@layers/amba-core 4.0.7 → 4.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layers/amba-core",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "description": "amba SDK runtime — shared client core used by @layers/amba-web, @layers/amba-node, @layers/amba-react-native. Internal dependency; install one of those packages instead.",
5
5
  "type": "module",
6
6
  "main": "./pkg/amba_core.js",
@@ -26,26 +26,26 @@ export class AmbaCoreWasm {
26
26
  * `filter_json` is the JSON-encoded [`Filter`] tree or `null`/None.
27
27
  * Returns the bare count as a JS `number` value.
28
28
  */
29
- collectionsCount(collection: string, filter_json?: string | null): Promise<any>;
30
- collectionsDelete(collection: string, id: string): Promise<any>;
29
+ collectionsCount(collection: string, filter_json?: string | null, group_context?: string | null): Promise<any>;
30
+ collectionsDelete(collection: string, id: string, group_context?: string | null): Promise<any>;
31
31
  /**
32
32
  * Bulk soft-delete rows matching `filter_json` (a JSON-encoded
33
33
  * [`Filter`](crate::collections::Filter) tree). Returns
34
34
  * `{data: {deleted: N}}`.
35
35
  */
36
- collectionsDeleteWhere(collection: string, filter_json: string): Promise<any>;
36
+ collectionsDeleteWhere(collection: string, filter_json: string, group_context?: string | null): Promise<any>;
37
37
  collectionsFind(collection: string, options_json: string): Promise<any>;
38
38
  /**
39
39
  * Vector-search. `options_json` matches `NearestOptions`
40
40
  * (`{vector_field, query_vector, k, filter?}`).
41
41
  */
42
- collectionsFindNearest(collection: string, options_json: string): Promise<any>;
43
- collectionsFindOne(collection: string, id: string): Promise<any>;
44
- collectionsInsert(collection: string, row_json: string): Promise<any>;
42
+ collectionsFindNearest(collection: string, options_json: string, group_context?: string | null): Promise<any>;
43
+ collectionsFindOne(collection: string, id: string, group_context?: string | null): Promise<any>;
44
+ collectionsInsert(collection: string, row_json: string, group_context?: string | null): Promise<any>;
45
45
  /**
46
46
  * Restore a previously soft-deleted row by id. Returns the restored row.
47
47
  */
48
- collectionsRestore(collection: string, id: string): Promise<any>;
48
+ collectionsRestore(collection: string, id: string, group_context?: string | null): Promise<any>;
49
49
  /**
50
50
  * Run an ordered batch of writes as ONE atomic transaction.
51
51
  * `operations_json` is a JSON-encoded array of wire-shaped op objects
@@ -53,15 +53,15 @@ export class AmbaCoreWasm {
53
53
  * conflict_target?}]`). Resolves to the per-op results array; rejects with
54
54
  * the server's structured error (naming the failing op index) on rollback.
55
55
  */
56
- collectionsTransaction(operations_json: string): Promise<any>;
57
- collectionsUpdate(collection: string, id: string, set_json: string): Promise<any>;
56
+ collectionsTransaction(operations_json: string, group_context?: string | null): Promise<any>;
57
+ collectionsUpdate(collection: string, id: string, set_json: string, group_context?: string | null): Promise<any>;
58
58
  /**
59
59
  * Upsert a row. `options_json` is `{on_conflict, conflict_target}` —
60
60
  * `on_conflict` is `"ignore"` or `"update"`, `conflict_target` is the
61
61
  * array of unique-index columns to arbitrate on. Returns the resolved
62
62
  * row.
63
63
  */
64
- collectionsUpsert(collection: string, row_json: string, options_json: string): Promise<any>;
64
+ collectionsUpsert(collection: string, row_json: string, options_json: string, group_context?: string | null): Promise<any>;
65
65
  configFetch(): Promise<any>;
66
66
  contentCreateItem(channel: string, item_json: string): Promise<any>;
67
67
  contentGetItem(id: string): Promise<any>;
@@ -131,6 +131,14 @@ export class AmbaCoreWasm {
131
131
  groupsJoin(id: string): Promise<any>;
132
132
  groupsLeave(id: string): Promise<any>;
133
133
  groupsUpdate(id: string, patch_json: string): Promise<any>;
134
+ /**
135
+ * Hydrate a browser-persisted identity into the live Rust core.
136
+ *
137
+ * This is intentionally a synchronous init-time bridge: the web wrapper
138
+ * reads its project-namespaced localStorage snapshot, initializes a fresh
139
+ * core, then calls this before publishing the configured SDK instance.
140
+ */
141
+ hydrateIdentity(identity_json: string): void;
134
142
  /**
135
143
  * Initialize the SDK.
136
144
  *
@@ -298,17 +306,17 @@ export interface InitOutput {
298
306
  readonly ambacorewasm_challengesGet: (a: number, b: number, c: number) => number;
299
307
  readonly ambacorewasm_challengesGetActive: (a: number) => number;
300
308
  readonly ambacorewasm_challengesGetProgress: (a: number, b: number, c: number) => number;
301
- readonly ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number) => number;
302
- readonly ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number) => number;
303
- readonly ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number) => number;
309
+ readonly ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
310
+ readonly ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
311
+ readonly ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
304
312
  readonly ambacorewasm_collectionsFind: (a: number, b: number, c: number, d: number, e: number) => number;
305
- readonly ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number) => number;
306
- readonly ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number) => number;
307
- readonly ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number) => number;
308
- readonly ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number) => number;
309
- readonly ambacorewasm_collectionsTransaction: (a: number, b: number, c: number) => number;
310
- readonly ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
311
- readonly ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
313
+ readonly ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
314
+ readonly ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
315
+ readonly ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
316
+ readonly ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
317
+ readonly ambacorewasm_collectionsTransaction: (a: number, b: number, c: number, d: number, e: number) => number;
318
+ readonly ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
319
+ readonly ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
312
320
  readonly ambacorewasm_configFetch: (a: number) => number;
313
321
  readonly ambacorewasm_contentCreateItem: (a: number, b: number, c: number, d: number, e: number) => number;
314
322
  readonly ambacorewasm_contentGetItem: (a: number, b: number, c: number) => number;
@@ -346,6 +354,7 @@ export interface InitOutput {
346
354
  readonly ambacorewasm_groupsJoin: (a: number, b: number, c: number) => number;
347
355
  readonly ambacorewasm_groupsLeave: (a: number, b: number, c: number) => number;
348
356
  readonly ambacorewasm_groupsUpdate: (a: number, b: number, c: number, d: number, e: number) => number;
357
+ readonly ambacorewasm_hydrateIdentity: (a: number, b: number, c: number, d: number) => void;
349
358
  readonly ambacorewasm_init: (a: number, b: number, c: number, d: number) => void;
350
359
  readonly ambacorewasm_inventoryConsume: (a: number, b: number, c: number) => number;
351
360
  readonly ambacorewasm_inventoryGetItem: (a: number, b: number, c: number) => number;
@@ -429,9 +438,9 @@ export interface InitOutput {
429
438
  readonly ambacorewasm_xpClaim: (a: number, b: number, c: number) => number;
430
439
  readonly ambacorewasm_xpGetBalance: (a: number) => number;
431
440
  readonly ambacorewasm_xpGetHistory: (a: number, b: number) => number;
432
- readonly __wasm_bindgen_func_elem_3247: (a: number, b: number, c: number, d: number) => void;
433
- readonly __wasm_bindgen_func_elem_3228: (a: number, b: number, c: number, d: number) => void;
434
- readonly __wasm_bindgen_func_elem_3247_144: (a: number, b: number, c: number, d: number) => void;
441
+ readonly __wasm_bindgen_func_elem_3293: (a: number, b: number, c: number, d: number) => void;
442
+ readonly __wasm_bindgen_func_elem_3291: (a: number, b: number, c: number, d: number) => void;
443
+ readonly __wasm_bindgen_func_elem_3293_145: (a: number, b: number, c: number, d: number) => void;
435
444
  readonly __wbindgen_export: (a: number, b: number) => number;
436
445
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
437
446
  readonly __wbindgen_export3: (a: number) => void;
package/pkg/amba_core.js CHANGED
@@ -144,27 +144,33 @@ export class AmbaCoreWasm {
144
144
  * Returns the bare count as a JS `number` value.
145
145
  * @param {string} collection
146
146
  * @param {string | null} [filter_json]
147
+ * @param {string | null} [group_context]
147
148
  * @returns {Promise<any>}
148
149
  */
149
- collectionsCount(collection, filter_json) {
150
+ collectionsCount(collection, filter_json, group_context) {
150
151
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
151
152
  const len0 = WASM_VECTOR_LEN;
152
153
  var ptr1 = isLikeNone(filter_json) ? 0 : passStringToWasm0(filter_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
153
154
  var len1 = WASM_VECTOR_LEN;
154
- const ret = wasm.ambacorewasm_collectionsCount(this.__wbg_ptr, ptr0, len0, ptr1, len1);
155
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
156
+ var len2 = WASM_VECTOR_LEN;
157
+ const ret = wasm.ambacorewasm_collectionsCount(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
155
158
  return takeObject(ret);
156
159
  }
157
160
  /**
158
161
  * @param {string} collection
159
162
  * @param {string} id
163
+ * @param {string | null} [group_context]
160
164
  * @returns {Promise<any>}
161
165
  */
162
- collectionsDelete(collection, id) {
166
+ collectionsDelete(collection, id, group_context) {
163
167
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
164
168
  const len0 = WASM_VECTOR_LEN;
165
169
  const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
166
170
  const len1 = WASM_VECTOR_LEN;
167
- const ret = wasm.ambacorewasm_collectionsDelete(this.__wbg_ptr, ptr0, len0, ptr1, len1);
171
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
172
+ var len2 = WASM_VECTOR_LEN;
173
+ const ret = wasm.ambacorewasm_collectionsDelete(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
168
174
  return takeObject(ret);
169
175
  }
170
176
  /**
@@ -173,14 +179,17 @@ export class AmbaCoreWasm {
173
179
  * `{data: {deleted: N}}`.
174
180
  * @param {string} collection
175
181
  * @param {string} filter_json
182
+ * @param {string | null} [group_context]
176
183
  * @returns {Promise<any>}
177
184
  */
178
- collectionsDeleteWhere(collection, filter_json) {
185
+ collectionsDeleteWhere(collection, filter_json, group_context) {
179
186
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
180
187
  const len0 = WASM_VECTOR_LEN;
181
188
  const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
182
189
  const len1 = WASM_VECTOR_LEN;
183
- const ret = wasm.ambacorewasm_collectionsDeleteWhere(this.__wbg_ptr, ptr0, len0, ptr1, len1);
190
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
191
+ var len2 = WASM_VECTOR_LEN;
192
+ const ret = wasm.ambacorewasm_collectionsDeleteWhere(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
184
193
  return takeObject(ret);
185
194
  }
186
195
  /**
@@ -201,54 +210,66 @@ export class AmbaCoreWasm {
201
210
  * (`{vector_field, query_vector, k, filter?}`).
202
211
  * @param {string} collection
203
212
  * @param {string} options_json
213
+ * @param {string | null} [group_context]
204
214
  * @returns {Promise<any>}
205
215
  */
206
- collectionsFindNearest(collection, options_json) {
216
+ collectionsFindNearest(collection, options_json, group_context) {
207
217
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
208
218
  const len0 = WASM_VECTOR_LEN;
209
219
  const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
210
220
  const len1 = WASM_VECTOR_LEN;
211
- const ret = wasm.ambacorewasm_collectionsFindNearest(this.__wbg_ptr, ptr0, len0, ptr1, len1);
221
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
222
+ var len2 = WASM_VECTOR_LEN;
223
+ const ret = wasm.ambacorewasm_collectionsFindNearest(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
212
224
  return takeObject(ret);
213
225
  }
214
226
  /**
215
227
  * @param {string} collection
216
228
  * @param {string} id
229
+ * @param {string | null} [group_context]
217
230
  * @returns {Promise<any>}
218
231
  */
219
- collectionsFindOne(collection, id) {
232
+ collectionsFindOne(collection, id, group_context) {
220
233
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
221
234
  const len0 = WASM_VECTOR_LEN;
222
235
  const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
223
236
  const len1 = WASM_VECTOR_LEN;
224
- const ret = wasm.ambacorewasm_collectionsFindOne(this.__wbg_ptr, ptr0, len0, ptr1, len1);
237
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
238
+ var len2 = WASM_VECTOR_LEN;
239
+ const ret = wasm.ambacorewasm_collectionsFindOne(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
225
240
  return takeObject(ret);
226
241
  }
227
242
  /**
228
243
  * @param {string} collection
229
244
  * @param {string} row_json
245
+ * @param {string | null} [group_context]
230
246
  * @returns {Promise<any>}
231
247
  */
232
- collectionsInsert(collection, row_json) {
248
+ collectionsInsert(collection, row_json, group_context) {
233
249
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
234
250
  const len0 = WASM_VECTOR_LEN;
235
251
  const ptr1 = passStringToWasm0(row_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
236
252
  const len1 = WASM_VECTOR_LEN;
237
- const ret = wasm.ambacorewasm_collectionsInsert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
253
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
254
+ var len2 = WASM_VECTOR_LEN;
255
+ const ret = wasm.ambacorewasm_collectionsInsert(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
238
256
  return takeObject(ret);
239
257
  }
240
258
  /**
241
259
  * Restore a previously soft-deleted row by id. Returns the restored row.
242
260
  * @param {string} collection
243
261
  * @param {string} id
262
+ * @param {string | null} [group_context]
244
263
  * @returns {Promise<any>}
245
264
  */
246
- collectionsRestore(collection, id) {
265
+ collectionsRestore(collection, id, group_context) {
247
266
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
248
267
  const len0 = WASM_VECTOR_LEN;
249
268
  const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
250
269
  const len1 = WASM_VECTOR_LEN;
251
- const ret = wasm.ambacorewasm_collectionsRestore(this.__wbg_ptr, ptr0, len0, ptr1, len1);
270
+ var ptr2 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
+ var len2 = WASM_VECTOR_LEN;
272
+ const ret = wasm.ambacorewasm_collectionsRestore(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
252
273
  return takeObject(ret);
253
274
  }
254
275
  /**
@@ -258,28 +279,34 @@ export class AmbaCoreWasm {
258
279
  * conflict_target?}]`). Resolves to the per-op results array; rejects with
259
280
  * the server's structured error (naming the failing op index) on rollback.
260
281
  * @param {string} operations_json
282
+ * @param {string | null} [group_context]
261
283
  * @returns {Promise<any>}
262
284
  */
263
- collectionsTransaction(operations_json) {
285
+ collectionsTransaction(operations_json, group_context) {
264
286
  const ptr0 = passStringToWasm0(operations_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
265
287
  const len0 = WASM_VECTOR_LEN;
266
- const ret = wasm.ambacorewasm_collectionsTransaction(this.__wbg_ptr, ptr0, len0);
288
+ var ptr1 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
289
+ var len1 = WASM_VECTOR_LEN;
290
+ const ret = wasm.ambacorewasm_collectionsTransaction(this.__wbg_ptr, ptr0, len0, ptr1, len1);
267
291
  return takeObject(ret);
268
292
  }
269
293
  /**
270
294
  * @param {string} collection
271
295
  * @param {string} id
272
296
  * @param {string} set_json
297
+ * @param {string | null} [group_context]
273
298
  * @returns {Promise<any>}
274
299
  */
275
- collectionsUpdate(collection, id, set_json) {
300
+ collectionsUpdate(collection, id, set_json, group_context) {
276
301
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
277
302
  const len0 = WASM_VECTOR_LEN;
278
303
  const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
279
304
  const len1 = WASM_VECTOR_LEN;
280
305
  const ptr2 = passStringToWasm0(set_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
281
306
  const len2 = WASM_VECTOR_LEN;
282
- const ret = wasm.ambacorewasm_collectionsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
307
+ var ptr3 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
308
+ var len3 = WASM_VECTOR_LEN;
309
+ const ret = wasm.ambacorewasm_collectionsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
283
310
  return takeObject(ret);
284
311
  }
285
312
  /**
@@ -290,16 +317,19 @@ export class AmbaCoreWasm {
290
317
  * @param {string} collection
291
318
  * @param {string} row_json
292
319
  * @param {string} options_json
320
+ * @param {string | null} [group_context]
293
321
  * @returns {Promise<any>}
294
322
  */
295
- collectionsUpsert(collection, row_json, options_json) {
323
+ collectionsUpsert(collection, row_json, options_json, group_context) {
296
324
  const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
297
325
  const len0 = WASM_VECTOR_LEN;
298
326
  const ptr1 = passStringToWasm0(row_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
299
327
  const len1 = WASM_VECTOR_LEN;
300
328
  const ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
301
329
  const len2 = WASM_VECTOR_LEN;
302
- const ret = wasm.ambacorewasm_collectionsUpsert(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
330
+ var ptr3 = isLikeNone(group_context) ? 0 : passStringToWasm0(group_context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
+ var len3 = WASM_VECTOR_LEN;
332
+ const ret = wasm.ambacorewasm_collectionsUpsert(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
303
333
  return takeObject(ret);
304
334
  }
305
335
  /**
@@ -690,6 +720,29 @@ export class AmbaCoreWasm {
690
720
  const ret = wasm.ambacorewasm_groupsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
691
721
  return takeObject(ret);
692
722
  }
723
+ /**
724
+ * Hydrate a browser-persisted identity into the live Rust core.
725
+ *
726
+ * This is intentionally a synchronous init-time bridge: the web wrapper
727
+ * reads its project-namespaced localStorage snapshot, initializes a fresh
728
+ * core, then calls this before publishing the configured SDK instance.
729
+ * @param {string} identity_json
730
+ */
731
+ hydrateIdentity(identity_json) {
732
+ try {
733
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
734
+ const ptr0 = passStringToWasm0(identity_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
735
+ const len0 = WASM_VECTOR_LEN;
736
+ wasm.ambacorewasm_hydrateIdentity(retptr, this.__wbg_ptr, ptr0, len0);
737
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
738
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
739
+ if (r1) {
740
+ throw takeObject(r0);
741
+ }
742
+ } finally {
743
+ wasm.__wbindgen_add_to_stack_pointer(16);
744
+ }
745
+ }
693
746
  /**
694
747
  * Initialize the SDK.
695
748
  *
@@ -1689,7 +1742,7 @@ function __wbg_get_imports() {
1689
1742
  const a = state0.a;
1690
1743
  state0.a = 0;
1691
1744
  try {
1692
- return __wasm_bindgen_func_elem_3247_144(a, state0.b, arg0, arg1);
1745
+ return __wasm_bindgen_func_elem_3293_145(a, state0.b, arg0, arg1);
1693
1746
  } finally {
1694
1747
  state0.a = a;
1695
1748
  }
@@ -1761,12 +1814,12 @@ function __wbg_get_imports() {
1761
1814
  },
1762
1815
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1763
1816
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 829, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1764
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3247);
1817
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3293);
1765
1818
  return addHeapObject(ret);
1766
1819
  },
1767
1820
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1768
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 818, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1769
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3228);
1821
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 827, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1822
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3291);
1770
1823
  return addHeapObject(ret);
1771
1824
  },
1772
1825
  __wbindgen_cast_0000000000000003: function(arg0) {
@@ -1803,14 +1856,14 @@ function __wbg_get_imports() {
1803
1856
  };
1804
1857
  }
1805
1858
 
1806
- function __wasm_bindgen_func_elem_3247(arg0, arg1, arg2, arg3) {
1807
- wasm.__wasm_bindgen_func_elem_3247(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1859
+ function __wasm_bindgen_func_elem_3293(arg0, arg1, arg2, arg3) {
1860
+ wasm.__wasm_bindgen_func_elem_3293(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1808
1861
  }
1809
1862
 
1810
- function __wasm_bindgen_func_elem_3228(arg0, arg1, arg2) {
1863
+ function __wasm_bindgen_func_elem_3291(arg0, arg1, arg2) {
1811
1864
  try {
1812
1865
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1813
- wasm.__wasm_bindgen_func_elem_3228(retptr, arg0, arg1, addHeapObject(arg2));
1866
+ wasm.__wasm_bindgen_func_elem_3291(retptr, arg0, arg1, addHeapObject(arg2));
1814
1867
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1815
1868
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1816
1869
  if (r1) {
@@ -1821,8 +1874,8 @@ function __wasm_bindgen_func_elem_3228(arg0, arg1, arg2) {
1821
1874
  }
1822
1875
  }
1823
1876
 
1824
- function __wasm_bindgen_func_elem_3247_144(arg0, arg1, arg2, arg3) {
1825
- wasm.__wasm_bindgen_func_elem_3247_144(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1877
+ function __wasm_bindgen_func_elem_3293_145(arg0, arg1, arg2, arg3) {
1878
+ wasm.__wasm_bindgen_func_elem_3293_145(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1826
1879
  }
1827
1880
 
1828
1881
  const AmbaCoreWasmFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -13,17 +13,17 @@ export const ambacorewasm_challengesClaim: (a: number, b: number, c: number) =>
13
13
  export const ambacorewasm_challengesGet: (a: number, b: number, c: number) => number;
14
14
  export const ambacorewasm_challengesGetActive: (a: number) => number;
15
15
  export const ambacorewasm_challengesGetProgress: (a: number, b: number, c: number) => number;
16
- export const ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number) => number;
17
- export const ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number) => number;
18
- export const ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number) => number;
16
+ export const ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
17
+ export const ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
18
+ export const ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
19
19
  export const ambacorewasm_collectionsFind: (a: number, b: number, c: number, d: number, e: number) => number;
20
- export const ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number) => number;
21
- export const ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number) => number;
22
- export const ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number) => number;
23
- export const ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number) => number;
24
- export const ambacorewasm_collectionsTransaction: (a: number, b: number, c: number) => number;
25
- export const ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
26
- export const ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
20
+ export const ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
21
+ export const ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
22
+ export const ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
23
+ export const ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
24
+ export const ambacorewasm_collectionsTransaction: (a: number, b: number, c: number, d: number, e: number) => number;
25
+ export const ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
26
+ export const ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
27
27
  export const ambacorewasm_configFetch: (a: number) => number;
28
28
  export const ambacorewasm_contentCreateItem: (a: number, b: number, c: number, d: number, e: number) => number;
29
29
  export const ambacorewasm_contentGetItem: (a: number, b: number, c: number) => number;
@@ -61,6 +61,7 @@ export const ambacorewasm_groupsInvite: (a: number, b: number, c: number, d: num
61
61
  export const ambacorewasm_groupsJoin: (a: number, b: number, c: number) => number;
62
62
  export const ambacorewasm_groupsLeave: (a: number, b: number, c: number) => number;
63
63
  export const ambacorewasm_groupsUpdate: (a: number, b: number, c: number, d: number, e: number) => number;
64
+ export const ambacorewasm_hydrateIdentity: (a: number, b: number, c: number, d: number) => void;
64
65
  export const ambacorewasm_init: (a: number, b: number, c: number, d: number) => void;
65
66
  export const ambacorewasm_inventoryConsume: (a: number, b: number, c: number) => number;
66
67
  export const ambacorewasm_inventoryGetItem: (a: number, b: number, c: number) => number;
@@ -144,9 +145,9 @@ export const ambacorewasm_verifySmsOtp: (a: number, b: number, c: number, d: num
144
145
  export const ambacorewasm_xpClaim: (a: number, b: number, c: number) => number;
145
146
  export const ambacorewasm_xpGetBalance: (a: number) => number;
146
147
  export const ambacorewasm_xpGetHistory: (a: number, b: number) => number;
147
- export const __wasm_bindgen_func_elem_3247: (a: number, b: number, c: number, d: number) => void;
148
- export const __wasm_bindgen_func_elem_3228: (a: number, b: number, c: number, d: number) => void;
149
- export const __wasm_bindgen_func_elem_3247_144: (a: number, b: number, c: number, d: number) => void;
148
+ export const __wasm_bindgen_func_elem_3293: (a: number, b: number, c: number, d: number) => void;
149
+ export const __wasm_bindgen_func_elem_3291: (a: number, b: number, c: number, d: number) => void;
150
+ export const __wasm_bindgen_func_elem_3293_145: (a: number, b: number, c: number, d: number) => void;
150
151
  export const __wbindgen_export: (a: number, b: number) => number;
151
152
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
152
153
  export const __wbindgen_export3: (a: number) => void;
@@ -26,26 +26,26 @@ export class AmbaCoreWasm {
26
26
  * `filter_json` is the JSON-encoded [`Filter`] tree or `null`/None.
27
27
  * Returns the bare count as a JS `number` value.
28
28
  */
29
- collectionsCount(collection: string, filter_json?: string | null): Promise<any>;
30
- collectionsDelete(collection: string, id: string): Promise<any>;
29
+ collectionsCount(collection: string, filter_json?: string | null, group_context?: string | null): Promise<any>;
30
+ collectionsDelete(collection: string, id: string, group_context?: string | null): Promise<any>;
31
31
  /**
32
32
  * Bulk soft-delete rows matching `filter_json` (a JSON-encoded
33
33
  * [`Filter`](crate::collections::Filter) tree). Returns
34
34
  * `{data: {deleted: N}}`.
35
35
  */
36
- collectionsDeleteWhere(collection: string, filter_json: string): Promise<any>;
36
+ collectionsDeleteWhere(collection: string, filter_json: string, group_context?: string | null): Promise<any>;
37
37
  collectionsFind(collection: string, options_json: string): Promise<any>;
38
38
  /**
39
39
  * Vector-search. `options_json` matches `NearestOptions`
40
40
  * (`{vector_field, query_vector, k, filter?}`).
41
41
  */
42
- collectionsFindNearest(collection: string, options_json: string): Promise<any>;
43
- collectionsFindOne(collection: string, id: string): Promise<any>;
44
- collectionsInsert(collection: string, row_json: string): Promise<any>;
42
+ collectionsFindNearest(collection: string, options_json: string, group_context?: string | null): Promise<any>;
43
+ collectionsFindOne(collection: string, id: string, group_context?: string | null): Promise<any>;
44
+ collectionsInsert(collection: string, row_json: string, group_context?: string | null): Promise<any>;
45
45
  /**
46
46
  * Restore a previously soft-deleted row by id. Returns the restored row.
47
47
  */
48
- collectionsRestore(collection: string, id: string): Promise<any>;
48
+ collectionsRestore(collection: string, id: string, group_context?: string | null): Promise<any>;
49
49
  /**
50
50
  * Run an ordered batch of writes as ONE atomic transaction.
51
51
  * `operations_json` is a JSON-encoded array of wire-shaped op objects
@@ -53,15 +53,15 @@ export class AmbaCoreWasm {
53
53
  * conflict_target?}]`). Resolves to the per-op results array; rejects with
54
54
  * the server's structured error (naming the failing op index) on rollback.
55
55
  */
56
- collectionsTransaction(operations_json: string): Promise<any>;
57
- collectionsUpdate(collection: string, id: string, set_json: string): Promise<any>;
56
+ collectionsTransaction(operations_json: string, group_context?: string | null): Promise<any>;
57
+ collectionsUpdate(collection: string, id: string, set_json: string, group_context?: string | null): Promise<any>;
58
58
  /**
59
59
  * Upsert a row. `options_json` is `{on_conflict, conflict_target}` —
60
60
  * `on_conflict` is `"ignore"` or `"update"`, `conflict_target` is the
61
61
  * array of unique-index columns to arbitrate on. Returns the resolved
62
62
  * row.
63
63
  */
64
- collectionsUpsert(collection: string, row_json: string, options_json: string): Promise<any>;
64
+ collectionsUpsert(collection: string, row_json: string, options_json: string, group_context?: string | null): Promise<any>;
65
65
  configFetch(): Promise<any>;
66
66
  contentCreateItem(channel: string, item_json: string): Promise<any>;
67
67
  contentGetItem(id: string): Promise<any>;
@@ -131,6 +131,14 @@ export class AmbaCoreWasm {
131
131
  groupsJoin(id: string): Promise<any>;
132
132
  groupsLeave(id: string): Promise<any>;
133
133
  groupsUpdate(id: string, patch_json: string): Promise<any>;
134
+ /**
135
+ * Hydrate a browser-persisted identity into the live Rust core.
136
+ *
137
+ * This is intentionally a synchronous init-time bridge: the web wrapper
138
+ * reads its project-namespaced localStorage snapshot, initializes a fresh
139
+ * core, then calls this before publishing the configured SDK instance.
140
+ */
141
+ hydrateIdentity(identity_json: string): void;
134
142
  /**
135
143
  * Initialize the SDK.
136
144
  *
@@ -298,17 +306,17 @@ export interface InitOutput {
298
306
  readonly ambacorewasm_challengesGet: (a: number, b: number, c: number) => number;
299
307
  readonly ambacorewasm_challengesGetActive: (a: number) => number;
300
308
  readonly ambacorewasm_challengesGetProgress: (a: number, b: number, c: number) => number;
301
- readonly ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number) => number;
302
- readonly ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number) => number;
303
- readonly ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number) => number;
309
+ readonly ambacorewasm_collectionsCount: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
310
+ readonly ambacorewasm_collectionsDelete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
311
+ readonly ambacorewasm_collectionsDeleteWhere: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
304
312
  readonly ambacorewasm_collectionsFind: (a: number, b: number, c: number, d: number, e: number) => number;
305
- readonly ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number) => number;
306
- readonly ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number) => number;
307
- readonly ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number) => number;
308
- readonly ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number) => number;
309
- readonly ambacorewasm_collectionsTransaction: (a: number, b: number, c: number) => number;
310
- readonly ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
311
- readonly ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
313
+ readonly ambacorewasm_collectionsFindNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
314
+ readonly ambacorewasm_collectionsFindOne: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
315
+ readonly ambacorewasm_collectionsInsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
316
+ readonly ambacorewasm_collectionsRestore: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
317
+ readonly ambacorewasm_collectionsTransaction: (a: number, b: number, c: number, d: number, e: number) => number;
318
+ readonly ambacorewasm_collectionsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
319
+ readonly ambacorewasm_collectionsUpsert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
312
320
  readonly ambacorewasm_configFetch: (a: number) => number;
313
321
  readonly ambacorewasm_contentCreateItem: (a: number, b: number, c: number, d: number, e: number) => number;
314
322
  readonly ambacorewasm_contentGetItem: (a: number, b: number, c: number) => number;
@@ -346,6 +354,7 @@ export interface InitOutput {
346
354
  readonly ambacorewasm_groupsJoin: (a: number, b: number, c: number) => number;
347
355
  readonly ambacorewasm_groupsLeave: (a: number, b: number, c: number) => number;
348
356
  readonly ambacorewasm_groupsUpdate: (a: number, b: number, c: number, d: number, e: number) => number;
357
+ readonly ambacorewasm_hydrateIdentity: (a: number, b: number, c: number, d: number) => void;
349
358
  readonly ambacorewasm_init: (a: number, b: number, c: number, d: number) => void;
350
359
  readonly ambacorewasm_inventoryConsume: (a: number, b: number, c: number) => number;
351
360
  readonly ambacorewasm_inventoryGetItem: (a: number, b: number, c: number) => number;
@@ -429,9 +438,9 @@ export interface InitOutput {
429
438
  readonly ambacorewasm_xpClaim: (a: number, b: number, c: number) => number;
430
439
  readonly ambacorewasm_xpGetBalance: (a: number) => number;
431
440
  readonly ambacorewasm_xpGetHistory: (a: number, b: number) => number;
432
- readonly __wasm_bindgen_func_elem_3247: (a: number, b: number, c: number, d: number) => void;
433
- readonly __wasm_bindgen_func_elem_3228: (a: number, b: number, c: number, d: number) => void;
434
- readonly __wasm_bindgen_func_elem_3247_144: (a: number, b: number, c: number, d: number) => void;
441
+ readonly __wasm_bindgen_func_elem_3293: (a: number, b: number, c: number, d: number) => void;
442
+ readonly __wasm_bindgen_func_elem_3291: (a: number, b: number, c: number, d: number) => void;
443
+ readonly __wasm_bindgen_func_elem_3293_145: (a: number, b: number, c: number, d: number) => void;
435
444
  readonly __wbindgen_export: (a: number, b: number) => number;
436
445
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
437
446
  readonly __wbindgen_export3: (a: number) => void;