@dreaminhex/hexdb 2.2.0 → 2.3.1

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The JavaScript and TypeScript client for [HexDB](https://github.com/dreaminhex/hexdb), a document database with REST, GraphQL and read-only SQL, encryption at rest and replication with automatic failover.
4
4
 
5
- It covers documents (insert, get, replace, patch, delete), queries with filters, sorting and paging, counts, aggregations, upserts, transactions, idempotency keys, the change feed, streams, functions and GraphQL. It retries `429` and `503` answers for reads, and for writes that carry an idempotency key. Runs on Node.js 18+, Deno, Bun and in browsers, with no dependencies.
5
+ It covers documents (insert, get, replace, patch, delete), queries with filters, sorting and paging, counts, aggregations, upserts, detokenizing vault tokens, transactions, idempotency keys, the change feed, streams, functions and GraphQL. It retries `429` and `503` answers for reads, and for writes that carry an idempotency key. Runs on Node.js 18+, Deno, Bun and in browsers, with no dependencies.
6
6
 
7
7
  ```sh
8
8
  npm install @dreaminhex/hexdb
package/dist/index.d.ts CHANGED
@@ -178,6 +178,11 @@ export declare class Tessellation {
178
178
  matched: number;
179
179
  modified: number;
180
180
  }>;
181
+ /**
182
+ * The values behind vault tokens of tokenized fields (up to 1,000; needs the
183
+ * `detokenize` permission; audited). One-way and unknown tokens map to null.
184
+ */
185
+ detokenize(tokens: string[]): Promise<Record<string, string | null>>;
181
186
  }
182
187
  export declare class Stream {
183
188
  private readonly db;
package/dist/index.js CHANGED
@@ -276,6 +276,13 @@ export class Tessellation {
276
276
  updateWhere(filter, update) {
277
277
  return this.db.request("POST", `${this.path}/_update`, { filter, update });
278
278
  }
279
+ /**
280
+ * The values behind vault tokens of tokenized fields (up to 1,000; needs the
281
+ * `detokenize` permission; audited). One-way and unknown tokens map to null.
282
+ */
283
+ async detokenize(tokens) {
284
+ return (await this.db.request("POST", `/tessellations/${enc(this.name)}/detokenize`, { tokens })).values;
285
+ }
279
286
  }
280
287
  export class Stream {
281
288
  db;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreaminhex/hexdb",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Client for HexDB, the hexagonal document database.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dream In Hex",