shelving 1.78.0 → 1.79.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/{api → modules/api}/Resource.d.ts +0 -0
- package/{api → modules/api}/Resource.js +0 -0
- package/{api → modules/api}/index.d.ts +0 -0
- package/{api → modules/api}/index.js +0 -0
- package/{constraint → modules/constraint}/Constraint.d.ts +0 -0
- package/{constraint → modules/constraint}/Constraint.js +0 -0
- package/{constraint → modules/constraint}/Constraints.d.ts +0 -0
- package/{constraint → modules/constraint}/Constraints.js +0 -0
- package/{constraint → modules/constraint}/FilterConstraint.d.ts +0 -0
- package/{constraint → modules/constraint}/FilterConstraint.js +0 -0
- package/{constraint → modules/constraint}/FilterConstraints.d.ts +0 -0
- package/{constraint → modules/constraint}/FilterConstraints.js +0 -0
- package/{constraint → modules/constraint}/QueryConstraints.d.ts +0 -0
- package/{constraint → modules/constraint}/QueryConstraints.js +0 -0
- package/{constraint → modules/constraint}/SortConstraint.d.ts +0 -0
- package/{constraint → modules/constraint}/SortConstraint.js +0 -0
- package/{constraint → modules/constraint}/SortConstraints.d.ts +0 -0
- package/{constraint → modules/constraint}/SortConstraints.js +0 -0
- package/{constraint → modules/constraint}/index.d.ts +0 -0
- package/{constraint → modules/constraint}/index.js +0 -0
- package/{db → modules/db}/Change.d.ts +0 -0
- package/{db → modules/db}/Change.js +0 -0
- package/{db → modules/db}/Collection.d.ts +34 -6
- package/{db → modules/db}/Collection.js +47 -7
- package/modules/db/Database.d.ts +76 -0
- package/modules/db/Database.js +95 -0
- package/{db → modules/db}/Item.d.ts +4 -4
- package/{db → modules/db}/Item.js +19 -19
- package/{db → modules/db}/Query.d.ts +0 -0
- package/{db → modules/db}/Query.js +0 -0
- package/{db → modules/db}/index.d.ts +0 -0
- package/{db → modules/db}/index.js +0 -0
- package/{error → modules/error}/AssertionError.d.ts +0 -0
- package/{error → modules/error}/AssertionError.js +0 -0
- package/{error → modules/error}/ConditionError.d.ts +0 -0
- package/{error → modules/error}/ConditionError.js +0 -0
- package/{error → modules/error}/PermissionError.d.ts +0 -0
- package/{error → modules/error}/PermissionError.js +0 -0
- package/{error → modules/error}/RequiredError.d.ts +0 -0
- package/{error → modules/error}/RequiredError.js +0 -0
- package/{error → modules/error}/ThroughError.d.ts +0 -0
- package/{error → modules/error}/ThroughError.js +0 -0
- package/{error → modules/error}/UnsupportedError.d.ts +0 -0
- package/{error → modules/error}/UnsupportedError.js +0 -0
- package/{error → modules/error}/ValidationError.d.ts +0 -0
- package/{error → modules/error}/ValidationError.js +0 -0
- package/{error → modules/error}/index.d.ts +0 -0
- package/{error → modules/error}/index.js +0 -0
- package/{feedback → modules/feedback}/ErrorFeedback.d.ts +0 -0
- package/{feedback → modules/feedback}/ErrorFeedback.js +1 -5
- package/{feedback → modules/feedback}/Feedback.d.ts +0 -0
- package/{feedback → modules/feedback}/Feedback.js +1 -5
- package/{feedback → modules/feedback}/InvalidFeedback.d.ts +0 -0
- package/{feedback → modules/feedback}/InvalidFeedback.js +1 -5
- package/{feedback → modules/feedback}/SuccessFeedback.d.ts +0 -0
- package/{feedback → modules/feedback}/SuccessFeedback.js +1 -5
- package/{feedback → modules/feedback}/WarningFeedback.d.ts +0 -0
- package/{feedback → modules/feedback}/WarningFeedback.js +1 -5
- package/{feedback → modules/feedback}/hydrations.d.ts +0 -0
- package/{feedback → modules/feedback}/hydrations.js +0 -0
- package/{feedback → modules/feedback}/index.d.ts +0 -0
- package/{feedback → modules/feedback}/index.js +0 -0
- package/{firestore → modules/firestore}/client/FirestoreClientProvider.d.ts +0 -0
- package/{firestore → modules/firestore}/client/FirestoreClientProvider.js +0 -0
- package/{firestore → modules/firestore}/client/index.d.ts +0 -0
- package/{firestore → modules/firestore}/client/index.js +0 -0
- package/{firestore → modules/firestore}/lite/FirestoreLiteProvider.d.ts +0 -0
- package/{firestore → modules/firestore}/lite/FirestoreLiteProvider.js +0 -0
- package/{firestore → modules/firestore}/lite/index.d.ts +0 -0
- package/{firestore → modules/firestore}/lite/index.js +0 -0
- package/{firestore → modules/firestore}/server/FirestoreServerProvider.d.ts +0 -0
- package/{firestore → modules/firestore}/server/FirestoreServerProvider.js +0 -0
- package/{firestore → modules/firestore}/server/index.d.ts +0 -0
- package/{firestore → modules/firestore}/server/index.js +0 -0
- package/{index.d.ts → modules/index.d.ts} +0 -0
- package/{index.js → modules/index.js} +0 -0
- package/{markup → modules/markup}/index.d.ts +0 -0
- package/{markup → modules/markup}/index.js +0 -0
- package/{markup → modules/markup}/options.d.ts +0 -0
- package/{markup → modules/markup}/options.js +0 -0
- package/{markup → modules/markup}/regexp.d.ts +0 -0
- package/{markup → modules/markup}/regexp.js +0 -0
- package/{markup → modules/markup}/render.d.ts +0 -0
- package/{markup → modules/markup}/render.js +0 -0
- package/{markup → modules/markup}/rules.d.ts +0 -0
- package/{markup → modules/markup}/rules.js +0 -0
- package/{observe → modules/observe}/AbstractObserver.d.ts +0 -0
- package/{observe → modules/observe}/AbstractObserver.js +0 -0
- package/{observe → modules/observe}/AsyncObserver.d.ts +0 -0
- package/{observe → modules/observe}/AsyncObserver.js +0 -0
- package/{observe → modules/observe}/LastSubject.d.ts +0 -0
- package/{observe → modules/observe}/LastSubject.js +0 -0
- package/{observe → modules/observe}/MatchObserver.d.ts +0 -0
- package/{observe → modules/observe}/MatchObserver.js +0 -0
- package/{observe → modules/observe}/MatchableObserver.d.ts +0 -0
- package/{observe → modules/observe}/MatchableObserver.js +0 -0
- package/{observe → modules/observe}/Observable.d.ts +0 -0
- package/{observe → modules/observe}/Observable.js +0 -0
- package/{observe → modules/observe}/Observer.d.ts +0 -0
- package/{observe → modules/observe}/Observer.js +0 -0
- package/{observe → modules/observe}/OnceObserver.d.ts +0 -0
- package/{observe → modules/observe}/OnceObserver.js +0 -0
- package/{observe → modules/observe}/Subject.d.ts +0 -0
- package/{observe → modules/observe}/Subject.js +0 -0
- package/{observe → modules/observe}/ThroughObserver.d.ts +0 -0
- package/{observe → modules/observe}/ThroughObserver.js +0 -0
- package/{observe → modules/observe}/TransformObserver.d.ts +0 -0
- package/{observe → modules/observe}/TransformObserver.js +0 -0
- package/{observe → modules/observe}/TransformableObserver.d.ts +0 -0
- package/{observe → modules/observe}/TransformableObserver.js +0 -0
- package/{observe → modules/observe}/index.d.ts +0 -0
- package/{observe → modules/observe}/index.js +0 -0
- package/{observe → modules/observe}/util.d.ts +0 -0
- package/{observe → modules/observe}/util.js +0 -0
- package/{provider → modules/provider}/BatchProvider.d.ts +0 -0
- package/{provider → modules/provider}/BatchProvider.js +0 -0
- package/{provider → modules/provider}/CacheProvider.d.ts +0 -0
- package/{provider → modules/provider}/CacheProvider.js +0 -0
- package/{provider → modules/provider}/DebugProvider.d.ts +0 -0
- package/{provider → modules/provider}/DebugProvider.js +0 -0
- package/{provider → modules/provider}/MemoryProvider.d.ts +0 -0
- package/{provider → modules/provider}/MemoryProvider.js +0 -0
- package/{provider → modules/provider}/Provider.d.ts +0 -0
- package/{provider → modules/provider}/Provider.js +0 -0
- package/{provider → modules/provider}/ThroughProvider.d.ts +0 -0
- package/{provider → modules/provider}/ThroughProvider.js +0 -0
- package/{provider → modules/provider}/ValidationProvider.d.ts +0 -0
- package/{provider → modules/provider}/ValidationProvider.js +0 -0
- package/{provider → modules/provider}/index.d.ts +0 -0
- package/{provider → modules/provider}/index.js +0 -0
- package/{react → modules/react}/index.d.ts +0 -0
- package/{react → modules/react}/index.js +0 -0
- package/{react → modules/react}/useCache.d.ts +0 -0
- package/{react → modules/react}/useCache.js +0 -0
- package/{react → modules/react}/useInstance.d.ts +0 -0
- package/{react → modules/react}/useInstance.js +0 -0
- package/{react → modules/react}/useItem.d.ts +0 -0
- package/{react → modules/react}/useItem.js +0 -0
- package/{react → modules/react}/useLazy.d.ts +0 -0
- package/{react → modules/react}/useLazy.js +0 -0
- package/{react → modules/react}/useQuery.d.ts +0 -0
- package/{react → modules/react}/useQuery.js +0 -0
- package/{react → modules/react}/useReduce.d.ts +0 -0
- package/{react → modules/react}/useReduce.js +0 -0
- package/{react → modules/react}/useSubscribe.d.ts +0 -0
- package/{react → modules/react}/useSubscribe.js +0 -0
- package/{schema → modules/schema}/AllowSchema.d.ts +0 -0
- package/{schema → modules/schema}/AllowSchema.js +0 -0
- package/{schema → modules/schema}/ArraySchema.d.ts +0 -0
- package/{schema → modules/schema}/ArraySchema.js +0 -0
- package/{schema → modules/schema}/BooleanSchema.d.ts +0 -0
- package/{schema → modules/schema}/BooleanSchema.js +0 -0
- package/{schema → modules/schema}/ColorSchema.d.ts +0 -0
- package/{schema → modules/schema}/ColorSchema.js +0 -0
- package/{schema → modules/schema}/DataSchema.d.ts +0 -0
- package/{schema → modules/schema}/DataSchema.js +0 -0
- package/{schema → modules/schema}/DateSchema.d.ts +0 -0
- package/{schema → modules/schema}/DateSchema.js +0 -0
- package/{schema → modules/schema}/EmailSchema.d.ts +0 -0
- package/{schema → modules/schema}/EmailSchema.js +0 -0
- package/{schema → modules/schema}/KeySchema.d.ts +0 -0
- package/{schema → modules/schema}/KeySchema.js +0 -0
- package/{schema → modules/schema}/LinkSchema.d.ts +0 -0
- package/{schema → modules/schema}/LinkSchema.js +0 -0
- package/{schema → modules/schema}/NumberSchema.d.ts +0 -0
- package/{schema → modules/schema}/NumberSchema.js +0 -0
- package/{schema → modules/schema}/ObjectSchema.d.ts +0 -0
- package/{schema → modules/schema}/ObjectSchema.js +0 -0
- package/{schema → modules/schema}/OptionalSchema.d.ts +0 -0
- package/{schema → modules/schema}/OptionalSchema.js +0 -0
- package/{schema → modules/schema}/PhoneSchema.d.ts +0 -0
- package/{schema → modules/schema}/PhoneSchema.js +0 -0
- package/{schema → modules/schema}/RequiredSchema.d.ts +0 -0
- package/{schema → modules/schema}/RequiredSchema.js +0 -0
- package/{schema → modules/schema}/Schema.d.ts +0 -0
- package/{schema → modules/schema}/Schema.js +0 -0
- package/{schema → modules/schema}/SlugSchema.d.ts +0 -0
- package/{schema → modules/schema}/SlugSchema.js +0 -0
- package/{schema → modules/schema}/StringSchema.d.ts +0 -0
- package/{schema → modules/schema}/StringSchema.js +0 -0
- package/{schema → modules/schema}/ThroughSchema.d.ts +0 -0
- package/{schema → modules/schema}/ThroughSchema.js +0 -0
- package/{schema → modules/schema}/index.d.ts +0 -0
- package/{schema → modules/schema}/index.js +0 -0
- package/{state → modules/state}/ArrayState.d.ts +0 -0
- package/{state → modules/state}/ArrayState.js +0 -0
- package/{state → modules/state}/BooleanState.d.ts +0 -0
- package/{state → modules/state}/BooleanState.js +0 -0
- package/{state → modules/state}/DataState.d.ts +0 -0
- package/{state → modules/state}/DataState.js +0 -0
- package/{state → modules/state}/ObjectState.d.ts +0 -0
- package/{state → modules/state}/ObjectState.js +0 -0
- package/{state → modules/state}/SelfClosingState.d.ts +0 -0
- package/{state → modules/state}/SelfClosingState.js +0 -0
- package/{state → modules/state}/State.d.ts +0 -0
- package/{state → modules/state}/State.js +0 -0
- package/{state → modules/state}/index.d.ts +0 -0
- package/{state → modules/state}/index.js +0 -0
- package/{test → modules/test}/basics.d.ts +0 -0
- package/{test → modules/test}/basics.js +0 -0
- package/{test → modules/test}/index.d.ts +0 -0
- package/{test → modules/test}/index.js +0 -0
- package/{test → modules/test}/people.d.ts +0 -0
- package/{test → modules/test}/people.js +0 -0
- package/{test → modules/test}/util.d.ts +0 -0
- package/{test → modules/test}/util.js +0 -0
- package/{update → modules/update}/ArrayUpdate.d.ts +0 -0
- package/{update → modules/update}/ArrayUpdate.js +0 -0
- package/{update → modules/update}/DataUpdate.d.ts +0 -0
- package/{update → modules/update}/DataUpdate.js +0 -0
- package/{update → modules/update}/Delete.d.ts +0 -0
- package/{update → modules/update}/Delete.js +0 -0
- package/{update → modules/update}/Increment.d.ts +0 -0
- package/{update → modules/update}/Increment.js +0 -0
- package/{update → modules/update}/ObjectUpdate.d.ts +0 -0
- package/{update → modules/update}/ObjectUpdate.js +0 -0
- package/{update → modules/update}/Update.d.ts +0 -0
- package/{update → modules/update}/Update.js +0 -0
- package/{update → modules/update}/hydrations.d.ts +0 -0
- package/{update → modules/update}/hydrations.js +0 -0
- package/{update → modules/update}/index.d.ts +0 -0
- package/{update → modules/update}/index.js +0 -0
- package/{util → modules/util}/array.d.ts +0 -0
- package/{util → modules/util}/array.js +0 -0
- package/{util → modules/util}/assert.d.ts +0 -0
- package/{util → modules/util}/assert.js +0 -0
- package/{util → modules/util}/async.d.ts +0 -0
- package/{util → modules/util}/async.js +0 -0
- package/{util → modules/util}/boolean.d.ts +0 -0
- package/{util → modules/util}/boolean.js +0 -0
- package/{util → modules/util}/class.d.ts +0 -0
- package/{util → modules/util}/class.js +0 -0
- package/{util → modules/util}/clone.d.ts +0 -0
- package/{util → modules/util}/clone.js +0 -0
- package/{util → modules/util}/color.d.ts +0 -0
- package/{util → modules/util}/color.js +0 -0
- package/{util → modules/util}/data.d.ts +0 -0
- package/{util → modules/util}/data.js +0 -0
- package/{util → modules/util}/date.d.ts +0 -0
- package/{util → modules/util}/date.js +0 -0
- package/{util → modules/util}/debug.d.ts +0 -0
- package/{util → modules/util}/debug.js +0 -0
- package/{util → modules/util}/diff.d.ts +0 -0
- package/{util → modules/util}/diff.js +0 -0
- package/{util → modules/util}/entry.d.ts +0 -0
- package/{util → modules/util}/entry.js +0 -0
- package/{util → modules/util}/equal.d.ts +0 -0
- package/{util → modules/util}/equal.js +0 -0
- package/{util → modules/util}/error.d.ts +0 -0
- package/{util → modules/util}/error.js +0 -0
- package/{util → modules/util}/filter.d.ts +0 -0
- package/{util → modules/util}/filter.js +0 -0
- package/{util → modules/util}/function.d.ts +0 -0
- package/{util → modules/util}/function.js +0 -0
- package/{util → modules/util}/hydrate.d.ts +0 -0
- package/{util → modules/util}/hydrate.js +0 -0
- package/{util → modules/util}/index.d.ts +0 -0
- package/{util → modules/util}/index.js +0 -0
- package/{util → modules/util}/iterate.d.ts +0 -0
- package/{util → modules/util}/iterate.js +0 -0
- package/{util → modules/util}/jsx.d.ts +0 -0
- package/{util → modules/util}/jsx.js +0 -0
- package/{util → modules/util}/lazy.d.ts +0 -0
- package/{util → modules/util}/lazy.js +0 -0
- package/{util → modules/util}/map.d.ts +0 -0
- package/{util → modules/util}/map.js +0 -0
- package/{util → modules/util}/match.d.ts +0 -0
- package/{util → modules/util}/match.js +0 -0
- package/{util → modules/util}/merge.d.ts +0 -0
- package/{util → modules/util}/merge.js +0 -0
- package/{util → modules/util}/null.d.ts +0 -0
- package/{util → modules/util}/null.js +0 -0
- package/{util → modules/util}/number.d.ts +0 -0
- package/{util → modules/util}/number.js +0 -0
- package/{util → modules/util}/object.d.ts +0 -0
- package/{util → modules/util}/object.js +0 -0
- package/{util → modules/util}/random.d.ts +0 -0
- package/{util → modules/util}/random.js +0 -0
- package/{util → modules/util}/regexp.d.ts +0 -0
- package/{util → modules/util}/regexp.js +0 -0
- package/{util → modules/util}/serialise.d.ts +0 -0
- package/{util → modules/util}/serialise.js +0 -0
- package/{util → modules/util}/set.d.ts +0 -0
- package/{util → modules/util}/set.js +0 -0
- package/{util → modules/util}/sort.d.ts +0 -0
- package/{util → modules/util}/sort.js +0 -0
- package/{util → modules/util}/source.d.ts +0 -0
- package/{util → modules/util}/source.js +0 -0
- package/{util → modules/util}/string.d.ts +0 -0
- package/{util → modules/util}/string.js +0 -0
- package/{util → modules/util}/template.d.ts +0 -0
- package/{util → modules/util}/template.js +0 -0
- package/{util → modules/util}/timeout.d.ts +0 -0
- package/{util → modules/util}/timeout.js +0 -0
- package/{util → modules/util}/transform.d.ts +0 -0
- package/{util → modules/util}/transform.js +0 -0
- package/{util → modules/util}/undefined.d.ts +0 -0
- package/{util → modules/util}/undefined.js +0 -0
- package/{util → modules/util}/units.d.ts +0 -0
- package/{util → modules/util}/units.js +0 -0
- package/{util → modules/util}/url.d.ts +0 -0
- package/{util → modules/util}/url.js +0 -0
- package/{util → modules/util}/validate.d.ts +0 -0
- package/{util → modules/util}/validate.js +0 -0
- package/package.json +6 -6
- package/db/Database.d.ts +0 -42
- package/db/Database.js +0 -43
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,10 +3,14 @@ import type { Nullish } from "../util/null.js";
|
|
|
3
3
|
import type { FilterList } from "../constraint/FilterConstraint.js";
|
|
4
4
|
import type { SortList } from "../constraint/SortConstraint.js";
|
|
5
5
|
import type { DeepIterable } from "../util/iterate.js";
|
|
6
|
+
import type { Updates } from "../update/DataUpdate.js";
|
|
7
|
+
import type { PartialObserver } from "../observe/Observer.js";
|
|
8
|
+
import type { Dispatch } from "../util/function.js";
|
|
9
|
+
import type { Unsubscribe } from "../observe/Observable.js";
|
|
6
10
|
import type { AsyncDatabase, Database } from "./Database.js";
|
|
7
|
-
import { ItemData, AsyncItem, Item } from "./Item.js";
|
|
11
|
+
import { ItemData, AsyncItem, Item, ItemValue } from "./Item.js";
|
|
8
12
|
import { AsyncQuery, Query } from "./Query.js";
|
|
9
|
-
import { AddChange, ItemChanges, WriteChange } from "./Change.js";
|
|
13
|
+
import { AddChange, ItemChanges, WriteChange, UpdateChange, DeleteChange, SetChange } from "./Change.js";
|
|
10
14
|
/** Reference to a collection in a synchronous or asynchronous provider. */
|
|
11
15
|
declare abstract class BaseCollection<T extends Datas = Datas, K extends Key<T> = Key<T>> {
|
|
12
16
|
abstract readonly db: Database<T> | AsyncDatabase<T>;
|
|
@@ -15,12 +19,28 @@ declare abstract class BaseCollection<T extends Datas = Datas, K extends Key<T>
|
|
|
15
19
|
abstract query(filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): Query<T, K> | AsyncQuery<T, K>;
|
|
16
20
|
/** Create a query on this item's collection. */
|
|
17
21
|
abstract item(id: string): Item<T, K> | AsyncItem<T, K>;
|
|
18
|
-
/** Add an item to this collection. */
|
|
19
|
-
abstract add(data: T[K]): string | Promise<string>;
|
|
20
22
|
/** Run a set of changes on this database. */
|
|
21
23
|
abstract change(...changes: DeepIterable<Nullish<WriteChange<T, K>>>[]): ItemChanges<T, K> | Promise<ItemChanges<T, K>>;
|
|
24
|
+
/** Get an item from this collection. */
|
|
25
|
+
abstract get(id: string): ItemValue<T[K]> | Promise<ItemValue<T[K]>>;
|
|
26
|
+
/** Subscribe a document from a collection in this database. */
|
|
27
|
+
subscribe(id: string, next: PartialObserver<ItemValue<T[K]>> | Dispatch<[ItemValue<T[K]>]>): Unsubscribe;
|
|
28
|
+
/** Add an item to this collection. */
|
|
29
|
+
abstract add(data: T[K]): string | Promise<string>;
|
|
30
|
+
/** Set a document in this collection. */
|
|
31
|
+
abstract set(id: string, data: T[K]): void | Promise<void>;
|
|
32
|
+
/** Update a document in this collection. */
|
|
33
|
+
abstract update(id: string, updates: Updates<T[K]>): void | Promise<void>;
|
|
34
|
+
/** Delete a document in this collection. */
|
|
35
|
+
abstract delete(id: string): void | Promise<void>;
|
|
22
36
|
/** Get an add change for this collection. */
|
|
23
37
|
getAdd(data: T[K]): AddChange<T, K>;
|
|
38
|
+
/** Get a set change for this collection. */
|
|
39
|
+
getSet(id: string, data: T[K]): SetChange<T, K>;
|
|
40
|
+
/** Get an update change for this collection. */
|
|
41
|
+
getUpdate(id: string, updates: Updates<T[K]>): UpdateChange<T, K>;
|
|
42
|
+
/** Get a delete change for this collection. */
|
|
43
|
+
getDelete(id: string): DeleteChange<T, K>;
|
|
24
44
|
toString(): K;
|
|
25
45
|
}
|
|
26
46
|
/** Reference to a collection in a synchronous provider. */
|
|
@@ -30,8 +50,12 @@ export declare class Collection<T extends Datas = Datas, K extends Key<T> = Key<
|
|
|
30
50
|
constructor(db: Database<T>, collection: K);
|
|
31
51
|
query(filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): Query<T, K>;
|
|
32
52
|
item(id: string): Item<T, K>;
|
|
33
|
-
add(data: T[K]): string;
|
|
34
53
|
change(...changes: DeepIterable<Nullish<WriteChange<T, K>>>[]): ItemChanges<T, K>;
|
|
54
|
+
get(id: string): ItemValue<T[K]>;
|
|
55
|
+
add(data: T[K]): string;
|
|
56
|
+
set(id: string, data: T[K]): void;
|
|
57
|
+
update(id: string, updates: Updates<T[K]>): void;
|
|
58
|
+
delete(id: string): void;
|
|
35
59
|
}
|
|
36
60
|
/** Reference to a collection in an asynchronous provider. */
|
|
37
61
|
export declare class AsyncCollection<T extends Datas = Datas, K extends Key<T> = Key<T>> extends BaseCollection<T, K> {
|
|
@@ -40,7 +64,11 @@ export declare class AsyncCollection<T extends Datas = Datas, K extends Key<T> =
|
|
|
40
64
|
constructor(db: AsyncDatabase<T>, collection: K);
|
|
41
65
|
query(filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): AsyncQuery<T, K>;
|
|
42
66
|
item(id: string): AsyncItem<T, K>;
|
|
43
|
-
add(data: T[K]): Promise<string>;
|
|
44
67
|
change(...changes: DeepIterable<Nullish<WriteChange<T, K>>>[]): Promise<ItemChanges<T, K>>;
|
|
68
|
+
get(id: string): Promise<ItemValue<T[K]>>;
|
|
69
|
+
add(data: T[K]): Promise<string>;
|
|
70
|
+
set(id: string, data: T[K]): Promise<void>;
|
|
71
|
+
update(id: string, updates: Updates<T[K]>): Promise<void>;
|
|
72
|
+
delete(id: string): Promise<void>;
|
|
45
73
|
}
|
|
46
74
|
export {};
|
|
@@ -3,9 +3,25 @@ import { AsyncQuery, Query } from "./Query.js";
|
|
|
3
3
|
import { changeAsyncProvider, changeProvider } from "./Change.js";
|
|
4
4
|
/** Reference to a collection in a synchronous or asynchronous provider. */
|
|
5
5
|
class BaseCollection {
|
|
6
|
+
/** Subscribe a document from a collection in this database. */
|
|
7
|
+
subscribe(id, next) {
|
|
8
|
+
return this.db.subscribe(this.collection, id, typeof next === "function" ? { next } : next);
|
|
9
|
+
}
|
|
6
10
|
/** Get an add change for this collection. */
|
|
7
11
|
getAdd(data) {
|
|
8
|
-
return
|
|
12
|
+
return this.db.getAdd(this.collection, data);
|
|
13
|
+
}
|
|
14
|
+
/** Get a set change for this collection. */
|
|
15
|
+
getSet(id, data) {
|
|
16
|
+
return this.db.getSet(this.collection, id, data);
|
|
17
|
+
}
|
|
18
|
+
/** Get an update change for this collection. */
|
|
19
|
+
getUpdate(id, updates) {
|
|
20
|
+
return this.db.getUpdate(this.collection, id, updates);
|
|
21
|
+
}
|
|
22
|
+
/** Get a delete change for this collection. */
|
|
23
|
+
getDelete(id) {
|
|
24
|
+
return this.db.getDelete(this.collection, id);
|
|
9
25
|
}
|
|
10
26
|
// Implement toString()
|
|
11
27
|
toString() {
|
|
@@ -25,12 +41,24 @@ export class Collection extends BaseCollection {
|
|
|
25
41
|
item(id) {
|
|
26
42
|
return new Item(this.db, this.collection, id);
|
|
27
43
|
}
|
|
28
|
-
add(data) {
|
|
29
|
-
return this.db.provider.addItem(this.collection, data);
|
|
30
|
-
}
|
|
31
44
|
change(...changes) {
|
|
32
45
|
return changeProvider(this.db.provider, changes);
|
|
33
46
|
}
|
|
47
|
+
get(id) {
|
|
48
|
+
return this.db.get(this.collection, id);
|
|
49
|
+
}
|
|
50
|
+
add(data) {
|
|
51
|
+
return this.db.add(this.collection, data);
|
|
52
|
+
}
|
|
53
|
+
set(id, data) {
|
|
54
|
+
return this.db.set(this.collection, id, data);
|
|
55
|
+
}
|
|
56
|
+
update(id, updates) {
|
|
57
|
+
return this.db.update(this.collection, id, updates);
|
|
58
|
+
}
|
|
59
|
+
delete(id) {
|
|
60
|
+
return this.db.delete(this.collection, id);
|
|
61
|
+
}
|
|
34
62
|
}
|
|
35
63
|
/** Reference to a collection in an asynchronous provider. */
|
|
36
64
|
export class AsyncCollection extends BaseCollection {
|
|
@@ -45,10 +73,22 @@ export class AsyncCollection extends BaseCollection {
|
|
|
45
73
|
item(id) {
|
|
46
74
|
return new AsyncItem(this.db, this.collection, id);
|
|
47
75
|
}
|
|
48
|
-
add(data) {
|
|
49
|
-
return this.db.provider.addItem(this.collection, data);
|
|
50
|
-
}
|
|
51
76
|
change(...changes) {
|
|
52
77
|
return changeAsyncProvider(this.db.provider, changes);
|
|
53
78
|
}
|
|
79
|
+
get(id) {
|
|
80
|
+
return this.db.get(this.collection, id);
|
|
81
|
+
}
|
|
82
|
+
add(data) {
|
|
83
|
+
return this.db.add(this.collection, data);
|
|
84
|
+
}
|
|
85
|
+
set(id, data) {
|
|
86
|
+
return this.db.set(this.collection, id, data);
|
|
87
|
+
}
|
|
88
|
+
update(id, updates) {
|
|
89
|
+
return this.db.update(this.collection, id, updates);
|
|
90
|
+
}
|
|
91
|
+
delete(id) {
|
|
92
|
+
return this.db.delete(this.collection, id);
|
|
93
|
+
}
|
|
54
94
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Key, Datas } from "../util/data.js";
|
|
2
|
+
import type { Nullish } from "../util/null.js";
|
|
3
|
+
import type { DeepIterable } from "../util/iterate.js";
|
|
4
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
5
|
+
import type { FilterList } from "../constraint/FilterConstraint.js";
|
|
6
|
+
import type { SortList } from "../constraint/SortConstraint.js";
|
|
7
|
+
import type { ItemData, ItemValue } from "../db/Item.js";
|
|
8
|
+
import type { Updates } from "../update/DataUpdate.js";
|
|
9
|
+
import type { PartialObserver } from "../observe/Observer.js";
|
|
10
|
+
import type { Dispatch } from "../util/function.js";
|
|
11
|
+
import type { Unsubscribe } from "../observe/Observable.js";
|
|
12
|
+
import { Item, AsyncItem } from "./Item.js";
|
|
13
|
+
import { Query, AsyncQuery } from "./Query.js";
|
|
14
|
+
import { Collection, AsyncCollection } from "./Collection.js";
|
|
15
|
+
import { AddChange, DeleteChange, ItemChanges, SetChange, UpdateChange, WriteChange } from "./Change.js";
|
|
16
|
+
/** Database with a synchronous or asynchronous provider. */
|
|
17
|
+
declare abstract class BaseDatabase<T extends Datas> {
|
|
18
|
+
abstract readonly provider: Provider<T> | AsyncProvider<T>;
|
|
19
|
+
/** Create a query on a collection in this database. */
|
|
20
|
+
abstract collection<K extends Key<T>>(collection: K): Collection<T, K> | AsyncCollection<T, K>;
|
|
21
|
+
/** Create a query on a collection in this database. */
|
|
22
|
+
abstract query<K extends Key<T>>(collection: K, filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): Query<T, K> | AsyncQuery<T, K>;
|
|
23
|
+
/** Reference an item in a collection in this database. */
|
|
24
|
+
abstract item<K extends Key<T>>(collection: K, id: string): Item<T, K> | AsyncItem<T, K>;
|
|
25
|
+
/** Run a set of changes in this database. */
|
|
26
|
+
abstract change(...changes: DeepIterable<Nullish<WriteChange<T>>>[]): ItemChanges<T> | Promise<ItemChanges<T>>;
|
|
27
|
+
/** Get a document from a collection in this database. */
|
|
28
|
+
abstract get<K extends Key<T>>(collection: K, id: string): ItemValue<T[K]> | Promise<ItemValue<T[K]>>;
|
|
29
|
+
/** Subscribe a document from a collection in this database. */
|
|
30
|
+
subscribe<K extends Key<T>>(collection: K, id: string, next: PartialObserver<ItemValue<T[K]>> | Dispatch<[ItemValue<T[K]>]>): Unsubscribe;
|
|
31
|
+
/** Add a document to a collection in this database. */
|
|
32
|
+
abstract add<K extends Key<T>>(collection: K, data: T[K]): string | Promise<string>;
|
|
33
|
+
/** Set a document in a collection in this database. */
|
|
34
|
+
abstract set<K extends Key<T>>(collection: K, id: string, data: T[K]): void | Promise<void>;
|
|
35
|
+
/** Update a document in a collection in this database. */
|
|
36
|
+
abstract update<K extends Key<T>>(collection: K, id: string, updates: Updates<T[K]>): void | Promise<void>;
|
|
37
|
+
/** Delete a document from a collection in this database. */
|
|
38
|
+
abstract delete<K extends Key<T>>(collection: K, id: string): void | Promise<void>;
|
|
39
|
+
/** Get an add change for a collection in this database. */
|
|
40
|
+
getAdd<K extends Key<T>>(collection: K, data: T[K]): AddChange<T, K>;
|
|
41
|
+
/** Get a set change for a collection in this database. */
|
|
42
|
+
getSet<K extends Key<T>>(collection: K, id: string, data: T[K]): SetChange<T, K>;
|
|
43
|
+
/** Get an update change for a collection in this database. */
|
|
44
|
+
getUpdate<K extends Key<T>>(collection: K, id: string, updates: Updates<T[K]>): UpdateChange<T, K>;
|
|
45
|
+
/** Get a delete change for a collection in this database. */
|
|
46
|
+
getDelete<K extends Key<T>>(collection: K, id: string): DeleteChange<T, K>;
|
|
47
|
+
}
|
|
48
|
+
/** Database with a synchronous provider. */
|
|
49
|
+
export declare class Database<T extends Datas = Datas> extends BaseDatabase<T> {
|
|
50
|
+
readonly provider: Provider<T>;
|
|
51
|
+
constructor(provider: Provider<T>);
|
|
52
|
+
collection<K extends Key<T>>(collection: K): Collection<T, K>;
|
|
53
|
+
query<K extends Key<T>>(collection: K, filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): Query<T, K>;
|
|
54
|
+
item<K extends Key<T>>(collection: K, id: string): Item<T, K>;
|
|
55
|
+
change(...changes: DeepIterable<Nullish<WriteChange<T>>>[]): ItemChanges<T>;
|
|
56
|
+
get<K extends Key<T>>(collection: K, id: string): ItemValue<T[K]>;
|
|
57
|
+
add<K extends Key<T>>(collection: K, data: T[K]): string;
|
|
58
|
+
set<K extends Key<T>>(collection: K, id: string, data: T[K]): void;
|
|
59
|
+
update<K extends Key<T>>(collection: K, id: string, updates: Updates<T[K]>): void;
|
|
60
|
+
delete<K extends Key<T>>(collection: K, id: string): void;
|
|
61
|
+
}
|
|
62
|
+
/** Database with a synchronous provider. */
|
|
63
|
+
export declare class AsyncDatabase<T extends Datas = Datas> extends BaseDatabase<T> {
|
|
64
|
+
readonly provider: AsyncProvider<T>;
|
|
65
|
+
constructor(provider: AsyncProvider<T>);
|
|
66
|
+
collection<K extends Key<T>>(collection: K): AsyncCollection<T, K>;
|
|
67
|
+
query<K extends Key<T>>(collection: K, filters?: FilterList<Partial<ItemData<T[K]>>>, sorts?: SortList<Partial<ItemData<T[K]>>>, limit?: number | null): AsyncQuery<T, K>;
|
|
68
|
+
item<K extends Key<T>>(collection: K, id: string): AsyncItem<T, K>;
|
|
69
|
+
change(...changes: DeepIterable<Nullish<WriteChange<T>>>[]): Promise<ItemChanges<T>>;
|
|
70
|
+
get<K extends Key<T>>(collection: K, id: string): Promise<ItemValue<T[K]>>;
|
|
71
|
+
add<K extends Key<T>>(collection: K, data: T[K]): Promise<string>;
|
|
72
|
+
set<K extends Key<T>>(collection: K, id: string, data: T[K]): Promise<void>;
|
|
73
|
+
update<K extends Key<T>>(collection: K, id: string, updates: Updates<T[K]>): Promise<void>;
|
|
74
|
+
delete<K extends Key<T>>(collection: K, id: string): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Item, AsyncItem } from "./Item.js";
|
|
2
|
+
import { Query, AsyncQuery } from "./Query.js";
|
|
3
|
+
import { Collection, AsyncCollection } from "./Collection.js";
|
|
4
|
+
import { changeAsyncProvider, changeProvider } from "./Change.js";
|
|
5
|
+
/** Database with a synchronous or asynchronous provider. */
|
|
6
|
+
class BaseDatabase {
|
|
7
|
+
/** Subscribe a document from a collection in this database. */
|
|
8
|
+
subscribe(collection, id, next) {
|
|
9
|
+
return this.provider.subscribeItem(collection, id, typeof next === "function" ? { next } : next);
|
|
10
|
+
}
|
|
11
|
+
/** Get an add change for a collection in this database. */
|
|
12
|
+
getAdd(collection, data) {
|
|
13
|
+
return { action: "ADD", collection, data };
|
|
14
|
+
}
|
|
15
|
+
/** Get a set change for a collection in this database. */
|
|
16
|
+
getSet(collection, id, data) {
|
|
17
|
+
return { action: "SET", collection, id, data };
|
|
18
|
+
}
|
|
19
|
+
/** Get an update change for a collection in this database. */
|
|
20
|
+
getUpdate(collection, id, updates) {
|
|
21
|
+
return { action: "UPDATE", collection, id, updates };
|
|
22
|
+
}
|
|
23
|
+
/** Get a delete change for a collection in this database. */
|
|
24
|
+
getDelete(collection, id) {
|
|
25
|
+
return { action: "DELETE", collection, id };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Database with a synchronous provider. */
|
|
29
|
+
export class Database extends BaseDatabase {
|
|
30
|
+
constructor(provider) {
|
|
31
|
+
super();
|
|
32
|
+
this.provider = provider;
|
|
33
|
+
}
|
|
34
|
+
collection(collection) {
|
|
35
|
+
return new Collection(this, collection);
|
|
36
|
+
}
|
|
37
|
+
query(collection, filters, sorts, limit) {
|
|
38
|
+
return new Query(this, collection, filters, sorts, limit);
|
|
39
|
+
}
|
|
40
|
+
item(collection, id) {
|
|
41
|
+
return new Item(this, collection, id);
|
|
42
|
+
}
|
|
43
|
+
change(...changes) {
|
|
44
|
+
return changeProvider(this.provider, changes);
|
|
45
|
+
}
|
|
46
|
+
get(collection, id) {
|
|
47
|
+
return this.provider.getItem(collection, id);
|
|
48
|
+
}
|
|
49
|
+
add(collection, data) {
|
|
50
|
+
return this.provider.addItem(collection, data);
|
|
51
|
+
}
|
|
52
|
+
set(collection, id, data) {
|
|
53
|
+
return this.provider.setItem(collection, id, data);
|
|
54
|
+
}
|
|
55
|
+
update(collection, id, updates) {
|
|
56
|
+
return this.provider.updateItem(collection, id, updates);
|
|
57
|
+
}
|
|
58
|
+
delete(collection, id) {
|
|
59
|
+
return this.provider.deleteItem(collection, id);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Database with a synchronous provider. */
|
|
63
|
+
export class AsyncDatabase extends BaseDatabase {
|
|
64
|
+
constructor(provider) {
|
|
65
|
+
super();
|
|
66
|
+
this.provider = provider;
|
|
67
|
+
}
|
|
68
|
+
collection(collection) {
|
|
69
|
+
return new AsyncCollection(this, collection);
|
|
70
|
+
}
|
|
71
|
+
query(collection, filters, sorts, limit) {
|
|
72
|
+
return new AsyncQuery(this, collection, filters, sorts, limit);
|
|
73
|
+
}
|
|
74
|
+
item(collection, id) {
|
|
75
|
+
return new AsyncItem(this, collection, id);
|
|
76
|
+
}
|
|
77
|
+
change(...changes) {
|
|
78
|
+
return changeAsyncProvider(this.provider, changes);
|
|
79
|
+
}
|
|
80
|
+
get(collection, id) {
|
|
81
|
+
return this.provider.getItem(collection, id);
|
|
82
|
+
}
|
|
83
|
+
add(collection, data) {
|
|
84
|
+
return this.provider.addItem(collection, data);
|
|
85
|
+
}
|
|
86
|
+
set(collection, id, data) {
|
|
87
|
+
return this.provider.setItem(collection, id, data);
|
|
88
|
+
}
|
|
89
|
+
update(collection, id, updates) {
|
|
90
|
+
return this.provider.updateItem(collection, id, updates);
|
|
91
|
+
}
|
|
92
|
+
delete(collection, id) {
|
|
93
|
+
return this.provider.deleteItem(collection, id);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -18,7 +18,7 @@ export declare type ItemValue<T extends Data = Data> = ItemData<T> | null;
|
|
|
18
18
|
export declare type ItemArray<T extends Data = Data> = ImmutableArray<ItemData<T>>;
|
|
19
19
|
/** A set of query constraints for item data. */
|
|
20
20
|
export declare type ItemConstraints<T extends Data = Data> = QueryConstraints<ItemData<T>>;
|
|
21
|
-
/** Reference to an item in a synchronous or asynchronous
|
|
21
|
+
/** Reference to an item in a synchronous or asynchronous database. */
|
|
22
22
|
declare abstract class BaseItem<T extends Datas = Datas, K extends Key<T> = Key<T>> implements Observable<ItemValue<T[K]>> {
|
|
23
23
|
abstract readonly db: Database<T> | AsyncDatabase<T>;
|
|
24
24
|
abstract readonly collection: K;
|
|
@@ -65,7 +65,7 @@ declare abstract class BaseItem<T extends Datas = Datas, K extends Key<T> = Key<
|
|
|
65
65
|
getDelete(): DeleteChange<T, K>;
|
|
66
66
|
toString(): `${K}/${string}`;
|
|
67
67
|
}
|
|
68
|
-
/** Reference to an item in a synchronous
|
|
68
|
+
/** Reference to an item in a synchronous database. */
|
|
69
69
|
export declare class Item<T extends Datas = Datas, K extends Key<T> = Key<T>> extends BaseItem<T, K> {
|
|
70
70
|
readonly db: Database<T>;
|
|
71
71
|
readonly collection: K;
|
|
@@ -79,12 +79,12 @@ export declare class Item<T extends Datas = Datas, K extends Key<T> = Key<T>> ex
|
|
|
79
79
|
update(updates: Updates<T[K]>): void;
|
|
80
80
|
delete(): void;
|
|
81
81
|
}
|
|
82
|
-
/** Reference to an item in an asynchronous
|
|
82
|
+
/** Reference to an item in an asynchronous database. */
|
|
83
83
|
export declare class AsyncItem<T extends Datas = Datas, K extends Key<T> = Key<T>> extends BaseItem<T, K> {
|
|
84
84
|
readonly db: AsyncDatabase<T>;
|
|
85
85
|
readonly collection: K;
|
|
86
86
|
readonly id: string;
|
|
87
|
-
constructor(
|
|
87
|
+
constructor(db: AsyncDatabase<T>, collection: K, id: string);
|
|
88
88
|
get optional(): AsyncQuery<T, K>;
|
|
89
89
|
get exists(): Promise<boolean>;
|
|
90
90
|
get value(): Promise<ItemValue<T[K]>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getData } from "../util/data.js";
|
|
2
2
|
import { FilterConstraint } from "../constraint/FilterConstraint.js";
|
|
3
|
-
/** Reference to an item in a synchronous or asynchronous
|
|
3
|
+
/** Reference to an item in a synchronous or asynchronous database. */
|
|
4
4
|
class BaseItem {
|
|
5
5
|
/**
|
|
6
6
|
* Subscribe to the result of this item (indefinitely).
|
|
@@ -10,26 +10,26 @@ class BaseItem {
|
|
|
10
10
|
* @return Function that ends the subscription.
|
|
11
11
|
*/
|
|
12
12
|
subscribe(next) {
|
|
13
|
-
return this.db.
|
|
13
|
+
return this.db.subscribe(this.collection, this.id, next);
|
|
14
14
|
}
|
|
15
15
|
/** Get a set change for this item. */
|
|
16
16
|
getSet(data) {
|
|
17
|
-
return
|
|
17
|
+
return this.db.getSet(this.collection, this.id, data);
|
|
18
18
|
}
|
|
19
19
|
/** Get an update change for this item. */
|
|
20
20
|
getUpdate(updates) {
|
|
21
|
-
return
|
|
21
|
+
return this.db.getUpdate(this.collection, this.id, updates);
|
|
22
22
|
}
|
|
23
23
|
/** Get a delete change for this item. */
|
|
24
24
|
getDelete() {
|
|
25
|
-
return
|
|
25
|
+
return this.db.getDelete(this.collection, this.id);
|
|
26
26
|
}
|
|
27
27
|
// Implement toString()
|
|
28
28
|
toString() {
|
|
29
29
|
return `${this.collection}/${this.id}`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
/** Reference to an item in a synchronous
|
|
32
|
+
/** Reference to an item in a synchronous database. */
|
|
33
33
|
export class Item extends BaseItem {
|
|
34
34
|
constructor(db, collection, id) {
|
|
35
35
|
super();
|
|
@@ -41,29 +41,29 @@ export class Item extends BaseItem {
|
|
|
41
41
|
return this.db.query(this.collection, new FilterConstraint("id", this.id), undefined, 1);
|
|
42
42
|
}
|
|
43
43
|
get exists() {
|
|
44
|
-
return !!this.db.
|
|
44
|
+
return !!this.db.get(this.collection, this.id);
|
|
45
45
|
}
|
|
46
46
|
get value() {
|
|
47
|
-
return this.db.
|
|
47
|
+
return this.db.get(this.collection, this.id);
|
|
48
48
|
}
|
|
49
49
|
get data() {
|
|
50
50
|
return getData(this.value);
|
|
51
51
|
}
|
|
52
52
|
set(data) {
|
|
53
|
-
return this.db.
|
|
53
|
+
return this.db.set(this.collection, this.id, data);
|
|
54
54
|
}
|
|
55
55
|
update(updates) {
|
|
56
|
-
return this.db.
|
|
56
|
+
return this.db.update(this.collection, this.id, updates);
|
|
57
57
|
}
|
|
58
58
|
delete() {
|
|
59
|
-
return this.db.
|
|
59
|
+
return this.db.delete(this.collection, this.id);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
/** Reference to an item in an asynchronous
|
|
62
|
+
/** Reference to an item in an asynchronous database. */
|
|
63
63
|
export class AsyncItem extends BaseItem {
|
|
64
|
-
constructor(
|
|
64
|
+
constructor(db, collection, id) {
|
|
65
65
|
super();
|
|
66
|
-
this.db =
|
|
66
|
+
this.db = db;
|
|
67
67
|
this.collection = collection;
|
|
68
68
|
this.id = id;
|
|
69
69
|
}
|
|
@@ -71,22 +71,22 @@ export class AsyncItem extends BaseItem {
|
|
|
71
71
|
return this.db.query(this.collection, new FilterConstraint("id", this.id), undefined, 1);
|
|
72
72
|
}
|
|
73
73
|
get exists() {
|
|
74
|
-
return this.db.
|
|
74
|
+
return this.db.get(this.collection, this.id).then(Boolean);
|
|
75
75
|
}
|
|
76
76
|
get value() {
|
|
77
|
-
return this.db.
|
|
77
|
+
return this.db.get(this.collection, this.id);
|
|
78
78
|
}
|
|
79
79
|
get data() {
|
|
80
80
|
return this.value.then(getData);
|
|
81
81
|
}
|
|
82
82
|
set(data) {
|
|
83
|
-
return this.db.
|
|
83
|
+
return this.db.set(this.collection, this.id, data);
|
|
84
84
|
}
|
|
85
85
|
update(updates) {
|
|
86
|
-
return this.db.
|
|
86
|
+
return this.db.update(this.collection, this.id, updates);
|
|
87
87
|
}
|
|
88
88
|
delete() {
|
|
89
|
-
return this.db.
|
|
89
|
+
return this.db.delete(this.collection, this.id);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
/** Get the ID from item data. */
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,15 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
7
|
import { setPrototype } from "../util/class.js";
|
|
11
8
|
import { Feedback } from "./Feedback.js";
|
|
12
9
|
/** Specific type of `Feedback` to indicate an error (something went wrong). */
|
|
13
10
|
export class ErrorFeedback extends Feedback {
|
|
14
11
|
}
|
|
15
12
|
__decorate([
|
|
16
|
-
setPrototype("name", "ErrorFeedback")
|
|
17
|
-
__metadata("design:type", String)
|
|
13
|
+
setPrototype("name", "ErrorFeedback")
|
|
18
14
|
], ErrorFeedback.prototype, "name", void 0);
|
|
File without changes
|
|
@@ -4,9 +4,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
7
|
import { isObject } from "../util/object.js";
|
|
11
8
|
import { getEntries } from "../util/entry.js";
|
|
12
9
|
import { setPrototype } from "../util/class.js";
|
|
@@ -28,8 +25,7 @@ export class Feedback {
|
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
__decorate([
|
|
31
|
-
setPrototype("name", "Feedback")
|
|
32
|
-
__metadata("design:type", String)
|
|
28
|
+
setPrototype("name", "Feedback")
|
|
33
29
|
], Feedback.prototype, "name", void 0);
|
|
34
30
|
/** Is an unknown value a `Feedback` object. */
|
|
35
31
|
export const isFeedback = (v) => isObject(v) && typeof v.name === "string" && v.name.endsWith("Feedback") && typeof v.message === "string";
|
|
File without changes
|
|
@@ -4,15 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
7
|
import { setPrototype } from "../util/class.js";
|
|
11
8
|
import { ErrorFeedback } from "./ErrorFeedback.js";
|
|
12
9
|
/** Specific type of `ErrorFeedback` returned from `validate()` when a value is invalid. */
|
|
13
10
|
export class InvalidFeedback extends ErrorFeedback {
|
|
14
11
|
}
|
|
15
12
|
__decorate([
|
|
16
|
-
setPrototype("name", "InvalidFeedback")
|
|
17
|
-
__metadata("design:type", String)
|
|
13
|
+
setPrototype("name", "InvalidFeedback")
|
|
18
14
|
], InvalidFeedback.prototype, "name", void 0);
|
|
File without changes
|