@larc-iu/plaid-client 0.2.0-alpha.3 → 0.2.0-alpha.32

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 (73) hide show
  1. package/README.md +39 -0
  2. package/package.json +13 -6
  3. package/src/apiAnnotations.d.ts +508 -0
  4. package/src/apiAnnotations.js +543 -0
  5. package/src/apiDocuments.d.ts +569 -0
  6. package/src/apiDocuments.js +551 -0
  7. package/src/apiLayers.d.ts +369 -0
  8. package/src/apiLayers.js +222 -0
  9. package/src/apiMessages.d.ts +293 -0
  10. package/src/apiMessages.js +265 -0
  11. package/src/apiPeople.d.ts +626 -0
  12. package/src/apiPeople.js +698 -0
  13. package/src/apiProject.d.ts +761 -0
  14. package/src/apiProject.js +774 -0
  15. package/src/apiServer.d.ts +457 -0
  16. package/src/apiServer.js +424 -0
  17. package/src/apiVocab.d.ts +456 -0
  18. package/src/apiVocab.js +425 -0
  19. package/src/batch.d.ts +54 -0
  20. package/src/batch.js +323 -0
  21. package/src/batchRef.d.ts +30 -0
  22. package/src/batchRef.js +128 -0
  23. package/src/client.d.ts +1321 -0
  24. package/src/client.js +743 -0
  25. package/src/codepoint.d.ts +94 -0
  26. package/src/codepoint.js +131 -1
  27. package/src/constraints.d.ts +85 -0
  28. package/src/constraints.js +112 -0
  29. package/src/created.d.ts +2 -0
  30. package/src/created.js +29 -0
  31. package/src/documentLock.d.ts +172 -0
  32. package/src/documentLock.js +384 -0
  33. package/src/entryForms.d.ts +68 -0
  34. package/src/entryForms.js +164 -0
  35. package/src/events.d.ts +60 -0
  36. package/src/events.js +271 -0
  37. package/src/families.d.ts +349 -0
  38. package/src/families.js +396 -0
  39. package/src/http.d.ts +233 -0
  40. package/src/http.js +809 -93
  41. package/src/ids.d.ts +26 -0
  42. package/src/ids.js +96 -0
  43. package/src/index.d.ts +101 -0
  44. package/src/index.js +183 -2105
  45. package/src/metadataOps.d.ts +15 -0
  46. package/src/metadataOps.js +124 -0
  47. package/src/operations.d.ts +36 -0
  48. package/src/operations.js +164 -0
  49. package/src/pagination.d.ts +49 -0
  50. package/src/pagination.js +20 -53
  51. package/src/provenance.d.ts +243 -0
  52. package/src/provenance.js +458 -36
  53. package/src/replayed.d.ts +3 -0
  54. package/src/replayed.js +31 -0
  55. package/src/requester.d.ts +60 -0
  56. package/src/requester.js +74 -0
  57. package/src/roles.d.ts +104 -0
  58. package/src/roles.js +64 -2
  59. package/src/serviceSchema.d.ts +337 -0
  60. package/src/serviceSchema.js +177 -60
  61. package/src/services.d.ts +319 -0
  62. package/src/services.js +742 -58
  63. package/src/sse.d.ts +30 -0
  64. package/src/sse.js +80 -3
  65. package/src/testing.d.ts +128 -0
  66. package/src/testing.js +379 -0
  67. package/src/textEdits.d.ts +59 -0
  68. package/src/textEdits.js +234 -0
  69. package/src/transforms.d.ts +25 -0
  70. package/src/transforms.js +11 -1
  71. package/src/types.d.ts +867 -0
  72. package/src/types.js +663 -0
  73. package/index.d.ts +0 -532
@@ -0,0 +1,761 @@
1
+ /**
2
+ * @typedef {import("./types.js").TextEditOp} TextEditOp
3
+ * @typedef {import("./types.js").TextGap} TextGap
4
+ * @typedef {import("./types.js").MetadataOp} MetadataOp
5
+ * @typedef {import("./types.js").LayerConstraint} LayerConstraint
6
+ * @typedef {import("./types.js").ConstraintWriteOptions} ConstraintWriteOptions
7
+ * @typedef {import("./types.js").ConstraintViolation} ConstraintViolation
8
+ * @typedef {import("./types.js").Requester} Requester
9
+ * @typedef {import("./types.js").BatchRef} BatchRef
10
+ * @typedef {import("./types.js").ServiceParam} ServiceParam
11
+ * @typedef {import("./types.js").ServiceInfo} ServiceInfo
12
+ * @typedef {import("./types.js").DiscoveredService} DiscoveredService
13
+ * @typedef {import("./types.js").ResponseHelper} ResponseHelper
14
+ * @typedef {import("./types.js").ServiceRegistration} ServiceRegistration
15
+ * @typedef {import("./types.js").ServiceStatusEvent} ServiceStatusEvent
16
+ * @typedef {import("./types.js").OperationGroupsBundle} OperationGroupsBundle
17
+ * @typedef {import("./types.js").PlaidClientOptions} PlaidClientOptions
18
+ * @typedef {import("./types.js").OperationKind} OperationKind
19
+ * @typedef {import("./types.js").KeySeed} KeySeed
20
+ * @typedef {import("./types.js").PlaidBatch} PlaidBatch
21
+ * @typedef {import("./types.js").AuditPageOptions} AuditPageOptions
22
+ * @typedef {import("./types.js").VocabItemRestoreSummary} VocabItemRestoreSummary
23
+ * @typedef {import("./types.js").UserDataEntry} UserDataEntry
24
+ * @typedef {import("./types.js").AdminUserDataEntry} AdminUserDataEntry
25
+ * @typedef {import("./types.js").ActivityTallyRow} ActivityTallyRow
26
+ * @typedef {import("./types.js").ConstraintRepair} ConstraintRepair
27
+ * @typedef {import("./types.js").ValueSetRule} ValueSetRule
28
+ * @typedef {import("./types.js").RefusedValues} RefusedValues
29
+ * @typedef {import("./types.js").CommentableType} CommentableType
30
+ * @typedef {import("./types.js").Comment} Comment
31
+ * @typedef {import("./types.js").Guideline} Guideline
32
+ * @typedef {import("./types.js").ClientEventType} ClientEventType
33
+ * @typedef {import("./types.js").ClientEvent} ClientEvent
34
+ * @typedef {import("./types.js").Invite} Invite
35
+ * @typedef {import("./types.js").ServerLimits} ServerLimits
36
+ * @typedef {import("./types.js").ServerHealth} ServerHealth
37
+ * @typedef {import("./types.js").RateLimitBucket} RateLimitBucket
38
+ * @typedef {import("./types.js").RateLimitSnapshot} RateLimitSnapshot
39
+ * @typedef {import("./types.js").BackupStatus} BackupStatus
40
+ * @typedef {import("./types.js").ServerReport} ServerReport
41
+ * @typedef {import("./types.js").LiveLog} LiveLog
42
+ * @typedef {import("./types.js").SSEConnection} SSEConnection
43
+ * @typedef {import("./types.js").SSEStats} SSEStats
44
+ * @typedef {import("./types.js").AtomicValue} AtomicValue
45
+ * @typedef {import("./types.js").Created} Created
46
+ * @typedef {import("./types.js").Project} Project
47
+ * @typedef {import("./types.js").ProjectTextLayer} ProjectTextLayer
48
+ * @typedef {import("./types.js").ProjectTokenLayer} ProjectTokenLayer
49
+ * @typedef {import("./types.js").ProjectSpanLayer} ProjectSpanLayer
50
+ * @typedef {import("./types.js").ProjectRelationLayer} ProjectRelationLayer
51
+ * @typedef {import("./types.js").ProjectVocab} ProjectVocab
52
+ * @typedef {import("./types.js").PlaidDocument} PlaidDocument
53
+ * @typedef {import("./types.js").DocumentTextLayer} DocumentTextLayer
54
+ * @typedef {import("./types.js").DocumentTokenLayer} DocumentTokenLayer
55
+ * @typedef {import("./types.js").DocumentSpanLayer} DocumentSpanLayer
56
+ * @typedef {import("./types.js").PlaidText} PlaidText
57
+ * @typedef {import("./types.js").TextReshape} TextReshape
58
+ * @typedef {import("./types.js").Token} Token
59
+ * @typedef {import("./types.js").Span} Span
60
+ * @typedef {import("./types.js").Relation} Relation
61
+ * @typedef {import("./types.js").VocabItem} VocabItem
62
+ * @typedef {import("./types.js").VocabLink} VocabLink
63
+ * @typedef {import("./types.js").VocabLayer} VocabLayer
64
+ * @typedef {import("./types.js").TextLayer} TextLayer
65
+ * @typedef {import("./types.js").TokenLayer} TokenLayer
66
+ * @typedef {import("./types.js").SpanLayer} SpanLayer
67
+ * @typedef {import("./types.js").RelationLayer} RelationLayer
68
+ * @typedef {import("./types.js").MetadataRecords} MetadataRecords
69
+ * @typedef {import("./types.js").LayerRecords} LayerRecords
70
+ * @typedef {import("./types.js").User} User
71
+ * @typedef {import("./types.js").ProjectListEntry} ProjectListEntry
72
+ * @typedef {import("./types.js").DocumentListEntry} DocumentListEntry
73
+ * @typedef {import("./types.js").ApiToken} ApiToken
74
+ * @typedef {import("./types.js").AuditUser} AuditUser
75
+ * @typedef {import("./types.js").AuditTarget} AuditTarget
76
+ * @typedef {import("./types.js").AuditOp} AuditOp
77
+ * @typedef {import("./types.js").AuditEntry} AuditEntry
78
+ * @typedef {import("./types.js").LockGrant} LockGrant
79
+ * @typedef {import("./types.js").DocumentRestoreSummary} DocumentRestoreSummary
80
+ * @typedef {import("./types.js").RestoreCounts} RestoreCounts
81
+ * @typedef {import("./types.js").OperationGroup} OperationGroup
82
+ * @typedef {import("./types.js").QueryResult} QueryResult
83
+ */
84
+ /**
85
+ * @template [T=any]
86
+ * @typedef {import("./types.js").Page<T>} Page
87
+ */
88
+ /** @param {import("./client.js").PlaidClient} client */
89
+ export function projectsApi(client: import("./client.js").PlaidClient): {
90
+ audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<import("./families.js").AuditEntry[]>;
91
+ auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
92
+ startTime?: string;
93
+ endTime?: string;
94
+ opTypes?: string[] | string;
95
+ kinds?: import("./families.js").OperationKind[] | string;
96
+ order?: "asc" | "desc";
97
+ limit?: number;
98
+ cursor?: string;
99
+ opsLimit?: number;
100
+ entryId?: string;
101
+ }) => Promise<import("./families.js").Page<import("./families.js").AuditEntry>>;
102
+ setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
103
+ expected?: any;
104
+ }) => Promise<void>;
105
+ deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
106
+ expected?: any;
107
+ }) => Promise<void>;
108
+ /**
109
+ * Get a project by ID. To fetch the project's documents, use
110
+ * listDocuments(id) — the include-documents flag has been removed.
111
+ * @param {string} id - The resource ID
112
+ * @returns {Promise<Project>}
113
+ */
114
+ get: (id: string) => Promise<Project>;
115
+ /**
116
+ * List all projects accessible to user. Transparently follows pagination
117
+ * cursors and returns the full flat array.
118
+ * @returns {Promise<ProjectListEntry[]>}
119
+ */
120
+ list: () => Promise<ProjectListEntry[]>;
121
+ /**
122
+ * Fetch a single page of projects.
123
+ * @param {object} [opts]
124
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
125
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
126
+ * @returns {Promise<Page<ProjectListEntry>>}
127
+ */
128
+ listPage: ({ limit, cursor }?: {
129
+ limit?: number;
130
+ cursor?: string;
131
+ }) => Promise<Page<ProjectListEntry>>;
132
+ /**
133
+ * Async-iterate projects page by page; yields each page's entries array.
134
+ * @param {object} [opts]
135
+ * @param {number} [opts.pageSize] - Per-request page size
136
+ * @returns {AsyncGenerator<ProjectListEntry[]>}
137
+ */
138
+ iterPages: ({ pageSize }?: {
139
+ pageSize?: number;
140
+ }) => AsyncGenerator<ProjectListEntry[]>;
141
+ /**
142
+ * List all documents in a project. Transparently follows pagination
143
+ * cursors and returns the full flat array.
144
+ *
145
+ * Note: this endpoint does not support temporal (`as-of`) queries; the
146
+ * server rejects `?as-of=` on the documents-list route with a 400.
147
+ * @param {string} id - The project ID
148
+ * @returns {Promise<DocumentListEntry[]>}
149
+ */
150
+ listDocuments: (id: string) => Promise<DocumentListEntry[]>;
151
+ /**
152
+ * Fetch a single page of a project's documents.
153
+ *
154
+ * Note: this endpoint does not support temporal (`as-of`) queries; the
155
+ * server rejects `?as-of=` on the documents-list route with a 400.
156
+ * @param {string} id - The project ID
157
+ * @param {object} [opts]
158
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
159
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
160
+ * @returns {Promise<Page<DocumentListEntry>>}
161
+ */
162
+ listDocumentsPage: (id: string, { limit, cursor }?: {
163
+ limit?: number;
164
+ cursor?: string;
165
+ }) => Promise<Page<DocumentListEntry>>;
166
+ /**
167
+ * Async-iterate a project's documents page by page; yields each page's
168
+ * entries array.
169
+ *
170
+ * Note: this endpoint does not support temporal (`as-of`) queries; the
171
+ * server rejects `?as-of=` on the documents-list route with a 400.
172
+ * @param {string} id - The project ID
173
+ * @param {object} [opts]
174
+ * @param {number} [opts.pageSize] - Per-request page size
175
+ * @returns {AsyncGenerator<DocumentListEntry[]>}
176
+ */
177
+ iterDocuments: (id: string, { pageSize }?: {
178
+ pageSize?: number;
179
+ }) => AsyncGenerator<DocumentListEntry[]>;
180
+ /**
181
+ * Create a new project. Note: this also registers the user as a maintainer.
182
+ * @param {string} name - The name
183
+ * @param {string} [auditMessage] - Audit message for this write
184
+ * @param {object} [opts]
185
+ * @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
186
+ * @returns {Promise<Created>}
187
+ */
188
+ create: (name: string, auditMessage?: string, { id }?: {
189
+ id?: string;
190
+ }) => Promise<Created>;
191
+ /**
192
+ * Update a project's name.
193
+ * @param {string} id - The resource ID
194
+ * @param {string} name - The name
195
+ * @param {string} [auditMessage] - Audit message for this write
196
+ * @returns {Promise<Project>}
197
+ */
198
+ update: (id: string, name: string, auditMessage?: string) => Promise<Project>;
199
+ /**
200
+ * Delete a project and everything in it. This is irrecoverable. The
201
+ * project is gone when this returns, and what it holds is removed on
202
+ * the server afterwards.
203
+ * @param {string} id - The resource ID
204
+ * @param {string} [auditMessage] - Custom audit-log message
205
+ * @param {object} [options]
206
+ * @param {number} [options.timeout] - Per-request timeout in ms, the client's own by default (0/null disables)
207
+ * @returns {Promise<void>}
208
+ */
209
+ delete: (id: string, auditMessage?: string, { timeout }?: {
210
+ timeout?: number;
211
+ }) => Promise<void>;
212
+ /**
213
+ * Set a user's access level to read and write for this project.
214
+ * @param {string} id - The resource ID
215
+ * @param {string} userId - The user ID
216
+ * @param {string} [auditMessage] - Audit message for this write
217
+ * @returns {Promise<void>}
218
+ */
219
+ addWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
220
+ /**
221
+ * Remove a user's writer privileges for this project.
222
+ * @param {string} id - The resource ID
223
+ * @param {string} userId - The user ID
224
+ * @param {string} [auditMessage] - Audit message for this write
225
+ * @returns {Promise<void>}
226
+ */
227
+ removeWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
228
+ /**
229
+ * Set a user's access level to read-only for this project.
230
+ * @param {string} id - The resource ID
231
+ * @param {string} userId - The user ID
232
+ * @param {string} [auditMessage] - Audit message for this write
233
+ * @returns {Promise<void>}
234
+ */
235
+ addReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
236
+ /**
237
+ * Remove a user's reader privileges for this project.
238
+ * @param {string} id - The resource ID
239
+ * @param {string} userId - The user ID
240
+ * @param {string} [auditMessage] - Audit message for this write
241
+ * @returns {Promise<void>}
242
+ */
243
+ removeReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
244
+ /**
245
+ * Assign a user as a maintainer for this project.
246
+ * @param {string} id - The resource ID
247
+ * @param {string} userId - The user ID
248
+ * @param {string} [auditMessage] - Audit message for this write
249
+ * @returns {Promise<void>}
250
+ */
251
+ addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
252
+ /**
253
+ * Remove a user's maintainer privileges for this project.
254
+ * @param {string} id - The resource ID
255
+ * @param {string} userId - The user ID
256
+ * @param {string} [auditMessage] - Audit message for this write
257
+ * @returns {Promise<void>}
258
+ */
259
+ removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
260
+ /**
261
+ * When the calling user last wrote to each document in a project, as a
262
+ * `{documentId: timestamp}` map. Documents they have never written to
263
+ * are absent. One request covers a whole document list.
264
+ *
265
+ * The response is NOT key-transformed: its keys are document ids, and
266
+ * camelCasing would mangle the hyphens in a UUID.
267
+ * @param {string} projectId - The project ID
268
+ * @returns {Promise<Object<string, string>>}
269
+ */
270
+ myLastEdits: (projectId: string) => Promise<{
271
+ [x: string]: string;
272
+ }>;
273
+ /**
274
+ * Link a vocabulary to a project.
275
+ * @param {string} id - The resource ID
276
+ * @param {string} vocabId - The vocab layer ID
277
+ * @param {string} [auditMessage] - Audit message for this write
278
+ * @returns {Promise<void>}
279
+ */
280
+ linkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
281
+ /**
282
+ * Unlink a vocabulary from a project.
283
+ * @param {string} id - The resource ID
284
+ * @param {string} vocabId - The vocab layer ID
285
+ * @param {string} [auditMessage] - Audit message for this write
286
+ * @returns {Promise<void>}
287
+ */
288
+ unlinkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
289
+ };
290
+ /** @param {import("./client.js").PlaidClient} client */
291
+ export function guidelinesApi(client: import("./client.js").PlaidClient): {
292
+ /**
293
+ * Read one guideline, Markdown body included.
294
+ * @param {string} id - The guideline id
295
+ * @returns {Promise<Guideline>}
296
+ */
297
+ get: (id: string) => Promise<Guideline>;
298
+ /**
299
+ * List a project's guidelines, by title. Transparently follows
300
+ * pagination cursors and returns the full flat array.
301
+ *
302
+ * Without `includeBodies` each entry carries `bodyChars`, the length of
303
+ * its body, so a caller can budget before fetching any. Pinned
304
+ * guidelines are NOT sorted first: `pinned` is on every entry and
305
+ * grouping is the caller's.
306
+ * @param {string} projectId - The project to read
307
+ * @param {object} [opts]
308
+ * @param {boolean} [opts.includeBodies] - Return each body instead of its length
309
+ * @returns {Promise<Guideline[]>}
310
+ */
311
+ list: (projectId: string, { includeBodies }?: {
312
+ includeBodies?: boolean;
313
+ }) => Promise<Guideline[]>;
314
+ /**
315
+ * Fetch a single page of a project's guidelines.
316
+ * @param {string} projectId - The project to read
317
+ * @param {object} [opts]
318
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
319
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
320
+ * @param {boolean} [opts.includeBodies] - Return each body instead of its length
321
+ * @returns {Promise<Page<Guideline>>}
322
+ */
323
+ listPage: (projectId: string, { limit, cursor, includeBodies }?: {
324
+ limit?: number;
325
+ cursor?: string;
326
+ includeBodies?: boolean;
327
+ }) => Promise<Page<Guideline>>;
328
+ /**
329
+ * Async-iterate a project's guidelines page by page; yields each page's entries array.
330
+ * @param {string} projectId - The project to read
331
+ * @param {object} [opts]
332
+ * @param {number} [opts.pageSize] - Per-request page size
333
+ * @param {boolean} [opts.includeBodies] - Return each body instead of its length
334
+ * @returns {AsyncGenerator<Guideline[]>}
335
+ */
336
+ iterPages: (projectId: string, { pageSize, includeBodies }?: {
337
+ pageSize?: number;
338
+ includeBodies?: boolean;
339
+ }) => AsyncGenerator<Guideline[]>;
340
+ /**
341
+ * Create a guideline in a project. `title` is the handle an assistant
342
+ * asks for one by, and the only thing a person has to keep current. It is
343
+ * NOT required to be unique, so a title already in use is written like
344
+ * any other: warn about it, do not refuse it. A `pinned` guideline is one
345
+ * the assistant is given in full on every turn.
346
+ * @param {string} projectId - The project the guideline belongs to
347
+ * @param {string} title - The handle an assistant asks for one by (1..100 characters)
348
+ * @param {object} [opts]
349
+ * @param {string} [opts.body] - The Markdown text (up to 20000 characters; may be empty)
350
+ * @param {boolean} [opts.pinned] - Send this one to the assistant in full on every turn
351
+ * @param {string} [opts.id] - The new guideline's id, minted by the caller (see uuidv7)
352
+ * @param {string} [auditMessage] - Audit message for this write
353
+ * @returns {Promise<{id: string}>}
354
+ */
355
+ create: (projectId: string, title: string, { body, pinned, id }?: {
356
+ body?: string;
357
+ pinned?: boolean;
358
+ id?: string;
359
+ }, auditMessage?: string) => Promise<{
360
+ id: string;
361
+ }>;
362
+ /**
363
+ * Update a guideline. Every field is optional and an omitted one is
364
+ * left alone, so an edit to the body need not restate the title.
365
+ *
366
+ * Pass `expectedUpdatedAt` (the `updatedAt` you last read) when a person
367
+ * has been editing prose: the write then fails with 409 rather than
368
+ * overwriting somebody who saved in between. Leave it off for a pin
369
+ * toggle or a script, which have nothing of anyone's to lose.
370
+ * @param {string} id - The guideline id
371
+ * @param {object} [changes]
372
+ * @param {string} [changes.title] - The new handle
373
+ * @param {string} [changes.body] - The new Markdown text
374
+ * @param {boolean} [changes.pinned] - Whether the assistant always gets it in full
375
+ * @param {string} [changes.expectedUpdatedAt] - Write only if this is still the stored updatedAt
376
+ * @param {string} [auditMessage] - Audit message for this write
377
+ * @returns {Promise<Guideline>}
378
+ */
379
+ update: (id: string, { title, body, pinned, expectedUpdatedAt }?: {
380
+ title?: string;
381
+ body?: string;
382
+ pinned?: boolean;
383
+ expectedUpdatedAt?: string;
384
+ }, auditMessage?: string) => Promise<Guideline>;
385
+ /**
386
+ * Delete a guideline.
387
+ * @param {string} id - The guideline id
388
+ * @param {string} [auditMessage] - Audit message for this write
389
+ * @returns {Promise<void>}
390
+ */
391
+ delete: (id: string, auditMessage?: string) => Promise<void>;
392
+ };
393
+ /** @param {import("./client.js").PlaidClient} client */
394
+ export function commentsApi(client: import("./client.js").PlaidClient): {
395
+ /**
396
+ * Read one comment.
397
+ * @param {string} id - The comment id
398
+ * @returns {Promise<Comment>}
399
+ */
400
+ get: (id: string) => Promise<Comment>;
401
+ /**
402
+ * List comments in a project, oldest first. Transparently follows
403
+ * pagination cursors and returns the full flat array.
404
+ * @param {string} projectId - The project to read
405
+ * @param {object} [filters] - Narrow the scope
406
+ * @param {string} [filters.documentId] - Every comment anywhere in one document
407
+ * @param {string} [filters.entityType] - With entityId, one entity's thread
408
+ * @param {string} [filters.entityId] - With entityType, one entity's thread
409
+ * @returns {Promise<Comment[]>}
410
+ */
411
+ list: (projectId: string, { documentId, entityType, entityId }?: {
412
+ documentId?: string;
413
+ entityType?: string;
414
+ entityId?: string;
415
+ }) => Promise<Comment[]>;
416
+ /**
417
+ * Fetch a single page of a project's comments.
418
+ * @param {string} projectId - The project to read
419
+ * @param {object} [opts]
420
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
421
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
422
+ * @param {string} [opts.documentId] - Every comment anywhere in one document
423
+ * @param {string} [opts.entityType] - With entityId, one entity's thread
424
+ * @param {string} [opts.entityId] - With entityType, one entity's thread
425
+ * @returns {Promise<Page<Comment>>}
426
+ */
427
+ listPage: (projectId: string, { limit, cursor, documentId, entityType, entityId }?: {
428
+ limit?: number;
429
+ cursor?: string;
430
+ documentId?: string;
431
+ entityType?: string;
432
+ entityId?: string;
433
+ }) => Promise<Page<Comment>>;
434
+ /**
435
+ * Async-iterate a project's comments page by page; yields each page's entries array.
436
+ * @param {string} projectId - The project to read
437
+ * @param {object} [opts]
438
+ * @param {number} [opts.pageSize] - Per-request page size
439
+ * @param {string} [opts.documentId] - Every comment anywhere in one document
440
+ * @param {string} [opts.entityType] - With entityId, one entity's thread
441
+ * @param {string} [opts.entityId] - With entityType, one entity's thread
442
+ * @returns {AsyncGenerator<Comment[]>}
443
+ */
444
+ iterPages: (projectId: string, { pageSize, documentId, entityType, entityId }?: {
445
+ pageSize?: number;
446
+ documentId?: string;
447
+ entityType?: string;
448
+ entityId?: string;
449
+ }) => AsyncGenerator<Comment[]>;
450
+ /**
451
+ * List the comments on a vocabulary's entries, oldest first. Requires
452
+ * read access to the vocabulary. Transparently follows pagination
453
+ * cursors and returns the full flat array.
454
+ * @param {string} vocabId - The vocab layer to read
455
+ * @param {object} [filters]
456
+ * @param {string} [filters.entityId] - One entry's thread
457
+ * @returns {Promise<Comment[]>}
458
+ */
459
+ listInVocab: (vocabId: string, { entityId }?: {
460
+ entityId?: string;
461
+ }) => Promise<Comment[]>;
462
+ /**
463
+ * Fetch a single page of a vocabulary's comments.
464
+ * @param {string} vocabId - The vocab layer to read
465
+ * @param {object} [opts]
466
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
467
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
468
+ * @param {string} [opts.entityId] - One entry's thread
469
+ * @returns {Promise<Page<Comment>>}
470
+ */
471
+ listInVocabPage: (vocabId: string, { limit, cursor, entityId }?: {
472
+ limit?: number;
473
+ cursor?: string;
474
+ entityId?: string;
475
+ }) => Promise<Page<Comment>>;
476
+ /**
477
+ * Async-iterate a vocabulary's comments page by page, oldest first;
478
+ * yields each page's entries array.
479
+ * @param {string} vocabId - The vocab layer to read
480
+ * @param {object} [opts]
481
+ * @param {string} [opts.entityId] - One entry's thread
482
+ * @param {number} [opts.pageSize] - Per-request page size
483
+ * @returns {AsyncGenerator<Comment[]>}
484
+ */
485
+ iterInVocabPages: (vocabId: string, { entityId, pageSize }?: {
486
+ entityId?: string;
487
+ pageSize?: number;
488
+ }) => AsyncGenerator<Comment[]>;
489
+ /**
490
+ * Post a comment on an entity. Requires write access to the entity's
491
+ * project, or to the vocabulary for a vocab-item; the author is the
492
+ * authenticated caller. Comments are not audited and do not bump the
493
+ * document version.
494
+ *
495
+ * A comment outlives its anchor: deleting the entity does not delete
496
+ * the comment. `anchorLabel` is the caption shown once that happens
497
+ * ("Gloss of ktab, sentence 4"), so pass what the comment is about.
498
+ * @param {CommentableType} entityType - What kind of thing is being commented on
499
+ * @param {string} entityId - The commented entity's id
500
+ * @param {string} body - The comment text (1..10000 characters)
501
+ * @param {object} [opts]
502
+ * @param {string} [opts.anchorLabel] - What the comment is about, in words (at most 200 characters)
503
+ * @param {string} [opts.id] - The new comment's id, minted by the caller (see uuidv7)
504
+ * @returns {Promise<Comment>}
505
+ */
506
+ create: (entityType: CommentableType, entityId: string, body: string, { anchorLabel, id }?: {
507
+ anchorLabel?: string;
508
+ id?: string;
509
+ }) => Promise<Comment>;
510
+ /**
511
+ * Edit a comment's body. Only the comment's AUTHOR may do this - not
512
+ * maintainers, not admins. Sets `edited` on the comment.
513
+ * @param {string} id - The comment id
514
+ * @param {string} body - The replacement text
515
+ * @returns {Promise<Comment>}
516
+ */
517
+ update: (id: string, body: string) => Promise<Comment>;
518
+ /**
519
+ * Delete a comment. The author may delete their own; a project
520
+ * maintainer (or admin) may delete any.
521
+ * @param {string} id - The comment id
522
+ * @returns {Promise<void>}
523
+ */
524
+ delete: (id: string) => Promise<void>;
525
+ /**
526
+ * Comment counts per entity, as an `{entityId: n}` map, over the same
527
+ * scope and filters as `list`. One cheap request paints a comment
528
+ * indicator on every annotated item in a document without paging
529
+ * through the bodies.
530
+ *
531
+ * The response is NOT key-transformed: its keys are entity ids, and
532
+ * camelCasing would mangle the hyphens in a UUID.
533
+ * @param {string} projectId - The project to read
534
+ * @param {{documentId?: string, entityType?: CommentableType, entityId?: string}} [filters] - Same filters as list()
535
+ * @returns {Promise<Object<string, number>>}
536
+ */
537
+ counts: (projectId: string, { documentId, entityType, entityId }?: {
538
+ documentId?: string;
539
+ entityType?: CommentableType;
540
+ entityId?: string;
541
+ }) => Promise<{
542
+ [x: string]: number;
543
+ }>;
544
+ /**
545
+ * Comment counts per entry of a vocabulary, as an `{entityId: n}` map.
546
+ * The response is NOT key-transformed: its keys are entry ids.
547
+ * @param {string} vocabId - The vocab layer to read
548
+ * @param {object} [filters]
549
+ * @param {string} [filters.entityId] - One entry only
550
+ * @returns {Promise<Object<string, number>>}
551
+ */
552
+ countsInVocab: (vocabId: string, { entityId }?: {
553
+ entityId?: string;
554
+ }) => Promise<{
555
+ [x: string]: number;
556
+ }>;
557
+ };
558
+ /** @param {import("./client.js").PlaidClient} client */
559
+ export function eventsApi(client: import("./client.js").PlaidClient): {
560
+ /**
561
+ * A project's events in arrival order. Maintainer or admin only.
562
+ * Transparently follows pagination cursors and returns the full flat
563
+ * array.
564
+ * @param {string} projectId - The project to read
565
+ * @param {object} [filters]
566
+ * @param {string|string[]} [filters.types] - Only these types
567
+ * @param {string} [filters.startTime] - Only events the server stamped at or after this instant
568
+ * @param {string} [filters.endTime] - Only events the server stamped at or before this instant
569
+ * @returns {Promise<ClientEvent[]>}
570
+ */
571
+ list: (projectId: string, { types, startTime, endTime }?: {
572
+ types?: string | string[];
573
+ startTime?: string;
574
+ endTime?: string;
575
+ }) => Promise<ClientEvent[]>;
576
+ /**
577
+ * One page of a project's events. Maintainer or admin only.
578
+ * @param {string} projectId - The project to read
579
+ * @param {object} [opts]
580
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
581
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
582
+ * @param {string|string[]} [opts.types] - Only these types
583
+ * @param {string} [opts.startTime] - Only events at or after this instant
584
+ * @param {string} [opts.endTime] - Only events at or before this instant
585
+ * @returns {Promise<Page<ClientEvent>>}
586
+ */
587
+ listPage: (projectId: string, { limit, cursor, types, startTime, endTime }?: {
588
+ limit?: number;
589
+ cursor?: string;
590
+ types?: string | string[];
591
+ startTime?: string;
592
+ endTime?: string;
593
+ }) => Promise<Page<ClientEvent>>;
594
+ /**
595
+ * Async-iterate a project's events page by page; yields each page's entries array.
596
+ * @param {string} projectId - The project to read
597
+ * @param {object} [opts]
598
+ * @param {number} [opts.pageSize] - Per-request page size
599
+ * @param {string|string[]} [opts.types] - Only these types
600
+ * @param {string} [opts.startTime] - Only events at or after this instant
601
+ * @param {string} [opts.endTime] - Only events at or before this instant
602
+ * @returns {AsyncGenerator<ClientEvent[]>}
603
+ */
604
+ iterPages: (projectId: string, { pageSize, types, startTime, endTime }?: {
605
+ pageSize?: number;
606
+ types?: string | string[];
607
+ startTime?: string;
608
+ endTime?: string;
609
+ }) => AsyncGenerator<ClientEvent[]>;
610
+ /**
611
+ * Record events directly, with no buffering. Requires write access, and
612
+ * the server refuses with a 403 while the project's switch is off. All
613
+ * or nothing: one bad event refuses the request with a 400 naming it.
614
+ * @param {string} projectId - The project the events happened in
615
+ * @param {Array<{type: string, documentId?: string, targetId?: string, data?: object, clientTs?: string}>} events - At most 500 events
616
+ * @returns {Promise<{count: number}>}
617
+ */
618
+ create: (projectId: string, events: Array<{
619
+ type: string;
620
+ documentId?: string;
621
+ targetId?: string;
622
+ data?: object;
623
+ clientTs?: string;
624
+ }>) => Promise<{
625
+ count: number;
626
+ }>;
627
+ /**
628
+ * Record one research-telemetry event (plaid-core sql/client_event.clj).
629
+ * Fire and forget: the event is buffered and sent with
630
+ * others every ten seconds, at fifty events, and when the page is
631
+ * hidden. A batch that fails is dropped, nothing is retried, and
632
+ * nothing is ever thrown. Sends nothing for a project whose switch
633
+ * (`config.plaid.research.telemetry`) is off, which it reads from the
634
+ * project itself. `suggestion.shown` is recorded once per target,
635
+ * field and value in a page session.
636
+ * @param {ClientEventType} type - The event type
637
+ * @param {object} fields
638
+ * @param {string} fields.projectId - The project it happened in
639
+ * @param {string} [fields.documentId] - The document it happened in
640
+ * @param {string} [fields.targetId] - What it is about: a token, a plan
641
+ * @param {object} [fields.data] - Its details, keyed by single lowercase words (`value`, `source`, `field`, `written`, `conversation`)
642
+ * @returns {boolean} Whether the event was buffered
643
+ */
644
+ record: (type: ClientEventType, fields: {
645
+ projectId: string;
646
+ documentId?: string;
647
+ targetId?: string;
648
+ data?: object;
649
+ }) => boolean;
650
+ /**
651
+ * Send what the recorder holds now, rather than at its next interval.
652
+ * @returns {void}
653
+ */
654
+ flush: () => void;
655
+ /**
656
+ * Tell the recorder a project's switch at once, e.g. right after a
657
+ * maintainer changed it. Turning it off drops what is buffered.
658
+ * @param {string} projectId - The project
659
+ * @param {boolean} on - Whether telemetry is on
660
+ * @returns {void}
661
+ */
662
+ setEnabled: (projectId: string, on: boolean) => void;
663
+ };
664
+ /** @param {import("./client.js").PlaidClient} client */
665
+ export function operationGroupsApi(client: import("./client.js").PlaidClient): {
666
+ /**
667
+ * Get a logical-operation group (its label + creator).
668
+ * @param {string} id - The group id
669
+ * @returns {Promise<OperationGroup>}
670
+ */
671
+ get: (id: string) => Promise<OperationGroup>;
672
+ /**
673
+ * Relabel a logical-operation group after the fact. Owner or admin only.
674
+ * @param {string} id - The group id
675
+ * @param {string|null} message - The new label
676
+ * @returns {Promise<OperationGroup>}
677
+ */
678
+ update: (id: string, message: string | null) => Promise<OperationGroup>;
679
+ };
680
+ export type TextEditOp = import("./types.js").TextEditOp;
681
+ export type TextGap = import("./types.js").TextGap;
682
+ export type MetadataOp = import("./types.js").MetadataOp;
683
+ export type LayerConstraint = import("./types.js").LayerConstraint;
684
+ export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
685
+ export type ConstraintViolation = import("./types.js").ConstraintViolation;
686
+ export type Requester = import("./types.js").Requester;
687
+ export type BatchRef = import("./types.js").BatchRef;
688
+ export type ServiceParam = import("./types.js").ServiceParam;
689
+ export type ServiceInfo = import("./types.js").ServiceInfo;
690
+ export type DiscoveredService = import("./types.js").DiscoveredService;
691
+ export type ResponseHelper = import("./types.js").ResponseHelper;
692
+ export type ServiceRegistration = import("./types.js").ServiceRegistration;
693
+ export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
694
+ export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
695
+ export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
696
+ export type OperationKind = import("./types.js").OperationKind;
697
+ export type KeySeed = import("./types.js").KeySeed;
698
+ export type PlaidBatch = import("./types.js").PlaidBatch;
699
+ export type AuditPageOptions = import("./types.js").AuditPageOptions;
700
+ export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
701
+ export type UserDataEntry = import("./types.js").UserDataEntry;
702
+ export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
703
+ export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
704
+ export type ConstraintRepair = import("./types.js").ConstraintRepair;
705
+ export type ValueSetRule = import("./types.js").ValueSetRule;
706
+ export type RefusedValues = import("./types.js").RefusedValues;
707
+ export type CommentableType = import("./types.js").CommentableType;
708
+ export type Comment = import("./types.js").Comment;
709
+ export type Guideline = import("./types.js").Guideline;
710
+ export type ClientEventType = import("./types.js").ClientEventType;
711
+ export type ClientEvent = import("./types.js").ClientEvent;
712
+ export type Invite = import("./types.js").Invite;
713
+ export type ServerLimits = import("./types.js").ServerLimits;
714
+ export type ServerHealth = import("./types.js").ServerHealth;
715
+ export type RateLimitBucket = import("./types.js").RateLimitBucket;
716
+ export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
717
+ export type BackupStatus = import("./types.js").BackupStatus;
718
+ export type ServerReport = import("./types.js").ServerReport;
719
+ export type LiveLog = import("./types.js").LiveLog;
720
+ export type SSEConnection = import("./types.js").SSEConnection;
721
+ export type SSEStats = import("./types.js").SSEStats;
722
+ export type AtomicValue = import("./types.js").AtomicValue;
723
+ export type Created = import("./types.js").Created;
724
+ export type Project = import("./types.js").Project;
725
+ export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
726
+ export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
727
+ export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
728
+ export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
729
+ export type ProjectVocab = import("./types.js").ProjectVocab;
730
+ export type PlaidDocument = import("./types.js").PlaidDocument;
731
+ export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
732
+ export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
733
+ export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
734
+ export type PlaidText = import("./types.js").PlaidText;
735
+ export type TextReshape = import("./types.js").TextReshape;
736
+ export type Token = import("./types.js").Token;
737
+ export type Span = import("./types.js").Span;
738
+ export type Relation = import("./types.js").Relation;
739
+ export type VocabItem = import("./types.js").VocabItem;
740
+ export type VocabLink = import("./types.js").VocabLink;
741
+ export type VocabLayer = import("./types.js").VocabLayer;
742
+ export type TextLayer = import("./types.js").TextLayer;
743
+ export type TokenLayer = import("./types.js").TokenLayer;
744
+ export type SpanLayer = import("./types.js").SpanLayer;
745
+ export type RelationLayer = import("./types.js").RelationLayer;
746
+ export type MetadataRecords = import("./types.js").MetadataRecords;
747
+ export type LayerRecords = import("./types.js").LayerRecords;
748
+ export type User = import("./types.js").User;
749
+ export type ProjectListEntry = import("./types.js").ProjectListEntry;
750
+ export type DocumentListEntry = import("./types.js").DocumentListEntry;
751
+ export type ApiToken = import("./types.js").ApiToken;
752
+ export type AuditUser = import("./types.js").AuditUser;
753
+ export type AuditTarget = import("./types.js").AuditTarget;
754
+ export type AuditOp = import("./types.js").AuditOp;
755
+ export type AuditEntry = import("./types.js").AuditEntry;
756
+ export type LockGrant = import("./types.js").LockGrant;
757
+ export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
758
+ export type RestoreCounts = import("./types.js").RestoreCounts;
759
+ export type OperationGroup = import("./types.js").OperationGroup;
760
+ export type QueryResult = import("./types.js").QueryResult;
761
+ export type Page<T = any> = import("./types.js").Page<T>;