@neondatabase/config 0.2.0 → 0.4.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.
package/dist/v1.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AppliedChange, BranchConfig, BranchTarget, BucketAccessLevel, BucketConfig, ComputeSettings, Config, ConflictReport, FunctionConfig, FunctionDevConfig, FunctionMemoryMib, FunctionRuntime, PostgresConfig, PreviewConfig, PushResult, ResolvedBranchConfig, ResolvedBucketConfig, ResolvedFunctionConfig, ResolvedPreviewConfig, ServiceToggle } from "./lib/types.js";
1
+ import { AppliedChange, BranchTarget, BranchTuning, BranchTuningFn, BucketAccessLevel, BucketDef, ComputeSettings, Config, ConflictReport, FunctionDef, FunctionDevConfig, FunctionRuntime, FunctionTuning, PostgresConfig, PreviewInput, PreviewTuning, PushResult, ResolvedBranchConfig, ResolvedBucketConfig, ResolvedFunctionConfig, ResolvedPreviewConfig, ServiceToggle, ServiceToggleInput } from "./lib/types.js";
2
2
  import { ConfigLoadError, ConfigValidationError, ErrorCode, MissingContextError, PlatformError, PushAbortedError, PushConflictError } from "./lib/errors.js";
3
3
  import { CreateBranchInput, CreateBucketInput, CreateProjectInput, DeployFunctionInput, GetConnectionUriInput, NeonApi, NeonAuthSnapshot, NeonBranchSnapshot, NeonBucketSnapshot, NeonDataApiSnapshot, NeonDatabaseSnapshot, NeonEndpointSnapshot, NeonFunctionDeploymentSnapshot, NeonFunctionSnapshot, NeonProjectSnapshot, NeonRoleSnapshot, UpdateBranchInput } from "./lib/neon-api.js";
4
4
  import { createNeonApiFromOptions, resolveApiKey } from "./lib/auth.js";
@@ -28,6 +28,7 @@ declare const errors: {
28
28
  readonly MissingApiKey: "PLATFORM_MISSING_API_KEY";
29
29
  readonly AmbiguousBranchAuth: "PLATFORM_AMBIGUOUS_BRANCH_AUTH";
30
30
  readonly BranchNotFound: "PLATFORM_BRANCH_NOT_FOUND";
31
+ readonly FeatureUnavailable: "PLATFORM_FEATURE_UNAVAILABLE";
31
32
  readonly MissingParentBranch: "PLATFORM_MISSING_PARENT_BRANCH";
32
33
  readonly Unauthorized: "PLATFORM_UNAUTHORIZED";
33
34
  readonly Forbidden: "PLATFORM_FORBIDDEN";
@@ -46,7 +47,33 @@ declare const errors: {
46
47
  };
47
48
  /** The zod schemas underlying `defineConfig`, grouped under product-friendly names. */
48
49
  declare const schemas: {
49
- readonly branch: zod0.ZodObject<{
50
+ readonly config: zod0.ZodObject<{
51
+ auth: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodBoolean, zod0.ZodObject<{
52
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
53
+ }, zod_v4_core0.$strict>]>>;
54
+ dataApi: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodBoolean, zod0.ZodObject<{
55
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
56
+ }, zod_v4_core0.$strict>]>>;
57
+ preview: zod0.ZodOptional<zod0.ZodObject<{
58
+ aiGateway: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodBoolean, zod0.ZodObject<{
59
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
60
+ }, zod_v4_core0.$strict>]>>;
61
+ functions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodObject<{
62
+ name: zod0.ZodString;
63
+ source: zod0.ZodString;
64
+ env: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodString>>;
65
+ dev: zod0.ZodOptional<zod0.ZodObject<{
66
+ port: zod0.ZodOptional<zod0.ZodNumber>;
67
+ portless: zod0.ZodOptional<zod0.ZodBoolean>;
68
+ }, zod_v4_core0.$strict>>;
69
+ }, zod_v4_core0.$strict>>>;
70
+ buckets: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodObject<{
71
+ access: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<"private">, zod0.ZodLiteral<"public_read">]>>;
72
+ }, zod_v4_core0.$strict>>>;
73
+ }, zod_v4_core0.$strict>>;
74
+ branch: zod0.ZodOptional<zod0.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
75
+ }, zod_v4_core0.$strict>;
76
+ readonly branchTuning: zod0.ZodObject<{
50
77
  parent: zod0.ZodOptional<zod0.ZodString>;
51
78
  protected: zod0.ZodOptional<zod0.ZodBoolean>;
52
79
  ttl: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodNumber]>>;
@@ -57,39 +84,13 @@ declare const schemas: {
57
84
  suspendTimeout: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<false>, zod0.ZodString, zod0.ZodNumber]>>;
58
85
  }, zod_v4_core0.$strict>>;
59
86
  }, zod_v4_core0.$strict>>;
60
- auth: zod0.ZodOptional<zod0.ZodObject<{
61
- enabled: zod0.ZodOptional<zod0.ZodBoolean>;
62
- }, zod_v4_core0.$strict>>;
63
- dataApi: zod0.ZodOptional<zod0.ZodObject<{
64
- enabled: zod0.ZodOptional<zod0.ZodBoolean>;
65
- }, zod_v4_core0.$strict>>;
66
87
  preview: zod0.ZodOptional<zod0.ZodObject<{
67
- functions: zod0.ZodOptional<zod0.ZodArray<zod0.ZodObject<{
68
- slug: zod0.ZodString;
69
- name: zod0.ZodString;
70
- source: zod0.ZodString;
71
- env: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodString>>;
88
+ functions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodObject<{
72
89
  runtime: zod0.ZodOptional<zod0.ZodLiteral<"nodejs24">>;
73
- memoryMib: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<256>, zod0.ZodLiteral<512>, zod0.ZodLiteral<1024>, zod0.ZodLiteral<2048>, zod0.ZodLiteral<4096>, zod0.ZodLiteral<8192>]>>;
74
- dev: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodObject<{
75
- portless: zod0.ZodLiteral<true>;
76
- port: zod0.ZodNumber;
77
- }, zod_v4_core0.$strict>, zod0.ZodObject<{
78
- portless: zod0.ZodOptional<zod0.ZodLiteral<false>>;
79
- port: zod0.ZodOptional<zod0.ZodNumber>;
80
- }, zod_v4_core0.$strict>]>>;
81
- }, zod_v4_core0.$strict>>>;
82
- buckets: zod0.ZodOptional<zod0.ZodArray<zod0.ZodObject<{
83
- name: zod0.ZodString;
84
- access: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<"private">, zod0.ZodLiteral<"public_read">]>>;
85
90
  }, zod_v4_core0.$strict>>>;
86
- aiGateway: zod0.ZodOptional<zod0.ZodObject<{
87
- enabled: zod0.ZodOptional<zod0.ZodBoolean>;
88
- }, zod_v4_core0.$strict>>;
89
91
  }, zod_v4_core0.$strict>>;
90
92
  }, zod_v4_core0.$strict>;
91
93
  readonly bucket: zod0.ZodObject<{
92
- name: zod0.ZodString;
93
94
  access: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<"private">, zod0.ZodLiteral<"public_read">]>>;
94
95
  }, zod_v4_core0.$strict>;
95
96
  readonly computeSettings: zod0.ZodObject<{
@@ -97,21 +98,17 @@ declare const schemas: {
97
98
  autoscalingLimitMaxCu: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<0.25>, zod0.ZodLiteral<0.5>, zod0.ZodLiteral<1>, zod0.ZodLiteral<2>, zod0.ZodLiteral<4>, zod0.ZodLiteral<8>]>>;
98
99
  suspendTimeout: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<false>, zod0.ZodString, zod0.ZodNumber]>>;
99
100
  }, zod_v4_core0.$strict>;
100
- readonly config: zod0.ZodFunction<zod0.ZodTuple<readonly [zod0.ZodUnknown], null>, zod0.ZodUnknown>;
101
101
  readonly function: zod0.ZodObject<{
102
- slug: zod0.ZodString;
103
102
  name: zod0.ZodString;
104
103
  source: zod0.ZodString;
105
104
  env: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodString>>;
106
- runtime: zod0.ZodOptional<zod0.ZodLiteral<"nodejs24">>;
107
- memoryMib: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<256>, zod0.ZodLiteral<512>, zod0.ZodLiteral<1024>, zod0.ZodLiteral<2048>, zod0.ZodLiteral<4096>, zod0.ZodLiteral<8192>]>>;
108
- dev: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodObject<{
109
- portless: zod0.ZodLiteral<true>;
110
- port: zod0.ZodNumber;
111
- }, zod_v4_core0.$strict>, zod0.ZodObject<{
112
- portless: zod0.ZodOptional<zod0.ZodLiteral<false>>;
105
+ dev: zod0.ZodOptional<zod0.ZodObject<{
113
106
  port: zod0.ZodOptional<zod0.ZodNumber>;
114
- }, zod_v4_core0.$strict>]>>;
107
+ portless: zod0.ZodOptional<zod0.ZodBoolean>;
108
+ }, zod_v4_core0.$strict>>;
109
+ }, zod_v4_core0.$strict>;
110
+ readonly functionTuning: zod0.ZodObject<{
111
+ runtime: zod0.ZodOptional<zod0.ZodLiteral<"nodejs24">>;
115
112
  }, zod_v4_core0.$strict>;
116
113
  readonly postgres: zod0.ZodObject<{
117
114
  computeSettings: zod0.ZodOptional<zod0.ZodObject<{
@@ -121,33 +118,29 @@ declare const schemas: {
121
118
  }, zod_v4_core0.$strict>>;
122
119
  }, zod_v4_core0.$strict>;
123
120
  readonly preview: zod0.ZodObject<{
124
- functions: zod0.ZodOptional<zod0.ZodArray<zod0.ZodObject<{
125
- slug: zod0.ZodString;
121
+ aiGateway: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodBoolean, zod0.ZodObject<{
122
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
123
+ }, zod_v4_core0.$strict>]>>;
124
+ functions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodObject<{
126
125
  name: zod0.ZodString;
127
126
  source: zod0.ZodString;
128
127
  env: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodString>>;
129
- runtime: zod0.ZodOptional<zod0.ZodLiteral<"nodejs24">>;
130
- memoryMib: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<256>, zod0.ZodLiteral<512>, zod0.ZodLiteral<1024>, zod0.ZodLiteral<2048>, zod0.ZodLiteral<4096>, zod0.ZodLiteral<8192>]>>;
131
- dev: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodObject<{
132
- portless: zod0.ZodLiteral<true>;
133
- port: zod0.ZodNumber;
134
- }, zod_v4_core0.$strict>, zod0.ZodObject<{
135
- portless: zod0.ZodOptional<zod0.ZodLiteral<false>>;
128
+ dev: zod0.ZodOptional<zod0.ZodObject<{
136
129
  port: zod0.ZodOptional<zod0.ZodNumber>;
137
- }, zod_v4_core0.$strict>]>>;
130
+ portless: zod0.ZodOptional<zod0.ZodBoolean>;
131
+ }, zod_v4_core0.$strict>>;
138
132
  }, zod_v4_core0.$strict>>>;
139
- buckets: zod0.ZodOptional<zod0.ZodArray<zod0.ZodObject<{
140
- name: zod0.ZodString;
133
+ buckets: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodObject<{
141
134
  access: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodLiteral<"private">, zod0.ZodLiteral<"public_read">]>>;
142
135
  }, zod_v4_core0.$strict>>>;
143
- aiGateway: zod0.ZodOptional<zod0.ZodObject<{
144
- enabled: zod0.ZodOptional<zod0.ZodBoolean>;
145
- }, zod_v4_core0.$strict>>;
146
136
  }, zod_v4_core0.$strict>;
147
137
  readonly service: zod0.ZodObject<{
148
138
  enabled: zod0.ZodOptional<zod0.ZodBoolean>;
149
139
  }, zod_v4_core0.$strict>;
140
+ readonly serviceInput: zod0.ZodUnion<readonly [zod0.ZodBoolean, zod0.ZodObject<{
141
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
142
+ }, zod_v4_core0.$strict>]>;
150
143
  };
151
144
  //#endregion
152
- export { type AppliedChange, type BranchConfig, type BranchTarget, type BucketAccessLevel, type BucketConfig, type ComputeSettings, type Config, ConfigLoadError, ConfigValidationError, type ConflictReport, type CreateBranchInput, type CreateBucketInput, type CreateProjectInput, type DeployFunctionInput, type DiffOptions, type DiffResult, ErrorCode, type FunctionConfig, type FunctionDevConfig, type FunctionMemoryMib, type FunctionRuntime, type GetConnectionUriInput, type LoadConfigOptions, MissingContextError, type NeonApi, type NeonAuthSnapshot, type NeonBranchSnapshot, type NeonBucketSnapshot, type NeonDataApiSnapshot, type NeonDatabaseSnapshot, type NeonEndpointSnapshot, type NeonFunctionDeploymentSnapshot, type NeonFunctionSnapshot, type NeonProjectSnapshot, type NeonRoleSnapshot, type PlanStep, PlatformError, type PostgresConfig, type PreviewConfig, PushAbortedError, PushConflictError, type PushResult, type RemotePreviewState, type RemoteServiceState, type RemoteState, type ResolvedBranchConfig, type ResolvedBucketConfig, type ResolvedFunctionConfig, type ResolvedPreviewConfig, type ServiceToggle, type UpdateBranchInput, createNeonApiFromOptions, createRealNeonApi, defineConfig, diffConfig, errors, loadConfigFromFile, resolveApiKey, resolveConfig, schemas };
145
+ export { type AppliedChange, type BranchTarget, type BranchTuning, type BranchTuningFn, type BucketAccessLevel, type BucketDef, type ComputeSettings, type Config, ConfigLoadError, ConfigValidationError, type ConflictReport, type CreateBranchInput, type CreateBucketInput, type CreateProjectInput, type DeployFunctionInput, type DiffOptions, type DiffResult, ErrorCode, type FunctionDef, type FunctionDevConfig, type FunctionRuntime, type FunctionTuning, type GetConnectionUriInput, type LoadConfigOptions, MissingContextError, type NeonApi, type NeonAuthSnapshot, type NeonBranchSnapshot, type NeonBucketSnapshot, type NeonDataApiSnapshot, type NeonDatabaseSnapshot, type NeonEndpointSnapshot, type NeonFunctionDeploymentSnapshot, type NeonFunctionSnapshot, type NeonProjectSnapshot, type NeonRoleSnapshot, type PlanStep, PlatformError, type PostgresConfig, type PreviewInput, type PreviewTuning, PushAbortedError, PushConflictError, type PushResult, type RemotePreviewState, type RemoteServiceState, type RemoteState, type ResolvedBranchConfig, type ResolvedBucketConfig, type ResolvedFunctionConfig, type ResolvedPreviewConfig, type ServiceToggle, type ServiceToggleInput, type UpdateBranchInput, createNeonApiFromOptions, createRealNeonApi, defineConfig, diffConfig, errors, loadConfigFromFile, resolveApiKey, resolveConfig, schemas };
153
146
  //# sourceMappingURL=v1.d.ts.map
package/dist/v1.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v1.d.ts","names":[],"sources":["../src/v1.ts"],"mappings":";;;;;;;;;;;;;;;;;cA0Da;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAWA;;6BASH,IAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"v1.d.ts","names":[],"sources":["../src/v1.ts"],"mappings":";;;;;;;;;;;;;;;;;cA4Da;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAWA;;mDAWH,IAAA,CAAA,UAAA"}
package/dist/v1.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConfigLoadError, ConfigValidationError, ErrorCode, MissingContextError, PlatformError, PushAbortedError, PushConflictError } from "./lib/errors.js";
2
- import { branchConfigSchema, bucketConfigSchema, computeSettingsSchema, configSchema, functionConfigSchema, postgresConfigSchema, previewConfigSchema, serviceToggleSchema } from "./lib/schema.js";
2
+ import { branchTuningSchema, bucketDefSchema, computeSettingsSchema, configInputSchema, functionDefSchema, functionTuningSchema, postgresConfigSchema, previewInputSchema, serviceToggleInputSchema, serviceToggleSchema } from "./lib/schema.js";
3
3
  import { createRealNeonApi } from "./lib/neon-api-real.js";
4
4
  import { createNeonApiFromOptions, resolveApiKey } from "./lib/auth.js";
5
5
  import { defineConfig, resolveConfig } from "./lib/define-config.js";
@@ -54,14 +54,16 @@ const errors = {
54
54
  };
55
55
  /** The zod schemas underlying `defineConfig`, grouped under product-friendly names. */
56
56
  const schemas = {
57
- branch: branchConfigSchema,
58
- bucket: bucketConfigSchema,
57
+ config: configInputSchema,
58
+ branchTuning: branchTuningSchema,
59
+ bucket: bucketDefSchema,
59
60
  computeSettings: computeSettingsSchema,
60
- config: configSchema,
61
- function: functionConfigSchema,
61
+ function: functionDefSchema,
62
+ functionTuning: functionTuningSchema,
62
63
  postgres: postgresConfigSchema,
63
- preview: previewConfigSchema,
64
- service: serviceToggleSchema
64
+ preview: previewInputSchema,
65
+ service: serviceToggleSchema,
66
+ serviceInput: serviceToggleInputSchema
65
67
  };
66
68
  //#endregion
67
69
  export { ConfigLoadError, ConfigValidationError, ErrorCode, MissingContextError, PlatformError, PushAbortedError, PushConflictError, createNeonApiFromOptions, createRealNeonApi, defineConfig, diffConfig, errors, loadConfigFromFile, resolveApiKey, resolveConfig, schemas };
package/dist/v1.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v1.js","names":[],"sources":["../src/v1.ts"],"sourcesContent":["/**\n * `@neondatabase/config/v1` — the v1 public API for Config-as-Code on the Neon Platform.\n *\n * Usage in `neon.ts`:\n * ```ts\n * import { defineConfig } from \"@neondatabase/config/v1\";\n *\n * export default defineConfig((branch) => {\n * if (branch.name === \"main\") return { protected: true, auth: {} };\n * return { parent: \"main\", ttl: \"7d\" };\n * });\n * ```\n *\n * This is the **authoring** surface — `defineConfig`, types, schemas, the pure diff engine,\n * and the Neon API adapter. It is intentionally free of heavy/native dependencies so that\n * importing it from `neon.ts` stays cheap and bundler-safe.\n *\n * The imperative operations (`inspect` / `plan` / `apply`, `pushConfig` / `pullConfig`) and\n * function bundling/deploy live in **`@neondatabase/config-runtime`**, which depends on this\n * package and pulls in `esbuild`. Import that from your CLI / CI, not from `neon.ts`:\n * ```ts\n * import config from \"../neon\";\n * import { inspect, plan, apply } from \"@neondatabase/config-runtime/v1\";\n * ```\n *\n * Surface guidelines:\n * - Top-level: `defineConfig` / `resolveConfig`, the pure `diffConfig` engine, the\n * `createRealNeonApi` adapter + `NeonApi` types, the config loader, the `PlatformError`\n * base class + `ErrorCode` enum, and the config types used in `neon.ts`.\n * - `errors` namespace: specific `PlatformError` subclasses (`ConfigLoadError`,\n * `PushConflictError`, …).\n * - `schemas` namespace: the zod schemas underlying `defineConfig`.\n */\n\nimport {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} from \"./lib/errors.js\";\nimport {\n\tbranchConfigSchema,\n\tbucketConfigSchema,\n\tcomputeSettingsSchema,\n\tconfigSchema,\n\tfunctionConfigSchema,\n\tpostgresConfigSchema,\n\tpreviewConfigSchema,\n\tserviceToggleSchema,\n} from \"./lib/schema.js\";\n\n/**\n * Specific `PlatformError` subclasses, grouped for `instanceof` / structured access.\n * Also available as top-level exports.\n */\nexport const errors = {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} as const;\n\n/** The zod schemas underlying `defineConfig`, grouped under product-friendly names. */\nexport const schemas = {\n\tbranch: branchConfigSchema,\n\tbucket: bucketConfigSchema,\n\tcomputeSettings: computeSettingsSchema,\n\tconfig: configSchema,\n\tfunction: functionConfigSchema,\n\tpostgres: postgresConfigSchema,\n\tpreview: previewConfigSchema,\n\tservice: serviceToggleSchema,\n} as const;\n\n// ─── Lower-level adapters ──────────────────────────────────────────────────────\nexport { createNeonApiFromOptions, resolveApiKey } from \"./lib/auth.js\";\nexport { defineConfig, resolveConfig } from \"./lib/define-config.js\";\n// ─── Diff engine (pure; consumed by @neondatabase/config-runtime) ─────────────\nexport type {\n\tDiffOptions,\n\tDiffResult,\n\tPlanStep,\n\tRemotePreviewState,\n\tRemoteServiceState,\n\tRemoteState,\n} from \"./lib/diff.js\";\nexport { diffConfig } from \"./lib/diff.js\";\n// ─── Errors ────────────────────────────────────────────────────────────────────\nexport {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} from \"./lib/errors.js\";\nexport type { LoadConfigOptions } from \"./lib/loader.js\";\nexport { loadConfigFromFile } from \"./lib/loader.js\";\n// ─── NeonApi types (needed by callers implementing their own adapters) ────────\nexport 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 \"./lib/neon-api.js\";\nexport { createRealNeonApi } from \"./lib/neon-api-real.js\";\n// ─── Config types (used in neon.ts and in operation return values) ────────────\nexport type {\n\tAppliedChange,\n\tBranchConfig,\n\tBranchTarget,\n\tBucketAccessLevel,\n\tBucketConfig,\n\tComputeSettings,\n\tConfig,\n\tConflictReport,\n\tFunctionConfig,\n\tFunctionDevConfig,\n\tFunctionMemoryMib,\n\tFunctionRuntime,\n\tPostgresConfig,\n\tPreviewConfig,\n\tPushResult,\n\tResolvedBranchConfig,\n\tResolvedBucketConfig,\n\tResolvedFunctionConfig,\n\tResolvedPreviewConfig,\n\tServiceToggle,\n} from \"./lib/types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAa,SAAS;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,MAAa,UAAU;CACtB,QAAQ;CACR,QAAQ;CACR,iBAAiB;CACjB,QAAQ;CACR,UAAU;CACV,UAAU;CACV,SAAS;CACT,SAAS;AACV"}
1
+ {"version":3,"file":"v1.js","names":[],"sources":["../src/v1.ts"],"sourcesContent":["/**\n * `@neondatabase/config/v1` — the v1 public API for Config-as-Code on the Neon Platform.\n *\n * Usage in `neon.ts`:\n * ```ts\n * import { defineConfig } from \"@neondatabase/config/v1\";\n *\n * export default defineConfig((branch) => {\n * if (branch.name === \"main\") return { protected: true, auth: {} };\n * return { parent: \"main\", ttl: \"7d\" };\n * });\n * ```\n *\n * This is the **authoring** surface — `defineConfig`, types, schemas, the pure diff engine,\n * and the Neon API adapter. It is intentionally free of heavy/native dependencies so that\n * importing it from `neon.ts` stays cheap and bundler-safe.\n *\n * The imperative operations (`inspect` / `plan` / `apply`, `pushConfig` / `pullConfig`) and\n * function bundling/deploy live in **`@neondatabase/config-runtime`**, which depends on this\n * package and pulls in `esbuild`. Import that from your CLI / CI, not from `neon.ts`:\n * ```ts\n * import config from \"../neon\";\n * import { inspect, plan, apply } from \"@neondatabase/config-runtime/v1\";\n * ```\n *\n * Surface guidelines:\n * - Top-level: `defineConfig` / `resolveConfig`, the pure `diffConfig` engine, the\n * `createRealNeonApi` adapter + `NeonApi` types, the config loader, the `PlatformError`\n * base class + `ErrorCode` enum, and the config types used in `neon.ts`.\n * - `errors` namespace: specific `PlatformError` subclasses (`ConfigLoadError`,\n * `PushConflictError`, …).\n * - `schemas` namespace: the zod schemas underlying `defineConfig`.\n */\n\nimport {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} from \"./lib/errors.js\";\nimport {\n\tbranchTuningSchema,\n\tbucketDefSchema,\n\tcomputeSettingsSchema,\n\tconfigInputSchema,\n\tfunctionDefSchema,\n\tfunctionTuningSchema,\n\tpostgresConfigSchema,\n\tpreviewInputSchema,\n\tserviceToggleInputSchema,\n\tserviceToggleSchema,\n} from \"./lib/schema.js\";\n\n/**\n * Specific `PlatformError` subclasses, grouped for `instanceof` / structured access.\n * Also available as top-level exports.\n */\nexport const errors = {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} as const;\n\n/** The zod schemas underlying `defineConfig`, grouped under product-friendly names. */\nexport const schemas = {\n\tconfig: configInputSchema,\n\tbranchTuning: branchTuningSchema,\n\tbucket: bucketDefSchema,\n\tcomputeSettings: computeSettingsSchema,\n\tfunction: functionDefSchema,\n\tfunctionTuning: functionTuningSchema,\n\tpostgres: postgresConfigSchema,\n\tpreview: previewInputSchema,\n\tservice: serviceToggleSchema,\n\tserviceInput: serviceToggleInputSchema,\n} as const;\n\n// ─── Lower-level adapters ──────────────────────────────────────────────────────\nexport { createNeonApiFromOptions, resolveApiKey } from \"./lib/auth.js\";\nexport { defineConfig, resolveConfig } from \"./lib/define-config.js\";\n// ─── Diff engine (pure; consumed by @neondatabase/config-runtime) ─────────────\nexport type {\n\tDiffOptions,\n\tDiffResult,\n\tPlanStep,\n\tRemotePreviewState,\n\tRemoteServiceState,\n\tRemoteState,\n} from \"./lib/diff.js\";\nexport { diffConfig } from \"./lib/diff.js\";\n// ─── Errors ────────────────────────────────────────────────────────────────────\nexport {\n\tConfigLoadError,\n\tConfigValidationError,\n\tErrorCode,\n\tMissingContextError,\n\tPlatformError,\n\tPushAbortedError,\n\tPushConflictError,\n} from \"./lib/errors.js\";\nexport type { LoadConfigOptions } from \"./lib/loader.js\";\nexport { loadConfigFromFile } from \"./lib/loader.js\";\n// ─── NeonApi types (needed by callers implementing their own adapters) ────────\nexport 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 \"./lib/neon-api.js\";\nexport { createRealNeonApi } from \"./lib/neon-api-real.js\";\n// ─── Config types (used in neon.ts and in operation return values) ────────────\nexport type {\n\tAppliedChange,\n\tBranchTarget,\n\tBranchTuning,\n\tBranchTuningFn,\n\tBucketAccessLevel,\n\tBucketDef,\n\tComputeSettings,\n\tConfig,\n\tConflictReport,\n\tFunctionDef,\n\tFunctionDevConfig,\n\tFunctionRuntime,\n\tFunctionTuning,\n\tPostgresConfig,\n\tPreviewInput,\n\tPreviewTuning,\n\tPushResult,\n\tResolvedBranchConfig,\n\tResolvedBucketConfig,\n\tResolvedFunctionConfig,\n\tResolvedPreviewConfig,\n\tServiceToggle,\n\tServiceToggleInput,\n} from \"./lib/types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,SAAS;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,MAAa,UAAU;CACtB,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,iBAAiB;CACjB,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,SAAS;CACT,SAAS;CACT,cAAc;AACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neondatabase/config",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Config-as-Code for the Neon Platform. Define a `neon.ts` policy and inspect/diff/deploy it against the Neon API as plain TypeScript functions.",
5
5
  "keywords": [
6
6
  "neon",