@arbidocs/sdk 0.4.84 → 0.4.86
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-uyIwS2cN.d.cts → browser-V51dp6kY.d.cts} +251 -117
- package/dist/{browser-uyIwS2cN.d.ts → browser-V51dp6kY.d.ts} +251 -117
- package/dist/browser.cjs +249 -180
- 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 +250 -181
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +249 -180
- 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 +250 -181
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile,
|
|
2
|
-
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as
|
|
1
|
+
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, ba as UploadResult, m as AuthHeaders, b6 as UploadBatchResult, b9 as UploadOptions, b7 as UploadDirectOptions, b8 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-V51dp6kY.cjs';
|
|
2
|
+
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagFieldDefinition, aW as TagKind, aX as TagKindField, aY as TagKindSchema, aZ as TagLinks, a_ as TagListQuery, a$ as TagResponse, b0 as TaskPlan, b1 as TaskPlanStep, b2 as TokenBudgetContext, b3 as UpdateConversationRequest, b5 as UpdateWorkflowRequest, bb as UsageBreakdown, bc as UserDailyUsageResponse, bd as UserInfo, be as UserInputRequestEvent, bf as UserMessageEvent, bg as WebSocketAuthError, bh as WorkStatus, bi as WorkflowAuthMode, bj as WorkflowResponse, bk as WorkflowRunHistoryResponse, bl as WorkflowRunResponse, bm as WorkspaceContext, bn as WsConnection, bo as account, bp as agentconfig, bq as agents, br as assistant, bs as authenticatedFetch, bt as buildDocNameMap, bu as buildFactsContextTool, bv as buildRetrievalChunkTool, bw as buildRetrievalFullContextTool, bx as buildRetrievalTocTool, by as connectWebSocket, bz as connectWithReconnect, bA as consumeSSEStream, bB as contacts, bC as conversations, bD as countCitations, bE as createAuthenticatedClient, bF as createDocumentWaiter, bG as dm, bH as doctags, bI as documents, bJ as facts, bK as files, bL as filterSkills, bM as formatAgentStepLabel, bN as formatFileSize, bO as formatItemLabel, bP as formatStreamSummary, bQ as formatUserName, bR as formatWorkspaceChoices, bS as formatWsMessage, bT as generateEncryptedWorkspaceKey, bU as generateNewWorkspaceKey, bV as getErrorCode, bW as getErrorMessage, bX as getRawWorkspaceKey, bY as health, b_ as identityErrorCode, bZ as identityVerification, b$ as mail, c0 as parseSSEEvents, c1 as parseSlashCommand, c2 as parseSlashTokenInProgress, c3 as performPasswordLogin, c4 as performSigningKeyLogin, c5 as performSsoDeviceFlowLogin, c6 as profile, c7 as projects, c8 as requireData, c9 as requireOk, ca as resolveAuth, cb as resolveCitations, cc as resolveWorkspace, cd as responses, ce as selectWorkspace, cf as selectWorkspaceById, cg as sessions, ch as settings, ci as streamSSE, cj as stripCitationMarkdown, ck as summarizeCitations, cl as tags, cm as work, cn as workflowSteps, co as workflows, cp as workspaces } from './browser-V51dp6kY.cjs';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
|
|
4
4
|
export { LoginProfile } from '@arbidocs/client';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile,
|
|
2
|
-
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as
|
|
1
|
+
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, ba as UploadResult, m as AuthHeaders, b6 as UploadBatchResult, b9 as UploadOptions, b7 as UploadDirectOptions, b8 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-V51dp6kY.js';
|
|
2
|
+
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagFieldDefinition, aW as TagKind, aX as TagKindField, aY as TagKindSchema, aZ as TagLinks, a_ as TagListQuery, a$ as TagResponse, b0 as TaskPlan, b1 as TaskPlanStep, b2 as TokenBudgetContext, b3 as UpdateConversationRequest, b5 as UpdateWorkflowRequest, bb as UsageBreakdown, bc as UserDailyUsageResponse, bd as UserInfo, be as UserInputRequestEvent, bf as UserMessageEvent, bg as WebSocketAuthError, bh as WorkStatus, bi as WorkflowAuthMode, bj as WorkflowResponse, bk as WorkflowRunHistoryResponse, bl as WorkflowRunResponse, bm as WorkspaceContext, bn as WsConnection, bo as account, bp as agentconfig, bq as agents, br as assistant, bs as authenticatedFetch, bt as buildDocNameMap, bu as buildFactsContextTool, bv as buildRetrievalChunkTool, bw as buildRetrievalFullContextTool, bx as buildRetrievalTocTool, by as connectWebSocket, bz as connectWithReconnect, bA as consumeSSEStream, bB as contacts, bC as conversations, bD as countCitations, bE as createAuthenticatedClient, bF as createDocumentWaiter, bG as dm, bH as doctags, bI as documents, bJ as facts, bK as files, bL as filterSkills, bM as formatAgentStepLabel, bN as formatFileSize, bO as formatItemLabel, bP as formatStreamSummary, bQ as formatUserName, bR as formatWorkspaceChoices, bS as formatWsMessage, bT as generateEncryptedWorkspaceKey, bU as generateNewWorkspaceKey, bV as getErrorCode, bW as getErrorMessage, bX as getRawWorkspaceKey, bY as health, b_ as identityErrorCode, bZ as identityVerification, b$ as mail, c0 as parseSSEEvents, c1 as parseSlashCommand, c2 as parseSlashTokenInProgress, c3 as performPasswordLogin, c4 as performSigningKeyLogin, c5 as performSsoDeviceFlowLogin, c6 as profile, c7 as projects, c8 as requireData, c9 as requireOk, ca as resolveAuth, cb as resolveCitations, cc as resolveWorkspace, cd as responses, ce as selectWorkspace, cf as selectWorkspaceById, cg as sessions, ch as settings, ci as streamSSE, cj as stripCitationMarkdown, ck as summarizeCitations, cl as tags, cm as work, cn as workflowSteps, co as workflows, cp as workspaces } from './browser-V51dp6kY.js';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
|
|
4
4
|
export { LoginProfile } from '@arbidocs/client';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs2, { readFileSync } from 'fs';
|
|
2
2
|
import path2, { dirname, resolve } from 'path';
|
|
3
3
|
import os2 from 'os';
|
|
4
|
-
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, bytesToBase64, decryptFile,
|
|
4
|
+
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, bytesToBase64, decryptFile, changePassword } from '@arbidocs/client';
|
|
5
5
|
import { execSync, spawn } from 'child_process';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
@@ -5705,17 +5705,33 @@ function extractResponseText(response) {
|
|
|
5705
5705
|
// src/operations/tags.ts
|
|
5706
5706
|
var tags_exports = {};
|
|
5707
5707
|
__export(tags_exports, {
|
|
5708
|
+
FLAT_TAG_KINDS: () => FLAT_TAG_KINDS,
|
|
5708
5709
|
TAG_FIELD_TYPES: () => TAG_FIELD_TYPES,
|
|
5710
|
+
TAG_KINDS: () => TAG_KINDS,
|
|
5709
5711
|
createTag: () => createTag,
|
|
5710
5712
|
deleteTag: () => deleteTag,
|
|
5711
|
-
|
|
5713
|
+
getTagKind: () => getTagKind,
|
|
5714
|
+
kindFieldWrites: () => kindFieldWrites,
|
|
5715
|
+
listTagKinds: () => listTagKinds,
|
|
5712
5716
|
listTags: () => listTags,
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
tagMatrixColumns: () => tagMatrixColumns,
|
|
5717
|
+
mergeKindFieldDefinitions: () => mergeKindFieldDefinitions,
|
|
5718
|
+
setTagValues: () => setTagValues,
|
|
5716
5719
|
updateTag: () => updateTag,
|
|
5717
|
-
|
|
5720
|
+
updateTagKind: () => updateTagKind
|
|
5718
5721
|
});
|
|
5722
|
+
var withFields = (schema) => ({
|
|
5723
|
+
...schema,
|
|
5724
|
+
fields: schema.fields ?? []
|
|
5725
|
+
});
|
|
5726
|
+
var TAG_KINDS = [
|
|
5727
|
+
"label",
|
|
5728
|
+
"annotation",
|
|
5729
|
+
"issue",
|
|
5730
|
+
"person",
|
|
5731
|
+
"organisation",
|
|
5732
|
+
"search"
|
|
5733
|
+
];
|
|
5734
|
+
var FLAT_TAG_KINDS = ["issue", "person", "organisation"];
|
|
5719
5735
|
var TAG_FIELD_TYPES = [
|
|
5720
5736
|
"text",
|
|
5721
5737
|
"number",
|
|
@@ -5724,8 +5740,20 @@ var TAG_FIELD_TYPES = [
|
|
|
5724
5740
|
"select",
|
|
5725
5741
|
"person"
|
|
5726
5742
|
];
|
|
5727
|
-
async function listTags(arbi) {
|
|
5728
|
-
|
|
5743
|
+
async function listTags(arbi, query = {}) {
|
|
5744
|
+
const params = {};
|
|
5745
|
+
if (query.kind) params.kind = query.kind;
|
|
5746
|
+
if (query.parentId) params.parent = query.parentId;
|
|
5747
|
+
if (query.ids?.length) params.ids = query.ids;
|
|
5748
|
+
if (query.include?.length) params.include = query.include;
|
|
5749
|
+
if (query.linksLimit !== void 0) params.links_limit = query.linksLimit;
|
|
5750
|
+
return requireData(
|
|
5751
|
+
await arbi.fetch.GET(
|
|
5752
|
+
"/v1/tag/",
|
|
5753
|
+
Object.keys(params).length ? { params: { query: params } } : {}
|
|
5754
|
+
),
|
|
5755
|
+
"Failed to fetch tags"
|
|
5756
|
+
);
|
|
5729
5757
|
}
|
|
5730
5758
|
async function createTag(arbi, options) {
|
|
5731
5759
|
return requireData(
|
|
@@ -5735,8 +5763,8 @@ async function createTag(arbi, options) {
|
|
|
5735
5763
|
tag_type: options.tagType ?? { type: "checkbox", options: [] },
|
|
5736
5764
|
instruction: options.instruction ?? null,
|
|
5737
5765
|
shared: options.shared ?? false,
|
|
5766
|
+
...options.kind ? { kind: options.kind } : {},
|
|
5738
5767
|
...options.parentId ? { parent_ext_id: options.parentId } : {},
|
|
5739
|
-
...options.fields ? { fields: options.fields } : {},
|
|
5740
5768
|
...options.fieldValues ? { field_values: options.fieldValues } : {}
|
|
5741
5769
|
}
|
|
5742
5770
|
}),
|
|
@@ -5755,48 +5783,47 @@ async function updateTag(arbi, tagId, change) {
|
|
|
5755
5783
|
return requireData(
|
|
5756
5784
|
await arbi.fetch.PATCH("/v1/tag/{tag_ext_id}", {
|
|
5757
5785
|
params: { path: { tag_ext_id: tagId } },
|
|
5758
|
-
body:
|
|
5786
|
+
body: change
|
|
5759
5787
|
}),
|
|
5760
5788
|
"Failed to update tag"
|
|
5761
5789
|
);
|
|
5762
5790
|
}
|
|
5763
|
-
async function
|
|
5764
|
-
|
|
5765
|
-
if (change.fields) body.fields = change.fields;
|
|
5766
|
-
if (change.values) body.field_values = change.values;
|
|
5767
|
-
return updateTag(arbi, tagId, body);
|
|
5791
|
+
async function setTagValues(arbi, tagId, values) {
|
|
5792
|
+
return updateTag(arbi, tagId, { field_values: values });
|
|
5768
5793
|
}
|
|
5769
|
-
async function
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
return requireData(
|
|
5773
|
-
await arbi.fetch.GET("/v1/tag/matrix", { params: { query } }),
|
|
5774
|
-
"Failed to fetch the tag matrix"
|
|
5794
|
+
async function listTagKinds(arbi) {
|
|
5795
|
+
return requireData(await arbi.fetch.GET("/v1/tag/kinds"), "Failed to fetch tag kinds").map(
|
|
5796
|
+
withFields
|
|
5775
5797
|
);
|
|
5776
5798
|
}
|
|
5777
|
-
function
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
return columns;
|
|
5799
|
+
async function getTagKind(arbi, kind) {
|
|
5800
|
+
return withFields(
|
|
5801
|
+
requireData(
|
|
5802
|
+
await arbi.fetch.GET("/v1/tag/kinds/{kind}", { params: { path: { kind } } }),
|
|
5803
|
+
"Failed to fetch the tag kind"
|
|
5804
|
+
)
|
|
5805
|
+
);
|
|
5785
5806
|
}
|
|
5786
|
-
function
|
|
5787
|
-
return (
|
|
5807
|
+
async function updateTagKind(arbi, kind, fields) {
|
|
5808
|
+
return withFields(
|
|
5809
|
+
requireData(
|
|
5810
|
+
await arbi.fetch.PUT("/v1/tag/kinds/{kind}", {
|
|
5811
|
+
params: { path: { kind } },
|
|
5812
|
+
body: { fields }
|
|
5813
|
+
}),
|
|
5814
|
+
"Failed to update the tag kind"
|
|
5815
|
+
)
|
|
5816
|
+
);
|
|
5788
5817
|
}
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
const byName = new Map(
|
|
5818
|
+
var kindFieldWrites = (fields) => fields.map((f2) => ({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null }));
|
|
5819
|
+
function mergeKindFieldDefinitions(current, wanted, { keepOthers = false } = {}) {
|
|
5820
|
+
const byName = new Map(current.map((f2) => [f2.name.toLowerCase(), f2]));
|
|
5792
5821
|
const out = wanted.map((w2) => {
|
|
5793
5822
|
const old = w2.id ? void 0 : byName.get(w2.name.trim().toLowerCase());
|
|
5794
5823
|
return old ? { ...w2, id: old.id } : w2;
|
|
5795
5824
|
});
|
|
5796
5825
|
if (keepOthers) {
|
|
5797
|
-
for (const f2 of
|
|
5798
|
-
if (!out.some((w2) => w2.id === f2.id))
|
|
5799
|
-
out.push({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null });
|
|
5826
|
+
for (const f2 of kindFieldWrites(current)) if (!out.some((w2) => w2.id === f2.id)) out.push(f2);
|
|
5800
5827
|
}
|
|
5801
5828
|
return out;
|
|
5802
5829
|
}
|
|
@@ -7610,6 +7637,137 @@ async function remindFact(arbi, factId, options = {}) {
|
|
|
7610
7637
|
);
|
|
7611
7638
|
}
|
|
7612
7639
|
|
|
7640
|
+
// src/operations/mail.ts
|
|
7641
|
+
var mail_exports = {};
|
|
7642
|
+
__export(mail_exports, {
|
|
7643
|
+
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
7644
|
+
attachmentFromBytes: () => attachmentFromBytes,
|
|
7645
|
+
claimNativeAlias: () => claimNativeAlias,
|
|
7646
|
+
createMailFetch: () => createMailFetch,
|
|
7647
|
+
downloadAttachment: () => downloadAttachment,
|
|
7648
|
+
getMailPolicy: () => getMailPolicy,
|
|
7649
|
+
getMessage: () => getMessage2,
|
|
7650
|
+
listFolders: () => listFolders,
|
|
7651
|
+
listMailAccounts: () => listMailAccounts,
|
|
7652
|
+
listMessages: () => listMessages,
|
|
7653
|
+
saveDraft: () => saveDraft,
|
|
7654
|
+
sendMessage: () => sendMessage,
|
|
7655
|
+
unlockNativeMail: () => unlockNativeMail,
|
|
7656
|
+
updateMessage: () => updateMessage
|
|
7657
|
+
});
|
|
7658
|
+
var NATIVE_ACCOUNT = "native";
|
|
7659
|
+
function createMailFetch(auth) {
|
|
7660
|
+
return (path4, init = {}) => authenticatedFetch({
|
|
7661
|
+
...auth,
|
|
7662
|
+
path: `/v1/mail${path4}`,
|
|
7663
|
+
method: init.method,
|
|
7664
|
+
body: init.body,
|
|
7665
|
+
headers: {
|
|
7666
|
+
...init.body ? { "Content-Type": "application/json" } : {},
|
|
7667
|
+
...init.headers
|
|
7668
|
+
}
|
|
7669
|
+
});
|
|
7670
|
+
}
|
|
7671
|
+
async function json(response) {
|
|
7672
|
+
return (await response).json();
|
|
7673
|
+
}
|
|
7674
|
+
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
7675
|
+
function getMailPolicy(mail) {
|
|
7676
|
+
return json(mail("/policy"));
|
|
7677
|
+
}
|
|
7678
|
+
function listMailAccounts(mail) {
|
|
7679
|
+
return json(mail("/accounts"));
|
|
7680
|
+
}
|
|
7681
|
+
async function claimNativeAlias(mail, alias) {
|
|
7682
|
+
const { email } = await json(
|
|
7683
|
+
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
7684
|
+
);
|
|
7685
|
+
return email;
|
|
7686
|
+
}
|
|
7687
|
+
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
7688
|
+
return json(mail(`${accountPath(accountId)}/folders`));
|
|
7689
|
+
}
|
|
7690
|
+
function listMessages(mail, options) {
|
|
7691
|
+
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
7692
|
+
if (options.query) params.set("q", options.query);
|
|
7693
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
7694
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
7695
|
+
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
7696
|
+
}
|
|
7697
|
+
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
7698
|
+
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
7699
|
+
}
|
|
7700
|
+
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
7701
|
+
const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
7702
|
+
return new Uint8Array(await (await mail(path4)).arrayBuffer());
|
|
7703
|
+
}
|
|
7704
|
+
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
7705
|
+
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
7706
|
+
method: "PATCH",
|
|
7707
|
+
body: JSON.stringify(update)
|
|
7708
|
+
});
|
|
7709
|
+
}
|
|
7710
|
+
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
7711
|
+
return json(
|
|
7712
|
+
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
7713
|
+
);
|
|
7714
|
+
}
|
|
7715
|
+
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
7716
|
+
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
7717
|
+
return json(
|
|
7718
|
+
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
7719
|
+
);
|
|
7720
|
+
}
|
|
7721
|
+
async function unlockNativeMail(mail, keys) {
|
|
7722
|
+
await initSodium();
|
|
7723
|
+
const secretKey = deriveEncryptionKeypairFromSigning({
|
|
7724
|
+
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
7725
|
+
secretKey: keys.signingPrivateKey
|
|
7726
|
+
}).secretKey;
|
|
7727
|
+
try {
|
|
7728
|
+
let cursor = 0;
|
|
7729
|
+
while (cursor !== null) {
|
|
7730
|
+
const page = await json(
|
|
7731
|
+
mail(`/native/keys?cursor=${cursor}`)
|
|
7732
|
+
);
|
|
7733
|
+
const sealed = {};
|
|
7734
|
+
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
7735
|
+
const key = sealedBoxDecrypt(wrapped, secretKey);
|
|
7736
|
+
try {
|
|
7737
|
+
sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
|
|
7738
|
+
} finally {
|
|
7739
|
+
key.fill(0);
|
|
7740
|
+
}
|
|
7741
|
+
}
|
|
7742
|
+
if (Object.keys(sealed).length) {
|
|
7743
|
+
await mail("/native/session-keys", {
|
|
7744
|
+
method: "POST",
|
|
7745
|
+
body: JSON.stringify({ keys: sealed })
|
|
7746
|
+
});
|
|
7747
|
+
}
|
|
7748
|
+
cursor = page.next_cursor;
|
|
7749
|
+
}
|
|
7750
|
+
} finally {
|
|
7751
|
+
secretKey.fill(0);
|
|
7752
|
+
}
|
|
7753
|
+
}
|
|
7754
|
+
function attachmentFromBytes(name, contentType, bytes) {
|
|
7755
|
+
return {
|
|
7756
|
+
id: "",
|
|
7757
|
+
name,
|
|
7758
|
+
content_type: contentType,
|
|
7759
|
+
size: bytes.length,
|
|
7760
|
+
content_base64: bytesToBase642(bytes)
|
|
7761
|
+
};
|
|
7762
|
+
}
|
|
7763
|
+
function bytesToBase642(bytes) {
|
|
7764
|
+
let binary = "";
|
|
7765
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
7766
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
7767
|
+
}
|
|
7768
|
+
return btoa(binary);
|
|
7769
|
+
}
|
|
7770
|
+
|
|
7613
7771
|
// src/arbi.ts
|
|
7614
7772
|
function tokenExpiresWithin(token, seconds) {
|
|
7615
7773
|
const payload = token?.split(".")[1];
|
|
@@ -7972,25 +8130,22 @@ var Arbi = class {
|
|
|
7972
8130
|
return result;
|
|
7973
8131
|
},
|
|
7974
8132
|
/**
|
|
7975
|
-
* Change (or, after recovery, set) the master password
|
|
7976
|
-
*
|
|
7977
|
-
*
|
|
8133
|
+
* Change (or, after recovery, set) the master password. Omit `currentPassword` in recovery
|
|
8134
|
+
* mode. One request: the account identity is re-wrapped under the new password and nothing is
|
|
8135
|
+
* re-encrypted, so the session, the workspace keys and the recovery key all stay as they are.
|
|
7978
8136
|
*/
|
|
7979
8137
|
changePassword: async (params) => {
|
|
7980
8138
|
const client = this.requireClient();
|
|
7981
8139
|
const lr2 = this.requireLogin();
|
|
7982
8140
|
const email = client.session.getState().userEmail ?? this.userProfile?.email;
|
|
7983
8141
|
if (!email) throw new ArbiError("The account email is unknown; sign in again.");
|
|
7984
|
-
|
|
7985
|
-
{ ...params, email,
|
|
8142
|
+
await changePassword(
|
|
8143
|
+
{ ...params, email, identitySecretKey: lr2.signingPrivateKey },
|
|
7986
8144
|
{
|
|
7987
8145
|
fetchClient: client.fetch,
|
|
7988
8146
|
deploymentDomain: this.getDeploymentDomain()
|
|
7989
8147
|
}
|
|
7990
8148
|
);
|
|
7991
|
-
this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
|
|
7992
|
-
this.wrappedKeys.clear();
|
|
7993
|
-
return result;
|
|
7994
8149
|
},
|
|
7995
8150
|
/** Close the account (soft delete) and sign out. Refused while a subscription is active. */
|
|
7996
8151
|
requestDeletion: async () => {
|
|
@@ -8260,6 +8415,39 @@ var Arbi = class {
|
|
|
8260
8415
|
return response;
|
|
8261
8416
|
})
|
|
8262
8417
|
};
|
|
8418
|
+
/**
|
|
8419
|
+
* Mail transport for `/v1/mail` (the native inbox and connected accounts), with normal session
|
|
8420
|
+
* recovery. Pass `fetch` to the `mail` operations, e.g. `mail.listFolders(arbi.mail.fetch)`.
|
|
8421
|
+
*/
|
|
8422
|
+
mail = {
|
|
8423
|
+
/** Fetch a path under `/v1/mail`; rejects a non-2xx response with an `ArbiApiError` (`status`). */
|
|
8424
|
+
fetch: (path4, init = {}) => this.recovering(async () => {
|
|
8425
|
+
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
8426
|
+
const headers = new Headers(init.headers);
|
|
8427
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
8428
|
+
if (init.body && !headers.has("Content-Type"))
|
|
8429
|
+
headers.set("Content-Type", "application/json");
|
|
8430
|
+
const response = await fetch(`${baseUrl}/v1/mail${path4}`, { ...init, headers });
|
|
8431
|
+
if (!response.ok) {
|
|
8432
|
+
const body = await response.json().catch(() => null);
|
|
8433
|
+
throw new ArbiApiError(
|
|
8434
|
+
typeof body?.detail === "string" ? body.detail : "The mail request could not be completed",
|
|
8435
|
+
body,
|
|
8436
|
+
response.status
|
|
8437
|
+
);
|
|
8438
|
+
}
|
|
8439
|
+
return response;
|
|
8440
|
+
}),
|
|
8441
|
+
/** Unlock the signed-in user's native inbox for this server session (see `unlockNativeMail`). */
|
|
8442
|
+
unlockNative: () => {
|
|
8443
|
+
const login = this.loginResult;
|
|
8444
|
+
if (!login) return Promise.reject(new ArbiError("Sign in to unlock your inbox"));
|
|
8445
|
+
return unlockNativeMail(this.mail.fetch, {
|
|
8446
|
+
signingPrivateKey: login.signingPrivateKey,
|
|
8447
|
+
serverSessionKey: login.serverSessionKey
|
|
8448
|
+
});
|
|
8449
|
+
}
|
|
8450
|
+
};
|
|
8263
8451
|
// ── Assistant ─────────────────────────────────────────────────────────
|
|
8264
8452
|
assistant = {
|
|
8265
8453
|
cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
|
|
@@ -8332,17 +8520,29 @@ var Arbi = class {
|
|
|
8332
8520
|
};
|
|
8333
8521
|
// ── Tags ──────────────────────────────────────────────────────────────
|
|
8334
8522
|
tags = {
|
|
8335
|
-
|
|
8523
|
+
/**
|
|
8524
|
+
* The workspace's tags, filtered (`kind`, `parentId`, `ids`) and with `include: ['links']`
|
|
8525
|
+
* each tag's documents, facts and threads: `list({ kind: 'issue', include: ['links'] })` is the
|
|
8526
|
+
* issue table's rows (its columns: `tagKinds.get('issue')`).
|
|
8527
|
+
*/
|
|
8528
|
+
list: (query) => listTags(this.requireClient(), query),
|
|
8336
8529
|
create: (options) => createTag(this.requireClient(), {
|
|
8337
8530
|
...options,
|
|
8338
8531
|
workspaceId: options.workspaceId ?? this.requireWorkspace()
|
|
8339
8532
|
}),
|
|
8340
8533
|
delete: (tagId) => deleteTag(this.requireClient(), tagId),
|
|
8341
8534
|
update: (tagId, change) => updateTag(this.requireClient(), tagId, change),
|
|
8342
|
-
/**
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8535
|
+
/** Merge-patch a tag's values for its kind's fields (`null` clears one). */
|
|
8536
|
+
setValues: (tagId, values) => setTagValues(this.requireClient(), tagId, values)
|
|
8537
|
+
};
|
|
8538
|
+
// ── Tag kinds: the workspace's fields per kind (a table's columns) ─────
|
|
8539
|
+
tagKinds = {
|
|
8540
|
+
/** Every kind's fields (the built-in ones where the workspace has not set its own). */
|
|
8541
|
+
list: () => listTagKinds(this.requireClient()),
|
|
8542
|
+
/** A kind's fields: the columns of a table of its tags. */
|
|
8543
|
+
get: (kind) => getTagKind(this.requireClient(), kind),
|
|
8544
|
+
/** Set a kind's fields in full (ids keep fields and their values; the rest are new). */
|
|
8545
|
+
update: (kind, fields) => updateTagKind(this.requireClient(), kind, fields)
|
|
8346
8546
|
};
|
|
8347
8547
|
// ── Document Tags ─────────────────────────────────────────────────────
|
|
8348
8548
|
doctags = {
|
|
@@ -9311,137 +9511,6 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
9311
9511
|
}
|
|
9312
9512
|
}
|
|
9313
9513
|
|
|
9314
|
-
// src/operations/mail.ts
|
|
9315
|
-
var mail_exports = {};
|
|
9316
|
-
__export(mail_exports, {
|
|
9317
|
-
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
9318
|
-
attachmentFromBytes: () => attachmentFromBytes,
|
|
9319
|
-
claimNativeAlias: () => claimNativeAlias,
|
|
9320
|
-
createMailFetch: () => createMailFetch,
|
|
9321
|
-
downloadAttachment: () => downloadAttachment,
|
|
9322
|
-
getMailPolicy: () => getMailPolicy,
|
|
9323
|
-
getMessage: () => getMessage2,
|
|
9324
|
-
listFolders: () => listFolders,
|
|
9325
|
-
listMailAccounts: () => listMailAccounts,
|
|
9326
|
-
listMessages: () => listMessages,
|
|
9327
|
-
saveDraft: () => saveDraft,
|
|
9328
|
-
sendMessage: () => sendMessage,
|
|
9329
|
-
unlockNativeMail: () => unlockNativeMail,
|
|
9330
|
-
updateMessage: () => updateMessage
|
|
9331
|
-
});
|
|
9332
|
-
var NATIVE_ACCOUNT = "native";
|
|
9333
|
-
function createMailFetch(auth) {
|
|
9334
|
-
return (path4, init = {}) => authenticatedFetch({
|
|
9335
|
-
...auth,
|
|
9336
|
-
path: `/v1/mail${path4}`,
|
|
9337
|
-
method: init.method,
|
|
9338
|
-
body: init.body,
|
|
9339
|
-
headers: {
|
|
9340
|
-
...init.body ? { "Content-Type": "application/json" } : {},
|
|
9341
|
-
...init.headers
|
|
9342
|
-
}
|
|
9343
|
-
});
|
|
9344
|
-
}
|
|
9345
|
-
async function json(response) {
|
|
9346
|
-
return (await response).json();
|
|
9347
|
-
}
|
|
9348
|
-
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
9349
|
-
function getMailPolicy(mail) {
|
|
9350
|
-
return json(mail("/policy"));
|
|
9351
|
-
}
|
|
9352
|
-
function listMailAccounts(mail) {
|
|
9353
|
-
return json(mail("/accounts"));
|
|
9354
|
-
}
|
|
9355
|
-
async function claimNativeAlias(mail, alias) {
|
|
9356
|
-
const { email } = await json(
|
|
9357
|
-
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
9358
|
-
);
|
|
9359
|
-
return email;
|
|
9360
|
-
}
|
|
9361
|
-
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
9362
|
-
return json(mail(`${accountPath(accountId)}/folders`));
|
|
9363
|
-
}
|
|
9364
|
-
function listMessages(mail, options) {
|
|
9365
|
-
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
9366
|
-
if (options.query) params.set("q", options.query);
|
|
9367
|
-
if (options.cursor) params.set("cursor", options.cursor);
|
|
9368
|
-
if (options.limit) params.set("limit", String(options.limit));
|
|
9369
|
-
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
9370
|
-
}
|
|
9371
|
-
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
9372
|
-
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
9373
|
-
}
|
|
9374
|
-
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
9375
|
-
const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
9376
|
-
return new Uint8Array(await (await mail(path4)).arrayBuffer());
|
|
9377
|
-
}
|
|
9378
|
-
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
9379
|
-
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
9380
|
-
method: "PATCH",
|
|
9381
|
-
body: JSON.stringify(update)
|
|
9382
|
-
});
|
|
9383
|
-
}
|
|
9384
|
-
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
9385
|
-
return json(
|
|
9386
|
-
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
9387
|
-
);
|
|
9388
|
-
}
|
|
9389
|
-
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
9390
|
-
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
9391
|
-
return json(
|
|
9392
|
-
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
9393
|
-
);
|
|
9394
|
-
}
|
|
9395
|
-
async function unlockNativeMail(mail, keys) {
|
|
9396
|
-
await initSodium();
|
|
9397
|
-
const secretKey = deriveEncryptionKeypairFromSigning({
|
|
9398
|
-
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
9399
|
-
secretKey: keys.signingPrivateKey
|
|
9400
|
-
}).secretKey;
|
|
9401
|
-
try {
|
|
9402
|
-
let cursor = 0;
|
|
9403
|
-
while (cursor !== null) {
|
|
9404
|
-
const page = await json(
|
|
9405
|
-
mail(`/native/keys?cursor=${cursor}`)
|
|
9406
|
-
);
|
|
9407
|
-
const sealed = {};
|
|
9408
|
-
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
9409
|
-
const key = sealedBoxDecrypt(wrapped, secretKey);
|
|
9410
|
-
try {
|
|
9411
|
-
sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
|
|
9412
|
-
} finally {
|
|
9413
|
-
key.fill(0);
|
|
9414
|
-
}
|
|
9415
|
-
}
|
|
9416
|
-
if (Object.keys(sealed).length) {
|
|
9417
|
-
await mail("/native/session-keys", {
|
|
9418
|
-
method: "POST",
|
|
9419
|
-
body: JSON.stringify({ keys: sealed })
|
|
9420
|
-
});
|
|
9421
|
-
}
|
|
9422
|
-
cursor = page.next_cursor;
|
|
9423
|
-
}
|
|
9424
|
-
} finally {
|
|
9425
|
-
secretKey.fill(0);
|
|
9426
|
-
}
|
|
9427
|
-
}
|
|
9428
|
-
function attachmentFromBytes(name, contentType, bytes) {
|
|
9429
|
-
return {
|
|
9430
|
-
id: "",
|
|
9431
|
-
name,
|
|
9432
|
-
content_type: contentType,
|
|
9433
|
-
size: bytes.length,
|
|
9434
|
-
content_base64: bytesToBase642(bytes)
|
|
9435
|
-
};
|
|
9436
|
-
}
|
|
9437
|
-
function bytesToBase642(bytes) {
|
|
9438
|
-
let binary = "";
|
|
9439
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
9440
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
9441
|
-
}
|
|
9442
|
-
return btoa(binary);
|
|
9443
|
-
}
|
|
9444
|
-
|
|
9445
9514
|
// src/operations/mail-node.ts
|
|
9446
9515
|
var mail_node_exports = {};
|
|
9447
9516
|
__export(mail_node_exports, {
|