@rivetkit/engine-api-full 2.0.21

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 (243) hide show
  1. package/LICENSE +203 -0
  2. package/dist/browser/cjs/core.js +2338 -0
  3. package/dist/browser/cjs/index.js +4030 -0
  4. package/dist/browser/cjs/serialization.js +1916 -0
  5. package/dist/browser/esm/core.js +2312 -0
  6. package/dist/browser/esm/index.js +4004 -0
  7. package/dist/browser/esm/serialization.js +1889 -0
  8. package/dist/node/core.js +2353 -0
  9. package/dist/node/index.js +4043 -0
  10. package/dist/node/serialization.js +1976 -0
  11. package/package.json +58 -0
  12. package/types/Client.d.ts +233 -0
  13. package/types/api/client/index.d.ts +1 -0
  14. package/types/api/client/requests/ActorsCreateRequest.d.ts +22 -0
  15. package/types/api/client/requests/ActorsDeleteRequest.d.ts +10 -0
  16. package/types/api/client/requests/ActorsGetOrCreateRequest.d.ts +23 -0
  17. package/types/api/client/requests/ActorsListNamesRequest.d.ts +14 -0
  18. package/types/api/client/requests/ActorsListRequest.d.ts +18 -0
  19. package/types/api/client/requests/RunnerConfigsDeleteRequest.d.ts +12 -0
  20. package/types/api/client/requests/RunnerConfigsListRequest.d.ts +17 -0
  21. package/types/api/client/requests/RunnerConfigsRefreshMetadataRequest.d.ts +17 -0
  22. package/types/api/client/requests/RunnerConfigsServerlessHealthCheckRequest.d.ts +15 -0
  23. package/types/api/client/requests/RunnerConfigsUpsertRequestBody.d.ts +17 -0
  24. package/types/api/client/requests/index.d.ts +10 -0
  25. package/types/api/index.d.ts +3 -0
  26. package/types/api/resources/datacenters/client/Client.d.ts +36 -0
  27. package/types/api/resources/datacenters/client/index.d.ts +1 -0
  28. package/types/api/resources/datacenters/index.d.ts +1 -0
  29. package/types/api/resources/health/client/Client.d.ts +36 -0
  30. package/types/api/resources/health/client/index.d.ts +1 -0
  31. package/types/api/resources/health/index.d.ts +1 -0
  32. package/types/api/resources/index.d.ts +6 -0
  33. package/types/api/resources/namespaces/client/Client.d.ts +48 -0
  34. package/types/api/resources/namespaces/client/index.d.ts +1 -0
  35. package/types/api/resources/namespaces/client/requests/NamespacesCreateRequest.d.ts +14 -0
  36. package/types/api/resources/namespaces/client/requests/NamespacesListRequest.d.ts +13 -0
  37. package/types/api/resources/namespaces/client/requests/index.d.ts +2 -0
  38. package/types/api/resources/namespaces/index.d.ts +1 -0
  39. package/types/api/resources/runners/client/Client.d.ts +54 -0
  40. package/types/api/resources/runners/client/index.d.ts +1 -0
  41. package/types/api/resources/runners/client/requests/RunnersListNamesRequest.d.ts +14 -0
  42. package/types/api/resources/runners/client/requests/RunnersListRequest.d.ts +17 -0
  43. package/types/api/resources/runners/client/requests/index.d.ts +2 -0
  44. package/types/api/resources/runners/index.d.ts +1 -0
  45. package/types/api/types/Actor.d.ts +19 -0
  46. package/types/api/types/ActorName.d.ts +6 -0
  47. package/types/api/types/ActorsCreateResponse.d.ts +7 -0
  48. package/types/api/types/ActorsDeleteResponse.d.ts +4 -0
  49. package/types/api/types/ActorsGetOrCreateResponse.d.ts +8 -0
  50. package/types/api/types/ActorsListNamesResponse.d.ts +8 -0
  51. package/types/api/types/ActorsListResponse.d.ts +8 -0
  52. package/types/api/types/CrashPolicy.d.ts +9 -0
  53. package/types/api/types/Datacenter.d.ts +8 -0
  54. package/types/api/types/DatacenterHealth.d.ts +12 -0
  55. package/types/api/types/DatacentersListResponse.d.ts +8 -0
  56. package/types/api/types/HealthFanoutResponse.d.ts +7 -0
  57. package/types/api/types/HealthResponse.d.ts +8 -0
  58. package/types/api/types/HealthStatus.d.ts +8 -0
  59. package/types/api/types/Namespace.d.ts +10 -0
  60. package/types/api/types/NamespaceListResponse.d.ts +8 -0
  61. package/types/api/types/NamespacesCreateResponse.d.ts +7 -0
  62. package/types/api/types/Pagination.d.ts +6 -0
  63. package/types/api/types/RivetId.d.ts +4 -0
  64. package/types/api/types/Runner.d.ts +21 -0
  65. package/types/api/types/RunnerConfig.d.ts +9 -0
  66. package/types/api/types/RunnerConfigKind.d.ts +5 -0
  67. package/types/api/types/RunnerConfigKindNormal.d.ts +6 -0
  68. package/types/api/types/RunnerConfigKindServerless.d.ts +7 -0
  69. package/types/api/types/RunnerConfigKindServerlessServerless.d.ts +13 -0
  70. package/types/api/types/RunnerConfigServerless.d.ts +13 -0
  71. package/types/api/types/RunnerConfigVariant.d.ts +8 -0
  72. package/types/api/types/RunnerConfigsDeleteResponse.d.ts +4 -0
  73. package/types/api/types/RunnerConfigsListResponse.d.ts +8 -0
  74. package/types/api/types/RunnerConfigsListResponseRunnerConfigsValue.d.ts +7 -0
  75. package/types/api/types/RunnerConfigsRefreshMetadataRequestBody.d.ts +4 -0
  76. package/types/api/types/RunnerConfigsRefreshMetadataResponse.d.ts +4 -0
  77. package/types/api/types/RunnerConfigsServerlessHealthCheckResponse.d.ts +5 -0
  78. package/types/api/types/RunnerConfigsServerlessHealthCheckResponseFailure.d.ts +7 -0
  79. package/types/api/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.d.ts +7 -0
  80. package/types/api/types/RunnerConfigsServerlessHealthCheckResponseSuccess.d.ts +7 -0
  81. package/types/api/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.d.ts +6 -0
  82. package/types/api/types/RunnerConfigsServerlessMetadataError.d.ts +5 -0
  83. package/types/api/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.d.ts +6 -0
  84. package/types/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.d.ts +7 -0
  85. package/types/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.d.ts +6 -0
  86. package/types/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.d.ts +7 -0
  87. package/types/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.d.ts +7 -0
  88. package/types/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.d.ts +7 -0
  89. package/types/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.d.ts +7 -0
  90. package/types/api/types/RunnerConfigsServerlessMetadataErrorRequestFailed.d.ts +6 -0
  91. package/types/api/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.d.ts +6 -0
  92. package/types/api/types/RunnerConfigsUpsertResponse.d.ts +6 -0
  93. package/types/api/types/RunnersListNamesResponse.d.ts +8 -0
  94. package/types/api/types/RunnersListResponse.d.ts +8 -0
  95. package/types/api/types/index.d.ts +50 -0
  96. package/types/core/auth/BasicAuth.d.ts +8 -0
  97. package/types/core/auth/BearerToken.d.ts +5 -0
  98. package/types/core/auth/index.d.ts +2 -0
  99. package/types/core/fetcher/APIResponse.d.ts +10 -0
  100. package/types/core/fetcher/Fetcher.d.ts +39 -0
  101. package/types/core/fetcher/Supplier.d.ts +4 -0
  102. package/types/core/fetcher/createRequestUrl.d.ts +1 -0
  103. package/types/core/fetcher/getFetchFn.d.ts +4 -0
  104. package/types/core/fetcher/getHeader.d.ts +1 -0
  105. package/types/core/fetcher/getRequestBody.d.ts +7 -0
  106. package/types/core/fetcher/getResponseBody.d.ts +1 -0
  107. package/types/core/fetcher/index.d.ts +5 -0
  108. package/types/core/fetcher/makeRequest.d.ts +1 -0
  109. package/types/core/fetcher/requestWithRetries.d.ts +1 -0
  110. package/types/core/fetcher/signals.d.ts +11 -0
  111. package/types/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  112. package/types/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  113. package/types/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  114. package/types/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  115. package/types/core/index.d.ts +4 -0
  116. package/types/core/json.d.ts +15 -0
  117. package/types/core/runtime/index.d.ts +1 -0
  118. package/types/core/runtime/runtime.d.ts +9 -0
  119. package/types/core/schemas/Schema.d.ts +87 -0
  120. package/types/core/schemas/builders/bigint/bigint.d.ts +2 -0
  121. package/types/core/schemas/builders/bigint/index.d.ts +1 -0
  122. package/types/core/schemas/builders/date/date.d.ts +2 -0
  123. package/types/core/schemas/builders/date/index.d.ts +1 -0
  124. package/types/core/schemas/builders/enum/enum.d.ts +2 -0
  125. package/types/core/schemas/builders/enum/index.d.ts +1 -0
  126. package/types/core/schemas/builders/index.d.ts +14 -0
  127. package/types/core/schemas/builders/lazy/index.d.ts +3 -0
  128. package/types/core/schemas/builders/lazy/lazy.d.ts +5 -0
  129. package/types/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
  130. package/types/core/schemas/builders/list/index.d.ts +1 -0
  131. package/types/core/schemas/builders/list/list.d.ts +2 -0
  132. package/types/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
  133. package/types/core/schemas/builders/literals/index.d.ts +2 -0
  134. package/types/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
  135. package/types/core/schemas/builders/object/index.d.ts +6 -0
  136. package/types/core/schemas/builders/object/object.d.ts +3 -0
  137. package/types/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
  138. package/types/core/schemas/builders/object/property.d.ts +8 -0
  139. package/types/core/schemas/builders/object/types.d.ts +31 -0
  140. package/types/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
  141. package/types/core/schemas/builders/object-like/index.d.ts +2 -0
  142. package/types/core/schemas/builders/object-like/types.d.ts +7 -0
  143. package/types/core/schemas/builders/primitives/any.d.ts +1 -0
  144. package/types/core/schemas/builders/primitives/boolean.d.ts +1 -0
  145. package/types/core/schemas/builders/primitives/index.d.ts +5 -0
  146. package/types/core/schemas/builders/primitives/number.d.ts +1 -0
  147. package/types/core/schemas/builders/primitives/string.d.ts +1 -0
  148. package/types/core/schemas/builders/primitives/unknown.d.ts +1 -0
  149. package/types/core/schemas/builders/record/index.d.ts +2 -0
  150. package/types/core/schemas/builders/record/record.d.ts +3 -0
  151. package/types/core/schemas/builders/record/types.d.ts +4 -0
  152. package/types/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
  153. package/types/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
  154. package/types/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +21 -0
  155. package/types/core/schemas/builders/schema-utils/index.d.ts +4 -0
  156. package/types/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
  157. package/types/core/schemas/builders/set/index.d.ts +1 -0
  158. package/types/core/schemas/builders/set/set.d.ts +2 -0
  159. package/types/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
  160. package/types/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
  161. package/types/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
  162. package/types/core/schemas/builders/union/discriminant.d.ts +5 -0
  163. package/types/core/schemas/builders/union/index.d.ts +4 -0
  164. package/types/core/schemas/builders/union/types.d.ts +13 -0
  165. package/types/core/schemas/builders/union/union.d.ts +4 -0
  166. package/types/core/schemas/index.d.ts +2 -0
  167. package/types/core/schemas/utils/MaybePromise.d.ts +1 -0
  168. package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
  169. package/types/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
  170. package/types/core/schemas/utils/entries.d.ts +1 -0
  171. package/types/core/schemas/utils/filterObject.d.ts +1 -0
  172. package/types/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
  173. package/types/core/schemas/utils/isPlainObject.d.ts +1 -0
  174. package/types/core/schemas/utils/keys.d.ts +1 -0
  175. package/types/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
  176. package/types/core/schemas/utils/partition.d.ts +1 -0
  177. package/types/errors/RivetError.d.ts +12 -0
  178. package/types/errors/RivetTimeoutError.d.ts +6 -0
  179. package/types/errors/index.d.ts +2 -0
  180. package/types/index.d.ts +4 -0
  181. package/types/serialization/client/index.d.ts +1 -0
  182. package/types/serialization/client/requests/ActorsCreateRequest.d.ts +18 -0
  183. package/types/serialization/client/requests/ActorsGetOrCreateRequest.d.ts +18 -0
  184. package/types/serialization/client/requests/RunnerConfigsServerlessHealthCheckRequest.d.ts +13 -0
  185. package/types/serialization/client/requests/RunnerConfigsUpsertRequestBody.d.ts +13 -0
  186. package/types/serialization/client/requests/index.d.ts +4 -0
  187. package/types/serialization/index.d.ts +3 -0
  188. package/types/serialization/resources/index.d.ts +2 -0
  189. package/types/serialization/resources/namespaces/client/index.d.ts +1 -0
  190. package/types/serialization/resources/namespaces/client/requests/NamespacesCreateRequest.d.ts +13 -0
  191. package/types/serialization/resources/namespaces/client/requests/index.d.ts +1 -0
  192. package/types/serialization/resources/namespaces/index.d.ts +1 -0
  193. package/types/serialization/types/Actor.d.ts +26 -0
  194. package/types/serialization/types/ActorName.d.ts +12 -0
  195. package/types/serialization/types/ActorsCreateResponse.d.ts +13 -0
  196. package/types/serialization/types/ActorsDeleteResponse.d.ts +10 -0
  197. package/types/serialization/types/ActorsGetOrCreateResponse.d.ts +14 -0
  198. package/types/serialization/types/ActorsListNamesResponse.d.ts +15 -0
  199. package/types/serialization/types/ActorsListResponse.d.ts +15 -0
  200. package/types/serialization/types/CrashPolicy.d.ts +10 -0
  201. package/types/serialization/types/Datacenter.d.ts +14 -0
  202. package/types/serialization/types/DatacenterHealth.d.ts +19 -0
  203. package/types/serialization/types/DatacentersListResponse.d.ts +15 -0
  204. package/types/serialization/types/HealthFanoutResponse.d.ts +13 -0
  205. package/types/serialization/types/HealthResponse.d.ts +14 -0
  206. package/types/serialization/types/HealthStatus.d.ts +10 -0
  207. package/types/serialization/types/Namespace.d.ts +16 -0
  208. package/types/serialization/types/NamespaceListResponse.d.ts +15 -0
  209. package/types/serialization/types/NamespacesCreateResponse.d.ts +13 -0
  210. package/types/serialization/types/Pagination.d.ts +12 -0
  211. package/types/serialization/types/RivetId.d.ts +10 -0
  212. package/types/serialization/types/Runner.d.ts +27 -0
  213. package/types/serialization/types/RunnerConfig.d.ts +15 -0
  214. package/types/serialization/types/RunnerConfigKind.d.ts +12 -0
  215. package/types/serialization/types/RunnerConfigKindNormal.d.ts +12 -0
  216. package/types/serialization/types/RunnerConfigKindServerless.d.ts +13 -0
  217. package/types/serialization/types/RunnerConfigKindServerlessServerless.d.ts +18 -0
  218. package/types/serialization/types/RunnerConfigServerless.d.ts +18 -0
  219. package/types/serialization/types/RunnerConfigVariant.d.ts +10 -0
  220. package/types/serialization/types/RunnerConfigsDeleteResponse.d.ts +10 -0
  221. package/types/serialization/types/RunnerConfigsListResponse.d.ts +15 -0
  222. package/types/serialization/types/RunnerConfigsListResponseRunnerConfigsValue.d.ts +13 -0
  223. package/types/serialization/types/RunnerConfigsRefreshMetadataRequestBody.d.ts +10 -0
  224. package/types/serialization/types/RunnerConfigsRefreshMetadataResponse.d.ts +10 -0
  225. package/types/serialization/types/RunnerConfigsServerlessHealthCheckResponse.d.ts +12 -0
  226. package/types/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailure.d.ts +13 -0
  227. package/types/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.d.ts +13 -0
  228. package/types/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccess.d.ts +13 -0
  229. package/types/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.d.ts +12 -0
  230. package/types/serialization/types/RunnerConfigsServerlessMetadataError.d.ts +16 -0
  231. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.d.ts +12 -0
  232. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.d.ts +13 -0
  233. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.d.ts +12 -0
  234. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.d.ts +13 -0
  235. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.d.ts +13 -0
  236. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.d.ts +13 -0
  237. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.d.ts +13 -0
  238. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorRequestFailed.d.ts +12 -0
  239. package/types/serialization/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.d.ts +12 -0
  240. package/types/serialization/types/RunnerConfigsUpsertResponse.d.ts +12 -0
  241. package/types/serialization/types/RunnersListNamesResponse.d.ts +14 -0
  242. package/types/serialization/types/RunnersListResponse.d.ts +15 -0
  243. package/types/serialization/types/index.d.ts +50 -0
@@ -0,0 +1,5 @@
1
+ export type BearerToken = string;
2
+ export declare const BearerToken: {
3
+ toAuthorizationHeader: (token: BearerToken | undefined) => string | undefined;
4
+ fromAuthorizationHeader: (header: string) => BearerToken;
5
+ };
@@ -0,0 +1,2 @@
1
+ export { BasicAuth } from "./BasicAuth";
2
+ export { BearerToken } from "./BearerToken";
@@ -0,0 +1,10 @@
1
+ export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | FailedResponse<Failure>;
2
+ export interface SuccessfulResponse<T> {
3
+ ok: true;
4
+ body: T;
5
+ headers?: Record<string, any>;
6
+ }
7
+ export interface FailedResponse<T> {
8
+ ok: false;
9
+ error: T;
10
+ }
@@ -0,0 +1,39 @@
1
+ import { APIResponse } from "./APIResponse";
2
+ export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
3
+ export declare namespace Fetcher {
4
+ interface Args {
5
+ url: string;
6
+ method: string;
7
+ contentType?: string;
8
+ headers?: Record<string, string | undefined>;
9
+ queryParameters?: Record<string, string | string[] | object | object[] | null>;
10
+ body?: unknown;
11
+ timeoutMs?: number;
12
+ maxRetries?: number;
13
+ withCredentials?: boolean;
14
+ abortSignal?: AbortSignal;
15
+ requestType?: "json" | "file" | "bytes";
16
+ responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer";
17
+ duplex?: "half";
18
+ }
19
+ type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
20
+ interface FailedStatusCodeError {
21
+ reason: "status-code";
22
+ statusCode: number;
23
+ body: unknown;
24
+ }
25
+ interface NonJsonError {
26
+ reason: "non-json";
27
+ statusCode: number;
28
+ rawBody: string;
29
+ }
30
+ interface TimeoutError {
31
+ reason: "timeout";
32
+ }
33
+ interface UnknownError {
34
+ reason: "unknown";
35
+ errorMessage: string;
36
+ }
37
+ }
38
+ export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
39
+ export declare const fetcher: FetchFunction;
@@ -0,0 +1,4 @@
1
+ export type Supplier<T> = T | Promise<T> | (() => T | Promise<T>);
2
+ export declare const Supplier: {
3
+ get: <T>(supplier: Supplier<T>) => Promise<T>;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[] | null>): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns a fetch function based on the runtime
3
+ */
4
+ export declare function getFetchFn(): Promise<any>;
@@ -0,0 +1 @@
1
+ export declare function getHeader(headers: Record<string, any>, header: string): string | undefined;
@@ -0,0 +1,7 @@
1
+ export declare namespace GetRequestBody {
2
+ interface Args {
3
+ body: unknown;
4
+ type: "json" | "file" | "bytes" | "other";
5
+ }
6
+ }
7
+ export declare function getRequestBody({ body, type }: GetRequestBody.Args): Promise<BodyInit | undefined>;
@@ -0,0 +1 @@
1
+ export declare function getResponseBody(response: Response, responseType?: string): Promise<unknown>;
@@ -0,0 +1,5 @@
1
+ export type { APIResponse } from "./APIResponse";
2
+ export { fetcher } from "./Fetcher";
3
+ export type { Fetcher, FetchFunction } from "./Fetcher";
4
+ export { getHeader } from "./getHeader";
5
+ export { Supplier } from "./Supplier";
@@ -0,0 +1 @@
1
+ export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
@@ -0,0 +1 @@
1
+ export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number): Promise<Response>;
@@ -0,0 +1,11 @@
1
+ export declare function getTimeoutSignal(timeoutMs: number): {
2
+ signal: AbortSignal;
3
+ abortId: NodeJS.Timeout;
4
+ };
5
+ /**
6
+ * Returns an abort signal that is getting aborted when
7
+ * at least one of the specified abort signals is aborted.
8
+ *
9
+ * Requires at least node.js 18.
10
+ */
11
+ export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
@@ -0,0 +1,30 @@
1
+ import type { Writable } from "readable-stream";
2
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
3
+ export declare class Node18UniversalStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>, ReadFormat> {
4
+ private readableStream;
5
+ private reader;
6
+ private events;
7
+ private paused;
8
+ private resumeCallback;
9
+ private encoding;
10
+ constructor(readableStream: ReadableStream<ReadFormat>);
11
+ on(event: string, callback: EventCallback): void;
12
+ off(event: string, callback: EventCallback): void;
13
+ pipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
14
+ pipeTo(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
15
+ unpipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): void;
16
+ destroy(error?: Error): void;
17
+ pause(): void;
18
+ resume(): void;
19
+ get isPaused(): boolean;
20
+ read(): Promise<ReadFormat | undefined>;
21
+ setEncoding(encoding: string): void;
22
+ text(): Promise<string>;
23
+ json<T>(): Promise<T>;
24
+ private _write;
25
+ private _end;
26
+ private _error;
27
+ private _emit;
28
+ private _startReading;
29
+ [Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
30
+ }
@@ -0,0 +1,21 @@
1
+ import type { Readable, Writable } from "readable-stream";
2
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
3
+ export declare class NodePre18StreamWrapper implements StreamWrapper<Writable, Buffer> {
4
+ private readableStream;
5
+ private encoding;
6
+ constructor(readableStream: Readable);
7
+ on(event: string, callback: EventCallback): void;
8
+ off(event: string, callback: EventCallback): void;
9
+ pipe(dest: Writable): Writable;
10
+ pipeTo(dest: Writable): Writable;
11
+ unpipe(dest?: Writable): void;
12
+ destroy(error?: Error): void;
13
+ pause(): void;
14
+ resume(): void;
15
+ get isPaused(): boolean;
16
+ read(): Promise<Buffer | undefined>;
17
+ setEncoding(encoding?: string): void;
18
+ text(): Promise<string>;
19
+ json<T>(): Promise<T>;
20
+ [Symbol.asyncIterator](): AsyncIterableIterator<Buffer>;
21
+ }
@@ -0,0 +1,31 @@
1
+ import { StreamWrapper } from "./chooseStreamWrapper";
2
+ type EventCallback = (data?: any) => void;
3
+ export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat> {
4
+ private readableStream;
5
+ private reader;
6
+ private events;
7
+ private paused;
8
+ private resumeCallback;
9
+ private encoding;
10
+ constructor(readableStream: ReadableStream<ReadFormat>);
11
+ on(event: string, callback: EventCallback): void;
12
+ off(event: string, callback: EventCallback): void;
13
+ pipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
14
+ pipeTo(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
15
+ unpipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream): void;
16
+ destroy(error?: Error): void;
17
+ pause(): void;
18
+ resume(): void;
19
+ get isPaused(): boolean;
20
+ read(): Promise<ReadFormat | undefined>;
21
+ setEncoding(encoding: string): void;
22
+ text(): Promise<string>;
23
+ json<T>(): Promise<T>;
24
+ private _write;
25
+ private _end;
26
+ private _error;
27
+ private _emit;
28
+ private _startReading;
29
+ [Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
30
+ }
31
+ export {};
@@ -0,0 +1,18 @@
1
+ export type EventCallback = (data?: any) => void;
2
+ export interface StreamWrapper<WritableStream, ReadFormat> {
3
+ setEncoding(encoding?: string): void;
4
+ on(event: string, callback: EventCallback): void;
5
+ off(event: string, callback: EventCallback): void;
6
+ pipe(dest: WritableStream): WritableStream;
7
+ pipeTo(dest: WritableStream): WritableStream;
8
+ unpipe(dest?: WritableStream): void;
9
+ destroy(error?: Error): void;
10
+ pause(): void;
11
+ resume(): void;
12
+ get isPaused(): boolean;
13
+ read(): Promise<ReadFormat | undefined>;
14
+ text(): Promise<string>;
15
+ json<T>(): Promise<T>;
16
+ [Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
17
+ }
18
+ export declare function chooseStreamWrapper(responseBody: any): Promise<Promise<StreamWrapper<any, any>>>;
@@ -0,0 +1,4 @@
1
+ export * from "./fetcher";
2
+ export * from "./auth";
3
+ export * from "./runtime";
4
+ export * as serialization from "./schemas";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Serialize a value to JSON
3
+ * @param value A JavaScript value, usually an object or array, to be converted.
4
+ * @param replacer A function that transforms the results.
5
+ * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
6
+ * @returns JSON string
7
+ */
8
+ export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
9
+ /**
10
+ * Parse JSON string to object, array, or other type
11
+ * @param text A valid JSON string.
12
+ * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
13
+ * @returns Parsed object, array, or other type
14
+ */
15
+ export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
@@ -0,0 +1 @@
1
+ export { RUNTIME } from "./runtime";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A constant that indicates which environment and version the SDK is running in.
3
+ */
4
+ export declare const RUNTIME: Runtime;
5
+ export interface Runtime {
6
+ type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
+ version?: string;
8
+ parsedVersion?: number;
9
+ }
@@ -0,0 +1,87 @@
1
+ import { SchemaUtils } from "./builders";
2
+ export type Schema<Raw = unknown, Parsed = unknown> = BaseSchema<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
3
+ export type inferRaw<S extends Schema> = S extends Schema<infer Raw, any> ? Raw : never;
4
+ export type inferParsed<S extends Schema> = S extends Schema<any, infer Parsed> ? Parsed : never;
5
+ export interface BaseSchema<Raw, Parsed> {
6
+ parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid<Parsed>;
7
+ json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid<Raw>;
8
+ getType: () => SchemaType | SchemaType;
9
+ }
10
+ export declare const SchemaType: {
11
+ readonly BIGINT: "bigint";
12
+ readonly DATE: "date";
13
+ readonly ENUM: "enum";
14
+ readonly LIST: "list";
15
+ readonly STRING_LITERAL: "stringLiteral";
16
+ readonly BOOLEAN_LITERAL: "booleanLiteral";
17
+ readonly OBJECT: "object";
18
+ readonly ANY: "any";
19
+ readonly BOOLEAN: "boolean";
20
+ readonly NUMBER: "number";
21
+ readonly STRING: "string";
22
+ readonly UNKNOWN: "unknown";
23
+ readonly RECORD: "record";
24
+ readonly SET: "set";
25
+ readonly UNION: "union";
26
+ readonly UNDISCRIMINATED_UNION: "undiscriminatedUnion";
27
+ readonly NULLABLE: "nullable";
28
+ readonly OPTIONAL: "optional";
29
+ readonly OPTIONAL_NULLABLE: "optionalNullable";
30
+ };
31
+ export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
32
+ export type MaybeValid<T> = Valid<T> | Invalid;
33
+ export interface Valid<T> {
34
+ ok: true;
35
+ value: T;
36
+ }
37
+ export interface Invalid {
38
+ ok: false;
39
+ errors: ValidationError[];
40
+ }
41
+ export interface ValidationError {
42
+ path: string[];
43
+ message: string;
44
+ }
45
+ export interface SchemaOptions {
46
+ /**
47
+ * how to handle unrecognized keys in objects
48
+ *
49
+ * @default "fail"
50
+ */
51
+ unrecognizedObjectKeys?: "fail" | "passthrough" | "strip";
52
+ /**
53
+ * whether to fail when an unrecognized discriminant value is
54
+ * encountered in a union
55
+ *
56
+ * @default false
57
+ */
58
+ allowUnrecognizedUnionMembers?: boolean;
59
+ /**
60
+ * whether to fail when an unrecognized enum value is encountered
61
+ *
62
+ * @default false
63
+ */
64
+ allowUnrecognizedEnumValues?: boolean;
65
+ /**
66
+ * whether to allow data that doesn't conform to the schema.
67
+ * invalid data is passed through without transformation.
68
+ *
69
+ * when this is enabled, .parse() and .json() will always
70
+ * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()`
71
+ * will never fail.
72
+ *
73
+ * @default false
74
+ */
75
+ skipValidation?: boolean;
76
+ /**
77
+ * each validation failure contains a "path" property, which is
78
+ * the breadcrumbs to the offending node in the JSON. you can supply
79
+ * a prefix that is prepended to all the errors' paths. this can be
80
+ * helpful for zurg's internal debug logging.
81
+ */
82
+ breadcrumbsPrefix?: string[];
83
+ /**
84
+ * whether to send 'null' for optional properties explicitly set to 'undefined'.
85
+ */
86
+ omitUndefined?: boolean;
87
+ }
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function bigint(): Schema<bigint | number, bigint>;
@@ -0,0 +1 @@
1
+ export { bigint } from "./bigint";
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function date(): Schema<string, Date>;
@@ -0,0 +1 @@
1
+ export { date } from "./date";
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function enum_<U extends string, E extends U[]>(values: E): Schema<E[number], E[number]>;
@@ -0,0 +1 @@
1
+ export { enum_ } from "./enum";
@@ -0,0 +1,14 @@
1
+ export * from "./bigint";
2
+ export * from "./date";
3
+ export * from "./enum";
4
+ export * from "./lazy";
5
+ export * from "./list";
6
+ export * from "./literals";
7
+ export * from "./object";
8
+ export * from "./object-like";
9
+ export * from "./primitives";
10
+ export * from "./record";
11
+ export * from "./schema-utils";
12
+ export * from "./set";
13
+ export * from "./undiscriminated-union";
14
+ export * from "./union";
@@ -0,0 +1,3 @@
1
+ export { lazy } from "./lazy";
2
+ export type { SchemaGetter } from "./lazy";
3
+ export { lazyObject } from "./lazyObject";
@@ -0,0 +1,5 @@
1
+ import { BaseSchema, Schema } from "../../Schema";
2
+ export type SchemaGetter<SchemaType extends Schema<any, any>> = () => SchemaType;
3
+ export declare function lazy<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): Schema<Raw, Parsed>;
4
+ export declare function constructLazyBaseSchema<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): BaseSchema<Raw, Parsed>;
5
+ export declare function getMemoizedSchema<SchemaType extends Schema<any, any>>(getter: SchemaGetter<SchemaType>): SchemaType;
@@ -0,0 +1,3 @@
1
+ import { ObjectSchema } from "../object/types";
2
+ import { SchemaGetter } from "./lazy";
3
+ export declare function lazyObject<Raw, Parsed>(getter: SchemaGetter<ObjectSchema<Raw, Parsed>>): ObjectSchema<Raw, Parsed>;
@@ -0,0 +1 @@
1
+ export { list } from "./list";
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function list<Raw, Parsed>(schema: Schema<Raw, Parsed>): Schema<Raw[], Parsed[]>;
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function booleanLiteral<V extends boolean>(literal: V): Schema<V, V>;
@@ -0,0 +1,2 @@
1
+ export { stringLiteral } from "./stringLiteral";
2
+ export { booleanLiteral } from "./booleanLiteral";
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function stringLiteral<V extends string>(literal: V): Schema<V, V>;
@@ -0,0 +1,6 @@
1
+ export { getObjectUtils, object } from "./object";
2
+ export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties";
3
+ export type { inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, } from "./objectWithoutOptionalProperties";
4
+ export { isProperty, property } from "./property";
5
+ export type { Property } from "./property";
6
+ export type { BaseObjectSchema, inferObjectSchemaFromPropertySchemas, inferParsedObject, inferParsedObjectFromPropertySchemas, inferParsedPropertySchema, inferRawKey, inferRawObject, inferRawObjectFromPropertySchemas, inferRawPropertySchema, ObjectSchema, ObjectUtils, PropertySchemas, } from "./types";
@@ -0,0 +1,3 @@
1
+ import { BaseObjectSchema, ObjectUtils, PropertySchemas, inferObjectSchemaFromPropertySchemas } from "./types";
2
+ export declare function object<ParsedKeys extends string, T extends PropertySchemas<ParsedKeys>>(schemas: T): inferObjectSchemaFromPropertySchemas<T>;
3
+ export declare function getObjectUtils<Raw, Parsed>(schema: BaseObjectSchema<Raw, Parsed>): ObjectUtils<Raw, Parsed>;
@@ -0,0 +1,6 @@
1
+ import { ObjectSchema, PropertySchemas, inferParsedPropertySchema, inferRawObjectFromPropertySchemas } from "./types";
2
+ export declare function objectWithoutOptionalProperties<ParsedKeys extends string, T extends PropertySchemas<ParsedKeys>>(schemas: T): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas<T>;
3
+ export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas<T extends PropertySchemas<keyof T>> = ObjectSchema<inferRawObjectFromPropertySchemas<T>, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas<T>>;
4
+ export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas<T extends PropertySchemas<keyof T>> = {
5
+ [K in keyof T]: inferParsedPropertySchema<T[K]>;
6
+ };
@@ -0,0 +1,8 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function property<RawKey extends string, RawValue, ParsedValue>(rawKey: RawKey, valueSchema: Schema<RawValue, ParsedValue>): Property<RawKey, RawValue, ParsedValue>;
3
+ export interface Property<RawKey extends string, RawValue, ParsedValue> {
4
+ rawKey: RawKey;
5
+ valueSchema: Schema<RawValue, ParsedValue>;
6
+ isProperty: true;
7
+ }
8
+ export declare function isProperty<O extends Property<any, any, any>>(maybeProperty: unknown): maybeProperty is O;
@@ -0,0 +1,31 @@
1
+ import { BaseSchema, Schema, inferParsed, inferRaw } from "../../Schema";
2
+ import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties";
3
+ import { ObjectLikeUtils } from "../object-like";
4
+ import { SchemaUtils } from "../schema-utils";
5
+ import { Property } from "./property";
6
+ export type ObjectSchema<Raw, Parsed> = BaseObjectSchema<Raw, Parsed> & ObjectLikeUtils<Raw, Parsed> & ObjectUtils<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
7
+ export interface BaseObjectSchema<Raw, Parsed> extends BaseSchema<Raw, Parsed> {
8
+ _getRawProperties: () => (keyof Raw)[];
9
+ _getParsedProperties: () => (keyof Parsed)[];
10
+ }
11
+ export interface ObjectUtils<Raw, Parsed> {
12
+ extend: <RawExtension, ParsedExtension>(schemas: ObjectSchema<RawExtension, ParsedExtension>) => ObjectSchema<Raw & RawExtension, Parsed & ParsedExtension>;
13
+ passthrough: () => ObjectSchema<Raw & {
14
+ [key: string]: unknown;
15
+ }, Parsed & {
16
+ [key: string]: unknown;
17
+ }>;
18
+ }
19
+ export type inferRawObject<O extends ObjectSchema<any, any>> = O extends ObjectSchema<infer Raw, any> ? Raw : never;
20
+ export type inferParsedObject<O extends ObjectSchema<any, any>> = O extends ObjectSchema<any, infer Parsed> ? Parsed : never;
21
+ export type inferObjectSchemaFromPropertySchemas<T extends PropertySchemas<keyof T>> = ObjectSchema<inferRawObjectFromPropertySchemas<T>, inferParsedObjectFromPropertySchemas<T>>;
22
+ export type inferRawObjectFromPropertySchemas<T extends PropertySchemas<keyof T>> = addQuestionMarksToNullableProperties<{
23
+ [ParsedKey in keyof T as inferRawKey<ParsedKey, T[ParsedKey]>]: inferRawPropertySchema<T[ParsedKey]>;
24
+ }>;
25
+ export type inferParsedObjectFromPropertySchemas<T extends PropertySchemas<keyof T>> = addQuestionMarksToNullableProperties<{
26
+ [K in keyof T]: inferParsedPropertySchema<T[K]>;
27
+ }>;
28
+ export type PropertySchemas<ParsedKeys extends string | number | symbol> = Record<ParsedKeys, Property<any, any, any> | Schema<any, any>>;
29
+ export type inferRawPropertySchema<P extends Property<any, any, any> | Schema<any, any>> = P extends Property<any, infer Raw, any> ? Raw : P extends Schema<any, any> ? inferRaw<P> : never;
30
+ export type inferParsedPropertySchema<P extends Property<any, any, any> | Schema<any, any>> = P extends Property<any, any, infer Parsed> ? Parsed : P extends Schema<any, any> ? inferParsed<P> : never;
31
+ export type inferRawKey<ParsedKey extends string | number | symbol, P extends Property<any, any, any> | Schema<any, any>> = P extends Property<infer Raw, any, any> ? Raw : ParsedKey;
@@ -0,0 +1,9 @@
1
+ import { BaseSchema } from "../../Schema";
2
+ import { ObjectLikeSchema, ObjectLikeUtils } from "./types";
3
+ export declare function getObjectLikeUtils<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): ObjectLikeUtils<Raw, Parsed>;
4
+ /**
5
+ * object-like utils are defined in one file to resolve issues with circular imports
6
+ */
7
+ export declare function withParsedProperties<RawObjectShape, ParsedObjectShape, Properties>(objectLike: BaseSchema<RawObjectShape, ParsedObjectShape>, properties: {
8
+ [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]);
9
+ }): ObjectLikeSchema<RawObjectShape, ParsedObjectShape & Properties>;
@@ -0,0 +1,2 @@
1
+ export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils";
2
+ export type { ObjectLikeSchema, ObjectLikeUtils } from "./types";
@@ -0,0 +1,7 @@
1
+ import { BaseSchema, Schema } from "../../Schema";
2
+ export type ObjectLikeSchema<Raw, Parsed> = Schema<Raw, Parsed> & BaseSchema<Raw, Parsed> & ObjectLikeUtils<Raw, Parsed>;
3
+ export interface ObjectLikeUtils<Raw, Parsed> {
4
+ withParsedProperties: <T extends Record<string, any>>(properties: {
5
+ [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]);
6
+ }) => ObjectLikeSchema<Raw, Parsed & T>;
7
+ }
@@ -0,0 +1 @@
1
+ export declare const any: () => import("../../Schema").Schema<any, any>;
@@ -0,0 +1 @@
1
+ export declare const boolean: () => import("../../Schema").Schema<boolean, boolean>;
@@ -0,0 +1,5 @@
1
+ export { any } from "./any";
2
+ export { boolean } from "./boolean";
3
+ export { number } from "./number";
4
+ export { string } from "./string";
5
+ export { unknown } from "./unknown";
@@ -0,0 +1 @@
1
+ export declare const number: () => import("../../Schema").Schema<number, number>;
@@ -0,0 +1 @@
1
+ export declare const string: () => import("../../Schema").Schema<string, string>;
@@ -0,0 +1 @@
1
+ export declare const unknown: () => import("../../Schema").Schema<unknown, unknown>;
@@ -0,0 +1,2 @@
1
+ export { record } from "./record";
2
+ export type { BaseRecordSchema, RecordSchema } from "./types";
@@ -0,0 +1,3 @@
1
+ import { Schema } from "../../Schema";
2
+ import { RecordSchema } from "./types";
3
+ export declare function record<RawKey extends string | number, RawValue, ParsedValue, ParsedKey extends string | number>(keySchema: Schema<RawKey, ParsedKey>, valueSchema: Schema<RawValue, ParsedValue>): RecordSchema<RawKey, RawValue, ParsedKey, ParsedValue>;
@@ -0,0 +1,4 @@
1
+ import { BaseSchema } from "../../Schema";
2
+ import { SchemaUtils } from "../schema-utils";
3
+ export type RecordSchema<RawKey extends string | number, RawValue, ParsedKey extends string | number, ParsedValue> = BaseRecordSchema<RawKey, RawValue, ParsedKey, ParsedValue> & SchemaUtils<Record<RawKey, RawValue>, Record<ParsedKey, ParsedValue>>;
4
+ export type BaseRecordSchema<RawKey extends string | number, RawValue, ParsedKey extends string | number, ParsedValue> = BaseSchema<Record<RawKey, RawValue>, Record<ParsedKey, ParsedValue>>;
@@ -0,0 +1,5 @@
1
+ import { ValidationError } from "../../Schema";
2
+ export declare class JsonError extends Error {
3
+ readonly errors: ValidationError[];
4
+ constructor(errors: ValidationError[]);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ValidationError } from "../../Schema";
2
+ export declare class ParseError extends Error {
3
+ readonly errors: ValidationError[];
4
+ constructor(errors: ValidationError[]);
5
+ }
@@ -0,0 +1,21 @@
1
+ import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
2
+ export interface SchemaUtils<Raw, Parsed> {
3
+ nullable: () => Schema<Raw | null, Parsed | null>;
4
+ optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
5
+ optionalNullable: () => Schema<Raw | null | undefined, Parsed | null | undefined>;
6
+ transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
7
+ parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
8
+ jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
9
+ }
10
+ export interface SchemaTransformer<Parsed, Transformed> {
11
+ transform: (parsed: Parsed) => Transformed;
12
+ untransform: (transformed: any) => Parsed;
13
+ }
14
+ export declare function getSchemaUtils<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): SchemaUtils<Raw, Parsed>;
15
+ /**
16
+ * schema utils are defined in one file to resolve issues with circular imports
17
+ */
18
+ export declare function nullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null, Parsed | null>;
19
+ export declare function optional<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | undefined>;
20
+ export declare function optionalNullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | null | undefined>;
21
+ export declare function transform<Raw, Parsed, Transformed>(schema: BaseSchema<Raw, Parsed>, transformer: SchemaTransformer<Parsed, Transformed>): Schema<Raw, Transformed>;
@@ -0,0 +1,4 @@
1
+ export { getSchemaUtils, optional, transform } from "./getSchemaUtils";
2
+ export type { SchemaUtils } from "./getSchemaUtils";
3
+ export { JsonError } from "./JsonError";
4
+ export { ParseError } from "./ParseError";
@@ -0,0 +1,2 @@
1
+ import { ValidationError } from "../../Schema";
2
+ export declare function stringifyValidationError(error: ValidationError): string;
@@ -0,0 +1 @@
1
+ export { set } from "./set";
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../../Schema";
2
+ export declare function set<Raw, Parsed>(schema: Schema<Raw, Parsed>): Schema<Raw[], Set<Parsed>>;
@@ -0,0 +1,2 @@
1
+ export type { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema, UndiscriminatedUnionSchema, } from "./types";
2
+ export { undiscriminatedUnion } from "./undiscriminatedUnion";