@assembly-js/app-foundation 0.6.3 → 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 +3 -0
- 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,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.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
|
+
|
|
22
25
|
## 0.6.3
|
|
23
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.
|
|
24
27
|
|
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;
|