@arbidocs/sdk 0.5.167 → 0.5.169

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.
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ // src/automation.ts
4
+ function createAutomationClient(options) {
5
+ const base = options.baseUrl.replace(/\/+$/, "") + "/admin/automation";
6
+ return {
7
+ async request(method, path, body, signal) {
8
+ if (!/^\/[A-Za-z0-9_./-]*(?:\?[^#]*)?$/.test(path) || path.startsWith("//") || path.includes(".."))
9
+ throw new Error("Invalid automation API path");
10
+ const token = await options.getAccessToken();
11
+ if (!token) throw new Error("Sign in to access automation");
12
+ const response = await (options.fetch ?? globalThis.fetch)(base + path, {
13
+ method,
14
+ headers: {
15
+ Authorization: `Bearer ${token}`,
16
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
17
+ },
18
+ body: body === void 0 ? void 0 : JSON.stringify(body),
19
+ signal,
20
+ redirect: "error"
21
+ });
22
+ if (response.status === 204) return null;
23
+ const result = await response.json();
24
+ const detail = result && typeof result === "object" && "detail" in result ? result.detail : null;
25
+ if (!response.ok)
26
+ throw new Error(
27
+ typeof detail === "string" ? detail : `Automation request failed (${response.status})`
28
+ );
29
+ return result;
30
+ }
31
+ };
32
+ }
33
+
34
+ exports.createAutomationClient = createAutomationClient;
35
+ //# sourceMappingURL=automation.cjs.map
36
+ //# sourceMappingURL=automation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/automation.ts"],"names":[],"mappings":";;;AAOO,SAAS,uBAAuB,OAAA,EAAkC;AACvE,EAAA,MAAM,OAAO,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,GAAI,mBAAA;AACnD,EAAA,OAAO;AAAA,IACL,MAAM,OAAA,CACJ,MAAA,EACA,IAAA,EACA,MACA,MAAA,EACkB;AAClB,MAAA,IACE,CAAC,kCAAA,CAAmC,IAAA,CAAK,IAAI,CAAA,IAC7C,IAAA,CAAK,UAAA,CAAW,IAAI,CAAA,IACpB,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA;AAElB,QAAA,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC/C,MAAA,MAAM,KAAA,GAAQ,MAAM,OAAA,CAAQ,cAAA,EAAe;AAC3C,MAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,MAAM,8BAA8B,CAAA;AAC1D,MAAA,MAAM,WAAW,MAAA,CAAO,OAAA,CAAQ,SAAS,UAAA,CAAW,KAAA,EAAO,OAAO,IAAA,EAAM;AAAA,QACtE,MAAA;AAAA,QACA,OAAA,EAAS;AAAA,UACP,aAAA,EAAe,UAAU,KAAK,CAAA,CAAA;AAAA,UAC9B,GAAI,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,gBAAgB,kBAAA;AAAmB,SACrE;AAAA,QACA,MAAM,IAAA,KAAS,MAAA,GAAY,MAAA,GAAY,IAAA,CAAK,UAAU,IAAI,CAAA;AAAA,QAC1D,MAAA;AAAA,QACA,QAAA,EAAU;AAAA,OACX,CAAA;AACD,MAAA,IAAI,QAAA,CAAS,MAAA,KAAW,GAAA,EAAK,OAAO,IAAA;AACpC,MAAA,MAAM,MAAA,GAAkB,MAAM,QAAA,CAAS,IAAA,EAAK;AAC5C,MAAA,MAAM,MAAA,GACJ,UAAU,OAAO,MAAA,KAAW,YAAY,QAAA,IAAY,MAAA,GAAS,OAAO,MAAA,GAAS,IAAA;AAC/E,MAAA,IAAI,CAAC,QAAA,CAAS,EAAA;AACZ,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,OAAO,MAAA,KAAW,QAAA,GAAW,MAAA,GAAS,CAAA,2BAAA,EAA8B,SAAS,MAAM,CAAA,CAAA;AAAA,SACrF;AACF,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACF;AACF","file":"automation.cjs","sourcesContent":["export interface AutomationClientOptions {\n baseUrl: string\n getAccessToken: () => Promise<string | null>\n fetch?: typeof globalThis.fetch\n}\n\n/** Authenticated access to Central's administrator automation API. */\nexport function createAutomationClient(options: AutomationClientOptions) {\n const base = options.baseUrl.replace(/\\/+$/, '') + '/admin/automation'\n return {\n async request(\n method: string,\n path: string,\n body?: unknown,\n signal?: AbortSignal\n ): Promise<unknown> {\n if (\n !/^\\/[A-Za-z0-9_./-]*(?:\\?[^#]*)?$/.test(path) ||\n path.startsWith('//') ||\n path.includes('..')\n )\n throw new Error('Invalid automation API path')\n const token = await options.getAccessToken()\n if (!token) throw new Error('Sign in to access automation')\n const response = await (options.fetch ?? globalThis.fetch)(base + path, {\n method,\n headers: {\n Authorization: `Bearer ${token}`,\n ...(body === undefined ? {} : { 'Content-Type': 'application/json' }),\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n signal,\n redirect: 'error',\n })\n if (response.status === 204) return null\n const result: unknown = await response.json()\n const detail =\n result && typeof result === 'object' && 'detail' in result ? result.detail : null\n if (!response.ok)\n throw new Error(\n typeof detail === 'string' ? detail : `Automation request failed (${response.status})`\n )\n return result\n },\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ interface AutomationClientOptions {
2
+ baseUrl: string;
3
+ getAccessToken: () => Promise<string | null>;
4
+ fetch?: typeof globalThis.fetch;
5
+ }
6
+ /** Authenticated access to Central's administrator automation API. */
7
+ declare function createAutomationClient(options: AutomationClientOptions): {
8
+ request(method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<unknown>;
9
+ };
10
+
11
+ export { type AutomationClientOptions, createAutomationClient };
@@ -0,0 +1,11 @@
1
+ interface AutomationClientOptions {
2
+ baseUrl: string;
3
+ getAccessToken: () => Promise<string | null>;
4
+ fetch?: typeof globalThis.fetch;
5
+ }
6
+ /** Authenticated access to Central's administrator automation API. */
7
+ declare function createAutomationClient(options: AutomationClientOptions): {
8
+ request(method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<unknown>;
9
+ };
10
+
11
+ export { type AutomationClientOptions, createAutomationClient };
@@ -0,0 +1,34 @@
1
+ // src/automation.ts
2
+ function createAutomationClient(options) {
3
+ const base = options.baseUrl.replace(/\/+$/, "") + "/admin/automation";
4
+ return {
5
+ async request(method, path, body, signal) {
6
+ if (!/^\/[A-Za-z0-9_./-]*(?:\?[^#]*)?$/.test(path) || path.startsWith("//") || path.includes(".."))
7
+ throw new Error("Invalid automation API path");
8
+ const token = await options.getAccessToken();
9
+ if (!token) throw new Error("Sign in to access automation");
10
+ const response = await (options.fetch ?? globalThis.fetch)(base + path, {
11
+ method,
12
+ headers: {
13
+ Authorization: `Bearer ${token}`,
14
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
15
+ },
16
+ body: body === void 0 ? void 0 : JSON.stringify(body),
17
+ signal,
18
+ redirect: "error"
19
+ });
20
+ if (response.status === 204) return null;
21
+ const result = await response.json();
22
+ const detail = result && typeof result === "object" && "detail" in result ? result.detail : null;
23
+ if (!response.ok)
24
+ throw new Error(
25
+ typeof detail === "string" ? detail : `Automation request failed (${response.status})`
26
+ );
27
+ return result;
28
+ }
29
+ };
30
+ }
31
+
32
+ export { createAutomationClient };
33
+ //# sourceMappingURL=automation.js.map
34
+ //# sourceMappingURL=automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/automation.ts"],"names":[],"mappings":";AAOO,SAAS,uBAAuB,OAAA,EAAkC;AACvE,EAAA,MAAM,OAAO,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,GAAI,mBAAA;AACnD,EAAA,OAAO;AAAA,IACL,MAAM,OAAA,CACJ,MAAA,EACA,IAAA,EACA,MACA,MAAA,EACkB;AAClB,MAAA,IACE,CAAC,kCAAA,CAAmC,IAAA,CAAK,IAAI,CAAA,IAC7C,IAAA,CAAK,UAAA,CAAW,IAAI,CAAA,IACpB,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA;AAElB,QAAA,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC/C,MAAA,MAAM,KAAA,GAAQ,MAAM,OAAA,CAAQ,cAAA,EAAe;AAC3C,MAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,MAAM,8BAA8B,CAAA;AAC1D,MAAA,MAAM,WAAW,MAAA,CAAO,OAAA,CAAQ,SAAS,UAAA,CAAW,KAAA,EAAO,OAAO,IAAA,EAAM;AAAA,QACtE,MAAA;AAAA,QACA,OAAA,EAAS;AAAA,UACP,aAAA,EAAe,UAAU,KAAK,CAAA,CAAA;AAAA,UAC9B,GAAI,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,gBAAgB,kBAAA;AAAmB,SACrE;AAAA,QACA,MAAM,IAAA,KAAS,MAAA,GAAY,MAAA,GAAY,IAAA,CAAK,UAAU,IAAI,CAAA;AAAA,QAC1D,MAAA;AAAA,QACA,QAAA,EAAU;AAAA,OACX,CAAA;AACD,MAAA,IAAI,QAAA,CAAS,MAAA,KAAW,GAAA,EAAK,OAAO,IAAA;AACpC,MAAA,MAAM,MAAA,GAAkB,MAAM,QAAA,CAAS,IAAA,EAAK;AAC5C,MAAA,MAAM,MAAA,GACJ,UAAU,OAAO,MAAA,KAAW,YAAY,QAAA,IAAY,MAAA,GAAS,OAAO,MAAA,GAAS,IAAA;AAC/E,MAAA,IAAI,CAAC,QAAA,CAAS,EAAA;AACZ,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,OAAO,MAAA,KAAW,QAAA,GAAW,MAAA,GAAS,CAAA,2BAAA,EAA8B,SAAS,MAAM,CAAA,CAAA;AAAA,SACrF;AACF,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,GACF;AACF","file":"automation.js","sourcesContent":["export interface AutomationClientOptions {\n baseUrl: string\n getAccessToken: () => Promise<string | null>\n fetch?: typeof globalThis.fetch\n}\n\n/** Authenticated access to Central's administrator automation API. */\nexport function createAutomationClient(options: AutomationClientOptions) {\n const base = options.baseUrl.replace(/\\/+$/, '') + '/admin/automation'\n return {\n async request(\n method: string,\n path: string,\n body?: unknown,\n signal?: AbortSignal\n ): Promise<unknown> {\n if (\n !/^\\/[A-Za-z0-9_./-]*(?:\\?[^#]*)?$/.test(path) ||\n path.startsWith('//') ||\n path.includes('..')\n )\n throw new Error('Invalid automation API path')\n const token = await options.getAccessToken()\n if (!token) throw new Error('Sign in to access automation')\n const response = await (options.fetch ?? globalThis.fetch)(base + path, {\n method,\n headers: {\n Authorization: `Bearer ${token}`,\n ...(body === undefined ? {} : { 'Content-Type': 'application/json' }),\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n signal,\n redirect: 'error',\n })\n if (response.status === 204) return null\n const result: unknown = await response.json()\n const detail =\n result && typeof result === 'object' && 'detail' in result ? result.detail : null\n if (!response.ok)\n throw new Error(\n typeof detail === 'string' ? detail : `Automation request failed (${response.status})`\n )\n return result\n },\n }\n}\n"]}
@@ -6,7 +6,7 @@
6
6
  "start": "node --env-file-if-exists=.env index.mjs"
7
7
  },
8
8
  "dependencies": {
9
- "@arbidocs/sdk": "0.5.167"
9
+ "@arbidocs/sdk": "0.5.169"
10
10
  },
11
11
  "engines": {
12
12
  "node": ">=22.13.0"
@@ -8,8 +8,8 @@
8
8
  "preview": "vite preview"
9
9
  },
10
10
  "dependencies": {
11
- "@arbidocs/blocks": "0.5.167",
12
- "@arbidocs/react": "0.5.167",
11
+ "@arbidocs/blocks": "0.5.169",
12
+ "@arbidocs/react": "0.5.169",
13
13
  "@tanstack/react-query": "^5.90.5",
14
14
  "react": "^19.2.0",
15
15
  "react-dom": "^19.2.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/sdk",
3
- "version": "0.5.167",
3
+ "version": "0.5.169",
4
4
  "description": "Shared operations layer for ARBI — auth, config, SSE, WebSocket, and API operations",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -32,6 +32,11 @@
32
32
  "types": "./dist/testing.d.ts",
33
33
  "import": "./dist/testing.js",
34
34
  "require": "./dist/testing.cjs"
35
+ },
36
+ "./automation": {
37
+ "types": "./dist/automation.d.ts",
38
+ "import": "./dist/automation.js",
39
+ "require": "./dist/automation.cjs"
35
40
  }
36
41
  },
37
42
  "files": [
@@ -46,7 +51,7 @@
46
51
  "typecheck": "tsc --noEmit"
47
52
  },
48
53
  "dependencies": {
49
- "@arbidocs/client": "0.5.167",
54
+ "@arbidocs/client": "0.5.169",
50
55
  "ajv": "^8.20.0",
51
56
  "jszip": "^3.10.1"
52
57
  },