@statelyai/sdk 0.16.1 → 0.16.2
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 +19 -19
- package/dist/index.mjs +1 -1
- package/dist/{inspect-C3Y_o_Np.mjs → inspect-DxOsKzlq.mjs} +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/oauth.mjs +19 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -106,20 +106,20 @@ const extracted = await studio.code.extractMachines({
|
|
|
106
106
|
|
|
107
107
|
The client namespaces map one-to-one onto the server-owned `/api/v1` contract:
|
|
108
108
|
|
|
109
|
-
| Method
|
|
110
|
-
|
|
|
111
|
-
| `auth.verify()`
|
|
112
|
-
| `projects.list()`
|
|
113
|
-
| `projects.create(input)`
|
|
114
|
-
| `projects.get(projectId)`
|
|
115
|
-
| `projects.update(projectId, input)`
|
|
116
|
-
| `projects.delete(projectId)`
|
|
117
|
-
| `projects.listMachines(projectId)`
|
|
118
|
-
| `machines.create(input)`
|
|
119
|
-
| `machines.get(machineId)`
|
|
120
|
-
| `machines.getVersion(machineId, versionId)`
|
|
121
|
-
| `machines.update(machineId, input)`
|
|
122
|
-
| `code.extractMachines(input)`
|
|
109
|
+
| Method | Operation |
|
|
110
|
+
| ------------------------------------------- | ----------------------------------------------------- |
|
|
111
|
+
| `auth.verify()` | `GET /api/v1/auth/verify` |
|
|
112
|
+
| `projects.list()` | `GET /api/v1/projects` |
|
|
113
|
+
| `projects.create(input)` | `POST /api/v1/projects` |
|
|
114
|
+
| `projects.get(projectId)` | `GET /api/v1/projects/:projectId` |
|
|
115
|
+
| `projects.update(projectId, input)` | `PATCH /api/v1/projects/:projectId` |
|
|
116
|
+
| `projects.delete(projectId)` | `DELETE /api/v1/projects/:projectId` |
|
|
117
|
+
| `projects.listMachines(projectId)` | `GET /api/v1/projects/:projectId/machines` |
|
|
118
|
+
| `machines.create(input)` | `POST /api/v1/machines` |
|
|
119
|
+
| `machines.get(machineId)` | `GET /api/v1/machines/:machineId` |
|
|
120
|
+
| `machines.getVersion(machineId, versionId)` | `GET /api/v1/machines/:machineId/versions/:versionId` |
|
|
121
|
+
| `machines.update(machineId, input)` | `PATCH /api/v1/machines/:machineId` |
|
|
122
|
+
| `code.extractMachines(input)` | `POST /api/v1/code/extract-machines` |
|
|
123
123
|
|
|
124
124
|
`projects.ensure(input)` is a client workflow composed of `projects.list`,
|
|
125
125
|
`projects.get`, and `projects.create`, not a route.
|
|
@@ -270,12 +270,12 @@ reference deployment.
|
|
|
270
270
|
|
|
271
271
|
Key environment variables for self-hosted deployments:
|
|
272
272
|
|
|
273
|
-
| Variable | Purpose
|
|
274
|
-
| --------------------------- |
|
|
275
|
-
| `AUTH_PROVIDER` | Auth strategy used by the editor host
|
|
273
|
+
| Variable | Purpose |
|
|
274
|
+
| --------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
275
|
+
| `AUTH_PROVIDER` | Auth strategy used by the editor host |
|
|
276
276
|
| `RESOURCE_PROVIDER` | Set to `stately` to enable project and machine resource operations; `none` (default) disables them |
|
|
277
|
-
| `EDITOR_SYNC_AUTH_REQUIRED` | Set to `false` to skip editor-sync API-key checks
|
|
278
|
-
| `NEXT_PUBLIC_BASE_URL` | Public-facing editor URL
|
|
277
|
+
| `EDITOR_SYNC_AUTH_REQUIRED` | Set to `false` to skip editor-sync API-key checks |
|
|
278
|
+
| `NEXT_PUBLIC_BASE_URL` | Public-facing editor URL |
|
|
279
279
|
|
|
280
280
|
For enterprise self-hosting options, [see pricing and contact
|
|
281
281
|
us](https://stately.ai/pricing).
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { n as createWebSocketTransport, t as createPostMessageTransport } from "
|
|
|
2
2
|
import { INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
3
3
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
4
4
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
5
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-DxOsKzlq.mjs";
|
|
6
6
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-txdyJHD7.mjs";
|
|
7
7
|
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, n as getStatelyPragma, o as contextSchemaToTSType, p as serializeJS, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-Bm9O4XV6.mjs";
|
|
8
8
|
import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
@@ -28,7 +28,7 @@ async function openBrowser(url) {
|
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/version.ts
|
|
31
|
-
const SDK_VERSION = "0.16.
|
|
31
|
+
const SDK_VERSION = "0.16.2";
|
|
32
32
|
function inspectionRuntime() {
|
|
33
33
|
if (typeof window !== "undefined") return "browser";
|
|
34
34
|
if (typeof process !== "undefined" && process.versions?.node) return "node";
|
package/dist/inspect.mjs
CHANGED
package/dist/oauth.mjs
CHANGED
|
@@ -13,6 +13,24 @@ async function getOAuthResponseError(response) {
|
|
|
13
13
|
const detail = (await response.text().catch(() => "")).trim();
|
|
14
14
|
return detail ? `: ${detail}` : "";
|
|
15
15
|
}
|
|
16
|
+
var OAuthTokenRequestError = class extends Error {
|
|
17
|
+
constructor(message, status, oauthError) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.oauthError = oauthError;
|
|
21
|
+
this.name = "OAuthTokenRequestError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
async function createOAuthTokenRequestError(response, message) {
|
|
25
|
+
const body = await response.text().catch(() => "");
|
|
26
|
+
let oauthError;
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(body);
|
|
29
|
+
if (typeof parsed.error === "string") oauthError = parsed.error;
|
|
30
|
+
} catch {}
|
|
31
|
+
const detail = body.trim() ? `: ${body.trim()}` : "";
|
|
32
|
+
return new OAuthTokenRequestError(`${message} with HTTP ${response.status}${detail}`, response.status, oauthError);
|
|
33
|
+
}
|
|
16
34
|
async function discoverProtectedResource(resourceUrl, options = {}) {
|
|
17
35
|
const resource = new URL(String(resourceUrl));
|
|
18
36
|
const pathParts = resource.pathname.split("/").filter(Boolean);
|
|
@@ -110,7 +128,7 @@ async function refreshToken(options) {
|
|
|
110
128
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
111
129
|
body
|
|
112
130
|
});
|
|
113
|
-
if (!response.ok) throw
|
|
131
|
+
if (!response.ok) throw await createOAuthTokenRequestError(response, "Token refresh failed");
|
|
114
132
|
return response.json();
|
|
115
133
|
}
|
|
116
134
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statelyai/sdk",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stately-sdk": "./dist/bin.mjs"
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"jsdom": "^27.4.0",
|
|
90
90
|
"tsdown": "0.21.0-beta.2",
|
|
91
91
|
"vitest": "^3.2.4",
|
|
92
|
-
"@statelyai/api-contract": "0.0.
|
|
93
|
-
"@statelyai/graph-tools": "0.0.
|
|
92
|
+
"@statelyai/api-contract": "0.0.2",
|
|
93
|
+
"@statelyai/graph-tools": "0.0.8"
|
|
94
94
|
},
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=22.4"
|