@webiny/api-mailer 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0
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/MailerFeature.d.ts +4 -0
- package/MailerFeature.js +23 -0
- package/MailerFeature.js.map +1 -0
- package/constants.d.ts +1 -1
- package/constants.js +2 -1
- package/constants.js.map +1 -1
- package/domain/MailTransport/abstractions.d.ts +8 -3
- package/domain/MailTransport/abstractions.js +3 -2
- package/domain/MailTransport/abstractions.js.map +1 -1
- package/domain/MailerService/abstractions.d.ts +4 -2
- package/domain/MailerService/abstractions.js +2 -1
- package/domain/MailerService/abstractions.js.map +1 -1
- package/domain/MailerService/errors.d.ts +4 -0
- package/domain/MailerService/errors.js +29 -24
- package/domain/MailerService/errors.js.map +1 -1
- package/domain/TransportSettings/abstractions.d.ts +47 -0
- package/domain/TransportSettings/abstractions.js +5 -0
- package/domain/TransportSettings/abstractions.js.map +1 -0
- package/domain/TransportSettings/findDefinition.d.ts +6 -0
- package/domain/TransportSettings/findDefinition.js +13 -0
- package/domain/TransportSettings/findDefinition.js.map +1 -0
- package/domain/errors.d.ts +23 -5
- package/domain/errors.js +68 -40
- package/domain/errors.js.map +1 -1
- package/exports/api/mailer.d.ts +6 -0
- package/exports/api/mailer.js +6 -0
- package/features/GetSettings/GetSettingsRepository.d.ts +7 -5
- package/features/GetSettings/GetSettingsRepository.js +43 -30
- package/features/GetSettings/GetSettingsRepository.js.map +1 -1
- package/features/GetSettings/GetSettingsUseCase.d.ts +11 -4
- package/features/GetSettings/GetSettingsUseCase.js +38 -10
- package/features/GetSettings/GetSettingsUseCase.js.map +1 -1
- package/features/GetSettings/abstractions.d.ts +20 -6
- package/features/GetSettings/abstractions.js +3 -2
- package/features/GetSettings/abstractions.js.map +1 -1
- package/features/GetSettings/feature.d.ts +4 -1
- package/features/GetSettings/feature.js +7 -6
- package/features/GetSettings/feature.js.map +1 -1
- package/features/GetSettings/index.d.ts +2 -1
- package/features/GetSettings/index.js +1 -3
- package/features/IsMailerConfigured/IsMailerConfiguredUseCase.d.ts +11 -0
- package/features/IsMailerConfigured/IsMailerConfiguredUseCase.js +19 -0
- package/features/IsMailerConfigured/IsMailerConfiguredUseCase.js.map +1 -0
- package/features/IsMailerConfigured/abstractions.d.ts +18 -0
- package/features/IsMailerConfigured/abstractions.js +5 -0
- package/features/IsMailerConfigured/abstractions.js.map +1 -0
- package/features/IsMailerConfigured/feature.d.ts +4 -0
- package/features/IsMailerConfigured/feature.js +11 -0
- package/features/IsMailerConfigured/feature.js.map +1 -0
- package/features/IsMailerConfigured/index.d.ts +1 -0
- package/features/IsMailerConfigured/index.js +1 -0
- package/features/MailerService/MailerService.d.ts +3 -4
- package/features/MailerService/MailerService.js +42 -41
- package/features/MailerService/MailerService.js.map +1 -1
- package/features/MailerService/feature.d.ts +4 -1
- package/features/MailerService/feature.js +6 -5
- package/features/MailerService/feature.js.map +1 -1
- package/features/SaveSettings/SaveSettingsRepository.d.ts +4 -3
- package/features/SaveSettings/SaveSettingsRepository.js +58 -48
- package/features/SaveSettings/SaveSettingsRepository.js.map +1 -1
- package/features/SaveSettings/SaveSettingsUseCase.d.ts +6 -4
- package/features/SaveSettings/SaveSettingsUseCase.js +49 -42
- package/features/SaveSettings/SaveSettingsUseCase.js.map +1 -1
- package/features/SaveSettings/abstractions.d.ts +22 -21
- package/features/SaveSettings/abstractions.js +5 -8
- package/features/SaveSettings/abstractions.js.map +1 -1
- package/features/SaveSettings/events.d.ts +3 -3
- package/features/SaveSettings/events.js +17 -12
- package/features/SaveSettings/events.js.map +1 -1
- package/features/SaveSettings/feature.d.ts +4 -1
- package/features/SaveSettings/feature.js +7 -6
- package/features/SaveSettings/feature.js.map +1 -1
- package/features/SaveSettings/index.d.ts +2 -1
- package/features/SaveSettings/index.js +1 -3
- package/features/SendMail/SendMailUseCase.d.ts +2 -2
- package/features/SendMail/SendMailUseCase.js +44 -48
- package/features/SendMail/SendMailUseCase.js.map +1 -1
- package/features/SendMail/abstractions.d.ts +7 -7
- package/features/SendMail/abstractions.js +5 -8
- package/features/SendMail/abstractions.js.map +1 -1
- package/features/SendMail/events.d.ts +4 -4
- package/features/SendMail/events.js +24 -17
- package/features/SendMail/events.js.map +1 -1
- package/features/SendMail/feature.d.ts +4 -1
- package/features/SendMail/feature.js +6 -5
- package/features/SendMail/feature.js.map +1 -1
- package/features/SendMail/index.d.ts +1 -0
- package/features/SendMail/index.js +1 -0
- package/features/SendTestMail/SendTestMailUseCase.d.ts +13 -0
- package/features/SendTestMail/SendTestMailUseCase.js +40 -0
- package/features/SendTestMail/SendTestMailUseCase.js.map +1 -0
- package/features/SendTestMail/abstractions.d.ts +32 -0
- package/features/SendTestMail/abstractions.js +5 -0
- package/features/SendTestMail/abstractions.js.map +1 -0
- package/features/SendTestMail/feature.d.ts +4 -0
- package/features/SendTestMail/feature.js +11 -0
- package/features/SendTestMail/feature.js.map +1 -0
- package/graphql/MailerSchemaFactory.d.ts +10 -0
- package/graphql/MailerSchemaFactory.js +135 -0
- package/graphql/MailerSchemaFactory.js.map +1 -0
- package/index.d.ts +11 -2
- package/index.js +8 -26
- package/package.json +25 -33
- package/types.d.ts +0 -8
- package/types.js +0 -3
- package/utils/isMailboxAddress.d.ts +6 -0
- package/utils/isMailboxAddress.js +5 -0
- package/utils/isMailboxAddress.js.map +1 -0
- package/domain/Encryption/abstractions.d.ts +0 -8
- package/domain/Encryption/abstractions.js +0 -4
- package/domain/Encryption/abstractions.js.map +0 -1
- package/features/DummyTransport/DummyMailTransport.d.ts +0 -9
- package/features/DummyTransport/DummyMailTransport.js +0 -12
- package/features/DummyTransport/DummyMailTransport.js.map +0 -1
- package/features/DummyTransport/DummyMailTransportFactory.d.ts +0 -8
- package/features/DummyTransport/DummyMailTransportFactory.js +0 -13
- package/features/DummyTransport/DummyMailTransportFactory.js.map +0 -1
- package/features/DummyTransport/feature.d.ts +0 -1
- package/features/DummyTransport/feature.js +0 -10
- package/features/DummyTransport/feature.js.map +0 -1
- package/features/Encryption/PasswordEncryption.d.ts +0 -9
- package/features/Encryption/PasswordEncryption.js +0 -23
- package/features/Encryption/PasswordEncryption.js.map +0 -1
- package/features/Encryption/feature.d.ts +0 -1
- package/features/Encryption/feature.js +0 -10
- package/features/Encryption/feature.js.map +0 -1
- package/features/Encryption/utils/password.d.ts +0 -7
- package/features/Encryption/utils/password.js +0 -56
- package/features/Encryption/utils/password.js.map +0 -1
- package/features/Encryption/utils/secret.d.ts +0 -1
- package/features/Encryption/utils/secret.js +0 -11
- package/features/Encryption/utils/secret.js.map +0 -1
- package/features/GetSettings/index.js.map +0 -1
- package/features/MailerService/TransportFactory.d.ts +0 -2
- package/features/MailerService/TransportFactory.js +0 -31
- package/features/MailerService/TransportFactory.js.map +0 -1
- package/features/SaveSettings/index.js.map +0 -1
- package/features/SaveSettings/validation.d.ts +0 -23
- package/features/SaveSettings/validation.js +0 -19
- package/features/SaveSettings/validation.js.map +0 -1
- package/features/SmtpTransport/SmtpConfig.d.ts +0 -6
- package/features/SmtpTransport/SmtpConfig.js +0 -29
- package/features/SmtpTransport/SmtpConfig.js.map +0 -1
- package/features/SmtpTransport/SmtpMailTransport.d.ts +0 -18
- package/features/SmtpTransport/SmtpMailTransport.js +0 -61
- package/features/SmtpTransport/SmtpMailTransport.js.map +0 -1
- package/features/SmtpTransport/SmtpMailTransportFactory.d.ts +0 -9
- package/features/SmtpTransport/SmtpMailTransportFactory.js +0 -14
- package/features/SmtpTransport/SmtpMailTransportFactory.js.map +0 -1
- package/features/SmtpTransport/feature.d.ts +0 -1
- package/features/SmtpTransport/feature.js +0 -10
- package/features/SmtpTransport/feature.js.map +0 -1
- package/graphql/settings.d.ts +0 -3
- package/graphql/settings.js +0 -115
- package/graphql/settings.js.map +0 -1
- package/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/GetSettings/GetSettingsRepository.js","sources":["../../../src/features/GetSettings/GetSettingsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { Encryption } from \"@webiny/api-core/features/encryption/index.js\";\nimport { KeyValueStore } from \"@webiny/api-core/features/keyValueStore/index.js\";\nimport { GetSettingsRepository, type ISettingsWithSource } from \"./abstractions.js\";\nimport { TransportSettingsDefinition } from \"~/domain/TransportSettings/abstractions.js\";\nimport {\n findDefinition,\n getStorageKey,\n withDefaults\n} from \"~/domain/TransportSettings/findDefinition.js\";\nimport { UnknownTransportSettings } from \"~/domain/errors.js\";\n\nclass GetSettingsRepositoryImpl implements GetSettingsRepository.Interface {\n constructor(\n private keyValueStore: KeyValueStore.Interface,\n private encryption: Encryption.Interface,\n private definitions: TransportSettingsDefinition.Interface[]\n ) {}\n\n async get<TSettings extends object>(\n transport: string\n ): Promise<Result<ISettingsWithSource<TSettings>, UnknownTransportSettings>> {\n const definition = findDefinition(this.definitions, transport);\n if (!definition) {\n return Result.fail(new UnknownTransportSettings(transport));\n }\n\n // Settings set in code win over stored ones.\n const codeSettings = definition.getCodeSettings?.() ?? null;\n if (codeSettings !== null) {\n return Result.ok({\n settings: withDefaults(definition, codeSettings) as TSettings,\n source: \"code\"\n });\n }\n\n const result = await this.keyValueStore.get<TransportSettingsDefinition.Values>(\n getStorageKey(definition)\n );\n if (result.isFail() || !result.value) {\n return Result.ok({ settings: null, source: null });\n }\n\n const settings = { ...result.value };\n for (const secret of definition.secrets ?? []) {\n settings[secret] = settings[secret]\n ? await this.encryption.decrypt(String(settings[secret]))\n : \"\";\n }\n\n return Result.ok({\n settings: withDefaults(definition, settings) as TSettings,\n source: \"storage\"\n });\n }\n}\n\nexport const GetSettingsRepositoryImplementation = GetSettingsRepository.createImplementation({\n implementation: GetSettingsRepositoryImpl,\n dependencies: [KeyValueStore, Encryption, [TransportSettingsDefinition, { multiple: true }]]\n});\n"],"names":["GetSettingsRepositoryImpl","keyValueStore","encryption","definitions","transport","definition","findDefinition","Result","UnknownTransportSettings","codeSettings","withDefaults","result","getStorageKey","settings","secret","String","GetSettingsRepositoryImplementation","GetSettingsRepository","KeyValueStore","Encryption","TransportSettingsDefinition"],"mappings":";;;;;;;AAYA,MAAMA;IACF,YACYC,aAAsC,EACtCC,UAAgC,EAChCC,WAAoD,CAC9D;aAHUF,aAAa,GAAbA;aACAC,UAAU,GAAVA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,IACFC,SAAiB,EACwD;QACzE,MAAMC,aAAaC,eAAe,IAAI,CAAC,WAAW,EAAEF;QACpD,IAAI,CAACC,YACD,OAAOE,OAAO,IAAI,CAAC,IAAIC,yBAAyBJ;QAIpD,MAAMK,eAAeJ,WAAW,eAAe,QAAQ;QACvD,IAAII,AAAiB,SAAjBA,cACA,OAAOF,OAAO,EAAE,CAAC;YACb,UAAUG,aAAaL,YAAYI;YACnC,QAAQ;QACZ;QAGJ,MAAME,SAAS,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CACvCC,cAAcP;QAElB,IAAIM,OAAO,MAAM,MAAM,CAACA,OAAO,KAAK,EAChC,OAAOJ,OAAO,EAAE,CAAC;YAAE,UAAU;YAAM,QAAQ;QAAK;QAGpD,MAAMM,WAAW;YAAE,GAAGF,OAAO,KAAK;QAAC;QACnC,KAAK,MAAMG,UAAUT,WAAW,OAAO,IAAI,EAAE,CACzCQ,QAAQ,CAACC,OAAO,GAAGD,QAAQ,CAACC,OAAO,GAC7B,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACC,OAAOF,QAAQ,CAACC,OAAO,KACrD;QAGV,OAAOP,OAAO,EAAE,CAAC;YACb,UAAUG,aAAaL,YAAYQ;YACnC,QAAQ;QACZ;IACJ;AACJ;AAEO,MAAMG,sCAAsCC,sBAAsB,oBAAoB,CAAC;IAC1F,gBAAgBjB;IAChB,cAAc;QAACkB;QAAeC;QAAY;YAACC;YAA6B;gBAAE,UAAU;YAAK;SAAE;KAAC;AAChG"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
2
3
|
import { GetSettingsUseCase, GetSettingsRepository } from "./abstractions.js";
|
|
3
|
-
import
|
|
4
|
+
import { TransportSettingsDefinition } from "../../domain/TransportSettings/abstractions.js";
|
|
5
|
+
import { SettingsNotAuthorized, UnknownTransportSettings } from "../../domain/errors.js";
|
|
4
6
|
declare class GetSettingsUseCaseImpl implements GetSettingsUseCase.Interface {
|
|
7
|
+
private identityContext;
|
|
5
8
|
private repository;
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
private definitions;
|
|
10
|
+
constructor(identityContext: IdentityContext.Interface, repository: GetSettingsRepository.Interface, definitions: TransportSettingsDefinition.Interface[]);
|
|
11
|
+
execute(transport: string): Promise<Result<never, SettingsNotAuthorized> | Result<never, UnknownTransportSettings> | Result<{
|
|
12
|
+
settings: import("~/domain/TransportSettings/abstractions.js").TransportSettingsValues | null;
|
|
13
|
+
source: import("./abstractions.js").MailerSettingsSource;
|
|
14
|
+
}, never>>;
|
|
8
15
|
}
|
|
9
16
|
export declare const GetSettingsUseCaseImplementation: typeof GetSettingsUseCaseImpl & {
|
|
10
|
-
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").
|
|
17
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetSettingsUseCase>;
|
|
11
18
|
};
|
|
12
19
|
export {};
|
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
3
|
+
import { GetSettingsRepository, GetSettingsUseCase } from "./abstractions.js";
|
|
4
|
+
import { TransportSettingsDefinition } from "../../domain/TransportSettings/abstractions.js";
|
|
5
|
+
import { findDefinition, withoutSecrets } from "../../domain/TransportSettings/findDefinition.js";
|
|
6
|
+
import { SettingsNotAuthorized, UnknownTransportSettings } from "../../domain/errors.js";
|
|
7
|
+
import { MAILER_SETTINGS_PERMISSION } from "../../constants.js";
|
|
2
8
|
class GetSettingsUseCaseImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
constructor(identityContext, repository, definitions){
|
|
10
|
+
this.identityContext = identityContext;
|
|
11
|
+
this.repository = repository;
|
|
12
|
+
this.definitions = definitions;
|
|
13
|
+
}
|
|
14
|
+
async execute(transport) {
|
|
15
|
+
const permission = await this.identityContext.getPermission(MAILER_SETTINGS_PERMISSION);
|
|
16
|
+
if (!permission) return Result.fail(new SettingsNotAuthorized("Not allowed to read the mailer settings."));
|
|
17
|
+
const definition = findDefinition(this.definitions, transport);
|
|
18
|
+
if (!definition) return Result.fail(new UnknownTransportSettings(transport));
|
|
19
|
+
const result = await this.repository.get(transport);
|
|
20
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
21
|
+
const { settings, source } = result.value;
|
|
22
|
+
return Result.ok({
|
|
23
|
+
settings: settings ? withoutSecrets(definition, settings) : null,
|
|
24
|
+
source
|
|
25
|
+
});
|
|
26
|
+
}
|
|
9
27
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
const GetSettingsUseCaseImplementation = GetSettingsUseCase.createImplementation({
|
|
29
|
+
implementation: GetSettingsUseCaseImpl,
|
|
30
|
+
dependencies: [
|
|
31
|
+
IdentityContext,
|
|
32
|
+
GetSettingsRepository,
|
|
33
|
+
[
|
|
34
|
+
TransportSettingsDefinition,
|
|
35
|
+
{
|
|
36
|
+
multiple: true
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
]
|
|
13
40
|
});
|
|
41
|
+
export { GetSettingsUseCaseImplementation };
|
|
14
42
|
|
|
15
43
|
//# sourceMappingURL=GetSettingsUseCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/GetSettings/GetSettingsUseCase.js","sources":["../../../src/features/GetSettings/GetSettingsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { GetSettingsUseCase, GetSettingsRepository } from \"./abstractions.js\";\nimport { TransportSettingsDefinition } from \"~/domain/TransportSettings/abstractions.js\";\nimport { findDefinition, withoutSecrets } from \"~/domain/TransportSettings/findDefinition.js\";\nimport { SettingsNotAuthorized, UnknownTransportSettings } from \"~/domain/errors.js\";\nimport { MAILER_SETTINGS_PERMISSION } from \"~/constants.js\";\n\nclass GetSettingsUseCaseImpl implements GetSettingsUseCase.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private repository: GetSettingsRepository.Interface,\n private definitions: TransportSettingsDefinition.Interface[]\n ) {}\n\n async execute(transport: string) {\n const permission = await this.identityContext.getPermission(MAILER_SETTINGS_PERMISSION);\n if (!permission) {\n return Result.fail(\n new SettingsNotAuthorized(\"Not allowed to read the mailer settings.\")\n );\n }\n\n const definition = findDefinition(this.definitions, transport);\n if (!definition) {\n return Result.fail(new UnknownTransportSettings(transport));\n }\n\n const result = await this.repository.get(transport);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const { settings, source } = result.value;\n return Result.ok({\n settings: settings ? withoutSecrets(definition, settings) : null,\n source\n });\n }\n}\n\nexport const GetSettingsUseCaseImplementation = GetSettingsUseCase.createImplementation({\n implementation: GetSettingsUseCaseImpl,\n dependencies: [\n IdentityContext,\n GetSettingsRepository,\n [TransportSettingsDefinition, { multiple: true }]\n ]\n});\n"],"names":["GetSettingsUseCaseImpl","identityContext","repository","definitions","transport","permission","MAILER_SETTINGS_PERMISSION","Result","SettingsNotAuthorized","definition","findDefinition","UnknownTransportSettings","result","settings","source","withoutSecrets","GetSettingsUseCaseImplementation","GetSettingsUseCase","IdentityContext","GetSettingsRepository","TransportSettingsDefinition"],"mappings":";;;;;;;AAQA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,UAA2C,EAC3CC,WAAoD,CAC9D;aAHUF,eAAe,GAAfA;aACAC,UAAU,GAAVA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,SAAiB,EAAE;QAC7B,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAACC;QAC5D,IAAI,CAACD,YACD,OAAOE,OAAO,IAAI,CACd,IAAIC,sBAAsB;QAIlC,MAAMC,aAAaC,eAAe,IAAI,CAAC,WAAW,EAAEN;QACpD,IAAI,CAACK,YACD,OAAOF,OAAO,IAAI,CAAC,IAAII,yBAAyBP;QAGpD,MAAMQ,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAACR;QACzC,IAAIQ,OAAO,MAAM,IACb,OAAOL,OAAO,IAAI,CAACK,OAAO,KAAK;QAGnC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGF,OAAO,KAAK;QACzC,OAAOL,OAAO,EAAE,CAAC;YACb,UAAUM,WAAWE,eAAeN,YAAYI,YAAY;YAC5DC;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,mBAAmB,oBAAoB,CAAC;IACpF,gBAAgBjB;IAChB,cAAc;QACVkB;QACAC;QACA;YAACC;YAA6B;gBAAE,UAAU;YAAK;SAAE;KACpD;AACL"}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SettingsNotAuthorized, UnknownTransportSettings } from "../../domain/errors.js";
|
|
3
|
+
import type { TransportSettingsDefinition } from "../../domain/TransportSettings/abstractions.js";
|
|
4
|
+
export type MailerSettingsSource = "code" | "storage" | null;
|
|
5
|
+
export interface ISettingsWithSource<TSettings extends object = TransportSettingsDefinition.Values> {
|
|
6
|
+
settings: TSettings | null;
|
|
7
|
+
source: MailerSettingsSource;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads a transport's settings with its secrets decrypted. For the transport itself (its
|
|
11
|
+
* `MailTransportFactory`); no permission check.
|
|
12
|
+
*/
|
|
3
13
|
export interface IGetSettingsRepository {
|
|
4
|
-
get(): Promise<Result<
|
|
14
|
+
get<TSettings extends object = TransportSettingsDefinition.Values>(transport: string): Promise<Result<ISettingsWithSource<TSettings>, UnknownTransportSettings>>;
|
|
5
15
|
}
|
|
6
16
|
export declare const GetSettingsRepository: import("@webiny/di").Abstraction<IGetSettingsRepository>;
|
|
7
17
|
export declare namespace GetSettingsRepository {
|
|
8
18
|
type Interface = IGetSettingsRepository;
|
|
9
19
|
}
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Reads a transport's settings for the GraphQL API: requires the `mailer.settings` permission and
|
|
22
|
+
* leaves the secrets out.
|
|
23
|
+
*/
|
|
24
|
+
export interface IGetSettingsUseCase {
|
|
25
|
+
execute(transport: string): Promise<Result<ISettingsWithSource, SettingsNotAuthorized | UnknownTransportSettings>>;
|
|
12
26
|
}
|
|
13
|
-
export declare const GetSettingsUseCase: import("@webiny/di").Abstraction<
|
|
27
|
+
export declare const GetSettingsUseCase: import("@webiny/di").Abstraction<IGetSettingsUseCase>;
|
|
14
28
|
export declare namespace GetSettingsUseCase {
|
|
15
|
-
type Interface =
|
|
29
|
+
type Interface = IGetSettingsUseCase;
|
|
16
30
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const GetSettingsRepository = createAbstraction("GetSettingsRepository");
|
|
3
|
+
const GetSettingsUseCase = createAbstraction("GetSettingsUseCase");
|
|
4
|
+
export { GetSettingsRepository, GetSettingsUseCase };
|
|
4
5
|
|
|
5
6
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/GetSettings/abstractions.js","sources":["../../../src/features/GetSettings/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { SettingsNotAuthorized, UnknownTransportSettings } from \"~/domain/errors.js\";\nimport type { TransportSettingsDefinition } from \"~/domain/TransportSettings/abstractions.js\";\n\nexport type MailerSettingsSource = \"code\" | \"storage\" | null;\n\nexport interface ISettingsWithSource<\n TSettings extends object = TransportSettingsDefinition.Values\n> {\n settings: TSettings | null;\n source: MailerSettingsSource;\n}\n\n/**\n * Reads a transport's settings with its secrets decrypted. For the transport itself (its\n * `MailTransportFactory`); no permission check.\n */\nexport interface IGetSettingsRepository {\n get<TSettings extends object = TransportSettingsDefinition.Values>(\n transport: string\n ): Promise<Result<ISettingsWithSource<TSettings>, UnknownTransportSettings>>;\n}\n\nexport const GetSettingsRepository =\n createAbstraction<IGetSettingsRepository>(\"GetSettingsRepository\");\n\nexport namespace GetSettingsRepository {\n export type Interface = IGetSettingsRepository;\n}\n\n/**\n * Reads a transport's settings for the GraphQL API: requires the `mailer.settings` permission and\n * leaves the secrets out.\n */\nexport interface IGetSettingsUseCase {\n execute(\n transport: string\n ): Promise<Result<ISettingsWithSource, SettingsNotAuthorized | UnknownTransportSettings>>;\n}\n\nexport const GetSettingsUseCase = createAbstraction<IGetSettingsUseCase>(\"GetSettingsUseCase\");\n\nexport namespace GetSettingsUseCase {\n export type Interface = IGetSettingsUseCase;\n}\n"],"names":["GetSettingsRepository","createAbstraction","GetSettingsUseCase"],"mappings":";AAwBO,MAAMA,wBACTC,kBAA0C;AAgBvC,MAAMC,qBAAqBD,kBAAuC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { GetSettingsRepositoryImplementation } from "./GetSettingsRepository.js";
|
|
3
3
|
import { GetSettingsUseCaseImplementation } from "./GetSettingsUseCase.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const GetSettingsFeature = createFeature({
|
|
5
|
+
name: "Mailer/GetSettings",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(GetSettingsRepositoryImplementation).inSingletonScope();
|
|
8
|
+
container.register(GetSettingsUseCaseImplementation);
|
|
9
|
+
}
|
|
10
10
|
});
|
|
11
|
+
export { GetSettingsFeature };
|
|
11
12
|
|
|
12
13
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/GetSettings/feature.js","sources":["../../../src/features/GetSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetSettingsRepositoryImplementation } from \"./GetSettingsRepository.js\";\nimport { GetSettingsUseCaseImplementation } from \"./GetSettingsUseCase.js\";\n\nexport const GetSettingsFeature = createFeature({\n name: \"Mailer/GetSettings\",\n register(container) {\n container.register(GetSettingsRepositoryImplementation).inSingletonScope();\n container.register(GetSettingsUseCaseImplementation);\n }\n});\n"],"names":["GetSettingsFeature","createFeature","container","GetSettingsRepositoryImplementation","GetSettingsUseCaseImplementation"],"mappings":";;;AAIO,MAAMA,qBAAqBC,cAAc;IAC5C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,qCAAqC,gBAAgB;QACxED,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { GetSettingsUseCase } from "./abstractions.js";
|
|
1
|
+
export { GetSettingsUseCase, GetSettingsRepository } from "./abstractions.js";
|
|
2
|
+
export type { ISettingsWithSource, MailerSettingsSource } from "./abstractions.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IsMailerConfiguredUseCase } from "./abstractions.js";
|
|
2
|
+
import { MailerService } from "../../domain/MailerService/abstractions.js";
|
|
3
|
+
declare class IsMailerConfiguredUseCaseImpl implements IsMailerConfiguredUseCase.Interface {
|
|
4
|
+
private mailerService;
|
|
5
|
+
constructor(mailerService: MailerService.Interface);
|
|
6
|
+
execute(): IsMailerConfiguredUseCase.Return;
|
|
7
|
+
}
|
|
8
|
+
export declare const IsMailerConfiguredUseCaseImplementation: typeof IsMailerConfiguredUseCaseImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IIsMailerConfiguredUseCase>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IsMailerConfiguredUseCase } from "./abstractions.js";
|
|
2
|
+
import { MailerService } from "../../domain/MailerService/abstractions.js";
|
|
3
|
+
class IsMailerConfiguredUseCaseImpl {
|
|
4
|
+
constructor(mailerService){
|
|
5
|
+
this.mailerService = mailerService;
|
|
6
|
+
}
|
|
7
|
+
execute() {
|
|
8
|
+
return this.mailerService.isConfigured();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const IsMailerConfiguredUseCaseImplementation = IsMailerConfiguredUseCase.createImplementation({
|
|
12
|
+
implementation: IsMailerConfiguredUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
MailerService
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { IsMailerConfiguredUseCaseImplementation };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=IsMailerConfiguredUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/IsMailerConfigured/IsMailerConfiguredUseCase.js","sources":["../../../src/features/IsMailerConfigured/IsMailerConfiguredUseCase.ts"],"sourcesContent":["import { IsMailerConfiguredUseCase } from \"./abstractions.js\";\nimport { MailerService } from \"~/domain/MailerService/abstractions.js\";\n\nclass IsMailerConfiguredUseCaseImpl implements IsMailerConfiguredUseCase.Interface {\n constructor(private mailerService: MailerService.Interface) {}\n\n execute(): IsMailerConfiguredUseCase.Return {\n return this.mailerService.isConfigured();\n }\n}\n\nexport const IsMailerConfiguredUseCaseImplementation =\n IsMailerConfiguredUseCase.createImplementation({\n implementation: IsMailerConfiguredUseCaseImpl,\n dependencies: [MailerService]\n });\n"],"names":["IsMailerConfiguredUseCaseImpl","mailerService","IsMailerConfiguredUseCaseImplementation","IsMailerConfiguredUseCase","MailerService"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,aAAsC,CAAE;aAAxCA,aAAa,GAAbA;IAAyC;IAE7D,UAA4C;QACxC,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY;IAC1C;AACJ;AAEO,MAAMC,0CACTC,0BAA0B,oBAAoB,CAAC;IAC3C,gBAAgBH;IAChB,cAAc;QAACI;KAAc;AACjC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IIsMailerConfiguredUseCase {
|
|
2
|
+
execute(): Promise<boolean>;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Whether a mail transport is set up. It does not connect or send, so a transport with wrong
|
|
6
|
+
* credentials still counts.
|
|
7
|
+
*
|
|
8
|
+
* Only for a question that has to be answered before anything is sent, like the password reset
|
|
9
|
+
* request, which must answer every address the same way. Otherwise send through `SendMailUseCase`
|
|
10
|
+
* and handle `NoTransportAvailableError`.
|
|
11
|
+
*
|
|
12
|
+
* No permission check: the password reset request is anonymous.
|
|
13
|
+
*/
|
|
14
|
+
export declare const IsMailerConfiguredUseCase: import("@webiny/di").Abstraction<IIsMailerConfiguredUseCase>;
|
|
15
|
+
export declare namespace IsMailerConfiguredUseCase {
|
|
16
|
+
type Interface = IIsMailerConfiguredUseCase;
|
|
17
|
+
type Return = Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/IsMailerConfigured/abstractions.js","sources":["../../../src/features/IsMailerConfigured/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IIsMailerConfiguredUseCase {\n execute(): Promise<boolean>;\n}\n\n/**\n * Whether a mail transport is set up. It does not connect or send, so a transport with wrong\n * credentials still counts.\n *\n * Only for a question that has to be answered before anything is sent, like the password reset\n * request, which must answer every address the same way. Otherwise send through `SendMailUseCase`\n * and handle `NoTransportAvailableError`.\n *\n * No permission check: the password reset request is anonymous.\n */\nexport const IsMailerConfiguredUseCase = createAbstraction<IIsMailerConfiguredUseCase>(\n \"IsMailerConfiguredUseCase\"\n);\n\nexport namespace IsMailerConfiguredUseCase {\n export type Interface = IIsMailerConfiguredUseCase;\n export type Return = Promise<boolean>;\n}\n"],"names":["IsMailerConfiguredUseCase","createAbstraction"],"mappings":";AAgBO,MAAMA,4BAA4BC,kBACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { IsMailerConfiguredUseCaseImplementation } from "./IsMailerConfiguredUseCase.js";
|
|
3
|
+
const IsMailerConfiguredFeature = createFeature({
|
|
4
|
+
name: "IsMailerConfigured",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(IsMailerConfiguredUseCaseImplementation);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { IsMailerConfiguredFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/IsMailerConfigured/feature.js","sources":["../../../src/features/IsMailerConfigured/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { IsMailerConfiguredUseCaseImplementation } from \"./IsMailerConfiguredUseCase.js\";\n\nexport const IsMailerConfiguredFeature = createFeature({\n name: \"IsMailerConfigured\",\n register(container) {\n container.register(IsMailerConfiguredUseCaseImplementation);\n }\n});\n"],"names":["IsMailerConfiguredFeature","createFeature","container","IsMailerConfiguredUseCaseImplementation"],"mappings":";;AAGO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IsMailerConfiguredUseCase } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IsMailerConfiguredUseCase } from "./abstractions.js";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { MailerService as Abstraction } from "../../domain/MailerService/abstractions.js";
|
|
2
2
|
import { MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
|
|
3
|
-
import { GetSettingsRepository } from "../GetSettings/abstractions.js";
|
|
4
3
|
import type { TransportSendData } from "../../types.js";
|
|
5
4
|
declare class MailerServiceImpl implements Abstraction.Interface {
|
|
6
|
-
private getSettingsRepository;
|
|
7
5
|
private transportFactories;
|
|
8
|
-
constructor(
|
|
6
|
+
constructor(transportFactories: MailTransportFactory.Interface[]);
|
|
9
7
|
sendMail<T = any>(data: TransportSendData): Abstraction.Return<T>;
|
|
10
|
-
|
|
8
|
+
isConfigured(): Promise<boolean>;
|
|
9
|
+
private createTransport;
|
|
11
10
|
}
|
|
12
11
|
export declare const MailerService: typeof MailerServiceImpl & {
|
|
13
12
|
__abstraction: import("@webiny/di").Abstraction<import("~/domain/MailerService/abstractions.js").IMailerService>;
|
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { MailerService
|
|
3
|
-
import { NoTransportAvailableError,
|
|
2
|
+
import { MailerService } from "../../domain/MailerService/abstractions.js";
|
|
3
|
+
import { NoTransportAvailableError, TransportCreateError, TransportSendError } from "../../domain/MailerService/errors.js";
|
|
4
4
|
import { MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
|
|
5
|
-
import { GetSettingsRepository } from "../GetSettings/abstractions.js";
|
|
6
|
-
import { getDefaultSettingsFromEnv } from "./TransportFactory.js";
|
|
7
5
|
class MailerServiceImpl {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.transportFactories = transportFactories;
|
|
11
|
-
}
|
|
12
|
-
async sendMail(data) {
|
|
13
|
-
// Get settings from repository or environment variables
|
|
14
|
-
const result = await this.getSettingsRepository.get();
|
|
15
|
-
const settings = result.value ?? getDefaultSettingsFromEnv();
|
|
16
|
-
if (!settings) {
|
|
17
|
-
return Result.fail(new NoSettingsConfiguredError());
|
|
6
|
+
constructor(transportFactories){
|
|
7
|
+
this.transportFactories = transportFactories;
|
|
18
8
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
async sendMail(data) {
|
|
10
|
+
const transport = await this.createTransport();
|
|
11
|
+
if (!transport) return Result.fail(new NoTransportAvailableError());
|
|
12
|
+
try {
|
|
13
|
+
const response = await transport.send(data);
|
|
14
|
+
if (response.error) return Result.fail(new TransportSendError(response.error));
|
|
15
|
+
return Result.ok(response);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return Result.fail(new TransportSendError(error));
|
|
18
|
+
}
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// If transport.send returned an error in the response
|
|
29
|
-
if (response.error) {
|
|
30
|
-
return Result.fail(new TransportSendError(response.error));
|
|
31
|
-
}
|
|
32
|
-
return Result.ok(response);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
return Result.fail(new TransportSendError(error));
|
|
20
|
+
async isConfigured() {
|
|
21
|
+
const transport = await this.createTransport();
|
|
22
|
+
return null !== transport;
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
async createTransport() {
|
|
25
|
+
const factories = [
|
|
26
|
+
...this.transportFactories
|
|
27
|
+
].reverse();
|
|
28
|
+
for (const factory of factories){
|
|
29
|
+
let transport;
|
|
30
|
+
try {
|
|
31
|
+
transport = await factory.createTransport();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw new TransportCreateError(error);
|
|
34
|
+
}
|
|
35
|
+
if (transport) return transport;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
40
38
|
}
|
|
41
|
-
const factory = this.transportFactories[this.transportFactories.length - 1];
|
|
42
|
-
return factory.createTransport(settings);
|
|
43
|
-
}
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const MailerService_MailerService = MailerService.createImplementation({
|
|
41
|
+
implementation: MailerServiceImpl,
|
|
42
|
+
dependencies: [
|
|
43
|
+
[
|
|
44
|
+
MailTransportFactory,
|
|
45
|
+
{
|
|
46
|
+
multiple: true
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
]
|
|
50
50
|
});
|
|
51
|
+
export { MailerService_MailerService as MailerService };
|
|
51
52
|
|
|
52
53
|
//# sourceMappingURL=MailerService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/MailerService/MailerService.js","sources":["../../../src/features/MailerService/MailerService.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { MailerService as Abstraction } from \"~/domain/MailerService/abstractions.js\";\nimport {\n NoTransportAvailableError,\n TransportCreateError,\n TransportSendError\n} from \"~/domain/MailerService/errors.js\";\nimport { MailTransport } from \"~/domain/MailTransport/abstractions.js\";\nimport { MailTransportFactory } from \"~/domain/MailTransport/abstractions.js\";\nimport type { TransportSendData } from \"~/types.js\";\n\nclass MailerServiceImpl implements Abstraction.Interface {\n constructor(private transportFactories: MailTransportFactory.Interface[]) {}\n\n async sendMail<T = any>(data: TransportSendData): Abstraction.Return<T> {\n const transport = await this.createTransport();\n\n if (!transport) {\n return Result.fail(new NoTransportAvailableError());\n }\n\n try {\n const response = await transport.send(data);\n\n if (response.error) {\n return Result.fail(new TransportSendError(response.error));\n }\n\n return Result.ok(response);\n } catch (error) {\n return Result.fail(new TransportSendError(error));\n }\n }\n\n async isConfigured(): Promise<boolean> {\n const transport = await this.createTransport();\n\n return transport !== null;\n }\n\n // The last registered factory that is configured wins, so a project's own transport takes over.\n // Null when no factory is configured.\n private async createTransport(): Promise<MailTransport.Interface | null> {\n const factories = [...this.transportFactories].reverse();\n\n for (const factory of factories) {\n let transport: MailTransport.Interface | null;\n try {\n transport = await factory.createTransport();\n } catch (error) {\n throw new TransportCreateError(error);\n }\n\n if (transport) {\n return transport;\n }\n }\n\n return null;\n }\n}\n\nexport const MailerService = Abstraction.createImplementation({\n implementation: MailerServiceImpl,\n dependencies: [[MailTransportFactory, { multiple: true }]]\n});\n"],"names":["MailerServiceImpl","transportFactories","data","transport","Result","NoTransportAvailableError","response","TransportSendError","error","factories","factory","TransportCreateError","MailerService","Abstraction","MailTransportFactory"],"mappings":";;;;AAWA,MAAMA;IACF,YAAoBC,kBAAoD,CAAE;aAAtDA,kBAAkB,GAAlBA;IAAuD;IAE3E,MAAM,SAAkBC,IAAuB,EAAyB;QACpE,MAAMC,YAAY,MAAM,IAAI,CAAC,eAAe;QAE5C,IAAI,CAACA,WACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,IAAI;YACA,MAAMC,WAAW,MAAMH,UAAU,IAAI,CAACD;YAEtC,IAAII,SAAS,KAAK,EACd,OAAOF,OAAO,IAAI,CAAC,IAAIG,mBAAmBD,SAAS,KAAK;YAG5D,OAAOF,OAAO,EAAE,CAACE;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAOJ,OAAO,IAAI,CAAC,IAAIG,mBAAmBC;QAC9C;IACJ;IAEA,MAAM,eAAiC;QACnC,MAAML,YAAY,MAAM,IAAI,CAAC,eAAe;QAE5C,OAAOA,AAAc,SAAdA;IACX;IAIA,MAAc,kBAA2D;QACrE,MAAMM,YAAY;eAAI,IAAI,CAAC,kBAAkB;SAAC,CAAC,OAAO;QAEtD,KAAK,MAAMC,WAAWD,UAAW;YAC7B,IAAIN;YACJ,IAAI;gBACAA,YAAY,MAAMO,QAAQ,eAAe;YAC7C,EAAE,OAAOF,OAAO;gBACZ,MAAM,IAAIG,qBAAqBH;YACnC;YAEA,IAAIL,WACA,OAAOA;QAEf;QAEA,OAAO;IACX;AACJ;AAEO,MAAMS,8BAAgBC,cAAAA,oBAAgC,CAAC;IAC1D,gBAAgBb;IAChB,cAAc;QAAC;YAACc;YAAsB;gBAAE,UAAU;YAAK;SAAE;KAAC;AAC9D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { MailerService } from "./MailerService.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const MailerServiceFeature = createFeature({
|
|
4
|
+
name: "Mailer/MailerService",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(MailerService).inSingletonScope();
|
|
7
|
+
}
|
|
8
8
|
});
|
|
9
|
+
export { MailerServiceFeature };
|
|
9
10
|
|
|
10
11
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/MailerService/feature.js","sources":["../../../src/features/MailerService/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { MailerService } from \"./MailerService.js\";\n\nexport const MailerServiceFeature = createFeature({\n name: \"Mailer/MailerService\",\n register(container) {\n container.register(MailerService).inSingletonScope();\n }\n});\n"],"names":["MailerServiceFeature","createFeature","container","MailerService"],"mappings":";;AAGO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,eAAe,gBAAgB;IACtD;AACJ"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Encryption } from "
|
|
2
|
-
import { SaveSettingsRepository, type SaveSettingsInput } from "./abstractions.js";
|
|
1
|
+
import { Encryption } from "@webiny/api-core/features/encryption/index.js";
|
|
3
2
|
import { KeyValueStore } from "@webiny/api-core/features/keyValueStore/index.js";
|
|
3
|
+
import { SaveSettingsRepository } from "./abstractions.js";
|
|
4
|
+
import type { TransportSettingsDefinition } from "../../domain/TransportSettings/abstractions.js";
|
|
4
5
|
declare class SaveSettingsRepositoryImpl implements SaveSettingsRepository.Interface {
|
|
5
6
|
private keyValueStore;
|
|
6
7
|
private encryption;
|
|
7
8
|
constructor(keyValueStore: KeyValueStore.Interface, encryption: Encryption.Interface);
|
|
8
|
-
execute(input:
|
|
9
|
+
execute(definition: TransportSettingsDefinition.Interface, input: TransportSettingsDefinition.Values): SaveSettingsRepository.Return;
|
|
9
10
|
}
|
|
10
11
|
export declare const SaveSettingsRepositoryImplementation: typeof SaveSettingsRepositoryImpl & {
|
|
11
12
|
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ISaveSettingsRepository>;
|