@livequery/client 2.0.7 → 2.0.11

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.
@@ -109,6 +109,7 @@ export class CollectionObservable extends BehaviorSubject {
109
109
  }))) {
110
110
  const item = {
111
111
  ...payload,
112
+ id: payload.id || payload._id,
112
113
  __adding: false,
113
114
  __updating: false,
114
115
  __removing: false,
@@ -299,7 +300,11 @@ export class CollectionObservable extends BehaviorSubject {
299
300
  return { ref, id, collection_ref, index };
300
301
  }
301
302
  async add(payload) {
302
- return await this.collection_options.transporter.add(`${this.ref}`, payload);
303
+ const r = await this.collection_options.transporter.add(`${this.ref}`, payload);
304
+ if (r.data && r.data.item && !r.data.item.id) {
305
+ r.data.item.id = r.data.item._id;
306
+ }
307
+ return r;
303
308
  }
304
309
  async update({ id: update_payload_id, ...payload }) {
305
310
  const { id, ref } = this.#find_ref_by_id(update_payload_id);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "repository": {
5
5
  "url": "https://github.com/livequery/client"
6
6
  },
7
- "version": "2.0.7",
7
+ "version": "2.0.11",
8
8
  "description": "",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",