@larc-iu/plaid-client 0.2.0-alpha.3 → 0.2.0-alpha.30
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 +455 -0
- package/src/apiServer.js +422 -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 +63 -0
- package/src/entryForms.js +152 -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
|
@@ -0,0 +1,369 @@
|
|
|
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 textLayersApi(client: import("./client.js").PlaidClient): {
|
|
90
|
+
get: (layerId: string) => Promise<import("./types.js").TextLayer>;
|
|
91
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
92
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").TextLayer>;
|
|
93
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
94
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
95
|
+
expected?: any;
|
|
96
|
+
}) => Promise<void>;
|
|
97
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
98
|
+
expected?: any;
|
|
99
|
+
}) => Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Create a new text layer for a project.
|
|
102
|
+
* @param {string} projectId - The project ID
|
|
103
|
+
* @param {string} name - The name
|
|
104
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
105
|
+
* @param {object} [opts]
|
|
106
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
107
|
+
* @returns {Promise<Created>}
|
|
108
|
+
*/
|
|
109
|
+
create: (projectId: string, name: string, auditMessage?: string, { id }?: {
|
|
110
|
+
id?: string;
|
|
111
|
+
}) => Promise<Created>;
|
|
112
|
+
};
|
|
113
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
114
|
+
export function tokenLayersApi(client: import("./client.js").PlaidClient): {
|
|
115
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
116
|
+
expected?: Array<object> | null;
|
|
117
|
+
}) => Promise<{
|
|
118
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
119
|
+
}>;
|
|
120
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
121
|
+
expected?: Array<object> | null;
|
|
122
|
+
}) => Promise<void>;
|
|
123
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
124
|
+
limit?: number;
|
|
125
|
+
}) => Promise<{
|
|
126
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
127
|
+
violationCount: number;
|
|
128
|
+
}>;
|
|
129
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
130
|
+
document?: string;
|
|
131
|
+
}) => Promise<{
|
|
132
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
133
|
+
locked: Array<{
|
|
134
|
+
document: string;
|
|
135
|
+
lockedBy: string;
|
|
136
|
+
}>;
|
|
137
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
138
|
+
violationCount: number;
|
|
139
|
+
}>;
|
|
140
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
141
|
+
expected?: any;
|
|
142
|
+
}) => Promise<void>;
|
|
143
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
144
|
+
expected?: any;
|
|
145
|
+
}) => Promise<void>;
|
|
146
|
+
get: (layerId: string) => Promise<import("./types.js").TokenLayer>;
|
|
147
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
148
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").TokenLayer>;
|
|
149
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Create a new token layer.
|
|
152
|
+
* @param {string} textLayerId - The text layer ID
|
|
153
|
+
* @param {string} name - The name
|
|
154
|
+
* @param {string} [overlapMode] - Per-layer, immutable token invariant: "any" (default), "non-overlapping", or "partitioning". On partitioning layers, single token create/update/delete are rejected; use bulkCreate plus split/merge/shift.
|
|
155
|
+
* @param {string} [parentTokenLayerId] - Optional immutable parent token layer. Tokens in this layer must nest within a parent-layer token; the parent layer must be in the same text layer and be "non-overlapping" or "partitioning" (an "any" parent is rejected). A nested layer may be "any" or "non-overlapping" but not "partitioning" (partitioning is only for root layers), e.g. words (non-overlapping, parent=sentences) within sentences (partitioning).
|
|
156
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
157
|
+
* @param {object} [opts]
|
|
158
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
159
|
+
* @returns {Promise<Created>}
|
|
160
|
+
*/
|
|
161
|
+
create: (textLayerId: string, name: string, overlapMode?: string, parentTokenLayerId?: string, auditMessage?: string, { id }?: {
|
|
162
|
+
id?: string;
|
|
163
|
+
}) => Promise<Created>;
|
|
164
|
+
/**
|
|
165
|
+
* Count, per document, the tokens of each layer whose surface matches a
|
|
166
|
+
* regex, as a query's `value: {regex}` on a token decides. Each text is
|
|
167
|
+
* read once, so it stays fast on a long document. Layers you cannot read
|
|
168
|
+
* are left out.
|
|
169
|
+
* @param {string[]} layerIds - The token layer ids
|
|
170
|
+
* @param {{regex: string, flags?: string}} value - The regex spec
|
|
171
|
+
* @returns {Promise<{results: Array<[string, string, number]>}>} [layerId,
|
|
172
|
+
* documentId, count] rows, a document with tokens of the layer and no
|
|
173
|
+
* match counting 0.
|
|
174
|
+
*/
|
|
175
|
+
countMatching: (layerIds: string[], value: {
|
|
176
|
+
regex: string;
|
|
177
|
+
flags?: string;
|
|
178
|
+
}) => Promise<{
|
|
179
|
+
results: Array<[string, string, number]>;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
183
|
+
export function spanLayersApi(client: import("./client.js").PlaidClient): {
|
|
184
|
+
get: (layerId: string) => Promise<import("./types.js").SpanLayer>;
|
|
185
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
186
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").SpanLayer>;
|
|
187
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
188
|
+
refusedValues: (layerId: string, rule: import("./families.js").ValueSetRule, options?: {
|
|
189
|
+
limit?: number;
|
|
190
|
+
}) => Promise<import("./families.js").RefusedValues>;
|
|
191
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
192
|
+
expected?: Array<object> | null;
|
|
193
|
+
}) => Promise<{
|
|
194
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
195
|
+
}>;
|
|
196
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
197
|
+
expected?: Array<object> | null;
|
|
198
|
+
}) => Promise<void>;
|
|
199
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
200
|
+
limit?: number;
|
|
201
|
+
}) => Promise<{
|
|
202
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
203
|
+
violationCount: number;
|
|
204
|
+
}>;
|
|
205
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
206
|
+
document?: string;
|
|
207
|
+
}) => Promise<{
|
|
208
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
209
|
+
locked: Array<{
|
|
210
|
+
document: string;
|
|
211
|
+
lockedBy: string;
|
|
212
|
+
}>;
|
|
213
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
214
|
+
violationCount: number;
|
|
215
|
+
}>;
|
|
216
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
217
|
+
expected?: any;
|
|
218
|
+
}) => Promise<void>;
|
|
219
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
220
|
+
expected?: any;
|
|
221
|
+
}) => Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Create a new span layer.
|
|
224
|
+
* @param {string} tokenLayerId - The token layer ID
|
|
225
|
+
* @param {string} name - The name
|
|
226
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
227
|
+
* @param {object} [opts]
|
|
228
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
229
|
+
* @returns {Promise<Created>}
|
|
230
|
+
*/
|
|
231
|
+
create: (tokenLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
232
|
+
id?: string;
|
|
233
|
+
}) => Promise<Created>;
|
|
234
|
+
};
|
|
235
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
236
|
+
export function relationLayersApi(client: import("./client.js").PlaidClient): {
|
|
237
|
+
refusedValues: (layerId: string, rule: import("./families.js").ValueSetRule, options?: {
|
|
238
|
+
limit?: number;
|
|
239
|
+
}) => Promise<import("./families.js").RefusedValues>;
|
|
240
|
+
setConstraints: (layerId: string, namespace: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
241
|
+
expected?: Array<object> | null;
|
|
242
|
+
}) => Promise<{
|
|
243
|
+
constraints: Record<string, import("./families.js").LayerConstraint[]>;
|
|
244
|
+
}>;
|
|
245
|
+
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
246
|
+
expected?: Array<object> | null;
|
|
247
|
+
}) => Promise<void>;
|
|
248
|
+
checkConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], options?: {
|
|
249
|
+
limit?: number;
|
|
250
|
+
}) => Promise<{
|
|
251
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
252
|
+
violationCount: number;
|
|
253
|
+
}>;
|
|
254
|
+
repairConstraints: (layerId: string, constraints: import("./families.js").LayerConstraint[], auditMessage?: string, options?: {
|
|
255
|
+
document?: string;
|
|
256
|
+
}) => Promise<{
|
|
257
|
+
repaired: import("./families.js").ConstraintRepair[];
|
|
258
|
+
locked: Array<{
|
|
259
|
+
document: string;
|
|
260
|
+
lockedBy: string;
|
|
261
|
+
}>;
|
|
262
|
+
violations: import("./families.js").ConstraintViolation[];
|
|
263
|
+
violationCount: number;
|
|
264
|
+
}>;
|
|
265
|
+
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
266
|
+
expected?: any;
|
|
267
|
+
}) => Promise<void>;
|
|
268
|
+
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
269
|
+
expected?: any;
|
|
270
|
+
}) => Promise<void>;
|
|
271
|
+
get: (layerId: string) => Promise<import("./types.js").RelationLayer>;
|
|
272
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
273
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<import("./types.js").RelationLayer>;
|
|
274
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Create a new relation layer.
|
|
277
|
+
* @param {string} spanLayerId - The span layer ID
|
|
278
|
+
* @param {string} name - The name
|
|
279
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
280
|
+
* @param {object} [opts]
|
|
281
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
282
|
+
* @returns {Promise<Created>}
|
|
283
|
+
*/
|
|
284
|
+
create: (spanLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
285
|
+
id?: string;
|
|
286
|
+
}) => Promise<Created>;
|
|
287
|
+
};
|
|
288
|
+
export type TextEditOp = import("./types.js").TextEditOp;
|
|
289
|
+
export type TextGap = import("./types.js").TextGap;
|
|
290
|
+
export type MetadataOp = import("./types.js").MetadataOp;
|
|
291
|
+
export type LayerConstraint = import("./types.js").LayerConstraint;
|
|
292
|
+
export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
|
|
293
|
+
export type ConstraintViolation = import("./types.js").ConstraintViolation;
|
|
294
|
+
export type Requester = import("./types.js").Requester;
|
|
295
|
+
export type BatchRef = import("./types.js").BatchRef;
|
|
296
|
+
export type ServiceParam = import("./types.js").ServiceParam;
|
|
297
|
+
export type ServiceInfo = import("./types.js").ServiceInfo;
|
|
298
|
+
export type DiscoveredService = import("./types.js").DiscoveredService;
|
|
299
|
+
export type ResponseHelper = import("./types.js").ResponseHelper;
|
|
300
|
+
export type ServiceRegistration = import("./types.js").ServiceRegistration;
|
|
301
|
+
export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
|
|
302
|
+
export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
|
|
303
|
+
export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
|
|
304
|
+
export type OperationKind = import("./types.js").OperationKind;
|
|
305
|
+
export type KeySeed = import("./types.js").KeySeed;
|
|
306
|
+
export type PlaidBatch = import("./types.js").PlaidBatch;
|
|
307
|
+
export type AuditPageOptions = import("./types.js").AuditPageOptions;
|
|
308
|
+
export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
|
|
309
|
+
export type UserDataEntry = import("./types.js").UserDataEntry;
|
|
310
|
+
export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
|
|
311
|
+
export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
|
|
312
|
+
export type ConstraintRepair = import("./types.js").ConstraintRepair;
|
|
313
|
+
export type ValueSetRule = import("./types.js").ValueSetRule;
|
|
314
|
+
export type RefusedValues = import("./types.js").RefusedValues;
|
|
315
|
+
export type CommentableType = import("./types.js").CommentableType;
|
|
316
|
+
export type Comment = import("./types.js").Comment;
|
|
317
|
+
export type Guideline = import("./types.js").Guideline;
|
|
318
|
+
export type ClientEventType = import("./types.js").ClientEventType;
|
|
319
|
+
export type ClientEvent = import("./types.js").ClientEvent;
|
|
320
|
+
export type Invite = import("./types.js").Invite;
|
|
321
|
+
export type ServerLimits = import("./types.js").ServerLimits;
|
|
322
|
+
export type ServerHealth = import("./types.js").ServerHealth;
|
|
323
|
+
export type RateLimitBucket = import("./types.js").RateLimitBucket;
|
|
324
|
+
export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
|
|
325
|
+
export type BackupStatus = import("./types.js").BackupStatus;
|
|
326
|
+
export type ServerReport = import("./types.js").ServerReport;
|
|
327
|
+
export type LiveLog = import("./types.js").LiveLog;
|
|
328
|
+
export type SSEConnection = import("./types.js").SSEConnection;
|
|
329
|
+
export type SSEStats = import("./types.js").SSEStats;
|
|
330
|
+
export type AtomicValue = import("./types.js").AtomicValue;
|
|
331
|
+
export type Created = import("./types.js").Created;
|
|
332
|
+
export type Project = import("./types.js").Project;
|
|
333
|
+
export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
|
|
334
|
+
export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
|
|
335
|
+
export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
|
|
336
|
+
export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
|
|
337
|
+
export type ProjectVocab = import("./types.js").ProjectVocab;
|
|
338
|
+
export type PlaidDocument = import("./types.js").PlaidDocument;
|
|
339
|
+
export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
|
|
340
|
+
export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
|
|
341
|
+
export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
|
|
342
|
+
export type PlaidText = import("./types.js").PlaidText;
|
|
343
|
+
export type TextReshape = import("./types.js").TextReshape;
|
|
344
|
+
export type Token = import("./types.js").Token;
|
|
345
|
+
export type Span = import("./types.js").Span;
|
|
346
|
+
export type Relation = import("./types.js").Relation;
|
|
347
|
+
export type VocabItem = import("./types.js").VocabItem;
|
|
348
|
+
export type VocabLink = import("./types.js").VocabLink;
|
|
349
|
+
export type VocabLayer = import("./types.js").VocabLayer;
|
|
350
|
+
export type TextLayer = import("./types.js").TextLayer;
|
|
351
|
+
export type TokenLayer = import("./types.js").TokenLayer;
|
|
352
|
+
export type SpanLayer = import("./types.js").SpanLayer;
|
|
353
|
+
export type RelationLayer = import("./types.js").RelationLayer;
|
|
354
|
+
export type MetadataRecords = import("./types.js").MetadataRecords;
|
|
355
|
+
export type LayerRecords = import("./types.js").LayerRecords;
|
|
356
|
+
export type User = import("./types.js").User;
|
|
357
|
+
export type ProjectListEntry = import("./types.js").ProjectListEntry;
|
|
358
|
+
export type DocumentListEntry = import("./types.js").DocumentListEntry;
|
|
359
|
+
export type ApiToken = import("./types.js").ApiToken;
|
|
360
|
+
export type AuditUser = import("./types.js").AuditUser;
|
|
361
|
+
export type AuditTarget = import("./types.js").AuditTarget;
|
|
362
|
+
export type AuditOp = import("./types.js").AuditOp;
|
|
363
|
+
export type AuditEntry = import("./types.js").AuditEntry;
|
|
364
|
+
export type LockGrant = import("./types.js").LockGrant;
|
|
365
|
+
export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
|
|
366
|
+
export type RestoreCounts = import("./types.js").RestoreCounts;
|
|
367
|
+
export type OperationGroup = import("./types.js").OperationGroup;
|
|
368
|
+
export type QueryResult = import("./types.js").QueryResult;
|
|
369
|
+
export type Page<T = any> = import("./types.js").Page<T>;
|
package/src/apiLayers.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layer bundles: text, token, span and relation layers, each a factory
|
|
3
|
+
* of the client (client.js installs them).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { bodyOf, configMethods, constraintMethods, layerMethods, valueSetMethods } from "./families.js";
|
|
7
|
+
import { queryTimeout } from "./http.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("./types.js").TextEditOp} TextEditOp
|
|
11
|
+
* @typedef {import("./types.js").TextGap} TextGap
|
|
12
|
+
* @typedef {import("./types.js").MetadataOp} MetadataOp
|
|
13
|
+
* @typedef {import("./types.js").LayerConstraint} LayerConstraint
|
|
14
|
+
* @typedef {import("./types.js").ConstraintWriteOptions} ConstraintWriteOptions
|
|
15
|
+
* @typedef {import("./types.js").ConstraintViolation} ConstraintViolation
|
|
16
|
+
* @typedef {import("./types.js").Requester} Requester
|
|
17
|
+
* @typedef {import("./types.js").BatchRef} BatchRef
|
|
18
|
+
* @typedef {import("./types.js").ServiceParam} ServiceParam
|
|
19
|
+
* @typedef {import("./types.js").ServiceInfo} ServiceInfo
|
|
20
|
+
* @typedef {import("./types.js").DiscoveredService} DiscoveredService
|
|
21
|
+
* @typedef {import("./types.js").ResponseHelper} ResponseHelper
|
|
22
|
+
* @typedef {import("./types.js").ServiceRegistration} ServiceRegistration
|
|
23
|
+
* @typedef {import("./types.js").ServiceStatusEvent} ServiceStatusEvent
|
|
24
|
+
* @typedef {import("./types.js").OperationGroupsBundle} OperationGroupsBundle
|
|
25
|
+
* @typedef {import("./types.js").PlaidClientOptions} PlaidClientOptions
|
|
26
|
+
* @typedef {import("./types.js").OperationKind} OperationKind
|
|
27
|
+
* @typedef {import("./types.js").KeySeed} KeySeed
|
|
28
|
+
* @typedef {import("./types.js").PlaidBatch} PlaidBatch
|
|
29
|
+
* @typedef {import("./types.js").AuditPageOptions} AuditPageOptions
|
|
30
|
+
* @typedef {import("./types.js").VocabItemRestoreSummary} VocabItemRestoreSummary
|
|
31
|
+
* @typedef {import("./types.js").UserDataEntry} UserDataEntry
|
|
32
|
+
* @typedef {import("./types.js").AdminUserDataEntry} AdminUserDataEntry
|
|
33
|
+
* @typedef {import("./types.js").ActivityTallyRow} ActivityTallyRow
|
|
34
|
+
* @typedef {import("./types.js").ConstraintRepair} ConstraintRepair
|
|
35
|
+
* @typedef {import("./types.js").ValueSetRule} ValueSetRule
|
|
36
|
+
* @typedef {import("./types.js").RefusedValues} RefusedValues
|
|
37
|
+
* @typedef {import("./types.js").CommentableType} CommentableType
|
|
38
|
+
* @typedef {import("./types.js").Comment} Comment
|
|
39
|
+
* @typedef {import("./types.js").Guideline} Guideline
|
|
40
|
+
* @typedef {import("./types.js").ClientEventType} ClientEventType
|
|
41
|
+
* @typedef {import("./types.js").ClientEvent} ClientEvent
|
|
42
|
+
* @typedef {import("./types.js").Invite} Invite
|
|
43
|
+
* @typedef {import("./types.js").ServerLimits} ServerLimits
|
|
44
|
+
* @typedef {import("./types.js").ServerHealth} ServerHealth
|
|
45
|
+
* @typedef {import("./types.js").RateLimitBucket} RateLimitBucket
|
|
46
|
+
* @typedef {import("./types.js").RateLimitSnapshot} RateLimitSnapshot
|
|
47
|
+
* @typedef {import("./types.js").BackupStatus} BackupStatus
|
|
48
|
+
* @typedef {import("./types.js").ServerReport} ServerReport
|
|
49
|
+
* @typedef {import("./types.js").LiveLog} LiveLog
|
|
50
|
+
* @typedef {import("./types.js").SSEConnection} SSEConnection
|
|
51
|
+
* @typedef {import("./types.js").SSEStats} SSEStats
|
|
52
|
+
* @typedef {import("./types.js").AtomicValue} AtomicValue
|
|
53
|
+
* @typedef {import("./types.js").Created} Created
|
|
54
|
+
* @typedef {import("./types.js").Project} Project
|
|
55
|
+
* @typedef {import("./types.js").ProjectTextLayer} ProjectTextLayer
|
|
56
|
+
* @typedef {import("./types.js").ProjectTokenLayer} ProjectTokenLayer
|
|
57
|
+
* @typedef {import("./types.js").ProjectSpanLayer} ProjectSpanLayer
|
|
58
|
+
* @typedef {import("./types.js").ProjectRelationLayer} ProjectRelationLayer
|
|
59
|
+
* @typedef {import("./types.js").ProjectVocab} ProjectVocab
|
|
60
|
+
* @typedef {import("./types.js").PlaidDocument} PlaidDocument
|
|
61
|
+
* @typedef {import("./types.js").DocumentTextLayer} DocumentTextLayer
|
|
62
|
+
* @typedef {import("./types.js").DocumentTokenLayer} DocumentTokenLayer
|
|
63
|
+
* @typedef {import("./types.js").DocumentSpanLayer} DocumentSpanLayer
|
|
64
|
+
* @typedef {import("./types.js").PlaidText} PlaidText
|
|
65
|
+
* @typedef {import("./types.js").TextReshape} TextReshape
|
|
66
|
+
* @typedef {import("./types.js").Token} Token
|
|
67
|
+
* @typedef {import("./types.js").Span} Span
|
|
68
|
+
* @typedef {import("./types.js").Relation} Relation
|
|
69
|
+
* @typedef {import("./types.js").VocabItem} VocabItem
|
|
70
|
+
* @typedef {import("./types.js").VocabLink} VocabLink
|
|
71
|
+
* @typedef {import("./types.js").VocabLayer} VocabLayer
|
|
72
|
+
* @typedef {import("./types.js").TextLayer} TextLayer
|
|
73
|
+
* @typedef {import("./types.js").TokenLayer} TokenLayer
|
|
74
|
+
* @typedef {import("./types.js").SpanLayer} SpanLayer
|
|
75
|
+
* @typedef {import("./types.js").RelationLayer} RelationLayer
|
|
76
|
+
* @typedef {import("./types.js").MetadataRecords} MetadataRecords
|
|
77
|
+
* @typedef {import("./types.js").LayerRecords} LayerRecords
|
|
78
|
+
* @typedef {import("./types.js").User} User
|
|
79
|
+
* @typedef {import("./types.js").ProjectListEntry} ProjectListEntry
|
|
80
|
+
* @typedef {import("./types.js").DocumentListEntry} DocumentListEntry
|
|
81
|
+
* @typedef {import("./types.js").ApiToken} ApiToken
|
|
82
|
+
* @typedef {import("./types.js").AuditUser} AuditUser
|
|
83
|
+
* @typedef {import("./types.js").AuditTarget} AuditTarget
|
|
84
|
+
* @typedef {import("./types.js").AuditOp} AuditOp
|
|
85
|
+
* @typedef {import("./types.js").AuditEntry} AuditEntry
|
|
86
|
+
* @typedef {import("./types.js").LockGrant} LockGrant
|
|
87
|
+
* @typedef {import("./types.js").DocumentRestoreSummary} DocumentRestoreSummary
|
|
88
|
+
* @typedef {import("./types.js").RestoreCounts} RestoreCounts
|
|
89
|
+
* @typedef {import("./types.js").OperationGroup} OperationGroup
|
|
90
|
+
* @typedef {import("./types.js").QueryResult} QueryResult
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @template [T=any]
|
|
95
|
+
* @typedef {import("./types.js").Page<T>} Page
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
99
|
+
export function textLayersApi(client) {
|
|
100
|
+
return {
|
|
101
|
+
/**
|
|
102
|
+
* Create a new text layer for a project.
|
|
103
|
+
* @param {string} projectId - The project ID
|
|
104
|
+
* @param {string} name - The name
|
|
105
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
106
|
+
* @param {object} [opts]
|
|
107
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
108
|
+
* @returns {Promise<Created>}
|
|
109
|
+
*/
|
|
110
|
+
create: (projectId, name, auditMessage, { id } = {}) =>
|
|
111
|
+
client._request("POST", "/api/v1/text-layers", {
|
|
112
|
+
auditMessage,
|
|
113
|
+
body: bodyOf({ id, "project-id": projectId, name }),
|
|
114
|
+
}),
|
|
115
|
+
...configMethods(client, "text-layers"),
|
|
116
|
+
...layerMethods(client, "text-layers"),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
121
|
+
export function tokenLayersApi(client) {
|
|
122
|
+
return {
|
|
123
|
+
/**
|
|
124
|
+
* Create a new token layer.
|
|
125
|
+
* @param {string} textLayerId - The text layer ID
|
|
126
|
+
* @param {string} name - The name
|
|
127
|
+
* @param {string} [overlapMode] - Per-layer, immutable token invariant: "any" (default), "non-overlapping", or "partitioning". On partitioning layers, single token create/update/delete are rejected; use bulkCreate plus split/merge/shift.
|
|
128
|
+
* @param {string} [parentTokenLayerId] - Optional immutable parent token layer. Tokens in this layer must nest within a parent-layer token; the parent layer must be in the same text layer and be "non-overlapping" or "partitioning" (an "any" parent is rejected). A nested layer may be "any" or "non-overlapping" but not "partitioning" (partitioning is only for root layers), e.g. words (non-overlapping, parent=sentences) within sentences (partitioning).
|
|
129
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
130
|
+
* @param {object} [opts]
|
|
131
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
132
|
+
* @returns {Promise<Created>}
|
|
133
|
+
*/
|
|
134
|
+
create: (
|
|
135
|
+
textLayerId,
|
|
136
|
+
name,
|
|
137
|
+
overlapMode,
|
|
138
|
+
parentTokenLayerId,
|
|
139
|
+
auditMessage,
|
|
140
|
+
{ id } = {},
|
|
141
|
+
) =>
|
|
142
|
+
client._request("POST", "/api/v1/token-layers", {
|
|
143
|
+
auditMessage,
|
|
144
|
+
body: bodyOf({
|
|
145
|
+
id,
|
|
146
|
+
"text-layer-id": textLayerId,
|
|
147
|
+
name,
|
|
148
|
+
"overlap-mode": overlapMode,
|
|
149
|
+
"parent-token-layer-id": parentTokenLayerId,
|
|
150
|
+
}),
|
|
151
|
+
}),
|
|
152
|
+
/**
|
|
153
|
+
* Count, per document, the tokens of each layer whose surface matches a
|
|
154
|
+
* regex, as a query's `value: {regex}` on a token decides. Each text is
|
|
155
|
+
* read once, so it stays fast on a long document. Layers you cannot read
|
|
156
|
+
* are left out.
|
|
157
|
+
* @param {string[]} layerIds - The token layer ids
|
|
158
|
+
* @param {{regex: string, flags?: string}} value - The regex spec
|
|
159
|
+
* @returns {Promise<{results: Array<[string, string, number]>}>} [layerId,
|
|
160
|
+
* documentId, count] rows, a document with tokens of the layer and no
|
|
161
|
+
* match counting 0.
|
|
162
|
+
*/
|
|
163
|
+
countMatching: (layerIds, value) =>
|
|
164
|
+
client._request("POST", "/api/v1/query/token-counts", {
|
|
165
|
+
body: { layers: layerIds, value },
|
|
166
|
+
outOfBand: true,
|
|
167
|
+
timeout: queryTimeout(client),
|
|
168
|
+
noBusyRetry: true,
|
|
169
|
+
}),
|
|
170
|
+
...layerMethods(client, "token-layers"),
|
|
171
|
+
...configMethods(client, "token-layers"),
|
|
172
|
+
...constraintMethods(client, "token-layers"),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
177
|
+
export function spanLayersApi(client) {
|
|
178
|
+
return {
|
|
179
|
+
/**
|
|
180
|
+
* Create a new span layer.
|
|
181
|
+
* @param {string} tokenLayerId - The token layer ID
|
|
182
|
+
* @param {string} name - The name
|
|
183
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
184
|
+
* @param {object} [opts]
|
|
185
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
186
|
+
* @returns {Promise<Created>}
|
|
187
|
+
*/
|
|
188
|
+
create: (tokenLayerId, name, auditMessage, { id } = {}) =>
|
|
189
|
+
client._request("POST", "/api/v1/span-layers", {
|
|
190
|
+
auditMessage,
|
|
191
|
+
body: bodyOf({ id, "token-layer-id": tokenLayerId, name }),
|
|
192
|
+
}),
|
|
193
|
+
...configMethods(client, "span-layers"),
|
|
194
|
+
...constraintMethods(client, "span-layers"),
|
|
195
|
+
...valueSetMethods(client, "span-layers"),
|
|
196
|
+
...layerMethods(client, "span-layers"),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
201
|
+
export function relationLayersApi(client) {
|
|
202
|
+
return {
|
|
203
|
+
/**
|
|
204
|
+
* Create a new relation layer.
|
|
205
|
+
* @param {string} spanLayerId - The span layer ID
|
|
206
|
+
* @param {string} name - The name
|
|
207
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
208
|
+
* @param {object} [opts]
|
|
209
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
210
|
+
* @returns {Promise<Created>}
|
|
211
|
+
*/
|
|
212
|
+
create: (spanLayerId, name, auditMessage, { id } = {}) =>
|
|
213
|
+
client._request("POST", "/api/v1/relation-layers", {
|
|
214
|
+
auditMessage,
|
|
215
|
+
body: bodyOf({ id, "span-layer-id": spanLayerId, name }),
|
|
216
|
+
}),
|
|
217
|
+
...layerMethods(client, "relation-layers"),
|
|
218
|
+
...configMethods(client, "relation-layers"),
|
|
219
|
+
...constraintMethods(client, "relation-layers"),
|
|
220
|
+
...valueSetMethods(client, "relation-layers"),
|
|
221
|
+
};
|
|
222
|
+
}
|