@tstdl/base 0.82.4 → 0.82.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/types.d.ts +2 -1
- package/api/types.js.map +1 -1
- package/authentication/authentication-credentials.repository.d.ts +5 -0
- package/authentication/{authentication-credentials.service.js → authentication-credentials.repository.js} +6 -6
- package/authentication/authentication-credentials.repository.js.map +1 -0
- package/authentication/authentication-session.repository.d.ts +13 -4
- package/authentication/authentication-session.repository.js +2 -13
- package/authentication/authentication-session.repository.js.map +1 -1
- package/authentication/authentication.api.d.ts +28 -0
- package/authentication/authentication.api.js +53 -0
- package/authentication/authentication.api.js.map +1 -0
- package/authentication/authentication.service.d.ts +13 -13
- package/authentication/authentication.service.js +50 -25
- package/authentication/authentication.service.js.map +1 -1
- package/authentication/models/authentication-credentials.model.d.ts +7 -5
- package/authentication/models/authentication-credentials.model.js +28 -7
- package/authentication/models/authentication-credentials.model.js.map +1 -1
- package/authentication/models/authentication-session.model.d.ts +13 -6
- package/authentication/models/authentication-session.model.js +47 -9
- package/authentication/models/authentication-session.model.js.map +1 -1
- package/authentication/models/index.d.ts +1 -0
- package/authentication/models/index.js +1 -0
- package/authentication/models/index.js.map +1 -1
- package/authentication/models/token-payload-base.model.d.ts +5 -0
- package/{orm/test.js → authentication/models/token-payload-base.model.js} +19 -10
- package/authentication/models/token-payload-base.model.js.map +1 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.d.ts +25 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.js +65 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.js.map +1 -0
- package/authentication/mongo/mongo-authentication-session.repository.d.ts +26 -0
- package/authentication/mongo/mongo-authentication-session.repository.js +64 -0
- package/authentication/mongo/mongo-authentication-session.repository.js.map +1 -0
- package/database/mongo/model/document.d.ts +0 -1
- package/database/mongo/model/document.js +1 -10
- package/database/mongo/model/document.js.map +1 -1
- package/database/mongo/module.js +0 -3
- package/database/mongo/module.js.map +1 -1
- package/database/mongo/query-converter.js.map +1 -1
- package/database/query.d.ts +1 -1
- package/examples/mail/basic.js +3 -3
- package/examples/mail/templates/hello-name.js +7 -2
- package/examples/mail/templates/hello-name.js.map +1 -1
- package/examples/pdf/basic.js +3 -3
- package/examples/pdf/templates/hello-name.js +1 -1
- package/examples/pdf/templates/hello-name.js.map +1 -1
- package/examples/template/basic.js +13 -7
- package/examples/template/basic.js.map +1 -1
- package/examples/template/templates/hello-jsx.d.ts +2 -0
- package/examples/template/templates/hello-jsx.js +15 -0
- package/examples/template/templates/hello-jsx.js.map +1 -0
- package/examples/template/templates/hello-name.js +1 -1
- package/examples/template/templates/hello-name.js.map +1 -1
- package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
- package/http/types.d.ts +3 -3
- package/mail/mail.service.d.ts +4 -3
- package/mail/mail.service.js +5 -8
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-log.model.d.ts +1 -1
- package/mail/models/mail-template.model.d.ts +1 -1
- package/mail/models/mail-template.model.js +2 -1
- package/mail/models/mail-template.model.js.map +1 -1
- package/notification/models/notification.model.d.ts +23 -5
- package/notification/models/notification.model.js +47 -3
- package/notification/models/notification.model.js.map +1 -1
- package/notification/notification.repository.d.ts +5 -0
- package/notification/notification.repository.js +7 -0
- package/notification/notification.repository.js.map +1 -0
- package/notification/notification.service.d.ts +2 -2
- package/notification/notification.service.js +4 -4
- package/notification/notification.service.js.map +1 -1
- package/package.json +6 -4
- package/pdf/pdf.service.d.ts +5 -4
- package/pdf/pdf.service.js +7 -6
- package/pdf/pdf.service.js.map +1 -1
- package/schema/schemas/assign.d.ts +3 -3
- package/schema/utils/schema.js.map +1 -1
- package/templates/providers/{file.provider-template.d.ts → file.template-provider.d.ts} +1 -1
- package/templates/providers/{file.provider-template.js → file.template-provider.js} +2 -2
- package/templates/providers/file.template-provider.js.map +1 -0
- package/templates/providers/memory.template-provider.d.ts +1 -1
- package/templates/providers/memory.template-provider.js +1 -1
- package/templates/providers/memory.template-provider.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/renderers/jsx.template-renderer.d.ts +16 -0
- package/templates/renderers/jsx.template-renderer.js +40 -0
- package/templates/renderers/jsx.template-renderer.js.map +1 -0
- package/templates/renderers/mjml.template-renderer.d.ts +1 -1
- package/templates/renderers/string.template-renderer.d.ts +2 -2
- package/templates/renderers/string.template-renderer.js +1 -1
- package/templates/renderers/string.template-renderer.js.map +1 -1
- package/templates/resolvers/file.template-resolver.d.ts +2 -2
- package/templates/resolvers/jsx.template-resolver.d.ts +15 -0
- package/templates/resolvers/jsx.template-resolver.js +45 -0
- package/templates/resolvers/jsx.template-resolver.js.map +1 -0
- package/templates/resolvers/string.template-resolver.d.ts +1 -1
- package/templates/resolvers/string.template-resolver.js +1 -1
- package/templates/resolvers/string.template-resolver.js.map +1 -1
- package/templates/template.model.d.ts +3 -1
- package/templates/template.model.js +8 -1
- package/templates/template.model.js.map +1 -1
- package/templates/template.provider.d.ts +1 -1
- package/templates/template.renderer.d.ts +5 -2
- package/templates/template.renderer.js +6 -1
- package/templates/template.renderer.js.map +1 -1
- package/templates/template.resolver.d.ts +2 -2
- package/templates/template.service.d.ts +3 -2
- package/templates/template.service.js +6 -1
- package/templates/template.service.js.map +1 -1
- package/templates/tokens.d.ts +1 -1
- package/text/localization.service.js +1 -1
- package/text/localization.service.js.map +1 -1
- package/tsconfig.json +5 -0
- package/types.d.ts +6 -32
- package/utils/jwt.js +2 -2
- package/utils/jwt.js.map +1 -1
- package/utils/object/object.d.ts +1 -1
- package/utils/object/object.js +6 -5
- package/utils/object/object.js.map +1 -1
- package/authentication/authentication-credentials.service.d.ts +0 -6
- package/authentication/authentication-credentials.service.js.map +0 -1
- package/orm/decorators.d.ts +0 -26
- package/orm/decorators.js +0 -172
- package/orm/decorators.js.map +0 -1
- package/orm/entity-definition.model.d.ts +0 -51
- package/orm/entity-definition.model.js +0 -27
- package/orm/entity-definition.model.js.map +0 -1
- package/orm/index.d.ts +0 -1
- package/orm/index.js +0 -18
- package/orm/index.js.map +0 -1
- package/orm/models/entity.d.ts +0 -22
- package/orm/models/entity.js +0 -87
- package/orm/models/entity.js.map +0 -1
- package/orm/models/index.d.ts +0 -1
- package/orm/models/index.js +0 -18
- package/orm/models/index.js.map +0 -1
- package/orm/repository/mongo/classes.d.ts +0 -25
- package/orm/repository/mongo/classes.js +0 -33
- package/orm/repository/mongo/classes.js.map +0 -1
- package/orm/repository/mongo/module.d.ts +0 -8
- package/orm/repository/mongo/module.js +0 -88
- package/orm/repository/mongo/module.js.map +0 -1
- package/orm/repository/mongo/mongo-repository.d.ts +0 -11
- package/orm/repository/mongo/mongo-repository.js +0 -55
- package/orm/repository/mongo/mongo-repository.js.map +0 -1
- package/orm/repository/mongo/mongo-transaction.d.ts +0 -10
- package/orm/repository/mongo/mongo-transaction.js +0 -28
- package/orm/repository/mongo/mongo-transaction.js.map +0 -1
- package/orm/repository/repository.d.ts +0 -75
- package/orm/repository/repository.js +0 -182
- package/orm/repository/repository.js.map +0 -1
- package/orm/repository/transaction.d.ts +0 -26
- package/orm/repository/transaction.js +0 -65
- package/orm/repository/transaction.js.map +0 -1
- package/orm/sql/sql-repository.d.ts +0 -6
- package/orm/sql/sql-repository.js +0 -15
- package/orm/sql/sql-repository.js.map +0 -1
- package/orm/test.d.ts +0 -1
- package/orm/test.js.map +0 -1
- package/orm/types/definition.d.ts +0 -19
- package/orm/types/definition.js +0 -55
- package/orm/types/definition.js.map +0 -1
- package/orm/types/index.d.ts +0 -3
- package/orm/types/index.js +0 -20
- package/orm/types/index.js.map +0 -1
- package/orm/types/options.d.ts +0 -36
- package/orm/types/options.js +0 -5
- package/orm/types/options.js.map +0 -1
- package/orm/types/query.d.ts +0 -110
- package/orm/types/query.js +0 -10
- package/orm/types/query.js.map +0 -1
- package/templates/providers/file.provider-template.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/authentication/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD;AACnD,iEAA+C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/authentication/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD;AACnD,iEAA+C;AAC/C,6DAA2C"}
|
|
@@ -9,15 +9,24 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
exports.TokenPayloadBase = void 0;
|
|
13
|
+
const property_1 = require("../../schema/decorators/property");
|
|
14
|
+
class TokenPayloadBase {
|
|
15
|
+
jti;
|
|
16
|
+
iat;
|
|
17
|
+
exp;
|
|
18
|
+
}
|
|
16
19
|
__decorate([
|
|
17
|
-
(0,
|
|
20
|
+
(0, property_1.Property)(),
|
|
18
21
|
__metadata("design:type", String)
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
(0,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
], TokenPayloadBase.prototype, "jti", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, property_1.Property)(),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], TokenPayloadBase.prototype, "iat", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, property_1.Property)(),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], TokenPayloadBase.prototype, "exp", void 0);
|
|
31
|
+
exports.TokenPayloadBase = TokenPayloadBase;
|
|
32
|
+
//# sourceMappingURL=token-payload-base.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-payload-base.model.js","sourceRoot":"","sources":["../../../source/authentication/models/token-payload-base.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAwD;AAExD,MAAa,gBAAgB;IAE3B,GAAG,CAAS;IAGZ,GAAG,CAAS;IAGZ,GAAG,CAAS;CACb;AARC;IAAC,IAAA,mBAAQ,GAAE;;6CACC;AAEZ;IAAC,IAAA,mBAAQ,GAAE;;6CACC;AAEZ;IAAC,IAAA,mBAAQ,GAAE;;6CACC;AARd,4CASC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Injectable } from "../../container";
|
|
2
|
+
import { resolveArgumentType } from "../../container";
|
|
3
|
+
import { MaybeNewEntity } from "../../database";
|
|
4
|
+
import type { CollectionArgument } from "../../database/mongo";
|
|
5
|
+
import { Collection, MongoEntityRepository } from "../../database/mongo";
|
|
6
|
+
import { Logger } from "../../logger";
|
|
7
|
+
import { AuthenticationCredentialsRepository } from '../authentication-credentials.repository';
|
|
8
|
+
import type { AuthenticationCredentials, NewAuthenticationCredentials } from '../models';
|
|
9
|
+
export type MongoAuthenticationCredentialsRepositoryConfig = {
|
|
10
|
+
config?: MongoAuthenticationCredentialsRepositoryArgument;
|
|
11
|
+
};
|
|
12
|
+
export type MongoAuthenticationCredentialsRepositoryArgument = CollectionArgument<AuthenticationCredentials>;
|
|
13
|
+
export declare const mongoAuthenticationCredentialsRepositoryConfig: MongoAuthenticationCredentialsRepositoryConfig;
|
|
14
|
+
export declare class MongoAuthenticationCredentialsRepository extends AuthenticationCredentialsRepository {
|
|
15
|
+
private readonly repository;
|
|
16
|
+
constructor(repository: InternalMongoAuthenticationCredentialsRepository);
|
|
17
|
+
tryLoad(id: string): Promise<AuthenticationCredentials | undefined>;
|
|
18
|
+
save(credentials: AuthenticationCredentials | NewAuthenticationCredentials): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare class InternalMongoAuthenticationCredentialsRepository extends MongoEntityRepository<AuthenticationCredentials> implements Injectable<MongoAuthenticationCredentialsRepositoryArgument> {
|
|
21
|
+
readonly [resolveArgumentType]: MongoAuthenticationCredentialsRepositoryArgument;
|
|
22
|
+
constructor(collection: Collection<AuthenticationCredentials>, logger: Logger);
|
|
23
|
+
upsert(credentials: MaybeNewEntity<AuthenticationCredentials>): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare function configureMongoAuthenticationCredentialsRepository(config?: Partial<MongoAuthenticationCredentialsRepositoryConfig>): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.configureMongoAuthenticationCredentialsRepository = exports.InternalMongoAuthenticationCredentialsRepository = exports.MongoAuthenticationCredentialsRepository = exports.mongoAuthenticationCredentialsRepositoryConfig = void 0;
|
|
16
|
+
const container_1 = require("../../container");
|
|
17
|
+
const database_1 = require("../../database");
|
|
18
|
+
const mongo_1 = require("../../database/mongo");
|
|
19
|
+
const logger_1 = require("../../logger");
|
|
20
|
+
const authentication_credentials_repository_1 = require("../authentication-credentials.repository");
|
|
21
|
+
exports.mongoAuthenticationCredentialsRepositoryConfig = {};
|
|
22
|
+
const indexes = [
|
|
23
|
+
{ key: { subject: 1 }, unique: true }
|
|
24
|
+
];
|
|
25
|
+
let MongoAuthenticationCredentialsRepository = class MongoAuthenticationCredentialsRepository extends authentication_credentials_repository_1.AuthenticationCredentialsRepository {
|
|
26
|
+
repository;
|
|
27
|
+
constructor(repository) {
|
|
28
|
+
super();
|
|
29
|
+
this.repository = repository;
|
|
30
|
+
}
|
|
31
|
+
async tryLoad(id) {
|
|
32
|
+
return this.repository.tryLoad(id);
|
|
33
|
+
}
|
|
34
|
+
async save(credentials) {
|
|
35
|
+
await this.repository.upsert(credentials);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
MongoAuthenticationCredentialsRepository = __decorate([
|
|
39
|
+
(0, container_1.singleton)(),
|
|
40
|
+
__metadata("design:paramtypes", [InternalMongoAuthenticationCredentialsRepository])
|
|
41
|
+
], MongoAuthenticationCredentialsRepository);
|
|
42
|
+
exports.MongoAuthenticationCredentialsRepository = MongoAuthenticationCredentialsRepository;
|
|
43
|
+
let InternalMongoAuthenticationCredentialsRepository = class InternalMongoAuthenticationCredentialsRepository extends mongo_1.MongoEntityRepository {
|
|
44
|
+
[container_1.resolveArgumentType];
|
|
45
|
+
constructor(collection, logger) {
|
|
46
|
+
super(collection, mongo_1.noopTransformer, { logger, indexes });
|
|
47
|
+
}
|
|
48
|
+
async upsert(credentials) {
|
|
49
|
+
const { id: _, ...credentialsWithoutId } = credentials;
|
|
50
|
+
await this.baseRepository.update({ subject: credentials.subject }, { $setOnInsert: { _id: (0, database_1.getNewId)() }, $set: credentialsWithoutId }, { upsert: true });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
InternalMongoAuthenticationCredentialsRepository = __decorate([
|
|
54
|
+
(0, container_1.singleton)({
|
|
55
|
+
defaultArgumentProvider: () => exports.mongoAuthenticationCredentialsRepositoryConfig.config
|
|
56
|
+
}),
|
|
57
|
+
__param(0, (0, container_1.forwardArg)()),
|
|
58
|
+
__metadata("design:paramtypes", [mongo_1.Collection, logger_1.Logger])
|
|
59
|
+
], InternalMongoAuthenticationCredentialsRepository);
|
|
60
|
+
exports.InternalMongoAuthenticationCredentialsRepository = InternalMongoAuthenticationCredentialsRepository;
|
|
61
|
+
function configureMongoAuthenticationCredentialsRepository(config = {}) {
|
|
62
|
+
exports.mongoAuthenticationCredentialsRepositoryConfig.config = config.config ?? exports.mongoAuthenticationCredentialsRepositoryConfig.config;
|
|
63
|
+
}
|
|
64
|
+
exports.configureMongoAuthenticationCredentialsRepository = configureMongoAuthenticationCredentialsRepository;
|
|
65
|
+
//# sourceMappingURL=mongo-authentication-credentials.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo-authentication-credentials.repository.js","sourceRoot":"","sources":["../../../source/authentication/mongo/mongo-authentication-credentials.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAyE;AACzE,6CAAsD;AAEtD,gDAAsF;AACtF,yCAAkC;AAClC,oGAA+F;AASlF,QAAA,8CAA8C,GAAmD,EAAE,CAAC;AAEjH,MAAM,OAAO,GAAuD;IAClE,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;CACtC,CAAC;AAGK,IAAM,wCAAwC,GAA9C,MAAM,wCAAyC,SAAQ,2EAAmC;IAC9E,UAAU,CAAmD;IAE9E,YAAY,UAA4D;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAqE;QAC9E,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;CACF,CAAA;AAfY,wCAAwC;IADpD,IAAA,qBAAS,GAAE;qCAIc,gDAAgD;GAH7D,wCAAwC,CAepD;AAfY,4FAAwC;AAoB9C,IAAM,gDAAgD,GAAtD,MAAM,gDAAiD,SAAQ,6BAAgD;IAC3G,CAAC,+BAAmB,CAAC,CAAmD;IAEjF,YAA0B,UAAiD,EAAE,MAAc;QACzF,KAAK,CAAC,UAAU,EAAE,uBAAe,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAsD;QACjE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,oBAAoB,EAAE,GAAG,WAAW,CAAC;QAEvD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,IAAA,mBAAQ,GAAE,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1J,CAAC;CACF,CAAA;AAZY,gDAAgD;IAH5D,IAAA,qBAAS,EAAC;QACT,uBAAuB,EAAE,GAAG,EAAE,CAAC,sDAA8C,CAAC,MAAM;KACrF,CAAC;IAIa,WAAA,IAAA,sBAAU,GAAE,CAAA;qCAAa,kBAAU,EAAqC,eAAM;GAHhF,gDAAgD,CAY5D;AAZY,4GAAgD;AAc7D,SAAgB,iDAAiD,CAAC,SAAkE,EAAE;IACpI,sDAA8C,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,sDAA8C,CAAC,MAAM,CAAC;AACjI,CAAC;AAFD,8GAEC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Injectable } from "../../container";
|
|
2
|
+
import { resolveArgumentType } from "../../container";
|
|
3
|
+
import type { CollectionArgument } from "../../database/mongo";
|
|
4
|
+
import { Collection, MongoEntityRepository } from "../../database/mongo";
|
|
5
|
+
import { Logger } from "../../logger";
|
|
6
|
+
import type { AuthenticationSessionExtendData } from '../authentication-session.repository';
|
|
7
|
+
import { AuthenticationSessionRepository } from '../authentication-session.repository';
|
|
8
|
+
import type { AuthenticationSession, NewAuthenticationSession } from '../models';
|
|
9
|
+
export type MongoAuthenticationSessionRepositoryConfig = {
|
|
10
|
+
config?: MongoAuthenticationSessionRepositoryArgument;
|
|
11
|
+
};
|
|
12
|
+
export type MongoAuthenticationSessionRepositoryArgument = CollectionArgument<AuthenticationSession>;
|
|
13
|
+
export declare const mongoAuthenticationSessionRepositoryConfig: MongoAuthenticationSessionRepositoryConfig;
|
|
14
|
+
export declare class MongoAuthenticationSessionRepository extends AuthenticationSessionRepository {
|
|
15
|
+
private readonly repository;
|
|
16
|
+
constructor(repository: InternalMongoAuthenticationSessionRepository);
|
|
17
|
+
insert(authenticationSession: NewAuthenticationSession): Promise<AuthenticationSession>;
|
|
18
|
+
load(id: string): Promise<AuthenticationSession>;
|
|
19
|
+
extend(id: string, data: AuthenticationSessionExtendData): Promise<void>;
|
|
20
|
+
end(id: string, timestamp: number): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare class InternalMongoAuthenticationSessionRepository extends MongoEntityRepository<AuthenticationSession> implements Injectable<MongoAuthenticationSessionRepositoryArgument> {
|
|
23
|
+
readonly [resolveArgumentType]: MongoAuthenticationSessionRepositoryArgument;
|
|
24
|
+
constructor(collection: Collection<AuthenticationSession>, logger: Logger);
|
|
25
|
+
}
|
|
26
|
+
export declare function configureMongoAuthenticationSessionRepository(config?: Partial<MongoAuthenticationSessionRepositoryConfig>): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
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.configureMongoAuthenticationSessionRepository = exports.InternalMongoAuthenticationSessionRepository = exports.MongoAuthenticationSessionRepository = exports.mongoAuthenticationSessionRepositoryConfig = void 0;
|
|
16
|
+
const container_1 = require("../../container");
|
|
17
|
+
const mongo_1 = require("../../database/mongo");
|
|
18
|
+
const logger_1 = require("../../logger");
|
|
19
|
+
const authentication_session_repository_1 = require("../authentication-session.repository");
|
|
20
|
+
exports.mongoAuthenticationSessionRepositoryConfig = {};
|
|
21
|
+
const indexes = [];
|
|
22
|
+
let MongoAuthenticationSessionRepository = class MongoAuthenticationSessionRepository extends authentication_session_repository_1.AuthenticationSessionRepository {
|
|
23
|
+
repository;
|
|
24
|
+
constructor(repository) {
|
|
25
|
+
super();
|
|
26
|
+
this.repository = repository;
|
|
27
|
+
}
|
|
28
|
+
async insert(authenticationSession) {
|
|
29
|
+
return this.repository.insert(authenticationSession);
|
|
30
|
+
}
|
|
31
|
+
async load(id) {
|
|
32
|
+
return this.repository.load(id);
|
|
33
|
+
}
|
|
34
|
+
async extend(id, data) {
|
|
35
|
+
await this.repository.patchByFilter({ id }, data);
|
|
36
|
+
}
|
|
37
|
+
async end(id, timestamp) {
|
|
38
|
+
await this.repository.patchByFilter({ id }, { end: timestamp });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
MongoAuthenticationSessionRepository = __decorate([
|
|
42
|
+
(0, container_1.singleton)(),
|
|
43
|
+
__metadata("design:paramtypes", [InternalMongoAuthenticationSessionRepository])
|
|
44
|
+
], MongoAuthenticationSessionRepository);
|
|
45
|
+
exports.MongoAuthenticationSessionRepository = MongoAuthenticationSessionRepository;
|
|
46
|
+
let InternalMongoAuthenticationSessionRepository = class InternalMongoAuthenticationSessionRepository extends mongo_1.MongoEntityRepository {
|
|
47
|
+
[container_1.resolveArgumentType];
|
|
48
|
+
constructor(collection, logger) {
|
|
49
|
+
super(collection, mongo_1.noopTransformer, { logger, indexes });
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
InternalMongoAuthenticationSessionRepository = __decorate([
|
|
53
|
+
(0, container_1.singleton)({
|
|
54
|
+
defaultArgumentProvider: () => exports.mongoAuthenticationSessionRepositoryConfig.config
|
|
55
|
+
}),
|
|
56
|
+
__param(0, (0, container_1.forwardArg)()),
|
|
57
|
+
__metadata("design:paramtypes", [mongo_1.Collection, logger_1.Logger])
|
|
58
|
+
], InternalMongoAuthenticationSessionRepository);
|
|
59
|
+
exports.InternalMongoAuthenticationSessionRepository = InternalMongoAuthenticationSessionRepository;
|
|
60
|
+
function configureMongoAuthenticationSessionRepository(config = {}) {
|
|
61
|
+
exports.mongoAuthenticationSessionRepositoryConfig.config = config.config ?? exports.mongoAuthenticationSessionRepositoryConfig.config;
|
|
62
|
+
}
|
|
63
|
+
exports.configureMongoAuthenticationSessionRepository = configureMongoAuthenticationSessionRepository;
|
|
64
|
+
//# sourceMappingURL=mongo-authentication-session.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo-authentication-session.repository.js","sourceRoot":"","sources":["../../../source/authentication/mongo/mongo-authentication-session.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAyE;AAEzE,gDAAsF;AACtF,yCAAkC;AAElC,4FAAuF;AAS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kDAA0C,CAAC,MAAM;KACjF,CAAC;IAIa,WAAA,IAAA,sBAAU,GAAE,CAAA;qCAAa,kBAAU,EAAiC,eAAM;GAH5E,4CAA4C,CAMxD;AANY,oGAA4C;AAQzD,SAAgB,6CAA6C,CAAC,SAA8D,EAAE;IAC5H,kDAA0C,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,kDAA0C,CAAC,MAAM,CAAC;AACzH,CAAC;AAFD,sGAEC"}
|
|
@@ -16,7 +16,6 @@ export declare function toMongoProjection<T extends Entity, M extends Projection
|
|
|
16
16
|
export declare function toMongoDocument<T extends Entity>(entity: T): MongoDocument<T>;
|
|
17
17
|
export declare function toMongoDocumentWithPartialId<T extends MaybeNewEntity>(entity: T): MongoDocumentWithPartialId<T>;
|
|
18
18
|
export declare function toMongoDocumentWithoutId<T extends Entity>(entity: MaybeNewEntity<T>): MongoDocumentWithoutId<T>;
|
|
19
|
-
export declare function toMongoDocumentWithId<T extends Entity>(entity: MaybeNewEntity<T>): MongoDocument<T>;
|
|
20
19
|
export declare function mongoDocumentFromMaybeNewEntity<T extends Entity>(entity: MaybeNewEntity<T>): MongoDocument<T>;
|
|
21
20
|
export declare function renameIdPropertyToUnderscoreId<T extends {
|
|
22
21
|
id: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameIdPropertyToUnderscoreId = exports.mongoDocumentFromMaybeNewEntity = exports.
|
|
3
|
+
exports.renameIdPropertyToUnderscoreId = exports.mongoDocumentFromMaybeNewEntity = exports.toMongoDocumentWithoutId = exports.toMongoDocumentWithPartialId = exports.toMongoDocument = exports.toMongoProjection = exports.toProjectedEntity = exports.toNewEntity = exports.toEntity = void 0;
|
|
4
4
|
const database_1 = require("../..");
|
|
5
5
|
const type_guards_1 = require("../../../utils/type-guards");
|
|
6
6
|
function toEntity(document) {
|
|
@@ -53,15 +53,6 @@ function toMongoDocumentWithoutId(entity) {
|
|
|
53
53
|
return document;
|
|
54
54
|
}
|
|
55
55
|
exports.toMongoDocumentWithoutId = toMongoDocumentWithoutId;
|
|
56
|
-
function toMongoDocumentWithId(entity) {
|
|
57
|
-
const { id, ...entityRest } = entity;
|
|
58
|
-
const document = {
|
|
59
|
-
_id: id ?? (0, database_1.getNewId)(),
|
|
60
|
-
...entityRest
|
|
61
|
-
};
|
|
62
|
-
return document;
|
|
63
|
-
}
|
|
64
|
-
exports.toMongoDocumentWithId = toMongoDocumentWithId;
|
|
65
56
|
function mongoDocumentFromMaybeNewEntity(entity) {
|
|
66
57
|
const { id, ...entityRest } = entity;
|
|
67
58
|
const document = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../source/database/mongo/model/document.ts"],"names":[],"mappings":";;;AACA,oCAAsC;AACtC,4DAAgD;AAWhD,SAAgB,QAAQ,CAAmB,QAAqD;IAC9F,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,CAAC;IAExC,MAAM,MAAM,GAAM;QAChB,EAAE,EAAE,GAAG;QACP,GAAG,UAAU;KACF,CAAC;IAEd,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,4BASC;AAED,SAAgB,WAAW,CAA2B,MAAS;IAC7D,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/B,OAAO,IAAoB,CAAC;AAC9B,CAAC;AAHD,kCAGC;AAED,SAAgB,iBAAiB,CAAyE,QAA0D;IAClK,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,QAAQ,CAAC;IAE1C,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAErE,MAAM,MAAM,GAA6B;QACvC,GAAG,eAAe;QAClB,GAAG,YAAsB;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ACjF,CAAC;AAFD,oEAEC;AAED,SAAgB,wBAAwB,CAAmB,MAAyB;IAClF,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC,CAAC,wDAAwD;IAE9F,MAAM,QAAQ,GAA8B;QAC1C,GAAG,UAAU;KACe,CAAC;IAE/B,OAAO,QAAQ,CAAC;AAClB,CAAC;AARD,4DAQC;AAED,SAAgB,+BAA+B,CAAmB,MAAyB;IACzF,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;IAErC,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,EAAE,IAAI,IAAA,mBAAQ,GAAE;QACrB,GAAG,UAAU;KACM,CAAC;IAEtB,OAAO,QAAQ,CAAC;AAClB,CAAC;AATD,0EASC;AAID,SAAgB,8BAA8B,CAAyB,MAAS;IAC9E,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAE/B,MAAM,eAAe,GAAG,IAAA,uBAAS,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhE,MAAM,QAAQ,GAAG;QACf,GAAG,eAAe;QAClB,GAAG,IAAI;KACR,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAXD,wEAWC"}
|
package/database/mongo/module.js
CHANGED
|
@@ -5,7 +5,6 @@ const container_1 = require("../../container");
|
|
|
5
5
|
const core_1 = require("../../core");
|
|
6
6
|
const logger_1 = require("../../logger");
|
|
7
7
|
const type_guards_1 = require("../../utils/type-guards");
|
|
8
|
-
const Mongo = require("mongodb");
|
|
9
8
|
const classes_1 = require("./classes");
|
|
10
9
|
exports.mongoModuleConfig = {
|
|
11
10
|
defaultConnection: { url: 'mongodb://localhost:27017/test-db' },
|
|
@@ -16,8 +15,6 @@ function configureMongo(config) {
|
|
|
16
15
|
exports.mongoModuleConfig.defaultDatabase = config.defaultDatabase ?? exports.mongoModuleConfig.defaultDatabase;
|
|
17
16
|
exports.mongoModuleConfig.defaultConnection = config.defaultConnection ?? exports.mongoModuleConfig.defaultConnection;
|
|
18
17
|
exports.mongoModuleConfig.logPrefix = config.logPrefix ?? exports.mongoModuleConfig.logPrefix;
|
|
19
|
-
const mongoLogger = container_1.container.resolve(logger_1.Logger, exports.mongoModuleConfig.logPrefix);
|
|
20
|
-
Mongo.Logger.setCurrentLogger((message, parameters) => mongoLogger.verbose(JSON.stringify({ message, parameters }, undefined, 2)));
|
|
21
18
|
}
|
|
22
19
|
exports.configureMongo = configureMongo;
|
|
23
20
|
container_1.container.registerSingleton(classes_1.MongoClient, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../source/database/mongo/module.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,qCAA2C;AAC3C,yCAAkC;AAClC,yDAAwE;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../source/database/mongo/module.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,qCAA2C;AAC3C,yCAAkC;AAClC,yDAAwE;AAGxE,uCAA8D;AAUjD,QAAA,iBAAiB,GAAsB;IAClD,iBAAiB,EAAE,EAAE,GAAG,EAAE,mCAAmC,EAAE;IAC/D,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,OAAO;CACnB,CAAC;AAEF,SAAgB,cAAc,CAAC,MAAkC;IAC/D,yBAAiB,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,yBAAiB,CAAC,eAAe,CAAC;IAChG,yBAAiB,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,IAAI,yBAAiB,CAAC,iBAAiB,CAAC;IACtG,yBAAiB,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,yBAAiB,CAAC,SAAS,CAAC;AAChF,CAAC;AAJD,wCAIC;AAED,qBAAS,CAAC,iBA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C;aACnD;SACF;QAED,OAAO,QAAQ,CAAC,gBAAgB,CAAwB,MAAM,CAAC,UAAU,CAAiB,CAAC;IAC7F,CAAC;CACF,EAAE;IACD,wBAAwB,EAAE,IAAI,CAAC,SAAS;CACzC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-converter.js","sourceRoot":"","sources":["../../../source/database/mongo/query-converter.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAG3C,sDAAsD;AACtD,yDAA8G;AAM9G,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,wBAAa,CAAC,CAAC;AAE5C,SAAgB,YAAY,CAAuC,KAAe,EAAE,aAA4C,IAAI,GAAG,EAAE,EAAE,SAAkC;IAC3K,IAAI,WAAW,GAAW,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAwB,CAAC;IAE5D,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE;QACvC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,QAAmB,CAAC,CAAC;QAEpD,QAAQ,QAAQ,EAAE;YAChB,KAAK,MAAM;gBACR,WAAuD,CAAC,IAAI,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,UAAsB,EAAE,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"query-converter.js","sourceRoot":"","sources":["../../../source/database/mongo/query-converter.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAG3C,sDAAsD;AACtD,yDAA8G;AAM9G,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,wBAAa,CAAC,CAAC;AAE5C,SAAgB,YAAY,CAAuC,KAAe,EAAE,aAA4C,IAAI,GAAG,EAAE,EAAE,SAAkC;IAC3K,IAAI,WAAW,GAAW,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAA,sBAAa,EAAC,KAAK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Aa,EAAE,UAAyC;IACxH,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAgB,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC;IACvE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAuB,CAAC;AACtE,CAAC;AAHD,kCAGC"}
|
package/database/query.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare const allOrders: Order[];
|
|
|
26
26
|
export type Operator = 'and' | 'or';
|
|
27
27
|
export declare const allOperators: Operator[];
|
|
28
28
|
export type Sort<T = any> = {
|
|
29
|
-
field:
|
|
29
|
+
field: Extract<keyof T, string> | '$score';
|
|
30
30
|
order?: Order;
|
|
31
31
|
};
|
|
32
32
|
export type LogicalAndQuery<T = any> = {
|
package/examples/mail/basic.js
CHANGED
|
@@ -4,7 +4,7 @@ const container_1 = require("../../container");
|
|
|
4
4
|
const mail_1 = require("../../mail");
|
|
5
5
|
const nodemailer_mail_client_1 = require("../../mail/clients/nodemailer.mail-client");
|
|
6
6
|
const templates_1 = require("../../templates");
|
|
7
|
-
const
|
|
7
|
+
const file_template_provider_1 = require("../../templates/providers/file.template-provider");
|
|
8
8
|
const handlebars_template_renderer_1 = require("../../templates/renderers/handlebars.template-renderer");
|
|
9
9
|
const mjml_template_renderer_1 = require("../../templates/renderers/mjml.template-renderer");
|
|
10
10
|
const file_template_resolver_1 = require("../../templates/resolvers/file.template-resolver");
|
|
@@ -24,10 +24,10 @@ const core_1 = require("../../core");
|
|
|
24
24
|
client: nodemailer_mail_client_1.NodemailerMailClient
|
|
25
25
|
});
|
|
26
26
|
(0, templates_1.configureTemplates)({
|
|
27
|
-
templateProvider:
|
|
27
|
+
templateProvider: file_template_provider_1.FileTemplateProvider,
|
|
28
28
|
templateRenderers: [mjml_template_renderer_1.MjmlTemplateRenderer, handlebars_template_renderer_1.HandlebarsTemplateRenderer]
|
|
29
29
|
});
|
|
30
|
-
(0,
|
|
30
|
+
(0, file_template_provider_1.configureFileTemplateProvider)({ basePath: (0, path_1.resolve)(__dirname, 'templates') });
|
|
31
31
|
(0, file_template_resolver_1.configureFileTemplateResolver)({ basePath: (0, path_1.resolve)(__dirname.replace('/dist', '/source'), 'templates') });
|
|
32
32
|
async function test() {
|
|
33
33
|
const service = await container_1.container.resolveAsync(mail_1.MailService);
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
3
4
|
const mail_1 = require("../../../mail");
|
|
5
|
+
const jsx_template_resolver_1 = require("../../../templates/resolvers/jsx.template-resolver");
|
|
4
6
|
const string_template_resolver_1 = require("../../../templates/resolvers/string.template-resolver");
|
|
5
|
-
|
|
7
|
+
function HelloMail({ name }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("mjml", { children: (0, jsx_runtime_1.jsx)("mj-body", { children: (0, jsx_runtime_1.jsx)("mj-section", { children: (0, jsx_runtime_1.jsx)("mj-column", { children: (0, jsx_runtime_1.jsxs)("mj-text", { "font-size": "20px", color: "#F45E43", "font-family": "helvetica", children: ["Hello ", name, " in html!"] }) }) }) }) }));
|
|
9
|
+
}
|
|
10
|
+
const template = (0, mail_1.mailTemplate)('hello-name', {
|
|
6
11
|
subject: (0, string_template_resolver_1.stringTemplateField)({ renderer: 'handlebars', template: 'Hello {{ name }} in subject!' }),
|
|
7
|
-
html: (0,
|
|
12
|
+
html: (0, jsx_template_resolver_1.jsxTemplateField)({ renderer: 'mjml-jsx', template: HelloMail }),
|
|
8
13
|
text: (0, string_template_resolver_1.stringTemplateField)({ renderer: 'handlebars', template: 'Hello {{ name }} in text!' })
|
|
9
14
|
});
|
|
10
15
|
exports.default = template;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/mail/templates/hello-name.
|
|
1
|
+
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/mail/templates/hello-name.tsx"],"names":[],"mappings":";;;AAAA,wCAAsC;AAGtC,8FAA+E;AAC/E,oGAAqF;AAGrF,SAAS,SAAS,CAAC,EAAE,IAAI,EAAoB;IAC3C,OAAO,CACL,2CACE,8CACE,iDACE,gDACE,kDAAmB,MAAM,EAAC,KAAK,EAAC,SAAS,iBAAa,WAAW,uBAAQ,IAAI,iBAAoB,GACvF,GACD,GACL,GACL,CACR,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG,IAAA,mBAAY,EAAC,YAAY,EAAE;IAC1C,OAAO,EAAE,IAAA,8CAAmB,EAA6B,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,8BAA8B,EAAE,CAAC;IAC9H,IAAI,EAAE,IAAA,wCAAgB,EAAuB,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC3F,IAAI,EAAE,IAAA,8CAAmB,EAA6B,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC;CACzH,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC"}
|
package/examples/pdf/basic.js
CHANGED
|
@@ -5,18 +5,18 @@ const container_1 = require("../../container");
|
|
|
5
5
|
const core_1 = require("../../core");
|
|
6
6
|
const pdf_service_1 = require("../../pdf/pdf.service");
|
|
7
7
|
const templates_1 = require("../../templates");
|
|
8
|
-
const
|
|
8
|
+
const file_template_provider_1 = require("../../templates/providers/file.template-provider");
|
|
9
9
|
const handlebars_template_renderer_1 = require("../../templates/renderers/handlebars.template-renderer");
|
|
10
10
|
const mjml_template_renderer_1 = require("../../templates/renderers/mjml.template-renderer");
|
|
11
11
|
const file_template_resolver_1 = require("../../templates/resolvers/file.template-resolver");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
(0, core_1.configureTstdl)();
|
|
14
14
|
(0, templates_1.configureTemplates)({
|
|
15
|
-
templateProvider:
|
|
15
|
+
templateProvider: file_template_provider_1.FileTemplateProvider,
|
|
16
16
|
templateResolvers: [file_template_resolver_1.FileTemplateResolver],
|
|
17
17
|
templateRenderers: [mjml_template_renderer_1.MjmlTemplateRenderer, handlebars_template_renderer_1.HandlebarsTemplateRenderer]
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
(0, file_template_provider_1.configureFileTemplateProvider)({ basePath: (0, path_1.resolve)(__dirname, 'templates') });
|
|
20
20
|
(0, file_template_resolver_1.configureFileTemplateResolver)({ basePath: (0, path_1.resolve)(__dirname.replace('dist', 'source'), 'templates') });
|
|
21
21
|
async function test() {
|
|
22
22
|
const pdfService = await container_1.container.resolveAsync(pdf_service_1.PdfService);
|
|
@@ -7,7 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
function reverse(value) {
|
|
8
8
|
return value.split('').reverse().join('');
|
|
9
9
|
}
|
|
10
|
-
const template = (0, pdf_1.pdfTemplate)({
|
|
10
|
+
const template = (0, pdf_1.pdfTemplate)('hello-name', {
|
|
11
11
|
body: (0, file_template_resolver_1.fileTemplateField)({
|
|
12
12
|
renderer: 'handlebars',
|
|
13
13
|
templateFile: (0, path_1.resolve)(__dirname.replace('dist', 'source'), 'hello-name.hbs'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/pdf/templates/hello-name.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAGpC,gGAAiF;AACjF,oGAAqF;AACrF,+BAA+B;AAE/B,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAQ,KAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,QAAQ,GAAG,IAAA,iBAAW,EAAC;
|
|
1
|
+
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/pdf/templates/hello-name.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAGpC,gGAAiF;AACjF,oGAAqF;AACrF,+BAA+B;AAE/B,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAQ,KAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,QAAQ,GAAG,IAAA,iBAAW,EAAC,YAAY,EAAE;IACzC,IAAI,EAAE,IAAA,0CAAiB,EAA6B;QAClD,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,IAAA,cAAO,EAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5E,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,QAAQ,EAAE,IAAA,8CAAmB,EAA6B;oBACxD,QAAQ,EAAE,YAAY;oBACtB,QAAQ,EAAE,6BAA6B;oBACvC,OAAO,EAAE;wBACP,OAAO,EAAE,EAAE,OAAO,EAAE;qBACrB;iBACF,CAAC;aACH;SACF;KACF,CAAC;IACF,MAAM,EAAE,IAAA,8CAAmB,EAAyB;QAClD,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,uBAAuB;KAClC,CAAC;IACF,MAAM,EAAE,IAAA,8CAAmB,EAAyB;QAClD,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,uBAAuB;KAClC,CAAC;CACH,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC"}
|
|
@@ -4,22 +4,28 @@ const application_1 = require("../../application");
|
|
|
4
4
|
const container_1 = require("../../container");
|
|
5
5
|
const core_1 = require("../../core");
|
|
6
6
|
const templates_1 = require("../../templates");
|
|
7
|
-
const
|
|
7
|
+
const file_template_provider_1 = require("../../templates/providers/file.template-provider");
|
|
8
8
|
const handlebars_template_renderer_1 = require("../../templates/renderers/handlebars.template-renderer");
|
|
9
|
+
const jsx_template_renderer_1 = require("../../templates/renderers/jsx.template-renderer");
|
|
9
10
|
const file_template_resolver_1 = require("../../templates/resolvers/file.template-resolver");
|
|
11
|
+
const jsx_template_resolver_1 = require("../../templates/resolvers/jsx.template-resolver");
|
|
10
12
|
const path_1 = require("path");
|
|
11
13
|
(0, core_1.configureTstdl)();
|
|
12
14
|
(0, templates_1.configureTemplates)({
|
|
13
|
-
templateProvider:
|
|
14
|
-
templateResolvers: [file_template_resolver_1.FileTemplateResolver],
|
|
15
|
-
templateRenderers: [handlebars_template_renderer_1.HandlebarsTemplateRenderer]
|
|
15
|
+
templateProvider: file_template_provider_1.FileTemplateProvider,
|
|
16
|
+
templateResolvers: [file_template_resolver_1.FileTemplateResolver, jsx_template_resolver_1.JsxTemplateResolver],
|
|
17
|
+
templateRenderers: [handlebars_template_renderer_1.HandlebarsTemplateRenderer, jsx_template_renderer_1.JsxTemplateRenderer]
|
|
16
18
|
});
|
|
17
|
-
(0,
|
|
19
|
+
(0, file_template_provider_1.configureFileTemplateProvider)({ basePath: (0, path_1.resolve)(__dirname, 'templates') });
|
|
18
20
|
(0, file_template_resolver_1.configureFileTemplateResolver)({ basePath: (0, path_1.resolve)(__dirname.replace('dist', 'source'), 'templates') });
|
|
19
21
|
async function test() {
|
|
20
22
|
const templateService = await container_1.container.resolveAsync(templates_1.TemplateService);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
const handlebarsResult = await templateService.render('hello-name', { name: 'Max Mustermann' });
|
|
24
|
+
const jsxResult = await templateService.render('hello-jsx', { name: 'Max Mustermann' });
|
|
25
|
+
console.log({
|
|
26
|
+
handlebars: handlebarsResult.fields,
|
|
27
|
+
jsx: jsxResult.fields
|
|
28
|
+
});
|
|
23
29
|
}
|
|
24
30
|
application_1.Application.run(test);
|
|
25
31
|
//# sourceMappingURL=basic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../source/examples/template/basic.ts"],"names":[],"mappings":";;AAAA,mDAA4C;AAC5C,+CAAwC;AACxC,qCAAwC;AACxC,+CAAkE;AAClE,6FAAmH;AACnH,yGAAgG;AAChG,6FAAmH;AACnH,+BAA+B;AAE/B,IAAA,qBAAc,GAAE,CAAC;AAEjB,IAAA,8BAAkB,EAAC;IACjB,gBAAgB,EAAE,6CAAoB;IACtC,iBAAiB,EAAE,CAAC,6CAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../source/examples/template/basic.ts"],"names":[],"mappings":";;AAAA,mDAA4C;AAC5C,+CAAwC;AACxC,qCAAwC;AACxC,+CAAkE;AAClE,6FAAmH;AACnH,yGAAgG;AAChG,2FAAkF;AAClF,6FAAmH;AACnH,2FAAkF;AAClF,+BAA+B;AAE/B,IAAA,qBAAc,GAAE,CAAC;AAEjB,IAAA,8BAAkB,EAAC;IACjB,gBAAgB,EAAE,6CAAoB;IACtC,iBAAiB,EAAE,CAAC,6CAAoB,EAAE,2CAAmB,CAAC;IAC9D,iBAAiB,EAAE,CAAC,yDAA0B,EAAE,2CAAmB,CAAC;CACrE,CAAC,CAAC;AAEH,IAAA,sDAA6B,EAAC,EAAE,QAAQ,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AAC7E,IAAA,sDAA6B,EAAC,EAAE,QAAQ,EAAE,IAAA,cAAO,EAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AAEvG,KAAK,UAAU,IAAI;IACjB,MAAM,eAAe,GAAG,MAAM,qBAAS,CAAC,YAAY,CAAC,2BAAe,CAAC,CAAC;IACtE,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAChG,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAExF,OAAO,CAAC,GAAG,CAAC;QACV,UAAU,EAAE,gBAAgB,CAAC,MAAM;QACnC,GAAG,EAAE,SAAS,CAAC,MAAM;KACtB,CAAC,CAAC;AACL,CAAC;AAED,yBAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.template = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
5
|
+
const templates_1 = require("../../../templates");
|
|
6
|
+
const jsx_template_resolver_1 = require("../../../templates/resolvers/jsx.template-resolver");
|
|
7
|
+
function HelloJsx({ name }) {
|
|
8
|
+
return (0, jsx_runtime_1.jsxs)("h1", { children: ["Hello ", name, "!"] });
|
|
9
|
+
}
|
|
10
|
+
exports.template = (0, templates_1.simpleTemplate)('hello-jsx', (0, jsx_template_resolver_1.jsxTemplateField)({
|
|
11
|
+
renderer: 'jsx',
|
|
12
|
+
template: HelloJsx
|
|
13
|
+
}));
|
|
14
|
+
exports.default = exports.template;
|
|
15
|
+
//# sourceMappingURL=hello-jsx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello-jsx.js","sourceRoot":"","sources":["../../../../source/examples/template/templates/hello-jsx.tsx"],"names":[],"mappings":";;;;AAAA,kDAA6C;AAE7C,8FAA+E;AAG/E,SAAS,QAAQ,CAAC,EAAE,IAAI,EAAoB;IAC1C,OAAO,qDAAW,IAAI,SAAO,CAAC;AAChC,CAAC;AAEY,QAAA,QAAQ,GAAG,IAAA,0BAAc,EAAC,WAAW,EAChD,IAAA,wCAAgB,EAAsB;IACpC,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,QAAQ;CACnB,CAAC,CACH,CAAC;AAEF,kBAAe,gBAAQ,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const templates_1 = require("../../../templates");
|
|
4
4
|
const string_template_resolver_1 = require("../../../templates/resolvers/string.template-resolver");
|
|
5
5
|
const type_guards_1 = require("../../../utils/type-guards");
|
|
6
|
-
const template = (0, templates_1.simpleTemplate)((0, string_template_resolver_1.stringTemplateField)({
|
|
6
|
+
const template = (0, templates_1.simpleTemplate)('hello-name', (0, string_template_resolver_1.stringTemplateField)({
|
|
7
7
|
renderer: 'handlebars',
|
|
8
8
|
template: '{{#fooBlockHelper this "A test argument"}}{{>fooPartial hobby="Music" }}{{/fooBlockHelper}}',
|
|
9
9
|
options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/template/templates/hello-name.ts"],"names":[],"mappings":";;AAAA,kDAA6C;AAE7C,oGAAqF;AACrF,4DAAqD;AAErD,MAAM,QAAQ,GAAG,IAAA,0BAAc,
|
|
1
|
+
{"version":3,"file":"hello-name.js","sourceRoot":"","sources":["../../../../source/examples/template/templates/hello-name.ts"],"names":[],"mappings":";;AAAA,kDAA6C;AAE7C,oGAAqF;AACrF,4DAAqD;AAErD,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,YAAY,EAC1C,IAAA,8CAAmB,EAA6B;IAC9C,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,6FAA6F;IACvG,OAAO,EAAE;QACP,OAAO,EAAE;YACP,cAAc,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;gBACzC,IAAA,4BAAc,EAAC,OAAO,CAAC,EAAE,EAAE,kDAAkD,CAAC,CAAC;gBAC/E,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;gBAExC,OAAO,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACtC,CAAC;SACF;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,IAAA,8CAAmB,EAA6B,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,qDAAqD,EAAE,CAAC;SACzJ;KACF;CACF,CAAC,CACH,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undici-http-client.adapter.js","sourceRoot":"","sources":["../../../../source/http/client/adapters/undici-http-client.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA8D;AAC9D,gCAAiE;AACjE,gDAAwC;AACxC,4DAAgD;
|
|
1
|
+
{"version":3,"file":"undici-http-client.adapter.js","sourceRoot":"","sources":["../../../../source/http/client/adapters/undici-http-client.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA8D;AAC9D,gCAAiE;AACjE,gDAAwC;AACxC,4DAAgD;AAChD,mCAAkC;AAGlC,mCAAyD;AAEzD,kEAA6D;AAC7D,gEAA2D;AAM3D,IAAI,cAAc,GAAmC,EAAE,CAAC;AAGjD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,uCAAiB;IAC3C,OAAO,CAAiC;IAEzD,YAAyB,UAA0C,EAAE;QACnE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,kEAAkE;IAClE,KAAK,CAAC,IAAI,CAAC,iBAAoC;QAC7C,IAAI,IAAwC,CAAC;QAE7C,IAAI,IAAA,uBAAS,EAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;YAC3C,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAK,CAAC,IAAI,CAAC,CAAC;SACrD;aACI,IAAI,IAAA,uBAAS,EAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;YAChD,IAAI,GAAG,iBAAiB,CAAC,IAAK,CAAC,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AAgB,gCAAgC,CAAC,UAAmE,EAAE;IACpH,cAAc,GAAG,OAAO,CAAC;IAEzB,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;QAC5B,qBAAS,CAAC,QAAQ,CAAC,uCAAiB,EAAE,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC,CAAC;KAC9E;AACH,CAAC;AAND,4EAMC"}
|
package/http/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { OneOrMany } from "../types";
|
|
1
|
+
import type { OneOrMany, WritableOneOrMany } from "../types";
|
|
2
2
|
export type HttpValue = string | number | boolean | null;
|
|
3
3
|
export type NormalizedHttpValue = string;
|
|
4
4
|
export type HttpValueObject = Record<string, OneOrMany<HttpValue>>;
|
|
5
|
-
export type NormalizedHttpValueObject = Record<string,
|
|
5
|
+
export type NormalizedHttpValueObject = Record<string, WritableOneOrMany<string>>;
|
|
6
6
|
export type HttpMethod = 'HEAD' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
7
|
-
export declare function normalizeHttpValue(value: OneOrMany<HttpValue>):
|
|
7
|
+
export declare function normalizeHttpValue(value: OneOrMany<HttpValue>): WritableOneOrMany<string>;
|
|
8
8
|
export declare function normalizeSingleHttpValue(value: HttpValue): string;
|
|
9
9
|
export declare function denormalizeHttpValue(value: OneOrMany<HttpValue>): OneOrMany<HttpValue>;
|
|
10
10
|
export declare function denormlizeSingleHttpValue(value: HttpValue): HttpValue;
|
package/mail/mail.service.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TemplateService } from "../templates";
|
|
|
3
3
|
import type { TypedOmit } from "../types";
|
|
4
4
|
import { MailLogRepository } from './mail-log.repository';
|
|
5
5
|
import { MailClient } from './mail.client';
|
|
6
|
-
import type { MailData, MailSendResult } from './models';
|
|
6
|
+
import type { MailData, MailSendResult, MailTemplate } from './models';
|
|
7
7
|
import { DefaultMailData } from './models';
|
|
8
8
|
export declare class MailService {
|
|
9
9
|
private readonly mailClient;
|
|
@@ -11,8 +11,9 @@ export declare class MailService {
|
|
|
11
11
|
private readonly mailLogRepository;
|
|
12
12
|
private readonly defaultData;
|
|
13
13
|
private readonly logger;
|
|
14
|
-
private readonly mailDataSourceTemplateKey;
|
|
15
14
|
constructor(mailClient: MailClient, templateService: TemplateService, mailLogRepository: MailLogRepository | undefined, logger: Logger, defaultData?: DefaultMailData);
|
|
16
15
|
send(mailData: MailData): Promise<MailSendResult>;
|
|
17
|
-
|
|
16
|
+
/** @deprecated internal */
|
|
17
|
+
send(mailData: MailData, templateName?: string): Promise<MailSendResult>;
|
|
18
|
+
sendTemplate(keyOrTemplate: string | MailTemplate, mailData: TypedOmit<MailData, 'content' | 'subject'>, templateContext?: object): Promise<MailSendResult>;
|
|
18
19
|
}
|