@larc-iu/plaid-client 0.2.0-alpha.12 → 0.2.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +39 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larc-iu/plaid-client",
3
- "version": "0.2.0-alpha.12",
3
+ "version": "0.2.0-alpha.13",
4
4
  "description": "JavaScript client for the Plaid annotation API",
5
5
  "type": "module",
6
6
  "repository": {
package/src/index.js CHANGED
@@ -475,6 +475,16 @@ class PlaidClient {
475
475
  auditMessage,
476
476
  body,
477
477
  }),
478
+ /**
479
+ * Update many relations in a single operation: set values and/or patch metadata.
480
+ * @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 patch, a null value deleting that key. The relations may lie in several documents of one project; every document touched has its version bumped. An unknown id refuses the whole update.
481
+ * @returns {Promise<{count: number}>} How many relations were updated.
482
+ */
483
+ bulkUpdate: (body, auditMessage) =>
484
+ this._request("PATCH", "/api/v1/relations/bulk", {
485
+ auditMessage,
486
+ body,
487
+ }),
478
488
  };
479
489
 
480
490
  this.spanLayers = {
@@ -625,6 +635,16 @@ class PlaidClient {
625
635
  */
626
636
  bulkDelete: (body, auditMessage) =>
627
637
  this._request("DELETE", "/api/v1/spans/bulk", { auditMessage, body }),
638
+ /**
639
+ * Update many spans in a single operation: set values and/or patch metadata.
640
+ * @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 patch, a null value deleting that key. The spans may lie in several documents of one project; every document touched has its version bumped. An unknown id refuses the whole update.
641
+ * @returns {Promise<{count: number}>} How many spans were updated.
642
+ */
643
+ bulkUpdate: (body, auditMessage) =>
644
+ this._request("PATCH", "/api/v1/spans/bulk", {
645
+ auditMessage,
646
+ body,
647
+ }),
628
648
  /**
629
649
  * Replace all metadata for a span.
630
650
  * @param {string} spanId - The span ID
@@ -1010,14 +1030,21 @@ class PlaidClient {
1010
1030
  /**
1011
1031
  * List a user's private data entries ({key, updatedAt}, plus value when
1012
1032
  * includeValues). Owner or admin only.
1033
+ *
1034
+ * Narrow with `prefix` (the literal head of a key) and/or `pattern`, a
1035
+ * GLOB over the whole key (`*` any run, `?` one character) — the way to
1036
+ * ask for a key convention identified by a segment in the middle, e.g.
1037
+ * `igt:assistant:*:meta:*` for every conversation's sidebar entry across
1038
+ * every project without dragging down the transcripts beside them.
1013
1039
  * @param {string} userId
1014
1040
  * @param {object} [opts]
1015
1041
  * @param {string} [opts.prefix] - Only keys starting with this prefix
1042
+ * @param {string} [opts.pattern] - Only keys matching this GLOB
1016
1043
  * @param {boolean} [opts.includeValues] - Also return each entry's value
1017
1044
  */
1018
- list: (userId, { prefix, includeValues } = {}) =>
1045
+ list: (userId, { prefix, pattern, includeValues } = {}) =>
1019
1046
  this._request("GET", `/api/v1/users/${userId}/data`, {
1020
- queryParams: { prefix, "include-values": includeValues },
1047
+ queryParams: { prefix, pattern, "include-values": includeValues },
1021
1048
  }),
1022
1049
  /**
1023
1050
  * Read one private data entry ({key, updatedAt, value}); 404 if absent.
@@ -2370,6 +2397,16 @@ class PlaidClient {
2370
2397
  */
2371
2398
  bulkDelete: (body, auditMessage) =>
2372
2399
  this._request("DELETE", "/api/v1/tokens/bulk", { auditMessage, body }),
2400
+ /**
2401
+ * Update many tokens in a single operation: patch metadata.
2402
+ * @param {Array} body - Objects of the shape `{id, metadata}`. `metadata` is a patch, a null value deleting that key. The tokens may lie in several documents of one project; every document touched has its version bumped. An unknown id refuses the whole update.
2403
+ * @returns {Promise<{count: number}>} How many tokens were updated.
2404
+ */
2405
+ bulkUpdate: (body, auditMessage) =>
2406
+ this._request("PATCH", "/api/v1/tokens/bulk", {
2407
+ auditMessage,
2408
+ body,
2409
+ }),
2373
2410
  /**
2374
2411
  * Split a token at a Unicode code-point offset. The original token becomes the
2375
2412
  * left half (keeps its ID, spans, vocab-links); the new right token's ID is returned.