@void/deploy-core 1.9.1 → 1.11.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 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;
@@ -9,6 +15,7 @@ export declare function validateManifestShape(manifest: unknown): string | null;
9
15
  type DeployResource = {
10
16
  type: "d1";
11
17
  bindingName: string;
18
+ readReplication?: boolean;
12
19
  } | {
13
20
  type: "kv";
14
21
  bindingName: string;
@@ -297,6 +304,7 @@ export type QueueMeta = {
297
304
  bindingName: string;
298
305
  maxBatchSize?: number;
299
306
  maxBatchTimeout?: number;
307
+ maxConcurrency?: number;
300
308
  maxRetries?: number;
301
309
  retryDelay?: number;
302
310
  };
@@ -424,6 +432,12 @@ export type DurableObjectManifestMeta = {
424
432
  };
425
433
  export type DeployManifest = {
426
434
  version: number;
435
+ /** D1 provisioning preferences. Omitted preserves existing replication; false disables it. */
436
+ database?: {
437
+ readReplication?: boolean;
438
+ };
439
+ /** R2 creation preferences. Requires manifest version 5. */
440
+ storage?: StorageConfig;
427
441
  assetManifestVersion?: 1 | 2;
428
442
  /** Authenticated framed HTTP delivery for managed inbound email. */
429
443
  emailProtocolVersion?: 1;
@@ -544,4 +558,4 @@ export type DeployEvent = {
544
558
  message: string;
545
559
  step: string;
546
560
  };
547
- export type { DeployAppType, DeployArtifact, DeployAssetManifestEntry, DeployAssetUploadRequest, DeployCapabilitySupport, DeployIntent, DeployResource, DeployResourcePlan, DeployRuntimeFeatures, DeploySourceMetadata, DeployTarget, DeployTargetAdapter, DeployTargetCapabilities, DeployUploadPayload, DeployWorkerInput, DeployWorkerModule, DeployWorkerUploadRequest, DeployWorkerUploadResponse, MigrationPlanHashInput, SqlMigrationClassification, SqlSegment };
561
+ 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,10 +79,18 @@ 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";
73
89
  const bindings = manifest.bindings;
90
+ if (manifest.database !== void 0) {
91
+ if (!isRecord(manifest.database) || Object.keys(manifest.database).some((key) => key !== "readReplication") || manifest.database.readReplication !== void 0 && typeof manifest.database.readReplication !== "boolean") return "invalid manifest shape: database.readReplication must be a boolean";
92
+ if (!Array.isArray(bindings.d1) || bindings.d1.length === 0) return "invalid manifest shape: database requires a D1 binding";
93
+ }
74
94
  for (const key of [
75
95
  "d1",
76
96
  "kv",
@@ -86,6 +106,7 @@ function validateManifestShape(manifest) {
86
106
  for (const queue of manifest.queues) {
87
107
  if (!isRecord(queue)) return "invalid manifest shape: queues entries must be objects";
88
108
  if (typeof queue.name !== "string" || typeof queue.bindingName !== "string") return "invalid manifest shape: queues entries must have string name and bindingName";
109
+ 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
110
  for (const tuning of [
90
111
  "maxBatchSize",
91
112
  "maxBatchTimeout",
@@ -265,7 +286,7 @@ function validateManifestShape(manifest) {
265
286
  }
266
287
  if (manifest.durableObjects !== void 0) {
267
288
  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";
289
+ 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
290
  if (durable.bindings.length > 32) return "invalid manifest shape: at most 32 custom Durable Objects are supported";
270
291
  const names = /* @__PURE__ */ new Set();
271
292
  const classes = /* @__PURE__ */ new Set();
@@ -307,7 +328,8 @@ function createDeployResourcePlan(manifest) {
307
328
  const resources = [];
308
329
  for (const bindingName of manifest.bindings.d1 ?? []) resources.push({
309
330
  type: "d1",
310
- bindingName
331
+ bindingName,
332
+ ...manifest.database?.readReplication !== void 0 && { readReplication: manifest.database.readReplication }
311
333
  });
312
334
  for (const bindingName of manifest.bindings.kv ?? []) resources.push({
313
335
  type: "kv",
@@ -635,7 +657,11 @@ function getMigrationPlanHashInput(plan) {
635
657
  return base;
636
658
  }
637
659
  // src/index.ts
638
- const SUPPORTED_MANIFEST_VERSIONS = [3, 4];
660
+ const SUPPORTED_MANIFEST_VERSIONS = [
661
+ 3,
662
+ 4,
663
+ 5
664
+ ];
639
665
  /**
640
666
  * Preserve an existing WebSocket class history while assigning every genuinely
641
667
  * new class to SQLite-backed Durable Object storage.
@@ -713,4 +739,4 @@ function sameStringSet(a, b) {
713
739
  function isSandboxRegistryImage(image) {
714
740
  return /^registry\.cloudflare\.com\/[^/@\s]+\/[^@\s]+@sha256:[a-f\d]{64}$/.test(image);
715
741
  }
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 };
742
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-core",
3
- "version": "1.9.1",
3
+ "version": "1.11.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.6.0"
30
+ "vite-plus": "1.7.0"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "vp pack",