ts-ag 1.0.30 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/browser.d.ts +578 -4
  2. package/dist/browser.d.ts.map +1 -1
  3. package/dist/browser.js +365 -4
  4. package/dist/browser.js.map +1 -0
  5. package/dist/cli-DIua8C8m.mjs +7 -0
  6. package/dist/cli-DIua8C8m.mjs.map +1 -0
  7. package/dist/index.d.mts +1242 -0
  8. package/dist/index.d.mts.map +1 -0
  9. package/dist/index.mjs +1069 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/scripts/ts-alias.d.mts +1 -0
  12. package/dist/scripts/ts-alias.mjs +131 -0
  13. package/dist/scripts/ts-alias.mjs.map +1 -0
  14. package/dist/scripts/ts-build-config.d.mts +1 -0
  15. package/dist/scripts/ts-build-config.mjs +317 -0
  16. package/dist/scripts/ts-build-config.mjs.map +1 -0
  17. package/package.json +11 -11
  18. package/dist/cognito/client.d.ts +0 -6
  19. package/dist/cognito/client.d.ts.map +0 -1
  20. package/dist/cognito/client.js +0 -7
  21. package/dist/cognito/errors.d.ts +0 -110
  22. package/dist/cognito/errors.d.ts.map +0 -1
  23. package/dist/cognito/errors.js +0 -101
  24. package/dist/cognito/index.d.ts +0 -5
  25. package/dist/cognito/index.d.ts.map +0 -1
  26. package/dist/cognito/index.js +0 -4
  27. package/dist/cognito/password.d.ts +0 -182
  28. package/dist/cognito/password.d.ts.map +0 -1
  29. package/dist/cognito/password.js +0 -281
  30. package/dist/cognito/user.d.ts +0 -24
  31. package/dist/cognito/user.d.ts.map +0 -1
  32. package/dist/cognito/user.js +0 -42
  33. package/dist/dynamo/errors.d.ts +0 -9
  34. package/dist/dynamo/errors.d.ts.map +0 -1
  35. package/dist/dynamo/errors.js +0 -5
  36. package/dist/dynamo/index.d.ts +0 -2
  37. package/dist/dynamo/index.d.ts.map +0 -1
  38. package/dist/dynamo/index.js +0 -1
  39. package/dist/index.d.ts +0 -9
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js +0 -9
  42. package/dist/lambda/browser.d.ts +0 -4
  43. package/dist/lambda/browser.d.ts.map +0 -1
  44. package/dist/lambda/browser.js +0 -3
  45. package/dist/lambda/client-types.d.ts +0 -88
  46. package/dist/lambda/client-types.d.ts.map +0 -1
  47. package/dist/lambda/client-types.js +0 -3
  48. package/dist/lambda/client.d.ts +0 -15
  49. package/dist/lambda/client.d.ts.map +0 -1
  50. package/dist/lambda/client.js +0 -68
  51. package/dist/lambda/errors.d.ts +0 -46
  52. package/dist/lambda/errors.d.ts.map +0 -1
  53. package/dist/lambda/errors.js +0 -29
  54. package/dist/lambda/handlerUtils.d.ts +0 -53
  55. package/dist/lambda/handlerUtils.d.ts.map +0 -1
  56. package/dist/lambda/handlerUtils.js +0 -28
  57. package/dist/lambda/index.d.ts +0 -5
  58. package/dist/lambda/index.d.ts.map +0 -1
  59. package/dist/lambda/index.js +0 -5
  60. package/dist/lambda/response.d.ts +0 -80
  61. package/dist/lambda/response.d.ts.map +0 -1
  62. package/dist/lambda/response.js +0 -39
  63. package/dist/lambda/server/authentication.d.ts +0 -10
  64. package/dist/lambda/server/authentication.d.ts.map +0 -1
  65. package/dist/lambda/server/authentication.js +0 -24
  66. package/dist/rehype/browser.d.ts +0 -2
  67. package/dist/rehype/browser.d.ts.map +0 -1
  68. package/dist/rehype/browser.js +0 -1
  69. package/dist/rehype/flat-toc.d.ts +0 -20
  70. package/dist/rehype/flat-toc.d.ts.map +0 -1
  71. package/dist/rehype/flat-toc.js +0 -52
  72. package/dist/rehype/index.d.ts +0 -2
  73. package/dist/rehype/index.d.ts.map +0 -1
  74. package/dist/rehype/index.js +0 -1
  75. package/dist/s3/client.d.ts +0 -6
  76. package/dist/s3/client.d.ts.map +0 -1
  77. package/dist/s3/client.js +0 -7
  78. package/dist/s3/errors.d.ts +0 -9
  79. package/dist/s3/errors.d.ts.map +0 -1
  80. package/dist/s3/errors.js +0 -2
  81. package/dist/s3/index.d.ts +0 -5
  82. package/dist/s3/index.d.ts.map +0 -1
  83. package/dist/s3/index.js +0 -4
  84. package/dist/s3/object.d.ts +0 -27
  85. package/dist/s3/object.d.ts.map +0 -1
  86. package/dist/s3/object.js +0 -57
  87. package/dist/s3/signedUrl.d.ts +0 -3
  88. package/dist/s3/signedUrl.d.ts.map +0 -1
  89. package/dist/s3/signedUrl.js +0 -3
  90. package/dist/scripts/clean-dist.d.ts +0 -3
  91. package/dist/scripts/clean-dist.d.ts.map +0 -1
  92. package/dist/scripts/clean-dist.js +0 -37
  93. package/dist/scripts/ts-alias.d.ts +0 -3
  94. package/dist/scripts/ts-alias.d.ts.map +0 -1
  95. package/dist/scripts/ts-alias.js +0 -139
  96. package/dist/scripts/ts-build-config.d.ts +0 -3
  97. package/dist/scripts/ts-build-config.d.ts.map +0 -1
  98. package/dist/scripts/ts-build-config.js +0 -345
  99. package/dist/ses/errors.d.ts +0 -4
  100. package/dist/ses/errors.d.ts.map +0 -1
  101. package/dist/ses/errors.js +0 -1
  102. package/dist/ses/index.d.ts +0 -2
  103. package/dist/ses/index.d.ts.map +0 -1
  104. package/dist/ses/index.js +0 -1
  105. package/dist/types/deep.d.ts +0 -23
  106. package/dist/types/deep.d.ts.map +0 -1
  107. package/dist/types/deep.js +0 -1
  108. package/dist/types/index.d.ts +0 -3
  109. package/dist/types/index.d.ts.map +0 -1
  110. package/dist/types/index.js +0 -2
  111. package/dist/types/safe.d.ts +0 -2
  112. package/dist/types/safe.d.ts.map +0 -1
  113. package/dist/types/safe.js +0 -1
  114. package/dist/utils/browser.d.ts +0 -3
  115. package/dist/utils/browser.d.ts.map +0 -1
  116. package/dist/utils/browser.js +0 -2
  117. package/dist/utils/cli.d.ts +0 -2
  118. package/dist/utils/cli.d.ts.map +0 -1
  119. package/dist/utils/cli.js +0 -2
  120. package/dist/utils/fs.d.ts +0 -15
  121. package/dist/utils/fs.d.ts.map +0 -1
  122. package/dist/utils/fs.js +0 -48
  123. package/dist/utils/index.d.ts +0 -4
  124. package/dist/utils/index.d.ts.map +0 -1
  125. package/dist/utils/index.js +0 -3
  126. package/dist/utils/object.d.ts +0 -62
  127. package/dist/utils/object.d.ts.map +0 -1
  128. package/dist/utils/object.js +0 -147
  129. package/dist/utils/valibot.d.ts +0 -12
  130. package/dist/utils/valibot.d.ts.map +0 -1
  131. package/dist/utils/valibot.js +0 -142
  132. package/src/browser.ts +0 -6
  133. package/src/cognito/client.ts +0 -11
  134. package/src/cognito/errors.ts +0 -148
  135. package/src/cognito/index.ts +0 -5
  136. package/src/cognito/password.ts +0 -382
  137. package/src/cognito/user.ts +0 -63
  138. package/src/dynamo/errors.ts +0 -9
  139. package/src/dynamo/errors.unit.test.ts +0 -13
  140. package/src/dynamo/index.ts +0 -1
  141. package/src/index.ts +0 -11
  142. package/src/lambda/browser.ts +0 -3
  143. package/src/lambda/client-types.ts +0 -93
  144. package/src/lambda/client.ts +0 -112
  145. package/src/lambda/errors.ts +0 -49
  146. package/src/lambda/errors.unit.test.ts +0 -39
  147. package/src/lambda/handlerUtils.ts +0 -70
  148. package/src/lambda/handlerUtils.unit.test.ts +0 -31
  149. package/src/lambda/index.ts +0 -6
  150. package/src/lambda/response.ts +0 -85
  151. package/src/lambda/server/authentication.ts +0 -32
  152. package/src/rehype/browser.ts +0 -1
  153. package/src/rehype/flat-toc.ts +0 -62
  154. package/src/rehype/index.ts +0 -1
  155. package/src/s3/client.ts +0 -11
  156. package/src/s3/errors.ts +0 -5
  157. package/src/s3/index.ts +0 -6
  158. package/src/s3/object.ts +0 -65
  159. package/src/s3/signedUrl.ts +0 -4
  160. package/src/scripts/clean-dist.ts +0 -44
  161. package/src/scripts/ts-alias.ts +0 -165
  162. package/src/scripts/ts-build-config.ts +0 -407
  163. package/src/ses/errors.ts +0 -1
  164. package/src/ses/index.ts +0 -1
  165. package/src/types/deep.ts +0 -42
  166. package/src/types/index.ts +0 -2
  167. package/src/types/safe.ts +0 -1
  168. package/src/utils/browser.ts +0 -2
  169. package/src/utils/cli.ts +0 -4
  170. package/src/utils/fs.ts +0 -54
  171. package/src/utils/index.ts +0 -4
  172. package/src/utils/object.ts +0 -160
  173. package/src/utils/object.unit.test.ts +0 -163
  174. package/src/utils/valibot.ts +0 -163
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,579 @@
1
- export * from './lambda/browser.js';
2
- export * from './rehype/browser.js';
3
- export * from './types/index.js';
4
- export * from './utils/browser.js';
1
+ import * as v from "valibot";
2
+ import { GenericSchema, GenericSchemaAsync } from "valibot";
3
+ import { Plugin } from "unified";
4
+ import { APIGatewayProxyEventV2WithLambdaAuthorizer, APIGatewayProxyResultV2, Context } from "aws-lambda";
5
+
6
+ //#region src/lambda/handlerUtils.d.ts
7
+ type SuccessCode = 200 | 201 | 204;
8
+ type ErrorCode = 400 | 401 | 403 | 404 | 409 | 500;
9
+ type ErrorBody = {
10
+ message: string;
11
+ field?: {
12
+ name: string;
13
+ value: string;
14
+ };
15
+ };
16
+ /**
17
+ * The error response for the lambda functions to return
18
+ */
19
+ type ErrorRawProxyResultV2 = {
20
+ statusCode: ErrorCode;
21
+ headers?: {
22
+ [header: string]: string;
23
+ } | undefined;
24
+ body?: ErrorBody;
25
+ isBase64Encoded?: boolean | undefined;
26
+ cookies?: string[] | undefined;
27
+ };
28
+ type OkRawProxyResultV2 = {
29
+ statusCode: SuccessCode;
30
+ headers?: {
31
+ [header: string]: string;
32
+ } | undefined;
33
+ body?: object | undefined;
34
+ isBase64Encoded?: boolean | undefined;
35
+ cookies?: string[] | undefined;
36
+ };
37
+ /**
38
+ * A type for the raw proxy result - just using an object not a stirng for the body
39
+ */
40
+ type RawProxyResultV2 = ErrorRawProxyResultV2 | OkRawProxyResultV2;
41
+ type APIGatewayHandler<E> = (event: E, context: Context) => Promise<APIGatewayProxyResultV2>;
42
+ type RawApiGatewayHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>> = (event: E, context: Context) => Promise<RawProxyResultV2>;
43
+ /**
44
+ * Wraps a handler that returns the body as an object rather than a string.
45
+ *
46
+ * This means you can achieve proper type inference on your handler and have standardised serialisation
47
+ *
48
+ * @example
49
+ ```ts
50
+ export type AuthorizerContext = {
51
+ details: JWTPayload;
52
+ } | null;
53
+
54
+ export const wrapHandler = baseWrapHandler<APIGatewayProxyEventV2WithLambdaAuthorizer<AuthorizerContext>>
55
+
56
+ */
57
+ declare function wrapHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>>(handler: RawApiGatewayHandler<E>): APIGatewayHandler<E>;
58
+ //#endregion
59
+ //#region src/lambda/client-types.d.ts
60
+ /**
61
+ * Extracts the requestInput type from an API endpoint definition
62
+ * @template E - Union type of all API endpoints
63
+ * @template P - Path string literal type (e.g. 'payments/account')
64
+ * @template M - HTTP method string literal type (e.g. 'GET', 'POST')
65
+ */
66
+ type ApiInput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<E, {
67
+ path: P;
68
+ method: M;
69
+ }>['requestInput'];
70
+ /**
71
+ * Extracts the requestOutput type from an API endpoint definition
72
+ * @template E - Union type of all API endpoints
73
+ * @template P - Path string literal type (e.g. 'payments/account')
74
+ * @template M - HTTP method string literal type (e.g. 'GET', 'POST')
75
+ */
76
+ type ApiOutput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<E, {
77
+ path: P;
78
+ method: M;
79
+ }>['requestOutput'];
80
+ /**
81
+ * Extracts the response type from an API endpoint definition
82
+ * @template E - Union type of all API endpoints
83
+ * @template P - Path string literal type (e.g. 'payments/account')
84
+ * @template M - HTTP method string literal type (e.g. 'GET', 'POST')
85
+ */
86
+ type ApiResponse<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<E, {
87
+ path: P;
88
+ method: M;
89
+ }>['response'];
90
+ /**
91
+ * Extracts the sucessful body type from an API endpoint definition
92
+ * @template E - Union type of all API endpoints
93
+ * @template P - Path string literal type (e.g. 'payments/account')
94
+ * @template M - HTTP method string literal type (e.g. 'GET', 'POST')
95
+ */
96
+ type ApiSuccessBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<Extract<E, {
97
+ path: P;
98
+ method: M;
99
+ }>['response'], {
100
+ status: SuccessCode;
101
+ }>['json'] extends (() => Promise<infer R>) ? R : unknown;
102
+ /**
103
+ * Extracts the sucessful body type from an API endpoint definition
104
+ * @template E - Union type of all API endpoints
105
+ * @template P - Path string literal type (e.g. 'payments/account')
106
+ * @template M - HTTP method string literal type (e.g. 'GET', 'POST')
107
+ */
108
+ type ApiErrorBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<Extract<E, {
109
+ path: P;
110
+ method: M;
111
+ }>['response'], {
112
+ status: ErrorCode;
113
+ }>['json'] extends (() => Promise<infer R>) ? R : unknown;
114
+ /**
115
+ * Converts a RawApiGatewayHandler response type to a fetch like response type.
116
+ */
117
+ type ConvertToFetch<T> = T extends {
118
+ statusCode: number;
119
+ body: object;
120
+ headers: object;
121
+ } ? {
122
+ ok: T['statusCode'] extends SuccessCode ? true : false;
123
+ json: () => Promise<T['body']>;
124
+ status: T['statusCode'];
125
+ } : T;
126
+ type CleanResponse = Omit<Response, 'status' | 'ok' | 'json'>;
127
+ type FetchResponse<T extends (...args: any) => any> = ConvertToFetch<Awaited<ReturnType<T>>> & CleanResponse;
128
+ declare const HTTPMethods: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"];
129
+ type HTTPMethod = (typeof HTTPMethods)[number];
130
+ type ApiEndpoints = {
131
+ path: string;
132
+ method: HTTPMethod;
133
+ requestInput: Record<string, any> | null;
134
+ requestOutput: object | null;
135
+ response: FetchResponse<() => Promise<{
136
+ headers: object;
137
+ statusCode: SuccessCode;
138
+ body: any;
139
+ } | {
140
+ headers: object;
141
+ statusCode: ErrorCode;
142
+ body: ErrorBody;
143
+ }>>;
144
+ };
145
+ //#endregion
146
+ //#region src/lambda/client.d.ts
147
+ declare const HTTPMethods$1: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"];
148
+ type HTTPMethod$1 = (typeof HTTPMethods$1)[number];
149
+ type ApiRequestFunction<API extends ApiEndpoints> = <Path extends API['path'], Method extends Extract<API, {
150
+ path: Path;
151
+ }>['method']>(path: Path, method: Method, input: ApiInput<API, Path, Method>, headers?: HeadersInit) => Promise<ApiResponse<API, Path, Method>>;
152
+ type ApiSchema = v.GenericSchema | v.GenericSchemaAsync;
153
+ /**
154
+ * @returns A function that can be used to make API requests with type safety
155
+ * @example const clientApiRequest = createApiRequest<ApiEndpoints>();
156
+ */
157
+ declare function createApiRequest<API extends ApiEndpoints>(schemas: Partial<Record<API['path'], Partial<Record<HTTPMethod$1, ApiSchema>>>>, apiUrl: string, env: string): ApiRequestFunction<API>;
158
+ //#endregion
159
+ //#region node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
160
+ // ## Interfaces
161
+ /**
162
+ * Info associated with nodes by the ecosystem.
163
+ *
164
+ * This space is guaranteed to never be specified by unist or specifications
165
+ * implementing unist.
166
+ * But you can use it in utilities and plugins to store data.
167
+ *
168
+ * This type can be augmented to register custom data.
169
+ * For example:
170
+ *
171
+ * ```ts
172
+ * declare module 'unist' {
173
+ * interface Data {
174
+ * // `someNode.data.myId` is typed as `number | undefined`
175
+ * myId?: number | undefined
176
+ * }
177
+ * }
178
+ * ```
179
+ */
180
+ interface Data$1 {}
181
+ /**
182
+ * One place in a source file.
183
+ */
184
+ interface Point {
185
+ /**
186
+ * Line in a source file (1-indexed integer).
187
+ */
188
+ line: number;
189
+ /**
190
+ * Column in a source file (1-indexed integer).
191
+ */
192
+ column: number;
193
+ /**
194
+ * Character in a source file (0-indexed integer).
195
+ */
196
+ offset?: number | undefined;
197
+ }
198
+ /**
199
+ * Position of a node in a source document.
200
+ *
201
+ * A position is a range between two points.
202
+ */
203
+ interface Position {
204
+ /**
205
+ * Place of the first character of the parsed source region.
206
+ */
207
+ start: Point;
208
+ /**
209
+ * Place of the first character after the parsed source region.
210
+ */
211
+ end: Point;
212
+ }
213
+ /**
214
+ * Abstract unist node.
215
+ *
216
+ * The syntactic unit in unist syntax trees are called nodes.
217
+ *
218
+ * This interface is supposed to be extended.
219
+ * If you can use {@link Literal} or {@link Parent}, you should.
220
+ * But for example in markdown, a `thematicBreak` (`***`), is neither literal
221
+ * nor parent, but still a node.
222
+ */
223
+ interface Node$1 {
224
+ /**
225
+ * Node type.
226
+ */
227
+ type: string;
228
+ /**
229
+ * Info from the ecosystem.
230
+ */
231
+ data?: Data$1 | undefined;
232
+ /**
233
+ * Position of a node in a source document.
234
+ *
235
+ * Nodes that are generated (not in the original source document) must not
236
+ * have a position.
237
+ */
238
+ position?: Position | undefined;
239
+ }
240
+ //#endregion
241
+ //#region node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts
242
+ // ## Interfaces
243
+ /**
244
+ * Info associated with hast nodes by the ecosystem.
245
+ *
246
+ * This space is guaranteed to never be specified by unist or hast.
247
+ * But you can use it in utilities and plugins to store data.
248
+ *
249
+ * This type can be augmented to register custom data.
250
+ * For example:
251
+ *
252
+ * ```ts
253
+ * declare module 'hast' {
254
+ * interface Data {
255
+ * // `someNode.data.myId` is typed as `number | undefined`
256
+ * myId?: number | undefined
257
+ * }
258
+ * }
259
+ * ```
260
+ */
261
+ interface Data extends Data$1 {}
262
+ /**
263
+ * Info associated with an element.
264
+ */
265
+ interface Properties {
266
+ [PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
267
+ }
268
+ // ## Content maps
269
+ /**
270
+ * Union of registered hast nodes that can occur in {@link Element}.
271
+ *
272
+ * To register mote custom hast nodes, add them to {@link ElementContentMap}.
273
+ * They will be automatically added here.
274
+ */
275
+ type ElementContent = ElementContentMap[keyof ElementContentMap];
276
+ /**
277
+ * Registry of all hast nodes that can occur as children of {@link Element}.
278
+ *
279
+ * For a union of all {@link Element} children, see {@link ElementContent}.
280
+ */
281
+ interface ElementContentMap {
282
+ comment: Comment;
283
+ element: Element;
284
+ text: Text;
285
+ }
286
+ /**
287
+ * Union of registered hast nodes that can occur in {@link Root}.
288
+ *
289
+ * To register custom hast nodes, add them to {@link RootContentMap}.
290
+ * They will be automatically added here.
291
+ */
292
+ type RootContent = RootContentMap[keyof RootContentMap];
293
+ /**
294
+ * Registry of all hast nodes that can occur as children of {@link Root}.
295
+ *
296
+ * > 👉 **Note**: {@link Root} does not need to be an entire document.
297
+ * > it can also be a fragment.
298
+ *
299
+ * For a union of all {@link Root} children, see {@link RootContent}.
300
+ */
301
+ interface RootContentMap {
302
+ comment: Comment;
303
+ doctype: Doctype;
304
+ element: Element;
305
+ text: Text;
306
+ }
307
+ // ## Abstract nodes
308
+ /**
309
+ * Abstract hast node.
310
+ *
311
+ * This interface is supposed to be extended.
312
+ * If you can use {@link Literal} or {@link Parent}, you should.
313
+ * But for example in HTML, a `Doctype` is neither literal nor parent, but
314
+ * still a node.
315
+ *
316
+ * To register custom hast nodes, add them to {@link RootContentMap} and other
317
+ * places where relevant (such as {@link ElementContentMap}).
318
+ *
319
+ * For a union of all registered hast nodes, see {@link Nodes}.
320
+ */
321
+ interface Node extends Node$1 {
322
+ /**
323
+ * Info from the ecosystem.
324
+ */
325
+ data?: Data | undefined;
326
+ }
327
+ /**
328
+ * Abstract hast node that contains the smallest possible value.
329
+ *
330
+ * This interface is supposed to be extended if you make custom hast nodes.
331
+ *
332
+ * For a union of all registered hast literals, see {@link Literals}.
333
+ */
334
+ interface Literal extends Node {
335
+ /**
336
+ * Plain-text value.
337
+ */
338
+ value: string;
339
+ }
340
+ /**
341
+ * Abstract hast node that contains other hast nodes (*children*).
342
+ *
343
+ * This interface is supposed to be extended if you make custom hast nodes.
344
+ *
345
+ * For a union of all registered hast parents, see {@link Parents}.
346
+ */
347
+ interface Parent extends Node {
348
+ /**
349
+ * List of children.
350
+ */
351
+ children: RootContent[];
352
+ }
353
+ // ## Concrete nodes
354
+ /**
355
+ * HTML comment.
356
+ */
357
+ interface Comment extends Literal {
358
+ /**
359
+ * Node type of HTML comments in hast.
360
+ */
361
+ type: "comment";
362
+ /**
363
+ * Data associated with the comment.
364
+ */
365
+ data?: CommentData | undefined;
366
+ }
367
+ /**
368
+ * Info associated with hast comments by the ecosystem.
369
+ */
370
+ interface CommentData extends Data {}
371
+ /**
372
+ * HTML document type.
373
+ */
374
+ interface Doctype extends Node$1 {
375
+ /**
376
+ * Node type of HTML document types in hast.
377
+ */
378
+ type: "doctype";
379
+ /**
380
+ * Data associated with the doctype.
381
+ */
382
+ data?: DoctypeData | undefined;
383
+ }
384
+ /**
385
+ * Info associated with hast doctypes by the ecosystem.
386
+ */
387
+ interface DoctypeData extends Data {}
388
+ /**
389
+ * HTML element.
390
+ */
391
+ interface Element extends Parent {
392
+ /**
393
+ * Node type of elements.
394
+ */
395
+ type: "element";
396
+ /**
397
+ * Tag name (such as `'body'`) of the element.
398
+ */
399
+ tagName: string;
400
+ /**
401
+ * Info associated with the element.
402
+ */
403
+ properties: Properties;
404
+ /**
405
+ * Children of element.
406
+ */
407
+ children: ElementContent[];
408
+ /**
409
+ * When the `tagName` field is `'template'`, a `content` field can be
410
+ * present.
411
+ */
412
+ content?: Root | undefined;
413
+ /**
414
+ * Data associated with the element.
415
+ */
416
+ data?: ElementData | undefined;
417
+ }
418
+ /**
419
+ * Info associated with hast elements by the ecosystem.
420
+ */
421
+ interface ElementData extends Data {}
422
+ /**
423
+ * Document fragment or a whole document.
424
+ *
425
+ * Should be used as the root of a tree and must not be used as a child.
426
+ *
427
+ * Can also be used as the value for the content field on a `'template'` element.
428
+ */
429
+ interface Root extends Parent {
430
+ /**
431
+ * Node type of hast root.
432
+ */
433
+ type: "root";
434
+ /**
435
+ * Children of root.
436
+ */
437
+ children: RootContent[];
438
+ /**
439
+ * Data associated with the hast root.
440
+ */
441
+ data?: RootData | undefined;
442
+ }
443
+ /**
444
+ * Info associated with hast root nodes by the ecosystem.
445
+ */
446
+ interface RootData extends Data {}
447
+ /**
448
+ * HTML character data (plain text).
449
+ */
450
+ interface Text extends Literal {
451
+ /**
452
+ * Node type of HTML character data (plain text) in hast.
453
+ */
454
+ type: "text";
455
+ /**
456
+ * Data associated with the text.
457
+ */
458
+ data?: TextData | undefined;
459
+ }
460
+ /**
461
+ * Info associated with hast texts by the ecosystem.
462
+ */
463
+ interface TextData extends Data {}
464
+ //#endregion
465
+ //#region src/rehype/flat-toc.d.ts
466
+ /**
467
+ * This rehype plugin extracts the headings from the markdown elements but also the raw elements.
468
+ * So we get html headings in the TOC as well
469
+ *
470
+ * It sets the file.data.fm.toc to a flat map of the toc
471
+ */
472
+ declare const extractToc: Plugin<[], Root>;
473
+ type Toc = TocEntry[];
474
+ type TocEntry = {
475
+ level: number;
476
+ id: string;
477
+ value: string;
478
+ };
479
+ /**
480
+ * Parses raw HTML and returns a flat array of all heading (h1-h6) elements as HAST nodes.
481
+ */
482
+ declare function parseRaw(raw: string): Element[];
483
+ //#endregion
484
+ //#region src/types/deep.d.ts
485
+ /**
486
+ * @example
487
+ * type HomeOverridden = DeepOverride<Home, {
488
+ * test: {
489
+ * featuredImages: never; // Removing the property
490
+ * meta: {
491
+ * updatedAt: string; // Changing the type
492
+ * };
493
+ * };
494
+ * }>;
495
+ */
496
+ type DeepOverride<T, R> = { [K in keyof T]: K extends keyof R ? R[K] extends infer RK ? RK extends Record<string, any> ? T[K] extends Record<string, any> ? DeepOverride<T[K], RK> : RK : RK extends Array<infer RU> ? T[K] extends Array<infer TU> ? Array<DeepOverride<TU, RU>> : RK : RK : never : T[K] };
497
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | RegExp | Function;
498
+ type DeepPartial<T> = T extends Primitive ? T : T extends readonly (infer U)[] ? readonly U[] : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
499
+ type DeepRequired<T> = { [P in keyof T]-?: NonNullable<T[P] extends object ? (T[P] extends Function ? T[P] : DeepRequired<T[P]>) : T[P]> };
500
+ //#endregion
501
+ //#region src/types/safe.d.ts
502
+ type SafeOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
503
+ //#endregion
504
+ //#region src/utils/valibot.d.ts
505
+ declare function isSchema(x: unknown): x is GenericSchema;
506
+ declare function unwrap(schema: GenericSchema): GenericSchema;
507
+ type GetSchemaByPathOptions = {
508
+ /**
509
+ * When a union/variant cannot be narrowed by the path segment,
510
+ * choose index `preferOption` (default 0). Set to -1 to return undefined instead.
511
+ */
512
+ preferOption?: number;
513
+ };
514
+ declare function getSchemaByPath(root: GenericSchema | GenericSchemaAsync, path: string, opts?: GetSchemaByPathOptions): GenericSchema | undefined;
515
+ //#endregion
516
+ //#region src/utils/object.d.ts
517
+ /**
518
+ * Sets the value for an object by its dot path
519
+ * @param obj - any object
520
+ * @param path - the dot path eg. key1.0.1.key2
521
+ * @param value - any value
522
+ * @returns - the modified object
523
+ */
524
+ declare function setByPath<T extends object>(obj: T, path: string, value: any): T;
525
+ /**
526
+ * Gets the value from an object by its dot path
527
+ * @param obj - any object
528
+ * @param path - the dot path eg. key1.0.1.key2
529
+ * @returns - the value at the given path or undefined
530
+ */
531
+ declare function getByPath<T extends object>(obj: T, path: string): any;
532
+ /**
533
+ * Returns a deep "patch" object containing only the fields from `b`
534
+ * that are different from `a`.
535
+ *
536
+ * Behavior:
537
+ * - Only keys from `b` can appear in the result.
538
+ * - New keys in `b` are included.
539
+ * - Changed primitive/array values are included as the value from `b`.
540
+ * - For nested plain objects, it recurses and returns only the differing nested fields.
541
+ * - Arrays are treated as atomic (if different, the whole array from `b` is returned).
542
+ *
543
+ * Typing:
544
+ * - Output is `DeepPartial<B>` because only a subset of `b`'s shape is returned.
545
+ *
546
+ * @template A
547
+ * @template B
548
+ * @param {A} a - Base/original object (can be a different shape than `b`).
549
+ * @param {B} b - Updated object; output keys come from this object.
550
+ * @returns {DeepPartial<B>} Deep partial of `b` containing only differences vs `a`.
551
+ */
552
+ declare const deepDiff: <A extends object, B extends object>(a: A, b: B) => DeepPartial<B>;
553
+ /**
554
+ * Deeply prunes `source` to match the *shape* of `shape`.
555
+ *
556
+ * Rules:
557
+ * - Only keys that exist on `shape` are kept.
558
+ * - Pruning is deep for nested plain objects.
559
+ * - Arrays are supported by using the first element of `shape` as the element-shape.
560
+ * - If `shape` is `[]`, returns `[]` (drops all elements).
561
+ * - Primitive values are kept as-is (no type coercion) if the key exists in `shape`.
562
+ * - If `shape` expects an object/array but `source` is not compatible, returns an empty object/array of that shape.
563
+ *
564
+ * @typeParam S - Source object type.
565
+ * @typeParam Sh - Shape object type.
566
+ * @param source - The object to prune.
567
+ * @param shape - The object whose keys/structure are the allowlist.
568
+ * @returns A new value derived from `source`, containing only fields present in `shape`, pruned deeply.
569
+ *
570
+ * @example
571
+ * const source = { a: 1, b: { c: 2, d: 3 }, e: [ { x: 1, y: 2 }, { x: 3, y: 4 } ], z: 9 };
572
+ * const shape = { a: 0, b: { c: 0 }, e: [ { x: 0 } ] };
573
+ * // => { a: 1, b: { c: 2 }, e: [ { x: 1 }, { x: 3 } ] }
574
+ * const out = pruneToShape(source, shape);
575
+ */
576
+ declare function pruneToShape<S, Sh>(source: S, shape: Sh): Sh;
577
+ //#endregion
578
+ export { APIGatewayHandler, ApiEndpoints, ApiErrorBody, ApiInput, ApiOutput, ApiRequestFunction, ApiResponse, ApiSchema, ApiSuccessBody, CleanResponse, DeepOverride, DeepPartial, DeepRequired, ErrorBody, ErrorCode, ErrorRawProxyResultV2, FetchResponse, GetSchemaByPathOptions, HTTPMethod, HTTPMethods, OkRawProxyResultV2, RawApiGatewayHandler, RawProxyResultV2, SafeOmit, SuccessCode, Toc, TocEntry, createApiRequest, deepDiff, extractToc, getByPath, getSchemaByPath, isSchema, parseRaw, pruneToShape, setByPath, unwrap, wrapHandler };
5
579
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","names":["Data","Point","line","column","offset","Position","start","end","Literal","Node","value","type","data","position","Parent","children","Data","UnistData","Literal","UnistLiteral","Node","UnistNode","Parent","UnistParent","Properties","Array","PropertyName","ElementContent","ElementContentMap","Comment","Element","Text","comment","element","text","RootContent","RootContentMap","Doctype","doctype","Content","Literals","Nodes","Extract","Root","Parents","data","value","children","CommentData","type","DoctypeData","ElementData","tagName","properties","content","RootData","TextData"],"sources":["../src/lambda/handlerUtils.ts","../src/lambda/client-types.ts","../src/lambda/client.ts","../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts","../src/rehype/flat-toc.ts","../src/types/deep.ts","../src/types/safe.ts","../src/utils/valibot.ts","../src/utils/object.ts"],"x_google_ignoreList":[3,4],"mappings":";;;;;;KAGY,WAAA;AAAA,KACA,SAAA;AAAA,KAEA,SAAA;EAAc,OAAA;EAAiB,KAAA;IAAU,IAAA;IAAc,KAAA;EAAA;AAAA;;AAFnE;;KAOY,qBAAA;EACV,UAAA,EAAY,SAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA,GAAO,SAAA;EACP,eAAA;EACA,OAAA;AAAA;AAAA,KAGU,kBAAA;EACV,UAAA,EAAY,WAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA;EACA,eAAA;EACA,OAAA;AAAA;;;;KAKU,gBAAA,GAAmB,qBAAA,GAAwB,kBAAA;AAAA,KAG3C,iBAAA,OAAwB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,OAAA,KAAY,OAAA,CAAQ,uBAAA;AAAA,KAG/D,oBAAA,WAA+B,0CAAA,UACzC,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,OAAA,KACN,OAAA,CAAQ,gBAAA;;;;AAnBb;;;;;;;;;;;iBAmCgB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