@prisma-next/family-sql 0.5.0-dev.66 → 0.5.0-dev.68
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/{authoring-type-constructors-D9b8AG6y.mjs → authoring-type-constructors-F4JpCJl7.mjs} +2 -3
- package/dist/{authoring-type-constructors-D9b8AG6y.mjs.map → authoring-type-constructors-F4JpCJl7.mjs.map} +1 -1
- package/dist/control-adapter.d.mts +9 -2
- package/dist/control-adapter.d.mts.map +1 -1
- package/dist/control-adapter.mjs +1 -1
- package/dist/control.d.mts +28 -16
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +148 -22
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +1 -2
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +1 -2
- package/dist/migration.mjs.map +1 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +3 -5
- package/dist/pack.mjs.map +1 -1
- package/dist/runtime.d.mts +0 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -6
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-verify.d.mts +2 -4
- package/dist/schema-verify.d.mts.map +1 -1
- package/dist/schema-verify.mjs +2 -3
- package/dist/test-utils.mjs +1 -2
- package/dist/{timestamp-now-generator-Bt4L3cfM.mjs → timestamp-now-generator-BWp8S2sa.mjs} +2 -2
- package/dist/{timestamp-now-generator-Bt4L3cfM.mjs.map → timestamp-now-generator-BWp8S2sa.mjs.map} +1 -1
- package/dist/{types-DFQkcr8A.d.mts → types-CIdiS2QK.d.mts} +117 -3
- package/dist/types-CIdiS2QK.d.mts.map +1 -0
- package/dist/{verify-BdES8wgQ.mjs → verify-pRYxnpiG.mjs} +2 -3
- package/dist/verify-pRYxnpiG.mjs.map +1 -0
- package/dist/{verify-sql-schema-Ovz7RXR5.mjs → verify-sql-schema-C84vejAP.mjs} +2 -6
- package/dist/verify-sql-schema-C84vejAP.mjs.map +1 -0
- package/dist/{verify-sql-schema-DW8Agf1F.d.mts → verify-sql-schema-CPHiuYHR.d.mts} +1 -2
- package/dist/verify-sql-schema-CPHiuYHR.d.mts.map +1 -0
- package/dist/verify.d.mts +0 -1
- package/dist/verify.d.mts.map +1 -1
- package/dist/verify.mjs +2 -3
- package/package.json +23 -23
- package/src/core/control-adapter.ts +11 -0
- package/src/core/control-descriptor.ts +2 -1
- package/src/core/control-instance.ts +70 -2
- package/src/core/migrations/field-event-planner.ts +196 -0
- package/src/core/migrations/types.ts +117 -1
- package/src/exports/control.ts +7 -0
- package/dist/types-DFQkcr8A.d.mts.map +0 -1
- package/dist/verify-BdES8wgQ.mjs.map +0 -1
- package/dist/verify-sql-schema-DW8Agf1F.d.mts.map +0 -1
- package/dist/verify-sql-schema-Ovz7RXR5.mjs.map +0 -1
package/dist/migration.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as SqlPlanTargetDetails, v as SqlMigrationPlanOperation } from "./types-CIdiS2QK.mjs";
|
|
2
2
|
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
3
3
|
|
|
4
4
|
//#region src/core/sql-migration.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Family-owned base class for SQL migrations.
|
|
8
7
|
*
|
package/dist/migration.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/sql-migration.ts"],"
|
|
1
|
+
{"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/sql-migration.ts"],"mappings":";;;;;;AAkBA;;;;;;;;;;;;uBAAsB,YAAA,kBACH,oBAAA,6CAET,SAAA,CAAU,yBAAA,CAA0B,QAAA,UAAkB,SAAA;EAAtD;;;;;;;;;;EAAA,IAWJ,kBAAA,CAAA;AAAA"}
|
package/dist/migration.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { deriveProvidedInvariants } from "@prisma-next/migration-tools/invariants";
|
|
2
2
|
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
3
|
-
|
|
4
3
|
//#region src/core/sql-migration.ts
|
|
5
4
|
/**
|
|
6
5
|
* Family-owned base class for SQL migrations.
|
|
@@ -31,7 +30,7 @@ var SqlMigration = class extends Migration {
|
|
|
31
30
|
return deriveProvidedInvariants(this.operations);
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
|
|
35
33
|
//#endregion
|
|
36
34
|
export { SqlMigration as Migration };
|
|
35
|
+
|
|
37
36
|
//# sourceMappingURL=migration.mjs.map
|
package/dist/migration.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":["import { deriveProvidedInvariants } from '@prisma-next/migration-tools/invariants';\nimport { Migration } from '@prisma-next/migration-tools/migration';\nimport type { SqlMigrationPlanOperation, SqlPlanTargetDetails } from './migrations/types';\n\n/**\n * Family-owned base class for SQL migrations.\n *\n * Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)\n * and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).\n *\n * Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and\n * a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the\n * fully concrete operation shape. Target-free code in SQL family / tooling\n * parameterises over `TDetails` (and usually `TTargetId = string`).\n *\n * Keeps target-free contract/runtime features in the family layer while\n * letting adapters own target shape.\n */\nexport abstract class SqlMigration<\n TDetails extends SqlPlanTargetDetails,\n TTargetId extends string = string,\n> extends Migration<SqlMigrationPlanOperation<TDetails>, 'sql', TTargetId> {\n /**\n * Sorted, deduplicated invariant ids declared by this migration's\n * data-transform ops. Derived from `this.operations` so the field remains\n * consistent with the operation list — planner-built plans (`db init`,\n * `db update`) yield `[]` because they emit no data-transform ops.\n *\n * Required by `SqlMigrationPlan.providedInvariants` (tightened from\n * optional at the SQL-family layer); the framework-level\n * `MigrationPlan.providedInvariants?` stays optional.\n */\n get providedInvariants(): readonly string[] {\n return deriveProvidedInvariants(this.operations);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":["import { deriveProvidedInvariants } from '@prisma-next/migration-tools/invariants';\nimport { Migration } from '@prisma-next/migration-tools/migration';\nimport type { SqlMigrationPlanOperation, SqlPlanTargetDetails } from './migrations/types';\n\n/**\n * Family-owned base class for SQL migrations.\n *\n * Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)\n * and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).\n *\n * Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and\n * a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the\n * fully concrete operation shape. Target-free code in SQL family / tooling\n * parameterises over `TDetails` (and usually `TTargetId = string`).\n *\n * Keeps target-free contract/runtime features in the family layer while\n * letting adapters own target shape.\n */\nexport abstract class SqlMigration<\n TDetails extends SqlPlanTargetDetails,\n TTargetId extends string = string,\n> extends Migration<SqlMigrationPlanOperation<TDetails>, 'sql', TTargetId> {\n /**\n * Sorted, deduplicated invariant ids declared by this migration's\n * data-transform ops. Derived from `this.operations` so the field remains\n * consistent with the operation list — planner-built plans (`db init`,\n * `db update`) yield `[]` because they emit no data-transform ops.\n *\n * Required by `SqlMigrationPlan.providedInvariants` (tightened from\n * optional at the SQL-family layer); the framework-level\n * `MigrationPlan.providedInvariants?` stays optional.\n */\n get providedInvariants(): readonly string[] {\n return deriveProvidedInvariants(this.operations);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAsB,eAAtB,cAGU,UAAiE;;;;;;;;;;;CAWzE,IAAI,qBAAwC;EAC1C,OAAO,yBAAyB,KAAK,WAAW"}
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"mappings":";cAIM,aAAA;EAAA"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-
|
|
2
|
-
|
|
1
|
+
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-F4JpCJl7.mjs";
|
|
3
2
|
//#region src/exports/pack.ts
|
|
4
3
|
const sqlFamilyPack = {
|
|
5
4
|
kind: "family",
|
|
@@ -11,8 +10,7 @@ const sqlFamilyPack = {
|
|
|
11
10
|
type: sqlFamilyAuthoringTypes
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
|
-
var pack_default = sqlFamilyPack;
|
|
15
|
-
|
|
16
13
|
//#endregion
|
|
17
|
-
export {
|
|
14
|
+
export { sqlFamilyPack as default };
|
|
15
|
+
|
|
18
16
|
//# sourceMappingURL=pack.mjs.map
|
package/dist/pack.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import type { FamilyPackRef } from '@prisma-next/framework-components/components';\nimport { sqlFamilyAuthoringFieldPresets } from '../core/authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from '../core/authoring-type-constructors';\n\nconst sqlFamilyPack = {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n authoring: {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n },\n} as const satisfies FamilyPackRef<'sql'>;\n\nexport default sqlFamilyPack;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import type { FamilyPackRef } from '@prisma-next/framework-components/components';\nimport { sqlFamilyAuthoringFieldPresets } from '../core/authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from '../core/authoring-type-constructors';\n\nconst sqlFamilyPack = {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n authoring: {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n },\n} as const satisfies FamilyPackRef<'sql'>;\n\nexport default sqlFamilyPack;\n"],"mappings":";;AAIA,MAAM,gBAAgB;CACpB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACT,OAAO;EACP,MAAM;EACP;CACF"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { RuntimeMutationDefaultGenerator } from "@prisma-next/sql-runtime";
|
|
|
2
2
|
import { RuntimeFamilyDescriptor, RuntimeFamilyInstance } from "@prisma-next/framework-components/execution";
|
|
3
3
|
|
|
4
4
|
//#region src/core/runtime-instance.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* SQL execution-plane family instance interface.
|
|
8
7
|
*
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts"],"
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts"],"mappings":";;;;;;;AAUA;;;;;UAAiB,wBAAA,SAAiC,qBAAA;;;;;AAAlD;;;;;;cCCa,0BAAA,EAA4B,uBAAA,QAA+B,wBAAA;;;;;;ADDxE;;;;;;;;ACCA;;;iBCMgB,4BAAA,CAAA,GAAgC,+BAAA"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-
|
|
2
|
-
|
|
1
|
+
import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-BWp8S2sa.mjs";
|
|
3
2
|
//#region src/core/runtime-instance.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates a SQL execution-plane family instance.
|
|
@@ -9,7 +8,6 @@ import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-Bt4L3
|
|
|
9
8
|
function createSqlRuntimeFamilyInstance() {
|
|
10
9
|
return { familyId: "sql" };
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
12
|
//#region src/core/runtime-descriptor.ts
|
|
15
13
|
/**
|
|
@@ -30,7 +28,6 @@ const sqlRuntimeFamilyDescriptor = {
|
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
30
|
Object.freeze(sqlRuntimeFamilyDescriptor);
|
|
33
|
-
|
|
34
31
|
//#endregion
|
|
35
32
|
//#region src/core/timestamp-now-runtime-generator.ts
|
|
36
33
|
/**
|
|
@@ -54,11 +51,10 @@ function timestampNowRuntimeGenerator() {
|
|
|
54
51
|
stability: "query"
|
|
55
52
|
};
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
//#endregion
|
|
59
55
|
//#region src/exports/runtime.ts
|
|
60
56
|
var runtime_default = sqlRuntimeFamilyDescriptor;
|
|
61
|
-
|
|
62
57
|
//#endregion
|
|
63
58
|
export { runtime_default as default, timestampNowRuntimeGenerator };
|
|
59
|
+
|
|
64
60
|
//# sourceMappingURL=runtime.mjs.map
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts","../src/exports/runtime.ts"],"sourcesContent":["import type { RuntimeFamilyInstance } from '@prisma-next/framework-components/execution';\n\n/**\n * SQL execution-plane family instance interface.\n *\n * Note: this is currently named `SqlRuntimeFamilyInstance` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyInstance`, etc.).\n *\n * This will be renamed to `SqlExecutionFamilyInstance` as part of `TML-1842`.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}\n\n/**\n * Creates a SQL execution-plane family instance.\n *\n * This will be renamed to `createSqlExecutionFamilyInstance()` as part of `TML-1842`.\n */\nexport function createSqlRuntimeFamilyInstance(): SqlRuntimeFamilyInstance {\n return {\n familyId: 'sql' as const,\n };\n}\n","import type { RuntimeFamilyDescriptor } from '@prisma-next/framework-components/execution';\nimport { createSqlRuntimeFamilyInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';\n\n/**\n * SQL execution-plane family descriptor.\n *\n * Note: this is currently named `sqlRuntimeFamilyDescriptor` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyDescriptor`, etc.).\n *\n * This will be renamed to `sqlExecutionFamilyDescriptor` as part of `TML-1842`.\n */\nexport const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> =\n {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n create() {\n return createSqlRuntimeFamilyInstance();\n },\n };\n\nObject.freeze(sqlRuntimeFamilyDescriptor);\n","import type { RuntimeMutationDefaultGenerator } from '@prisma-next/sql-runtime';\nimport { TIMESTAMP_NOW_GENERATOR_ID } from './timestamp-now-generator';\n\n/**\n * Builds the canonical runtime-plane generator for the wall-clock-now\n * mutation default. Returns `new Date()`; semantics are target-agnostic\n * so all SQL targets share this single implementation.\n *\n * Declares `stability: 'query'` so a single ORM bulk operation\n * (e.g. `createAll([...])`) shares one timestamp across every row and\n * every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`\n * semantics: one `new Date()` per lowered mutation, not per row.\n *\n * Lives in a runtime-plane-only module so the control-plane\n * `timestamp-now-generator.ts` (descriptor + authoring presets) stays\n * free of `@prisma-next/sql-runtime` imports.\n */\nexport function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n generate: () => new Date(),\n stability: 'query',\n };\n}\n","import { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\nexport { timestampNowRuntimeGenerator } from '../core/timestamp-now-runtime-generator';\n\nexport default sqlRuntimeFamilyDescriptor;\n"],"mappings":";;;;;;;AAiBA,SAAgB,iCAA2D;CACzE,OAAO,EACL,UAAU,OACX;;;;;;;;;;;;ACTH,MAAa,6BACX;CACE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,SAAS;EACP,OAAO,gCAAgC;;CAE1C;AAEH,OAAO,OAAO,2BAA2B;;;;;;;;;;;;;;;;;ACLzC,SAAgB,+BAAgE;CAC9E,OAAO;EACL,IAAI;EACJ,gCAAgB,IAAI,MAAM;EAC1B,WAAW;EACZ;;;;AClBH,IAAA,kBAAe"}
|
package/dist/schema-verify.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-
|
|
2
|
-
import { i as ComponentDatabaseDependency } from "./types-
|
|
1
|
+
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-CPHiuYHR.mjs";
|
|
2
|
+
import { i as ComponentDatabaseDependency } from "./types-CIdiS2QK.mjs";
|
|
3
3
|
import { SchemaIssue, SchemaVerificationNode } from "@prisma-next/framework-components/control";
|
|
4
4
|
import { SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
|
-
|
|
6
5
|
//#region src/core/schema-verify/verify-helpers.d.ts
|
|
7
|
-
|
|
8
6
|
/**
|
|
9
7
|
* Compares two arrays of strings for equality (order-sensitive).
|
|
10
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"
|
|
1
|
+
{"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"mappings":";;;;;;;;iBA0BgB,WAAA,CAAY,CAAA,qBAAsB,CAAA;AA+BlD;;;;;;;;;;;AA0BA;AA1BA,iBAAgB,2BAAA,CACd,OAAA,WAAkB,WAAA,IAClB,OAAA,WAAkB,UAAA,IAClB,OAAA;;;;;;;;;;AAoaF;;;iBA7YgB,gBAAA,CACd,OAAA,WAAkB,UAAA,IAClB,OAAA,WAAkB,WAAA,IAClB,OAAA;;;;;;;;iBA0Yc,0BAAA,CACd,YAAA,EAAc,aAAA,CAAc,2BAAA,YAC5B,MAAA,EAAQ,WAAA,EACR,MAAA,EAAQ,WAAA,KACP,sBAAA"}
|
package/dist/schema-verify.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-
|
|
2
|
-
|
|
3
|
-
export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };
|
|
1
|
+
import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-C84vejAP.mjs";
|
|
2
|
+
export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };
|
package/dist/test-utils.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
|
|
2
|
-
|
|
3
|
-
export { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports };
|
|
2
|
+
export { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports };
|
|
@@ -80,7 +80,7 @@ function temporalAuthoringPresets(input) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
|
|
84
83
|
//#endregion
|
|
85
84
|
export { temporalAuthoringPresets as n, timestampNowControlDescriptor as r, TIMESTAMP_NOW_GENERATOR_ID as t };
|
|
86
|
-
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=timestamp-now-generator-BWp8S2sa.mjs.map
|
package/dist/{timestamp-now-generator-Bt4L3cfM.mjs.map → timestamp-now-generator-BWp8S2sa.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestamp-now-generator-
|
|
1
|
+
{"version":3,"file":"timestamp-now-generator-BWp8S2sa.mjs","names":[],"sources":["../src/core/timestamp-now-generator.ts"],"sourcesContent":["import type { AuthoringFieldPresetDescriptor } from '@prisma-next/framework-components/authoring';\nimport type { MutationDefaultGeneratorDescriptor } from '@prisma-next/framework-components/control';\n\n/**\n * Canonical id for the wall-clock-now mutation default generator.\n *\n * Owned by `family-sql` because that's where the generator lives. The\n * id flows out from here to (1) the control-plane descriptor and the\n * temporal field-preset pair below, (2) the runtime-plane sibling\n * `timestamp-now-runtime-generator.ts`, and (3) authoring surfaces\n * (PSL `temporal.updatedAt()`, TS `field.temporal.updatedAt()`) via\n * the descriptor flow. Co-locating the constant with its only owner\n * keeps the framework layer free of concrete generator ids.\n */\nexport const TIMESTAMP_NOW_GENERATOR_ID = 'timestampNow' as const;\n\n/**\n * Builds the canonical control-plane descriptor for the wall-clock-now\n * mutation default generator. The descriptor's `id` and `buildPhases`\n * are target-agnostic so PSL `temporal.updatedAt()` and TS\n * `field.temporal.updatedAt()` lower to byte-identical contracts.\n *\n * `applicableCodecIds` is omitted: `timestampNow` is preset-only (not\n * reachable via `@default(timestampNow())` lowering), and the codec is\n * co-registered by the preset descriptor itself, so the\n * `@default(...)` compatibility check has no role to play here.\n */\nexport function timestampNowControlDescriptor(): MutationDefaultGeneratorDescriptor {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n buildPhases: () => ({\n onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n }),\n };\n}\n\n/**\n * Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair\n * for a SQL target. `createdAt` lowers to a `now()` storage default;\n * `updatedAt` lowers to the `timestampNow` execution generator on both\n * `onCreate` and `onUpdate` (RD: \"last modified time\", non-null). Targets\n * supply the codec/native-type pair that matches their timestamp column;\n * everything else is shared so PSL `temporal.updatedAt()` and TS\n * `field.temporal.updatedAt()` lower to byte-identical contracts across\n * targets by construction.\n */\nexport function temporalAuthoringPresets<\n const CodecId extends string,\n const NativeType extends string,\n>(input: { readonly codecId: CodecId; readonly nativeType: NativeType }) {\n const { codecId, nativeType } = input;\n return {\n createdAt: {\n kind: 'fieldPreset',\n output: {\n codecId,\n nativeType,\n default: { kind: 'function', expression: 'now()' },\n },\n },\n updatedAt: {\n kind: 'fieldPreset',\n output: {\n codecId,\n nativeType,\n executionDefaults: {\n onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n },\n },\n },\n } as const satisfies Record<string, AuthoringFieldPresetDescriptor>;\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,6BAA6B;;;;;;;;;;;;AAa1C,SAAgB,gCAAoE;CAClF,OAAO;EACL,IAAI;EACJ,oBAAoB;GAClB,UAAU;IAAE,MAAM;IAAa,IAAI;IAA4B;GAC/D,UAAU;IAAE,MAAM;IAAa,IAAI;IAA4B;GAChE;EACF;;;;;;;;;;;;AAaH,SAAgB,yBAGd,OAAuE;CACvE,MAAM,EAAE,SAAS,eAAe;CAChC,OAAO;EACL,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,SAAS;KAAE,MAAM;KAAY,YAAY;KAAS;IACnD;GACF;EACD,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,mBAAmB;KACjB,UAAU;MAAE,MAAM;MAAa,IAAI;MAA4B;KAC/D,UAAU;MAAE,MAAM;MAAa,IAAI;MAA4B;KAChE;IACF;GACF;EACF"}
|
|
@@ -3,7 +3,7 @@ import { Result } from "@prisma-next/utils/result";
|
|
|
3
3
|
import { Contract } from "@prisma-next/contract/types";
|
|
4
4
|
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
5
|
import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
|
|
6
|
-
import { SqlStorage, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
6
|
+
import { SqlStorage, StorageColumn, StorageTable, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
7
7
|
import { TypesImportSpec } from "@prisma-next/framework-components/emission";
|
|
8
8
|
import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
|
|
9
9
|
import { SqlOperationDescriptor } from "@prisma-next/sql-operations";
|
|
@@ -43,6 +43,21 @@ interface SqlControlFamilyInstance extends ControlFamilyInstance<'sql', SqlSchem
|
|
|
43
43
|
readonly configPath?: string;
|
|
44
44
|
}): Promise<VerifyDatabaseResult>;
|
|
45
45
|
schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Verify a contract against an already-introspected schema slice.
|
|
48
|
+
*
|
|
49
|
+
* Used by the aggregate verifier to invoke per-member verification
|
|
50
|
+
* with the live schema pre-projected to the member's claimed slice
|
|
51
|
+
* via `projectSchemaToSpace`. Closes F23 — without per-member
|
|
52
|
+
* pre-projection, single-contract verifiers see other-space tables
|
|
53
|
+
* as `extras`.
|
|
54
|
+
*/
|
|
55
|
+
schemaVerifyAgainstSchema(options: {
|
|
56
|
+
readonly contract: unknown;
|
|
57
|
+
readonly schema: SqlSchemaIR;
|
|
58
|
+
readonly strict: boolean;
|
|
59
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
60
|
+
}): VerifyDatabaseSchemaResult;
|
|
46
61
|
sign(options: {
|
|
47
62
|
readonly driver: ControlDriverInstance<'sql', string>;
|
|
48
63
|
readonly contract: unknown;
|
|
@@ -95,6 +110,39 @@ interface ResolveIdentityValueInput {
|
|
|
95
110
|
readonly codecId?: string;
|
|
96
111
|
readonly typeParams?: Record<string, unknown>;
|
|
97
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Per-field lifecycle event a codec hook can react to.
|
|
115
|
+
*
|
|
116
|
+
* Fired during app-space migration emission as the SQL family diffs the
|
|
117
|
+
* prior contract against the new contract.
|
|
118
|
+
*
|
|
119
|
+
* - `'added'` — the field is present in the new contract but not the prior.
|
|
120
|
+
* - `'dropped'` — the field is present in the prior contract but not the new.
|
|
121
|
+
* - `'altered'` — the field is present in both and any property other than
|
|
122
|
+
* `codecId` differs. Codec-id changes are a v1 non-goal:
|
|
123
|
+
* when only `codecId` differs, no `'altered'` event fires.
|
|
124
|
+
*/
|
|
125
|
+
type FieldEvent = 'added' | 'dropped' | 'altered';
|
|
126
|
+
/**
|
|
127
|
+
* Context passed to {@link CodecControlHooks.onFieldEvent}.
|
|
128
|
+
*
|
|
129
|
+
* `tableName` and `fieldName` are always populated; `priorTable` /
|
|
130
|
+
* `priorField` carry the prior contract's view of the table and column
|
|
131
|
+
* (present for `'dropped'` and `'altered'`); `newTable` / `newField`
|
|
132
|
+
* carry the new contract's view (present for `'added'` and `'altered'`).
|
|
133
|
+
*
|
|
134
|
+
* The hook only ever receives app-space contract IR — extension-space
|
|
135
|
+
* fields are scoped out by the API: the hook is wired at the
|
|
136
|
+
* application emitter only.
|
|
137
|
+
*/
|
|
138
|
+
interface FieldEventContext {
|
|
139
|
+
readonly tableName: string;
|
|
140
|
+
readonly fieldName: string;
|
|
141
|
+
readonly priorTable?: StorageTable;
|
|
142
|
+
readonly newTable?: StorageTable;
|
|
143
|
+
readonly priorField?: StorageColumn;
|
|
144
|
+
readonly newField?: StorageColumn;
|
|
145
|
+
}
|
|
98
146
|
interface CodecControlHooks<TTargetDetails = unknown> {
|
|
99
147
|
planTypeOperations?: (options: {
|
|
100
148
|
readonly typeName: string;
|
|
@@ -135,6 +183,18 @@ interface CodecControlHooks<TTargetDetails = unknown> {
|
|
|
135
183
|
* - undefined: no opinion; planner may use built-in fallbacks
|
|
136
184
|
*/
|
|
137
185
|
resolveIdentityValue?: (input: ResolveIdentityValueInput) => string | null | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Reacts to per-field added / dropped / altered events as the app-space
|
|
188
|
+
* emitter diffs the prior contract against the new contract. Returned
|
|
189
|
+
* ops are inlined into the app-space migration's `ops.json` alongside
|
|
190
|
+
* the user's structural ops.
|
|
191
|
+
*
|
|
192
|
+
* Synchronous. Each returned op must carry its own `invariantId`. Hooks
|
|
193
|
+
* are dispatched per `(table, field)` based on the field's `codecId`
|
|
194
|
+
* (the new field's codec for `'added'` / `'altered'`; the prior field's
|
|
195
|
+
* codec for `'dropped'`).
|
|
196
|
+
*/
|
|
197
|
+
onFieldEvent?: (event: FieldEvent, ctx: FieldEventContext) => readonly SqlMigrationPlanOperation<TTargetDetails>[];
|
|
138
198
|
}
|
|
139
199
|
interface SqlControlExtensionDescriptor<TTargetId extends string> extends ControlExtensionDescriptor<'sql', TTargetId> {
|
|
140
200
|
readonly databaseDependencies?: ComponentDatabaseDependencies<unknown>;
|
|
@@ -303,6 +363,14 @@ interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails> {
|
|
|
303
363
|
interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
|
|
304
364
|
readonly plan: SqlMigrationPlan<TTargetDetails>;
|
|
305
365
|
readonly driver: ControlDriverInstance<'sql', string>;
|
|
366
|
+
/**
|
|
367
|
+
* Logical contract space this plan applies to. When omitted the
|
|
368
|
+
* runner derives the space from {@link SqlMigrationPlan.spaceId};
|
|
369
|
+
* when supplied, the runner asserts it matches `plan.spaceId` so a
|
|
370
|
+
* caller cannot accidentally write the marker row for a different
|
|
371
|
+
* space than the plan was produced for.
|
|
372
|
+
*/
|
|
373
|
+
readonly space?: string;
|
|
306
374
|
/**
|
|
307
375
|
* Destination contract IR.
|
|
308
376
|
* Must correspond to `plan.destination` and is used for schema verification and marker/ledger writes.
|
|
@@ -337,8 +405,54 @@ interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
|
|
|
337
405
|
interface SqlMigrationRunnerSuccessValue extends MigrationRunnerSuccessValue {}
|
|
338
406
|
type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
|
|
339
407
|
interface SqlMigrationRunner<TTargetDetails> {
|
|
408
|
+
/**
|
|
409
|
+
* Apply a single migration plan, opening and managing its own
|
|
410
|
+
* transaction (and any target-specific connection-level setup, e.g.
|
|
411
|
+
* SQLite's `PRAGMA foreign_keys` toggle). Existing single-space
|
|
412
|
+
* callers route through here.
|
|
413
|
+
*/
|
|
340
414
|
execute(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
|
|
415
|
+
/**
|
|
416
|
+
* Apply a single migration plan against an already-open connection
|
|
417
|
+
* **without** opening a transaction. The caller is responsible for
|
|
418
|
+
* wrapping the call (and any siblings) in `BEGIN` / `COMMIT` /
|
|
419
|
+
* `ROLLBACK`. Used by the per-space runner wiring to fan out across
|
|
420
|
+
* contract spaces inside one outer transaction so a mid-apply
|
|
421
|
+
* failure rolls back every space's writes.
|
|
422
|
+
*
|
|
423
|
+
* Idempotent control-table setup (`prisma_contract.*`) and marker
|
|
424
|
+
* writes use `options.space` to address the per-space marker row.
|
|
425
|
+
*/
|
|
426
|
+
executeOnConnection(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
|
|
427
|
+
/**
|
|
428
|
+
* Apply per-space plans across multiple contract spaces inside a
|
|
429
|
+
* single outer transaction. The caller orders the input list
|
|
430
|
+
* (typically via the aggregate planner's `applyOrder`: extensions
|
|
431
|
+
* alphabetical, then app); the runner is responsible for opening
|
|
432
|
+
* / committing the outer
|
|
433
|
+
* transaction (and any target-specific connection-level setup such
|
|
434
|
+
* as the SQLite FK pragma toggle). A failure on any space rolls
|
|
435
|
+
* back every space's writes.
|
|
436
|
+
*
|
|
437
|
+
* Each space's `SqlMigrationRunnerExecuteOptions` must reference the
|
|
438
|
+
* same `driver` (the connection the outer transaction is open on).
|
|
439
|
+
* Per-space marker writes use `options.space` to address the row.
|
|
440
|
+
*/
|
|
441
|
+
executeAcrossSpaces(options: {
|
|
442
|
+
readonly driver: ControlDriverInstance<'sql', string>;
|
|
443
|
+
readonly perSpaceOptions: ReadonlyArray<SqlMigrationRunnerExecuteOptions<TTargetDetails>>;
|
|
444
|
+
}): Promise<MultiSpaceRunnerResult>;
|
|
445
|
+
}
|
|
446
|
+
interface MultiSpaceRunnerSuccessValue {
|
|
447
|
+
readonly perSpaceResults: ReadonlyArray<{
|
|
448
|
+
readonly space: string;
|
|
449
|
+
readonly value: SqlMigrationRunnerSuccessValue;
|
|
450
|
+
}>;
|
|
451
|
+
}
|
|
452
|
+
interface MultiSpaceRunnerFailure extends SqlMigrationRunnerFailure {
|
|
453
|
+
readonly failingSpace: string;
|
|
341
454
|
}
|
|
455
|
+
type MultiSpaceRunnerResult = Result<MultiSpaceRunnerSuccessValue, MultiSpaceRunnerFailure>;
|
|
342
456
|
interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails> extends MigratableTargetDescriptor<'sql', TTargetId, SqlControlFamilyInstance> {
|
|
343
457
|
readonly queryOperations?: () => ReadonlyArray<SqlOperationDescriptor>;
|
|
344
458
|
createPlanner(family: SqlControlFamilyInstance): SqlMigrationPlanner<TTargetDetails>;
|
|
@@ -362,5 +476,5 @@ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
|
|
|
362
476
|
readonly meta?: AnyRecord;
|
|
363
477
|
}
|
|
364
478
|
//#endregion
|
|
365
|
-
export {
|
|
366
|
-
//# sourceMappingURL=types-
|
|
479
|
+
export { SqlPlanTargetDetails as A, SchemaVerifyOptions as B, SqlMigrationRunner as C, SqlMigrationRunnerFailure as D, SqlMigrationRunnerExecuteOptions as E, SqlPlannerResult as F, SqlPlannerSuccessResult as I, StorageTypePlanResult as L, SqlPlannerConflictKind as M, SqlPlannerConflictLocation as N, SqlMigrationRunnerResult as O, SqlPlannerFailureResult as P, collectInitDependencies as R, SqlMigrationPlannerPlanOptions as S, SqlMigrationRunnerExecuteCallbacks as T, SqlControlFamilyInstance as V, SqlMigrationPlanContractInfo as _, CreateSqlMigrationPlanOptions as a, SqlMigrationPlanOperationTarget as b, FieldEventContext as c, MultiSpaceRunnerSuccessValue as d, ResolveIdentityValueInput as f, SqlMigrationPlan as g, SqlControlTargetDescriptor as h, ComponentDatabaseDependency as i, SqlPlannerConflict as j, SqlMigrationRunnerSuccessValue as k, MultiSpaceRunnerFailure as l, SqlControlExtensionDescriptor as m, CodecControlHooks as n, ExpandNativeTypeInput as o, SqlControlAdapterDescriptor as p, ComponentDatabaseDependencies as r, FieldEvent as s, AnyRecord as t, MultiSpaceRunnerResult as u, SqlMigrationPlanOperation as v, SqlMigrationRunnerErrorCode as w, SqlMigrationPlanner as x, SqlMigrationPlanOperationStep as y, isDatabaseDependencyProvider as z };
|
|
480
|
+
//# sourceMappingURL=types-CIdiS2QK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CIdiS2QK.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/migrations/types.ts"],"mappings":";;;;;;;;;;;UAkKU,eAAA;EAAA,SACC,MAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGN,uBAAA,GAA0B,GAAA,SAAY,eAAA;AAAA,UAEjC,sBAAA;EAAA,SACC,gBA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,EAAiB,aAAA;IAAA,SACf,KAAA;IAAA,SACA,KAAA,EAAO,8BAAA;EAAA;AAAA;AAAA,UAIH,uBAAA,SAAgC,yBAAA;EAAA,SACtC,YAAA;AAAA;AAAA,KAGC,sBAAA,GAAyB,MAAA,CAAO,4BAAA,EAA8B,uBAAA;AAAA,UAEzD,0BAAA,mDACP,0BAAA,QAAkC,SAAA,EAAW,wBAAA;EAAA,SAC5C,eAAA,SAAwB,aAAA,CAAc,sBAAA;EAC/C,aAAA,CAAc,MAAA,EAAQ,wBAAA,GAA2B,mBAAA,CAAoB,cAAA;EACrE,YAAA,CAAa,MAAA,EAAQ,wBAAA,GAA2B,kBAAA,CAAmB,cAAA;AAAA;AAAA,UAGpD,6BAAA;EAAA,SACN,QAAA;EArSA;;;EAAA,SAySA,OAAA;EAAA,SACA,MAAA,GAAS,4BAAA;EAAA,SACT,WAAA,EAAa,4BAAA;EAAA,SACb,UAAA,WAAqB,yBAAA,CAA0B,cAAA;EAxRrB;;;;AAKrC;EALqC,SA8R1B,kBAAA;EAAA,SACA,IAAA,GAAO,SAAA;AAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
|
|
3
2
|
//#region src/core/verify.ts
|
|
4
3
|
const MetaSchema = type({ "[string]": "unknown" });
|
|
5
4
|
function parseMeta(meta) {
|
|
@@ -76,7 +75,7 @@ function parseContractMarkerRow(row) {
|
|
|
76
75
|
function collectSupportedCodecTypeIds(descriptors) {
|
|
77
76
|
return [];
|
|
78
77
|
}
|
|
79
|
-
|
|
80
78
|
//#endregion
|
|
81
79
|
export { parseContractMarkerRow as n, collectSupportedCodecTypeIds as t };
|
|
82
|
-
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=verify-pRYxnpiG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-pRYxnpiG.mjs","names":[],"sources":["../src/core/verify.ts"],"sourcesContent":["import type { ContractMarkerRecord } from '@prisma-next/contract/types';\nimport { type } from 'arktype';\n\nconst MetaSchema = type({ '[string]': 'unknown' });\n\nfunction parseMeta(meta: unknown): Record<string, unknown> {\n if (meta === null || meta === undefined) {\n return {};\n }\n\n let parsed: unknown;\n if (typeof meta === 'string') {\n try {\n parsed = JSON.parse(meta);\n } catch {\n return {};\n }\n } else {\n parsed = meta;\n }\n\n const result = MetaSchema(parsed);\n if (result instanceof type.errors) {\n return {};\n }\n\n return result as Record<string, unknown>;\n}\n\n/**\n * SQLite stores `contract_json` as TEXT, so the wire shape is a JSON string;\n * Postgres uses `jsonb` and returns an already-parsed value. Normalize both\n * here so `ContractMarkerRecord.contractJson` is always the structured form.\n */\nfunction parseContractJson(value: unknown): unknown {\n if (value === null || value === undefined) return null;\n if (typeof value !== 'string') return value;\n try {\n return JSON.parse(value);\n } catch {\n return null;\n }\n}\n\n/**\n * Wire shape of a `prisma_contract.marker` row as it comes out of a SQL\n * driver. Snake-cased to match the on-disk column names. Shared by every\n * SQL target's `readMarker` so each runner doesn't redeclare it inline.\n */\nexport type ContractMarkerRow = {\n core_hash: string;\n profile_hash: string;\n contract_json: unknown | null;\n canonical_version: number | null;\n updated_at: Date | string;\n app_tag: string | null;\n meta: unknown | null;\n // SQLite stores arrays as JSON-TEXT, so this is `string` on the wire from\n // a SQLite driver and `string[]` from a Postgres driver. Targets normalize\n // before passing to `parseContractMarkerRow`.\n invariants: unknown;\n};\n\nconst ContractMarkerRowSchema = type({\n core_hash: 'string',\n profile_hash: 'string',\n 'contract_json?': 'unknown | null',\n 'canonical_version?': 'number | null',\n 'updated_at?': 'Date | string',\n 'app_tag?': 'string | null',\n 'meta?': 'unknown | null',\n invariants: type('string').array(),\n});\n\n/**\n * Parses a contract marker row from database query result.\n * This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).\n */\nexport function parseContractMarkerRow(row: unknown): ContractMarkerRecord {\n const result = ContractMarkerRowSchema(row);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Invalid contract marker row: ${messages}`);\n }\n\n const updatedAt = result.updated_at\n ? result.updated_at instanceof Date\n ? result.updated_at\n : new Date(result.updated_at)\n : new Date();\n\n return {\n storageHash: result.core_hash,\n profileHash: result.profile_hash,\n contractJson: parseContractJson(result.contract_json),\n canonicalVersion: result.canonical_version ?? null,\n updatedAt,\n appTag: result.app_tag ?? null,\n meta: parseMeta(result.meta),\n invariants: result.invariants,\n };\n}\n\n/**\n * Collects supported codec type IDs from adapter and extension manifests.\n * Returns a sorted, unique array of type IDs that are declared in the manifests.\n * This enables coverage checks by comparing contract column types against supported types.\n *\n * Note: This extracts type IDs from manifest type imports, not from runtime codec registries.\n * The manifests declare which codec types are available, but the actual type IDs\n * are defined in the codec-types TypeScript modules that are imported.\n *\n * For MVP, we return an empty array since extracting type IDs from TypeScript modules\n * would require runtime evaluation or static analysis. This can be enhanced later.\n */\nexport function collectSupportedCodecTypeIds(\n descriptors: ReadonlyArray<{ readonly id: string }>,\n): readonly string[] {\n // For MVP, return empty array\n // Future enhancement: Extract type IDs from codec-types modules via static analysis\n // or require manifests to explicitly list supported type IDs\n void descriptors;\n return [];\n}\n"],"mappings":";;AAGA,MAAM,aAAa,KAAK,EAAE,YAAY,WAAW,CAAC;AAElD,SAAS,UAAU,MAAwC;CACzD,IAAI,SAAS,QAAQ,SAAS,KAAA,GAC5B,OAAO,EAAE;CAGX,IAAI;CACJ,IAAI,OAAO,SAAS,UAClB,IAAI;EACF,SAAS,KAAK,MAAM,KAAK;SACnB;EACN,OAAO,EAAE;;MAGX,SAAS;CAGX,MAAM,SAAS,WAAW,OAAO;CACjC,IAAI,kBAAkB,KAAK,QACzB,OAAO,EAAE;CAGX,OAAO;;;;;;;AAQT,SAAS,kBAAkB,OAAyB;CAClD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI;EACF,OAAO,KAAK,MAAM,MAAM;SAClB;EACN,OAAO;;;AAuBX,MAAM,0BAA0B,KAAK;CACnC,WAAW;CACX,cAAc;CACd,kBAAkB;CAClB,sBAAsB;CACtB,eAAe;CACf,YAAY;CACZ,SAAS;CACT,YAAY,KAAK,SAAS,CAAC,OAAO;CACnC,CAAC;;;;;AAMF,SAAgB,uBAAuB,KAAoC;CACzE,MAAM,SAAS,wBAAwB,IAAI;CAC3C,IAAI,kBAAkB,KAAK,QAAQ;EACjC,MAAM,WAAW,OAAO,KAAK,MAA2B,EAAE,QAAQ,CAAC,KAAK,KAAK;EAC7E,MAAM,IAAI,MAAM,gCAAgC,WAAW;;CAG7D,MAAM,YAAY,OAAO,aACrB,OAAO,sBAAsB,OAC3B,OAAO,aACP,IAAI,KAAK,OAAO,WAAW,mBAC7B,IAAI,MAAM;CAEd,OAAO;EACL,aAAa,OAAO;EACpB,aAAa,OAAO;EACpB,cAAc,kBAAkB,OAAO,cAAc;EACrD,kBAAkB,OAAO,qBAAqB;EAC9C;EACA,QAAQ,OAAO,WAAW;EAC1B,MAAM,UAAU,OAAO,KAAK;EAC5B,YAAY,OAAO;EACpB;;;;;;;;;;;;;;AAeH,SAAgB,6BACd,aACmB;CAKnB,OAAO,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assertUniqueCodecOwner } from "@prisma-next/framework-components/control";
|
|
2
2
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
3
|
-
|
|
4
3
|
//#region src/core/assembly.ts
|
|
5
4
|
function hasCodecControlHooks(descriptor) {
|
|
6
5
|
if (typeof descriptor !== "object" || descriptor === null) return false;
|
|
@@ -28,7 +27,6 @@ function extractCodecControlHooks(descriptors) {
|
|
|
28
27
|
}
|
|
29
28
|
return hooks;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
//#region src/core/migrations/types.ts
|
|
34
32
|
function isDatabaseDependencyProvider(value) {
|
|
@@ -44,7 +42,6 @@ function collectInitDependencies(components) {
|
|
|
44
42
|
}
|
|
45
43
|
return result;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
//#endregion
|
|
49
46
|
//#region src/core/schema-verify/verify-helpers.ts
|
|
50
47
|
/**
|
|
@@ -453,7 +450,6 @@ function getReferentialActionMismatches(contractFK, schemaFK) {
|
|
|
453
450
|
function normalizeReferentialAction(action) {
|
|
454
451
|
return action === "noAction" ? void 0 : action;
|
|
455
452
|
}
|
|
456
|
-
|
|
457
453
|
//#endregion
|
|
458
454
|
//#region src/core/schema-verify/verify-sql-schema.ts
|
|
459
455
|
/**
|
|
@@ -1123,7 +1119,7 @@ function formatLiteralValue(value) {
|
|
|
1123
1119
|
if (typeof value === "string") return value;
|
|
1124
1120
|
return JSON.stringify(value);
|
|
1125
1121
|
}
|
|
1126
|
-
|
|
1127
1122
|
//#endregion
|
|
1128
1123
|
export { verifyDatabaseDependencies as a, extractCodecControlHooks as c, isUniqueConstraintSatisfied as i, arraysEqual as n, collectInitDependencies as o, isIndexSatisfied as r, isDatabaseDependencyProvider as s, verifySqlSchema as t };
|
|
1129
|
-
|
|
1124
|
+
|
|
1125
|
+
//# sourceMappingURL=verify-sql-schema-C84vejAP.mjs.map
|