@void/deploy-core 1.9.1 → 1.10.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 +10 -1
- package/dist/index.mjs +24 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export declare const R2_LOCATION_HINTS: readonly ["apac", "eeur", "enam", "weur", "wnam", "oc"];
|
|
2
|
+
type R2LocationHint = (typeof R2_LOCATION_HINTS)[number];
|
|
3
|
+
type StorageConfig = {
|
|
4
|
+
locationHint?: R2LocationHint;
|
|
5
|
+
};
|
|
6
|
+
export declare function isR2LocationHint(value: unknown): value is R2LocationHint;
|
|
1
7
|
export declare const MANIFEST_REDIRECT_RULE_STATUSES: ReadonlySet<number>;
|
|
2
8
|
export declare const MAX_ROUTING_RULES = 2e3;
|
|
3
9
|
export declare const MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES: number;
|
|
@@ -297,6 +303,7 @@ export type QueueMeta = {
|
|
|
297
303
|
bindingName: string;
|
|
298
304
|
maxBatchSize?: number;
|
|
299
305
|
maxBatchTimeout?: number;
|
|
306
|
+
maxConcurrency?: number;
|
|
300
307
|
maxRetries?: number;
|
|
301
308
|
retryDelay?: number;
|
|
302
309
|
};
|
|
@@ -424,6 +431,8 @@ export type DurableObjectManifestMeta = {
|
|
|
424
431
|
};
|
|
425
432
|
export type DeployManifest = {
|
|
426
433
|
version: number;
|
|
434
|
+
/** R2 creation preferences. Requires manifest version 5. */
|
|
435
|
+
storage?: StorageConfig;
|
|
427
436
|
assetManifestVersion?: 1 | 2;
|
|
428
437
|
/** Authenticated framed HTTP delivery for managed inbound email. */
|
|
429
438
|
emailProtocolVersion?: 1;
|
|
@@ -544,4 +553,4 @@ export type DeployEvent = {
|
|
|
544
553
|
message: string;
|
|
545
554
|
step: string;
|
|
546
555
|
};
|
|
547
|
-
export type { DeployAppType, DeployArtifact, DeployAssetManifestEntry, DeployAssetUploadRequest, DeployCapabilitySupport, DeployIntent, DeployResource, DeployResourcePlan, DeployRuntimeFeatures, DeploySourceMetadata, DeployTarget, DeployTargetAdapter, DeployTargetCapabilities, DeployUploadPayload, DeployWorkerInput, DeployWorkerModule, DeployWorkerUploadRequest, DeployWorkerUploadResponse, MigrationPlanHashInput, SqlMigrationClassification, SqlSegment };
|
|
556
|
+
export type { DeployAppType, DeployArtifact, DeployAssetManifestEntry, DeployAssetUploadRequest, DeployCapabilitySupport, DeployIntent, DeployResource, DeployResourcePlan, DeployRuntimeFeatures, DeploySourceMetadata, DeployTarget, DeployTargetAdapter, DeployTargetCapabilities, DeployUploadPayload, DeployWorkerInput, DeployWorkerModule, DeployWorkerUploadRequest, DeployWorkerUploadResponse, MigrationPlanHashInput, R2LocationHint, SqlMigrationClassification, SqlSegment, StorageConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// src/storage.ts
|
|
2
|
+
const R2_LOCATION_HINTS = [
|
|
3
|
+
"apac",
|
|
4
|
+
"eeur",
|
|
5
|
+
"enam",
|
|
6
|
+
"weur",
|
|
7
|
+
"wnam",
|
|
8
|
+
"oc"
|
|
9
|
+
];
|
|
10
|
+
function isR2LocationHint(value) {
|
|
11
|
+
return typeof value === "string" && R2_LOCATION_HINTS.some((hint) => hint === value);
|
|
12
|
+
}
|
|
1
13
|
// src/is-record.ts
|
|
2
14
|
/** Narrow object-shaped input without accepting null or arrays. */
|
|
3
15
|
function isRecord(value) {
|
|
@@ -67,6 +79,10 @@ function validateClassMigrations(path, migrations, fields, requireNonEmptyTag =
|
|
|
67
79
|
*/
|
|
68
80
|
function validateManifestShape(manifest) {
|
|
69
81
|
if (!isRecord(manifest)) return "invalid manifest shape: expected a JSON object";
|
|
82
|
+
if (manifest.storage !== void 0) {
|
|
83
|
+
if (manifest.version !== 5) return "invalid manifest shape: storage requires manifest version 5";
|
|
84
|
+
if (!isRecord(manifest.storage) || !isR2LocationHint(manifest.storage.locationHint) || Object.keys(manifest.storage).some((key) => key !== "locationHint")) return "invalid manifest shape: storage.locationHint must be a supported R2 location hint";
|
|
85
|
+
}
|
|
70
86
|
if (manifest.emailProtocolVersion !== void 0 && manifest.emailProtocolVersion !== 1) return "invalid manifest shape: emailProtocolVersion must be 1";
|
|
71
87
|
if (manifest.migrationMode !== void 0 && manifest.migrationMode !== "apply" && manifest.migrationMode !== "skip") return "invalid manifest shape: migrationMode must be apply or skip";
|
|
72
88
|
if (!isRecord(manifest.bindings)) return "invalid manifest shape: bindings must be an object";
|
|
@@ -86,6 +102,7 @@ function validateManifestShape(manifest) {
|
|
|
86
102
|
for (const queue of manifest.queues) {
|
|
87
103
|
if (!isRecord(queue)) return "invalid manifest shape: queues entries must be objects";
|
|
88
104
|
if (typeof queue.name !== "string" || typeof queue.bindingName !== "string") return "invalid manifest shape: queues entries must have string name and bindingName";
|
|
105
|
+
if (queue.maxConcurrency !== void 0 && (typeof queue.maxConcurrency !== "number" || !Number.isInteger(queue.maxConcurrency) || queue.maxConcurrency < 1 || queue.maxConcurrency > 250)) return "invalid manifest shape: queues entry maxConcurrency must be an integer between 1 and 250";
|
|
89
106
|
for (const tuning of [
|
|
90
107
|
"maxBatchSize",
|
|
91
108
|
"maxBatchTimeout",
|
|
@@ -265,7 +282,7 @@ function validateManifestShape(manifest) {
|
|
|
265
282
|
}
|
|
266
283
|
if (manifest.durableObjects !== void 0) {
|
|
267
284
|
const durable = manifest.durableObjects;
|
|
268
|
-
if (manifest.version !== 4 || !isRecord(durable) || !Array.isArray(durable.bindings)) return "invalid manifest shape: durableObjects requires manifest version 4 and a bindings array";
|
|
285
|
+
if (manifest.version !== 4 && manifest.version !== 5 || !isRecord(durable) || !Array.isArray(durable.bindings)) return "invalid manifest shape: durableObjects requires manifest version 4 and a bindings array";
|
|
269
286
|
if (durable.bindings.length > 32) return "invalid manifest shape: at most 32 custom Durable Objects are supported";
|
|
270
287
|
const names = /* @__PURE__ */ new Set();
|
|
271
288
|
const classes = /* @__PURE__ */ new Set();
|
|
@@ -635,7 +652,11 @@ function getMigrationPlanHashInput(plan) {
|
|
|
635
652
|
return base;
|
|
636
653
|
}
|
|
637
654
|
// src/index.ts
|
|
638
|
-
const SUPPORTED_MANIFEST_VERSIONS = [
|
|
655
|
+
const SUPPORTED_MANIFEST_VERSIONS = [
|
|
656
|
+
3,
|
|
657
|
+
4,
|
|
658
|
+
5
|
|
659
|
+
];
|
|
639
660
|
/**
|
|
640
661
|
* Preserve an existing WebSocket class history while assigning every genuinely
|
|
641
662
|
* new class to SQLite-backed Durable Object storage.
|
|
@@ -713,4 +734,4 @@ function sameStringSet(a, b) {
|
|
|
713
734
|
function isSandboxRegistryImage(image) {
|
|
714
735
|
return /^registry\.cloudflare\.com\/[^/@\s]+\/[^@\s]+@sha256:[a-f\d]{64}$/.test(image);
|
|
715
736
|
}
|
|
716
|
-
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 };
|
|
737
|
+
export { DEPLOY_ARTIFACT_VERSION, MANIFEST_REDIRECT_RULE_STATUSES, MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES, MAX_ROUTING_RULES, MIGRATION_CLASSIFIER_VERSION, R2_LOCATION_HINTS, SUPPORTED_MANIFEST_VERSIONS, UNSPLIT_MULTI_STATEMENT_PRAGMA, appendSqliteClassMigration, canonicalJson, canonicalSql, classifySqlMigration, createDeployArtifact, createDeployIntent, createDeployResourcePlan, createDeployUploadPayload, deployArtifactDigest, getMigrationPlanHashInput, hasStandalonePragma, isR2LocationHint, isRecord, isSandboxRegistryImage, isSingleStatement, planWebSocketMigrations, splitSqlStatements, tokenizeSql, validateManifestShape };
|