@tstdl/base 0.81.35 → 0.82.0
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/client/client.d.ts +3 -3
- package/api/default-error-handlers.d.ts +1 -1
- package/api/response.d.ts +8 -8
- package/api/server/api-controller.d.ts +1 -1
- package/api/server/gateway.d.ts +9 -9
- package/api/server/middlewares/cors.middleware.d.ts +1 -1
- package/api/server/module.d.ts +1 -1
- package/api/types.d.ts +30 -30
- package/api/utils.d.ts +1 -1
- package/authentication/authentication-credentials.service.d.ts +6 -0
- package/authentication/authentication-credentials.service.js +17 -0
- package/authentication/authentication-credentials.service.js.map +1 -0
- package/authentication/authentication-session.service.d.ts +6 -0
- package/authentication/authentication-session.service.js +17 -0
- package/authentication/authentication-session.service.js.map +1 -0
- package/authentication/authentication-token-payload.provider.d.ts +3 -0
- package/authentication/authentication-token-payload.provider.js +17 -0
- package/authentication/authentication-token-payload.provider.js.map +1 -0
- package/authentication/authentication.service.d.ts +42 -0
- package/authentication/authentication.service.js +133 -0
- package/authentication/authentication.service.js.map +1 -0
- package/authentication/models/authentication-credentials.model.d.ts +6 -0
- package/authentication/models/authentication-credentials.model.js +37 -0
- package/authentication/models/authentication-credentials.model.js.map +1 -0
- package/authentication/models/authentication-session.model.d.ts +9 -0
- package/authentication/models/authentication-session.model.js +52 -0
- package/authentication/models/authentication-session.model.js.map +1 -0
- package/authentication/models/index.d.ts +2 -0
- package/authentication/models/index.js +19 -0
- package/authentication/models/index.js.map +1 -0
- package/authentication/tokens.d.ts +2 -0
- package/authentication/tokens.js +6 -0
- package/authentication/tokens.js.map +1 -0
- package/collections/keyed-set.d.ts +1 -1
- package/collections/observable/observable-collection.d.ts +1 -1
- package/collections/observable/observable-list.d.ts +2 -2
- package/container/container.d.ts +3 -3
- package/container/decorators.d.ts +3 -3
- package/container/interfaces.d.ts +1 -1
- package/container/provider.d.ts +6 -6
- package/container/resolve-chain.d.ts +2 -2
- package/container/token.d.ts +3 -3
- package/container/type-info.d.ts +1 -1
- package/container/types.d.ts +4 -4
- package/core.d.ts +1 -1
- package/data-structures/linked-list.d.ts +1 -1
- package/data-structures/multi-key-map.d.ts +2 -2
- package/data-structures/sorted-array-list.d.ts +1 -1
- package/database/entity-repository.d.ts +2 -2
- package/database/entity.d.ts +3 -3
- package/database/module.d.ts +1 -1
- package/database/mongo/classes.d.ts +3 -3
- package/database/mongo/model/document.d.ts +3 -3
- package/database/mongo/module.d.ts +1 -1
- package/database/mongo/mongo-base.repository.d.ts +11 -11
- package/database/mongo/mongo-bulk.d.ts +1 -1
- package/database/mongo/mongo-entity-repository.d.ts +7 -7
- package/database/mongo/types.d.ts +16 -16
- package/database/query.d.ts +38 -38
- package/disposable/async-disposer.d.ts +3 -3
- package/distributed-loop/distributed-loop.d.ts +2 -2
- package/error/custom.error.d.ts +1 -1
- package/http/client/adapters/undici-http-client.adapter.d.ts +1 -1
- package/http/client/http-client-request.d.ts +5 -5
- package/http/client/http-client-response.d.ts +2 -2
- package/http/client/http-client.d.ts +5 -5
- package/http/http-body.d.ts +3 -1
- package/http/http-body.js +18 -12
- package/http/http-body.js.map +1 -1
- package/http/http-form.d.ts +2 -2
- package/http/http-headers.d.ts +3 -3
- package/http/http-query.d.ts +2 -2
- package/http/http-url-parameters.d.ts +2 -2
- package/http/http-value-map.d.ts +1 -1
- package/http/server/http-server-request.d.ts +1 -1
- package/http/server/http-server-response.d.ts +1 -1
- package/http/server/http-server.d.ts +1 -1
- package/http/server/node/node-http-server.d.ts +1 -1
- package/http/types.d.ts +5 -5
- package/http/utils.d.ts +3 -3
- package/image-service/imgproxy/imgproxy-image-service.d.ts +1 -1
- package/json-path/json-path.d.ts +4 -4
- package/key-value-store/key-value.store.d.ts +1 -1
- package/key-value-store/mongo/module.d.ts +1 -1
- package/key-value-store/mongo/mongo-key-value.model.d.ts +1 -1
- package/lock/lock.d.ts +4 -4
- package/lock/mongo/model.d.ts +1 -1
- package/lock/mongo/module.d.ts +1 -1
- package/lock/provider.d.ts +1 -1
- package/logger/logger.d.ts +6 -6
- package/mail/mail.client.d.ts +1 -1
- package/mail/models/mail-address.model.d.ts +1 -1
- package/mail/models/mail-content.model.d.ts +1 -1
- package/mail/models/mail-data.model.d.ts +1 -1
- package/mail/models/mail-log.model.d.ts +2 -2
- package/mail/models/mail-send-result.model.d.ts +1 -1
- package/mail/models/mail-template.model.d.ts +1 -1
- package/mail/module.d.ts +1 -1
- package/mail/repositories/mongo-mail-log.repository.d.ts +2 -2
- package/message-bus/local/types.d.ts +1 -1
- package/message-bus/message-bus.d.ts +1 -1
- package/migration/migration-state.d.ts +2 -2
- package/migration/migrator.d.ts +4 -4
- package/migration/mongo/module.d.ts +1 -1
- package/module/module-metric-reporter.d.ts +2 -2
- package/module/module.d.ts +1 -1
- package/module/modules/function.module.d.ts +1 -1
- package/module/modules/web-server.module.d.ts +1 -1
- package/notification/api.d.ts +1 -1
- package/notification/module.d.ts +1 -1
- package/object-storage/object-storage.d.ts +2 -2
- package/object-storage/object.d.ts +1 -1
- package/object-storage/s3/s3.object-storage-provider.d.ts +1 -1
- package/openid-connect/mongo-oidc-state.repository.d.ts +1 -1
- package/openid-connect/oidc-configuration.service.d.ts +1 -1
- package/openid-connect/oidc-state.model.d.ts +2 -2
- package/openid-connect/oidc.service-model.d.ts +8 -8
- package/orm/types.d.ts +4 -4
- package/package.json +3 -3
- package/pdf/pdf.service.d.ts +3 -3
- package/pool/pool.d.ts +4 -4
- package/promise/cancelable-promise.d.ts +1 -1
- package/promise/lazy-promise.d.ts +1 -1
- package/queue/mongo/job.d.ts +2 -2
- package/queue/mongo/queue.js +2 -2
- package/queue/mongo/queue.js.map +1 -1
- package/queue/queue.d.ts +11 -6
- package/queue/queue.js +2 -1
- package/queue/queue.js.map +1 -1
- package/reflection/registry.d.ts +9 -9
- package/reflection/types.d.ts +32 -32
- package/reflection/utils.d.ts +5 -5
- package/rpc/endpoints/message-port.rpc-endpoint.d.ts +3 -3
- package/rpc/model.d.ts +22 -22
- package/rpc/rpc.d.ts +1 -1
- package/rxjs/intersection-observer.d.ts +1 -1
- package/rxjs/mutation-observer.d.ts +1 -1
- package/rxjs/performance-observer.d.ts +1 -1
- package/rxjs/resize-observer.d.ts +1 -1
- package/rxjs/slow-array.d.ts +1 -1
- package/rxjs/touch.d.ts +1 -1
- package/schema/constraints/generic.d.ts +2 -2
- package/schema/constraints/length.d.ts +1 -1
- package/schema/decorators/types.d.ts +3 -3
- package/schema/schema.d.ts +4 -4
- package/schema/schema.error.d.ts +1 -1
- package/schema/schema.js +10 -13
- package/schema/schema.js.map +1 -1
- package/schema/schemas/any.d.ts +1 -1
- package/schema/schemas/array.d.ts +1 -1
- package/schema/schemas/boolean.d.ts +1 -1
- package/schema/schemas/date.d.ts +1 -1
- package/schema/schemas/enumeration.d.ts +1 -1
- package/schema/schemas/instance.d.ts +1 -1
- package/schema/schemas/literal.d.ts +1 -1
- package/schema/schemas/nullable.d.ts +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/object.d.ts +1 -1
- package/schema/schemas/one-or-many.d.ts +2 -2
- package/schema/schemas/optional.d.ts +1 -1
- package/schema/schemas/readable-stream.d.ts +1 -1
- package/schema/schemas/record.d.ts +1 -1
- package/schema/schemas/regexp.d.ts +1 -1
- package/schema/schemas/string.d.ts +1 -1
- package/schema/schemas/uint8-array.d.ts +1 -1
- package/schema/schemas/union.d.ts +1 -1
- package/schema/schemas/unknown.d.ts +1 -1
- package/schema/transformers/generic.d.ts +1 -1
- package/schema/types.d.ts +31 -31
- package/search-index/elastic/config.d.ts +1 -1
- package/search-index/elastic/model/elastic-query.d.ts +15 -15
- package/search-index/elastic/model/index-mapping.d.ts +14 -14
- package/search-index/elastic/model/sort.d.ts +3 -3
- package/search-index/elastic/module.d.ts +1 -1
- package/search-index/search-index.d.ts +1 -1
- package/search-index/search-result.d.ts +2 -2
- package/serializer/handlers/error.d.ts +1 -1
- package/serializer/handlers/map.d.ts +1 -1
- package/serializer/handlers/regex.d.ts +1 -1
- package/serializer/handlers/set.d.ts +1 -1
- package/serializer/serializable.d.ts +6 -6
- package/serializer/serializer.d.ts +1 -1
- package/serializer/types.d.ts +15 -15
- package/sse/server-sent-events.d.ts +3 -3
- package/tailwind/theme-adapter.d.ts +1 -1
- package/templates/module.d.ts +1 -1
- package/templates/providers/file.provider-template.d.ts +2 -2
- package/templates/providers/file.provider-template.js +2 -1
- package/templates/providers/file.provider-template.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.d.ts +9 -9
- package/templates/renderers/mjml.template-renderer.d.ts +3 -3
- package/templates/renderers/string.template-renderer.d.ts +1 -1
- package/templates/resolvers/file.template-resolver.d.ts +2 -2
- package/templates/template.model.d.ts +1 -1
- package/templates/template.renderer.d.ts +4 -4
- package/templates/template.service.d.ts +1 -1
- package/text/dynamic-text.model.d.ts +1 -1
- package/text/localizable-text.model.d.ts +1 -1
- package/text/localization.service.d.ts +11 -11
- package/theme/theme-service.d.ts +6 -6
- package/threading/thread-pool.d.ts +1 -1
- package/threading/thread-worker.d.ts +1 -1
- package/types/geo-json.d.ts +12 -12
- package/types.d.ts +91 -91
- package/utils/any-iterable-iterator.d.ts +3 -3
- package/utils/async-iterable-helpers/parallel/types.d.ts +2 -2
- package/utils/async-iterable-helpers/types.d.ts +7 -7
- package/utils/backoff.d.ts +5 -5
- package/utils/benchmark.d.ts +1 -1
- package/utils/binary-search.d.ts +1 -1
- package/utils/binary.js.map +1 -1
- package/utils/cancellation-token.d.ts +1 -1
- package/utils/compression.d.ts +1 -1
- package/utils/cryptography.d.ts +11 -11
- package/utils/date-time.d.ts +8 -7
- package/utils/date-time.js +6 -2
- package/utils/date-time.js.map +1 -1
- package/utils/equals.d.ts +3 -3
- package/utils/factory-map.d.ts +1 -1
- package/utils/format-error.d.ts +1 -1
- package/utils/function/memoize.d.ts +1 -1
- package/utils/helpers.d.ts +1 -1
- package/utils/iterable-helpers/types.d.ts +6 -6
- package/utils/jwt.d.ts +4 -4
- package/utils/math.d.ts +1 -1
- package/utils/merge.d.ts +1 -1
- package/utils/middleware.d.ts +9 -9
- package/utils/moving-metric.d.ts +1 -1
- package/utils/object/decycle.d.ts +1 -1
- package/utils/object/dereference.d.ts +1 -1
- package/utils/object/forward-ref.d.ts +2 -2
- package/utils/object/lazy-property.d.ts +5 -5
- package/utils/object/merge.d.ts +1 -1
- package/utils/object/property-name.d.ts +5 -5
- package/utils/patch-worker.d.ts +1 -1
- package/utils/periodic-sampler.d.ts +1 -1
- package/utils/provider-function-iterable.d.ts +2 -2
- package/utils/proxy.d.ts +1 -1
- package/utils/singleton.d.ts +2 -2
- package/utils/sort.d.ts +2 -2
- package/utils/stream/stream-helper-types.d.ts +5 -5
- package/utils/type-guards.d.ts +3 -3
- package/utils/url-builder.d.ts +4 -4
- package/web-types.d.ts +4 -4
package/api/client/client.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Injectable } from "../../container";
|
|
|
2
2
|
import type { HttpClientOptions } from "../../http/client";
|
|
3
3
|
import { HttpClient } from "../../http/client";
|
|
4
4
|
import type { ApiClientImplementation, ApiDefinition, ApiEndpointDefinition } from '../types';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ApiClient<T extends ApiDefinition> = new (httpClient: HttpClient) => ApiClientImplementation<T> & Injectable<HttpClientOptions>;
|
|
6
|
+
export type ClientOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* url prefix
|
|
9
9
|
* @default `api/`
|
|
@@ -11,7 +11,7 @@ export declare type ClientOptions = {
|
|
|
11
11
|
prefix?: string;
|
|
12
12
|
defaultHttpClientOptions?: HttpClientOptions;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ApiClientHttpRequestContext = {
|
|
15
15
|
endpoint: ApiEndpointDefinition;
|
|
16
16
|
};
|
|
17
17
|
export declare const httpClientSymbol: unique symbol;
|
package/api/response.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { CustomError, CustomErrorStatic } from '../error';
|
|
2
2
|
import type { UndefinableJson } from '../types';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
export type ErrorHandlerData = undefined | UndefinableJson;
|
|
4
|
+
export type ErrorSerializer<T extends CustomError, TData extends ErrorHandlerData> = (error: T) => TData;
|
|
5
|
+
export type ErrorDeserializer<T extends CustomError, TData extends ErrorHandlerData> = (data: TData, responseError: ResponseError) => T;
|
|
6
|
+
export type ErrorHandler<T extends CustomError = CustomError, TData extends ErrorHandlerData = undefined> = {
|
|
7
7
|
statusCode: number;
|
|
8
8
|
serializer: ErrorSerializer<T, TData>;
|
|
9
9
|
deserializer: ErrorDeserializer<T, TData>;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type ResultResponse<T> = {
|
|
12
12
|
result: T;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ErrorResponse = {
|
|
15
15
|
error: ResponseError;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
17
|
+
export type Response<T> = ResultResponse<T> | ErrorResponse;
|
|
18
|
+
export type ResponseError = {
|
|
19
19
|
name: string;
|
|
20
20
|
message: string;
|
|
21
21
|
details?: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InjectableOptionsWithoutLifecycle } from "../../container";
|
|
2
2
|
import type { Constructor, Type } from "../../types";
|
|
3
3
|
import type { ApiController, ApiDefinition } from '../types';
|
|
4
|
-
|
|
4
|
+
type ApiDefinitionProvider = () => ApiDefinition;
|
|
5
5
|
export declare const apiControllerDefinition: unique symbol;
|
|
6
6
|
export declare function getApiControllerDefinition(controller: Type): ApiDefinition;
|
|
7
7
|
export declare function isApiController(controller: Type): boolean;
|
package/api/server/gateway.d.ts
CHANGED
|
@@ -9,15 +9,15 @@ import type { AsyncMiddleware, AsyncMiddlewareNext } from "../../utils/middlewar
|
|
|
9
9
|
import 'urlpattern-polyfill';
|
|
10
10
|
import type { ApiController, ApiDefinition, ApiEndpointDefinition, ApiEndpointMethod, ApiEndpointServerImplementation } from '../types';
|
|
11
11
|
import type { CorsMiddlewareOptions } from './middlewares';
|
|
12
|
-
export
|
|
12
|
+
export type ApiGatewayMiddlewareContext = {
|
|
13
13
|
api: ApiItem;
|
|
14
14
|
/** can be undefined if used before allowedMethods middleware */
|
|
15
15
|
endpoint: GatewayEndpoint;
|
|
16
16
|
resourcePatternResult: URLPatternResult;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
18
|
+
export type ApiGatewayMiddlewareNext = AsyncMiddlewareNext<HttpServerRequest, HttpServerResponse>;
|
|
19
|
+
export type ApiGatewayMiddleware = AsyncMiddleware<HttpServerRequest, HttpServerResponse, ApiGatewayMiddlewareContext>;
|
|
20
|
+
export type ApiGatewayOptions = {
|
|
21
21
|
/**
|
|
22
22
|
* Api prefix. Pass `null` to disable prefix.
|
|
23
23
|
* @default api
|
|
@@ -35,18 +35,18 @@ export declare type ApiGatewayOptions = {
|
|
|
35
35
|
*/
|
|
36
36
|
defaultMaxBytes?: number;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type GatewayEndpoint = {
|
|
39
39
|
definition: ApiEndpointDefinition;
|
|
40
40
|
implementation: ApiEndpointServerImplementation;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type ApiItem = {
|
|
43
43
|
resource: string;
|
|
44
44
|
pattern: URLPattern;
|
|
45
45
|
endpoints: Map<ApiEndpointMethod, GatewayEndpoint>;
|
|
46
46
|
};
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
47
|
+
export type EndpointMetadataBodyType = 'none' | 'text' | 'json' | 'buffer' | 'stream';
|
|
48
|
+
export type ApiGatewayArgument = ApiGatewayOptions;
|
|
49
|
+
export type ApiMetadata = {
|
|
50
50
|
api: ApiItem;
|
|
51
51
|
patternResult: URLPatternResult;
|
|
52
52
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApiEndpointDefinitionCors } from "../../types";
|
|
2
2
|
import type { ApiGatewayMiddleware } from '../gateway';
|
|
3
|
-
export
|
|
3
|
+
export type CorsMiddlewareOptions = {
|
|
4
4
|
default?: ApiEndpointDefinitionCors;
|
|
5
5
|
};
|
|
6
6
|
export declare function corsMiddleware(options?: CorsMiddlewareOptions): ApiGatewayMiddleware;
|
package/api/server/module.d.ts
CHANGED
package/api/types.d.ts
CHANGED
|
@@ -3,26 +3,26 @@ import type { HttpMethod } from "../http/types";
|
|
|
3
3
|
import type { SchemaOutput, SchemaTestable } from "../schema";
|
|
4
4
|
import type { NonUndefinable, OneOrMany, Record, ReturnTypeOrT } from "../types";
|
|
5
5
|
import type { ApiGatewayMiddlewareContext } from './server';
|
|
6
|
-
export
|
|
6
|
+
export type ApiRegistrationOptions = {
|
|
7
7
|
name?: string;
|
|
8
8
|
prefix?: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type ApiRegistration = {
|
|
11
11
|
target: object;
|
|
12
12
|
name: string;
|
|
13
13
|
path: string;
|
|
14
14
|
prefix: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type EndpointRegistrationOptions = {
|
|
17
17
|
path?: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
20
|
+
export type ApiEndpointMethod = HttpMethod;
|
|
21
|
+
export type ApiEndpointDefinitionParameters = SchemaTestable;
|
|
22
|
+
export type ApiEndpointDefinitionBody = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
|
|
23
|
+
export type ApiEndpointDefinitionResult = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
|
|
24
|
+
export type ApiEndpointDataProvider<T> = T | ((request: HttpServerRequest, context: ApiGatewayMiddlewareContext) => T | Promise<T>);
|
|
25
|
+
export type ApiEndpointDefinitionCors = {
|
|
26
26
|
accessControlAllowCredentials?: ApiEndpointDataProvider<boolean | undefined>;
|
|
27
27
|
accessControlAllowHeaders?: ApiEndpointDataProvider<OneOrMany<string> | undefined>;
|
|
28
28
|
accessControlAllowMethods?: ApiEndpointDataProvider<OneOrMany<HttpMethod> | undefined>;
|
|
@@ -31,7 +31,7 @@ export declare type ApiEndpointDefinitionCors = {
|
|
|
31
31
|
accessControlExposeHeaders?: ApiEndpointDataProvider<OneOrMany<string> | undefined>;
|
|
32
32
|
accessControlMaxAge?: ApiEndpointDataProvider<number | undefined>;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type ApiEndpointDefinition = {
|
|
35
35
|
/**
|
|
36
36
|
* Http Method
|
|
37
37
|
* @default GET
|
|
@@ -67,7 +67,7 @@ export declare type ApiEndpointDefinition = {
|
|
|
67
67
|
data?: any;
|
|
68
68
|
cors?: ApiEndpointDefinitionCors;
|
|
69
69
|
};
|
|
70
|
-
export
|
|
70
|
+
export type ApiDefinition = {
|
|
71
71
|
/**
|
|
72
72
|
* Default root resource for endpoints.
|
|
73
73
|
*/
|
|
@@ -78,33 +78,33 @@ export declare type ApiDefinition = {
|
|
|
78
78
|
prefix?: string | null;
|
|
79
79
|
endpoints: Record<string, ApiEndpointDefinition | (() => ApiEndpointDefinition)>;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
82
|
-
export
|
|
81
|
+
export type ApiEndpointKeys<T extends ApiDefinition> = keyof T['endpoints'];
|
|
82
|
+
export type NormalizedApiEndpoints<T extends ApiDefinition['endpoints']> = {
|
|
83
83
|
[P in keyof T]: ReturnTypeOrT<T[P]>;
|
|
84
84
|
};
|
|
85
|
-
export
|
|
86
|
-
export
|
|
87
|
-
export
|
|
88
|
-
export
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
export
|
|
93
|
-
export
|
|
94
|
-
export
|
|
95
|
-
export
|
|
96
|
-
export
|
|
97
|
-
export
|
|
85
|
+
export type ApiEndpoint<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NormalizedApiEndpoints<T['endpoints']>[K];
|
|
86
|
+
export type ApiEndpointParametersSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['parameters']>;
|
|
87
|
+
export type ApiEndpointBodySchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['body']>;
|
|
88
|
+
export type ApiEndpointResultSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['result']>;
|
|
89
|
+
export type ApiBinaryType = typeof Uint8Array | typeof Blob | typeof ReadableStream;
|
|
90
|
+
export type ApiInputType<T extends SchemaTestable> = T extends ApiBinaryType ? (Uint8Array | Blob | ReadableStream<Uint8Array>) : T extends SchemaTestable ? SchemaOutput<T> : never;
|
|
91
|
+
export type ApiOutputType<T extends SchemaTestable> = T extends typeof ReadableStream ? ReadableStream<Uint8Array> : T extends SchemaTestable ? SchemaOutput<T> : never;
|
|
92
|
+
export type ApiParameters<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointParametersSchema<T, K>>;
|
|
93
|
+
export type ApiClientBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointBodySchema<T, K>>;
|
|
94
|
+
export type ApiServerBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointBodySchema<T, K>>;
|
|
95
|
+
export type ApiServerResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointResultSchema<T, K>> | HttpServerResponse;
|
|
96
|
+
export type ApiClientResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointResultSchema<T, K>>;
|
|
97
|
+
export type ApiRequestData<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = {
|
|
98
98
|
parameters: ApiParameters<T, K>;
|
|
99
99
|
body: ApiServerBody<T, K>;
|
|
100
100
|
request: HttpServerRequest;
|
|
101
101
|
};
|
|
102
|
-
export
|
|
103
|
-
export
|
|
104
|
-
export
|
|
102
|
+
export type ApiEndpointServerImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = (requestData: ApiRequestData<T, K>) => ApiServerResult<T, K> | Promise<ApiServerResult<T, K>>;
|
|
103
|
+
export type ApiEndpointClientImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = ApiClientBody<T, K> extends never ? ApiParameters<T, K> extends never ? () => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K>) => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K> extends never ? undefined | Record<never, never> : ApiParameters<T, K>, body: ApiClientBody<T, K>) => Promise<ApiClientResult<T, K>>;
|
|
104
|
+
export type ApiController<T extends ApiDefinition = any> = {
|
|
105
105
|
[P in ApiEndpointKeys<T>]: ApiEndpointServerImplementation<T, P>;
|
|
106
106
|
};
|
|
107
|
-
export
|
|
107
|
+
export type ApiClientImplementation<T extends ApiDefinition = any> = {
|
|
108
108
|
[P in ApiEndpointKeys<T>]: ApiEndpointClientImplementation<T, P>;
|
|
109
109
|
};
|
|
110
110
|
export declare function defineApi<T extends ApiDefinition>(definition: T): T;
|
package/api/utils.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AuthenticationCredentials } from './models';
|
|
2
|
+
export declare abstract class AuthenticationCredentialsService {
|
|
3
|
+
abstract has(subject: string): Promise<boolean>;
|
|
4
|
+
abstract tryGet(subject: string): Promise<AuthenticationCredentials | undefined>;
|
|
5
|
+
abstract save(credentials: AuthenticationCredentials): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthenticationCredentialsService = void 0;
|
|
10
|
+
const reflection_1 = require("../reflection");
|
|
11
|
+
let AuthenticationCredentialsService = class AuthenticationCredentialsService {
|
|
12
|
+
};
|
|
13
|
+
AuthenticationCredentialsService = __decorate([
|
|
14
|
+
(0, reflection_1.Class)()
|
|
15
|
+
], AuthenticationCredentialsService);
|
|
16
|
+
exports.AuthenticationCredentialsService = AuthenticationCredentialsService;
|
|
17
|
+
//# sourceMappingURL=authentication-credentials.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-credentials.service.js","sourceRoot":"","sources":["../../source/authentication/authentication-credentials.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAI9B,IAAe,gCAAgC,GAA/C,MAAe,gCAAgC;CAIrD,CAAA;AAJqB,gCAAgC;IADrD,IAAA,kBAAK,GAAE;GACc,gCAAgC,CAIrD;AAJqB,4EAAgC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AuthenticationSession } from './models';
|
|
2
|
+
export declare abstract class AuthenticationSessionService {
|
|
3
|
+
abstract has(subject: string): Promise<boolean>;
|
|
4
|
+
abstract tryGet(subject: string, tokenId: string): Promise<AuthenticationSession | undefined>;
|
|
5
|
+
abstract save(refreshToken: AuthenticationSession): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthenticationSessionService = void 0;
|
|
10
|
+
const reflection_1 = require("../reflection");
|
|
11
|
+
let AuthenticationSessionService = class AuthenticationSessionService {
|
|
12
|
+
};
|
|
13
|
+
AuthenticationSessionService = __decorate([
|
|
14
|
+
(0, reflection_1.Class)()
|
|
15
|
+
], AuthenticationSessionService);
|
|
16
|
+
exports.AuthenticationSessionService = AuthenticationSessionService;
|
|
17
|
+
//# sourceMappingURL=authentication-session.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-session.service.js","sourceRoot":"","sources":["../../source/authentication/authentication-session.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAI9B,IAAe,4BAA4B,GAA3C,MAAe,4BAA4B;CAIjD,CAAA;AAJqB,4BAA4B;IADjD,IAAA,kBAAK,GAAE;GACc,4BAA4B,CAIjD;AAJqB,oEAA4B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthenticationTokenPayloadProvider = void 0;
|
|
10
|
+
const reflection_1 = require("../reflection");
|
|
11
|
+
let AuthenticationTokenPayloadProvider = class AuthenticationTokenPayloadProvider {
|
|
12
|
+
};
|
|
13
|
+
AuthenticationTokenPayloadProvider = __decorate([
|
|
14
|
+
(0, reflection_1.Class)()
|
|
15
|
+
], AuthenticationTokenPayloadProvider);
|
|
16
|
+
exports.AuthenticationTokenPayloadProvider = AuthenticationTokenPayloadProvider;
|
|
17
|
+
//# sourceMappingURL=authentication-token-payload.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-token-payload.provider.js","sourceRoot":"","sources":["../../source/authentication/authentication-token-payload.provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAG9B,IAAe,kCAAkC,GAAjD,MAAe,kCAAkC;CAEvD,CAAA;AAFqB,kCAAkC;IADvD,IAAA,kBAAK,GAAE;GACc,kCAAkC,CAEvD;AAFqB,gFAAkC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { JwtToken, JwtTokenHeader } from "../utils/jwt";
|
|
2
|
+
import { AuthenticationCredentialsService } from './authentication-credentials.service';
|
|
3
|
+
import { AuthenticationSessionService } from './authentication-session.service';
|
|
4
|
+
import { AuthenticationTokenPayloadProvider } from './authentication-token-payload.provider';
|
|
5
|
+
export type Token<TokenPayload> = JwtToken<TokenPayload & {
|
|
6
|
+
jti: string;
|
|
7
|
+
iat: number;
|
|
8
|
+
exp: number;
|
|
9
|
+
}, JwtTokenHeader<TokenHeader>>;
|
|
10
|
+
export type TokenHeader = {
|
|
11
|
+
v: number;
|
|
12
|
+
};
|
|
13
|
+
export type AuthenticationServiceOptions = {
|
|
14
|
+
/** Secret used for signing tokens */
|
|
15
|
+
secret: string;
|
|
16
|
+
/** Token version, forces refresh on mismatch (useful if payload changes) */
|
|
17
|
+
version?: number;
|
|
18
|
+
/** How long a token is valid */
|
|
19
|
+
tokenTimeToLive?: number;
|
|
20
|
+
/** How long a session is valid after a refreshed. Cannot be refreshed (new token issued) after it timed out. */
|
|
21
|
+
sessionTimeToLive?: number;
|
|
22
|
+
};
|
|
23
|
+
export type AuthenticationResult = {
|
|
24
|
+
token: string;
|
|
25
|
+
refreshToken: string;
|
|
26
|
+
};
|
|
27
|
+
export declare class AuthenticationService<TokenPayload, AdditionalAuthenticationData> {
|
|
28
|
+
private readonly credentialsService;
|
|
29
|
+
private readonly authenticationSessionService;
|
|
30
|
+
private readonly tokenPayloadProviderService;
|
|
31
|
+
private readonly secret;
|
|
32
|
+
private readonly tokenVersion;
|
|
33
|
+
private readonly tokenTimeToLive;
|
|
34
|
+
private readonly sessionTimeToLive;
|
|
35
|
+
constructor(credentialsService: AuthenticationCredentialsService, authenticationSessionService: AuthenticationSessionService, tokenPayloadProviderService: AuthenticationTokenPayloadProvider<TokenPayload, AdditionalAuthenticationData>, options: AuthenticationServiceOptions);
|
|
36
|
+
updateCredentials(subject: string, secret: string): Promise<void>;
|
|
37
|
+
authenticate(subject: string, secret: string, additionalAuthenticationData: AdditionalAuthenticationData): Promise<AuthenticationResult>;
|
|
38
|
+
validate(token: string): Promise<Token<TokenPayload>>;
|
|
39
|
+
private createToken;
|
|
40
|
+
private createRefreshToken;
|
|
41
|
+
private getHash;
|
|
42
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthenticationService = void 0;
|
|
16
|
+
const container_1 = require("../container");
|
|
17
|
+
const error_1 = require("../error");
|
|
18
|
+
const invalid_token_error_1 = require("../error/invalid-token.error");
|
|
19
|
+
const alphabet_1 = require("../utils/alphabet");
|
|
20
|
+
const cryptography_1 = require("../utils/cryptography");
|
|
21
|
+
const date_time_1 = require("../utils/date-time");
|
|
22
|
+
const equals_1 = require("../utils/equals");
|
|
23
|
+
const jwt_1 = require("../utils/jwt");
|
|
24
|
+
const random_1 = require("../utils/random");
|
|
25
|
+
const type_guards_1 = require("../utils/type-guards");
|
|
26
|
+
const units_1 = require("../utils/units");
|
|
27
|
+
const authentication_credentials_service_1 = require("./authentication-credentials.service");
|
|
28
|
+
const authentication_session_service_1 = require("./authentication-session.service");
|
|
29
|
+
const authentication_token_payload_provider_1 = require("./authentication-token-payload.provider");
|
|
30
|
+
const tokens_1 = require("./tokens");
|
|
31
|
+
let AuthenticationService = class AuthenticationService {
|
|
32
|
+
credentialsService;
|
|
33
|
+
authenticationSessionService;
|
|
34
|
+
tokenPayloadProviderService;
|
|
35
|
+
secret;
|
|
36
|
+
tokenVersion;
|
|
37
|
+
tokenTimeToLive;
|
|
38
|
+
sessionTimeToLive;
|
|
39
|
+
constructor(credentialsService, authenticationSessionService, tokenPayloadProviderService, options) {
|
|
40
|
+
this.credentialsService = credentialsService;
|
|
41
|
+
this.authenticationSessionService = authenticationSessionService;
|
|
42
|
+
this.tokenPayloadProviderService = tokenPayloadProviderService;
|
|
43
|
+
this.secret = options.secret;
|
|
44
|
+
this.tokenVersion = options.version ?? 1;
|
|
45
|
+
this.tokenTimeToLive = options.tokenTimeToLive ?? (5 * units_1.millisecondsPerMinute);
|
|
46
|
+
this.sessionTimeToLive = options.sessionTimeToLive ?? (5 * units_1.millisecondsPerDay);
|
|
47
|
+
}
|
|
48
|
+
async updateCredentials(subject, secret) {
|
|
49
|
+
const salt = (0, random_1.getRandomBytes)(32);
|
|
50
|
+
const hash = await this.getHash(secret, salt);
|
|
51
|
+
const credentials = {
|
|
52
|
+
subject,
|
|
53
|
+
hashVersion: 1,
|
|
54
|
+
salt,
|
|
55
|
+
hash
|
|
56
|
+
};
|
|
57
|
+
await this.credentialsService.save(credentials);
|
|
58
|
+
}
|
|
59
|
+
async authenticate(subject, secret, additionalAuthenticationData) {
|
|
60
|
+
const credentials = await this.credentialsService.tryGet(subject);
|
|
61
|
+
if ((0, type_guards_1.isUndefined)(credentials)) {
|
|
62
|
+
throw new error_1.UnauthorizedError('Invalid credentials.');
|
|
63
|
+
}
|
|
64
|
+
const hash = await this.getHash(secret, credentials.salt);
|
|
65
|
+
if (!(0, equals_1.binaryEquals)(hash, credentials.hash)) {
|
|
66
|
+
throw new error_1.UnauthorizedError('Invalid credentials.');
|
|
67
|
+
}
|
|
68
|
+
const now = (0, date_time_1.currentTimestamp)();
|
|
69
|
+
const tokenPayload = await this.tokenPayloadProviderService.getTokenPayload(subject, additionalAuthenticationData);
|
|
70
|
+
const { token, payload } = await this.createToken(tokenPayload, now);
|
|
71
|
+
const refreshToken = await this.createRefreshToken();
|
|
72
|
+
await this.authenticationSessionService.save({
|
|
73
|
+
subject,
|
|
74
|
+
begin: now,
|
|
75
|
+
end: now + this.sessionTimeToLive,
|
|
76
|
+
tokenId: payload.jti,
|
|
77
|
+
hashVersion: 1,
|
|
78
|
+
refreshTokenSalt: refreshToken.salt,
|
|
79
|
+
refreshTokenHash: refreshToken.hash
|
|
80
|
+
});
|
|
81
|
+
return { token, refreshToken: refreshToken.token };
|
|
82
|
+
}
|
|
83
|
+
/*
|
|
84
|
+
async refresh(subject: string, tokenId: string, refreshToken: string): Promise<string> {
|
|
85
|
+
const session = await this.authenticationSessionService.tryGet(subject, tokenId);
|
|
86
|
+
}
|
|
87
|
+
*/
|
|
88
|
+
async validate(token) {
|
|
89
|
+
const validatedToken = await (0, jwt_1.parseAndValidateJwtTokenString)(token, 'HS256', this.secret);
|
|
90
|
+
if (validatedToken.header.v != this.tokenVersion) {
|
|
91
|
+
throw new invalid_token_error_1.InvalidTokenError('Invalid token version.');
|
|
92
|
+
}
|
|
93
|
+
return validatedToken;
|
|
94
|
+
}
|
|
95
|
+
async createToken(tokenPayload, timestamp = (0, date_time_1.currentTimestamp)()) {
|
|
96
|
+
const header = {
|
|
97
|
+
v: this.tokenVersion,
|
|
98
|
+
alg: 'HS256',
|
|
99
|
+
typ: 'JWT'
|
|
100
|
+
};
|
|
101
|
+
const payload = {
|
|
102
|
+
jti: (0, random_1.getRandomString)(24, alphabet_1.Alphabet.LowerUpperCaseNumbers),
|
|
103
|
+
iat: (0, date_time_1.timestampToTimestampSeconds)(timestamp),
|
|
104
|
+
exp: (0, date_time_1.timestampToTimestampSeconds)(timestamp + this.tokenTimeToLive),
|
|
105
|
+
...tokenPayload
|
|
106
|
+
};
|
|
107
|
+
const token = await (0, jwt_1.createJwtTokenString)({
|
|
108
|
+
header,
|
|
109
|
+
payload
|
|
110
|
+
}, this.secret);
|
|
111
|
+
return { header, payload, token };
|
|
112
|
+
}
|
|
113
|
+
async createRefreshToken() {
|
|
114
|
+
const token = (0, random_1.getRandomString)(64, alphabet_1.Alphabet.LowerUpperCaseNumbers);
|
|
115
|
+
const salt = (0, random_1.getRandomBytes)(32);
|
|
116
|
+
const hash = await this.getHash(token, salt);
|
|
117
|
+
return { token, salt, hash: new Uint8Array(hash) };
|
|
118
|
+
}
|
|
119
|
+
async getHash(password, salt) {
|
|
120
|
+
const key = await (0, cryptography_1.importPbkdf2Key)(password);
|
|
121
|
+
const hash = await (0, cryptography_1.deriveBits)({ name: 'PBKDF2', hash: 'SHA-512', iterations: 250000, salt }, key, 384);
|
|
122
|
+
return new Uint8Array(hash);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
AuthenticationService = __decorate([
|
|
126
|
+
(0, container_1.singleton)(),
|
|
127
|
+
__param(3, (0, container_1.inject)(tokens_1.AUTHENTICATION_SERVICE_OPTIONS)),
|
|
128
|
+
__metadata("design:paramtypes", [authentication_credentials_service_1.AuthenticationCredentialsService,
|
|
129
|
+
authentication_session_service_1.AuthenticationSessionService,
|
|
130
|
+
authentication_token_payload_provider_1.AuthenticationTokenPayloadProvider, Object])
|
|
131
|
+
], AuthenticationService);
|
|
132
|
+
exports.AuthenticationService = AuthenticationService;
|
|
133
|
+
//# sourceMappingURL=authentication.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../source/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAgD;AAChD,oCAA4C;AAC5C,sEAAgE;AAChE,gDAA4C;AAC5C,wDAAmE;AACnE,kDAAkF;AAClF,4CAA8C;AAE9C,sCAAmF;AACnF,4CAAiE;AACjE,sDAAkD;AAClD,0CAA0E;AAC1E,6FAAwF;AACxF,qFAAgF;AAChF,mGAA6F;AAE7F,qCAA0D;AAwCnD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACf,kBAAkB,CAAmC;IACrD,4BAA4B,CAA+B;IAC3D,2BAA2B,CAAiF;IAE5G,MAAM,CAAS;IACf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,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAEvG,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF,CAAA;AA5HY,qBAAqB;IADjC,IAAA,qBAAS,GAAE;IAeP,WAAA,IAAA,kBAAM,EAAC,uCAA8B,CAAC,CAAA;qCAHnB,qEAAgC;QACtB,6DAA4B;QAC7B,0EAAkC;GAbtD,qBAAqB,CA4HjC;AA5HY,sDAAqB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuthenticationCredentials = void 0;
|
|
13
|
+
const schema_1 = require("../../schema");
|
|
14
|
+
class AuthenticationCredentials {
|
|
15
|
+
subject;
|
|
16
|
+
hashVersion;
|
|
17
|
+
salt;
|
|
18
|
+
hash;
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, schema_1.Property)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], AuthenticationCredentials.prototype, "subject", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, schema_1.Property)(),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], AuthenticationCredentials.prototype, "hashVersion", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, schema_1.Property)(),
|
|
30
|
+
__metadata("design:type", Uint8Array)
|
|
31
|
+
], AuthenticationCredentials.prototype, "salt", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, schema_1.Property)(),
|
|
34
|
+
__metadata("design:type", Uint8Array)
|
|
35
|
+
], AuthenticationCredentials.prototype, "hash", void 0);
|
|
36
|
+
exports.AuthenticationCredentials = AuthenticationCredentials;
|
|
37
|
+
//# sourceMappingURL=authentication-credentials.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-credentials.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-credentials.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,MAAa,yBAAyB;IAEpC,OAAO,CAAS;IAGhB,WAAW,CAAS;IAGpB,IAAI,CAAa;IAGjB,IAAI,CAAa;CAClB;AAXC;IAAC,IAAA,iBAAQ,GAAE;;0DACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;8DACS;AAEpB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAEjB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAXnB,8DAYC"}
|