@doctorus/common 0.0.38 β†’ 0.0.39

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 (2) hide show
  1. package/README.md +60 -552
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,621 +1,129 @@
1
1
  # @doctorus/common
2
2
 
3
- Common TypeScript utilities for Doctorus - A comprehensive shared library providing operations management, status handling, SSM parameters, audit logging, and internationalization across the platform.
3
+ Common TypeScript building blocks shared across the Doctorus platform.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@doctorus/common.svg)](https://www.npmjs.com/package/@doctorus/common)
6
- [![License](https://img.shields.io/npm/l/@doctorus/common.svg)](https://github.com/DoctorusRepoOwner/common/blob/main/LICENSE)
7
- [![Test Coverage](https://img.shields.io/badge/coverage-99%25-brightgreen.svg)](https://github.com/DoctorusRepoOwner/common)
5
+ This package centralizes:
6
+
7
+ - operations and permission primitives
8
+ - status enums with metadata and translations
9
+ - audit event types
10
+ - AWS SSM parameter keys and path helpers
8
11
 
9
12
  ## Installation
10
13
 
11
14
  ```bash
12
- npm install @doctorus/common
13
- # or
14
15
  pnpm add @doctorus/common
15
- # or
16
- yarn add @doctorus/common
17
16
  ```
18
17
 
19
- ## Features
20
-
21
- - 🎯 **Operations Module** - Type-safe resource-action patterns with i18n support (English/French)
22
- - πŸ“Š **Status Module** - Rich status management with icons, colors, and translations
23
- - πŸ” **Audit Module** - Comprehensive audit logging and compliance tracking
24
- - πŸ—„οΈ **SSM Module** - AWS SSM Parameter Store utilities with hierarchical keys
25
- - 🌍 **Internationalization** - Full bilingual support (us-EN, fr-FR) for all user-facing text
26
- - πŸ₯ **Medical Compliance** - Separate categorization for HIPAA-compliant resources
27
- - βœ… **100% Test Coverage** - Production-ready with comprehensive testing
28
-
29
- ## Quick Start
18
+ ## Exports
30
19
 
31
- ```typescript
20
+ ```ts
32
21
  import {
33
22
  // Operations
34
- Operation,
35
23
  Action,
24
+ Operation,
36
25
  Resource,
26
+ getActionLabel,
37
27
  getOperationLabel,
38
28
 
39
29
  // Status
40
30
  MedicalServiceStatus,
41
31
  getStatusLabel,
42
- getStatusIcon,
43
-
44
- // SSM
45
- buildSSMKey,
46
- SSM_CATEGORIES,
32
+ getStatusMetadata,
47
33
 
48
34
  // Audit
49
35
  AuditEvent,
50
- } from '@doctorus/common';
51
-
52
- // Create and label an operation
53
- const op = new Operation(Action.CREATE, Resource.PRESCRIPTION);
54
- console.log(getOperationLabel(op, 'us-EN')); // "Create Prescription"
55
- console.log(getOperationLabel(op, 'fr-FR')); // "CrΓ©er Ordonnance"
56
36
 
57
- // Get status information
58
- const status = MedicalServiceStatus.IN_PROGRESS;
59
- console.log(getStatusLabel(status, 'us-EN')); // "In Progress"
60
- console.log(getStatusIcon(status)); // "medical_services"
61
-
62
- // Build SSM key
63
- const key = buildSSMKey({
64
- environment: 'production',
65
- application: 'doctorus',
66
- category: SSM_CATEGORIES.DATABASE,
67
- subcategory: 'postgres',
68
- name: 'connection-string',
69
- });
70
- // "/production/doctorus/database/postgres/connection-string"
37
+ // SSM
38
+ SSM_PARAM_KEY,
39
+ SSM_PARAM_METADATA,
40
+ getSSMParamDescription,
41
+ buildSSMPath,
42
+ } from '@doctorus/common';
71
43
  ```
72
44
 
73
- ## Modules Overview
74
-
75
- ### 🎯 [Operations Module](src/operations/README.md)
76
-
77
- Resource-action based system for permissions, operations, and audit logging with full internationalization.
78
-
79
- **Key Features:**
45
+ ## Modules
80
46
 
81
- - 67 predefined actions (CRUD, medical-specific, system operations)
82
- - 49 categorized resources (medical + public)
83
- - Bilingual labels (English/French)
84
- - Predefined operation combinations
85
- - Resource categorization helpers
47
+ ### Operations
86
48
 
87
- **Quick Example:**
49
+ Defines typed actions, resources, and `Operation` pairs used for authorization, labeling, and audit context.
88
50
 
89
- ```typescript
90
- import { Action, Resource, getActionLabel, isMedicalResource } from '@doctorus/common';
51
+ ```ts
52
+ import { Action, Operation, Resource, getOperationLabel } from '@doctorus/common';
91
53
 
92
- const action = Action.PRESCRIBE;
93
- console.log(getActionLabel(action, 'us-EN')); // "Prescribe"
94
- console.log(getActionLabel(action, 'fr-FR')); // "Prescrire"
54
+ const operation = new Operation(Action.CREATE, Resource.PRESCRIPTION);
95
55
 
96
- console.log(isMedicalResource(Resource.PATIENT)); // true
97
- console.log(isMedicalResource(Resource.ACCOUNT)); // false
56
+ getOperationLabel(operation, 'us-EN'); // "Create Prescription"
57
+ getOperationLabel(operation, 'fr-FR'); // "CrΓ©er Ordonnance"
98
58
  ```
99
59
 
100
- [πŸ“– Full Operations Documentation](src/operations/README.md)
60
+ [Operations documentation](src/operations/README.md)
101
61
 
102
- ---
62
+ ### Status
103
63
 
104
- ### πŸ“Š [Status Module](src/status/README.md)
64
+ Provides reusable status enums and metadata with labels, descriptions, colors, and icons.
105
65
 
106
- Comprehensive status management with rich metadata, visual elements, and validation.
107
-
108
- **Key Features:**
109
-
110
- - Type-safe status enums
111
- - Material Design icons and color schemes
112
- - Short and long labels in English/French
113
- - Detailed descriptions
114
- - Status transition validation
115
- - Reusable pattern for multiple entity types
116
-
117
- **Quick Example:**
118
-
119
- ```typescript
120
- import {
121
- MedicalServiceStatus,
122
- getStatusLabel,
123
- getStatusColor,
124
- getStatusIcon,
125
- isValidTransition,
126
- } from '@doctorus/common';
66
+ ```ts
67
+ import { MedicalServiceStatus, getStatusLabel, getStatusMetadata } from '@doctorus/common';
127
68
 
128
69
  const status = MedicalServiceStatus.IN_PROGRESS;
129
- console.log(getStatusLabel(status, 'us-EN', 'long')); // "Service In Progress"
130
- console.log(getStatusColor(status)); // "#2196F3"
131
- console.log(getStatusIcon(status)); // "medical_services"
132
70
 
133
- // Validate transitions
134
- isValidTransition(MedicalServiceStatus.PENDING, MedicalServiceStatus.IN_PROGRESS); // true
71
+ getStatusLabel(status, 'us-EN'); // "In Progress"
72
+ getStatusMetadata(status).icon; // e.g. "medical_services"
135
73
  ```
136
74
 
137
- [πŸ“– Full Status Documentation](src/status/README.md)
138
-
139
- ---
75
+ [Status documentation](src/status/README.md)
140
76
 
141
- ### πŸ” [Audit Module](src/audit/README.md)
77
+ ### Audit
142
78
 
143
- Enterprise-grade audit logging for compliance, security, and debugging.
79
+ Contains audit event types shared by services that log user or system activity.
144
80
 
145
- **Key Features:**
146
-
147
- - Comprehensive event tracking
148
- - User and system action logging
149
- - Data change tracking (before/after states)
150
- - Correlation and tracing support
151
- - HIPAA/GDPR compliance ready
152
- - Integration with Operations module
153
-
154
- **Quick Example:**
155
-
156
- ```typescript
81
+ ```ts
157
82
  import { AuditEvent, Action, Resource } from '@doctorus/common';
158
83
 
159
84
  const event: AuditEvent = {
160
- id: uuidv4(),
85
+ id: 'evt-123',
161
86
  timestamp: new Date(),
162
- userId: 'user-123',
163
87
  action: Action.CREATE,
164
- resource: Resource.PRESCRIPTION,
165
- resourceId: 'prescription-789',
88
+ resource: Resource.PATIENT,
166
89
  result: 'success',
167
- metadata: { medication: 'Amoxicillin' },
168
90
  };
169
-
170
- await auditLogger.log(event);
171
- ```
172
-
173
- [πŸ“– Full Audit Documentation](src/audit/README.md)
174
-
175
- ---
176
-
177
- ### πŸ—„οΈ [SSM Module](src/ssm/README.md)
178
-
179
- Type-safe AWS Systems Manager Parameter Store key management.
180
-
181
- **Key Features:**
182
-
183
- - Hierarchical key structure
184
- - Environment-aware configuration
185
- - Key parsing and validation
186
- - Predefined key categories
187
- - Prefix building for batch operations
188
-
189
- **Quick Example:**
190
-
191
- ```typescript
192
- import { buildSSMKey, parseSSMKey, SSM_CATEGORIES } from '@doctorus/common';
193
-
194
- // Build a key
195
- const key = buildSSMKey({
196
- environment: 'production',
197
- application: 'doctorus',
198
- category: SSM_CATEGORIES.API,
199
- subcategory: 'stripe',
200
- name: 'secret-key',
201
- });
202
- // "/production/doctorus/api/stripe/secret-key"
203
-
204
- // Parse a key
205
- const parsed = parseSSMKey(key);
206
- console.log(parsed.category); // "api"
207
- console.log(parsed.subcategory); // "stripe"
208
- ```
209
-
210
- [πŸ“– Full SSM Documentation](src/ssm/README.md)
211
-
212
- ---
213
-
214
- ## Internationalization (i18n)
215
-
216
- All user-facing text supports English (us-EN) and French (fr-FR):
217
-
218
- ```typescript
219
- import { getActionLabel, getResourceLabel, getStatusLabel } from '@doctorus/common';
220
-
221
- // Action labels
222
- getActionLabel(Action.CREATE, 'us-EN'); // "Create"
223
- getActionLabel(Action.CREATE, 'fr-FR'); // "CrΓ©er"
224
-
225
- // Resource labels
226
- getResourceLabel(Resource.PATIENT, 'us-EN'); // "Patient"
227
- getResourceLabel(Resource.PATIENT, 'fr-FR'); // "Patient"
228
-
229
- // Status labels
230
- getStatusLabel(MedicalServiceStatus.COMPLETED, 'us-EN'); // "Completed"
231
- getStatusLabel(MedicalServiceStatus.COMPLETED, 'fr-FR'); // "TerminΓ©"
232
- ```
233
-
234
- ## Medical Service Status Actions
235
-
236
- Special actions for medical service workflow management:
237
-
238
- ```typescript
239
- import { Action } from '@doctorus/common';
240
-
241
- // Status transition actions
242
- Action.CHECK_IN; // Move patient to waiting room
243
- Action.UNDO_CHECK_IN; // Revert check-in
244
- Action.START_SERVICE; // Begin consultation
245
- Action.UNSTART_SERVICE; // Undo service start
246
- Action.COMPLETE_SERVICE; // Mark as completed
247
- Action.REOPEN_COMPLETED_SERVICE; // Reopen completed service
248
- Action.CANCEL_SERVICE; // Cancel the service
249
- Action.UNDO_CANCEL_SERVICE; // Uncancel
250
- Action.FORCE_RESET_STATUS; // Admin: reset all (dangerous)
251
- Action.CORRECT_TIMESTAMPS; // Admin: modify timestamps
252
- ```
253
-
254
- ## Modules
255
-
256
- ### 1. Operations Module
257
-
258
- Manage operations in `RESOURCE:ACTION` format for access control, audit logging, and permission management.
259
-
260
- #### Basic Usage
261
-
262
- ```typescript
263
- import { Operation, Operations, Resource, Action } from '@doctorus/common';
264
-
265
- // Use predefined operations
266
- const operation = Operations.PATIENT_READ;
267
- console.log(operation.toString()); // "PATIENT:READ"
268
-
269
- // Create custom operations
270
- const customOp = new Operation(Resource.PRESCRIPTION, Action.PRESCRIBE);
271
- console.log(customOp.toString()); // "PRESCRIPTION:PRESCRIBE"
272
-
273
- // Parse from string
274
- const parsed = Operation.fromString('MEDICAL_SERVICE:SCHEDULE');
275
- if (parsed) {
276
- console.log(parsed.resource); // Resource.MEDICAL_SERVICE
277
- console.log(parsed.action); // Action.SCHEDULE
278
- }
279
-
280
- // Compare operations
281
- const op1 = Operations.PATIENT_READ;
282
- const op2 = Operations.PATIENT_READ;
283
- console.log(op1.equals(op2)); // true
284
-
285
- // Convert to JSON
286
- const json = operation.toJSON();
287
- // { resource: "PATIENT", action: "READ", operation: "PATIENT:READ" }
288
- ```
289
-
290
- #### Resources
291
-
292
- Resources are categorized as **Medical** (require special access control) or **Public** (standard access control):
293
-
294
- **Medical Resources:**
295
-
296
- - Patient: `PATIENT`, `PATIENT_MEDICAL_NOTES`, `PATIENT_MEDICAL_PROPERTIES`, `PATIENT_PAYMENT`
297
- - Medical Services: `MEDICAL_SERVICE`, `MEDICAL_SERVICE_NOTE`, `MEDICAL_SERVICE_SCHEDULE`, `MEDICAL_SERVICE_FEES`, `MEDICAL_SERVICE_STATUS`
298
- - Clinical: `MEDICAL_RECORD`, `MEDICAL_HISTORY`, `PRESCRIPTION`, `DIAGNOSIS`, `OBSERVATION`, `MEDICATION`, `ALLERGY`, `IMMUNIZATION`, `PROCEDURE`
299
- - Measurements: `CLINICAL_NOTE`, `VITAL_SIGNS`, `MEASURE_MODEL`, `CALCULATED_MEASURE_MODEL`
300
- - Diagnostics: `LAB_RESULT`, `IMAGING`
301
-
302
- **Public Resources:**
303
-
304
- - Account: `ACCOUNT`, `ACCOUNT_OWNERSHIP`, `ACCOUNT_PREFERENCES`
305
- - User: `USER`, `CONTACT`
306
- - Documents: `UPLOADED_DOCUMENT`, `DOCUMENT_LAYOUT`, `GENERATED_DOCUMENT`, `DOCUMENT_MODEL`, `SNIPPET`
307
- - System: `NOTIFICATION`, `REPORT`, `AUDIT_LOG`, `SYSTEM`, `SETTINGS`, `MEMBERSHIP`, `LOCATION`, `TASK_TYPE`
308
-
309
- #### Actions
310
-
311
- ```typescript
312
- // CRUD operations
313
- (Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE, Action.PUT, Action.LIST);
314
-
315
- // General actions
316
- (Action.MANAGE, Action.VIEW, Action.SEARCH);
317
-
318
- // Medical-specific actions
319
- (Action.PRESCRIBE,
320
- Action.DIAGNOSE,
321
- Action.SIGN,
322
- Action.VERIFY,
323
- Action.SCHEDULE,
324
- Action.CANCEL,
325
- Action.APPROVE,
326
- Action.REJECT);
327
-
328
- // Medical service actions
329
- (Action.SET_MEDICAL_SERVICE_STATUS, Action.SET_MEDICAL_SERVICE_FEES);
330
-
331
- // Patient-specific actions
332
- (Action.UPDATE_STATUS, Action.VIEW_PATIENTS, Action.PUT_PATIENT_PAYMENT, Action.DELETE_PATIENT_PAYMENT);
333
-
334
- // Data operations
335
- (Action.EXPORT, Action.IMPORT, Action.ARCHIVE, Action.RESTORE, Action.SHARE, Action.DOWNLOAD, Action.UPLOAD);
336
-
337
- // System operations
338
- (Action.LOGIN, Action.LOGOUT, Action.CONFIGURE, Action.AUDIT);
339
- ```
340
-
341
- #### Helper Functions
342
-
343
- ```typescript
344
- import {
345
- isMedicalResource,
346
- isPublicResource,
347
- getAllOperations,
348
- getOperationsByResource,
349
- getOperationsByAction,
350
- } from '@doctorus/common';
351
-
352
- // Check resource type
353
- if (isMedicalResource(Resource.PATIENT)) {
354
- // Apply HIPAA-compliant access controls
355
- }
356
-
357
- if (isPublicResource(Resource.USER)) {
358
- // Apply standard access controls
359
- }
360
-
361
- // Get all predefined operations
362
- const allOps = getAllOperations();
363
-
364
- // Filter operations by resource
365
- const patientOps = getOperationsByResource(Resource.PATIENT);
366
- // [PATIENT_CREATE, PATIENT_READ, PATIENT_UPDATE, ...]
367
-
368
- // Filter operations by action
369
- const createOps = getOperationsByAction(Action.CREATE);
370
- // [PATIENT_CREATE, USER_CREATE, MEDICAL_RECORD_CREATE, ...]
371
- ```
372
-
373
- #### Predefined Operations
374
-
375
- Commonly used operations are predefined for convenience:
376
-
377
- ```typescript
378
- // Account operations
379
- (Operations.ACCOUNT_CREATE,
380
- Operations.ACCOUNT_READ,
381
- Operations.ACCOUNT_UPDATE,
382
- Operations.ACCOUNT_DELETE,
383
- Operations.ACCOUNT_MANAGE);
384
-
385
- // Patient operations
386
- (Operations.PATIENT_CREATE,
387
- Operations.PATIENT_READ,
388
- Operations.PATIENT_UPDATE,
389
- Operations.PATIENT_DELETE,
390
- Operations.PATIENT_LIST,
391
- Operations.PATIENT_VIEW,
392
- Operations.PATIENT_UPDATE_STATUS);
393
-
394
- // Medical service operations
395
- (Operations.MEDICAL_SERVICE_CREATE,
396
- Operations.MEDICAL_SERVICE_READ,
397
- Operations.MEDICAL_SERVICE_UPDATE,
398
- Operations.MEDICAL_SERVICE_DELETE,
399
- Operations.MEDICAL_SERVICE_MANAGE,
400
- Operations.MEDICAL_SERVICE_SCHEDULE,
401
- Operations.MEDICAL_SERVICE_CANCEL,
402
- Operations.MEDICAL_SERVICE_SET_STATUS,
403
- Operations.MEDICAL_SERVICE_SET_FEES);
404
-
405
- // Prescription operations
406
- (Operations.PRESCRIPTION_CREATE,
407
- Operations.PRESCRIPTION_READ,
408
- Operations.PRESCRIPTION_UPDATE,
409
- Operations.PRESCRIPTION_SIGN,
410
- Operations.PRESCRIPTION_PRESCRIBE);
411
-
412
- // User operations
413
- (Operations.USER_CREATE,
414
- Operations.USER_READ,
415
- Operations.USER_UPDATE,
416
- Operations.USER_DELETE,
417
- Operations.USER_LOGIN,
418
- Operations.USER_LOGOUT);
419
-
420
- // ... and many more
421
- ```
422
-
423
- ### 2. SSM Parameters Module
424
-
425
- Utilities for managing AWS SSM Parameter Store keys with environment support.
426
-
427
- #### Basic Usage
428
-
429
- ```typescript
430
- import {
431
- SSM_PARAM_KEY,
432
- buildSSMPath,
433
- buildSSMPathWithPrefix,
434
- extractEnvFromPath,
435
- extractKeyFromPath,
436
- isEnvAgnostic,
437
- } from '@doctorus/common';
438
-
439
- // Build environment-specific path
440
- const path = buildSSMPath('prod', SSM_PARAM_KEY.COGNITO_USER_POOL_ID);
441
- console.log(path); // "/prod/user-pool-id"
442
-
443
- // Build environment-agnostic path (for shared/central account parameters)
444
- const sharedPath = buildSSMPath(null, SSM_PARAM_KEY.DB_USER);
445
- console.log(sharedPath); // "/db-user"
446
-
447
- // Build path with custom prefix
448
- const customPath = buildSSMPathWithPrefix('/myapp/prod', SSM_PARAM_KEY.GRAPHQL_API_ID);
449
- console.log(customPath); // "/myapp/prod/graphql-api-id"
450
-
451
- // Extract environment from path
452
- const env = extractEnvFromPath('/prod/user-pool-id');
453
- console.log(env); // "prod"
454
-
455
- // Extract key from path
456
- const key = extractKeyFromPath('/prod/user-pool-id');
457
- console.log(key); // SSM_PARAM_KEY.COGNITO_USER_POOL_ID
458
-
459
- // Check if path is environment-agnostic
460
- console.log(isEnvAgnostic('/db-user')); // true
461
- console.log(isEnvAgnostic('/prod/user-pool-id')); // false
462
- ```
463
-
464
- #### Available SSM Parameter Keys
465
-
466
- ```typescript
467
- SSM_PARAM_KEY.COGNITO_USER_POOL_ID;
468
- SSM_PARAM_KEY.COGNITO_USER_POOL_WEB_CLIENT_ID;
469
- SSM_PARAM_KEY.COGNITO_OAUTH_DOMAIN;
470
- SSM_PARAM_KEY.RUM_GUEST_ROLE_ARN;
471
- SSM_PARAM_KEY.RUM_IDENTITY_POOL_ID;
472
- SSM_PARAM_KEY.RUM_APP_ID;
473
- SSM_PARAM_KEY.GRAPHQL_HTTP_URL;
474
- SSM_PARAM_KEY.GRAPHQL_WS_URL;
475
- SSM_PARAM_KEY.GRAPHQL_HOST;
476
- SSM_PARAM_KEY.GRAPHQL_API_ID;
477
- SSM_PARAM_KEY.MEDICAL_ASSETS_AWS_CLOUDFRONT_PRIVATE_KEY;
478
- SSM_PARAM_KEY.MEDICAL_ASSETS_AWS_CLOUDFRONT_KEY_ID;
479
- SSM_PARAM_KEY.MEDICAL_ASSETS_BUCKET_NAME;
480
- SSM_PARAM_KEY.PUBLIC_ASSETS_BUCKET_NAME;
481
- SSM_PARAM_KEY.DB_USER;
482
- SSM_PARAM_KEY.DB_PASSWORD;
483
- SSM_PARAM_KEY.MEDICAL_ASSETS_DISTRIBUTION_DOMAIN_NAME;
484
- SSM_PARAM_KEY.BASE_HOST;
485
- SSM_PARAM_KEY.EMAIL_FROM_ADDRESS;
486
- SSM_PARAM_KEY.EVENT_API_REAL_TIME_DNS;
487
- SSM_PARAM_KEY.EVENT_API_HTTP_DNS;
488
- SSM_PARAM_KEY.NOTIFIED_EVENT_ACTIONS;
489
- ```
490
-
491
- ## Use Cases
492
-
493
- ### 1. Access Control
494
-
495
- ```typescript
496
- import { Operation, isMedicalResource } from '@doctorus/common';
497
-
498
- function checkPermission(userPermissions: string[], operation: Operation): boolean {
499
- // Check if user has permission for this operation
500
- const hasPermission = userPermissions.includes(operation.toString());
501
-
502
- // Apply additional checks for medical resources
503
- if (isMedicalResource(operation.resource)) {
504
- // Enforce HIPAA compliance, additional logging, etc.
505
- return hasPermission && user.hasHIPAAAccess;
506
- }
507
-
508
- return hasPermission;
509
- }
510
-
511
- // Usage
512
- const canRead = checkPermission(userPermissions, Operations.PATIENT_READ);
513
91
  ```
514
92
 
515
- ### 2. Audit Logging
516
-
517
- ```typescript
518
- import { Operation, Operations } from '@doctorus/common';
519
-
520
- interface AuditLog {
521
- timestamp: Date;
522
- userId: string;
523
- operation: string;
524
- resourceId: string;
525
- success: boolean;
526
- }
527
-
528
- function logAudit(userId: string, operation: Operation, resourceId: string, success: boolean) {
529
- const log: AuditLog = {
530
- timestamp: new Date(),
531
- userId,
532
- operation: operation.toString(),
533
- resourceId,
534
- success,
535
- };
536
-
537
- // Store in audit log database
538
- auditLogService.create(log);
539
- }
540
-
541
- // Usage
542
- logAudit('user123', Operations.PRESCRIPTION_PRESCRIBE, 'rx-456', true);
543
- ```
93
+ [Audit documentation](src/audit/README.md)
544
94
 
545
- ### 3. Infrastructure Configuration
95
+ ### SSM
546
96
 
547
- ```typescript
548
- import { buildSSMPath, SSM_PARAM_KEY } from '@doctorus/common';
549
- import { StringParameter } from 'aws-cdk-lib/aws-ssm';
97
+ Defines known SSM parameter keys and utilities to build, inspect, and describe parameter paths.
550
98
 
551
- // In your CDK stack
552
- const env = 'prod';
99
+ ```ts
100
+ import { SSM_PARAM_KEY, getSSMParamDescription, buildSSMPath, extractKeyFromPath } from '@doctorus/common';
553
101
 
554
- const userPoolId = StringParameter.valueFromLookup(this, buildSSMPath(env, SSM_PARAM_KEY.COGNITO_USER_POOL_ID));
102
+ const key = SSM_PARAM_KEY.DB_PASSWORD;
555
103
 
556
- const graphqlUrl = StringParameter.valueFromLookup(this, buildSSMPath(env, SSM_PARAM_KEY.GRAPHQL_HTTP_URL));
104
+ buildSSMPath('prod', key); // "/prod/db-password"
105
+ getSSMParamDescription(key); // "Database password used by application services."
106
+ extractKeyFromPath('/prod/db-password'); // SSM_PARAM_KEY.DB_PASSWORD
557
107
  ```
558
108
 
559
- ### 4. Frontend Configuration
109
+ [SSM documentation](src/ssm/README.md)
560
110
 
561
- ```typescript
562
- import { buildSSMPath, SSM_PARAM_KEY } from '@doctorus/common';
563
- import { SSM } from '@aws-sdk/client-ssm';
111
+ ## Internationalization
564
112
 
565
- async function loadConfig(environment: string) {
566
- const ssm = new SSM();
113
+ User-facing labels in this package use the shared locale shape:
567
114
 
568
- const params = [SSM_PARAM_KEY.COGNITO_USER_POOL_ID, SSM_PARAM_KEY.GRAPHQL_HTTP_URL, SSM_PARAM_KEY.RUM_APP_ID];
115
+ - `'us-EN'`
116
+ - `'fr-FR'`
569
117
 
570
- const config: Record<string, string> = {};
571
-
572
- for (const param of params) {
573
- const path = buildSSMPath(environment, param);
574
- const response = await ssm.getParameter({ Name: path });
575
- config[param] = response.Parameter?.Value || '';
576
- }
577
-
578
- return config;
579
- }
580
- ```
118
+ This applies to operations and status metadata APIs.
581
119
 
582
120
  ## Development
583
121
 
584
- ```bash
585
- # Install dependencies
586
- pnpm install
587
-
588
- # Run tests
589
- pnpm test
590
-
591
- # Build
592
- pnpm build
593
-
594
- # Run projen (regenerate configuration)
595
- pnpm projen
596
- ```
597
-
598
- ## Testing
599
-
600
- The library includes comprehensive tests with 100% coverage:
601
-
602
- ```bash
603
- pnpm test
604
- ```
605
-
606
- ## Contributing
607
-
608
- Contributions are welcome! Please feel free to submit a Pull Request.
609
-
610
- ## License
611
-
612
- Apache-2.0
613
-
614
- ## Related
615
-
616
- - [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html)
617
- - [AWS CDK](https://aws.amazon.com/cdk/)
122
+ - `pnpm test` runs Jest and lint checks via Projen
123
+ - `pnpm build` compiles the library
124
+ - `pnpm projen` regenerates project files from [.projenrc.ts](.projenrc.ts)
618
125
 
619
- ---
126
+ ## Notes
620
127
 
621
- Built with ❀️ for Doctorus
128
+ - The root `README.md` is generated from `.projenrc.ts`
129
+ - Edit Projen configuration first, then re-run `pnpm projen` when documentation changes
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "version": "0.0.38",
35
+ "version": "0.0.39",
36
36
  "jest": {
37
37
  "coverageProvider": "v8",
38
38
  "testMatch": [