@tstdl/base 0.89.8 → 0.90.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/response.d.ts +2 -6
- package/api/response.js +9 -32
- package/api/server/gateway.js +3 -3
- package/api/server/middlewares/allowed-methods.middleware.js +1 -1
- package/authentication/client/authentication.service.js +6 -6
- package/authentication/errors/secret-requirements.error.d.ts +1 -1
- package/authentication/errors/secret-requirements.error.js +1 -1
- package/authentication/server/authentication.api-controller.js +2 -2
- package/authentication/server/authentication.service.js +2 -2
- package/authentication/server/helper.js +2 -2
- package/browser/module.js +1 -1
- package/cookie/cookie.js +1 -1
- package/data-structures/index-out-of-bounds.error.d.ts +1 -1
- package/data-structures/index-out-of-bounds.error.js +1 -1
- package/data-structures/sorted-array-list.js +1 -1
- package/database/mongo/mongo-base.repository.js +1 -1
- package/disposable/async-disposer.js +1 -1
- package/errors/errors.localization.d.ts +43 -0
- package/errors/errors.localization.js +117 -0
- package/{error → errors}/index.d.ts +2 -0
- package/{error → errors}/index.js +2 -0
- package/errors/invalid-credentials.error.d.ts +5 -0
- package/errors/invalid-credentials.error.js +7 -0
- package/http/http-headers.js +1 -1
- package/http/http-value-map.js +1 -1
- package/http/http.error.d.ts +1 -1
- package/http/http.error.js +1 -1
- package/http/utils.js +3 -3
- package/injector/resolve.error.d.ts +1 -1
- package/injector/resolve.error.js +1 -1
- package/openid-connect/oidc.service.js +2 -2
- package/package.json +3 -4
- package/reflection/decorator-data.js +1 -1
- package/rpc/rpc-error.d.ts +1 -1
- package/rpc/rpc-error.js +1 -1
- package/rpc/rpc.js +1 -1
- package/schema/schema.error.d.ts +2 -2
- package/schema/schema.error.js +1 -1
- package/search-index/elastic/search-index.js +2 -2
- package/search-index/error.d.ts +1 -1
- package/search-index/error.js +1 -1
- package/sse/server-sent-events.js +1 -1
- package/templates/providers/file.template-provider.js +1 -1
- package/templates/resolvers/file.template-resolver.js +1 -1
- package/text/localization.service.js +1 -1
- package/utils/async-iterable-helpers/parallel/for-each.js +1 -1
- package/utils/compression.js +1 -1
- package/utils/date-time.js +1 -1
- package/utils/encoding.js +1 -1
- package/utils/file-reader.js +1 -1
- package/utils/helpers.js +1 -1
- package/utils/image.js +1 -1
- package/utils/jwt.js +1 -1
- package/utils/math.js +1 -1
- package/utils/stream/size-limited-stream.js +1 -1
- package/utils/stream/stream-reader.js +1 -1
- package/utils/timing.js +1 -1
- package/utils/type-guards.js +1 -1
- /package/{error → errors}/api.error.d.ts +0 -0
- /package/{error → errors}/api.error.js +0 -0
- /package/{error → errors}/assertion.error.d.ts +0 -0
- /package/{error → errors}/assertion.error.js +0 -0
- /package/{error → errors}/bad-request.error.d.ts +0 -0
- /package/{error → errors}/bad-request.error.js +0 -0
- /package/{error → errors}/custom.error.d.ts +0 -0
- /package/{error → errors}/custom.error.js +0 -0
- /package/{error → errors}/details.error.d.ts +0 -0
- /package/{error → errors}/details.error.js +0 -0
- /package/{error → errors}/forbidden.error.d.ts +0 -0
- /package/{error → errors}/forbidden.error.js +0 -0
- /package/{error → errors}/invalid-token.error.d.ts +0 -0
- /package/{error → errors}/invalid-token.error.js +0 -0
- /package/{error → errors}/max-bytes-exceeded.error.d.ts +0 -0
- /package/{error → errors}/max-bytes-exceeded.error.js +0 -0
- /package/{error → errors}/method-not-allowed.error.d.ts +0 -0
- /package/{error → errors}/method-not-allowed.error.js +0 -0
- /package/{error → errors}/multi.error.d.ts +0 -0
- /package/{error → errors}/multi.error.js +0 -0
- /package/{error → errors}/not-found.error.d.ts +0 -0
- /package/{error → errors}/not-found.error.js +0 -0
- /package/{error → errors}/not-implemented.error.d.ts +0 -0
- /package/{error → errors}/not-implemented.error.js +0 -0
- /package/{error → errors}/not-supported.error.d.ts +0 -0
- /package/{error → errors}/not-supported.error.js +0 -0
- /package/{error → errors}/timeout.error.d.ts +0 -0
- /package/{error → errors}/timeout.error.js +0 -0
- /package/{error → errors}/unauthorized.error.d.ts +0 -0
- /package/{error → errors}/unauthorized.error.js +0 -0
- /package/{error → errors}/unsupported-media-type.error.d.ts +0 -0
- /package/{error → errors}/unsupported-media-type.error.js +0 -0
package/api/response.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomError, CustomErrorStatic } from '../
|
|
1
|
+
import type { CustomError, CustomErrorStatic } from '../errors/index.js';
|
|
2
2
|
import type { UndefinableJson } from '../types.js';
|
|
3
3
|
export type ErrorHandlerData = undefined | UndefinableJson;
|
|
4
4
|
export type ErrorSerializer<T extends CustomError, TData extends ErrorHandlerData> = (error: T) => TData;
|
|
@@ -22,14 +22,10 @@ export type ResponseError = {
|
|
|
22
22
|
data?: ErrorHandlerData;
|
|
23
23
|
};
|
|
24
24
|
export declare function registerErrorHandler<T extends CustomError, TData extends ErrorHandlerData>(constructor: CustomErrorStatic<T>, statusCode: number, serializer: ErrorSerializer<T, TData>, deserializer: ErrorDeserializer<T, TData>): void;
|
|
25
|
-
export declare function hasErrorHandler(
|
|
25
|
+
export declare function hasErrorHandler(typeOrResponseOrName: CustomErrorStatic | ErrorResponse | string): boolean;
|
|
26
26
|
export declare function getErrorStatusCode(error: CustomError, defaultStatusCode?: number): number;
|
|
27
|
-
export declare function createResultResponse<T>(result: T): ResultResponse<T>;
|
|
28
27
|
export declare function createErrorResponse(error: Error, details?: any): ErrorResponse;
|
|
29
28
|
export declare function createErrorResponse(name: string, message: string, details?: any): ErrorResponse;
|
|
30
|
-
export declare function parseResponse<T>(response: Response<T>): T;
|
|
31
29
|
export declare function parseErrorResponse(response: ErrorResponse, fallbackToGenericApiError?: true): Error;
|
|
32
30
|
export declare function parseErrorResponse(response: ErrorResponse, fallbackToGenericApiError: false): Error | undefined;
|
|
33
|
-
export declare function isResultResponse<T = any>(response: Response<T> | unknown): response is ResultResponse<T>;
|
|
34
31
|
export declare function isErrorResponse(response: Response<any> | unknown): response is ErrorResponse;
|
|
35
|
-
export declare function isResponse<T = any>(obj: unknown): obj is Response<T>;
|
package/api/response.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SecretRequirementsError } from '../authentication/errors/secret-requirements.error.js';
|
|
2
2
|
import { SchemaError } from '../schema/schema.error.js';
|
|
3
|
-
import { ApiError, BadRequestError, ForbiddenError, InvalidTokenError, MaxBytesExceededError, MethodNotAllowedError, NotFoundError, NotImplementedError, NotSupportedError, UnauthorizedError, UnsupportedMediaTypeError } from '../
|
|
3
|
+
import { ApiError, BadRequestError, ForbiddenError, InvalidTokenError, MaxBytesExceededError, MethodNotAllowedError, NotFoundError, NotImplementedError, NotSupportedError, UnauthorizedError, UnsupportedMediaTypeError } from '../errors/index.js';
|
|
4
4
|
import { assertString, isDefined, isFunction, isObject, isString } from '../utils/type-guards.js';
|
|
5
5
|
import { deserializeSchemaError, serializeSchemaError } from './default-error-handlers.js';
|
|
6
6
|
const errorHandlers = new Map();
|
|
@@ -11,25 +11,19 @@ export function registerErrorHandler(constructor, statusCode, serializer, deseri
|
|
|
11
11
|
}
|
|
12
12
|
errorHandlers.set(constructor.errorName, { statusCode, serializer, deserializer });
|
|
13
13
|
}
|
|
14
|
-
export function hasErrorHandler(
|
|
15
|
-
const name = isFunction(
|
|
16
|
-
?
|
|
17
|
-
: isString(
|
|
18
|
-
?
|
|
19
|
-
: isErrorResponse(
|
|
20
|
-
?
|
|
14
|
+
export function hasErrorHandler(typeOrResponseOrName) {
|
|
15
|
+
const name = isFunction(typeOrResponseOrName)
|
|
16
|
+
? typeOrResponseOrName.errorName
|
|
17
|
+
: isString(typeOrResponseOrName)
|
|
18
|
+
? typeOrResponseOrName
|
|
19
|
+
: isErrorResponse(typeOrResponseOrName)
|
|
20
|
+
? typeOrResponseOrName.error.name
|
|
21
21
|
: undefined;
|
|
22
22
|
return errorHandlers.has(name);
|
|
23
23
|
}
|
|
24
24
|
export function getErrorStatusCode(error, defaultStatusCode = 500) {
|
|
25
25
|
return errorHandlers.get(error.name)?.statusCode ?? defaultStatusCode;
|
|
26
26
|
}
|
|
27
|
-
export function createResultResponse(result) {
|
|
28
|
-
const response = {
|
|
29
|
-
result
|
|
30
|
-
};
|
|
31
|
-
return response;
|
|
32
|
-
}
|
|
33
27
|
export function createErrorResponse(errorOrName, message = '', details) {
|
|
34
28
|
let response;
|
|
35
29
|
if (errorOrName instanceof Error) {
|
|
@@ -66,15 +60,6 @@ export function createErrorResponse(errorOrName, message = '', details) {
|
|
|
66
60
|
}
|
|
67
61
|
return response;
|
|
68
62
|
}
|
|
69
|
-
export function parseResponse(response) {
|
|
70
|
-
if (isResultResponse(response)) {
|
|
71
|
-
return response.result;
|
|
72
|
-
}
|
|
73
|
-
if (isErrorResponse(response)) {
|
|
74
|
-
throw parseErrorResponse(response);
|
|
75
|
-
}
|
|
76
|
-
throw new Error('Unsupported response.');
|
|
77
|
-
}
|
|
78
63
|
export function parseErrorResponse(response, fallbackToGenericApiError = true) {
|
|
79
64
|
const handler = errorHandlers.get(response.error.name);
|
|
80
65
|
if (handler != undefined) {
|
|
@@ -86,16 +71,8 @@ export function parseErrorResponse(response, fallbackToGenericApiError = true) {
|
|
|
86
71
|
}
|
|
87
72
|
return new ApiError(response);
|
|
88
73
|
}
|
|
89
|
-
export function isResultResponse(response) {
|
|
90
|
-
const hasResult = isObject(response) && isDefined(response.result);
|
|
91
|
-
return hasResult;
|
|
92
|
-
}
|
|
93
74
|
export function isErrorResponse(response) {
|
|
94
|
-
|
|
95
|
-
return hasError;
|
|
96
|
-
}
|
|
97
|
-
export function isResponse(obj) {
|
|
98
|
-
return (isResultResponse(obj) || isErrorResponse(obj));
|
|
75
|
+
return isObject(response) && isDefined(response.error);
|
|
99
76
|
}
|
|
100
77
|
registerErrorHandler(ApiError, 400, ({ response }) => response, (response) => new ApiError(response));
|
|
101
78
|
registerErrorHandler(BadRequestError, 400, () => undefined, (_, error) => new BadRequestError(error.message));
|
package/api/server/gateway.js
CHANGED
|
@@ -11,9 +11,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import 'urlpattern-polyfill'; // eslint-disable-line import/no-unassigned-import
|
|
14
|
-
import { BadRequestError } from '../../
|
|
15
|
-
import { NotFoundError } from '../../
|
|
16
|
-
import { NotImplementedError } from '../../
|
|
14
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
15
|
+
import { NotFoundError } from '../../errors/not-found.error.js';
|
|
16
|
+
import { NotImplementedError } from '../../errors/not-implemented.error.js';
|
|
17
17
|
import { HttpServerResponse } from '../../http/server/index.js';
|
|
18
18
|
import { InjectArg, ResolveArg, Singleton, resolveArgumentType } from '../../injector/index.js';
|
|
19
19
|
import { Logger } from '../../logger/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MethodNotAllowedError } from '../../../
|
|
1
|
+
import { MethodNotAllowedError } from '../../../errors/method-not-allowed.error.js';
|
|
2
2
|
import { HttpServerResponse } from '../../../http/server/index.js';
|
|
3
3
|
import { isUndefined } from '../../../utils/type-guards.js';
|
|
4
4
|
export async function allowedMethodsMiddleware(request, next, context) {
|
|
@@ -13,12 +13,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { Subject, filter, firstValueFrom, race, timer } from 'rxjs';
|
|
14
14
|
import { CancellationToken } from '../../cancellation/token.js';
|
|
15
15
|
import { disposeAsync } from '../../disposable/index.js';
|
|
16
|
-
import { BadRequestError } from '../../
|
|
17
|
-
import { ForbiddenError } from '../../
|
|
18
|
-
import { InvalidTokenError } from '../../
|
|
19
|
-
import { NotFoundError } from '../../
|
|
20
|
-
import { NotSupportedError } from '../../
|
|
21
|
-
import { UnauthorizedError } from '../../
|
|
16
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
17
|
+
import { ForbiddenError } from '../../errors/forbidden.error.js';
|
|
18
|
+
import { InvalidTokenError } from '../../errors/invalid-token.error.js';
|
|
19
|
+
import { NotFoundError } from '../../errors/not-found.error.js';
|
|
20
|
+
import { NotSupportedError } from '../../errors/not-supported.error.js';
|
|
21
|
+
import { UnauthorizedError } from '../../errors/unauthorized.error.js';
|
|
22
22
|
import { Inject, Optional, Singleton, afterResolve, inject } from '../../injector/index.js';
|
|
23
23
|
import { Lock } from '../../lock/index.js';
|
|
24
24
|
import { Logger } from '../../logger/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomError } from '../../
|
|
1
|
+
import { CustomError } from '../../errors/custom.error.js';
|
|
2
2
|
export declare class SecretRequirementsError extends CustomError {
|
|
3
3
|
static readonly errorName = "SecretRequirementsError";
|
|
4
4
|
constructor(message?: string);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomError } from '../../
|
|
1
|
+
import { CustomError } from '../../errors/custom.error.js';
|
|
2
2
|
export class SecretRequirementsError extends CustomError {
|
|
3
3
|
static errorName = 'SecretRequirementsError';
|
|
4
4
|
constructor(message = 'Secret requirements not met.') {
|
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { apiController } from '../../api/server/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { InvalidCredentialsError } from '../../errors/invalid-credentials.error.js';
|
|
12
12
|
import { HttpServerResponse } from '../../http/server/index.js';
|
|
13
13
|
import { currentTimestamp } from '../../utils/date-time.js';
|
|
14
14
|
import { authenticationApiDefinition } from '../authentication.api.js';
|
|
@@ -23,7 +23,7 @@ let AuthenticationApiController = class AuthenticationApiController {
|
|
|
23
23
|
async token({ parameters }) {
|
|
24
24
|
const authenticationResult = await this.authenticationService.authenticate(parameters.subject, parameters.secret);
|
|
25
25
|
if (!authenticationResult.success) {
|
|
26
|
-
throw new
|
|
26
|
+
throw new InvalidCredentialsError();
|
|
27
27
|
}
|
|
28
28
|
const result = await this.authenticationService.getToken(authenticationResult.subject, parameters.data);
|
|
29
29
|
return this.getTokenResponse(result);
|
|
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { InvalidTokenError } from '../../
|
|
14
|
-
import { NotImplementedError } from '../../
|
|
13
|
+
import { InvalidTokenError } from '../../errors/invalid-token.error.js';
|
|
14
|
+
import { NotImplementedError } from '../../errors/not-implemented.error.js';
|
|
15
15
|
import { Inject, Optional, Singleton, afterResolve } from '../../injector/index.js';
|
|
16
16
|
import { Alphabet } from '../../utils/alphabet.js';
|
|
17
17
|
import { deriveBytesMultiple, importPbkdf2Key } from '../../utils/cryptography.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BadRequestError } from '../../
|
|
2
|
-
import { InvalidTokenError } from '../../
|
|
1
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
2
|
+
import { InvalidTokenError } from '../../errors/invalid-token.error.js';
|
|
3
3
|
import { currentTimestampSeconds } from '../../utils/date-time.js';
|
|
4
4
|
import { parseAndValidateJwtTokenString } from '../../utils/jwt.js';
|
|
5
5
|
import { isArray, isDefined, isUndefined } from '../../utils/type-guards.js';
|
package/browser/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { chromium, firefox, webkit } from 'playwright';
|
|
2
|
-
import { NotSupportedError } from '../
|
|
2
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
3
3
|
import { Injector } from '../injector/injector.js';
|
|
4
4
|
import { copyObjectProperties, filterUndefinedObjectProperties } from '../utils/object/object.js';
|
|
5
5
|
import { isDefined, isUndefined } from '../utils/type-guards.js';
|
package/cookie/cookie.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotSupportedError } from '../
|
|
1
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
2
2
|
import { trim } from '../utils/string/trim.js';
|
|
3
3
|
import { isDefined, isNumber, isUndefined } from '../utils/type-guards.js';
|
|
4
4
|
const sameSiteMap = {
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var SortedArrayList_1;
|
|
11
11
|
/* eslint-disable @typescript-eslint/member-ordering */
|
|
12
|
-
import { NotImplementedError } from '../
|
|
12
|
+
import { NotImplementedError } from '../errors/not-implemented.error.js';
|
|
13
13
|
import { Serializable, serializable } from '../serializer/serializable.js';
|
|
14
14
|
import { binarySearch, binarySearchFirst, binarySearchInsertionIndex, binarySearchLast } from '../utils/binary-search.js';
|
|
15
15
|
import { compareByValue } from '../utils/comparison.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotFoundError } from '../../
|
|
1
|
+
import { NotFoundError } from '../../errors/not-found.error.js';
|
|
2
2
|
import { objectKeys } from '../../utils/object/object.js';
|
|
3
3
|
import { assertDefined, isNull, isNullOrUndefined } from '../../utils/type-guards.js';
|
|
4
4
|
import { mongoDocumentFromMaybeNewEntity, toEntity, toMongoDocument, toMongoProjection, toNewEntity, toProjectedEntity } from './model/document.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDefined, isNullOrUndefined } from '../utils/type-guards.js';
|
|
2
2
|
import { CancellationToken } from '../cancellation/token.js';
|
|
3
|
-
import { MultiError } from '../
|
|
3
|
+
import { MultiError } from '../errors/multi.error.js';
|
|
4
4
|
import { dispose, disposeAsync, isAsyncDisposable, isDisposable } from './disposable.js';
|
|
5
5
|
const deferrerToken = Symbol('DeferrerToken');
|
|
6
6
|
export class AsyncDisposer {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Localization, LocalizeItem } from '../text/localization.service.js';
|
|
2
|
+
import type { ApiError } from './api.error.js';
|
|
3
|
+
import type { BadRequestError } from './bad-request.error.js';
|
|
4
|
+
import type { CustomErrorStatic } from './custom.error.js';
|
|
5
|
+
import type { ForbiddenError } from './forbidden.error.js';
|
|
6
|
+
import type { InvalidCredentialsError } from './invalid-credentials.error.js';
|
|
7
|
+
import type { InvalidTokenError } from './invalid-token.error.js';
|
|
8
|
+
import type { MaxBytesExceededError } from './max-bytes-exceeded.error.js';
|
|
9
|
+
import type { MethodNotAllowedError } from './method-not-allowed.error.js';
|
|
10
|
+
import type { NotFoundError } from './not-found.error.js';
|
|
11
|
+
import type { NotImplementedError } from './not-implemented.error.js';
|
|
12
|
+
import type { NotSupportedError } from './not-supported.error.js';
|
|
13
|
+
import type { TimeoutError } from './timeout.error.js';
|
|
14
|
+
import type { UnauthorizedError } from './unauthorized.error.js';
|
|
15
|
+
export type ErrorsLocalizationEntries<T extends CustomErrorStatic[]> = {
|
|
16
|
+
[I in Extract<keyof T, number> as T[I]['errorName']]: {
|
|
17
|
+
header: LocalizeItem<InstanceType<T[I]>>;
|
|
18
|
+
message?: LocalizeItem<InstanceType<T[I]>>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type ErrorsLocalization<T extends CustomErrorStatic[] = CustomErrorStatic[]> = Localization<{
|
|
22
|
+
errors: ErrorsLocalizationEntries<T>;
|
|
23
|
+
}>;
|
|
24
|
+
type TstdlErrors = [
|
|
25
|
+
typeof ApiError,
|
|
26
|
+
typeof BadRequestError,
|
|
27
|
+
typeof ForbiddenError,
|
|
28
|
+
typeof InvalidCredentialsError,
|
|
29
|
+
typeof InvalidTokenError,
|
|
30
|
+
typeof MaxBytesExceededError,
|
|
31
|
+
typeof MethodNotAllowedError,
|
|
32
|
+
typeof NotFoundError,
|
|
33
|
+
typeof NotImplementedError,
|
|
34
|
+
typeof NotSupportedError,
|
|
35
|
+
typeof TimeoutError,
|
|
36
|
+
typeof UnauthorizedError
|
|
37
|
+
];
|
|
38
|
+
export declare const errorsLocalizationKeys: import("../text/localization.service.js").ProxyLocalizationKeys<{
|
|
39
|
+
errors: ErrorsLocalizationEntries<CustomErrorStatic<import("./custom.error.js").CustomError>[]>;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const germanTstdlErrorsLocalization: ErrorsLocalization<TstdlErrors>;
|
|
42
|
+
export declare const englishTstdlErrorsLocalization: ErrorsLocalization<TstdlErrors>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { getLocalizationKeys } from '../text/localization.service.js';
|
|
2
|
+
export const errorsLocalizationKeys = getLocalizationKeys();
|
|
3
|
+
export const germanTstdlErrorsLocalization = {
|
|
4
|
+
language: { code: 'de', name: 'Deutsch' },
|
|
5
|
+
keys: {
|
|
6
|
+
errors: {
|
|
7
|
+
ApiError: {
|
|
8
|
+
header: 'API Fehler',
|
|
9
|
+
message: getErrorMessage
|
|
10
|
+
},
|
|
11
|
+
BadRequestError: {
|
|
12
|
+
header: 'Ungültige Anfrage',
|
|
13
|
+
message: getErrorMessage
|
|
14
|
+
},
|
|
15
|
+
ForbiddenError: {
|
|
16
|
+
header: 'Zugriff nicht erlaubt',
|
|
17
|
+
message: getErrorMessage
|
|
18
|
+
},
|
|
19
|
+
InvalidCredentialsError: {
|
|
20
|
+
header: 'Ungültige Zugangsdaten',
|
|
21
|
+
message: getErrorMessage
|
|
22
|
+
},
|
|
23
|
+
InvalidTokenError: {
|
|
24
|
+
header: 'Anmeldung abgelaufen oder ungültig',
|
|
25
|
+
message: getErrorMessage
|
|
26
|
+
},
|
|
27
|
+
MaxBytesExceededError: {
|
|
28
|
+
header: 'Daten größer als erlaubt',
|
|
29
|
+
message: getErrorMessage
|
|
30
|
+
},
|
|
31
|
+
MethodNotAllowedError: {
|
|
32
|
+
header: 'Anfrage nicht erlaubt',
|
|
33
|
+
message: getErrorMessage
|
|
34
|
+
},
|
|
35
|
+
NotFoundError: {
|
|
36
|
+
header: 'Nicht gefunden',
|
|
37
|
+
message: getErrorMessage
|
|
38
|
+
},
|
|
39
|
+
NotImplementedError: {
|
|
40
|
+
header: 'Funktion nicht implementiert',
|
|
41
|
+
message: getErrorMessage
|
|
42
|
+
},
|
|
43
|
+
NotSupportedError: {
|
|
44
|
+
header: 'Nicht unterstützt',
|
|
45
|
+
message: getErrorMessage
|
|
46
|
+
},
|
|
47
|
+
TimeoutError: {
|
|
48
|
+
header: 'Zeitüberschreitung',
|
|
49
|
+
message: getErrorMessage
|
|
50
|
+
},
|
|
51
|
+
UnauthorizedError: {
|
|
52
|
+
header: 'Unautorisiert',
|
|
53
|
+
message: getErrorMessage
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
enums: []
|
|
58
|
+
};
|
|
59
|
+
export const englishTstdlErrorsLocalization = {
|
|
60
|
+
language: { code: 'en', name: 'English' },
|
|
61
|
+
keys: {
|
|
62
|
+
errors: {
|
|
63
|
+
ApiError: {
|
|
64
|
+
header: 'API error',
|
|
65
|
+
message: getErrorMessage
|
|
66
|
+
},
|
|
67
|
+
BadRequestError: {
|
|
68
|
+
header: 'Bad Request',
|
|
69
|
+
message: getErrorMessage
|
|
70
|
+
},
|
|
71
|
+
ForbiddenError: {
|
|
72
|
+
header: 'Access forbidden',
|
|
73
|
+
message: getErrorMessage
|
|
74
|
+
},
|
|
75
|
+
InvalidCredentialsError: {
|
|
76
|
+
header: 'Invalid credentials',
|
|
77
|
+
message: getErrorMessage
|
|
78
|
+
},
|
|
79
|
+
InvalidTokenError: {
|
|
80
|
+
header: 'Login expired or invalid',
|
|
81
|
+
message: getErrorMessage
|
|
82
|
+
},
|
|
83
|
+
MaxBytesExceededError: {
|
|
84
|
+
header: 'Data larger than allowed',
|
|
85
|
+
message: getErrorMessage
|
|
86
|
+
},
|
|
87
|
+
MethodNotAllowedError: {
|
|
88
|
+
header: 'Request not allowed',
|
|
89
|
+
message: getErrorMessage
|
|
90
|
+
},
|
|
91
|
+
NotFoundError: {
|
|
92
|
+
header: 'Not found',
|
|
93
|
+
message: getErrorMessage
|
|
94
|
+
},
|
|
95
|
+
NotImplementedError: {
|
|
96
|
+
header: 'Function not implemented',
|
|
97
|
+
message: getErrorMessage
|
|
98
|
+
},
|
|
99
|
+
NotSupportedError: {
|
|
100
|
+
header: 'Not supported',
|
|
101
|
+
message: getErrorMessage
|
|
102
|
+
},
|
|
103
|
+
TimeoutError: {
|
|
104
|
+
header: 'Timeout',
|
|
105
|
+
message: getErrorMessage
|
|
106
|
+
},
|
|
107
|
+
UnauthorizedError: {
|
|
108
|
+
header: 'Unauthorized',
|
|
109
|
+
message: getErrorMessage
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
enums: []
|
|
114
|
+
};
|
|
115
|
+
function getErrorMessage(error) {
|
|
116
|
+
return `${error.message}`;
|
|
117
|
+
}
|
|
@@ -8,7 +8,9 @@ export * from './assertion.error.js';
|
|
|
8
8
|
export * from './bad-request.error.js';
|
|
9
9
|
export * from './custom.error.js';
|
|
10
10
|
export * from './details.error.js';
|
|
11
|
+
export * from './errors.localization.js';
|
|
11
12
|
export * from './forbidden.error.js';
|
|
13
|
+
export * from './invalid-credentials.error.js';
|
|
12
14
|
export * from './invalid-token.error.js';
|
|
13
15
|
export * from './max-bytes-exceeded.error.js';
|
|
14
16
|
export * from './method-not-allowed.error.js';
|
|
@@ -8,7 +8,9 @@ export * from './assertion.error.js';
|
|
|
8
8
|
export * from './bad-request.error.js';
|
|
9
9
|
export * from './custom.error.js';
|
|
10
10
|
export * from './details.error.js';
|
|
11
|
+
export * from './errors.localization.js';
|
|
11
12
|
export * from './forbidden.error.js';
|
|
13
|
+
export * from './invalid-credentials.error.js';
|
|
12
14
|
export * from './invalid-token.error.js';
|
|
13
15
|
export * from './max-bytes-exceeded.error.js';
|
|
14
16
|
export * from './method-not-allowed.error.js';
|
package/http/http-headers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadRequestError } from '../
|
|
1
|
+
import { BadRequestError } from '../errors/bad-request.error.js';
|
|
2
2
|
import { numberPattern } from '../utils/patterns.js';
|
|
3
3
|
import { isNotNumber, isNotString, isNullOrUndefined, isNumber, isString, isUndefined } from '../utils/type-guards.js';
|
|
4
4
|
import { HttpValueMap } from './http-value-map.js';
|
package/http/http-value-map.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadRequestError } from '../
|
|
1
|
+
import { BadRequestError } from '../errors/bad-request.error.js';
|
|
2
2
|
import { toArray } from '../utils/array/array.js';
|
|
3
3
|
import { isIterable } from '../utils/iterable-helpers/is-iterable.js';
|
|
4
4
|
import { objectEntries } from '../utils/object/object.js';
|
package/http/http.error.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TypedOmit, UndefinableJson } from '../types.js';
|
|
2
2
|
import type { ErrorExtraInfo } from '../utils/format-error.js';
|
|
3
|
-
import { CustomError } from '../
|
|
3
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
4
4
|
import type { HttpClientRequest, HttpClientRequestObject, HttpClientResponse, HttpClientResponseObject } from './client/index.js';
|
|
5
5
|
export declare enum HttpErrorReason {
|
|
6
6
|
Unknown = "Unknown",
|
package/http/http.error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { propertyNameOf } from '../utils/object/property-name.js';
|
|
2
2
|
import { isDefined, isNotString, isString } from '../utils/type-guards.js';
|
|
3
|
-
import { CustomError } from '../
|
|
3
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
4
4
|
export var HttpErrorReason;
|
|
5
5
|
(function (HttpErrorReason) {
|
|
6
6
|
HttpErrorReason["Unknown"] = "Unknown";
|
package/http/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MaxBytesExceededError } from '../
|
|
2
|
-
import { NotSupportedError } from '../
|
|
3
|
-
import { UnsupportedMediaTypeError } from '../
|
|
1
|
+
import { MaxBytesExceededError } from '../errors/max-bytes-exceeded.error.js';
|
|
2
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
3
|
+
import { UnsupportedMediaTypeError } from '../errors/unsupported-media-type.error.js';
|
|
4
4
|
import { isAnyIterable } from '../utils/any-iterable-iterator.js';
|
|
5
5
|
import { decompress, decompressStream } from '../utils/compression.js';
|
|
6
6
|
import { decodeText, decodeTextStream } from '../utils/encoding.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomError } from '../
|
|
1
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
2
2
|
import type { ResolveChain } from './resolve-chain.js';
|
|
3
3
|
export declare class ResolveError extends CustomError {
|
|
4
4
|
constructor(message: string, chain: ResolveChain, cause?: Error);
|
|
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { ForbiddenError } from '../
|
|
14
|
-
import { NotImplementedError } from '../
|
|
13
|
+
import { ForbiddenError } from '../errors/forbidden.error.js';
|
|
14
|
+
import { NotImplementedError } from '../errors/not-implemented.error.js';
|
|
15
15
|
import { HttpClient } from '../http/client/index.js';
|
|
16
16
|
import { HttpHeaders } from '../http/http-headers.js';
|
|
17
17
|
import { Inject, Optional, Singleton } from '../injector/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.1",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"./disposable": "./disposable/index.js",
|
|
45
45
|
"./distributed-loop": "./distributed-loop/index.js",
|
|
46
46
|
"./enumerable": "./enumerable/index.js",
|
|
47
|
-
"./
|
|
47
|
+
"./errors": "./errors/index.js",
|
|
48
48
|
"./function": "./function/index.js",
|
|
49
49
|
"./http": "./http/index.js",
|
|
50
50
|
"./http/undici": "./http/client/adapters/undici.adapter.js",
|
|
@@ -134,14 +134,13 @@
|
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@elastic/elasticsearch": "^8.10",
|
|
136
136
|
"@koa/router": "^12.0",
|
|
137
|
-
"@tstdl/angular": "^0.
|
|
137
|
+
"@tstdl/angular": "^0.90",
|
|
138
138
|
"@zxcvbn-ts/core": "^3.0",
|
|
139
139
|
"@zxcvbn-ts/language-common": "^3.0",
|
|
140
140
|
"@zxcvbn-ts/language-de": "^3.0",
|
|
141
141
|
"@zxcvbn-ts/language-en": "^3.0",
|
|
142
142
|
"chroma-js": "^2.4",
|
|
143
143
|
"handlebars": "^4.7",
|
|
144
|
-
"knex": "^2.5",
|
|
145
144
|
"koa": "^2.14",
|
|
146
145
|
"minio": "^7.1",
|
|
147
146
|
"mjml": "^4.14",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DetailsError } from '../
|
|
1
|
+
import { DetailsError } from '../errors/details.error.js';
|
|
2
2
|
import { isDefined, isFunction, isNumber, isObject, isUndefined } from '../utils/type-guards.js';
|
|
3
3
|
import { getConstructor } from './utils.js';
|
|
4
4
|
// eslint-disable-next-line max-lines-per-function
|
package/rpc/rpc-error.d.ts
CHANGED
package/rpc/rpc-error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomError } from '../
|
|
1
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
2
2
|
import { formatError } from '../utils/format-error.js';
|
|
3
3
|
import { isDefined, isObject } from '../utils/type-guards.js';
|
|
4
4
|
export class RpcError extends CustomError {
|
package/rpc/rpc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
-
import { NotImplementedError } from '../
|
|
3
|
+
import { NotImplementedError } from '../errors/not-implemented.error.js';
|
|
4
4
|
import { deserialize, registerSerializer, serialize } from '../serializer/index.js';
|
|
5
5
|
import { hasOwnProperty } from '../utils/object/object.js';
|
|
6
6
|
import { reflectMethods } from '../utils/proxy.js';
|
package/schema/schema.error.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CustomErrorOptions } from '../
|
|
2
|
-
import { CustomError } from '../
|
|
1
|
+
import type { CustomErrorOptions } from '../errors/custom.error.js';
|
|
2
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
3
3
|
import type { JsonPath } from '../json-path/index.js';
|
|
4
4
|
import type { OneOrMany, TypedOmit, UndefinableJson } from '../types.js';
|
|
5
5
|
import type { ErrorExtraInfo } from '../utils/format-error.js';
|
package/schema/schema.error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomError } from '../
|
|
1
|
+
import { CustomError } from '../errors/custom.error.js';
|
|
2
2
|
import { toArray } from '../utils/array/array.js';
|
|
3
3
|
import { isArray, isDefined, isNotNullOrUndefined, isString } from '../utils/type-guards.js';
|
|
4
4
|
import { getExpectString } from './schema.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BadRequestError } from '../../
|
|
2
|
-
import { MultiError } from '../../
|
|
1
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
2
|
+
import { MultiError } from '../../errors/multi.error.js';
|
|
3
3
|
import { afterResolve } from '../../injector/interfaces.js';
|
|
4
4
|
import { SearchIndex, SearchIndexError } from '../../search-index/index.js';
|
|
5
5
|
import { decodeBase64, encodeBase64 } from '../../utils/base64.js';
|
package/search-index/error.d.ts
CHANGED
package/search-index/error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotSupportedError } from '../
|
|
1
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
2
2
|
import { distinctUntilChanged, filter, fromEvent, map, merge, ReplaySubject, share, shareReplay, startWith, takeUntil } from 'rxjs';
|
|
3
3
|
export var ServerSentEventsState;
|
|
4
4
|
(function (ServerSentEventsState) {
|
|
@@ -11,7 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import * as path from 'node:path';
|
|
14
|
-
import { BadRequestError } from '../../
|
|
14
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
15
15
|
import { InjectArg, Singleton } from '../../injector/decorators.js';
|
|
16
16
|
import { resolveArgumentType } from '../../injector/interfaces.js';
|
|
17
17
|
import { Schema } from '../../schema/index.js';
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import * as fs from 'node:fs/promises';
|
|
14
14
|
import * as path from 'node:path';
|
|
15
|
-
import { BadRequestError } from '../../
|
|
15
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
16
16
|
import { InjectArg, Singleton } from '../../injector/decorators.js';
|
|
17
17
|
import { resolveArgumentType } from '../../injector/interfaces.js';
|
|
18
18
|
import { Property } from '../../schema/index.js';
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { DetailsError } from '../
|
|
13
|
+
import { DetailsError } from '../errors/details.error.js';
|
|
14
14
|
import { ResolveArg, Singleton } from '../injector/decorators.js';
|
|
15
15
|
import { Logger } from '../logger/index.js';
|
|
16
16
|
import { computed, signal, toObservable } from '../signals/api.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObservableSet } from '../../../collections/observable/observable-set.js';
|
|
2
|
-
import { MultiError } from '../../../
|
|
2
|
+
import { MultiError } from '../../../errors/multi.error.js';
|
|
3
3
|
export async function parallelForEach(iterable, concurrency, func) {
|
|
4
4
|
const running = new ObservableSet();
|
|
5
5
|
const errors = [];
|
package/utils/compression.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotSupportedError } from '../
|
|
1
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
2
2
|
import { dynamicImport } from '../import.js';
|
|
3
3
|
import { supportsReadableStream } from '../supports.js';
|
|
4
4
|
import { isAsyncIterable } from './async-iterable-helpers/is-async-iterable.js';
|
package/utils/date-time.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotSupportedError } from '../
|
|
1
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
2
2
|
import { DateTime } from 'luxon';
|
|
3
3
|
import { isDate, isNumber } from './type-guards.js';
|
|
4
4
|
import { typeOf } from './type-of.js';
|
package/utils/encoding.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from '../
|
|
1
|
+
import { AssertionError } from '../errors/assertion.error.js';
|
|
2
2
|
import { createArray } from './array/array.js';
|
|
3
3
|
import { toUint8Array } from './binary.js';
|
|
4
4
|
import { isUndefined } from './type-guards.js';
|
package/utils/file-reader.js
CHANGED
package/utils/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
2
|
import { supportsNotification } from '../supports.js';
|
|
3
|
-
import { DetailsError } from '../
|
|
3
|
+
import { DetailsError } from '../errors/details.error.js';
|
|
4
4
|
import { decycle } from './object/decycle.js';
|
|
5
5
|
import { isDefined } from './type-guards.js';
|
|
6
6
|
/**
|
package/utils/image.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from '../
|
|
1
|
+
import { AssertionError } from '../errors/assertion.error.js';
|
|
2
2
|
import { firstValueFrom, fromEvent, map, race, switchMap, throwError } from 'rxjs';
|
|
3
3
|
import { FactoryMap } from './factory-map.js';
|
|
4
4
|
import { assertNotNullPass, isFunction, isNull } from './type-guards.js';
|
package/utils/jwt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidTokenError } from '../
|
|
1
|
+
import { InvalidTokenError } from '../errors/invalid-token.error.js';
|
|
2
2
|
import { toArray } from './array/array.js';
|
|
3
3
|
import { decodeBase64Url, encodeBase64Url } from './base64.js';
|
|
4
4
|
import { importHmacKey, sign } from './cryptography.js';
|
package/utils/math.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotSupportedError } from '../
|
|
1
|
+
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
2
2
|
import { defaultRandomNumberGeneratorFn } from '../random/number-generator/random-number-generator-function.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generate a random float in interval [min, max).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaxBytesExceededError } from '../../
|
|
1
|
+
import { MaxBytesExceededError } from '../../errors/max-bytes-exceeded.error.js';
|
|
2
2
|
export function sizeLimitTransform(maxBytes, writableStrategy, readableStrategy) {
|
|
3
3
|
let totalLength = 0;
|
|
4
4
|
return new TransformStream({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadRequestError } from '../../
|
|
1
|
+
import { BadRequestError } from '../../errors/bad-request.error.js';
|
|
2
2
|
import { isAnyIterable } from '../any-iterable-iterator.js';
|
|
3
3
|
import { concatArrayBufferViews } from '../binary.js';
|
|
4
4
|
import { isDefined } from '../type-guards.js';
|
package/utils/timing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { firstValueFrom, map, race, timer } from 'rxjs';
|
|
2
|
-
import { TimeoutError } from '../
|
|
2
|
+
import { TimeoutError } from '../errors/timeout.error.js';
|
|
3
3
|
import { _throw } from './throw.js';
|
|
4
4
|
import { resolveValueOrProvider } from './value-or-provider.js';
|
|
5
5
|
/** timeout for specified duration */
|
package/utils/type-guards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/restrict-template-expressions, max-statements-per-line, no-eq-null */
|
|
2
2
|
import { supportsBlob, supportsReadableStream } from '../supports.js';
|
|
3
|
-
import { AssertionError } from '../
|
|
3
|
+
import { AssertionError } from '../errors/assertion.error.js';
|
|
4
4
|
export function assert(condition, message = 'assertion failed') {
|
|
5
5
|
if (!condition) {
|
|
6
6
|
throw new AssertionError((typeof message == 'function') ? message() : message);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|