@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.
- package/README.md +39 -0
- package/package.json +13 -6
- package/src/apiAnnotations.d.ts +508 -0
- package/src/apiAnnotations.js +543 -0
- package/src/apiDocuments.d.ts +569 -0
- package/src/apiDocuments.js +551 -0
- package/src/apiLayers.d.ts +369 -0
- package/src/apiLayers.js +222 -0
- package/src/apiMessages.d.ts +293 -0
- package/src/apiMessages.js +265 -0
- package/src/apiPeople.d.ts +626 -0
- package/src/apiPeople.js +698 -0
- package/src/apiProject.d.ts +761 -0
- package/src/apiProject.js +774 -0
- package/src/apiServer.d.ts +457 -0
- package/src/apiServer.js +424 -0
- package/src/apiVocab.d.ts +456 -0
- package/src/apiVocab.js +425 -0
- package/src/batch.d.ts +54 -0
- package/src/batch.js +323 -0
- package/src/batchRef.d.ts +30 -0
- package/src/batchRef.js +128 -0
- package/src/client.d.ts +1321 -0
- package/src/client.js +743 -0
- package/src/codepoint.d.ts +94 -0
- package/src/codepoint.js +131 -1
- package/src/constraints.d.ts +85 -0
- package/src/constraints.js +112 -0
- package/src/created.d.ts +2 -0
- package/src/created.js +29 -0
- package/src/documentLock.d.ts +172 -0
- package/src/documentLock.js +384 -0
- package/src/entryForms.d.ts +68 -0
- package/src/entryForms.js +164 -0
- package/src/events.d.ts +60 -0
- package/src/events.js +271 -0
- package/src/families.d.ts +349 -0
- package/src/families.js +396 -0
- package/src/http.d.ts +233 -0
- package/src/http.js +809 -93
- package/src/ids.d.ts +26 -0
- package/src/ids.js +96 -0
- package/src/index.d.ts +101 -0
- package/src/index.js +183 -2105
- package/src/metadataOps.d.ts +15 -0
- package/src/metadataOps.js +124 -0
- package/src/operations.d.ts +36 -0
- package/src/operations.js +164 -0
- package/src/pagination.d.ts +49 -0
- package/src/pagination.js +20 -53
- package/src/provenance.d.ts +243 -0
- package/src/provenance.js +458 -36
- package/src/replayed.d.ts +3 -0
- package/src/replayed.js +31 -0
- package/src/requester.d.ts +60 -0
- package/src/requester.js +74 -0
- package/src/roles.d.ts +104 -0
- package/src/roles.js +64 -2
- package/src/serviceSchema.d.ts +337 -0
- package/src/serviceSchema.js +177 -60
- package/src/services.d.ts +319 -0
- package/src/services.js +742 -58
- package/src/sse.d.ts +30 -0
- package/src/sse.js +80 -3
- package/src/testing.d.ts +128 -0
- package/src/testing.js +379 -0
- package/src/textEdits.d.ts +59 -0
- package/src/textEdits.js +234 -0
- package/src/transforms.d.ts +25 -0
- package/src/transforms.js +11 -1
- package/src/types.d.ts +867 -0
- package/src/types.js +663 -0
- package/index.d.ts +0 -532
package/src/client.d.ts
ADDED
|
@@ -0,0 +1,1321 @@
|
|
|
1
|
+
export type TextEditOp = import("./types.js").TextEditOp;
|
|
2
|
+
export type TextGap = import("./types.js").TextGap;
|
|
3
|
+
export type MetadataOp = import("./types.js").MetadataOp;
|
|
4
|
+
export type LayerConstraint = import("./types.js").LayerConstraint;
|
|
5
|
+
export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
|
|
6
|
+
export type ConstraintViolation = import("./types.js").ConstraintViolation;
|
|
7
|
+
export type Requester = import("./types.js").Requester;
|
|
8
|
+
export type BatchRef = import("./types.js").BatchRef;
|
|
9
|
+
export type ServiceParam = import("./types.js").ServiceParam;
|
|
10
|
+
export type ServiceInfo = import("./types.js").ServiceInfo;
|
|
11
|
+
export type DiscoveredService = import("./types.js").DiscoveredService;
|
|
12
|
+
export type ResponseHelper = import("./types.js").ResponseHelper;
|
|
13
|
+
export type ServiceRegistration = import("./types.js").ServiceRegistration;
|
|
14
|
+
export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
|
|
15
|
+
export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
|
|
16
|
+
export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
|
|
17
|
+
export type OperationKind = import("./types.js").OperationKind;
|
|
18
|
+
export type KeySeed = import("./types.js").KeySeed;
|
|
19
|
+
export type PlaidBatch = import("./types.js").PlaidBatch;
|
|
20
|
+
export type AuditPageOptions = import("./types.js").AuditPageOptions;
|
|
21
|
+
export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
|
|
22
|
+
export type UserDataEntry = import("./types.js").UserDataEntry;
|
|
23
|
+
export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
|
|
24
|
+
export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
|
|
25
|
+
export type ConstraintRepair = import("./types.js").ConstraintRepair;
|
|
26
|
+
export type ValueSetRule = import("./types.js").ValueSetRule;
|
|
27
|
+
export type RefusedValues = import("./types.js").RefusedValues;
|
|
28
|
+
export type CommentableType = import("./types.js").CommentableType;
|
|
29
|
+
export type Comment = import("./types.js").Comment;
|
|
30
|
+
export type Guideline = import("./types.js").Guideline;
|
|
31
|
+
export type ClientEventType = import("./types.js").ClientEventType;
|
|
32
|
+
export type ClientEvent = import("./types.js").ClientEvent;
|
|
33
|
+
export type Invite = import("./types.js").Invite;
|
|
34
|
+
export type ServerLimits = import("./types.js").ServerLimits;
|
|
35
|
+
export type ServerHealth = import("./types.js").ServerHealth;
|
|
36
|
+
export type RateLimitBucket = import("./types.js").RateLimitBucket;
|
|
37
|
+
export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
|
|
38
|
+
export type BackupStatus = import("./types.js").BackupStatus;
|
|
39
|
+
export type ServerReport = import("./types.js").ServerReport;
|
|
40
|
+
export type LiveLog = import("./types.js").LiveLog;
|
|
41
|
+
export type SSEConnection = import("./types.js").SSEConnection;
|
|
42
|
+
export type SSEStats = import("./types.js").SSEStats;
|
|
43
|
+
export type AtomicValue = import("./types.js").AtomicValue;
|
|
44
|
+
export type Created = import("./types.js").Created;
|
|
45
|
+
export type Project = import("./types.js").Project;
|
|
46
|
+
export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
|
|
47
|
+
export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
|
|
48
|
+
export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
|
|
49
|
+
export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
|
|
50
|
+
export type ProjectVocab = import("./types.js").ProjectVocab;
|
|
51
|
+
export type PlaidDocument = import("./types.js").PlaidDocument;
|
|
52
|
+
export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
|
|
53
|
+
export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
|
|
54
|
+
export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
|
|
55
|
+
export type PlaidText = import("./types.js").PlaidText;
|
|
56
|
+
export type TextReshape = import("./types.js").TextReshape;
|
|
57
|
+
export type Token = import("./types.js").Token;
|
|
58
|
+
export type Span = import("./types.js").Span;
|
|
59
|
+
export type Relation = import("./types.js").Relation;
|
|
60
|
+
export type VocabItem = import("./types.js").VocabItem;
|
|
61
|
+
export type VocabLink = import("./types.js").VocabLink;
|
|
62
|
+
export type VocabLayer = import("./types.js").VocabLayer;
|
|
63
|
+
export type TextLayer = import("./types.js").TextLayer;
|
|
64
|
+
export type TokenLayer = import("./types.js").TokenLayer;
|
|
65
|
+
export type SpanLayer = import("./types.js").SpanLayer;
|
|
66
|
+
export type RelationLayer = import("./types.js").RelationLayer;
|
|
67
|
+
export type MetadataRecords = import("./types.js").MetadataRecords;
|
|
68
|
+
export type LayerRecords = import("./types.js").LayerRecords;
|
|
69
|
+
export type User = import("./types.js").User;
|
|
70
|
+
export type ProjectListEntry = import("./types.js").ProjectListEntry;
|
|
71
|
+
export type DocumentListEntry = import("./types.js").DocumentListEntry;
|
|
72
|
+
export type ApiToken = import("./types.js").ApiToken;
|
|
73
|
+
export type AuditUser = import("./types.js").AuditUser;
|
|
74
|
+
export type AuditTarget = import("./types.js").AuditTarget;
|
|
75
|
+
export type AuditOp = import("./types.js").AuditOp;
|
|
76
|
+
export type AuditEntry = import("./types.js").AuditEntry;
|
|
77
|
+
export type LockGrant = import("./types.js").LockGrant;
|
|
78
|
+
export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
|
|
79
|
+
export type RestoreCounts = import("./types.js").RestoreCounts;
|
|
80
|
+
export type OperationGroup = import("./types.js").OperationGroup;
|
|
81
|
+
export type QueryResult = import("./types.js").QueryResult;
|
|
82
|
+
export type Page<T = any> = import("./types.js").Page<T>;
|
|
83
|
+
export class PlaidClient {
|
|
84
|
+
/**
|
|
85
|
+
* Liveness, version and database size, with NO authentication and no client
|
|
86
|
+
* instance — for a launcher or status page checking whether a server is up
|
|
87
|
+
* before anyone logs in.
|
|
88
|
+
* @param {string} baseUrl - The API base URL
|
|
89
|
+
* @param {{timeout?: number | null}} [options]
|
|
90
|
+
* @returns {Promise<ServerHealth>}
|
|
91
|
+
*/
|
|
92
|
+
static health(baseUrl: string, options?: {
|
|
93
|
+
timeout?: number | null;
|
|
94
|
+
}): Promise<ServerHealth>;
|
|
95
|
+
/**
|
|
96
|
+
* The limits this server enforces, with NO authentication and no client
|
|
97
|
+
* instance. See the instance method for the shape.
|
|
98
|
+
* @param {string} baseUrl - The API base URL
|
|
99
|
+
* @param {{timeout?: number | null}} [options]
|
|
100
|
+
* @returns {Promise<{limits: ServerLimits}>}
|
|
101
|
+
*/
|
|
102
|
+
static info(baseUrl: string, options?: {
|
|
103
|
+
timeout?: number | null;
|
|
104
|
+
}): Promise<{
|
|
105
|
+
limits: ServerLimits;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Build the link to hand someone for an invite code. The server never sees
|
|
109
|
+
* an app URL, so the app that minted the invite is the one that names it.
|
|
110
|
+
* Both SPAs use HashRouter, so the code rides in the fragment — which also
|
|
111
|
+
* keeps it out of server access logs.
|
|
112
|
+
* @param {string} appUrl - Where the SPA lives, e.g. "https://plaid.example.org/igt/"
|
|
113
|
+
* @param {string} code - The code returned by invites.create()
|
|
114
|
+
* @returns {string}
|
|
115
|
+
*/
|
|
116
|
+
static inviteUrl(appUrl: string, code: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* Describe an invite code, with NO authentication — this is what a signup
|
|
119
|
+
* page calls before the redeemer has an account. Returns the kind of link
|
|
120
|
+
* ("signup" or "password-reset"), its status ("active", "used", "expired",
|
|
121
|
+
* "revoked", or "inactive" when its creator can no longer grant what it
|
|
122
|
+
* grants), and the project it grants access to, if any.
|
|
123
|
+
*
|
|
124
|
+
* Throws a 404-shaped error if the code is unknown. A known-but-dead code
|
|
125
|
+
* resolves normally with a non-"active" status, so the page can say why.
|
|
126
|
+
* @param {string} baseUrl - The API base URL
|
|
127
|
+
* @param {string} code - The invite code
|
|
128
|
+
* @param {object} [options]
|
|
129
|
+
* @returns {Promise<{kind: string, status: string, expiresAt: string, projectName?: string, projectRole?: string, email?: string, grantAdmin: boolean}>}
|
|
130
|
+
*/
|
|
131
|
+
static lookupInvite(baseUrl: string, code: string, options?: object): Promise<{
|
|
132
|
+
kind: string;
|
|
133
|
+
status: string;
|
|
134
|
+
expiresAt: string;
|
|
135
|
+
projectName?: string;
|
|
136
|
+
projectRole?: string;
|
|
137
|
+
email?: string;
|
|
138
|
+
grantAdmin: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Redeem an invite code, with NO authentication.
|
|
142
|
+
*
|
|
143
|
+
* For a signup invite, pass `email` and `password` to create the account
|
|
144
|
+
* (and optionally `displayName`); the invite's grants are applied in the
|
|
145
|
+
* same transaction. For a password reset link, pass `password` only.
|
|
146
|
+
* Resolves to a logged-in client, exactly like login() — the redeemer just
|
|
147
|
+
* chose these credentials, so there is no reason to send them to a login
|
|
148
|
+
* form to retype them.
|
|
149
|
+
* @param {string} baseUrl - The API base URL
|
|
150
|
+
* @param {string} code - The invite code
|
|
151
|
+
* @param {object} credentials
|
|
152
|
+
* @param {string} [credentials.email] - The new account's email address,
|
|
153
|
+
* which becomes its id and login (signup only)
|
|
154
|
+
* @param {string} [credentials.displayName] - How the new user is shown in
|
|
155
|
+
* the UI; defaults to the local part of the email (signup only)
|
|
156
|
+
* @param {string} credentials.password - Desired password (min 8 characters)
|
|
157
|
+
* @param {object} [options]
|
|
158
|
+
* @returns {Promise<{client: PlaidClient, userId: string, kind: string}>}
|
|
159
|
+
*/
|
|
160
|
+
static redeemInvite(baseUrl: string, code: string, { email, password, displayName }?: {
|
|
161
|
+
email?: string;
|
|
162
|
+
displayName?: string;
|
|
163
|
+
password: string;
|
|
164
|
+
}, options?: object): Promise<{
|
|
165
|
+
client: PlaidClient;
|
|
166
|
+
userId: string;
|
|
167
|
+
kind: string;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* Authenticate and return a new client instance with token. This is the
|
|
171
|
+
* single auth entry point — there is no `client.login` resource.
|
|
172
|
+
* @param {string} baseUrl - The base URL for the API
|
|
173
|
+
* @param {string} userId - User ID for authentication
|
|
174
|
+
* @param {string} password - Password for authentication
|
|
175
|
+
* @param {object} [options] - Client options forwarded to the constructor (e.g. { timeout })
|
|
176
|
+
* @returns {Promise<PlaidClient>} - Authenticated client instance
|
|
177
|
+
*/
|
|
178
|
+
static login(baseUrl: string, userId: string, password: string, options?: object): Promise<PlaidClient>;
|
|
179
|
+
/**
|
|
180
|
+
* Create a new PlaidClient instance
|
|
181
|
+
* @param {string} baseUrl - The base URL for the API
|
|
182
|
+
* @param {string} token - The authentication token
|
|
183
|
+
* @param {PlaidClientOptions} [options] - Client options
|
|
184
|
+
*/
|
|
185
|
+
constructor(baseUrl: string, token: string, options?: PlaidClientOptions);
|
|
186
|
+
baseUrl: string;
|
|
187
|
+
token: string;
|
|
188
|
+
/** @type {number | null} */
|
|
189
|
+
timeout: number | null;
|
|
190
|
+
/** @type {number | null} */
|
|
191
|
+
batchTimeout: number | null;
|
|
192
|
+
/** @type {number[] | undefined} */
|
|
193
|
+
retryDelaysMs: number[] | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* The latest version seen for each document written through this client,
|
|
196
|
+
* keyed by document id.
|
|
197
|
+
* @type {Record<string, number>}
|
|
198
|
+
*/
|
|
199
|
+
documentVersions: Record<string, number>;
|
|
200
|
+
/**
|
|
201
|
+
* True once a response left its version list out
|
|
202
|
+
* (X-Document-Versions-Omitted, past fifty documents). Every version held
|
|
203
|
+
* was then forgotten, and the strict-mode document's is read again before
|
|
204
|
+
* the next write.
|
|
205
|
+
* @type {boolean | undefined}
|
|
206
|
+
*/
|
|
207
|
+
documentVersionsOmitted: boolean | undefined;
|
|
208
|
+
/** @type {number | null} */
|
|
209
|
+
serverClockOffsetMs: number | null;
|
|
210
|
+
/**
|
|
211
|
+
* The document strict mode is entered for, or null.
|
|
212
|
+
* @type {string | null}
|
|
213
|
+
*/
|
|
214
|
+
strictModeDocumentId: string | null;
|
|
215
|
+
/** @type {import("./documentLock.js").DocumentLockLost | null} */
|
|
216
|
+
documentLockLost: import("./documentLock.js").DocumentLockLost | null;
|
|
217
|
+
lockKeepers: Map<any, any>;
|
|
218
|
+
/**
|
|
219
|
+
* @type {{id: string, message: string | null, kind: OperationKind | null,
|
|
220
|
+
* ref: string | null, depth: number, written: boolean, refined: any,
|
|
221
|
+
* frames: object[]} | null}
|
|
222
|
+
*/
|
|
223
|
+
operationGroup: {
|
|
224
|
+
id: string;
|
|
225
|
+
message: string | null;
|
|
226
|
+
kind: OperationKind | null;
|
|
227
|
+
ref: string | null;
|
|
228
|
+
depth: number;
|
|
229
|
+
written: boolean;
|
|
230
|
+
refined: any;
|
|
231
|
+
frames: object[];
|
|
232
|
+
} | null;
|
|
233
|
+
/** @type {((error: Error) => void) | null} */
|
|
234
|
+
onAuthError: ((error: Error) => void) | null;
|
|
235
|
+
/** @private */
|
|
236
|
+
private _authErrorFired;
|
|
237
|
+
/** @private */
|
|
238
|
+
private _retryListeners;
|
|
239
|
+
/** @private */
|
|
240
|
+
private _serverFacts;
|
|
241
|
+
/** @private @type {object | null} */
|
|
242
|
+
private _openedFrame;
|
|
243
|
+
/**
|
|
244
|
+
* A stream of this client ended without being closed here: the server may
|
|
245
|
+
* have restarted, with other limits.
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
private _noteStreamDropped;
|
|
249
|
+
/**
|
|
250
|
+
* A stream of this client is open. After a drop the limits are read again,
|
|
251
|
+
* once however many streams reopen.
|
|
252
|
+
* @private
|
|
253
|
+
*/
|
|
254
|
+
private _noteStreamOpened;
|
|
255
|
+
/**
|
|
256
|
+
* Hear every time a request is sent again: after a 503 (the database was
|
|
257
|
+
* busy), or for a keyed write after its answer was lost (no response, 502,
|
|
258
|
+
* 504). The listener gets `{ attempt, retries, delay, error }` before the
|
|
259
|
+
* wait. A screen that writes through the client directly can say it is
|
|
260
|
+
* retrying while the server does not answer, though the browser is online.
|
|
261
|
+
* @param {(info: {attempt: number, retries: number, delay: number, error: Error}) => void} listener
|
|
262
|
+
* @returns {() => void} the unsubscribe
|
|
263
|
+
*/
|
|
264
|
+
onRetry(listener: (info: {
|
|
265
|
+
attempt: number;
|
|
266
|
+
retries: number;
|
|
267
|
+
delay: number;
|
|
268
|
+
error: Error;
|
|
269
|
+
}) => void): () => void;
|
|
270
|
+
/**
|
|
271
|
+
* Tell every `onRetry` listener. A listener that throws is passed over.
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
private _noteRetry;
|
|
275
|
+
/**
|
|
276
|
+
* The server's time now, as its last response's Date header put it (to the
|
|
277
|
+
* second), else this machine's. Judge a time the server stamped, such as an
|
|
278
|
+
* audit entry's `ts`, against this rather than `Date.now()`: a browser
|
|
279
|
+
* clock can be minutes off.
|
|
280
|
+
* @returns {Date}
|
|
281
|
+
*/
|
|
282
|
+
serverNow(): Date;
|
|
283
|
+
/**
|
|
284
|
+
* The API bundles (`client.documents`, `client.tokens`, ...). Installed on
|
|
285
|
+
* the client, and again on every batch it opens (see `batch()`): a batch is
|
|
286
|
+
* a view of the client with its own `_request`, so the same bundles built
|
|
287
|
+
* on it queue instead of sending.
|
|
288
|
+
* @private
|
|
289
|
+
*/
|
|
290
|
+
private _installResources;
|
|
291
|
+
documents: {
|
|
292
|
+
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<import("./families.js").AuditEntry[]>;
|
|
293
|
+
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
294
|
+
startTime?: string;
|
|
295
|
+
endTime?: string;
|
|
296
|
+
opTypes?: string[] | string;
|
|
297
|
+
kinds?: import("./families.js").OperationKind[] | string;
|
|
298
|
+
order?: "asc" | "desc";
|
|
299
|
+
limit?: number;
|
|
300
|
+
cursor?: string;
|
|
301
|
+
opsLimit?: number;
|
|
302
|
+
entryId?: string;
|
|
303
|
+
}) => Promise<import("./families.js").Page<import("./families.js").AuditEntry>>;
|
|
304
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").PlaidDocument>;
|
|
305
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").PlaidDocument>;
|
|
306
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").PlaidDocument>;
|
|
307
|
+
get: (documentId: string, includeBody?: boolean, asOf?: string, layers?: string[] | string) => Promise<import("./apiDocuments.js").PlaidDocument>;
|
|
308
|
+
getMedia: (documentId: string, { timeout, onProgress }?: {
|
|
309
|
+
timeout?: number | null;
|
|
310
|
+
onProgress?: (progress: {
|
|
311
|
+
loaded: number;
|
|
312
|
+
total: number | null;
|
|
313
|
+
}) => void;
|
|
314
|
+
}) => Promise<Blob>;
|
|
315
|
+
create: (projectId: string, name: string, metadata?: any, auditMessage?: string, { id, freeName }?: {
|
|
316
|
+
id?: string;
|
|
317
|
+
freeName?: boolean;
|
|
318
|
+
}) => Promise<{
|
|
319
|
+
id: string;
|
|
320
|
+
name: string;
|
|
321
|
+
}>;
|
|
322
|
+
update: (documentId: string, name: string, auditMessage?: string) => Promise<import("./apiDocuments.js").PlaidDocument>;
|
|
323
|
+
delete: (documentId: string, auditMessage?: string) => Promise<void>;
|
|
324
|
+
checkLock: (documentId: string) => Promise<{
|
|
325
|
+
userId: string;
|
|
326
|
+
expiresAt: number;
|
|
327
|
+
} | void>;
|
|
328
|
+
acquireLock: (documentId: string, auditMessage?: string, newLockId?: string) => Promise<import("./apiDocuments.js").LockGrant>;
|
|
329
|
+
renewLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<import("./apiDocuments.js").LockGrant>;
|
|
330
|
+
releaseLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<void>;
|
|
331
|
+
locked: <T>(documentId: string, fn: (lock: import("./documentLock.js").DocumentLock) => T | Promise<T>, options?: {
|
|
332
|
+
keepAlive?: boolean;
|
|
333
|
+
}) => Promise<T>;
|
|
334
|
+
mediaLink: (documentId: string) => Promise<{
|
|
335
|
+
url: string;
|
|
336
|
+
expiresAt: string;
|
|
337
|
+
}>;
|
|
338
|
+
uploadMedia: (documentId: string, file: File, auditMessage?: string, { onProgress }?: {
|
|
339
|
+
onProgress?: (progress: {
|
|
340
|
+
loaded: number;
|
|
341
|
+
total: number | null;
|
|
342
|
+
}) => void;
|
|
343
|
+
}) => Promise<{
|
|
344
|
+
message: string;
|
|
345
|
+
extension: string;
|
|
346
|
+
contentType: string;
|
|
347
|
+
}>;
|
|
348
|
+
deleteMedia: (documentId: string, auditMessage?: string, { mediaVersion }?: {
|
|
349
|
+
mediaVersion?: string;
|
|
350
|
+
}) => Promise<void>;
|
|
351
|
+
restore: (documentId: string, asOf: string, { dryRun }?: {
|
|
352
|
+
dryRun?: boolean;
|
|
353
|
+
}, auditMessage?: string) => Promise<import("./apiDocuments.js").DocumentRestoreSummary>;
|
|
354
|
+
copy: (documentId: string, name: string, { includeMedia, id, freeName }?: {
|
|
355
|
+
includeMedia?: boolean;
|
|
356
|
+
id?: string;
|
|
357
|
+
freeName?: boolean;
|
|
358
|
+
}, auditMessage?: string) => Promise<{
|
|
359
|
+
id: string;
|
|
360
|
+
name: string;
|
|
361
|
+
mediaError?: string;
|
|
362
|
+
}>;
|
|
363
|
+
};
|
|
364
|
+
texts: {
|
|
365
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").PlaidText>;
|
|
366
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").PlaidText>;
|
|
367
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").PlaidText>;
|
|
368
|
+
get: (textId: string) => Promise<import("./apiDocuments.js").PlaidText>;
|
|
369
|
+
create: (textLayerId: string, documentId: string, body: string, metadata?: any, auditMessage?: string, { id, tokenEdges, tokenizeLayer }?: {
|
|
370
|
+
id?: string;
|
|
371
|
+
tokenEdges?: number[];
|
|
372
|
+
tokenizeLayer?: string;
|
|
373
|
+
}) => Promise<import("./apiDocuments.js").Created>;
|
|
374
|
+
update: (textId: string, body: any, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
375
|
+
base?: string;
|
|
376
|
+
versioned?: boolean;
|
|
377
|
+
tokenizeLayer?: string;
|
|
378
|
+
}) => Promise<import("./apiDocuments.js").PlaidText & {
|
|
379
|
+
reshape: import("./apiDocuments.js").TextReshape;
|
|
380
|
+
}>;
|
|
381
|
+
delete: (textId: string, auditMessage?: string) => Promise<void>;
|
|
382
|
+
edit: (textId: string, edits: Array<object>, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
383
|
+
base?: string;
|
|
384
|
+
versioned?: boolean;
|
|
385
|
+
tokenizeLayer?: string;
|
|
386
|
+
}) => Promise<import("./apiDocuments.js").PlaidText & {
|
|
387
|
+
reshape: import("./apiDocuments.js").TextReshape;
|
|
388
|
+
}>;
|
|
389
|
+
};
|
|
390
|
+
tokens: {
|
|
391
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
392
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
393
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
394
|
+
get: (tokenId: string) => Promise<import("./apiAnnotations.js").Token>;
|
|
395
|
+
create: (tokenLayerId: string, text: string, begin: number, end: number, precedence?: number, metadata?: any, auditMessage?: string, { id }?: {
|
|
396
|
+
id?: string;
|
|
397
|
+
}) => Promise<import("./apiAnnotations.js").Created>;
|
|
398
|
+
update: (tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string) => Promise<import("./apiAnnotations.js").Token>;
|
|
399
|
+
delete: (tokenId: string, auditMessage?: string) => Promise<void>;
|
|
400
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
401
|
+
ids: string[];
|
|
402
|
+
}>;
|
|
403
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
404
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
405
|
+
count: number;
|
|
406
|
+
}>;
|
|
407
|
+
split: (tokenId: string, position: number, auditMessage?: string, { id, keep }?: {
|
|
408
|
+
id?: string;
|
|
409
|
+
keep?: "left" | "right";
|
|
410
|
+
}) => Promise<import("./apiAnnotations.js").Created>;
|
|
411
|
+
merge: (tokenId: string, otherTokenId: string, auditMessage?: string) => Promise<import("./apiAnnotations.js").Token>;
|
|
412
|
+
shift: (tokenId: string, begin?: number, end?: number, auditMessage?: string) => Promise<import("./apiAnnotations.js").Token>;
|
|
413
|
+
};
|
|
414
|
+
spans: {
|
|
415
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
416
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
417
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
418
|
+
get: (spanId: string) => Promise<import("./apiAnnotations.js").Span>;
|
|
419
|
+
create: (spanLayerId: string, tokens: any[], value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
420
|
+
id?: string;
|
|
421
|
+
}) => Promise<import("./apiAnnotations.js").Created>;
|
|
422
|
+
update: (spanId: string, value: any, auditMessage?: string) => Promise<import("./apiAnnotations.js").Span>;
|
|
423
|
+
delete: (spanId: string, auditMessage?: string) => Promise<void>;
|
|
424
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
425
|
+
ids: string[];
|
|
426
|
+
}>;
|
|
427
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
428
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
429
|
+
count: number;
|
|
430
|
+
}>;
|
|
431
|
+
setTokens: (spanId: string, tokens: any[], auditMessage?: string) => Promise<import("./apiAnnotations.js").Span>;
|
|
432
|
+
};
|
|
433
|
+
relations: {
|
|
434
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
435
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
436
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
437
|
+
get: (relationId: string) => Promise<import("./apiAnnotations.js").Relation>;
|
|
438
|
+
create: (relationLayerId: string, source: string, target: string, value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
439
|
+
id?: string;
|
|
440
|
+
}) => Promise<import("./apiAnnotations.js").Created>;
|
|
441
|
+
update: (relationId: string, value: any, auditMessage?: string) => Promise<import("./apiAnnotations.js").Relation>;
|
|
442
|
+
delete: (relationId: string, auditMessage?: string) => Promise<void>;
|
|
443
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
444
|
+
ids: string[];
|
|
445
|
+
}>;
|
|
446
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
447
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
448
|
+
count: number;
|
|
449
|
+
}>;
|
|
450
|
+
setTarget: (relationId: string, spanId: string, auditMessage?: string) => Promise<import("./apiAnnotations.js").Relation>;
|
|
451
|
+
setSource: (relationId: string, spanId: string, auditMessage?: string) => Promise<import("./apiAnnotations.js").Relation>;
|
|
452
|
+
};
|
|
453
|
+
vocabLinks: {
|
|
454
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
455
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
456
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
457
|
+
get: (id: string) => Promise<import("./apiAnnotations.js").VocabLink>;
|
|
458
|
+
create: (vocabItem: string, tokens: any[], metadata?: any, auditMessage?: string, { id }?: {
|
|
459
|
+
id?: string;
|
|
460
|
+
}) => Promise<import("./apiAnnotations.js").Created>;
|
|
461
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
462
|
+
bulkCreate: (body: Array<{
|
|
463
|
+
vocabItem: string;
|
|
464
|
+
tokens: string[];
|
|
465
|
+
metadata?: any;
|
|
466
|
+
}>, auditMessage?: string) => Promise<{
|
|
467
|
+
ids: string[];
|
|
468
|
+
}>;
|
|
469
|
+
bulkDelete: (body: string[], auditMessage?: string) => Promise<void>;
|
|
470
|
+
};
|
|
471
|
+
textLayers: {
|
|
472
|
+
get: (layerId: string) => Promise<import("./types.js").TextLayer>;
|
|
473
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
474
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").TextLayer>;
|
|
475
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
476
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
477
|
+
expected?: any;
|
|
478
|
+
}) => Promise<void>;
|
|
479
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
480
|
+
expected?: any;
|
|
481
|
+
}) => Promise<void>;
|
|
482
|
+
create: (projectId: string, name: string, auditMessage?: string, { id }?: {
|
|
483
|
+
id?: string;
|
|
484
|
+
}) => Promise<import("./apiLayers.js").Created>;
|
|
485
|
+
};
|
|
486
|
+
tokenLayers: {
|
|
487
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
488
|
+
expected?: Array<object> | null;
|
|
489
|
+
}) => Promise<{
|
|
490
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
491
|
+
}>;
|
|
492
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
493
|
+
expected?: Array<object> | null;
|
|
494
|
+
}) => Promise<void>;
|
|
495
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
496
|
+
limit?: number;
|
|
497
|
+
}) => Promise<{
|
|
498
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
499
|
+
violationCount: number;
|
|
500
|
+
}>;
|
|
501
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
502
|
+
document?: string;
|
|
503
|
+
}) => Promise<{
|
|
504
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
505
|
+
locked: Array<{
|
|
506
|
+
document: string;
|
|
507
|
+
lockedBy: string;
|
|
508
|
+
}>;
|
|
509
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
510
|
+
violationCount: number;
|
|
511
|
+
}>;
|
|
512
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
513
|
+
expected?: any;
|
|
514
|
+
}) => Promise<void>;
|
|
515
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
516
|
+
expected?: any;
|
|
517
|
+
}) => Promise<void>;
|
|
518
|
+
get: (layerId: string) => Promise<import("./types.js").TokenLayer>;
|
|
519
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
520
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").TokenLayer>;
|
|
521
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
522
|
+
create: (textLayerId: string, name: string, overlapMode?: string, parentTokenLayerId?: string, auditMessage?: string, { id }?: {
|
|
523
|
+
id?: string;
|
|
524
|
+
}) => Promise<import("./apiLayers.js").Created>;
|
|
525
|
+
countMatching: (layerIds: string[], value: {
|
|
526
|
+
regex: string;
|
|
527
|
+
flags?: string;
|
|
528
|
+
}) => Promise<{
|
|
529
|
+
results: Array<[string, string, number]>;
|
|
530
|
+
}>;
|
|
531
|
+
};
|
|
532
|
+
spanLayers: {
|
|
533
|
+
get: (layerId: string) => Promise<import("./types.js").SpanLayer>;
|
|
534
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
535
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").SpanLayer>;
|
|
536
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
537
|
+
refusedValues: (layerId: string, rule: import("./families.js").ValueSetRule, options?: {
|
|
538
|
+
limit?: number;
|
|
539
|
+
}) => Promise<import("./families.js").RefusedValues>;
|
|
540
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
541
|
+
expected?: Array<object> | null;
|
|
542
|
+
}) => Promise<{
|
|
543
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
544
|
+
}>;
|
|
545
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
546
|
+
expected?: Array<object> | null;
|
|
547
|
+
}) => Promise<void>;
|
|
548
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
549
|
+
limit?: number;
|
|
550
|
+
}) => Promise<{
|
|
551
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
552
|
+
violationCount: number;
|
|
553
|
+
}>;
|
|
554
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
555
|
+
document?: string;
|
|
556
|
+
}) => Promise<{
|
|
557
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
558
|
+
locked: Array<{
|
|
559
|
+
document: string;
|
|
560
|
+
lockedBy: string;
|
|
561
|
+
}>;
|
|
562
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
563
|
+
violationCount: number;
|
|
564
|
+
}>;
|
|
565
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
566
|
+
expected?: any;
|
|
567
|
+
}) => Promise<void>;
|
|
568
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
569
|
+
expected?: any;
|
|
570
|
+
}) => Promise<void>;
|
|
571
|
+
create: (tokenLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
572
|
+
id?: string;
|
|
573
|
+
}) => Promise<import("./apiLayers.js").Created>;
|
|
574
|
+
};
|
|
575
|
+
relationLayers: {
|
|
576
|
+
refusedValues: (layerId: string, rule: import("./families.js").ValueSetRule, options?: {
|
|
577
|
+
limit?: number;
|
|
578
|
+
}) => Promise<import("./families.js").RefusedValues>;
|
|
579
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
580
|
+
expected?: Array<object> | null;
|
|
581
|
+
}) => Promise<{
|
|
582
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
583
|
+
}>;
|
|
584
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
585
|
+
expected?: Array<object> | null;
|
|
586
|
+
}) => Promise<void>;
|
|
587
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
588
|
+
limit?: number;
|
|
589
|
+
}) => Promise<{
|
|
590
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
591
|
+
violationCount: number;
|
|
592
|
+
}>;
|
|
593
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
594
|
+
document?: string;
|
|
595
|
+
}) => Promise<{
|
|
596
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
597
|
+
locked: Array<{
|
|
598
|
+
document: string;
|
|
599
|
+
lockedBy: string;
|
|
600
|
+
}>;
|
|
601
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
602
|
+
violationCount: number;
|
|
603
|
+
}>;
|
|
604
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
605
|
+
expected?: any;
|
|
606
|
+
}) => Promise<void>;
|
|
607
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
608
|
+
expected?: any;
|
|
609
|
+
}) => Promise<void>;
|
|
610
|
+
get: (layerId: string) => Promise<import("./types.js").RelationLayer>;
|
|
611
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
612
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").RelationLayer>;
|
|
613
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
614
|
+
create: (spanLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
615
|
+
id?: string;
|
|
616
|
+
}) => Promise<import("./apiLayers.js").Created>;
|
|
617
|
+
};
|
|
618
|
+
vocabLayers: {
|
|
619
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
620
|
+
expected?: any;
|
|
621
|
+
}) => Promise<void>;
|
|
622
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
623
|
+
expected?: any;
|
|
624
|
+
}) => Promise<void>;
|
|
625
|
+
get: (id: string, includeItems?: boolean, asOf?: string) => Promise<import("./apiVocab.js").VocabLayer>;
|
|
626
|
+
getItemAt: (id: string, itemId: string, asOf: string) => Promise<import("./apiVocab.js").VocabItem>;
|
|
627
|
+
list: () => Promise<import("./apiVocab.js").VocabLayer[]>;
|
|
628
|
+
listPage: ({ limit, cursor }?: {
|
|
629
|
+
limit?: number;
|
|
630
|
+
cursor?: string;
|
|
631
|
+
}) => Promise<import("./apiVocab.js").Page<import("./apiVocab.js").VocabLayer>>;
|
|
632
|
+
iterPages: ({ pageSize }?: {
|
|
633
|
+
pageSize?: number;
|
|
634
|
+
}) => AsyncGenerator<import("./apiVocab.js").VocabLayer[]>;
|
|
635
|
+
create: (name: string, auditMessage?: string, { id }?: {
|
|
636
|
+
id?: string;
|
|
637
|
+
}) => Promise<import("./apiVocab.js").Created>;
|
|
638
|
+
update: (id: string, name: string, auditMessage?: string) => Promise<import("./apiVocab.js").VocabLayer>;
|
|
639
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
640
|
+
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, itemId?: string, kinds?: string[] | string) => Promise<import("./apiVocab.js").AuditEntry[]>;
|
|
641
|
+
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId, itemId }?: {
|
|
642
|
+
startTime?: string;
|
|
643
|
+
endTime?: string;
|
|
644
|
+
opTypes?: string[] | string;
|
|
645
|
+
kinds?: import("./apiVocab.js").OperationKind[] | string;
|
|
646
|
+
order?: "asc" | "desc";
|
|
647
|
+
limit?: number;
|
|
648
|
+
cursor?: string;
|
|
649
|
+
opsLimit?: number;
|
|
650
|
+
entryId?: string;
|
|
651
|
+
itemId?: string;
|
|
652
|
+
}) => Promise<import("./apiVocab.js").Page<import("./apiVocab.js").AuditEntry>>;
|
|
653
|
+
restoreItem: (id: string, itemId: string, asOf: string, { dryRun }?: {
|
|
654
|
+
dryRun?: boolean;
|
|
655
|
+
}, auditMessage?: string) => Promise<import("./apiVocab.js").VocabItemRestoreSummary>;
|
|
656
|
+
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
657
|
+
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
658
|
+
};
|
|
659
|
+
vocabItems: {
|
|
660
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").VocabItem>;
|
|
661
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").VocabItem>;
|
|
662
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").VocabItem>;
|
|
663
|
+
get: (id: string) => Promise<import("./apiVocab.js").VocabItem>;
|
|
664
|
+
create: (vocabLayerId: string, form: string, metadata?: any, auditMessage?: string, { id }?: {
|
|
665
|
+
id?: string;
|
|
666
|
+
}) => Promise<import("./apiVocab.js").Created>;
|
|
667
|
+
update: (id: string, form: string, auditMessage?: string) => Promise<import("./apiVocab.js").VocabItem>;
|
|
668
|
+
delete: (id: string, auditMessage?: string, { expectedLinkCount }?: {
|
|
669
|
+
expectedLinkCount?: number;
|
|
670
|
+
}) => Promise<void>;
|
|
671
|
+
bulkCreate: (body: Array<{
|
|
672
|
+
vocabLayerId: string;
|
|
673
|
+
form: string;
|
|
674
|
+
metadata?: any;
|
|
675
|
+
}>, auditMessage?: string) => Promise<{
|
|
676
|
+
ids: string[];
|
|
677
|
+
}>;
|
|
678
|
+
bulkUpdate: (body: Array<{
|
|
679
|
+
id: string;
|
|
680
|
+
form?: string;
|
|
681
|
+
metadata?: Array<object>;
|
|
682
|
+
}>, auditMessage?: string) => Promise<{
|
|
683
|
+
count: number;
|
|
684
|
+
}>;
|
|
685
|
+
bulkDelete: (body: string[], auditMessage?: string) => Promise<void>;
|
|
686
|
+
merge: (survivorId: string, loserIds: string[], auditMessage?: string) => Promise<{
|
|
687
|
+
moved: number;
|
|
688
|
+
duplicates: number;
|
|
689
|
+
removed: string[];
|
|
690
|
+
}>;
|
|
691
|
+
};
|
|
692
|
+
users: {
|
|
693
|
+
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<import("./families.js").AuditEntry[]>;
|
|
694
|
+
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
695
|
+
startTime?: string;
|
|
696
|
+
endTime?: string;
|
|
697
|
+
opTypes?: string[] | string;
|
|
698
|
+
kinds?: import("./families.js").OperationKind[] | string;
|
|
699
|
+
order?: "asc" | "desc";
|
|
700
|
+
limit?: number;
|
|
701
|
+
cursor?: string;
|
|
702
|
+
opsLimit?: number;
|
|
703
|
+
entryId?: string;
|
|
704
|
+
}) => Promise<import("./families.js").Page<import("./families.js").AuditEntry>>;
|
|
705
|
+
get: (id: string) => Promise<import("./apiPeople.js").User>;
|
|
706
|
+
getAvatar: (id: string) => Promise<ArrayBuffer>;
|
|
707
|
+
list: ({ q }?: {
|
|
708
|
+
q?: string;
|
|
709
|
+
}) => Promise<import("./apiPeople.js").User[]>;
|
|
710
|
+
listPage: ({ q, limit, cursor }?: {
|
|
711
|
+
q?: string;
|
|
712
|
+
limit?: number;
|
|
713
|
+
cursor?: string;
|
|
714
|
+
}) => Promise<import("./apiPeople.js").Page<import("./apiPeople.js").User>>;
|
|
715
|
+
iterPages: ({ q, pageSize }?: {
|
|
716
|
+
q?: string;
|
|
717
|
+
pageSize?: number;
|
|
718
|
+
}) => AsyncGenerator<import("./apiPeople.js").User[]>;
|
|
719
|
+
create: (email: string, password: string, isAdmin: boolean, displayName?: string, auditMessage?: string) => Promise<import("./apiPeople.js").Created>;
|
|
720
|
+
update: (id: string, password?: string, displayName?: string, isAdmin?: boolean, auditMessage?: string) => Promise<import("./apiPeople.js").User>;
|
|
721
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
722
|
+
activate: (id: string, auditMessage?: string) => Promise<import("./apiPeople.js").User>;
|
|
723
|
+
avatarToken: ({ renew }?: {
|
|
724
|
+
renew?: boolean;
|
|
725
|
+
}) => Promise<{
|
|
726
|
+
token: string;
|
|
727
|
+
expiresAt: string;
|
|
728
|
+
}>;
|
|
729
|
+
avatarUrl: (id: string, avatarHash?: string | null, { renew }?: {
|
|
730
|
+
renew?: boolean;
|
|
731
|
+
}) => Promise<string | null>;
|
|
732
|
+
setAvatar: (id: string, file: File, auditMessage?: string) => Promise<import("./apiPeople.js").User>;
|
|
733
|
+
deleteAvatar: (id: string, auditMessage?: string) => Promise<void>;
|
|
734
|
+
};
|
|
735
|
+
apiTokens: {
|
|
736
|
+
list: (userId: string) => Promise<import("./apiPeople.js").ApiToken[]>;
|
|
737
|
+
listPage: (userId: string, { limit, cursor }?: {
|
|
738
|
+
limit?: number;
|
|
739
|
+
cursor?: string;
|
|
740
|
+
}) => Promise<import("./apiPeople.js").Page<import("./apiPeople.js").ApiToken>>;
|
|
741
|
+
iterPages: (userId: string, { pageSize }?: {
|
|
742
|
+
pageSize?: number;
|
|
743
|
+
}) => AsyncGenerator<import("./apiPeople.js").ApiToken[]>;
|
|
744
|
+
create: (userId: string, name: string, auditMessage?: string) => Promise<{
|
|
745
|
+
id: string;
|
|
746
|
+
name: string;
|
|
747
|
+
token: string;
|
|
748
|
+
}>;
|
|
749
|
+
revoke: (userId: string, tokenId: string, auditMessage?: string) => Promise<void>;
|
|
750
|
+
};
|
|
751
|
+
invites: {
|
|
752
|
+
list: ({ projectId, all }?: {
|
|
753
|
+
projectId?: string;
|
|
754
|
+
all?: boolean;
|
|
755
|
+
}) => Promise<import("./apiPeople.js").Invite[]>;
|
|
756
|
+
listPage: ({ projectId, all, limit, cursor }?: {
|
|
757
|
+
projectId?: string;
|
|
758
|
+
all?: boolean;
|
|
759
|
+
limit?: number;
|
|
760
|
+
cursor?: string;
|
|
761
|
+
}) => Promise<import("./apiPeople.js").Page<import("./apiPeople.js").Invite>>;
|
|
762
|
+
iterPages: ({ projectId, all, pageSize }?: {
|
|
763
|
+
projectId?: string;
|
|
764
|
+
all?: boolean;
|
|
765
|
+
pageSize?: number;
|
|
766
|
+
}) => AsyncGenerator<import("./apiPeople.js").Invite[]>;
|
|
767
|
+
create: ({ projectId, projectRole, grantAdmin, targetUserId, maxUses, ttlDays, note, }?: {
|
|
768
|
+
projectId?: string;
|
|
769
|
+
projectRole?: string;
|
|
770
|
+
grantAdmin?: boolean;
|
|
771
|
+
targetUserId?: string;
|
|
772
|
+
maxUses?: number;
|
|
773
|
+
ttlDays?: number;
|
|
774
|
+
note?: string;
|
|
775
|
+
}, auditMessage?: string) => Promise<import("./apiPeople.js").Invite & {
|
|
776
|
+
code: string;
|
|
777
|
+
}>;
|
|
778
|
+
revoke: (id: string, auditMessage?: string) => Promise<void>;
|
|
779
|
+
};
|
|
780
|
+
auth: {
|
|
781
|
+
logoutEverywhere: () => Promise<void>;
|
|
782
|
+
};
|
|
783
|
+
userData: {
|
|
784
|
+
get: (userId: string, key: string) => Promise<import("./apiPeople.js").UserDataEntry & {
|
|
785
|
+
value: any;
|
|
786
|
+
}>;
|
|
787
|
+
list: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
|
|
788
|
+
prefix?: string;
|
|
789
|
+
pattern?: string;
|
|
790
|
+
includeValues?: boolean;
|
|
791
|
+
pageSize?: number;
|
|
792
|
+
}) => Promise<import("./apiPeople.js").UserDataEntry[]>;
|
|
793
|
+
listPage: (userId: string, { prefix, pattern, includeValues, limit, cursor }?: {
|
|
794
|
+
prefix?: string;
|
|
795
|
+
pattern?: string;
|
|
796
|
+
includeValues?: boolean;
|
|
797
|
+
limit?: number;
|
|
798
|
+
cursor?: string;
|
|
799
|
+
}) => Promise<import("./apiPeople.js").Page<import("./apiPeople.js").UserDataEntry>>;
|
|
800
|
+
iterPages: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
|
|
801
|
+
prefix?: string;
|
|
802
|
+
pattern?: string;
|
|
803
|
+
includeValues?: boolean;
|
|
804
|
+
pageSize?: number;
|
|
805
|
+
}) => AsyncGenerator<import("./apiPeople.js").UserDataEntry[]>;
|
|
806
|
+
delete: (userId: string, key: string) => Promise<void>;
|
|
807
|
+
put: (userId: string, key: string, value: any, { version }?: {
|
|
808
|
+
version?: number;
|
|
809
|
+
}) => Promise<{
|
|
810
|
+
key: string;
|
|
811
|
+
updatedAt: string;
|
|
812
|
+
version: number;
|
|
813
|
+
}>;
|
|
814
|
+
};
|
|
815
|
+
projects: {
|
|
816
|
+
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<import("./families.js").AuditEntry[]>;
|
|
817
|
+
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
818
|
+
startTime?: string;
|
|
819
|
+
endTime?: string;
|
|
820
|
+
opTypes?: string[] | string;
|
|
821
|
+
kinds?: import("./families.js").OperationKind[] | string;
|
|
822
|
+
order?: "asc" | "desc";
|
|
823
|
+
limit?: number;
|
|
824
|
+
cursor?: string;
|
|
825
|
+
opsLimit?: number;
|
|
826
|
+
entryId?: string;
|
|
827
|
+
}) => Promise<import("./families.js").Page<import("./families.js").AuditEntry>>;
|
|
828
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
829
|
+
expected?: any;
|
|
830
|
+
}) => Promise<void>;
|
|
831
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
832
|
+
expected?: any;
|
|
833
|
+
}) => Promise<void>;
|
|
834
|
+
get: (id: string) => Promise<import("./apiProject.js").Project>;
|
|
835
|
+
list: () => Promise<import("./apiProject.js").ProjectListEntry[]>;
|
|
836
|
+
listPage: ({ limit, cursor }?: {
|
|
837
|
+
limit?: number;
|
|
838
|
+
cursor?: string;
|
|
839
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").ProjectListEntry>>;
|
|
840
|
+
iterPages: ({ pageSize }?: {
|
|
841
|
+
pageSize?: number;
|
|
842
|
+
}) => AsyncGenerator<import("./apiProject.js").ProjectListEntry[]>;
|
|
843
|
+
listDocuments: (id: string) => Promise<import("./apiProject.js").DocumentListEntry[]>;
|
|
844
|
+
listDocumentsPage: (id: string, { limit, cursor }?: {
|
|
845
|
+
limit?: number;
|
|
846
|
+
cursor?: string;
|
|
847
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").DocumentListEntry>>;
|
|
848
|
+
iterDocuments: (id: string, { pageSize }?: {
|
|
849
|
+
pageSize?: number;
|
|
850
|
+
}) => AsyncGenerator<import("./apiProject.js").DocumentListEntry[]>;
|
|
851
|
+
create: (name: string, auditMessage?: string, { id }?: {
|
|
852
|
+
id?: string;
|
|
853
|
+
}) => Promise<import("./apiProject.js").Created>;
|
|
854
|
+
update: (id: string, name: string, auditMessage?: string) => Promise<import("./apiProject.js").Project>;
|
|
855
|
+
delete: (id: string, auditMessage?: string, { timeout }?: {
|
|
856
|
+
timeout?: number;
|
|
857
|
+
}) => Promise<void>;
|
|
858
|
+
addWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
859
|
+
removeWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
860
|
+
addReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
861
|
+
removeReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
862
|
+
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
863
|
+
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
864
|
+
myLastEdits: (projectId: string) => Promise<{
|
|
865
|
+
[x: string]: string;
|
|
866
|
+
}>;
|
|
867
|
+
linkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
868
|
+
unlinkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
869
|
+
};
|
|
870
|
+
guidelines: {
|
|
871
|
+
get: (id: string) => Promise<import("./apiProject.js").Guideline>;
|
|
872
|
+
list: (projectId: string, { includeBodies }?: {
|
|
873
|
+
includeBodies?: boolean;
|
|
874
|
+
}) => Promise<import("./apiProject.js").Guideline[]>;
|
|
875
|
+
listPage: (projectId: string, { limit, cursor, includeBodies }?: {
|
|
876
|
+
limit?: number;
|
|
877
|
+
cursor?: string;
|
|
878
|
+
includeBodies?: boolean;
|
|
879
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").Guideline>>;
|
|
880
|
+
iterPages: (projectId: string, { pageSize, includeBodies }?: {
|
|
881
|
+
pageSize?: number;
|
|
882
|
+
includeBodies?: boolean;
|
|
883
|
+
}) => AsyncGenerator<import("./apiProject.js").Guideline[]>;
|
|
884
|
+
create: (projectId: string, title: string, { body, pinned, id }?: {
|
|
885
|
+
body?: string;
|
|
886
|
+
pinned?: boolean;
|
|
887
|
+
id?: string;
|
|
888
|
+
}, auditMessage?: string) => Promise<{
|
|
889
|
+
id: string;
|
|
890
|
+
}>;
|
|
891
|
+
update: (id: string, { title, body, pinned, expectedUpdatedAt }?: {
|
|
892
|
+
title?: string;
|
|
893
|
+
body?: string;
|
|
894
|
+
pinned?: boolean;
|
|
895
|
+
expectedUpdatedAt?: string;
|
|
896
|
+
}, auditMessage?: string) => Promise<import("./apiProject.js").Guideline>;
|
|
897
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
898
|
+
};
|
|
899
|
+
comments: {
|
|
900
|
+
get: (id: string) => Promise<import("./apiProject.js").Comment>;
|
|
901
|
+
list: (projectId: string, { documentId, entityType, entityId }?: {
|
|
902
|
+
documentId?: string;
|
|
903
|
+
entityType?: string;
|
|
904
|
+
entityId?: string;
|
|
905
|
+
}) => Promise<import("./apiProject.js").Comment[]>;
|
|
906
|
+
listPage: (projectId: string, { limit, cursor, documentId, entityType, entityId }?: {
|
|
907
|
+
limit?: number;
|
|
908
|
+
cursor?: string;
|
|
909
|
+
documentId?: string;
|
|
910
|
+
entityType?: string;
|
|
911
|
+
entityId?: string;
|
|
912
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").Comment>>;
|
|
913
|
+
iterPages: (projectId: string, { pageSize, documentId, entityType, entityId }?: {
|
|
914
|
+
pageSize?: number;
|
|
915
|
+
documentId?: string;
|
|
916
|
+
entityType?: string;
|
|
917
|
+
entityId?: string;
|
|
918
|
+
}) => AsyncGenerator<import("./apiProject.js").Comment[]>;
|
|
919
|
+
listInVocab: (vocabId: string, { entityId }?: {
|
|
920
|
+
entityId?: string;
|
|
921
|
+
}) => Promise<import("./apiProject.js").Comment[]>;
|
|
922
|
+
listInVocabPage: (vocabId: string, { limit, cursor, entityId }?: {
|
|
923
|
+
limit?: number;
|
|
924
|
+
cursor?: string;
|
|
925
|
+
entityId?: string;
|
|
926
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").Comment>>;
|
|
927
|
+
iterInVocabPages: (vocabId: string, { entityId, pageSize }?: {
|
|
928
|
+
entityId?: string;
|
|
929
|
+
pageSize?: number;
|
|
930
|
+
}) => AsyncGenerator<import("./apiProject.js").Comment[]>;
|
|
931
|
+
create: (entityType: import("./apiProject.js").CommentableType, entityId: string, body: string, { anchorLabel, id }?: {
|
|
932
|
+
anchorLabel?: string;
|
|
933
|
+
id?: string;
|
|
934
|
+
}) => Promise<import("./apiProject.js").Comment>;
|
|
935
|
+
update: (id: string, body: string) => Promise<import("./apiProject.js").Comment>;
|
|
936
|
+
delete: (id: string) => Promise<void>;
|
|
937
|
+
counts: (projectId: string, { documentId, entityType, entityId }?: {
|
|
938
|
+
documentId?: string;
|
|
939
|
+
entityType?: import("./apiProject.js").CommentableType;
|
|
940
|
+
entityId?: string;
|
|
941
|
+
}) => Promise<{
|
|
942
|
+
[x: string]: number;
|
|
943
|
+
}>;
|
|
944
|
+
countsInVocab: (vocabId: string, { entityId }?: {
|
|
945
|
+
entityId?: string;
|
|
946
|
+
}) => Promise<{
|
|
947
|
+
[x: string]: number;
|
|
948
|
+
}>;
|
|
949
|
+
};
|
|
950
|
+
events: {
|
|
951
|
+
list: (projectId: string, { types, startTime, endTime }?: {
|
|
952
|
+
types?: string | string[];
|
|
953
|
+
startTime?: string;
|
|
954
|
+
endTime?: string;
|
|
955
|
+
}) => Promise<import("./apiProject.js").ClientEvent[]>;
|
|
956
|
+
listPage: (projectId: string, { limit, cursor, types, startTime, endTime }?: {
|
|
957
|
+
limit?: number;
|
|
958
|
+
cursor?: string;
|
|
959
|
+
types?: string | string[];
|
|
960
|
+
startTime?: string;
|
|
961
|
+
endTime?: string;
|
|
962
|
+
}) => Promise<import("./apiProject.js").Page<import("./apiProject.js").ClientEvent>>;
|
|
963
|
+
iterPages: (projectId: string, { pageSize, types, startTime, endTime }?: {
|
|
964
|
+
pageSize?: number;
|
|
965
|
+
types?: string | string[];
|
|
966
|
+
startTime?: string;
|
|
967
|
+
endTime?: string;
|
|
968
|
+
}) => AsyncGenerator<import("./apiProject.js").ClientEvent[]>;
|
|
969
|
+
create: (projectId: string, events: Array<{
|
|
970
|
+
type: string;
|
|
971
|
+
documentId?: string;
|
|
972
|
+
targetId?: string;
|
|
973
|
+
data?: object;
|
|
974
|
+
clientTs?: string;
|
|
975
|
+
}>) => Promise<{
|
|
976
|
+
count: number;
|
|
977
|
+
}>;
|
|
978
|
+
record: (type: import("./apiProject.js").ClientEventType, fields: {
|
|
979
|
+
projectId: string;
|
|
980
|
+
documentId?: string;
|
|
981
|
+
targetId?: string;
|
|
982
|
+
data?: object;
|
|
983
|
+
}) => boolean;
|
|
984
|
+
flush: () => void;
|
|
985
|
+
setEnabled: (projectId: string, on: boolean) => void;
|
|
986
|
+
};
|
|
987
|
+
operationGroups: {
|
|
988
|
+
get: (id: string) => Promise<import("./apiProject.js").OperationGroup>;
|
|
989
|
+
update: (id: string, message: string | null) => Promise<import("./apiProject.js").OperationGroup>;
|
|
990
|
+
};
|
|
991
|
+
server: {
|
|
992
|
+
info: () => Promise<{
|
|
993
|
+
limits: import("./apiServer.js").ServerLimits;
|
|
994
|
+
}>;
|
|
995
|
+
refresh: () => Promise<{
|
|
996
|
+
limits: import("./apiServer.js").ServerLimits;
|
|
997
|
+
}>;
|
|
998
|
+
limits: () => Promise<import("./apiServer.js").ServerLimits>;
|
|
999
|
+
health: () => Promise<import("./apiServer.js").ServerHealth>;
|
|
1000
|
+
};
|
|
1001
|
+
admin: {
|
|
1002
|
+
server: () => Promise<import("./apiServer.js").ServerReport>;
|
|
1003
|
+
backup: () => Promise<import("./apiServer.js").BackupStatus>;
|
|
1004
|
+
locks: () => Promise<{
|
|
1005
|
+
entries: Array<{
|
|
1006
|
+
documentId: string;
|
|
1007
|
+
userId: string;
|
|
1008
|
+
expiresAt: number;
|
|
1009
|
+
}>;
|
|
1010
|
+
}>;
|
|
1011
|
+
releaseLock: (documentId: string) => Promise<{
|
|
1012
|
+
result: string;
|
|
1013
|
+
}>;
|
|
1014
|
+
rateLimits: () => Promise<import("./apiServer.js").RateLimitSnapshot>;
|
|
1015
|
+
clearRateLimits: ({ ip, userId }?: {
|
|
1016
|
+
ip?: string;
|
|
1017
|
+
userId?: string;
|
|
1018
|
+
}) => Promise<{
|
|
1019
|
+
result: string;
|
|
1020
|
+
}>;
|
|
1021
|
+
logs: ({ limit, q, level, status, user, method }?: {
|
|
1022
|
+
limit?: number;
|
|
1023
|
+
q?: string;
|
|
1024
|
+
level?: string;
|
|
1025
|
+
status?: string;
|
|
1026
|
+
user?: string;
|
|
1027
|
+
method?: string;
|
|
1028
|
+
}) => Promise<import("./apiServer.js").LiveLog>;
|
|
1029
|
+
logFile: ({ lines }?: {
|
|
1030
|
+
lines?: number;
|
|
1031
|
+
}) => Promise<{
|
|
1032
|
+
file: (string | null);
|
|
1033
|
+
lines: string[];
|
|
1034
|
+
error?: string;
|
|
1035
|
+
}>;
|
|
1036
|
+
userData: ({ prefix, pattern, includeValues }?: {
|
|
1037
|
+
prefix?: string;
|
|
1038
|
+
pattern?: string;
|
|
1039
|
+
includeValues?: boolean;
|
|
1040
|
+
}) => Promise<import("./apiServer.js").AdminUserDataEntry[]>;
|
|
1041
|
+
userDataPage: ({ prefix, pattern, includeValues, limit, cursor }?: {
|
|
1042
|
+
prefix?: string;
|
|
1043
|
+
pattern?: string;
|
|
1044
|
+
includeValues?: boolean;
|
|
1045
|
+
limit?: number;
|
|
1046
|
+
cursor?: string;
|
|
1047
|
+
}) => Promise<import("./apiServer.js").Page<import("./apiServer.js").AdminUserDataEntry>>;
|
|
1048
|
+
};
|
|
1049
|
+
audit: {
|
|
1050
|
+
list: ({ startTime, endTime, opTypes, kinds }?: {
|
|
1051
|
+
startTime?: string;
|
|
1052
|
+
endTime?: string;
|
|
1053
|
+
opTypes?: string[] | string;
|
|
1054
|
+
kinds?: string[] | string;
|
|
1055
|
+
}) => Promise<import("./apiServer.js").AuditEntry[]>;
|
|
1056
|
+
listPage: ({ startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
1057
|
+
startTime?: string;
|
|
1058
|
+
endTime?: string;
|
|
1059
|
+
opTypes?: string[] | string;
|
|
1060
|
+
kinds?: import("./apiServer.js").OperationKind[] | string;
|
|
1061
|
+
order?: "asc" | "desc";
|
|
1062
|
+
limit?: number;
|
|
1063
|
+
cursor?: string;
|
|
1064
|
+
opsLimit?: number;
|
|
1065
|
+
entryId?: string;
|
|
1066
|
+
}) => Promise<import("./apiServer.js").Page<import("./apiServer.js").AuditEntry>>;
|
|
1067
|
+
iterPages: ({ startTime, endTime, opTypes, kinds, pageSize }?: {
|
|
1068
|
+
startTime?: string;
|
|
1069
|
+
endTime?: string;
|
|
1070
|
+
opTypes?: string[] | string;
|
|
1071
|
+
kinds?: import("./apiServer.js").OperationKind[] | string;
|
|
1072
|
+
pageSize?: number;
|
|
1073
|
+
}) => AsyncGenerator<import("./apiServer.js").AuditEntry[]>;
|
|
1074
|
+
tally: ({ projectId, startTime, endTime, daily }?: {
|
|
1075
|
+
projectId?: string;
|
|
1076
|
+
startTime?: string;
|
|
1077
|
+
endTime?: string;
|
|
1078
|
+
daily?: boolean;
|
|
1079
|
+
}) => Promise<import("./apiServer.js").ActivityTallyRow[]>;
|
|
1080
|
+
};
|
|
1081
|
+
messages: {
|
|
1082
|
+
listen: (projectId: string, onEvent: (eventType: string, data: any) => void | boolean, path?: string) => import("./apiMessages.js").SSEConnection;
|
|
1083
|
+
sendMessage: (projectId: string, data: any) => Promise<{
|
|
1084
|
+
success: boolean;
|
|
1085
|
+
message: string;
|
|
1086
|
+
}>;
|
|
1087
|
+
discoverServices: (projectId: string) => Promise<import("./apiMessages.js").DiscoveredService[]>;
|
|
1088
|
+
discardService: (projectId: string, serviceId: string) => Promise<void>;
|
|
1089
|
+
releaseService: (projectId: string, serviceId: string) => Promise<void>;
|
|
1090
|
+
serve: (projectId: string, serviceInfo: import("./apiMessages.js").ServiceInfo, onServiceRequest: (data: any, responseHelper: import("./apiMessages.js").ResponseHelper) => void, extras?: any, onStatus?: (event: import("./apiMessages.js").ServiceStatusEvent, projectId: string, detail?: string) => void) => import("./apiMessages.js").ServiceRegistration;
|
|
1091
|
+
requestService: (projectId: string, serviceId: string, data: any, timeout?: number, onProgress?: Function, signal?: AbortSignal, opts?: {
|
|
1092
|
+
requestId?: string;
|
|
1093
|
+
onAccepted?: (requestId: string) => void;
|
|
1094
|
+
projectIds?: string[];
|
|
1095
|
+
noOperation?: boolean;
|
|
1096
|
+
}) => Promise<any>;
|
|
1097
|
+
attachServiceRequest: (projectId: string, requestId: string, timeout?: number, onProgress?: Function, signal?: AbortSignal) => Promise<any>;
|
|
1098
|
+
cancelServiceRequest: (projectId: string, requestId: string) => Promise<void>;
|
|
1099
|
+
};
|
|
1100
|
+
/**
|
|
1101
|
+
* Run a query over every project you can read.
|
|
1102
|
+
*
|
|
1103
|
+
* `body` is the query AST. Its keys follow the usual client convention
|
|
1104
|
+
* (camelCase, e.g. `scope.projectIds`) and are converted to the wire
|
|
1105
|
+
* format automatically; clause heads and variables are plain strings you
|
|
1106
|
+
* write literally (e.g. `'span'`, `'?s1'`, `'vocab-link'`). Example:
|
|
1107
|
+
*
|
|
1108
|
+
* await client.query({
|
|
1109
|
+
* find: ['?s1', '?s2'],
|
|
1110
|
+
* where: [
|
|
1111
|
+
* ['span', '?s1', { layer: posLayerId, value: 'NOUN' }],
|
|
1112
|
+
* ['span', '?s2', { layer: posLayerId, value: 'VERB' }],
|
|
1113
|
+
* ['covers', '?s1', '?t1'], ['covers', '?s2', '?t2'],
|
|
1114
|
+
* ['precedes', '?t1', '?t2'],
|
|
1115
|
+
* ],
|
|
1116
|
+
* return: 'entities', // 'ids' (default) | 'entities' | 'count'
|
|
1117
|
+
* limit: 100,
|
|
1118
|
+
* });
|
|
1119
|
+
*
|
|
1120
|
+
* A `layer` is referenced by its id (its UUID) only — not by name or
|
|
1121
|
+
* path. To match a layer by name, bind it with a `*-layer` clause (e.g.
|
|
1122
|
+
* `['span-layer', '?sl', { name: 'pos' }]`) and use the variable.
|
|
1123
|
+
*
|
|
1124
|
+
* A vocab link's provenance is on the link itself: bind it as a `link`
|
|
1125
|
+
* entity to filter or group by it, e.g. the machine-made links nobody
|
|
1126
|
+
* confirmed, with the tokens they sit on:
|
|
1127
|
+
*
|
|
1128
|
+
* ['link', '?l', { metadata: { prov: 'inferred' } }],
|
|
1129
|
+
* ['not', ['link', '?l', { metadata: { provConfirmed: true } }]],
|
|
1130
|
+
* ['link-token', '?l', '?t'], ['link-item', '?l', '?v']
|
|
1131
|
+
*
|
|
1132
|
+
* Optional keys: `scope` (restrict to projects by id, `{projectIds}`), `orderBy`
|
|
1133
|
+
* (sort rows), and `bindings` (substitute `?name` placeholders with literals).
|
|
1134
|
+
* `return` may also be an aggregate spec `{group, aggregates}`. See the query
|
|
1135
|
+
* language reference.
|
|
1136
|
+
*
|
|
1137
|
+
* @param {Object} body - The query AST ({find, where, scope?, limit?, orderBy?,
|
|
1138
|
+
* return?, bindings?}).
|
|
1139
|
+
* @returns {Promise<QueryResult>} For 'ids'/'entities': {columns, results, count, truncated}.
|
|
1140
|
+
* For 'count': {return: 'count', count, truncated}, where `truncated` says
|
|
1141
|
+
* the count stopped at the server's cap. Entity cells are full entity
|
|
1142
|
+
* objects (same shape as the GET endpoints).
|
|
1143
|
+
*/
|
|
1144
|
+
query: (body: any) => Promise<QueryResult>;
|
|
1145
|
+
/** @private */
|
|
1146
|
+
private _request;
|
|
1147
|
+
/**
|
|
1148
|
+
* Enter strict mode for a specific document, requiring document version
|
|
1149
|
+
* headers so that conflicting concurrent writes are rejected.
|
|
1150
|
+
* @param {string} documentId - The ID of the document to track versions for
|
|
1151
|
+
*/
|
|
1152
|
+
enterStrictMode(documentId: string): void;
|
|
1153
|
+
/** Exit strict mode and stop tracking document versions for writes. */
|
|
1154
|
+
exitStrictMode(): void;
|
|
1155
|
+
/**
|
|
1156
|
+
* Begin a LOGICAL OPERATION: a user-meaningful action ("Merge morphemes",
|
|
1157
|
+
* "Re-transcribe") implemented as many low-level writes, possibly across
|
|
1158
|
+
* several batches and even a service round-trip. Until `endOperation()`,
|
|
1159
|
+
* every write is stamped with a client-minted `?group-id=` (and the message)
|
|
1160
|
+
* so the audit log shows the whole run as ONE expandable entry labeled
|
|
1161
|
+
* `message`, with each write's own description underneath.
|
|
1162
|
+
*
|
|
1163
|
+
* Grouping is orthogonal to batches: a batch is a transaction boundary, an
|
|
1164
|
+
* operation is an intent boundary. An operation is NOT atomic — if write 3
|
|
1165
|
+
* of 5 fails, writes 1–2 stay committed (and logged under the group). Use a
|
|
1166
|
+
* batch inside the operation for any step that must be all-or-nothing.
|
|
1167
|
+
*
|
|
1168
|
+
* Nesting flattens: a `beginOperation` while one is open is a no-op that
|
|
1169
|
+
* joins the outer operation (the outer label wins), and the matching
|
|
1170
|
+
* `endOperation` is likewise a no-op. The label is recorded on the FIRST
|
|
1171
|
+
* write, so an operation that is never ended (crash, closed tab) is still
|
|
1172
|
+
* labeled in the log.
|
|
1173
|
+
*
|
|
1174
|
+
* "Every write" is the writes of project data. Reads never join, and neither
|
|
1175
|
+
* do the out-of-band signals shaped like a write (a document lock taken or
|
|
1176
|
+
* renewed, a stopped service request, a service reporting itself, an admin
|
|
1177
|
+
* control), and neither does a broadcast message (`messages.sendMessage`):
|
|
1178
|
+
* none of them is audited, so there would be nothing under the label.
|
|
1179
|
+
*
|
|
1180
|
+
* `kind` says what kind of operation this is, for a program reading the
|
|
1181
|
+
* log: one of `assistant-plan`, `service-run`, `import`, `bulk-edit`,
|
|
1182
|
+
* `guess-adoption`, `repair` or `review` (the server refuses any other).
|
|
1183
|
+
* Any other kind throws here, before anything is written.
|
|
1184
|
+
* `ref` is a short string naming what the operation came from, in the
|
|
1185
|
+
* shape its kind documents (the core manual, "Kinds of operation"). Both
|
|
1186
|
+
* are recorded from the first write like the label, and a nested operation
|
|
1187
|
+
* keeps the outer one's.
|
|
1188
|
+
*
|
|
1189
|
+
* `keys` (from `keySeed()`) makes a run of the operation send the same
|
|
1190
|
+
* requests as an earlier run with the same keys: the nth keyed request that
|
|
1191
|
+
* joins it takes the Idempotency-Key `<seed>.<n>` and the document-version
|
|
1192
|
+
* its first run claimed, so a request that landed is answered from its
|
|
1193
|
+
* first send and writes nothing again. The count starts at 0 at each
|
|
1194
|
+
* outermost begin. A nested operation joins the outer one's keys, unless it
|
|
1195
|
+
* brings its own: then it numbers from 0 under its own seed until its
|
|
1196
|
+
* matching end, and the outer numbering resumes after it.
|
|
1197
|
+
*
|
|
1198
|
+
* @param {string} message - Human label for the operation.
|
|
1199
|
+
* @param {{groupId?: string, kind?: OperationKind, ref?: string, keys?: KeySeed, minted?: Iterable<string>}} [opts] - Optional `{ groupId, kind, ref, keys, minted }`. `groupId` adopts an existing group id instead of minting one (a service joining the requester's operation; `requestService` propagates an open operation to the service automatically). Python's is `group_id`. `kind`, `ref` and `keys` are described above. `minted` is the ids the operation mints for what it creates: a create refused 409 id-taken for one of them was made by an earlier send of the operation, and answers as made.
|
|
1200
|
+
* @returns {string} The operation's group id.
|
|
1201
|
+
*/
|
|
1202
|
+
beginOperation(message: string, { groupId, kind, ref, keys, minted }?: {
|
|
1203
|
+
groupId?: string;
|
|
1204
|
+
kind?: OperationKind;
|
|
1205
|
+
ref?: string;
|
|
1206
|
+
keys?: KeySeed;
|
|
1207
|
+
minted?: Iterable<string>;
|
|
1208
|
+
}): string;
|
|
1209
|
+
/**
|
|
1210
|
+
* A seed for the Idempotency-Keys of a logical operation that may be run
|
|
1211
|
+
* again from the top (see beginOperation's `keys`). Keep it with the work
|
|
1212
|
+
* it belongs to and pass it to every run.
|
|
1213
|
+
* @returns {KeySeed}
|
|
1214
|
+
*/
|
|
1215
|
+
keySeed(): KeySeed;
|
|
1216
|
+
/**
|
|
1217
|
+
* End the current logical operation. With no argument this is purely local
|
|
1218
|
+
* (no request). Pass a refined `message` to relabel the group now that the
|
|
1219
|
+
* outcome is known (e.g. `endOperation('Merged 3 morphemes')`) — that sends
|
|
1220
|
+
* one PATCH, skipped if the operation never wrote anything. A refine from a
|
|
1221
|
+
* nested (flattened) `endOperation` is ignored; the outer label wins.
|
|
1222
|
+
* @param {string} [message] - Optional refined label.
|
|
1223
|
+
* @returns {Promise<void>}
|
|
1224
|
+
*/
|
|
1225
|
+
endOperation(message?: string): Promise<void>;
|
|
1226
|
+
/**
|
|
1227
|
+
* Run `fn` as one logical operation (see beginOperation), ending it when
|
|
1228
|
+
* `fn` settles — including on throw. `fn` receives a `setMessage(msg)`
|
|
1229
|
+
* callback to refine the label once the outcome is known.
|
|
1230
|
+
*
|
|
1231
|
+
* await client.withOperation('Merge morphemes', async (setMessage) => {
|
|
1232
|
+
* await client.batched(async (b) => { ... });
|
|
1233
|
+
* setMessage(`Merged ${n} morphemes`);
|
|
1234
|
+
* });
|
|
1235
|
+
*
|
|
1236
|
+
* The kind and reference (see beginOperation) come after `fn`:
|
|
1237
|
+
*
|
|
1238
|
+
* await client.withOperation('Import ELAN corpus', run, { kind: 'import', ref: 'format:elan' });
|
|
1239
|
+
*
|
|
1240
|
+
* @template T
|
|
1241
|
+
* @param {string} message - Human label for the operation.
|
|
1242
|
+
* @param {(setMessage: (msg: string) => void) => T | Promise<T>} fn - The work to run; receives `setMessage(msg)` to refine the label once the outcome is known.
|
|
1243
|
+
* @param {{kind?: OperationKind, ref?: string, groupId?: string, keys?: KeySeed, minted?: Iterable<string>}} [opts] - Optional `{ kind, ref, groupId, keys, minted }`, as for beginOperation. `kind` is one of `assistant-plan`, `service-run`, `import`, `bulk-edit`, `guess-adoption`, `repair` or `review`, and any other throws before `fn` runs.
|
|
1244
|
+
* @returns {Promise<T>} Whatever `fn` resolves to.
|
|
1245
|
+
*/
|
|
1246
|
+
withOperation<T>(message: string, fn: (setMessage: (msg: string) => void) => T | Promise<T>, { kind, ref, groupId, keys, minted }?: {
|
|
1247
|
+
kind?: OperationKind;
|
|
1248
|
+
ref?: string;
|
|
1249
|
+
groupId?: string;
|
|
1250
|
+
keys?: KeySeed;
|
|
1251
|
+
minted?: Iterable<string>;
|
|
1252
|
+
}): Promise<T>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Open a batch: a view of this client with the same bundles, on which every
|
|
1255
|
+
* write of project data queues instead of going out. `submit()` sends the
|
|
1256
|
+
* queued operations as ONE atomic request (larger than the server's cap,
|
|
1257
|
+
* as consecutive requests with the results concatenated in queue order,
|
|
1258
|
+
* each atomic on its own, so a failure in a later one leaves the earlier
|
|
1259
|
+
* ones committed, and the error it throws carries `committed`, the count
|
|
1260
|
+
* saved, and `committedResults`, their results) and
|
|
1261
|
+
* resolves to one result per operation; `abort()` drops them. A call made
|
|
1262
|
+
* on the client itself is never touched by an open batch, and a read or an
|
|
1263
|
+
* out-of-band signal made on the batch goes over the wire now (see the note
|
|
1264
|
+
* at the top of `http.js`).
|
|
1265
|
+
*
|
|
1266
|
+
* const b = client.batch();
|
|
1267
|
+
* b.tokens.bulkCreate(sentenceOps);
|
|
1268
|
+
* b.tokens.bulkCreate(wordOps);
|
|
1269
|
+
* const [sentRes, wordRes] = await b.submit();
|
|
1270
|
+
*
|
|
1271
|
+
* Server-side a batch runs sequentially in one transaction: a child op sees
|
|
1272
|
+
* parents created earlier in the same batch, and any op's failure rolls the
|
|
1273
|
+
* whole batch back. A batch is not nestable. Prefer `batched()`, which
|
|
1274
|
+
* submits or aborts for you.
|
|
1275
|
+
*
|
|
1276
|
+
* `timeout` (ms, or null for none) is how long each of this batch's
|
|
1277
|
+
* requests may wait for its answer, in place of the client's
|
|
1278
|
+
* `batchTimeout`, for this batch alone.
|
|
1279
|
+
* @param {{timeout?: number | null}} [options]
|
|
1280
|
+
* @returns {PlaidBatch} the batch view
|
|
1281
|
+
*/
|
|
1282
|
+
batch({ timeout }?: {
|
|
1283
|
+
timeout?: number | null;
|
|
1284
|
+
}): PlaidBatch;
|
|
1285
|
+
/**
|
|
1286
|
+
* POST one batch request (at most MAX_BATCH_OPS operations). Resolves to
|
|
1287
|
+
* one `{ status, headers, body }` per operation, with only the body
|
|
1288
|
+
* recased: the headers keep the server's spelling. `key` is the request's
|
|
1289
|
+
* Idempotency-Key: a batch whose answer is lost (no response, 502, 504) is
|
|
1290
|
+
* sent again under it, and answered from the first send if that landed.
|
|
1291
|
+
* `timeout` is this request's, in place of `batchTimeout` when given.
|
|
1292
|
+
* See postBatch in http.js.
|
|
1293
|
+
* @param {string} url
|
|
1294
|
+
* @param {object[]} body
|
|
1295
|
+
* @param {{key?: string, timeout?: number | null}} [options]
|
|
1296
|
+
* @private
|
|
1297
|
+
*/
|
|
1298
|
+
private _postBatch;
|
|
1299
|
+
/**
|
|
1300
|
+
* Run `fn` with a batch, then submit all queued ops as `submit()` does (ONE
|
|
1301
|
+
* atomic request up to MAX_BATCH_OPS operations, consecutive requests past
|
|
1302
|
+
* it), or abort the batch if `fn` throws. `fn` receives the batch and makes its
|
|
1303
|
+
* writes on it; it must NOT call `submit()` itself. Resolves to the batch
|
|
1304
|
+
* results array (`[]` if `fn` queued nothing).
|
|
1305
|
+
*
|
|
1306
|
+
* const [sentRes, wordRes] = await client.batched(async (b) => {
|
|
1307
|
+
* b.tokens.bulkCreate(sentenceOps);
|
|
1308
|
+
* b.tokens.bulkCreate(wordOps);
|
|
1309
|
+
* });
|
|
1310
|
+
*
|
|
1311
|
+
* A write made on `client` inside `fn` is not part of the batch: it goes
|
|
1312
|
+
* over the wire at once, as it would anywhere else. See `batch()`, which
|
|
1313
|
+
* also says what `timeout` does.
|
|
1314
|
+
* @param {(batch: PlaidBatch) => (void | Promise<void>)} fn
|
|
1315
|
+
* @param {{timeout?: number | null}} [options]
|
|
1316
|
+
* @returns {Promise<any[]>}
|
|
1317
|
+
*/
|
|
1318
|
+
batched(fn: (batch: PlaidBatch) => (void | Promise<void>), { timeout }?: {
|
|
1319
|
+
timeout?: number | null;
|
|
1320
|
+
}): Promise<any[]>;
|
|
1321
|
+
}
|