@breadstone/archipel-mcp 0.0.21 → 0.0.22

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 (136) hide show
  1. package/data/guides/cryptography-and-otp.md +2 -2
  2. package/data/guides/database-setup.md +4 -3
  3. package/data/guides/email-templates.md +3 -3
  4. package/data/guides/getting-started.md +6 -6
  5. package/data/guides/resource-management.md +9 -9
  6. package/data/packages/platform-blob-storage/api/Variable.AWS_S3_PROVIDER_OPTIONS.md +1 -1
  7. package/data/packages/platform-blob-storage/api/Variable.AZURE_BLOB_PROVIDER_OPTIONS.md +1 -1
  8. package/data/packages/platform-blob-storage/api/Variable.BLOB_PROVIDER.md +1 -1
  9. package/data/packages/platform-blob-storage/api/Variable.VERCEL_BLOB_PROVIDER_OPTIONS.md +1 -1
  10. package/data/packages/platform-core/api/Class.ErrorTemplateService.md +1 -1
  11. package/data/packages/platform-core/api/Class.HostService.md +1 -1
  12. package/data/packages/platform-core/api/Variable.ID_GENERATOR_TOKEN.md +1 -1
  13. package/data/packages/platform-core/api/index.md +0 -27
  14. package/data/packages/platform-core/index.md +7 -4
  15. package/data/packages/platform-cryptography/api/Class.BcryptService.md +4 -4
  16. package/data/packages/platform-cryptography/api/Class.OtpService.md +6 -6
  17. package/data/packages/platform-cryptography/api/Variable.BCRYPT_OPTIONS.md +2 -2
  18. package/data/packages/platform-cryptography/api/Variable.MAX_BCRYPT_PASSWORD_BYTES.md +1 -1
  19. package/data/packages/platform-cryptography/api/Variable.MIN_BCRYPT_ROUNDS.md +1 -1
  20. package/data/packages/platform-cryptography/api/Variable.OTP_OPTIONS.md +2 -2
  21. package/data/packages/platform-cryptography/api/Variable.OTP_SERVICE_TOKEN.md +2 -2
  22. package/data/packages/platform-cryptography/api/Variable.TOTP_EPOCH_TOLERANCE.md +1 -1
  23. package/data/packages/platform-cryptography/api/index.md +3 -3
  24. package/data/packages/platform-documents/api/Class.BaseDocumentRenderer.md +32 -1
  25. package/data/packages/platform-documents/api/Class.DocumentEngine.md +4 -4
  26. package/data/packages/platform-documents/api/Class.DocumentModule.md +2 -2
  27. package/data/packages/platform-documents/api/Class.DocxDocumentRenderer2.md +333 -0
  28. package/data/packages/platform-documents/api/Class.PdfDocumentRenderer.md +355 -0
  29. package/data/packages/platform-documents/api/Interface.IDocumentModuleOptions.md +31 -5
  30. package/data/packages/platform-documents/api/Variable.DOCUMENT_MODULE_OPTIONS.md +1 -1
  31. package/data/packages/platform-documents/api/Variable.DOCUMENT_PARSER_TOKEN.md +1 -1
  32. package/data/packages/platform-documents/api/Variable.DOCUMENT_RENDERER_TOKEN.md +1 -1
  33. package/data/packages/platform-documents/api/Variable.IMAGE_PROCESSOR_TOKEN.md +1 -1
  34. package/data/packages/platform-documents/api/index.md +2 -0
  35. package/data/packages/platform-esigning/api/Class.EsigningClientPort.md +1 -1
  36. package/data/packages/platform-health/index.md +128 -0
  37. package/data/packages/platform-mailing/api/Class.DeliveryStrategyBase.md +0 -1
  38. package/data/packages/platform-mailing/api/Class.MailModule.md +1 -1
  39. package/data/packages/platform-mailing/api/Class.TemplateFetchStrategyBase.md +0 -5
  40. package/data/packages/platform-mailing/api/Variable.SMTP_CONFIG_ENTRIES.md +14 -0
  41. package/data/packages/platform-mailing/api/Variable.SMTP_HOST.md +14 -0
  42. package/data/packages/platform-mailing/api/Variable.SMTP_PASSWORD.md +14 -0
  43. package/data/packages/platform-mailing/api/Variable.SMTP_PORT.md +14 -0
  44. package/data/packages/platform-mailing/api/Variable.SMTP_SECURE.md +14 -0
  45. package/data/packages/platform-mailing/api/Variable.SMTP_USER.md +14 -0
  46. package/data/packages/platform-mailing/api/index.md +6 -3
  47. package/data/packages/platform-mapping/index.md +121 -0
  48. package/data/packages/platform-mcp/api/Variable.MCP_MODULE_OPTIONS.md +1 -1
  49. package/data/packages/platform-openapi/api/Class.SwaggerMultiDocumentService.md +4 -4
  50. package/data/packages/platform-resources/index.md +135 -0
  51. package/data/packages/platform-telemetry/api/Variable.TELEMETRY_ENABLED.md +1 -1
  52. package/data/packages/platform-telemetry/api/Variable.TELEMETRY_FACADE.md +1 -1
  53. package/data/packages/platform-telemetry/api/Variable.TELEMETRY_OPTIONS.md +1 -1
  54. package/{src/knowledge/configPattern.js → data/patterns/config-pattern.md} +44 -47
  55. package/{src/knowledge/dtoPattern.js → data/patterns/dto-pattern.md} +58 -61
  56. package/{src/knowledge/errorHandlingPattern.js → data/patterns/error-handling-pattern.md} +35 -38
  57. package/{src/knowledge/guardPattern.js → data/patterns/guard-pattern.md} +35 -38
  58. package/{src/knowledge/mappingPattern.js → data/patterns/mapping-pattern.md} +43 -144
  59. package/data/patterns/module-pattern.md +182 -0
  60. package/data/patterns/query-pattern.md +137 -0
  61. package/data/patterns/repository-pattern.md +208 -0
  62. package/{src/knowledge/testingPattern.js → data/patterns/testing-pattern.md} +37 -40
  63. package/package.json +1 -1
  64. package/src/PatternsLoader.d.ts +12 -0
  65. package/src/PatternsLoader.js +65 -0
  66. package/src/generators/mappingPatternGenerator.d.ts +5 -0
  67. package/src/generators/mappingPatternGenerator.js +107 -0
  68. package/src/generators/modulePatternGenerator.d.ts +5 -0
  69. package/src/generators/modulePatternGenerator.js +107 -0
  70. package/src/generators/queryPatternGenerator.d.ts +4 -0
  71. package/src/generators/queryPatternGenerator.js +83 -0
  72. package/src/generators/repositoryPatternGenerator.d.ts +5 -0
  73. package/src/generators/repositoryPatternGenerator.js +165 -0
  74. package/src/main.js +15 -9
  75. package/src/models/IPatternDoc.d.ts +15 -0
  76. package/src/models/IPatternDoc.js +3 -0
  77. package/src/tools/registerGetConfigPatternTool.d.ts +2 -1
  78. package/src/tools/registerGetConfigPatternTool.js +4 -3
  79. package/src/tools/registerGetDtoPatternTool.d.ts +2 -1
  80. package/src/tools/registerGetDtoPatternTool.js +4 -3
  81. package/src/tools/registerGetErrorHandlingPatternTool.d.ts +2 -1
  82. package/src/tools/registerGetErrorHandlingPatternTool.js +4 -3
  83. package/src/tools/registerGetGuardPatternTool.d.ts +2 -1
  84. package/src/tools/registerGetGuardPatternTool.js +4 -3
  85. package/src/tools/registerGetMappingPatternTool.d.ts +2 -1
  86. package/src/tools/registerGetMappingPatternTool.js +5 -4
  87. package/src/tools/registerGetModulePatternTool.d.ts +2 -1
  88. package/src/tools/registerGetModulePatternTool.js +5 -4
  89. package/src/tools/registerGetQueryPatternTool.d.ts +2 -1
  90. package/src/tools/registerGetQueryPatternTool.js +5 -4
  91. package/src/tools/registerGetRepositoryPatternTool.d.ts +2 -1
  92. package/src/tools/registerGetRepositoryPatternTool.js +5 -4
  93. package/src/tools/registerGetTestingPatternTool.d.ts +2 -1
  94. package/src/tools/registerGetTestingPatternTool.js +4 -3
  95. package/data/packages/platform-core/api/Class.BlobResourceStrategy.md +0 -195
  96. package/data/packages/platform-core/api/Class.EmbeddedResourceStrategy.md +0 -215
  97. package/data/packages/platform-core/api/Class.FileResourceStrategy.md +0 -192
  98. package/data/packages/platform-core/api/Class.HealthModule.md +0 -42
  99. package/data/packages/platform-core/api/Class.HealthOrchestrator.md +0 -64
  100. package/data/packages/platform-core/api/Class.MappingBuilder.md +0 -110
  101. package/data/packages/platform-core/api/Class.MappingModule.md +0 -46
  102. package/data/packages/platform-core/api/Class.MappingNotRegisteredError.md +0 -56
  103. package/data/packages/platform-core/api/Class.MappingProfileBase.md +0 -52
  104. package/data/packages/platform-core/api/Class.MappingService.md +0 -284
  105. package/data/packages/platform-core/api/Class.ResourceManager.md +0 -565
  106. package/data/packages/platform-core/api/Class.ResourceModule.md +0 -46
  107. package/data/packages/platform-core/api/Class.TypeMappingNotRegisteredError.md +0 -57
  108. package/data/packages/platform-core/api/Function.createMappingKey.md +0 -39
  109. package/data/packages/platform-core/api/Interface.IBlobResourceStrategyConfig.md +0 -28
  110. package/data/packages/platform-core/api/Interface.IBlobServiceAdapter.md +0 -40
  111. package/data/packages/platform-core/api/Interface.IFileResourceStrategyConfig.md +0 -72
  112. package/data/packages/platform-core/api/Interface.IHealthCheckResult.md +0 -46
  113. package/data/packages/platform-core/api/Interface.IHealthIndicator.md +0 -41
  114. package/data/packages/platform-core/api/Interface.IMappingBuilder.md +0 -76
  115. package/data/packages/platform-core/api/Interface.IMappingKey.md +0 -58
  116. package/data/packages/platform-core/api/Interface.IMappingProfile.md +0 -32
  117. package/data/packages/platform-core/api/Interface.IResourceManagerConfig.md +0 -89
  118. package/data/packages/platform-core/api/Interface.IResourceMetadata.md +0 -94
  119. package/data/packages/platform-core/api/Interface.IResourceResult.md +0 -34
  120. package/data/packages/platform-core/api/Interface.IResourceStrategy.md +0 -134
  121. package/data/packages/platform-core/api/Variable.HEALTH_INDICATORS_TOKEN.md +0 -14
  122. package/data/packages/platform-mailing/api/Class.BlobTemplateFetchStrategy.md +0 -60
  123. package/data/packages/platform-mailing/api/Class.FileTemplateFetchStrategy.md +0 -58
  124. package/data/packages/platform-mailing/api/Class.LogDeliveryStrategy.md +0 -71
  125. package/src/knowledge/configPattern.d.ts +0 -5
  126. package/src/knowledge/dtoPattern.d.ts +0 -5
  127. package/src/knowledge/errorHandlingPattern.d.ts +0 -5
  128. package/src/knowledge/guardPattern.d.ts +0 -5
  129. package/src/knowledge/mappingPattern.d.ts +0 -6
  130. package/src/knowledge/modulePattern.d.ts +0 -6
  131. package/src/knowledge/modulePattern.js +0 -283
  132. package/src/knowledge/queryPattern.d.ts +0 -6
  133. package/src/knowledge/queryPattern.js +0 -215
  134. package/src/knowledge/repositoryPattern.d.ts +0 -6
  135. package/src/knowledge/repositoryPattern.js +0 -367
  136. package/src/knowledge/testingPattern.d.ts +0 -5
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: 'Variable: SMTP\_PASSWORD'
3
+ generated: true
4
+ editUrl: false
5
+ ---
6
+ # Variable: SMTP\_PASSWORD
7
+
8
+ ```ts
9
+ const SMTP_PASSWORD: IConfigKey<string>;
10
+ ```
11
+
12
+ Defined in: [platform-mailing/src/smtp/env.ts:24](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/smtp/env.ts#L24)
13
+
14
+ SMTP authentication password.
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: 'Variable: SMTP\_PORT'
3
+ generated: true
4
+ editUrl: false
5
+ ---
6
+ # Variable: SMTP\_PORT
7
+
8
+ ```ts
9
+ const SMTP_PORT: IConfigKey<number>;
10
+ ```
11
+
12
+ Defined in: [platform-mailing/src/smtp/env.ts:15](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/smtp/env.ts#L15)
13
+
14
+ SMTP server port.
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: 'Variable: SMTP\_SECURE'
3
+ generated: true
4
+ editUrl: false
5
+ ---
6
+ # Variable: SMTP\_SECURE
7
+
8
+ ```ts
9
+ const SMTP_SECURE: IConfigKey<boolean>;
10
+ ```
11
+
12
+ Defined in: [platform-mailing/src/smtp/env.ts:18](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/smtp/env.ts#L18)
13
+
14
+ Whether the SMTP connection uses TLS.
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: 'Variable: SMTP\_USER'
3
+ generated: true
4
+ editUrl: false
5
+ ---
6
+ # Variable: SMTP\_USER
7
+
8
+ ```ts
9
+ const SMTP_USER: IConfigKey<string>;
10
+ ```
11
+
12
+ Defined in: [platform-mailing/src/smtp/env.ts:21](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/smtp/env.ts#L21)
13
+
14
+ SMTP authentication username.
@@ -9,10 +9,7 @@ editUrl: false
9
9
 
10
10
  | Class | Description |
11
11
  | ------ | ------ |
12
- | [BlobTemplateFetchStrategy](Class.BlobTemplateFetchStrategy) | The `BlobTemplateFetchStrategy` class. |
13
12
  | [DeliveryStrategyBase](Class.DeliveryStrategyBase) | Represents the base class for all email delivery strategies. |
14
- | [FileTemplateFetchStrategy](Class.FileTemplateFetchStrategy) | The `FileTemplateFetchStrategy` class. |
15
- | [LogDeliveryStrategy](Class.LogDeliveryStrategy) | The `LogDeliveryStrategy` class. |
16
13
  | [MailDeliveryError](Class.MailDeliveryError) | Domain error thrown when email delivery fails. |
17
14
  | [MailgunDeliveryStrategy](Class.MailgunDeliveryStrategy) | Delivers emails via the Mailgun API. |
18
15
  | [MailHealthIndicator](Class.MailHealthIndicator) | Health indicator for mail service. |
@@ -76,3 +73,9 @@ editUrl: false
76
73
  | [SEND\_MAIL\_EVENT\_KEY](Variable.SEND_MAIL_EVENT_KEY) | Event key registry for the mail domain events. |
77
74
  | [SENDGRID\_API\_KEY](Variable.SENDGRID_API_KEY) | API key for the SendGrid delivery service. |
78
75
  | [SENDGRID\_CONFIG\_ENTRIES](Variable.SENDGRID_CONFIG_ENTRIES) | Configuration entries required by the SendGrid delivery provider. |
76
+ | [SMTP\_CONFIG\_ENTRIES](Variable.SMTP_CONFIG_ENTRIES) | Configuration entries required by the SMTP delivery provider. |
77
+ | [SMTP\_HOST](Variable.SMTP_HOST) | SMTP server host. |
78
+ | [SMTP\_PASSWORD](Variable.SMTP_PASSWORD) | SMTP authentication password. |
79
+ | [SMTP\_PORT](Variable.SMTP_PORT) | SMTP server port. |
80
+ | [SMTP\_SECURE](Variable.SMTP_SECURE) | Whether the SMTP connection uses TLS. |
81
+ | [SMTP\_USER](Variable.SMTP_USER) | SMTP authentication username. |
@@ -0,0 +1,121 @@
1
+ ---
2
+ title: platform-mapping
3
+ description: Type-safe object-to-object mapping framework with profile-based configuration.
4
+ order: 2
5
+ tags: [mapping, dto, profiles, type-safe]
6
+ package: '@breadstone/archipel-platform-mapping'
7
+ ---
8
+
9
+ # platform-mapping
10
+
11
+ Type-safe object-to-object mapping framework for transforming domain entities into response DTOs. Extracted from `platform-core` to provide a focused, independently versionable mapping module.
12
+
13
+ **Package:** `@breadstone/archipel-platform-mapping`
14
+
15
+ ## Installation
16
+
17
+ ```typescript
18
+ import {
19
+ MappingModule,
20
+ MappingService,
21
+ MappingProfileBase,
22
+ MappingKey,
23
+ MappingError,
24
+ MappingNotRegisteredError,
25
+ TypeMappingNotRegisteredError,
26
+ } from '@breadstone/archipel-platform-mapping';
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Defining Mapping Keys
32
+
33
+ Mapping keys are branded constants that provide compile-time safety for source → destination pairs:
34
+
35
+ ```typescript
36
+ import { MappingKey } from '@breadstone/archipel-platform-mapping';
37
+ import type { IUserEntity } from './entities';
38
+ import type { UserResponse } from './responses';
39
+
40
+ export const USER_TO_RESPONSE = new MappingKey<IUserEntity, UserResponse>('UserEntity→UserResponse');
41
+ export const USER_TO_SUMMARY = new MappingKey<IUserEntity, UserSummary>('UserEntity→UserSummary');
42
+ ```
43
+
44
+ ## Creating a Mapping Profile
45
+
46
+ Profiles group related mappings into cohesive, injectable classes:
47
+
48
+ ```typescript
49
+ import { Injectable } from '@nestjs/common';
50
+ import { MappingProfileBase, type IMappingBuilder } from '@breadstone/archipel-platform-mapping';
51
+ import { USER_TO_RESPONSE, USER_TO_SUMMARY } from './mapping-keys';
52
+
53
+ @Injectable()
54
+ export class UserMappingProfile extends MappingProfileBase {
55
+ public override configure(builder: IMappingBuilder): void {
56
+ builder.createKeyedMap(USER_TO_RESPONSE, (source) => ({
57
+ id: source.id,
58
+ name: source.userName,
59
+ email: source.email,
60
+ verified: source.isVerified,
61
+ roles: [...source.roles],
62
+ }));
63
+
64
+ builder.createKeyedMap(USER_TO_SUMMARY, (source) => ({
65
+ id: source.id,
66
+ displayName: source.userName ?? source.email ?? 'Anonymous',
67
+ }));
68
+ }
69
+ }
70
+ ```
71
+
72
+ ## Registering Profiles in a Module
73
+
74
+ ```typescript
75
+ import { Module } from '@nestjs/common';
76
+ import { MappingModule } from '@breadstone/archipel-platform-mapping';
77
+ import { UserMappingProfile } from './mappers/UserMappingProfile';
78
+
79
+ @Module({
80
+ imports: [MappingModule.withProfiles([UserMappingProfile])],
81
+ })
82
+ export class AppModule {}
83
+ ```
84
+
85
+ ## Using in a Controller
86
+
87
+ ```typescript
88
+ import { Controller, Get, Param } from '@nestjs/common';
89
+ import { MappingService } from '@breadstone/archipel-platform-mapping';
90
+ import { USER_TO_RESPONSE } from './mapping-keys';
91
+
92
+ @Controller('users')
93
+ export class UserController {
94
+ constructor(
95
+ private readonly _userService: UserService,
96
+ private readonly _mappingService: MappingService,
97
+ ) {}
98
+
99
+ @Get(':id')
100
+ public async getUser(@Param('id') id: string): Promise<UserResponse> {
101
+ const entity = await this._userService.findById(id);
102
+ return this._mappingService.map(USER_TO_RESPONSE, entity);
103
+ }
104
+ }
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Error Classes
110
+
111
+ | Error | Description |
112
+ | ------------------------------ | ----------------------------------------------- |
113
+ | `MappingError` | Base error for all mapping failures |
114
+ | `MappingNotRegisteredError` | Thrown when a mapping key has no registered map |
115
+ | `TypeMappingNotRegisteredError`| Thrown when a type-based mapping is not found |
116
+
117
+ ---
118
+
119
+ ## API Reference
120
+
121
+ See the auto-generated [API Reference](./api/) for full details on all exported classes, interfaces, and types.
@@ -9,6 +9,6 @@ editUrl: false
9
9
  const MCP_MODULE_OPTIONS: typeof MCP_MODULE_OPTIONS;
10
10
  ```
11
11
 
12
- Defined in: [constants/McpTokens.ts:4](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mcp/src/constants/McpTokens.ts#L4)
12
+ Defined in: [tokens/McpTokens.ts:4](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mcp/src/tokens/McpTokens.ts#L4)
13
13
 
14
14
  Injection tokens used by the MCP module.
@@ -5,7 +5,7 @@ editUrl: false
5
5
  ---
6
6
  # Class: SwaggerMultiDocumentService
7
7
 
8
- Defined in: [services/SwaggerMultiDocumentService.ts:14](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L14)
8
+ Defined in: [services/SwaggerMultiDocumentService.ts:15](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L15)
9
9
 
10
10
  ## Constructors
11
11
 
@@ -21,7 +21,7 @@ new SwaggerMultiDocumentService(
21
21
  contentTemplateEngine): SwaggerMultiDocumentService;
22
22
  ```
23
23
 
24
- Defined in: [services/SwaggerMultiDocumentService.ts:30](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L30)
24
+ Defined in: [services/SwaggerMultiDocumentService.ts:31](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L31)
25
25
 
26
26
  #### Parameters
27
27
 
@@ -49,7 +49,7 @@ generateOpenApiDocuments(): {
49
49
  }[];
50
50
  ```
51
51
 
52
- Defined in: [services/SwaggerMultiDocumentService.ts:78](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L78)
52
+ Defined in: [services/SwaggerMultiDocumentService.ts:79](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L79)
53
53
 
54
54
  Generates OpenAPI documents for every registered feature without wiring HTTP routes.
55
55
 
@@ -68,7 +68,7 @@ Generates OpenAPI documents for every registered feature without wiring HTTP rou
68
68
  setupMultipleSwaggerDocuments(): Promise<void>;
69
69
  ```
70
70
 
71
- Defined in: [services/SwaggerMultiDocumentService.ts:54](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L54)
71
+ Defined in: [services/SwaggerMultiDocumentService.ts:55](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-openapi/src/services/SwaggerMultiDocumentService.ts#L55)
72
72
 
73
73
  Setup multiple Swagger documents for different features
74
74
 
@@ -0,0 +1,135 @@
1
+ ---
2
+ title: platform-resources
3
+ description: Multi-strategy resource management with MIME type detection and optional caching.
4
+ order: 3
5
+ tags: [resources, files, blob, mime, caching]
6
+ package: '@breadstone/archipel-platform-resources'
7
+ ---
8
+
9
+ # platform-resources
10
+
11
+ Multi-strategy resource management for NestJS applications. Loads files from the file system, embedded buffers, or blob storage with MIME type detection and optional caching. Extracted from `platform-core` to provide a focused, independently versionable resource module.
12
+
13
+ **Package:** `@breadstone/archipel-platform-resources`
14
+
15
+ ## Installation
16
+
17
+ ```typescript
18
+ import {
19
+ ResourceModule,
20
+ ResourceManager,
21
+ FileResourceStrategy,
22
+ BlobResourceStrategy,
23
+ EmbeddedResourceStrategy,
24
+ ResourceNotFoundError,
25
+ } from '@breadstone/archipel-platform-resources';
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Module Registration
31
+
32
+ Register the module with one or more resource strategies:
33
+
34
+ ```typescript
35
+ import { Module } from '@nestjs/common';
36
+ import { ResourceModule, FileResourceStrategy, EmbeddedResourceStrategy } from '@breadstone/archipel-platform-resources';
37
+ import { join } from 'node:path';
38
+
39
+ @Module({
40
+ imports: [
41
+ ResourceModule.forRoot({
42
+ strategies: [
43
+ new FileResourceStrategy({
44
+ basePath: join(__dirname, '..', 'assets'),
45
+ }),
46
+ new EmbeddedResourceStrategy([
47
+ { name: 'fallback.html', buffer: Buffer.from('<html>Fallback</html>') },
48
+ ]),
49
+ ],
50
+ }),
51
+ ],
52
+ })
53
+ export class AppModule {}
54
+ ```
55
+
56
+ ## Using ResourceManager
57
+
58
+ Inject and use `ResourceManager` to load resources at runtime:
59
+
60
+ ```typescript
61
+ import { Injectable } from '@nestjs/common';
62
+ import { ResourceManager } from '@breadstone/archipel-platform-resources';
63
+
64
+ @Injectable()
65
+ export class TemplateService {
66
+ constructor(private readonly _resourceManager: ResourceManager) {}
67
+
68
+ public async loadTemplate(name: string): Promise<string> {
69
+ const result = await this._resourceManager.get(name);
70
+ return result.buffer.toString('utf-8');
71
+ }
72
+ }
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Strategies
78
+
79
+ | Strategy | Description |
80
+ | --------------------------- | ----------------------------------------------------------------- |
81
+ | `FileResourceStrategy` | Loads resources from the local file system with glob support |
82
+ | `BlobResourceStrategy` | Loads resources from a blob storage adapter (Vercel, Azure, S3) |
83
+ | `EmbeddedResourceStrategy` | Serves pre-loaded in-memory buffers |
84
+
85
+ ### BlobResourceStrategy
86
+
87
+ For loading resources from cloud blob storage, provide an adapter that implements `IBlobServiceAdapter`:
88
+
89
+ ```typescript
90
+ import { BlobResourceStrategy, type IBlobServiceAdapter } from '@breadstone/archipel-platform-resources';
91
+
92
+ const blobStrategy = new BlobResourceStrategy({
93
+ adapter: myBlobAdapter,
94
+ containerName: 'templates',
95
+ });
96
+ ```
97
+
98
+ ### Custom Strategies
99
+
100
+ Implement `IResourceStrategy` to create your own resource loading strategy:
101
+
102
+ ```typescript
103
+ import type { IResourceStrategy, IResourceResult } from '@breadstone/archipel-platform-resources';
104
+
105
+ export class CustomStrategy implements IResourceStrategy {
106
+ public async get(name: string): Promise<IResourceResult | undefined> {
107
+ // Custom loading logic
108
+ }
109
+ }
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Interfaces
115
+
116
+ | Interface | Description |
117
+ | ---------------------- | ---------------------------------------- |
118
+ | `IResourceResult` | Result object with `buffer` and `metadata` |
119
+ | `IResourceMetadata` | Metadata including `mimeType` and `size` |
120
+ | `IResourceStrategy` | Strategy contract for resource loading |
121
+ | `IBlobServiceAdapter` | Adapter contract for blob storage access |
122
+
123
+ ---
124
+
125
+ ## Error Classes
126
+
127
+ | Error | Description |
128
+ | ------------------------ | --------------------------------------------- |
129
+ | `ResourceNotFoundError` | Thrown when a requested resource is not found |
130
+
131
+ ---
132
+
133
+ ## API Reference
134
+
135
+ See the auto-generated [API Reference](./api/) for full details on all exported classes, interfaces, and types.
@@ -9,4 +9,4 @@ editUrl: false
9
9
  const TELEMETRY_ENABLED: typeof TELEMETRY_ENABLED;
10
10
  ```
11
11
 
12
- Defined in: [tokens.ts:4](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens.ts#L4)
12
+ Defined in: [tokens/TelemetryTokens.ts:4](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens/TelemetryTokens.ts#L4)
@@ -9,4 +9,4 @@ editUrl: false
9
9
  const TELEMETRY_FACADE: typeof TELEMETRY_FACADE;
10
10
  ```
11
11
 
12
- Defined in: [tokens.ts:3](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens.ts#L3)
12
+ Defined in: [tokens/TelemetryTokens.ts:3](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens/TelemetryTokens.ts#L3)
@@ -9,4 +9,4 @@ editUrl: false
9
9
  const TELEMETRY_OPTIONS: typeof TELEMETRY_OPTIONS;
10
10
  ```
11
11
 
12
- Defined in: [tokens.ts:2](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens.ts#L2)
12
+ Defined in: [tokens/TelemetryTokens.ts:2](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-telemetry/src/tokens/TelemetryTokens.ts#L2)
@@ -1,46 +1,45 @@
1
- "use strict";
2
- /**
3
- * Static knowledge content for the Archipel configuration pattern.
4
- * Returned by the get-config-pattern tool.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.CONFIG_PATTERN_KNOWLEDGE = void 0;
8
- exports.CONFIG_PATTERN_KNOWLEDGE = `# Archipel Configuration Pattern
1
+ ---
2
+ title: Configuration Pattern
3
+ description: Typed config keys, ConfigRegistry, ConfigService, env.ts conventions, and ConfigModule integration.
4
+ order: 1
5
+ ---
6
+
7
+ # Archipel Configuration Pattern
9
8
 
10
9
  ## Overview
11
10
 
12
11
  Archipel uses a **typed configuration key** system with a **central registry**.
13
- Each platform library declares its required and optional config keys in an \`env.ts\`
14
- file, which are registered into the global \`ConfigRegistry\`. At runtime, the
15
- \`ConfigService\` resolves values through a pluggable strategy (environment variables,
12
+ Each platform library declares its required and optional config keys in an `env.ts`
13
+ file, which are registered into the global `ConfigRegistry`. At runtime, the
14
+ `ConfigService` resolves values through a pluggable strategy (environment variables,
16
15
  Azure App Configuration, etc.).
17
16
 
18
- **Rule:** No direct \`process.env\` access outside of config strategy implementations.
17
+ **Rule:** No direct `process.env` access outside of config strategy implementations.
19
18
 
20
19
  ## Core Types
21
20
 
22
21
  ### IConfigKey<TType>
23
22
 
24
- \`\`\`typescript
23
+ ```typescript
25
24
  export interface IConfigKey<TType = unknown> {
26
25
  readonly _type?: TType; // Phantom type for compile-time safety
27
26
  readonly key: string; // The actual config key string
28
27
  }
29
- \`\`\`
28
+ ```
30
29
 
31
30
  ### createConfigKey<TType>
32
31
 
33
- \`\`\`typescript
32
+ ```typescript
34
33
  import { createConfigKey } from '@breadstone/archipel-platform-core';
35
34
 
36
35
  export const APP_URL = createConfigKey<string>('APP_URL');
37
36
  export const APP_PORT = createConfigKey<number>('APP_PORT');
38
37
  export const FEATURE_ENABLED = createConfigKey<boolean>('FEATURE_ENABLED');
39
- \`\`\`
38
+ ```
40
39
 
41
40
  ## ConfigService API
42
41
 
43
- \`\`\`typescript
42
+ ```typescript
44
43
  @Injectable()
45
44
  export class ConfigService {
46
45
 
@@ -54,18 +53,18 @@ export class ConfigService {
54
53
  public compare<T>(key: string, value: T): boolean;
55
54
 
56
55
  }
57
- \`\`\`
56
+ ```
58
57
 
59
58
  **Auto-parsing:** String values are automatically converted:
60
- - \`'true'\` / \`'false'\`\`boolean\`
61
- - Numeric strings → \`number\`
62
- - Empty strings → \`null\`
59
+ - `'true'` / `'false'``boolean`
60
+ - Numeric strings → `number`
61
+ - Empty strings → `null`
63
62
 
64
63
  ## ConfigRegistry
65
64
 
66
65
  A static global registry that collects all declared config keys at module initialization.
67
66
 
68
- \`\`\`typescript
67
+ ```typescript
69
68
  export class ConfigRegistry {
70
69
 
71
70
  // Register keys for a module
@@ -78,11 +77,11 @@ export class ConfigRegistry {
78
77
  public static getModules(): ReadonlyArray<string>;
79
78
 
80
79
  }
81
- \`\`\`
80
+ ```
82
81
 
83
82
  ### IConfigRegistryEntry
84
83
 
85
- \`\`\`typescript
84
+ ```typescript
86
85
  export interface IConfigRegistryEntry<TType = unknown> {
87
86
  readonly key: IConfigKey<TType>;
88
87
  readonly module: string;
@@ -90,13 +89,13 @@ export interface IConfigRegistryEntry<TType = unknown> {
90
89
  readonly defaultValue?: TType;
91
90
  readonly description?: string;
92
91
  }
93
- \`\`\`
92
+ ```
94
93
 
95
94
  ## How to Add Configuration to a Library
96
95
 
97
96
  ### Step 1: Define typed config keys in env.ts
98
97
 
99
- \`\`\`typescript
98
+ ```typescript
100
99
  // src/env.ts
101
100
  import { createConfigKey } from '@breadstone/archipel-platform-core';
102
101
  import { ConfigRegistry, IConfigRegistryEntry } from '@breadstone/archipel-platform-core';
@@ -118,25 +117,25 @@ export const PLATFORM_PAYMENTS_CONFIG_ENTRIES: ReadonlyArray<Omit<IConfigRegistr
118
117
  { key: STRIPE_WEBHOOK_SECRET, required: true, description: 'Stripe webhook signing secret.' },
119
118
  { key: PAYMENT_CURRENCY, required: false, defaultValue: 'EUR', description: 'Default payment currency.' },
120
119
  ];
121
- \`\`\`
120
+ ```
122
121
 
123
122
  ### Step 2: Register in ConfigModule
124
123
 
125
- \`\`\`typescript
124
+ ```typescript
126
125
  // In the module's register() method:
127
126
  imports: [ConfigModule.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES)]
128
- \`\`\`
127
+ ```
129
128
 
130
129
  Or for libraries without a dedicated module (self-registration):
131
130
 
132
- \`\`\`typescript
131
+ ```typescript
133
132
  // At the bottom of env.ts:
134
133
  ConfigRegistry.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES);
135
- \`\`\`
134
+ ```
136
135
 
137
136
  ### Step 3: Use in services
138
137
 
139
- \`\`\`typescript
138
+ ```typescript
140
139
  @Injectable()
141
140
  export class StripeClient {
142
141
 
@@ -151,41 +150,41 @@ export class StripeClient {
151
150
  }
152
151
 
153
152
  }
154
- \`\`\`
153
+ ```
155
154
 
156
155
  ## ConfigModule
157
156
 
158
157
  ### register() — Per-library config registration
159
158
 
160
- Declares which config keys a library needs. Used in \`imports\` of feature modules.
159
+ Declares which config keys a library needs. Used in `imports` of feature modules.
161
160
 
162
- \`\`\`typescript
161
+ ```typescript
163
162
  ConfigModule.register('platform-authentication', PLATFORM_AUTHENTICATION_CONFIG_ENTRIES)
164
- \`\`\`
163
+ ```
165
164
 
166
165
  ### forRoot() — Application bootstrap
167
166
 
168
167
  Configures the global strategy and static overrides. Used once in the root module.
169
168
 
170
- \`\`\`typescript
169
+ ```typescript
171
170
  ConfigModule.forRoot({
172
171
  strategyFactory: () => new EnvironmentConfigStrategy(),
173
172
  statics: { APP_VERSION: '1.0.0' },
174
173
  })
175
- \`\`\`
174
+ ```
176
175
 
177
176
  ## ConfigStrategyBase
178
177
 
179
178
  Pluggable strategy for resolving config values:
180
179
 
181
- \`\`\`typescript
180
+ ```typescript
182
181
  export abstract class ConfigStrategyBase {
183
182
  public abstract initialize(): void;
184
183
  public abstract resolve<T>(key: string): T;
185
184
  public abstract tryResolve<T>(key: string, fallback: T): T;
186
185
  public abstract has(key: string): boolean;
187
186
  }
188
- \`\`\`
187
+ ```
189
188
 
190
189
  Implementations can read from environment variables, Azure App Configuration, Consul, etc.
191
190
 
@@ -200,12 +199,10 @@ Implementations can read from environment variables, Azure App Configuration, Co
200
199
 
201
200
  ## Rules
202
201
 
203
- 1. **All config keys defined via \`createConfigKey<T>()\`** — never raw \`process.env\` access.
204
- 2. **Each library declares entries in \`env.ts\`** with required flag, default value, and description.
205
- 3. **Registration via \`ConfigModule.register()\`** in the module, or self-registration for libraries without modules.
206
- 4. **\`ConfigService.get()\` throws on missing required keys** — fail-fast at startup.
207
- 5. **Use \`tryGet()\` with fallback** for optional keys.
202
+ 1. **All config keys defined via `createConfigKey<T>()`** — never raw `process.env` access.
203
+ 2. **Each library declares entries in `env.ts`** with required flag, default value, and description.
204
+ 3. **Registration via `ConfigModule.register()`** in the module, or self-registration for libraries without modules.
205
+ 4. **`ConfigService.get()` throws on missing required keys** — fail-fast at startup.
206
+ 5. **Use `tryGet()` with fallback** for optional keys.
208
207
  6. **Config key names use UPPER_SNAKE_CASE** matching environment variable conventions.
209
208
  7. **Group related keys** with comment separators in env.ts.
210
- `;
211
- //# sourceMappingURL=configPattern.js.map