@neondatabase/config-runtime 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 (43) hide show
  1. package/LICENSE.md +178 -0
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.js +6 -0
  4. package/dist/lib/function-bundle.d.ts +25 -0
  5. package/dist/lib/function-bundle.d.ts.map +1 -0
  6. package/dist/lib/function-bundle.js +65 -0
  7. package/dist/lib/function-bundle.js.map +1 -0
  8. package/dist/lib/operations.d.ts +70 -0
  9. package/dist/lib/operations.d.ts.map +1 -0
  10. package/dist/lib/operations.js +60 -0
  11. package/dist/lib/operations.js.map +1 -0
  12. package/dist/lib/pull-config.d.ts +59 -0
  13. package/dist/lib/pull-config.d.ts.map +1 -0
  14. package/dist/lib/pull-config.js +93 -0
  15. package/dist/lib/pull-config.js.map +1 -0
  16. package/dist/lib/push-config.d.ts +104 -0
  17. package/dist/lib/push-config.d.ts.map +1 -0
  18. package/dist/lib/push-config.js +389 -0
  19. package/dist/lib/push-config.js.map +1 -0
  20. package/dist/v1.d.ts +6 -0
  21. package/dist/v1.js +6 -0
  22. package/package.json +69 -22
  23. package/e2e/conflict.e2e.test.ts +0 -34
  24. package/e2e/helpers.ts +0 -204
  25. package/e2e/lifecycle.e2e.test.ts +0 -50
  26. package/e2e/load-env.ts +0 -29
  27. package/e2e/setup.ts +0 -24
  28. package/src/index.ts +0 -5
  29. package/src/lib/fake-neon-api.ts +0 -782
  30. package/src/lib/function-bundle.test.ts +0 -60
  31. package/src/lib/function-bundle.ts +0 -104
  32. package/src/lib/operations.test.ts +0 -150
  33. package/src/lib/operations.ts +0 -103
  34. package/src/lib/pull-config.test.ts +0 -51
  35. package/src/lib/pull-config.ts +0 -215
  36. package/src/lib/push-config.test.ts +0 -421
  37. package/src/lib/push-config.ts +0 -619
  38. package/src/v1.test.ts +0 -30
  39. package/src/v1.ts +0 -74
  40. package/tsconfig.json +0 -4
  41. package/tsdown.config.ts +0 -22
  42. package/vitest.config.ts +0 -19
  43. package/vitest.e2e.config.ts +0 -29
package/src/v1.ts DELETED
@@ -1,74 +0,0 @@
1
- /**
2
- * `@neondatabase/config-runtime/v1` — the imperative runtime for Config-as-Code on the
3
- * Neon Platform.
4
- *
5
- * `@neondatabase/config` is the **authoring** surface: `defineConfig`, types, and schemas
6
- * you import from `neon.ts`. It is intentionally free of heavy/native dependencies.
7
- *
8
- * This package is the **runtime**: it reads a branch's live state, diffs a policy against
9
- * it, applies changes, and bundles + deploys Neon Functions. Bundling pulls in `esbuild`
10
- * (a native binary), so deploy-side consumers (the neonctl CLI, CI scripts) import *this*
11
- * package — and a `neon.ts` that only imports `defineConfig` never drags esbuild into the
12
- * user's dependency tree.
13
- *
14
- * ```ts
15
- * import config from "../neon";
16
- * import { inspect, plan, apply } from "@neondatabase/config-runtime/v1";
17
- *
18
- * const target = { projectId: "patient-art-12345", branchId: "main" };
19
- * const diff = await plan(config, target); // dry-run plan, no mutations
20
- * await apply(config, target); // apply the policy to a branch
21
- * const live = await inspect(target); // read the branch's live state
22
- * ```
23
- *
24
- * `plan` / `apply` mirror the Terraform mental model. No CLI commands are shipped here, and
25
- * no `.neon` files or `NEON_*` env vars are read — resolve project/branch in your CLI (e.g.
26
- * neonctl) and pass them in.
27
- */
28
-
29
- export type {
30
- AppliedChange,
31
- Config,
32
- ConflictReport,
33
- LoadConfigOptions,
34
- NeonApi,
35
- PushResult,
36
- } from "@neondatabase/config";
37
- // ─── Re-exports from @neondatabase/config for convenience ─────────────────────
38
- // Runtime callers usually want a few authoring-side symbols alongside the operations
39
- // (the errors `apply`/`pushConfig` throw, the result types they return, and the loader).
40
- // Re-export the common ones so a deploy script can import everything it needs from one
41
- // place, while `neon.ts` keeps importing the lean `@neondatabase/config`.
42
- export {
43
- ConfigLoadError,
44
- ConfigValidationError,
45
- createNeonApiFromOptions,
46
- createRealNeonApi,
47
- defineConfig,
48
- ErrorCode,
49
- loadConfigFromFile,
50
- MissingContextError,
51
- PlatformError,
52
- PushAbortedError,
53
- PushConflictError,
54
- } from "@neondatabase/config";
55
- // ─── Function bundling (esbuild + zip) ────────────────────────────────────────
56
- export { buildFunctionBundle } from "./lib/function-bundle.js";
57
- // ─── Operations (intent-revealing entry points) ───────────────────────────────
58
- export type {
59
- ApplyOptions,
60
- ConfigOperationOptions,
61
- } from "./lib/operations.js";
62
- export { apply, inspect, plan } from "./lib/operations.js";
63
- // ─── Engine (advanced / programmatic use) ─────────────────────────────────────
64
- export type {
65
- PullConfigOptions,
66
- PulledBranchConfig,
67
- PulledPreview,
68
- } from "./lib/pull-config.js";
69
- export { pullConfig } from "./lib/pull-config.js";
70
- export type {
71
- PushConfigOptions,
72
- PushConfirmContext,
73
- } from "./lib/push-config.js";
74
- export { pushConfig } from "./lib/push-config.js";
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "include": ["src", "e2e", "vitest.config.ts", "vitest.e2e.config.ts", "tsdown.config.ts"]
4
- }
package/tsdown.config.ts DELETED
@@ -1,22 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- name: "@neondatabase/config-runtime",
5
- bundle: false,
6
- clean: true,
7
- dts: true,
8
- entry: [
9
- "src/index.ts",
10
- "src/v1.ts",
11
- "src/lib/**/*.ts",
12
- "!src/**/*.test.*",
13
- "!src/lib/fake-neon-api.ts",
14
- ],
15
- format: "esm",
16
- outDir: "dist",
17
- treeshake: true,
18
- // esbuild and fflate are real, auto-installed dependencies of this package — but they
19
- // must stay external so the published runtime resolves them from node_modules rather
20
- // than inlining esbuild's native binary into the bundle.
21
- external: ["esbuild", "fflate", "@neondatabase/config"],
22
- });
package/vitest.config.ts DELETED
@@ -1,19 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- clearMocks: true,
6
- mockReset: true,
7
- unstubEnvs: true,
8
- coverage: {
9
- all: true,
10
- include: ["src"],
11
- exclude: ["src/**/*.test.ts"],
12
- reporter: ["html", "lcov"],
13
- },
14
- // Skip e2e tests (which talk to the real Neon API) in the standard suite — they
15
- // run via `pnpm test:e2e` against `vitest.e2e.config.ts`.
16
- exclude: ["lib", "node_modules", "dist", "**/*.e2e.test.ts", "e2e/**"],
17
- setupFiles: ["console-fail-test/setup"],
18
- },
19
- });
@@ -1,29 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- /**
4
- * Vitest config for end-to-end tests that hit the **real** Neon API.
5
- *
6
- * - Matches `**\/*.e2e.test.ts` only — the standard `test:ci` config explicitly excludes
7
- * this pattern so the two suites never collide.
8
- * - Uses long per-test timeouts because real project creation / deletion can take 10+s.
9
- * - Forces single-threaded execution to avoid quota / rate-limit interference between
10
- * tests (`pool: "forks"` with `singleFork: true`).
11
- * - Loads `.env` via Vitest's built-in dotenv support so `NEON_API_KEY` (and optionally
12
- * `NEON_ORG_ID`) become `process.env` entries inside the tests.
13
- */
14
- export default defineConfig({
15
- test: {
16
- include: ["src/**/*.e2e.test.ts", "e2e/**/*.test.ts"],
17
- exclude: ["node_modules", "dist"],
18
- setupFiles: ["./e2e/load-env.ts", "./e2e/setup.ts"],
19
- testTimeout: 120_000,
20
- hookTimeout: 120_000,
21
- pool: "forks",
22
- poolOptions: {
23
- forks: {
24
- singleFork: true,
25
- },
26
- },
27
- reporters: ["verbose"],
28
- },
29
- });