@livequery/client 1.0.24 → 1.0.27
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/build/Collection.d.ts +3 -3
- package/build/Collection.js +4 -5
- package/package.json +2 -2
package/build/Collection.d.ts
CHANGED
|
@@ -38,11 +38,11 @@ export declare class CollectionObservable<T extends {
|
|
|
38
38
|
reset(): void;
|
|
39
39
|
fetch_more(): void;
|
|
40
40
|
filter(filters: Partial<QueryOption<T>>): void;
|
|
41
|
-
add(payload: T): Promise<
|
|
41
|
+
add(payload: T): Promise<T>;
|
|
42
42
|
remove(remove_document_id?: string): Promise<void>;
|
|
43
43
|
update({ id: update_payload_id, ...payload }: Partial<T & {
|
|
44
44
|
id: string;
|
|
45
|
-
}>): Promise<
|
|
46
|
-
trigger(name: string, payload?: object, trigger_document_id?: string): Promise<
|
|
45
|
+
}>): Promise<T>;
|
|
46
|
+
trigger<T>(name: string, payload?: object, trigger_document_id?: string): Promise<T>;
|
|
47
47
|
}
|
|
48
48
|
export {};
|
package/build/Collection.js
CHANGED
|
@@ -64,7 +64,7 @@ class CollectionObservable extends rxjs_1.Observable {
|
|
|
64
64
|
this.document_id = this.is_collection_ref ? null : refs[refs.length - 1];
|
|
65
65
|
}
|
|
66
66
|
push_item(data) {
|
|
67
|
-
const item = Object.assign(Object.assign({ __adding: false, __updating:
|
|
67
|
+
const item = Object.assign(Object.assign({}, data), { __adding: false, __updating: false, __removing: false, __remove: () => this.remove(data === null || data === void 0 ? void 0 : data.id), __trigger: (name, payload) => this.trigger(name, payload, data === null || data === void 0 ? void 0 : data.id), __update: (payload) => this.update(Object.assign(Object.assign({}, payload), { id: data === null || data === void 0 ? void 0 : data.id })) });
|
|
68
68
|
__classPrivateFieldGet(this, _state).items.push(item);
|
|
69
69
|
}
|
|
70
70
|
sync(stream) {
|
|
@@ -126,7 +126,7 @@ class CollectionObservable extends rxjs_1.Observable {
|
|
|
126
126
|
}
|
|
127
127
|
if (index >= 0) {
|
|
128
128
|
if (type == 'added' || type == 'modified') {
|
|
129
|
-
__classPrivateFieldGet(this, _state).items[index] = Object.assign(Object.assign(Object.assign({}, __classPrivateFieldGet(this, _state).items[index]), { __adding: false, __updating: false, __removing: false })
|
|
129
|
+
__classPrivateFieldGet(this, _state).items[index] = Object.assign(Object.assign(Object.assign({}, __classPrivateFieldGet(this, _state).items[index]), payload), { __adding: false, __updating: false, __removing: false });
|
|
130
130
|
}
|
|
131
131
|
if (type == 'removed') {
|
|
132
132
|
__classPrivateFieldGet(this, _state).items.splice(index, 1);
|
|
@@ -139,7 +139,6 @@ class CollectionObservable extends rxjs_1.Observable {
|
|
|
139
139
|
__classPrivateFieldGet(this, _$state).next(__classPrivateFieldGet(this, _state));
|
|
140
140
|
}
|
|
141
141
|
fetch_data(options = {}, flush = false) {
|
|
142
|
-
console.log({ ref: this.ref, options });
|
|
143
142
|
if (!this.ref)
|
|
144
143
|
return;
|
|
145
144
|
if (flush) {
|
|
@@ -188,7 +187,7 @@ class CollectionObservable extends rxjs_1.Observable {
|
|
|
188
187
|
}]);
|
|
189
188
|
// Trigger
|
|
190
189
|
const ref = `${this.collection_ref}${id ? `/${id}` : ''}`;
|
|
191
|
-
|
|
190
|
+
yield this.collection_options.transporter.remove(ref);
|
|
192
191
|
});
|
|
193
192
|
}
|
|
194
193
|
update(_a) {
|
|
@@ -199,7 +198,7 @@ class CollectionObservable extends rxjs_1.Observable {
|
|
|
199
198
|
this.sync([{
|
|
200
199
|
data: {
|
|
201
200
|
changes: [{
|
|
202
|
-
data: Object.assign({ id, __updating: true }
|
|
201
|
+
data: Object.assign(Object.assign({}, payload), { id, __updating: true }),
|
|
203
202
|
ref: this.ref,
|
|
204
203
|
type: 'modified'
|
|
205
204
|
}]
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"repository": {
|
|
4
4
|
"url": "https://github.com/livequery/client"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.27",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "build/index.js",
|
|
9
9
|
"types": "build/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"uuid": "^8.3.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@livequery/types": "^1.0.
|
|
18
|
+
"@livequery/types": "^1.0.31"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|