shelving 1.157.3 → 1.158.1

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.
Files changed (66) hide show
  1. package/api/Endpoint.d.ts +21 -21
  2. package/api/Endpoint.js +14 -13
  3. package/db/CacheProvider.d.ts +1 -1
  4. package/db/Change.d.ts +1 -1
  5. package/db/ChangesProvider.d.ts +1 -1
  6. package/db/DebugProvider.d.ts +1 -1
  7. package/db/ItemStore.d.ts +1 -1
  8. package/db/MemoryProvider.d.ts +1 -1
  9. package/db/Provider.d.ts +1 -1
  10. package/db/Provider.js +1 -2
  11. package/db/QueryStore.d.ts +1 -1
  12. package/db/ThroughProvider.d.ts +1 -1
  13. package/db/ValidationProvider.d.ts +1 -1
  14. package/db/index.d.ts +5 -5
  15. package/db/index.js +7 -7
  16. package/error/BaseError.js +1 -1
  17. package/error/index.d.ts +1 -1
  18. package/error/index.js +1 -1
  19. package/firestore/client/FirestoreClientProvider.d.ts +1 -1
  20. package/firestore/lite/FirestoreLiteProvider.d.ts +1 -1
  21. package/firestore/server/FirestoreServerProvider.d.ts +1 -1
  22. package/markup/index.d.ts +2 -2
  23. package/markup/index.js +2 -2
  24. package/markup/render.js +2 -2
  25. package/markup/rule/code.js +1 -1
  26. package/markup/rule/fenced.js +2 -2
  27. package/markup/rule/heading.js +1 -1
  28. package/markup/rule/index.js +1 -2
  29. package/markup/rule/linebreak.js +1 -1
  30. package/markup/rule/ordered.js +2 -2
  31. package/markup/rule/separator.js +1 -1
  32. package/markup/rule/unordered.js +2 -2
  33. package/package.json +7 -7
  34. package/react/createDataContext.d.ts +1 -1
  35. package/schema/ArraySchema.d.ts +3 -4
  36. package/schema/DataSchema.d.ts +8 -9
  37. package/schema/DataSchema.js +2 -2
  38. package/schema/DictionarySchema.d.ts +3 -4
  39. package/schema/NullableSchema.d.ts +2 -2
  40. package/schema/OptionalSchema.d.ts +2 -2
  41. package/schema/Schema.d.ts +8 -0
  42. package/schema/Schema.js +9 -0
  43. package/schema/ThroughSchema.d.ts +3 -4
  44. package/schema/index.d.ts +5 -5
  45. package/schema/index.js +6 -6
  46. package/sequence/DeferredSequence.js +3 -1
  47. package/sequence/index.d.ts +1 -1
  48. package/sequence/index.js +1 -1
  49. package/store/ArrayStore.js +1 -2
  50. package/store/index.d.ts +2 -2
  51. package/store/index.js +2 -2
  52. package/util/array.d.ts +1 -1
  53. package/util/function.d.ts +1 -1
  54. package/util/function.js +1 -1
  55. package/util/iterate.js +2 -2
  56. package/util/jwt.js +2 -2
  57. package/util/merge.d.ts +1 -1
  58. package/util/merge.js +1 -1
  59. package/util/number.js +1 -1
  60. package/util/query.js +1 -2
  61. package/util/random.d.ts +1 -1
  62. package/util/sequence.d.ts +1 -2
  63. package/util/set.d.ts +3 -3
  64. package/util/url.js +1 -1
  65. package/util/validate.d.ts +0 -3
  66. package/util/validate.js +0 -9
package/api/Endpoint.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { type Schema } from "../schema/Schema.js";
1
2
  import type { AbsolutePath } from "../util/path.js";
2
- import { type Validator } from "../util/validate.js";
3
3
  import type { EndpointCallback, EndpointHandler } from "./util.js";
4
4
  /** Types for an HTTP request or response that does something. */
5
5
  export type EndpointMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
@@ -8,8 +8,8 @@ export type EndpointMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
8
8
  *
9
9
  * @param method The method of the resource, e.g. `GET`
10
10
  * @param path The path of the resource optionally including `{placeholder}` values, e.g. `/patient/{id}`
11
- * @param payload A `Validator` for the payload of the resource.
12
- * @param result A `Validator` for the result of the resource.
11
+ * @param payload A `Schema` for the payload of the resource.
12
+ * @param result A `Schema` for the result of the resource.
13
13
  */
14
14
  export declare class Endpoint<P, R> {
15
15
  /** Endpoint method. */
@@ -17,10 +17,10 @@ export declare class Endpoint<P, R> {
17
17
  /** Endpoint path, e.g. `/patient/{id}` */
18
18
  readonly path: AbsolutePath;
19
19
  /** Payload validator. */
20
- readonly payload: Validator<P>;
20
+ readonly payload: Schema<P>;
21
21
  /** Result validator. */
22
- readonly result: Validator<R>;
23
- constructor(method: EndpointMethod, path: AbsolutePath, payload: Validator<P>, result: Validator<R>);
22
+ readonly result: Schema<R>;
23
+ constructor(method: EndpointMethod, path: AbsolutePath, payload: Schema<P>, result: Schema<R>);
24
24
  /**
25
25
  * Return an `EndpointHandler` for this endpoint.
26
26
  *
@@ -46,34 +46,34 @@ export type EndpointType<X extends Endpoint<unknown, unknown>> = X extends Endpo
46
46
  * Represent a GET request to a specified path, with validated payload and return types.
47
47
  * "The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should not contain a request content."
48
48
  */
49
- export declare function GET<P, R>(path: AbsolutePath, payload?: Validator<P>, result?: Validator<R>): Endpoint<P, R>;
50
- export declare function GET<P>(path: AbsolutePath, payload: Validator<P>): Endpoint<P, undefined>;
51
- export declare function GET<R>(path: AbsolutePath, payload: undefined, result: Validator<R>): Endpoint<undefined, R>;
49
+ export declare function GET<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
50
+ export declare function GET<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
51
+ export declare function GET<R>(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>;
52
52
  /**
53
53
  * Represent a POST request to a specified path, with validated payload and return types.
54
54
  * "The POST method submits an entity to the specified resource, often causing a change in state or side effects on the server.
55
55
  */
56
- export declare function POST<P, R>(path: AbsolutePath, payload?: Validator<P>, result?: Validator<R>): Endpoint<P, R>;
57
- export declare function POST<P>(path: AbsolutePath, payload: Validator<P>): Endpoint<P, undefined>;
58
- export declare function POST<R>(path: AbsolutePath, payload: undefined, result: Validator<R>): Endpoint<undefined, R>;
56
+ export declare function POST<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
57
+ export declare function POST<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
58
+ export declare function POST<R>(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>;
59
59
  /**
60
60
  * Represent a PUT request to a specified path, with validated payload and return types.
61
61
  * "The PUT method replaces all current representations of the target resource with the request content."
62
62
  */
63
- export declare function PUT<P, R>(path: AbsolutePath, payload?: Validator<P>, result?: Validator<R>): Endpoint<P, R>;
64
- export declare function PUT<P>(path: AbsolutePath, payload: Validator<P>): Endpoint<P, undefined>;
65
- export declare function PUT<R>(path: AbsolutePath, payload: undefined, result: Validator<R>): Endpoint<undefined, R>;
63
+ export declare function PUT<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
64
+ export declare function PUT<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
65
+ export declare function PUT<R>(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>;
66
66
  /**
67
67
  * Represent a PATCH request to a specified path, with validated payload and return types.
68
68
  * "The PATCH method applies partial modifications to a resource."
69
69
  */
70
- export declare function PATCH<P, R>(path: AbsolutePath, payload?: Validator<P>, result?: Validator<R>): Endpoint<P, R>;
71
- export declare function PATCH<P>(path: AbsolutePath, payload: Validator<P>): Endpoint<P, undefined>;
72
- export declare function PATCH<R>(path: AbsolutePath, payload: undefined, result: Validator<R>): Endpoint<undefined, R>;
70
+ export declare function PATCH<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
71
+ export declare function PATCH<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
72
+ export declare function PATCH<R>(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>;
73
73
  /**
74
74
  * Represent a DELETE request to a specified path, with validated payload and return types.
75
75
  * "The DELETE method deletes the specified resource."
76
76
  */
77
- export declare function DELETE<P, R>(path: AbsolutePath, payload?: Validator<P>, result?: Validator<R>): Endpoint<P, R>;
78
- export declare function DELETE<P>(path: AbsolutePath, payload: Validator<P>): Endpoint<P, undefined>;
79
- export declare function DELETE<R>(path: AbsolutePath, payload: undefined, result: Validator<R>): Endpoint<undefined, R>;
77
+ export declare function DELETE<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
78
+ export declare function DELETE<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
79
+ export declare function DELETE<R>(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>;
package/api/Endpoint.js CHANGED
@@ -1,12 +1,13 @@
1
+ import { UNDEFINED } from "../schema/Schema.js";
1
2
  import { getResponse } from "../util/http.js";
2
- import { UNDEFINED, getValid } from "../util/validate.js";
3
+ import { getValid } from "../util/validate.js";
3
4
  /**
4
5
  * An abstract API resource definition, used to specify types for e.g. serverless functions.
5
6
  *
6
7
  * @param method The method of the resource, e.g. `GET`
7
8
  * @param path The path of the resource optionally including `{placeholder}` values, e.g. `/patient/{id}`
8
- * @param payload A `Validator` for the payload of the resource.
9
- * @param result A `Validator` for the result of the resource.
9
+ * @param payload A `Schema` for the payload of the resource.
10
+ * @param result A `Schema` for the result of the resource.
10
11
  */
11
12
  export class Endpoint {
12
13
  /** Endpoint method. */
@@ -53,18 +54,18 @@ export class Endpoint {
53
54
  return `${this.method} ${this.path}`;
54
55
  }
55
56
  }
56
- export function GET(path, payload, result) {
57
- return new Endpoint("GET", path, payload || UNDEFINED, result || UNDEFINED);
57
+ export function GET(path, payload = UNDEFINED, result = UNDEFINED) {
58
+ return new Endpoint("GET", path, payload, result);
58
59
  }
59
- export function POST(path, payload, result) {
60
- return new Endpoint("POST", path, payload || UNDEFINED, result || UNDEFINED);
60
+ export function POST(path, payload = UNDEFINED, result = UNDEFINED) {
61
+ return new Endpoint("POST", path, payload, result);
61
62
  }
62
- export function PUT(path, payload, result) {
63
- return new Endpoint("PUT", path, payload || UNDEFINED, result || UNDEFINED);
63
+ export function PUT(path, payload = UNDEFINED, result = UNDEFINED) {
64
+ return new Endpoint("PUT", path, payload, result);
64
65
  }
65
- export function PATCH(path, payload, result) {
66
- return new Endpoint("PATCH", path, payload || UNDEFINED, result || UNDEFINED);
66
+ export function PATCH(path, payload = UNDEFINED, result = UNDEFINED) {
67
+ return new Endpoint("PATCH", path, payload, result);
67
68
  }
68
- export function DELETE(path, payload, result) {
69
- return new Endpoint("DELETE", path, payload || UNDEFINED, result || UNDEFINED);
69
+ export function DELETE(path, payload = UNDEFINED, result = UNDEFINED) {
70
+ return new Endpoint("DELETE", path, payload, result);
70
71
  }
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Sourceable } from "../util/source.js";
package/db/Change.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ImmutableArray } from "../util/array.js";
2
- import type { DataKey, Database } from "../util/data.js";
2
+ import type { Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier } from "../util/item.js";
4
4
  import { type Nullish } from "../util/null.js";
5
5
  import type { ItemQuery } from "../util/query.js";
@@ -1,5 +1,5 @@
1
1
  import type { MutableArray } from "../util/array.js";
2
- import type { DataKey, Database } from "../util/data.js";
2
+ import type { Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier } from "../util/item.js";
4
4
  import type { ItemQuery } from "../util/query.js";
5
5
  import type { Updates } from "../util/update.js";
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Updates } from "../util/update.js";
package/db/ItemStore.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BooleanStore } from "../store/BooleanStore.js";
2
2
  import { OptionalDataStore } from "../store/DataStore.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Item } from "../util/item.js";
5
5
  import type { StopCallback } from "../util/start.js";
6
6
  import type { MemoryProvider } from "./MemoryProvider.js";
@@ -1,5 +1,5 @@
1
1
  import { DeferredSequence } from "../sequence/DeferredSequence.js";
2
- import type { Data, DataKey, Database } from "../util/data.js";
2
+ import type { Data, Database, DataKey } from "../util/data.js";
3
3
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
4
4
  import type { ItemQuery } from "../util/query.js";
5
5
  import type { Updates } from "../util/update.js";
package/db/Provider.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Updates } from "../util/update.js";
package/db/Provider.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { RequiredError } from "../error/RequiredError.js";
2
- import { countArray } from "../util/array.js";
3
- import { getFirst } from "../util/array.js";
2
+ import { countArray, getFirst } from "../util/array.js";
4
3
  /** Provider with a fully synchronous interface */
5
4
  export class Provider {
6
5
  requireItem(collection, id) {
@@ -1,6 +1,6 @@
1
1
  import { ArrayStore } from "../store/ArrayStore.js";
2
2
  import { BooleanStore } from "../store/BooleanStore.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Item } from "../util/item.js";
5
5
  import type { ItemQuery } from "../util/query.js";
6
6
  import type { StopCallback } from "../util/start.js";
@@ -1,4 +1,4 @@
1
- import type { DataKey, Database } from "../util/data.js";
1
+ import type { Database, DataKey } from "../util/data.js";
2
2
  import type { Identifier, Item, Items, OptionalItem } from "../util/item.js";
3
3
  import type { ItemQuery } from "../util/query.js";
4
4
  import type { Sourceable } from "../util/source.js";
@@ -1,6 +1,6 @@
1
1
  import type { DataSchema, DataSchemas } from "../schema/DataSchema.js";
2
2
  import type { Schema } from "../schema/Schema.js";
3
- import type { DataKey, Database } from "../util/data.js";
3
+ import type { Database, DataKey } from "../util/data.js";
4
4
  import type { Identifier, Items, OptionalItem } from "../util/item.js";
5
5
  import type { ItemQuery } from "../util/query.js";
6
6
  import type { Sourceable } from "../util/source.js";
package/db/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from "./ItemStore.js";
2
- export * from "./QueryStore.js";
3
- export * from "./Provider.js";
4
- export * from "./ThroughProvider.js";
5
1
  export * from "./CacheProvider.js";
2
+ export * from "./Change.js";
6
3
  export * from "./ChangesProvider.js";
7
4
  export * from "./DebugProvider.js";
5
+ export * from "./ItemStore.js";
8
6
  export * from "./MemoryProvider.js";
7
+ export * from "./Provider.js";
8
+ export * from "./QueryStore.js";
9
+ export * from "./ThroughProvider.js";
9
10
  export * from "./ValidationProvider.js";
10
- export * from "./Change.js";
package/db/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // Stores.
2
- export * from "./ItemStore.js";
3
- export * from "./QueryStore.js";
4
- // Providers.
5
- export * from "./Provider.js";
6
- export * from "./ThroughProvider.js";
7
2
  export * from "./CacheProvider.js";
3
+ // Util.
4
+ export * from "./Change.js";
8
5
  export * from "./ChangesProvider.js";
9
6
  export * from "./DebugProvider.js";
7
+ export * from "./ItemStore.js";
10
8
  export * from "./MemoryProvider.js";
9
+ // Providers.
10
+ export * from "./Provider.js";
11
+ export * from "./QueryStore.js";
12
+ export * from "./ThroughProvider.js";
11
13
  export * from "./ValidationProvider.js";
12
- // Util.
13
- export * from "./Change.js";
@@ -2,7 +2,7 @@
2
2
  export class BaseError extends Error {
3
3
  constructor(message, options = {}) {
4
4
  super(message, options);
5
- const { cause, caller = BaseError, ...rest } = options;
5
+ const { _cause, caller = BaseError, ...rest } = options;
6
6
  for (const [key, value] of Object.entries(rest))
7
7
  this[key] = value;
8
8
  Error.captureStackTrace(this, caller);
package/error/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from "./BaseError.js";
2
2
  export * from "./NetworkError.js";
3
- export * from "./ResponseError.js";
4
3
  export * from "./RequestError.js";
5
4
  export * from "./RequiredError.js";
5
+ export * from "./ResponseError.js";
6
6
  export * from "./UnexpectedError.js";
7
7
  export * from "./UnimplementedError.js";
8
8
  export * from "./ValueError.js";
package/error/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from "./BaseError.js";
2
2
  export * from "./NetworkError.js";
3
- export * from "./ResponseError.js";
4
3
  export * from "./RequestError.js";
5
4
  export * from "./RequiredError.js";
5
+ export * from "./ResponseError.js";
6
6
  export * from "./UnexpectedError.js";
7
7
  export * from "./UnimplementedError.js";
8
8
  export * from "./ValueError.js";
@@ -1,6 +1,6 @@
1
1
  import type { Firestore } from "firebase/firestore";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { Data, DataKey, Database } from "../../util/data.js";
3
+ import type { Data, Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
@@ -1,6 +1,6 @@
1
1
  import type { Firestore } from "firebase/firestore/lite";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { Data, DataKey, Database } from "../../util/data.js";
3
+ import type { Data, Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
@@ -1,6 +1,6 @@
1
1
  import { Firestore } from "@google-cloud/firestore";
2
2
  import { AsyncProvider } from "../../db/Provider.js";
3
- import type { DataKey, Database } from "../../util/data.js";
3
+ import type { Database, DataKey } from "../../util/data.js";
4
4
  import type { Items, OptionalItem } from "../../util/item.js";
5
5
  import type { ItemQuery } from "../../util/query.js";
6
6
  import type { Updates } from "../../util/update.js";
package/markup/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./util/options.js";
2
- export * from "./util/rule.js";
3
2
  export * from "./util/regexp.js";
4
- export * from "./rule/index.js";
3
+ export * from "./util/rule.js";
5
4
  export * from "./render.js";
5
+ export * from "./rule/index.js";
package/markup/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./util/options.js";
2
- export * from "./util/rule.js";
3
2
  export * from "./util/regexp.js";
3
+ export * from "./util/rule.js";
4
4
  // export * from "./util/internal.js"; // Not exported.
5
- export * from "./rule/index.js";
6
5
  export * from "./render.js";
6
+ export * from "./rule/index.js";
package/markup/render.js CHANGED
@@ -27,8 +27,8 @@ context,
27
27
  offset = 0) {
28
28
  // The best matched rule is the one with the highest priority.
29
29
  // If two have equal priority use the earliest match in the string.
30
- let bestMatch = undefined;
31
- let bestRule = undefined;
30
+ let bestMatch;
31
+ let bestRule;
32
32
  // Loop through all rules in the list and see if any match.
33
33
  for (const rule of options.rules) {
34
34
  const { priority, regexp, contexts } = rule;
@@ -10,7 +10,7 @@ const CODE_REGEXP = getRegExp(`(?<fence>\`+)(?<code>${BLOCK_CONTENT_REGEXP})\\k<
10
10
  * - Closing characters must exactly match opening characters.
11
11
  * - Same as Markdown syntax.
12
12
  */
13
- export const CODE_RULE = getMarkupRule(CODE_REGEXP, ({ groups: { code } }, options, key) => ({
13
+ export const CODE_RULE = getMarkupRule(CODE_REGEXP, ({ groups: { code } }, _options, key) => ({
14
14
  key,
15
15
  $$typeof: REACT_ELEMENT_TYPE,
16
16
  type: "code",
@@ -1,5 +1,5 @@
1
1
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
2
- import { BLOCK_CONTENT_REGEXP, BLOCK_START_REGEXP, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
2
+ import { BLOCK_CONTENT_REGEXP, BLOCK_START_REGEXP, getBlockRegExp, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP } from "../util/regexp.js";
3
3
  import { getMarkupRule } from "../util/rule.js";
4
4
  const FENCE = "`{3,}|~{3,}";
5
5
  const FENCED_REGEXP = getBlockRegExp(`(?<code>${BLOCK_CONTENT_REGEXP})`,
@@ -16,7 +16,7 @@ const FENCED_REGEXP = getBlockRegExp(`(?<code>${BLOCK_CONTENT_REGEXP})`,
16
16
  * - If there's no closing fence the code block will run to the end of the current string.
17
17
  * - Markdown-style four-space indent syntax is not supported (only fenced code since it's less confusing and more common).
18
18
  */
19
- export const FENCED_RULE = getMarkupRule(FENCED_REGEXP, ({ groups: { title, code } }, options, key) => ({
19
+ export const FENCED_RULE = getMarkupRule(FENCED_REGEXP, ({ groups: { title, code } }, _options, key) => ({
20
20
  key,
21
21
  $$typeof: REACT_ELEMENT_TYPE,
22
22
  type: "pre",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP, getLineRegExp } from "../util/regexp.js";
3
+ import { getLineRegExp, LINE_CONTENT_REGEXP, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const HEADING_REGEXP = getLineRegExp(`(?<prefix>#{1,6})(?:${LINE_SPACE_REGEXP}+(?<heading>${LINE_CONTENT_REGEXP}))?`);
6
6
  /**
@@ -4,8 +4,7 @@ import { FENCED_RULE } from "./fenced.js";
4
4
  import { HEADING_RULE } from "./heading.js";
5
5
  import { INLINE_RULE } from "./inline.js";
6
6
  import { LINEBREAK_RULE } from "./linebreak.js";
7
- import { LINK_RULE } from "./link.js";
8
- import { AUTOLINK_RULE } from "./link.js";
7
+ import { AUTOLINK_RULE, LINK_RULE } from "./link.js";
9
8
  import { ORDERED_RULE } from "./ordered.js";
10
9
  import { PARAGRAPH_RULE } from "./paragraph.js";
11
10
  import { SEPARATOR_RULE } from "./separator.js";
@@ -10,7 +10,7 @@ import { getMarkupRule } from "../util/rule.js";
10
10
  * - This is more intuitive (a linebreak becomes a linebreak is isn't silently ignored).
11
11
  * - This works better with textareas that wrap text (since manually breaking up long lines is no longer necessary).
12
12
  */
13
- export const LINEBREAK_RULE = getMarkupRule(/[^\n\S]*\n[^\n\S]*/, (match, options, key) => ({
13
+ export const LINEBREAK_RULE = getMarkupRule(/[^\n\S]*\n[^\n\S]*/, (_match, _options, key) => ({
14
14
  key,
15
15
  $$typeof: REACT_ELEMENT_TYPE,
16
16
  type: "br",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
3
+ import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, getBlockRegExp, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const INDENT = /^\t/gm; // Nesting is recognised with tabs only.
6
6
  const NUMBER = "\\d{1,9}[.):]"; // Number for a numbered list, e.g. `1.` or `2)` or `3:` followed by one or more spaces.
@@ -24,7 +24,7 @@ export const ORDERED_RULE = getMarkupRule(ORDERED_REGEXP, ({ groups: { list } },
24
24
  /** Parse a markdown list into a set of items elements. */
25
25
  function* _getOrderedItems(list, options) {
26
26
  let key = 0;
27
- for (const [unused, number = "", item = ""] of list.matchAll(ITEM)) {
27
+ for (const [_unused, number = "", item = ""] of list.matchAll(ITEM)) {
28
28
  yield {
29
29
  $$typeof: REACT_ELEMENT_TYPE,
30
30
  type: "li",
@@ -9,7 +9,7 @@ const SEPARATOR_REGEXP = getLineRegExp("([-*•+_=])(?: *\\1){2,}");
9
9
  * - Character must be the same every time (can't mix)
10
10
  * - Might have infinite number of spaces between the characters.
11
11
  */
12
- export const SEPARATOR_RULE = getMarkupRule(SEPARATOR_REGEXP, (match, options, key) => ({
12
+ export const SEPARATOR_RULE = getMarkupRule(SEPARATOR_REGEXP, (_match, _options, key) => ({
13
13
  key,
14
14
  $$typeof: REACT_ELEMENT_TYPE,
15
15
  type: "hr",
@@ -1,6 +1,6 @@
1
1
  import { renderMarkup } from "../render.js";
2
2
  import { REACT_ELEMENT_TYPE } from "../util/internal.js";
3
- import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, LINE_SPACE_REGEXP, getBlockRegExp } from "../util/regexp.js";
3
+ import { BLOCK_CONTENT_REGEXP, BLOCK_SPACE_REGEXP, getBlockRegExp, LINE_SPACE_REGEXP } from "../util/regexp.js";
4
4
  import { getMarkupRule } from "../util/rule.js";
5
5
  const INDENT = /^\t/gm; // Nesting is recognised with tabs only.
6
6
  const BULLET = "[-*•+]"; // Allowed bullet symbol.
@@ -25,7 +25,7 @@ export const UNORDERED_RULE = getMarkupRule(UNORDERED_REGEXP, ({ groups: { list
25
25
  /** Parse a markdown list into a set of items elements. */
26
26
  export function* _getItems(list, options) {
27
27
  let key = 0;
28
- for (const [unused, item = ""] of list.matchAll(ITEM)) {
28
+ for (const [_unused, item = ""] of list.matchAll(ITEM)) {
29
29
  yield {
30
30
  $$typeof: REACT_ELEMENT_TYPE,
31
31
  type: "li",
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.157.3",
14
+ "version": "1.158.1",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
@@ -57,14 +57,14 @@
57
57
  "build:test:unit": "bun test ./dist/**/*.test.js --bail"
58
58
  },
59
59
  "devDependencies": {
60
- "@biomejs/biome": "^1.9.4",
60
+ "@biomejs/biome": "^2.2.6",
61
61
  "@google-cloud/firestore": "^7.11.6",
62
- "@types/bun": "^1.2.23",
63
- "@types/react": "^19.1.16",
64
- "@types/react-dom": "^19.1.9",
62
+ "@types/bun": "^1.3.0",
63
+ "@types/react": "^19.2.2",
64
+ "@types/react-dom": "^19.2.2",
65
65
  "firebase": "^11.10.0",
66
- "react": "^19.1.1",
67
- "react-dom": "^19.1.1",
66
+ "react": "^19.2.0",
67
+ "react-dom": "^19.2.0",
68
68
  "typescript": "^5.9.3"
69
69
  },
70
70
  "peerDependencies": {
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode } from "react";
2
2
  import { ItemStore } from "../db/ItemStore.js";
3
3
  import type { AbstractProvider } from "../db/Provider.js";
4
4
  import { QueryStore } from "../db/QueryStore.js";
5
- import type { DataKey, Database } from "../util/data.js";
5
+ import type { Database, DataKey } from "../util/data.js";
6
6
  import type { Identifier } from "../util/item.js";
7
7
  import type { Nullish } from "../util/null.js";
8
8
  import type { ItemQuery } from "../util/query.js";
@@ -1,11 +1,10 @@
1
1
  import type { ImmutableArray } from "../util/array.js";
2
- import type { Validator } from "../util/validate.js";
3
2
  import type { SchemaOptions } from "./Schema.js";
4
3
  import { Schema } from "./Schema.js";
5
4
  /** Allowed options for `ArraySchema` */
6
5
  export interface ArraySchemaOptions<T> extends SchemaOptions {
7
6
  readonly value?: ImmutableArray;
8
- readonly items: Validator<T>;
7
+ readonly items: Schema<T>;
9
8
  readonly min?: number;
10
9
  readonly max?: number;
11
10
  readonly unique?: boolean;
@@ -39,7 +38,7 @@ export interface ArraySchemaOptions<T> extends SchemaOptions {
39
38
  */
40
39
  export declare class ArraySchema<T> extends Schema<ImmutableArray<T>> {
41
40
  readonly value: ImmutableArray;
42
- readonly items: Validator<T>;
41
+ readonly items: Schema<T>;
43
42
  readonly unique: boolean;
44
43
  readonly min: number;
45
44
  readonly max: number;
@@ -47,4 +46,4 @@ export declare class ArraySchema<T> extends Schema<ImmutableArray<T>> {
47
46
  validate(unsafeValue?: unknown): ImmutableArray<T>;
48
47
  }
49
48
  /** Valid array with specifed items. */
50
- export declare const ARRAY: <T>(items: Validator<T>) => ArraySchema<T>;
49
+ export declare const ARRAY: <T>(items: Schema<T>) => ArraySchema<T>;
@@ -1,19 +1,18 @@
1
1
  import type { Data, Database } from "../util/data.js";
2
2
  import type { Identifier, Item } from "../util/item.js";
3
- import type { Validator, Validators } from "../util/validate.js";
4
3
  import type { NullableSchema } from "./NullableSchema.js";
5
- import type { SchemaOptions } from "./Schema.js";
4
+ import type { SchemaOptions, Schemas } from "./Schema.js";
6
5
  import { Schema } from "./Schema.js";
7
6
  /** Allowed options for `PropsSchema` (a schema that has props). */
8
7
  export interface DataSchemaOptions<T extends Data> extends SchemaOptions {
9
- readonly id?: Validator<string>;
10
- readonly props: Validators<T>;
8
+ readonly id?: Schema<string>;
9
+ readonly props: Schemas<T>;
11
10
  readonly value?: Partial<T> | undefined;
12
11
  }
13
12
  /** Validate a data object. */
14
13
  export declare class DataSchema<T extends Data> extends Schema<unknown> {
15
14
  readonly value: Partial<T>;
16
- readonly props: Validators<T>;
15
+ readonly props: Schemas<T>;
17
16
  constructor({ props, title, value, ...options }: DataSchemaOptions<T>);
18
17
  validate(unsafeValue?: unknown): T;
19
18
  }
@@ -22,10 +21,10 @@ export type DataSchemas<T extends Database> = {
22
21
  [K in keyof T]: DataSchema<T[K]>;
23
22
  };
24
23
  /** Create a `DataSchema` for a set of properties. */
25
- export declare const DATA: <T extends Data>(props: Validators<T>) => DataSchema<T>;
24
+ export declare const DATA: <T extends Data>(props: Schemas<T>) => DataSchema<T>;
26
25
  /** Valid data object with specifed properties, or `null` */
27
- export declare const NULLABLE_DATA: <T extends Data>(props: Validators<T>) => NullableSchema<T>;
26
+ export declare const NULLABLE_DATA: <T extends Data>(props: Schemas<T>) => NullableSchema<T>;
28
27
  /** Create a `DataSchema` that validates partially, i.e. properties can be their value, or `undefined` */
29
- export declare function PARTIAL<T extends Data>(source: Validators<T> | DataSchema<T>): DataSchema<Partial<T>>;
28
+ export declare function PARTIAL<T extends Data>(source: Schemas<T> | DataSchema<T>): DataSchema<Partial<T>>;
30
29
  /** Create a `DataSchema` that validates a data item, i.e. it has a string or number `.id` identifier property. */
31
- export declare function ITEM<I extends Identifier, T extends Data>(id: Validator<I>, validators: Validators<T> | DataSchema<T>): DataSchema<Item<I, T>>;
30
+ export declare function ITEM<I extends Identifier, T extends Data>(id: Schema<I>, schemas: Schemas<T> | DataSchema<T>): DataSchema<Item<I, T>>;
@@ -32,8 +32,8 @@ function _optionalProp([, v]) {
32
32
  return OPTIONAL(v);
33
33
  }
34
34
  /** Create a `DataSchema` that validates a data item, i.e. it has a string or number `.id` identifier property. */
35
- export function ITEM(id, validators) {
36
- const props = validators instanceof DataSchema ? validators.props : validators;
35
+ export function ITEM(id, schemas) {
36
+ const props = schemas instanceof DataSchema ? schemas.props : schemas;
37
37
  return new DataSchema({
38
38
  props: { id, ...props },
39
39
  });
@@ -1,10 +1,9 @@
1
1
  import type { ImmutableDictionary } from "../util/dictionary.js";
2
- import type { Validator } from "../util/validate.js";
3
2
  import type { SchemaOptions } from "./Schema.js";
4
3
  import { Schema } from "./Schema.js";
5
4
  /** Allowed options for `DictionarySchema` */
6
5
  export interface DictionarySchemaOptions<T> extends SchemaOptions {
7
- readonly items: Validator<T>;
6
+ readonly items: Schema<T>;
8
7
  readonly value?: ImmutableDictionary | undefined;
9
8
  readonly min?: number | undefined;
10
9
  readonly max?: number | undefined;
@@ -12,11 +11,11 @@ export interface DictionarySchemaOptions<T> extends SchemaOptions {
12
11
  /** Validate a dictionary object (whose props are all the same with string keys). */
13
12
  export declare class DictionarySchema<T> extends Schema<ImmutableDictionary<T>> {
14
13
  readonly value: ImmutableDictionary;
15
- readonly items: Validator<T>;
14
+ readonly items: Schema<T>;
16
15
  readonly min: number;
17
16
  readonly max: number;
18
17
  constructor({ items, min, max, title, value, ...options }: DictionarySchemaOptions<T>);
19
18
  validate(unsafeValue?: unknown): ImmutableDictionary<T>;
20
19
  }
21
20
  /** Valid dictionary object with specifed items. */
22
- export declare const DICTIONARY: <T>(items: Validator<T>) => DictionarySchema<T>;
21
+ export declare const DICTIONARY: <T>(items: Schema<T>) => DictionarySchema<T>;
@@ -1,4 +1,4 @@
1
- import type { Validator } from "../index.js";
1
+ import type { Schema } from "./Schema.js";
2
2
  import { ThroughSchema, type ThroughSchemaOptions } from "./ThroughSchema.js";
3
3
  /** Allowed options for `NullableSchema` */
4
4
  export interface NullableSchemaOptions<T> extends ThroughSchemaOptions<T | null> {
@@ -12,4 +12,4 @@ export declare class NullableSchema<T> extends ThroughSchema<T | null> {
12
12
  validate(unsafeValue?: unknown): T | null;
13
13
  }
14
14
  /** Create a new nullable schema from a source schema. */
15
- export declare const NULLABLE: <T>(source: Validator<T>) => NullableSchema<T>;
15
+ export declare const NULLABLE: <T>(source: Schema<T>) => NullableSchema<T>;
@@ -1,4 +1,4 @@
1
- import type { Validator } from "../util/validate.js";
1
+ import type { Schema } from "./Schema.js";
2
2
  import { ThroughSchema, type ThroughSchemaOptions } from "./ThroughSchema.js";
3
3
  export interface OptionalSchemaOptions<T> extends ThroughSchemaOptions<T | undefined> {
4
4
  /** Default value for an `OptionalSchema` can always `undefined` */
@@ -16,4 +16,4 @@ export declare class OptionalSchema<T> extends ThroughSchema<T | undefined> {
16
16
  validate(unsafeValue: unknown): T | undefined;
17
17
  }
18
18
  /** Make a property of a set of data optional, i.e. it can be the value or `undefined` */
19
- export declare const OPTIONAL: <T>(source: Validator<T>) => OptionalSchema<T>;
19
+ export declare const OPTIONAL: <T>(source: Schema<T>) => OptionalSchema<T>;
@@ -1,3 +1,4 @@
1
+ import type { Data } from "../util/data.js";
1
2
  import type { Validator } from "../util/validate.js";
2
3
  /** Options allowed by a `Schema` instance. */
3
4
  export type SchemaOptions = {
@@ -28,3 +29,10 @@ export declare abstract class Schema<T = unknown> implements Validator<T> {
28
29
  /** Every schema must implement a `validate()` method. */
29
30
  abstract validate(unsafeValue: unknown): T;
30
31
  }
32
+ /** A set of named schemas in `{ name: schema }` format. */
33
+ export type Schemas<T extends Data = Data> = {
34
+ readonly [K in keyof T]: Schema<T[K]>;
35
+ };
36
+ export declare const UNKNOWN: Schema<unknown>;
37
+ export declare const UNDEFINED: Schema<undefined>;
38
+ export declare const NULL: Schema<null>;
package/schema/Schema.js CHANGED
@@ -1,3 +1,6 @@
1
+ import { PASSTHROUGH } from "../util/function.js";
2
+ import { getNull } from "../util/null.js";
3
+ import { getUndefined } from "../util/undefined.js";
1
4
  /**
2
5
  * Schema is an object instance with a `validate()` method.
3
6
  * - Type `T` represents the type of value `validate()` returns.
@@ -19,3 +22,9 @@ export class Schema {
19
22
  this.value = value;
20
23
  }
21
24
  }
25
+ // Unknown validator always passes through its input value as `unknown`
26
+ export const UNKNOWN = { title: "", description: "", placeholder: "", value: undefined, validate: PASSTHROUGH };
27
+ // Undefined validator always returns `undefined`
28
+ export const UNDEFINED = { ...UNKNOWN, validate: getUndefined };
29
+ // Null validator always returns `null`
30
+ export const NULL = { ...UNKNOWN, validate: getNull };
@@ -1,14 +1,13 @@
1
1
  import type { Sourceable } from "../util/source.js";
2
- import type { Validator } from "../util/validate.js";
3
2
  import type { SchemaOptions } from "./Schema.js";
4
3
  import { Schema } from "./Schema.js";
5
4
  /** Allowed options for `ThroughSchema` */
6
5
  export interface ThroughSchemaOptions<T> extends SchemaOptions {
7
- source: Validator<T>;
6
+ source: Schema<T>;
8
7
  }
9
8
  /** Schema that passes through to a source schema. */
10
- export declare abstract class ThroughSchema<T> extends Schema<T> implements Sourceable<Validator<T>> {
11
- readonly source: Validator<T>;
9
+ export declare abstract class ThroughSchema<T> extends Schema<T> implements Sourceable<Schema<T>> {
10
+ readonly source: Schema<T>;
12
11
  constructor({ source, ...options }: ThroughSchemaOptions<T>);
13
12
  validate(unsafeValue: unknown): T;
14
13
  }
package/schema/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- export * from "./Schema.js";
2
- export * from "./ThroughSchema.js";
3
- export * from "./NullableSchema.js";
4
- export * from "./OptionalSchema.js";
5
- export * from "./RequiredSchema.js";
6
1
  export * from "./ArraySchema.js";
7
2
  export * from "./BooleanSchema.js";
8
3
  export * from "./ChoiceSchema.js";
@@ -16,9 +11,14 @@ export * from "./EntitySchema.js";
16
11
  export * from "./FileSchema.js";
17
12
  export * from "./KeySchema.js";
18
13
  export * from "./LinkSchema.js";
14
+ export * from "./NullableSchema.js";
19
15
  export * from "./NumberSchema.js";
16
+ export * from "./OptionalSchema.js";
20
17
  export * from "./PhoneSchema.js";
18
+ export * from "./RequiredSchema.js";
19
+ export * from "./Schema.js";
21
20
  export * from "./SlugSchema.js";
22
21
  export * from "./StringSchema.js";
22
+ export * from "./ThroughSchema.js";
23
23
  export * from "./TimeSchema.js";
24
24
  export * from "./UUIDSchema.js";
package/schema/index.js CHANGED
@@ -1,9 +1,3 @@
1
- export * from "./Schema.js";
2
- // Utility schemas.
3
- export * from "./ThroughSchema.js";
4
- export * from "./NullableSchema.js";
5
- export * from "./OptionalSchema.js";
6
- export * from "./RequiredSchema.js";
7
1
  // Field schemas.
8
2
  export * from "./ArraySchema.js";
9
3
  export * from "./BooleanSchema.js";
@@ -18,9 +12,15 @@ export * from "./EntitySchema.js";
18
12
  export * from "./FileSchema.js";
19
13
  export * from "./KeySchema.js";
20
14
  export * from "./LinkSchema.js";
15
+ export * from "./NullableSchema.js";
21
16
  export * from "./NumberSchema.js";
17
+ export * from "./OptionalSchema.js";
22
18
  export * from "./PhoneSchema.js";
19
+ export * from "./RequiredSchema.js";
20
+ export * from "./Schema.js";
23
21
  export * from "./SlugSchema.js";
24
22
  export * from "./StringSchema.js";
23
+ // Utility schemas.
24
+ export * from "./ThroughSchema.js";
25
25
  export * from "./TimeSchema.js";
26
26
  export * from "./UUIDSchema.js";
@@ -40,7 +40,9 @@ export class DeferredSequence extends AbstractSequence {
40
40
  }
41
41
  /** Fulfill the current deferred by resolving or rejecting it. */
42
42
  _fulfill() {
43
- const { _deferred, _nextReason, _nextValue } = this;
43
+ const _deferred = this._deferred;
44
+ const _nextReason = this._nextReason;
45
+ const _nextValue = this._nextValue;
44
46
  this._nextReason = _NOVALUE;
45
47
  this._nextValue = _NOVALUE;
46
48
  if (_deferred) {
@@ -1,6 +1,6 @@
1
1
  export * from "./AbstractSequence.js";
2
2
  export * from "./DeferredSequence.js";
3
3
  export * from "./InspectSequence.js";
4
+ export * from "./IteratorSequence.js";
4
5
  export * from "./LazyDeferredSequence.js";
5
6
  export * from "./ThroughSequence.js";
6
- export * from "./IteratorSequence.js";
package/sequence/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./AbstractSequence.js";
2
2
  export * from "./DeferredSequence.js";
3
3
  export * from "./InspectSequence.js";
4
+ export * from "./IteratorSequence.js";
4
5
  export * from "./LazyDeferredSequence.js";
5
6
  export * from "./ThroughSequence.js";
6
- export * from "./IteratorSequence.js";
@@ -1,5 +1,4 @@
1
- import { omitArrayItems, toggleArrayItems, withArrayItems } from "../util/array.js";
2
- import { getFirst, getLast, requireFirst, requireLast } from "../util/array.js";
1
+ import { getFirst, getLast, omitArrayItems, requireFirst, requireLast, toggleArrayItems, withArrayItems } from "../util/array.js";
3
2
  import { Store } from "./Store.js";
4
3
  /** Store an array. */
5
4
  export class ArrayStore extends Store {
package/store/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./Store.js";
2
1
  export * from "./ArrayStore.js";
3
2
  export * from "./BooleanStore.js";
4
3
  export * from "./DataStore.js";
5
- export * from "./PathStore.js";
6
4
  export * from "./DictionaryStore.js";
5
+ export * from "./PathStore.js";
6
+ export * from "./Store.js";
package/store/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./Store.js";
2
1
  export * from "./ArrayStore.js";
3
2
  export * from "./BooleanStore.js";
4
3
  export * from "./DataStore.js";
5
- export * from "./PathStore.js";
6
4
  export * from "./DictionaryStore.js";
5
+ export * from "./PathStore.js";
6
+ export * from "./Store.js";
package/util/array.d.ts CHANGED
@@ -27,7 +27,7 @@ export declare function isArray<T>(arr: ImmutableArray<T>, min: 3, max: 3): arr
27
27
  export declare function isArray<T>(arr: ImmutableArray<T>, min?: 1, max?: number): arr is readonly [T, ...T[]];
28
28
  export declare function isArray<T>(arr: ImmutableArray<T>, min: 2, max?: number): arr is readonly [T, T, ...T[]];
29
29
  export declare function isArray<T>(arr: ImmutableArray<T>, min: 3, max?: number): arr is readonly [T, T, T, ...T[]];
30
- export declare function isArray<T>(value: unknown, min?: number, max?: number): value is ImmutableArray;
30
+ export declare function isArray<T>(value: unknown, min?: number, max?: number): value is ImmutableArray<T>;
31
31
  /** Assert that an unknown value is an array (optionally with specified min/max length). */
32
32
  export declare function assertArray<T>(arr: MutableArray<T>, min: 1, max: 1, caller?: AnyCaller): asserts arr is [T];
33
33
  export declare function assertArray<T>(arr: MutableArray<T>, min: 2, max: 2, caller?: AnyCaller): asserts arr is [T, T];
@@ -14,4 +14,4 @@ export type Arguments = readonly unknown[];
14
14
  /** Function that just passes through the first argument. */
15
15
  export declare function PASSTHROUGH<T>(value: T): T;
16
16
  /** Function that does nothing with its arguments and always returns void. */
17
- export declare function BLACKHOLE(...unused: Arguments): void | undefined;
17
+ export declare function BLACKHOLE(..._unused: Arguments): void | undefined;
package/util/function.js CHANGED
@@ -14,6 +14,6 @@ export function PASSTHROUGH(value) {
14
14
  }
15
15
  /** Function that does nothing with its arguments and always returns void. */
16
16
  // biome-ignore lint/suspicious/noConfusingVoidType: Allow `BLACKHOLE` to be used in places that allow `void`
17
- export function BLACKHOLE(...unused) {
17
+ export function BLACKHOLE(..._unused) {
18
18
  return undefined;
19
19
  }
package/util/iterate.js CHANGED
@@ -13,14 +13,14 @@ export function* flattenItems(items) {
13
13
  * - Checks `items.size` or `items.length` first, or consumes the iterable and counts its iterations.
14
14
  */
15
15
  export function hasItems(items) {
16
- for (const unused of items)
16
+ for (const _unused of items)
17
17
  return true;
18
18
  return false;
19
19
  }
20
20
  /** Count the number of items in an iterable. */
21
21
  export function countItems(items) {
22
22
  let count = 0;
23
- for (const unused of items)
23
+ for (const _unused of items)
24
24
  count++;
25
25
  return count;
26
26
  }
package/util/jwt.js CHANGED
@@ -84,9 +84,9 @@ export async function verifyToken(token, secret, caller = verifyToken) {
84
84
  const { header, payload, signature, headerData, payloadData } = splitToken(token, caller);
85
85
  // Validate header.
86
86
  if (headerData.typ !== HEADER.typ)
87
- throw new UnauthorizedError(`JWT header type must be \"${HEADER.typ}\"`, { received: headerData.typ, caller });
87
+ throw new UnauthorizedError(`JWT header type must be "${HEADER.typ}"`, { received: headerData.typ, caller });
88
88
  if (headerData.alg !== HEADER.alg)
89
- throw new UnauthorizedError(`JWT header algorithm must be \"${HEADER.alg}\"`, { received: headerData.alg, caller });
89
+ throw new UnauthorizedError(`JWT header algorithm must be "${HEADER.alg}"`, { received: headerData.alg, caller });
90
90
  // Validate signature.
91
91
  const key = await _getKey(verifyToken, secret, "verify");
92
92
  const isValid = await crypto.subtle.verify("HMAC", key, decodeBase64URLBytes(signature), requireBytes(`${header}.${payload}`));
package/util/merge.d.ts CHANGED
@@ -5,7 +5,7 @@ type MergeRecursor = (left: unknown, right: unknown) => unknown;
5
5
  * Exact merge two unknown values.
6
6
  * - Always returns `right`.
7
7
  */
8
- export declare function exactMerge(left: unknown, right: unknown): unknown;
8
+ export declare function exactMerge(_left: unknown, right: unknown): unknown;
9
9
  /**
10
10
  * Shallow merge two unknown values.
11
11
  *
package/util/merge.js CHANGED
@@ -14,7 +14,7 @@ function _merge(left, right, recursor) {
14
14
  * Exact merge two unknown values.
15
15
  * - Always returns `right`.
16
16
  */
17
- export function exactMerge(left, right) {
17
+ export function exactMerge(_left, right) {
18
18
  return right;
19
19
  }
20
20
  export function shallowMerge(left, right) {
package/util/number.js CHANGED
@@ -158,7 +158,7 @@ export function sumNumbers(nums) {
158
158
  }
159
159
  /** Find the number that's closest to a target in an iterable set of numbers. */
160
160
  export function getClosestNumber(nums, target) {
161
- let closest = undefined;
161
+ let closest;
162
162
  for (const item of nums)
163
163
  if (closest === undefined || Math.abs(item - target) < Math.abs(closest - target))
164
164
  closest = item;
package/util/query.js CHANGED
@@ -1,5 +1,4 @@
1
- import { isArray, limitArray } from "./array.js";
2
- import { requireLast } from "./array.js";
1
+ import { isArray, limitArray, requireLast } from "./array.js";
3
2
  import { getDataProp } from "./data.js";
4
3
  import { isArrayWith, isEqual, isEqualGreater, isEqualLess, isGreater, isInArray, isLess, notEqual, notInArray } from "./equal.js";
5
4
  import { limitItems } from "./iterate.js";
package/util/random.d.ts CHANGED
@@ -13,4 +13,4 @@ export declare function getRandomKey(length?: number): string;
13
13
  /** Get a random character from a string. */
14
14
  export declare function getRandomCharacter(str: string): string;
15
15
  /** Get a random item from an array or random character from a string string. */
16
- export declare function getRandomItem<I, T>(arr: ImmutableArray<T>): T;
16
+ export declare function getRandomItem<T>(arr: ImmutableArray<T>): T;
@@ -1,5 +1,4 @@
1
- import type { AsyncValueCallback, ValueCallback } from "./callback.js";
2
- import type { ErrorCallback } from "./callback.js";
1
+ import type { AsyncValueCallback, ErrorCallback, ValueCallback } from "./callback.js";
3
2
  import { STOP } from "./constants.js";
4
3
  import type { StopCallback } from "./start.js";
5
4
  /**
package/util/set.d.ts CHANGED
@@ -16,11 +16,11 @@ export declare function getSet<T>(value: PossibleSet<T>): ImmutableSet;
16
16
  /** Apply a limit to a set. */
17
17
  export declare function limitSet<T>(set: ImmutableSet<T>, limit: number): ImmutableSet<T>;
18
18
  /** Is an unknown value an item in a set? */
19
- export declare function isSetItem<I, T>(set: ImmutableSet<T>, item: unknown): item is T;
19
+ export declare function isSetItem<T>(set: ImmutableSet<T>, item: unknown): item is T;
20
20
  /** Assert that an unknown value is an item in a set. */
21
- export declare function assertSetItem<I, T>(set: ImmutableSet<T>, item: unknown, caller?: AnyCaller): asserts item is T;
21
+ export declare function assertSetItem<T>(set: ImmutableSet<T>, item: unknown, caller?: AnyCaller): asserts item is T;
22
22
  /** Add an item to a set (by reference) and return the set item. */
23
- export declare function addSetItem<I, T>(set: MutableSet<T>, item: T): T;
23
+ export declare function addSetItem<T>(set: MutableSet<T>, item: T): T;
24
24
  /** Add multiple items to a set (by reference). */
25
25
  export declare function addSetItems<T>(set: MutableSet<T>, ...items: T[]): void;
26
26
  /** Remove multiple items from a set (by reference). */
package/util/url.js CHANGED
@@ -15,7 +15,7 @@ export function getURL(possible, base = _BASE) {
15
15
  try {
16
16
  return isURL(possible) ? possible : new URL(possible, base);
17
17
  }
18
- catch (e) {
18
+ catch (_e) {
19
19
  //
20
20
  }
21
21
  }
@@ -64,6 +64,3 @@ export declare function validateDictionary<T>(unsafeDictionary: ImmutableDiction
64
64
  */
65
65
  export declare function validateData<T extends Data>(unsafeData: Data, validators: Validators<T>, partial: true): DeepPartial<T>;
66
66
  export declare function validateData<T extends Data>(unsafeData: Data, validators: Validators<T>, partial?: false): T;
67
- export declare const UNDEFINED: Validator<undefined>;
68
- export declare const NULL: Validator<null>;
69
- export declare const UNKNOWN: Validator<unknown>;
package/util/validate.js CHANGED
@@ -4,10 +4,7 @@ import { isArray } from "./array.js";
4
4
  import { getDataKeys, getDataProps } from "./data.js";
5
5
  import { getDictionaryItems } from "./dictionary.js";
6
6
  import { getNamedMessage } from "./error.js";
7
- import { PASSTHROUGH } from "./function.js";
8
7
  import { isIterable } from "./iterate.js";
9
- import { getNull } from "./null.js";
10
- import { getUndefined } from "./undefined.js";
11
8
  /** Get value that validates against a given `Validator`, or throw `ValueError` */
12
9
  export function getValid(value, validator, ErrorConstructor = ValueError, caller = getValid) {
13
10
  try {
@@ -135,9 +132,3 @@ export function validateData(unsafeData, validators, partial = isDeeplyPartial)
135
132
  isDeeplyPartial = false;
136
133
  }
137
134
  }
138
- // Undefined validator always returns `undefined`
139
- export const UNDEFINED = { validate: getUndefined };
140
- // Null validator always returns `null`
141
- export const NULL = { validate: getNull };
142
- // Unknown validator always passes through its input value as `unknown`
143
- export const UNKNOWN = { validate: PASSTHROUGH };