@confect/react 10.0.0-next.22 → 10.0.0-next.24
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/CHANGELOG.md +10 -0
- package/dist/PaginatedQueryResult.d.ts +16 -14
- package/dist/PaginatedQueryResult.d.ts.map +1 -1
- package/dist/PaginatedQueryResult.js +3 -3
- package/dist/PaginatedQueryResult.js.map +1 -1
- package/dist/QueryResult.d.ts +7 -7
- package/dist/QueryResult.d.ts.map +1 -1
- package/dist/QueryResult.js +5 -6
- package/dist/QueryResult.js.map +1 -1
- package/dist/StreamPagination.d.ts +83 -51
- package/dist/StreamPagination.d.ts.map +1 -1
- package/dist/StreamPagination.js +33 -21
- package/dist/StreamPagination.js.map +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
- package/src/PaginatedQueryResult.ts +16 -14
- package/src/QueryResult.ts +7 -7
- package/src/StreamPagination.ts +86 -52
- package/src/index.ts +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @confect/react
|
|
2
2
|
|
|
3
|
+
## 10.0.0-next.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 850a3c3: Require `effect@^4.0.0-rc.117` across `@confect/*` and `@effect/platform-node@^4.0.0-rc.117` for `@confect/server`'s optional Node integration. Upgrade these dependencies alongside Confect; existing Confect call sites are unchanged.
|
|
8
|
+
|
|
9
|
+
## 10.0.0-next.23
|
|
10
|
+
|
|
11
|
+
No changes in this release.
|
|
12
|
+
|
|
3
13
|
## 10.0.0-next.22
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -10,15 +10,15 @@ type TypeId = typeof TypeId;
|
|
|
10
10
|
*
|
|
11
11
|
* Every variant carries `results`, including `Failure`: when a later page
|
|
12
12
|
* fails, the pages already loaded are still worth rendering alongside the
|
|
13
|
-
* error, so they are not discarded. `Failure` additionally carries the
|
|
14
|
-
*
|
|
13
|
+
* error, so they are not discarded. `Failure` additionally carries the query's
|
|
14
|
+
* decoded typed error.
|
|
15
15
|
*
|
|
16
|
-
* `loadMore` appears only on `CanLoadMore`, the one state it can make
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* {@link isCanLoadMore} or {@link match}—makes that statically apparent
|
|
21
|
-
*
|
|
16
|
+
* `loadMore` appears only on `CanLoadMore`, the one state it can make progress
|
|
17
|
+
* from. The underlying Convex hook exposes it on every status, but calling it
|
|
18
|
+
* while a page is in flight, once the list is exhausted, or after a failure is
|
|
19
|
+
* an intentional no-op there; narrowing to `CanLoadMore`—via
|
|
20
|
+
* {@link isCanLoadMore} or {@link match}—makes that statically apparent instead
|
|
21
|
+
* of silently dropping the call.
|
|
22
22
|
*
|
|
23
23
|
* When the query declares no `error` schema (`E` is `never`), the `Failure`
|
|
24
24
|
* variant is excluded from the type entirely, so `isLoading` is accessible
|
|
@@ -30,8 +30,8 @@ type TypeId = typeof TypeId;
|
|
|
30
30
|
export type PaginatedQueryResult<Item, E = never> = [E] extends [never] ? LoadingFirstPage<Item, E> | LoadingMore<Item, E> | CanLoadMore<Item, E> | Exhausted<Item, E> : LoadingFirstPage<Item, E> | LoadingMore<Item, E> | CanLoadMore<Item, E> | Exhausted<Item, E> | Failure<Item, E>;
|
|
31
31
|
/**
|
|
32
32
|
* Every variant regardless of `E`—the parameter type for guards and
|
|
33
|
-
* {@link match}, since `PaginatedQueryResult` itself excludes `Failure` when
|
|
34
|
-
*
|
|
33
|
+
* {@link match}, since `PaginatedQueryResult` itself excludes `Failure` when `E`
|
|
34
|
+
* is `never`.
|
|
35
35
|
*/
|
|
36
36
|
export type Variants<Item, E = never> = LoadingFirstPage<Item, E> | LoadingMore<Item, E> | CanLoadMore<Item, E> | Exhausted<Item, E> | Failure<Item, E>;
|
|
37
37
|
export declare namespace PaginatedQueryResult {
|
|
@@ -72,7 +72,9 @@ export interface Exhausted<Item, E = never> extends PaginatedQueryResult.Proto<I
|
|
|
72
72
|
export interface Failure<Item, E = never> extends PaginatedQueryResult.Proto<Item, E> {
|
|
73
73
|
readonly _tag: "Failure";
|
|
74
74
|
readonly error: E;
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The pages loaded before the failure.
|
|
77
|
+
*/
|
|
76
78
|
readonly results: ReadonlyArray<Item>;
|
|
77
79
|
}
|
|
78
80
|
export declare const isPaginatedQueryResult: (u: unknown) => u is Variants<unknown, unknown>;
|
|
@@ -109,9 +111,9 @@ type MatchOptions<Item, E, V, W, X, Y, Z> = {
|
|
|
109
111
|
});
|
|
110
112
|
type MatchReturns<E, V, W, X, Y, Z> = [E] extends [never] ? V | W | X | Y : V | W | X | Y | Z;
|
|
111
113
|
/**
|
|
112
|
-
* Matches a {@link PaginatedQueryResult} to the appropriate handler based on
|
|
113
|
-
*
|
|
114
|
-
*
|
|
114
|
+
* Matches a {@link PaginatedQueryResult} to the appropriate handler based on its
|
|
115
|
+
* tag. If the provided result cannot fail (i.e. `E` is `never`), `onFailure` is
|
|
116
|
+
* not required.
|
|
115
117
|
*/
|
|
116
118
|
export declare const match: {
|
|
117
119
|
<Item, E, V, W, X, Y, Z = never>(options: MatchOptions<Item, E, V, W, X, Y, Z>): (self: Variants<Item, E>) => MatchReturns<E, V, W, X, Y, Z>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginatedQueryResult.d.ts","sourceRoot":"","sources":["../src/PaginatedQueryResult.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,QAAA,MAAM,MAAM,yCAAyC,CAAC;AACtD,KAAK,MAAM,GAAG,OAAO,MAAM,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CA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AC,CAAC;CACnE,CAAC,CAAC;AAEP,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACrD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACb,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtB;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE;IAClB,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAC7B,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5C,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EACvB,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5C,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CA8BnC,CAAC"}
|
|
@@ -77,9 +77,9 @@ const isExhausted = (result) => result._tag === "Exhausted";
|
|
|
77
77
|
const isFailure = (result) => result._tag === "Failure";
|
|
78
78
|
const isLoading = (result) => result._tag === "LoadingFirstPage" || result._tag === "LoadingMore";
|
|
79
79
|
/**
|
|
80
|
-
* Matches a {@link PaginatedQueryResult} to the appropriate handler based on
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* Matches a {@link PaginatedQueryResult} to the appropriate handler based on its
|
|
81
|
+
* tag. If the provided result cannot fail (i.e. `E` is `never`), `onFailure` is
|
|
82
|
+
* not required.
|
|
83
83
|
*/
|
|
84
84
|
const match = Function.dual(2, (self, options) => Match.value(self).pipe(Match.tag("LoadingFirstPage", (loadingFirstPage_) => options.onLoadingFirstPage(loadingFirstPage_.skipped)), Match.tag("LoadingMore", (loadingMore_) => options.onLoadingMore(loadingMore_.results)), Match.tag("CanLoadMore", (canLoadMore_) => options.onCanLoadMore(canLoadMore_.results, canLoadMore_.loadMore)), Match.tag("Exhausted", (exhausted_) => options.onExhausted(exhausted_.results)), Match.tag("Failure", (failure_) => {
|
|
85
85
|
if (Predicate.hasProperty(options, "onFailure")) return options.onFailure(failure_.error, failure_.results);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginatedQueryResult.js","names":[],"sources":["../src/PaginatedQueryResult.ts"],"sourcesContent":["import * as Equal from \"effect/Equal\";\nimport * as Function from \"effect/Function\";\nimport * as Hash from \"effect/Hash\";\nimport * as Match from \"effect/Match\";\nimport * as Pipeable from \"effect/Pipeable\";\nimport * as Predicate from \"effect/Predicate\";\n\nconst TypeId = \"~@confect/react/PaginatedQueryResult\";\ntype TypeId = typeof TypeId;\n\n/**\n * A `PaginatedQueryResult` represents the result of a Confect paginated query.\n * The non-`Failure` variants mirror the statuses of `usePaginatedQuery` from\n * `convex/react` and all carry `results` and `isLoading`, so the common UI\n * shape—render the list, show a spinner while loading—needs only an\n * {@link isFailure} early-out and plain field access.\n *\n * Every variant carries `results`, including `Failure`: when a later page\n * fails, the pages already loaded are still worth rendering alongside the\n * error, so they are not discarded. `Failure` additionally carries the\n * query's decoded typed error.\n *\n * `loadMore` appears only on `CanLoadMore`, the one state it can make\n * progress from. The underlying Convex hook exposes it on every status, but\n * calling it while a page is in flight, once the list is exhausted, or after\n * a failure is an intentional no-op there; narrowing to `CanLoadMore`—via\n * {@link isCanLoadMore} or {@link match}—makes that statically apparent\n * instead of silently dropping the call.\n *\n * When the query declares no `error` schema (`E` is `never`), the `Failure`\n * variant is excluded from the type entirely, so `isLoading` is accessible\n * without any narrowing.\n *\n * @typeParam Item - The type of a decoded page item.\n * @typeParam E - The type of the decoded typed error in the `Failure` variant.\n */\nexport type PaginatedQueryResult<Item, E = never> = [E] extends [never]\n ?\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n :\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n | Failure<Item, E>;\n\n/**\n * Every variant regardless of `E`—the parameter type for guards and\n * {@link match}, since `PaginatedQueryResult` itself excludes `Failure` when\n * `E` is `never`.\n */\nexport type Variants<Item, E = never> =\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n | Failure<Item, E>;\n\nexport declare namespace PaginatedQueryResult {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export interface Proto<out Item, out E> extends Pipeable.Pipeable {\n readonly [TypeId]: TypeId;\n readonly \"~Item\": Item;\n readonly \"~E\": E;\n }\n\n export type Item<R> = R extends { readonly \"~Item\": infer Item_ }\n ? Item_\n : never;\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export type Failure<R> = R extends { readonly \"~E\": infer E } ? E : never;\n}\n\nexport interface LoadingFirstPage<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"LoadingFirstPage\";\n readonly skipped: boolean;\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: true;\n}\n\nexport interface LoadingMore<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"LoadingMore\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: true;\n}\n\nexport interface CanLoadMore<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"CanLoadMore\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: false;\n readonly loadMore: (numItems: number) => void;\n}\n\nexport interface Exhausted<Item, E = never> extends PaginatedQueryResult.Proto<\n Item,\n E\n> {\n readonly _tag: \"Exhausted\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: false;\n}\n\nexport interface Failure<Item, E = never> extends PaginatedQueryResult.Proto<\n Item,\n E\n> {\n readonly _tag: \"Failure\";\n readonly error: E;\n /** The pages loaded before the failure. */\n readonly results: ReadonlyArray<Item>;\n}\n\nexport const isPaginatedQueryResult = (\n u: unknown,\n): u is Variants<unknown, unknown> => Predicate.hasProperty(u, TypeId);\n\nconst PaginatedQueryResultProto = {\n [TypeId]: TypeId,\n pipe(this: Variants<any, any>, ...args: ReadonlyArray<unknown>) {\n return Pipeable.pipeArguments(\n this,\n args as unknown as Parameters<typeof Pipeable.pipeArguments>[1],\n );\n },\n /**\n * `CanLoadMore`'s `loadMore` is excluded from equality and hashing, like\n * function fields generally: two results that render identically are equal\n * even though their callbacks differ by identity.\n */\n [Equal.symbol](this: Variants<any, any>, that: Variants<any, any>): boolean {\n if (this._tag !== that._tag) {\n return false;\n }\n return Match.value(this).pipe(\n Match.tag(\n \"LoadingFirstPage\",\n (self) => self.skipped === (that as LoadingFirstPage<any, any>).skipped,\n ),\n Match.tag(\"LoadingMore\", \"CanLoadMore\", \"Exhausted\", (self) =>\n Equal.equals(self.results, that.results),\n ),\n Match.tag(\n \"Failure\",\n (self) =>\n Equal.equals(self.error, (that as Failure<any, any>).error) &&\n Equal.equals(self.results, (that as Failure<any, any>).results),\n ),\n Match.exhaustive,\n );\n },\n [Hash.symbol](this: Variants<any, any>): number {\n const tagHash = Hash.string(this._tag);\n return Match.value(this).pipe(\n Match.tag(\"LoadingFirstPage\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.skipped)),\n ),\n Match.tag(\"LoadingMore\", \"CanLoadMore\", \"Exhausted\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.results)),\n ),\n Match.tag(\"Failure\", (self) =>\n Hash.combine(tagHash)(\n Hash.combine(Hash.hash(self.error))(Hash.hash(self.results)),\n ),\n ),\n Match.exhaustive,\n );\n },\n};\n\nconst noResults: ReadonlyArray<never> = [];\n\nexport const loadingFirstPage = <Item = never, E = never>(options: {\n skipped: boolean;\n}): LoadingFirstPage<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"LoadingFirstPage\" as const,\n skipped: options.skipped,\n results: noResults,\n isLoading: true as const,\n });\n\nexport const loadingMore = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n}): LoadingMore<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"LoadingMore\" as const,\n results: options.results,\n isLoading: true as const,\n });\n\nexport const canLoadMore = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n loadMore: (numItems: number) => void;\n}): CanLoadMore<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"CanLoadMore\" as const,\n results: options.results,\n isLoading: false as const,\n loadMore: options.loadMore,\n });\n\nexport const exhausted = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n}): Exhausted<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"Exhausted\" as const,\n results: options.results,\n isLoading: false as const,\n });\n\nexport const failure = <E, Item = never>(options: {\n error: E;\n results: ReadonlyArray<Item>;\n}): Failure<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"Failure\" as const,\n error: options.error,\n results: options.results,\n });\n\nexport const isLoadingFirstPage = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingFirstPage<Item, E> => result._tag === \"LoadingFirstPage\";\n\nexport const isLoadingMore = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingMore<Item, E> => result._tag === \"LoadingMore\";\n\nexport const isCanLoadMore = <Item, E>(\n result: Variants<Item, E>,\n): result is CanLoadMore<Item, E> => result._tag === \"CanLoadMore\";\n\nexport const isExhausted = <Item, E>(\n result: Variants<Item, E>,\n): result is Exhausted<Item, E> => result._tag === \"Exhausted\";\n\nexport const isFailure = <Item, E>(\n result: Variants<Item, E>,\n): result is Failure<Item, E> => result._tag === \"Failure\";\n\nexport const isLoading = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingFirstPage<Item, E> | LoadingMore<Item, E> =>\n result._tag === \"LoadingFirstPage\" || result._tag === \"LoadingMore\";\n\ntype MatchOptions<Item, E, V, W, X, Y, Z> = {\n readonly onLoadingFirstPage: (skipped: boolean) => V;\n readonly onLoadingMore: (results: ReadonlyArray<Item>) => W;\n readonly onCanLoadMore: (\n results: ReadonlyArray<Item>,\n loadMore: (numItems: number) => void,\n ) => X;\n readonly onExhausted: (results: ReadonlyArray<Item>) => Y;\n} & ([E] extends [never]\n ? {}\n : {\n readonly onFailure: (error: E, results: ReadonlyArray<Item>) => Z;\n });\n\ntype MatchReturns<E, V, W, X, Y, Z> = [E] extends [never]\n ? V | W | X | Y\n : V | W | X | Y | Z;\n\n/**\n * Matches a {@link PaginatedQueryResult} to the appropriate handler based on\n * its tag. If the provided result cannot fail (i.e. `E` is `never`),\n * `onFailure` is not required.\n */\nexport const match: {\n <Item, E, V, W, X, Y, Z = never>(\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): (self: Variants<Item, E>) => MatchReturns<E, V, W, X, Y, Z>;\n <Item, E, V, W, X, Y, Z = never>(\n self: Variants<Item, E>,\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): MatchReturns<E, V, W, X, Y, Z>;\n} = Function.dual(\n 2,\n <Item, E, V, W, X, Y, Z = never>(\n self: Variants<Item, E>,\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): MatchReturns<E, V, W, X, Y, Z> =>\n Match.value(self).pipe(\n Match.tag(\"LoadingFirstPage\", (loadingFirstPage_) =>\n options.onLoadingFirstPage(loadingFirstPage_.skipped),\n ),\n Match.tag(\"LoadingMore\", (loadingMore_) =>\n options.onLoadingMore(loadingMore_.results),\n ),\n Match.tag(\"CanLoadMore\", (canLoadMore_) =>\n options.onCanLoadMore(canLoadMore_.results, canLoadMore_.loadMore),\n ),\n Match.tag(\"Exhausted\", (exhausted_) =>\n options.onExhausted(exhausted_.results),\n ),\n Match.tag(\"Failure\", (failure_) => {\n if (Predicate.hasProperty(options, \"onFailure\")) {\n return options.onFailure(failure_.error, failure_.results);\n }\n throw new Error(\n \"`onFailure` is required when error schema is provided\",\n );\n }),\n Match.exhaustive,\n ) as MatchReturns<E, V, W, X, Y, Z>,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,SAAS;AAsHf,MAAa,0BACX,MACoC,UAAU,YAAY,GAAG,MAAM;AAErE,MAAM,4BAA4B;EAC/B,SAAS;CACV,KAA+B,GAAG,MAA8B;EAC9D,OAAO,SAAS,cACd,MACA,IACF;CACF;;;;;;CAMA,CAAC,MAAM,QAAkC,MAAmC;EAC1E,IAAI,KAAK,SAAS,KAAK,MACrB,OAAO;EAET,OAAO,MAAM,MAAM,IAAI,CAAC,CAAC,KACvB,MAAM,IACJ,qBACC,SAAS,KAAK,YAAa,KAAoC,OAClE,GACA,MAAM,IAAI,eAAe,eAAe,cAAc,SACpD,MAAM,OAAO,KAAK,SAAS,KAAK,OAAO,CACzC,GACA,MAAM,IACJ,YACC,SACC,MAAM,OAAO,KAAK,OAAQ,KAA2B,KAAK,KAC1D,MAAM,OAAO,KAAK,SAAU,KAA2B,OAAO,CAClE,GACA,MAAM,UACR;CACF;CACA,CAAC,KAAK,UAA0C;EAC9C,MAAM,UAAU,KAAK,OAAO,KAAK,IAAI;EACrC,OAAO,MAAM,MAAM,IAAI,CAAC,CAAC,KACvB,MAAM,IAAI,qBAAqB,SAC7B,KA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BAAsB,OAAO,SAAS;;;;;;AAyBxD,MAAa,QAQT,SAAS,KACX,IAEE,MACA,YAEA,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,IAAI,qBAAqB,sBAC7B,QAAQ,mBAAmB,kBAAkB,OAAO,CACtD,GACA,MAAM,IAAI,gBAAgB,iBACxB,QAAQ,cAAc,aAAa,OAAO,CAC5C,GACA,MAAM,IAAI,gBAAgB,iBACxB,QAAQ,cAAc,aAAa,SAAS,aAAa,QAAQ,CACnE,GACA,MAAM,IAAI,cAAc,eACtB,QAAQ,YAAY,WAAW,OAAO,CACxC,GACA,MAAM,IAAI,YAAY,aAAa;CACjC,IAAI,UAAU,YAAY,SAAS,WAAW,GAC5C,OAAO,QAAQ,UAAU,SAAS,OAAO,SAAS,OAAO;CAE3D,MAAM,IAAI,MACR,uDACF;AACF,CAAC,GACD,MAAM,UACR,CACJ"}
|
|
1
|
+
{"version":3,"file":"PaginatedQueryResult.js","names":[],"sources":["../src/PaginatedQueryResult.ts"],"sourcesContent":["import * as Equal from \"effect/Equal\";\nimport * as Function from \"effect/Function\";\nimport * as Hash from \"effect/Hash\";\nimport * as Match from \"effect/Match\";\nimport * as Pipeable from \"effect/Pipeable\";\nimport * as Predicate from \"effect/Predicate\";\n\nconst TypeId = \"~@confect/react/PaginatedQueryResult\";\ntype TypeId = typeof TypeId;\n\n/**\n * A `PaginatedQueryResult` represents the result of a Confect paginated query.\n * The non-`Failure` variants mirror the statuses of `usePaginatedQuery` from\n * `convex/react` and all carry `results` and `isLoading`, so the common UI\n * shape—render the list, show a spinner while loading—needs only an\n * {@link isFailure} early-out and plain field access.\n *\n * Every variant carries `results`, including `Failure`: when a later page\n * fails, the pages already loaded are still worth rendering alongside the\n * error, so they are not discarded. `Failure` additionally carries the query's\n * decoded typed error.\n *\n * `loadMore` appears only on `CanLoadMore`, the one state it can make progress\n * from. The underlying Convex hook exposes it on every status, but calling it\n * while a page is in flight, once the list is exhausted, or after a failure is\n * an intentional no-op there; narrowing to `CanLoadMore`—via\n * {@link isCanLoadMore} or {@link match}—makes that statically apparent instead\n * of silently dropping the call.\n *\n * When the query declares no `error` schema (`E` is `never`), the `Failure`\n * variant is excluded from the type entirely, so `isLoading` is accessible\n * without any narrowing.\n *\n * @typeParam Item - The type of a decoded page item.\n * @typeParam E - The type of the decoded typed error in the `Failure` variant.\n */\nexport type PaginatedQueryResult<Item, E = never> = [E] extends [never]\n ?\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n :\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n | Failure<Item, E>;\n\n/**\n * Every variant regardless of `E`—the parameter type for guards and\n * {@link match}, since `PaginatedQueryResult` itself excludes `Failure` when `E`\n * is `never`.\n */\nexport type Variants<Item, E = never> =\n | LoadingFirstPage<Item, E>\n | LoadingMore<Item, E>\n | CanLoadMore<Item, E>\n | Exhausted<Item, E>\n | Failure<Item, E>;\n\nexport declare namespace PaginatedQueryResult {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export interface Proto<out Item, out E> extends Pipeable.Pipeable {\n readonly [TypeId]: TypeId;\n readonly \"~Item\": Item;\n readonly \"~E\": E;\n }\n\n export type Item<R> = R extends { readonly \"~Item\": infer Item_ }\n ? Item_\n : never;\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export type Failure<R> = R extends { readonly \"~E\": infer E } ? E : never;\n}\n\nexport interface LoadingFirstPage<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"LoadingFirstPage\";\n readonly skipped: boolean;\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: true;\n}\n\nexport interface LoadingMore<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"LoadingMore\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: true;\n}\n\nexport interface CanLoadMore<\n Item,\n E = never,\n> extends PaginatedQueryResult.Proto<Item, E> {\n readonly _tag: \"CanLoadMore\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: false;\n readonly loadMore: (numItems: number) => void;\n}\n\nexport interface Exhausted<Item, E = never> extends PaginatedQueryResult.Proto<\n Item,\n E\n> {\n readonly _tag: \"Exhausted\";\n readonly results: ReadonlyArray<Item>;\n readonly isLoading: false;\n}\n\nexport interface Failure<Item, E = never> extends PaginatedQueryResult.Proto<\n Item,\n E\n> {\n readonly _tag: \"Failure\";\n readonly error: E;\n /**\n * The pages loaded before the failure.\n */\n readonly results: ReadonlyArray<Item>;\n}\n\nexport const isPaginatedQueryResult = (\n u: unknown,\n): u is Variants<unknown, unknown> => Predicate.hasProperty(u, TypeId);\n\nconst PaginatedQueryResultProto = {\n [TypeId]: TypeId,\n pipe(this: Variants<any, any>, ...args: ReadonlyArray<unknown>) {\n return Pipeable.pipeArguments(\n this,\n args as unknown as Parameters<typeof Pipeable.pipeArguments>[1],\n );\n },\n /**\n * `CanLoadMore`'s `loadMore` is excluded from equality and hashing, like\n * function fields generally: two results that render identically are equal\n * even though their callbacks differ by identity.\n */\n [Equal.symbol](this: Variants<any, any>, that: Variants<any, any>): boolean {\n if (this._tag !== that._tag) {\n return false;\n }\n return Match.value(this).pipe(\n Match.tag(\n \"LoadingFirstPage\",\n (self) => self.skipped === (that as LoadingFirstPage<any, any>).skipped,\n ),\n Match.tag(\"LoadingMore\", \"CanLoadMore\", \"Exhausted\", (self) =>\n Equal.equals(self.results, that.results),\n ),\n Match.tag(\n \"Failure\",\n (self) =>\n Equal.equals(self.error, (that as Failure<any, any>).error) &&\n Equal.equals(self.results, (that as Failure<any, any>).results),\n ),\n Match.exhaustive,\n );\n },\n [Hash.symbol](this: Variants<any, any>): number {\n const tagHash = Hash.string(this._tag);\n return Match.value(this).pipe(\n Match.tag(\"LoadingFirstPage\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.skipped)),\n ),\n Match.tag(\"LoadingMore\", \"CanLoadMore\", \"Exhausted\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.results)),\n ),\n Match.tag(\"Failure\", (self) =>\n Hash.combine(tagHash)(\n Hash.combine(Hash.hash(self.error))(Hash.hash(self.results)),\n ),\n ),\n Match.exhaustive,\n );\n },\n};\n\nconst noResults: ReadonlyArray<never> = [];\n\nexport const loadingFirstPage = <Item = never, E = never>(options: {\n skipped: boolean;\n}): LoadingFirstPage<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"LoadingFirstPage\" as const,\n skipped: options.skipped,\n results: noResults,\n isLoading: true as const,\n });\n\nexport const loadingMore = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n}): LoadingMore<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"LoadingMore\" as const,\n results: options.results,\n isLoading: true as const,\n });\n\nexport const canLoadMore = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n loadMore: (numItems: number) => void;\n}): CanLoadMore<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"CanLoadMore\" as const,\n results: options.results,\n isLoading: false as const,\n loadMore: options.loadMore,\n });\n\nexport const exhausted = <Item, E = never>(options: {\n results: ReadonlyArray<Item>;\n}): Exhausted<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"Exhausted\" as const,\n results: options.results,\n isLoading: false as const,\n });\n\nexport const failure = <E, Item = never>(options: {\n error: E;\n results: ReadonlyArray<Item>;\n}): Failure<Item, E> =>\n Object.assign(Object.create(PaginatedQueryResultProto), {\n _tag: \"Failure\" as const,\n error: options.error,\n results: options.results,\n });\n\nexport const isLoadingFirstPage = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingFirstPage<Item, E> => result._tag === \"LoadingFirstPage\";\n\nexport const isLoadingMore = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingMore<Item, E> => result._tag === \"LoadingMore\";\n\nexport const isCanLoadMore = <Item, E>(\n result: Variants<Item, E>,\n): result is CanLoadMore<Item, E> => result._tag === \"CanLoadMore\";\n\nexport const isExhausted = <Item, E>(\n result: Variants<Item, E>,\n): result is Exhausted<Item, E> => result._tag === \"Exhausted\";\n\nexport const isFailure = <Item, E>(\n result: Variants<Item, E>,\n): result is Failure<Item, E> => result._tag === \"Failure\";\n\nexport const isLoading = <Item, E>(\n result: Variants<Item, E>,\n): result is LoadingFirstPage<Item, E> | LoadingMore<Item, E> =>\n result._tag === \"LoadingFirstPage\" || result._tag === \"LoadingMore\";\n\ntype MatchOptions<Item, E, V, W, X, Y, Z> = {\n readonly onLoadingFirstPage: (skipped: boolean) => V;\n readonly onLoadingMore: (results: ReadonlyArray<Item>) => W;\n readonly onCanLoadMore: (\n results: ReadonlyArray<Item>,\n loadMore: (numItems: number) => void,\n ) => X;\n readonly onExhausted: (results: ReadonlyArray<Item>) => Y;\n} & ([E] extends [never]\n ? {}\n : {\n readonly onFailure: (error: E, results: ReadonlyArray<Item>) => Z;\n });\n\ntype MatchReturns<E, V, W, X, Y, Z> = [E] extends [never]\n ? V | W | X | Y\n : V | W | X | Y | Z;\n\n/**\n * Matches a {@link PaginatedQueryResult} to the appropriate handler based on its\n * tag. If the provided result cannot fail (i.e. `E` is `never`), `onFailure` is\n * not required.\n */\nexport const match: {\n <Item, E, V, W, X, Y, Z = never>(\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): (self: Variants<Item, E>) => MatchReturns<E, V, W, X, Y, Z>;\n <Item, E, V, W, X, Y, Z = never>(\n self: Variants<Item, E>,\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): MatchReturns<E, V, W, X, Y, Z>;\n} = Function.dual(\n 2,\n <Item, E, V, W, X, Y, Z = never>(\n self: Variants<Item, E>,\n options: MatchOptions<Item, E, V, W, X, Y, Z>,\n ): MatchReturns<E, V, W, X, Y, Z> =>\n Match.value(self).pipe(\n Match.tag(\"LoadingFirstPage\", (loadingFirstPage_) =>\n options.onLoadingFirstPage(loadingFirstPage_.skipped),\n ),\n Match.tag(\"LoadingMore\", (loadingMore_) =>\n options.onLoadingMore(loadingMore_.results),\n ),\n Match.tag(\"CanLoadMore\", (canLoadMore_) =>\n options.onCanLoadMore(canLoadMore_.results, canLoadMore_.loadMore),\n ),\n Match.tag(\"Exhausted\", (exhausted_) =>\n options.onExhausted(exhausted_.results),\n ),\n Match.tag(\"Failure\", (failure_) => {\n if (Predicate.hasProperty(options, \"onFailure\")) {\n return options.onFailure(failure_.error, failure_.results);\n }\n throw new Error(\n \"`onFailure` is required when error schema is provided\",\n );\n }),\n Match.exhaustive,\n ) as MatchReturns<E, V, W, X, Y, Z>,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,SAAS;AAwHf,MAAa,0BACX,MACoC,UAAU,YAAY,GAAG,MAAM;AAErE,MAAM,4BAA4B;EAC/B,SAAS;CACV,KAA+B,GAAG,MAA8B;EAC9D,OAAO,SAAS,cACd,MACA,IACF;CACF;;;;;;CAMA,CAAC,MAAM,QAAkC,MAAmC;EAC1E,IAAI,KAAK,SAAS,KAAK,MACrB,OAAO;EAET,OAAO,MAAM,MAAM,IAAI,CAAC,CAAC,KACvB,MAAM,IACJ,qBACC,SAAS,KAAK,YAAa,KAAoC,OAClE,GACA,MAAM,IAAI,eAAe,eAAe,cAAc,SACpD,MAAM,OAAO,KAAK,SAAS,KAAK,OAAO,CACzC,GACA,MAAM,IACJ,YACC,SACC,MAAM,OAAO,KAAK,OAAQ,KAA2B,KAAK,KAC1D,MAAM,OAAO,KAAK,SAAU,KAA2B,OAAO,CAClE,GACA,MAAM,UACR;CACF;CACA,CAAC,KAAK,UAA0C;EAC9C,MAAM,UAAU,KAAK,OAAO,KAAK,IAAI;EACrC,OAAO,MAAM,MAAM,IAAI,CAAC,CAAC,KACvB,MAAM,IAAI,qBAAqB,SAC7B,KAAK,QAAQ,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,OAAO,CAAC,CAC/C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A,YAEA,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,IAAI,qBAAqB,sBAC7B,QAAQ,mBAAmB,kBAAkB,OAAO,CACtD,GACA,MAAM,IAAI,gBAAgB,iBACxB,QAAQ,cAAc,aAAa,OAAO,CAC5C,GACA,MAAM,IAAI,gBAAgB,iBACxB,QAAQ,cAAc,aAAa,SAAS,aAAa,QAAQ,CACnE,GACA,MAAM,IAAI,cAAc,eACtB,QAAQ,YAAY,WAAW,OAAO,CACxC,GACA,MAAM,IAAI,YAAY,aAAa;CACjC,IAAI,UAAU,YAAY,SAAS,WAAW,GAC5C,OAAO,QAAQ,UAAU,SAAS,OAAO,SAAS,OAAO;CAE3D,MAAM,IAAI,MACR,uDACF;AACF,CAAC,GACD,MAAM,UACR,CACJ"}
|
package/dist/QueryResult.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ type TypeId = typeof TypeId;
|
|
|
4
4
|
/**
|
|
5
5
|
* A `QueryResult` represents the result of a Confect query.
|
|
6
6
|
*
|
|
7
|
-
* @typeParam A - The type of the decoded `returns` value in the `Success`
|
|
7
|
+
* @typeParam A - The type of the decoded `returns` value in the `Success`
|
|
8
|
+
* variant.
|
|
8
9
|
* @typeParam E - The type of the decoded typed error in the `Failure` variant.
|
|
9
10
|
*/
|
|
10
11
|
export type QueryResult<A, E = never> = Loading<A, E> | Success<A, E> | Failure<A, E>;
|
|
@@ -53,12 +54,11 @@ type MatchReturns<E, X, Y, Z> = [E] extends [never] ? X | Y : X | Y | Z;
|
|
|
53
54
|
* not required.
|
|
54
55
|
*
|
|
55
56
|
* @example
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* });
|
|
57
|
+
* const result = QueryResult.match(queryResult, {
|
|
58
|
+
* onLoading: (skipped) => (skipped ? null : <p>Loading…</p>),
|
|
59
|
+
* onSuccess: (value) => <p>{value.text}</p>,
|
|
60
|
+
* onFailure: (error) => <p>Error: {error.message}</p>,
|
|
61
|
+
* });
|
|
62
62
|
*/
|
|
63
63
|
export declare const match: {
|
|
64
64
|
<A, E, X, Y, Z = never>(options: MatchOptions<A, E, X, Y, Z>): (self: QueryResult<A, E>) => MatchReturns<E, X, Y, Z>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResult.d.ts","sourceRoot":"","sources":["../src/QueryResult.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,QAAA,MAAM,MAAM,gCAAgC,CAAC;AAC7C,KAAK,MAAM,GAAG,OAAO,MAAM,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"QueryResult.d.ts","sourceRoot":"","sources":["../src/QueryResult.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,QAAA,MAAM,MAAM,gCAAgC,CAAC;AAC7C,KAAK,MAAM,GAAG,OAAO,MAAM,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAChC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAElB,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,UAAiB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,QAAQ;QAC5D,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACjB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;KAClB;IAGD,KAAY,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAA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AAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACnC,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EACpB,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACnC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAoB7B,CAAC"}
|
package/dist/QueryResult.js
CHANGED
|
@@ -53,12 +53,11 @@ const isFailure = (queryResult) => queryResult._tag === "Failure";
|
|
|
53
53
|
* not required.
|
|
54
54
|
*
|
|
55
55
|
* @example
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* });
|
|
56
|
+
* const result = QueryResult.match(queryResult, {
|
|
57
|
+
* onLoading: (skipped) => (skipped ? null : <p>Loading…</p>),
|
|
58
|
+
* onSuccess: (value) => <p>{value.text}</p>,
|
|
59
|
+
* onFailure: (error) => <p>Error: {error.message}</p>,
|
|
60
|
+
* });
|
|
62
61
|
*/
|
|
63
62
|
const match = Function.dual(2, (self, options) => Match.value(self).pipe(Match.tag("Loading", (loading) => options.onLoading(loading.skipped)), Match.tag("Success", (success) => options.onSuccess(success.value)), Match.tag("Failure", (failure) => {
|
|
64
63
|
if (Predicate.hasProperty(options, "onFailure")) return options.onFailure(failure.error);
|
package/dist/QueryResult.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResult.js","names":[],"sources":["../src/QueryResult.ts"],"sourcesContent":["import * as Equal from \"effect/Equal\";\nimport * as Function from \"effect/Function\";\nimport * as Hash from \"effect/Hash\";\nimport * as Match from \"effect/Match\";\nimport * as Pipeable from \"effect/Pipeable\";\nimport * as Predicate from \"effect/Predicate\";\n\nconst TypeId = \"~@confect/react/QueryResult\";\ntype TypeId = typeof TypeId;\n\n/**\n * A `QueryResult` represents the result of a Confect query.\n *\n * @typeParam A - The type of the decoded `returns` value in the `Success
|
|
1
|
+
{"version":3,"file":"QueryResult.js","names":[],"sources":["../src/QueryResult.ts"],"sourcesContent":["import * as Equal from \"effect/Equal\";\nimport * as Function from \"effect/Function\";\nimport * as Hash from \"effect/Hash\";\nimport * as Match from \"effect/Match\";\nimport * as Pipeable from \"effect/Pipeable\";\nimport * as Predicate from \"effect/Predicate\";\n\nconst TypeId = \"~@confect/react/QueryResult\";\ntype TypeId = typeof TypeId;\n\n/**\n * A `QueryResult` represents the result of a Confect query.\n *\n * @typeParam A - The type of the decoded `returns` value in the `Success`\n * variant.\n * @typeParam E - The type of the decoded typed error in the `Failure` variant.\n */\nexport type QueryResult<A, E = never> =\n | Loading<A, E>\n | Success<A, E>\n | Failure<A, E>;\n\nexport declare namespace QueryResult {\n export interface Proto<out A, out E> extends Pipeable.Pipeable {\n readonly [TypeId]: TypeId;\n readonly \"~A\": A;\n readonly \"~E\": E;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export type Success<R> = R extends { readonly \"~A\": infer A } ? A : never;\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export type Failure<R> = R extends { readonly \"~E\": infer E } ? E : never;\n}\n\nexport interface Loading<A, E = never> extends QueryResult.Proto<A, E> {\n readonly _tag: \"Loading\";\n readonly skipped: boolean;\n}\n\nexport interface Success<A, E = never> extends QueryResult.Proto<A, E> {\n readonly _tag: \"Success\";\n readonly value: A;\n}\n\nexport interface Failure<A, E = never> extends QueryResult.Proto<A, E> {\n readonly _tag: \"Failure\";\n readonly error: E;\n}\n\nexport const isQueryResult = (u: unknown): u is QueryResult<unknown, unknown> =>\n Predicate.hasProperty(u, TypeId);\n\nconst QueryResultProto = {\n [TypeId]: TypeId,\n pipe(this: QueryResult<any, any>, ...args: ReadonlyArray<unknown>) {\n return Pipeable.pipeArguments(\n this,\n args as unknown as Parameters<typeof Pipeable.pipeArguments>[1],\n );\n },\n [Equal.symbol](\n this: QueryResult<any, any>,\n that: QueryResult<any, any>,\n ): boolean {\n if (this._tag !== that._tag) {\n return false;\n }\n return Match.value(this).pipe(\n Match.tag(\n \"Loading\",\n (self) => self.skipped === (that as Loading<any, any>).skipped,\n ),\n Match.tag(\"Success\", (self) =>\n Equal.equals(self.value, (that as Success<any, any>).value),\n ),\n Match.tag(\"Failure\", (self) =>\n Equal.equals(self.error, (that as Failure<any, any>).error),\n ),\n Match.exhaustive,\n );\n },\n [Hash.symbol](this: QueryResult<any, any>): number {\n const tagHash = Hash.string(this._tag);\n return Match.value(this).pipe(\n Match.tag(\"Loading\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.skipped)),\n ),\n Match.tag(\"Success\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.value)),\n ),\n Match.tag(\"Failure\", (self) =>\n Hash.combine(tagHash)(Hash.hash(self.error)),\n ),\n Match.exhaustive,\n );\n },\n};\n\nexport const load = <A = never, E = never>(skipped: boolean): Loading<A, E> =>\n Object.assign(Object.create(QueryResultProto), {\n _tag: \"Loading\" as const,\n skipped,\n });\n\nexport const succeed = <A, E = never>(value: A): Success<A, E> =>\n Object.assign(Object.create(QueryResultProto), {\n _tag: \"Success\" as const,\n value,\n });\n\nexport const fail = <E, A = never>(error: E): Failure<A, E> =>\n Object.assign(Object.create(QueryResultProto), {\n _tag: \"Failure\" as const,\n error,\n });\n\nexport const isLoading = <A, E>(\n queryResult: QueryResult<A, E>,\n): queryResult is Loading<A, E> => queryResult._tag === \"Loading\";\n\nexport const isSuccess = <A, E>(\n queryResult: QueryResult<A, E>,\n): queryResult is Success<A, E> => queryResult._tag === \"Success\";\n\nexport const isFailure = <A, E>(\n queryResult: QueryResult<A, E>,\n): queryResult is Failure<A, E> => queryResult._tag === \"Failure\";\n\ntype MatchOptions<A, E, X, Y, Z> = {\n readonly onLoading: (skipped: boolean) => X;\n readonly onSuccess: (value: A) => Y;\n} & ([E] extends [never] ? {} : { readonly onFailure: (error: E) => Z });\n\ntype MatchReturns<E, X, Y, Z> = [E] extends [never] ? X | Y : X | Y | Z;\n\n/**\n * Matches a {@link QueryResult} to the appropriate handler based on its tag. If\n * the provided `QueryResult` cannot fail (i.e. `E` is `never`), `onFailure` is\n * not required.\n *\n * @example\n * const result = QueryResult.match(queryResult, {\n * onLoading: (skipped) => (skipped ? null : <p>Loading…</p>),\n * onSuccess: (value) => <p>{value.text}</p>,\n * onFailure: (error) => <p>Error: {error.message}</p>,\n * });\n */\nexport const match: {\n <A, E, X, Y, Z = never>(\n options: MatchOptions<A, E, X, Y, Z>,\n ): (self: QueryResult<A, E>) => MatchReturns<E, X, Y, Z>;\n <A, E, X, Y, Z = never>(\n self: QueryResult<A, E>,\n options: MatchOptions<A, E, X, Y, Z>,\n ): MatchReturns<E, X, Y, Z>;\n} = Function.dual(\n 2,\n <A, E, X, Y, Z = never>(\n self: QueryResult<A, E>,\n options: MatchOptions<A, E, X, Y, Z>,\n ): MatchReturns<E, X, Y, Z> =>\n Match.value(self).pipe(\n Match.tag(\"Loading\", (loading) => options.onLoading(loading.skipped)),\n Match.tag(\"Success\", (success) => options.onSuccess(success.value)),\n Match.tag(\"Failure\", (failure) => {\n if (Predicate.hasProperty(options, \"onFailure\")) {\n return options.onFailure(failure.error);\n }\n throw new Error(\n \"`onFailure` is required when error schema is provided\",\n );\n }),\n Match.exhaustive,\n ) as MatchReturns<E, X, Y, Z>,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAOA,MAAM,SAAS;AA4Cf,MAAa,iBAAiB,MAC5B,UAAU,YAAY,GAAG,MAAM;AAEjC,MAAM,mBAAmB;EACtB,SAAS;CACV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a,QAQT,SAAS,KACX,IAEE,MACA,YAEA,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,IAAI,YAAY,YAAY,QAAQ,UAAU,QAAQ,OAAO,CAAC,GACpE,MAAM,IAAI,YAAY,YAAY,QAAQ,UAAU,QAAQ,KAAK,CAAC,GAClE,MAAM,IAAI,YAAY,YAAY;CAChC,IAAI,UAAU,YAAY,SAAS,WAAW,GAC5C,OAAO,QAAQ,UAAU,QAAQ,KAAK;CAExC,MAAM,IAAI,MACR,uDACF;AACF,CAAC,GACD,MAAM,UACR,CACJ"}
|
|
@@ -2,48 +2,60 @@
|
|
|
2
2
|
* EXPERIMENTAL—the pure state machine behind {@link useStreamPaginatedQuery}
|
|
3
3
|
* (see `notes/stream-based-querying.md` in the repo root).
|
|
4
4
|
*
|
|
5
|
-
* Reactive pagination without the query journal: every loaded page—including
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Reactive pagination without the query journal: every loaded page—including
|
|
6
|
+
* the first—is pinned to a fixed index range by echoing its `continueCursor`
|
|
7
|
+
* back as the next subscription's `endCursor` (the last page pins to the
|
|
8
|
+
* end-of-stream sentinel once exhausted), so adjacent pages stay exactly
|
|
9
|
+
* contiguous and pages never shed items as data changes—the "range-defined
|
|
10
|
+
* pages" the Fully Reactive Pagination article calls for, and the mechanism of
|
|
11
|
+
* `convex-helpers/react`'s `usePaginatedQuery`.
|
|
10
12
|
*
|
|
11
|
-
* Pinning a freshly loaded page, loading more, and splitting an overgrown
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Pinning a freshly loaded page, loading more, and splitting an overgrown page
|
|
14
|
+
* are the same transition shape: the affected page keeps rendering while its
|
|
15
|
+
* replacement subscriptions ("ongoing split") load, and is swapped out once all
|
|
16
|
+
* of them have results.
|
|
15
17
|
*
|
|
16
|
-
* This module is framework-free (it imports only `effect/*` and a type
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* This module is framework-free (it imports only `effect/*` and a type from
|
|
19
|
+
* `convex/server`); it lives here for now because the React hook is its only
|
|
20
|
+
* consumer—a second client (e.g. `@confect/foldkit`) should prompt a move down
|
|
21
|
+
* to `@confect/js`.
|
|
20
22
|
*/
|
|
21
23
|
import type { PaginationResult } from "convex/server";
|
|
22
24
|
import * as Option from "effect/Option";
|
|
23
25
|
import * as Record from "effect/Record";
|
|
24
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The `paginationOpts` one subscribed page queries with.
|
|
28
|
+
*/
|
|
25
29
|
export interface PageRequest {
|
|
26
30
|
readonly numItems: number;
|
|
27
31
|
readonly cursor: string | null;
|
|
28
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Present once the page is pinned to a fixed range.
|
|
34
|
+
*/
|
|
29
35
|
readonly endCursor?: string;
|
|
30
36
|
/**
|
|
31
|
-
* Per-page read budgets, forwarded to the server so a scan-heavy page
|
|
32
|
-
*
|
|
37
|
+
* Per-page read budgets, forwarded to the server so a scan-heavy page fails
|
|
38
|
+
* over to `SplitRequired` instead of exceeding query limits.
|
|
33
39
|
*/
|
|
34
40
|
readonly maximumRowsRead?: number;
|
|
35
41
|
readonly maximumBytesRead?: number;
|
|
36
42
|
}
|
|
37
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The per-page read budgets every growing page is requested with.
|
|
45
|
+
*/
|
|
38
46
|
export interface ReadBudget {
|
|
39
47
|
readonly maximumRowsRead?: number | undefined;
|
|
40
48
|
readonly maximumBytesRead?: number | undefined;
|
|
41
49
|
}
|
|
42
50
|
export interface State {
|
|
43
51
|
readonly nextPageKey: number;
|
|
44
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Page keys in display order.
|
|
54
|
+
*/
|
|
45
55
|
readonly pageKeys: ReadonlyArray<string>;
|
|
46
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The request each subscribed page queries with, by page key.
|
|
58
|
+
*/
|
|
47
59
|
readonly pages: Record.ReadonlyRecord<string, PageRequest>;
|
|
48
60
|
/**
|
|
49
61
|
* Pages being replaced by one (a pin) or two (a split) narrower
|
|
@@ -52,73 +64,93 @@ export interface State {
|
|
|
52
64
|
*/
|
|
53
65
|
readonly ongoingSplits: Record.ReadonlyRecord<string, ReadonlyArray<string>>;
|
|
54
66
|
}
|
|
55
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The skipped state: nothing subscribed.
|
|
69
|
+
*/
|
|
56
70
|
export declare const empty: State;
|
|
57
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* One growing (unpinned) page from the start of the stream.
|
|
73
|
+
*/
|
|
58
74
|
export declare const initial: (initialNumItems: number, budget?: ReadBudget) => State;
|
|
59
75
|
/**
|
|
60
76
|
* Pin a freshly loaded growing page at its `continueCursor` (or, once
|
|
61
77
|
* exhausted, at the end-of-stream sentinel), so it stops being a sliding
|
|
62
|
-
* window: a pinned page grows and shrinks with the data in its range but
|
|
63
|
-
*
|
|
64
|
-
*
|
|
78
|
+
* window: a pinned page grows and shrinks with the data in its range but never
|
|
79
|
+
* sheds items past its edges. Modeled as a one-replacement split so the
|
|
80
|
+
* original keeps rendering until the pinned twin has a result.
|
|
65
81
|
*/
|
|
66
82
|
export declare const pin: (key: string, endCursor: string) => ((state: State) => State);
|
|
67
83
|
/**
|
|
68
|
-
* Pin the growing last page at `continueCursor` and start a new growing
|
|
69
|
-
*
|
|
70
|
-
*
|
|
84
|
+
* Pin the growing last page at `continueCursor` and start a new growing page
|
|
85
|
+
* from there. Modeled as a split of the last page into its pinned replacement
|
|
86
|
+
* and the new page, so the swap waits for both.
|
|
71
87
|
*/
|
|
72
88
|
export declare const loadMore: (continueCursor: string, numItems: number, budget?: ReadBudget) => ((state: State) => State);
|
|
73
89
|
/**
|
|
74
|
-
* Split the page at `key` in two at `splitCursor`. The first replacement
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* growing).
|
|
90
|
+
* Split the page at `key` in two at `splitCursor`. The first replacement pins
|
|
91
|
+
* at the split point; the second keeps the page's own `endCursor`—for a pinned
|
|
92
|
+
* page its original end (so a truncated `SplitRequired` page loses none of its
|
|
93
|
+
* range), and for a growing page no end at all (it keeps growing).
|
|
78
94
|
*/
|
|
79
95
|
export declare const split: (key: string, splitCursor: string) => ((state: State) => State);
|
|
80
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Swap a completed split's replacements in for the original page.
|
|
98
|
+
*/
|
|
81
99
|
export declare const completeSplit: (key: string) => ((state: State) => State);
|
|
82
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Whether the last (rendered) page is currently being split or pinned.
|
|
102
|
+
*/
|
|
83
103
|
export declare const isLastPageSplitting: (state: State) => boolean;
|
|
84
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Build one subscription request per subscribed page.
|
|
106
|
+
*/
|
|
85
107
|
export declare const pageRequests: <A>(state: State, f: (page: PageRequest) => A) => Record.ReadonlyRecord<string, A>;
|
|
86
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* The per-page results a render observes, keyed like {@link pageRequests}.
|
|
110
|
+
*/
|
|
87
111
|
export type Results = Record.ReadonlyRecord<string, PageResult | Error | undefined>;
|
|
88
112
|
/**
|
|
89
|
-
* The wire shape of one loaded page—`PaginationResult` from
|
|
90
|
-
*
|
|
113
|
+
* The wire shape of one loaded page—`PaginationResult` from `convex/server`, so
|
|
114
|
+
* the protocol has a single source of truth.
|
|
91
115
|
*/
|
|
92
116
|
export type PageResult = PaginationResult<unknown>;
|
|
93
117
|
/**
|
|
94
|
-
* What one render pass derives from the subscribed pages' results: the
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
118
|
+
* What one render pass derives from the subscribed pages' results: the items to
|
|
119
|
+
* show, the trailing complete result (absent while the tail is loading or
|
|
120
|
+
* force-splitting), state transitions to apply, and whether a failure or an
|
|
121
|
+
* invalid cursor was hit.
|
|
98
122
|
*/
|
|
99
123
|
export type Interpretation = {
|
|
100
124
|
readonly _tag: "ResetRequired";
|
|
101
125
|
} | {
|
|
102
126
|
readonly _tag: "Failed";
|
|
103
127
|
readonly error: unknown;
|
|
104
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Encoded items loaded before the failing page.
|
|
130
|
+
*/
|
|
105
131
|
readonly items: ReadonlyArray<unknown>;
|
|
106
132
|
} | {
|
|
107
133
|
readonly _tag: "Interpreted";
|
|
108
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Encoded items across the loaded pages, in order.
|
|
136
|
+
*/
|
|
109
137
|
readonly items: ReadonlyArray<unknown>;
|
|
110
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* The last page's result, when every page has loaded completely.
|
|
140
|
+
*/
|
|
111
141
|
readonly lastResult: Option.Option<PageResult>;
|
|
112
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Split/swap transitions this render discovered.
|
|
144
|
+
*/
|
|
113
145
|
readonly transitions: ReadonlyArray<(state: State) => State>;
|
|
114
146
|
};
|
|
115
147
|
/**
|
|
116
|
-
* Walk the pages in display order, concatenating their items and
|
|
117
|
-
*
|
|
118
|
-
*
|
|
148
|
+
* Walk the pages in display order, concatenating their items and collecting the
|
|
149
|
+
* transitions to apply (completed split swaps, recommended splits, eager splits
|
|
150
|
+
* of pages that outgrew `initialNumItems`).
|
|
119
151
|
*
|
|
120
|
-
* `isInvalidCursorError` marks errors that call for a full pagination
|
|
121
|
-
*
|
|
152
|
+
* `isInvalidCursorError` marks errors that call for a full pagination reset
|
|
153
|
+
* rather than a failure (the cursor no longer matches the query).
|
|
122
154
|
*/
|
|
123
155
|
export declare const interpret: (state: State, results: Record.ReadonlyRecord<string, PageResult | Error | undefined>, options: {
|
|
124
156
|
readonly initialNumItems: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamPagination.d.ts","sourceRoot":"","sources":["../src/StreamPagination.ts"],"names":[],"mappings":"AAAA
|
|
1
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