@engervall/shared
Advanced tools
Comparing version 1.0.11-bdbf779.0 to 1.0.11-f50712f.0
@@ -11,2 +11,1 @@ "use strict"; | ||
]); | ||
//# sourceMappingURL=external-error-codes.js.map |
@@ -21,2 +21,1 @@ "use strict"; | ||
__exportStar(require("./unknown-error-data"), exports); | ||
//# sourceMappingURL=index.js.map |
import { z } from 'zod'; | ||
declare const _zSortOrder: z.ZodObject<{ | ||
/** | ||
* [new, ..., old] | ||
*/ | ||
DESC: z.ZodLiteral<"DESC">; | ||
/** | ||
* [old, ..., new] | ||
*/ | ||
ASC: z.ZodLiteral<"ASC">; | ||
@@ -23,6 +17,3 @@ }, "strip", z.ZodTypeAny, { | ||
export type SortOrder = keyof typeof SortOrder; | ||
/** | ||
* [new, ..., old] | ||
*/ | ||
export declare const DefaultSortOrder: "DESC"; | ||
export {}; |
@@ -6,9 +6,3 @@ "use strict"; | ||
const _zSortOrder = zod_1.z.object({ | ||
/** | ||
* [new, ..., old] | ||
*/ | ||
DESC: zod_1.z.literal('DESC'), | ||
/** | ||
* [old, ..., new] | ||
*/ | ||
ASC: zod_1.z.literal('ASC'), | ||
@@ -18,15 +12,5 @@ }); | ||
exports.SortOrder = { | ||
/** | ||
* [new, ..., old] | ||
*/ | ||
DESC: 'DESC', | ||
/** | ||
* [old, ..., new] | ||
*/ | ||
ASC: 'ASC', | ||
}; | ||
/** | ||
* [new, ..., old] | ||
*/ | ||
exports.DefaultSortOrder = exports.SortOrder.DESC; | ||
//# sourceMappingURL=sort.js.map |
@@ -11,2 +11,1 @@ "use strict"; | ||
exports.ONE_DAY_IN_MS = exports.ONE_HOUR_IN_MS * 24; | ||
//# sourceMappingURL=time.js.map |
@@ -9,2 +9,1 @@ "use strict"; | ||
]); | ||
//# sourceMappingURL=unknown-error-data.js.map |
@@ -21,2 +21,1 @@ "use strict"; | ||
__exportStar(require("./zods"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,2 +18,1 @@ "use strict"; | ||
__exportStar(require("./utility-types"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=utility-types.js.map |
@@ -1,4 +0,1 @@ | ||
/** | ||
* Deduplicates an array | ||
*/ | ||
export declare function arrayDedup<T>(array?: Array<T>): Array<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.arrayDedup = arrayDedup; | ||
/** | ||
* Deduplicates an array | ||
*/ | ||
function arrayDedup(array) { | ||
@@ -13,2 +10,1 @@ if (!array || !Array.isArray(array)) { | ||
} | ||
//# sourceMappingURL=array-dedup.js.map |
@@ -10,3 +10,2 @@ "use strict"; | ||
it('should return an empty array if input is not an array', () => { | ||
// TypeScript should prevent this from happening, but just in case... | ||
const result = (0, array_dedup_1.arrayDedup)('not an array'); | ||
@@ -31,2 +30,1 @@ expect(result).toEqual([]); | ||
}); | ||
//# sourceMappingURL=array-dedup.test.js.map |
@@ -1,6 +0,1 @@ | ||
/** | ||
* A type safe way to pick an item from an array. | ||
* | ||
* Without this, TypeScript won't include `undefined` as a possible return value. | ||
*/ | ||
export declare function arrayPickAt<T>(array: T[] | null | undefined, index: number): T | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.arrayPickAt = arrayPickAt; | ||
/** | ||
* A type safe way to pick an item from an array. | ||
* | ||
* Without this, TypeScript won't include `undefined` as a possible return value. | ||
*/ | ||
function arrayPickAt(array = [], index) { | ||
@@ -15,2 +10,1 @@ if (!Array.isArray(array)) { | ||
} | ||
//# sourceMappingURL=array-pick-at.js.map |
@@ -24,3 +24,2 @@ "use strict"; | ||
it('should return undefined if the input is not an array', () => { | ||
// TypeScript should prevent this from happening, but just in case... | ||
const array = 'not an array'; | ||
@@ -44,2 +43,1 @@ const index = 0; | ||
}); | ||
//# sourceMappingURL=array-pick-at.test.js.map |
@@ -1,19 +0,8 @@ | ||
/** | ||
* Supported locale values. Use `false` to ignore locale. | ||
* Defaults to `undefined`, which uses the host environment. | ||
*/ | ||
export type Locale = string[] | string | false | undefined; | ||
/** | ||
* Options used for converting strings to pascal/camel case. | ||
*/ | ||
export interface PascalCaseOptions extends Options { | ||
mergeAmbiguousCharacters?: boolean; | ||
} | ||
/** | ||
* Options used for converting strings to any case. | ||
*/ | ||
export interface Options { | ||
locale?: Locale; | ||
split?: (value: string) => string[]; | ||
/** @deprecated Pass `split: splitSeparateNumbers` instead. */ | ||
separateNumbers?: boolean; | ||
@@ -24,57 +13,15 @@ delimiter?: string; | ||
} | ||
/** | ||
* Split any cased input strings into an array of words. | ||
*/ | ||
export declare function split(value: string): string[]; | ||
/** | ||
* Split the input string into an array of words, separating numbers. | ||
*/ | ||
export declare function splitSeparateNumbers(value: string): string[]; | ||
/** | ||
* Convert a string to space separated lower case (`foo bar`). | ||
*/ | ||
export declare function noCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to camel case (`fooBar`). | ||
*/ | ||
export declare function camelCase(input: string, options?: PascalCaseOptions): string; | ||
/** | ||
* Convert a string to pascal case (`FooBar`). | ||
*/ | ||
export declare function pascalCase(input: string, options?: PascalCaseOptions): string; | ||
/** | ||
* Convert a string to pascal snake case (`Foo_Bar`). | ||
*/ | ||
export declare function pascalSnakeCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to capital case (`Foo Bar`). | ||
*/ | ||
export declare function capitalCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to constant case (`FOO_BAR`). | ||
*/ | ||
export declare function constantCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to dot case (`foo.bar`). | ||
*/ | ||
export declare function dotCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to kebab case (`foo-bar`). | ||
*/ | ||
export declare function kebabCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to path case (`foo/bar`). | ||
*/ | ||
export declare function pathCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to path case (`Foo bar`). | ||
*/ | ||
export declare function sentenceCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to snake case (`foo_bar`). | ||
*/ | ||
export declare function snakeCase(input: string, options?: Options): string; | ||
/** | ||
* Convert a string to header case (`Foo-Bar`). | ||
*/ | ||
export declare function trainCase(input: string, options?: Options): string; |
@@ -17,16 +17,8 @@ "use strict"; | ||
exports.trainCase = trainCase; | ||
// Regexps involved with splitting words in various case formats. | ||
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu; | ||
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu; | ||
// Used to iterate over the initial split result and separate numbers. | ||
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u; | ||
// Regexp involved with stripping non-word characters from the result. | ||
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu; | ||
// The replacement value for splits. | ||
const SPLIT_REPLACE_VALUE = '$1\0$2'; | ||
// The default characters to keep after transforming case. | ||
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = ''; | ||
/** | ||
* Split any cased input strings into an array of words. | ||
*/ | ||
function split(value) { | ||
@@ -40,3 +32,2 @@ let result = value.trim(); | ||
let end = result.length; | ||
// Trim the delimiter from around the output string. | ||
while (result.charAt(start) === '\0') { | ||
@@ -53,5 +44,2 @@ start++; | ||
} | ||
/** | ||
* Split the input string into an array of words, separating numbers. | ||
*/ | ||
function splitSeparateNumbers(value) { | ||
@@ -70,5 +58,2 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to space separated lower case (`foo bar`). | ||
*/ | ||
function noCase(input, options) { | ||
@@ -81,5 +66,2 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to camel case (`fooBar`). | ||
*/ | ||
function camelCase(input, options) { | ||
@@ -104,5 +86,2 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to pascal case (`FooBar`). | ||
*/ | ||
function pascalCase(input, options) { | ||
@@ -118,11 +97,5 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to pascal snake case (`Foo_Bar`). | ||
*/ | ||
function pascalSnakeCase(input, options) { | ||
return capitalCase(input, Object.assign({ delimiter: '_' }, options)); | ||
} | ||
/** | ||
* Convert a string to capital case (`Foo Bar`). | ||
*/ | ||
function capitalCase(input, options) { | ||
@@ -139,5 +112,2 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to constant case (`FOO_BAR`). | ||
*/ | ||
function constantCase(input, options) { | ||
@@ -150,23 +120,11 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to dot case (`foo.bar`). | ||
*/ | ||
function dotCase(input, options) { | ||
return noCase(input, Object.assign({ delimiter: '.' }, options)); | ||
} | ||
/** | ||
* Convert a string to kebab case (`foo-bar`). | ||
*/ | ||
function kebabCase(input, options) { | ||
return noCase(input, Object.assign({ delimiter: '-' }, options)); | ||
} | ||
/** | ||
* Convert a string to path case (`foo/bar`). | ||
*/ | ||
function pathCase(input, options) { | ||
return noCase(input, Object.assign({ delimiter: '/' }, options)); | ||
} | ||
/** | ||
* Convert a string to path case (`Foo bar`). | ||
*/ | ||
function sentenceCase(input, options) { | ||
@@ -189,11 +147,5 @@ var _a; | ||
} | ||
/** | ||
* Convert a string to snake case (`foo_bar`). | ||
*/ | ||
function snakeCase(input, options) { | ||
return noCase(input, Object.assign({ delimiter: '_' }, options)); | ||
} | ||
/** | ||
* Convert a string to header case (`Foo-Bar`). | ||
*/ | ||
function trainCase(input, options) { | ||
@@ -250,2 +202,1 @@ return capitalCase(input, Object.assign({ delimiter: '-' }, options)); | ||
} | ||
//# sourceMappingURL=change-case.js.map |
@@ -39,2 +39,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=change-case.test.js.map |
@@ -14,2 +14,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=create-alt-from-src.js.map |
import { z } from 'zod'; | ||
type CustomZodErrorMapOptions = { | ||
/** | ||
* Append the input data to the default error message. | ||
*/ | ||
appendInputData?: boolean; | ||
}; | ||
/** | ||
* Create a custom ZodErrorMap with options to append input data to the default error message. | ||
* | ||
* `customZodErrorMap` can also be used in individual parsings, for example: | ||
* `Person.safeParse(person, { errorMap: customZodErrorMap() });` | ||
*/ | ||
export declare function customZodErrorMap(customZodErrorMapOptions?: CustomZodErrorMapOptions): z.ZodErrorMap; | ||
/** | ||
* There can only be one global ZodErrorMap set at any one time. | ||
* | ||
* Using this function will set the global ZodErrorMap to `customZodErrorMap`. | ||
* | ||
* The default ZodErrorMap can still be used in individual parsings, for example: | ||
* `Person.safeParse(person, { errorMap: z.defaultErrorMap });` | ||
*/ | ||
export declare function setGlobalCustomZodErrorMap(options?: CustomZodErrorMapOptions): void; | ||
/** | ||
* There can only be one global ZodErrorMap set at any one time. | ||
* | ||
* Using this function will reset the global ZodErrorMap to `z.defaultErrorMap`, | ||
* essentially overriding the previous global ZodErrorMap. | ||
*/ | ||
export declare function resetGlobalCustomZodErrorMap(): void; | ||
export {}; |
@@ -10,8 +10,2 @@ "use strict"; | ||
}; | ||
/** | ||
* Create a custom ZodErrorMap with options to append input data to the default error message. | ||
* | ||
* `customZodErrorMap` can also be used in individual parsings, for example: | ||
* `Person.safeParse(person, { errorMap: customZodErrorMap() });` | ||
*/ | ||
function customZodErrorMap(customZodErrorMapOptions = DEFAULT_CUSTOM_ZOD_ERROR_MAP_OPTIONS) { | ||
@@ -29,22 +23,7 @@ return (_issue, ctx) => { | ||
} | ||
/** | ||
* There can only be one global ZodErrorMap set at any one time. | ||
* | ||
* Using this function will set the global ZodErrorMap to `customZodErrorMap`. | ||
* | ||
* The default ZodErrorMap can still be used in individual parsings, for example: | ||
* `Person.safeParse(person, { errorMap: z.defaultErrorMap });` | ||
*/ | ||
function setGlobalCustomZodErrorMap(options = DEFAULT_CUSTOM_ZOD_ERROR_MAP_OPTIONS) { | ||
zod_1.z.setErrorMap(customZodErrorMap(options)); | ||
} | ||
/** | ||
* There can only be one global ZodErrorMap set at any one time. | ||
* | ||
* Using this function will reset the global ZodErrorMap to `z.defaultErrorMap`, | ||
* essentially overriding the previous global ZodErrorMap. | ||
*/ | ||
function resetGlobalCustomZodErrorMap() { | ||
zod_1.z.setErrorMap(zod_1.z.defaultErrorMap); | ||
} | ||
//# sourceMappingURL=custom-zod-error-map.js.map |
@@ -10,22 +10,14 @@ "use strict"; | ||
it('should set the custom zod error map', () => { | ||
// with default error map | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
// with custom error map | ||
(0, custom_zod_error_map_1.setGlobalCustomZodErrorMap)(); | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
// reset -> back to default error map | ||
(0, custom_zod_error_map_1.resetGlobalCustomZodErrorMap)(); | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
// with custom error map (without data) | ||
(0, custom_zod_error_map_1.setGlobalCustomZodErrorMap)({ appendInputData: false }); | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
// reset -> back to default error map | ||
(0, custom_zod_error_map_1.resetGlobalCustomZodErrorMap)(); | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
// with custom error map (with data) | ||
expect(() => Person.parse({ name: 123 }, { errorMap: (0, custom_zod_error_map_1.customZodErrorMap)({ appendInputData: true }) })).toThrowErrorMatchingSnapshot(); | ||
// the custom error map should not be set globally | ||
expect(() => Person.parse({ name: 123 })).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=custom-zod-error-map.test.js.map |
@@ -1,9 +0,3 @@ | ||
/** | ||
* Returns a string representation of the execution time. | ||
* | ||
* @example executionTime(105) => '105ms', | ||
* @example executionTime(1005) => '1005ms (1.0s)' | ||
*/ | ||
export declare function executionTime(perf_start: number): { | ||
executionTime: string; | ||
}; |
@@ -5,8 +5,2 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
/** | ||
* Returns a string representation of the execution time. | ||
* | ||
* @example executionTime(105) => '105ms', | ||
* @example executionTime(1005) => '1005ms (1.0s)' | ||
*/ | ||
function executionTime(perf_start) { | ||
@@ -17,3 +11,2 @@ const end = performance.now(); | ||
if (durationMs < constants_1.ONE_SECOND_IN_MS) { | ||
// round to 0 decimal, format in milliseconds -> 2ms | ||
return { | ||
@@ -25,3 +18,2 @@ executionTime: `${ms}ms`, | ||
if (durationMs < constants_1.ONE_MINUTE_IN_MS) { | ||
// round to 1 decimal, format in seconds -> 2.1s | ||
return { | ||
@@ -34,6 +26,4 @@ executionTime: `${ms}ms (${s}s)`, | ||
return { | ||
// round to 1 decimal, format in minutes -> 2.1m 2.1s | ||
executionTime: `${ms}ms (${m}m ${sRemaining}s)`, | ||
}; | ||
} | ||
//# sourceMappingURL=execution-time.js.map |
@@ -24,2 +24,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=execution-time.test.js.map |
@@ -30,2 +30,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=extract-error-details.js.map |
@@ -81,2 +81,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=extract-error-details.test.js.map |
import type { ZodError } from 'zod'; | ||
/** | ||
* Format a ZodError into a string with a newline per issue | ||
* | ||
* Completely missing fields in an object will be output as `Required at "path.to.field"` | ||
* | ||
* There's a hard limit of 100 issues in the message, so if you have more than 100 issues, you'll get a truncated message. | ||
*/ | ||
export declare function formatZodError(zodError: ZodError, | ||
/** | ||
* The Zod model's name, E.g. "Person". | ||
*/ | ||
modelName: string): string; | ||
export declare function formatZodError(zodError: ZodError, modelName: string): string; |
@@ -5,14 +5,3 @@ "use strict"; | ||
const zod_validation_error_1 = require("zod-validation-error"); | ||
/** | ||
* Format a ZodError into a string with a newline per issue | ||
* | ||
* Completely missing fields in an object will be output as `Required at "path.to.field"` | ||
* | ||
* There's a hard limit of 100 issues in the message, so if you have more than 100 issues, you'll get a truncated message. | ||
*/ | ||
function formatZodError(zodError, | ||
/** | ||
* The Zod model's name, E.g. "Person". | ||
*/ | ||
modelName) { | ||
function formatZodError(zodError, modelName) { | ||
const { message, name } = (0, zod_validation_error_1.fromZodError)(zodError, { | ||
@@ -28,2 +17,1 @@ issueSeparator: '\n', | ||
} | ||
//# sourceMappingURL=format-zod-error.js.map |
@@ -70,2 +70,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=format-zod-error.test.js.map |
@@ -17,2 +17,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=get-filename-from-error-stack.js.map |
@@ -38,2 +38,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=get-filename-from-error-stack.test.js.map |
@@ -1,4 +0,1 @@ | ||
/** | ||
* Gets a random number between minNumber and maxNumber (both included) | ||
*/ | ||
export declare function getRandomNumber({ inclusiveFrom, inclusiveTo, }: { | ||
@@ -5,0 +2,0 @@ inclusiveFrom: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRandomNumber = getRandomNumber; | ||
/** | ||
* Gets a random number between minNumber and maxNumber (both included) | ||
*/ | ||
function getRandomNumber({ inclusiveFrom, inclusiveTo, }) { | ||
@@ -11,2 +8,1 @@ return (Math.floor(Math.random() * (inclusiveTo - inclusiveFrom + 1)) + | ||
} | ||
//# sourceMappingURL=get-random-number.js.map |
@@ -6,39 +6,39 @@ "use strict"; | ||
exports.HTTP_ERROR_STATUS_CODES = { | ||
400: 400, // BAD_REQUEST | ||
401: 401, // UNAUTHORIZED | ||
402: 402, // PAYMENT_REQUIRED | ||
403: 403, // FORBIDDEN | ||
404: 404, // NOT_FOUND | ||
405: 405, // METHOD_NOT_ALLOWED | ||
406: 406, // NOT_ACCEPTABLE | ||
407: 407, // PROXY_AUTHENTICATION_REQUIRED | ||
408: 408, // REQUEST_TIMEOUT | ||
409: 409, // CONFLICT | ||
410: 410, // GONE | ||
411: 411, // LENGTH_REQUIRED | ||
412: 412, // PRECONDITION_FAILED | ||
413: 413, // REQUEST_TOO_LONG | ||
414: 414, // REQUEST_URI_TOO_LONG | ||
415: 415, // UNSUPPORTED_MEDIA_TYPE | ||
416: 416, // REQUESTED_RANGE_NOT_SATISFIABLE | ||
417: 417, // EXPECTATION_FAILED | ||
418: 418, // IM_A_TEAPOT | ||
419: 419, // INSUFFICIENT_SPACE_ON_RESOURCE | ||
420: 420, // METHOD_FAILURE | ||
421: 421, // MISDIRECTED_REQUEST | ||
422: 422, // UNPROCESSABLE_ENTITY | ||
423: 423, // LOCKED | ||
424: 424, // FAILED_DEPENDENCY | ||
428: 428, // PRECONDITION_REQUIRED | ||
429: 429, // TOO_MANY_REQUESTS | ||
431: 431, // REQUEST_HEADER_FIELDS_TOO_LARGE | ||
451: 451, // UNAVAILABLE_FOR_LEGAL_REASONS | ||
500: 500, // INTERNAL_SERVER_ERROR | ||
501: 501, // NOT_IMPLEMENTED | ||
502: 502, // BAD_GATEWAY | ||
503: 503, // SERVICE_UNAVAILABLE | ||
504: 504, // GATEWAY_TIMEOUT | ||
505: 505, // HTTP_VERSION_NOT_SUPPORTED | ||
507: 507, // INSUFFICIENT_STORAGE | ||
511: 511, // NETWORK_AUTHENTICATION_REQUIRED | ||
400: 400, | ||
401: 401, | ||
402: 402, | ||
403: 403, | ||
404: 404, | ||
405: 405, | ||
406: 406, | ||
407: 407, | ||
408: 408, | ||
409: 409, | ||
410: 410, | ||
411: 411, | ||
412: 412, | ||
413: 413, | ||
414: 414, | ||
415: 415, | ||
416: 416, | ||
417: 417, | ||
418: 418, | ||
419: 419, | ||
420: 420, | ||
421: 421, | ||
422: 422, | ||
423: 423, | ||
424: 424, | ||
428: 428, | ||
429: 429, | ||
431: 431, | ||
451: 451, | ||
500: 500, | ||
501: 501, | ||
502: 502, | ||
503: 503, | ||
504: 504, | ||
505: 505, | ||
507: 507, | ||
511: 511, | ||
}; | ||
@@ -48,2 +48,1 @@ function isValidHttpStatusCode(value) { | ||
} | ||
//# sourceMappingURL=http-error-status-codes.js.map |
@@ -33,2 +33,1 @@ "use strict"; | ||
__exportStar(require("./upper-case-first-character-all-words"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=lowercase.js.map |
@@ -1,4 +0,1 @@ | ||
/** | ||
* A very naive implementation of deepclone | ||
*/ | ||
export declare function naiveDeepclone<T>(someObject: T): T; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.naiveDeepclone = naiveDeepclone; | ||
/** | ||
* A very naive implementation of deepclone | ||
*/ | ||
function naiveDeepclone(someObject) { | ||
return JSON.parse(JSON.stringify(someObject)); | ||
} | ||
//# sourceMappingURL=naive-deepclone.js.map |
@@ -30,2 +30,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=naive-deepclone.test.js.map |
@@ -1,349 +0,58 @@ | ||
/** | ||
* Maps an Http status code to its reason phrase. | ||
* | ||
* @example 500 -> 'Internal Server Error' | ||
*/ | ||
export declare const REASON_PHRASE_FOR_STATUS_CODE_MAP: { | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3 | ||
* | ||
* The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing. | ||
*/ | ||
readonly 202: "Accepted"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3 | ||
* | ||
* This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response. | ||
*/ | ||
readonly 502: "Bad Gateway"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1 | ||
* | ||
* This response means that server could not understand the request due to invalid syntax. | ||
*/ | ||
readonly 400: "Bad Request"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8 | ||
* | ||
* This response is sent when a request conflicts with the current state of the server. | ||
*/ | ||
readonly 409: "Conflict"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 | ||
* | ||
* This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished. | ||
*/ | ||
readonly 100: "Continue"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2 | ||
* | ||
* The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request. | ||
*/ | ||
readonly 201: "Created"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14 | ||
* | ||
* This response code means the expectation indicated by the Expect request header field can't be met by the server. | ||
*/ | ||
readonly 417: "Expectation Failed"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5 | ||
* | ||
* The request failed due to failure of a previous request. | ||
*/ | ||
readonly 424: "Failed Dependency"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3 | ||
* | ||
* The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server. | ||
*/ | ||
readonly 403: "Forbidden"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5 | ||
* | ||
* This error response is given when the server is acting as a gateway and cannot get a response in time. | ||
*/ | ||
readonly 504: "Gateway Timeout"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9 | ||
* | ||
* This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate resources that have been deleted with this status code. | ||
*/ | ||
readonly 410: "Gone"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6 | ||
* | ||
* The HTTP version used in the request is not supported by the server. | ||
*/ | ||
readonly 505: "HTTP Version Not Supported"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2 | ||
* | ||
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout. | ||
*/ | ||
readonly 418: "I'm a teapot"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6 | ||
* | ||
* The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action. | ||
*/ | ||
readonly 419: "Insufficient Space on Resource"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6 | ||
* | ||
* The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. | ||
*/ | ||
readonly 507: "Insufficient Storage"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1 | ||
* | ||
* The server encountered an unexpected condition that prevented it from fulfilling the request. | ||
*/ | ||
readonly 500: "Internal Server Error"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10 | ||
* | ||
* The server rejected the request because the Content-Length header field is not defined and the server requires it. | ||
*/ | ||
readonly 411: "Length Required"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4 | ||
* | ||
* The resource that is being accessed is locked. | ||
*/ | ||
readonly 423: "Locked"; | ||
/** | ||
* @deprecated | ||
* Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt | ||
* | ||
* A deprecated response used by the Spring Framework when a method has failed. | ||
*/ | ||
readonly 420: "Method Failure"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5 | ||
* | ||
* The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code. | ||
*/ | ||
readonly 405: "Method Not Allowed"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2 | ||
* | ||
* This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response. | ||
*/ | ||
readonly 301: "Moved Permanently"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3 | ||
* | ||
* This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests. | ||
*/ | ||
readonly 302: "Moved Temporarily"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2 | ||
* | ||
* A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate. | ||
*/ | ||
readonly 207: "Multi-Status"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1 | ||
* | ||
* The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses. | ||
*/ | ||
readonly 300: "Multiple Choices"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6 | ||
* | ||
* The 511 status code indicates that the client needs to authenticate to gain network access. | ||
*/ | ||
readonly 511: "Network Authentication Required"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5 | ||
* | ||
* There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones. | ||
*/ | ||
readonly 204: "No Content"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4 | ||
* | ||
* This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response. | ||
*/ | ||
readonly 203: "Non Authoritative Information"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6 | ||
* | ||
* This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent. | ||
*/ | ||
readonly 406: "Not Acceptable"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4 | ||
* | ||
* The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web. | ||
*/ | ||
readonly 404: "Not Found"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2 | ||
* | ||
* The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD. | ||
*/ | ||
readonly 501: "Not Implemented"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1 | ||
* | ||
* This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response. | ||
*/ | ||
readonly 304: "Not Modified"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1 | ||
* | ||
* The request has succeeded. The meaning of a success varies depending on the HTTP method: | ||
* GET: The resource has been fetched and is transmitted in the message body. | ||
* HEAD: The entity headers are in the message body. | ||
* POST: The resource describing the result of the action is transmitted in the message body. | ||
* TRACE: The message body contains the request message as received by the server | ||
*/ | ||
readonly 200: "OK"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1 | ||
* | ||
* This response code is used because of range header sent by the client to separate download into multiple streams. | ||
*/ | ||
readonly 206: "Partial Content"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2 | ||
* | ||
* This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently. | ||
*/ | ||
readonly 402: "Payment Required"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3 | ||
* | ||
* This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. | ||
*/ | ||
readonly 308: "Permanent Redirect"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2 | ||
* | ||
* The client has indicated preconditions in its headers which the server does not meet. | ||
*/ | ||
readonly 412: "Precondition Failed"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3 | ||
* | ||
* The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. | ||
*/ | ||
readonly 428: "Precondition Required"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1 | ||
* | ||
* This code indicates that the server has received and is processing the request, but no response is available yet. | ||
*/ | ||
readonly 102: "Processing"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2 | ||
* | ||
* This is similar to 401 but authentication is needed to be done by a proxy. | ||
*/ | ||
readonly 407: "Proxy Authentication Required"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5 | ||
* | ||
* The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. | ||
*/ | ||
readonly 431: "Request Header Fields Too Large"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7 | ||
* | ||
* This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message. | ||
*/ | ||
readonly 408: "Request Timeout"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11 | ||
* | ||
* Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. | ||
*/ | ||
readonly 413: "Request Entity Too Large"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12 | ||
* | ||
* The URI requested by the client is longer than the server is willing to interpret. | ||
*/ | ||
readonly 414: "Request-URI Too Long"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4 | ||
* | ||
* The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data. | ||
*/ | ||
readonly 416: "Requested Range Not Satisfiable"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6 | ||
* | ||
* This response code is sent after accomplishing request to tell user agent reset document view which sent this request. | ||
*/ | ||
readonly 205: "Reset Content"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4 | ||
* | ||
* Server sent this response to directing client to get requested resource to another URI with an GET request. | ||
*/ | ||
readonly 303: "See Other"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4 | ||
* | ||
* The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached. | ||
*/ | ||
readonly 503: "Service Unavailable"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2 | ||
* | ||
* This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too. | ||
*/ | ||
readonly 101: "Switching Protocols"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7 | ||
* | ||
* Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. | ||
*/ | ||
readonly 307: "Temporary Redirect"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4 | ||
* | ||
* The user has sent too many requests in a given amount of time ("rate limiting"). | ||
*/ | ||
readonly 429: "Too Many Requests"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1 | ||
* | ||
* Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. | ||
*/ | ||
readonly 401: "Unauthorized"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7725 | ||
* | ||
* The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government. | ||
*/ | ||
readonly 451: "Unavailable For Legal Reasons"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3 | ||
* | ||
* The request was well-formed but was unable to be followed due to semantic errors. | ||
*/ | ||
readonly 422: "Unprocessable Entity"; | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13 | ||
* | ||
* The media format of the requested data is not supported by the server, so the server is rejecting the request. | ||
*/ | ||
readonly 415: "Unsupported Media Type"; | ||
/** | ||
* @deprecated | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6 | ||
* | ||
* Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy. | ||
*/ | ||
readonly 305: "Use Proxy"; | ||
/** | ||
* Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2 | ||
* | ||
* Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI. | ||
*/ | ||
readonly 421: "Misdirected Request"; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.REASON_PHRASE_FOR_STATUS_CODE_MAP = void 0; | ||
/** | ||
* Maps an Http status code to its reason phrase. | ||
* | ||
* @example 500 -> 'Internal Server Error' | ||
*/ | ||
exports.REASON_PHRASE_FOR_STATUS_CODE_MAP = { | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3 | ||
* | ||
* The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing. | ||
*/ | ||
202: 'Accepted', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3 | ||
* | ||
* This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response. | ||
*/ | ||
502: 'Bad Gateway', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1 | ||
* | ||
* This response means that server could not understand the request due to invalid syntax. | ||
*/ | ||
400: 'Bad Request', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8 | ||
* | ||
* This response is sent when a request conflicts with the current state of the server. | ||
*/ | ||
409: 'Conflict', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 | ||
* | ||
* This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished. | ||
*/ | ||
100: 'Continue', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2 | ||
* | ||
* The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request. | ||
*/ | ||
201: 'Created', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14 | ||
* | ||
* This response code means the expectation indicated by the Expect request header field can't be met by the server. | ||
*/ | ||
417: 'Expectation Failed', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5 | ||
* | ||
* The request failed due to failure of a previous request. | ||
*/ | ||
424: 'Failed Dependency', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3 | ||
* | ||
* The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server. | ||
*/ | ||
403: 'Forbidden', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5 | ||
* | ||
* This error response is given when the server is acting as a gateway and cannot get a response in time. | ||
*/ | ||
504: 'Gateway Timeout', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9 | ||
* | ||
* This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate resources that have been deleted with this status code. | ||
*/ | ||
410: 'Gone', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6 | ||
* | ||
* The HTTP version used in the request is not supported by the server. | ||
*/ | ||
505: 'HTTP Version Not Supported', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2 | ||
* | ||
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout. | ||
*/ | ||
418: "I'm a teapot", | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6 | ||
* | ||
* The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action. | ||
*/ | ||
419: 'Insufficient Space on Resource', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6 | ||
* | ||
* The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. | ||
*/ | ||
507: 'Insufficient Storage', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1 | ||
* | ||
* The server encountered an unexpected condition that prevented it from fulfilling the request. | ||
*/ | ||
500: 'Internal Server Error', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10 | ||
* | ||
* The server rejected the request because the Content-Length header field is not defined and the server requires it. | ||
*/ | ||
411: 'Length Required', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4 | ||
* | ||
* The resource that is being accessed is locked. | ||
*/ | ||
423: 'Locked', | ||
/** | ||
* @deprecated | ||
* Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt | ||
* | ||
* A deprecated response used by the Spring Framework when a method has failed. | ||
*/ | ||
420: 'Method Failure', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5 | ||
* | ||
* The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code. | ||
*/ | ||
405: 'Method Not Allowed', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2 | ||
* | ||
* This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response. | ||
*/ | ||
301: 'Moved Permanently', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3 | ||
* | ||
* This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests. | ||
*/ | ||
302: 'Moved Temporarily', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2 | ||
* | ||
* A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate. | ||
*/ | ||
207: 'Multi-Status', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1 | ||
* | ||
* The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses. | ||
*/ | ||
300: 'Multiple Choices', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6 | ||
* | ||
* The 511 status code indicates that the client needs to authenticate to gain network access. | ||
*/ | ||
511: 'Network Authentication Required', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5 | ||
* | ||
* There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones. | ||
*/ | ||
204: 'No Content', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4 | ||
* | ||
* This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response. | ||
*/ | ||
203: 'Non Authoritative Information', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6 | ||
* | ||
* This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent. | ||
*/ | ||
406: 'Not Acceptable', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4 | ||
* | ||
* The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web. | ||
*/ | ||
404: 'Not Found', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2 | ||
* | ||
* The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD. | ||
*/ | ||
501: 'Not Implemented', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1 | ||
* | ||
* This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response. | ||
*/ | ||
304: 'Not Modified', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1 | ||
* | ||
* The request has succeeded. The meaning of a success varies depending on the HTTP method: | ||
* GET: The resource has been fetched and is transmitted in the message body. | ||
* HEAD: The entity headers are in the message body. | ||
* POST: The resource describing the result of the action is transmitted in the message body. | ||
* TRACE: The message body contains the request message as received by the server | ||
*/ | ||
200: 'OK', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1 | ||
* | ||
* This response code is used because of range header sent by the client to separate download into multiple streams. | ||
*/ | ||
206: 'Partial Content', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2 | ||
* | ||
* This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently. | ||
*/ | ||
402: 'Payment Required', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3 | ||
* | ||
* This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. | ||
*/ | ||
308: 'Permanent Redirect', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2 | ||
* | ||
* The client has indicated preconditions in its headers which the server does not meet. | ||
*/ | ||
412: 'Precondition Failed', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3 | ||
* | ||
* The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. | ||
*/ | ||
428: 'Precondition Required', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1 | ||
* | ||
* This code indicates that the server has received and is processing the request, but no response is available yet. | ||
*/ | ||
102: 'Processing', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2 | ||
* | ||
* This is similar to 401 but authentication is needed to be done by a proxy. | ||
*/ | ||
407: 'Proxy Authentication Required', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5 | ||
* | ||
* The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. | ||
*/ | ||
431: 'Request Header Fields Too Large', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7 | ||
* | ||
* This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message. | ||
*/ | ||
408: 'Request Timeout', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11 | ||
* | ||
* Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. | ||
*/ | ||
413: 'Request Entity Too Large', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12 | ||
* | ||
* The URI requested by the client is longer than the server is willing to interpret. | ||
*/ | ||
414: 'Request-URI Too Long', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4 | ||
* | ||
* The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data. | ||
*/ | ||
416: 'Requested Range Not Satisfiable', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6 | ||
* | ||
* This response code is sent after accomplishing request to tell user agent reset document view which sent this request. | ||
*/ | ||
205: 'Reset Content', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4 | ||
* | ||
* Server sent this response to directing client to get requested resource to another URI with an GET request. | ||
*/ | ||
303: 'See Other', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4 | ||
* | ||
* The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached. | ||
*/ | ||
503: 'Service Unavailable', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2 | ||
* | ||
* This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too. | ||
*/ | ||
101: 'Switching Protocols', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7 | ||
* | ||
* Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. | ||
*/ | ||
307: 'Temporary Redirect', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4 | ||
* | ||
* The user has sent too many requests in a given amount of time ("rate limiting"). | ||
*/ | ||
429: 'Too Many Requests', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1 | ||
* | ||
* Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. | ||
*/ | ||
401: 'Unauthorized', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7725 | ||
* | ||
* The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government. | ||
*/ | ||
451: 'Unavailable For Legal Reasons', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3 | ||
* | ||
* The request was well-formed but was unable to be followed due to semantic errors. | ||
*/ | ||
422: 'Unprocessable Entity', | ||
/** | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13 | ||
* | ||
* The media format of the requested data is not supported by the server, so the server is rejecting the request. | ||
*/ | ||
415: 'Unsupported Media Type', | ||
/** | ||
* @deprecated | ||
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6 | ||
* | ||
* Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy. | ||
*/ | ||
305: 'Use Proxy', | ||
/** | ||
* Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2 | ||
* | ||
* Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI. | ||
*/ | ||
421: 'Misdirected Request', | ||
}; | ||
//# sourceMappingURL=reason-phrase-for-status-code-map.js.map |
@@ -10,2 +10,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=truncate-string.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=upper-case-first-character-all-words.js.map |
@@ -7,2 +7,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=upper-case-first-character.js.map |
@@ -19,2 +19,1 @@ "use strict"; | ||
__exportStar(require("./z-ulid"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -8,11 +8,3 @@ "use strict"; | ||
.email() | ||
/** | ||
* In order to prevent Regular expression Denial of Service (ReDoS), | ||
* a user cannot provide an email that is more than 254 characters long. The max limit | ||
* comes from the RFC Errata Report: https://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690 | ||
*/ | ||
.max(254) | ||
/** | ||
* The refinement below helps us prevent emails which domain contains two subsequent dots. | ||
*/ | ||
.refine((e) => { | ||
@@ -23,2 +15,1 @@ var _a, _b; | ||
}); | ||
//# sourceMappingURL=z-email.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
describe('zEmail', () => { | ||
// ref: https://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses | ||
it.each([ | ||
@@ -24,3 +23,2 @@ 'email@example.com', | ||
}); | ||
// ref: https://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses | ||
it.each([ | ||
@@ -43,2 +41,1 @@ 'plainaddress', | ||
}); | ||
//# sourceMappingURL=z-email.test.js.map |
import { z } from 'zod'; | ||
/** | ||
* https://regex101.com/library/ik6xZx | ||
*/ | ||
export declare const ULID_REGEX: RegExp; | ||
export declare const zUlid: z.ZodString; |
@@ -5,14 +5,6 @@ "use strict"; | ||
const zod_1 = require("zod"); | ||
/** | ||
* https://regex101.com/library/ik6xZx | ||
*/ | ||
exports.ULID_REGEX = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/; | ||
exports.zUlid = zod_1.z | ||
.string() | ||
.length( | ||
/** | ||
* https://www.npmjs.com/package/ulid | ||
*/ | ||
26) | ||
.length(26) | ||
.regex(exports.ULID_REGEX); | ||
//# sourceMappingURL=z-ulid.js.map |
@@ -56,2 +56,1 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=z-ulid.test.js.map |
{ | ||
"name": "@engervall/shared", | ||
"version": "1.0.11-bdbf779.0+bdbf779", | ||
"version": "1.0.11-f50712f.0+f50712f", | ||
"main": "dist/index.js", | ||
@@ -27,3 +27,3 @@ "repository": "git@github.com:erikengervall/gigalib.git", | ||
}, | ||
"gitHead": "bdbf779d64a4889772ca78d6043f55037f6c7a50" | ||
"gitHead": "f50712fc33ad0f2d09dcc104007f505932332234" | ||
} |
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"lib": ["es2021"], | ||
"module": "CommonJS", | ||
"noEmit": false, | ||
"sourceMap": true, | ||
"target": "ES6", | ||
"baseUrl": "src", | ||
"outDir": "dist", | ||
"rootDir": "src" | ||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, | ||
"module": "commonjs" /* Specify what module code is generated. */, | ||
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, | ||
"outDir": "./dist" /* Specify an output folder for all emitted files. */, | ||
"removeComments": true /* Disable emitting comments. */, | ||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, | ||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, | ||
"strict": true /* Enable all strict type-checking options. */, | ||
"noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied `any` type.. */, | ||
"strictNullChecks": true /* When type checking, take into account `null` and `undefined`. */, | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
}, | ||
"include": ["src", "../../scripts/change-case.ts"], | ||
"exclude": [ | ||
"_warmup", | ||
".cache", | ||
".next", | ||
".serverless", | ||
".vscode", | ||
".vscode", | ||
".webpack", | ||
"*.dist*", | ||
"*.spec*", | ||
"*.test*", | ||
"build", | ||
"coverage", | ||
"cypress-coverage", | ||
"dist", | ||
"jest-coverage", | ||
"node_modules" | ||
] | ||
"include": ["src/**/*"] | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
136953
130
2944