@prisma/orm-mongo 8.0.1-dev.40 → 8.0.1-dev.42
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/{mongo-static-DjmABCwj-8F0oDGAV.mjs → mongo-static-DXv-zWOu-FTCkjjZe.mjs} +3 -3
- package/dist/{mongo-static-DjmABCwj-8F0oDGAV.mjs.map → mongo-static-DXv-zWOu-FTCkjjZe.mjs.map} +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/static.mjs +1 -1
- package/package.json +12 -12
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/upgrade-app.md +1 -1
- package/skills/prisma-8/references/upgrade-extension.md +1 -1
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/instructions.md +2385 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-hash-inputs/contract-hash-inputs.ts +2048 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-signature-names/contract-signature-names.ts +667 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/facade-paths-an-application-uses/facade-paths-an-application-uses.ts +667 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/platform-paths-an-extension-uses/platform-paths-an-extension-uses.ts +1996 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/stored-files-format-version/stored-files-format-version.ts +586 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/instructions.md +2043 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-hash-inputs/contract-hash-inputs.ts +2048 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-signature-names/contract-signature-names.ts +667 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/facade-paths-an-application-uses/facade-paths-an-application-uses.ts +667 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/platform-paths-an-extension-uses/platform-paths-an-extension-uses.ts +1996 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/stored-files-format-version/stored-files-format-version.ts +586 -0
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Changes each import of a path the database packages (`@prisma/orm-postgres`, `@prisma/orm-sqlite`, `@prisma/orm-mysql`, `@prisma/orm-mariadb`, `@prisma/orm-mongo`) no longer publish to the path that publishes the same module. A database package forwarded these paths from the platform packages; the platform package still publishes each of them, under its own name. Two modules were renamed since: the families' `contract/canonicalization-hooks` is now `contract/normal-form`, and MySQL's `target/marker-lock` is now `target/signature-lock`. An import that takes only the default from `target/pack` or `family/pack` becomes an import from the database package's own `target` or `family`, which export the same pack as their default; one that takes only `param` from `relational-core/expression`, or only `isStructuredError` from `utils/structured-error`, becomes an import from the database package's own `runtime`. Every other import goes to the platform package.
|
|
4
|
+
*
|
|
5
|
+
* Usage: node facade-paths-an-application-uses.ts [project-root]
|
|
6
|
+
*
|
|
7
|
+
* The project root defaults to the working directory. The script walks it, skipping `node_modules`, `dist`, `build` and directories whose name starts with a dot, and rewrites the module specifiers in each `.ts`, `.mts`, `.cts`, `.tsx`, `.js`, `.mjs`, `.cjs` and `.jsx` file in place. It changes nothing else in a file, prints each file it changed, and a second run changes nothing.
|
|
8
|
+
*/
|
|
9
|
+
import { readdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { join, relative, resolve } from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
|
|
13
|
+
const AUDIENCE: 'app' | 'extension' = 'app';
|
|
14
|
+
|
|
15
|
+
type Facade = 'postgres' | 'sqlite' | 'mysql' | 'mariadb' | 'mongo';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The paths each database package published at release 8.0.0-rc.25 and this change removes. Only these
|
|
19
|
+
* are rewritten. A path that release did not publish, such as one an older snapshot imports, is left
|
|
20
|
+
* alone, and so are the `internal/…` paths the `postgres-client-parts-early-access-names` change removes.
|
|
21
|
+
*/
|
|
22
|
+
export const REMOVED: Readonly<Record<Facade, ReadonlySet<string>>> = {
|
|
23
|
+
postgres: new Set([
|
|
24
|
+
'adapter',
|
|
25
|
+
'adapter/adapter',
|
|
26
|
+
'adapter/control',
|
|
27
|
+
'adapter/runtime',
|
|
28
|
+
'adapter/sql-renderer',
|
|
29
|
+
'adapter/types',
|
|
30
|
+
'builder',
|
|
31
|
+
'components',
|
|
32
|
+
'components/authoring',
|
|
33
|
+
'components/codec',
|
|
34
|
+
'components/components',
|
|
35
|
+
'components/control',
|
|
36
|
+
'components/emission',
|
|
37
|
+
'components/execution',
|
|
38
|
+
'components/ir',
|
|
39
|
+
'components/psl-ast',
|
|
40
|
+
'components/utils',
|
|
41
|
+
'contract',
|
|
42
|
+
'contract/apply-specifier-default-control-policy',
|
|
43
|
+
'contract/contract-validation-error',
|
|
44
|
+
'contract/default-namespace',
|
|
45
|
+
'contract/enum-accessor',
|
|
46
|
+
'contract/hashing',
|
|
47
|
+
'contract/hashing-utils',
|
|
48
|
+
'contract/is-plain-record',
|
|
49
|
+
'contract/resolve-domain-model',
|
|
50
|
+
'contract/validate-domain',
|
|
51
|
+
'contract/validate-once',
|
|
52
|
+
'contract/validate-storage',
|
|
53
|
+
'driver',
|
|
54
|
+
'driver/control',
|
|
55
|
+
'driver/runtime',
|
|
56
|
+
'family-contract',
|
|
57
|
+
'family-contract/authored-check-naming',
|
|
58
|
+
'family-contract/canonicalization-hooks',
|
|
59
|
+
'family-contract/check-expressions',
|
|
60
|
+
'family-contract/codec-json-type',
|
|
61
|
+
'family-contract/contract-view',
|
|
62
|
+
'family-contract/data-type',
|
|
63
|
+
'family-contract/data-type-support',
|
|
64
|
+
'family-contract/entity-handle-lowering-hook',
|
|
65
|
+
'family-contract/entity-kinds',
|
|
66
|
+
'family-contract/factories',
|
|
67
|
+
'family-contract/foreign-key-materialization',
|
|
68
|
+
'family-contract/generated-id-column-aliases',
|
|
69
|
+
'family-contract/index-naming',
|
|
70
|
+
'family-contract/index-type-validation',
|
|
71
|
+
'family-contract/index-types',
|
|
72
|
+
'family-contract/referential-action-sql',
|
|
73
|
+
'family-contract/resolve-storage-table',
|
|
74
|
+
'family-contract/sql-expression',
|
|
75
|
+
'family-contract/validators',
|
|
76
|
+
'family-contract/value-set-derivation-hook',
|
|
77
|
+
'family/control-adapter',
|
|
78
|
+
'family/diff',
|
|
79
|
+
'family/ir',
|
|
80
|
+
'family/migration',
|
|
81
|
+
'family/pack',
|
|
82
|
+
'family/psl-build',
|
|
83
|
+
'family/psl-infer',
|
|
84
|
+
'family/runtime',
|
|
85
|
+
'family/verify',
|
|
86
|
+
'migration-tools/contract-snapshot-store',
|
|
87
|
+
'relational-core',
|
|
88
|
+
'relational-core/aggregate-descriptor-registry',
|
|
89
|
+
'relational-core/codec-descriptor-registry',
|
|
90
|
+
'relational-core/collection-methods',
|
|
91
|
+
'relational-core/contract-free',
|
|
92
|
+
'relational-core/expression',
|
|
93
|
+
'relational-core/functions',
|
|
94
|
+
'relational-core/index-reference',
|
|
95
|
+
'relational-core/middleware',
|
|
96
|
+
'relational-core/plan',
|
|
97
|
+
'relational-core/query-lane-context',
|
|
98
|
+
'relational-core/types',
|
|
99
|
+
'schema-ir/types',
|
|
100
|
+
'target/aggregates',
|
|
101
|
+
'target/codec-descriptor',
|
|
102
|
+
'target/codecs',
|
|
103
|
+
'target/contract-free',
|
|
104
|
+
'target/control',
|
|
105
|
+
'target/data-transform',
|
|
106
|
+
'target/data-types',
|
|
107
|
+
'target/ddl',
|
|
108
|
+
'target/default-normalizer',
|
|
109
|
+
'target/diff-database-schema',
|
|
110
|
+
'target/errors',
|
|
111
|
+
'target/full-text-index-authoring',
|
|
112
|
+
'target/issue-planner',
|
|
113
|
+
'target/marker-lock',
|
|
114
|
+
'target/native-type-normalizer',
|
|
115
|
+
'target/op-factory-call',
|
|
116
|
+
'target/pack',
|
|
117
|
+
'target/planner',
|
|
118
|
+
'target/planner-ddl-builders',
|
|
119
|
+
'target/planner-identity-values',
|
|
120
|
+
'target/planner-produced-postgres-migration',
|
|
121
|
+
'target/planner-schema-lookup',
|
|
122
|
+
'target/planner-sql-checks',
|
|
123
|
+
'target/render-ops',
|
|
124
|
+
'target/render-typescript',
|
|
125
|
+
'target/rls-canonicalize',
|
|
126
|
+
'target/schema-ir-annotations',
|
|
127
|
+
'target/server-version',
|
|
128
|
+
'target/sql-utils',
|
|
129
|
+
'target/types',
|
|
130
|
+
'utils',
|
|
131
|
+
'utils/abortable',
|
|
132
|
+
'utils/array-equal',
|
|
133
|
+
'utils/assertions',
|
|
134
|
+
'utils/canonical-stringify',
|
|
135
|
+
'utils/casts',
|
|
136
|
+
'utils/defined',
|
|
137
|
+
'utils/guards',
|
|
138
|
+
'utils/hash-content',
|
|
139
|
+
'utils/internal-error',
|
|
140
|
+
'utils/json',
|
|
141
|
+
'utils/promise',
|
|
142
|
+
'utils/redact-db-url',
|
|
143
|
+
'utils/result',
|
|
144
|
+
'utils/simplify-deep',
|
|
145
|
+
'utils/structured-error',
|
|
146
|
+
'utils/suppress-idle-connection-errors',
|
|
147
|
+
'utils/text',
|
|
148
|
+
'utils/types',
|
|
149
|
+
]),
|
|
150
|
+
sqlite: new Set([
|
|
151
|
+
'adapter',
|
|
152
|
+
'adapter/adapter',
|
|
153
|
+
'adapter/control',
|
|
154
|
+
'adapter/runtime',
|
|
155
|
+
'adapter/sql-renderer',
|
|
156
|
+
'adapter/types',
|
|
157
|
+
'builder',
|
|
158
|
+
'components',
|
|
159
|
+
'components/authoring',
|
|
160
|
+
'components/codec',
|
|
161
|
+
'components/components',
|
|
162
|
+
'components/control',
|
|
163
|
+
'components/emission',
|
|
164
|
+
'components/execution',
|
|
165
|
+
'components/ir',
|
|
166
|
+
'components/psl-ast',
|
|
167
|
+
'components/utils',
|
|
168
|
+
'contract',
|
|
169
|
+
'contract/apply-specifier-default-control-policy',
|
|
170
|
+
'contract/contract-validation-error',
|
|
171
|
+
'contract/default-namespace',
|
|
172
|
+
'contract/enum-accessor',
|
|
173
|
+
'contract/hashing',
|
|
174
|
+
'contract/hashing-utils',
|
|
175
|
+
'contract/is-plain-record',
|
|
176
|
+
'contract/resolve-domain-model',
|
|
177
|
+
'contract/validate-domain',
|
|
178
|
+
'contract/validate-once',
|
|
179
|
+
'contract/validate-storage',
|
|
180
|
+
'driver',
|
|
181
|
+
'driver/control',
|
|
182
|
+
'driver/runtime',
|
|
183
|
+
'family-contract',
|
|
184
|
+
'family-contract/authored-check-naming',
|
|
185
|
+
'family-contract/canonicalization-hooks',
|
|
186
|
+
'family-contract/check-expressions',
|
|
187
|
+
'family-contract/codec-json-type',
|
|
188
|
+
'family-contract/contract-view',
|
|
189
|
+
'family-contract/data-type',
|
|
190
|
+
'family-contract/data-type-support',
|
|
191
|
+
'family-contract/entity-handle-lowering-hook',
|
|
192
|
+
'family-contract/entity-kinds',
|
|
193
|
+
'family-contract/factories',
|
|
194
|
+
'family-contract/foreign-key-materialization',
|
|
195
|
+
'family-contract/generated-id-column-aliases',
|
|
196
|
+
'family-contract/index-naming',
|
|
197
|
+
'family-contract/index-type-validation',
|
|
198
|
+
'family-contract/index-types',
|
|
199
|
+
'family-contract/referential-action-sql',
|
|
200
|
+
'family-contract/resolve-storage-table',
|
|
201
|
+
'family-contract/sql-expression',
|
|
202
|
+
'family-contract/validators',
|
|
203
|
+
'family-contract/value-set-derivation-hook',
|
|
204
|
+
'family/control-adapter',
|
|
205
|
+
'family/diff',
|
|
206
|
+
'family/ir',
|
|
207
|
+
'family/migration',
|
|
208
|
+
'family/pack',
|
|
209
|
+
'family/psl-build',
|
|
210
|
+
'family/psl-infer',
|
|
211
|
+
'family/runtime',
|
|
212
|
+
'family/verify',
|
|
213
|
+
'migration-tools/contract-snapshot-store',
|
|
214
|
+
'relational-core',
|
|
215
|
+
'relational-core/aggregate-descriptor-registry',
|
|
216
|
+
'relational-core/codec-descriptor-registry',
|
|
217
|
+
'relational-core/collection-methods',
|
|
218
|
+
'relational-core/contract-free',
|
|
219
|
+
'relational-core/expression',
|
|
220
|
+
'relational-core/functions',
|
|
221
|
+
'relational-core/index-reference',
|
|
222
|
+
'relational-core/middleware',
|
|
223
|
+
'relational-core/plan',
|
|
224
|
+
'relational-core/query-lane-context',
|
|
225
|
+
'relational-core/types',
|
|
226
|
+
'schema-ir/types',
|
|
227
|
+
'target/aggregates',
|
|
228
|
+
'target/codec-descriptor',
|
|
229
|
+
'target/codecs',
|
|
230
|
+
'target/contract-free',
|
|
231
|
+
'target/control',
|
|
232
|
+
'target/control-tables',
|
|
233
|
+
'target/data-types',
|
|
234
|
+
'target/ddl',
|
|
235
|
+
'target/default-normalizer',
|
|
236
|
+
'target/op-factory-call',
|
|
237
|
+
'target/pack',
|
|
238
|
+
'target/planner',
|
|
239
|
+
'target/planner-produced-sqlite-migration',
|
|
240
|
+
'target/render-ops',
|
|
241
|
+
'target/sql-utils',
|
|
242
|
+
'target/types',
|
|
243
|
+
'utils',
|
|
244
|
+
'utils/abortable',
|
|
245
|
+
'utils/array-equal',
|
|
246
|
+
'utils/assertions',
|
|
247
|
+
'utils/canonical-stringify',
|
|
248
|
+
'utils/casts',
|
|
249
|
+
'utils/defined',
|
|
250
|
+
'utils/guards',
|
|
251
|
+
'utils/hash-content',
|
|
252
|
+
'utils/internal-error',
|
|
253
|
+
'utils/json',
|
|
254
|
+
'utils/promise',
|
|
255
|
+
'utils/redact-db-url',
|
|
256
|
+
'utils/result',
|
|
257
|
+
'utils/simplify-deep',
|
|
258
|
+
'utils/structured-error',
|
|
259
|
+
'utils/suppress-idle-connection-errors',
|
|
260
|
+
'utils/text',
|
|
261
|
+
'utils/types',
|
|
262
|
+
]),
|
|
263
|
+
mysql: new Set([
|
|
264
|
+
'adapter',
|
|
265
|
+
'adapter/adapter',
|
|
266
|
+
'adapter/control',
|
|
267
|
+
'adapter/runtime',
|
|
268
|
+
'adapter/sql-renderer',
|
|
269
|
+
'builder',
|
|
270
|
+
'components',
|
|
271
|
+
'components/authoring',
|
|
272
|
+
'components/codec',
|
|
273
|
+
'components/components',
|
|
274
|
+
'components/control',
|
|
275
|
+
'components/emission',
|
|
276
|
+
'components/execution',
|
|
277
|
+
'components/ir',
|
|
278
|
+
'components/psl-ast',
|
|
279
|
+
'components/utils',
|
|
280
|
+
'contract',
|
|
281
|
+
'contract/apply-specifier-default-control-policy',
|
|
282
|
+
'contract/contract-validation-error',
|
|
283
|
+
'contract/default-namespace',
|
|
284
|
+
'contract/enum-accessor',
|
|
285
|
+
'contract/hashing',
|
|
286
|
+
'contract/hashing-utils',
|
|
287
|
+
'contract/is-plain-record',
|
|
288
|
+
'contract/resolve-domain-model',
|
|
289
|
+
'contract/validate-domain',
|
|
290
|
+
'contract/validate-once',
|
|
291
|
+
'contract/validate-storage',
|
|
292
|
+
'driver',
|
|
293
|
+
'driver/control',
|
|
294
|
+
'driver/runtime',
|
|
295
|
+
'family-contract',
|
|
296
|
+
'family-contract/authored-check-naming',
|
|
297
|
+
'family-contract/canonicalization-hooks',
|
|
298
|
+
'family-contract/check-expressions',
|
|
299
|
+
'family-contract/codec-json-type',
|
|
300
|
+
'family-contract/contract-view',
|
|
301
|
+
'family-contract/data-type',
|
|
302
|
+
'family-contract/data-type-support',
|
|
303
|
+
'family-contract/entity-handle-lowering-hook',
|
|
304
|
+
'family-contract/entity-kinds',
|
|
305
|
+
'family-contract/factories',
|
|
306
|
+
'family-contract/foreign-key-materialization',
|
|
307
|
+
'family-contract/generated-id-column-aliases',
|
|
308
|
+
'family-contract/index-naming',
|
|
309
|
+
'family-contract/index-type-validation',
|
|
310
|
+
'family-contract/index-types',
|
|
311
|
+
'family-contract/referential-action-sql',
|
|
312
|
+
'family-contract/resolve-storage-table',
|
|
313
|
+
'family-contract/sql-expression',
|
|
314
|
+
'family-contract/validators',
|
|
315
|
+
'family-contract/value-set-derivation-hook',
|
|
316
|
+
'family/control-adapter',
|
|
317
|
+
'family/diff',
|
|
318
|
+
'family/ir',
|
|
319
|
+
'family/migration',
|
|
320
|
+
'family/pack',
|
|
321
|
+
'family/psl-build',
|
|
322
|
+
'family/psl-infer',
|
|
323
|
+
'family/runtime',
|
|
324
|
+
'family/verify',
|
|
325
|
+
'migration-tools/contract-snapshot-store',
|
|
326
|
+
'relational-core',
|
|
327
|
+
'relational-core/aggregate-descriptor-registry',
|
|
328
|
+
'relational-core/codec-descriptor-registry',
|
|
329
|
+
'relational-core/collection-methods',
|
|
330
|
+
'relational-core/contract-free',
|
|
331
|
+
'relational-core/expression',
|
|
332
|
+
'relational-core/functions',
|
|
333
|
+
'relational-core/index-reference',
|
|
334
|
+
'relational-core/middleware',
|
|
335
|
+
'relational-core/plan',
|
|
336
|
+
'relational-core/query-lane-context',
|
|
337
|
+
'relational-core/types',
|
|
338
|
+
'schema-ir/types',
|
|
339
|
+
'target/aggregates',
|
|
340
|
+
'target/codec-descriptor',
|
|
341
|
+
'target/codecs',
|
|
342
|
+
'target/contract-free',
|
|
343
|
+
'target/control',
|
|
344
|
+
'target/control-tables',
|
|
345
|
+
'target/data-types',
|
|
346
|
+
'target/ddl',
|
|
347
|
+
'target/default-normalizer',
|
|
348
|
+
'target/descriptor-meta-runtime',
|
|
349
|
+
'target/errors',
|
|
350
|
+
'target/marker-lock',
|
|
351
|
+
'target/pack',
|
|
352
|
+
'target/sql-utils',
|
|
353
|
+
'target/types',
|
|
354
|
+
'utils',
|
|
355
|
+
'utils/abortable',
|
|
356
|
+
'utils/array-equal',
|
|
357
|
+
'utils/assertions',
|
|
358
|
+
'utils/canonical-stringify',
|
|
359
|
+
'utils/casts',
|
|
360
|
+
'utils/defined',
|
|
361
|
+
'utils/guards',
|
|
362
|
+
'utils/hash-content',
|
|
363
|
+
'utils/internal-error',
|
|
364
|
+
'utils/json',
|
|
365
|
+
'utils/promise',
|
|
366
|
+
'utils/redact-db-url',
|
|
367
|
+
'utils/result',
|
|
368
|
+
'utils/simplify-deep',
|
|
369
|
+
'utils/structured-error',
|
|
370
|
+
'utils/suppress-idle-connection-errors',
|
|
371
|
+
'utils/text',
|
|
372
|
+
'utils/types',
|
|
373
|
+
]),
|
|
374
|
+
mariadb: new Set([
|
|
375
|
+
'adapter',
|
|
376
|
+
'adapter/adapter',
|
|
377
|
+
'adapter/control',
|
|
378
|
+
'adapter/runtime',
|
|
379
|
+
'builder',
|
|
380
|
+
'components',
|
|
381
|
+
'components/authoring',
|
|
382
|
+
'components/codec',
|
|
383
|
+
'components/components',
|
|
384
|
+
'components/control',
|
|
385
|
+
'components/emission',
|
|
386
|
+
'components/execution',
|
|
387
|
+
'components/ir',
|
|
388
|
+
'components/psl-ast',
|
|
389
|
+
'components/utils',
|
|
390
|
+
'contract',
|
|
391
|
+
'contract/apply-specifier-default-control-policy',
|
|
392
|
+
'contract/contract-validation-error',
|
|
393
|
+
'contract/default-namespace',
|
|
394
|
+
'contract/enum-accessor',
|
|
395
|
+
'contract/hashing',
|
|
396
|
+
'contract/hashing-utils',
|
|
397
|
+
'contract/is-plain-record',
|
|
398
|
+
'contract/resolve-domain-model',
|
|
399
|
+
'contract/validate-domain',
|
|
400
|
+
'contract/validate-once',
|
|
401
|
+
'contract/validate-storage',
|
|
402
|
+
'driver',
|
|
403
|
+
'driver/control',
|
|
404
|
+
'driver/runtime',
|
|
405
|
+
'family-contract',
|
|
406
|
+
'family-contract/authored-check-naming',
|
|
407
|
+
'family-contract/canonicalization-hooks',
|
|
408
|
+
'family-contract/check-expressions',
|
|
409
|
+
'family-contract/codec-json-type',
|
|
410
|
+
'family-contract/contract-view',
|
|
411
|
+
'family-contract/data-type',
|
|
412
|
+
'family-contract/data-type-support',
|
|
413
|
+
'family-contract/entity-handle-lowering-hook',
|
|
414
|
+
'family-contract/entity-kinds',
|
|
415
|
+
'family-contract/factories',
|
|
416
|
+
'family-contract/foreign-key-materialization',
|
|
417
|
+
'family-contract/generated-id-column-aliases',
|
|
418
|
+
'family-contract/index-naming',
|
|
419
|
+
'family-contract/index-type-validation',
|
|
420
|
+
'family-contract/index-types',
|
|
421
|
+
'family-contract/referential-action-sql',
|
|
422
|
+
'family-contract/resolve-storage-table',
|
|
423
|
+
'family-contract/sql-expression',
|
|
424
|
+
'family-contract/validators',
|
|
425
|
+
'family-contract/value-set-derivation-hook',
|
|
426
|
+
'family/control-adapter',
|
|
427
|
+
'family/diff',
|
|
428
|
+
'family/ir',
|
|
429
|
+
'family/migration',
|
|
430
|
+
'family/pack',
|
|
431
|
+
'family/psl-build',
|
|
432
|
+
'family/psl-infer',
|
|
433
|
+
'family/runtime',
|
|
434
|
+
'family/verify',
|
|
435
|
+
'migration-tools/contract-snapshot-store',
|
|
436
|
+
'relational-core',
|
|
437
|
+
'relational-core/aggregate-descriptor-registry',
|
|
438
|
+
'relational-core/codec-descriptor-registry',
|
|
439
|
+
'relational-core/collection-methods',
|
|
440
|
+
'relational-core/contract-free',
|
|
441
|
+
'relational-core/expression',
|
|
442
|
+
'relational-core/functions',
|
|
443
|
+
'relational-core/index-reference',
|
|
444
|
+
'relational-core/middleware',
|
|
445
|
+
'relational-core/plan',
|
|
446
|
+
'relational-core/query-lane-context',
|
|
447
|
+
'relational-core/types',
|
|
448
|
+
'schema-ir/types',
|
|
449
|
+
'target/control',
|
|
450
|
+
'target/descriptor-meta-runtime',
|
|
451
|
+
'target/pack',
|
|
452
|
+
'utils',
|
|
453
|
+
'utils/abortable',
|
|
454
|
+
'utils/array-equal',
|
|
455
|
+
'utils/assertions',
|
|
456
|
+
'utils/canonical-stringify',
|
|
457
|
+
'utils/casts',
|
|
458
|
+
'utils/defined',
|
|
459
|
+
'utils/guards',
|
|
460
|
+
'utils/hash-content',
|
|
461
|
+
'utils/internal-error',
|
|
462
|
+
'utils/json',
|
|
463
|
+
'utils/promise',
|
|
464
|
+
'utils/redact-db-url',
|
|
465
|
+
'utils/result',
|
|
466
|
+
'utils/simplify-deep',
|
|
467
|
+
'utils/structured-error',
|
|
468
|
+
'utils/suppress-idle-connection-errors',
|
|
469
|
+
'utils/text',
|
|
470
|
+
'utils/types',
|
|
471
|
+
]),
|
|
472
|
+
mongo: new Set([
|
|
473
|
+
'adapter',
|
|
474
|
+
'adapter/control',
|
|
475
|
+
'adapter/runtime',
|
|
476
|
+
'components',
|
|
477
|
+
'components/authoring',
|
|
478
|
+
'components/codec',
|
|
479
|
+
'components/components',
|
|
480
|
+
'components/control',
|
|
481
|
+
'components/emission',
|
|
482
|
+
'components/execution',
|
|
483
|
+
'components/ir',
|
|
484
|
+
'components/psl-ast',
|
|
485
|
+
'components/utils',
|
|
486
|
+
'contract',
|
|
487
|
+
'contract/apply-specifier-default-control-policy',
|
|
488
|
+
'contract/contract-validation-error',
|
|
489
|
+
'contract/default-namespace',
|
|
490
|
+
'contract/enum-accessor',
|
|
491
|
+
'contract/hashing',
|
|
492
|
+
'contract/hashing-utils',
|
|
493
|
+
'contract/is-plain-record',
|
|
494
|
+
'contract/resolve-domain-model',
|
|
495
|
+
'contract/validate-domain',
|
|
496
|
+
'contract/validate-once',
|
|
497
|
+
'contract/validate-storage',
|
|
498
|
+
'driver',
|
|
499
|
+
'driver/control',
|
|
500
|
+
'driver/runtime',
|
|
501
|
+
'family-contract/canonicalization-hooks',
|
|
502
|
+
'family-contract/data-type',
|
|
503
|
+
'family-contract/entity-kinds',
|
|
504
|
+
'family/control-adapter',
|
|
505
|
+
'family/ir',
|
|
506
|
+
'family/migration',
|
|
507
|
+
'family/pack',
|
|
508
|
+
'family/runtime',
|
|
509
|
+
'family/schema-verify',
|
|
510
|
+
'migration-tools/contract-snapshot-store',
|
|
511
|
+
'query-ast',
|
|
512
|
+
'query-ast/control',
|
|
513
|
+
'query-builder/contract-free',
|
|
514
|
+
'target/codecs',
|
|
515
|
+
'target/control',
|
|
516
|
+
'target/data-types',
|
|
517
|
+
'target/pack',
|
|
518
|
+
'target/server-version',
|
|
519
|
+
'utils',
|
|
520
|
+
'utils/abortable',
|
|
521
|
+
'utils/array-equal',
|
|
522
|
+
'utils/assertions',
|
|
523
|
+
'utils/canonical-stringify',
|
|
524
|
+
'utils/casts',
|
|
525
|
+
'utils/defined',
|
|
526
|
+
'utils/guards',
|
|
527
|
+
'utils/hash-content',
|
|
528
|
+
'utils/internal-error',
|
|
529
|
+
'utils/json',
|
|
530
|
+
'utils/promise',
|
|
531
|
+
'utils/redact-db-url',
|
|
532
|
+
'utils/result',
|
|
533
|
+
'utils/simplify-deep',
|
|
534
|
+
'utils/structured-error',
|
|
535
|
+
'utils/suppress-idle-connection-errors',
|
|
536
|
+
'utils/text',
|
|
537
|
+
'utils/types',
|
|
538
|
+
'value/mongodb-types',
|
|
539
|
+
]),
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
const TARGET_PACKAGE: Readonly<Record<Facade, string>> = {
|
|
543
|
+
postgres: '@prisma/orm-target-postgres',
|
|
544
|
+
sqlite: '@prisma/orm-target-sqlite',
|
|
545
|
+
mysql: '@prisma/orm-target-mysql',
|
|
546
|
+
mariadb: '@prisma/orm-target-mariadb',
|
|
547
|
+
mongo: '@prisma/orm-target-mongo',
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const FACADES_WITH_OWN_PACKS: ReadonlySet<Facade> = new Set(['postgres', 'mongo']);
|
|
551
|
+
|
|
552
|
+
function familyPackage(facade: Facade): string {
|
|
553
|
+
return facade === 'mongo' ? '@prisma/orm-family-mongo' : '@prisma/orm-family-sql';
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/** The specifier that publishes what `@prisma/orm-<facade>/<subpath>` did, or undefined when this change did not remove the path. */
|
|
557
|
+
export function replacementOf(facade: Facade, subpath: string): string | undefined {
|
|
558
|
+
if (!REMOVED[facade].has(subpath)) return undefined;
|
|
559
|
+
const [entry = '', ...rest] = subpath.split('/');
|
|
560
|
+
const tail = rest.length === 0 ? '' : `/${rest.join('/')}`;
|
|
561
|
+
switch (entry) {
|
|
562
|
+
case 'adapter':
|
|
563
|
+
case 'driver':
|
|
564
|
+
case 'target':
|
|
565
|
+
return `${TARGET_PACKAGE[facade]}/${entry}${facade === 'mysql' && tail === '/marker-lock' ? '/signature-lock' : tail}`;
|
|
566
|
+
case 'components':
|
|
567
|
+
case 'contract':
|
|
568
|
+
case 'utils':
|
|
569
|
+
return `@prisma/orm-framework/${entry}${tail}`;
|
|
570
|
+
case 'family-contract':
|
|
571
|
+
return `${familyPackage(facade)}/contract${tail === '/canonicalization-hooks' ? '/normal-form' : tail}`;
|
|
572
|
+
case 'family':
|
|
573
|
+
return `${familyPackage(facade)}/family${tail}`;
|
|
574
|
+
case 'builder':
|
|
575
|
+
case 'relational-core':
|
|
576
|
+
case 'schema-ir':
|
|
577
|
+
case 'query-ast':
|
|
578
|
+
case 'query-builder':
|
|
579
|
+
case 'value':
|
|
580
|
+
return `${familyPackage(facade)}/${entry}${tail}`;
|
|
581
|
+
case 'migration-tools':
|
|
582
|
+
return `@prisma/orm-toolchain/migration-tools${tail}`;
|
|
583
|
+
default:
|
|
584
|
+
return undefined;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const SPECIFIER =
|
|
589
|
+
/(['"`])@prisma\/orm-(postgres|sqlite|mysql|mariadb|mongo)\/([A-Za-z0-9_./-]+)\1/g;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* In an application, an import that takes only what one of the database package's own modules
|
|
593
|
+
* re-exports goes to that module: the default alone from `target/pack` or `family/pack` (PostgreSQL
|
|
594
|
+
* and MongoDB, whose `target` and `family` export the pack as their default) to `target` or
|
|
595
|
+
* `family`, and `param` or `isStructuredError` alone to `runtime`. Every other import goes to the
|
|
596
|
+
* platform package, which publishes the whole module.
|
|
597
|
+
*/
|
|
598
|
+
// The clause holds no further `import`, so a match starts at the statement's own keyword, not at
|
|
599
|
+
// the word in a comment before it.
|
|
600
|
+
const IMPORT =
|
|
601
|
+
/(\bimport\s+(?:type\s+)?((?:(?!\bimport\b)[^'"`;])*?)\s*from\s*)(['"`])@prisma\/orm-(postgres|sqlite|mysql|mariadb|mongo)\/([A-Za-z0-9_./-]+)\3/g;
|
|
602
|
+
|
|
603
|
+
export function ownModuleOf(facade: Facade, subpath: string, clause: string): string | undefined {
|
|
604
|
+
if (AUDIENCE !== 'app' || !REMOVED[facade].has(subpath)) return undefined;
|
|
605
|
+
const taken = clause.trim();
|
|
606
|
+
if (/^[\w$]+$/.test(taken) && FACADES_WITH_OWN_PACKS.has(facade)) {
|
|
607
|
+
if (subpath === 'target/pack') return 'target';
|
|
608
|
+
if (subpath === 'family/pack') return 'family';
|
|
609
|
+
}
|
|
610
|
+
const name = /^\{\s*([\w$]+)\s*,?\s*\}$/.exec(taken)?.[1];
|
|
611
|
+
if (name === 'param' && subpath === 'relational-core/expression' && facade !== 'mongo')
|
|
612
|
+
return 'runtime';
|
|
613
|
+
if (name === 'isStructuredError' && subpath === 'utils/structured-error') return 'runtime';
|
|
614
|
+
return undefined;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function ownModuleImports(source: string): string {
|
|
618
|
+
return source.replace(
|
|
619
|
+
IMPORT,
|
|
620
|
+
(whole, head: string, clause: string, quote: string, facade: Facade, subpath: string) => {
|
|
621
|
+
const own = ownModuleOf(facade, subpath, clause);
|
|
622
|
+
return own === undefined ? whole : `${head}${quote}@prisma/orm-${facade}/${own}${quote}`;
|
|
623
|
+
},
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export function rewrite(source: string): string {
|
|
628
|
+
return ownModuleImports(source).replace(
|
|
629
|
+
SPECIFIER,
|
|
630
|
+
(whole, quote: string, facade: Facade, subpath: string) => {
|
|
631
|
+
const replacement = replacementOf(facade, subpath);
|
|
632
|
+
return replacement === undefined ? whole : `${quote}${replacement}${quote}`;
|
|
633
|
+
},
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
const SKIPPED_DIRECTORIES = new Set(['node_modules', 'dist', 'build']);
|
|
638
|
+
const SOURCE_FILE = /\.(ts|mts|cts|tsx|js|mjs|cjs|jsx)$/;
|
|
639
|
+
|
|
640
|
+
function* sourceFiles(dir: string): Generator<string> {
|
|
641
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
642
|
+
if (entry.isDirectory()) {
|
|
643
|
+
if (SKIPPED_DIRECTORIES.has(entry.name) || entry.name.startsWith('.')) continue;
|
|
644
|
+
yield* sourceFiles(join(dir, entry.name));
|
|
645
|
+
} else if (entry.isFile() && SOURCE_FILE.test(entry.name)) {
|
|
646
|
+
yield join(dir, entry.name);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function main(): void {
|
|
652
|
+
const root = resolve(process.argv[2] ?? process.cwd());
|
|
653
|
+
for (const file of sourceFiles(root)) {
|
|
654
|
+
const source = readFileSync(file, 'utf8');
|
|
655
|
+
const rewritten = rewrite(source);
|
|
656
|
+
if (rewritten === source) continue;
|
|
657
|
+
writeFileSync(file, rewritten);
|
|
658
|
+
console.log(relative(root, file));
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// Node names the module by its real path, so a script reached through a symbolic link compares that.
|
|
663
|
+
if (
|
|
664
|
+
process.argv[1] !== undefined &&
|
|
665
|
+
import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href
|
|
666
|
+
)
|
|
667
|
+
main();
|