@neetru/sdk 2.1.0 → 2.1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +53 -1
  2. package/dist/auth.cjs +29 -7
  3. package/dist/auth.cjs.map +1 -1
  4. package/dist/auth.d.cts +2 -2
  5. package/dist/auth.d.ts +2 -2
  6. package/dist/auth.mjs +29 -7
  7. package/dist/auth.mjs.map +1 -1
  8. package/dist/catalog.d.cts +2 -2
  9. package/dist/catalog.d.ts +2 -2
  10. package/dist/checkout.d.cts +2 -2
  11. package/dist/checkout.d.ts +2 -2
  12. package/dist/{collection-ref-BBvTTXoG.d.cts → collection-ref-DqAAhuhX.d.cts} +56 -7
  13. package/dist/{collection-ref-BBvTTXoG.d.ts → collection-ref-DqAAhuhX.d.ts} +56 -7
  14. package/dist/db-react.d.cts +1 -1
  15. package/dist/db-react.d.ts +1 -1
  16. package/dist/db.cjs +29 -7
  17. package/dist/db.cjs.map +1 -1
  18. package/dist/db.d.cts +2 -2
  19. package/dist/db.d.ts +2 -2
  20. package/dist/db.mjs +29 -7
  21. package/dist/db.mjs.map +1 -1
  22. package/dist/entitlements.d.cts +2 -2
  23. package/dist/entitlements.d.ts +2 -2
  24. package/dist/index.cjs +49 -21
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +3 -3
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.mjs +49 -21
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/mocks.cjs +20 -14
  31. package/dist/mocks.cjs.map +1 -1
  32. package/dist/mocks.d.cts +2 -2
  33. package/dist/mocks.d.ts +2 -2
  34. package/dist/mocks.mjs +20 -14
  35. package/dist/mocks.mjs.map +1 -1
  36. package/dist/notifications.d.cts +2 -2
  37. package/dist/notifications.d.ts +2 -2
  38. package/dist/react.d.cts +2 -2
  39. package/dist/react.d.ts +2 -2
  40. package/dist/support.d.cts +2 -2
  41. package/dist/support.d.ts +2 -2
  42. package/dist/telemetry.d.cts +2 -2
  43. package/dist/telemetry.d.ts +2 -2
  44. package/dist/{types-Kmt4y1FQ.d.cts → types-Cfb-qeDg.d.cts} +1 -1
  45. package/dist/{types-B1jylbMC.d.ts → types-V1EfjR1p.d.ts} +1 -1
  46. package/dist/usage.d.cts +2 -2
  47. package/dist/usage.d.ts +2 -2
  48. package/dist/webhooks.d.cts +2 -2
  49. package/dist/webhooks.d.ts +2 -2
  50. package/package.json +2 -2
package/dist/db.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as ConflictRecord, a as CreateOfflineDocumentsOptions, D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery, i as DbWhereFilter, N as NeetruDbDocuments, R as RealtimeTransport, S as SyncState } from './collection-ref-BBvTTXoG.cjs';
2
- export { k as DbSqlLease, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, v as NeetruSqlClient, I as SqlOptions, a3 as createNeetruDb, a5 as createRestSyncTransport, a7 as getWebSocketRealtimeClient } from './types-Kmt4y1FQ.cjs';
1
+ export { C as ConflictRecord, a as CreateOfflineDocumentsOptions, D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery, i as DbWhereFilter, N as NeetruDbDocuments, R as RealtimeTransport, S as SyncState } from './collection-ref-DqAAhuhX.cjs';
2
+ export { k as DbSqlLease, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, v as NeetruSqlClient, I as SqlOptions, a3 as createNeetruDb, a5 as createRestSyncTransport, a7 as getWebSocketRealtimeClient } from './types-Cfb-qeDg.cjs';
3
3
  import '@neetru/realtime-protocol';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.cjs';
package/dist/db.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as ConflictRecord, a as CreateOfflineDocumentsOptions, D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery, i as DbWhereFilter, N as NeetruDbDocuments, R as RealtimeTransport, S as SyncState } from './collection-ref-BBvTTXoG.js';
2
- export { k as DbSqlLease, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, v as NeetruSqlClient, I as SqlOptions, a3 as createNeetruDb, a5 as createRestSyncTransport, a7 as getWebSocketRealtimeClient } from './types-B1jylbMC.js';
1
+ export { C as ConflictRecord, a as CreateOfflineDocumentsOptions, D as DbBatchOp, b as DbChangeType, c as DbCollectionRef, d as DbDoc, e as DbDocRef, f as DbGetResult, g as DbListResult, h as DbQuery, i as DbWhereFilter, N as NeetruDbDocuments, R as RealtimeTransport, S as SyncState } from './collection-ref-DqAAhuhX.js';
2
+ export { k as DbSqlLease, p as NeetruDb, q as NeetruDbEngine, r as NeetruDbError, s as NeetruDbErrorCode, t as NeetruDbOptions, v as NeetruSqlClient, I as SqlOptions, a3 as createNeetruDb, a5 as createRestSyncTransport, a7 as getWebSocketRealtimeClient } from './types-V1EfjR1p.js';
3
3
  import '@neetru/realtime-protocol';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.js';
package/dist/db.mjs CHANGED
@@ -2375,10 +2375,9 @@ var DbCollectionRefImpl = class {
2375
2375
  const batchId = `batch-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2376
2376
  const busChanges = [];
2377
2377
  for (const op of ops) {
2378
- const id = op.id ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
2379
- const data = op.data ?? {};
2380
- const collection = op.collection;
2381
- if (op.op === "add") {
2378
+ const collection = this._collection;
2379
+ if (op.kind === "add") {
2380
+ const data = op.data;
2382
2381
  const mutation = await this._queue.enqueue({
2383
2382
  collection,
2384
2383
  op: "add",
@@ -2402,7 +2401,9 @@ var DbCollectionRefImpl = class {
2402
2401
  }
2403
2402
  });
2404
2403
  busChanges.push({ type: "added", collection, doc: { id: docId, data } });
2405
- } else if (op.op === "set") {
2404
+ } else if (op.kind === "set") {
2405
+ const id = op.id;
2406
+ const data = op.data;
2406
2407
  const existing = await this._store.getDoc(collection, id);
2407
2408
  const mutation = await this._queue.enqueue({
2408
2409
  collection,
@@ -2431,7 +2432,9 @@ var DbCollectionRefImpl = class {
2431
2432
  collection,
2432
2433
  doc: { id, data }
2433
2434
  });
2434
- } else if (op.op === "update") {
2435
+ } else if (op.kind === "update") {
2436
+ const id = op.id;
2437
+ const data = op.data;
2435
2438
  const existing = await this._store.getDoc(collection, id);
2436
2439
  const merged = { ...existing?.data ?? {}, ...data };
2437
2440
  const mutation = await this._queue.enqueue({
@@ -2460,7 +2463,8 @@ var DbCollectionRefImpl = class {
2460
2463
  }
2461
2464
  });
2462
2465
  busChanges.push({ type: "modified", collection, doc: { id, data: merged } });
2463
- } else if (op.op === "remove") {
2466
+ } else if (op.kind === "remove") {
2467
+ const id = op.id;
2464
2468
  const existing = await this._store.getDoc(collection, id);
2465
2469
  await this._queue.enqueue({
2466
2470
  collection,
@@ -2569,6 +2573,15 @@ var DbCollectionRefImpl = class {
2569
2573
  assertValidId(id);
2570
2574
  const self = this;
2571
2575
  return {
2576
+ get id() {
2577
+ return id;
2578
+ },
2579
+ get path() {
2580
+ return `${self._collection}/${id}`;
2581
+ },
2582
+ get collection() {
2583
+ return self._collection;
2584
+ },
2572
2585
  async get() {
2573
2586
  return self._buildGetResult(id);
2574
2587
  },
@@ -3705,6 +3718,15 @@ function createLazyCollectionRef(name, getDocsPromise) {
3705
3718
  },
3706
3719
  doc(id) {
3707
3720
  return {
3721
+ get id() {
3722
+ return id;
3723
+ },
3724
+ get path() {
3725
+ return `${name}/${id}`;
3726
+ },
3727
+ get collection() {
3728
+ return name;
3729
+ },
3708
3730
  async get() {
3709
3731
  return (await getRef()).doc(id).get();
3710
3732
  },