@webiny/api-mailer 0.0.0-unstable.2af142b57e → 0.0.0-unstable.3bc8100a7f

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 (57) hide show
  1. package/context.d.ts +1 -1
  2. package/context.js +7 -4
  3. package/context.js.map +1 -1
  4. package/crud/settings/hooks.d.ts +1 -1
  5. package/crud/settings/hooks.js +6 -7
  6. package/crud/settings/hooks.js.map +1 -1
  7. package/crud/settings/model.d.ts +1 -2
  8. package/crud/settings/model.js +16 -22
  9. package/crud/settings/model.js.map +1 -1
  10. package/crud/settings/password.js +3 -1
  11. package/crud/settings/password.js.map +1 -1
  12. package/crud/settings/secret.js +3 -1
  13. package/crud/settings/secret.js.map +1 -1
  14. package/crud/settings/transform.d.ts +2 -2
  15. package/crud/settings/transform.js +10 -8
  16. package/crud/settings/transform.js.map +1 -1
  17. package/crud/settings/validation.d.ts +19 -19
  18. package/crud/settings/validation.js +12 -9
  19. package/crud/settings/validation.js.map +1 -1
  20. package/crud/settings.crud.d.ts +1 -1
  21. package/crud/settings.crud.js +127 -132
  22. package/crud/settings.crud.js.map +1 -1
  23. package/crud/transport/onTransportBeforeSend.d.ts +2 -2
  24. package/crud/transport/onTransportBeforeSend.js +8 -4
  25. package/crud/transport/onTransportBeforeSend.js.map +1 -1
  26. package/crud/transporter.crud.d.ts +1 -1
  27. package/crud/transporter.crud.js +7 -5
  28. package/crud/transporter.crud.js.map +1 -1
  29. package/graphql/index.js +3 -1
  30. package/graphql/index.js.map +1 -1
  31. package/graphql/settings.d.ts +1 -1
  32. package/graphql/settings.js +7 -5
  33. package/graphql/settings.js.map +1 -1
  34. package/index.d.ts +3 -6
  35. package/index.js +38 -29
  36. package/index.js.map +1 -1
  37. package/package.json +28 -39
  38. package/plugins/CreateTransportPlugin.d.ts +1 -1
  39. package/plugins/CreateTransportPlugin.js +4 -5
  40. package/plugins/CreateTransportPlugin.js.map +1 -1
  41. package/plugins/index.js +3 -1
  42. package/plugins/index.js.map +1 -1
  43. package/transports/createDummyTransport.d.ts +1 -1
  44. package/transports/createDummyTransport.js +4 -2
  45. package/transports/createDummyTransport.js.map +1 -1
  46. package/transports/createSmtpTransport.d.ts +5 -4
  47. package/transports/createSmtpTransport.js +14 -6
  48. package/transports/createSmtpTransport.js.map +1 -1
  49. package/transports/index.d.ts +2 -0
  50. package/transports/index.js +29 -0
  51. package/transports/index.js.map +1 -0
  52. package/types.d.ts +4 -4
  53. package/types.js +3 -1
  54. package/types.js.map +1 -1
  55. package/crud/group.d.ts +0 -2
  56. package/crud/group.js +0 -18
  57. package/crud/group.js.map +0 -1
package/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { PluginCollection } from "@webiny/plugins/types";
2
- import { createDummyTransport, DummyTransport } from "./transports/createDummyTransport";
3
- import { createSmtpTransport, SmtpTransport, SmtpTransportConfig } from "./transports/createSmtpTransport";
4
- import { createTransport } from "./plugins";
5
- export { createDummyTransport, createSmtpTransport, createTransport };
6
- export type { SmtpTransport, SmtpTransportConfig, DummyTransport };
1
+ import type { PluginCollection } from "@webiny/plugins/types";
2
+ export * from "./plugins";
3
+ export * from "./transports";
7
4
  export declare const createMailerContext: () => PluginCollection;
8
5
  export declare const createMailerGraphQL: () => import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("./types").MailerContext>[];
package/index.js CHANGED
@@ -1,49 +1,54 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- Object.defineProperty(exports, "createDummyTransport", {
8
- enumerable: true,
9
- get: function () {
10
- return _createDummyTransport.createDummyTransport;
11
- }
12
- });
6
+ var _exportNames = {
7
+ createMailerContext: true,
8
+ createMailerGraphQL: true
9
+ };
13
10
  exports.createMailerGraphQL = exports.createMailerContext = void 0;
14
- Object.defineProperty(exports, "createSmtpTransport", {
15
- enumerable: true,
16
- get: function () {
17
- return _createSmtpTransport.createSmtpTransport;
18
- }
19
- });
20
- Object.defineProperty(exports, "createTransport", {
21
- enumerable: true,
22
- get: function () {
23
- return _plugins.createTransport;
24
- }
25
- });
26
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
27
11
  var _context = require("./context");
28
12
  var _createDummyTransport = require("./transports/createDummyTransport");
29
13
  var _createSmtpTransport = require("./transports/createSmtpTransport");
30
14
  var _plugins = require("./plugins");
15
+ Object.keys(_plugins).forEach(function (key) {
16
+ if (key === "default" || key === "__esModule") return;
17
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
18
+ if (key in exports && exports[key] === _plugins[key]) return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _plugins[key];
23
+ }
24
+ });
25
+ });
31
26
  var _model = require("./crud/settings/model");
32
- var _group = require("./crud/group");
33
27
  var _graphql = require("./graphql");
28
+ var _transports = require("./transports");
29
+ Object.keys(_transports).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _transports[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _transports[key];
37
+ }
38
+ });
39
+ });
34
40
  const createMailerContext = () => {
35
- const group = (0, _group.createGroup)();
36
- return [group,
41
+ return [
37
42
  /**
38
- * Groups and models to use via the CMS
43
+ * Models to use via the CMS
39
44
  */
40
- (0, _model.createSettingsModel)(group),
45
+ (0, _model.createSettingsModel)(),
41
46
  /**
42
47
  * If something is wrong with the smtp mailer, we will initialize the dummy one.
43
48
  */
44
49
  (0, _plugins.createTransport)(async () => {
45
50
  const plugin = await (0, _createDummyTransport.createDummyTransport)();
46
- plugin.name = "dummy-default";
51
+ plugin.name = "mailer.dummy-default";
47
52
  return plugin;
48
53
  }),
49
54
  /**
@@ -55,7 +60,9 @@ const createMailerContext = () => {
55
60
  /**
56
61
  * We need to map our settings to the required settings for the SMTP NodeMailer transport.
57
62
  */
58
- const config = (0, _objectSpread2.default)({}, settings || {});
63
+ const config = {
64
+ ...(settings || {})
65
+ };
59
66
  if (settings) {
60
67
  config.auth = {
61
68
  user: settings.user,
@@ -63,7 +70,7 @@ const createMailerContext = () => {
63
70
  };
64
71
  }
65
72
  const plugin = await (0, _createSmtpTransport.createSmtpTransport)(config);
66
- plugin.name = "smtp-default";
73
+ plugin.name = "mailer.smtp-default";
67
74
  return plugin;
68
75
  }), (0, _context.createMailerContext)()];
69
76
  };
@@ -71,4 +78,6 @@ exports.createMailerContext = createMailerContext;
71
78
  const createMailerGraphQL = () => {
72
79
  return [...(0, _graphql.createGraphQL)()];
73
80
  };
74
- exports.createMailerGraphQL = createMailerGraphQL;
81
+ exports.createMailerGraphQL = createMailerGraphQL;
82
+
83
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createMailerContext","group","createGroup","createSettingsModel","createTransport","plugin","createDummyTransport","name","settings","config","auth","user","pass","password","createSmtpTransport","createMailerContextPlugin","createMailerGraphQL","createGraphQL"],"sources":["index.ts"],"sourcesContent":["import { PluginCollection } from \"@webiny/plugins/types\";\nimport { createMailerContext as createMailerContextPlugin } from \"~/context\";\nimport { createDummyTransport, DummyTransport } from \"~/transports/createDummyTransport\";\nimport {\n createSmtpTransport,\n SmtpTransport,\n SmtpTransportConfig\n} from \"~/transports/createSmtpTransport\";\nimport { createTransport } from \"~/plugins\";\nimport { createSettingsModel } from \"~/crud/settings/model\";\nimport { createGroup } from \"~/crud/group\";\nimport { createGraphQL } from \"~/graphql\";\n\nexport { createDummyTransport, createSmtpTransport, createTransport };\nexport type { SmtpTransport, SmtpTransportConfig, DummyTransport };\n\nexport const createMailerContext = (): PluginCollection => {\n const group = createGroup();\n return [\n group,\n /**\n * Groups and models to use via the CMS\n */\n createSettingsModel(group),\n /**\n * If something is wrong with the smtp mailer, we will initialize the dummy one.\n */\n createTransport(async () => {\n const plugin = await createDummyTransport();\n plugin.name = \"dummy-default\";\n return plugin;\n }),\n /**\n * Smtp mailer goes into the plugins after the dummy one because plugins are loaded in reverse.\n */\n createTransport(async ({ settings }) => {\n /**\n * We need to map our settings to the required settings for the SMTP NodeMailer transport.\n */\n const config: SmtpTransportConfig = {\n ...(settings || {})\n };\n if (settings) {\n config.auth = {\n user: settings.user,\n pass: settings.password\n };\n }\n const plugin = await createSmtpTransport(config);\n plugin.name = \"smtp-default\";\n return plugin;\n }),\n createMailerContextPlugin()\n ];\n};\n\nexport const createMailerGraphQL = () => {\n return [...createGraphQL()];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKO,MAAMA,mBAAmB,GAAG,MAAwB;EACvD,MAAMC,KAAK,GAAG,IAAAC,kBAAW,GAAE;EAC3B,OAAO,CACHD,KAAK;EACL;AACR;AACA;EACQ,IAAAE,0BAAmB,EAACF,KAAK,CAAC;EAC1B;AACR;AACA;EACQ,IAAAG,wBAAe,EAAC,YAAY;IACxB,MAAMC,MAAM,GAAG,MAAM,IAAAC,0CAAoB,GAAE;IAC3CD,MAAM,CAACE,IAAI,GAAG,eAAe;IAC7B,OAAOF,MAAM;EACjB,CAAC,CAAC;EACF;AACR;AACA;EACQ,IAAAD,wBAAe,EAAC,OAAO;IAAEI;EAAS,CAAC,KAAK;IACpC;AACZ;AACA;IACY,MAAMC,MAA2B,mCACzBD,QAAQ,IAAI,CAAC,CAAC,CACrB;IACD,IAAIA,QAAQ,EAAE;MACVC,MAAM,CAACC,IAAI,GAAG;QACVC,IAAI,EAAEH,QAAQ,CAACG,IAAI;QACnBC,IAAI,EAAEJ,QAAQ,CAACK;MACnB,CAAC;IACL;IACA,MAAMR,MAAM,GAAG,MAAM,IAAAS,wCAAmB,EAACL,MAAM,CAAC;IAChDJ,MAAM,CAACE,IAAI,GAAG,cAAc;IAC5B,OAAOF,MAAM;EACjB,CAAC,CAAC,EACF,IAAAU,4BAAyB,GAAE,CAC9B;AACL,CAAC;AAAC;AAEK,MAAMC,mBAAmB,GAAG,MAAM;EACrC,OAAO,CAAC,GAAG,IAAAC,sBAAa,GAAE,CAAC;AAC/B,CAAC;AAAC"}
1
+ {"version":3,"names":["_context","require","_createDummyTransport","_createSmtpTransport","_plugins","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_model","_graphql","_transports","createMailerContext","createSettingsModel","createTransport","plugin","createDummyTransport","name","settings","config","auth","user","pass","password","createSmtpTransport","createMailerContextPlugin","createMailerGraphQL","createGraphQL"],"sources":["index.ts"],"sourcesContent":["import type { PluginCollection } from \"@webiny/plugins/types\";\nimport { createMailerContext as createMailerContextPlugin } from \"~/context\";\nimport { createDummyTransport } from \"~/transports/createDummyTransport\";\nimport type { SmtpTransportConfig } from \"~/transports/createSmtpTransport\";\nimport { createSmtpTransport } from \"~/transports/createSmtpTransport\";\nimport { createTransport } from \"~/plugins\";\nimport { createSettingsModel } from \"~/crud/settings/model\";\nimport { createGraphQL } from \"~/graphql\";\n\nexport * from \"~/plugins\";\nexport * from \"~/transports\";\n\nexport const createMailerContext = (): PluginCollection => {\n return [\n /**\n * Models to use via the CMS\n */\n createSettingsModel(),\n /**\n * If something is wrong with the smtp mailer, we will initialize the dummy one.\n */\n createTransport(async () => {\n const plugin = await createDummyTransport();\n plugin.name = \"mailer.dummy-default\";\n return plugin;\n }),\n /**\n * Smtp mailer goes into the plugins after the dummy one because plugins are loaded in reverse.\n */\n createTransport(async ({ settings }) => {\n /**\n * We need to map our settings to the required settings for the SMTP NodeMailer transport.\n */\n const config: SmtpTransportConfig = {\n ...(settings || {})\n };\n if (settings) {\n config.auth = {\n user: settings.user,\n pass: settings.password\n };\n }\n const plugin = await createSmtpTransport(config);\n plugin.name = \"mailer.smtp-default\";\n return plugin;\n }),\n createMailerContextPlugin()\n ];\n};\n\nexport const createMailerGraphQL =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,IAAAC,wBAAe,EAAC,YAAY;IACxB,MAAMC,MAAM,GAAG,MAAM,IAAAC,0CAAoB,EAAC,CAAC;IAC3CD,MAAM,CAACE,IAAI,GAAG,sBAAsB;IACpC,OAAOF,MAAM;EACjB,CAAC,CAAC;EACF;AACR;AACA;EACQ,IAAAD,wBAAe,EAAC,OAAO;IAAEI;EAAS,CAAC,KAAK;IACpC;AACZ;AACA;IACY,MAAMC,MAA2B,GAAG;MAChC,IAAID,QAAQ,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,IAAIA,QAAQ,EAAE;MACVC,MAAM,CAACC,IAAI,GAAG;QACVC,IAAI,EAAEH,QAAQ,CAACG,IAAI;QACnBC,IAAI,EAAEJ,QAAQ,CAACK;MACnB,CAAC;IACL;IACA,MAAMR,MAAM,GAAG,MAAM,IAAAS,wCAAmB,EAACL,MAAM,CAAC;IAChDJ,MAAM,CAACE,IAAI,GAAG,qBAAqB;IACnC,OAAOF,MAAM;EACjB,CAAC,CAAC,EACF,IAAAU,4BAAyB,EAAC,CAAC,CAC9B;AACL,CAAC;AAACpB,OAAA,CAAAO,mBAAA,GAAAA,mBAAA;AAEK,MAAMc,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO,CAAC,GAAG,IAAAC,sBAAa,EAAC,CAAC,CAAC;AAC/B,CAAC;AAACtB,OAAA,CAAAqB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-mailer",
3
- "version": "0.0.0-unstable.2af142b57e",
3
+ "version": "0.0.0-unstable.3bc8100a7f",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,52 +14,41 @@
14
14
  "description": "The API to send e-mails.",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "7.20.13",
18
- "@webiny/api": "0.0.0-unstable.2af142b57e",
19
- "@webiny/api-headless-cms": "0.0.0-unstable.2af142b57e",
20
- "@webiny/error": "0.0.0-unstable.2af142b57e",
21
- "@webiny/handler-graphql": "0.0.0-unstable.2af142b57e",
22
- "@webiny/plugins": "0.0.0-unstable.2af142b57e",
23
- "@webiny/pubsub": "0.0.0-unstable.2af142b57e",
24
- "crypto-js": "4.1.1",
17
+ "@webiny/api": "0.0.0-unstable.3bc8100a7f",
18
+ "@webiny/api-headless-cms": "0.0.0-unstable.3bc8100a7f",
19
+ "@webiny/error": "0.0.0-unstable.3bc8100a7f",
20
+ "@webiny/handler-graphql": "0.0.0-unstable.3bc8100a7f",
21
+ "@webiny/plugins": "0.0.0-unstable.3bc8100a7f",
22
+ "@webiny/pubsub": "0.0.0-unstable.3bc8100a7f",
23
+ "crypto-js": "4.2.0",
25
24
  "lodash": "4.17.21",
26
- "nodemailer": "6.9.1",
27
- "zod": "3.20.2"
25
+ "nodemailer": "6.9.16",
26
+ "zod": "3.23.8"
28
27
  },
29
28
  "devDependencies": {
30
- "@babel/cli": "^7.19.3",
31
- "@babel/core": "^7.19.3",
32
- "@babel/preset-env": "^7.19.4",
33
- "@babel/preset-typescript": "^7.18.6",
34
- "@types/crypto-js": "^4.1.1",
35
- "@types/nodemailer": "^6.4.4",
36
- "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.2af142b57e",
37
- "@webiny/api-i18n": "^0.0.0-unstable.2af142b57e",
38
- "@webiny/api-i18n-ddb": "^0.0.0-unstable.2af142b57e",
39
- "@webiny/api-security": "^0.0.0-unstable.2af142b57e",
40
- "@webiny/api-security-so-ddb": "^0.0.0-unstable.2af142b57e",
41
- "@webiny/api-tenancy": "^0.0.0-unstable.2af142b57e",
42
- "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.2af142b57e",
43
- "@webiny/cli": "^0.0.0-unstable.2af142b57e",
44
- "@webiny/db-dynamodb": "^0.0.0-unstable.2af142b57e",
45
- "@webiny/handler": "^0.0.0-unstable.2af142b57e",
46
- "@webiny/handler-aws": "^0.0.0-unstable.2af142b57e",
47
- "@webiny/handler-db": "^0.0.0-unstable.2af142b57e",
48
- "@webiny/project-utils": "^0.0.0-unstable.2af142b57e",
49
- "graphql": "^15.7.2",
50
- "jest": "^28.1.0",
51
- "jest-dynalite": "^3.6.1",
52
- "rimraf": "^3.0.2",
53
- "ttypescript": "^1.5.12",
54
- "typescript": "4.7.4"
29
+ "@types/crypto-js": "4.2.2",
30
+ "@types/nodemailer": "6.4.17",
31
+ "@webiny/api-i18n": "0.0.0-unstable.3bc8100a7f",
32
+ "@webiny/api-security": "0.0.0-unstable.3bc8100a7f",
33
+ "@webiny/api-tenancy": "0.0.0-unstable.3bc8100a7f",
34
+ "@webiny/db-dynamodb": "0.0.0-unstable.3bc8100a7f",
35
+ "@webiny/handler": "0.0.0-unstable.3bc8100a7f",
36
+ "@webiny/handler-aws": "0.0.0-unstable.3bc8100a7f",
37
+ "@webiny/handler-db": "0.0.0-unstable.3bc8100a7f",
38
+ "@webiny/project-utils": "0.0.0-unstable.3bc8100a7f",
39
+ "graphql": "15.9.0",
40
+ "jest": "29.7.0",
41
+ "jest-dynalite": "3.6.1",
42
+ "rimraf": "6.0.1",
43
+ "typescript": "5.3.3"
55
44
  },
56
45
  "publishConfig": {
57
46
  "access": "public",
58
47
  "directory": "dist"
59
48
  },
60
49
  "scripts": {
61
- "build": "yarn webiny run build",
62
- "watch": "yarn webiny run watch"
50
+ "build": "node ../cli/bin.js run build",
51
+ "watch": "node ../cli/bin.js run watch"
63
52
  },
64
- "gitHead": "2af142b57e7cdc433f5098b3b6d43ae6caa5d54e"
53
+ "gitHead": "3bc8100a7f1fb3a8d6a3454a2765f8ef377c279e"
65
54
  }
@@ -1,5 +1,5 @@
1
1
  import { Plugin as BasePlugin } from "@webiny/plugins";
2
- import { Transport, MailerContext, TransportSettings } from "../types";
2
+ import type { Transport, MailerContext, TransportSettings } from "../types";
3
3
  interface TransportParams {
4
4
  settings: TransportSettings | null;
5
5
  context: MailerContext;
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createTransport = exports.CreateTransportPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _plugins = require("@webiny/plugins");
10
8
  class CreateTransportPlugin extends _plugins.Plugin {
9
+ static type = "mailer.builder.plugin";
11
10
  constructor(cb) {
12
11
  super();
13
- (0, _defineProperty2.default)(this, "cb", void 0);
14
12
  this.cb = cb;
15
13
  }
16
14
  async buildMailerTransport(params) {
@@ -18,8 +16,9 @@ class CreateTransportPlugin extends _plugins.Plugin {
18
16
  }
19
17
  }
20
18
  exports.CreateTransportPlugin = CreateTransportPlugin;
21
- (0, _defineProperty2.default)(CreateTransportPlugin, "type", "mailer.builder.plugin");
22
19
  const createTransport = cb => {
23
20
  return new CreateTransportPlugin(cb);
24
21
  };
25
- exports.createTransport = createTransport;
22
+ exports.createTransport = createTransport;
23
+
24
+ //# sourceMappingURL=CreateTransportPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CreateTransportPlugin","BasePlugin","constructor","cb","buildMailerTransport","params","createTransport"],"sources":["CreateTransportPlugin.ts"],"sourcesContent":["import { Plugin as BasePlugin } from \"@webiny/plugins\";\nimport { Transport, MailerContext, TransportSettings } from \"~/types\";\n\ninterface TransportParams {\n settings: TransportSettings | null;\n context: MailerContext;\n}\n\nexport interface CreateTransportCallable<T> {\n (params: TransportParams): Promise<T>;\n}\n\nexport class CreateTransportPlugin<T extends Transport = Transport> extends BasePlugin {\n public static override type = \"mailer.builder.plugin\";\n\n private readonly cb: CreateTransportCallable<T>;\n\n public constructor(cb: CreateTransportCallable<T>) {\n super();\n this.cb = cb;\n }\n\n public async buildMailerTransport(params: TransportParams): Promise<T> {\n return this.cb(params);\n }\n}\n\nexport const createTransport = <T extends Transport = Transport>(\n cb: CreateTransportCallable<T>\n) => {\n return new CreateTransportPlugin<T>(cb);\n};\n"],"mappings":";;;;;;;;AAAA;AAYO,MAAMA,qBAAqB,SAA0CC,eAAU,CAAC;EAK5EC,WAAW,CAACC,EAA8B,EAAE;IAC/C,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,oBAAoB,CAACC,MAAuB,EAAc;IACnE,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAAC;AAAA,8BAbYL,qBAAqB,UACA,uBAAuB;AAclD,MAAMM,eAAe,GACxBH,EAA8B,IAC7B;EACD,OAAO,IAAIH,qBAAqB,CAAIG,EAAE,CAAC;AAC3C,CAAC;AAAC"}
1
+ {"version":3,"names":["_plugins","require","CreateTransportPlugin","BasePlugin","type","constructor","cb","buildMailerTransport","params","exports","createTransport"],"sources":["CreateTransportPlugin.ts"],"sourcesContent":["import { Plugin as BasePlugin } from \"@webiny/plugins\";\nimport type { Transport, MailerContext, TransportSettings } from \"~/types\";\n\ninterface TransportParams {\n settings: TransportSettings | null;\n context: MailerContext;\n}\n\nexport interface CreateTransportCallable<T> {\n (params: TransportParams): Promise<T>;\n}\n\nexport class CreateTransportPlugin<T extends Transport = Transport> extends BasePlugin {\n public static override type = \"mailer.builder.plugin\";\n\n private readonly cb: CreateTransportCallable<T>;\n\n public constructor(cb: CreateTransportCallable<T>) {\n super();\n this.cb = cb;\n }\n\n public async buildMailerTransport(params: TransportParams): Promise<T> {\n return this.cb(params);\n }\n}\n\nexport const createTransport = <T extends Transport = Transport>(\n cb: CreateTransportCallable<T>\n) => {\n return new CreateTransportPlugin<T>(cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAYO,MAAMC,qBAAqB,SAA0CC,eAAU,CAAC;EACnF,OAAuBC,IAAI,GAAG,uBAAuB;EAI9CC,WAAWA,CAACC,EAA8B,EAAE;IAC/C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,oBAAoBA,CAACC,MAAuB,EAAc;IACnE,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAP,qBAAA,GAAAA,qBAAA;AAEM,MAAMQ,eAAe,GACxBJ,EAA8B,IAC7B;EACD,OAAO,IAAIJ,qBAAqB,CAAII,EAAE,CAAC;AAC3C,CAAC;AAACG,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
package/plugins/index.js CHANGED
@@ -13,4 +13,6 @@ Object.keys(_CreateTransportPlugin).forEach(function (key) {
13
13
  return _CreateTransportPlugin[key];
14
14
  }
15
15
  });
16
- });
16
+ });
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CreateTransportPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_CreateTransportPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./CreateTransportPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,sBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,sBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,sBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { Transport, TransportSendData } from "../types";
1
+ import type { Transport, TransportSendData } from "../types";
2
2
  export interface DummyTransport extends Transport {
3
3
  getAllSent: () => TransportSendData[];
4
4
  }
@@ -7,7 +7,7 @@ exports.createDummyTransport = void 0;
7
7
  const createDummyTransport = () => {
8
8
  const sent = [];
9
9
  return {
10
- name: "dummy-default",
10
+ name: "mailer.dummy-default",
11
11
  send: async params => {
12
12
  sent.push(params);
13
13
  return {
@@ -20,4 +20,6 @@ const createDummyTransport = () => {
20
20
  }
21
21
  };
22
22
  };
23
- exports.createDummyTransport = createDummyTransport;
23
+ exports.createDummyTransport = createDummyTransport;
24
+
25
+ //# sourceMappingURL=createDummyTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createDummyTransport","sent","name","send","params","push","result","error","getAllSent"],"sources":["createDummyTransport.ts"],"sourcesContent":["import { Transport, TransportSendData } from \"~/types\";\n\nexport interface DummyTransport extends Transport {\n getAllSent: () => TransportSendData[];\n}\nexport const createDummyTransport = (): DummyTransport => {\n const sent: TransportSendData[] = [];\n\n return {\n name: \"dummy-default\",\n send: async params => {\n sent.push(params);\n return {\n result: true,\n error: null\n };\n },\n getAllSent: () => {\n return sent;\n }\n };\n};\n"],"mappings":";;;;;;AAKO,MAAMA,oBAAoB,GAAG,MAAsB;EACtD,MAAMC,IAAyB,GAAG,EAAE;EAEpC,OAAO;IACHC,IAAI,EAAE,eAAe;IACrBC,IAAI,EAAE,MAAMC,MAAM,IAAI;MAClBH,IAAI,CAACI,IAAI,CAACD,MAAM,CAAC;MACjB,OAAO;QACHE,MAAM,EAAE,IAAI;QACZC,KAAK,EAAE;MACX,CAAC;IACL,CAAC;IACDC,UAAU,EAAE,MAAM;MACd,OAAOP,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createDummyTransport","sent","name","send","params","push","result","error","getAllSent","exports"],"sources":["createDummyTransport.ts"],"sourcesContent":["import type { Transport, TransportSendData } from \"~/types\";\n\nexport interface DummyTransport extends Transport {\n getAllSent: () => TransportSendData[];\n}\nexport const createDummyTransport = (): DummyTransport => {\n const sent: TransportSendData[] = [];\n\n return {\n name: \"mailer.dummy-default\",\n send: async params => {\n sent.push(params);\n return {\n result: true,\n error: null\n };\n },\n getAllSent: () => {\n return sent;\n }\n };\n};\n"],"mappings":";;;;;;AAKO,MAAMA,oBAAoB,GAAGA,CAAA,KAAsB;EACtD,MAAMC,IAAyB,GAAG,EAAE;EAEpC,OAAO;IACHC,IAAI,EAAE,sBAAsB;IAC5BC,IAAI,EAAE,MAAMC,MAAM,IAAI;MAClBH,IAAI,CAACI,IAAI,CAACD,MAAM,CAAC;MACjB,OAAO;QACHE,MAAM,EAAE,IAAI;QACZC,KAAK,EAAE;MACX,CAAC;IACL,CAAC;IACDC,UAAU,EAAEA,CAAA,KAAM;MACd,OAAOP,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACQ,OAAA,CAAAT,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -2,10 +2,11 @@
2
2
  * Nodemailer docs
3
3
  * https://nodemailer.com/about/
4
4
  */
5
- import { Transport } from "../types";
6
- import { Transporter } from "nodemailer";
7
- import SMTPTransport, { Options } from "nodemailer/lib/smtp-transport";
8
- export declare type SmtpTransportConfig = Options;
5
+ import type { Transport } from "../types";
6
+ import type { Transporter } from "nodemailer";
7
+ import type { Options } from "nodemailer/lib/smtp-transport";
8
+ import type SMTPTransport from "nodemailer/lib/smtp-transport";
9
+ export type SmtpTransportConfig = Options;
9
10
  export interface SmtpTransport extends Transport {
10
11
  transporter: Transporter<SMTPTransport.SentMessageInfo>;
11
12
  }
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createSmtpTransport = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
8
  var _error = _interopRequireDefault(require("@webiny/error"));
10
9
  var _nodemailer = _interopRequireDefault(require("nodemailer"));
11
10
  /**
@@ -22,11 +21,13 @@ const applyDefaults = initialConfig => {
22
21
  return Object.keys(configDefaults).reduce((config, key) => {
23
22
  const configKey = key;
24
23
  if (config[configKey] === undefined || config[configKey] === null) {
25
- // @ts-ignore
24
+ // @ts-expect-error
26
25
  config[configKey] = configDefaults[configKey];
27
26
  }
28
27
  return config;
29
- }, (0, _objectSpread2.default)({}, initialConfig));
28
+ }, {
29
+ ...initialConfig
30
+ });
30
31
  };
31
32
  const createSmtpTransport = initialConfig => {
32
33
  if (!initialConfig || typeof initialConfig !== "object" || Object.keys(initialConfig).length === 0) {
@@ -68,7 +69,9 @@ const createSmtpTransport = initialConfig => {
68
69
  throw new _error.default({
69
70
  message: "nodemailer.sendMail does not have a messageId in the result. Something went wrong...",
70
71
  code: "MAILER_ERROR",
71
- data: (0, _objectSpread2.default)({}, result)
72
+ data: {
73
+ ...result
74
+ }
72
75
  });
73
76
  } catch (ex) {
74
77
  return {
@@ -76,11 +79,16 @@ const createSmtpTransport = initialConfig => {
76
79
  error: {
77
80
  message: ex.message,
78
81
  code: ex.code,
79
- data: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), ex.data)
82
+ data: {
83
+ ...params,
84
+ ...ex.data
85
+ }
80
86
  }
81
87
  };
82
88
  }
83
89
  }
84
90
  };
85
91
  };
86
- exports.createSmtpTransport = createSmtpTransport;
92
+ exports.createSmtpTransport = createSmtpTransport;
93
+
94
+ //# sourceMappingURL=createSmtpTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["configDefaults","socketTimeout","connectionTimeout","greetingTimeout","applyDefaults","initialConfig","Object","keys","reduce","config","key","configKey","undefined","createSmtpTransport","length","WebinyError","transporter","nodemailer","createTransport","name","send","params","replyTo","text","html","to","bcc","cc","from","subject","result","sendMail","messageId","response","error","message","code","data","ex"],"sources":["createSmtpTransport.ts"],"sourcesContent":["/**\n * Nodemailer docs\n * https://nodemailer.com/about/\n */\nimport { Transport } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport nodemailer, { Transporter } from \"nodemailer\";\nimport SMTPTransport, { Options } from \"nodemailer/lib/smtp-transport\";\n\nexport type SmtpTransportConfig = Options;\n\nexport interface SmtpTransport extends Transport {\n transporter: Transporter<SMTPTransport.SentMessageInfo>;\n}\n\nconst configDefaults: Partial<SmtpTransportConfig> = {\n socketTimeout: 15000,\n connectionTimeout: 15000,\n greetingTimeout: 15000\n};\n\nconst applyDefaults = (\n initialConfig: Partial<SmtpTransportConfig>\n): Partial<SmtpTransportConfig> => {\n return Object.keys(configDefaults).reduce<Partial<SmtpTransportConfig>>(\n (config, key) => {\n const configKey = key as unknown as keyof SmtpTransportConfig;\n if (config[configKey] === undefined || config[configKey] === null) {\n // @ts-ignore\n config[configKey] = configDefaults[configKey];\n }\n\n return config;\n },\n { ...initialConfig }\n );\n};\n\nexport const createSmtpTransport = (\n initialConfig?: Partial<SmtpTransportConfig> | null\n): SmtpTransport => {\n if (\n !initialConfig ||\n typeof initialConfig !== \"object\" ||\n Object.keys(initialConfig).length === 0\n ) {\n throw new WebinyError(\"There is no configuration for the SMTP transport.\");\n }\n\n const config = applyDefaults(initialConfig);\n\n const transporter = nodemailer.createTransport(config);\n\n return {\n name: \"smtp-default\",\n transporter,\n send: async params => {\n const { replyTo, text, html, to, bcc, cc, from, subject } = params;\n\n try {\n const result = await transporter.sendMail({\n replyTo,\n bcc,\n cc,\n from,\n text,\n html,\n to,\n subject\n });\n if (result.messageId) {\n return {\n result: result.response,\n error: null\n };\n }\n\n throw new WebinyError({\n message:\n \"nodemailer.sendMail does not have a messageId in the result. Something went wrong...\",\n code: \"MAILER_ERROR\",\n data: {\n ...result\n }\n });\n } catch (ex) {\n return {\n result: null,\n error: {\n message: ex.message,\n code: ex.code,\n data: {\n ...params,\n ...ex.data\n }\n }\n };\n }\n }\n };\n};\n"],"mappings":";;;;;;;;AAKA;AACA;AANA;AACA;AACA;AACA;;AAYA,MAAMA,cAA4C,GAAG;EACjDC,aAAa,EAAE,KAAK;EACpBC,iBAAiB,EAAE,KAAK;EACxBC,eAAe,EAAE;AACrB,CAAC;AAED,MAAMC,aA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AAK,EAAE;UACX,CAAC;QACL;QAEA,MAAM,IAAInB,cAAW,CAAC;UAClBoB,OAAO,EACH,sFAAsF;UAC1FC,IAAI,EAAE,cAAc;UACpBC,IAAI,kCACGP,MAAM;QAEjB,CAAC,CAAC;MACN,CAAC,CAAC,OAAOQ,EAAE,EAAE;QACT,OAAO;UACHR,MAAM,EAAE,IAAI;UACZI,KAAK,EAAE;YACHC,OAAO,EAAEG,EAAE,CAACH,OAAO;YACnBC,IAAI,EAAEE,EAAE,CAACF,IAAI;YACbC,IAAI,8DACGhB,MAAM,GACNiB,EAAE,CAACD,IAAI;UAElB;QACJ,CAAC;MACL;IACJ;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_nodemailer","configDefaults","socketTimeout","connectionTimeout","greetingTimeout","applyDefaults","initialConfig","Object","keys","reduce","config","key","configKey","undefined","createSmtpTransport","length","WebinyError","transporter","nodemailer","createTransport","name","send","params","replyTo","text","html","to","bcc","cc","from","subject","result","sendMail","messageId","response","error","message","code","data","ex","exports"],"sources":["createSmtpTransport.ts"],"sourcesContent":["/**\n * Nodemailer docs\n * https://nodemailer.com/about/\n */\nimport type { Transport } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport type { Transporter } from \"nodemailer\";\nimport nodemailer from \"nodemailer\";\nimport type { Options } from \"nodemailer/lib/smtp-transport\";\nimport type SMTPTransport from \"nodemailer/lib/smtp-transport\";\n\nexport type SmtpTransportConfig = Options;\n\nexport interface SmtpTransport extends Transport {\n transporter: Transporter<SMTPTransport.SentMessageInfo>;\n}\n\nconst configDefaults: Partial<SmtpTransportConfig> = {\n socketTimeout: 15000,\n connectionTimeout: 15000,\n greetingTimeout: 15000\n};\n\nconst applyDefaults = (\n initialConfig: Partial<SmtpTransportConfig>\n): Partial<SmtpTransportConfig> => {\n return Object.keys(configDefaults).reduce<Partial<SmtpTransportConfig>>(\n (config, key) => {\n const configKey = key as unknown as keyof SmtpTransportConfig;\n if (config[configKey] === undefined || config[configKey] === null) {\n // @ts-expect-error\n config[configKey] = configDefaults[configKey];\n }\n\n return config;\n },\n { ...initialConfig }\n );\n};\n\nexport const createSmtpTransport = (\n initialConfig?: Partial<SmtpTransportConfig> | null\n): SmtpTransport => {\n if (\n !initialConfig ||\n typeof initialConfig !== \"object\" ||\n Object.keys(initialConfig).length === 0\n ) {\n throw new WebinyError(\"There is no configuration for the SMTP transport.\");\n }\n\n const config = applyDefaults(initialConfig);\n\n const transporter = nodemailer.createTransport(config);\n\n return {\n name: \"smtp-default\",\n transporter,\n send: async params => {\n const { replyTo, text, html, to, bcc, cc, from, subject } = params;\n\n try {\n const result = await transporter.sendMail({\n replyTo,\n bcc,\n cc,\n from,\n text,\n html,\n to,\n subject\n });\n if (result.messageId) {\n return {\n result: result.response,\n error: null\n };\n }\n\n throw new WebinyError({\n message:\n \"nodemailer.sendMail does not have a messageId in the result. Something went wrong...\",\n code: \"MAILER_ERROR\",\n data: {\n ...result\n }\n });\n } catch (ex) {\n return {\n result: null,\n error: {\n message: ex.message,\n code: ex.code,\n data: {\n ...params,\n ...ex.data\n }\n }\n };\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAKA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAPA;AACA;AACA;AACA;;AAcA,MAAME,cAA4C,GAAG;EACjDC,aAAa,EAAE,KAAK;EACpBC,iBAAiB,EAAE,KAAK;EACxBC,eAAe,EAAE;AACrB,CAAC;AAED,MAAMC,aAAa,GACfC,aAA2C,IACZ;EAC/B,OAAOC,MAAM,CAACC,IAAI,CAACP,cAAc,CAAC,CAACQ,MAAM,CACrC,CAACC,MAAM,EAAEC,GAAG,KAAK;IACb,MAAMC,SAAS,GAAGD,GAA2C;IAC7D,IAAID,MAAM,CAACE,SAAS,CAAC,KAAKC,SAAS,IAAIH,MAAM,CAACE,SAAS,CAAC,KAAK,IAAI,EAAE;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ACZI,KAAK,EAAE;YACHC,OAAO,EAAEG,EAAE,CAACH,OAAO;YACnBC,IAAI,EAAEE,EAAE,CAACF,IAAI;YACbC,IAAI,EAAE;cACF,GAAGhB,MAAM;cACT,GAAGiB,EAAE,CAACD;YACV;UACJ;QACJ,CAAC;MACL;IACJ;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./createDummyTransport";
2
+ export * from "./createSmtpTransport";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _createDummyTransport = require("./createDummyTransport");
7
+ Object.keys(_createDummyTransport).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _createDummyTransport[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _createDummyTransport[key];
14
+ }
15
+ });
16
+ });
17
+ var _createSmtpTransport = require("./createSmtpTransport");
18
+ Object.keys(_createSmtpTransport).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _createSmtpTransport[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _createSmtpTransport[key];
25
+ }
26
+ });
27
+ });
28
+
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_createDummyTransport","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_createSmtpTransport"],"sources":["index.ts"],"sourcesContent":["export * from \"./createDummyTransport\";\nexport * from \"./createSmtpTransport\";\n"],"mappings":";;;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,qBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,qBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,qBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,oBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,oBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { CmsContext } from "@webiny/api-headless-cms/types";
2
- import { Topic } from "@webiny/pubsub/types";
1
+ import type { CmsContext } from "@webiny/api-headless-cms/types";
2
+ import type { Topic } from "@webiny/pubsub/types";
3
3
  export interface MailerTransporterContext<T extends Transport = Transport> {
4
4
  onTransportBeforeSend: Topic<OnTransportBeforeSendParams>;
5
5
  onTransportAfterSend: Topic<OnTransportAfterSendParams>;
@@ -129,11 +129,11 @@ interface BaseTransportSendData {
129
129
  bcc?: string[];
130
130
  from?: string;
131
131
  subject: string;
132
- text: string;
132
+ text?: string;
133
133
  html?: string;
134
134
  replyTo?: string;
135
135
  }
136
- export declare type TransportSendData = BaseTransportSendData & (TransportSendToData | TransportSendBccData | TransportSendCcData);
136
+ export type TransportSendData = BaseTransportSendData & (TransportSendToData | TransportSendBccData | TransportSendCcData);
137
137
  export interface Transport<T = any> {
138
138
  name: string;
139
139
  send: (params: TransportSendData) => Promise<TransportSendResponse<T>>;
package/types.js CHANGED
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\n\nexport interface MailerTransporterContext<T extends Transport = Transport> {\n onTransportBeforeSend: Topic<OnTransportBeforeSendParams>;\n onTransportAfterSend: Topic<OnTransportAfterSendParams>;\n onTransportError: Topic<OnTransportErrorParams>;\n getTransport: () => Promise<T | null>;\n sendMail: <D>(data: TransportSendData) => Promise<TransportSendResponse<D>>;\n}\n\nexport interface MailerSettingsCreateParams {\n input: Partial<TransportSettings>;\n}\nexport interface MailerSettingsUpdateParams {\n input: Partial<TransportSettings>;\n original?: ExtendedTransportSettings | null;\n}\n\nexport interface MailerSettingsSaveParams {\n input: Partial<TransportSettings>;\n}\n\nexport interface OnSettingsBeforeGetTopicParams {\n tenant: string;\n}\n\nexport interface OnSettingsAfterGetTopicParams {\n tenant: string;\n settings: TransportSettings | null;\n}\n\nexport interface OnSettingsGetErrorTopicParams {\n tenant: string;\n error: Error;\n}\n\nexport interface OnSettingsBeforeCreateTopicParams {\n settings: TransportSettings;\n}\n\nexport interface OnSettingsAfterCreateTopicParams {\n settings: TransportSettings;\n}\n\nexport interface OnSettingsCreateErrorTopicParams {\n settings: TransportSettings;\n error: Error;\n}\n\nexport interface OnSettingsBeforeUpdateTopicParams {\n settings: TransportSettings;\n original: TransportSettings;\n}\n\nexport interface OnSettingsAfterUpdateTopicParams {\n original: TransportSettings;\n settings: TransportSettings;\n}\n\nexport interface OnSettingsUpdateErrorTopicParams {\n original: TransportSettings;\n settings: TransportSettings;\n error: Error;\n}\n\nexport interface ExtendedTransportSettings extends TransportSettings {\n id: string;\n}\n\nexport interface MailerSettingsContext {\n getSettings: () => Promise<ExtendedTransportSettings | null>;\n /**\n * Method should not be used outside of mailer\n * @internal\n */\n createSettings: (params: MailerSettingsCreateParams) => Promise<TransportSettings>;\n /**\n * Method should not be used outside of mailer\n * @internal\n */\n updateSettings: (params: MailerSettingsUpdateParams) => Promise<TransportSettings>;\n /**\n * Use to store the settings data.\n */\n saveSettings: (params: MailerSettingsSaveParams) => Promise<TransportSettings>;\n /**\n * Lifecycle events\n */\n onSettingsBeforeGet: Topic<OnSettingsBeforeGetTopicParams>;\n onSettingsAfterGet: Topic<OnSettingsAfterGetTopicParams>;\n onSettingsGetError: Topic<OnSettingsGetErrorTopicParams>;\n onSettingsBeforeCreate: Topic<OnSettingsBeforeCreateTopicParams>;\n onSettingsAfterCreate: Topic<OnSettingsAfterCreateTopicParams>;\n onSettingsCreateError: Topic<OnSettingsCreateErrorTopicParams>;\n onSettingsBeforeUpdate: Topic<OnSettingsBeforeUpdateTopicParams>;\n onSettingsAfterUpdate: Topic<OnSettingsAfterUpdateTopicParams>;\n onSettingsUpdateError: Topic<OnSettingsUpdateErrorTopicParams>;\n}\n\nexport interface MailerContextObject<T extends Transport = Transport>\n extends MailerTransporterContext<T>,\n MailerSettingsContext {}\nexport interface MailerContext extends CmsContext {\n mailer: MailerContextObject;\n}\n\nexport interface OnTransportBeforeSendParams {\n data: TransportSendData;\n transport: Transport;\n}\nexport interface OnTransportAfterSendParams {\n data: TransportSendData;\n transport: Transport;\n}\nexport interface OnTransportErrorParams {\n error: Error;\n data: TransportSendData;\n transport: Transport;\n}\n\n/**\n * Interface to implement the actual mailer.\n */\nexport interface TransportSendResponse<T = any> {\n result: T | null;\n error: {\n message: string;\n code: string;\n data?: {\n [key: string]: any;\n };\n } | null;\n}\n\ninterface TransportSendToData {\n to: string[];\n}\ninterface TransportSendCcData {\n cc: string[];\n}\ninterface TransportSendBccData {\n bcc: string[];\n}\n\ninterface BaseTransportSendData {\n to?: string[];\n cc?: string[];\n bcc?: string[];\n from?: string;\n subject: string;\n text: string;\n html?: string;\n replyTo?: string;\n}\n\nexport type TransportSendData = BaseTransportSendData &\n (TransportSendToData | TransportSendBccData | TransportSendCcData);\nexport interface Transport<T = any> {\n name: string;\n send: (params: TransportSendData) => Promise<TransportSendResponse<T>>;\n}\n\nexport interface TransportSettings {\n host: string;\n port: number;\n user: string;\n password: string;\n from: string;\n replyTo?: string;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\n\nexport interface MailerTransporterContext<T extends Transport = Transport> {\n onTransportBeforeSend: Topic<OnTransportBeforeSendParams>;\n onTransportAfterSend: Topic<OnTransportAfterSendParams>;\n onTransportError: Topic<OnTransportErrorParams>;\n getTransport: () => Promise<T | null>;\n sendMail: <D>(data: TransportSendData) => Promise<TransportSendResponse<D>>;\n}\n\nexport interface MailerSettingsCreateParams {\n input: Partial<TransportSettings>;\n}\nexport interface MailerSettingsUpdateParams {\n input: Partial<TransportSettings>;\n original?: ExtendedTransportSettings | null;\n}\n\nexport interface MailerSettingsSaveParams {\n input: Partial<TransportSettings>;\n}\n\nexport interface OnSettingsBeforeGetTopicParams {\n tenant: string;\n}\n\nexport interface OnSettingsAfterGetTopicParams {\n tenant: string;\n settings: TransportSettings | null;\n}\n\nexport interface OnSettingsGetErrorTopicParams {\n tenant: string;\n error: Error;\n}\n\nexport interface OnSettingsBeforeCreateTopicParams {\n settings: TransportSettings;\n}\n\nexport interface OnSettingsAfterCreateTopicParams {\n settings: TransportSettings;\n}\n\nexport interface OnSettingsCreateErrorTopicParams {\n settings: TransportSettings;\n error: Error;\n}\n\nexport interface OnSettingsBeforeUpdateTopicParams {\n settings: TransportSettings;\n original: TransportSettings;\n}\n\nexport interface OnSettingsAfterUpdateTopicParams {\n original: TransportSettings;\n settings: TransportSettings;\n}\n\nexport interface OnSettingsUpdateErrorTopicParams {\n original: TransportSettings;\n settings: TransportSettings;\n error: Error;\n}\n\nexport interface ExtendedTransportSettings extends TransportSettings {\n id: string;\n}\n\nexport interface MailerSettingsContext {\n getSettings: () => Promise<ExtendedTransportSettings | null>;\n /**\n * Method should not be used outside of mailer\n * @internal\n */\n createSettings: (params: MailerSettingsCreateParams) => Promise<TransportSettings>;\n /**\n * Method should not be used outside of mailer\n * @internal\n */\n updateSettings: (params: MailerSettingsUpdateParams) => Promise<TransportSettings>;\n /**\n * Use to store the settings data.\n */\n saveSettings: (params: MailerSettingsSaveParams) => Promise<TransportSettings>;\n /**\n * Lifecycle events\n */\n onSettingsBeforeGet: Topic<OnSettingsBeforeGetTopicParams>;\n onSettingsAfterGet: Topic<OnSettingsAfterGetTopicParams>;\n onSettingsGetError: Topic<OnSettingsGetErrorTopicParams>;\n onSettingsBeforeCreate: Topic<OnSettingsBeforeCreateTopicParams>;\n onSettingsAfterCreate: Topic<OnSettingsAfterCreateTopicParams>;\n onSettingsCreateError: Topic<OnSettingsCreateErrorTopicParams>;\n onSettingsBeforeUpdate: Topic<OnSettingsBeforeUpdateTopicParams>;\n onSettingsAfterUpdate: Topic<OnSettingsAfterUpdateTopicParams>;\n onSettingsUpdateError: Topic<OnSettingsUpdateErrorTopicParams>;\n}\n\nexport interface MailerContextObject<T extends Transport = Transport>\n extends MailerTransporterContext<T>,\n MailerSettingsContext {}\nexport interface MailerContext extends CmsContext {\n mailer: MailerContextObject;\n}\n\nexport interface OnTransportBeforeSendParams {\n data: TransportSendData;\n transport: Transport;\n}\nexport interface OnTransportAfterSendParams {\n data: TransportSendData;\n transport: Transport;\n}\nexport interface OnTransportErrorParams {\n error: Error;\n data: TransportSendData;\n transport: Transport;\n}\n\n/**\n * Interface to implement the actual mailer.\n */\nexport interface TransportSendResponse<T = any> {\n result: T | null;\n error: {\n message: string;\n code: string;\n data?: {\n [key: string]: any;\n };\n } | null;\n}\n\ninterface TransportSendToData {\n to: string[];\n}\ninterface TransportSendCcData {\n cc: string[];\n}\ninterface TransportSendBccData {\n bcc: string[];\n}\n\ninterface BaseTransportSendData {\n to?: string[];\n cc?: string[];\n bcc?: string[];\n from?: string;\n subject: string;\n text?: string;\n html?: string;\n replyTo?: string;\n}\n\nexport type TransportSendData = BaseTransportSendData &\n (TransportSendToData | TransportSendBccData | TransportSendCcData);\nexport interface Transport<T = any> {\n name: string;\n send: (params: TransportSendData) => Promise<TransportSendResponse<T>>;\n}\n\nexport interface TransportSettings {\n host: string;\n port: number;\n user: string;\n password: string;\n from: string;\n replyTo?: string;\n}\n"],"mappings":"","ignoreList":[]}
package/crud/group.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { CmsGroupPlugin } from "@webiny/api-headless-cms";
2
- export declare const createGroup: () => CmsGroupPlugin;
package/crud/group.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createGroup = void 0;
7
- var _apiHeadlessCms = require("@webiny/api-headless-cms");
8
- const createGroup = () => {
9
- return (0, _apiHeadlessCms.createCmsGroup)({
10
- name: "Mailer Group",
11
- description: "Mailer Group for CMS",
12
- id: "mailerGroup",
13
- slug: "mailerGroup",
14
- icon: "none",
15
- isPrivate: true
16
- });
17
- };
18
- exports.createGroup = createGroup;
package/crud/group.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["createGroup","createCmsGroup","name","description","id","slug","icon","isPrivate"],"sources":["group.ts"],"sourcesContent":["import { CmsGroupPlugin, createCmsGroup } from \"@webiny/api-headless-cms\";\n\nexport const createGroup = (): CmsGroupPlugin => {\n return createCmsGroup({\n name: \"Mailer Group\",\n description: \"Mailer Group for CMS\",\n id: \"mailerGroup\",\n slug: \"mailerGroup\",\n icon: \"none\",\n isPrivate: true\n });\n};\n"],"mappings":";;;;;;AAAA;AAEO,MAAMA,WAAW,GAAG,MAAsB;EAC7C,OAAO,IAAAC,8BAAc,EAAC;IAClBC,IAAI,EAAE,cAAc;IACpBC,WAAW,EAAE,sBAAsB;IACnCC,EAAE,EAAE,aAAa;IACjBC,IAAI,EAAE,aAAa;IACnBC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAAC"}