@wtfalch/foundry 0.52.1 → 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.
@@ -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
  /**
@@ -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
- const failure = new Error(`${label} failed`);
416
- const status = error?.status;
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.52.1",
3
+ "version": "0.53.0",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",