@bernierllc/email-template-service 3.0.8 → 3.0.10
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/package.json +3 -3
- package/dist/database-adapter.d.ts +0 -59
- package/dist/database-adapter.d.ts.map +0 -1
- package/dist/database-adapter.js +0 -132
- package/dist/database-adapter.js.map +0 -1
- package/dist/email-template-service.d.ts +0 -131
- package/dist/email-template-service.d.ts.map +0 -1
- package/dist/email-template-service.js +0 -580
- package/dist/email-template-service.js.map +0 -1
- package/dist/errors.d.ts +0 -109
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -174
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -36
- package/dist/index.js.map +0 -1
- package/dist/provider-plugin.d.ts +0 -91
- package/dist/provider-plugin.d.ts.map +0 -1
- package/dist/provider-plugin.js +0 -161
- package/dist/provider-plugin.js.map +0 -1
- package/dist/types.d.ts +0 -322
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
package/dist/errors.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed error code union for email-template-service errors.
|
|
3
|
-
*/
|
|
4
|
-
export type EmailTemplateServiceErrorCode = 'EMAIL_TEMPLATE_SERVICE_ERROR' | 'TEMPLATE_NOT_FOUND' | 'BASE_TEMPLATE_NOT_FOUND' | 'TEMPLATE_VALIDATION_ERROR' | 'BASE_TEMPLATE_VALIDATION_ERROR' | 'PROVIDER_NOT_FOUND' | 'SYNC_ERROR' | 'SYNC_CONFLICT' | 'MANUAL_RESOLUTION_REQUIRED' | 'DATABASE_ERROR';
|
|
5
|
-
/**
|
|
6
|
-
* Options bag accepted by all email-template-service error classes.
|
|
7
|
-
*
|
|
8
|
-
* - `cause`: chained underlying error (ES2022 Error.cause).
|
|
9
|
-
* - `code`: a typed error code from {@link EmailTemplateServiceErrorCode}.
|
|
10
|
-
* - `context`: arbitrary structured context — templateId/errors/conflicts/etc.
|
|
11
|
-
*/
|
|
12
|
-
export interface EmailTemplateServiceErrorOptions {
|
|
13
|
-
cause?: Error;
|
|
14
|
-
code?: EmailTemplateServiceErrorCode;
|
|
15
|
-
context?: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Base error class for email template service.
|
|
19
|
-
*
|
|
20
|
-
* Uses native ES2022 `Error.cause` for error chaining — read the underlying
|
|
21
|
-
* error via `error.cause`. Subclass-specific fields (templateId, errors,
|
|
22
|
-
* conflicts) live on `error.context` since 2.0.0.
|
|
23
|
-
*/
|
|
24
|
-
export declare class EmailTemplateServiceError extends Error {
|
|
25
|
-
readonly code: EmailTemplateServiceErrorCode;
|
|
26
|
-
readonly context?: Record<string, unknown>;
|
|
27
|
-
constructor(message: string, options?: EmailTemplateServiceErrorOptions);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Template not found error.
|
|
31
|
-
*
|
|
32
|
-
* Convenience constructor accepts `templateId`; stored on `context.templateId`.
|
|
33
|
-
*/
|
|
34
|
-
export declare class TemplateNotFoundError extends EmailTemplateServiceError {
|
|
35
|
-
constructor(templateId: string, options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Base template not found error.
|
|
39
|
-
*
|
|
40
|
-
* Convenience constructor accepts `baseTemplateId`; stored on `context.baseTemplateId`.
|
|
41
|
-
*/
|
|
42
|
-
export declare class BaseTemplateNotFoundError extends EmailTemplateServiceError {
|
|
43
|
-
constructor(baseTemplateId: string, options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Template validation error.
|
|
47
|
-
*
|
|
48
|
-
* Convenience constructor accepts validation `errors` array; stored on `context.errors`.
|
|
49
|
-
*/
|
|
50
|
-
export declare class TemplateValidationError extends EmailTemplateServiceError {
|
|
51
|
-
constructor(errors: string[], options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Base template validation error.
|
|
55
|
-
*
|
|
56
|
-
* Convenience constructor accepts validation `errors` array; stored on `context.errors`.
|
|
57
|
-
*/
|
|
58
|
-
export declare class BaseTemplateValidationError extends EmailTemplateServiceError {
|
|
59
|
-
constructor(errors: string[], options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Provider not found error.
|
|
63
|
-
*
|
|
64
|
-
* Convenience constructor accepts `providerId`; stored on `context.providerId`.
|
|
65
|
-
*/
|
|
66
|
-
export declare class ProviderNotFoundError extends EmailTemplateServiceError {
|
|
67
|
-
constructor(providerId: string, options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Sync error.
|
|
71
|
-
*/
|
|
72
|
-
export declare class SyncError extends EmailTemplateServiceError {
|
|
73
|
-
constructor(message: string, options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Sync conflict error.
|
|
77
|
-
*
|
|
78
|
-
* Convenience constructor accepts `conflicts` array; stored on `context.conflicts`.
|
|
79
|
-
* Typed as `unknown[]` here to keep this file free of cross-module imports;
|
|
80
|
-
* consumers cast to `Conflict[]` from `./types` as needed.
|
|
81
|
-
*/
|
|
82
|
-
export declare class SyncConflictError extends EmailTemplateServiceError {
|
|
83
|
-
constructor(conflicts: unknown[], options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Conflict requires manual resolution error.
|
|
87
|
-
*
|
|
88
|
-
* Convenience constructor accepts `templateId` + `conflicts`; both stored on `context`.
|
|
89
|
-
*/
|
|
90
|
-
export declare class ConflictRequiresManualResolutionError extends EmailTemplateServiceError {
|
|
91
|
-
constructor(templateId: string, conflicts: unknown[], options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Database error.
|
|
95
|
-
*
|
|
96
|
-
* Read the underlying error via `error.cause` (the legacy `.originalError`
|
|
97
|
-
* field was removed in 2.0.0). Exported as `DatabaseError` and aliased as
|
|
98
|
-
* `EmailTemplateDatabaseError` for cross-package disambiguation.
|
|
99
|
-
*/
|
|
100
|
-
export declare class DatabaseError extends EmailTemplateServiceError {
|
|
101
|
-
constructor(message: string, options?: Omit<EmailTemplateServiceErrorOptions, 'code'>);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Cross-package naming alias for {@link DatabaseError}.
|
|
105
|
-
* Useful when consuming code wants to disambiguate between several
|
|
106
|
-
* package-specific database error classes via a fully qualified name.
|
|
107
|
-
*/
|
|
108
|
-
export { DatabaseError as EmailTemplateDatabaseError };
|
|
109
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,8BAA8B,GAC9B,oBAAoB,GACpB,yBAAyB,GACzB,2BAA2B,GAC3B,gCAAgC,GAChC,oBAAoB,GACpB,YAAY,GACZ,eAAe,GACf,4BAA4B,GAC5B,gBAAgB,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,WAAW,gCAAgC;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,6BAA6B,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;GAMG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,IAAI,EAAE,6BAA6B,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yB;gBAEhF,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,CAAC,EAAE,IAAI,CAAC,gCAAgC,EAAE,MAAM,CAAC;CAY3D;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,yBAAyB;gBAExD,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,IAAI,CAAC,gCAAgC,EAAE,MAAM,CAAC;CAQ3D;AAED;;;;GAIG;AACH,OAAO,EAAE,aAAa,IAAI,0BAA0B,EAAE,CAAC"}
|
package/dist/errors.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (c) 2025 Bernier LLC
|
|
4
|
-
|
|
5
|
-
This file is licensed to the client under a limited-use license.
|
|
6
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.EmailTemplateDatabaseError = exports.DatabaseError = exports.ConflictRequiresManualResolutionError = exports.SyncConflictError = exports.SyncError = exports.ProviderNotFoundError = exports.BaseTemplateValidationError = exports.TemplateValidationError = exports.BaseTemplateNotFoundError = exports.TemplateNotFoundError = exports.EmailTemplateServiceError = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Base error class for email template service.
|
|
13
|
-
*
|
|
14
|
-
* Uses native ES2022 `Error.cause` for error chaining — read the underlying
|
|
15
|
-
* error via `error.cause`. Subclass-specific fields (templateId, errors,
|
|
16
|
-
* conflicts) live on `error.context` since 2.0.0.
|
|
17
|
-
*/
|
|
18
|
-
class EmailTemplateServiceError extends Error {
|
|
19
|
-
code;
|
|
20
|
-
context;
|
|
21
|
-
constructor(message, options) {
|
|
22
|
-
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
23
|
-
this.name = 'EmailTemplateServiceError';
|
|
24
|
-
this.code = options?.code ?? 'EMAIL_TEMPLATE_SERVICE_ERROR';
|
|
25
|
-
if (options?.context !== undefined) {
|
|
26
|
-
this.context = options.context;
|
|
27
|
-
}
|
|
28
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.EmailTemplateServiceError = EmailTemplateServiceError;
|
|
32
|
-
/**
|
|
33
|
-
* Template not found error.
|
|
34
|
-
*
|
|
35
|
-
* Convenience constructor accepts `templateId`; stored on `context.templateId`.
|
|
36
|
-
*/
|
|
37
|
-
class TemplateNotFoundError extends EmailTemplateServiceError {
|
|
38
|
-
constructor(templateId, options) {
|
|
39
|
-
super(`Template not found: ${templateId}`, {
|
|
40
|
-
...options,
|
|
41
|
-
code: 'TEMPLATE_NOT_FOUND',
|
|
42
|
-
context: { ...(options?.context ?? {}), templateId },
|
|
43
|
-
});
|
|
44
|
-
this.name = 'TemplateNotFoundError';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.TemplateNotFoundError = TemplateNotFoundError;
|
|
48
|
-
/**
|
|
49
|
-
* Base template not found error.
|
|
50
|
-
*
|
|
51
|
-
* Convenience constructor accepts `baseTemplateId`; stored on `context.baseTemplateId`.
|
|
52
|
-
*/
|
|
53
|
-
class BaseTemplateNotFoundError extends EmailTemplateServiceError {
|
|
54
|
-
constructor(baseTemplateId, options) {
|
|
55
|
-
super(`Base template not found: ${baseTemplateId}`, {
|
|
56
|
-
...options,
|
|
57
|
-
code: 'BASE_TEMPLATE_NOT_FOUND',
|
|
58
|
-
context: { ...(options?.context ?? {}), baseTemplateId },
|
|
59
|
-
});
|
|
60
|
-
this.name = 'BaseTemplateNotFoundError';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.BaseTemplateNotFoundError = BaseTemplateNotFoundError;
|
|
64
|
-
/**
|
|
65
|
-
* Template validation error.
|
|
66
|
-
*
|
|
67
|
-
* Convenience constructor accepts validation `errors` array; stored on `context.errors`.
|
|
68
|
-
*/
|
|
69
|
-
class TemplateValidationError extends EmailTemplateServiceError {
|
|
70
|
-
constructor(errors, options) {
|
|
71
|
-
super(`Template validation failed: ${errors.join(', ')}`, {
|
|
72
|
-
...options,
|
|
73
|
-
code: 'TEMPLATE_VALIDATION_ERROR',
|
|
74
|
-
context: { ...(options?.context ?? {}), errors },
|
|
75
|
-
});
|
|
76
|
-
this.name = 'TemplateValidationError';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.TemplateValidationError = TemplateValidationError;
|
|
80
|
-
/**
|
|
81
|
-
* Base template validation error.
|
|
82
|
-
*
|
|
83
|
-
* Convenience constructor accepts validation `errors` array; stored on `context.errors`.
|
|
84
|
-
*/
|
|
85
|
-
class BaseTemplateValidationError extends EmailTemplateServiceError {
|
|
86
|
-
constructor(errors, options) {
|
|
87
|
-
super(`Base template validation failed: ${errors.join(', ')}`, {
|
|
88
|
-
...options,
|
|
89
|
-
code: 'BASE_TEMPLATE_VALIDATION_ERROR',
|
|
90
|
-
context: { ...(options?.context ?? {}), errors },
|
|
91
|
-
});
|
|
92
|
-
this.name = 'BaseTemplateValidationError';
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.BaseTemplateValidationError = BaseTemplateValidationError;
|
|
96
|
-
/**
|
|
97
|
-
* Provider not found error.
|
|
98
|
-
*
|
|
99
|
-
* Convenience constructor accepts `providerId`; stored on `context.providerId`.
|
|
100
|
-
*/
|
|
101
|
-
class ProviderNotFoundError extends EmailTemplateServiceError {
|
|
102
|
-
constructor(providerId, options) {
|
|
103
|
-
super(`Provider not found: ${providerId}`, {
|
|
104
|
-
...options,
|
|
105
|
-
code: 'PROVIDER_NOT_FOUND',
|
|
106
|
-
context: { ...(options?.context ?? {}), providerId },
|
|
107
|
-
});
|
|
108
|
-
this.name = 'ProviderNotFoundError';
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.ProviderNotFoundError = ProviderNotFoundError;
|
|
112
|
-
/**
|
|
113
|
-
* Sync error.
|
|
114
|
-
*/
|
|
115
|
-
class SyncError extends EmailTemplateServiceError {
|
|
116
|
-
constructor(message, options) {
|
|
117
|
-
super(message, { ...options, code: 'SYNC_ERROR' });
|
|
118
|
-
this.name = 'SyncError';
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.SyncError = SyncError;
|
|
122
|
-
/**
|
|
123
|
-
* Sync conflict error.
|
|
124
|
-
*
|
|
125
|
-
* Convenience constructor accepts `conflicts` array; stored on `context.conflicts`.
|
|
126
|
-
* Typed as `unknown[]` here to keep this file free of cross-module imports;
|
|
127
|
-
* consumers cast to `Conflict[]` from `./types` as needed.
|
|
128
|
-
*/
|
|
129
|
-
class SyncConflictError extends EmailTemplateServiceError {
|
|
130
|
-
constructor(conflicts, options) {
|
|
131
|
-
super(`Sync conflicts detected: ${conflicts.length} conflicts`, {
|
|
132
|
-
...options,
|
|
133
|
-
code: 'SYNC_CONFLICT',
|
|
134
|
-
context: { ...(options?.context ?? {}), conflicts },
|
|
135
|
-
});
|
|
136
|
-
this.name = 'SyncConflictError';
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.SyncConflictError = SyncConflictError;
|
|
140
|
-
/**
|
|
141
|
-
* Conflict requires manual resolution error.
|
|
142
|
-
*
|
|
143
|
-
* Convenience constructor accepts `templateId` + `conflicts`; both stored on `context`.
|
|
144
|
-
*/
|
|
145
|
-
class ConflictRequiresManualResolutionError extends EmailTemplateServiceError {
|
|
146
|
-
constructor(templateId, conflicts, options) {
|
|
147
|
-
super(`Template ${templateId} has conflicts requiring manual resolution: ${conflicts.length} conflicts`, {
|
|
148
|
-
...options,
|
|
149
|
-
code: 'MANUAL_RESOLUTION_REQUIRED',
|
|
150
|
-
context: { ...(options?.context ?? {}), templateId, conflicts },
|
|
151
|
-
});
|
|
152
|
-
this.name = 'ConflictRequiresManualResolutionError';
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.ConflictRequiresManualResolutionError = ConflictRequiresManualResolutionError;
|
|
156
|
-
/**
|
|
157
|
-
* Database error.
|
|
158
|
-
*
|
|
159
|
-
* Read the underlying error via `error.cause` (the legacy `.originalError`
|
|
160
|
-
* field was removed in 2.0.0). Exported as `DatabaseError` and aliased as
|
|
161
|
-
* `EmailTemplateDatabaseError` for cross-package disambiguation.
|
|
162
|
-
*/
|
|
163
|
-
class DatabaseError extends EmailTemplateServiceError {
|
|
164
|
-
constructor(message, options) {
|
|
165
|
-
super(`Database operation failed: ${message}`, {
|
|
166
|
-
...options,
|
|
167
|
-
code: 'DATABASE_ERROR',
|
|
168
|
-
});
|
|
169
|
-
this.name = 'DatabaseError';
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
exports.DatabaseError = DatabaseError;
|
|
173
|
-
exports.EmailTemplateDatabaseError = DatabaseError;
|
|
174
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AA8BF;;;;;;GAMG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAClC,IAAI,CAAgC;IACpC,OAAO,CAA2B;IAElD,YAAY,OAAe,EAAE,OAA0C;QACrE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,8BAA8B,CAAC;QAC5D,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,iBAAiB,EAAE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AC;IAClC,CAAC;CACF;AAZD,8CAYC;AAED;;;;GAIG;AACH,MAAa,qCAAsC,SAAQ,yBAAyB;IAClF,YACE,UAAkB,EAClB,SAAoB,EACpB,OAAwD;QAExD,KAAK,CACH,YAAY,UAAU,+CAA+C,SAAS,CAAC,MAAM,YAAY,EACjG;YACE,GAAG,OAAO;YACV,IAAI,EAAE,4BAA4B;YAClC,OAAO,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE;SAChE,CACF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uCAAuC,CAAC;IACtD,CAAC;CACF;AAhBD,sFAgBC;AAED;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,yBAAyB;IAC1D,YACE,OAAe,EACf,OAAwD;QAExD,KAAK,CAAC,8BAA8B,OAAO,EAAE,EAAE;YAC7C,GAAG,OAAO;YACV,IAAI,EAAE,gBAAgB;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAXD,sCAWC;AAOyB,mDAA0B"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @bernierllc/email-template-service
|
|
3
|
-
*
|
|
4
|
-
* Email template management service with provider synchronization,
|
|
5
|
-
* variable context validation, and base template support.
|
|
6
|
-
*/
|
|
7
|
-
export { EmailTemplateService, EmailTemplateServiceConfig, TemplateEngine, VariableRegistry, Logger } from './email-template-service';
|
|
8
|
-
export { TemplateProviderPlugin, BaseProviderPlugin, MockProviderPlugin } from './provider-plugin';
|
|
9
|
-
export { DatabaseAdapter, InMemoryDatabaseAdapter } from './database-adapter';
|
|
10
|
-
export { EmailTemplateServiceError, TemplateNotFoundError, BaseTemplateNotFoundError, TemplateValidationError, BaseTemplateValidationError, ProviderNotFoundError, SyncError, SyncConflictError, ConflictRequiresManualResolutionError, DatabaseError, EmailTemplateDatabaseError } from './errors';
|
|
11
|
-
export type { EmailTemplateServiceErrorCode, EmailTemplateServiceErrorOptions } from './errors';
|
|
12
|
-
export type { Template, TemplateDefinition, TemplateUpdate, BaseTemplate, BaseTemplateDefinition, BuiltTemplate, TemplateVariable, VariableContext, VariableContextVariable, ValidationResult, VariableSuggestion, ListOptions, PaginatedResult, SyncConfiguration, ProviderSyncConfig, SyncResult, BatchSyncResult, Conflict, ConflictResolution, ConflictResolutionStrategy, ProviderTemplate, ProviderCapability, FeatureConfig, ProviderStatus, PluginConfig, BrandingElement, SenderConfiguration, CacheConfiguration, VariableType, SyncStatus, SyncStrategy, SyncDirection, SyncAction, ConflictAction } from './types';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AAEH,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,MAAM,EACP,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,qCAAqC,EACrC,aAAa,EACb,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (c) 2025 Bernier LLC
|
|
4
|
-
|
|
5
|
-
This file is licensed to the client under a limited-use license.
|
|
6
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.EmailTemplateDatabaseError = exports.DatabaseError = exports.ConflictRequiresManualResolutionError = exports.SyncConflictError = exports.SyncError = exports.ProviderNotFoundError = exports.BaseTemplateValidationError = exports.TemplateValidationError = exports.BaseTemplateNotFoundError = exports.TemplateNotFoundError = exports.EmailTemplateServiceError = exports.InMemoryDatabaseAdapter = exports.MockProviderPlugin = exports.BaseProviderPlugin = exports.EmailTemplateService = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* @bernierllc/email-template-service
|
|
13
|
-
*
|
|
14
|
-
* Email template management service with provider synchronization,
|
|
15
|
-
* variable context validation, and base template support.
|
|
16
|
-
*/
|
|
17
|
-
var email_template_service_1 = require("./email-template-service");
|
|
18
|
-
Object.defineProperty(exports, "EmailTemplateService", { enumerable: true, get: function () { return email_template_service_1.EmailTemplateService; } });
|
|
19
|
-
var provider_plugin_1 = require("./provider-plugin");
|
|
20
|
-
Object.defineProperty(exports, "BaseProviderPlugin", { enumerable: true, get: function () { return provider_plugin_1.BaseProviderPlugin; } });
|
|
21
|
-
Object.defineProperty(exports, "MockProviderPlugin", { enumerable: true, get: function () { return provider_plugin_1.MockProviderPlugin; } });
|
|
22
|
-
var database_adapter_1 = require("./database-adapter");
|
|
23
|
-
Object.defineProperty(exports, "InMemoryDatabaseAdapter", { enumerable: true, get: function () { return database_adapter_1.InMemoryDatabaseAdapter; } });
|
|
24
|
-
var errors_1 = require("./errors");
|
|
25
|
-
Object.defineProperty(exports, "EmailTemplateServiceError", { enumerable: true, get: function () { return errors_1.EmailTemplateServiceError; } });
|
|
26
|
-
Object.defineProperty(exports, "TemplateNotFoundError", { enumerable: true, get: function () { return errors_1.TemplateNotFoundError; } });
|
|
27
|
-
Object.defineProperty(exports, "BaseTemplateNotFoundError", { enumerable: true, get: function () { return errors_1.BaseTemplateNotFoundError; } });
|
|
28
|
-
Object.defineProperty(exports, "TemplateValidationError", { enumerable: true, get: function () { return errors_1.TemplateValidationError; } });
|
|
29
|
-
Object.defineProperty(exports, "BaseTemplateValidationError", { enumerable: true, get: function () { return errors_1.BaseTemplateValidationError; } });
|
|
30
|
-
Object.defineProperty(exports, "ProviderNotFoundError", { enumerable: true, get: function () { return errors_1.ProviderNotFoundError; } });
|
|
31
|
-
Object.defineProperty(exports, "SyncError", { enumerable: true, get: function () { return errors_1.SyncError; } });
|
|
32
|
-
Object.defineProperty(exports, "SyncConflictError", { enumerable: true, get: function () { return errors_1.SyncConflictError; } });
|
|
33
|
-
Object.defineProperty(exports, "ConflictRequiresManualResolutionError", { enumerable: true, get: function () { return errors_1.ConflictRequiresManualResolutionError; } });
|
|
34
|
-
Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return errors_1.DatabaseError; } });
|
|
35
|
-
Object.defineProperty(exports, "EmailTemplateDatabaseError", { enumerable: true, get: function () { return errors_1.EmailTemplateDatabaseError; } });
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF;;;;;GAKG;AAEH,mEAMkC;AALhC,8HAAA,oBAAoB,OAAA;AAOtB,qDAI2B;AAFzB,qHAAA,kBAAkB,OAAA;AAClB,qHAAA,kBAAkB,OAAA;AAGpB,uDAG4B;AAD1B,2HAAA,uBAAuB,OAAA;AAGzB,mCAYkB;AAXhB,mHAAA,yBAAyB,OAAA;AACzB,+GAAA,qBAAqB,OAAA;AACrB,mHAAA,yBAAyB,OAAA;AACzB,iHAAA,uBAAuB,OAAA;AACvB,qHAAA,2BAA2B,OAAA;AAC3B,+GAAA,qBAAqB,OAAA;AACrB,mGAAA,SAAS,OAAA;AACT,2GAAA,iBAAiB,OAAA;AACjB,+HAAA,qCAAqC,OAAA;AACrC,uGAAA,aAAa,OAAA;AACb,oHAAA,0BAA0B,OAAA"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Template, ProviderTemplate, ProviderCapability, FeatureConfig, ProviderStatus, PluginConfig, SyncResult } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Template provider plugin interface
|
|
4
|
-
*
|
|
5
|
-
* Defines the contract for provider-specific template management implementations.
|
|
6
|
-
* Each provider (SendGrid, Mailgun, etc.) should implement this interface.
|
|
7
|
-
*/
|
|
8
|
-
export interface TemplateProviderPlugin {
|
|
9
|
-
/**
|
|
10
|
-
* Plugin identification
|
|
11
|
-
*/
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly version: string;
|
|
14
|
-
readonly providerId: string;
|
|
15
|
-
readonly capabilities: ProviderCapability[];
|
|
16
|
-
/**
|
|
17
|
-
* Plugin lifecycle management
|
|
18
|
-
*/
|
|
19
|
-
initialize(config: PluginConfig): Promise<void>;
|
|
20
|
-
destroy(): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Template operations
|
|
23
|
-
*/
|
|
24
|
-
createTemplate(template: Template): Promise<string>;
|
|
25
|
-
updateTemplate(providerTemplateId: string, template: Template): Promise<void>;
|
|
26
|
-
deleteTemplate(providerTemplateId: string): Promise<void>;
|
|
27
|
-
getTemplate(providerTemplateId: string): Promise<ProviderTemplate>;
|
|
28
|
-
listTemplates(): Promise<ProviderTemplate[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Synchronization
|
|
31
|
-
*/
|
|
32
|
-
syncToProvider(template: Template): Promise<SyncResult>;
|
|
33
|
-
syncFromProvider(providerTemplateId: string): Promise<Template>;
|
|
34
|
-
/**
|
|
35
|
-
* Capabilities
|
|
36
|
-
*/
|
|
37
|
-
supportsFeature(feature: string): boolean;
|
|
38
|
-
getFeatureConfig(feature: string): FeatureConfig | null;
|
|
39
|
-
/**
|
|
40
|
-
* Health and status
|
|
41
|
-
*/
|
|
42
|
-
testConnection(): Promise<boolean>;
|
|
43
|
-
getStatus(): Promise<ProviderStatus>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Base abstract class for provider plugins with common functionality
|
|
47
|
-
*/
|
|
48
|
-
export declare abstract class BaseProviderPlugin implements TemplateProviderPlugin {
|
|
49
|
-
abstract readonly name: string;
|
|
50
|
-
abstract readonly version: string;
|
|
51
|
-
abstract readonly providerId: string;
|
|
52
|
-
abstract readonly capabilities: ProviderCapability[];
|
|
53
|
-
protected config: PluginConfig;
|
|
54
|
-
protected initialized: boolean;
|
|
55
|
-
initialize(config: PluginConfig): Promise<void>;
|
|
56
|
-
destroy(): Promise<void>;
|
|
57
|
-
protected ensureInitialized(): void;
|
|
58
|
-
supportsFeature(feature: string): boolean;
|
|
59
|
-
getFeatureConfig(feature: string): FeatureConfig | null;
|
|
60
|
-
abstract createTemplate(template: Template): Promise<string>;
|
|
61
|
-
abstract updateTemplate(providerTemplateId: string, template: Template): Promise<void>;
|
|
62
|
-
abstract deleteTemplate(providerTemplateId: string): Promise<void>;
|
|
63
|
-
abstract getTemplate(providerTemplateId: string): Promise<ProviderTemplate>;
|
|
64
|
-
abstract listTemplates(): Promise<ProviderTemplate[]>;
|
|
65
|
-
abstract syncToProvider(template: Template): Promise<SyncResult>;
|
|
66
|
-
abstract syncFromProvider(providerTemplateId: string): Promise<Template>;
|
|
67
|
-
abstract testConnection(): Promise<boolean>;
|
|
68
|
-
abstract getStatus(): Promise<ProviderStatus>;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Mock provider plugin for testing
|
|
72
|
-
*/
|
|
73
|
-
export declare class MockProviderPlugin extends BaseProviderPlugin {
|
|
74
|
-
readonly name = "MockProvider";
|
|
75
|
-
readonly version = "1.0.0";
|
|
76
|
-
readonly providerId = "mock";
|
|
77
|
-
readonly capabilities: ProviderCapability[];
|
|
78
|
-
private templates;
|
|
79
|
-
private idCounter;
|
|
80
|
-
createTemplate(template: Template): Promise<string>;
|
|
81
|
-
updateTemplate(providerTemplateId: string, template: Template): Promise<void>;
|
|
82
|
-
deleteTemplate(providerTemplateId: string): Promise<void>;
|
|
83
|
-
getTemplate(providerTemplateId: string): Promise<ProviderTemplate>;
|
|
84
|
-
listTemplates(): Promise<ProviderTemplate[]>;
|
|
85
|
-
syncToProvider(template: Template): Promise<SyncResult>;
|
|
86
|
-
syncFromProvider(providerTemplateId: string): Promise<Template>;
|
|
87
|
-
testConnection(): Promise<boolean>;
|
|
88
|
-
getStatus(): Promise<ProviderStatus>;
|
|
89
|
-
clear(): void;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=provider-plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-plugin.d.ts","sourceRoot":"","sources":["../src/provider-plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG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ED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,UAAU,UAAU;IAC7B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,EAAE,CAMzC;IAEF,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,SAAS,CAAK;IAEhB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAcnD,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7E,cAAc,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzD,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IASlE,aAAa,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAK5C,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAWvD,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IA2B/D,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC;IAW1C,KAAK,IAAI,IAAI;CAId"}
|
package/dist/provider-plugin.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (c) 2025 Bernier LLC
|
|
4
|
-
|
|
5
|
-
This file is licensed to the client under a limited-use license.
|
|
6
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
7
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.MockProviderPlugin = exports.BaseProviderPlugin = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Base abstract class for provider plugins with common functionality
|
|
13
|
-
*/
|
|
14
|
-
class BaseProviderPlugin {
|
|
15
|
-
config = {};
|
|
16
|
-
initialized = false;
|
|
17
|
-
async initialize(config) {
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.initialized = true;
|
|
20
|
-
}
|
|
21
|
-
async destroy() {
|
|
22
|
-
this.initialized = false;
|
|
23
|
-
}
|
|
24
|
-
ensureInitialized() {
|
|
25
|
-
if (!this.initialized) {
|
|
26
|
-
throw new Error(`Plugin ${this.name} is not initialized`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
supportsFeature(feature) {
|
|
30
|
-
return this.capabilities.some(cap => cap.feature === feature);
|
|
31
|
-
}
|
|
32
|
-
getFeatureConfig(feature) {
|
|
33
|
-
const capability = this.capabilities.find(cap => cap.feature === feature);
|
|
34
|
-
if (!capability) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
enabled: true,
|
|
39
|
-
options: capability.config
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.BaseProviderPlugin = BaseProviderPlugin;
|
|
44
|
-
/**
|
|
45
|
-
* Mock provider plugin for testing
|
|
46
|
-
*/
|
|
47
|
-
class MockProviderPlugin extends BaseProviderPlugin {
|
|
48
|
-
name = 'MockProvider';
|
|
49
|
-
version = '1.0.0';
|
|
50
|
-
providerId = 'mock';
|
|
51
|
-
capabilities = [
|
|
52
|
-
{
|
|
53
|
-
feature: 'template-versioning',
|
|
54
|
-
description: 'Supports template versions',
|
|
55
|
-
methods: ['createTemplate', 'updateTemplate']
|
|
56
|
-
}
|
|
57
|
-
];
|
|
58
|
-
templates = new Map();
|
|
59
|
-
idCounter = 1;
|
|
60
|
-
async createTemplate(template) {
|
|
61
|
-
this.ensureInitialized();
|
|
62
|
-
const id = `mock_${this.idCounter++}`;
|
|
63
|
-
this.templates.set(id, {
|
|
64
|
-
id,
|
|
65
|
-
name: template.name,
|
|
66
|
-
subject: template.subject,
|
|
67
|
-
htmlContent: template.htmlContent,
|
|
68
|
-
textContent: template.textContent,
|
|
69
|
-
updatedAt: new Date()
|
|
70
|
-
});
|
|
71
|
-
return id;
|
|
72
|
-
}
|
|
73
|
-
async updateTemplate(providerTemplateId, template) {
|
|
74
|
-
this.ensureInitialized();
|
|
75
|
-
const existing = this.templates.get(providerTemplateId);
|
|
76
|
-
if (!existing) {
|
|
77
|
-
throw new Error(`Template not found: ${providerTemplateId}`);
|
|
78
|
-
}
|
|
79
|
-
this.templates.set(providerTemplateId, {
|
|
80
|
-
...existing,
|
|
81
|
-
name: template.name,
|
|
82
|
-
subject: template.subject,
|
|
83
|
-
htmlContent: template.htmlContent,
|
|
84
|
-
textContent: template.textContent,
|
|
85
|
-
updatedAt: new Date()
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async deleteTemplate(providerTemplateId) {
|
|
89
|
-
this.ensureInitialized();
|
|
90
|
-
if (!this.templates.has(providerTemplateId)) {
|
|
91
|
-
throw new Error(`Template not found: ${providerTemplateId}`);
|
|
92
|
-
}
|
|
93
|
-
this.templates.delete(providerTemplateId);
|
|
94
|
-
}
|
|
95
|
-
async getTemplate(providerTemplateId) {
|
|
96
|
-
this.ensureInitialized();
|
|
97
|
-
const template = this.templates.get(providerTemplateId);
|
|
98
|
-
if (!template) {
|
|
99
|
-
throw new Error(`Template not found: ${providerTemplateId}`);
|
|
100
|
-
}
|
|
101
|
-
return template;
|
|
102
|
-
}
|
|
103
|
-
async listTemplates() {
|
|
104
|
-
this.ensureInitialized();
|
|
105
|
-
return Array.from(this.templates.values());
|
|
106
|
-
}
|
|
107
|
-
async syncToProvider(template) {
|
|
108
|
-
this.ensureInitialized();
|
|
109
|
-
const id = await this.createTemplate(template);
|
|
110
|
-
return {
|
|
111
|
-
success: true,
|
|
112
|
-
action: 'created',
|
|
113
|
-
providerTemplateId: id,
|
|
114
|
-
localTemplateId: template.id
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
async syncFromProvider(providerTemplateId) {
|
|
118
|
-
this.ensureInitialized();
|
|
119
|
-
const providerTemplate = await this.getTemplate(providerTemplateId);
|
|
120
|
-
return {
|
|
121
|
-
id: `local_${providerTemplateId}`,
|
|
122
|
-
name: providerTemplate.name,
|
|
123
|
-
subject: providerTemplate.subject || '',
|
|
124
|
-
htmlContent: providerTemplate.htmlContent || '',
|
|
125
|
-
textContent: providerTemplate.textContent,
|
|
126
|
-
category: undefined,
|
|
127
|
-
tags: [],
|
|
128
|
-
version: '1.0.0',
|
|
129
|
-
isActive: true,
|
|
130
|
-
context: undefined,
|
|
131
|
-
variables: [],
|
|
132
|
-
requiredVariables: [],
|
|
133
|
-
providerTemplateIds: { [this.providerId]: providerTemplateId },
|
|
134
|
-
lastSyncedAt: {},
|
|
135
|
-
syncStatus: {},
|
|
136
|
-
createdAt: new Date(),
|
|
137
|
-
updatedAt: new Date(),
|
|
138
|
-
createdBy: 'system',
|
|
139
|
-
lastModifiedBy: 'system'
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
async testConnection() {
|
|
143
|
-
return this.initialized;
|
|
144
|
-
}
|
|
145
|
-
async getStatus() {
|
|
146
|
-
return {
|
|
147
|
-
connected: this.initialized,
|
|
148
|
-
lastCheck: new Date(),
|
|
149
|
-
metrics: {
|
|
150
|
-
templateCount: this.templates.size
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
// Helper for testing
|
|
155
|
-
clear() {
|
|
156
|
-
this.templates.clear();
|
|
157
|
-
this.idCounter = 1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.MockProviderPlugin = MockProviderPlugin;
|
|
161
|
-
//# sourceMappingURL=provider-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-plugin.js","sourceRoot":"","sources":["../src/provider-plugin.ts"],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