@isomorph.ai/app-sdk 2.6.1 → 2.7.0
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/README.md +15 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +17 -1
- package/dist/integration-operations.d.ts +2 -2
- package/dist/integration-operations.js +3 -2
- package/dist/runtime.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -533,6 +533,21 @@ await runtimeSecrets.delete(`supplier-key/${ctx.user.id}`);
|
|
|
533
533
|
|
|
534
534
|
(1.36.0, 1.36.1, 1.45.0; data plane ADR 0090)
|
|
535
535
|
|
|
536
|
+
## Another app's address and this app's environment
|
|
537
|
+
|
|
538
|
+
`appApiUrl(name)` is another app's API address in the environment the calling code runs in: its preview from preview, its production from production. `name` is that app's address name (the first part of its API host).
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
import { appApiUrl } from '@isomorph.ai/app-sdk';
|
|
542
|
+
const reply = await fetch(`${appApiUrl('ats')}/_harbour/api/list-openings`, { method: 'POST', headers, body });
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
- It is `https://<name>.<ISOMORPH_APPS_API_SUFFIX>`. Provision sets the suffix on a deployed app's actions and jobs from the app's own API host; `isomorph check` and `isomorph dev` set it from the app's preview address.
|
|
546
|
+
- A name that is not lower-case letters, digits and hyphens (one DNS label) throws `VALIDATION_FAILED`. Without the suffix (a browser, or a local run with no app address) it throws an `UNAVAILABLE` error whose `details.code` is `APP_API_ADDRESS_UNAVAILABLE`.
|
|
547
|
+
- `process.env.ISOMORPH_ENVIRONMENT` is `preview` or `production` on a deployed app, and `local` under `isomorph dev`.
|
|
548
|
+
|
|
549
|
+
(2.7.0; data plane ADR 2026-11-06, kit apps learn their environment and the apps' API suffix)
|
|
550
|
+
|
|
536
551
|
## Running and rollout
|
|
537
552
|
|
|
538
553
|
`isomorph dev` uses canned server-model fixtures. `dev --real` supplies an approved development connection to the action process. Hosted actions resolve their exact ACTIVE version key. The current V2 PLAN is published after LIVE; before key activation, an AI action fails and later actions retry. LIVE alone is not AI acceptance.
|
package/dist/index.d.ts
CHANGED
|
@@ -298,6 +298,8 @@ export interface GmailAttachmentInput {
|
|
|
298
298
|
export interface GmailMessageSendRequest {
|
|
299
299
|
operation: 'gmail.message.send';
|
|
300
300
|
resource: string;
|
|
301
|
+
/** `app` sends from the company mailbox IT connected (contracts 0.102.0); `user` (the default) sends as the signed-in person. */
|
|
302
|
+
mode?: SlackIdentityMode;
|
|
301
303
|
input: {
|
|
302
304
|
/** 1 to 50 email addresses per recipient list (at most 50 across to, cc and bcc). */
|
|
303
305
|
to: string[];
|
|
@@ -2024,6 +2026,12 @@ declare class RealtimeChannelBuilder {
|
|
|
2024
2026
|
}
|
|
2025
2027
|
/** One request on the gateway with the client's headers and refusals; for the kit runtime's own calls. */
|
|
2026
2028
|
export declare function gatewayRequest<T>(options: ClientOptions, path: string, init?: RequestInit): Promise<T>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Another app's API address in the environment this code runs in: its preview from preview, its production
|
|
2031
|
+
* from production. `name` is that app's address name. Server code only; the platform sets
|
|
2032
|
+
* ISOMORPH_APPS_API_SUFFIX on a deployed app and `isomorph dev` sets it locally.
|
|
2033
|
+
*/
|
|
2034
|
+
export declare function appApiUrl(name: string): string;
|
|
2027
2035
|
export declare function createClient(options?: ClientOptions): {
|
|
2028
2036
|
identity: {
|
|
2029
2037
|
current: () => Promise<IsomorphUser | null>;
|
package/dist/index.js
CHANGED
|
@@ -435,6 +435,22 @@ class RealtimeChannelBuilder {
|
|
|
435
435
|
export function gatewayRequest(options, path, init) {
|
|
436
436
|
return new Transport(options).json(path, init);
|
|
437
437
|
}
|
|
438
|
+
const DNS_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
439
|
+
/**
|
|
440
|
+
* Another app's API address in the environment this code runs in: its preview from preview, its production
|
|
441
|
+
* from production. `name` is that app's address name. Server code only; the platform sets
|
|
442
|
+
* ISOMORPH_APPS_API_SUFFIX on a deployed app and `isomorph dev` sets it locally.
|
|
443
|
+
*/
|
|
444
|
+
export function appApiUrl(name) {
|
|
445
|
+
if (typeof name !== 'string' || !DNS_LABEL.test(name)) {
|
|
446
|
+
throw new IsomorphError('VALIDATION_FAILED', `${JSON.stringify(name)} is not an app address name: lower-case letters, digits and hyphens, at most 63, starting and ending with a letter or digit.`, undefined, { code: 'VALIDATION_FAILED' });
|
|
447
|
+
}
|
|
448
|
+
const suffix = typeof process === 'undefined' ? undefined : process.env.ISOMORPH_APPS_API_SUFFIX;
|
|
449
|
+
if (!suffix) {
|
|
450
|
+
throw new IsomorphError('UNAVAILABLE', `Another app's address is not known here. appApiUrl works in a deployed app's actions and jobs, and under isomorph dev for an app that has an address.`, undefined, { code: 'APP_API_ADDRESS_UNAVAILABLE' });
|
|
451
|
+
}
|
|
452
|
+
return `https://${name}.${suffix}`;
|
|
453
|
+
}
|
|
438
454
|
export function createClient(options = {}) {
|
|
439
455
|
const authListeners = new Set();
|
|
440
456
|
let currentUser;
|
|
@@ -835,7 +851,7 @@ export function createClient(options = {}) {
|
|
|
835
851
|
}
|
|
836
852
|
catch { /* not JSON: the status says what happened */ }
|
|
837
853
|
if (!response.ok || body.error) {
|
|
838
|
-
throw new IsomorphError(body.error?.category ?? 'INTERNAL', body.error?.message ?? `the public action answered ${response.status}`, body.requestId,
|
|
854
|
+
throw new IsomorphError(body.error?.category ?? 'INTERNAL', body.error?.message ?? `the public action answered ${response.status}`, body.requestId, body.error?.details, response.status);
|
|
839
855
|
}
|
|
840
856
|
return body.data;
|
|
841
857
|
},
|
|
@@ -65,9 +65,9 @@ export declare const IntegrationOperations: {
|
|
|
65
65
|
};
|
|
66
66
|
readonly "gmail.message.send": {
|
|
67
67
|
readonly kind: "saas";
|
|
68
|
-
readonly identities: readonly ["user"];
|
|
68
|
+
readonly identities: readonly ["user", "app"];
|
|
69
69
|
readonly readOnly: false;
|
|
70
|
-
readonly declaredMode:
|
|
70
|
+
readonly declaredMode: true;
|
|
71
71
|
readonly idempotencyKey: true;
|
|
72
72
|
};
|
|
73
73
|
readonly "gmail.attachment.read": {
|
|
@@ -90,10 +90,11 @@ export const IntegrationOperations = {
|
|
|
90
90
|
"gmail.message.send": {
|
|
91
91
|
"kind": "saas",
|
|
92
92
|
"identities": [
|
|
93
|
-
"user"
|
|
93
|
+
"user",
|
|
94
|
+
"app"
|
|
94
95
|
],
|
|
95
96
|
"readOnly": false,
|
|
96
|
-
"declaredMode":
|
|
97
|
+
"declaredMode": true,
|
|
97
98
|
"idempotencyKey": true
|
|
98
99
|
},
|
|
99
100
|
"gmail.attachment.read": {
|
package/dist/runtime.js
CHANGED
|
@@ -57,6 +57,11 @@
|
|
|
57
57
|
// ISOMORPH_JOBS_QUEUE_URL an enqueue sends the run to this SQS queue and
|
|
58
58
|
// the queue loop never runs here: the cell's
|
|
59
59
|
// Event Function works it (lambda-events-entry.ts)
|
|
60
|
+
// ISOMORPH_ENVIRONMENT preview or production, set by Provision (by the
|
|
61
|
+
// CLI under isomorph check and isomorph dev); the
|
|
62
|
+
// SDK itself never reads it
|
|
63
|
+
// ISOMORPH_APPS_API_SUFFIX the part of this app's API host after its own
|
|
64
|
+
// name, which appApiUrl puts after another app's
|
|
60
65
|
import { createHash, randomBytes } from 'node:crypto';
|
|
61
66
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
62
67
|
import { createServer } from 'node:http';
|