@void/deploy-core 1.1.11 → 1.1.12

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
@@ -146,11 +146,42 @@ type DeploySourceMetadata = {
146
146
  commitUrl: string | null;
147
147
  gitRef: string | null;
148
148
  };
149
- /** JSON payload accepted by the managed deployment API. */
149
+ /** One Worker module uploaded to R2 before the deployment is finalized. */
150
+ type DeployWorkerModule = {
151
+ /** Module path relative to the Worker output, the same key `workerFiles` uses. */
152
+ name: string;
153
+ /** Byte length of the module. */
154
+ size: number;
155
+ /** SHA-256 of the module bytes as 64 lowercase hex characters. */
156
+ sha256: string;
157
+ };
158
+ /** Request body of `POST /projects/:id/deploy/worker-upload-urls`. */
159
+ type DeployWorkerUploadRequest = {
160
+ modules: Array<DeployWorkerModule>;
161
+ };
162
+ /** Upload URLs for each requested module, in request order. */
163
+ type DeployWorkerUploadResponse = {
164
+ id: string;
165
+ urls: Array<{
166
+ url: string;
167
+ headers: Record<string, string>;
168
+ }>;
169
+ };
170
+ /** Worker modules already uploaded through `worker-upload-urls`, named by its upload `id`. */
171
+ type DeployWorkerInput = {
172
+ id: string;
173
+ modules: Array<DeployWorkerModule>;
174
+ };
175
+ /**
176
+ * JSON payload accepted by the managed deployment API. Worker modules travel
177
+ * either inline as `workerFiles` or uploaded beforehand as `workerInput`,
178
+ * never both.
179
+ */
150
180
  type DeployUploadPayload = {
151
181
  manifest: DeployManifest;
152
182
  assetManifest: Record<string, DeployAssetManifestEntry>;
153
183
  workerFiles?: Record<string, string>;
184
+ workerInput?: DeployWorkerInput;
154
185
  } & DeploySourceMetadata & {
155
186
  preflight: "true" | null;
156
187
  };
@@ -167,10 +198,14 @@ export declare function createDeployArtifact(input: {
167
198
  assetManifest: Record<string, DeployAssetManifestEntry>;
168
199
  workerFiles?: Record<string, string>;
169
200
  }): DeployArtifact;
170
- /** Convert the canonical artifact into the stable hosted-platform wire shape. */
201
+ /**
202
+ * Convert the canonical artifact into the stable hosted-platform wire shape.
203
+ * Pass `workerInput` when the Worker modules were uploaded beforehand; the
204
+ * artifact must then carry no inline `workerFiles`.
205
+ */
171
206
  export declare function createDeployUploadPayload(artifact: DeployArtifact, metadata: DeploySourceMetadata & {
172
207
  preflight: "true" | null;
173
- }): DeployUploadPayload;
208
+ }, workerInput?: DeployWorkerInput): DeployUploadPayload;
174
209
  //#endregion
175
210
  //#region src/canonical-json.d.ts
176
211
  export declare function canonicalJson(value: unknown): string;
@@ -527,4 +562,4 @@ export type DeployEvent = {
527
562
  step: string;
528
563
  };
529
564
  //#endregion
530
- export type { DeployAppType, DeployArtifact, DeployAssetManifestEntry, DeployAssetUploadRequest, DeployCapabilitySupport, DeployIntent, DeployResource, DeployResourcePlan, DeployRuntimeFeatures, DeploySourceMetadata, DeployTarget, DeployTargetAdapter, DeployTargetCapabilities, DeployUploadPayload, MigrationPlanHashInput, SqlMigrationClassification, SqlSegment };
565
+ 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
@@ -382,8 +382,13 @@ function createDeployArtifact(input) {
382
382
  ...input.workerFiles && Object.keys(input.workerFiles).length > 0 ? { workerFiles: input.workerFiles } : {}
383
383
  };
384
384
  }
385
- /** Convert the canonical artifact into the stable hosted-platform wire shape. */
386
- function createDeployUploadPayload(artifact, metadata) {
385
+ /**
386
+ * Convert the canonical artifact into the stable hosted-platform wire shape.
387
+ * Pass `workerInput` when the Worker modules were uploaded beforehand; the
388
+ * artifact must then carry no inline `workerFiles`.
389
+ */
390
+ function createDeployUploadPayload(artifact, metadata, workerInput) {
391
+ if (workerInput && artifact.workerFiles) throw new Error("A deployment sends its Worker modules inline or as uploads, not both.");
387
392
  return {
388
393
  manifest: {
389
394
  ...artifact.manifest,
@@ -391,6 +396,10 @@ function createDeployUploadPayload(artifact, metadata) {
391
396
  },
392
397
  assetManifest: { ...artifact.assetManifest },
393
398
  ...artifact.workerFiles ? { workerFiles: { ...artifact.workerFiles } } : {},
399
+ ...workerInput ? { workerInput: {
400
+ id: workerInput.id,
401
+ modules: workerInput.modules.map((module) => ({ ...module }))
402
+ } } : {},
394
403
  ...metadata
395
404
  };
396
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-core",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Shared deployment contracts, manifests, and resource plans for Void.",
5
5
  "homepage": "https://void.cloud",
6
6
  "bugs": {