@assembly-js/app-foundation 0.6.2 → 0.6.4
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 +6 -0
- package/CLAUDE.md +1 -1
- package/bin/client-safe-sdk-methods.mjs +3 -2
- package/dist/mint-bearer.js +7 -1
- package/dist/scripts.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,12 @@ 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.4
|
|
23
|
+
- [behavior] An app's sandbox now sends its sandbox grant when minting an app bearer, so the platform can tell its calls from the deployed app's.
|
|
24
|
+
|
|
25
|
+
## 0.6.3
|
|
26
|
+
- [fix] The client-call scan no longer reports `retrieveCompany` on the viewer client as breaking: the platform now lets a client read its own active company (`GET /v1/companies/{id}`), and refuses any other company. Nothing in the app changes.
|
|
27
|
+
|
|
22
28
|
## 0.6.2
|
|
23
29
|
- [guidance] The build agent now returns a failed AI call as `{ ok: false, message }` with the proxy's error instead of throwing, and saves a chat's question and answer together only once the answer has arrived.
|
|
24
30
|
|
package/CLAUDE.md
CHANGED
|
@@ -1196,7 +1196,7 @@ if (id?.internalUserId) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
```
|
|
1198
1198
|
|
|
1199
|
-
Client-side, the same fields come from `useAssembly()` (seeded from the server, no token). If you also need the full record:
|
|
1199
|
+
Client-side, the same fields come from `useAssembly()` (seeded from the server, no token). If you also need the full record (a client may read only its own record and its active company, `id.companyId`; any other company id is refused):
|
|
1200
1200
|
|
|
1201
1201
|
```ts
|
|
1202
1202
|
const assembly = await getAssembly();
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// give it a method here when the SDK gains one.
|
|
10
10
|
export const CLIENT_SAFE_ROUTES = Object.freeze([
|
|
11
11
|
{ method: 'GET', path: '/v1/clients/{id}', sdkMethod: 'retrieveClient' }, // the client's own record only
|
|
12
|
+
{ method: 'GET', path: '/v1/companies/{id}', sdkMethod: 'retrieveCompany' }, // the viewer's own company only
|
|
12
13
|
{ method: 'GET', path: '/v1/me', sdkMethod: 'retrieveMe' },
|
|
13
14
|
{ method: 'GET', path: '/v1/notifications', sdkMethod: 'listNotifications' },
|
|
14
15
|
{ method: 'POST', path: '/v1/notifications/{id}/read', sdkMethod: 'markNotificationRead' },
|
|
@@ -17,8 +18,8 @@ export const CLIENT_SAFE_ROUTES = Object.freeze([
|
|
|
17
18
|
{ method: 'POST', path: '/v1/ai/openai/*proxyPath', sdkMethod: null }, // the AI proxy; reached through `fetch`
|
|
18
19
|
].map(Object.freeze));
|
|
19
20
|
|
|
20
|
-
// retrieveClient
|
|
21
|
-
// fact a static scan cannot see. The notification routes are open to clients, and the
|
|
21
|
+
// retrieveClient and retrieveCompany are allowlisted by name: whether the id is the viewer's
|
|
22
|
+
// own is a runtime fact a static scan cannot see. The notification routes are open to clients, and the
|
|
22
23
|
// platform pins a client caller to their own notifications. Creating, retrieving and
|
|
23
24
|
// deleting a notification stay off the list: those routes are not open to clients.
|
|
24
25
|
export const CLIENT_SAFE_SDK_METHODS = Object.freeze(
|
package/dist/mint-bearer.js
CHANGED
|
@@ -171,9 +171,15 @@ export async function mintBearerFromAppKey() {
|
|
|
171
171
|
const controller = new AbortController();
|
|
172
172
|
const timeoutId = setTimeout(() => controller.abort(), EXCHANGE_TIMEOUT_MS);
|
|
173
173
|
try {
|
|
174
|
+
// Present only in the app's sandbox (written to .env.local, never to the deployed
|
|
175
|
+
// env); it lets the platform tell a sandbox call from a deployed one.
|
|
176
|
+
const sandboxGrant = process.env.ASSEMBLY_SANDBOX_GRANT;
|
|
174
177
|
const resp = await fetch(`${base}/v1/token`, {
|
|
175
178
|
method: 'POST',
|
|
176
|
-
headers:
|
|
179
|
+
headers: sandboxGrant
|
|
180
|
+
? { 'X-API-Key': apiKey, 'Content-Type': 'application/json' }
|
|
181
|
+
: { 'X-API-Key': apiKey },
|
|
182
|
+
...(sandboxGrant ? { body: JSON.stringify({ sandboxGrant }) } : {}),
|
|
177
183
|
signal: controller.signal,
|
|
178
184
|
});
|
|
179
185
|
if (!resp.ok)
|
package/dist/scripts.js
CHANGED
|
@@ -4652,9 +4652,11 @@ async function mintBearerFromAppKey() {
|
|
|
4652
4652
|
const controller = new AbortController();
|
|
4653
4653
|
const timeoutId = setTimeout(() => controller.abort(), EXCHANGE_TIMEOUT_MS);
|
|
4654
4654
|
try {
|
|
4655
|
+
const sandboxGrant = process.env.ASSEMBLY_SANDBOX_GRANT;
|
|
4655
4656
|
const resp = await fetch(`${base}/v1/token`, {
|
|
4656
4657
|
method: "POST",
|
|
4657
|
-
headers: { "X-API-Key": apiKey },
|
|
4658
|
+
headers: sandboxGrant ? { "X-API-Key": apiKey, "Content-Type": "application/json" } : { "X-API-Key": apiKey },
|
|
4659
|
+
...sandboxGrant ? { body: JSON.stringify({ sandboxGrant }) } : {},
|
|
4658
4660
|
signal: controller.signal
|
|
4659
4661
|
});
|
|
4660
4662
|
if (!resp.ok) return null;
|