@wtfalch/foundry 0.78.0 → 0.78.1

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.
@@ -1262,6 +1262,7 @@ export declare const PLATFORM_USAGE_TAIL_SCRIPT_NAME = "platform-usage-tail";
1262
1262
  export declare const PLATFORM_USAGE_TAIL_KEY_REF = "usage-tail:worker:key";
1263
1263
  export declare const PLATFORM_USAGE_TAIL_KEY_UNDELIVERED_SCOPE_KEY = "usage_tail_key_undelivered";
1264
1264
  export declare const PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY = "usage_tail_key_set";
1265
+ export declare const PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY = "usage_tail_applied_url";
1265
1266
  export declare const PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY = "usage_tail_applied_tag";
1266
1267
  export declare const PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY = "usage_tail_applied_sha256";
1267
1268
  export declare const PLATFORM_USAGE_TAIL_REMOVED_SCOPE_KEY = "usage_tail_removed";
@@ -1461,6 +1461,7 @@ export const PLATFORM_USAGE_TAIL_SCRIPT_NAME = 'platform-usage-tail';
1461
1461
  export const PLATFORM_USAGE_TAIL_KEY_REF = 'usage-tail:worker:key';
1462
1462
  export const PLATFORM_USAGE_TAIL_KEY_UNDELIVERED_SCOPE_KEY = 'usage_tail_key_undelivered';
1463
1463
  export const PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY = 'usage_tail_key_set';
1464
+ export const PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY = 'usage_tail_applied_url';
1464
1465
  export const PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY = 'usage_tail_applied_tag';
1465
1466
  export const PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY = 'usage_tail_applied_sha256';
1466
1467
  export const PLATFORM_USAGE_TAIL_REMOVED_SCOPE_KEY = 'usage_tail_removed';
@@ -3488,12 +3489,17 @@ function planUsageTail(platform, recordedIds, executorBlocked, edgeApplied) {
3488
3489
  const applied = deployed &&
3489
3490
  Boolean(recordedIds[PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY]) &&
3490
3491
  recordedIds[PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY] === usageTail.tag &&
3491
- recordedIds[PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY] === usageTail.sha256;
3492
+ recordedIds[PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY] === usageTail.sha256 &&
3493
+ recordedIds[PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY] === `https://${platform.edge.hostname}`;
3492
3494
  if (applied)
3493
3495
  return { step: null, blocked: [] };
3494
3496
  return {
3495
3497
  step: {
3496
- action: action({ gitRef: usageTail.tag, sha256: usageTail.sha256 }),
3498
+ action: action({
3499
+ gitRef: usageTail.tag,
3500
+ sha256: usageTail.sha256,
3501
+ url: `https://${platform.edge.hostname}`,
3502
+ }),
3497
3503
  step: {
3498
3504
  description: `deploy the usage tail Worker ${PLATFORM_USAGE_TAIL_SCRIPT_NAME} from edge release ${usageTail.tag}, with its held key`,
3499
3505
  destroys: false,
@@ -1,6 +1,6 @@
1
1
  import { createHash, randomBytes } from 'node:crypto';
2
2
  import { usageTailArtifactUrl } from '../platform.js';
3
- import { PLATFORM_EDGE_INTERNAL_URL_SCOPE_KEY, PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY, PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY, PLATFORM_USAGE_TAIL_KEY, PLATFORM_USAGE_TAIL_KEY_REF, PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY, PLATFORM_USAGE_TAIL_KEY_UNDELIVERED_SCOPE_KEY, PLATFORM_USAGE_TAIL_REMOVED_SCOPE_KEY, PLATFORM_USAGE_TAIL_SCRIPT_NAME, } from './platform-diff.js';
3
+ import { PLATFORM_EDGE_INTERNAL_URL_SCOPE_KEY, PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY, PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY, PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY, PLATFORM_USAGE_TAIL_KEY, PLATFORM_USAGE_TAIL_KEY_REF, PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY, PLATFORM_USAGE_TAIL_KEY_UNDELIVERED_SCOPE_KEY, PLATFORM_USAGE_TAIL_REMOVED_SCOPE_KEY, PLATFORM_USAGE_TAIL_SCRIPT_NAME, } from './platform-diff.js';
4
4
  /** The date Cloudflare's Workers runtime compatibility is pinned to; no Workers feature here needs a later one. */
5
5
  const USAGE_TAIL_COMPATIBILITY_DATE = '2026-10-01';
6
6
  /**
@@ -28,6 +28,7 @@ export async function provisionPlatformUsageTail(context, deps) {
28
28
  PLATFORM_USAGE_TAIL_KEY_UNDELIVERED_SCOPE_KEY,
29
29
  PLATFORM_USAGE_TAIL_KEY_SET_SCOPE_KEY,
30
30
  PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY,
31
+ PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY,
31
32
  PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY,
32
33
  ]) {
33
34
  context.recordScopeId(key, '');
@@ -64,7 +65,9 @@ export async function provisionPlatformUsageTail(context, deps) {
64
65
  artifactUrl: usageTailArtifactUrl(usageTail.tag),
65
66
  artifactSha256: usageTail.sha256,
66
67
  compatibilityDate: USAGE_TAIL_COMPATIBILITY_DATE,
67
- bindings: [{ type: 'plain_text', name: 'EDGE_USAGE_URL', text: edgeUrl }],
68
+ bindings: [
69
+ { type: 'plain_text', name: 'EDGE_USAGE_URL', text: `https://${platform.edge.hostname}` },
70
+ ],
68
71
  });
69
72
  // The script is foundry's from here on. Recorded now, not at the end: after
70
73
  // a later failure the next plan must repair this Worker, not take it for a
@@ -84,6 +87,7 @@ export async function provisionPlatformUsageTail(context, deps) {
84
87
  // Last, after every write the applied values depend on.
85
88
  context.recordScopeId(PLATFORM_USAGE_TAIL_APPLIED_TAG_SCOPE_KEY, usageTail.tag);
86
89
  context.recordScopeId(PLATFORM_USAGE_TAIL_APPLIED_SHA256_SCOPE_KEY, usageTail.sha256);
90
+ context.recordScopeId(PLATFORM_USAGE_TAIL_APPLIED_URL_SCOPE_KEY, `https://${platform.edge.hostname}`);
87
91
  return { resourceId: PLATFORM_USAGE_TAIL_SCRIPT_NAME };
88
92
  }
89
93
  /** Rule 1: delivery is tried up to `deliverAttempts` times; the error names the ref only, never the cause. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.78.0",
3
+ "version": "0.78.1",
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",