@webiny/api-mailer 6.6.0-alpha.11 → 6.6.0-alpha.13
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.js +8 -10
- package/MailerFeature.js.map +1 -1
- package/constants.d.ts +1 -1
- package/constants.js +2 -2
- package/constants.js.map +1 -1
- package/domain/MailTransport/abstractions.d.ts +7 -4
- package/domain/MailTransport/abstractions.js.map +1 -1
- package/domain/MailerService/abstractions.d.ts +2 -0
- package/domain/MailerService/abstractions.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 +15 -1
- package/domain/errors.js +27 -3
- package/domain/errors.js.map +1 -1
- package/exports/api/mailer.d.ts +3 -1
- package/exports/api/mailer.js +3 -1
- package/features/GetSettings/GetSettingsRepository.d.ts +5 -4
- package/features/GetSettings/GetSettingsRepository.js +23 -27
- package/features/GetSettings/GetSettingsRepository.js.map +1 -1
- package/features/GetSettings/GetSettingsUseCase.d.ts +11 -3
- package/features/GetSettings/GetSettingsUseCase.js +29 -4
- package/features/GetSettings/GetSettingsUseCase.js.map +1 -1
- package/features/GetSettings/abstractions.d.ts +14 -6
- package/features/GetSettings/abstractions.js.map +1 -1
- package/features/GetSettings/feature.js +1 -1
- package/features/GetSettings/feature.js.map +1 -1
- package/features/GetSettings/index.d.ts +1 -0
- 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/{CodeMailerSettings → IsMailerConfigured}/feature.d.ts +1 -1
- 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 +13 -19
- package/features/MailerService/MailerService.js.map +1 -1
- package/features/SaveSettings/SaveSettingsRepository.d.ts +3 -2
- package/features/SaveSettings/SaveSettingsRepository.js +44 -22
- package/features/SaveSettings/SaveSettingsRepository.js.map +1 -1
- package/features/SaveSettings/SaveSettingsUseCase.d.ts +5 -7
- package/features/SaveSettings/SaveSettingsUseCase.js +27 -25
- package/features/SaveSettings/SaveSettingsUseCase.js.map +1 -1
- package/features/SaveSettings/abstractions.d.ts +12 -20
- package/features/SaveSettings/abstractions.js.map +1 -1
- package/features/SaveSettings/feature.js +1 -1
- package/features/SaveSettings/feature.js.map +1 -1
- package/features/SaveSettings/index.d.ts +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/{SmtpTransport → SendTestMail}/feature.d.ts +1 -1
- package/features/SendTestMail/feature.js +11 -0
- package/features/SendTestMail/feature.js.map +1 -0
- package/graphql/MailerSchemaFactory.js +52 -38
- package/graphql/MailerSchemaFactory.js.map +1 -1
- package/index.d.ts +10 -0
- package/index.js +7 -0
- package/package.json +13 -15
- package/types.d.ts +0 -9
- package/domain/CodeMailerSettings/abstractions.d.ts +0 -8
- package/domain/CodeMailerSettings/abstractions.js +0 -5
- package/domain/CodeMailerSettings/abstractions.js.map +0 -1
- package/features/CodeMailerSettings/CodeMailerSettings.d.ts +0 -12
- package/features/CodeMailerSettings/CodeMailerSettings.js +0 -23
- package/features/CodeMailerSettings/CodeMailerSettings.js.map +0 -1
- package/features/CodeMailerSettings/feature.js +0 -11
- package/features/CodeMailerSettings/feature.js.map +0 -1
- package/features/DummyTransport/DummyMailTransport.d.ts +0 -9
- package/features/DummyTransport/DummyMailTransport.js +0 -14
- package/features/DummyTransport/DummyMailTransport.js.map +0 -1
- package/features/DummyTransport/DummyMailTransportFactory.d.ts +0 -10
- package/features/DummyTransport/DummyMailTransportFactory.js +0 -20
- package/features/DummyTransport/DummyMailTransportFactory.js.map +0 -1
- package/features/DummyTransport/feature.d.ts +0 -4
- package/features/DummyTransport/feature.js +0 -11
- package/features/DummyTransport/feature.js.map +0 -1
- package/features/SaveSettings/validation.d.ts +0 -10
- package/features/SaveSettings/validation.js +0 -21
- package/features/SaveSettings/validation.js.map +0 -1
- package/features/SmtpTransport/SmtpConfig.d.ts +0 -6
- package/features/SmtpTransport/SmtpConfig.js +0 -26
- package/features/SmtpTransport/SmtpConfig.js.map +0 -1
- package/features/SmtpTransport/SmtpMailTransport.d.ts +0 -77
- package/features/SmtpTransport/SmtpMailTransport.js +0 -54
- package/features/SmtpTransport/SmtpMailTransport.js.map +0 -1
- package/features/SmtpTransport/SmtpMailTransportFactory.d.ts +0 -11
- package/features/SmtpTransport/SmtpMailTransportFactory.js +0 -21
- package/features/SmtpTransport/SmtpMailTransportFactory.js.map +0 -1
- package/features/SmtpTransport/feature.js +0 -11
- package/features/SmtpTransport/feature.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/SaveSettings/feature.js","sources":["../../../src/features/SaveSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { SaveSettingsRepositoryImplementation } from \"./SaveSettingsRepository.js\";\nimport { SaveSettingsUseCaseImplementation } from \"./SaveSettingsUseCase.js\";\n\nexport const SaveSettingsFeature = createFeature({\n name: \"SaveSettings\",\n register(container) {\n container.register(SaveSettingsRepositoryImplementation).inSingletonScope();\n container.register(SaveSettingsUseCaseImplementation);\n }\n});\n"],"names":["SaveSettingsFeature","createFeature","container","SaveSettingsRepositoryImplementation","SaveSettingsUseCaseImplementation"],"mappings":";;;AAIO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,sCAAsC,gBAAgB;QACzED,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
1
|
+
{"version":3,"file":"features/SaveSettings/feature.js","sources":["../../../src/features/SaveSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { SaveSettingsRepositoryImplementation } from \"./SaveSettingsRepository.js\";\nimport { SaveSettingsUseCaseImplementation } from \"./SaveSettingsUseCase.js\";\n\nexport const SaveSettingsFeature = createFeature({\n name: \"Mailer/SaveSettings\",\n register(container) {\n container.register(SaveSettingsRepositoryImplementation).inSingletonScope();\n container.register(SaveSettingsUseCaseImplementation);\n }\n});\n"],"names":["SaveSettingsFeature","createFeature","container","SaveSettingsRepositoryImplementation","SaveSettingsUseCaseImplementation"],"mappings":";;;AAIO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,sCAAsC,gBAAgB;QACzED,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export { SaveSettingsUseCase, SaveSettingsRepository, MailerSettingsAfterSaveEventHandler, MailerSettingsBeforeSaveEventHandler } from "./abstractions.js";
|
|
2
|
+
export type { SavedTransportSettings, MailerSettingsBeforeSavePayload, MailerSettingsAfterSavePayload } from "./abstractions.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
2
|
+
import { SendTestMailUseCase } from "./abstractions.js";
|
|
3
|
+
import { SendMailUseCase } from "../../features/SendMail/abstractions.js";
|
|
4
|
+
declare class SendTestMailUseCaseImpl implements SendTestMailUseCase.Interface {
|
|
5
|
+
private identityContext;
|
|
6
|
+
private sendMailUseCase;
|
|
7
|
+
constructor(identityContext: IdentityContext.Interface, sendMailUseCase: SendMailUseCase.Interface);
|
|
8
|
+
execute(input: SendTestMailUseCase.Input): SendTestMailUseCase.Return;
|
|
9
|
+
}
|
|
10
|
+
export declare const SendTestMailUseCaseImplementation: typeof SendTestMailUseCaseImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ISendTestMailUseCase>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
3
|
+
import { SendTestMailUseCase } from "./abstractions.js";
|
|
4
|
+
import { SendMailUseCase } from "../SendMail/abstractions.js";
|
|
5
|
+
import { TestMailNotAuthorized, TestMailNotConfigured } from "../../domain/errors.js";
|
|
6
|
+
import { NoTransportAvailableError } from "../../domain/MailerService/errors.js";
|
|
7
|
+
import { MAILER_SETTINGS_PERMISSION } from "../../constants.js";
|
|
8
|
+
const TEST_MAIL_TEXT = "This is a test email from Webiny.\n\nIt was sent from the Mailer settings screen to check that mail is delivered. No action is needed.";
|
|
9
|
+
class SendTestMailUseCaseImpl {
|
|
10
|
+
constructor(identityContext, sendMailUseCase){
|
|
11
|
+
this.identityContext = identityContext;
|
|
12
|
+
this.sendMailUseCase = sendMailUseCase;
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const permission = await this.identityContext.getPermission(MAILER_SETTINGS_PERMISSION);
|
|
16
|
+
if (!permission) return Result.fail(new TestMailNotAuthorized());
|
|
17
|
+
const result = await this.sendMailUseCase.execute({
|
|
18
|
+
to: [
|
|
19
|
+
input.to
|
|
20
|
+
],
|
|
21
|
+
subject: "Webiny test email",
|
|
22
|
+
text: TEST_MAIL_TEXT
|
|
23
|
+
});
|
|
24
|
+
if (result.isFail()) {
|
|
25
|
+
if (result.error instanceof NoTransportAvailableError) return Result.fail(new TestMailNotConfigured());
|
|
26
|
+
return Result.fail(result.error);
|
|
27
|
+
}
|
|
28
|
+
return Result.ok(void 0);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const SendTestMailUseCaseImplementation = SendTestMailUseCase.createImplementation({
|
|
32
|
+
implementation: SendTestMailUseCaseImpl,
|
|
33
|
+
dependencies: [
|
|
34
|
+
IdentityContext,
|
|
35
|
+
SendMailUseCase
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
export { SendTestMailUseCaseImplementation };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=SendTestMailUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/SendTestMail/SendTestMailUseCase.js","sources":["../../../src/features/SendTestMail/SendTestMailUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { SendTestMailUseCase } from \"./abstractions.js\";\nimport { SendMailUseCase } from \"~/features/SendMail/abstractions.js\";\nimport { TestMailNotAuthorized } from \"~/domain/errors.js\";\nimport { TestMailNotConfigured } from \"~/domain/errors.js\";\nimport { NoTransportAvailableError } from \"~/domain/MailerService/errors.js\";\nimport { MAILER_SETTINGS_PERMISSION } from \"~/constants.js\";\n\nconst TEST_MAIL_TEXT = [\n \"This is a test email from Webiny.\",\n \"\",\n \"It was sent from the Mailer settings screen to check that mail is delivered. \" +\n \"No action is needed.\"\n].join(\"\\n\");\n\nclass SendTestMailUseCaseImpl implements SendTestMailUseCase.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendMailUseCase: SendMailUseCase.Interface\n ) {}\n\n async execute(input: SendTestMailUseCase.Input): SendTestMailUseCase.Return {\n const permission = await this.identityContext.getPermission(MAILER_SETTINGS_PERMISSION);\n if (!permission) {\n return Result.fail(new TestMailNotAuthorized());\n }\n\n const result = await this.sendMailUseCase.execute({\n to: [input.to],\n subject: \"Webiny test email\",\n text: TEST_MAIL_TEXT\n });\n\n if (result.isFail()) {\n if (result.error instanceof NoTransportAvailableError) {\n return Result.fail(new TestMailNotConfigured());\n }\n return Result.fail(result.error);\n }\n\n return Result.ok(undefined);\n }\n}\n\nexport const SendTestMailUseCaseImplementation = SendTestMailUseCase.createImplementation({\n implementation: SendTestMailUseCaseImpl,\n dependencies: [IdentityContext, SendMailUseCase]\n});\n"],"names":["TEST_MAIL_TEXT","SendTestMailUseCaseImpl","identityContext","sendMailUseCase","input","permission","MAILER_SETTINGS_PERMISSION","Result","TestMailNotAuthorized","result","NoTransportAvailableError","TestMailNotConfigured","undefined","SendTestMailUseCaseImplementation","SendTestMailUseCase","IdentityContext","SendMailUseCase"],"mappings":";;;;;;;AASA,MAAMA,iBAAiB;AAOvB,MAAMC;IACF,YACYC,eAA0C,EAC1CC,eAA0C,CACpD;aAFUD,eAAe,GAAfA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QAAQC,KAAgC,EAA8B;QACxE,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAACC;QAC5D,IAAI,CAACD,YACD,OAAOE,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;YAC9C,IAAI;gBAACL,MAAM,EAAE;aAAC;YACd,SAAS;YACT,MAAMJ;QACV;QAEA,IAAIS,OAAO,MAAM,IAAI;YACjB,IAAIA,OAAO,KAAK,YAAYC,2BACxB,OAAOH,OAAO,IAAI,CAAC,IAAII;YAE3B,OAAOJ,OAAO,IAAI,CAACE,OAAO,KAAK;QACnC;QAEA,OAAOF,OAAO,EAAE,CAACK;IACrB;AACJ;AAEO,MAAMC,oCAAoCC,oBAAoB,oBAAoB,CAAC;IACtF,gBAAgBb;IAChB,cAAc;QAACc;QAAiBC;KAAgB;AACpD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { SendMailUseCase } from "../../features/SendMail/abstractions.js";
|
|
3
|
+
import { TestMailNotAuthorized } from "../../domain/errors.js";
|
|
4
|
+
import { TestMailNotConfigured } from "../../domain/errors.js";
|
|
5
|
+
export interface SendTestMailInput {
|
|
6
|
+
to: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ISendTestMailErrors {
|
|
9
|
+
notAuthorized: TestMailNotAuthorized;
|
|
10
|
+
notConfigured: TestMailNotConfigured;
|
|
11
|
+
sendMail: SendMailUseCase.Error;
|
|
12
|
+
}
|
|
13
|
+
type SendTestMailError = ISendTestMailErrors[keyof ISendTestMailErrors];
|
|
14
|
+
export interface ISendTestMailUseCase {
|
|
15
|
+
execute(input: SendTestMailInput): Promise<Result<void, SendTestMailError>>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sends one message through the transport that delivers this project's mail, so an operator can
|
|
19
|
+
* tell settings that deliver from settings that only look configured. The mail server's own error
|
|
20
|
+
* comes back to the caller.
|
|
21
|
+
*
|
|
22
|
+
* The test goes through `SendMailUseCase` like any other mail, so it publishes the same
|
|
23
|
+
* `MailBeforeSend`, `MailAfterSend` and `MailSendError` events.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SendTestMailUseCase: import("@webiny/di").Abstraction<ISendTestMailUseCase>;
|
|
26
|
+
export declare namespace SendTestMailUseCase {
|
|
27
|
+
type Interface = ISendTestMailUseCase;
|
|
28
|
+
type Input = SendTestMailInput;
|
|
29
|
+
type Return = Promise<Result<void, SendTestMailError>>;
|
|
30
|
+
type Error = SendTestMailError;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/SendTestMail/abstractions.js","sources":["../../../src/features/SendTestMail/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { SendMailUseCase } from \"~/features/SendMail/abstractions.js\";\nimport { TestMailNotAuthorized } from \"~/domain/errors.js\";\nimport { TestMailNotConfigured } from \"~/domain/errors.js\";\n\nexport interface SendTestMailInput {\n to: string;\n}\n\nexport interface ISendTestMailErrors {\n notAuthorized: TestMailNotAuthorized;\n notConfigured: TestMailNotConfigured;\n sendMail: SendMailUseCase.Error;\n}\n\ntype SendTestMailError = ISendTestMailErrors[keyof ISendTestMailErrors];\n\nexport interface ISendTestMailUseCase {\n execute(input: SendTestMailInput): Promise<Result<void, SendTestMailError>>;\n}\n\n/**\n * Sends one message through the transport that delivers this project's mail, so an operator can\n * tell settings that deliver from settings that only look configured. The mail server's own error\n * comes back to the caller.\n *\n * The test goes through `SendMailUseCase` like any other mail, so it publishes the same\n * `MailBeforeSend`, `MailAfterSend` and `MailSendError` events.\n */\nexport const SendTestMailUseCase = createAbstraction<ISendTestMailUseCase>(\"SendTestMailUseCase\");\n\nexport namespace SendTestMailUseCase {\n export type Interface = ISendTestMailUseCase;\n export type Input = SendTestMailInput;\n export type Return = Promise<Result<void, SendTestMailError>>;\n export type Error = SendTestMailError;\n}\n"],"names":["SendTestMailUseCase","createAbstraction"],"mappings":";AA8BO,MAAMA,sBAAsBC,kBAAwC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { SendTestMailUseCaseImplementation } from "./SendTestMailUseCase.js";
|
|
3
|
+
const SendTestMailFeature = createFeature({
|
|
4
|
+
name: "SendTestMail",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(SendTestMailUseCaseImplementation);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { SendTestMailFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/SendTestMail/feature.js","sources":["../../../src/features/SendTestMail/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { SendTestMailUseCaseImplementation } from \"./SendTestMailUseCase.js\";\n\nexport const SendTestMailFeature = createFeature({\n name: \"SendTestMail\",\n register(container) {\n container.register(SendTestMailUseCaseImplementation);\n }\n});\n"],"names":["SendTestMailFeature","createFeature","container","SendTestMailUseCaseImplementation"],"mappings":";;AAGO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
|
|
2
2
|
import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
|
|
3
3
|
import { ErrorResponse } from "@webiny/api-graphql/responses.js";
|
|
4
|
+
import { SendTestMailUseCase } from "../features/SendTestMail/abstractions.js";
|
|
4
5
|
import { GetSettingsUseCase } from "../features/GetSettings/abstractions.js";
|
|
5
6
|
import { SaveSettingsUseCase } from "../features/SaveSettings/abstractions.js";
|
|
6
|
-
const SMTP_TRANSPORT_NAME = "Mailer/SmtpTransport";
|
|
7
|
-
const toPublicSettings = (settings, source)=>{
|
|
8
|
-
if (!settings) return null;
|
|
9
|
-
const { password: _password, ...publicSettings } = settings;
|
|
10
|
-
return {
|
|
11
|
-
...publicSettings,
|
|
12
|
-
source
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
7
|
class MailerSchemaFactoryImpl {
|
|
16
8
|
async execute(builder) {
|
|
17
9
|
builder.addTypeDefs(`
|
|
@@ -21,42 +13,38 @@ class MailerSchemaFactoryImpl {
|
|
|
21
13
|
data: JSON
|
|
22
14
|
}
|
|
23
15
|
|
|
24
|
-
type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
type MailerSendTestMailResponse {
|
|
17
|
+
data: Boolean
|
|
18
|
+
error: MailerTransportSettingsError
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type MailerTransportSettingsData {
|
|
22
|
+
transport: String!
|
|
23
|
+
settings: JSON
|
|
31
24
|
source: String
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
type
|
|
35
|
-
data:
|
|
27
|
+
type MailerTransportSettingsDataResponse {
|
|
28
|
+
data: MailerTransportSettingsData
|
|
36
29
|
error: MailerTransportSettingsError
|
|
37
30
|
}
|
|
38
31
|
|
|
39
32
|
type MailerQuery {
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
input MailerTransportSettingsInput {
|
|
44
|
-
host: String!
|
|
45
|
-
port: Number
|
|
46
|
-
secure: Boolean
|
|
47
|
-
user: String!
|
|
48
|
-
password: String
|
|
49
|
-
from: String!
|
|
50
|
-
replyTo: String
|
|
33
|
+
getTransportSettings(transport: String!): MailerTransportSettingsDataResponse!
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
type MailerMutation {
|
|
54
|
-
|
|
37
|
+
sendTestMail(to: String!): MailerSendTestMailResponse!
|
|
38
|
+
saveTransportSettings(
|
|
39
|
+
transport: String!
|
|
40
|
+
settings: JSON!
|
|
41
|
+
): MailerTransportSettingsDataResponse!
|
|
55
42
|
}
|
|
56
43
|
|
|
57
44
|
extend type Query {
|
|
58
45
|
mailer: MailerQuery
|
|
59
46
|
}
|
|
47
|
+
|
|
60
48
|
extend type Mutation {
|
|
61
49
|
mailer: MailerMutation
|
|
62
50
|
}
|
|
@@ -70,17 +58,19 @@ class MailerSchemaFactoryImpl {
|
|
|
70
58
|
resolver: ()=>async ()=>({})
|
|
71
59
|
});
|
|
72
60
|
builder.addResolver({
|
|
73
|
-
path: "MailerQuery.
|
|
61
|
+
path: "MailerQuery.getTransportSettings",
|
|
74
62
|
dependencies: [
|
|
75
63
|
GetSettingsUseCase
|
|
76
64
|
],
|
|
77
|
-
resolver: (getSettings)=>async ()=>{
|
|
65
|
+
resolver: (getSettings)=>async ({ args })=>{
|
|
78
66
|
try {
|
|
79
|
-
const result = await getSettings.execute(
|
|
67
|
+
const result = await getSettings.execute(args.transport);
|
|
80
68
|
if (result.isFail()) return new ErrorResponse(result.error);
|
|
81
|
-
const { settings, source } = result.value;
|
|
82
69
|
return {
|
|
83
|
-
data:
|
|
70
|
+
data: {
|
|
71
|
+
transport: args.transport,
|
|
72
|
+
...result.value
|
|
73
|
+
},
|
|
84
74
|
error: null
|
|
85
75
|
};
|
|
86
76
|
} catch (ex) {
|
|
@@ -89,16 +79,40 @@ class MailerSchemaFactoryImpl {
|
|
|
89
79
|
}
|
|
90
80
|
});
|
|
91
81
|
builder.addResolver({
|
|
92
|
-
path: "MailerMutation.
|
|
82
|
+
path: "MailerMutation.saveTransportSettings",
|
|
93
83
|
dependencies: [
|
|
94
84
|
SaveSettingsUseCase
|
|
95
85
|
],
|
|
96
86
|
resolver: (saveSettings)=>async ({ args })=>{
|
|
97
87
|
try {
|
|
98
|
-
const result = await saveSettings.execute(args.
|
|
88
|
+
const result = await saveSettings.execute(args.transport, args.settings);
|
|
89
|
+
if (result.isFail()) return new ErrorResponse(result.error);
|
|
90
|
+
return {
|
|
91
|
+
data: {
|
|
92
|
+
transport: args.transport,
|
|
93
|
+
settings: result.value,
|
|
94
|
+
source: "storage"
|
|
95
|
+
},
|
|
96
|
+
error: null
|
|
97
|
+
};
|
|
98
|
+
} catch (ex) {
|
|
99
|
+
return new ErrorResponse(ex);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
builder.addResolver({
|
|
104
|
+
path: "MailerMutation.sendTestMail",
|
|
105
|
+
dependencies: [
|
|
106
|
+
SendTestMailUseCase
|
|
107
|
+
],
|
|
108
|
+
resolver: (sendTestMail)=>async ({ args })=>{
|
|
109
|
+
try {
|
|
110
|
+
const result = await sendTestMail.execute({
|
|
111
|
+
to: args.to
|
|
112
|
+
});
|
|
99
113
|
if (result.isFail()) return new ErrorResponse(result.error);
|
|
100
114
|
return {
|
|
101
|
-
data:
|
|
115
|
+
data: true,
|
|
102
116
|
error: null
|
|
103
117
|
};
|
|
104
118
|
} catch (ex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/MailerSchemaFactory.js","sources":["../../src/graphql/MailerSchemaFactory.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { ErrorResponse } from \"@webiny/api-graphql/responses.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"graphql/MailerSchemaFactory.js","sources":["../../src/graphql/MailerSchemaFactory.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { ErrorResponse } from \"@webiny/api-graphql/responses.js\";\nimport { SendTestMailUseCase } from \"~/features/SendTestMail/abstractions.js\";\nimport { GetSettingsUseCase } from \"~/features/GetSettings/abstractions.js\";\nimport { SaveSettingsUseCase } from \"~/features/SaveSettings/abstractions.js\";\n\n/*\n * The `mailer` namespaces, the test email, and the settings of any transport that registers a\n * `TransportSettingsDefinition`, as JSON. Secrets are never returned.\n */\nclass MailerSchemaFactoryImpl implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"api-mailer/MailerSchemaFactoryImpl\");\n\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n builder.addTypeDefs(`\n type MailerTransportSettingsError {\n message: String!\n code: String\n data: JSON\n }\n\n type MailerSendTestMailResponse {\n data: Boolean\n error: MailerTransportSettingsError\n }\n\n type MailerTransportSettingsData {\n transport: String!\n settings: JSON\n source: String\n }\n\n type MailerTransportSettingsDataResponse {\n data: MailerTransportSettingsData\n error: MailerTransportSettingsError\n }\n\n type MailerQuery {\n getTransportSettings(transport: String!): MailerTransportSettingsDataResponse!\n }\n\n type MailerMutation {\n sendTestMail(to: String!): MailerSendTestMailResponse!\n saveTransportSettings(\n transport: String!\n settings: JSON!\n ): MailerTransportSettingsDataResponse!\n }\n\n extend type Query {\n mailer: MailerQuery\n }\n\n extend type Mutation {\n mailer: MailerMutation\n }\n `);\n\n builder.addResolver({\n path: \"Query.mailer\",\n resolver: () => async () => ({})\n });\n\n builder.addResolver({\n path: \"Mutation.mailer\",\n resolver: () => async () => ({})\n });\n\n builder.addResolver<{ transport: string }>({\n path: \"MailerQuery.getTransportSettings\",\n dependencies: [GetSettingsUseCase],\n resolver:\n (getSettings: GetSettingsUseCase.Interface) =>\n async ({ args }) => {\n try {\n const result = await getSettings.execute(args.transport);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return {\n data: { transport: args.transport, ...result.value },\n error: null\n };\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n }\n });\n\n builder.addResolver<{ transport: string; settings: Record<string, unknown> }>({\n path: \"MailerMutation.saveTransportSettings\",\n dependencies: [SaveSettingsUseCase],\n resolver:\n (saveSettings: SaveSettingsUseCase.Interface) =>\n async ({ args }) => {\n try {\n const result = await saveSettings.execute(args.transport, args.settings);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return {\n data: {\n transport: args.transport,\n settings: result.value,\n source: \"storage\"\n },\n error: null\n };\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n }\n });\n\n builder.addResolver<{ to: string }>({\n path: \"MailerMutation.sendTestMail\",\n dependencies: [SendTestMailUseCase],\n resolver:\n (sendTestMail: SendTestMailUseCase.Interface) =>\n async ({ args }) => {\n try {\n const result = await sendTestMail.execute({ to: args.to });\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return { data: true, error: null };\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n }\n });\n\n return builder;\n }\n}\n\nexport const MailerSchemaFactory = GraphQLSchemaFactory.createImplementation({\n implementation: MailerSchemaFactoryImpl,\n dependencies: []\n});\n"],"names":["MailerSchemaFactoryImpl","builder","GetSettingsUseCase","getSettings","args","result","ErrorResponse","ex","SaveSettingsUseCase","saveSettings","SendTestMailUseCase","sendTestMail","staticSchemaKey","MailerSchemaFactory","GraphQLSchemaFactory"],"mappings":";;;;;;AAYA,MAAMA;IAGF,MAAM,QAAQC,OAA8B,EAAkC;QAC1EA,QAAQ,WAAW,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0CrB,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAU,IAAM,UAAa,EAAC;QAClC;QAEAA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAU,IAAM,UAAa,EAAC;QAClC;QAEAA,QAAQ,WAAW,CAAwB;YACvC,MAAM;YACN,cAAc;gBAACC;aAAmB;YAClC,UACI,CAACC,cACD,OAAO,EAAEC,IAAI,EAAE;oBACX,IAAI;wBACA,MAAMC,SAAS,MAAMF,YAAY,OAAO,CAACC,KAAK,SAAS;wBACvD,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;wBAEzC,OAAO;4BACH,MAAM;gCAAE,WAAWD,KAAK,SAAS;gCAAE,GAAGC,OAAO,KAAK;4BAAC;4BACnD,OAAO;wBACX;oBACJ,EAAE,OAAOE,IAAI;wBACT,OAAO,IAAID,cAAcC;oBAC7B;gBACJ;QACR;QAEAN,QAAQ,WAAW,CAA2D;YAC1E,MAAM;YACN,cAAc;gBAACO;aAAoB;YACnC,UACI,CAACC,eACD,OAAO,EAAEL,IAAI,EAAE;oBACX,IAAI;wBACA,MAAMC,SAAS,MAAMI,aAAa,OAAO,CAACL,KAAK,SAAS,EAAEA,KAAK,QAAQ;wBACvE,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;wBAEzC,OAAO;4BACH,MAAM;gCACF,WAAWD,KAAK,SAAS;gCACzB,UAAUC,OAAO,KAAK;gCACtB,QAAQ;4BACZ;4BACA,OAAO;wBACX;oBACJ,EAAE,OAAOE,IAAI;wBACT,OAAO,IAAID,cAAcC;oBAC7B;gBACJ;QACR;QAEAN,QAAQ,WAAW,CAAiB;YAChC,MAAM;YACN,cAAc;gBAACS;aAAoB;YACnC,UACI,CAACC,eACD,OAAO,EAAEP,IAAI,EAAE;oBACX,IAAI;wBACA,MAAMC,SAAS,MAAMM,aAAa,OAAO,CAAC;4BAAE,IAAIP,KAAK,EAAE;wBAAC;wBAExD,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;wBAGzC,OAAO;4BAAE,MAAM;4BAAM,OAAO;wBAAK;oBACrC,EAAE,OAAOE,IAAI;wBACT,OAAO,IAAID,cAAcC;oBAC7B;gBACJ;QACR;QAEA,OAAON;IACX;;aA5HO,YAAY,GAAGW,gBAAgB;;AA6H1C;AAEO,MAAMC,sBAAsBC,qBAAqB,oBAAoB,CAAC;IACzE,gBAAgBd;IAChB,cAAc,EAAE;AACpB"}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export { MailerFeature } from "./MailerFeature.js";
|
|
2
2
|
export { MailerService } from "./domain/MailerService/abstractions.js";
|
|
3
3
|
export type { IMailerService, IMailerServiceErrors } from "./domain/MailerService/abstractions.js";
|
|
4
|
+
export { MailTransport } from "./domain/MailTransport/abstractions.js";
|
|
5
|
+
export { MailTransportFactory } from "./domain/MailTransport/abstractions.js";
|
|
6
|
+
export { MAILER_SETTINGS_PERMISSION } from "./constants.js";
|
|
7
|
+
export { isMailboxAddress } from "./utils/isMailboxAddress.js";
|
|
8
|
+
export { TransportSettingsDefinition } from "./domain/TransportSettings/abstractions.js";
|
|
9
|
+
export { SettingsValidationError, SettingsNotAuthorized, SettingsPersistenceError, SettingsLockedByCode, UnknownTransportSettings } from "./domain/errors.js";
|
|
10
|
+
export { GetSettingsUseCase, GetSettingsRepository } from "./features/GetSettings/index.js";
|
|
11
|
+
export type { ISettingsWithSource, MailerSettingsSource } from "./features/GetSettings/index.js";
|
|
12
|
+
export { SaveSettingsUseCase, SaveSettingsRepository, MailerSettingsAfterSaveEventHandler, MailerSettingsBeforeSaveEventHandler } from "./features/SaveSettings/index.js";
|
|
13
|
+
export type { SavedTransportSettings, MailerSettingsBeforeSavePayload, MailerSettingsAfterSavePayload } from "./features/SaveSettings/index.js";
|
package/index.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export { MailerFeature } from "./MailerFeature.js";
|
|
2
2
|
export { MailerService } from "./domain/MailerService/abstractions.js";
|
|
3
|
+
export { MailTransport, MailTransportFactory } from "./domain/MailTransport/abstractions.js";
|
|
4
|
+
export { MAILER_SETTINGS_PERMISSION } from "./constants.js";
|
|
5
|
+
export { isMailboxAddress } from "./utils/isMailboxAddress.js";
|
|
6
|
+
export { TransportSettingsDefinition } from "./domain/TransportSettings/abstractions.js";
|
|
7
|
+
export { SettingsLockedByCode, SettingsNotAuthorized, SettingsPersistenceError, SettingsValidationError, UnknownTransportSettings } from "./domain/errors.js";
|
|
8
|
+
export { GetSettingsRepository, GetSettingsUseCase } from "./features/GetSettings/index.js";
|
|
9
|
+
export { MailerSettingsAfterSaveEventHandler, MailerSettingsBeforeSaveEventHandler, SaveSettingsRepository, SaveSettingsUseCase } from "./features/SaveSettings/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-mailer",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -18,26 +18,24 @@
|
|
|
18
18
|
"description": "The API to send e-mails.",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
22
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
23
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
21
|
+
"@webiny/api-graphql": "6.6.0-alpha.13",
|
|
22
|
+
"@webiny/feature": "6.6.0-alpha.13",
|
|
23
|
+
"@webiny/plugins": "6.6.0-alpha.13",
|
|
24
24
|
"email-addresses": "5.0.0",
|
|
25
|
-
"nodemailer": "10.3.1",
|
|
26
25
|
"zod": "4.6.7"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@webiny/api": "6.6.0-alpha.
|
|
31
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
32
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
33
|
-
"@webiny/db-dynamodb": "6.6.0-alpha.
|
|
28
|
+
"@webiny/api": "6.6.0-alpha.13",
|
|
29
|
+
"@webiny/api-core": "6.6.0-alpha.13",
|
|
30
|
+
"@webiny/api-kernel-core": "6.6.0-alpha.13",
|
|
31
|
+
"@webiny/build-tools": "6.6.0-alpha.13",
|
|
32
|
+
"@webiny/db-dynamodb": "6.6.0-alpha.13",
|
|
34
33
|
"@webiny/di": "2.0.0",
|
|
35
|
-
"@webiny/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"rimraf": "6.1.3",
|
|
34
|
+
"@webiny/handler": "6.6.0-alpha.13",
|
|
35
|
+
"graphql": "16.15.0",
|
|
36
|
+
"rimraf": "6.1.4",
|
|
39
37
|
"typescript": "7.0.2",
|
|
40
|
-
"vitest": "5.
|
|
38
|
+
"vitest": "5.1.1"
|
|
41
39
|
},
|
|
42
40
|
"publishConfig": {
|
|
43
41
|
"access": "public"
|
package/types.d.ts
CHANGED
|
@@ -31,13 +31,4 @@ interface BaseTransportSendData {
|
|
|
31
31
|
replyTo?: string;
|
|
32
32
|
}
|
|
33
33
|
export type TransportSendData = BaseTransportSendData & (TransportSendToData | TransportSendBccData | TransportSendCcData);
|
|
34
|
-
export interface TransportSettings {
|
|
35
|
-
host: string;
|
|
36
|
-
port: number;
|
|
37
|
-
secure: boolean;
|
|
38
|
-
user: string;
|
|
39
|
-
password: string;
|
|
40
|
-
from: string;
|
|
41
|
-
replyTo?: string;
|
|
42
|
-
}
|
|
43
34
|
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TransportSettings } from "../../types.js";
|
|
2
|
-
export interface ICodeMailerSettings {
|
|
3
|
-
get(transportName: string): TransportSettings | null;
|
|
4
|
-
}
|
|
5
|
-
export declare const CodeMailerSettings: import("@webiny/di").Abstraction<ICodeMailerSettings>;
|
|
6
|
-
export declare namespace CodeMailerSettings {
|
|
7
|
-
type Interface = ICodeMailerSettings;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domain/CodeMailerSettings/abstractions.js","sources":["../../../src/domain/CodeMailerSettings/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { TransportSettings } from \"~/types.js\";\n\nexport interface ICodeMailerSettings {\n get(transportName: string): TransportSettings | null;\n}\n\nexport const CodeMailerSettings = createAbstraction<ICodeMailerSettings>(\"CodeMailerSettings\");\n\nexport namespace CodeMailerSettings {\n export type Interface = ICodeMailerSettings;\n}\n"],"names":["CodeMailerSettings","createAbstraction"],"mappings":";AAOO,MAAMA,qBAAqBC,kBAAuC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BuildParams } from "@webiny/api-core/features/buildParams/index.js";
|
|
2
|
-
import { CodeMailerSettings as Abstraction } from "../../domain/CodeMailerSettings/abstractions.js";
|
|
3
|
-
import type { TransportSettings } from "../../types.js";
|
|
4
|
-
declare class CodeMailerSettingsImpl implements Abstraction.Interface {
|
|
5
|
-
private buildParams;
|
|
6
|
-
constructor(buildParams: BuildParams.Interface);
|
|
7
|
-
get(transportName: string): TransportSettings | null;
|
|
8
|
-
}
|
|
9
|
-
export declare const CodeMailerSettings: typeof CodeMailerSettingsImpl & {
|
|
10
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/domain/CodeMailerSettings/abstractions.js").ICodeMailerSettings>;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BuildParams } from "@webiny/api-core/features/buildParams/index.js";
|
|
2
|
-
import { CodeMailerSettings } from "../../domain/CodeMailerSettings/abstractions.js";
|
|
3
|
-
const SMTP_TRANSPORT_NAME = "Mailer/SmtpTransport";
|
|
4
|
-
const SMTP_BUILD_PARAM_KEY = "Mailer.SmtpSettings";
|
|
5
|
-
class CodeMailerSettingsImpl {
|
|
6
|
-
constructor(buildParams){
|
|
7
|
-
this.buildParams = buildParams;
|
|
8
|
-
}
|
|
9
|
-
get(transportName) {
|
|
10
|
-
if (transportName !== SMTP_TRANSPORT_NAME) return null;
|
|
11
|
-
const value = this.buildParams.get(SMTP_BUILD_PARAM_KEY);
|
|
12
|
-
return value ?? null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const CodeMailerSettings_CodeMailerSettings = CodeMailerSettings.createImplementation({
|
|
16
|
-
implementation: CodeMailerSettingsImpl,
|
|
17
|
-
dependencies: [
|
|
18
|
-
BuildParams
|
|
19
|
-
]
|
|
20
|
-
});
|
|
21
|
-
export { CodeMailerSettings_CodeMailerSettings as CodeMailerSettings };
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=CodeMailerSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CodeMailerSettings/CodeMailerSettings.js","sources":["../../../src/features/CodeMailerSettings/CodeMailerSettings.ts"],"sourcesContent":["import { BuildParams } from \"@webiny/api-core/features/buildParams/index.js\";\nimport { CodeMailerSettings as Abstraction } from \"~/domain/CodeMailerSettings/abstractions.js\";\nimport type { TransportSettings } from \"~/types.js\";\n\nconst SMTP_TRANSPORT_NAME = \"Mailer/SmtpTransport\";\nconst SMTP_BUILD_PARAM_KEY = \"Mailer.SmtpSettings\";\n\nclass CodeMailerSettingsImpl implements Abstraction.Interface {\n constructor(private buildParams: BuildParams.Interface) {}\n\n get(transportName: string): TransportSettings | null {\n if (transportName !== SMTP_TRANSPORT_NAME) {\n return null;\n }\n const value = this.buildParams.get<TransportSettings>(SMTP_BUILD_PARAM_KEY);\n return value ?? null;\n }\n}\n\nexport const CodeMailerSettings = Abstraction.createImplementation({\n implementation: CodeMailerSettingsImpl,\n dependencies: [BuildParams]\n});\n"],"names":["SMTP_TRANSPORT_NAME","SMTP_BUILD_PARAM_KEY","CodeMailerSettingsImpl","buildParams","transportName","value","CodeMailerSettings","Abstraction","BuildParams"],"mappings":";;AAIA,MAAMA,sBAAsB;AAC5B,MAAMC,uBAAuB;AAE7B,MAAMC;IACF,YAAoBC,WAAkC,CAAE;aAApCA,WAAW,GAAXA;IAAqC;IAEzD,IAAIC,aAAqB,EAA4B;QACjD,IAAIA,kBAAkBJ,qBAClB,OAAO;QAEX,MAAMK,QAAQ,IAAI,CAAC,WAAW,CAAC,GAAG,CAAoBJ;QACtD,OAAOI,SAAS;IACpB;AACJ;AAEO,MAAMC,wCAAqBC,mBAAAA,oBAAgC,CAAC;IAC/D,gBAAgBL;IAChB,cAAc;QAACM;KAAY;AAC/B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { CodeMailerSettings } from "./CodeMailerSettings.js";
|
|
3
|
-
const CodeMailerSettingsFeature = createFeature({
|
|
4
|
-
name: "Mailer/CodeMailerSettings",
|
|
5
|
-
register (container) {
|
|
6
|
-
container.register(CodeMailerSettings).inSingletonScope();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export { CodeMailerSettingsFeature };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CodeMailerSettings/feature.js","sources":["../../../src/features/CodeMailerSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CodeMailerSettings } from \"./CodeMailerSettings.js\";\n\nexport const CodeMailerSettingsFeature = createFeature({\n name: \"Mailer/CodeMailerSettings\",\n register(container) {\n container.register(CodeMailerSettings).inSingletonScope();\n }\n});\n"],"names":["CodeMailerSettingsFeature","createFeature","container","CodeMailerSettings"],"mappings":";;AAGO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,oBAAoB,gBAAgB;IAC3D;AACJ"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MailTransport } from "../../domain/MailTransport/abstractions.js";
|
|
2
|
-
export declare class DummyMailTransport implements MailTransport.Interface {
|
|
3
|
-
readonly name = "Mailer/DummyTransport";
|
|
4
|
-
constructor();
|
|
5
|
-
send(): Promise<{
|
|
6
|
-
result: boolean;
|
|
7
|
-
error: null;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/DummyTransport/DummyMailTransport.js","sources":["../../../src/features/DummyTransport/DummyMailTransport.ts"],"sourcesContent":["import { MailTransport } from \"~/domain/MailTransport/abstractions.js\";\n\nexport class DummyMailTransport implements MailTransport.Interface {\n public readonly name = \"Mailer/DummyTransport\";\n\n constructor() {}\n\n async send() {\n return {\n result: true,\n error: null\n };\n }\n}\n"],"names":["DummyMailTransport"],"mappings":"AAEO,MAAMA;IAGT,aAAc;aAFE,IAAI,GAAG;IAER;IAEf,MAAM,OAAO;QACT,OAAO;YACH,QAAQ;YACR,OAAO;QACX;IACJ;AACJ"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type IMailTransport, MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
|
|
2
|
-
declare class DummyMailTransportFactoryImpl implements MailTransportFactory.Interface {
|
|
3
|
-
readonly name = "Mailer/DummyTransport";
|
|
4
|
-
canUse(): boolean;
|
|
5
|
-
createTransport(): Promise<IMailTransport>;
|
|
6
|
-
}
|
|
7
|
-
export declare const DummyMailTransportFactory: typeof DummyMailTransportFactoryImpl & {
|
|
8
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/domain/MailTransport/abstractions.js").IMailTransportFactory>;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
|
|
2
|
-
import { DummyMailTransport } from "./DummyMailTransport.js";
|
|
3
|
-
class DummyMailTransportFactoryImpl {
|
|
4
|
-
canUse() {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
async createTransport() {
|
|
8
|
-
return new DummyMailTransport();
|
|
9
|
-
}
|
|
10
|
-
constructor(){
|
|
11
|
-
this.name = "Mailer/DummyTransport";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const DummyMailTransportFactory = MailTransportFactory.createImplementation({
|
|
15
|
-
implementation: DummyMailTransportFactoryImpl,
|
|
16
|
-
dependencies: []
|
|
17
|
-
});
|
|
18
|
-
export { DummyMailTransportFactory };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=DummyMailTransportFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/DummyTransport/DummyMailTransportFactory.js","sources":["../../../src/features/DummyTransport/DummyMailTransportFactory.ts"],"sourcesContent":["import { type IMailTransport, MailTransportFactory } from \"~/domain/MailTransport/abstractions.js\";\nimport { DummyMailTransport } from \"./DummyMailTransport.js\";\n\nclass DummyMailTransportFactoryImpl implements MailTransportFactory.Interface {\n public readonly name = \"Mailer/DummyTransport\";\n\n canUse(): boolean {\n return true;\n }\n\n async createTransport(): Promise<IMailTransport> {\n return new DummyMailTransport();\n }\n}\n\nexport const DummyMailTransportFactory = MailTransportFactory.createImplementation({\n implementation: DummyMailTransportFactoryImpl,\n dependencies: []\n});\n"],"names":["DummyMailTransportFactoryImpl","DummyMailTransport","DummyMailTransportFactory","MailTransportFactory"],"mappings":";;AAGA,MAAMA;IAGF,SAAkB;QACd,OAAO;IACX;IAEA,MAAM,kBAA2C;QAC7C,OAAO,IAAIC;IACf;;aARgB,IAAI,GAAG;;AAS3B;AAEO,MAAMC,4BAA4BC,qBAAqB,oBAAoB,CAAC;IAC/E,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { DummyMailTransportFactory } from "./DummyMailTransportFactory.js";
|
|
3
|
-
const DummyTransportFeature = createFeature({
|
|
4
|
-
name: "Mailer/DummyTransport",
|
|
5
|
-
register (container) {
|
|
6
|
-
container.register(DummyMailTransportFactory).inSingletonScope();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export { DummyTransportFeature };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/DummyTransport/feature.js","sources":["../../../src/features/DummyTransport/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DummyMailTransportFactory } from \"./DummyMailTransportFactory.js\";\n\nexport const DummyTransportFeature = createFeature({\n name: \"Mailer/DummyTransport\",\n register(container) {\n container.register(DummyMailTransportFactory).inSingletonScope();\n }\n});\n"],"names":["DummyTransportFeature","createFeature","container","DummyMailTransportFactory"],"mappings":";;AAGO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,2BAA2B,gBAAgB;IAClE;AACJ"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import zod from "zod";
|
|
2
|
-
export declare const saveValidation: zod.ZodObject<{
|
|
3
|
-
from: zod.ZodString;
|
|
4
|
-
port: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodNumber>>>;
|
|
5
|
-
replyTo: zod.ZodPreprocess<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, unknown>;
|
|
6
|
-
host: zod.ZodString;
|
|
7
|
-
user: zod.ZodString;
|
|
8
|
-
secure: zod.ZodOptional<zod.ZodBoolean>;
|
|
9
|
-
password: zod.ZodPipe<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>>, zod.ZodTransform<string | null, string | null | undefined>>;
|
|
10
|
-
}, zod.core.$strip>;
|