@neondatabase/config 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE.md +178 -0
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +8 -0
  4. package/dist/lib/auth.d.ts +63 -0
  5. package/dist/lib/auth.d.ts.map +1 -0
  6. package/dist/lib/auth.js +93 -0
  7. package/dist/lib/auth.js.map +1 -0
  8. package/dist/lib/define-config.d.ts +43 -0
  9. package/dist/lib/define-config.d.ts.map +1 -0
  10. package/dist/lib/define-config.js +111 -0
  11. package/dist/lib/define-config.js.map +1 -0
  12. package/dist/lib/diff.d.ts +109 -0
  13. package/dist/lib/diff.d.ts.map +1 -0
  14. package/dist/lib/diff.js +205 -0
  15. package/dist/lib/diff.js.map +1 -0
  16. package/dist/lib/duration.d.ts +46 -0
  17. package/dist/lib/duration.d.ts.map +1 -0
  18. package/dist/lib/duration.js +96 -0
  19. package/dist/lib/duration.js.map +1 -0
  20. package/dist/lib/errors.d.ts +129 -0
  21. package/dist/lib/errors.d.ts.map +1 -0
  22. package/dist/lib/errors.js +168 -0
  23. package/dist/lib/errors.js.map +1 -0
  24. package/dist/lib/loader.d.ts +44 -0
  25. package/dist/lib/loader.d.ts.map +1 -0
  26. package/dist/lib/loader.js +119 -0
  27. package/dist/lib/loader.js.map +1 -0
  28. package/dist/lib/neon-api-real.d.ts +45 -0
  29. package/dist/lib/neon-api-real.d.ts.map +1 -0
  30. package/dist/lib/neon-api-real.js +582 -0
  31. package/dist/lib/neon-api-real.js.map +1 -0
  32. package/dist/lib/neon-api.d.ts +262 -0
  33. package/dist/lib/neon-api.d.ts.map +1 -0
  34. package/dist/lib/neon-api.js +1 -0
  35. package/dist/lib/patterns.d.ts +43 -0
  36. package/dist/lib/patterns.d.ts.map +1 -0
  37. package/dist/lib/patterns.js +76 -0
  38. package/dist/lib/patterns.js.map +1 -0
  39. package/dist/lib/schema.d.ts +109 -0
  40. package/dist/lib/schema.d.ts.map +1 -0
  41. package/dist/lib/schema.js +199 -0
  42. package/dist/lib/schema.js.map +1 -0
  43. package/dist/lib/types.d.ts +259 -0
  44. package/dist/lib/types.d.ts.map +1 -0
  45. package/dist/lib/types.js +1 -0
  46. package/dist/lib/wrap-neon-error.d.ts +30 -0
  47. package/dist/lib/wrap-neon-error.d.ts.map +1 -0
  48. package/dist/lib/wrap-neon-error.js +139 -0
  49. package/dist/lib/wrap-neon-error.js.map +1 -0
  50. package/dist/v1.d.ts +132 -0
  51. package/dist/v1.d.ts.map +1 -0
  52. package/dist/v1.js +69 -0
  53. package/dist/v1.js.map +1 -0
  54. package/package.json +67 -17
  55. package/.env.example +0 -5
  56. package/e2e/errors.e2e.test.ts +0 -52
  57. package/e2e/helpers.ts +0 -205
  58. package/e2e/load-env.ts +0 -29
  59. package/e2e/setup.ts +0 -24
  60. package/src/index.ts +0 -5
  61. package/src/lib/auth.test.ts +0 -166
  62. package/src/lib/auth.ts +0 -124
  63. package/src/lib/define-config.test.ts +0 -161
  64. package/src/lib/define-config.ts +0 -152
  65. package/src/lib/diff.test.ts +0 -142
  66. package/src/lib/diff.ts +0 -391
  67. package/src/lib/duration.test.ts +0 -105
  68. package/src/lib/duration.ts +0 -147
  69. package/src/lib/errors.test.ts +0 -26
  70. package/src/lib/errors.ts +0 -220
  71. package/src/lib/fake-neon-api.ts +0 -782
  72. package/src/lib/loader.test.ts +0 -35
  73. package/src/lib/loader.ts +0 -215
  74. package/src/lib/neon-api-real.test.ts +0 -72
  75. package/src/lib/neon-api-real.ts +0 -1123
  76. package/src/lib/neon-api.ts +0 -356
  77. package/src/lib/patterns.test.ts +0 -80
  78. package/src/lib/patterns.ts +0 -98
  79. package/src/lib/schema.test.ts +0 -88
  80. package/src/lib/schema.ts +0 -252
  81. package/src/lib/test-utils.ts +0 -83
  82. package/src/lib/types.ts +0 -268
  83. package/src/lib/wrap-neon-error.test.ts +0 -145
  84. package/src/lib/wrap-neon-error.ts +0 -204
  85. package/src/v1.test.ts +0 -33
  86. package/src/v1.ts +0 -148
  87. package/tsconfig.json +0 -4
  88. package/tsdown.config.ts +0 -19
  89. package/vitest.config.ts +0 -19
  90. package/vitest.e2e.config.ts +0 -29
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neon-api-real.js","names":[],"sources":["../../src/lib/neon-api-real.ts"],"sourcesContent":["import {\n\ttype Branch,\n\ttype BranchCreateRequest,\n\ttype BranchCreateRequestEndpointOptions,\n\ttype BranchUpdateRequest,\n\tcreateApiClient,\n\ttype Database,\n\ttype DefaultEndpointSettings,\n\ttype Endpoint,\n\tEndpointType,\n\ttype EndpointUpdateRequest,\n\ttype PgVersion,\n\ttype Project,\n\ttype ProjectCreateRequest,\n\ttype ProjectListItem,\n\ttype ProjectUpdateRequest,\n\ttype Role,\n} from \"@neondatabase/api-client\";\nimport { z } from \"zod\";\nimport { formatSuspendTimeout, parseSuspendTimeout } from \"./duration.js\";\nimport { ErrorCode, PlatformError } from \"./errors.js\";\nimport type {\n\tCreateBranchInput,\n\tCreateBucketInput,\n\tCreateProjectInput,\n\tDeployFunctionInput,\n\tGetConnectionUriInput,\n\tNeonApi,\n\tNeonAuthSnapshot,\n\tNeonBranchSnapshot,\n\tNeonBucketSnapshot,\n\tNeonDataApiSnapshot,\n\tNeonDatabaseSnapshot,\n\tNeonEndpointSnapshot,\n\tNeonFunctionDeploymentSnapshot,\n\tNeonFunctionSnapshot,\n\tNeonProjectSnapshot,\n\tNeonRoleSnapshot,\n\tUpdateBranchInput,\n} from \"./neon-api.js\";\nimport type { BucketAccessLevel, ComputeSettings } from \"./types.js\";\nimport { wrapNeonError } from \"./wrap-neon-error.js\";\n\ntype ApiClient = ReturnType<typeof createApiClient>;\nconst DEFAULT_NEON_API_BASE_URL = \"https://console.neon.tech/api/v2\";\n\nconst neonAuthResponseSchema = z.object({\n\tauth_provider_project_id: z.string(),\n\tpub_client_key: z.string().optional(),\n\tsecret_server_key: z.string().optional(),\n\tjwks_url: z.string(),\n\tbase_url: z.string().optional(),\n});\n\n// ─── Preview: buckets ──────────────────────────────────────────────────────\n\nconst bucketSchema = z.object({\n\tname: z.string(),\n\taccess_level: z.string().optional(),\n});\nconst bucketResponseSchema = z.object({ bucket: bucketSchema });\nconst bucketsListResponseSchema = z.object({ buckets: z.array(bucketSchema) });\n\n// ─── Preview: functions ────────────────────────────────────────────────────\n\nconst functionDeploymentSchema = z.object({\n\tid: z.number(),\n\tstatus: z.string(),\n});\nconst neonFunctionSchema = z.object({\n\tid: z.string(),\n\tslug: z.string(),\n\tname: z.string(),\n\tinvocation_url: z.string(),\n\tactive_deployment: functionDeploymentSchema.optional(),\n});\nconst functionResponseSchema = z.object({ function: neonFunctionSchema });\nconst functionsListResponseSchema = z.object({\n\tfunctions: z.array(neonFunctionSchema),\n});\nconst functionDeploymentResponseSchema = z.object({\n\tdeployment: functionDeploymentSchema,\n});\n\ninterface CreateNeonAuthRestInput {\n\tauth_provider: \"better_auth\";\n\tdatabase_name?: string;\n}\n\ninterface RestConfig {\n\tapiKey: string;\n\tbaseUrl: string;\n}\n\n/**\n * Adapt `@neondatabase/api-client` to the narrow {@link NeonApi} façade used by the rest of\n * this package. Constructs are restricted to whole-object read/write of just the fields we\n * model in {@link Config}; anything else stays untouched on the remote.\n */\nexport function createRealNeonApi(options: {\n\tapiKey: string;\n\tbaseUrl?: string;\n\t/**\n\t * Tuning knob for the built-in 423 retry. Defaults: ~30s of total wait spread across\n\t * 12 attempts with exponential backoff capped at 5s. Lowering this is mostly useful in\n\t * tests; raising it is rarely needed because Neon operations are usually sub-second.\n\t */\n\tretryOnLocked?: {\n\t\tmaxAttempts?: number;\n\t\tinitialDelayMs?: number;\n\t\tmaxDelayMs?: number;\n\t};\n}): NeonApi {\n\tif (!options.apiKey || options.apiKey.trim() === \"\") {\n\t\tthrow new PlatformError(\n\t\t\tErrorCode.MissingApiKey,\n\t\t\t[\n\t\t\t\t\"createRealNeonApi requires a non-empty `apiKey`.\",\n\t\t\t\t\"Generate one at https://console.neon.tech/app/settings/api-keys and pass it as { apiKey: process.env.NEON_API_KEY }.\",\n\t\t\t].join(\" \"),\n\t\t);\n\t}\n\n\tconst client = createApiClient({\n\t\tapiKey: options.apiKey,\n\t\t...(options.baseUrl ? { baseURL: options.baseUrl } : {}),\n\t});\n\n\treturn new RealNeonApi(\n\t\tclient,\n\t\t{\n\t\t\tmaxAttempts: options.retryOnLocked?.maxAttempts ?? 12,\n\t\t\tinitialDelayMs: options.retryOnLocked?.initialDelayMs ?? 250,\n\t\t\tmaxDelayMs: options.retryOnLocked?.maxDelayMs ?? 5_000,\n\t\t},\n\t\t{\n\t\t\tapiKey: options.apiKey,\n\t\t\tbaseUrl: options.baseUrl ?? DEFAULT_NEON_API_BASE_URL,\n\t\t},\n\t);\n}\n\ninterface RetryConfig {\n\tmaxAttempts: number;\n\tinitialDelayMs: number;\n\tmaxDelayMs: number;\n}\n\n/**\n * Retry a function whenever it throws an HTTP 423 (Locked) — Neon's signal that a prior\n * mutation on the same resource is still in flight. Uses exponential backoff capped at\n * `maxDelayMs`. Any other error (and the last attempt) propagates.\n *\n * Exported only for tests; production callers go through the wrapped {@link NeonApi}.\n */\nexport async function retryOnLocked<T>(\n\tfn: () => Promise<T>,\n\tconfig: RetryConfig,\n): Promise<T> {\n\tlet delay = config.initialDelayMs;\n\tlet lastError: unknown;\n\tfor (let attempt = 1; attempt <= config.maxAttempts; attempt++) {\n\t\ttry {\n\t\t\treturn await fn();\n\t\t} catch (err) {\n\t\t\tlastError = err;\n\t\t\tconst status = readHttpStatusFromError(err);\n\t\t\tif (status !== 423 || attempt === config.maxAttempts) throw err;\n\t\t\tawait sleep(delay);\n\t\t\tdelay = Math.min(delay * 2, config.maxDelayMs);\n\t\t}\n\t}\n\tthrow lastError;\n}\n\nfunction readHttpStatusFromError(err: unknown): number | undefined {\n\tif (err === null || typeof err !== \"object\") return undefined;\n\tconst response = (err as { response?: unknown }).response;\n\tif (response === null || typeof response !== \"object\") return undefined;\n\tconst status = (response as { status?: unknown }).status;\n\treturn typeof status === \"number\" ? status : undefined;\n}\n\nfunction sleep(ms: number): Promise<void> {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nclass RealNeonApi implements NeonApi {\n\tconstructor(\n\t\tprivate readonly client: ApiClient,\n\t\tprivate readonly retryConfig: RetryConfig,\n\t\tprivate readonly restConfig: RestConfig,\n\t) {}\n\n\tprivate retry<T>(fn: () => Promise<T>): Promise<T> {\n\t\treturn retryOnLocked(fn, this.retryConfig);\n\t}\n\n\tprivate async call<T>(\n\t\top: string,\n\t\tfn: () => Promise<T>,\n\t\toptions: { projectId?: string; mutating?: boolean } = {},\n\t): Promise<T> {\n\t\ttry {\n\t\t\treturn options.mutating ? await this.retry(fn) : await fn();\n\t\t} catch (err) {\n\t\t\tconst wrapped = wrapNeonError(\n\t\t\t\terr,\n\t\t\t\toptions.projectId\n\t\t\t\t\t? { op, projectId: options.projectId }\n\t\t\t\t\t: { op },\n\t\t\t);\n\t\t\tthrow wrapped;\n\t\t}\n\t}\n\n\tasync listProjects(filter: {\n\t\torgId?: string;\n\t}): Promise<NeonProjectSnapshot[]> {\n\t\treturn this.call(\n\t\t\tfilter.orgId ? `listProjects(org=${filter.orgId})` : \"listProjects\",\n\t\t\tasync () => {\n\t\t\t\tconst projects: ProjectListItem[] = [];\n\t\t\t\tlet cursor: string | undefined;\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst res = await this.client.listProjects({\n\t\t\t\t\t\t...(filter.orgId ? { org_id: filter.orgId } : {}),\n\t\t\t\t\t\t...(cursor ? { cursor } : {}),\n\t\t\t\t\t\tlimit: 100,\n\t\t\t\t\t});\n\t\t\t\t\tprojects.push(...res.data.projects);\n\t\t\t\t\tconst next = (\n\t\t\t\t\t\tres.data as { pagination?: { next?: string } }\n\t\t\t\t\t).pagination?.next;\n\t\t\t\t\tif (!next || next === cursor) break;\n\t\t\t\t\tcursor = next;\n\t\t\t\t}\n\t\t\t\treturn projects.map(projectToSnapshot);\n\t\t\t},\n\t\t);\n\t}\n\n\tasync getProject(projectId: string): Promise<NeonProjectSnapshot> {\n\t\treturn this.call(\n\t\t\t`getProject(${projectId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.getProject(projectId);\n\t\t\t\treturn projectToSnapshot(res.data.project);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync createProject(\n\t\tinput: CreateProjectInput,\n\t): Promise<NeonProjectSnapshot> {\n\t\tconst body: ProjectCreateRequest = {\n\t\t\tproject: {\n\t\t\t\tname: input.name,\n\t\t\t\tregion_id: input.regionId,\n\t\t\t\t...(input.pgVersion !== undefined\n\t\t\t\t\t? { pg_version: input.pgVersion as PgVersion }\n\t\t\t\t\t: {}),\n\t\t\t\t...(input.orgId ? { org_id: input.orgId } : {}),\n\t\t\t\t...(input.defaultEndpointSettings\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdefault_endpoint_settings:\n\t\t\t\t\t\t\t\tcomputeSettingsToDefaults(\n\t\t\t\t\t\t\t\t\tinput.defaultEndpointSettings,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\t...(input.defaultBranchName\n\t\t\t\t\t? { branch: { name: input.defaultBranchName } }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t};\n\t\treturn this.call(\n\t\t\t`createProject(${input.name})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.createProject(body);\n\t\t\t\treturn projectToSnapshot(res.data.project);\n\t\t\t},\n\t\t\t{ mutating: true },\n\t\t);\n\t}\n\n\tasync updateProject(\n\t\tprojectId: string,\n\t\tinput: { name?: string; defaultEndpointSettings?: ComputeSettings },\n\t): Promise<NeonProjectSnapshot> {\n\t\tconst body: ProjectUpdateRequest = {\n\t\t\tproject: {\n\t\t\t\t...(input.name !== undefined ? { name: input.name } : {}),\n\t\t\t\t...(input.defaultEndpointSettings\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdefault_endpoint_settings:\n\t\t\t\t\t\t\t\tcomputeSettingsToDefaults(\n\t\t\t\t\t\t\t\t\tinput.defaultEndpointSettings,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t};\n\t\treturn this.call(\n\t\t\t`updateProject(${projectId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.updateProject(projectId, body);\n\t\t\t\treturn projectToSnapshot(res.data.project);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync listBranches(projectId: string): Promise<NeonBranchSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listBranches(${projectId})`,\n\t\t\tasync () => {\n\t\t\t\tconst branches: Branch[] = [];\n\t\t\t\tlet cursor: string | undefined;\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst res = await this.client.listProjectBranches({\n\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\tlimit: 100,\n\t\t\t\t\t\t...(cursor ? { cursor } : {}),\n\t\t\t\t\t});\n\t\t\t\t\tbranches.push(...(res.data.branches as Branch[]));\n\t\t\t\t\tconst next = (\n\t\t\t\t\t\tres.data as { pagination?: { next?: string } }\n\t\t\t\t\t).pagination?.next;\n\t\t\t\t\tif (!next || next === cursor) break;\n\t\t\t\t\tcursor = next;\n\t\t\t\t}\n\t\t\t\treturn branches.map(branchToSnapshot);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync createBranch(\n\t\tprojectId: string,\n\t\tinput: CreateBranchInput,\n\t): Promise<{\n\t\tbranch: NeonBranchSnapshot;\n\t\tendpoints: NeonEndpointSnapshot[];\n\t}> {\n\t\tconst endpointOptions: BranchCreateRequestEndpointOptions | undefined =\n\t\t\tinput.computeSettings\n\t\t\t\t? {\n\t\t\t\t\t\ttype: EndpointType.ReadWrite,\n\t\t\t\t\t\t...computeSettingsToEndpointOptions(\n\t\t\t\t\t\t\tinput.computeSettings,\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: { type: EndpointType.ReadWrite };\n\n\t\tconst body: BranchCreateRequest = {\n\t\t\tbranch: {\n\t\t\t\tname: input.name,\n\t\t\t\t...(input.parentId ? { parent_id: input.parentId } : {}),\n\t\t\t\t...(input.expiresAt ? { expires_at: input.expiresAt } : {}),\n\t\t\t\t...(input.protected !== undefined\n\t\t\t\t\t? { protected: input.protected }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t\tendpoints: [endpointOptions],\n\t\t};\n\t\treturn this.call(\n\t\t\t`createBranch(${projectId}/${input.name})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.createProjectBranch(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbody,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbranch: branchToSnapshot(res.data.branch),\n\t\t\t\t\tendpoints: (res.data.endpoints ?? []).map(\n\t\t\t\t\t\tendpointToSnapshot,\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync updateBranch(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateBranchInput,\n\t): Promise<NeonBranchSnapshot> {\n\t\tconst branch: BranchUpdateRequest[\"branch\"] = {};\n\t\tif (input.name !== undefined) branch.name = input.name;\n\t\tif (input.expiresAt !== undefined) branch.expires_at = input.expiresAt;\n\t\tif (input.protected !== undefined) branch.protected = input.protected;\n\t\treturn this.call(\n\t\t\t`updateBranch(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.updateProjectBranch(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId,\n\t\t\t\t\t{ branch },\n\t\t\t\t);\n\t\t\t\treturn branchToSnapshot(res.data.branch);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync listEndpoints(projectId: string): Promise<NeonEndpointSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listEndpoints(${projectId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.listProjectEndpoints(projectId);\n\t\t\t\treturn (res.data.endpoints as Endpoint[]).map(\n\t\t\t\t\tendpointToSnapshot,\n\t\t\t\t);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync updateEndpoint(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\tsettings: ComputeSettings,\n\t): Promise<NeonEndpointSnapshot> {\n\t\tconst endpoint: EndpointUpdateRequest[\"endpoint\"] =\n\t\t\tcomputeSettingsToEndpointOptions(settings);\n\t\treturn this.call(\n\t\t\t`updateEndpoint(${projectId}/${endpointId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.updateProjectEndpoint(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tendpointId,\n\t\t\t\t\t{ endpoint },\n\t\t\t\t);\n\t\t\t\treturn endpointToSnapshot(res.data.endpoint);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync listBranchRoles(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<NeonRoleSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listBranchRoles(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.listProjectBranchRoles(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId,\n\t\t\t\t);\n\t\t\t\treturn (res.data.roles as Role[]).map(roleToSnapshot);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync listBranchDatabases(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<NeonDatabaseSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listBranchDatabases(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.listProjectBranchDatabases(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId,\n\t\t\t\t);\n\t\t\t\treturn (res.data.databases as Database[]).map(\n\t\t\t\t\tdatabaseToSnapshot,\n\t\t\t\t);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync getConnectionUri(\n\t\tprojectId: string,\n\t\tinput: GetConnectionUriInput,\n\t): Promise<{ uri: string }> {\n\t\tconst op = `getConnectionUri(${projectId}/${input.databaseName}@${input.roleName}${input.pooled ? \" pooled\" : \"\"})`;\n\t\t// Always send `pooled` explicitly. The Neon API has switched its default\n\t\t// to returning the pooled URI when the parameter is omitted, so we have\n\t\t// to be explicit to get the direct URI back.\n\t\tconst pooled = input.pooled === true;\n\t\treturn this.call(\n\t\t\top,\n\t\t\tasync () => {\n\t\t\t\tconst res = await this.client.getConnectionUri({\n\t\t\t\t\tprojectId,\n\t\t\t\t\tdatabase_name: input.databaseName,\n\t\t\t\t\trole_name: input.roleName,\n\t\t\t\t\t...(input.branchId ? { branch_id: input.branchId } : {}),\n\t\t\t\t\t...(input.endpointId\n\t\t\t\t\t\t? { endpoint_id: input.endpointId }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tpooled,\n\t\t\t\t});\n\t\t\t\treturn { uri: res.data.uri };\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync getNeonAuth(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<NeonAuthSnapshot | null> {\n\t\t// `GET /projects/:pid/branches/:bid/auth` returns 404 when no integration exists.\n\t\t// Surface that as `null` so callers can branch cleanly instead of try/catch.\n\t\ttry {\n\t\t\treturn await this.call(\n\t\t\t\t`getNeonAuth(${projectId}/${branchId})`,\n\t\t\t\tasync () => {\n\t\t\t\t\tconst res = await this.client.getNeonAuth(\n\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\tbranchId,\n\t\t\t\t\t);\n\t\t\t\t\treturn neonAuthResponseToSnapshot(res.data);\n\t\t\t\t},\n\t\t\t\t{ projectId },\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tif (err instanceof PlatformError && err.code === ErrorCode.NotFound)\n\t\t\t\treturn null;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tasync enableNeonAuth(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: { databaseName?: string } = {},\n\t): Promise<NeonAuthSnapshot> {\n\t\t// Idempotent: if an integration already exists on the branch, the POST returns 409\n\t\t// (`Conflict`). We swallow that and re-fetch the existing snapshot so callers can\n\t\t// rely on `enableNeonAuth` to be safe to invoke from any push, including no-ops.\n\t\ttry {\n\t\t\treturn await this.call(\n\t\t\t\t`enableNeonAuth(${projectId}/${branchId})`,\n\t\t\t\tasync () => {\n\t\t\t\t\t// TODO: switch back to `this.client.createNeonAuth` once\n\t\t\t\t\t// @neondatabase/api-client narrows this branch endpoint to `better_auth`.\n\t\t\t\t\tconst data = await this.postJson(\n\t\t\t\t\t\t`/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/auth`,\n\t\t\t\t\t\tcreateNeonAuthRestInput(input),\n\t\t\t\t\t);\n\t\t\t\t\tconst parsed = neonAuthResponseSchema.parse(data);\n\t\t\t\t\treturn neonAuthResponseToSnapshot(parsed);\n\t\t\t\t},\n\t\t\t\t{ projectId, mutating: true },\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tif (\n\t\t\t\terr instanceof PlatformError &&\n\t\t\t\terr.code === ErrorCode.Conflict\n\t\t\t) {\n\t\t\t\tconst existing = await this.getNeonAuth(projectId, branchId);\n\t\t\t\tif (existing) return existing;\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tprivate async postJson(path: string, body: unknown): Promise<unknown> {\n\t\treturn this.request(\"POST\", path, {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify(body),\n\t\t});\n\t}\n\n\tprivate async getJson(path: string): Promise<unknown> {\n\t\treturn this.request(\"GET\", path);\n\t}\n\n\tprivate async deleteJson(path: string): Promise<unknown> {\n\t\treturn this.request(\"DELETE\", path);\n\t}\n\n\t/**\n\t * Upload a built function bundle via `multipart/form-data` to the deploy endpoint.\n\t * Sends the bundle as the `file` field plus the deploy params Neon requires.\n\t */\n\tprivate async postMultipart(\n\t\tpath: string,\n\t\tinput: DeployFunctionInput,\n\t): Promise<unknown> {\n\t\tconst form = new FormData();\n\t\tform.set(\n\t\t\t\"file\",\n\t\t\tnew Blob([input.bundle as BlobPart], {\n\t\t\t\ttype: \"application/zip\",\n\t\t\t}),\n\t\t\t\"bundle.zip\",\n\t\t);\n\t\tform.set(\"memory_mib\", String(input.memoryMib));\n\t\t// Keep concurrency internal for now. The API requires it, but the public\n\t\t// neon.ts config surface intentionally does not expose it yet.\n\t\tform.set(\"concurrency\", \"1\");\n\t\tform.set(\"runtime\", input.runtime);\n\t\tfor (const [key, value] of Object.entries(input.environment)) {\n\t\t\tform.set(`environment[${key}]`, value);\n\t\t}\n\t\treturn this.request(\"POST\", path, { body: form });\n\t}\n\n\tprivate async request(\n\t\tmethod: \"GET\" | \"POST\" | \"DELETE\",\n\t\tpath: string,\n\t\tinit: { headers?: Record<string, string>; body?: BodyInit } = {},\n\t): Promise<unknown> {\n\t\tconst url = `${this.restConfig.baseUrl.replace(/\\/+$/, \"\")}${path}`;\n\t\tconst res = await fetch(url, {\n\t\t\tmethod,\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.restConfig.apiKey}`,\n\t\t\t\t...(init.headers ?? {}),\n\t\t\t},\n\t\t\t...(init.body !== undefined ? { body: init.body } : {}),\n\t\t});\n\t\tconst data = await readJsonBody(res);\n\t\tif (!res.ok) {\n\t\t\tthrow {\n\t\t\t\tresponse: {\n\t\t\t\t\tstatus: res.status,\n\t\t\t\t\tdata,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn data;\n\t}\n\n\tasync getNeonDataApi(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t): Promise<NeonDataApiSnapshot | null> {\n\t\t// Same shape as getNeonAuth — 404 means \"no integration on this branch/db\", which\n\t\t// we translate to `null` for the caller.\n\t\ttry {\n\t\t\treturn await this.call(\n\t\t\t\t`getNeonDataApi(${projectId}/${branchId}/${databaseName})`,\n\t\t\t\tasync () => {\n\t\t\t\t\tconst res = await this.client.getProjectBranchDataApi(\n\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\tbranchId,\n\t\t\t\t\t\tdatabaseName,\n\t\t\t\t\t);\n\t\t\t\t\treturn { url: res.data.url };\n\t\t\t\t},\n\t\t\t\t{ projectId },\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tif (err instanceof PlatformError && err.code === ErrorCode.NotFound)\n\t\t\t\treturn null;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tasync enableProjectBranchDataApi(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t): Promise<NeonDataApiSnapshot> {\n\t\t// Idempotent in the same shape as `enableNeonAuth`: if an integration already\n\t\t// exists, the POST returns 409 and we re-fetch the existing snapshot.\n\t\ttry {\n\t\t\treturn await this.call(\n\t\t\t\t`enableProjectBranchDataApi(${projectId}/${branchId}/${databaseName})`,\n\t\t\t\tasync () => {\n\t\t\t\t\tconst res = await this.client.createProjectBranchDataApi(\n\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\tbranchId,\n\t\t\t\t\t\tdatabaseName,\n\t\t\t\t\t\t// Empty body — pick up Neon defaults (auth_provider inferred from\n\t\t\t\t\t\t// whether Neon Auth is also enabled; default schemas/grants).\n\t\t\t\t\t\t{},\n\t\t\t\t\t);\n\t\t\t\t\treturn { url: res.data.url };\n\t\t\t\t},\n\t\t\t\t{ projectId, mutating: true },\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tif (\n\t\t\t\terr instanceof PlatformError &&\n\t\t\t\terr.code === ErrorCode.Conflict\n\t\t\t) {\n\t\t\t\tconst existing = await this.getNeonDataApi(\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId,\n\t\t\t\t\tdatabaseName,\n\t\t\t\t);\n\t\t\t\tif (existing) return existing;\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// ─── Preview: buckets ──────────────────────────────────────────────────────\n\n\tasync listBranchBuckets(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<NeonBucketSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listBranchBuckets(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tconst data = await this.getJson(\n\t\t\t\t\tbranchPreviewPath(projectId, branchId, \"buckets\"),\n\t\t\t\t);\n\t\t\t\tconst parsed = bucketsListResponseSchema.parse(data);\n\t\t\t\treturn parsed.buckets.map(bucketToSnapshot);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync createBranchBucket(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateBucketInput,\n\t): Promise<NeonBucketSnapshot> {\n\t\treturn this.call(\n\t\t\t`createBranchBucket(${projectId}/${branchId}/${input.name})`,\n\t\t\tasync () => {\n\t\t\t\tconst data = await this.postJson(\n\t\t\t\t\tbranchPreviewPath(projectId, branchId, \"buckets\"),\n\t\t\t\t\t{\n\t\t\t\t\t\tname: input.name,\n\t\t\t\t\t\t...(input.accessLevel\n\t\t\t\t\t\t\t? { access_level: input.accessLevel }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst parsed = bucketResponseSchema.parse(data);\n\t\t\t\treturn bucketToSnapshot(parsed.bucket);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync deleteBranchBucket(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t): Promise<void> {\n\t\tawait this.call(\n\t\t\t`deleteBranchBucket(${projectId}/${branchId}/${bucketName})`,\n\t\t\tasync () => {\n\t\t\t\tawait this.deleteJson(\n\t\t\t\t\t`${branchPreviewPath(projectId, branchId, \"buckets\")}/${encodeURIComponent(bucketName)}`,\n\t\t\t\t);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\t// ─── Preview: functions ────────────────────────────────────────────────────\n\n\tasync listBranchFunctions(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<NeonFunctionSnapshot[]> {\n\t\treturn this.call(\n\t\t\t`listBranchFunctions(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tconst data = await this.getJson(\n\t\t\t\t\tbranchPreviewPath(projectId, branchId, \"functions\"),\n\t\t\t\t);\n\t\t\t\tconst parsed = functionsListResponseSchema.parse(data);\n\t\t\t\treturn parsed.functions.map(functionToSnapshot);\n\t\t\t},\n\t\t\t{ projectId },\n\t\t);\n\t}\n\n\tasync createBranchFunction(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: { slug: string; name: string },\n\t): Promise<NeonFunctionSnapshot> {\n\t\treturn this.call(\n\t\t\t`createBranchFunction(${projectId}/${branchId}/${input.slug})`,\n\t\t\tasync () => {\n\t\t\t\tconst data = await this.postJson(\n\t\t\t\t\tbranchPreviewPath(projectId, branchId, \"functions\"),\n\t\t\t\t\t{ slug: input.slug, name: input.name },\n\t\t\t\t);\n\t\t\t\tconst parsed = functionResponseSchema.parse(data);\n\t\t\t\treturn functionToSnapshot(parsed.function);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync deleteBranchFunction(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t): Promise<void> {\n\t\tawait this.call(\n\t\t\t`deleteBranchFunction(${projectId}/${branchId}/${slug})`,\n\t\t\tasync () => {\n\t\t\t\tawait this.deleteJson(\n\t\t\t\t\t`${branchPreviewPath(projectId, branchId, \"functions\")}/${encodeURIComponent(slug)}`,\n\t\t\t\t);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync deployBranchFunction(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: DeployFunctionInput,\n\t): Promise<NeonFunctionDeploymentSnapshot> {\n\t\treturn this.call(\n\t\t\t`deployBranchFunction(${projectId}/${branchId}/${slug})`,\n\t\t\tasync () => {\n\t\t\t\tconst data = await this.postMultipart(\n\t\t\t\t\t`${branchPreviewPath(projectId, branchId, \"functions\")}/${encodeURIComponent(slug)}/deployments`,\n\t\t\t\t\tinput,\n\t\t\t\t);\n\t\t\t\tconst parsed = functionDeploymentResponseSchema.parse(data);\n\t\t\t\treturn deploymentToSnapshot(parsed.deployment);\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\t// ─── Preview: AI Gateway ───────────────────────────────────────────────────\n\t//\n\t// TODO(neon-deploy): the AI Gateway routes are not yet in the public API spec we wired\n\t// the rest of this adapter against. The paths below follow the established branch-scoped\n\t// convention (`/projects/{p}/branches/{b}/ai-gateway`); confirm them against the real\n\t// API (and the exact enable/disable verb + response shape) before relying on this in\n\t// production, and swap to the typed `@neondatabase/api-client` method once it exists.\n\n\tasync getAiGatewayEnabled(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<boolean> {\n\t\ttry {\n\t\t\treturn await this.call(\n\t\t\t\t`getAiGatewayEnabled(${projectId}/${branchId})`,\n\t\t\t\tasync () => {\n\t\t\t\t\tconst data = await this.getJson(\n\t\t\t\t\t\taiGatewayPath(projectId, branchId),\n\t\t\t\t\t);\n\t\t\t\t\treturn aiGatewayEnabledFromResponse(data);\n\t\t\t\t},\n\t\t\t\t{ projectId },\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tif (err instanceof PlatformError && err.code === ErrorCode.NotFound)\n\t\t\t\treturn false;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tasync enableAiGateway(projectId: string, branchId: string): Promise<void> {\n\t\tawait this.call(\n\t\t\t`enableAiGateway(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tawait this.postJson(aiGatewayPath(projectId, branchId), {\n\t\t\t\t\tenabled: true,\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n\n\tasync disableAiGateway(projectId: string, branchId: string): Promise<void> {\n\t\tawait this.call(\n\t\t\t`disableAiGateway(${projectId}/${branchId})`,\n\t\t\tasync () => {\n\t\t\t\tawait this.deleteJson(aiGatewayPath(projectId, branchId));\n\t\t\t},\n\t\t\t{ projectId, mutating: true },\n\t\t);\n\t}\n}\n\nfunction branchPreviewPath(\n\tprojectId: string,\n\tbranchId: string,\n\tresource: \"buckets\" | \"functions\",\n): string {\n\treturn `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/${resource}`;\n}\n\nfunction aiGatewayPath(projectId: string, branchId: string): string {\n\treturn `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/ai-gateway`;\n}\n\nfunction bucketToSnapshot(\n\tbucket: z.infer<typeof bucketSchema>,\n): NeonBucketSnapshot {\n\treturn {\n\t\tname: bucket.name,\n\t\taccessLevel: normalizeBucketAccessLevel(bucket.access_level),\n\t};\n}\n\n/**\n * The Neon API returns `access_level` as a free-form string (per the API guidelines:\n * responses use plain strings, not enums). Map the known values onto our union and treat\n * anything else as `private` — the safe default for an unrecognised access level.\n */\nfunction normalizeBucketAccessLevel(\n\tvalue: string | undefined,\n): BucketAccessLevel {\n\treturn value === \"public_read\" ? \"public_read\" : \"private\";\n}\n\nfunction functionToSnapshot(\n\tfn: z.infer<typeof neonFunctionSchema>,\n): NeonFunctionSnapshot {\n\tconst snapshot: NeonFunctionSnapshot = {\n\t\tid: fn.id,\n\t\tslug: fn.slug,\n\t\tname: fn.name,\n\t\tinvocationUrl: fn.invocation_url,\n\t};\n\tif (fn.active_deployment) {\n\t\tsnapshot.activeDeploymentId = fn.active_deployment.id;\n\t}\n\treturn snapshot;\n}\n\nfunction deploymentToSnapshot(\n\tdeployment: z.infer<typeof functionDeploymentSchema>,\n): NeonFunctionDeploymentSnapshot {\n\treturn {\n\t\tid: deployment.id,\n\t\tstatus: normalizeDeploymentStatus(deployment.status),\n\t};\n}\n\nfunction normalizeDeploymentStatus(\n\tvalue: string,\n): NeonFunctionDeploymentSnapshot[\"status\"] {\n\tswitch (value) {\n\t\tcase \"pending\":\n\t\tcase \"building\":\n\t\tcase \"completed\":\n\t\tcase \"failed\":\n\t\t\treturn value;\n\t\tdefault:\n\t\t\t// Unknown status from a newer server — surface as `pending` rather than throwing,\n\t\t\t// matching the API guideline that clients treat undocumented enum values leniently.\n\t\t\treturn \"pending\";\n\t}\n}\n\nfunction aiGatewayEnabledFromResponse(data: unknown): boolean {\n\tif (data !== null && typeof data === \"object\" && \"enabled\" in data) {\n\t\treturn (data as { enabled?: unknown }).enabled === true;\n\t}\n\treturn false;\n}\n\nfunction neonAuthResponseToSnapshot(\n\tdata: z.infer<typeof neonAuthResponseSchema>,\n): NeonAuthSnapshot {\n\tconst snapshot: NeonAuthSnapshot = {\n\t\tprojectId: data.auth_provider_project_id,\n\t\tjwksUrl: data.jwks_url,\n\t};\n\tif (data.pub_client_key !== undefined) {\n\t\tsnapshot.publishableClientKey = data.pub_client_key;\n\t}\n\tif (data.secret_server_key !== undefined) {\n\t\tsnapshot.secretServerKey = data.secret_server_key;\n\t}\n\tif (data.base_url) snapshot.baseUrl = data.base_url;\n\treturn snapshot;\n}\n\nexport function createNeonAuthRestInput(input: {\n\tdatabaseName?: string;\n}): CreateNeonAuthRestInput {\n\treturn {\n\t\tauth_provider: \"better_auth\",\n\t\t...(input.databaseName ? { database_name: input.databaseName } : {}),\n\t};\n}\n\nasync function readJsonBody(res: Response): Promise<unknown> {\n\tconst text = await res.text();\n\tif (text.trim() === \"\") return {};\n\treturn JSON.parse(text);\n}\n\nfunction projectToSnapshot(\n\tproject: Project | ProjectListItem,\n): NeonProjectSnapshot {\n\tconst defaults = project.default_endpoint_settings;\n\tconst snapshot: NeonProjectSnapshot = {\n\t\tid: project.id,\n\t\tname: project.name,\n\t\tregionId: project.region_id,\n\t\tpgVersion: project.pg_version,\n\t};\n\tif (project.org_id) snapshot.orgId = project.org_id;\n\tif (defaults) {\n\t\tconst compute = defaultsToComputeSettings(defaults);\n\t\tif (compute) snapshot.defaultEndpointSettings = compute;\n\t}\n\treturn snapshot;\n}\n\nfunction branchToSnapshot(branch: Branch): NeonBranchSnapshot {\n\tconst snapshot: NeonBranchSnapshot = {\n\t\tid: branch.id,\n\t\tname: branch.name,\n\t\tisDefault: branch.default,\n\t\tprotected: branch.protected === true,\n\t};\n\tif (branch.parent_id) snapshot.parentId = branch.parent_id;\n\tif (branch.expires_at) snapshot.expiresAt = branch.expires_at;\n\treturn snapshot;\n}\n\nfunction endpointToSnapshot(endpoint: Endpoint): NeonEndpointSnapshot {\n\treturn {\n\t\tid: endpoint.id,\n\t\tbranchId: endpoint.branch_id,\n\t\ttype:\n\t\t\tendpoint.type === EndpointType.ReadOnly\n\t\t\t\t? \"read_only\"\n\t\t\t\t: \"read_write\",\n\t\tautoscalingLimitMinCu:\n\t\t\tendpoint.autoscaling_limit_min_cu as ComputeSettings[\"autoscalingLimitMinCu\"],\n\t\tautoscalingLimitMaxCu:\n\t\t\tendpoint.autoscaling_limit_max_cu as ComputeSettings[\"autoscalingLimitMaxCu\"],\n\t\tsuspendTimeout: formatSuspendTimeout(endpoint.suspend_timeout_seconds),\n\t};\n}\n\nfunction roleToSnapshot(role: Role): NeonRoleSnapshot {\n\treturn {\n\t\tname: role.name,\n\t\tbranchId: role.branch_id,\n\t\tprotected: role.protected ?? false,\n\t};\n}\n\nfunction databaseToSnapshot(database: Database): NeonDatabaseSnapshot {\n\treturn {\n\t\tname: database.name,\n\t\tbranchId: database.branch_id,\n\t\townerName: database.owner_name,\n\t};\n}\n\nfunction computeSettingsToDefaults(\n\tsettings: ComputeSettings,\n): DefaultEndpointSettings {\n\tconst out: DefaultEndpointSettings = {};\n\tif (settings.autoscalingLimitMinCu !== undefined)\n\t\tout.autoscaling_limit_min_cu = settings.autoscalingLimitMinCu;\n\tif (settings.autoscalingLimitMaxCu !== undefined)\n\t\tout.autoscaling_limit_max_cu = settings.autoscalingLimitMaxCu;\n\tif (settings.suspendTimeout !== undefined) {\n\t\tconst parsed = parseSuspendTimeout(settings.suspendTimeout);\n\t\tif (\"error\" in parsed) {\n\t\t\tthrow new PlatformError(\n\t\t\t\tErrorCode.InvalidConfig,\n\t\t\t\t`Invalid suspendTimeout: ${parsed.error}`,\n\t\t\t);\n\t\t}\n\t\tout.suspend_timeout_seconds = parsed.seconds;\n\t}\n\treturn out;\n}\n\nfunction computeSettingsToEndpointOptions(settings: ComputeSettings): {\n\tautoscaling_limit_min_cu?: number;\n\tautoscaling_limit_max_cu?: number;\n\tsuspend_timeout_seconds?: number;\n} {\n\tconst out: {\n\t\tautoscaling_limit_min_cu?: number;\n\t\tautoscaling_limit_max_cu?: number;\n\t\tsuspend_timeout_seconds?: number;\n\t} = {};\n\tif (settings.autoscalingLimitMinCu !== undefined)\n\t\tout.autoscaling_limit_min_cu = settings.autoscalingLimitMinCu;\n\tif (settings.autoscalingLimitMaxCu !== undefined)\n\t\tout.autoscaling_limit_max_cu = settings.autoscalingLimitMaxCu;\n\tif (settings.suspendTimeout !== undefined) {\n\t\tconst parsed = parseSuspendTimeout(settings.suspendTimeout);\n\t\tif (\"error\" in parsed) {\n\t\t\tthrow new PlatformError(\n\t\t\t\tErrorCode.InvalidConfig,\n\t\t\t\t`Invalid suspendTimeout: ${parsed.error}`,\n\t\t\t);\n\t\t}\n\t\tout.suspend_timeout_seconds = parsed.seconds;\n\t}\n\treturn out;\n}\n\nfunction defaultsToComputeSettings(\n\tdefaults: DefaultEndpointSettings,\n): ComputeSettings | undefined {\n\tconst out: ComputeSettings = {};\n\tif (defaults.autoscaling_limit_min_cu !== undefined)\n\t\tout.autoscalingLimitMinCu =\n\t\t\tdefaults.autoscaling_limit_min_cu as ComputeSettings[\"autoscalingLimitMinCu\"];\n\tif (defaults.autoscaling_limit_max_cu !== undefined)\n\t\tout.autoscalingLimitMaxCu =\n\t\t\tdefaults.autoscaling_limit_max_cu as ComputeSettings[\"autoscalingLimitMaxCu\"];\n\tif (defaults.suspend_timeout_seconds !== undefined)\n\t\tout.suspendTimeout = formatSuspendTimeout(\n\t\t\tdefaults.suspend_timeout_seconds,\n\t\t);\n\treturn Object.keys(out).length > 0 ? out : undefined;\n}\n"],"mappings":";;;;;;AA4CA,MAAM,4BAA4B;AAElC,MAAM,yBAAyB,EAAE,OAAO;CACvC,0BAA0B,EAAE,OAAO;CACnC,gBAAgB,EAAE,OAAO,EAAE,SAAS;CACpC,mBAAmB,EAAE,OAAO,EAAE,SAAS;CACvC,UAAU,EAAE,OAAO;CACnB,UAAU,EAAE,OAAO,EAAE,SAAS;AAC/B,CAAC;AAID,MAAM,eAAe,EAAE,OAAO;CAC7B,MAAM,EAAE,OAAO;CACf,cAAc,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;AACD,MAAM,uBAAuB,EAAE,OAAO,EAAE,QAAQ,aAAa,CAAC;AAC9D,MAAM,4BAA4B,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,EAAE,CAAC;AAI7E,MAAM,2BAA2B,EAAE,OAAO;CACzC,IAAI,EAAE,OAAO;CACb,QAAQ,EAAE,OAAO;AAClB,CAAC;AACD,MAAM,qBAAqB,EAAE,OAAO;CACnC,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,gBAAgB,EAAE,OAAO;CACzB,mBAAmB,yBAAyB,SAAS;AACtD,CAAC;AACD,MAAM,yBAAyB,EAAE,OAAO,EAAE,UAAU,mBAAmB,CAAC;AACxE,MAAM,8BAA8B,EAAE,OAAO,EAC5C,WAAW,EAAE,MAAM,kBAAkB,EACtC,CAAC;AACD,MAAM,mCAAmC,EAAE,OAAO,EACjD,YAAY,yBACb,CAAC;;;;;;AAiBD,SAAgB,kBAAkB,SAatB;CACX,IAAI,CAAC,QAAQ,UAAU,QAAQ,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,iBAAiB,qBACpB,SAAS,uBACV;CACD,OAAO,OAAO,KAAK,GAAG,EAAE,SAAS,IAAI,MAAM,KAAA;AAC5C"}
@@ -0,0 +1,262 @@
1
+ import { BucketAccessLevel, ComputeSettings, FunctionMemoryMib, FunctionRuntime } from "./types.js";
2
+
3
+ //#region src/lib/neon-api.d.ts
4
+
5
+ /**
6
+ * Snapshot of a Neon project field set we care about. Maps onto a subset of the upstream
7
+ * `@neondatabase/api-client` `Project` type. We do **not** widen this to the full upstream
8
+ * shape — keeping the surface narrow makes the in-memory fake practical to maintain.
9
+ */
10
+ interface NeonProjectSnapshot {
11
+ id: string;
12
+ name: string;
13
+ regionId: string;
14
+ pgVersion: number;
15
+ orgId?: string;
16
+ defaultEndpointSettings?: ComputeSettings;
17
+ }
18
+ interface NeonBranchSnapshot {
19
+ id: string;
20
+ name: string;
21
+ parentId?: string;
22
+ isDefault: boolean;
23
+ /** Whether the branch is marked protected on Neon. */
24
+ protected: boolean;
25
+ expiresAt?: string;
26
+ }
27
+ interface NeonEndpointSnapshot {
28
+ id: string;
29
+ branchId: string;
30
+ type: "read_only" | "read_write";
31
+ autoscalingLimitMinCu: ComputeSettings["autoscalingLimitMinCu"];
32
+ autoscalingLimitMaxCu: ComputeSettings["autoscalingLimitMaxCu"];
33
+ suspendTimeout: ComputeSettings["suspendTimeout"];
34
+ }
35
+ interface CreateProjectInput {
36
+ name: string;
37
+ regionId: string;
38
+ pgVersion?: number;
39
+ orgId?: string;
40
+ defaultEndpointSettings?: ComputeSettings;
41
+ /**
42
+ * Optional name for the project's auto-created default branch. When omitted, Neon
43
+ * uses its own default (`main`).
44
+ */
45
+ defaultBranchName?: string;
46
+ }
47
+ interface CreateBranchInput {
48
+ name: string;
49
+ parentId?: string;
50
+ expiresAt?: string;
51
+ /** When `true`, the branch is created with the `protected` flag set on Neon. */
52
+ protected?: boolean;
53
+ computeSettings?: ComputeSettings;
54
+ }
55
+ interface UpdateBranchInput {
56
+ name?: string;
57
+ expiresAt?: string | null;
58
+ /** When set, toggles the branch's `protected` flag on Neon. */
59
+ protected?: boolean;
60
+ }
61
+ /**
62
+ * A role on a Neon branch (e.g. `neondb_owner`). Passwords are never returned by
63
+ * {@link NeonApi.listBranchRoles}; use {@link NeonApi.getConnectionUri} to fetch a URI
64
+ * with the role's password baked in.
65
+ */
66
+ interface NeonRoleSnapshot {
67
+ name: string;
68
+ branchId: string;
69
+ /** Whether the role is system-protected (cannot be deleted). */
70
+ protected: boolean;
71
+ }
72
+ /**
73
+ * A database on a Neon branch (e.g. `neondb`).
74
+ */
75
+ interface NeonDatabaseSnapshot {
76
+ name: string;
77
+ branchId: string;
78
+ /** The role that owns the database (one role can own multiple databases). */
79
+ ownerName: string;
80
+ }
81
+ /**
82
+ * Bits of a Neon Auth integration. The key fields are optional because the Neon API only
83
+ * includes them on create / rotate responses; `GET /auth` returns the public fields.
84
+ */
85
+ interface NeonAuthSnapshot {
86
+ /** The Neon Auth project id (`auth_provider_project_id` on the Neon API). */
87
+ projectId: string;
88
+ /** Public client key (`pub_client_key`), only present on create / rotate responses. */
89
+ publishableClientKey?: string;
90
+ /** Secret server key (`secret_server_key`), only present on create / rotate responses. */
91
+ secretServerKey?: string;
92
+ /** JWKS URL for verifying tokens issued by Neon Auth. */
93
+ jwksUrl: string;
94
+ /** Optional base URL of the Neon Auth deployment. */
95
+ baseUrl?: string;
96
+ }
97
+ /**
98
+ * Public, fetchable bits of a Neon Data API integration on a specific branch.
99
+ */
100
+ interface NeonDataApiSnapshot {
101
+ /** REST endpoint URL. */
102
+ url: string;
103
+ }
104
+ /**
105
+ * A branchable object-storage bucket (Preview). Backed by the Neon Platform
106
+ * branchable-storage service.
107
+ */
108
+ interface NeonBucketSnapshot {
109
+ name: string;
110
+ accessLevel: BucketAccessLevel;
111
+ }
112
+ /**
113
+ * Input for creating a bucket on a branch.
114
+ */
115
+ interface CreateBucketInput {
116
+ name: string;
117
+ accessLevel?: BucketAccessLevel;
118
+ }
119
+ /**
120
+ * A Neon Function on a branch (Preview). Mirrors the subset of the Functions API we model:
121
+ * the immutable `slug`, the display `name`, and the active deployment id when one exists.
122
+ */
123
+ interface NeonFunctionSnapshot {
124
+ /** Opaque, stable function identifier. */
125
+ id: string;
126
+ /** Branch-unique slug (the invocation path segment). Immutable. */
127
+ slug: string;
128
+ /** Free-form display name. */
129
+ name: string;
130
+ /** URL at which the function is invoked. */
131
+ invocationUrl: string;
132
+ /** Id (platform version number) of the active deployment, when any code is deployed. */
133
+ activeDeploymentId?: number;
134
+ }
135
+ /**
136
+ * Input for deploying code to a function. `bundle` is the already-built ZIP archive of the
137
+ * function source — building it (esbuild + zip) is an imperative step performed by the
138
+ * caller, not by the {@link NeonApi} adapter.
139
+ */
140
+ interface DeployFunctionInput {
141
+ bundle: Uint8Array;
142
+ runtime: FunctionRuntime;
143
+ memoryMib: FunctionMemoryMib;
144
+ environment: Record<string, string>;
145
+ }
146
+ /**
147
+ * A function deployment (Preview).
148
+ */
149
+ interface NeonFunctionDeploymentSnapshot {
150
+ /** The deployment id (monotonic per function). */
151
+ id: number;
152
+ status: "pending" | "building" | "completed" | "failed";
153
+ }
154
+ /**
155
+ * Parameters accepted by {@link NeonApi.getConnectionUri}. `branchId` and `endpointId`
156
+ * are optional — when omitted, the API uses the project's default branch and that
157
+ * branch's read-write endpoint, respectively.
158
+ */
159
+ interface GetConnectionUriInput {
160
+ branchId?: string;
161
+ endpointId?: string;
162
+ databaseName: string;
163
+ roleName: string;
164
+ /** When `true`, returns the pooled (PgBouncer) URI instead of the direct URI. */
165
+ pooled?: boolean;
166
+ }
167
+ /**
168
+ * Narrow façade over the Neon management API. `pullConfig`, `pushConfig`, and `fetchEnv`
169
+ * depend on this interface — *not* on `@neondatabase/api-client` directly — which lets us
170
+ * inject a real in-memory fake during tests without resorting to module mocks.
171
+ */
172
+ interface NeonApi {
173
+ listProjects(filter: {
174
+ orgId?: string;
175
+ }): Promise<NeonProjectSnapshot[]>;
176
+ getProject(projectId: string): Promise<NeonProjectSnapshot>;
177
+ createProject(input: CreateProjectInput): Promise<NeonProjectSnapshot>;
178
+ updateProject(projectId: string, input: {
179
+ name?: string;
180
+ defaultEndpointSettings?: ComputeSettings;
181
+ }): Promise<NeonProjectSnapshot>;
182
+ listBranches(projectId: string): Promise<NeonBranchSnapshot[]>;
183
+ createBranch(projectId: string, input: CreateBranchInput): Promise<{
184
+ branch: NeonBranchSnapshot;
185
+ endpoints: NeonEndpointSnapshot[];
186
+ }>;
187
+ updateBranch(projectId: string, branchId: string, input: UpdateBranchInput): Promise<NeonBranchSnapshot>;
188
+ listEndpoints(projectId: string): Promise<NeonEndpointSnapshot[]>;
189
+ updateEndpoint(projectId: string, endpointId: string, settings: ComputeSettings): Promise<NeonEndpointSnapshot>;
190
+ /** List roles on a branch. Used by {@link fetchEnv} to auto-pick the role when only one exists. */
191
+ listBranchRoles(projectId: string, branchId: string): Promise<NeonRoleSnapshot[]>;
192
+ /** List databases on a branch. Used by {@link fetchEnv} to auto-pick the database when only one exists. */
193
+ listBranchDatabases(projectId: string, branchId: string): Promise<NeonDatabaseSnapshot[]>;
194
+ /**
195
+ * Fetch a Postgres connection URI for the given role + database on a branch.
196
+ * Returns the same string the Neon Console shows under "Connection Details".
197
+ */
198
+ getConnectionUri(projectId: string, input: GetConnectionUriInput): Promise<{
199
+ uri: string;
200
+ }>;
201
+ /**
202
+ * Fetch the Neon Auth integration attached to a specific branch. Returns `null` when
203
+ * no integration is enabled — used by `fetchEnv` to decide whether the `env.auth`
204
+ * namespace can be populated.
205
+ */
206
+ getNeonAuth(projectId: string, branchId: string): Promise<NeonAuthSnapshot | null>;
207
+ /**
208
+ * Enable the Neon Auth integration on a specific branch. Idempotent: if an integration
209
+ * is already enabled, the existing snapshot is returned unchanged. Used by
210
+ * `pushConfig` and `branch` to honour branch policy `auth: {}` / `auth.enabled: true`.
211
+ */
212
+ enableNeonAuth(projectId: string, branchId: string, input?: {
213
+ databaseName?: string;
214
+ }): Promise<NeonAuthSnapshot>;
215
+ /**
216
+ * Fetch the Neon Data API integration attached to a specific branch + database.
217
+ * Returns `null` when no integration is enabled — used by `fetchEnv` to decide
218
+ * whether the `env.dataApi` namespace can be populated.
219
+ */
220
+ getNeonDataApi(projectId: string, branchId: string, databaseName: string): Promise<NeonDataApiSnapshot | null>;
221
+ /**
222
+ * Enable the Neon Data API integration on a specific branch + database. Idempotent:
223
+ * if an integration is already enabled, the existing snapshot is returned unchanged.
224
+ * Used by `pushConfig` and `branch` to honour branch policy `dataApi: {}` / `dataApi.enabled: true`.
225
+ */
226
+ enableProjectBranchDataApi(projectId: string, branchId: string, databaseName: string): Promise<NeonDataApiSnapshot>;
227
+ /** List branchable object-storage buckets visible on a branch. */
228
+ listBranchBuckets(projectId: string, branchId: string): Promise<NeonBucketSnapshot[]>;
229
+ /** Create a bucket on a branch. Used by `pushConfig` to honour `preview.buckets`. */
230
+ createBranchBucket(projectId: string, branchId: string, input: CreateBucketInput): Promise<NeonBucketSnapshot>;
231
+ /** Delete a bucket from a branch. */
232
+ deleteBranchBucket(projectId: string, branchId: string, bucketName: string): Promise<void>;
233
+ /** List functions on a branch. */
234
+ listBranchFunctions(projectId: string, branchId: string): Promise<NeonFunctionSnapshot[]>;
235
+ /**
236
+ * Create a function on a branch. The function has no deployment until code is deployed
237
+ * to it with {@link deployBranchFunction}.
238
+ */
239
+ createBranchFunction(projectId: string, branchId: string, input: {
240
+ slug: string;
241
+ name: string;
242
+ }): Promise<NeonFunctionSnapshot>;
243
+ /** Delete a function (by slug) from a branch. */
244
+ deleteBranchFunction(projectId: string, branchId: string, slug: string): Promise<void>;
245
+ /**
246
+ * Deploy a built bundle to a function. The newest deployment becomes active. The
247
+ * `bundle` is built (esbuild + zip) by the caller and passed in as bytes.
248
+ */
249
+ deployBranchFunction(projectId: string, branchId: string, slug: string, input: DeployFunctionInput): Promise<NeonFunctionDeploymentSnapshot>;
250
+ /**
251
+ * Whether the AI Gateway is enabled on a branch. Toggle-style, like Neon Auth / Data
252
+ * API: used by both `fetchEnv` (to decide visibility) and `pushConfig` (to diff intent).
253
+ */
254
+ getAiGatewayEnabled(projectId: string, branchId: string): Promise<boolean>;
255
+ /** Enable the AI Gateway on a branch. Idempotent. */
256
+ enableAiGateway(projectId: string, branchId: string): Promise<void>;
257
+ /** Disable the AI Gateway on a branch. Idempotent. */
258
+ disableAiGateway(projectId: string, branchId: string): Promise<void>;
259
+ }
260
+ //#endregion
261
+ export { CreateBranchInput, CreateBucketInput, CreateProjectInput, DeployFunctionInput, GetConnectionUriInput, NeonApi, NeonAuthSnapshot, NeonBranchSnapshot, NeonBucketSnapshot, NeonDataApiSnapshot, NeonDatabaseSnapshot, NeonEndpointSnapshot, NeonFunctionDeploymentSnapshot, NeonFunctionSnapshot, NeonProjectSnapshot, NeonRoleSnapshot, UpdateBranchInput };
262
+ //# sourceMappingURL=neon-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neon-api.d.ts","names":[],"sources":["../../src/lib/neon-api.ts"],"mappings":";;;;;;AAYA;AASA;AAUA;AAAqC,UAnBpB,mBAAA,CAmBoB;MAIb,MAAA;MACA,EAAA,MAAA;UACP,EAAA,MAAA;EAAe,SAAA,EAAA,MAAA;EAGf,KAAA,CAAA,EAAA,MAAA;EAaA,uBAAiB,CAAA,EAnCP,eAyCR;AAGnB;AAYiB,UArDA,kBAAA,CAqDgB;EAUhB,EAAA,EAAA,MAAA;EAWA,IAAA,EAAA,MAAA;EAgBA,QAAA,CAAA,EAAA,MAAA;EASA,SAAA,EAAA,OAAA;EAQA;EASA,SAAA,EAAA,OAAA;EAkBA,SAAA,CAAA,EAAA,MAAA;;AACR,UA7HQ,oBAAA,CA6HR;MACC,MAAA;UACE,EAAA,MAAA;MACE,EAAA,WAAA,GAAA,YAAA;EAAM,qBAAA,EA5HI,eA4HJ,CAAA,uBAAA,CAAA;EAMH,qBAAA,EAjIO,eAiIuB,CAAA,uBAAA,CAAA;EAW9B,cAAA,EA3IA,eA2IqB,CAAA,gBAAA,CA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AAQ;;;;;;6EAWR,QAAQ;;;;;;yFAWR,QAAQ;;0DAQR,QAAQ;;iEAMH,oBACL,QAAQ;;+EAOR;;4DAQA,QAAQ;;;;;;;;MAUR,QAAQ;;2EAOR;;;;;iFAUK,sBACL,QAAQ;;;;;4DAQ+C;;wDAGJ;;yDAGC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ //#region src/lib/patterns.d.ts
2
+ /**
3
+ * Branch-name pattern helpers. Patterns are GitHub-branch-protection style globs:
4
+ * `*` matches one or more characters within a name segment. `**` is not supported (branch
5
+ * names cannot contain `/` in Neon).
6
+ */
7
+ /** Returns `true` when the pattern contains an unescaped wildcard. */
8
+ declare function isWildcardPattern(pattern: string): boolean;
9
+ /**
10
+ * Returns `true` if `branchName` matches `pattern`. Anchors at both ends.
11
+ */
12
+ declare function matchPattern(pattern: string, branchName: string): boolean;
13
+ /**
14
+ * Substitute every `*` in `pattern` with `replacement`. When the pattern has no `*`, the
15
+ * replacement is appended with a `-` separator so the caller still gets a unique name.
16
+ *
17
+ * Pure function. The returned string is **not** validated — callers compose it from
18
+ * sources that already passed {@link validatePattern} (the pattern) and
19
+ * {@link normalizeGitBranch}-style sanitization (the replacement).
20
+ *
21
+ * @example
22
+ * fillPattern("preview-*", "andre-feature-a1b2c3") // → "preview-andre-feature-a1b2c3"
23
+ * fillPattern("feat-*-staging", "x") // → "feat-x-staging"
24
+ * fillPattern("specific", "x") // → "specific-x"
25
+ */
26
+ declare function fillPattern(pattern: string, replacement: string): string;
27
+ /**
28
+ * Validate a branch pattern. Pure — returns either `{ ok: true }` or `{ error: string }`.
29
+ *
30
+ * Rules:
31
+ * - Non-empty after trim, no leading/trailing whitespace.
32
+ * - Length <= 256 (Neon branch name max).
33
+ * - May contain `*`, ASCII letters/digits, and the punctuation Neon allows in branch names:
34
+ * `-`, `_`, `.`, `/`. Whitespace and regex meta-characters other than `*` are rejected.
35
+ */
36
+ declare function validatePattern(pattern: string): {
37
+ ok: true;
38
+ } | {
39
+ error: string;
40
+ };
41
+ //#endregion
42
+ export { fillPattern, isWildcardPattern, matchPattern, validatePattern };
43
+ //# sourceMappingURL=patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patterns.d.ts","names":[],"sources":["../../src/lib/patterns.ts"],"mappings":";;AAOA;AAOA;AAkBA;AAcA;;iBAvCgB,iBAAA;;;;iBAOA,YAAA;;;;;;;;;;;;;;iBAkBA,WAAA;;;;;;;;;;iBAcA,eAAA"}
@@ -0,0 +1,76 @@
1
+ //#region src/lib/patterns.ts
2
+ /**
3
+ * Branch-name pattern helpers. Patterns are GitHub-branch-protection style globs:
4
+ * `*` matches one or more characters within a name segment. `**` is not supported (branch
5
+ * names cannot contain `/` in Neon).
6
+ */
7
+ /** Returns `true` when the pattern contains an unescaped wildcard. */
8
+ function isWildcardPattern(pattern) {
9
+ return pattern.includes("*");
10
+ }
11
+ /**
12
+ * Returns `true` if `branchName` matches `pattern`. Anchors at both ends.
13
+ */
14
+ function matchPattern(pattern, branchName) {
15
+ return patternToRegex(pattern).test(branchName);
16
+ }
17
+ /**
18
+ * Substitute every `*` in `pattern` with `replacement`. When the pattern has no `*`, the
19
+ * replacement is appended with a `-` separator so the caller still gets a unique name.
20
+ *
21
+ * Pure function. The returned string is **not** validated — callers compose it from
22
+ * sources that already passed {@link validatePattern} (the pattern) and
23
+ * {@link normalizeGitBranch}-style sanitization (the replacement).
24
+ *
25
+ * @example
26
+ * fillPattern("preview-*", "andre-feature-a1b2c3") // → "preview-andre-feature-a1b2c3"
27
+ * fillPattern("feat-*-staging", "x") // → "feat-x-staging"
28
+ * fillPattern("specific", "x") // → "specific-x"
29
+ */
30
+ function fillPattern(pattern, replacement) {
31
+ if (!isWildcardPattern(pattern)) return `${pattern}-${replacement}`;
32
+ return pattern.replaceAll("*", replacement);
33
+ }
34
+ /**
35
+ * Validate a branch pattern. Pure — returns either `{ ok: true }` or `{ error: string }`.
36
+ *
37
+ * Rules:
38
+ * - Non-empty after trim, no leading/trailing whitespace.
39
+ * - Length <= 256 (Neon branch name max).
40
+ * - May contain `*`, ASCII letters/digits, and the punctuation Neon allows in branch names:
41
+ * `-`, `_`, `.`, `/`. Whitespace and regex meta-characters other than `*` are rejected.
42
+ */
43
+ function validatePattern(pattern) {
44
+ const trimmed = pattern.trim();
45
+ if (trimmed === "") return { error: "branch pattern is empty" };
46
+ if (trimmed !== pattern) return { error: `branch pattern has leading or trailing whitespace: ${JSON.stringify(pattern)}` };
47
+ if (trimmed.length > 256) return { error: `branch pattern exceeds 256 characters: ${trimmed.length} chars` };
48
+ if (!/^[A-Za-z0-9._\-*/]+$/.test(trimmed)) return { error: `branch pattern contains unsupported characters; allowed: letters, digits, '-', '_', '.', '/', '*' (got ${JSON.stringify(pattern)})` };
49
+ return { ok: true };
50
+ }
51
+ function patternToRegex(pattern) {
52
+ let body = "";
53
+ for (const ch of pattern) if (ch === "*") body += ".*";
54
+ else if (REGEX_META.has(ch)) body += `\\${ch}`;
55
+ else body += ch;
56
+ return new RegExp(`^${body}$`);
57
+ }
58
+ const REGEX_META = new Set([
59
+ ".",
60
+ "+",
61
+ "?",
62
+ "^",
63
+ "$",
64
+ "(",
65
+ ")",
66
+ "[",
67
+ "]",
68
+ "{",
69
+ "}",
70
+ "|",
71
+ "\\"
72
+ ]);
73
+ //#endregion
74
+ export { fillPattern, isWildcardPattern, matchPattern, validatePattern };
75
+
76
+ //# sourceMappingURL=patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patterns.js","names":[],"sources":["../../src/lib/patterns.ts"],"sourcesContent":["/**\n * Branch-name pattern helpers. Patterns are GitHub-branch-protection style globs:\n * `*` matches one or more characters within a name segment. `**` is not supported (branch\n * names cannot contain `/` in Neon).\n */\n\n/** Returns `true` when the pattern contains an unescaped wildcard. */\nexport function isWildcardPattern(pattern: string): boolean {\n\treturn pattern.includes(\"*\");\n}\n\n/**\n * Returns `true` if `branchName` matches `pattern`. Anchors at both ends.\n */\nexport function matchPattern(pattern: string, branchName: string): boolean {\n\tconst regex = patternToRegex(pattern);\n\treturn regex.test(branchName);\n}\n\n/**\n * Substitute every `*` in `pattern` with `replacement`. When the pattern has no `*`, the\n * replacement is appended with a `-` separator so the caller still gets a unique name.\n *\n * Pure function. The returned string is **not** validated — callers compose it from\n * sources that already passed {@link validatePattern} (the pattern) and\n * {@link normalizeGitBranch}-style sanitization (the replacement).\n *\n * @example\n * fillPattern(\"preview-*\", \"andre-feature-a1b2c3\") // → \"preview-andre-feature-a1b2c3\"\n * fillPattern(\"feat-*-staging\", \"x\") // → \"feat-x-staging\"\n * fillPattern(\"specific\", \"x\") // → \"specific-x\"\n */\nexport function fillPattern(pattern: string, replacement: string): string {\n\tif (!isWildcardPattern(pattern)) return `${pattern}-${replacement}`;\n\treturn pattern.replaceAll(\"*\", replacement);\n}\n\n/**\n * Validate a branch pattern. Pure — returns either `{ ok: true }` or `{ error: string }`.\n *\n * Rules:\n * - Non-empty after trim, no leading/trailing whitespace.\n * - Length <= 256 (Neon branch name max).\n * - May contain `*`, ASCII letters/digits, and the punctuation Neon allows in branch names:\n * `-`, `_`, `.`, `/`. Whitespace and regex meta-characters other than `*` are rejected.\n */\nexport function validatePattern(\n\tpattern: string,\n): { ok: true } | { error: string } {\n\tconst trimmed = pattern.trim();\n\tif (trimmed === \"\") return { error: \"branch pattern is empty\" };\n\tif (trimmed !== pattern) {\n\t\treturn {\n\t\t\terror: `branch pattern has leading or trailing whitespace: ${JSON.stringify(pattern)}`,\n\t\t};\n\t}\n\tif (trimmed.length > 256) {\n\t\treturn {\n\t\t\terror: `branch pattern exceeds 256 characters: ${trimmed.length} chars`,\n\t\t};\n\t}\n\tif (!/^[A-Za-z0-9._\\-*/]+$/.test(trimmed)) {\n\t\treturn {\n\t\t\terror: `branch pattern contains unsupported characters; allowed: letters, digits, '-', '_', '.', '/', '*' (got ${JSON.stringify(pattern)})`,\n\t\t};\n\t}\n\treturn { ok: true };\n}\n\nfunction patternToRegex(pattern: string): RegExp {\n\tlet body = \"\";\n\tfor (const ch of pattern) {\n\t\tif (ch === \"*\") {\n\t\t\tbody += \".*\";\n\t\t} else if (REGEX_META.has(ch)) {\n\t\t\tbody += `\\\\${ch}`;\n\t\t} else {\n\t\t\tbody += ch;\n\t\t}\n\t}\n\treturn new RegExp(`^${body}$`);\n}\n\nconst REGEX_META = new Set([\n\t\".\",\n\t\"+\",\n\t\"?\",\n\t\"^\",\n\t\"$\",\n\t\"(\",\n\t\")\",\n\t\"[\",\n\t\"]\",\n\t\"{\",\n\t\"}\",\n\t\"|\",\n\t\"\\\\\",\n]);\n"],"mappings":";;;;;;;AAOA,SAAgB,kBAAkB,SAA0B;CAC3D,OAAO,QAAQ,SAAS,GAAG;AAC5B;;;;AAKA,SAAgB,aAAa,SAAiB,YAA6B;CAE1E,OADc,eAAe,OAClB,EAAE,KAAK,UAAU;AAC7B;;;;;;;;;;;;;;AAeA,SAAgB,YAAY,SAAiB,aAA6B;CACzE,IAAI,CAAC,kBAAkB,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG;CACtD,OAAO,QAAQ,WAAW,KAAK,WAAW;AAC3C;;;;;;;;;;AAWA,SAAgB,gBACf,SACmC;CACnC,MAAM,UAAU,QAAQ,KAAK;CAC7B,IAAI,YAAY,IAAI,OAAO,EAAE,OAAO,0BAA0B;CAC9D,IAAI,YAAY,SACf,OAAO,EACN,OAAO,sDAAsD,KAAK,UAAU,OAAO,IACpF;CAED,IAAI,QAAQ,SAAS,KACpB,OAAO,EACN,OAAO,0CAA0C,QAAQ,OAAO,QACjE;CAED,IAAI,CAAC,uBAAuB,KAAK,OAAO,GACvC,OAAO,EACN,OAAO,0GAA0G,KAAK,UAAU,OAAO,EAAE,GAC1I;CAED,OAAO,EAAE,IAAI,KAAK;AACnB;AAEA,SAAS,eAAe,SAAyB;CAChD,IAAI,OAAO;CACX,KAAK,MAAM,MAAM,SAChB,IAAI,OAAO,KACV,QAAQ;MACF,IAAI,WAAW,IAAI,EAAE,GAC3B,QAAQ,KAAK;MAEb,QAAQ;CAGV,OAAO,IAAI,OAAO,IAAI,KAAK,EAAE;AAC9B;AAEA,MAAM,aAAa,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/lib/schema.d.ts
4
+
5
+ /**
6
+ * Zod schema for {@link import("./types.js").ComputeSettings}.
7
+ *
8
+ * - CU values must be one of: 0.25, 0.5, 1, 2, 4, 8
9
+ * - `suspendTimeout` can be:
10
+ * - `false` (never suspend)
11
+ * - duration string like "5m", "1h" (must be 60s-604800s when parsed)
12
+ * - number in seconds (60-604800, or -1/0 for special values)
13
+ * - `undefined` (use platform default)
14
+ *
15
+ * Cross-field invariants (min <= max) are enforced via `superRefine`.
16
+ */
17
+ declare const computeSettingsSchema: z.ZodObject<{
18
+ autoscalingLimitMinCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
19
+ autoscalingLimitMaxCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
20
+ suspendTimeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodString, z.ZodNumber]>>;
21
+ }, z.core.$strict>;
22
+ declare const serviceToggleSchema: z.ZodObject<{
23
+ enabled: z.ZodOptional<z.ZodBoolean>;
24
+ }, z.core.$strict>;
25
+ declare const postgresConfigSchema: z.ZodObject<{
26
+ computeSettings: z.ZodOptional<z.ZodObject<{
27
+ autoscalingLimitMinCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
28
+ autoscalingLimitMaxCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
29
+ suspendTimeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodString, z.ZodNumber]>>;
30
+ }, z.core.$strict>>;
31
+ }, z.core.$strict>;
32
+ declare const functionConfigSchema: z.ZodObject<{
33
+ slug: z.ZodString;
34
+ name: z.ZodString;
35
+ source: z.ZodString;
36
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
37
+ runtime: z.ZodOptional<z.ZodLiteral<"nodejs24">>;
38
+ memoryMib: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<256>, z.ZodLiteral<512>, z.ZodLiteral<1024>, z.ZodLiteral<2048>, z.ZodLiteral<4096>, z.ZodLiteral<8192>]>>;
39
+ }, z.core.$strict>;
40
+ declare const bucketConfigSchema: z.ZodObject<{
41
+ name: z.ZodString;
42
+ access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"private">, z.ZodLiteral<"public_read">]>>;
43
+ }, z.core.$strict>;
44
+ declare const previewConfigSchema: z.ZodObject<{
45
+ functions: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ slug: z.ZodString;
47
+ name: z.ZodString;
48
+ source: z.ZodString;
49
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
50
+ runtime: z.ZodOptional<z.ZodLiteral<"nodejs24">>;
51
+ memoryMib: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<256>, z.ZodLiteral<512>, z.ZodLiteral<1024>, z.ZodLiteral<2048>, z.ZodLiteral<4096>, z.ZodLiteral<8192>]>>;
52
+ }, z.core.$strict>>>;
53
+ buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
+ name: z.ZodString;
55
+ access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"private">, z.ZodLiteral<"public_read">]>>;
56
+ }, z.core.$strict>>>;
57
+ aiGateway: z.ZodOptional<z.ZodObject<{
58
+ enabled: z.ZodOptional<z.ZodBoolean>;
59
+ }, z.core.$strict>>;
60
+ }, z.core.$strict>;
61
+ declare const branchConfigSchema: z.ZodObject<{
62
+ parent: z.ZodOptional<z.ZodString>;
63
+ protected: z.ZodOptional<z.ZodBoolean>;
64
+ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
65
+ postgres: z.ZodOptional<z.ZodObject<{
66
+ computeSettings: z.ZodOptional<z.ZodObject<{
67
+ autoscalingLimitMinCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
68
+ autoscalingLimitMaxCu: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
69
+ suspendTimeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodString, z.ZodNumber]>>;
70
+ }, z.core.$strict>>;
71
+ }, z.core.$strict>>;
72
+ auth: z.ZodOptional<z.ZodObject<{
73
+ enabled: z.ZodOptional<z.ZodBoolean>;
74
+ }, z.core.$strict>>;
75
+ dataApi: z.ZodOptional<z.ZodObject<{
76
+ enabled: z.ZodOptional<z.ZodBoolean>;
77
+ }, z.core.$strict>>;
78
+ preview: z.ZodOptional<z.ZodObject<{
79
+ functions: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ slug: z.ZodString;
81
+ name: z.ZodString;
82
+ source: z.ZodString;
83
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ runtime: z.ZodOptional<z.ZodLiteral<"nodejs24">>;
85
+ memoryMib: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<256>, z.ZodLiteral<512>, z.ZodLiteral<1024>, z.ZodLiteral<2048>, z.ZodLiteral<4096>, z.ZodLiteral<8192>]>>;
86
+ }, z.core.$strict>>>;
87
+ buckets: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ name: z.ZodString;
89
+ access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"private">, z.ZodLiteral<"public_read">]>>;
90
+ }, z.core.$strict>>>;
91
+ aiGateway: z.ZodOptional<z.ZodObject<{
92
+ enabled: z.ZodOptional<z.ZodBoolean>;
93
+ }, z.core.$strict>>;
94
+ }, z.core.$strict>>;
95
+ }, z.core.$strict>;
96
+ declare const configSchema: z.ZodFunction<z.ZodTuple<readonly [z.ZodUnknown], null>, z.ZodUnknown>;
97
+ /**
98
+ * Convert the structured {@link z.ZodError} produced by `configSchema.safeParse` into the
99
+ * `string[]` shape used by {@link import("./errors.js").ConfigValidationError}.
100
+ *
101
+ * Issue paths are rendered as dot-separated property accesses (`postgres.computeSettings`)
102
+ * and unknown-key issues from `strictObject` are normalised so the message contains the
103
+ * substring "unknown key" — keeping pre-zod assertions in test suites and downstream tools
104
+ * stable.
105
+ */
106
+ declare function formatZodIssues(error: z.ZodError): string[];
107
+ //#endregion
108
+ export { branchConfigSchema, bucketConfigSchema, computeSettingsSchema, configSchema, formatZodIssues, functionConfigSchema, postgresConfigSchema, previewConfigSchema, serviceToggleSchema };
109
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/lib/schema.ts"],"mappings":";;;;;;AAgBA;;;;;;;;;;cAAa,uBAAqB,CAAA,CAAA;;;;;cAgDrB,qBAAmB,CAAA,CAAA;;;cAInB,sBAAoB,CAAA,CAAA;;;;;;iBApDC,CAAA;AAAA,cA0ErB,oBA1EqB,EA0ED,CAAA,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