@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
@@ -1,134 +0,0 @@
1
- ---
2
- title: 'Interface: IResourceStrategy'
3
- generated: true
4
- editUrl: false
5
- ---
6
- # Interface: IResourceStrategy
7
-
8
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:8](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L8)
9
-
10
- Strategy for loading resources from a specific source.
11
-
12
- ## Properties
13
-
14
- ### name
15
-
16
- ```ts
17
- readonly name: string;
18
- ```
19
-
20
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:13](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L13)
21
-
22
- The unique name of this strategy.
23
-
24
- ## Methods
25
-
26
- ### exists()
27
-
28
- ```ts
29
- exists(key): boolean;
30
- ```
31
-
32
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:37](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L37)
33
-
34
- Checks if a resource exists without loading it.
35
-
36
- #### Parameters
37
-
38
- | Parameter | Type | Description |
39
- | ------ | ------ | ------ |
40
- | `key` | `string` | The resource key/identifier |
41
-
42
- #### Returns
43
-
44
- `boolean`
45
-
46
- True if the resource exists
47
-
48
- ***
49
-
50
- ### existsAsync()
51
-
52
- ```ts
53
- existsAsync(key): Promise<boolean>;
54
- ```
55
-
56
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:45](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L45)
57
-
58
- Checks if a resource exists without loading it (asynchronous).
59
-
60
- #### Parameters
61
-
62
- | Parameter | Type | Description |
63
- | ------ | ------ | ------ |
64
- | `key` | `string` | The resource key/identifier |
65
-
66
- #### Returns
67
-
68
- `Promise`\<`boolean`\>
69
-
70
- Promise resolving to true if the resource exists
71
-
72
- ***
73
-
74
- ### load()
75
-
76
- ```ts
77
- load(key): IResourceResult | undefined;
78
- ```
79
-
80
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:21](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L21)
81
-
82
- Loads a resource by its key.
83
-
84
- #### Parameters
85
-
86
- | Parameter | Type | Description |
87
- | ------ | ------ | ------ |
88
- | `key` | `string` | The resource key/identifier |
89
-
90
- #### Returns
91
-
92
- [`IResourceResult`](Interface.IResourceResult) \| `undefined`
93
-
94
- The resource result or undefined if not found
95
-
96
- ***
97
-
98
- ### loadAsync()
99
-
100
- ```ts
101
- loadAsync(key): Promise<IResourceResult | undefined>;
102
- ```
103
-
104
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L29)
105
-
106
- Loads a resource by its key (asynchronous).
107
-
108
- #### Parameters
109
-
110
- | Parameter | Type | Description |
111
- | ------ | ------ | ------ |
112
- | `key` | `string` | The resource key/identifier |
113
-
114
- #### Returns
115
-
116
- `Promise`\<[`IResourceResult`](Interface.IResourceResult) \| `undefined`\>
117
-
118
- Promise resolving to the resource result or undefined if not found
119
-
120
- ***
121
-
122
- ### whatDoIHave()
123
-
124
- ```ts
125
- whatDoIHave(): void;
126
- ```
127
-
128
- Defined in: [resources/strategies/abstracts/IResourceStrategy.ts:50](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/resources/strategies/abstracts/IResourceStrategy.ts#L50)
129
-
130
- List all files and folders in the base paths for debugging purposes.
131
-
132
- #### Returns
133
-
134
- `void`
@@ -1,14 +0,0 @@
1
- ---
2
- title: 'Variable: HEALTH\_INDICATORS\_TOKEN'
3
- generated: true
4
- editUrl: false
5
- ---
6
- # Variable: HEALTH\_INDICATORS\_TOKEN
7
-
8
- ```ts
9
- const HEALTH_INDICATORS_TOKEN: typeof HEALTH_INDICATORS_TOKEN;
10
- ```
11
-
12
- Defined in: [health/HealthTokens.ts:2](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/health/HealthTokens.ts#L2)
13
-
14
- Injection token for registered health indicators
@@ -1,60 +0,0 @@
1
- ---
2
- title: 'Class: BlobTemplateFetchStrategy'
3
- generated: true
4
- editUrl: false
5
- ---
6
- # Class: BlobTemplateFetchStrategy
7
-
8
- Defined in: [platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts#L16)
9
-
10
- The `BlobTemplateFetchStrategy` class.
11
-
12
- ## Extends
13
-
14
- - [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase)
15
-
16
- ## Constructors
17
-
18
- ### Constructor
19
-
20
- ```ts
21
- new BlobTemplateFetchStrategy(blobService): BlobTemplateFetchStrategy;
22
- ```
23
-
24
- Defined in: [platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts:31](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts#L31)
25
-
26
- Constructs a new instance of the `BlobTemplateFetchStrategy` class.
27
-
28
- #### Parameters
29
-
30
- | Parameter | Type |
31
- | ------ | ------ |
32
- | `blobService` | `BlobService` |
33
-
34
- #### Returns
35
-
36
- `BlobTemplateFetchStrategy`
37
-
38
- #### Overrides
39
-
40
- [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase).[`constructor`](Class.TemplateFetchStrategyBase#constructor)
41
-
42
- ## Methods
43
-
44
- ### load()
45
-
46
- ```ts
47
- abstract load(): Promise<Record<string, IMailTemplateVariants>>;
48
- ```
49
-
50
- Defined in: [platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts:41](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/BlobTemplateFetchStrategy.ts#L41)
51
-
52
- Loads the templates.
53
-
54
- #### Returns
55
-
56
- `Promise`\<`Record`\<`string`, [`IMailTemplateVariants`](Interface.IMailTemplateVariants)\>\>
57
-
58
- #### Overrides
59
-
60
- [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase).[`load`](Class.TemplateFetchStrategyBase#load)
@@ -1,58 +0,0 @@
1
- ---
2
- title: 'Class: FileTemplateFetchStrategy'
3
- generated: true
4
- editUrl: false
5
- ---
6
- # Class: FileTemplateFetchStrategy
7
-
8
- Defined in: [platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts#L16)
9
-
10
- The `FileTemplateFetchStrategy` class.
11
-
12
- ## Extends
13
-
14
- - [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase)
15
-
16
- ## Constructors
17
-
18
- ### Constructor
19
-
20
- ```ts
21
- new FileTemplateFetchStrategy(resourceManager): FileTemplateFetchStrategy;
22
- ```
23
-
24
- Defined in: [platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts:26](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts#L26)
25
-
26
- #### Parameters
27
-
28
- | Parameter | Type |
29
- | ------ | ------ |
30
- | `resourceManager` | `ResourceManager` |
31
-
32
- #### Returns
33
-
34
- `FileTemplateFetchStrategy`
35
-
36
- #### Overrides
37
-
38
- [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase).[`constructor`](Class.TemplateFetchStrategyBase#constructor)
39
-
40
- ## Methods
41
-
42
- ### load()
43
-
44
- ```ts
45
- load(): Promise<Record<string, IMailTemplateVariants>>;
46
- ```
47
-
48
- Defined in: [platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts:40](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/templating/strategies/FileTemplateFetchStrategy.ts#L40)
49
-
50
- Loads mail templates from the file system.
51
-
52
- #### Returns
53
-
54
- `Promise`\<`Record`\<`string`, [`IMailTemplateVariants`](Interface.IMailTemplateVariants)\>\>
55
-
56
- #### Overrides
57
-
58
- [`TemplateFetchStrategyBase`](Class.TemplateFetchStrategyBase).[`load`](Class.TemplateFetchStrategyBase#load)
@@ -1,71 +0,0 @@
1
- ---
2
- title: 'Class: LogDeliveryStrategy'
3
- generated: true
4
- editUrl: false
5
- ---
6
- # Class: LogDeliveryStrategy
7
-
8
- Defined in: [platform-mailing/src/services/strategies/LogDeliveryStrategy.ts:13](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/strategies/LogDeliveryStrategy.ts#L13)
9
-
10
- The `LogDeliveryStrategy` class.
11
-
12
- ## Extends
13
-
14
- - [`DeliveryStrategyBase`](Class.DeliveryStrategyBase)
15
-
16
- ## Constructors
17
-
18
- ### Constructor
19
-
20
- ```ts
21
- new LogDeliveryStrategy(): LogDeliveryStrategy;
22
- ```
23
-
24
- Defined in: [platform-mailing/src/services/strategies/LogDeliveryStrategy.ts:27](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/strategies/LogDeliveryStrategy.ts#L27)
25
-
26
- Constructs a new instance of the `LogDelivery` class.
27
-
28
- #### Returns
29
-
30
- `LogDeliveryStrategy`
31
-
32
- #### Overrides
33
-
34
- [`DeliveryStrategyBase`](Class.DeliveryStrategyBase).[`constructor`](Class.DeliveryStrategyBase#constructor)
35
-
36
- ## Methods
37
-
38
- ### send()
39
-
40
- ```ts
41
- abstract send(
42
- from,
43
- to,
44
- subject,
45
- content,
46
- isHtml,
47
- _attachments?): Promise<void>;
48
- ```
49
-
50
- Defined in: [platform-mailing/src/services/strategies/LogDeliveryStrategy.ts:35](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/strategies/LogDeliveryStrategy.ts#L35)
51
-
52
- Sends an email with either plain text or HTML content.
53
-
54
- #### Parameters
55
-
56
- | Parameter | Type | Description |
57
- | ------ | ------ | ------ |
58
- | `from` | `string` | Sender's email address (optional, defaults to config) |
59
- | `to` | `string` | Recipient's email address |
60
- | `subject` | `string` | Subject of the email |
61
- | `content` | `string` | Email body content (plain text or HTML) |
62
- | `isHtml` | `boolean` | Flag to indicate whether the email is HTML (true) or plain text (false) |
63
- | `_attachments?` | [`IMailAttachment`](Interface.IMailAttachment)[] | - |
64
-
65
- #### Returns
66
-
67
- `Promise`\<`void`\>
68
-
69
- #### Overrides
70
-
71
- [`DeliveryStrategyBase`](Class.DeliveryStrategyBase).[`send`](Class.DeliveryStrategyBase#send)
@@ -1,5 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel configuration pattern.
3
- * Returned by the get-config-pattern tool.
4
- */
5
- export declare const CONFIG_PATTERN_KNOWLEDGE = "# Archipel Configuration Pattern\n\n## Overview\n\nArchipel uses a **typed configuration key** system with a **central registry**.\nEach platform library declares its required and optional config keys in an `env.ts`\nfile, which are registered into the global `ConfigRegistry`. At runtime, the\n`ConfigService` resolves values through a pluggable strategy (environment variables,\nAzure App Configuration, etc.).\n\n**Rule:** No direct `process.env` access outside of config strategy implementations.\n\n## Core Types\n\n### IConfigKey<TType>\n\n```typescript\nexport interface IConfigKey<TType = unknown> {\n readonly _type?: TType; // Phantom type for compile-time safety\n readonly key: string; // The actual config key string\n}\n```\n\n### createConfigKey<TType>\n\n```typescript\nimport { createConfigKey } from '@breadstone/archipel-platform-core';\n\nexport const APP_URL = createConfigKey<string>('APP_URL');\nexport const APP_PORT = createConfigKey<number>('APP_PORT');\nexport const FEATURE_ENABLED = createConfigKey<boolean>('FEATURE_ENABLED');\n```\n\n## ConfigService API\n\n```typescript\n@Injectable()\nexport class ConfigService {\n\n // Throws if key not found\n public get<T>(key: string): T;\n\n // Returns fallback if key not found\n public tryGet<T>(key: string, fallback: T): T;\n\n // Compares a key's value to an expected value\n public compare<T>(key: string, value: T): boolean;\n\n}\n```\n\n**Auto-parsing:** String values are automatically converted:\n- `'true'` / `'false'` \u2192 `boolean`\n- Numeric strings \u2192 `number`\n- Empty strings \u2192 `null`\n\n## ConfigRegistry\n\nA static global registry that collects all declared config keys at module initialization.\n\n```typescript\nexport class ConfigRegistry {\n\n // Register keys for a module\n public static register(module: string, entries: ReadonlyArray<Omit<IConfigRegistryEntry, 'module'>>): void;\n\n // Query all registered entries\n public static getAll(): ReadonlyArray<IConfigRegistryEntry>;\n public static getByModule(): ReadonlyMap<string, ReadonlyArray<IConfigRegistryEntry>>;\n public static getRequired(): ReadonlyArray<IConfigRegistryEntry>;\n public static getModules(): ReadonlyArray<string>;\n\n}\n```\n\n### IConfigRegistryEntry\n\n```typescript\nexport interface IConfigRegistryEntry<TType = unknown> {\n readonly key: IConfigKey<TType>;\n readonly module: string;\n readonly required: boolean;\n readonly defaultValue?: TType;\n readonly description?: string;\n}\n```\n\n## How to Add Configuration to a Library\n\n### Step 1: Define typed config keys in env.ts\n\n```typescript\n// src/env.ts\nimport { createConfigKey } from '@breadstone/archipel-platform-core';\nimport { ConfigRegistry, IConfigRegistryEntry } from '@breadstone/archipel-platform-core';\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Keys\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const STRIPE_SECRET_KEY = createConfigKey<string>('STRIPE_SECRET_KEY');\nexport const STRIPE_WEBHOOK_SECRET = createConfigKey<string>('STRIPE_WEBHOOK_SECRET');\nexport const PAYMENT_CURRENCY = createConfigKey<string>('PAYMENT_CURRENCY');\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Registry entries\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const PLATFORM_PAYMENTS_CONFIG_ENTRIES: ReadonlyArray<Omit<IConfigRegistryEntry, 'module'>> = [\n { key: STRIPE_SECRET_KEY, required: true, description: 'Stripe API secret key.' },\n { key: STRIPE_WEBHOOK_SECRET, required: true, description: 'Stripe webhook signing secret.' },\n { key: PAYMENT_CURRENCY, required: false, defaultValue: 'EUR', description: 'Default payment currency.' },\n];\n```\n\n### Step 2: Register in ConfigModule\n\n```typescript\n// In the module's register() method:\nimports: [ConfigModule.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES)]\n```\n\nOr for libraries without a dedicated module (self-registration):\n\n```typescript\n// At the bottom of env.ts:\nConfigRegistry.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES);\n```\n\n### Step 3: Use in services\n\n```typescript\n@Injectable()\nexport class StripeClient {\n\n private readonly _configService: ConfigService;\n\n public constructor(configService: ConfigService) {\n this._configService = configService;\n }\n\n private getApiKey(): string {\n return this._configService.get<string>('STRIPE_SECRET_KEY');\n }\n\n}\n```\n\n## ConfigModule\n\n### register() \u2014 Per-library config registration\n\nDeclares which config keys a library needs. Used in `imports` of feature modules.\n\n```typescript\nConfigModule.register('platform-authentication', PLATFORM_AUTHENTICATION_CONFIG_ENTRIES)\n```\n\n### forRoot() \u2014 Application bootstrap\n\nConfigures the global strategy and static overrides. Used once in the root module.\n\n```typescript\nConfigModule.forRoot({\n strategyFactory: () => new EnvironmentConfigStrategy(),\n statics: { APP_VERSION: '1.0.0' },\n})\n```\n\n## ConfigStrategyBase\n\nPluggable strategy for resolving config values:\n\n```typescript\nexport abstract class ConfigStrategyBase {\n public abstract initialize(): void;\n public abstract resolve<T>(key: string): T;\n public abstract tryResolve<T>(key: string, fallback: T): T;\n public abstract has(key: string): boolean;\n}\n```\n\nImplementations can read from environment variables, Azure App Configuration, Consul, etc.\n\n## Existing Config Modules\n\n| Module | Prefix | Example Keys |\n|--------|--------|-------------|\n| platform-core | APP_, NODE_ENV, INTELLIGENCE_ | APP_URL, APP_PORT, APP_VERSION, INTELLIGENCE_MODEL |\n| platform-authentication | AUTH_ | AUTH_JWT_SECRET, AUTH_JWT_EXPIRES_IN |\n| platform-payments | STRIPE_ | STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET |\n| platform-openapi | SWAGGER_ | SWAGGER_CONTACT_NAME, SWAGGER_CONTACT_URL |\n\n## Rules\n\n1. **All config keys defined via `createConfigKey<T>()`** \u2014 never raw `process.env` access.\n2. **Each library declares entries in `env.ts`** with required flag, default value, and description.\n3. **Registration via `ConfigModule.register()`** in the module, or self-registration for libraries without modules.\n4. **`ConfigService.get()` throws on missing required keys** \u2014 fail-fast at startup.\n5. **Use `tryGet()` with fallback** for optional keys.\n6. **Config key names use UPPER_SNAKE_CASE** matching environment variable conventions.\n7. **Group related keys** with comment separators in env.ts.\n";
@@ -1,5 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel DTO & validation pattern.
3
- * Returned by the get-dto-pattern tool.
4
- */
5
- export declare const DTO_PATTERN_KNOWLEDGE = "# Archipel DTO & Validation Pattern\n\n## Overview\n\nArchipel uses **class-based DTOs** with **class-validator** decorators for input validation\nand **class-transformer** decorators for serialization control. A global `ValidationPipe`\nenforces validation on all incoming requests automatically.\n\nRequest DTOs validate input; Response classes define the output shape with\n`@ApiProperty` decorators for OpenAPI documentation.\n\n## Global Validation Pipe\n\n```typescript\n// In main.ts bootstrap:\napp.useGlobalPipes(\n new ValidationPipe({\n whitelist: true, // Strip unknown properties\n forbidNonWhitelisted: true, // Throw on unknown properties\n transform: true, // Auto-transform payloads to DTO instances\n }),\n);\n```\n\n## Request DTO (Input Validation)\n\n```typescript\n// dtos/CreateUserRequest.ts\nimport { Expose } from 'class-transformer';\nimport { IsEmail, IsString, MinLength, MaxLength } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class CreateUserRequest {\n\n @Expose()\n @IsEmail()\n @ApiProperty({ example: 'user@example.com', description: 'User email address' })\n public email!: string;\n\n @Expose()\n @IsString()\n @MinLength(3)\n @MaxLength(50)\n @ApiProperty({ description: 'Display name' })\n public name!: string;\n\n @Expose()\n @IsString()\n @MinLength(8)\n @ApiProperty({ description: 'Password (min 8 characters)' })\n public password!: string;\n\n}\n```\n\n## Response DTO (Output Shape)\n\n```typescript\n// dtos/UserResponse.ts\nimport { Expose } from 'class-transformer';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UserResponse {\n\n @Expose()\n @ApiProperty({ description: 'Unique identifier' })\n public id!: string;\n\n @Expose()\n @ApiProperty({ description: 'User email address' })\n public email!: string;\n\n @Expose()\n @ApiProperty({ description: 'Display name' })\n public name!: string;\n\n @Expose()\n @ApiProperty({ description: 'Account creation date' })\n public createdAt!: Date;\n\n // Note: password is intentionally NOT exposed\n\n}\n```\n\n## Common Validators\n\n### Basic Types\n\n| Decorator | Purpose |\n|-----------|---------|\n| `@IsString()` | Must be a string |\n| `@IsNumber()` | Must be a number |\n| `@IsBoolean()` | Must be a boolean |\n| `@IsEmail()` | Must be a valid email |\n| `@IsUUID()` | Must be a valid UUID |\n| `@IsDate()` | Must be a Date instance |\n| `@IsEnum(MyEnum)` | Must be a value from the enum |\n| `@IsOptional()` | Field is optional (skip validation if undefined) |\n\n### String Constraints\n\n| Decorator | Purpose |\n|-----------|---------|\n| `@MinLength(n)` | Minimum string length |\n| `@MaxLength(n)` | Maximum string length |\n| `@Matches(regex)` | Must match a regex pattern |\n| `@IsNotEmpty()` | Must not be empty string |\n\n### Number Constraints\n\n| Decorator | Purpose |\n|-----------|---------|\n| `@Min(n)` | Minimum value |\n| `@Max(n)` | Maximum value |\n| `@IsPositive()` | Must be > 0 |\n| `@IsInt()` | Must be integer |\n\n### Nested & Array\n\n| Decorator | Purpose |\n|-----------|---------|\n| `@ValidateNested()` | Validate nested objects |\n| `@Type(() => Cls)` | Transform to class instance (class-transformer) |\n| `@IsArray()` | Must be an array |\n| `@ArrayMinSize(n)` | Minimum array length |\n| `@ArrayMaxSize(n)` | Maximum array length |\n\n## Cross-Field Validation\n\nFor fields that depend on each other, use custom class-level validators:\n\n```typescript\nimport { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments, Validate } from 'class-validator';\n\n@ValidatorConstraint({ name: 'Match', async: false })\nexport class MatchConstraint implements ValidatorConstraintInterface {\n\n public validate(value: unknown, args: ValidationArguments): boolean {\n const [relatedPropertyName] = args.constraints;\n const relatedValue = (args.object as Record<string, unknown>)[relatedPropertyName];\n\n return value === relatedValue;\n }\n\n public defaultMessage(args: ValidationArguments): string {\n const [relatedPropertyName] = args.constraints;\n\n return \\`\\${args.property} must match \\${relatedPropertyName}\\`;\n }\n\n}\n\n// Usage in DTO:\nexport class ResetPasswordRequest {\n\n @Expose()\n @IsString()\n @MinLength(8)\n public password!: string;\n\n @Expose()\n @IsString()\n @Validate(MatchConstraint, ['password'])\n public confirmPassword!: string;\n\n}\n```\n\n## Query Parameter DTOs\n\nFor GET request query parameters, use `@Transform()` and `@Type()` for type coercion:\n\n```typescript\nimport { Type } from 'class-transformer';\nimport { IsOptional, IsInt, Min, Max, IsString } from 'class-validator';\nimport { ApiPropertyOptional } from '@nestjs/swagger';\n\nexport class PaginationQuery {\n\n @IsOptional()\n @Type(() => Number)\n @IsInt()\n @Min(1)\n @ApiPropertyOptional({ default: 1 })\n public page?: number = 1;\n\n @IsOptional()\n @Type(() => Number)\n @IsInt()\n @Min(1)\n @Max(100)\n @ApiPropertyOptional({ default: 20 })\n public perPage?: number = 20;\n\n @IsOptional()\n @IsString()\n @ApiPropertyOptional()\n public search?: string;\n\n}\n```\n\n## OpenAPI / Swagger Integration\n\n### @ApiProperty Decorators\n\n```typescript\n@ApiProperty({\n description: 'User email address',\n example: 'user@example.com',\n required: true,\n})\npublic email!: string;\n\n@ApiPropertyOptional({\n description: 'Profile bio',\n maxLength: 500,\n})\npublic bio?: string;\n```\n\n### Controller Response Decorators\n\n```typescript\n@Controller('/users')\n@ApiTags('Users')\nexport class UsersController {\n\n @Post()\n @HttpCode(HttpStatus.CREATED)\n @ApiOperation({ summary: 'Create a new user' })\n @ApiResponse({ status: 201, description: 'User created', type: UserResponse })\n @ApiResponse({ status: 400, description: 'Validation error' })\n public async createUser(@Body() body: CreateUserRequest): Promise<UserResponse> {\n // ...\n }\n\n}\n```\n\n## Naming Conventions\n\n| Type | Naming Pattern | Example |\n|------|---------------|---------|\n| Create input | `Create{Entity}Request` | `CreateUserRequest` |\n| Update input | `Update{Entity}Request` | `UpdateUserRequest` |\n| Query params | `{Entity}Query` or `Pagination{Entity}Query` | `UserQuery` |\n| Response | `{Entity}Response` | `UserResponse` |\n| List response | `{Entity}ListResponse` | `UserListResponse` |\n\n## Constants for Bounds\n\nDefine and reuse constants for upper limits:\n\n```typescript\n// constants/ValidationConstants.ts\nexport const MAX_PAGE_SIZE = 100;\nexport const MAX_SEARCH_LIMIT = 50;\nexport const MAX_NAME_LENGTH = 100;\nexport const MAX_BIO_LENGTH = 500;\n\n// In DTO:\n@Max(MAX_PAGE_SIZE)\npublic perPage?: number;\n```\n\n## Rules\n\n1. **Every field has `@Expose()`** for serialization control.\n2. **Every field has `@ApiProperty()`** for OpenAPI documentation.\n3. **Request DTOs use class-validator decorators** \u2014 validation is automatic via global pipe.\n4. **Response DTOs have no validation decorators** \u2014 they're output-only shapes.\n5. **Cross-field validation uses custom class-level validators** \u2014 never imperative checks in services.\n6. **Query parameters use `@Type(() => Number)`** for type coercion from strings.\n7. **Upper bounds (`@Max`, `@MaxLength`) defined as exported constants** \u2014 never inline magic numbers.\n8. **`whitelist: true` + `forbidNonWhitelisted: true`** strips and rejects unknown properties.\n";
@@ -1,5 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel error handling pattern.
3
- * Returned by the get-error-handling-pattern tool.
4
- */
5
- export declare const ERROR_HANDLING_PATTERN_KNOWLEDGE = "# Archipel Error Handling Pattern\n\n## Overview\n\nArchipel uses **domain-specific error classes** that are caught by **global exception filters**\nand mapped to structured HTTP responses. Services throw domain errors; the framework handles\nthe HTTP translation. This keeps business logic clean and error responses consistent.\n\n## Layer Architecture\n\n```\nService \u2192 throws DomainError \u2192 ExceptionFilter \u2192 HTTP Response Envelope\n```\n\n## Base Error Classes\n\n### RepositoryError\n\nThrown when any Prisma operation fails. Automatically wrapped by `RepositoryBase.tryCatch()`.\n\n```typescript\n// models/errors/RepositoryError.ts\nexport class RepositoryError extends Error {\n\n public readonly code = 'REPOSITORY_ERROR';\n public readonly originalCode?: string;\n public readonly meta?: Record<string, unknown>;\n\n public constructor(message: string, originalCode?: string, meta?: Record<string, unknown>) {\n super(message);\n Object.setPrototypeOf(this, RepositoryError.prototype);\n this.name = 'RepositoryError';\n this.originalCode = originalCode;\n this.meta = meta;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, RepositoryError);\n }\n }\n\n}\n```\n\n### MappingError (abstract)\n\nBase for mapping-related errors.\n\n```typescript\nexport abstract class MappingError extends Error {\n public readonly code: string;\n\n protected constructor(message: string, code: string) {\n super(message);\n this.code = code;\n }\n}\n```\n\nConcrete variants:\n- `MappingNotRegisteredError` \u2014 code: `'MAPPING_NOT_REGISTERED'`\n- `TypeMappingNotRegisteredError` \u2014 code: `'TYPE_MAPPING_NOT_REGISTERED'`\n\n## Exception Filters\n\n### RepositoryExceptionFilter\n\n```typescript\nimport { ArgumentsHost, Catch, ExceptionFilter, HttpStatus } from '@nestjs/common';\nimport { Request, Response } from 'express';\nimport { RepositoryError } from '../models/errors/RepositoryError';\n\n@Catch(RepositoryError)\nexport class RepositoryExceptionFilter implements ExceptionFilter<RepositoryError> {\n\n public catch(_exception: RepositoryError, host: ArgumentsHost): void {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest<Request>();\n\n response.status(HttpStatus.INTERNAL_SERVER_ERROR).json({\n statusCode: HttpStatus.INTERNAL_SERVER_ERROR,\n timestamp: new Date().toISOString(),\n error: 'Repository Error',\n path: request.url,\n });\n }\n\n}\n```\n\n### Registration (in main.ts or AppModule)\n\n```typescript\napp.useGlobalFilters(new RepositoryExceptionFilter());\n```\n\n## How to Create a Domain Error\n\n### Step 1: Define the error class\n\n```typescript\n// models/errors/UserNotFoundError.ts\nexport class UserNotFoundError extends Error {\n\n public readonly code = 'USER_NOT_FOUND';\n public readonly userId: string;\n\n public constructor(userId: string) {\n super(\\`User not found: \\${userId}\\`);\n Object.setPrototypeOf(this, UserNotFoundError.prototype);\n this.name = 'UserNotFoundError';\n this.userId = userId;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, UserNotFoundError);\n }\n }\n\n}\n```\n\n### Step 2: Create an exception filter\n\n```typescript\n// filters/UserNotFoundExceptionFilter.ts\nimport { ArgumentsHost, Catch, ExceptionFilter, HttpStatus } from '@nestjs/common';\nimport { Request, Response } from 'express';\nimport { UserNotFoundError } from '../models/errors/UserNotFoundError';\n\n@Catch(UserNotFoundError)\nexport class UserNotFoundExceptionFilter implements ExceptionFilter<UserNotFoundError> {\n\n public catch(exception: UserNotFoundError, host: ArgumentsHost): void {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest<Request>();\n\n response.status(HttpStatus.NOT_FOUND).json({\n statusCode: HttpStatus.NOT_FOUND,\n timestamp: new Date().toISOString(),\n error: exception.code,\n message: exception.message,\n path: request.url,\n });\n }\n\n}\n```\n\n### Step 3: Register the filter globally\n\n```typescript\napp.useGlobalFilters(\n new RepositoryExceptionFilter(),\n new UserNotFoundExceptionFilter(),\n);\n```\n\n### Step 4: Throw from a service\n\n```typescript\n@Injectable()\nexport class UserService {\n\n public async findById(id: string): Promise<IUserEntity> {\n const user = await this._userRepository.execute(findUserByIdQuery(id));\n\n if (!user) {\n throw new UserNotFoundError(id);\n }\n\n return user;\n }\n\n}\n```\n\n## Response Envelope Convention\n\nAll error responses follow the same shape:\n\n```json\n{\n \"statusCode\": 404,\n \"timestamp\": \"2026-04-05T12:00:00.000Z\",\n \"error\": \"USER_NOT_FOUND\",\n \"message\": \"User not found: abc-123\",\n \"path\": \"/api/v1/users/abc-123\"\n}\n```\n\n## Prisma Error Code Reference\n\nCommon Prisma error codes wrapped by `RepositoryError`:\n\n| Code | Meaning |\n|------|---------|\n| P2000 | Value too long |\n| P2002 | Unique constraint violation |\n| P2003 | Foreign key constraint violation |\n| P2025 | Record not found |\n\n## Rules\n\n1. **Services throw domain errors** \u2014 never raw NestJS HttpException in service layer.\n2. **Exception filters map to HTTP** \u2014 one filter per domain error type.\n3. **Error classes include a machine-readable `code`** \u2014 used for client-side error handling.\n4. **Use `Object.setPrototypeOf`** and `Error.captureStackTrace` in custom Error subclasses.\n5. **Don't leak internal details** \u2014 the filter should not expose Prisma error codes or stack traces.\n6. **Register filters globally** in the bootstrap function or via `APP_FILTER` provider.\n";
@@ -1,5 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel guard & interceptor pattern.
3
- * Returned by the get-guard-pattern tool.
4
- */
5
- export declare const GUARD_PATTERN_KNOWLEDGE = "# Archipel Guard & Interceptor Pattern\n\n## Overview\n\nArchipel uses a **metadata-driven** guard and interceptor pattern. A custom decorator\nattaches metadata (e.g., a feature key or role) to the handler. The guard reads this\nmetadata to decide access. An optional interceptor runs after the handler to record\nusage or perform side effects.\n\nThis creates a reusable trio: **Decorator \u2192 Guard \u2192 Interceptor**.\n\n## Guard Architecture\n\n```\n@RequiresFeature('create-posts') \u2190 Decorator sets metadata\n@UseGuards(JwtAuthGuard, FeatureGuard) \u2190 Guard reads metadata, checks access\n@UseInterceptors(FeatureUsageInterceptor) \u2190 Interceptor records usage after success\n```\n\n## Available Guards\n\n| Guard | Strategy | Purpose |\n|-------|----------|---------|\n| `JwtAuthGuard` | jwt | Validates JWT bearer token |\n| `LocalAuthGuard` | local | Validates username + password |\n| `AnonymousAuthGuard` | anonymous | Allows unauthenticated access with a seed user |\n| `GithubAuthGuard` | github | OAuth via GitHub |\n| `RolesGuard` | metadata | Checks user roles against required roles |\n| `FeatureGuard` | metadata + port | Checks feature access via FeatureAccessPort |\n\n## The Feature Guard Pattern (Full Example)\n\n### Step 1: Metadata Decorator\n\n```typescript\nimport { SetMetadata } from '@nestjs/common';\n\nexport const FEATURE_KEY_METADATA = 'feature_key';\n\nexport const RequiresFeature = (featureKey: string) =>\n SetMetadata(FEATURE_KEY_METADATA, featureKey);\n```\n\n### Step 2: Guard\n\n```typescript\nimport { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';\nimport { Reflector } from '@nestjs/core';\nimport { FeatureAccessPort } from '../contracts/FeatureAccessPort';\n\n@Injectable()\nexport class FeatureGuard implements CanActivate {\n\n // #region Fields\n\n private readonly _featureAccessPort: FeatureAccessPort;\n private readonly _reflector: Reflector;\n\n // #endregion\n\n // #region Ctor\n\n public constructor(featureAccessPort: FeatureAccessPort, reflector: Reflector) {\n this._featureAccessPort = featureAccessPort;\n this._reflector = reflector;\n }\n\n // #endregion\n\n // #region Methods\n\n public async canActivate(context: ExecutionContext): Promise<boolean> {\n const featureKey = this._reflector.get<string>(FEATURE_KEY_METADATA, context.getHandler());\n\n if (!featureKey) {\n return true; // No feature requirement on this endpoint\n }\n\n const request = context.switchToHttp().getRequest();\n const user = request.user;\n\n if (!user || !user.id) {\n return false;\n }\n\n const access = await this._featureAccessPort.checkAccess(user.id, featureKey);\n request.featureAccess = access; // Attach for downstream use\n\n return access.allowed;\n }\n\n // #endregion\n\n}\n```\n\n### Step 3: Interceptor (records usage after success)\n\n```typescript\nimport { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';\nimport { Reflector } from '@nestjs/core';\nimport { Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\n@Injectable()\nexport class FeatureUsageInterceptor implements NestInterceptor {\n\n // #region Fields\n\n private readonly _featureAccessPort: FeatureAccessPort;\n private readonly _reflector: Reflector;\n\n // #endregion\n\n // #region Ctor\n\n public constructor(featureAccessPort: FeatureAccessPort, reflector: Reflector) {\n this._featureAccessPort = featureAccessPort;\n this._reflector = reflector;\n }\n\n // #endregion\n\n // #region Methods\n\n public intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {\n const featureKey = this._reflector.get<string>(FEATURE_KEY_METADATA, context.getHandler());\n\n if (!featureKey) {\n return next.handle();\n }\n\n const request = context.switchToHttp().getRequest();\n const user = request.user;\n\n return next.handle().pipe(\n tap(async () => {\n if (user && user.id) {\n await this._featureAccessPort.recordUsage(user.id, featureKey);\n }\n }),\n );\n }\n\n // #endregion\n\n}\n```\n\n### Step 4: Controller Usage\n\n```typescript\n@Controller('/posts')\nexport class PostsController {\n\n @Post()\n @RequiresFeature('create-posts')\n @UseGuards(JwtAuthGuard, FeatureGuard)\n @UseInterceptors(FeatureUsageInterceptor)\n public async createPost(@Body() body: CreatePostRequest): Promise<PostResponse> {\n const entity = await this._postService.create(body);\n\n return this._mappingService.map(POST_MAPPING_KEY, entity);\n }\n\n}\n```\n\n## Roles Guard Pattern\n\n```typescript\n// Decorator\nexport const Roles = (...roles: string[]) => SetMetadata('roles', roles);\n\n// Guard\n@Injectable()\nexport class RolesGuard implements CanActivate {\n\n public constructor(private readonly _reflector: Reflector) {}\n\n public canActivate(context: ExecutionContext): boolean {\n const requiredRoles = this._reflector.get<string[]>('roles', context.getHandler());\n if (!requiredRoles) return true;\n\n const request = context.switchToHttp().getRequest();\n const user = request.user;\n\n return requiredRoles.some((role) => user.roles?.includes(role));\n }\n\n}\n\n// Usage\n@Get('/admin')\n@Roles('admin', 'superadmin')\n@UseGuards(JwtAuthGuard, RolesGuard)\npublic async getAdminPanel(): Promise<AdminResponse> { ... }\n```\n\n## Telemetry Interceptor\n\n```typescript\n@Injectable()\nexport class OperationTelemetryInterceptor implements NestInterceptor {\n\n private readonly _facade: ITelemetryFacade;\n\n public intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {\n const handler = context.getHandler().name;\n const cls = context.getClass().name;\n // ... start span, capture duration, record outcome\n return next.handle();\n }\n\n}\n```\n\n## How to Create a Custom Guard + Interceptor Pair\n\n### Step 1: Define the metadata key and decorator\n\n```typescript\nexport const RATE_LIMIT_METADATA = 'rate_limit';\nexport const RateLimit = (maxRequests: number) => SetMetadata(RATE_LIMIT_METADATA, maxRequests);\n```\n\n### Step 2: Create the guard\n\nRead metadata via `Reflector`, check the condition, return boolean.\n\n### Step 3: Create the interceptor (optional)\n\nUse `tap()` in the RxJS pipeline to perform post-handler side effects.\n\n### Step 4: Register in the module\n\nExport guard and interceptor from the library module so consumers can apply them.\n\n## Rules\n\n1. **Guards decide access** \u2014 return `true` or `false`, never throw directly.\n2. **Interceptors handle side effects** \u2014 recording, logging, transforming responses.\n3. **Metadata decorators are the glue** \u2014 they attach config to handlers, read by guards/interceptors.\n4. **Auth guards extend Passport's AuthGuard** \u2014 e.g. `AuthGuard('jwt')`.\n5. **Feature guards delegate to ports** \u2014 the guard itself holds no business logic.\n6. **Guard order matters** \u2014 `@UseGuards(AuthGuard, FeatureGuard)`: auth runs first.\n7. **Interceptors use `tap()`** for post-handler logic, `map()` for response transformation.\n";
@@ -1,6 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel mapping pattern.
3
- * Returned by the get-mapping-pattern tool.
4
- */
5
- export declare const MAPPING_PATTERN_KNOWLEDGE = "# Archipel Mapping Pattern\n\n## Overview\n\nIn Archipel, all object-to-object mapping goes through a central **MappingService** with\n**branded, type-safe mapping keys**. This guarantees compile-time type safety: the key\nencodes both the input and output type, so calling `mappingService.map(KEY, input)` is\nstatically checked \u2014 the compiler verifies that `input` matches the key's input type and\ninfers the return type automatically.\n\n**Rule:** Services MUST NOT inline-create response objects. They return entities.\nControllers use the MappingService to convert entities to response DTOs.\n\n## Core Types\n\n### IMappingKey<TInput, TOutput>\n\n```typescript\nexport interface IMappingKey<TInput, TOutput> {\n readonly _brand: 'MappingKey';\n readonly _input: TInput;\n readonly _output: TOutput;\n readonly key: string;\n}\n```\n\nThe `_input` and `_output` fields are phantom types \u2014 they exist only for compile-time\ntype encoding and are never accessed at runtime.\n\n### createMappingKey<TInput, TOutput>\n\n```typescript\nimport { createMappingKey } from '@breadstone/archipel-platform-core';\n\nexport const PRODUCT_MAPPING_KEY = createMappingKey<IProductMappingInput, ProductResponse>('food.product');\n```\n\nThe string argument `'food.product'` is the unique registry key. Convention:\n`<domain>.<entity>` in lowercase dot-notation.\n\n## MappingService API\n\n```typescript\n// Key-based mapping (preferred)\nconst response = mappingService.map(PRODUCT_MAPPING_KEY, input);\n// \u2192 TOutput is inferred from the key, TInput is validated\n\n// Safe variant (returns undefined if not registered)\nconst maybeResponse = mappingService.tryMap(PRODUCT_MAPPING_KEY, input);\n\n// Type-based mapping (alternative)\nconst response = mappingService.mapTypes(sourceInstance, DestinationClass);\nconst responses = mappingService.mapTypesArray(sourceArray, DestinationClass);\n```\n\n## How to Create a Mapping\n\n### Step 1: Define the input interface\n\nThe input interface represents the shape of data coming from the repository query.\nProperty names MUST match the Prisma select shape exactly.\n\n```typescript\n// models/mapping-inputs/IProductMappingInput.ts\nexport interface IProductMappingInput {\n readonly id: string;\n readonly barcode: string;\n readonly name: string;\n readonly categoryId: string;\n readonly createdAt: Date;\n}\n```\n\n### Step 2: Create a branded mapping key\n\nEach key is an **exported constant** \u2014 never inline magic strings.\n\n```typescript\n// constants/MappingKeys.ts\nimport { createMappingKey } from '@breadstone/archipel-platform-core';\nimport { IProductMappingInput } from '../models/mapping-inputs/IProductMappingInput';\nimport { ProductResponse } from '../dtos/ProductResponse';\n\nexport const PRODUCT_MAPPING_KEY = createMappingKey<IProductMappingInput, ProductResponse>('food.product');\n```\n\n### Step 3: Create a mapping profile\n\nA profile extends `MappingProfileBase` and registers one or more mappings via the builder.\n\n```typescript\n// mappers/ProductMappingProfile.ts\nimport { MappingProfileBase, IMappingBuilder } from '@breadstone/archipel-platform-core';\nimport { PRODUCT_MAPPING_KEY } from '../constants/MappingKeys';\nimport { IProductMappingInput } from '../models/mapping-inputs/IProductMappingInput';\nimport { ProductResponse } from '../dtos/ProductResponse';\n\nexport class ProductMappingProfile extends MappingProfileBase {\n\n // #region Methods\n\n public configure(builder: IMappingBuilder): void {\n builder.createKeyedMap(PRODUCT_MAPPING_KEY, (input: IProductMappingInput) => {\n const response = new ProductResponse();\n response.id = input.id;\n response.barcode = input.barcode;\n response.name = input.name;\n response.categoryId = input.categoryId;\n response.createdAt = input.createdAt;\n\n return response;\n });\n }\n\n // #endregion\n\n}\n```\n\n### Step 4: Register the profile in the module\n\n```typescript\nimport { MappingModule } from '@breadstone/archipel-platform-core';\nimport { ProductMappingProfile } from './mappers/ProductMappingProfile';\n\n@Module({\n imports: [\n MappingModule.withProfiles([ProductMappingProfile]),\n ],\n})\nexport class ProductModule {}\n```\n\n### Step 5: Use in controller (NOT in service)\n\n```typescript\n@Controller('/products')\nexport class ProductController {\n\n // #region Fields\n\n private readonly _productService: ProductService;\n private readonly _mappingService: MappingService;\n\n // #endregion\n\n // #region Ctor\n\n public constructor(productService: ProductService, mappingService: MappingService) {\n this._productService = productService;\n this._mappingService = mappingService;\n }\n\n // #endregion\n\n // #region Methods\n\n @Get(':id')\n public async getProduct(@Param('id') id: string): Promise<ProductResponse> {\n const entity = await this._productService.findById(id);\n\n return this._mappingService.map(PRODUCT_MAPPING_KEY, entity);\n }\n\n @Get()\n public async listProducts(): Promise<ProductResponse[]> {\n const entities = await this._productService.findAll();\n\n return entities.map((e) => this._mappingService.map(PRODUCT_MAPPING_KEY, e));\n }\n\n // #endregion\n\n}\n```\n\n## MappingBuilder Methods\n\nThe builder supports two registration flavors:\n\n### createKeyedMap (preferred)\n\n```typescript\nbuilder.createKeyedMap(SOME_MAPPING_KEY, (input: TInput) => {\n const output = new TOutput();\n // ... map fields\n return output;\n});\n```\n\n### createMap (type-based)\n\n```typescript\nbuilder.createMap(SourceClass, DestinationClass, (source: SourceClass) => {\n const dest = new DestinationClass();\n // ... map fields\n return dest;\n});\n```\n\n## Error Handling\n\n- `MappingNotRegisteredError` \u2014 thrown when a keyed mapping is not found\n- `TypeMappingNotRegisteredError` \u2014 thrown when a type-based mapping is not found\n- Both extend `MappingError` with a machine-readable `code` field\n\n## Rules\n\n1. **Mapping keys MUST be exported constants** \u2014 never inline magic strings in services or controllers.\n2. **Services return entities, controllers map to responses** \u2014 services MUST NOT create response objects.\n3. **One mapping key per entity\u2192response pair** \u2014 use descriptive dot notation for the key string.\n4. **Input interfaces match Prisma select shape** \u2014 property names must align exactly.\n5. **Profiles extend MappingProfileBase** and are registered via `MappingModule.withProfiles()`.\n6. **Use `createKeyedMap` over `createMap`** \u2014 branded keys provide better type safety.\n7. **Mapping functions instantiate response classes** \u2014 use `new ResponseClass()` and assign fields.\n";
6
- export declare const MAPPING_PATTERN_WITH_CONTEXT: (entityName: string, fields: string[], responseName: string) => string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Static knowledge content for the Archipel dynamic module pattern.
3
- * Returned by the get-module-pattern tool.
4
- */
5
- export declare const MODULE_PATTERN_KNOWLEDGE = "# Archipel Dynamic Module Pattern\n\n## Overview\n\nArchipel platform libraries use **NestJS dynamic modules** with a `register()` factory\nmethod and **port/adapter dependency inversion**. Each library defines abstract port\nclasses. The consuming application provides concrete implementations at registration time.\n\nThis pattern keeps platform libraries free of product-specific logic while allowing\nfull customization through dependency injection.\n\n## Pattern Structure\n\n### 1. Abstract Port (Contract)\n\n```typescript\n// contracts/FeatureAccessPort.ts\n\nexport abstract class FeatureAccessPort {\n\n public abstract checkAccess(userId: string, featureKey: string): Promise<IFeatureAccessResult>;\n\n public abstract recordUsage(userId: string, featureKey: string): Promise<void>;\n\n}\n```\n\nPorts are **abstract classes** (not interfaces) so they can serve as NestJS injection tokens.\n\n### 2. Options Interface\n\n```typescript\n// interfaces/IPaymentModuleOptions.ts\n\nexport interface IPaymentModuleOptions {\n /**\n * Concrete implementation of the FeatureAccessPort.\n */\n featureAccess?: Type<FeatureAccessPort>;\n\n /**\n * When true the module is registered globally.\n */\n isGlobal?: boolean;\n}\n```\n\n### 3. Dynamic Module with register()\n\n```typescript\n// PaymentModule.ts\nimport { ConfigModule } from '@breadstone/archipel-platform-core';\nimport { type DynamicModule, Module, type Type } from '@nestjs/common';\n\n@Module({})\nexport class PaymentModule {\n\n public static register(options?: IPaymentModuleOptions): DynamicModule {\n const providers = [StripeClient, FeatureGuard, FeatureUsageInterceptor];\n\n if (options?.featureAccess) {\n providers.push({\n provide: FeatureAccessPort,\n useClass: options.featureAccess,\n } as never);\n }\n\n return {\n global: options?.isGlobal ?? false,\n module: PaymentModule,\n imports: [ConfigModule.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES)],\n providers: providers,\n exports: [StripeClient, FeatureGuard, FeatureUsageInterceptor],\n };\n }\n\n}\n```\n\n### 4. Consumer Registration\n\n```typescript\n// In the consuming application:\n@Module({\n imports: [\n PaymentModule.register({\n featureAccess: MyFeatureAccessAdapter,\n isGlobal: true,\n }),\n ],\n})\nexport class AppModule {}\n```\n\n## Variants in the Codebase\n\n### Simple: PaymentModule\n\n- 1 optional port (`featureAccess`)\n- Optional `isGlobal` flag\n- Config via `ConfigModule.register()`\n\n### Complex: AuthModule\n\n- 4 required ports (`authSubject`, `mfaSubject`, `sessionPersistence`, `verificationSubject`)\n- 2 optional ports (`socialAuth`, `tokenEnricher`)\n- Conditional strategy registration (social OAuth only when `socialAuth` provided)\n- Imports: PassportModule, JwtModule, MappingModule, EventModule, IdentifierModule\n- Middleware configuration via `configure(consumer)`\n\n### Provider-based: BlobModule\n\n- Uses `forRoot()` instead of `register()` (global by default)\n- Discriminated union for provider selection: `{ kind: 'Vercel' }` or `{ kind: 'Custom', useClass: ... }`\n- Optional persistence ports (`objectPersistence`, `variantPersistence`)\n\n### Infrastructure: DatabaseModule\n\n- Both `forRoot()` (global) and `register()` (scoped) variants\n- Factory provider for PrismaService with extensions\n- Health indicator bootstrapping\n\n### Async: McpModule\n\n- `register(options)` for synchronous configuration\n- `registerAsync({ useFactory, inject })` for async (e.g., reading config at runtime)\n- `registerAsync({ useClass })` for factory class pattern\n- `registerAsync({ useExisting })` for reusing an existing factory\n\n## ConfigModule Integration\n\nEvery library module imports `ConfigModule.register()` to declare its configuration\ndependencies:\n\n```typescript\nimports: [ConfigModule.register('platform-payments', PLATFORM_PAYMENTS_CONFIG_ENTRIES)]\n```\n\nThis registers typed config keys into the global `ConfigRegistry` for validation\nand discovery.\n\n## MappingModule Integration\n\nModules that need object mapping import `MappingModule.withProfiles()`:\n\n```typescript\nimports: [MappingModule.withProfiles([SessionMappingProfile])]\n```\n\n## Health Indicator Pattern\n\nInfrastructure modules (Database, Blob) register health indicators:\n\n```typescript\nproviders: [\n BlobHealthIndicator,\n {\n provide: 'BLOB_HEALTH_INDICATOR_BOOTSTRAP',\n useFactory: (orchestrator: HealthOrchestrator, indicator: BlobHealthIndicator) => {\n orchestrator.registerIndicator(indicator);\n return true;\n },\n inject: [HealthOrchestrator, BlobHealthIndicator],\n },\n]\n```\n\n## Rules\n\n1. **Ports are abstract classes** \u2014 not interfaces \u2014 so they work as DI tokens.\n2. **`register()` for stateless config**, `registerAsync()` when config depends on runtime values.\n3. **`forRoot()` for global singletons** (database, blob storage), `register()` for scoped modules.\n4. **Always import ConfigModule.register()** to declare environment dependencies.\n5. **Optional ports use conditional provider registration** (`if (options?.port)`).\n6. **Required ports are listed in the options interface** without optional markers.\n7. **Exports should list concrete services, guards, interceptors** \u2014 not internal implementation details.\n";
6
- export declare const MODULE_PATTERN_WITH_CONTEXT: (moduleName: string, ports: string[]) => string;