shelving 1.196.1 → 1.196.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.196.1",
3
+ "version": "1.196.3",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,8 +5,8 @@ import { NULLABLE } from "./NullableSchema.js";
5
5
  import { StringSchema } from "./StringSchema.js";
6
6
  export { formatAddress };
7
7
  const ADDRESS_PROPS = {
8
- address1: new StringSchema({ title: "Address 1", max: 60, min: 1 }),
9
- address2: new StringSchema({ title: "Address 2", max: 60, min: 0 }),
8
+ address1: new StringSchema({ title: "Address", max: 60, min: 1 }),
9
+ address2: new StringSchema({ title: undefined, max: 60, min: 0 }),
10
10
  city: new StringSchema({ title: "City", min: 1, max: 60 }),
11
11
  state: new StringSchema({ title: "State", min: 0, max: 60 }),
12
12
  postcode: new StringSchema({ title: "Postcode", min: 1, max: 12, case: "upper" }),
@@ -1,12 +1,12 @@
1
1
  import { BooleanStore } from "./BooleanStore.js";
2
- import { Store } from "./Store.js";
2
+ import { Store, type StoreInput } from "./Store.js";
3
3
  /**
4
4
  * Store that tracks its busy status via a separate `this.busy` store.
5
5
  * - "busy" means the store is awaiting a new value.
6
6
  */
7
7
  export declare class BusyStore<T, TT = T> extends Store<T, TT> {
8
8
  readonly busy: BooleanStore;
9
- await(pending: PromiseLike<TT>): Promise<boolean>;
9
+ await(pending: PromiseLike<StoreInput<TT>>): Promise<boolean>;
10
10
  abort(): void;
11
11
  [Symbol.asyncDispose](): Promise<void>;
12
12
  }
@@ -1,8 +1,8 @@
1
1
  import { type NONE } from "../util/constants.js";
2
2
  import { BusyStore } from "./BusyStore.js";
3
- import type { StoreInput } from "./Store.js";
3
+ import type { AsyncStoreInput, StoreInput } from "./Store.js";
4
4
  /** Callback for a callback fetch store. */
5
- export type FetchCallback<T> = (signal: AbortSignal) => T | PromiseLike<T>;
5
+ export type FetchCallback<T> = (signal: AbortSignal) => StoreInput<T> | PromiseLike<StoreInput<T>>;
6
6
  /**
7
7
  * Store that fetches its values from a remote source.
8
8
  *
@@ -35,7 +35,7 @@ export declare class FetchStore<T, TT = T> extends BusyStore<T, TT> {
35
35
  * Call the fetch callback to get the next value.
36
36
  * @param signal `AbortSignal` for the current fetch — passed through to the callback so it can cancel HTTP requests etc.
37
37
  */
38
- protected _fetch(signal: AbortSignal): TT | PromiseLike<TT>;
38
+ protected _fetch(signal: AbortSignal): AsyncStoreInput<TT>;
39
39
  private _callback;
40
40
  /** Whether this store is has currently been invalidated and needs a refresh. */
41
41
  get invalidated(): boolean;
package/store/Store.d.ts CHANGED
@@ -6,12 +6,14 @@ import { type PossibleStarter } from "../util/start.js";
6
6
  export type AnyStore = Store<any, any>;
7
7
  /** Values that a store natively knows how to process as inputs. */
8
8
  export type StoreInput<I> = I | typeof SKIP | typeof NONE;
9
+ /** Values that a store natively knows how to process as inputs. */
10
+ export type AsyncStoreInput<I> = StoreInput<I> | PromiseLike<StoreInput<I>>;
9
11
  /** Internal storage value for a store. */
10
12
  export type StoreInternal<O> = O | typeof NONE;
11
13
  /** Callback that sets a store's value (possibly asynchronously). */
12
- export type StoreCallback<I, A extends Arguments = []> = (...args: A) => StoreInput<I> | PromiseLike<StoreInput<I>>;
14
+ export type StoreCallback<I, A extends Arguments = []> = (...args: A) => AsyncStoreInput<I>;
13
15
  /** Reducer that receives a store's current value and sets the stores next value (possibly asynchronously). */
14
- export type StoreReducer<I, O, A extends Arguments = []> = (value: O, ...args: A) => StoreInput<I> | PromiseLike<StoreInput<I>>;
16
+ export type StoreReducer<I, O, A extends Arguments = []> = (value: O, ...args: A) => AsyncStoreInput<I>;
15
17
  /**
16
18
  * Store that retains its most recent value and is async-iterable to allow values to be observed.
17
19
  * - Current value can be read at `store.value` and `store.data`
@@ -53,7 +55,7 @@ export declare class Store<T, TT = T> implements AsyncIterable<T, void, void>, A
53
55
  * - Setting value to the same as the existing value
54
56
  * - If this store has any pending `await()` calls they are aborted and their results are silently discarded.
55
57
  */
56
- set value(input: StoreInput<TT> | PromiseLike<StoreInput<TT>>);
58
+ set value(input: AsyncStoreInput<TT>);
57
59
  /** Write a synchronous value to this store. */
58
60
  write(input: StoreInput<TT>): void;
59
61
  /**