@arbidocs/sdk 0.4.144 → 0.4.146
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/{browser-C48W4Ivd.d.cts → browser-Cd9i8TIR.d.cts} +86 -9
- package/dist/{browser-C48W4Ivd.d.ts → browser-Cd9i8TIR.d.ts} +86 -9
- package/dist/browser.cjs +82 -12
- 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 +82 -12
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +82 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +82 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4922,7 +4922,9 @@ __export(documents_exports, {
|
|
|
4922
4922
|
mimeFromName: () => mimeFromName,
|
|
4923
4923
|
presignedPut: () => presignedPut,
|
|
4924
4924
|
sanitizeFolderPath: () => sanitizeFolderPath,
|
|
4925
|
+
similarDocuments: () => similarDocuments,
|
|
4925
4926
|
updateDocuments: () => updateDocuments,
|
|
4927
|
+
uploadDocuments: () => uploadDocuments,
|
|
4926
4928
|
uploadDocumentsDirect: () => uploadDocumentsDirect,
|
|
4927
4929
|
uploadFile: () => uploadFile,
|
|
4928
4930
|
uploadFiles: () => uploadFiles,
|
|
@@ -5090,16 +5092,54 @@ async function updateDocuments(arbi, documents) {
|
|
|
5090
5092
|
"Failed to update documents"
|
|
5091
5093
|
);
|
|
5092
5094
|
}
|
|
5093
|
-
async function uploadUrl(arbi, urls, shared = false) {
|
|
5095
|
+
async function uploadUrl(arbi, urls, shared = false, configExtId) {
|
|
5094
5096
|
return requireData(
|
|
5095
5097
|
await arbi.fetch.POST("/v1/document/upload-url", {
|
|
5096
5098
|
params: {
|
|
5097
|
-
query: { urls, shared }
|
|
5099
|
+
query: { urls, shared, ...configExtId ? { config_ext_id: configExtId } : {} }
|
|
5098
5100
|
}
|
|
5099
5101
|
}),
|
|
5100
5102
|
"Failed to upload from URLs"
|
|
5101
5103
|
);
|
|
5102
5104
|
}
|
|
5105
|
+
async function uploadDocuments(arbi, files, options = {}) {
|
|
5106
|
+
const query = {};
|
|
5107
|
+
if (options.shared !== void 0) query.shared = options.shared;
|
|
5108
|
+
if (options.folder) query.folder = sanitizeFolderPath(options.folder);
|
|
5109
|
+
if (options.configExtId) query.config_ext_id = options.configExtId;
|
|
5110
|
+
if (options.wpType) query.wp_type = options.wpType;
|
|
5111
|
+
if (options.versionOf) query.version_of = options.versionOf;
|
|
5112
|
+
if (options.tagExtId) query.tag_ext_id = options.tagExtId;
|
|
5113
|
+
if (options.workspaceExtId) query.workspace_ext_id = options.workspaceExtId;
|
|
5114
|
+
if (options.derivedFrom) {
|
|
5115
|
+
query.derived_from = options.derivedFrom.docId;
|
|
5116
|
+
query.derived_role = options.derivedFrom.role;
|
|
5117
|
+
}
|
|
5118
|
+
const result = await arbi.fetch.POST("/v1/document/upload", {
|
|
5119
|
+
params: { query },
|
|
5120
|
+
// The schema types the files as strings; they go as multipart parts.
|
|
5121
|
+
body: { files },
|
|
5122
|
+
bodySerializer: () => {
|
|
5123
|
+
const form = new FormData();
|
|
5124
|
+
for (const file of files) form.append("files", file);
|
|
5125
|
+
return form;
|
|
5126
|
+
}
|
|
5127
|
+
});
|
|
5128
|
+
return requireData(result, "Failed to upload documents");
|
|
5129
|
+
}
|
|
5130
|
+
async function similarDocuments(arbi, options = {}) {
|
|
5131
|
+
return requireData(
|
|
5132
|
+
await arbi.fetch.GET("/v1/document/similar", {
|
|
5133
|
+
params: {
|
|
5134
|
+
query: {
|
|
5135
|
+
...options.threshold !== void 0 ? { threshold: options.threshold } : {},
|
|
5136
|
+
...options.docId ? { doc_ext_id: options.docId } : {}
|
|
5137
|
+
}
|
|
5138
|
+
}
|
|
5139
|
+
}),
|
|
5140
|
+
"Failed to fetch similar documents"
|
|
5141
|
+
);
|
|
5142
|
+
}
|
|
5103
5143
|
async function getParsedContent(auth, docId, stage, version) {
|
|
5104
5144
|
const res = await authenticatedFetch({
|
|
5105
5145
|
...auth,
|
|
@@ -5545,15 +5585,17 @@ async function updateWorkspace(arbi, body) {
|
|
|
5545
5585
|
async function listWorkspaceUsers(arbi) {
|
|
5546
5586
|
return requireData(await arbi.fetch.GET("/v1/workspace/users"), "Failed to fetch workspace users");
|
|
5547
5587
|
}
|
|
5548
|
-
async function addWorkspaceUsers(arbi, emails, role = "collaborator", target) {
|
|
5588
|
+
async function addWorkspaceUsers(arbi, emails, role = "collaborator", target, confirmInvite = false) {
|
|
5589
|
+
const invite = confirmInvite ? { confirm_invite: true } : {};
|
|
5549
5590
|
return requireData(
|
|
5550
5591
|
await arbi.fetch.POST("/v1/workspace/users", {
|
|
5551
5592
|
body: target ? {
|
|
5552
5593
|
emails,
|
|
5553
5594
|
role,
|
|
5554
5595
|
workspace_ext_id: target.workspaceExtId,
|
|
5555
|
-
workspace_key: target.workspaceKey
|
|
5556
|
-
|
|
5596
|
+
workspace_key: target.workspaceKey,
|
|
5597
|
+
...invite
|
|
5598
|
+
} : { emails, role, ...invite }
|
|
5557
5599
|
}),
|
|
5558
5600
|
"Failed to add users"
|
|
5559
5601
|
);
|
|
@@ -6162,10 +6204,15 @@ __export(doctags_exports, {
|
|
|
6162
6204
|
removeDocTags: () => removeDocTags,
|
|
6163
6205
|
updateDocTag: () => updateDocTag
|
|
6164
6206
|
});
|
|
6165
|
-
async function assignDocTags(arbi, tagId, docIds, note) {
|
|
6207
|
+
async function assignDocTags(arbi, tagId, docIds, note, citations) {
|
|
6166
6208
|
return requireData(
|
|
6167
6209
|
await arbi.fetch.POST("/v1/document/doctag", {
|
|
6168
|
-
body: {
|
|
6210
|
+
body: {
|
|
6211
|
+
tag_ext_id: tagId,
|
|
6212
|
+
doc_ext_ids: docIds,
|
|
6213
|
+
note: note ?? null,
|
|
6214
|
+
...citations ? { citations } : {}
|
|
6215
|
+
}
|
|
6169
6216
|
}),
|
|
6170
6217
|
"Failed to create doctags"
|
|
6171
6218
|
);
|
|
@@ -9428,7 +9475,14 @@ var Arbi = class {
|
|
|
9428
9475
|
listUsers: () => listWorkspaceUsers(this.requireClient()),
|
|
9429
9476
|
/** One page of a workspace's activity feed, newest first (see `getWorkspaceActivity`). */
|
|
9430
9477
|
activity: (workspaceId, options) => getWorkspaceActivity(this.requireClient(), workspaceId, options),
|
|
9431
|
-
|
|
9478
|
+
/** Add users to the open workspace; `confirmInvite` also invites emails not on ARBI yet. */
|
|
9479
|
+
addUsers: (emails, role, options) => addWorkspaceUsers(
|
|
9480
|
+
this.requireClient(),
|
|
9481
|
+
emails,
|
|
9482
|
+
role,
|
|
9483
|
+
void 0,
|
|
9484
|
+
options?.confirmInvite
|
|
9485
|
+
),
|
|
9432
9486
|
/**
|
|
9433
9487
|
* Grant users a temporary key scoped to ONE session (identified by its public key), for
|
|
9434
9488
|
* example an agent's run session minted by `agents.authorize()`. Nothing standing is created:
|
|
@@ -9507,12 +9561,26 @@ var Arbi = class {
|
|
|
9507
9561
|
get: (externalIds) => getDocuments(this.requireClient(), externalIds),
|
|
9508
9562
|
/** Every version of a document, oldest first; `is_current` marks the current one. */
|
|
9509
9563
|
versions: (docId) => listVersions(this.requireClient(), docId),
|
|
9564
|
+
/** Save a translation's current version as a new PDF document linked to its original. */
|
|
9565
|
+
finaliseTranslation: (docId) => finaliseTranslation(this.requireClient(), docId),
|
|
9510
9566
|
delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
|
|
9511
9567
|
update: (documents) => updateDocuments(this.requireClient(), documents),
|
|
9512
|
-
uploadUrl: (urls,
|
|
9568
|
+
uploadUrl: (urls, options) => {
|
|
9513
9569
|
this.requireWorkspace();
|
|
9514
|
-
return uploadUrl(
|
|
9570
|
+
return uploadUrl(
|
|
9571
|
+
this.requireClient(),
|
|
9572
|
+
urls,
|
|
9573
|
+
options?.shared,
|
|
9574
|
+
options?.configExtId
|
|
9575
|
+
);
|
|
9515
9576
|
},
|
|
9577
|
+
/**
|
|
9578
|
+
* Upload files in one request (the open workspace, or `options.workspaceExtId`): folder, tag,
|
|
9579
|
+
* sharing, config, a new version of a document.
|
|
9580
|
+
*/
|
|
9581
|
+
upload: (files, options) => uploadDocuments(this.requireClient(), files, options),
|
|
9582
|
+
/** Near-duplicate pairs at or above `threshold` (or one document's, `docId`). */
|
|
9583
|
+
similar: (options) => similarDocuments(this.requireClient(), options),
|
|
9516
9584
|
uploadFile: (fileData, fileName, options) => {
|
|
9517
9585
|
this.requireWorkspace();
|
|
9518
9586
|
return this.recovering(
|
|
@@ -9763,10 +9831,12 @@ var Arbi = class {
|
|
|
9763
9831
|
};
|
|
9764
9832
|
// ── Document Tags ─────────────────────────────────────────────────────
|
|
9765
9833
|
doctags = {
|
|
9766
|
-
|
|
9834
|
+
/** Apply a tag to documents, with a note (a field's value) and the passages it cites. */
|
|
9835
|
+
assign: (tagId, docIds, note, citations) => assignDocTags(this.requireClient(), tagId, docIds, note, citations),
|
|
9767
9836
|
remove: (tagId, docIds) => removeDocTags(this.requireClient(), tagId, docIds),
|
|
9768
9837
|
update: (tagId, docId, updates) => updateDocTag(this.requireClient(), tagId, docId, updates),
|
|
9769
|
-
|
|
9838
|
+
/** Fill the tags' values on the documents with AI (`overwrite`: also where already set). */
|
|
9839
|
+
generate: (tagIds, docIds, options) => generateDocTags(this.requireClient(), tagIds, docIds, options)
|
|
9770
9840
|
};
|
|
9771
9841
|
// ── Contacts ──────────────────────────────────────────────────────────
|
|
9772
9842
|
// A card is sealed under its address book's key, which the calendar key bridge carries: without
|