@neon/config-runtime 1.10.4 → 1.11.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/_virtual/_rolldown/runtime.js +1 -2
- package/dist/lib/function-bundle.d.ts +1 -2
- package/dist/lib/function-bundle.js +1 -2
- package/dist/lib/function-source.d.ts +1 -2
- package/dist/lib/function-source.js +1 -2
- package/dist/lib/function-zip.d.ts +0 -2
- package/dist/lib/function-zip.d.ts.map +1 -1
- package/dist/lib/function-zip.js +1 -2
- package/dist/lib/native-detect.d.ts +0 -2
- package/dist/lib/native-detect.d.ts.map +1 -1
- package/dist/lib/native-detect.js +1 -2
- package/dist/lib/native-packages.d.ts +0 -2
- package/dist/lib/native-packages.d.ts.map +1 -1
- package/dist/lib/native-packages.js +1 -2
- package/dist/lib/operations.d.ts +1 -2
- package/dist/lib/operations.js +1 -2
- package/dist/lib/pull-config.d.ts +17 -4
- package/dist/lib/pull-config.d.ts.map +1 -1
- package/dist/lib/pull-config.js +28 -5
- package/dist/lib/pull-config.js.map +1 -1
- package/dist/lib/push-config.d.ts +1 -2
- package/dist/lib/push-config.js +1 -2
- package/dist/lib/resolve-package.d.ts +0 -2
- package/dist/lib/resolve-package.d.ts.map +1 -1
- package/dist/lib/resolve-package.js +1 -2
- package/dist/lib/run-hook.d.ts +1 -2
- package/dist/lib/run-hook.js +1 -2
- package/dist/lib/run-hook.test-d.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js +1 -2
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js +0 -1
- package/dist/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js +1 -2
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js +1 -2
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js +1 -2
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js +1 -2
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js +1 -2
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +1 -2
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +1 -2
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +1 -2
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +1 -2
- package/dist/node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@29.1.1_@noble_ha_0258998ed4eee0dc3e7b1b8446e9e9d6/node_modules/vitest/dist/index.js +1 -2
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NativeTraceDeps } from "./native-packages.js";
|
|
2
2
|
import { ResolvedFunctionConfig } from "@neon/config";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/function-bundle.d.ts
|
|
5
5
|
/** Deploy-level ZIP. `@neon/config`'s FunctionBundler returns a file map. */
|
|
6
6
|
type FunctionBundler = (fn: ResolvedFunctionConfig) => Promise<Uint8Array>;
|
|
7
7
|
/**
|
|
@@ -22,6 +22,5 @@ type FunctionBundleOptions = {
|
|
|
22
22
|
* bundler so esbuild stays out of the pkg graph.
|
|
23
23
|
*/
|
|
24
24
|
declare function buildFunctionBundle(fn: ResolvedFunctionConfig, options?: FunctionBundleOptions): Promise<Uint8Array>;
|
|
25
|
-
//#endregion
|
|
26
25
|
export { ESM_CJS_INTEROP_BANNER, FunctionBundler, buildFunctionBundle };
|
|
27
26
|
//# sourceMappingURL=function-bundle.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { zipEntries, zipFunctionBundle } from "./function-zip.js";
|
|
|
4
4
|
import { describeNativeFinding, findUndeclaredNativePackages } from "./native-detect.js";
|
|
5
5
|
import { ErrorCode, PlatformError, packagesToStage } from "@neon/config";
|
|
6
6
|
import { basename, dirname } from "node:path";
|
|
7
|
-
|
|
7
|
+
// src/lib/function-bundle.ts
|
|
8
8
|
/**
|
|
9
9
|
* Prepended to the ESM bundle. Bundled dependencies are frequently CommonJS, but an ESM
|
|
10
10
|
* output (`format: "esm"`) has no `require` / `__filename` / `__dirname` in scope — so any
|
|
@@ -79,7 +79,6 @@ const loadEsbuild = async () => {
|
|
|
79
79
|
throw new PlatformError(ErrorCode.InvalidConfig, ["Deploying Neon Functions requires `esbuild`, which could not be loaded.", "It is a dependency of @neon/config-runtime — reinstall your dependencies (`pnpm install` / `npm install`)."].join(" "), { cause });
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
//#endregion
|
|
83
82
|
export { ESM_CJS_INTEROP_BANNER, buildFunctionBundle };
|
|
84
83
|
|
|
85
84
|
//# sourceMappingURL=function-bundle.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionBundle, ResolvedFunctionConfig } from "@neon/config";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/function-source.d.ts
|
|
4
4
|
type UnbundledVia = "none" | "no-bundle";
|
|
5
5
|
/** A file is the entry. A directory is searched in {@link FUNCTION_SOURCE_ENTRIES} order; only real files count. */
|
|
6
6
|
declare function resolveEsbuildEntry(source: string): Promise<string>;
|
|
@@ -11,6 +11,5 @@ declare function resolveEsbuildEntry(source: string): Promise<string>;
|
|
|
11
11
|
declare function bundleAsIs(fn: ResolvedFunctionConfig, options?: {
|
|
12
12
|
via?: UnbundledVia;
|
|
13
13
|
}): Promise<FunctionBundle>;
|
|
14
|
-
//#endregion
|
|
15
14
|
export { UnbundledVia, bundleAsIs, resolveEsbuildEntry };
|
|
16
15
|
//# sourceMappingURL=function-source.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorCode, FUNCTION_ARCHIVE_ENTRIES, FUNCTION_SOURCE_ENTRIES, PlatformError, isFunctionArchiveEntry, pickFunctionSourceEntry } from "@neon/config";
|
|
2
2
|
import { basename, isAbsolute, join, relative, sep } from "node:path";
|
|
3
3
|
import { readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
4
|
-
|
|
4
|
+
// src/lib/function-source.ts
|
|
5
5
|
/** A file is the entry. A directory is searched in {@link FUNCTION_SOURCE_ENTRIES} order; only real files count. */
|
|
6
6
|
async function resolveEsbuildEntry(source) {
|
|
7
7
|
let sourceStat;
|
|
@@ -81,7 +81,6 @@ const assertSymlinkInsideSource = async (abs, root, rootReal) => {
|
|
|
81
81
|
const escaped = relative(rootReal, targetReal);
|
|
82
82
|
if (escaped === ".." || escaped.startsWith(`..${sep}`) || isAbsolute(escaped)) throw new PlatformError(ErrorCode.InvalidConfig, `Function source ${root} contains a symlink that points outside the directory: ${abs}.`);
|
|
83
83
|
};
|
|
84
|
-
//#endregion
|
|
85
84
|
export { bundleAsIs, resolveEsbuildEntry };
|
|
86
85
|
|
|
87
86
|
//# sourceMappingURL=function-source.js.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//#region src/lib/function-zip.d.ts
|
|
2
1
|
/** No size check — the esbuild path without staged native files stayed unlimited. */
|
|
3
2
|
declare function zipEntries(entries: Record<string, Uint8Array>): Promise<Uint8Array>;
|
|
4
3
|
declare function zipFunctionBundle(slug: string, entries: Record<string, Uint8Array>): Promise<Uint8Array>;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { zipEntries, zipFunctionBundle };
|
|
7
5
|
//# sourceMappingURL=function-zip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-zip.d.ts","names":["zipEntries","Uint8Array","Record","Promise","zipFunctionBundle","zipEntries","entries","Record","Uint8Array","Promise","zipFunctionBundle","slug"],"sources":["../../src/lib/function-zip.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"function-zip.d.ts","names":["zipEntries","Uint8Array","Record","Promise","zipFunctionBundle","zipEntries","entries","Record","Uint8Array","Promise","zipFunctionBundle","slug"],"sources":["../../src/lib/function-zip.ts"],"mappings":";AAIsBA,iBAAAA,UAAAA,CAAUM,OAAA,EACtBJ,MADsB,CAAA,MAAA,EACPD,UADO,CAAA,CAAA,EAE7BE,OAF6B,CAErBF,UAFqB,CAAA;AAAA,iBAOVG,iBAAAA,CAPUO,IAAA,EAAA,MAAA,EAAAL,OAAA,EAStBJ,MATsB,CAAA,MAAA,EASPD,UATO,CAAA,CAAA,EAU7BE,OAV6B,CAUrBF,UAVqB,CAAA"}
|
package/dist/lib/function-zip.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertZipWithinLimits, enforceLimits } from "./native-packages.js";
|
|
2
2
|
import { ErrorCode, PlatformError } from "@neon/config";
|
|
3
|
-
|
|
3
|
+
// src/lib/function-zip.ts
|
|
4
4
|
/** No size check — the esbuild path without staged native files stayed unlimited. */
|
|
5
5
|
async function zipEntries(entries) {
|
|
6
6
|
const { zipSync } = await loadFflate();
|
|
@@ -19,7 +19,6 @@ async function loadFflate() {
|
|
|
19
19
|
throw new PlatformError(ErrorCode.InvalidConfig, ["Deploying Neon Functions requires `fflate`, which could not be loaded.", "It is a dependency of @neon/config-runtime — reinstall your dependencies (`pnpm install` / `npm install`)."].join(" "), { cause });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { zipEntries, zipFunctionBundle };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=function-zip.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/lib/native-detect.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Why a package looks like it needs its files shipped. Carried through to the message so the
|
|
4
3
|
* report states the evidence rather than a prediction about what will happen at invoke.
|
|
@@ -59,6 +58,5 @@ declare function packageNameFromInput(input: string): string | undefined;
|
|
|
59
58
|
* shipping form first because it is the one that produces a working function.
|
|
60
59
|
*/
|
|
61
60
|
declare function describeNativeFinding(slug: string, finding: NativeFinding): string;
|
|
62
|
-
//#endregion
|
|
63
61
|
export { NativeEvidence, NativeFinding, describeNativeFinding, findUndeclaredNativePackages, packageNameFromInput };
|
|
64
62
|
//# sourceMappingURL=native-detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-detect.d.ts","names":["NativeEvidence","NativeFinding","findUndeclaredNativePackages","Record","packageNameFromInput","describeNativeFinding","NativeEvidence","kind","file","dependency","script","NativeFinding","name","evidence","findUndeclaredNativePackages","options","metafile","inputs","Record","declared","projectDir","cwd","packageNameFromInput","input","describeNativeFinding","slug","finding"],"sources":["../../src/lib/native-detect.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-detect.d.ts","names":["NativeEvidence","NativeFinding","findUndeclaredNativePackages","Record","packageNameFromInput","describeNativeFinding","NativeEvidence","kind","file","dependency","script","NativeFinding","name","evidence","findUndeclaredNativePackages","options","metafile","inputs","Record","declared","projectDir","cwd","packageNameFromInput","input","describeNativeFinding","slug","finding"],"sources":["../../src/lib/native-detect.ts"],"mappings":";AAUA;AAMA;AAwCA;AAA4C,KA9ChCA,cAAAA,GA8CgC;EACtBG,IAAAA,EAAAA,QAAAA;EAKlBF,IAAAA,EAAAA,MAAAA;AAAa,CAAA,GAAA;EA2EDG,IAAAA,EAAAA,oBAAoB;EAyIpBC,UAAAA,EAAAA,MAAAA;;;;;;;;A,KAlQJJ,aAAAA,G;;;E,UAGDD,c;;;;;;;;;;;;;;;;A,iBAqCKE,4BAAAA,C;;I,SACMC,M;;;;;;A,IAKlBF,a;;;;;;;;;;A,iBA2EYG,oBAAAA,C;;;;;A,iBAyIAC,qBAAAA,C,uBAENJ,a"}
|
|
@@ -3,7 +3,7 @@ import { RUNTIME_TARGET, RUNTIME_TARGET_LABEL } from "./native-packages.js";
|
|
|
3
3
|
import { externalPackageRoot } from "@neon/config";
|
|
4
4
|
import { isAbsolute, join, resolve } from "node:path";
|
|
5
5
|
import { readdirSync, realpathSync } from "node:fs";
|
|
6
|
-
|
|
6
|
+
// src/lib/native-detect.ts
|
|
7
7
|
/** Depth of the walk for a `.node`/`.so` inside one package. */
|
|
8
8
|
const SCAN_DEPTH = 4;
|
|
9
9
|
const BINARY_PATTERN = /\.(node|so)(\.\d+)*$/;
|
|
@@ -196,7 +196,6 @@ function describeNativeFinding(slug, finding) {
|
|
|
196
196
|
`nothing for it, so a top-level import of it would then fail on every invoke.`
|
|
197
197
|
].join("\n");
|
|
198
198
|
}
|
|
199
|
-
//#endregion
|
|
200
199
|
export { describeNativeFinding, findUndeclaredNativePackages, packageNameFromInput };
|
|
201
200
|
|
|
202
201
|
//# sourceMappingURL=native-detect.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/lib/native-packages.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The architecture, OS and libc a Neon Function runs on. Native packages are installed for
|
|
4
3
|
* this triple rather than for the machine running the deploy, which is usually a macOS or
|
|
@@ -103,6 +102,5 @@ declare function enforceLimits(slug: string, entries: Record<string, Uint8Array>
|
|
|
103
102
|
* finished ZIP.
|
|
104
103
|
*/
|
|
105
104
|
declare function assertZipWithinLimits(slug: string, zip: Uint8Array, entries: Record<string, Uint8Array>, limits?: ArchiveLimits): void;
|
|
106
|
-
//#endregion
|
|
107
105
|
export { ArchiveLimits, DEFAULT_ARCHIVE_LIMITS, NativeTraceDeps, NativeTraceResult, RUNTIME_TARGET, RUNTIME_TARGET_LABEL, assertZipWithinLimits, enforceLimits, traceNativePackages };
|
|
108
106
|
//# sourceMappingURL=native-packages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-packages.d.ts","names":["RUNTIME_TARGET","RUNTIME_TARGET_LABEL","ArchiveLimits","DEFAULT_ARCHIVE_LIMITS","NativeTraceDeps","Promise","NativeTraceResult","Uint8Array","Record","traceNativePackages","Partial","enforceLimits","assertZipWithinLimits","RUNTIME_TARGET","cpu","os","libc","RUNTIME_TARGET_LABEL","ArchiveLimits","maxZipBytes","maxTotalBytes","maxEntries","DEFAULT_ARCHIVE_LIMITS","NativeTraceDeps","install","cwd","specs","Promise","trace","base","entry","files","unresolved","installedVersion","projectDir","pkg","NativeTraceResult","entries","Record","Uint8Array","warnings","traceNativePackages","options","slug","packages","limits","deps","Partial","enforceLimits","assertZipWithinLimits","zip"],"sources":["../../src/lib/native-packages.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-packages.d.ts","names":["RUNTIME_TARGET","RUNTIME_TARGET_LABEL","ArchiveLimits","DEFAULT_ARCHIVE_LIMITS","NativeTraceDeps","Promise","NativeTraceResult","Uint8Array","Record","traceNativePackages","Partial","enforceLimits","assertZipWithinLimits","RUNTIME_TARGET","cpu","os","libc","RUNTIME_TARGET_LABEL","ArchiveLimits","maxZipBytes","maxTotalBytes","maxEntries","DEFAULT_ARCHIVE_LIMITS","NativeTraceDeps","install","cwd","specs","Promise","trace","base","entry","files","unresolved","installedVersion","projectDir","pkg","NativeTraceResult","entries","Record","Uint8Array","warnings","traceNativePackages","options","slug","packages","limits","deps","Partial","enforceLimits","assertZipWithinLimits","zip"],"sources":["../../src/lib/native-packages.ts"],"mappings":";AAqBA;AAOA;AAwLA;AASA;AAOYI,cA/MCJ,cA+Mc,EAAA;EAAA,SAAAc,GAAA,EAAA,OAAA;EAEiBT,SAAAA,EAAAA,EAAAA,OAAAA;EAYtCA,SAAAA,IAAAA,EAAAA,OAAAA;AAAO,CAAA;AAMb;AAA6B,cA5NhBJ,oBA4NgB,EAAA,MAAA;AACJM;AAAfC;AAAM;AA0ChB;AAAyC;AAI/BN;AACME;AAARM;AACIJ,KArFAJ,aAAAA,GAqFAI;EAARD;EAAOc,WAAA,EAAA,MAAA;EAwRKR;EAAaS,aAAA,EAAA,MAAA;EAEJb;EAAfC,UAAAA,EAAAA,MAAAA;AACDN,CAAAA;AAAsC,cAvWlCC,sBAuWkC,EAvWVD,aAuWU;AAyB/C;AAAqC,KAzXzBE,eAAAA,GAyXyB;EAE/BG;EACmBA,OAAAA,EAAAA,CAAAA,GAAAA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,EAAAA,GA1XmBF,OA0XnBE,CAAAA,IAAAA,CAAAA;EAAfC;EACDN;AAAsC;;;;;;E,wCA/WzCG,O;;;;;;;;A,KAMMC,iBAAAA,G;E,SACFE,M,SAAeD,U;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,iBA0CHE,mBAAAA,C;;;;E,SAIZP,a;E,OACFQ,O,CAAQN,e;A,IACZC,O,CAAQC,iB;;;;;;;;;A,iBAwRIK,aAAAA,C,uBAENH,M,SAAeD,U,YAChBL,a;;;;;;A,iBAyBOU,qBAAAA,C,mBAEVL,U,WACIC,M,SAAeD,U,YAChBL,a"}
|
|
@@ -4,7 +4,7 @@ import { join, resolve, sep } from "node:path";
|
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { lstatSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
|
-
|
|
7
|
+
// src/lib/native-packages.ts
|
|
8
8
|
/**
|
|
9
9
|
* The architecture, OS and libc a Neon Function runs on. Native packages are installed for
|
|
10
10
|
* this triple rather than for the machine running the deploy, which is usually a macOS or
|
|
@@ -418,7 +418,6 @@ async function loadNft() {
|
|
|
418
418
|
throw invalid("Staging a function's external packages requires `@vercel/nft`, which could not be loaded. Installed from npm it is a dependency of @neon/config-runtime, so reinstalling your dependencies fixes it. If you are running the standalone `neon` binary, this is a packaging bug — please report it at https://github.com/neondatabase/neon-pkgs/issues.", cause);
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
//#endregion
|
|
422
421
|
export { DEFAULT_ARCHIVE_LIMITS, RUNTIME_TARGET, RUNTIME_TARGET_LABEL, assertZipWithinLimits, enforceLimits, traceNativePackages };
|
|
423
422
|
|
|
424
423
|
//# sourceMappingURL=native-packages.js.map
|
package/dist/lib/operations.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PullConfigOptions, PulledBranchConfig } from "./pull-config.js";
|
|
|
3
3
|
import { PushConfigOptions } from "./push-config.js";
|
|
4
4
|
import { Config, NeonApi, PushResult } from "@neon/config";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/lib/operations.d.ts
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Where to run the operation and how to authenticate. Filesystem- and env-agnostic: the
|
|
@@ -129,6 +129,5 @@ interface CreateBranchResult {
|
|
|
129
129
|
* branch already created; that throws {@link PartialBranchCreateError} carrying its id/name.
|
|
130
130
|
*/
|
|
131
131
|
declare function createBranch(config: Config, options: CreateBranchOptions): Promise<CreateBranchResult>;
|
|
132
|
-
//#endregion
|
|
133
132
|
export { ApplyOptions, ConfigOperationOptions, CreateBranchOptions, CreateBranchResult, apply, createBranch, inspect, plan };
|
|
134
133
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/lib/operations.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { pullConfig } from "./pull-config.js";
|
|
2
2
|
import { pushConfig } from "./push-config.js";
|
|
3
3
|
import { ErrorCode, PartialBranchCreateError, PlatformError, createNeonApiFromOptions, resolveConfig } from "@neon/config";
|
|
4
|
-
|
|
4
|
+
// src/lib/operations.ts
|
|
5
5
|
/**
|
|
6
6
|
* Read a branch's live Neon state as a plain object (project + branch metadata and the
|
|
7
7
|
* reverse-engineered `BranchConfig`). Network read only — never mutates.
|
|
@@ -200,7 +200,6 @@ function resolveParentBranchId(parentName, branches, branchName) {
|
|
|
200
200
|
}
|
|
201
201
|
return branches.find((b) => b.isDefault)?.id;
|
|
202
202
|
}
|
|
203
|
-
//#endregion
|
|
204
203
|
export { apply, createBranch, inspect, plan };
|
|
205
204
|
|
|
206
205
|
//# sourceMappingURL=operations.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BucketAccessLevel, Config, NeonApi, NeonBranchSnapshot, NeonBucketSnapshot, NeonCredentialMeta, NeonEndpointSnapshot, NeonFunctionSnapshot, NeonProjectSnapshot, NeonRealtimeSnapshot } from "@neon/config";
|
|
1
|
+
import { BucketAccessLevel, Config, DataApiInput, NeonApi, NeonBranchSnapshot, NeonBucketSnapshot, NeonCredentialMeta, NeonDataApiSnapshot, NeonEndpointSnapshot, NeonFunctionSnapshot, NeonProjectSnapshot, NeonRealtimeSnapshot } from "@neon/config";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/pull-config.d.ts
|
|
4
4
|
interface PullConfigOptions {
|
|
5
5
|
/** Neon project id (`<project>`). Required — the API addresses branches by project. */
|
|
6
6
|
projectId: string;
|
|
@@ -77,6 +77,14 @@ interface PulledBranchConfig {
|
|
|
77
77
|
preview?: PulledPreview;
|
|
78
78
|
}
|
|
79
79
|
declare function pullConfig(options: PullConfigOptions): Promise<PulledBranchConfig>;
|
|
80
|
+
/**
|
|
81
|
+
* The `dataApi` a pulled policy declares for a live Data API. The provider is fixed when the
|
|
82
|
+
* Data API is created, so a bare `true` (Neon Auth) is only right when that is what the
|
|
83
|
+
* branch has; writing it over an external-IdP Data API would make the next apply enable Neon
|
|
84
|
+
* Auth. When the API does not report the provider (older Data APIs), the branch's Neon Auth
|
|
85
|
+
* state is the best available answer: with Neon Auth off, the Data API cannot be using it.
|
|
86
|
+
*/
|
|
87
|
+
declare function pulledDataApiConfig(dataApi: NeonDataApiSnapshot, authEnabled: boolean): DataApiInput;
|
|
80
88
|
declare function buildPulledBranchConfig(project: NeonProjectSnapshot, branch: NeonBranchSnapshot, branches: NeonBranchSnapshot[], endpoint: NeonEndpointSnapshot | undefined, previewState?: {
|
|
81
89
|
buckets: NeonBucketSnapshot[];
|
|
82
90
|
functions: NeonFunctionSnapshot[];
|
|
@@ -85,9 +93,14 @@ declare function buildPulledBranchConfig(project: NeonProjectSnapshot, branch: N
|
|
|
85
93
|
authEnabled?: boolean;
|
|
86
94
|
/** Whether a Neon Data API integration is enabled on the branch. */
|
|
87
95
|
dataApiEnabled?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The live Data API, when enabled. Its auth provider decides the shape of the emitted
|
|
98
|
+
* `dataApi` (see {@link pulledDataApiConfig}); with only `dataApiEnabled` the policy
|
|
99
|
+
* falls back to a bare `true`.
|
|
100
|
+
*/
|
|
101
|
+
dataApi?: NeonDataApiSnapshot | null;
|
|
88
102
|
/** Realtime state when the adapter supports the branch endpoint. */
|
|
89
103
|
realtime?: NeonRealtimeSnapshot | null;
|
|
90
104
|
}): PulledBranchConfig;
|
|
91
|
-
|
|
92
|
-
export { PullConfigOptions, PulledBranchConfig, PulledPreview, buildPulledBranchConfig, pullConfig };
|
|
105
|
+
export { PullConfigOptions, PulledBranchConfig, PulledPreview, buildPulledBranchConfig, pullConfig, pulledDataApiConfig };
|
|
93
106
|
//# sourceMappingURL=pull-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-config.d.ts","names":["BucketAccessLevel","Config","NeonApi","NeonBranchSnapshot","NeonBucketSnapshot","NeonCredentialMeta","NeonEndpointSnapshot","NeonFunctionSnapshot","NeonProjectSnapshot","NeonRealtimeSnapshot","PullConfigOptions","PulledPreview","Array","PulledBranchConfig","pullConfig","Promise","buildPulledBranchConfig","BucketAccessLevel","Config","NeonApi","NeonBranchSnapshot","NeonBucketSnapshot","NeonCredentialMeta","NeonEndpointSnapshot","NeonFunctionSnapshot","NeonProjectSnapshot","NeonRealtimeSnapshot","PullConfigOptions","projectId","branchId","apiKey","apiHost","api","realtime","PulledPreview","buckets","Array","name","access","functions","slug","credentials","PulledBranchConfig","project","id","region","pgVersion","orgId","branch","parent","isDefault","protected","expiresAt","config","preview","pullConfig","options","Promise","buildPulledBranchConfig","branches","endpoint","previewState","
|
|
1
|
+
{"version":3,"file":"pull-config.d.ts","names":["BucketAccessLevel","Config","DataApiInput","NeonApi","NeonBranchSnapshot","NeonBucketSnapshot","NeonCredentialMeta","NeonDataApiSnapshot","NeonEndpointSnapshot","NeonFunctionSnapshot","NeonProjectSnapshot","NeonRealtimeSnapshot","PullConfigOptions","PulledPreview","Array","PulledBranchConfig","pullConfig","Promise","pulledDataApiConfig","buildPulledBranchConfig","BucketAccessLevel","Config","DataApiInput","NeonApi","NeonBranchSnapshot","NeonBucketSnapshot","NeonCredentialMeta","NeonDataApiSnapshot","NeonEndpointSnapshot","NeonFunctionSnapshot","NeonProjectSnapshot","NeonRealtimeSnapshot","PullConfigOptions","projectId","branchId","apiKey","apiHost","api","realtime","PulledPreview","buckets","Array","name","access","functions","slug","credentials","PulledBranchConfig","project","id","region","pgVersion","orgId","branch","parent","isDefault","protected","expiresAt","config","preview","pullConfig","options","Promise","pulledDataApiConfig","dataApi","authEnabled","buildPulledBranchConfig","branches","endpoint","previewState","dataApiEnabled"],"sources":["../../src/lib/pull-config.ts"],"mappings":";;;A,UAsBiBY,iBAAAA,C;;EAAAA,SAAAA,EAAAA,MAAAA;EAqBAC;EAAaqB,QAAA,EAAA,MAAA;EACUlC;EAA9Bc,MAAAA,CAAAA,EAAAA,MAAAA;EACEA;EAOER,OAAAA,CAAAA,EAAAA,MAAAA;EAAkB;EAGfS,GAAAA,CAAAA,EAvBVZ,OAuBUY;EAAkB;EA8B1Bd,QAAAA,CAAAA,EAAAA,OAAAA;AAMEY;AAAa;AAGxB;AAAgC;AACtBD;AACCG;AAARE;AAAO,UArDOJ,aAAAA,CAqDP;EAkGMK,OAAAA,EAtJNJ,KAsJMI,CAAAA;IAAmBwB,IAAA,EAAA,MAAA;IACzBnC,MAAAA,EAvJ8BP,iBAuJ9BO;EAEPL,CAAAA,CAAAA;EAAY0C,SAAA,EAxJH9B,KAwJG,CAAA;IAkFCK,IAAAA,EAAAA,MAAAA;IAAuBuB,IAAA,EAAA,MAAA;EAC7BhC,CAAAA,CAAAA;EACDN;AACEA;AACAI;AAEAH;AACEI;AACGH;EAUJC,WAAAA,EArPED,kBAqPFC,EAAAA;AAECI;AAEVI,UAtPcA,kBAAAA,CAsPdA;EAAkBiC,OAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;E,QAxNZ/C,M;;;;;;E,UAMEY,a;;A,iBAGWG,UAAAA,C,SACZJ,iB,GACPK,O,CAAQF,kB;;;;;;;;A,iBAkGKG,mBAAAA,C,SACNX,mB,yBAEPL,Y;A,iBAkFaiB,uBAAAA,C,SACNT,mB,UACDN,kB,YACEA,kB,cACAI,oB;E,SAEAH,kB;E,WACEI,oB;E,cACGH,kB;;;;;;;;;;E,UAUJC,mB;;E,WAECI,oB;A,IAEVI,kB"}
|
package/dist/lib/pull-config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorCode, PlatformError, createNeonApiFromOptions } from "@neon/config";
|
|
2
|
-
|
|
2
|
+
// src/lib/pull-config.ts
|
|
3
3
|
async function pullConfig(options) {
|
|
4
4
|
const api = options.api ?? createApiFromOptions(options);
|
|
5
5
|
const projectId = options.projectId;
|
|
@@ -31,10 +31,32 @@ async function pullConfig(options) {
|
|
|
31
31
|
credentials,
|
|
32
32
|
authEnabled: auth !== null,
|
|
33
33
|
dataApiEnabled: dataApi !== null,
|
|
34
|
+
dataApi,
|
|
34
35
|
realtime
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
39
|
+
* The `dataApi` a pulled policy declares for a live Data API. The provider is fixed when the
|
|
40
|
+
* Data API is created, so a bare `true` (Neon Auth) is only right when that is what the
|
|
41
|
+
* branch has; writing it over an external-IdP Data API would make the next apply enable Neon
|
|
42
|
+
* Auth. When the API does not report the provider (older Data APIs), the branch's Neon Auth
|
|
43
|
+
* state is the best available answer: with Neon Auth off, the Data API cannot be using it.
|
|
44
|
+
*/
|
|
45
|
+
function pulledDataApiConfig(dataApi, authEnabled) {
|
|
46
|
+
const external = () => {
|
|
47
|
+
const config = { authProvider: "external" };
|
|
48
|
+
if (dataApi.jwksUrl !== void 0) config.jwksUrl = dataApi.jwksUrl;
|
|
49
|
+
if (dataApi.providerName !== void 0) config.providerName = dataApi.providerName;
|
|
50
|
+
if (dataApi.jwtAudience !== void 0) config.jwtAudience = dataApi.jwtAudience;
|
|
51
|
+
return config;
|
|
52
|
+
};
|
|
53
|
+
switch (dataApi.authProvider) {
|
|
54
|
+
case "neon_auth": return true;
|
|
55
|
+
case "external": return external();
|
|
56
|
+
default: return authEnabled ? true : external();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
38
60
|
* Starts a read now and keeps an unread rejection from crashing the process; the caller
|
|
39
61
|
* awaits it (and sees the error) when its turn comes. Also turns a synchronous throw from
|
|
40
62
|
* a custom adapter into a rejection.
|
|
@@ -92,9 +114,11 @@ function buildPulledBranchConfig(project, branch, branches, endpoint, previewSta
|
|
|
92
114
|
const policyPreview = {};
|
|
93
115
|
if (previewState?.realtime?.enabled) policyPreview.realtime = true;
|
|
94
116
|
if (Object.keys(bucketDefs).length > 0) policyPreview.buckets = bucketDefs;
|
|
117
|
+
const authEnabled = previewState?.authEnabled === true;
|
|
118
|
+
const dataApi = previewState?.dataApi ? pulledDataApiConfig(previewState.dataApi, authEnabled) : previewState?.dataApiEnabled ? true : void 0;
|
|
95
119
|
const config = {
|
|
96
|
-
...
|
|
97
|
-
...
|
|
120
|
+
...authEnabled ? { auth: true } : {},
|
|
121
|
+
...dataApi !== void 0 ? { dataApi } : {},
|
|
98
122
|
...Object.keys(policyPreview).length > 0 ? { preview: policyPreview } : {},
|
|
99
123
|
...Object.keys(tuning).length > 0 ? { branch: () => tuning } : {}
|
|
100
124
|
};
|
|
@@ -155,7 +179,6 @@ function endpointToComputeSettings(endpoint, project) {
|
|
|
155
179
|
if (endpoint.suspendTimeout !== void 0 && endpoint.suspendTimeout !== defaults?.suspendTimeout) out.suspendTimeout = endpoint.suspendTimeout;
|
|
156
180
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
157
181
|
}
|
|
158
|
-
|
|
159
|
-
export { buildPulledBranchConfig, pullConfig };
|
|
182
|
+
export { buildPulledBranchConfig, pullConfig, pulledDataApiConfig };
|
|
160
183
|
|
|
161
184
|
//# sourceMappingURL=pull-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-config.js","names":[],"sources":["../../src/lib/pull-config.ts"],"sourcesContent":["import {\n\ttype BranchTuning,\n\ttype BucketAccessLevel,\n\ttype ComputeSettings,\n\ttype Config,\n\tcreateNeonApiFromOptions,\n\tErrorCode,\n\ttype NeonApi,\n\ttype NeonBranchSnapshot,\n\ttype NeonBucketSnapshot,\n\ttype NeonCredentialMeta,\n\ttype NeonDatabaseSnapshot,\n\ttype NeonEndpointSnapshot,\n\ttype NeonFunctionSnapshot,\n\ttype NeonProjectSnapshot,\n\ttype NeonRealtimeSnapshot,\n\tPlatformError,\n} from \"@neon/config\";\n\nexport interface PullConfigOptions {\n\t/** Neon project id (`<project>`). Required — the API addresses branches by project. */\n\tprojectId: string;\n\t/** Neon branch id (`br-…`). Required. Resolve names to ids before calling. */\n\tbranchId: string;\n\t/** Neon API key. Falls back to `NEON_API_KEY` / neonctl credentials. */\n\tapiKey?: string;\n\t/** Neon API base URL. Falls back to `NEON_API_HOST`, then production. */\n\tapiHost?: string;\n\t/** Inject a custom NeonApi adapter (primarily for tests). */\n\tapi?: NeonApi;\n\t/** Read the branch's Realtime state. Defaults to `true`. */\n\trealtime?: boolean;\n}\n\n/**\n * Live Preview-feature state read back from a branch. Surfaced alongside `config` rather\n * than inside it because functions cannot round-trip: the remote only knows the deployed\n * bundle, not the local `source` path a {@link FunctionConfig} requires, so a pulled\n * function is reported as `{ slug, name }` (no `source`).\n */\nexport interface PulledPreview {\n\tbuckets: Array<{ name: string; access: BucketAccessLevel }>;\n\tfunctions: Array<{ slug: string; name: string }>;\n\t/**\n\t * Secret-free metadata for the credentials issued on the branch (Preview). Surfaced so\n\t * `config status` can show issued credentials (id, scopes, last used) without ever\n\t * exposing the one-time `api_token` / `s3_secret_access_key`. Empty when none / the\n\t * credentials endpoint is unavailable for the project.\n\t */\n\tcredentials: NeonCredentialMeta[];\n}\n\nexport interface PulledBranchConfig {\n\tproject: {\n\t\tid: string;\n\t\tname: string;\n\t\tregion: string;\n\t\tpgVersion: number;\n\t\torgId?: string;\n\t};\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tparent?: string;\n\t\tisDefault: boolean;\n\t\tprotected: boolean;\n\t\texpiresAt?: string;\n\t};\n\t/**\n\t * The branch's live state expressed as a {@link Config}: static `auth` / `dataApi`\n\t * toggles, Realtime under `preview.realtime`, any object-storage `preview.buckets`, plus\n\t * a `branch` closure carrying the\n\t * branch's lifecycle/compute tuning. Buckets are included here (not just in\n\t * {@link PulledBranchConfig.preview}) because they round-trip cleanly — name + access\n\t * level is all a {@link Config} needs — so the no-policy env path (`neon dev` /\n\t * `neon env pull`) can resolve the branch's storage credentials without a local\n\t * `neon.ts`. Preview **functions** are reported only in\n\t * {@link PulledBranchConfig.preview}: they cannot round-trip (the remote has no local\n\t * `source` path). The AI Gateway is omitted from both — it has no branch-level \"enabled\"\n\t * state to read back (it is always available, credential-gated), so `pullConfig` cannot\n\t * tell whether a policy would enable it.\n\t */\n\tconfig: Config;\n\t/**\n\t * Live Preview-feature state, when the branch has any buckets/functions or issued\n\t * credentials. Omitted entirely when there is nothing to report. The AI Gateway is not\n\t * included: it is always available (credential-gated), not per-branch state.\n\t */\n\tpreview?: PulledPreview;\n}\n\nexport async function pullConfig(\n\toptions: PullConfigOptions,\n): Promise<PulledBranchConfig> {\n\tconst api = options.api ?? createApiFromOptions(options);\n\tconst projectId = options.projectId;\n\tconst branchId = options.branchId;\n\tconst getRealtime =\n\t\toptions.realtime === false\n\t\t\t? undefined\n\t\t\t: api.getProjectBranchRealtime?.bind(api);\n\n\t// The first three stages need only the project and branch ids, so they start together.\n\t// They are awaited in the order they used to run, so the first error reported is the same\n\t// one as before (project, then branches/endpoints, then the branch lookup, then databases).\n\tconst projectRead = started(() => api.getProject(projectId));\n\tconst listsRead = started(() =>\n\t\tPromise.all([\n\t\t\tstarted(() => api.listBranches(projectId)),\n\t\t\tstarted(() => api.listEndpoints(projectId)),\n\t\t]),\n\t);\n\t// Data API is enabled per branch + database, so resolve a database to probe.\n\tconst databasesRead = started(() =>\n\t\tapi.listBranchDatabases(projectId, branchId),\n\t);\n\t// Preview reads degrade to \"none / disabled\" when the feature isn't available for the\n\t// project/region. `pullConfig` mirrors the branch for env resolution (`neon dev`,\n\t// `neon env pull`) and `inspect` — an unavailable Preview feature should not break those\n\t// (env comes from auth/dataApi/postgres). `pushConfig` is the place that fails on an\n\t// unavailable feature, and only when the policy declares it.\n\t// The group starts together once databases resolve (the Data API probe needs one), as\n\t// before, so which member's error comes first is unchanged.\n\tconst previewRead = started(() =>\n\t\tdatabasesRead.then((databases) => {\n\t\t\tconst probeDatabase = pickProbeDatabase(databases);\n\t\t\treturn Promise.all([\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listBranchBuckets(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listBranchFunctions(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listCredentials(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() => api.getNeonAuth(projectId, branchId)),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tprobeDatabase\n\t\t\t\t\t\t? api.getNeonDataApi(projectId, branchId, probeDatabase)\n\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tgetRealtime\n\t\t\t\t\t\t? degradeUnavailable(\n\t\t\t\t\t\t\t\t() => getRealtime(projectId, branchId),\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t),\n\t\t\t]);\n\t\t}),\n\t);\n\n\tconst project = await projectRead;\n\tconst [branches, endpoints] = await listsRead;\n\tconst branch = resolveBranch(branchId, branches);\n\tconst endpoint = endpoints.find(\n\t\t(ep) => ep.type === \"read_write\" && ep.branchId === branch.id,\n\t);\n\tawait databasesRead;\n\tconst [buckets, functions, credentials, auth, dataApi, realtime] =\n\t\tawait previewRead;\n\n\treturn buildPulledBranchConfig(project, branch, branches, endpoint, {\n\t\tbuckets,\n\t\tfunctions,\n\t\tcredentials,\n\t\tauthEnabled: auth !== null,\n\t\tdataApiEnabled: dataApi !== null,\n\t\trealtime,\n\t});\n}\n\n/**\n * Starts a read now and keeps an unread rejection from crashing the process; the caller\n * awaits it (and sees the error) when its turn comes. Also turns a synchronous throw from\n * a custom adapter into a rejection.\n */\nfunction started<T>(read: () => Promise<T>): Promise<T> {\n\tconst promise = Promise.resolve().then(read);\n\tpromise.catch(() => undefined);\n\treturn promise;\n}\n\n/**\n * Pick the database to probe for a Data API integration. Data API is enabled per\n * branch + database; for read-back we only need to know whether *any* database has it\n * on, so prefer the conventional default (`neondb`) and otherwise fall back to the first\n * database. Returns `undefined` when the branch has no databases.\n */\nfunction pickProbeDatabase(\n\tdatabases: NeonDatabaseSnapshot[],\n): string | undefined {\n\tif (databases.length === 0) return undefined;\n\tconst byName = databases.find((d) => d.name === \"neondb\");\n\tif (byName) return byName.name;\n\treturn databases[0].name;\n}\n\n/**\n * Run a Preview-feature read, returning `fallback` if the feature is unavailable for the\n * project/region. Most adapters report {@link ErrorCode.FeatureUnavailable}; API hosts where\n * a route is not deployed can instead return a generic 404. The project and branch are\n * validated independently by `pullConfig`, so that route-level 404 is also safe to degrade.\n * Other errors propagate. This lets a branch without a Preview feature still mirror cleanly\n * for env resolution / `inspect`, rather than aborting on an unrelated capability.\n */\nasync function degradeUnavailable<T>(\n\tread: () => Promise<T>,\n\tfallback: T,\n): Promise<T> {\n\ttry {\n\t\treturn await read();\n\t} catch (err) {\n\t\tif (\n\t\t\terr instanceof PlatformError &&\n\t\t\t(err.code === ErrorCode.FeatureUnavailable ||\n\t\t\t\t(err.code === ErrorCode.NotFound && err.details.status === 404))\n\t\t) {\n\t\t\treturn fallback;\n\t\t}\n\t\tthrow err;\n\t}\n}\n\nfunction createApiFromOptions(options: PullConfigOptions): NeonApi {\n\treturn createNeonApiFromOptions(\"pullConfig\", {\n\t\t...(options.apiKey ? { apiKey: options.apiKey } : {}),\n\t\t...(options.apiHost ? { apiHost: options.apiHost } : {}),\n\t});\n}\n\nexport function buildPulledBranchConfig(\n\tproject: NeonProjectSnapshot,\n\tbranch: NeonBranchSnapshot,\n\tbranches: NeonBranchSnapshot[],\n\tendpoint: NeonEndpointSnapshot | undefined,\n\tpreviewState?: {\n\t\tbuckets: NeonBucketSnapshot[];\n\t\tfunctions: NeonFunctionSnapshot[];\n\t\tcredentials?: NeonCredentialMeta[];\n\t\t/** Whether a Neon Auth integration is enabled on the branch. */\n\t\tauthEnabled?: boolean;\n\t\t/** Whether a Neon Data API integration is enabled on the branch. */\n\t\tdataApiEnabled?: boolean;\n\t\t/** Realtime state when the adapter supports the branch endpoint. */\n\t\trealtime?: NeonRealtimeSnapshot | null;\n\t},\n): PulledBranchConfig {\n\tconst parent = branch.parentId\n\t\t? branches.find((b) => b.id === branch.parentId)\n\t\t: undefined;\n\t// Auth and Data API are static top-level toggles, while Realtime is static under\n\t// `preview.realtime`. A config pulled from a branch with them enabled round-trips through\n\t// `resolveConfig` / `fetchEnv` and the matching secrets get injected. Branch\n\t// lifecycle/compute is per-branch tuning, so it goes in the `branch` closure.\n\tconst tuning: BranchTuning = {};\n\tif (parent) tuning.parent = parent.name;\n\t// Deliberately NOT emitting `ttl` from `branch.expiresAt`: policy `ttl` is a\n\t// creation-time *duration*, while `expiresAt` is an absolute timestamp. Feeding the\n\t// timestamp through `parseDuration` (in `resolveConfig`) would throw, breaking\n\t// `fetchEnv` / `neon dev` / `neon env pull` for any branch that has a TTL. The expiry\n\t// is reported faithfully on `branch.expiresAt` above.\n\tif (branch.protected) tuning.protected = true;\n\tif (endpoint) {\n\t\tconst compute = endpointToComputeSettings(endpoint, project);\n\t\tif (compute) tuning.postgres = { computeSettings: compute };\n\t}\n\t// Buckets round-trip cleanly (name + access level), so they belong in the config the\n\t// env path resolves from — this is what lets `neon dev` / `neon env pull` inject the\n\t// branch's object-storage credentials (AWS_*) with no local neon.ts. Functions are\n\t// deliberately NOT emitted here (they can't round-trip: the remote has no `source`\n\t// path) and neither is the AI Gateway (no branch-level enabled state to detect, only a\n\t// credential) — both would otherwise turn a read-back into a bogus policy declaration.\n\tconst bucketDefs: Record<string, { access: BucketAccessLevel }> = {};\n\tfor (const b of previewState?.buckets ?? []) {\n\t\tbucketDefs[b.name] = { access: b.accessLevel };\n\t}\n\tconst policyPreview: NonNullable<Config[\"preview\"]> = {};\n\tif (previewState?.realtime?.enabled) policyPreview.realtime = true;\n\tif (Object.keys(bucketDefs).length > 0) policyPreview.buckets = bucketDefs;\n\tconst config: Config = {\n\t\t...(previewState?.authEnabled ? { auth: true } : {}),\n\t\t...(previewState?.dataApiEnabled ? { dataApi: true } : {}),\n\t\t...(Object.keys(policyPreview).length > 0\n\t\t\t? { preview: policyPreview }\n\t\t\t: {}),\n\t\t...(Object.keys(tuning).length > 0 ? { branch: () => tuning } : {}),\n\t};\n\tconst result: PulledBranchConfig = {\n\t\tproject: {\n\t\t\tid: project.id,\n\t\t\tname: project.name,\n\t\t\tregion: project.regionId,\n\t\t\tpgVersion: project.pgVersion,\n\t\t\t...(project.orgId ? { orgId: project.orgId } : {}),\n\t\t},\n\t\tbranch: {\n\t\t\tid: branch.id,\n\t\t\tname: branch.name,\n\t\t\t...(parent ? { parent: parent.name } : {}),\n\t\t\tisDefault: branch.isDefault,\n\t\t\tprotected: branch.protected,\n\t\t\t...(branch.expiresAt ? { expiresAt: branch.expiresAt } : {}),\n\t\t},\n\t\tconfig,\n\t};\n\tconst preview = previewState ? buildPulledPreview(previewState) : undefined;\n\tif (preview) result.preview = preview;\n\treturn result;\n}\n\n/**\n * Reverse-engineer the {@link PulledPreview} from remote snapshots. Returns `undefined` when\n * the branch has no Preview features so the field can be omitted entirely.\n */\nfunction buildPulledPreview(state: {\n\tbuckets: NeonBucketSnapshot[];\n\tfunctions: NeonFunctionSnapshot[];\n\tcredentials?: NeonCredentialMeta[];\n}): PulledPreview | undefined {\n\tconst credentials = state.credentials ?? [];\n\tif (\n\t\tstate.buckets.length === 0 &&\n\t\tstate.functions.length === 0 &&\n\t\tcredentials.length === 0\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tbuckets: state.buckets.map((b) => ({\n\t\t\tname: b.name,\n\t\t\taccess: b.accessLevel,\n\t\t})),\n\t\tfunctions: state.functions.map((f) => ({\n\t\t\tslug: f.slug,\n\t\t\tname: f.name,\n\t\t})),\n\t\tcredentials,\n\t};\n}\n\nfunction resolveBranch(\n\tbranchId: string,\n\tbranches: NeonBranchSnapshot[],\n): NeonBranchSnapshot {\n\tconst match = branches.find((b) => b.id === branchId);\n\tif (match) return match;\n\tthrow new PlatformError(\n\t\tErrorCode.BranchNotFound,\n\t\t[\n\t\t\t`pullConfig: branch id ${JSON.stringify(branchId)} not found on project.`,\n\t\t\t`Available branches: ${branches.map((b) => `${b.name} (${b.id})`).join(\", \") || \"(none)\"}.`,\n\t\t].join(\" \"),\n\t\t{\n\t\t\tdetails: {\n\t\t\t\tbranchId,\n\t\t\t\tavailable: branches.map((b) => b.id),\n\t\t\t},\n\t\t},\n\t);\n}\n\nfunction endpointToComputeSettings(\n\tendpoint: NeonEndpointSnapshot,\n\tproject: NeonProjectSnapshot,\n): ComputeSettings | undefined {\n\tconst defaults = project.defaultEndpointSettings;\n\tconst out: ComputeSettings = {};\n\tif (\n\t\tendpoint.autoscalingLimitMinCu !== undefined &&\n\t\tendpoint.autoscalingLimitMinCu !== defaults?.autoscalingLimitMinCu\n\t) {\n\t\tout.autoscalingLimitMinCu = endpoint.autoscalingLimitMinCu;\n\t}\n\tif (\n\t\tendpoint.autoscalingLimitMaxCu !== undefined &&\n\t\tendpoint.autoscalingLimitMaxCu !== defaults?.autoscalingLimitMaxCu\n\t) {\n\t\tout.autoscalingLimitMaxCu = endpoint.autoscalingLimitMaxCu;\n\t}\n\tif (\n\t\tendpoint.suspendTimeout !== undefined &&\n\t\tendpoint.suspendTimeout !== defaults?.suspendTimeout\n\t) {\n\t\tout.suspendTimeout = endpoint.suspendTimeout;\n\t}\n\treturn Object.keys(out).length > 0 ? out : undefined;\n}\n"],"mappings":";;AA2FA,eAAsB,WACrB,SAC8B;CAC9B,MAAM,MAAM,QAAQ,OAAO,qBAAqB,OAAO;CACvD,MAAM,YAAY,QAAQ;CAC1B,MAAM,WAAW,QAAQ;CACzB,MAAM,cACL,QAAQ,aAAa,QAClB,KAAA,IACA,IAAI,0BAA0B,KAAK,GAAG;CAK1C,MAAM,cAAc,cAAc,IAAI,WAAW,SAAS,CAAC;CAC3D,MAAM,YAAY,cACjB,QAAQ,IAAI,CACX,cAAc,IAAI,aAAa,SAAS,CAAC,GACzC,cAAc,IAAI,cAAc,SAAS,CAAC,CAC3C,CAAC,CACF;CAEA,MAAM,gBAAgB,cACrB,IAAI,oBAAoB,WAAW,QAAQ,CAC5C;CAQA,MAAM,cAAc,cACnB,cAAc,MAAM,cAAc;EACjC,MAAM,gBAAgB,kBAAkB,SAAS;EACjD,OAAO,QAAQ,IAAI;GAClB,cACC,yBACO,IAAI,kBAAkB,WAAW,QAAQ,GAC/C,CA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,MAAM,MAAuB,CAAC;CAC9B,IACC,SAAS,0BAA0B,KAAA,KACnC,SAAS,0BAA0B,UAAU,uBAE7C,IAAI,wBAAwB,SAAS;CAEtC,IACC,SAAS,0BAA0B,KAAA,KACnC,SAAS,0BAA0B,UAAU,uBAE7C,IAAI,wBAAwB,SAAS;CAEtC,IACC,SAAS,mBAAmB,KAAA,KAC5B,SAAS,mBAAmB,UAAU,gBAEtC,IAAI,iBAAiB,SAAS;CAE/B,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,IAAI,MAAM,KAAA;AAC5C"}
|
|
1
|
+
{"version":3,"file":"pull-config.js","names":[],"sources":["../../src/lib/pull-config.ts"],"sourcesContent":["import {\n\ttype BranchTuning,\n\ttype BucketAccessLevel,\n\ttype ComputeSettings,\n\ttype Config,\n\tcreateNeonApiFromOptions,\n\ttype DataApiExternalAuthConfig,\n\ttype DataApiInput,\n\tErrorCode,\n\ttype NeonApi,\n\ttype NeonBranchSnapshot,\n\ttype NeonBucketSnapshot,\n\ttype NeonCredentialMeta,\n\ttype NeonDataApiSnapshot,\n\ttype NeonDatabaseSnapshot,\n\ttype NeonEndpointSnapshot,\n\ttype NeonFunctionSnapshot,\n\ttype NeonProjectSnapshot,\n\ttype NeonRealtimeSnapshot,\n\tPlatformError,\n} from \"@neon/config\";\n\nexport interface PullConfigOptions {\n\t/** Neon project id (`<project>`). Required — the API addresses branches by project. */\n\tprojectId: string;\n\t/** Neon branch id (`br-…`). Required. Resolve names to ids before calling. */\n\tbranchId: string;\n\t/** Neon API key. Falls back to `NEON_API_KEY` / neonctl credentials. */\n\tapiKey?: string;\n\t/** Neon API base URL. Falls back to `NEON_API_HOST`, then production. */\n\tapiHost?: string;\n\t/** Inject a custom NeonApi adapter (primarily for tests). */\n\tapi?: NeonApi;\n\t/** Read the branch's Realtime state. Defaults to `true`. */\n\trealtime?: boolean;\n}\n\n/**\n * Live Preview-feature state read back from a branch. Surfaced alongside `config` rather\n * than inside it because functions cannot round-trip: the remote only knows the deployed\n * bundle, not the local `source` path a {@link FunctionConfig} requires, so a pulled\n * function is reported as `{ slug, name }` (no `source`).\n */\nexport interface PulledPreview {\n\tbuckets: Array<{ name: string; access: BucketAccessLevel }>;\n\tfunctions: Array<{ slug: string; name: string }>;\n\t/**\n\t * Secret-free metadata for the credentials issued on the branch (Preview). Surfaced so\n\t * `config status` can show issued credentials (id, scopes, last used) without ever\n\t * exposing the one-time `api_token` / `s3_secret_access_key`. Empty when none / the\n\t * credentials endpoint is unavailable for the project.\n\t */\n\tcredentials: NeonCredentialMeta[];\n}\n\nexport interface PulledBranchConfig {\n\tproject: {\n\t\tid: string;\n\t\tname: string;\n\t\tregion: string;\n\t\tpgVersion: number;\n\t\torgId?: string;\n\t};\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tparent?: string;\n\t\tisDefault: boolean;\n\t\tprotected: boolean;\n\t\texpiresAt?: string;\n\t};\n\t/**\n\t * The branch's live state expressed as a {@link Config}: static `auth` / `dataApi`\n\t * toggles, Realtime under `preview.realtime`, any object-storage `preview.buckets`, plus\n\t * a `branch` closure carrying the\n\t * branch's lifecycle/compute tuning. Buckets are included here (not just in\n\t * {@link PulledBranchConfig.preview}) because they round-trip cleanly — name + access\n\t * level is all a {@link Config} needs — so the no-policy env path (`neon dev` /\n\t * `neon env pull`) can resolve the branch's storage credentials without a local\n\t * `neon.ts`. Preview **functions** are reported only in\n\t * {@link PulledBranchConfig.preview}: they cannot round-trip (the remote has no local\n\t * `source` path). The AI Gateway is omitted from both — it has no branch-level \"enabled\"\n\t * state to read back (it is always available, credential-gated), so `pullConfig` cannot\n\t * tell whether a policy would enable it.\n\t */\n\tconfig: Config;\n\t/**\n\t * Live Preview-feature state, when the branch has any buckets/functions or issued\n\t * credentials. Omitted entirely when there is nothing to report. The AI Gateway is not\n\t * included: it is always available (credential-gated), not per-branch state.\n\t */\n\tpreview?: PulledPreview;\n}\n\nexport async function pullConfig(\n\toptions: PullConfigOptions,\n): Promise<PulledBranchConfig> {\n\tconst api = options.api ?? createApiFromOptions(options);\n\tconst projectId = options.projectId;\n\tconst branchId = options.branchId;\n\tconst getRealtime =\n\t\toptions.realtime === false\n\t\t\t? undefined\n\t\t\t: api.getProjectBranchRealtime?.bind(api);\n\n\t// The first three stages need only the project and branch ids, so they start together.\n\t// They are awaited in the order they used to run, so the first error reported is the same\n\t// one as before (project, then branches/endpoints, then the branch lookup, then databases).\n\tconst projectRead = started(() => api.getProject(projectId));\n\tconst listsRead = started(() =>\n\t\tPromise.all([\n\t\t\tstarted(() => api.listBranches(projectId)),\n\t\t\tstarted(() => api.listEndpoints(projectId)),\n\t\t]),\n\t);\n\t// Data API is enabled per branch + database, so resolve a database to probe.\n\tconst databasesRead = started(() =>\n\t\tapi.listBranchDatabases(projectId, branchId),\n\t);\n\t// Preview reads degrade to \"none / disabled\" when the feature isn't available for the\n\t// project/region. `pullConfig` mirrors the branch for env resolution (`neon dev`,\n\t// `neon env pull`) and `inspect` — an unavailable Preview feature should not break those\n\t// (env comes from auth/dataApi/postgres). `pushConfig` is the place that fails on an\n\t// unavailable feature, and only when the policy declares it.\n\t// The group starts together once databases resolve (the Data API probe needs one), as\n\t// before, so which member's error comes first is unchanged.\n\tconst previewRead = started(() =>\n\t\tdatabasesRead.then((databases) => {\n\t\t\tconst probeDatabase = pickProbeDatabase(databases);\n\t\t\treturn Promise.all([\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listBranchBuckets(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listBranchFunctions(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tdegradeUnavailable(\n\t\t\t\t\t\t() => api.listCredentials(projectId, branchId),\n\t\t\t\t\t\t[],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstarted(() => api.getNeonAuth(projectId, branchId)),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tprobeDatabase\n\t\t\t\t\t\t? api.getNeonDataApi(projectId, branchId, probeDatabase)\n\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t),\n\t\t\t\tstarted(() =>\n\t\t\t\t\tgetRealtime\n\t\t\t\t\t\t? degradeUnavailable(\n\t\t\t\t\t\t\t\t() => getRealtime(projectId, branchId),\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: Promise.resolve(null),\n\t\t\t\t),\n\t\t\t]);\n\t\t}),\n\t);\n\n\tconst project = await projectRead;\n\tconst [branches, endpoints] = await listsRead;\n\tconst branch = resolveBranch(branchId, branches);\n\tconst endpoint = endpoints.find(\n\t\t(ep) => ep.type === \"read_write\" && ep.branchId === branch.id,\n\t);\n\tawait databasesRead;\n\tconst [buckets, functions, credentials, auth, dataApi, realtime] =\n\t\tawait previewRead;\n\n\treturn buildPulledBranchConfig(project, branch, branches, endpoint, {\n\t\tbuckets,\n\t\tfunctions,\n\t\tcredentials,\n\t\tauthEnabled: auth !== null,\n\t\tdataApiEnabled: dataApi !== null,\n\t\tdataApi,\n\t\trealtime,\n\t});\n}\n\n/**\n * The `dataApi` a pulled policy declares for a live Data API. The provider is fixed when the\n * Data API is created, so a bare `true` (Neon Auth) is only right when that is what the\n * branch has; writing it over an external-IdP Data API would make the next apply enable Neon\n * Auth. When the API does not report the provider (older Data APIs), the branch's Neon Auth\n * state is the best available answer: with Neon Auth off, the Data API cannot be using it.\n */\nexport function pulledDataApiConfig(\n\tdataApi: NeonDataApiSnapshot,\n\tauthEnabled: boolean,\n): DataApiInput {\n\tconst external = (): DataApiExternalAuthConfig => {\n\t\tconst config: DataApiExternalAuthConfig = { authProvider: \"external\" };\n\t\tif (dataApi.jwksUrl !== undefined) config.jwksUrl = dataApi.jwksUrl;\n\t\tif (dataApi.providerName !== undefined)\n\t\t\tconfig.providerName = dataApi.providerName;\n\t\tif (dataApi.jwtAudience !== undefined)\n\t\t\tconfig.jwtAudience = dataApi.jwtAudience;\n\t\treturn config;\n\t};\n\tswitch (dataApi.authProvider) {\n\t\tcase \"neon_auth\":\n\t\t\treturn true;\n\t\tcase \"external\":\n\t\t\treturn external();\n\t\tdefault:\n\t\t\t// \"none\" has no policy spelling; `external` without a JWKS declares the Data API\n\t\t\t// while leaving Neon Auth alone, which is the one thing a provider-less Data API\n\t\t\t// and an unknown one have in common.\n\t\t\treturn authEnabled ? true : external();\n\t}\n}\n\n/**\n * Starts a read now and keeps an unread rejection from crashing the process; the caller\n * awaits it (and sees the error) when its turn comes. Also turns a synchronous throw from\n * a custom adapter into a rejection.\n */\nfunction started<T>(read: () => Promise<T>): Promise<T> {\n\tconst promise = Promise.resolve().then(read);\n\tpromise.catch(() => undefined);\n\treturn promise;\n}\n\n/**\n * Pick the database to probe for a Data API integration. Data API is enabled per\n * branch + database; for read-back we only need to know whether *any* database has it\n * on, so prefer the conventional default (`neondb`) and otherwise fall back to the first\n * database. Returns `undefined` when the branch has no databases.\n */\nfunction pickProbeDatabase(\n\tdatabases: NeonDatabaseSnapshot[],\n): string | undefined {\n\tif (databases.length === 0) return undefined;\n\tconst byName = databases.find((d) => d.name === \"neondb\");\n\tif (byName) return byName.name;\n\treturn databases[0].name;\n}\n\n/**\n * Run a Preview-feature read, returning `fallback` if the feature is unavailable for the\n * project/region. Most adapters report {@link ErrorCode.FeatureUnavailable}; API hosts where\n * a route is not deployed can instead return a generic 404. The project and branch are\n * validated independently by `pullConfig`, so that route-level 404 is also safe to degrade.\n * Other errors propagate. This lets a branch without a Preview feature still mirror cleanly\n * for env resolution / `inspect`, rather than aborting on an unrelated capability.\n */\nasync function degradeUnavailable<T>(\n\tread: () => Promise<T>,\n\tfallback: T,\n): Promise<T> {\n\ttry {\n\t\treturn await read();\n\t} catch (err) {\n\t\tif (\n\t\t\terr instanceof PlatformError &&\n\t\t\t(err.code === ErrorCode.FeatureUnavailable ||\n\t\t\t\t(err.code === ErrorCode.NotFound && err.details.status === 404))\n\t\t) {\n\t\t\treturn fallback;\n\t\t}\n\t\tthrow err;\n\t}\n}\n\nfunction createApiFromOptions(options: PullConfigOptions): NeonApi {\n\treturn createNeonApiFromOptions(\"pullConfig\", {\n\t\t...(options.apiKey ? { apiKey: options.apiKey } : {}),\n\t\t...(options.apiHost ? { apiHost: options.apiHost } : {}),\n\t});\n}\n\nexport function buildPulledBranchConfig(\n\tproject: NeonProjectSnapshot,\n\tbranch: NeonBranchSnapshot,\n\tbranches: NeonBranchSnapshot[],\n\tendpoint: NeonEndpointSnapshot | undefined,\n\tpreviewState?: {\n\t\tbuckets: NeonBucketSnapshot[];\n\t\tfunctions: NeonFunctionSnapshot[];\n\t\tcredentials?: NeonCredentialMeta[];\n\t\t/** Whether a Neon Auth integration is enabled on the branch. */\n\t\tauthEnabled?: boolean;\n\t\t/** Whether a Neon Data API integration is enabled on the branch. */\n\t\tdataApiEnabled?: boolean;\n\t\t/**\n\t\t * The live Data API, when enabled. Its auth provider decides the shape of the emitted\n\t\t * `dataApi` (see {@link pulledDataApiConfig}); with only `dataApiEnabled` the policy\n\t\t * falls back to a bare `true`.\n\t\t */\n\t\tdataApi?: NeonDataApiSnapshot | null;\n\t\t/** Realtime state when the adapter supports the branch endpoint. */\n\t\trealtime?: NeonRealtimeSnapshot | null;\n\t},\n): PulledBranchConfig {\n\tconst parent = branch.parentId\n\t\t? branches.find((b) => b.id === branch.parentId)\n\t\t: undefined;\n\t// Auth and Data API are static top-level toggles, while Realtime is static under\n\t// `preview.realtime`. A config pulled from a branch with them enabled round-trips through\n\t// `resolveConfig` / `fetchEnv` and the matching secrets get injected. Branch\n\t// lifecycle/compute is per-branch tuning, so it goes in the `branch` closure.\n\tconst tuning: BranchTuning = {};\n\tif (parent) tuning.parent = parent.name;\n\t// Deliberately NOT emitting `ttl` from `branch.expiresAt`: policy `ttl` is a\n\t// creation-time *duration*, while `expiresAt` is an absolute timestamp. Feeding the\n\t// timestamp through `parseDuration` (in `resolveConfig`) would throw, breaking\n\t// `fetchEnv` / `neon dev` / `neon env pull` for any branch that has a TTL. The expiry\n\t// is reported faithfully on `branch.expiresAt` above.\n\tif (branch.protected) tuning.protected = true;\n\tif (endpoint) {\n\t\tconst compute = endpointToComputeSettings(endpoint, project);\n\t\tif (compute) tuning.postgres = { computeSettings: compute };\n\t}\n\t// Buckets round-trip cleanly (name + access level), so they belong in the config the\n\t// env path resolves from — this is what lets `neon dev` / `neon env pull` inject the\n\t// branch's object-storage credentials (AWS_*) with no local neon.ts. Functions are\n\t// deliberately NOT emitted here (they can't round-trip: the remote has no `source`\n\t// path) and neither is the AI Gateway (no branch-level enabled state to detect, only a\n\t// credential) — both would otherwise turn a read-back into a bogus policy declaration.\n\tconst bucketDefs: Record<string, { access: BucketAccessLevel }> = {};\n\tfor (const b of previewState?.buckets ?? []) {\n\t\tbucketDefs[b.name] = { access: b.accessLevel };\n\t}\n\tconst policyPreview: NonNullable<Config[\"preview\"]> = {};\n\tif (previewState?.realtime?.enabled) policyPreview.realtime = true;\n\tif (Object.keys(bucketDefs).length > 0) policyPreview.buckets = bucketDefs;\n\tconst authEnabled = previewState?.authEnabled === true;\n\tconst dataApi = previewState?.dataApi\n\t\t? pulledDataApiConfig(previewState.dataApi, authEnabled)\n\t\t: previewState?.dataApiEnabled\n\t\t\t? true\n\t\t\t: undefined;\n\tconst config: Config = {\n\t\t...(authEnabled ? { auth: true } : {}),\n\t\t...(dataApi !== undefined ? { dataApi } : {}),\n\t\t...(Object.keys(policyPreview).length > 0\n\t\t\t? { preview: policyPreview }\n\t\t\t: {}),\n\t\t...(Object.keys(tuning).length > 0 ? { branch: () => tuning } : {}),\n\t};\n\tconst result: PulledBranchConfig = {\n\t\tproject: {\n\t\t\tid: project.id,\n\t\t\tname: project.name,\n\t\t\tregion: project.regionId,\n\t\t\tpgVersion: project.pgVersion,\n\t\t\t...(project.orgId ? { orgId: project.orgId } : {}),\n\t\t},\n\t\tbranch: {\n\t\t\tid: branch.id,\n\t\t\tname: branch.name,\n\t\t\t...(parent ? { parent: parent.name } : {}),\n\t\t\tisDefault: branch.isDefault,\n\t\t\tprotected: branch.protected,\n\t\t\t...(branch.expiresAt ? { expiresAt: branch.expiresAt } : {}),\n\t\t},\n\t\tconfig,\n\t};\n\tconst preview = previewState ? buildPulledPreview(previewState) : undefined;\n\tif (preview) result.preview = preview;\n\treturn result;\n}\n\n/**\n * Reverse-engineer the {@link PulledPreview} from remote snapshots. Returns `undefined` when\n * the branch has no Preview features so the field can be omitted entirely.\n */\nfunction buildPulledPreview(state: {\n\tbuckets: NeonBucketSnapshot[];\n\tfunctions: NeonFunctionSnapshot[];\n\tcredentials?: NeonCredentialMeta[];\n}): PulledPreview | undefined {\n\tconst credentials = state.credentials ?? [];\n\tif (\n\t\tstate.buckets.length === 0 &&\n\t\tstate.functions.length === 0 &&\n\t\tcredentials.length === 0\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tbuckets: state.buckets.map((b) => ({\n\t\t\tname: b.name,\n\t\t\taccess: b.accessLevel,\n\t\t})),\n\t\tfunctions: state.functions.map((f) => ({\n\t\t\tslug: f.slug,\n\t\t\tname: f.name,\n\t\t})),\n\t\tcredentials,\n\t};\n}\n\nfunction resolveBranch(\n\tbranchId: string,\n\tbranches: NeonBranchSnapshot[],\n): NeonBranchSnapshot {\n\tconst match = branches.find((b) => b.id === branchId);\n\tif (match) return match;\n\tthrow new PlatformError(\n\t\tErrorCode.BranchNotFound,\n\t\t[\n\t\t\t`pullConfig: branch id ${JSON.stringify(branchId)} not found on project.`,\n\t\t\t`Available branches: ${branches.map((b) => `${b.name} (${b.id})`).join(\", \") || \"(none)\"}.`,\n\t\t].join(\" \"),\n\t\t{\n\t\t\tdetails: {\n\t\t\t\tbranchId,\n\t\t\t\tavailable: branches.map((b) => b.id),\n\t\t\t},\n\t\t},\n\t);\n}\n\nfunction endpointToComputeSettings(\n\tendpoint: NeonEndpointSnapshot,\n\tproject: NeonProjectSnapshot,\n): ComputeSettings | undefined {\n\tconst defaults = project.defaultEndpointSettings;\n\tconst out: ComputeSettings = {};\n\tif (\n\t\tendpoint.autoscalingLimitMinCu !== undefined &&\n\t\tendpoint.autoscalingLimitMinCu !== defaults?.autoscalingLimitMinCu\n\t) {\n\t\tout.autoscalingLimitMinCu = endpoint.autoscalingLimitMinCu;\n\t}\n\tif (\n\t\tendpoint.autoscalingLimitMaxCu !== undefined &&\n\t\tendpoint.autoscalingLimitMaxCu !== defaults?.autoscalingLimitMaxCu\n\t) {\n\t\tout.autoscalingLimitMaxCu = endpoint.autoscalingLimitMaxCu;\n\t}\n\tif (\n\t\tendpoint.suspendTimeout !== undefined &&\n\t\tendpoint.suspendTimeout !== defaults?.suspendTimeout\n\t) {\n\t\tout.suspendTimeout = endpoint.suspendTimeout;\n\t}\n\treturn Object.keys(out).length > 0 ? out : undefined;\n}\n"],"mappings":";;AA8FA,eAAsB,WACrB,SAC8B;CAC9B,MAAM,MAAM,QAAQ,OAAO,qBAAqB,OAAO;CACvD,MAAM,YAAY,QAAQ;CAC1B,MAAM,WAAW,QAAQ;CACzB,MAAM,cACL,QAAQ,aAAa,QAClB,KAAA,IACA,IAAI,0BAA0B,KAAK,GAAG;CAK1C,MAAM,cAAc,cAAc,IAAI,WAAW,SAAS,CAAC;CAC3D,MAAM,YAAY,cACjB,QAAQ,IAAI,CACX,cAAc,IAAI,aAAa,SAAS,CAAC,GACzC,cAAc,IAAI,cAAc,SAAS,CAAC,CAC3C,CAAC,CACF;CAEA,MAAM,gBAAgB,cACrB,IAAI,oBAAoB,WAAW,QAAQ,CAC5C;CAQA,MAAM,cAAc,cACnB,cAAc,MAAM,cAAc;EACjC,MAAM,gBAAgB,kBAAkB,SAAS;EACjD,OAAO,QAAQ,IAAI;GAClB,cACC,yBACO,IAAI,kBAAkB,WAAW,QAAQ,GAC/C,CAAC,CACF,CACD;GACA,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EAAE;GACR,MAAM,EAAE;EACT,EAAE;EACF;CACD;AACD;AAEA,SAAS,cACR,UACA,UACqB;CACrB,MAAM,QAAQ,SAAS,MAAM,MAAM,EAAE,OAAO,QAAQ;CACpD,IAAI,OAAO,OAAO;CAClB,MAAM,IAAI,cACT,UAAU,gBACV,CACC,yBAAyB,KAAK,UAAU,QAAQ,EAAE,yBAClD,uBAAuB,SAAS,KAAK,MAAM,GAAG,EAAE,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,SAAS,EAC1F,CAAC,CAAC,KAAK,GAAG,GACV,EACC,SAAS;EACR;EACA,WAAW,SAAS,KAAK,MAAM,EAAE,EAAE;CACpC,EACD,CACD;AACD;AAEA,SAAS,0BACR,UACA,SAC8B;CAC9B,MAAM,WAAW,QAAQ;CACzB,MAAM,MAAuB,CAAC;CAC9B,IACC,SAAS,0BAA0B,KAAA,KACnC,SAAS,0BAA0B,UAAU,uBAE7C,IAAI,wBAAwB,SAAS;CAEtC,IACC,SAAS,0BAA0B,KAAA,KACnC,SAAS,0BAA0B,UAAU,uBAE7C,IAAI,wBAAwB,SAAS;CAEtC,IACC,SAAS,mBAAmB,KAAA,KAC5B,SAAS,mBAAmB,UAAU,gBAEtC,IAAI,iBAAiB,SAAS;CAE/B,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,IAAI,MAAM,KAAA;AAC5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionBundler } from "./function-bundle.js";
|
|
2
2
|
import { Config, ConflictReport, NeonApi, PushResult } from "@neon/config";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/lib/push-config.d.ts
|
|
5
5
|
interface PushConfigOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Neon project id. **Required** — the management API addresses every branch through
|
|
@@ -126,6 +126,5 @@ interface PushConfirmContext {
|
|
|
126
126
|
* It will **not** create a project or branch — both must already exist on Neon.
|
|
127
127
|
*/
|
|
128
128
|
declare function pushConfig(config: Config, options: PushConfigOptions): Promise<PushResult>;
|
|
129
|
-
//#endregion
|
|
130
129
|
export { PushConfigOptions, PushConfirmContext, pushConfig };
|
|
131
130
|
//# sourceMappingURL=push-config.d.ts.map
|
package/dist/lib/push-config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorCode, PlatformError, PushAbortedError, PushConflictError, createNeonApiFromOptions, diffConfig, resolveConfig } from "@neon/config";
|
|
2
|
-
|
|
2
|
+
// src/lib/push-config.ts
|
|
3
3
|
const makeDefaultBundleFunction = (onWarning) => async (fn) => {
|
|
4
4
|
const { buildFunctionBundle } = await import("./function-bundle.js");
|
|
5
5
|
return buildFunctionBundle(fn, { onWarning });
|
|
@@ -748,7 +748,6 @@ function updateTriggerInput(functionSlug, trigger) {
|
|
|
748
748
|
enabled: trigger.enabled
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
//#endregion
|
|
752
751
|
export { pushConfig };
|
|
753
752
|
|
|
754
753
|
//# sourceMappingURL=push-config.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/lib/resolve-package.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Locate an installed package by walking `node_modules` up from `fromDir`, the way Node
|
|
4
3
|
* resolves.
|
|
@@ -23,6 +22,5 @@ declare function readPackageManifest(dir: string): Record<string, unknown> | und
|
|
|
23
22
|
* installing whatever the registry calls latest.
|
|
24
23
|
*/
|
|
25
24
|
declare function installedPackageVersion(fromDir: string, name: string): string | undefined;
|
|
26
|
-
//#endregion
|
|
27
25
|
export { findPackageDir, installedPackageVersion, readPackageManifest };
|
|
28
26
|
//# sourceMappingURL=resolve-package.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-package.d.ts","names":["findPackageDir","readPackageManifest","Record","installedPackageVersion","findPackageDir","fromDir","name","readPackageManifest","dir","Record","installedPackageVersion"],"sources":["../../src/lib/resolve-package.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-package.d.ts","names":["findPackageDir","readPackageManifest","Record","installedPackageVersion","findPackageDir","fromDir","name","readPackageManifest","dir","Record","installedPackageVersion"],"sources":["../../src/lib/resolve-package.ts"],"mappings":";AAkBA;AAgBA;AAoBA;;;;;;;;;;;;A,iBApCgBA,cAAAA,C;;A,iBAgBAC,mBAAAA,C,cAEbC,M;;;;;;A,iBAkBaC,uBAAAA,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
2
|
import { readFileSync, statSync } from "node:fs";
|
|
3
|
-
|
|
3
|
+
// src/lib/resolve-package.ts
|
|
4
4
|
/**
|
|
5
5
|
* Locate an installed package by walking `node_modules` up from `fromDir`, the way Node
|
|
6
6
|
* resolves.
|
|
@@ -46,7 +46,6 @@ function installedPackageVersion(fromDir, name) {
|
|
|
46
46
|
const version = readPackageManifest(dir)?.version;
|
|
47
47
|
return typeof version === "string" ? version : void 0;
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { findPackageDir, installedPackageVersion, readPackageManifest };
|
|
51
50
|
|
|
52
51
|
//# sourceMappingURL=resolve-package.js.map
|
package/dist/lib/run-hook.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hook, ShellHook } from "@neon/config";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/lib/run-hook.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Thrown when a **shell-command** hook exits non-zero (or fails to spawn). Function hooks
|
|
@@ -46,6 +46,5 @@ declare function runHook<Ctx, Result>(hook: Hook<Ctx, Result> | undefined, ctx:
|
|
|
46
46
|
* with Neon env injected. Throws {@link HookExecutionError} on the first non-zero exit.
|
|
47
47
|
*/
|
|
48
48
|
declare function runShellHook(hook: ShellHook, options?: RunHookOptions): Promise<void>;
|
|
49
|
-
//#endregion
|
|
50
49
|
export { HookExecutionError, RunHookOptions, runHook, runShellHook };
|
|
51
50
|
//# sourceMappingURL=run-hook.d.ts.map
|
package/dist/lib/run-hook.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
|
|
2
|
+
// src/lib/run-hook.ts
|
|
3
3
|
/**
|
|
4
4
|
* Thrown when a **shell-command** hook exits non-zero (or fails to spawn). Function hooks
|
|
5
5
|
* surface their own thrown errors directly; this wraps the process-level failure with the
|
|
@@ -86,7 +86,6 @@ function buildEnv(extra) {
|
|
|
86
86
|
}
|
|
87
87
|
return env;
|
|
88
88
|
}
|
|
89
|
-
//#endregion
|
|
90
89
|
export { HookExecutionError, runHook, runShellHook };
|
|
91
90
|
|
|
92
91
|
//# sourceMappingURL=run-hook.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runHook, runShellHook } from "./run-hook.js";
|
|
2
2
|
import { describe, test } from "../node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js";
|
|
3
3
|
import { import_dist } from "../node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@29.1.1_@noble_ha_0258998ed4eee0dc3e7b1b8446e9e9d6/node_modules/vitest/dist/index.js";
|
|
4
|
-
|
|
4
|
+
// src/lib/run-hook.test-d.ts
|
|
5
5
|
describe("runHook return typing", () => {
|
|
6
6
|
test("a function hook resolves to `Result | undefined`, inferred from the function", () => {
|
|
7
7
|
const fn = (ctx) => ({ name: ctx.inputName });
|
|
@@ -33,7 +33,6 @@ describe("RunHookOptions shape", () => {
|
|
|
33
33
|
(0, import_dist.expectTypeOf)().toEqualTypeOf();
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
-
//#endregion
|
|
37
36
|
export {};
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=run-hook.test-d.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function(e) {
|
|
5
5
|
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
@@ -871,7 +871,6 @@ const plugins = {
|
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
|
-
//#endregion
|
|
875
874
|
export { plugins };
|
|
876
875
|
|
|
877
876
|
//# sourceMappingURL=index.js.map
|
package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/@vitest+runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js
|
|
2
2
|
function createChainable(keys, fn) {
|
|
3
3
|
function create(context) {
|
|
4
4
|
const chain2 = function(...args) {
|
|
@@ -24,7 +24,6 @@ function createChainable(keys, fn) {
|
|
|
24
24
|
chain.fn = fn;
|
|
25
25
|
return chain;
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createChainable as c };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=chunk-tasks.js.map
|
package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createDefer, isNegativeNaN, isObject, objectAttr, toArray } from "../..
|
|
|
3
3
|
import { getSafeTimers } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js";
|
|
4
4
|
import { parseSingleStack } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js";
|
|
5
5
|
import { c as createChainable } from "./chunk-tasks.js";
|
|
6
|
-
|
|
6
|
+
// ../../node_modules/.pnpm/@vitest+runner@3.0.9/node_modules/@vitest/runner/dist/index.js
|
|
7
7
|
var PendingError = class extends Error {
|
|
8
8
|
constructor(message, task, note) {
|
|
9
9
|
super(message);
|
|
@@ -575,7 +575,6 @@ function findTestFileStackTrace(error, each) {
|
|
|
575
575
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
576
576
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
577
577
|
Date.now;
|
|
578
|
-
//#endregion
|
|
579
578
|
export { createTaskCollector, describe, getCurrentSuite, getCurrentTest, getHooks, setFn, setHooks, suite, test };
|
|
580
579
|
|
|
581
580
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { plugins } from "../../../../../@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js";
|
|
2
2
|
import inspect$1 from "../../../../../loupe@3.2.1/node_modules/loupe/lib/index.js";
|
|
3
|
-
|
|
3
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
|
|
4
4
|
const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
|
|
5
5
|
const formatRegExp = /%[sdjifoOc%]/g;
|
|
6
6
|
function format(...args) {
|
|
@@ -85,7 +85,6 @@ function objDisplay(obj, options = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
return str;
|
|
87
87
|
}
|
|
88
|
-
//#endregion
|
|
89
88
|
export { format as f, inspect as i, objDisplay as o };
|
|
90
89
|
|
|
91
90
|
//# sourceMappingURL=chunk-_commonjsHelpers.js.map
|
package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js
|
|
2
2
|
function assertTypes(value, name, types) {
|
|
3
3
|
const receivedType = typeof value;
|
|
4
4
|
if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
|
|
@@ -37,7 +37,6 @@ function isNegativeNaN(val) {
|
|
|
37
37
|
f64[0] = val;
|
|
38
38
|
return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { assertTypes, createDefer, isNegativeNaN, isObject, objectAttr, toArray };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=helpers.js.map
|
package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js";
|
|
|
2
2
|
import "../../../../../loupe@3.2.1/node_modules/loupe/lib/index.js";
|
|
3
3
|
import { f as format, o as objDisplay } from "./chunk-_commonjsHelpers.js";
|
|
4
4
|
import { assertTypes, createDefer, isNegativeNaN, isObject, objectAttr, toArray } from "./helpers.js";
|
|
5
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/@vitest+utils@3.0.9/node_modules/@vitest/utils/dist/index.js
|
|
6
6
|
var jsTokens_1;
|
|
7
7
|
var hasRequiredJsTokens;
|
|
8
8
|
function requireJsTokens() {
|
|
@@ -444,7 +444,6 @@ function getSafeTimers() {
|
|
|
444
444
|
queueMicrotask: safeQueueMicrotask
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
//#endregion
|
|
448
447
|
export { assertTypes, createDefer, format, getSafeTimers, isNegativeNaN, isObject, objDisplay, objectAttr, toArray };
|
|
449
448
|
|
|
450
449
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -3104,7 +3104,6 @@ references to blow the stack.
|
|
|
3104
3104
|
* @return {Boolean} result
|
|
3105
3105
|
*)
|
|
3106
3106
|
*/
|
|
3107
|
-
//#endregion
|
|
3108
3107
|
export { Assertion, AssertionError, Should, assert, config, expect, should, use, utils_exports as util };
|
|
3109
3108
|
|
|
3110
3109
|
//# sourceMappingURL=chai.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js
|
|
3
3
|
var require_branding = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
}));
|
|
6
|
-
//#endregion
|
|
7
6
|
export default require_branding();
|
|
8
7
|
export { require_branding };
|
|
9
8
|
|
|
@@ -3,7 +3,7 @@ import { require_branding } from "./branding.js";
|
|
|
3
3
|
import { require_messages } from "./messages.js";
|
|
4
4
|
import { require_overloads } from "./overloads.js";
|
|
5
5
|
import { require_utils } from "./utils.js";
|
|
6
|
-
|
|
6
|
+
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js
|
|
7
7
|
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
8
8
|
var __createBinding = this$1 && this$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
9
9
|
if (k2 === void 0) k2 = k;
|
|
@@ -102,7 +102,6 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
|
102
102
|
};
|
|
103
103
|
exports.expectTypeOf = expectTypeOf;
|
|
104
104
|
}));
|
|
105
|
-
//#endregion
|
|
106
105
|
export default require_dist();
|
|
107
106
|
export { require_dist };
|
|
108
107
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js
|
|
3
3
|
var require_messages = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
}));
|
|
6
|
-
//#endregion
|
|
7
6
|
export default require_messages();
|
|
8
7
|
export { require_messages };
|
|
9
8
|
|
package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js
|
|
3
3
|
var require_overloads = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
}));
|
|
6
|
-
//#endregion
|
|
7
6
|
export default require_overloads();
|
|
8
7
|
export { require_overloads };
|
|
9
8
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js
|
|
3
3
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
}));
|
|
6
|
-
//#endregion
|
|
7
6
|
export default require_utils();
|
|
8
7
|
export { require_utils };
|
|
9
8
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { inspectList } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js
|
|
3
3
|
function inspectArguments(args, options) {
|
|
4
4
|
if (args.length === 0) return "Arguments[]";
|
|
5
5
|
options.truncate -= 13;
|
|
6
6
|
return `Arguments[ ${inspectList(args, options)} ]`;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { inspectArguments as default };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=arguments.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList, inspectProperty } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js
|
|
3
3
|
function inspectArray(array, options) {
|
|
4
4
|
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
5
5
|
if (!array.length && !nonIndexProperties.length) return "[]";
|
|
@@ -10,7 +10,6 @@ function inspectArray(array, options) {
|
|
|
10
10
|
if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
11
11
|
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { inspectArray as default };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=array.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js
|
|
3
3
|
function inspectBigInt(number, options) {
|
|
4
4
|
let nums = truncate(number.toString(), options.truncate - 1);
|
|
5
5
|
if (nums !== "…") nums += "n";
|
|
6
6
|
return options.stylize(nums, "bigint");
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { inspectBigInt as default };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=bigint.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import inspectObject from "./object.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js
|
|
3
3
|
const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
4
4
|
function inspectClass(value, options) {
|
|
5
5
|
let name = "";
|
|
@@ -9,7 +9,6 @@ function inspectClass(value, options) {
|
|
|
9
9
|
options.truncate -= name.length;
|
|
10
10
|
return `${name}${inspectObject(value, options)}`;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { inspectClass as default };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=class.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js
|
|
3
3
|
function inspectDate(dateObject, options) {
|
|
4
4
|
const stringRepresentation = dateObject.toJSON();
|
|
5
5
|
if (stringRepresentation === null) return "Invalid Date";
|
|
@@ -7,7 +7,6 @@ function inspectDate(dateObject, options) {
|
|
|
7
7
|
const date = split[0];
|
|
8
8
|
return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { inspectDate as default };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=date.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList, inspectProperty, truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js
|
|
3
3
|
const errorKeys = [
|
|
4
4
|
"stack",
|
|
5
5
|
"line",
|
|
@@ -28,7 +28,6 @@ function inspectObject(error, options) {
|
|
|
28
28
|
const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
|
|
29
29
|
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { inspectObject as default };
|
|
33
32
|
|
|
34
33
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js
|
|
3
3
|
function inspectFunction(func, options) {
|
|
4
4
|
const functionType = func[Symbol.toStringTag] || "Function";
|
|
5
5
|
const name = func.name;
|
|
6
6
|
if (!name) return options.stylize(`[${functionType}]`, "special");
|
|
7
7
|
return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { inspectFunction as default };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=function.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js
|
|
2
2
|
const ansiColors = {
|
|
3
3
|
bold: ["1", "22"],
|
|
4
4
|
dim: ["2", "22"],
|
|
@@ -116,7 +116,6 @@ function inspectProperty([key, value], options) {
|
|
|
116
116
|
value = options.inspect(value, options);
|
|
117
117
|
return `${key}: ${value}`;
|
|
118
118
|
}
|
|
119
|
-
//#endregion
|
|
120
119
|
export { inspectList, inspectProperty, normaliseOptions, truncate };
|
|
121
120
|
|
|
122
121
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js
|
|
3
3
|
function inspectAttribute([key, value], options) {
|
|
4
4
|
options.truncate -= 3;
|
|
5
5
|
if (!value) return `${options.stylize(String(key), "yellow")}`;
|
|
@@ -33,7 +33,6 @@ function inspectHTML(element, options) {
|
|
|
33
33
|
if (children && children.length > truncate) children = `…(${element.children.length})`;
|
|
34
34
|
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
35
35
|
}
|
|
36
|
-
//#endregion
|
|
37
36
|
export { inspectHTML as default, inspectAttribute, inspectNode, inspectNodeCollection };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=html.js.map
|
|
@@ -16,7 +16,7 @@ import inspectClass from "./class.js";
|
|
|
16
16
|
import inspectArguments from "./arguments.js";
|
|
17
17
|
import inspectObject$1 from "./error.js";
|
|
18
18
|
import inspectHTML, { inspectNodeCollection } from "./html.js";
|
|
19
|
-
|
|
19
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js
|
|
20
20
|
const chaiInspect = typeof Symbol === "function" && typeof Symbol.for === "function" ? Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
21
21
|
const nodeInspect = Symbol.for("nodejs.util.inspect.custom");
|
|
22
22
|
const constructorMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -93,7 +93,6 @@ function inspect(value, opts = {}) {
|
|
|
93
93
|
if (value === Object(value)) return inspectObject(value, options);
|
|
94
94
|
return options.stylize(String(value), type);
|
|
95
95
|
}
|
|
96
|
-
//#endregion
|
|
97
96
|
export { inspect as default, inspect };
|
|
98
97
|
|
|
99
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js
|
|
3
3
|
function inspectMapEntry([key, value], options) {
|
|
4
4
|
options.truncate -= 4;
|
|
5
5
|
key = options.inspect(key, options);
|
|
@@ -19,7 +19,6 @@ function inspectMap(map, options) {
|
|
|
19
19
|
options.truncate -= 7;
|
|
20
20
|
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { inspectMap as default };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=map.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js
|
|
3
3
|
const isNaN = Number.isNaN || ((i) => i !== i);
|
|
4
4
|
function inspectNumber(number, options) {
|
|
5
5
|
if (isNaN(number)) return options.stylize("NaN", "number");
|
|
@@ -8,7 +8,6 @@ function inspectNumber(number, options) {
|
|
|
8
8
|
if (number === 0) return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
|
|
9
9
|
return options.stylize(truncate(String(number), options.truncate), "number");
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { inspectNumber as default };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=number.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList, inspectProperty } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js
|
|
3
3
|
function inspectObject(object, options) {
|
|
4
4
|
const properties = Object.getOwnPropertyNames(object);
|
|
5
5
|
const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
@@ -15,7 +15,6 @@ function inspectObject(object, options) {
|
|
|
15
15
|
if (propertyContents && symbolContents) sep = ", ";
|
|
16
16
|
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { inspectObject as default };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=object.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js
|
|
2
2
|
const getPromiseValue = () => "Promise{…}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { getPromiseValue as default };
|
|
5
4
|
|
|
6
5
|
//# sourceMappingURL=promise.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js
|
|
3
3
|
function inspectRegExp(value, options) {
|
|
4
4
|
const flags = value.toString().split("/")[2];
|
|
5
5
|
const sourceLength = options.truncate - (2 + flags.length);
|
|
6
6
|
const source = value.source;
|
|
7
7
|
return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { inspectRegExp as default };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=regexp.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js
|
|
3
3
|
function arrayFromSet(set) {
|
|
4
4
|
const values = [];
|
|
5
5
|
set.forEach((value) => {
|
|
@@ -12,7 +12,6 @@ function inspectSet(set, options) {
|
|
|
12
12
|
options.truncate -= 7;
|
|
13
13
|
return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { inspectSet as default };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=set.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js
|
|
3
3
|
const stringEscapeChars = /* @__PURE__ */ new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
|
|
4
4
|
const escapeCharacters = {
|
|
5
5
|
"\b": "\\b",
|
|
@@ -18,7 +18,6 @@ function inspectString(string, options) {
|
|
|
18
18
|
if (stringEscapeChars.test(string)) string = string.replace(stringEscapeChars, escape);
|
|
19
19
|
return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { inspectString as default };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=string.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js
|
|
2
2
|
function inspectSymbol(value) {
|
|
3
3
|
if ("description" in Symbol.prototype) return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
4
4
|
return value.toString();
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { inspectSymbol as default };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=symbol.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inspectList, inspectProperty, truncate } from "./helpers.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js
|
|
3
3
|
const getArrayName = (array) => {
|
|
4
4
|
if (typeof Buffer === "function" && array instanceof Buffer) return "Buffer";
|
|
5
5
|
if (array[Symbol.toStringTag]) return array[Symbol.toStringTag];
|
|
@@ -24,7 +24,6 @@ function inspectTypedArray(array, options) {
|
|
|
24
24
|
if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
25
25
|
return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { inspectTypedArray as default };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=typedarray.js.map
|
package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
|
|
2
2
|
var h = Object.entries({
|
|
3
3
|
reset: [0, 0],
|
|
4
4
|
bold: [
|
|
@@ -76,7 +76,6 @@ function p(n = !1) {
|
|
|
76
76
|
for (let [r, t] of h) u[r] = e ? g(d(t[0]), d(t[1]), t[2]) : a;
|
|
77
77
|
return u;
|
|
78
78
|
}
|
|
79
|
-
//#endregion
|
|
80
79
|
export { C as b, p as c };
|
|
81
80
|
|
|
82
81
|
//# sourceMappingURL=chunk-BVHSVHOK.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { c as p } from "./chunk-BVHSVHOK.js";
|
|
2
2
|
import { isatty } from "tty";
|
|
3
|
-
|
|
3
|
+
// ../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js
|
|
4
4
|
var r = process.env.FORCE_TTY !== void 0 || isatty(1);
|
|
5
5
|
p(r);
|
|
6
|
-
//#endregion
|
|
7
6
|
export {};
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=node.js.map
|
|
@@ -2,9 +2,8 @@ import "../../../../chai@5.2.0/node_modules/chai/chai.js";
|
|
|
2
2
|
import { describe, test } from "../../../../@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js";
|
|
3
3
|
import "../../../../@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/utils.js";
|
|
4
4
|
import { require_dist } from "../../../../expect-type@1.2.1/node_modules/expect-type/dist/index.js";
|
|
5
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/vitest@3.0.9_@types+debug@4.1.13_@types+node@20.19.17_jiti@2.7.0_jsdom@29.1.1_@noble+ha_0258998ed4eee0dc3e7b1b8446e9e9d6/node_modules/vitest/dist/index.js
|
|
6
6
|
var import_dist = require_dist();
|
|
7
|
-
//#endregion
|
|
8
7
|
export { describe, import_dist, test };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon/config-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Imperative runtime for @neon/config: inspect/plan/apply a neon.ts policy against the Neon API and bundle + deploy Neon Functions. Pulls in esbuild; import this from CLIs and CI, not from neon.ts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"typescript": "^5.9.0",
|
|
49
49
|
"vitest": "^3.0.9",
|
|
50
50
|
"@neon/e2e-harness": "0.0.0",
|
|
51
|
-
"@neon/sdk": "7.
|
|
51
|
+
"@neon/sdk": "7.7.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@vercel/nft": "^1.10.2",
|
|
55
55
|
"esbuild": "^0.28.1",
|
|
56
56
|
"fflate": "^0.8.3",
|
|
57
|
-
"@neon/config": "1.
|
|
57
|
+
"@neon/config": "1.10.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=20.19.0"
|