@prisma-next/target-postgres 0.12.0-dev.30 → 0.12.0-dev.32

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 (85) hide show
  1. package/dist/{codec-ids-BEVQ-gO4.d.mts → codec-ids-Cx7C07Y_.d.mts} +3 -2
  2. package/dist/codec-ids-Cx7C07Y_.d.mts.map +1 -0
  3. package/dist/{codec-ids-C5qzBqus.mjs → codec-ids-DTqscwN9.mjs} +3 -2
  4. package/dist/codec-ids-DTqscwN9.mjs.map +1 -0
  5. package/dist/codec-ids.d.mts +2 -2
  6. package/dist/codec-ids.mjs +2 -2
  7. package/dist/{codec-types-ClVgENiR.d.mts → codec-types-BoxMGJk-.d.mts} +2 -2
  8. package/dist/{codec-types-ClVgENiR.d.mts.map → codec-types-BoxMGJk-.d.mts.map} +1 -1
  9. package/dist/codec-types.d.mts +1 -1
  10. package/dist/{codecs-BHrYhAZc.d.mts → codecs-DCSyTOCb.d.mts} +2 -2
  11. package/dist/codecs-DCSyTOCb.d.mts.map +1 -0
  12. package/dist/codecs.d.mts +1 -1
  13. package/dist/codecs.mjs +37 -2
  14. package/dist/codecs.mjs.map +1 -1
  15. package/dist/contract-free.d.mts +43 -3
  16. package/dist/contract-free.d.mts.map +1 -1
  17. package/dist/contract-free.mjs +45 -3
  18. package/dist/contract-free.mjs.map +1 -1
  19. package/dist/control.d.mts +1 -1
  20. package/dist/control.mjs +41 -33
  21. package/dist/control.mjs.map +1 -1
  22. package/dist/{data-transform-C1ZpoMCt.d.mts → data-transform-5gLOgP68.d.mts} +2 -2
  23. package/dist/{data-transform-C1ZpoMCt.d.mts.map → data-transform-5gLOgP68.d.mts.map} +1 -1
  24. package/dist/data-transform.d.mts +1 -1
  25. package/dist/ddl.d.mts +1 -1
  26. package/dist/ddl.mjs +1 -1
  27. package/dist/{enum-planning-DHQE3zSH.mjs → enum-planning-Nt9TYPHe.mjs} +0 -0
  28. package/dist/{enum-planning-DHQE3zSH.mjs.map → enum-planning-Nt9TYPHe.mjs.map} +1 -1
  29. package/dist/enum-planning.d.mts +1 -1
  30. package/dist/enum-planning.mjs +1 -1
  31. package/dist/{issue-planner-ttX4mOiF.mjs → issue-planner-SUBi9fH8.mjs} +2 -2
  32. package/dist/{issue-planner-ttX4mOiF.mjs.map → issue-planner-SUBi9fH8.mjs.map} +1 -1
  33. package/dist/issue-planner.d.mts +1 -1
  34. package/dist/issue-planner.mjs +1 -1
  35. package/dist/migration.d.mts +3 -3
  36. package/dist/{nodes-BYSqasmC.mjs → nodes-DCC8-DhV.mjs} +1 -1
  37. package/dist/{nodes-BYSqasmC.mjs.map → nodes-DCC8-DhV.mjs.map} +1 -1
  38. package/dist/{nodes-BS8vS8gv.d.mts → nodes-DflxwrE8.d.mts} +1 -1
  39. package/dist/{nodes-BS8vS8gv.d.mts.map → nodes-DflxwrE8.d.mts.map} +1 -1
  40. package/dist/{op-factory-call-B9mYdDex.d.mts → op-factory-call-B-HEOf41.d.mts} +3 -3
  41. package/dist/{op-factory-call-B9mYdDex.d.mts.map → op-factory-call-B-HEOf41.d.mts.map} +1 -1
  42. package/dist/op-factory-call.d.mts +1 -1
  43. package/dist/pack.d.mts +2 -2
  44. package/dist/{planner-y-bVvDFR.mjs → planner-BruD4_LM.mjs} +3 -3
  45. package/dist/{planner-y-bVvDFR.mjs.map → planner-BruD4_LM.mjs.map} +1 -1
  46. package/dist/planner-ddl-builders.d.mts +1 -1
  47. package/dist/{planner-produced-postgres-migration-RdjC7aUC.d.mts → planner-produced-postgres-migration-Co71_VbU.d.mts} +3 -3
  48. package/dist/{planner-produced-postgres-migration-RdjC7aUC.d.mts.map → planner-produced-postgres-migration-Co71_VbU.d.mts.map} +1 -1
  49. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  50. package/dist/{planner-target-details-C1Ye0hb6.d.mts → planner-target-details-Dv5N6x6k.d.mts} +1 -1
  51. package/dist/{planner-target-details-C1Ye0hb6.d.mts.map → planner-target-details-Dv5N6x6k.d.mts.map} +1 -1
  52. package/dist/planner-target-details.d.mts +1 -1
  53. package/dist/planner.d.mts +1 -1
  54. package/dist/planner.mjs +1 -1
  55. package/dist/{postgres-contract-serializer-BYpK6TkY.mjs → postgres-contract-serializer-OfORJ-GY.mjs} +1 -1
  56. package/dist/{postgres-contract-serializer-BYpK6TkY.mjs.map → postgres-contract-serializer-OfORJ-GY.mjs.map} +1 -1
  57. package/dist/{postgres-enum-type-Bl6THBPg.d.mts → postgres-enum-type-CWwVGBNK.d.mts} +1 -1
  58. package/dist/{postgres-enum-type-Bl6THBPg.d.mts.map → postgres-enum-type-CWwVGBNK.d.mts.map} +1 -1
  59. package/dist/{postgres-migration-DLZtVVDM.d.mts → postgres-migration-BcKS2Lqq.d.mts} +3 -3
  60. package/dist/{postgres-migration-DLZtVVDM.d.mts.map → postgres-migration-BcKS2Lqq.d.mts.map} +1 -1
  61. package/dist/render-ops.d.mts +1 -1
  62. package/dist/runtime.mjs +1 -1
  63. package/dist/{shared-wRIzOjdd.d.mts → shared-CMqM-2BA.d.mts} +2 -2
  64. package/dist/{shared-wRIzOjdd.d.mts.map → shared-CMqM-2BA.d.mts.map} +1 -1
  65. package/dist/{types-DncetAjv.d.mts → types-kggVJs6C.d.mts} +1 -1
  66. package/dist/types-kggVJs6C.d.mts.map +1 -0
  67. package/dist/types.d.mts +2 -2
  68. package/package.json +17 -18
  69. package/src/contract-free/columns.ts +49 -0
  70. package/src/core/ast/table-source.ts +23 -0
  71. package/src/core/codec-ids.ts +1 -0
  72. package/src/core/codecs.ts +44 -0
  73. package/src/core/migrations/runner.ts +41 -47
  74. package/src/exports/contract-free.ts +2 -0
  75. package/dist/codec-ids-BEVQ-gO4.d.mts.map +0 -1
  76. package/dist/codec-ids-C5qzBqus.mjs.map +0 -1
  77. package/dist/codecs-BHrYhAZc.d.mts.map +0 -1
  78. package/dist/statement-builders-Cd311EDF.mjs +0 -143
  79. package/dist/statement-builders-Cd311EDF.mjs.map +0 -1
  80. package/dist/statement-builders.d.mts +0 -51
  81. package/dist/statement-builders.d.mts.map +0 -1
  82. package/dist/statement-builders.mjs +0 -2
  83. package/dist/types-DncetAjv.d.mts.map +0 -1
  84. package/src/core/migrations/statement-builders.ts +0 -198
  85. package/src/exports/statement-builders.ts +0 -8
@@ -71,6 +71,7 @@ import {
71
71
  PG_JSON_CODEC_ID,
72
72
  PG_JSONB_CODEC_ID,
73
73
  PG_NUMERIC_CODEC_ID,
74
+ PG_TEXT_ARRAY_CODEC_ID,
74
75
  PG_TEXT_CODEC_ID,
75
76
  PG_TIME_CODEC_ID,
76
77
  PG_TIMESTAMP_CODEC_ID,
@@ -99,6 +100,7 @@ const precisionParamsSchema = arktype({
99
100
  }) satisfies StandardSchemaV1<PrecisionParams>;
100
101
 
101
102
  const PG_TEXT_META = { db: { sql: { postgres: { nativeType: 'text' } } } } as const;
103
+ const PG_TEXT_ARRAY_META = { db: { sql: { postgres: { nativeType: 'text[]' } } } } as const;
102
104
  const PG_INT4_META = { db: { sql: { postgres: { nativeType: 'integer' } } } } as const;
103
105
  const PG_INT2_META = { db: { sql: { postgres: { nativeType: 'smallint' } } } } as const;
104
106
  const PG_INT8_META = { db: { sql: { postgres: { nativeType: 'bigint' } } } } as const;
@@ -160,6 +162,47 @@ export const pgTextColumn = () =>
160
162
  pgTextColumn satisfies ColumnHelperFor<PgTextDescriptor>;
161
163
  pgTextColumn satisfies ColumnHelperForStrict<PgTextDescriptor>;
162
164
 
165
+ /**
166
+ * Postgres `text[]` codec. Encode is an identity pass-through: the pg wire
167
+ * driver serialises a JS `string[]` to a Postgres array literal under the
168
+ * `$N::text[]` cast the renderer emits from this codec's `text[]` native type,
169
+ * and decode reads it back as a JS array. Used by the control plane to write
170
+ * the marker's `invariants` column. Not a user-facing scalar — it is not part
171
+ * of the authorable `CodecTypes` surface, only the runtime codec registry.
172
+ */
173
+ export class PgTextArrayCodec extends CodecImpl<
174
+ typeof PG_TEXT_ARRAY_CODEC_ID,
175
+ readonly ['equality'],
176
+ readonly string[],
177
+ readonly string[]
178
+ > {
179
+ async encode(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {
180
+ return value;
181
+ }
182
+ async decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {
183
+ return wire;
184
+ }
185
+ encodeJson(value: readonly string[]): JsonValue {
186
+ return [...value];
187
+ }
188
+ decodeJson(json: JsonValue): readonly string[] {
189
+ return Array.isArray(json) ? json.map((entry) => String(entry)) : [];
190
+ }
191
+ }
192
+
193
+ export class PgTextArrayDescriptor extends CodecDescriptorImpl<void> {
194
+ override readonly codecId = PG_TEXT_ARRAY_CODEC_ID;
195
+ override readonly traits = ['equality'] as const;
196
+ override readonly targetTypes = ['text[]'] as const;
197
+ override readonly meta = PG_TEXT_ARRAY_META;
198
+ override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;
199
+ override factory(): (ctx: CodecInstanceContext) => PgTextArrayCodec {
200
+ return () => new PgTextArrayCodec(this);
201
+ }
202
+ }
203
+
204
+ export const pgTextArrayDescriptor = new PgTextArrayDescriptor();
205
+
163
206
  export class PgInt4Codec extends CodecImpl<
164
207
  typeof PG_INT4_CODEC_ID,
165
208
  readonly ['equality', 'order', 'numeric'],
@@ -1036,4 +1079,5 @@ export const codecDescriptors: readonly AnyCodecDescriptor[] = [
1036
1079
  pgEnumDescriptor,
1037
1080
  pgJsonDescriptor,
1038
1081
  pgJsonbDescriptor,
1082
+ pgTextArrayDescriptor,
1039
1083
  ];
@@ -21,6 +21,7 @@ import { APP_SPACE_ID } from '@prisma-next/framework-components/control';
21
21
  import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';
22
22
  import type { SqlStorage } from '@prisma-next/sql-contract/types';
23
23
  import { SqlQueryError } from '@prisma-next/sql-errors';
24
+ import type { LoweredStatement } from '@prisma-next/sql-relational-core/ast';
24
25
  import { ifDefined } from '@prisma-next/utils/defined';
25
26
  import type { Result } from '@prisma-next/utils/result';
26
27
  import { notOk, ok, okVoid } from '@prisma-next/utils/result';
@@ -29,11 +30,6 @@ import { parsePostgresDefault } from '../default-normalizer';
29
30
  import { normalizeSchemaNativeType } from '../native-type-normalizer';
30
31
  import { createResolveExistingEnumValues } from './enum-planning';
31
32
  import type { PostgresPlanTargetDetails } from './planner-target-details';
32
- import {
33
- buildLedgerInsertStatement,
34
- buildMergeMarkerStatements,
35
- type SqlStatement,
36
- } from './statement-builders';
37
33
 
38
34
  interface ApplyPlanSuccessValue {
39
35
  readonly operationsExecuted: number;
@@ -165,13 +161,9 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
165
161
  isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting;
166
162
 
167
163
  if (!isSelfEdgeNoOp) {
168
- await this.upsertMarker(driver, options, existingMarker, space);
169
- await this.recordLedgerEntries(
170
- driver,
171
- options,
172
- existingMarker,
173
- applyValue.executedOperations,
174
- );
164
+ const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
165
+ if (!markerResult.ok) return markerResult;
166
+ await this.recordLedgerEntries(driver, options, applyValue.executedOperations);
175
167
  }
176
168
 
177
169
  return runnerSuccess({
@@ -603,36 +595,48 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
603
595
  options: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>,
604
596
  existingMarker: ContractMarkerRecord | null,
605
597
  space: string,
606
- ): Promise<void> {
607
- const incomingInvariants = options.plan.providedInvariants ?? [];
608
- const writeStatements = buildMergeMarkerStatements({
609
- space,
598
+ ): Promise<Result<void, SqlMigrationRunnerFailure>> {
599
+ const destination = {
610
600
  storageHash: options.plan.destination.storageHash,
611
601
  profileHash:
612
602
  options.plan.destination.profileHash ??
613
603
  options.destinationContract.profileHash ??
614
604
  options.plan.destination.storageHash,
615
- contractJson: options.destinationContract,
616
- canonicalVersion: null,
617
- meta: {},
618
- invariants: incomingInvariants,
605
+ invariants: options.plan.providedInvariants ?? [],
606
+ };
607
+ if (!existingMarker) {
608
+ await this.family.initMarker({ driver, space, destination });
609
+ return okVoid();
610
+ }
611
+ const updated = await this.family.updateMarker({
612
+ driver,
613
+ space,
614
+ expectedFrom: existingMarker.storageHash,
615
+ destination,
619
616
  });
620
- const statement = existingMarker ? writeStatements.update : writeStatements.insert;
621
- await this.executeStatement(driver, statement);
617
+ if (!updated) {
618
+ return runnerFailure(
619
+ 'MARKER_CAS_FAILURE',
620
+ 'Marker was modified by another process during migration execution.',
621
+ {
622
+ meta: {
623
+ space,
624
+ expectedStorageHash: existingMarker.storageHash,
625
+ destinationStorageHash: options.plan.destination.storageHash,
626
+ },
627
+ },
628
+ );
629
+ }
630
+ return okVoid();
622
631
  }
623
632
 
624
633
  private async recordLedgerEntries(
625
634
  driver: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['driver'],
626
635
  options: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>,
627
- existingMarker: ContractMarkerRecord | null,
628
636
  executedOperations: readonly SqlMigrationPlanOperation<PostgresPlanTargetDetails>[],
629
637
  ): Promise<void> {
630
638
  const plan = options.plan;
631
639
  const space = plan.spaceId;
632
- const destinationProfileHash =
633
- plan.destination.profileHash ??
634
- options.destinationContract.profileHash ??
635
- plan.destination.storageHash;
636
640
  const edges = options.migrationEdges;
637
641
  const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
638
642
  if (totalEdgeOps !== plan.operations.length) {
@@ -644,31 +648,21 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
644
648
  // are substituted with skip records (empty `execute`) by `applyPlan`, so the
645
649
  // journal reflects what actually ran rather than the raw plan.
646
650
  let offset = 0;
647
- const lastIndex = edges.length - 1;
648
- for (const [i, edge] of edges.entries()) {
651
+ for (const edge of edges) {
649
652
  const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
650
653
  offset += edge.operationCount;
651
- const isFirst = i === 0;
652
- const isLast = i === lastIndex;
653
- await this.executeStatement(
654
+ await this.family.writeLedgerEntry({
654
655
  driver,
655
- buildLedgerInsertStatement({
656
- space,
656
+ space,
657
+ entry: {
658
+ edgeId: `${edge.from}->${edge.to}`,
659
+ from: edge.from,
660
+ to: edge.to,
657
661
  migrationName: edge.dirName,
658
662
  migrationHash: edge.migrationHash,
659
- originStorageHash: edge.from === '' ? null : edge.from,
660
- originProfileHash:
661
- isFirst && existingMarker?.storageHash === edge.from
662
- ? (existingMarker.profileHash ?? null)
663
- : null,
664
- destinationStorageHash: edge.to,
665
- destinationProfileHash:
666
- isLast && edge.to === plan.destination.storageHash ? destinationProfileHash : null,
667
- contractJsonBefore: isFirst ? (existingMarker?.contractJson ?? null) : null,
668
- contractJsonAfter: isLast ? options.destinationContract : null,
669
663
  operations: edgeOps,
670
- }),
671
- );
664
+ },
665
+ });
672
666
  }
673
667
  }
674
668
 
@@ -699,7 +693,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
699
693
 
700
694
  private async executeStatement(
701
695
  driver: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['driver'],
702
- statement: SqlStatement,
696
+ statement: LoweredStatement,
703
697
  ): Promise<void> {
704
698
  if (statement.params.length > 0) {
705
699
  await driver.query(statement.sql, statement.params);
@@ -1,5 +1,7 @@
1
+ export { int4, int8, jsonb, pgTable, text, textArray, timestamptz } from '../contract-free/columns';
1
2
  export {
2
3
  buildControlTableBootstrapQueries,
3
4
  buildSignMarkerBootstrapQueries,
4
5
  } from '../contract-free/control-bootstrap';
5
6
  export { createSchema, createTable } from '../contract-free/ddl';
7
+ export { PostgresTableSource } from '../core/ast/table-source';
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-ids-BEVQ-gO4.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;;cAQa,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,mBAAA;AAAA,cACA,eAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,kBAAA;AAAA,cACA,kBAAA;AAAA,cACA,mBAAA;AAAA,cACA,gBAAA;AAAA,cACA,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,qBAAA;AAAA,cACA,uBAAA;AAAA,cACA,gBAAA;AAAA,cACA,kBAAA;AAAA,cACA,oBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,iBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-ids-C5qzBqus.mjs","names":[],"sources":["../src/core/codec-ids.ts"],"sourcesContent":["export {\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/sql-relational-core/ast';\nexport const PG_TEXT_CODEC_ID = 'pg/text@1' as const;\nexport const PG_ENUM_CODEC_ID = 'pg/enum@1' as const;\nexport const PG_CHAR_CODEC_ID = 'pg/char@1' as const;\nexport const PG_VARCHAR_CODEC_ID = 'pg/varchar@1' as const;\nexport const PG_INT_CODEC_ID = 'pg/int@1' as const;\nexport const PG_INT2_CODEC_ID = 'pg/int2@1' as const;\nexport const PG_INT4_CODEC_ID = 'pg/int4@1' as const;\nexport const PG_INT8_CODEC_ID = 'pg/int8@1' as const;\nexport const PG_FLOAT_CODEC_ID = 'pg/float@1' as const;\nexport const PG_FLOAT4_CODEC_ID = 'pg/float4@1' as const;\nexport const PG_FLOAT8_CODEC_ID = 'pg/float8@1' as const;\nexport const PG_NUMERIC_CODEC_ID = 'pg/numeric@1' as const;\nexport const PG_BOOL_CODEC_ID = 'pg/bool@1' as const;\nexport const PG_BIT_CODEC_ID = 'pg/bit@1' as const;\nexport const PG_VARBIT_CODEC_ID = 'pg/varbit@1' as const;\nexport const PG_TIMESTAMP_CODEC_ID = 'pg/timestamp@1' as const;\nexport const PG_TIMESTAMPTZ_CODEC_ID = 'pg/timestamptz@1' as const;\nexport const PG_TIME_CODEC_ID = 'pg/time@1' as const;\nexport const PG_TIMETZ_CODEC_ID = 'pg/timetz@1' as const;\nexport const PG_INTERVAL_CODEC_ID = 'pg/interval@1' as const;\nexport const PG_JSON_CODEC_ID = 'pg/json@1' as const;\nexport const PG_JSONB_CODEC_ID = 'pg/jsonb@1' as const;\nexport const PG_BYTEA_CODEC_ID = 'pg/bytea@1' as const;\n"],"mappings":";;AAQA,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,sBAAsB;AACnC,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;AACnC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,wBAAwB;AACrC,MAAa,0BAA0B;AACvC,MAAa,mBAAmB;AAChC,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,oBAAoB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"codecs-BHrYhAZc.d.mts","names":[],"sources":["../src/core/codecs.ts"],"mappings":";;;;;;;;;KAkFK,YAAA;EAAA,SAA0B,MAAM;AAAA;AAAA,KAChC,eAAA;EAAA,SAA6B,SAAS;AAAA;AAAA,KACtC,aAAA;EAAA,SAA2B,SAAA;EAAA,SAA4B,KAAK;AAAA;AAAA,KAC5D,UAAA;EAAA,SAAwB,MAAM;AAAA;AAAA,cAsCtB,WAAA,SAAoB,SAAA,QACxB,gBAAA;EAKD,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAG/C,MAAA,CAAO,IAAA,UAAc,IAAA,EAA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SACA,IAAA;IAAA;;;;;;;;WACA,MAAA;EAAA,SACA,YAAA,EAAY,gBAAA;EACrB,OAAA,CAAA,IAAY,GAAA,EAAK,oBAAA,KAAyB,aAAA;AAAA;AAAA,cAOxC,aAAA,QAAa,0CAAA,CAAA,UAAA,CAAA,aAAA"}
@@ -1,143 +0,0 @@
1
- import { APP_SPACE_ID as APP_SPACE_ID$1 } from "@prisma-next/framework-components/control";
2
- //#region src/core/migrations/statement-builders.ts
3
- const ensurePrismaContractSchemaStatement = {
4
- sql: "create schema if not exists prisma_contract",
5
- params: []
6
- };
7
- /**
8
- * Schema for `prisma_contract.marker`. The `space text` primary key
9
- * supports one row per loaded contract space (`'app'`,
10
- * `'<extension-id>'`, …); on a brand-new database `CREATE TABLE IF NOT
11
- * EXISTS` produces this shape directly. The migration runner detects
12
- * pre-1.0 single-row markers (no `space` column) at boot and fails with
13
- * a structured `LEGACY_MARKER_SHAPE` error rather than auto-migrating —
14
- * see `specs/framework-mechanism.spec.md § 2`.
15
- */
16
- const ensureMarkerTableStatement = {
17
- sql: `create table if not exists prisma_contract.marker (
18
- space text not null primary key default '${APP_SPACE_ID$1}',
19
- core_hash text not null,
20
- profile_hash text not null,
21
- contract_json jsonb,
22
- canonical_version int,
23
- updated_at timestamptz not null default now(),
24
- app_tag text,
25
- meta jsonb not null default '{}',
26
- invariants text[] not null default '{}'
27
- )`,
28
- params: []
29
- };
30
- const ensureLedgerTableStatement = {
31
- sql: `create table if not exists prisma_contract.ledger (
32
- id bigserial primary key,
33
- created_at timestamptz not null default now(),
34
- space text not null,
35
- migration_name text not null,
36
- migration_hash text not null,
37
- origin_core_hash text,
38
- origin_profile_hash text,
39
- destination_core_hash text not null,
40
- destination_profile_hash text,
41
- contract_json_before jsonb,
42
- contract_json_after jsonb,
43
- operations jsonb not null
44
- )`,
45
- params: []
46
- };
47
- function buildMergeMarkerStatements(input) {
48
- const params = [
49
- input.space,
50
- input.storageHash,
51
- input.profileHash,
52
- jsonParam(input.contractJson),
53
- input.canonicalVersion ?? null,
54
- input.appTag ?? null,
55
- jsonParam(input.meta ?? {}),
56
- input.invariants
57
- ];
58
- return {
59
- insert: {
60
- sql: `insert into prisma_contract.marker (
61
- space,
62
- core_hash,
63
- profile_hash,
64
- contract_json,
65
- canonical_version,
66
- updated_at,
67
- app_tag,
68
- meta,
69
- invariants
70
- ) values (
71
- $1,
72
- $2,
73
- $3,
74
- $4::jsonb,
75
- $5,
76
- now(),
77
- $6,
78
- $7::jsonb,
79
- $8::text[]
80
- )`,
81
- params
82
- },
83
- update: {
84
- sql: `update prisma_contract.marker set
85
- core_hash = $2,
86
- profile_hash = $3,
87
- contract_json = $4::jsonb,
88
- canonical_version = $5,
89
- updated_at = now(),
90
- app_tag = $6,
91
- meta = $7::jsonb,
92
- invariants = array(select distinct unnest(invariants || $8::text[]) order by 1)
93
- where space = $1`,
94
- params
95
- }
96
- };
97
- }
98
- function buildLedgerInsertStatement(input) {
99
- return {
100
- sql: `insert into prisma_contract.ledger (
101
- space,
102
- migration_name,
103
- migration_hash,
104
- origin_core_hash,
105
- origin_profile_hash,
106
- destination_core_hash,
107
- destination_profile_hash,
108
- contract_json_before,
109
- contract_json_after,
110
- operations
111
- ) values (
112
- $1,
113
- $2,
114
- $3,
115
- $4,
116
- $5,
117
- $6,
118
- $7,
119
- $8::jsonb,
120
- $9::jsonb,
121
- $10::jsonb
122
- )`,
123
- params: [
124
- input.space,
125
- input.migrationName,
126
- input.migrationHash,
127
- input.originStorageHash ?? null,
128
- input.originProfileHash ?? null,
129
- input.destinationStorageHash,
130
- input.destinationProfileHash ?? null,
131
- jsonParam(input.contractJsonBefore),
132
- jsonParam(input.contractJsonAfter),
133
- jsonParam(input.operations)
134
- ]
135
- };
136
- }
137
- function jsonParam(value) {
138
- return JSON.stringify(value ?? null);
139
- }
140
- //#endregion
141
- export { ensureMarkerTableStatement as a, ensureLedgerTableStatement as i, buildLedgerInsertStatement as n, ensurePrismaContractSchemaStatement as o, buildMergeMarkerStatements as r, APP_SPACE_ID$1 as t };
142
-
143
- //# sourceMappingURL=statement-builders-Cd311EDF.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"statement-builders-Cd311EDF.mjs","names":["APP_SPACE_ID"],"sources":["../src/core/migrations/statement-builders.ts"],"sourcesContent":["import { APP_SPACE_ID } from '@prisma-next/framework-components/control';\n\nexport { APP_SPACE_ID };\n\nexport interface SqlStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n}\n\nexport const ensurePrismaContractSchemaStatement: SqlStatement = {\n sql: 'create schema if not exists prisma_contract',\n params: [],\n};\n\n/**\n * Schema for `prisma_contract.marker`. The `space text` primary key\n * supports one row per loaded contract space (`'app'`,\n * `'<extension-id>'`, …); on a brand-new database `CREATE TABLE IF NOT\n * EXISTS` produces this shape directly. The migration runner detects\n * pre-1.0 single-row markers (no `space` column) at boot and fails with\n * a structured `LEGACY_MARKER_SHAPE` error rather than auto-migrating —\n * see `specs/framework-mechanism.spec.md § 2`.\n */\nexport const ensureMarkerTableStatement: SqlStatement = {\n sql: `create table if not exists prisma_contract.marker (\n space text not null primary key default '${APP_SPACE_ID}',\n core_hash text not null,\n profile_hash text not null,\n contract_json jsonb,\n canonical_version int,\n updated_at timestamptz not null default now(),\n app_tag text,\n meta jsonb not null default '{}',\n invariants text[] not null default '{}'\n )`,\n params: [],\n};\n\nexport const ensureLedgerTableStatement: SqlStatement = {\n sql: `create table if not exists prisma_contract.ledger (\n id bigserial primary key,\n created_at timestamptz not null default now(),\n space text not null,\n migration_name text not null,\n migration_hash text not null,\n origin_core_hash text,\n origin_profile_hash text,\n destination_core_hash text not null,\n destination_profile_hash text,\n contract_json_before jsonb,\n contract_json_after jsonb,\n operations jsonb not null\n )`,\n params: [],\n};\n\nexport interface MergeMarkerInput {\n /**\n * Logical space identifier for this marker row. Required at every\n * call site so the type system surfaces every place that needs to\n * thread the value (rather than letting an `?? APP_SPACE_ID`\n * fall-through silently collapse per-space markers onto the\n * `'app'` row). App-plan callers pass {@link APP_SPACE_ID}\n * (`'app'`); per-extension callers (planner / runner / verifier\n * extensions over contract spaces) pass the extension's space id.\n */\n readonly space: string;\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson?: unknown;\n readonly canonicalVersion?: number | null;\n readonly appTag?: string | null;\n readonly meta?: Record<string, unknown>;\n /**\n * Invariants to merge into `marker.invariants`. INSERT writes them as\n * the initial value (callers are expected to pass a sorted, deduped\n * array). UPDATE merges them with the existing column server-side via\n * a single atomic SQL expression.\n */\n readonly invariants: readonly string[];\n}\n\nexport function buildMergeMarkerStatements(input: MergeMarkerInput): {\n readonly insert: SqlStatement;\n readonly update: SqlStatement;\n} {\n const params: readonly unknown[] = [\n input.space,\n input.storageHash,\n input.profileHash,\n jsonParam(input.contractJson),\n input.canonicalVersion ?? null,\n input.appTag ?? null,\n jsonParam(input.meta ?? {}),\n input.invariants,\n ];\n\n return {\n insert: {\n sql: `insert into prisma_contract.marker (\n space,\n core_hash,\n profile_hash,\n contract_json,\n canonical_version,\n updated_at,\n app_tag,\n meta,\n invariants\n ) values (\n $1,\n $2,\n $3,\n $4::jsonb,\n $5,\n now(),\n $6,\n $7::jsonb,\n $8::text[]\n )`,\n params,\n },\n update: {\n // `invariants = array(select distinct unnest(invariants || $8::text[]) order by 1)`\n // reads the current column value under the UPDATE's row lock, unions\n // with the incoming array, dedupes, and sorts ascending — single\n // statement, atomic, no read-then-write window.\n sql: `update prisma_contract.marker set\n core_hash = $2,\n profile_hash = $3,\n contract_json = $4::jsonb,\n canonical_version = $5,\n updated_at = now(),\n app_tag = $6,\n meta = $7::jsonb,\n invariants = array(select distinct unnest(invariants || $8::text[]) order by 1)\n where space = $1`,\n params,\n },\n };\n}\n\nexport interface LedgerInsertInput {\n readonly space: string;\n readonly migrationName: string;\n readonly migrationHash: string;\n readonly originStorageHash?: string | null;\n readonly originProfileHash?: string | null;\n readonly destinationStorageHash: string;\n readonly destinationProfileHash?: string | null;\n readonly contractJsonBefore?: unknown;\n readonly contractJsonAfter?: unknown;\n readonly operations: unknown;\n}\n\nexport function buildLedgerInsertStatement(input: LedgerInsertInput): SqlStatement {\n return {\n sql: `insert into prisma_contract.ledger (\n space,\n migration_name,\n migration_hash,\n origin_core_hash,\n origin_profile_hash,\n destination_core_hash,\n destination_profile_hash,\n contract_json_before,\n contract_json_after,\n operations\n ) values (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8::jsonb,\n $9::jsonb,\n $10::jsonb\n )`,\n params: [\n input.space,\n input.migrationName,\n input.migrationHash,\n input.originStorageHash ?? null,\n input.originProfileHash ?? null,\n input.destinationStorageHash,\n input.destinationProfileHash ?? null,\n jsonParam(input.contractJsonBefore),\n jsonParam(input.contractJsonAfter),\n jsonParam(input.operations),\n ],\n };\n}\n\nfunction jsonParam(value: unknown): string {\n return JSON.stringify(value ?? null);\n}\n"],"mappings":";;AASA,MAAa,sCAAoD;CAC/D,KAAK;CACL,QAAQ,CAAC;AACX;;;;;;;;;;AAWA,MAAa,6BAA2C;CACtD,KAAK;+CACwCA,eAAa;;;;;;;;;;CAU1D,QAAQ,CAAC;AACX;AAEA,MAAa,6BAA2C;CACtD,KAAK;;;;;;;;;;;;;;CAcL,QAAQ,CAAC;AACX;AA4BA,SAAgB,2BAA2B,OAGzC;CACA,MAAM,SAA6B;EACjC,MAAM;EACN,MAAM;EACN,MAAM;EACN,UAAU,MAAM,YAAY;EAC5B,MAAM,oBAAoB;EAC1B,MAAM,UAAU;EAChB,UAAU,MAAM,QAAQ,CAAC,CAAC;EAC1B,MAAM;CACR;CAEA,OAAO;EACL,QAAQ;GACN,KAAK;;;;;;;;;;;;;;;;;;;;;GAqBL;EACF;EACA,QAAQ;GAKN,KAAK;;;;;;;;;;GAUL;EACF;CACF;AACF;AAeA,SAAgB,2BAA2B,OAAwC;CACjF,OAAO;EACL,KAAK;;;;;;;;;;;;;;;;;;;;;;;EAuBL,QAAQ;GACN,MAAM;GACN,MAAM;GACN,MAAM;GACN,MAAM,qBAAqB;GAC3B,MAAM,qBAAqB;GAC3B,MAAM;GACN,MAAM,0BAA0B;GAChC,UAAU,MAAM,kBAAkB;GAClC,UAAU,MAAM,iBAAiB;GACjC,UAAU,MAAM,UAAU;EAC5B;CACF;AACF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,KAAK,UAAU,SAAS,IAAI;AACrC"}
@@ -1,51 +0,0 @@
1
- import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
2
-
3
- //#region src/core/migrations/statement-builders.d.ts
4
- interface SqlStatement {
5
- readonly sql: string;
6
- readonly params: readonly unknown[];
7
- }
8
- declare const ensurePrismaContractSchemaStatement: SqlStatement;
9
- /**
10
- * Schema for `prisma_contract.marker`. The `space text` primary key
11
- * supports one row per loaded contract space (`'app'`,
12
- * `'<extension-id>'`, …); on a brand-new database `CREATE TABLE IF NOT
13
- * EXISTS` produces this shape directly. The migration runner detects
14
- * pre-1.0 single-row markers (no `space` column) at boot and fails with
15
- * a structured `LEGACY_MARKER_SHAPE` error rather than auto-migrating —
16
- * see `specs/framework-mechanism.spec.md § 2`.
17
- */
18
- declare const ensureMarkerTableStatement: SqlStatement;
19
- declare const ensureLedgerTableStatement: SqlStatement;
20
- interface MergeMarkerInput {
21
- /**
22
- * Logical space identifier for this marker row. Required at every
23
- * call site so the type system surfaces every place that needs to
24
- * thread the value (rather than letting an `?? APP_SPACE_ID`
25
- * fall-through silently collapse per-space markers onto the
26
- * `'app'` row). App-plan callers pass {@link APP_SPACE_ID}
27
- * (`'app'`); per-extension callers (planner / runner / verifier
28
- * extensions over contract spaces) pass the extension's space id.
29
- */
30
- readonly space: string;
31
- readonly storageHash: string;
32
- readonly profileHash: string;
33
- readonly contractJson?: unknown;
34
- readonly canonicalVersion?: number | null;
35
- readonly appTag?: string | null;
36
- readonly meta?: Record<string, unknown>;
37
- /**
38
- * Invariants to merge into `marker.invariants`. INSERT writes them as
39
- * the initial value (callers are expected to pass a sorted, deduped
40
- * array). UPDATE merges them with the existing column server-side via
41
- * a single atomic SQL expression.
42
- */
43
- readonly invariants: readonly string[];
44
- }
45
- declare function buildMergeMarkerStatements(input: MergeMarkerInput): {
46
- readonly insert: SqlStatement;
47
- readonly update: SqlStatement;
48
- };
49
- //#endregion
50
- export { APP_SPACE_ID, type SqlStatement, buildMergeMarkerStatements, ensureLedgerTableStatement, ensureMarkerTableStatement, ensurePrismaContractSchemaStatement };
51
- //# sourceMappingURL=statement-builders.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"statement-builders.d.mts","names":[],"sources":["../src/core/migrations/statement-builders.ts"],"mappings":";;;UAIiB,YAAA;EAAA,SACN,GAAA;EAAA,SACA,MAAM;AAAA;AAAA,cAGJ,mCAAA,EAAqC,YAGjD;AANgB;AAGjB;;;;AAGC;AAWD;;;AAjBiB,cAiBJ,0BAAA,EAA4B,YAaxC;AAAA,cAEY,0BAAA,EAA4B,YAgBxC;AAAA,UAEgB,gBAAA;EAFhB;;;AAAA;AAED;;;;;EAFC,SAYU,KAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA;EAAA,SACA,gBAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA,GAAO,MAAM;EAOb;;AAAU;AAGrB;;;EAHW,SAAA,UAAA;AAAA;AAAA,iBAGK,0BAAA,CAA2B,KAAA,EAAO,gBAAA;EAAA,SACvC,MAAA,EAAQ,YAAA;EAAA,SACR,MAAA,EAAQ,YAAA;AAAA"}
@@ -1,2 +0,0 @@
1
- import { a as ensureMarkerTableStatement, i as ensureLedgerTableStatement, o as ensurePrismaContractSchemaStatement, r as buildMergeMarkerStatements, t as APP_SPACE_ID } from "./statement-builders-Cd311EDF.mjs";
2
- export { APP_SPACE_ID, buildMergeMarkerStatements, ensureLedgerTableStatement, ensureMarkerTableStatement, ensurePrismaContractSchemaStatement };
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-DncetAjv.d.mts","names":[],"sources":["../src/core/types.ts"],"mappings":";;;KAEY,qBAAA,GACR,aAAa;EAAA,SACF,IAAA;EAAA,SAA2B,IAAA;AAAA"}