prisma-next 0.5.0-dev.67 → 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/cli.mjs +8 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/client-0ZX24FXF.mjs +1398 -0
- package/dist/client-0ZX24FXF.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +7 -5
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +2 -2
- package/dist/commands/db-sign.mjs +2 -2
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +7 -5
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -320
- package/dist/commands/migration-apply.mjs +11 -11
- package/dist/commands/migration-apply.mjs.map +1 -1
- package/dist/commands/migration-new.mjs +5 -5
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -344
- package/dist/commands/migration-ref.d.mts +1 -1
- package/dist/commands/migration-ref.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +8 -7
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/{contract-emit-B0nGrDtk.mjs → contract-emit-DkMqO7f2.mjs} +2 -2
- package/dist/{contract-emit-B0nGrDtk.mjs.map → contract-emit-DkMqO7f2.mjs.map} +1 -1
- package/dist/{contract-infer-BjMJaOOa.mjs → contract-infer-BDKAE0B0.mjs} +3 -3
- package/dist/{contract-infer-BjMJaOOa.mjs.map → contract-infer-BDKAE0B0.mjs.map} +1 -1
- package/dist/db-verify-B4TdDKOI.mjs +403 -0
- package/dist/db-verify-B4TdDKOI.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +201 -3
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +17 -17
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{init-C3qdc0Sh.mjs → init-Deo7U8_U.mjs} +2 -2
- package/dist/{init-C3qdc0Sh.mjs.map → init-Deo7U8_U.mjs.map} +1 -1
- package/dist/{inspect-live-schema-33rxnu0K.mjs → inspect-live-schema-BAgQMYpD.mjs} +3 -3
- package/dist/{inspect-live-schema-33rxnu0K.mjs.map → inspect-live-schema-BAgQMYpD.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-DQo4R0XT.mjs → migration-command-scaffold-B8J702Uh.mjs} +3 -3
- package/dist/{migration-command-scaffold-DQo4R0XT.mjs.map → migration-command-scaffold-B8J702Uh.mjs.map} +1 -1
- package/dist/migration-plan-BcKNnTM7.mjs +530 -0
- package/dist/migration-plan-BcKNnTM7.mjs.map +1 -0
- package/dist/{migration-status-C_2FSkbf.mjs → migration-status-CjwB2of-.mjs} +6 -6
- package/dist/{migration-status-C_2FSkbf.mjs.map → migration-status-CjwB2of-.mjs.map} +1 -1
- package/dist/{output-BTgnZ5c_.mjs → output-DnjfCC_u.mjs} +1 -1
- package/dist/{output-BTgnZ5c_.mjs.map → output-DnjfCC_u.mjs.map} +1 -1
- package/dist/{result-handler-C0QeiqKO.mjs → result-handler-DWb1rFS-.mjs} +18 -3
- package/dist/result-handler-DWb1rFS-.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/client-CW1hcUtM.mjs +0 -1025
- package/dist/client-CW1hcUtM.mjs.map +0 -1
- package/dist/commands/db-verify.mjs.map +0 -1
- package/dist/commands/migration-plan.mjs.map +0 -1
- package/dist/result-handler-C0QeiqKO.mjs.map +0 -1
- /package/dist/{cli-errors-BWn943z2.d.mts → cli-errors-QH8kf-C2.d.mts} +0 -0
|
@@ -1,10 +1,70 @@
|
|
|
1
|
+
import { t as CliStructuredError } from "../cli-errors-QH8kf-C2.mjs";
|
|
1
2
|
import { Result } from "@prisma-next/utils/result";
|
|
2
3
|
import { ContractSourceDiagnostics, ContractSourceProvider } from "@prisma-next/config/config-types";
|
|
3
|
-
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlStack, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview, SignDatabaseResult, SignDatabaseResult as SignDatabaseResult$1, VerifyDatabaseResult, VerifyDatabaseResult as VerifyDatabaseResult$1, VerifyDatabaseSchemaResult, VerifyDatabaseSchemaResult as VerifyDatabaseSchemaResult$1 } from "@prisma-next/framework-components/control";
|
|
4
|
+
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview, SignDatabaseResult, SignDatabaseResult as SignDatabaseResult$1, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseResult as VerifyDatabaseResult$1, VerifyDatabaseSchemaResult, VerifyDatabaseSchemaResult as VerifyDatabaseSchemaResult$1 } from "@prisma-next/framework-components/control";
|
|
4
5
|
import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
|
|
5
6
|
import { Contract, ContractMarkerRecord } from "@prisma-next/contract/types";
|
|
6
7
|
import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
|
|
7
8
|
|
|
9
|
+
//#region src/control-api/operations/db-verify.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Inputs for the aggregate `db verify` operation.
|
|
12
|
+
*
|
|
13
|
+
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
14
|
+
* boundary) builds a {@link import('@prisma-next/migration-tools/aggregate').ContractSpaceAggregate};
|
|
15
|
+
* the aggregate verifier bundles `markerCheck` + per-space pre-projected
|
|
16
|
+
* `schemaCheck`. `mode: 'strict' | 'lenient'` maps directly to the user
|
|
17
|
+
* facing `--strict` flag.
|
|
18
|
+
*/
|
|
19
|
+
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
20
|
+
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
21
|
+
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
22
|
+
readonly contract: Contract;
|
|
23
|
+
readonly migrationsDir: string;
|
|
24
|
+
readonly targetId: TTargetId;
|
|
25
|
+
readonly extensionPacks: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
26
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
27
|
+
readonly mode: 'strict' | 'lenient';
|
|
28
|
+
readonly skipSchema: boolean;
|
|
29
|
+
readonly skipMarker: boolean;
|
|
30
|
+
readonly onProgress?: OnControlProgress;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of the aggregate verify operation.
|
|
34
|
+
*
|
|
35
|
+
* Marker-check failures are surfaced as a {@link CliStructuredError}
|
|
36
|
+
* (same envelope code `5002` the legacy `runContractSpaceVerifierMarkerCheck`
|
|
37
|
+
* emitted, so downstream tooling and integration tests assert on the
|
|
38
|
+
* same shape).
|
|
39
|
+
*
|
|
40
|
+
* On success, the per-space schema results are returned for the CLI to
|
|
41
|
+
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
42
|
+
* is empty.
|
|
43
|
+
*/
|
|
44
|
+
interface ExecuteDbVerifySuccess {
|
|
45
|
+
readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult$1>;
|
|
46
|
+
readonly memberOrder: readonly string[];
|
|
47
|
+
readonly appSpaceId: string;
|
|
48
|
+
}
|
|
49
|
+
type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError>;
|
|
50
|
+
/**
|
|
51
|
+
* Loader → verifier pipeline shared by `db verify` modes (`full`,
|
|
52
|
+
* `marker-only`, `schema-only`).
|
|
53
|
+
*
|
|
54
|
+
* 1. **Load**: build a {@link import('@prisma-next/migration-tools/aggregate').ContractSpaceAggregate}
|
|
55
|
+
* from descriptors + on-disk on-disk artefacts. Layout / drift /
|
|
56
|
+
* integrity / disjointness violations short-circuit with a
|
|
57
|
+
* structured CLI error.
|
|
58
|
+
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
59
|
+
* schema introspection.
|
|
60
|
+
* 3. **Verify**: {@link verifyAggregate} returns per-space
|
|
61
|
+
* `markerCheck` + per-space pre-projected `schemaCheck` (closes F23).
|
|
62
|
+
* Marker mismatches map to `CliStructuredError` (code `5002`) so
|
|
63
|
+
* callers (CLI command) can render and exit. Schema results are
|
|
64
|
+
* returned to the caller verbatim.
|
|
65
|
+
*/
|
|
66
|
+
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
67
|
+
//#endregion
|
|
8
68
|
//#region src/control-api/types.d.ts
|
|
9
69
|
/**
|
|
10
70
|
* Options for creating a control client.
|
|
@@ -34,7 +94,7 @@ interface ControlClientOptions {
|
|
|
34
94
|
/**
|
|
35
95
|
* Action names for control-api operations that can emit progress events.
|
|
36
96
|
*/
|
|
37
|
-
type ControlActionName = 'dbInit' | 'dbUpdate' | 'migrationApply' | 'verify' | 'schemaVerify' | 'sign' | 'introspect' | 'emit';
|
|
97
|
+
type ControlActionName = 'dbInit' | 'dbUpdate' | 'dbVerify' | 'migrationApply' | 'verify' | 'schemaVerify' | 'sign' | 'introspect' | 'emit';
|
|
38
98
|
/**
|
|
39
99
|
* Progress event emitted during control-api operation execution.
|
|
40
100
|
*
|
|
@@ -143,6 +203,13 @@ interface DbInitOptions {
|
|
|
143
203
|
* The type is driver-specific (e.g., string URL for Postgres).
|
|
144
204
|
*/
|
|
145
205
|
readonly connection?: unknown;
|
|
206
|
+
/**
|
|
207
|
+
* On-disk migrations directory. Always required — every `db init`
|
|
208
|
+
* routes through the per-space flow, which reads on-disk
|
|
209
|
+
* `refs/head.json` and extension destination contracts from this
|
|
210
|
+
* root.
|
|
211
|
+
*/
|
|
212
|
+
readonly migrationsDir: string;
|
|
146
213
|
/** Optional progress callback for observing operation progress */
|
|
147
214
|
readonly onProgress?: OnControlProgress;
|
|
148
215
|
}
|
|
@@ -172,9 +239,33 @@ interface DbUpdateOptions {
|
|
|
172
239
|
* or re-run with -y/--yes.
|
|
173
240
|
*/
|
|
174
241
|
readonly acceptDataLoss?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* On-disk migrations directory. Always required — every `db update`
|
|
244
|
+
* routes through the per-space flow, which reads on-disk
|
|
245
|
+
* `refs/head.json` and extension destination contracts from this
|
|
246
|
+
* root.
|
|
247
|
+
*/
|
|
248
|
+
readonly migrationsDir: string;
|
|
175
249
|
/** Optional progress callback for observing operation progress */
|
|
176
250
|
readonly onProgress?: OnControlProgress;
|
|
177
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Options for the dbVerify operation.
|
|
254
|
+
*
|
|
255
|
+
* Drives the loader → aggregate-verifier pipeline. `strict` maps to
|
|
256
|
+
* `verifyAggregate({ mode: 'strict' | 'lenient' })`; `skipSchema`
|
|
257
|
+
* mirrors the `--marker-only` CLI flag and short-circuits the schema
|
|
258
|
+
* portion of the verifier.
|
|
259
|
+
*/
|
|
260
|
+
interface DbVerifyOptions {
|
|
261
|
+
readonly contract: unknown;
|
|
262
|
+
readonly migrationsDir: string;
|
|
263
|
+
readonly strict: boolean;
|
|
264
|
+
readonly skipSchema: boolean;
|
|
265
|
+
readonly skipMarker: boolean;
|
|
266
|
+
readonly connection?: unknown;
|
|
267
|
+
readonly onProgress?: OnControlProgress;
|
|
268
|
+
}
|
|
178
269
|
/**
|
|
179
270
|
* Options for the introspect operation.
|
|
180
271
|
*/
|
|
@@ -574,6 +665,20 @@ interface ControlClient {
|
|
|
574
665
|
* @throws If not connected, target doesn't support migrations, or infrastructure failure
|
|
575
666
|
*/
|
|
576
667
|
dbUpdate(options: DbUpdateOptions): Promise<DbUpdateResult>;
|
|
668
|
+
/**
|
|
669
|
+
* Verifies the database against every contract space (app + extensions).
|
|
670
|
+
*
|
|
671
|
+
* Loader → aggregate-verifier pipeline:
|
|
672
|
+
* - The loader catches layout / drift / disjointness violations.
|
|
673
|
+
* - The aggregate verifier surfaces marker-vs-on-disk drift and orphan
|
|
674
|
+
* markers, and (unless `skipSchema` is true) per-space schema
|
|
675
|
+
* verification with pre-projection (closes F23).
|
|
676
|
+
*
|
|
677
|
+
* @returns Result pattern: per-space schema results on success;
|
|
678
|
+
* structured CLI error on marker / loader failure.
|
|
679
|
+
* @throws If not connected or infrastructure failure
|
|
680
|
+
*/
|
|
681
|
+
dbVerify(options: DbVerifyOptions): Promise<ExecuteDbVerifyResult>;
|
|
577
682
|
/**
|
|
578
683
|
* Reads the contract marker from the database.
|
|
579
684
|
* Returns null if no marker exists (fresh database).
|
|
@@ -581,6 +686,12 @@ interface ControlClient {
|
|
|
581
686
|
* @throws If not connected or infrastructure failure
|
|
582
687
|
*/
|
|
583
688
|
readMarker(): Promise<ContractMarkerRecord | null>;
|
|
689
|
+
/**
|
|
690
|
+
* Reads every marker row (one per contract space). Used by the
|
|
691
|
+
* per-space verifier to detect orphan marker rows and marker-vs-on-disk
|
|
692
|
+
* drift after a database connection has been established.
|
|
693
|
+
*/
|
|
694
|
+
readAllMarkers(): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
|
|
584
695
|
/**
|
|
585
696
|
* Applies pre-planned on-disk migrations to the database.
|
|
586
697
|
* Each migration runs in its own transaction with full execution checks.
|
|
@@ -677,8 +788,95 @@ declare function enrichContract(ir: Contract, components: ReadonlyArray<TargetBo
|
|
|
677
788
|
*/
|
|
678
789
|
declare function executeContractEmit(options: ContractEmitOptions): Promise<ContractEmitResult>;
|
|
679
790
|
//#endregion
|
|
791
|
+
//#region src/control-api/operations/db-init.d.ts
|
|
792
|
+
/**
|
|
793
|
+
* Options for executing the `db init` operation.
|
|
794
|
+
*
|
|
795
|
+
* `db init` runs the loader → planner → runner pipeline:
|
|
796
|
+
*
|
|
797
|
+
* 1. {@link executeAggregateApply} loads a `ContractSpaceAggregate` via
|
|
798
|
+
* {@link import('@prisma-next/migration-tools/aggregate').loadContractSpaceAggregate}
|
|
799
|
+
* from the supplied descriptor set + on-disk on-disk artefacts.
|
|
800
|
+
* 2. The aggregate planner runs with `callerPolicy.ignoreGraphFor`
|
|
801
|
+
* locked to the app member — synth strategy for the app, graph-walk
|
|
802
|
+
* for every extension.
|
|
803
|
+
* 3. The runner's `executeAcrossSpaces` applies the per-space plans
|
|
804
|
+
* inside one outer transaction.
|
|
805
|
+
*
|
|
806
|
+
* `extensionPacks` mirrors `Config.extensionPacks` (descriptor list).
|
|
807
|
+
* The loader (sub-spec § Loader) is the sole descriptor-import boundary.
|
|
808
|
+
*/
|
|
809
|
+
interface ExecuteDbInitOptions<TFamilyId extends string, TTargetId extends string> {
|
|
810
|
+
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
811
|
+
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
812
|
+
readonly contract: Contract;
|
|
813
|
+
readonly mode: 'plan' | 'apply';
|
|
814
|
+
readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, ControlFamilyInstance<TFamilyId, unknown>>;
|
|
815
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
816
|
+
/**
|
|
817
|
+
* On-disk migrations directory the aggregate loader reads on-disk
|
|
818
|
+
* artefacts from. Required.
|
|
819
|
+
*/
|
|
820
|
+
readonly migrationsDir: string;
|
|
821
|
+
/**
|
|
822
|
+
* Resolved adapter target id. Threaded through to the loader for
|
|
823
|
+
* target-consistency checks across descriptors and the app contract.
|
|
824
|
+
*/
|
|
825
|
+
readonly targetId: TTargetId;
|
|
826
|
+
/**
|
|
827
|
+
* Declared extension descriptors. Defaults to an empty list, which
|
|
828
|
+
* routes through the same loader → planner → runner pipeline with no
|
|
829
|
+
* extension members in the aggregate.
|
|
830
|
+
*/
|
|
831
|
+
readonly extensionPacks?: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
832
|
+
/** Optional progress callback for observing operation progress */
|
|
833
|
+
readonly onProgress?: OnControlProgress;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Execute `db init` against the configured contract.
|
|
837
|
+
*
|
|
838
|
+
* Routes through the loader → planner → runner pipeline (sub-spec
|
|
839
|
+
* "Commit-by-commit § Commit 4"). Always additive-only; destructive
|
|
840
|
+
* changes belong to `db update`.
|
|
841
|
+
*/
|
|
842
|
+
declare function executeDbInit<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbInitOptions<TFamilyId, TTargetId>): Promise<DbInitResult>;
|
|
843
|
+
//#endregion
|
|
844
|
+
//#region src/control-api/operations/db-update.d.ts
|
|
845
|
+
/**
|
|
846
|
+
* Options for the `db update` operation.
|
|
847
|
+
*
|
|
848
|
+
* Same loader → planner → runner pipeline as `db init`, but with the
|
|
849
|
+
* widened operation policy (additive + widening + destructive). The
|
|
850
|
+
* destructive-change confirmation gate runs at this layer: when
|
|
851
|
+
* `mode === 'apply'` and `acceptDataLoss` is `false`, the operation
|
|
852
|
+
* pre-plans, surfaces destructive ops to the caller, and aborts.
|
|
853
|
+
*/
|
|
854
|
+
interface ExecuteDbUpdateOptions<TFamilyId extends string, TTargetId extends string> {
|
|
855
|
+
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
856
|
+
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
857
|
+
readonly contract: Contract;
|
|
858
|
+
readonly mode: 'plan' | 'apply';
|
|
859
|
+
readonly migrations: TargetMigrationsCapability<TFamilyId, TTargetId, ControlFamilyInstance<TFamilyId, unknown>>;
|
|
860
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
861
|
+
readonly acceptDataLoss?: boolean;
|
|
862
|
+
readonly migrationsDir: string;
|
|
863
|
+
readonly targetId: TTargetId;
|
|
864
|
+
readonly extensionPacks?: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
865
|
+
readonly onProgress?: OnControlProgress;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Execute `db update` against the configured contract.
|
|
869
|
+
*
|
|
870
|
+
* Routes through the loader → planner → runner pipeline. Destructive
|
|
871
|
+
* operations require either `acceptDataLoss: true` or a prior
|
|
872
|
+
* `mode: 'plan'` invocation that surfaces the destructive ops; the
|
|
873
|
+
* confirmation gate is implemented here so the lower-level applier
|
|
874
|
+
* remains policy-agnostic.
|
|
875
|
+
*/
|
|
876
|
+
declare function executeDbUpdate<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbUpdateOptions<TFamilyId, TTargetId>): Promise<DbUpdateResult>;
|
|
877
|
+
//#endregion
|
|
680
878
|
//#region src/utils/emit-queue.d.ts
|
|
681
879
|
declare function disposeEmitQueue(outputJsonPath: string): void;
|
|
682
880
|
//#endregion
|
|
683
|
-
export { type ContractEmitOptions, type ContractEmitResult, type ControlActionName, type ControlClient, type ControlClientOptions, type ControlProgressEvent, type ControlStack, type DbInitFailure, type DbInitFailureCode, type DbInitOptions, type DbInitResult, type DbInitSuccess, type DbUpdateFailure, type DbUpdateFailureCode, type DbUpdateOptions, type DbUpdateResult, type DbUpdateSuccess, type EmitContractConfig, type EmitFailure, type EmitFailureCode, type EmitOptions, type EmitResult, type EmitSuccess, type IntrospectOptions, type OnControlProgress, type SchemaVerifyOptions, type SignDatabaseResult, type SignOptions, type VerifyDatabaseResult, type VerifyDatabaseSchemaResult, type VerifyOptions, createControlClient, disposeEmitQueue, enrichContract, executeContractEmit };
|
|
881
|
+
export { type ContractEmitOptions, type ContractEmitResult, type ControlActionName, type ControlClient, type ControlClientOptions, type ControlProgressEvent, type ControlStack, type DbInitFailure, type DbInitFailureCode, type DbInitOptions, type DbInitResult, type DbInitSuccess, type DbUpdateFailure, type DbUpdateFailureCode, type DbUpdateOptions, type DbUpdateResult, type DbUpdateSuccess, type EmitContractConfig, type EmitFailure, type EmitFailureCode, type EmitOptions, type EmitResult, type EmitSuccess, type ExecuteDbInitOptions, type ExecuteDbUpdateOptions, type ExecuteDbVerifyOptions, type ExecuteDbVerifyResult, type IntrospectOptions, type OnControlProgress, type SchemaVerifyOptions, type SignDatabaseResult, type SignOptions, type VerifyDatabaseResult, type VerifyDatabaseSchemaResult, type VerifyOptions, createControlClient, disposeEmitQueue, enrichContract, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify };
|
|
684
882
|
//# sourceMappingURL=control-api.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-api.d.mts","names":[],"sources":["../../src/control-api/types.ts","../../src/control-api/client.ts","../../src/control-api/contract-enrichment.ts","../../src/control-api/operations/contract-emit.ts","../../src/utils/emit-queue.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"control-api.d.mts","names":[],"sources":["../../src/control-api/operations/db-verify.ts","../../src/control-api/types.ts","../../src/control-api/client.ts","../../src/control-api/contract-enrichment.ts","../../src/control-api/operations/contract-emit.ts","../../src/control-api/operations/db-init.ts","../../src/control-api/operations/db-update.ts","../../src/utils/emit-queue.ts"],"mappings":";;;;;;;;;;;;AAwCA;;;;;;UAAiB,sBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,aAAA;EAAA,SACA,QAAA,EAAU,SAAA;EAAA,SACV,cAAA,EAAg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UF,aAAA,oDAAA,CACpB,OAAA,EAAS,oBAAA,CAAqB,SAAA,EAAW,SAAA,IACxC,OAAA,CAAQ,YAAA;;;;;;;;AL7BX;;;;UMdiB,sBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,IAAA;EAAA,SACA,UAAA,EAAY,0BAAA,CACnB,SAAA,EACA,SAAA,EACA,qBAAA,CAAsB,SAAA;EAAA,SAEf,mBAAA,EAAqB,aAAA,CAAc,8BAAA,CAA+B,SAAA,EAAW,SAAA;EAAA,SAC7E,cAAA;EAAA,SACA,aAAA;EAAA,SACA,QAAA,EAAU,SAAA;EAAA,SACV,cAAA,GAAiB,aAAA,CAAc,0BAAA,CAA2B,SAAA,EAAW,SAAA;EAAA,SACrE,UAAA,GAAa,iBAAA;AAAA;;;;;;;;;;iBAYF,eAAA,oDAAA,CACpB,OAAA,EAAS,sBAAA,CAAuB,SAAA,EAAW,SAAA,IAC1C,OAAA,CAAQ,cAAA;;;iBChCK,gBAAA,CAAiB,cAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { n as executeContractEmit, r as disposeEmitQueue } from "../contract-emit-B3ChISB_.mjs";
|
|
2
2
|
import { t as enrichContract } from "../contract-enrichment-CF6ogEJ_.mjs";
|
|
3
|
-
import { t as createControlClient } from "../client-
|
|
4
|
-
export { createControlClient, disposeEmitQueue, enrichContract, executeContractEmit };
|
|
3
|
+
import { i as executeDbInit, n as executeDbVerify, r as executeDbUpdate, t as createControlClient } from "../client-0ZX24FXF.mjs";
|
|
4
|
+
export { createControlClient, disposeEmitQueue, enrichContract, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/load-ts-contract.ts"],"mappings":";;;;UAQiB,qBAAA;EAAA,SACN,SAAA,GAAY,aAAA;AAAA;AADvB;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/load-ts-contract.ts"],"mappings":";;;;UAQiB,qBAAA;EAAA,SACN,SAAA,GAAY,aAAA;AAAA;AADvB;;;;;AA6HA;;;;;;;;;;AA7HA,iBA6HsB,kBAAA,CACpB,SAAA,UACA,OAAA,GAAU,qBAAA,GACT,OAAA,CAAQ,QAAA"}
|
package/dist/exports/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createContractEmitCommand } from "../contract-emit-
|
|
2
|
-
import { join } from "pathe";
|
|
1
|
+
import { t as createContractEmitCommand } from "../contract-emit-DkMqO7f2.mjs";
|
|
2
|
+
import { join, resolve } from "pathe";
|
|
3
3
|
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -45,17 +45,24 @@ function validatePurity(value) {
|
|
|
45
45
|
throw new Error("Contract export is not JSON-serializable");
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function createImportAllowlistPlugin(allowlist, entryPath) {
|
|
48
|
+
function createImportAllowlistPlugin(allowlist, entryPath, collected) {
|
|
49
|
+
const entryAbs = resolve(entryPath);
|
|
50
|
+
function isFromEntry(importer) {
|
|
51
|
+
return importer === entryAbs || importer === entryPath || importer === "<stdin>";
|
|
52
|
+
}
|
|
49
53
|
return {
|
|
50
54
|
name: "import-allowlist",
|
|
51
55
|
setup(build) {
|
|
52
56
|
build.onResolve({ filter: /.*/ }, (args) => {
|
|
53
57
|
if (args.kind === "entry-point") return;
|
|
54
58
|
if (args.path.startsWith(".") || args.path.startsWith("/")) return;
|
|
55
|
-
if ((args.importer
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
if (isFromEntry(args.importer) && !isAllowedImport(args.path, allowlist)) {
|
|
60
|
+
collected.add(args.path);
|
|
61
|
+
return {
|
|
62
|
+
path: args.path,
|
|
63
|
+
external: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
59
66
|
});
|
|
60
67
|
}
|
|
61
68
|
};
|
|
@@ -79,6 +86,7 @@ async function loadContractFromTs(entryPath, options) {
|
|
|
79
86
|
const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;
|
|
80
87
|
if (!existsSync(entryPath)) throw new Error(`Contract file not found: ${entryPath}`);
|
|
81
88
|
const tempFile = join(tmpdir(), `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`);
|
|
89
|
+
const disallowedFromEntry = /* @__PURE__ */ new Set();
|
|
82
90
|
try {
|
|
83
91
|
const result = await build({
|
|
84
92
|
entryPoints: [entryPath],
|
|
@@ -89,7 +97,7 @@ async function loadContractFromTs(entryPath, options) {
|
|
|
89
97
|
outfile: tempFile,
|
|
90
98
|
write: false,
|
|
91
99
|
metafile: true,
|
|
92
|
-
plugins: [createImportAllowlistPlugin(allowlist, entryPath)],
|
|
100
|
+
plugins: [createImportAllowlistPlugin(allowlist, entryPath, disallowedFromEntry)],
|
|
93
101
|
logLevel: "error"
|
|
94
102
|
});
|
|
95
103
|
if (result.errors.length > 0) {
|
|
@@ -97,15 +105,7 @@ async function loadContractFromTs(entryPath, options) {
|
|
|
97
105
|
throw new Error(`Failed to bundle contract file: ${errorMessages}`);
|
|
98
106
|
}
|
|
99
107
|
if (!result.outputFiles || result.outputFiles.length === 0) throw new Error("No output files generated from bundling");
|
|
100
|
-
|
|
101
|
-
if (result.metafile) {
|
|
102
|
-
const inputs = result.metafile.inputs;
|
|
103
|
-
for (const [, inputData] of Object.entries(inputs)) {
|
|
104
|
-
const imports = inputData.imports || [];
|
|
105
|
-
for (const imp of imports) if (imp.external && !imp.path.startsWith(".") && !imp.path.startsWith("/") && !isAllowedImport(imp.path, allowlist)) disallowedImports.push(imp.path);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (disallowedImports.length > 0) throw new Error(`Disallowed imports detected. Only imports matching the allowlist are permitted:\n Allowlist: ${allowlist.join(", ")}\n Disallowed imports: ${disallowedImports.join(", ")}\n\nOnly @prisma-next/* packages are allowed in contract files.`);
|
|
108
|
+
if (disallowedFromEntry.size > 0) throw new Error(`Disallowed imports detected. Only imports matching the allowlist are permitted:\n Allowlist: ${allowlist.join(", ")}\n Disallowed imports: ${[...disallowedFromEntry].join(", ")}`);
|
|
109
109
|
const bundleContent = result.outputFiles[0]?.text;
|
|
110
110
|
if (bundleContent === void 0) throw new Error("Bundle content is undefined");
|
|
111
111
|
writeFileSync(tempFile, bundleContent, "utf-8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/load-ts-contract.ts"],"sourcesContent":["import { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { pathToFileURL } from 'node:url';\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { Plugin } from 'esbuild';\nimport { build } from 'esbuild';\nimport { join } from 'pathe';\n\nexport interface LoadTsContractOptions {\n readonly allowlist?: ReadonlyArray<string>;\n}\n\nconst DEFAULT_ALLOWLIST = ['@prisma-next/*', 'node:crypto'];\n\nfunction isAllowedImport(importPath: string, allowlist: ReadonlyArray<string>): boolean {\n for (const pattern of allowlist) {\n if (pattern.endsWith('/*')) {\n const prefix = pattern.slice(0, -2);\n if (importPath === prefix || importPath.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (pattern.endsWith('*')) {\n const prefix = pattern.slice(0, -1);\n if (importPath.startsWith(prefix)) {\n return true;\n }\n } else if (importPath === pattern) {\n return true;\n }\n }\n return false;\n}\n\nfunction validatePurity(value: unknown): void {\n if (typeof value !== 'object' || value === null) {\n return;\n }\n\n const path = new WeakSet();\n\n function check(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n return;\n }\n\n if (path.has(value)) {\n throw new Error('Contract export contains circular references');\n }\n path.add(value);\n\n try {\n for (const key in value) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor && (descriptor.get || descriptor.set)) {\n throw new Error(`Contract export contains getter/setter at key \"${key}\"`);\n }\n if (descriptor && typeof descriptor.value === 'function') {\n throw new Error(`Contract export contains function at key \"${key}\"`);\n }\n check((value as Record<string, unknown>)[key]);\n }\n } finally {\n path.delete(value);\n }\n }\n\n try {\n check(value);\n JSON.stringify(value);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('getter') || error.message.includes('circular')) {\n throw error;\n }\n throw new Error(`Contract export is not JSON-serializable: ${error.message}`);\n }\n throw new Error('Contract export is not JSON-serializable');\n }\n}\n\nfunction createImportAllowlistPlugin(allowlist: ReadonlyArray<string>, entryPath: string): Plugin {\n return {\n name: 'import-allowlist',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (args.kind === 'entry-point') {\n return undefined;\n }\n if (args.path.startsWith('.') || args.path.startsWith('/')) {\n return undefined;\n }\n const isFromEntryPoint = args.importer === entryPath || args.importer === '<stdin>';\n if (isFromEntryPoint && !isAllowedImport(args.path, allowlist)) {\n return {\n path: args.path,\n external: true,\n };\n }\n return undefined;\n });\n },\n };\n}\n\n/**\n * Loads a contract from a TypeScript file and returns it as Contract.\n *\n * **Responsibility: Parsing Only**\n * This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n * The contract should already be normalized if it was built using the contract builder.\n *\n * Normalization must happen in the contract builder when the contract is created.\n * This function only validates that the contract is JSON-serializable and returns it as-is.\n *\n * @param entryPath - Path to the TypeScript contract file\n * @param options - Optional configuration (import allowlist)\n * @returns The contract as Contract (should already be normalized)\n * @throws Error if the contract cannot be loaded or is not JSON-serializable\n */\nexport async function loadContractFromTs(\n entryPath: string,\n options?: LoadTsContractOptions,\n): Promise<Contract> {\n const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\n if (!existsSync(entryPath)) {\n throw new Error(`Contract file not found: ${entryPath}`);\n }\n\n const tempFile = join(\n tmpdir(),\n `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`,\n );\n\n try {\n const result = await build({\n entryPoints: [entryPath],\n bundle: true,\n format: 'esm',\n platform: 'node',\n target: 'es2022',\n outfile: tempFile,\n write: false,\n metafile: true,\n plugins: [createImportAllowlistPlugin(allowlist, entryPath)],\n logLevel: 'error',\n });\n\n if (result.errors.length > 0) {\n const errorMessages = result.errors.map((e: { text: string }) => e.text).join('\\n');\n throw new Error(`Failed to bundle contract file: ${errorMessages}`);\n }\n\n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated from bundling');\n }\n\n const disallowedImports: string[] = [];\n if (result.metafile) {\n const inputs = result.metafile.inputs;\n for (const [, inputData] of Object.entries(inputs)) {\n const imports =\n (inputData as { imports?: Array<{ path: string; external?: boolean }> }).imports || [];\n for (const imp of imports) {\n if (\n imp.external &&\n !imp.path.startsWith('.') &&\n !imp.path.startsWith('/') &&\n !isAllowedImport(imp.path, allowlist)\n ) {\n disallowedImports.push(imp.path);\n }\n }\n }\n }\n\n if (disallowedImports.length > 0) {\n throw new Error(\n `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(', ')}\\n Disallowed imports: ${disallowedImports.join(', ')}\\n\\nOnly @prisma-next/* packages are allowed in contract files.`,\n );\n }\n\n const bundleContent = result.outputFiles[0]?.text;\n if (bundleContent === undefined) {\n throw new Error('Bundle content is undefined');\n }\n writeFileSync(tempFile, bundleContent, 'utf-8');\n\n const module = (await import(/* @vite-ignore */ pathToFileURL(tempFile).href)) as {\n default?: unknown;\n contract?: unknown;\n };\n unlinkSync(tempFile);\n\n let contract: unknown;\n\n if (module.default !== undefined) {\n contract = module.default;\n } else if (module.contract !== undefined) {\n contract = module.contract;\n } else {\n throw new Error(\n `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module as Record<string, unknown>).join(', ') || 'none'}`,\n );\n }\n\n if (typeof contract !== 'object' || contract === null) {\n throw new Error(`Contract export must be an object, got ${typeof contract}`);\n }\n\n validatePurity(contract);\n\n return contract as Contract;\n } catch (error) {\n try {\n if (tempFile) {\n unlinkSync(tempFile);\n }\n } catch {\n // Ignore cleanup errors\n }\n\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(`Failed to load contract from ${entryPath}: ${String(error)}`);\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,oBAAoB,CAAC,kBAAkB,cAAc;AAE3D,SAAS,gBAAgB,YAAoB,WAA2C;CACtF,KAAK,MAAM,WAAW,WACpB,IAAI,QAAQ,SAAS,KAAK,EAAE;EAC1B,MAAM,SAAS,QAAQ,MAAM,GAAG,GAAG;EACnC,IAAI,eAAe,UAAU,WAAW,WAAW,GAAG,OAAO,GAAG,EAC9D,OAAO;QAEJ,IAAI,QAAQ,SAAS,IAAI,EAAE;EAChC,MAAM,SAAS,QAAQ,MAAM,GAAG,GAAG;EACnC,IAAI,WAAW,WAAW,OAAO,EAC/B,OAAO;QAEJ,IAAI,eAAe,SACxB,OAAO;CAGX,OAAO;;AAGT,SAAS,eAAe,OAAsB;CAC5C,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC;CAGF,MAAM,uBAAO,IAAI,SAAS;CAE1B,SAAS,MAAM,OAAsB;EACnC,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC;EAGF,IAAI,KAAK,IAAI,MAAM,EACjB,MAAM,IAAI,MAAM,+CAA+C;EAEjE,KAAK,IAAI,MAAM;EAEf,IAAI;GACF,KAAK,MAAM,OAAO,OAAO;IACvB,MAAM,aAAa,OAAO,yBAAyB,OAAO,IAAI;IAC9D,IAAI,eAAe,WAAW,OAAO,WAAW,MAC9C,MAAM,IAAI,MAAM,kDAAkD,IAAI,GAAG;IAE3E,IAAI,cAAc,OAAO,WAAW,UAAU,YAC5C,MAAM,IAAI,MAAM,6CAA6C,IAAI,GAAG;IAEtE,MAAO,MAAkC,KAAK;;YAExC;GACR,KAAK,OAAO,MAAM;;;CAItB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U,IAAI,OAAO,MAAM,GAAG"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["resolvePath"],"sources":["../../src/load-ts-contract.ts"],"sourcesContent":["import { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { pathToFileURL } from 'node:url';\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { Plugin } from 'esbuild';\nimport { build } from 'esbuild';\nimport { join, resolve as resolvePath } from 'pathe';\n\nexport interface LoadTsContractOptions {\n readonly allowlist?: ReadonlyArray<string>;\n}\n\nconst DEFAULT_ALLOWLIST = ['@prisma-next/*', 'node:crypto'];\n\nfunction isAllowedImport(importPath: string, allowlist: ReadonlyArray<string>): boolean {\n for (const pattern of allowlist) {\n if (pattern.endsWith('/*')) {\n const prefix = pattern.slice(0, -2);\n if (importPath === prefix || importPath.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (pattern.endsWith('*')) {\n const prefix = pattern.slice(0, -1);\n if (importPath.startsWith(prefix)) {\n return true;\n }\n } else if (importPath === pattern) {\n return true;\n }\n }\n return false;\n}\n\nfunction validatePurity(value: unknown): void {\n if (typeof value !== 'object' || value === null) {\n return;\n }\n\n const path = new WeakSet();\n\n function check(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n return;\n }\n\n if (path.has(value)) {\n throw new Error('Contract export contains circular references');\n }\n path.add(value);\n\n try {\n for (const key in value) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor && (descriptor.get || descriptor.set)) {\n throw new Error(`Contract export contains getter/setter at key \"${key}\"`);\n }\n if (descriptor && typeof descriptor.value === 'function') {\n throw new Error(`Contract export contains function at key \"${key}\"`);\n }\n check((value as Record<string, unknown>)[key]);\n }\n } finally {\n path.delete(value);\n }\n }\n\n try {\n check(value);\n JSON.stringify(value);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('getter') || error.message.includes('circular')) {\n throw error;\n }\n throw new Error(`Contract export is not JSON-serializable: ${error.message}`);\n }\n throw new Error('Contract export is not JSON-serializable');\n }\n}\n\nfunction createImportAllowlistPlugin(\n allowlist: ReadonlyArray<string>,\n entryPath: string,\n collected: Set<string>,\n): Plugin {\n // Match against several path forms that esbuild may use as the importer:\n // the absolute resolved entry, the value the caller passed (which may be\n // relative), and the conventional `<stdin>` placeholder. This is more\n // forgiving than `===` against a single form, which broke when esbuild\n // resolved the entry to an absolute path while the caller passed a\n // relative one (or vice versa).\n const entryAbs = resolvePath(entryPath);\n function isFromEntry(importer: string): boolean {\n return importer === entryAbs || importer === entryPath || importer === '<stdin>';\n }\n return {\n name: 'import-allowlist',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (args.kind === 'entry-point') {\n return undefined;\n }\n if (args.path.startsWith('.') || args.path.startsWith('/')) {\n return undefined;\n }\n if (isFromEntry(args.importer) && !isAllowedImport(args.path, allowlist)) {\n collected.add(args.path);\n return {\n path: args.path,\n external: true,\n };\n }\n return undefined;\n });\n },\n };\n}\n\n/**\n * Loads a contract from a TypeScript file and returns it as Contract.\n *\n * **Responsibility: Parsing Only**\n * This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n * The contract should already be normalized if it was built using the contract builder.\n *\n * Normalization must happen in the contract builder when the contract is created.\n * This function only validates that the contract is JSON-serializable and returns it as-is.\n *\n * @param entryPath - Path to the TypeScript contract file\n * @param options - Optional configuration (import allowlist)\n * @returns The contract as Contract (should already be normalized)\n * @throws Error if the contract cannot be loaded or is not JSON-serializable\n */\nexport async function loadContractFromTs(\n entryPath: string,\n options?: LoadTsContractOptions,\n): Promise<Contract> {\n const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\n if (!existsSync(entryPath)) {\n throw new Error(`Contract file not found: ${entryPath}`);\n }\n\n const tempFile = join(\n tmpdir(),\n `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`,\n );\n\n // Disallowed imports are collected by the allowlist resolver plugin itself,\n // which has the `importer` context to distinguish entry-direct imports from\n // transitive imports made inside allowlisted (`@prisma-next/*`) dependencies.\n // The metafile is intentionally not re-walked: it would surface internal\n // `node:*` imports inside framework code as false positives.\n const disallowedFromEntry = new Set<string>();\n\n try {\n const result = await build({\n entryPoints: [entryPath],\n bundle: true,\n format: 'esm',\n platform: 'node',\n target: 'es2022',\n outfile: tempFile,\n write: false,\n metafile: true,\n plugins: [createImportAllowlistPlugin(allowlist, entryPath, disallowedFromEntry)],\n logLevel: 'error',\n });\n\n if (result.errors.length > 0) {\n const errorMessages = result.errors.map((e: { text: string }) => e.text).join('\\n');\n throw new Error(`Failed to bundle contract file: ${errorMessages}`);\n }\n\n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated from bundling');\n }\n\n if (disallowedFromEntry.size > 0) {\n throw new Error(\n `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(', ')}\\n Disallowed imports: ${[...disallowedFromEntry].join(', ')}`,\n );\n }\n\n const bundleContent = result.outputFiles[0]?.text;\n if (bundleContent === undefined) {\n throw new Error('Bundle content is undefined');\n }\n writeFileSync(tempFile, bundleContent, 'utf-8');\n\n const module = (await import(/* @vite-ignore */ pathToFileURL(tempFile).href)) as {\n default?: unknown;\n contract?: unknown;\n };\n unlinkSync(tempFile);\n\n let contract: unknown;\n\n if (module.default !== undefined) {\n contract = module.default;\n } else if (module.contract !== undefined) {\n contract = module.contract;\n } else {\n throw new Error(\n `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module as Record<string, unknown>).join(', ') || 'none'}`,\n );\n }\n\n if (typeof contract !== 'object' || contract === null) {\n throw new Error(`Contract export must be an object, got ${typeof contract}`);\n }\n\n validatePurity(contract);\n\n return contract as Contract;\n } catch (error) {\n try {\n if (tempFile) {\n unlinkSync(tempFile);\n }\n } catch {\n // Ignore cleanup errors\n }\n\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(`Failed to load contract from ${entryPath}: ${String(error)}`);\n }\n}\n"],"mappings":";;;;;;;AA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AAW,GACvD,MAAM,IAAI,MAAM,0CAA0C;EAG5D,IAAI,oBAAoB,OAAO,GAC7B,MAAM,IAAI,MACR,iGAAiG,UAAU,KAAK,KAAK,CAAC,0BAA0B,CAAC,GAAG,oBAAoB,CAAC,KAAK,KAAK,GACpL;EAGH,MAAM,gBAAgB,OAAO,YAAY,IAAI;EAC7C,IAAI,kBAAkB,KAAA,GACpB,MAAM,IAAI,MAAM,8BAA8B;EAEhD,cAAc,UAAU,eAAe,QAAQ;EAE/C,MAAM,SAAU,MAAM;;GAA0B,cAAc,SAAS,CAAC;;EAIxE,WAAW,SAAS;EAEpB,IAAI;EAEJ,IAAI,OAAO,YAAY,KAAA,GACrB,WAAW,OAAO;OACb,IAAI,OAAO,aAAa,KAAA,GAC7B,WAAW,OAAO;OAElB,MAAM,IAAI,MACR,qGAAqG,OAAO,KAAK,OAAkC,CAAC,KAAK,KAAK,IAAI,SACnK;EAGH,IAAI,OAAO,aAAa,YAAY,aAAa,MAC/C,MAAM,IAAI,MAAM,0CAA0C,OAAO,WAAW;EAG9E,eAAe,SAAS;EAExB,OAAO;UACA,OAAO;EACd,IAAI;GACF,IAAI,UACF,WAAW,SAAS;UAEhB;EAIR,IAAI,iBAAiB,OACnB,MAAM;EAER,MAAM,IAAI,MAAM,gCAAgC,UAAU,IAAI,OAAO,MAAM,GAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as InitOutputSchema } from "../output-
|
|
1
|
+
import { t as InitOutputSchema } from "../output-DnjfCC_u.mjs";
|
|
2
2
|
export { InitOutputSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CliStructuredError } from "./cli-errors-D3_sMh2K.mjs";
|
|
2
2
|
import { i as formatErrorOutput, r as formatErrorJson, t as TerminalUI } from "./terminal-ui-zaRDhJnP.mjs";
|
|
3
|
-
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-
|
|
3
|
+
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-DnjfCC_u.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { dirname, extname, isAbsolute, join, normalize } from "pathe";
|
|
6
6
|
import * as clack from "@clack/prompts";
|
|
@@ -2050,4 +2050,4 @@ function causeMessage(err) {
|
|
|
2050
2050
|
//#endregion
|
|
2051
2051
|
export { runInit };
|
|
2052
2052
|
|
|
2053
|
-
//# sourceMappingURL=init-
|
|
2053
|
+
//# sourceMappingURL=init-Deo7U8_U.mjs.map
|