@prisma-next/cli 0.3.0-pr.99.6 → 0.3.0
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/LICENSE +201 -0
- package/README.md +381 -128
- package/dist/agent-skill-mongo.md +106 -0
- package/dist/agent-skill-postgres.md +106 -0
- package/dist/cli-errors-BDCYR5ap.mjs +4 -0
- package/dist/cli-errors-DStABy9d.d.mts +3 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.js +1 -2910
- package/dist/cli.mjs +261 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client-DiUkJAeN.mjs +987 -0
- package/dist/client-DiUkJAeN.mjs.map +1 -0
- package/dist/commands/contract-emit.d.mts +7 -0
- package/dist/commands/contract-emit.d.mts.map +1 -0
- package/dist/commands/contract-emit.mjs +9 -0
- package/dist/commands/contract-infer.d.mts +7 -0
- package/dist/commands/contract-infer.d.mts.map +1 -0
- package/dist/commands/contract-infer.mjs +10 -0
- package/dist/commands/db-init.d.mts +7 -0
- package/dist/commands/db-init.d.mts.map +1 -0
- package/dist/commands/db-init.mjs +126 -0
- package/dist/commands/db-init.mjs.map +1 -0
- package/dist/commands/db-schema.d.mts +7 -0
- package/dist/commands/db-schema.d.mts.map +1 -0
- package/dist/commands/db-schema.mjs +56 -0
- package/dist/commands/db-schema.mjs.map +1 -0
- package/dist/commands/db-sign.d.mts +7 -0
- package/dist/commands/db-sign.d.mts.map +1 -0
- package/dist/commands/db-sign.mjs +137 -0
- package/dist/commands/db-sign.mjs.map +1 -0
- package/dist/commands/db-update.d.mts +7 -0
- package/dist/commands/db-update.d.mts.map +1 -0
- package/dist/commands/db-update.mjs +123 -0
- package/dist/commands/db-update.mjs.map +1 -0
- package/dist/commands/db-verify.d.mts +7 -0
- package/dist/commands/db-verify.d.mts.map +1 -0
- package/dist/commands/db-verify.mjs +323 -0
- package/dist/commands/db-verify.mjs.map +1 -0
- package/dist/commands/migration-apply.d.mts +36 -0
- package/dist/commands/migration-apply.d.mts.map +1 -0
- package/dist/commands/migration-apply.mjs +245 -0
- package/dist/commands/migration-apply.mjs.map +1 -0
- package/dist/commands/migration-new.d.mts +8 -0
- package/dist/commands/migration-new.d.mts.map +1 -0
- package/dist/commands/migration-new.mjs +152 -0
- package/dist/commands/migration-new.mjs.map +1 -0
- package/dist/commands/migration-plan.d.mts +47 -0
- package/dist/commands/migration-plan.d.mts.map +1 -0
- package/dist/commands/migration-plan.mjs +313 -0
- package/dist/commands/migration-plan.mjs.map +1 -0
- package/dist/commands/migration-ref.d.mts +43 -0
- package/dist/commands/migration-ref.d.mts.map +1 -0
- package/dist/commands/migration-ref.mjs +195 -0
- package/dist/commands/migration-ref.mjs.map +1 -0
- package/dist/commands/migration-show.d.mts +28 -0
- package/dist/commands/migration-show.d.mts.map +1 -0
- package/dist/commands/migration-show.mjs +140 -0
- package/dist/commands/migration-show.mjs.map +1 -0
- package/dist/commands/migration-status.d.mts +86 -0
- package/dist/commands/migration-status.d.mts.map +1 -0
- package/dist/commands/migration-status.mjs +9 -0
- package/dist/commands/migration-verify.d.mts +16 -0
- package/dist/commands/migration-verify.d.mts.map +1 -0
- package/dist/commands/migration-verify.mjs +110 -0
- package/dist/commands/migration-verify.mjs.map +1 -0
- package/dist/config-loader-C4VXKl8f.mjs +43 -0
- package/dist/config-loader-C4VXKl8f.mjs.map +1 -0
- package/dist/{config-loader.d.ts → config-loader.d.mts} +8 -3
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +3 -0
- package/dist/contract-emit-D2wDXfyo.mjs +191 -0
- package/dist/contract-emit-D2wDXfyo.mjs.map +1 -0
- package/dist/contract-emit-Zm_sd1wQ.mjs +112 -0
- package/dist/contract-emit-Zm_sd1wQ.mjs.map +1 -0
- package/dist/contract-emit-kN-IkKTE.mjs +6 -0
- package/dist/contract-enrichment-CGW6mm-E.mjs +79 -0
- package/dist/contract-enrichment-CGW6mm-E.mjs.map +1 -0
- package/dist/contract-infer-DozZT511.mjs +90 -0
- package/dist/contract-infer-DozZT511.mjs.map +1 -0
- package/dist/exports/config-types.d.mts +2 -0
- package/dist/exports/config-types.mjs +3 -0
- package/dist/exports/control-api.d.mts +624 -0
- package/dist/exports/control-api.d.mts.map +1 -0
- package/dist/exports/control-api.mjs +8 -0
- package/dist/{load-ts-contract.d.ts → exports/index.d.mts} +12 -7
- package/dist/exports/index.d.mts.map +1 -0
- package/dist/exports/index.mjs +142 -0
- package/dist/exports/index.mjs.map +1 -0
- package/dist/extract-operation-statements-DZUJNmL3.mjs +13 -0
- package/dist/extract-operation-statements-DZUJNmL3.mjs.map +1 -0
- package/dist/extract-sql-ddl-DDMX-9mz.mjs +26 -0
- package/dist/extract-sql-ddl-DDMX-9mz.mjs.map +1 -0
- package/dist/framework-components-BAsliT4V.mjs +59 -0
- package/dist/framework-components-BAsliT4V.mjs.map +1 -0
- package/dist/init-6Pvm_esG.mjs +430 -0
- package/dist/init-6Pvm_esG.mjs.map +1 -0
- package/dist/inspect-live-schema-BYnhztxZ.mjs +91 -0
- package/dist/inspect-live-schema-BYnhztxZ.mjs.map +1 -0
- package/dist/migration-command-scaffold-CntCcntR.mjs +105 -0
- package/dist/migration-command-scaffold-CntCcntR.mjs.map +1 -0
- package/dist/migration-status-CJANY4yr.mjs +1583 -0
- package/dist/migration-status-CJANY4yr.mjs.map +1 -0
- package/dist/migrations-DTZBYXm1.mjs +173 -0
- package/dist/migrations-DTZBYXm1.mjs.map +1 -0
- package/dist/progress-adapter-B-YvmcDu.mjs +43 -0
- package/dist/progress-adapter-B-YvmcDu.mjs.map +1 -0
- package/dist/quick-reference-mongo.md +93 -0
- package/dist/quick-reference-postgres.md +91 -0
- package/dist/result-handler-oK_vA-Fn.mjs +697 -0
- package/dist/result-handler-oK_vA-Fn.mjs.map +1 -0
- package/dist/terminal-ui-C5k88MmW.mjs +274 -0
- package/dist/terminal-ui-C5k88MmW.mjs.map +1 -0
- package/dist/validate-contract-deps-esa-VQ0h.mjs +37 -0
- package/dist/validate-contract-deps-esa-VQ0h.mjs.map +1 -0
- package/dist/verify-DlFQ2FOw.mjs +385 -0
- package/dist/verify-DlFQ2FOw.mjs.map +1 -0
- package/package.json +87 -40
- package/src/cli.ts +118 -58
- package/src/commands/contract-emit.ts +101 -78
- package/src/commands/contract-infer-paths.ts +32 -0
- package/src/commands/contract-infer.ts +143 -0
- package/src/commands/db-init.ts +97 -219
- package/src/commands/db-schema.ts +77 -0
- package/src/commands/db-sign.ts +46 -73
- package/src/commands/db-update.ts +236 -0
- package/src/commands/db-verify.ts +409 -119
- package/src/commands/init/detect-package-manager.ts +47 -0
- package/src/commands/init/index.ts +21 -0
- package/src/commands/init/init.ts +203 -0
- package/src/commands/init/templates/agent-skill-mongo.md +106 -0
- package/src/commands/init/templates/agent-skill-postgres.md +106 -0
- package/src/commands/init/templates/agent-skill.ts +19 -0
- package/src/commands/init/templates/code-templates.ts +168 -0
- package/src/commands/init/templates/quick-reference-mongo.md +93 -0
- package/src/commands/init/templates/quick-reference-postgres.md +91 -0
- package/src/commands/init/templates/quick-reference.ts +19 -0
- package/src/commands/init/templates/render.ts +20 -0
- package/src/commands/init/templates/tsconfig.ts +35 -0
- package/src/commands/inspect-live-schema.ts +170 -0
- package/src/commands/migration-apply.ts +427 -0
- package/src/commands/migration-new.ts +260 -0
- package/src/commands/migration-plan.ts +519 -0
- package/src/commands/migration-ref.ts +305 -0
- package/src/commands/migration-show.ts +246 -0
- package/src/commands/migration-status.ts +864 -0
- package/src/commands/migration-verify.ts +180 -0
- package/src/config-loader.ts +13 -3
- package/src/control-api/client.ts +205 -183
- package/src/control-api/contract-enrichment.ts +119 -0
- package/src/control-api/errors.ts +9 -0
- package/src/control-api/operations/contract-emit.ts +181 -0
- package/src/control-api/operations/db-init.ts +53 -49
- package/src/control-api/operations/db-update.ts +220 -0
- package/src/control-api/operations/extract-operation-statements.ts +14 -0
- package/src/control-api/operations/extract-sql-ddl.ts +47 -0
- package/src/control-api/operations/migration-apply.ts +191 -0
- package/src/control-api/operations/migration-helpers.ts +49 -0
- package/src/control-api/types.ts +274 -52
- package/src/exports/config-types.ts +4 -3
- package/src/exports/control-api.ts +15 -5
- package/src/load-ts-contract.ts +30 -19
- package/src/utils/cli-errors.ts +14 -8
- package/src/utils/command-helpers.ts +302 -3
- package/src/utils/formatters/emit.ts +67 -0
- package/src/utils/formatters/errors.ts +82 -0
- package/src/utils/formatters/graph-migration-mapper.ts +240 -0
- package/src/utils/formatters/graph-render.ts +1323 -0
- package/src/utils/formatters/graph-types.ts +120 -0
- package/src/utils/formatters/help.ts +380 -0
- package/src/utils/formatters/helpers.ts +28 -0
- package/src/utils/formatters/migrations.ts +346 -0
- package/src/utils/formatters/styled.ts +212 -0
- package/src/utils/formatters/verify.ts +621 -0
- package/src/utils/framework-components.ts +13 -10
- package/src/utils/global-flags.ts +41 -23
- package/src/utils/migration-command-scaffold.ts +184 -0
- package/src/utils/migration-types.ts +12 -0
- package/src/utils/progress-adapter.ts +18 -29
- package/src/utils/result-handler.ts +12 -13
- package/src/utils/shutdown.ts +92 -0
- package/src/utils/suggest-command.ts +31 -0
- package/src/utils/terminal-ui.ts +276 -0
- package/src/utils/validate-contract-deps.ts +49 -0
- package/dist/chunk-AGOTG4L3.js +0 -965
- package/dist/chunk-AGOTG4L3.js.map +0 -1
- package/dist/chunk-HLLI4YL7.js +0 -180
- package/dist/chunk-HLLI4YL7.js.map +0 -1
- package/dist/chunk-HWYQOCAJ.js +0 -47
- package/dist/chunk-HWYQOCAJ.js.map +0 -1
- package/dist/chunk-VG2R7DGF.js +0 -735
- package/dist/chunk-VG2R7DGF.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/contract-emit.d.ts +0 -3
- package/dist/commands/contract-emit.d.ts.map +0 -1
- package/dist/commands/contract-emit.js +0 -10
- package/dist/commands/contract-emit.js.map +0 -1
- package/dist/commands/db-init.d.ts +0 -3
- package/dist/commands/db-init.d.ts.map +0 -1
- package/dist/commands/db-init.js +0 -257
- package/dist/commands/db-init.js.map +0 -1
- package/dist/commands/db-introspect.d.ts +0 -3
- package/dist/commands/db-introspect.d.ts.map +0 -1
- package/dist/commands/db-introspect.js +0 -155
- package/dist/commands/db-introspect.js.map +0 -1
- package/dist/commands/db-schema-verify.d.ts +0 -3
- package/dist/commands/db-schema-verify.d.ts.map +0 -1
- package/dist/commands/db-schema-verify.js +0 -171
- package/dist/commands/db-schema-verify.js.map +0 -1
- package/dist/commands/db-sign.d.ts +0 -3
- package/dist/commands/db-sign.d.ts.map +0 -1
- package/dist/commands/db-sign.js +0 -195
- package/dist/commands/db-sign.js.map +0 -1
- package/dist/commands/db-verify.d.ts +0 -3
- package/dist/commands/db-verify.d.ts.map +0 -1
- package/dist/commands/db-verify.js +0 -193
- package/dist/commands/db-verify.js.map +0 -1
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -7
- package/dist/config-loader.js.map +0 -1
- package/dist/control-api/client.d.ts +0 -13
- package/dist/control-api/client.d.ts.map +0 -1
- package/dist/control-api/operations/db-init.d.ts +0 -29
- package/dist/control-api/operations/db-init.d.ts.map +0 -1
- package/dist/control-api/types.d.ts +0 -387
- package/dist/control-api/types.d.ts.map +0 -1
- package/dist/exports/config-types.d.ts +0 -3
- package/dist/exports/config-types.d.ts.map +0 -1
- package/dist/exports/config-types.js +0 -6
- package/dist/exports/config-types.js.map +0 -1
- package/dist/exports/control-api.d.ts +0 -13
- package/dist/exports/control-api.d.ts.map +0 -1
- package/dist/exports/control-api.js +0 -7
- package/dist/exports/control-api.js.map +0 -1
- package/dist/exports/index.d.ts +0 -4
- package/dist/exports/index.d.ts.map +0 -1
- package/dist/exports/index.js +0 -176
- package/dist/exports/index.js.map +0 -1
- package/dist/load-ts-contract.d.ts.map +0 -1
- package/dist/utils/cli-errors.d.ts +0 -7
- package/dist/utils/cli-errors.d.ts.map +0 -1
- package/dist/utils/command-helpers.d.ts +0 -12
- package/dist/utils/command-helpers.d.ts.map +0 -1
- package/dist/utils/framework-components.d.ts +0 -70
- package/dist/utils/framework-components.d.ts.map +0 -1
- package/dist/utils/global-flags.d.ts +0 -25
- package/dist/utils/global-flags.d.ts.map +0 -1
- package/dist/utils/output.d.ts +0 -142
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/progress-adapter.d.ts +0 -26
- package/dist/utils/progress-adapter.d.ts.map +0 -1
- package/dist/utils/result-handler.d.ts +0 -15
- package/dist/utils/result-handler.d.ts.map +0 -1
- package/src/commands/db-introspect.ts +0 -227
- package/src/commands/db-schema-verify.ts +0 -238
- package/src/utils/output.ts +0 -1471
package/dist/chunk-VG2R7DGF.js
DELETED
|
@@ -1,735 +0,0 @@
|
|
|
1
|
-
// src/utils/cli-errors.ts
|
|
2
|
-
import {
|
|
3
|
-
CliStructuredError,
|
|
4
|
-
errorConfigFileNotFound,
|
|
5
|
-
errorConfigValidation,
|
|
6
|
-
errorContractConfigMissing,
|
|
7
|
-
errorContractMissingExtensionPacks,
|
|
8
|
-
errorContractValidationFailed,
|
|
9
|
-
errorDatabaseConnectionRequired,
|
|
10
|
-
errorDriverRequired,
|
|
11
|
-
errorFamilyReadMarkerSqlRequired,
|
|
12
|
-
errorFileNotFound,
|
|
13
|
-
errorHashMismatch,
|
|
14
|
-
errorJsonFormatNotSupported,
|
|
15
|
-
errorMarkerMissing,
|
|
16
|
-
errorMigrationPlanningFailed,
|
|
17
|
-
errorQueryRunnerFactoryRequired,
|
|
18
|
-
errorRuntime,
|
|
19
|
-
errorTargetMigrationNotSupported,
|
|
20
|
-
errorTargetMismatch,
|
|
21
|
-
errorUnexpected
|
|
22
|
-
} from "@prisma-next/core-control-plane/errors";
|
|
23
|
-
|
|
24
|
-
// src/control-api/client.ts
|
|
25
|
-
import { createControlPlaneStack } from "@prisma-next/core-control-plane/stack";
|
|
26
|
-
import { notOk as notOk2, ok as ok2 } from "@prisma-next/utils/result";
|
|
27
|
-
|
|
28
|
-
// src/utils/framework-components.ts
|
|
29
|
-
import {
|
|
30
|
-
checkContractComponentRequirements
|
|
31
|
-
} from "@prisma-next/contract/framework-components";
|
|
32
|
-
function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {
|
|
33
|
-
for (let i = 0; i < frameworkComponents.length; i++) {
|
|
34
|
-
const component = frameworkComponents[i];
|
|
35
|
-
if (typeof component !== "object" || component === null) {
|
|
36
|
-
throw errorConfigValidation("frameworkComponents[]", {
|
|
37
|
-
why: `Framework component at index ${i} must be an object`
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const record = component;
|
|
41
|
-
if (!Object.hasOwn(record, "kind")) {
|
|
42
|
-
throw errorConfigValidation("frameworkComponents[].kind", {
|
|
43
|
-
why: `Framework component at index ${i} must have 'kind' property`
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const kind = record["kind"];
|
|
47
|
-
if (kind !== "target" && kind !== "adapter" && kind !== "extension" && kind !== "driver") {
|
|
48
|
-
throw errorConfigValidation("frameworkComponents[].kind", {
|
|
49
|
-
why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')`
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (!Object.hasOwn(record, "familyId")) {
|
|
53
|
-
throw errorConfigValidation("frameworkComponents[].familyId", {
|
|
54
|
-
why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property`
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const familyId = record["familyId"];
|
|
58
|
-
if (familyId !== expectedFamilyId) {
|
|
59
|
-
throw errorConfigValidation("frameworkComponents[].familyId", {
|
|
60
|
-
why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'`
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (!Object.hasOwn(record, "targetId")) {
|
|
64
|
-
throw errorConfigValidation("frameworkComponents[].targetId", {
|
|
65
|
-
why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property`
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const targetId = record["targetId"];
|
|
69
|
-
if (targetId !== expectedTargetId) {
|
|
70
|
-
throw errorConfigValidation("frameworkComponents[].targetId", {
|
|
71
|
-
why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'`
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return frameworkComponents;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// src/control-api/operations/db-init.ts
|
|
79
|
-
import { notOk, ok } from "@prisma-next/utils/result";
|
|
80
|
-
async function executeDbInit(options) {
|
|
81
|
-
const { driver, familyInstance, contractIR, mode, migrations, frameworkComponents, onProgress } = options;
|
|
82
|
-
const planner = migrations.createPlanner(familyInstance);
|
|
83
|
-
const runner = migrations.createRunner(familyInstance);
|
|
84
|
-
const introspectSpanId = "introspect";
|
|
85
|
-
onProgress?.({
|
|
86
|
-
action: "dbInit",
|
|
87
|
-
kind: "spanStart",
|
|
88
|
-
spanId: introspectSpanId,
|
|
89
|
-
label: "Introspecting database schema"
|
|
90
|
-
});
|
|
91
|
-
const schemaIR = await familyInstance.introspect({ driver });
|
|
92
|
-
onProgress?.({
|
|
93
|
-
action: "dbInit",
|
|
94
|
-
kind: "spanEnd",
|
|
95
|
-
spanId: introspectSpanId,
|
|
96
|
-
outcome: "ok"
|
|
97
|
-
});
|
|
98
|
-
const policy = { allowedOperationClasses: ["additive"] };
|
|
99
|
-
const planSpanId = "plan";
|
|
100
|
-
onProgress?.({
|
|
101
|
-
action: "dbInit",
|
|
102
|
-
kind: "spanStart",
|
|
103
|
-
spanId: planSpanId,
|
|
104
|
-
label: "Planning migration"
|
|
105
|
-
});
|
|
106
|
-
const plannerResult = await planner.plan({
|
|
107
|
-
contract: contractIR,
|
|
108
|
-
schema: schemaIR,
|
|
109
|
-
policy,
|
|
110
|
-
frameworkComponents
|
|
111
|
-
});
|
|
112
|
-
if (plannerResult.kind === "failure") {
|
|
113
|
-
onProgress?.({
|
|
114
|
-
action: "dbInit",
|
|
115
|
-
kind: "spanEnd",
|
|
116
|
-
spanId: planSpanId,
|
|
117
|
-
outcome: "error"
|
|
118
|
-
});
|
|
119
|
-
return notOk({
|
|
120
|
-
code: "PLANNING_FAILED",
|
|
121
|
-
summary: "Migration planning failed due to conflicts",
|
|
122
|
-
conflicts: plannerResult.conflicts,
|
|
123
|
-
why: void 0,
|
|
124
|
-
meta: void 0
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const migrationPlan = plannerResult.plan;
|
|
128
|
-
onProgress?.({
|
|
129
|
-
action: "dbInit",
|
|
130
|
-
kind: "spanEnd",
|
|
131
|
-
spanId: planSpanId,
|
|
132
|
-
outcome: "ok"
|
|
133
|
-
});
|
|
134
|
-
const checkMarkerSpanId = "checkMarker";
|
|
135
|
-
onProgress?.({
|
|
136
|
-
action: "dbInit",
|
|
137
|
-
kind: "spanStart",
|
|
138
|
-
spanId: checkMarkerSpanId,
|
|
139
|
-
label: "Checking contract marker"
|
|
140
|
-
});
|
|
141
|
-
const existingMarker = await familyInstance.readMarker({ driver });
|
|
142
|
-
if (existingMarker) {
|
|
143
|
-
const markerMatchesDestination = existingMarker.coreHash === migrationPlan.destination.coreHash && (!migrationPlan.destination.profileHash || existingMarker.profileHash === migrationPlan.destination.profileHash);
|
|
144
|
-
if (markerMatchesDestination) {
|
|
145
|
-
onProgress?.({
|
|
146
|
-
action: "dbInit",
|
|
147
|
-
kind: "spanEnd",
|
|
148
|
-
spanId: checkMarkerSpanId,
|
|
149
|
-
outcome: "skipped"
|
|
150
|
-
});
|
|
151
|
-
const result2 = {
|
|
152
|
-
mode,
|
|
153
|
-
plan: { operations: [] },
|
|
154
|
-
...mode === "apply" ? {
|
|
155
|
-
execution: { operationsPlanned: 0, operationsExecuted: 0 },
|
|
156
|
-
marker: {
|
|
157
|
-
coreHash: existingMarker.coreHash,
|
|
158
|
-
profileHash: existingMarker.profileHash
|
|
159
|
-
}
|
|
160
|
-
} : {},
|
|
161
|
-
summary: "Database already at target contract state"
|
|
162
|
-
};
|
|
163
|
-
return ok(result2);
|
|
164
|
-
}
|
|
165
|
-
onProgress?.({
|
|
166
|
-
action: "dbInit",
|
|
167
|
-
kind: "spanEnd",
|
|
168
|
-
spanId: checkMarkerSpanId,
|
|
169
|
-
outcome: "error"
|
|
170
|
-
});
|
|
171
|
-
return notOk({
|
|
172
|
-
code: "MARKER_ORIGIN_MISMATCH",
|
|
173
|
-
summary: "Existing contract marker does not match plan destination",
|
|
174
|
-
marker: {
|
|
175
|
-
coreHash: existingMarker.coreHash,
|
|
176
|
-
profileHash: existingMarker.profileHash
|
|
177
|
-
},
|
|
178
|
-
destination: {
|
|
179
|
-
coreHash: migrationPlan.destination.coreHash,
|
|
180
|
-
profileHash: migrationPlan.destination.profileHash
|
|
181
|
-
},
|
|
182
|
-
why: void 0,
|
|
183
|
-
conflicts: void 0,
|
|
184
|
-
meta: void 0
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
onProgress?.({
|
|
188
|
-
action: "dbInit",
|
|
189
|
-
kind: "spanEnd",
|
|
190
|
-
spanId: checkMarkerSpanId,
|
|
191
|
-
outcome: "ok"
|
|
192
|
-
});
|
|
193
|
-
if (mode === "plan") {
|
|
194
|
-
const result2 = {
|
|
195
|
-
mode: "plan",
|
|
196
|
-
plan: { operations: migrationPlan.operations },
|
|
197
|
-
summary: `Planned ${migrationPlan.operations.length} operation(s)`
|
|
198
|
-
};
|
|
199
|
-
return ok(result2);
|
|
200
|
-
}
|
|
201
|
-
const applySpanId = "apply";
|
|
202
|
-
onProgress?.({
|
|
203
|
-
action: "dbInit",
|
|
204
|
-
kind: "spanStart",
|
|
205
|
-
spanId: applySpanId,
|
|
206
|
-
label: "Applying migration plan"
|
|
207
|
-
});
|
|
208
|
-
const callbacks = onProgress ? {
|
|
209
|
-
onOperationStart: (op) => {
|
|
210
|
-
onProgress({
|
|
211
|
-
action: "dbInit",
|
|
212
|
-
kind: "spanStart",
|
|
213
|
-
spanId: `operation:${op.id}`,
|
|
214
|
-
parentSpanId: applySpanId,
|
|
215
|
-
label: op.label
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
onOperationComplete: (op) => {
|
|
219
|
-
onProgress({
|
|
220
|
-
action: "dbInit",
|
|
221
|
-
kind: "spanEnd",
|
|
222
|
-
spanId: `operation:${op.id}`,
|
|
223
|
-
outcome: "ok"
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
} : void 0;
|
|
227
|
-
const runnerResult = await runner.execute({
|
|
228
|
-
plan: migrationPlan,
|
|
229
|
-
driver,
|
|
230
|
-
destinationContract: contractIR,
|
|
231
|
-
policy,
|
|
232
|
-
...callbacks ? { callbacks } : {},
|
|
233
|
-
// db init plans and applies back-to-back from a fresh introspection, so per-operation
|
|
234
|
-
// pre/postchecks and the idempotency probe are usually redundant overhead. We still
|
|
235
|
-
// enforce marker/origin compatibility and a full schema verification after apply.
|
|
236
|
-
executionChecks: {
|
|
237
|
-
prechecks: false,
|
|
238
|
-
postchecks: false,
|
|
239
|
-
idempotencyChecks: false
|
|
240
|
-
},
|
|
241
|
-
frameworkComponents
|
|
242
|
-
});
|
|
243
|
-
if (!runnerResult.ok) {
|
|
244
|
-
onProgress?.({
|
|
245
|
-
action: "dbInit",
|
|
246
|
-
kind: "spanEnd",
|
|
247
|
-
spanId: applySpanId,
|
|
248
|
-
outcome: "error"
|
|
249
|
-
});
|
|
250
|
-
return notOk({
|
|
251
|
-
code: "RUNNER_FAILED",
|
|
252
|
-
summary: runnerResult.failure.summary,
|
|
253
|
-
why: runnerResult.failure.why,
|
|
254
|
-
meta: runnerResult.failure.meta,
|
|
255
|
-
conflicts: void 0
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
const execution = runnerResult.value;
|
|
259
|
-
onProgress?.({
|
|
260
|
-
action: "dbInit",
|
|
261
|
-
kind: "spanEnd",
|
|
262
|
-
spanId: applySpanId,
|
|
263
|
-
outcome: "ok"
|
|
264
|
-
});
|
|
265
|
-
const result = {
|
|
266
|
-
mode: "apply",
|
|
267
|
-
plan: { operations: migrationPlan.operations },
|
|
268
|
-
execution: {
|
|
269
|
-
operationsPlanned: execution.operationsPlanned,
|
|
270
|
-
operationsExecuted: execution.operationsExecuted
|
|
271
|
-
},
|
|
272
|
-
marker: migrationPlan.destination.profileHash ? {
|
|
273
|
-
coreHash: migrationPlan.destination.coreHash,
|
|
274
|
-
profileHash: migrationPlan.destination.profileHash
|
|
275
|
-
} : { coreHash: migrationPlan.destination.coreHash },
|
|
276
|
-
summary: `Applied ${execution.operationsExecuted} operation(s), marker written`
|
|
277
|
-
};
|
|
278
|
-
return ok(result);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// src/control-api/client.ts
|
|
282
|
-
function createControlClient(options) {
|
|
283
|
-
return new ControlClientImpl(options);
|
|
284
|
-
}
|
|
285
|
-
var ControlClientImpl = class {
|
|
286
|
-
options;
|
|
287
|
-
stack = null;
|
|
288
|
-
driver = null;
|
|
289
|
-
familyInstance = null;
|
|
290
|
-
frameworkComponents = null;
|
|
291
|
-
initialized = false;
|
|
292
|
-
defaultConnection;
|
|
293
|
-
constructor(options) {
|
|
294
|
-
this.options = options;
|
|
295
|
-
this.defaultConnection = options.connection;
|
|
296
|
-
}
|
|
297
|
-
init() {
|
|
298
|
-
if (this.initialized) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
this.stack = createControlPlaneStack({
|
|
302
|
-
target: this.options.target,
|
|
303
|
-
adapter: this.options.adapter,
|
|
304
|
-
driver: this.options.driver,
|
|
305
|
-
extensionPacks: this.options.extensionPacks
|
|
306
|
-
});
|
|
307
|
-
this.familyInstance = this.options.family.create(this.stack);
|
|
308
|
-
const rawComponents = [
|
|
309
|
-
this.options.target,
|
|
310
|
-
this.options.adapter,
|
|
311
|
-
...this.options.extensionPacks ?? []
|
|
312
|
-
];
|
|
313
|
-
this.frameworkComponents = assertFrameworkComponentsCompatible(
|
|
314
|
-
this.options.family.familyId,
|
|
315
|
-
this.options.target.targetId,
|
|
316
|
-
rawComponents
|
|
317
|
-
);
|
|
318
|
-
this.initialized = true;
|
|
319
|
-
}
|
|
320
|
-
async connect(connection) {
|
|
321
|
-
this.init();
|
|
322
|
-
if (this.driver) {
|
|
323
|
-
throw new Error("Already connected. Call close() before reconnecting.");
|
|
324
|
-
}
|
|
325
|
-
const resolvedConnection = connection ?? this.defaultConnection;
|
|
326
|
-
if (resolvedConnection === void 0) {
|
|
327
|
-
throw new Error(
|
|
328
|
-
"No connection provided. Pass a connection to connect() or provide a default connection when creating the client."
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
if (!this.stack?.driver) {
|
|
332
|
-
throw new Error(
|
|
333
|
-
"Driver is not configured. Pass a driver descriptor when creating the control client to enable database operations."
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
this.driver = await this.stack?.driver.create(resolvedConnection);
|
|
337
|
-
}
|
|
338
|
-
async close() {
|
|
339
|
-
if (this.driver) {
|
|
340
|
-
await this.driver.close();
|
|
341
|
-
this.driver = null;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
async ensureConnected() {
|
|
345
|
-
this.init();
|
|
346
|
-
if (!this.driver && this.defaultConnection !== void 0) {
|
|
347
|
-
await this.connect(this.defaultConnection);
|
|
348
|
-
}
|
|
349
|
-
if (!this.driver || !this.familyInstance || !this.frameworkComponents) {
|
|
350
|
-
throw new Error("Not connected. Call connect(connection) first.");
|
|
351
|
-
}
|
|
352
|
-
return {
|
|
353
|
-
driver: this.driver,
|
|
354
|
-
familyInstance: this.familyInstance,
|
|
355
|
-
frameworkComponents: this.frameworkComponents
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
async verify(options) {
|
|
359
|
-
const { onProgress } = options;
|
|
360
|
-
if (options.connection !== void 0) {
|
|
361
|
-
onProgress?.({
|
|
362
|
-
action: "verify",
|
|
363
|
-
kind: "spanStart",
|
|
364
|
-
spanId: "connect",
|
|
365
|
-
label: "Connecting to database..."
|
|
366
|
-
});
|
|
367
|
-
try {
|
|
368
|
-
await this.connect(options.connection);
|
|
369
|
-
onProgress?.({
|
|
370
|
-
action: "verify",
|
|
371
|
-
kind: "spanEnd",
|
|
372
|
-
spanId: "connect",
|
|
373
|
-
outcome: "ok"
|
|
374
|
-
});
|
|
375
|
-
} catch (error) {
|
|
376
|
-
onProgress?.({
|
|
377
|
-
action: "verify",
|
|
378
|
-
kind: "spanEnd",
|
|
379
|
-
spanId: "connect",
|
|
380
|
-
outcome: "error"
|
|
381
|
-
});
|
|
382
|
-
throw error;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
const { driver, familyInstance } = await this.ensureConnected();
|
|
386
|
-
const contractIR = familyInstance.validateContractIR(options.contractIR);
|
|
387
|
-
onProgress?.({
|
|
388
|
-
action: "verify",
|
|
389
|
-
kind: "spanStart",
|
|
390
|
-
spanId: "verify",
|
|
391
|
-
label: "Verifying contract marker..."
|
|
392
|
-
});
|
|
393
|
-
try {
|
|
394
|
-
const result = await familyInstance.verify({
|
|
395
|
-
driver,
|
|
396
|
-
contractIR,
|
|
397
|
-
expectedTargetId: this.options.target.targetId,
|
|
398
|
-
contractPath: ""
|
|
399
|
-
});
|
|
400
|
-
onProgress?.({
|
|
401
|
-
action: "verify",
|
|
402
|
-
kind: "spanEnd",
|
|
403
|
-
spanId: "verify",
|
|
404
|
-
outcome: result.ok ? "ok" : "error"
|
|
405
|
-
});
|
|
406
|
-
return result;
|
|
407
|
-
} catch (error) {
|
|
408
|
-
onProgress?.({
|
|
409
|
-
action: "verify",
|
|
410
|
-
kind: "spanEnd",
|
|
411
|
-
spanId: "verify",
|
|
412
|
-
outcome: "error"
|
|
413
|
-
});
|
|
414
|
-
throw error;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
async schemaVerify(options) {
|
|
418
|
-
const { onProgress } = options;
|
|
419
|
-
if (options.connection !== void 0) {
|
|
420
|
-
onProgress?.({
|
|
421
|
-
action: "schemaVerify",
|
|
422
|
-
kind: "spanStart",
|
|
423
|
-
spanId: "connect",
|
|
424
|
-
label: "Connecting to database..."
|
|
425
|
-
});
|
|
426
|
-
try {
|
|
427
|
-
await this.connect(options.connection);
|
|
428
|
-
onProgress?.({
|
|
429
|
-
action: "schemaVerify",
|
|
430
|
-
kind: "spanEnd",
|
|
431
|
-
spanId: "connect",
|
|
432
|
-
outcome: "ok"
|
|
433
|
-
});
|
|
434
|
-
} catch (error) {
|
|
435
|
-
onProgress?.({
|
|
436
|
-
action: "schemaVerify",
|
|
437
|
-
kind: "spanEnd",
|
|
438
|
-
spanId: "connect",
|
|
439
|
-
outcome: "error"
|
|
440
|
-
});
|
|
441
|
-
throw error;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
const { driver, familyInstance, frameworkComponents } = await this.ensureConnected();
|
|
445
|
-
const contractIR = familyInstance.validateContractIR(options.contractIR);
|
|
446
|
-
onProgress?.({
|
|
447
|
-
action: "schemaVerify",
|
|
448
|
-
kind: "spanStart",
|
|
449
|
-
spanId: "schemaVerify",
|
|
450
|
-
label: "Verifying database schema..."
|
|
451
|
-
});
|
|
452
|
-
try {
|
|
453
|
-
const result = await familyInstance.schemaVerify({
|
|
454
|
-
driver,
|
|
455
|
-
contractIR,
|
|
456
|
-
strict: options.strict ?? false,
|
|
457
|
-
contractPath: "",
|
|
458
|
-
frameworkComponents
|
|
459
|
-
});
|
|
460
|
-
onProgress?.({
|
|
461
|
-
action: "schemaVerify",
|
|
462
|
-
kind: "spanEnd",
|
|
463
|
-
spanId: "schemaVerify",
|
|
464
|
-
outcome: result.ok ? "ok" : "error"
|
|
465
|
-
});
|
|
466
|
-
return result;
|
|
467
|
-
} catch (error) {
|
|
468
|
-
onProgress?.({
|
|
469
|
-
action: "schemaVerify",
|
|
470
|
-
kind: "spanEnd",
|
|
471
|
-
spanId: "schemaVerify",
|
|
472
|
-
outcome: "error"
|
|
473
|
-
});
|
|
474
|
-
throw error;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
async sign(options) {
|
|
478
|
-
const { onProgress } = options;
|
|
479
|
-
if (options.connection !== void 0) {
|
|
480
|
-
onProgress?.({
|
|
481
|
-
action: "sign",
|
|
482
|
-
kind: "spanStart",
|
|
483
|
-
spanId: "connect",
|
|
484
|
-
label: "Connecting to database..."
|
|
485
|
-
});
|
|
486
|
-
try {
|
|
487
|
-
await this.connect(options.connection);
|
|
488
|
-
onProgress?.({
|
|
489
|
-
action: "sign",
|
|
490
|
-
kind: "spanEnd",
|
|
491
|
-
spanId: "connect",
|
|
492
|
-
outcome: "ok"
|
|
493
|
-
});
|
|
494
|
-
} catch (error) {
|
|
495
|
-
onProgress?.({
|
|
496
|
-
action: "sign",
|
|
497
|
-
kind: "spanEnd",
|
|
498
|
-
spanId: "connect",
|
|
499
|
-
outcome: "error"
|
|
500
|
-
});
|
|
501
|
-
throw error;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
const { driver, familyInstance } = await this.ensureConnected();
|
|
505
|
-
const contractIR = familyInstance.validateContractIR(options.contractIR);
|
|
506
|
-
onProgress?.({
|
|
507
|
-
action: "sign",
|
|
508
|
-
kind: "spanStart",
|
|
509
|
-
spanId: "sign",
|
|
510
|
-
label: "Signing database..."
|
|
511
|
-
});
|
|
512
|
-
try {
|
|
513
|
-
const result = await familyInstance.sign({
|
|
514
|
-
driver,
|
|
515
|
-
contractIR,
|
|
516
|
-
contractPath: options.contractPath ?? "",
|
|
517
|
-
...options.configPath ? { configPath: options.configPath } : {}
|
|
518
|
-
});
|
|
519
|
-
onProgress?.({
|
|
520
|
-
action: "sign",
|
|
521
|
-
kind: "spanEnd",
|
|
522
|
-
spanId: "sign",
|
|
523
|
-
outcome: "ok"
|
|
524
|
-
});
|
|
525
|
-
return result;
|
|
526
|
-
} catch (error) {
|
|
527
|
-
onProgress?.({
|
|
528
|
-
action: "sign",
|
|
529
|
-
kind: "spanEnd",
|
|
530
|
-
spanId: "sign",
|
|
531
|
-
outcome: "error"
|
|
532
|
-
});
|
|
533
|
-
throw error;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
async dbInit(options) {
|
|
537
|
-
const { onProgress } = options;
|
|
538
|
-
if (options.connection !== void 0) {
|
|
539
|
-
onProgress?.({
|
|
540
|
-
action: "dbInit",
|
|
541
|
-
kind: "spanStart",
|
|
542
|
-
spanId: "connect",
|
|
543
|
-
label: "Connecting to database..."
|
|
544
|
-
});
|
|
545
|
-
try {
|
|
546
|
-
await this.connect(options.connection);
|
|
547
|
-
onProgress?.({
|
|
548
|
-
action: "dbInit",
|
|
549
|
-
kind: "spanEnd",
|
|
550
|
-
spanId: "connect",
|
|
551
|
-
outcome: "ok"
|
|
552
|
-
});
|
|
553
|
-
} catch (error) {
|
|
554
|
-
onProgress?.({
|
|
555
|
-
action: "dbInit",
|
|
556
|
-
kind: "spanEnd",
|
|
557
|
-
spanId: "connect",
|
|
558
|
-
outcome: "error"
|
|
559
|
-
});
|
|
560
|
-
throw error;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
const { driver, familyInstance, frameworkComponents } = await this.ensureConnected();
|
|
564
|
-
if (!this.options.target.migrations) {
|
|
565
|
-
throw new Error(`Target "${this.options.target.targetId}" does not support migrations`);
|
|
566
|
-
}
|
|
567
|
-
const contractIR = familyInstance.validateContractIR(options.contractIR);
|
|
568
|
-
return executeDbInit({
|
|
569
|
-
driver,
|
|
570
|
-
familyInstance,
|
|
571
|
-
contractIR,
|
|
572
|
-
mode: options.mode,
|
|
573
|
-
migrations: this.options.target.migrations,
|
|
574
|
-
frameworkComponents,
|
|
575
|
-
...onProgress ? { onProgress } : {}
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
async introspect(options) {
|
|
579
|
-
const onProgress = options?.onProgress;
|
|
580
|
-
if (options?.connection !== void 0) {
|
|
581
|
-
onProgress?.({
|
|
582
|
-
action: "introspect",
|
|
583
|
-
kind: "spanStart",
|
|
584
|
-
spanId: "connect",
|
|
585
|
-
label: "Connecting to database..."
|
|
586
|
-
});
|
|
587
|
-
try {
|
|
588
|
-
await this.connect(options.connection);
|
|
589
|
-
onProgress?.({
|
|
590
|
-
action: "introspect",
|
|
591
|
-
kind: "spanEnd",
|
|
592
|
-
spanId: "connect",
|
|
593
|
-
outcome: "ok"
|
|
594
|
-
});
|
|
595
|
-
} catch (error) {
|
|
596
|
-
onProgress?.({
|
|
597
|
-
action: "introspect",
|
|
598
|
-
kind: "spanEnd",
|
|
599
|
-
spanId: "connect",
|
|
600
|
-
outcome: "error"
|
|
601
|
-
});
|
|
602
|
-
throw error;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
const { driver, familyInstance } = await this.ensureConnected();
|
|
606
|
-
const _schema = options?.schema;
|
|
607
|
-
void _schema;
|
|
608
|
-
onProgress?.({
|
|
609
|
-
action: "introspect",
|
|
610
|
-
kind: "spanStart",
|
|
611
|
-
spanId: "introspect",
|
|
612
|
-
label: "Introspecting database schema..."
|
|
613
|
-
});
|
|
614
|
-
try {
|
|
615
|
-
const result = await familyInstance.introspect({ driver });
|
|
616
|
-
onProgress?.({
|
|
617
|
-
action: "introspect",
|
|
618
|
-
kind: "spanEnd",
|
|
619
|
-
spanId: "introspect",
|
|
620
|
-
outcome: "ok"
|
|
621
|
-
});
|
|
622
|
-
return result;
|
|
623
|
-
} catch (error) {
|
|
624
|
-
onProgress?.({
|
|
625
|
-
action: "introspect",
|
|
626
|
-
kind: "spanEnd",
|
|
627
|
-
spanId: "introspect",
|
|
628
|
-
outcome: "error"
|
|
629
|
-
});
|
|
630
|
-
throw error;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
toSchemaView(schemaIR) {
|
|
634
|
-
this.init();
|
|
635
|
-
if (this.familyInstance?.toSchemaView) {
|
|
636
|
-
return this.familyInstance.toSchemaView(schemaIR);
|
|
637
|
-
}
|
|
638
|
-
return void 0;
|
|
639
|
-
}
|
|
640
|
-
async emit(options) {
|
|
641
|
-
const { onProgress, contractConfig } = options;
|
|
642
|
-
this.init();
|
|
643
|
-
if (!this.familyInstance) {
|
|
644
|
-
throw new Error("Family instance was not initialized. This is a bug.");
|
|
645
|
-
}
|
|
646
|
-
let contractRaw;
|
|
647
|
-
onProgress?.({
|
|
648
|
-
action: "emit",
|
|
649
|
-
kind: "spanStart",
|
|
650
|
-
spanId: "resolveSource",
|
|
651
|
-
label: "Resolving contract source..."
|
|
652
|
-
});
|
|
653
|
-
try {
|
|
654
|
-
switch (contractConfig.source.kind) {
|
|
655
|
-
case "loader":
|
|
656
|
-
contractRaw = await contractConfig.source.load();
|
|
657
|
-
break;
|
|
658
|
-
case "value":
|
|
659
|
-
contractRaw = contractConfig.source.value;
|
|
660
|
-
break;
|
|
661
|
-
}
|
|
662
|
-
onProgress?.({
|
|
663
|
-
action: "emit",
|
|
664
|
-
kind: "spanEnd",
|
|
665
|
-
spanId: "resolveSource",
|
|
666
|
-
outcome: "ok"
|
|
667
|
-
});
|
|
668
|
-
} catch (error) {
|
|
669
|
-
onProgress?.({
|
|
670
|
-
action: "emit",
|
|
671
|
-
kind: "spanEnd",
|
|
672
|
-
spanId: "resolveSource",
|
|
673
|
-
outcome: "error"
|
|
674
|
-
});
|
|
675
|
-
return notOk2({
|
|
676
|
-
code: "CONTRACT_SOURCE_INVALID",
|
|
677
|
-
summary: "Failed to resolve contract source",
|
|
678
|
-
why: error instanceof Error ? error.message : String(error),
|
|
679
|
-
meta: void 0
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
onProgress?.({
|
|
683
|
-
action: "emit",
|
|
684
|
-
kind: "spanStart",
|
|
685
|
-
spanId: "emit",
|
|
686
|
-
label: "Emitting contract..."
|
|
687
|
-
});
|
|
688
|
-
try {
|
|
689
|
-
const emitResult = await this.familyInstance.emitContract({ contractIR: contractRaw });
|
|
690
|
-
onProgress?.({
|
|
691
|
-
action: "emit",
|
|
692
|
-
kind: "spanEnd",
|
|
693
|
-
spanId: "emit",
|
|
694
|
-
outcome: "ok"
|
|
695
|
-
});
|
|
696
|
-
return ok2({
|
|
697
|
-
coreHash: emitResult.coreHash,
|
|
698
|
-
profileHash: emitResult.profileHash,
|
|
699
|
-
contractJson: emitResult.contractJson,
|
|
700
|
-
contractDts: emitResult.contractDts
|
|
701
|
-
});
|
|
702
|
-
} catch (error) {
|
|
703
|
-
onProgress?.({
|
|
704
|
-
action: "emit",
|
|
705
|
-
kind: "spanEnd",
|
|
706
|
-
spanId: "emit",
|
|
707
|
-
outcome: "error"
|
|
708
|
-
});
|
|
709
|
-
return notOk2({
|
|
710
|
-
code: "EMIT_FAILED",
|
|
711
|
-
summary: "Failed to emit contract",
|
|
712
|
-
why: error instanceof Error ? error.message : String(error),
|
|
713
|
-
meta: void 0
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
export {
|
|
720
|
-
CliStructuredError,
|
|
721
|
-
errorContractValidationFailed,
|
|
722
|
-
errorDatabaseConnectionRequired,
|
|
723
|
-
errorDriverRequired,
|
|
724
|
-
errorFileNotFound,
|
|
725
|
-
errorHashMismatch,
|
|
726
|
-
errorJsonFormatNotSupported,
|
|
727
|
-
errorMarkerMissing,
|
|
728
|
-
errorMigrationPlanningFailed,
|
|
729
|
-
errorRuntime,
|
|
730
|
-
errorTargetMigrationNotSupported,
|
|
731
|
-
errorTargetMismatch,
|
|
732
|
-
errorUnexpected,
|
|
733
|
-
createControlClient
|
|
734
|
-
};
|
|
735
|
-
//# sourceMappingURL=chunk-VG2R7DGF.js.map
|