@prisma-next/family-sql 0.14.0-dev.9 → 0.14.0-dev.90
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-CjFfO6LM.mjs → authoring-type-constructors-CXd-8ydc.mjs} +7 -30
- package/dist/authoring-type-constructors-CXd-8ydc.mjs.map +1 -0
- package/dist/{control-adapter-Cmw9LvEP.d.mts → control-adapter-BQgad8Zc.d.mts} +30 -8
- package/dist/control-adapter-BQgad8Zc.d.mts.map +1 -0
- package/dist/control-adapter.d.mts +1 -1
- package/dist/control.d.mts +279 -34
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +378 -1005
- package/dist/control.mjs.map +1 -1
- package/dist/diff.d.mts +102 -0
- package/dist/diff.d.mts.map +1 -0
- package/dist/diff.mjs +14 -0
- package/dist/diff.mjs.map +1 -0
- package/dist/foreign-key-index-backing-BP71iI-Q.mjs +32 -0
- package/dist/foreign-key-index-backing-BP71iI-Q.mjs.map +1 -0
- package/dist/ir.d.mts +26 -9
- package/dist/ir.d.mts.map +1 -1
- package/dist/ir.mjs +2 -2
- package/dist/ir.mjs.map +1 -1
- package/dist/migration.d.mts +11 -2
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +7 -0
- package/dist/migration.mjs.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/psl-infer.d.mts +119 -0
- package/dist/psl-infer.d.mts.map +1 -0
- package/dist/psl-infer.mjs +366 -0
- package/dist/psl-infer.mjs.map +1 -0
- package/dist/schema-differ-DnoopSXm.d.mts +45 -0
- package/dist/schema-differ-DnoopSXm.d.mts.map +1 -0
- package/dist/schema-verify-W3r631Jh.mjs +226 -0
- package/dist/schema-verify-W3r631Jh.mjs.map +1 -0
- package/dist/{sql-contract-serializer-BR2vC7Z-.mjs → sql-contract-serializer-C75cfMSS.mjs} +46 -20
- package/dist/sql-contract-serializer-C75cfMSS.mjs.map +1 -0
- package/dist/{types-kgstZ_Zd.d.mts → types-BPv_y7iS.d.mts} +36 -142
- package/dist/types-BPv_y7iS.d.mts.map +1 -0
- package/package.json +26 -26
- package/src/core/authoring-entity-types.ts +12 -37
- package/src/core/control-adapter.ts +11 -5
- package/src/core/control-instance.ts +212 -42
- package/src/core/control-target-descriptor.ts +98 -0
- package/src/core/diff/schema-verify.ts +324 -0
- package/src/core/diff/sql-schema-diff.ts +41 -0
- package/src/core/diff/verifier-disposition.ts +30 -0
- package/src/core/foreign-key-index-backing.ts +37 -0
- package/src/core/ir/sql-contract-serializer-base.ts +70 -56
- package/src/core/ir/sql-contract-serializer.ts +5 -7
- package/src/core/ir/sql-schema-verifier-base.ts +5 -5
- package/src/core/migrations/contract-to-schema-ir.ts +141 -37
- package/src/core/migrations/control-policy.ts +66 -115
- package/src/core/migrations/field-event-planner.ts +2 -2
- package/src/core/migrations/native-type-expander.ts +28 -0
- package/src/core/migrations/schema-differ.ts +41 -0
- package/src/core/migrations/types.ts +33 -37
- package/src/core/psl-contract-infer/name-transforms.ts +15 -0
- package/src/core/psl-contract-infer/printer-config.ts +14 -6
- package/src/core/psl-contract-infer/relation-inference.ts +27 -1
- package/src/core/sql-migration.ts +12 -1
- package/src/exports/control.ts +12 -2
- package/src/exports/diff.ts +25 -0
- package/src/exports/psl-infer.ts +40 -0
- package/dist/authoring-type-constructors-CjFfO6LM.mjs.map +0 -1
- package/dist/control-adapter-Cmw9LvEP.d.mts.map +0 -1
- package/dist/schema-verify.d.mts +0 -39
- package/dist/schema-verify.d.mts.map +0 -1
- package/dist/schema-verify.mjs +0 -2
- package/dist/sql-contract-serializer-BR2vC7Z-.mjs.map +0 -1
- package/dist/test-utils.d.mts +0 -2
- package/dist/test-utils.mjs +0 -2
- package/dist/types-kgstZ_Zd.d.mts.map +0 -1
- package/dist/verify-sql-schema-thU-jKpf.d.mts +0 -66
- package/dist/verify-sql-schema-thU-jKpf.d.mts.map +0 -1
- package/dist/verify-sql-schema-xT4udQLQ.mjs +0 -1501
- package/dist/verify-sql-schema-xT4udQLQ.mjs.map +0 -1
- package/src/core/psl-contract-infer/postgres-default-mapping.ts +0 -16
- package/src/core/psl-contract-infer/postgres-type-map.ts +0 -157
- package/src/core/psl-contract-infer/sql-schema-ir-to-psl-ast.ts +0 -795
- package/src/core/schema-verify/control-verify-emit.ts +0 -46
- package/src/core/schema-verify/verifier-disposition.ts +0 -58
- package/src/core/schema-verify/verify-helpers.ts +0 -820
- package/src/core/schema-verify/verify-sql-schema.ts +0 -1311
- package/src/exports/schema-verify.ts +0 -18
- package/src/exports/test-utils.ts +0 -9
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ControlPolicy } from '@prisma-next/contract/types';
|
|
2
|
-
import type {
|
|
3
|
-
SchemaIssue,
|
|
4
|
-
SchemaVerificationNode,
|
|
5
|
-
VerifierOutcome,
|
|
6
|
-
} from '@prisma-next/framework-components/control';
|
|
7
|
-
import { verifierDisposition } from './verifier-disposition';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Grades `issue` under `controlPolicy` and, unless suppressed, pushes both the
|
|
11
|
-
* issue and a status-stamped verification node. Returns the resolved outcome so
|
|
12
|
-
* the caller never re-grades the same issue.
|
|
13
|
-
*/
|
|
14
|
-
export function emitIssueAndNodeUnderControlPolicy(
|
|
15
|
-
controlPolicy: ControlPolicy,
|
|
16
|
-
issue: SchemaIssue,
|
|
17
|
-
node: SchemaVerificationNode,
|
|
18
|
-
issues: SchemaIssue[],
|
|
19
|
-
nodes: SchemaVerificationNode[],
|
|
20
|
-
): VerifierOutcome {
|
|
21
|
-
const disposition = verifierDisposition(controlPolicy, issue.kind);
|
|
22
|
-
if (disposition === 'suppress') {
|
|
23
|
-
return disposition;
|
|
24
|
-
}
|
|
25
|
-
issues.push(issue);
|
|
26
|
-
nodes.push({ ...node, status: disposition });
|
|
27
|
-
return disposition;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Grades `issue` under `controlPolicy` and, unless suppressed, pushes the issue
|
|
32
|
-
* (no verification node). Returns the resolved outcome so the caller maps it to
|
|
33
|
-
* a node status itself without re-grading.
|
|
34
|
-
*/
|
|
35
|
-
export function emitIssueUnderControlPolicy(
|
|
36
|
-
controlPolicy: ControlPolicy,
|
|
37
|
-
issue: SchemaIssue,
|
|
38
|
-
issues: SchemaIssue[],
|
|
39
|
-
): VerifierOutcome {
|
|
40
|
-
const disposition = verifierDisposition(controlPolicy, issue.kind);
|
|
41
|
-
if (disposition === 'suppress') {
|
|
42
|
-
return disposition;
|
|
43
|
-
}
|
|
44
|
-
issues.push(issue);
|
|
45
|
-
return disposition;
|
|
46
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { ControlPolicy } from '@prisma-next/contract/types';
|
|
2
|
-
import type {
|
|
3
|
-
SchemaIssue,
|
|
4
|
-
VerifierIssueCategory,
|
|
5
|
-
VerifierOutcome,
|
|
6
|
-
} from '@prisma-next/framework-components/control';
|
|
7
|
-
import { dispositionForCategory } from '@prisma-next/framework-components/control';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Classifies the relational verifier issue kinds the SQL family emits (tables,
|
|
11
|
-
* columns, constraints, indexes, defaults, enum types) into the target-neutral
|
|
12
|
-
* categories the framework grades. The relational vocabulary lives here, in the
|
|
13
|
-
* SQL domain — the framework never switches over `extra_foreign_key` and friends.
|
|
14
|
-
*/
|
|
15
|
-
export function classifySqlVerifierIssueKind(kind: SchemaIssue['kind']): VerifierIssueCategory {
|
|
16
|
-
switch (kind) {
|
|
17
|
-
case 'extra_column':
|
|
18
|
-
return 'extraNestedElement';
|
|
19
|
-
case 'extra_primary_key':
|
|
20
|
-
case 'extra_foreign_key':
|
|
21
|
-
case 'extra_unique_constraint':
|
|
22
|
-
case 'extra_index':
|
|
23
|
-
case 'extra_validator':
|
|
24
|
-
case 'extra_default':
|
|
25
|
-
return 'extraAuxiliary';
|
|
26
|
-
case 'extra_table':
|
|
27
|
-
return 'extraTopLevelObject';
|
|
28
|
-
case 'missing_schema':
|
|
29
|
-
case 'missing_table':
|
|
30
|
-
case 'missing_column':
|
|
31
|
-
case 'type_missing':
|
|
32
|
-
case 'default_missing':
|
|
33
|
-
return 'declaredMissing';
|
|
34
|
-
case 'type_values_mismatch':
|
|
35
|
-
case 'enum_values_changed':
|
|
36
|
-
case 'check_mismatch':
|
|
37
|
-
return 'valueDrift';
|
|
38
|
-
case 'type_mismatch':
|
|
39
|
-
case 'nullability_mismatch':
|
|
40
|
-
case 'primary_key_mismatch':
|
|
41
|
-
case 'foreign_key_mismatch':
|
|
42
|
-
case 'unique_constraint_mismatch':
|
|
43
|
-
case 'index_mismatch':
|
|
44
|
-
case 'default_mismatch':
|
|
45
|
-
return 'declaredIncompatible';
|
|
46
|
-
case 'check_missing':
|
|
47
|
-
return 'declaredMissing';
|
|
48
|
-
case 'check_removed':
|
|
49
|
-
return 'extraAuxiliary';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function verifierDisposition(
|
|
54
|
-
controlPolicy: ControlPolicy,
|
|
55
|
-
issueKind: SchemaIssue['kind'],
|
|
56
|
-
): VerifierOutcome {
|
|
57
|
-
return dispositionForCategory(controlPolicy, classifySqlVerifierIssueKind(issueKind));
|
|
58
|
-
}
|