diff --git a/bun.lockb b/bun.lockb index 90e7630b..04d31388 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package-lock.json b/package-lock.json index c5b485b6..16079a44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.4.1", "license": "MIT", "dependencies": { - "@neondatabase/api-client": "1.10.0", + "@neondatabase/api-client": "1.11.1", "@segment/analytics-node": "^1.0.0-beta.26", "axios": "^1.4.0", "axios-debug-log": "^1.0.0", @@ -931,12 +931,12 @@ } }, "node_modules/@neondatabase/api-client": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@neondatabase/api-client/-/api-client-1.10.0.tgz", - "integrity": "sha512-bVl0J/L5Io8uxJsNEMKJq2r0LoNeMWwR41xk4wBSv4kHIU6rGJSvCFe7ep/35Xo/c88/cnV2jeMXmN0KpaxYGQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@neondatabase/api-client/-/api-client-1.11.1.tgz", + "integrity": "sha512-fV+gcTtQSLEvziAYa+6LSM7DpMy6bZ5zt2bWAegq87b4VSo62fhNGGm/tBsfKX0G7kkN48V0jJr0OI1L+/d5Qg==", "license": "MIT", "dependencies": { - "axios": "^1.6.0" + "axios": "^1.7.9" } }, "node_modules/@nodelib/fs.scandir": { @@ -2557,7 +2557,9 @@ } }, "node_modules/axios": { - "version": "1.7.2", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", diff --git a/package.json b/package.json index fd404927..29a60a88 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "vitest": "^1.6.0" }, "dependencies": { - "@neondatabase/api-client": "1.10.0", + "@neondatabase/api-client": "1.11.1", "@segment/analytics-node": "^1.0.0-beta.26", "axios": "^1.4.0", "axios-debug-log": "^1.0.0", diff --git a/src/commands/bootstrap/index.ts b/src/commands/bootstrap/index.ts index 153485d1..f94473f1 100644 --- a/src/commands/bootstrap/index.ts +++ b/src/commands/bootstrap/index.ts @@ -244,7 +244,9 @@ async function deployApp({ }) { let { data: { branches }, - } = await props.apiClient.listProjectBranches(project.id); + } = await props.apiClient.listProjectBranches({ + projectId: project.id, + }); branches = branches.filter((branch) => branch.name !== devBranchName); diff --git a/src/commands/branches.ts b/src/commands/branches.ts index d9d04ead..6400be86 100644 --- a/src/commands/branches.ts +++ b/src/commands/branches.ts @@ -258,7 +258,9 @@ export const handler = (args: yargs.Argv) => { }; const list = async (props: ProjectScopeProps) => { - const { data } = await props.apiClient.listProjectBranches(props.projectId); + const { data } = await props.apiClient.listProjectBranches({ + projectId: props.projectId, + }); writer(props).end(data.branches, { fields: BRANCH_FIELDS, }); @@ -278,7 +280,7 @@ const create = async ( }, ) => { const branches = await props.apiClient - .listProjectBranches(props.projectId) + .listProjectBranches({ projectId: props.projectId }) .then(({ data }) => data.branches); const parentProps = (() => { diff --git a/src/commands/schema_diff.ts b/src/commands/schema_diff.ts index 49268e72..fbf68d16 100644 --- a/src/commands/schema_diff.ts +++ b/src/commands/schema_diff.ts @@ -119,7 +119,6 @@ const fetchSchema = async ( projectId: props.projectId, branchId: pointInTime.branchId, db_name: database.name, - role: database.owner_name, ...pointInTimeParams(pointInTime), }) .then((response) => response.data.sql ?? ''); @@ -188,9 +187,9 @@ export const parseSchemaDiffParams = async (props: SchemaDiffProps) => { props.compareSource = props.baseBranch; props.baseBranch = props.branch; } else if (props.branch) { - const { data } = await props.apiClient.listProjectBranches( - props.projectId, - ); + const { data } = await props.apiClient.listProjectBranches({ + projectId: props.projectId, + }); const contextBranch = data.branches.find( (b) => b.id === props.branch || b.name === props.branch, ); @@ -206,9 +205,9 @@ export const parseSchemaDiffParams = async (props: SchemaDiffProps) => { ); props.compareSource = '^parent'; } else { - const { data } = await props.apiClient.listProjectBranches( - props.projectId, - ); + const { data } = await props.apiClient.listProjectBranches({ + projectId: props.projectId, + }); const defaultBranch = data.branches.find((b) => b.default); if (defaultBranch?.parent_id == undefined) { diff --git a/src/parameters.gen.ts b/src/parameters.gen.ts index fbc79bf8..64b4becb 100644 --- a/src/parameters.gen.ts +++ b/src/parameters.gen.ts @@ -36,14 +36,34 @@ export const projectCreateRequest = { description: "If true, the list will be applied only to protected branches.", demandOption: false, }, - 'project.settings.allowed_ips.primary_branch_only': { + 'project.settings.enable_logical_replication': { type: "boolean", - description: "DEPRECATED: Use `protected_branches_only`.\nIf true, the list will be applied only to the default branch.\n", + description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n", demandOption: false, }, - 'project.settings.enable_logical_replication': { + 'project.settings.maintenance_window.weekdays': { + type: "array", + description: "A list of weekdays when the maintenance window is active.\nEncoded as ints, where 1 - Monday, and 7 - Sunday.\n", + demandOption: true, + }, + 'project.settings.maintenance_window.start_time': { + type: "string", + description: "Start time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n", + demandOption: true, + }, + 'project.settings.maintenance_window.end_time': { + type: "string", + description: "End time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n", + demandOption: true, + }, + 'project.settings.block_public_connections': { type: "boolean", - description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n", + description: "When set, connections from the public internet\nare disallowed. This supersedes the AllowedIPs list.\n(IN DEVELOPMENT - NOT AVAILABLE YET)\n", + demandOption: false, + }, + 'project.settings.block_vpc_connections': { + type: "boolean", + description: "When set, connections using VPC endpoints\nare disallowed.\n(IN DEVELOPMENT - NOT AVAILABLE YET)\n", demandOption: false, }, 'project.name': { @@ -53,24 +73,23 @@ export const projectCreateRequest = { }, 'project.branch.name': { type: "string", - description: "The branch name. If not specified, the default branch name will be used.\n", + description: "The default branch name. If not specified, the default branch name, `main`, will be used.\n", demandOption: false, }, 'project.branch.role_name': { type: "string", - description: "The role name. If not specified, the default role name will be used.\n", + description: "The role name. If not specified, the default role name, `{database_name}_owner`, will be used.\n", demandOption: false, }, 'project.branch.database_name': { type: "string", - description: "The database name. If not specified, the default database name will be used.\n", + description: "The database name. If not specified, the default database name, `neondb`, will be used.\n", demandOption: false, }, 'project.provisioner': { type: "string", - description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n", + description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n", demandOption: false, - choices: ["k8s-pod","k8s-neonvm"], }, 'project.region_id': { type: "string", @@ -84,7 +103,7 @@ export const projectCreateRequest = { }, 'project.pg_version': { type: "number", - description: "The major Postgres version number. Currently supported versions are `14`, `15`, and `16`.", + description: "The major Postgres version number. Currently supported versions are `14`, `15`, `16`, and `17`.", demandOption: false, }, 'project.store_passwords': { @@ -94,7 +113,7 @@ export const projectCreateRequest = { }, 'project.history_retention_seconds': { type: "number", - description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n", + description: "The number of seconds to retain the shared history for all branches in this project.\nThe default is 1 day (86400 seconds).\n", demandOption: false, }, 'project.org_id': { @@ -140,14 +159,34 @@ export const projectUpdateRequest = { description: "If true, the list will be applied only to protected branches.", demandOption: false, }, - 'project.settings.allowed_ips.primary_branch_only': { + 'project.settings.enable_logical_replication': { type: "boolean", - description: "DEPRECATED: Use `protected_branches_only`.\nIf true, the list will be applied only to the default branch.\n", + description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n", demandOption: false, }, - 'project.settings.enable_logical_replication': { + 'project.settings.maintenance_window.weekdays': { + type: "array", + description: "A list of weekdays when the maintenance window is active.\nEncoded as ints, where 1 - Monday, and 7 - Sunday.\n", + demandOption: true, + }, + 'project.settings.maintenance_window.start_time': { + type: "string", + description: "Start time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n", + demandOption: true, + }, + 'project.settings.maintenance_window.end_time': { + type: "string", + description: "End time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n", + demandOption: true, + }, + 'project.settings.block_public_connections': { type: "boolean", - description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n", + description: "When set, connections from the public internet\nare disallowed. This supersedes the AllowedIPs list.\n(IN DEVELOPMENT - NOT AVAILABLE YET)\n", + demandOption: false, + }, + 'project.settings.block_vpc_connections': { + type: "boolean", + description: "When set, connections using VPC endpoints\nare disallowed.\n(IN DEVELOPMENT - NOT AVAILABLE YET)\n", demandOption: false, }, 'project.name': { @@ -162,7 +201,7 @@ export const projectUpdateRequest = { }, 'project.history_retention_seconds': { type: "number", - description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n", + description: "The number of seconds to retain the shared history for all branches in this project.\nThe default is 1 day (604800 seconds).\n", demandOption: false, }, } as const; @@ -198,6 +237,17 @@ export const branchCreateRequest = { description: "Whether the branch is protected\n", demandOption: false, }, + 'branch.archived': { + type: "boolean", + description: "Whether to create the branch as archived\n", + demandOption: false, + }, + 'branch.schema_initialization_type': { + type: "string", + description: "The type of schema initialization. Defines how the schema is initialized, currently only empty is supported. This parameter is under\nactive development and may change its semantics in the future.\n", + demandOption: false, + choices: ["empty"], + }, } as const; export const branchCreateRequestEndpointOptions = { @@ -209,9 +259,8 @@ export const branchCreateRequestEndpointOptions = { }, 'provisioner': { type: "string", - description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n", + description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n", demandOption: false, - choices: ["k8s-pod","k8s-neonvm"], }, 'suspend_timeout_seconds': { type: "number", @@ -252,9 +301,8 @@ export const endpointCreateRequest = { }, 'endpoint.provisioner': { type: "string", - description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n", + description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n", demandOption: false, - choices: ["k8s-pod","k8s-neonvm"], }, 'endpoint.pooler_enabled': { type: "boolean", @@ -287,14 +335,13 @@ export const endpointCreateRequest = { export const endpointUpdateRequest = { 'endpoint.branch_id': { type: "string", - description: "The destination branch ID. The destination branch must not have an exsiting read-write endpoint.\n", + description: "DEPRECATED: This field will be removed in a future release.\nThe destination branch ID. The destination branch must not have an exsiting read-write endpoint.\n", demandOption: false, }, 'endpoint.provisioner': { type: "string", - description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n", + description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n", demandOption: false, - choices: ["k8s-pod","k8s-neonvm"], }, 'endpoint.pooler_enabled': { type: "boolean", diff --git a/src/utils/enrichers.ts b/src/utils/enrichers.ts index 2397ca49..274e1779 100644 --- a/src/utils/enrichers.ts +++ b/src/utils/enrichers.ts @@ -15,7 +15,9 @@ export const branchIdResolve = async ({ return branch; } - const { data } = await apiClient.listProjectBranches(projectId); + const { data } = await apiClient.listProjectBranches({ + projectId, + }); const branchData = data.branches.find((b) => b.name === branch); if (!branchData) { throw new Error( @@ -41,7 +43,9 @@ export const branchIdFromProps = async (props: BranchScopeProps) => { }); } - const { data } = await props.apiClient.listProjectBranches(props.projectId); + const { data } = await props.apiClient.listProjectBranches({ + projectId: props.projectId, + }); const defaultBranch = data.branches.find((b) => b.default); if (defaultBranch) {