@wtfalch/foundry 0.52.0 → 0.53.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/plan/executor.js
CHANGED
|
@@ -1092,7 +1092,9 @@ export class FoundryStepExecutor {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
async execute(action, context) {
|
|
1094
1094
|
const { org } = context;
|
|
1095
|
-
|
|
1095
|
+
// The Worker app database uses only platform ports, and its backup needs the files host's
|
|
1096
|
+
// bucket and key ports, which the scoped copy drops with `ownServices` (foundry#878).
|
|
1097
|
+
if (ownsServices(org) && !action.kind.startsWith('own-') && action.kind !== 'worker-app-db') {
|
|
1096
1098
|
return this.executeScoped(action, context);
|
|
1097
1099
|
}
|
|
1098
1100
|
return this.run(action, context);
|
|
@@ -105,6 +105,8 @@ export interface WorkerAppUpload {
|
|
|
105
105
|
bindings: WorkerAppBinding[];
|
|
106
106
|
/** Only the migrations not yet applied; absent when there are none. */
|
|
107
107
|
migrations?: WorkerAppMigrations;
|
|
108
|
+
/** Durable Object classes the upload marks container-enabled; absent when the entry declares no container. */
|
|
109
|
+
containers?: string[];
|
|
108
110
|
}
|
|
109
111
|
export interface WorkerAppContainer {
|
|
110
112
|
className: string;
|
|
@@ -299,7 +301,7 @@ export interface WorkerAppDeps {
|
|
|
299
301
|
export declare const WORKER_APP_CALL_TIMEOUT_MS = 120000;
|
|
300
302
|
export declare const WORKER_APP_KEYS_DELIVERY_ATTEMPTS = 3;
|
|
301
303
|
/**
|
|
302
|
-
* Races `task` against a timer. An error names the call, never the cause.
|
|
304
|
+
* Races `task` against a timer. An error names the call and edge's error code, never the cause.
|
|
303
305
|
*/
|
|
304
306
|
export declare function withCallTimeout<T>(ms: number, label: string, task: () => Promise<T>): Promise<T>;
|
|
305
307
|
/**
|
package/dist/plan/worker-app.js
CHANGED
|
@@ -400,7 +400,7 @@ export function planWorkerApps(org, recordedIds, input) {
|
|
|
400
400
|
export const WORKER_APP_CALL_TIMEOUT_MS = 120_000;
|
|
401
401
|
export const WORKER_APP_KEYS_DELIVERY_ATTEMPTS = 3;
|
|
402
402
|
/**
|
|
403
|
-
* Races `task` against a timer. An error names the call, never the cause.
|
|
403
|
+
* Races `task` against a timer. An error names the call and edge's error code, never the cause.
|
|
404
404
|
*/
|
|
405
405
|
export function withCallTimeout(ms, label, task) {
|
|
406
406
|
return new Promise((resolve, reject) => {
|
|
@@ -411,11 +411,15 @@ export function withCallTimeout(ms, label, task) {
|
|
|
411
411
|
}, (error) => {
|
|
412
412
|
clearTimeout(timer);
|
|
413
413
|
// The cause is dropped: a provider error can echo a request body. The
|
|
414
|
-
// HTTP status stays, because callers tell "already gone" by it.
|
|
415
|
-
|
|
416
|
-
const status = error
|
|
414
|
+
// HTTP status stays, because callers tell "already gone" by it. So does
|
|
415
|
+
// edge's error code (a fixed lower-case enum, never a secret), to say why.
|
|
416
|
+
const { status, code } = (error ?? {});
|
|
417
|
+
const known = typeof code === 'string' && /^[a-z_]{1,40}$/.test(code) ? code : undefined;
|
|
418
|
+
const failure = new Error(known ? `${label} failed (${known})` : `${label} failed`);
|
|
417
419
|
if (typeof status === 'number')
|
|
418
420
|
failure.status = status;
|
|
421
|
+
if (known)
|
|
422
|
+
failure.code = known;
|
|
419
423
|
reject(failure);
|
|
420
424
|
});
|
|
421
425
|
});
|
|
@@ -523,6 +527,9 @@ export async function applyWorkerApp(deps, org, action, context) {
|
|
|
523
527
|
: []),
|
|
524
528
|
],
|
|
525
529
|
...(migrations ? { migrations } : {}),
|
|
530
|
+
...(want.containers.length > 0
|
|
531
|
+
? { containers: want.containers.map((c) => c.className) }
|
|
532
|
+
: {}),
|
|
526
533
|
}));
|
|
527
534
|
context.recordScopeId(workerAppTagsScopeKey(entryKey), JSON.stringify(declaredTags));
|
|
528
535
|
await context.persistScopeIds();
|