@prisma/compute-sdk 0.22.0 → 0.24.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/config/frameworks.d.ts +46 -0
- package/dist/config/frameworks.d.ts.map +1 -0
- package/dist/config/frameworks.js +129 -0
- package/dist/config/frameworks.js.map +1 -0
- package/dist/config/index.d.ts +15 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +15 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +48 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +138 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/normalize.d.ts +77 -0
- package/dist/config/normalize.d.ts.map +1 -0
- package/dist/config/normalize.js +366 -0
- package/dist/config/normalize.js.map +1 -0
- package/dist/config/serialize.d.ts +11 -0
- package/dist/config/serialize.d.ts.map +1 -0
- package/dist/config/serialize.js +55 -0
- package/dist/config/serialize.js.map +1 -0
- package/dist/config/source-root.d.ts +10 -0
- package/dist/config/source-root.d.ts.map +1 -0
- package/dist/config/source-root.js +72 -0
- package/dist/config/source-root.js.map +1 -0
- package/dist/config/types.d.ts +67 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +30 -0
- package/dist/config/types.js.map +1 -0
- package/package.json +10 -2
- package/src/config/frameworks.ts +187 -0
- package/src/config/index.ts +59 -0
- package/src/config/load.ts +198 -0
- package/src/config/normalize.ts +569 -0
- package/src/config/serialize.ts +76 -0
- package/src/config/source-root.ts +91 -0
- package/src/config/types.ts +78 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ComputeFramework } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Framework capability registry — the single source of truth for what each
|
|
4
|
+
* supported framework is and can do. Commands, config validation, detection,
|
|
5
|
+
* and prompts all query this table; adding a framework means adding one
|
|
6
|
+
* entry here plus its build/run strategy implementation.
|
|
7
|
+
*/
|
|
8
|
+
export type FrameworkBuildType = "nextjs" | "nuxt" | "astro" | "tanstack-start" | "bun";
|
|
9
|
+
export interface FrameworkDescriptor {
|
|
10
|
+
readonly key: ComputeFramework;
|
|
11
|
+
readonly displayName: string;
|
|
12
|
+
/** Build/deploy strategy this framework uses. */
|
|
13
|
+
readonly buildType: FrameworkBuildType;
|
|
14
|
+
/** Accepted user-facing spellings, lowercased, including the key. */
|
|
15
|
+
readonly aliases: readonly string[];
|
|
16
|
+
/** Dependencies whose presence detects this framework. */
|
|
17
|
+
readonly detectPackages: readonly string[];
|
|
18
|
+
/** Config files whose presence detects this framework. */
|
|
19
|
+
readonly detectConfigFiles: readonly string[];
|
|
20
|
+
/** Consumes a user-provided source entrypoint instead of build output. */
|
|
21
|
+
readonly usesEntrypoint: boolean;
|
|
22
|
+
/** Entrypoint assumed when the package defines none. */
|
|
23
|
+
readonly defaultEntrypoint: string | null;
|
|
24
|
+
/** Has a local dev server (`app run`) in the current preview. */
|
|
25
|
+
readonly hasLocalDevServer: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const NEXT_CONFIG_FILENAMES: readonly ["next.config.js", "next.config.mjs", "next.config.ts", "next.config.mts"];
|
|
28
|
+
export declare const NUXT_CONFIG_FILENAMES: readonly ["nuxt.config.js", "nuxt.config.mjs", "nuxt.config.cjs", "nuxt.config.ts", "nuxt.config.mts"];
|
|
29
|
+
export declare const ASTRO_CONFIG_FILENAMES: readonly ["astro.config.js", "astro.config.mjs", "astro.config.cjs", "astro.config.ts", "astro.config.mts"];
|
|
30
|
+
export declare const FRAMEWORKS: readonly FrameworkDescriptor[];
|
|
31
|
+
export declare const FRAMEWORK_KEYS: ("astro" | "bun" | "nuxt" | "nextjs" | "hono" | "tanstack-start")[];
|
|
32
|
+
/**
|
|
33
|
+
* Build types whose preview build consumes committed build settings. The
|
|
34
|
+
* others (nuxt, astro) run their framework CLI and stage fixed output, so a
|
|
35
|
+
* config `build` block has nothing to apply to.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CONFIG_BACKED_BUILD_TYPES: readonly ["nextjs", "tanstack-start", "bun"];
|
|
38
|
+
export type ConfigBackedBuildType = (typeof CONFIG_BACKED_BUILD_TYPES)[number];
|
|
39
|
+
/** Build types that consume a user-provided source entrypoint. */
|
|
40
|
+
export declare const ENTRYPOINT_BUILD_TYPES: readonly FrameworkBuildType[];
|
|
41
|
+
/** Build types `app run` can start a local dev server for. */
|
|
42
|
+
export declare const LOCAL_DEV_BUILD_TYPES: readonly FrameworkBuildType[];
|
|
43
|
+
export declare function frameworkByKey(key: ComputeFramework): FrameworkDescriptor;
|
|
44
|
+
export declare function frameworkFromAlias(value: string): FrameworkDescriptor | null;
|
|
45
|
+
export declare function isConfigBackedBuildType(value: string): value is ConfigBackedBuildType;
|
|
46
|
+
//# sourceMappingURL=frameworks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/config/frameworks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;GAKG;AAEH,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,KAAK,CAAC;AAEV,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,0DAA0D;IAC1D,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,iEAAiE;IACjE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACrC;AAED,eAAO,MAAM,qBAAqB,qFAKxB,CAAC;AAEX,eAAO,MAAM,qBAAqB,wGAMxB,CAAC;AAEX,eAAO,MAAM,sBAAsB,6GAMzB,CAAC;AAGX,eAAO,MAAM,UAAU,EAAE,SAAS,mBAAmB,EAwEpD,CAAC;AAEF,eAAO,MAAM,cAAc,qEAA+C,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,8CAIY,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,EAAE,SAAS,kBAAkB,EAM/D,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAM9D,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,CAMzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAM5E;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GACZ,KAAK,IAAI,qBAAqB,CAEhC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export const NEXT_CONFIG_FILENAMES = [
|
|
2
|
+
"next.config.js",
|
|
3
|
+
"next.config.mjs",
|
|
4
|
+
"next.config.ts",
|
|
5
|
+
"next.config.mts",
|
|
6
|
+
];
|
|
7
|
+
export const NUXT_CONFIG_FILENAMES = [
|
|
8
|
+
"nuxt.config.js",
|
|
9
|
+
"nuxt.config.mjs",
|
|
10
|
+
"nuxt.config.cjs",
|
|
11
|
+
"nuxt.config.ts",
|
|
12
|
+
"nuxt.config.mts",
|
|
13
|
+
];
|
|
14
|
+
export const ASTRO_CONFIG_FILENAMES = [
|
|
15
|
+
"astro.config.js",
|
|
16
|
+
"astro.config.mjs",
|
|
17
|
+
"astro.config.cjs",
|
|
18
|
+
"astro.config.ts",
|
|
19
|
+
"astro.config.mts",
|
|
20
|
+
];
|
|
21
|
+
// Detection checks frameworks in this order; keep more specific signals first.
|
|
22
|
+
export const FRAMEWORKS = [
|
|
23
|
+
{
|
|
24
|
+
key: "nextjs",
|
|
25
|
+
displayName: "Next.js",
|
|
26
|
+
buildType: "nextjs",
|
|
27
|
+
aliases: ["nextjs", "next", "next.js"],
|
|
28
|
+
detectPackages: ["next"],
|
|
29
|
+
detectConfigFiles: NEXT_CONFIG_FILENAMES,
|
|
30
|
+
usesEntrypoint: false,
|
|
31
|
+
defaultEntrypoint: null,
|
|
32
|
+
hasLocalDevServer: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: "nuxt",
|
|
36
|
+
displayName: "Nuxt",
|
|
37
|
+
buildType: "nuxt",
|
|
38
|
+
aliases: ["nuxt", "nuxtjs", "nuxt.js"],
|
|
39
|
+
detectPackages: ["nuxt"],
|
|
40
|
+
detectConfigFiles: NUXT_CONFIG_FILENAMES,
|
|
41
|
+
usesEntrypoint: false,
|
|
42
|
+
defaultEntrypoint: null,
|
|
43
|
+
hasLocalDevServer: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "astro",
|
|
47
|
+
displayName: "Astro",
|
|
48
|
+
buildType: "astro",
|
|
49
|
+
aliases: ["astro"],
|
|
50
|
+
detectPackages: ["astro"],
|
|
51
|
+
detectConfigFiles: ASTRO_CONFIG_FILENAMES,
|
|
52
|
+
usesEntrypoint: false,
|
|
53
|
+
defaultEntrypoint: null,
|
|
54
|
+
hasLocalDevServer: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "hono",
|
|
58
|
+
displayName: "Hono",
|
|
59
|
+
buildType: "bun",
|
|
60
|
+
aliases: ["hono"],
|
|
61
|
+
detectPackages: ["hono"],
|
|
62
|
+
detectConfigFiles: [],
|
|
63
|
+
usesEntrypoint: true,
|
|
64
|
+
defaultEntrypoint: "src/index.ts",
|
|
65
|
+
hasLocalDevServer: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "tanstack-start",
|
|
69
|
+
displayName: "TanStack Start",
|
|
70
|
+
buildType: "tanstack-start",
|
|
71
|
+
aliases: [
|
|
72
|
+
"tanstack-start",
|
|
73
|
+
"tanstack",
|
|
74
|
+
"@tanstack/react-start",
|
|
75
|
+
"@tanstack/solid-start",
|
|
76
|
+
],
|
|
77
|
+
detectPackages: ["@tanstack/react-start", "@tanstack/solid-start"],
|
|
78
|
+
detectConfigFiles: [],
|
|
79
|
+
usesEntrypoint: false,
|
|
80
|
+
defaultEntrypoint: null,
|
|
81
|
+
hasLocalDevServer: false,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: "bun",
|
|
85
|
+
displayName: "Bun",
|
|
86
|
+
buildType: "bun",
|
|
87
|
+
aliases: ["bun"],
|
|
88
|
+
detectPackages: [],
|
|
89
|
+
detectConfigFiles: [],
|
|
90
|
+
usesEntrypoint: true,
|
|
91
|
+
defaultEntrypoint: null,
|
|
92
|
+
hasLocalDevServer: true,
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
export const FRAMEWORK_KEYS = FRAMEWORKS.map((framework) => framework.key);
|
|
96
|
+
/**
|
|
97
|
+
* Build types whose preview build consumes committed build settings. The
|
|
98
|
+
* others (nuxt, astro) run their framework CLI and stage fixed output, so a
|
|
99
|
+
* config `build` block has nothing to apply to.
|
|
100
|
+
*/
|
|
101
|
+
export const CONFIG_BACKED_BUILD_TYPES = [
|
|
102
|
+
"nextjs",
|
|
103
|
+
"tanstack-start",
|
|
104
|
+
"bun",
|
|
105
|
+
];
|
|
106
|
+
/** Build types that consume a user-provided source entrypoint. */
|
|
107
|
+
export const ENTRYPOINT_BUILD_TYPES = [
|
|
108
|
+
...new Set(FRAMEWORKS.filter((framework) => framework.usesEntrypoint).map((framework) => framework.buildType)),
|
|
109
|
+
];
|
|
110
|
+
/** Build types `app run` can start a local dev server for. */
|
|
111
|
+
export const LOCAL_DEV_BUILD_TYPES = [
|
|
112
|
+
...new Set(FRAMEWORKS.filter((framework) => framework.hasLocalDevServer).map((framework) => framework.buildType)),
|
|
113
|
+
];
|
|
114
|
+
export function frameworkByKey(key) {
|
|
115
|
+
const framework = FRAMEWORKS.find((candidate) => candidate.key === key);
|
|
116
|
+
if (!framework) {
|
|
117
|
+
throw new Error(`Unknown framework key "${key}".`);
|
|
118
|
+
}
|
|
119
|
+
return framework;
|
|
120
|
+
}
|
|
121
|
+
export function frameworkFromAlias(value) {
|
|
122
|
+
const normalized = value.trim().toLowerCase();
|
|
123
|
+
return (FRAMEWORKS.find((framework) => framework.aliases.includes(normalized)) ??
|
|
124
|
+
null);
|
|
125
|
+
}
|
|
126
|
+
export function isConfigBackedBuildType(value) {
|
|
127
|
+
return CONFIG_BACKED_BUILD_TYPES.includes(value);
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=frameworks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../src/config/frameworks.ts"],"names":[],"mappings":"AAmCA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;CACV,CAAC;AAEX,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAmC;IACxD;Q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AAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACxE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,CACL,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACtE,IAAI,CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAa;IAEb,OAAQ,yBAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compute config contract and its tooling: types, validation, discovery,
|
|
3
|
+
* loading, and serialization for `prisma.compute.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Consumers (CLI, build-runner, scaffolding) share this module so every part
|
|
6
|
+
* of the platform reads the same deploy graph. Consumer-specific concerns —
|
|
7
|
+
* project/branch resolution, prompts, flag precedence — stay with consumers.
|
|
8
|
+
*/
|
|
9
|
+
export { ASTRO_CONFIG_FILENAMES, CONFIG_BACKED_BUILD_TYPES, type ConfigBackedBuildType, ENTRYPOINT_BUILD_TYPES, FRAMEWORK_KEYS, FRAMEWORKS, type FrameworkBuildType, type FrameworkDescriptor, frameworkByKey, frameworkFromAlias, isConfigBackedBuildType, LOCAL_DEV_BUILD_TYPES, NEXT_CONFIG_FILENAMES, NUXT_CONFIG_FILENAMES, } from "./frameworks.ts";
|
|
10
|
+
export { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAMES, ComputeConfigAmbiguousError, type ComputeConfigError, ComputeConfigLoadError, findComputeConfigCandidates, findComputeConfigDir, loadComputeConfig, } from "./load.ts";
|
|
11
|
+
export { ComputeConfigInvalidError, type ComputeConfigTargetError, ComputeConfigTargetRequiredError, ComputeConfigTargetUnknownError, type ComputeDeployTarget, type ComputeDeployTargetBuild, computeTargetAppDir, inferComputeTargetFromCwd, type LoadedComputeConfig, normalizeComputeConfig, selectComputeDeployTarget, } from "./normalize.ts";
|
|
12
|
+
export { serializeComputeConfig } from "./serialize.ts";
|
|
13
|
+
export { resolveSourceRoot, sourceRootLineage } from "./source-root.ts";
|
|
14
|
+
export { COMPUTE_FRAMEWORKS, type ComputeAppConfig, type ComputeBuildConfig, type ComputeConfig, type ComputeEnvConfig, type ComputeFramework, defineComputeConfig, } from "./types.ts";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compute config contract and its tooling: types, validation, discovery,
|
|
3
|
+
* loading, and serialization for `prisma.compute.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Consumers (CLI, build-runner, scaffolding) share this module so every part
|
|
6
|
+
* of the platform reads the same deploy graph. Consumer-specific concerns —
|
|
7
|
+
* project/branch resolution, prompts, flag precedence — stay with consumers.
|
|
8
|
+
*/
|
|
9
|
+
export { ASTRO_CONFIG_FILENAMES, CONFIG_BACKED_BUILD_TYPES, ENTRYPOINT_BUILD_TYPES, FRAMEWORK_KEYS, FRAMEWORKS, frameworkByKey, frameworkFromAlias, isConfigBackedBuildType, LOCAL_DEV_BUILD_TYPES, NEXT_CONFIG_FILENAMES, NUXT_CONFIG_FILENAMES, } from "./frameworks.js";
|
|
10
|
+
export { COMPUTE_CONFIG_FILENAME, COMPUTE_CONFIG_FILENAMES, ComputeConfigAmbiguousError, ComputeConfigLoadError, findComputeConfigCandidates, findComputeConfigDir, loadComputeConfig, } from "./load.js";
|
|
11
|
+
export { ComputeConfigInvalidError, ComputeConfigTargetRequiredError, ComputeConfigTargetUnknownError, computeTargetAppDir, inferComputeTargetFromCwd, normalizeComputeConfig, selectComputeDeployTarget, } from "./normalize.js";
|
|
12
|
+
export { serializeComputeConfig } from "./serialize.js";
|
|
13
|
+
export { resolveSourceRoot, sourceRootLineage } from "./source-root.js";
|
|
14
|
+
export { COMPUTE_FRAMEWORKS, defineComputeConfig, } from "./types.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EAEzB,sBAAsB,EACtB,cAAc,EACd,UAAU,EAGV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAE3B,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EAEzB,gCAAgC,EAChC,+BAA+B,EAG/B,mBAAmB,EACnB,yBAAyB,EAEzB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAMlB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Result } from "better-result";
|
|
2
|
+
import { type ComputeConfigInvalidError, type LoadedComputeConfig } from "./normalize.ts";
|
|
3
|
+
export declare const COMPUTE_CONFIG_FILENAME = "prisma.compute.ts";
|
|
4
|
+
export declare const COMPUTE_CONFIG_FILENAMES: readonly ["prisma.compute.ts", "prisma.compute.mts", "prisma.compute.js", "prisma.compute.mjs", "prisma.compute.cjs"];
|
|
5
|
+
declare const ComputeConfigAmbiguousError_base: import("better-result").TaggedErrorClass<"ComputeConfigAmbiguousError", {
|
|
6
|
+
message: string;
|
|
7
|
+
configPaths: string[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare class ComputeConfigAmbiguousError extends ComputeConfigAmbiguousError_base {
|
|
10
|
+
constructor(configPaths: string[]);
|
|
11
|
+
}
|
|
12
|
+
declare const ComputeConfigLoadError_base: import("better-result").TaggedErrorClass<"ComputeConfigLoadError", {
|
|
13
|
+
message: string;
|
|
14
|
+
cause: unknown;
|
|
15
|
+
configPath: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare class ComputeConfigLoadError extends ComputeConfigLoadError_base {
|
|
18
|
+
constructor(configPath: string, cause: unknown);
|
|
19
|
+
}
|
|
20
|
+
export type ComputeConfigError = ComputeConfigAmbiguousError | ComputeConfigLoadError | ComputeConfigInvalidError;
|
|
21
|
+
/**
|
|
22
|
+
* Compute config files present in one directory, in filename priority order.
|
|
23
|
+
*/
|
|
24
|
+
export declare function findComputeConfigCandidates(directory: string, signal?: AbortSignal): Promise<string[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Locates the nearest directory holding a compute config file, searching from
|
|
27
|
+
* `cwd` up to the source root. This is location-only discovery — the config
|
|
28
|
+
* is not loaded or validated — so it is safe to run in hot paths.
|
|
29
|
+
* Returns null when no config exists inside the repository boundary.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findComputeConfigDir(cwd: string, signal?: AbortSignal): Promise<string | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Loads the nearest compute config, searching from `cwd` up to the source
|
|
34
|
+
* root (repository or workspace boundary). Without such a boundary only
|
|
35
|
+
* `cwd` itself is checked, so discovery never escapes into unrelated
|
|
36
|
+
* directories.
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadComputeConfig(cwd: string, options?: {
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
/**
|
|
41
|
+
* Module path the config-helper import specifiers alias to. Defaults to
|
|
42
|
+
* this SDK's own config module; pass a path when the consumer ships its
|
|
43
|
+
* own copy of the contract (e.g. a bundled CLI).
|
|
44
|
+
*/
|
|
45
|
+
configModuleAlias?: string;
|
|
46
|
+
}): Promise<Result<LoadedComputeConfig | null, ComputeConfigError>>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAGpD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAI3D,eAAO,MAAM,wBAAwB,uHAM3B,CAAC;;aASA,MAAM;iBACF,MAAM,EAAE;;AAJvB,qBAAa,2BAA4B,SAAQ,gCAK7C;gBACU,WAAW,EAAE,MAAM,EAAE;CAMlC;;aAKU,MAAM;WACR,OAAO;gBACF,MAAM;;AALpB,qBAAa,sBAAuB,SAAQ,2BAMxC;gBACU,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAO/C;AAED,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,sBAAsB,GACtB,yBAAyB,CAAC;AAE9B;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACA,OAAO,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAwBjE"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { access } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { Result, TaggedError } from "better-result";
|
|
6
|
+
import { createJiti } from "jiti";
|
|
7
|
+
import { normalizeComputeConfig, } from "./normalize.js";
|
|
8
|
+
import { sourceRootLineage } from "./source-root.js";
|
|
9
|
+
export const COMPUTE_CONFIG_FILENAME = "prisma.compute.ts";
|
|
10
|
+
// Highest priority first. TypeScript is the canonical format; the rest exist
|
|
11
|
+
// so plain JavaScript projects are not forced into TypeScript.
|
|
12
|
+
export const COMPUTE_CONFIG_FILENAMES = [
|
|
13
|
+
"prisma.compute.ts",
|
|
14
|
+
"prisma.compute.mts",
|
|
15
|
+
"prisma.compute.js",
|
|
16
|
+
"prisma.compute.mjs",
|
|
17
|
+
"prisma.compute.cjs",
|
|
18
|
+
];
|
|
19
|
+
// Config files import the typed helper through this specifier; it aliases
|
|
20
|
+
// to this module so configs load without a local install.
|
|
21
|
+
const CONFIG_MODULE_SPECIFIERS = ["@prisma/compute-sdk/config"];
|
|
22
|
+
export class ComputeConfigAmbiguousError extends TaggedError("ComputeConfigAmbiguousError")() {
|
|
23
|
+
constructor(configPaths) {
|
|
24
|
+
super({
|
|
25
|
+
message: `Multiple compute config files exist: ${configPaths.map((configPath) => path.basename(configPath)).join(", ")}. Keep exactly one.`,
|
|
26
|
+
configPaths,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class ComputeConfigLoadError extends TaggedError("ComputeConfigLoadError")() {
|
|
31
|
+
constructor(configPath, cause) {
|
|
32
|
+
super({
|
|
33
|
+
message: `Could not load ${path.basename(configPath)}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
34
|
+
cause,
|
|
35
|
+
configPath,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute config files present in one directory, in filename priority order.
|
|
41
|
+
*/
|
|
42
|
+
export async function findComputeConfigCandidates(directory, signal) {
|
|
43
|
+
const candidates = [];
|
|
44
|
+
for (const filename of COMPUTE_CONFIG_FILENAMES) {
|
|
45
|
+
const configPath = path.join(directory, filename);
|
|
46
|
+
signal?.throwIfAborted();
|
|
47
|
+
try {
|
|
48
|
+
await access(configPath);
|
|
49
|
+
candidates.push(configPath);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (signal?.aborted)
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
signal?.throwIfAborted();
|
|
57
|
+
return candidates;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Locates the nearest directory holding a compute config file, searching from
|
|
61
|
+
* `cwd` up to the source root. This is location-only discovery — the config
|
|
62
|
+
* is not loaded or validated — so it is safe to run in hot paths.
|
|
63
|
+
* Returns null when no config exists inside the repository boundary.
|
|
64
|
+
*/
|
|
65
|
+
export async function findComputeConfigDir(cwd, signal) {
|
|
66
|
+
for (const directory of await sourceRootLineage(cwd, signal)) {
|
|
67
|
+
const candidates = await findComputeConfigCandidates(directory, signal);
|
|
68
|
+
if (candidates.length > 0) {
|
|
69
|
+
return directory;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Loads the nearest compute config, searching from `cwd` up to the source
|
|
76
|
+
* root (repository or workspace boundary). Without such a boundary only
|
|
77
|
+
* `cwd` itself is checked, so discovery never escapes into unrelated
|
|
78
|
+
* directories.
|
|
79
|
+
*/
|
|
80
|
+
export async function loadComputeConfig(cwd, options) {
|
|
81
|
+
const signal = options?.signal;
|
|
82
|
+
for (const directory of await sourceRootLineage(cwd, signal)) {
|
|
83
|
+
const candidates = await findComputeConfigCandidates(directory, signal);
|
|
84
|
+
if (candidates.length === 0) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (candidates.length > 1) {
|
|
88
|
+
return Result.err(new ComputeConfigAmbiguousError(candidates));
|
|
89
|
+
}
|
|
90
|
+
const configPath = candidates[0];
|
|
91
|
+
signal?.throwIfAborted();
|
|
92
|
+
const imported = await importComputeConfigModule(configPath, options?.configModuleAlias);
|
|
93
|
+
if (imported.isErr()) {
|
|
94
|
+
return Result.err(imported.error);
|
|
95
|
+
}
|
|
96
|
+
return normalizeComputeConfig(imported.value, configPath);
|
|
97
|
+
}
|
|
98
|
+
return Result.ok(null);
|
|
99
|
+
}
|
|
100
|
+
async function importComputeConfigModule(configPath, configModuleAlias) {
|
|
101
|
+
return Result.tryPromise({
|
|
102
|
+
try: async () => {
|
|
103
|
+
const aliasTarget = configModuleAlias ?? resolveOwnConfigModulePath();
|
|
104
|
+
const jiti = createJiti(import.meta.url, {
|
|
105
|
+
// Keep Node's standard interop so `.default` exists only for a real
|
|
106
|
+
// default export (ESM) or module.exports (CJS).
|
|
107
|
+
interopDefault: false,
|
|
108
|
+
// Re-import fresh so repeated loads in one process observe file edits.
|
|
109
|
+
moduleCache: false,
|
|
110
|
+
...(aliasTarget
|
|
111
|
+
? {
|
|
112
|
+
alias: Object.fromEntries(CONFIG_MODULE_SPECIFIERS.map((specifier) => [
|
|
113
|
+
specifier,
|
|
114
|
+
aliasTarget,
|
|
115
|
+
])),
|
|
116
|
+
}
|
|
117
|
+
: {}),
|
|
118
|
+
});
|
|
119
|
+
const moduleNamespace = await jiti.import(configPath);
|
|
120
|
+
// Require an explicit default export instead of jiti's namespace
|
|
121
|
+
// interop so named-export configs fail with a clear message.
|
|
122
|
+
return moduleNamespace?.default;
|
|
123
|
+
},
|
|
124
|
+
catch: (cause) => new ComputeConfigLoadError(configPath, cause),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function resolveOwnConfigModulePath() {
|
|
128
|
+
// dist layout: dist/config/load.js -> dist/config/index.js
|
|
129
|
+
// src layout (bun/tests): src/config/load.ts -> src/config/index.ts
|
|
130
|
+
for (const candidate of ["./index.js", "./index.ts"]) {
|
|
131
|
+
const candidatePath = fileURLToPath(new URL(candidate, import.meta.url));
|
|
132
|
+
if (existsSync(candidatePath)) {
|
|
133
|
+
return candidatePath;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAGL,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE3D,6EAA6E;AAC7E,+DAA+D;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;CACZ,CAAC;AAEX,0EAA0E;AAC1E,0DAA0D;AAC1D,MAAM,wBAAwB,GAAG,CAAC,4BAA4B,CAAU,CAAC;AAEzE,MAAM,OAAO,2BAA4B,SAAQ,WAAW,CAC1D,6BAA6B,CAC9B,EAGG;IACF,YAAY,WAAqB;QAC/B,KAAK,CAA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;AACd,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Result } from "better-result";
|
|
2
|
+
import { type ComputeFramework } from "./types.ts";
|
|
3
|
+
export interface ComputeDeployTargetBuild {
|
|
4
|
+
/** Build command, null to skip the build step, undefined when not configured. */
|
|
5
|
+
command: string | null | undefined;
|
|
6
|
+
/** Normalized output path relative to the app root, undefined when not configured. */
|
|
7
|
+
outputDirectory: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface ComputeDeployTarget {
|
|
10
|
+
/** `apps` map key, or null for a single-app `app` config. */
|
|
11
|
+
key: string | null;
|
|
12
|
+
name: string | null;
|
|
13
|
+
/** Normalized app directory relative to the config file, or null for the config directory. */
|
|
14
|
+
root: string | null;
|
|
15
|
+
framework: ComputeFramework | null;
|
|
16
|
+
entry: string | null;
|
|
17
|
+
httpPort: number | null;
|
|
18
|
+
/** Env inputs in deploy order: dotenv file paths first, then NAME=VALUE assignments. */
|
|
19
|
+
envInputs: string[];
|
|
20
|
+
/** Build settings; non-null means the config owns build configuration. */
|
|
21
|
+
build: ComputeDeployTargetBuild | null;
|
|
22
|
+
}
|
|
23
|
+
export interface LoadedComputeConfig {
|
|
24
|
+
configPath: string;
|
|
25
|
+
/** Directory containing the config file. Config-relative paths resolve from here. */
|
|
26
|
+
configDir: string;
|
|
27
|
+
relativeConfigPath: string;
|
|
28
|
+
kind: "single" | "multi";
|
|
29
|
+
targets: ComputeDeployTarget[];
|
|
30
|
+
}
|
|
31
|
+
declare const ComputeConfigInvalidError_base: import("better-result").TaggedErrorClass<"ComputeConfigInvalidError", {
|
|
32
|
+
message: string;
|
|
33
|
+
configPath: string;
|
|
34
|
+
issues: string[];
|
|
35
|
+
}>;
|
|
36
|
+
export declare class ComputeConfigInvalidError extends ComputeConfigInvalidError_base {
|
|
37
|
+
constructor(configPath: string, issues: string[]);
|
|
38
|
+
}
|
|
39
|
+
declare const ComputeConfigTargetRequiredError_base: import("better-result").TaggedErrorClass<"ComputeConfigTargetRequiredError", {
|
|
40
|
+
message: string;
|
|
41
|
+
configPath: string;
|
|
42
|
+
availableTargets: string[];
|
|
43
|
+
}>;
|
|
44
|
+
export declare class ComputeConfigTargetRequiredError extends ComputeConfigTargetRequiredError_base {
|
|
45
|
+
constructor(configPath: string, availableTargets: string[]);
|
|
46
|
+
}
|
|
47
|
+
declare const ComputeConfigTargetUnknownError_base: import("better-result").TaggedErrorClass<"ComputeConfigTargetUnknownError", {
|
|
48
|
+
message: string;
|
|
49
|
+
configPath: string;
|
|
50
|
+
requestedTarget: string;
|
|
51
|
+
availableTargets: string[];
|
|
52
|
+
}>;
|
|
53
|
+
export declare class ComputeConfigTargetUnknownError extends ComputeConfigTargetUnknownError_base {
|
|
54
|
+
constructor(configPath: string, requestedTarget: string, availableTargets: string[]);
|
|
55
|
+
}
|
|
56
|
+
export type ComputeConfigTargetError = ComputeConfigTargetRequiredError | ComputeConfigTargetUnknownError;
|
|
57
|
+
/**
|
|
58
|
+
* Validates and normalizes a config module's default export. Reports every
|
|
59
|
+
* issue at once so authors fix the file in one pass.
|
|
60
|
+
*/
|
|
61
|
+
export declare function normalizeComputeConfig(exported: unknown, configPath: string): Result<LoadedComputeConfig, ComputeConfigInvalidError>;
|
|
62
|
+
/** Absolute app directory of a config target. */
|
|
63
|
+
export declare function computeTargetAppDir(config: LoadedComputeConfig, target: ComputeDeployTarget): string;
|
|
64
|
+
/**
|
|
65
|
+
* Selects a deploy target. Single-app configs return their app (a requested
|
|
66
|
+
* target must then match the configured `name`); multi-app configs require a
|
|
67
|
+
* matching key unless they hold exactly one target.
|
|
68
|
+
*/
|
|
69
|
+
export declare function selectComputeDeployTarget(config: LoadedComputeConfig, requestedTarget: string | undefined): Result<ComputeDeployTarget, ComputeConfigTargetError>;
|
|
70
|
+
/**
|
|
71
|
+
* Infers the deploy target whose app directory contains `cwd`, so commands
|
|
72
|
+
* run from inside a target's root select it without a target argument. The
|
|
73
|
+
* deepest matching root wins; an ambiguous tie infers nothing.
|
|
74
|
+
*/
|
|
75
|
+
export declare function inferComputeTargetFromCwd(config: LoadedComputeConfig, cwd: string): string | undefined;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/config/normalize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,sFAAsF;IACtF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,8FAA8F;IAC9F,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wFAAwF;IACxF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0EAA0E;IAC1E,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC;;aAKU,MAAM;gBACH,MAAM;YACV,MAAM,EAAE;;AALlB,qBAAa,yBAA0B,SAAQ,8BA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