@arbidocs/react 0.5.152 → 0.5.154

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.
Files changed (61) hide show
  1. package/dist/artifacts/index.cjs +14 -14
  2. package/dist/calls/livekit/index.cjs +48 -48
  3. package/dist/{chunk-VXFTVWEI.cjs → chunk-4VHECR5O.cjs} +44 -44
  4. package/dist/{chunk-VXFTVWEI.cjs.map → chunk-4VHECR5O.cjs.map} +1 -1
  5. package/dist/{chunk-GFX7LQGR.cjs → chunk-5LKTSVTE.cjs} +66 -66
  6. package/dist/{chunk-GFX7LQGR.cjs.map → chunk-5LKTSVTE.cjs.map} +1 -1
  7. package/dist/{chunk-P2DPOZBS.cjs → chunk-5ZNO77YB.cjs} +11 -2
  8. package/dist/chunk-5ZNO77YB.cjs.map +1 -0
  9. package/dist/{chunk-BI7HFGXF.cjs → chunk-H2TP7JWR.cjs} +10 -10
  10. package/dist/{chunk-BI7HFGXF.cjs.map → chunk-H2TP7JWR.cjs.map} +1 -1
  11. package/dist/{chunk-WJIRX5MS.cjs → chunk-XQLJSNAL.cjs} +3 -3
  12. package/dist/{chunk-WJIRX5MS.cjs.map → chunk-XQLJSNAL.cjs.map} +1 -1
  13. package/dist/{chunk-MK5L56Z3.cjs → chunk-ZBCTLPO5.cjs} +57 -57
  14. package/dist/{chunk-MK5L56Z3.cjs.map → chunk-ZBCTLPO5.cjs.map} +1 -1
  15. package/dist/{chunk-SKJWJ3OY.cjs → chunk-ZELH6W5C.cjs} +37 -37
  16. package/dist/{chunk-SKJWJ3OY.cjs.map → chunk-ZELH6W5C.cjs.map} +1 -1
  17. package/dist/datasets/aggregate-source.js +133 -0
  18. package/dist/datasets/aggregate-source.js.map +7 -0
  19. package/dist/datasets/aggregate.js +72 -22
  20. package/dist/datasets/aggregate.js.map +2 -2
  21. package/dist/datasets/index.js +32 -2
  22. package/dist/datasets/index.js.map +2 -2
  23. package/dist/datasets/pages.js +70 -7
  24. package/dist/datasets/pages.js.map +2 -2
  25. package/dist/datasets/sources/activity.js +44 -9
  26. package/dist/datasets/sources/activity.js.map +2 -2
  27. package/dist/datasets/sources/conversations.js +37 -7
  28. package/dist/datasets/sources/conversations.js.map +2 -2
  29. package/dist/datasets/sources/documents.js +44 -6
  30. package/dist/datasets/sources/documents.js.map +2 -2
  31. package/dist/datasets/sources/facts.js +31 -5
  32. package/dist/datasets/sources/facts.js.map +3 -3
  33. package/dist/datasets/sources/tags.js +37 -5
  34. package/dist/datasets/sources/tags.js.map +3 -3
  35. package/dist/datasets/sources/usage.js +29 -32
  36. package/dist/datasets/sources/usage.js.map +2 -2
  37. package/dist/datasets/sources/workflows.js +56 -22
  38. package/dist/datasets/sources/workflows.js.map +2 -2
  39. package/dist/datasets/workspace-aggregate.js +64 -0
  40. package/dist/datasets/workspace-aggregate.js.map +7 -0
  41. package/dist/document-tools/core.cjs +100 -100
  42. package/dist/document-tools/core.d.ts +2 -2
  43. package/dist/document-tools/index.cjs +102 -102
  44. package/dist/document-tools/index.d.ts +2 -2
  45. package/dist/{file-shares.d-CamKxNLC.d.ts → file-shares.d-CyTnJ2Re.d.ts} +11 -0
  46. package/dist/index.cjs +2309 -1787
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.ts +196 -7
  49. package/dist/index.js +11 -2
  50. package/dist/index.js.map +2 -2
  51. package/dist/projects.js +9 -0
  52. package/dist/projects.js.map +2 -2
  53. package/dist/query-keys.js +9 -0
  54. package/dist/query-keys.js.map +2 -2
  55. package/dist/storage.js +24 -1
  56. package/dist/storage.js.map +2 -2
  57. package/dist/table-views.js +19 -1
  58. package/dist/table-views.js.map +2 -2
  59. package/dist/ui/index.cjs +168 -168
  60. package/package.json +3 -3
  61. package/dist/chunk-P2DPOZBS.cjs.map +0 -1
package/dist/projects.js CHANGED
@@ -23,7 +23,16 @@ function useProjectConversationUsage(projectExtId, monthsBack = 0, options) {
23
23
  enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
24
24
  });
25
25
  }
26
+ function useOwnedProjectsUsage(monthsBack = 0, options) {
27
+ const arbi = useArbi();
28
+ return useQuery({
29
+ queryKey: arbiQueryKeys.ownedProjectsUsage(monthsBack),
30
+ queryFn: () => arbi.projects.usageOfOwned(monthsBack),
31
+ enabled: (options?.enabled ?? true) && arbi.isLoggedIn
32
+ });
33
+ }
26
34
  export {
35
+ useOwnedProjectsUsage,
27
36
  useProjectConversationUsage,
28
37
  useUpdateProjectFields
29
38
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/projects.ts"],
4
- "sourcesContent": ["/**\n * Project details (budget, client, stage, lead, fields) and spend by conversation.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport type {\n ProjectConversationUsageResponse,\n ProjectResponse,\n ProjectUpdateRequest,\n} from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './hooks'\n\n/**\n * Patch a project (owner only): name, daily cap, and the details a host sets (`budget` in minor\n * units, `client`, `client_ref`, `stage`, `lead_user`, `fields` merged key by key, `field_schema`).\n * The project list and the workspace list (which carries project names) refresh.\n */\nexport function useUpdateProjectFields() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n patch,\n }: {\n projectExtId: string\n patch: ProjectUpdateRequest\n }): Promise<ProjectResponse> => arbi.projects.update(projectExtId, patch),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n // Each workspace carries its project's name: a rename shows there at once.\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n },\n })\n}\n\n/** A project's spend by conversation (and what no conversation accounts for), in \u00A3. */\nexport function useProjectConversationUsage(\n projectExtId: string | undefined,\n monthsBack: number = 0,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.projectConversationUsage(projectExtId ?? '', monthsBack),\n queryFn: (): Promise<ProjectConversationUsageResponse> =>\n arbi.projects.usageByConversation(projectExtId as string, monthsBack),\n enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn,\n })\n}\n"],
5
- "mappings": "AAMA,SAAS,aAAa,UAAU,sBAAsB;AAMtD,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAOvB,SAAS,yBAAyB;AACvC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGgC,KAAK,SAAS,OAAO,cAAc,KAAK;AAAA,IACxE,WAAW,MAAM;AACf,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAEhE,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,IACpE;AAAA,EACF,CAAC;AACH;AAGO,SAAS,4BACd,cACA,aAAqB,GACrB,SACA;AACA,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,yBAAyB,gBAAgB,IAAI,UAAU;AAAA,IAC/E,SAAS,MACP,KAAK,SAAS,oBAAoB,cAAwB,UAAU;AAAA,IACtE,UAAU,SAAS,WAAW,SAAS,CAAC,CAAC,gBAAgB,KAAK;AAAA,EAChE,CAAC;AACH;",
4
+ "sourcesContent": ["/**\n * Project details (budget, client, stage, lead, fields), spend by conversation, and the usage of\n * every project the user owns.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport type {\n ProjectConversationUsageResponse,\n ProjectResponse,\n ProjectUpdateRequest,\n ProjectsUsageResponse,\n} from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './hooks'\n\n/**\n * Patch a project (owner only): name, daily cap, and the details a host sets (`budget` in minor\n * units, `client`, `client_ref`, `stage`, `lead_user`, `fields` merged key by key, `field_schema`).\n * The project list and the workspace list (which carries project names) refresh.\n */\nexport function useUpdateProjectFields() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n patch,\n }: {\n projectExtId: string\n patch: ProjectUpdateRequest\n }): Promise<ProjectResponse> => arbi.projects.update(projectExtId, patch),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n // Each workspace carries its project's name: a rename shows there at once.\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n },\n })\n}\n\n/** A project's spend by conversation (and what no conversation accounts for), in \u00A3. */\nexport function useProjectConversationUsage(\n projectExtId: string | undefined,\n monthsBack: number = 0,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.projectConversationUsage(projectExtId ?? '', monthsBack),\n queryFn: (): Promise<ProjectConversationUsageResponse> =>\n arbi.projects.usageByConversation(projectExtId as string, monthsBack),\n enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn,\n })\n}\n\n/**\n * The AI usage of every project the user owns, each for its billing period `monthsBack` periods\n * ago, in one read (only an owner reads a project's usage; one that cannot be read has `usage:\n * null`). For a dashboard of all the user's projects; one project's own view reads\n * `useProjectUsage`.\n */\nexport function useOwnedProjectsUsage(monthsBack: number = 0, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.ownedProjectsUsage(monthsBack),\n queryFn: (): Promise<ProjectsUsageResponse> => arbi.projects.usageOfOwned(monthsBack),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n"],
5
+ "mappings": "AAOA,SAAS,aAAa,UAAU,sBAAsB;AAOtD,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAOvB,SAAS,yBAAyB;AACvC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGgC,KAAK,SAAS,OAAO,cAAc,KAAK;AAAA,IACxE,WAAW,MAAM;AACf,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAEhE,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,IACpE;AAAA,EACF,CAAC;AACH;AAGO,SAAS,4BACd,cACA,aAAqB,GACrB,SACA;AACA,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,yBAAyB,gBAAgB,IAAI,UAAU;AAAA,IAC/E,SAAS,MACP,KAAK,SAAS,oBAAoB,cAAwB,UAAU;AAAA,IACtE,UAAU,SAAS,WAAW,SAAS,CAAC,CAAC,gBAAgB,KAAK;AAAA,EAChE,CAAC;AACH;AAQO,SAAS,sBAAsB,aAAqB,GAAG,SAAiC;AAC7F,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,mBAAmB,UAAU;AAAA,IACrD,SAAS,MAAsC,KAAK,SAAS,aAAa,UAAU;AAAA,IACpF,UAAU,SAAS,WAAW,SAAS,KAAK;AAAA,EAC9C,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -72,6 +72,8 @@ const arbiQueryKeys = {
72
72
  workspaceActivity: (workspaceId, limit) => limit === void 0 ? ["arbi", "workspaceActivity", workspaceId] : ["arbi", "workspaceActivity", workspaceId, limit],
73
73
  projects: () => ["arbi", "projects"],
74
74
  projectUsage: (projectExtId, monthsBack) => ["arbi", "projectUsage", projectExtId, monthsBack],
75
+ /** The usage of every project the user owns, in one read (under `projectUsage`'s prefix). */
76
+ ownedProjectsUsage: (monthsBack) => ["arbi", "projectUsage", "owned", monthsBack],
75
77
  projectConversationUsage: (projectExtId, monthsBack) => ["arbi", "projectUsage", projectExtId, "byConversation", monthsBack],
76
78
  projectInvoices: (projectExtId) => ["arbi", "projectInvoices", projectExtId],
77
79
  /** The plans and add-ons on sale. */
@@ -163,6 +165,13 @@ const arbiQueryKeys = {
163
165
  * no target: every table's; no workspace: every workspace's.
164
166
  */
165
167
  tableViews: (workspaceId, target) => workspaceId === void 0 ? ["arbi", "table-views"] : target === void 0 ? ["arbi", "table-views", workspaceId] : ["arbi", "table-views", workspaceId, target],
168
+ /**
169
+ * A view's rows with its database (a page's table block), under `databaseRows`' prefix so every
170
+ * row write refreshes it: the database is the view's, unknown until read.
171
+ */
172
+ tableViewRows: (workspaceId, viewId) => ["arbi", "databases", "rows", workspaceId, "", { view: viewId }],
173
+ /** A workspace's items counted on the server (a chart); no workspace: every workspace's. */
174
+ workspaceAggregate: (workspaceId, query) => workspaceId === void 0 ? ["arbi", "workspaceAggregate"] : ["arbi", "workspaceAggregate", workspaceId, query ?? {}],
166
175
  /** A database's rows grouped and measured (a chart); no workspace: every database's. */
167
176
  databaseAggregate: (workspaceId, databaseId, request) => workspaceId === void 0 ? ["arbi", "databases", "aggregate"] : ["arbi", "databases", "aggregate", workspaceId, databaseId ?? "", request ?? {}],
168
177
  // ── Configs, health ─────────────────────────────────────────────────────────────────────────
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/query-keys.ts"],
4
- "sourcesContent": ["/**\n * The one query-key factory of the ARBI front end: every React Query key and mutation key the\n * packages and the app use is built here, under `['arbi', \u2026]`. Literal key arrays anywhere else\n * fail the `arbi/query-keys-from-factory` lint rule and `query-keys.guard.test.ts`, so a key can't\n * drift from the queries it names (a stale literal reads or invalidates nothing, silently).\n *\n * Dependency-free on purpose (types only): e2e helpers import it and pass keys into the page.\n */\n\nimport type {\n CalendarWindow,\n ListEventsParams,\n OverlayLayerName,\n RoomQuery,\n} from '@arbidocs/sdk/browser'\n\nexport const arbiQueryKeys = {\n fileShares: () => ['arbi', 'fileShares'] as const,\n fileShare: (id: string) => ['arbi', 'fileShare', id] as const,\n fileSharePdf: (id: string, status?: string) => ['arbi', 'fileSharePdf', id, status] as const,\n workspaces: () => ['arbi', 'workspaces'] as const,\n /** Every workspace's member list: what a workspace switch drops. */\n allWorkspaceUsers: () => ['arbi', 'workspaceUsers'] as const,\n workspaceUsers: (workspaceId: string) => ['arbi', 'workspaceUsers', workspaceId] as const,\n /** Every workspace's documents list: the prefix a write patches when it does not know the workspace. */\n allDocuments: () => ['arbi', 'documents'] as const,\n documents: (workspaceId: string) => ['arbi', 'documents', workspaceId] as const,\n /** One document (a viewer's); writes keep it current next to the list. */\n document: (docId: string) => ['arbi', 'document', docId] as const,\n documentsById: (docIds: string[]) =>\n ['arbi', 'documentsById', [...docIds].sort().join(',')] as const,\n /** Every workspace's near-duplicate pairs. */\n allSimilarDocuments: () => ['arbi', 'similarDocuments'] as const,\n similarDocuments: (workspaceId: string, threshold: number) =>\n ['arbi', 'similarDocuments', workspaceId, threshold] as const,\n /** Every version list: the prefix a new version invalidates. */\n allDocumentVersions: () => ['arbi', 'documentVersions'] as const,\n documentVersions: (docId: string) => ['arbi', 'documentVersions', docId] as const,\n conversations: (workspaceId: string) => ['arbi', 'conversations', workspaceId] as const,\n /** Every workspace's conversation list (and threads): the prefix a conversation write invalidates. */\n allConversations: () => ['arbi', 'conversations'] as const,\n /** A conversation's threads, under the conversations prefix (ids are unique across workspaces). */\n conversationThreads: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'threads'] as const,\n /** One stored message with everything the server keeps on it (its trace and metadata). */\n messageDetails: (messageId: string) => ['arbi', 'messageDetails', messageId] as const,\n /** The backend's built-in slash commands. */\n assistantCommands: () => ['arbi', 'assistantCommands'] as const,\n /** Every workspace's tags (lists, tables and kinds): what a cross-workspace change refreshes. */\n allTags: () => ['arbi', 'tags'] as const,\n tags: (workspaceId: string) => ['arbi', 'tags', workspaceId] as const,\n /** Under the workspace's tags: the kinds' fields (refreshed with the tags). */\n tagKinds: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'kinds'] as const,\n /** Every filtered list (a table of tags): what a tag write refreshes, the whole list aside. */\n tagLists: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'list'] as const,\n /** Under the workspace's tags: a tag, doctag or fact write that invalidates `tags` refreshes it. */\n tagList: (workspaceId: string, query: string) =>\n ['arbi', 'tags', workspaceId, 'list', query] as const,\n /** A kind's fields, under the workspace's tags. */\n tagKind: (workspaceId: string, kind: string) =>\n ['arbi', 'tags', workspaceId, 'kind', kind] as const,\n /** A task's history, under the conversations prefix: every conversation write refreshes it. */\n conversationActivity: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'activity'] as const,\n thumbnails: (docIds: string[]) => ['arbi', 'thumbnails', [...docIds].sort().join(',')] as const,\n /** Every stage of a document's parsed content. */\n parsedDocument: (docId: string) => ['arbi', 'parsedDoc', docId] as const,\n parsedDoc: (docId: string, stage: string) => ['arbi', 'parsedDoc', docId, stage] as const,\n agents: () => ['arbi', 'agents'] as const,\n sessions: () => ['arbi', 'sessions'] as const,\n health: () => ['arbi', 'health'] as const,\n workflows: () => ['arbi', 'workflows'] as const,\n /** Under `workflows()`: a workflow write or run refreshes its runs too. */\n workflowRuns: (workflowId: string) => ['arbi', 'workflows', workflowId, 'runs'] as const,\n /** Under `workflows()`: one workflow with its steps. */\n workflow: (workflowId: string) => ['arbi', 'workflows', workflowId] as const,\n /** Every workspace's facts: the prefix a fact write invalidates. */\n allFacts: () => ['arbi', 'facts'] as const,\n facts: (workspaceId: string) => ['arbi', 'facts', workspaceId] as const,\n configs: () => ['arbi', 'configs'] as const,\n activity: () => ['arbi', 'activity'] as const,\n /** Every transfer query (jobs, lists, plans): what a finished job refreshes. */\n allWorkspaceTransfers: () => ['arbi', 'workspaceTransfers'] as const,\n /** The caller's recent transfer jobs out of a workspace. */\n workspaceTransfers: (workspaceId: string) =>\n ['arbi', 'workspaceTransfers', 'list', workspaceId] as const,\n /** One transfer job's progress. */\n workspaceTransfer: (transferId: string) =>\n ['arbi', 'workspaceTransfers', 'job', transferId] as const,\n /** What a scope (serialised) would take in a workspace, for a mode. */\n workspaceTransferPlan: (workspaceId: string, scope: string, mode: string) =>\n ['arbi', 'workspaceTransfers', 'plan', workspaceId, scope, mode] as const,\n /**\n * A workspace's activity feed (all its pages), read `limit` entries a page (absent: the server's\n * default): each page size is its own entry, under the workspace's key.\n */\n workspaceActivity: (workspaceId: string, limit?: number) =>\n limit === undefined\n ? (['arbi', 'workspaceActivity', workspaceId] as const)\n : (['arbi', 'workspaceActivity', workspaceId, limit] as const),\n projects: () => ['arbi', 'projects'] as const,\n projectUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, monthsBack] as const,\n projectConversationUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, 'byConversation', monthsBack] as const,\n projectInvoices: (projectExtId: string) => ['arbi', 'projectInvoices', projectExtId] as const,\n /** The plans and add-ons on sale. */\n products: () => ['arbi', 'products'] as const,\n /** Prices of a purchase or a change (quotes, previews); nothing is bought. */\n billingQuotes: () => ['arbi', 'billingQuote'] as const,\n userUsageToday: () => ['arbi', 'userUsageToday'] as const,\n currentUser: () => ['arbi', 'currentUser'] as const,\n firmPool: () => ['arbi', 'firmPool'] as const,\n contacts: () => ['arbi', 'contacts'] as const,\n /** Every chat query (the list and each open thread). */\n chats: () => ['arbi', 'chats'] as const,\n /** My chats, raw (titles and last messages are ciphertext), most recently active first. */\n chatList: () => ['arbi', 'chats', 'list'] as const,\n /** One thread's loaded messages, decrypted, oldest first (`ChatThreadData`). */\n chatThread: (chatExtId: string) => ['arbi', 'chats', 'thread', chatExtId] as const,\n /** My own agent's progress on my last message to it (`agent_dm_status`), per agent. */\n agentDmStatus: (agentExtId: string) => ['arbi', 'chats', 'agentStatus', agentExtId] as const,\n /** The paid features this person may use (`/v1/user/entitlements`). */\n entitlements: () => ['arbi', 'entitlements'] as const,\n skills: () => ['arbi', 'skills'] as const,\n /** A skill's main file (SKILL.md), as text. */\n skillSource: (docExtId: string) => ['arbi', 'skills', 'source', docExtId] as const,\n /** An agent's pinned config; `undefined` = the library default config. */\n agentConfig: (agentExtId?: string) => ['arbi', 'agentConfig', agentExtId ?? 'default'] as const,\n agentWorkspaces: (agentExtId: string) => ['arbi', 'agentWorkspaces', agentExtId] as const,\n /** An agent's own login, polled while its controls are open. */\n agentSession: (agentExtId: string) => ['arbi', 'agentSession', agentExtId] as const,\n agentChats: (agentExtId: string) => ['arbi', 'agentChats', agentExtId] as const,\n authorizeLimits: () => ['arbi', 'authorizeLimits'] as const,\n mcpTools: () => ['arbi', 'mcpTools'] as const,\n models: () => ['arbi', 'models'] as const,\n availableModels: () => ['arbi', 'availableModels'] as const,\n /** The workspace Assistant's brief. */\n assistantBrief: (workspaceId: string) => ['arbi', 'assistantBrief', workspaceId] as const,\n /** Whether the workspace Assistant is waiting, working or idle. */\n assistantStatus: (workspaceId: string) => ['arbi', 'assistantStatus', workspaceId] as const,\n /** What the workspace Assistant did with each arrival. */\n assistantArrivals: (workspaceId: string) => ['arbi', 'assistantArrivals', workspaceId] as const,\n modelConnections: (userId?: string) => ['arbi', 'modelConnections', userId] as const,\n directModelUsage: (userId?: string) => ['arbi', 'directModelUsage', userId] as const,\n /** The signed-in user's own profile (name, picture, email). */\n profile: () => ['arbi', 'profile'] as const,\n identity: () => ['arbi', 'identity'] as const,\n /** The signed-in user's settings record (notification preferences, flags). */\n userSettings: () => ['arbi', 'userSettings'] as const,\n /** Every notification list: the prefix a delete, a read receipt or an arrival invalidates. */\n allSupportTickets: () => ['arbi', 'support'] as const,\n supportTickets: () => ['arbi', 'support', 'tickets'] as const,\n supportTicket: (id: number) => ['arbi', 'support', 'tickets', id] as const,\n allNotifications: () => ['arbi', 'notifications'] as const,\n /** The newest `limit` notifications, received and sent. */\n notifications: (limit: number) => ['arbi', 'notifications', limit] as const,\n /** The documents a workspace may use as its Word house template. */\n houseTemplateCandidates: (workspaceId: string) =>\n ['arbi', 'houseTemplateCandidates', workspaceId] as const,\n // \u2500\u2500 Storage, archive \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Every storage view (projects, items, names, Recently deleted): what a restore or delete refreshes. */\n storage: () => ['arbi', 'storage'] as const,\n /** What each project stores; no params: every such list. */\n storageProjects: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'projects'] as const)\n : (['arbi', 'storage', 'projects', params] as const),\n /** The largest items stored; no params: every such list. */\n storageItems: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'items'] as const)\n : (['arbi', 'storage', 'items', params] as const),\n /** Decrypted document names of storage items. */\n storageItemNames: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'names'] as const)\n : (['arbi', 'storage', 'names', params] as const),\n /** The deployment's storage day by day. */\n storageSnapshots: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'snapshots'] as const)\n : (['arbi', 'storage', 'snapshots', params] as const),\n /** A workspace's Recently deleted documents; no id: every workspace's. */\n workspaceTrash: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'storage', 'workspaceTrash'] as const)\n : (['arbi', 'storage', 'workspaceTrash', workspaceId] as const),\n /** A workspace's archive state; no id: every workspace's. */\n workspaceArchive: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'workspaceArchive'] as const)\n : (['arbi', 'workspaceArchive', workspaceId] as const),\n // \u2500\u2500 Databases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Every key below names its workspace right after its kind: a list read in one workspace is never\n // served, or overwritten, in another (the list is the session's open workspace on the server).\n /** Every database query of every workspace (what a write or a switch refreshes). */\n databases: () => ['arbi', 'databases'] as const,\n /** A workspace's databases; no id: every workspace's. */\n databaseList: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'list'] as const)\n : (['arbi', 'databases', 'list', workspaceId] as const),\n /** One database of a workspace; no workspace: every one read. */\n database: (workspaceId?: string, databaseId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'one'] as const)\n : (['arbi', 'databases', 'one', workspaceId, databaseId ?? ''] as const),\n /**\n * A database's rows (a search); no workspace: every database's, no params: every search of one.\n * `['arbi', 'databases', 'rows', workspaceId, databaseId, params]`.\n */\n databaseRows: (workspaceId?: string, databaseId?: string, params?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'rows'] as const)\n : params === undefined\n ? (['arbi', 'databases', 'rows', workspaceId, databaseId ?? ''] as const)\n : (['arbi', 'databases', 'rows', workspaceId, databaseId ?? '', params] as const),\n /** A workspace's pages; no id: every workspace's. */\n pages: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'pages'] as const)\n : (['arbi', 'pages', workspaceId] as const),\n /**\n * Saved table views a workspace's session sees: of one table (a database id or `documents`);\n * no target: every table's; no workspace: every workspace's.\n */\n tableViews: (workspaceId?: string, target?: string) =>\n workspaceId === undefined\n ? (['arbi', 'table-views'] as const)\n : target === undefined\n ? (['arbi', 'table-views', workspaceId] as const)\n : (['arbi', 'table-views', workspaceId, target] as const),\n /** A database's rows grouped and measured (a chart); no workspace: every database's. */\n databaseAggregate: (workspaceId?: string, databaseId?: string, request?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'aggregate'] as const)\n : (['arbi', 'databases', 'aggregate', workspaceId, databaseId ?? '', request ?? {}] as const),\n // \u2500\u2500 Configs, health \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Under `configs()`: the saved configuration versions. */\n configVersions: () => ['arbi', 'configs', 'versions'] as const,\n /** Under `configs()`: the JSON schema of every config model. */\n configSchema: () => ['arbi', 'configs', 'schema'] as const,\n /** Under `configs()`: one configuration. */\n config: (configId: string) => ['arbi', 'configs', 'one', configId] as const,\n /** The remote model providers' health. */\n remoteModels: () => ['arbi', 'remoteModels'] as const,\n // \u2500\u2500 Conversations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Under the conversations prefix: what a parked run waits for the owner to allow. */\n conversationPendingAuth: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'pending-auth'] as const,\n // \u2500\u2500 Document tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Signatures on a document (a version); no id: every document's. */\n documentSignatures: (docId?: string, version?: number | null) =>\n docId === undefined\n ? (['arbi', 'documentSignatures'] as const)\n : (['arbi', 'documentSignatures', docId, version ?? null] as const),\n /** The certificate of a signature reference. */\n signatureVerification: (reference: string) =>\n ['arbi', 'signatureVerification', reference] as const,\n /** Every signature request list: what a request write refreshes. */\n signatureRequests: () => ['arbi', 'signatureRequests'] as const,\n signatureRequestsForDocument: (docId: string) =>\n ['arbi', 'signatureRequests', 'document', docId] as const,\n /** Who may sign in a workspace; no id: every workspace's. */\n signatureCandidates: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'signatureRequests', 'candidates'] as const)\n : (['arbi', 'signatureRequests', 'candidates', workspaceId] as const),\n /** The user's saved (informal) signature. */\n savedSignature: () => ['arbi', 'savedSignature'] as const,\n /** An html/react artifact's source. */\n artifactSource: (docId: string) => ['arbi', 'artifactSource', docId] as const,\n /** An artifact's text, under its parsed content (refreshed with it). */\n artifactText: (docId: string) => ['arbi', 'parsedDoc', docId, 'marker', 'artifact-text'] as const,\n /** An image document's bytes as an object URL. */\n assetImage: (docId: string) => ['arbi', 'assetImage', docId] as const,\n // \u2500\u2500 Misc \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** An agent config's model tier (the builder's badge). */\n agentConfigModel: (configId: string) => ['arbi', 'agentConfigModel', configId] as const,\n /** Under `billingQuotes()`: the price of a plan change. */\n billingPreview: (projectExtId: string, change: unknown) =>\n ['arbi', 'billingQuote', 'preview', projectExtId, change] as const,\n billingPlanQuote: (projectExtId: string | null, body: unknown) =>\n ['arbi', 'billingQuote', 'plan', projectExtId, body] as const,\n billingAddonQuote: (projectExtId: string, kind: string) =>\n ['arbi', 'billingQuote', 'addon', projectExtId, kind] as const,\n /** Under `contacts()`: a search of the people one can reach. */\n contactSearch: (term: string) => ['arbi', 'contacts', 'search', term] as const,\n /** Under the workspace's facts: a filtered list. */\n factList: (workspaceId: string, filter: unknown) =>\n ['arbi', 'facts', workspaceId, filter] as const,\n /**\n * Under `skills()`: a workspace's list, hidden ones included or not. Without a marketplace the\n * server lists the open workspace's skills, so the list is kept per workspace.\n */\n skillList: (workspaceId: string, includeHidden: boolean) =>\n ['arbi', 'skills', 'list', workspaceId, includeHidden] as const,\n /** Under the project's events: one kind, one page size. */\n projectEventList: (projectExtId: string, kind: string, limit: number | 'default') =>\n ['arbi', 'projects', projectExtId, 'events', kind, limit] as const,\n /** The documents pinned for offline reading on this device. */\n offlineDocuments: () => ['arbi', 'offlineDocuments'] as const,\n /** Notifications of one kind for a deployment's user (polled). */\n typedNotifications: (kind: string, apiUrl: string, userId: string | undefined) =>\n ['arbi', 'typedNotifications', kind, apiUrl, userId ?? ''] as const,\n}\n\n/**\n * Keys of the mutations a host may need to follow (its own caches outside these hooks), e.g. with\n * a `MutationCache` subscription: a workflow run creates a task in the host's own task list.\n */\nexport const arbiMutationKeys = {\n /** A member's role changed. */\n setWorkspaceMemberRoles: () => ['arbi', 'workspaces', 'roles'] as const,\n runWorkflow: () => ['arbi', 'workflows', 'run'] as const,\n startWorkflow: () => ['arbi', 'workflows', 'start'] as const,\n updateTagKindSchema: () => ['arbi', 'tags', 'kinds', 'update'] as const,\n createTag: () => ['arbi', 'tags', 'create'] as const,\n updateTag: () => ['arbi', 'tags', 'update'] as const,\n deleteTag: () => ['arbi', 'tags', 'delete'] as const,\n extractEntities: () => ['arbi', 'tags', 'entities', 'extract'] as const,\n updateDocuments: () => ['arbi', 'documents', 'update'] as const,\n deleteDocuments: () => ['arbi', 'documents', 'delete'] as const,\n uploadDocuments: () => ['arbi', 'documents', 'upload'] as const,\n uploadUrls: () => ['arbi', 'documents', 'uploadUrls'] as const,\n assignDocTags: () => ['arbi', 'doctags', 'assign'] as const,\n removeDocTags: () => ['arbi', 'doctags', 'remove'] as const,\n updateDocTag: () => ['arbi', 'doctags', 'update'] as const,\n generateDocTags: () => ['arbi', 'doctags', 'generate'] as const,\n /** Members added to or removed from a workspace (leaving included). */\n workspaceMembership: () => ['arbi', 'workspaces', 'members'] as const,\n /** A chat turn being sent (the app's send pipeline). */\n sendMessage: () => ['arbi', 'conversations', 'send'] as const,\n}\n\n/**\n * Query keys of the calendar hooks, all under `['arbi', 'calendar']`. The calendar is the user's,\n * not a workspace's; only the overlays carry the open workspace.\n */\nexport const calendarQueryKeys = {\n all: () => ['arbi', 'calendar'] as const,\n settings: () => ['arbi', 'calendar', 'settings'] as const,\n calendars: () => ['arbi', 'calendar', 'calendars'] as const,\n /** Every event list: the prefix an event write invalidates. */\n events: () => ['arbi', 'calendar', 'events'] as const,\n eventList: (p: ListEventsParams) =>\n [\n 'arbi',\n 'calendar',\n 'events',\n { start: p.start, end: p.end, calendars: p.calendars?.join(',') ?? null },\n ] as const,\n /** Every single event read. */\n eventDetails: () => ['arbi', 'calendar', 'event'] as const,\n event: (id: string, recurrenceId?: string | null) =>\n ['arbi', 'calendar', 'event', id, recurrenceId ?? null] as const,\n shares: (calId: string) => ['arbi', 'calendar', 'shares', calId] as const,\n invitations: () => ['arbi', 'calendar', 'invitations'] as const,\n holidayCountries: () => ['arbi', 'calendar', 'holiday-countries'] as const,\n allRooms: () => ['arbi', 'calendar', 'rooms'] as const,\n rooms: (q: RoomQuery) => ['arbi', 'calendar', 'rooms', q] as const,\n freebusy: (attendees: string[], start: string, end: string) =>\n ['arbi', 'calendar', 'freebusy', attendees.join(','), start, end] as const,\n allLookups: () => ['arbi', 'calendar', 'lookup'] as const,\n lookup: (uid: string) => ['arbi', 'calendar', 'lookup', uid] as const,\n overlays: (workspaceId: string | null, w?: CalendarWindow, layers?: OverlayLayerName[]) =>\n [\n 'arbi',\n 'calendar',\n 'overlays',\n workspaceId,\n w ? { start: w.start, end: w.end, layers: layers?.join(',') } : null,\n ] as const,\n accounts: () => ['arbi', 'calendar', 'accounts'] as const,\n caldavProfiles: () => ['arbi', 'calendar', 'caldav-profiles'] as const,\n bookingPages: () => ['arbi', 'calendar', 'booking-pages'] as const,\n /** The offline outbox (writes made offline, not yet sent). */\n outbox: () => ['arbi', 'calendar', 'outbox'] as const,\n}\n\n/** Query keys of the call hooks, all under `['arbi', 'calls']`. Calls are the user's, not a workspace's. */\nexport const callQueryKeys = {\n all: () => ['arbi', 'calls'] as const,\n config: () => ['arbi', 'calls', 'config'] as const,\n call: (callExtId: string) => ['arbi', 'calls', 'call', callExtId] as const,\n /** Everything about a call's recordings: the prefix a recording event invalidates. */\n recordingsOf: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId] as const,\n recordings: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId, 'list'] as const,\n recording: (callExtId: string, recordingExtId: string) =>\n ['arbi', 'calls', 'recordings', callExtId, 'one', recordingExtId] as const,\n inviteLinks: (callExtId: string) => ['arbi', 'calls', 'invite-links', callExtId] as const,\n}\n\nexport const connectorQueryKeys = {\n all: () => ['arbi', 'connectors'] as const,\n catalog: () => ['arbi', 'connectors', 'catalog'] as const,\n mine: () => ['arbi', 'connectors', 'mine'] as const,\n mailboxFolders: (vendor: string) => ['arbi', 'connectors', 'folders', vendor] as const,\n mailboxSyncProgress: (vendor: string, workspaceExtId: string) =>\n ['arbi', 'connectors', 'sync-progress', vendor, workspaceExtId] as const,\n allMailboxSyncProgress: () => ['arbi', 'connectors', 'sync-progress'] as const,\n driveFolders: (vendor: string) => ['arbi', 'connectors', 'drive-folders', vendor] as const,\n driveFolderChildren: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-children', vendor, itemId] as const,\n driveFolderDocCount: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-doc-count', vendor, itemId] as const,\n driveSyncEstimate: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-estimate', vendor] as const,\n driveSyncProgress: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-progress', vendor] as const,\n allDriveSyncProgress: () => ['arbi', 'connectors', 'drive-sync-progress'] as const,\n slack: () => ['arbi', 'connectors', 'slack'] as const,\n}\n\nexport const mailQueryKeys = {\n all: () => ['arbi', 'mail'] as const,\n policy: () => ['arbi', 'mail', 'policy'] as const,\n accounts: () => ['arbi', 'mail', 'accounts'] as const,\n unlock: (accountId: string | undefined, sessionKey: string | null) =>\n ['arbi', 'mail', 'unlock', accountId, sessionKey ?? ''] as const,\n allFolders: () => ['arbi', 'mail', 'folders'] as const,\n folders: (accountId: string | undefined) => ['arbi', 'mail', 'folders', accountId] as const,\n allMessages: () => ['arbi', 'mail', 'messages'] as const,\n messages: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'messages', accountId, folderId, query, cursor] as const,\n message: (accountId: string | undefined, messageId: string | null | undefined) =>\n ['arbi', 'mail', 'message', accountId, messageId] as const,\n /** Every conversation list: the prefix a flag or move patches or refreshes. */\n allConversations: () => ['arbi', 'mail', 'conversations'] as const,\n conversations: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'conversations', accountId, folderId, query, cursor] as const,\n /** Every thread read of an account. */\n accountThreads: (accountId: string) => ['arbi', 'mail', 'thread', accountId] as const,\n thread: (\n accountId: string | undefined,\n threadId: string | null | undefined,\n folderId: string | undefined\n ) => ['arbi', 'mail', 'thread', accountId, threadId, folderId] as const,\n /** Where the ARBI mailbox files mail (folders and conversations, per workspace). */\n nativeFiling: () => ['arbi', 'mail', 'filing', 'native'] as const,\n /** Every filing lookup: refreshed after mail is added to a workspace or a rule is stopped. */\n allFiling: () => ['arbi', 'mail', 'filing'] as const,\n filing: (accountId: string | undefined, messageIds: string[], threadIds: string[]) =>\n ['arbi', 'mail', 'filing', accountId, messageIds.join(' '), threadIds.join(' ')] as const,\n /** The key the user's client keys older native mail with: outside the `['arbi', 'mail']` prefix, so\n * refreshing mail never fetches it again. */\n threadSecret: () => ['arbi', 'mail-thread-secret'] as const,\n /** The projects an email's AI work can be billed to. */\n projects: () => ['arbi', 'mail', 'projects'] as const,\n /** A saved draft prepared for editing. */\n draftCompose: (accountId: string | undefined, draftId: string | undefined) =>\n ['arbi', 'mail', 'draft-compose', accountId, draftId] as const,\n attachmentText: (accountId: string, messageId: string, attachmentId: string) =>\n ['arbi', 'mail', 'attachment-text', accountId, messageId, attachmentId] as const,\n}\n\n/** `pdf`: the document as a PDF; `original`: the stored file (an image, a recording, a sheet). */\nexport type DocumentBytesKind = 'pdf' | 'original'\n\n/** Every version and kind of a document's bytes: the prefix a new version invalidates. */\nexport const documentBytesKey = (\n documentRef: string,\n version?: number | null,\n kind?: DocumentBytesKind\n) =>\n version === undefined\n ? (['arbi', 'documentBytes', documentRef] as const)\n : (['arbi', 'documentBytes', documentRef, version, kind ?? 'pdf'] as const)\n\n/** Whether `queryKey` lies under `prefix` (a factory key): React Query's own prefix match. */\nexport function isUnderQueryKey(queryKey: readonly unknown[], prefix: readonly unknown[]): boolean {\n return prefix.every((part, i) => queryKey[i] === part)\n}\n"],
5
- "mappings": "AAgBO,MAAM,gBAAgB;AAAA,EAC3B,YAAY,MAAM,CAAC,QAAQ,YAAY;AAAA,EACvC,WAAW,CAAC,OAAe,CAAC,QAAQ,aAAa,EAAE;AAAA,EACnD,cAAc,CAAC,IAAY,WAAoB,CAAC,QAAQ,gBAAgB,IAAI,MAAM;AAAA,EAClF,YAAY,MAAM,CAAC,QAAQ,YAAY;AAAA;AAAA,EAEvC,mBAAmB,MAAM,CAAC,QAAQ,gBAAgB;AAAA,EAClD,gBAAgB,CAAC,gBAAwB,CAAC,QAAQ,kBAAkB,WAAW;AAAA;AAAA,EAE/E,cAAc,MAAM,CAAC,QAAQ,WAAW;AAAA,EACxC,WAAW,CAAC,gBAAwB,CAAC,QAAQ,aAAa,WAAW;AAAA;AAAA,EAErE,UAAU,CAAC,UAAkB,CAAC,QAAQ,YAAY,KAAK;AAAA,EACvD,eAAe,CAAC,WACd,CAAC,QAAQ,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA;AAAA,EAExD,qBAAqB,MAAM,CAAC,QAAQ,kBAAkB;AAAA,EACtD,kBAAkB,CAAC,aAAqB,cACtC,CAAC,QAAQ,oBAAoB,aAAa,SAAS;AAAA;AAAA,EAErD,qBAAqB,MAAM,CAAC,QAAQ,kBAAkB;AAAA,EACtD,kBAAkB,CAAC,UAAkB,CAAC,QAAQ,oBAAoB,KAAK;AAAA,EACvE,eAAe,CAAC,gBAAwB,CAAC,QAAQ,iBAAiB,WAAW;AAAA;AAAA,EAE7E,kBAAkB,MAAM,CAAC,QAAQ,eAAe;AAAA;AAAA,EAEhD,qBAAqB,CAAC,mBACpB,CAAC,Q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AAA;AAAA,EAE7D,cAAc,MAAM,CAAC,QAAQ,QAAQ,UAAU,QAAQ;AAAA;AAAA,EAEvD,WAAW,MAAM,CAAC,QAAQ,QAAQ,QAAQ;AAAA,EAC1C,QAAQ,CAAC,WAA+B,YAAsB,cAC5D,CAAC,QAAQ,QAAQ,UAAU,WAAW,WAAW,KAAK,GAAG,GAAG,UAAU,KAAK,GAAG,CAAC;AAAA;AAAA;AAAA,EAGjF,cAAc,MAAM,CAAC,QAAQ,oBAAoB;AAAA;AAAA,EAEjD,UAAU,MAAM,CAAC,QAAQ,QAAQ,UAAU;AAAA;AAAA,EAE3C,cAAc,CAAC,WAA+B,YAC5C,CAAC,QAAQ,QAAQ,iBAAiB,WAAW,OAAO;AAAA,EACtD,gBAAgB,CAAC,WAAmB,WAAmB,iBACrD,CAAC,QAAQ,QAAQ,mBAAmB,WAAW,WAAW,YAAY;AAC1E;AAMO,MAAM,mBAAmB,CAC9B,aACA,SACA,SAEA,YAAY,SACP,CAAC,QAAQ,iBAAiB,WAAW,IACrC,CAAC,QAAQ,iBAAiB,aAAa,SAAS,QAAQ,KAAK;AAG7D,SAAS,gBAAgB,UAA8B,QAAqC;AACjG,SAAO,OAAO,MAAM,CAAC,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI;AACvD;",
4
+ "sourcesContent": ["/**\n * The one query-key factory of the ARBI front end: every React Query key and mutation key the\n * packages and the app use is built here, under `['arbi', \u2026]`. Literal key arrays anywhere else\n * fail the `arbi/query-keys-from-factory` lint rule and `query-keys.guard.test.ts`, so a key can't\n * drift from the queries it names (a stale literal reads or invalidates nothing, silently).\n *\n * Dependency-free on purpose (types only): e2e helpers import it and pass keys into the page.\n */\n\nimport type {\n CalendarWindow,\n ListEventsParams,\n OverlayLayerName,\n RoomQuery,\n} from '@arbidocs/sdk/browser'\n\nexport const arbiQueryKeys = {\n fileShares: () => ['arbi', 'fileShares'] as const,\n fileShare: (id: string) => ['arbi', 'fileShare', id] as const,\n fileSharePdf: (id: string, status?: string) => ['arbi', 'fileSharePdf', id, status] as const,\n workspaces: () => ['arbi', 'workspaces'] as const,\n /** Every workspace's member list: what a workspace switch drops. */\n allWorkspaceUsers: () => ['arbi', 'workspaceUsers'] as const,\n workspaceUsers: (workspaceId: string) => ['arbi', 'workspaceUsers', workspaceId] as const,\n /** Every workspace's documents list: the prefix a write patches when it does not know the workspace. */\n allDocuments: () => ['arbi', 'documents'] as const,\n documents: (workspaceId: string) => ['arbi', 'documents', workspaceId] as const,\n /** One document (a viewer's); writes keep it current next to the list. */\n document: (docId: string) => ['arbi', 'document', docId] as const,\n documentsById: (docIds: string[]) =>\n ['arbi', 'documentsById', [...docIds].sort().join(',')] as const,\n /** Every workspace's near-duplicate pairs. */\n allSimilarDocuments: () => ['arbi', 'similarDocuments'] as const,\n similarDocuments: (workspaceId: string, threshold: number) =>\n ['arbi', 'similarDocuments', workspaceId, threshold] as const,\n /** Every version list: the prefix a new version invalidates. */\n allDocumentVersions: () => ['arbi', 'documentVersions'] as const,\n documentVersions: (docId: string) => ['arbi', 'documentVersions', docId] as const,\n conversations: (workspaceId: string) => ['arbi', 'conversations', workspaceId] as const,\n /** Every workspace's conversation list (and threads): the prefix a conversation write invalidates. */\n allConversations: () => ['arbi', 'conversations'] as const,\n /** A conversation's threads, under the conversations prefix (ids are unique across workspaces). */\n conversationThreads: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'threads'] as const,\n /** One stored message with everything the server keeps on it (its trace and metadata). */\n messageDetails: (messageId: string) => ['arbi', 'messageDetails', messageId] as const,\n /** The backend's built-in slash commands. */\n assistantCommands: () => ['arbi', 'assistantCommands'] as const,\n /** Every workspace's tags (lists, tables and kinds): what a cross-workspace change refreshes. */\n allTags: () => ['arbi', 'tags'] as const,\n tags: (workspaceId: string) => ['arbi', 'tags', workspaceId] as const,\n /** Under the workspace's tags: the kinds' fields (refreshed with the tags). */\n tagKinds: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'kinds'] as const,\n /** Every filtered list (a table of tags): what a tag write refreshes, the whole list aside. */\n tagLists: (workspaceId: string) => ['arbi', 'tags', workspaceId, 'list'] as const,\n /** Under the workspace's tags: a tag, doctag or fact write that invalidates `tags` refreshes it. */\n tagList: (workspaceId: string, query: string) =>\n ['arbi', 'tags', workspaceId, 'list', query] as const,\n /** A kind's fields, under the workspace's tags. */\n tagKind: (workspaceId: string, kind: string) =>\n ['arbi', 'tags', workspaceId, 'kind', kind] as const,\n /** A task's history, under the conversations prefix: every conversation write refreshes it. */\n conversationActivity: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'activity'] as const,\n thumbnails: (docIds: string[]) => ['arbi', 'thumbnails', [...docIds].sort().join(',')] as const,\n /** Every stage of a document's parsed content. */\n parsedDocument: (docId: string) => ['arbi', 'parsedDoc', docId] as const,\n parsedDoc: (docId: string, stage: string) => ['arbi', 'parsedDoc', docId, stage] as const,\n agents: () => ['arbi', 'agents'] as const,\n sessions: () => ['arbi', 'sessions'] as const,\n health: () => ['arbi', 'health'] as const,\n workflows: () => ['arbi', 'workflows'] as const,\n /** Under `workflows()`: a workflow write or run refreshes its runs too. */\n workflowRuns: (workflowId: string) => ['arbi', 'workflows', workflowId, 'runs'] as const,\n /** Under `workflows()`: one workflow with its steps. */\n workflow: (workflowId: string) => ['arbi', 'workflows', workflowId] as const,\n /** Every workspace's facts: the prefix a fact write invalidates. */\n allFacts: () => ['arbi', 'facts'] as const,\n facts: (workspaceId: string) => ['arbi', 'facts', workspaceId] as const,\n configs: () => ['arbi', 'configs'] as const,\n activity: () => ['arbi', 'activity'] as const,\n /** Every transfer query (jobs, lists, plans): what a finished job refreshes. */\n allWorkspaceTransfers: () => ['arbi', 'workspaceTransfers'] as const,\n /** The caller's recent transfer jobs out of a workspace. */\n workspaceTransfers: (workspaceId: string) =>\n ['arbi', 'workspaceTransfers', 'list', workspaceId] as const,\n /** One transfer job's progress. */\n workspaceTransfer: (transferId: string) =>\n ['arbi', 'workspaceTransfers', 'job', transferId] as const,\n /** What a scope (serialised) would take in a workspace, for a mode. */\n workspaceTransferPlan: (workspaceId: string, scope: string, mode: string) =>\n ['arbi', 'workspaceTransfers', 'plan', workspaceId, scope, mode] as const,\n /**\n * A workspace's activity feed (all its pages), read `limit` entries a page (absent: the server's\n * default): each page size is its own entry, under the workspace's key.\n */\n workspaceActivity: (workspaceId: string, limit?: number) =>\n limit === undefined\n ? (['arbi', 'workspaceActivity', workspaceId] as const)\n : (['arbi', 'workspaceActivity', workspaceId, limit] as const),\n projects: () => ['arbi', 'projects'] as const,\n projectUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, monthsBack] as const,\n /** The usage of every project the user owns, in one read (under `projectUsage`'s prefix). */\n ownedProjectsUsage: (monthsBack: number) =>\n ['arbi', 'projectUsage', 'owned', monthsBack] as const,\n projectConversationUsage: (projectExtId: string, monthsBack: number) =>\n ['arbi', 'projectUsage', projectExtId, 'byConversation', monthsBack] as const,\n projectInvoices: (projectExtId: string) => ['arbi', 'projectInvoices', projectExtId] as const,\n /** The plans and add-ons on sale. */\n products: () => ['arbi', 'products'] as const,\n /** Prices of a purchase or a change (quotes, previews); nothing is bought. */\n billingQuotes: () => ['arbi', 'billingQuote'] as const,\n userUsageToday: () => ['arbi', 'userUsageToday'] as const,\n currentUser: () => ['arbi', 'currentUser'] as const,\n firmPool: () => ['arbi', 'firmPool'] as const,\n contacts: () => ['arbi', 'contacts'] as const,\n /** Every chat query (the list and each open thread). */\n chats: () => ['arbi', 'chats'] as const,\n /** My chats, raw (titles and last messages are ciphertext), most recently active first. */\n chatList: () => ['arbi', 'chats', 'list'] as const,\n /** One thread's loaded messages, decrypted, oldest first (`ChatThreadData`). */\n chatThread: (chatExtId: string) => ['arbi', 'chats', 'thread', chatExtId] as const,\n /** My own agent's progress on my last message to it (`agent_dm_status`), per agent. */\n agentDmStatus: (agentExtId: string) => ['arbi', 'chats', 'agentStatus', agentExtId] as const,\n /** The paid features this person may use (`/v1/user/entitlements`). */\n entitlements: () => ['arbi', 'entitlements'] as const,\n skills: () => ['arbi', 'skills'] as const,\n /** A skill's main file (SKILL.md), as text. */\n skillSource: (docExtId: string) => ['arbi', 'skills', 'source', docExtId] as const,\n /** An agent's pinned config; `undefined` = the library default config. */\n agentConfig: (agentExtId?: string) => ['arbi', 'agentConfig', agentExtId ?? 'default'] as const,\n agentWorkspaces: (agentExtId: string) => ['arbi', 'agentWorkspaces', agentExtId] as const,\n /** An agent's own login, polled while its controls are open. */\n agentSession: (agentExtId: string) => ['arbi', 'agentSession', agentExtId] as const,\n agentChats: (agentExtId: string) => ['arbi', 'agentChats', agentExtId] as const,\n authorizeLimits: () => ['arbi', 'authorizeLimits'] as const,\n mcpTools: () => ['arbi', 'mcpTools'] as const,\n models: () => ['arbi', 'models'] as const,\n availableModels: () => ['arbi', 'availableModels'] as const,\n /** The workspace Assistant's brief. */\n assistantBrief: (workspaceId: string) => ['arbi', 'assistantBrief', workspaceId] as const,\n /** Whether the workspace Assistant is waiting, working or idle. */\n assistantStatus: (workspaceId: string) => ['arbi', 'assistantStatus', workspaceId] as const,\n /** What the workspace Assistant did with each arrival. */\n assistantArrivals: (workspaceId: string) => ['arbi', 'assistantArrivals', workspaceId] as const,\n modelConnections: (userId?: string) => ['arbi', 'modelConnections', userId] as const,\n directModelUsage: (userId?: string) => ['arbi', 'directModelUsage', userId] as const,\n /** The signed-in user's own profile (name, picture, email). */\n profile: () => ['arbi', 'profile'] as const,\n identity: () => ['arbi', 'identity'] as const,\n /** The signed-in user's settings record (notification preferences, flags). */\n userSettings: () => ['arbi', 'userSettings'] as const,\n /** Every notification list: the prefix a delete, a read receipt or an arrival invalidates. */\n allSupportTickets: () => ['arbi', 'support'] as const,\n supportTickets: () => ['arbi', 'support', 'tickets'] as const,\n supportTicket: (id: number) => ['arbi', 'support', 'tickets', id] as const,\n allNotifications: () => ['arbi', 'notifications'] as const,\n /** The newest `limit` notifications, received and sent. */\n notifications: (limit: number) => ['arbi', 'notifications', limit] as const,\n /** The documents a workspace may use as its Word house template. */\n houseTemplateCandidates: (workspaceId: string) =>\n ['arbi', 'houseTemplateCandidates', workspaceId] as const,\n // \u2500\u2500 Storage, archive \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Every storage view (projects, items, names, Recently deleted): what a restore or delete refreshes. */\n storage: () => ['arbi', 'storage'] as const,\n /** What each project stores; no params: every such list. */\n storageProjects: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'projects'] as const)\n : (['arbi', 'storage', 'projects', params] as const),\n /** The largest items stored; no params: every such list. */\n storageItems: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'items'] as const)\n : (['arbi', 'storage', 'items', params] as const),\n /** Decrypted document names of storage items. */\n storageItemNames: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'names'] as const)\n : (['arbi', 'storage', 'names', params] as const),\n /** The deployment's storage day by day. */\n storageSnapshots: (params?: object) =>\n params === undefined\n ? (['arbi', 'storage', 'snapshots'] as const)\n : (['arbi', 'storage', 'snapshots', params] as const),\n /** A workspace's Recently deleted documents; no id: every workspace's. */\n workspaceTrash: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'storage', 'workspaceTrash'] as const)\n : (['arbi', 'storage', 'workspaceTrash', workspaceId] as const),\n /** A workspace's archive state; no id: every workspace's. */\n workspaceArchive: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'workspaceArchive'] as const)\n : (['arbi', 'workspaceArchive', workspaceId] as const),\n // \u2500\u2500 Databases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Every key below names its workspace right after its kind: a list read in one workspace is never\n // served, or overwritten, in another (the list is the session's open workspace on the server).\n /** Every database query of every workspace (what a write or a switch refreshes). */\n databases: () => ['arbi', 'databases'] as const,\n /** A workspace's databases; no id: every workspace's. */\n databaseList: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'list'] as const)\n : (['arbi', 'databases', 'list', workspaceId] as const),\n /** One database of a workspace; no workspace: every one read. */\n database: (workspaceId?: string, databaseId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'one'] as const)\n : (['arbi', 'databases', 'one', workspaceId, databaseId ?? ''] as const),\n /**\n * A database's rows (a search); no workspace: every database's, no params: every search of one.\n * `['arbi', 'databases', 'rows', workspaceId, databaseId, params]`.\n */\n databaseRows: (workspaceId?: string, databaseId?: string, params?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'rows'] as const)\n : params === undefined\n ? (['arbi', 'databases', 'rows', workspaceId, databaseId ?? ''] as const)\n : (['arbi', 'databases', 'rows', workspaceId, databaseId ?? '', params] as const),\n /** A workspace's pages; no id: every workspace's. */\n pages: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'pages'] as const)\n : (['arbi', 'pages', workspaceId] as const),\n /**\n * Saved table views a workspace's session sees: of one table (a database id or `documents`);\n * no target: every table's; no workspace: every workspace's.\n */\n tableViews: (workspaceId?: string, target?: string) =>\n workspaceId === undefined\n ? (['arbi', 'table-views'] as const)\n : target === undefined\n ? (['arbi', 'table-views', workspaceId] as const)\n : (['arbi', 'table-views', workspaceId, target] as const),\n /**\n * A view's rows with its database (a page's table block), under `databaseRows`' prefix so every\n * row write refreshes it: the database is the view's, unknown until read.\n */\n tableViewRows: (workspaceId: string, viewId: string) =>\n ['arbi', 'databases', 'rows', workspaceId, '', { view: viewId }] as const,\n /** A workspace's items counted on the server (a chart); no workspace: every workspace's. */\n workspaceAggregate: (workspaceId?: string, query?: object) =>\n workspaceId === undefined\n ? (['arbi', 'workspaceAggregate'] as const)\n : (['arbi', 'workspaceAggregate', workspaceId, query ?? {}] as const),\n /** A database's rows grouped and measured (a chart); no workspace: every database's. */\n databaseAggregate: (workspaceId?: string, databaseId?: string, request?: object) =>\n workspaceId === undefined\n ? (['arbi', 'databases', 'aggregate'] as const)\n : (['arbi', 'databases', 'aggregate', workspaceId, databaseId ?? '', request ?? {}] as const),\n // \u2500\u2500 Configs, health \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Under `configs()`: the saved configuration versions. */\n configVersions: () => ['arbi', 'configs', 'versions'] as const,\n /** Under `configs()`: the JSON schema of every config model. */\n configSchema: () => ['arbi', 'configs', 'schema'] as const,\n /** Under `configs()`: one configuration. */\n config: (configId: string) => ['arbi', 'configs', 'one', configId] as const,\n /** The remote model providers' health. */\n remoteModels: () => ['arbi', 'remoteModels'] as const,\n // \u2500\u2500 Conversations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Under the conversations prefix: what a parked run waits for the owner to allow. */\n conversationPendingAuth: (conversationId: string) =>\n ['arbi', 'conversations', conversationId, 'pending-auth'] as const,\n // \u2500\u2500 Document tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** Signatures on a document (a version); no id: every document's. */\n documentSignatures: (docId?: string, version?: number | null) =>\n docId === undefined\n ? (['arbi', 'documentSignatures'] as const)\n : (['arbi', 'documentSignatures', docId, version ?? null] as const),\n /** The certificate of a signature reference. */\n signatureVerification: (reference: string) =>\n ['arbi', 'signatureVerification', reference] as const,\n /** Every signature request list: what a request write refreshes. */\n signatureRequests: () => ['arbi', 'signatureRequests'] as const,\n signatureRequestsForDocument: (docId: string) =>\n ['arbi', 'signatureRequests', 'document', docId] as const,\n /** Who may sign in a workspace; no id: every workspace's. */\n signatureCandidates: (workspaceId?: string) =>\n workspaceId === undefined\n ? (['arbi', 'signatureRequests', 'candidates'] as const)\n : (['arbi', 'signatureRequests', 'candidates', workspaceId] as const),\n /** The user's saved (informal) signature. */\n savedSignature: () => ['arbi', 'savedSignature'] as const,\n /** An html/react artifact's source. */\n artifactSource: (docId: string) => ['arbi', 'artifactSource', docId] as const,\n /** An artifact's text, under its parsed content (refreshed with it). */\n artifactText: (docId: string) => ['arbi', 'parsedDoc', docId, 'marker', 'artifact-text'] as const,\n /** An image document's bytes as an object URL. */\n assetImage: (docId: string) => ['arbi', 'assetImage', docId] as const,\n // \u2500\u2500 Misc \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n /** An agent config's model tier (the builder's badge). */\n agentConfigModel: (configId: string) => ['arbi', 'agentConfigModel', configId] as const,\n /** Under `billingQuotes()`: the price of a plan change. */\n billingPreview: (projectExtId: string, change: unknown) =>\n ['arbi', 'billingQuote', 'preview', projectExtId, change] as const,\n billingPlanQuote: (projectExtId: string | null, body: unknown) =>\n ['arbi', 'billingQuote', 'plan', projectExtId, body] as const,\n billingAddonQuote: (projectExtId: string, kind: string) =>\n ['arbi', 'billingQuote', 'addon', projectExtId, kind] as const,\n /** Under `contacts()`: a search of the people one can reach. */\n contactSearch: (term: string) => ['arbi', 'contacts', 'search', term] as const,\n /** Under the workspace's facts: a filtered list. */\n factList: (workspaceId: string, filter: unknown) =>\n ['arbi', 'facts', workspaceId, filter] as const,\n /**\n * Under `skills()`: a workspace's list, hidden ones included or not. Without a marketplace the\n * server lists the open workspace's skills, so the list is kept per workspace.\n */\n skillList: (workspaceId: string, includeHidden: boolean) =>\n ['arbi', 'skills', 'list', workspaceId, includeHidden] as const,\n /** Under the project's events: one kind, one page size. */\n projectEventList: (projectExtId: string, kind: string, limit: number | 'default') =>\n ['arbi', 'projects', projectExtId, 'events', kind, limit] as const,\n /** The documents pinned for offline reading on this device. */\n offlineDocuments: () => ['arbi', 'offlineDocuments'] as const,\n /** Notifications of one kind for a deployment's user (polled). */\n typedNotifications: (kind: string, apiUrl: string, userId: string | undefined) =>\n ['arbi', 'typedNotifications', kind, apiUrl, userId ?? ''] as const,\n}\n\n/**\n * Keys of the mutations a host may need to follow (its own caches outside these hooks), e.g. with\n * a `MutationCache` subscription: a workflow run creates a task in the host's own task list.\n */\nexport const arbiMutationKeys = {\n /** A member's role changed. */\n setWorkspaceMemberRoles: () => ['arbi', 'workspaces', 'roles'] as const,\n runWorkflow: () => ['arbi', 'workflows', 'run'] as const,\n startWorkflow: () => ['arbi', 'workflows', 'start'] as const,\n updateTagKindSchema: () => ['arbi', 'tags', 'kinds', 'update'] as const,\n createTag: () => ['arbi', 'tags', 'create'] as const,\n updateTag: () => ['arbi', 'tags', 'update'] as const,\n deleteTag: () => ['arbi', 'tags', 'delete'] as const,\n extractEntities: () => ['arbi', 'tags', 'entities', 'extract'] as const,\n updateDocuments: () => ['arbi', 'documents', 'update'] as const,\n deleteDocuments: () => ['arbi', 'documents', 'delete'] as const,\n uploadDocuments: () => ['arbi', 'documents', 'upload'] as const,\n uploadUrls: () => ['arbi', 'documents', 'uploadUrls'] as const,\n assignDocTags: () => ['arbi', 'doctags', 'assign'] as const,\n removeDocTags: () => ['arbi', 'doctags', 'remove'] as const,\n updateDocTag: () => ['arbi', 'doctags', 'update'] as const,\n generateDocTags: () => ['arbi', 'doctags', 'generate'] as const,\n /** Members added to or removed from a workspace (leaving included). */\n workspaceMembership: () => ['arbi', 'workspaces', 'members'] as const,\n /** A chat turn being sent (the app's send pipeline). */\n sendMessage: () => ['arbi', 'conversations', 'send'] as const,\n}\n\n/**\n * Query keys of the calendar hooks, all under `['arbi', 'calendar']`. The calendar is the user's,\n * not a workspace's; only the overlays carry the open workspace.\n */\nexport const calendarQueryKeys = {\n all: () => ['arbi', 'calendar'] as const,\n settings: () => ['arbi', 'calendar', 'settings'] as const,\n calendars: () => ['arbi', 'calendar', 'calendars'] as const,\n /** Every event list: the prefix an event write invalidates. */\n events: () => ['arbi', 'calendar', 'events'] as const,\n eventList: (p: ListEventsParams) =>\n [\n 'arbi',\n 'calendar',\n 'events',\n { start: p.start, end: p.end, calendars: p.calendars?.join(',') ?? null },\n ] as const,\n /** Every single event read. */\n eventDetails: () => ['arbi', 'calendar', 'event'] as const,\n event: (id: string, recurrenceId?: string | null) =>\n ['arbi', 'calendar', 'event', id, recurrenceId ?? null] as const,\n shares: (calId: string) => ['arbi', 'calendar', 'shares', calId] as const,\n invitations: () => ['arbi', 'calendar', 'invitations'] as const,\n holidayCountries: () => ['arbi', 'calendar', 'holiday-countries'] as const,\n allRooms: () => ['arbi', 'calendar', 'rooms'] as const,\n rooms: (q: RoomQuery) => ['arbi', 'calendar', 'rooms', q] as const,\n freebusy: (attendees: string[], start: string, end: string) =>\n ['arbi', 'calendar', 'freebusy', attendees.join(','), start, end] as const,\n allLookups: () => ['arbi', 'calendar', 'lookup'] as const,\n lookup: (uid: string) => ['arbi', 'calendar', 'lookup', uid] as const,\n overlays: (workspaceId: string | null, w?: CalendarWindow, layers?: OverlayLayerName[]) =>\n [\n 'arbi',\n 'calendar',\n 'overlays',\n workspaceId,\n w ? { start: w.start, end: w.end, layers: layers?.join(',') } : null,\n ] as const,\n accounts: () => ['arbi', 'calendar', 'accounts'] as const,\n caldavProfiles: () => ['arbi', 'calendar', 'caldav-profiles'] as const,\n bookingPages: () => ['arbi', 'calendar', 'booking-pages'] as const,\n /** The offline outbox (writes made offline, not yet sent). */\n outbox: () => ['arbi', 'calendar', 'outbox'] as const,\n}\n\n/** Query keys of the call hooks, all under `['arbi', 'calls']`. Calls are the user's, not a workspace's. */\nexport const callQueryKeys = {\n all: () => ['arbi', 'calls'] as const,\n config: () => ['arbi', 'calls', 'config'] as const,\n call: (callExtId: string) => ['arbi', 'calls', 'call', callExtId] as const,\n /** Everything about a call's recordings: the prefix a recording event invalidates. */\n recordingsOf: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId] as const,\n recordings: (callExtId: string) => ['arbi', 'calls', 'recordings', callExtId, 'list'] as const,\n recording: (callExtId: string, recordingExtId: string) =>\n ['arbi', 'calls', 'recordings', callExtId, 'one', recordingExtId] as const,\n inviteLinks: (callExtId: string) => ['arbi', 'calls', 'invite-links', callExtId] as const,\n}\n\nexport const connectorQueryKeys = {\n all: () => ['arbi', 'connectors'] as const,\n catalog: () => ['arbi', 'connectors', 'catalog'] as const,\n mine: () => ['arbi', 'connectors', 'mine'] as const,\n mailboxFolders: (vendor: string) => ['arbi', 'connectors', 'folders', vendor] as const,\n mailboxSyncProgress: (vendor: string, workspaceExtId: string) =>\n ['arbi', 'connectors', 'sync-progress', vendor, workspaceExtId] as const,\n allMailboxSyncProgress: () => ['arbi', 'connectors', 'sync-progress'] as const,\n driveFolders: (vendor: string) => ['arbi', 'connectors', 'drive-folders', vendor] as const,\n driveFolderChildren: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-children', vendor, itemId] as const,\n driveFolderDocCount: (vendor: string, itemId: string) =>\n ['arbi', 'connectors', 'drive-folder-doc-count', vendor, itemId] as const,\n driveSyncEstimate: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-estimate', vendor] as const,\n driveSyncProgress: (vendor: string) =>\n ['arbi', 'connectors', 'drive-sync-progress', vendor] as const,\n allDriveSyncProgress: () => ['arbi', 'connectors', 'drive-sync-progress'] as const,\n slack: () => ['arbi', 'connectors', 'slack'] as const,\n}\n\nexport const mailQueryKeys = {\n all: () => ['arbi', 'mail'] as const,\n policy: () => ['arbi', 'mail', 'policy'] as const,\n accounts: () => ['arbi', 'mail', 'accounts'] as const,\n unlock: (accountId: string | undefined, sessionKey: string | null) =>\n ['arbi', 'mail', 'unlock', accountId, sessionKey ?? ''] as const,\n allFolders: () => ['arbi', 'mail', 'folders'] as const,\n folders: (accountId: string | undefined) => ['arbi', 'mail', 'folders', accountId] as const,\n allMessages: () => ['arbi', 'mail', 'messages'] as const,\n messages: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'messages', accountId, folderId, query, cursor] as const,\n message: (accountId: string | undefined, messageId: string | null | undefined) =>\n ['arbi', 'mail', 'message', accountId, messageId] as const,\n /** Every conversation list: the prefix a flag or move patches or refreshes. */\n allConversations: () => ['arbi', 'mail', 'conversations'] as const,\n conversations: (\n accountId: string | undefined,\n folderId: string | undefined,\n query: string,\n cursor: string | null\n ) => ['arbi', 'mail', 'conversations', accountId, folderId, query, cursor] as const,\n /** Every thread read of an account. */\n accountThreads: (accountId: string) => ['arbi', 'mail', 'thread', accountId] as const,\n thread: (\n accountId: string | undefined,\n threadId: string | null | undefined,\n folderId: string | undefined\n ) => ['arbi', 'mail', 'thread', accountId, threadId, folderId] as const,\n /** Where the ARBI mailbox files mail (folders and conversations, per workspace). */\n nativeFiling: () => ['arbi', 'mail', 'filing', 'native'] as const,\n /** Every filing lookup: refreshed after mail is added to a workspace or a rule is stopped. */\n allFiling: () => ['arbi', 'mail', 'filing'] as const,\n filing: (accountId: string | undefined, messageIds: string[], threadIds: string[]) =>\n ['arbi', 'mail', 'filing', accountId, messageIds.join(' '), threadIds.join(' ')] as const,\n /** The key the user's client keys older native mail with: outside the `['arbi', 'mail']` prefix, so\n * refreshing mail never fetches it again. */\n threadSecret: () => ['arbi', 'mail-thread-secret'] as const,\n /** The projects an email's AI work can be billed to. */\n projects: () => ['arbi', 'mail', 'projects'] as const,\n /** A saved draft prepared for editing. */\n draftCompose: (accountId: string | undefined, draftId: string | undefined) =>\n ['arbi', 'mail', 'draft-compose', accountId, draftId] as const,\n attachmentText: (accountId: string, messageId: string, attachmentId: string) =>\n ['arbi', 'mail', 'attachment-text', accountId, messageId, attachmentId] as const,\n}\n\n/** `pdf`: the document as a PDF; `original`: the stored file (an image, a recording, a sheet). */\nexport type DocumentBytesKind = 'pdf' | 'original'\n\n/** Every version and kind of a document's bytes: the prefix a new version invalidates. */\nexport const documentBytesKey = (\n documentRef: string,\n version?: number | null,\n kind?: DocumentBytesKind\n) =>\n version === undefined\n ? (['arbi', 'documentBytes', documentRef] as const)\n : (['arbi', 'documentBytes', documentRef, version, kind ?? 'pdf'] as const)\n\n/** Whether `queryKey` lies under `prefix` (a factory key): React Query's own prefix match. */\nexport function isUnderQueryKey(queryKey: readonly unknown[], prefix: readonly unknown[]): boolean {\n return prefix.every((part, i) => queryKey[i] === part)\n}\n"],
5
+ "mappings": "AAgBO,MAAM,gBAAgB;AAAA,EAC3B,YAAY,MAAM,CAAC,QAAQ,YAAY;AAAA,EACvC,WAAW,CAAC,OAAe,CAAC,QAAQ,aAAa,EAAE;AAAA,EACnD,cAAc,CAAC,IAAY,WAAoB,CAAC,QAAQ,gBAAgB,IAAI,MAAM;AAAA,EAClF,YAAY,MAAM,CAAC,QAAQ,YAAY;AAAA;AAAA,EAEvC,mBAAmB,MAAM,CAAC,QAAQ,gBAAgB;AAAA,EAClD,gBAAgB,CAAC,gBAAwB,CAAC,QAAQ,kBAAkB,WAAW;AAAA;AAAA,EAE/E,cAAc,MAAM,CAAC,QAAQ,WAAW;AAAA,EACxC,WAAW,CAAC,gBAAwB,CAAC,QAAQ,aAAa,WAAW;AAAA;AAAA,EAErE,UAAU,CAAC,UAAkB,CAAC,QAAQ,YAAY,KAAK;AAAA,EACvD,eAAe,CAAC,WACd,CAAC,QAAQ,iBAAiB,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA;AAAA,E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C,QAAQ,QAAQ,mBAAmB,WAAW,WAAW,YAAY;AAC1E;AAMO,MAAM,mBAAmB,CAC9B,aACA,SACA,SAEA,YAAY,SACP,CAAC,QAAQ,iBAAiB,WAAW,IACrC,CAAC,QAAQ,iBAAiB,aAAa,SAAS,QAAQ,KAAK;AAG7D,SAAS,gBAAgB,UAA8B,QAAqC;AACjG,SAAO,OAAO,MAAM,CAAC,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI;AACvD;",
6
6
  "names": []
7
7
  }
package/dist/storage.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useMemo } from "react";
1
+ import { useCallback, useMemo } from "react";
2
2
  import { useQuery, useQueryClient } from "@tanstack/react-query";
3
3
  import { useArbi } from "./useArbi.js";
4
4
  import { arbiQueryKeys } from "./query-keys.js";
@@ -82,6 +82,28 @@ function useInvalidateStorage() {
82
82
  queryClient.invalidateQueries({ queryKey: arbiQueryKeys.projects() })
83
83
  ]);
84
84
  }
85
+ function useHideFromWorkspaceTrash() {
86
+ const queryClient = useQueryClient();
87
+ return useCallback(
88
+ (workspace, externalIds, othersPrivate = false) => {
89
+ const queryKey = arbiQueryKeys.workspaceTrash(workspace);
90
+ const before = queryClient.getQueryData(queryKey);
91
+ void queryClient.cancelQueries({ queryKey });
92
+ if (before) {
93
+ const gone = new Set(externalIds);
94
+ queryClient.setQueryData(queryKey, {
95
+ ...before,
96
+ items: before.items.filter((d) => !gone.has(d.external_id)),
97
+ others_private: othersPrivate && before.others_private ? { count: 0, bytes: 0 } : before.others_private
98
+ });
99
+ }
100
+ return () => {
101
+ if (before) queryClient.setQueryData(queryKey, before);
102
+ };
103
+ },
104
+ [queryClient]
105
+ );
106
+ }
85
107
  class StorageActionError extends Error {
86
108
  }
87
109
  const RESTORE_POLL_MS = 3e3;
@@ -175,6 +197,7 @@ function useStorageActions() {
175
197
  }
176
198
  export {
177
199
  StorageActionError,
200
+ useHideFromWorkspaceTrash,
178
201
  useInvalidateStorage,
179
202
  useStorageActions,
180
203
  useStorageItemNames,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/storage.ts"],
4
- "sourcesContent": ["/**\n * Storage: what each project stores (by kind, workspace, live and trash), its largest items, the\n * deployment's view for Box admins / billing managers, a workspace's Recently deleted, and the trash\n * actions (restore, delete permanently, empty trash). The server counts every stored byte against\n * one project (ARBI `src/core/storage_ledger.py`).\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './query-keys'\n\nexport type StorageProjectUsage = components['schemas']['StorageProjectUsage']\nexport type StorageItem = components['schemas']['StorageItem']\nexport type StorageKindUsage = components['schemas']['StorageKindUsage']\nexport type StorageDeploymentUsage = components['schemas']['StorageDeploymentUsage']\nexport type StorageSnapshot = components['schemas']['StorageSnapshotRead']\nexport type DeletedDocument = components['schemas']['DeletedDocument']\nexport type DeletedDocumentsPage = components['schemas']['DeletedDocumentsPage']\n\nexport type StorageScope = 'mine' | 'deployment'\nexport type StorageItemState = 'live' | 'trash' | 'all'\nexport type StorageItemKind = NonNullable<StorageItem['kind']>\n\nexport interface StorageItemsQuery {\n scope?: StorageScope\n project?: string\n workspace?: string\n kind?: 'document' | 'mail' | 'mail_draft' | 'recording' | 'chat_attachment' | 'other'\n state?: StorageItemState\n limit?: number\n}\n\n/** A read's data, or its error response thrown. */\nfunction dataOrThrow<T>({ data, error }: { data?: T; error?: unknown }): T {\n if (error !== undefined) throw error\n return data as T\n}\n\n/** My projects' storage (`mine`), or the deployment's (`deployment`: 403 for anyone but admins, not retried). */\nexport function useStorageProjects(scope: StorageScope = 'mine', project?: string) {\n const arbi = useArbi()\n const query = { scope, include: ['workspaces' as const], ...(project ? { project } : {}) }\n return useQuery({\n queryKey: arbiQueryKeys.storageProjects(query),\n queryFn: async () =>\n dataOrThrow(await arbi.getClient().fetch.GET('/v1/storage/projects', { params: { query } })),\n enabled: arbi.isLoggedIn,\n retry: false,\n staleTime: 30_000,\n })\n}\n\n/** The largest items stored, largest first (`state: 'trash'` is Recently deleted). */\nexport function useStorageItems(query: StorageItemsQuery, enabled = true) {\n const arbi = useArbi()\n const params = { limit: 50, ...query }\n return useQuery({\n queryKey: arbiQueryKeys.storageItems(params),\n queryFn: async () =>\n dataOrThrow(\n await arbi.getClient().fetch.GET('/v1/storage/items', { params: { query: params } })\n ),\n enabled: arbi.isLoggedIn && enabled,\n retry: false,\n staleTime: 30_000,\n })\n}\n\n/**\n * Names of the documents among `items`, one request per workspace (its key is primed on the session\n * when needed, without switching workspace). Names are encrypted; the server decrypts them with the key.\n */\nexport function useStorageItemNames(items: StorageItem[] | undefined, query: StorageItemsQuery) {\n const arbi = useArbi()\n const workspaces = [\n ...new Set(\n (items ?? [])\n .filter((i) => i.kind === 'document' && i.workspace_ext_id)\n .map((i) => i.workspace_ext_id as string)\n ),\n ].sort()\n return useQuery({\n queryKey: arbiQueryKeys.storageItemNames({ workspaces, query }),\n enabled: arbi.isLoggedIn && workspaces.length > 0,\n staleTime: 60_000,\n retry: false,\n queryFn: async () => {\n const names: Record<string, string> = {}\n for (const workspace of workspaces) {\n const { data } = await arbi.getClient().fetch.GET('/v1/storage/items', {\n params: {\n query: {\n ...query,\n workspace,\n kind: 'document',\n include: ['names'],\n limit: 200,\n },\n },\n })\n for (const item of data?.items ?? []) {\n if (item.ref && item.name) names[item.ref] = item.name\n }\n }\n return names\n },\n })\n}\n\n/** The deployment's storage day by day (admins). */\nexport function useStorageSnapshots(enabled: boolean) {\n const arbi = useArbi()\n const query = { limit: 90 }\n return useQuery({\n queryKey: arbiQueryKeys.storageSnapshots(query),\n queryFn: async () =>\n dataOrThrow(await arbi.getClient().fetch.GET('/v1/storage/snapshots', { params: { query } })),\n enabled: arbi.isLoggedIn && enabled,\n retry: false,\n staleTime: 5 * 60_000,\n })\n}\n\n/** After anything that changes what is stored: storage views, and the projects' quota meters. */\nexport function useInvalidateStorage() {\n const queryClient = useQueryClient()\n return () =>\n Promise.all([\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.storage() }),\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.projects() }),\n ])\n}\n\n/** A refused storage action, with the server's message. */\nexport class StorageActionError extends Error {}\n\n/** How often a Recently deleted list with documents being restored is checked. */\nconst RESTORE_POLL_MS = 3_000\n\nfunction fail(fallback: string, error: unknown): never {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n const message =\n typeof detail === 'string'\n ? detail\n : typeof (detail as { message?: unknown } | undefined)?.message === 'string'\n ? (detail as { message: string }).message\n : fallback\n throw new StorageActionError(message)\n}\n\n/**\n * A workspace's Recently deleted documents \u2014 only those the caller could see live (shared, or theirs) \u2014\n * with what they may do; for a workspace manager (project or workspace owner), how much other members keep\n * private in the trash. The workspace's key is primed on the session when needed.\n */\nexport function useWorkspaceTrash(workspace: string | undefined, enabled = true) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workspaceTrash(workspace ?? ''),\n enabled: arbi.isLoggedIn && Boolean(workspace) && enabled,\n retry: false,\n // Other members delete and restore too, and deleting from the documents list doesn't touch this cache:\n // refetch whenever Recently deleted is opened instead of trusting a long staleTime.\n staleTime: 0,\n // A restore copies files back from archive storage first: follow it until the documents leave the list.\n refetchInterval: (query) =>\n query.state.data?.items.some((d) => d.restoring) ? RESTORE_POLL_MS : false,\n queryFn: async (): Promise<DeletedDocumentsPage> => {\n const { data, error, response } = await arbi.getClient().fetch.GET('/v1/document/deleted', {\n params: { query: { workspace_ext_id: workspace as string } },\n })\n if (!response.ok || !data) fail('Could not load Recently deleted', error)\n return data\n },\n })\n}\n\n/** The trash actions on the signed-in session. Each throws a {@link StorageActionError} when refused. */\nexport interface StorageActions {\n /**\n * Delete a workspace's deleted documents for good: these `externalIds`, or (omitted) Empty trash \u2014 a\n * manager's everything-they-can-see, plus other members' private items only with `includeOthersPrivate`;\n * anyone else their own. Returns the documents removed.\n */\n purgeDeletedDocuments(\n workspace: string,\n options?: { externalIds?: string[]; includeOthersPrivate?: boolean }\n ): Promise<string[]>\n /** Delete permanently what is in a project's trash (or only `refs`). Returns the bytes freed. */\n purgeStorageItems(project: string, refs?: string[]): Promise<number>\n /**\n * Restore deleted documents of one workspace: their files come back from archive storage first (they are\n * listed as `restoring` meanwhile), then they reappear and are re-indexed in the background.\n */\n restoreDocuments(workspace: string, externalIds: string[]): Promise<void>\n /** Restore deleted workspaces (their owner). */\n restoreWorkspaces(externalIds: string[]): Promise<void>\n /** Move live documents to Recently deleted (the documents' usual delete). */\n deleteDocuments(externalIds: string[]): Promise<void>\n /** ARBI mail: to the Trash, or back from it. */\n updateNativeMail(messageId: string, action: 'trash' | 'restore'): Promise<void>\n /** ARBI mail: empty the Trash. Returns the messages deleted. */\n emptyMailTrash(): Promise<number>\n}\n\nexport function useStorageActions(): StorageActions {\n const arbi = useArbi()\n return useMemo(() => {\n const client = () => arbi.getClient().fetch\n return {\n async purgeDeletedDocuments(workspace, options = {}) {\n const { data, error, response } = await client().DELETE('/v1/document/deleted', {\n params: { query: { workspace_ext_id: workspace } },\n body: {\n ...(options.externalIds ? { external_ids: options.externalIds } : {}),\n include_others_private: Boolean(options.includeOthersPrivate),\n },\n })\n if (!response.ok || !data) fail('Could not delete permanently', error)\n return data.external_ids\n },\n async purgeStorageItems(project, refs) {\n const { data, error, response } = await client().DELETE('/v1/storage/items', {\n params: { query: { project, ...(refs?.length ? { refs } : {}) } },\n })\n if (!response.ok || !data) fail('Could not delete permanently', error)\n return data.bytes\n },\n async restoreDocuments(workspace, externalIds) {\n const { error, response } = await client().POST('/v1/document/restore', {\n params: { query: { workspace_ext_id: workspace } },\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not restore', error)\n },\n async restoreWorkspaces(externalIds) {\n const { error, response } = await client().POST('/v1/workspace/restore', {\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not restore the workspace', error)\n },\n async deleteDocuments(externalIds) {\n const { error, response } = await client().DELETE('/v1/document/', {\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not delete', error)\n },\n async updateNativeMail(messageId, action) {\n const { error, response } = await client().PATCH(\n '/v1/mail/accounts/{account_id}/messages/{message_id}',\n {\n params: { path: { account_id: 'native', message_id: messageId } },\n body: { action },\n }\n )\n if (!response.ok) fail(action === 'trash' ? 'Could not delete' : 'Could not restore', error)\n },\n async emptyMailTrash() {\n const { data, error, response } = await client().DELETE(\n '/v1/mail/accounts/{account_id}/messages',\n { params: { path: { account_id: 'native' }, query: { folder: 'trash' } } }\n )\n if (!response.ok || !data) fail('Could not empty the Trash', error)\n return data.deleted\n },\n }\n }, [arbi])\n}\n"],
5
- "mappings": "AASA,SAAS,eAAe;AACxB,SAAS,UAAU,sBAAsB;AAEzC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAwB9B,SAAS,YAAe,EAAE,MAAM,MAAM,GAAqC;AACzE,MAAI,UAAU,OAAW,OAAM;AAC/B,SAAO;AACT;AAGO,SAAS,mBAAmB,QAAsB,QAAQ,SAAkB;AACjF,QAAM,OAAO,QAAQ;AACrB,QAAM,QAAQ,EAAE,OAAO,SAAS,CAAC,YAAqB,GAAG,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC,EAAG;AACzF,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,gBAAgB,KAAK;AAAA,IAC7C,SAAS,YACP,YAAY,MAAM,KAAK,UAAU,EAAE,MAAM,IAAI,wBAAwB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAAA,IAC7F,SAAS,KAAK;AAAA,IACd,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AACH;AAGO,SAAS,gBAAgB,OAA0B,UAAU,MAAM;AACxE,QAAM,OAAO,QAAQ;AACrB,QAAM,SAAS,EAAE,OAAO,IAAI,GAAG,MAAM;AACrC,SAAO,SAAS;AAAA,IACd,UA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AAS,GAAI,MAAK,qBAAqB,KAAK;AAAA,MACnD;AAAA,MACA,MAAM,kBAAkB,aAAa;AACnC,cAAM,EAAE,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE,KAAK,yBAAyB;AAAA,UACvE,MAAM,EAAE,cAAc,YAAY;AAAA,QACpC,CAAC;AACD,YAAI,CAAC,SAAS,GAAI,MAAK,mCAAmC,KAAK;AAAA,MACjE;AAAA,MACA,MAAM,gBAAgB,aAAa;AACjC,cAAM,EAAE,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE,OAAO,iBAAiB;AAAA,UACjE,MAAM,EAAE,cAAc,YAAY;AAAA,QACpC,CAAC;AACD,YAAI,CAAC,SAAS,GAAI,MAAK,oBAAoB,KAAK;AAAA,MAClD;AAAA,MACA,MAAM,iBAAiB,WAAW,QAAQ;AACxC,cAAM,EAAE,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE;AAAA,UACzC;AAAA,UACA;AAAA,YACE,QAAQ,EAAE,MAAM,EAAE,YAAY,UAAU,YAAY,UAAU,EAAE;AAAA,YAChE,MAAM,EAAE,OAAO;AAAA,UACjB;AAAA,QACF;AACA,YAAI,CAAC,SAAS,GAAI,MAAK,WAAW,UAAU,qBAAqB,qBAAqB,KAAK;AAAA,MAC7F;AAAA,MACA,MAAM,iBAAiB;AACrB,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE;AAAA,UAC/C;AAAA,UACA,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,SAAS,GAAG,OAAO,EAAE,QAAQ,QAAQ,EAAE,EAAE;AAAA,QAC3E;AACA,YAAI,CAAC,SAAS,MAAM,CAAC,KAAM,MAAK,6BAA6B,KAAK;AAClE,eAAO,KAAK;AAAA,MACd;AAAA,IACF;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AACX;",
4
+ "sourcesContent": ["/**\n * Storage: what each project stores (by kind, workspace, live and trash), its largest items, the\n * deployment's view for Box admins / billing managers, a workspace's Recently deleted, and the trash\n * actions (restore, delete permanently, empty trash). The server counts every stored byte against\n * one project (ARBI `src/core/storage_ledger.py`).\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useCallback, useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './query-keys'\n\nexport type StorageProjectUsage = components['schemas']['StorageProjectUsage']\nexport type StorageItem = components['schemas']['StorageItem']\nexport type StorageKindUsage = components['schemas']['StorageKindUsage']\nexport type StorageDeploymentUsage = components['schemas']['StorageDeploymentUsage']\nexport type StorageSnapshot = components['schemas']['StorageSnapshotRead']\nexport type DeletedDocument = components['schemas']['DeletedDocument']\nexport type DeletedDocumentsPage = components['schemas']['DeletedDocumentsPage']\n\nexport type StorageScope = 'mine' | 'deployment'\nexport type StorageItemState = 'live' | 'trash' | 'all'\nexport type StorageItemKind = NonNullable<StorageItem['kind']>\n\nexport interface StorageItemsQuery {\n scope?: StorageScope\n project?: string\n workspace?: string\n kind?: 'document' | 'mail' | 'mail_draft' | 'recording' | 'chat_attachment' | 'other'\n state?: StorageItemState\n limit?: number\n}\n\n/** A read's data, or its error response thrown. */\nfunction dataOrThrow<T>({ data, error }: { data?: T; error?: unknown }): T {\n if (error !== undefined) throw error\n return data as T\n}\n\n/** My projects' storage (`mine`), or the deployment's (`deployment`: 403 for anyone but admins, not retried). */\nexport function useStorageProjects(scope: StorageScope = 'mine', project?: string) {\n const arbi = useArbi()\n const query = { scope, include: ['workspaces' as const], ...(project ? { project } : {}) }\n return useQuery({\n queryKey: arbiQueryKeys.storageProjects(query),\n queryFn: async () =>\n dataOrThrow(await arbi.getClient().fetch.GET('/v1/storage/projects', { params: { query } })),\n enabled: arbi.isLoggedIn,\n retry: false,\n staleTime: 30_000,\n })\n}\n\n/** The largest items stored, largest first (`state: 'trash'` is Recently deleted). */\nexport function useStorageItems(query: StorageItemsQuery, enabled = true) {\n const arbi = useArbi()\n const params = { limit: 50, ...query }\n return useQuery({\n queryKey: arbiQueryKeys.storageItems(params),\n queryFn: async () =>\n dataOrThrow(\n await arbi.getClient().fetch.GET('/v1/storage/items', { params: { query: params } })\n ),\n enabled: arbi.isLoggedIn && enabled,\n retry: false,\n staleTime: 30_000,\n })\n}\n\n/**\n * Names of the documents among `items`, one request per workspace (its key is primed on the session\n * when needed, without switching workspace). Names are encrypted; the server decrypts them with the key.\n */\nexport function useStorageItemNames(items: StorageItem[] | undefined, query: StorageItemsQuery) {\n const arbi = useArbi()\n const workspaces = [\n ...new Set(\n (items ?? [])\n .filter((i) => i.kind === 'document' && i.workspace_ext_id)\n .map((i) => i.workspace_ext_id as string)\n ),\n ].sort()\n return useQuery({\n queryKey: arbiQueryKeys.storageItemNames({ workspaces, query }),\n enabled: arbi.isLoggedIn && workspaces.length > 0,\n staleTime: 60_000,\n retry: false,\n queryFn: async () => {\n const names: Record<string, string> = {}\n for (const workspace of workspaces) {\n const { data } = await arbi.getClient().fetch.GET('/v1/storage/items', {\n params: {\n query: {\n ...query,\n workspace,\n kind: 'document',\n include: ['names'],\n limit: 200,\n },\n },\n })\n for (const item of data?.items ?? []) {\n if (item.ref && item.name) names[item.ref] = item.name\n }\n }\n return names\n },\n })\n}\n\n/** The deployment's storage day by day (admins). */\nexport function useStorageSnapshots(enabled: boolean) {\n const arbi = useArbi()\n const query = { limit: 90 }\n return useQuery({\n queryKey: arbiQueryKeys.storageSnapshots(query),\n queryFn: async () =>\n dataOrThrow(await arbi.getClient().fetch.GET('/v1/storage/snapshots', { params: { query } })),\n enabled: arbi.isLoggedIn && enabled,\n retry: false,\n staleTime: 5 * 60_000,\n })\n}\n\n/** After anything that changes what is stored: storage views, and the projects' quota meters. */\nexport function useInvalidateStorage() {\n const queryClient = useQueryClient()\n return () =>\n Promise.all([\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.storage() }),\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.projects() }),\n ])\n}\n\n/**\n * Take documents out of a workspace's cached Recently deleted at once, before Delete permanently / Empty\n * trash answers (`othersPrivate`: the hidden count of other members' private items goes too). Returns an\n * undo that puts the list back as it was, for when the action fails. The server stops counting and listing\n * purged documents when it answers; their files are deleted after it, so nothing comes back on refetch.\n */\nexport function useHideFromWorkspaceTrash() {\n const queryClient = useQueryClient()\n return useCallback(\n (workspace: string, externalIds: string[], othersPrivate = false) => {\n const queryKey = arbiQueryKeys.workspaceTrash(workspace)\n const before = queryClient.getQueryData<DeletedDocumentsPage>(queryKey)\n // A refetch already on its way would put the documents back until the next one.\n void queryClient.cancelQueries({ queryKey })\n if (before) {\n const gone = new Set(externalIds)\n queryClient.setQueryData<DeletedDocumentsPage>(queryKey, {\n ...before,\n items: before.items.filter((d) => !gone.has(d.external_id)),\n others_private:\n othersPrivate && before.others_private ? { count: 0, bytes: 0 } : before.others_private,\n })\n }\n return () => {\n if (before) queryClient.setQueryData(queryKey, before)\n }\n },\n [queryClient]\n )\n}\n\n/** A refused storage action, with the server's message. */\nexport class StorageActionError extends Error {}\n\n/** How often a Recently deleted list with documents being restored is checked. */\nconst RESTORE_POLL_MS = 3_000\n\nfunction fail(fallback: string, error: unknown): never {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n const message =\n typeof detail === 'string'\n ? detail\n : typeof (detail as { message?: unknown } | undefined)?.message === 'string'\n ? (detail as { message: string }).message\n : fallback\n throw new StorageActionError(message)\n}\n\n/**\n * A workspace's Recently deleted documents \u2014 only those the caller could see live (shared, or theirs) \u2014\n * with what they may do; for a workspace manager (project or workspace owner), how much other members keep\n * private in the trash. The workspace's key is primed on the session when needed.\n */\nexport function useWorkspaceTrash(workspace: string | undefined, enabled = true) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workspaceTrash(workspace ?? ''),\n enabled: arbi.isLoggedIn && Boolean(workspace) && enabled,\n retry: false,\n // Other members delete and restore too, and deleting from the documents list doesn't touch this cache:\n // refetch whenever Recently deleted is opened instead of trusting a long staleTime.\n staleTime: 0,\n // A restore copies files back from archive storage first: follow it until the documents leave the list.\n refetchInterval: (query) =>\n query.state.data?.items.some((d) => d.restoring) ? RESTORE_POLL_MS : false,\n queryFn: async (): Promise<DeletedDocumentsPage> => {\n const { data, error, response } = await arbi.getClient().fetch.GET('/v1/document/deleted', {\n params: { query: { workspace_ext_id: workspace as string } },\n })\n if (!response.ok || !data) fail('Could not load Recently deleted', error)\n return data\n },\n })\n}\n\n/** The trash actions on the signed-in session. Each throws a {@link StorageActionError} when refused. */\nexport interface StorageActions {\n /**\n * Delete a workspace's deleted documents for good: these `externalIds`, or (omitted) Empty trash \u2014 a\n * manager's everything-they-can-see, plus other members' private items only with `includeOthersPrivate`;\n * anyone else their own. Returns the documents removed.\n */\n purgeDeletedDocuments(\n workspace: string,\n options?: { externalIds?: string[]; includeOthersPrivate?: boolean }\n ): Promise<string[]>\n /** Delete permanently what is in a project's trash (or only `refs`). Returns the bytes freed. */\n purgeStorageItems(project: string, refs?: string[]): Promise<number>\n /**\n * Restore deleted documents of one workspace: their files come back from archive storage first (they are\n * listed as `restoring` meanwhile), then they reappear and are re-indexed in the background.\n */\n restoreDocuments(workspace: string, externalIds: string[]): Promise<void>\n /** Restore deleted workspaces (their owner). */\n restoreWorkspaces(externalIds: string[]): Promise<void>\n /** Move live documents to Recently deleted (the documents' usual delete). */\n deleteDocuments(externalIds: string[]): Promise<void>\n /** ARBI mail: to the Trash, or back from it. */\n updateNativeMail(messageId: string, action: 'trash' | 'restore'): Promise<void>\n /** ARBI mail: empty the Trash. Returns the messages deleted. */\n emptyMailTrash(): Promise<number>\n}\n\nexport function useStorageActions(): StorageActions {\n const arbi = useArbi()\n return useMemo(() => {\n const client = () => arbi.getClient().fetch\n return {\n async purgeDeletedDocuments(workspace, options = {}) {\n const { data, error, response } = await client().DELETE('/v1/document/deleted', {\n params: { query: { workspace_ext_id: workspace } },\n body: {\n ...(options.externalIds ? { external_ids: options.externalIds } : {}),\n include_others_private: Boolean(options.includeOthersPrivate),\n },\n })\n if (!response.ok || !data) fail('Could not delete permanently', error)\n return data.external_ids\n },\n async purgeStorageItems(project, refs) {\n const { data, error, response } = await client().DELETE('/v1/storage/items', {\n params: { query: { project, ...(refs?.length ? { refs } : {}) } },\n })\n if (!response.ok || !data) fail('Could not delete permanently', error)\n return data.bytes\n },\n async restoreDocuments(workspace, externalIds) {\n const { error, response } = await client().POST('/v1/document/restore', {\n params: { query: { workspace_ext_id: workspace } },\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not restore', error)\n },\n async restoreWorkspaces(externalIds) {\n const { error, response } = await client().POST('/v1/workspace/restore', {\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not restore the workspace', error)\n },\n async deleteDocuments(externalIds) {\n const { error, response } = await client().DELETE('/v1/document/', {\n body: { external_ids: externalIds },\n })\n if (!response.ok) fail('Could not delete', error)\n },\n async updateNativeMail(messageId, action) {\n const { error, response } = await client().PATCH(\n '/v1/mail/accounts/{account_id}/messages/{message_id}',\n {\n params: { path: { account_id: 'native', message_id: messageId } },\n body: { action },\n }\n )\n if (!response.ok) fail(action === 'trash' ? 'Could not delete' : 'Could not restore', error)\n },\n async emptyMailTrash() {\n const { data, error, response } = await client().DELETE(\n '/v1/mail/accounts/{account_id}/messages',\n { params: { path: { account_id: 'native' }, query: { folder: 'trash' } } }\n )\n if (!response.ok || !data) fail('Could not empty the Trash', error)\n return data.deleted\n },\n }\n }, [arbi])\n}\n"],
5
+ "mappings": "AASA,SAAS,aAAa,eAAe;AACrC,SAAS,UAAU,sBAAsB;AAEzC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAwB9B,SAAS,YAAe,EAAE,MAAM,MAAM,GAAqC;AACzE,MAAI,UAAU,OAAW,OAAM;AAC/B,SAAO;AACT;AAGO,SAAS,mBAAmB,QAAsB,QAAQ,SAAkB;AACjF,QAAM,OAAO,QAAQ;AACrB,QAAM,QAAQ,EAAE,OAAO,SAAS,CAAC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AAyB;AAAA,UACvE,MAAM,EAAE,cAAc,YAAY;AAAA,QACpC,CAAC;AACD,YAAI,CAAC,SAAS,GAAI,MAAK,mCAAmC,KAAK;AAAA,MACjE;AAAA,MACA,MAAM,gBAAgB,aAAa;AACjC,cAAM,EAAE,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE,OAAO,iBAAiB;AAAA,UACjE,MAAM,EAAE,cAAc,YAAY;AAAA,QACpC,CAAC;AACD,YAAI,CAAC,SAAS,GAAI,MAAK,oBAAoB,KAAK;AAAA,MAClD;AAAA,MACA,MAAM,iBAAiB,WAAW,QAAQ;AACxC,cAAM,EAAE,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE;AAAA,UACzC;AAAA,UACA;AAAA,YACE,QAAQ,EAAE,MAAM,EAAE,YAAY,UAAU,YAAY,UAAU,EAAE;AAAA,YAChE,MAAM,EAAE,OAAO;AAAA,UACjB;AAAA,QACF;AACA,YAAI,CAAC,SAAS,GAAI,MAAK,WAAW,UAAU,qBAAqB,qBAAqB,KAAK;AAAA,MAC7F;AAAA,MACA,MAAM,iBAAiB;AACrB,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,OAAO,EAAE;AAAA,UAC/C;AAAA,UACA,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,SAAS,GAAG,OAAO,EAAE,QAAQ,QAAQ,EAAE,EAAE;AAAA,QAC3E;AACA,YAAI,CAAC,SAAS,MAAM,CAAC,KAAM,MAAK,6BAA6B,KAAK;AAClE,eAAO,KAAK;AAAA,MACd;AAAA,IACF;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AACX;",
6
6
  "names": []
7
7
  }
@@ -46,9 +46,25 @@ function useTableView(viewId) {
46
46
  retry: false
47
47
  });
48
48
  }
49
+ const TABLE_VIEW_ROWS_PAGE = 100;
50
+ function useTableViewRows(viewId) {
51
+ const arbi = useArbi();
52
+ const workspaceId = openWorkspaceId(arbi);
53
+ return useQuery({
54
+ queryKey: arbiQueryKeys.tableViewRows(workspaceId, viewId ?? ""),
55
+ queryFn: () => arbi.views.rows(viewId, { limit: TABLE_VIEW_ROWS_PAGE }),
56
+ enabled: !!workspaceId && !!viewId,
57
+ staleTime: 1e3 * 15,
58
+ retry: false
59
+ });
60
+ }
49
61
  function useInvalidateViews() {
50
62
  const queryClient = useQueryClient();
51
- return () => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() });
63
+ return () => Promise.all([
64
+ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() }),
65
+ // A view's rows read applies the view: a changed view reads its rows anew.
66
+ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.databaseRows() })
67
+ ]);
52
68
  }
53
69
  function useCreateTableView() {
54
70
  const arbi = useArbi();
@@ -149,6 +165,7 @@ function resetLegacyTableViewMigration() {
149
165
  }
150
166
  export {
151
167
  DOCUMENTS_VIEW_TARGET,
168
+ TABLE_VIEW_ROWS_PAGE,
152
169
  filterText,
153
170
  legacySpec,
154
171
  migrateLegacyTableViews,
@@ -159,6 +176,7 @@ export {
159
176
  useMigrateLegacyTableViews,
160
177
  useShareTableView,
161
178
  useTableView,
179
+ useTableViewRows,
162
180
  useTableViewsQuery,
163
181
  useUpdateTableView,
164
182
  useWorkspaceTableViews
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/table-views.ts"],
4
- "sourcesContent": ["/**\n * Saved table views (`/v1/views`): a database grid's or the document table's saved ways of\n * looking at it \u2014 columns and layout, filters, sort. A view is private to its creator until\n * shared with the workspace, for good (sharing is one way); only a workspace owner deletes a\n * shared view. Grids write them (blocks' `useTableViews`); charts over a database read a view's columns\n * and filters.\n *\n * Views used to live in the user settings (`tableviews`). The first read of a workspace's views\n * moves that workspace's settings views to the API as private views and takes them out of the\n * settings (`migrateLegacyTableViews`), once per session.\n */\nimport { useEffect, useMemo, useState } from 'react'\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport {\n ArbiApiError,\n DOCUMENTS_VIEW_TARGET,\n filterText,\n type TableViewFilter,\n type TableViewRecord,\n type TableViewSpec,\n} from '@arbidocs/sdk/browser'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './query-keys'\nimport { useUserSettings } from './account/settings'\n\nexport { DOCUMENTS_VIEW_TARGET, filterText }\nexport type { TableViewFilter, TableViewRecord, TableViewSpec }\n\n/** A view as the user settings kept it (before views moved to the API). */\nexport type LegacyTableView = components['schemas']['TableView']\n\n/** The table a view belongs to: a database id, or `null` for the documents table. */\nexport type TableViewTable = string | null\n\n/** The API's target of a table: its database id, or `documents`. */\nexport const tableViewTarget = (table: TableViewTable): string => table ?? DOCUMENTS_VIEW_TARGET\n\n/** The open workspace's id, or '' with none open. */\nfunction openWorkspaceId(arbi: ReturnType<typeof useArbi>): string {\n return arbi.hasWorkspace ? arbi.getWorkspaceId() : ''\n}\n\n/**\n * The views of one table the caller can see (their own, and the workspace's shared ones), oldest\n * first. Moves the open workspace's settings views to the API first (once).\n */\nexport function useTableViewsQuery(table: TableViewTable, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n const migrated = useMigrateLegacyTableViews()\n const target = tableViewTarget(table)\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId, target),\n queryFn: () => arbi.views.list(target),\n enabled: (options?.enabled ?? true) && !!workspaceId && migrated,\n staleTime: 1000 * 30,\n })\n}\n\n/**\n * Every view of the open workspace the caller can see, of every table (a page's table block picks\n * one). Keyed under the workspace's views, so every view write refreshes it.\n */\nexport function useWorkspaceTableViews(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n const migrated = useMigrateLegacyTableViews()\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId),\n queryFn: () => arbi.views.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && migrated,\n staleTime: 1000 * 30,\n })\n}\n\n/** One view, by id (a page's table block). An error when the caller cannot see it (404). */\nexport function useTableView(viewId: string | null) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId, viewId ?? ''),\n queryFn: () => arbi.views.get(viewId as string),\n enabled: !!workspaceId && !!viewId,\n staleTime: 1000 * 30,\n retry: false,\n })\n}\n\nfunction useInvalidateViews() {\n const queryClient = useQueryClient()\n return () => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() })\n}\n\nexport interface CreateTableViewVars {\n table: TableViewTable\n spec: TableViewSpec\n shared?: boolean\n}\n\n/** Save a view of a table: private unless `shared`. */\nexport function useCreateTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: ({ table, spec, shared }: CreateTableViewVars) =>\n arbi.views.create(tableViewTarget(table), spec, { shared }),\n onSuccess: () => invalidate(),\n })\n}\n\n/** Replace a view's spec (its creator, or a workspace owner for a shared view). */\nexport function useUpdateTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: ({ viewId, spec }: { viewId: string; spec: TableViewSpec }) =>\n arbi.views.update(viewId, spec),\n onSuccess: () => invalidate(),\n })\n}\n\n/** Share a view with the workspace. One way: it is never made private again. */\nexport function useShareTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: (viewId: string) => arbi.views.share(viewId),\n onSuccess: () => invalidate(),\n })\n}\n\nexport function useDeleteTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: (viewId: string) => arbi.views.remove(viewId),\n onSuccess: () => invalidate(),\n })\n}\n\n// \u2500\u2500 the settings views' one move to the API \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A settings view as the API's spec. */\nexport function legacySpec(view: LegacyTableView): TableViewSpec {\n return {\n name: view.name,\n columns: view.columns,\n column_widths: view.column_widths ?? null,\n tile_size: view.tile_size ?? null,\n row_height: view.row_height ?? null,\n descending: false,\n }\n}\n\nexport interface LegacyViewsWriter {\n list: (target?: string) => Promise<TableViewRecord[]>\n create: (target: string, spec: TableViewSpec) => Promise<TableViewRecord>\n /** Write the settings' remaining views. */\n keep: (views: LegacyTableView[]) => Promise<unknown>\n}\n\n/**\n * Move `workspaceId`'s settings views to the API as private views (a name the table already has\n * among the caller's own views is not added twice), then keep in the settings only the views of\n * other workspaces and those that failed to move (tried again next time). A view of a database\n * that no longer exists (404) is dropped. Returns how many were moved.\n */\nexport async function migrateLegacyTableViews(\n all: readonly LegacyTableView[],\n workspaceId: string,\n writer: LegacyViewsWriter\n): Promise<number> {\n const here = all.filter((v) => v.workspace === workspaceId)\n if (!here.length) return 0\n const existing = await writer.list()\n const taken = new Set(\n existing.filter((v) => v.mine).map((v) => `${v.target}\\u0000${v.spec.name}`)\n )\n const failed: LegacyTableView[] = []\n let moved = 0\n for (const view of here) {\n const target = tableViewTarget(view.table ?? null)\n const key = `${target}\\u0000${view.name}`\n if (taken.has(key)) continue\n try {\n await writer.create(target, legacySpec(view))\n taken.add(key)\n moved += 1\n } catch (err) {\n if (!(err instanceof ArbiApiError && err.status === 404)) failed.push(view)\n }\n }\n await writer.keep([...all.filter((v) => v.workspace !== workspaceId), ...failed])\n return moved\n}\n\n/** Workspaces whose settings views this session has moved (or is moving). */\nconst moving = new Map<string, Promise<unknown>>()\n\n/**\n * Move the open workspace's settings views to the API, once per session. True once there is\n * nothing (left) to move, so reads of the views wait for it and never miss a moved view.\n */\nexport function useMigrateLegacyTableViews(): boolean {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const workspaceId = openWorkspaceId(arbi)\n const settings = useUserSettings({ enabled: !!workspaceId })\n const legacy = useMemo(() => settings.data?.tableviews ?? [], [settings.data?.tableviews])\n const pending = !!workspaceId && legacy.some((v) => v.workspace === workspaceId)\n const [failed, setFailed] = useState<string | null>(null)\n useEffect(() => {\n if (!pending || moving.has(workspaceId)) return\n const run = migrateLegacyTableViews(legacy, workspaceId, {\n list: () => arbi.views.list(),\n create: (target, spec) => arbi.views.create(target, spec),\n keep: async (tableviews) => {\n await arbi.settings.update({ tableviews })\n queryClient.setQueryData(arbiQueryKeys.userSettings(), (old: object | undefined) =>\n old ? { ...old, tableviews } : old\n )\n },\n })\n .then(() => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() }))\n .catch(() => {\n // Read the API's views anyway; the settings ones are tried again next session.\n setFailed(workspaceId)\n })\n moving.set(workspaceId, run)\n }, [pending, workspaceId, legacy, arbi, queryClient])\n return !!workspaceId && settings.isFetched && (!pending || failed === workspaceId)\n}\n\n/** Forget which workspaces were migrated (tests). */\nexport function resetLegacyTableViewMigration() {\n moving.clear()\n}\n"],
5
- "mappings": "AAWA,SAAS,WAAW,SAAS,gBAAgB;AAC7C,SAAS,aAAa,UAAU,sBAAsB;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAYzB,MAAM,kBAAkB,CAAC,UAAkC,SAAS;AAG3E,SAAS,gBAAgB,MAA0C;AACjE,SAAO,KAAK,eAAe,KAAK,eAAe,IAAI;AACrD;AAMO,SAAS,mBAAmB,OAAuB,SAAiC;AACzF,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,gBAAgB,IAAI;AACxC,QAAM,WAAW,2BAA2B;AAC5C,QAAM,SAAS,gBAAgB,KAAK;AACpC,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,WAAW,aAAa,MAAM;AAAA,IACtD,SAAS,MAAM,KAAK,MAAM,KAAK,MAAM;AAAA,IACrC,UAAU,SAAS,WAAW,SAAS,CAAC,CAAC,eAAe;AAAA,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AAU,WAAW;AAAA,IACvB,CAAC;AACH,WAAO,IAAI,aAAa,GAAG;AAAA,EAC7B,GAAG,CAAC,SAAS,aAAa,QAAQ,MAAM,WAAW,CAAC;AACpD,SAAO,CAAC,CAAC,eAAe,SAAS,cAAc,CAAC,WAAW,WAAW;AACxE;AAGO,SAAS,gCAAgC;AAC9C,SAAO,MAAM;AACf;",
4
+ "sourcesContent": ["/**\n * Saved table views (`/v1/views`): a database grid's or the document table's saved ways of\n * looking at it \u2014 columns and layout, filters, sort. A view is private to its creator until\n * shared with the workspace, for good (sharing is one way); only a workspace owner deletes a\n * shared view. Grids write them (blocks' `useTableViews`); charts over a database read a view's columns\n * and filters.\n *\n * Views used to live in the user settings (`tableviews`). The first read of a workspace's views\n * moves that workspace's settings views to the API as private views and takes them out of the\n * settings (`migrateLegacyTableViews`), once per session.\n */\nimport { useEffect, useMemo, useState } from 'react'\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport {\n ArbiApiError,\n DOCUMENTS_VIEW_TARGET,\n filterText,\n type TableViewFilter,\n type TableViewRecord,\n type TableViewRows,\n type TableViewSpec,\n} from '@arbidocs/sdk/browser'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './query-keys'\nimport { useUserSettings } from './account/settings'\n\nexport { DOCUMENTS_VIEW_TARGET, filterText }\nexport type { TableViewFilter, TableViewRecord, TableViewRows, TableViewSpec }\n\n/** A view as the user settings kept it (before views moved to the API). */\nexport type LegacyTableView = components['schemas']['TableView']\n\n/** The table a view belongs to: a database id, or `null` for the documents table. */\nexport type TableViewTable = string | null\n\n/** The API's target of a table: its database id, or `documents`. */\nexport const tableViewTarget = (table: TableViewTable): string => table ?? DOCUMENTS_VIEW_TARGET\n\n/** The open workspace's id, or '' with none open. */\nfunction openWorkspaceId(arbi: ReturnType<typeof useArbi>): string {\n return arbi.hasWorkspace ? arbi.getWorkspaceId() : ''\n}\n\n/**\n * The views of one table the caller can see (their own, and the workspace's shared ones), oldest\n * first. Moves the open workspace's settings views to the API first (once).\n */\nexport function useTableViewsQuery(table: TableViewTable, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n const migrated = useMigrateLegacyTableViews()\n const target = tableViewTarget(table)\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId, target),\n queryFn: () => arbi.views.list(target),\n enabled: (options?.enabled ?? true) && !!workspaceId && migrated,\n staleTime: 1000 * 30,\n })\n}\n\n/**\n * Every view of the open workspace the caller can see, of every table (a page's table block picks\n * one). Keyed under the workspace's views, so every view write refreshes it.\n */\nexport function useWorkspaceTableViews(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n const migrated = useMigrateLegacyTableViews()\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId),\n queryFn: () => arbi.views.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && migrated,\n staleTime: 1000 * 30,\n })\n}\n\n/** One view, by id (a page's table block). An error when the caller cannot see it (404). */\nexport function useTableView(viewId: string | null) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n return useQuery({\n queryKey: arbiQueryKeys.tableViews(workspaceId, viewId ?? ''),\n queryFn: () => arbi.views.get(viewId as string),\n enabled: !!workspaceId && !!viewId,\n staleTime: 1000 * 30,\n retry: false,\n })\n}\n\n/** How many rows a page's table block reads of its view. */\nexport const TABLE_VIEW_ROWS_PAGE = 100\n\n/**\n * A view with its database, its columns and its first rows (its filters and sort applied on the\n * server), in one read: a page's table block. An error when the caller cannot see the view or its\n * database (404); a view of the document table has no database. Row and view writes refresh it.\n */\nexport function useTableViewRows(viewId: string | null) {\n const arbi = useArbi()\n const workspaceId = openWorkspaceId(arbi)\n return useQuery({\n queryKey: arbiQueryKeys.tableViewRows(workspaceId, viewId ?? ''),\n queryFn: () => arbi.views.rows(viewId as string, { limit: TABLE_VIEW_ROWS_PAGE }),\n enabled: !!workspaceId && !!viewId,\n staleTime: 1000 * 15,\n retry: false,\n })\n}\n\nfunction useInvalidateViews() {\n const queryClient = useQueryClient()\n return () =>\n Promise.all([\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() }),\n // A view's rows read applies the view: a changed view reads its rows anew.\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.databaseRows() }),\n ])\n}\n\nexport interface CreateTableViewVars {\n table: TableViewTable\n spec: TableViewSpec\n shared?: boolean\n}\n\n/** Save a view of a table: private unless `shared`. */\nexport function useCreateTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: ({ table, spec, shared }: CreateTableViewVars) =>\n arbi.views.create(tableViewTarget(table), spec, { shared }),\n onSuccess: () => invalidate(),\n })\n}\n\n/** Replace a view's spec (its creator, or a workspace owner for a shared view). */\nexport function useUpdateTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: ({ viewId, spec }: { viewId: string; spec: TableViewSpec }) =>\n arbi.views.update(viewId, spec),\n onSuccess: () => invalidate(),\n })\n}\n\n/** Share a view with the workspace. One way: it is never made private again. */\nexport function useShareTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: (viewId: string) => arbi.views.share(viewId),\n onSuccess: () => invalidate(),\n })\n}\n\nexport function useDeleteTableView() {\n const arbi = useArbi()\n const invalidate = useInvalidateViews()\n return useMutation({\n mutationFn: (viewId: string) => arbi.views.remove(viewId),\n onSuccess: () => invalidate(),\n })\n}\n\n// \u2500\u2500 the settings views' one move to the API \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** A settings view as the API's spec. */\nexport function legacySpec(view: LegacyTableView): TableViewSpec {\n return {\n name: view.name,\n columns: view.columns,\n column_widths: view.column_widths ?? null,\n tile_size: view.tile_size ?? null,\n row_height: view.row_height ?? null,\n descending: false,\n }\n}\n\nexport interface LegacyViewsWriter {\n list: (target?: string) => Promise<TableViewRecord[]>\n create: (target: string, spec: TableViewSpec) => Promise<TableViewRecord>\n /** Write the settings' remaining views. */\n keep: (views: LegacyTableView[]) => Promise<unknown>\n}\n\n/**\n * Move `workspaceId`'s settings views to the API as private views (a name the table already has\n * among the caller's own views is not added twice), then keep in the settings only the views of\n * other workspaces and those that failed to move (tried again next time). A view of a database\n * that no longer exists (404) is dropped. Returns how many were moved.\n */\nexport async function migrateLegacyTableViews(\n all: readonly LegacyTableView[],\n workspaceId: string,\n writer: LegacyViewsWriter\n): Promise<number> {\n const here = all.filter((v) => v.workspace === workspaceId)\n if (!here.length) return 0\n const existing = await writer.list()\n const taken = new Set(\n existing.filter((v) => v.mine).map((v) => `${v.target}\\u0000${v.spec.name}`)\n )\n const failed: LegacyTableView[] = []\n let moved = 0\n for (const view of here) {\n const target = tableViewTarget(view.table ?? null)\n const key = `${target}\\u0000${view.name}`\n if (taken.has(key)) continue\n try {\n await writer.create(target, legacySpec(view))\n taken.add(key)\n moved += 1\n } catch (err) {\n if (!(err instanceof ArbiApiError && err.status === 404)) failed.push(view)\n }\n }\n await writer.keep([...all.filter((v) => v.workspace !== workspaceId), ...failed])\n return moved\n}\n\n/** Workspaces whose settings views this session has moved (or is moving). */\nconst moving = new Map<string, Promise<unknown>>()\n\n/**\n * Move the open workspace's settings views to the API, once per session. True once there is\n * nothing (left) to move, so reads of the views wait for it and never miss a moved view.\n */\nexport function useMigrateLegacyTableViews(): boolean {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const workspaceId = openWorkspaceId(arbi)\n const settings = useUserSettings({ enabled: !!workspaceId })\n const legacy = useMemo(() => settings.data?.tableviews ?? [], [settings.data?.tableviews])\n const pending = !!workspaceId && legacy.some((v) => v.workspace === workspaceId)\n const [failed, setFailed] = useState<string | null>(null)\n useEffect(() => {\n if (!pending || moving.has(workspaceId)) return\n const run = migrateLegacyTableViews(legacy, workspaceId, {\n list: () => arbi.views.list(),\n create: (target, spec) => arbi.views.create(target, spec),\n keep: async (tableviews) => {\n await arbi.settings.update({ tableviews })\n queryClient.setQueryData(arbiQueryKeys.userSettings(), (old: object | undefined) =>\n old ? { ...old, tableviews } : old\n )\n },\n })\n .then(() => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.tableViews() }))\n .catch(() => {\n // Read the API's views anyway; the settings ones are tried again next session.\n setFailed(workspaceId)\n })\n moving.set(workspaceId, run)\n }, [pending, workspaceId, legacy, arbi, queryClient])\n return !!workspaceId && settings.isFetched && (!pending || failed === workspaceId)\n}\n\n/** Forget which workspaces were migrated (tests). */\nexport function resetLegacyTableViewMigration() {\n moving.clear()\n}\n"],
5
+ "mappings": "AAWA,SAAS,WAAW,SAAS,gBAAgB;AAC7C,SAAS,aAAa,UAAU,sBAAsB;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAEP,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAYzB,MAAM,kBAAkB,CAAC,UAAkC,SAAS;AAG3E,SAAS,gBAAgB,MAA0C;AACjE,SAAO,KAAK,eAAe,KAAK,eAAe,IAAI;AACrD;AAMO,SAAS,mBAAmB,OAAuB,SAAiC;AACzF,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,gBAAgB,IAAI;AACxC,QAAM,WAAW,2BAA2B;AAC5C,QAAM,SAAS,gBAAgB,KAAK;AACpC,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,WAAW,aAAa,MAAM;AAAA,IACtD,SAAS,MAAM,KAAK,MAAM,KAAK,MAAM;AAAA,IACrC,UAAU,SAAS,WAAW,SAAS,CAAC,CAAC,eAAe;AAAA,IACxD,WAAW,MAAO;AAAA,EACpB,CAAC;AACH;AAMO,SAAS,uBAAuB,SAAiC;AACtE,QAAM,OAA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