@distilled.cloud/core 0.30.3 → 1.0.0-rc.10
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/LICENSE +201 -0
- package/lib/api.d.ts +165 -0
- package/lib/api.d.ts.map +1 -0
- package/lib/api.js +190 -0
- package/lib/api.js.map +1 -0
- package/lib/category.d.ts +4 -4
- package/lib/category.js +4 -4
- package/lib/codegen/boolean-string-enums.d.ts +36 -0
- package/lib/codegen/boolean-string-enums.d.ts.map +1 -0
- package/lib/codegen/boolean-string-enums.js +94 -0
- package/lib/codegen/boolean-string-enums.js.map +1 -0
- package/lib/codegen/boolean-string-enums.test.d.ts +2 -0
- package/lib/codegen/boolean-string-enums.test.d.ts.map +1 -0
- package/lib/codegen/boolean-string-enums.test.js +147 -0
- package/lib/codegen/boolean-string-enums.test.js.map +1 -0
- package/lib/codegen/cli.d.ts +79 -0
- package/lib/codegen/cli.d.ts.map +1 -0
- package/lib/codegen/cli.js +149 -0
- package/lib/codegen/cli.js.map +1 -0
- package/lib/codegen/emit.d.ts +125 -0
- package/lib/codegen/emit.d.ts.map +1 -0
- package/lib/codegen/emit.js +101 -0
- package/lib/codegen/emit.js.map +1 -0
- package/lib/codegen/format.d.ts +23 -0
- package/lib/codegen/format.d.ts.map +1 -0
- package/lib/codegen/format.js +28 -0
- package/lib/codegen/format.js.map +1 -0
- package/lib/codegen/generator.d.ts +334 -0
- package/lib/codegen/generator.d.ts.map +1 -0
- package/lib/codegen/generator.js +813 -0
- package/lib/codegen/generator.js.map +1 -0
- package/lib/codegen/graph.d.ts +36 -0
- package/lib/codegen/graph.d.ts.map +1 -0
- package/lib/codegen/graph.js +136 -0
- package/lib/codegen/graph.js.map +1 -0
- package/lib/codegen/graphql-client.d.ts +62 -0
- package/lib/codegen/graphql-client.d.ts.map +1 -0
- package/lib/codegen/graphql-client.js +294 -0
- package/lib/codegen/graphql-client.js.map +1 -0
- package/lib/codegen/graphql-client.test.d.ts +2 -0
- package/lib/codegen/graphql-client.test.d.ts.map +1 -0
- package/lib/codegen/graphql-client.test.js +311 -0
- package/lib/codegen/graphql-client.test.js.map +1 -0
- package/lib/codegen/graphql.d.ts +207 -0
- package/lib/codegen/graphql.d.ts.map +1 -0
- package/lib/codegen/graphql.js +799 -0
- package/lib/codegen/graphql.js.map +1 -0
- package/lib/codegen/members.d.ts +25 -0
- package/lib/codegen/members.d.ts.map +1 -0
- package/lib/codegen/members.js +55 -0
- package/lib/codegen/members.js.map +1 -0
- package/lib/codegen/naming.d.ts +29 -0
- package/lib/codegen/naming.d.ts.map +1 -0
- package/lib/codegen/naming.js +74 -0
- package/lib/codegen/naming.js.map +1 -0
- package/lib/codegen/openapi-cli.d.ts +52 -0
- package/lib/codegen/openapi-cli.d.ts.map +1 -0
- package/lib/codegen/openapi-cli.js +109 -0
- package/lib/codegen/openapi-cli.js.map +1 -0
- package/lib/codegen/openapi.d.ts +178 -0
- package/lib/codegen/openapi.d.ts.map +1 -0
- package/lib/codegen/openapi.js +1377 -0
- package/lib/codegen/openapi.js.map +1 -0
- package/lib/codegen/operations.d.ts +24 -0
- package/lib/codegen/operations.d.ts.map +1 -0
- package/lib/codegen/operations.js +56 -0
- package/lib/codegen/operations.js.map +1 -0
- package/lib/codegen/pagination.d.ts +39 -0
- package/lib/codegen/pagination.d.ts.map +1 -0
- package/lib/codegen/pagination.js +33 -0
- package/lib/codegen/pagination.js.map +1 -0
- package/lib/codegen/patches.d.ts +65 -0
- package/lib/codegen/patches.d.ts.map +1 -0
- package/lib/codegen/patches.js +236 -0
- package/lib/codegen/patches.js.map +1 -0
- package/lib/codegen/patches.test.d.ts +2 -0
- package/lib/codegen/patches.test.d.ts.map +1 -0
- package/lib/codegen/patches.test.js +105 -0
- package/lib/codegen/patches.test.js.map +1 -0
- package/lib/codegen/prelude.d.ts +15 -0
- package/lib/codegen/prelude.d.ts.map +1 -0
- package/lib/codegen/prelude.js +60 -0
- package/lib/codegen/prelude.js.map +1 -0
- package/lib/codegen/proto.d.ts +121 -0
- package/lib/codegen/proto.d.ts.map +1 -0
- package/lib/codegen/proto.js +962 -0
- package/lib/codegen/proto.js.map +1 -0
- package/lib/codegen/rewrite-operation-ids.d.ts +131 -0
- package/lib/codegen/rewrite-operation-ids.d.ts.map +1 -0
- package/lib/codegen/rewrite-operation-ids.js +1079 -0
- package/lib/codegen/rewrite-operation-ids.js.map +1 -0
- package/lib/codegen/rewrite-operation-ids.test.d.ts +2 -0
- package/lib/codegen/rewrite-operation-ids.test.d.ts.map +1 -0
- package/lib/codegen/rewrite-operation-ids.test.js +533 -0
- package/lib/codegen/rewrite-operation-ids.test.js.map +1 -0
- package/lib/codegen/spec-path.d.ts +16 -0
- package/lib/codegen/spec-path.d.ts.map +1 -0
- package/lib/codegen/spec-path.js +101 -0
- package/lib/codegen/spec-path.js.map +1 -0
- package/lib/error-category.d.ts +28 -0
- package/lib/error-category.d.ts.map +1 -0
- package/lib/error-category.js +46 -0
- package/lib/error-category.js.map +1 -0
- package/lib/errors.d.ts +1 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +18 -13
- package/lib/errors.js.map +1 -1
- package/lib/graphql.d.ts +284 -0
- package/lib/graphql.d.ts.map +1 -0
- package/lib/graphql.fixture.d.ts +249 -0
- package/lib/graphql.fixture.d.ts.map +1 -0
- package/lib/graphql.fixture.js +240 -0
- package/lib/graphql.fixture.js.map +1 -0
- package/lib/graphql.js +718 -0
- package/lib/graphql.js.map +1 -0
- package/lib/graphql.test.d.ts +2 -0
- package/lib/graphql.test.d.ts.map +1 -0
- package/lib/graphql.test.js +780 -0
- package/lib/graphql.test.js.map +1 -0
- package/lib/graphql.types.d.ts +2 -0
- package/lib/graphql.types.d.ts.map +1 -0
- package/lib/graphql.types.js +45 -0
- package/lib/graphql.types.js.map +1 -0
- package/lib/json-patch.d.ts +30 -30
- package/lib/json-patch.d.ts.map +1 -1
- package/lib/json-patch.js +73 -107
- package/lib/json-patch.js.map +1 -1
- package/lib/pagination.d.ts +77 -51
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +162 -94
- package/lib/pagination.js.map +1 -1
- package/lib/protocol-http.d.ts +74 -0
- package/lib/protocol-http.d.ts.map +1 -0
- package/lib/protocol-http.js +590 -0
- package/lib/protocol-http.js.map +1 -0
- package/lib/protocol-http.test.d.ts +2 -0
- package/lib/protocol-http.test.d.ts.map +1 -0
- package/lib/protocol-http.test.js +88 -0
- package/lib/protocol-http.test.js.map +1 -0
- package/lib/protocol-rest.d.ts +134 -0
- package/lib/protocol-rest.d.ts.map +1 -0
- package/lib/protocol-rest.js +256 -0
- package/lib/protocol-rest.js.map +1 -0
- package/lib/retry.d.ts +8 -2
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +22 -16
- package/lib/retry.js.map +1 -1
- package/lib/schema.d.ts +8 -9
- package/lib/schema.d.ts.map +1 -1
- package/lib/schema.js +8 -9
- package/lib/schema.js.map +1 -1
- package/lib/trait.d.ts +174 -0
- package/lib/trait.d.ts.map +1 -0
- package/lib/trait.js +123 -0
- package/lib/trait.js.map +1 -0
- package/package.json +24 -78
- package/src/api.ts +460 -0
- package/src/category.ts +4 -4
- package/src/codegen/boolean-string-enums.test.ts +168 -0
- package/src/codegen/boolean-string-enums.ts +106 -0
- package/src/codegen/cli.ts +285 -0
- package/src/codegen/emit.ts +203 -0
- package/src/codegen/format.ts +47 -0
- package/src/codegen/generator.ts +1283 -0
- package/src/codegen/graph.ts +151 -0
- package/src/codegen/graphql-client.test.ts +386 -0
- package/src/codegen/graphql-client.ts +419 -0
- package/src/codegen/graphql.ts +1217 -0
- package/src/codegen/members.ts +71 -0
- package/src/codegen/naming.ts +86 -0
- package/src/codegen/openapi-cli.ts +182 -0
- package/src/codegen/openapi.ts +1689 -0
- package/src/codegen/operations.ts +76 -0
- package/src/codegen/pagination.ts +71 -0
- package/src/codegen/patches.test.ts +130 -0
- package/src/codegen/patches.ts +291 -0
- package/src/codegen/prelude.ts +70 -0
- package/src/codegen/proto.ts +1128 -0
- package/src/codegen/rewrite-operation-ids.test.ts +563 -0
- package/src/codegen/rewrite-operation-ids.ts +1206 -0
- package/src/codegen/spec-path.ts +115 -0
- package/src/error-category.ts +84 -0
- package/src/errors.ts +22 -25
- package/src/graphql.fixture.ts +371 -0
- package/src/graphql.test.ts +974 -0
- package/src/graphql.ts +1321 -0
- package/src/graphql.types.ts +185 -0
- package/src/json-patch.ts +95 -122
- package/src/pagination.ts +217 -146
- package/src/protocol-http.test.ts +107 -0
- package/src/protocol-http.ts +735 -0
- package/src/protocol-rest.ts +391 -0
- package/src/retry.ts +21 -22
- package/src/schema.ts +9 -10
- package/src/trait.ts +274 -0
- package/README.md +0 -30
- package/lib/client.d.ts +0 -167
- package/lib/client.d.ts.map +0 -1
- package/lib/client.js +0 -659
- package/lib/client.js.map +0 -1
- package/lib/schemas.d.ts +0 -60
- package/lib/schemas.d.ts.map +0 -1
- package/lib/schemas.js +0 -79
- package/lib/schemas.js.map +0 -1
- package/lib/sensitive.d.ts +0 -71
- package/lib/sensitive.d.ts.map +0 -1
- package/lib/sensitive.js +0 -96
- package/lib/sensitive.js.map +0 -1
- package/lib/traits.d.ts +0 -421
- package/lib/traits.d.ts.map +0 -1
- package/lib/traits.js +0 -737
- package/lib/traits.js.map +0 -1
- package/src/client.ts +0 -1177
- package/src/schemas.ts +0 -128
- package/src/sensitive.ts +0 -119
- package/src/traits.ts +0 -996
package/lib/pagination.d.ts
CHANGED
|
@@ -2,93 +2,119 @@
|
|
|
2
2
|
* Pagination utilities for streaming through paginated API responses.
|
|
3
3
|
*
|
|
4
4
|
* Supports multiple pagination styles:
|
|
5
|
-
* - Page-based
|
|
6
|
-
* - Cursor-based
|
|
7
|
-
* - Token-based (
|
|
5
|
+
* - Page-based: page/per_page with a page number that advances
|
|
6
|
+
* - Cursor-based: cursor/limit with an opaque next-cursor string
|
|
7
|
+
* - Token-based (AWS style): NextToken/MaxResults continuation tokens
|
|
8
|
+
* - Relay (GraphQL connections): after/first with a `pageInfo` block whose
|
|
9
|
+
* `hasNextPage` — not the cursor — marks the end
|
|
10
|
+
* - Single: one-shot list endpoints that still expose the paginated surface
|
|
8
11
|
*
|
|
9
|
-
* Each SDK
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* import * as Pagination from "@distilled.cloud/core/pagination";
|
|
15
|
-
*
|
|
16
|
-
* // Page-based pagination
|
|
17
|
-
* const allPages = Pagination.paginatePages(listDatabases, { organization: "my-org" }, {
|
|
18
|
-
* inputToken: "page",
|
|
19
|
-
* outputToken: "next_page",
|
|
20
|
-
* items: "data",
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
12
|
+
* Each SDK stores a {@link PaginatedTrait} on its operations (sourced from the
|
|
13
|
+
* `smithy.api#paginated` trait in its models) and picks a
|
|
14
|
+
* {@link PaginationStrategy}; these shared utilities handle the streaming.
|
|
15
|
+
* Ported from the distilled repo's `core/pagination`.
|
|
23
16
|
*/
|
|
24
17
|
import * as Effect from "effect/Effect";
|
|
25
18
|
import * as Stream from "effect/Stream";
|
|
26
19
|
/**
|
|
27
|
-
*
|
|
20
|
+
* Get a value from an object using a dot-separated path (e.g.
|
|
21
|
+
* `"resultInfo.page"`). Used for pagination traits and nested access.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getPath: (obj: unknown, path: string) => unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Collect the items a dot-separated path selects, flattening arrays as it
|
|
26
|
+
* goes. Unlike {@link getPath} (which walks a single value and is used for
|
|
27
|
+
* cursors/tokens), every segment here fans out over whatever the previous one
|
|
28
|
+
* produced, so a path may cross a list:
|
|
29
|
+
*
|
|
30
|
+
* - `"items"` on `{ items: [a, b] }` → `[a, b]` (the common flat case)
|
|
31
|
+
* - `"edges.node"` on a Relay connection → every edge's `node`
|
|
32
|
+
*
|
|
33
|
+
* `null`/`undefined` links are dropped rather than propagated, so a partially
|
|
34
|
+
* null page yields the items it does have instead of nothing.
|
|
28
35
|
*/
|
|
36
|
+
export declare const getItems: (obj: unknown, path: string) => readonly unknown[];
|
|
37
|
+
/** Pagination trait describing how to navigate between pages. */
|
|
29
38
|
export interface PaginatedTrait {
|
|
30
39
|
/** Pagination strategy */
|
|
31
|
-
mode?: "token" | "page" | "cursor" | "single";
|
|
40
|
+
readonly mode?: "token" | "page" | "cursor" | "relay" | "single";
|
|
32
41
|
/** The name of the input member containing the page/cursor token */
|
|
33
|
-
inputToken?: string;
|
|
42
|
+
readonly inputToken?: string;
|
|
34
43
|
/** The path to the output member containing the next page/cursor token */
|
|
35
|
-
outputToken?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
44
|
+
readonly outputToken?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The path to the output member containing the paginated items. Segments
|
|
47
|
+
* may cross arrays — `"edges.node"` walks every edge and collects its
|
|
48
|
+
* `node` (see {@link getItems}).
|
|
49
|
+
*/
|
|
50
|
+
readonly items?: string;
|
|
38
51
|
/** The name of the input member that limits page size */
|
|
39
|
-
pageSize?: string;
|
|
52
|
+
readonly pageSize?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Relay extension: the path to the boolean that says whether another page
|
|
55
|
+
* exists (`"pageInfo.hasNextPage"`). Relay connections keep returning the
|
|
56
|
+
* last page's `endCursor` after the end, so the cursor alone can't
|
|
57
|
+
* terminate traversal — see {@link paginateRelay}.
|
|
58
|
+
*/
|
|
59
|
+
readonly hasNextPage?: string;
|
|
40
60
|
}
|
|
41
|
-
export type PaginationStrategy = <Input extends Record<string, unknown>, Output, E, R
|
|
61
|
+
export type PaginationStrategy = <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Input, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
|
|
42
62
|
/**
|
|
43
63
|
* Whether a continuation token/cursor returned by a paginated operation
|
|
44
64
|
* means "no more pages".
|
|
45
65
|
*
|
|
46
66
|
* APIs mark the terminal page by omitting the output token, returning it
|
|
47
|
-
* as `null`, or
|
|
48
|
-
* token re-requests the first page
|
|
49
|
-
*
|
|
67
|
+
* as `null`, or — for several services (e.g. SSM, CloudWatch Logs) — as an
|
|
68
|
+
* empty string. Treating `""` as a live token re-requests the first page
|
|
69
|
+
* forever (or fails with a ValidationException). Object tokens (e.g.
|
|
70
|
+
* DynamoDB's `LastEvaluatedKey`) are always truthy and unaffected.
|
|
50
71
|
*/
|
|
51
72
|
export declare const isTerminalToken: (token: unknown) => boolean;
|
|
52
73
|
/**
|
|
53
|
-
*
|
|
74
|
+
* Stream for single-shot list endpoints that still expose the paginated
|
|
75
|
+
* surface — emits exactly one page.
|
|
54
76
|
*/
|
|
55
77
|
export declare const paginateSingle: PaginationStrategy;
|
|
56
78
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param input - The initial input (without page parameter)
|
|
61
|
-
* @param pagination - The pagination trait configuration
|
|
62
|
-
* @returns A Stream of full page responses
|
|
79
|
+
* Stream of pages using page-number pagination. The next page is taken from
|
|
80
|
+
* `outputToken` when it advances; otherwise the page number is incremented,
|
|
81
|
+
* terminating when a page comes back with no items (or no token).
|
|
63
82
|
*/
|
|
64
|
-
export declare const paginatePageNumber: <Input extends Record<string, unknown>, Output, E, R
|
|
83
|
+
export declare const paginatePageNumber: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Input, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
|
|
65
84
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
85
|
+
* Stream of pages using cursor-based pagination — follow `outputToken`
|
|
86
|
+
* cursors until one comes back absent.
|
|
87
|
+
*/
|
|
88
|
+
export declare const paginateCursor: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Input, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
|
|
89
|
+
/**
|
|
90
|
+
* Stream of pages using token-based pagination — pass `outputToken` back as
|
|
91
|
+
* `inputToken` until it comes back absent.
|
|
72
92
|
*/
|
|
73
|
-
export declare const
|
|
93
|
+
export declare const paginateToken: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Input, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
|
|
74
94
|
/**
|
|
75
|
-
*
|
|
95
|
+
* Stream of pages over a Relay connection — pass `pageInfo.endCursor` back as
|
|
96
|
+
* `after` for as long as `pageInfo.hasNextPage` is true.
|
|
76
97
|
*
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
79
|
-
*
|
|
80
|
-
*
|
|
98
|
+
* Relay is cursor pagination with one twist that breaks
|
|
99
|
+
* {@link paginateCursor}: the terminal page still carries an `endCursor` (it
|
|
100
|
+
* points at the last edge, not at "nothing left"). Only `hasNextPage`
|
|
101
|
+
* distinguishes "more to fetch" from "that was everything", so this strategy
|
|
102
|
+
* reads the boolean and treats the cursor as a pure position marker. A
|
|
103
|
+
* connection that omits `pageInfo` entirely (or returns an empty page) also
|
|
104
|
+
* terminates, so a malformed response can't spin forever.
|
|
81
105
|
*/
|
|
82
|
-
export declare const
|
|
106
|
+
export declare const paginateRelay: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Input, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
|
|
83
107
|
/**
|
|
84
|
-
* Shared default pagination dispatcher for SDKs that use generic
|
|
108
|
+
* Shared default pagination dispatcher for SDKs that use generic
|
|
109
|
+
* token/cursor/page traversal.
|
|
85
110
|
*/
|
|
86
111
|
export declare const paginateWithDefaults: PaginationStrategy;
|
|
87
112
|
/**
|
|
88
113
|
* Extracts individual items from a page stream.
|
|
89
114
|
*
|
|
90
115
|
* @param pages - A stream of page responses
|
|
91
|
-
* @param itemsPath - Dot-separated path to the items
|
|
116
|
+
* @param itemsPath - Dot-separated path to the items in the page; segments may
|
|
117
|
+
* cross arrays (see {@link getItems})
|
|
92
118
|
* @returns A Stream of individual items
|
|
93
119
|
*/
|
|
94
120
|
export declare const extractItems: <Output, Item, E, R>(pages: Stream.Stream<Output, E, R>, itemsPath: string) => Stream.Stream<Item, E, R>;
|
package/lib/pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAS,OAAO,QAAQ,MAAM,KAAG,OAUpD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,QAAS,OAAO,QAAQ,MAAM,KAAG,SAAS,OAAO,EAarE,CAAC;AAMF,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACjE,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK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K,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,SACjD,KAAK,cACA,cAAc,KACzB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAgC5B,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,MAAM,EACN,CAAC,EACD,CAAC,aAEU,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,SACjD,KAAK,cACA,cAAc,KACzB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CA0D5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAoBlC,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,SACtC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,aACvB,MAAM,KAChB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAKxB,CAAC"}
|
package/lib/pagination.js
CHANGED
|
@@ -2,80 +2,107 @@
|
|
|
2
2
|
* Pagination utilities for streaming through paginated API responses.
|
|
3
3
|
*
|
|
4
4
|
* Supports multiple pagination styles:
|
|
5
|
-
* - Page-based
|
|
6
|
-
* - Cursor-based
|
|
7
|
-
* - Token-based (
|
|
5
|
+
* - Page-based: page/per_page with a page number that advances
|
|
6
|
+
* - Cursor-based: cursor/limit with an opaque next-cursor string
|
|
7
|
+
* - Token-based (AWS style): NextToken/MaxResults continuation tokens
|
|
8
|
+
* - Relay (GraphQL connections): after/first with a `pageInfo` block whose
|
|
9
|
+
* `hasNextPage` — not the cursor — marks the end
|
|
10
|
+
* - Single: one-shot list endpoints that still expose the paginated surface
|
|
8
11
|
*
|
|
9
|
-
* Each SDK
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* import * as Pagination from "@distilled.cloud/core/pagination";
|
|
15
|
-
*
|
|
16
|
-
* // Page-based pagination
|
|
17
|
-
* const allPages = Pagination.paginatePages(listDatabases, { organization: "my-org" }, {
|
|
18
|
-
* inputToken: "page",
|
|
19
|
-
* outputToken: "next_page",
|
|
20
|
-
* items: "data",
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
12
|
+
* Each SDK stores a {@link PaginatedTrait} on its operations (sourced from the
|
|
13
|
+
* `smithy.api#paginated` trait in its models) and picks a
|
|
14
|
+
* {@link PaginationStrategy}; these shared utilities handle the streaming.
|
|
15
|
+
* Ported from the distilled repo's `core/pagination`.
|
|
23
16
|
*/
|
|
24
17
|
import * as Effect from "effect/Effect";
|
|
25
18
|
import * as Stream from "effect/Stream";
|
|
26
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Get a value from an object using a dot-separated path (e.g.
|
|
21
|
+
* `"resultInfo.page"`). Used for pagination traits and nested access.
|
|
22
|
+
*/
|
|
23
|
+
export const getPath = (obj, path) => {
|
|
24
|
+
const parts = path.split(".");
|
|
25
|
+
let current = obj;
|
|
26
|
+
for (const part of parts) {
|
|
27
|
+
if (current == null || typeof current !== "object") {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
current = current[part];
|
|
31
|
+
}
|
|
32
|
+
return current;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Collect the items a dot-separated path selects, flattening arrays as it
|
|
36
|
+
* goes. Unlike {@link getPath} (which walks a single value and is used for
|
|
37
|
+
* cursors/tokens), every segment here fans out over whatever the previous one
|
|
38
|
+
* produced, so a path may cross a list:
|
|
39
|
+
*
|
|
40
|
+
* - `"items"` on `{ items: [a, b] }` → `[a, b]` (the common flat case)
|
|
41
|
+
* - `"edges.node"` on a Relay connection → every edge's `node`
|
|
42
|
+
*
|
|
43
|
+
* `null`/`undefined` links are dropped rather than propagated, so a partially
|
|
44
|
+
* null page yields the items it does have instead of nothing.
|
|
45
|
+
*/
|
|
46
|
+
export const getItems = (obj, path) => {
|
|
47
|
+
let current = [obj];
|
|
48
|
+
for (const part of path.split(".")) {
|
|
49
|
+
const next = [];
|
|
50
|
+
for (const value of current) {
|
|
51
|
+
if (value == null || typeof value !== "object")
|
|
52
|
+
continue;
|
|
53
|
+
const child = value[part];
|
|
54
|
+
if (Array.isArray(child))
|
|
55
|
+
next.push(...child);
|
|
56
|
+
else if (child != null)
|
|
57
|
+
next.push(child);
|
|
58
|
+
}
|
|
59
|
+
current = next;
|
|
60
|
+
}
|
|
61
|
+
return current;
|
|
62
|
+
};
|
|
27
63
|
const missingPaginationConfig = (kind) => Stream.die(new Error(kind));
|
|
28
64
|
/**
|
|
29
65
|
* Whether a continuation token/cursor returned by a paginated operation
|
|
30
66
|
* means "no more pages".
|
|
31
67
|
*
|
|
32
68
|
* APIs mark the terminal page by omitting the output token, returning it
|
|
33
|
-
* as `null`, or
|
|
34
|
-
* token re-requests the first page
|
|
35
|
-
*
|
|
69
|
+
* as `null`, or — for several services (e.g. SSM, CloudWatch Logs) — as an
|
|
70
|
+
* empty string. Treating `""` as a live token re-requests the first page
|
|
71
|
+
* forever (or fails with a ValidationException). Object tokens (e.g.
|
|
72
|
+
* DynamoDB's `LastEvaluatedKey`) are always truthy and unaffected.
|
|
36
73
|
*/
|
|
37
74
|
export const isTerminalToken = (token) => token === undefined || token === null || token === "";
|
|
38
75
|
/**
|
|
39
|
-
*
|
|
76
|
+
* Stream for single-shot list endpoints that still expose the paginated
|
|
77
|
+
* surface — emits exactly one page.
|
|
40
78
|
*/
|
|
41
|
-
export const paginateSingle = (operation, input
|
|
79
|
+
export const paginateSingle = (operation, input) => Stream.make(input).pipe(Stream.mapEffect((requestPayload) => operation(requestPayload)));
|
|
42
80
|
// ============================================================================
|
|
43
|
-
// Page-based Pagination
|
|
81
|
+
// Page-based Pagination
|
|
44
82
|
// ============================================================================
|
|
45
83
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param input - The initial input (without page parameter)
|
|
50
|
-
* @param pagination - The pagination trait configuration
|
|
51
|
-
* @returns A Stream of full page responses
|
|
84
|
+
* Stream of pages using page-number pagination. The next page is taken from
|
|
85
|
+
* `outputToken` when it advances; otherwise the page number is incremented,
|
|
86
|
+
* terminating when a page comes back with no items (or no token).
|
|
52
87
|
*/
|
|
53
|
-
export const paginatePageNumber = (operation, input, pagination
|
|
88
|
+
export const paginatePageNumber = (operation, input, pagination) => {
|
|
54
89
|
const inputToken = pagination.inputToken;
|
|
55
90
|
const outputToken = pagination.outputToken;
|
|
56
|
-
const inputRecord = input;
|
|
57
91
|
if (!inputToken || !outputToken) {
|
|
58
92
|
return missingPaginationConfig("Page-number pagination requires inputToken and outputToken");
|
|
59
93
|
}
|
|
60
|
-
const startPage = typeof
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const unfoldFn = (state) => Effect.gen(function* () {
|
|
64
|
-
if (state.done) {
|
|
94
|
+
const startPage = typeof input[inputToken] === "number" ? input[inputToken] : 1;
|
|
95
|
+
return Stream.unfold({ page: startPage, done: false }, (state) => Effect.gen(function* () {
|
|
96
|
+
if (state.done)
|
|
65
97
|
return undefined;
|
|
66
|
-
}
|
|
67
|
-
const
|
|
68
|
-
...input,
|
|
69
|
-
[inputToken]: state.page,
|
|
70
|
-
};
|
|
71
|
-
const response = yield* operation(requestPayload, requestOptions);
|
|
98
|
+
const requestPayload = { ...input, [inputToken]: state.page };
|
|
99
|
+
const response = yield* operation(requestPayload);
|
|
72
100
|
const nextPage = getPath(response, outputToken);
|
|
73
|
-
// Some APIs report the CURRENT page at `outputToken` rather than
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
// absent).
|
|
101
|
+
// Some APIs report the CURRENT page at `outputToken` rather than the
|
|
102
|
+
// next one (e.g. Cloudflare's `result_info.page`). Taking that value as
|
|
103
|
+
// the next page re-requests the same page forever. Only accept an
|
|
104
|
+
// *advancing* page number; otherwise advance by one and terminate when
|
|
105
|
+
// a page comes back with no items (or the token is absent).
|
|
79
106
|
const items = pagination.items
|
|
80
107
|
? getPath(response, pagination.items)
|
|
81
108
|
: undefined;
|
|
@@ -88,99 +115,142 @@ export const paginatePageNumber = (operation, input, pagination, requestOptions)
|
|
|
88
115
|
(items !== undefined && items.length === 0),
|
|
89
116
|
};
|
|
90
117
|
return [response, nextState];
|
|
91
|
-
});
|
|
92
|
-
return Stream.unfold({ page: startPage, done: false }, unfoldFn);
|
|
118
|
+
}));
|
|
93
119
|
};
|
|
94
120
|
// ============================================================================
|
|
95
|
-
// Cursor-based Pagination
|
|
121
|
+
// Cursor-based Pagination
|
|
96
122
|
// ============================================================================
|
|
97
123
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param operation - The paginated operation to call
|
|
101
|
-
* @param input - The initial input (without cursor parameter)
|
|
102
|
-
* @param pagination - The pagination trait configuration
|
|
103
|
-
* @returns A Stream of full page responses
|
|
124
|
+
* Stream of pages using cursor-based pagination — follow `outputToken`
|
|
125
|
+
* cursors until one comes back absent.
|
|
104
126
|
*/
|
|
105
|
-
export const paginateCursor = (operation, input, pagination
|
|
127
|
+
export const paginateCursor = (operation, input, pagination) => {
|
|
106
128
|
const inputToken = pagination.inputToken;
|
|
107
129
|
const outputToken = pagination.outputToken;
|
|
108
|
-
const inputRecord = input;
|
|
109
130
|
if (!inputToken || !outputToken) {
|
|
110
131
|
return missingPaginationConfig("Cursor pagination requires inputToken and outputToken");
|
|
111
132
|
}
|
|
112
|
-
const startCursor = typeof
|
|
113
|
-
?
|
|
133
|
+
const startCursor = typeof input[inputToken] === "string"
|
|
134
|
+
? input[inputToken]
|
|
114
135
|
: undefined;
|
|
115
|
-
|
|
116
|
-
if (state.done)
|
|
136
|
+
return Stream.unfold({ cursor: startCursor, done: false }, (state) => Effect.gen(function* () {
|
|
137
|
+
if (state.done)
|
|
117
138
|
return undefined;
|
|
118
|
-
}
|
|
119
139
|
const requestPayload = {
|
|
120
140
|
...input,
|
|
121
141
|
...(state.cursor ? { [inputToken]: state.cursor } : {}),
|
|
122
142
|
};
|
|
123
|
-
const response = yield* operation(requestPayload
|
|
143
|
+
const response = yield* operation(requestPayload);
|
|
124
144
|
const nextCursor = getPath(response, outputToken);
|
|
125
145
|
const nextState = {
|
|
126
146
|
cursor: nextCursor ?? undefined,
|
|
127
147
|
done: isTerminalToken(nextCursor),
|
|
128
148
|
};
|
|
129
149
|
return [response, nextState];
|
|
130
|
-
});
|
|
131
|
-
return Stream.unfold({ cursor: startCursor, done: false }, unfoldFn);
|
|
150
|
+
}));
|
|
132
151
|
};
|
|
133
152
|
// ============================================================================
|
|
134
153
|
// Token-based Pagination (AWS style)
|
|
135
154
|
// ============================================================================
|
|
136
155
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* @param operation - The paginated operation to call
|
|
140
|
-
* @param input - The initial input
|
|
141
|
-
* @param pagination - The pagination trait configuration
|
|
142
|
-
* @returns A Stream of full page responses
|
|
156
|
+
* Stream of pages using token-based pagination — pass `outputToken` back as
|
|
157
|
+
* `inputToken` until it comes back absent.
|
|
143
158
|
*/
|
|
144
|
-
export const paginateToken = (operation, input, pagination
|
|
159
|
+
export const paginateToken = (operation, input, pagination) => {
|
|
145
160
|
const inputToken = pagination.inputToken;
|
|
146
161
|
const outputToken = pagination.outputToken;
|
|
147
|
-
const inputRecord = input;
|
|
148
162
|
if (!inputToken || !outputToken) {
|
|
149
163
|
return missingPaginationConfig("Token pagination requires inputToken and outputToken");
|
|
150
164
|
}
|
|
151
|
-
const startToken =
|
|
152
|
-
|
|
153
|
-
if (state.done)
|
|
165
|
+
const startToken = input[inputToken];
|
|
166
|
+
return Stream.unfold({ token: startToken, done: false }, (state) => Effect.gen(function* () {
|
|
167
|
+
if (state.done)
|
|
154
168
|
return undefined;
|
|
155
|
-
}
|
|
156
169
|
const requestPayload = state.token !== undefined
|
|
157
170
|
? { ...input, [inputToken]: state.token }
|
|
158
171
|
: input;
|
|
159
|
-
const response = yield* operation(requestPayload
|
|
172
|
+
const response = yield* operation(requestPayload);
|
|
160
173
|
const nextToken = getPath(response, outputToken);
|
|
161
174
|
const nextState = {
|
|
162
175
|
token: nextToken,
|
|
163
176
|
done: isTerminalToken(nextToken),
|
|
164
177
|
};
|
|
165
178
|
return [response, nextState];
|
|
166
|
-
});
|
|
167
|
-
|
|
179
|
+
}));
|
|
180
|
+
};
|
|
181
|
+
// ============================================================================
|
|
182
|
+
// Relay Pagination (GraphQL connections)
|
|
183
|
+
// ============================================================================
|
|
184
|
+
/**
|
|
185
|
+
* Stream of pages over a Relay connection — pass `pageInfo.endCursor` back as
|
|
186
|
+
* `after` for as long as `pageInfo.hasNextPage` is true.
|
|
187
|
+
*
|
|
188
|
+
* Relay is cursor pagination with one twist that breaks
|
|
189
|
+
* {@link paginateCursor}: the terminal page still carries an `endCursor` (it
|
|
190
|
+
* points at the last edge, not at "nothing left"). Only `hasNextPage`
|
|
191
|
+
* distinguishes "more to fetch" from "that was everything", so this strategy
|
|
192
|
+
* reads the boolean and treats the cursor as a pure position marker. A
|
|
193
|
+
* connection that omits `pageInfo` entirely (or returns an empty page) also
|
|
194
|
+
* terminates, so a malformed response can't spin forever.
|
|
195
|
+
*/
|
|
196
|
+
export const paginateRelay = (operation, input, pagination) => {
|
|
197
|
+
const inputToken = pagination.inputToken;
|
|
198
|
+
const outputToken = pagination.outputToken;
|
|
199
|
+
if (!inputToken || !outputToken) {
|
|
200
|
+
return missingPaginationConfig("Relay pagination requires inputToken and outputToken");
|
|
201
|
+
}
|
|
202
|
+
// `pageInfo.endCursor` → `pageInfo.hasNextPage` when the trait doesn't say.
|
|
203
|
+
const hasNextPath = pagination.hasNextPage ??
|
|
204
|
+
`${outputToken.split(".").slice(0, -1).concat("hasNextPage").join(".")}`;
|
|
205
|
+
const startCursor = typeof input[inputToken] === "string"
|
|
206
|
+
? input[inputToken]
|
|
207
|
+
: undefined;
|
|
208
|
+
return Stream.unfold({ cursor: startCursor, done: false }, (state) => Effect.gen(function* () {
|
|
209
|
+
if (state.done)
|
|
210
|
+
return undefined;
|
|
211
|
+
const requestPayload = {
|
|
212
|
+
...input,
|
|
213
|
+
...(state.cursor ? { [inputToken]: state.cursor } : {}),
|
|
214
|
+
};
|
|
215
|
+
const response = yield* operation(requestPayload);
|
|
216
|
+
const nextCursor = getPath(response, outputToken);
|
|
217
|
+
const hasNext = getPath(response, hasNextPath) === true;
|
|
218
|
+
// An empty page means the connection is exhausted regardless of what
|
|
219
|
+
// `hasNextPage` claims — re-requesting the same cursor would loop.
|
|
220
|
+
const emptyPage = pagination.items !== undefined &&
|
|
221
|
+
getItems(response, pagination.items).length === 0;
|
|
222
|
+
// A connection that keeps returning the same `endCursor` with
|
|
223
|
+
// `hasNextPage: true` (Railway `projects` has done this) would
|
|
224
|
+
// otherwise paginate forever.
|
|
225
|
+
const stuckCursor = state.cursor !== undefined &&
|
|
226
|
+
nextCursor !== undefined &&
|
|
227
|
+
nextCursor !== null &&
|
|
228
|
+
nextCursor === state.cursor;
|
|
229
|
+
const nextState = {
|
|
230
|
+
cursor: nextCursor ?? undefined,
|
|
231
|
+
done: !hasNext || isTerminalToken(nextCursor) || emptyPage || stuckCursor,
|
|
232
|
+
};
|
|
233
|
+
return [response, nextState];
|
|
234
|
+
}));
|
|
168
235
|
};
|
|
169
236
|
/**
|
|
170
|
-
* Shared default pagination dispatcher for SDKs that use generic
|
|
237
|
+
* Shared default pagination dispatcher for SDKs that use generic
|
|
238
|
+
* token/cursor/page traversal.
|
|
171
239
|
*/
|
|
172
|
-
export const paginateWithDefaults = (operation, input, pagination
|
|
240
|
+
export const paginateWithDefaults = (operation, input, pagination) => {
|
|
173
241
|
const mode = pagination.mode ?? "token";
|
|
174
242
|
switch (mode) {
|
|
175
243
|
case "page":
|
|
176
|
-
return paginatePageNumber(operation, input, pagination
|
|
244
|
+
return paginatePageNumber(operation, input, pagination);
|
|
177
245
|
case "cursor":
|
|
178
|
-
return paginateCursor(operation, input, pagination
|
|
246
|
+
return paginateCursor(operation, input, pagination);
|
|
247
|
+
case "relay":
|
|
248
|
+
return paginateRelay(operation, input, pagination);
|
|
179
249
|
case "single":
|
|
180
|
-
return
|
|
250
|
+
return paginateSingle(operation, input, pagination);
|
|
181
251
|
case "token":
|
|
182
252
|
default:
|
|
183
|
-
return paginateToken(operation, input, pagination
|
|
253
|
+
return paginateToken(operation, input, pagination);
|
|
184
254
|
}
|
|
185
255
|
};
|
|
186
256
|
// ============================================================================
|
|
@@ -190,11 +260,9 @@ export const paginateWithDefaults = (operation, input, pagination, requestOption
|
|
|
190
260
|
* Extracts individual items from a page stream.
|
|
191
261
|
*
|
|
192
262
|
* @param pages - A stream of page responses
|
|
193
|
-
* @param itemsPath - Dot-separated path to the items
|
|
263
|
+
* @param itemsPath - Dot-separated path to the items in the page; segments may
|
|
264
|
+
* cross arrays (see {@link getItems})
|
|
194
265
|
* @returns A Stream of individual items
|
|
195
266
|
*/
|
|
196
|
-
export const extractItems = (pages, itemsPath) => pages.pipe(Stream.flatMap((page) =>
|
|
197
|
-
const items = getPath(page, itemsPath);
|
|
198
|
-
return Stream.fromIterable(items ?? []);
|
|
199
|
-
}));
|
|
267
|
+
export const extractItems = (pages, itemsPath) => pages.pipe(Stream.flatMap((page) => Stream.fromIterable(getItems(page, itemsPath))));
|
|
200
268
|
//# sourceMappingURL=pagination.js.map
|
package/lib/pagination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO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