@distilled.cloud/core 0.0.0 → 0.2.0-alpha

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/lib/errors.js ADDED
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Common error types shared across SDKs.
3
+ *
4
+ * Each SDK defines its own provider-specific errors (e.g., Unauthorized, NotFound)
5
+ * using the category system. This module provides base error types and utilities
6
+ * that are used across all SDKs.
7
+ */
8
+ import * as Schema from "effect/Schema";
9
+ import * as Category from "./category.js";
10
+ // ============================================================================
11
+ // Common HTTP Status Error Classes
12
+ // ============================================================================
13
+ /**
14
+ * Unauthorized - Authentication failure (401).
15
+ */
16
+ export class Unauthorized extends Schema.TaggedErrorClass()("Unauthorized", { message: Schema.String }).pipe(Category.withAuthError) {
17
+ }
18
+ /**
19
+ * Forbidden - Access denied (403).
20
+ */
21
+ export class Forbidden extends Schema.TaggedErrorClass()("Forbidden", { message: Schema.String }).pipe(Category.withAuthError) {
22
+ }
23
+ /**
24
+ * NotFound - Resource not found (404).
25
+ */
26
+ export class NotFound extends Schema.TaggedErrorClass()("NotFound", {
27
+ message: Schema.String,
28
+ }).pipe(Category.withNotFoundError) {
29
+ }
30
+ /**
31
+ * BadRequest - Invalid request (400).
32
+ */
33
+ export class BadRequest extends Schema.TaggedErrorClass()("BadRequest", { message: Schema.String }).pipe(Category.withBadRequestError) {
34
+ }
35
+ /**
36
+ * Conflict - Resource conflict (409).
37
+ */
38
+ export class Conflict extends Schema.TaggedErrorClass()("Conflict", {
39
+ message: Schema.String,
40
+ }).pipe(Category.withConflictError) {
41
+ }
42
+ /**
43
+ * UnprocessableEntity - Validation error (422).
44
+ */
45
+ export class UnprocessableEntity extends Schema.TaggedErrorClass()("UnprocessableEntity", { message: Schema.String }).pipe(Category.withBadRequestError) {
46
+ }
47
+ /**
48
+ * TooManyRequests - Rate limited (429).
49
+ */
50
+ export class TooManyRequests extends Schema.TaggedErrorClass()("TooManyRequests", { message: Schema.String }).pipe(Category.withThrottlingError, Category.withRetryable({ throttling: true })) {
51
+ }
52
+ /**
53
+ * Locked - Resource locked (423).
54
+ */
55
+ export class Locked extends Schema.TaggedErrorClass()("Locked", {
56
+ message: Schema.String,
57
+ }).pipe(Category.withLockedError, Category.withRetryable()) {
58
+ }
59
+ /**
60
+ * InternalServerError - Server error (500).
61
+ */
62
+ export class InternalServerError extends Schema.TaggedErrorClass()("InternalServerError", { message: Schema.String }).pipe(Category.withServerError, Category.withRetryable()) {
63
+ }
64
+ /**
65
+ * ServiceUnavailable - Service unavailable (503).
66
+ */
67
+ export class ServiceUnavailable extends Schema.TaggedErrorClass()("ServiceUnavailable", { message: Schema.String }).pipe(Category.withServerError, Category.withRetryable()) {
68
+ }
69
+ /**
70
+ * Configuration error - missing or invalid configuration.
71
+ */
72
+ export class ConfigError extends Schema.TaggedErrorClass()("ConfigError", { message: Schema.String }).pipe(Category.withConfigurationError) {
73
+ }
74
+ // ============================================================================
75
+ // Error Maps
76
+ // ============================================================================
77
+ /**
78
+ * Mapping from HTTP status codes to common error classes.
79
+ */
80
+ export const HTTP_STATUS_MAP = {
81
+ 400: BadRequest,
82
+ 401: Unauthorized,
83
+ 403: Forbidden,
84
+ 404: NotFound,
85
+ 409: Conflict,
86
+ 422: UnprocessableEntity,
87
+ 423: Locked,
88
+ 429: TooManyRequests,
89
+ 500: InternalServerError,
90
+ 503: ServiceUnavailable,
91
+ };
92
+ /**
93
+ * HTTP status codes that are considered "default" errors (always present).
94
+ * These are excluded from per-operation error types since they're handled globally.
95
+ */
96
+ export const DEFAULT_ERROR_STATUSES = new Set([401, 429, 500, 503]);
97
+ /**
98
+ * All common API error classes.
99
+ */
100
+ export const API_ERRORS = [
101
+ Unauthorized,
102
+ Forbidden,
103
+ NotFound,
104
+ BadRequest,
105
+ Conflict,
106
+ UnprocessableEntity,
107
+ TooManyRequests,
108
+ Locked,
109
+ InternalServerError,
110
+ ServiceUnavailable,
111
+ ];
112
+ /**
113
+ * Default errors that apply to ALL operations.
114
+ * These are infrastructure-level errors that can occur regardless of the operation.
115
+ */
116
+ export const DEFAULT_ERRORS = [
117
+ Unauthorized,
118
+ TooManyRequests,
119
+ InternalServerError,
120
+ ServiceUnavailable,
121
+ ];
122
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,+EAA+E;AAC/E,mCAAmC;AACnC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM,CAAC,gBAAgB,EAAgB,CACvE,cAAc,EACd,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAC3B,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;CAAG;AAEjC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC,gBAAgB,EAAa,CACjE,WAAW,EACX,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAC3B,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;CAAG;AAEjC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,gBAAgB,EAAY,CAAC,UAAU,EAAE;IAC5E,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;CAAG;AAEtC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,gBAAgB,EAAc,CACnE,YAAY,EACZ,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAC3B,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAAG;AAEvC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,gBAAgB,EAA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a,EAAE,CAAC;CAAG;AAE7D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,MAAM,CAAC,gBAAgB,EAAe,CACrE,aAAa,EACb,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAC3B,CAAC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CAAG;AAE1C,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,kBAAkB;CACf,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,mBAAmB;IACnB,eAAe;IACf,MAAM;IACN,mBAAmB;IACnB,kBAAkB;CACV,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY;IACZ,eAAe;IACf,mBAAmB;IACnB,kBAAkB;CACV,CAAC"}
@@ -0,0 +1,44 @@
1
+ export interface JsonPatchOperation {
2
+ op: "add" | "remove" | "replace" | "move" | "copy" | "test";
3
+ path: string;
4
+ value?: unknown;
5
+ from?: string;
6
+ }
7
+ export type JsonPatch = JsonPatchOperation[];
8
+ export interface PatchFile {
9
+ description: string;
10
+ patches: JsonPatch;
11
+ }
12
+ /**
13
+ * Parse a JSON Pointer (RFC 6901) path into segments.
14
+ */
15
+ export declare function parseJsonPointer(pointer: string): string[];
16
+ /**
17
+ * Get a value at a JSON Pointer path.
18
+ */
19
+ export declare function getValueAtPath(obj: unknown, pointer: string): unknown;
20
+ /**
21
+ * Set a value at a JSON Pointer path.
22
+ */
23
+ export declare function setValueAtPath(obj: unknown, pointer: string, value: unknown): void;
24
+ /**
25
+ * Remove a value at a JSON Pointer path.
26
+ */
27
+ export declare function removeValueAtPath(obj: unknown, pointer: string): void;
28
+ /**
29
+ * Apply a single JSON Patch operation.
30
+ */
31
+ export declare function applyOperation(obj: unknown, operation: JsonPatchOperation): void;
32
+ /**
33
+ * Apply a JSON Patch to an object (mutates in place).
34
+ */
35
+ export declare function applyPatch(obj: unknown, patch: JsonPatch): void;
36
+ /**
37
+ * Load and apply all patches from a directory.
38
+ * Finds all *.patch.json files and applies them.
39
+ */
40
+ export declare function applyAllPatches(spec: unknown, patchDir: string): {
41
+ applied: string[];
42
+ errors: string[];
43
+ };
44
+ //# sourceMappingURL=json-patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-patch.d.ts","sourceRoot":"","sources":["../src/json-patch.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;AAE7C,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;CACpB;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAS1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAiBrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,GACb,IAAI,CAuCN;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAgCrE;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,kBAAkB,GAC5B,IAAI,CA0CN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAI/D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,GACf;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA6BzC"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * JSON Patch (RFC 6902) Implementation
3
+ *
4
+ * Provides a unified spec patching system for all SDKs.
5
+ * Patches are applied to OpenAPI/Discovery/Smithy specs before code generation
6
+ * to add error types, fix nullable fields, mark sensitive data, etc.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { applyAllPatches } from "@distilled.cloud/core/json-patch";
11
+ *
12
+ * const spec = JSON.parse(fs.readFileSync("openapi.json", "utf-8"));
13
+ * const { applied, errors } = applyAllPatches(spec, "./patches");
14
+ * ```
15
+ */
16
+ import * as fs from "fs";
17
+ import * as path from "path";
18
+ // ============================================================================
19
+ // JSON Pointer (RFC 6901)
20
+ // ============================================================================
21
+ /**
22
+ * Parse a JSON Pointer (RFC 6901) path into segments.
23
+ */
24
+ export function parseJsonPointer(pointer) {
25
+ if (pointer === "")
26
+ return [];
27
+ if (!pointer.startsWith("/")) {
28
+ throw new Error(`Invalid JSON Pointer: ${pointer}`);
29
+ }
30
+ return pointer
31
+ .slice(1)
32
+ .split("/")
33
+ .map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
34
+ }
35
+ /**
36
+ * Get a value at a JSON Pointer path.
37
+ */
38
+ export function getValueAtPath(obj, pointer) {
39
+ const segments = parseJsonPointer(pointer);
40
+ let current = obj;
41
+ for (const segment of segments) {
42
+ if (current === null || typeof current !== "object") {
43
+ throw new Error(`Cannot traverse path ${pointer}: not an object`);
44
+ }
45
+ if (Array.isArray(current)) {
46
+ const index = segment === "-" ? current.length : parseInt(segment, 10);
47
+ current = current[index];
48
+ }
49
+ else {
50
+ current = current[segment];
51
+ }
52
+ }
53
+ return current;
54
+ }
55
+ /**
56
+ * Set a value at a JSON Pointer path.
57
+ */
58
+ export function setValueAtPath(obj, pointer, value) {
59
+ const segments = parseJsonPointer(pointer);
60
+ if (segments.length === 0) {
61
+ throw new Error("Cannot set value at root path");
62
+ }
63
+ let current = obj;
64
+ for (let i = 0; i < segments.length - 1; i++) {
65
+ const segment = segments[i];
66
+ if (current === null || typeof current !== "object") {
67
+ throw new Error(`Cannot traverse path ${pointer}: not an object`);
68
+ }
69
+ if (Array.isArray(current)) {
70
+ const index = parseInt(segment, 10);
71
+ current = current[index];
72
+ }
73
+ else {
74
+ current = current[segment];
75
+ }
76
+ }
77
+ const lastSegment = segments[segments.length - 1];
78
+ if (current === null || typeof current !== "object") {
79
+ throw new Error(`Cannot set value at path ${pointer}: parent is not an object`);
80
+ }
81
+ if (Array.isArray(current)) {
82
+ const index = lastSegment === "-" ? current.length : parseInt(lastSegment, 10);
83
+ if (lastSegment === "-") {
84
+ current.push(value);
85
+ }
86
+ else {
87
+ current[index] = value;
88
+ }
89
+ }
90
+ else {
91
+ current[lastSegment] = value;
92
+ }
93
+ }
94
+ /**
95
+ * Remove a value at a JSON Pointer path.
96
+ */
97
+ export function removeValueAtPath(obj, pointer) {
98
+ const segments = parseJsonPointer(pointer);
99
+ if (segments.length === 0) {
100
+ throw new Error("Cannot remove root");
101
+ }
102
+ let current = obj;
103
+ for (let i = 0; i < segments.length - 1; i++) {
104
+ const segment = segments[i];
105
+ if (current === null || typeof current !== "object") {
106
+ throw new Error(`Cannot traverse path ${pointer}: not an object`);
107
+ }
108
+ if (Array.isArray(current)) {
109
+ current = current[parseInt(segment, 10)];
110
+ }
111
+ else {
112
+ current = current[segment];
113
+ }
114
+ }
115
+ const lastSegment = segments[segments.length - 1];
116
+ if (current === null || typeof current !== "object") {
117
+ throw new Error(`Cannot remove at path ${pointer}: parent is not an object`);
118
+ }
119
+ if (Array.isArray(current)) {
120
+ current.splice(parseInt(lastSegment, 10), 1);
121
+ }
122
+ else {
123
+ delete current[lastSegment];
124
+ }
125
+ }
126
+ // ============================================================================
127
+ // Patch Operations
128
+ // ============================================================================
129
+ /**
130
+ * Apply a single JSON Patch operation.
131
+ */
132
+ export function applyOperation(obj, operation) {
133
+ switch (operation.op) {
134
+ case "add":
135
+ setValueAtPath(obj, operation.path, operation.value);
136
+ break;
137
+ case "remove":
138
+ removeValueAtPath(obj, operation.path);
139
+ break;
140
+ case "replace":
141
+ // For replace, the path must exist
142
+ getValueAtPath(obj, operation.path); // throws if doesn't exist
143
+ setValueAtPath(obj, operation.path, operation.value);
144
+ break;
145
+ case "move": {
146
+ if (!operation.from)
147
+ throw new Error("move operation requires 'from'");
148
+ const moveValue = getValueAtPath(obj, operation.from);
149
+ removeValueAtPath(obj, operation.from);
150
+ setValueAtPath(obj, operation.path, moveValue);
151
+ break;
152
+ }
153
+ case "copy": {
154
+ if (!operation.from)
155
+ throw new Error("copy operation requires 'from'");
156
+ const copyValue = getValueAtPath(obj, operation.from);
157
+ setValueAtPath(obj, operation.path, JSON.parse(JSON.stringify(copyValue)));
158
+ break;
159
+ }
160
+ case "test": {
161
+ const testValue = getValueAtPath(obj, operation.path);
162
+ if (JSON.stringify(testValue) !== JSON.stringify(operation.value)) {
163
+ throw new Error(`Test operation failed at ${operation.path}: expected ${JSON.stringify(operation.value)}, got ${JSON.stringify(testValue)}`);
164
+ }
165
+ break;
166
+ }
167
+ default:
168
+ throw new Error(`Unknown operation: ${operation.op}`);
169
+ }
170
+ }
171
+ /**
172
+ * Apply a JSON Patch to an object (mutates in place).
173
+ */
174
+ export function applyPatch(obj, patch) {
175
+ for (const operation of patch) {
176
+ applyOperation(obj, operation);
177
+ }
178
+ }
179
+ /**
180
+ * Load and apply all patches from a directory.
181
+ * Finds all *.patch.json files and applies them.
182
+ */
183
+ export function applyAllPatches(spec, patchDir) {
184
+ const applied = [];
185
+ const errors = [];
186
+ if (!fs.existsSync(patchDir)) {
187
+ return { applied, errors };
188
+ }
189
+ // Find all .patch.json files
190
+ const files = fs
191
+ .readdirSync(patchDir)
192
+ .filter((f) => f.endsWith(".patch.json"))
193
+ .sort(); // Sort for deterministic application order
194
+ for (const file of files) {
195
+ const filePath = path.join(patchDir, file);
196
+ try {
197
+ const content = fs.readFileSync(filePath, "utf-8");
198
+ const patchFile = JSON.parse(content);
199
+ applyPatch(spec, patchFile.patches);
200
+ applied.push(`${file}: ${patchFile.description}`);
201
+ }
202
+ catch (error) {
203
+ errors.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
204
+ }
205
+ }
206
+ return { applied, errors };
207
+ }
208
+ //# sourceMappingURL=json-patch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-patch.js","sourceRoot":"","sources":["../src/json-patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAoB7B,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAA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EAAE,CAAC;IAC7B,CAAC;IAED,6BAA6B;IAC7B,MAAM,KAAK,GAAG,EAAE;SACb,WAAW,CAAC,QAAQ,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;SACxC,IAAI,EAAE,CAAC,CAAC,2CAA2C;IAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,SAAS,GAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjD,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Pagination utilities for streaming through paginated API responses.
3
+ *
4
+ * Supports multiple pagination styles:
5
+ * - Page-based (e.g., PlanetScale): page/per_page with next_page number
6
+ * - Cursor-based (e.g., Neon): cursor/limit with next cursor string
7
+ * - Token-based (e.g., AWS): NextToken/MaxResults with continuation tokens
8
+ *
9
+ * Each SDK defines its own pagination trait configuration, and these
10
+ * shared utilities handle the streaming logic.
11
+ *
12
+ * @example
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
+ * ```
23
+ */
24
+ import * as Effect from "effect/Effect";
25
+ import * as Stream from "effect/Stream";
26
+ /**
27
+ * Pagination trait describing how to navigate between pages.
28
+ */
29
+ export interface PaginatedTrait {
30
+ /** The name of the input member containing the page/cursor token */
31
+ inputToken: string;
32
+ /** The path to the output member containing the next page/cursor token */
33
+ outputToken: string;
34
+ /** The path to the output member containing the paginated items */
35
+ items?: string;
36
+ /** The name of the input member that limits page size */
37
+ pageSize?: string;
38
+ }
39
+ /**
40
+ * Creates a stream of pages using page-number pagination.
41
+ *
42
+ * @param operation - The paginated operation to call
43
+ * @param input - The initial input (without page parameter)
44
+ * @param pagination - The pagination trait configuration
45
+ * @returns A Stream of full page responses
46
+ */
47
+ export declare const paginatePageNumber: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Omit<Input, string>, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
48
+ /**
49
+ * Creates a stream of pages using cursor-based pagination.
50
+ *
51
+ * @param operation - The paginated operation to call
52
+ * @param input - The initial input (without cursor parameter)
53
+ * @param pagination - The pagination trait configuration
54
+ * @returns A Stream of full page responses
55
+ */
56
+ export declare const paginateCursor: <Input extends Record<string, unknown>, Output, E, R>(operation: (input: Input) => Effect.Effect<Output, E, R>, input: Omit<Input, string>, pagination: PaginatedTrait) => Stream.Stream<Output, E, R>;
57
+ /**
58
+ * Creates a stream of pages using token-based pagination.
59
+ *
60
+ * @param operation - The paginated operation to call
61
+ * @param input - The initial input
62
+ * @param pagination - The pagination trait configuration
63
+ * @returns A Stream of full page responses
64
+ */
65
+ 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>;
66
+ /**
67
+ * Extracts individual items from a page stream.
68
+ *
69
+ * @param pages - A stream of page responses
70
+ * @param itemsPath - Dot-separated path to the items array in the page response
71
+ * @returns A Stream of individual items
72
+ */
73
+ export declare const extractItems: <Output, Item, E, R>(pages: Stream.Stream<Output, E, R>, itemsPath: string) => Stream.Stream<Item, E, R>;
74
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAOxC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,kCACL,MAAM,EACN,CAAC,EACD,CAAC,kJAmCF,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,kCACL,MAAM,EACN,CAAC,EACD,CAAC,kJAmCF,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,kCACL,MAAM,EACN,CAAC,EACD,CAAC,oIAgCF,CAAC;AAMF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,qFAS5C,CAAC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Pagination utilities for streaming through paginated API responses.
3
+ *
4
+ * Supports multiple pagination styles:
5
+ * - Page-based (e.g., PlanetScale): page/per_page with next_page number
6
+ * - Cursor-based (e.g., Neon): cursor/limit with next cursor string
7
+ * - Token-based (e.g., AWS): NextToken/MaxResults with continuation tokens
8
+ *
9
+ * Each SDK defines its own pagination trait configuration, and these
10
+ * shared utilities handle the streaming logic.
11
+ *
12
+ * @example
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
+ * ```
23
+ */
24
+ import * as Effect from "effect/Effect";
25
+ import * as Stream from "effect/Stream";
26
+ import { getPath } from "./traits.js";
27
+ // ============================================================================
28
+ // Page-based Pagination (PlanetScale style)
29
+ // ============================================================================
30
+ /**
31
+ * Creates a stream of pages using page-number pagination.
32
+ *
33
+ * @param operation - The paginated operation to call
34
+ * @param input - The initial input (without page parameter)
35
+ * @param pagination - The pagination trait configuration
36
+ * @returns A Stream of full page responses
37
+ */
38
+ export const paginatePageNumber = (operation, input, pagination) => {
39
+ const unfoldFn = (state) => Effect.gen(function* () {
40
+ if (state.done) {
41
+ return undefined;
42
+ }
43
+ const requestPayload = {
44
+ ...input,
45
+ [pagination.inputToken]: state.page,
46
+ };
47
+ const response = yield* operation(requestPayload);
48
+ const nextPage = getPath(response, pagination.outputToken);
49
+ const nextState = {
50
+ page: nextPage ?? state.page + 1,
51
+ done: nextPage === null || nextPage === undefined,
52
+ };
53
+ return [response, nextState];
54
+ });
55
+ return Stream.unfold({ page: 1, done: false }, unfoldFn);
56
+ };
57
+ // ============================================================================
58
+ // Cursor-based Pagination (Neon style)
59
+ // ============================================================================
60
+ /**
61
+ * Creates a stream of pages using cursor-based pagination.
62
+ *
63
+ * @param operation - The paginated operation to call
64
+ * @param input - The initial input (without cursor parameter)
65
+ * @param pagination - The pagination trait configuration
66
+ * @returns A Stream of full page responses
67
+ */
68
+ export const paginateCursor = (operation, input, pagination) => {
69
+ const unfoldFn = (state) => Effect.gen(function* () {
70
+ if (state.done) {
71
+ return undefined;
72
+ }
73
+ const requestPayload = {
74
+ ...input,
75
+ ...(state.cursor ? { [pagination.inputToken]: state.cursor } : {}),
76
+ };
77
+ const response = yield* operation(requestPayload);
78
+ const nextCursor = getPath(response, pagination.outputToken);
79
+ const nextState = {
80
+ cursor: nextCursor ?? undefined,
81
+ done: nextCursor === null || nextCursor === undefined,
82
+ };
83
+ return [response, nextState];
84
+ });
85
+ return Stream.unfold({ cursor: undefined, done: false }, unfoldFn);
86
+ };
87
+ // ============================================================================
88
+ // Token-based Pagination (AWS style)
89
+ // ============================================================================
90
+ /**
91
+ * Creates a stream of pages using token-based pagination.
92
+ *
93
+ * @param operation - The paginated operation to call
94
+ * @param input - The initial input
95
+ * @param pagination - The pagination trait configuration
96
+ * @returns A Stream of full page responses
97
+ */
98
+ export const paginateToken = (operation, input, pagination) => {
99
+ const unfoldFn = (state) => Effect.gen(function* () {
100
+ if (state.done) {
101
+ return undefined;
102
+ }
103
+ const requestPayload = state.token !== undefined
104
+ ? { ...input, [pagination.inputToken]: state.token }
105
+ : input;
106
+ const response = yield* operation(requestPayload);
107
+ const nextToken = getPath(response, pagination.outputToken);
108
+ const nextState = {
109
+ token: nextToken,
110
+ done: nextToken === undefined || nextToken === null,
111
+ };
112
+ return [response, nextState];
113
+ });
114
+ return Stream.unfold({ token: undefined, done: false }, unfoldFn);
115
+ };
116
+ // ============================================================================
117
+ // Item extraction
118
+ // ============================================================================
119
+ /**
120
+ * Extracts individual items from a page stream.
121
+ *
122
+ * @param pages - A stream of page responses
123
+ * @param itemsPath - Dot-separated path to the items array in the page response
124
+ * @returns A Stream of individual items
125
+ */
126
+ export const extractItems = (pages, itemsPath) => pages.pipe(Stream.flatMap((page) => {
127
+ const items = getPath(page, itemsPath);
128
+ return Stream.fromIterable(items ?? []);
129
+ }));
130
+ //# s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