diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index d199c8f17..ec7e6900b 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -5,10 +5,12 @@ x-common-variables: &common-variables services: gitlab: - image: gitlab/gitlab-ce:16.0.1-ce.0 + image: gitlab/gitlab-ce:19.0.1-ce.0 container_name: gitlab restart: unless-stopped hostname: gitlab + privileged: true + shm_size: '256m' environment: <<: *common-variables GITLAB_OMNIBUS_CONFIG: | @@ -24,7 +26,6 @@ services: redis_exporter['enable'] = false postgres_exporter['enable'] = false gitlab_exporter['enable'] = false - grafana['enable'] = false entrypoint: - /bin/sh - -c @@ -43,7 +44,7 @@ services: token.set_token(ENV["GITLAB_PERSONAL_ACCESS_TOKEN"]) token.save! EOF - exec /assets/wrapper + exec /assets/init-container ports: - '8080:80' - '8443:443' diff --git a/.gitignore b/.gitignore index 49f149017..e2fe8bab2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ test-results .DS_Store yarn-error.log .env -.npmrc .turbo tmp .nx @@ -22,3 +21,4 @@ tmp !.yarn/releases !.yarn/sdks !.yarn/versions +.gitlab-master-doc-api \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..c7e1d6377 --- /dev/null +++ b/.npmrc @@ -0,0 +1,10 @@ +auto-install-peers=true +dedupe-peer-dependents=false + +# Overrides +overrides.lodash=>=4.18.1 +overrides.tar=^7.5.13 +overrides.undici=>=8.0.2 + +# Build configuration +enable-pre-post-scripts=true \ No newline at end of file diff --git a/package.json b/package.json index 4ca98ad97..1158f7169 100644 --- a/package.json +++ b/package.json @@ -7,16 +7,6 @@ "url": "https://github.com/jdalrymple/gitbeaker/issues" }, "author": "Justin Dalrymple", - "pnpm": { - "overrides": { - "lodash": ">=4.18.1", - "tar": "^7.5.13", - "undici": ">=8.0.2" - }, - "ignoredBuiltDependencies": [ - "nx" - ] - }, "scripts": { "build": "nx run-many --target=build", "lint": "nx run-many --target=lint", @@ -58,5 +48,5 @@ "typescript": "^5.9.3", "vitest": "^4.1.5" }, - "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319" + "packageManager": "pnpm@11.5.2+sha512.71c631e382066efc25625d5cf029075de07b61b37f6e27350fbd84b1bda5864c8c1967adc280776b45c30a715c0359a3be08fef42d5bb09e2b99029979692916" } diff --git a/packages/cli/package.json b/packages/cli/package.json index 2bbbefa32..6ff30ead2 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -4,7 +4,7 @@ "description": "CLI implementation of the GitLab API.", "license": "MIT", "engines": { - "node": ">=18.20.0" + "node": ">=v24.16.0" }, "repository": { "type": "git", diff --git a/packages/core/README.md b/packages/core/README.md index fabfcc937..373329c35 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -103,12 +103,21 @@ import { Gitlab } from '@gitbeaker/core'; -Agents +AICatalog -🦊 +🦊 -⌨️ +⌨️ + + + +ClusterAgents + +🦊 + + +⌨️ @@ -186,7 +195,7 @@ import { Gitlab } from '@gitbeaker/core'; Branches -🦊 +🦊 ⌨️ @@ -195,16 +204,25 @@ import { Gitlab } from '@gitbeaker/core'; BroadcastMessages -🦊 +🦊 ⌨️ +BulkImports + +🦊 + + +⌨️ + + + CommitDiscussions -🦊 +🦊 ⌨️ @@ -213,7 +231,7 @@ import { Gitlab } from '@gitbeaker/core'; Code Suggestions -🦊 +🦊 ⌨️ @@ -222,13 +240,22 @@ import { Gitlab } from '@gitbeaker/core'; Commits -🦊 +🦊 ⌨️ +CompliancePolicySettings + +🦊 + + +⌨️ + + + Composer 🦊 @@ -247,147 +274,138 @@ import { Gitlab } from '@gitbeaker/core'; -ContainerRegistry +ConanV2 -🦊 +🦊 -⌨️ +⌨️ -DashboardAnnotations +DataManagement -🦊 +🦊 -⌨️ +⌨️ -Debian +DatabaseMigrations -🦊 +🦊 -⌨️ +⌨️ -DependencyProxy +ContainerRegistry -🦊 +🦊 -⌨️ +⌨️ -DeployKeys +ContainerRegistryProtectionTagRules -🦊 +🦊 -⌨️ +⌨️ -DeployTokens +ContainerRepositoryProtectionRules -🦊 +🦊 -⌨️ +⌨️ -Deployments +ContainerVirtualRegistry -🦊 +🦊 -⌨️ +⌨️ -DockerfileTemplates - -🦊 - - -⌨️ - - - -Environments +Debian -🦊 +🦊 -⌨️ +⌨️ -EpicAwardEmojis +Dependencies -🦊 +🦊 -⌨️ +⌨️ -EpicDiscussions +DependencyListExport -🦊 +🦊 -⌨️ +⌨️ -EpicIssues +DependencyProxy -🦊 +🦊 -⌨️ +⌨️ -EpicLabelEvents +DeployKeys -🦊 +🦊 -⌨️ +⌨️ -EpicLinks +DeployTokens -🦊 +🦊 -⌨️ +⌨️ -EpicNotes +Deployments -🦊 +🦊 -⌨️ +⌨️ -Epics +Environments -🦊 +🦊 -⌨️ +⌨️ @@ -427,6 +445,15 @@ import { Gitlab } from '@gitbeaker/core'; +ExternalControls + +🦊 + + +⌨️ + + + ExternalStatusChecks 🦊 @@ -454,48 +481,48 @@ import { Gitlab } from '@gitbeaker/core'; -FreezePeriods +Features -🦊 +🦊 -⌨️ +⌨️ -GeoNodes +Flows -🦊 +🦊 -⌨️ +⌨️ -GeoSites +FreezePeriods -🦊 +🦊 -⌨️ +⌨️ -GitLabCIYMLTemplates +GeoSites -🦊 +🦊 -⌨️ +⌨️ -GitignoreTemplates +GitLabDuoChat -🦊 +🦊 -⌨️ +⌨️ @@ -517,9 +544,18 @@ import { Gitlab } from '@gitbeaker/core'; +GoogleCloudIntegration + +🦊 + + +⌨️ + + + GroupAccessRequests -🦊 +🦊 ⌨️ @@ -544,15 +580,6 @@ import { Gitlab } from '@gitbeaker/core'; - -GroupEpicBoards - -🦊 - - -⌨️ - - GroupBadges 🦊 @@ -571,9 +598,27 @@ import { Gitlab } from '@gitbeaker/core'; +GroupEnterpriseUsers + +🦊 + + +⌨️ + + + +GroupEpicBoards + +🦊 + + +⌨️ + + + GroupDORA4Metrics -🦊 +🦊 ⌨️ @@ -598,6 +643,15 @@ import { Gitlab } from '@gitbeaker/core'; +GroupIntegrations + +🦊 + + +⌨️ + + + GroupInvitations 🦊 @@ -679,6 +733,15 @@ import { Gitlab } from '@gitbeaker/core'; +GroupProtectedBranches + +🦊 + + +⌨️ + + + GroupProtectedEnvironments 🦊 @@ -769,6 +832,15 @@ import { Gitlab } from '@gitbeaker/core'; +GroupWikiNotes + +🦊 + + +⌨️ + + + GroupWikis 🦊 @@ -825,7 +897,7 @@ import { Gitlab } from '@gitbeaker/core'; IssueAwardEmojis -🦊 +🦊 ⌨️ @@ -834,7 +906,7 @@ import { Gitlab } from '@gitbeaker/core'; IssueDiscussions -🦊 +🦊 ⌨️ @@ -879,7 +951,7 @@ import { Gitlab } from '@gitbeaker/core'; IssueNoteAwardEmojis -🦊 +🦊 ⌨️ @@ -967,24 +1039,6 @@ import { Gitlab } from '@gitbeaker/core'; -LicenseTemplates - -🦊 - - -⌨️ - - - -LinkedEpics - -🦊 - - -⌨️ - - - Lint 🦊 @@ -1021,9 +1075,18 @@ import { Gitlab } from '@gitbeaker/core'; +MergeRequestApprovalSettings + +🦊 + + +⌨️ + + + MergeRequestAwardEmojis -🦊 +🦊 ⌨️ @@ -1041,7 +1104,7 @@ import { Gitlab } from '@gitbeaker/core'; MergeRequestDiscussions -🦊 +🦊 ⌨️ @@ -1050,7 +1113,7 @@ import { Gitlab } from '@gitbeaker/core'; MergeRequestDraftNotes -🦊 +🦊 ⌨️ @@ -1077,7 +1140,7 @@ import { Gitlab } from '@gitbeaker/core'; MergeRequestNoteAwardEmojis -🦊 +🦊 ⌨️ @@ -1113,13 +1176,22 @@ import { Gitlab } from '@gitbeaker/core'; Metadata -🦊 +🦊 ⌨️ +ModelRegistry + +🦊 + + +⌨️ + + + Migrations 🦊 @@ -1248,7 +1320,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectAccessRequests -🦊 +🦊 ⌨️ @@ -1257,7 +1329,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectAccessTokens -🦊 +🦊 ⌨️ @@ -1266,7 +1338,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectAliases -🦊 +🦊 ⌨️ @@ -1275,7 +1347,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectBadges -🦊 +🦊 ⌨️ @@ -1293,7 +1365,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectDORA4Metrics -🦊 +🦊 ⌨️ @@ -1311,7 +1383,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectImportExports -🦊 +🦊 ⌨️ @@ -1446,7 +1518,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectSnippetAwardEmojis -🦊 +🦊 ⌨️ @@ -1455,7 +1527,7 @@ import { Gitlab } from '@gitbeaker/core'; ProjectSnippetDiscussions -🦊 +🦊 ⌨️ @@ -1516,6 +1588,15 @@ import { Gitlab } from '@gitbeaker/core'; +ProjectWikiNotes + +🦊 + + +⌨️ + + + ProjectWikis 🦊 @@ -1527,19 +1608,19 @@ import { Gitlab } from '@gitbeaker/core'; Projects -🦊 +🦊 ⌨️ -ProtectedBranches +ProjectProtectedBranches 🦊 -⌨️ +⌨️ @@ -1732,6 +1813,15 @@ import { Gitlab } from '@gitbeaker/core'; +TerraformModules + +🦊 + + +⌨️ + + + TodoLists 🦊 diff --git a/packages/core/package.json b/packages/core/package.json index 1417af54f..2a524ec9a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,7 +4,7 @@ "description": "Core API implementation of the GitLab API", "license": "MIT", "engines": { - "node": ">=18.20.0" + "node": ">=v24.16.0" }, "repository": { "type": "git", diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index dacacc74e..02bd4f3cc 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -2,7 +2,9 @@ export enum AccessLevel { NO_ACCESS = 0, MINIMAL_ACCESS = 5, GUEST = 10, + PLANNER = 15, REPORTER = 20, + SECURITY_MANAGER = 25, DEVELOPER = 30, MAINTAINER = 40, OWNER = 50, diff --git a/packages/core/src/resources/AICatalog.ts b/packages/core/src/resources/AICatalog.ts new file mode 100644 index 000000000..620ba7b3f --- /dev/null +++ b/packages/core/src/resources/AICatalog.ts @@ -0,0 +1,22 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export class AICatalog extends BaseResource { + seedExternalAgents( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post<{ message: string }>()( + this, + 'admin/ai_catalog/seed_external_agents', + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/ApplicationAppearance.ts b/packages/core/src/resources/ApplicationAppearance.ts index 34d9b203b..220476b61 100644 --- a/packages/core/src/resources/ApplicationAppearance.ts +++ b/packages/core/src/resources/ApplicationAppearance.ts @@ -19,6 +19,7 @@ export interface ApplicationAppearanceSchema extends Record { logo: string; header_logo: string; favicon: string; + member_guidelines: string; new_project_guidelines: string; profile_image_guidelines: string; header_message: string; @@ -26,6 +27,7 @@ export interface ApplicationAppearanceSchema extends Record { message_background_color: string; message_font_color: string; email_header_and_footer_enabled: boolean; + site_name: string; } export class ApplicationAppearance extends BaseResource { diff --git a/packages/core/src/resources/ApplicationSettings.ts b/packages/core/src/resources/ApplicationSettings.ts index 29adbd460..db02e6bfa 100644 --- a/packages/core/src/resources/ApplicationSettings.ts +++ b/packages/core/src/resources/ApplicationSettings.ts @@ -10,6 +10,12 @@ import type { import { RequestHelper } from '../infrastructure'; export interface ApplicationSettingsSchema extends Record { + // Core settings + id?: number; + created_at?: string; + updated_at?: string; + + // Authentication & security admin_mode?: boolean; admin_notification_email?: string; abuse_notification_email?: string; @@ -17,25 +23,69 @@ export interface ApplicationSettingsSchema extends Record { after_sign_up_text?: string; akismet_api_key?: string; akismet_enabled?: boolean; + allow_account_deletion?: boolean; allow_group_owners_to_manage_ldap?: boolean; allow_local_requests_from_hooks_and_services?: boolean; allow_local_requests_from_system_hooks?: boolean; allow_local_requests_from_web_hooks_and_services?: boolean; + allow_project_creation_for_guest_and_below?: boolean; allow_runner_registration_token?: boolean; - archive_builds_in_human_readable?: string; + authorized_keys_enabled?: boolean; + + // Asset proxy settings asset_proxy_enabled?: boolean; asset_proxy_secret_key?: string; asset_proxy_url?: string; asset_proxy_whitelist?: string | string[]; asset_proxy_allowlist?: string | string[]; - authorized_keys_enabled?: boolean; + + // Archive and timeout settings + archive_builds_in_human_readable?: string; + authn_data_retention_cleanup_enabled?: boolean; + + // Auto DevOps auto_devops_domain?: string; auto_devops_enabled?: boolean; automatic_purchased_storage_allocation?: boolean; + + // Rate limiting and API limits + autocomplete_users?: number; + autocomplete_users_unauthenticated?: number; + + // Import/Export settings bulk_import_enabled?: boolean; + bulk_import_max_download_file_size?: number; + bulk_import_concurrent_pipeline_batch_limit?: number; + + // User management + allow_bypass_placeholder_confirmation?: boolean; + allow_s3_compatible_storage_for_offline_transfer?: boolean; can_create_group?: boolean; check_namespace_plan?: boolean; + + // CI/CD settings + ci_delete_pipelines_in_seconds_limit_human_readable?: string; + ci_job_live_trace_enabled?: boolean; + git_push_pipeline_limit?: number; + ci_max_total_yaml_size_bytes?: number; + ci_max_includes?: number; + ci_partitions_in_seconds_limit?: number; + + // Import job limits + concurrent_github_import_jobs_limit?: number; + concurrent_bitbucket_import_jobs_limit?: number; + concurrent_bitbucket_server_import_jobs_limit?: number; + concurrent_relation_batch_export_limit?: number; + + // Email settings commit_email_hostname?: string; + email_additional_text?: string; + email_author_in_body?: boolean; + email_confirmation_setting?: string; + email_restrictions_enabled?: boolean; + email_restrictions?: string; + + // Container registry container_expiration_policies_enable_historic_entries?: boolean; container_registry_cleanup_tags_service_max_list_size?: number; container_registry_delete_tags_service_timeout?: number; @@ -43,11 +93,26 @@ export interface ApplicationSettingsSchema extends Record { container_registry_expiration_policies_worker_capacity?: number; container_registry_token_expire_delay?: number; package_registry_cleanup_policies_worker_capacity?: number; + + // HTTP settings + custom_http_clone_url_root?: string; + + // User deactivation deactivate_dormant_users?: boolean; deactivate_dormant_users_period?: number; + + // Archive decompression + decompress_archive_file_timeout?: number; + + // Default settings default_artifacts_expire_in?: string; default_branch_name?: string; default_branch_protection?: number; + default_branch_protection_defaults?: { + allowed_to_push?: Array<{ access_level?: number }>; + allow_force_push?: boolean; + allowed_to_merge?: Array<{ access_level?: number }>; + }; default_ci_config_path?: string; default_group_visibility?: string; default_preferred_language?: string; @@ -56,51 +121,91 @@ export interface ApplicationSettingsSchema extends Record { default_projects_limit?: number; default_snippet_visibility?: string; default_syntax_highlighting_theme?: number; - delayed_project_deletion?: boolean; - delayed_group_deletion?: boolean; + default_dark_syntax_highlighting_theme?: number; + default_project_deletion_protection?: boolean; + + // User deletion settings + delete_unconfirmed_users?: boolean; deletion_adjourned_period?: number; + + // Content size limits + description_and_note_max_size?: number; + + // Diagrams.net integration + diagramsnet_enabled?: boolean; + diagramsnet_url?: string; + + // Diff limits diff_max_patch_bytes?: number; diff_max_files?: number; diff_max_lines?: number; + diff_max_versions?: number; + diff_max_commits?: number; + + // OAuth and access control disable_admin_oauth_scopes?: boolean; disable_feed_token?: boolean; - disable_personal_access_token?: boolean; + disable_personal_access_tokens?: boolean; disabled_oauth_sign_in_sources?: string[]; + disable_password_authentication_for_users_with_sso_identities?: boolean; + + // DNS and domain settings dns_rebinding_protection_enabled?: boolean; domain_denylist_enabled?: boolean; domain_denylist?: string[]; domain_allowlist?: string[]; + downstream_pipeline_trigger_limit_per_project_user_sha?: number; + + // Key restrictions dsa_key_restriction?: number; ecdsa_key_restriction?: number; ecdsa_sk_key_restriction?: number; ed25519_key_restriction?: number; ed25519_sk_key_restriction?: number; + + // AWS EKS integration eks_access_key_id?: string; eks_account_id?: string; eks_integration_enabled?: boolean; eks_secret_access_key?: string; + + // Elasticsearch settings elasticsearch_aws_access_key?: string; elasticsearch_aws_region?: string; elasticsearch_aws_secret_access_key?: string; elasticsearch_aws?: boolean; + elasticsearch_client_adapter?: string; elasticsearch_indexed_field_length_limit?: number; elasticsearch_indexed_file_size_limit_kb?: number; elasticsearch_indexing?: boolean; + elasticsearch_requeue_workers?: boolean; elasticsearch_limit_indexing?: boolean; elasticsearch_max_bulk_concurrency?: number; + elasticsearch_max_code_indexing_concurrency?: number; + elasticsearch_worker_number_of_shards?: number; elasticsearch_max_bulk_size_mb?: number; elasticsearch_namespace_ids?: number[]; elasticsearch_project_ids?: number[]; elasticsearch_search?: boolean; - elasticsearch_url?: string; + elasticsearch_url?: string | string[]; elasticsearch_username?: string; elasticsearch_password?: string; - email_additional_text?: string; - email_author_in_body?: boolean; - email_confirmation_setting?: string; + elasticsearch_prefix?: string; + elasticsearch_retry_on_failure?: number; + elasticsearch_shards?: number | Record; + elasticsearch_replicas?: number | Record; + elasticsearch_index_settings?: Array<{ + alias_name?: string; + number_of_shards?: number; + number_of_replicas?: number; + }>; + + // Protocol and access settings enabled_git_access_protocol?: string; enforce_namespace_storage_limit?: boolean; enforce_terms?: boolean; + + // External authorization external_auth_client_cert?: string; external_auth_client_key_pass?: string; external_auth_client_key?: string; @@ -108,162 +213,508 @@ export interface ApplicationSettingsSchema extends Record { external_authorization_service_enabled?: boolean; external_authorization_service_timeout?: number; external_authorization_service_url?: string; + + // Pipeline validation external_pipeline_validation_service_url?: string; external_pipeline_validation_service_token?: string; external_pipeline_validation_service_timeout?: number; + + // Static objects storage + static_objects_external_storage_url?: string; + static_objects_external_storage_auth_token?: string; + + // Security settings + failed_login_attempts_unlock_period_in_minutes?: number; file_template_project_id?: number; first_day_of_week?: number; + floc_enabled?: boolean; + + // IP allowlists + globally_allowed_ips?: string; geo_node_allowed_ips?: string; geo_status_timeout?: number; + + // Two-factor authentication for Git git_two_factor_session_expiry?: number; + + // Gitaly timeouts gitaly_timeout_default?: number; gitaly_timeout_fast?: number; gitaly_timeout_medium?: number; + + // Instance identification gitlab_dedicated_instance?: boolean; + gitlab_environment_toolkit_instance?: boolean; + gitlab_shell_operation_limit?: number; + + // Grafana integration grafana_enabled?: boolean; grafana_url?: string; gravatar_enabled?: boolean; group_owners_can_manage_default_branch_protection?: boolean; + + // Storage settings hashed_storage_enabled?: boolean; + + // Help page settings help_page_hide_commercial_content?: boolean; help_page_support_url?: string; + help_page_documentation_base_url?: string; help_page_text?: string; - help_text?: string; hide_third_party_offers?: boolean; home_page_url?: string; + + // Git housekeeping + housekeeping_bitmaps_enabled?: boolean; housekeeping_enabled?: boolean; + housekeeping_full_repack_period?: number; + housekeeping_gc_period?: number; + housekeeping_incremental_repack_period?: number; housekeeping_optimize_repository_period?: number; html_emails_enabled?: boolean; + + // Import sources import_sources?: string[]; - in_product_marketing_emails_enabled?: boolean; + + // CAPTCHA settings invisible_captcha_enabled?: boolean; + + // Rate limits issues_create_limit?: number; + + // Jira integration + jira_connect_application_key?: string; + jira_connect_public_key_storage_enabled?: boolean; + jira_connect_proxy_url?: string; + jira_connect_additional_audience_url?: string; + + // Artifact settings keep_latest_artifact?: boolean; + + // Kroki integration + kroki_enabled?: boolean; + kroki_url?: string; + kroki_formats?: Record; + kroki_diagram_proxy_enabled?: boolean; + + // Markdown settings local_markdown_version?: number; + + // SAML membership locking + lock_memberships_to_saml?: boolean; + + // Mailgun integration mailgun_signing_key?: string; mailgun_events_enabled?: boolean; + + // Maintenance mode maintenance_mode_message?: string; maintenance_mode?: boolean; + + // Size limits max_artifacts_size?: number; max_attachment_size?: number; + max_decompressed_archive_size?: number; max_export_size?: number; + max_github_response_size_limit?: number; + max_github_response_json_value_count?: number; + max_http_decompressed_size?: number; + max_http_response_json_depth?: number; + max_http_response_json_structural_chars?: number; + max_http_response_xml_structural_chars?: number; + max_http_response_csv_structural_chars?: number; + max_http_response_size_limit?: number; max_import_size?: number; + max_import_remote_file_size?: number; + max_login_attempts?: number; max_pages_size?: number; max_personal_access_token_lifetime?: number; max_ssh_key_lifetime?: number; max_terraform_state_size_bytes?: number; + + // Performance metrics metrics_method_call_threshold?: number; + + // Repository download limits max_number_of_repository_downloads?: number; max_number_of_repository_downloads_within_time_period?: number; + + // YAML limits + max_yaml_depth?: number; + max_yaml_size_bytes?: number; + + // Git rate limiting git_rate_limit_users_allowlist?: string[]; git_rate_limit_users_alertlist?: number[]; auto_ban_user_on_excessive_projects_download?: boolean; + + // Repository mirroring mirror_available?: boolean; mirror_capacity_threshold?: number; mirror_max_capacity?: number; mirror_max_delay?: number; + + // Package forwarding maven_package_requests_forwarding?: boolean; npm_package_requests_forwarding?: boolean; pypi_package_requests_forwarding?: boolean; + + // Local request allowlists outbound_local_requests_whitelist?: string[]; + + // Package registry settings + package_registry_allow_anyone_to_pull_option?: boolean; + package_metadata_purl_types?: number[]; + + // Pages settings pages_domain_verification_enabled?: boolean; + pages_unique_domain_default_enabled?: boolean; + + // Password authentication password_authentication_enabled_for_git?: boolean; password_authentication_enabled_for_web?: boolean; + + // Password requirements + minimum_password_length?: number; password_number_required?: boolean; password_symbol_required?: boolean; password_uppercase_required?: boolean; password_lowercase_required?: boolean; + + // Performance bar + performance_bar_allowed_group_id?: string; performance_bar_allowed_group_path?: string; + performance_bar_enabled?: boolean; + + // Access tokens personal_access_token_prefix?: string; + + // Pipeline limits pipeline_limit_per_project_user_sha?: number; + pipeline_limit_per_user?: number; + + // Gitpod integration + gitpod_enabled?: boolean; + gitpod_url?: string; + + // Token settings + inactive_resource_access_tokens_delete_after_days?: number; + + // PlantUML integration plantuml_enabled?: boolean; plantuml_url?: string; + plantuml_diagram_proxy_enabled?: boolean; + + // Polling settings polling_interval_multiplier?: number; + + // Project settings project_export_enabled?: boolean; + project_jobs_api_rate_limit?: number; projects_api_rate_limit_unauthenticated?: number; + + // Runner API rate limits + runner_jobs_request_api_limit?: number; + runner_jobs_patch_trace_api_limit?: number; + runner_jobs_endpoints_api_limit?: number; + + // User API rate limits + users_api_limit_following?: number; + users_api_limit_followers?: number; + users_api_limit_status?: number; + users_api_limit_keys?: number; + users_api_limit_key?: number; + users_api_limit_gpg_keys?: number; + users_api_limit_gpg_key?: number; + + // Virtual registries + virtual_registries_endpoints_api_limit?: number; + + // Secrets limits + project_secrets_limit?: number; + group_secrets_limit?: number; + + // Prometheus settings prometheus_metrics_enabled?: boolean; protected_ci_variables?: boolean; + + // Approval settings + disable_overriding_approvers_per_merge_request?: boolean; + prevent_merge_requests_author_approval?: boolean; + prevent_merge_requests_committers_approval?: boolean; + + // Event limits push_event_activities_limit?: number; push_event_hooks_limit?: number; + + // Rate limiting response rate_limiting_response_text?: string; + + // Raw blob limits raw_blob_request_limit?: number; + raw_blob_request_limit_unauthenticated?: number; + + // Search rate limits search_rate_limit?: number; search_rate_limit_unauthenticated?: number; + + // reCAPTCHA settings recaptcha_enabled?: boolean; + login_recaptcha_protection_enabled?: boolean; recaptcha_private_key?: string; recaptcha_site_key?: string; + + // Receptive cluster agents + receptive_cluster_agents_enabled?: boolean; + + // Repository settings receive_max_input_size?: number; + relation_export_batch_size?: number; + remember_me_enabled?: boolean; repository_checks_enabled?: boolean; repository_size_limit?: number; repository_storages_weighted?: Record; - repository_storages?: string[]; + + // User signup and approval require_admin_approval_after_user_signup?: boolean; + require_email_verification_on_account_locked?: boolean; + require_personal_access_token_expiry?: boolean; require_two_factor_authentication?: boolean; + + // Resource limits + resource_usage_limits?: Record; restricted_visibility_levels?: string[]; rsa_key_restriction?: number; + + // Session settings session_expire_delay?: number; + session_expire_from_init?: boolean; + + // Security policies + security_policy_global_group_approvers_enabled?: boolean; + security_approval_policies_limit?: number; + scan_execution_policies_action_limit?: number; + scan_execution_policies_schedule_limit?: number; + + // Security settings + security_txt_content?: string; + security_mr_report_cache_lifetime_minutes?: number; + security_scan_stale_after_days?: number; + + // Service access tokens + service_access_tokens_expiration_enforced?: boolean; + + // Shared runners shared_runners_enabled?: boolean; shared_runners_minutes?: number; shared_runners_text?: string; + + // Runner token expiration + runner_token_expiration_interval?: number; + group_runner_token_expiration_interval?: number; + project_runner_token_expiration_interval?: number; + + // Sidekiq settings sidekiq_job_limiter_mode?: string; sidekiq_job_limiter_compression_threshold_bytes?: number; sidekiq_job_limiter_limit_bytes?: number; - sign_in_text?: string; + + // Sign-in settings + signin_enabled?: string; + sign_in_restrictions?: Record; signup_enabled?: boolean; + silent_admin_exports_enabled?: boolean; + silent_mode_enabled?: boolean; + + // Slack integration slack_app_enabled?: boolean; slack_app_id?: string; slack_app_secret?: string; slack_app_signing_secret?: string; slack_app_verification_token?: string; + + // Content size limits snippet_size_limit?: number; + + // Snowplow analytics snowplow_app_id?: string; snowplow_collector_hostname?: string; + snowplow_database_collector_hostname?: string; snowplow_cookie_domain?: string; snowplow_enabled?: boolean; + + // Sourcegraph integration sourcegraph_enabled?: boolean; sourcegraph_public_only?: boolean; sourcegraph_url?: string; + + // Spam checking spam_check_endpoint_enabled?: boolean; spam_check_endpoint_url?: string; spam_check_api_key?: string; + + // Pipeline suggestions suggest_pipeline_enabled?: boolean; + + // External redirect warning + enable_artifact_external_redirect_warning_page?: boolean; + + // Terminal settings terminal_max_session_time?: number; terms?: string; + + // Throttling settings - Authenticated API throttle_authenticated_api_enabled?: boolean; throttle_authenticated_api_period_in_seconds?: number; throttle_authenticated_api_requests_per_period?: number; + + // Throttling settings - Authenticated Git HTTP + throttle_authenticated_git_http_enabled?: boolean; + throttle_authenticated_git_http_period_in_seconds?: number; + throttle_authenticated_git_http_requests_per_period?: number; + + // Throttling settings - Authenticated Packages API throttle_authenticated_packages_api_enabled?: boolean; throttle_authenticated_packages_api_period_in_seconds?: number; throttle_authenticated_packages_api_requests_per_period?: number; + + // Throttling settings - Authenticated Web throttle_authenticated_web_enabled?: boolean; throttle_authenticated_web_period_in_seconds?: number; throttle_authenticated_web_requests_per_period?: number; + + // Throttling settings - Unauthenticated (deprecated) + throttle_unauthenticated_enabled?: boolean; + throttle_unauthenticated_period_in_seconds?: number; + throttle_unauthenticated_requests_per_period?: number; + + // Throttling settings - Unauthenticated API throttle_unauthenticated_api_enabled?: boolean; throttle_unauthenticated_api_period_in_seconds?: number; throttle_unauthenticated_api_requests_per_period?: number; + + // Throttling settings - Unauthenticated Git HTTP + throttle_unauthenticated_git_http_enabled?: boolean; + throttle_unauthenticated_git_http_period_in_seconds?: number; + throttle_unauthenticated_git_http_requests_per_period?: number; + + // Throttling settings - Unauthenticated Packages API throttle_unauthenticated_packages_api_enabled?: boolean; throttle_unauthenticated_packages_api_period_in_seconds?: number; throttle_unauthenticated_packages_api_requests_per_period?: number; + + // Throttling settings - Unauthenticated Web throttle_unauthenticated_web_enabled?: boolean; throttle_unauthenticated_web_period_in_seconds?: number; throttle_unauthenticated_web_requests_per_period?: number; + + // Time tracking time_tracking_limit_to_hours?: boolean; + + // Group creation + top_level_group_creation_enabled?: boolean; + + // Two-factor authentication two_factor_grace_period?: number; + + // User deletion settings + unconfirmed_users_delete_after_days?: number; + updating_name_disabled_for_users?: boolean; + + // IP limiting unique_ips_limit_enabled?: boolean; unique_ips_limit_per_user?: number; unique_ips_limit_time_window?: number; + + // Runner version updates + update_runner_versions_enabled?: boolean; + + // Usage data usage_ping_enabled?: boolean; + gitlab_product_usage_data_enabled?: boolean; + gitlab_product_usage_data_source?: string; + use_clickhouse_for_analytics?: boolean; + include_optional_metrics_in_service_ping?: boolean; + + // User settings user_deactivation_emails_enabled?: boolean; user_default_external?: boolean; user_default_internal_regex?: string; user_defaults_to_private_profile?: boolean; user_oauth_applications?: boolean; user_show_add_ssh_key_message?: boolean; + + // Valid runner registrars + valid_runner_registrars?: string[]; + + // Version checking version_check_enabled?: boolean; + + // VS Code integration + vscode_extension_marketplace?: Record; + + // What's new feature whats_new_variant?: string; + + // Wiki settings wiki_page_max_content_bytes?: number; - jira_connect_application_key?: string; - jira_connect_proxy_url?: string; + + // Dormant project settings + delete_inactive_projects?: boolean; + inactive_projects_delete_after_months?: number; + inactive_projects_min_size_mb?: number; + inactive_projects_send_warning_email_after_months?: number; + + // AsciiDoc settings + asciidoc_max_includes?: number; + + // GitLab Duo features + duo_custom_agents_enabled?: boolean; + duo_custom_flows_enabled?: boolean; + duo_features_enabled?: boolean; + lock_duo_custom_agents_enabled?: boolean; + lock_duo_custom_flows_enabled?: boolean; + lock_duo_features_enabled?: boolean; + + // NuGet settings + nuget_skip_metadata_url_validation?: boolean; + + // Helm settings + helm_max_packages_count?: number; + + // Admin two-factor authentication + require_admin_two_factor_authentication?: boolean; + + // Secret push protection + secret_push_protection_available?: boolean; + + // Member invitations + disable_invite_members?: boolean; + + // PIPL compliance + enforce_pipl_compliance?: boolean; + + // Additional notification settings + notify_on_unknown_sign_in?: boolean; + + // Iframe rendering + iframe_rendering_enabled?: boolean; + iframe_rendering_allowlist?: string[]; + + // Usage billing settings + usage_billing?: Record; + + // Model prompt cache + model_prompt_cache_enabled?: boolean; + lock_model_prompt_cache_enabled?: boolean; + + // Security scan dependencies + dependency_scanning_sbom_scan_api_download_limit?: number; + dependency_scanning_sbom_scan_api_upload_limit?: number; + + // Integration allowlists + allow_all_integrations?: boolean; + allowed_integrations?: string[]; } export class ApplicationSettings extends BaseResource { diff --git a/packages/core/src/resources/ApplicationStatistics.ts b/packages/core/src/resources/ApplicationStatistics.ts index 098126c5b..052543eea 100644 --- a/packages/core/src/resources/ApplicationStatistics.ts +++ b/packages/core/src/resources/ApplicationStatistics.ts @@ -5,17 +5,17 @@ import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; import { RequestHelper } from '../infrastructure'; export interface ApplicationStatisticSchema extends Record { - forks: string; - issues: string; - merge_requests: string; - notes: string; - snippets: string; - ssh_keys: string; - milestones: string; - users: string; - groups: string; - projects: string; - active_users: string; + forks: number; + issues: number; + merge_requests: number; + notes: number; + snippets: number; + ssh_keys: number; + milestones: number; + users: number; + groups: number; + projects: number; + active_users: number; } export class ApplicationStatistics extends BaseResource { diff --git a/packages/core/src/resources/Applications.ts b/packages/core/src/resources/Applications.ts index ec813ae8e..882709e4f 100644 --- a/packages/core/src/resources/Applications.ts +++ b/packages/core/src/resources/Applications.ts @@ -14,9 +14,10 @@ export interface ApplicationSchema extends Record { id: number; application_id: string; application_name: string; - secret: string; + secret?: string; callback_url: string; confidential: boolean; + scopes: string[]; } export class Applications extends BaseResource { @@ -64,4 +65,20 @@ export class Applications extends BaseResource { showExpanded, }); } + + renewSecret( + applicationId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + `applications/${applicationId}/renew-secret`, + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/Attestations.ts b/packages/core/src/resources/Attestations.ts new file mode 100644 index 000000000..f8e97fb59 --- /dev/null +++ b/packages/core/src/resources/Attestations.ts @@ -0,0 +1,74 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface AttestationSchema extends Record { + id: number; + iid: number; + created_at: string; + updated_at: string; + expire_at: string; + project_id: number; + build_id: number; + status: string; + predicate_kind: string; + predicate_type: string; + subject_digest: string; + download_url: string; +} + +export interface SigstoreBundleSchema extends Record { + mediaType: string; + verificationMaterial: { + certificate: { + rawBytes: string; + }; + tlogEntries: unknown[]; + }; +} + +export class Attestations extends BaseResource { + all( + projectId: string | number, + subjectDigest: string, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/attestations/${subjectDigest}`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + download( + projectId: string | number, + attestationIid: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/attestations/${attestationIid}/download`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/AuditEvents.ts b/packages/core/src/resources/AuditEvents.ts index 1627de059..d6f9f5c5b 100644 --- a/packages/core/src/resources/AuditEvents.ts +++ b/packages/core/src/resources/AuditEvents.ts @@ -17,25 +17,49 @@ export interface AuditEventSchema extends Record { entity_id: number; entity_type: string; details: { + // Change-related fields change?: string; from?: string; to?: string; + add?: string; + remove?: string; + + // Message fields custom_message?: string; - author_name: string; - author_email: string; - target_id: string; - target_type: string; - target_details: string; - ip_address: string; - entity_path: string; + + // Author information + author_name?: string; + author_email?: string; + author_class?: string; + + // Target information + target_id?: string | number; + target_type?: string; + target_details?: string; + + // Network and location + ip_address?: string | null; + entity_path?: string; + + // Additional dynamic fields that can appear in details + [key: string]: unknown; }; created_at: string; + + // Optional top-level fields that may appear in responses + ip_address?: string; + author_name?: string; + entity_path?: string; + target_details?: string; + target_type?: string; + target_id?: number; + event_type?: string; } export interface AllAuditEventOptions { createdAfter?: string; createdBefore?: string; - entityType?: string; + entityType?: 'User' | 'Group' | 'Project' | 'Gitlab::Audit::InstanceScope' | string; entityId?: number; } diff --git a/packages/core/src/resources/Avatar.ts b/packages/core/src/resources/Avatar.ts index 756527723..cd2255515 100644 --- a/packages/core/src/resources/Avatar.ts +++ b/packages/core/src/resources/Avatar.ts @@ -11,14 +11,14 @@ export interface AvatarSchema extends Record { export class Avatar extends BaseResource { show( email: string, - options?: ShowExpanded & Sudo, + options?: { size?: number } & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...searchParams } = options || {}; return RequestHelper.get()(this, 'avatar', { sudo, showExpanded, - searchParams: { email }, + searchParams: { email, ...searchParams }, }); } } diff --git a/packages/core/src/resources/Branches.ts b/packages/core/src/resources/Branches.ts index fdf97c889..0711b158b 100644 --- a/packages/core/src/resources/Branches.ts +++ b/packages/core/src/resources/Branches.ts @@ -2,7 +2,6 @@ import { BaseResource } from '@gitbeaker/requester-utils'; import type { GitlabAPIResponse, - MappedOmit, PaginationRequestOptions, PaginationTypes, ShowExpanded, @@ -21,7 +20,10 @@ export interface BranchSchema extends Record { developers_can_merge: boolean; can_push: boolean; web_url: string; - commit: MappedOmit; + commit: { + trailers?: Record; + extended_trailers?: Record; + } & CommitSchema; } export class Branches extends BaseResource { diff --git a/packages/core/src/resources/BroadcastMessages.ts b/packages/core/src/resources/BroadcastMessages.ts index 3304ebb33..b1050ef0c 100644 --- a/packages/core/src/resources/BroadcastMessages.ts +++ b/packages/core/src/resources/BroadcastMessages.ts @@ -10,23 +10,33 @@ import type { } from '../infrastructure'; import { AccessLevel } from '../constants'; -import { RequestHelper } from '../infrastructure'; +import { RequestHelper, endpoint } from '../infrastructure'; export interface BroadcastMessageSchema extends Record { message: string; starts_at: string; ends_at: string; - color: string; font: string; id: number; active: boolean; - target_path: string; - target_access_levels: Exclude< + target_path?: string; + target_access_levels?: Exclude< AccessLevel, AccessLevel.MINIMAL_ACCESS | AccessLevel.NO_ACCESS | AccessLevel.ADMIN >[]; - broadcast_type: string; - dismissible: boolean; + broadcast_type?: string; + dismissable?: boolean; + theme?: + | 'indigo' + | 'light-indigo' + | 'blue' + | 'light-blue' + | 'green' + | 'light-green' + | 'red' + | 'light-red' + | 'dark' + | 'light'; } type BroadcastMessageOptions = Partial>; @@ -46,14 +56,15 @@ export class BroadcastMessages extends BaseResource( - options?: BroadcastMessageOptions & ShowExpanded & Sudo, + message: string, + options?: Omit & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; return RequestHelper.post()(this, 'broadcast_messages', { sudo, showExpanded, - body, + body: { message, ...body }, }); } @@ -65,7 +76,7 @@ export class BroadcastMessages extends BaseResource()( this, - `broadcast_messages/${broadcastMessageId}`, + endpoint`broadcast_messages/${broadcastMessageId}`, { sudo, showExpanded, @@ -80,7 +91,7 @@ export class BroadcastMessages extends BaseResource> { const { sudo, showExpanded } = options || {}; - return RequestHelper.del()(this, `broadcast_messages/${broadcastMessageId}`, { + return RequestHelper.del()(this, endpoint`broadcast_messages/${broadcastMessageId}`, { sudo, showExpanded, }); @@ -94,7 +105,7 @@ export class BroadcastMessages extends BaseResource()( this, - `broadcast_messages/${broadcastMessageId}`, + endpoint`broadcast_messages/${broadcastMessageId}`, { sudo, showExpanded }, ); } diff --git a/packages/core/src/resources/BulkImports.ts b/packages/core/src/resources/BulkImports.ts new file mode 100644 index 000000000..e36e85ccd --- /dev/null +++ b/packages/core/src/resources/BulkImports.ts @@ -0,0 +1,200 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, + Camelize, +} from '../infrastructure'; + +import { RequestHelper, endpoint, getPrefixedUrl } from '../infrastructure'; + +export interface BulkImportConfigurationSchema extends Record { + url: string; + access_token: string; +} + +export interface BulkImportEntitySchema extends Record { + source_type: 'group_entity' | 'project_entity'; + source_full_path: string; + destination_slug: string; + destination_namespace: string; + destination_name?: string; + migrate_memberships?: boolean; + migrate_projects?: boolean; +} + +export interface BulkImportFailureSchema extends Record { + relation: string; + step: string; + exception_message: string; + exception_class: string; + correlation_id_value: string; + created_at: string; + pipeline_class: string; + pipeline_step: string; + source_url?: string; + source_title?: string; +} + +export interface BulkImportStatsSchema extends Record { + [key: string]: { + source: number; + fetched: number; + imported: number; + }; +} + +export interface BulkImportSchema extends Record { + id: number; + status: 'created' | 'started' | 'finished' | 'failed' | 'canceled'; + source_type: string; + source_url?: string; + created_at: string; + updated_at: string; + has_failures: boolean; +} + +export interface BulkImportEntityFullSchema extends Record { + id: number; + bulk_import_id: number; + status: 'created' | 'started' | 'finished' | 'failed'; + entity_type: 'group' | 'project'; + source_full_path: string; + destination_full_path: string; + destination_name: string; + destination_slug: string; + destination_namespace: string; + parent_id?: number | null; + namespace_id?: number | null; + project_id?: number | null; + created_at: string; + updated_at: string; + failures: BulkImportFailureSchema[]; + migrate_projects: boolean; + migrate_memberships: boolean; + has_failures: boolean; + stats: BulkImportStatsSchema; +} + +export type BulkImportStatus = 'created' | 'started' | 'finished' | 'failed'; + +export class BulkImports extends BaseResource { + create( + configuration: Camelize, + entities: Camelize[], + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()(this, 'bulk_imports', { + sudo, + showExpanded, + body: { + configuration, + entities, + }, + }); + } + + all( + options?: { status?: BulkImportStatus } & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'bulk_imports', { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, + }); + } + + allEntities( + options?: { + status?: BulkImportStatus; + bulkImportId?: string | number; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, bulkImportId, ...searchParams } = options || {}; + + const url = getPrefixedUrl('entities', { + bulk_imports: bulkImportId || true, + }); + + return RequestHelper.get()(this, url, { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, + }); + } + + show( + bulkImportId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()(this, endpoint`bulk_imports/${bulkImportId}`, { + sudo, + showExpanded, + }); + } + + showEntity( + bulkImportId: number, + entityId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`bulk_imports/${bulkImportId}/entities/${entityId}`, + { + sudo, + showExpanded, + }, + ); + } + + showEntityFailures( + bulkImportId: number, + entityId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`bulk_imports/${bulkImportId}/entities/${entityId}/failures`, + { + sudo, + showExpanded, + }, + ); + } + + cancel( + bulkImportId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + endpoint`bulk_imports/${bulkImportId}/cancel`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/Agents.ts b/packages/core/src/resources/ClusterAgents.ts similarity index 62% rename from packages/core/src/resources/Agents.ts rename to packages/core/src/resources/ClusterAgents.ts index e32652918..fcd3635d2 100644 --- a/packages/core/src/resources/Agents.ts +++ b/packages/core/src/resources/ClusterAgents.ts @@ -16,15 +16,26 @@ export interface ClusterAgentSchema extends Record { export interface ClusterAgentTokenSchema extends Record { id: number; name: string; - description: string; + description: string | null; agent_id: number; status: string; token?: string; created_at: string; - created_by_user_id: number; + created_by_user_id: string; + last_used_at?: string | null; +} + +export interface ClusterAgentUrlConfigurationSchema extends Record { + id: number; + agent_id: number; + url: string; + public_key?: string; + client_cert?: string; + ca_cert?: string; + tls_host?: string; } -export class Agents extends BaseResource { +export class ClusterAgents extends BaseResource { all( projectId: string | number, options?: ShowExpanded & Sudo, @@ -41,6 +52,56 @@ export class Agents extends BaseResource { ); } + show( + projectId: string | number, + agentId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/cluster_agents/${agentId}`, + { + sudo, + showExpanded, + }, + ); + } + + register( + projectId: string | number, + name: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + endpoint`projects/${projectId}/cluster_agents`, + { + sudo, + showExpanded, + body: { + name, + }, + }, + ); + } + + unregister( + projectId: string | number, + agentId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()(this, endpoint`projects/${projectId}/cluster_agents/${agentId}`, { + sudo, + showExpanded, + }); + } + allTokens( projectId: string | number, agentId: number, @@ -58,6 +119,24 @@ export class Agents extends BaseResource { ); } + showToken( + projectId: string | number, + agentId: number, + tokenId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/cluster_agents/${agentId}/tokens/${tokenId}`, + { + sudo, + showExpanded, + }, + ); + } + createToken( projectId: string | number, agentId: number, @@ -77,16 +156,17 @@ export class Agents extends BaseResource { ); } - show( + removeToken( projectId: string | number, agentId: number, + tokenId: number, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.get()( + return RequestHelper.del()( this, - endpoint`projects/${projectId}/cluster_agents/${agentId}`, + endpoint`projects/${projectId}/cluster_agents/${agentId}/tokens/${tokenId}`, { sudo, showExpanded, @@ -94,17 +174,16 @@ export class Agents extends BaseResource { ); } - showToken( + allUrlConfigurations( projectId: string | number, agentId: number, - tokenId: number, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.get()( + return RequestHelper.get()( this, - endpoint`projects/${projectId}/cluster_agents/${agentId}/tokens/${tokenId}`, + endpoint`projects/${projectId}/cluster_agents/${agentId}/url_configurations`, { sudo, showExpanded, @@ -112,54 +191,64 @@ export class Agents extends BaseResource { ); } - register( + showUrlConfiguration( projectId: string | number, - name: string, + agentId: number, + urlConfigId: number, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.post()( + return RequestHelper.get()( this, - endpoint`projects/${projectId}/cluster_agents`, + endpoint`projects/${projectId}/cluster_agents/${agentId}/url_configurations/${urlConfigId}`, { sudo, showExpanded, - body: { - name, - }, }, ); } - removeToken( + createUrlConfiguration( projectId: string | number, agentId: number, - tokenId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + url: string, + options?: { + clientCert?: string; + clientKey?: string; + caCert?: string; + tlsHost?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.del()( + return RequestHelper.post()( this, - endpoint`projects/${projectId}/cluster_agents/${agentId}/tokens/${tokenId}`, + endpoint`projects/${projectId}/cluster_agents/${agentId}/url_configurations`, { sudo, showExpanded, + body: { ...body, url }, }, ); } - unregister( + deleteUrlConfiguration( projectId: string | number, agentId: number, + urlConfigId: number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.del()(this, endpoint`projects/${projectId}/cluster_agents/${agentId}`, { - sudo, - showExpanded, - }); + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/cluster_agents/${agentId}/url_configurations/${urlConfigId}`, + { + sudo, + showExpanded, + }, + ); } } diff --git a/packages/core/src/resources/CodeSuggestions.ts b/packages/core/src/resources/CodeSuggestions.ts index 8d0157d49..8c81e2fe2 100644 --- a/packages/core/src/resources/CodeSuggestions.ts +++ b/packages/core/src/resources/CodeSuggestions.ts @@ -1,18 +1,41 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { - BaseRequestBodyRecordOptions, - GitlabAPIResponse, - ShowExpanded, - Sudo, -} from '../infrastructure'; +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; import { RequestHelper } from '../infrastructure'; -export interface CodeSuggestionSchema extends Record { - access_token: string; - expires_in: number; - created_at: number; +export interface CodeSuggestionDirectAccessSchema extends Record { + base_url: string; + token: string; + expires_at: number; + headers: { + 'X-Gitlab-Instance-Id': string; + 'X-Gitlab-Realm': string; + 'X-Gitlab-Global-User-Id': string; + 'X-Gitlab-Host-Name': string; + }; +} + +export interface CodeSuggestionConnectionDetailsSchema extends Record { + instance_id: string; + instance_version: string; + realm: string; + global_user_id: string; + host_name: string; + feature_enablement_type: string; + saas_duo_pro_namespace_ids?: string; +} + +export interface CodeSuggestionCurrentFileSchema { + file_name: string; + content_above_cursor: string; + content_below_cursor?: string; +} + +export interface CodeSuggestionContextSchema { + type: 'file' | 'snippet'; + name: string; + content: string; } export interface CodeCompletionSchema extends Record { @@ -31,26 +54,76 @@ export interface CodeCompletionSchema extends Record { } export class CodeSuggestions extends BaseResource { - createAccessToken( - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + generateCompletion( + currentFile: { + fileName: string; + contentAboveCursor: string; + contentBelowCursor?: string; + }, + options?: { + intent?: 'completion' | 'generation'; + stream?: boolean; + projectPath?: string; + generationType?: 'comment' | 'empty_function' | 'small_file'; + context?: CodeSuggestionContextSchema[]; + userInstruction?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()(this, 'code_suggestions/tokens', { + return RequestHelper.post()(this, 'code_suggestions/completions', { sudo, showExpanded, + body: { + ...body, + currentFile, + }, }); } - generateCompletion( - options?: BaseRequestBodyRecordOptions & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; + checkEnabled( + projectPath: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; - return RequestHelper.post()(this, 'code_suggestions/completions', { + return RequestHelper.post()(this, 'code_suggestions/enabled', { sudo, showExpanded, - body, + body: { + projectPath, + }, }); } + + showDirectAccessDetails( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + 'code_suggestions/direct_access', + { + sudo, + showExpanded, + }, + ); + } + + showConnectionDetails( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + 'code_suggestions/connection_details', + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/Commits.ts b/packages/core/src/resources/Commits.ts index 69cd96d8f..50c0922a2 100644 --- a/packages/core/src/resources/Commits.ts +++ b/packages/core/src/resources/Commits.ts @@ -58,6 +58,8 @@ export interface CommitSchema extends CondensedCommitSchema { committer_email?: string; committed_date?: string; web_url: string; + trailers?: Record; + extended_trailers?: Record; } export interface ExpandedCommitSchema extends CommitSchema { @@ -102,6 +104,20 @@ export interface X509SignatureSchema extends Record { commit_source: string; } +export interface SSHSignatureSchema extends Record { + signature_type: 'SSH'; + verification_status: 'verified' | 'unverified'; + key: { + id: number; + title: string; + created_at: string; + expires_at?: string; + key: string; + usage_type: string; + }; + commit_source: string; +} + export interface MissingSignatureSchema extends Record { message: string; } @@ -109,6 +125,7 @@ export interface MissingSignatureSchema extends Record { export type CommitSignatureSchema = | GPGSignatureSchema | X509SignatureSchema + | SSHSignatureSchema | MissingSignatureSchema; export interface CondensedCommitCommentSchema extends Record { @@ -131,6 +148,8 @@ export interface CommitDiffSchema extends Record { new_file: boolean; renamed_file: boolean; deleted_file: boolean; + collapsed?: boolean; + too_large?: boolean; } export interface CommitStatusSchema extends Record { @@ -179,6 +198,7 @@ export type AllCommitsOptions = { firstParent?: boolean; order?: string; trailers?: boolean; + follow?: boolean; }; export type CreateCommitOptions = { @@ -190,6 +210,7 @@ export type CreateCommitOptions = { authorName?: string; stats?: boolean; force?: boolean; + allowEmpty?: boolean; }; export type EditPipelineStatusOptions = { @@ -322,7 +343,15 @@ export class Commits extends BaseResource { allStatuses( projectId: string | number, sha: string, - options?: { ref?: string; stage?: string; name?: string; all?: boolean } & ShowExpanded & + options?: { + ref?: string; + stage?: string; + name?: string; + all?: boolean; + pipelineId?: number; + orderBy?: string; + sort?: string; + } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...searchParams } = options || {}; diff --git a/packages/core/src/resources/CompliancePolicySettings.ts b/packages/core/src/resources/CompliancePolicySettings.ts new file mode 100644 index 000000000..65f991f18 --- /dev/null +++ b/packages/core/src/resources/CompliancePolicySettings.ts @@ -0,0 +1,45 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export interface CompliancePolicySettingsSchema extends Record { + csp_namespace_id: number | null; +} + +export class CompliancePolicySettings extends BaseResource { + show( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + 'admin/security/compliance_policy_settings', + { + sudo, + showExpanded, + }, + ); + } + + edit( + cspNamespaceId: number | null, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.put()( + this, + 'admin/security/compliance_policy_settings', + { + sudo, + showExpanded, + body: { + cspNamespaceId, + }, + }, + ); + } +} diff --git a/packages/core/src/resources/ConanV2.ts b/packages/core/src/resources/ConanV2.ts new file mode 100644 index 000000000..9db0d28c6 --- /dev/null +++ b/packages/core/src/resources/ConanV2.ts @@ -0,0 +1,377 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded } from '../infrastructure'; + +import { RequestHelper, createFormData, endpoint } from '../infrastructure'; + +export interface ConanV2RevisionSchema extends Record { + revision: string; + time: string; +} + +export interface ConanV2RevisionListSchema extends Record { + reference: string; + revisions: ConanV2RevisionSchema[]; +} + +export interface ConanV2PackageReferenceMetadataSchema extends Record { + settings: Record; + options: Record; + requires: Record; + recipe_hash: string; +} + +export interface ConanV2FilesListSchema extends Record { + files: Record>; +} + +export interface ConanV2FileUploadResponseSchema extends Record { + id: number; + package_id: number; + created_at: string; + updated_at: string; + size: number; + file_store: number; + file_md5: string; + file_sha1: string; + file_name: string; + file: { + url: string; + }; + file_sha256: string | null; + verification_retry_at: string | null; + verified_at: string | null; + verification_failure: string | null; + verification_retry_count: number | null; + verification_checksum: string | null; + verification_state: number; + verification_started_at: string | null; + status: string; + file_final_path: string | null; + project_id: number; + new_file_path: string | null; +} + +export class ConanV2 extends BaseResource { + authenticate( + projectId: string | number, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/users/authenticate`, + { + showExpanded, + }, + ); + } + + checkCredentials( + projectId: string | number, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/users/check_credentials`, + { + showExpanded, + }, + ); + } + + search( + projectId: string | number, + query: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get<{ results: string[] }>()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/search`, + { + showExpanded, + searchParams: { q: query }, + }, + ); + } + + showLatestRecipeRevision( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/latest`, + { + showExpanded, + }, + ); + } + + allRecipeRevisions( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions`, + { + showExpanded, + }, + ); + } + + removeRecipeRevision( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/packages/conan/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}`, + { + showExpanded, + }, + ); + } + + allRecipeFiles( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/files`, + { + showExpanded, + }, + ); + } + + downloadRecipeFile( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + fileName: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/files/${fileName}`, + { + showExpanded, + }, + ); + } + + uploadRecipeFile( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + packageFile: { content: Blob; filename: string }, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/files/${packageFile.filename}`, + { + showExpanded, + body: createFormData({ + file: [packageFile.content, packageFile.filename], + }), + }, + ); + } + + allPackageRevisions( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + conanPackageReference: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/packages/${conanPackageReference}/revisions`, + { + showExpanded, + }, + ); + } + + showLatestPackageRevision( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + conanPackageReference: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/packages/${conanPackageReference}/latest`, + { + showExpanded, + }, + ); + } + + removePackageRevision( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + conanPackageReference: string, + packageRevision: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/packages/${conanPackageReference}/revisions/${packageRevision}`, + { + showExpanded, + }, + ); + } + + downloadPackageFile( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + conanPackageReference: string, + packageRevision: string, + fileName: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/packages/${conanPackageReference}/revisions/${packageRevision}/files/${fileName}`, + { + showExpanded, + }, + ); + } + + uploadPackageFile( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + conanPackageReference: string, + packageRevision: string, + packageFile: { content: Blob; filename: string }, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/packages/${conanPackageReference}/revisions/${packageRevision}/files/${packageFile.filename}`, + { + showExpanded, + body: createFormData({ + file: [packageFile.content, packageFile.filename], + }), + }, + ); + } + + showPackageReferencesMetadata( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + options?: ShowExpanded, + ): Promise, C, E, void>> { + const { showExpanded } = options || {}; + + return RequestHelper.get>()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/search`, + { + showExpanded, + }, + ); + } + + showPackageReferencesMetadataByRevision( + projectId: string | number, + packageName: string, + packageVersion: string, + packageUsername: string, + packageChannel: string, + recipeRevision: string, + options?: ShowExpanded, + ): Promise, C, E, void>> { + const { showExpanded } = options || {}; + + return RequestHelper.get>()( + this, + endpoint`projects/${projectId}/packages/conan/v2/conans/${packageName}/${packageVersion}/${packageUsername}/${packageChannel}/revisions/${recipeRevision}/search`, + { + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/ContainerRegistry.ts b/packages/core/src/resources/ContainerRegistry.ts index 4df15c1ea..d9da8e96d 100644 --- a/packages/core/src/resources/ContainerRegistry.ts +++ b/packages/core/src/resources/ContainerRegistry.ts @@ -38,6 +38,8 @@ export interface RegistryRepositorySchema extends Record { cleanup_policy_started_at: string; tags_count?: number; tags?: Pick[]; + size?: number; + status?: string | null; } export type CondensedRegistryRepositorySchema = MappedOmit< diff --git a/packages/core/src/resources/ContainerRegistryProtectionTagRules.ts b/packages/core/src/resources/ContainerRegistryProtectionTagRules.ts new file mode 100644 index 000000000..94708b5f3 --- /dev/null +++ b/packages/core/src/resources/ContainerRegistryProtectionTagRules.ts @@ -0,0 +1,105 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ContainerRegistryProtectionTagRuleSchema extends Record { + id: number; + project_id: number; + tag_name_pattern: string; + minimum_access_level_for_push: 'maintainer' | 'owner' | 'admin'; + minimum_access_level_for_delete: 'maintainer' | 'owner' | 'admin'; +} + +export class ContainerRegistryProtectionTagRules< + C extends boolean = false, +> extends BaseResource { + all( + projectId: string | number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/registry/protection/tag/rules`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + create( + projectId: string | number, + tagNamePattern: string, + minimumAccessLevelForPush: 'maintainer' | 'owner' | 'admin', + minimumAccessLevelForDelete: 'maintainer' | 'owner' | 'admin', + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + endpoint`projects/${projectId}/registry/protection/tag/rules`, + { + sudo, + showExpanded, + body: { + tagNamePattern, + minimumAccessLevelForPush, + minimumAccessLevelForDelete, + }, + }, + ); + } + + edit( + projectId: string | number, + protectionRuleId: number, + options?: { + tagNamePattern?: string; + minimumAccessLevelForPush?: 'maintainer' | 'owner' | 'admin' | ''; + minimumAccessLevelForDelete?: 'maintainer' | 'owner' | 'admin' | ''; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`projects/${projectId}/registry/protection/tag/rules/${protectionRuleId}`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + remove( + projectId: string | number, + protectionRuleId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/registry/protection/tag/rules/${protectionRuleId}`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/ContainerRepositoryProtectionRules.ts b/packages/core/src/resources/ContainerRepositoryProtectionRules.ts new file mode 100644 index 000000000..6b29a2682 --- /dev/null +++ b/packages/core/src/resources/ContainerRepositoryProtectionRules.ts @@ -0,0 +1,104 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ContainerRepositoryProtectionRuleSchema extends Record { + id: number; + project_id: number; + repository_path_pattern: string; + minimum_access_level_for_push?: 'maintainer' | 'owner' | 'admin'; + minimum_access_level_for_delete?: 'maintainer' | 'owner' | 'admin'; +} + +export class ContainerRepositoryProtectionRules extends BaseResource { + all( + projectId: string | number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/registry/protection/repository/rules`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + create( + projectId: string | number, + repositoryPathPattern: string, + options?: { + minimumAccessLevelForPush?: 'maintainer' | 'owner' | 'admin'; + minimumAccessLevelForDelete?: 'maintainer' | 'owner' | 'admin'; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.post()( + this, + endpoint`projects/${projectId}/registry/protection/repository/rules`, + { + sudo, + showExpanded, + searchParams: { + ...searchParams, + repositoryPathPattern, + }, + }, + ); + } + + edit( + projectId: string | number, + protectionRuleId: number, + options?: { + repositoryPathPattern?: string; + minimumAccessLevelForPush?: 'maintainer' | 'owner' | 'admin' | ''; + minimumAccessLevelForDelete?: 'maintainer' | 'owner' | 'admin' | ''; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`projects/${projectId}/registry/protection/repository/rules/${protectionRuleId}`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + remove( + projectId: string | number, + protectionRuleId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/registry/protection/repository/rules/${protectionRuleId}`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/ContainerVirtualRegistry.ts b/packages/core/src/resources/ContainerVirtualRegistry.ts new file mode 100644 index 000000000..d4c3f44bb --- /dev/null +++ b/packages/core/src/resources/ContainerVirtualRegistry.ts @@ -0,0 +1,459 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface VirtualRegistrySchema extends Record { + id: number; + group_id: number; + name: string; + description?: string; + created_at: string; + updated_at: string; + registry_upstreams?: RegistryUpstreamAssociationSchema[]; +} + +export interface UpstreamRegistrySchema extends Record { + id: number; + group_id: number; + url: string; + name: string; + description?: string; + cache_validity_hours: number; + username?: string; + created_at: string; + updated_at: string; + registry_upstreams?: RegistryUpstreamAssociationSchema[]; + registry_upstream?: RegistryUpstreamAssociationSchema; +} + +export interface RegistryUpstreamAssociationSchema extends Record { + id: number; + registry_id: number; + upstream_id: number; + position: number; +} + +export interface CacheEntrySchema extends Record { + id: string; + group_id: number; + upstream_id: number; + upstream_checked_at: string; + file_md5: string; + file_sha1: string; + size: number; + relative_path: string; + content_type: string; + upstream_etag: string; + created_at: string; + updated_at: string; + downloads_count: number; + downloaded_at: string; +} + +export interface ConnectionTestResultSchema extends Record { + success: boolean; + result?: string; +} + +export class ContainerVirtualRegistry extends BaseResource { + all( + groupId: string | number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, maxPages, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/-/virtual_registries/container/registries`, + { + sudo, + maxPages, + showExpanded, + searchParams, + }, + ); + } + + create( + groupId: string | number, + name: string, + options?: { + description?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`groups/${groupId}/-/virtual_registries/container/registries`, + { + sudo, + showExpanded, + body: { + ...body, + name, + }, + }, + ); + } + + show( + registryId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`virtual_registries/container/registries/${registryId}`, + { + sudo, + showExpanded, + }, + ); + } + + edit( + registryId: number, + options?: { + name?: string; + description?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`virtual_registries/container/registries/${registryId}`, + { + sudo, + showExpanded, + body, + }, + ); + } + + remove( + registryId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/registries/${registryId}`, + { + sudo, + showExpanded, + }, + ); + } + + clearCache( + registryId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/registries/${registryId}/cache`, + { + sudo, + showExpanded, + }, + ); + } + + allUpstreams( + groupId: string | number, + options?: { + upstreamName?: string; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/-/virtual_registries/container/upstreams`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + testUpstreamConnection( + groupId: string | number, + url: string, + options?: { + username?: string; + password?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`groups/${groupId}/-/virtual_registries/container/upstreams/test`, + { + sudo, + showExpanded, + body: { + ...body, + url, + }, + }, + ); + } + + allRegistryUpstreams( + registryId: number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`virtual_registries/container/registries/${registryId}/upstreams`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + createUpstream( + registryId: number, + url: string, + name: string, + options?: { + description?: string; + username?: string; + password?: string; + cacheValidityHours?: number; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`virtual_registries/container/registries/${registryId}/upstreams`, + { + sudo, + showExpanded, + body: { + ...body, + url, + name, + }, + }, + ); + } + + showUpstream( + upstreamId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}`, + { + sudo, + showExpanded, + }, + ); + } + + editUpstream( + upstreamId: number, + options?: { + url?: string; + name?: string; + description?: string; + username?: string; + password?: string; + cacheValidityHours?: number; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}`, + { + sudo, + showExpanded, + body, + }, + ); + } + + updateUpstreamPosition( + registryUpstreamId: number, + position: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`virtual_registries/container/registry_upstreams/${registryUpstreamId}`, + { + sudo, + showExpanded, + body: { position }, + }, + ); + } + + removeUpstream( + upstreamId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}`, + { + sudo, + showExpanded, + }, + ); + } + + associateUpstream( + registryId: number, + upstreamId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + 'virtual_registries/container/registry_upstreams', + { + sudo, + showExpanded, + body: { + registryId, + upstreamId, + }, + }, + ); + } + + disassociateUpstream( + registryUpstreamId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/registry_upstreams/${registryUpstreamId}`, + { + sudo, + showExpanded, + }, + ); + } + + clearUpstreamCache( + upstreamId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}/cache`, + { + sudo, + showExpanded, + }, + ); + } + + testUpstream( + upstreamId: number, + options?: { + url?: string; + username?: string; + password?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}/test`, + { + sudo, + showExpanded, + body, + }, + ); + } + + allCacheEntries( + upstreamId: number, + options?: { + search?: string; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`virtual_registries/container/upstreams/${upstreamId}/cache_entries`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + removeCacheEntry( + cacheEntryId: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`virtual_registries/container/cache_entries/${cacheEntryId}`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/DashboardAnnotations.ts b/packages/core/src/resources/DashboardAnnotations.ts deleted file mode 100644 index b499b093d..000000000 --- a/packages/core/src/resources/DashboardAnnotations.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { GitlabAPIResponse, OneOf, ShowExpanded, Sudo } from '../infrastructure'; - -import { RequestHelper, ensureRequiredParams, getPrefixedUrl } from '../infrastructure'; - -export interface DashboardAnnotationSchema extends Record { - id: number; - starting_at: string; - ending_at?: null; - dashboard_path: string; - description: string; - environment_id: number; - cluster_id?: null; -} - -export class DashboardAnnotations extends BaseResource { - create( - dashboardPath: string, - startingAt: string, - description: string, - options?: { endingAt?: string } & OneOf<{ environmentId: number; clusterId: number }> & - ShowExpanded & - Sudo, - ): Promise> { - const { environmentId, clusterId, sudo, showExpanded, ...body } = options || {}; - - ensureRequiredParams({ environmentId, clusterId }); - - const url = getPrefixedUrl('metrics_dashboard/annotations', { - environments: environmentId, - clusters: clusterId, - }); - - return RequestHelper.post()(this, url, { - sudo, - showExpanded, - body: { - dashboardPath, - startingAt, - description, - ...body, - }, - }); - } -} diff --git a/packages/core/src/resources/DataManagement.ts b/packages/core/src/resources/DataManagement.ts new file mode 100644 index 000000000..b2255a8ac --- /dev/null +++ b/packages/core/src/resources/DataManagement.ts @@ -0,0 +1,137 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export type DataModelName = + | 'ci_job_artifacts' + | 'ci_pipeline_artifacts' + | 'ci_secure_files' + | 'container_repositories' + | 'dependency_proxy_blobs' + | 'dependency_proxy_manifests' + | 'design_management_repositories' + | 'group_wiki_repositories' + | 'lfs_objects' + | 'merge_request_diffs' + | 'packages_nuget_symbols' + | 'packages_package_files' + | 'pages_deployments' + | 'projects' + | 'projects_wiki_repositories' + | 'snippet_repositories' + | 'supply_chain_attestations' + | 'terraform_state_versions' + | 'uploads'; + +export type ChecksumState = 'pending' | 'started' | 'succeeded' | 'failed' | 'disabled'; + +export interface ChecksumInformationSchema extends Record { + checksum?: string; + last_checksum?: string; + checksum_state: ChecksumState; + checksum_retry_count: number; + checksum_retry_at?: string | null; + checksum_failure?: string | null; +} + +export interface DataModelRecordSchema extends Record { + record_identifier: string | number; + model_class: string; + created_at?: string; + file_size?: number | null; + checksum_information?: ChecksumInformationSchema; +} + +export interface ChecksumOperationResultSchema extends Record { + status: 'success' | 'error'; + message: string; +} + +export class DataManagement extends BaseResource { + allRecords( + modelName: DataModelName, + options?: { + checksumState?: ChecksumState; + identifiers?: (string | number)[]; + sort?: 'asc' | 'desc'; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`admin/data_management/${modelName}`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } + + recalculateChecksums( + modelName: DataModelName, + options?: { + checksumState?: ChecksumState; + identifiers?: (string | number)[]; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`admin/data_management/${modelName}/checksum`, + { + sudo, + showExpanded, + body, + }, + ); + } + + showRecord( + modelName: DataModelName, + recordIdentifier: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`admin/data_management/${modelName}/${recordIdentifier}`, + { + sudo, + showExpanded, + }, + ); + } + + recalculateRecordChecksum( + modelName: DataModelName, + recordIdentifier: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`admin/data_management/${modelName}/${recordIdentifier}/checksum`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/DatabaseMigrations.ts b/packages/core/src/resources/DatabaseMigrations.ts new file mode 100644 index 000000000..a3bbf0f3c --- /dev/null +++ b/packages/core/src/resources/DatabaseMigrations.ts @@ -0,0 +1,51 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface PendingMigrationSchema extends Record { + version: number; + name: string; + filename: string; + status: string; +} + +export interface PendingMigrationsResponseSchema extends Record { + pending_migrations: PendingMigrationSchema[]; + database: string; + total_pending: number; +} + +export class DatabaseMigrations extends BaseResource { + markAsSuccessful( + version: number, + options?: { + database?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.post()(this, endpoint`admin/migrations/${version}/mark`, { + sudo, + showExpanded, + searchParams, + }); + } + + showPending( + options?: { + database?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'admin/migrations/pending', { + sudo, + showExpanded, + searchParams, + }); + } +} diff --git a/packages/core/src/resources/Debian.ts b/packages/core/src/resources/Debian.ts index accb66d21..a79c0d229 100644 --- a/packages/core/src/resources/Debian.ts +++ b/packages/core/src/resources/Debian.ts @@ -1,6 +1,6 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { GitlabAPIResponse, OneOf, ShowExpanded } from '../infrastructure'; +import type { GitlabAPIResponse, OneOf, ShowExpanded, Sudo } from '../infrastructure'; import { RequestHelper, @@ -10,6 +10,42 @@ import { getPrefixedUrl, } from '../infrastructure'; +export interface DebianDistributionSchema extends Record { + id: number; + codename: string; + suite: string | null; + origin: string | null; + label: string | null; + version: string | null; + description: string | null; + valid_time_duration_seconds: number | null; + components: string[]; + architectures: string[]; +} + +export type CreateDistributionOptions = { + codename: string; + suite?: string; + origin?: string; + label?: string; + version?: string; + description?: string; + validTimeDurationSeconds?: number; + components?: string[]; + architectures?: string[]; +}; + +export type EditDistributionOptions = { + suite?: string; + origin?: string; + label?: string; + version?: string; + description?: string; + validTimeDurationSeconds?: number; + components?: string[]; + architectures?: string[]; +}; + export class Debian extends BaseResource { downloadBinaryFileIndex( distribution: string, @@ -23,15 +59,19 @@ export class Debian extends BaseResource { ): Promise> { ensureRequiredParams({ projectId, groupId }); + const { showExpanded } = options || {}; + const url = getPrefixedUrl( `dists/${distribution}/${component}/binary-${architecture}/Packages`, { projects: projectId, - 'groups/-': groupId, + groups: groupId ? `${groupId}/-` : undefined, }, ); - return RequestHelper.get()(this, url, options as ShowExpanded); + return RequestHelper.get()(this, url, { + showExpanded, + }); } downloadDistributionReleaseFile( @@ -44,12 +84,14 @@ export class Debian extends BaseResource { ): Promise> { ensureRequiredParams({ projectId, groupId }); + const { showExpanded } = options || {}; + const url = getPrefixedUrl(`packages/debian/dists/${distribution}/Release`, { projects: projectId, - 'groups/-': groupId, + groups: groupId ? `${groupId}/-` : undefined, }); - return RequestHelper.get()(this, url, options as ShowExpanded); + return RequestHelper.get()(this, url, { showExpanded }); } downloadSignedDistributionReleaseFile( @@ -62,12 +104,14 @@ export class Debian extends BaseResource { ): Promise> { ensureRequiredParams({ projectId, groupId }); + const { showExpanded } = options || {}; + const url = getPrefixedUrl(`packages/debian/dists/${distribution}/InRelease`, { projects: projectId, - 'groups/-': groupId, + groups: groupId ? `${groupId}/-` : undefined, }); - return RequestHelper.get()(this, url, options as ShowExpanded); + return RequestHelper.get()(this, url, { showExpanded }); } downloadReleaseFileSignature( @@ -80,12 +124,14 @@ export class Debian extends BaseResource { ): Promise> { ensureRequiredParams({ projectId, groupId }); + const { showExpanded } = options || {}; + const url = getPrefixedUrl(`packages/debian/dists/${distribution}/Release.gpg`, { projects: projectId, - 'groups/-': groupId, + groups: groupId ? `${groupId}/-` : undefined, }); - return RequestHelper.get()(this, url, options as ShowExpanded); + return RequestHelper.get()(this, url, { showExpanded }); } downloadPackageFile( @@ -98,6 +144,7 @@ export class Debian extends BaseResource { options?: ShowExpanded, ): Promise> { const { showExpanded } = options || {}; + const url = getPrefixedUrl( `packages/debian/pool/${distribution}/${letter}/${packageName}/${packageVersion}/${filename}`, { @@ -128,4 +175,268 @@ export class Debian extends BaseResource { }, ); } + + allDistributions({ + projectId, + groupId, + ...options + }: { + codename?: string; + suite?: string; + } & OneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded & + Sudo): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { sudo, showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl('debian_distributions', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.get()(this, url, { + sudo, + showExpanded, + searchParams, + }); + } + + showDistribution( + codename: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded & Sudo, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { sudo, showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl(`debian_distributions/${codename}`, { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.get()(this, url, { + sudo, + showExpanded, + searchParams, + }); + } + + showDistributionKey( + codename: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl(`debian_distributions/${codename}/key.asc`, { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.get()(this, url, { showExpanded, searchParams }); + } + + createDistribution({ + projectId, + groupId, + ...options + }: CreateDistributionOptions & + OneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded & + Sudo): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { sudo, showExpanded, ...body } = options || {}; + + const url = getPrefixedUrl('debian_distributions', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.post()(this, url, { + sudo, + showExpanded, + body, + }); + } + + editDistribution( + codename: string, + { + projectId, + groupId, + ...options + }: EditDistributionOptions & + OneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded & + Sudo, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { sudo, showExpanded, ...body } = options || {}; + + const url = getPrefixedUrl(`debian_distributions/${codename}`, { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.put()(this, url, { + sudo, + showExpanded, + body, + }); + } + + removeDistribution( + codename: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded & Sudo, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { sudo, showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl(`debian_distributions/${codename}`, { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.del()(this, url, { sudo, showExpanded, searchParams }); + } + + downloadBinaryFileIndexByHash( + distribution: string, + component: string, + architecture: string, + fileSha256: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl( + `dists/${distribution}/${component}/binary-${architecture}/by-hash/SHA256/${fileSha256}`, + { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }, + ); + + return RequestHelper.get()(this, url, { showExpanded, searchParams }); + } + + downloadDebianInstallerIndex( + distribution: string, + component: string, + architecture: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl( + `dists/${distribution}/${component}/debian-installer/binary-${architecture}/Packages`, + { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }, + ); + + return RequestHelper.get()(this, url, { showExpanded, searchParams }); + } + + downloadDebianInstallerIndexByHash( + distribution: string, + component: string, + architecture: string, + fileSha256: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded, ...searchParams } = options || {}; + + const url = getPrefixedUrl( + `dists/${distribution}/${component}/debian-installer/binary-${architecture}/by-hash/SHA256/${fileSha256}`, + { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }, + ); + + return RequestHelper.get()(this, url, { showExpanded, searchParams }); + } + + downloadSourceIndex( + distribution: string, + component: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded } = options || {}; + + const url = getPrefixedUrl(`dists/${distribution}/${component}/source/Sources`, { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + + return RequestHelper.get()(this, url, { showExpanded }); + } + + downloadSourceIndexByHash( + distribution: string, + component: string, + fileSha256: string, + { + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const { showExpanded } = options || {}; + + const url = getPrefixedUrl( + `dists/${distribution}/${component}/source/by-hash/SHA256/${fileSha256}`, + { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }, + ); + + return RequestHelper.get()(this, url, { showExpanded }); + } } diff --git a/packages/core/src/resources/Dependencies.ts b/packages/core/src/resources/Dependencies.ts new file mode 100644 index 000000000..8a52ca38f --- /dev/null +++ b/packages/core/src/resources/Dependencies.ts @@ -0,0 +1,56 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface DependencyVulnerability { + name: string; + severity: string; + id: number; + url: string; +} + +export interface DependencyLicense { + name: string; + url: string; +} + +export interface DependencySchema extends Record { + name: string; + version: string; + package_manager: string; + dependency_file_path: string; + vulnerabilities: DependencyVulnerability[]; + licenses: DependencyLicense[]; +} + +export class Dependencies extends BaseResource { + all( + projectId: string | number, + options?: { + package_manager?: string | string[]; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { showExpanded, sudo, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/dependencies`, + { + showExpanded, + sudo, + searchParams, + maxPages, + }, + ); + } +} diff --git a/packages/core/src/resources/DependencyListExport.ts b/packages/core/src/resources/DependencyListExport.ts new file mode 100644 index 000000000..2119643c6 --- /dev/null +++ b/packages/core/src/resources/DependencyListExport.ts @@ -0,0 +1,75 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface DependencyListExportSchema extends Record { + id: number; + status?: string; + has_finished: boolean; + export_type?: string; + send_email?: boolean; + expires_at?: string; + self: string; + download: string; +} + +export class DependencyListExport extends BaseResource { + create( + id: string | number, + exportType: string, + options?: { + sendEmail?: boolean; + entity?: 'projects' | 'groups' | 'pipelines'; + } & ShowExpanded & + Sudo, + ): Promise> { + const { showExpanded, sudo, entity = 'projects', ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`${entity}/${id}/dependency_list_exports`, + { + showExpanded, + sudo, + body: { + ...body, + exportType, + }, + }, + ); + } + + show( + exportId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { showExpanded, sudo } = options || {}; + + return RequestHelper.get()( + this, + endpoint`dependency_list_exports/${exportId}`, + { + showExpanded, + sudo, + }, + ); + } + + download( + exportId: number, + options?: ShowExpanded & Sudo, + ): Promise, C, E, void>> { + const { showExpanded, sudo } = options || {}; + + return RequestHelper.get>()( + this, + endpoint`dependency_list_exports/${exportId}/download`, + { + showExpanded, + sudo, + }, + ); + } +} diff --git a/packages/core/src/resources/DeployKeys.ts b/packages/core/src/resources/DeployKeys.ts index dcab58631..0ee1305b3 100644 --- a/packages/core/src/resources/DeployKeys.ts +++ b/packages/core/src/resources/DeployKeys.ts @@ -65,7 +65,7 @@ export class DeployKeys extends BaseResource { projectId: string | number, title: string, key: string, - options?: { canPush?: boolean } & ShowExpanded & Sudo, + options?: { canPush?: boolean; expiresAt?: string } & ShowExpanded & Sudo, ): Promise> { const { showExpanded, sudo, ...body } = options || {}; @@ -84,6 +84,24 @@ export class DeployKeys extends BaseResource { ); } + createAdmin( + title: string, + key: string, + options?: { expiresAt?: string } & ShowExpanded & Sudo, + ): Promise> { + const { showExpanded, sudo, ...body } = options || {}; + + return RequestHelper.post()(this, 'deploy_keys', { + showExpanded, + sudo, + body: { + ...body, + title, + key, + }, + }); + } + edit( projectId: string | number, keyId: number, diff --git a/packages/core/src/resources/DeployTokens.ts b/packages/core/src/resources/DeployTokens.ts index 74f7da989..16635b123 100644 --- a/packages/core/src/resources/DeployTokens.ts +++ b/packages/core/src/resources/DeployTokens.ts @@ -20,7 +20,9 @@ export type DeployTokenScope = | 'read_registry' | 'write_registry' | 'read_package_registry' - | 'write_package_registry'; + | 'write_package_registry' + | 'read_virtual_registry' + | 'write_virtual_registry'; export interface DeployTokenSchema extends Record { id: number; diff --git a/packages/core/src/resources/Deployments.ts b/packages/core/src/resources/Deployments.ts index 9d00ca969..0cdcb624e 100644 --- a/packages/core/src/resources/Deployments.ts +++ b/packages/core/src/resources/Deployments.ts @@ -58,10 +58,12 @@ export interface DeploymentSchema extends Record { } export type AllDeploymentsOptions = { - orderBy?: 'id' | 'iid' | 'created_at' | 'updated_at' | 'ref'; + orderBy?: 'id' | 'iid' | 'created_at' | 'updated_at' | 'finished_at' | 'ref'; sort?: 'asc' | 'desc'; updatedAfter?: string; updatedBefore?: string; + finishedAfter?: string; + finishedBefore?: string; environment?: string; status?: 'created' | 'running' | 'success' | 'failed' | 'canceled' | 'blocked'; }; @@ -110,9 +112,10 @@ export class Deployments extends BaseResource { sha: string, ref: string, tag: boolean, - options?: { status?: 'running' | 'success' | 'failed' | 'canceled' } & ShowExpanded & Sudo, + status: 'running' | 'success' | 'failed' | 'canceled', + options?: ShowExpanded & Sudo, ): Promise> { - const { showExpanded, sudo, ...searchParams } = options || {}; + const { showExpanded, sudo } = options || {}; return RequestHelper.post()( this, @@ -120,12 +123,12 @@ export class Deployments extends BaseResource { { showExpanded, sudo, - searchParams: { - ...searchParams, + body: { environment, sha, ref, tag, + status, }, }, ); diff --git a/packages/core/src/resources/DockerfileTemplates.ts b/packages/core/src/resources/DockerfileTemplates.ts deleted file mode 100644 index ab1e088af..000000000 --- a/packages/core/src/resources/DockerfileTemplates.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import { ResourceTemplates } from '../templates'; - -export class DockerfileTemplates extends ResourceTemplates { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('dockerfiles', options); - } -} diff --git a/packages/core/src/resources/Environments.ts b/packages/core/src/resources/Environments.ts index 3d130374d..ae0fef71d 100644 --- a/packages/core/src/resources/Environments.ts +++ b/packages/core/src/resources/Environments.ts @@ -47,6 +47,23 @@ export type CondensedEnvironmentSchema = MappedOmit< export type ReviewAppSchema = MappedOmit; +export type CreateEnvironmentOptions = { + description?: string; + externalUrl?: string; + tier?: EnvironmentTier; + clusterAgentId?: number; + kubernetesNamespace?: string; + fluxResourcePath?: string; + autoStopSetting?: 'always' | 'with_action'; +}; + +export type EditEnvironmentOptions = { + clusterAgentId?: number | null; + kubernetesNamespace?: string | null; + fluxResourcePath?: string | null; + autoStopSetting?: string | null; +} & CreateEnvironmentOptions; + export class Environments extends BaseResource { all( projectId: string | number, @@ -77,7 +94,7 @@ export class Environments extends BaseResource { create( projectId: string | number, name: string, - options?: { externalUrl?: string; tier?: EnvironmentTier } & ShowExpanded & Sudo, + options?: CreateEnvironmentOptions & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -98,7 +115,7 @@ export class Environments extends BaseResource { edit( projectId: string | number, environmentId: number, - options?: { externalUrl?: string; tier?: EnvironmentTier } & ShowExpanded & Sudo, + options?: EditEnvironmentOptions & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; diff --git a/packages/core/src/resources/EpicAwardEmojis.ts b/packages/core/src/resources/EpicAwardEmojis.ts deleted file mode 100644 index 6e5857160..000000000 --- a/packages/core/src/resources/EpicAwardEmojis.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { AwardEmojiSchema } from '../templates/ResourceAwardEmojis'; - -import { ResourceAwardEmojis } from '../templates'; - -export interface EpicAwardEmojis extends ResourceAwardEmojis { - all( - epicId: string | number, - issueIId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; - - award( - epicId: string | number, - issueIId: number, - name: string, - options?: ShowExpanded & Sudo, - ): Promise>; - - remove( - epicId: string | number, - issueIId: number, - awardId: number, - options?: ShowExpanded & Sudo, - ): Promise>; - - show( - epicId: string | number, - issueIId: number, - awardId: number, - options?: ShowExpanded & Sudo, - ): Promise>; -} - -export class EpicAwardEmojis extends ResourceAwardEmojis { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('epics', 'issues', options); - } -} diff --git a/packages/core/src/resources/EpicDiscussions.ts b/packages/core/src/resources/EpicDiscussions.ts deleted file mode 100644 index e95f66fe4..000000000 --- a/packages/core/src/resources/EpicDiscussions.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { DiscussionNoteSchema, DiscussionSchema } from '../templates/ResourceDiscussions'; - -import { ResourceDiscussions } from '../templates'; - -export interface EpicDiscussions extends ResourceDiscussions { - addNote( - groupId: string | number, - epicId: number, - discussionId: string, - body: string, - options?: { createdAt?: string } & ShowExpanded & Sudo, - ): Promise>; - - all( - groupId: string | number, - epicId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; - - create( - groupId: string | number, - epicId: number, - body: string, - options?: { createdAt?: string } & ShowExpanded & Sudo, - ): Promise>; - - editNote( - groupId: string | number, - epicId: number, - discussionId: string, - noteId: number, - options: { body: string } & ShowExpanded & Sudo, - ): Promise>; - - removeNote( - groupId: string | number, - epicId: number, - discussionId: string, - noteId: number, - options?: ShowExpanded & Sudo, - ): Promise>; - - show( - groupId: string | number, - epicId: number, - discussionId: string, - options?: ShowExpanded & Sudo, - ): Promise>; -} - -export class EpicDiscussions extends ResourceDiscussions { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('groups', 'epics', options); - } -} diff --git a/packages/core/src/resources/EpicIssues.ts b/packages/core/src/resources/EpicIssues.ts deleted file mode 100644 index 735970fed..000000000 --- a/packages/core/src/resources/EpicIssues.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - MappedOmit, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { IssueSchema } from './Issues'; - -import { RequestHelper, endpoint } from '../infrastructure'; - -export interface EpicIssueSchema - extends MappedOmit { - epic_issue_id: number; -} - -export interface ExpandedEpicIssueSchema extends EpicIssueSchema { - subscribed: boolean; - relative_position: number; -} - -export class EpicIssues extends BaseResource { - all( - groupId: string | number, - epicIId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/issues`, - { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }, - ); - } - - assign( - groupId: string | number, - epicIId: number, - epicIssueId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.post()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/issues/${epicIssueId}`, - { - showExpanded, - sudo, - }, - ); - } - - edit( - groupId: string | number, - epicIId: number, - epicIssueId: number, - options?: { moveBeforeId?: number; moveAfterId?: number } & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.put()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/issues/${epicIssueId}`, - { - sudo, - showExpanded, - body, - }, - ); - } - - remove( - groupId: string | number, - epicIId: number, - epicIssueId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.del()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/issues/${epicIssueId}`, - { - showExpanded, - sudo, - }, - ); - } -} diff --git a/packages/core/src/resources/EpicLabelEvents.ts b/packages/core/src/resources/EpicLabelEvents.ts deleted file mode 100644 index 202c9e23a..000000000 --- a/packages/core/src/resources/EpicLabelEvents.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { LabelEventSchema } from '../templates/ResourceLabelEvents'; - -import { ResourceLabelEvents } from '../templates'; - -export interface EpicLabelEvents { - all( - groupId: string | number, - epidId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; - - show( - groupId: string | number, - epidId: number, - labelEventId: number, - options?: ShowExpanded & Sudo, - ): Promise>; -} - -export class EpicLabelEvents extends ResourceLabelEvents { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('groups', 'epics', options); - } -} diff --git a/packages/core/src/resources/EpicLinks.ts b/packages/core/src/resources/EpicLinks.ts deleted file mode 100644 index 7ef78a8c4..000000000 --- a/packages/core/src/resources/EpicLinks.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; - -import { RequestHelper, endpoint } from '../infrastructure'; -import { SimpleUserSchema } from './Users'; - -export interface CondensedEpicLinkSchema extends Record { - id: number; - iid: number; - group_id: number; - parent_id: number; - title: string; - has_children: boolean; - has_issues: boolean; - reference: string; - url: string; - relation_url: string; -} - -export interface EpicLinkSchema extends Record { - id: number; - iid: number; - group_id: number; - parent_id: number; - title: string; - description: string; - author: SimpleUserSchema; - start_date?: string; - start_date_is_fixed: boolean; - start_date_fixed?: string; - start_date_from_milestones?: string; - start_date_from_inherited_source?: string; - due_date: string; - due_date_is_fixed: boolean; - due_date_fixed?: string; - due_date_from_milestones?: string; - due_date_from_inherited_source: string; - created_at: string; - updated_at: string; - labels?: string[]; -} - -export class EpicLinks extends BaseResource { - all( - groupId: string | number, - epicIId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/links`, - { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }, - ); - } - - assign( - groupId: string | number, - epicIId: number, - childEpicId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.post()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`, - { - showExpanded, - sudo, - }, - ); - } - - create( - groupId: string | number, - epicIId: number, - title: string, - options?: { confidential?: boolean } & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.post()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/links`, - { - sudo, - showExpanded, - searchParams: { - title, - }, - body, - }, - ); - } - - reorder( - groupId: string | number, - epicIId: number, - childEpicId: number, - options?: { moveBeforeId?: number; moveAfterId?: number } & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.put()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`, - { - sudo, - showExpanded, - body, - }, - ); - } - - unassign( - groupId: string | number, - epicIId: number, - childEpicId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.del()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/links/${childEpicId}`, - { - showExpanded, - sudo, - }, - ); - } -} diff --git a/packages/core/src/resources/EpicStateEvents.ts b/packages/core/src/resources/EpicStateEvents.ts deleted file mode 100644 index 2051d7e59..000000000 --- a/packages/core/src/resources/EpicStateEvents.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { StateEventSchema } from '../templates/ResourceStateEvents'; - -import { ResourceStateEvents } from '../templates'; - -export interface EpicStateEvents { - all( - groupId: string | number, - epicId: number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; - - show( - groupId: string | number, - epicId: number, - stateEventId: number, - options?: ShowExpanded & Sudo, - ): Promise>; -} - -export class EpicStateEvents extends ResourceStateEvents { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('groups', 'epics', options); - } -} diff --git a/packages/core/src/resources/Epics.ts b/packages/core/src/resources/Epics.ts deleted file mode 100644 index f9b04c622..000000000 --- a/packages/core/src/resources/Epics.ts +++ /dev/null @@ -1,237 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - MappedOmit, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; -import type { SimpleLabelSchema } from '../templates/ResourceLabels'; -import type { GroupSchema } from './Groups'; -import type { TodoSchema } from './TodoLists'; -import type { SimpleUserSchema } from './Users'; - -import { RequestHelper, endpoint } from '../infrastructure'; - -export interface EpicSchema extends Record { - id: number; - iid: number; - group_id: number; - parent_id: number; - parent_iid: number; - title: string; - description: string; - state: string; - confidential: string; - web_url: string; - references: { - short: string; - relative: string; - full: string; - }; - author: MappedOmit; - start_date?: string; - start_date_is_fixed: boolean; - start_date_fixed?: string; - start_date_from_inherited_source?: string; - due_date: string; - due_date_is_fixed: boolean; - due_date_fixed?: string; - due_date_from_inherited_source: string; - created_at: string; - updated_at: string; - closed_at: string; - labels: string[] | SimpleLabelSchema[]; - upvotes: number; - downvotes: number; - _links: { - self: string; - epic_issues: string; - group: string; - }; -} - -export interface EpicSchemaWithExpandedLabels extends EpicSchema { - labels: SimpleLabelSchema[]; -} - -export interface EpicSchemaWithBasicLabels extends EpicSchema { - labels: string[]; -} - -export interface EpicTodoSchema extends TodoSchema { - group: Pick; - target_type: 'Epic'; - target: EpicSchema; -} - -export type AllEpicsOptions = { - authorId?: number; - authorUsername?: string; - labels?: string; - withLabelsDetails?: boolean; - orderBy?: 'created_at' | 'updated_at' | 'title'; - sort?: string; - search?: string; - state?: string; - createdAfter?: string; - createdBefore?: string; - updatedAfter?: string; - updatedBefore?: string; - includeAncestorGroups?: boolean; - includeDescendantGroups?: boolean; - myReactionEmoji?: string; - not?: Record; -}; - -export type CreateEpicOptions = { - labels?: string; - description?: string; - color?: string; - confidential?: boolean; - createdAt?: string; - startDateIsFixed?: boolean; - startDateFixed?: string; - dueDateIsFixed?: boolean; - dueDateFixed?: string; - parentId?: number | string; -}; - -export type EditEpicOptions = { - addLabels?: string; - confidential?: boolean; - description?: string; - dueDateFixed?: string; - dueDateIsFixed?: boolean; - labels?: string; - parentId?: number | string; - removeLabels?: string; - startDateFixed?: string; - startDateIsFixed?: boolean; - stateEvent?: string; - title?: string; - updatedAt?: string; - color?: string; -}; -export class Epics extends BaseResource { - all( - groupId: string | number, - options: { withLabelsDetails: true } & AllEpicsOptions & - BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise>; - - all( - groupId: string | number, - options?: { withLabelsDetails?: false } & AllEpicsOptions & - BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise>; - - all( - groupId: string | number, - options?: AllEpicsOptions & - BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, endpoint`groups/${groupId}/epics`, { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - create( - groupId: string | number, - title: string, - options?: CreateEpicOptions & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.post()(this, endpoint`groups/${groupId}/epics`, { - sudo, - showExpanded, - body: { - ...body, - title, - }, - }); - } - - createTodo( - groupId: string | number, - epicIId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.post()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/todos`, - { - showExpanded, - sudo, - }, - ); - } - - edit( - groupId: string | number, - epicIId: number, - options?: EditEpicOptions & ShowExpanded & Sudo, - ): Promise, C, E, void>> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.put>()( - this, - endpoint`groups/${groupId}/epics/${epicIId}`, - { - sudo, - showExpanded, - body, - }, - ); - } - - remove( - groupId: string | number, - epicIId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.del()(this, endpoint`groups/${groupId}/epics/${epicIId}`, { - showExpanded, - sudo, - }); - } - - show( - groupId: string | number, - epicIId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { showExpanded, sudo } = options || {}; - - return RequestHelper.get()(this, endpoint`groups/${groupId}/epics/${epicIId}`, { - showExpanded, - sudo, - }); - } -} diff --git a/packages/core/src/resources/ErrorTrackingClientKeys.ts b/packages/core/src/resources/ErrorTrackingClientKeys.ts index aae7077f7..c4bbaef0f 100644 --- a/packages/core/src/resources/ErrorTrackingClientKeys.ts +++ b/packages/core/src/resources/ErrorTrackingClientKeys.ts @@ -59,13 +59,18 @@ export class ErrorTrackingClientKeys extends BaseReso remove( projectId: string | number, + keyId: number, options?: ShowExpanded & Sudo, ): Promise> { const { showExpanded, sudo } = options || {}; - return RequestHelper.del()(this, endpoint`projects/${projectId}/error_tracking/client_keys`, { - showExpanded, - sudo, - }); + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/error_tracking/client_keys/${keyId}`, + { + showExpanded, + sudo, + }, + ); } } diff --git a/packages/core/src/resources/Events.ts b/packages/core/src/resources/Events.ts index 925da1ed6..349f4d6ae 100644 --- a/packages/core/src/resources/Events.ts +++ b/packages/core/src/resources/Events.ts @@ -28,26 +28,64 @@ export type AllEventOptions = { | 'joined' | 'left' | 'destroyed' - | 'expired'; - targetType?: 'issue' | 'milestone' | 'merge_request' | 'note' | 'project' | 'snippet' | 'user'; + | 'expired' + | 'opened'; + targetType?: + | 'epic' + | 'issue' + | 'milestone' + | 'merge_request' + | 'note' + | 'project' + | 'snippet' + | 'user'; before?: string; after?: string; scope?: string; sort?: 'asc' | 'desc'; }; +export interface EventPushDataSchema extends Record { + commit_count: number; + action: string; + ref_type: string; + commit_from?: string | null; + commit_to?: string | null; + ref?: string | null; + commit_title?: string | null; + ref_count?: number; +} + +export interface EventNoteSchema extends Record { + id: number; + body: string; + attachment?: string | null; + author: MappedOmit; + created_at: string; + system: boolean; + noteable_id: number; + noteable_type: string; + noteable_iid?: number; +} + export interface EventSchema extends Record { id: number; - title?: string; + title?: string | null; project_id: number; action_name: string; - target_id: number; - target_type: string; + target_id?: number | null; + target_iid?: number | null; + target_type?: string | null; author_id: number; - target_title: string; + target_title?: string | null; created_at: string; author: MappedOmit; author_username: string; + imported?: boolean; + imported_from?: string; + push_data?: EventPushDataSchema; + note?: EventNoteSchema; + data?: any; } export class Events extends BaseResource { diff --git a/packages/core/src/resources/ExternalControls.ts b/packages/core/src/resources/ExternalControls.ts new file mode 100644 index 000000000..3ab8cd17c --- /dev/null +++ b/packages/core/src/resources/ExternalControls.ts @@ -0,0 +1,47 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ExternalControlStatusSchema extends Record { + status: string; +} + +export class ExternalControls extends BaseResource { + setStatus( + projectId: string | number, + externalControlId: number, + status: 'pass' | 'fail', + options?: { + timestamp: string; + nonce: string; + hmacSignature: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, timestamp, nonce, hmacSignature } = options || {}; + const headers: Record = {}; + const clonedService = { ...this }; + + if (timestamp) headers['X-Gitlab-Timestamp'] = timestamp; + if (nonce) headers['X-Gitlab-Nonce'] = nonce; + if (hmacSignature) headers['X-Gitlab-Hmac-Sha256'] = hmacSignature; + + if (Object.keys(headers).length > 0) { + clonedService.headers = { ...clonedService.headers, ...headers }; + } + + return RequestHelper.patch()( + clonedService, + endpoint`projects/${projectId}/compliance_external_controls/${externalControlId}/status`, + { + sudo, + showExpanded, + body: { + status, + }, + }, + ); + } +} diff --git a/packages/core/src/resources/ExternalStatusChecks.ts b/packages/core/src/resources/ExternalStatusChecks.ts index 8433fbcd2..8a72de116 100644 --- a/packages/core/src/resources/ExternalStatusChecks.ts +++ b/packages/core/src/resources/ExternalStatusChecks.ts @@ -15,7 +15,7 @@ export interface BaseExternalStatusCheckSchema extends Record { id: number; name: string; external_url: string; - status: string; + status?: string; } export type MergeRequestExternalStatusCheckSchema = BaseExternalStatusCheckSchema; @@ -31,6 +31,7 @@ export interface ExternalStatusCheckProtectedBranchesSchema { export interface ProjectExternalStatusCheckSchema extends BaseExternalStatusCheckSchema { project_id: number; + hmac?: boolean; protected_branches?: ExternalStatusCheckProtectedBranchesSchema[]; } @@ -76,7 +77,7 @@ export class ExternalStatusChecks extends BaseResourc projectId: string | number, name: string, externalUrl: string, - options?: { protectedBranchIds: number[] } & ShowExpanded & Sudo, + options?: { protectedBranchIds?: number[]; sharedSecret?: string } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -102,6 +103,7 @@ export class ExternalStatusChecks extends BaseResourc protectedBranchIds?: number[]; externalUrl?: string; name?: string; + sharedSecret?: string; } & ShowExpanded & Sudo, ): Promise> { @@ -140,7 +142,7 @@ export class ExternalStatusChecks extends BaseResourc mergerequestIId: number, sha: string, externalStatusCheckId: number, - options?: { status?: 'passed' | 'failed' } & ShowExpanded & Sudo, + options?: { status?: 'passed' | 'failed' | 'pending' } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -158,4 +160,22 @@ export class ExternalStatusChecks extends BaseResourc }, ); } + + retry( + projectId: string | number, + mergerequestIId: number, + externalStatusCheckId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post<{ message: string }>()( + this, + endpoint`projects/${projectId}/merge_requests/${mergerequestIId}/status_checks/${externalStatusCheckId}/retry`, + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/FeatureFlagUserLists.ts b/packages/core/src/resources/FeatureFlagUserLists.ts index 67e91f98b..333c29012 100644 --- a/packages/core/src/resources/FeatureFlagUserLists.ts +++ b/packages/core/src/resources/FeatureFlagUserLists.ts @@ -73,7 +73,7 @@ export class FeatureFlagUserLists extends BaseResourc edit( projectId: string | number, featureFlagUserListIId: string | number, - options?: { name?: string; userXIds?: string } & ShowExpanded & Sudo, + options?: { name?: string; userXids?: string } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; diff --git a/packages/core/src/resources/FeatureFlags.ts b/packages/core/src/resources/FeatureFlags.ts index f8c0ec668..c4b706734 100644 --- a/packages/core/src/resources/FeatureFlags.ts +++ b/packages/core/src/resources/FeatureFlags.ts @@ -13,6 +13,7 @@ import type { } from '../infrastructure'; import { RequestHelper, endpoint } from '../infrastructure'; +import { FeatureFlagUserListSchema } from './FeatureFlagUserLists'; export interface FeatureFlagStrategyScopeSchema { id: number; @@ -24,11 +25,12 @@ export interface FeatureFlagStrategySchema { name: string; parameters: Record; scopes?: FeatureFlagStrategyScopeSchema[]; + user_list?: FeatureFlagUserListSchema | null; } export interface FeatureFlagSchema extends Record { name: string; - description: string; + description: string | null; active: boolean; version: string; created_at: string; @@ -41,22 +43,37 @@ export type CreateFeatureFlagOptions = { description?: string; active?: boolean; strategies?: { - name: string; - parameters?: Record; + name: + | 'default' + | 'gradualRolloutUserId' + | 'userWithId' + | 'gitlabUserList' + | 'flexibleRollout' + | string; + parameters?: Record; scopes?: MappedOmit[]; - }; + userListId?: number | string; + }[]; }; export type EditFeatureFlagOptions = { description?: string; active?: boolean; + name?: string; strategies?: { - id: string; - name?: string; + id?: string | number; + name?: + | 'default' + | 'gradualRolloutUserId' + | 'userWithId' + | 'gitlabUserList' + | 'flexibleRollout' + | string; _destroy?: boolean; - parameters?: Record; - scopes?: ({ _destroy?: boolean } & FeatureFlagStrategyScopeSchema)[]; - }; + parameters?: Record; + scopes?: ({ id?: number; _destroy?: boolean } & Partial)[]; + userListId?: number | string; + }[]; }; export class FeatureFlags extends BaseResource { diff --git a/packages/core/src/resources/Features.ts b/packages/core/src/resources/Features.ts new file mode 100644 index 000000000..b9dde3cb8 --- /dev/null +++ b/packages/core/src/resources/Features.ts @@ -0,0 +1,109 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface FeatureGateSchema extends Record { + key: string; + value: boolean | number; +} + +export interface FeatureDefinitionSchema extends Record { + name: string; + introduced_by_url: string; + rollout_issue_url: string; + milestone?: string; + log_state_changes?: boolean | null; + type: string; + group: string; + default_enabled: boolean; +} + +export interface FeatureSchema extends Record { + name: string; + state: string; + gates: FeatureGateSchema[]; + definition: FeatureDefinitionSchema | null; +} + +export class Features extends BaseResource { + all( + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'features', { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }); + } + + allDefinitions( + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'features/definitions', { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }); + } + + create( + name: string, + value: boolean | number | string, + options?: { + key?: 'percentage_of_actors' | 'percentage_of_time'; + featureGroup?: string; + user?: string; + group?: string; + namespace?: string; + project?: string; + repository?: string; + runner?: string; + force?: boolean; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()(this, endpoint`features/${name}`, { + sudo, + showExpanded, + body: { + ...body, + value, + }, + }); + } + + remove( + name: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()(this, endpoint`features/${name}`, { + sudo, + showExpanded, + }); + } +} diff --git a/packages/core/src/resources/Flows.ts b/packages/core/src/resources/Flows.ts new file mode 100644 index 000000000..c12adf02e --- /dev/null +++ b/packages/core/src/resources/Flows.ts @@ -0,0 +1,115 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export interface FlowAdditionalContextSchema extends Record { + Category: string; + Content: string; +} + +export interface FlowWorkloadSchema extends Record { + id: string; + message: string; +} + +export interface FlowSchema extends Record { + id: number; + project_id: number | null; + namespace_id: number | null; + agent_privileges: number[]; + agent_privileges_names: string[]; + pre_approved_agent_privileges: number[]; + pre_approved_agent_privileges_names: string[]; + workflow_definition: string; + status: + | 'created' + | 'running' + | 'paused' + | 'finished' + | 'failed' + | 'stopped' + | 'input_required' + | 'plan_approval_required' + | 'tool_call_approval_required'; + allow_agent_to_request_user: boolean; + image: string | null; + environment: string | null; + ai_catalog_item_version_id: number | null; + workload: FlowWorkloadSchema; + mcp_enabled: boolean; + gitlab_url: string; +} + +export interface AgentPrivilegeSchema extends Record { + id: number; + name: string; + description: string; + default_enabled: boolean; +} + +export interface AgentPrivilegesResponseSchema extends Record { + all_privileges: AgentPrivilegeSchema[]; +} + +export class Flows extends BaseResource { + create( + options: { + additionalContext?: FlowAdditionalContextSchema[]; + agentPrivileges?: number[]; + aiCatalogItemConsumerId?: number; + aiCatalogItemVersionId?: number; + allowAgentToRequestUser?: boolean; + environment?: 'ide' | 'web' | 'chat_partial' | 'chat' | 'ambient'; + goal?: string; + image?: string; + issueId?: number; + mergeRequestId?: number; + namespaceId?: string | number; + preApprovedAgentPrivileges?: number[]; + projectId?: string | number; + shallowClone?: boolean; + sourceBranch?: string; + startWorkflow?: boolean; + workflowDefinition?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()(this, 'ai/duo_workflows/workflows', { + sudo, + showExpanded, + body, + }); + } + + allAgentPrivileges( + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + 'ai/duo_workflows/workflows/agent_privileges', + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }, + ); + } +} diff --git a/packages/core/src/resources/GeoNodes.ts b/packages/core/src/resources/GeoNodes.ts deleted file mode 100644 index 541d74067..000000000 --- a/packages/core/src/resources/GeoNodes.ts +++ /dev/null @@ -1,300 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; - -import { RequestHelper, endpoint } from '../infrastructure'; - -export interface GeoNodeSchema extends Record { - id: number; - name: string; - url: string; - internal_url: string; - primary: boolean; - enabled: boolean; - current: boolean; - files_max_capacity: number; - repos_max_capacity: number; - verification_max_capacity: number; - selective_sync_type: string; - selective_sync_shards?: string[]; - selective_sync_namespace_ids?: number[]; - minimum_reverification_interval: number; - container_repositories_max_capacity: number; - sync_object_storage: boolean; - clone_protocol: string; - web_edit_url: string; - web_geo_projects_url: string; - _links: { - self: string; - status: string; - repair: string; - }; -} - -export interface GeoNodeFailureSchema extends Record { - project_id: number; - last_repository_synced_at: string; - last_repository_successful_sync_at: string; - last_wiki_synced_at: string; - last_wiki_successful_sync_at: string; - repository_retry_count?: number; - wiki_retry_count: number; - last_repository_sync_failure?: string; - last_wiki_sync_failure: string; - last_repository_verification_failure: string; - last_wiki_verification_failure: string; - repository_verification_checksum_sha: string; - wiki_verification_checksum_sha: string; - repository_checksum_mismatch: boolean; - wiki_checksum_mismatch: boolean; -} - -export interface GeoNodeStatusSchema extends Record { - geo_node_id: number; - healthy: boolean; - health: string; - health_status: string; - missing_oauth_application: boolean; - attachments_count: number; - attachments_synced_count?: number; - attachments_failed_count?: number; - attachments_synced_missing_on_primary_count: number; - attachments_synced_in_percentage: string; - db_replication_lag_seconds?: number; - lfs_objects_count: number; - lfs_objects_synced_count?: number; - lfs_objects_failed_count?: number; - lfs_objects_synced_missing_on_primary_count: number; - lfs_objects_synced_in_percentage: string; - job_artifacts_count: number; - job_artifacts_synced_count?: number; - job_artifacts_failed_count?: number; - job_artifacts_synced_missing_on_primary_count: number; - job_artifacts_synced_in_percentage: string; - container_repositories_count: number; - container_repositories_synced_count?: number; - container_repositories_failed_count?: number; - container_repositories_synced_in_percentage: string; - design_repositories_count: number; - design_repositories_synced_count?: number; - design_repositories_failed_count?: number; - design_repositories_synced_in_percentage: string; - projects_count: number; - repositories_count: number; - repositories_failed_count?: number; - repositories_synced_count?: number; - repositories_synced_in_percentage: string; - wikis_count: number; - wikis_failed_count?: number; - wikis_synced_count?: number; - wikis_synced_in_percentage: string; - replication_slots_count: number; - replication_slots_used_count: number; - replication_slots_used_in_percentage: string; - replication_slots_max_retained_wal_bytes: number; - repositories_checked_count: number; - repositories_checked_failed_count: number; - repositories_checked_in_percentage: string; - repositories_checksummed_count: number; - repositories_checksum_failed_count: number; - repositories_checksummed_in_percentage: string; - wikis_checksummed_count: number; - wikis_checksum_failed_count: number; - wikis_checksummed_in_percentage: string; - repositories_verified_count: number; - repositories_verification_failed_count: number; - repositories_verified_in_percentage: string; - repositories_checksum_mismatch_count: number; - wikis_verified_count: number; - wikis_verification_failed_count: number; - wikis_verified_in_percentage: string; - wikis_checksum_mismatch_count: number; - repositories_retrying_verification_count: number; - wikis_retrying_verification_count: number; - last_event_id: number; - last_event_timestamp: number; - cursor_last_event_id?: number; - cursor_last_event_timestamp: number; - last_successful_status_check_timestamp: number; - version: string; - revision: string; - package_files_count: number; - package_files_checksummed_count: number; - package_files_checksum_failed_count: number; - package_files_registry_count: number; - package_files_synced_count: number; - package_files_failed_count: number; - snippet_repositories_count: number; - snippet_repositories_checksummed_count: number; - snippet_repositories_checksum_failed_count: number; - snippet_repositories_registry_count: number; - snippet_repositories_synced_count: number; - snippet_repositories_failed_count: number; - group_wiki_repositories_checksummed_count: number; - group_wiki_repositories_checksum_failed_count: number; - group_wiki_repositories_registry_count: number; - group_wiki_repositories_synced_count: number; - group_wiki_repositories_failed_count: number; -} - -export type CreateGeoNodeOptions = { - primary?: boolean; - enabled?: boolean; - internalUrl?: string; - filesMaxCapacity?: number; - reposMaxCapacity?: number; - verificationMaxCapacity?: number; - containerRepositoriesMaxCapacity?: number; - syncObjectStorage?: boolean; - selectiveSyncType?: 'namespaces' | 'shards'; - selectiveSyncShards?: string[]; - selectiveSyncNamespaceIds?: number[]; - minimumReverificationInterval?: number; -}; - -export type EditGeoNodeOptions = { - enabled?: boolean; - name?: string; - url?: string; - internalUrl?: string; - filesMaxCapacity?: number; - reposMaxCapacity?: number; - verificationMaxCapacity?: number; - containerRepositoriesMaxCapacity?: number; - syncObjectStorage?: boolean; - selectiveSyncType?: 'namespaces' | 'shards'; - selectiveSyncShards?: string[]; - selectiveSyncNamespaceIds?: number[]; - minimumReverificationInterval?: number; -}; - -export class GeoNodes extends BaseResource { - all( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, 'geo_nodes', { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - allStatuses( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, 'geo_nodes/statuses', { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - allFailures( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, 'geo_nodes/current/failures', { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - create( - name: string, - url: string, - options?: CreateGeoNodeOptions & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.post()(this, 'geo_nodes', { - sudo, - showExpanded, - body: { ...body, name, url }, - }); - } - - edit( - geonodeId: number, - options?: EditGeoNodeOptions & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.put()(this, endpoint`geo_nodes/${geonodeId}`, { - sudo, - showExpanded, - body, - }); - } - - repair( - geonodeId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.post()(this, endpoint`geo_nodes/${geonodeId}/repair`, { - sudo, - showExpanded, - }); - } - - remove( - geonodeId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.del()(this, endpoint`geo_nodes/${geonodeId}`, { - sudo, - showExpanded, - }); - } - - show( - geonodeId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.get()(this, endpoint`geo_nodes/${geonodeId}`, { - sudo, - showExpanded, - }); - } - - showStatus( - geonodeId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.get()(this, endpoint`geo_nodes/${geonodeId}/status`, { - sudo, - showExpanded, - }); - } -} diff --git a/packages/core/src/resources/GeoSites.ts b/packages/core/src/resources/GeoSites.ts index abd0c9783..69d396880 100644 --- a/packages/core/src/resources/GeoSites.ts +++ b/packages/core/src/resources/GeoSites.ts @@ -11,7 +11,41 @@ import type { Sudo, } from '../infrastructure'; -import { RequestHelper } from '../infrastructure'; +import { endpoint, RequestHelper } from '../infrastructure'; + +export interface GeoSiteCreateOptions { + primary?: boolean; + enabled?: boolean; + name: string; + url: string; + internalUrl?: string; + filesMaxCapacity?: number; + reposMaxCapacity?: number; + verificationMaxCapacity?: number; + containerRepositoriesMaxCapacity?: number; + syncObjectStorage?: boolean; + selectiveSyncType?: 'namespaces' | 'shards' | null; + selectiveSyncShards?: string[]; + selectiveSyncNamespaceIds?: number[]; + minimumReverificationInterval?: number; + blobDownloadTimeout?: number; +} + +export interface GeoSiteUpdateOptions { + enabled?: boolean; + name?: string; + url?: string; + internalUrl?: string; + filesMaxCapacity?: number; + reposMaxCapacity?: number; + verificationMaxCapacity?: number; + containerRepositoriesMaxCapacity?: number; + selectiveSyncType?: 'namespaces' | 'shards' | null; + selectiveSyncShards?: string[]; + selectiveSyncNamespaceIds?: number[]; + minimumReverificationInterval?: number; + blobDownloadTimeout?: number; +} export interface GeoSiteSchema extends Record { id: number; @@ -24,13 +58,15 @@ export interface GeoSiteSchema extends Record { files_max_capacity: number; repos_max_capacity: number; verification_max_capacity: number; - selective_sync_type: string; - selective_sync_shards?: string[]; - selective_sync_namespace_ids?: number[]; + container_repositories_max_capacity: number; + selective_sync_type: 'namespaces' | 'shards' | null; + selective_sync_shards: string[]; + selective_sync_namespace_ids: number[]; minimum_reverification_interval: number; - sync_object_storage: boolean; + sync_object_storage?: boolean; + blob_download_timeout?: number; web_edit_url: string; - web_geo_projects_url: string; + web_geo_replication_details_url?: string; _links: { self: string; status: string; @@ -40,125 +76,12 @@ export interface GeoSiteSchema extends Record { export interface GeoSiteStatusSchema extends Record { geo_node_id: number; - repository_verification_enabled: boolean; - repositories_replication_enabled?: boolean; - repositories_synced_count: number | null; - repositories_failed_count: number | null; - repositories_verified_count: number | null; - repositories_verification_failed_count: number | null; - repositories_verification_total_count: number | null; - job_artifacts_synced_missing_on_primary_count: number | null; - repositories_checksummed_count: number | null; - repositories_checksum_failed_count: number | null; - repositories_checksum_mismatch_count: number | null; - repositories_checksum_total_count: number | null; - repositories_retrying_verification_count: number | null; projects_count: number | null; container_repositories_replication_enabled: boolean | null; - lfs_objects_count: number; - lfs_objects_checksum_total_count: number; - lfs_objects_checksummed_count: number; - lfs_objects_checksum_failed_count: number; - lfs_objects_synced_count: number | null; - lfs_objects_failed_count: number | null; - lfs_objects_registry_count: number | null; - lfs_objects_verification_total_count: number | null; - lfs_objects_verified_count: number | null; - lfs_objects_verification_failed_count?: number | null; - merge_request_diffs_count: number; - merge_request_diffs_checksum_total_count: number; - merge_request_diffs_checksummed_count: number; - merge_request_diffs_checksum_failed_count: number; - merge_request_diffs_synced_count: number | null; - merge_request_diffs_failed_count: number | null; - merge_request_diffs_registry_count: number | null; - merge_request_diffs_verification_total_count: number | null; - merge_request_diffs_verified_count: number | null; - merge_request_diffs_verification_failed_count: number | null; - package_files_count: number; - package_files_checksum_total_count: number; - package_files_checksummed_count: number; - package_files_checksum_failed_count: number; - package_files_synced_count: number | null; - package_files_failed_count: number | null; - package_files_registry_count: number | null; - package_files_verification_total_count: number | null; - package_files_verified_count: number | null; - package_files_verification_failed_count: number | null; - terraform_state_versions_count: number; - terraform_state_versions_checksum_total_count: number; - terraform_state_versions_checksummed_count: number; - terraform_state_versions_checksum_failed_count: number; - terraform_state_versions_synced_count: number | null; - terraform_state_versions_failed_count: number | null; - terraform_state_versions_registry_count: number | null; - terraform_state_versions_verification_total_count: number | null; - terraform_state_versions_verified_count: number | null; - terraform_state_versions_verification_failed_count: number | null; - snippet_repositories_count: number; - snippet_repositories_checksum_total_count: number; - snippet_repositories_checksummed_count: number; - snippet_repositories_checksum_failed_count: number; - snippet_repositories_synced_count: number | null; - snippet_repositories_failed_count: number | null; - snippet_repositories_registry_count: number | null; - snippet_repositories_verification_total_count: number | null; - snippet_repositories_verified_count: number | null; - snippet_repositories_verification_failed_count: number | null; - group_wiki_repositories_count: number; - group_wiki_repositories_checksum_total_count: number | null; - group_wiki_repositories_checksummed_count: number | null; - group_wiki_repositories_checksum_failed_count: number | null; - group_wiki_repositories_synced_count: number | null; - group_wiki_repositories_failed_count: number | null; - group_wiki_repositories_registry_count: number | null; - group_wiki_repositories_verification_total_count: number | null; - group_wiki_repositories_verified_count: number | null; - group_wiki_repositories_verification_failed_count: number | null; - pipeline_artifacts_count: number; - pipeline_artifacts_checksum_total_count: number; - pipeline_artifacts_checksummed_count: number; - pipeline_artifacts_checksum_failed_count: number; - pipeline_artifacts_synced_count: number | null; - pipeline_artifacts_failed_count: number | null; - pipeline_artifacts_registry_count: number | null; - pipeline_artifacts_verification_total_count: number | null; - pipeline_artifacts_verified_count: number | null; - pipeline_artifacts_verification_failed_count: number | null; - pages_deployments_count: number; - pages_deployments_checksum_total_count: number; - pages_deployments_checksummed_count: number; - pages_deployments_checksum_failed_count: number; - pages_deployments_synced_count: number | null; - pages_deployments_failed_count: number | null; - pages_deployments_registry_count: number | null; - pages_deployments_verification_total_count: number | null; - pages_deployments_verified_count: number | null; - pages_deployments_verification_failed_count: number | null; - uploads_count: number; - uploads_checksum_total_count: number; - uploads_checksummed_count: number; - uploads_checksum_failed_count: number; - uploads_synced_count: number | null; - uploads_failed_count: number | null; - uploads_registry_count: number | null; - uploads_verification_total_count: number | null; - uploads_verified_count: number | null; - uploads_verification_failed_count: number | null; - job_artifacts_count: number; - job_artifacts_checksum_total_count: number; - job_artifacts_checksummed_count: number; - job_artifacts_checksum_failed_count: number; - job_artifacts_synced_count: number | null; - job_artifacts_failed_count: number | null; - job_artifacts_registry_count: number | null; - job_artifacts_verification_total_count: number | null; - job_artifacts_verified_count: number | null; - job_artifacts_verification_failed_count: number | null; ci_secure_files_count: number; - ci_secure_files_checksum_total_count: number; - ci_secure_files_checksummed_count: number; - ci_secure_files_checksum_failed_count: number; + ci_secure_files_checksum_total_count: number | null; + ci_secure_files_checksummed_count: number | null; + ci_secure_files_checksum_failed_count: number | null; ci_secure_files_synced_count: number | null; ci_secure_files_failed_count: number | null; ci_secure_files_registry_count: number | null; @@ -166,9 +89,9 @@ export interface GeoSiteStatusSchema extends Record { ci_secure_files_verified_count: number | null; ci_secure_files_verification_failed_count: number | null; container_repositories_count: number; - container_repositories_checksum_total_count: number; - container_repositories_checksummed_count: number; - container_repositories_checksum_failed_count: number; + container_repositories_checksum_total_count: number | null; + container_repositories_checksummed_count: number | null; + container_repositories_checksum_failed_count: number | null; container_repositories_synced_count: number | null; container_repositories_failed_count: number | null; container_repositories_registry_count: number | null; @@ -176,9 +99,9 @@ export interface GeoSiteStatusSchema extends Record { container_repositories_verified_count: number | null; container_repositories_verification_failed_count: number | null; dependency_proxy_blobs_count: number; - dependency_proxy_blobs_checksum_total_count: number; - dependency_proxy_blobs_checksummed_count: number; - dependency_proxy_blobs_checksum_failed_count: number; + dependency_proxy_blobs_checksum_total_count: number | null; + dependency_proxy_blobs_checksummed_count: number | null; + dependency_proxy_blobs_checksum_failed_count: number | null; dependency_proxy_blobs_synced_count: number | null; dependency_proxy_blobs_failed_count: number | null; dependency_proxy_blobs_registry_count: number | null; @@ -186,54 +109,259 @@ export interface GeoSiteStatusSchema extends Record { dependency_proxy_blobs_verified_count: number | null; dependency_proxy_blobs_verification_failed_count: number | null; dependency_proxy_manifests_count: number; - dependency_proxy_manifests_checksum_total_count: number; - dependency_proxy_manifests_checksummed_count: number; - dependency_proxy_manifests_checksum_failed_count: number; + dependency_proxy_manifests_checksum_total_count: number | null; + dependency_proxy_manifests_checksummed_count: number | null; + dependency_proxy_manifests_checksum_failed_count: number | null; dependency_proxy_manifests_synced_count: number | null; dependency_proxy_manifests_failed_count: number | null; dependency_proxy_manifests_registry_count: number | null; dependency_proxy_manifests_verification_total_count: number | null; dependency_proxy_manifests_verified_count: number | null; dependency_proxy_manifests_verification_failed_count: number | null; + design_management_repositories_count: number; + design_management_repositories_checksum_total_count: number | null; + design_management_repositories_checksummed_count: number | null; + design_management_repositories_checksum_failed_count: number | null; + design_management_repositories_synced_count: number | null; + design_management_repositories_failed_count: number | null; + design_management_repositories_registry_count: number | null; + design_management_repositories_verification_total_count: number | null; + design_management_repositories_verified_count: number | null; + design_management_repositories_verification_failed_count: number | null; + group_wiki_repositories_count: number; + group_wiki_repositories_checksum_total_count: number | null; + group_wiki_repositories_checksummed_count: number | null; + group_wiki_repositories_checksum_failed_count: number | null; + group_wiki_repositories_synced_count: number | null; + group_wiki_repositories_failed_count: number | null; + group_wiki_repositories_registry_count: number | null; + group_wiki_repositories_verification_total_count: number | null; + group_wiki_repositories_verified_count: number | null; + group_wiki_repositories_verification_failed_count: number | null; + job_artifacts_count: number; + job_artifacts_checksum_total_count: number | null; + job_artifacts_checksummed_count: number | null; + job_artifacts_checksum_failed_count: number | null; + job_artifacts_synced_count: number | null; + job_artifacts_failed_count: number | null; + job_artifacts_registry_count: number | null; + job_artifacts_verification_total_count: number | null; + job_artifacts_verified_count: number | null; + job_artifacts_verification_failed_count: number | null; + lfs_objects_count: number; + lfs_objects_checksum_total_count: number | null; + lfs_objects_checksummed_count: number | null; + lfs_objects_checksum_failed_count: number | null; + lfs_objects_synced_count: number | null; + lfs_objects_failed_count: number | null; + lfs_objects_registry_count: number | null; + lfs_objects_verification_total_count: number | null; + lfs_objects_verified_count: number | null; + lfs_objects_verification_failed_count: number | null; + merge_request_diffs_count: number; + merge_request_diffs_checksum_total_count: number | null; + merge_request_diffs_checksummed_count: number | null; + merge_request_diffs_checksum_failed_count: number | null; + merge_request_diffs_synced_count: number | null; + merge_request_diffs_failed_count: number | null; + merge_request_diffs_registry_count: number | null; + merge_request_diffs_verification_total_count: number | null; + merge_request_diffs_verified_count: number | null; + merge_request_diffs_verification_failed_count: number | null; + package_files_count: number; + package_files_checksum_total_count: number | null; + package_files_checksummed_count: number | null; + package_files_checksum_failed_count: number | null; + package_files_synced_count: number | null; + package_files_failed_count: number | null; + package_files_registry_count: number | null; + package_files_verification_total_count: number | null; + package_files_verified_count: number | null; + package_files_verification_failed_count: number | null; + pages_deployments_count: number; + pages_deployments_checksum_total_count: number | null; + pages_deployments_checksummed_count: number | null; + pages_deployments_checksum_failed_count: number | null; + pages_deployments_synced_count: number | null; + pages_deployments_failed_count: number | null; + pages_deployments_registry_count: number | null; + pages_deployments_verification_total_count: number | null; + pages_deployments_verified_count: number | null; + pages_deployments_verification_failed_count: number | null; + pipeline_artifacts_count: number; + pipeline_artifacts_checksum_total_count: number | null; + pipeline_artifacts_checksummed_count: number | null; + pipeline_artifacts_checksum_failed_count: number | null; + pipeline_artifacts_synced_count: number | null; + pipeline_artifacts_failed_count: number | null; + pipeline_artifacts_registry_count: number | null; + pipeline_artifacts_verification_total_count: number | null; + pipeline_artifacts_verified_count: number | null; + pipeline_artifacts_verification_failed_count: number | null; + project_repositories_count: number; + project_repositories_checksum_total_count: number | null; + project_repositories_checksummed_count: number | null; + project_repositories_checksum_failed_count: number | null; + project_repositories_synced_count: number | null; + project_repositories_failed_count: number | null; + project_repositories_registry_count: number | null; + project_repositories_verification_total_count: number | null; + project_repositories_verified_count: number | null; + project_repositories_verification_failed_count: number | null; project_wiki_repositories_count: number; - project_wiki_repositories_checksum_total_count: number; - project_wiki_repositories_checksummed_count: number; - project_wiki_repositories_checksum_failed_count: number; + project_wiki_repositories_checksum_total_count: number | null; + project_wiki_repositories_checksummed_count: number | null; + project_wiki_repositories_checksum_failed_count: number | null; project_wiki_repositories_synced_count: number | null; project_wiki_repositories_failed_count: number | null; project_wiki_repositories_registry_count: number | null; project_wiki_repositories_verification_total_count: number | null; project_wiki_repositories_verified_count: number | null; project_wiki_repositories_verification_failed_count: number | null; + snippet_repositories_count: number; + snippet_repositories_checksum_total_count: number | null; + snippet_repositories_checksummed_count: number | null; + snippet_repositories_checksum_failed_count: number | null; + snippet_repositories_synced_count: number | null; + snippet_repositories_failed_count: number | null; + snippet_repositories_registry_count: number | null; + snippet_repositories_verification_total_count: number | null; + snippet_repositories_verified_count: number | null; + snippet_repositories_verification_failed_count: number | null; + terraform_state_versions_count: number; + terraform_state_versions_checksum_total_count: number | null; + terraform_state_versions_checksummed_count: number | null; + terraform_state_versions_checksum_failed_count: number | null; + terraform_state_versions_synced_count: number | null; + terraform_state_versions_failed_count: number | null; + terraform_state_versions_registry_count: number | null; + terraform_state_versions_verification_total_count: number | null; + terraform_state_versions_verified_count: number | null; + terraform_state_versions_verification_failed_count: number | null; + uploads_count: number; + uploads_checksum_total_count: number | null; + uploads_checksummed_count: number | null; + uploads_checksum_failed_count: number | null; + uploads_synced_count: number | null; + uploads_failed_count: number | null; + uploads_registry_count: number | null; + uploads_verification_total_count: number | null; + uploads_verified_count: number | null; + uploads_verification_failed_count: number | null; + abuse_report_uploads_count: number; + abuse_report_uploads_checksum_total_count: number; + abuse_report_uploads_checksummed_count: number; + abuse_report_uploads_checksum_failed_count: number; + abuse_report_uploads_synced_count: number | null; + abuse_report_uploads_failed_count: number | null; + abuse_report_uploads_registry_count: number | null; + abuse_report_uploads_verification_total_count: number | null; + abuse_report_uploads_verified_count: number | null; + abuse_report_uploads_verification_failed_count: number | null; + abuse_report_uploads_synced_in_percentage: string; + abuse_report_uploads_verified_in_percentage: string; + project_uploads_count: number; + project_uploads_checksum_total_count: number; + project_uploads_checksummed_count: number; + project_uploads_checksum_failed_count: number; + project_uploads_synced_count: number | null; + project_uploads_failed_count: number | null; + project_uploads_registry_count: number | null; + project_uploads_verification_total_count: number | null; + project_uploads_verified_count: number | null; + project_uploads_verification_failed_count: number | null; + project_uploads_synced_in_percentage: string; + project_uploads_verified_in_percentage: string; + group_uploads_count: number; + group_uploads_checksum_total_count: number; + group_uploads_checksummed_count: number; + group_uploads_checksum_failed_count: number; + group_uploads_synced_count: number | null; + group_uploads_failed_count: number | null; + group_uploads_registry_count: number | null; + group_uploads_verification_total_count: number | null; + group_uploads_verified_count: number | null; + group_uploads_verification_failed_count: number | null; + group_uploads_synced_in_percentage: string; + group_uploads_verified_in_percentage: string; + user_uploads_count: number; + user_uploads_checksum_total_count: number; + user_uploads_checksummed_count: number; + user_uploads_checksum_failed_count: number; + user_uploads_synced_count: number | null; + user_uploads_failed_count: number | null; + user_uploads_registry_count: number | null; + user_uploads_verification_total_count: number | null; + user_uploads_verified_count: number | null; + user_uploads_verification_failed_count: number | null; + user_uploads_synced_in_percentage: string; + user_uploads_verified_in_percentage: string; + design_management_action_uploads_count: number; + design_management_action_uploads_checksum_total_count: number; + design_management_action_uploads_checksummed_count: number; + design_management_action_uploads_checksum_failed_count: number; + design_management_action_uploads_synced_count: number | null; + design_management_action_uploads_failed_count: number | null; + design_management_action_uploads_registry_count: number | null; + design_management_action_uploads_verification_total_count: number | null; + design_management_action_uploads_verified_count: number | null; + design_management_action_uploads_verification_failed_count: number | null; + design_management_action_uploads_synced_in_percentage: string; + design_management_action_uploads_verified_in_percentage: string; + bulk_import_export_upload_uploads_count: number; + bulk_import_export_upload_uploads_checksum_total_count: number; + bulk_import_export_upload_uploads_checksummed_count: number; + bulk_import_export_upload_uploads_checksum_failed_count: number; + bulk_import_export_upload_uploads_synced_count: number | null; + bulk_import_export_upload_uploads_failed_count: number | null; + bulk_import_export_upload_uploads_registry_count: number | null; + bulk_import_export_upload_uploads_verification_total_count: number | null; + bulk_import_export_upload_uploads_verified_count: number | null; + bulk_import_export_upload_uploads_verification_failed_count: number | null; + bulk_import_export_upload_uploads_synced_in_percentage: string; + bulk_import_export_upload_uploads_verified_in_percentage: string; + achievement_uploads_count: number; + achievement_uploads_checksum_total_count: number; + achievement_uploads_checksummed_count: number; + achievement_uploads_checksum_failed_count: number; + achievement_uploads_synced_count: number | null; + achievement_uploads_failed_count: number | null; + achievement_uploads_registry_count: number | null; + achievement_uploads_verification_total_count: number | null; + achievement_uploads_verified_count: number | null; + achievement_uploads_verification_failed_count: number | null; + achievement_uploads_synced_in_percentage: string; + achievement_uploads_verified_in_percentage: string; + ai_vectorizable_file_uploads_count: number; + ai_vectorizable_file_uploads_checksum_total_count: number; + ai_vectorizable_file_uploads_checksummed_count: number; + ai_vectorizable_file_uploads_checksum_failed_count: number; + ai_vectorizable_file_uploads_synced_count: number | null; + ai_vectorizable_file_uploads_failed_count: number | null; + ai_vectorizable_file_uploads_registry_count: number | null; + ai_vectorizable_file_uploads_verification_total_count: number | null; + ai_vectorizable_file_uploads_verified_count: number | null; + ai_vectorizable_file_uploads_verification_failed_count: number | null; + ai_vectorizable_file_uploads_synced_in_percentage: string; + ai_vectorizable_file_uploads_verified_in_percentage: string; + import_export_upload_uploads_count: number; + import_export_upload_uploads_checksum_total_count: number; + import_export_upload_uploads_checksummed_count: number; + import_export_upload_uploads_checksum_failed_count: number; + import_export_upload_uploads_synced_count: number | null; + import_export_upload_uploads_failed_count: number | null; + import_export_upload_uploads_registry_count: number | null; + import_export_upload_uploads_verification_total_count: number | null; + import_export_upload_uploads_verified_count: number | null; + import_export_upload_uploads_verification_failed_count: number | null; + import_export_upload_uploads_synced_in_percentage: string; + import_export_upload_uploads_verified_in_percentage: string; git_fetch_event_count_weekly: number | null; git_push_event_count_weekly: number | null; proxy_remote_requests_event_count_weekly: number | null; proxy_local_requests_event_count_weekly: number | null; - repositories_synced_in_percentage: string; - repositories_checksummed_in_percentage: string; - repositories_verified_in_percentage: string; repositories_checked_in_percentage: string; replication_slots_used_in_percentage: string; - lfs_objects_synced_in_percentage: string; - lfs_objects_verified_in_percentage: string; - merge_request_diffs_synced_in_percentage: string; - merge_request_diffs_verified_in_percentage: string; - package_files_synced_in_percentage: string; - package_files_verified_in_percentage: string; - terraform_state_versions_synced_in_percentage: string; - terraform_state_versions_verified_in_percentage: string; - snippet_repositories_synced_in_percentage: string; - snippet_repositories_verified_in_percentage: string; - group_wiki_repositories_synced_in_percentage: string; - group_wiki_repositories_verified_in_percentage: string; - pipeline_artifacts_synced_in_percentage: string; - pipeline_artifacts_verified_in_percentage: string; - pages_deployments_synced_in_percentage: string; - pages_deployments_verified_in_percentage: string; - uploads_synced_in_percentage: string; - uploads_verified_in_percentage: string; - job_artifacts_synced_in_percentage: string; - job_artifacts_verified_in_percentage: string; ci_secure_files_synced_in_percentage: string; ci_secure_files_verified_in_percentage: string; container_repositories_synced_in_percentage: string; @@ -242,17 +370,41 @@ export interface GeoSiteStatusSchema extends Record { dependency_proxy_blobs_verified_in_percentage: string; dependency_proxy_manifests_synced_in_percentage: string; dependency_proxy_manifests_verified_in_percentage: string; + design_management_repositories_synced_in_percentage: string; + design_management_repositories_verified_in_percentage: string; + group_wiki_repositories_synced_in_percentage: string; + group_wiki_repositories_verified_in_percentage: string; + job_artifacts_synced_in_percentage: string; + job_artifacts_verified_in_percentage: string; + lfs_objects_synced_in_percentage: string; + lfs_objects_verified_in_percentage: string; + merge_request_diffs_synced_in_percentage: string; + merge_request_diffs_verified_in_percentage: string; + package_files_synced_in_percentage: string; + package_files_verified_in_percentage: string; + pages_deployments_synced_in_percentage: string; + pages_deployments_verified_in_percentage: string; + pipeline_artifacts_synced_in_percentage: string; + pipeline_artifacts_verified_in_percentage: string; + project_repositories_synced_in_percentage: string; + project_repositories_verified_in_percentage: string; project_wiki_repositories_synced_in_percentage: string; project_wiki_repositories_verified_in_percentage: string; + snippet_repositories_synced_in_percentage: string; + snippet_repositories_verified_in_percentage: string; + terraform_state_versions_synced_in_percentage: string; + terraform_state_versions_verified_in_percentage: string; + uploads_synced_in_percentage: string; + uploads_verified_in_percentage: string; repositories_count: number; - replication_slots_count: number; - replication_slots_used_count: number; + replication_slots_count: number | null; + replication_slots_used_count: number | null; healthy: boolean; health: string; health_status: string; missing_oauth_application: boolean; db_replication_lag_seconds: number | null; - replication_slots_max_retained_wal_bytes: number; + replication_slots_max_retained_wal_bytes: number | null; repositories_checked_count: number | null; repositories_checked_failed_count: number | null; last_event_id: number; @@ -262,8 +414,8 @@ export interface GeoSiteStatusSchema extends Record { last_successful_status_check_timestamp: number; version: string; revision: string; - selective_sync_type: string | null; - namespaces: string[] | null; + selective_sync_type: 'namespaces' | 'shards' | null; + namespaces: unknown[]; updated_at: string; storage_shards_match: boolean; _links: { @@ -272,41 +424,6 @@ export interface GeoSiteStatusSchema extends Record { }; } -export interface GeoSiteFailureSchema extends Record { - project_id: number; - last_repository_synced_at: string; - last_repository_successful_sync_at: string; - last_wiki_synced_at: string; - last_wiki_successful_sync_at: string; - repository_retry_count: number | null; - wiki_retry_count: number; - last_repository_sync_failure: string | null; - last_wiki_sync_failure: string; - last_repository_verification_failure: string; - last_wiki_verification_failure: string; - repository_verification_checksum_sha: string; - wiki_verification_checksum_sha: string; - repository_checksum_mismatch: boolean; - wiki_checksum_mismatch: boolean; -} - -export type CreateGeoSiteOptions = { - primary?: boolean; - enabled?: boolean; - internalUrl?: string; - filesMaxCapacity?: number; - reposMaxCapacity?: number; - verificationMaxCapacity?: number; - containerRepositoriesMaxCapacity?: number; - syncObjectStorage?: boolean; - selectiveSyncType?: 'namespaces' | 'shards'; - selectiveSyncShards?: string[]; - selectiveSyncNamespaceIds?: number[]; - minimumReverificationInterval?: number; -}; - -export type EditGeoSiteOptions = CreateGeoSiteOptions; - export class GeoSites extends BaseResource { all( options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, @@ -323,57 +440,31 @@ export class GeoSites extends BaseResource { }); } - allStatuses( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, 'geo_sites/statuses', { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - allFailures( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, 'geo_sites/current/failures', { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - create( name: string, url: string, - options?: CreateGeoSiteOptions & ShowExpanded & Sudo, + options?: GeoSiteCreateOptions & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; return RequestHelper.post()(this, 'geo_sites', { sudo, showExpanded, - body: { ...body, name, url }, + body: { + ...body, + name, + url, + }, }); } edit( - geositeId: number, - options?: EditGeoSiteOptions & ShowExpanded & Sudo, + siteId: string | number, + options?: GeoSiteUpdateOptions & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.put()(this, `geo_sites/${geositeId}`, { + return RequestHelper.put()(this, endpoint`geo_sites/${siteId}`, { sudo, showExpanded, body, @@ -381,48 +472,61 @@ export class GeoSites extends BaseResource { } repair( - geositeId: number, + siteId: string | number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.post()(this, `geo_sites/${geositeId}/repair`, { + return RequestHelper.post()(this, endpoint`geo_sites/${siteId}/repair`, { sudo, showExpanded, }); } remove( - geositeId: number, + siteId: string | number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.del()(this, `geo_sites/${geositeId}`, { + return RequestHelper.del()(this, endpoint`geo_sites/${siteId}`, { sudo, showExpanded, }); } show( - geositeId: number, + siteId: string | number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.get()(this, `geo_sites/${geositeId}`, { + return RequestHelper.get()(this, endpoint`geo_sites/${siteId}`, { + sudo, + showExpanded, + }); + } + + allStatuses( + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'geo_sites/status', { sudo, showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, }); } showStatus( - geositeId: number, + siteId: string | number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.get()(this, `geo_sites/${geositeId}/status`, { + return RequestHelper.get()(this, endpoint`geo_sites/${siteId}/status`, { sudo, showExpanded, }); diff --git a/packages/core/src/resources/GitLabCIYMLTemplates.ts b/packages/core/src/resources/GitLabCIYMLTemplates.ts deleted file mode 100644 index bcc5633e9..000000000 --- a/packages/core/src/resources/GitLabCIYMLTemplates.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import { ResourceTemplates } from '../templates'; - -export class GitLabCIYMLTemplates extends ResourceTemplates { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('gitlab_ci_ymls', options); - } -} diff --git a/packages/core/src/resources/GitLabDuoChat.ts b/packages/core/src/resources/GitLabDuoChat.ts new file mode 100644 index 000000000..b328bfad9 --- /dev/null +++ b/packages/core/src/resources/GitLabDuoChat.ts @@ -0,0 +1,37 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export interface GitLabDuoChatContextItem { + category: 'file' | 'merge_request' | 'issue' | 'snippet'; + id: string; + content: string; + metadata?: Record; +} + +export interface GitLabDuoChatCompletionOptions { + content: string; + resource_type?: string; + resource_id?: string | number; + referer_url?: string; + client_subscription_id?: string; + with_clean_history?: boolean; + project_id?: number; + additional_context?: GitLabDuoChatContextItem[]; +} + +export class GitLabDuoChat extends BaseResource { + completions( + options: GitLabDuoChatCompletionOptions & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()(this, 'chat/completions', { + sudo, + showExpanded, + body, + }); + } +} diff --git a/packages/core/src/resources/GitignoreTemplates.ts b/packages/core/src/resources/GitignoreTemplates.ts deleted file mode 100644 index d27a4a370..000000000 --- a/packages/core/src/resources/GitignoreTemplates.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import { ResourceTemplates } from '../templates'; - -export class GitignoreTemplates extends ResourceTemplates { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('gitignores', options); - } -} diff --git a/packages/core/src/resources/Gitlab.ts b/packages/core/src/resources/Gitlab.ts index def369fae..4a0fe1ef5 100644 --- a/packages/core/src/resources/Gitlab.ts +++ b/packages/core/src/resources/Gitlab.ts @@ -3,52 +3,56 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; import { BaseResource } from '@gitbeaker/requester-utils'; // General -import { Agents } from './Agents'; +import { AICatalog } from './AICatalog'; import { AlertManagement } from './AlertManagement'; import { ApplicationAppearance } from './ApplicationAppearance'; import { ApplicationPlanLimits } from './ApplicationPlanLimits'; import { Applications } from './Applications'; import { ApplicationSettings } from './ApplicationSettings'; import { ApplicationStatistics } from './ApplicationStatistics'; +import { Attestations } from './Attestations'; import { AuditEvents } from './AuditEvents'; import { Avatar } from './Avatar'; import { Branches } from './Branches'; import { BroadcastMessages } from './BroadcastMessages'; +import { BulkImports } from './BulkImports'; +import { ClusterAgents } from './ClusterAgents'; import { CodeSuggestions } from './CodeSuggestions'; import { CommitDiscussions } from './CommitDiscussions'; import { Commits } from './Commits'; +import { CompliancePolicySettings } from './CompliancePolicySettings'; import { Composer } from './Composer'; import { Conan } from './Conan'; +import { ConanV2 } from './ConanV2'; import { ContainerRegistry } from './ContainerRegistry'; -import { DashboardAnnotations } from './DashboardAnnotations'; +import { ContainerRegistryProtectionTagRules } from './ContainerRegistryProtectionTagRules'; +import { ContainerRepositoryProtectionRules } from './ContainerRepositoryProtectionRules'; +import { ContainerVirtualRegistry } from './ContainerVirtualRegistry'; +import { DatabaseMigrations } from './DatabaseMigrations'; +import { DataManagement } from './DataManagement'; import { Debian } from './Debian'; +import { Dependencies } from './Dependencies'; +import { DependencyListExport } from './DependencyListExport'; import { DependencyProxy } from './DependencyProxy'; import { DeployKeys } from './DeployKeys'; import { Deployments } from './Deployments'; import { DeployTokens } from './DeployTokens'; -import { DockerfileTemplates } from './DockerfileTemplates'; import { Environments } from './Environments'; -import { EpicAwardEmojis } from './EpicAwardEmojis'; -import { EpicDiscussions } from './EpicDiscussions'; -import { EpicIssues } from './EpicIssues'; -import { EpicLabelEvents } from './EpicLabelEvents'; -import { EpicLinks } from './EpicLinks'; -import { EpicNotes } from './EpicNotes'; -import { Epics } from './Epics'; -import { EpicStateEvents } from './EpicStateEvents'; import { ErrorTrackingClientKeys } from './ErrorTrackingClientKeys'; import { ErrorTrackingSettings } from './ErrorTrackingSettings'; import { Events } from './Events'; import { Experiments } from './Experiments'; +import { ExternalControls } from './ExternalControls'; import { ExternalStatusChecks } from './ExternalStatusChecks'; import { FeatureFlags } from './FeatureFlags'; import { FeatureFlagUserLists } from './FeatureFlagUserLists'; +import { Features } from './Features'; +import { Flows } from './Flows'; import { FreezePeriods } from './FreezePeriods'; -import { GeoNodes } from './GeoNodes'; import { GeoSites } from './GeoSites'; -import { GitignoreTemplates } from './GitignoreTemplates'; -import { GitLabCIYMLTemplates } from './GitLabCIYMLTemplates'; +import { GitLabDuoChat } from './GitLabDuoChat'; import { GitlabPages } from './GitlabPages'; +import { GoogleCloudIntegration } from './GoogleCloudIntegration'; import { GoProxy } from './GoProxy'; import { GroupAccessRequests } from './GroupAccessRequests'; import { GroupAccessTokens } from './GroupAccessTokens'; @@ -56,9 +60,11 @@ import { GroupActivityAnalytics } from './GroupActivityAnalytics'; import { GroupBadges } from './GroupBadges'; import { GroupCustomAttributes } from './GroupCustomAttributes'; import { GroupDORA4Metrics } from './GroupDORA4Metrics'; +import { GroupEnterpriseUsers } from './GroupEnterpriseUsers'; import { GroupEpicBoards } from './GroupEpicBoards'; import { GroupHooks } from './GroupHooks'; import { GroupImportExports } from './GroupImportExports'; +import { GroupIntegrations } from './GroupIntegrations'; import { GroupInvitations } from './GroupInvitations'; import { GroupIssueBoards } from './GroupIssueBoards'; import { GroupIterations } from './GroupIterations'; @@ -68,6 +74,8 @@ import { GroupMarkdownUploads } from './GroupMarkdownUploads'; import { GroupMemberRoles } from './GroupMemberRoles'; import { GroupMembers } from './GroupMembers'; import { GroupMilestones } from './GroupMilestones'; +import { GroupPlaceholderReassignments } from './GroupPlaceholderReassignments'; +import { GroupProtectedBranches } from './GroupProtectedBranches'; import { GroupProtectedEnvironments } from './GroupProtectedEnvironments'; import { GroupPushRules } from './GroupPushRules'; import { GroupRelationExports } from './GroupRelationExports'; @@ -77,8 +85,11 @@ import { Groups } from './Groups'; import { GroupSAMLIdentities } from './GroupSAMLIdentities'; import { GroupSAMLLinks } from './GroupSAMLLinks'; import { GroupSCIMIdentities } from './GroupSCIMIdentities'; +import { GroupSecuritySettings } from './GroupSecuritySettings'; import { GroupServiceAccounts } from './GroupServiceAccounts'; +import { GroupSSHCertificates } from './GroupSSHCertificates'; import { GroupVariables } from './GroupVariables'; +import { GroupWikiNotes } from './GroupWikiNotes'; import { GroupWikis } from './GroupWikis'; import { Helm } from './Helm'; import { Import } from './Import'; @@ -100,16 +111,17 @@ import { JobArtifacts } from './JobArtifacts'; import { Jobs } from './Jobs'; import { Keys } from './Keys'; import { License } from './License'; -import { LicenseTemplates } from './LicenseTemplates'; -import { LinkedEpics } from './LinkedEpics'; +import { Licenses } from './Licenses'; import { Lint } from './Lint'; import { Markdown } from './Markdown'; import { Maven } from './Maven'; import { MergeRequestApprovals } from './MergeRequestApprovals'; +import { MergeRequestApprovalSettings } from './MergeRequestApprovalSettings'; import { MergeRequestAwardEmojis } from './MergeRequestAwardEmojis'; import { MergeRequestContextCommits } from './MergeRequestContextCommits'; import { MergeRequestDiscussions } from './MergeRequestDiscussions'; import { MergeRequestDraftNotes } from './MergeRequestDraftNotes'; +import { MergeRequestIterationEvents } from './MergeRequestIterationEvents'; import { MergeRequestLabelEvents } from './MergeRequestLabelEvents'; import { MergeRequestMilestoneEvents } from './MergeRequestMilestoneEvents'; import { MergeRequestNoteAwardEmojis } from './MergeRequestNoteAwardEmojis'; @@ -119,18 +131,24 @@ import { MergeRequestStateEvents } from './MergeRequestStateEvents'; import { MergeTrains } from './MergeTrains'; import { Metadata } from './Metadata'; import { Migrations } from './Migrations'; +import { ModelRegistry } from './ModelRegistry'; import { Namespaces } from './Namespaces'; import { NotificationSettings } from './NotificationSettings'; import { NPM } from './NPM'; import { NuGet } from './NuGet'; +import { Orbit } from './Orbit'; +import { Organizations } from './Organizations'; import { PackageRegistry } from './PackageRegistry'; import { Packages } from './Packages'; +import { Pages } from './Pages'; import { PagesDomains } from './PagesDomains'; import { PersonalAccessTokens } from './PersonalAccessTokens'; import { Pipelines } from './Pipelines'; import { PipelineSchedules } from './PipelineSchedules'; import { PipelineScheduleVariables } from './PipelineScheduleVariables'; +import { PipelineTriggers } from './PipelineTriggers'; import { PipelineTriggerTokens } from './PipelineTriggerTokens'; +import { PlanLimits } from './PlanLimits'; import { ProductAnalytics } from './ProductAnalytics'; import { ProjectAccessRequests } from './ProjectAccessRequests'; import { ProjectAccessTokens } from './ProjectAccessTokens'; @@ -148,7 +166,9 @@ import { ProjectLabels } from './ProjectLabels'; import { ProjectMarkdownUploads } from './ProjectMarkdownUploads'; import { ProjectMembers } from './ProjectMembers'; import { ProjectMilestones } from './ProjectMilestones'; +import { ProjectProtectedBranches } from './ProjectProtectedBranches'; import { ProjectProtectedEnvironments } from './ProjectProtectedEnvironments'; +import { ProjectPullMirroring } from './ProjectPullMirroring'; import { ProjectPushRules } from './ProjectPushRules'; import { ProjectRelationsExport } from './ProjectRelationsExport'; import { ProjectReleases } from './ProjectReleases'; @@ -164,8 +184,8 @@ import { ProjectTemplates } from './ProjectTemplates'; import { ProjectTerraformState } from './ProjectTerraformState'; import { ProjectVariables } from './ProjectVariables'; import { ProjectVulnerabilities } from './ProjectVulnerabilities'; +import { ProjectWikiNotes } from './ProjectWikiNotes'; import { ProjectWikis } from './ProjectWikis'; -import { ProtectedBranches } from './ProtectedBranches'; import { ProtectedTags } from './ProtectedTags'; import { PyPI } from './PyPI'; import { ReleaseLinks } from './ReleaseLinks'; @@ -187,6 +207,7 @@ import { Snippets } from './Snippets'; import { Suggestions } from './Suggestions'; import { SystemHooks } from './SystemHooks'; import { Tags } from './Tags'; +import { TerraformModules } from './TerraformModules'; import { TodoLists } from './TodoLists'; import { Topics } from './Topics'; import { UserCustomAttributes } from './UserCustomAttributes'; @@ -201,46 +222,56 @@ import { UserStarredMetricsDashboard } from './UserStarredMetricsDashboard'; // This will most likely be accomplished using higher kinded types: https://github.com/Microsoft/TypeScript/issues/1213#issuecomment-750930496 export interface Gitlab extends BaseResource { - Agents: Agents; + AICatalog: AICatalog; AlertManagement: AlertManagement; ApplicationAppearance: ApplicationAppearance; ApplicationPlanLimits: ApplicationPlanLimits; Applications: Applications; ApplicationSettings: ApplicationSettings; ApplicationStatistics: ApplicationStatistics; + Attestations: Attestations; AuditEvents: AuditEvents; Avatar: Avatar; BroadcastMessages: BroadcastMessages; + BulkImports: BulkImports; + ClusterAgents: ClusterAgents; CodeSuggestions: CodeSuggestions; Composer: Composer; Conan: Conan; - DashboardAnnotations: DashboardAnnotations; + ConanV2: ConanV2; + DataManagement: DataManagement; + DatabaseMigrations: DatabaseMigrations; Debian: Debian; + Dependencies: Dependencies; + DependencyListExport: DependencyListExport; DependencyProxy: DependencyProxy; DeployKeys: DeployKeys; DeployTokens: DeployTokens; - DockerfileTemplates: DockerfileTemplates; Events: Events; Experiments: Experiments; - GeoNodes: GeoNodes; GeoSites: GeoSites; - GitignoreTemplates: GitignoreTemplates; - GitLabCIYMLTemplates: GitLabCIYMLTemplates; + GitLabDuoChat: GitLabDuoChat; Import: Import; InstanceLevelCICDVariables: InstanceLevelCICDVariables; Keys: Keys; License: License; - LicenseTemplates: LicenseTemplates; + Licenses: Licenses; Lint: Lint; Markdown: Markdown; Maven: Maven; Metadata: Metadata; Migrations: Migrations; + ModelRegistry: ModelRegistry; Namespaces: Namespaces; NotificationSettings: NotificationSettings; NPM: NPM; NuGet: NuGet; + Orbit: Orbit; + Organizations: Organizations; + Pages: Pages; PersonalAccessTokens: PersonalAccessTokens; + PipelineTriggers: PipelineTriggers; + PlanLimits: PlanLimits; PyPI: PyPI; RubyGems: RubyGems; Search: Search; @@ -253,22 +284,31 @@ export interface Gitlab extends BaseResource { Snippets: Snippets; Suggestions: Suggestions; SystemHooks: SystemHooks; + TerraformModules: TerraformModules; TodoLists: TodoLists; Topics: Topics; Branches: Branches; CommitDiscussions: CommitDiscussions; Commits: Commits; + CompliancePolicySettings: CompliancePolicySettings; ContainerRegistry: ContainerRegistry; + ContainerRegistryProtectionTagRules: ContainerRegistryProtectionTagRules; + ContainerRepositoryProtectionRules: ContainerRepositoryProtectionRules; + ContainerVirtualRegistry: ContainerVirtualRegistry; Deployments: Deployments; Environments: Environments; ErrorTrackingClientKeys: ErrorTrackingClientKeys; ErrorTrackingSettings: ErrorTrackingSettings; + ExternalControls: ExternalControls; ExternalStatusChecks: ExternalStatusChecks; FeatureFlags: FeatureFlags; FeatureFlagUserLists: FeatureFlagUserLists; + Features: Features; + Flows: Flows; FreezePeriods: FreezePeriods; GitlabPages: GitlabPages; GoProxy: GoProxy; + GoogleCloudIntegration: GoogleCloudIntegration; Helm: Helm; Integrations: Integrations; IssueAwardEmojis: IssueAwardEmojis; @@ -286,9 +326,11 @@ export interface Gitlab extends BaseResource { JobArtifacts: JobArtifacts; Jobs: Jobs; MergeRequestApprovals: MergeRequestApprovals; + MergeRequestApprovalSettings: MergeRequestApprovalSettings; MergeRequestAwardEmojis: MergeRequestAwardEmojis; MergeRequestContextCommits: MergeRequestContextCommits; MergeRequestDiscussions: MergeRequestDiscussions; + MergeRequestIterationEvents: MergeRequestIterationEvents; MergeRequestLabelEvents: MergeRequestLabelEvents; MergeRequestMilestoneEvents: MergeRequestMilestoneEvents; MergeRequestStateEvents: MergeRequestStateEvents; @@ -322,6 +364,7 @@ export interface Gitlab extends BaseResource { ProjectMembers: ProjectMembers; ProjectMilestones: ProjectMilestones; ProjectProtectedEnvironments: ProjectProtectedEnvironments; + ProjectPullMirroring: ProjectPullMirroring; ProjectPushRules: ProjectPushRules; ProjectRelationsExport: ProjectRelationsExport; ProjectReleases: ProjectReleases; @@ -337,8 +380,9 @@ export interface Gitlab extends BaseResource { ProjectTerraformState: ProjectTerraformState; ProjectVariables: ProjectVariables; ProjectVulnerabilities: ProjectVulnerabilities; + ProjectWikiNotes: ProjectWikiNotes; ProjectWikis: ProjectWikis; - ProtectedBranches: ProtectedBranches; + ProjectProtectedBranches: ProjectProtectedBranches; ProtectedTags: ProtectedTags; ReleaseLinks: ReleaseLinks; Repositories: Repositories; @@ -349,45 +393,43 @@ export interface Gitlab extends BaseResource { SecureFiles: SecureFiles; Tags: Tags; UserStarredMetricsDashboard: UserStarredMetricsDashboard; - EpicAwardEmojis: EpicAwardEmojis; - EpicDiscussions: EpicDiscussions; - EpicIssues: EpicIssues; - EpicLabelEvents: EpicLabelEvents; - EpicLinks: EpicLinks; - EpicNotes: EpicNotes; - Epics: Epics; - EpicStateEvents: EpicStateEvents; GroupAccessRequests: GroupAccessRequests; GroupAccessTokens: GroupAccessTokens; GroupActivityAnalytics: GroupActivityAnalytics; GroupBadges: GroupBadges; GroupCustomAttributes: GroupCustomAttributes; - GroupDORA4Metrics: GroupDORA4Metrics; + GroupEnterpriseUsers: GroupEnterpriseUsers; GroupEpicBoards: GroupEpicBoards; + GroupDORA4Metrics: GroupDORA4Metrics; GroupHooks: GroupHooks; GroupImportExports: GroupImportExports; + GroupIntegrations: GroupIntegrations; GroupInvitations: GroupInvitations; GroupIssueBoards: GroupIssueBoards; GroupIterations: GroupIterations; GroupLabels: GroupLabels; GroupLDAPLinks: GroupLDAPLinks; GroupMarkdownUploads: GroupMarkdownUploads; + GroupPlaceholderReassignments: GroupPlaceholderReassignments; GroupMembers: GroupMembers; GroupMemberRoles: GroupMemberRoles; GroupMilestones: GroupMilestones; + GroupProtectedBranches: GroupProtectedBranches; GroupProtectedEnvironments: GroupProtectedEnvironments; GroupPushRules: GroupPushRules; GroupRelationExports: GroupRelationExports; GroupReleases: GroupReleases; GroupRepositoryStorageMoves: GroupRepositoryStorageMoves; + GroupSecuritySettings: GroupSecuritySettings; + GroupSSHCertificates: GroupSSHCertificates; Groups: Groups; GroupSAMLIdentities: GroupSAMLIdentities; GroupSAMLLinks: GroupSAMLLinks; GroupSCIMIdentities: GroupSCIMIdentities; GroupServiceAccounts: GroupServiceAccounts; GroupVariables: GroupVariables; + GroupWikiNotes: GroupWikiNotes; GroupWikis: GroupWikis; - LinkedEpics: LinkedEpics; UserCustomAttributes: UserCustomAttributes; UserEmails: UserEmails; UserGPGKeys: UserGPGKeys; @@ -397,46 +439,54 @@ export interface Gitlab extends BaseResource { } const resources = { - Agents, + AICatalog, AlertManagement, ApplicationAppearance, ApplicationPlanLimits, Applications, ApplicationSettings, ApplicationStatistics, + Attestations, AuditEvents, Avatar, BroadcastMessages, + BulkImports, + ClusterAgents, CodeSuggestions, Composer, Conan, - DashboardAnnotations, + ConanV2, + DataManagement, + DatabaseMigrations, Debian, + Dependencies, + DependencyListExport, DependencyProxy, DeployKeys, DeployTokens, - DockerfileTemplates, Events, Experiments, - GeoNodes, - GeoSites, - GitignoreTemplates, - GitLabCIYMLTemplates, Import, InstanceLevelCICDVariables, Keys, License, - LicenseTemplates, + Licenses, Lint, Markdown, Maven, Metadata, Migrations, + ModelRegistry, Namespaces, NotificationSettings, NPM, NuGet, + Orbit, + Organizations, + Pages, PersonalAccessTokens, + PipelineTriggers, + PlanLimits, PyPI, RubyGems, Search, @@ -449,22 +499,33 @@ const resources = { Snippets, Suggestions, SystemHooks, + TerraformModules, TodoLists, Topics, Branches, CommitDiscussions, Commits, + CompliancePolicySettings, ContainerRegistry, + ContainerRegistryProtectionTagRules, + ContainerRepositoryProtectionRules, + ContainerVirtualRegistry, Deployments, Environments, ErrorTrackingClientKeys, ErrorTrackingSettings, + ExternalControls, ExternalStatusChecks, FeatureFlags, FeatureFlagUserLists, + Features, + Flows, FreezePeriods, + GeoSites, + GitLabDuoChat, GitlabPages, GoProxy, + GoogleCloudIntegration, Helm, Integrations, IssueAwardEmojis, @@ -482,9 +543,11 @@ const resources = { JobArtifacts, Jobs, MergeRequestApprovals, + MergeRequestApprovalSettings, MergeRequestAwardEmojis, MergeRequestContextCommits, MergeRequestDiscussions, + MergeRequestIterationEvents, MergeRequestLabelEvents, MergeRequestMilestoneEvents, MergeRequestStateEvents, @@ -518,6 +581,7 @@ const resources = { ProjectMembers, ProjectMilestones, ProjectProtectedEnvironments, + ProjectPullMirroring, ProjectPushRules, ProjectRelationsExport, ProjectReleases, @@ -533,8 +597,9 @@ const resources = { ProjectTerraformState, ProjectVariables, ProjectVulnerabilities, + ProjectWikiNotes, ProjectWikis, - ProtectedBranches, + ProjectProtectedBranches, ProtectedTags, ReleaseLinks, Repositories, @@ -545,45 +610,43 @@ const resources = { SecureFiles, Tags, UserStarredMetricsDashboard, - EpicAwardEmojis, - EpicDiscussions, - EpicIssues, - EpicLabelEvents, - EpicLinks, - EpicNotes, - Epics, - EpicStateEvents, GroupAccessRequests, GroupAccessTokens, GroupActivityAnalytics, GroupBadges, GroupCustomAttributes, - GroupDORA4Metrics, + GroupEnterpriseUsers, GroupEpicBoards, + GroupDORA4Metrics, GroupHooks, GroupImportExports, + GroupIntegrations, GroupInvitations, GroupIssueBoards, GroupIterations, GroupLabels, GroupLDAPLinks, GroupMarkdownUploads, + GroupPlaceholderReassignments, GroupMembers, GroupMemberRoles, GroupMilestones, + GroupProtectedBranches, GroupProtectedEnvironments, GroupPushRules, GroupRelationExports, GroupReleases, GroupRepositoryStorageMoves, + GroupSecuritySettings, + GroupSSHCertificates, Groups, GroupSAMLIdentities, GroupSAMLLinks, GroupSCIMIdentities, GroupServiceAccounts, GroupVariables, + GroupWikiNotes, GroupWikis, - LinkedEpics, UserCustomAttributes, UserEmails, UserGPGKeys, diff --git a/packages/core/src/resources/GoProxy.ts b/packages/core/src/resources/GoProxy.ts index 322b1a23e..0e548fb79 100644 --- a/packages/core/src/resources/GoProxy.ts +++ b/packages/core/src/resources/GoProxy.ts @@ -50,7 +50,7 @@ export class GoProxy extends BaseResource { moduleName: string, moduleVersion: string, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; return RequestHelper.get()( @@ -68,7 +68,7 @@ export class GoProxy extends BaseResource { moduleName: string, moduleVersion: string, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; return RequestHelper.get()( diff --git a/packages/core/src/resources/GoogleCloudIntegration.ts b/packages/core/src/resources/GoogleCloudIntegration.ts new file mode 100644 index 000000000..1705161e1 --- /dev/null +++ b/packages/core/src/resources/GoogleCloudIntegration.ts @@ -0,0 +1,75 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface WorkloadIdentityFederationOptions { + google_cloud_project_id: string; + google_cloud_workload_identity_pool_id?: string; + google_cloud_workload_identity_pool_display_name?: string; + google_cloud_workload_identity_pool_provider_id?: string; + google_cloud_workload_identity_pool_provider_display_name?: string; +} + +export interface GoogleCloudIntegrationOptions { + enable_google_cloud_artifact_registry: boolean; + google_cloud_artifact_registry_project_id: string; +} + +export interface RunnerDeploymentProjectOptions { + google_cloud_project_id: string; +} + +export class GoogleCloudIntegration extends BaseResource { + workloadIdentityFederationScript( + projectId: string | number, + options: ShowExpanded & Sudo & WorkloadIdentityFederationOptions, + ) { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/google_cloud/setup/wlif.sh`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + integrationScript( + projectId: string | number, + options: GoogleCloudIntegrationOptions & ShowExpanded & Sudo, + ) { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`${projectId}/google_cloud/setup/integrations.sh`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + runnerDeploymentProjectScript( + projectId: string | number, + options: RunnerDeploymentProjectOptions & ShowExpanded & Sudo, + ) { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`${projectId}/google_cloud/setup/runner_deployment_project.sh`, + { + searchParams, + showExpanded, + sudo, + }, + ); + } +} diff --git a/packages/core/src/resources/GroupAccessRequests.ts b/packages/core/src/resources/GroupAccessRequests.ts index 916eef662..fdcfe4a67 100644 --- a/packages/core/src/resources/GroupAccessRequests.ts +++ b/packages/core/src/resources/GroupAccessRequests.ts @@ -33,6 +33,7 @@ export interface GroupAccessRequests extends Resource deny( groupId: string | number, userId: number, + options?: ShowExpanded & Sudo, ): Promise>; } diff --git a/packages/core/src/resources/GroupAccessTokens.ts b/packages/core/src/resources/GroupAccessTokens.ts index 7c4cae871..fb91ded41 100644 --- a/packages/core/src/resources/GroupAccessTokens.ts +++ b/packages/core/src/resources/GroupAccessTokens.ts @@ -17,18 +17,44 @@ import type { import { AccessLevel } from '../constants'; import { ResourceAccessTokens } from '../templates'; +export interface GroupAccessTokenFilterOptions { + created_after?: string; + created_before?: string; + expires_after?: string; + expires_before?: string; + last_used_after?: string; + last_used_before?: string; + revoked?: boolean; + search?: string; + sort?: + | 'created_asc' + | 'created_desc' + | 'expires_asc' + | 'expires_desc' + | 'last_used_asc' + | 'last_used_desc' + | 'name_asc' + | 'name_desc'; + state?: 'active' | 'inactive'; +} + export interface GroupAccessTokens extends ResourceAccessTokens { all( groupId: string | number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + options?: BaseRequestSearchParams & + GroupAccessTokenFilterOptions & + PaginationRequestOptions

& + ShowExpanded & + Sudo, ): Promise>; create( groupId: string | number, name: string, scopes: AccessTokenScopes[], - expiresAt: string, options?: { + expiresAt?: string; + description?: string; accessLevel?: Exclude< AccessLevel, AccessLevel.MINIMAL_ACCESS | AccessLevel.NO_ACCESS | AccessLevel.ADMIN diff --git a/packages/core/src/resources/GroupEnterpriseUsers.ts b/packages/core/src/resources/GroupEnterpriseUsers.ts new file mode 100644 index 000000000..b137b1d73 --- /dev/null +++ b/packages/core/src/resources/GroupEnterpriseUsers.ts @@ -0,0 +1,170 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface GroupEnterpriseUserIdentitySchema extends Record { + provider: string; + extern_uid: string; + saml_provider_id: number; +} + +export interface GroupEnterpriseUserSCIMIdentitySchema extends Record { + extern_uid: string; + group_id: number; + active: boolean; +} + +export interface GroupEnterpriseUserSchema extends Record { + id: number; + username: string; + name: string; + state: string; + avatar_url: string; + web_url: string; + created_at: string; + bio: string; + location?: string | null; + public_email: string; + linkedin: string; + twitter: string; + website_url: string; + organization?: string | null; + job_title: string; + pronouns?: string | null; + bot: boolean; + work_information?: string | null; + followers: number; + following: number; + local_time?: string | null; + last_sign_in_at?: string | null; + confirmed_at: string; + last_activity_on?: string | null; + email: string; + theme_id: number; + color_scheme_id: number; + projects_limit: number; + current_sign_in_at?: string | null; + identities: GroupEnterpriseUserIdentitySchema[]; + can_create_group: boolean; + can_create_project: boolean; + two_factor_enabled: boolean; + external: boolean; + private_profile: boolean; + commit_email: string; + shared_runners_minutes_limit?: number | null; + extra_shared_runners_minutes_limit?: number | null; + scim_identities: GroupEnterpriseUserSCIMIdentitySchema[]; +} + +export interface GroupEnterpriseUserListOptions { + username?: string; + search?: string; + active?: boolean; + blocked?: boolean; + createdAfter?: string; + createdBefore?: string; + twoFactor?: 'enabled' | 'disabled'; +} + +export interface GroupEnterpriseUserEditOptions { + name?: string; + email?: string; +} + +export class GroupEnterpriseUsers extends BaseResource { + all( + groupId: string | number, + options?: GroupEnterpriseUserListOptions & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/enterprise_users`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as GroupEnterpriseUserListOptions & + PaginationRequestSearchParams

& + PaginationType

, + }, + ); + } + + show( + groupId: string | number, + userId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/enterprise_users/${userId}`, + { + sudo, + showExpanded, + }, + ); + } + + edit( + groupId: string | number, + userId: number, + options?: GroupEnterpriseUserEditOptions & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`groups/${groupId}/enterprise_users/${userId}`, + { + sudo, + showExpanded, + body, + }, + ); + } + + remove( + groupId: string | number, + userId: number, + options?: { hardDelete?: boolean } & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.del()(this, endpoint`groups/${groupId}/enterprise_users/${userId}`, { + sudo, + showExpanded, + body, + }); + } + + disableTwoFactor( + groupId: string | number, + userId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`groups/${groupId}/enterprise_users/${userId}/disable_two_factor`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/GroupEpicBoards.ts b/packages/core/src/resources/GroupEpicBoards.ts index 7532fe676..cdcc4750c 100644 --- a/packages/core/src/resources/GroupEpicBoards.ts +++ b/packages/core/src/resources/GroupEpicBoards.ts @@ -1,7 +1,6 @@ import { BaseResource } from '@gitbeaker/requester-utils'; import type { - BaseRequestSearchParams, GitlabAPIResponse, PaginationRequestOptions, PaginationRequestSearchParams, @@ -10,33 +9,58 @@ import type { ShowExpanded, Sudo, } from '../infrastructure'; -import type { CondensedGroupSchema } from './Groups'; import { RequestHelper, endpoint } from '../infrastructure'; -import { LabelSchema } from '../templates/ResourceLabels'; + +export interface GroupEpicBoardLabelSchema extends Record { + id: number; + title: string; + name: string; + color: string; + description?: string | null; + group_id?: number | null; + project_id?: number | null; + template: boolean; + text_color: string; + created_at: string; + updated_at: string; +} + +export interface GroupEpicBoardListLabelSchema extends Record { + id: number; + name: string; + color: string; + description?: string | null; +} export interface GroupEpicBoardListSchema extends Record { id: number; - label: Pick; + label: GroupEpicBoardListLabelSchema; position: number; - list_type: 'label'; + list_type: string; collapsed: boolean; } +export interface GroupEpicBoardGroupSchema extends Record { + id: number; + name: string; + web_url: string; +} + export interface GroupEpicBoardSchema extends Record { id: number; name: string; - group: CondensedGroupSchema; hide_backlog_list: boolean; hide_closed_list: boolean; - labels: LabelSchema[] | null; - lists: GroupEpicBoardListSchema[] | null; + group: GroupEpicBoardGroupSchema; + labels: GroupEpicBoardLabelSchema[]; + lists: GroupEpicBoardListSchema[]; } export class GroupEpicBoards extends BaseResource { all( groupId: string | number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; @@ -47,23 +71,21 @@ export class GroupEpicBoards extends BaseResource sudo, showExpanded, maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, }, ); } - allLists( + show( groupId: string | number, boardId: number, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.get()( + return RequestHelper.get()( this, - endpoint`groups/${groupId}/epic_boards/${boardId}/lists`, + endpoint`groups/${groupId}/epic_boards/${boardId}`, { sudo, showExpanded, @@ -71,19 +93,21 @@ export class GroupEpicBoards extends BaseResource ); } - show( + allLists( groupId: string | number, boardId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - return RequestHelper.get()( + return RequestHelper.get()( this, - endpoint`groups/${groupId}/epic_boards/${boardId}`, + endpoint`groups/${groupId}/epic_boards/${boardId}/lists`, { sudo, showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, }, ); } diff --git a/packages/core/src/resources/GroupHooks.ts b/packages/core/src/resources/GroupHooks.ts index 69dbc39cd..6dd6042e8 100644 --- a/packages/core/src/resources/GroupHooks.ts +++ b/packages/core/src/resources/GroupHooks.ts @@ -33,6 +33,12 @@ export interface GroupHooks { options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, ): Promise>; + allEvents( + groupId: string | number, + hookId: number, + options?: { status?: string | number } & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise>; + edit( groupId: string | number, hookId: number, @@ -46,6 +52,13 @@ export interface GroupHooks { options?: ShowExpanded & Sudo, ): Promise>; + resendEvent( + groupId: string | number, + hookId: number, + eventId: number, + options?: ShowExpanded & Sudo, + ): Promise>; + show( groupId: string | number, hookId: number, diff --git a/packages/core/src/resources/GroupIntegrations.ts b/packages/core/src/resources/GroupIntegrations.ts new file mode 100644 index 000000000..3e50d53c6 --- /dev/null +++ b/packages/core/src/resources/GroupIntegrations.ts @@ -0,0 +1,153 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestBodyRecordOptions, + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export type SupportedGroupIntegration = + | 'asana' + | 'assembla' + | 'bamboo' + | 'bugzilla' + | 'buildkite' + | 'campfire' + | 'clickup' + | 'confluence' + | 'custom-issue-tracker' + | 'datadog' + | 'diffblue-cover' + | 'discord' + | 'drone-ci' + | 'emails-on-push' + | 'ewm' + | 'external-wiki' + | 'git-guardian' + | 'github' + | 'gitlab-slack-application' + | 'google-cloud-platform-artifact-registry' + | 'google-cloud-platform-workload-identity-federation' + | 'hangouts-chat' + | 'harbor' + | 'irker' + | 'jenkins' + | 'jira' + | 'jira-cloud-app' + | 'linear' + | 'matrix' + | 'mattermost' + | 'mattermost-slash-commands' + | 'microsoft-teams' + | 'mock-ci' + | 'packagist' + | 'phorge' + | 'pipelines-email' + | 'pivotaltracker' + | 'pumble' + | 'pushover' + | 'redmine' + | 'slack' + | 'slack-slash-commands' + | 'squash-tm' + | 'teamcity' + | 'telegram' + | 'unify-circuit' + | 'webex-teams' + | 'youtrack'; + +export interface GroupIntegrationSchema extends Record { + id: number; + title: string; + slug: string; + created_at: string; + updated_at: string; + active: boolean; + commit_events?: boolean; + push_events?: boolean; + issues_events?: boolean; + alert_events?: boolean; + confidential_issues_events?: boolean; + merge_requests_events?: boolean; + tag_push_events?: boolean; + deployment_events?: boolean; + note_events?: boolean; + confidential_note_events?: boolean; + pipeline_events?: boolean; + wiki_page_events?: boolean; + job_events?: boolean; + comment_on_event_enabled?: boolean; + inherited: boolean; + vulnerability_events?: boolean; +} + +export class GroupIntegrations extends BaseResource { + all( + groupId: string | number, + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/integrations`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }, + ); + } + + show( + groupId: string | number, + integrationName: SupportedGroupIntegration, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/integrations/${integrationName}`, + { sudo, showExpanded }, + ); + } + + edit( + groupId: string | number, + integrationName: SupportedGroupIntegration, + options?: BaseRequestBodyRecordOptions & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`groups/${groupId}/integrations/${integrationName}`, + { sudo, showExpanded, body }, + ); + } + + remove( + groupId: string | number, + integrationName: SupportedGroupIntegration, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()(this, endpoint`groups/${groupId}/integrations/${integrationName}`, { + sudo, + showExpanded, + }); + } +} diff --git a/packages/core/src/resources/GroupInvitations.ts b/packages/core/src/resources/GroupInvitations.ts index 620e49d2e..0360cc869 100644 --- a/packages/core/src/resources/GroupInvitations.ts +++ b/packages/core/src/resources/GroupInvitations.ts @@ -9,7 +9,11 @@ import type { ShowExpanded, Sudo, } from '../infrastructure'; -import type { InvitationSchema } from '../templates/ResourceInvitations'; +import type { + InvitationSchema, + InvitationResponseSchema, + UpdateInvitationResponseSchema, +} from '../templates/ResourceInvitations'; import { AccessLevel } from '../constants'; import { ResourceInvitations } from '../templates'; @@ -21,12 +25,13 @@ export interface GroupInvitations { options: { expiresAt?: string; inviteSource?: string; + memberRoleId?: number; tasksToBeDone?: string[]; tasksProjectId?: number; } & OneOf<{ email: string; userId: string }> & ShowExpanded & Sudo, - ): Promise>; + ): Promise>; all( groupId: string | number, @@ -44,13 +49,13 @@ export interface GroupInvitations { accessLevel?: Exclude; } & ShowExpanded & Sudo, - ): Promise>; + ): Promise>; remove( groupId: string | number, email: string, options?: ShowExpanded & Sudo, - ): Promise>; + ): Promise>; } export class GroupInvitations extends ResourceInvitations { diff --git a/packages/core/src/resources/GroupIssueBoards.ts b/packages/core/src/resources/GroupIssueBoards.ts index d11721a3e..dd1cb7e6c 100644 --- a/packages/core/src/resources/GroupIssueBoards.ts +++ b/packages/core/src/resources/GroupIssueBoards.ts @@ -38,16 +38,22 @@ export interface GroupIssueBoards extends ResourceIss createList( groupId: string | number, boardId: number, - options?: ShowExpanded & Sudo, + options?: { + labelId?: number; + assigneeId?: number; + milestoneId?: number; + iterationId?: number; + } & ShowExpanded & + Sudo, ): Promise>; edit( groupId: string | number, boardId: number, options?: { + name?: string; hideBacklogList?: boolean; hideClosedList?: boolean; - name?: string; assigneeId?: number; milestoneId?: number; labels?: string; diff --git a/packages/core/src/resources/GroupLDAPLinks.ts b/packages/core/src/resources/GroupLDAPLinks.ts index 792a74e22..1a8197b89 100644 --- a/packages/core/src/resources/GroupLDAPLinks.ts +++ b/packages/core/src/resources/GroupLDAPLinks.ts @@ -1,60 +1,61 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; +import type { GitlabAPIResponse, OneOf, ShowExpanded, Sudo } from '../infrastructure'; -import { AccessLevel } from '../constants'; import { RequestHelper, endpoint } from '../infrastructure'; -// Documentation: https://docs.gitlab.com/api/groups/#ldap-group-links +export interface GroupLDAPLinkSchema extends Record { + cn: string | null; + group_access: number; + provider: string; + filter: string | null; + member_role_id: number | null; +} + export class GroupLDAPLinks extends BaseResource { + all( + groupId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/ldap_group_links`, + { + sudo, + showExpanded, + }, + ); + } + add( groupId: string | number, groupAccess: number, provider: string, options?: { - cn?: string; - groupAccess?: Exclude; - } & ShowExpanded & + memberRoleId?: number; + } & OneOf<{ cn: string; filter: string }> & + ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()(this, endpoint`groups/${groupId}/ldap_group_links`, { - sudo, - showExpanded, - body: { ...body, groupAccess, provider }, - }); - } - - all( - groupId: string | number, - options: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, endpoint`groups/${groupId}/ldap_group_links`, { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); + return RequestHelper.post()( + this, + endpoint`groups/${groupId}/ldap_group_links`, + { + sudo, + showExpanded, + body: { ...body, groupAccess, provider }, + }, + ); } remove( groupId: string | number, provider: string, - options?: { cn?: string; filter?: string } & ShowExpanded & Sudo, + options?: OneOf<{ cn: string; filter: string }> & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -64,13 +65,4 @@ export class GroupLDAPLinks extends BaseResource { body: { ...body, provider }, }); } - - sync(groupId: string | number, options?: ShowExpanded & Sudo) { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.post()(this, endpoint`groups/${groupId}/ldap_sync`, { - sudo, - showExpanded, - }); - } } diff --git a/packages/core/src/resources/GroupLabels.ts b/packages/core/src/resources/GroupLabels.ts index bd44a1fa8..43c7848ca 100644 --- a/packages/core/src/resources/GroupLabels.ts +++ b/packages/core/src/resources/GroupLabels.ts @@ -19,30 +19,24 @@ export interface GroupLabels extends ResourceLabels & ShowExpanded & Sudo, ): Promise>; - all( - groupId: string | number, - options: { - includeAncestorGroups?: boolean; - search?: string; - } & BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise>; - all( groupId: string | number, options?: { - withCounts?: boolean; includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; search?: string; + archived?: boolean; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -53,7 +47,8 @@ export interface GroupLabels extends ResourceLabels & Sudo, + options?: { description?: string; priority?: number; archived?: boolean } & ShowExpanded & + Sudo, ): Promise>; edit( @@ -62,6 +57,7 @@ export interface GroupLabels extends ResourceLabels & ShowExpanded & Sudo, @@ -82,7 +78,12 @@ export interface GroupLabels extends ResourceLabels( groupId: string | number, labelId: number | string, - options?: { includeAncestorGroups?: boolean } & ShowExpanded & Sudo, + options?: { + includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; + } & ShowExpanded & + Sudo, ): Promise>; subscribe( diff --git a/packages/core/src/resources/GroupMembers.ts b/packages/core/src/resources/GroupMembers.ts index 0198aef44..e694f0442 100644 --- a/packages/core/src/resources/GroupMembers.ts +++ b/packages/core/src/resources/GroupMembers.ts @@ -28,6 +28,8 @@ export interface BillableGroupMemberSchema extends CondensedMemberSchema { membership_type: string; removable: boolean; created_at: string; + last_login_at?: string; + email?: string; } export interface BillableGroupMemberMembershipSchema extends Record { @@ -36,7 +38,7 @@ export interface BillableGroupMemberMembershipSchema extends Record; @@ -47,6 +49,17 @@ export interface OverrodeGroupMemberSchema extends SimpleMemberSchema { override: boolean; } +export interface PendingMemberSchema extends Record { + id: number; + name?: string; + username?: string; + email: string; + avatar_url: string; + web_url?: string; + approved: boolean; + invited: boolean; +} + export interface GroupMembers extends ResourceMembers { add( projectId: string | number, @@ -92,7 +105,23 @@ export class GroupMembers extends ResourceMembers allBillable( groupId: string | number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + options?: { + search?: string; + sort?: + | 'access_level_asc' + | 'access_level_desc' + | 'last_joined' + | 'name_asc' + | 'name_desc' + | 'oldest_joined' + | 'oldest_sign_in' + | 'recent_sign_in' + | 'last_activity_on_asc' + | 'last_activity_on_desc'; + } & BaseRequestSearchParams & + PaginationRequestOptions

& + ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; @@ -113,10 +142,10 @@ export class GroupMembers extends ResourceMembers allPending( groupId: string | number, options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - return RequestHelper.get()(this, endpoint`${groupId}/pending_members`, { + return RequestHelper.get()(this, endpoint`${groupId}/pending_members`, { sudo, showExpanded, maxPages, @@ -126,26 +155,12 @@ export class GroupMembers extends ResourceMembers }); } - allBillableMemberships( + allBillableMemberships( groupId: string | number, userId: number, - options?: { - search?: string; - sort?: - | 'access_level_asc' - | 'access_level_desc' - | 'last_joined' - | 'name_asc' - | 'name_desc' - | 'oldest_joined' - | 'oldest_sign_in' - | 'recent_sign_in' - | 'last_activity_on_asc' - | 'last_activity_on_desc'; - } & ShowExpanded & - Sudo, - ): Promise> { - const { sudo, showExpanded, ...searchParams } = options || {}; + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; return RequestHelper.get()( this, @@ -153,7 +168,27 @@ export class GroupMembers extends ResourceMembers { sudo, showExpanded, - searchParams, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, + }, + ); + } + + allBillableIndirect( + groupId: string | number, + userId: number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`${groupId}/billable_members/${userId}/indirect`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, }, ); } @@ -177,12 +212,31 @@ export class GroupMembers extends ResourceMembers ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.put()(this, endpoint`${groupId}/members/approve_all`, { + return RequestHelper.post()(this, endpoint`${groupId}/members/approve_all`, { sudo, showExpanded, }); } + changeMembershipState( + groupId: string | number, + userId: number, + state: 'awaiting' | 'active', + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.put<{ success: boolean }>()( + this, + endpoint`${groupId}/members/${userId}/state`, + { + sudo, + showExpanded, + searchParams: { state }, + }, + ); + } + removeBillable( groupId: string | number, userId: number, diff --git a/packages/core/src/resources/GroupPlaceholderReassignments.ts b/packages/core/src/resources/GroupPlaceholderReassignments.ts new file mode 100644 index 000000000..4044af564 --- /dev/null +++ b/packages/core/src/resources/GroupPlaceholderReassignments.ts @@ -0,0 +1,55 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { AsStream, GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, createFormData, endpoint } from '../infrastructure'; + +export class GroupPlaceholderReassignments extends BaseResource { + all( + groupId: string | number, + options: { asStream: true } & ShowExpanded & Sudo, + ): Promise>; + + all( + groupId: string | number, + options?: { asStream?: boolean } & ShowExpanded & Sudo, + ): Promise>; + + all( + groupId: string | number, + options?: AsStream & ShowExpanded & Sudo, + ): Promise { + const { sudo, showExpanded, asStream, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/placeholder_reassignments`, + { + sudo, + showExpanded, + asStream, + searchParams, + }, + ); + } + + create( + groupId: string | number, + file: { content: Blob; filename: string }, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post<{ message: string }>()( + this, + endpoint`groups/${groupId}/placeholder_reassignments`, + { + sudo, + showExpanded, + body: createFormData({ + file: [file.content, file.filename], + }), + }, + ); + } +} diff --git a/packages/core/src/resources/GroupProtectedBranches.ts b/packages/core/src/resources/GroupProtectedBranches.ts new file mode 100644 index 000000000..7096df8ad --- /dev/null +++ b/packages/core/src/resources/GroupProtectedBranches.ts @@ -0,0 +1,140 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ProtectedBranchAccessLevelEntity { + id?: number; + access_level?: number; + user_id?: number | null; + group_id?: number | null; + access_level_description?: string; + _destroy?: boolean; +} + +export interface GroupProtectedBranchSchema extends Record { + id: number; + name: string; + push_access_levels: ProtectedBranchAccessLevelEntity[]; + merge_access_levels: ProtectedBranchAccessLevelEntity[]; + unprotect_access_levels?: ProtectedBranchAccessLevelEntity[]; + allow_force_push: boolean; + code_owner_approval_required: boolean; +} + +export class GroupProtectedBranches extends BaseResource { + all( + groupId: string | number, + options?: { + search?: string; + } & BaseRequestSearchParams & + PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/protected_branches`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }, + ); + } + + show( + groupId: string | number, + name: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/protected_branches/${name}`, + { sudo, showExpanded }, + ); + } + + create( + groupId: string | number, + name: string, + options?: { + allowForcePush?: boolean; + allowedToMerge?: ProtectedBranchAccessLevelEntity[]; + allowedToPush?: ProtectedBranchAccessLevelEntity[]; + allowedToUnprotect?: ProtectedBranchAccessLevelEntity[]; + codeOwnerApprovalRequired?: boolean; + mergeAccessLevel?: number; + pushAccessLevel?: number; + unprotectAccessLevel?: number; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`groups/${groupId}/protected_branches`, + { + sudo, + showExpanded, + body: { + ...body, + name, + }, + }, + ); + } + + edit( + groupId: string | number, + name: string, + options?: { + allowForcePush?: boolean; + allowedToPush?: ProtectedBranchAccessLevelEntity[]; + allowedToMerge?: ProtectedBranchAccessLevelEntity[]; + allowedToUnprotect?: ProtectedBranchAccessLevelEntity[]; + codeOwnerApprovalRequired?: boolean; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.patch()( + this, + endpoint`groups/${groupId}/protected_branches/${name}`, + { sudo, showExpanded, body }, + ); + } + + remove( + groupId: string | number, + name: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`groups/${groupId}/protected_branches/${name}`, + { sudo, showExpanded }, + ); + } +} diff --git a/packages/core/src/resources/GroupRelationExports.ts b/packages/core/src/resources/GroupRelationExports.ts index a0a092853..9ecdb7cec 100644 --- a/packages/core/src/resources/GroupRelationExports.ts +++ b/packages/core/src/resources/GroupRelationExports.ts @@ -1,55 +1,62 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - ShowExpanded, - Sudo, -} from '../infrastructure'; +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; import { RequestHelper, endpoint } from '../infrastructure'; +export interface GroupRelationExportBatchSchema extends Record { + status: number; + batch_number: number; + objects_count: number; + error: string | null; + updated_at: string; +} + export interface GroupRelationExportStatusSchema extends Record { relation: string; status: number; - error?: string; + error: string | null; updated_at: string; + batched: boolean; + batches_count: number; + batches?: GroupRelationExportBatchSchema[]; } export class GroupRelationExports extends BaseResource { download( groupId: string | number, relation: string, - options?: ShowExpanded & Sudo, + options?: { batched?: boolean; batchNumber?: number } & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...searchParams } = options || {}; return RequestHelper.get()(this, endpoint`groups/${groupId}/export_relations/download`, { sudo, showExpanded, - searchParams: { relation }, + searchParams: { ...searchParams, relation }, }); } exportStatus( groupId: string | number, - options?: ShowExpanded & Sudo, + options?: { relation?: string } & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...searchParams } = options || {}; return RequestHelper.get()( this, - endpoint`groups/${groupId}/export_relations`, + endpoint`groups/${groupId}/export_relations/status`, { sudo, showExpanded, + searchParams, }, ); } scheduleExport( groupId: string | number, - options?: BaseRequestSearchParams & ShowExpanded & Sudo, + options?: { batched?: boolean } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; diff --git a/packages/core/src/resources/GroupReleases.ts b/packages/core/src/resources/GroupReleases.ts index 68193578f..fe3841f41 100644 --- a/packages/core/src/resources/GroupReleases.ts +++ b/packages/core/src/resources/GroupReleases.ts @@ -17,7 +17,7 @@ import { RequestHelper, endpoint } from '../infrastructure'; export class GroupReleases extends BaseResource { all( groupId: string | number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + options?: { simple?: boolean } & PaginationRequestOptions

& ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; diff --git a/packages/core/src/resources/GroupSSHCertificates.ts b/packages/core/src/resources/GroupSSHCertificates.ts new file mode 100644 index 000000000..65d606093 --- /dev/null +++ b/packages/core/src/resources/GroupSSHCertificates.ts @@ -0,0 +1,76 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface SSHCertificateSchema extends Record { + id: number; + title: string; + key: string; + created_at: string; +} + +export class GroupSSHCertificates extends BaseResource { + all( + groupId: string | number, + options?: PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/ssh_certificates`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, + }, + ); + } + + create( + groupId: string | number, + key: string, + title: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + endpoint`groups/${groupId}/ssh_certificates`, + { + sudo, + showExpanded, + body: { key, title }, + }, + ); + } + + remove( + groupId: string | number, + certificateId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`groups/${groupId}/ssh_certificates/${certificateId}`, + { + sudo, + showExpanded, + }, + ); + } +} diff --git a/packages/core/src/resources/GroupSecuritySettings.ts b/packages/core/src/resources/GroupSecuritySettings.ts new file mode 100644 index 000000000..8ee437deb --- /dev/null +++ b/packages/core/src/resources/GroupSecuritySettings.ts @@ -0,0 +1,33 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface GroupSecuritySettingsUpdateResponse extends Record { + secret_push_protection_enabled: boolean; + errors: string[]; +} + +export class GroupSecuritySettings extends BaseResource { + edit( + groupId: string | number, + secretPushProtectionEnabled: boolean, + options?: { projectsToExclude?: number[] } & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`groups/${groupId}/security_settings`, + { + sudo, + showExpanded, + body: { + ...body, + secretPushProtectionEnabled, + }, + }, + ); + } +} diff --git a/packages/core/src/resources/GroupVariables.ts b/packages/core/src/resources/GroupVariables.ts index 8e26a312e..2c883cf9b 100644 --- a/packages/core/src/resources/GroupVariables.ts +++ b/packages/core/src/resources/GroupVariables.ts @@ -26,6 +26,7 @@ export interface GroupVariables extends ResourceVaria variableType?: VariableType; protected?: boolean; masked?: boolean; + maskedAndHidden?: boolean; environmentScope?: string; description?: string; raw?: boolean; @@ -41,10 +42,11 @@ export interface GroupVariables extends ResourceVaria variableType?: VariableType; protected?: boolean; masked?: boolean; + maskedAndHidden?: boolean; environmentScope?: string; description?: string; raw?: boolean; - filter: VariableFilter; + filter?: VariableFilter; } & ShowExpanded & Sudo, ): Promise>; @@ -52,13 +54,13 @@ export interface GroupVariables extends ResourceVaria show( groupId: string | number, key: string, - options?: ShowExpanded & Sudo, + options?: { filter?: VariableFilter } & ShowExpanded & Sudo, ): Promise>; remove( groupId: string | number, key: string, - options?: ShowExpanded & Sudo, + options?: { filter?: VariableFilter } & ShowExpanded & Sudo, ): Promise>; } diff --git a/packages/core/src/resources/EpicNotes.ts b/packages/core/src/resources/GroupWikiNotes.ts similarity index 54% rename from packages/core/src/resources/EpicNotes.ts rename to packages/core/src/resources/GroupWikiNotes.ts index 6286e2cec..aeeb4514f 100644 --- a/packages/core/src/resources/EpicNotes.ts +++ b/packages/core/src/resources/GroupWikiNotes.ts @@ -1,6 +1,7 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; import type { + BaseRequestSearchParams, GitlabAPIResponse, PaginationRequestOptions, PaginationTypes, @@ -9,56 +10,58 @@ import type { } from '../infrastructure'; import type { NoteSchema } from '../templates/ResourceNotes'; -import { ResourceNotes } from '../templates'; +import { ResourceNotes } from '../templates/ResourceNotes'; -export interface EpicNoteSchema extends NoteSchema { - noteable_type: 'Epic'; +export interface GroupWikiNoteSchema extends NoteSchema { + noteable_type: 'WikiPage::Meta'; + project_id: null; } -export interface EpicNotes extends ResourceNotes { +export interface GroupWikiNotes extends ResourceNotes { all( groupId: string | number, - epicId: number, + wikiPageMetaId: number, options?: { sort?: 'asc' | 'desc'; orderBy?: 'created_at' | 'updated_at'; - } & PaginationRequestOptions

& + } & BaseRequestSearchParams & + PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; + ): Promise>; create( groupId: string | number, - epicId: number, + wikiPageMetaId: number, body: string, - options?: { internal?: boolean; createdAt?: string } & ShowExpanded & Sudo, - ): Promise>; + options?: ShowExpanded & Sudo, + ): Promise>; edit( groupId: string | number, - epicId: number, + wikiPageMetaId: number, noteId: number, options: { body: string } & ShowExpanded & Sudo, - ): Promise>; + ): Promise>; remove( groupId: string | number, - epicId: number, + wikiPageMetaId: number, noteId: number, options?: Sudo, ): Promise>; show( groupId: string | number, - epicId: number, + wikiPageMetaId: number, noteId: number, options?: ShowExpanded & Sudo, - ): Promise>; + ): Promise>; } -export class EpicNotes extends ResourceNotes { +export class GroupWikiNotes extends ResourceNotes { constructor(options: BaseResourceOptions) { /* istanbul ignore next */ - super('groups', 'epics', options); + super('groups', 'wiki_pages', options); } } diff --git a/packages/core/src/resources/Import.ts b/packages/core/src/resources/Import.ts index a947090b4..2ef314fbb 100644 --- a/packages/core/src/resources/Import.ts +++ b/packages/core/src/resources/Import.ts @@ -9,13 +9,13 @@ export interface RepositoryImportStatusSchema extends Record { name: string; full_path: string; full_name: string; -} - -export interface ExpandedRepositoryImportStatusSchema extends RepositoryImportStatusSchema { - import_source: string; - import_status: string; - human_import_status_name: string; - provider_link: string; + refs_url?: string; + import_source?: string; + import_status?: string; + human_import_status_name?: string; + provider_link?: string; + relation_type?: string | null; + import_warning?: string | null; } export class Import extends BaseResource { @@ -26,7 +26,14 @@ export class Import extends BaseResource { options?: { newName?: string; githubHostname?: string; - optionalStages?: Record; + optionalStages?: { + attachmentsImport?: boolean; + collaboratorsImport?: boolean; + singleEndpointIssueEventsImport?: boolean; + singleEndpointNotesImport?: boolean; + }; + paginationLimit?: number; + timeoutStrategy?: 'optimistic' | 'pessimistic'; } & ShowExpanded & Sudo, ): Promise> { @@ -76,7 +83,12 @@ export class Import extends BaseResource { personalAccessToken: string, bitbucketServerProject: string, bitbucketServerRepository: string, - options?: { newName?: string; targetNamespace?: string } & ShowExpanded & Sudo, + options?: { + newName?: string; + targetNamespace?: string; + timeoutStrategy?: 'optimistic' | 'pessimistic'; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -93,4 +105,29 @@ export class Import extends BaseResource { }, }); } + + importBitbucketCloudRepository( + repoPath: string, + targetNamespace: string, + options?: { + bitbucketApiToken?: string; + bitbucketEmail?: string; + bitbucketUsername?: string; + bitbucketAppPassword?: string; + newName?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()(this, 'import/bitbucket', { + sudo, + showExpanded, + body: { + ...body, + repoPath, + targetNamespace, + }, + }); + } } diff --git a/packages/core/src/resources/InstanceLevelCICDVariables.ts b/packages/core/src/resources/InstanceLevelCICDVariables.ts index d99dc383f..32ed80953 100644 --- a/packages/core/src/resources/InstanceLevelCICDVariables.ts +++ b/packages/core/src/resources/InstanceLevelCICDVariables.ts @@ -1,11 +1,21 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationRequestSearchParams, + PaginationType, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; import { RequestHelper, endpoint } from '../infrastructure'; export interface CICDVariableSchema extends Record { key: string; + description?: string | null; variable_type: string; value: string; protected: boolean; @@ -14,14 +24,18 @@ export interface CICDVariableSchema extends Record { } export class InstanceLevelCICDVariables extends BaseResource { - all( - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + all( + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; return RequestHelper.get()(this, 'admin/ci/variables', { sudo, showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, }); } @@ -29,6 +43,7 @@ export class InstanceLevelCICDVariables extends BaseR key: string, value: string, options?: { + description?: string; variableType?: string; protected?: boolean; masked?: boolean; @@ -49,6 +64,7 @@ export class InstanceLevelCICDVariables extends BaseR keyId: string, value: string, options?: { + description?: string; variableType?: string; protected?: boolean; masked?: boolean; diff --git a/packages/core/src/resources/IssueLinks.ts b/packages/core/src/resources/IssueLinks.ts index 1e0aecbf2..95987c6ac 100644 --- a/packages/core/src/resources/IssueLinks.ts +++ b/packages/core/src/resources/IssueLinks.ts @@ -40,6 +40,7 @@ export interface IssueLinkSchema extends Record { } export interface ExpandedIssueLinkSchema extends Record { + id: number; source_issue: MappedOmit< IssueLinkSchema, 'link_type' | 'link_created_at' | 'link_updated_at' | 'issue_link_id' @@ -73,6 +74,24 @@ export class IssueLinks extends BaseResource { ); } + show( + projectId: string | number, + issueIId: number, + issueLinkId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/issues/${issueIId}/links/${issueLinkId}`, + { + sudo, + showExpanded, + }, + ); + } + create( projectId: string | number, issueIId: number, diff --git a/packages/core/src/resources/IssueNotes.ts b/packages/core/src/resources/IssueNotes.ts index 123ff0a58..3bbf00c73 100644 --- a/packages/core/src/resources/IssueNotes.ts +++ b/packages/core/src/resources/IssueNotes.ts @@ -23,6 +23,7 @@ export interface IssueNotes extends ResourceNotes options?: { sort?: 'asc' | 'desc'; orderBy?: 'created_at' | 'updated_at'; + activityFilter?: 'all_notes' | 'only_comments' | 'only_activity'; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & diff --git a/packages/core/src/resources/IssueWeightEvents.ts b/packages/core/src/resources/IssueWeightEvents.ts index 639c95aa5..1335c00e6 100644 --- a/packages/core/src/resources/IssueWeightEvents.ts +++ b/packages/core/src/resources/IssueWeightEvents.ts @@ -8,26 +8,26 @@ import type { ShowExpanded, Sudo, } from '../infrastructure'; -import type { StateEventSchema } from '../templates/ResourceStateEvents'; +import type { WeightEventSchema } from '../templates/ResourceWeightEvents'; -import { ResourceStateEvents } from '../templates'; +import { ResourceWeightEvents } from '../templates'; export interface IssueWeightEvents { all( projectId: string | number, issueIId: number, options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise>; + ): Promise>; show( projectId: string | number, issueIId: number, weightEventId: number, options?: ShowExpanded & Sudo, - ): Promise>; + ): Promise>; } -export class IssueWeightEvents extends ResourceStateEvents { +export class IssueWeightEvents extends ResourceWeightEvents { constructor(options: BaseResourceOptions) { /* istanbul ignore next */ super('projects', 'issues', options); diff --git a/packages/core/src/resources/JobArtifacts.ts b/packages/core/src/resources/JobArtifacts.ts index f3f12540b..9572f55b8 100644 --- a/packages/core/src/resources/JobArtifacts.ts +++ b/packages/core/src/resources/JobArtifacts.ts @@ -1,10 +1,24 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; +import type { + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; import type { JobSchema } from './Jobs'; import { RequestHelper, endpoint, ensureRequiredParams, getPrefixedUrl } from '../infrastructure'; +export interface ArtifactFileSchema extends Record { + name: string; + path: string; + type: 'file' | 'directory'; + size?: number; + mode: string; +} + export class JobArtifacts extends BaseResource { downloadArchive( projectId: string | number, @@ -86,4 +100,29 @@ export class JobArtifacts extends BaseResource { return RequestHelper.del()(this, url, { sudo, showExpanded }); } + + all( + projectId: string | number, + jobId: number, + options?: { + path?: string; + recursive?: boolean; + jobToken?: string; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/jobs/${jobId}/artifacts/tree`, + { + sudo, + showExpanded, + maxPages, + searchParams, + }, + ); + } } diff --git a/packages/core/src/resources/Jobs.ts b/packages/core/src/resources/Jobs.ts index 7cdf2b11c..09edb402e 100644 --- a/packages/core/src/resources/Jobs.ts +++ b/packages/core/src/resources/Jobs.ts @@ -26,8 +26,12 @@ export type JobScope = | 'failed' | 'success' | 'canceled' + | 'canceling' | 'skipped' | 'manual' + | 'scheduled' + | 'preparing' + | 'waiting_for_callback' | 'waiting_for_resource'; export interface ArtifactSchema extends Record { @@ -45,6 +49,19 @@ export interface CondensedJobSchema extends Record { project_name: string; } +export interface RunnerManagerSchema extends Record { + id: number; + system_id: string; + version: string; + revision: string; + platform: string; + architecture: string; + created_at: string; + contacted_at: string; + ip_address: string; + status: string; +} + export interface JobSchema extends Record { id: number; name: string; @@ -52,7 +69,9 @@ export interface JobSchema extends Record { status: string; ref: string; tag: boolean; - coverage?: string; + coverage?: string | number | null; + archived: boolean; + source: string; allow_failure: boolean; created_at: string; started_at?: string; @@ -65,12 +84,13 @@ export interface JobSchema extends Record { pipeline: PipelineSchema; web_url: string; artifacts: ArtifactSchema[]; - queued_duration: number; - artifacts_file: { + queued_duration?: number; + artifacts_file?: { filename: string; size: number; - }; - runner: RunnerSchema; + } | null; + runner?: RunnerSchema | null; + runner_manager?: RunnerManagerSchema | null; artifacts_expire_at?: string; tag_list?: string[]; project?: { @@ -125,6 +145,7 @@ export class Jobs extends BaseResource { pipelineId?: number; scope?: JobScope | JobScope[]; includeRetried?: boolean; + orderBy?: 'id'; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -164,9 +185,9 @@ export class Jobs extends BaseResource { cancel( projectId: string | number, jobId: number, - options?: ShowExpanded & Sudo, + options?: { force?: boolean } & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...searchParams } = options || {}; return RequestHelper.post()( this, @@ -174,6 +195,7 @@ export class Jobs extends BaseResource { { sudo, showExpanded, + searchParams, }, ); } @@ -198,7 +220,11 @@ export class Jobs extends BaseResource { play( projectId: string | number, jobId: number, - options?: { jobVariablesAttributes?: JobVariableAttributeOption[] } & ShowExpanded & Sudo, + options?: { + jobVariablesAttributes?: JobVariableAttributeOption[]; + jobInputs?: Record; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -216,9 +242,9 @@ export class Jobs extends BaseResource { retry( projectId: string | number, jobId: number, - options?: ShowExpanded & Sudo, + options?: { jobInputs?: Record } & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...body } = options || {}; return RequestHelper.post()( this, @@ -226,6 +252,7 @@ export class Jobs extends BaseResource { { sudo, showExpanded, + body, }, ); } diff --git a/packages/core/src/resources/Keys.ts b/packages/core/src/resources/Keys.ts index 8d8118a15..6aa107ac2 100644 --- a/packages/core/src/resources/Keys.ts +++ b/packages/core/src/resources/Keys.ts @@ -19,7 +19,8 @@ export interface KeySchema extends Record { title: string; key: string; created_at: string; - expires_at: string; + expires_at?: string; + last_used_at?: string; usage_type?: string; user: ExpandedUserSchema; deploy_keys_projects?: DeployKeyProjectsSchema[]; diff --git a/packages/core/src/resources/License.ts b/packages/core/src/resources/License.ts index 4b9d4757b..ce7653337 100644 --- a/packages/core/src/resources/License.ts +++ b/packages/core/src/resources/License.ts @@ -11,7 +11,7 @@ import type { Sudo, } from '../infrastructure'; -import { RequestHelper } from '../infrastructure'; +import { RequestHelper, endpoint, getPrefixedUrl } from '../infrastructure'; export interface LicenseSchema extends Record { id: number; @@ -24,14 +24,13 @@ export interface LicenseSchema extends Record { expired: boolean; overage: number; user_limit: number; - active_users: number; + active_users?: number; licensee: { Name: string; + Email: string; + Company: string; }; - add_ons: { - GitLab_FileLocks: number; - GitLab_Auditor_User: number; - }; + add_ons: Record; } export class License extends BaseResource { @@ -65,32 +64,42 @@ export class License extends BaseResource { } show( + licenseId?: number, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; + const url = getPrefixedUrl('license', { license: licenseId }); - return RequestHelper.get()(this, 'license', { sudo, showExpanded }); + return RequestHelper.get()(this, url, { sudo, showExpanded }); } remove( licenceId: number, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.del()(this, `license/${licenceId}`, { sudo, showExpanded }); + return RequestHelper.del()(this, endpoint`license/${licenceId}`, { sudo, showExpanded }); + } + + exportUsage( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()(this, 'license/usage_export.csv', { sudo, showExpanded }); } recalculateBillableUsers( licenceId: number, options?: ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; + const { sudo, showExpanded } = options || {}; return RequestHelper.put<{ success: boolean }>()( this, - `license/${licenceId}/refresh_billable_users`, - { sudo, showExpanded, body }, + endpoint`license/${licenceId}/refresh_billable_users`, + { sudo, showExpanded }, ); } } diff --git a/packages/core/src/resources/LicenseTemplates.ts b/packages/core/src/resources/LicenseTemplates.ts deleted file mode 100644 index 9eac15b8e..000000000 --- a/packages/core/src/resources/LicenseTemplates.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; - -import { ResourceTemplates } from '../templates'; - -export interface LicenseTemplateSchema extends Record { - key: string; - name: string; - nickname?: string; - featured: boolean; - html_url: string; - source_url: string; - description: string; - conditions?: string[]; - permissions?: string[]; - limitations?: string[]; - content: string; -} - -export interface LicenseTemplates extends ResourceTemplates { - all( - options?: { popular?: boolean } & BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise>; - - show( - key: string | number, - options?: { project?: string; fullName?: string } & ShowExpanded & Sudo, - ): Promise>; -} - -export class LicenseTemplates extends ResourceTemplates { - constructor(options: BaseResourceOptions) { - /* istanbul ignore next */ - super('Licenses', options); - } -} diff --git a/packages/core/src/resources/Licenses.ts b/packages/core/src/resources/Licenses.ts new file mode 100644 index 000000000..647d7fed0 --- /dev/null +++ b/packages/core/src/resources/Licenses.ts @@ -0,0 +1,50 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface LicenseTemplateSchema extends Record { + key: string; + name: string; + nickname: string | null; + featured: boolean; + html_url: string; + source_url: string; + description: string; + conditions: string[]; + permissions: string[]; + limitations: string[]; + content: string; +} + +export class Licenses extends BaseResource { + all( + options?: { popular?: boolean } & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'templates/licenses', { + sudo, + showExpanded, + searchParams, + }); + } + + show( + key: string, + options?: { + project?: string; + fullname?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, endpoint`templates/licenses/${key}`, { + sudo, + showExpanded, + searchParams, + }); + } +} diff --git a/packages/core/src/resources/LinkedEpics.ts b/packages/core/src/resources/LinkedEpics.ts deleted file mode 100644 index ce34c647a..000000000 --- a/packages/core/src/resources/LinkedEpics.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; - -import { RequestHelper, endpoint } from '../infrastructure'; -import { EpicSchema } from './Epics'; - -export interface RelatedEpicSchema extends EpicSchema { - related_epic_link_id: number; -} - -export interface RelatedEpicLinkSchema extends Record { - source_epic: RelatedEpicSchema; - target_epic: RelatedEpicSchema; -} - -export type RelatedEpicLinkType = 'relates_to' | 'blocks' | 'is_blocked_by'; - -export class LinkedEpics extends BaseResource { - all( - groupId: string | number, - epicIId: number, - options?: { - createdAfter?: string; - createdBefore?: string; - updatedAfter?: string; - updatedBefore?: string; - } & BaseRequestSearchParams & - PaginationRequestOptions

& - ShowExpanded & - Sudo, - ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/related_epics`, - { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }, - ); - } - - create( - groupId: string | number, - epicIId: number, - targetEpicIId: string | number, - targetGroupId: string | number, - options?: { linkType?: RelatedEpicLinkType } & ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; - - return RequestHelper.post()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/related_epics`, - { - sudo, - showExpanded, - searchParams: { - targetGroupId, - targetEpicIid: targetEpicIId, - }, - body, - }, - ); - } - - remove( - groupId: string | number, - epicIId: number, - relatedEpicLinkId: string | number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; - - return RequestHelper.del()( - this, - endpoint`groups/${groupId}/epics/${epicIId}/related_epics/${relatedEpicLinkId}`, - { sudo, showExpanded }, - ); - } -} diff --git a/packages/core/src/resources/MergeRequestApprovalSettings.ts b/packages/core/src/resources/MergeRequestApprovalSettings.ts new file mode 100644 index 000000000..b8f463ae5 --- /dev/null +++ b/packages/core/src/resources/MergeRequestApprovalSettings.ts @@ -0,0 +1,84 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ApprovalSettingValue { + value: boolean; + locked: boolean; + inherited_from: string | null; +} + +export interface MergeRequestApprovalSettingsSchema extends Record { + allow_author_approval: ApprovalSettingValue; + allow_committer_approval: ApprovalSettingValue; + allow_overrides_to_approver_list_per_merge_request: ApprovalSettingValue; + retain_approvals_on_push: ApprovalSettingValue; + selective_code_owner_removals: ApprovalSettingValue; + require_password_to_approve: ApprovalSettingValue; + require_reauthentication_to_approve: ApprovalSettingValue; +} + +export type EditMergeRequestApprovalSettingsOptions = { + allowAuthorApproval?: boolean; + allowCommitterApproval?: boolean; + allowOverridesToApproverListPerMergeRequest?: boolean; + retainApprovalsOnPush?: boolean; + selectiveCodeOwnerRemovals?: boolean; + requireReauthenticationToApprove?: boolean; +}; + +export class MergeRequestApprovalSettings extends BaseResource { + show( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/merge_request_approval_setting`, + { sudo, showExpanded }, + ); + } + + edit( + projectId: string | number, + options?: EditMergeRequestApprovalSettingsOptions & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/merge_request_approval_setting`, + { sudo, showExpanded, body }, + ); + } + + showGroup( + groupId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`groups/${groupId}/merge_request_approval_setting`, + { sudo, showExpanded }, + ); + } + + editGroup( + groupId: string | number, + options?: EditMergeRequestApprovalSettingsOptions & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`groups/${groupId}/merge_request_approval_setting`, + { sudo, showExpanded, body }, + ); + } +} diff --git a/packages/core/src/resources/MergeRequestApprovals.ts b/packages/core/src/resources/MergeRequestApprovals.ts index ae5c1af98..8122aa9a9 100644 --- a/packages/core/src/resources/MergeRequestApprovals.ts +++ b/packages/core/src/resources/MergeRequestApprovals.ts @@ -2,7 +2,7 @@ import { BaseResource } from '@gitbeaker/requester-utils'; import type { GitlabAPIResponse, MappedOmit, ShowExpanded, Sudo } from '../infrastructure'; import type { GroupSchema } from './Groups'; -import type { ProtectedBranchSchema } from './ProtectedBranches'; +import type { ProtectedBranchSchema } from './ProjectProtectedBranches'; import type { SimpleUserSchema } from './Users'; import { RequestHelper, endpoint, getPrefixedUrl } from '../infrastructure'; @@ -10,14 +10,17 @@ import { RequestHelper, endpoint, getPrefixedUrl } from '../infrastructure'; export interface ProjectLevelMergeRequestApprovalSchema extends Record { approvals_before_merge: number; reset_approvals_on_push: boolean; + selective_code_owner_removals: boolean; disable_overriding_approvers_per_merge_request: boolean; merge_requests_author_approval: boolean; merge_requests_disable_committers_approval: boolean; require_password_to_approve: boolean; + require_reauthentication_to_approve: boolean; } -export interface ApprovedByEntity { +export interface ApprovedByEntitySchema { user: MappedOmit; + approved_at?: string; } export interface MergeRequestLevelMergeRequestApprovalSchema extends Record { @@ -32,7 +35,7 @@ export interface MergeRequestLevelMergeRequestApprovalSchema extends Record { @@ -49,6 +52,7 @@ export interface ApprovalRuleSchema extends Record { export interface ProjectLevelApprovalRuleSchema extends ApprovalRuleSchema { protected_branches?: ProtectedBranchSchema[]; + applies_to_all_protected_branches?: boolean; } export interface MergeRequestLevelApprovalRuleSchema extends ApprovalRuleSchema { @@ -84,6 +88,7 @@ export type EditConfigurationOptions = { mergeRequestsAuthorApproval?: boolean; mergeRequestsDisableCommittersApproval?: boolean; requirePasswordToApprove?: boolean; + requireReauthenticationToApprove?: boolean; resetApprovalsOnPush?: boolean; selectiveCodeOwnerRemovals?: boolean; }; @@ -323,4 +328,18 @@ export class MergeRequestApprovals extends BaseResour { sudo, showExpanded }, ); } + + resetApprovals( + projectId: string | number, + mergerequestIId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/merge_requests/${mergerequestIId}/reset_approvals`, + { sudo, showExpanded }, + ); + } } diff --git a/packages/core/src/resources/MergeRequestContextCommits.ts b/packages/core/src/resources/MergeRequestContextCommits.ts index 8486fd0ed..9e2256986 100644 --- a/packages/core/src/resources/MergeRequestContextCommits.ts +++ b/packages/core/src/resources/MergeRequestContextCommits.ts @@ -17,7 +17,7 @@ export interface MergeRequestContextCommitSchema extends Record id: string; short_id: string; created_at: string; - parent_ids?: null; + parent_ids?: string[] | null; title: string; message: string; author_name: string; @@ -26,6 +26,8 @@ export interface MergeRequestContextCommitSchema extends Record committer_name: string; committer_email: string; committed_date: string; + trailers?: Record; + web_url?: string; } export class MergeRequestContextCommits extends BaseResource { @@ -72,14 +74,19 @@ export class MergeRequestContextCommits extends BaseR remove( projectId: string | number, mergerequestIId: number, + commits: string[], options?: ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded } = options || {}; + const { sudo, showExpanded, ...body } = options || {}; return RequestHelper.del()( this, endpoint`projects/${projectId}/merge_requests/${mergerequestIId}/context_commits`, - { sudo, showExpanded }, + { + sudo, + showExpanded, + body: { ...body, commits }, + }, ); } } diff --git a/packages/core/src/resources/MergeRequestDraftNotes.ts b/packages/core/src/resources/MergeRequestDraftNotes.ts index 60a824287..e5534f74b 100644 --- a/packages/core/src/resources/MergeRequestDraftNotes.ts +++ b/packages/core/src/resources/MergeRequestDraftNotes.ts @@ -89,7 +89,7 @@ export class MergeRequestDraftNotes extends BaseResou ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()( + return RequestHelper.put()( this, endpoint`projects/${projectId}/merge_requests/${mergerequestIId}/draft_notes/${draftNoteId}`, { diff --git a/packages/core/src/resources/MergeRequestIterationEvents.ts b/packages/core/src/resources/MergeRequestIterationEvents.ts new file mode 100644 index 000000000..9e6442785 --- /dev/null +++ b/packages/core/src/resources/MergeRequestIterationEvents.ts @@ -0,0 +1,37 @@ +import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; +import type { IterationEventSchema } from '../templates/ResourceIterationEvents'; + +import { ResourceIterationEvents } from '../templates'; + +export interface MergeRequestIterationEvents { + all( + projectId: string | number, + mergeRequestIId: number, + options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise>; + + show( + projectId: string | number, + mergeRequestIId: number, + iterationEventId: number, + options?: ShowExpanded & Sudo, + ): Promise>; +} + +export class MergeRequestIterationEvents< + C extends boolean = false, +> extends ResourceIterationEvents { + constructor(options: BaseResourceOptions) { + /* istanbul ignore next */ + super('projects', 'merge_requests', options); + } +} diff --git a/packages/core/src/resources/MergeTrains.ts b/packages/core/src/resources/MergeTrains.ts index fb6ab7fa9..d34889636 100644 --- a/packages/core/src/resources/MergeTrains.ts +++ b/packages/core/src/resources/MergeTrains.ts @@ -14,47 +14,52 @@ import type { CondensedMergeRequestSchema } from './MergeRequests'; import type { PipelineSchema } from './Pipelines'; import type { SimpleUserSchema } from './Users'; -import { BaseRequestSearchParams, RequestHelper, endpoint } from '../infrastructure'; +import { + BaseRequestSearchParams, + RequestHelper, + endpoint, + getPrefixedUrl, +} from '../infrastructure'; export interface MergeTrainSchema extends Record { id: number; merge_request: CondensedMergeRequestSchema; user: MappedOmit; - pipeline: PipelineSchema; + pipeline: PipelineSchema | null; created_at: string; updated_at: string; target_branch: string; - status: string; - merged_at: string; - duration: number; + status: 'idle' | 'stale' | 'fresh' | 'merging' | 'merged' | 'skip_merged'; + merged_at: string | null; + duration: number | null; } export class MergeTrains extends BaseResource { all( projectId: string | number, - options: { + options?: { targetBranch?: string; scope?: 'active' | 'complete'; - sort?: 'asc' | 'desc'; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + const { sudo, showExpanded, maxPages, targetBranch, ...searchParams } = options || {}; - return RequestHelper.get()( - this, - endpoint`projects/${projectId}/merge_trains`, - { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }, - ); + const url = getPrefixedUrl('', { + projects: projectId, + merge_trains: targetBranch || true, + }); + + return RequestHelper.get()(this, url, { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }); } showStatus( @@ -77,7 +82,12 @@ export class MergeTrains extends BaseResource { addMergeRequest( projectId: string | number, mergeRequestIId: number, - options?: { whenPipelineSucceeds?: boolean; sha?: string; squash?: boolean } & ShowExpanded & + options?: { + autoMerge?: boolean; + whenPipelineSucceeds?: boolean; + sha?: string; + squash?: boolean; + } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; diff --git a/packages/core/src/resources/Metadata.ts b/packages/core/src/resources/Metadata.ts index f9659adf8..9cf69d51c 100644 --- a/packages/core/src/resources/Metadata.ts +++ b/packages/core/src/resources/Metadata.ts @@ -9,8 +9,9 @@ export interface MetadataSchema extends Record { revision: string; kas: { enabled: boolean; - externalUrl: string; - version: string; + externalUrl: string | null; + externalK8sProxyUrl: string | null; + version: string | null; }; enterprise: boolean; } @@ -26,4 +27,15 @@ export class Metadata extends BaseResource { showExpanded, }); } + + showVersion( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()(this, 'version', { + sudo, + showExpanded, + }); + } } diff --git a/packages/core/src/resources/ModelRegistry.ts b/packages/core/src/resources/ModelRegistry.ts new file mode 100644 index 000000000..904fdb0b1 --- /dev/null +++ b/packages/core/src/resources/ModelRegistry.ts @@ -0,0 +1,81 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export class ModelRegistry extends BaseResource { + download( + projectId: string | number, + modelVersionId: string | number, + fileName: string, + options?: { + path?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, path, ...searchParams } = options || {}; + const filePath = path ? endpoint`${path}/${fileName}` : fileName; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/ml_models/${modelVersionId}/files/${filePath}`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + authorizeUpload( + projectId: string | number, + modelVersionId: string | number, + fileName: string, + options?: { + path?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, path, ...searchParams } = options || {}; + const filePath = path ? `${path}/${fileName}` : fileName; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/packages/ml_models/${modelVersionId}/files/${filePath}/authorize`, + { + sudo, + showExpanded, + searchParams, + }, + ); + } + + upload( + projectId: string | number, + modelVersionId: string | number, + fileName: string, + file: File | Blob, + options?: { + path?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, path } = options || {}; + const filePath = path ? `${path}/${fileName}` : fileName; + + const formData = new FormData(); + + formData.append('file', file); + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/packages/ml_models/${modelVersionId}/files/${filePath}`, + { + sudo, + showExpanded, + body: formData, + }, + ); + } +} diff --git a/packages/core/src/resources/NPM.ts b/packages/core/src/resources/NPM.ts index 9e9be0119..cc2fe354c 100644 --- a/packages/core/src/resources/NPM.ts +++ b/packages/core/src/resources/NPM.ts @@ -1,6 +1,6 @@ import { BaseResource } from '@gitbeaker/requester-utils'; -import type { GitlabAPIResponse, ShowExpanded } from '../infrastructure'; +import type { GitlabAPIResponse, OneOrNoneOf, ShowExpanded } from '../infrastructure'; import { RequestHelper, endpoint, getPrefixedUrl } from '../infrastructure'; @@ -44,10 +44,14 @@ export class NPM extends BaseResource { removeDistTag( packageName: string, tag: string, - options?: { projectId?: string | number } & ShowExpanded, + options?: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded, ): Promise> { - const { showExpanded, projectId } = options || {}; - const prefix = getPrefixedUrl('packages/npm', { projects: projectId }); + const { showExpanded, projectId, groupId } = options || {}; + const prefix = getPrefixedUrl('packages/npm', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); return RequestHelper.del()(this, `${prefix}/-/package/${packageName}/dist-tags/${tag}`, { showExpanded, @@ -57,10 +61,14 @@ export class NPM extends BaseResource { setDistTag( packageName: string, tag: string, - options?: { projectId?: string | number } & ShowExpanded, + options?: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded, ): Promise> { - const { showExpanded, projectId } = options || {}; - const prefix = getPrefixedUrl('packages/npm', { projects: projectId }); + const { showExpanded, projectId, groupId } = options || {}; + const prefix = getPrefixedUrl('packages/npm', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); return RequestHelper.put()(this, `${prefix}/-/package/${packageName}/dist-tags/${tag}`, { showExpanded, @@ -69,10 +77,14 @@ export class NPM extends BaseResource { showDistTags( packageName: string, - options?: { projectId?: string | number } & ShowExpanded, + options?: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded, ): Promise, C, E, void>> { - const { showExpanded, projectId } = options || {}; - const prefix = getPrefixedUrl('packages/npm', { projects: projectId }); + const { showExpanded, projectId, groupId } = options || {}; + const prefix = getPrefixedUrl('packages/npm', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); return RequestHelper.get>()( this, @@ -85,10 +97,14 @@ export class NPM extends BaseResource { showMetadata( packageName: string, - options?: { projectId?: string | number } & ShowExpanded, + options?: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded, ): Promise> { - const { showExpanded, projectId } = options || {}; - const prefix = getPrefixedUrl('packages/npm', { projects: projectId }); + const { showExpanded, projectId, groupId } = options || {}; + const prefix = getPrefixedUrl('packages/npm', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); return RequestHelper.get()(this, `${prefix}/${packageName}`, { showExpanded, diff --git a/packages/core/src/resources/Namespaces.ts b/packages/core/src/resources/Namespaces.ts index 130a7dca2..57b6466ce 100644 --- a/packages/core/src/resources/Namespaces.ts +++ b/packages/core/src/resources/Namespaces.ts @@ -24,11 +24,17 @@ export interface CondensedNamespaceSchema extends Record { } export interface NamespaceSchema extends CondensedNamespaceSchema { - members_count_with_descendants: number; - billable_members_count: number; - plan: string; - trial_ends_on?: string; - trial: boolean; + members_count_with_descendants?: number; + billable_members_count?: number; + max_seats_used?: number; + max_seats_used_changed_at?: string; + seats_in_use?: number; + plan?: string; + end_date?: string | null; + trial_ends_on?: string | null; + trial?: boolean; + root_repository_size?: number; + projects_count?: number; } export interface NamespaceExistsSchema extends Record { @@ -40,8 +46,9 @@ export class Namespaces extends BaseResource { all( options?: { search?: string; - ownedOnly?: string; + ownedOnly?: boolean; topLevelOnly?: boolean; + fullPathSearch?: boolean; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -61,7 +68,7 @@ export class Namespaces extends BaseResource { exists( namespace: string, - options?: { parentId?: string } & ShowExpanded & Sudo, + options?: { parentId?: number } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...searchParams } = options || {}; diff --git a/packages/core/src/resources/NotificationSettings.ts b/packages/core/src/resources/NotificationSettings.ts index dbd17de8e..dbdead3a2 100644 --- a/packages/core/src/resources/NotificationSettings.ts +++ b/packages/core/src/resources/NotificationSettings.ts @@ -13,51 +13,58 @@ export type NotificationSettingLevel = | 'custom'; export type CustomSettingLevelEmailEvents = - | 'new_note' - | 'new_issue' - | 'reopen_issue' + | 'approver' + | 'change_reviewer_merge_request' | 'close_issue' - | 'reassign_issue' - | 'issue_due' - | 'new_merge_request' - | 'push_to_merge_request' - | 'reopen_merge_request' | 'close_merge_request' - | 'reassign_merge_request' - | 'merge_merge_request' | 'failed_pipeline' | 'fixed_pipeline' - | 'success_pipeline' - | 'moved_project' + | 'issue_due' + | 'merge_merge_request' | 'merge_when_pipeline_succeeds' - | 'new_epic '; + | 'moved_project' + | 'new_epic' + | 'new_issue' + | 'new_merge_request' + | 'new_note' + | 'new_release' + | 'push_to_merge_request' + | 'reassign_issue' + | 'reassign_merge_request' + | 'reopen_issue' + | 'reopen_merge_request' + | 'success_pipeline'; export interface NotificationSettingSchema extends Record { level: NotificationSettingLevel; notification_email?: string; + events?: Record; } export type EditNotificationSettingsOptions = { - level?: string; + level?: NotificationSettingLevel; notificationEmail?: string; - newNote?: boolean; - newIssue?: boolean; - reopenIssue?: boolean; + approver?: boolean; + changeReviewerMergeRequest?: boolean; closeIssue?: boolean; - reassignIssue?: boolean; - issueDue?: boolean; - newMergeRequest?: boolean; - pushToMergeRequest?: boolean; - reopenMergeRequest?: boolean; closeMergeRequest?: boolean; - reassignMergeRequest?: boolean; - mergeMergeRequest?: boolean; failedPipeline?: boolean; fixedPipeline?: boolean; - successPipeline?: boolean; - movedProject?: boolean; + issueDue?: boolean; + mergeMergeRequest?: boolean; mergeWhenPipelineSucceeds?: boolean; + movedProject?: boolean; newEpic?: boolean; + newIssue?: boolean; + newMergeRequest?: boolean; + newNote?: boolean; + newRelease?: boolean; + pushToMergeRequest?: boolean; + reassignIssue?: boolean; + reassignMergeRequest?: boolean; + reopenIssue?: boolean; + reopenMergeRequest?: boolean; + successPipeline?: boolean; }; export class NotificationSettings extends BaseResource { diff --git a/packages/core/src/resources/NuGet.ts b/packages/core/src/resources/NuGet.ts index 675292dd1..71ba05fbe 100644 --- a/packages/core/src/resources/NuGet.ts +++ b/packages/core/src/resources/NuGet.ts @@ -234,4 +234,96 @@ export class NuGet extends BaseResource { }, ); } + + uploadPackageFileV2( + projectId: string | number, + packageName: string, + packageVersion: string, + packageFile: { content: Blob; filename: string }, + options?: ShowExpanded, + ): Promise> { + const { showExpanded, ...body } = options || {}; + + return RequestHelper.put()(this, endpoint`projects/${projectId}/packages/nuget/v2`, { + showExpanded, + body: createFormData( + normalizeFormData({ + ...body, + packageName, + packageVersion, + file: [packageFile.content, packageFile.filename], + }), + ), + }); + } + + removePackage( + projectId: string | number, + packageName: string, + packageVersion: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.del()( + this, + endpoint`projects/${projectId}/packages/nuget/${packageName}/${packageVersion}`, + { + showExpanded, + }, + ); + } + + showServiceIndexV2( + options: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + const { projectId, groupId, showExpanded } = options; + + ensureRequiredParams({ projectId, groupId }); + + const uri = getPrefixedUrl('packages/nuget', { projects: projectId, 'groups/-': groupId }); + + return RequestHelper.get()(this, `${uri}/v2`, { + showExpanded, + }); + } + + showV2Metadata( + options: OneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, + ): Promise> { + const { projectId, groupId, showExpanded } = options; + + ensureRequiredParams({ projectId, groupId }); + + const uri = getPrefixedUrl('packages/nuget', { projects: projectId, 'groups/-': groupId }); + + return RequestHelper.get()(this, `${uri}/v2/$metadata`, { + showExpanded, + }); + } + + downloadSymbolFile( + fileName: string, + signature: string, + options: { + symbolChecksum: string; + } & OneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded, + ): Promise> { + const { projectId, groupId, showExpanded, symbolChecksum } = options; + + ensureRequiredParams({ projectId, groupId }); + + const uri = getPrefixedUrl('packages/nuget', { projects: projectId, 'groups/-': groupId }); + const clonedService = { ...this }; + clonedService.headers.Symbolchecksum = symbolChecksum; + + return RequestHelper.get()( + clonedService, + `${uri}/symbolfiles/${fileName}/${signature}/${fileName}`, + { + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/Orbit.ts b/packages/core/src/resources/Orbit.ts new file mode 100644 index 000000000..8ffd41683 --- /dev/null +++ b/packages/core/src/resources/Orbit.ts @@ -0,0 +1,107 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export interface OrbitQueryRequest extends Record { + query: Record; + queryType?: 'json'; + responseFormat?: 'raw' | 'llm'; +} + +export interface OrbitQuerySchema extends Record { + result: unknown[] | string; + query_type: string; + raw_query_strings?: string[]; + row_count: number; +} + +export interface OrbitSchema extends Record { + schema_version: string; + domains: { + name: string; + description?: string; + node_names: string[]; + }[]; + nodes: Record[]; + edges: Record[]; +} + +export interface OrbitStatusSchema extends Record { + status: string; + timestamp: string; + version: string; + components: { + name: string; + status: string; + replicas: { + ready: number; + desired: number; + }; + metrics: Record; + }[]; +} + +export interface OrbitToolSchema extends Record { + name: string; + description: string; + parameters: Record; +} + +export class Orbit extends BaseResource { + createQuery( + queryRequest: OrbitQueryRequest, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()(this, 'orbit/query', { + sudo, + showExpanded, + body: queryRequest, + }); + } + + showSchema( + options?: { + expand?: string; + responseFormat?: 'raw' | 'llm'; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'orbit/schema', { + sudo, + showExpanded, + searchParams, + }); + } + + showStatus( + options?: { + responseFormat?: 'raw' | 'llm'; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'orbit/status', { + sudo, + showExpanded, + searchParams, + }); + } + + allTools( + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()(this, 'orbit/tools', { + sudo, + showExpanded, + }); + } +} diff --git a/packages/core/src/resources/Organizations.ts b/packages/core/src/resources/Organizations.ts new file mode 100644 index 000000000..92a7ec0cd --- /dev/null +++ b/packages/core/src/resources/Organizations.ts @@ -0,0 +1,48 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, createFormData, normalizeFormData } from '../infrastructure'; + +export interface OrganizationSchema extends Record { + id: number; + name: string; + path: string; + description: string; + created_at: string; + updated_at: string; + web_url: string; + avatar_url: string; +} + +export interface CreateOrganizationOptions { + name: string; + path: string; + description?: string; + avatar?: { content: Blob; filename: string }; +} + +export class Organizations extends BaseResource { + create( + options: CreateOrganizationOptions & ShowExpanded & Sudo, + ): Promise> { + const { name, path, description, avatar, sudo, showExpanded } = options; + + const body = avatar + ? createFormData( + normalizeFormData({ + name, + path, + description, + avatar: [avatar.content, avatar.filename], + }), + ) + : { name, path, description }; + + return RequestHelper.post()(this, 'organizations', { + sudo, + showExpanded, + body, + }); + } +} diff --git a/packages/core/src/resources/Packages.ts b/packages/core/src/resources/Packages.ts index 13e7b0a5a..363e5be1f 100644 --- a/packages/core/src/resources/Packages.ts +++ b/packages/core/src/resources/Packages.ts @@ -45,10 +45,21 @@ export type AllPackageOptions = { excludeSubgroups?: boolean; orderBy?: 'created_at' | 'name' | 'version' | 'type' | 'project_path'; sort?: 'asc' | 'desc'; - packageType?: 'conan' | 'maven' | 'npm' | 'pypi' | 'composer' | 'nuget' | 'helm' | 'golang'; + packageType?: + | 'conan' + | 'maven' + | 'npm' + | 'pypi' + | 'composer' + | 'nuget' + | 'helm' + | 'golang' + | 'generic' + | 'terraform_module'; packageName?: string; + packageVersion?: string; includeVersionless?: boolean; - status?: 'default' | 'hidden' | 'processing' | 'error' | 'pending_destruction'; + status?: 'default' | 'hidden' | 'processing' | 'error' | 'pending_destruction' | 'deprecated'; }; export class Packages extends BaseResource { @@ -140,4 +151,21 @@ export class Packages extends BaseResource { }, ); } + + allPipelines( + projectId: string | number, + packageId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/${packageId}/pipelines`, + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/Pages.ts b/packages/core/src/resources/Pages.ts new file mode 100644 index 000000000..1416933f2 --- /dev/null +++ b/packages/core/src/resources/Pages.ts @@ -0,0 +1,65 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface PageDeploymentSchema extends Record { + created_at: string; + url: string; + path_prefix: string; + root_directory: string | null; +} + +export interface PagesSchema extends Record { + url: string; + is_unique_domain_enabled: boolean; + force_https: boolean; + deployments: PageDeploymentSchema[]; + primary_domain: string | null; +} + +export interface UpdatePagesOptions { + pagesUniqueDomainEnabled?: boolean; + pagesHttpsOnly?: boolean; + pagesPrimaryDomain?: string; +} + +export class Pages extends BaseResource { + show( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()(this, endpoint`projects/${projectId}/pages`, { + sudo, + showExpanded, + }); + } + + edit( + projectId: string | number, + options?: ShowExpanded & Sudo & UpdatePagesOptions, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.patch()(this, endpoint`projects/${projectId}/pages`, { + sudo, + showExpanded, + body, + }); + } + + remove( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()(this, endpoint`projects/${projectId}/pages`, { + sudo, + showExpanded, + }); + } +} diff --git a/packages/core/src/resources/PagesDomains.ts b/packages/core/src/resources/PagesDomains.ts index 3f0b4a47a..b264dbaed 100644 --- a/packages/core/src/resources/PagesDomains.ts +++ b/packages/core/src/resources/PagesDomains.ts @@ -90,6 +90,23 @@ export class PagesDomains extends BaseResource { ); } + verify( + projectId: string | number, + domain: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/pages/domains/${domain}/verify`, + { + sudo, + showExpanded, + }, + ); + } + remove( projectId: string | number, domain: string, diff --git a/packages/core/src/resources/PersonalAccessTokens.ts b/packages/core/src/resources/PersonalAccessTokens.ts index 27e50c89d..c2f9be8c2 100644 --- a/packages/core/src/resources/PersonalAccessTokens.ts +++ b/packages/core/src/resources/PersonalAccessTokens.ts @@ -47,8 +47,60 @@ export type AllPersonalAccessTokenOptions = { lastUsedAfter?: string; createdBefore?: string; createdAfter?: string; + expiresAfter?: string; + expiresBefore?: string; + sort?: + | 'created_asc' + | 'created_desc' + | 'expires_asc' + | 'expires_desc' + | 'last_used_asc' + | 'last_used_desc' + | 'name_asc' + | 'name_desc'; }; +export interface TokenAssociationGroupSchema extends Record { + id: number; + web_url: string; + name: string; + parent_id: number | null; + organization_id: number; + access_levels: number; + visibility: string; +} + +export interface TokenAssociationProjectSchema extends Record { + id: number; + description: string; + name: string; + name_with_namespace: string; + path: string; + path_with_namespace: string; + created_at: string; + access_levels: { + project_access_level: number | null; + group_access_level: number | null; + }; + visibility: string; + web_url: string; + namespace: { + id: number; + name: string; + path: string; + kind: string; + full_path: string; + parent_id: number | null; + avatar_url: string | null; + web_url: string; + }; +} + +export interface TokenAssociationsSchema extends Record { + groups: TokenAssociationGroupSchema[]; + projects: TokenAssociationProjectSchema[]; +} + export class PersonalAccessTokens extends BaseResource { all( options?: AllPersonalAccessTokenOptions & @@ -139,4 +191,29 @@ export class PersonalAccessTokens extends BaseResourc showExpanded, }); } + + allAssociations( + options?: { + minAccessLevel?: 5 | 10 | 15 | 20 | 25 | 30 | 40 | 50; + page?: number; + perPage?: number; + } & PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + 'personal_access_tokens/self/associations', + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as BaseRequestSearchParams & + PaginationRequestSearchParams

& + PaginationType

, + }, + ); + } } diff --git a/packages/core/src/resources/PipelineSchedules.ts b/packages/core/src/resources/PipelineSchedules.ts index 75c9179c1..fca336b20 100644 --- a/packages/core/src/resources/PipelineSchedules.ts +++ b/packages/core/src/resources/PipelineSchedules.ts @@ -17,6 +17,11 @@ import type { SimpleUserSchema } from './Users'; import { RequestHelper, endpoint } from '../infrastructure'; +export interface PipelineInputSchema extends Record { + name: string; + value: string | number | boolean | string[]; +} + export interface CondensedPipelineScheduleSchema extends Record { id: number; description: string; @@ -28,6 +33,7 @@ export interface CondensedPipelineScheduleSchema extends Record created_at: string; updated_at: string; owner: MappedOmit; + inputs?: PipelineInputSchema[]; } export interface PipelineScheduleSchema extends CondensedPipelineScheduleSchema { @@ -63,12 +69,34 @@ export class PipelineSchedules extends BaseResource( + allTriggeredPipelines( projectId: string | number, pipelineScheduleId: number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + options?: { + scope?: 'running' | 'pending' | 'finished' | 'branches' | 'tags'; + sort?: 'asc' | 'desc'; + status?: + | 'created' + | 'waiting_for_resource' + | 'preparing' + | 'pending' + | 'running' + | 'success' + | 'failed' + | 'canceled' + | 'skipped' + | 'manual' + | 'scheduled'; + updatedAfter?: string; + updatedBefore?: string; + createdAfter?: string; + createdBefore?: string; + } & BaseRequestSearchParams & + PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; return RequestHelper.get()( this, @@ -76,6 +104,10 @@ export class PipelineSchedules extends BaseResource & + PaginationType

, }, ); } @@ -85,7 +117,12 @@ export class PipelineSchedules extends BaseResource & Sudo, + options?: { + cronTimezone?: string; + active?: boolean; + inputs?: PipelineInputSchema[]; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -114,6 +151,7 @@ export class PipelineSchedules extends BaseResource & Sudo, ): Promise> { diff --git a/packages/core/src/resources/PipelineTriggers.ts b/packages/core/src/resources/PipelineTriggers.ts new file mode 100644 index 000000000..323157692 --- /dev/null +++ b/packages/core/src/resources/PipelineTriggers.ts @@ -0,0 +1,130 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; +import type { PipelineSchema } from './Pipelines'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface PipelineTriggerSchema extends Record { + id: number; + description: string; + created_at: string; + last_used: string | null; + token: string; + updated_at: string; + owner: Record | null; +} + +export interface TriggerPipelineOptions { + variables?: Record; + inputs?: Record; +} + +export class PipelineTriggers extends BaseResource { + all( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/triggers`, + { + sudo, + showExpanded, + }, + ); + } + + show( + projectId: string | number, + triggerId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/triggers/${triggerId}`, + { + sudo, + showExpanded, + }, + ); + } + + create( + projectId: string | number, + description: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()( + this, + endpoint`projects/${projectId}/triggers`, + { + sudo, + showExpanded, + body: { + description, + }, + }, + ); + } + + edit( + projectId: string | number, + triggerId: number, + options?: { description?: string } & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/triggers/${triggerId}`, + { + sudo, + showExpanded, + body, + }, + ); + } + + remove( + projectId: string | number, + triggerId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.del()(this, endpoint`projects/${projectId}/triggers/${triggerId}`, { + sudo, + showExpanded, + }); + } + + trigger( + projectId: string | number, + ref: string, + token: string, + options?: ShowExpanded & Sudo & TriggerPipelineOptions, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()( + this, + endpoint`projects/${projectId}/trigger/pipeline`, + { + sudo, + showExpanded, + searchParams: { + ref, + token, + }, + body, + }, + ); + } +} diff --git a/packages/core/src/resources/PlanLimits.ts b/packages/core/src/resources/PlanLimits.ts new file mode 100644 index 000000000..ae1ca2172 --- /dev/null +++ b/packages/core/src/resources/PlanLimits.ts @@ -0,0 +1,84 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper } from '../infrastructure'; + +export interface PlanLimitSchema extends Record { + ci_instance_level_variables: number; + ci_pipeline_size: number; + ci_active_jobs: number; + ci_project_subscriptions: number; + ci_pipeline_schedules: number; + ci_needs_size_limit: number; + ci_registered_group_runners: number; + ci_registered_project_runners: number; + dotenv_size: number; + dotenv_variables: number; + conan_max_file_size: number; + enforcement_limit: number; + generic_packages_max_file_size: number; + helm_max_file_size: number; + notification_limit: number; + maven_max_file_size: number; + npm_max_file_size: number; + nuget_max_file_size: number; + pipeline_hierarchy_size: number; + pypi_max_file_size: number; + terraform_module_max_file_size: number; + storage_size_limit: number; + web_hook_calls?: number; +} + +export interface UpdatePlanLimitOptions { + planName: string; + ciInstanceLevelVariables?: number; + ciPipelineSize?: number; + ciActiveJobs?: number; + ciProjectSubscriptions?: number; + ciPipelineSchedules?: number; + ciNeedsSizeLimit?: number; + ciRegisteredGroupRunners?: number; + ciRegisteredProjectRunners?: number; + dotenvSize?: number; + dotenvVariables?: number; + conanMaxFileSize?: number; + enforcementLimit?: number; + genericPackagesMaxFileSize?: number; + helmMaxFileSize?: number; + mavenMaxFileSize?: number; + notificationLimit?: number; + npmMaxFileSize?: number; + nugetMaxFileSize?: number; + pipelineHierarchySize?: number; + pypiMaxFileSize?: number; + terraformModuleMaxFileSize?: number; + storageSizeLimit?: number; + webHookCalls?: number; +} + +export class PlanLimits extends BaseResource { + show( + options?: { planName?: string } & ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; + + return RequestHelper.get()(this, 'application/plan_limits', { + sudo, + showExpanded, + searchParams, + }); + } + + edit( + options: ShowExpanded & Sudo & UpdatePlanLimitOptions, + ): Promise> { + const { sudo, showExpanded, ...body } = options; + + return RequestHelper.put()(this, 'application/plan_limits', { + sudo, + showExpanded, + body, + }); + } +} diff --git a/packages/core/src/resources/ProjectAccessTokens.ts b/packages/core/src/resources/ProjectAccessTokens.ts index 080a64159..c3c30c152 100644 --- a/packages/core/src/resources/ProjectAccessTokens.ts +++ b/packages/core/src/resources/ProjectAccessTokens.ts @@ -27,8 +27,9 @@ export interface ProjectAccessTokens extends Resource projectId: string | number, name: string, scopes: AccessTokenScopes[], - expiresAt: string, options?: { + expiresAt?: string; + description?: string; accessLevel?: Exclude< AccessLevel, AccessLevel.MINIMAL_ACCESS | AccessLevel.NO_ACCESS | AccessLevel.ADMIN diff --git a/packages/core/src/resources/ProjectAliases.ts b/packages/core/src/resources/ProjectAliases.ts index 3c5d6cc2c..bce947158 100644 --- a/packages/core/src/resources/ProjectAliases.ts +++ b/packages/core/src/resources/ProjectAliases.ts @@ -53,13 +53,13 @@ export class ProjectAliases extends BaseResource { }); } - edit( + show( name: string, options?: ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.post()(this, `project_aliases/${name}`, { + return RequestHelper.get()(this, `project_aliases/${name}`, { sudo, showExpanded, }); diff --git a/packages/core/src/resources/ProjectBadges.ts b/packages/core/src/resources/ProjectBadges.ts index 2316b83d6..7acf3a15a 100644 --- a/packages/core/src/resources/ProjectBadges.ts +++ b/packages/core/src/resources/ProjectBadges.ts @@ -22,14 +22,14 @@ export interface ProjectBadgeSchema extends BadgeSchema { export interface ProjectBadges extends ResourceBadges { add( - groupId: string | number, + projectId: string | number, linkUrl: string, imageUrl: string, options?: { name?: string } & ShowExpanded & Sudo, ): Promise>; all( - groupId: string | number, + projectId: string | number, options?: { name?: string } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -37,26 +37,26 @@ export interface ProjectBadges extends ResourceBadges ): Promise>; edit( - groupId: string | number, + projectId: string | number, badgeId: number, options?: EditBadgeOptions & ShowExpanded & Sudo, ): Promise>; preview( - groupId: string | number, + projectId: string | number, linkUrl: string, imageUrl: string, options?: ShowExpanded & Sudo, ): Promise>; remove( - groupId: string | number, + projectId: string | number, badgeId: number, options?: ShowExpanded & Sudo, ): Promise>; show( - groupId: string | number, + projectId: string | number, badgeId: number, options?: ShowExpanded & Sudo, ): Promise>; diff --git a/packages/core/src/resources/ProjectImportExports.ts b/packages/core/src/resources/ProjectImportExports.ts index 95e7978b3..c85527aeb 100644 --- a/packages/core/src/resources/ProjectImportExports.ts +++ b/packages/core/src/resources/ProjectImportExports.ts @@ -26,6 +26,7 @@ export interface FailedRelationSchema { exception_message: string; source: string; relation_name: string; + line_number: number; } export interface ImportStatusSchema extends Record { @@ -40,6 +41,20 @@ export interface ImportStatusSchema extends Record { correlation_id: string; failed_relations?: FailedRelationSchema[]; import_error?: string; + import_type?: string; + stats?: { + fetched: Record; + imported: Record; + }; +} + +export interface RelationImportSchema extends Record { + id: number; + project_path: string; + relation: string; + status: string; + created_at?: string; + updated_at?: string; } export class ProjectImportExports extends BaseResource { @@ -76,6 +91,8 @@ export class ProjectImportExports extends BaseResourc options?: { name?: string; namespace?: number | string; + namespaceId?: number; + namespacePath?: string; overrideParams?: Record; overwrite?: boolean; } & ShowExpanded & @@ -100,8 +117,10 @@ export class ProjectImportExports extends BaseResourc url: string, path: string, options?: { - name?: number; + name?: string; namespace?: number | string; + namespaceId?: number; + namespacePath?: string; overrideParams?: Record; overwrite?: boolean; } & ShowExpanded & @@ -127,11 +146,17 @@ export class ProjectImportExports extends BaseResourc path: string, region: string, secretAccessKey: string, - options?: { name?: number; namespace?: number | string } & ShowExpanded & Sudo, + options?: { + name?: string; + namespace?: number | string; + namespaceId?: number; + namespacePath?: string; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()(this, 'projects/remote-import', { + return RequestHelper.post()(this, 'projects/remote-import-s3', { sudo, showExpanded, body: { @@ -146,6 +171,43 @@ export class ProjectImportExports extends BaseResourc }); } + importRelation( + file: { content: Blob; filename: string }, + path: string, + relation: 'issues' | 'milestones' | 'ci_pipelines' | 'merge_requests', + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()(this, 'projects/import-relation', { + sudo, + showExpanded, + body: createFormData( + normalizeFormData({ + file: [file.content, file.filename], + path, + relation, + }), + ), + }); + } + + showRelationImportStatus( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/relation-imports`, + { + sudo, + showExpanded, + }, + ); + } + showExportStatus( projectId: string | number, options?: ShowExpanded & Sudo, diff --git a/packages/core/src/resources/ProjectInvitations.ts b/packages/core/src/resources/ProjectInvitations.ts index ea8f409fb..195d02173 100644 --- a/packages/core/src/resources/ProjectInvitations.ts +++ b/packages/core/src/resources/ProjectInvitations.ts @@ -9,7 +9,11 @@ import type { ShowExpanded, Sudo, } from '../infrastructure'; -import type { InvitationSchema } from '../templates/ResourceInvitations'; +import type { + InvitationSchema, + InvitationResponseSchema, + UpdateInvitationResponseSchema, +} from '../templates/ResourceInvitations'; import { AccessLevel } from '../constants'; import { ResourceInvitations } from '../templates'; @@ -26,7 +30,7 @@ export interface ProjectInvitations { } & OneOf<{ email: string; userId: string }> & ShowExpanded & Sudo, - ): Promise>; + ): Promise>; all( projectId: string | number, @@ -44,13 +48,13 @@ export interface ProjectInvitations { accessLevel?: Exclude; } & ShowExpanded & Sudo, - ): Promise>; + ): Promise>; remove( projectId: string | number, email: string, options?: ShowExpanded & Sudo, - ): Promise>; + ): Promise>; } export class ProjectInvitations extends ResourceInvitations { diff --git a/packages/core/src/resources/ProtectedBranches.ts b/packages/core/src/resources/ProjectProtectedBranches.ts similarity index 93% rename from packages/core/src/resources/ProtectedBranches.ts rename to packages/core/src/resources/ProjectProtectedBranches.ts index 8961226df..897602bbe 100644 --- a/packages/core/src/resources/ProtectedBranches.ts +++ b/packages/core/src/resources/ProjectProtectedBranches.ts @@ -26,6 +26,7 @@ export interface ExtendedProtectedBranchAccessLevelSchema { access_level_description: string; user_id?: number | null; group_id?: number | null; + deploy_key_id?: number | null; } export interface ProtectedBranchSchema extends Record { @@ -36,11 +37,13 @@ export interface ProtectedBranchSchema extends Record { unprotect_access_levels?: ExtendedProtectedBranchAccessLevelSchema[]; allow_force_push: boolean; code_owner_approval_required: boolean; + inherited?: boolean; } export type CreateProtectedBranchAllowOptions = | { userId: number } | { groupId: number } + | { deployKeyId: number } | { accessLevel: ProtectedBranchAccessLevel }; export type EditProtectedBranchAllowOptions = { @@ -48,6 +51,7 @@ export type EditProtectedBranchAllowOptions = { } & ( | { userId: number } | { groupId: number } + | { deployKeyId: number } | { accessLevel: ProtectedBranchAccessLevel; id: number; @@ -73,7 +77,7 @@ export type EditProtectedBranchOptions = { codeOwnerApprovalRequired?: boolean; }; -export class ProtectedBranches extends BaseResource { +export class ProjectProtectedBranches extends BaseResource { all( projectId: string | number, options?: { search?: string } & BaseRequestSearchParams & @@ -130,9 +134,9 @@ export class ProtectedBranches extends BaseResource( projectId: string | number, branchName: string, - options?: BaseRequestSearchParams & EditProtectedBranchOptions & ShowExpanded & Sudo, + options?: EditProtectedBranchOptions & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded, ...searchParams } = options || {}; + const { sudo, showExpanded, ...body } = options || {}; return RequestHelper.patch()( this, @@ -140,7 +144,7 @@ export class ProtectedBranches extends BaseResource { + id: number; + enabled: boolean; + last_error: string | null; + last_successful_update_at: string; + last_update_at: string; + last_update_started_at: string; + mirror_branch_regex: string | null; + mirror_overwrites_diverged_branches: boolean; + mirror_trigger_builds: boolean; + only_mirror_protected_branches: boolean | null; + update_status: 'none' | 'scheduled' | 'started' | 'finished' | 'failed' | 'canceled'; + url: string; +} + +export type UpdatePullMirrorOptions = { + authPassword?: string; + authUser?: string; + enabled?: boolean; + mirrorBranchRegex?: string; + mirrorOverwritesDivergedBranches?: boolean; + mirrorTriggerBuilds?: boolean; + onlyMirrorProtectedBranches?: boolean; + url?: string; +}; + +export class ProjectPullMirroring extends BaseResource { + show( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/mirror/pull`, + { + sudo, + showExpanded, + }, + ); + } + + edit( + projectId: string | number, + options?: ShowExpanded & Sudo & UpdatePullMirrorOptions, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/mirror/pull`, + { + sudo, + showExpanded, + body, + }, + ); + } + + start( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post()(this, endpoint`projects/${projectId}/mirror/pull`, { + sudo, + showExpanded, + }); + } +} diff --git a/packages/core/src/resources/ProjectRelationsExport.ts b/packages/core/src/resources/ProjectRelationsExport.ts index ee98bbbf4..64b5b4093 100644 --- a/packages/core/src/resources/ProjectRelationsExport.ts +++ b/packages/core/src/resources/ProjectRelationsExport.ts @@ -4,18 +4,33 @@ import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; import { RequestHelper, endpoint } from '../infrastructure'; +export interface RelationsExportBatchSchema extends Record { + status: number; + batch_number: number; + objects_count: number; + error?: string; + updated_at: string; +} + export interface RelationsExportStatusSchema extends Record { relation: string; status: number; error?: string; updated_at: string; + batched: boolean; + batches_count: number; + batches?: RelationsExportBatchSchema[]; } export class ProjectRelationsExport extends BaseResource { download( projectId: string | number, relation: string, - options?: ShowExpanded & Sudo, + options?: { + batched?: boolean; + batchNumber?: number; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...searchParams } = options || {}; @@ -35,23 +50,30 @@ export class ProjectRelationsExport extends BaseResou showExportStatus( projectId: string | number, - options?: ShowExpanded & Sudo, - ): Promise> { - const { sudo, showExpanded } = options || {}; + options?: { + relation?: string; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...searchParams } = options || {}; - return RequestHelper.get()( + return RequestHelper.get()( this, endpoint`projects/${projectId}/export_relations/status`, { sudo, showExpanded, + searchParams, }, ); } scheduleExport( projectId: string | number, - options?: ShowExpanded & Sudo, + options?: { + batched?: boolean; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; diff --git a/packages/core/src/resources/ProjectReleases.ts b/packages/core/src/resources/ProjectReleases.ts index 558f83077..89098a42d 100644 --- a/packages/core/src/resources/ProjectReleases.ts +++ b/packages/core/src/resources/ProjectReleases.ts @@ -70,7 +70,10 @@ export interface ReleaseSchema extends Record { export class ProjectReleases extends BaseResource { all( projectId: string | number, - options?: { includeHtmlDescription: true } & BaseRequestSearchParams & + options?: { includeHtmlDescription: true } & { + orderBy?: 'released_at' | 'created_at'; + sort?: 'desc' | 'asc'; + } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, @@ -78,12 +81,21 @@ export class ProjectReleases extends BaseResource all( projectId: string | number, - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, + options?: { + orderBy?: 'released_at' | 'created_at'; + sort?: 'desc' | 'asc'; + } & BaseRequestSearchParams & + PaginationRequestOptions

& + ShowExpanded & + Sudo, ): Promise>; all( projectId: string | number, - options?: { includeHtmlDescription?: boolean } & BaseRequestSearchParams & + options?: { includeHtmlDescription?: boolean } & { + orderBy?: 'released_at' | 'created_at'; + sort?: 'desc' | 'asc'; + } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, diff --git a/packages/core/src/resources/ProjectRemoteMirrors.ts b/packages/core/src/resources/ProjectRemoteMirrors.ts index 192c654e3..54c7a7606 100644 --- a/packages/core/src/resources/ProjectRemoteMirrors.ts +++ b/packages/core/src/resources/ProjectRemoteMirrors.ts @@ -13,9 +13,18 @@ import type { import { RequestHelper, endpoint } from '../infrastructure'; +export interface RemoteMirrorHostKey { + fingerprint_sha256: string; +} + +export interface RemoteMirrorPublicKey { + public_key: string; +} + export interface ProjectRemoteMirrorSchema extends Record { enabled: boolean; id: number; + auth_method?: string; last_error?: string; last_successful_update_at: string; last_update_at: string; @@ -24,6 +33,7 @@ export interface ProjectRemoteMirrorSchema extends Record { keep_divergent_refs: boolean; update_status: string; url: string; + host_keys?: RemoteMirrorHostKey[]; } export class ProjectRemoteMirrors extends BaseResource { @@ -76,6 +86,8 @@ export class ProjectRemoteMirrors extends BaseResourc url: string, options?: { enabled?: boolean; + authMethod?: 'ssh_public_key' | 'password'; + hostKeys?: string[]; onlyProtectedBranches?: boolean; keepDivergentRefs?: boolean; mirrorBranchRegex?: string; @@ -103,6 +115,8 @@ export class ProjectRemoteMirrors extends BaseResourc mirrorId: number, options?: { enabled?: boolean; + authMethod?: 'ssh_public_key' | 'password'; + hostKeys?: string[]; onlyProtectedBranches?: boolean; keepDivergentRefs?: boolean; mirrorBranchRegex?: string; @@ -111,7 +125,7 @@ export class ProjectRemoteMirrors extends BaseResourc ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()( + return RequestHelper.put()( this, endpoint`projects/${projectId}/remote_mirrors/${mirrorId}`, { @@ -152,6 +166,23 @@ export class ProjectRemoteMirrors extends BaseResourc ); } + publicKey( + projectId: string | number, + mirrorId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/remote_mirrors/${mirrorId}/public_key`, + { + sudo, + showExpanded, + }, + ); + } + sync( projectId: string | number, mirrorId: number, diff --git a/packages/core/src/resources/ProjectRepositoryStorageMoves.ts b/packages/core/src/resources/ProjectRepositoryStorageMoves.ts index cb32f2b44..004a72a01 100644 --- a/packages/core/src/resources/ProjectRepositoryStorageMoves.ts +++ b/packages/core/src/resources/ProjectRepositoryStorageMoves.ts @@ -32,8 +32,11 @@ export interface ProjectRepositoryStorageMoves ): Promise>; schedule( - sourceStorageName: string, - options?: { projectId?: string | number; destinationStorageName?: string } & ShowExpanded & + options?: { + projectId?: string | number; + sourceStorageName?: string; + destinationStorageName?: string; + } & ShowExpanded & Sudo, ): Promise>; } diff --git a/packages/core/src/resources/ProjectSecuritySettings.ts b/packages/core/src/resources/ProjectSecuritySettings.ts new file mode 100644 index 000000000..78e823dfc --- /dev/null +++ b/packages/core/src/resources/ProjectSecuritySettings.ts @@ -0,0 +1,56 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; + +import { RequestHelper, endpoint } from '../infrastructure'; + +export interface ProjectSecuritySettingsSchema extends Record { + project_id: number; + created_at: string; + updated_at: string; + auto_fix_container_scanning: boolean; + auto_fix_dast: boolean; + auto_fix_dependency_scanning: boolean; + auto_fix_sast: boolean; + continuous_vulnerability_scans_enabled: boolean; + container_scanning_for_registry_enabled: boolean; + secret_push_protection_enabled: boolean; +} + +export class ProjectSecuritySettings extends BaseResource { + show( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/security_settings`, + { + sudo, + showExpanded, + }, + ); + } + + edit( + projectId: string | number, + options?: { + secretPushProtectionEnabled?: boolean; + } & ShowExpanded & + Sudo, + ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/security_settings`, + { + sudo, + showExpanded, + body, + }, + ); + } +} diff --git a/packages/core/src/resources/ProjectTemplates.ts b/packages/core/src/resources/ProjectTemplates.ts index ede3d45e6..6430a20f9 100644 --- a/packages/core/src/resources/ProjectTemplates.ts +++ b/packages/core/src/resources/ProjectTemplates.ts @@ -17,9 +17,25 @@ export type ProjectTemplateType = | 'licenses' | 'issues' | 'merge_requests'; + +export interface ProjectTemplateListSchema extends Record { + key: string; + name: string; +} + export interface ProjectTemplateSchema extends Record { name: string; content: string; + // License-specific fields + key?: string; + nickname?: string; + popular?: boolean; + html_url?: string; + source_url?: string; + description?: string; + conditions?: string[]; + permissions?: string[]; + limitations?: string[]; } export class ProjectTemplates extends BaseResource { @@ -27,10 +43,10 @@ export class ProjectTemplates extends BaseResource projectId: string | number, type: ProjectTemplateType, options?: PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - return RequestHelper.get()( + return RequestHelper.get()( this, endpoint`projects/${projectId}/templates/${type}`, { diff --git a/packages/core/src/resources/ProjectWikiNotes.ts b/packages/core/src/resources/ProjectWikiNotes.ts new file mode 100644 index 000000000..61ce2b28b --- /dev/null +++ b/packages/core/src/resources/ProjectWikiNotes.ts @@ -0,0 +1,67 @@ +import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; + +import type { + BaseRequestSearchParams, + GitlabAPIResponse, + PaginationRequestOptions, + PaginationTypes, + ShowExpanded, + Sudo, +} from '../infrastructure'; +import type { NoteSchema } from '../templates/ResourceNotes'; + +import { ResourceNotes } from '../templates/ResourceNotes'; + +export interface ProjectWikiNoteSchema extends NoteSchema { + noteable_type: 'WikiPage::Meta'; + project_id: number; +} + +export interface ProjectWikiNotes extends ResourceNotes { + all( + projectId: string | number, + wikiPageMetaId: number, + options?: { + sort?: 'asc' | 'desc'; + orderBy?: 'created_at' | 'updated_at'; + } & BaseRequestSearchParams & + PaginationRequestOptions

& + ShowExpanded & + Sudo, + ): Promise>; + + create( + projectId: string | number, + wikiPageMetaId: number, + body: string, + options?: ShowExpanded & Sudo, + ): Promise>; + + edit( + projectId: string | number, + wikiPageMetaId: number, + noteId: number, + options: { body: string } & ShowExpanded & Sudo, + ): Promise>; + + remove( + projectId: string | number, + wikiPageMetaId: number, + noteId: number, + options?: Sudo, + ): Promise>; + + show( + projectId: string | number, + wikiPageMetaId: number, + noteId: number, + options?: ShowExpanded & Sudo, + ): Promise>; +} + +export class ProjectWikiNotes extends ResourceNotes { + constructor(options: BaseResourceOptions) { + /* istanbul ignore next */ + super('projects', 'wiki_pages', options); + } +} diff --git a/packages/core/src/resources/Projects.ts b/packages/core/src/resources/Projects.ts index d523b0407..8435f4b11 100644 --- a/packages/core/src/resources/Projects.ts +++ b/packages/core/src/resources/Projects.ts @@ -86,6 +86,12 @@ export interface SimpleProjectSchema extends CondensedProjectSchema { namespace: CondensedNamespaceSchema; } +export interface ForkedProjectSchema extends SimpleProjectSchema { + license_url: string; + license: ProjectLicenseSchema; + repository_storage: string; +} + export interface ProjectSchema extends SimpleProjectSchema { description_html: string; visibility: 'public' | 'internal' | 'private'; @@ -138,8 +144,11 @@ export interface ProjectSchema extends SimpleProjectSchema { ci_forward_deployment_enabled: boolean; ci_forward_deployment_rollback_allowed: boolean; ci_allow_fork_pipelines_to_run_in_parent_project: boolean; + ci_id_token_sub_claim_components: string[]; ci_separated_caches: boolean; ci_restrict_pipeline_cancellation_role: string; + ci_pipeline_variables_minimum_override_role: string; + ci_push_repository_for_job_token_allowed: boolean; public_jobs: boolean; shared_with_groups: | { @@ -152,7 +161,8 @@ export interface ProjectSchema extends SimpleProjectSchema { repository_storage: string; only_allow_merge_if_pipeline_succeeds: boolean; allow_merge_on_skipped_pipeline: boolean; - ci_pipeline_variables_minimum_override_role: boolean; + allow_pipeline_trigger_approve_deployment: boolean; + restrict_user_defined_variables: boolean; only_allow_merge_if_all_discussions_are_resolved: boolean; remove_source_branch_after_merge: boolean; printing_merge_requests_link_enabled: boolean; @@ -179,6 +189,16 @@ export interface ProjectSchema extends SimpleProjectSchema { marked_for_deletion_on: string; compliance_frameworks: string[] | null; warn_about_potentially_unwanted_characters: boolean; + secret_push_protection_enabled: boolean; + repository_object_format: 'sha1' | 'sha256'; + package_registry_access_level: string; + mr_default_title_template: string | null; + emails_enabled: boolean; + ci_pipeline_variables_minimum_override_role: string; + ci_display_pipeline_variables: boolean; + model_experiments_access_level: string; + model_registry_access_level: string; + statistics: ProjectStatisticsSchema; container_registry_image_prefix: string; _links: { self: string; @@ -190,6 +210,9 @@ export interface ProjectSchema extends SimpleProjectSchema { members: string; cluster_agents: string; }; + only_allow_merge_if_all_status_checks_passed?: boolean; + mr_default_target_self?: boolean; + forked_from_project?: ForkedProjectSchema; } export interface ProjectFileUploadSchema extends Record { @@ -267,6 +290,7 @@ export type CreateProjectOptions = { defaultBranch?: string; description?: string; emailsDisabled?: boolean; + emailsEnabled?: boolean; externalAuthorizationClassificationLabel?: string; forkingAccessLevel?: AccessLevelSettingState; groupWithProjectTemplatesId?: number; @@ -280,10 +304,12 @@ export type CreateProjectOptions = { mergeTrainsEnabled?: boolean; mirrorTriggerBuilds?: boolean; mirror?: boolean; + mrDefaultTitleTemplate?: string; namespaceId?: number; onlyAllowMergeIfAllDiscussionsAreResolved?: boolean; onlyAllowMergeIfPipelineSucceeds?: boolean; packagesEnabled?: boolean; + packageRegistryAccessLevel?: AccessLevelSettingState; pagesAccessLevel?: AccessLevelSettingState | 'public'; printingMergeRequestLinkEnabled?: boolean; publicBuilds?: boolean; @@ -292,8 +318,11 @@ export type CreateProjectOptions = { featureFlagsAccessLevel?: AccessLevelSettingState; infrastructureAccessLevel?: AccessLevelSettingState; monitorAccessLevel?: AccessLevelSettingState; + modelExperimentsAccessLevel?: AccessLevelSettingState; + modelRegistryAccessLevel?: AccessLevelSettingState; removeSourceBranchAfterMerge?: boolean; repositoryAccessLevel?: AccessLevelSettingState; + repositoryObjectFormat?: 'sha1' | 'sha256'; repositoryStorage?: string; requestAccessEnabled?: boolean; requirementsAccessLevel?: AccessLevelSettingState; @@ -309,6 +338,7 @@ export type CreateProjectOptions = { useCustomTemplate?: boolean; visibility?: 'public' | 'internal' | 'private'; wikiAccessLevel?: AccessLevelSettingState; + warnAboutPotentiallyUnwantedCharacters?: boolean; }; export type EditProjectOptions = { @@ -360,6 +390,7 @@ export type EditProjectOptions = { onlyAllowMergeIfPipelineSucceeds?: boolean; onlyMirrorProtectedBranches?: boolean; packagesEnabled?: boolean; + packageRegistryAccessLevel?: string; pagesAccessLevel?: string; path?: string; printingMergeRequestLinkEnabled?: boolean; @@ -369,8 +400,11 @@ export type EditProjectOptions = { featureFlagsAccessLevel?: AccessLevelSettingState; infrastructureAccessLevel?: AccessLevelSettingState; monitorAccessLevel?: AccessLevelSettingState; + modelExperimentsAccessLevel?: AccessLevelSettingState; + modelRegistryAccessLevel?: AccessLevelSettingState; removeSourceBranchAfterMerge?: boolean; repositoryAccessLevel?: AccessLevelSettingState; + repositoryObjectFormat?: 'sha1' | 'sha256'; repositoryStorage?: string; requestAccessEnabled?: boolean; requirementsAccessLevel?: AccessLevelSettingState; diff --git a/packages/core/src/resources/ProtectedTags.ts b/packages/core/src/resources/ProtectedTags.ts index 50cd37d39..77067436d 100644 --- a/packages/core/src/resources/ProtectedTags.ts +++ b/packages/core/src/resources/ProtectedTags.ts @@ -25,6 +25,9 @@ export interface ProtectedTagAccessLevelSummarySchema { id: number; access_level: ProtectedTagAccessLevel; access_level_description: string; + deploy_key_id?: number | null; + group_id?: number | null; + user_id?: number | null; } export interface ProtectedTagSchema extends Record { @@ -35,6 +38,7 @@ export interface ProtectedTagSchema extends Record { export type ProtectedTagAccessLevelEntity = OneOf<{ userId: number; groupId: number; + deployKeyId: number; accessLevel: ProtectedTagAccessLevel; }>; @@ -65,8 +69,7 @@ export class ProtectedTags extends BaseResource { options?: { createAccessLevel?: ProtectedTagAccessLevel; allowedToCreate?: ProtectedTagAccessLevelEntity[]; - } & BaseRequestSearchParams & - ShowExpanded & + } & ShowExpanded & Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -92,8 +95,7 @@ export class ProtectedTags extends BaseResource { options?: { createAccessLevel?: ProtectedTagAccessLevel; allowedToCreate?: ProtectedTagAccessLevelEntity[]; - } & BaseRequestSearchParams & - ShowExpanded & + } & ShowExpanded & Sudo, ): Promise> { return this.create(projectId, tagName, options); diff --git a/packages/core/src/resources/PyPI.ts b/packages/core/src/resources/PyPI.ts index e39f6b2d3..d836c4be4 100644 --- a/packages/core/src/resources/PyPI.ts +++ b/packages/core/src/resources/PyPI.ts @@ -8,6 +8,7 @@ import { endpoint, ensureRequiredParams, getPrefixedUrl, + normalizeFormData, } from '../infrastructure'; export class PyPI extends BaseResource { @@ -63,14 +64,47 @@ export class PyPI extends BaseResource { uploadPackageFile( projectId: string | number, packageFile: { content: Blob; filename: string }, - options?: ShowExpanded & Sudo, + options?: { + requiresPython?: string; + sha256Digest?: string; + name?: string; + version?: string; + } & ShowExpanded & + Sudo, ): Promise> { + const { sudo, showExpanded, ...body } = options || {}; + + return RequestHelper.post()(this, endpoint`projects/${projectId}/packages/pypi`, { + sudo, + showExpanded, + body: createFormData( + normalizeFormData({ + ...body, + content: [packageFile.content, packageFile.filename], + }), + ), + }); + } + + allPackages({ + projectId, + groupId, + ...options + }: OneOf<{ projectId: string | number; groupId: string | number }> & + ShowExpanded & + Sudo): Promise> { + ensureRequiredParams({ projectId, groupId }); + + const url = getPrefixedUrl('packages/pypi/simple', { + projects: projectId, + groups: groupId ? `${groupId}/-` : undefined, + }); + const { sudo, showExpanded } = options || {}; - return RequestHelper.put()(this, endpoint`projects/${projectId}/packages/pypi`, { + return RequestHelper.get()(this, url, { sudo, showExpanded, - body: createFormData({ file: [packageFile.content, packageFile.filename] }), }); } } diff --git a/packages/core/src/resources/ReleaseLinks.ts b/packages/core/src/resources/ReleaseLinks.ts index 17bc227b2..62645d763 100644 --- a/packages/core/src/resources/ReleaseLinks.ts +++ b/packages/core/src/resources/ReleaseLinks.ts @@ -17,8 +17,9 @@ export interface ReleaseLinkSchema extends Record { id: number; name: string; url: string; + direct_asset_url?: string; external: boolean; - link_type: string; + link_type: 'other' | 'runbook' | 'image' | 'package'; } export class ReleaseLinks extends BaseResource { @@ -50,7 +51,7 @@ export class ReleaseLinks extends BaseResource { url: string, options?: { filePath?: string; - linkType?: string; + linkType?: 'other' | 'runbook' | 'image' | 'package'; directAssetPath?: string; } & BaseRequestSearchParams & ShowExpanded & @@ -81,7 +82,7 @@ export class ReleaseLinks extends BaseResource { name?: string; url?: string; filePath?: string; - linkType?: string; + linkType?: 'other' | 'runbook' | 'image' | 'package'; directAssetPath?: string; } & BaseRequestSearchParams & ShowExpanded & diff --git a/packages/core/src/resources/Repositories.ts b/packages/core/src/resources/Repositories.ts index 8090b2523..1372555a6 100644 --- a/packages/core/src/resources/Repositories.ts +++ b/packages/core/src/resources/Repositories.ts @@ -26,6 +26,36 @@ export interface RepositoryCompareSchema extends Record { diffs?: CommitDiffSchema[]; compare_timeout: boolean; compare_same_ref: boolean; + collapsed?: boolean; + too_large?: boolean; +} + +export interface RepositoryHealthSchema extends Record { + size: number; + objects: { + count: number; + size: number; + }; + refs: { + count: number; + size: number; + }; + packfiles: { + count: number; + size: number; + }; + alternate_objects: { + count: number; + size: number; + }; + loose_objects: { + count: number; + size: number; + }; + packfile_objects: { + count: number; + size: number; + }; } export interface RepositoryContributorSchema extends Record { @@ -83,6 +113,7 @@ export class Repositories extends BaseResource { options?: { orderBy?: string; sort?: string; + ref?: string; } & ShowExpanded & Sudo, ): Promise> { @@ -99,6 +130,22 @@ export class Repositories extends BaseResource { ); } + showHealth( + projectId: string | number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/repository/health`, + { + sudo, + showExpanded, + }, + ); + } + allRepositoryTrees( projectId: string | number, options?: AllRepositoryTreesOptions & diff --git a/packages/core/src/resources/RepositoryFiles.ts b/packages/core/src/resources/RepositoryFiles.ts index 7e9573182..7defa173f 100644 --- a/packages/core/src/resources/RepositoryFiles.ts +++ b/packages/core/src/resources/RepositoryFiles.ts @@ -21,6 +21,7 @@ export interface RepositoryFileExpandedSchema extends Record { blob_id: string; commit_id: string; last_commit_id: string; + execute_filemode: boolean; } export interface RepositoryFileBlameSchema extends Record { diff --git a/packages/core/src/resources/ResourceGroups.ts b/packages/core/src/resources/ResourceGroups.ts index f77d4f7f5..6f00332d1 100644 --- a/packages/core/src/resources/ResourceGroups.ts +++ b/packages/core/src/resources/ResourceGroups.ts @@ -97,4 +97,21 @@ export class ResourceGroups extends BaseResource { }, ); } + + showCurrentJob( + projectId: string | number, + key: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/resource_groups/${key}/current_job`, + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/resources/RubyGems.ts b/packages/core/src/resources/RubyGems.ts index ba7bee993..fab549db1 100644 --- a/packages/core/src/resources/RubyGems.ts +++ b/packages/core/src/resources/RubyGems.ts @@ -42,6 +42,23 @@ export class RubyGems extends BaseResource { ); } + downloadGemspecFile( + projectId: string, + fileName: string, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/rubygems/quick/Marshal.4.8/${fileName}`, + { + sudo, + showExpanded, + }, + ); + } + uploadGemFile( projectId: string | number, packageFile: { content: Blob; filename: string }, diff --git a/packages/core/src/resources/Snippets.ts b/packages/core/src/resources/Snippets.ts index 40dc56a8e..55a06a4b3 100644 --- a/packages/core/src/resources/Snippets.ts +++ b/packages/core/src/resources/Snippets.ts @@ -30,6 +30,8 @@ export interface SimpleSnippetSchema extends Record { export interface SnippetSchema extends SimpleSnippetSchema { visibility: SnippetVisibility; raw_url: string; + imported?: boolean; + imported_from?: string; } export interface ExpandedSnippetSchema extends SnippetSchema { diff --git a/packages/core/src/resources/TerraformModules.ts b/packages/core/src/resources/TerraformModules.ts new file mode 100644 index 000000000..ef367b877 --- /dev/null +++ b/packages/core/src/resources/TerraformModules.ts @@ -0,0 +1,193 @@ +import { BaseResource } from '@gitbeaker/requester-utils'; + +import type { GitlabAPIResponse, ShowExpanded } from '../infrastructure'; + +import { RequestHelper, createFormData, endpoint } from '../infrastructure'; + +export interface TerraformModuleProviderSchema { + name: string; + version: string; +} + +export interface TerraformModuleRootSchema { + dependencies: unknown[]; + providers?: TerraformModuleProviderSchema[]; +} + +export interface TerraformModuleVersionSchema { + version: string; + submodules: unknown[]; + root: TerraformModuleRootSchema; +} + +export interface TerraformModuleSchema { + versions: TerraformModuleVersionSchema[]; + source: string; +} + +export interface TerraformModuleVersionsResponseSchema extends Record { + modules: TerraformModuleSchema[]; +} + +export interface TerraformModuleDetailsSchema extends Record { + name: string; + provider: string; + providers: string[]; + root: TerraformModuleRootSchema; + source: string; + submodules: unknown[]; + version: string; + versions: string[]; +} + +export interface TerraformModuleUploadResponseSchema extends Record { + message: string; +} + +export class TerraformModules extends BaseResource { + allVersions( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}/versions`, + { + showExpanded, + }, + ); + } + + showLatest( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}`, + { + showExpanded, + }, + ); + } + + showVersion( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + moduleVersion: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}/${moduleVersion}`, + { + showExpanded, + }, + ); + } + + showLatestDownloadUrl( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}/download`, + { + showExpanded, + }, + ); + } + + showVersionDownloadUrl( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + moduleVersion: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}/${moduleVersion}/download`, + { + showExpanded, + }, + ); + } + + downloadFromNamespace( + moduleNamespace: string, + moduleName: string, + moduleSystem: string, + moduleVersion: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.get()( + this, + endpoint`packages/terraform/modules/v1/${moduleNamespace}/${moduleName}/${moduleSystem}/${moduleVersion}/file`, + { + showExpanded, + }, + ); + } + + downloadFromProject( + projectId: string | number, + moduleName: string, + moduleSystem: string, + moduleVersion?: string, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + const versionPath = moduleVersion || ''; + + return RequestHelper.get()( + this, + endpoint`projects/${projectId}/packages/terraform/modules/${moduleName}/${moduleSystem}/${versionPath}`, + { + showExpanded, + }, + ); + } + + uploadModule( + projectId: string | number, + moduleName: string, + moduleSystem: string, + moduleVersion: string, + packageFile: { content: Blob; filename: string }, + options?: ShowExpanded, + ): Promise> { + const { showExpanded } = options || {}; + + return RequestHelper.put()( + this, + endpoint`projects/${projectId}/packages/terraform/modules/${moduleName}/${moduleSystem}/${moduleVersion}/file`, + { + showExpanded, + body: createFormData({ + file: [packageFile.content, packageFile.filename], + }), + }, + ); + } +} diff --git a/packages/core/src/resources/TodoLists.ts b/packages/core/src/resources/TodoLists.ts index 2cac691a5..b6d836762 100644 --- a/packages/core/src/resources/TodoLists.ts +++ b/packages/core/src/resources/TodoLists.ts @@ -24,14 +24,19 @@ export type TodoAction = | 'approval_required' | 'unmergeable' | 'directly_addressed' - | 'merge_train_removed'; + | 'merge_train_removed' + | 'member_access_requested'; export type TodoType = | 'Issue' | 'MergeRequest' | 'Commit' | 'Epic' | 'DesignManagement::Design' - | 'AlertManagement::Alert'; + | 'AlertManagement::Alert' + | 'Project' + | 'Namespace' + | 'Vulnerability' + | 'WikiPage::Meta'; export type TodoState = 'pending' | 'done'; export interface TodoSchema extends Record { diff --git a/packages/core/src/resources/index.ts b/packages/core/src/resources/index.ts index 62f55c15d..d7f5d4058 100644 --- a/packages/core/src/resources/index.ts +++ b/packages/core/src/resources/index.ts @@ -1,44 +1,52 @@ // General -export * from './Agents'; +export * from './AICatalog'; export * from './AlertManagement'; export * from './ApplicationAppearance'; export * from './ApplicationPlanLimits'; export * from './ApplicationSettings'; export * from './ApplicationStatistics'; export * from './Applications'; +export * from './Attestations'; export * from './AuditEvents'; export * from './Avatar'; export * from './BroadcastMessages'; +export * from './BulkImports'; +export * from './ClusterAgents'; export * from './CodeSuggestions'; export * from './Composer'; export * from './Conan'; -export * from './DashboardAnnotations'; +export * from './ConanV2'; +export * from './DataManagement'; +export * from './DatabaseMigrations'; export * from './Debian'; +export * from './Dependencies'; +export * from './DependencyListExport'; export * from './DependencyProxy'; export * from './DeployKeys'; export * from './DeployTokens'; -export * from './DockerfileTemplates'; export * from './Events'; export * from './Experiments'; -export * from './GeoNodes'; -export * from './GeoSites'; -export * from './GitLabCIYMLTemplates'; -export * from './GitignoreTemplates'; export * from './Import'; export * from './InstanceLevelCICDVariables'; export * from './Keys'; export * from './License'; -export * from './LicenseTemplates'; +export * from './Licenses'; export * from './Lint'; export * from './Markdown'; export * from './Maven'; export * from './Metadata'; export * from './Migrations'; +export * from './ModelRegistry'; export * from './NPM'; export * from './Namespaces'; export * from './NotificationSettings'; export * from './NuGet'; +export * from './Orbit'; +export * from './Organizations'; +export * from './Pages'; export * from './PersonalAccessTokens'; +export * from './PipelineTriggers'; +export * from './PlanLimits'; export * from './PyPI'; export * from './RubyGems'; export * from './Search'; @@ -51,6 +59,7 @@ export * from './SnippetRepositoryStorageMoves'; export * from './Snippets'; export * from './Suggestions'; export * from './SystemHooks'; +export * from './TerraformModules'; export * from './TodoLists'; export * from './Topics'; @@ -58,17 +67,27 @@ export * from './Topics'; export * from './Branches'; export * from './CommitDiscussions'; export * from './Commits'; +export * from './CompliancePolicySettings'; export * from './ContainerRegistry'; +export * from './ContainerRegistryProtectionTagRules'; +export * from './ContainerRepositoryProtectionRules'; +export * from './ContainerVirtualRegistry'; export * from './Deployments'; export * from './Environments'; export * from './ErrorTrackingClientKeys'; export * from './ErrorTrackingSettings'; +export * from './ExternalControls'; export * from './ExternalStatusChecks'; export * from './FeatureFlagUserLists'; export * from './FeatureFlags'; +export * from './Features'; +export * from './Flows'; export * from './FreezePeriods'; +export * from './GeoSites'; +export * from './GitLabDuoChat'; export * from './GitlabPages'; export * from './GoProxy'; +export * from './GoogleCloudIntegration'; export * from './Helm'; export * from './Integrations'; export * from './IssueAwardEmojis'; @@ -86,9 +105,11 @@ export * from './IssuesStatistics'; export * from './JobArtifacts'; export * from './Jobs'; export * from './MergeRequestApprovals'; +export * from './MergeRequestApprovalSettings'; export * from './MergeRequestAwardEmojis'; export * from './MergeRequestContextCommits'; export * from './MergeRequestDiscussions'; +export * from './MergeRequestIterationEvents'; export * from './MergeRequestDraftNotes'; export * from './MergeRequestLabelEvents'; export * from './MergeRequestMilestoneEvents'; @@ -121,11 +142,13 @@ export * from './ProjectMarkdownUploads'; export * from './ProjectMembers'; export * from './ProjectMilestones'; export * from './ProjectProtectedEnvironments'; +export * from './ProjectPullMirroring'; export * from './ProjectPushRules'; export * from './ProjectRelationsExport'; export * from './ProjectReleases'; export * from './ProjectRemoteMirrors'; export * from './ProjectRepositoryStorageMoves'; +export * from './ProjectSecuritySettings'; export * from './ProjectSnippetAwardEmojis'; export * from './ProjectSnippetDiscussions'; export * from './ProjectSnippetNotes'; @@ -135,9 +158,10 @@ export * from './ProjectTemplates'; export * from './ProjectTerraformState'; export * from './ProjectVariables'; export * from './ProjectVulnerabilities'; +export * from './ProjectWikiNotes'; export * from './ProjectWikis'; export * from './Projects'; -export * from './ProtectedBranches'; +export * from './ProjectProtectedBranches'; export * from './ProtectedTags'; export * from './ReleaseLinks'; export * from './Repositories'; @@ -150,44 +174,43 @@ export * from './Tags'; export * from './UserStarredMetricsDashboard'; // Groups -export * from './EpicAwardEmojis'; -export * from './EpicDiscussions'; -export * from './EpicIssues'; -export * from './EpicLabelEvents'; -export * from './EpicLinks'; -export * from './EpicNotes'; -export * from './Epics'; export * from './GroupAccessRequests'; export * from './GroupAccessTokens'; export * from './GroupActivityAnalytics'; export * from './GroupBadges'; export * from './GroupCustomAttributes'; -export * from './GroupDORA4Metrics'; +export * from './GroupEnterpriseUsers'; export * from './GroupEpicBoards'; +export * from './GroupDORA4Metrics'; export * from './GroupHooks'; export * from './GroupImportExports'; +export * from './GroupIntegrations'; export * from './GroupInvitations'; export * from './GroupIssueBoards'; export * from './GroupIterations'; export * from './GroupLDAPLinks'; export * from './GroupLabels'; export * from './GroupMarkdownUploads'; +export * from './GroupPlaceholderReassignments'; export * from './GroupMemberRoles'; export * from './GroupMembers'; export * from './GroupMilestones'; +export * from './GroupProtectedBranches'; export * from './GroupProtectedEnvironments'; export * from './GroupPushRules'; export * from './GroupRelationExports'; export * from './GroupReleases'; export * from './GroupRepositoryStorageMoves'; +export * from './GroupSecuritySettings'; +export * from './GroupSSHCertificates'; export * from './GroupSAMLIdentities'; export * from './GroupSAMLLinks'; export * from './GroupSCIMIdentities'; export * from './GroupServiceAccounts'; export * from './GroupVariables'; +export * from './GroupWikiNotes'; export * from './GroupWikis'; export * from './Groups'; -export * from './LinkedEpics'; // Users export * from './UserCustomAttributes'; diff --git a/packages/core/src/templates/ResourceAccessRequests.ts b/packages/core/src/templates/ResourceAccessRequests.ts index 040053fbb..454266400 100644 --- a/packages/core/src/templates/ResourceAccessRequests.ts +++ b/packages/core/src/templates/ResourceAccessRequests.ts @@ -21,8 +21,12 @@ export interface AccessRequestSchema extends Record { username: string; name: string; state: string; + locked?: boolean; + avatar_url?: string; + web_url?: string; created_at: string; requested_at: string; + access_level?: number; } export class ResourceAccessRequests extends BaseResource { diff --git a/packages/core/src/templates/ResourceAccessTokens.ts b/packages/core/src/templates/ResourceAccessTokens.ts index 77808c7ea..23cdaa927 100644 --- a/packages/core/src/templates/ResourceAccessTokens.ts +++ b/packages/core/src/templates/ResourceAccessTokens.ts @@ -23,17 +23,22 @@ export type AccessTokenScopes = | 'read_registry' | 'write_registry' | 'read_repository' - | 'write_repository'; + | 'write_repository' + | 'manage_runners' + | 'admin_runners' + | 'self_rotate'; export interface AccessTokenSchema extends Record { user_id: number; scopes?: AccessTokenScopes[]; name: string; - expires_at: string; + expires_at: string | null; id: number; active: boolean; created_at: string; + description?: string; revoked: boolean; + last_used_at?: string | null; access_level: Exclude< AccessLevel, AccessLevel.NO_ACCESS | AccessLevel.MINIMAL_ACCESS | AccessLevel.ADMIN @@ -69,8 +74,9 @@ export class ResourceAccessTokens extends BaseResourc resourceId: string | number, name: string, scopes: AccessTokenScopes[], - expiresAt: string, options?: { + expiresAt?: string; + description?: string; accessLevel?: Exclude< AccessLevel, AccessLevel.NO_ACCESS | AccessLevel.MINIMAL_ACCESS | AccessLevel.ADMIN @@ -90,7 +96,6 @@ export class ResourceAccessTokens extends BaseResourc ...body, name, scopes, - expiresAt, }, }, ); diff --git a/packages/core/src/templates/ResourceDiscussions.ts b/packages/core/src/templates/ResourceDiscussions.ts index fcf12db06..e658c1193 100644 --- a/packages/core/src/templates/ResourceDiscussions.ts +++ b/packages/core/src/templates/ResourceDiscussions.ts @@ -23,7 +23,7 @@ export interface DiscussionNotePositionBaseSchema extends Record { id: number; diff --git a/packages/core/src/templates/ResourceHooks.ts b/packages/core/src/templates/ResourceHooks.ts index b797dbfb1..b1d52831f 100644 --- a/packages/core/src/templates/ResourceHooks.ts +++ b/packages/core/src/templates/ResourceHooks.ts @@ -27,7 +27,10 @@ export interface HookSchema extends Record { } export interface ExpandedHookSchema extends HookSchema { - push_events_branch_filter: string; + name?: string; + description?: string; + push_events_branch_filter: string | null; + branch_filter_strategy: string; issues_events: boolean; confidential_issues_events: boolean; note_events: boolean; @@ -36,34 +39,67 @@ export interface ExpandedHookSchema extends HookSchema { pipeline_events: boolean; wiki_page_events: boolean; deployment_events: boolean; + feature_flag_events: boolean; releases_events: boolean; + milestone_events: boolean; + subgroup_events?: boolean; + member_events: boolean; + project_events?: boolean; + resource_access_token_events: boolean; + emoji_events?: boolean; alert_status: string; - disabled_until?: string; - url_variables: string[]; + disabled_until?: string | null; + url_variables: unknown[]; + custom_webhook_template?: string; + custom_headers?: { key: string; value?: string }[]; + token_present?: boolean; + signing_token_present?: boolean; } export interface AddResourceHookOptions { - memberEvents?: boolean; - pushEvents?: boolean; - pushEventsBranchFilter?: string; - issuesEvents?: boolean; + name?: string; + description?: string; + branchFilterStrategy?: 'wildcard' | 'regex' | 'all_branches'; confidentialIssuesEvents?: boolean; - mergeRequestsEvents?: boolean; - tagPushEvents?: boolean; - noteEvents?: boolean; confidentialNoteEvents?: boolean; + customHeaders?: { key: string; value?: string }[]; + customWebhookTemplate?: string; + deploymentEvents?: boolean; + enableSslVerification?: boolean; + featureFlagEvents?: boolean; + issuesEvents?: boolean; jobEvents?: boolean; + memberEvents?: boolean; + mergeRequestsEvents?: boolean; + milestoneEvents?: boolean; + noteEvents?: boolean; pipelineEvents?: boolean; - wikiPageEvents?: boolean; - deploymentEvents?: boolean; + projectEvents?: boolean; + pushEvents?: boolean; + pushEventsBranchFilter?: string; releasesEvents?: boolean; + resourceAccessTokenEvents?: boolean; + signingToken?: string; subgroupEvents?: boolean; - enableSslVerification?: boolean; + tagPushEvents?: boolean; token?: string; + wikiPageEvents?: boolean; } export type EditResourceHookOptions = AddResourceHookOptions; +export interface HookEventSchema extends Record { + id: number; + url: string; + trigger: string; + request_headers: Record; + request_data: Record; + response_headers: Record; + response_body: string; + execution_duration: number; + response_status: string; +} + export class ResourceHooks extends BaseResource { constructor(resourceType: string, options: BaseResourceOptions) { super({ prefixUrl: resourceType, ...options }); @@ -145,4 +181,41 @@ export class ResourceHooks extends BaseResource { showExpanded, }); } + + allEvents( + resourceId: string | number, + hookId: number, + options?: { status?: string | number } & PaginationRequestOptions

& ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; + + return RequestHelper.get()( + this, + endpoint`${resourceId}/hooks/${hookId}/events`, + { + sudo, + showExpanded, + maxPages, + searchParams: searchParams as PaginationRequestSearchParams

& PaginationType

, + }, + ); + } + + resendEvent( + resourceId: string | number, + hookId: number, + eventId: number, + options?: ShowExpanded & Sudo, + ): Promise> { + const { sudo, showExpanded } = options || {}; + + return RequestHelper.post<{ response_status: number }>()( + this, + endpoint`${resourceId}/hooks/${hookId}/events/${eventId}/resend`, + { + sudo, + showExpanded, + }, + ); + } } diff --git a/packages/core/src/templates/ResourceInvitations.ts b/packages/core/src/templates/ResourceInvitations.ts index ac66b0de3..eeeca0da4 100644 --- a/packages/core/src/templates/ResourceInvitations.ts +++ b/packages/core/src/templates/ResourceInvitations.ts @@ -22,9 +22,20 @@ export interface InvitationSchema extends Record { invite_email: string; created_at: string; access_level: Exclude; - expires_at: string; - user_name: string; - created_by_name: string; + expires_at?: string | null; + user_name?: string; + created_by_name?: string; +} + +export interface InvitationResponseSchema extends Record { + status: 'success' | 'error'; + message?: Record; + queued_users?: Record; +} + +export interface UpdateInvitationResponseSchema extends Record { + expires_at?: string | null; + access_level: Exclude; } export class ResourceInvitations extends BaseResource { @@ -38,24 +49,29 @@ export class ResourceInvitations extends BaseResource options: { expiresAt?: string; inviteSource?: string; + memberRoleId?: number; tasksToBeDone?: string[]; tasksProjectId?: number; } & OneOf<{ email: string; userId: string }> & ShowExpanded & Sudo, - ): Promise> { + ): Promise> { ensureRequiredParams({ email: options?.email, userId: options?.userId }); const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.post()(this, endpoint`${resourceId}/invitations`, { - sudo, - showExpanded, - body: { - ...body, - accessLevel, + return RequestHelper.post()( + this, + endpoint`${resourceId}/invitations`, + { + sudo, + showExpanded, + body: { + ...body, + accessLevel, + }, }, - }); + ); } all( @@ -85,10 +101,10 @@ export class ResourceInvitations extends BaseResource accessLevel?: Exclude; } & ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded, ...body } = options || {}; - return RequestHelper.put()( + return RequestHelper.put()( this, endpoint`${resourceId}/invitations/${email}`, { @@ -103,16 +119,12 @@ export class ResourceInvitations extends BaseResource resourceId: string | number, email: string, options?: ShowExpanded & Sudo, - ): Promise> { + ): Promise> { const { sudo, showExpanded } = options || {}; - return RequestHelper.del()( - this, - endpoint`${resourceId}/invitations/${email}`, - { - sudo, - showExpanded, - }, - ); + return RequestHelper.del()(this, endpoint`${resourceId}/invitations/${email}`, { + sudo, + showExpanded, + }); } } diff --git a/packages/core/src/templates/ResourceIterations.ts b/packages/core/src/templates/ResourceIterations.ts index 73e4cedc0..42275e00f 100644 --- a/packages/core/src/templates/ResourceIterations.ts +++ b/packages/core/src/templates/ResourceIterations.ts @@ -18,6 +18,7 @@ import { RequestHelper, endpoint } from '../infrastructure'; export interface IterationSchema extends Record { id: number; iid: number; + sequence: number; group_id: number; title: string; description: string; @@ -32,7 +33,9 @@ export interface IterationSchema extends Record { export interface AllIterationsOptions { state?: 'opened' | 'upcoming' | 'current' | 'closed' | 'all'; search?: string; + in?: ('title' | 'cadence_title')[]; includeAncestors?: boolean; + includeDescendants?: boolean; updatedBefore?: string; updatedAfter?: string; } diff --git a/packages/core/src/templates/ResourceLabels.ts b/packages/core/src/templates/ResourceLabels.ts index 8d3049869..873de74d5 100644 --- a/packages/core/src/templates/ResourceLabels.ts +++ b/packages/core/src/templates/ResourceLabels.ts @@ -32,6 +32,7 @@ export interface LabelSchema extends SimpleLabelSchema { subscribed: boolean; priority: number; is_project_label: boolean; + archived?: boolean; } export interface LabelCountSchema extends Record { @@ -50,7 +51,10 @@ export class ResourceLabels extends BaseResource { options: { withCounts: true; includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; search?: string; + archived?: boolean; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -61,7 +65,10 @@ export class ResourceLabels extends BaseResource { resourceId: string | number, options?: { includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; search?: string; + archived?: boolean; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -73,7 +80,10 @@ export class ResourceLabels extends BaseResource { options?: { withCounts?: boolean; includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; search?: string; + archived?: boolean; } & BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & @@ -95,7 +105,8 @@ export class ResourceLabels extends BaseResource { resourceId: string | number, labelName: string, color: string, - options?: { description?: string; priority?: number } & ShowExpanded & Sudo, + options?: { description?: string; priority?: number; archived?: boolean } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...body } = options || {}; @@ -116,6 +127,7 @@ export class ResourceLabels extends BaseResource { options: { description?: string; priority?: number; + archived?: boolean; } & OneOf<{ newName: string; color: string }> & ShowExpanded & Sudo, @@ -168,7 +180,12 @@ export class ResourceLabels extends BaseResource { show( resourceId: string | number, labelId: number | string, - options?: { includeAncestorGroups?: boolean } & ShowExpanded & Sudo, + options?: { + includeAncestorGroups?: boolean; + includeDescendantGroups?: boolean; + onlyGroupLabels?: boolean; + } & ShowExpanded & + Sudo, ): Promise> { const { sudo, showExpanded, ...searchParams } = options || {}; @@ -188,7 +205,7 @@ export class ResourceLabels extends BaseResource { return RequestHelper.post()( this, - endpoint`${resourceId}/issues/${labelId}/subscribe`, + endpoint`${resourceId}/labels/${labelId}/subscribe`, { sudo, showExpanded, @@ -206,7 +223,7 @@ export class ResourceLabels extends BaseResource { return RequestHelper.post()( this, - endpoint`${resourceId}/issues/${labelId}/unsubscribe`, + endpoint`${resourceId}/labels/${labelId}/unsubscribe`, { sudo, showExpanded, diff --git a/packages/core/src/templates/ResourceMarkdownUploads.ts b/packages/core/src/templates/ResourceMarkdownUploads.ts index aa3c75738..1af536bce 100644 --- a/packages/core/src/templates/ResourceMarkdownUploads.ts +++ b/packages/core/src/templates/ResourceMarkdownUploads.ts @@ -26,7 +26,7 @@ export interface MarkdownUploadSchema extends Record { size: number; filename: string; created_at: string; - uploaded_by: MarkdownUploadUserSchema; + uploaded_by: MarkdownUploadUserSchema | null; } export interface MarkdownUploadCreatedSchema extends Record { diff --git a/packages/core/src/templates/ResourceMembers.ts b/packages/core/src/templates/ResourceMembers.ts index 21c41e819..38ba43fc8 100644 --- a/packages/core/src/templates/ResourceMembers.ts +++ b/packages/core/src/templates/ResourceMembers.ts @@ -13,6 +13,7 @@ import type { ShowExpanded, Sudo, } from '../infrastructure'; +import type { SimpleUserSchema } from '../resources/Users'; import { AccessLevel } from '../constants'; import { RequestHelper, endpoint } from '../infrastructure'; @@ -31,17 +32,23 @@ export interface CondensedMemberSchema extends Record { } export interface SimpleMemberSchema extends CondensedMemberSchema { - expires_at: string; + expires_at?: string | null; access_level: Exclude; - email: string; + email?: string; } export interface MemberSchema extends SimpleMemberSchema { - group_saml_identity: { + created_at?: string; + created_by?: SimpleUserSchema; + is_using_seat?: boolean; + group_saml_identity?: { extern_uid: string; provider: string; saml_provider_id: number; - }; + } | null; + group_scim_identity?: { + [key: string]: unknown; + } | null; } export type AddMemberOptions = { @@ -56,6 +63,7 @@ export interface AllMembersOptions { userIds?: number[]; skipUsers?: number[]; showSeatInfo?: boolean; + state?: 'awaiting' | 'active'; } export class ResourceMembers extends BaseResource { diff --git a/packages/core/src/templates/ResourceMilestones.ts b/packages/core/src/templates/ResourceMilestones.ts index 5a1d9c184..f63b46445 100644 --- a/packages/core/src/templates/ResourceMilestones.ts +++ b/packages/core/src/templates/ResourceMilestones.ts @@ -20,11 +20,12 @@ import { RequestHelper, endpoint } from '../infrastructure'; export interface MilestoneSchema extends Record { id: number; iid: number; - project_id: number; + project_id?: number; + group_id?: number; title: string; description: string; due_date?: string; - start_date: string; + start_date?: string; state: string; updated_at: string; created_at: string; @@ -43,9 +44,15 @@ export interface AllMilestonesOptions { state?: string; title?: string; search?: string; + searchTitle?: string; includeParentMilestones?: boolean; + includeAncestors?: boolean; + includeDescendants?: boolean; updatedBefore?: string; updatedAfter?: string; + containingDate?: string; + startDate?: string; + endDate?: string; } export class ResourceMilestones extends BaseResource { diff --git a/packages/core/src/templates/ResourceNotes.ts b/packages/core/src/templates/ResourceNotes.ts index ff7b2b033..ba4060c0d 100644 --- a/packages/core/src/templates/ResourceNotes.ts +++ b/packages/core/src/templates/ResourceNotes.ts @@ -20,16 +20,22 @@ import { SimpleUserSchema } from '../resources/Users'; export interface NoteSchema extends Record { id: number; body: string; - attachment: string | null; + attachment?: string | null; author: MappedOmit; created_at: string; updated_at: string; system: boolean; noteable_id: number; - noteable_type: 'Issue' | 'Snippet' | 'Epic' | 'Commit' | 'MergeRequest'; - noteable_iid: number; - project_id: number; + noteable_type: 'Issue' | 'Snippet' | 'Epic' | 'Commit' | 'MergeRequest' | 'WikiPage::Meta'; + noteable_iid: number | null; + project_id: number | null; resolvable: boolean; + confidential?: boolean; + internal?: boolean; + imported?: boolean; + imported_from?: string; + commands_changes?: Record; + type?: string | null; } export class ResourceNotes extends BaseResource { diff --git a/packages/core/src/templates/ResourceProtectedEnvironments.ts b/packages/core/src/templates/ResourceProtectedEnvironments.ts index c47308abb..677dea005 100644 --- a/packages/core/src/templates/ResourceProtectedEnvironments.ts +++ b/packages/core/src/templates/ResourceProtectedEnvironments.ts @@ -18,19 +18,36 @@ import { AccessLevel } from '../constants'; import { RequestHelper, endpoint } from '../infrastructure'; export interface ProtectedEnvironmentAccessLevelSummarySchema { - access_level: AccessLevel.DEVELOPER | AccessLevel.MAINTAINER | AccessLevel.ADMIN; + id: number; + access_level: AccessLevel.DEVELOPER | AccessLevel.MAINTAINER | AccessLevel.ADMIN | null; access_level_description: string; - user_id?: number; - group_id?: number; + user_id?: number | null; + group_id?: number | null; + group_inheritance_type?: 0 | 1; +} + +export interface ProtectedEnvironmentApprovalRuleSchema { + id: number; + access_level: AccessLevel.DEVELOPER | AccessLevel.MAINTAINER | AccessLevel.ADMIN | null; + access_level_description: string; + user_id?: number | null; + group_id?: number | null; + required_approvals: number; + group_inheritance_type?: 0 | 1; } export interface ProtectedEnvironmentSchema extends Record { name: string; deploy_access_levels?: ProtectedEnvironmentAccessLevelSummarySchema[]; required_approval_count: number; + approval_rules?: ProtectedEnvironmentApprovalRuleSchema[]; } -export type ProtectedEnvironmentAccessLevelEntity = OneOf<{ +export type ProtectedEnvironmentAccessLevelEntity = { + groupInheritanceType?: 0 | 1; + requiredApprovals?: number; + _destroy?: boolean; +} & OneOf<{ userId: number; groupId: number; accessLevel: AccessLevel.DEVELOPER | AccessLevel.MAINTAINER | AccessLevel.ADMIN; diff --git a/packages/core/src/templates/ResourcePushRules.ts b/packages/core/src/templates/ResourcePushRules.ts index 0ac2ee33c..48930bd25 100644 --- a/packages/core/src/templates/ResourcePushRules.ts +++ b/packages/core/src/templates/ResourcePushRules.ts @@ -8,18 +8,22 @@ import { RequestHelper, endpoint } from '../infrastructure'; export interface PushRuleSchema extends Record { id: number; - commit_message_regex: string; - commit_message_negative_regex: string; - branch_name_regex: string; + project_id?: number; + group_id?: number; + commit_message_regex: string | null; + commit_message_negative_regex: string | null; + branch_name_regex: string | null; deny_delete_tag: boolean; created_at: string; member_check: boolean; prevent_secrets: boolean; - author_email_regex: string; - file_name_regex: string; + author_email_regex: string | null; + file_name_regex: string | null; max_file_size: number; - commit_committer_check?: boolean; - reject_unsigned_commits?: boolean; + commit_committer_check?: boolean | null; + commit_committer_name_check: boolean; + reject_unsigned_commits?: boolean | null; + reject_non_dco_commits?: boolean | null; } export interface CreateAndEditPushRuleOptions { @@ -33,7 +37,9 @@ export interface CreateAndEditPushRuleOptions { fileNameRegex?: string; maxFileSize?: number; commitCommitterCheck?: boolean; + commitCommitterNameCheck?: boolean; rejectUnsignedCommits?: boolean; + rejectNonDcoCommits?: boolean; } export class ResourcePushRules extends BaseResource { diff --git a/packages/core/src/templates/ResourceRepositoryStorageMoves.ts b/packages/core/src/templates/ResourceRepositoryStorageMoves.ts index c1dae79f6..f31fbe1dc 100644 --- a/packages/core/src/templates/ResourceRepositoryStorageMoves.ts +++ b/packages/core/src/templates/ResourceRepositoryStorageMoves.ts @@ -79,24 +79,30 @@ export class ResourceRepositoryStorageMoves extends B } schedule( - sourceStorageName: string, - options?: { destinationStorageName?: string } & BaseRequestSearchParams & + options?: { + sourceStorageName?: string; + destinationStorageName?: string; + } & BaseRequestSearchParams & ShowExpanded & Sudo, ): Promise> { - const { sudo, showExpanded, ...body } = options || {}; + const { sudo, showExpanded, sourceStorageName, destinationStorageName, ...body } = + options || {}; const resourceId = body?.[`${this.resourceTypeSingular}Id`] as string | number; const url = resourceId ? endpoint`${this.resourceType}/${resourceId}/repository_storage_moves` : `${this.resourceTypeSingular}_repository_storage_moves`; + // For project-specific moves, only send destinationStorageName + // For bulk moves, only send sourceStorageName + const requestBody = resourceId + ? { destination_storage_name: destinationStorageName } + : { source_storage_name: sourceStorageName }; + return RequestHelper.post()(this, url, { sudo, showExpanded, - body: { - ...body, - sourceStorageName, - }, + body: requestBody, }); } } diff --git a/packages/core/src/templates/ResourceTemplates.ts b/packages/core/src/templates/ResourceTemplates.ts deleted file mode 100644 index c5fcb5a30..000000000 --- a/packages/core/src/templates/ResourceTemplates.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { BaseResourceOptions } from '@gitbeaker/requester-utils'; - -import { BaseResource } from '@gitbeaker/requester-utils'; - -import type { - BaseRequestSearchParams, - GitlabAPIResponse, - PaginationRequestOptions, - PaginationRequestSearchParams, - PaginationType, - PaginationTypes, - ShowExpanded, - Sudo, -} from '../infrastructure'; - -import { RequestHelper, endpoint } from '../infrastructure'; - -export interface TemplateSchema extends Record { - name: string; - content: string; -} - -export class ResourceTemplates extends BaseResource { - constructor(resourceType: string, options: BaseResourceOptions) { - super({ prefixUrl: ['templates', resourceType].join('/'), ...options }); - } - - all( - options?: BaseRequestSearchParams & PaginationRequestOptions

& ShowExpanded & Sudo, - ): Promise> { - process.emitWarning( - 'This API will be deprecated as of Gitlabs v5 API. Please make the switch to "ProjectTemplates".', - 'DeprecationWarning', - ); - - const { sudo, showExpanded, maxPages, ...searchParams } = options || {}; - - return RequestHelper.get()(this, endpoint``, { - sudo, - showExpanded, - maxPages, - searchParams: searchParams as BaseRequestSearchParams & - PaginationRequestSearchParams

& - PaginationType

, - }); - } - - show( - key: string | number, - options?: ShowExpanded & Sudo, - ): Promise> { - process.emitWarning( - 'This API will be deprecated as of Gitlabs v5 API. Please make the switch to "ProjectTemplates".', - 'DeprecationWarning', - ); - - const { sudo, showExpanded } = options || {}; - - return RequestHelper.get()(this, endpoint`${key}`, { - sudo, - showExpanded, - }); - } -} diff --git a/packages/core/src/templates/ResourceVariables.ts b/packages/core/src/templates/ResourceVariables.ts index 58b9c109e..ebd23f231 100644 --- a/packages/core/src/templates/ResourceVariables.ts +++ b/packages/core/src/templates/ResourceVariables.ts @@ -21,7 +21,11 @@ export interface VariableSchema extends Record { value: string; protected: boolean; masked: boolean; + hidden?: boolean; key: string; + environment_scope?: string; + description?: string; + raw?: boolean; } export type VariableFilter = Record<'environment_scope', number | string>; @@ -54,6 +58,7 @@ export class ResourceVariables extends BaseResource { variableType?: VariableType; protected?: boolean; masked?: boolean; + maskedAndHidden?: boolean; environmentScope?: string; description?: string; raw?: boolean; @@ -81,8 +86,9 @@ export class ResourceVariables extends BaseResource { variableType?: VariableType; protected?: boolean; masked?: boolean; + maskedAndHidden?: boolean; environmentScope?: string; - filter: VariableFilter; + filter?: VariableFilter; description?: string; raw?: boolean; } & ShowExpanded & diff --git a/packages/core/src/templates/index.ts b/packages/core/src/templates/index.ts index 3d5ff84ee..572c48eff 100644 --- a/packages/core/src/templates/index.ts +++ b/packages/core/src/templates/index.ts @@ -12,7 +12,6 @@ export * from './ResourceMarkdownUploads'; export * from './ResourceMembers'; export * from './ResourceMilestones'; export * from './ResourceNotes'; -export * from './ResourceTemplates'; export * from './ResourceVariables'; export * from './ResourceWikis'; export * from './ResourceHooks'; diff --git a/packages/core/test/integration/map.ts b/packages/core/test/integration/map.ts index 7e5849d8a..52f5e69f7 100644 --- a/packages/core/test/integration/map.ts +++ b/packages/core/test/integration/map.ts @@ -3,7 +3,6 @@ import { describe, expect, it } from 'vitest'; describe('API Map', () => { it('should return object representing all resources in JSON format', async () => { const keys = [ - 'Agents', 'AlertManagement', 'ApplicationAppearance', 'ApplicationPlanLimits', @@ -13,24 +12,22 @@ describe('API Map', () => { 'AuditEvents', 'Avatar', 'BroadcastMessages', + 'ClusterAgents', 'Composer', 'Conan', - 'DashboardAnnotations', + 'ContainerVirtualRegistry', + 'DataManagement', + 'DatabaseMigrations', 'Debian', 'DependencyProxy', 'DeployKeys', 'DeployTokens', - 'DockerfileTemplates', 'Events', 'Experiments', - 'GeoNodes', - 'GitignoreTemplates', - 'GitLabCIYMLTemplates', 'Import', 'InstanceLevelCICDVariables', 'Keys', 'License', - 'LicenseTemplates', 'Lint', 'Markdown', 'Maven', @@ -65,8 +62,11 @@ describe('API Map', () => { 'FeatureFlags', 'FeatureFlagUserLists', 'FreezePeriods', + 'GeoSites', + 'GitLabDuoChat', 'GitlabPages', 'GoProxy', + 'GoogleCloudIntegration', 'Helm', 'Integrations', 'IssueAwardEmojis', @@ -134,7 +134,7 @@ describe('API Map', () => { 'ProjectVariables', 'ProjectVulnerabilities', 'ProjectWikis', - 'ProtectedBranches', + 'ProjectProtectedBranches', 'ProtectedTags', 'ReleaseLinks', 'Repositories', @@ -145,13 +145,6 @@ describe('API Map', () => { 'SecureFiles', 'Tags', 'UserStarredMetricsDashboard', - 'EpicAwardEmojis', - 'EpicDiscussions', - 'EpicIssues', - 'EpicLabelEvents', - 'EpicLinks', - 'EpicNotes', - 'Epics', 'GroupAccessRequests', 'GroupAccessTokens', 'GroupActivityAnalytics', @@ -160,6 +153,7 @@ describe('API Map', () => { 'GroupDORA4Metrics', 'GroupHooks', 'GroupImportExports', + 'GroupIntegrations', 'GroupInvitations', 'GroupIssueBoards', 'GroupIterations', @@ -169,18 +163,21 @@ describe('API Map', () => { 'GroupMembers', 'GroupMemberRoles', 'GroupMilestones', + 'GroupPlaceholderReassignments', + 'GroupProtectedBranches', 'GroupProtectedEnvironments', 'GroupPushRules', 'GroupRelationExports', 'GroupReleases', 'GroupRepositoryStorageMoves', + 'GroupSecuritySettings', + 'GroupSSHCertificates', 'Groups', 'GroupSAMLIdentities', 'GroupSCIMIdentities', 'GroupServiceAccounts', 'GroupVariables', 'GroupWikis', - 'LinkedEpics', 'UserCustomAttributes', 'UserEmails', 'UserGPGKeys', diff --git a/packages/core/test/unit/resources/AlertManagement.ts b/packages/core/test/unit/resources/AlertManagement.ts index a3fae5c06..8bc5d25a2 100644 --- a/packages/core/test/unit/resources/AlertManagement.ts +++ b/packages/core/test/unit/resources/AlertManagement.ts @@ -68,18 +68,26 @@ describe('Agents.uploadMetricImage', () => { await service.uploadMetricImage(1, 2, image, { urlText: 'text' }); - const expectedFormData = new FormData(); - expectedFormData.append('url_text', 'text'); - expectedFormData.append('file', content, 'image.jpeg'); - expect(RequestHelper.post()).toHaveBeenCalledWith( service, 'projects/1/alert_management_alerts/2/metric_images', - { - body: expectedFormData, + expect.objectContaining({ + body: expect.any(FormData), showExpanded: undefined, sudo: undefined, - }, + }), ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + url_text: 'text', + file: expect.objectContaining({ + type: content.type, + size: content.size, + }), + }); }); }); diff --git a/packages/core/test/unit/resources/ApplicationAppearance.ts b/packages/core/test/unit/resources/ApplicationAppearance.ts index 697c95f20..d9f8170e8 100644 --- a/packages/core/test/unit/resources/ApplicationAppearance.ts +++ b/packages/core/test/unit/resources/ApplicationAppearance.ts @@ -30,7 +30,7 @@ describe('ApplicationAppearance.show', () => { }); describe('ApplicationAppearance.edit', () => { - it('should request PUT /application/appearence without arguments', async () => { + it('should request PUT /application/appearance without arguments', async () => { await service.edit(); expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'application/appearance', { @@ -40,33 +40,57 @@ describe('ApplicationAppearance.edit', () => { }); }); - it('should request PUT /application/appearence with a logo property', async () => { + it('should request PUT /application/appearance with a logo property', async () => { const content = new Blob(['image'], { type: 'image/jpeg' }); await service.edit({ logo: { content, filename: 'test.jpeg' } }); - const expectedFormData = new FormData(); - expectedFormData.append('logo', content, 'test.jpeg'); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'application/appearance', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.put()).toHaveBeenCalledWith( + service, + 'application/appearance', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.put() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + logo: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); - it('should request PUT /application/appearence with a pwaIcon property', async () => { + it('should request PUT /application/appearance with a pwaIcon property', async () => { const content = new Blob(['image'], { type: 'image/jpeg' }); await service.edit({ pwaIcon: { content, filename: 'test.jpeg' } }); - const expectedFormData = new FormData(); - expectedFormData.append('pwa_icon', content, 'test.jpeg'); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'application/appearance', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.put()).toHaveBeenCalledWith( + service, + 'application/appearance', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.put() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + pwa_icon: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); diff --git a/packages/core/test/unit/resources/BroadcastMessages.ts b/packages/core/test/unit/resources/BroadcastMessages.ts index d889fc870..723e61bbd 100644 --- a/packages/core/test/unit/resources/BroadcastMessages.ts +++ b/packages/core/test/unit/resources/BroadcastMessages.ts @@ -33,11 +33,11 @@ describe('BroadcastMessages.all', () => { describe('BroadcastMessages.create', () => { it('should request POST /broadcast_messages', async () => { - await service.create({ prop: 'test epic' }); + await service.create('test epic'); expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'broadcast_messages', { body: { - prop: 'test epic', + message: 'test epic', }, showExpanded: undefined, sudo: undefined, diff --git a/packages/core/test/unit/resources/Agents.ts b/packages/core/test/unit/resources/ClusterAgents.ts similarity index 53% rename from packages/core/test/unit/resources/Agents.ts rename to packages/core/test/unit/resources/ClusterAgents.ts index 8e324e742..c9f8354aa 100644 --- a/packages/core/test/unit/resources/Agents.ts +++ b/packages/core/test/unit/resources/ClusterAgents.ts @@ -1,7 +1,7 @@ import { RequesterFn } from '@gitbeaker/requester-utils'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { Agents } from '../../../src'; +import { ClusterAgents } from '../../../src'; import { RequestHelper } from '../../../src/infrastructure'; vi.mock('../../../src/infrastructure/RequestHelper', async () => { @@ -9,16 +9,16 @@ vi.mock('../../../src/infrastructure/RequestHelper', async () => { return (mock as any).default; }); -let service: Agents; +let service: ClusterAgents; beforeEach(() => { - service = new Agents({ + service = new ClusterAgents({ requesterFn: vi.fn(), token: 'abcdefg', }); }); -describe('Agents.all', () => { +describe('ClusterAgents.all', () => { it('should request GET /projects/1/cluster_agents without options', async () => { await service.all(1); @@ -29,7 +29,7 @@ describe('Agents.all', () => { }); }); -describe('Agents.allTokens', () => { +describe('ClusterAgents.allTokens', () => { it('should request GET /projects/1/cluster_agents/2/tokens without options', async () => { await service.allTokens(1, 2); @@ -41,7 +41,7 @@ describe('Agents.allTokens', () => { }); }); -describe('Agents.createToken', () => { +describe('ClusterAgents.createToken', () => { it('should request POST /projects/1/cluster_agents/2/tokens without options', async () => { await service.createToken(1, 2, 'name'); @@ -73,7 +73,7 @@ describe('Agents.createToken', () => { }); }); -describe('Agents.show', () => { +describe('ClusterAgents.show', () => { it('should request GET /projects/1/cluster_agents/2 without options', async () => { await service.show(1, 2); @@ -84,7 +84,7 @@ describe('Agents.show', () => { }); }); -describe('Agents.showToken', () => { +describe('ClusterAgents.showToken', () => { it('should request GET /projects/1/cluster_agents/2/tokens/3 without options', async () => { await service.showToken(1, 2, 3); @@ -96,7 +96,7 @@ describe('Agents.showToken', () => { }); }); -describe('Agents.register', () => { +describe('ClusterAgents.register', () => { it('should request POST /projects/1/cluster_agents without options', async () => { await service.register(1, 'name'); @@ -108,7 +108,7 @@ describe('Agents.register', () => { }); }); -describe('Agents.unregister', () => { +describe('ClusterAgents.unregister', () => { it('should request DEL /projects/1/cluster_agents/2 without options', async () => { await service.unregister(1, 2); @@ -119,7 +119,7 @@ describe('Agents.unregister', () => { }); }); -describe('Agents.removeToken', () => { +describe('ClusterAgents.removeToken', () => { it('should request DEL /projects/1/cluster_agents/2/tokens/3 without options', async () => { await service.removeToken(1, 2, 3); @@ -130,3 +130,78 @@ describe('Agents.removeToken', () => { ); }); }); + +describe('ClusterAgents.allUrlConfigurations', () => { + it('should request GET /projects/1/cluster_agents/2/url_configurations without options', async () => { + await service.allUrlConfigurations(1, 2); + + expect(RequestHelper.get()).toHaveBeenCalledWith( + service, + 'projects/1/cluster_agents/2/url_configurations', + { showExpanded: undefined, sudo: undefined }, + ); + }); +}); + +describe('ClusterAgents.showUrlConfiguration', () => { + it('should request GET /projects/1/cluster_agents/2/url_configurations/3 without options', async () => { + await service.showUrlConfiguration(1, 2, 3); + + expect(RequestHelper.get()).toHaveBeenCalledWith( + service, + 'projects/1/cluster_agents/2/url_configurations/3', + { showExpanded: undefined, sudo: undefined }, + ); + }); +}); + +describe('ClusterAgents.createUrlConfiguration', () => { + it('should request POST /projects/1/cluster_agents/2/url_configurations without options', async () => { + await service.createUrlConfiguration(1, 2, 'grpcs://agent.example.com:4242'); + + expect(RequestHelper.post()).toHaveBeenCalledWith( + service, + 'projects/1/cluster_agents/2/url_configurations', + { + body: { + url: 'grpcs://agent.example.com:4242', + }, + }, + ); + }); + + it('should request POST /projects/1/cluster_agents/2/url_configurations with mTLS options', async () => { + await service.createUrlConfiguration(1, 2, 'grpcs://agent.example.com:4242', { + clientCert: 'cert-data', + clientKey: 'key-data', + caCert: 'ca-data', + tlsHost: 'agent.example.com', + }); + + expect(RequestHelper.post()).toHaveBeenCalledWith( + service, + 'projects/1/cluster_agents/2/url_configurations', + { + body: { + url: 'grpcs://agent.example.com:4242', + clientCert: 'cert-data', + clientKey: 'key-data', + caCert: 'ca-data', + tlsHost: 'agent.example.com', + }, + }, + ); + }); +}); + +describe('ClusterAgents.deleteUrlConfiguration', () => { + it('should request DEL /projects/1/cluster_agents/2/url_configurations/3 without options', async () => { + await service.deleteUrlConfiguration(1, 2, 3); + + expect(RequestHelper.del()).toHaveBeenCalledWith( + service, + 'projects/1/cluster_agents/2/url_configurations/3', + { showExpanded: undefined, sudo: undefined }, + ); + }); +}); diff --git a/packages/core/test/unit/resources/Conan.ts b/packages/core/test/unit/resources/Conan.ts index f72db78f3..4a80e7d3f 100644 --- a/packages/core/test/unit/resources/Conan.ts +++ b/packages/core/test/unit/resources/Conan.ts @@ -378,17 +378,24 @@ describe('Conan.uploadPackageFile', () => { 'pkgrev', ); - const expectedFormData = new FormData(); - expectedFormData.append('file', content, 'filename'); - expect(RequestHelper.post()).toHaveBeenCalledWith( + expect(RequestHelper.put()).toHaveBeenLastCalledWith( service, 'packages/conan/v1/files/name/v1/user/ch/recrev/package/pkgref/pkgrev/filename', - { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, - }, - ); + expect.objectContaining({ + body: expect.any(FormData), + }), + ); + + // Verify FormData contents + const call = (RequestHelper.put() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + file: expect.objectContaining({ + type: content.type, + size: content.size, + }), + }); }); }); @@ -405,16 +412,23 @@ describe('Conan.uploadRecipeFile', () => { 'recrev', ); - const expectedFormData = new FormData(); - expectedFormData.append('file', content, 'filename'); - expect(RequestHelper.post()).toHaveBeenCalledWith( + expect(RequestHelper.post()).toHaveBeenLastCalledWith( service, 'packages/conan/v1/files/name/v1/user/ch/recrev/export/filename', - { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, - }, - ); + expect.objectContaining({ + body: expect.any(FormData), + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + file: expect.objectContaining({ + type: content.type, + size: content.size, + }), + }); }); }); diff --git a/packages/core/test/unit/resources/DashboardAnnotations.ts b/packages/core/test/unit/resources/DashboardAnnotations.ts deleted file mode 100644 index 1ea18b915..000000000 --- a/packages/core/test/unit/resources/DashboardAnnotations.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { DashboardAnnotations } from '../../../src'; -import { RequestHelper } from '../../../src/infrastructure'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: DashboardAnnotations; - -beforeEach(() => { - service = new DashboardAnnotations({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('DashboardAnnotations.create', () => { - it('should request POST /environments/1/metrics_dashboard/annotations', async () => { - await service.create('path', 'start', 'desc', { environmentId: 1 }); - - expect(RequestHelper.post()).toHaveBeenCalledWith( - service, - 'environments/1/metrics_dashboard/annotations', - { - body: { - dashboardPath: 'path', - startingAt: 'start', - description: 'desc', - }, - showExpanded: undefined, - sudo: undefined, - }, - ); - }); - - it('should request POST /clusters/1/metrics_dashboard/annotations', async () => { - await service.create('path', 'start', 'desc', { clusterId: 1 }); - - expect(RequestHelper.post()).toHaveBeenCalledWith( - service, - 'clusters/1/metrics_dashboard/annotations', - { - body: { - dashboardPath: 'path', - startingAt: 'start', - description: 'desc', - }, - showExpanded: undefined, - sudo: undefined, - }, - ); - }); - - it('should throw an error if environmentId or clusterId isnt passed', () => { - expect(() => service.create('path', 'start', 'desc', {} as any)).toThrow( - 'Missing required argument. Please supply a environmentId or clusterId in the options parameter.', - ); - }); -}); diff --git a/packages/core/test/unit/resources/EpicIssues.ts b/packages/core/test/unit/resources/EpicIssues.ts deleted file mode 100644 index 0f9b82b5e..000000000 --- a/packages/core/test/unit/resources/EpicIssues.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { EpicIssues } from '../../../src'; -import { RequestHelper } from '../../../src/infrastructure'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: EpicIssues; - -beforeEach(() => { - service = new EpicIssues({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('EpicIssues.all', () => { - it('should request GET /groups/:id/epics/:id/issues', async () => { - await service.all(1, 2); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'groups/1/epics/2/issues', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicIssues.edit', () => { - it('should request PUT /groups/:id/epics/:id/issues/:id', async () => { - await service.edit(1, 2, 3, { moveBeforeId: 3 }); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'groups/1/epics/2/issues/3', { - body: { - moveBeforeId: 3, - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicIssues.assign', () => { - it('should request POST /groups/:id/epics/:id/issues/:id', async () => { - await service.assign(1, 2, 3); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'groups/1/epics/2/issues/3', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicIssues.remove', () => { - it('should request DEL /groups/:id/epics/:id/issues/:id', async () => { - await service.remove(1, 2, 3); - - expect(RequestHelper.del()).toHaveBeenCalledWith(service, 'groups/1/epics/2/issues/3', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); diff --git a/packages/core/test/unit/resources/EpicLinks.ts b/packages/core/test/unit/resources/EpicLinks.ts deleted file mode 100644 index a2209c495..000000000 --- a/packages/core/test/unit/resources/EpicLinks.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { EpicLinks } from '../../../src'; -import { RequestHelper } from '../../../src/infrastructure'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: EpicLinks; - -beforeEach(() => { - service = new EpicLinks({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('EpicLinks.all', () => { - it('should request GET /groups/:id/epics/:id/links', async () => { - await service.all(1, 2); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'groups/1/epics/2/links', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicLinks.assign', () => { - it('should request POST /groups/:id/epics/:id/links/:id', async () => { - await service.assign(1, 2, 3); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'groups/1/epics/2/links/3', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicLinks.create', () => { - it('should request POST /groups/:id/epics/:id/links', async () => { - await service.create(1, 2, 'Testing epic links', { confidential: false }); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'groups/1/epics/2/links', { - body: { - confidential: false, - }, - searchParams: { - title: 'Testing epic links', - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicLinks.reorder', () => { - it('should request PUT /groups/:id/epics/:id/links/:id', async () => { - await service.reorder(1, 2, 3, { moveBeforeId: 3, moveAfterId: 1 }); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'groups/1/epics/2/links/3', { - body: { - moveBeforeId: 3, - moveAfterId: 1, - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('EpicLinks.unassign', () => { - it('should request DEL /groups/:id/epics/:id/links/:id', async () => { - await service.unassign(1, 2, 3); - - expect(RequestHelper.del()).toHaveBeenCalledWith(service, 'groups/1/epics/2/links/3', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); diff --git a/packages/core/test/unit/resources/EpicStateEvents.ts b/packages/core/test/unit/resources/EpicStateEvents.ts deleted file mode 100644 index e6106a106..000000000 --- a/packages/core/test/unit/resources/EpicStateEvents.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { RequestHelper } from '../../../src/infrastructure'; -import { EpicStateEvents } from '../../../src/resources/EpicStateEvents'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: EpicStateEvents; - -beforeEach(() => { - service = new EpicStateEvents({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('EpicStateEvents.all', () => { - it('should request GET groups/:id/epics/:epic_id/resource_state_events', async () => { - await service.all(1, 2); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '1/epics/2/resource_state_events', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); - - it('should request GET groups/:id/epics/:epic_id/resource_state_events with options', async () => { - await service.all(1, 2, { sudo: 'admin' }); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '1/epics/2/resource_state_events', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: 'admin', - }); - }); -}); - -describe('EpicStateEvents.show', () => { - it('should request GET groups/:id/epics/:epic_id/resource_state_events/:resource_state_event_id', async () => { - await service.show(1, 2, 3); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '1/epics/2/resource_state_events/3', { - showExpanded: undefined, - sudo: undefined, - }); - }); - - it('should request GET groups/:id/epics/:epic_id/resource_state_events/:resource_state_event_id with options', async () => { - await service.show(1, 2, 3, { sudo: 'admin' }); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '1/epics/2/resource_state_events/3', { - sudo: 'admin', - }); - }); -}); diff --git a/packages/core/test/unit/resources/Epics.ts b/packages/core/test/unit/resources/Epics.ts deleted file mode 100644 index 5238118ba..000000000 --- a/packages/core/test/unit/resources/Epics.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { Epics } from '../../../src'; -import { RequestHelper } from '../../../src/infrastructure'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: Epics; - -beforeEach(() => { - service = new Epics({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('Epics.all', () => { - it('should request GET /groups/:id/epics', async () => { - await service.all(1); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'groups/1/epics', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('Epics.create', () => { - it('should request POST /groups/:id/epics', async () => { - await service.create(1, 'test epic'); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'groups/1/epics', { - body: { - title: 'test epic', - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('Epics.edit', () => { - it('should request PUT /groups/:id/epics', async () => { - await service.edit(1, 2); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'groups/1/epics/2', { - body: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('Epics.show', () => { - it('should request GET /groups/:id/epics/:id', async () => { - await service.show(1, 2); - - expect(RequestHelper.get()).toHaveBeenLastCalledWith(service, 'groups/1/epics/2', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('Epics.remove', () => { - it('should request DEL /groups/:id/epics/:id', async () => { - await service.remove(1, 2); - - expect(RequestHelper.del()).toHaveBeenCalledWith(service, 'groups/1/epics/2', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); diff --git a/packages/core/test/unit/resources/GeoNodes.ts b/packages/core/test/unit/resources/GeoNodes.ts deleted file mode 100644 index 3e62c0b36..000000000 --- a/packages/core/test/unit/resources/GeoNodes.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { beforeEach, describe, expect, it, vi } from 'vitest'; - -import { GeoNodes } from '../../../src'; -import { RequestHelper } from '../../../src/infrastructure'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: GeoNodes; - -beforeEach(() => { - service = new GeoNodes({ - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -describe('GeoNodes.all', () => { - it('should request GET /geo_nodes', async () => { - await service.all(); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'geo_nodes', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.create', () => { - it('should request POST /geo_nodes', async () => { - await service.create('name', 'url'); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'geo_nodes', { - body: { - name: 'name', - url: 'url', - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.edit', () => { - it('should request PUT /geo_nodes/:id', async () => { - await service.edit(1); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'geo_nodes/1', { - body: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); - - it('should request PUT /geo_nodes/:id with options', async () => { - await service.edit(1, { name: 'name', url: 'url' }); - - expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'geo_nodes/1', { - body: { - name: 'name', - url: 'url', - }, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.allFailures', () => { - it('should request POST /geo_nodes/current/failures', async () => { - await service.allFailures(); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'geo_nodes/current/failures', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.repair', () => { - it('should request POST /geo_nodes/:id/repair', async () => { - await service.repair(1); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'geo_nodes/1/repair', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.show', () => { - it('should request GET /geo_nodes/:id', async () => { - await service.show(1); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'geo_nodes/1', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.showStatus', () => { - it('should request GET /geo_nodes/:id/status', async () => { - await service.showStatus(1); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'geo_nodes/1/status', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('GeoNodes.allStatuses', () => { - it('should request GET /geo_nodes/statuses', async () => { - await service.allStatuses(); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'geo_nodes/statuses', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); diff --git a/packages/core/test/unit/resources/GeoSites.ts b/packages/core/test/unit/resources/GeoSites.ts index f7d60e226..74a6c6af2 100644 --- a/packages/core/test/unit/resources/GeoSites.ts +++ b/packages/core/test/unit/resources/GeoSites.ts @@ -70,19 +70,6 @@ describe('GeoSites.edit', () => { }); }); -describe('GeoSites.allFailures', () => { - it('should request POST /geo_sites/current/failures', async () => { - await service.allFailures(); - - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'geo_sites/current/failures', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - describe('GeoSites.repair', () => { it('should request POST /geo_sites/:id/repair', async () => { await service.repair(1); @@ -117,10 +104,10 @@ describe('GeoSites.showStatus', () => { }); describe('GeoSites.allStatuses', () => { - it('should request GET /geo_sites/statuses', async () => { + it('should request GET /geo_sites/status', async () => { await service.allStatuses(); - expect(RequestHelper.get()).toHaveBeenLastCalledWith(service, 'geo_sites/statuses', { + expect(RequestHelper.get()).toHaveBeenLastCalledWith(service, 'geo_sites/status', { maxPages: undefined, searchParams: {}, showExpanded: undefined, diff --git a/packages/core/test/unit/resources/GroupEpicBoards.ts b/packages/core/test/unit/resources/GroupEpicBoards.ts index 14f6a4d21..cf342de4c 100644 --- a/packages/core/test/unit/resources/GroupEpicBoards.ts +++ b/packages/core/test/unit/resources/GroupEpicBoards.ts @@ -40,6 +40,8 @@ describe('GroupEpicBoards.allLists', () => { await service.allLists('5', 6); expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'groups/5/epic_boards/6/lists', { + maxPages: undefined, + searchParams: {}, showExpanded: undefined, sudo: undefined, }); diff --git a/packages/core/test/unit/resources/GroupImportExports.ts b/packages/core/test/unit/resources/GroupImportExports.ts index c7a203ad7..037e77e35 100644 --- a/packages/core/test/unit/resources/GroupImportExports.ts +++ b/packages/core/test/unit/resources/GroupImportExports.ts @@ -45,18 +45,32 @@ describe('GroupImportExport.download', () => { describe('GroupImportExport.import', () => { it('should request POST /groups/import', async () => { const content = new Blob(['content'], { type: 'text/plain' }); + const expectedFile = new File([content], 'test.tar.gz', { type: content.type }); await service.import({ content, filename: 'test.tar.gz' }, 'path', { name: 'test' }); - const expectedFormData = new FormData(); - expectedFormData.append('path', 'path'); - expectedFormData.append('name', 'test'); - expectedFormData.append('file', new File([content], 'test.tar.gz', { type: content.type })); + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + 'groups/import', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'groups/import', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + path: 'path', + name: 'test', + file: expect.objectContaining({ + type: expectedFile.type, + size: expectedFile.size, + name: expectedFile.name, + }), }); }); }); diff --git a/packages/core/test/unit/resources/InstanceLevelCICDVariables.ts b/packages/core/test/unit/resources/InstanceLevelCICDVariables.ts index 0f5795e00..c1496784b 100644 --- a/packages/core/test/unit/resources/InstanceLevelCICDVariables.ts +++ b/packages/core/test/unit/resources/InstanceLevelCICDVariables.ts @@ -23,6 +23,8 @@ describe('InstanceLevelCICDVariables.all', () => { await service.all(); expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'admin/ci/variables', { + maxPages: undefined, + searchParams: {}, showExpanded: undefined, sudo: undefined, }); diff --git a/packages/core/test/unit/resources/Jobs.ts b/packages/core/test/unit/resources/Jobs.ts index 9f1a80850..6c1d98a8d 100644 --- a/packages/core/test/unit/resources/Jobs.ts +++ b/packages/core/test/unit/resources/Jobs.ts @@ -165,6 +165,7 @@ describe('Jobs.cancel', () => { await service.cancel(1, 2); expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'projects/1/jobs/2/cancel', { + searchParams: {}, showExpanded: undefined, sudo: undefined, }); @@ -210,6 +211,7 @@ describe('Jobs.retry', () => { await service.retry(1, 2); expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'projects/1/jobs/2/retry', { + body: {}, showExpanded: undefined, sudo: undefined, }); diff --git a/packages/core/test/unit/resources/PipelineTriggerTokens.ts b/packages/core/test/unit/resources/PipelineTriggerTokens.ts index 8747d1e49..401bb06da 100644 --- a/packages/core/test/unit/resources/PipelineTriggerTokens.ts +++ b/packages/core/test/unit/resources/PipelineTriggerTokens.ts @@ -95,17 +95,24 @@ describe('PipelineTriggerTokens.trigger', () => { it('should request POST /projects/:id/trigger/pipeline', async () => { await service.trigger(1, 'main', 'token', { variables: { PAYLOAD: 'test' } }); - const expectedFormData = new FormData(); - expectedFormData.append('variables[PAYLOAD]', 'test'); - - expect(RequestHelper.get()).toHaveBeenLastCalledWith(service, 'projects/1/trigger/pipeline', { - body: expectedFormData, - searchParams: { - token: 'token', - ref: 'main', - }, - showExpanded: undefined, - sudo: undefined, - }); + expect(RequestHelper.get()).toHaveBeenLastCalledWith( + service, + 'projects/1/trigger/pipeline', + expect.objectContaining({ + body: expect.any(FormData), + searchParams: { + token: 'token', + ref: 'main', + }, + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.get() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ 'variables[PAYLOAD]': 'test' }); }); }); diff --git a/packages/core/test/unit/resources/ProjectImportExports.ts b/packages/core/test/unit/resources/ProjectImportExports.ts index 029471fa4..4f267c991 100644 --- a/packages/core/test/unit/resources/ProjectImportExports.ts +++ b/packages/core/test/unit/resources/ProjectImportExports.ts @@ -54,18 +54,32 @@ describe('ProjectImportExport.showExportStatus', () => { describe('ProjectImportExport.import', () => { it('should request POST /projects/import', async () => { const content = new Blob(['content'], { type: 'text/plain' }); + const expectedFile = new File([content], 'test.tar.gz', { type: content.type }); await service.import({ content, filename: 'test.tar.gz' }, 'path', { name: 'test' }); - const expectedFormData = new FormData(); - expectedFormData.append('name', 'test'); - expectedFormData.append('path', 'path'); - expectedFormData.append('file', new File([content], 'test.tar.gz', { type: content.type })); - - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'projects/import', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + 'projects/import', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + name: 'test', + path: 'path', + file: expect.objectContaining({ + type: expectedFile.type, + size: expectedFile.size, + name: expectedFile.name, + }), }); }); }); diff --git a/packages/core/test/unit/resources/ProjectMarkdownUploads.ts b/packages/core/test/unit/resources/ProjectMarkdownUploads.ts index 54e458447..c25532f69 100644 --- a/packages/core/test/unit/resources/ProjectMarkdownUploads.ts +++ b/packages/core/test/unit/resources/ProjectMarkdownUploads.ts @@ -36,13 +36,25 @@ describe('ProjectMarkdownUploads.create', () => { const file = { content, filename: 'content.txt' }; await service.create('5', file); - const expectedFormData = new FormData(); - expectedFormData.append('file', content, 'content.txt'); - - expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/uploads', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenCalledWith( + service, + '5/uploads', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + file: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); diff --git a/packages/core/test/unit/resources/Projects.ts b/packages/core/test/unit/resources/Projects.ts index 4ee613280..e01020219 100644 --- a/packages/core/test/unit/resources/Projects.ts +++ b/packages/core/test/unit/resources/Projects.ts @@ -183,14 +183,26 @@ describe('Projects.create', () => { const avatar = { content, filename: 'image.jpeg' }; await service.create({ name: 'test proj', avatar }); - const expectedFormData = new FormData(); - expectedFormData.append('name', 'test proj'); - expectedFormData.append('avatar', content, 'image.jpeg'); - - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'projects', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + 'projects', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + name: 'test proj', + avatar: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); diff --git a/packages/core/test/unit/resources/ProtectedBranches.ts b/packages/core/test/unit/resources/ProtectedBranches.ts index 91b25abd2..29dec1092 100644 --- a/packages/core/test/unit/resources/ProtectedBranches.ts +++ b/packages/core/test/unit/resources/ProtectedBranches.ts @@ -1,7 +1,7 @@ import { RequesterFn } from '@gitbeaker/requester-utils'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { ProtectedBranches } from '../../../src'; +import { ProjectProtectedBranches } from '../../../src'; import { RequestHelper } from '../../../src/infrastructure'; vi.mock('../../../src/infrastructure/RequestHelper', async () => { @@ -9,16 +9,16 @@ vi.mock('../../../src/infrastructure/RequestHelper', async () => { return (mock as any).default; }); -let service: ProtectedBranches; +let service: ProjectProtectedBranches; beforeEach(() => { - service = new ProtectedBranches({ + service = new ProjectProtectedBranches({ requesterFn: vi.fn(), token: 'abcdefg', }); }); -describe('ProtectedBranches.all', () => { +describe('ProjectProtectedBranches.all', () => { it('should request GET /projects/:id/protected_branches', async () => { await service.all(1, { search: 'dedde' }); @@ -44,7 +44,7 @@ describe('ProtectedBranches.all', () => { }); }); -describe('ProtectedBranches.create', () => { +describe('ProjectProtectedBranches.create', () => { it('should request POST /projects/:id/protected_branches', async () => { await service.create(1, 'name', { allowForcePush: true }); @@ -57,7 +57,7 @@ describe('ProtectedBranches.create', () => { }); }); -describe('ProtectedBranches.protect', () => { +describe('ProjectProtectedBranches.protect', () => { it('should request POST /projects/:id/protected_branches', async () => { const spy = vi.spyOn(service, 'create'); @@ -67,7 +67,7 @@ describe('ProtectedBranches.protect', () => { }); }); -describe('ProtectedBranches.show', () => { +describe('ProjectProtectedBranches.show', () => { it('should request GET /projects/:id/protected_branches/:branch_name', async () => { await service.show(1, 'name', { sudo: 1 }); @@ -92,7 +92,7 @@ describe('ProtectedBranches.show', () => { }); }); -describe('ProtectedBranches.remove', () => { +describe('ProjectProtectedBranches.remove', () => { it('should request DEL /projects/:id/protected_branches/:branch_name without options', async () => { await service.remove(1, 'name'); @@ -114,7 +114,7 @@ describe('ProtectedBranches.remove', () => { }); }); -describe('ProtectedBranches.unprotect', () => { +describe('ProjectProtectedBranches.unprotect', () => { it('should request DEL /projects/:id/protected_branches/:branch_name without options', async () => { const spy = vi.spyOn(service, 'remove'); diff --git a/packages/core/test/unit/resources/PyPI.ts b/packages/core/test/unit/resources/PyPI.ts index e4eba841c..22ec23448 100644 --- a/packages/core/test/unit/resources/PyPI.ts +++ b/packages/core/test/unit/resources/PyPI.ts @@ -81,12 +81,25 @@ describe('PyPI.uploadPackageFile', () => { await service.uploadPackageFile(1, file); - const expectedFormData = new FormData(); - expectedFormData.append('file', content, 'pkg.txt'); - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'projects/1/packages/pypi', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + 'projects/1/packages/pypi', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + content: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); diff --git a/packages/core/test/unit/resources/Topics.ts b/packages/core/test/unit/resources/Topics.ts index f8fabb249..803c67543 100644 --- a/packages/core/test/unit/resources/Topics.ts +++ b/packages/core/test/unit/resources/Topics.ts @@ -58,13 +58,26 @@ describe('Topics.create', () => { await service.create('topicname', { avatar: { content, filename: 'name.jpeg' } }); - const expectedFormData = new FormData(); - expectedFormData.append('name', 'topicname'); - expectedFormData.append('avatar', content, 'name.jpeg'); - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, 'topics', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + 'topics', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + name: 'topicname', + avatar: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); @@ -85,12 +98,25 @@ describe('Topics.edit', () => { await service.edit(3, { avatar: { content, filename: 'name.jpeg' } }); - const expectedFormData = new FormData(); - expectedFormData.append('avatar', content, 'name.jpeg'); - expect(RequestHelper.put()).toHaveBeenLastCalledWith(service, 'topics/3', { - body: expectedFormData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.put()).toHaveBeenLastCalledWith( + service, + 'topics/3', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.put() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + avatar: expect.objectContaining({ + type: content.type, + size: content.size, + }), }); }); }); diff --git a/packages/core/test/unit/templates/ResourceAccessRequests.ts b/packages/core/test/unit/templates/ResourceAccessRequests.ts index 894a6631c..6d340f18e 100644 --- a/packages/core/test/unit/templates/ResourceAccessRequests.ts +++ b/packages/core/test/unit/templates/ResourceAccessRequests.ts @@ -88,7 +88,7 @@ describe('ResourceAccessRequests.approve', () => { it('should accept the correct access levels', async () => { await service.approve(5, 1, { accessLevel: 20 }); - expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/access_requests/1/approve', { + expect(RequestHelper.put()).toHaveBeenCalledWith(service, '5/access_requests/1/approve', { body: { accessLevel: 20, }, @@ -100,7 +100,7 @@ describe('ResourceAccessRequests.approve', () => { it('should allow for sudo calls', async () => { await service.approve(5, 1, { sudo: 'test' }); - expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/access_requests/1/approve', { + expect(RequestHelper.put()).toHaveBeenCalledWith(service, '5/access_requests/1/approve', { body: {}, showExpanded: undefined, sudo: 'test', diff --git a/packages/core/test/unit/templates/ResourceAccessTokens.ts b/packages/core/test/unit/templates/ResourceAccessTokens.ts index cb855e99b..1c6a8263a 100644 --- a/packages/core/test/unit/templates/ResourceAccessTokens.ts +++ b/packages/core/test/unit/templates/ResourceAccessTokens.ts @@ -56,7 +56,7 @@ describe('ResourceAccessTokens.all', () => { describe('ResourceAccessTokens.create', () => { it('should call the correct url for creating access token with a string identifer', async () => { - await service.create('5', 'test', ['api'], '2021-01-31'); + await service.create('5', 'test', ['api'], { expiresAt: '2021-01-31' }); expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/access_tokens', { body: { @@ -70,7 +70,7 @@ describe('ResourceAccessTokens.create', () => { }); it('should call the correct url for creating access token with a number identifer', async () => { - await service.create(5, 'test', ['api'], '2021-01-31'); + await service.create(5, 'test', ['api'], { expiresAt: '2021-01-31' }); expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/access_tokens', { body: { diff --git a/packages/core/test/unit/templates/ResourceDiscussions.ts b/packages/core/test/unit/templates/ResourceDiscussions.ts index ec5ad17ef..ff9c1ee90 100644 --- a/packages/core/test/unit/templates/ResourceDiscussions.ts +++ b/packages/core/test/unit/templates/ResourceDiscussions.ts @@ -83,21 +83,30 @@ describe('ResourceDiscussions.create', () => { }, }); - const formData = new FormData(); - formData.append('body', 'test'); - formData.append('position[base_sha]', 'sha1'); - formData.append('position[start_sha]', 'sha2'); - formData.append('position[head_sha]', 'sha3'); - formData.append('position[position_type]', 'text'); - formData.append('position[new_line]', '1'); - formData.append('position[new_path]', 'index.js'); - formData.append('position[line_range][start][type]', 'new'); - formData.append('position[line_range][start][line_code]', '1'); - - expect(RequestHelper.post()).toHaveBeenLastCalledWith(service, '1/resource2/2/discussions', { - body: formData, - showExpanded: undefined, - sudo: undefined, + expect(RequestHelper.post()).toHaveBeenLastCalledWith( + service, + '1/resource2/2/discussions', + expect.objectContaining({ + body: expect.any(FormData), + showExpanded: undefined, + sudo: undefined, + }), + ); + + // Verify FormData contents + const call = (RequestHelper.post() as any).mock.calls.slice(-1)[0]; + const formData = call[2].body as FormData; + const formDataObj = Object.fromEntries(formData.entries()); + expect(formDataObj).toEqual({ + body: 'test', + 'position[base_sha]': 'sha1', + 'position[start_sha]': 'sha2', + 'position[head_sha]': 'sha3', + 'position[position_type]': 'text', + 'position[new_line]': '1', + 'position[new_path]': 'index.js', + 'position[line_range][start][type]': 'new', + 'position[line_range][start][line_code]': '1', }); }); }); diff --git a/packages/core/test/unit/templates/ResourceLabels.ts b/packages/core/test/unit/templates/ResourceLabels.ts index c7551e149..b1fc69e1d 100644 --- a/packages/core/test/unit/templates/ResourceLabels.ts +++ b/packages/core/test/unit/templates/ResourceLabels.ts @@ -82,7 +82,7 @@ describe('ResourceLabels.subscribe', () => { it('should call the correct url with a resource id and label id', async () => { await service.subscribe('5', 6); - expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/issues/6/subscribe', { + expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/labels/6/subscribe', { body: {}, showExpanded: undefined, sudo: undefined, @@ -94,7 +94,7 @@ describe('ResourceLabels.unsubscribe', () => { it('should call the correct url with a resource id and label id', async () => { await service.unsubscribe('5', 6); - expect(RequestHelper.del()).toHaveBeenCalledWith(service, '5/issues/6/unsubscribe', { + expect(RequestHelper.post()).toHaveBeenCalledWith(service, '5/labels/6/unsubscribe', { body: {}, showExpanded: undefined, sudo: undefined, diff --git a/packages/core/test/unit/templates/ResourceTemplates.ts b/packages/core/test/unit/templates/ResourceTemplates.ts deleted file mode 100644 index 061b00cfd..000000000 --- a/packages/core/test/unit/templates/ResourceTemplates.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { RequesterFn } from '@gitbeaker/requester-utils'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; - -import { RequestHelper } from '../../../src/infrastructure'; -import { ResourceTemplates } from '../../../src/templates'; - -vi.mock('../../../src/infrastructure/RequestHelper', async () => { - const mock = await vi.importActual('../../__mocks__/RequestHelper'); - return (mock as any).default; -}); - -let service: ResourceTemplates; - -beforeEach(() => { - service = new ResourceTemplates('resource', { - requesterFn: vi.fn(), - token: 'abcdefg', - }); -}); - -afterEach(() => { - vi.clearAllMocks(); -}); - -describe('Instantiating ResourceTemplates service', () => { - it('should create a valid service object', () => { - expect(service).toBeInstanceOf(ResourceTemplates); - expect(service.url).toBeDefined(); - expect(service.url).toContain('resource'); - }); -}); - -describe('ResourceTemplates.all', () => { - it('should call the correct url', async () => { - await service.all(); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '', { - maxPages: undefined, - searchParams: {}, - showExpanded: undefined, - sudo: undefined, - }); - }); -}); - -describe('ResourceTemplates.show', () => { - it('should call the correct url with a resource id', async () => { - await service.show(6); - - expect(RequestHelper.get()).toHaveBeenCalledWith(service, '6', { - showExpanded: undefined, - sudo: undefined, - }); - }); -}); diff --git a/packages/requester-utils/package.json b/packages/requester-utils/package.json index b9d472954..90fccaa1f 100644 --- a/packages/requester-utils/package.json +++ b/packages/requester-utils/package.json @@ -4,7 +4,7 @@ "description": "Utility functions for requester implementatons used in @gitbeaker", "license": "MIT", "engines": { - "node": ">=18.20.0" + "node": ">=v24.16.0" }, "repository": { "type": "git", diff --git a/packages/requester-utils/src/BaseResource.ts b/packages/requester-utils/src/BaseResource.ts index bafe78f80..a81b73c23 100644 --- a/packages/requester-utils/src/BaseResource.ts +++ b/packages/requester-utils/src/BaseResource.ts @@ -91,7 +91,7 @@ export class BaseResource { public readonly requester: RequesterType; - public readonly headers: { [header: string]: string }; + public headers: { [header: string]: string }; public readonly authHeaders: { [authHeader: string]: () => Promise }; diff --git a/packages/rest/package.json b/packages/rest/package.json index 8db5b7f3a..6d866825e 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -4,7 +4,7 @@ "description": "Cross Platform implementation of the GitLab API", "license": "MIT", "engines": { - "node": ">=18.20.0" + "node": ">=v24.16.0" }, "repository": { "type": "git", diff --git a/packages/rest/src/index.ts b/packages/rest/src/index.ts index f9a7c34a6..5116aecf6 100644 --- a/packages/rest/src/index.ts +++ b/packages/rest/src/index.ts @@ -22,8 +22,11 @@ export { AccessLevel }; // Dual Export Pattern: Each class exported as both constructor and instance type -export const { Agents } = API; -export type Agents = CORE.Agents; +export const { ClusterAgents } = API; +export type ClusterAgents = CORE.ClusterAgents; + +export const { AICatalog } = API; +export type AICatalog = CORE.AICatalog; export const { AlertManagement } = API; export type AlertManagement = CORE.AlertManagement; @@ -36,6 +39,8 @@ export type ApplicationPlanLimits = CORE.ApplicationP export const { Applications } = API; export type Applications = CORE.Applications; +export const { Attestations } = API; +export type Attestations = CORE.Attestations; export const { ApplicationSettings } = API; export type ApplicationSettings = CORE.ApplicationSettings; @@ -55,6 +60,9 @@ export type Branches = CORE.Branches; export const { BroadcastMessages } = API; export type BroadcastMessages = CORE.BroadcastMessages; +export const { BulkImports } = API; +export type BulkImports = CORE.BulkImports; + export const { CodeSuggestions } = API; export type CodeSuggestions = CORE.CodeSuggestions; @@ -64,21 +72,47 @@ export type CommitDiscussions = CORE.CommitDiscussion export const { Commits } = API; export type Commits = CORE.Commits; +export const { CompliancePolicySettings } = API; +export type CompliancePolicySettings = CORE.CompliancePolicySettings; + export const { Composer } = API; export type Composer = CORE.Composer; export const { Conan } = API; export type Conan = CORE.Conan; +export const { ConanV2 } = API; +export type ConanV2 = CORE.ConanV2; + +export const { DataManagement } = API; +export type DataManagement = CORE.DataManagement; + +export const { DatabaseMigrations } = API; +export type DatabaseMigrations = CORE.DatabaseMigrations; + export const { ContainerRegistry } = API; export type ContainerRegistry = CORE.ContainerRegistry; -export const { DashboardAnnotations } = API; -export type DashboardAnnotations = CORE.DashboardAnnotations; +export const { ContainerRegistryProtectionTagRules } = API; +export type ContainerRegistryProtectionTagRules = + CORE.ContainerRegistryProtectionTagRules; + +export const { ContainerRepositoryProtectionRules } = API; +export type ContainerRepositoryProtectionRules = + CORE.ContainerRepositoryProtectionRules; + +export const { ContainerVirtualRegistry } = API; +export type ContainerVirtualRegistry = CORE.ContainerVirtualRegistry; export const { Debian } = API; export type Debian = CORE.Debian; +export const { Dependencies } = API; +export type Dependencies = CORE.Dependencies; + +export const { DependencyListExport } = API; +export type DependencyListExport = CORE.DependencyListExport; + export const { DependencyProxy } = API; export type DependencyProxy = CORE.DependencyProxy; @@ -91,39 +125,18 @@ export type DeployTokens = CORE.DeployTokens; export const { Deployments } = API; export type Deployments = CORE.Deployments; -export const { DockerfileTemplates } = API; -export type DockerfileTemplates = CORE.DockerfileTemplates; - export const { Environments } = API; export type Environments = CORE.Environments; -export const { EpicAwardEmojis } = API; -export type EpicAwardEmojis = CORE.EpicAwardEmojis; - -export const { EpicDiscussions } = API; -export type EpicDiscussions = CORE.EpicDiscussions; - -export const { EpicIssues } = API; -export type EpicIssues = CORE.EpicIssues; - -export const { EpicLabelEvents } = API; -export type EpicLabelEvents = CORE.EpicLabelEvents; - -export const { EpicLinks } = API; -export type EpicLinks = CORE.EpicLinks; - -export const { EpicNotes } = API; -export type EpicNotes = CORE.EpicNotes; - -export const { Epics } = API; -export type Epics = CORE.Epics; - export const { ErrorTrackingClientKeys } = API; export type ErrorTrackingClientKeys = CORE.ErrorTrackingClientKeys; export const { ErrorTrackingSettings } = API; export type ErrorTrackingSettings = CORE.ErrorTrackingSettings; +export const { ExternalControls } = API; +export type ExternalControls = CORE.ExternalControls; + export const { Events } = API; export type Events = CORE.Events; @@ -139,20 +152,20 @@ export type FeatureFlags = CORE.FeatureFlags; export const { FeatureFlagUserLists } = API; export type FeatureFlagUserLists = CORE.FeatureFlagUserLists; +export const { Features } = API; +export type Features = CORE.Features; + +export const { Flows } = API; +export type Flows = CORE.Flows; + export const { FreezePeriods } = API; export type FreezePeriods = CORE.FreezePeriods; -export const { GeoNodes } = API; -export type GeoNodes = CORE.GeoNodes; - export const { GeoSites } = API; export type GeoSites = CORE.GeoSites; -export const { GitignoreTemplates } = API; -export type GitignoreTemplates = CORE.GitignoreTemplates; - -export const { GitLabCIYMLTemplates } = API; -export type GitLabCIYMLTemplates = CORE.GitLabCIYMLTemplates; +export const { GitLabDuoChat } = API; +export type GitLabDuoChat = CORE.GitLabDuoChat; export const { GitlabPages } = API; export type GitlabPages = CORE.GitlabPages; @@ -160,6 +173,9 @@ export type GitlabPages = CORE.GitlabPages; export const { GoProxy } = API; export type GoProxy = CORE.GoProxy; +export const { GoogleCloudIntegration } = API; +export type GoogleCloudIntegration = CORE.GoogleCloudIntegration; + export const { GroupAccessRequests } = API; export type GroupAccessRequests = CORE.GroupAccessRequests; @@ -175,18 +191,24 @@ export type GroupBadges = CORE.GroupBadges; export const { GroupCustomAttributes } = API; export type GroupCustomAttributes = CORE.GroupCustomAttributes; -export const { GroupDORA4Metrics } = API; -export type GroupDORA4Metrics = CORE.GroupDORA4Metrics; +export const { GroupEnterpriseUsers } = API; +export type GroupEnterpriseUsers = CORE.GroupEnterpriseUsers; export const { GroupEpicBoards } = API; export type GroupEpicBoards = CORE.GroupEpicBoards; +export const { GroupDORA4Metrics } = API; +export type GroupDORA4Metrics = CORE.GroupDORA4Metrics; + export const { GroupHooks } = API; export type GroupHooks = CORE.GroupHooks; export const { GroupImportExports } = API; export type GroupImportExports = CORE.GroupImportExports; +export const { GroupIntegrations } = API; +export type GroupIntegrations = CORE.GroupIntegrations; + export const { GroupInvitations } = API; export type GroupInvitations = CORE.GroupInvitations; @@ -205,6 +227,10 @@ export type GroupLDAPLinks = CORE.GroupLDAPLinks; export const { GroupMarkdownUploads } = API; export type GroupMarkdownUploads = CORE.GroupMarkdownUploads; +export const { GroupPlaceholderReassignments } = API; +export type GroupPlaceholderReassignments = + CORE.GroupPlaceholderReassignments; + export const { GroupMemberRoles } = API; export type GroupMemberRoles = CORE.GroupMemberRoles; @@ -214,6 +240,9 @@ export type GroupMembers = CORE.GroupMembers; export const { GroupMilestones } = API; export type GroupMilestones = CORE.GroupMilestones; +export const { GroupProtectedBranches } = API; +export type GroupProtectedBranches = CORE.GroupProtectedBranches; + export const { GroupProtectedEnvironments } = API; export type GroupProtectedEnvironments = CORE.GroupProtectedEnvironments; @@ -231,6 +260,12 @@ export const { GroupRepositoryStorageMoves } = API; export type GroupRepositoryStorageMoves = CORE.GroupRepositoryStorageMoves; +export const { GroupSecuritySettings } = API; +export type GroupSecuritySettings = CORE.GroupSecuritySettings; + +export const { GroupSSHCertificates } = API; +export type GroupSSHCertificates = CORE.GroupSSHCertificates; + export const { Groups } = API; export type Groups = CORE.Groups; @@ -249,6 +284,9 @@ export type GroupServiceAccounts = CORE.GroupServiceA export const { GroupVariables } = API; export type GroupVariables = CORE.GroupVariables; +export const { GroupWikiNotes } = API; +export type GroupWikiNotes = CORE.GroupWikiNotes; + export const { GroupWikis } = API; export type GroupWikis = CORE.GroupWikis; @@ -313,11 +351,8 @@ export type Keys = CORE.Keys; export const { License } = API; export type License = CORE.License; -export const { LicenseTemplates } = API; -export type LicenseTemplates = CORE.LicenseTemplates; - -export const { LinkedEpics } = API; -export type LinkedEpics = CORE.LinkedEpics; +export const { Licenses } = API; +export type Licenses = CORE.Licenses; export const { Lint } = API; export type Lint = CORE.Lint; @@ -331,6 +366,10 @@ export type Maven = CORE.Maven; export const { MergeRequestApprovals } = API; export type MergeRequestApprovals = CORE.MergeRequestApprovals; +export const { MergeRequestApprovalSettings } = API; +export type MergeRequestApprovalSettings = + CORE.MergeRequestApprovalSettings; + export const { MergeRequestAwardEmojis } = API; export type MergeRequestAwardEmojis = CORE.MergeRequestAwardEmojis; @@ -370,6 +409,9 @@ export type Metadata = CORE.Metadata; export const { Migrations } = API; export type Migrations = CORE.Migrations; +export const { ModelRegistry } = API; +export type ModelRegistry = CORE.ModelRegistry; + export const { Namespaces } = API; export type Namespaces = CORE.Namespaces; @@ -382,6 +424,15 @@ export type NPM = CORE.NPM; export const { NuGet } = API; export type NuGet = CORE.NuGet; +export const { Orbit } = API; +export type Orbit = CORE.Orbit; + +export const { Organizations } = API; +export type Organizations = CORE.Organizations; + +export const { Pages } = API; +export type Pages = CORE.Pages; + export const { PackageRegistry } = API; export type PackageRegistry = CORE.PackageRegistry; @@ -394,6 +445,9 @@ export type PagesDomains = CORE.PagesDomains; export const { PersonalAccessTokens } = API; export type PersonalAccessTokens = CORE.PersonalAccessTokens; +export const { PipelineTriggers } = API; +export type PipelineTriggers = CORE.PipelineTriggers; + export const { PipelineSchedules } = API; export type PipelineSchedules = CORE.PipelineSchedules; @@ -510,15 +564,21 @@ export type ProjectVariables = CORE.ProjectVariables< export const { ProjectVulnerabilities } = API; export type ProjectVulnerabilities = CORE.ProjectVulnerabilities; +export const { ProjectWikiNotes } = API; +export type ProjectWikiNotes = CORE.ProjectWikiNotes; + export const { ProjectWikis } = API; export type ProjectWikis = CORE.ProjectWikis; -export const { ProtectedBranches } = API; -export type ProtectedBranches = CORE.ProtectedBranches; +export const { ProjectProtectedBranches } = API; +export type ProjectProtectedBranches = CORE.ProjectProtectedBranches; export const { ProtectedTags } = API; export type ProtectedTags = CORE.ProtectedTags; +export const { PlanLimits } = API; +export type PlanLimits = CORE.PlanLimits; + export const { PyPI } = API; export type PyPI = CORE.PyPI; @@ -583,6 +643,9 @@ export type Tags = CORE.Tags; export const { TodoLists } = API; export type TodoLists = CORE.TodoLists; +export const { TerraformModules } = API; +export type TerraformModules = CORE.TerraformModules; + export const { Topics } = API; export type Topics = CORE.Topics; diff --git a/packages/rest/test/e2e/browser/General.ts b/packages/rest/test/e2e/browser/General.ts index 1cac54751..b83b7cb83 100644 --- a/packages/rest/test/e2e/browser/General.ts +++ b/packages/rest/test/e2e/browser/General.ts @@ -9,41 +9,43 @@ describe('Browser Import', () => { 'GitbeakerRetryError', 'GitbeakerTimeoutError', 'AccessLevel', - 'Agents', + 'AICatalog', + 'ClusterAgents', 'AlertManagement', 'ApplicationAppearance', 'ApplicationPlanLimits', 'Applications', + 'Attestations', 'ApplicationSettings', 'ApplicationStatistics', 'AuditEvents', 'Avatar', 'BroadcastMessages', + 'BulkImports', 'CodeSuggestions', 'Composer', 'Conan', - 'DashboardAnnotations', + 'ConanV2', + 'DataManagement', + 'DatabaseMigrations', 'Debian', + 'Dependencies', + 'DependencyListExport', 'DependencyProxy', 'DeployKeys', 'DeployTokens', - 'DockerfileTemplates', 'Events', 'Experiments', - 'GeoNodes', - 'GeoSites', - 'GitignoreTemplates', - 'GitLabCIYMLTemplates', 'Import', 'InstanceLevelCICDVariables', 'Keys', 'License', - 'LicenseTemplates', 'Lint', 'Markdown', 'Maven', 'Metadata', 'Migrations', + 'ModelRegistry', 'Namespaces', 'NotificationSettings', 'NPM', @@ -60,19 +62,27 @@ describe('Browser Import', () => { 'Snippets', 'Suggestions', 'SystemHooks', + 'TerraformModules', 'TodoLists', 'Topics', 'Branches', 'CommitDiscussions', 'Commits', + 'CompliancePolicySettings', 'ContainerRegistry', + 'ContainerRegistryProtectionTagRules', + 'ContainerRepositoryProtectionRules', + 'ContainerVirtualRegistry', 'Deployments', 'Environments', 'ErrorTrackingClientKeys', 'ErrorTrackingSettings', + 'ExternalControls', 'ExternalStatusChecks', 'FeatureFlags', 'FeatureFlagUserLists', + 'Features', + 'Flows', 'FreezePeriods', 'GitlabPages', 'GoProxy', @@ -93,6 +103,7 @@ describe('Browser Import', () => { 'JobArtifacts', 'Jobs', 'MergeRequestApprovals', + 'MergeRequestApprovalSettings', 'MergeRequestAwardEmojis', 'MergeRequestContextCommits', 'MergeRequestDiscussions', @@ -143,8 +154,9 @@ describe('Browser Import', () => { 'ProjectTerraformState', 'ProjectVariables', 'ProjectVulnerabilities', + 'ProjectWikiNotes', 'ProjectWikis', - 'ProtectedBranches', + 'ProjectProtectedBranches', 'ProtectedTags', 'ReleaseLinks', 'Repositories', @@ -156,44 +168,43 @@ describe('Browser Import', () => { 'ServiceAccounts', 'Tags', 'UserStarredMetricsDashboard', - 'EpicAwardEmojis', - 'EpicDiscussions', - 'EpicIssues', - 'EpicLabelEvents', - 'EpicLinks', - 'EpicNotes', - 'Epics', 'GroupAccessRequests', 'GroupAccessTokens', 'GroupActivityAnalytics', 'GroupBadges', 'GroupCustomAttributes', - 'GroupDORA4Metrics', + 'GroupEnterpriseUsers', 'GroupEpicBoards', + 'GroupDORA4Metrics', 'GroupHooks', 'GroupImportExports', + 'GroupIntegrations', 'GroupInvitations', 'GroupIssueBoards', 'GroupIterations', 'GroupLabels', 'GroupMarkdownUploads', + 'GroupPlaceholderReassignments', 'GroupLDAPLinks', 'GroupMembers', 'GroupMemberRoles', 'GroupMilestones', + 'GroupProtectedBranches', 'GroupProtectedEnvironments', 'GroupPushRules', 'GroupRelationExports', 'GroupReleases', 'GroupRepositoryStorageMoves', + 'GroupSecuritySettings', + 'GroupSSHCertificates', 'Groups', 'GroupSAMLIdentities', 'GroupSAMLLinks', 'GroupSCIMIdentities', 'GroupServiceAccounts', 'GroupVariables', + 'GroupWikiNotes', 'GroupWikis', - 'LinkedEpics', 'UserCustomAttributes', 'UserEmails', 'UserGPGKeys', diff --git a/packages/rest/test/integration/browser/General.ts b/packages/rest/test/integration/browser/General.ts index 13ed961d6..db8c2c4f9 100644 --- a/packages/rest/test/integration/browser/General.ts +++ b/packages/rest/test/integration/browser/General.ts @@ -22,23 +22,20 @@ describe('Browser Import', () => { 'CodeSuggestions', 'Composer', 'Conan', - 'DashboardAnnotations', + 'DataManagement', + 'DatabaseMigrations', 'Debian', 'DependencyProxy', 'DeployKeys', 'DeployTokens', - 'DockerfileTemplates', 'Events', 'Experiments', - 'GeoNodes', 'GeoSites', - 'GitignoreTemplates', - 'GitLabCIYMLTemplates', + 'GitLabDuoChat', 'Import', 'InstanceLevelCICDVariables', 'Keys', 'License', - 'LicenseTemplates', 'Lint', 'Markdown', 'Maven', @@ -66,6 +63,7 @@ describe('Browser Import', () => { 'CommitDiscussions', 'Commits', 'ContainerRegistry', + 'ContainerVirtualRegistry', 'Deployments', 'Environments', 'ErrorTrackingClientKeys', @@ -76,6 +74,7 @@ describe('Browser Import', () => { 'FreezePeriods', 'GitlabPages', 'GoProxy', + 'GoogleCloudIntegration', 'Helm', 'Integrations', 'IssueAwardEmojis', @@ -144,7 +143,7 @@ describe('Browser Import', () => { 'ProjectVariables', 'ProjectVulnerabilities', 'ProjectWikis', - 'ProtectedBranches', + 'ProjectProtectedBranches', 'ProtectedTags', 'ReleaseLinks', 'Repositories', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 47c06f60d..938f9f6f3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,11 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - lodash: '>=4.18.1' - tar: ^7.5.13 - undici: '>=8.0.2' - importers: .: @@ -513,6 +508,10 @@ packages: resolution: {integrity: sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} + '@fastify/busboy@2.1.1': + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + '@gitbeaker/core@43.8.0': resolution: {integrity: sha512-H+LfKuf4dExBinb79c+CXViRBvTVQNf5BYLNSizm2SiqdED5JruhKX88payefleY0szp7G/mySlFSXPyGRH1dQ==} engines: {node: '>=18.20.0'} @@ -1443,7 +1442,7 @@ packages: resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} all-contributors-cli@https://codeload.github.com/jdalrymple/all-contributors-cli/tar.gz/7ecc1a0f36b91fe5e3face34e5217f3db2b0359b: - resolution: {tarball: https://codeload.github.com/jdalrymple/all-contributors-cli/tar.gz/7ecc1a0f36b91fe5e3face34e5217f3db2b0359b} + resolution: {gitHosted: true, integrity: sha512-fhfyotpoUYMeCRGwR6xh7wiNFqc5Tqt+3Avx6BakX+FPUvktqeeNzWmbQNCr2iKvCb6JKaJ7ksKaQ1Q+j/aX/g==, tarball: https://codeload.github.com/jdalrymple/all-contributors-cli/tar.gz/7ecc1a0f36b91fe5e3face34e5217f3db2b0359b} version: 0.0.0-semantically-released engines: {node: '>=22'} hasBin: true @@ -2883,9 +2882,9 @@ packages: undici-types@7.16.0: resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} - undici@8.0.2: - resolution: {integrity: sha512-B9MeU5wuFhkFAuNeA19K2GDFcQXZxq33fL0nRy2Aq30wdufZbyyvxW3/ChaeipXVfy/wUweZyzovQGk39+9k2w==} - engines: {node: '>=22.19.0'} + undici@5.29.0: + resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==} + engines: {node: '>=14.0'} universal-user-agent@6.0.1: resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} @@ -3103,12 +3102,12 @@ snapshots: '@octokit/plugin-rest-endpoint-methods': 10.4.1(@octokit/core@5.2.2) '@octokit/request': 8.4.1 '@octokit/request-error': 5.1.1 - undici: 8.0.2 + undici: 5.29.0 '@actions/http-client@2.2.3': dependencies: tunnel: 0.0.6 - undici: 8.0.2 + undici: 5.29.0 '@actions/io@1.1.3': {} @@ -3461,6 +3460,8 @@ snapshots: '@eslint/core': 1.2.1 levn: 0.4.1 + '@fastify/busboy@2.1.1': {} + '@gitbeaker/core@43.8.0': dependencies: '@gitbeaker/requester-utils': 43.8.0 @@ -5620,7 +5621,9 @@ snapshots: undici-types@7.16.0: {} - undici@8.0.2: {} + undici@5.29.0: + dependencies: + '@fastify/busboy': 2.1.1 universal-user-agent@6.0.1: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 4340350e1..20e9762bc 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,6 @@ packages: - - 'packages/*' \ No newline at end of file + - 'packages/*' +allowBuilds: + '@swc/core': true + esbuild: true + nx: false