@guildeducationinc/benefits-admin-policy-sdk 1.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 +78 -0
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +6 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/s3-adapter.d.ts +41 -0
- package/dist/adapters/s3-adapter.d.ts.map +1 -0
- package/dist/adapters/s3-adapter.js +96 -0
- package/dist/adapters/s3-adapter.js.map +1 -0
- package/dist/clients/policy-client.d.ts +141 -0
- package/dist/clients/policy-client.d.ts.map +1 -0
- package/dist/clients/policy-client.js +427 -0
- package/dist/clients/policy-client.js.map +1 -0
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/index.d.ts +38 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +75 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/guildeducationinc-benefits-admin-policy-sdk-1.1.0.tgz +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +7 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/policy-override.d.ts +528 -0
- package/dist/models/policy-override.d.ts.map +1 -0
- package/dist/models/policy-override.js +7 -0
- package/dist/models/policy-override.js.map +1 -0
- package/dist/models/policy-version.d.ts +948 -0
- package/dist/models/policy-version.d.ts.map +1 -0
- package/dist/models/policy-version.js +7 -0
- package/dist/models/policy-version.js.map +1 -0
- package/dist/models/policy.d.ts +34 -0
- package/dist/models/policy.d.ts.map +1 -0
- package/dist/models/policy.js +7 -0
- package/dist/models/policy.js.map +1 -0
- package/dist/schemas/index.d.ts +23 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +31 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/policy-override.schema.json +627 -0
- package/dist/schemas/policy-version.schema.json +1242 -0
- package/dist/schemas/policy.schema.json +31 -0
- package/package.json +64 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyClient = void 0;
|
|
4
|
+
const client_ssm_1 = require("@aws-sdk/client-ssm");
|
|
5
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
6
|
+
const s3_adapter_1 = require("../adapters/s3-adapter");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const errors_1 = require("../errors");
|
|
9
|
+
/**
|
|
10
|
+
* Client for retrieving Policy documents from S3 storage.
|
|
11
|
+
*
|
|
12
|
+
* Provides methods to list policies for employers and retrieve policy versions
|
|
13
|
+
* from S3 storage. Automatically handles AWS credential management and S3
|
|
14
|
+
* client configuration with TTL-based caching.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Create a client instance
|
|
19
|
+
* const client = new PolicyClient();
|
|
20
|
+
*
|
|
21
|
+
* // List all policies for an employer
|
|
22
|
+
* const policyUris = await client.listPolicies('employer-uuid');
|
|
23
|
+
*
|
|
24
|
+
* // Retrieve a specific policy version by URI
|
|
25
|
+
* const policyVersion = await client.retrievePolicyVersion('path/to/policy.json');
|
|
26
|
+
*
|
|
27
|
+
* // Retrieve the current active policy version
|
|
28
|
+
* const currentPolicy = await client.retrieveCurrentPolicyVersion('policy-uuid');
|
|
29
|
+
*
|
|
30
|
+
* // Retrieve policy version as of a specific date
|
|
31
|
+
* const historicalPolicy = await client.retrieveCurrentPolicyVersion('policy-uuid', '2025-01-15');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class PolicyClient {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.s3Adapter = null;
|
|
37
|
+
this.s3AdapterExpiresAt = 0;
|
|
38
|
+
this.bucketName = null;
|
|
39
|
+
this.policyUriPrefix = null;
|
|
40
|
+
this.policyUriPrefixExpiresAt = 0;
|
|
41
|
+
this.region = constants_1.DEFAULT_REGION;
|
|
42
|
+
// Validate STAGE environment variable early
|
|
43
|
+
this.getBucketName();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the AWS region
|
|
47
|
+
*/
|
|
48
|
+
getRegion() {
|
|
49
|
+
return this.region;
|
|
50
|
+
}
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Public API Methods
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* List all policy URIs for a given employer.
|
|
56
|
+
*
|
|
57
|
+
* @param employerId - The UUID of the employer to list policies for
|
|
58
|
+
* @returns A list of full S3 URIs for all policies under the given employer
|
|
59
|
+
*/
|
|
60
|
+
async listPolicies(employerId) {
|
|
61
|
+
const policyUriPrefix = await this.getPolicyUriPrefix();
|
|
62
|
+
const prefix = `${policyUriPrefix}/employers/${employerId}/policies/`;
|
|
63
|
+
const bucketName = this.getBucketName();
|
|
64
|
+
const s3Client = await this.getS3Client();
|
|
65
|
+
const keys = await s3Client.listAllUrisByPrefix(prefix);
|
|
66
|
+
return keys.map((key) => `s3://${bucketName}/${key}`);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Retrieve a PolicyVersion from S3 using the given URI.
|
|
70
|
+
*
|
|
71
|
+
* @param uri - The S3 URI or resource path for the PolicyVersion. Can be:
|
|
72
|
+
* - Full S3 URI (e.g., "s3://bucket/path/file.json")
|
|
73
|
+
* - Relative resource path (e.g., "path/to/policy.json")
|
|
74
|
+
*
|
|
75
|
+
* @returns The deserialized PolicyVersion object
|
|
76
|
+
*
|
|
77
|
+
* @throws PolicySdkConfigurationError - If the uri format is invalid
|
|
78
|
+
* @throws PolicyVersionNotFoundError - If the PolicyVersion resource is not found
|
|
79
|
+
* @throws PolicyVersionDeserializationError - If the JSON cannot be deserialized
|
|
80
|
+
*/
|
|
81
|
+
async retrievePolicyVersion(uri) {
|
|
82
|
+
// Fast-fail validation
|
|
83
|
+
const resourcePath = this.validatePolicyVersionUri(uri);
|
|
84
|
+
const s3Client = await this.getS3Client();
|
|
85
|
+
const policyVersionJson = await s3Client.retrieveObject(resourcePath);
|
|
86
|
+
if (!policyVersionJson) {
|
|
87
|
+
throw new errors_1.PolicyVersionNotFoundError(uri);
|
|
88
|
+
}
|
|
89
|
+
return this.deserializePolicyVersion(policyVersionJson);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Retrieve the most recent active PolicyVersion for a given policy.
|
|
93
|
+
*
|
|
94
|
+
* This function finds the most recently published policy version for the specified date.
|
|
95
|
+
* If no date is provided, it defaults to the current "coverage day" (4am ET - 4am ET).
|
|
96
|
+
* If no policy version exists for the target date, it finds the most recently published
|
|
97
|
+
* version prior to that date.
|
|
98
|
+
*
|
|
99
|
+
* @param policyId - The policy identifier, which can be:
|
|
100
|
+
* - UUID string (e.g., "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d")
|
|
101
|
+
* - Full S3 URI (e.g., "s3://{bucket}/{dataset}/employers/{employer_id}/policies/{policy_uuid}.json")
|
|
102
|
+
* - Relative resource path (e.g., "{dataset}/employers/{employer_id}/policies/{policy_uuid}.json")
|
|
103
|
+
*
|
|
104
|
+
* @param asOf - Optional date to use when finding the current policy version.
|
|
105
|
+
* Can be a Date object or a date string in 'YYYY-MM-DD' format.
|
|
106
|
+
* Defaults to the current coverage day (4am ET - 4am ET) if not provided.
|
|
107
|
+
*
|
|
108
|
+
* @returns The most recent active PolicyVersion for the specified date
|
|
109
|
+
*
|
|
110
|
+
* @throws PolicyVersionNotFoundError - If no active policy version is found
|
|
111
|
+
* @throws PolicyVersionDeserializationError - If the JSON cannot be deserialized
|
|
112
|
+
* @throws PolicySdkConfigurationError - If the policy_id or as_of format is invalid
|
|
113
|
+
*/
|
|
114
|
+
async retrieveCurrentPolicyVersion(policyId, asOf) {
|
|
115
|
+
// Parse inputs
|
|
116
|
+
const { uuid: policyUuid, datasetPrefix: extractedDatasetPrefix } = this.parsePolicyId(policyId);
|
|
117
|
+
const targetDate = this.parseAsOfDate(asOf);
|
|
118
|
+
// Determine dataset prefix (use extracted or fetch from SSM)
|
|
119
|
+
const datasetPrefix = extractedDatasetPrefix ?? (await this.getPolicyUriPrefix());
|
|
120
|
+
// List all policy version keys
|
|
121
|
+
const basePrefix = `${datasetPrefix}/policies/${policyUuid}/active/`;
|
|
122
|
+
const s3Client = await this.getS3Client();
|
|
123
|
+
const allKeys = await s3Client.listAllUrisByPrefix(basePrefix);
|
|
124
|
+
if (allKeys.length === 0) {
|
|
125
|
+
throw new errors_1.PolicyVersionNotFoundError(`No active policy versions found for policy ${policyUuid}`);
|
|
126
|
+
}
|
|
127
|
+
// Filter versions by date
|
|
128
|
+
const validKeys = this.filterPolicyVersionsByDate(allKeys, targetDate);
|
|
129
|
+
if (validKeys.length === 0) {
|
|
130
|
+
throw new errors_1.PolicyVersionNotFoundError(`No active policy versions found for policy ${policyUuid} on or before ${this.formatDate(targetDate)}`);
|
|
131
|
+
}
|
|
132
|
+
// Get the most recent version (sort by date descending)
|
|
133
|
+
validKeys.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
134
|
+
const mostRecentKey = validKeys[0].key;
|
|
135
|
+
// Retrieve and return
|
|
136
|
+
const policyVersionJson = await s3Client.retrieveObject(mostRecentKey);
|
|
137
|
+
if (!policyVersionJson) {
|
|
138
|
+
throw new errors_1.PolicyVersionNotFoundError(mostRecentKey);
|
|
139
|
+
}
|
|
140
|
+
return this.deserializePolicyVersion(policyVersionJson);
|
|
141
|
+
}
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// AWS Credential Management
|
|
144
|
+
// ============================================================================
|
|
145
|
+
/**
|
|
146
|
+
* Get the S3 bucket name based on the STAGE environment variable
|
|
147
|
+
*/
|
|
148
|
+
getBucketName() {
|
|
149
|
+
if (this.bucketName) {
|
|
150
|
+
return this.bucketName;
|
|
151
|
+
}
|
|
152
|
+
const stage = process.env['STAGE'];
|
|
153
|
+
if (!stage) {
|
|
154
|
+
throw new errors_1.PolicySdkConfigurationError('STAGE env var must be set to determine S3 bucket');
|
|
155
|
+
}
|
|
156
|
+
this.bucketName = `${constants_1.POLICY_BUCKET_NAME_PREFIX}-${stage}`;
|
|
157
|
+
return this.bucketName;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get the BA consumer role ARN from SSM parameter store
|
|
161
|
+
*/
|
|
162
|
+
async getConsumerRoleArn() {
|
|
163
|
+
try {
|
|
164
|
+
const ssmClient = new client_ssm_1.SSMClient({ region: this.region });
|
|
165
|
+
const command = new client_ssm_1.GetParameterCommand({
|
|
166
|
+
Name: constants_1.BA_CONSUMER_ROLE_PARAMETER_NAME,
|
|
167
|
+
WithDecryption: false,
|
|
168
|
+
});
|
|
169
|
+
const response = await ssmClient.send(command);
|
|
170
|
+
const value = response.Parameter?.Value;
|
|
171
|
+
if (!value) {
|
|
172
|
+
throw new errors_1.PolicySdkAwsError(`SSM parameter ${constants_1.BA_CONSUMER_ROLE_PARAMETER_NAME} not found or has no value`);
|
|
173
|
+
}
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error instanceof Error && error.message.includes('AccessDenied')) {
|
|
178
|
+
throw new errors_1.PolicySdkSsmParameterAccessError(constants_1.BA_CONSUMER_ROLE_PARAMETER_NAME, undefined, error);
|
|
179
|
+
}
|
|
180
|
+
throw new errors_1.PolicySdkAwsError(`Failed to get BA consumer role ARN from SSM: ${error instanceof Error ? error.message : 'Unknown error'}`, error instanceof Error ? error : undefined);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Assume the BA consumer role using STS
|
|
185
|
+
*/
|
|
186
|
+
async assumeRole(roleArn) {
|
|
187
|
+
try {
|
|
188
|
+
const stsClient = new client_sts_1.STSClient({ region: this.region });
|
|
189
|
+
const command = new client_sts_1.AssumeRoleCommand({
|
|
190
|
+
RoleArn: roleArn,
|
|
191
|
+
RoleSessionName: constants_1.ROLE_SESSION_NAME,
|
|
192
|
+
DurationSeconds: 3600, // 1 hour
|
|
193
|
+
});
|
|
194
|
+
const response = await stsClient.send(command);
|
|
195
|
+
const credentials = response.Credentials;
|
|
196
|
+
if (!credentials?.AccessKeyId ||
|
|
197
|
+
!credentials?.SecretAccessKey ||
|
|
198
|
+
!credentials?.SessionToken) {
|
|
199
|
+
throw new errors_1.PolicySdkAwsError('Failed to obtain valid credentials from STS');
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
accessKeyId: credentials.AccessKeyId,
|
|
203
|
+
secretAccessKey: credentials.SecretAccessKey,
|
|
204
|
+
sessionToken: credentials.SessionToken,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
if (error instanceof errors_1.PolicySdkAwsError) {
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
throw new errors_1.PolicySdkAwsError(`Failed to assume role ${roleArn}: ${error instanceof Error ? error.message : 'Unknown error'}`, error instanceof Error ? error : undefined);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get or create the S3 adapter with caching
|
|
216
|
+
*/
|
|
217
|
+
async getS3Client() {
|
|
218
|
+
const now = Date.now();
|
|
219
|
+
// Return cached client if still valid
|
|
220
|
+
if (this.s3Adapter && this.s3AdapterExpiresAt > now) {
|
|
221
|
+
return this.s3Adapter;
|
|
222
|
+
}
|
|
223
|
+
const bucketName = this.getBucketName();
|
|
224
|
+
const roleArn = await this.getConsumerRoleArn();
|
|
225
|
+
const credentials = await this.assumeRole(roleArn);
|
|
226
|
+
this.s3Adapter = new s3_adapter_1.S3Adapter(bucketName, this.region, credentials);
|
|
227
|
+
this.s3AdapterExpiresAt = now + constants_1.S3_CLIENT_TTL_MS;
|
|
228
|
+
return this.s3Adapter;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the policy URI prefix from SSM Parameter Store
|
|
232
|
+
*/
|
|
233
|
+
async getPolicyUriPrefix() {
|
|
234
|
+
const now = Date.now();
|
|
235
|
+
const TTL_MS = 120 * 1000; // 2 minutes
|
|
236
|
+
// Return cached value if still valid
|
|
237
|
+
if (this.policyUriPrefix && this.policyUriPrefixExpiresAt > now) {
|
|
238
|
+
return this.policyUriPrefix;
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
const ssmClient = new client_ssm_1.SSMClient({ region: this.region });
|
|
242
|
+
const command = new client_ssm_1.GetParameterCommand({
|
|
243
|
+
Name: constants_1.POLICY_URI_PREFIX_PARAMETER_NAME,
|
|
244
|
+
WithDecryption: false,
|
|
245
|
+
});
|
|
246
|
+
const response = await ssmClient.send(command);
|
|
247
|
+
const value = response.Parameter?.Value;
|
|
248
|
+
if (!value) {
|
|
249
|
+
throw new errors_1.PolicySdkAwsError(`SSM parameter ${constants_1.POLICY_URI_PREFIX_PARAMETER_NAME} not found or has no value`);
|
|
250
|
+
}
|
|
251
|
+
this.policyUriPrefix = value;
|
|
252
|
+
this.policyUriPrefixExpiresAt = now + TTL_MS;
|
|
253
|
+
return value;
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
if (error instanceof Error && error.message.includes('AccessDenied')) {
|
|
257
|
+
throw new errors_1.PolicySdkSsmParameterAccessError(constants_1.POLICY_URI_PREFIX_PARAMETER_NAME, undefined, error);
|
|
258
|
+
}
|
|
259
|
+
throw new errors_1.PolicySdkAwsError(`Failed to get policy URI prefix from SSM: ${error instanceof Error ? error.message : 'Unknown error'}`, error instanceof Error ? error : undefined);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// ============================================================================
|
|
263
|
+
// Helper Methods
|
|
264
|
+
// ============================================================================
|
|
265
|
+
/**
|
|
266
|
+
* Get the current coverage day based on ET timezone.
|
|
267
|
+
*
|
|
268
|
+
* A "coverage day" runs from 4am ET to 4am ET the next calendar day.
|
|
269
|
+
* This prevents timezone-related edge cases where UTC midnight doesn't align
|
|
270
|
+
* with business operations.
|
|
271
|
+
*/
|
|
272
|
+
getCoverageDay() {
|
|
273
|
+
const now = new Date();
|
|
274
|
+
const etFormatter = new Intl.DateTimeFormat('en-US', {
|
|
275
|
+
timeZone: 'America/New_York',
|
|
276
|
+
year: 'numeric',
|
|
277
|
+
month: '2-digit',
|
|
278
|
+
day: '2-digit',
|
|
279
|
+
hour: '2-digit',
|
|
280
|
+
hour12: false,
|
|
281
|
+
});
|
|
282
|
+
const parts = etFormatter.formatToParts(now);
|
|
283
|
+
const year = parseInt(parts.find((p) => p.type === 'year')?.value || '0', 10);
|
|
284
|
+
const month = parseInt(parts.find((p) => p.type === 'month')?.value || '0', 10);
|
|
285
|
+
const day = parseInt(parts.find((p) => p.type === 'day')?.value || '0', 10);
|
|
286
|
+
const hour = parseInt(parts.find((p) => p.type === 'hour')?.value || '0', 10);
|
|
287
|
+
const coverageDate = new Date(year, month - 1, day);
|
|
288
|
+
// If it's before 4am ET, the coverage day is the previous calendar day
|
|
289
|
+
if (hour < 4) {
|
|
290
|
+
coverageDate.setDate(coverageDate.getDate() - 1);
|
|
291
|
+
}
|
|
292
|
+
return coverageDate;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Format a date as YYYY-MM-DD string
|
|
296
|
+
*/
|
|
297
|
+
formatDate(date) {
|
|
298
|
+
const year = date.getFullYear();
|
|
299
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
300
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
301
|
+
return `${year}-${month}-${day}`;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Parse a date string or Date object into a Date
|
|
305
|
+
*/
|
|
306
|
+
parseAsOfDate(asOf) {
|
|
307
|
+
if (asOf === null || asOf === undefined) {
|
|
308
|
+
return this.getCoverageDay();
|
|
309
|
+
}
|
|
310
|
+
if (asOf instanceof Date) {
|
|
311
|
+
return asOf;
|
|
312
|
+
}
|
|
313
|
+
if (typeof asOf === 'string') {
|
|
314
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(asOf);
|
|
315
|
+
if (!match) {
|
|
316
|
+
throw new errors_1.PolicySdkConfigurationError(`Invalid date format for as_of. Expected 'YYYY-MM-DD', got: ${asOf}`);
|
|
317
|
+
}
|
|
318
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
319
|
+
return new Date(parseInt(yearStr, 10), parseInt(monthStr, 10) - 1, parseInt(dayStr, 10));
|
|
320
|
+
}
|
|
321
|
+
throw new errors_1.PolicySdkConfigurationError(`Invalid type for as_of. Expected Date or string, got: ${typeof asOf}`);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Validate and convert a policy version URI to a resource path
|
|
325
|
+
*/
|
|
326
|
+
validatePolicyVersionUri(uri) {
|
|
327
|
+
if (typeof uri !== 'string') {
|
|
328
|
+
throw new errors_1.PolicySdkConfigurationError(`Invalid uri type. Expected string, got: ${typeof uri}`);
|
|
329
|
+
}
|
|
330
|
+
if (!uri.includes('/')) {
|
|
331
|
+
throw new errors_1.PolicySdkConfigurationError(`Invalid uri format. Expected S3 URI (s3://bucket/path) or ` +
|
|
332
|
+
`resource path (path/to/file.json), got: ${uri}`);
|
|
333
|
+
}
|
|
334
|
+
const bucketName = this.getBucketName();
|
|
335
|
+
const s3BucketPrefix = `s3://${bucketName}/`;
|
|
336
|
+
if (uri.startsWith('s3://')) {
|
|
337
|
+
if (!uri.startsWith(s3BucketPrefix)) {
|
|
338
|
+
throw new errors_1.PolicySdkConfigurationError(`S3 URI must be for bucket ${bucketName}, got: ${uri}`);
|
|
339
|
+
}
|
|
340
|
+
return uri.substring(s3BucketPrefix.length);
|
|
341
|
+
}
|
|
342
|
+
return uri;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Parse policy_id and extract UUID and optional dataset prefix
|
|
346
|
+
*/
|
|
347
|
+
parsePolicyId(policyId) {
|
|
348
|
+
const bucketName = this.getBucketName();
|
|
349
|
+
const s3BucketPrefix = `s3://${bucketName}/`;
|
|
350
|
+
if (policyId.startsWith('s3://')) {
|
|
351
|
+
if (!policyId.startsWith(s3BucketPrefix)) {
|
|
352
|
+
throw new errors_1.PolicySdkConfigurationError(`S3 URI must be for bucket ${bucketName}, got: ${policyId}`);
|
|
353
|
+
}
|
|
354
|
+
const resourcePath = policyId.substring(s3BucketPrefix.length);
|
|
355
|
+
return this.extractDatasetAndUuid(resourcePath);
|
|
356
|
+
}
|
|
357
|
+
else if (policyId.includes('/')) {
|
|
358
|
+
return this.extractDatasetAndUuid(policyId);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
const uuidRegex = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
362
|
+
if (!uuidRegex.test(policyId)) {
|
|
363
|
+
throw new errors_1.PolicySdkConfigurationError(`Invalid policy_id format. Must be a UUID, S3 URI, or ` +
|
|
364
|
+
`resource path, got: ${policyId}`);
|
|
365
|
+
}
|
|
366
|
+
return { uuid: policyId, datasetPrefix: null };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Extract dataset prefix and UUID from a resource path
|
|
371
|
+
*/
|
|
372
|
+
extractDatasetAndUuid(resourcePath) {
|
|
373
|
+
const uriPattern = /^([^/]+)\/employers\/[a-f0-9-]+\/policies\/([a-f0-9-]+)\.json$/i;
|
|
374
|
+
const match = uriPattern.exec(resourcePath);
|
|
375
|
+
if (!match) {
|
|
376
|
+
throw new errors_1.PolicySdkConfigurationError('Invalid resource path format for policy_id. Expected format: ' +
|
|
377
|
+
'{dataset}/employers/{employer_id}/policies/{policy_uuid}.json or ' +
|
|
378
|
+
's3://{bucket}/{dataset}/employers/{employer_id}/policies/{policy_uuid}.json');
|
|
379
|
+
}
|
|
380
|
+
return {
|
|
381
|
+
datasetPrefix: match[1],
|
|
382
|
+
uuid: match[2],
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Filter policy version keys by date, keeping only those on or before target_date
|
|
387
|
+
*/
|
|
388
|
+
filterPolicyVersionsByDate(keys, targetDate) {
|
|
389
|
+
const datePattern = /\/(\d{4})\/(\d{2})\/(\d{2})\/[^/]+\.json$/;
|
|
390
|
+
const validKeys = [];
|
|
391
|
+
for (const key of keys) {
|
|
392
|
+
const match = datePattern.exec(key);
|
|
393
|
+
if (match) {
|
|
394
|
+
const year = parseInt(match[1], 10);
|
|
395
|
+
const month = parseInt(match[2], 10);
|
|
396
|
+
const day = parseInt(match[3], 10);
|
|
397
|
+
try {
|
|
398
|
+
const keyDate = new Date(year, month - 1, day);
|
|
399
|
+
if (keyDate.getFullYear() === year &&
|
|
400
|
+
keyDate.getMonth() === month - 1 &&
|
|
401
|
+
keyDate.getDate() === day) {
|
|
402
|
+
if (keyDate <= targetDate) {
|
|
403
|
+
validKeys.push({ key, date: keyDate });
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return validKeys;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Deserialize JSON string to PolicyVersion
|
|
416
|
+
*/
|
|
417
|
+
deserializePolicyVersion(json) {
|
|
418
|
+
try {
|
|
419
|
+
return JSON.parse(json);
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
throw new errors_1.PolicyVersionDeserializationError(error instanceof Error ? error : undefined);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
exports.PolicyClient = PolicyClient;
|
|
427
|
+
//# sourceMappingURL=policy-client.js.map
|
|
@@ -0,0 +1 @@
|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,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,0CAAiC,CACzC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC3C,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAphBD,oCAohBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants used throughout the Benefits Admin Policy SDK
|
|
3
|
+
*/
|
|
4
|
+
/** SSM parameter name for the BA consumer role ARN */
|
|
5
|
+
export declare const BA_CONSUMER_ROLE_PARAMETER_NAME = "/benefits-admin/consumer-role-arn";
|
|
6
|
+
/** SSM parameter name for the policy URI prefix (dataset) */
|
|
7
|
+
export declare const POLICY_URI_PREFIX_PARAMETER_NAME = "/benefits-admin-policy/policy-uri-prefix";
|
|
8
|
+
/** S3 bucket name prefix for policy versions */
|
|
9
|
+
export declare const POLICY_BUCKET_NAME_PREFIX = "benefits-admin-policy-versions";
|
|
10
|
+
/** Default AWS region */
|
|
11
|
+
export declare const DEFAULT_REGION = "us-west-2";
|
|
12
|
+
/** S3 client TTL in milliseconds (55 minutes, 5 min before IAM session expires) */
|
|
13
|
+
export declare const S3_CLIENT_TTL_MS: number;
|
|
14
|
+
/** Role session name for STS assume role */
|
|
15
|
+
export declare const ROLE_SESSION_NAME = "benefits-admin-policy-sdk";
|
|
16
|
+
/** Page size for S3 list operations */
|
|
17
|
+
export declare const S3_PAGE_SIZE = 1000;
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sDAAsD;AACtD,eAAO,MAAM,+BAA+B,sCACP,CAAC;AAEtC,6DAA6D;AAC7D,eAAO,MAAM,gCAAgC,6CACD,CAAC;AAE7C,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,mCAAmC,CAAC;AAE1E,yBAAyB;AACzB,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,QAAiB,CAAC;AAE/C,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAE7D,uCAAuC;AACvC,eAAO,MAAM,YAAY,OAAO,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants used throughout the Benefits Admin Policy SDK
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.S3_PAGE_SIZE = exports.ROLE_SESSION_NAME = exports.S3_CLIENT_TTL_MS = exports.DEFAULT_REGION = exports.POLICY_BUCKET_NAME_PREFIX = exports.POLICY_URI_PREFIX_PARAMETER_NAME = exports.BA_CONSUMER_ROLE_PARAMETER_NAME = void 0;
|
|
7
|
+
/** SSM parameter name for the BA consumer role ARN */
|
|
8
|
+
exports.BA_CONSUMER_ROLE_PARAMETER_NAME = '/benefits-admin/consumer-role-arn';
|
|
9
|
+
/** SSM parameter name for the policy URI prefix (dataset) */
|
|
10
|
+
exports.POLICY_URI_PREFIX_PARAMETER_NAME = '/benefits-admin-policy/policy-uri-prefix';
|
|
11
|
+
/** S3 bucket name prefix for policy versions */
|
|
12
|
+
exports.POLICY_BUCKET_NAME_PREFIX = 'benefits-admin-policy-versions';
|
|
13
|
+
/** Default AWS region */
|
|
14
|
+
exports.DEFAULT_REGION = 'us-west-2';
|
|
15
|
+
/** S3 client TTL in milliseconds (55 minutes, 5 min before IAM session expires) */
|
|
16
|
+
exports.S3_CLIENT_TTL_MS = 55 * 60 * 1000;
|
|
17
|
+
/** Role session name for STS assume role */
|
|
18
|
+
exports.ROLE_SESSION_NAME = 'benefits-admin-policy-sdk';
|
|
19
|
+
/** Page size for S3 list operations */
|
|
20
|
+
exports.S3_PAGE_SIZE = 1000;
|
|
21
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sDAAsD;AACzC,QAAA,+BAA+B,GAC1C,mCAAmC,CAAC;AAEtC,6DAA6D;AAChD,QAAA,gCAAgC,GAC3C,0CAA0C,CAAC;AAE7C,gDAAgD;AACnC,QAAA,yBAAyB,GAAG,gCAAgC,CAAC;AAE1E,yBAAyB;AACZ,QAAA,cAAc,GAAG,WAAW,CAAC;AAE1C,mFAAmF;AACtE,QAAA,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,4CAA4C;AAC/B,QAAA,iBAAiB,GAAG,2BAA2B,CAAC;AAE7D,uCAAuC;AAC1B,QAAA,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Policy SDK errors
|
|
3
|
+
*/
|
|
4
|
+
export declare class PolicySdkError extends Error {
|
|
5
|
+
cause?: Error;
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when a PolicyVersion is not found
|
|
10
|
+
*/
|
|
11
|
+
export declare class PolicyVersionNotFoundError extends PolicySdkError {
|
|
12
|
+
constructor(uri: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when a PolicyVersion cannot be deserialized
|
|
16
|
+
*/
|
|
17
|
+
export declare class PolicyVersionDeserializationError extends PolicySdkError {
|
|
18
|
+
constructor(cause?: Error);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown when AWS operations fail
|
|
22
|
+
*/
|
|
23
|
+
export declare class PolicySdkAwsError extends PolicySdkError {
|
|
24
|
+
constructor(message: string, cause?: Error);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Error thrown when configuration is invalid
|
|
28
|
+
*/
|
|
29
|
+
export declare class PolicySdkConfigurationError extends PolicySdkError {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error thrown when SSM parameter access is not available
|
|
34
|
+
*/
|
|
35
|
+
export declare class PolicySdkSsmParameterAccessError extends PolicySdkError {
|
|
36
|
+
constructor(parameterName: string, message?: string, cause?: Error);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC;gBAET,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,cAAc;gBAChD,GAAG,EAAE,MAAM;CAIxB;AAED;;GAEG;AACH,qBAAa,iCAAkC,SAAQ,cAAc;gBACvD,KAAK,CAAC,EAAE,KAAK;CAO1B;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;gBACvC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAO3C;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,cAAc;gBACjD,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,cAAc;gBACtD,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAWnE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicySdkSsmParameterAccessError = exports.PolicySdkConfigurationError = exports.PolicySdkAwsError = exports.PolicyVersionDeserializationError = exports.PolicyVersionNotFoundError = exports.PolicySdkError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all Policy SDK errors
|
|
6
|
+
*/
|
|
7
|
+
class PolicySdkError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'PolicySdkError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.PolicySdkError = PolicySdkError;
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when a PolicyVersion is not found
|
|
16
|
+
*/
|
|
17
|
+
class PolicyVersionNotFoundError extends PolicySdkError {
|
|
18
|
+
constructor(uri) {
|
|
19
|
+
super(`PolicyVersion not found at URI: ${uri}`);
|
|
20
|
+
this.name = 'PolicyVersionNotFoundError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.PolicyVersionNotFoundError = PolicyVersionNotFoundError;
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when a PolicyVersion cannot be deserialized
|
|
26
|
+
*/
|
|
27
|
+
class PolicyVersionDeserializationError extends PolicySdkError {
|
|
28
|
+
constructor(cause) {
|
|
29
|
+
super('Failed to deserialize JSON string into PolicyVersion model.');
|
|
30
|
+
this.name = 'PolicyVersionDeserializationError';
|
|
31
|
+
if (cause) {
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.PolicyVersionDeserializationError = PolicyVersionDeserializationError;
|
|
37
|
+
/**
|
|
38
|
+
* Error thrown when AWS operations fail
|
|
39
|
+
*/
|
|
40
|
+
class PolicySdkAwsError extends PolicySdkError {
|
|
41
|
+
constructor(message, cause) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = 'PolicySdkAwsError';
|
|
44
|
+
if (cause) {
|
|
45
|
+
this.cause = cause;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.PolicySdkAwsError = PolicySdkAwsError;
|
|
50
|
+
/**
|
|
51
|
+
* Error thrown when configuration is invalid
|
|
52
|
+
*/
|
|
53
|
+
class PolicySdkConfigurationError extends PolicySdkError {
|
|
54
|
+
constructor(message) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.name = 'PolicySdkConfigurationError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.PolicySdkConfigurationError = PolicySdkConfigurationError;
|
|
60
|
+
/**
|
|
61
|
+
* Error thrown when SSM parameter access is not available
|
|
62
|
+
*/
|
|
63
|
+
class PolicySdkSsmParameterAccessError extends PolicySdkError {
|
|
64
|
+
constructor(parameterName, message, cause) {
|
|
65
|
+
const defaultMessage = `Access denied to SSM parameter: ${parameterName}. ` +
|
|
66
|
+
`Please check the README.md file for IAM policy examples to grant access to this parameter.`;
|
|
67
|
+
super(message || defaultMessage);
|
|
68
|
+
this.name = 'PolicySdkSsmParameterAccessError';
|
|
69
|
+
if (cause) {
|
|
70
|
+
this.cause = cause;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.PolicySdkSsmParameterAccessError = PolicySdkSsmParameterAccessError;
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAGvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAPD,wCAOC;AAED;;GAEG;AACH,MAAa,0BAA2B,SAAQ,cAAc;IAC5D,YAAY,GAAW;QACrB,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AALD,gEAKC;AAED;;GAEG;AACH,MAAa,iCAAkC,SAAQ,cAAc;IACnE,YAAY,KAAa;QACvB,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;QAChD,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AARD,8EAQC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,cAAc;IACnD,YAAY,OAAe,EAAE,KAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AARD,8CAQC;AAED;;GAEG;AACH,MAAa,2BAA4B,SAAQ,cAAc;IAC7D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AALD,kEAKC;AAED;;GAEG;AACH,MAAa,gCAAiC,SAAQ,cAAc;IAClE,YAAY,aAAqB,EAAE,OAAgB,EAAE,KAAa;QAChE,MAAM,cAAc,GAClB,mCAAmC,aAAa,IAAI;YACpD,4FAA4F,CAAC;QAE/F,KAAK,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;QAC/C,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AAZD,4EAYC"}
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { PolicyClient } from './clients/policy-client';
|
|
2
|
+
export type * from './models';
|
|
3
|
+
export { PolicySdkError, PolicyVersionNotFoundError, PolicyVersionDeserializationError, PolicySdkAwsError, PolicySdkConfigurationError, PolicySdkSsmParameterAccessError, } from './errors';
|
|
4
|
+
export { S3Adapter } from './adapters/s3-adapter';
|
|
5
|
+
export type { S3Credentials } from './adapters/s3-adapter';
|
|
6
|
+
export { policySchema, policyVersionSchema } from './schemas';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,mBAAmB,UAAU,CAAC;AAG9B,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,iCAAiC,EACjC,iBAAiB,EACjB,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.policyVersionSchema = exports.policySchema = exports.S3Adapter = exports.PolicySdkSsmParameterAccessError = exports.PolicySdkConfigurationError = exports.PolicySdkAwsError = exports.PolicyVersionDeserializationError = exports.PolicyVersionNotFoundError = exports.PolicySdkError = exports.PolicyClient = void 0;
|
|
4
|
+
// Policy Client export
|
|
5
|
+
var policy_client_1 = require("./clients/policy-client");
|
|
6
|
+
Object.defineProperty(exports, "PolicyClient", { enumerable: true, get: function () { return policy_client_1.PolicyClient; } });
|
|
7
|
+
// Error exports
|
|
8
|
+
var errors_1 = require("./errors");
|
|
9
|
+
Object.defineProperty(exports, "PolicySdkError", { enumerable: true, get: function () { return errors_1.PolicySdkError; } });
|
|
10
|
+
Object.defineProperty(exports, "PolicyVersionNotFoundError", { enumerable: true, get: function () { return errors_1.PolicyVersionNotFoundError; } });
|
|
11
|
+
Object.defineProperty(exports, "PolicyVersionDeserializationError", { enumerable: true, get: function () { return errors_1.PolicyVersionDeserializationError; } });
|
|
12
|
+
Object.defineProperty(exports, "PolicySdkAwsError", { enumerable: true, get: function () { return errors_1.PolicySdkAwsError; } });
|
|
13
|
+
Object.defineProperty(exports, "PolicySdkConfigurationError", { enumerable: true, get: function () { return errors_1.PolicySdkConfigurationError; } });
|
|
14
|
+
Object.defineProperty(exports, "PolicySdkSsmParameterAccessError", { enumerable: true, get: function () { return errors_1.PolicySdkSsmParameterAccessError; } });
|
|
15
|
+
// Adapter exports (for advanced usage)
|
|
16
|
+
var s3_adapter_1 = require("./adapters/s3-adapter");
|
|
17
|
+
Object.defineProperty(exports, "S3Adapter", { enumerable: true, get: function () { return s3_adapter_1.S3Adapter; } });
|
|
18
|
+
// JSON Schema exports (for runtime validation)
|
|
19
|
+
var schemas_1 = require("./schemas");
|
|
20
|
+
Object.defineProperty(exports, "policySchema", { enumerable: true, get: function () { return schemas_1.policySchema; } });
|
|
21
|
+
Object.defineProperty(exports, "policyVersionSchema", { enumerable: true, get: function () { return schemas_1.policyVersionSchema; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|