@assembly-js/app-foundation 0.6.0 → 0.6.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.
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.6.1
23
+ - [fix] The client-call scan no longer reports a `fetch` to the AI proxy (`POST /v1/ai/openai/...`) as breaking: the platform now admits a client bearer on that route. Nothing in the app changes.
24
+
22
25
  ## 0.6.0
23
26
  - [new] `AuthUnavailableError` carries a fixed digest (`AUTH_UNAVAILABLE_DIGEST`), so an app's error boundary can recognise a platform outage after production has redacted the error.
24
27
  - [action] A platform outage reaches the retry screen from every page, not only the root layout: `app/error.tsx` renders it on that digest and no helper or route may swallow the error; the renewal limiter earlier updates copied into the app is removed now that the package bounds renewal itself.
@@ -14,6 +14,7 @@ export const CLIENT_SAFE_ROUTES = Object.freeze([
14
14
  { method: 'POST', path: '/v1/notifications/{id}/read', sdkMethod: 'markNotificationRead' },
15
15
  { method: 'POST', path: '/v1/notifications/{id}/unread', sdkMethod: 'markNotificationUnread' },
16
16
  { method: 'GET', path: '/v1/session/flags', sdkMethod: null },
17
+ { method: 'POST', path: '/v1/ai/openai/*proxyPath', sdkMethod: null }, // the AI proxy; reached through `fetch`
17
18
  ].map(Object.freeze));
18
19
 
19
20
  // retrieveClient is allowlisted by name: whether the id is the viewer's own is a runtime
@@ -27,10 +28,15 @@ export const CLIENT_SAFE_SDK_METHODS = Object.freeze(
27
28
  // Marked client-safe routes that no SDK method reaches yet.
28
29
  export const CLIENT_SAFE_ROUTES_WITHOUT_SDK_METHOD = CLIENT_SAFE_ROUTES.filter((r) => !r.sdkMethod).length;
29
30
 
30
- // `{id}` stands for exactly one non-empty path segment.
31
+ // `{id}` stands for exactly one non-empty path segment; a trailing `*name` stands for the rest of
32
+ // the path, as the platform's wildcard does.
31
33
  // The id segment excludes `.` and `%` so `.`, `..` and `%2e` forms that URL normalisation resolves elsewhere fail closed.
32
- const routePattern = (route) =>
33
- new RegExp(`^${route.path.split('/').map((seg) => (seg === '{id}' ? '[A-Za-z0-9_-]+' : seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))).join('/')}$`);
34
+ const segmentPattern = (seg) => {
35
+ if (seg === '{id}') return '[A-Za-z0-9_-]+';
36
+ if (seg.startsWith('*')) return '.+';
37
+ return seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
38
+ };
39
+ const routePattern = (route) => new RegExp(`^${route.path.split('/').map(segmentPattern).join('/')}$`);
34
40
  const ROUTE_MATCHERS = CLIENT_SAFE_ROUTES.map((route) => ({ method: route.method, pattern: routePattern(route) }));
35
41
 
36
42
  // Whether `fetch(path, { method })` hits a client-safe route; `path` has no query string.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assembly-js/app-foundation",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Versioned foundation helpers and build context for Assembly generated apps",
5
5
  "type": "module",
6
6
  "files": [