@memberjunction/communication-sendgrid 3.4.0 → 4.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/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # @memberjunction/communication-sendgrid
2
+
3
+ SendGrid provider for the MemberJunction Communication Framework. This provider enables transactional email sending through the SendGrid API, with support for HTML and plain text content, CC/BCC recipients, scheduled delivery, and per-request credential overrides.
4
+
5
+ ## Architecture
6
+
7
+ ```mermaid
8
+ graph TD
9
+ subgraph sendgrid["@memberjunction/communication-sendgrid"]
10
+ SGP["SendGridProvider"]
11
+ CFG["Config Module\n(Environment Variable)"]
12
+ CRED["SendGridCredentials"]
13
+ end
14
+
15
+ subgraph sg["SendGrid Service"]
16
+ API["SendGrid Web API v3"]
17
+ DELIVERY["Email Delivery"]
18
+ end
19
+
20
+ subgraph base["@memberjunction/communication-types"]
21
+ BCP["BaseCommunicationProvider"]
22
+ end
23
+
24
+ BCP --> SGP
25
+ SGP --> CFG
26
+ SGP --> CRED
27
+ SGP --> API
28
+ API --> DELIVERY
29
+
30
+ style sendgrid fill:#2d6a9f,stroke:#1a4971,color:#fff
31
+ style sg fill:#7c5295,stroke:#563a6b,color:#fff
32
+ style base fill:#2d8659,stroke:#1a5c3a,color:#fff
33
+ ```
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ npm install @memberjunction/communication-sendgrid
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ Set the following environment variable:
44
+
45
+ ```env
46
+ COMMUNICATION_VENDOR_API_KEY__SENDGRID=SG.your-api-key-here
47
+ ```
48
+
49
+ ## Supported Operations
50
+
51
+ SendGrid is a send-only transactional email service. It does not provide mailbox access.
52
+
53
+ | Operation | Supported | Notes |
54
+ |-----------|-----------|-------|
55
+ | `SendSingleMessage` | Yes | Full email sending with HTML, text, CC/BCC, scheduling |
56
+ | `GetMessages` | No | No inbox access (throws error) |
57
+ | `ForwardMessage` | No | No mailbox operations (throws error) |
58
+ | `ReplyToMessage` | No | No mailbox operations (throws error) |
59
+ | `CreateDraft` | No | No mailbox access (returns error result) |
60
+ | Extended operations | No | No folder, search, or attachment operations |
61
+
62
+ ## Usage
63
+
64
+ ### Sending Email via CommunicationEngine
65
+
66
+ ```typescript
67
+ import { CommunicationEngine } from '@memberjunction/communication-engine';
68
+ import { Message } from '@memberjunction/communication-types';
69
+
70
+ const engine = CommunicationEngine.Instance;
71
+ await engine.Config(false, contextUser);
72
+
73
+ const message = new Message();
74
+ message.From = 'noreply@example.com';
75
+ message.FromName = 'My Application';
76
+ message.To = 'recipient@example.com';
77
+ message.Subject = 'Order Confirmation';
78
+ message.HTMLBody = '<h1>Thank you for your order</h1>';
79
+ message.Body = 'Thank you for your order';
80
+ message.CCRecipients = ['accounting@example.com'];
81
+
82
+ const result = await engine.SendSingleMessage('SendGrid', 'Email', message);
83
+ if (result.Success) {
84
+ console.log('Email sent successfully');
85
+ }
86
+ ```
87
+
88
+ ### Scheduled Sending
89
+
90
+ ```typescript
91
+ const message = new Message();
92
+ message.From = 'noreply@example.com';
93
+ message.To = 'recipient@example.com';
94
+ message.Subject = 'Scheduled Report';
95
+ message.Body = 'Your weekly report is attached.';
96
+ message.SendAt = new Date('2025-12-01T09:00:00Z');
97
+
98
+ const result = await engine.SendSingleMessage('SendGrid', 'Email', message);
99
+ ```
100
+
101
+ ### Per-Request Credentials
102
+
103
+ Override the API key for multi-tenant or customer-specific sending:
104
+
105
+ ```typescript
106
+ import { SendGridCredentials } from '@memberjunction/communication-sendgrid';
107
+
108
+ // Override API key
109
+ const result = await engine.SendSingleMessage(
110
+ 'SendGrid',
111
+ 'Email',
112
+ message,
113
+ undefined,
114
+ false,
115
+ { apiKey: 'SG.customer-specific-api-key' } as SendGridCredentials
116
+ );
117
+
118
+ // Disable environment fallback (require explicit key)
119
+ const result2 = await engine.SendSingleMessage(
120
+ 'SendGrid',
121
+ 'Email',
122
+ message,
123
+ undefined,
124
+ false,
125
+ {
126
+ apiKey: 'SG.required-key',
127
+ disableEnvironmentFallback: true
128
+ } as SendGridCredentials
129
+ );
130
+ ```
131
+
132
+ ### Direct Provider Usage
133
+
134
+ ```typescript
135
+ import { SendGridProvider } from '@memberjunction/communication-sendgrid';
136
+
137
+ const provider = new SendGridProvider();
138
+ const result = await provider.SendSingleMessage(processedMessage);
139
+ ```
140
+
141
+ ## Message Features
142
+
143
+ | Feature | Support |
144
+ |---------|---------|
145
+ | HTML body | Yes |
146
+ | Plain text body | Yes |
147
+ | CC recipients | Yes |
148
+ | BCC recipients | Yes |
149
+ | From name | Yes |
150
+ | Scheduled send (`SendAt`) | Yes (converted to Unix timestamp) |
151
+ | Subscription tracking | Disabled by default |
152
+
153
+ ## SendGridCredentials
154
+
155
+ ```typescript
156
+ interface SendGridCredentials extends ProviderCredentialsBase {
157
+ /** SendGrid API key (typically starts with 'SG.') */
158
+ apiKey?: string;
159
+ /** If true, do not fall back to environment variables */
160
+ disableEnvironmentFallback?: boolean;
161
+ }
162
+ ```
163
+
164
+ ## Dependencies
165
+
166
+ | Package | Purpose |
167
+ |---------|---------|
168
+ | `@memberjunction/communication-types` | Base provider class and type definitions |
169
+ | `@memberjunction/core` | Logging utilities (LogError, LogStatus) |
170
+ | `@memberjunction/global` | RegisterClass decorator |
171
+ | `@sendgrid/mail` | Official SendGrid Node.js client |
172
+ | `dotenv` | Environment variable loading |
173
+ | `env-var` | Environment variable validation |
174
+
175
+ ## Development
176
+
177
+ ```bash
178
+ npm run build # Compile TypeScript
179
+ npm run clean # Remove dist directory
180
+ ```
@@ -82,5 +82,4 @@ export declare class SendGridProvider extends BaseCommunicationProvider {
82
82
  */
83
83
  CreateDraft(params: CreateDraftParams, credentials?: SendGridCredentials): Promise<CreateDraftResult>;
84
84
  }
85
- export declare function LoadProvider(): void;
86
85
  //# sourceMappingURL=SendGridProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridProvider.d.ts","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EAGpB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAM7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAChE;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,gBAAiB,SAAQ,yBAAyB;IAC3D;;;;OAIG;IACa,sBAAsB,IAAI,iBAAiB,EAAE;IAS7D;;;;OAIG;IACU,iBAAiB,CAC1B,OAAO,EAAE,gBAAgB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,aAAa,CAAC;IAkFzB;;;OAGG;IACU,WAAW,CACpB,MAAM,EAAE,iBAAiB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,iBAAiB,CAAC;IAI7B;;;OAGG;IACI,cAAc,CACjB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;;OAGG;IACI,cAAc,CACjB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;;OAGG;IACU,WAAW,CACpB,MAAM,EAAE,iBAAiB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,iBAAiB,CAAC;CAMhC;AAED,wBAAgB,YAAY,SAE3B"}
1
+ {"version":3,"file":"SendGridProvider.d.ts","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EAGpB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAM7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAChE;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,gBAAiB,SAAQ,yBAAyB;IAC3D;;;;OAIG;IACa,sBAAsB,IAAI,iBAAiB,EAAE;IAS7D;;;;OAIG;IACU,iBAAiB,CAC1B,OAAO,EAAE,gBAAgB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,aAAa,CAAC;IAkFzB;;;OAGG;IACU,WAAW,CACpB,MAAM,EAAE,iBAAiB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,iBAAiB,CAAC;IAI7B;;;OAGG;IACI,cAAc,CACjB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;;OAGG;IACI,cAAc,CACjB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;;OAGG;IACU,WAAW,CACpB,MAAM,EAAE,iBAAiB,EACzB,WAAW,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,iBAAiB,CAAC;CAMhC"}
@@ -1,20 +1,14 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LoadProvider = exports.SendGridProvider = void 0;
13
- const communication_types_1 = require("@memberjunction/communication-types");
14
- const global_1 = require("@memberjunction/global");
15
- const mail_1 = __importDefault(require("@sendgrid/mail"));
16
- const config_1 = require("./config");
17
- const core_1 = require("@memberjunction/core");
7
+ import { BaseCommunicationProvider, resolveCredentialValue, validateRequiredCredentials } from "@memberjunction/communication-types";
8
+ import { RegisterClass } from "@memberjunction/global";
9
+ import sgMail from '@sendgrid/mail';
10
+ import { __API_KEY } from "./config.js";
11
+ import { LogError, LogStatus } from "@memberjunction/core";
18
12
  /**
19
13
  * Implementation of the SendGrid provider for sending and receiving messages.
20
14
  *
@@ -40,7 +34,7 @@ const core_1 = require("@memberjunction/core");
40
34
  * });
41
35
  * ```
42
36
  */
43
- let SendGridProvider = class SendGridProvider extends communication_types_1.BaseCommunicationProvider {
37
+ let SendGridProvider = class SendGridProvider extends BaseCommunicationProvider {
44
38
  /**
45
39
  * Returns the list of operations supported by the SendGrid provider.
46
40
  * SendGrid is a transactional email service (send-only) and does not support
@@ -62,12 +56,12 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
62
56
  async SendSingleMessage(message, credentials) {
63
57
  // Resolve credentials: request values override env vars
64
58
  const disableFallback = credentials?.disableEnvironmentFallback ?? false;
65
- const apiKey = (0, communication_types_1.resolveCredentialValue)(credentials?.apiKey, config_1.__API_KEY, disableFallback);
59
+ const apiKey = resolveCredentialValue(credentials?.apiKey, __API_KEY, disableFallback);
66
60
  // Validate required credentials
67
- (0, communication_types_1.validateRequiredCredentials)({ apiKey }, ['apiKey'], 'SendGrid');
61
+ validateRequiredCredentials({ apiKey }, ['apiKey'], 'SendGrid');
68
62
  const from = message.From;
69
63
  // Set API key for this request
70
- mail_1.default.setApiKey(apiKey);
64
+ sgMail.setApiKey(apiKey);
71
65
  const msg = {
72
66
  to: message.To,
73
67
  from: {
@@ -97,9 +91,9 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
97
91
  msg.sendAt = unitTime;
98
92
  }
99
93
  try {
100
- const result = await mail_1.default.send(msg);
94
+ const result = await sgMail.send(msg);
101
95
  if (result && result.length > 0 && result[0].statusCode >= 200 && result[0].statusCode < 300) {
102
- (0, core_1.LogStatus)(`Email sent to ${msg.to}: ${result[0].statusCode}`);
96
+ LogStatus(`Email sent to ${msg.to}: ${result[0].statusCode}`);
103
97
  return {
104
98
  Message: message,
105
99
  Success: true,
@@ -107,8 +101,8 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
107
101
  };
108
102
  }
109
103
  else {
110
- (0, core_1.LogError)(`Error sending email to ${msg.to}:`, undefined, result);
111
- (0, core_1.LogError)(result[0].body);
104
+ LogError(`Error sending email to ${msg.to}:`, undefined, result);
105
+ LogError(result[0].body);
112
106
  return {
113
107
  Message: message,
114
108
  Success: false,
@@ -119,9 +113,9 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
119
113
  catch (error) {
120
114
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
121
115
  const errorResponse = error?.response?.body;
122
- (0, core_1.LogError)(`Error sending email to ${msg.to}:`, undefined, error);
116
+ LogError(`Error sending email to ${msg.to}:`, undefined, error);
123
117
  if (errorResponse) {
124
- (0, core_1.LogError)(errorResponse);
118
+ LogError(errorResponse);
125
119
  }
126
120
  return {
127
121
  Message: message,
@@ -162,12 +156,8 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
162
156
  };
163
157
  }
164
158
  };
165
- exports.SendGridProvider = SendGridProvider;
166
- exports.SendGridProvider = SendGridProvider = __decorate([
167
- (0, global_1.RegisterClass)(communication_types_1.BaseCommunicationProvider, 'SendGrid')
159
+ SendGridProvider = __decorate([
160
+ RegisterClass(BaseCommunicationProvider, 'SendGrid')
168
161
  ], SendGridProvider);
169
- function LoadProvider() {
170
- // do nothing, this prevents tree shaking from removing this class
171
- }
172
- exports.LoadProvider = LoadProvider;
162
+ export { SendGridProvider };
173
163
  //# sourceMappingURL=SendGridProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridProvider.js","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAgB6C;AAC7C,mDAAuD;AACvD,0DAA0D;AAC1D,qCAAqC;AACrC,+CAA2D;AA2B3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,+CAAyB;IAC3D;;;;OAIG;IACa,sBAAsB;QAClC,OAAO;YACH,mBAAmB;YACnB,wEAAwE;YACxE,2DAA2D;YAC3D,oCAAoC;SACvC,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iBAAiB,CAC1B,OAAyB,EACzB,WAAiC;QAEjC,wDAAwD;QACxD,MAAM,eAAe,GAAG,WAAW,EAAE,0BAA0B,IAAI,KAAK,CAAC;QAEzE,MAAM,MAAM,GAAG,IAAA,4CAAsB,EACjC,WAAW,EAAE,MAAM,EACnB,kBAAS,EACT,eAAe,CAClB,CAAC;QAEF,gCAAgC;QAChC,IAAA,iDAA2B,EAAC,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;QAEhE,MAAM,IAAI,GAAW,OAAO,CAAC,IAAI,CAAC;QAClC,+BAA+B;QAC/B,cAAM,CAAC,SAAS,CAAC,MAAO,CAAC,CAAC;QAE1B,MAAM,GAAG,GAAqB;YAC1B,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAA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AC;IACN,CAAC;CACJ,CAAA;AAvJY,gBAAgB;IAD5B,aAAa,CAAC,yBAAyB,EAAE,UAAU,CAAC;GACxC,gBAAgB,CAuJ5B"}
package/dist/config.js CHANGED
@@ -1,12 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.__API_KEY = void 0;
7
1
  // TEMPORARY
8
- const dotenv_1 = __importDefault(require("dotenv"));
2
+ import dotenv from 'dotenv';
9
3
  // Load environment variables from .env file
10
- dotenv_1.default.config();
11
- exports.__API_KEY = process.env.COMMUNICATION_VENDOR_API_KEY__SENDGRID;
4
+ dotenv.config({ quiet: true });
5
+ export const __API_KEY = process.env.COMMUNICATION_VENDOR_API_KEY__SENDGRID;
12
6
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAAA,YAAY;AACZ,oDAA4B;AAE5B,4CAA4C;AAC5C,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEH,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './SendGridProvider';
2
- export type { SendGridCredentials } from './SendGridProvider';
1
+ export * from './SendGridProvider.js';
2
+ export type { SendGridCredentials } from './SendGridProvider.js';
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
1
  // PUBLIC API SURFACE AREA
18
- __exportStar(require("./SendGridProvider"), exports);
2
+ export * from './SendGridProvider.js';
19
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/communication-sendgrid",
3
- "version": "3.4.0",
3
+ "type": "module",
4
+ "version": "4.1.0",
4
5
  "description": "MemberJunction: SendGrid Provider for the MJ Communication Framework",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
@@ -9,22 +10,22 @@
9
10
  ],
10
11
  "scripts": {
11
12
  "start": "ts-node-dev src/index.ts",
12
- "build": "tsc",
13
+ "build": "tsc && tsc-alias -f",
13
14
  "test": "echo \"Error: no test specified\" && exit 1"
14
15
  },
15
16
  "author": "MemberJunction.com",
16
17
  "license": "ISC",
17
18
  "devDependencies": {
18
19
  "ts-node-dev": "^2.0.0",
19
- "typescript": "^5.4.5"
20
+ "typescript": "^5.9.3"
20
21
  },
21
22
  "dependencies": {
22
- "@memberjunction/communication-types": "3.4.0",
23
- "@memberjunction/core": "3.4.0",
24
- "@memberjunction/core-entities": "3.4.0",
25
- "@memberjunction/global": "3.4.0",
26
- "@sendgrid/mail": "^8.1.3",
27
- "dotenv": "^16.4.1"
23
+ "@memberjunction/communication-types": "4.1.0",
24
+ "@memberjunction/core": "4.1.0",
25
+ "@memberjunction/core-entities": "4.1.0",
26
+ "@memberjunction/global": "4.1.0",
27
+ "@sendgrid/mail": "^8.1.6",
28
+ "dotenv": "^17.2.4"
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
package/readme.md CHANGED
Binary file