@assembly-js/app-foundation 0.3.7 → 0.3.8

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/CHANGELOG.md CHANGED
@@ -19,6 +19,9 @@ A patch release never changes what an app's build requires; a minor release may
19
19
  not by hand; see `changes/README.md`. CI fails a PR that changes a check script without a
20
20
  `bump: minor` change file.
21
21
 
22
+ ## 0.3.8
23
+ - [behavior] An app that calls a provider's inferred route now lists that provider in `.assembly/app-deps.json`.
24
+
22
25
  ## 0.3.7
23
26
  - [guidance] The `assembly-api-contract` skill now tells the build agent that every documented route must admit an app caller, so other apps' calls are not refused with a 403.
24
27
 
@@ -28,6 +28,9 @@ const VIA_CLIENT = 'client';
28
28
  // Lets a reader tell a file from a scanner that sees client calls from an older one that
29
29
  // would omit them, since both look the same when an app has none.
30
30
  const DETECTS = [VIA_PROXY_PATH, VIA_CLIENT];
31
+ const DETECTS_INFERRED_ROUTES = 'inferred-routes';
32
+ // `via` only ever names a detector that finds calls, so it stays on DETECTS.
33
+ const EMITTED_DETECTS = [...DETECTS, DETECTS_INFERRED_ROUTES];
31
34
  const CLIENT_SPECIFIER = /(?:^|\/)generated\/apps\/([^/]+)\/client(?:\.[jt]s)?$/;
32
35
  // The generated client's exports that make calls; its other exports (APP_ID, types) do not.
33
36
  const CLIENT_EXPORTS = new Set(['installerClient', 'viewerClient']);
@@ -237,7 +240,8 @@ function opsFor(provider, { template, method }) {
237
240
  const matched = (provider ?? []).filter((op) => templateMatches(op, template)).sort(bySpecificity(template));
238
241
  if (matched.length === 0) return (method ? [method] : PROXY_METHODS).map((m) => `${m} ${template}`);
239
242
  const winner = matched.filter((op) => op.template === matched[0].template);
240
- if (winner.every((op) => op.method === INFERRED_METHOD)) return [];
243
+ // An inferred route accepts any method, so the template is the dependency whether or not the call states one.
244
+ if (winner.every((op) => op.method === INFERRED_METHOD)) return [`${INFERRED_METHOD} ${winner[0].template}`];
241
245
  if (method) return [`${method} ${winner[0].template}`];
242
246
  return winner.filter((op) => op.method !== INFERRED_METHOD).map((op) => `${op.method} ${op.template}`);
243
247
  }
@@ -269,7 +273,7 @@ export function scanAppDeps(root, { loadTs = loadTypeScript } = {}) {
269
273
  apps[appId] = { ops: [...ops.get(appId)].sort(byteCompare), via: DETECTS.filter((v) => via.get(appId).has(v)) };
270
274
  }
271
275
  const hashes = hashFiles(root, files, contents);
272
- return { apps, detects: DETECTS, files: Object.fromEntries(files.map((f) => [f, hashes.get(f)])) };
276
+ return { apps, detects: EMITTED_DETECTS, files: Object.fromEntries(files.map((f) => [f, hashes.get(f)])) };
273
277
  }
274
278
 
275
279
  export const serializeAppDeps = (result) => JSON.stringify(result, null, 2) + '\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assembly-js/app-foundation",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Versioned foundation helpers and build context for Assembly generated apps",
5
5
  "type": "module",
6
6
  "files": [