@zayne-labs/callapi 1.11.4 → 1.11.6

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.
@@ -1,580 +0,0 @@
1
- //#region src/types/type-helpers.ts
2
- const defineEnum = (value) => Object.freeze(value);
3
-
4
- //#endregion
5
- //#region src/constants/defaults.ts
6
- const extraOptionDefaults = Object.freeze(defineEnum({
7
- bodySerializer: JSON.stringify,
8
- defaultHTTPErrorMessage: "HTTP request failed unexpectedly",
9
- dedupeCacheScope: "local",
10
- dedupeCacheScopeKey: "default",
11
- dedupeStrategy: "cancel",
12
- hooksExecutionMode: "parallel",
13
- responseParser: JSON.parse,
14
- responseType: "json",
15
- resultMode: "all",
16
- retryAttempts: 0,
17
- retryCondition: () => true,
18
- retryDelay: 1e3,
19
- retryMaxDelay: 1e4,
20
- retryMethods: ["GET", "POST"],
21
- retryStatusCodes: [],
22
- retryStrategy: "linear"
23
- }));
24
- const requestOptionDefaults = defineEnum({ method: "GET" });
25
-
26
- //#endregion
27
- //#region src/error.ts
28
- const httpErrorSymbol = Symbol("HTTPError");
29
- var HTTPError = class HTTPError extends Error {
30
- errorData;
31
- httpErrorSymbol = httpErrorSymbol;
32
- name = "HTTPError";
33
- response;
34
- constructor(errorDetails, errorOptions) {
35
- const { defaultHTTPErrorMessage, errorData, response } = errorDetails;
36
- const selectedDefaultErrorMessage = (isString(defaultHTTPErrorMessage) ? defaultHTTPErrorMessage : defaultHTTPErrorMessage?.({
37
- errorData,
38
- response
39
- })) ?? (response.statusText || extraOptionDefaults.defaultHTTPErrorMessage);
40
- const message = errorData?.message ?? selectedDefaultErrorMessage;
41
- super(message, errorOptions);
42
- this.errorData = errorData;
43
- this.response = response;
44
- }
45
- /**
46
- * @description Checks if the given error is an instance of HTTPError
47
- * @param error - The error to check
48
- * @returns true if the error is an instance of HTTPError, false otherwise
49
- */
50
- static isError(error) {
51
- if (!isObject(error)) return false;
52
- if (error instanceof HTTPError) return true;
53
- const actualError = error;
54
- return actualError.httpErrorSymbol === httpErrorSymbol && actualError.name === "HTTPError";
55
- }
56
- };
57
- const prettifyPath = (path) => {
58
- if (!path || path.length === 0) return "";
59
- return ` → at ${path.map((segment) => isObject(segment) ? segment.key : segment).join(".")}`;
60
- };
61
- const prettifyValidationIssues = (issues) => {
62
- return issues.map((issue) => `✖ ${issue.message}${prettifyPath(issue.path)}`).join(" | ");
63
- };
64
- const validationErrorSymbol = Symbol("ValidationErrorSymbol");
65
- var ValidationError = class ValidationError extends Error {
66
- errorData;
67
- issueCause;
68
- name = "ValidationError";
69
- response;
70
- validationErrorSymbol = validationErrorSymbol;
71
- constructor(details, errorOptions) {
72
- const { issueCause, issues, response } = details;
73
- const message = prettifyValidationIssues(issues);
74
- super(message, errorOptions);
75
- this.errorData = issues;
76
- this.response = response;
77
- this.issueCause = issueCause;
78
- }
79
- /**
80
- * @description Checks if the given error is an instance of ValidationError
81
- * @param error - The error to check
82
- * @returns true if the error is an instance of ValidationError, false otherwise
83
- */
84
- static isError(error) {
85
- if (!isObject(error)) return false;
86
- if (error instanceof ValidationError) return true;
87
- const actualError = error;
88
- return actualError.validationErrorSymbol === validationErrorSymbol && actualError.name === "ValidationError";
89
- }
90
- };
91
-
92
- //#endregion
93
- //#region src/utils/guards.ts
94
- const isHTTPError = (error) => {
95
- return isObject(error) && error.name === "HTTPError";
96
- };
97
- const isHTTPErrorInstance = (error) => {
98
- return HTTPError.isError(error);
99
- };
100
- const isValidationError = (error) => {
101
- return isObject(error) && error.name === "ValidationError";
102
- };
103
- const isValidationErrorInstance = (error) => {
104
- return ValidationError.isError(error);
105
- };
106
- const isJavascriptError = (error) => {
107
- return isObject(error) && !isHTTPError(error) && !isValidationError(error);
108
- };
109
- const isArray = (value) => Array.isArray(value);
110
- const isBoolean = (value) => typeof value === "boolean";
111
- const isObject = (value) => {
112
- return typeof value === "object" && value !== null;
113
- };
114
- const hasObjectPrototype = (value) => {
115
- return Object.prototype.toString.call(value) === "[object Object]";
116
- };
117
- /**
118
- * @description Copied from TanStack Query's isPlainObject
119
- * @see https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L321
120
- */
121
- const isPlainObject = (value) => {
122
- if (!hasObjectPrototype(value)) return false;
123
- const constructor = value?.constructor;
124
- if (constructor === void 0) return true;
125
- const prototype = constructor.prototype;
126
- if (!hasObjectPrototype(prototype)) return false;
127
- if (!Object.hasOwn(prototype, "isPrototypeOf")) return false;
128
- if (Object.getPrototypeOf(value) !== Object.prototype) return false;
129
- return true;
130
- };
131
- const isValidJsonString = (value) => {
132
- if (!isString(value)) return false;
133
- try {
134
- JSON.parse(value);
135
- return true;
136
- } catch {
137
- return false;
138
- }
139
- };
140
- const isSerializable = (value) => {
141
- return isPlainObject(value) || isArray(value) || typeof value?.toJSON === "function";
142
- };
143
- const isFunction = (value) => typeof value === "function";
144
- const isQueryString = (value) => isString(value) && value.includes("=");
145
- const isString = (value) => typeof value === "string";
146
- const isPromise = (value) => value instanceof Promise;
147
- const isReadableStream = (value) => {
148
- return value instanceof ReadableStream;
149
- };
150
-
151
- //#endregion
152
- //#region src/auth.ts
153
- const resolveAuthValue = (value) => isFunction(value) ? value() : value;
154
- const getAuthHeader = async (auth) => {
155
- if (auth === void 0) return;
156
- if (isPromise(auth) || isFunction(auth) || !isObject(auth)) {
157
- const authValue = await resolveAuthValue(auth);
158
- if (authValue === void 0) return;
159
- return { Authorization: `Bearer ${authValue}` };
160
- }
161
- switch (auth.type) {
162
- case "Basic": {
163
- const [username, password] = await Promise.all([resolveAuthValue(auth.username), resolveAuthValue(auth.password)]);
164
- if (username === void 0 || password === void 0) return;
165
- return { Authorization: `Basic ${globalThis.btoa(`${username}:${password}`)}` };
166
- }
167
- case "Custom": {
168
- const [prefix, value] = await Promise.all([resolveAuthValue(auth.prefix), resolveAuthValue(auth.value)]);
169
- if (value === void 0) return;
170
- return { Authorization: `${prefix} ${value}` };
171
- }
172
- default: {
173
- const [bearer, token] = await Promise.all([resolveAuthValue(auth.bearer), resolveAuthValue(auth.token)]);
174
- if (bearer !== void 0) return { Authorization: `Bearer ${bearer}` };
175
- if (token === void 0) return;
176
- return { Authorization: `Token ${token}` };
177
- }
178
- }
179
- };
180
-
181
- //#endregion
182
- //#region src/constants/common.ts
183
- const fetchSpecificKeys = defineEnum([
184
- "body",
185
- "integrity",
186
- "duplex",
187
- "method",
188
- "headers",
189
- "signal",
190
- "cache",
191
- "redirect",
192
- "window",
193
- "credentials",
194
- "keepalive",
195
- "referrer",
196
- "priority",
197
- "mode",
198
- "referrerPolicy"
199
- ]);
200
-
201
- //#endregion
202
- //#region src/validation.ts
203
- const handleValidatorFunction = async (validator, inputData) => {
204
- try {
205
- return {
206
- issues: void 0,
207
- value: await validator(inputData)
208
- };
209
- } catch (error) {
210
- return {
211
- issues: toArray(error),
212
- value: void 0
213
- };
214
- }
215
- };
216
- const standardSchemaParser = async (fullSchema, schemaName, inputData, response) => {
217
- const schema = fullSchema?.[schemaName];
218
- if (!schema) return inputData;
219
- const result = isFunction(schema) ? await handleValidatorFunction(schema, inputData) : await schema["~standard"].validate(inputData);
220
- if (result.issues) throw new ValidationError({
221
- issueCause: schemaName,
222
- issues: result.issues,
223
- response: response ?? null
224
- });
225
- return result.value;
226
- };
227
- const routeKeyMethods = defineEnum([
228
- "delete",
229
- "get",
230
- "patch",
231
- "post",
232
- "put"
233
- ]);
234
- const handleSchemaValidation = async (fullSchema, schemaName, validationOptions) => {
235
- const { inputValue, response, schemaConfig } = validationOptions;
236
- if (schemaConfig?.disableRuntimeValidation) return inputValue;
237
- return await standardSchemaParser(fullSchema, schemaName, inputValue, response);
238
- };
239
- const extraOptionsToBeValidated = [
240
- "meta",
241
- "params",
242
- "query"
243
- ];
244
- const handleExtraOptionsValidation = async (validationOptions) => {
245
- const { options, schema, schemaConfig } = validationOptions;
246
- const validationResultArray = await Promise.all(extraOptionsToBeValidated.map((schemaName) => handleSchemaValidation(schema, schemaName, {
247
- inputValue: options[schemaName],
248
- schemaConfig
249
- })));
250
- const validatedResultObject = {};
251
- for (const [index, schemaName] of extraOptionsToBeValidated.entries()) {
252
- const validationResult = validationResultArray[index];
253
- if (validationResult === void 0) continue;
254
- validatedResultObject[schemaName] = validationResult;
255
- }
256
- return validatedResultObject;
257
- };
258
- const requestOptionsToBeValidated = [
259
- "body",
260
- "headers",
261
- "method"
262
- ];
263
- const handleRequestOptionsValidation = async (validationOptions) => {
264
- const { requestOptions, schema, schemaConfig } = validationOptions;
265
- const validationResultArray = await Promise.all(requestOptionsToBeValidated.map((schemaName) => handleSchemaValidation(schema, schemaName, {
266
- inputValue: requestOptions[schemaName],
267
- schemaConfig
268
- })));
269
- const validatedResultObject = {};
270
- for (const [index, propertyKey] of requestOptionsToBeValidated.entries()) {
271
- const validationResult = validationResultArray[index];
272
- if (validationResult === void 0) continue;
273
- validatedResultObject[propertyKey] = validationResult;
274
- }
275
- return validatedResultObject;
276
- };
277
- const handleConfigValidation = async (validationOptions) => {
278
- const { baseExtraOptions, currentRouteSchemaKey, extraOptions, options, requestOptions } = validationOptions;
279
- const { currentRouteSchema, resolvedSchema } = getResolvedSchema({
280
- baseExtraOptions,
281
- currentRouteSchemaKey,
282
- extraOptions
283
- });
284
- const resolvedSchemaConfig = getResolvedSchemaConfig({
285
- baseExtraOptions,
286
- extraOptions
287
- });
288
- if (resolvedSchemaConfig?.strict === true && !currentRouteSchema) throw new ValidationError({
289
- issueCause: "schemaConfig-(strict)",
290
- issues: [{ message: `Strict Mode - No schema found for route '${currentRouteSchemaKey}' ` }],
291
- response: null
292
- });
293
- if (resolvedSchemaConfig?.disableRuntimeValidation) return {
294
- extraOptionsValidationResult: null,
295
- requestOptionsValidationResult: null,
296
- resolvedSchema,
297
- resolvedSchemaConfig,
298
- shouldApplySchemaOutput: false
299
- };
300
- const [extraOptionsValidationResult, requestOptionsValidationResult] = await Promise.all([handleExtraOptionsValidation({
301
- options,
302
- schema: resolvedSchema,
303
- schemaConfig: resolvedSchemaConfig
304
- }), handleRequestOptionsValidation({
305
- requestOptions,
306
- schema: resolvedSchema,
307
- schemaConfig: resolvedSchemaConfig
308
- })]);
309
- return {
310
- extraOptionsValidationResult,
311
- requestOptionsValidationResult,
312
- resolvedSchema,
313
- resolvedSchemaConfig,
314
- shouldApplySchemaOutput: (Boolean(extraOptionsValidationResult) || Boolean(requestOptionsValidationResult)) && !resolvedSchemaConfig?.disableValidationOutputApplication
315
- };
316
- };
317
- const fallBackRouteSchemaKey = ".";
318
- const getResolvedSchema = (context) => {
319
- const { baseExtraOptions, currentRouteSchemaKey, extraOptions } = context;
320
- const fallbackRouteSchema = baseExtraOptions.schema?.routes[fallBackRouteSchemaKey];
321
- const currentRouteSchema = baseExtraOptions.schema?.routes[currentRouteSchemaKey];
322
- const resolvedRouteSchema = {
323
- ...fallbackRouteSchema,
324
- ...currentRouteSchema
325
- };
326
- return {
327
- currentRouteSchema,
328
- resolvedSchema: isFunction(extraOptions.schema) ? extraOptions.schema({
329
- baseSchemaRoutes: baseExtraOptions.schema?.routes ?? {},
330
- currentRouteSchema: resolvedRouteSchema ?? {}
331
- }) : extraOptions.schema ?? resolvedRouteSchema
332
- };
333
- };
334
- const getResolvedSchemaConfig = (context) => {
335
- const { baseExtraOptions, extraOptions } = context;
336
- return isFunction(extraOptions.schemaConfig) ? extraOptions.schemaConfig({ baseSchemaConfig: baseExtraOptions.schema?.config ?? {} }) : extraOptions.schemaConfig ?? baseExtraOptions.schema?.config;
337
- };
338
- const getCurrentRouteSchemaKeyAndMainInitURL = (context) => {
339
- const { baseExtraOptions, extraOptions, initURL } = context;
340
- const schemaConfig = getResolvedSchemaConfig({
341
- baseExtraOptions,
342
- extraOptions
343
- });
344
- let currentRouteSchemaKey = initURL;
345
- let mainInitURL = initURL;
346
- if (schemaConfig?.prefix && currentRouteSchemaKey.startsWith(schemaConfig.prefix)) {
347
- currentRouteSchemaKey = currentRouteSchemaKey.replace(schemaConfig.prefix, "");
348
- mainInitURL = mainInitURL.replace(schemaConfig.prefix, schemaConfig.baseURL ?? "");
349
- }
350
- if (schemaConfig?.baseURL && currentRouteSchemaKey.startsWith(schemaConfig.baseURL)) currentRouteSchemaKey = currentRouteSchemaKey.replace(schemaConfig.baseURL, "");
351
- return {
352
- currentRouteSchemaKey,
353
- mainInitURL
354
- };
355
- };
356
-
357
- //#endregion
358
- //#region src/url.ts
359
- const slash = "/";
360
- const colon = ":";
361
- const openBrace = "{";
362
- const closeBrace = "}";
363
- const mergeUrlWithParams = (url, params) => {
364
- if (!params) return url;
365
- let newUrl = url;
366
- if (isArray(params)) {
367
- const matchedParamsArray = newUrl.split(slash).filter((part) => part.startsWith(colon) || part.startsWith(openBrace) && part.endsWith(closeBrace));
368
- for (const [paramIndex, matchedParam] of matchedParamsArray.entries()) {
369
- const stringParamValue = String(params[paramIndex]);
370
- newUrl = newUrl.replace(matchedParam, stringParamValue);
371
- }
372
- return newUrl;
373
- }
374
- for (const [paramKey, paramValue] of Object.entries(params)) {
375
- const colonPattern = `${colon}${paramKey}`;
376
- const bracePattern = `${openBrace}${paramKey}${closeBrace}`;
377
- const stringValue = String(paramValue);
378
- newUrl = newUrl.replace(colonPattern, stringValue);
379
- newUrl = newUrl.replace(bracePattern, stringValue);
380
- }
381
- return newUrl;
382
- };
383
- const questionMark = "?";
384
- const ampersand = "&";
385
- const mergeUrlWithQuery = (url, query) => {
386
- if (!query) return url;
387
- const queryString = toQueryString(query);
388
- if (queryString?.length === 0) return url;
389
- if (url.endsWith(questionMark)) return `${url}${queryString}`;
390
- if (url.includes(questionMark)) return `${url}${ampersand}${queryString}`;
391
- return `${url}${questionMark}${queryString}`;
392
- };
393
- /**
394
- * @description Extracts the HTTP method from method-prefixed route patterns.
395
- *
396
- * Analyzes URLs that start with method modifiers (e.g., "@get/", "@post/") and extracts
397
- * the HTTP method for use in API requests. This enables method specification directly
398
- * in route definitions.
399
- *
400
- * @param initURL - The URL string to analyze for method modifiers
401
- * @returns The extracted HTTP method (lowercase) if found, otherwise undefined
402
- *
403
- * @example
404
- * ```typescript
405
- * // Method extraction from prefixed routes
406
- * extractMethodFromURL("@get/users"); // Returns: "get"
407
- * extractMethodFromURL("@post/users"); // Returns: "post"
408
- * extractMethodFromURL("@put/users/:id"); // Returns: "put"
409
- * extractMethodFromURL("@delete/users/:id"); // Returns: "delete"
410
- * extractMethodFromURL("@patch/users/:id"); // Returns: "patch"
411
- *
412
- * // No method modifier
413
- * extractMethodFromURL("/users"); // Returns: undefined
414
- * extractMethodFromURL("users"); // Returns: undefined
415
- *
416
- * // Invalid or unsupported methods
417
- * extractMethodFromURL("@invalid/users"); // Returns: undefined
418
- * extractMethodFromURL("@/users"); // Returns: undefined
419
- *
420
- * // Edge cases
421
- * extractMethodFromURL(undefined); // Returns: undefined
422
- * extractMethodFromURL(""); // Returns: undefined
423
- * ```
424
- */
425
- const extractMethodFromURL = (initURL) => {
426
- if (!initURL?.startsWith("@")) return;
427
- const method = initURL.split("@")[1]?.split("/")[0];
428
- if (!method || !routeKeyMethods.includes(method)) return;
429
- return method;
430
- };
431
- const normalizeURL = (initURL) => {
432
- const methodFromURL = extractMethodFromURL(initURL);
433
- if (!methodFromURL) return initURL;
434
- return initURL.replace(`@${methodFromURL}/`, "/");
435
- };
436
- const getFullAndNormalizedURL = (options) => {
437
- const { baseURL, initURL, params, query } = options;
438
- const normalizedInitURL = normalizeURL(initURL);
439
- const urlWithMergedQueryAndParams = mergeUrlWithQuery(mergeUrlWithParams(normalizedInitURL, params), query);
440
- return {
441
- fullURL: !urlWithMergedQueryAndParams.startsWith("http") && baseURL ? `${baseURL}${urlWithMergedQueryAndParams}` : urlWithMergedQueryAndParams,
442
- normalizedInitURL
443
- };
444
- };
445
-
446
- //#endregion
447
- //#region src/utils/polyfills/combinedSignal.ts
448
- const createCombinedSignalPolyfill = (signals) => {
449
- const controller = new AbortController();
450
- const handleAbort = (actualSignal) => {
451
- if (controller.signal.aborted) return;
452
- controller.abort(actualSignal.reason);
453
- };
454
- for (const actualSignal of signals) {
455
- if (actualSignal.aborted) {
456
- handleAbort(actualSignal);
457
- break;
458
- }
459
- actualSignal.addEventListener("abort", () => handleAbort(actualSignal), { signal: controller.signal });
460
- }
461
- return controller.signal;
462
- };
463
-
464
- //#endregion
465
- //#region src/utils/polyfills/timeoutSignal.ts
466
- const createTimeoutSignalPolyfill = (milliseconds) => {
467
- const controller = new AbortController();
468
- const reason = new DOMException("Request timed out", "TimeoutError");
469
- const timeout = setTimeout(() => controller.abort(reason), milliseconds);
470
- controller.signal.addEventListener("abort", () => clearTimeout(timeout));
471
- return controller.signal;
472
- };
473
-
474
- //#endregion
475
- //#region src/utils/common.ts
476
- const omitKeys = (initialObject, keysToOmit) => {
477
- const updatedObject = {};
478
- const keysToOmitSet = new Set(keysToOmit);
479
- for (const [key, value] of Object.entries(initialObject)) if (!keysToOmitSet.has(key)) updatedObject[key] = value;
480
- return updatedObject;
481
- };
482
- const pickKeys = (initialObject, keysToPick) => {
483
- const updatedObject = {};
484
- const keysToPickSet = new Set(keysToPick);
485
- for (const [key, value] of Object.entries(initialObject)) if (keysToPickSet.has(key)) updatedObject[key] = value;
486
- return updatedObject;
487
- };
488
- const splitBaseConfig = (baseConfig) => [pickKeys(baseConfig, fetchSpecificKeys), omitKeys(baseConfig, fetchSpecificKeys)];
489
- const splitConfig = (config) => [pickKeys(config, fetchSpecificKeys), omitKeys(config, fetchSpecificKeys)];
490
- const toQueryString = (params) => {
491
- if (!params) {
492
- console.error("toQueryString:", "No query params provided!");
493
- return null;
494
- }
495
- return new URLSearchParams(params).toString();
496
- };
497
- const objectifyHeaders = (headers) => {
498
- if (!headers || isPlainObject(headers)) return headers;
499
- return Object.fromEntries(headers);
500
- };
501
- const getHeaders = async (options) => {
502
- const { auth, body, headers } = options;
503
- if (!(Boolean(headers) || Boolean(body) || Boolean(auth))) return;
504
- const headersObject = {
505
- ...await getAuthHeader(auth),
506
- ...objectifyHeaders(headers)
507
- };
508
- if (isQueryString(body)) {
509
- headersObject["Content-Type"] = "application/x-www-form-urlencoded";
510
- return headersObject;
511
- }
512
- if (isSerializable(body) || isValidJsonString(body)) {
513
- headersObject["Content-Type"] = "application/json";
514
- headersObject.Accept = "application/json";
515
- }
516
- return headersObject;
517
- };
518
- const getMethod = (ctx) => {
519
- const { initURL, method } = ctx;
520
- return method?.toUpperCase() ?? extractMethodFromURL(initURL)?.toUpperCase() ?? requestOptionDefaults.method;
521
- };
522
- const getBody = (options) => {
523
- const { body, bodySerializer } = options;
524
- if (isSerializable(body)) return (bodySerializer ?? extraOptionDefaults.bodySerializer)(body);
525
- return body;
526
- };
527
- const getInitFetchImpl = (customFetchImpl) => {
528
- if (customFetchImpl) return customFetchImpl;
529
- if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) return globalThis.fetch;
530
- throw new Error("No fetch implementation found");
531
- };
532
- const getFetchImpl = (context) => {
533
- const { customFetchImpl, fetchMiddleware, requestContext } = context;
534
- const initFetchImpl = getInitFetchImpl(customFetchImpl);
535
- return fetchMiddleware ? fetchMiddleware({
536
- ...requestContext,
537
- fetchImpl: initFetchImpl
538
- }) : initFetchImpl;
539
- };
540
- const PromiseWithResolvers = () => {
541
- let reject;
542
- let resolve;
543
- return {
544
- promise: new Promise((res, rej) => {
545
- resolve = res;
546
- reject = rej;
547
- }),
548
- reject,
549
- resolve
550
- };
551
- };
552
- const waitFor = (delay) => {
553
- if (delay === 0) return;
554
- const { promise, resolve } = PromiseWithResolvers();
555
- setTimeout(resolve, delay);
556
- return promise;
557
- };
558
- const createCombinedSignal = (...signals) => {
559
- const cleanedSignals = signals.filter((signal) => signal != null);
560
- if (!("any" in AbortSignal)) return createCombinedSignalPolyfill(cleanedSignals);
561
- return AbortSignal.any(cleanedSignals);
562
- };
563
- const createTimeoutSignal = (milliseconds) => {
564
- if (!("timeout" in AbortSignal)) return createTimeoutSignalPolyfill(milliseconds);
565
- return AbortSignal.timeout(milliseconds);
566
- };
567
- const deterministicHashFn = (value) => {
568
- return JSON.stringify(value, (_, val) => {
569
- if (!isPlainObject(val)) return val;
570
- const sortedKeys = Object.keys(val).toSorted();
571
- const result = {};
572
- for (const key of sortedKeys) result[key] = val[key];
573
- return result;
574
- });
575
- };
576
- const toArray = (value) => isArray(value) ? value : [value];
577
-
578
- //#endregion
579
- export { HTTPError, ValidationError, createCombinedSignal, createTimeoutSignal, deterministicHashFn, extraOptionDefaults, fallBackRouteSchemaKey, getBody, getCurrentRouteSchemaKeyAndMainInitURL, getFetchImpl, getFullAndNormalizedURL, getHeaders, getMethod, handleConfigValidation, handleSchemaValidation, isArray, isBoolean, isFunction, isHTTPError, isHTTPErrorInstance, isJavascriptError, isObject, isPlainObject, isReadableStream, isString, isValidationError, isValidationErrorInstance, splitBaseConfig, splitConfig, toQueryString, waitFor };
580
- //# sourceMappingURL=common-CfCB_X1k.js.map