@opensaas/stack-cli 0.43.0 → 0.44.0-alpha.1
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/README.md +116 -135
- package/dist/.build-hash +1 -0
- package/dist/commands/db.d.ts +23 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +43 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/dev.d.ts +12 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +519 -22
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/fk-renames.d.ts +14 -0
- package/dist/commands/fk-renames.d.ts.map +1 -0
- package/dist/commands/fk-renames.js +90 -0
- package/dist/commands/fk-renames.js.map +1 -0
- package/dist/commands/generate.d.ts +61 -4
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +225 -138
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/junction-ids.d.ts +11 -0
- package/dist/commands/junction-ids.d.ts.map +1 -0
- package/dist/commands/junction-ids.js +81 -0
- package/dist/commands/junction-ids.js.map +1 -0
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +47 -25
- package/dist/commands/migrate.js.map +1 -1
- package/dist/dev/app-runner.d.ts +70 -0
- package/dist/dev/app-runner.d.ts.map +1 -0
- package/dist/dev/app-runner.js +116 -0
- package/dist/dev/app-runner.js.map +1 -0
- package/dist/dev/control.d.ts +73 -0
- package/dist/dev/control.d.ts.map +1 -0
- package/dist/dev/control.js +251 -0
- package/dist/dev/control.js.map +1 -0
- package/dist/dev/staged-reconcile.d.ts +126 -0
- package/dist/dev/staged-reconcile.d.ts.map +1 -0
- package/dist/dev/staged-reconcile.js +289 -0
- package/dist/dev/staged-reconcile.js.map +1 -0
- package/dist/generator/config-load.d.ts +34 -0
- package/dist/generator/config-load.d.ts.map +1 -0
- package/dist/generator/config-load.js +64 -0
- package/dist/generator/config-load.js.map +1 -0
- package/dist/generator/context.d.ts +39 -3
- package/dist/generator/context.d.ts.map +1 -1
- package/dist/generator/context.js +245 -107
- package/dist/generator/context.js.map +1 -1
- package/dist/generator/contract-emit.d.ts +24 -0
- package/dist/generator/contract-emit.d.ts.map +1 -0
- package/dist/generator/contract-emit.js +34 -0
- package/dist/generator/contract-emit.js.map +1 -0
- package/dist/generator/contract-module.d.ts +39 -0
- package/dist/generator/contract-module.d.ts.map +1 -0
- package/dist/generator/contract-module.js +440 -0
- package/dist/generator/contract-module.js.map +1 -0
- package/dist/generator/extension-spaces.d.ts +142 -0
- package/dist/generator/extension-spaces.d.ts.map +1 -0
- package/dist/generator/extension-spaces.js +358 -0
- package/dist/generator/extension-spaces.js.map +1 -0
- package/dist/generator/index.d.ts +12 -4
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +7 -3
- package/dist/generator/index.js.map +1 -1
- package/dist/generator/lists.d.ts +6 -7
- package/dist/generator/lists.d.ts.map +1 -1
- package/dist/generator/lists.js +33 -13
- package/dist/generator/lists.js.map +1 -1
- package/dist/generator/output-paths.d.ts +62 -19
- package/dist/generator/output-paths.d.ts.map +1 -1
- package/dist/generator/output-paths.js +68 -30
- package/dist/generator/output-paths.js.map +1 -1
- package/dist/generator/prisma-cli.d.ts +61 -0
- package/dist/generator/prisma-cli.d.ts.map +1 -0
- package/dist/generator/prisma-cli.js +92 -0
- package/dist/generator/prisma-cli.js.map +1 -0
- package/dist/generator/prisma-config.d.ts +50 -31
- package/dist/generator/prisma-config.d.ts.map +1 -1
- package/dist/generator/prisma-config.js +72 -65
- package/dist/generator/prisma-config.js.map +1 -1
- package/dist/generator/source-text.d.ts +16 -0
- package/dist/generator/source-text.d.ts.map +1 -0
- package/dist/generator/source-text.js +35 -0
- package/dist/generator/source-text.js.map +1 -0
- package/dist/generator/tables.d.ts +5 -0
- package/dist/generator/tables.d.ts.map +1 -0
- package/dist/generator/tables.js +84 -0
- package/dist/generator/tables.js.map +1 -0
- package/dist/generator/types.d.ts +23 -3
- package/dist/generator/types.d.ts.map +1 -1
- package/dist/generator/types.js +291 -1171
- package/dist/generator/types.js.map +1 -1
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/lib/documentation-provider.d.ts.map +1 -1
- package/dist/mcp/lib/documentation-provider.js +44 -42
- package/dist/mcp/lib/documentation-provider.js.map +1 -1
- package/dist/mcp/lib/generators/feature-generator.d.ts.map +1 -1
- package/dist/mcp/lib/generators/feature-generator.js +124 -73
- package/dist/mcp/lib/generators/feature-generator.js.map +1 -1
- package/dist/mcp/lib/wizards/migration-wizard.js +6 -6
- package/dist/mcp/lib/wizards/migration-wizard.js.map +1 -1
- package/dist/mcp/lib/wizards/wizard-engine.d.ts.map +1 -1
- package/dist/mcp/lib/wizards/wizard-engine.js +3 -2
- package/dist/mcp/lib/wizards/wizard-engine.js.map +1 -1
- package/dist/mcp/server/stack-mcp-server.js +1 -1
- package/dist/migration/fk-renames.d.ts +39 -0
- package/dist/migration/fk-renames.d.ts.map +1 -0
- package/dist/migration/fk-renames.js +79 -0
- package/dist/migration/fk-renames.js.map +1 -0
- package/dist/migration/generators/migration-generator.d.ts +11 -0
- package/dist/migration/generators/migration-generator.d.ts.map +1 -1
- package/dist/migration/generators/migration-generator.js +83 -150
- package/dist/migration/generators/migration-generator.js.map +1 -1
- package/dist/migration/introspectors/prisma-introspector.d.ts.map +1 -1
- package/dist/migration/introspectors/prisma-introspector.js +1 -0
- package/dist/migration/introspectors/prisma-introspector.js.map +1 -1
- package/dist/migration/junction-ids.d.ts +15 -0
- package/dist/migration/junction-ids.d.ts.map +1 -0
- package/dist/migration/junction-ids.js +58 -0
- package/dist/migration/junction-ids.js.map +1 -0
- package/dist/migration/types.d.ts +2 -0
- package/dist/migration/types.d.ts.map +1 -1
- package/package.json +27 -15
- package/dist/generator/node-build.d.ts +0 -53
- package/dist/generator/node-build.d.ts.map +0 -1
- package/dist/generator/node-build.js +0 -280
- package/dist/generator/node-build.js.map +0 -1
- package/dist/generator/prisma.d.ts +0 -30
- package/dist/generator/prisma.d.ts.map +0 -1
- package/dist/generator/prisma.js +0 -422
- package/dist/generator/prisma.js.map +0 -1
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
5
|
+
import { runContractSpaceSeedPhase } from '@prisma/orm-toolchain/cli/control-api';
|
|
6
|
+
import { APP_SPACE_ID, listContractSpaceDirectories, verifyContractSpaces, } from '@prisma/orm-toolchain/migration-tools/spaces';
|
|
7
|
+
/** The subpaths one `db.extensions` entry must publish, one per emission (ADR-0065). */
|
|
8
|
+
const REQUIRED_SUBPATHS = ['pack', 'control', 'runtime'];
|
|
9
|
+
/**
|
|
10
|
+
* Thrown when a declared extension pack does not publish one of the three
|
|
11
|
+
* subpaths the emissions need. Names the pack and the exact missing subpath —
|
|
12
|
+
* Supabase's pack has no `/control` and is precisely this error.
|
|
13
|
+
*/
|
|
14
|
+
export class ExtensionSubpathError extends Error {
|
|
15
|
+
pack;
|
|
16
|
+
subpath;
|
|
17
|
+
constructor(
|
|
18
|
+
/** The pack's binding name, as `db.extensions` spells it. */
|
|
19
|
+
pack,
|
|
20
|
+
/** The subpath that did not resolve, e.g. `@prisma/orm-extension-x/control`. */
|
|
21
|
+
subpath) {
|
|
22
|
+
super(`Extension pack "${pack}" does not publish "${subpath}". A declared pack must export ` +
|
|
23
|
+
`/pack (the Contract module), /control (prisma.config.ts and the migration seed) and ` +
|
|
24
|
+
`/runtime (the generated client) — ADR-0065. Check the package is installed and that ` +
|
|
25
|
+
`its "exports" map carries that subpath.`);
|
|
26
|
+
this.pack = pack;
|
|
27
|
+
this.subpath = subpath;
|
|
28
|
+
this.name = 'ExtensionSubpathError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when a declared pack's `/control` subpath resolves and loads but does
|
|
33
|
+
* not default-export a control descriptor. Names the pack and the subpath, so
|
|
34
|
+
* a pack built against a different toolchain generation is reported as such
|
|
35
|
+
* rather than as a `TypeError` from inside the seed phase.
|
|
36
|
+
*/
|
|
37
|
+
export class ExtensionDescriptorError extends Error {
|
|
38
|
+
pack;
|
|
39
|
+
subpath;
|
|
40
|
+
constructor(
|
|
41
|
+
/** The pack's binding name, as `db.extensions` spells it. */
|
|
42
|
+
pack,
|
|
43
|
+
/** The subpath that loaded without a usable descriptor. */
|
|
44
|
+
subpath) {
|
|
45
|
+
super(`Extension pack "${pack}" exports no control descriptor from "${subpath}". The /control ` +
|
|
46
|
+
`subpath must default-export the pack's control descriptor — an object carrying a string ` +
|
|
47
|
+
`"id" (ADR-0065). Check the installed pack version matches the toolchain this project ` +
|
|
48
|
+
`generates against.`);
|
|
49
|
+
this.pack = pack;
|
|
50
|
+
this.subpath = subpath;
|
|
51
|
+
this.name = 'ExtensionDescriptorError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Thrown when `migrations/` carries a contract-space directory that no
|
|
56
|
+
* longer corresponds to any pack in `db.extensions` — the pack was
|
|
57
|
+
* dropped from the config, or its space id changed, and the seeded
|
|
58
|
+
* directory was left behind. Each entry's message is the toolchain's own
|
|
59
|
+
* `orphanSpaceDir` remediation, byte-identical to what a later `db init`/
|
|
60
|
+
* `db update` would otherwise refuse with (ADR-0065).
|
|
61
|
+
*/
|
|
62
|
+
export class OrphanExtensionSpaceError extends Error {
|
|
63
|
+
spaceIds;
|
|
64
|
+
constructor(
|
|
65
|
+
/** One entry per orphaned space directory, keyed by the directory's own name. */
|
|
66
|
+
spaceIds, remediations) {
|
|
67
|
+
super(remediations.join('\n'));
|
|
68
|
+
this.spaceIds = spaceIds;
|
|
69
|
+
this.name = 'OrphanExtensionSpaceError';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// The conditions Node applies to `import`, which is how the generated
|
|
73
|
+
// prisma.config.ts and Contract module reach these same subpaths. Resolving
|
|
74
|
+
// under the `require` conditions instead refuses an ESM-only pack whose
|
|
75
|
+
// `exports` map is correct, and picks the CJS half of a dual publish.
|
|
76
|
+
const IMPORT_CONDITIONS = new Set(['node', 'import', 'default']);
|
|
77
|
+
/** The package directory a bare specifier names, found by Node's own walk. */
|
|
78
|
+
function findPackageRoot(cwd, from) {
|
|
79
|
+
const require = createRequire(path.join(cwd, 'noop.js'));
|
|
80
|
+
for (const dir of require.resolve.paths(from) ?? []) {
|
|
81
|
+
const root = path.join(dir, from);
|
|
82
|
+
if (fs.existsSync(path.join(root, 'package.json')))
|
|
83
|
+
return root;
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
function readExportsField(root) {
|
|
88
|
+
let manifest;
|
|
89
|
+
try {
|
|
90
|
+
manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
if (typeof manifest !== 'object' || manifest === null || !('exports' in manifest))
|
|
96
|
+
return undefined;
|
|
97
|
+
return manifest.exports;
|
|
98
|
+
}
|
|
99
|
+
/** Pick the first target an import-condition matches, substituting a pattern's `*`. */
|
|
100
|
+
function selectTarget(target, star) {
|
|
101
|
+
if (typeof target === 'string') {
|
|
102
|
+
return star === undefined ? target : target.replaceAll('*', star);
|
|
103
|
+
}
|
|
104
|
+
if (Array.isArray(target)) {
|
|
105
|
+
for (const entry of target) {
|
|
106
|
+
const picked = selectTarget(entry, star);
|
|
107
|
+
if (picked !== undefined)
|
|
108
|
+
return picked;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
if (typeof target === 'object' && target !== null) {
|
|
113
|
+
for (const [condition, value] of Object.entries(target)) {
|
|
114
|
+
if (!IMPORT_CONDITIONS.has(condition))
|
|
115
|
+
continue;
|
|
116
|
+
const picked = selectTarget(value, star);
|
|
117
|
+
if (picked !== undefined)
|
|
118
|
+
return picked;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
// Node's PATTERN_KEY_COMPARE ranks two overlapping patterns by the length of
|
|
124
|
+
// the base (the prefix up to and including `*`) and breaks an equal base with
|
|
125
|
+
// the longer key. Ranking on the prefix alone picks `./*` over `./*l` for
|
|
126
|
+
// `./control`, which is not the file the loader would load.
|
|
127
|
+
// https://nodejs.org/api/esm.html#resolution-algorithm-specification
|
|
128
|
+
function isBetterPatternKey(candidate, incumbent) {
|
|
129
|
+
const candidateBase = candidate.indexOf('*');
|
|
130
|
+
const incumbentBase = incumbent.indexOf('*');
|
|
131
|
+
if (candidateBase !== incumbentBase)
|
|
132
|
+
return candidateBase > incumbentBase;
|
|
133
|
+
return candidate.length > incumbent.length;
|
|
134
|
+
}
|
|
135
|
+
function matchSubpath(exportsField, key) {
|
|
136
|
+
if (typeof exportsField !== 'object' || exportsField === null || Array.isArray(exportsField)) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
const entries = Object.entries(exportsField);
|
|
140
|
+
if (!entries.some(([name]) => name.startsWith('.')))
|
|
141
|
+
return undefined;
|
|
142
|
+
for (const [name, target] of entries) {
|
|
143
|
+
if (name === key)
|
|
144
|
+
return { target, star: undefined };
|
|
145
|
+
}
|
|
146
|
+
let best;
|
|
147
|
+
for (const [name, target] of entries) {
|
|
148
|
+
const starAt = name.indexOf('*');
|
|
149
|
+
if (starAt === -1)
|
|
150
|
+
continue;
|
|
151
|
+
const prefix = name.slice(0, starAt);
|
|
152
|
+
const suffix = name.slice(starAt + 1);
|
|
153
|
+
if (suffix.includes('*'))
|
|
154
|
+
continue;
|
|
155
|
+
if (!key.startsWith(prefix) || !key.endsWith(suffix))
|
|
156
|
+
continue;
|
|
157
|
+
// Node requires `matchKey.length >= key.length`, so the star must expand to
|
|
158
|
+
// at least one character: `./control*` does not match `./control`.
|
|
159
|
+
if (key.length < name.length)
|
|
160
|
+
continue;
|
|
161
|
+
if (best !== undefined && !isBetterPatternKey(name, best.name))
|
|
162
|
+
continue;
|
|
163
|
+
best = { name, target, star: key.slice(prefix.length, key.length - suffix.length) };
|
|
164
|
+
}
|
|
165
|
+
return best === undefined ? undefined : { target: best.target, star: best.star };
|
|
166
|
+
}
|
|
167
|
+
/** The URL `import('<from>/<subpath>')` would load from `cwd`, or undefined. */
|
|
168
|
+
function resolveImportSubpath(cwd, from, subpath) {
|
|
169
|
+
const root = findPackageRoot(cwd, from);
|
|
170
|
+
if (root === undefined)
|
|
171
|
+
return undefined;
|
|
172
|
+
const exportsField = readExportsField(root);
|
|
173
|
+
let file;
|
|
174
|
+
if (exportsField === undefined) {
|
|
175
|
+
file = path.join(root, subpath);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const matched = matchSubpath(exportsField, `./${subpath}`);
|
|
179
|
+
if (matched === undefined)
|
|
180
|
+
return undefined;
|
|
181
|
+
const target = selectTarget(matched.target, matched.star);
|
|
182
|
+
if (target === undefined || !target.startsWith('./'))
|
|
183
|
+
return undefined;
|
|
184
|
+
file = path.join(root, target);
|
|
185
|
+
}
|
|
186
|
+
// ESM has no directory index resolution — importing a directory throws
|
|
187
|
+
// ERR_UNSUPPORTED_DIR_IMPORT — so an existing directory is not a resolution.
|
|
188
|
+
return fs.statSync(file, { throwIfNoEntry: false })?.isFile() === true
|
|
189
|
+
? pathToFileURL(file).href
|
|
190
|
+
: undefined;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Resolve every required subpath of a declared pack against the project.
|
|
194
|
+
*
|
|
195
|
+
* @returns the URL of the `/control` module, which the seeder then imports —
|
|
196
|
+
* the check and the load are the one resolution, so they cannot disagree.
|
|
197
|
+
* @throws {ExtensionSubpathError} naming the pack and the first missing subpath.
|
|
198
|
+
*/
|
|
199
|
+
function resolveSubpaths(cwd, pack, from) {
|
|
200
|
+
const resolved = {};
|
|
201
|
+
for (const subpath of REQUIRED_SUBPATHS) {
|
|
202
|
+
const url = resolveImportSubpath(cwd, from, subpath);
|
|
203
|
+
if (url === undefined)
|
|
204
|
+
throw new ExtensionSubpathError(pack, `${from}/${subpath}`);
|
|
205
|
+
resolved[subpath] = url;
|
|
206
|
+
}
|
|
207
|
+
return { control: resolved.control };
|
|
208
|
+
}
|
|
209
|
+
// Only the descriptor's identity is checked. `contractSpace` is optional and
|
|
210
|
+
// the seed phase validates its own shape, reporting the pack by id; what it
|
|
211
|
+
// cannot report is a missing descriptor, because there is no id to name.
|
|
212
|
+
function isControlDescriptor(value) {
|
|
213
|
+
return (typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string');
|
|
214
|
+
}
|
|
215
|
+
function readControlDescriptor(namespace, pack, subpath) {
|
|
216
|
+
if (typeof namespace !== 'object' || namespace === null || !('default' in namespace)) {
|
|
217
|
+
throw new ExtensionDescriptorError(pack, subpath);
|
|
218
|
+
}
|
|
219
|
+
if (!isControlDescriptor(namespace.default)) {
|
|
220
|
+
throw new ExtensionDescriptorError(pack, subpath);
|
|
221
|
+
}
|
|
222
|
+
return namespace.default;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Refuse a declared pack that does not publish every required subpath.
|
|
226
|
+
*
|
|
227
|
+
* Runs before the generator writes `prisma.config.ts` and the Contract module,
|
|
228
|
+
* both of which import `<from>/control` and `<from>/pack`: refusing after the
|
|
229
|
+
* writes would leave the project carrying an unresolvable import.
|
|
230
|
+
*
|
|
231
|
+
* @throws {ExtensionSubpathError} when a declared pack lacks a required subpath.
|
|
232
|
+
*/
|
|
233
|
+
export function verifyExtensionSubpaths(cwd, data) {
|
|
234
|
+
for (const extension of data.extensions) {
|
|
235
|
+
resolveSubpaths(cwd, extension.name, extension.from);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Materialise each declared extension pack's **Extension contract space**
|
|
240
|
+
* under the project's `migrations/` directory, between writing the Contract
|
|
241
|
+
* module and shelling to `prisma contract emit` (ADR-0065).
|
|
242
|
+
*
|
|
243
|
+
* For every entry in `data.extensions` this derives the `/pack`, `/control`
|
|
244
|
+
* and `/runtime` subpaths from the package name, refuses when one is absent,
|
|
245
|
+
* then hands the `/control` descriptors to the toolchain's public seed phase.
|
|
246
|
+
* That writes five files per pack — the migration package's `migration.json`
|
|
247
|
+
* and `ops.json`, `refs/head.json`, and the space's `contract.json` +
|
|
248
|
+
* `contract.d.ts` in the content-addressed snapshot store.
|
|
249
|
+
*
|
|
250
|
+
* The space's content is a function of the installed pack version alone, so
|
|
251
|
+
* the files are committed and regenerated on every `generate`: a pack upgrade
|
|
252
|
+
* shipping a new package shows up as a generate diff, and `db update` never
|
|
253
|
+
* meets a declared-but-unmigrated space.
|
|
254
|
+
*
|
|
255
|
+
* Seeding opens no database connection — it is a file copy out of the pack's
|
|
256
|
+
* own descriptor.
|
|
257
|
+
*
|
|
258
|
+
* Once the currently declared packs are seeded, every contract-space
|
|
259
|
+
* directory under `migrations/` is checked against them via the toolchain's
|
|
260
|
+
* own `verifyContractSpaces` — the same structural check a later `db init`/
|
|
261
|
+
* `db update` runs. A directory that is not the app space and does not
|
|
262
|
+
* belong to a currently declared pack is an **orphan**: most often a pack
|
|
263
|
+
* that was removed from `db.extensions` without removing its seeded space.
|
|
264
|
+
* This refuses with {@link OrphanExtensionSpaceError} naming every such
|
|
265
|
+
* directory, rather than leaving `generate` to exit 0 and the failure to
|
|
266
|
+
* surface later, out of the toolchain, as `db init`/`db update`'s own
|
|
267
|
+
* `orphanSpaceDir` refusal. Nothing under `migrations/` is ever deleted by
|
|
268
|
+
* this check — including the orphan's own migration packages and the
|
|
269
|
+
* content-addressed snapshot entries they reference — so a hand-authored
|
|
270
|
+
* migration directory this check does not recognise as a pack space (it
|
|
271
|
+
* carries its own `migration.json`, per the toolchain's own space/package
|
|
272
|
+
* distinction) is never at risk (#1192).
|
|
273
|
+
*
|
|
274
|
+
* Known limits:
|
|
275
|
+
* - The migrations directory is the toolchain's default, `<cwd>/migrations`.
|
|
276
|
+
* A project that overrides `migrations.dir` in a hand-edited
|
|
277
|
+
* `prisma.config.ts` would be seeded in the wrong place; the generated
|
|
278
|
+
* config never sets that key.
|
|
279
|
+
* - Only the `/control` subpath is loaded. `/pack` and `/runtime` are checked
|
|
280
|
+
* for resolvability and are otherwise the Contract module's and the
|
|
281
|
+
* generated client's business.
|
|
282
|
+
* - A pack whose `/control` descriptor ships no `contractSpace` is resolved
|
|
283
|
+
* and passed through; the toolchain reports nothing seeded for it.
|
|
284
|
+
* - Orphan detection is refuse-and-report only. Removing the directory (or
|
|
285
|
+
* re-adding the extension) is left to the user; there is no `--prune` flag.
|
|
286
|
+
* - Subpaths are resolved by reading the pack's `exports` under the `import`
|
|
287
|
+
* condition, which is how the generated artifacts reach them. Exotic maps
|
|
288
|
+
* (nested patterns, `imports`-style self-reference) are not covered.
|
|
289
|
+
*
|
|
290
|
+
* @param cwd - The project root, which is also the migrations directory's parent.
|
|
291
|
+
* @param data - The derived contract, read only for its declared extensions.
|
|
292
|
+
* @throws {ExtensionSubpathError} when a declared pack lacks a required subpath.
|
|
293
|
+
* @throws {ExtensionDescriptorError} when `/control` has no default descriptor.
|
|
294
|
+
* @throws {OrphanExtensionSpaceError} when a seeded space directory no longer
|
|
295
|
+
* matches any currently declared pack.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* const { seeded } = await seedExtensionContractSpaces(cwd, deriveContract(config))
|
|
300
|
+
* // → [{ pack: 'pgvector', spaceId: 'pgvector', action: 'unchanged', migrationDirs: [] }]
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export async function seedExtensionContractSpaces(cwd, data) {
|
|
304
|
+
const migrationsDir = path.join(cwd, 'migrations');
|
|
305
|
+
if (data.extensions.length === 0) {
|
|
306
|
+
await refuseOrphanedExtensionSpaces(migrationsDir, new Set([APP_SPACE_ID]));
|
|
307
|
+
return { seeded: [] };
|
|
308
|
+
}
|
|
309
|
+
const descriptors = [];
|
|
310
|
+
const packBySpaceId = new Map();
|
|
311
|
+
for (const extension of data.extensions) {
|
|
312
|
+
const { control } = resolveSubpaths(cwd, extension.name, extension.from);
|
|
313
|
+
const namespace = await import(control);
|
|
314
|
+
const descriptor = readControlDescriptor(namespace, extension.name, `${extension.from}/control`);
|
|
315
|
+
descriptors.push(descriptor);
|
|
316
|
+
packBySpaceId.set(descriptor.id, extension.name);
|
|
317
|
+
}
|
|
318
|
+
const result = await runContractSpaceSeedPhase({
|
|
319
|
+
migrationsDir,
|
|
320
|
+
extensions: descriptors,
|
|
321
|
+
});
|
|
322
|
+
await refuseOrphanedExtensionSpaces(migrationsDir, new Set([APP_SPACE_ID, ...packBySpaceId.keys()]));
|
|
323
|
+
return {
|
|
324
|
+
seeded: result.seeded.map((record) => ({
|
|
325
|
+
pack: packBySpaceId.get(record.spaceId) ?? record.spaceId,
|
|
326
|
+
spaceId: record.spaceId,
|
|
327
|
+
action: record.action,
|
|
328
|
+
migrationDirs: record.newMigrationDirs,
|
|
329
|
+
})),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Refuse every on-disk contract-space directory that isn't `loadedSpaces` —
|
|
334
|
+
* the app space plus whatever pack space ids are currently declared and
|
|
335
|
+
* already seeded. Read-only: it never removes a directory itself, leaving
|
|
336
|
+
* that to the user per the toolchain's own `orphanSpaceDir` remediation.
|
|
337
|
+
*
|
|
338
|
+
* @throws {OrphanExtensionSpaceError} naming every orphaned directory.
|
|
339
|
+
*/
|
|
340
|
+
// Not exported by @prisma/orm-target-postgres; only named in marker remediations.
|
|
341
|
+
const POSTGRES_MARKER_TABLE = 'prisma_contract.marker';
|
|
342
|
+
async function refuseOrphanedExtensionSpaces(migrationsDir, loadedSpaces) {
|
|
343
|
+
const spaceDirsOnDisk = await listContractSpaceDirectories(migrationsDir);
|
|
344
|
+
const result = verifyContractSpaces({
|
|
345
|
+
loadedSpaces,
|
|
346
|
+
spaceDirsOnDisk,
|
|
347
|
+
headRefsBySpace: new Map(),
|
|
348
|
+
markerRowsBySpace: new Map(),
|
|
349
|
+
markerLocation: POSTGRES_MARKER_TABLE,
|
|
350
|
+
});
|
|
351
|
+
if (result.ok)
|
|
352
|
+
return;
|
|
353
|
+
const orphans = result.violations.filter((violation) => violation.kind === 'orphanSpaceDir');
|
|
354
|
+
if (orphans.length === 0)
|
|
355
|
+
return;
|
|
356
|
+
throw new OrphanExtensionSpaceError(orphans.map((violation) => violation.spaceId), orphans.map((violation) => violation.remediation));
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=extension-spaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-spaces.js","sourceRoot":"","sources":["../../src/generator/extension-spaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAEjF,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,8CAA8C,CAAA;AAOrD,wFAAwF;AACxF,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAU,CAAA;AAEjE;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAGnC,IAAI;IAEJ,OAAO;IAJlB;IACE,6DAA6D;IACpD,IAAY;IACrB,gFAAgF;IACvE,OAAe;QAExB,KAAK,CACH,mBAAmB,IAAI,uB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-
export {
|
|
1
|
+
export { renderContractModule, writeContractModule } from './contract-module.js';
|
|
2
|
+
export { emitContract, ContractEmitError } from './contract-emit.js';
|
|
3
|
+
export { resolvePrismaBinary, runPrismaCli } from './prisma-cli.js';
|
|
4
|
+
export type { PrismaCliRun, PrismaCliStdio } from './prisma-cli.js';
|
|
5
|
+
export { seedExtensionContractSpaces, verifyExtensionSubpaths, ExtensionSubpathError, ExtensionDescriptorError, } from './extension-spaces.js';
|
|
6
|
+
export type { SeededExtensionSpaces, SeededExtensionSpace } from './extension-spaces.js';
|
|
2
7
|
export { generatePrismaConfig, writePrismaConfig } from './prisma-config.js';
|
|
8
|
+
export type { PrismaConfigLocationOverrides } from './prisma-config.js';
|
|
3
9
|
export { generateTypes, writeTypes } from './types.js';
|
|
4
10
|
export { generateListsNamespace, writeLists } from './lists.js';
|
|
5
11
|
export { generateContext, writeContext } from './context.js';
|
|
12
|
+
export type { ContextReferences } from './context.js';
|
|
6
13
|
export { generatePluginTypes, writePluginTypes } from './plugin-types.js';
|
|
7
|
-
export {
|
|
14
|
+
export { generateTables, writeTables } from './tables.js';
|
|
15
|
+
export { resolveOutputPaths, stageWritePaths, CONTRACT_ARTIFACTS, STAGED_ROOT_PRISMA_CONFIG, DEFAULT_CONTRACT_MODULE, DEFAULT_OPENSAAS_DIR, OPENSAAS_FILES, } from './output-paths.js';
|
|
8
16
|
export type { ResolvedOutputPaths, ResolvedWritePaths, ResolvedCrossReferences, } from './output-paths.js';
|
|
9
|
-
export { buildNodeBundle, formatNodeBuildDiagnostics } from './node-build.js';
|
|
10
|
-
export type { BuildNodeBundleOptions, BuildNodeBundleResult } from './node-build.js';
|
|
11
17
|
export { resolveTsconfigAlias } from './tsconfig-alias.js';
|
|
12
18
|
export type { TsconfigAliasResult } from './tsconfig-alias.js';
|
|
19
|
+
export { loadOpenSaasConfig, loadProjectEnvFile } from './config-load.js';
|
|
20
|
+
export type { LoadedOpenSaasConfig } from './config-load.js';
|
|
13
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,YAAY,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,cAAc,GACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/generator/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { renderContractModule, writeContractModule } from './contract-module.js';
|
|
2
|
+
export { emitContract, ContractEmitError } from './contract-emit.js';
|
|
3
|
+
export { resolvePrismaBinary, runPrismaCli } from './prisma-cli.js';
|
|
4
|
+
export { seedExtensionContractSpaces, verifyExtensionSubpaths, ExtensionSubpathError, ExtensionDescriptorError, } from './extension-spaces.js';
|
|
2
5
|
export { generatePrismaConfig, writePrismaConfig } from './prisma-config.js';
|
|
3
6
|
export { generateTypes, writeTypes } from './types.js';
|
|
4
7
|
export { generateListsNamespace, writeLists } from './lists.js';
|
|
5
8
|
export { generateContext, writeContext } from './context.js';
|
|
6
9
|
export { generatePluginTypes, writePluginTypes } from './plugin-types.js';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
10
|
+
export { generateTables, writeTables } from './tables.js';
|
|
11
|
+
export { resolveOutputPaths, stageWritePaths, CONTRACT_ARTIFACTS, STAGED_ROOT_PRISMA_CONFIG, DEFAULT_CONTRACT_MODULE, DEFAULT_OPENSAAS_DIR, OPENSAAS_FILES, } from './output-paths.js';
|
|
9
12
|
export { resolveTsconfigAlias } from './tsconfig-alias.js';
|
|
13
|
+
export { loadOpenSaasConfig, loadProjectEnvFile } from './config-load.js';
|
|
10
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,cAAc,GACf,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenSaasConfig } from '@opensaas/stack-core';
|
|
1
|
+
import type { DependencyTable, OpenSaasConfig } from '@opensaas/stack-core';
|
|
2
2
|
/**
|
|
3
3
|
* Generates the `Lists` namespace: TypeInfo for each list, giving hooks
|
|
4
4
|
* strongly-typed access to Prisma input types.
|
|
@@ -14,17 +14,16 @@ import type { OpenSaasConfig } from '@opensaas/stack-core';
|
|
|
14
14
|
* export type TypeInfo = {
|
|
15
15
|
* key: 'Post'
|
|
16
16
|
* item: Item
|
|
17
|
+
* db: import('./types.ts').DB
|
|
17
18
|
* inputs: {
|
|
18
|
-
* create: import('./
|
|
19
|
-
* update: import('./
|
|
19
|
+
* create: import('./types.ts').PostCreateInput
|
|
20
|
+
* update: import('./types.ts').PostUpdateInput
|
|
20
21
|
* }
|
|
21
|
-
* prisma: import('./prisma-client/client.ts').PrismaClient
|
|
22
|
-
* db: import('./types.ts').CustomDB
|
|
23
22
|
* }
|
|
24
23
|
* }
|
|
25
24
|
* }
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
|
-
export declare function generateListsNamespace(config: OpenSaasConfig): string;
|
|
29
|
-
export declare function writeLists(config: OpenSaasConfig, outputPath: string): void;
|
|
27
|
+
export declare function generateListsNamespace(config: OpenSaasConfig, dependencies: DependencyTable): string;
|
|
28
|
+
export declare function writeLists(config: OpenSaasConfig, outputPath: string, dependencies: DependencyTable): void;
|
|
30
29
|
//# sourceMappingURL=lists.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../src/generator/lists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../src/generator/lists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AA0C3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,eAAe,GAC5B,MAAM,CA+FR;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,eAAe,GAC5B,IAAI,CASN"}
|
package/dist/generator/lists.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import { assertFieldKeysAreIdentifiers } from './source-text.js';
|
|
4
|
+
import { needsEntries } from './types.js';
|
|
5
|
+
function capitalize(value) {
|
|
6
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Map a field type string to the TypeScript field-config type and the
|
|
5
10
|
* `@opensaas/stack-core` entry point it is exported from.
|
|
@@ -44,18 +49,18 @@ function getFieldTypeImport(fieldType) {
|
|
|
44
49
|
* export type TypeInfo = {
|
|
45
50
|
* key: 'Post'
|
|
46
51
|
* item: Item
|
|
52
|
+
* db: import('./types.ts').DB
|
|
47
53
|
* inputs: {
|
|
48
|
-
* create: import('./
|
|
49
|
-
* update: import('./
|
|
54
|
+
* create: import('./types.ts').PostCreateInput
|
|
55
|
+
* update: import('./types.ts').PostUpdateInput
|
|
50
56
|
* }
|
|
51
|
-
* prisma: import('./prisma-client/client.ts').PrismaClient
|
|
52
|
-
* db: import('./types.ts').CustomDB
|
|
53
57
|
* }
|
|
54
58
|
* }
|
|
55
59
|
* }
|
|
56
60
|
* ```
|
|
57
61
|
*/
|
|
58
|
-
export function generateListsNamespace(config) {
|
|
62
|
+
export function generateListsNamespace(config, dependencies) {
|
|
63
|
+
assertFieldKeysAreIdentifiers(config);
|
|
59
64
|
const lines = [];
|
|
60
65
|
lines.push('/**');
|
|
61
66
|
lines.push(' * Generated Lists namespace from OpenSaas configuration');
|
|
@@ -88,7 +93,9 @@ export function generateListsNamespace(config) {
|
|
|
88
93
|
lines.push(` export type ${listName} = import('@opensaas/stack-core').ListConfig<Lists.${listName}.TypeInfo>`);
|
|
89
94
|
lines.push('');
|
|
90
95
|
lines.push(` namespace ${listName} {`);
|
|
91
|
-
|
|
96
|
+
// A hook's \`item\` is the STORED row: it runs before \`resolveOutput\`, so a
|
|
97
|
+
// type carrying computed keys would promise a value it never sees (ADR-0027).
|
|
98
|
+
lines.push(` export type Item = import('./types.ts').${listName}StoredRow`);
|
|
92
99
|
lines.push('');
|
|
93
100
|
lines.push(` /**`);
|
|
94
101
|
lines.push(` * Field configurations for ${listName}`);
|
|
@@ -97,20 +104,33 @@ export function generateListsNamespace(config) {
|
|
|
97
104
|
lines.push(` export type Fields = {`);
|
|
98
105
|
for (const [fieldName, fieldConfig] of Object.entries(listConfig.fields)) {
|
|
99
106
|
const { module, typeName } = getFieldTypeImport(fieldConfig.type);
|
|
100
|
-
lines.push(` ${fieldName}: import('${module}').${typeName}<Lists.${listName}.TypeInfo>`);
|
|
107
|
+
lines.push(` ${fieldName}: import('${module}').${typeName}<Lists.${listName}.TypeInfo, '${fieldName}'>`);
|
|
108
|
+
}
|
|
109
|
+
lines.push(` }`);
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push(` /**`);
|
|
112
|
+
lines.push(` * Per-field declared-dependency facts (ADR-0051). \`needs\` is the set`);
|
|
113
|
+
lines.push(` * the runtime widens the read by; \`item\` is that set resolved against`);
|
|
114
|
+
lines.push(` * the contract — exactly what its \`resolveOutput\` hook is handed.`);
|
|
115
|
+
lines.push(` */`);
|
|
116
|
+
lines.push(` export type Needs = {`);
|
|
117
|
+
for (const [fieldName, union] of needsEntries(listName, listConfig.fields, dependencies, config)) {
|
|
118
|
+
const itemType = `import('./types.ts').${listName}${capitalize(fieldName)}NeedsItem`;
|
|
119
|
+
lines.push(` ${fieldName}: { needs: ${union}; item: ${itemType} }`);
|
|
101
120
|
}
|
|
102
121
|
lines.push(` }`);
|
|
103
122
|
lines.push('');
|
|
104
123
|
lines.push(` export type TypeInfo = {`);
|
|
105
124
|
lines.push(` key: '${listName}'`);
|
|
106
125
|
lines.push(` fields: Fields`);
|
|
126
|
+
lines.push(` needs: Needs`);
|
|
107
127
|
lines.push(` item: Item`);
|
|
128
|
+
lines.push(` output: import('./types.ts').${listName}`);
|
|
129
|
+
lines.push(` db: import('./types.ts').DB`);
|
|
108
130
|
lines.push(` inputs: {`);
|
|
109
|
-
lines.push(` create: import('./
|
|
110
|
-
lines.push(` update: import('./
|
|
131
|
+
lines.push(` create: import('./types.ts').${listName}CreateInput`);
|
|
132
|
+
lines.push(` update: import('./types.ts').${listName}UpdateInput`);
|
|
111
133
|
lines.push(` }`);
|
|
112
|
-
lines.push(` prisma: import('./prisma-client/client.ts').PrismaClient`);
|
|
113
|
-
lines.push(` db: import('./types.ts').CustomDB`);
|
|
114
134
|
lines.push(` }`);
|
|
115
135
|
lines.push(` }`);
|
|
116
136
|
lines.push('');
|
|
@@ -118,8 +138,8 @@ export function generateListsNamespace(config) {
|
|
|
118
138
|
lines.push('}');
|
|
119
139
|
return lines.join('\n');
|
|
120
140
|
}
|
|
121
|
-
export function writeLists(config, outputPath) {
|
|
122
|
-
const lists = generateListsNamespace(config);
|
|
141
|
+
export function writeLists(config, outputPath, dependencies) {
|
|
142
|
+
const lists = generateListsNamespace(config, dependencies);
|
|
123
143
|
const dir = path.dirname(outputPath);
|
|
124
144
|
if (!fs.existsSync(dir)) {
|
|
125
145
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/generator/lists.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/generator/lists.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,M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