@arbidocs/sdk 0.5.166 → 0.5.168
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/dist/automation.cjs +36 -0
- package/dist/automation.cjs.map +1 -0
- package/dist/automation.d.cts +11 -0
- package/dist/automation.d.ts +11 -0
- package/dist/automation.js +34 -0
- package/dist/automation.js.map +1 -0
- package/dist/{browser-ELa3ogbW.d.cts → browser-BNilSnIn.d.cts} +1 -1
- package/dist/{browser-CCrsY0_5.d.ts → browser-CJgLHGP5.d.ts} +1 -1
- package/dist/browser.cjs +4 -5
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +4 -5
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +4 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/examples/human-review/package.json +1 -1
- package/examples/react-chat/package.json +2 -2
- package/package.json +7 -2
|
@@ -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"]}
|
|
@@ -1139,7 +1139,7 @@ declare const SUPPORTED_EXTENSIONS: Set<string>;
|
|
|
1139
1139
|
*/
|
|
1140
1140
|
declare function sanitizeFolderPath(folderPath: string): string;
|
|
1141
1141
|
interface UploadOptions {
|
|
1142
|
-
/**
|
|
1142
|
+
/** Share with workspace members. Omitted uploads are private. */
|
|
1143
1143
|
shared?: boolean;
|
|
1144
1144
|
folder?: string;
|
|
1145
1145
|
configExtId?: string;
|
|
@@ -1139,7 +1139,7 @@ declare const SUPPORTED_EXTENSIONS: Set<string>;
|
|
|
1139
1139
|
*/
|
|
1140
1140
|
declare function sanitizeFolderPath(folderPath: string): string;
|
|
1141
1141
|
interface UploadOptions {
|
|
1142
|
-
/**
|
|
1142
|
+
/** Share with workspace members. Omitted uploads are private. */
|
|
1143
1143
|
shared?: boolean;
|
|
1144
1144
|
folder?: string;
|
|
1145
1145
|
configExtId?: string;
|
package/dist/browser.cjs
CHANGED
|
@@ -6179,8 +6179,7 @@ function requireUploadData(result, message) {
|
|
|
6179
6179
|
return requireWorkspaceData(result, message, UPLOAD_WORKSPACE_CONFLICT_MESSAGES);
|
|
6180
6180
|
}
|
|
6181
6181
|
async function uploadDocuments(arbi, files, options = {}) {
|
|
6182
|
-
const query2 = {};
|
|
6183
|
-
if (options.shared !== void 0) query2.shared = options.shared;
|
|
6182
|
+
const query2 = { shared: options.shared ?? false };
|
|
6184
6183
|
if (options.folder) query2.folder = sanitizeFolderPath(options.folder);
|
|
6185
6184
|
if (options.configExtId) query2.config_ext_id = options.configExtId;
|
|
6186
6185
|
if (options.wpType) query2.wp_type = options.wpType;
|
|
@@ -6242,7 +6241,7 @@ async function uploadFile(auth, fileData, fileName, options) {
|
|
|
6242
6241
|
const formData = new FormData();
|
|
6243
6242
|
formData.append("files", fileData, fileName);
|
|
6244
6243
|
const params = new URLSearchParams();
|
|
6245
|
-
|
|
6244
|
+
params.set("shared", String(options?.shared ?? false));
|
|
6246
6245
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
6247
6246
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
6248
6247
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
@@ -6267,7 +6266,7 @@ async function uploadFile(auth, fileData, fileName, options) {
|
|
|
6267
6266
|
async function uploadFiles(auth, files, options) {
|
|
6268
6267
|
const formData = new FormData();
|
|
6269
6268
|
for (const f2 of files) formData.append("files", f2.data, f2.name);
|
|
6270
|
-
const params = new URLSearchParams();
|
|
6269
|
+
const params = new URLSearchParams({ shared: String(options?.shared ?? false) });
|
|
6271
6270
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
6272
6271
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
6273
6272
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
@@ -6387,7 +6386,7 @@ async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
|
|
|
6387
6386
|
}
|
|
6388
6387
|
const initBody = {
|
|
6389
6388
|
files: declared,
|
|
6390
|
-
shared: options.shared
|
|
6389
|
+
shared: options.shared ?? false,
|
|
6391
6390
|
config_ext_id: options.configExtId ?? null,
|
|
6392
6391
|
// Only sent when set, so a plain upload is accepted by any server version.
|
|
6393
6392
|
...options.versionOf ? { version_of: options.versionOf } : {},
|