@bernierllc/email-manager 0.12.0 → 0.12.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.
Files changed (93) hide show
  1. package/package.json +12 -12
  2. package/dist/capabilities/degradation-logger.d.ts +0 -59
  3. package/dist/capabilities/degradation-logger.d.ts.map +0 -1
  4. package/dist/capabilities/degradation-logger.js +0 -106
  5. package/dist/capabilities/degradation-logger.js.map +0 -1
  6. package/dist/capabilities/feature-router.d.ts +0 -55
  7. package/dist/capabilities/feature-router.d.ts.map +0 -1
  8. package/dist/capabilities/feature-router.js +0 -143
  9. package/dist/capabilities/feature-router.js.map +0 -1
  10. package/dist/capabilities/in-memory-resolver.d.ts +0 -27
  11. package/dist/capabilities/in-memory-resolver.d.ts.map +0 -1
  12. package/dist/capabilities/in-memory-resolver.js +0 -79
  13. package/dist/capabilities/in-memory-resolver.js.map +0 -1
  14. package/dist/capabilities/index.d.ts +0 -13
  15. package/dist/capabilities/index.d.ts.map +0 -1
  16. package/dist/capabilities/index.js +0 -21
  17. package/dist/capabilities/index.js.map +0 -1
  18. package/dist/capabilities/matrix.d.ts +0 -67
  19. package/dist/capabilities/matrix.d.ts.map +0 -1
  20. package/dist/capabilities/matrix.js +0 -312
  21. package/dist/capabilities/matrix.js.map +0 -1
  22. package/dist/capabilities/redis-resolver.d.ts +0 -95
  23. package/dist/capabilities/redis-resolver.d.ts.map +0 -1
  24. package/dist/capabilities/redis-resolver.js +0 -227
  25. package/dist/capabilities/redis-resolver.js.map +0 -1
  26. package/dist/capabilities/resolver-factory.d.ts +0 -30
  27. package/dist/capabilities/resolver-factory.d.ts.map +0 -1
  28. package/dist/capabilities/resolver-factory.js +0 -70
  29. package/dist/capabilities/resolver-factory.js.map +0 -1
  30. package/dist/capabilities/resolver.d.ts +0 -40
  31. package/dist/capabilities/resolver.d.ts.map +0 -1
  32. package/dist/capabilities/resolver.js +0 -18
  33. package/dist/capabilities/resolver.js.map +0 -1
  34. package/dist/capabilities/routing-metadata.d.ts +0 -16
  35. package/dist/capabilities/routing-metadata.d.ts.map +0 -1
  36. package/dist/capabilities/routing-metadata.js +0 -17
  37. package/dist/capabilities/routing-metadata.js.map +0 -1
  38. package/dist/capabilities/safe-resolver.d.ts +0 -24
  39. package/dist/capabilities/safe-resolver.d.ts.map +0 -1
  40. package/dist/capabilities/safe-resolver.js +0 -48
  41. package/dist/capabilities/safe-resolver.js.map +0 -1
  42. package/dist/config/loadConfiguration.d.ts +0 -60
  43. package/dist/config/loadConfiguration.d.ts.map +0 -1
  44. package/dist/config/loadConfiguration.js +0 -468
  45. package/dist/config/loadConfiguration.js.map +0 -1
  46. package/dist/config/schema.d.ts +0 -962
  47. package/dist/config/schema.d.ts.map +0 -1
  48. package/dist/config/schema.js +0 -318
  49. package/dist/config/schema.js.map +0 -1
  50. package/dist/config/types.d.ts +0 -826
  51. package/dist/config/types.d.ts.map +0 -1
  52. package/dist/config/types.js +0 -9
  53. package/dist/config/types.js.map +0 -1
  54. package/dist/email-manager.d.ts +0 -143
  55. package/dist/email-manager.d.ts.map +0 -1
  56. package/dist/email-manager.js +0 -365
  57. package/dist/email-manager.js.map +0 -1
  58. package/dist/enhanced-email-manager.d.ts +0 -349
  59. package/dist/enhanced-email-manager.d.ts.map +0 -1
  60. package/dist/enhanced-email-manager.js +0 -1396
  61. package/dist/enhanced-email-manager.js.map +0 -1
  62. package/dist/errors.d.ts +0 -154
  63. package/dist/errors.d.ts.map +0 -1
  64. package/dist/errors.js +0 -251
  65. package/dist/errors.js.map +0 -1
  66. package/dist/index.d.ts +0 -25
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/index.js +0 -30
  69. package/dist/index.js.map +0 -1
  70. package/dist/managers/email-analytics.d.ts +0 -92
  71. package/dist/managers/email-analytics.d.ts.map +0 -1
  72. package/dist/managers/email-analytics.js +0 -375
  73. package/dist/managers/email-analytics.js.map +0 -1
  74. package/dist/managers/email-scheduler.d.ts +0 -81
  75. package/dist/managers/email-scheduler.d.ts.map +0 -1
  76. package/dist/managers/email-scheduler.js +0 -288
  77. package/dist/managers/email-scheduler.js.map +0 -1
  78. package/dist/managers/provider-manager.d.ts +0 -152
  79. package/dist/managers/provider-manager.d.ts.map +0 -1
  80. package/dist/managers/provider-manager.js +0 -592
  81. package/dist/managers/provider-manager.js.map +0 -1
  82. package/dist/managers/template-manager.d.ts +0 -65
  83. package/dist/managers/template-manager.d.ts.map +0 -1
  84. package/dist/managers/template-manager.js +0 -314
  85. package/dist/managers/template-manager.js.map +0 -1
  86. package/dist/types.d.ts +0 -1029
  87. package/dist/types.d.ts.map +0 -1
  88. package/dist/types.js +0 -62
  89. package/dist/types.js.map +0 -1
  90. package/dist/utils/simple-template-engine.d.ts +0 -27
  91. package/dist/utils/simple-template-engine.d.ts.map +0 -1
  92. package/dist/utils/simple-template-engine.js +0 -61
  93. package/dist/utils/simple-template-engine.js.map +0 -1
@@ -1,227 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
- import { capabilityEntrySchema } from '@bernierllc/email-sender';
9
- import { CAPABILITY_MATRIX } from './matrix.js';
10
- import { CapabilityResolverError } from './resolver.js';
11
- // ---------------------------------------------------------------------------
12
- // Implementation
13
- // ---------------------------------------------------------------------------
14
- /**
15
- * Redis-backed {@link CapabilityResolverAdmin}.
16
- *
17
- * Stores per-provider, per-feature capability overrides in Redis. When a key
18
- * is not present in Redis the resolver falls back to the static
19
- * {@link CAPABILITY_MATRIX}.
20
- *
21
- * Entries read from Redis are validated against `capabilityEntrySchema`; if
22
- * validation fails the static matrix entry is returned instead.
23
- */
24
- export class RedisCapabilityResolver {
25
- constructor(options) {
26
- this.redis = options.redis;
27
- this.prefix = options.keyPrefix ?? 'ecap';
28
- this.namespace = options.namespace;
29
- this.ttl = options.ttl ?? 0;
30
- this.logger = options.logger;
31
- }
32
- // -----------------------------------------------------------------------
33
- // Key helpers
34
- // -----------------------------------------------------------------------
35
- /**
36
- * Builds the Redis key for a specific provider + feature pair.
37
- *
38
- * Without namespace: `ecap:sendgrid:batchSend`
39
- * With namespace `org_123`: `ecap:org_123:sendgrid:batchSend`
40
- */
41
- buildKey(provider, feature) {
42
- if (this.namespace) {
43
- return `${this.prefix}:${this.namespace}:${provider}:${feature}`;
44
- }
45
- return `${this.prefix}:${provider}:${feature}`;
46
- }
47
- /**
48
- * Builds the key pattern for listing all features of a provider.
49
- */
50
- buildProviderPattern(provider) {
51
- if (this.namespace) {
52
- return `${this.prefix}:${this.namespace}:${provider}:*`;
53
- }
54
- return `${this.prefix}:${provider}:*`;
55
- }
56
- /**
57
- * Extracts the feature name from a full Redis key.
58
- */
59
- extractFeature(key) {
60
- const parts = key.split(':');
61
- return parts[parts.length - 1];
62
- }
63
- // -----------------------------------------------------------------------
64
- // Read operations
65
- // -----------------------------------------------------------------------
66
- async getCapability(provider, feature) {
67
- const key = this.buildKey(provider, feature);
68
- let raw;
69
- try {
70
- raw = await this.redis.get(key);
71
- }
72
- catch {
73
- // Redis unavailable -- fall back to static matrix
74
- return this.getMatrixEntry(provider, feature);
75
- }
76
- if (raw === null) {
77
- // No override in Redis -- use static matrix
78
- return this.getMatrixEntry(provider, feature);
79
- }
80
- return this.parseAndValidate(raw, provider, feature);
81
- }
82
- async getProviderCapabilities(provider) {
83
- // Start with static matrix entries as base
84
- const matrixCaps = this.getMatrixProviderCaps(provider);
85
- // Overlay Redis overrides
86
- let keys;
87
- try {
88
- keys = await this.redis.keys(this.buildProviderPattern(provider));
89
- }
90
- catch {
91
- // Redis unavailable -- return matrix entries only
92
- return { ...matrixCaps };
93
- }
94
- if (keys.length === 0) {
95
- return { ...matrixCaps };
96
- }
97
- // Use pipeline for efficient batch fetch
98
- const pipeline = this.redis.pipeline();
99
- for (const key of keys) {
100
- pipeline.get(key);
101
- }
102
- let results;
103
- try {
104
- results = await pipeline.exec();
105
- }
106
- catch {
107
- return { ...matrixCaps };
108
- }
109
- const result = { ...matrixCaps };
110
- for (let i = 0; i < keys.length; i++) {
111
- const [err, raw] = results[i];
112
- if (err || typeof raw !== 'string')
113
- continue;
114
- const feature = this.extractFeature(keys[i]);
115
- const parsed = this.parseAndValidateQuiet(raw);
116
- if (parsed) {
117
- result[feature] = parsed;
118
- }
119
- }
120
- return result;
121
- }
122
- // -----------------------------------------------------------------------
123
- // Write operations
124
- // -----------------------------------------------------------------------
125
- async setCapability(provider, feature, entry) {
126
- this.validateEntry(entry);
127
- const key = this.buildKey(provider, feature);
128
- const json = JSON.stringify(entry);
129
- if (this.ttl > 0) {
130
- await this.redis.set(key, json, 'EX', this.ttl);
131
- }
132
- else {
133
- await this.redis.set(key, json);
134
- }
135
- }
136
- async setProviderCapabilities(provider, capabilities) {
137
- // Validate all entries before committing any
138
- for (const [feature, entry] of Object.entries(capabilities)) {
139
- this.validateEntry(entry, feature);
140
- }
141
- const pipeline = this.redis.pipeline();
142
- for (const [feature, entry] of Object.entries(capabilities)) {
143
- const key = this.buildKey(provider, feature);
144
- const json = JSON.stringify(entry);
145
- if (this.ttl > 0) {
146
- pipeline.set(key, json, 'EX', this.ttl);
147
- }
148
- else {
149
- pipeline.set(key, json);
150
- }
151
- }
152
- await pipeline.exec();
153
- }
154
- // -----------------------------------------------------------------------
155
- // Internal helpers
156
- // -----------------------------------------------------------------------
157
- /**
158
- * Parses a JSON string from Redis and validates it against the schema.
159
- * Falls back to the static matrix entry on any error.
160
- */
161
- parseAndValidate(raw, provider, feature) {
162
- let parsed;
163
- try {
164
- parsed = JSON.parse(raw);
165
- }
166
- catch {
167
- this.logger?.warn(`RedisCapabilityResolver: invalid JSON for key ${this.buildKey(provider, feature)}, falling back to matrix`);
168
- return this.getMatrixEntry(provider, feature);
169
- }
170
- const result = capabilityEntrySchema.safeParse(parsed);
171
- if (!result.success) {
172
- this.logger?.warn(`RedisCapabilityResolver: schema validation failed for key ${this.buildKey(provider, feature)}, falling back to matrix`);
173
- return this.getMatrixEntry(provider, feature);
174
- }
175
- return result.data;
176
- }
177
- /**
178
- * Parses and validates silently, returning null on failure (used in batch operations).
179
- */
180
- parseAndValidateQuiet(raw) {
181
- let parsed;
182
- try {
183
- parsed = JSON.parse(raw);
184
- }
185
- catch {
186
- return null;
187
- }
188
- const result = capabilityEntrySchema.safeParse(parsed);
189
- return result.success ? result.data : null;
190
- }
191
- /**
192
- * Gets a capability entry from the static CAPABILITY_MATRIX.
193
- * Throws CapabilityResolverError if provider or feature is unknown.
194
- */
195
- getMatrixEntry(provider, feature) {
196
- const providerCaps = CAPABILITY_MATRIX.providers[provider];
197
- if (!providerCaps) {
198
- throw new CapabilityResolverError(`Unknown provider "${provider}"`, 'UNKNOWN_PROVIDER');
199
- }
200
- const entry = providerCaps[feature];
201
- if (!entry) {
202
- throw new CapabilityResolverError(`Unknown feature "${feature}" for provider "${provider}"`, 'UNKNOWN_FEATURE');
203
- }
204
- return entry;
205
- }
206
- /**
207
- * Gets all capabilities for a provider from the static matrix.
208
- * Returns an empty object for unknown providers (Redis may have entries for providers
209
- * not in the static matrix).
210
- */
211
- getMatrixProviderCaps(provider) {
212
- const providerCaps = CAPABILITY_MATRIX.providers[provider];
213
- return providerCaps ? { ...providerCaps } : {};
214
- }
215
- /**
216
- * Validates a capability entry against the Zod schema, throwing a
217
- * {@link CapabilityResolverError} with code `INVALID_ENTRY` on failure.
218
- */
219
- validateEntry(entry, label) {
220
- const result = capabilityEntrySchema.safeParse(entry);
221
- if (!result.success) {
222
- const prefix = label ? `Invalid entry for "${label}": ` : 'Invalid capability entry: ';
223
- throw new CapabilityResolverError(prefix + result.error.issues.map((i) => i.message).join('; '), 'INVALID_ENTRY');
224
- }
225
- }
226
- }
227
- //# sourceMappingURL=redis-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redis-resolver.js","sourceRoot":"","sources":["../../src/capabilities/redis-resolver.ts"],"names":[],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- export interface ResolverFactoryOptions {
3
- /** User-provided resolver instance. When set, the factory returns it directly. */
4
- capabilityResolver?: CapabilityResolver;
5
- /** Redis key namespace (forwarded to RedisCapabilityResolver). */
6
- namespace?: string;
7
- /** Redis TTL in seconds (forwarded to RedisCapabilityResolver). */
8
- ttl?: number;
9
- }
10
- export interface ResolverFactoryLogger {
11
- warn: (...args: unknown[]) => void;
12
- info: (...args: unknown[]) => void;
13
- }
14
- /**
15
- * Creates the best-available {@link CapabilityResolver} based on the runtime
16
- * environment and the supplied options.
17
- *
18
- * Resolution order:
19
- * 1. If `options.capabilityResolver` is provided, return it directly.
20
- * 2. If the `EMAIL_MANAGER_REDIS_URL` environment variable is set **and**
21
- * `ioredis` is installed, return a {@link SafeCapabilityResolver} wrapping
22
- * a {@link RedisCapabilityResolver} with an {@link InMemoryCapabilityResolver}
23
- * fallback.
24
- * 3. Otherwise return an {@link InMemoryCapabilityResolver}.
25
- *
26
- * `ioredis` is loaded via dynamic `import()` so it remains an optional peer
27
- * dependency -- projects that do not use Redis never need to install it.
28
- */
29
- export declare function createCapabilityResolver(options?: ResolverFactoryOptions, logger?: ResolverFactoryLogger): Promise<CapabilityResolver>;
30
- //# sourceMappingURL=resolver-factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver-factory.d.ts","sourceRoot":"","sources":["../../src/capabilities/resolver-factory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOxD,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACpC;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,CAAC,EAAE,sBAAsB,EAChC,MAAM,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA+C7B"}
@@ -1,70 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
- import { InMemoryCapabilityResolver } from './in-memory-resolver.js';
9
- // ---------------------------------------------------------------------------
10
- // Factory
11
- // ---------------------------------------------------------------------------
12
- /**
13
- * Creates the best-available {@link CapabilityResolver} based on the runtime
14
- * environment and the supplied options.
15
- *
16
- * Resolution order:
17
- * 1. If `options.capabilityResolver` is provided, return it directly.
18
- * 2. If the `EMAIL_MANAGER_REDIS_URL` environment variable is set **and**
19
- * `ioredis` is installed, return a {@link SafeCapabilityResolver} wrapping
20
- * a {@link RedisCapabilityResolver} with an {@link InMemoryCapabilityResolver}
21
- * fallback.
22
- * 3. Otherwise return an {@link InMemoryCapabilityResolver}.
23
- *
24
- * `ioredis` is loaded via dynamic `import()` so it remains an optional peer
25
- * dependency -- projects that do not use Redis never need to install it.
26
- */
27
- export async function createCapabilityResolver(options, logger) {
28
- // 1. User-provided resolver takes priority
29
- if (options?.capabilityResolver) {
30
- return options.capabilityResolver;
31
- }
32
- // 2. Attempt Redis when the env var is present
33
- const redisUrl = process.env.EMAIL_MANAGER_REDIS_URL;
34
- if (redisUrl) {
35
- try {
36
- // Dynamic import -- ioredis is an optional peer dependency.
37
- // The module specifier is kept in a variable to avoid TS2307 when
38
- // ioredis type declarations are not installed.
39
- const ioredisModule = 'ioredis';
40
- // eslint-disable-next-line @typescript-eslint/no-require-imports
41
- const { default: Redis } = await import(/* webpackIgnore: true */ ioredisModule);
42
- const { RedisCapabilityResolver } = await import('./redis-resolver.js');
43
- const { SafeCapabilityResolver } = await import('./safe-resolver.js');
44
- const redis = new Redis(redisUrl);
45
- const primary = new RedisCapabilityResolver({
46
- redis,
47
- namespace: options?.namespace,
48
- ttl: options?.ttl,
49
- });
50
- const fallback = new InMemoryCapabilityResolver();
51
- logger?.info('Using Redis-backed capability resolver', {
52
- redisUrl: redisUrl.replace(/\/\/.*@/, '//***@'),
53
- });
54
- return new SafeCapabilityResolver(primary, fallback, logger);
55
- }
56
- catch (error) {
57
- const code = error?.code;
58
- if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
59
- logger?.warn('ioredis not installed. Using InMemory capability resolver. Install ioredis for Redis-backed capability lookup.');
60
- }
61
- else {
62
- logger?.warn('Failed to initialize Redis capability resolver, using InMemory', { error });
63
- }
64
- return new InMemoryCapabilityResolver();
65
- }
66
- }
67
- // 3. Default: in-memory resolver
68
- return new InMemoryCapabilityResolver();
69
- }
70
- //# sourceMappingURL=resolver-factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver-factory.js","sourceRoot":"","sources":["../../src/capabilities/resolver-factory.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAGF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAoBrE,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAAgC,EAChC,MAA8B;IAE9B,2CAA2C;IAC3C,IAAI,OAAO,EAAE,kBAAkB,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,kBAAkB,CAAC;IACpC,CAAC;IAED,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IACrD,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC;YACH,4DAA4D;YAC5D,kEAAkE;Y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AAC1C,CAAC"}
@@ -1,40 +0,0 @@
1
- import type { CapabilityEntry } from '@bernierllc/email-sender';
2
- export declare class CapabilityResolverError extends Error {
3
- readonly code: string;
4
- constructor(message: string, code: string);
5
- }
6
- /**
7
- * Resolves capability entries for a given provider and feature combination.
8
- * Implementations may back this with static data, a database, or a remote API.
9
- */
10
- export interface CapabilityResolver {
11
- /**
12
- * Returns the capability entry for a specific provider + feature pair.
13
- * @throws {CapabilityResolverError} with code `UNKNOWN_PROVIDER` or `UNKNOWN_FEATURE`
14
- */
15
- getCapability(provider: string, feature: string): Promise<CapabilityEntry>;
16
- /**
17
- * Returns all feature capability entries for a given provider.
18
- * @throws {CapabilityResolverError} with code `UNKNOWN_PROVIDER`
19
- */
20
- getProviderCapabilities(provider: string): Promise<Record<string, CapabilityEntry>>;
21
- }
22
- /**
23
- * Extends the read-only resolver with mutation methods for overriding
24
- * capability entries at runtime.
25
- */
26
- export interface CapabilityResolverAdmin extends CapabilityResolver {
27
- /**
28
- * Overrides a single capability entry for a provider + feature pair.
29
- * The entry is validated against `capabilityEntrySchema` before storage.
30
- * @throws {CapabilityResolverError} with code `INVALID_ENTRY` on schema failure
31
- */
32
- setCapability(provider: string, feature: string, entry: CapabilityEntry): Promise<void>;
33
- /**
34
- * Replaces all capability entries for a provider.
35
- * Each entry is validated against `capabilityEntrySchema` before storage.
36
- * @throws {CapabilityResolverError} with code `INVALID_ENTRY` on schema failure
37
- */
38
- setProviderCapabilities(provider: string, capabilities: Record<string, CapabilityEntry>): Promise<void>;
39
- }
40
- //# sourceMappingURL=resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/capabilities/resolver.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAMhE,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAMD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE3E;;;OAGG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CACrF;AAMD;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExF;;;;OAIG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzG"}
@@ -1,18 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
- // ---------------------------------------------------------------------------
9
- // Error class
10
- // ---------------------------------------------------------------------------
11
- export class CapabilityResolverError extends Error {
12
- constructor(message, code) {
13
- super(message);
14
- this.name = 'CapabilityResolverError';
15
- this.code = code;
16
- }
17
- }
18
- //# sourceMappingURL=resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/capabilities/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAGhD,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -1,16 +0,0 @@
1
- import { RoutingMetadata } from '../types.js';
2
- /**
3
- * Factory function to create RoutingMetadata instances.
4
- *
5
- * RoutingMetadata tracks how a feature was routed across providers,
6
- * including degradation info and failover attempts.
7
- */
8
- export declare function createRoutingMetadata(params: {
9
- provider: string;
10
- feature: string;
11
- source: 'provider' | 'platform' | 'enhanced' | 'unsupported';
12
- degraded: boolean;
13
- degradationReason?: string;
14
- attemptedProviders?: string[];
15
- }): RoutingMetadata;
16
- //# sourceMappingURL=routing-metadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routing-metadata.d.ts","sourceRoot":"","sources":["../../src/capabilities/routing-metadata.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IAC7D,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,GAAG,eAAe,CAElB"}
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
- /**
9
- * Factory function to create RoutingMetadata instances.
10
- *
11
- * RoutingMetadata tracks how a feature was routed across providers,
12
- * including degradation info and failover attempts.
13
- */
14
- export function createRoutingMetadata(params) {
15
- return { ...params };
16
- }
17
- //# sourceMappingURL=routing-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routing-metadata.js","sourceRoot":"","sources":["../../src/capabilities/routing-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAOrC;IACC,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;AACvB,CAAC"}
@@ -1,24 +0,0 @@
1
- import type { CapabilityEntry } from '@bernierllc/email-sender';
2
- import type { CapabilityResolver } from './resolver.js';
3
- /**
4
- * Read-only wrapper that delegates to a primary {@link CapabilityResolver} and
5
- * falls back to a secondary resolver when the primary throws.
6
- *
7
- * This is useful for wrapping a {@link RedisCapabilityResolver} (primary) with
8
- * an {@link InMemoryCapabilityResolver} (fallback) so that capability lookups
9
- * always succeed even when Redis is unavailable.
10
- *
11
- * This class intentionally implements only {@link CapabilityResolver} (not
12
- * admin) -- mutations should go through the primary resolver directly.
13
- */
14
- export declare class SafeCapabilityResolver implements CapabilityResolver {
15
- private readonly primary;
16
- private readonly fallback;
17
- private readonly logger;
18
- constructor(primary: CapabilityResolver, fallback: CapabilityResolver, logger?: {
19
- warn: (...args: unknown[]) => void;
20
- });
21
- getCapability(provider: string, feature: string): Promise<CapabilityEntry>;
22
- getProviderCapabilities(provider: string): Promise<Record<string, CapabilityEntry>>;
23
- }
24
- //# sourceMappingURL=safe-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-resolver.d.ts","sourceRoot":"","sources":["../../src/capabilities/safe-resolver.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD;;;;;;;;;;GAUG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqD;gBAG1E,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE;IAO3C,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAc1E,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAY1F"}
@@ -1,48 +0,0 @@
1
- /*
2
- Copyright (c) 2025 Bernier LLC
3
-
4
- This file is licensed to the client under a limited-use license.
5
- The client may use and modify this code *only within the scope of the project it was delivered for*.
6
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
7
- */
8
- // ---------------------------------------------------------------------------
9
- // SafeCapabilityResolver
10
- // ---------------------------------------------------------------------------
11
- /**
12
- * Read-only wrapper that delegates to a primary {@link CapabilityResolver} and
13
- * falls back to a secondary resolver when the primary throws.
14
- *
15
- * This is useful for wrapping a {@link RedisCapabilityResolver} (primary) with
16
- * an {@link InMemoryCapabilityResolver} (fallback) so that capability lookups
17
- * always succeed even when Redis is unavailable.
18
- *
19
- * This class intentionally implements only {@link CapabilityResolver} (not
20
- * admin) -- mutations should go through the primary resolver directly.
21
- */
22
- export class SafeCapabilityResolver {
23
- constructor(primary, fallback, logger) {
24
- this.primary = primary;
25
- this.fallback = fallback;
26
- this.logger = logger;
27
- }
28
- async getCapability(provider, feature) {
29
- try {
30
- return await this.primary.getCapability(provider, feature);
31
- }
32
- catch (primaryError) {
33
- this.logger?.warn(`SafeCapabilityResolver: primary failed for getCapability("${provider}", "${feature}"), falling back`, primaryError);
34
- // Let fallback error propagate if it also fails
35
- return await this.fallback.getCapability(provider, feature);
36
- }
37
- }
38
- async getProviderCapabilities(provider) {
39
- try {
40
- return await this.primary.getProviderCapabilities(provider);
41
- }
42
- catch (primaryError) {
43
- this.logger?.warn(`SafeCapabilityResolver: primary failed for getProviderCapabilities("${provider}"), falling back`, primaryError);
44
- return await this.fallback.getProviderCapabilities(provider);
45
- }
46
- }
47
- }
48
- //# sourceMappingURL=safe-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-resolver.js","sourceRoot":"","sources":["../../src/capabilities/safe-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAMF,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,OAAO,sBAAsB;IAKjC,YACE,OAA2B,EAC3B,QAA4B,EAC5B,MAA+C;QAE/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,OAAe;QACnD,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,EAAE,IAAI,CACf,6DAA6D,QAAQ,OAAO,OAAO,kBAAkB,EACrG,YAAY,CACb,CAAC;YAEF,gDAAgD;YAChD,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,QAAgB;QAC5C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,EAAE,IAAI,CACf,uEAAuE,QAAQ,kBAAkB,EACjG,YAAY,CACb,CAAC;YAEF,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF"}
@@ -1,60 +0,0 @@
1
- import { ResolvedEmailManagerConfig, ConfigurationSource } from './types.js';
2
- /**
3
- * Configuration loader with source tracking and validation
4
- */
5
- export declare class EmailManagerConfigurationLoader {
6
- private sources;
7
- /**
8
- * Parse environment variable value to appropriate type
9
- */
10
- private parseEnvironmentValue;
11
- /**
12
- * Set nested object value using dot notation
13
- */
14
- private setNestedValue;
15
- /**
16
- * Merge configuration objects recursively
17
- */
18
- private mergeConfiguration;
19
- /**
20
- * Get default configuration values
21
- */
22
- private getDefaultConfiguration;
23
- /**
24
- * Load configuration from all sources with validation
25
- */
26
- loadConfiguration(): ResolvedEmailManagerConfig;
27
- /**
28
- * Configure core package dependencies with overrides
29
- */
30
- private configureCorePackageDependencies;
31
- /**
32
- * Get configuration sources for debugging
33
- */
34
- getConfigurationSources(): ConfigurationSource[];
35
- /**
36
- * Get environment variable documentation
37
- */
38
- getEnvironmentVariableDocumentation(): Record<string, string>;
39
- /**
40
- * Print resolved configuration with sensitive data redacted
41
- */
42
- printConfiguration(config: ResolvedEmailManagerConfig, redactSecrets?: boolean): string;
43
- }
44
- /**
45
- * Load email manager suite configuration
46
- * Main entry point for configuration loading
47
- */
48
- export declare function loadEmailManagerConfiguration(): ResolvedEmailManagerConfig;
49
- /**
50
- * Load configuration with source tracking for debugging
51
- */
52
- export declare function loadEmailManagerConfigurationWithSources(): {
53
- config: ResolvedEmailManagerConfig;
54
- sources: ConfigurationSource[];
55
- };
56
- /**
57
- * Get environment variable documentation
58
- */
59
- export declare function getEmailManagerEnvironmentDocumentation(): Record<string, string>;
60
- //# sourceMappingURL=loadConfiguration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadConfiguration.d.ts","sourceRoot":"","sources":["../../src/config/loadConfiguration.ts"],"names":[],"mappings":"AASA,OAAO,EAA6B,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA+FxG;;GAEG;AACH,qBAAa,+BAA+B;IAC1C,OAAO,CAAC,OAAO,CAA6B;IAE5C;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA4I/B;;OAEG;IACH,iBAAiB,IAAI,0BAA0B;IAuF/C;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAwBxC;;OAEG;IACH,uBAAuB,IAAI,mBAAmB,EAAE;IAIhD;;OAEG;IACH,mCAAmC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAU7D;;OAEG;IACH,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,EAAE,aAAa,GAAE,OAAc,GAAG,MAAM;CAqB9F;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,0BAA0B,CAG1E;AAED;;GAEG;AACH,wBAAgB,wCAAwC,IAAI;IAC1D,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,CAMA;AAED;;GAEG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGhF"}