shelving 1.91.1 → 1.91.2
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/Resource.d.ts +1 -1
- package/api/Resource.js +3 -3
- package/constraint/Constraints.d.ts +1 -1
- package/constraint/Constraints.js +1 -1
- package/constraint/Filter.d.ts +4 -4
- package/constraint/Filter.js +5 -3
- package/constraint/Filters.d.ts +3 -2
- package/constraint/Filters.js +3 -3
- package/constraint/Sort.d.ts +3 -3
- package/constraint/Sort.js +3 -1
- package/constraint/Sorts.d.ts +4 -3
- package/constraint/Statement.d.ts +4 -2
- package/constraint/Statement.js +4 -4
- package/db/Change.d.ts +4 -4
- package/db/Collection.d.ts +5 -4
- package/db/Database.d.ts +7 -7
- package/db/Database.js +3 -3
- package/db/Item.d.ts +5 -5
- package/db/Item.js +1 -1
- package/db/ItemState.d.ts +3 -3
- package/db/ItemState.js +4 -4
- package/db/Query.d.ts +5 -5
- package/db/Query.js +2 -2
- package/db/QueryState.d.ts +3 -3
- package/db/QueryState.js +4 -4
- package/feedback/Feedback.d.ts +0 -2
- package/feedback/Feedback.js +0 -2
- package/feedback/Feedbacks.d.ts +2 -2
- package/feedback/Feedbacks.js +6 -3
- package/firestore/client/FirestoreClientProvider.d.ts +4 -4
- package/firestore/client/FirestoreClientProvider.js +7 -2
- package/firestore/lite/FirestoreLiteProvider.d.ts +4 -4
- package/firestore/lite/FirestoreLiteProvider.js +7 -2
- package/firestore/server/FirestoreServerProvider.d.ts +4 -4
- package/firestore/server/FirestoreServerProvider.js +7 -2
- package/markup/regexp.d.ts +2 -2
- package/markup/render.d.ts +1 -1
- package/markup/rule.d.ts +5 -5
- package/markup/rules.d.ts +3 -2
- package/markup/rules.js +1 -1
- package/package.json +3 -4
- package/provider/CacheProvider.d.ts +3 -3
- package/provider/DebugProvider.d.ts +3 -3
- package/provider/MemoryProvider.d.ts +3 -3
- package/provider/MemoryProvider.js +3 -3
- package/provider/Provider.d.ts +1 -1
- package/provider/ThroughProvider.d.ts +3 -3
- package/provider/ValidationProvider.d.ts +5 -5
- package/provider/ValidationProvider.js +2 -2
- package/react/createCache.js +1 -1
- package/react/useData.d.ts +1 -1
- package/react/useData.js +3 -3
- package/react/useLazy.d.ts +1 -1
- package/react/useState.d.ts +1 -1
- package/schema/AllowSchema.d.ts +3 -2
- package/schema/AllowSchema.js +2 -2
- package/schema/ArraySchema.d.ts +4 -3
- package/schema/ArraySchema.js +1 -1
- package/schema/BooleanSchema.d.ts +2 -1
- package/schema/DataSchema.d.ts +4 -3
- package/schema/DataSchema.js +1 -1
- package/schema/DateSchema.d.ts +3 -2
- package/schema/DateSchema.js +2 -2
- package/schema/DictionarySchema.d.ts +4 -3
- package/schema/DictionarySchema.js +1 -1
- package/schema/KeySchema.js +1 -1
- package/schema/LinkSchema.d.ts +2 -1
- package/schema/NumberSchema.d.ts +2 -1
- package/schema/NumberSchema.js +2 -2
- package/schema/OptionalSchema.d.ts +1 -1
- package/schema/PhoneSchema.js +1 -1
- package/schema/RequiredSchema.d.ts +1 -1
- package/schema/StringSchema.d.ts +2 -1
- package/schema/StringSchema.js +1 -1
- package/schema/ThroughSchema.d.ts +2 -1
- package/schema/TimeSchema.d.ts +4 -2
- package/schema/TimeSchema.js +1 -1
- package/state/ArrayState.d.ts +1 -1
- package/state/ArrayState.js +1 -1
- package/state/DataState.d.ts +2 -2
- package/state/DataState.js +1 -1
- package/state/DictionaryState.d.ts +2 -2
- package/state/DictionaryState.js +1 -1
- package/state/State.d.ts +1 -1
- package/state/State.js +1 -1
- package/test/basics.d.ts +1 -1
- package/test/basics.js +1 -1
- package/test/people.d.ts +1 -1
- package/test/util.d.ts +2 -2
- package/update/ArrayUpdate.d.ts +1 -1
- package/update/ArrayUpdate.js +1 -1
- package/update/DataUpdate.d.ts +3 -3
- package/update/DictionaryUpdate.d.ts +3 -3
- package/update/DictionaryUpdate.js +3 -3
- package/update/hydrations.d.ts +1 -1
- package/update/hydrations.js +3 -3
- package/util/activity.d.ts +1 -1
- package/util/array.d.ts +0 -4
- package/util/array.js +1 -8
- package/util/async.d.ts +1 -1
- package/util/class.d.ts +1 -1
- package/util/class.js +1 -1
- package/util/diff.d.ts +2 -2
- package/util/duration.d.ts +1 -1
- package/util/duration.js +1 -1
- package/util/entry.d.ts +3 -3
- package/util/equal.d.ts +3 -3
- package/util/equal.js +1 -1
- package/util/hydrate.d.ts +2 -2
- package/util/hydrate.js +1 -1
- package/util/iterate.d.ts +0 -4
- package/util/iterate.js +5 -7
- package/util/lazy.d.ts +1 -1
- package/util/map.d.ts +1 -1
- package/util/match.d.ts +6 -1
- package/util/match.js +13 -0
- package/util/merge.d.ts +2 -2
- package/util/object.d.ts +1 -1
- package/util/regexp.d.ts +2 -2
- package/util/sequence.d.ts +1 -1
- package/util/sort.d.ts +1 -1
- package/util/string.d.ts +1 -1
- package/util/string.js +2 -2
- package/util/template.d.ts +1 -1
- package/util/template.js +2 -2
- package/util/transform.d.ts +3 -3
- package/util/units.d.ts +4 -3
- package/util/units.js +2 -2
- package/util/validate.d.ts +3 -3
- package/util/validate.js +2 -2
package/api/Resource.d.ts
CHANGED
package/api/Resource.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { validate } from "../util/validate.js";
|
|
2
|
-
import { getUndefined } from "../util/undefined.js";
|
|
3
|
-
import { Feedback } from "../feedback/Feedback.js";
|
|
4
1
|
import { ValidationError } from "../error/ValidationError.js";
|
|
2
|
+
import { Feedback } from "../feedback/Feedback.js";
|
|
3
|
+
import { getUndefined } from "../util/undefined.js";
|
|
4
|
+
import { validate } from "../util/validate.js";
|
|
5
5
|
/**
|
|
6
6
|
* An abstract API resource definition, used to specify types for e.g. serverless functions..
|
|
7
7
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ImmutableArray } from "../util/array.js";
|
|
1
2
|
import type { Data } from "../util/data.js";
|
|
2
|
-
import { ImmutableArray } from "../util/array.js";
|
|
3
3
|
import { Constraint } from "./Constraint.js";
|
|
4
4
|
/** Type of Rule that is powered by several sub-constraints (e.g. `Filters` and `Sorts` and `Query` itself extend this). */
|
|
5
5
|
export declare abstract class Constraints<T extends Data, C extends Constraint<Partial<T>>> extends Constraint<T> implements Iterable<C> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { omitArrayItems, withArrayItems } from "../util/array.js";
|
|
1
2
|
import { cloneObjectWith } from "../util/object.js";
|
|
2
|
-
import { withArrayItems, omitArrayItems } from "../util/array.js";
|
|
3
3
|
import { Constraint } from "./Constraint.js";
|
|
4
4
|
/** Type of Rule that is powered by several sub-constraints (e.g. `Filters` and `Sorts` and `Query` itself extend this). */
|
|
5
5
|
export class Constraints extends Constraint {
|
package/constraint/Filter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ImmutableArray } from "../util/array.js";
|
|
2
|
+
import type { Data, FlatDataKey } from "../util/data.js";
|
|
3
3
|
import type { Matchable } from "../util/match.js";
|
|
4
|
-
import
|
|
4
|
+
import { Constraint } from "./Constraint.js";
|
|
5
5
|
/** Possible operator references. */
|
|
6
6
|
export type FilterOperator = "IS" | "NOT" | "IN" | "OUT" | "CONTAINS" | "LT" | "LTE" | "GT" | "GTE";
|
|
7
7
|
/** Format that allows multiple filters to be specified as a plain object. */
|
|
@@ -21,7 +21,7 @@ export type FilterKey<T extends Data> = keyof FilterProps<T>;
|
|
|
21
21
|
* @param operator FilterOperator, e.g. `IS` or `CONTAINS`
|
|
22
22
|
* @param value Value the specified property should be matched against.
|
|
23
23
|
*/
|
|
24
|
-
export declare class Filter<T extends Data = Data>
|
|
24
|
+
export declare class Filter<T extends Data = Data> extends Constraint<T> implements Matchable<[T]> {
|
|
25
25
|
readonly keys: readonly [string, ...string[]];
|
|
26
26
|
readonly operator: FilterOperator;
|
|
27
27
|
readonly value: unknown;
|
package/constraint/Filter.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isArray } from "../util/array.js";
|
|
2
|
-
import { isArrayWith, isEqualGreater, isEqualLess, isGreater, isInArray, isLess,
|
|
3
|
-
import { filterItems } from "../util/
|
|
2
|
+
import { isArrayWith, isEqual, isEqualGreater, isEqualLess, isGreater, isInArray, isLess, notEqual, notInArray } from "../util/equal.js";
|
|
3
|
+
import { filterItems } from "../util/match.js";
|
|
4
4
|
import { getProp } from "../util/object.js";
|
|
5
5
|
import { splitString } from "../util/string.js";
|
|
6
|
+
import { Constraint } from "./Constraint.js";
|
|
6
7
|
/** Map `FilterOperator` to its corresponding `Match` function. */
|
|
7
8
|
const MATCHERS = {
|
|
8
9
|
IS: isEqual,
|
|
@@ -22,7 +23,7 @@ const MATCHERS = {
|
|
|
22
23
|
* @param operator FilterOperator, e.g. `IS` or `CONTAINS`
|
|
23
24
|
* @param value Value the specified property should be matched against.
|
|
24
25
|
*/
|
|
25
|
-
export class Filter {
|
|
26
|
+
export class Filter extends Constraint {
|
|
26
27
|
get key() {
|
|
27
28
|
return this.keys.join(".");
|
|
28
29
|
}
|
|
@@ -45,6 +46,7 @@ export class Filter {
|
|
|
45
46
|
: operator; // Never.
|
|
46
47
|
}
|
|
47
48
|
constructor(filterKey, value) {
|
|
49
|
+
super();
|
|
48
50
|
if (filterKey.startsWith("!")) {
|
|
49
51
|
this.keys = splitString(filterKey.slice(1), ".");
|
|
50
52
|
this.operator = isArray(value) ? "OUT" : "NOT";
|
package/constraint/Filters.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { FilterProps } from "./Filter.js";
|
|
2
|
+
import type { Data } from "../util/data.js";
|
|
1
3
|
import type { Matchable } from "../util/match.js";
|
|
2
|
-
import { Data } from "../util/data.js";
|
|
3
|
-
import { Filter, FilterProps } from "./Filter.js";
|
|
4
4
|
import { Constraints } from "./Constraints.js";
|
|
5
|
+
import { Filter } from "./Filter.js";
|
|
5
6
|
/** A possible set of filters. */
|
|
6
7
|
export type PossibleFilters<T extends Data> = Filters<T> | FilterProps<T>;
|
|
7
8
|
/** Turn `FilterProps` into a list of `Filter` instances. */
|
package/constraint/Filters.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { clearArray } from "../util/array.js";
|
|
1
2
|
import { getDataProps } from "../util/data.js";
|
|
2
|
-
import { filterItems } from "../util/
|
|
3
|
+
import { filterItems } from "../util/match.js";
|
|
3
4
|
import { cloneObjectWith } from "../util/object.js";
|
|
4
|
-
import { clearArray } from "../util/array.js";
|
|
5
|
-
import { Filter } from "./Filter.js";
|
|
6
5
|
import { Constraints } from "./Constraints.js";
|
|
6
|
+
import { Filter } from "./Filter.js";
|
|
7
7
|
/** Turn `FilterProps` into a list of `Filter` instances. */
|
|
8
8
|
export function* getFilters(filters) {
|
|
9
9
|
if (filters instanceof Filters)
|
package/constraint/Sort.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Data, FlatDataKey } from "../util/data.js";
|
|
2
|
-
import { Rankable } from "../util/sort.js";
|
|
3
|
-
import
|
|
2
|
+
import type { Rankable } from "../util/sort.js";
|
|
3
|
+
import { Constraint } from "./Constraint.js";
|
|
4
4
|
/** Format that allows sorts to be set as a plain string, e.g. `name` sorts by name in ascending order and `!date` sorts by date in descending order. */
|
|
5
5
|
export type SortKey<T extends Data> = FlatDataKey<T> | `${FlatDataKey<T>}` | `!${FlatDataKey<T>}`;
|
|
6
6
|
/** Possible operator references. */
|
|
7
7
|
export type SortDirection = "ASC" | "DESC";
|
|
8
8
|
/** Sort a list of values. */
|
|
9
|
-
export declare class Sort<T extends Data = Data>
|
|
9
|
+
export declare class Sort<T extends Data = Data> extends Constraint<T> implements Rankable<T> {
|
|
10
10
|
readonly keys: readonly [string, ...string[]];
|
|
11
11
|
readonly direction: SortDirection;
|
|
12
12
|
get key(): string;
|
package/constraint/Sort.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getProp } from "../util/object.js";
|
|
2
2
|
import { rank, rankAsc, rankDesc, sortItems } from "../util/sort.js";
|
|
3
3
|
import { splitString } from "../util/string.js";
|
|
4
|
+
import { Constraint } from "./Constraint.js";
|
|
4
5
|
/** Sort a list of values. */
|
|
5
|
-
export class Sort {
|
|
6
|
+
export class Sort extends Constraint {
|
|
6
7
|
get key() {
|
|
7
8
|
return this.keys.join(".");
|
|
8
9
|
}
|
|
@@ -10,6 +11,7 @@ export class Sort {
|
|
|
10
11
|
return `"${this.direction === "DESC" ? "!" : ""}${this.key}"`;
|
|
11
12
|
}
|
|
12
13
|
constructor(sortKey) {
|
|
14
|
+
super();
|
|
13
15
|
if (sortKey.startsWith("!")) {
|
|
14
16
|
this.keys = splitString(sortKey.slice(1), ".");
|
|
15
17
|
this.direction = "DESC";
|
package/constraint/Sorts.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { SortKey } from "./Sort.js";
|
|
2
|
+
import type { ImmutableArray } from "../util/array.js";
|
|
1
3
|
import type { Data } from "../util/data.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Rankable } from "../util/sort.js";
|
|
4
|
+
import type { Rankable } from "../util/sort.js";
|
|
4
5
|
import { Constraints } from "./Constraints.js";
|
|
5
|
-
import { Sort
|
|
6
|
+
import { Sort } from "./Sort.js";
|
|
6
7
|
/** A possible set of sorts. */
|
|
7
8
|
export type PossibleSorts<T extends Data> = Sorts<T> | SortKey<T> | Iterable<SortKey<T>> | ImmutableArray<SortKey<T>>;
|
|
8
9
|
/** Turn `SortList` into array of list of `Sort` instances. */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Filterable, PossibleFilters } from "./Filters.js";
|
|
2
|
+
import type { PossibleSorts, Sortable } from "./Sorts.js";
|
|
1
3
|
import type { Data } from "../util/data.js";
|
|
2
|
-
import { Filterable, Filters, PossibleFilters } from "./Filters.js";
|
|
3
|
-
import { PossibleSorts, Sortable, Sorts } from "./Sorts.js";
|
|
4
4
|
import { Constraint } from "./Constraint.js";
|
|
5
|
+
import { Filters } from "./Filters.js";
|
|
6
|
+
import { Sorts } from "./Sorts.js";
|
|
5
7
|
/** Interface that combines Filterable, Sortable, Sliceable. */
|
|
6
8
|
export interface Queryable<T extends Data> extends Filterable<T>, Sortable<T> {
|
|
7
9
|
/**
|
package/constraint/Statement.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { cloneObjectWith, getProp } from "../util/object.js";
|
|
2
|
-
import { assert } from "../util/assert.js";
|
|
3
1
|
import { limitArray } from "../util/array.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { assert } from "../util/assert.js";
|
|
3
|
+
import { cloneObjectWith, getProp } from "../util/object.js";
|
|
6
4
|
import { Constraint } from "./Constraint.js";
|
|
7
5
|
import { Filter } from "./Filter.js";
|
|
6
|
+
import { Filters } from "./Filters.js";
|
|
7
|
+
import { Sorts } from "./Sorts.js";
|
|
8
8
|
// Instances to save resources for the default case (empty query).
|
|
9
9
|
const EMPTY_FILTERS = new Filters(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
10
10
|
const EMPTY_SORTS = new Sorts(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
package/db/Change.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
2
|
+
import type { Updates } from "../update/DataUpdate.js";
|
|
2
3
|
import type { ImmutableArray } from "../util/array.js";
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { Nullish } from "../util/null.js";
|
|
4
|
+
import type { Data } from "../util/data.js";
|
|
5
|
+
import type { Nullish } from "../util/null.js";
|
|
6
6
|
/** Change on a collection. */
|
|
7
7
|
export interface Change {
|
|
8
8
|
readonly action: string;
|
package/db/Collection.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AddChange, DeleteChange, SetChange, UpdateChange } from "./Change.js";
|
|
2
|
+
import type { ItemData, ItemValue } from "./Item.js";
|
|
2
3
|
import type { PossibleFilters } from "../constraint/Filters.js";
|
|
3
4
|
import type { PossibleSorts } from "../constraint/Sorts.js";
|
|
5
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
4
6
|
import type { Updates } from "../update/DataUpdate.js";
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
+
import type { Data } from "../util/data.js";
|
|
8
|
+
import { AsyncItem, Item } from "./Item.js";
|
|
7
9
|
import { AsyncQuery, Query } from "./Query.js";
|
|
8
|
-
import { AddChange, UpdateChange, DeleteChange, SetChange } from "./Change.js";
|
|
9
10
|
/** Reference to a collection in a synchronous or asynchronous provider. */
|
|
10
11
|
declare abstract class BaseCollection<T extends Data = Data> {
|
|
11
12
|
abstract readonly provider: Provider | AsyncProvider;
|
package/db/Database.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Nullish } from "../util/null.js";
|
|
3
|
-
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
1
|
+
import type { AddChange, DeleteChange, ItemChanges, SetChange, UpdateChange, WriteChange } from "./Change.js";
|
|
4
2
|
import type { PossibleFilters } from "../constraint/Filters.js";
|
|
5
3
|
import type { PossibleSorts } from "../constraint/Sorts.js";
|
|
6
4
|
import type { ItemData, ItemValue } from "../db/Item.js";
|
|
5
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
7
6
|
import type { Updates } from "../update/DataUpdate.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import type { DataKey, Datas } from "../util/data.js";
|
|
8
|
+
import type { Nullish } from "../util/null.js";
|
|
9
|
+
import { AsyncCollection, Collection } from "./Collection.js";
|
|
10
|
+
import { AsyncItem, Item } from "./Item.js";
|
|
11
|
+
import { AsyncQuery, Query } from "./Query.js";
|
|
12
12
|
/** Database with a synchronous or asynchronous provider. */
|
|
13
13
|
declare abstract class BaseDatabase<T extends Datas> {
|
|
14
14
|
abstract readonly provider: Provider | AsyncProvider;
|
package/db/Database.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Item, AsyncItem } from "./Item.js";
|
|
2
|
-
import { Query, AsyncQuery } from "./Query.js";
|
|
3
|
-
import { Collection, AsyncCollection } from "./Collection.js";
|
|
4
1
|
import { changeAsyncProvider, changeProvider } from "./Change.js";
|
|
2
|
+
import { AsyncCollection, Collection } from "./Collection.js";
|
|
3
|
+
import { AsyncItem, Item } from "./Item.js";
|
|
4
|
+
import { AsyncQuery, Query } from "./Query.js";
|
|
5
5
|
/** Database with a synchronous or asynchronous provider. */
|
|
6
6
|
class BaseDatabase {
|
|
7
7
|
/** Get an add change for a collection in this database. */
|
package/db/Item.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { Provider, AsyncProvider } from "../provider/Provider.js";
|
|
1
|
+
import type { DeleteChange, SetChange, UpdateChange } from "./Change.js";
|
|
2
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
4
3
|
import type { Updates } from "../update/DataUpdate.js";
|
|
4
|
+
import type { ImmutableArray } from "../util/array.js";
|
|
5
|
+
import type { Data } from "../util/data.js";
|
|
6
|
+
import type { Dispatch, Handler, Stop } from "../util/function.js";
|
|
5
7
|
import { Statement } from "../constraint/Statement.js";
|
|
6
|
-
import { Data } from "../util/data.js";
|
|
7
|
-
import type { DeleteChange, SetChange, UpdateChange } from "./Change.js";
|
|
8
8
|
/** Item data with a string ID that uniquely identifies it. */
|
|
9
9
|
export type ItemData<T extends Data = Data> = T & {
|
|
10
10
|
id: string;
|
package/db/Item.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Statement } from "../constraint/Statement.js";
|
|
2
1
|
import { Filter } from "../constraint/Filter.js";
|
|
3
2
|
import { Filters } from "../constraint/Filters.js";
|
|
3
|
+
import { Statement } from "../constraint/Statement.js";
|
|
4
4
|
import { getData } from "../util/data.js";
|
|
5
5
|
import { runSequence } from "../util/sequence.js";
|
|
6
6
|
/** Get the ID from item data. */
|
package/db/ItemState.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { AsyncItem, Item, ItemData, ItemValue } from "./Item.js";
|
|
2
|
+
import type { Data } from "../util/data.js";
|
|
1
3
|
import type { Dispatch } from "../util/function.js";
|
|
2
|
-
import { Data } from "../util/data.js";
|
|
3
|
-
import { State } from "../state/State.js";
|
|
4
4
|
import { BooleanState } from "../state/BooleanState.js";
|
|
5
|
-
import {
|
|
5
|
+
import { State } from "../state/State.js";
|
|
6
6
|
/** Hold the current state of a item. */
|
|
7
7
|
export declare class ItemState<T extends Data = Data> extends State<ItemValue<T>> {
|
|
8
8
|
readonly ref: Item<T> | AsyncItem<T>;
|
package/db/ItemState.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CacheProvider } from "../provider/CacheProvider.js";
|
|
2
|
+
import { LazyDeferredSequence } from "../sequence/LazyDeferredSequence.js";
|
|
3
3
|
import { BooleanState } from "../state/BooleanState.js";
|
|
4
|
+
import { State } from "../state/State.js";
|
|
5
|
+
import { getData } from "../util/data.js";
|
|
4
6
|
import { getOptionalSource } from "../util/source.js";
|
|
5
|
-
import { LazyDeferredSequence } from "../sequence/LazyDeferredSequence.js";
|
|
6
|
-
import { CacheProvider } from "../provider/CacheProvider.js";
|
|
7
7
|
/** Hold the current state of a item. */
|
|
8
8
|
export class ItemState extends State {
|
|
9
9
|
/** Get the data of the item (throws `RequiredError` if item doesn't exist). */
|
package/db/Query.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { ItemArray, ItemData, ItemValue } from "./Item.js";
|
|
2
|
+
import type { PossibleFilters } from "../constraint/Filters.js";
|
|
3
|
+
import type { PossibleSorts } from "../constraint/Sorts.js";
|
|
4
|
+
import type { AsyncProvider, Provider } from "../provider/Provider.js";
|
|
5
|
+
import type { Updates } from "../update/DataUpdate.js";
|
|
1
6
|
import type { Data } from "../util/data.js";
|
|
2
7
|
import type { Dispatch, Handler, Stop } from "../util/function.js";
|
|
3
|
-
import type { Updates } from "../update/DataUpdate.js";
|
|
4
|
-
import type { Provider, AsyncProvider } from "../provider/Provider.js";
|
|
5
8
|
import { Statement } from "../constraint/Statement.js";
|
|
6
|
-
import type { PossibleFilters } from "../constraint/Filters.js";
|
|
7
|
-
import type { PossibleSorts } from "../constraint/Sorts.js";
|
|
8
|
-
import type { ItemArray, ItemValue, ItemData } from "./Item.js";
|
|
9
9
|
/** Reference to a set of items in a sync or async provider. */
|
|
10
10
|
declare abstract class BaseQuery<T extends Data = Data> extends Statement<ItemData<T>> implements AsyncIterable<ItemArray<T>> {
|
|
11
11
|
abstract readonly provider: Provider | AsyncProvider;
|
package/db/Query.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getFirstItem, getLastItem, getOptionalFirstItem, getOptionalLastItem, isArrayLength, countArray } from "../util/array.js";
|
|
2
|
-
import { runSequence } from "../util/sequence.js";
|
|
3
1
|
import { Statement } from "../constraint/Statement.js";
|
|
2
|
+
import { countArray, getFirstItem, getLastItem, getOptionalFirstItem, getOptionalLastItem, isArrayLength } from "../util/array.js";
|
|
3
|
+
import { runSequence } from "../util/sequence.js";
|
|
4
4
|
/** Reference to a set of items in a sync or async provider. */
|
|
5
5
|
class BaseQuery extends Statement {
|
|
6
6
|
// Override to include the collection name.
|
package/db/QueryState.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { ItemArray, ItemData, ItemValue } from "../db/Item.js";
|
|
2
|
+
import type { AsyncQuery, Query } from "../db/Query.js";
|
|
1
3
|
import type { Data } from "../util/data.js";
|
|
2
4
|
import type { Stop } from "../util/function.js";
|
|
3
|
-
import type { ItemArray, ItemValue, ItemData } from "../db/Item.js";
|
|
4
|
-
import type { AsyncQuery, Query } from "../db/Query.js";
|
|
5
|
-
import { State } from "../state/State.js";
|
|
6
5
|
import { BooleanState } from "../state/BooleanState.js";
|
|
6
|
+
import { State } from "../state/State.js";
|
|
7
7
|
/** Hold the current state of a query. */
|
|
8
8
|
export declare class QueryState<T extends Data = Data> extends State<ItemArray<T>> implements Iterable<ItemData<T>> {
|
|
9
9
|
readonly ref: Query<T> | AsyncQuery<T>;
|
package/db/QueryState.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getFirstItem, getLastItem, getOptionalFirstItem, getOptionalLastItem } from "../util/array.js";
|
|
2
|
-
import { getOptionalSource } from "../util/source.js";
|
|
3
1
|
import { CacheProvider } from "../provider/CacheProvider.js";
|
|
4
|
-
import { State } from "../state/State.js";
|
|
5
|
-
import { BooleanState } from "../state/BooleanState.js";
|
|
6
2
|
import { LazyDeferredSequence } from "../sequence/LazyDeferredSequence.js";
|
|
3
|
+
import { BooleanState } from "../state/BooleanState.js";
|
|
4
|
+
import { State } from "../state/State.js";
|
|
5
|
+
import { getFirstItem, getLastItem, getOptionalFirstItem, getOptionalLastItem } from "../util/array.js";
|
|
6
|
+
import { getOptionalSource } from "../util/source.js";
|
|
7
7
|
/** Hold the current state of a query. */
|
|
8
8
|
export class QueryState extends State {
|
|
9
9
|
/** Can more items be loaded after the current result. */
|
package/feedback/Feedback.d.ts
CHANGED
package/feedback/Feedback.js
CHANGED
package/feedback/Feedbacks.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Feedback } from "./Feedback.js";
|
|
|
4
4
|
export declare class Feedbacks extends Feedback {
|
|
5
5
|
/** List of sub-feedbacks. */
|
|
6
6
|
readonly feedbacks: ImmutableDictionary<Feedback>;
|
|
7
|
+
/** List of sub-messages. */
|
|
8
|
+
get messages(): ImmutableDictionary<string>;
|
|
7
9
|
constructor(feedbacks: ImmutableDictionary<Feedback>, value?: unknown);
|
|
8
10
|
}
|
|
9
|
-
/** Get the messages from a feedbacks' sub-feedbacks. */
|
|
10
|
-
export declare const getFeedbackMessages: ({ feedbacks }: Feedbacks) => ImmutableDictionary<string>;
|
package/feedback/Feedbacks.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { getProp } from "../util/object.js";
|
|
1
2
|
import { mapDictionary } from "../util/transform.js";
|
|
2
|
-
import { Feedback
|
|
3
|
+
import { Feedback } from "./Feedback.js";
|
|
3
4
|
/** Feedback with a list of sub-feedbacks. */
|
|
4
5
|
export class Feedbacks extends Feedback {
|
|
6
|
+
/** List of sub-messages. */
|
|
7
|
+
get messages() {
|
|
8
|
+
return mapDictionary(this.feedbacks, getProp, "message");
|
|
9
|
+
}
|
|
5
10
|
constructor(feedbacks, value) {
|
|
6
11
|
super("Invalid format", value);
|
|
7
12
|
this.feedbacks = feedbacks;
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
|
-
/** Get the messages from a feedbacks' sub-feedbacks. */
|
|
11
|
-
export const getFeedbackMessages = ({ feedbacks }) => mapDictionary(feedbacks, getFeedbackMessage);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Data } from "../../util/data.js";
|
|
1
|
+
import type { ItemArray, ItemStatement, ItemValue } from "../../db/Item.js";
|
|
3
2
|
import type { AsyncProvider } from "../../provider/Provider.js";
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
3
|
+
import type { Updates } from "../../update/DataUpdate.js";
|
|
4
|
+
import type { Data } from "../../util/data.js";
|
|
5
|
+
import type { Firestore } from "firebase/firestore";
|
|
6
6
|
/**
|
|
7
7
|
* Firestore client database provider.
|
|
8
8
|
* - Works with the Firebase JS SDK.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDoc, deleteDoc, arrayRemove as firestoreArrayRemove, arrayUnion as firestoreArrayUnion, collection as firestoreCollection, deleteField as firestoreDeleteField, doc as firestoreDocument, documentId as firestoreDocumentId, increment as firestoreIncrement, limit as firestoreLimit, orderBy as firestoreOrderBy, query as firestoreQuery, where as firestoreWhere, getDoc, getDocs, onSnapshot, setDoc, updateDoc, } from "firebase/firestore";
|
|
2
2
|
import { LazyDeferredSequence } from "../../sequence/LazyDeferredSequence.js";
|
|
3
|
-
import { ArrayUpdate
|
|
3
|
+
import { ArrayUpdate } from "../../update/ArrayUpdate.js";
|
|
4
|
+
import { DataUpdate } from "../../update/DataUpdate.js";
|
|
5
|
+
import { Delete } from "../../update/Delete.js";
|
|
6
|
+
import { DictionaryUpdate } from "../../update/DictionaryUpdate.js";
|
|
7
|
+
import { Increment } from "../../update/Increment.js";
|
|
8
|
+
import { Update } from "../../update/Update.js";
|
|
4
9
|
// Constants.
|
|
5
10
|
const ID = firestoreDocumentId();
|
|
6
11
|
// Map `Filter.types` to `WhereFilterOp`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Data } from "../../util/data.js";
|
|
1
|
+
import type { ItemArray, ItemStatement, ItemValue } from "../../db/Item.js";
|
|
3
2
|
import type { AsyncProvider } from "../../provider/Provider.js";
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
3
|
+
import type { Updates } from "../../update/DataUpdate.js";
|
|
4
|
+
import type { Data } from "../../util/data.js";
|
|
5
|
+
import type { Firestore } from "firebase/firestore/lite";
|
|
6
6
|
/**
|
|
7
7
|
* Firestore Lite client database provider.
|
|
8
8
|
* - Works with the Firebase JS SDK.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDoc, deleteDoc, arrayRemove as firestoreArrayRemove, arrayUnion as firestoreArrayUnion, collection as firestoreCollection, deleteField as firestoreDeleteField, doc as firestoreDocument, documentId as firestoreDocumentId, increment as firestoreIncrement, limit as firestoreLimit, orderBy as firestoreOrderBy, query as firestoreQuery, where as firestoreWhere, getDoc, getDocs, setDoc, updateDoc, } from "firebase/firestore/lite";
|
|
2
2
|
import { UnsupportedError } from "../../error/UnsupportedError.js";
|
|
3
|
-
import { ArrayUpdate
|
|
3
|
+
import { ArrayUpdate } from "../../update/ArrayUpdate.js";
|
|
4
|
+
import { DataUpdate } from "../../update/DataUpdate.js";
|
|
5
|
+
import { Delete } from "../../update/Delete.js";
|
|
6
|
+
import { DictionaryUpdate } from "../../update/DictionaryUpdate.js";
|
|
7
|
+
import { Increment } from "../../update/Increment.js";
|
|
8
|
+
import { Update } from "../../update/Update.js";
|
|
4
9
|
// Constants.
|
|
5
10
|
const ID = firestoreDocumentId();
|
|
6
11
|
// Map `Filter.types` to `WhereFilterOp`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Data } from "../../util/data.js";
|
|
1
|
+
import type { ItemArray, ItemStatement, ItemValue } from "../../db/Item.js";
|
|
3
2
|
import type { AsyncProvider } from "../../provider/Provider.js";
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
3
|
+
import type { Updates } from "../../update/DataUpdate.js";
|
|
4
|
+
import type { Data } from "../../util/data.js";
|
|
5
|
+
import { Firestore } from "@google-cloud/firestore";
|
|
6
6
|
/**
|
|
7
7
|
* Firestore server database provider.
|
|
8
8
|
* - Works with the Firebase Admin SDK for Node.JS
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldPath, FieldValue, Firestore } from "@google-cloud/firestore";
|
|
2
2
|
import { LazyDeferredSequence } from "../../sequence/LazyDeferredSequence.js";
|
|
3
|
-
import { ArrayUpdate
|
|
3
|
+
import { ArrayUpdate } from "../../update/ArrayUpdate.js";
|
|
4
|
+
import { DataUpdate } from "../../update/DataUpdate.js";
|
|
5
|
+
import { Delete } from "../../update/Delete.js";
|
|
6
|
+
import { DictionaryUpdate } from "../../update/DictionaryUpdate.js";
|
|
7
|
+
import { Increment } from "../../update/Increment.js";
|
|
8
|
+
import { Update } from "../../update/Update.js";
|
|
4
9
|
// Constants.
|
|
5
10
|
const ID = FieldPath.documentId();
|
|
6
11
|
// Map `Filter.types` to `WhereFilterOp`
|
package/markup/regexp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Data } from "../util/data.js";
|
|
2
|
-
import { NamedRegExp, NamedRegExpData, PossibleRegExp } from "../util/regexp.js";
|
|
3
1
|
import type { MarkupOptions } from "./options.js";
|
|
2
|
+
import type { Data } from "../util/data.js";
|
|
3
|
+
import type { NamedRegExp, NamedRegExpData, PossibleRegExp } from "../util/regexp.js";
|
|
4
4
|
/** Subset of `NamedRegExpArray<T>` that are the only things we're required return from a `MarkupMatcher` function. */
|
|
5
5
|
export type MarkupMatch<T extends Data | undefined> = {
|
|
6
6
|
0: string;
|
package/markup/render.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { MarkupOptions } from "./options.js";
|
|
1
2
|
import type { JSXNode } from "../util/jsx.js";
|
|
2
|
-
import { MarkupOptions } from "./options.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parse a text string as Markdownish syntax and render it as a JSX node.
|
|
5
5
|
* - Syntax is not defined by this code, but by the rules supplied to it.
|
package/markup/rule.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { MarkupOptions } from "./options.js";
|
|
2
|
+
import type { ImmutableArray } from "../util/array.js";
|
|
3
|
+
import type { Data } from "../util/data.js";
|
|
4
|
+
import type { JSXElement } from "../util/jsx.js";
|
|
5
|
+
import type { NamedRegExp, NamedRegExpArray, NamedRegExpData } from "../util/regexp.js";
|
|
6
6
|
export type MarkupRuleMatch<T extends Data = Data> = {
|
|
7
7
|
0: string;
|
|
8
8
|
index: number;
|
package/markup/rules.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { JSXElement } from "../util/jsx.js";
|
|
2
1
|
import type { MarkupOptions } from "./options.js";
|
|
3
|
-
import {
|
|
2
|
+
import type { MarkupRules } from "./rule.js";
|
|
3
|
+
import type { JSXElement } from "../util/jsx.js";
|
|
4
|
+
import { LinkRegExpMarkupRule, NamedRegExpMarkupRule, RegExpMarkupRule } from "./rule.js";
|
|
4
5
|
/**
|
|
5
6
|
* Headings are single line only (don't allow multiline).
|
|
6
7
|
* - 1-6 hashes then 1+ spaces, then the title.
|
package/markup/rules.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
import { getRegExp } from "../util/regexp.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BLOCK_REGEXP, LINE_REGEXP, WordRegExp, getBlockRegExp, getLineRegExp } from "./regexp.js";
|
|
4
4
|
import { LinkRegExpMarkupRule, NamedRegExpMarkupRule, RegExpMarkupRule } from "./rule.js";
|
|
5
5
|
/** React security symbol — see https://github.com/facebook/react/pull/4832 */
|
|
6
6
|
const $$typeof = Symbol.for("react.element");
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"state-management",
|
|
12
12
|
"query-builder"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.91.
|
|
14
|
+
"version": "1.91.2",
|
|
15
15
|
"repository": "https://github.com/dhoulb/shelving",
|
|
16
16
|
"author": "Dave Houlbrooke <dave@shax.com>",
|
|
17
17
|
"license": "0BSD",
|
|
@@ -49,11 +49,10 @@
|
|
|
49
49
|
"fix": "npm run fix:prettier && npm run fix:eslint",
|
|
50
50
|
"fix:prettier": "prettier --write './**/*.{md,json}'",
|
|
51
51
|
"fix:eslint": "eslint --cache --fix './**/*.{ts,tsx}'",
|
|
52
|
-
"test": "npm run test:prettier && npm run test:eslint && npm run test:
|
|
52
|
+
"test": "npm run test:prettier && npm run test:eslint && npm run test:typescript && npm run test:jest",
|
|
53
53
|
"test:prettier": "prettier --check './**/*.{md,json}'",
|
|
54
54
|
"test:eslint": "eslint --cache './**/*.{ts,tsx}'",
|
|
55
55
|
"test:typescript": "tsc --noEmit",
|
|
56
|
-
"test:dpdm": "dpdm ./modules/index.ts --transform --tree=false --warning=false --exit-code circular:1",
|
|
57
56
|
"test:jest": "jest --detectOpenHandles",
|
|
58
57
|
"test:jest:watch": "jest --watchAll",
|
|
59
58
|
"build": "npm run build:setup && npm run build:copy && npm run build:typescript && npm run build:check && npm run build:jest",
|
|
@@ -70,11 +69,11 @@
|
|
|
70
69
|
"@types/react-dom": "^18.0.10",
|
|
71
70
|
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
72
71
|
"@typescript-eslint/parser": "^5.49.0",
|
|
73
|
-
"dpdm": "^3.11.0",
|
|
74
72
|
"esbuild": "^0.17.12",
|
|
75
73
|
"esbuild-jest": "^0.5.0",
|
|
76
74
|
"eslint": "^8.33.0",
|
|
77
75
|
"eslint-config-prettier": "^8.6.0",
|
|
76
|
+
"eslint-import-resolver-typescript": "^3.5.5",
|
|
78
77
|
"eslint-plugin-import": "^2.27.5",
|
|
79
78
|
"eslint-plugin-prettier": "^4.0.0",
|
|
80
79
|
"firebase": "^9.16.0",
|