@prisma/orm-toolchain 8.0.0-rc.1-dev.38 → 8.0.0-rc.1-dev.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/bin__prisma-next.mjs +8 -301
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/cli.mjs +1944 -256
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/cli__commands__migrate.mjs +1 -1
  6. package/dist/cli__commands__migration-check.d.mts +1 -1
  7. package/dist/cli__commands__migration-check.mjs +1 -1
  8. package/dist/cli__commands__migration-graph.d.mts +1 -1
  9. package/dist/cli__commands__migration-graph.mjs +1 -1
  10. package/dist/cli__commands__migration-list.d.mts +1 -1
  11. package/dist/cli__commands__migration-list.mjs +1 -1
  12. package/dist/cli__commands__migration-log.d.mts +1 -1
  13. package/dist/cli__commands__migration-log.mjs +1 -1
  14. package/dist/cli__commands__migration-show.d.mts +1 -1
  15. package/dist/cli__commands__migration-status.d.mts +1 -1
  16. package/dist/cli__commands__migration-status.mjs +2 -2
  17. package/dist/cli__control-api.d.mts +1 -1
  18. package/dist/cli__control-api.mjs +1 -1
  19. package/dist/cli__init-output.d.mts +1 -1
  20. package/dist/cli__init-output.mjs +1 -1
  21. package/dist/code-templates-CSLH8721-CWRA4Lru.mjs +295 -0
  22. package/dist/code-templates-CSLH8721-CWRA4Lru.mjs.map +1 -0
  23. package/dist/init-CcJxAIeS-CITTa8YU.mjs +800 -0
  24. package/dist/init-CcJxAIeS-CITTa8YU.mjs.map +1 -0
  25. package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs → migrate-BVEyoBor-CN_EOCzx.mjs} +3 -3
  26. package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs.map → migrate-BVEyoBor-CN_EOCzx.mjs.map} +1 -1
  27. package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs → migrate-failure-CKMEnA_x-ByHkYjn5.mjs} +3 -3
  28. package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs.map → migrate-failure-CKMEnA_x-ByHkYjn5.mjs.map} +1 -1
  29. package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs → migration-graph-D4sgTiXa-BLtiLIk7.mjs} +4 -4
  30. package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs.map → migration-graph-D4sgTiXa-BLtiLIk7.mjs.map} +1 -1
  31. package/dist/{migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs → migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs} +17 -3
  32. package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map +1 -0
  33. package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs → migration-graph-sections-B8WSWSkJ-CyaRo0T6.mjs} +3 -3
  34. package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs.map → migration-graph-sections-B8WSWSkJ-CyaRo0T6.mjs.map} +1 -1
  35. package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs → migration-list-BIL-re1m-CZY4m3d0.mjs} +3 -3
  36. package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs.map → migration-list-BIL-re1m-CZY4m3d0.mjs.map} +1 -1
  37. package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs → migration-log-BdBKYAUW-DTPxKZtD.mjs} +4 -4
  38. package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs.map → migration-log-BdBKYAUW-DTPxKZtD.mjs.map} +1 -1
  39. package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs → migration-log-table-eES9lPjv-BCFm8qJr.mjs} +3 -3
  40. package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs.map → migration-log-table-eES9lPjv-BCFm8qJr.mjs.map} +1 -1
  41. package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs → migration-status-DzPVkkB3-BA7jjITd.mjs} +5 -4
  42. package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs.map → migration-status-DzPVkkB3-BA7jjITd.mjs.map} +1 -1
  43. package/dist/{output-DWNYqZGc-D2sRgLAm.mjs → output-DP3woAjV-BxCr9nHA.mjs} +21 -11
  44. package/dist/output-DP3woAjV-BxCr9nHA.mjs.map +1 -0
  45. package/dist/{init-Bco4QkKJ-DqUZVrBU.mjs → redact-secrets-kQ0KKV1u-MnVSKe-u.mjs} +740 -1516
  46. package/dist/redact-secrets-kQ0KKV1u-MnVSKe-u.mjs.map +1 -0
  47. package/dist/{schemas-Bm2e3Hk1-qLKF0B36.d.mts → schemas-BGgjiKV0-Rh8RlMCl.d.mts} +4 -2
  48. package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts.map +1 -0
  49. package/dist/{schemas-BMkqaqvM-CLaqlat4.mjs → schemas-CYSD83Cu-Bff4PPoi.mjs} +3 -2
  50. package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs.map +1 -0
  51. package/package.json +13 -13
  52. package/dist/init-Bco4QkKJ-DqUZVrBU.mjs.map +0 -1
  53. package/dist/migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs.map +0 -1
  54. package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +0 -1
  55. package/dist/schemas-BMkqaqvM-CLaqlat4.mjs.map +0 -1
  56. package/dist/schemas-Bm2e3Hk1-qLKF0B36.d.mts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { t as createMigrateCommand } from "./migrate-CgSnzAUm-aGstaO5N.mjs";
1
+ import { t as createMigrateCommand } from "./migrate-BVEyoBor-CN_EOCzx.mjs";
2
2
  export { createMigrateCommand };
@@ -1,4 +1,4 @@
1
- import { f as migrationCheckResultSchema, n as MigrationCheckResult, t as CheckFailure } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
1
+ import { f as migrationCheckResultSchema, n as MigrationCheckResult, t as CheckFailure } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
2
2
  import { Command } from "commander";
3
3
  //#region ../../../1-framework/3-tooling/cli/dist/commands/migration-check.d.mts
4
4
  //#region src/commands/migration-check.d.ts
@@ -1,3 +1,3 @@
1
- import { t as migrationCheckResultSchema } from "./schemas-BMkqaqvM-CLaqlat4.mjs";
1
+ import { t as migrationCheckResultSchema } from "./schemas-CYSD83Cu-Bff4PPoi.mjs";
2
2
  import { t as createMigrationCheckCommand } from "./migration-check-BVK9vfan-Dfg8lbeB.mjs";
3
3
  export { createMigrationCheckCommand, migrationCheckResultSchema };
@@ -1,6 +1,6 @@
1
1
  import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
2
2
  import { t as CliStructuredError$2 } from "./cli-errors-BiKBrOXc-JPxQqO58.mjs";
3
- import { o as MigrationSpaceGraphEntry } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
3
+ import { o as MigrationSpaceGraphEntry } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
4
4
  import { n as TerminalUI } from "./terminal-ui-BN4QOsm5-Bf3pim46.mjs";
5
5
  import { n as GlobalFlags, t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
6
6
  import { Result } from "@prisma/orm-framework/utils/result";
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationGraphCommand, r as formatMigrationGraphHumanOutput, t as createMigrationGraphCommand } from "./migration-graph-D2dbLCkl-CCHL0aDA.mjs";
1
+ import { n as executeMigrationGraphCommand, r as formatMigrationGraphHumanOutput, t as createMigrationGraphCommand } from "./migration-graph-D4sgTiXa-BLtiLIk7.mjs";
2
2
  export { createMigrationGraphCommand, executeMigrationGraphCommand, formatMigrationGraphHumanOutput };
@@ -1,7 +1,7 @@
1
1
  import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
2
2
  import { t as CliStructuredError$2 } from "./cli-errors-BiKBrOXc-JPxQqO58.mjs";
3
3
  import { c as ContractSpaceAggregate } from "./aggregate-CA6bJ8UO.mjs";
4
- import { r as MigrationListResult } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
4
+ import { r as MigrationListResult } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
5
5
  import { n as TerminalUI, t as GlyphMode } from "./terminal-ui-BN4QOsm5-Bf3pim46.mjs";
6
6
  import { n as GlobalFlags, t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
7
7
  import { Result } from "@prisma/orm-framework/utils/result";
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationListCommand, r as renderMigrationListHumanOutput, t as createMigrationListCommand } from "./migration-list-DCx0KOFp-B3MiGnpa.mjs";
1
+ import { n as executeMigrationListCommand, r as renderMigrationListHumanOutput, t as createMigrationListCommand } from "./migration-list-BIL-re1m-CZY4m3d0.mjs";
2
2
  export { createMigrationListCommand, executeMigrationListCommand, renderMigrationListHumanOutput };
@@ -1,5 +1,5 @@
1
1
  import { t as CliStructuredError$2 } from "./cli-errors-BiKBrOXc-JPxQqO58.mjs";
2
- import { i as MigrationLogResult } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
2
+ import { i as MigrationLogResult } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
3
3
  import { n as TerminalUI } from "./terminal-ui-BN4QOsm5-Bf3pim46.mjs";
4
4
  import { n as GlobalFlags, t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
5
5
  import { Result } from "@prisma/orm-framework/utils/result";
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "./migration-log-CJ6_9_uj-uWyc3vlC.mjs";
1
+ import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "./migration-log-BdBKYAUW-DTPxKZtD.mjs";
2
2
  export { createMigrationLogCommand, executeMigrationLogCommand };
@@ -1,4 +1,4 @@
1
- import { a as MigrationShowResult } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
1
+ import { a as MigrationShowResult } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
2
2
  import { Command } from "commander";
3
3
  //#region ../../../1-framework/3-tooling/cli/dist/commands/migration-show.d.mts
4
4
  //#region src/commands/migration-show.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as CliStructuredError$2 } from "./cli-errors-BiKBrOXc-JPxQqO58.mjs";
2
- import { c as MigrationStatusEntry, d as StatusDiagnosticJson, l as MigrationStatusResult, p as migrationStatusJsonResultSchema, u as MigrationStatusSpace } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
2
+ import { c as MigrationStatusEntry, d as StatusDiagnosticJson, l as MigrationStatusResult, p as migrationStatusJsonResultSchema, u as MigrationStatusSpace } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
3
3
  import { n as TerminalUI } from "./terminal-ui-BN4QOsm5-Bf3pim46.mjs";
4
4
  import { n as GlobalFlags, t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
5
5
  import { Result } from "@prisma/orm-framework/utils/result";
@@ -1,3 +1,3 @@
1
- import { n as migrationStatusJsonResultSchema } from "./schemas-BMkqaqvM-CLaqlat4.mjs";
2
- import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "./migration-status-S88DjM8c-DLHnCKfW.mjs";
1
+ import { n as migrationStatusJsonResultSchema } from "./schemas-CYSD83Cu-Bff4PPoi.mjs";
2
+ import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "./migration-status-DzPVkkB3-BA7jjITd.mjs";
3
3
  export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, executeMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary, migrationStatusJsonResultSchema };
@@ -5,7 +5,7 @@ import { A as OnControlProgress, C as EmitResult, D as IntrospectOptions, E as E
5
5
  import { n as OnDiskMigrationPackage } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
6
6
  import { c as ContractSpaceAggregate, d as IntegrityQueryOptions, p as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-CA6bJ8UO.mjs";
7
7
  import { i as executeMigrateShowPlan, n as MigrateShowMigration, r as MigrateShowPlanSuccess, t as ExecuteMigrateShowPlanOptions } from "./migrate-show-Dlo-YzOk-BXo-DmwI.mjs";
8
- import { n as MigrationCheckResult, o as MigrationSpaceGraphEntry, r as MigrationListResult, s as MigrationSpaceListEntry } from "./schemas-Bm2e3Hk1-qLKF0B36.mjs";
8
+ import { n as MigrationCheckResult, o as MigrationSpaceGraphEntry, r as MigrationListResult, s as MigrationSpaceListEntry } from "./schemas-BGgjiKV0-Rh8RlMCl.mjs";
9
9
  import { t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
10
10
  import "./package-N9PPdFV_.mjs";
11
11
  import { a as executeMigrationPlanCommand, i as MigrationPlanResult, n as ContractSpaceSeedPhaseRecord, o as runContractSpaceSeedPhase, r as ContractSpaceSeedPhaseResult, t as ContractSpaceSeedPhaseInputs } from "./migration-plan-CharRhoN-BIB3WL65.mjs";
@@ -11,9 +11,9 @@ import { t as executeMigrateShowPlan } from "./migrate-show-kVUG1xdo-bVTW8tu4.mj
11
11
  import { n as resolveMigrationRef, t as resolveContractRef } from "./ref-resolution-DAK4OK3x-B-8ZZc0f.mjs";
12
12
  import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList, t as listRefsByContractHash } from "./migration-list-BQTfSGbT-DoNqbNsu.mjs";
13
13
  import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-B30X5398-BH3zB9Mn.mjs";
14
- import { n as executeRefListCommand, r as executeRefSetCommand, t as executeRefDeleteCommand } from "./ref-C8oaaeky-ColNkWpr.mjs";
15
14
  import { t as executeMigrationNewCommand } from "./migration-new-Bp5dPKnF-D-Fb6vEp.mjs";
16
15
  import { i as runContractSpaceSeedPhase, n as resolveFromForPlan, r as resolveToForPlan, t as executeMigrationPlanCommand } from "./migration-plan-C6KrFHJT-CRkTsE7L.mjs";
17
16
  import { a as statusForMigrationHash, i as readMigrationRefs, n as deriveStatusEdgeAnnotations, r as originHashForStatus, t as appliedHashesFromLedger } from "./refs-fQLFcMoq-aTBeUU9H.mjs";
17
+ import { n as executeRefListCommand, r as executeRefSetCommand, t as executeRefDeleteCommand } from "./ref-C8oaaeky-ColNkWpr.mjs";
18
18
  import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-CBMoMDX2-DhSEOGNg.mjs";
19
19
  export { advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSpaceAggregateForCli, mapCaughtMigrationError, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, originHashForStatus, readContractIR, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveRefAdvancementFields, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
@@ -23,7 +23,7 @@ declare const InitOutputSchema: import("arktype/internal/variants/object.ts").Ob
23
23
  filesWritten: string[];
24
24
  filesDeleted: string[];
25
25
  packagesInstalled: {
26
- skipped: boolean;
26
+ status: "installed" | "skipped" | "failed";
27
27
  deps: string[];
28
28
  devDeps: string[];
29
29
  };
@@ -1,2 +1,2 @@
1
- import { t as InitOutputSchema } from "./output-DWNYqZGc-D2sRgLAm.mjs";
1
+ import { t as InitOutputSchema } from "./output-DP3woAjV-BxCr9nHA.mjs";
2
2
  export { InitOutputSchema };
@@ -0,0 +1,295 @@
1
+ import { i as createScaffoldSpecifierResolver } from "./import-roots-NDOIEDVj.mjs";
2
+ import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
3
+ import { DEFAULT_CONTRACT_SOURCE_DIR } from "@prisma/orm-framework/config/config-types";
4
+ //#region ../../../1-framework/3-tooling/cli/dist/code-templates-CSLH8721.mjs
5
+ var version = "8.0.0-rc.1-dev.39";
6
+ /**
7
+ * The resolver a scaffold for `target` is written against.
8
+ *
9
+ * A scaffold is always on the facade root: `init` writes an application around
10
+ * one database package, and the workspace names are not published, so a project
11
+ * scaffolded against them could not install (ADR 242). Both the files `init`
12
+ * writes and the dependency it adds go through this, so they cannot disagree.
13
+ */
14
+ function scaffoldSpecifierResolverFor(target) {
15
+ return createScaffoldSpecifierResolver({
16
+ mode: "facade",
17
+ facade: target === "postgres" ? "@prisma/orm-postgres" : "@prisma/orm-mongo"
18
+ });
19
+ }
20
+ /**
21
+ * The package name a scaffolded project depends on and imports from, for the
22
+ * import root it is being scaffolded against.
23
+ *
24
+ * Every specifier the scaffold writes derives from this one, and `init` builds
25
+ * a single resolver and hands it to both the file templates and the dependency
26
+ * it installs — so the two cannot disagree. The one caller that deliberately
27
+ * does not thread a resolver is the re-init cleanup in `inputs.ts`, which
28
+ * inspects a manifest an earlier run wrote rather than writing one.
29
+ *
30
+ * Resolvers for scaffolding should come from `createScaffoldSpecifierResolver`
31
+ * in the publish-surface package, which rejects the roots a facade-shaped
32
+ * scaffold cannot express. (Named without its scope on purpose: JSDoc survives
33
+ * into the published bundle, where an internal package name would trip the
34
+ * shell tarball checks.)
35
+ */
36
+ function targetPackageName(target, resolveImportSpecifier = keepInternalSpecifiers) {
37
+ return resolveImportSpecifier(target === "postgres" ? "@internal/postgres" : "@internal/mongo");
38
+ }
39
+ /** One entrypoint of the scaffolded project's target package. */
40
+ function targetEntrypoint(target, subpath, resolveImportSpecifier = keepInternalSpecifiers) {
41
+ return resolveImportSpecifier(`${target === "postgres" ? "@internal/postgres" : "@internal/mongo"}/${subpath}`);
42
+ }
43
+ function targetLabel(target) {
44
+ return target === "postgres" ? "PostgreSQL" : "MongoDB";
45
+ }
46
+ function defaultSchemaPath(authoring) {
47
+ if (authoring === "typescript") return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.ts`;
48
+ return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.prisma`;
49
+ }
50
+ function starterSchema(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {
51
+ if (authoring === "typescript") {
52
+ const builder = targetEntrypoint(target, "contract-builder", resolveImportSpecifier);
53
+ return target === "mongo" ? starterSchemaTsMongo(builder) : starterSchemaTsPostgres(builder);
54
+ }
55
+ return target === "mongo" ? starterSchemaPslMongo() : starterSchemaPslPostgres();
56
+ }
57
+ /**
58
+ * Renders a short authoring-appropriate schema sample (FR5.1) for embedding
59
+ * in `prisma-next.md`. Returns a complete fenced markdown code block.
60
+ *
61
+ * The sample intentionally shows just one model: it's illustrative, not
62
+ * a substitute for the full scaffolded contract file. The TS samples use
63
+ * the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading
64
+ * the doc and the file side-by-side sees the same structure.
65
+ */
66
+ function schemaSample(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {
67
+ if (authoring === "typescript") {
68
+ const builder = targetEntrypoint(target, "contract-builder", resolveImportSpecifier);
69
+ return target === "mongo" ? schemaSampleTsMongo(builder) : schemaSampleTsPostgres(builder);
70
+ }
71
+ return target === "mongo" ? schemaSamplePslMongo() : schemaSamplePslPostgres();
72
+ }
73
+ function schemaSamplePslPostgres() {
74
+ return `\`\`\`prisma
75
+ model User {
76
+ id Int @id @default(autoincrement())
77
+ email String @unique
78
+ username String?
79
+ name String?
80
+ }
81
+ \`\`\``;
82
+ }
83
+ function schemaSamplePslMongo() {
84
+ return `\`\`\`prisma
85
+ model User {
86
+ id ObjectId @id @map("_id")
87
+ email String @unique
88
+ username String?
89
+ name String?
90
+ @@map("users")
91
+ }
92
+ \`\`\``;
93
+ }
94
+ function schemaSampleTsPostgres(builder) {
95
+ return `\`\`\`typescript
96
+ import { defineContract } from '${builder}';
97
+
98
+ export const contract = defineContract(
99
+ {},
100
+ ({ field, model }) => ({
101
+ models: {
102
+ User: model('User', {
103
+ fields: {
104
+ id: field.id.uuidv7String(),
105
+ email: field.text().unique(),
106
+ username: field.text().optional(),
107
+ name: field.text().optional(),
108
+ },
109
+ }),
110
+ },
111
+ }),
112
+ );
113
+ \`\`\``;
114
+ }
115
+ function schemaSampleTsMongo(builder) {
116
+ return `\`\`\`typescript
117
+ import { defineContract } from '${builder}';
118
+
119
+ export const contract = defineContract(
120
+ {},
121
+ ({ field, model }) => ({
122
+ models: {
123
+ User: model('User', {
124
+ collection: 'users',
125
+ fields: {
126
+ _id: field.objectId(),
127
+ email: field.string(),
128
+ username: field.string().optional(),
129
+ name: field.string().optional(),
130
+ },
131
+ }),
132
+ },
133
+ }),
134
+ );
135
+ \`\`\``;
136
+ }
137
+ function starterSchemaPslPostgres() {
138
+ return `// use prisma-next
139
+
140
+ model User {
141
+ id Int @id @default(autoincrement())
142
+ email String @unique
143
+ username String?
144
+ name String?
145
+ posts Post[]
146
+ createdAt DateTime @default(now())
147
+ updatedAt temporal.updatedAt()
148
+ }
149
+
150
+ model Post {
151
+ id Int @id @default(autoincrement())
152
+ title String
153
+ content String?
154
+ author User @relation(fields: [authorId], references: [id])
155
+ authorId Int
156
+ createdAt DateTime @default(now())
157
+ updatedAt temporal.updatedAt()
158
+ }
159
+ `;
160
+ }
161
+ function starterSchemaPslMongo() {
162
+ return `// use prisma-next
163
+
164
+ model User {
165
+ id ObjectId @id @map("_id")
166
+ email String @unique
167
+ username String?
168
+ name String?
169
+ posts Post[]
170
+ @@map("users")
171
+ }
172
+
173
+ model Post {
174
+ id ObjectId @id @map("_id")
175
+ title String
176
+ content String?
177
+ author User @relation(fields: [authorId], references: [id])
178
+ authorId ObjectId
179
+ @@map("posts")
180
+ }
181
+ `;
182
+ }
183
+ function starterSchemaTsPostgres(builder) {
184
+ return `import { defineContract } from '${builder}';
185
+
186
+ export const contract = defineContract(
187
+ {},
188
+ ({ field, model, rel }) => ({
189
+ models: {
190
+ User: model('User', {
191
+ fields: {
192
+ id: field.id.uuidv7String(),
193
+ email: field.text().unique(),
194
+ username: field.text().optional(),
195
+ name: field.text().optional(),
196
+ createdAt: field.temporal.createdAt(),
197
+ updatedAt: field.temporal.updatedAt(),
198
+ },
199
+ relations: {
200
+ posts: rel.hasMany('Post', { by: 'authorId' }),
201
+ },
202
+ }),
203
+
204
+ Post: model('Post', {
205
+ fields: {
206
+ id: field.id.uuidv7String(),
207
+ title: field.text(),
208
+ content: field.text().optional(),
209
+ authorId: field.uuidString(),
210
+ createdAt: field.temporal.createdAt(),
211
+ updatedAt: field.temporal.updatedAt(),
212
+ },
213
+ relations: {
214
+ author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),
215
+ },
216
+ }),
217
+ },
218
+ }),
219
+ );
220
+ `;
221
+ }
222
+ function starterSchemaTsMongo(builder) {
223
+ return `import { defineContract } from '${builder}';
224
+
225
+ export const contract = defineContract(
226
+ {},
227
+ ({ field, model, rel }) => ({
228
+ models: {
229
+ User: model('User', {
230
+ collection: 'users',
231
+ fields: {
232
+ _id: field.objectId(),
233
+ email: field.string(),
234
+ username: field.string().optional(),
235
+ name: field.string().optional(),
236
+ },
237
+ relations: {
238
+ posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),
239
+ },
240
+ }),
241
+
242
+ Post: model('Post', {
243
+ collection: 'posts',
244
+ fields: {
245
+ _id: field.objectId(),
246
+ title: field.string(),
247
+ content: field.string().optional(),
248
+ authorId: field.objectId(),
249
+ },
250
+ relations: {
251
+ author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),
252
+ },
253
+ }),
254
+ },
255
+ }),
256
+ );
257
+ `;
258
+ }
259
+ function configFile(target, contractPath, resolveImportSpecifier = keepInternalSpecifiers) {
260
+ return `import 'dotenv/config';
261
+ import { defineConfig } from '${targetEntrypoint(target, "config", resolveImportSpecifier)}';
262
+
263
+ export default defineConfig({
264
+ contract: ${JSON.stringify(contractPath)},
265
+ db: {
266
+ connection: process.env['DATABASE_URL']!,
267
+ },
268
+ });
269
+ `;
270
+ }
271
+ function dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {
272
+ const runtime = targetEntrypoint(target, "runtime", resolveImportSpecifier);
273
+ if (target === "postgres") return `import postgres from '${runtime}';
274
+ import type { Contract } from './contract.d';
275
+ import contractJson from './contract.json' with { type: 'json' };
276
+
277
+ export const db = postgres<Contract>({
278
+ contractJson,
279
+ url: process.env['DATABASE_URL']!,
280
+ });
281
+ `;
282
+ return `import mongo from '${runtime}';
283
+ import type { Contract } from './contract.d';
284
+ import contractJson from './contract.json' with { type: 'json' };
285
+
286
+ export const db = mongo<Contract>({
287
+ contractJson,
288
+ url: process.env['DATABASE_URL']!,
289
+ });
290
+ `;
291
+ }
292
+ //#endregion
293
+ export { schemaSample as a, targetLabel as c, scaffoldSpecifierResolverFor as i, targetPackageName as l, dbFile as n, starterSchema as o, defaultSchemaPath as r, targetEntrypoint as s, configFile as t, version as u };
294
+
295
+ //# sourceMappingURL=code-templates-CSLH8721-CWRA4Lru.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-templates-CSLH8721-CWRA4Lru.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/code-templates-CSLH8721.mjs"],"sourcesContent":["import { createScaffoldSpecifierResolver } from \"@internal/publish-surface/import-roots\";\nimport { DEFAULT_CONTRACT_SOURCE_DIR } from \"@internal/config/config-types\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\n//#region package.json\nvar version = \"8.0.0-rc.1-dev.39\";\n//#endregion\n//#region src/commands/init/templates/code-templates.ts\n/**\n* The resolver a scaffold for `target` is written against.\n*\n* A scaffold is always on the facade root: `init` writes an application around\n* one database package, and the workspace names are not published, so a project\n* scaffolded against them could not install (ADR 242). Both the files `init`\n* writes and the dependency it adds go through this, so they cannot disagree.\n*/\nfunction scaffoldSpecifierResolverFor(target) {\n\treturn createScaffoldSpecifierResolver({\n\t\tmode: \"facade\",\n\t\tfacade: target === \"postgres\" ? \"@prisma/orm-postgres\" : \"@prisma/orm-mongo\"\n\t});\n}\n/**\n* The package name a scaffolded project depends on and imports from, for the\n* import root it is being scaffolded against.\n*\n* Every specifier the scaffold writes derives from this one, and `init` builds\n* a single resolver and hands it to both the file templates and the dependency\n* it installs — so the two cannot disagree. The one caller that deliberately\n* does not thread a resolver is the re-init cleanup in `inputs.ts`, which\n* inspects a manifest an earlier run wrote rather than writing one.\n*\n* Resolvers for scaffolding should come from `createScaffoldSpecifierResolver`\n* in the publish-surface package, which rejects the roots a facade-shaped\n* scaffold cannot express. (Named without its scope on purpose: JSDoc survives\n* into the published bundle, where an internal package name would trip the\n* shell tarball checks.)\n*/\nfunction targetPackageName(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\");\n}\n/** One entrypoint of the scaffolded project's target package. */\nfunction targetEntrypoint(target, subpath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn resolveImportSpecifier(`${target === \"postgres\" ? \"@internal/postgres\" : \"@internal/mongo\"}/${subpath}`);\n}\nfunction targetLabel(target) {\n\treturn target === \"postgres\" ? \"PostgreSQL\" : \"MongoDB\";\n}\nfunction defaultSchemaPath(authoring) {\n\tif (authoring === \"typescript\") return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.ts`;\n\treturn `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.prisma`;\n}\nfunction starterSchema(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? starterSchemaTsMongo(builder) : starterSchemaTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? starterSchemaPslMongo() : starterSchemaPslPostgres();\n}\n/**\n* Renders a short authoring-appropriate schema sample (FR5.1) for embedding\n* in `prisma-next.md`. Returns a complete fenced markdown code block.\n*\n* The sample intentionally shows just one model: it's illustrative, not\n* a substitute for the full scaffolded contract file. The TS samples use\n* the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading\n* the doc and the file side-by-side sees the same structure.\n*/\nfunction schemaSample(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {\n\tif (authoring === \"typescript\") {\n\t\tconst builder = targetEntrypoint(target, \"contract-builder\", resolveImportSpecifier);\n\t\treturn target === \"mongo\" ? schemaSampleTsMongo(builder) : schemaSampleTsPostgres(builder);\n\t}\n\treturn target === \"mongo\" ? schemaSamplePslMongo() : schemaSamplePslPostgres();\n}\nfunction schemaSamplePslPostgres() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n}\n\\`\\`\\``;\n}\nfunction schemaSamplePslMongo() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n @@map(\"users\")\n}\n\\`\\`\\``;\n}\nfunction schemaSampleTsPostgres(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction schemaSampleTsMongo(builder) {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction starterSchemaPslPostgres() {\n\treturn `// use prisma-next\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n posts Post[]\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId Int\n createdAt DateTime @default(now())\n updatedAt temporal.updatedAt()\n}\n`;\n}\nfunction starterSchemaPslMongo() {\n\treturn `// use prisma-next\n\nmodel User {\n id ObjectId @id @map(\"_id\")\n email String @unique\n username String?\n name String?\n posts Post[]\n @@map(\"users\")\n}\n\nmodel Post {\n id ObjectId @id @map(\"_id\")\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId ObjectId\n @@map(\"posts\")\n}\n`;\n}\nfunction starterSchemaTsPostgres(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.id.uuidv7String(),\n email: field.text().unique(),\n username: field.text().optional(),\n name: field.text().optional(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n posts: rel.hasMany('Post', { by: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n fields: {\n id: field.id.uuidv7String(),\n title: field.text(),\n content: field.text().optional(),\n authorId: field.uuidString(),\n createdAt: field.temporal.createdAt(),\n updatedAt: field.temporal.updatedAt(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction starterSchemaTsMongo(builder) {\n\treturn `import { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, rel }) => ({\n models: {\n User: model('User', {\n collection: 'users',\n fields: {\n _id: field.objectId(),\n email: field.string(),\n username: field.string().optional(),\n name: field.string().optional(),\n },\n relations: {\n posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),\n },\n }),\n\n Post: model('Post', {\n collection: 'posts',\n fields: {\n _id: field.objectId(),\n title: field.string(),\n content: field.string().optional(),\n authorId: field.objectId(),\n },\n relations: {\n author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),\n },\n }),\n },\n }),\n);\n`;\n}\nfunction configFile(target, contractPath, resolveImportSpecifier = keepInternalSpecifiers) {\n\treturn `import 'dotenv/config';\nimport { defineConfig } from '${targetEntrypoint(target, \"config\", resolveImportSpecifier)}';\n\nexport default defineConfig({\n contract: ${JSON.stringify(contractPath)},\n db: {\n connection: process.env['DATABASE_URL']!,\n },\n});\n`;\n}\nfunction dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst runtime = targetEntrypoint(target, \"runtime\", resolveImportSpecifier);\n\tif (target === \"postgres\") return `import postgres from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = postgres<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n\treturn `import mongo from '${runtime}';\nimport type { Contract } from './contract.d';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const db = mongo<Contract>({\n contractJson,\n url: process.env['DATABASE_URL']!,\n});\n`;\n}\n//#endregion\nexport { schemaSample as a, targetLabel as c, scaffoldSpecifierResolverFor as i, targetPackageName as l, dbFile as n, starterSchema as o, defaultSchemaPath as r, targetEntrypoint as s, configFile as t, version as u };\n\n//# sourceMappingURL=code-templates-CSLH8721.mjs.map"],"mappings":";;;;AAIA,IAAI,UAAU;;;;;;;;;AAWd,SAAS,6BAA6B,QAAQ;CAC7C,OAAO,gCAAgC;EACtC,MAAM;EACN,QAAQ,WAAW,aAAa,yBAAyB;CAC1D,CAAC;AACF;;;;;;;;;;;;;;;;;AAiBA,SAAS,kBAAkB,QAAQ,yBAAyB,wBAAwB;CACnF,OAAO,uBAAuB,WAAW,aAAa,uBAAuB,iBAAiB;AAC/F;;AAEA,SAAS,iBAAiB,QAAQ,SAAS,yBAAyB,wBAAwB;CAC3F,OAAO,uBAAuB,GAAG,WAAW,aAAa,uBAAuB,kBAAkB,GAAG,SAAS;AAC/G;AACA,SAAS,YAAY,QAAQ;CAC5B,OAAO,WAAW,aAAa,eAAe;AAC/C;AACA,SAAS,kBAAkB,WAAW;CACrC,IAAI,cAAc,cAAc,OAAO,GAAG,4BAA4B;CACtE,OAAO,GAAG,4BAA4B;AACvC;AACA,SAAS,cAAc,QAAQ,WAAW,yBAAyB,wBAAwB;CAC1F,IAAI,cAAc,cAAc;EAC/B,MAAM,UAAU,iBAAiB,QAAQ,oBAAoB,sBAAsB;EACnF,OAAO,WAAW,UAAU,qBAAqB,OAAO,IAAI,wBAAwB,OAAO;CAC5F;CACA,OAAO,WAAW,UAAU,sBAAsB,IAAI,yBAAyB;AAChF;;;;;;;;;;AAUA,SAAS,aAAa,QAAQ,WAAW,yBAAyB,wBAAwB;CACzF,IAAI,cAAc,cAAc;EAC/B,MAAM,UAAU,iBAAiB,QAAQ,oBAAoB,sBAAsB;EACnF,OAAO,WAAW,UAAU,oBAAoB,OAAO,IAAI,uBAAuB,OAAO;CAC1F;CACA,OAAO,WAAW,UAAU,qBAAqB,IAAI,wBAAwB;AAC9E;AACA,SAAS,0BAA0B;CAClC,OAAO;;;;;;;;AAQR;AACA,SAAS,uBAAuB;CAC/B,OAAO;;;;;;;;;AASR;AACA,SAAS,uBAAuB,SAAS;CACxC,OAAO;kCAC0B,QAAQ;;;;;;;;;;;;;;;;;;AAkB1C;AACA,SAAS,oBAAoB,SAAS;CACrC,OAAO;kCAC0B,QAAQ;;;;;;;;;;;;;;;;;;;AAmB1C;AACA,SAAS,2BAA2B;CACnC,OAAO;;;;;;;;;;;;;;;;;;;;;;AAsBR;AACA,SAAS,wBAAwB;CAChC,OAAO;;;;;;;;;;;;;;;;;;;;AAoBR;AACA,SAAS,wBAAwB,SAAS;CACzC,OAAO,mCAAmC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCnD;AACA,SAAS,qBAAqB,SAAS;CACtC,OAAO,mCAAmC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCnD;AACA,SAAS,WAAW,QAAQ,cAAc,yBAAyB,wBAAwB;CAC1F,OAAO;gCACwB,iBAAiB,QAAQ,UAAU,sBAAsB,EAAE;;;cAG7E,KAAK,UAAU,YAAY,EAAE;;;;;;AAM3C;AACA,SAAS,OAAO,QAAQ,yBAAyB,wBAAwB;CACxE,MAAM,UAAU,iBAAiB,QAAQ,WAAW,sBAAsB;CAC1E,IAAI,WAAW,YAAY,OAAO,yBAAyB,QAAQ;;;;;;;;;CASnE,OAAO,sBAAsB,QAAQ;;;;;;;;;AAStC"}