@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.
Files changed (157) hide show
  1. package/MailerFeature.d.ts +4 -0
  2. package/MailerFeature.js +23 -0
  3. package/MailerFeature.js.map +1 -0
  4. package/constants.d.ts +1 -1
  5. package/constants.js +2 -1
  6. package/constants.js.map +1 -1
  7. package/domain/MailTransport/abstractions.d.ts +8 -3
  8. package/domain/MailTransport/abstractions.js +3 -2
  9. package/domain/MailTransport/abstractions.js.map +1 -1
  10. package/domain/MailerService/abstractions.d.ts +4 -2
  11. package/domain/MailerService/abstractions.js +2 -1
  12. package/domain/MailerService/abstractions.js.map +1 -1
  13. package/domain/MailerService/errors.d.ts +4 -0
  14. package/domain/MailerService/errors.js +29 -24
  15. package/domain/MailerService/errors.js.map +1 -1
  16. package/domain/TransportSettings/abstractions.d.ts +47 -0
  17. package/domain/TransportSettings/abstractions.js +5 -0
  18. package/domain/TransportSettings/abstractions.js.map +1 -0
  19. package/domain/TransportSettings/findDefinition.d.ts +6 -0
  20. package/domain/TransportSettings/findDefinition.js +13 -0
  21. package/domain/TransportSettings/findDefinition.js.map +1 -0
  22. package/domain/errors.d.ts +23 -5
  23. package/domain/errors.js +68 -40
  24. package/domain/errors.js.map +1 -1
  25. package/exports/api/mailer.d.ts +6 -0
  26. package/exports/api/mailer.js +6 -0
  27. package/features/GetSettings/GetSettingsRepository.d.ts +7 -5
  28. package/features/GetSettings/GetSettingsRepository.js +43 -30
  29. package/features/GetSettings/GetSettingsRepository.js.map +1 -1
  30. package/features/GetSettings/GetSettingsUseCase.d.ts +11 -4
  31. package/features/GetSettings/GetSettingsUseCase.js +38 -10
  32. package/features/GetSettings/GetSettingsUseCase.js.map +1 -1
  33. package/features/GetSettings/abstractions.d.ts +20 -6
  34. package/features/GetSettings/abstractions.js +3 -2
  35. package/features/GetSettings/abstractions.js.map +1 -1
  36. package/features/GetSettings/feature.d.ts +4 -1
  37. package/features/GetSettings/feature.js +7 -6
  38. package/features/GetSettings/feature.js.map +1 -1
  39. package/features/GetSettings/index.d.ts +2 -1
  40. package/features/GetSettings/index.js +1 -3
  41. package/features/IsMailerConfigured/IsMailerConfiguredUseCase.d.ts +11 -0
  42. package/features/IsMailerConfigured/IsMailerConfiguredUseCase.js +19 -0
  43. package/features/IsMailerConfigured/IsMailerConfiguredUseCase.js.map +1 -0
  44. package/features/IsMailerConfigured/abstractions.d.ts +18 -0
  45. package/features/IsMailerConfigured/abstractions.js +5 -0
  46. package/features/IsMailerConfigured/abstractions.js.map +1 -0
  47. package/features/IsMailerConfigured/feature.d.ts +4 -0
  48. package/features/IsMailerConfigured/feature.js +11 -0
  49. package/features/IsMailerConfigured/feature.js.map +1 -0
  50. package/features/IsMailerConfigured/index.d.ts +1 -0
  51. package/features/IsMailerConfigured/index.js +1 -0
  52. package/features/MailerService/MailerService.d.ts +3 -4
  53. package/features/MailerService/MailerService.js +42 -41
  54. package/features/MailerService/MailerService.js.map +1 -1
  55. package/features/MailerService/feature.d.ts +4 -1
  56. package/features/MailerService/feature.js +6 -5
  57. package/features/MailerService/feature.js.map +1 -1
  58. package/features/SaveSettings/SaveSettingsRepository.d.ts +4 -3
  59. package/features/SaveSettings/SaveSettingsRepository.js +58 -48
  60. package/features/SaveSettings/SaveSettingsRepository.js.map +1 -1
  61. package/features/SaveSettings/SaveSettingsUseCase.d.ts +6 -4
  62. package/features/SaveSettings/SaveSettingsUseCase.js +49 -42
  63. package/features/SaveSettings/SaveSettingsUseCase.js.map +1 -1
  64. package/features/SaveSettings/abstractions.d.ts +22 -21
  65. package/features/SaveSettings/abstractions.js +5 -8
  66. package/features/SaveSettings/abstractions.js.map +1 -1
  67. package/features/SaveSettings/events.d.ts +3 -3
  68. package/features/SaveSettings/events.js +17 -12
  69. package/features/SaveSettings/events.js.map +1 -1
  70. package/features/SaveSettings/feature.d.ts +4 -1
  71. package/features/SaveSettings/feature.js +7 -6
  72. package/features/SaveSettings/feature.js.map +1 -1
  73. package/features/SaveSettings/index.d.ts +2 -1
  74. package/features/SaveSettings/index.js +1 -3
  75. package/features/SendMail/SendMailUseCase.d.ts +2 -2
  76. package/features/SendMail/SendMailUseCase.js +44 -48
  77. package/features/SendMail/SendMailUseCase.js.map +1 -1
  78. package/features/SendMail/abstractions.d.ts +7 -7
  79. package/features/SendMail/abstractions.js +5 -8
  80. package/features/SendMail/abstractions.js.map +1 -1
  81. package/features/SendMail/events.d.ts +4 -4
  82. package/features/SendMail/events.js +24 -17
  83. package/features/SendMail/events.js.map +1 -1
  84. package/features/SendMail/feature.d.ts +4 -1
  85. package/features/SendMail/feature.js +6 -5
  86. package/features/SendMail/feature.js.map +1 -1
  87. package/features/SendMail/index.d.ts +1 -0
  88. package/features/SendMail/index.js +1 -0
  89. package/features/SendTestMail/SendTestMailUseCase.d.ts +13 -0
  90. package/features/SendTestMail/SendTestMailUseCase.js +40 -0
  91. package/features/SendTestMail/SendTestMailUseCase.js.map +1 -0
  92. package/features/SendTestMail/abstractions.d.ts +32 -0
  93. package/features/SendTestMail/abstractions.js +5 -0
  94. package/features/SendTestMail/abstractions.js.map +1 -0
  95. package/features/SendTestMail/feature.d.ts +4 -0
  96. package/features/SendTestMail/feature.js +11 -0
  97. package/features/SendTestMail/feature.js.map +1 -0
  98. package/graphql/MailerSchemaFactory.d.ts +10 -0
  99. package/graphql/MailerSchemaFactory.js +135 -0
  100. package/graphql/MailerSchemaFactory.js.map +1 -0
  101. package/index.d.ts +11 -2
  102. package/index.js +8 -26
  103. package/package.json +25 -33
  104. package/types.d.ts +0 -8
  105. package/types.js +0 -3
  106. package/utils/isMailboxAddress.d.ts +6 -0
  107. package/utils/isMailboxAddress.js +5 -0
  108. package/utils/isMailboxAddress.js.map +1 -0
  109. package/domain/Encryption/abstractions.d.ts +0 -8
  110. package/domain/Encryption/abstractions.js +0 -4
  111. package/domain/Encryption/abstractions.js.map +0 -1
  112. package/features/DummyTransport/DummyMailTransport.d.ts +0 -9
  113. package/features/DummyTransport/DummyMailTransport.js +0 -12
  114. package/features/DummyTransport/DummyMailTransport.js.map +0 -1
  115. package/features/DummyTransport/DummyMailTransportFactory.d.ts +0 -8
  116. package/features/DummyTransport/DummyMailTransportFactory.js +0 -13
  117. package/features/DummyTransport/DummyMailTransportFactory.js.map +0 -1
  118. package/features/DummyTransport/feature.d.ts +0 -1
  119. package/features/DummyTransport/feature.js +0 -10
  120. package/features/DummyTransport/feature.js.map +0 -1
  121. package/features/Encryption/PasswordEncryption.d.ts +0 -9
  122. package/features/Encryption/PasswordEncryption.js +0 -23
  123. package/features/Encryption/PasswordEncryption.js.map +0 -1
  124. package/features/Encryption/feature.d.ts +0 -1
  125. package/features/Encryption/feature.js +0 -10
  126. package/features/Encryption/feature.js.map +0 -1
  127. package/features/Encryption/utils/password.d.ts +0 -7
  128. package/features/Encryption/utils/password.js +0 -56
  129. package/features/Encryption/utils/password.js.map +0 -1
  130. package/features/Encryption/utils/secret.d.ts +0 -1
  131. package/features/Encryption/utils/secret.js +0 -11
  132. package/features/Encryption/utils/secret.js.map +0 -1
  133. package/features/GetSettings/index.js.map +0 -1
  134. package/features/MailerService/TransportFactory.d.ts +0 -2
  135. package/features/MailerService/TransportFactory.js +0 -31
  136. package/features/MailerService/TransportFactory.js.map +0 -1
  137. package/features/SaveSettings/index.js.map +0 -1
  138. package/features/SaveSettings/validation.d.ts +0 -23
  139. package/features/SaveSettings/validation.js +0 -19
  140. package/features/SaveSettings/validation.js.map +0 -1
  141. package/features/SmtpTransport/SmtpConfig.d.ts +0 -6
  142. package/features/SmtpTransport/SmtpConfig.js +0 -29
  143. package/features/SmtpTransport/SmtpConfig.js.map +0 -1
  144. package/features/SmtpTransport/SmtpMailTransport.d.ts +0 -18
  145. package/features/SmtpTransport/SmtpMailTransport.js +0 -61
  146. package/features/SmtpTransport/SmtpMailTransport.js.map +0 -1
  147. package/features/SmtpTransport/SmtpMailTransportFactory.d.ts +0 -9
  148. package/features/SmtpTransport/SmtpMailTransportFactory.js +0 -14
  149. package/features/SmtpTransport/SmtpMailTransportFactory.js.map +0 -1
  150. package/features/SmtpTransport/feature.d.ts +0 -1
  151. package/features/SmtpTransport/feature.js +0 -10
  152. package/features/SmtpTransport/feature.js.map +0 -1
  153. package/graphql/settings.d.ts +0 -3
  154. package/graphql/settings.js +0 -115
  155. package/graphql/settings.js.map +0 -1
  156. package/index.js.map +0 -1
  157. package/types.js.map +0 -1
@@ -0,0 +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 { 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,4 +1,13 @@
1
+ export { MailerFeature } from "./MailerFeature.js";
1
2
  export { MailerService } from "./domain/MailerService/abstractions.js";
2
3
  export type { IMailerService, IMailerServiceErrors } from "./domain/MailerService/abstractions.js";
3
- export declare const createMailerContext: () => import("@webiny/api").ContextPlugin<import("@webiny/api/types.js").Context>;
4
- export declare const createMailerGraphQL: () => import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("@webiny/api/types.js").Context>;
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,27 +1,9 @@
1
- import { createContextPlugin } from "@webiny/api";
2
- import { EncryptionFeature } from "./features/Encryption/feature.js";
3
- import { GetSettingsFeature } from "./features/GetSettings/feature.js";
4
- import { SaveSettingsFeature } from "./features/SaveSettings/feature.js";
5
- import { DummyTransportFeature } from "./features/DummyTransport/feature.js";
6
- import { SmtpTransportFeature } from "./features/SmtpTransport/feature.js";
7
- import { MailerServiceFeature } from "./features/MailerService/feature.js";
8
- import { SendMailFeature } from "./features/SendMail/feature.js";
9
- import { createSettingsGraphQL } from "./graphql/settings.js";
1
+ export { MailerFeature } from "./MailerFeature.js";
10
2
  export { MailerService } from "./domain/MailerService/abstractions.js";
11
- export const createMailerContext = () => {
12
- return createContextPlugin(context => {
13
- // Register all features
14
- EncryptionFeature.register(context.container);
15
- DummyTransportFeature.register(context.container);
16
- SmtpTransportFeature.register(context.container);
17
- GetSettingsFeature.register(context.container);
18
- SaveSettingsFeature.register(context.container);
19
- MailerServiceFeature.register(context.container);
20
- SendMailFeature.register(context.container);
21
- });
22
- };
23
- export const createMailerGraphQL = () => {
24
- return createSettingsGraphQL();
25
- };
26
-
27
- //# sourceMappingURL=index.js.map
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,8 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/api-mailer",
3
- "version": "0.0.0-unstable.df7a8bb475",
3
+ "version": "0.0.0-unstable.e1999482d0",
4
4
  "type": "module",
5
- "main": "index.js",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
6
9
  "repository": {
7
10
  "type": "git",
8
11
  "url": "https://github.com/webiny/webiny-js.git",
@@ -15,41 +18,30 @@
15
18
  "description": "The API to send e-mails.",
16
19
  "license": "MIT",
17
20
  "dependencies": {
18
- "@webiny/api": "0.0.0-unstable.df7a8bb475",
19
- "@webiny/api-headless-cms": "0.0.0-unstable.df7a8bb475",
20
- "@webiny/error": "0.0.0-unstable.df7a8bb475",
21
- "@webiny/feature": "0.0.0-unstable.df7a8bb475",
22
- "@webiny/handler-graphql": "0.0.0-unstable.df7a8bb475",
23
- "@webiny/plugins": "0.0.0-unstable.df7a8bb475",
24
- "nodemailer": "7.0.13",
25
- "zod": "3.25.76"
21
+ "@webiny/api-graphql": "0.0.0-unstable.e1999482d0",
22
+ "@webiny/feature": "0.0.0-unstable.e1999482d0",
23
+ "@webiny/plugins": "0.0.0-unstable.e1999482d0",
24
+ "email-addresses": "5.0.0",
25
+ "zod": "4.6.7"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/crypto-js": "4.2.2",
29
- "@types/nodemailer": "7.0.10",
30
- "@webiny/api-core": "0.0.0-unstable.df7a8bb475",
31
- "@webiny/build-tools": "0.0.0-unstable.df7a8bb475",
32
- "@webiny/db-dynamodb": "0.0.0-unstable.df7a8bb475",
33
- "@webiny/handler": "0.0.0-unstable.df7a8bb475",
34
- "@webiny/handler-aws": "0.0.0-unstable.df7a8bb475",
35
- "@webiny/handler-db": "0.0.0-unstable.df7a8bb475",
36
- "@webiny/project-utils": "0.0.0-unstable.df7a8bb475",
37
- "graphql": "16.12.0",
38
- "jest-dynalite": "3.6.1",
39
- "rimraf": "6.1.3",
40
- "typescript": "5.9.3",
41
- "vitest": "3.2.4"
28
+ "@webiny/api": "0.0.0-unstable.e1999482d0",
29
+ "@webiny/api-core": "0.0.0-unstable.e1999482d0",
30
+ "@webiny/api-kernel-core": "0.0.0-unstable.e1999482d0",
31
+ "@webiny/build-tools": "0.0.0-unstable.e1999482d0",
32
+ "@webiny/db-dynamodb": "0.0.0-unstable.e1999482d0",
33
+ "@webiny/di": "2.0.0",
34
+ "@webiny/handler": "0.0.0-unstable.e1999482d0",
35
+ "graphql": "16.15.0",
36
+ "rimraf": "6.1.4",
37
+ "typescript": "7.0.2",
38
+ "vitest": "5.1.1"
42
39
  },
43
40
  "publishConfig": {
44
- "access": "public",
45
- "directory": "dist"
41
+ "access": "public"
46
42
  },
47
- "gitHead": "df7a8bb4755a1da047f0af8c56bdb649cc81bf7d",
48
- "adio": {
49
- "ignore": {
50
- "src": [
51
- "node:crypto"
52
- ]
53
- }
43
+ "gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
44
+ "webiny": {
45
+ "publishFrom": "dist"
54
46
  }
55
47
  }
package/types.d.ts CHANGED
@@ -31,12 +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
- user: string;
38
- password: string;
39
- from: string;
40
- replyTo?: string;
41
- }
42
34
  export {};
package/types.js CHANGED
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * RFC 5322 mailbox validator. Accepts both addr-spec ("addr@domain") and
3
+ * name-addr ("Display Name <addr@domain>") forms — both are valid SMTP
4
+ * From / Reply-To inputs that nodemailer and most providers accept.
5
+ */
6
+ export declare const isMailboxAddress: (value: string) => boolean;
@@ -0,0 +1,5 @@
1
+ import email_addresses from "email-addresses";
2
+ const isMailboxAddress = (value)=>null !== email_addresses.parseOneAddress(value);
3
+ export { isMailboxAddress };
4
+
5
+ //# sourceMappingURL=isMailboxAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/isMailboxAddress.js","sources":["../../src/utils/isMailboxAddress.ts"],"sourcesContent":["import emailAddresses from \"email-addresses\";\n\n/**\n * RFC 5322 mailbox validator. Accepts both addr-spec (\"addr@domain\") and\n * name-addr (\"Display Name <addr@domain>\") forms — both are valid SMTP\n * From / Reply-To inputs that nodemailer and most providers accept.\n */\nexport const isMailboxAddress = (value: string): boolean => {\n return emailAddresses.parseOneAddress(value) !== null;\n};\n"],"names":["isMailboxAddress","value","emailAddresses"],"mappings":";AAOO,MAAMA,mBAAmB,CAACC,QACtBC,AAA0C,SAA1CA,gBAAAA,eAA8B,CAACD"}
@@ -1,8 +0,0 @@
1
- export interface IEncryption {
2
- encrypt(value: string): Promise<string>;
3
- decrypt(value: string): Promise<string>;
4
- }
5
- export declare const Encryption: import("@webiny/di").Abstraction<IEncryption>;
6
- export declare namespace Encryption {
7
- type Interface = IEncryption;
8
- }
@@ -1,4 +0,0 @@
1
- import { createAbstraction } from "@webiny/feature/api";
2
- export const Encryption = createAbstraction("Encryption");
3
-
4
- //# sourceMappingURL=abstractions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createAbstraction","Encryption"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IEncryption {\n encrypt(value: string): Promise<string>;\n decrypt(value: string): Promise<string>;\n}\n\nexport const Encryption = createAbstraction<IEncryption>(\"Encryption\");\n\nexport namespace Encryption {\n export type Interface = IEncryption;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,UAAU,GAAGD,iBAAiB,CAAc,YAAY,CAAC","ignoreList":[]}
@@ -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,12 +0,0 @@
1
- export class DummyMailTransport {
2
- name = "Mailer/DummyTransport";
3
- constructor() {}
4
- async send() {
5
- return {
6
- result: true,
7
- error: null
8
- };
9
- }
10
- }
11
-
12
- //# sourceMappingURL=DummyMailTransport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["DummyMailTransport","name","constructor","send","result","error"],"sources":["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"],"mappings":"AAEA,OAAO,MAAMA,kBAAkB,CAAoC;EAC/CC,IAAI,GAAG,uBAAuB;EAE9CC,WAAWA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAAA,EAAG;IACT,OAAO;MACHC,MAAM,EAAE,IAAI;MACZC,KAAK,EAAE;IACX,CAAC;EACL;AACJ","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { type IMailTransport, MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
2
- declare class DummyMailTransportFactoryImpl implements MailTransportFactory.Interface {
3
- createTransport(): Promise<IMailTransport>;
4
- }
5
- export declare const DummyMailTransportFactory: typeof DummyMailTransportFactoryImpl & {
6
- __abstraction: import("@webiny/di").Abstraction<import("~/domain/MailTransport/abstractions.js").IMailTransportFactory>;
7
- };
8
- export {};
@@ -1,13 +0,0 @@
1
- import { MailTransportFactory } from "../../domain/MailTransport/abstractions.js";
2
- import { DummyMailTransport } from "./DummyMailTransport.js";
3
- class DummyMailTransportFactoryImpl {
4
- async createTransport() {
5
- return new DummyMailTransport();
6
- }
7
- }
8
- export const DummyMailTransportFactory = MailTransportFactory.createImplementation({
9
- implementation: DummyMailTransportFactoryImpl,
10
- dependencies: []
11
- });
12
-
13
- //# sourceMappingURL=DummyMailTransportFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MailTransportFactory","DummyMailTransport","DummyMailTransportFactoryImpl","createTransport","DummyMailTransportFactory","createImplementation","implementation","dependencies"],"sources":["DummyMailTransportFactory.ts"],"sourcesContent":["import { type IMailTransport, MailTransportFactory } from \"~/domain/MailTransport/abstractions.js\";\nimport { DummyMailTransport } from \"./DummyMailTransport.js\";\n\nclass DummyMailTransportFactoryImpl implements MailTransportFactory.Interface {\n async createTransport(): Promise<IMailTransport> {\n return new DummyMailTransport();\n }\n}\n\nexport const DummyMailTransportFactory = MailTransportFactory.createImplementation({\n implementation: DummyMailTransportFactoryImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAA8BA,oBAAoB;AAClD,SAASC,kBAAkB;AAE3B,MAAMC,6BAA6B,CAA2C;EAC1E,MAAMC,eAAeA,CAAA,EAA4B;IAC7C,OAAO,IAAIF,kBAAkB,CAAC,CAAC;EACnC;AACJ;AAEA,OAAO,MAAMG,yBAAyB,GAAGJ,oBAAoB,CAACK,oBAAoB,CAAC;EAC/EC,cAAc,EAAEJ,6BAA6B;EAC7CK,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- export declare const DummyTransportFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
@@ -1,10 +0,0 @@
1
- import { createFeature } from "@webiny/feature/api";
2
- import { DummyMailTransportFactory } from "./DummyMailTransportFactory.js";
3
- export const DummyTransportFeature = createFeature({
4
- name: "Mailer/DummyTransport",
5
- register(container) {
6
- container.register(DummyMailTransportFactory).inSingletonScope();
7
- }
8
- });
9
-
10
- //# sourceMappingURL=feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createFeature","DummyMailTransportFactory","DummyTransportFeature","name","register","container","inSingletonScope"],"sources":["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"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,yBAAyB;AAElC,OAAO,MAAMC,qBAAqB,GAAGF,aAAa,CAAC;EAC/CG,IAAI,EAAE,uBAAuB;EAC7BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,yBAAyB,CAAC,CAACK,gBAAgB,CAAC,CAAC;EACpE;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import { Encryption } from "../../domain/Encryption/abstractions.js";
2
- declare class PasswordEncryptionImpl implements Encryption.Interface {
3
- encrypt(value: string): Promise<string>;
4
- decrypt(value: string): Promise<string>;
5
- }
6
- export declare const PasswordEncryption: typeof PasswordEncryptionImpl & {
7
- __abstraction: import("@webiny/di").Abstraction<import("~/domain/Encryption/abstractions.js").IEncryption>;
8
- };
9
- export {};
@@ -1,23 +0,0 @@
1
- import { Encryption } from "../../domain/Encryption/abstractions.js";
2
- import { decrypt, encrypt } from "./utils/password.js";
3
- import { getSecret } from "./utils/secret.js";
4
- class PasswordEncryptionImpl {
5
- async encrypt(value) {
6
- return encrypt({
7
- value,
8
- secret: getSecret()
9
- });
10
- }
11
- async decrypt(value) {
12
- return decrypt({
13
- value,
14
- secret: getSecret()
15
- });
16
- }
17
- }
18
- export const PasswordEncryption = Encryption.createImplementation({
19
- implementation: PasswordEncryptionImpl,
20
- dependencies: []
21
- });
22
-
23
- //# sourceMappingURL=PasswordEncryption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Encryption","decrypt","encrypt","getSecret","PasswordEncryptionImpl","value","secret","PasswordEncryption","createImplementation","implementation","dependencies"],"sources":["PasswordEncryption.ts"],"sourcesContent":["import { Encryption } from \"~/domain/Encryption/abstractions.js\";\nimport { decrypt, encrypt } from \"./utils/password.js\";\nimport { getSecret } from \"./utils/secret.js\";\n\nclass PasswordEncryptionImpl implements Encryption.Interface {\n public async encrypt(value: string): Promise<string> {\n return encrypt({ value, secret: getSecret() });\n }\n\n public async decrypt(value: string): Promise<string> {\n return decrypt({ value, secret: getSecret() });\n }\n}\n\nexport const PasswordEncryption = Encryption.createImplementation({\n implementation: PasswordEncryptionImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,UAAU;AACnB,SAASC,OAAO,EAAEC,OAAO;AACzB,SAASC,SAAS;AAElB,MAAMC,sBAAsB,CAAiC;EACzD,MAAaF,OAAOA,CAACG,KAAa,EAAmB;IACjD,OAAOH,OAAO,CAAC;MAAEG,KAAK;MAAEC,MAAM,EAAEH,SAAS,CAAC;IAAE,CAAC,CAAC;EAClD;EAEA,MAAaF,OAAOA,CAACI,KAAa,EAAmB;IACjD,OAAOJ,OAAO,CAAC;MAAEI,KAAK;MAAEC,MAAM,EAAEH,SAAS,CAAC;IAAE,CAAC,CAAC;EAClD;AACJ;AAEA,OAAO,MAAMI,kBAAkB,GAAGP,UAAU,CAACQ,oBAAoB,CAAC;EAC9DC,cAAc,EAAEL,sBAAsB;EACtCM,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- export declare const EncryptionFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
@@ -1,10 +0,0 @@
1
- import { createFeature } from "@webiny/feature/api";
2
- import { PasswordEncryption } from "./PasswordEncryption.js";
3
- export const EncryptionFeature = createFeature({
4
- name: "Mailer/Encryption",
5
- register(container) {
6
- container.register(PasswordEncryption).inSingletonScope();
7
- }
8
- });
9
-
10
- //# sourceMappingURL=feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createFeature","PasswordEncryption","EncryptionFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { PasswordEncryption } from \"./PasswordEncryption.js\";\n\nexport const EncryptionFeature = createFeature({\n name: \"Mailer/Encryption\",\n register(container) {\n container.register(PasswordEncryption).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,kBAAkB;AAE3B,OAAO,MAAMC,iBAAiB,GAAGF,aAAa,CAAC;EAC3CG,IAAI,EAAE,mBAAmB;EACzBC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,kBAAkB,CAAC,CAACK,gBAAgB,CAAC,CAAC;EAC7D;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- interface Params {
2
- value?: string | null;
3
- secret?: string | null;
4
- }
5
- export declare const decrypt: (params: Params) => string;
6
- export declare const encrypt: (params: Params) => string;
7
- export {};
@@ -1,56 +0,0 @@
1
- import crypto from "node:crypto";
2
- import WebinyError from "@webiny/error";
3
- const ALGORITHM = "aes-256-gcm";
4
- const IV_LENGTH = 12;
5
- const KEY_LENGTH = 32;
6
- export const decrypt = params => {
7
- const {
8
- value,
9
- secret
10
- } = params;
11
- if (!secret) {
12
- throw new WebinyError(`Cannot call decrypt without passing the secret.`);
13
- }
14
- if (!value) {
15
- return "";
16
- }
17
- try {
18
- const data = Buffer.from(value, "base64");
19
- const iv = data.subarray(0, 12);
20
- const authTag = data.subarray(12, 28);
21
- const encrypted = data.subarray(28);
22
- const key = crypto.scryptSync(secret, "salt", 32);
23
- const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);
24
- decipher.setAuthTag(authTag);
25
- const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
26
- return decrypted.toString("utf8");
27
- } catch {
28
- console.log(`Could not decrypt given encrypted password.`);
29
- }
30
- return "";
31
- };
32
- export const encrypt = params => {
33
- const {
34
- value,
35
- secret
36
- } = params;
37
- if (!secret) {
38
- throw new WebinyError(`Cannot call decrypt without passing the secret.`);
39
- }
40
- if (!value) {
41
- return "";
42
- }
43
- try {
44
- const key = crypto.scryptSync(secret, "salt", KEY_LENGTH);
45
- const iv = crypto.randomBytes(IV_LENGTH);
46
- const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
47
- const encrypted = Buffer.concat([cipher.update(value, "utf8"), cipher.final()]);
48
- const authTag = cipher.getAuthTag();
49
- return Buffer.concat([iv, authTag, encrypted]).toString("base64");
50
- } catch {
51
- console.log(`Could not encrypt given password.`);
52
- }
53
- return "";
54
- };
55
-
56
- //# sourceMappingURL=password.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["crypto","WebinyError","ALGORITHM","IV_LENGTH","KEY_LENGTH","decrypt","params","value","secret","data","Buffer","from","iv","subarray","authTag","encrypted","key","scryptSync","decipher","createDecipheriv","setAuthTag","decrypted","concat","update","final","toString","console","log","encrypt","randomBytes","cipher","createCipheriv","getAuthTag"],"sources":["password.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport WebinyError from \"@webiny/error\";\n\nconst ALGORITHM = \"aes-256-gcm\";\nconst IV_LENGTH = 12;\nconst KEY_LENGTH = 32;\n\ninterface Params {\n value?: string | null;\n secret?: string | null;\n}\n\nexport const decrypt = (params: Params): string => {\n const { value, secret } = params;\n if (!secret) {\n throw new WebinyError(`Cannot call decrypt without passing the secret.`);\n }\n if (!value) {\n return \"\";\n }\n try {\n const data = Buffer.from(value, \"base64\");\n\n const iv = data.subarray(0, 12);\n const authTag = data.subarray(12, 28);\n const encrypted = data.subarray(28);\n\n const key = crypto.scryptSync(secret, \"salt\", 32);\n\n const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);\n decipher.setAuthTag(authTag);\n\n const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);\n\n return decrypted.toString(\"utf8\");\n } catch {\n console.log(`Could not decrypt given encrypted password.`);\n }\n return \"\";\n};\n\nexport const encrypt = (params: Params): string => {\n const { value, secret } = params;\n if (!secret) {\n throw new WebinyError(`Cannot call decrypt without passing the secret.`);\n }\n if (!value) {\n return \"\";\n }\n\n try {\n const key = crypto.scryptSync(secret, \"salt\", KEY_LENGTH);\n const iv = crypto.randomBytes(IV_LENGTH);\n const cipher = crypto.createCipheriv(ALGORITHM, key, iv);\n const encrypted = Buffer.concat([cipher.update(value, \"utf8\"), cipher.final()]);\n const authTag = cipher.getAuthTag();\n return Buffer.concat([iv, authTag, encrypted]).toString(\"base64\");\n } catch {\n console.log(`Could not encrypt given password.`);\n }\n return \"\";\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,aAAa;AAChC,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,SAAS,GAAG,aAAa;AAC/B,MAAMC,SAAS,GAAG,EAAE;AACpB,MAAMC,UAAU,GAAG,EAAE;AAOrB,OAAO,MAAMC,OAAO,GAAIC,MAAc,IAAa;EAC/C,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGF,MAAM;EAChC,IAAI,CAACE,MAAM,EAAE;IACT,MAAM,IAAIP,WAAW,CAAC,iDAAiD,CAAC;EAC5E;EACA,IAAI,CAACM,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EACA,IAAI;IACA,MAAME,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACJ,KAAK,EAAE,QAAQ,CAAC;IAEzC,MAAMK,EAAE,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAC/B,MAAMC,OAAO,GAAGL,IAAI,CAACI,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IACrC,MAAME,SAAS,GAAGN,IAAI,CAACI,QAAQ,CAAC,EAAE,CAAC;IAEnC,MAAMG,GAAG,GAAGhB,MAAM,CAACiB,UAAU,CAACT,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAEjD,MAAMU,QAAQ,GAAGlB,MAAM,CAACmB,gBAAgB,CAACjB,SAAS,EAAEc,GAAG,EAAEJ,EAAE,CAAC;IAC5DM,QAAQ,CAACE,UAAU,CAACN,OAAO,CAAC;IAE5B,MAAMO,SAAS,GAAGX,MAAM,CAACY,MAAM,CAAC,CAACJ,QAAQ,CAACK,MAAM,CAACR,SAAS,CAAC,EAAEG,QAAQ,CAACM,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/E,OAAOH,SAAS,CAACI,QAAQ,CAAC,MAAM,CAAC;EACrC,CAAC,CAAC,MAAM;IACJC,OAAO,CAACC,GAAG,CAAC,6CAA6C,CAAC;EAC9D;EACA,OAAO,EAAE;AACb,CAAC;AAED,OAAO,MAAMC,OAAO,GAAItB,MAAc,IAAa;EAC/C,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGF,MAAM;EAChC,IAAI,CAACE,MAAM,EAAE;IACT,MAAM,IAAIP,WAAW,CAAC,iDAAiD,CAAC;EAC5E;EACA,IAAI,CAACM,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EAEA,IAAI;IACA,MAAMS,GAAG,GAAGhB,MAAM,CAACiB,UAAU,CAACT,MAAM,EAAE,MAAM,EAAEJ,UAAU,CAAC;IACzD,MAAMQ,EAAE,GAAGZ,MAAM,CAAC6B,WAAW,CAAC1B,SAAS,CAAC;IACxC,MAAM2B,MAAM,GAAG9B,MAAM,CAAC+B,cAAc,CAAC7B,SAAS,EAAEc,GAAG,EAAEJ,EAAE,CAAC;IACxD,MAAMG,SAAS,GAAGL,MAAM,CAACY,MAAM,CAAC,CAACQ,MAAM,CAACP,MAAM,CAAChB,KAAK,EAAE,MAAM,CAAC,EAAEuB,MAAM,CAACN,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/E,MAAMV,OAAO,GAAGgB,MAAM,CAACE,UAAU,CAAC,CAAC;IACnC,OAAOtB,MAAM,CAACY,MAAM,CAAC,CAACV,EAAE,EAAEE,OAAO,EAAEC,SAAS,CAAC,CAAC,CAACU,QAAQ,CAAC,QAAQ,CAAC;EACrE,CAAC,CAAC,MAAM;IACJC,OAAO,CAACC,GAAG,CAAC,mCAAmC,CAAC;EACpD;EACA,OAAO,EAAE;AACb,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- export declare const getSecret: () => string;
@@ -1,11 +0,0 @@
1
- import WebinyError from "@webiny/error";
2
- export const getSecret = () => {
3
- const envValue = process.env.WEBINY_API_MAILER_PASSWORD_SECRET;
4
- const value = String(envValue).trim();
5
- if (!envValue || !value) {
6
- throw new WebinyError(`There must be a password secret defined!`, "PASSWORD_SECRET_ERROR");
7
- }
8
- return value;
9
- };
10
-
11
- //# sourceMappingURL=secret.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["WebinyError","getSecret","envValue","process","env","WEBINY_API_MAILER_PASSWORD_SECRET","value","String","trim"],"sources":["secret.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport const getSecret = (): string => {\n const envValue = process.env.WEBINY_API_MAILER_PASSWORD_SECRET;\n\n const value = String(envValue).trim();\n if (!envValue || !value) {\n throw new WebinyError(`There must be a password secret defined!`, \"PASSWORD_SECRET_ERROR\");\n }\n return value;\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAc;EACnC,MAAMC,QAAQ,GAAGC,OAAO,CAACC,GAAG,CAACC,iCAAiC;EAE9D,MAAMC,KAAK,GAAGC,MAAM,CAACL,QAAQ,CAAC,CAACM,IAAI,CAAC,CAAC;EACrC,IAAI,CAACN,QAAQ,IAAI,CAACI,KAAK,EAAE;IACrB,MAAM,IAAIN,WAAW,CAAC,0CAA0C,EAAE,uBAAuB,CAAC;EAC9F;EACA,OAAOM,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["GetSettingsUseCase"],"sources":["index.ts"],"sourcesContent":["export { GetSettingsUseCase } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,kBAAkB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import type { TransportSettings } from "../../types.js";
2
- export declare const getDefaultSettingsFromEnv: () => TransportSettings | null;
@@ -1,31 +0,0 @@
1
- const getPort = value => {
2
- const port = Number(value);
3
- if (!!value && isNaN(port) === false) {
4
- return port;
5
- }
6
- return 25;
7
- };
8
- export const getDefaultSettingsFromEnv = () => {
9
- const input = {
10
- host: process.env.WEBINY_API_MAILER_HOST,
11
- port: getPort(process.env.WEBINY_API_MAILER_PORT),
12
- user: process.env.WEBINY_API_MAILER_USER,
13
- password: process.env.WEBINY_API_MAILER_PASSWORD,
14
- replyTo: process.env.WEBINY_API_MAILER_REPLY_TO,
15
- from: process.env.WEBINY_API_MAILER_FROM
16
- };
17
-
18
- // No need to do the validation if there is not at least one variable defined
19
- const hasAtLeastOneValue = Object.values(input).some(value => !!String(value).trim());
20
- if (!hasAtLeastOneValue) {
21
- return null;
22
- }
23
-
24
- // Basic validation - require essential fields
25
- if (!input.host || !input.user || !input.from) {
26
- return null;
27
- }
28
- return input;
29
- };
30
-
31
- //# sourceMappingURL=TransportFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getPort","value","port","Number","isNaN","getDefaultSettingsFromEnv","input","host","process","env","WEBINY_API_MAILER_HOST","WEBINY_API_MAILER_PORT","user","WEBINY_API_MAILER_USER","password","WEBINY_API_MAILER_PASSWORD","replyTo","WEBINY_API_MAILER_REPLY_TO","from","WEBINY_API_MAILER_FROM","hasAtLeastOneValue","Object","values","some","String","trim"],"sources":["TransportFactory.ts"],"sourcesContent":["import type { TransportSettings } from \"~/types.js\";\n\nconst getPort = (value: any): number => {\n const port = Number(value);\n if (!!value && isNaN(port) === false) {\n return port;\n }\n return 25;\n};\n\nexport const getDefaultSettingsFromEnv = (): TransportSettings | null => {\n const input: Partial<TransportSettings> = {\n host: process.env.WEBINY_API_MAILER_HOST,\n port: getPort(process.env.WEBINY_API_MAILER_PORT),\n user: process.env.WEBINY_API_MAILER_USER,\n password: process.env.WEBINY_API_MAILER_PASSWORD,\n replyTo: process.env.WEBINY_API_MAILER_REPLY_TO,\n from: process.env.WEBINY_API_MAILER_FROM\n };\n\n // No need to do the validation if there is not at least one variable defined\n const hasAtLeastOneValue = Object.values(input).some(value => !!String(value).trim());\n if (!hasAtLeastOneValue) {\n return null;\n }\n\n // Basic validation - require essential fields\n if (!input.host || !input.user || !input.from) {\n return null;\n }\n\n return input as TransportSettings;\n};\n"],"mappings":"AAEA,MAAMA,OAAO,GAAIC,KAAU,IAAa;EACpC,MAAMC,IAAI,GAAGC,MAAM,CAACF,KAAK,CAAC;EAC1B,IAAI,CAAC,CAACA,KAAK,IAAIG,KAAK,CAACF,IAAI,CAAC,KAAK,KAAK,EAAE;IAClC,OAAOA,IAAI;EACf;EACA,OAAO,EAAE;AACb,CAAC;AAED,OAAO,MAAMG,yBAAyB,GAAGA,CAAA,KAAgC;EACrE,MAAMC,KAAiC,GAAG;IACtCC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,sBAAsB;IACxCR,IAAI,EAAEF,OAAO,CAACQ,OAAO,CAACC,GAAG,CAACE,sBAAsB,CAAC;IACjDC,IAAI,EAAEJ,OAAO,CAACC,GAAG,CAACI,sBAAsB;IACxCC,QAAQ,EAAEN,OAAO,CAACC,GAAG,CAACM,0BAA0B;IAChDC,OAAO,EAAER,OAAO,CAACC,GAAG,CAACQ,0BAA0B;IAC/CC,IAAI,EAAEV,OAAO,CAACC,GAAG,CAACU;EACtB,CAAC;;EAED;EACA,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAAChB,KAAK,CAAC,CAACiB,IAAI,CAACtB,KAAK,IAAI,CAAC,CAACuB,MAAM,CAACvB,KAAK,CAAC,CAACwB,IAAI,CAAC,CAAC,CAAC;EACrF,IAAI,CAACL,kBAAkB,EAAE;IACrB,OAAO,IAAI;EACf;;EAEA;EACA,IAAI,CAACd,KAAK,CAACC,IAAI,IAAI,CAACD,KAAK,CAACM,IAAI,IAAI,CAACN,KAAK,CAACY,IAAI,EAAE;IAC3C,OAAO,IAAI;EACf;EAEA,OAAOZ,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["SaveSettingsUseCase","MailerSettingsAfterSaveHandler","MailerSettingsBeforeSaveHandler"],"sources":["index.ts"],"sourcesContent":["export {\n SaveSettingsUseCase,\n MailerSettingsAfterSaveHandler,\n MailerSettingsBeforeSaveHandler\n} from \"./abstractions.js\";\n"],"mappings":"AAAA,SACIA,mBAAmB,EACnBC,8BAA8B,EAC9BC,+BAA+B","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- import zod from "zod";
2
- export declare const saveValidation: zod.ZodObject<{
3
- password: zod.ZodEffects<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>>, string | null, string | null | undefined>;
4
- from: zod.ZodString;
5
- port: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodNumber>>>;
6
- replyTo: zod.ZodEffects<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>, string | null | undefined, unknown>;
7
- host: zod.ZodString;
8
- user: zod.ZodString;
9
- }, "strip", zod.ZodTypeAny, {
10
- host: string;
11
- user: string;
12
- password: string | null;
13
- from: string;
14
- port?: number | null | undefined;
15
- replyTo?: string | null | undefined;
16
- }, {
17
- host: string;
18
- user: string;
19
- from: string;
20
- port?: number | null | undefined;
21
- password?: string | null | undefined;
22
- replyTo?: unknown;
23
- }>;
@@ -1,19 +0,0 @@
1
- import zod from "zod";
2
- const password = zod.string().describe("Password");
3
- const common = {
4
- from: zod.string().email().describe("Mail from"),
5
- port: zod.number().optional().nullish().describe("Port"),
6
- replyTo: zod.preprocess(
7
- // We need to set empty strings to `null` before email validation kicks in
8
- value => value === "" ? null : value, zod.string().email().optional().nullish()).describe("Mail reply-to"),
9
- host: zod.string().describe("Hostname"),
10
- user: zod.string().describe("User")
11
- };
12
- export const saveValidation = zod.object({
13
- ...common,
14
- password: password.nullish().optional().transform(value => {
15
- return value === undefined ? null : value;
16
- })
17
- });
18
-
19
- //# sourceMappingURL=validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["zod","password","string","describe","common","from","email","port","number","optional","nullish","replyTo","preprocess","value","host","user","saveValidation","object","transform","undefined"],"sources":["validation.ts"],"sourcesContent":["import zod from \"zod\";\n\nconst password = zod.string().describe(\"Password\");\n\nconst common = {\n from: zod.string().email().describe(\"Mail from\"),\n port: zod.number().optional().nullish().describe(\"Port\"),\n replyTo: zod\n .preprocess(\n // We need to set empty strings to `null` before email validation kicks in\n value => (value === \"\" ? null : value),\n zod.string().email().optional().nullish()\n )\n .describe(\"Mail reply-to\"),\n host: zod.string().describe(\"Hostname\"),\n user: zod.string().describe(\"User\")\n};\n\nexport const saveValidation = zod.object({\n ...common,\n password: password\n .nullish()\n .optional()\n .transform(value => {\n return value === undefined ? null : value;\n })\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,MAAMC,QAAQ,GAAGD,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,UAAU,CAAC;AAElD,MAAMC,MAAM,GAAG;EACXC,IAAI,EAAEL,GAAG,CAACE,MAAM,CAAC,CAAC,CAACI,KAAK,CAAC,CAAC,CAACH,QAAQ,CAAC,WAAW,CAAC;EAChDI,IAAI,EAAEP,GAAG,CAACQ,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACP,QAAQ,CAAC,MAAM,CAAC;EACxDQ,OAAO,EAAEX,GAAG,CACPY,UAAU;EACP;EACAC,KAAK,IAAKA,KAAK,KAAK,EAAE,GAAG,IAAI,GAAGA,KAAM,EACtCb,GAAG,CAACE,MAAM,CAAC,CAAC,CAACI,KAAK,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAC5C,CAAC,CACAP,QAAQ,CAAC,eAAe,CAAC;EAC9BW,IAAI,EAAEd,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,UAAU,CAAC;EACvCY,IAAI,EAAEf,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,MAAM;AACtC,CAAC;AAED,OAAO,MAAMa,cAAc,GAAGhB,GAAG,CAACiB,MAAM,CAAC;EACrC,GAAGb,MAAM;EACTH,QAAQ,EAAEA,QAAQ,CACbS,OAAO,CAAC,CAAC,CACTD,QAAQ,CAAC,CAAC,CACVS,SAAS,CAACL,KAAK,IAAI;IAChB,OAAOA,KAAK,KAAKM,SAAS,GAAG,IAAI,GAAGN,KAAK;EAC7C,CAAC;AACT,CAAC,CAAC","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import type { TransportSettings } from "../../types.js";
2
- import type SMTPTransport from "nodemailer/lib/smtp-transport";
3
- export type SmtpTransportConfig = SMTPTransport.Options;
4
- export declare class SmtpConfig {
5
- static fromTransportSettings(settings: TransportSettings): SmtpTransportConfig;
6
- }
@@ -1,29 +0,0 @@
1
- const configDefaults = {
2
- socketTimeout: 15000,
3
- connectionTimeout: 15000,
4
- greetingTimeout: 15000
5
- };
6
- export class SmtpConfig {
7
- static fromTransportSettings(settings) {
8
- const baseConfig = {
9
- host: settings.host,
10
- port: settings.port,
11
- auth: {
12
- user: settings.user,
13
- pass: settings.password
14
- }
15
- };
16
-
17
- // Apply defaults
18
- return Object.keys(configDefaults).reduce((config, key) => {
19
- const configKey = key;
20
- if (config[configKey] === undefined || config[configKey] === null) {
21
- // @ts-expect-error
22
- config[configKey] = configDefaults[configKey];
23
- }
24
- return config;
25
- }, baseConfig);
26
- }
27
- }
28
-
29
- //# sourceMappingURL=SmtpConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["configDefaults","socketTimeout","connectionTimeout","greetingTimeout","SmtpConfig","fromTransportSettings","settings","baseConfig","host","port","auth","user","pass","password","Object","keys","reduce","config","key","configKey","undefined"],"sources":["SmtpConfig.ts"],"sourcesContent":["import type { TransportSettings } from \"~/types.js\";\nimport type SMTPTransport from \"nodemailer/lib/smtp-transport\";\n\nexport type SmtpTransportConfig = SMTPTransport.Options;\n\nconst configDefaults: Partial<SmtpTransportConfig> = {\n socketTimeout: 15000,\n connectionTimeout: 15000,\n greetingTimeout: 15000\n};\n\nexport class SmtpConfig {\n static fromTransportSettings(settings: TransportSettings): SmtpTransportConfig {\n const baseConfig: SmtpTransportConfig = {\n host: settings.host,\n port: settings.port,\n auth: {\n user: settings.user,\n pass: settings.password\n }\n };\n\n // Apply defaults\n return Object.keys(configDefaults).reduce<SmtpTransportConfig>((config, key) => {\n const configKey = key as keyof SmtpTransportConfig;\n if (config[configKey] === undefined || config[configKey] === null) {\n // @ts-expect-error\n config[configKey] = configDefaults[configKey];\n }\n return config;\n }, baseConfig);\n }\n}\n"],"mappings":"AAKA,MAAMA,cAA4C,GAAG;EACjDC,aAAa,EAAE,KAAK;EACpBC,iBAAiB,EAAE,KAAK;EACxBC,eAAe,EAAE;AACrB,CAAC;AAED,OAAO,MAAMC,UAAU,CAAC;EACpB,OAAOC,qBAAqBA,CAACC,QAA2B,EAAuB;IAC3E,MAAMC,UAA+B,GAAG;MACpCC,IAAI,EAAEF,QAAQ,CAACE,IAAI;MACnBC,IAAI,EAAEH,QAAQ,CAACG,IAAI;MACnBC,IAAI,EAAE;QACFC,IAAI,EAAEL,QAAQ,CAACK,IAAI;QACnBC,IAAI,EAAEN,QAAQ,CAACO;MACnB;IACJ,CAAC;;IAED;IACA,OAAOC,MAAM,CAACC,IAAI,CAACf,cAAc,CAAC,CAACgB,MAAM,CAAsB,CAACC,MAAM,EAAEC,GAAG,KAAK;MAC5E,MAAMC,SAAS,GAAGD,GAAgC;MAClD,IAAID,MAAM,CAACE,SAAS,CAAC,KAAKC,SAAS,IAAIH,MAAM,CAACE,SAAS,CAAC,KAAK,IAAI,EAAE;QAC/D;QACAF,MAAM,CAACE,SAAS,CAAC,GAAGnB,cAAc,CAACmB,SAAS,CAAC;MACjD;MACA,OAAOF,MAAM;IACjB,CAAC,EAAEV,UAAU,CAAC;EAClB;AACJ","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- import type SMTPTransport from "nodemailer/lib/smtp-transport";
2
- import { MailTransport } from "../../domain/MailTransport/abstractions.js";
3
- export declare class SmtpMailTransport implements MailTransport.Interface {
4
- readonly name = "Mailer/SmtpTransport";
5
- private readonly transporter;
6
- constructor(config: SMTPTransport.Options);
7
- send(params: MailTransport.SendParams): Promise<{
8
- result: string;
9
- error: null;
10
- } | {
11
- result: null;
12
- error: {
13
- message: any;
14
- code: any;
15
- data: any;
16
- };
17
- }>;
18
- }