@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
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @larc-iu/plaid-client
|
|
2
|
+
|
|
3
|
+
The JavaScript client for the [Plaid](https://larc-iu.github.io/plaid/) annotation API.
|
|
4
|
+
It has no dependencies and runs in browsers and in Node.
|
|
5
|
+
|
|
6
|
+
## From npm
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @larc-iu/plaid-client@alpha
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import { PlaidClient } from "@larc-iu/plaid-client";
|
|
14
|
+
|
|
15
|
+
const client = await PlaidClient.login("http://localhost:8080", "user@example.com", "password");
|
|
16
|
+
console.log(await client.projects.list());
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## From a Plaid server
|
|
20
|
+
|
|
21
|
+
Every Plaid server serves the client that matches its own version at `/client/plaid-client.js`, with its type declarations at `/client/plaid-client.d.ts`.
|
|
22
|
+
A page served by Plaid, for example from the folder set as `static_resources_path` in its `config.toml`, can import it without bundling a copy:
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<script type="module">
|
|
26
|
+
import { PlaidClient } from "/client/plaid-client.js";
|
|
27
|
+
const client = await PlaidClient.login(location.origin, "user@example.com", "password");
|
|
28
|
+
console.log(await client.projects.list());
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
- [Manual](https://larc-iu.github.io/plaid/manual.html), which covers the API and its concepts.
|
|
35
|
+
- [API reference](https://larc-iu.github.io/plaid/api-js.html) for this client.
|
|
36
|
+
|
|
37
|
+
## Types
|
|
38
|
+
|
|
39
|
+
The type declarations are generated from the JSDoc in `src/` by `npm run types` (TypeScript's `tsc`), which `npm pack` runs. The JSDoc is their only source.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larc-iu/plaid-client",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.30",
|
|
4
4
|
"description": "JavaScript client for the Plaid annotation API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,20 @@
|
|
|
14
14
|
},
|
|
15
15
|
"main": "src/index.js",
|
|
16
16
|
"exports": {
|
|
17
|
-
".": "./src/index.js"
|
|
17
|
+
".": "./src/index.js",
|
|
18
|
+
"./testing": "./src/testing.js"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
|
-
"test": "node --test"
|
|
21
|
+
"test": "node --test",
|
|
22
|
+
"types": "npm run clean-types && tsc -p .",
|
|
23
|
+
"clean-types": "node -e \"const fs = require('fs'); for (const f of fs.readdirSync('src')) if (f.endsWith('.d.ts')) fs.rmSync('src/' + f)\"",
|
|
24
|
+
"prepack": "npm run types",
|
|
25
|
+
"postpack": "npm run clean-types"
|
|
21
26
|
},
|
|
22
27
|
"files": [
|
|
23
|
-
"src/"
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
"src/"
|
|
29
|
+
],
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
|
+
}
|
|
26
33
|
}
|
|
@@ -0,0 +1,508 @@
|
|
|
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 tokensApi(client: import("./client.js").PlaidClient): {
|
|
90
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
91
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
92
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Token>;
|
|
93
|
+
/**
|
|
94
|
+
* Get a token.
|
|
95
|
+
* @param {string} tokenId - The token ID
|
|
96
|
+
* @returns {Promise<Token>}
|
|
97
|
+
*/
|
|
98
|
+
get: (tokenId: string) => Promise<Token>;
|
|
99
|
+
/**
|
|
100
|
+
* Create a new token in a token layer. Tokens define text substrings
|
|
101
|
+
* using begin and end offsets. Tokens may be zero-width and may overlap.
|
|
102
|
+
* For tokens sharing the same begin, precedence controls the linear
|
|
103
|
+
* ordering.
|
|
104
|
+
*
|
|
105
|
+
* Offsets are 0-based indices in Unicode CODE POINTS (not UTF-16 code
|
|
106
|
+
* units): a supplementary-plane character (emoji, SMP script) is one
|
|
107
|
+
* position. JS strings are UTF-16, so do NOT use `str.length` /
|
|
108
|
+
* `str.substring` to compute offsets — count code points instead
|
|
109
|
+
* (e.g. `[...str].length`, or iterate with `codePointAt`).
|
|
110
|
+
* @param {string} tokenLayerId - The token layer ID
|
|
111
|
+
* @param {string} text - The text ID
|
|
112
|
+
* @param {number} begin - Start offset, inclusive (Unicode code points)
|
|
113
|
+
* @param {number} end - End offset, exclusive (Unicode code points)
|
|
114
|
+
* @param {number} [precedence] - Ordering precedence
|
|
115
|
+
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
116
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
117
|
+
* @param {object} [opts]
|
|
118
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
119
|
+
* @returns {Promise<Created>}
|
|
120
|
+
*/
|
|
121
|
+
create: (tokenLayerId: string, text: string, begin: number, end: number, precedence?: number, metadata?: any, auditMessage?: string, { id }?: {
|
|
122
|
+
id?: string;
|
|
123
|
+
}) => Promise<Created>;
|
|
124
|
+
/**
|
|
125
|
+
* Update a token.
|
|
126
|
+
* @param {string} tokenId - The token ID
|
|
127
|
+
* @param {number} [begin] - New start offset, inclusive (Unicode code points)
|
|
128
|
+
* @param {number} [end] - New end offset, exclusive (Unicode code points)
|
|
129
|
+
* @param {?number} [precedence] - Ordering precedence. Omit (undefined)
|
|
130
|
+
* to leave unchanged; pass a number to set; pass null explicitly to
|
|
131
|
+
* CLEAR it (revert to no explicit ordering). bodyOf keeps null but
|
|
132
|
+
* drops undefined, so the three cases map correctly to the server.
|
|
133
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
134
|
+
* @returns {Promise<Token>}
|
|
135
|
+
*/
|
|
136
|
+
update: (tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string) => Promise<Token>;
|
|
137
|
+
/**
|
|
138
|
+
* Delete a token and remove it from any spans. If this causes a span to
|
|
139
|
+
* have no remaining tokens, the span will also be deleted.
|
|
140
|
+
* @param {string} tokenId - The token ID
|
|
141
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
142
|
+
* @returns {Promise<void>}
|
|
143
|
+
*/
|
|
144
|
+
delete: (tokenId: string, auditMessage?: string) => Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Create multiple tokens in a single operation.
|
|
147
|
+
* @param {Array} body - The tokens to create, each as its single create takes it
|
|
148
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
149
|
+
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order.
|
|
150
|
+
*/
|
|
151
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
152
|
+
ids: string[];
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* Delete multiple tokens in a single operation. Provide an array of IDs.
|
|
156
|
+
* @param {Array} body - The IDs of the tokens to delete
|
|
157
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
158
|
+
* @returns {Promise<void>}
|
|
159
|
+
*/
|
|
160
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Update many tokens in a single operation: patch metadata.
|
|
163
|
+
* @param {Array} body - Objects of the shape `{id, metadata}`. `metadata` is a list of metadata ops, as for patchMetadata. The tokens may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
164
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
165
|
+
* @returns {Promise<{count: number}>} How many tokens were updated.
|
|
166
|
+
*/
|
|
167
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
168
|
+
count: number;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Split a token at a Unicode code-point offset. A new token is made for one
|
|
172
|
+
* half and its ID is returned. The original token keeps its ID, spans and
|
|
173
|
+
* vocab-links on the left half, or on the right half with `keep: "right"`.
|
|
174
|
+
* @param {string} tokenId - The token ID
|
|
175
|
+
* @param {number} position - Code-point offset to split at (strictly between begin and end)
|
|
176
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
177
|
+
* @param {{id?: string, keep?: "left"|"right"}} [options] - `id`: the new
|
|
178
|
+
* token's id, a UUIDv7 this client minted. `keep`: the half the original token
|
|
179
|
+
* (its id, spans, vocab-links, comments and metadata) stays on, `"left"` by
|
|
180
|
+
* default. With `"right"` the new token, whose id is answered, is the left
|
|
181
|
+
* half. A relation layer whose relations must stay inside one token
|
|
182
|
+
* of this layer declares a same-ancestor constraint, and the server deletes
|
|
183
|
+
* the relations the split leaves crossing in the same transaction.
|
|
184
|
+
* @returns {Promise<Created>}
|
|
185
|
+
*/
|
|
186
|
+
split: (tokenId: string, position: number, auditMessage?: string, { id, keep }?: {
|
|
187
|
+
id?: string;
|
|
188
|
+
keep?: "left" | "right";
|
|
189
|
+
}) => Promise<Created>;
|
|
190
|
+
/**
|
|
191
|
+
* Merge two tokens. The left token (smaller begin) survives with the combined
|
|
192
|
+
* extent; the right is deleted and its spans/vocab-links are reparented to the left.
|
|
193
|
+
* On partitioning layers the tokens must be adjacent; on non-overlapping layers the
|
|
194
|
+
* merged extent must not engulf a third token.
|
|
195
|
+
* @param {string} tokenId - The anchor token ID
|
|
196
|
+
* @param {string} otherTokenId - The other token to merge in
|
|
197
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
198
|
+
* @returns {Promise<Token>}
|
|
199
|
+
*/
|
|
200
|
+
merge: (tokenId: string, otherTokenId: string, auditMessage?: string) => Promise<Token>;
|
|
201
|
+
/**
|
|
202
|
+
* Shift a token's boundary. On partitioning layers the adjacent token is
|
|
203
|
+
* auto-adjusted to preserve the partition; on non-overlapping layers a shift that
|
|
204
|
+
* would create an overlap is rejected.
|
|
205
|
+
* @param {string} tokenId - The token ID
|
|
206
|
+
* @param {number} [begin] - New start offset, inclusive (Unicode code points)
|
|
207
|
+
* @param {number} [end] - New end offset, exclusive (Unicode code points)
|
|
208
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
209
|
+
* @returns {Promise<Token>}
|
|
210
|
+
*/
|
|
211
|
+
shift: (tokenId: string, begin?: number, end?: number, auditMessage?: string) => Promise<Token>;
|
|
212
|
+
};
|
|
213
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
214
|
+
export function spansApi(client: import("./client.js").PlaidClient): {
|
|
215
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
216
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
217
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Span>;
|
|
218
|
+
/**
|
|
219
|
+
* Get a span by ID.
|
|
220
|
+
* @param {string} spanId - The span ID
|
|
221
|
+
* @returns {Promise<Span>}
|
|
222
|
+
*/
|
|
223
|
+
get: (spanId: string) => Promise<Span>;
|
|
224
|
+
/**
|
|
225
|
+
* Create a new span. A span holds a primary atomic value and optional
|
|
226
|
+
* metadata, and must at all times be associated with one or more tokens.
|
|
227
|
+
* @param {string} spanLayerId - The span layer ID
|
|
228
|
+
* @param {Array} tokens - The tokens
|
|
229
|
+
* @param {any} value - The value
|
|
230
|
+
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
231
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
232
|
+
* @param {object} [opts]
|
|
233
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
234
|
+
* @returns {Promise<Created>}
|
|
235
|
+
*/
|
|
236
|
+
create: (spanLayerId: string, tokens: any[], value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
237
|
+
id?: string;
|
|
238
|
+
}) => Promise<Created>;
|
|
239
|
+
/**
|
|
240
|
+
* Update a span's value.
|
|
241
|
+
* @param {string} spanId - The span ID
|
|
242
|
+
* @param {any} value - The value
|
|
243
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
244
|
+
* @returns {Promise<Span>}
|
|
245
|
+
*/
|
|
246
|
+
update: (spanId: string, value: any, auditMessage?: string) => Promise<Span>;
|
|
247
|
+
/**
|
|
248
|
+
* Delete a span.
|
|
249
|
+
* @param {string} spanId - The span ID
|
|
250
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
251
|
+
* @returns {Promise<void>}
|
|
252
|
+
*/
|
|
253
|
+
delete: (spanId: string, auditMessage?: string) => Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Create multiple spans in a single operation.
|
|
256
|
+
* @param {Array} body - The spans to create, each as its single create takes it
|
|
257
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
258
|
+
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order.
|
|
259
|
+
*/
|
|
260
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
261
|
+
ids: string[];
|
|
262
|
+
}>;
|
|
263
|
+
/**
|
|
264
|
+
* Delete multiple spans in a single operation. Provide an array of IDs.
|
|
265
|
+
* @param {Array} body - The IDs of the spans to delete
|
|
266
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
267
|
+
* @returns {Promise<void>}
|
|
268
|
+
*/
|
|
269
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Update many spans in a single operation: set values and/or patch metadata.
|
|
272
|
+
* @param {Array} body - Objects of the shape `{id, value?, metadata?}`. `value` is set only when the key is present (null sends JSON null); `metadata` is a list of metadata ops, as for patchMetadata. The spans may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
273
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
274
|
+
* @returns {Promise<{count: number}>} How many spans were updated.
|
|
275
|
+
*/
|
|
276
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
277
|
+
count: number;
|
|
278
|
+
}>;
|
|
279
|
+
/**
|
|
280
|
+
* Replace tokens for a span.
|
|
281
|
+
* @param {string} spanId - The span ID
|
|
282
|
+
* @param {Array} tokens - The tokens
|
|
283
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
284
|
+
* @returns {Promise<Span>}
|
|
285
|
+
*/
|
|
286
|
+
setTokens: (spanId: string, tokens: any[], auditMessage?: string) => Promise<Span>;
|
|
287
|
+
};
|
|
288
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
289
|
+
export function relationsApi(client: import("./client.js").PlaidClient): {
|
|
290
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
291
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
292
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").Relation>;
|
|
293
|
+
/**
|
|
294
|
+
* Get a relation by ID.
|
|
295
|
+
* @param {string} relationId - The relation ID
|
|
296
|
+
* @returns {Promise<Relation>}
|
|
297
|
+
*/
|
|
298
|
+
get: (relationId: string) => Promise<Relation>;
|
|
299
|
+
/**
|
|
300
|
+
* Create a new relation. A relation is a directed edge between two spans
|
|
301
|
+
* with a value, useful for expressing phenomena such as syntactic or
|
|
302
|
+
* semantic relations.
|
|
303
|
+
* @param {string} relationLayerId - The relation layer ID
|
|
304
|
+
* @param {string} source - The source span ID
|
|
305
|
+
* @param {string} target - The target span ID
|
|
306
|
+
* @param {any} value - The value
|
|
307
|
+
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
308
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
309
|
+
* @param {object} [opts]
|
|
310
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
311
|
+
* @returns {Promise<Created>}
|
|
312
|
+
*/
|
|
313
|
+
create: (relationLayerId: string, source: string, target: string, value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
314
|
+
id?: string;
|
|
315
|
+
}) => Promise<Created>;
|
|
316
|
+
/**
|
|
317
|
+
* Update a relation's value.
|
|
318
|
+
* @param {string} relationId - The relation ID
|
|
319
|
+
* @param {any} value - The value
|
|
320
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
321
|
+
* @returns {Promise<Relation>}
|
|
322
|
+
*/
|
|
323
|
+
update: (relationId: string, value: any, auditMessage?: string) => Promise<Relation>;
|
|
324
|
+
/**
|
|
325
|
+
* Delete a relation.
|
|
326
|
+
* @param {string} relationId - The relation ID
|
|
327
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
328
|
+
* @returns {Promise<void>}
|
|
329
|
+
*/
|
|
330
|
+
delete: (relationId: string, auditMessage?: string) => Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Create multiple relations in a single operation.
|
|
333
|
+
* @param {Array} body - The relations to create, each as its single create takes it
|
|
334
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
335
|
+
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order.
|
|
336
|
+
*/
|
|
337
|
+
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
338
|
+
ids: string[];
|
|
339
|
+
}>;
|
|
340
|
+
/**
|
|
341
|
+
* Delete multiple relations in a single operation. Provide an array of IDs.
|
|
342
|
+
* @param {Array} body - The IDs of the relations to delete
|
|
343
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
344
|
+
* @returns {Promise<void>}
|
|
345
|
+
*/
|
|
346
|
+
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
347
|
+
/**
|
|
348
|
+
* Update many relations in a single operation: set values and/or patch metadata.
|
|
349
|
+
* @param {Array} body - Objects of the shape `{id, value?, metadata?}`. `value` is set only when the key is present (null sends JSON null); `metadata` is a list of metadata ops, as for patchMetadata. The relations may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
350
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
351
|
+
* @returns {Promise<{count: number}>} How many relations were updated.
|
|
352
|
+
*/
|
|
353
|
+
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
354
|
+
count: number;
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* Update the target span of a relation.
|
|
358
|
+
* @param {string} relationId - The relation ID
|
|
359
|
+
* @param {string} spanId - The span ID
|
|
360
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
361
|
+
* @returns {Promise<Relation>}
|
|
362
|
+
*/
|
|
363
|
+
setTarget: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
364
|
+
/**
|
|
365
|
+
* Update the source span of a relation.
|
|
366
|
+
* @param {string} relationId - The relation ID
|
|
367
|
+
* @param {string} spanId - The span ID
|
|
368
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
369
|
+
* @returns {Promise<Relation>}
|
|
370
|
+
*/
|
|
371
|
+
setSource: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
372
|
+
};
|
|
373
|
+
/** @param {import("./client.js").PlaidClient} client */
|
|
374
|
+
export function vocabLinksApi(client: import("./client.js").PlaidClient): {
|
|
375
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
376
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
377
|
+
patchMetadata: (id: string, body: import("./families.js").MetadataOp[], auditMessage?: string) => Promise<import("./types.js").VocabLink>;
|
|
378
|
+
/**
|
|
379
|
+
* Get a vocab link by ID
|
|
380
|
+
* @param {string} id - The resource ID
|
|
381
|
+
* @returns {Promise<VocabLink>}
|
|
382
|
+
*/
|
|
383
|
+
get: (id: string) => Promise<VocabLink>;
|
|
384
|
+
/**
|
|
385
|
+
* Create a new vocab link between tokens and a vocab item.
|
|
386
|
+
* @param {string} vocabItem - The vocab item to link
|
|
387
|
+
* @param {Array} tokens - The tokens to link
|
|
388
|
+
* @param {any} [metadata] - Metadata for the link. Omit to leave unset; pass null to send JSON null.
|
|
389
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
390
|
+
* @param {object} [opts]
|
|
391
|
+
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
392
|
+
* @returns {Promise<Created>}
|
|
393
|
+
*/
|
|
394
|
+
create: (vocabItem: string, tokens: any[], metadata?: any, auditMessage?: string, { id }?: {
|
|
395
|
+
id?: string;
|
|
396
|
+
}) => Promise<Created>;
|
|
397
|
+
/**
|
|
398
|
+
* Delete a vocab link
|
|
399
|
+
* @param {string} id - The resource ID
|
|
400
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
401
|
+
* @returns {Promise<void>}
|
|
402
|
+
*/
|
|
403
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
404
|
+
/**
|
|
405
|
+
* Create multiple vocab links in a single operation. Entries may
|
|
406
|
+
* reference different vocab items, but all tokens across the call must
|
|
407
|
+
* belong to one document.
|
|
408
|
+
* @param {Array<{vocabItem: string, tokens: string[], metadata?: any}>} body - The vocab links to create
|
|
409
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
410
|
+
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order.
|
|
411
|
+
*/
|
|
412
|
+
bulkCreate: (body: Array<{
|
|
413
|
+
vocabItem: string;
|
|
414
|
+
tokens: string[];
|
|
415
|
+
metadata?: any;
|
|
416
|
+
}>, auditMessage?: string) => Promise<{
|
|
417
|
+
ids: string[];
|
|
418
|
+
}>;
|
|
419
|
+
/**
|
|
420
|
+
* Delete multiple vocab links in a single operation. Provide an array of IDs.
|
|
421
|
+
* @param {string[]} body - The vocab link IDs to delete
|
|
422
|
+
* @param {string} [auditMessage] - Audit message for this write
|
|
423
|
+
* @returns {Promise<void>}
|
|
424
|
+
*/
|
|
425
|
+
bulkDelete: (body: string[], auditMessage?: string) => Promise<void>;
|
|
426
|
+
};
|
|
427
|
+
export type TextEditOp = import("./types.js").TextEditOp;
|
|
428
|
+
export type TextGap = import("./types.js").TextGap;
|
|
429
|
+
export type MetadataOp = import("./types.js").MetadataOp;
|
|
430
|
+
export type LayerConstraint = import("./types.js").LayerConstraint;
|
|
431
|
+
export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
|
|
432
|
+
export type ConstraintViolation = import("./types.js").ConstraintViolation;
|
|
433
|
+
export type Requester = import("./types.js").Requester;
|
|
434
|
+
export type BatchRef = import("./types.js").BatchRef;
|
|
435
|
+
export type ServiceParam = import("./types.js").ServiceParam;
|
|
436
|
+
export type ServiceInfo = import("./types.js").ServiceInfo;
|
|
437
|
+
export type DiscoveredService = import("./types.js").DiscoveredService;
|
|
438
|
+
export type ResponseHelper = import("./types.js").ResponseHelper;
|
|
439
|
+
export type ServiceRegistration = import("./types.js").ServiceRegistration;
|
|
440
|
+
export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
|
|
441
|
+
export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
|
|
442
|
+
export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
|
|
443
|
+
export type OperationKind = import("./types.js").OperationKind;
|
|
444
|
+
export type KeySeed = import("./types.js").KeySeed;
|
|
445
|
+
export type PlaidBatch = import("./types.js").PlaidBatch;
|
|
446
|
+
export type AuditPageOptions = import("./types.js").AuditPageOptions;
|
|
447
|
+
export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
|
|
448
|
+
export type UserDataEntry = import("./types.js").UserDataEntry;
|
|
449
|
+
export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
|
|
450
|
+
export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
|
|
451
|
+
export type ConstraintRepair = import("./types.js").ConstraintRepair;
|
|
452
|
+
export type ValueSetRule = import("./types.js").ValueSetRule;
|
|
453
|
+
export type RefusedValues = import("./types.js").RefusedValues;
|
|
454
|
+
export type CommentableType = import("./types.js").CommentableType;
|
|
455
|
+
export type Comment = import("./types.js").Comment;
|
|
456
|
+
export type Guideline = import("./types.js").Guideline;
|
|
457
|
+
export type ClientEventType = import("./types.js").ClientEventType;
|
|
458
|
+
export type ClientEvent = import("./types.js").ClientEvent;
|
|
459
|
+
export type Invite = import("./types.js").Invite;
|
|
460
|
+
export type ServerLimits = import("./types.js").ServerLimits;
|
|
461
|
+
export type ServerHealth = import("./types.js").ServerHealth;
|
|
462
|
+
export type RateLimitBucket = import("./types.js").RateLimitBucket;
|
|
463
|
+
export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
|
|
464
|
+
export type BackupStatus = import("./types.js").BackupStatus;
|
|
465
|
+
export type ServerReport = import("./types.js").ServerReport;
|
|
466
|
+
export type LiveLog = import("./types.js").LiveLog;
|
|
467
|
+
export type SSEConnection = import("./types.js").SSEConnection;
|
|
468
|
+
export type SSEStats = import("./types.js").SSEStats;
|
|
469
|
+
export type AtomicValue = import("./types.js").AtomicValue;
|
|
470
|
+
export type Created = import("./types.js").Created;
|
|
471
|
+
export type Project = import("./types.js").Project;
|
|
472
|
+
export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
|
|
473
|
+
export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
|
|
474
|
+
export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
|
|
475
|
+
export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
|
|
476
|
+
export type ProjectVocab = import("./types.js").ProjectVocab;
|
|
477
|
+
export type PlaidDocument = import("./types.js").PlaidDocument;
|
|
478
|
+
export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
|
|
479
|
+
export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
|
|
480
|
+
export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
|
|
481
|
+
export type PlaidText = import("./types.js").PlaidText;
|
|
482
|
+
export type TextReshape = import("./types.js").TextReshape;
|
|
483
|
+
export type Token = import("./types.js").Token;
|
|
484
|
+
export type Span = import("./types.js").Span;
|
|
485
|
+
export type Relation = import("./types.js").Relation;
|
|
486
|
+
export type VocabItem = import("./types.js").VocabItem;
|
|
487
|
+
export type VocabLink = import("./types.js").VocabLink;
|
|
488
|
+
export type VocabLayer = import("./types.js").VocabLayer;
|
|
489
|
+
export type TextLayer = import("./types.js").TextLayer;
|
|
490
|
+
export type TokenLayer = import("./types.js").TokenLayer;
|
|
491
|
+
export type SpanLayer = import("./types.js").SpanLayer;
|
|
492
|
+
export type RelationLayer = import("./types.js").RelationLayer;
|
|
493
|
+
export type MetadataRecords = import("./types.js").MetadataRecords;
|
|
494
|
+
export type LayerRecords = import("./types.js").LayerRecords;
|
|
495
|
+
export type User = import("./types.js").User;
|
|
496
|
+
export type ProjectListEntry = import("./types.js").ProjectListEntry;
|
|
497
|
+
export type DocumentListEntry = import("./types.js").DocumentListEntry;
|
|
498
|
+
export type ApiToken = import("./types.js").ApiToken;
|
|
499
|
+
export type AuditUser = import("./types.js").AuditUser;
|
|
500
|
+
export type AuditTarget = import("./types.js").AuditTarget;
|
|
501
|
+
export type AuditOp = import("./types.js").AuditOp;
|
|
502
|
+
export type AuditEntry = import("./types.js").AuditEntry;
|
|
503
|
+
export type LockGrant = import("./types.js").LockGrant;
|
|
504
|
+
export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
|
|
505
|
+
export type RestoreCounts = import("./types.js").RestoreCounts;
|
|
506
|
+
export type OperationGroup = import("./types.js").OperationGroup;
|
|
507
|
+
export type QueryResult = import("./types.js").QueryResult;
|
|
508
|
+
export type Page<T = any> = import("./types.js").Page<T>;
|