@tlouverse/graph-mailer-nestjs 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tlouverse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # @tlouverse/graph-mailer-nestjs
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@tlouverse/graph-mailer-nestjs)](https://www.npmjs.com/package/@tlouverse/graph-mailer-nestjs)
4
+ [![license](https://img.shields.io/npm/l/@tlouverse/graph-mailer-nestjs)](./LICENSE)
5
+
6
+ **[English](#english) · [Français](#français)**
7
+
8
+ ---
9
+
10
+ ## English
11
+
12
+ NestJS module for [@tlouverse/graph-mailer](https://www.npmjs.com/package/@tlouverse/graph-mailer). Registers `GraphMailer` as a global provider so you can inject it anywhere in your application.
13
+
14
+ ### Installation
15
+
16
+ ```bash
17
+ npm install @tlouverse/graph-mailer-nestjs @tlouverse/graph-mailer
18
+ ```
19
+
20
+ ### Setup
21
+
22
+ Register the module once in your root `AppModule`.
23
+
24
+ **Static configuration:**
25
+
26
+ ```ts
27
+ import { GraphMailerModule } from '@tlouverse/graph-mailer-nestjs';
28
+
29
+ @Module({
30
+ imports: [
31
+ GraphMailerModule.forRoot({
32
+ tenantId: 'your-tenant-id',
33
+ clientId: 'your-client-id',
34
+ clientSecret: 'your-client-secret',
35
+ defaultFrom: 'noreply@example.com',
36
+ }),
37
+ ],
38
+ })
39
+ export class AppModule {}
40
+ ```
41
+
42
+ **Async configuration (e.g. with `ConfigService`):**
43
+
44
+ ```ts
45
+ import { GraphMailerModule } from '@tlouverse/graph-mailer-nestjs';
46
+ import { ConfigModule, ConfigService } from '@nestjs/config';
47
+
48
+ @Module({
49
+ imports: [
50
+ ConfigModule.forRoot(),
51
+ GraphMailerModule.forRootAsync({
52
+ imports: [ConfigModule],
53
+ inject: [ConfigService],
54
+ useFactory: (config: ConfigService) => ({
55
+ tenantId: config.getOrThrow('AZURE_TENANT_ID'),
56
+ clientId: config.getOrThrow('AZURE_CLIENT_ID'),
57
+ clientSecret: config.getOrThrow('AZURE_CLIENT_SECRET'),
58
+ defaultFrom: config.get('MAIL_DEFAULT_FROM'),
59
+ }),
60
+ }),
61
+ ],
62
+ })
63
+ export class AppModule {}
64
+ ```
65
+
66
+ ### Injection
67
+
68
+ Once registered, inject `GraphMailer` directly by type:
69
+
70
+ ```ts
71
+ import { Injectable } from '@nestjs/common';
72
+ import { GraphMailer } from '@tlouverse/graph-mailer-nestjs';
73
+
74
+ @Injectable()
75
+ export class NotificationService {
76
+ constructor(private readonly mailer: GraphMailer) {}
77
+
78
+ async sendWelcome(to: string) {
79
+ await this.mailer.send({
80
+ to,
81
+ subject: 'Welcome',
82
+ html: '<p>Welcome aboard!</p>',
83
+ });
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### API
89
+
90
+ This package re-exports everything from `@tlouverse/graph-mailer` — you only need to import from `@tlouverse/graph-mailer-nestjs` in your NestJS project.
91
+
92
+ | Export | Description |
93
+ |---|---|
94
+ | `GraphMailerModule` | NestJS module — register with `forRoot` or `forRootAsync` |
95
+ | `GraphMailerAsyncOptions` | Type for `forRootAsync` options |
96
+ | `GraphMailer` | Mailer class (injectable) |
97
+ | `GraphMailerConfig` | Config type |
98
+ | `SendMailOptions` | Send options type |
99
+ | `Address` | Address type |
100
+ | `GraphMailError` | Graph API error |
101
+ | `GraphAuthError` | Token acquisition error |
102
+
103
+ For the full `GraphMailer` API, see the [@tlouverse/graph-mailer documentation](https://www.npmjs.com/package/@tlouverse/graph-mailer).
104
+
105
+ ### Azure prerequisites
106
+
107
+ See [@tlouverse/graph-mailer — Azure prerequisites](https://www.npmjs.com/package/@tlouverse/graph-mailer#azure-prerequisites).
108
+
109
+ ---
110
+
111
+ ## Français
112
+
113
+ Module NestJS pour [@tlouverse/graph-mailer](https://www.npmjs.com/package/@tlouverse/graph-mailer). Enregistre `GraphMailer` comme provider global, injectable partout dans l'application.
114
+
115
+ ### Installation
116
+
117
+ ```bash
118
+ npm install @tlouverse/graph-mailer-nestjs @tlouverse/graph-mailer
119
+ ```
120
+
121
+ ### Configuration
122
+
123
+ Enregistrez le module une seule fois dans votre `AppModule` racine.
124
+
125
+ **Configuration statique :**
126
+
127
+ ```ts
128
+ import { GraphMailerModule } from '@tlouverse/graph-mailer-nestjs';
129
+
130
+ @Module({
131
+ imports: [
132
+ GraphMailerModule.forRoot({
133
+ tenantId: 'votre-tenant-id',
134
+ clientId: 'votre-client-id',
135
+ clientSecret: 'votre-client-secret',
136
+ defaultFrom: 'noreply@example.com',
137
+ }),
138
+ ],
139
+ })
140
+ export class AppModule {}
141
+ ```
142
+
143
+ **Configuration asynchrone (ex. avec `ConfigService`) :**
144
+
145
+ ```ts
146
+ import { GraphMailerModule } from '@tlouverse/graph-mailer-nestjs';
147
+ import { ConfigModule, ConfigService } from '@nestjs/config';
148
+
149
+ @Module({
150
+ imports: [
151
+ ConfigModule.forRoot(),
152
+ GraphMailerModule.forRootAsync({
153
+ imports: [ConfigModule],
154
+ inject: [ConfigService],
155
+ useFactory: (config: ConfigService) => ({
156
+ tenantId: config.getOrThrow('AZURE_TENANT_ID'),
157
+ clientId: config.getOrThrow('AZURE_CLIENT_ID'),
158
+ clientSecret: config.getOrThrow('AZURE_CLIENT_SECRET'),
159
+ defaultFrom: config.get('MAIL_DEFAULT_FROM'),
160
+ }),
161
+ }),
162
+ ],
163
+ })
164
+ export class AppModule {}
165
+ ```
166
+
167
+ ### Injection
168
+
169
+ Une fois enregistré, injectez `GraphMailer` directement par type :
170
+
171
+ ```ts
172
+ import { Injectable } from '@nestjs/common';
173
+ import { GraphMailer } from '@tlouverse/graph-mailer-nestjs';
174
+
175
+ @Injectable()
176
+ export class NotificationService {
177
+ constructor(private readonly mailer: GraphMailer) {}
178
+
179
+ async sendWelcome(to: string) {
180
+ await this.mailer.send({
181
+ to,
182
+ subject: 'Bienvenue',
183
+ html: '<p>Bienvenue !</p>',
184
+ });
185
+ }
186
+ }
187
+ ```
188
+
189
+ ### API
190
+
191
+ Ce package réexporte tout depuis `@tlouverse/graph-mailer` — dans un projet NestJS, importez uniquement depuis `@tlouverse/graph-mailer-nestjs`.
192
+
193
+ | Export | Description |
194
+ |---|---|
195
+ | `GraphMailerModule` | Module NestJS — à enregistrer avec `forRoot` ou `forRootAsync` |
196
+ | `GraphMailerAsyncOptions` | Type des options pour `forRootAsync` |
197
+ | `GraphMailer` | Classe mailer (injectable) |
198
+ | `GraphMailerConfig` | Type de configuration |
199
+ | `SendMailOptions` | Type des options d'envoi |
200
+ | `Address` | Type d'adresse |
201
+ | `GraphMailError` | Erreur API Graph |
202
+ | `GraphAuthError` | Erreur d'acquisition du token |
203
+
204
+ Pour l'API complète de `GraphMailer`, voir la [documentation @tlouverse/graph-mailer](https://www.npmjs.com/package/@tlouverse/graph-mailer).
205
+
206
+ ### Prérequis Azure
207
+
208
+ Voir [@tlouverse/graph-mailer — Prérequis Azure](https://www.npmjs.com/package/@tlouverse/graph-mailer#prérequis-azure).
209
+
210
+ ---
211
+
212
+ ## License
213
+
214
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ var common = require('@nestjs/common');
4
+ var graphMailer = require('@tlouverse/graph-mailer');
5
+
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (decorator(result)) || result;
12
+ return result;
13
+ };
14
+
15
+ // src/graph-mailer.constants.ts
16
+ var GRAPH_MAILER_OPTIONS = /* @__PURE__ */ Symbol("GRAPH_MAILER_OPTIONS");
17
+
18
+ // src/graph-mailer.module.ts
19
+ exports.GraphMailerModule = class GraphMailerModule {
20
+ static forRoot(config) {
21
+ return {
22
+ module: exports.GraphMailerModule,
23
+ global: true,
24
+ providers: [
25
+ { provide: GRAPH_MAILER_OPTIONS, useValue: config },
26
+ {
27
+ provide: graphMailer.GraphMailer,
28
+ useValue: new graphMailer.GraphMailer(config)
29
+ }
30
+ ],
31
+ exports: [graphMailer.GraphMailer]
32
+ };
33
+ }
34
+ static forRootAsync(options) {
35
+ return {
36
+ module: exports.GraphMailerModule,
37
+ global: true,
38
+ imports: options.imports ?? [],
39
+ providers: [
40
+ {
41
+ provide: GRAPH_MAILER_OPTIONS,
42
+ useFactory: options.useFactory,
43
+ inject: options.inject ?? []
44
+ },
45
+ {
46
+ provide: graphMailer.GraphMailer,
47
+ useFactory: (config) => new graphMailer.GraphMailer(config),
48
+ inject: [GRAPH_MAILER_OPTIONS]
49
+ }
50
+ ],
51
+ exports: [graphMailer.GraphMailer]
52
+ };
53
+ }
54
+ };
55
+ exports.GraphMailerModule = __decorateClass([
56
+ common.Module({})
57
+ ], exports.GraphMailerModule);
58
+
59
+ Object.defineProperty(exports, "Address", {
60
+ enumerable: true,
61
+ get: function () { return graphMailer.Address; }
62
+ });
63
+ Object.defineProperty(exports, "GraphAuthError", {
64
+ enumerable: true,
65
+ get: function () { return graphMailer.GraphAuthError; }
66
+ });
67
+ Object.defineProperty(exports, "GraphMailError", {
68
+ enumerable: true,
69
+ get: function () { return graphMailer.GraphMailError; }
70
+ });
71
+ Object.defineProperty(exports, "GraphMailer", {
72
+ enumerable: true,
73
+ get: function () { return graphMailer.GraphMailer; }
74
+ });
75
+ Object.defineProperty(exports, "GraphMailerConfig", {
76
+ enumerable: true,
77
+ get: function () { return graphMailer.GraphMailerConfig; }
78
+ });
79
+ Object.defineProperty(exports, "SendMailOptions", {
80
+ enumerable: true,
81
+ get: function () { return graphMailer.SendMailOptions; }
82
+ });
83
+ //# sourceMappingURL=index.cjs.map
84
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph-mailer.constants.ts","../src/graph-mailer.module.ts"],"names":["GraphMailerModule","GraphMailer","Module"],"mappings":";;;;;;;;;;;;;;;AAAO,IAAM,oBAAA,0BAA8B,sBAAsB,CAAA;;;ACMpDA,4BAAN,uBAAA,CAAwB;AAAA,EAC7B,OAAO,QAAQ,MAAA,EAA0C;AACvD,IAAA,OAAO;AAAA,MACL,MAAA,EAAQA,yBAAA;AAAA,MACR,MAAA,EAAQ,IAAA;AAAA,MACR,SAAA,EAAW;AAAA,QACT,EAAE,OAAA,EAAS,oBAAA,EAAsB,QAAA,EAAU,MAAA,EAAO;AAAA,QAClD;AAAA,UACE,OAAA,EAASC,uBAAA;AAAA,UACT,QAAA,EAAU,IAAIA,uBAAA,CAAY,MAAM;AAAA;AAClC,OACF;AAAA,MACA,OAAA,EAAS,CAACA,uBAAW;AAAA,KACvB;AAAA,EACF;AAAA,EAEA,OAAO,aAAa,OAAA,EAAiD;AACnE,IAAA,OAAO;AAAA,MACL,MAAA,EAAQD,yBAAA;AAAA,MACR,MAAA,EAAQ,IAAA;AAAA,MACR,OAAA,EAAS,OAAA,CAAQ,OAAA,IAAW,EAAC;AAAA,MAC7B,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,oBAAA;AAAA,UACT,YAAY,OAAA,CAAQ,UAAA;AAAA,UACpB,MAAA,EAAQ,OAAA,CAAQ,MAAA,IAAU;AAAC,SAC7B;AAAA,QACA;AAAA,UACE,OAAA,EAASC,uBAAA;AAAA,UACT,UAAA,EAAY,CAAC,MAAA,KAA8B,IAAIA,wBAAY,MAAM,CAAA;AAAA,UACjE,MAAA,EAAQ,CAAC,oBAAoB;AAAA;AAC/B,OACF;AAAA,MACA,OAAA,EAAS,CAACA,uBAAW;AAAA,KACvB;AAAA,EACF;AACF;AApCaD,yBAAA,GAAN,eAAA,CAAA;AAAA,EADNE,aAAA,CAAO,EAAE;AAAA,CAAA,EACGF,yBAAA,CAAA","file":"index.cjs","sourcesContent":["export const GRAPH_MAILER_OPTIONS = Symbol('GRAPH_MAILER_OPTIONS');\n","import { DynamicModule, Module } from '@nestjs/common';\nimport { GraphMailer, GraphMailerConfig } from '@tlouverse/graph-mailer';\nimport { GRAPH_MAILER_OPTIONS } from './graph-mailer.constants.js';\nimport { GraphMailerAsyncOptions } from './graph-mailer.interfaces.js';\n\n@Module({})\nexport class GraphMailerModule {\n static forRoot(config: GraphMailerConfig): DynamicModule {\n return {\n module: GraphMailerModule,\n global: true,\n providers: [\n { provide: GRAPH_MAILER_OPTIONS, useValue: config },\n {\n provide: GraphMailer,\n useValue: new GraphMailer(config),\n },\n ],\n exports: [GraphMailer],\n };\n }\n\n static forRootAsync(options: GraphMailerAsyncOptions): DynamicModule {\n return {\n module: GraphMailerModule,\n global: true,\n imports: options.imports ?? [],\n providers: [\n {\n provide: GRAPH_MAILER_OPTIONS,\n useFactory: options.useFactory,\n inject: options.inject ?? [],\n },\n {\n provide: GraphMailer,\n useFactory: (config: GraphMailerConfig) => new GraphMailer(config),\n inject: [GRAPH_MAILER_OPTIONS],\n },\n ],\n exports: [GraphMailer],\n };\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { ModuleMetadata, Type, DynamicModule } from '@nestjs/common';
2
+ import { GraphMailerConfig } from '@tlouverse/graph-mailer';
3
+ export { Address, GraphAuthError, GraphMailError, GraphMailer, GraphMailerConfig, SendMailOptions } from '@tlouverse/graph-mailer';
4
+
5
+ interface GraphMailerAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
6
+ useFactory: (...args: unknown[]) => GraphMailerConfig | Promise<GraphMailerConfig>;
7
+ inject?: (string | symbol | Type)[];
8
+ }
9
+
10
+ declare class GraphMailerModule {
11
+ static forRoot(config: GraphMailerConfig): DynamicModule;
12
+ static forRootAsync(options: GraphMailerAsyncOptions): DynamicModule;
13
+ }
14
+
15
+ export { type GraphMailerAsyncOptions, GraphMailerModule };
@@ -0,0 +1,15 @@
1
+ import { ModuleMetadata, Type, DynamicModule } from '@nestjs/common';
2
+ import { GraphMailerConfig } from '@tlouverse/graph-mailer';
3
+ export { Address, GraphAuthError, GraphMailError, GraphMailer, GraphMailerConfig, SendMailOptions } from '@tlouverse/graph-mailer';
4
+
5
+ interface GraphMailerAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
6
+ useFactory: (...args: unknown[]) => GraphMailerConfig | Promise<GraphMailerConfig>;
7
+ inject?: (string | symbol | Type)[];
8
+ }
9
+
10
+ declare class GraphMailerModule {
11
+ static forRoot(config: GraphMailerConfig): DynamicModule;
12
+ static forRootAsync(options: GraphMailerAsyncOptions): DynamicModule;
13
+ }
14
+
15
+ export { type GraphMailerAsyncOptions, GraphMailerModule };
package/dist/index.js ADDED
@@ -0,0 +1,60 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { GraphMailer } from '@tlouverse/graph-mailer';
3
+ export { Address, GraphAuthError, GraphMailError, GraphMailer, GraphMailerConfig, SendMailOptions } from '@tlouverse/graph-mailer';
4
+
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (decorator(result)) || result;
11
+ return result;
12
+ };
13
+
14
+ // src/graph-mailer.constants.ts
15
+ var GRAPH_MAILER_OPTIONS = /* @__PURE__ */ Symbol("GRAPH_MAILER_OPTIONS");
16
+
17
+ // src/graph-mailer.module.ts
18
+ var GraphMailerModule = class {
19
+ static forRoot(config) {
20
+ return {
21
+ module: GraphMailerModule,
22
+ global: true,
23
+ providers: [
24
+ { provide: GRAPH_MAILER_OPTIONS, useValue: config },
25
+ {
26
+ provide: GraphMailer,
27
+ useValue: new GraphMailer(config)
28
+ }
29
+ ],
30
+ exports: [GraphMailer]
31
+ };
32
+ }
33
+ static forRootAsync(options) {
34
+ return {
35
+ module: GraphMailerModule,
36
+ global: true,
37
+ imports: options.imports ?? [],
38
+ providers: [
39
+ {
40
+ provide: GRAPH_MAILER_OPTIONS,
41
+ useFactory: options.useFactory,
42
+ inject: options.inject ?? []
43
+ },
44
+ {
45
+ provide: GraphMailer,
46
+ useFactory: (config) => new GraphMailer(config),
47
+ inject: [GRAPH_MAILER_OPTIONS]
48
+ }
49
+ ],
50
+ exports: [GraphMailer]
51
+ };
52
+ }
53
+ };
54
+ GraphMailerModule = __decorateClass([
55
+ Module({})
56
+ ], GraphMailerModule);
57
+
58
+ export { GraphMailerModule };
59
+ //# sourceMappingURL=index.js.map
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph-mailer.constants.ts","../src/graph-mailer.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAO,IAAM,oBAAA,0BAA8B,sBAAsB,CAAA;;;ACM1D,IAAM,oBAAN,MAAwB;AAAA,EAC7B,OAAO,QAAQ,MAAA,EAA0C;AACvD,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ,iBAAA;AAAA,MACR,MAAA,EAAQ,IAAA;AAAA,MACR,SAAA,EAAW;AAAA,QACT,EAAE,OAAA,EAAS,oBAAA,EAAsB,QAAA,EAAU,MAAA,EAAO;AAAA,QAClD;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,QAAA,EAAU,IAAI,WAAA,CAAY,MAAM;AAAA;AAClC,OACF;AAAA,MACA,OAAA,EAAS,CAAC,WAAW;AAAA,KACvB;AAAA,EACF;AAAA,EAEA,OAAO,aAAa,OAAA,EAAiD;AACnE,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ,iBAAA;AAAA,MACR,MAAA,EAAQ,IAAA;AAAA,MACR,OAAA,EAAS,OAAA,CAAQ,OAAA,IAAW,EAAC;AAAA,MAC7B,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,oBAAA;AAAA,UACT,YAAY,OAAA,CAAQ,UAAA;AAAA,UACpB,MAAA,EAAQ,OAAA,CAAQ,MAAA,IAAU;AAAC,SAC7B;AAAA,QACA;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,UAAA,EAAY,CAAC,MAAA,KAA8B,IAAI,YAAY,MAAM,CAAA;AAAA,UACjE,MAAA,EAAQ,CAAC,oBAAoB;AAAA;AAC/B,OACF;AAAA,MACA,OAAA,EAAS,CAAC,WAAW;AAAA,KACvB;AAAA,EACF;AACF;AApCa,iBAAA,GAAN,eAAA,CAAA;AAAA,EADN,MAAA,CAAO,EAAE;AAAA,CAAA,EACG,iBAAA,CAAA","file":"index.js","sourcesContent":["export const GRAPH_MAILER_OPTIONS = Symbol('GRAPH_MAILER_OPTIONS');\n","import { DynamicModule, Module } from '@nestjs/common';\nimport { GraphMailer, GraphMailerConfig } from '@tlouverse/graph-mailer';\nimport { GRAPH_MAILER_OPTIONS } from './graph-mailer.constants.js';\nimport { GraphMailerAsyncOptions } from './graph-mailer.interfaces.js';\n\n@Module({})\nexport class GraphMailerModule {\n static forRoot(config: GraphMailerConfig): DynamicModule {\n return {\n module: GraphMailerModule,\n global: true,\n providers: [\n { provide: GRAPH_MAILER_OPTIONS, useValue: config },\n {\n provide: GraphMailer,\n useValue: new GraphMailer(config),\n },\n ],\n exports: [GraphMailer],\n };\n }\n\n static forRootAsync(options: GraphMailerAsyncOptions): DynamicModule {\n return {\n module: GraphMailerModule,\n global: true,\n imports: options.imports ?? [],\n providers: [\n {\n provide: GRAPH_MAILER_OPTIONS,\n useFactory: options.useFactory,\n inject: options.inject ?? [],\n },\n {\n provide: GraphMailer,\n useFactory: (config: GraphMailerConfig) => new GraphMailer(config),\n inject: [GRAPH_MAILER_OPTIONS],\n },\n ],\n exports: [GraphMailer],\n };\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@tlouverse/graph-mailer-nestjs",
3
+ "version": "0.1.0",
4
+ "description": "NestJS module for @tlouverse/graph-mailer.",
5
+ "license": "MIT",
6
+ "author": "tlouverse",
7
+ "keywords": [
8
+ "nestjs",
9
+ "microsoft-graph",
10
+ "email",
11
+ "mailer",
12
+ "graph-api"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/Tlouverse/graph-mailer-nestjs.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/Tlouverse/graph-mailer-nestjs/issues"
20
+ },
21
+ "homepage": "https://github.com/Tlouverse/graph-mailer-nestjs#readme",
22
+ "type": "module",
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js",
30
+ "require": "./dist/index.cjs"
31
+ }
32
+ },
33
+ "sideEffects": false,
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "build": "tsup",
47
+ "typecheck": "tsc --noEmit",
48
+ "prepublishOnly": "npm run build"
49
+ },
50
+ "dependencies": {
51
+ "@tlouverse/graph-mailer": "^0.2.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@nestjs/common": "^10.0.0 || ^11.0.0",
55
+ "@nestjs/core": "^10.0.0 || ^11.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@nestjs/common": "^11.0.0",
59
+ "@nestjs/core": "^11.0.0",
60
+ "@types/node": "^22.0.0",
61
+ "reflect-metadata": "^0.2.0",
62
+ "tsup": "^8.0.0",
63
+ "typescript": "^5.8.0"
64
+ }
65
+ }