@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,626 @@
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 usersApi(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
+ /**
103
+ * Get a user by ID
104
+ * @param {string} id - The resource ID
105
+ * @returns {Promise<User>}
106
+ */
107
+ get: (id: string) => Promise<User>;
108
+ /**
109
+ * Fetch a user's profile picture as raw bytes. Most callers want
110
+ * avatarUrl() instead. This one is for non-browser consumers.
111
+ * @param {string} id - The user ID
112
+ * @returns {Promise<ArrayBuffer>}
113
+ */
114
+ getAvatar: (id: string) => Promise<ArrayBuffer>;
115
+ /**
116
+ * List (or search) users. Transparently follows pagination cursors and
117
+ * returns the full flat array. Admin-or-maintainer only.
118
+ * @param {object} [opts]
119
+ * @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
120
+ * @returns {Promise<User[]>}
121
+ */
122
+ list: ({ q }?: {
123
+ q?: string;
124
+ }) => Promise<User[]>;
125
+ /**
126
+ * Fetch a single page of users (optionally filtered by `q`).
127
+ * @param {object} [opts]
128
+ * @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
129
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
130
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
131
+ * @returns {Promise<Page<User>>}
132
+ */
133
+ listPage: ({ q, limit, cursor }?: {
134
+ q?: string;
135
+ limit?: number;
136
+ cursor?: string;
137
+ }) => Promise<Page<User>>;
138
+ /**
139
+ * Async-iterate users page by page; yields each page's entries array.
140
+ * @param {object} [opts]
141
+ * @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
142
+ * @param {number} [opts.pageSize] - Per-request page size
143
+ * @returns {AsyncGenerator<User[]>}
144
+ */
145
+ iterPages: ({ q, pageSize }?: {
146
+ q?: string;
147
+ pageSize?: number;
148
+ }) => AsyncGenerator<User[]>;
149
+ /**
150
+ * Create a new user. Admin only, and not with a named API token (403):
151
+ * it needs a sign-in token.
152
+ * @param {string} email - The account's email address. It becomes the
153
+ * user's id and is what they log in with; it can never be changed.
154
+ * @param {string} password - The password
155
+ * @param {boolean} isAdmin - Whether the user is an admin
156
+ * @param {string} [displayName] - How the user is shown in the UI.
157
+ * Defaults to the local part of the email.
158
+ * @param {string} [auditMessage] - Audit message for this write
159
+ * @returns {Promise<Created>}
160
+ */
161
+ create: (email: string, password: string, isAdmin: boolean, displayName?: string, auditMessage?: string) => Promise<Created>;
162
+ /**
163
+ * Modify a user. Admins may change the display name, password, and admin
164
+ * status of any user. All other users may only modify their own display
165
+ * name or password. A password change cannot be made with a named API
166
+ * token (403): it needs a sign-in token.
167
+ *
168
+ * A user's id is their email address and is fixed for the life of the
169
+ * account — it is what they log in with, so nothing can change it.
170
+ * @param {string} id - The resource ID (the user's email address)
171
+ * @param {string} [password] - New password
172
+ * @param {string} [displayName] - New display name
173
+ * @param {boolean} [isAdmin] - New admin status
174
+ * @param {string} [auditMessage] - Audit message for this write
175
+ * @returns {Promise<User>}
176
+ */
177
+ update: (id: string, password?: string, displayName?: string, isAdmin?: boolean, auditMessage?: string) => Promise<User>;
178
+ /**
179
+ * Deactivate a user. Users are never hard-deleted: deactivation
180
+ * rejects their logins and tokens, strips their project memberships
181
+ * and vocab maintainerships, and revokes their API tokens. The user
182
+ * stays visible in listings with a deactivated-at timestamp.
183
+ * Reversible via activate(), which restores login only.
184
+ * @param {string} id - The resource ID
185
+ * @param {string} [auditMessage] - Audit message for this write
186
+ * @returns {Promise<void>}
187
+ */
188
+ delete: (id: string, auditMessage?: string) => Promise<void>;
189
+ /**
190
+ * Reactivate a deactivated user, restoring their ability to log in.
191
+ * Project memberships, vocab maintainerships, and API tokens removed
192
+ * at deactivation are NOT restored — re-grant them deliberately.
193
+ * @param {string} id - The resource ID
194
+ * @param {string} [auditMessage] - Audit message for this write
195
+ * @returns {Promise<User>}
196
+ */
197
+ activate: (id: string, auditMessage?: string) => Promise<User>;
198
+ /**
199
+ * A token that shows any user's profile picture without an
200
+ * Authorization header, for an `<img>`, which cannot send one. Resolves
201
+ * to `{ token, expiresAt }` (`expiresAt` an ISO-8601 instant, a day on by
202
+ * default). The server refuses it on every route but the picture, and
203
+ * it stops working when the user signs out or changes password.
204
+ *
205
+ * One token serves the whole client: it is kept and handed out again
206
+ * until under ten minutes of it remain (half its life, for one minted
207
+ * near the end of a login), calls made while one is being minted share
208
+ * that request, and it is dropped when the client's token changes.
209
+ * avatarUrl() uses it.
210
+ * @param {{renew?: boolean}} [options] - `renew`: mint a new one
211
+ * whatever is kept, unless one was minted in the last few seconds
212
+ * (or is being minted), which is shared
213
+ * @returns {Promise<{token: string, expiresAt: string}>}
214
+ */
215
+ avatarToken: ({ renew }?: {
216
+ renew?: boolean;
217
+ }) => Promise<{
218
+ token: string;
219
+ expiresAt: string;
220
+ }>;
221
+ /**
222
+ * Build a URL for a user's profile picture, for an `<img>` src. The
223
+ * URL carries the client's avatar token (see avatarToken()), never the
224
+ * login token.
225
+ *
226
+ * Pass the user record's `avatarHash` as the second argument whenever you
227
+ * have it: the URL then addresses that exact picture, so the browser can
228
+ * cache it indefinitely and still pick up a replacement the moment the
229
+ * user changes it. Resolves to null when `avatarHash` is null (the user
230
+ * has no picture), so callers can fall back to initials without a
231
+ * wasted request.
232
+ * @param {string} id - The user ID
233
+ * @param {string|null} [avatarHash] - The user record's `avatarHash`
234
+ * @param {{renew?: boolean}} [options] - `renew`: mint a new avatar
235
+ * token first, for a picture its URL failed to load (the token
236
+ * stops working when the login it was minted under ends)
237
+ * @returns {Promise<string|null>}
238
+ */
239
+ avatarUrl: (id: string, avatarHash?: string | null, { renew }?: {
240
+ renew?: boolean;
241
+ }) => Promise<string | null>;
242
+ /**
243
+ * Upload a profile picture. Your own, or anyone's if you are an admin.
244
+ * The server center-crops to a square, scales to the configured edge
245
+ * length, and re-encodes, so no client-side resizing is needed. Accepts
246
+ * PNG, JPEG, WebP, and GIF. Resolves to the updated user record.
247
+ * @param {string} id - The user ID
248
+ * @param {File} file - The image to upload
249
+ * @param {string} [auditMessage] - Audit message for this write
250
+ * @returns {Promise<User>}
251
+ */
252
+ setAvatar: (id: string, file: File, auditMessage?: string) => Promise<User>;
253
+ /**
254
+ * Remove a profile picture. Your own, or anyone's if you are an admin.
255
+ * @param {string} id - The user ID
256
+ * @param {string} [auditMessage] - Audit message for this write
257
+ * @returns {Promise<void>}
258
+ */
259
+ deleteAvatar: (id: string, auditMessage?: string) => Promise<void>;
260
+ };
261
+ /** @param {import("./client.js").PlaidClient} client */
262
+ export function apiTokensApi(client: import("./client.js").PlaidClient): {
263
+ /**
264
+ * List a user's named API tokens. Never includes the signed token
265
+ * string itself — that is only returned once, by create().
266
+ * Transparently follows pagination cursors and returns the full flat array.
267
+ * @param {string} userId - The user ID who owns the tokens
268
+ * @returns {Promise<ApiToken[]>}
269
+ */
270
+ list: (userId: string) => Promise<ApiToken[]>;
271
+ /**
272
+ * Fetch a single page of a user's named API tokens.
273
+ * @param {string} userId - The user ID who owns the tokens
274
+ * @param {object} [opts]
275
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
276
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
277
+ * @returns {Promise<Page<ApiToken>>}
278
+ */
279
+ listPage: (userId: string, { limit, cursor }?: {
280
+ limit?: number;
281
+ cursor?: string;
282
+ }) => Promise<Page<ApiToken>>;
283
+ /**
284
+ * Async-iterate a user's named API tokens page by page; yields each
285
+ * page's entries array.
286
+ * @param {string} userId - The user ID who owns the tokens
287
+ * @param {object} [opts]
288
+ * @param {number} [opts.pageSize] - Per-request page size
289
+ * @returns {AsyncGenerator<ApiToken[]>}
290
+ */
291
+ iterPages: (userId: string, { pageSize }?: {
292
+ pageSize?: number;
293
+ }) => AsyncGenerator<ApiToken[]>;
294
+ /**
295
+ * Mint a named API token for a user. The returned `token` is the signed
296
+ * credential and is shown ONLY here — store it immediately. API tokens
297
+ * do not expire and survive password changes / logout; revoke to kill.
298
+ * A client signed in with a named API token cannot do this (403): it
299
+ * needs a sign-in token.
300
+ * @param {string} userId - The user ID who will own the token
301
+ * @param {string} name - A human label, e.g. "Stanza parser"
302
+ * @param {string} [auditMessage] - Audit message for this write
303
+ * @returns {Promise<{id: string, name: string, token: string}>}
304
+ */
305
+ create: (userId: string, name: string, auditMessage?: string) => Promise<{
306
+ id: string;
307
+ name: string;
308
+ token: string;
309
+ }>;
310
+ /**
311
+ * Revoke a named API token (soft-revoke; idempotent).
312
+ * A client signed in with a named API token cannot do this (403): it
313
+ * needs a sign-in token.
314
+ * @param {string} userId - The user ID who owns the token
315
+ * @param {string} tokenId - The token ID to revoke
316
+ * @param {string} [auditMessage] - Audit message for this write
317
+ * @returns {Promise<void>}
318
+ */
319
+ revoke: (userId: string, tokenId: string, auditMessage?: string) => Promise<void>;
320
+ };
321
+ /** @param {import("./client.js").PlaidClient} client */
322
+ export function invitesApi(client: import("./client.js").PlaidClient): {
323
+ /**
324
+ * List invites you minted, oldest first. With `projectId`, lists that
325
+ * project's invites instead (including co-maintainers'), which requires
326
+ * maintainer or admin on it. Never includes invite codes — the code is
327
+ * returned once, by create(), and is not recoverable afterward.
328
+ * Transparently follows pagination cursors and returns the full flat array.
329
+ * @param {object} [opts]
330
+ * @param {string} [opts.projectId] - List this project's invites instead of your own
331
+ * @param {boolean} [opts.all] - List every invite on the server (admin only)
332
+ * @returns {Promise<Invite[]>}
333
+ */
334
+ list: ({ projectId, all }?: {
335
+ projectId?: string;
336
+ all?: boolean;
337
+ }) => Promise<Invite[]>;
338
+ /**
339
+ * Fetch a single page of invites.
340
+ * @param {object} [opts]
341
+ * @param {string} [opts.projectId] - List this project's invites instead of your own
342
+ * @param {boolean} [opts.all] - List every invite on the server (admin only)
343
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
344
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
345
+ * @returns {Promise<Page<Invite>>}
346
+ */
347
+ listPage: ({ projectId, all, limit, cursor }?: {
348
+ projectId?: string;
349
+ all?: boolean;
350
+ limit?: number;
351
+ cursor?: string;
352
+ }) => Promise<Page<Invite>>;
353
+ /**
354
+ * Async-iterate invites page by page; yields each page's entries array.
355
+ * @param {object} [opts]
356
+ * @param {string} [opts.projectId] - List this project's invites instead of your own
357
+ * @param {boolean} [opts.all] - List every invite on the server (admin only)
358
+ * @param {number} [opts.pageSize] - Per-request page size
359
+ * @returns {AsyncGenerator<Invite[]>}
360
+ */
361
+ iterPages: ({ projectId, all, pageSize }?: {
362
+ projectId?: string;
363
+ all?: boolean;
364
+ pageSize?: number;
365
+ }) => AsyncGenerator<Invite[]>;
366
+ /**
367
+ * Mint an invite. The returned `code` is shown ONLY here — it is never
368
+ * stored and cannot be recovered, so build and hand off the link now.
369
+ * Use PlaidClient.inviteUrl() to turn it into one.
370
+ *
371
+ * Admins may mint anything. A project maintainer may mint role grants on
372
+ * projects they maintain, and nothing else: no admin grant, no grantless
373
+ * invite, no password resets — so for a non-admin, projectId/projectRole
374
+ * are required in practice (403 without them).
375
+ *
376
+ * Needs a signed-in session: a client signed in with a named API token
377
+ * cannot mint any invite (403).
378
+ *
379
+ * EVERY option is optional; `create()` with no arguments mints a
380
+ * single-use signup link granting nothing but an account. Two pairing
381
+ * rules the server enforces with a 400: projectId and projectRole must be
382
+ * given TOGETHER, and targetUserId may not be combined with projectId,
383
+ * grantAdmin, or a maxUses above 1.
384
+ * @param {object} [opts]
385
+ * @param {string} [opts.projectId] - Project the redeemer joins (requires projectRole)
386
+ * @param {string} [opts.projectRole] - "reader" | "writer" | "maintainer" (requires projectId)
387
+ * @param {boolean} [opts.grantAdmin] - Make the new account a global admin (admin only)
388
+ * @param {string} [opts.targetUserId] - Password reset for that user instead of a signup; admin only, single-use, grants nothing
389
+ * @param {number} [opts.maxUses] - How many accounts this link may create (default 1)
390
+ * @param {number} [opts.ttlDays] - Days until it expires (default 14, max 365)
391
+ * @param {string} [opts.note] - Human label shown in your invite list
392
+ * @param {string} [auditMessage] - Audit message for this write
393
+ * @returns {Promise<Invite & {code: string}>}
394
+ */
395
+ create: ({ projectId, projectRole, grantAdmin, targetUserId, maxUses, ttlDays, note, }?: {
396
+ projectId?: string;
397
+ projectRole?: string;
398
+ grantAdmin?: boolean;
399
+ targetUserId?: string;
400
+ maxUses?: number;
401
+ ttlDays?: number;
402
+ note?: string;
403
+ }, auditMessage?: string) => Promise<Invite & {
404
+ code: string;
405
+ }>;
406
+ /**
407
+ * Revoke an invite, killing the link immediately. Idempotent. Allowed for
408
+ * the creator, an admin, or a maintainer of the invite's project.
409
+ * @param {string} id - The invite ID
410
+ * @param {string} [auditMessage] - Audit message for this write
411
+ * @returns {Promise<void>}
412
+ */
413
+ revoke: (id: string, auditMessage?: string) => Promise<void>;
414
+ };
415
+ /** @param {import("./client.js").PlaidClient} client */
416
+ export function authApi(client: import("./client.js").PlaidClient): {
417
+ /**
418
+ * End every sign-in of this user on every device: each browser tab,
419
+ * script and service holding one of the user's sign-in tokens is
420
+ * refused from now on, this client included. Named API tokens are not
421
+ * affected (revoke one with `apiTokens.revoke`). To sign out of one tab
422
+ * only, discard its token instead. A signal rather than project data:
423
+ * made on a batch it still goes out at once, and it never joins an
424
+ * operation.
425
+ * @returns {Promise<void>}
426
+ */
427
+ logoutEverywhere: () => Promise<void>;
428
+ };
429
+ /** @param {import("./client.js").PlaidClient} client */
430
+ export function userDataApi(client: import("./client.js").PlaidClient): {
431
+ /**
432
+ * Read one private data entry ({key, updatedAt, version, value}); 404 if absent.
433
+ * @param {string} userId
434
+ * @param {string} key
435
+ * @returns {Promise<UserDataEntry & {value: any}>}
436
+ */
437
+ get: (userId: string, key: string) => Promise<UserDataEntry & {
438
+ value: any;
439
+ }>;
440
+ /**
441
+ * List a user's private data entries ({key, updatedAt}, plus value when
442
+ * includeValues), ordered by key. Owner or admin only. Transparently
443
+ * follows pagination cursors and returns the full flat array.
444
+ *
445
+ * Narrow with `prefix` (the literal head of a key) and/or `pattern`, a
446
+ * GLOB over the whole key (`*` any run, `?` one character) — the way to
447
+ * ask for a key convention identified by a segment in the middle, e.g.
448
+ * `igt:assistant:*:meta:*` for every conversation's sidebar entry across
449
+ * every project without dragging down the transcripts beside them.
450
+ *
451
+ * `pageSize` is exposed here, and defaults lower than elsewhere, because
452
+ * one value runs to megabytes (`userDataValueBytes` in
453
+ * `server.limits()`): a page of them with `includeValues` is the
454
+ * largest response this API can be asked for. Raise it when the listing
455
+ * is keys, or the values are known to be small.
456
+ * @param {string} userId
457
+ * @param {object} [opts]
458
+ * @param {string} [opts.prefix] - Only keys starting with this prefix
459
+ * @param {string} [opts.pattern] - Only keys matching this GLOB
460
+ * @param {boolean} [opts.includeValues] - Also return each entry's value
461
+ * @param {number} [opts.pageSize=100] - Entries per request (1..1000)
462
+ * @returns {Promise<UserDataEntry[]>}
463
+ */
464
+ list: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
465
+ prefix?: string;
466
+ pattern?: string;
467
+ includeValues?: boolean;
468
+ pageSize?: number;
469
+ }) => Promise<UserDataEntry[]>;
470
+ /**
471
+ * One page of a user's private data entries, ordered by key.
472
+ * @param {string} userId
473
+ * @param {object} [opts]
474
+ * @param {string} [opts.prefix] - Only keys starting with this prefix
475
+ * @param {string} [opts.pattern] - Only keys matching this GLOB
476
+ * @param {boolean} [opts.includeValues] - Also return each entry's value
477
+ * @param {number} [opts.limit] - Page size (1..1000; server default 100)
478
+ * @param {string} [opts.cursor] - Opaque cursor from a previous page
479
+ * @returns {Promise<Page<UserDataEntry>>}
480
+ */
481
+ listPage: (userId: string, { prefix, pattern, includeValues, limit, cursor }?: {
482
+ prefix?: string;
483
+ pattern?: string;
484
+ includeValues?: boolean;
485
+ limit?: number;
486
+ cursor?: string;
487
+ }) => Promise<Page<UserDataEntry>>;
488
+ /**
489
+ * Async generator over a user's private data entries, one page at a time.
490
+ * @param {string} userId
491
+ * @param {object} [opts]
492
+ * @param {string} [opts.prefix] - Only keys starting with this prefix
493
+ * @param {string} [opts.pattern] - Only keys matching this GLOB
494
+ * @param {boolean} [opts.includeValues] - Also return each entry's value
495
+ * @param {number} [opts.pageSize=100] - Entries per request (1..1000)
496
+ * @returns {AsyncGenerator<UserDataEntry[]>}
497
+ */
498
+ iterPages: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
499
+ prefix?: string;
500
+ pattern?: string;
501
+ includeValues?: boolean;
502
+ pageSize?: number;
503
+ }) => AsyncGenerator<UserDataEntry[]>;
504
+ /**
505
+ * Delete one private data entry; 404 if absent.
506
+ * @param {string} userId
507
+ * @param {string} key
508
+ * @returns {Promise<void>}
509
+ */
510
+ delete: (userId: string, key: string) => Promise<void>;
511
+ /**
512
+ * Create or replace one private data entry. `value` is any JSON, up to
513
+ * the server's `userDataValueBytes` (`server.limits()`, 5 MB by
514
+ * default), and is refused with 413 over it, after which
515
+ * `server.limits()` answers the figure the server has now. Not audited,
516
+ * not batchable.
517
+ *
518
+ * The server stores it verbatim, but this client recases object keys on
519
+ * the way out and back like any other body (`myKey` <-> `my-key`), so a
520
+ * value whose keys are camelCase round-trips unchanged while one keyed
521
+ * by arbitrary strings does not. Put such a map under a `metadata` key,
522
+ * which both clients pass through untouched.
523
+ *
524
+ * Every write raises the entry's `version` by one, and reads answer it.
525
+ * With `version`, the write lands only when the entry is still at that
526
+ * version (0: only when there is no entry), and is otherwise refused with
527
+ * 409, `error: "version-mismatch"`, and the stored `version` and
528
+ * `updatedAt` on the error's `responseData`: read it again and make the
529
+ * change on what is there.
530
+ * @param {string} userId
531
+ * @param {string} key
532
+ * @param {*} value
533
+ * @param {object} [opts]
534
+ * @param {number} [opts.version] - The version this write was made from
535
+ * @returns {Promise<{key: string, updatedAt: string, version: number}>}
536
+ */
537
+ put: (userId: string, key: string, value: any, { version }?: {
538
+ version?: number;
539
+ }) => Promise<{
540
+ key: string;
541
+ updatedAt: string;
542
+ version: number;
543
+ }>;
544
+ };
545
+ export type TextEditOp = import("./types.js").TextEditOp;
546
+ export type TextGap = import("./types.js").TextGap;
547
+ export type MetadataOp = import("./types.js").MetadataOp;
548
+ export type LayerConstraint = import("./types.js").LayerConstraint;
549
+ export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
550
+ export type ConstraintViolation = import("./types.js").ConstraintViolation;
551
+ export type Requester = import("./types.js").Requester;
552
+ export type BatchRef = import("./types.js").BatchRef;
553
+ export type ServiceParam = import("./types.js").ServiceParam;
554
+ export type ServiceInfo = import("./types.js").ServiceInfo;
555
+ export type DiscoveredService = import("./types.js").DiscoveredService;
556
+ export type ResponseHelper = import("./types.js").ResponseHelper;
557
+ export type ServiceRegistration = import("./types.js").ServiceRegistration;
558
+ export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
559
+ export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
560
+ export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
561
+ export type OperationKind = import("./types.js").OperationKind;
562
+ export type KeySeed = import("./types.js").KeySeed;
563
+ export type PlaidBatch = import("./types.js").PlaidBatch;
564
+ export type AuditPageOptions = import("./types.js").AuditPageOptions;
565
+ export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
566
+ export type UserDataEntry = import("./types.js").UserDataEntry;
567
+ export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
568
+ export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
569
+ export type ConstraintRepair = import("./types.js").ConstraintRepair;
570
+ export type ValueSetRule = import("./types.js").ValueSetRule;
571
+ export type RefusedValues = import("./types.js").RefusedValues;
572
+ export type CommentableType = import("./types.js").CommentableType;
573
+ export type Comment = import("./types.js").Comment;
574
+ export type Guideline = import("./types.js").Guideline;
575
+ export type ClientEventType = import("./types.js").ClientEventType;
576
+ export type ClientEvent = import("./types.js").ClientEvent;
577
+ export type Invite = import("./types.js").Invite;
578
+ export type ServerLimits = import("./types.js").ServerLimits;
579
+ export type ServerHealth = import("./types.js").ServerHealth;
580
+ export type RateLimitBucket = import("./types.js").RateLimitBucket;
581
+ export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
582
+ export type BackupStatus = import("./types.js").BackupStatus;
583
+ export type ServerReport = import("./types.js").ServerReport;
584
+ export type LiveLog = import("./types.js").LiveLog;
585
+ export type SSEConnection = import("./types.js").SSEConnection;
586
+ export type SSEStats = import("./types.js").SSEStats;
587
+ export type AtomicValue = import("./types.js").AtomicValue;
588
+ export type Created = import("./types.js").Created;
589
+ export type Project = import("./types.js").Project;
590
+ export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
591
+ export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
592
+ export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
593
+ export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
594
+ export type ProjectVocab = import("./types.js").ProjectVocab;
595
+ export type PlaidDocument = import("./types.js").PlaidDocument;
596
+ export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
597
+ export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
598
+ export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
599
+ export type PlaidText = import("./types.js").PlaidText;
600
+ export type TextReshape = import("./types.js").TextReshape;
601
+ export type Token = import("./types.js").Token;
602
+ export type Span = import("./types.js").Span;
603
+ export type Relation = import("./types.js").Relation;
604
+ export type VocabItem = import("./types.js").VocabItem;
605
+ export type VocabLink = import("./types.js").VocabLink;
606
+ export type VocabLayer = import("./types.js").VocabLayer;
607
+ export type TextLayer = import("./types.js").TextLayer;
608
+ export type TokenLayer = import("./types.js").TokenLayer;
609
+ export type SpanLayer = import("./types.js").SpanLayer;
610
+ export type RelationLayer = import("./types.js").RelationLayer;
611
+ export type MetadataRecords = import("./types.js").MetadataRecords;
612
+ export type LayerRecords = import("./types.js").LayerRecords;
613
+ export type User = import("./types.js").User;
614
+ export type ProjectListEntry = import("./types.js").ProjectListEntry;
615
+ export type DocumentListEntry = import("./types.js").DocumentListEntry;
616
+ export type ApiToken = import("./types.js").ApiToken;
617
+ export type AuditUser = import("./types.js").AuditUser;
618
+ export type AuditTarget = import("./types.js").AuditTarget;
619
+ export type AuditOp = import("./types.js").AuditOp;
620
+ export type AuditEntry = import("./types.js").AuditEntry;
621
+ export type LockGrant = import("./types.js").LockGrant;
622
+ export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
623
+ export type RestoreCounts = import("./types.js").RestoreCounts;
624
+ export type OperationGroup = import("./types.js").OperationGroup;
625
+ export type QueryResult = import("./types.js").QueryResult;
626
+ export type Page<T = any> = import("./types.js").Page<T>;