@void/deploy-core 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -22
- package/dist/index.mjs +11 -20
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/validate.d.ts
|
|
2
1
|
export declare const MANIFEST_REDIRECT_RULE_STATUSES: ReadonlySet<number>;
|
|
3
2
|
export declare const MAX_ROUTING_RULES = 2e3;
|
|
4
3
|
export declare const MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES: number;
|
|
@@ -7,8 +6,6 @@ export declare const MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES: number;
|
|
|
7
6
|
* Deploy code reads the manifest without re-checking, so run this before creating any deploy state.
|
|
8
7
|
*/
|
|
9
8
|
export declare function validateManifestShape(manifest: unknown): string | null;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/resource-plan.d.ts
|
|
12
9
|
type DeployResource = {
|
|
13
10
|
type: "d1";
|
|
14
11
|
bindingName: string;
|
|
@@ -44,8 +41,6 @@ type DeployResourcePlan = {
|
|
|
44
41
|
* target adapter and are deliberately absent from this plan.
|
|
45
42
|
*/
|
|
46
43
|
export declare function createDeployResourcePlan(manifest: DeployManifest): DeployResourcePlan;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/target.d.ts
|
|
49
44
|
/** A concrete destination that can execute a Void deployment. */
|
|
50
45
|
type DeployTarget = "cloudflare" | "void";
|
|
51
46
|
type DeployAppType = "void" | "spa" | "static" | "framework";
|
|
@@ -91,8 +86,6 @@ type DeployTargetAdapter<TOptions, TContext> = {
|
|
|
91
86
|
readonly capabilities: DeployTargetCapabilities;
|
|
92
87
|
deploy(root: string, options: TOptions, context: TContext): Promise<void>;
|
|
93
88
|
};
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/intent.d.ts
|
|
96
89
|
type DeployRuntimeFeatures = Readonly<{
|
|
97
90
|
assets: boolean;
|
|
98
91
|
auth: boolean;
|
|
@@ -120,8 +113,6 @@ type DeployIntent = Readonly<{
|
|
|
120
113
|
* This function performs no I/O and does not mutate the manifest.
|
|
121
114
|
*/
|
|
122
115
|
export declare function createDeployIntent(manifest: DeployManifest): DeployIntent;
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/artifact.d.ts
|
|
125
116
|
export declare const DEPLOY_ARTIFACT_VERSION: 1;
|
|
126
117
|
/** Content-addressed metadata for one static asset in a deployment artifact. */
|
|
127
118
|
type DeployAssetManifestEntry = {
|
|
@@ -206,19 +197,11 @@ export declare function createDeployArtifact(input: {
|
|
|
206
197
|
export declare function createDeployUploadPayload(artifact: DeployArtifact, metadata: DeploySourceMetadata & {
|
|
207
198
|
preflight: "true" | null;
|
|
208
199
|
}, workerInput?: DeployWorkerInput): DeployUploadPayload;
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/canonical-json.d.ts
|
|
211
200
|
export declare function canonicalJson(value: unknown): string;
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/artifact-digest.d.ts
|
|
214
201
|
/** Commit to all executable bytes, asset hashes, bindings, migrations, and routing. */
|
|
215
202
|
export declare function deployArtifactDigest(artifact: DeployArtifact): Promise<string>;
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/is-record.d.ts
|
|
218
203
|
/** Narrow object-shaped input without accepting null or arrays. */
|
|
219
204
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region src/sql-tokenize.d.ts
|
|
222
205
|
/**
|
|
223
206
|
* Char-by-char SQL tokenizer shared by the migration classifier, the
|
|
224
207
|
* destructive-SQL guard, and the remote migration runner.
|
|
@@ -267,8 +250,6 @@ type SqlSegment = {
|
|
|
267
250
|
end: number;
|
|
268
251
|
};
|
|
269
252
|
export declare function tokenizeSql(sql: string): Generator<SqlSegment>;
|
|
270
|
-
//#endregion
|
|
271
|
-
//#region src/migration-plan.d.ts
|
|
272
253
|
export declare const MIGRATION_CLASSIFIER_VERSION = 1;
|
|
273
254
|
export declare const UNSPLIT_MULTI_STATEMENT_PRAGMA = "-- void:allow-unsplit-multi-statement";
|
|
274
255
|
type SqlMigrationClassification = {
|
|
@@ -302,8 +283,6 @@ export declare function splitSqlStatements(sql: string): Array<string> | null;
|
|
|
302
283
|
export declare function classifySqlMigration(sql: string): SqlMigrationClassification;
|
|
303
284
|
/** Preserve the classifier-v1 hash preimage; policy markers and warnings are not hashed. */
|
|
304
285
|
export declare function getMigrationPlanHashInput(plan: MigrationPlanHashInput): unknown;
|
|
305
|
-
//#endregion
|
|
306
|
-
//#region src/index.d.ts
|
|
307
286
|
export declare const SUPPORTED_MANIFEST_VERSIONS: ReadonlyArray<number>;
|
|
308
287
|
export type MigrationMeta = {
|
|
309
288
|
name: string;
|
|
@@ -490,6 +469,8 @@ export type DeployManifest = {
|
|
|
490
469
|
hashedAssetsPrefix?: string;
|
|
491
470
|
headerRules?: Array<HeaderRule>;
|
|
492
471
|
redirectRules?: Array<RedirectRule>;
|
|
472
|
+
/** Omitted values inherit the platform default; preserve explicit false. */
|
|
473
|
+
alwaysUseHttps?: boolean;
|
|
493
474
|
fallbackRules?: Array<RedirectRule>;
|
|
494
475
|
websocket?: WebSocketManifestMeta;
|
|
495
476
|
sandbox?: SandboxManifestMeta;
|
|
@@ -561,5 +542,4 @@ export type DeployEvent = {
|
|
|
561
542
|
message: string;
|
|
562
543
|
step: string;
|
|
563
544
|
};
|
|
564
|
-
//#endregion
|
|
565
545
|
export type { DeployAppType, DeployArtifact, DeployAssetManifestEntry, DeployAssetUploadRequest, DeployCapabilitySupport, DeployIntent, DeployResource, DeployResourcePlan, DeployRuntimeFeatures, DeploySourceMetadata, DeployTarget, DeployTargetAdapter, DeployTargetCapabilities, DeployUploadPayload, DeployWorkerInput, DeployWorkerModule, DeployWorkerUploadRequest, DeployWorkerUploadResponse, MigrationPlanHashInput, SqlMigrationClassification, SqlSegment };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/is-record.ts
|
|
2
2
|
/** Narrow object-shaped input without accepting null or arrays. */
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
//#region src/validate.ts
|
|
6
|
+
// src/validate.ts
|
|
8
7
|
const MANIFEST_REDIRECT_RULE_STATUSES = /* @__PURE__ */ new Set([
|
|
9
8
|
200,
|
|
10
9
|
301,
|
|
@@ -193,6 +192,7 @@ function validateManifestShape(manifest) {
|
|
|
193
192
|
for (const pair of rule.headers) if (!Array.isArray(pair) || pair.length !== 2 || typeof pair[0] !== "string" || typeof pair[1] !== "string") return "invalid manifest shape: headerRules headers entries must be [name, value] string pairs";
|
|
194
193
|
}
|
|
195
194
|
}
|
|
195
|
+
if (manifest.alwaysUseHttps !== void 0 && typeof manifest.alwaysUseHttps !== "boolean") return "invalid manifest shape: alwaysUseHttps must be a boolean";
|
|
196
196
|
const redirectRulesError = validateRoutingRules(manifest.redirectRules, "redirectRules");
|
|
197
197
|
if (redirectRulesError) return redirectRulesError;
|
|
198
198
|
if (manifest.revalidateQueryAllowlist !== void 0) {
|
|
@@ -295,8 +295,7 @@ function validateManifestShape(manifest) {
|
|
|
295
295
|
function isLocalImageReference(image) {
|
|
296
296
|
return image.startsWith(".") || image.startsWith("/") || image.toLowerCase().includes("dockerfile");
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
//#region src/resource-plan.ts
|
|
298
|
+
// src/resource-plan.ts
|
|
300
299
|
/**
|
|
301
300
|
* Convert a deployment manifest into provider-neutral resource intent.
|
|
302
301
|
*
|
|
@@ -338,8 +337,7 @@ function createDeployResourcePlan(manifest) {
|
|
|
338
337
|
}
|
|
339
338
|
};
|
|
340
339
|
}
|
|
341
|
-
|
|
342
|
-
//#region src/intent.ts
|
|
340
|
+
// src/intent.ts
|
|
343
341
|
/**
|
|
344
342
|
* Interpret a manifest once before a target assigns provider names and ids.
|
|
345
343
|
* This function performs no I/O and does not mutate the manifest.
|
|
@@ -370,8 +368,7 @@ function createDeployIntent(manifest) {
|
|
|
370
368
|
}
|
|
371
369
|
};
|
|
372
370
|
}
|
|
373
|
-
|
|
374
|
-
//#region src/artifact.ts
|
|
371
|
+
// src/artifact.ts
|
|
375
372
|
const DEPLOY_ARTIFACT_VERSION = 1;
|
|
376
373
|
/** Build one target-neutral artifact before either target adds provider state. */
|
|
377
374
|
function createDeployArtifact(input) {
|
|
@@ -403,8 +400,7 @@ function createDeployUploadPayload(artifact, metadata, workerInput) {
|
|
|
403
400
|
...metadata
|
|
404
401
|
};
|
|
405
402
|
}
|
|
406
|
-
|
|
407
|
-
//#region src/canonical-json.ts
|
|
403
|
+
// src/canonical-json.ts
|
|
408
404
|
function canonicalJson(value) {
|
|
409
405
|
if (value === null) return "null";
|
|
410
406
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return JSON.stringify(value);
|
|
@@ -415,8 +411,7 @@ function canonicalJson(value) {
|
|
|
415
411
|
}
|
|
416
412
|
throw new TypeError(`Unsupported canonical JSON value: ${typeof value}`);
|
|
417
413
|
}
|
|
418
|
-
|
|
419
|
-
//#region src/artifact-digest.ts
|
|
414
|
+
// src/artifact-digest.ts
|
|
420
415
|
/** Commit to all executable bytes, asset hashes, bindings, migrations, and routing. */
|
|
421
416
|
async function deployArtifactDigest(artifact) {
|
|
422
417
|
const host = globalThis;
|
|
@@ -428,8 +423,7 @@ async function deployArtifactDigest(artifact) {
|
|
|
428
423
|
const bytes = await host.crypto.subtle.digest("SHA-256", new host.TextEncoder().encode(data));
|
|
429
424
|
return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
430
425
|
}
|
|
431
|
-
|
|
432
|
-
//#region src/sql-tokenize.ts
|
|
426
|
+
// src/sql-tokenize.ts
|
|
433
427
|
function* tokenizeSql(sql) {
|
|
434
428
|
const sqlLength = sql.length;
|
|
435
429
|
let index = 0;
|
|
@@ -528,8 +522,7 @@ function* tokenizeSql(sql) {
|
|
|
528
522
|
const tail = flushRun(sqlLength);
|
|
529
523
|
if (tail) yield tail;
|
|
530
524
|
}
|
|
531
|
-
|
|
532
|
-
//#region src/migration-plan.ts
|
|
525
|
+
// src/migration-plan.ts
|
|
533
526
|
const MIGRATION_CLASSIFIER_VERSION = 1;
|
|
534
527
|
const UNSPLIT_MULTI_STATEMENT_PRAGMA = "-- void:allow-unsplit-multi-statement";
|
|
535
528
|
function canonicalSql(sql) {
|
|
@@ -640,8 +633,7 @@ function getMigrationPlanHashInput(plan) {
|
|
|
640
633
|
if (plan.kind === "breakpoint-framed") base.statements = plan.statements;
|
|
641
634
|
return base;
|
|
642
635
|
}
|
|
643
|
-
|
|
644
|
-
//#region src/index.ts
|
|
636
|
+
// src/index.ts
|
|
645
637
|
const SUPPORTED_MANIFEST_VERSIONS = [3, 4];
|
|
646
638
|
/**
|
|
647
639
|
* Preserve an existing WebSocket class history while assigning every genuinely
|
|
@@ -720,5 +712,4 @@ function sameStringSet(a, b) {
|
|
|
720
712
|
function isSandboxRegistryImage(image) {
|
|
721
713
|
return /^registry\.cloudflare\.com\/[^/@\s]+\/[^@\s]+@sha256:[a-f\d]{64}$/.test(image);
|
|
722
714
|
}
|
|
723
|
-
//#endregion
|
|
724
715
|
export { DEPLOY_ARTIFACT_VERSION, MANIFEST_REDIRECT_RULE_STATUSES, MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES, MAX_ROUTING_RULES, MIGRATION_CLASSIFIER_VERSION, SUPPORTED_MANIFEST_VERSIONS, UNSPLIT_MULTI_STATEMENT_PRAGMA, appendSqliteClassMigration, canonicalJson, canonicalSql, classifySqlMigration, createDeployArtifact, createDeployIntent, createDeployResourcePlan, createDeployUploadPayload, deployArtifactDigest, getMigrationPlanHashInput, hasStandalonePragma, isRecord, isSandboxRegistryImage, isSingleStatement, planWebSocketMigrations, splitSqlStatements, tokenizeSql, validateManifestShape };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/deploy-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Shared deployment contracts, manifests, and resource plans for Void.",
|
|
5
5
|
"homepage": "https://void.cloud",
|
|
6
6
|
"bugs": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"typescript": "7.0.2",
|
|
30
|
-
"vite-plus": "1.
|
|
30
|
+
"vite-plus": "1.4.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "vp pack",
|