@void/deploy-core 0.28.0 → 1.1.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 +13 -0
- package/dist/index.mjs +29 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -394,6 +394,18 @@ export type LiveManifestMeta = {
|
|
|
394
394
|
classes: ReadonlyArray<string>;
|
|
395
395
|
migrations?: ReadonlyArray<LiveMigrationMeta>;
|
|
396
396
|
};
|
|
397
|
+
export type DurableObjectManifestMeta = {
|
|
398
|
+
bindings: ReadonlyArray<{
|
|
399
|
+
bindingName: string;
|
|
400
|
+
className: string;
|
|
401
|
+
storage: "sqlite";
|
|
402
|
+
}>;
|
|
403
|
+
/** Verified by the platform; never accepted from a deployment client. */
|
|
404
|
+
runtime?: {
|
|
405
|
+
protocol: 1;
|
|
406
|
+
namespaces: Record<string, string>;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
397
409
|
export type DeployManifest = {
|
|
398
410
|
version: number;
|
|
399
411
|
assetManifestVersion?: 1 | 2;
|
|
@@ -445,6 +457,7 @@ export type DeployManifest = {
|
|
|
445
457
|
websocket?: WebSocketManifestMeta;
|
|
446
458
|
sandbox?: SandboxManifestMeta;
|
|
447
459
|
live?: LiveManifestMeta;
|
|
460
|
+
durableObjects?: DurableObjectManifestMeta;
|
|
448
461
|
};
|
|
449
462
|
export type DeployEvent = {
|
|
450
463
|
event: "start";
|
package/dist/index.mjs
CHANGED
|
@@ -262,6 +262,34 @@ function validateManifestShape(manifest) {
|
|
|
262
262
|
const migrationsError = validateClassMigrations("live.migrations", live.migrations, ["newSqliteClasses"]);
|
|
263
263
|
if (migrationsError) return migrationsError;
|
|
264
264
|
}
|
|
265
|
+
if (manifest.durableObjects !== void 0) {
|
|
266
|
+
const durable = manifest.durableObjects;
|
|
267
|
+
if (manifest.version !== 4 || !isRecord(durable) || !Array.isArray(durable.bindings)) return "invalid manifest shape: durableObjects requires manifest version 4 and a bindings array";
|
|
268
|
+
if (durable.bindings.length > 32) return "invalid manifest shape: at most 32 custom Durable Objects are supported";
|
|
269
|
+
const names = /* @__PURE__ */ new Set();
|
|
270
|
+
const classes = /* @__PURE__ */ new Set();
|
|
271
|
+
const otherBindings = /* @__PURE__ */ new Set([
|
|
272
|
+
...Object.values(bindings).filter(Array.isArray).flat(),
|
|
273
|
+
...Object.keys(isRecord(manifest.vars) ? manifest.vars : {}),
|
|
274
|
+
...Array.isArray(manifest.queues) ? manifest.queues.map((q) => q.bindingName) : [],
|
|
275
|
+
...isRecord(manifest.websocket) && Array.isArray(manifest.websocket.routes) ? manifest.websocket.routes.map((r) => r.bindingName ?? r.className) : [],
|
|
276
|
+
...isRecord(manifest.live) ? [manifest.live.bindingName] : []
|
|
277
|
+
]);
|
|
278
|
+
for (const binding of durable.bindings) {
|
|
279
|
+
if (!isRecord(binding) || Object.keys(binding).some((key) => ![
|
|
280
|
+
"bindingName",
|
|
281
|
+
"className",
|
|
282
|
+
"storage"
|
|
283
|
+
].includes(key)) || typeof binding.bindingName !== "string" || !/^[A-Za-z_$][\w$]{0,127}$/.test(binding.bindingName) || binding.bindingName.startsWith("__") || [
|
|
284
|
+
"ASSETS",
|
|
285
|
+
"SEND_EMAIL",
|
|
286
|
+
"USAGE_EVENTS_QUEUE"
|
|
287
|
+
].includes(binding.bindingName) || typeof binding.className !== "string" || !/^[A-Za-z_$][\w$]{0,127}$/.test(binding.className) || binding.storage !== "sqlite") return "invalid manifest shape: custom Durable Objects require local SQLite classes and valid binding names";
|
|
288
|
+
if (names.has(binding.bindingName) || classes.has(binding.className) || otherBindings.has(binding.bindingName)) return "invalid manifest shape: custom Durable Object bindings and classes must be unique";
|
|
289
|
+
names.add(binding.bindingName);
|
|
290
|
+
classes.add(binding.className);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
265
293
|
return null;
|
|
266
294
|
}
|
|
267
295
|
function isLocalImageReference(image) {
|
|
@@ -605,7 +633,7 @@ function getMigrationPlanHashInput(plan) {
|
|
|
605
633
|
}
|
|
606
634
|
//#endregion
|
|
607
635
|
//#region src/index.ts
|
|
608
|
-
const SUPPORTED_MANIFEST_VERSIONS = [3];
|
|
636
|
+
const SUPPORTED_MANIFEST_VERSIONS = [3, 4];
|
|
609
637
|
/**
|
|
610
638
|
* Preserve an existing WebSocket class history while assigning every genuinely
|
|
611
639
|
* new class to SQLite-backed Durable Object storage.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/deploy-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.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.2.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "vp pack",
|