@tstdl/base 0.78.0-beta5 → 0.78.0-beta50
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 +2 -1
- package/api/client/client.js +6 -13
- package/api/client/client.js.map +1 -1
- package/api/response.js.map +1 -1
- package/api/server/gateway.js +4 -5
- package/api/server/gateway.js.map +1 -1
- package/api/types.d.ts +13 -2
- package/api/types.js +1 -2
- package/api/types.js.map +1 -1
- package/api/utils.d.ts +9 -0
- package/api/utils.js +15 -0
- package/api/utils.js.map +1 -0
- package/application/application.js.map +1 -1
- package/container/container.js.map +1 -1
- package/container/decorators.d.ts +1 -1
- package/container/decorators.js.map +1 -1
- package/css/theme/theme.service.js.map +1 -1
- package/data-structures/iterable-weak-map.js +1 -1
- package/data-structures/iterable-weak-map.js.map +1 -1
- package/data-structures/linked-list.js.map +1 -1
- package/data-structures/sorted-array-list.js.map +1 -1
- package/database/mongo/classes.js.map +1 -1
- package/database/mongo/mongo-entity-repository.js +2 -2
- package/database/mongo/mongo-entity-repository.js.map +1 -1
- package/distributed-loop/distributed-loop.js.map +1 -1
- package/distributed-loop/provider.js.map +1 -1
- package/error/custom.error.d.ts +2 -2
- package/error/custom.error.js +13 -7
- package/error/custom.error.js.map +1 -1
- package/examples/api/basic-overview.js +0 -1
- package/examples/api/basic-overview.js.map +1 -1
- package/examples/mail/basic.js +12 -7
- package/examples/mail/basic.js.map +1 -1
- package/examples/mail/templates/hello-name.d.ts +2 -0
- package/examples/mail/templates/hello-name.js +11 -0
- package/examples/mail/templates/hello-name.js.map +1 -0
- package/examples/pdf/basic.js +6 -3
- package/examples/pdf/basic.js.map +1 -1
- package/examples/pdf/templates/hello-name.d.ts +1 -4
- package/examples/pdf/templates/hello-name.js +16 -4
- package/examples/pdf/templates/hello-name.js.map +1 -1
- package/examples/reflection/basic.js +1 -1
- package/examples/reflection/basic.js.map +1 -1
- package/http/client/adapters/got-http-client.adapter.js.map +1 -1
- package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
- package/http/client/adapters/utils.js +20 -8
- package/http/client/adapters/utils.js.map +1 -1
- package/http/client/http-client-request.d.ts +13 -3
- package/http/client/http-client-request.js +4 -0
- package/http/client/http-client-request.js.map +1 -1
- package/http/client/http-client.d.ts +0 -3
- package/http/client/http-client.js +31 -24
- package/http/client/http-client.js.map +1 -1
- package/http/http-headers.d.ts +2 -0
- package/http/http-headers.js +6 -0
- package/http/http-headers.js.map +1 -1
- package/http/server/node/node-http-server.js.map +1 -1
- package/image-service/image-service.js.map +1 -1
- package/image-service/imgproxy/imgproxy-image-service.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value-store.provider.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.repository.js.map +1 -1
- package/key-value-store/mongo/mongo-key-value.store.js.map +1 -1
- package/lock/mongo/lock.js.map +1 -1
- package/lock/mongo/mongo-lock-repository.js.map +1 -1
- package/lock/mongo/provider.js.map +1 -1
- package/logger/console/logger.js.map +1 -1
- package/mail/clients/nodemailer.mail-client.js.map +1 -1
- package/mail/index.d.ts +0 -3
- package/mail/index.js +0 -3
- package/mail/index.js.map +1 -1
- package/mail/mail.service.d.ts +3 -5
- package/mail/mail.service.js +8 -14
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-template.model.d.ts +11 -10
- package/mail/models/mail-template.model.js +7 -0
- package/mail/models/mail-template.model.js.map +1 -1
- package/mail/module.d.ts +1 -5
- package/mail/module.js +2 -11
- package/mail/module.js.map +1 -1
- package/mail/repositories/mongo-mail-log.repository.js.map +1 -1
- package/mail/tokens.d.ts +0 -3
- package/mail/tokens.js +1 -2
- package/mail/tokens.js.map +1 -1
- package/message-bus/local/local-message-bus-provider.js.map +1 -1
- package/message-bus/local/local-message-bus.js.map +1 -1
- package/migration/migrator.js.map +1 -1
- package/migration/mongo/migration-state-repository.js.map +1 -1
- package/module/modules/web-server.module.js.map +1 -1
- package/object-storage/s3/s3.object-storage-provider.js.map +1 -1
- package/object-storage/s3/s3.object-storage.js.map +1 -1
- package/openid-connect/cached-oidc-configuration.service.js.map +1 -1
- package/openid-connect/mongo-oidc-state.repository.js.map +1 -1
- package/openid-connect/oidc-configuration.service.d.ts +2 -1
- package/openid-connect/oidc-configuration.service.js +5 -3
- package/openid-connect/oidc-configuration.service.js.map +1 -1
- package/openid-connect/oidc.service-model.d.ts +11 -3
- package/openid-connect/oidc.service.d.ts +6 -3
- package/openid-connect/oidc.service.js +69 -23
- package/openid-connect/oidc.service.js.map +1 -1
- package/package.json +7 -8
- package/pdf/pdf.service.d.ts +48 -10
- package/pdf/pdf.service.js +123 -13
- package/pdf/pdf.service.js.map +1 -1
- package/promise/deferred-promise.d.ts +2 -15
- package/promise/deferred-promise.js +5 -10
- package/promise/deferred-promise.js.map +1 -1
- package/promise/index.d.ts +1 -0
- package/promise/index.js +1 -0
- package/promise/index.js.map +1 -1
- package/promise/lazy-promise.d.ts +11 -0
- package/promise/lazy-promise.js +31 -0
- package/promise/lazy-promise.js.map +1 -0
- package/queue/mongo/mongo-job.repository.js +1 -1
- package/queue/mongo/mongo-job.repository.js.map +1 -1
- package/queue/mongo/queue.js.map +1 -1
- package/queue/mongo/queue.provider.js.map +1 -1
- package/reflection/decorator-data.js +1 -1
- package/reflection/decorator-data.js.map +1 -1
- package/reflection/decorators.d.ts +2 -2
- package/reflection/decorators.js +7 -7
- package/reflection/decorators.js.map +1 -1
- package/reflection/registry.d.ts +8 -8
- package/reflection/registry.js +1 -1
- package/reflection/registry.js.map +1 -1
- package/reflection/types.d.ts +3 -2
- package/reflection/utils.d.ts +7 -2
- package/reflection/utils.js +38 -12
- package/reflection/utils.js.map +1 -1
- package/schema/array-constraints/maximum-length.d.ts +2 -2
- package/schema/array-constraints/maximum-length.js +3 -3
- package/schema/array-constraints/maximum-length.js.map +1 -1
- package/schema/array-constraints/minimum-length.d.ts +2 -2
- package/schema/array-constraints/minimum-length.js +3 -3
- package/schema/array-constraints/minimum-length.js.map +1 -1
- package/schema/coercers/boolean.coercer.d.ts +2 -2
- package/schema/coercers/boolean.coercer.js +2 -2
- package/schema/coercers/boolean.coercer.js.map +1 -1
- package/schema/coercers/date.coercer.d.ts +2 -2
- package/schema/coercers/date.coercer.js +2 -2
- package/schema/coercers/date.coercer.js.map +1 -1
- package/schema/coercers/number.coercer.d.ts +2 -2
- package/schema/coercers/number.coercer.js +2 -2
- package/schema/coercers/number.coercer.js.map +1 -1
- package/schema/coercers/regexp.coercer.d.ts +2 -2
- package/schema/coercers/regexp.coercer.js +2 -2
- package/schema/coercers/regexp.coercer.js.map +1 -1
- package/schema/coercers/string.coercer.d.ts +2 -2
- package/schema/coercers/string.coercer.js +2 -2
- package/schema/coercers/string.coercer.js.map +1 -1
- package/schema/coercers/uint8-array.coercer.js +2 -2
- package/schema/coercers/uint8-array.coercer.js.map +1 -1
- package/schema/constraints/enumeration.d.ts +5 -5
- package/schema/constraints/enumeration.js +3 -3
- package/schema/constraints/enumeration.js.map +1 -1
- package/schema/constraints/generic.d.ts +2 -2
- package/schema/constraints/generic.js +3 -3
- package/schema/constraints/generic.js.map +1 -1
- package/schema/constraints/integer.d.ts +2 -2
- package/schema/constraints/integer.js +3 -3
- package/schema/constraints/integer.js.map +1 -1
- package/schema/constraints/literal.d.ts +2 -2
- package/schema/constraints/literal.js +3 -3
- package/schema/constraints/literal.js.map +1 -1
- package/schema/constraints/maximum-date.d.ts +2 -2
- package/schema/constraints/maximum-date.js +3 -3
- package/schema/constraints/maximum-date.js.map +1 -1
- package/schema/constraints/maximum-length.d.ts +2 -2
- package/schema/constraints/maximum-length.js +3 -3
- package/schema/constraints/maximum-length.js.map +1 -1
- package/schema/constraints/maximum.d.ts +2 -2
- package/schema/constraints/maximum.js +3 -3
- package/schema/constraints/maximum.js.map +1 -1
- package/schema/constraints/minimum-date.d.ts +2 -2
- package/schema/constraints/minimum-date.js +3 -3
- package/schema/constraints/minimum-date.js.map +1 -1
- package/schema/constraints/minimum-length.d.ts +2 -2
- package/schema/constraints/minimum-length.js +3 -3
- package/schema/constraints/minimum-length.js.map +1 -1
- package/schema/constraints/minimum.d.ts +2 -2
- package/schema/constraints/minimum.js +3 -3
- package/schema/constraints/minimum.js.map +1 -1
- package/schema/constraints/pattern.d.ts +2 -2
- package/schema/constraints/pattern.js +3 -3
- package/schema/constraints/pattern.js.map +1 -1
- package/schema/decorators/optional.d.ts +3 -1
- package/schema/decorators/optional.js +2 -2
- package/schema/decorators/optional.js.map +1 -1
- package/schema/decorators/types.d.ts +3 -3
- package/schema/schema.d.ts +0 -4
- package/schema/schema.error.d.ts +5 -4
- package/schema/schema.error.js +3 -3
- package/schema/schema.error.js.map +1 -1
- package/schema/schema.js +85 -106
- package/schema/schema.js.map +1 -1
- package/schema/schemas/assign.d.ts +5 -5
- package/schema/schemas/assign.js.map +1 -1
- package/schema/schemas/exclude.d.ts +4 -1
- package/schema/schemas/exclude.js +6 -11
- package/schema/schemas/exclude.js.map +1 -1
- package/schema/schemas/index.d.ts +2 -0
- package/schema/schemas/index.js +2 -0
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/number.d.ts +1 -1
- package/schema/schemas/number.js.map +1 -1
- package/schema/schemas/omit.d.ts +4 -0
- package/schema/schemas/omit.js +17 -0
- package/schema/schemas/omit.js.map +1 -0
- package/schema/schemas/union.d.ts +2 -7
- package/schema/schemas/union.js.map +1 -1
- package/schema/types.d.ts +25 -18
- package/schema/types.js +17 -4
- package/schema/types.js.map +1 -1
- package/schema/utils/schema.d.ts +3 -0
- package/schema/utils/schema.js +44 -2
- package/schema/utils/schema.js.map +1 -1
- package/schema/utils/value-type.d.ts +2 -2
- package/schema/utils/value-type.js +11 -1
- package/schema/utils/value-type.js.map +1 -1
- package/search-index/elastic/config.js.map +1 -1
- package/search-index/elastic/model/index-mapping.d.ts +2 -1
- package/search-index/elastic/model/index-mapping.js.map +1 -1
- package/search-index/elastic/search-index.js +1 -1
- package/search-index/elastic/search-index.js.map +1 -1
- package/serializer/serializable.d.ts +4 -4
- package/serializer/serializable.js.map +1 -1
- package/templates/index.d.ts +2 -0
- package/templates/index.js +2 -0
- package/templates/index.js.map +1 -1
- package/templates/module.d.ts +3 -1
- package/templates/module.js +31 -8
- package/templates/module.js.map +1 -1
- package/templates/providers/file.provider-template.d.ts +16 -0
- package/templates/providers/{file-template.provider.js → file.provider-template.js} +22 -15
- package/templates/providers/file.provider-template.js.map +1 -0
- package/templates/providers/memory.template-provider.d.ts +8 -0
- package/templates/providers/{memory-template.provider.base.js → memory.template-provider.js} +8 -6
- package/templates/providers/memory.template-provider.js.map +1 -0
- package/templates/renderers/handlebars.template-renderer.d.ts +38 -6
- package/templates/renderers/handlebars.template-renderer.js +47 -3
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/renderers/mjml.template-renderer.d.ts +6 -6
- package/templates/renderers/mjml.template-renderer.js +8 -9
- package/templates/renderers/mjml.template-renderer.js.map +1 -1
- package/templates/renderers/string.template-renderer.d.ts +8 -0
- package/{mail/template-providers/memory-mail-template.provider.js → templates/renderers/string.template-renderer.js} +13 -7
- package/templates/renderers/string.template-renderer.js.map +1 -0
- package/templates/resolvers/file.template-resolver.d.ts +23 -0
- package/templates/resolvers/file.template-resolver.js +63 -0
- package/templates/resolvers/file.template-resolver.js.map +1 -0
- package/templates/resolvers/string.template-resolver.d.ts +13 -0
- package/templates/resolvers/string.template-resolver.js +44 -0
- package/templates/resolvers/string.template-resolver.js.map +1 -0
- package/templates/template-renderer.provider.js +7 -19
- package/templates/template-renderer.provider.js.map +1 -1
- package/templates/template-resolver.provider.d.ts +8 -0
- package/templates/template-resolver.provider.js +48 -0
- package/templates/template-resolver.provider.js.map +1 -0
- package/templates/template.model.d.ts +15 -4
- package/templates/template.model.js +50 -0
- package/templates/template.model.js.map +1 -1
- package/templates/template.renderer.d.ts +14 -3
- package/templates/template.renderer.js +3 -0
- package/templates/template.renderer.js.map +1 -1
- package/templates/template.resolver.d.ts +5 -0
- package/templates/template.resolver.js +7 -0
- package/templates/template.resolver.js.map +1 -0
- package/templates/template.service.d.ts +10 -4
- package/templates/template.service.js +19 -6
- package/templates/template.service.js.map +1 -1
- package/templates/tokens.d.ts +3 -2
- package/templates/tokens.js +2 -1
- package/templates/tokens.js.map +1 -1
- package/threading/index.d.ts +1 -0
- package/threading/index.js +18 -0
- package/threading/index.js.map +1 -0
- package/threading/message-proxy.d.ts +66 -0
- package/threading/message-proxy.js +34 -0
- package/threading/message-proxy.js.map +1 -0
- package/threading/thread-pool.d.ts +4 -0
- package/threading/thread-pool.js +10 -0
- package/threading/thread-pool.js.map +1 -0
- package/threading/thread.d.ts +16 -0
- package/threading/thread.js +30 -0
- package/threading/thread.js.map +1 -0
- package/types.d.ts +20 -7
- package/utils/array/array.d.ts +1 -2
- package/utils/array/array.js.map +1 -1
- package/utils/clone.js +4 -0
- package/utils/clone.js.map +1 -1
- package/utils/compression.d.ts +13 -13
- package/utils/compression.js +10 -9
- package/utils/compression.js.map +1 -1
- package/utils/encoding.js +1 -1
- package/utils/encoding.js.map +1 -1
- package/utils/enum.d.ts +5 -8
- package/utils/enum.js +15 -13
- package/utils/enum.js.map +1 -1
- package/utils/function/memoize.js +4 -4
- package/utils/function/memoize.js.map +1 -1
- package/utils/helpers.d.ts +0 -2
- package/utils/helpers.js +1 -12
- package/utils/helpers.js.map +1 -1
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/utils/object/forward-ref.js +3 -19
- package/utils/object/forward-ref.js.map +1 -1
- package/utils/object/property-name.d.ts +2 -2
- package/utils/proxy.d.ts +6 -0
- package/utils/proxy.js +21 -0
- package/utils/proxy.js.map +1 -0
- package/utils/throw.d.ts +2 -0
- package/utils/throw.js +15 -0
- package/utils/throw.js.map +1 -0
- package/utils/type-guards.d.ts +13 -1
- package/utils/type-guards.js +29 -5
- package/utils/type-guards.js.map +1 -1
- package/web-types.d.ts +28 -0
- package/web-types.js +3 -0
- package/web-types.js.map +1 -0
- package/mail/mail-template-renderer.provider.d.ts +0 -8
- package/mail/mail-template-renderer.provider.js +0 -60
- package/mail/mail-template-renderer.provider.js.map +0 -1
- package/mail/mail-template.provider.d.ts +0 -4
- package/mail/mail-template.provider.js +0 -7
- package/mail/mail-template.provider.js.map +0 -1
- package/mail/mail-template.renderer.d.ts +0 -10
- package/mail/mail-template.renderer.js +0 -7
- package/mail/mail-template.renderer.js.map +0 -1
- package/mail/template-providers/file-mail-template.provider.d.ts +0 -24
- package/mail/template-providers/file-mail-template.provider.js +0 -51
- package/mail/template-providers/file-mail-template.provider.js.map +0 -1
- package/mail/template-providers/memory-mail-template.provider.d.ts +0 -6
- package/mail/template-providers/memory-mail-template.provider.js.map +0 -1
- package/mail/template-renderers/handlebars.mail-template-renderer.d.ts +0 -13
- package/mail/template-renderers/handlebars.mail-template-renderer.js +0 -49
- package/mail/template-renderers/handlebars.mail-template-renderer.js.map +0 -1
- package/mail/template-renderers/mjml.mail-template-renderer.d.ts +0 -14
- package/mail/template-renderers/mjml.mail-template-renderer.js +0 -63
- package/mail/template-renderers/mjml.mail-template-renderer.js.map +0 -1
- package/templates/providers/file-template.provider.base.d.ts +0 -12
- package/templates/providers/file-template.provider.base.js +0 -50
- package/templates/providers/file-template.provider.base.js.map +0 -1
- package/templates/providers/file-template.provider.d.ts +0 -22
- package/templates/providers/file-template.provider.js.map +0 -1
- package/templates/providers/memory-template.provider.base.d.ts +0 -9
- package/templates/providers/memory-template.provider.base.js.map +0 -1
- package/templates/providers/memory-template.provider.d.ts +0 -4
- package/templates/providers/memory-template.provider.js +0 -18
- package/templates/providers/memory-template.provider.js.map +0 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { PickBy, Record, SimplifyObject } from "../types";
|
|
2
|
+
export declare class TemplateField<Resolver extends string = string, Renderer extends string = string, Options = any> {
|
|
3
|
+
resolver: Resolver;
|
|
4
|
+
renderer: Renderer;
|
|
4
5
|
options?: Options;
|
|
5
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare type TemplateFields<Fields extends Record<string, boolean>, Resolver extends string = string, Renderer extends string = string, Options = any> = SimplifyObject<{
|
|
8
|
+
[P in keyof PickBy<Fields, true>]: TemplateField<Resolver, Renderer, Options>;
|
|
9
|
+
} & {
|
|
10
|
+
[P in keyof PickBy<Fields, false>]?: TemplateField<Resolver, Renderer, Options>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare abstract class Template<Fields extends Record<string, boolean> = Record<string, boolean>, TemplateOptions = any> {
|
|
13
|
+
fields: TemplateFields<Fields>;
|
|
14
|
+
options?: TemplateOptions;
|
|
15
|
+
}
|
|
16
|
+
export declare function simpleTemplate(template: TemplateField): Template;
|
|
@@ -1,3 +1,53 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.simpleTemplate = exports.Template = exports.TemplateField = void 0;
|
|
13
|
+
const schema_1 = require("../schema");
|
|
14
|
+
let TemplateField = class TemplateField {
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, schema_1.Property)(),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], TemplateField.prototype, "resolver", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, schema_1.Property)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], TemplateField.prototype, "renderer", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, schema_1.Any)(),
|
|
26
|
+
(0, schema_1.Optional)(),
|
|
27
|
+
__metadata("design:type", Object)
|
|
28
|
+
], TemplateField.prototype, "options", void 0);
|
|
29
|
+
TemplateField = __decorate([
|
|
30
|
+
(0, schema_1.Type)({ allowUnknownProperties: (0, schema_1.any)() })
|
|
31
|
+
], TemplateField);
|
|
32
|
+
exports.TemplateField = TemplateField;
|
|
33
|
+
class Template {
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, schema_1.Property)({ schema: (0, schema_1.object)({}, { allowUnknownProperties: TemplateField }) }),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], Template.prototype, "fields", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, schema_1.Any)(),
|
|
41
|
+
(0, schema_1.Optional)(),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], Template.prototype, "options", void 0);
|
|
44
|
+
exports.Template = Template;
|
|
45
|
+
function simpleTemplate(template) {
|
|
46
|
+
return {
|
|
47
|
+
fields: {
|
|
48
|
+
template
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.simpleTemplate = simpleTemplate;
|
|
3
53
|
//# sourceMappingURL=template.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.model.js","sourceRoot":"","sources":["../../source/templates/template.model.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"template.model.js","sourceRoot":"","sources":["../../source/templates/template.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAsE;AAI/D,IAAM,aAAa,GAAnB,MAAM,aAAa;CAUzB,CAAA;AATC;IAAC,IAAA,iBAAQ,GAAE;;+CACQ;AAEnB;IAAC,IAAA,iBAAQ,GAAE;;+CACQ;AAEnB;IAAC,IAAA,YAAG,GAAE;IACL,IAAA,iBAAQ,GAAE;;8CACO;AATP,aAAa;IADzB,IAAA,aAAI,EAAC,EAAE,sBAAsB,EAAE,IAAA,YAAG,GAAE,EAAE,CAAC;GAC3B,aAAa,CAUzB;AAVY,sCAAa;AAiB1B,MAAsB,QAAQ;CAO7B;AANC;IAAC,IAAA,iBAAQ,EAAC,EAAE,MAAM,EAAE,IAAA,eAAM,EAAC,EAAE,EAAE,EAAE,sBAAsB,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;;wCAC7C;AAE/B;IAAC,IAAA,YAAG,GAAE;IACL,IAAA,iBAAQ,GAAE;;yCACe;AAN5B,4BAOC;AAED,SAAgB,cAAc,CAAC,QAAuB;IACpD,OAAO;QACL,MAAM,EAAE;YACN,QAAQ;SACT;KACF,CAAC;AACJ,CAAC;AAND,wCAMC"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import type { Template } from './template.model';
|
|
2
1
|
export declare type TemplateRenderResult = string;
|
|
3
|
-
export declare
|
|
2
|
+
export declare type TemplateRenderObject<Renderer extends string = string, Options = any> = {
|
|
3
|
+
renderer: Renderer;
|
|
4
|
+
template: string;
|
|
5
|
+
options?: Options;
|
|
6
|
+
};
|
|
7
|
+
export declare type TemplateRendererString = typeof templateRendererString;
|
|
8
|
+
export declare type TemplateRendererOptions = typeof templateRendererOptions;
|
|
9
|
+
export declare const templateRendererString: unique symbol;
|
|
10
|
+
export declare const templateRendererOptions: unique symbol;
|
|
11
|
+
export declare abstract class TemplateRenderer<Renderer extends string = string, Options = any> {
|
|
12
|
+
readonly [templateRendererString]: Renderer;
|
|
13
|
+
readonly [templateRendererOptions]: Options;
|
|
14
|
+
render(template: TemplateRenderObject<Renderer, Options>, context?: object): Promise<TemplateRenderResult>;
|
|
4
15
|
abstract canHandleType(type: string): boolean;
|
|
5
|
-
abstract
|
|
16
|
+
protected abstract _render(renderObject: TemplateRenderObject<Renderer, Options>, context?: object): TemplateRenderResult | Promise<TemplateRenderResult>;
|
|
6
17
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TemplateRenderer = void 0;
|
|
4
4
|
class TemplateRenderer {
|
|
5
|
+
async render(template, context) {
|
|
6
|
+
return this._render(template, context);
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
exports.TemplateRenderer = TemplateRenderer;
|
|
7
10
|
//# sourceMappingURL=template.renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.renderer.js","sourceRoot":"","sources":["../../source/templates/template.renderer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"template.renderer.js","sourceRoot":"","sources":["../../source/templates/template.renderer.ts"],"names":[],"mappings":";;;AAcA,MAAsB,gBAAgB;IAIpC,KAAK,CAAC,MAAM,CAAC,QAAiD,EAAE,OAAgB;QAC9E,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CAKF;AAXD,4CAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.resolver.js","sourceRoot":"","sources":["../../source/templates/template.resolver.ts"],"names":[],"mappings":";;;AAEA,MAAsB,gBAAgB;CAGrC;AAHD,4CAGC"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import type { Record } from "../types";
|
|
1
2
|
import { TemplateRendererProvider } from './template-renderer.provider';
|
|
3
|
+
import { TemplateResolverProvider } from './template-resolver.provider';
|
|
2
4
|
import type { Template } from './template.model';
|
|
3
5
|
import { TemplateProvider } from './template.provider';
|
|
4
|
-
|
|
6
|
+
export declare type TemplateServiceRenderResult<T extends Template = Template> = {
|
|
7
|
+
fields: Record<keyof T['fields'], string>;
|
|
8
|
+
options: T['options'];
|
|
9
|
+
};
|
|
5
10
|
export declare class TemplateService {
|
|
6
11
|
private readonly templateProvider;
|
|
7
12
|
private readonly templateRendererProvider;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
render<T extends Template = Template>(
|
|
13
|
+
private readonly templateResolverProvider;
|
|
14
|
+
constructor(templateProvider: TemplateProvider | undefined, templateRendererProvider: TemplateRendererProvider, templateResolverProvider: TemplateResolverProvider);
|
|
15
|
+
render<T extends Template = Template>(key: string, templateContext?: object): Promise<TemplateServiceRenderResult<T>>;
|
|
16
|
+
render<T extends Template = Template>(template: T, templateContext?: object): Promise<TemplateServiceRenderResult<T>>;
|
|
11
17
|
}
|
|
@@ -14,26 +14,39 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.TemplateService = void 0;
|
|
16
16
|
const container_1 = require("../container");
|
|
17
|
-
const
|
|
17
|
+
const throw_1 = require("../utils/throw");
|
|
18
18
|
const type_guards_1 = require("../utils/type-guards");
|
|
19
19
|
const template_renderer_provider_1 = require("./template-renderer.provider");
|
|
20
|
+
const template_resolver_provider_1 = require("./template-resolver.provider");
|
|
20
21
|
const template_provider_1 = require("./template.provider");
|
|
21
22
|
let TemplateService = class TemplateService {
|
|
22
|
-
constructor(templateProvider, templateRendererProvider) {
|
|
23
|
-
this.templateProvider = templateProvider ?? { get: () => (0,
|
|
23
|
+
constructor(templateProvider, templateRendererProvider, templateResolverProvider) {
|
|
24
|
+
this.templateProvider = templateProvider ?? { get: () => (0, throw_1._throw)(new Error('No template provider provided. Cannot render template-keys.')) };
|
|
24
25
|
this.templateRendererProvider = templateRendererProvider;
|
|
26
|
+
this.templateResolverProvider = templateResolverProvider;
|
|
25
27
|
}
|
|
26
28
|
async render(keyOrTemplate, templateContext) {
|
|
27
29
|
const template = (0, type_guards_1.isString)(keyOrTemplate) ? await this.templateProvider.get(keyOrTemplate) : keyOrTemplate;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
+
const result = {
|
|
31
|
+
fields: {},
|
|
32
|
+
options: template.options
|
|
33
|
+
};
|
|
34
|
+
for (const [key, field] of Object.entries(template.fields)) {
|
|
35
|
+
const resolver = this.templateResolverProvider.get(field.resolver);
|
|
36
|
+
const renderer = this.templateRendererProvider.get(field.renderer);
|
|
37
|
+
const templateString = await resolver.resolve(field);
|
|
38
|
+
const resultString = await renderer.render({ renderer: field.renderer, template: templateString, options: field.options }, templateContext);
|
|
39
|
+
result.fields[key] = resultString;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
30
42
|
}
|
|
31
43
|
};
|
|
32
44
|
TemplateService = __decorate([
|
|
33
45
|
(0, container_1.singleton)(),
|
|
34
46
|
__param(0, (0, container_1.optional)()),
|
|
35
47
|
__param(0, (0, container_1.inject)(template_provider_1.TemplateProvider)),
|
|
36
|
-
__metadata("design:paramtypes", [Object, template_renderer_provider_1.TemplateRendererProvider
|
|
48
|
+
__metadata("design:paramtypes", [Object, template_renderer_provider_1.TemplateRendererProvider,
|
|
49
|
+
template_resolver_provider_1.TemplateResolverProvider])
|
|
37
50
|
], TemplateService);
|
|
38
51
|
exports.TemplateService = TemplateService;
|
|
39
52
|
//# sourceMappingURL=template.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../source/templates/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA0D;
|
|
1
|
+
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../source/templates/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA0D;AAE1D,0CAAuC;AACvC,sDAA+C;AAC/C,6EAAwE;AACxE,6EAAwE;AAExE,2DAAuD;AAQhD,IAAM,eAAe,GAArB,MAAM,eAAe;IAK1B,YACwC,gBAA8C,EACpF,wBAAkD,EAClD,wBAAkD;QAElD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,IAAI,EAAE,GAAG,EAAE,GAAG,EA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A,oBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,kBAAM,EAAC,oCAAgB,CAAC,CAAA;6CACX,qDAAwB;QACxB,qDAAwB;GARzC,eAAe,CAqC3B;AArCY,0CAAe"}
|
package/templates/tokens.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { Type } from "../types";
|
|
2
1
|
import type { TemplateRenderer } from './template.renderer';
|
|
3
|
-
|
|
2
|
+
import type { TemplateResolver } from './template.resolver';
|
|
3
|
+
export declare const TEMPLATE_RENDERERS: import("../container").InjectionToken<TemplateRenderer<string, any>[], any>;
|
|
4
|
+
export declare const TEMPLATE_RESOLVERS: import("../container").InjectionToken<TemplateResolver<import("./template.model").TemplateField<string, string, any>>[], any>;
|
package/templates/tokens.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEMPLATE_RENDERERS = void 0;
|
|
3
|
+
exports.TEMPLATE_RESOLVERS = exports.TEMPLATE_RENDERERS = void 0;
|
|
4
4
|
const container_1 = require("../container");
|
|
5
5
|
exports.TEMPLATE_RENDERERS = (0, container_1.injectionToken)('TEMPLATE_RENDERERS');
|
|
6
|
+
exports.TEMPLATE_RESOLVERS = (0, container_1.injectionToken)('TEMPLATE_RESOLVERS');
|
|
6
7
|
//# sourceMappingURL=tokens.js.map
|
package/templates/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../source/templates/tokens.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAIhC,QAAA,kBAAkB,GAAG,IAAA,0BAAc,
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../source/templates/tokens.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAIhC,QAAA,kBAAkB,GAAG,IAAA,0BAAc,EAAqB,oBAAoB,CAAC,CAAC;AAC9E,QAAA,kBAAkB,GAAG,IAAA,0BAAc,EAAqB,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './thread-pool';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./thread-pool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/threading/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Record } from "../types";
|
|
2
|
+
declare const messageProxyValue: unique symbol;
|
|
3
|
+
declare const revokeMessageProxy: unique symbol;
|
|
4
|
+
export declare type ProxyFunction<T extends (...args: any) => any, Args extends any[] = Parameters<T>, R = ReturnType<T>> = (...args: Args) => Promise<Awaited<R>>;
|
|
5
|
+
export declare type ProxyObject<T extends Record> = {
|
|
6
|
+
[P in keyof T]: T extends (...args: any) => any ? ProxyFunction<T[P]> : T[P];
|
|
7
|
+
};
|
|
8
|
+
export declare type ProxyInput = ((...args: any) => any) | Record;
|
|
9
|
+
export declare type ProxyValue<T extends ProxyInput> = T extends (...args: any) => any ? ProxyFunction<T> : ProxyObject<T>;
|
|
10
|
+
export declare type MessageProxy<T extends ProxyInput = ProxyInput> = ProxyValue<T> & {
|
|
11
|
+
[messageProxyValue]: T;
|
|
12
|
+
[revokeMessageProxy]: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare type MessageProxyMessage = {
|
|
15
|
+
type: 'apply';
|
|
16
|
+
thisArg: any;
|
|
17
|
+
argArray: any[];
|
|
18
|
+
} | {
|
|
19
|
+
type: 'construct';
|
|
20
|
+
argArray: any[];
|
|
21
|
+
newTarget: Function;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'defineProperty';
|
|
24
|
+
property: string | symbol;
|
|
25
|
+
attributes: PropertyDescriptor;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'deleteProperty';
|
|
28
|
+
property: string | symbol;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'get';
|
|
31
|
+
property: string | symbol;
|
|
32
|
+
receiver: any;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'getOwnPropertyDescriptor';
|
|
35
|
+
property: string | symbol;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'getPrototypeOf';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'has';
|
|
40
|
+
property: string | symbol;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'isExtensible';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'ownKeys';
|
|
45
|
+
} | {
|
|
46
|
+
type: 'preventExtensions';
|
|
47
|
+
} | {
|
|
48
|
+
type: 'set';
|
|
49
|
+
property: string | symbol;
|
|
50
|
+
newValue: any;
|
|
51
|
+
receiver: any;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'setPrototypeOf';
|
|
54
|
+
v: object | null;
|
|
55
|
+
};
|
|
56
|
+
export declare class MessageProxyAdapter<T> {
|
|
57
|
+
readonly value: T;
|
|
58
|
+
constructor(value: T);
|
|
59
|
+
handleMessage(message: MessageProxyMessage): void;
|
|
60
|
+
}
|
|
61
|
+
export declare const MessageProxy: {
|
|
62
|
+
create<T extends ProxyInput>(_value: T): MessageProxy<T>;
|
|
63
|
+
isMessageProxy<T_1 extends ProxyInput = ProxyInput>(value: any): value is MessageProxy<T_1>;
|
|
64
|
+
revoke(threadProxy: MessageProxy): void;
|
|
65
|
+
};
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageProxy = exports.MessageProxyAdapter = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
const type_guards_1 = require("../utils/type-guards");
|
|
6
|
+
const messageProxyValue = Symbol('MessageProxy value.');
|
|
7
|
+
const revokeMessageProxy = Symbol('Revoke MessageProxy.');
|
|
8
|
+
class MessageProxyAdapter {
|
|
9
|
+
constructor(value) {
|
|
10
|
+
this.value = value;
|
|
11
|
+
}
|
|
12
|
+
handleMessage(message) {
|
|
13
|
+
switch (message.type) {
|
|
14
|
+
case 'apply':
|
|
15
|
+
break;
|
|
16
|
+
default:
|
|
17
|
+
throw new error_1.NotImplementedError();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.MessageProxyAdapter = MessageProxyAdapter;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare, @typescript-eslint/naming-convention
|
|
23
|
+
exports.MessageProxy = {
|
|
24
|
+
create(_value) {
|
|
25
|
+
throw new error_1.NotImplementedError();
|
|
26
|
+
},
|
|
27
|
+
isMessageProxy(value) {
|
|
28
|
+
return (0, type_guards_1.isDefined)(value?.[revokeMessageProxy]);
|
|
29
|
+
},
|
|
30
|
+
revoke(threadProxy) {
|
|
31
|
+
threadProxy[revokeMessageProxy]();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=message-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-proxy.js","sourceRoot":"","sources":["../../source/threading/message-proxy.ts"],"names":[],"mappings":";;;AAAA,oCAA8C;AAE9C,sDAAgD;AAEhD,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAyB1D,MAAa,mBAAmB;IAG9B,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,OAA4B;QACxC,QAAQ,OAAO,CAAC,IAAI,EAAE;YACpB,KAAK,OAAO;gBACV,MAAM;YAER;gBACE,MAAM,IAAI,2BAAmB,EAAE,CAAC;SACnC;IACH,CAAC;CACF;AAhBD,kDAgBC;AAED,iGAAiG;AACpF,QAAA,YAAY,GAAG;IAC1B,MAAM,CAAuB,MAAS;QACpC,MAAM,IAAI,2BAAmB,EAAE,CAAC;IAClC,CAAC;IAED,cAAc,CAAoC,KAAU;QAC1D,OAAO,IAAA,uBAAS,EAAE,KAA4B,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,WAAyB;QAC9B,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACpC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThreadPool = void 0;
|
|
4
|
+
class ThreadPool {
|
|
5
|
+
constructor(threadCount) {
|
|
6
|
+
this.threadCount = threadCount;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.ThreadPool = ThreadPool;
|
|
10
|
+
//# sourceMappingURL=thread-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-pool.js","sourceRoot":"","sources":["../../source/threading/thread-pool.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IAGrB,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAND,gCAMC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { ProxyInput, ProxyValue } from './message-proxy';
|
|
3
|
+
export declare abstract class Thread {
|
|
4
|
+
private readonly url;
|
|
5
|
+
private readonly errorSubject;
|
|
6
|
+
private readonly messageSubject;
|
|
7
|
+
private readonly messageErrorSubject;
|
|
8
|
+
private worker;
|
|
9
|
+
readonly error$: Observable<ErrorEvent>;
|
|
10
|
+
readonly message$: Observable<MessageEvent>;
|
|
11
|
+
readonly messageError$: Observable<MessageEvent>;
|
|
12
|
+
constructor(url: string);
|
|
13
|
+
static proxy<T extends ProxyInput>(_value: T): ProxyValue<T>;
|
|
14
|
+
initialize(): Promise<void>;
|
|
15
|
+
terminate(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Thread = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
class Thread {
|
|
7
|
+
constructor(url) {
|
|
8
|
+
this.url = url;
|
|
9
|
+
this.errorSubject = new rxjs_1.Subject();
|
|
10
|
+
this.messageSubject = new rxjs_1.Subject();
|
|
11
|
+
this.messageErrorSubject = new rxjs_1.Subject();
|
|
12
|
+
this.error$ = this.errorSubject.asObservable();
|
|
13
|
+
this.message$ = this.messageSubject.asObservable();
|
|
14
|
+
this.messageError$ = this.messageErrorSubject.asObservable();
|
|
15
|
+
}
|
|
16
|
+
static proxy(_value) {
|
|
17
|
+
throw new error_1.NotImplementedError();
|
|
18
|
+
}
|
|
19
|
+
async initialize() {
|
|
20
|
+
this.worker = new Worker(this.url, { type: 'module' });
|
|
21
|
+
this.worker.addEventListener('message', (messageEvent) => this.messageSubject.next(messageEvent));
|
|
22
|
+
this.worker.addEventListener('messageerror', (messageEvent) => this.messageErrorSubject.next(messageEvent));
|
|
23
|
+
this.worker.addEventListener('error', (errorEvent) => this.errorSubject.next(errorEvent));
|
|
24
|
+
}
|
|
25
|
+
terminate() {
|
|
26
|
+
this.worker.terminate();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Thread = Thread;
|
|
30
|
+
//# sourceMappingURL=thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread.js","sourceRoot":"","sources":["../../source/threading/thread.ts"],"names":[],"mappings":";;;AAAA,oCAA8C;AAE9C,+BAA+B;AAG/B,MAAsB,MAAM;IAY1B,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,IAAI,CAAC,YAAY,GAAG,IAAI,cAAO,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,cAAO,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,GAAG,IAAI,cAAO,EAAE,CAAC;QAEzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,CAAuB,MAAS;QAC1C,MAAM,IAAI,2BAAmB,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEvD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAClG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED,SAAS;QACP,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;CACF;AAvCD,wBAuCC"}
|
package/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { UnionToIntersection } from 'type-fest';
|
|
2
|
+
export declare type ObjectLiteral = {};
|
|
1
3
|
export declare type PrimitiveTypeMap = {
|
|
2
4
|
'string': string;
|
|
3
5
|
'number': number;
|
|
@@ -35,10 +37,22 @@ export declare type UndefinableJsonObject = {
|
|
|
35
37
|
[key: string]: UndefinableJsonInnerNode;
|
|
36
38
|
};
|
|
37
39
|
export declare type UndefinableJsonArray = UndefinableJsonInnerNode[];
|
|
40
|
+
export declare type ArrayItem<T extends readonly any[]> = T extends readonly (infer U)[] ? U : never;
|
|
38
41
|
export declare type Enumeration = EnumerationArray | EnumerationObject;
|
|
39
42
|
export declare type EnumerationArray = readonly [string | number, ...(string | number)[]];
|
|
40
43
|
export declare type EnumerationObject = Record<string, string | number>;
|
|
41
|
-
export declare type
|
|
44
|
+
export declare type EnumerationKey<T extends EnumerationObject = EnumerationObject> = Extract<keyof T, string>;
|
|
45
|
+
export declare type EnumerationMap<T extends EnumerationObject = EnumerationObject> = SimplifyObject<{
|
|
46
|
+
[P in EnumerationKey<T>]: (T[P] extends number ? (`${T[P]}` extends `${infer U extends number}` ? U : never) : `${T[P]}`) | T[P];
|
|
47
|
+
}>;
|
|
48
|
+
export declare type EnumerationValue<T extends Enumeration = Enumeration> = T extends EnumerationObject ? Simplify<EnumerationMap<T>[keyof EnumerationMap<T>]> : T extends EnumerationArray ? T[number] : never;
|
|
49
|
+
export declare type EnumerationEntry<T extends EnumerationObject = EnumerationObject> = {
|
|
50
|
+
[P in EnumerationKey<T>]: [P, EnumerationMap<T>[P]];
|
|
51
|
+
}[EnumerationKey<T>];
|
|
52
|
+
declare type EnumerationEntriesHelper<T extends EnumerationObject = EnumerationObject, Tuple = UnionToTuple<EnumerationKey<T>>> = {
|
|
53
|
+
[P in keyof Tuple]: [Tuple[P], Tuple[P] extends EnumerationKey<T> ? EnumerationMap<T>[Tuple[P]] : never];
|
|
54
|
+
};
|
|
55
|
+
export declare type EnumerationEntries<T extends EnumerationObject = EnumerationObject> = EnumerationEntriesHelper<T> extends (infer U)[] ? U[] : never;
|
|
42
56
|
export declare type Type<T = any, Arguments extends any[] = any> = Constructor<T, Arguments> & {
|
|
43
57
|
prototype: T;
|
|
44
58
|
};
|
|
@@ -87,15 +101,14 @@ export declare type SimplifiedOptionalize<T extends object> = Simplify<Optionali
|
|
|
87
101
|
/**
|
|
88
102
|
* remove nested type information
|
|
89
103
|
*/
|
|
90
|
-
export declare type Simplify<T> = T extends (Primitive | Function | Date | RegExp) ? T : T extends (infer AT)[] ? Simplify<AT>[] : T extends readonly (infer AT)[] ? readonly Simplify<AT>[] :
|
|
91
|
-
[K in keyof T]: T[K];
|
|
92
|
-
} & {};
|
|
104
|
+
export declare type Simplify<T> = T extends (Primitive | Function | Date | RegExp) ? T : T extends (infer AT)[] ? Simplify<AT>[] : T extends readonly (infer AT)[] ? readonly Simplify<AT>[] : T extends Record ? SimplifyObject<T> : T;
|
|
93
105
|
/**
|
|
94
106
|
* remove type information on object
|
|
95
107
|
*/
|
|
96
108
|
export declare type SimplifyObject<T extends Record> = {
|
|
97
109
|
[K in keyof T]: T[K];
|
|
98
110
|
} & {};
|
|
111
|
+
export declare type UnionToTuple<T, Tuple extends any[] = []> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? UnionToTuple<Exclude<T, R>, [R, ...Tuple]> : Tuple;
|
|
99
112
|
export declare type UndefinableObject<T extends Record> = {
|
|
100
113
|
[K in keyof T]: T[K] | undefined;
|
|
101
114
|
};
|
|
@@ -111,9 +124,9 @@ export declare type NonNullOrUndefinable<T> = T extends null | undefined ? never
|
|
|
111
124
|
/**
|
|
112
125
|
* makes optional properties required and removes null and undefined
|
|
113
126
|
*/
|
|
114
|
-
export declare type DeepNonNullable<T extends Record
|
|
115
|
-
[P in keyof T]-?:
|
|
116
|
-
}
|
|
127
|
+
export declare type DeepNonNullable<T> = T extends Record ? {
|
|
128
|
+
[P in keyof T]-?: DeepNonNullable<T[P]>;
|
|
129
|
+
} : NonNullable<T>;
|
|
117
130
|
export declare type IfAny<T, Then, Else = never> = true extends (false & T) ? Then : Else;
|
|
118
131
|
export declare type IfUnknown<T, Then, Else = never> = unknown extends T ? Then : Else;
|
|
119
132
|
export declare type IsAny<T> = IfAny<T, true, false>;
|
package/utils/array/array.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export declare function toArray<T>(value: T | T[]): T[];
|
|
2
|
-
export declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
1
|
+
export declare function toArray<T>(value: T | T[] | readonly T[]): T[];
|
|
3
2
|
/**
|
|
4
3
|
* creates a new array of specified length and fills it with values from the specified value provider function
|
|
5
4
|
* @param length length of the new array
|
package/utils/array/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/utils/array/array.ts"],"names":[],"mappings":";;;AAAA,kCAAoC;AACpC,gDAA2C;
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../source/utils/array/array.ts"],"names":[],"m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AK,CAAC,KAAK,CAAE,CAAC;aACtB;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAzBD,kCAyBC"}
|
package/utils/clone.js
CHANGED
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.clone = void 0;
|
|
4
4
|
const object_1 = require("./object/object");
|
|
5
5
|
const type_guards_1 = require("./type-guards");
|
|
6
|
+
const supportsStructuredClone = (typeof structuredClone == 'function');
|
|
6
7
|
function clone(object, deep) {
|
|
8
|
+
if (supportsStructuredClone && deep) {
|
|
9
|
+
return structuredClone(object);
|
|
10
|
+
}
|
|
7
11
|
if ((0, type_guards_1.isPrimitive)(object)) {
|
|
8
12
|
return object;
|
|
9
13
|
}
|
package/utils/clone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../source/utils/clone.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAChD,+CAA4I;AAE5I,SAAgB,KAAK,CAAI,MAAS,EAAE,IAAa;IAC/C,IAAI,IAAA,yBAAW,EAAC,MAAM,CAAC,EAAE;QACvB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,IAAA,oBAAM,EAAC,MAAM,CAAC,EAAE;QAClB,OAAO,IAAI,IAAI,CAAC,MAAM,CAAiB,CAAC;KACzC;IAED,IAAI,IAAA,sBAAQ,EAAC,MAAM,CAAC,EAAE;QACpB,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAiB,CAAC;KAChE;IAED,IAAI,IAAA,mBAAK,EAAC,MAAM,CAAC,EAAE;QACjB,OAAO,IAAI,GAAG,CAAC,MAAM,CAAiB,CAAC;KACxC;IAED,IAAI,IAAA,mBAAK,EAAC,MAAM,CAAC,EAAE;QACjB,OAAO,IAAI,GAAG,CAAC,MAAM,CAAiB,CAAC;KACxC;IAED,IAAI,IAAA,2BAAa,EAAC,MAAM,CAAC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,CAAC,CAAa;YAC5D,CAAC,CAAC,CAAC,GAAG,MAAM,CAAiB,CAAC;KACjC;IAED,IAAA,0BAAY,EAAC,MAAM,CAAC,CAAC;IAErB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,GAAG,MAAM,EAAO,CAAC;KAC3B;IAED,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAU,CAAC,CAAC;IAChG,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAiB,CAAC;AACrD,CAAC;AApDD,sBAoDC"}
|
package/utils/compression.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import * as
|
|
3
|
+
import type * as ZlibType from 'zlib';
|
|
4
4
|
export interface CompressionResult {
|
|
5
5
|
toBuffer(): Promise<Uint8Array>;
|
|
6
6
|
toHex(): Promise<string>;
|
|
@@ -12,16 +12,16 @@ export interface DecompressionResult extends CompressionResult {
|
|
|
12
12
|
toUtf8(): Promise<string>;
|
|
13
13
|
}
|
|
14
14
|
declare type Algorithms = 'gzip' | 'brotli' | 'deflate' | 'deflate-raw';
|
|
15
|
-
export declare function compressString(input: string, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?:
|
|
16
|
-
export declare function compressString(input: string, algorithm: 'brotli', options?:
|
|
17
|
-
export declare function compressString(input: string, algorithm: Algorithms, options?:
|
|
18
|
-
export declare function compress(buffer:
|
|
19
|
-
export declare function compress(buffer:
|
|
20
|
-
export declare function compress(buffer:
|
|
21
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?:
|
|
22
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'brotli', options?:
|
|
23
|
-
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: Algorithms, options?:
|
|
24
|
-
export declare function decompress(buffer:
|
|
25
|
-
export declare function decompress(buffer:
|
|
26
|
-
export declare function decompress(buffer:
|
|
15
|
+
export declare function compressString(input: string, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): CompressionResult;
|
|
16
|
+
export declare function compressString(input: string, algorithm: 'brotli', options?: ZlibType.BrotliOptions): CompressionResult;
|
|
17
|
+
export declare function compressString(input: string, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): CompressionResult;
|
|
18
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): CompressionResult;
|
|
19
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: 'brotli', options?: ZlibType.BrotliOptions): CompressionResult;
|
|
20
|
+
export declare function compress(buffer: ZlibType.InputType, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): CompressionResult;
|
|
21
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): DecompressionResult;
|
|
22
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: 'brotli', options?: ZlibType.BrotliOptions): DecompressionResult;
|
|
23
|
+
export declare function decompressString(input: string, encoding: BufferEncoding, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): DecompressionResult;
|
|
24
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: 'gzip' | 'deflate' | 'deflate-raw', options?: ZlibType.ZlibOptions): DecompressionResult;
|
|
25
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: 'brotli', options?: ZlibType.BrotliOptions): DecompressionResult;
|
|
26
|
+
export declare function decompress(buffer: ZlibType.InputType, algorithm: Algorithms, options?: ZlibType.ZlibOptions | ZlibType.BrotliOptions): DecompressionResult;
|
|
27
27
|
export {};
|