@proteinjs/email-server 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.1.0](https://github.com/proteinjs/notifications/compare/@proteinjs/email-server@1.0.5...@proteinjs/email-server@1.1.0) (2024-08-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * email config files for sign up and invite ([#1](https://github.com/proteinjs/notifications/issues/1)) ([e2787d0](https://github.com/proteinjs/notifications/commit/e2787d08e21fd3642666a79065df81cf74dcef60))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.0.5](https://github.com/proteinjs/notifications/compare/@proteinjs/email-server@1.0.4...@proteinjs/email-server@1.0.5) (2024-08-02)
7
18
 
8
19
  **Note:** Version bump only for package @proteinjs/email-server
@@ -19,7 +19,7 @@ require("@proteinjs/reflection");
19
19
  require("@proteinjs/util");
20
20
  require("nodemailer");
21
21
  /** Generate Source Graph */
22
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordResetEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailConfigs.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordResetEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordResetEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailSender.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getEmailConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"EmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/EmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}}],\"edges\":[{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
22
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailSender.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getEmailConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"EmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/EmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultInviteEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/InviteEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"InviteEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/InviteEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordResetEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/PasswordResetEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordResetEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordResetEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultSignupConfirmationEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/SignupConfirmationEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"SignupConfirmationEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/SignupConfirmationEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}}],\"edges\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
23
23
  /** Generate Source Links */
24
24
  var sourceLinks = {};
25
25
  /** Load Source Graph and Links */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,iCAA+B;AAC/B,2BAAyB;AACzB,sBAAoB;AAGpB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,k7EAAk7E,CAAC;AAGv8E,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,iCAA+B;AAC/B,2BAAyB;AACzB,sBAAoB;AAGpB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,szJAAszJ,CAAC;AAG30J,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export * from './src/EmailConfigs';
1
+ export * from './src/InviteEmailConfig';
2
+ export * from './src/PasswordResetEmailConfig';
3
+ export * from './src/SignupConfirmationEmailConfig';
2
4
  export * from './src/EmailSender';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/EmailConfigs"), exports);
17
+ __exportStar(require("./src/InviteEmailConfig"), exports);
18
+ __exportStar(require("./src/PasswordResetEmailConfig"), exports);
19
+ __exportStar(require("./src/SignupConfirmationEmailConfig"), exports);
18
20
  __exportStar(require("./src/EmailSender"), exports);
19
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,iEAA+C;AAC/C,sEAAoD;AACpD,oDAAkC"}
@@ -0,0 +1,39 @@
1
+ import { Loadable } from '@proteinjs/reflection';
2
+ import Mail from 'nodemailer/lib/mailer';
3
+ export declare const getDefaultInviteEmailConfigFactory: () => DefaultInviteEmailConfigFactory;
4
+ export interface InviteEmailConfig {
5
+ /**
6
+ * Options to pass into the `EmailSender` object when building the email to be sent.
7
+ *
8
+ * @see https://nodemailer.com/message/ for all available options
9
+ */
10
+ options?: Mail.Options;
11
+ /**
12
+ * A function that generates the email content (both text and HTML versions) for the password reset email.
13
+ *
14
+ * @param signupPathWithToken A partial URL path for the sign up page, including the invite token.
15
+ * This is in the format: 'signup?token=abc123def456'.
16
+ * Note: This is NOT a full URL. You need to prepend your application's base URL to create a complete, clickable link in the email content.
17
+ *
18
+ * @returns An object containing the email content:
19
+ * text: The plain text version of the email (required)
20
+ * html: The HTML version of the email (optional, used for styling)
21
+ *
22
+ * @example
23
+ * getEmailContent: (signupPathWithToken) => {
24
+ * const fullUrl = `https://myapp.com/${signupPathWithToken}`;
25
+ * return {
26
+ * text: `Click here to sign up: ${fullUrl}`,
27
+ * html: `<p>Click <a href="${fullUrl}">here</a> to sign up.</p>`
28
+ * };
29
+ * }
30
+ */
31
+ getEmailContent: (signupPathWithToken: string) => {
32
+ text: string;
33
+ html?: string;
34
+ };
35
+ }
36
+ export interface DefaultInviteEmailConfigFactory extends Loadable {
37
+ getConfig(): InviteEmailConfig;
38
+ }
39
+ //# sourceMappingURL=InviteEmailConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InviteEmailConfig.d.ts","sourceRoot":"","sources":["../../src/InviteEmailConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAEzC,eAAO,MAAM,kCAAkC,uCAG5C,CAAC;AAEJ,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAEvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK;QAChD,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,+BAAgC,SAAQ,QAAQ;IAC/D,SAAS,IAAI,iBAAiB,CAAC;CAChC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultInviteEmailConfigFactory = void 0;
4
+ var reflection_1 = require("@proteinjs/reflection");
5
+ var getDefaultInviteEmailConfigFactory = function () {
6
+ return reflection_1.SourceRepository.get().object('@proteinjs/email-server/DefaultInviteEmailConfigFactory');
7
+ };
8
+ exports.getDefaultInviteEmailConfigFactory = getDefaultInviteEmailConfigFactory;
9
+ //# sourceMappingURL=InviteEmailConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InviteEmailConfig.js","sourceRoot":"","sources":["../../src/InviteEmailConfig.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAG5D,IAAM,kCAAkC,GAAG;IAChD,OAAA,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAC3B,yDAAyD,CAC1D;AAFD,CAEC,CAAC;AAHS,QAAA,kCAAkC,sCAG3C"}
@@ -36,4 +36,4 @@ export interface PasswordResetEmailConfig {
36
36
  export interface DefaultPasswordResetEmailConfigFactory extends Loadable {
37
37
  getConfig(): PasswordResetEmailConfig;
38
38
  }
39
- //# sourceMappingURL=EmailConfigs.d.ts.map
39
+ //# sourceMappingURL=PasswordResetEmailConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordResetEmailConfig.d.ts","sourceRoot":"","sources":["../../src/PasswordResetEmailConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAEzC,eAAO,MAAM,yCAAyC,8CAGnD,CAAC;AAEJ,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAEvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK;QAC/C,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,sCAAuC,SAAQ,QAAQ;IACtE,SAAS,IAAI,wBAAwB,CAAC;CACvC"}
@@ -6,4 +6,4 @@ var getDefaultPasswordResetEmailConfigFactory = function () {
6
6
  return reflection_1.SourceRepository.get().object('@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory');
7
7
  };
8
8
  exports.getDefaultPasswordResetEmailConfigFactory = getDefaultPasswordResetEmailConfigFactory;
9
- //# sourceMappingURL=EmailConfigs.js.map
9
+ //# sourceMappingURL=PasswordResetEmailConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordResetEmailConfig.js","sourceRoot":"","sources":["../../src/PasswordResetEmailConfig.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAG5D,IAAM,yCAAyC,GAAG;IACvD,OAAA,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAC3B,gEAAgE,CACjE;AAFD,CAEC,CAAC;AAHS,QAAA,yCAAyC,6CAGlD"}
@@ -0,0 +1,47 @@
1
+ import { Loadable } from '@proteinjs/reflection';
2
+ import Mail from 'nodemailer/lib/mailer';
3
+ export interface DefaultSignupConfirmationEmailConfigFactory extends Loadable {
4
+ getConfig(): SignupConfirmationEmailConfig;
5
+ }
6
+ export declare const getDefaultSignupConfirmationEmailConfigFactory: () => DefaultSignupConfirmationEmailConfigFactory;
7
+ export interface SignupConfirmationEmailConfig {
8
+ /**
9
+ * Options to pass into the `EmailSender` object when building the email to be sent.
10
+ *
11
+ * @see https://nodemailer.com/message/ for all available options
12
+ */
13
+ options?: Mail.Options;
14
+ /**
15
+ * Subject for new user signup confirmation emails.
16
+ * If provided, this will override the subject in options for new user emails.
17
+ */
18
+ newUserSubject?: string;
19
+ /**
20
+ * Subject for existing user notification emails.
21
+ * If provided, this will override the subject in options for existing user emails.
22
+ */
23
+ existingUserSubject?: string;
24
+ /**
25
+ * Generates the email content for a new user signup confirmation.
26
+ *
27
+ * @returns An object containing the email content:
28
+ * - text: The plain text version of the email (required)
29
+ * - html: The HTML version of the email (optional, used for styling)
30
+ */
31
+ getNewUserEmailContent: () => {
32
+ text: string;
33
+ html?: string;
34
+ };
35
+ /**
36
+ * Generates the email content for an existing user if they attempt to sign up again.
37
+ *
38
+ * @returns An object containing the email content:
39
+ * - text: The plain text version of the email (required)
40
+ * - html: The HTML version of the email (optional, used for styling)
41
+ */
42
+ getExistingUserEmailContent: () => {
43
+ text: string;
44
+ html?: string;
45
+ };
46
+ }
47
+ //# sourceMappingURL=SignupConfirmationEmailConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignupConfirmationEmailConfig.d.ts","sourceRoot":"","sources":["../../src/SignupConfirmationEmailConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAEzC,MAAM,WAAW,2CAA4C,SAAQ,QAAQ;IAC3E,SAAS,IAAI,6BAA6B,CAAC;CAC5C;AAED,eAAO,MAAM,8CAA8C,QAAO,2CAiBjE,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;OAMG;IACH,sBAAsB,EAAE,MAAM;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEF;;;;;;OAMG;IACH,2BAA2B,EAAE,MAAM;QACjC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultSignupConfirmationEmailConfigFactory = void 0;
4
+ var reflection_1 = require("@proteinjs/reflection");
5
+ var getDefaultSignupConfirmationEmailConfigFactory = function () {
6
+ var defaultFactory = {
7
+ getConfig: function () { return ({
8
+ getNewUserEmailContent: function () { return ({
9
+ text: "Welcome to our app! Thank you for signing up. Your account has been successfully created.",
10
+ }); },
11
+ getExistingUserEmailContent: function () { return ({
12
+ text: "Hello, We received a sign up request for this email address, but you already have an account with us.\n If you didn't attempt to sign up again, you can safely ignore this email.",
13
+ }); },
14
+ }); },
15
+ };
16
+ var factory = reflection_1.SourceRepository.get().object('@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory');
17
+ return factory || defaultFactory;
18
+ };
19
+ exports.getDefaultSignupConfirmationEmailConfigFactory = getDefaultSignupConfirmationEmailConfigFactory;
20
+ //# sourceMappingURL=SignupConfirmationEmailConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignupConfirmationEmailConfig.js","sourceRoot":"","sources":["../../src/SignupConfirmationEmailConfig.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAO5D,IAAM,8CAA8C,GAAG;IAC5D,IAAM,cAAc,GAAgD;QAClE,SAAS,EAAE,cAAqC,OAAA,CAAC;YAC/C,sBAAsB,EAAE,cAAM,OAAA,CAAC;gBAC7B,IAAI,EAAE,2FAA2F;aAClG,CAAC,EAF4B,CAE5B;YACF,2BAA2B,EAAE,cAAM,OAAA,CAAC;gBAClC,IAAI,EAAE,0LACoE;aAC3E,CAAC,EAHiC,CAGjC;SACH,CAAC,EAR8C,CAQ9C;KACH,CAAC;IAEF,IAAM,OAAO,GAAG,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAC3C,qEAAqE,CACtE,CAAC;IACF,OAAO,OAAO,IAAI,cAAc,CAAC;AACnC,CAAC,CAAC;AAjBW,QAAA,8CAA8C,kDAiBzD"}
@@ -7,7 +7,7 @@ import 'nodemailer';
7
7
 
8
8
  /** Generate Source Graph */
9
9
 
10
- const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordResetEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailConfigs.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordResetEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordResetEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailSender.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getEmailConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"EmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/EmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}}],\"edges\":[{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
10
+ const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailSender.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getEmailConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"EmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/EmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultInviteEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/InviteEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"InviteEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/InviteEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordResetEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/PasswordResetEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordResetEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordResetEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultSignupConfirmationEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/SignupConfirmationEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"SignupConfirmationEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/SignupConfirmationEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}}],\"edges\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
11
11
 
12
12
 
13
13
  /** Generate Source Links */
package/index.ts CHANGED
@@ -1,2 +1,4 @@
1
- export * from './src/EmailConfigs';
1
+ export * from './src/InviteEmailConfig';
2
+ export * from './src/PasswordResetEmailConfig';
3
+ export * from './src/SignupConfirmationEmailConfig';
2
4
  export * from './src/EmailSender';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/email-server",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Email server libraries",
5
5
  "main": "./dist/generated/index.js",
6
6
  "types": "./dist/generated/index.d.ts",
@@ -41,5 +41,5 @@
41
41
  "ts-jest": "29.1.1",
42
42
  "typescript": "5.2.2"
43
43
  },
44
- "gitHead": "b3340adf0c32126349cd3f74e1544ab1a0381d5e"
44
+ "gitHead": "8b1a0ce65d2d22f69b3b643da30ba1adfae42a70"
45
45
  }
@@ -0,0 +1,45 @@
1
+ import { Loadable, SourceRepository } from '@proteinjs/reflection';
2
+ import Mail from 'nodemailer/lib/mailer';
3
+
4
+ export const getDefaultInviteEmailConfigFactory = () =>
5
+ SourceRepository.get().object<DefaultInviteEmailConfigFactory>(
6
+ '@proteinjs/email-server/DefaultInviteEmailConfigFactory'
7
+ );
8
+
9
+ export interface InviteEmailConfig {
10
+ /**
11
+ * Options to pass into the `EmailSender` object when building the email to be sent.
12
+ *
13
+ * @see https://nodemailer.com/message/ for all available options
14
+ */
15
+ options?: Mail.Options;
16
+
17
+ /**
18
+ * A function that generates the email content (both text and HTML versions) for the password reset email.
19
+ *
20
+ * @param signupPathWithToken A partial URL path for the sign up page, including the invite token.
21
+ * This is in the format: 'signup?token=abc123def456'.
22
+ * Note: This is NOT a full URL. You need to prepend your application's base URL to create a complete, clickable link in the email content.
23
+ *
24
+ * @returns An object containing the email content:
25
+ * text: The plain text version of the email (required)
26
+ * html: The HTML version of the email (optional, used for styling)
27
+ *
28
+ * @example
29
+ * getEmailContent: (signupPathWithToken) => {
30
+ * const fullUrl = `https://myapp.com/${signupPathWithToken}`;
31
+ * return {
32
+ * text: `Click here to sign up: ${fullUrl}`,
33
+ * html: `<p>Click <a href="${fullUrl}">here</a> to sign up.</p>`
34
+ * };
35
+ * }
36
+ */
37
+ getEmailContent: (signupPathWithToken: string) => {
38
+ text: string;
39
+ html?: string;
40
+ };
41
+ }
42
+
43
+ export interface DefaultInviteEmailConfigFactory extends Loadable {
44
+ getConfig(): InviteEmailConfig;
45
+ }
@@ -0,0 +1,70 @@
1
+ import { Loadable, SourceRepository } from '@proteinjs/reflection';
2
+ import Mail from 'nodemailer/lib/mailer';
3
+
4
+ export interface DefaultSignupConfirmationEmailConfigFactory extends Loadable {
5
+ getConfig(): SignupConfirmationEmailConfig;
6
+ }
7
+
8
+ export const getDefaultSignupConfirmationEmailConfigFactory = (): DefaultSignupConfirmationEmailConfigFactory => {
9
+ const defaultFactory: DefaultSignupConfirmationEmailConfigFactory = {
10
+ getConfig: (): SignupConfirmationEmailConfig => ({
11
+ getNewUserEmailContent: () => ({
12
+ text: `Welcome to our app! Thank you for signing up. Your account has been successfully created.`,
13
+ }),
14
+ getExistingUserEmailContent: () => ({
15
+ text: `Hello, We received a sign up request for this email address, but you already have an account with us.
16
+ If you didn't attempt to sign up again, you can safely ignore this email.`,
17
+ }),
18
+ }),
19
+ };
20
+
21
+ const factory = SourceRepository.get().object<DefaultSignupConfirmationEmailConfigFactory>(
22
+ '@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory'
23
+ );
24
+ return factory || defaultFactory;
25
+ };
26
+
27
+ export interface SignupConfirmationEmailConfig {
28
+ /**
29
+ * Options to pass into the `EmailSender` object when building the email to be sent.
30
+ *
31
+ * @see https://nodemailer.com/message/ for all available options
32
+ */
33
+ options?: Mail.Options;
34
+
35
+ /**
36
+ * Subject for new user signup confirmation emails.
37
+ * If provided, this will override the subject in options for new user emails.
38
+ */
39
+ newUserSubject?: string;
40
+
41
+ /**
42
+ * Subject for existing user notification emails.
43
+ * If provided, this will override the subject in options for existing user emails.
44
+ */
45
+ existingUserSubject?: string;
46
+
47
+ /**
48
+ * Generates the email content for a new user signup confirmation.
49
+ *
50
+ * @returns An object containing the email content:
51
+ * - text: The plain text version of the email (required)
52
+ * - html: The HTML version of the email (optional, used for styling)
53
+ */
54
+ getNewUserEmailContent: () => {
55
+ text: string;
56
+ html?: string;
57
+ };
58
+
59
+ /**
60
+ * Generates the email content for an existing user if they attempt to sign up again.
61
+ *
62
+ * @returns An object containing the email content:
63
+ * - text: The plain text version of the email (required)
64
+ * - html: The HTML version of the email (optional, used for styling)
65
+ */
66
+ getExistingUserEmailContent: () => {
67
+ text: string;
68
+ html?: string;
69
+ };
70
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailConfigs.d.ts","sourceRoot":"","sources":["../../src/EmailConfigs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAEzC,eAAO,MAAM,yCAAyC,8CAGnD,CAAC;AAEJ,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAEvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK;QAC/C,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,sCAAuC,SAAQ,QAAQ;IACtE,SAAS,IAAI,wBAAwB,CAAC;CACvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailConfigs.js","sourceRoot":"","sources":["../../src/EmailConfigs.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAG5D,IAAM,yCAAyC,GAAG;IACvD,OAAA,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAC3B,gEAAgE,CACjE;AAFD,CAEC,CAAC;AAHS,QAAA,yCAAyC,6CAGlD"}