@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
@@ -1,5 +1,5 @@
1
- import { G as ResolvedConfig, E as EntitlementCheck } from './types-Kmt4y1FQ.cjs';
2
- import './collection-ref-BBvTTXoG.cjs';
1
+ import { G as ResolvedConfig, E as EntitlementCheck } 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';
@@ -1,5 +1,5 @@
1
- import { G as ResolvedConfig, E as EntitlementCheck } from './types-B1jylbMC.js';
2
- import './collection-ref-BBvTTXoG.js';
1
+ import { G as ResolvedConfig, E as EntitlementCheck } 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/index.cjs CHANGED
@@ -2956,10 +2956,9 @@ var DbCollectionRefImpl = class {
2956
2956
  const batchId = `batch-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2957
2957
  const busChanges = [];
2958
2958
  for (const op of ops) {
2959
- const id = op.id ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
2960
- const data = op.data ?? {};
2961
- const collection = op.collection;
2962
- if (op.op === "add") {
2959
+ const collection = this._collection;
2960
+ if (op.kind === "add") {
2961
+ const data = op.data;
2963
2962
  const mutation = await this._queue.enqueue({
2964
2963
  collection,
2965
2964
  op: "add",
@@ -2983,7 +2982,9 @@ var DbCollectionRefImpl = class {
2983
2982
  }
2984
2983
  });
2985
2984
  busChanges.push({ type: "added", collection, doc: { id: docId, data } });
2986
- } else if (op.op === "set") {
2985
+ } else if (op.kind === "set") {
2986
+ const id = op.id;
2987
+ const data = op.data;
2987
2988
  const existing = await this._store.getDoc(collection, id);
2988
2989
  const mutation = await this._queue.enqueue({
2989
2990
  collection,
@@ -3012,7 +3013,9 @@ var DbCollectionRefImpl = class {
3012
3013
  collection,
3013
3014
  doc: { id, data }
3014
3015
  });
3015
- } else if (op.op === "update") {
3016
+ } else if (op.kind === "update") {
3017
+ const id = op.id;
3018
+ const data = op.data;
3016
3019
  const existing = await this._store.getDoc(collection, id);
3017
3020
  const merged = { ...existing?.data ?? {}, ...data };
3018
3021
  const mutation = await this._queue.enqueue({
@@ -3041,7 +3044,8 @@ var DbCollectionRefImpl = class {
3041
3044
  }
3042
3045
  });
3043
3046
  busChanges.push({ type: "modified", collection, doc: { id, data: merged } });
3044
- } else if (op.op === "remove") {
3047
+ } else if (op.kind === "remove") {
3048
+ const id = op.id;
3045
3049
  const existing = await this._store.getDoc(collection, id);
3046
3050
  await this._queue.enqueue({
3047
3051
  collection,
@@ -3150,6 +3154,15 @@ var DbCollectionRefImpl = class {
3150
3154
  assertValidId(id);
3151
3155
  const self = this;
3152
3156
  return {
3157
+ get id() {
3158
+ return id;
3159
+ },
3160
+ get path() {
3161
+ return `${self._collection}/${id}`;
3162
+ },
3163
+ get collection() {
3164
+ return self._collection;
3165
+ },
3153
3166
  async get() {
3154
3167
  return self._buildGetResult(id);
3155
3168
  },
@@ -4283,6 +4296,15 @@ function createLazyCollectionRef(name, getDocsPromise) {
4283
4296
  },
4284
4297
  doc(id) {
4285
4298
  return {
4299
+ get id() {
4300
+ return id;
4301
+ },
4302
+ get path() {
4303
+ return `${name}/${id}`;
4304
+ },
4305
+ get collection() {
4306
+ return name;
4307
+ },
4286
4308
  async get() {
4287
4309
  return (await getRef()).doc(id).get();
4288
4310
  },
@@ -5084,20 +5106,17 @@ var MockDb = class {
5084
5106
  },
5085
5107
  async batch(ops) {
5086
5108
  for (const op of ops) {
5087
- const collMap = (() => {
5088
- if (!_store.has(op.collection)) _store.set(op.collection, /* @__PURE__ */ new Map());
5089
- return _store.get(op.collection);
5090
- })();
5091
- const id = op.id ?? `mock-batch-${++autoSeq}`;
5092
- if (op.op === "add") {
5093
- collMap.set(id, { ...op.data ?? {}, id });
5094
- } else if (op.op === "set") {
5095
- collMap.set(id, { ...op.data ?? {}, id });
5096
- } else if (op.op === "update") {
5097
- const cur = collMap.get(id);
5098
- collMap.set(id, { ...cur ?? {}, ...op.data ?? {}, id });
5099
- } else if (op.op === "remove") {
5100
- collMap.delete(id);
5109
+ const collMap = coll;
5110
+ if (op.kind === "add") {
5111
+ const id = `mock-batch-${++autoSeq}`;
5112
+ collMap.set(id, { ...op.data, id });
5113
+ } else if (op.kind === "set") {
5114
+ collMap.set(op.id, { ...op.data, id: op.id });
5115
+ } else if (op.kind === "update") {
5116
+ const cur = collMap.get(op.id);
5117
+ collMap.set(op.id, { ...cur ?? {}, ...op.data, id: op.id });
5118
+ } else if (op.kind === "remove") {
5119
+ collMap.delete(op.id);
5101
5120
  }
5102
5121
  }
5103
5122
  return { ok: true };
@@ -5118,6 +5137,15 @@ var MockDb = class {
5118
5137
  },
5119
5138
  doc(id) {
5120
5139
  return {
5140
+ get id() {
5141
+ return id;
5142
+ },
5143
+ get path() {
5144
+ return `${name}/${id}`;
5145
+ },
5146
+ get collection() {
5147
+ return name;
5148
+ },
5121
5149
  async get() {
5122
5150
  const data = coll.get(id);
5123
5151
  if (!data) return null;