prisma-next 0.11.0 → 0.12.0-dev.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/dist/cli.mjs +259 -12
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-oXO2WCPD.mjs → client-KgJorIvG.mjs} +72 -60
- package/dist/client-KgJorIvG.mjs.map +1 -0
- package/dist/{command-helpers-BSb0tRC8.mjs → command-helpers-Bbw1GbwL.mjs} +646 -46
- package/dist/command-helpers-Bbw1GbwL.mjs.map +1 -0
- package/dist/commands/contract-emit.d.mts.map +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.d.mts.map +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +32 -7
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.d.mts.map +1 -1
- package/dist/commands/db-schema.mjs +3 -4
- package/dist/commands/db-schema.mjs.map +1 -1
- package/dist/commands/db-sign.d.mts.map +1 -1
- package/dist/commands/db-sign.mjs +12 -10
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +41 -11
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +6 -2
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +75 -40
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +4 -3
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +1 -280
- package/dist/commands/migration-graph.d.mts +13 -2
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +2 -137
- package/dist/commands/migration-list.d.mts +64 -4
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +143 -56
- package/dist/commands/migration-list.mjs.map +1 -1
- package/dist/commands/migration-log.d.mts +10 -1
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +10 -15
- package/dist/commands/migration-log.mjs.map +1 -1
- package/dist/commands/migration-new.d.mts.map +1 -1
- package/dist/commands/migration-new.mjs +32 -38
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts +3 -2
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +4 -55
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +61 -153
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +12 -49
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +85 -81
- package/dist/commands/migration-status.mjs.map +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.d.mts.map +1 -1
- package/dist/commands/ref.mjs +38 -10
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/config-loader-B6sJjXTv.mjs.map +1 -1
- package/dist/config-loader.d.mts.map +1 -1
- package/dist/contract-at-errors-BxP-TOMl.mjs +42 -0
- package/dist/contract-at-errors-BxP-TOMl.mjs.map +1 -0
- package/dist/{contract-emit-bcrpT-wD.mjs → contract-emit-D-4jrNve.mjs} +25 -10
- package/dist/contract-emit-D-4jrNve.mjs.map +1 -0
- package/dist/{contract-emit-r4y8Zhf1.mjs → contract-emit-DxcGl4Uq.mjs} +19 -14
- package/dist/contract-emit-DxcGl4Uq.mjs.map +1 -0
- package/dist/{contract-enrichment-Dani0mMW.mjs → contract-enrichment-a0V5Y_mL.mjs} +4 -25
- package/dist/contract-enrichment-a0V5Y_mL.mjs.map +1 -0
- package/dist/{contract-infer-BmySmqVT.mjs → contract-infer-D8uEbJuu.mjs} +4 -5
- package/dist/{contract-infer-BmySmqVT.mjs.map → contract-infer-D8uEbJuu.mjs.map} +1 -1
- package/dist/contract-space-aggregate-loader-DvZwdkrr.mjs +247 -0
- package/dist/contract-space-aggregate-loader-DvZwdkrr.mjs.map +1 -0
- package/dist/{db-verify-BClPs3ph.mjs → db-verify-v_vUKXTU.mjs} +5 -7
- package/dist/{db-verify-BClPs3ph.mjs.map → db-verify-v_vUKXTU.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +3 -3
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +3 -3
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/init-output.d.mts.map +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/extension-pack-inputs-IDvjRCi3.mjs +62 -0
- package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +1 -0
- package/dist/{framework-components-65gOHkHB.mjs → framework-components-fYXjz_in.mjs} +2 -2
- package/dist/{framework-components-65gOHkHB.mjs.map → framework-components-fYXjz_in.mjs.map} +1 -1
- package/dist/global-flags-DEHjV8_s.d.mts +34 -0
- package/dist/global-flags-DEHjV8_s.d.mts.map +1 -0
- package/dist/{graph-render-DJVv0_uf.mjs → graph-render-rFAqZujX.mjs} +2 -2
- package/dist/{graph-render-DJVv0_uf.mjs.map → graph-render-rFAqZujX.mjs.map} +1 -1
- package/dist/{init-BCJZPWE1.mjs → init-Cv9UzWL5.mjs} +20 -269
- package/dist/init-Cv9UzWL5.mjs.map +1 -0
- package/dist/{inspect-live-schema-DSRbFoOL.mjs → inspect-live-schema-C6ohV_oQ.mjs} +4 -5
- package/dist/{inspect-live-schema-DSRbFoOL.mjs.map → inspect-live-schema-C6ohV_oQ.mjs.map} +1 -1
- package/dist/migration-check-BiBJoYYW.mjs +341 -0
- package/dist/migration-check-BiBJoYYW.mjs.map +1 -0
- package/dist/migration-cli.d.mts.map +1 -1
- package/dist/migration-cli.mjs +4 -4
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-Bzd9La5c.mjs → migration-command-scaffold-CjvwO6at.mjs} +4 -5
- package/dist/{migration-command-scaffold-Bzd9La5c.mjs.map → migration-command-scaffold-CjvwO6at.mjs.map} +1 -1
- package/dist/migration-graph-D7DVUElV.mjs +1232 -0
- package/dist/migration-graph-D7DVUElV.mjs.map +1 -0
- package/dist/migration-list-styler-BRwF4-gy.mjs +399 -0
- package/dist/migration-list-styler-BRwF4-gy.mjs.map +1 -0
- package/dist/{migration-plan-CFwqw3Gk.mjs → migration-plan-9DJ7q7_z.mjs} +372 -133
- package/dist/migration-plan-9DJ7q7_z.mjs.map +1 -0
- package/dist/{migration-types-BXWvz12q.d.mts → migration-types-D2FW63pr.d.mts} +1 -1
- package/dist/{migration-types-BXWvz12q.d.mts.map → migration-types-D2FW63pr.d.mts.map} +1 -1
- package/dist/{migrations-CwZMa1Ck.mjs → migrations-Cv2jxNNK.mjs} +12 -13
- package/dist/migrations-Cv2jxNNK.mjs.map +1 -0
- package/dist/{output-BlsrGMEF.mjs → output-B60Gw5fu.mjs} +1 -1
- package/dist/{output-BlsrGMEF.mjs.map → output-B60Gw5fu.mjs.map} +1 -1
- package/dist/{progress-adapter-DFfvZcYL.mjs → progress-adapter-C644QK8l.mjs} +1 -1
- package/dist/{progress-adapter-DFfvZcYL.mjs.map → progress-adapter-C644QK8l.mjs.map} +1 -1
- package/dist/ref-advancement-DUZqsue6.mjs +50 -0
- package/dist/ref-advancement-DUZqsue6.mjs.map +1 -0
- package/dist/terminal-ui-5Y6mrg93.d.mts +133 -0
- package/dist/terminal-ui-5Y6mrg93.d.mts.map +1 -0
- package/dist/{types--CqjMdk0.d.mts → types-Dt_SfqFm.d.mts} +28 -28
- package/dist/types-Dt_SfqFm.d.mts.map +1 -0
- package/dist/{verify-Bom75OYI.mjs → verify-DCA9Sldu.mjs} +2 -2
- package/dist/{verify-Bom75OYI.mjs.map → verify-DCA9Sldu.mjs.map} +1 -1
- package/package.json +28 -17
- package/dist/cli-errors-Czmx92Zy.d.mts +0 -3
- package/dist/cli-errors-Djtz98Vm.mjs +0 -71
- package/dist/cli-errors-Djtz98Vm.mjs.map +0 -1
- package/dist/client-oXO2WCPD.mjs.map +0 -1
- package/dist/command-helpers-BSb0tRC8.mjs.map +0 -1
- package/dist/commands/migration-check.mjs.map +0 -1
- package/dist/commands/migration-graph.mjs.map +0 -1
- package/dist/contract-emit-bcrpT-wD.mjs.map +0 -1
- package/dist/contract-emit-r4y8Zhf1.mjs.map +0 -1
- package/dist/contract-enrichment-Dani0mMW.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-BmNQwlws.mjs +0 -160
- package/dist/contract-space-aggregate-loader-BmNQwlws.mjs.map +0 -1
- package/dist/global-flags-CdE7M0d9.d.mts +0 -15
- package/dist/global-flags-CdE7M0d9.d.mts.map +0 -1
- package/dist/init-BCJZPWE1.mjs.map +0 -1
- package/dist/migration-plan-CFwqw3Gk.mjs.map +0 -1
- package/dist/migrations-CwZMa1Ck.mjs.map +0 -1
- package/dist/rolldown-runtime-twds-ZHy.mjs +0 -14
- package/dist/terminal-ui-BiB_8KNo.mjs +0 -379
- package/dist/terminal-ui-BiB_8KNo.mjs.map +0 -1
- package/dist/types--CqjMdk0.d.mts.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as
|
|
4
|
-
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-BlsrGMEF.mjs";
|
|
1
|
+
import { A as CliStructuredError, S as isCI, _ as createTerminalUI, b as formatErrorJson, x as formatErrorOutput } from "./command-helpers-Bbw1GbwL.mjs";
|
|
2
|
+
import { a as starterSchema, c as version, i as schemaSample, n as dbFile, o as targetLabel, r as defaultSchemaPath, s as targetPackageName, t as configFile } from "./cli.mjs";
|
|
3
|
+
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-B60Gw5fu.mjs";
|
|
5
4
|
import { createRequire } from "node:module";
|
|
6
5
|
import { basename, dirname, extname, isAbsolute, join, normalize } from "pathe";
|
|
7
6
|
import * as clack from "@clack/prompts";
|
|
@@ -442,7 +441,7 @@ function errorInitSkillInstallFailed(options) {
|
|
|
442
441
|
* `db/contract.json linguist-generated` — not the workspace-glob form
|
|
443
442
|
* `<glob>/contract.json` (which would over-match any unrelated
|
|
444
443
|
* `contract.json` the user has elsewhere) and not the absolute
|
|
445
|
-
* `
|
|
444
|
+
* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json` (which would silently break for a non-default
|
|
446
445
|
* schema path).
|
|
447
446
|
*/
|
|
448
447
|
const ARTEFACT_FILENAMES$1 = [
|
|
@@ -475,7 +474,7 @@ function requiredGitattributesLines(schemaDir, _target) {
|
|
|
475
474
|
*
|
|
476
475
|
* Equivalence is exact-line: a user-customised line like
|
|
477
476
|
* `prisma/*.json linguist-generated` is *not* recognised as covering
|
|
478
|
-
* `
|
|
477
|
+
* `DEFAULT_CONTRACT_SOURCE_DIR/contract.json linguist-generated`. We accept that
|
|
479
478
|
* over-specification — preserving the user's broad pattern *and*
|
|
480
479
|
* appending the narrow one — because the narrow lines are what the
|
|
481
480
|
* acceptance criteria pin (FR3.4 AC).
|
|
@@ -635,253 +634,6 @@ function ensureEsmModuleType(existing) {
|
|
|
635
634
|
};
|
|
636
635
|
}
|
|
637
636
|
//#endregion
|
|
638
|
-
//#region src/commands/init/templates/code-templates.ts
|
|
639
|
-
function targetPackageName(target) {
|
|
640
|
-
return target === "postgres" ? "@prisma-next/postgres" : "@prisma-next/mongo";
|
|
641
|
-
}
|
|
642
|
-
function targetLabel(target) {
|
|
643
|
-
return target === "postgres" ? "PostgreSQL" : "MongoDB";
|
|
644
|
-
}
|
|
645
|
-
function defaultSchemaPath(authoring) {
|
|
646
|
-
if (authoring === "typescript") return "prisma/contract.ts";
|
|
647
|
-
return "prisma/contract.prisma";
|
|
648
|
-
}
|
|
649
|
-
function starterSchema(target, authoring) {
|
|
650
|
-
if (authoring === "typescript") return target === "mongo" ? starterSchemaTsMongo() : starterSchemaTsPostgres();
|
|
651
|
-
return target === "mongo" ? starterSchemaPslMongo() : starterSchemaPslPostgres();
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Renders a short authoring-appropriate schema sample (FR5.1) for embedding
|
|
655
|
-
* in `prisma-next.md`. Returns a complete fenced markdown code block.
|
|
656
|
-
*
|
|
657
|
-
* The sample intentionally shows just one model: it's illustrative, not
|
|
658
|
-
* a substitute for the full scaffolded contract file. The TS samples use
|
|
659
|
-
* the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading
|
|
660
|
-
* the doc and the file side-by-side sees the same structure.
|
|
661
|
-
*/
|
|
662
|
-
function schemaSample(target, authoring) {
|
|
663
|
-
if (authoring === "typescript") return target === "mongo" ? schemaSampleTsMongo() : schemaSampleTsPostgres();
|
|
664
|
-
return target === "mongo" ? schemaSamplePslMongo() : schemaSamplePslPostgres();
|
|
665
|
-
}
|
|
666
|
-
function schemaSamplePslPostgres() {
|
|
667
|
-
return `\`\`\`prisma
|
|
668
|
-
model User {
|
|
669
|
-
id Int @id @default(autoincrement())
|
|
670
|
-
email String @unique
|
|
671
|
-
username String?
|
|
672
|
-
name String?
|
|
673
|
-
}
|
|
674
|
-
\`\`\``;
|
|
675
|
-
}
|
|
676
|
-
function schemaSamplePslMongo() {
|
|
677
|
-
return `\`\`\`prisma
|
|
678
|
-
model User {
|
|
679
|
-
id ObjectId @id @map("_id")
|
|
680
|
-
email String @unique
|
|
681
|
-
username String?
|
|
682
|
-
name String?
|
|
683
|
-
@@map("users")
|
|
684
|
-
}
|
|
685
|
-
\`\`\``;
|
|
686
|
-
}
|
|
687
|
-
function schemaSampleTsPostgres() {
|
|
688
|
-
return `\`\`\`typescript
|
|
689
|
-
import { defineContract } from '@prisma-next/postgres/contract-builder';
|
|
690
|
-
|
|
691
|
-
export const contract = defineContract(
|
|
692
|
-
{},
|
|
693
|
-
({ field, model }) => ({
|
|
694
|
-
models: {
|
|
695
|
-
User: model('User', {
|
|
696
|
-
fields: {
|
|
697
|
-
id: field.id.uuidv7(),
|
|
698
|
-
email: field.text().unique(),
|
|
699
|
-
username: field.text().optional(),
|
|
700
|
-
name: field.text().optional(),
|
|
701
|
-
},
|
|
702
|
-
}),
|
|
703
|
-
},
|
|
704
|
-
}),
|
|
705
|
-
);
|
|
706
|
-
\`\`\``;
|
|
707
|
-
}
|
|
708
|
-
function schemaSampleTsMongo() {
|
|
709
|
-
return `\`\`\`typescript
|
|
710
|
-
import { defineContract } from '@prisma-next/mongo/contract-builder';
|
|
711
|
-
|
|
712
|
-
export const contract = defineContract(
|
|
713
|
-
{},
|
|
714
|
-
({ field, model }) => ({
|
|
715
|
-
models: {
|
|
716
|
-
User: model('User', {
|
|
717
|
-
collection: 'users',
|
|
718
|
-
fields: {
|
|
719
|
-
_id: field.objectId(),
|
|
720
|
-
email: field.string(),
|
|
721
|
-
username: field.string().optional(),
|
|
722
|
-
name: field.string().optional(),
|
|
723
|
-
},
|
|
724
|
-
}),
|
|
725
|
-
},
|
|
726
|
-
}),
|
|
727
|
-
);
|
|
728
|
-
\`\`\``;
|
|
729
|
-
}
|
|
730
|
-
function starterSchemaPslPostgres() {
|
|
731
|
-
return `// use prisma-next
|
|
732
|
-
|
|
733
|
-
model User {
|
|
734
|
-
id Int @id @default(autoincrement())
|
|
735
|
-
email String @unique
|
|
736
|
-
username String?
|
|
737
|
-
name String?
|
|
738
|
-
posts Post[]
|
|
739
|
-
createdAt DateTime @default(now())
|
|
740
|
-
updatedAt temporal.updatedAt()
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
model Post {
|
|
744
|
-
id Int @id @default(autoincrement())
|
|
745
|
-
title String
|
|
746
|
-
content String?
|
|
747
|
-
author User @relation(fields: [authorId], references: [id])
|
|
748
|
-
authorId Int
|
|
749
|
-
createdAt DateTime @default(now())
|
|
750
|
-
updatedAt temporal.updatedAt()
|
|
751
|
-
}
|
|
752
|
-
`;
|
|
753
|
-
}
|
|
754
|
-
function starterSchemaPslMongo() {
|
|
755
|
-
return `// use prisma-next
|
|
756
|
-
|
|
757
|
-
model User {
|
|
758
|
-
id ObjectId @id @map("_id")
|
|
759
|
-
email String @unique
|
|
760
|
-
username String?
|
|
761
|
-
name String?
|
|
762
|
-
posts Post[]
|
|
763
|
-
@@map("users")
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
model Post {
|
|
767
|
-
id ObjectId @id @map("_id")
|
|
768
|
-
title String
|
|
769
|
-
content String?
|
|
770
|
-
author User @relation(fields: [authorId], references: [id])
|
|
771
|
-
authorId ObjectId
|
|
772
|
-
@@map("posts")
|
|
773
|
-
}
|
|
774
|
-
`;
|
|
775
|
-
}
|
|
776
|
-
function starterSchemaTsPostgres() {
|
|
777
|
-
return `import { defineContract } from '@prisma-next/postgres/contract-builder';
|
|
778
|
-
|
|
779
|
-
export const contract = defineContract(
|
|
780
|
-
{},
|
|
781
|
-
({ field, model, rel }) => ({
|
|
782
|
-
models: {
|
|
783
|
-
User: model('User', {
|
|
784
|
-
fields: {
|
|
785
|
-
id: field.id.uuidv7(),
|
|
786
|
-
email: field.text().unique(),
|
|
787
|
-
username: field.text().optional(),
|
|
788
|
-
name: field.text().optional(),
|
|
789
|
-
createdAt: field.temporal.createdAt(),
|
|
790
|
-
updatedAt: field.temporal.updatedAt(),
|
|
791
|
-
},
|
|
792
|
-
relations: {
|
|
793
|
-
posts: rel.hasMany('Post', { by: 'authorId' }),
|
|
794
|
-
},
|
|
795
|
-
}),
|
|
796
|
-
|
|
797
|
-
Post: model('Post', {
|
|
798
|
-
fields: {
|
|
799
|
-
id: field.id.uuidv7(),
|
|
800
|
-
title: field.text(),
|
|
801
|
-
content: field.text().optional(),
|
|
802
|
-
authorId: field.uuid(),
|
|
803
|
-
createdAt: field.temporal.createdAt(),
|
|
804
|
-
updatedAt: field.temporal.updatedAt(),
|
|
805
|
-
},
|
|
806
|
-
relations: {
|
|
807
|
-
author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),
|
|
808
|
-
},
|
|
809
|
-
}),
|
|
810
|
-
},
|
|
811
|
-
}),
|
|
812
|
-
);
|
|
813
|
-
`;
|
|
814
|
-
}
|
|
815
|
-
function starterSchemaTsMongo() {
|
|
816
|
-
return `import { defineContract } from '@prisma-next/mongo/contract-builder';
|
|
817
|
-
|
|
818
|
-
export const contract = defineContract(
|
|
819
|
-
{},
|
|
820
|
-
({ field, model, rel }) => ({
|
|
821
|
-
models: {
|
|
822
|
-
User: model('User', {
|
|
823
|
-
collection: 'users',
|
|
824
|
-
fields: {
|
|
825
|
-
_id: field.objectId(),
|
|
826
|
-
email: field.string(),
|
|
827
|
-
username: field.string().optional(),
|
|
828
|
-
name: field.string().optional(),
|
|
829
|
-
},
|
|
830
|
-
relations: {
|
|
831
|
-
posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),
|
|
832
|
-
},
|
|
833
|
-
}),
|
|
834
|
-
|
|
835
|
-
Post: model('Post', {
|
|
836
|
-
collection: 'posts',
|
|
837
|
-
fields: {
|
|
838
|
-
_id: field.objectId(),
|
|
839
|
-
title: field.string(),
|
|
840
|
-
content: field.string().optional(),
|
|
841
|
-
authorId: field.objectId(),
|
|
842
|
-
},
|
|
843
|
-
relations: {
|
|
844
|
-
author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),
|
|
845
|
-
},
|
|
846
|
-
}),
|
|
847
|
-
},
|
|
848
|
-
}),
|
|
849
|
-
);
|
|
850
|
-
`;
|
|
851
|
-
}
|
|
852
|
-
function configFile(target, contractPath) {
|
|
853
|
-
return `import 'dotenv/config';
|
|
854
|
-
import { defineConfig } from '${targetPackageName(target)}/config';
|
|
855
|
-
|
|
856
|
-
export default defineConfig({
|
|
857
|
-
contract: ${JSON.stringify(contractPath)},
|
|
858
|
-
db: {
|
|
859
|
-
connection: process.env['DATABASE_URL']!,
|
|
860
|
-
},
|
|
861
|
-
});
|
|
862
|
-
`;
|
|
863
|
-
}
|
|
864
|
-
function dbFile(target) {
|
|
865
|
-
if (target === "postgres") return `import postgres from '@prisma-next/postgres/runtime';
|
|
866
|
-
import type { Contract } from './contract.d';
|
|
867
|
-
import contractJson from './contract.json' with { type: 'json' };
|
|
868
|
-
|
|
869
|
-
export const db = postgres<Contract>({
|
|
870
|
-
contractJson,
|
|
871
|
-
url: process.env['DATABASE_URL']!,
|
|
872
|
-
});
|
|
873
|
-
`;
|
|
874
|
-
return `import mongo from '@prisma-next/mongo/runtime';
|
|
875
|
-
import type { Contract } from './contract.d';
|
|
876
|
-
import contractJson from './contract.json' with { type: 'json' };
|
|
877
|
-
|
|
878
|
-
export const db = mongo<Contract>({
|
|
879
|
-
contractJson,
|
|
880
|
-
url: process.env['DATABASE_URL']!,
|
|
881
|
-
});
|
|
882
|
-
`;
|
|
883
|
-
}
|
|
884
|
-
//#endregion
|
|
885
637
|
//#region src/commands/init/inputs.ts
|
|
886
638
|
const TARGET_ALIASES = new Map([
|
|
887
639
|
["postgres", "postgres"],
|
|
@@ -1598,7 +1350,7 @@ const LEGACY_SKILL_FILE = ".agents/skills/prisma-next/SKILL.md";
|
|
|
1598
1350
|
//#endregion
|
|
1599
1351
|
//#region src/commands/init/templates/env.ts
|
|
1600
1352
|
/**
|
|
1601
|
-
* The minimum supported server version for each target
|
|
1353
|
+
* The minimum supported server version for each target. The
|
|
1602
1354
|
* authoritative source of truth is each target package's
|
|
1603
1355
|
* `package.json#prismaNext.minServerVersion` field — this module
|
|
1604
1356
|
* mirrors those values and a workspace-level test asserts the two
|
|
@@ -1606,13 +1358,13 @@ const LEGACY_SKILL_FILE = ".agents/skills/prisma-next/SKILL.md";
|
|
|
1606
1358
|
*
|
|
1607
1359
|
* Bumping a value here in isolation is **not** safe: edit the
|
|
1608
1360
|
* corresponding target package's `package.json` first, then mirror
|
|
1609
|
-
* here. The scaffold's `.env.example`
|
|
1610
|
-
*
|
|
1611
|
-
*
|
|
1361
|
+
* here. The scaffold's `.env.example` and the "Requirements" section
|
|
1362
|
+
* of `prisma-next.md` both read from this constant, so a stale value
|
|
1363
|
+
* lies to every freshly initialised user.
|
|
1612
1364
|
*/
|
|
1613
1365
|
const MIN_SERVER_VERSION = {
|
|
1614
|
-
postgres: "
|
|
1615
|
-
mongo: "
|
|
1366
|
+
postgres: "17",
|
|
1367
|
+
mongo: "8.0"
|
|
1616
1368
|
};
|
|
1617
1369
|
const TARGET_LABEL = {
|
|
1618
1370
|
postgres: "PostgreSQL",
|
|
@@ -1634,7 +1386,7 @@ function envPlaceholderBody(target) {
|
|
|
1634
1386
|
lines.push("");
|
|
1635
1387
|
if (target === "postgres") lines.push("DATABASE_URL=\"postgresql://user:password@localhost:5432/mydb\"");
|
|
1636
1388
|
else {
|
|
1637
|
-
lines.push("# Standalone local mongod / `docker run mongo:
|
|
1389
|
+
lines.push("# Standalone local mongod / `docker run mongo:8` — no replica set required for first-run queries.");
|
|
1638
1390
|
lines.push("# Transactions and change streams need a replica set; add ?replicaSet=... only after initiating one.");
|
|
1639
1391
|
lines.push("");
|
|
1640
1392
|
lines.push("DATABASE_URL=\"mongodb://user:password@localhost:27017/mydb\"");
|
|
@@ -1643,7 +1395,7 @@ function envPlaceholderBody(target) {
|
|
|
1643
1395
|
return lines.join("\n");
|
|
1644
1396
|
}
|
|
1645
1397
|
/**
|
|
1646
|
-
* Renders the `.env.example` content for a given target
|
|
1398
|
+
* Renders the `.env.example` content for a given target:
|
|
1647
1399
|
*
|
|
1648
1400
|
* - Carries a "Copy this file to `.env`…" intro that only makes sense
|
|
1649
1401
|
* for the example file (the real `.env` is the destination of that
|
|
@@ -1652,8 +1404,7 @@ function envPlaceholderBody(target) {
|
|
|
1652
1404
|
* shape (Postgres: standard `postgresql://`, Mongo: `mongodb://` plus
|
|
1653
1405
|
* a `mydb` database segment so the lazy facade has a `dbName`).
|
|
1654
1406
|
* - Carries a `# Requires <db> >= <version>` comment so a fresh user
|
|
1655
|
-
* knows the minimum supported server before they first try to
|
|
1656
|
-
* connect (FR8.2).
|
|
1407
|
+
* knows the minimum supported server before they first try to connect.
|
|
1657
1408
|
*/
|
|
1658
1409
|
function envExampleContent(target) {
|
|
1659
1410
|
const lines = [];
|
|
@@ -1663,10 +1414,10 @@ function envExampleContent(target) {
|
|
|
1663
1414
|
}
|
|
1664
1415
|
/**
|
|
1665
1416
|
* Renders the initial `.env` content for `--write-env` / interactive
|
|
1666
|
-
* opt-in
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1669
|
-
* file is gitignored (
|
|
1417
|
+
* opt-in. Same placeholder body as `.env.example`, **without** the
|
|
1418
|
+
* example file's "Copy this file to `.env`…" intro: the real `.env` is
|
|
1419
|
+
* the destination of that copy, so the line would lie. Writing this
|
|
1420
|
+
* file is gitignored (`.env` lands in `.gitignore` during init).
|
|
1670
1421
|
*/
|
|
1671
1422
|
function envFileContent(target) {
|
|
1672
1423
|
return envPlaceholderBody(target);
|
|
@@ -2447,7 +2198,7 @@ async function runEmit(ctx) {
|
|
|
2447
2198
|
const spinner = ctx.ui.spinner();
|
|
2448
2199
|
spinner.start("Emitting contract...");
|
|
2449
2200
|
try {
|
|
2450
|
-
const { executeContractEmit } = await import("./contract-emit-
|
|
2201
|
+
const { executeContractEmit } = await import("./contract-emit-D-4jrNve.mjs").then((n) => n.t);
|
|
2451
2202
|
await executeContractEmit({ configPath: join(ctx.baseDir, "prisma-next.config.ts") });
|
|
2452
2203
|
spinner.stop("Contract emitted");
|
|
2453
2204
|
} catch (err) {
|
|
@@ -2500,4 +2251,4 @@ function sanitisePackageName(raw) {
|
|
|
2500
2251
|
//#endregion
|
|
2501
2252
|
export { runInit };
|
|
2502
2253
|
|
|
2503
|
-
//# sourceMappingURL=init-
|
|
2254
|
+
//# sourceMappingURL=init-Cv9UzWL5.mjs.map
|