@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/auth.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as NeetruClientConfig, N as NeetruClient } from './types-Kmt4y1FQ.cjs';
2
- import './collection-ref-BBvTTXoG.cjs';
1
+ import { o as NeetruClientConfig, N as NeetruClient } from './types-Cfb-qeDg.cjs';
2
+ import './collection-ref-DqAAhuhX.cjs';
3
3
  import '@neetru/realtime-protocol';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.cjs';
package/dist/auth.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as NeetruClientConfig, N as NeetruClient } from './types-B1jylbMC.js';
2
- import './collection-ref-BBvTTXoG.js';
1
+ import { o as NeetruClientConfig, N as NeetruClient } from './types-V1EfjR1p.js';
2
+ import './collection-ref-DqAAhuhX.js';
3
3
  import '@neetru/realtime-protocol';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.js';
package/dist/auth.mjs CHANGED
@@ -2954,10 +2954,9 @@ var DbCollectionRefImpl = class {
2954
2954
  const batchId = `batch-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2955
2955
  const busChanges = [];
2956
2956
  for (const op of ops) {
2957
- const id = op.id ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
2958
- const data = op.data ?? {};
2959
- const collection = op.collection;
2960
- if (op.op === "add") {
2957
+ const collection = this._collection;
2958
+ if (op.kind === "add") {
2959
+ const data = op.data;
2961
2960
  const mutation = await this._queue.enqueue({
2962
2961
  collection,
2963
2962
  op: "add",
@@ -2981,7 +2980,9 @@ var DbCollectionRefImpl = class {
2981
2980
  }
2982
2981
  });
2983
2982
  busChanges.push({ type: "added", collection, doc: { id: docId, data } });
2984
- } else if (op.op === "set") {
2983
+ } else if (op.kind === "set") {
2984
+ const id = op.id;
2985
+ const data = op.data;
2985
2986
  const existing = await this._store.getDoc(collection, id);
2986
2987
  const mutation = await this._queue.enqueue({
2987
2988
  collection,
@@ -3010,7 +3011,9 @@ var DbCollectionRefImpl = class {
3010
3011
  collection,
3011
3012
  doc: { id, data }
3012
3013
  });
3013
- } else if (op.op === "update") {
3014
+ } else if (op.kind === "update") {
3015
+ const id = op.id;
3016
+ const data = op.data;
3014
3017
  const existing = await this._store.getDoc(collection, id);
3015
3018
  const merged = { ...existing?.data ?? {}, ...data };
3016
3019
  const mutation = await this._queue.enqueue({
@@ -3039,7 +3042,8 @@ var DbCollectionRefImpl = class {
3039
3042
  }
3040
3043
  });
3041
3044
  busChanges.push({ type: "modified", collection, doc: { id, data: merged } });
3042
- } else if (op.op === "remove") {
3045
+ } else if (op.kind === "remove") {
3046
+ const id = op.id;
3043
3047
  const existing = await this._store.getDoc(collection, id);
3044
3048
  await this._queue.enqueue({
3045
3049
  collection,
@@ -3148,6 +3152,15 @@ var DbCollectionRefImpl = class {
3148
3152
  assertValidId(id);
3149
3153
  const self = this;
3150
3154
  return {
3155
+ get id() {
3156
+ return id;
3157
+ },
3158
+ get path() {
3159
+ return `${self._collection}/${id}`;
3160
+ },
3161
+ get collection() {
3162
+ return self._collection;
3163
+ },
3151
3164
  async get() {
3152
3165
  return self._buildGetResult(id);
3153
3166
  },
@@ -4281,6 +4294,15 @@ function createLazyCollectionRef(name, getDocsPromise) {
4281
4294
  },
4282
4295
  doc(id) {
4283
4296
  return {
4297
+ get id() {
4298
+ return id;
4299
+ },
4300
+ get path() {
4301
+ return `${name}/${id}`;
4302
+ },
4303
+ get collection() {
4304
+ return name;
4305
+ },
4284
4306
  async get() {
4285
4307
  return (await getRef()).doc(id).get();
4286
4308
  },