@hyperframes/gcp-cloud-run 0.7.110 → 0.7.111
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/README.md +17 -4
- package/dist/events.d.ts +10 -10
- package/dist/events.d.ts.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/renderToCloudRun.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -13
- package/dist/server.js.map +2 -2
- package/package.json +2 -2
- package/terraform/smoke-safety.test.ts +2 -2
- package/terraform/workflow.test.ts +2 -2
- package/terraform/workflow.yaml +3 -3
package/README.md
CHANGED
|
@@ -45,14 +45,13 @@ per-step durations on success.
|
|
|
45
45
|
|
|
46
46
|
### Plan transport selection
|
|
47
47
|
|
|
48
|
-
Plan v2 is
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
Plan v2 is the default for new renders. When `planProtocol` is omitted,
|
|
49
|
+
`renderToCloudRun` sends an explicit `PlanProtocol: "v2"` so the SDK and
|
|
50
|
+
the deployed workflow agree:
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
53
|
await renderToCloudRun({
|
|
54
54
|
// ...project, bucket, workflow, service, and config...
|
|
55
|
-
planProtocol: "v2",
|
|
56
55
|
});
|
|
57
56
|
```
|
|
58
57
|
|
|
@@ -60,6 +59,20 @@ V2 uses separate manifest and content-addressed artifact locators throughout
|
|
|
60
59
|
the workflow. Unknown protocols and integrity failures fail closed; a render
|
|
61
60
|
never mixes v1 and v2 artifacts.
|
|
62
61
|
|
|
62
|
+
The monolithic v1 transport remains available as deprecated compatibility by
|
|
63
|
+
passing `planProtocol: "v1"` explicitly.
|
|
64
|
+
|
|
65
|
+
#### Upgrade order
|
|
66
|
+
|
|
67
|
+
Redeploy the Cloud Run image and Cloud Workflows definition from the same new
|
|
68
|
+
package version before upgrading an application that calls
|
|
69
|
+
`renderToCloudRun`. Pause new renders and drain active workflow executions
|
|
70
|
+
during the infrastructure update. Older workflows can default omission to v1
|
|
71
|
+
or lack the v2 branch, while the new SDK sends explicit v2. If infrastructure
|
|
72
|
+
cannot be redeployed first, keep the previous SDK version or pass
|
|
73
|
+
`planProtocol: "v1"` explicitly until the Terraform/workflow redeploy is
|
|
74
|
+
complete.
|
|
75
|
+
|
|
63
76
|
## Chrome runtime
|
|
64
77
|
|
|
65
78
|
Unlike the Lambda adapter — which fights a 250 MB ZIP ceiling and
|
package/dist/events.d.ts
CHANGED
|
@@ -51,16 +51,16 @@ interface PlanEventBase {
|
|
|
51
51
|
Config: SerializableDistributedRenderConfig;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Legacy
|
|
54
|
+
* Legacy plan transport. Callers must select it explicitly.
|
|
55
55
|
*
|
|
56
56
|
* @deprecated Use {@link PlanV2Event} for new integrations.
|
|
57
57
|
*/
|
|
58
58
|
export interface PlanV1Event extends PlanEventBase {
|
|
59
|
-
PlanProtocol
|
|
59
|
+
PlanProtocol: "v1";
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
61
|
+
/** Default content-addressed v2 plan transport. */
|
|
62
62
|
export interface PlanV2Event extends PlanEventBase {
|
|
63
|
-
PlanProtocol
|
|
63
|
+
PlanProtocol?: "v2";
|
|
64
64
|
}
|
|
65
65
|
export type PlanEvent = PlanV1Event | PlanV2Event;
|
|
66
66
|
/** Activity B: fetch planDir, render one chunk, upload result. */
|
|
@@ -82,12 +82,12 @@ interface RenderChunkEventBase {
|
|
|
82
82
|
Format: DistributedFormat;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Legacy
|
|
85
|
+
* Legacy chunk event. Callers must select it explicitly.
|
|
86
86
|
*
|
|
87
87
|
* @deprecated Use {@link RenderChunkV2Event} for new integrations.
|
|
88
88
|
*/
|
|
89
89
|
export interface RenderChunkV1Event extends RenderChunkEventBase {
|
|
90
|
-
PlanProtocol
|
|
90
|
+
PlanProtocol: "v1";
|
|
91
91
|
/** GCS URI of the v1 plan tar produced by a PlanEvent invocation. */
|
|
92
92
|
PlanGcsUri: string;
|
|
93
93
|
PlanV2ManifestGcsUri?: never;
|
|
@@ -98,7 +98,7 @@ export interface RenderChunkV1Event extends RenderChunkEventBase {
|
|
|
98
98
|
* describes the exact content-addressed artifacts needed by this chunk.
|
|
99
99
|
*/
|
|
100
100
|
export interface RenderChunkV2Event extends RenderChunkEventBase {
|
|
101
|
-
PlanProtocol
|
|
101
|
+
PlanProtocol?: "v2";
|
|
102
102
|
PlanV2ManifestGcsUri: string;
|
|
103
103
|
PlanV2ArtifactGcsPrefix: string;
|
|
104
104
|
PlanGcsUri?: never;
|
|
@@ -125,12 +125,12 @@ interface AssembleEventBase {
|
|
|
125
125
|
Cfr?: boolean;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Legacy
|
|
128
|
+
* Legacy assemble event. Callers must select it explicitly.
|
|
129
129
|
*
|
|
130
130
|
* @deprecated Use {@link AssembleV2Event} for new integrations.
|
|
131
131
|
*/
|
|
132
132
|
export interface AssembleV1Event extends AssembleEventBase {
|
|
133
|
-
PlanProtocol
|
|
133
|
+
PlanProtocol: "v1";
|
|
134
134
|
/** GCS URI of the v1 plan tar produced by a PlanEvent invocation. */
|
|
135
135
|
PlanGcsUri: string;
|
|
136
136
|
/** Legacy standalone audio locator; `null` when audio is embedded in the v1 plan tar. */
|
|
@@ -140,7 +140,7 @@ export interface AssembleV1Event extends AssembleEventBase {
|
|
|
140
140
|
}
|
|
141
141
|
/** V2 assemble event, scoped to manifest-declared assembler artifacts. */
|
|
142
142
|
export interface AssembleV2Event extends AssembleEventBase {
|
|
143
|
-
PlanProtocol
|
|
143
|
+
PlanProtocol?: "v2";
|
|
144
144
|
PlanV2ManifestGcsUri: string;
|
|
145
145
|
PlanV2ArtifactGcsPrefix: string;
|
|
146
146
|
PlanHash: string;
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,mCAAmC,EACpC,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EAAE,mCAAmC,EAAE,MAAM,mCAAmC,CAAC;AAE7F,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,UAAU,CAAC;AACjE,uEAAuE;AACvE,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1B;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,CAAC;AAE7B,oDAAoD;AACpD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,MAAM,EAAE,mCAAmC,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,YAAY,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,mCAAmC,EACpC,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EAAE,mCAAmC,EAAE,MAAM,mCAAmC,CAAC;AAE7F,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,UAAU,CAAC;AACjE,uEAAuE;AACvE,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,C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AAED,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,qBAAqB,GAAG,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -388,18 +388,19 @@ function validatePlanProtocolShape(event) {
|
|
|
388
388
|
throw error;
|
|
389
389
|
}
|
|
390
390
|
if (event.Action === "plan") return;
|
|
391
|
+
const effectiveProtocol = protocol ?? "v2";
|
|
391
392
|
const hasV1Locator = typeof raw.PlanGcsUri === "string";
|
|
392
393
|
const hasV2Manifest = typeof raw.PlanV2ManifestGcsUri === "string";
|
|
393
394
|
const hasV2Prefix = typeof raw.PlanV2ArtifactGcsPrefix === "string";
|
|
394
|
-
const valid =
|
|
395
|
+
const valid = effectiveProtocol === "v2" ? !hasV1Locator && hasV2Manifest && hasV2Prefix : hasV1Locator && !hasV2Manifest && !hasV2Prefix;
|
|
395
396
|
if (!valid) {
|
|
396
397
|
const error = new Error(
|
|
397
|
-
`[handler] ${
|
|
398
|
+
`[handler] ${effectiveProtocol} ${event.Action} event has mixed or missing plan locators`
|
|
398
399
|
);
|
|
399
400
|
error.name = "PLAN_PROTOCOL_UNSUPPORTED";
|
|
400
401
|
throw error;
|
|
401
402
|
}
|
|
402
|
-
if (
|
|
403
|
+
if (effectiveProtocol === "v2" && event.Action === "assemble" && event.AudioGcsUri !== null) {
|
|
403
404
|
const error = new Error("[handler] v2 assemble audio must be materialized from the manifest");
|
|
404
405
|
error.name = "PLAN_PROTOCOL_UNSUPPORTED";
|
|
405
406
|
throw error;
|
|
@@ -448,21 +449,21 @@ function summarizeEvent(event) {
|
|
|
448
449
|
return {
|
|
449
450
|
projectGcsUri: event.ProjectGcsUri,
|
|
450
451
|
planOutputGcsPrefix: event.PlanOutputGcsPrefix,
|
|
451
|
-
planProtocol: event.PlanProtocol ?? "
|
|
452
|
+
planProtocol: event.PlanProtocol ?? "v2",
|
|
452
453
|
format: event.Config.format,
|
|
453
454
|
fps: event.Config.fps
|
|
454
455
|
};
|
|
455
456
|
case "renderChunk":
|
|
456
457
|
return {
|
|
457
|
-
planProtocol: event.PlanProtocol ?? "
|
|
458
|
-
...event.PlanProtocol
|
|
458
|
+
planProtocol: event.PlanProtocol ?? "v2",
|
|
459
|
+
...event.PlanProtocol !== "v1" ? { planV2ManifestGcsUri: event.PlanV2ManifestGcsUri } : { planGcsUri: event.PlanGcsUri },
|
|
459
460
|
chunkIndex: event.ChunkIndex,
|
|
460
461
|
format: event.Format
|
|
461
462
|
};
|
|
462
463
|
case "assemble":
|
|
463
464
|
return {
|
|
464
|
-
planProtocol: event.PlanProtocol ?? "
|
|
465
|
-
...event.PlanProtocol
|
|
465
|
+
planProtocol: event.PlanProtocol ?? "v2",
|
|
466
|
+
...event.PlanProtocol !== "v1" ? { planV2ManifestGcsUri: event.PlanV2ManifestGcsUri } : { planGcsUri: event.PlanGcsUri },
|
|
466
467
|
chunkCount: event.ChunkGcsUris.length,
|
|
467
468
|
hasAudio: event.AudioGcsUri !== null,
|
|
468
469
|
outputGcsUri: event.OutputGcsUri,
|
|
@@ -476,7 +477,7 @@ function primeChrome(deps) {
|
|
|
476
477
|
process.env.PRODUCER_HEADLESS_SHELL_PATH = resolveChromeExecutablePath();
|
|
477
478
|
}
|
|
478
479
|
async function handlePlan(event, deps) {
|
|
479
|
-
if (event.PlanProtocol
|
|
480
|
+
if (event.PlanProtocol !== "v1") {
|
|
480
481
|
return handlePlanV2(event, deps);
|
|
481
482
|
}
|
|
482
483
|
const started = Date.now();
|
|
@@ -562,7 +563,7 @@ async function handlePlanV2(event, deps) {
|
|
|
562
563
|
}
|
|
563
564
|
}
|
|
564
565
|
async function handleRenderChunk(event, deps) {
|
|
565
|
-
if (event.PlanProtocol
|
|
566
|
+
if (event.PlanProtocol !== "v1") {
|
|
566
567
|
return handleRenderChunkV2(event, deps);
|
|
567
568
|
}
|
|
568
569
|
const started = Date.now();
|
|
@@ -652,7 +653,7 @@ async function uploadChunkOutput(storage, result, prefix, chunkIndex) {
|
|
|
652
653
|
return uri;
|
|
653
654
|
}
|
|
654
655
|
async function handleAssemble(event, deps) {
|
|
655
|
-
if (event.PlanProtocol
|
|
656
|
+
if (event.PlanProtocol !== "v1") {
|
|
656
657
|
return handleAssembleV2(event, deps);
|
|
657
658
|
}
|
|
658
659
|
const started = Date.now();
|
|
@@ -814,10 +815,10 @@ function getEventGcsUris(event) {
|
|
|
814
815
|
case "plan":
|
|
815
816
|
return [event.ProjectGcsUri, event.PlanOutputGcsPrefix];
|
|
816
817
|
case "renderChunk":
|
|
817
|
-
return event.PlanProtocol
|
|
818
|
+
return event.PlanProtocol !== "v1" ? [event.PlanV2ManifestGcsUri, event.PlanV2ArtifactGcsPrefix, event.ChunkOutputGcsPrefix] : [event.PlanGcsUri, event.ChunkOutputGcsPrefix];
|
|
818
819
|
case "assemble":
|
|
819
820
|
return [
|
|
820
|
-
...event.PlanProtocol
|
|
821
|
+
...event.PlanProtocol !== "v1" ? [event.PlanV2ManifestGcsUri, event.PlanV2ArtifactGcsPrefix] : [event.PlanGcsUri],
|
|
821
822
|
...event.ChunkGcsUris,
|
|
822
823
|
event.OutputGcsUri,
|
|
823
824
|
event.AudioGcsUri
|
|
@@ -1071,7 +1072,7 @@ async function renderToCloudRun(opts) {
|
|
|
1071
1072
|
OutputGcsUri: outputGcsUri,
|
|
1072
1073
|
ServiceUrl: opts.serviceUrl,
|
|
1073
1074
|
Config: opts.config,
|
|
1074
|
-
PlanProtocol: opts.planProtocol ?? "
|
|
1075
|
+
PlanProtocol: opts.planProtocol ?? "v2"
|
|
1075
1076
|
};
|
|
1076
1077
|
validateWorkflowsInputSize(argument);
|
|
1077
1078
|
const executions = opts.executions ?? await defaultExecutionsClient();
|