@brightnkhoma/credentials 1.0.0 → 1.0.2

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.
@@ -0,0 +1,15 @@
1
+ import { Options } from "./types/cred";
2
+ import { Mail, SMTPSentMessageInfo, SMTPTransportOptions } from "nodemailer";
3
+ export declare class Mailer {
4
+ private readonly options;
5
+ mailer: Mail<SMTPSentMessageInfo, SMTPTransportOptions>;
6
+ constructor(options: Options);
7
+ generateBaseEmail(subject: string, text: string): string;
8
+ sendMail(options: {
9
+ to: string;
10
+ subject: string;
11
+ text: string;
12
+ html?: string;
13
+ }): Promise<SMTPSentMessageInfo>;
14
+ }
15
+ //# sourceMappingURL=mailer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailer.d.ts","sourceRoot":"","sources":["../../src/lib/mailer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAmB,EAAE,IAAI,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACxF,qBAAa,MAAM;IAEH,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAA;IACvD,YAA6B,OAAO,EAAG,OAAO,EAiB7C;IAED,iBAAiB,CAAC,OAAO,EAAG,MAAM,EAAC,IAAI,EAAG,MAAM,UAe/C;IAEK,QAAQ,CAAC,OAAO,EAAG;QACrB,EAAE,EAAG,MAAM,CAAC;QACZ,OAAO,EAAG,MAAM,CAAC;QACjB,IAAI,EAAG,MAAM,CAAC;QACd,IAAK,CAAC,EAAG,MAAM,CAAC;KACnB,gCAKA;CACJ"}
@@ -1,18 +1,15 @@
1
- import { ServiceAccount, App } from "firebase-admin/app";
2
- import { Auth } from "firebase-admin/auth";
3
- export interface BaseDB {
4
- db: App;
5
- auth: Auth;
6
- }
1
+ import { ServiceAccount } from "firebase-admin/app";
2
+ import { BaseDB, Options } from "./types/cred";
7
3
  export declare class CredentialRegistry {
8
4
  private dbs;
9
- registerDB(serviceAccountPathOrObject: string | ServiceAccount, key: string): void;
5
+ registerDB(serviceAccountPathOrObject: string | ServiceAccount, key: string, options?: Options): void;
10
6
  getCred(key: string): BaseDB;
7
+ setMailer(key: string, options: Options): void;
11
8
  static init(): {
12
9
  reg: CredentialRegistry;
13
- registerDB: (serviceAccountPathOrObject: string | ServiceAccount, key: string) => void;
14
- getDB: (key: string) => BaseDB;
10
+ registerDB: (serviceAccountPathOrObject: string | ServiceAccount, key?: string | "main", options?: Options) => void;
11
+ getDB: (key?: string | "main") => BaseDB;
15
12
  };
16
13
  }
17
- export declare const getDB: (key: string) => BaseDB, reg: CredentialRegistry, registerDB: (serviceAccountPathOrObject: string | ServiceAccount, key: string) => void;
14
+ export declare const getDB: (key?: string | "main") => BaseDB, reg: CredentialRegistry, registerDB: (serviceAccountPathOrObject: string | ServiceAccount, key?: string | "main", options?: Options) => void;
18
15
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAW,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,MAAM;IACnB,EAAE,EAAG,GAAG,CAAC;IACT,IAAI,EAAG,IAAI,CAAA;CACd;AACD,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,GAAG,CAAkC;IAE7C,UAAU,CAAE,0BAA0B,EAAE,MAAM,GAAG,cAAc,EAAC,GAAG,EAAG,MAAM,QAO3E;IAED,OAAO,CAAC,GAAG,EAAG,MAAM,UAInB;IAGD,MAAM,CAAC,IAAI;;iDAEyC,MAAM,GAAG,cAAc,OAAO,MAAM;qBAG/D,MAAM;MAK9B;CACJ;AAED,eAAO,MAAO,KAAK,QARU,MAAM,aAQf,GAAG,sBAAC,UAAU,+BAXsB,MAAM,GAAG,cAAc,OAAO,MAAM,SAW7B,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAO,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI/C,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,GAAG,CAAkC;IAG7C,UAAU,CAAE,0BAA0B,EAAE,MAAM,GAAG,cAAc,EAAC,GAAG,EAAG,MAAM,EAAC,OAAO,GAAI,OAAY,QAWnG;IAED,OAAO,CAAC,GAAG,EAAG,MAAM,UAInB;IAED,SAAS,CAAC,GAAG,EAAG,MAAM,EAAC,OAAO,EAAG,OAAO,QAMvC;IAGD,MAAM,CAAC,IAAI;;iDAEyC,MAAM,GAAG,cAAc,QAAO,MAAM,GAAG,MAAM,YAAoB,OAAO;sBAGnG,MAAM,GAAG,MAAM;MAMvC;CACJ;AAED,eAAO,MAAO,KAAK,SATU,MAAM,GAAG,MAAM,aASxB,GAAG,sBAAC,UAAU,+BAZsB,MAAM,GAAG,cAAc,QAAO,MAAM,GAAG,MAAM,YAAoB,OAAO,SAYjE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { App } from "firebase-admin/app";
2
+ import { Auth } from "firebase-admin/auth";
3
+ import { Mailer } from "../mailer";
4
+ export interface Options {
5
+ companyName?: string | undefined;
6
+ companyEmail?: string | undefined;
7
+ companyMailPassword?: string | undefined;
8
+ jwtSecret?: string;
9
+ extras?: {
10
+ [key: string]: any;
11
+ };
12
+ }
13
+ export interface BaseDB extends Options {
14
+ db: App;
15
+ auth: Auth;
16
+ mailer?: Mailer;
17
+ sendEmail?: Mailer["sendMail"];
18
+ }
19
+ //# sourceMappingURL=cred.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cred.d.ts","sourceRoot":"","sources":["../../../src/lib/types/cred.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,WAAW,OAAO;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,SAAU,CAAC,EAAG,MAAM,CAAC;IACrB,MAAO,CAAC,EAAG;QACP,CAAC,GAAG,EAAG,MAAM,GAAI,GAAG,CAAA;KACvB,CAAA;CACJ;AACF,MAAM,WAAW,MAAO,SAAQ,OAAO;IACnC,EAAE,EAAG,GAAG,CAAC;IACT,IAAI,EAAG,IAAI,CAAC;IACZ,MAAO,CAAC,EAAG,MAAM,CAAC;IAClB,SAAU,CAAC,EAAG,MAAM,CAAC,UAAU,CAAC,CAAC;CACpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightnkhoma/credentials",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -32,10 +32,11 @@
32
32
  "type": "commonjs",
33
33
  "devDependencies": {
34
34
  "firebase-admin": "^13.8.0",
35
+ "nodemailer": "^10.0.12",
35
36
  "tsup": "^8.5.1",
36
37
  "typescript": "^7.0.2"
37
38
  },
38
39
  "peerDependencies": {
39
- "firebase-admin": "^13.8.0"
40
+ "firebase-admin": "^13.8.0"
40
41
  }
41
42
  }