@supacloud/compiler 0.52.2 → 0.53.1
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.js +638 -201
- package/dist/index.js +9 -0
- package/dist/preview-fix-cli.d.ts +2 -0
- package/dist/preview-fix-loop.d.ts +72 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -17126,11 +17126,6 @@ ${source.text}`;
|
|
|
17126
17126
|
}
|
|
17127
17127
|
var init_fixes = () => {};
|
|
17128
17128
|
|
|
17129
|
-
// src/delivery-files.ts
|
|
17130
|
-
var init_delivery_files2 = __esm(() => {
|
|
17131
|
-
init_delivery_files();
|
|
17132
|
-
});
|
|
17133
|
-
|
|
17134
17129
|
// node_modules/@supacloud/delivery/src/application-release.ts
|
|
17135
17130
|
var ApplicationIdSchema, ApplicationReleaseIdSchema, ApplicationReleaseRecordSchema;
|
|
17136
17131
|
var init_application_release = __esm(() => {
|
|
@@ -17314,20 +17309,20 @@ var init_application_deploy_plan = __esm(() => {
|
|
|
17314
17309
|
});
|
|
17315
17310
|
|
|
17316
17311
|
// node_modules/@supacloud/delivery/src/application-deploy-operation.ts
|
|
17317
|
-
var
|
|
17312
|
+
var closed5, sha256, nullableActivation, ApplicationDeployWebReleaseSchema, ApplicationDeployRequestSchema, ApplicationBackendReceiptSchema, ApplicationDeployResultSchema;
|
|
17318
17313
|
var init_application_deploy_operation = __esm(() => {
|
|
17319
17314
|
init_build();
|
|
17320
17315
|
init_value2();
|
|
17321
17316
|
init_application_activation();
|
|
17322
17317
|
init_application_configuration();
|
|
17323
17318
|
init_application_release();
|
|
17324
|
-
|
|
17319
|
+
closed5 = { additionalProperties: false };
|
|
17325
17320
|
sha256 = ApplicationReleaseIdSchema;
|
|
17326
17321
|
nullableActivation = Union([ApplicationActivationIdSchema, Null()]);
|
|
17327
17322
|
ApplicationDeployWebReleaseSchema = _Object_({
|
|
17328
17323
|
deployment_id: String2({ pattern: "^[A-Za-z0-9_-]{1,128}$" }),
|
|
17329
17324
|
release_id: sha256
|
|
17330
|
-
},
|
|
17325
|
+
}, closed5);
|
|
17331
17326
|
ApplicationDeployRequestSchema = _Object_({
|
|
17332
17327
|
mutation_id: ApplicationActivationIdSchema,
|
|
17333
17328
|
release_id: sha256,
|
|
@@ -17336,7 +17331,7 @@ var init_application_deploy_operation = __esm(() => {
|
|
|
17336
17331
|
expected_plan_sha256: Optional(sha256),
|
|
17337
17332
|
approved_migration_digest: Optional(sha256),
|
|
17338
17333
|
web_release: Optional(ApplicationDeployWebReleaseSchema)
|
|
17339
|
-
},
|
|
17334
|
+
}, closed5);
|
|
17340
17335
|
ApplicationBackendReceiptSchema = _Object_({
|
|
17341
17336
|
schema: Literal("supacloud.application-backend-receipt.v1"),
|
|
17342
17337
|
project_ref: String2({ pattern: "^[a-z0-9-]{1,20}$" }),
|
|
@@ -17352,7 +17347,7 @@ var init_application_deploy_operation = __esm(() => {
|
|
|
17352
17347
|
applied_versions: _Array_(String2({ pattern: "^\\d{1,20}$" }), { uniqueItems: true }),
|
|
17353
17348
|
schema_reloaded: Boolean2(),
|
|
17354
17349
|
postgrest_healthy: Boolean2()
|
|
17355
|
-
},
|
|
17350
|
+
}, closed5);
|
|
17356
17351
|
ApplicationDeployResultSchema = _Object_({
|
|
17357
17352
|
schema: Literal("supacloud.application-deploy.v1"),
|
|
17358
17353
|
project_ref: String2({ pattern: "^[a-z0-9-]{1,20}$" }),
|
|
@@ -17373,8 +17368,8 @@ var init_application_deploy_operation = __esm(() => {
|
|
|
17373
17368
|
release_id: sha256,
|
|
17374
17369
|
activation_id: ApplicationActivationIdSchema,
|
|
17375
17370
|
replayed: Boolean2()
|
|
17376
|
-
},
|
|
17377
|
-
},
|
|
17371
|
+
}, closed5))
|
|
17372
|
+
}, closed5);
|
|
17378
17373
|
});
|
|
17379
17374
|
|
|
17380
17375
|
// node_modules/@supacloud/delivery/src/application-history.ts
|
|
@@ -17421,7 +17416,12 @@ var init_application_history = __esm(() => {
|
|
|
17421
17416
|
});
|
|
17422
17417
|
|
|
17423
17418
|
// node_modules/@supacloud/delivery/src/application-preview.ts
|
|
17424
|
-
|
|
17419
|
+
function applicationPreviewBranchRef(previewId) {
|
|
17420
|
+
if (!/^[a-f0-9-]{8,64}$/.test(previewId))
|
|
17421
|
+
throw new Error("Invalid preview ID");
|
|
17422
|
+
return `pv${previewId.replace(/-/g, "").slice(0, 18)}`;
|
|
17423
|
+
}
|
|
17424
|
+
var phaseStatus, closed6, ApplicationPreviewReceiptSchema;
|
|
17425
17425
|
var init_application_preview = __esm(() => {
|
|
17426
17426
|
init_build();
|
|
17427
17427
|
init_value2();
|
|
@@ -17434,7 +17434,7 @@ var init_application_preview = __esm(() => {
|
|
|
17434
17434
|
Literal("failed"),
|
|
17435
17435
|
Literal("cleaned")
|
|
17436
17436
|
]);
|
|
17437
|
-
|
|
17437
|
+
closed6 = { additionalProperties: false };
|
|
17438
17438
|
ApplicationPreviewReceiptSchema = _Object_({
|
|
17439
17439
|
schema: Literal("supacloud.application-preview.v1"),
|
|
17440
17440
|
preview_id: String2({ pattern: "^[a-f0-9-]{8,64}$" }),
|
|
@@ -17454,46 +17454,50 @@ var init_application_preview = __esm(() => {
|
|
|
17454
17454
|
Literal("cleaned")
|
|
17455
17455
|
]),
|
|
17456
17456
|
resources: _Object_({
|
|
17457
|
-
build_artifact: _Object_({ status: phaseStatus, release_id: ApplicationReleaseIdSchema },
|
|
17457
|
+
build_artifact: _Object_({ status: phaseStatus, release_id: ApplicationReleaseIdSchema }, closed6),
|
|
17458
17458
|
database_branch: _Object_({
|
|
17459
17459
|
status: phaseStatus,
|
|
17460
17460
|
branch_ref: String2({ pattern: "^[A-Za-z0-9_-]{1,20}$" }),
|
|
17461
17461
|
data_mode: Union([Literal("schema_only"), Literal("full_clone")])
|
|
17462
|
-
},
|
|
17462
|
+
}, closed6),
|
|
17463
17463
|
queue_namespace: _Object_({
|
|
17464
17464
|
status: phaseStatus,
|
|
17465
17465
|
namespace: String2({ minLength: 1, maxLength: 128 })
|
|
17466
|
-
},
|
|
17466
|
+
}, closed6),
|
|
17467
17467
|
storage_namespace: _Object_({
|
|
17468
17468
|
status: phaseStatus,
|
|
17469
17469
|
namespace: String2({ minLength: 1, maxLength: 128 })
|
|
17470
|
-
},
|
|
17470
|
+
}, closed6),
|
|
17471
17471
|
test_secret: _Object_({
|
|
17472
17472
|
status: phaseStatus,
|
|
17473
17473
|
name: String2({ minLength: 1, maxLength: 128 }),
|
|
17474
17474
|
value_issued: Literal(false)
|
|
17475
|
-
},
|
|
17475
|
+
}, closed6),
|
|
17476
17476
|
configuration_revision: _Object_({
|
|
17477
17477
|
status: phaseStatus,
|
|
17478
17478
|
configuration_id: Union([ApplicationConfigurationIdSchema, Null()])
|
|
17479
|
-
},
|
|
17479
|
+
}, closed6),
|
|
17480
17480
|
application_activation: _Object_({
|
|
17481
17481
|
status: phaseStatus,
|
|
17482
17482
|
activation_id: Union([ApplicationActivationIdSchema, Null()])
|
|
17483
|
-
},
|
|
17483
|
+
}, closed6),
|
|
17484
|
+
functions: Optional(_Object_({
|
|
17485
|
+
status: phaseStatus,
|
|
17486
|
+
slugs: _Array_(String2({ pattern: "^[A-Za-z0-9_-]{1,128}$" }), { maxItems: 64 })
|
|
17487
|
+
}, closed6)),
|
|
17484
17488
|
smoke_test: _Object_({
|
|
17485
17489
|
status: phaseStatus,
|
|
17486
17490
|
checks: _Array_(String2({ minLength: 1, maxLength: 64 }), { maxItems: 32 }),
|
|
17487
17491
|
passed: _Array_(String2({ minLength: 1, maxLength: 64 }), { maxItems: 32 }),
|
|
17488
17492
|
failed: _Array_(String2({ minLength: 1, maxLength: 64 }), { maxItems: 32 })
|
|
17489
|
-
},
|
|
17490
|
-
},
|
|
17493
|
+
}, closed6)
|
|
17494
|
+
}, closed6),
|
|
17491
17495
|
cleanup: _Object_({
|
|
17492
17496
|
required: Boolean2(),
|
|
17493
17497
|
completed: Boolean2(),
|
|
17494
17498
|
error: Union([String2({ minLength: 1, maxLength: 128 }), Null()])
|
|
17495
|
-
},
|
|
17496
|
-
},
|
|
17499
|
+
}, closed6)
|
|
17500
|
+
}, closed6);
|
|
17497
17501
|
});
|
|
17498
17502
|
|
|
17499
17503
|
// node_modules/@supacloud/delivery/src/application-release-transfer.ts
|
|
@@ -17529,13 +17533,13 @@ var init_application_release_transfer = __esm(() => {
|
|
|
17529
17533
|
});
|
|
17530
17534
|
|
|
17531
17535
|
// node_modules/@supacloud/delivery/src/deployment-evidence.ts
|
|
17532
|
-
var
|
|
17536
|
+
var closed7, sha2562, isoDate, status, evidenceStatus, DEPLOYMENT_EVIDENCE_SCHEMA = "supacloud.deployment-evidence.v1", DatabaseProviderSchema, componentName, DeploymentComponentEvidenceSchema, DeploymentEvidenceSchema;
|
|
17533
17537
|
var init_deployment_evidence = __esm(() => {
|
|
17534
17538
|
init_build();
|
|
17535
17539
|
init_value2();
|
|
17536
17540
|
init_application_configuration();
|
|
17537
17541
|
init_application_release();
|
|
17538
|
-
|
|
17542
|
+
closed7 = { additionalProperties: false };
|
|
17539
17543
|
sha2562 = String2({ pattern: "^[a-f0-9]{64}$" });
|
|
17540
17544
|
isoDate = String2({ minLength: 20, maxLength: 40 });
|
|
17541
17545
|
status = Union([
|
|
@@ -17561,19 +17565,19 @@ var init_deployment_evidence = __esm(() => {
|
|
|
17561
17565
|
Literal("not-proven"),
|
|
17562
17566
|
Literal("failed")
|
|
17563
17567
|
])
|
|
17564
|
-
},
|
|
17568
|
+
}, closed7),
|
|
17565
17569
|
backup: _Object_({
|
|
17566
17570
|
status,
|
|
17567
17571
|
latest_success_at: Union([isoDate, Null()]),
|
|
17568
17572
|
freshness_seconds: Union([Integer({ minimum: 0 }), Null()])
|
|
17569
|
-
},
|
|
17573
|
+
}, closed7),
|
|
17570
17574
|
recovery: _Object_({
|
|
17571
17575
|
status,
|
|
17572
17576
|
drill_id: Union([String2({ minLength: 1, maxLength: 128 }), Null()]),
|
|
17573
17577
|
rpo_seconds: Union([Integer({ minimum: 0 }), Null()]),
|
|
17574
17578
|
rto_seconds: Union([Integer({ minimum: 0 }), Null()])
|
|
17575
|
-
},
|
|
17576
|
-
},
|
|
17579
|
+
}, closed7)
|
|
17580
|
+
}, closed7);
|
|
17577
17581
|
componentName = Union([
|
|
17578
17582
|
Literal("management-api"),
|
|
17579
17583
|
Literal("web-console"),
|
|
@@ -17591,7 +17595,7 @@ var init_deployment_evidence = __esm(() => {
|
|
|
17591
17595
|
status,
|
|
17592
17596
|
health_check: Union([String2({ minLength: 1, maxLength: 256 }), Null()]),
|
|
17593
17597
|
checked_at: Union([isoDate, Null()])
|
|
17594
|
-
},
|
|
17598
|
+
}, closed7);
|
|
17595
17599
|
DeploymentEvidenceSchema = _Object_({
|
|
17596
17600
|
schema: Literal(DEPLOYMENT_EVIDENCE_SCHEMA),
|
|
17597
17601
|
status: evidenceStatus,
|
|
@@ -17600,33 +17604,33 @@ var init_deployment_evidence = __esm(() => {
|
|
|
17600
17604
|
project_ref: String2({ pattern: "^[a-z0-9-]{1,20}$" }),
|
|
17601
17605
|
application_id: ApplicationIdSchema,
|
|
17602
17606
|
environment_id: ApplicationIdSchema
|
|
17603
|
-
},
|
|
17607
|
+
}, closed7),
|
|
17604
17608
|
source: _Object_({
|
|
17605
17609
|
commit_sha: Union([String2({ pattern: "^[0-9a-f]{7,64}$" }), Null()]),
|
|
17606
17610
|
manifest_sha256: sha2562,
|
|
17607
17611
|
contract_schema: Union([String2({ minLength: 1, maxLength: 128 }), Null()]),
|
|
17608
17612
|
environment_binding_version: Union([sha2562, Null()])
|
|
17609
|
-
},
|
|
17613
|
+
}, closed7),
|
|
17610
17614
|
database: DatabaseProviderSchema,
|
|
17611
17615
|
components: _Array_(DeploymentComponentEvidenceSchema, { minItems: 1, maxItems: 32 }),
|
|
17612
17616
|
activation: _Object_({
|
|
17613
17617
|
release_id: ApplicationReleaseIdSchema,
|
|
17614
17618
|
configuration_id: ApplicationConfigurationIdSchema,
|
|
17615
17619
|
activation_id: ApplicationConfigurationIdSchema
|
|
17616
|
-
},
|
|
17620
|
+
}, closed7),
|
|
17617
17621
|
health: _Object_({
|
|
17618
17622
|
status,
|
|
17619
17623
|
checked_at: Union([isoDate, Null()]),
|
|
17620
17624
|
authenticated_smoke: status
|
|
17621
|
-
},
|
|
17625
|
+
}, closed7),
|
|
17622
17626
|
rollback: _Object_({
|
|
17623
17627
|
release_id: Union([ApplicationReleaseIdSchema, Null()]),
|
|
17624
17628
|
configuration_id: Union([ApplicationConfigurationIdSchema, Null()]),
|
|
17625
17629
|
status: Union([Literal("ready"), Literal("not-ready"), Literal("unknown")]),
|
|
17626
17630
|
result: Union([status, Null()])
|
|
17627
|
-
},
|
|
17631
|
+
}, closed7),
|
|
17628
17632
|
notes: _Array_(String2({ minLength: 1, maxLength: 512 }), { maxItems: 32 })
|
|
17629
|
-
},
|
|
17633
|
+
}, closed7);
|
|
17630
17634
|
});
|
|
17631
17635
|
|
|
17632
17636
|
// node_modules/@supacloud/delivery/src/delivery-tuple.ts
|
|
@@ -17660,14 +17664,14 @@ var init_delivery_tuple = __esm(() => {
|
|
|
17660
17664
|
});
|
|
17661
17665
|
|
|
17662
17666
|
// node_modules/@supacloud/delivery/src/contract-matrix.ts
|
|
17663
|
-
var
|
|
17667
|
+
var closed8, sha2564, generation, versions, CONTRACT_MATRIX_SCHEMA = "supacloud.consumer-contract-matrix.v1", FA_CONTRACT_SCENARIOS, ConsumerContractMatrixSchema;
|
|
17664
17668
|
var init_contract_matrix = __esm(() => {
|
|
17665
17669
|
init_build();
|
|
17666
17670
|
init_value2();
|
|
17667
|
-
|
|
17671
|
+
closed8 = { additionalProperties: false };
|
|
17668
17672
|
sha2564 = String2({ pattern: "^[a-f0-9]{64}$" });
|
|
17669
17673
|
generation = Union([Literal("old"), Literal("new")]);
|
|
17670
|
-
versions = _Object_({ old: sha2564, new: sha2564 },
|
|
17674
|
+
versions = _Object_({ old: sha2564, new: sha2564 }, closed8);
|
|
17671
17675
|
FA_CONTRACT_SCENARIOS = [
|
|
17672
17676
|
"missing-display-field",
|
|
17673
17677
|
"missing-authority-field",
|
|
@@ -17681,7 +17685,7 @@ var init_contract_matrix = __esm(() => {
|
|
|
17681
17685
|
customer: Literal("xigu-fa"),
|
|
17682
17686
|
baseline_tuple_sha256: sha2564,
|
|
17683
17687
|
candidate_tuple_sha256: sha2564,
|
|
17684
|
-
artifacts: _Object_({ frontend: versions, functions: versions, database: versions },
|
|
17688
|
+
artifacts: _Object_({ frontend: versions, functions: versions, database: versions }, closed8),
|
|
17685
17689
|
cases: _Array_(_Object_({
|
|
17686
17690
|
frontend: generation,
|
|
17687
17691
|
functions: generation,
|
|
@@ -17689,20 +17693,20 @@ var init_contract_matrix = __esm(() => {
|
|
|
17689
17693
|
scenarios: _Array_(_Object_({
|
|
17690
17694
|
name: Enum(FA_CONTRACT_SCENARIOS),
|
|
17691
17695
|
expected: Union([Literal("compatible"), Literal("blocked-safely")])
|
|
17692
|
-
},
|
|
17693
|
-
},
|
|
17694
|
-
},
|
|
17696
|
+
}, closed8), { minItems: FA_CONTRACT_SCENARIOS.length, maxItems: FA_CONTRACT_SCENARIOS.length })
|
|
17697
|
+
}, closed8), { minItems: 8, maxItems: 8 })
|
|
17698
|
+
}, closed8);
|
|
17695
17699
|
});
|
|
17696
17700
|
|
|
17697
17701
|
// node_modules/@supacloud/delivery/src/fa-stability.ts
|
|
17698
|
-
var
|
|
17702
|
+
var closed9, hash3, label, timestamp2, count2, environment2, FA_REQUIRED_ACCEPTANCE, FA_BUSINESS_OPERATIONS, operation, proof, FaBusinessObservationSchema, FaServiceObjectivesSchema, FaStabilityEvidenceSchema;
|
|
17699
17703
|
var init_fa_stability = __esm(() => {
|
|
17700
17704
|
init_build();
|
|
17701
17705
|
init_value2();
|
|
17702
17706
|
init_delivery_files();
|
|
17703
17707
|
init_contract_matrix();
|
|
17704
17708
|
init_delivery_tuple();
|
|
17705
|
-
|
|
17709
|
+
closed9 = { additionalProperties: false };
|
|
17706
17710
|
hash3 = String2({ pattern: "^[a-f0-9]{64}$" });
|
|
17707
17711
|
label = String2({ minLength: 1, maxLength: 256, pattern: "\\S" });
|
|
17708
17712
|
timestamp2 = String2({ minLength: 24, maxLength: 24 });
|
|
@@ -17725,7 +17729,7 @@ var init_fa_stability = __esm(() => {
|
|
|
17725
17729
|
proof = _Object_({
|
|
17726
17730
|
path: String2({ pattern: "^[A-Za-z0-9_-][A-Za-z0-9_./-]{0,255}$" }),
|
|
17727
17731
|
sha256: hash3
|
|
17728
|
-
},
|
|
17732
|
+
}, closed9);
|
|
17729
17733
|
FaBusinessObservationSchema = _Object_({
|
|
17730
17734
|
id: String2({ pattern: "^[A-Za-z0-9_-]{1,128}$" }),
|
|
17731
17735
|
tuple_sha256: hash3,
|
|
@@ -17735,7 +17739,7 @@ var init_fa_stability = __esm(() => {
|
|
|
17735
17739
|
outcome: Enum(["success", "failure", "timeout", "unknown"]),
|
|
17736
17740
|
attempts: Integer({ minimum: 1, maximum: 1000 }),
|
|
17737
17741
|
rollbacks: count2
|
|
17738
|
-
},
|
|
17742
|
+
}, closed9);
|
|
17739
17743
|
FaServiceObjectivesSchema = _Object_({
|
|
17740
17744
|
status: Literal("approved"),
|
|
17741
17745
|
owner: label,
|
|
@@ -17751,8 +17755,8 @@ var init_fa_stability = __esm(() => {
|
|
|
17751
17755
|
minimum_samples: Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
17752
17756
|
availability_percent: Number2({ exclusiveMinimum: 0, maximum: 100 }),
|
|
17753
17757
|
p95_ms: Number2({ exclusiveMinimum: 0, maximum: Number.MAX_SAFE_INTEGER })
|
|
17754
|
-
},
|
|
17755
|
-
},
|
|
17758
|
+
}, closed9), { minItems: FA_BUSINESS_OPERATIONS.length, maxItems: FA_BUSINESS_OPERATIONS.length })
|
|
17759
|
+
}, closed9);
|
|
17756
17760
|
FaStabilityEvidenceSchema = _Object_({
|
|
17757
17761
|
schema: Literal("supacloud.fa-stability-evidence.v1"),
|
|
17758
17762
|
environment: environment2,
|
|
@@ -17778,7 +17782,7 @@ var init_fa_stability = __esm(() => {
|
|
|
17778
17782
|
passed: Boolean2(),
|
|
17779
17783
|
measured_at: timestamp2,
|
|
17780
17784
|
proof
|
|
17781
|
-
},
|
|
17785
|
+
}, closed9), { minItems: 10, maxItems: 10 }),
|
|
17782
17786
|
matrix: _Array_(_Object_({
|
|
17783
17787
|
combination: label,
|
|
17784
17788
|
scenario: label,
|
|
@@ -17787,14 +17791,14 @@ var init_fa_stability = __esm(() => {
|
|
|
17787
17791
|
passed: Boolean2(),
|
|
17788
17792
|
measured_at: timestamp2,
|
|
17789
17793
|
proof
|
|
17790
|
-
},
|
|
17794
|
+
}, closed9), { minItems: 48, maxItems: 48 }),
|
|
17791
17795
|
observation: proof,
|
|
17792
|
-
alert: _Object_({ route: label, acknowledged_by: label, delivered_at: timestamp2 },
|
|
17793
|
-
},
|
|
17796
|
+
alert: _Object_({ route: label, acknowledged_by: label, delivered_at: timestamp2 }, closed9)
|
|
17797
|
+
}, closed9);
|
|
17794
17798
|
});
|
|
17795
17799
|
|
|
17796
17800
|
// node_modules/@supacloud/delivery/src/application-promotion.ts
|
|
17797
|
-
var
|
|
17801
|
+
var closed10, projectRef2, sha2565, nullableActivation2, nullableDigest, observation, blocker, ApplicationPromotionPlanSchema;
|
|
17798
17802
|
var init_application_promotion = __esm(() => {
|
|
17799
17803
|
init_build();
|
|
17800
17804
|
init_value2();
|
|
@@ -17802,7 +17806,7 @@ var init_application_promotion = __esm(() => {
|
|
|
17802
17806
|
init_application_activation();
|
|
17803
17807
|
init_application_configuration();
|
|
17804
17808
|
init_application_release();
|
|
17805
|
-
|
|
17809
|
+
closed10 = { additionalProperties: false };
|
|
17806
17810
|
projectRef2 = String2({ pattern: "^[a-z0-9-]{1,20}$" });
|
|
17807
17811
|
sha2565 = ApplicationReleaseIdSchema;
|
|
17808
17812
|
nullableActivation2 = Union([ApplicationActivationIdSchema, Null()]);
|
|
@@ -17839,7 +17843,7 @@ var init_application_promotion = __esm(() => {
|
|
|
17839
17843
|
environment_id: ApplicationIdSchema,
|
|
17840
17844
|
release_id: sha2565,
|
|
17841
17845
|
...observation
|
|
17842
|
-
},
|
|
17846
|
+
}, closed10),
|
|
17843
17847
|
target: _Object_({
|
|
17844
17848
|
candidate_release_id: sha2565,
|
|
17845
17849
|
current_release_id: Union([sha2565, Null()]),
|
|
@@ -17847,18 +17851,18 @@ var init_application_promotion = __esm(() => {
|
|
|
17847
17851
|
configuration_id: Union([ApplicationConfigurationIdSchema, Null()]),
|
|
17848
17852
|
configuration: Union([ApplicationConfigurationViewSchema, Null()]),
|
|
17849
17853
|
...observation
|
|
17850
|
-
},
|
|
17854
|
+
}, closed10),
|
|
17851
17855
|
migrations: _Object_({
|
|
17852
17856
|
ledger_digest: sha2565,
|
|
17853
17857
|
ledger_compatible: Boolean2(),
|
|
17854
17858
|
project_migrations_applied: Boolean2(),
|
|
17855
17859
|
pending_versions: _Array_(String2({ pattern: "^\\d{1,20}$" }), { maxItems: 4096, uniqueItems: true }),
|
|
17856
17860
|
operator_provisioning_required: Boolean2()
|
|
17857
|
-
},
|
|
17861
|
+
}, closed10),
|
|
17858
17862
|
backup: _Object_({
|
|
17859
17863
|
required: Boolean2(),
|
|
17860
17864
|
confirmed: Literal(false)
|
|
17861
|
-
},
|
|
17865
|
+
}, closed10),
|
|
17862
17866
|
action: Union([Literal("promote"), Literal("no-op"), Literal("blocked")]),
|
|
17863
17867
|
blockers: _Array_(Enum([...blocker]), {
|
|
17864
17868
|
maxItems: blocker.length,
|
|
@@ -17867,7 +17871,7 @@ var init_application_promotion = __esm(() => {
|
|
|
17867
17871
|
steps: _Array_(String2({ minLength: 1, maxLength: 64 }), { maxItems: 8, uniqueItems: true }),
|
|
17868
17872
|
execution_performed: Literal(false),
|
|
17869
17873
|
data_recovery: Literal("separate-required")
|
|
17870
|
-
},
|
|
17874
|
+
}, closed10);
|
|
17871
17875
|
});
|
|
17872
17876
|
|
|
17873
17877
|
// node_modules/@supacloud/delivery/src/application-runtime-identity.ts
|
|
@@ -18024,6 +18028,11 @@ var init_src = __esm(() => {
|
|
|
18024
18028
|
init_release_contract();
|
|
18025
18029
|
});
|
|
18026
18030
|
|
|
18031
|
+
// src/delivery-files.ts
|
|
18032
|
+
var init_delivery_files2 = __esm(() => {
|
|
18033
|
+
init_delivery_files();
|
|
18034
|
+
});
|
|
18035
|
+
|
|
18027
18036
|
// src/delivery-migration-archive.ts
|
|
18028
18037
|
var init_delivery_migration_archive2 = __esm(() => {
|
|
18029
18038
|
init_src();
|
|
@@ -18140,7 +18149,7 @@ var init_release_evidence = __esm(() => {
|
|
|
18140
18149
|
});
|
|
18141
18150
|
|
|
18142
18151
|
// src/release-evidence-cli.ts
|
|
18143
|
-
import { resolve as
|
|
18152
|
+
import { resolve as resolve24 } from "node:path";
|
|
18144
18153
|
async function runReleaseEvidenceCommand(args) {
|
|
18145
18154
|
try {
|
|
18146
18155
|
const values = new Map;
|
|
@@ -18164,7 +18173,7 @@ async function runReleaseEvidenceCommand(args) {
|
|
|
18164
18173
|
if (!manifest || !target || manifest.length > 4096 || !/^[a-z][a-z0-9-]{0,62}$/.test(target)) {
|
|
18165
18174
|
throw new ReleaseEvidenceError("RELEASE_EVIDENCE_INVALID");
|
|
18166
18175
|
}
|
|
18167
|
-
const evidence = await createReleaseEvidence(
|
|
18176
|
+
const evidence = await createReleaseEvidence(resolve24(manifest), target);
|
|
18168
18177
|
console.log(json ? JSON.stringify(evidence, null, 2) : formatReleaseEvidence(evidence));
|
|
18169
18178
|
} catch (error) {
|
|
18170
18179
|
console.error(`Error: ${error instanceof ReleaseEvidenceError ? error.code : "RELEASE_EVIDENCE_INVALID"}`);
|
|
@@ -18176,15 +18185,15 @@ var init_release_evidence_cli = __esm(() => {
|
|
|
18176
18185
|
});
|
|
18177
18186
|
|
|
18178
18187
|
// src/database-contracts.ts
|
|
18179
|
-
import { createHash as
|
|
18180
|
-
import { mkdir as mkdir5, readFile as
|
|
18181
|
-
import { dirname as dirname11, relative as
|
|
18188
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
18189
|
+
import { mkdir as mkdir5, readFile as readFile14 } from "node:fs/promises";
|
|
18190
|
+
import { dirname as dirname11, relative as relative13, resolve as resolve25 } from "node:path";
|
|
18182
18191
|
import * as ts18 from "@typescript/typescript6";
|
|
18183
18192
|
function hash4(value) {
|
|
18184
|
-
return
|
|
18193
|
+
return createHash13("sha256").update(value).digest("hex");
|
|
18185
18194
|
}
|
|
18186
18195
|
function importPath(out, path) {
|
|
18187
|
-
const value =
|
|
18196
|
+
const value = relative13(out, path).replaceAll("\\", "/").replace(/\.(?:d\.)?[cm]?ts$/, "");
|
|
18188
18197
|
return value.startsWith(".") ? value : `./${value}`;
|
|
18189
18198
|
}
|
|
18190
18199
|
function parseDatabaseContractsOptions(value, directory) {
|
|
@@ -18206,19 +18215,19 @@ function parseDatabaseContractsOptions(value, directory) {
|
|
|
18206
18215
|
throw new TypeError("migrations must be an ordered list of SQL files");
|
|
18207
18216
|
}
|
|
18208
18217
|
return {
|
|
18209
|
-
rootDir:
|
|
18210
|
-
outDir:
|
|
18211
|
-
postgrestTypes:
|
|
18212
|
-
drizzleSchema:
|
|
18218
|
+
rootDir: resolve25(directory, field("rootDir")),
|
|
18219
|
+
outDir: resolve25(directory, field("outDir")),
|
|
18220
|
+
postgrestTypes: resolve25(directory, field("postgrestTypes")),
|
|
18221
|
+
drizzleSchema: resolve25(directory, field("drizzleSchema")),
|
|
18213
18222
|
role: field("role"),
|
|
18214
|
-
graphql: { ...graphql, schema:
|
|
18215
|
-
migrations: migrations.map((file) =>
|
|
18223
|
+
graphql: { ...graphql, schema: resolve25(directory, graphql.schema) },
|
|
18224
|
+
migrations: migrations.map((file) => resolve25(directory, file))
|
|
18216
18225
|
};
|
|
18217
18226
|
}
|
|
18218
18227
|
async function generateDatabaseContracts(options, check = false) {
|
|
18219
|
-
const rootDir =
|
|
18220
|
-
const postgrestTypes =
|
|
18221
|
-
const snapshot = await
|
|
18228
|
+
const rootDir = resolve25(options.rootDir), outDir = resolve25(options.outDir);
|
|
18229
|
+
const postgrestTypes = resolve25(rootDir, options.postgrestTypes), drizzleSchema = resolve25(rootDir, options.drizzleSchema);
|
|
18230
|
+
const snapshot = await readFile14(postgrestTypes, "utf8");
|
|
18222
18231
|
const syntax = ts18.createSourceFile(postgrestTypes, snapshot, ts18.ScriptTarget.Latest, true);
|
|
18223
18232
|
const database = syntax.statements.find((node) => (ts18.isTypeAliasDeclaration(node) || ts18.isInterfaceDeclaration(node)) && node.name.text === "Database" && node.modifiers?.some((modifier) => modifier.kind === ts18.SyntaxKind.ExportKeyword));
|
|
18224
18233
|
if (!database)
|
|
@@ -18245,8 +18254,8 @@ async function generateDatabaseContracts(options, check = false) {
|
|
|
18245
18254
|
}
|
|
18246
18255
|
const inputs = {};
|
|
18247
18256
|
const addInput = async (path) => {
|
|
18248
|
-
const absolute =
|
|
18249
|
-
inputs[
|
|
18257
|
+
const absolute = resolve25(rootDir, path);
|
|
18258
|
+
inputs[relative13(rootDir, absolute).replaceAll("\\", "/")] = hash4(await readFile14(absolute, "utf8"));
|
|
18250
18259
|
};
|
|
18251
18260
|
await addInput(postgrestTypes);
|
|
18252
18261
|
await addInput(drizzleSchema);
|
|
@@ -18262,8 +18271,8 @@ async function generateDatabaseContracts(options, check = false) {
|
|
|
18262
18271
|
if (!source.isDeclarationFile && !source.fileName.includes("/node_modules/"))
|
|
18263
18272
|
await addInput(source.fileName);
|
|
18264
18273
|
}
|
|
18265
|
-
await addInput(
|
|
18266
|
-
if (new Set(options.migrations.map((path) =>
|
|
18274
|
+
await addInput(resolve25(rootDir, options.graphql.schema));
|
|
18275
|
+
if (new Set(options.migrations.map((path) => resolve25(rootDir, path))).size !== options.migrations.length) {
|
|
18267
18276
|
throw new Error("Duplicate migration in database contracts configuration");
|
|
18268
18277
|
}
|
|
18269
18278
|
for (const path of options.migrations)
|
|
@@ -18284,17 +18293,17 @@ async function generateDatabaseContracts(options, check = false) {
|
|
|
18284
18293
|
version: 1,
|
|
18285
18294
|
role: options.role,
|
|
18286
18295
|
inputs: Object.fromEntries(Object.entries(inputs).sort(([a], [b]) => a.localeCompare(b))),
|
|
18287
|
-
migrationOrder: options.migrations.map((path) =>
|
|
18296
|
+
migrationOrder: options.migrations.map((path) => relative13(rootDir, resolve25(rootDir, path)).replaceAll("\\", "/")),
|
|
18288
18297
|
outputs: Object.fromEntries(Object.entries(files).sort(([a], [b]) => a.localeCompare(b)).map(([file, text]) => [file, hash4(text)]))
|
|
18289
18298
|
};
|
|
18290
18299
|
files["database.manifest.json"] = JSON.stringify(manifest, null, 2) + `
|
|
18291
18300
|
`;
|
|
18292
18301
|
const mismatches = [];
|
|
18293
18302
|
for (const [file, content] of Object.entries(files)) {
|
|
18294
|
-
const path =
|
|
18303
|
+
const path = resolve25(outDir, file);
|
|
18295
18304
|
let current;
|
|
18296
18305
|
try {
|
|
18297
|
-
current = await
|
|
18306
|
+
current = await readFile14(path, "utf8");
|
|
18298
18307
|
} catch (error) {
|
|
18299
18308
|
if (!(error instanceof Error && ("code" in error) && error.code === "ENOENT"))
|
|
18300
18309
|
throw error;
|
|
@@ -18305,13 +18314,13 @@ async function generateDatabaseContracts(options, check = false) {
|
|
|
18305
18314
|
if (!check) {
|
|
18306
18315
|
await mkdir5(outDir, { recursive: true });
|
|
18307
18316
|
for (const [file, content] of Object.entries(files))
|
|
18308
|
-
await writeFileIfChanged(
|
|
18317
|
+
await writeFileIfChanged(resolve25(outDir, file), content);
|
|
18309
18318
|
}
|
|
18310
18319
|
return { upToDate: mismatches.length === 0, mismatches, written: check ? [] : mismatches, manifest };
|
|
18311
18320
|
}
|
|
18312
18321
|
async function runDatabaseContractsFile(path, check = false) {
|
|
18313
|
-
const absolute =
|
|
18314
|
-
const value = JSON.parse(await
|
|
18322
|
+
const absolute = resolve25(path);
|
|
18323
|
+
const value = JSON.parse(await readFile14(absolute, "utf8"));
|
|
18315
18324
|
return generateDatabaseContracts(parseDatabaseContractsOptions(value, dirname11(absolute)), check);
|
|
18316
18325
|
}
|
|
18317
18326
|
var init_database_contracts = __esm(() => {
|
|
@@ -18321,8 +18330,8 @@ var init_database_contracts = __esm(() => {
|
|
|
18321
18330
|
});
|
|
18322
18331
|
|
|
18323
18332
|
// src/graphql-schema.ts
|
|
18324
|
-
import { mkdir as mkdir6, readFile as
|
|
18325
|
-
import { dirname as dirname12, resolve as
|
|
18333
|
+
import { mkdir as mkdir6, readFile as readFile15 } from "node:fs/promises";
|
|
18334
|
+
import { dirname as dirname12, resolve as resolve26 } from "node:path";
|
|
18326
18335
|
async function pullGraphqlSchema(options) {
|
|
18327
18336
|
assertGraphqlOptions({ schema: options.output });
|
|
18328
18337
|
const endpoint = new URL(options.url);
|
|
@@ -18362,7 +18371,7 @@ async function pullGraphqlSchema(options) {
|
|
|
18362
18371
|
throw new Error("GraphQL schema export failed. Verify caller grants and enable introspection only in the intended development environment.");
|
|
18363
18372
|
}
|
|
18364
18373
|
const schema = lexicographicSortSchema(buildClientSchema(data));
|
|
18365
|
-
const path =
|
|
18374
|
+
const path = resolve26(options.output);
|
|
18366
18375
|
const content = path.endsWith(".json") ? JSON.stringify(introspectionFromSchema(schema), null, 2) + `
|
|
18367
18376
|
` : `# GENERATED BY supacloud-compiler graphql-schema. DO NOT EDIT.
|
|
18368
18377
|
# Database First: change database declarations, apply migrations, then re-export for the intended role.
|
|
@@ -18370,7 +18379,7 @@ async function pullGraphqlSchema(options) {
|
|
|
18370
18379
|
`;
|
|
18371
18380
|
let previous;
|
|
18372
18381
|
try {
|
|
18373
|
-
previous = await
|
|
18382
|
+
previous = await readFile15(path, "utf8");
|
|
18374
18383
|
} catch (error) {
|
|
18375
18384
|
if (!(error instanceof Error && ("code" in error) && error.code === "ENOENT"))
|
|
18376
18385
|
throw error;
|
|
@@ -18390,8 +18399,8 @@ var init_graphql_schema = __esm(() => {
|
|
|
18390
18399
|
});
|
|
18391
18400
|
|
|
18392
18401
|
// src/cli.ts
|
|
18393
|
-
import { resolve as
|
|
18394
|
-
import { readFile as
|
|
18402
|
+
import { resolve as resolve27 } from "node:path";
|
|
18403
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
18395
18404
|
|
|
18396
18405
|
// src/analyze.ts
|
|
18397
18406
|
import { createHash as createHash3 } from "node:crypto";
|
|
@@ -23933,6 +23942,428 @@ function compileOptionsFromConfig(config, cwd = process.cwd()) {
|
|
|
23933
23942
|
// src/cli.ts
|
|
23934
23943
|
init_fixes();
|
|
23935
23944
|
|
|
23945
|
+
// src/preview-fix-loop.ts
|
|
23946
|
+
init_src();
|
|
23947
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
23948
|
+
import { lstat as lstat3, readdir as readdir4, readFile as readFile6, realpath as realpath4, writeFile as writeFile4 } from "node:fs/promises";
|
|
23949
|
+
import { basename as basename2, isAbsolute as isAbsolute5, join as join9, relative as relative10, resolve as resolve15, sep as sep10 } from "node:path";
|
|
23950
|
+
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
23951
|
+
init_execution_context();
|
|
23952
|
+
init_fixes();
|
|
23953
|
+
var PREVIEW_DEPLOY_RECEIPT_SCHEMA = "supacloud.preview-deploy-receipt.v1";
|
|
23954
|
+
var PREVIEW_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
23955
|
+
var PROJECT_REF = /^[a-z0-9-]{1,20}$/;
|
|
23956
|
+
var RESOURCE_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
23957
|
+
var RELATIVE_FILE = /^(?!\/)(?!\.\.(?:\/|$))(?!.*\/\.\.(?:\/|$))[A-Za-z0-9_./-]{1,240}$/;
|
|
23958
|
+
var MAX_FILES = 200;
|
|
23959
|
+
var MAX_FILE_BYTES = 1048576;
|
|
23960
|
+
var EVENTS_FILE = "preview-execution-events.json";
|
|
23961
|
+
var RECEIPT_FILE = "preview-deploy-receipt.json";
|
|
23962
|
+
|
|
23963
|
+
class PreviewFixError extends Error {
|
|
23964
|
+
code;
|
|
23965
|
+
constructor(code) {
|
|
23966
|
+
super(code);
|
|
23967
|
+
this.code = code;
|
|
23968
|
+
this.name = "PreviewFixError";
|
|
23969
|
+
}
|
|
23970
|
+
}
|
|
23971
|
+
function fail(code) {
|
|
23972
|
+
throw new PreviewFixError(code);
|
|
23973
|
+
}
|
|
23974
|
+
function inside2(parent, child) {
|
|
23975
|
+
const fromParent = relative10(parent, child);
|
|
23976
|
+
return fromParent === "" || !isAbsolute5(fromParent) && fromParent !== ".." && !fromParent.startsWith(`..${sep10}`);
|
|
23977
|
+
}
|
|
23978
|
+
async function realDirectory(path) {
|
|
23979
|
+
const resolved = resolve15(path);
|
|
23980
|
+
let stat;
|
|
23981
|
+
try {
|
|
23982
|
+
stat = await lstat3(resolved);
|
|
23983
|
+
} catch {
|
|
23984
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
23985
|
+
}
|
|
23986
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
23987
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
23988
|
+
return realpath4(resolved);
|
|
23989
|
+
}
|
|
23990
|
+
async function treeDigest(root) {
|
|
23991
|
+
const files = [];
|
|
23992
|
+
async function walk(directory) {
|
|
23993
|
+
if (files.length > MAX_FILES)
|
|
23994
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
23995
|
+
for (const entry of await readdir4(directory, { withFileTypes: true })) {
|
|
23996
|
+
if (entry.isSymbolicLink() || entry.name === "." || entry.name === ".." || entry.name.includes("..")) {
|
|
23997
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
23998
|
+
}
|
|
23999
|
+
const path = join9(directory, entry.name);
|
|
24000
|
+
if (entry.isDirectory()) {
|
|
24001
|
+
if (entry.name === "node_modules")
|
|
24002
|
+
continue;
|
|
24003
|
+
await walk(path);
|
|
24004
|
+
} else if (entry.isFile()) {
|
|
24005
|
+
const stat = await lstat3(path);
|
|
24006
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > MAX_FILE_BYTES)
|
|
24007
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
24008
|
+
files.push(path);
|
|
24009
|
+
} else {
|
|
24010
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
24011
|
+
}
|
|
24012
|
+
}
|
|
24013
|
+
}
|
|
24014
|
+
await walk(root);
|
|
24015
|
+
if (files.length > MAX_FILES)
|
|
24016
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
24017
|
+
const hash = createHash10("sha256");
|
|
24018
|
+
for (const file of files.sort()) {
|
|
24019
|
+
hash.update(relative10(root, file));
|
|
24020
|
+
hash.update("\x00");
|
|
24021
|
+
hash.update(await readFile6(file));
|
|
24022
|
+
hash.update("\x00");
|
|
24023
|
+
}
|
|
24024
|
+
return hash.digest("hex");
|
|
24025
|
+
}
|
|
24026
|
+
function identity2(input, branchRef) {
|
|
24027
|
+
if (!PREVIEW_ID.test(input.previewId) || !PROJECT_REF.test(input.projectRef) || !RESOURCE_ID.test(input.applicationId) || !RESOURCE_ID.test(input.environmentId) || input.property !== "transaction" && input.property !== "idempotency" || input.value !== "required" && input.value !== "none") {
|
|
24028
|
+
fail("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24029
|
+
}
|
|
24030
|
+
if (applicationPreviewBranchRef(input.previewId) !== branchRef)
|
|
24031
|
+
fail("PREVIEW_FIX_IDENTITY_MISMATCH");
|
|
24032
|
+
}
|
|
24033
|
+
function matchingFix(diagnostics, property) {
|
|
24034
|
+
const errors = diagnostics.filter((diagnostic) => diagnostic.severity === "error");
|
|
24035
|
+
const matches = errors.filter((diagnostic) => diagnostic.code === "invalid-command-mode" && diagnostic.fix?.type === "set_command_mode" && diagnostic.fix.property === property && typeof diagnostic.file === "string" && RELATIVE_FILE.test(diagnostic.file) && diagnostic.errorCode === "SC4012");
|
|
24036
|
+
const [match] = matches;
|
|
24037
|
+
if (errors.length !== 1 || matches.length !== 1 || !match?.fix || match.fix.type !== "set_command_mode") {
|
|
24038
|
+
return fail("PREVIEW_FIX_DIAGNOSIS_REQUIRED");
|
|
24039
|
+
}
|
|
24040
|
+
return match.fix;
|
|
24041
|
+
}
|
|
24042
|
+
function record5(value, keys) {
|
|
24043
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
24044
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24045
|
+
const entry = value;
|
|
24046
|
+
const present = Object.keys(entry);
|
|
24047
|
+
if (present.length !== keys.length || keys.some((key) => !Object.prototype.hasOwnProperty.call(entry, key))) {
|
|
24048
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24049
|
+
}
|
|
24050
|
+
return entry;
|
|
24051
|
+
}
|
|
24052
|
+
function text3(value, pattern) {
|
|
24053
|
+
if (typeof value !== "string" || !pattern.test(value))
|
|
24054
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24055
|
+
return value;
|
|
24056
|
+
}
|
|
24057
|
+
function stringList(value) {
|
|
24058
|
+
if (!Array.isArray(value) || value.length > 32 || value.some((item) => typeof item !== "string" || !/^[A-Za-z0-9_.:-]{1,128}$/.test(item))) {
|
|
24059
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24060
|
+
}
|
|
24061
|
+
return [...value];
|
|
24062
|
+
}
|
|
24063
|
+
function parsePreviewDeployReceipt(value) {
|
|
24064
|
+
const root = record5(value, [
|
|
24065
|
+
"schema",
|
|
24066
|
+
"deployed",
|
|
24067
|
+
"published",
|
|
24068
|
+
"live",
|
|
24069
|
+
"target",
|
|
24070
|
+
"preview_id",
|
|
24071
|
+
"project_ref",
|
|
24072
|
+
"application_id",
|
|
24073
|
+
"environment_id",
|
|
24074
|
+
"branch_ref",
|
|
24075
|
+
"artifact_sha256",
|
|
24076
|
+
"status",
|
|
24077
|
+
"graph",
|
|
24078
|
+
"change",
|
|
24079
|
+
"diagnosis",
|
|
24080
|
+
"test",
|
|
24081
|
+
"timeline",
|
|
24082
|
+
"production"
|
|
24083
|
+
]);
|
|
24084
|
+
if (root.schema !== PREVIEW_DEPLOY_RECEIPT_SCHEMA || root.deployed !== false || root.published !== false || root.live !== false || root.target !== "preview" || root.status !== "recorded") {
|
|
24085
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24086
|
+
}
|
|
24087
|
+
const graph = record5(root.graph, ["modules", "command", "transaction"]);
|
|
24088
|
+
const change = record5(root.change, ["file", "written"]);
|
|
24089
|
+
const diagnosis = record5(root.diagnosis, ["code", "errorCode", "file"]);
|
|
24090
|
+
const test = record5(root.test, ["operation", "ok"]);
|
|
24091
|
+
const timeline = record5(root.timeline, ["requestId", "operation", "handler", "failed", "complete", "missingStages"]);
|
|
24092
|
+
const production = record5(root.production, ["written", "approval", "graphRead"]);
|
|
24093
|
+
if (change.written !== true || test.ok !== true || timeline.handler !== "succeeded" || timeline.failed !== false || typeof timeline.complete !== "boolean" || production.written !== false || production.approval !== "required" || production.graphRead !== true || graph.transaction !== "required" && graph.transaction !== "none") {
|
|
24094
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24095
|
+
}
|
|
24096
|
+
const previewId = text3(root.preview_id, PREVIEW_ID);
|
|
24097
|
+
const branchRef = text3(root.branch_ref, /^pv[a-f0-9]{18}$/);
|
|
24098
|
+
if (applicationPreviewBranchRef(previewId) !== branchRef)
|
|
24099
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24100
|
+
return {
|
|
24101
|
+
schema: PREVIEW_DEPLOY_RECEIPT_SCHEMA,
|
|
24102
|
+
deployed: false,
|
|
24103
|
+
published: false,
|
|
24104
|
+
live: false,
|
|
24105
|
+
target: "preview",
|
|
24106
|
+
preview_id: previewId,
|
|
24107
|
+
project_ref: text3(root.project_ref, PROJECT_REF),
|
|
24108
|
+
application_id: text3(root.application_id, RESOURCE_ID),
|
|
24109
|
+
environment_id: text3(root.environment_id, RESOURCE_ID),
|
|
24110
|
+
branch_ref: branchRef,
|
|
24111
|
+
artifact_sha256: text3(root.artifact_sha256, /^[a-f0-9]{64}$/),
|
|
24112
|
+
status: "recorded",
|
|
24113
|
+
graph: {
|
|
24114
|
+
modules: stringList(graph.modules),
|
|
24115
|
+
command: text3(graph.command, /^[A-Za-z0-9_.:-]{1,128}$/),
|
|
24116
|
+
transaction: graph.transaction
|
|
24117
|
+
},
|
|
24118
|
+
change: { file: text3(change.file, RELATIVE_FILE), written: true },
|
|
24119
|
+
diagnosis: {
|
|
24120
|
+
code: text3(diagnosis.code, /^[a-z0-9-]{1,64}$/),
|
|
24121
|
+
errorCode: text3(diagnosis.errorCode, /^SC[0-9]{4}$/),
|
|
24122
|
+
file: text3(diagnosis.file, RELATIVE_FILE)
|
|
24123
|
+
},
|
|
24124
|
+
test: { operation: text3(test.operation, /^[A-Za-z0-9_.:-]{1,128}$/), ok: true },
|
|
24125
|
+
timeline: {
|
|
24126
|
+
requestId: text3(timeline.requestId, /^[A-Za-z0-9._:-]{1,256}$/),
|
|
24127
|
+
operation: text3(timeline.operation, /^[A-Za-z0-9_.:-]{1,128}$/),
|
|
24128
|
+
handler: "succeeded",
|
|
24129
|
+
failed: false,
|
|
24130
|
+
complete: timeline.complete,
|
|
24131
|
+
missingStages: stringList(timeline.missingStages)
|
|
24132
|
+
},
|
|
24133
|
+
production: { written: false, approval: "required", graphRead: true }
|
|
24134
|
+
};
|
|
24135
|
+
}
|
|
24136
|
+
async function writeInside(root, name, contents) {
|
|
24137
|
+
if (name !== EVENTS_FILE && name !== RECEIPT_FILE)
|
|
24138
|
+
return fail("PREVIEW_FIX_ROOT_UNSUPPORTED");
|
|
24139
|
+
const path = join9(root, name);
|
|
24140
|
+
if (!inside2(root, path))
|
|
24141
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24142
|
+
await writeFile4(path, contents, { encoding: "utf8", flag: "wx", mode: 420 });
|
|
24143
|
+
}
|
|
24144
|
+
async function runPreviewFixLoop(input) {
|
|
24145
|
+
const branchRef = basename2(resolve15(input.previewRoot));
|
|
24146
|
+
identity2(input, branchRef);
|
|
24147
|
+
const productionRoot = await realDirectory(input.productionRoot);
|
|
24148
|
+
const previewRoot = await realDirectory(input.previewRoot);
|
|
24149
|
+
if (basename2(previewRoot) !== branchRef || productionRoot === previewRoot || inside2(productionRoot, previewRoot) || inside2(previewRoot, productionRoot)) {
|
|
24150
|
+
return fail("PREVIEW_FIX_IDENTITY_MISMATCH");
|
|
24151
|
+
}
|
|
24152
|
+
const productionBefore = await treeDigest(productionRoot);
|
|
24153
|
+
let previewGraph;
|
|
24154
|
+
let productionGraph;
|
|
24155
|
+
try {
|
|
24156
|
+
previewGraph = await analyzeProject(previewRoot);
|
|
24157
|
+
productionGraph = await analyzeProject(productionRoot);
|
|
24158
|
+
} catch (error) {
|
|
24159
|
+
if (error instanceof PreviewFixError)
|
|
24160
|
+
throw error;
|
|
24161
|
+
return fail("PREVIEW_FIX_DIAGNOSIS_REQUIRED");
|
|
24162
|
+
}
|
|
24163
|
+
if (!productionGraph.modules)
|
|
24164
|
+
return fail("PREVIEW_FIX_DIAGNOSIS_REQUIRED");
|
|
24165
|
+
const fix = matchingFix(previewGraph.diagnostics ?? [], input.property);
|
|
24166
|
+
const chosen = { ...fix, value: input.value };
|
|
24167
|
+
const previewed = await applyDiagnosticFix(chosen, { rootDir: previewRoot });
|
|
24168
|
+
if (!previewed.changed || !inside2(previewRoot, previewed.file))
|
|
24169
|
+
return fail("PREVIEW_FIX_DIAGNOSIS_REQUIRED");
|
|
24170
|
+
const applied = await applyDiagnosticFix(chosen, { rootDir: previewRoot, dryRun: false });
|
|
24171
|
+
if (!applied.changed || !inside2(previewRoot, applied.file))
|
|
24172
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24173
|
+
if (await treeDigest(productionRoot) !== productionBefore)
|
|
24174
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24175
|
+
const compiled = await compileProject({ rootDir: previewRoot, outDir: join9(previewRoot, "generated") });
|
|
24176
|
+
const command = compiled.graph.modules.flatMap((module) => module.commands).find((item) => item.className === fix.command);
|
|
24177
|
+
const policyApplied = input.property === "transaction" ? command?.transaction === input.value : command?.idempotency === input.value;
|
|
24178
|
+
if (compiled.diagnostics.some((diagnostic) => diagnostic.severity === "error") || !command || !policyApplied) {
|
|
24179
|
+
return fail("PREVIEW_FIX_COMPILE_FAILED");
|
|
24180
|
+
}
|
|
24181
|
+
const sourceFile = join9(previewRoot, fix.targetFile);
|
|
24182
|
+
const sourceReal = await realpath4(sourceFile).catch(() => fail("PREVIEW_FIX_INVOKE_FAILED"));
|
|
24183
|
+
if (!inside2(previewRoot, sourceReal))
|
|
24184
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24185
|
+
const started = performance.now();
|
|
24186
|
+
try {
|
|
24187
|
+
const child = Bun.spawn([
|
|
24188
|
+
process.versions.bun ? process.execPath : "bun",
|
|
24189
|
+
"--no-env-file",
|
|
24190
|
+
"-e",
|
|
24191
|
+
[
|
|
24192
|
+
"const imported = await import(process.argv[1]);",
|
|
24193
|
+
"const ctor = imported[process.argv[2]];",
|
|
24194
|
+
'if (typeof ctor !== "function") process.exit(2);',
|
|
24195
|
+
"const instance = new ctor();",
|
|
24196
|
+
'if (typeof instance.execute !== "function") process.exit(3);',
|
|
24197
|
+
"const output = await instance.execute();",
|
|
24198
|
+
'process.exit(output && typeof output === "object" && output.ok === true ? 0 : 4);'
|
|
24199
|
+
].join(`
|
|
24200
|
+
`),
|
|
24201
|
+
"--",
|
|
24202
|
+
pathToFileURL2(sourceReal).href,
|
|
24203
|
+
fix.command
|
|
24204
|
+
], {
|
|
24205
|
+
cwd: previewRoot,
|
|
24206
|
+
env: { PATH: process.env.PATH ?? "" },
|
|
24207
|
+
stdout: "ignore",
|
|
24208
|
+
stderr: "ignore"
|
|
24209
|
+
});
|
|
24210
|
+
const timer = setTimeout(() => child.kill(), 1e4);
|
|
24211
|
+
const status = await child.exited.finally(() => clearTimeout(timer));
|
|
24212
|
+
if (status !== 0)
|
|
24213
|
+
return fail("PREVIEW_FIX_INVOKE_FAILED");
|
|
24214
|
+
} catch (error) {
|
|
24215
|
+
if (error instanceof PreviewFixError)
|
|
24216
|
+
throw error;
|
|
24217
|
+
return fail("PREVIEW_FIX_INVOKE_FAILED");
|
|
24218
|
+
}
|
|
24219
|
+
const durationMs = Math.max(0, performance.now() - started);
|
|
24220
|
+
const requestId = `preview-${input.previewId}`;
|
|
24221
|
+
const events = {
|
|
24222
|
+
version: 1,
|
|
24223
|
+
events: [
|
|
24224
|
+
{ kind: "command", operation: command.name, stage: "handler", phase: "started", requestId, attempt: 1 },
|
|
24225
|
+
{ kind: "command", operation: command.name, stage: "handler", phase: "succeeded", requestId, attempt: 1, durationMs }
|
|
24226
|
+
]
|
|
24227
|
+
};
|
|
24228
|
+
await writeInside(previewRoot, EVENTS_FILE, `${JSON.stringify(events)}
|
|
24229
|
+
`);
|
|
24230
|
+
const eventsPath = join9(previewRoot, EVENTS_FILE);
|
|
24231
|
+
let pack;
|
|
24232
|
+
try {
|
|
24233
|
+
pack = createExecutionContextPack(compiled.graph, command.name, await readExecutionMetadata(eventsPath), requestId);
|
|
24234
|
+
} catch {
|
|
24235
|
+
return fail("PREVIEW_FIX_TIMELINE_UNAVAILABLE");
|
|
24236
|
+
}
|
|
24237
|
+
const entry = pack.timeline.find((item) => item.kind === "command" && item.operation === command.name);
|
|
24238
|
+
const attempt = entry?.attempts[0];
|
|
24239
|
+
const handler = attempt?.stages.find((stage) => stage.stage === "handler" && stage.phase === "succeeded");
|
|
24240
|
+
if (!entry || !attempt || !handler || attempt.failed || pack.requestId !== requestId) {
|
|
24241
|
+
return fail("PREVIEW_FIX_TIMELINE_UNAVAILABLE");
|
|
24242
|
+
}
|
|
24243
|
+
const artifactPath = join9(previewRoot, "generated", "application.ts");
|
|
24244
|
+
const artifactReal = await realpath4(artifactPath).catch(() => fail("PREVIEW_FIX_COMPILE_FAILED"));
|
|
24245
|
+
if (!inside2(previewRoot, artifactReal))
|
|
24246
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24247
|
+
const artifact = await readFile6(artifactReal);
|
|
24248
|
+
const receipt = parsePreviewDeployReceipt({
|
|
24249
|
+
schema: PREVIEW_DEPLOY_RECEIPT_SCHEMA,
|
|
24250
|
+
deployed: false,
|
|
24251
|
+
published: false,
|
|
24252
|
+
live: false,
|
|
24253
|
+
target: "preview",
|
|
24254
|
+
preview_id: input.previewId,
|
|
24255
|
+
project_ref: input.projectRef,
|
|
24256
|
+
application_id: input.applicationId,
|
|
24257
|
+
environment_id: input.environmentId,
|
|
24258
|
+
branch_ref: branchRef,
|
|
24259
|
+
artifact_sha256: createHash10("sha256").update(artifact).digest("hex"),
|
|
24260
|
+
status: "recorded",
|
|
24261
|
+
graph: {
|
|
24262
|
+
modules: compiled.graph.modules.map((module) => module.name),
|
|
24263
|
+
command: command.name,
|
|
24264
|
+
transaction: command.transaction
|
|
24265
|
+
},
|
|
24266
|
+
change: { file: relative10(previewRoot, applied.file), written: true },
|
|
24267
|
+
diagnosis: { code: "invalid-command-mode", errorCode: "SC4012", file: fix.targetFile },
|
|
24268
|
+
test: { operation: command.name, ok: true },
|
|
24269
|
+
timeline: {
|
|
24270
|
+
requestId,
|
|
24271
|
+
operation: command.name,
|
|
24272
|
+
handler: "succeeded",
|
|
24273
|
+
failed: false,
|
|
24274
|
+
complete: attempt.complete,
|
|
24275
|
+
missingStages: attempt.missingStages
|
|
24276
|
+
},
|
|
24277
|
+
production: { written: false, approval: "required", graphRead: true }
|
|
24278
|
+
});
|
|
24279
|
+
await writeInside(previewRoot, RECEIPT_FILE, `${JSON.stringify(receipt, null, 2)}
|
|
24280
|
+
`);
|
|
24281
|
+
if (await treeDigest(productionRoot) !== productionBefore)
|
|
24282
|
+
return fail("PRODUCTION_APPROVAL_REQUIRED");
|
|
24283
|
+
const written = parsePreviewDeployReceipt(JSON.parse(await readFile6(join9(previewRoot, RECEIPT_FILE), "utf8")));
|
|
24284
|
+
if (written.deployed !== false || written.production.written !== false)
|
|
24285
|
+
return fail("PREVIEW_FIX_RECEIPT_INVALID");
|
|
24286
|
+
return written;
|
|
24287
|
+
}
|
|
24288
|
+
|
|
24289
|
+
// src/preview-fix-cli.ts
|
|
24290
|
+
var FLAGS = [
|
|
24291
|
+
"--production",
|
|
24292
|
+
"--preview",
|
|
24293
|
+
"--preview-id",
|
|
24294
|
+
"--project-ref",
|
|
24295
|
+
"--application-id",
|
|
24296
|
+
"--environment-id",
|
|
24297
|
+
"--property",
|
|
24298
|
+
"--value"
|
|
24299
|
+
];
|
|
24300
|
+
function fail2(code) {
|
|
24301
|
+
console.error(`Error: ${code}`);
|
|
24302
|
+
process.exitCode = 1;
|
|
24303
|
+
throw new Error(code);
|
|
24304
|
+
}
|
|
24305
|
+
async function runPreviewFixCommand(args) {
|
|
24306
|
+
try {
|
|
24307
|
+
const values = new Map;
|
|
24308
|
+
let json = false;
|
|
24309
|
+
for (let index = 0;index < args.length; index++) {
|
|
24310
|
+
const option = args[index];
|
|
24311
|
+
if (option === "--json") {
|
|
24312
|
+
if (json)
|
|
24313
|
+
fail2("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24314
|
+
json = true;
|
|
24315
|
+
continue;
|
|
24316
|
+
}
|
|
24317
|
+
if (!FLAGS.includes(option))
|
|
24318
|
+
fail2("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24319
|
+
const value = args[++index];
|
|
24320
|
+
if (!value || value.startsWith("-") || values.has(option) || /[\u0000-\u001f\u007f]/.test(value) || value.length > 4096) {
|
|
24321
|
+
fail2("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24322
|
+
}
|
|
24323
|
+
values.set(option, value);
|
|
24324
|
+
}
|
|
24325
|
+
const required = FLAGS.map((flag) => values.get(flag));
|
|
24326
|
+
if (required.some((value) => value === undefined))
|
|
24327
|
+
fail2("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24328
|
+
const [productionRoot, previewRoot, previewId, projectRef, applicationId, environmentId, property, value] = required;
|
|
24329
|
+
if (property !== "transaction" && property !== "idempotency" || value !== "required" && value !== "none") {
|
|
24330
|
+
fail2("PREVIEW_FIX_POLICY_REQUIRED");
|
|
24331
|
+
}
|
|
24332
|
+
const input = {
|
|
24333
|
+
productionRoot,
|
|
24334
|
+
previewRoot,
|
|
24335
|
+
previewId,
|
|
24336
|
+
projectRef,
|
|
24337
|
+
applicationId,
|
|
24338
|
+
environmentId,
|
|
24339
|
+
property,
|
|
24340
|
+
value
|
|
24341
|
+
};
|
|
24342
|
+
const receipt = await runPreviewFixLoop(input);
|
|
24343
|
+
if (json) {
|
|
24344
|
+
console.log(JSON.stringify(receipt, null, 2));
|
|
24345
|
+
return;
|
|
24346
|
+
}
|
|
24347
|
+
console.log([
|
|
24348
|
+
"preview-fix recorded",
|
|
24349
|
+
` preview: ${receipt.preview_id}`,
|
|
24350
|
+
` branch: ${receipt.branch_ref}`,
|
|
24351
|
+
` diagnosis: ${receipt.diagnosis.errorCode}`,
|
|
24352
|
+
` test: ${receipt.test.operation} ok`,
|
|
24353
|
+
" deployed: false",
|
|
24354
|
+
" published: false",
|
|
24355
|
+
" production written: false",
|
|
24356
|
+
" production approval: required"
|
|
24357
|
+
].join(`
|
|
24358
|
+
`));
|
|
24359
|
+
} catch (error) {
|
|
24360
|
+
if (process.exitCode === 1)
|
|
24361
|
+
return;
|
|
24362
|
+
console.error(`Error: ${error instanceof PreviewFixError ? error.code : "PREVIEW_FIX_FAILED"}`);
|
|
24363
|
+
process.exitCode = 1;
|
|
24364
|
+
}
|
|
24365
|
+
}
|
|
24366
|
+
|
|
23936
24367
|
// src/diagnostics.ts
|
|
23937
24368
|
function createDiagnosticReport(diagnostics) {
|
|
23938
24369
|
return { format: 1, entries: diagnostics.map((diagnostic) => {
|
|
@@ -23990,7 +24421,7 @@ async function createEditorCodeActions(diagnostics, options = {}) {
|
|
|
23990
24421
|
init_graphql_options();
|
|
23991
24422
|
|
|
23992
24423
|
// src/delivery-plan.ts
|
|
23993
|
-
import { createHash as
|
|
24424
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
23994
24425
|
init_feature();
|
|
23995
24426
|
init_validate();
|
|
23996
24427
|
var compare2 = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -24223,7 +24654,7 @@ function createDeliveryPlan(graph, input, validation) {
|
|
|
24223
24654
|
deploymentReady: false,
|
|
24224
24655
|
targets: [...targets.values()].sort((a, b) => compare2(a.name, b.name))
|
|
24225
24656
|
};
|
|
24226
|
-
const topologyDigest =
|
|
24657
|
+
const topologyDigest = createHash11("sha256").update(JSON.stringify(topology)).digest("hex");
|
|
24227
24658
|
return parseDeliveryPlanResult({
|
|
24228
24659
|
ok: true,
|
|
24229
24660
|
plan: { ...topology, topologyDigest },
|
|
@@ -24258,9 +24689,9 @@ function formatDeliveryPlan(result) {
|
|
|
24258
24689
|
}
|
|
24259
24690
|
|
|
24260
24691
|
// src/delivery-build.ts
|
|
24261
|
-
import { mkdir as mkdir3, mkdtemp, readFile as
|
|
24692
|
+
import { mkdir as mkdir3, mkdtemp, readFile as readFile8, realpath as realpath5, rename as rename4, rm as rm2 } from "node:fs/promises";
|
|
24262
24693
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
24263
|
-
import { dirname as dirname9, join as
|
|
24694
|
+
import { dirname as dirname9, join as join11, relative as relative11, resolve as resolve18, sep as sep11 } from "node:path";
|
|
24264
24695
|
import * as ts16 from "@typescript/typescript6";
|
|
24265
24696
|
|
|
24266
24697
|
// src/delivery-build-schema.ts
|
|
@@ -24301,8 +24732,8 @@ function renderDeliveryTarget(graph, target, options) {
|
|
|
24301
24732
|
// src/delivery-bundle.ts
|
|
24302
24733
|
init_delivery_files2();
|
|
24303
24734
|
import { isBuiltin } from "node:module";
|
|
24304
|
-
import { readFile as
|
|
24305
|
-
import { join as
|
|
24735
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
24736
|
+
import { join as join10, resolve as resolve16 } from "node:path";
|
|
24306
24737
|
import * as ts15 from "@typescript/typescript6";
|
|
24307
24738
|
|
|
24308
24739
|
// src/delivery-imports.ts
|
|
@@ -24391,7 +24822,7 @@ function staticDeliveryImports(path, contents) {
|
|
|
24391
24822
|
// src/delivery-bundle-protocol.ts
|
|
24392
24823
|
init_build();
|
|
24393
24824
|
init_value2();
|
|
24394
|
-
var
|
|
24825
|
+
var closed11 = { additionalProperties: false };
|
|
24395
24826
|
var requestSchema = _Object_({
|
|
24396
24827
|
parentPid: Integer({ minimum: 1 }),
|
|
24397
24828
|
name: String2(),
|
|
@@ -24399,15 +24830,15 @@ var requestSchema = _Object_({
|
|
|
24399
24830
|
project: String2(),
|
|
24400
24831
|
generatedDirectory: String2(),
|
|
24401
24832
|
options: DeliveryOptionsSchema
|
|
24402
|
-
},
|
|
24833
|
+
}, closed11);
|
|
24403
24834
|
var responseSchema = Union([
|
|
24404
24835
|
_Object_({
|
|
24405
24836
|
ok: Literal(true),
|
|
24406
24837
|
files: _Array_(Tuple([DeliveryFilePathSchema, String2({ pattern: "^[A-Za-z0-9+/]*={0,2}$" })])),
|
|
24407
24838
|
inputs: _Array_(Tuple([String2(), String2({ pattern: "^[a-f0-9]{64}$" })])),
|
|
24408
24839
|
runtimeImports: _Array_(String2())
|
|
24409
|
-
},
|
|
24410
|
-
_Object_({ ok: Literal(false) },
|
|
24840
|
+
}, closed11),
|
|
24841
|
+
_Object_({ ok: Literal(false) }, closed11)
|
|
24411
24842
|
]);
|
|
24412
24843
|
function parseDeliveryBundleRequest(input) {
|
|
24413
24844
|
if (!Check2(requestSchema, input))
|
|
@@ -24422,7 +24853,7 @@ function parseDeliveryBundleResponse(input) {
|
|
|
24422
24853
|
|
|
24423
24854
|
// src/delivery-bundle.ts
|
|
24424
24855
|
async function bundleDeliveryTarget(name, code, project, generatedDirectory, options) {
|
|
24425
|
-
const worker =
|
|
24856
|
+
const worker = join10(import.meta.dir, `delivery-bundle-worker.${import.meta.path.endsWith(".ts") ? "ts" : "js"}`);
|
|
24426
24857
|
const environment = {};
|
|
24427
24858
|
for (const name of ["PATH", "HOME", "TMPDIR", "TMP", "TEMP", "SystemRoot"]) {
|
|
24428
24859
|
const value = process.env[name];
|
|
@@ -24479,7 +24910,7 @@ async function bundleDeliveryTarget(name, code, project, generatedDirectory, opt
|
|
|
24479
24910
|
async function bundleDeliveryTargetInProcess(name, code, project, generatedDirectory, options) {
|
|
24480
24911
|
const inputs = new Map;
|
|
24481
24912
|
const workingDirectory = process.cwd();
|
|
24482
|
-
const entry =
|
|
24913
|
+
const entry = resolve16(generatedDirectory, `delivery-${name}.ts`);
|
|
24483
24914
|
const entryPattern = new RegExp(`^${entry.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
|
|
24484
24915
|
const result = await Bun.build({
|
|
24485
24916
|
entrypoints: [entry],
|
|
@@ -24501,8 +24932,8 @@ async function bundleDeliveryTargetInProcess(name, code, project, generatedDirec
|
|
|
24501
24932
|
build.onLoad({ filter: /.*/, namespace: "file" }, async (args) => {
|
|
24502
24933
|
if (args.path === entry)
|
|
24503
24934
|
return { contents: code, loader: "ts" };
|
|
24504
|
-
const bytes = await
|
|
24505
|
-
inputs.set(
|
|
24935
|
+
const bytes = await readFile7(args.path);
|
|
24936
|
+
inputs.set(resolve16(args.path), digest(bytes));
|
|
24506
24937
|
return { contents: staticDeliveryImports(args.path, bytes), loader: args.loader };
|
|
24507
24938
|
});
|
|
24508
24939
|
}
|
|
@@ -24512,7 +24943,7 @@ async function bundleDeliveryTargetInProcess(name, code, project, generatedDirec
|
|
|
24512
24943
|
throw new Error("Independent bundle failed or has no dependency metadata.");
|
|
24513
24944
|
const runtimeImports = new Set;
|
|
24514
24945
|
for (const [path, metadata] of Object.entries(result.metafile.inputs)) {
|
|
24515
|
-
if (
|
|
24946
|
+
if (resolve16(workingDirectory, path) !== entry && !inputs.has(resolve16(workingDirectory, path))) {
|
|
24516
24947
|
throw new Error("Bundler reported an input that was not captured by the delivery snapshot.");
|
|
24517
24948
|
}
|
|
24518
24949
|
for (const imported of metadata.imports) {
|
|
@@ -24547,7 +24978,7 @@ async function bundleDeliveryTargetInProcess(name, code, project, generatedDirec
|
|
|
24547
24978
|
if (!files.has("bundle/index.js"))
|
|
24548
24979
|
throw new Error("Independent bundle has no index.js entrypoint.");
|
|
24549
24980
|
for (const [path, hash] of inputs) {
|
|
24550
|
-
if (digest(await
|
|
24981
|
+
if (digest(await readFile7(path)) !== hash)
|
|
24551
24982
|
throw new Error("Source changed during bundling; retry the build.");
|
|
24552
24983
|
}
|
|
24553
24984
|
return { files, inputs, runtimeImports: [...runtimeImports].sort() };
|
|
@@ -24898,14 +25329,14 @@ export default deliveryFunctionDefault;
|
|
|
24898
25329
|
|
|
24899
25330
|
// src/delivery-migrations.ts
|
|
24900
25331
|
init_delivery_files2();
|
|
24901
|
-
import { resolve as
|
|
25332
|
+
import { resolve as resolve17 } from "node:path";
|
|
24902
25333
|
async function prepareDeliveryMigrations(project, generatedRoot, declarations = []) {
|
|
24903
25334
|
const entries = [];
|
|
24904
25335
|
const files = new Map;
|
|
24905
25336
|
const inputs = new Map;
|
|
24906
25337
|
let totalBytes = 0;
|
|
24907
25338
|
for (const declaration of [...declarations].sort((a, b) => BigInt(a.version) < BigInt(b.version) ? -1 : BigInt(a.version) > BigInt(b.version) ? 1 : 0)) {
|
|
24908
|
-
const source =
|
|
25339
|
+
const source = resolve17(project, declaration.source);
|
|
24909
25340
|
if (!inside(project, source) || inside(generatedRoot, source))
|
|
24910
25341
|
throw new Error("Invalid migration source.");
|
|
24911
25342
|
const bytes = await readBoundedOwned(project, source, 1048576);
|
|
@@ -24956,27 +25387,27 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
24956
25387
|
const settings = parseDeliveryOptions(delivery);
|
|
24957
25388
|
if (typeof Bun === "undefined")
|
|
24958
25389
|
throw new Error("Independent delivery builds require Bun.");
|
|
24959
|
-
const configPath = ts16.findConfigFile(
|
|
25390
|
+
const configPath = ts16.findConfigFile(resolve18(options.rootDir), ts16.sys.fileExists);
|
|
24960
25391
|
if (!configPath)
|
|
24961
25392
|
throw new Error("Independent delivery builds require a project tsconfig.json.");
|
|
24962
25393
|
const lexicalProject = dirname9(configPath);
|
|
24963
|
-
const project = await
|
|
24964
|
-
const sourceRoot = await
|
|
25394
|
+
const project = await realpath5(lexicalProject);
|
|
25395
|
+
const sourceRoot = await realpath5(options.rootDir);
|
|
24965
25396
|
if (!inside(project, sourceRoot))
|
|
24966
25397
|
throw new Error("Application sources must be inside the project.");
|
|
24967
|
-
const requested =
|
|
25398
|
+
const requested = resolve18(options.outDir, "delivery");
|
|
24968
25399
|
if (!inside(lexicalProject, requested))
|
|
24969
25400
|
throw new Error("Output must be inside the application project.");
|
|
24970
|
-
const buildRoot =
|
|
24971
|
-
const generatedRoot =
|
|
25401
|
+
const buildRoot = resolve18(project, relative11(lexicalProject, requested));
|
|
25402
|
+
const generatedRoot = resolve18(project, relative11(lexicalProject, options.outDir));
|
|
24972
25403
|
if (inside(generatedRoot, sourceRoot))
|
|
24973
25404
|
throw new Error("Output must not contain the application source root.");
|
|
24974
25405
|
const configInputs = new Map;
|
|
24975
|
-
const parsedConfig = ts16.getParsedCommandLineOfConfigFile(await
|
|
25406
|
+
const parsedConfig = ts16.getParsedCommandLineOfConfigFile(await realpath5(configPath), {}, {
|
|
24976
25407
|
...ts16.sys,
|
|
24977
25408
|
readFile(path) {
|
|
24978
25409
|
const contents = readFileSync3(path, "utf8");
|
|
24979
|
-
configInputs.set(
|
|
25410
|
+
configInputs.set(resolve18(path), digest(contents));
|
|
24980
25411
|
return contents;
|
|
24981
25412
|
},
|
|
24982
25413
|
onUnRecoverableConfigFileDiagnostic() {
|
|
@@ -25014,7 +25445,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25014
25445
|
if (!target || (kind === "worker" ? target.kind !== "jobs" : target.kind === "jobs")) {
|
|
25015
25446
|
throw new Error("Delivery host kind does not match its target.");
|
|
25016
25447
|
}
|
|
25017
|
-
const path =
|
|
25448
|
+
const path = resolve18(sourceRoot, app.source);
|
|
25018
25449
|
if (inside(generatedRoot, path) || !/\.[cm]?ts$/.test(path))
|
|
25019
25450
|
throw new Error("Hosts require application TypeScript source.");
|
|
25020
25451
|
hosts.set(app.target, { path, kind, hash: digest(await readOwned(sourceRoot, path)) });
|
|
@@ -25025,7 +25456,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25025
25456
|
continue;
|
|
25026
25457
|
if (hosts.has(target.name))
|
|
25027
25458
|
throw new Error("Duplicate delivery application host.");
|
|
25028
|
-
const path =
|
|
25459
|
+
const path = resolve18(sourceRoot, target.function.entrypoint);
|
|
25029
25460
|
if (inside(generatedRoot, path) || !/\.[cm]?ts$/.test(path)) {
|
|
25030
25461
|
throw new Error("Function hosts require application TypeScript source.");
|
|
25031
25462
|
}
|
|
@@ -25035,10 +25466,10 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25035
25466
|
const migrations = await prepareDeliveryMigrations(project, generatedRoot, settings.build?.migrations);
|
|
25036
25467
|
phase = "output-ownership";
|
|
25037
25468
|
output = await reserveOutput(project, buildRoot);
|
|
25038
|
-
const objectRoot =
|
|
25469
|
+
const objectRoot = join11(output.path, "objects");
|
|
25039
25470
|
await noLinks(output.path, objectRoot);
|
|
25040
25471
|
await mkdir3(objectRoot, { recursive: true });
|
|
25041
|
-
const pointer =
|
|
25472
|
+
const pointer = join11(output.path, "delivery.manifest.json");
|
|
25042
25473
|
const previous = await exists(pointer) ? parseDeliveryBuildManifest(JSON.parse(new TextDecoder().decode(await readOwned(output.path, pointer)))) : undefined;
|
|
25043
25474
|
const objects = [];
|
|
25044
25475
|
const candidates = [];
|
|
@@ -25059,14 +25490,14 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25059
25490
|
let directory = project;
|
|
25060
25491
|
while (true) {
|
|
25061
25492
|
for (const name of ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bunfig.toml", "tsconfig.json"]) {
|
|
25062
|
-
const path =
|
|
25493
|
+
const path = join11(directory, name);
|
|
25063
25494
|
if (await exists(path)) {
|
|
25064
|
-
const bytes = await
|
|
25495
|
+
const bytes = await readFile8(path);
|
|
25065
25496
|
const before = snapshots.get(path);
|
|
25066
25497
|
if (before !== undefined && before !== digest(bytes))
|
|
25067
25498
|
throw new Error("Configuration changed during analysis; retry.");
|
|
25068
25499
|
snapshots.set(path, digest(bytes));
|
|
25069
|
-
configuration[
|
|
25500
|
+
configuration[relative11(project, path).split(sep11).join("/")] = digest(bytes);
|
|
25070
25501
|
}
|
|
25071
25502
|
}
|
|
25072
25503
|
const parent = dirname9(directory);
|
|
@@ -25078,13 +25509,13 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25078
25509
|
producer,
|
|
25079
25510
|
bun: Bun.version,
|
|
25080
25511
|
revision: Bun.revision,
|
|
25081
|
-
compiler: digest(canonical2(Object.fromEntries([...await sourceInventory(import.meta.dir,
|
|
25512
|
+
compiler: digest(canonical2(Object.fromEntries([...await sourceInventory(import.meta.dir, join11(import.meta.dir, "node_modules"))].map(([path, hash]) => [relative11(import.meta.dir, path), hash]))))
|
|
25082
25513
|
};
|
|
25083
25514
|
for (const target of planned.plan.targets) {
|
|
25084
25515
|
phase = `target:${target.name}`;
|
|
25085
|
-
const stage = await mkdtemp(
|
|
25516
|
+
const stage = await mkdtemp(join11(objectRoot, ".build-"));
|
|
25086
25517
|
temporary.push(stage);
|
|
25087
|
-
const generatedDirectory =
|
|
25518
|
+
const generatedDirectory = join11(objectRoot, "0".repeat(64), "generated");
|
|
25088
25519
|
const host = hosts.get(target.name);
|
|
25089
25520
|
const standaloneFunction = target.kind === "function" && target.modules.length === 0;
|
|
25090
25521
|
const rendered = standaloneFunction ? undefined : renderDeliveryTarget(checked.graph, target, {
|
|
@@ -25098,7 +25529,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25098
25529
|
if (standaloneFunction) {
|
|
25099
25530
|
if (target.function === undefined)
|
|
25100
25531
|
throw new Error("Function target requires an entrypoint descriptor.");
|
|
25101
|
-
const entrypointPath =
|
|
25532
|
+
const entrypointPath = resolve18(sourceRoot, target.function.entrypoint);
|
|
25102
25533
|
if (inside(generatedRoot, entrypointPath) || !/\.[cm]?ts$/.test(entrypointPath)) {
|
|
25103
25534
|
throw new Error("Standalone Function entrypoints require application TypeScript source.");
|
|
25104
25535
|
}
|
|
@@ -25126,7 +25557,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25126
25557
|
const program = ts16.createProgram({
|
|
25127
25558
|
rootNames: [
|
|
25128
25559
|
...parsedConfig.fileNames.filter((path) => !inside(generatedRoot, path)),
|
|
25129
|
-
...Object.keys(generated).map((name) =>
|
|
25560
|
+
...Object.keys(generated).map((name) => join11(stage, "generated", name))
|
|
25130
25561
|
],
|
|
25131
25562
|
options: { ...parsedConfig.options, rootDir: project },
|
|
25132
25563
|
...parsedConfig.projectReferences ? { projectReferences: parsedConfig.projectReferences } : {}
|
|
@@ -25176,7 +25607,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25176
25607
|
}));
|
|
25177
25608
|
const assetInputs = {};
|
|
25178
25609
|
for (const asset of assets.filter((asset) => asset.target === target.name)) {
|
|
25179
|
-
const path =
|
|
25610
|
+
const path = resolve18(sourceRoot, asset.source);
|
|
25180
25611
|
const bytes = await readOwned(sourceRoot, path);
|
|
25181
25612
|
const hash = digest(bytes);
|
|
25182
25613
|
const previousHash = snapshots.get(path);
|
|
@@ -25199,7 +25630,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25199
25630
|
workerApplication: workerApplications.find((app) => app.target === target.name),
|
|
25200
25631
|
assets: assets.filter((asset) => asset.target === target.name)
|
|
25201
25632
|
},
|
|
25202
|
-
inputs: Object.fromEntries([...bundled.inputs].map(([path, hash]) => [
|
|
25633
|
+
inputs: Object.fromEntries([...bundled.inputs].map(([path, hash]) => [relative11(project, path).split(sep11).join("/"), hash])),
|
|
25203
25634
|
assets: assetInputs,
|
|
25204
25635
|
...migrations.entries.length ? { migrations: migrations.entries } : {}
|
|
25205
25636
|
}));
|
|
@@ -25220,7 +25651,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25220
25651
|
if (canonical2(Object.fromEntries(sources)) !== canonical2(Object.fromEntries(await sourceInventory(sourceRoot, generatedRoot))))
|
|
25221
25652
|
throw new Error("Application sources changed during analysis; retry.");
|
|
25222
25653
|
for (const [path, hash] of snapshots) {
|
|
25223
|
-
if (digest(await
|
|
25654
|
+
if (digest(await readFile8(path)) !== hash)
|
|
25224
25655
|
throw new Error("Build inputs changed before publication; retry.");
|
|
25225
25656
|
}
|
|
25226
25657
|
const manifest = parseDeliveryBuildManifest({
|
|
@@ -25239,7 +25670,7 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25239
25670
|
});
|
|
25240
25671
|
phase = "artifact-integrity";
|
|
25241
25672
|
for (const candidate of candidates) {
|
|
25242
|
-
const destination =
|
|
25673
|
+
const destination = join11(objectRoot, candidate.object.objectId);
|
|
25243
25674
|
await noLinks(output.path, destination);
|
|
25244
25675
|
if (await exists(destination) && canonical2(await artifactInventory(destination)) !== canonical2(candidate.object.files)) {
|
|
25245
25676
|
throw new Error("An immutable artifact was modified. Refusing to overwrite it.");
|
|
@@ -25247,10 +25678,10 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25247
25678
|
}
|
|
25248
25679
|
const written = [];
|
|
25249
25680
|
for (const candidate of candidates) {
|
|
25250
|
-
const destination =
|
|
25681
|
+
const destination = join11(objectRoot, candidate.object.objectId);
|
|
25251
25682
|
if (!await exists(destination)) {
|
|
25252
25683
|
await rename4(candidate.path, destination);
|
|
25253
|
-
written.push(...candidate.object.files.map((file) =>
|
|
25684
|
+
written.push(...candidate.object.files.map((file) => join11(destination, file.path)));
|
|
25254
25685
|
}
|
|
25255
25686
|
}
|
|
25256
25687
|
phase = "manifest-publication";
|
|
@@ -25290,14 +25721,14 @@ async function buildDeliveryProject(options, delivery) {
|
|
|
25290
25721
|
}
|
|
25291
25722
|
|
|
25292
25723
|
// src/migrations.ts
|
|
25293
|
-
import { rename as rename5, readFile as
|
|
25294
|
-
import { relative as
|
|
25724
|
+
import { rename as rename5, readFile as readFile10, writeFile as writeFile5, rm as rm3 } from "node:fs/promises";
|
|
25725
|
+
import { relative as relative12, resolve as resolve20 } from "node:path";
|
|
25295
25726
|
import * as ts17 from "@typescript/typescript6";
|
|
25296
25727
|
|
|
25297
25728
|
// src/migration-policy.ts
|
|
25298
|
-
import { readFile as
|
|
25729
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
25299
25730
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
25300
|
-
import { resolve as
|
|
25731
|
+
import { resolve as resolve19 } from "node:path";
|
|
25301
25732
|
|
|
25302
25733
|
// src/migration-app-version.ts
|
|
25303
25734
|
var MIGRATION_APP_VERSION = "0.35.0";
|
|
@@ -25330,7 +25761,7 @@ async function checkMigrationDependencies(rootDir) {
|
|
|
25330
25761
|
const problems = [];
|
|
25331
25762
|
for (const [name, expected] of Object.entries(migrationDependencies())) {
|
|
25332
25763
|
try {
|
|
25333
|
-
const manifest = JSON.parse(await
|
|
25764
|
+
const manifest = JSON.parse(await readFile9(resolve19(rootDir, "node_modules", name, "package.json"), "utf8"));
|
|
25334
25765
|
if (!manifest || typeof manifest !== "object" || !("name" in manifest) || manifest.name !== name || !("version" in manifest) || manifest.version !== expected) {
|
|
25335
25766
|
problems.push(`${name}: requires tested installed version ${expected}`);
|
|
25336
25767
|
}
|
|
@@ -25435,7 +25866,7 @@ function resolveStaticObjectLiteral2(input, checker, seen = new Set) {
|
|
|
25435
25866
|
return;
|
|
25436
25867
|
}
|
|
25437
25868
|
function displayFile(rootDir, fileName) {
|
|
25438
|
-
const path =
|
|
25869
|
+
const path = relative12(rootDir, fileName);
|
|
25439
25870
|
return path && !path.startsWith("..") ? path : fileName;
|
|
25440
25871
|
}
|
|
25441
25872
|
function createMigrationProgram(fileNames, sourceOverrides, rootDir) {
|
|
@@ -25445,10 +25876,10 @@ function createMigrationProgram(fileNames, sourceOverrides, rootDir) {
|
|
|
25445
25876
|
const fileExists = host.fileExists.bind(host);
|
|
25446
25877
|
const readFile = host.readFile.bind(host);
|
|
25447
25878
|
const currentDirectory = host.getCurrentDirectory.bind(host);
|
|
25448
|
-
host.fileExists = (fileName) => sourceOverrides.has(
|
|
25449
|
-
host.readFile = (fileName) => sourceOverrides.get(
|
|
25879
|
+
host.fileExists = (fileName) => sourceOverrides.has(resolve20(fileName)) || fileExists(fileName);
|
|
25880
|
+
host.readFile = (fileName) => sourceOverrides.get(resolve20(fileName)) ?? readFile(fileName);
|
|
25450
25881
|
host.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
|
|
25451
|
-
const source = sourceOverrides.get(
|
|
25882
|
+
const source = sourceOverrides.get(resolve20(fileName));
|
|
25452
25883
|
return source === undefined ? getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) : ts17.createSourceFile(fileName, source, languageVersion, true);
|
|
25453
25884
|
};
|
|
25454
25885
|
host.getCurrentDirectory = () => rootDir ?? currentDirectory();
|
|
@@ -25474,7 +25905,7 @@ function planRouteResponseMigration(sourceFiles, checker, rootDir, includedFiles
|
|
|
25474
25905
|
issues.push(issue);
|
|
25475
25906
|
};
|
|
25476
25907
|
for (const sourceFile of sourceFiles) {
|
|
25477
|
-
const sourcePath =
|
|
25908
|
+
const sourcePath = resolve20(sourceFile.fileName);
|
|
25478
25909
|
if (!includedFiles.has(sourcePath))
|
|
25479
25910
|
continue;
|
|
25480
25911
|
const visit = (node) => {
|
|
@@ -25482,7 +25913,7 @@ function planRouteResponseMigration(sourceFiles, checker, rootDir, includedFiles
|
|
|
25482
25913
|
const options = node.arguments[1];
|
|
25483
25914
|
const object = options && resolveStaticObjectLiteral2(options, checker);
|
|
25484
25915
|
if (object) {
|
|
25485
|
-
const objectPath =
|
|
25916
|
+
const objectPath = resolve20(object.getSourceFile().fileName);
|
|
25486
25917
|
const properties = routeResponseProperties(object);
|
|
25487
25918
|
if (properties.response) {
|
|
25488
25919
|
if (!includedFiles.has(objectPath)) {
|
|
@@ -25525,13 +25956,13 @@ function planRouteResponseMigration(sourceFiles, checker, rootDir, includedFiles
|
|
|
25525
25956
|
line: lineOf2(sourceFile, response)
|
|
25526
25957
|
});
|
|
25527
25958
|
} else {
|
|
25528
|
-
const replacements = replacementsByFile.get(
|
|
25959
|
+
const replacements = replacementsByFile.get(resolve20(sourceFile.fileName)) ?? [];
|
|
25529
25960
|
replacements.push({
|
|
25530
25961
|
start: response.getStart(sourceFile),
|
|
25531
25962
|
end: response.getEnd(),
|
|
25532
25963
|
text: `responses: { 200: ${response.initializer.getText(sourceFile)} }`
|
|
25533
25964
|
});
|
|
25534
|
-
replacementsByFile.set(
|
|
25965
|
+
replacementsByFile.set(resolve20(sourceFile.fileName), replacements);
|
|
25535
25966
|
}
|
|
25536
25967
|
}
|
|
25537
25968
|
return { replacementsByFile, issues };
|
|
@@ -25544,7 +25975,7 @@ function applyReplacements(source, replacements) {
|
|
|
25544
25975
|
return content;
|
|
25545
25976
|
}
|
|
25546
25977
|
function migrateRouteResponse(source, fileName) {
|
|
25547
|
-
const absoluteFile =
|
|
25978
|
+
const absoluteFile = resolve20(fileName);
|
|
25548
25979
|
const sourceOverrides = new Map([[absoluteFile, source]]);
|
|
25549
25980
|
const program = createMigrationProgram([absoluteFile], sourceOverrides);
|
|
25550
25981
|
const sourceFile = program.getSourceFile(absoluteFile);
|
|
@@ -25560,7 +25991,7 @@ function migrateRouteResponse(source, fileName) {
|
|
|
25560
25991
|
}]
|
|
25561
25992
|
};
|
|
25562
25993
|
}
|
|
25563
|
-
const plan = planRouteResponseMigration([sourceFile], program.getTypeChecker(),
|
|
25994
|
+
const plan = planRouteResponseMigration([sourceFile], program.getTypeChecker(), resolve20("."), new Set([absoluteFile]));
|
|
25564
25995
|
const replacements = plan.replacementsByFile.get(absoluteFile) ?? [];
|
|
25565
25996
|
return {
|
|
25566
25997
|
changed: replacements.length > 0,
|
|
@@ -25570,7 +26001,7 @@ function migrateRouteResponse(source, fileName) {
|
|
|
25570
26001
|
};
|
|
25571
26002
|
}
|
|
25572
26003
|
function migrateRouteResponseProject(files, rootDir, sourceByPath) {
|
|
25573
|
-
const absoluteFiles = files.map((file) =>
|
|
26004
|
+
const absoluteFiles = files.map((file) => resolve20(file));
|
|
25574
26005
|
const program = createMigrationProgram(absoluteFiles, sourceByPath, rootDir);
|
|
25575
26006
|
const sourceFiles = absoluteFiles.map((file) => program.getSourceFile(file)).filter((file) => file !== undefined);
|
|
25576
26007
|
const plan = planRouteResponseMigration(sourceFiles, program.getTypeChecker(), rootDir, new Set(absoluteFiles));
|
|
@@ -25583,11 +26014,11 @@ function migrateRouteResponseProject(files, rootDir, sourceByPath) {
|
|
|
25583
26014
|
changed: replacements.length > 0,
|
|
25584
26015
|
content: applyReplacements(source, replacements),
|
|
25585
26016
|
replacements: replacements.length,
|
|
25586
|
-
issues: plan.issues.filter((issue) =>
|
|
26017
|
+
issues: plan.issues.filter((issue) => resolve20(rootDir, issue.file) === file)
|
|
25587
26018
|
});
|
|
25588
26019
|
}
|
|
25589
26020
|
for (const issue of plan.issues) {
|
|
25590
|
-
const path =
|
|
26021
|
+
const path = resolve20(rootDir, issue.file);
|
|
25591
26022
|
if (!results.has(path) && sourceByPath.has(path)) {
|
|
25592
26023
|
results.set(path, {
|
|
25593
26024
|
changed: false,
|
|
@@ -25618,14 +26049,14 @@ var SUPACLOUD_MIGRATIONS = [
|
|
|
25618
26049
|
async function writeAtomically(path, content) {
|
|
25619
26050
|
const temporary = `${path}.supacloud-migrate-${process.pid}-${crypto.randomUUID()}`;
|
|
25620
26051
|
try {
|
|
25621
|
-
await
|
|
26052
|
+
await writeFile5(temporary, content, "utf8");
|
|
25622
26053
|
await rename5(temporary, path);
|
|
25623
26054
|
} finally {
|
|
25624
26055
|
await rm3(temporary, { force: true });
|
|
25625
26056
|
}
|
|
25626
26057
|
}
|
|
25627
26058
|
async function migrateProject(options) {
|
|
25628
|
-
const rootDir =
|
|
26059
|
+
const rootDir = resolve20(options.rootDir);
|
|
25629
26060
|
let migrations = SUPACLOUD_MIGRATIONS;
|
|
25630
26061
|
const preflightIssues = [];
|
|
25631
26062
|
if (options.fromVersion !== undefined || options.toVersion !== undefined) {
|
|
@@ -25681,7 +26112,7 @@ async function migrateProject(options) {
|
|
|
25681
26112
|
}
|
|
25682
26113
|
};
|
|
25683
26114
|
for (const filePath of files) {
|
|
25684
|
-
sourceByPath.set(
|
|
26115
|
+
sourceByPath.set(resolve20(filePath), await readFile10(filePath, "utf8"));
|
|
25685
26116
|
}
|
|
25686
26117
|
const originalSources = new Map(sourceByPath);
|
|
25687
26118
|
const writtenFiles = new Set;
|
|
@@ -25690,8 +26121,8 @@ async function migrateProject(options) {
|
|
|
25690
26121
|
if (projectResults)
|
|
25691
26122
|
appendIssues(projectResults.issues);
|
|
25692
26123
|
for (const filePath of files) {
|
|
25693
|
-
const absoluteFile =
|
|
25694
|
-
const file =
|
|
26124
|
+
const absoluteFile = resolve20(filePath);
|
|
26125
|
+
const file = relative12(rootDir, absoluteFile) || absoluteFile;
|
|
25695
26126
|
const before = sourceByPath.get(absoluteFile);
|
|
25696
26127
|
if (before === undefined)
|
|
25697
26128
|
continue;
|
|
@@ -25716,7 +26147,7 @@ async function migrateProject(options) {
|
|
|
25716
26147
|
const written = [];
|
|
25717
26148
|
try {
|
|
25718
26149
|
for (const [path, content] of pendingWrites) {
|
|
25719
|
-
if (await
|
|
26150
|
+
if (await readFile10(path, "utf8") !== originalSources.get(path)) {
|
|
25720
26151
|
throw new Error(`Source changed during migration: ${path}`);
|
|
25721
26152
|
}
|
|
25722
26153
|
await writeAtomically(path, content);
|
|
@@ -25728,7 +26159,7 @@ async function migrateProject(options) {
|
|
|
25728
26159
|
for (const path of written.reverse()) {
|
|
25729
26160
|
try {
|
|
25730
26161
|
const original = originalSources.get(path);
|
|
25731
|
-
if (original === undefined || await
|
|
26162
|
+
if (original === undefined || await readFile10(path, "utf8") !== pendingWrites.get(path)) {
|
|
25732
26163
|
throw new Error("File changed after migration; refusing to overwrite concurrent edits");
|
|
25733
26164
|
}
|
|
25734
26165
|
await writeAtomically(path, original);
|
|
@@ -25739,7 +26170,7 @@ async function migrateProject(options) {
|
|
|
25739
26170
|
}
|
|
25740
26171
|
}
|
|
25741
26172
|
}
|
|
25742
|
-
const changedFiles = options.write && issues.length > 0 ? [...writtenFiles].map((file) =>
|
|
26173
|
+
const changedFiles = options.write && issues.length > 0 ? [...writtenFiles].map((file) => relative12(rootDir, file)) : [...new Set(results.filter((result) => result.changed && result.issues.length === 0).map((result) => result.file))];
|
|
25743
26174
|
return {
|
|
25744
26175
|
write: options.write === true,
|
|
25745
26176
|
migrations: migrations.map(({ id, from, to, description }) => ({ id, from, to, description })),
|
|
@@ -25750,14 +26181,14 @@ async function migrateProject(options) {
|
|
|
25750
26181
|
}
|
|
25751
26182
|
|
|
25752
26183
|
// src/migration-assess.ts
|
|
25753
|
-
import { createHash as
|
|
25754
|
-
import { readFile as
|
|
25755
|
-
import { join as
|
|
26184
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
26185
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
26186
|
+
import { join as join12, resolve as resolve22 } from "node:path";
|
|
25756
26187
|
|
|
25757
26188
|
// src/openapi-tools.ts
|
|
25758
|
-
import { mkdir as mkdir4, readFile as
|
|
25759
|
-
import { dirname as dirname10, resolve as
|
|
25760
|
-
import { pathToFileURL as
|
|
26189
|
+
import { mkdir as mkdir4, readFile as readFile11, rename as rename6, unlink as unlink3, writeFile as writeFile6 } from "node:fs/promises";
|
|
26190
|
+
import { dirname as dirname10, resolve as resolve21 } from "node:path";
|
|
26191
|
+
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
25761
26192
|
|
|
25762
26193
|
class OpenApiDocumentError extends Error {
|
|
25763
26194
|
code = "OPENAPI_DOCUMENT_INVALID";
|
|
@@ -26147,7 +26578,7 @@ function serializeOpenApiJson(document, space = 2) {
|
|
|
26147
26578
|
}
|
|
26148
26579
|
async function readOpenApiJson(path) {
|
|
26149
26580
|
try {
|
|
26150
|
-
const value = JSON.parse(await
|
|
26581
|
+
const value = JSON.parse(await readFile11(resolve21(path), "utf8"));
|
|
26151
26582
|
return parseOpenApiDocument(value);
|
|
26152
26583
|
} catch (error) {
|
|
26153
26584
|
if (error instanceof OpenApiDocumentError)
|
|
@@ -26156,16 +26587,16 @@ async function readOpenApiJson(path) {
|
|
|
26156
26587
|
}
|
|
26157
26588
|
}
|
|
26158
26589
|
async function writeOpenApiJson(document, outputPath, space = 2) {
|
|
26159
|
-
const path =
|
|
26590
|
+
const path = resolve21(outputPath);
|
|
26160
26591
|
const content = serializeOpenApiJson(document, space);
|
|
26161
26592
|
await mkdir4(dirname10(path), { recursive: true });
|
|
26162
26593
|
try {
|
|
26163
|
-
if (await
|
|
26594
|
+
if (await readFile11(path, "utf8") === content)
|
|
26164
26595
|
return { path, written: false };
|
|
26165
26596
|
} catch {}
|
|
26166
26597
|
const temporaryPath = `${path}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
26167
26598
|
try {
|
|
26168
|
-
await
|
|
26599
|
+
await writeFile6(temporaryPath, content, "utf8");
|
|
26169
26600
|
await rename6(temporaryPath, path);
|
|
26170
26601
|
} catch (error) {
|
|
26171
26602
|
await unlink3(temporaryPath).catch(() => {
|
|
@@ -26177,7 +26608,7 @@ async function writeOpenApiJson(document, outputPath, space = 2) {
|
|
|
26177
26608
|
}
|
|
26178
26609
|
async function loadGeneratedOpenApiDocument(modulePath) {
|
|
26179
26610
|
try {
|
|
26180
|
-
const moduleUrl =
|
|
26611
|
+
const moduleUrl = pathToFileURL3(resolve21(modulePath));
|
|
26181
26612
|
moduleUrl.searchParams.set("supacloud-openapi-export", "1");
|
|
26182
26613
|
const loaded = await import(moduleUrl.href);
|
|
26183
26614
|
if (!isRecord(loaded))
|
|
@@ -26447,17 +26878,17 @@ function validRpcInventory(value, commandInventory) {
|
|
|
26447
26878
|
});
|
|
26448
26879
|
}
|
|
26449
26880
|
async function sha2566(path) {
|
|
26450
|
-
return
|
|
26881
|
+
return createHash12("sha256").update(await readFile12(path)).digest("hex");
|
|
26451
26882
|
}
|
|
26452
26883
|
function overallStatus(findings) {
|
|
26453
26884
|
return findings.reduce((current, finding) => STATUS_PRIORITY[finding.status] > STATUS_PRIORITY[current] ? finding.status : current, "compatible");
|
|
26454
26885
|
}
|
|
26455
26886
|
async function assessMigration(options) {
|
|
26456
|
-
const projectDir =
|
|
26887
|
+
const projectDir = resolve22(options.projectDir);
|
|
26457
26888
|
const compile = {
|
|
26458
26889
|
...options.compile,
|
|
26459
|
-
rootDir:
|
|
26460
|
-
outDir:
|
|
26890
|
+
rootDir: resolve22(options.compile.rootDir),
|
|
26891
|
+
outDir: resolve22(options.compile.outDir)
|
|
26461
26892
|
};
|
|
26462
26893
|
const findings = [];
|
|
26463
26894
|
const dependencyProblems = await checkMigrationDependencies(projectDir);
|
|
@@ -26508,13 +26939,13 @@ async function assessMigration(options) {
|
|
|
26508
26939
|
remediation: "Verify the project source, configuration and installed dependencies, then reassess."
|
|
26509
26940
|
});
|
|
26510
26941
|
}
|
|
26511
|
-
const contractsManifestPath =
|
|
26942
|
+
const contractsManifestPath = join12(compile.outDir, "contracts.manifest.json");
|
|
26512
26943
|
let contractsManifest = {
|
|
26513
26944
|
path: contractsManifestPath,
|
|
26514
26945
|
present: false
|
|
26515
26946
|
};
|
|
26516
26947
|
try {
|
|
26517
|
-
const parsed = JSON.parse(await
|
|
26948
|
+
const parsed = JSON.parse(await readFile12(contractsManifestPath, "utf8"));
|
|
26518
26949
|
if (!isRecord2(parsed) || parsed["version"] !== 1 || !validJobInventory(parsed["jobs"]) || !validCommandInventory(parsed["commands"]) || !Array.isArray(parsed["routes"]) || !validRpcInventory(parsed["rpc"], parsed["commands"]) || !validFeatureInventory(parsed["features"], parsed["jobs"], parsed["commands"], parsed["routes"], parsed["rpc"])) {
|
|
26519
26950
|
throw new Error("invalid manifest");
|
|
26520
26951
|
}
|
|
@@ -26545,8 +26976,8 @@ async function assessMigration(options) {
|
|
|
26545
26976
|
}
|
|
26546
26977
|
let openApi;
|
|
26547
26978
|
if (options.baselineOpenApiPath && options.currentOpenApiPath) {
|
|
26548
|
-
const baselinePath =
|
|
26549
|
-
const currentPath =
|
|
26979
|
+
const baselinePath = resolve22(projectDir, options.baselineOpenApiPath);
|
|
26980
|
+
const currentPath = resolve22(projectDir, options.currentOpenApiPath);
|
|
26550
26981
|
try {
|
|
26551
26982
|
const diff = diffOpenApiDocuments(await readOpenApiJson(baselinePath), await readOpenApiJson(currentPath));
|
|
26552
26983
|
openApi = {
|
|
@@ -26628,8 +27059,8 @@ function formatMigrationAssessment(result) {
|
|
|
26628
27059
|
|
|
26629
27060
|
// src/graphql-governance.ts
|
|
26630
27061
|
init_graphql_schema_hashes();
|
|
26631
|
-
import { readFile as
|
|
26632
|
-
import { resolve as
|
|
27062
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
27063
|
+
import { resolve as resolve23 } from "node:path";
|
|
26633
27064
|
import {
|
|
26634
27065
|
buildClientSchema as buildClientSchema2,
|
|
26635
27066
|
buildSchema as buildSchema2,
|
|
@@ -26649,8 +27080,8 @@ function schemaFromSource(source, path = "schema.graphql") {
|
|
|
26649
27080
|
return buildSchema2(source);
|
|
26650
27081
|
}
|
|
26651
27082
|
async function readGraphqlSchema(path) {
|
|
26652
|
-
const absolute =
|
|
26653
|
-
const source = await
|
|
27083
|
+
const absolute = resolve23(path);
|
|
27084
|
+
const source = await readFile13(absolute, "utf8");
|
|
26654
27085
|
const hashes = graphqlSchemaHashes(source);
|
|
26655
27086
|
return { path: absolute, source, schema: schemaFromSource(source, absolute), ...hashes };
|
|
26656
27087
|
}
|
|
@@ -26911,6 +27342,7 @@ Usage:
|
|
|
26911
27342
|
supacloud-compiler graph [rootDir] [options]
|
|
26912
27343
|
supacloud-compiler explain <name> [rootDir] [options]
|
|
26913
27344
|
supacloud-compiler context <name> [rootDir] [options]
|
|
27345
|
+
supacloud-compiler preview-fix --production <dir> --preview <dir> --preview-id <uuid> --project-ref <ref> --application-id <id> --environment-id <id> --property transaction|idempotency --value required|none [--json]
|
|
26914
27346
|
supacloud-compiler dev-context [rootDir] [options]
|
|
26915
27347
|
supacloud-compiler environment-bindings [rootDir] [options]
|
|
26916
27348
|
supacloud-compiler release-evidence --delivery-manifest <file> --delivery-target <name> [--json]
|
|
@@ -26936,6 +27368,7 @@ Commands:
|
|
|
26936
27368
|
graph Print the discovered application graph
|
|
26937
27369
|
explain Explain a module, provider, or external token
|
|
26938
27370
|
context Extract an AI-sized module context pack
|
|
27371
|
+
preview-fix Edit, compile, invoke, and record a timeline inside one isolated preview. Does not deploy or write production.
|
|
26939
27372
|
dev-context Print the read-only application development context for tooling/console/MCP consumers
|
|
26940
27373
|
environment-bindings Resolve static per-environment resource bindings without credentials
|
|
26941
27374
|
release-evidence Summarize one immutable target without loading project configuration
|
|
@@ -27009,11 +27442,11 @@ async function runGraphqlGovernanceCommand(args) {
|
|
|
27009
27442
|
if (!schemaPath || documentPaths.length === 0)
|
|
27010
27443
|
throw new Error("graphql compatibility requires --schema and at least one --documents");
|
|
27011
27444
|
const schema = await readGraphqlSchema(schemaPath);
|
|
27012
|
-
const documents = await Promise.all(documentPaths.map(async (path) => ({ path, source: await
|
|
27445
|
+
const documents = await Promise.all(documentPaths.map(async (path) => ({ path, source: await readFile16(resolve27(path), "utf8") })));
|
|
27013
27446
|
let policy = {};
|
|
27014
27447
|
const policyPath = one("--policy");
|
|
27015
27448
|
if (policyPath)
|
|
27016
|
-
policy = JSON.parse(await
|
|
27449
|
+
policy = JSON.parse(await readFile16(resolve27(policyPath), "utf8"));
|
|
27017
27450
|
const report = checkGraphqlCompatibility(schema.schema, documents, policy);
|
|
27018
27451
|
const result = {
|
|
27019
27452
|
ok: report.ok,
|
|
@@ -27049,7 +27482,7 @@ async function runGraphqlGovernanceCommand(args) {
|
|
|
27049
27482
|
throw new Error("--role must use name=schema");
|
|
27050
27483
|
const role = value.slice(0, separator);
|
|
27051
27484
|
const path = value.slice(separator + 1);
|
|
27052
|
-
return { role, path, source: await
|
|
27485
|
+
return { role, path, source: await readFile16(resolve27(path), "utf8") };
|
|
27053
27486
|
}));
|
|
27054
27487
|
const result = createRoleSnapshotReport(roles);
|
|
27055
27488
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -27068,6 +27501,10 @@ async function run() {
|
|
|
27068
27501
|
const command = args[0];
|
|
27069
27502
|
if (await runGraphqlGovernanceCommand(args))
|
|
27070
27503
|
return;
|
|
27504
|
+
if (command === "preview-fix") {
|
|
27505
|
+
await runPreviewFixCommand(args.slice(1));
|
|
27506
|
+
return;
|
|
27507
|
+
}
|
|
27071
27508
|
if (command === "release-evidence") {
|
|
27072
27509
|
await Promise.resolve().then(() => init_release_evidence_cli());
|
|
27073
27510
|
await runReleaseEvidenceCommand(args.slice(1));
|
|
@@ -27319,7 +27756,7 @@ async function run() {
|
|
|
27319
27756
|
throw new Error("Build context requires a manifest, target, subject, events, request ID and --json");
|
|
27320
27757
|
}
|
|
27321
27758
|
try {
|
|
27322
|
-
const pack = await createDeliveryExecutionContextPack(contextManifest, contextTarget, query, await readExecutionMetadata(
|
|
27759
|
+
const pack = await createDeliveryExecutionContextPack(contextManifest, contextTarget, query, await readExecutionMetadata(resolve27(executionEventsPath)), executionRequestId);
|
|
27323
27760
|
console.log(JSON.stringify(pack, null, 2));
|
|
27324
27761
|
} catch (error) {
|
|
27325
27762
|
console.log(JSON.stringify({
|
|
@@ -27338,7 +27775,7 @@ async function run() {
|
|
|
27338
27775
|
const currentPath = openApiDiffPaths[1];
|
|
27339
27776
|
if (!basePath || !currentPath)
|
|
27340
27777
|
throw new Error("openapi-diff requires two JSON file paths");
|
|
27341
|
-
const result = diffOpenApiDocuments(await readOpenApiJson(
|
|
27778
|
+
const result = diffOpenApiDocuments(await readOpenApiJson(resolve27(process.cwd(), basePath)), await readOpenApiJson(resolve27(process.cwd(), currentPath)));
|
|
27342
27779
|
console.log(json ? JSON.stringify(result, null, 2) : formatOpenApiDiff(result));
|
|
27343
27780
|
if (!result.ok)
|
|
27344
27781
|
process.exitCode = 1;
|
|
@@ -27353,8 +27790,8 @@ async function run() {
|
|
|
27353
27790
|
if (!modulePath || !outputPath)
|
|
27354
27791
|
throw new Error("openapi-export requires an OpenAPI module and output path");
|
|
27355
27792
|
const result = await exportGeneratedOpenApiJson({
|
|
27356
|
-
modulePath:
|
|
27357
|
-
outputPath:
|
|
27793
|
+
modulePath: resolve27(process.cwd(), modulePath),
|
|
27794
|
+
outputPath: resolve27(process.cwd(), outputPath),
|
|
27358
27795
|
...openApiExportSpace === undefined ? {} : { space: openApiExportSpace }
|
|
27359
27796
|
});
|
|
27360
27797
|
console.log(json ? JSON.stringify({ ok: true, ...result }, null, 2) : result.written ? `OpenAPI JSON written: ${result.path}` : `OpenAPI JSON matches: ${result.path}`);
|
|
@@ -27362,7 +27799,7 @@ async function run() {
|
|
|
27362
27799
|
}
|
|
27363
27800
|
if (command === "migrate") {
|
|
27364
27801
|
const result = await migrateProject({
|
|
27365
|
-
rootDir: rootDir ?
|
|
27802
|
+
rootDir: rootDir ? resolve27(process.cwd(), rootDir) : process.cwd(),
|
|
27366
27803
|
write: !dryRun,
|
|
27367
27804
|
...fromVersion === undefined ? {} : { fromVersion },
|
|
27368
27805
|
...toVersion === undefined ? {} : { toVersion }
|
|
@@ -27400,8 +27837,8 @@ async function run() {
|
|
|
27400
27837
|
if (checkSchema && command !== "graphql-schema")
|
|
27401
27838
|
throw new Error("--check is only supported by graphql-schema");
|
|
27402
27839
|
const defaults = resolveSupacloudConfig(loadedConfig, process.cwd());
|
|
27403
|
-
const resolvedRoot = rootDir ?
|
|
27404
|
-
const resolvedOut = outDir ?
|
|
27840
|
+
const resolvedRoot = rootDir ? resolve27(process.cwd(), rootDir) : defaults.rootDir;
|
|
27841
|
+
const resolvedOut = outDir ? resolve27(process.cwd(), outDir) : defaults.outDir;
|
|
27405
27842
|
const configured = compileOptionsFromConfig({
|
|
27406
27843
|
...loadedConfig,
|
|
27407
27844
|
root: resolvedRoot,
|
|
@@ -27420,7 +27857,7 @@ async function run() {
|
|
|
27420
27857
|
let delivery = loadedConfig.delivery;
|
|
27421
27858
|
if (deliveryPath !== undefined) {
|
|
27422
27859
|
try {
|
|
27423
|
-
delivery = JSON.parse(await
|
|
27860
|
+
delivery = JSON.parse(await readFile16(resolve27(process.cwd(), deliveryPath), "utf8"));
|
|
27424
27861
|
} catch {
|
|
27425
27862
|
throw new DeliveryConfigurationError;
|
|
27426
27863
|
}
|
|
@@ -27478,7 +27915,7 @@ ${item.suggestion ?? ""}`).join(`
|
|
|
27478
27915
|
} else if (command === "fix") {
|
|
27479
27916
|
if (!query)
|
|
27480
27917
|
throw new Error("fix requires a JSON file containing one DiagnosticFix");
|
|
27481
|
-
const input = JSON.parse(await
|
|
27918
|
+
const input = JSON.parse(await readFile16(resolve27(process.cwd(), query), "utf8"));
|
|
27482
27919
|
const envelope = input && typeof input === "object" && "fix" in input;
|
|
27483
27920
|
if (envelope && (typeof input.expectedSourceHash !== "string" || !/^[a-f0-9]{64}$/.test(input.expectedSourceHash))) {
|
|
27484
27921
|
throw new Error("Editor fix requires the source hash from its validated preview");
|
|
@@ -27619,7 +28056,7 @@ Source change detected; compiling...`);
|
|
|
27619
28056
|
process.exitCode = 1;
|
|
27620
28057
|
return;
|
|
27621
28058
|
}
|
|
27622
|
-
const file =
|
|
28059
|
+
const file = resolve27(rootDir ? resolve27(process.cwd(), rootDir) : process.cwd(), bindingsFile ?? "supacloud.environments.json");
|
|
27623
28060
|
try {
|
|
27624
28061
|
const document = await readEnvironmentBindingsFile(file);
|
|
27625
28062
|
const graph = await analyzeProject(resolvedRoot);
|
|
@@ -27654,7 +28091,7 @@ Source change detected; compiling...`);
|
|
|
27654
28091
|
try {
|
|
27655
28092
|
const result = await checkProject(compileDefaults);
|
|
27656
28093
|
if (executionEventsPath && executionRequestId) {
|
|
27657
|
-
const pack = createExecutionContextPack({ ...result.graph, diagnostics: result.diagnostics }, query, await readExecutionMetadata(
|
|
28094
|
+
const pack = createExecutionContextPack({ ...result.graph, diagnostics: result.diagnostics }, query, await readExecutionMetadata(resolve27(process.cwd(), executionEventsPath)), executionRequestId);
|
|
27658
28095
|
console.log(JSON.stringify(pack, null, 2));
|
|
27659
28096
|
return;
|
|
27660
28097
|
}
|