@aouda/client 0.1.12 → 0.1.14

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.
@@ -421,7 +421,7 @@ var import_node_url = require("url");
421
421
  // package.json
422
422
  var package_default = {
423
423
  name: "@aouda/client",
424
- version: "0.1.12",
424
+ version: "0.1.14",
425
425
  description: "Official TypeScript/JavaScript client library for Aouda",
426
426
  type: "module",
427
427
  main: "./dist/index.cjs",
@@ -1434,7 +1434,9 @@ var BulkLoadCoordinator = class {
1434
1434
  replicationMode: options.replicationMode,
1435
1435
  forceSingleNodeReplicationBypass: options.forceSingleNodeReplicationBypass,
1436
1436
  postLoadMqBehavior: options.postLoadMqBehavior,
1437
- ...options.identityInsert === true ? { identityInsert: true } : {}
1437
+ ...options.identityInsert === true ? { identityInsert: true } : {},
1438
+ ...options.applyTransforms === true ? { applyTransforms: true } : {},
1439
+ ...options.preTransformed === true ? { preTransformed: true } : {}
1438
1440
  }
1439
1441
  };
1440
1442
  const beginResp = await this.transport.post(
@@ -1527,7 +1529,11 @@ var ERROR_CODE_MAP = {
1527
1529
  NAMED_QUERY_BATCH_MUTATION: AoudaValidationError,
1528
1530
  NAMED_QUERY_BIND_FAILED: AoudaValidationError,
1529
1531
  NAMED_QUERY_PARAM_REQUIRED: AoudaValidationError,
1530
- NAMED_MUTATION_BIND_FAILED: AoudaValidationError
1532
+ NAMED_MUTATION_BIND_FAILED: AoudaValidationError,
1533
+ AUTH_IDENTITY_INVALID: AoudaValidationError,
1534
+ AUTH_IDENTITY_NOT_FOUND: AoudaValidationError,
1535
+ BULK_LOAD_TRANSFORM_INTENT_REQUIRED: AoudaValidationError,
1536
+ BULK_LOAD_TRANSFORM_INTENT_CONFLICT: AoudaValidationError
1531
1537
  };
1532
1538
  function createComposedAbortController(...signals) {
1533
1539
  const controller = new AbortController();
@@ -2498,6 +2504,9 @@ var TableSubscription = class {
2498
2504
  if (this._identity.args !== void 0) {
2499
2505
  message.args = this._identity.args;
2500
2506
  }
2507
+ if (this._identity.orderByIndex !== void 0) {
2508
+ message.orderByIndex = this._identity.orderByIndex;
2509
+ }
2501
2510
  } else {
2502
2511
  message.target = this._identity.target;
2503
2512
  if (this._identity.filter !== void 0) {
@@ -2546,12 +2555,16 @@ var TableSubscription = class {
2546
2555
  }
2547
2556
  const rows = this._pendingSnapshotRows;
2548
2557
  this._pendingSnapshotRows = [];
2549
- this._onSnapshot?.(rows, message.version);
2550
- this._queue.push({
2558
+ this._onSnapshot?.(rows, message.version, message.total_matches);
2559
+ const snapshot = {
2551
2560
  type: "snapshot",
2552
2561
  rows,
2553
2562
  version: message.version
2554
- });
2563
+ };
2564
+ if (message.total_matches !== void 0) {
2565
+ snapshot.totalMatches = message.total_matches;
2566
+ }
2567
+ this._queue.push(snapshot);
2555
2568
  }
2556
2569
  async _handleGap(message) {
2557
2570
  this._pendingSnapshotRows = [];
@@ -5107,9 +5120,15 @@ var NamedQueriesApi = class {
5107
5120
  }
5108
5121
  const prefix = databasePath2(this.database);
5109
5122
  const path4 = `${prefix}/named-queries/${encodeURIComponent(hash)}/query?format=columnar`;
5123
+ const body = {
5124
+ args: args ?? {}
5125
+ };
5126
+ if (options?.orderByIndex !== void 0) {
5127
+ body.orderByIndex = options.orderByIndex;
5128
+ }
5110
5129
  const response = await this.transport.post(
5111
5130
  path4,
5112
- { args: args ?? {} },
5131
+ body,
5113
5132
  { signal: options?.signal }
5114
5133
  );
5115
5134
  const rows = columnarToRows(response);
@@ -5117,7 +5136,8 @@ var NamedQueriesApi = class {
5117
5136
  return {
5118
5137
  rows,
5119
5138
  stats: response.stats,
5120
- warnings: response.warnings
5139
+ warnings: response.warnings,
5140
+ totalMatches: response.totalMatches
5121
5141
  };
5122
5142
  }
5123
5143
  async batch(items, options) {
@@ -5156,12 +5176,14 @@ var NamedQueriesApi = class {
5156
5176
  data: slot.data ?? [],
5157
5177
  rowCount: slot.rowCount ?? 0,
5158
5178
  stats: slot.stats ?? emptyStats(),
5159
- warnings: slot.warnings
5179
+ warnings: slot.warnings,
5180
+ totalMatches: slot.totalMatches
5160
5181
  };
5161
5182
  const result = {
5162
5183
  rows: columnarToRows(columnar),
5163
5184
  stats: columnar.stats,
5164
- warnings: slot.warnings
5185
+ warnings: slot.warnings,
5186
+ totalMatches: slot.totalMatches
5165
5187
  };
5166
5188
  raiseDeprecationWarnings(this.onWarning, slot.warnings);
5167
5189
  return { isError: false, result };
@@ -5173,7 +5195,7 @@ var NamedQueriesApi = class {
5173
5195
  }
5174
5196
  const subscription = new TableSubscription(
5175
5197
  this.getStreamingTransport(),
5176
- { kind: "named", hash, args },
5198
+ { kind: "named", hash, args, orderByIndex: options.orderByIndex },
5177
5199
  {
5178
5200
  onSnapshot: options.onSnapshot,
5179
5201
  onChange: options.onChange,
@@ -5230,6 +5252,20 @@ var NamedMutationsApi = class {
5230
5252
  }
5231
5253
  };
5232
5254
 
5255
+ // src/policy.ts
5256
+ var PolicyApi = class {
5257
+ constructor(transport, database) {
5258
+ this.transport = transport;
5259
+ this.database = database;
5260
+ }
5261
+ inspect(body, options) {
5262
+ const path4 = `${databasePath2(this.database)}/policy/inspect`;
5263
+ return this.transport.post(path4, body, {
5264
+ signal: options?.signal
5265
+ });
5266
+ }
5267
+ };
5268
+
5233
5269
  // src/streaming/websocket-transport.ts
5234
5270
  var import_msgpack = require("@msgpack/msgpack");
5235
5271
  var DEFAULT_PING_INTERVAL_MS = 2e4;
@@ -6018,6 +6054,7 @@ var AoudaClient = class {
6018
6054
  this.database,
6019
6055
  onNamedArtifactWarning
6020
6056
  );
6057
+ this._policy = new PolicyApi(this.transport, this.database);
6021
6058
  }
6022
6059
  /**
6023
6060
  * Connects to the Aouda server.
@@ -6172,6 +6209,12 @@ var AoudaClient = class {
6172
6209
  get namedMutations() {
6173
6210
  return this._namedMutations;
6174
6211
  }
6212
+ /**
6213
+ * Policy inspect (`POST …/policy/inspect`). Admin on the data DB.
6214
+ */
6215
+ get policy() {
6216
+ return this._policy;
6217
+ }
6175
6218
  /**
6176
6219
  * Access auth operations (signUp, signIn, signOut, refresh, me, changePassword).
6177
6220
  * @returns The auth API.