shelving 1.118.0 → 1.119.0
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/change/Change.d.ts +1 -15
- package/change/Change.js +0 -28
- package/db/OperationProvider.js +15 -15
- package/db/index.d.ts +0 -1
- package/db/index.js +0 -1
- package/package.json +1 -1
- package/db/ChangeProvider.d.ts +0 -29
- package/db/ChangeProvider.js +0 -58
package/change/Change.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AsyncProvider, Provider } from "../db/Provider.js";
|
|
2
2
|
import type { ImmutableArray } from "../util/array.js";
|
|
3
3
|
import type { DataKey, Database } from "../util/data.js";
|
|
4
4
|
import type { ItemQuery } from "../util/item.js";
|
|
@@ -64,20 +64,6 @@ export type DatabaseQueryChange<T extends Database> = QuerySetChange<T, DataKey<
|
|
|
64
64
|
export type DatabaseChange<T extends Database> = ItemAddChange<T, DataKey<T>> | DatabaseItemChange<T> | DatabaseQueryChange<T>;
|
|
65
65
|
/** Write an item or multiple items in a set of collection. */
|
|
66
66
|
export type DatabaseChanges<T extends Database> = ImmutableArray<DatabaseChange<T>>;
|
|
67
|
-
/** Get a set change for an item. */
|
|
68
|
-
export declare function getItemAdd<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, data: T[K]): ItemAddChange<T, K>;
|
|
69
|
-
/** Get a set change for an item. */
|
|
70
|
-
export declare function getItemSet<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, id: string, data: T[K]): ItemSetChange<T, K>;
|
|
71
|
-
/** Get an update change an item. */
|
|
72
|
-
export declare function getItemUpdate<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, id: string, updates: Updates<T[K]>): ItemUpdateChange<T, K>;
|
|
73
|
-
/** Get a set change for an item. */
|
|
74
|
-
export declare function getItemDelete<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, id: string): ItemDeleteChange<T, K>;
|
|
75
|
-
/** Get a set change for an query. */
|
|
76
|
-
export declare function getQuerySet<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, query: ItemQuery<T[K]>, data: T[K]): QuerySetChange<T, K>;
|
|
77
|
-
/** Get an update change an query. */
|
|
78
|
-
export declare function getQueryUpdate<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, query: ItemQuery<T[K]>, updates: Updates<T[K]>): QueryUpdateChange<T, K>;
|
|
79
|
-
/** Get a set change for an query. */
|
|
80
|
-
export declare function getQueryDelete<T extends Database, K extends DataKey<T>>(provider: AbstractProvider<T>, collection: K, query: ItemQuery<T[K]>): QueryDeleteChange<T, K>;
|
|
81
67
|
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
82
68
|
export declare function writeChange<T extends Database>(provider: Provider<T>, change: DatabaseChange<T>): DatabaseChange<T>;
|
|
83
69
|
/** Write a single change to an asynchronous provider and return the change that was written. */
|
package/change/Change.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/** Get a set change for an item. */
|
|
2
|
-
export function getItemAdd(provider, collection, data) {
|
|
3
|
-
return { action: "add", collection, data };
|
|
4
|
-
}
|
|
5
|
-
/** Get a set change for an item. */
|
|
6
|
-
export function getItemSet(provider, collection, id, data) {
|
|
7
|
-
return { action: "set", collection, id, data };
|
|
8
|
-
}
|
|
9
|
-
/** Get an update change an item. */
|
|
10
|
-
export function getItemUpdate(provider, collection, id, updates) {
|
|
11
|
-
return { action: "update", collection, id, updates };
|
|
12
|
-
}
|
|
13
|
-
/** Get a set change for an item. */
|
|
14
|
-
export function getItemDelete(provider, collection, id) {
|
|
15
|
-
return { action: "delete", collection, id };
|
|
16
|
-
}
|
|
17
|
-
/** Get a set change for an query. */
|
|
18
|
-
export function getQuerySet(provider, collection, query, data) {
|
|
19
|
-
return { action: "set", collection, query, data };
|
|
20
|
-
}
|
|
21
|
-
/** Get an update change an query. */
|
|
22
|
-
export function getQueryUpdate(provider, collection, query, updates) {
|
|
23
|
-
return { action: "update", collection, query, updates };
|
|
24
|
-
}
|
|
25
|
-
/** Get a set change for an query. */
|
|
26
|
-
export function getQueryDelete(provider, collection, query) {
|
|
27
|
-
return { action: "delete", collection, query };
|
|
28
|
-
}
|
|
29
1
|
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
30
2
|
export function writeChange(provider, change) {
|
|
31
3
|
const { action, collection, id, query } = change;
|
package/db/OperationProvider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeAsyncChange, writeChange } from "../change/Change.js";
|
|
2
2
|
import { notOptional } from "../util/optional.js";
|
|
3
3
|
import { AsyncThroughProvider, ThroughProvider } from "./ThroughProvider.js";
|
|
4
4
|
/** Write a set of operations or changes to a synchronous provider and return an array of the changes that were written. */
|
|
@@ -23,32 +23,32 @@ export class OperationProvider extends ThroughProvider {
|
|
|
23
23
|
_written = [];
|
|
24
24
|
addItem(collection, data) {
|
|
25
25
|
const id = super.addItem(collection, data);
|
|
26
|
-
this._written.push(
|
|
26
|
+
this._written.push({ action: "set", collection, id, data });
|
|
27
27
|
return id;
|
|
28
28
|
}
|
|
29
29
|
setItem(collection, id, data) {
|
|
30
30
|
super.setItem(collection, id, data);
|
|
31
|
-
this._written.push(
|
|
31
|
+
this._written.push({ action: "set", collection, id, data });
|
|
32
32
|
}
|
|
33
33
|
updateItem(collection, id, updates) {
|
|
34
34
|
super.updateItem(collection, id, updates);
|
|
35
|
-
this._written.push(
|
|
35
|
+
this._written.push({ action: "update", collection, id, updates });
|
|
36
36
|
}
|
|
37
37
|
deleteItem(collection, id) {
|
|
38
38
|
super.deleteItem(collection, id);
|
|
39
|
-
this._written.push(
|
|
39
|
+
this._written.push({ action: "delete", collection, id });
|
|
40
40
|
}
|
|
41
41
|
setQuery(collection, query, data) {
|
|
42
42
|
super.setQuery(collection, query, data);
|
|
43
|
-
this._written.push(
|
|
43
|
+
this._written.push({ action: "set", collection, query, data });
|
|
44
44
|
}
|
|
45
45
|
updateQuery(collection, query, updates) {
|
|
46
46
|
super.updateQuery(collection, query, updates);
|
|
47
|
-
this._written.push(
|
|
47
|
+
this._written.push({ action: "update", collection, query, updates });
|
|
48
48
|
}
|
|
49
49
|
deleteQuery(collection, query) {
|
|
50
50
|
super.deleteQuery(collection, query);
|
|
51
|
-
this._written.push(
|
|
51
|
+
this._written.push({ action: "delete", collection, query });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
/** Write a set of operations or changes to an asynchronous provider and return an array of the changes that were written. */
|
|
@@ -73,31 +73,31 @@ export class AsyncOperationProvider extends AsyncThroughProvider {
|
|
|
73
73
|
_written = [];
|
|
74
74
|
async addItem(collection, data) {
|
|
75
75
|
const id = await super.addItem(collection, data);
|
|
76
|
-
this._written.push(
|
|
76
|
+
this._written.push({ action: "set", collection, id, data });
|
|
77
77
|
return id;
|
|
78
78
|
}
|
|
79
79
|
async setItem(collection, id, data) {
|
|
80
80
|
await super.setItem(collection, id, data);
|
|
81
|
-
this._written.push(
|
|
81
|
+
this._written.push({ action: "set", collection, id, data });
|
|
82
82
|
}
|
|
83
83
|
async updateItem(collection, id, updates) {
|
|
84
84
|
await super.updateItem(collection, id, updates);
|
|
85
|
-
this._written.push(
|
|
85
|
+
this._written.push({ action: "update", collection, id, updates });
|
|
86
86
|
}
|
|
87
87
|
async deleteItem(collection, id) {
|
|
88
88
|
await super.deleteItem(collection, id);
|
|
89
|
-
this._written.push(
|
|
89
|
+
this._written.push({ action: "delete", collection, id });
|
|
90
90
|
}
|
|
91
91
|
async setQuery(collection, query, data) {
|
|
92
92
|
await super.setQuery(collection, query, data);
|
|
93
|
-
this._written.push(
|
|
93
|
+
this._written.push({ action: "set", collection, query, data });
|
|
94
94
|
}
|
|
95
95
|
async updateQuery(collection, query, updates) {
|
|
96
96
|
await super.updateQuery(collection, query, updates);
|
|
97
|
-
this._written.push(
|
|
97
|
+
this._written.push({ action: "update", collection, query, updates });
|
|
98
98
|
}
|
|
99
99
|
async deleteQuery(collection, query) {
|
|
100
100
|
await super.deleteQuery(collection, query);
|
|
101
|
-
this._written.push(
|
|
101
|
+
this._written.push({ action: "delete", collection, query });
|
|
102
102
|
}
|
|
103
103
|
}
|
package/db/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from "./QueryStore.js";
|
|
|
3
3
|
export * from "./Provider.js";
|
|
4
4
|
export * from "./ThroughProvider.js";
|
|
5
5
|
export * from "./CacheProvider.js";
|
|
6
|
-
export * from "./ChangeProvider.js";
|
|
7
6
|
export * from "./DebugProvider.js";
|
|
8
7
|
export * from "./MemoryProvider.js";
|
|
9
8
|
export * from "./OperationProvider.js";
|
package/db/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export * from "./QueryStore.js";
|
|
|
5
5
|
export * from "./Provider.js";
|
|
6
6
|
export * from "./ThroughProvider.js";
|
|
7
7
|
export * from "./CacheProvider.js";
|
|
8
|
-
export * from "./ChangeProvider.js";
|
|
9
8
|
export * from "./DebugProvider.js";
|
|
10
9
|
export * from "./MemoryProvider.js";
|
|
11
10
|
export * from "./OperationProvider.js";
|
package/package.json
CHANGED
package/db/ChangeProvider.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { DatabaseChange, ItemAddChange, ItemDeleteChange, ItemSetChange, ItemUpdateChange, QueryDeleteChange, QuerySetChange, QueryUpdateChange } from "../change/Change.js";
|
|
2
|
-
import type { DataKey, Database } from "../util/data.js";
|
|
3
|
-
import type { ItemQuery } from "../util/item.js";
|
|
4
|
-
import type { Updates } from "../util/update.js";
|
|
5
|
-
import { AsyncThroughProvider, ThroughProvider } from "./ThroughProvider.js";
|
|
6
|
-
/** Synchronous provider that offers additional helper methods for working with `Change` items. */
|
|
7
|
-
export declare class ChangeProvider<T extends Database> extends ThroughProvider<T> {
|
|
8
|
-
getItemAdd<K extends DataKey<T>>(collection: K, data: T[K]): ItemAddChange<T, K>;
|
|
9
|
-
getItemSet<K extends DataKey<T>>(collection: K, id: string, data: T[K]): ItemSetChange<T, K>;
|
|
10
|
-
getItemUpdate<K extends DataKey<T>>(collection: K, id: string, updates: Updates<T[K]>): ItemUpdateChange<T, K>;
|
|
11
|
-
getItemDelete<K extends DataKey<T>>(collection: K, id: string): ItemDeleteChange<T, K>;
|
|
12
|
-
getQuerySet<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>, data: T[K]): QuerySetChange<T, K>;
|
|
13
|
-
getQueryUpdate<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>, updates: Updates<T[K]>): QueryUpdateChange<T, K>;
|
|
14
|
-
getQueryDelete<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>): QueryDeleteChange<T, K>;
|
|
15
|
-
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
16
|
-
change(change: DatabaseChange<T>): DatabaseChange<T>;
|
|
17
|
-
}
|
|
18
|
-
/** Asynchronous provider that offers additional helper methods for working with `Change` items. */
|
|
19
|
-
export declare class AsyncConvenienceProvider<T extends Database> extends AsyncThroughProvider<T> {
|
|
20
|
-
getItemAdd<K extends DataKey<T>>(collection: K, data: T[K]): ItemAddChange<T, K>;
|
|
21
|
-
getItemSet<K extends DataKey<T>>(collection: K, id: string, data: T[K]): ItemSetChange<T, K>;
|
|
22
|
-
getItemUpdate<K extends DataKey<T>>(collection: K, id: string, updates: Updates<T[K]>): ItemUpdateChange<T, K>;
|
|
23
|
-
getItemDelete<K extends DataKey<T>>(collection: K, id: string): ItemDeleteChange<T, K>;
|
|
24
|
-
getQuerySet<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>, data: T[K]): QuerySetChange<T, K>;
|
|
25
|
-
getQueryUpdate<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>, updates: Updates<T[K]>): QueryUpdateChange<T, K>;
|
|
26
|
-
getQueryDelete<K extends DataKey<T>>(collection: K, query: ItemQuery<T[K]>): QueryDeleteChange<T, K>;
|
|
27
|
-
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
28
|
-
change(change: DatabaseChange<T>): Promise<DatabaseChange<T>>;
|
|
29
|
-
}
|
package/db/ChangeProvider.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { getItemAdd, getItemDelete, getItemSet, getItemUpdate, getQueryDelete, getQuerySet, getQueryUpdate, writeAsyncChange, writeChange } from "../change/Change.js";
|
|
2
|
-
import { AsyncThroughProvider, ThroughProvider } from "./ThroughProvider.js";
|
|
3
|
-
/** Synchronous provider that offers additional helper methods for working with `Change` items. */
|
|
4
|
-
export class ChangeProvider extends ThroughProvider {
|
|
5
|
-
getItemAdd(collection, data) {
|
|
6
|
-
return getItemAdd(this, collection, data);
|
|
7
|
-
}
|
|
8
|
-
getItemSet(collection, id, data) {
|
|
9
|
-
return getItemSet(this, collection, id, data);
|
|
10
|
-
}
|
|
11
|
-
getItemUpdate(collection, id, updates) {
|
|
12
|
-
return getItemUpdate(this, collection, id, updates);
|
|
13
|
-
}
|
|
14
|
-
getItemDelete(collection, id) {
|
|
15
|
-
return getItemDelete(this, collection, id);
|
|
16
|
-
}
|
|
17
|
-
getQuerySet(collection, query, data) {
|
|
18
|
-
return getQuerySet(this, collection, query, data);
|
|
19
|
-
}
|
|
20
|
-
getQueryUpdate(collection, query, updates) {
|
|
21
|
-
return getQueryUpdate(this, collection, query, updates);
|
|
22
|
-
}
|
|
23
|
-
getQueryDelete(collection, query) {
|
|
24
|
-
return getQueryDelete(this, collection, query);
|
|
25
|
-
}
|
|
26
|
-
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
27
|
-
change(change) {
|
|
28
|
-
return writeChange(this, change);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** Asynchronous provider that offers additional helper methods for working with `Change` items. */
|
|
32
|
-
export class AsyncConvenienceProvider extends AsyncThroughProvider {
|
|
33
|
-
getItemAdd(collection, data) {
|
|
34
|
-
return getItemAdd(this, collection, data);
|
|
35
|
-
}
|
|
36
|
-
getItemSet(collection, id, data) {
|
|
37
|
-
return getItemSet(this, collection, id, data);
|
|
38
|
-
}
|
|
39
|
-
getItemUpdate(collection, id, updates) {
|
|
40
|
-
return getItemUpdate(this, collection, id, updates);
|
|
41
|
-
}
|
|
42
|
-
getItemDelete(collection, id) {
|
|
43
|
-
return getItemDelete(this, collection, id);
|
|
44
|
-
}
|
|
45
|
-
getQuerySet(collection, query, data) {
|
|
46
|
-
return getQuerySet(this, collection, query, data);
|
|
47
|
-
}
|
|
48
|
-
getQueryUpdate(collection, query, updates) {
|
|
49
|
-
return getQueryUpdate(this, collection, query, updates);
|
|
50
|
-
}
|
|
51
|
-
getQueryDelete(collection, query) {
|
|
52
|
-
return getQueryDelete(this, collection, query);
|
|
53
|
-
}
|
|
54
|
-
/** Write a single change to a synchronous provider and return an array of the changes that were written. */
|
|
55
|
-
change(change) {
|
|
56
|
-
return writeAsyncChange(this, change);
|
|
57
|
-
}
|
|
58
|
-
}
|