@breadstone/archipel-mcp 0.0.54 → 0.0.56

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 (216) hide show
  1. package/data/guides/ai-image-generation.md +101 -0
  2. package/data/guides/ai-realtime-voice.md +85 -473
  3. package/data/guides/ai-text-generation.md +98 -635
  4. package/data/guides/health-indicators.md +67 -66
  5. package/data/guides/index.md +2 -1
  6. package/data/guides/intelligence-prompts-warm-up.md +81 -312
  7. package/data/packages/platform-intelligence/api/Class.AnthropicIntelligenceProviderAdapter.md +122 -0
  8. package/data/packages/platform-intelligence/api/Class.GatewayIntelligenceProviderAdapter.md +122 -0
  9. package/data/packages/platform-intelligence/api/Class.GoogleIntelligenceProviderAdapter.md +122 -0
  10. package/data/packages/platform-intelligence/api/Class.GrokIntelligenceProviderAdapter.md +122 -0
  11. package/data/packages/platform-intelligence/api/Class.IntelligenceAgent.md +95 -0
  12. package/data/packages/platform-intelligence/api/Class.IntelligenceAgentFactory.md +11 -23
  13. package/data/packages/platform-intelligence/api/Class.IntelligenceEmbeddingGenerator.md +25 -21
  14. package/data/packages/platform-intelligence/api/Class.IntelligenceHealthIndicator.md +15 -10
  15. package/data/packages/platform-intelligence/api/Class.IntelligenceImageGenerator.md +117 -0
  16. package/data/packages/platform-intelligence/api/Class.IntelligenceLanguageGenerator.md +159 -0
  17. package/data/packages/platform-intelligence/api/Class.IntelligenceModule.md +2 -2
  18. package/data/packages/platform-intelligence/api/Class.IntelligencePromptExecutor.md +6 -6
  19. package/data/packages/platform-intelligence/api/Class.IntelligencePromptPolicyPort.md +1 -1
  20. package/data/packages/platform-intelligence/api/Class.IntelligenceProviderAdapterPort.md +104 -0
  21. package/data/packages/platform-intelligence/api/Class.IntelligenceProviderAssetUploader.md +21 -15
  22. package/data/packages/platform-intelligence/api/Class.IntelligenceProviderDiagnostics.md +55 -0
  23. package/data/packages/platform-intelligence/api/Class.IntelligenceProviderError.md +14 -4
  24. package/data/packages/platform-intelligence/api/Class.IntelligenceProviderRegistry.md +68 -0
  25. package/data/packages/platform-intelligence/api/Class.IntelligenceRealtimeError.md +9 -9
  26. package/data/packages/platform-intelligence/api/Class.IntelligenceRealtimeMeteringPort.md +1 -1
  27. package/data/packages/platform-intelligence/api/Class.IntelligenceRealtimeSessionFactory.md +8 -8
  28. package/data/packages/platform-intelligence/api/Class.IntelligenceRealtimeSessionPort.md +18 -18
  29. package/data/packages/platform-intelligence/api/Class.IntelligenceReranker.md +58 -0
  30. package/data/packages/platform-intelligence/api/Class.IntelligenceSpeechGenerator.md +117 -0
  31. package/data/packages/platform-intelligence/api/Class.IntelligenceToolBase.md +14 -16
  32. package/data/packages/platform-intelligence/api/Class.IntelligenceToolRegistry.md +14 -18
  33. package/data/packages/platform-intelligence/api/Class.IntelligenceTranscriptionGenerator.md +139 -0
  34. package/data/packages/platform-intelligence/api/Class.IntelligenceVideoGenerator.md +117 -0
  35. package/data/packages/platform-intelligence/api/Class.MiMoIntelligenceProviderAdapter.md +122 -0
  36. package/data/packages/platform-intelligence/api/Class.OpenAIIntelligenceProviderAdapter.md +122 -0
  37. package/data/packages/platform-intelligence/api/Function.createAnthropicAdvisor20260301Tool.md +1 -1
  38. package/data/packages/platform-intelligence/api/Function.createAnthropicBash20241022Tool.md +1 -1
  39. package/data/packages/platform-intelligence/api/Function.createAnthropicBash20250124Tool.md +1 -1
  40. package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20250522Tool.md +1 -1
  41. package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20250825Tool.md +1 -1
  42. package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20260120Tool.md +1 -1
  43. package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20241022Tool.md +1 -1
  44. package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20250124Tool.md +1 -1
  45. package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20251124Tool.md +1 -1
  46. package/data/packages/platform-intelligence/api/Function.createAnthropicMemory20250818Tool.md +1 -1
  47. package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20241022Tool.md +1 -1
  48. package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250124Tool.md +1 -1
  49. package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250429Tool.md +1 -1
  50. package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250728Tool.md +1 -1
  51. package/data/packages/platform-intelligence/api/Function.createAnthropicToolSearchBM2520251119Tool.md +1 -1
  52. package/data/packages/platform-intelligence/api/Function.createAnthropicToolSearchRegex20251119Tool.md +1 -1
  53. package/data/packages/platform-intelligence/api/Function.createAnthropicWebFetch20250910Tool.md +1 -1
  54. package/data/packages/platform-intelligence/api/Function.createAnthropicWebFetch20260209Tool.md +1 -1
  55. package/data/packages/platform-intelligence/api/Function.createAnthropicWebSearch20250305Tool.md +1 -1
  56. package/data/packages/platform-intelligence/api/Function.createAnthropicWebSearch20260209Tool.md +1 -1
  57. package/data/packages/platform-intelligence/api/Function.createGoogleCodeExecutionTool.md +1 -1
  58. package/data/packages/platform-intelligence/api/Function.createGoogleEnterpriseWebSearchTool.md +1 -1
  59. package/data/packages/platform-intelligence/api/Function.createGoogleFileSearchTool.md +1 -1
  60. package/data/packages/platform-intelligence/api/Function.createGoogleGoogleMapsTool.md +1 -1
  61. package/data/packages/platform-intelligence/api/Function.createGoogleGoogleSearchTool.md +1 -1
  62. package/data/packages/platform-intelligence/api/Function.createGoogleUrlContextTool.md +1 -1
  63. package/data/packages/platform-intelligence/api/Function.createGoogleVertexRagStoreTool.md +1 -1
  64. package/data/packages/platform-intelligence/api/Function.createGrokCodeExecutionTool.md +1 -1
  65. package/data/packages/platform-intelligence/api/Function.createGrokFileSearchTool.md +1 -1
  66. package/data/packages/platform-intelligence/api/Function.createGrokMcpServerTool.md +1 -1
  67. package/data/packages/platform-intelligence/api/Function.createGrokViewImageTool.md +1 -1
  68. package/data/packages/platform-intelligence/api/Function.createGrokViewXVideoTool.md +1 -1
  69. package/data/packages/platform-intelligence/api/Function.createGrokWebSearchTool.md +1 -1
  70. package/data/packages/platform-intelligence/api/Function.createGrokXSearchTool.md +1 -1
  71. package/data/packages/platform-intelligence/api/Function.createIntelligenceJsonSchema.md +31 -0
  72. package/data/packages/platform-intelligence/api/Function.createIntelligenceTool.md +2 -2
  73. package/data/packages/platform-intelligence/api/Function.createMimoCustomTool.md +5 -5
  74. package/data/packages/platform-intelligence/api/Function.createOpenAIApplyPatchTool.md +1 -1
  75. package/data/packages/platform-intelligence/api/Function.createOpenAICodeInterpreterTool.md +1 -1
  76. package/data/packages/platform-intelligence/api/Function.createOpenAICustomTool.md +1 -1
  77. package/data/packages/platform-intelligence/api/Function.createOpenAIFileSearchTool.md +1 -1
  78. package/data/packages/platform-intelligence/api/Function.createOpenAIImageGenerationTool.md +1 -1
  79. package/data/packages/platform-intelligence/api/Function.createOpenAILocalShellTool.md +1 -1
  80. package/data/packages/platform-intelligence/api/Function.createOpenAIMcpTool.md +1 -1
  81. package/data/packages/platform-intelligence/api/Function.createOpenAIShellTool.md +1 -1
  82. package/data/packages/platform-intelligence/api/Function.createOpenAIToolSearchTool.md +1 -1
  83. package/data/packages/platform-intelligence/api/Function.createOpenAIWebSearchPreviewTool.md +1 -1
  84. package/data/packages/platform-intelligence/api/Function.createOpenAIWebSearchTool.md +1 -1
  85. package/data/packages/platform-intelligence/api/Function.defineIntelligenceTool.md +31 -0
  86. package/data/packages/platform-intelligence/api/Interface.IIntelligenceAgentConfiguration.md +70 -0
  87. package/data/packages/platform-intelligence/api/Interface.IIntelligenceEmbeddingBatchOptions.md +140 -0
  88. package/data/packages/platform-intelligence/api/Interface.IIntelligenceEmbeddingBatchResult.md +70 -0
  89. package/data/packages/platform-intelligence/api/Interface.IIntelligenceEmbeddingOptions.md +130 -0
  90. package/data/packages/platform-intelligence/api/Interface.IIntelligenceEmbeddingResult.md +70 -0
  91. package/data/packages/platform-intelligence/api/Interface.IIntelligenceFileUploadOptions.md +118 -0
  92. package/data/packages/platform-intelligence/api/Interface.IIntelligenceFileUploadResult.md +60 -0
  93. package/data/packages/platform-intelligence/api/Interface.IIntelligenceGeneratedFile.md +40 -0
  94. package/data/packages/platform-intelligence/api/Interface.IIntelligenceGenerationStepStartEvent.md +50 -0
  95. package/data/packages/platform-intelligence/api/Interface.IIntelligenceImageGenerationOptions.md +186 -0
  96. package/data/packages/platform-intelligence/api/Interface.IIntelligenceImageGenerationResult.md +60 -0
  97. package/data/packages/platform-intelligence/api/Interface.IIntelligenceLanguageCompletion.md +141 -0
  98. package/data/packages/platform-intelligence/api/Interface.IIntelligenceLanguageGenerationOptions.md +250 -0
  99. package/data/packages/platform-intelligence/api/Interface.IIntelligenceLanguageStream.md +50 -0
  100. package/data/packages/platform-intelligence/api/Interface.IIntelligenceModelReference.md +34 -0
  101. package/data/packages/platform-intelligence/api/Interface.IIntelligenceModelRequestOptions.md +72 -0
  102. package/data/packages/platform-intelligence/api/Interface.IIntelligenceModelStatus.md +30 -0
  103. package/data/packages/platform-intelligence/api/Interface.IIntelligenceModuleOptions.md +54 -26
  104. package/data/packages/platform-intelligence/api/Interface.IIntelligenceObjectStream.md +56 -0
  105. package/data/packages/platform-intelligence/api/Interface.IIntelligencePrompt.md +50 -0
  106. package/data/packages/platform-intelligence/api/Interface.IIntelligencePromptDefinition.md +14 -14
  107. package/data/packages/platform-intelligence/api/Interface.IIntelligencePromptEffectivePolicy.md +1 -1
  108. package/data/packages/platform-intelligence/api/Interface.IIntelligencePromptExecutionPolicy.md +1 -1
  109. package/data/packages/platform-intelligence/api/Interface.IIntelligencePromptExecutionResult.md +15 -27
  110. package/data/packages/platform-intelligence/api/Interface.IIntelligenceProviderConfiguration.md +10 -10
  111. package/data/packages/platform-intelligence/api/Interface.IIntelligenceProviderLoadRequest.md +54 -0
  112. package/data/packages/platform-intelligence/api/Interface.IIntelligenceProviderProbeResult.md +70 -0
  113. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRealtimeModuleOptions.md +9 -21
  114. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRealtimeSessionOptions.md +23 -11
  115. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRealtimeUsage.md +174 -10
  116. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRequestOptions.md +114 -0
  117. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRerankingOptions.md +156 -0
  118. package/data/packages/platform-intelligence/api/Interface.IIntelligenceRerankingResult.md +50 -0
  119. package/data/packages/platform-intelligence/api/Interface.IIntelligenceSkillUploadOptions.md +110 -0
  120. package/data/packages/platform-intelligence/api/Interface.IIntelligenceSkillUploadResult.md +80 -0
  121. package/data/packages/platform-intelligence/api/Interface.IIntelligenceSpeechGenerationOptions.md +180 -0
  122. package/data/packages/platform-intelligence/api/Interface.IIntelligenceSpeechGenerationResult.md +50 -0
  123. package/data/packages/platform-intelligence/api/Interface.IIntelligenceStreamingTranscriptionOptions.md +155 -0
  124. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTool.md +7 -10
  125. package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolCall.md +40 -0
  126. package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolDefinition.md +91 -0
  127. package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolExecutionEndEvent.md +50 -0
  128. package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolExecutionStartEvent.md +30 -0
  129. package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolRegistry.md +4 -4
  130. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTranscriptionOptions.md +130 -0
  131. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTranscriptionResult.md +84 -0
  132. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTranscriptionStream.md +97 -0
  133. package/data/packages/platform-intelligence/api/Interface.IIntelligenceUsage.md +197 -0
  134. package/data/packages/platform-intelligence/api/Interface.IIntelligenceVideoGenerationOptions.md +245 -0
  135. package/data/packages/platform-intelligence/api/Interface.IIntelligenceVideoGenerationResult.md +50 -0
  136. package/data/packages/platform-intelligence/api/TypeAlias.IIntelligenceModelMessage.md +43 -0
  137. package/data/packages/platform-intelligence/api/TypeAlias.IIntelligencePromptModelRequirement.md +2 -2
  138. package/data/packages/platform-intelligence/api/TypeAlias.IIntelligenceSchema.md +70 -0
  139. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceCapability.md +14 -0
  140. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceDefaultModels.md +14 -0
  141. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceJsonValue.md +22 -0
  142. package/data/packages/platform-intelligence/api/TypeAlias.IntelligencePromptDefinitionConfiguration.md +2 -2
  143. package/data/packages/platform-intelligence/api/TypeAlias.IntelligencePromptGenerationOptions.md +1 -1
  144. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceProviderName.md +1 -1
  145. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceProviderOptions.md +14 -0
  146. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceProviderProbeStatus.md +14 -0
  147. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceProviderToolOptions.md +17 -0
  148. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceRealtimeMeteringEvent.md +1 -1
  149. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceRequestTimeouts.md +14 -0
  150. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceToolChoice.md +21 -0
  151. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceToolOutput.md +22 -0
  152. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceToolSet.md +14 -0
  153. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceTranscriptionStreamPart.md +46 -0
  154. package/data/packages/platform-intelligence/api/Variable.AI_GATEWAY_API_KEY.md +14 -0
  155. package/data/packages/platform-intelligence/api/Variable.AI_GATEWAY_BASE_URL.md +14 -0
  156. package/data/packages/platform-intelligence/api/Variable.AI_GATEWAY_CONFIG_ENTRIES.md +14 -0
  157. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_API_KEY.md +1 -1
  158. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_BASE_URL.md +1 -1
  159. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_MAX_OUTPUT_TOKENS.md +1 -1
  160. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_MODEL.md +1 -1
  161. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_PROVIDER.md +2 -2
  162. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_TEMPERATURE.md +1 -1
  163. package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_TOP_P.md +1 -1
  164. package/data/packages/platform-intelligence/api/Variable.IntelligenceCapabilityNames.md +40 -0
  165. package/data/packages/platform-intelligence/api/Variable.IntelligenceProviderNames.md +2 -0
  166. package/data/packages/platform-intelligence/api/Variable.PLATFORM_INTELLIGENCE_CONFIG_ENTRIES.md +2 -2
  167. package/data/packages/platform-intelligence/api/index.md +83 -32
  168. package/data/packages/platform-intelligence/index.md +81 -622
  169. package/package.json +1 -1
  170. package/data/packages/index.md +0 -8
  171. package/data/packages/platform-analytics/index.md +0 -209
  172. package/data/packages/platform-authentication/index.md +0 -725
  173. package/data/packages/platform-blob-storage/index.md +0 -416
  174. package/data/packages/platform-bootstrap/index.md +0 -162
  175. package/data/packages/platform-caching/index.md +0 -167
  176. package/data/packages/platform-configuration/index.md +0 -226
  177. package/data/packages/platform-core/index.md +0 -504
  178. package/data/packages/platform-cryptography/index.md +0 -142
  179. package/data/packages/platform-database/index.md +0 -337
  180. package/data/packages/platform-documents/index.md +0 -255
  181. package/data/packages/platform-esigning/index.md +0 -710
  182. package/data/packages/platform-feature-flags/index.md +0 -103
  183. package/data/packages/platform-health/index.md +0 -141
  184. package/data/packages/platform-intelligence/api/Class.IntelligenceMediaGenerator.md +0 -118
  185. package/data/packages/platform-intelligence/api/Class.IntelligenceStructuredGenerator.md +0 -70
  186. package/data/packages/platform-intelligence/api/Class.IntelligenceTelemetryRegistry.md +0 -44
  187. package/data/packages/platform-intelligence/api/Class.IntelligenceTextGenerator.md +0 -138
  188. package/data/packages/platform-intelligence/api/Function.createProviderOptions.md +0 -39
  189. package/data/packages/platform-intelligence/api/Function.loadAnthropicLanguageModel.md +0 -26
  190. package/data/packages/platform-intelligence/api/Function.loadGoogleLanguageModel.md +0 -26
  191. package/data/packages/platform-intelligence/api/Function.loadGoogleRealtimeModel.md +0 -25
  192. package/data/packages/platform-intelligence/api/Function.loadGrokLanguageModel.md +0 -26
  193. package/data/packages/platform-intelligence/api/Function.loadGrokRealtimeModel.md +0 -25
  194. package/data/packages/platform-intelligence/api/Function.loadMimoLanguageModel.md +0 -26
  195. package/data/packages/platform-intelligence/api/Function.loadOpenAILanguageModel.md +0 -26
  196. package/data/packages/platform-intelligence/api/Function.loadOpenAIRealtimeModel.md +0 -25
  197. package/data/packages/platform-intelligence/api/Interface.IIntelligenceCompletionUsage.md +0 -46
  198. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextCompletion.md +0 -180
  199. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextGenerationOptions.md +0 -144
  200. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextGenerator.md +0 -78
  201. package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextStreamingOptions.md +0 -170
  202. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceLanguageModelLoader.md +0 -24
  203. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceLanguageModelLoaders.md +0 -14
  204. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceRealtimeModelLoader.md +0 -25
  205. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceRealtimeModelLoaders.md +0 -14
  206. package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceTextStream.md +0 -14
  207. package/data/packages/platform-logging/index.md +0 -150
  208. package/data/packages/platform-mailing/index.md +0 -470
  209. package/data/packages/platform-mapping/index.md +0 -123
  210. package/data/packages/platform-mcp/index.md +0 -335
  211. package/data/packages/platform-openapi/index.md +0 -207
  212. package/data/packages/platform-payments/index.md +0 -610
  213. package/data/packages/platform-queue/index.md +0 -192
  214. package/data/packages/platform-reporting/index.md +0 -233
  215. package/data/packages/platform-resources/index.md +0 -137
  216. package/data/packages/platform-telemetry/index.md +0 -262
@@ -1,504 +0,0 @@
1
- ---
2
- title: platform-core
3
- description: Foundation library providing mapping, templates, event pub/sub, and shared utilities.
4
- order: 1
5
- tags: [core, mapping, templates, event-hub]
6
- package: '@breadstone/archipel-platform-core'
7
- ---
8
-
9
- # platform-core
10
-
11
- The foundation library that every other Archipel package depends on. Provides object mapping, template engines, event pub/sub, and shared utilities.
12
-
13
- > **Note:** Configuration has moved to [`platform-configuration`](../platform-configuration/), caching to [`platform-caching`](../platform-caching/), cryptography/OTP to [`platform-cryptography`](../platform-cryptography/), mapping to [`platform-mapping`](../platform-mapping/), resource management to [`platform-resources`](../platform-resources/), and health checks to [`platform-health`](../platform-health/). Re-exports are still available from `platform-core` for backward compatibility.
14
-
15
- **Package:** `@breadstone/archipel-platform-core`
16
-
17
- <InstallTabs />
18
-
19
- ## Installation
20
-
21
- ```typescript
22
- import {
23
- ConfigModule,
24
- ConfigRegistry,
25
- MappingModule,
26
- MappingService,
27
- BcryptService,
28
- CryptoService,
29
- OtpService,
30
- MemoryLayeredCache,
31
- RedisLayeredCache,
32
- ContentTemplateEngine,
33
- EventHub,
34
- } from '@breadstone/archipel-platform-core';
35
- ```
36
-
37
- ---
38
-
39
- ## Configuration System
40
-
41
- > **Extracted:** Configuration has been extracted into [`platform-configuration`](../platform-configuration/). The imports below still work via re-exports for backward compatibility. New code should import from `@breadstone/archipel-platform-configuration` directly.
42
- >
43
- > See the [Configuration Management guide](../../guides/configuration) for full documentation.
44
-
45
- ### Defining Config Keys
46
-
47
- ```typescript
48
- import { createConfigKey, type IConfigRegistryEntry } from '@breadstone/archipel-platform-core';
49
-
50
- // Type-safe config keys with phantom types
51
- const SMTP_HOST = createConfigKey<string>('SMTP_HOST');
52
- const SMTP_PORT = createConfigKey<number>('SMTP_PORT');
53
- const SMTP_SECURE = createConfigKey<boolean>('SMTP_SECURE');
54
-
55
- export const MY_MODULE_CONFIG_ENTRIES: ReadonlyArray<IConfigRegistryEntry> = [
56
- { key: SMTP_HOST, module: 'my-module', required: true, description: 'SMTP server hostname' },
57
- { key: SMTP_PORT, module: 'my-module', required: false, defaultValue: 587, description: 'SMTP port' },
58
- { key: SMTP_SECURE, module: 'my-module', required: false, defaultValue: true },
59
- ];
60
- ```
61
-
62
- ### Registering in a Module
63
-
64
- ```typescript
65
- import { Module } from '@nestjs/common';
66
- import { ConfigModule } from '@breadstone/archipel-platform-core';
67
- import { MY_MODULE_CONFIG_ENTRIES } from './env';
68
-
69
- @Module({
70
- imports: [ConfigModule.register('my-module', MY_MODULE_CONFIG_ENTRIES)],
71
- })
72
- export class MyModule {}
73
- ```
74
-
75
- ### Using the ConfigService
76
-
77
- ```typescript
78
- import { Injectable } from '@nestjs/common';
79
- import { ConfigService } from '@breadstone/archipel-platform-core';
80
-
81
- @Injectable()
82
- export class SmtpClient {
83
- private readonly _host: string;
84
- private readonly _port: number;
85
-
86
- constructor(configService: ConfigService) {
87
- this._host = configService.get<string>('SMTP_HOST');
88
- this._port = configService.tryGet<number>('SMTP_PORT', 587);
89
- }
90
- }
91
- ```
92
-
93
- ### ConfigRegistry (Static Access)
94
-
95
- ```typescript
96
- import { ConfigRegistry } from '@breadstone/archipel-platform-core';
97
-
98
- // List all registered modules
99
- const modules = ConfigRegistry.getModules(); // ['my-module', 'platform-auth', ...]
100
-
101
- // Get all required entries
102
- const required = ConfigRegistry.getRequired();
103
-
104
- // Get entries grouped by module
105
- const grouped = ConfigRegistry.getByModule();
106
- ```
107
-
108
- ---
109
-
110
- ## Caching
111
-
112
- Layered caching with pluggable backends, metrics, and stale-while-revalidate support.
113
-
114
- ### ILayeredCache Interface
115
-
116
- ```typescript
117
- interface ILayeredCache<TKey, TValue> {
118
- get(key: TKey): TValue | undefined;
119
- getAsync(key: TKey): Promise<TValue | undefined>;
120
- set(key: TKey, value: TValue): void;
121
- setAsync(key: TKey, value: TValue): Promise<void>;
122
- invalidate(key: TKey): void;
123
- invalidateAsync(key: TKey): Promise<void>;
124
- warm?(key: TKey): Promise<TValue | undefined>;
125
- stats?(): ICacheStats;
126
- }
127
- ```
128
-
129
- ### MemoryLayeredCache
130
-
131
- In-memory LRU cache with TTL and stale-while-revalidate.
132
-
133
- ```typescript
134
- import { MemoryLayeredCache } from '@breadstone/archipel-platform-core';
135
-
136
- const productCache = new MemoryLayeredCache<string, IProduct>(
137
- async (key) => {
138
- // Load function — called on cache miss
139
- return await this._productRepository.findById(key);
140
- },
141
- {
142
- ttlMs: 60_000, // 60 seconds TTL
143
- staleWhileRevalidate: true, // Serve stale data while refreshing
144
- maxEntries: 1000, // LRU eviction after 1000 entries
145
- cacheName: 'products', // For metrics labeling
146
- metricsRecorder: telemetryRecorder,
147
- },
148
- );
149
-
150
- // Usage
151
- const product = await productCache.getAsync('prod-123');
152
-
153
- // Invalidate after mutation
154
- productCache.invalidate('prod-123');
155
-
156
- // Check stats
157
- const stats = productCache.stats();
158
- // → { hits: 142, misses: 23, loads: 23, loadErrors: 0, evictions: 0 }
159
- ```
160
-
161
- ### RedisLayeredCache
162
-
163
- Redis-backed distributed cache for multi-instance deployments.
164
-
165
- ```typescript
166
- import { RedisLayeredCache } from '@breadstone/archipel-platform-core';
167
-
168
- const sessionCache = new RedisLayeredCache<string, ISessionData>(
169
- async (key) => await this._sessionStore.findByToken(key),
170
- {
171
- url: 'redis://localhost:6379',
172
- keyPrefix: 'session:',
173
- ttlSeconds: 3600,
174
- serialize: (value) => JSON.stringify(value),
175
- deserialize: (raw) => JSON.parse(raw),
176
- cacheName: 'sessions',
177
- },
178
- );
179
- ```
180
-
181
- ### ICacheMetricsRecorder
182
-
183
- Integrate cache metrics with your observability stack.
184
-
185
- ```typescript
186
- import type { ICacheMetricsRecorder } from '@breadstone/archipel-platform-core';
187
-
188
- class MyMetricsRecorder implements ICacheMetricsRecorder {
189
- public recordHit(cache: string): void {
190
- /* prometheus counter */
191
- }
192
- public recordMiss(cache: string): void {
193
- /* prometheus counter */
194
- }
195
- public recordLoadSuccess(cache: string): void {
196
- /* ... */
197
- }
198
- public recordLoadError(cache: string): void {
199
- /* ... */
200
- }
201
- public recordEviction(cache: string): void {
202
- /* ... */
203
- }
204
- }
205
- ```
206
-
207
- ---
208
-
209
- ## Mapping Service
210
-
211
- > **Extracted:** Mapping functionality now lives in [`platform-mapping`](/packages/platform-mapping/). The imports below still work via backward-compatible re-exports from `platform-core`, but new code should import from `@breadstone/archipel-platform-mapping` directly.
212
-
213
- Centralized object mapping with type-safe keys and profiles.
214
-
215
- ### Defining Mapping Keys
216
-
217
- ```typescript
218
- import { createMappingKey } from '@breadstone/archipel-platform-core';
219
- import type { IUserEntity } from './entities';
220
- import type { UserResponse } from './responses';
221
-
222
- export const USER_TO_RESPONSE = createMappingKey<IUserEntity, UserResponse>('UserEntity→UserResponse');
223
- export const USER_TO_SUMMARY = createMappingKey<IUserEntity, UserSummary>('UserEntity→UserSummary');
224
- ```
225
-
226
- ### Creating a Mapping Profile
227
-
228
- ```typescript
229
- import { Injectable } from '@nestjs/common';
230
- import { MappingProfileBase, type IMappingBuilder } from '@breadstone/archipel-platform-core';
231
- import { USER_TO_RESPONSE, USER_TO_SUMMARY } from './mapping-keys';
232
-
233
- @Injectable()
234
- export class UserMappingProfile extends MappingProfileBase {
235
- public override configure(builder: IMappingBuilder): void {
236
- builder.createKeyedMap(USER_TO_RESPONSE, (source) => ({
237
- id: source.id,
238
- name: source.userName,
239
- email: source.email,
240
- verified: source.isVerified,
241
- roles: [...source.roles],
242
- }));
243
-
244
- builder.createKeyedMap(USER_TO_SUMMARY, (source) => ({
245
- id: source.id,
246
- displayName: source.userName ?? source.email ?? 'Anonymous',
247
- }));
248
- }
249
- }
250
- ```
251
-
252
- ### Registering Profiles in a Module
253
-
254
- ```typescript
255
- import { Module } from '@nestjs/common';
256
- import { MappingModule } from '@breadstone/archipel-platform-core';
257
- import { UserMappingProfile } from './mappers/UserMappingProfile';
258
- import { OrderMappingProfile } from './mappers/OrderMappingProfile';
259
-
260
- @Module({
261
- imports: [MappingModule.withProfiles([UserMappingProfile, OrderMappingProfile])],
262
- })
263
- export class AppModule {}
264
- ```
265
-
266
- ### Using in a Controller
267
-
268
- ```typescript
269
- import { Controller, Get, Param } from '@nestjs/common';
270
- import { MappingService } from '@breadstone/archipel-platform-core';
271
- import { USER_TO_RESPONSE } from './mapping-keys';
272
-
273
- @Controller('users')
274
- export class UserController {
275
- constructor(
276
- private readonly _userService: UserService,
277
- private readonly _mappingService: MappingService,
278
- ) {}
279
-
280
- @Get(':id')
281
- public async getUser(@Param('id') id: string): Promise<UserResponse> {
282
- const entity = await this._userService.findById(id);
283
- return this._mappingService.map(USER_TO_RESPONSE, entity);
284
- }
285
- }
286
- ```
287
-
288
- ---
289
-
290
- ## Cryptography & OTP
291
-
292
- ### BcryptService
293
-
294
- Password hashing with bcrypt.
295
-
296
- ```typescript
297
- import { BcryptService } from '@breadstone/archipel-platform-core';
298
-
299
- @Injectable()
300
- export class AccountService {
301
- constructor(private readonly _bcrypt: BcryptService) {}
302
-
303
- public async register(password: string): Promise<void> {
304
- const hash = await this._bcrypt.hash(password);
305
- // Store hash in database
306
- }
307
-
308
- public async verifyPassword(input: string, storedHash: string): Promise<boolean> {
309
- return this._bcrypt.compare(input, storedHash);
310
- }
311
- }
312
- ```
313
-
314
- ### CryptoService
315
-
316
- UUID-based identifier generation.
317
-
318
- ```typescript
319
- import { CryptoService } from '@breadstone/archipel-platform-core';
320
-
321
- const crypto = new CryptoService();
322
- const token = crypto.getRandomGuid('verify');
323
- // → "verify-a1b2c3d4-e5f6-7890-abcd-ef1234567890"
324
- ```
325
-
326
- ### OtpService
327
-
328
- TOTP one-time password generation and verification (otplib).
329
-
330
- ```typescript
331
- import { OtpService } from '@breadstone/archipel-platform-core';
332
- import type { IOtpService } from '@breadstone/archipel-platform-core';
333
-
334
- @Injectable()
335
- export class MfaSetupService {
336
- constructor(@Inject(OTP_SERVICE_TOKEN) private readonly _otp: IOtpService) {}
337
-
338
- public setup(userEmail: string): { secret: string; uri: string } {
339
- const secret = this._otp.generateSecret();
340
- const uri = this._otp.generateUri({
341
- issuer: 'MyApp',
342
- label: userEmail,
343
- secret,
344
- });
345
- return { secret, uri };
346
- }
347
-
348
- public verify(token: string, secret: string): boolean {
349
- return this._otp.verify(token, secret);
350
- // Window = 1 → accepts current + previous 30s interval
351
- }
352
- }
353
- ```
354
-
355
- ---
356
-
357
- ## Event System
358
-
359
- Type-safe publish/subscribe with RxJS.
360
-
361
- ### Defining Events
362
-
363
- ```typescript
364
- import { createEventKey, type IEventMap } from '@breadstone/archipel-platform-core';
365
-
366
- interface IOrderEvents extends IEventMap {
367
- 'order.created': { orderId: string; userId: string };
368
- 'order.shipped': { orderId: string; trackingNumber: string };
369
- 'order.cancelled': { orderId: string; reason: string };
370
- }
371
-
372
- export const ORDER_CREATED = createEventKey<IOrderEvents, 'order.created'>('order.created');
373
- export const ORDER_SHIPPED = createEventKey<IOrderEvents, 'order.shipped'>('order.shipped');
374
- ```
375
-
376
- ### Publishing & Subscribing
377
-
378
- ```typescript
379
- import { EventHub } from '@breadstone/archipel-platform-core';
380
- import { ORDER_CREATED, ORDER_SHIPPED } from './events';
381
-
382
- @Injectable()
383
- export class OrderService {
384
- constructor(private readonly _events: EventHub) {}
385
-
386
- public async createOrder(userId: string): Promise<void> {
387
- const orderId = '...';
388
- // ... create order logic
389
-
390
- this._events.publish(ORDER_CREATED, { orderId, userId });
391
- }
392
- }
393
-
394
- @Injectable()
395
- export class NotificationService {
396
- constructor(events: EventHub) {
397
- events.subscribe(ORDER_CREATED, (payload) => {
398
- // payload is typed as { orderId: string; userId: string }
399
- this.sendOrderConfirmation(payload.userId, payload.orderId);
400
- });
401
- }
402
- }
403
- ```
404
-
405
- ---
406
-
407
- ## Content Template Engine
408
-
409
- Handlebars-style template compilation with block helpers.
410
-
411
- ```typescript
412
- import { ContentTemplateEngine } from '@breadstone/archipel-platform-core';
413
-
414
- const engine = new ContentTemplateEngine();
415
-
416
- // Simple variable substitution
417
- const result = engine.compileTemplate('Hello {{name}}, welcome to {{app}}!', { name: 'Alice', app: 'MyApp' });
418
- // → "Hello Alice, welcome to MyApp!"
419
-
420
- // Block helpers
421
- const list = engine.compileTemplate('{{#each items}}- {{this.name}}: {{this.price}}€\n{{/each}}', {
422
- items: [
423
- { name: 'Widget', price: 9.99 },
424
- { name: 'Gadget', price: 19.99 },
425
- ],
426
- });
427
-
428
- // Conditionals
429
- const conditional = engine.compileTemplate('{{#if isPremium}}Premium Member{{/if}}{{#if !isPremium}}Free Tier{{/if}}', {
430
- isPremium: true,
431
- });
432
- ```
433
-
434
- ---
435
-
436
- ## Identifier Generation
437
-
438
- Pluggable ID generation via `IdentifierModule`.
439
-
440
- ```typescript
441
- import { IdentifierModule, ID_GENERATOR_TOKEN, type IIdGenerator } from '@breadstone/archipel-platform-core';
442
-
443
- // Module setup — choose strategy
444
- @Module({
445
- imports: [IdentifierModule.register('CUID')],
446
- })
447
- export class AppModule {}
448
-
449
- // Usage in a service
450
- @Injectable()
451
- export class OrderService {
452
- constructor(@Inject(ID_GENERATOR_TOKEN) private readonly _idGen: IIdGenerator) {}
453
-
454
- public createOrder(): string {
455
- return this._idGen.generate(); // CUID, UUID, or GUID depending on registration
456
- }
457
- }
458
- ```
459
-
460
- ---
461
-
462
- ## Utility Services
463
-
464
- | Service | Purpose |
465
- | ---------------------------- | ------------------------------------------------------------------------ |
466
- | `DeviceParserService` | Parse `User-Agent` headers into `IDeviceInfo` (browser, OS, device type) |
467
- | `HostService` | Host configuration (title, logo, features, health endpoints) |
468
- | `UserAvatarGeneratorService` | Generate deterministic avatars from user identifiers |
469
- | `UsernameGeneratorService` | Generate random usernames from word lists |
470
- | `SseHub` | Server-Sent Events hub — bounded to 10,000 event subjects |
471
- | `maskSensitiveFields()` | Recursively masks sensitive keys (password, token, apikey, etc.) in objects for safe logging |
472
- | `maskSensitive()` | Serializes a value to JSON with sensitive keys masked |
473
-
474
- ---
475
-
476
- ## HTTP Logger Middleware
477
-
478
- The `HttpLoggerMiddleware` logs incoming requests with automatic masking of sensitive data in query parameters, route params, and request bodies. Sensitive fields (passwords, tokens, API keys, emails, etc.) are replaced with `'***'` before logging.
479
-
480
- ---
481
-
482
- ## Module Summary
483
-
484
- | Export | Type | Description |
485
- | ----------------------- | ------------- | ----------------------------------------------------------------------------------- |
486
- | `ConfigModule` | NestJS Module | Configuration registration and validation (re-export from `platform-configuration`) |
487
- | `MappingModule` | NestJS Module | Mapping profile registration (re-export from `platform-mapping`) |
488
- | `EventModule` | NestJS Module | Event pub/sub system |
489
- | `IdentifierModule` | NestJS Module | ID generation strategy |
490
- | `HostModule` | NestJS Module | Host services and templates |
491
- | `HealthModule` | NestJS Module | Health check orchestration (re-export from `platform-health`) |
492
- | `ResourceModule` | NestJS Module | Resource loading strategies (re-export from `platform-resources`) |
493
- | `MappingService` | Service | Central object mapping (re-export from `platform-mapping`) |
494
- | `ConfigService` | Service | Type-safe config access (re-export from `platform-configuration`) |
495
- | `BcryptService` | Service | Password hashing |
496
- | `CryptoService` | Service | UUID generation |
497
- | `OtpService` | Service | TOTP generation/verification |
498
- | `EventHub` | Service | Event publish/subscribe |
499
- | `ContentTemplateEngine` | Service | Template compilation |
500
- | `MemoryLayeredCache` | Class | In-memory LRU cache |
501
- | `RedisLayeredCache` | Class | Redis-backed cache |
502
- | `maskSensitiveFields()` | Utility | Recursively masks sensitive keys in objects for safe logging |
503
- | `maskSensitive()` | Utility | JSON-serializes values with sensitive keys masked |
504
- | `HttpLoggerMiddleware` | Middleware | Request logging with automatic sensitive data masking |
@@ -1,142 +0,0 @@
1
- ---
2
- title: platform-cryptography
3
- description: Bcrypt password hashing, prefixed UUID generation, and TOTP multi-factor authentication.
4
- order: 17
5
- tags: [cryptography, bcrypt, uuid, totp, otp, mfa, hashing]
6
- package: '@breadstone/archipel-platform-cryptography'
7
- ---
8
-
9
- # platform-cryptography
10
-
11
- Cryptographic building blocks for NestJS applications: bcrypt password hashing, prefixed UUID generation, and TOTP-based multi-factor authentication. All services are `@Injectable()` and ready for constructor injection.
12
-
13
- **Package:** `@breadstone/archipel-platform-cryptography`
14
-
15
- <InstallTabs />
16
-
17
- ## Quick Start
18
-
19
- ```typescript
20
- import { BcryptService, CryptoService } from '@breadstone/archipel-platform-cryptography';
21
-
22
- // OTP is a tree-shakable sub-export
23
- import { OtpService, OTP_SERVICE_TOKEN } from '@breadstone/archipel-platform-cryptography/otp';
24
- ```
25
-
26
- ---
27
-
28
- ## Password Hashing (BcryptService)
29
-
30
- Secure password hashing with auto-generated salts.
31
-
32
- ```typescript
33
- import { Injectable } from '@nestjs/common';
34
- import { BcryptService } from '@breadstone/archipel-platform-cryptography';
35
-
36
- @Injectable()
37
- export class AccountService {
38
- constructor(private readonly _bcrypt: BcryptService) {}
39
-
40
- async createAccount(password: string): Promise<void> {
41
- const hashed = await this._bcrypt.hash(password);
42
- // store hashed password
43
- }
44
-
45
- async verifyPassword(password: string, hash: string): Promise<boolean> {
46
- return this._bcrypt.compare(password, hash);
47
- }
48
- }
49
- ```
50
-
51
- | Method | Description |
52
- | -------------------------- | --------------------------------------------- |
53
- | `hash(data)` | Hashes a string with a generated bcrypt salt. |
54
- | `compare(data, encrypted)` | Compares plain text against a bcrypt hash. |
55
-
56
- ---
57
-
58
- ## Prefixed UUIDs (CryptoService)
59
-
60
- Generates random UUIDs prefixed with a domain identifier for readable, collision-free identifiers.
61
-
62
- ```typescript
63
- import { CryptoService } from '@breadstone/archipel-platform-cryptography';
64
-
65
- const crypto = new CryptoService();
66
-
67
- crypto.getRandomGuid('usr'); // → 'usr-a1b2c3d4-...'
68
- crypto.getRandomGuid('ord'); // → 'ord-e5f6a7b8-...'
69
- crypto.getRandomGuid('inv'); // → 'inv-c9d0e1f2-...'
70
- ```
71
-
72
- | Method | Description |
73
- | ----------------------- | ----------------------------------------------------- |
74
- | `getRandomGuid(prefix)` | Returns `{prefix}-{uuid}`. Throws if prefix is empty. |
75
-
76
- ---
77
-
78
- ## TOTP Multi-Factor Authentication (OtpService)
79
-
80
- TOTP enrollment and verification backed by otplib v13, injected via the `OTP_SERVICE_TOKEN` symbol.
81
-
82
- ### Injection Setup
83
-
84
- ```typescript
85
- import { Module } from '@nestjs/common';
86
- import { OtpService, OTP_SERVICE_TOKEN } from '@breadstone/archipel-platform-cryptography/otp';
87
-
88
- @Module({
89
- providers: [{ provide: OTP_SERVICE_TOKEN, useClass: OtpService }],
90
- exports: [OTP_SERVICE_TOKEN],
91
- })
92
- export class SecurityModule {}
93
- ```
94
-
95
- ### Usage
96
-
97
- ```typescript
98
- import { Inject, Injectable } from '@nestjs/common';
99
- import { OTP_SERVICE_TOKEN, IOtpService } from '@breadstone/archipel-platform-cryptography/otp';
100
-
101
- @Injectable()
102
- export class MfaService {
103
- constructor(@Inject(OTP_SERVICE_TOKEN) private readonly _otp: IOtpService) {}
104
-
105
- enroll(issuer: string, label: string) {
106
- const secret = this._otp.generateSecret();
107
- const uri = this._otp.generateUri({ issuer, label, secret });
108
- return { secret, uri }; // uri → QR code
109
- }
110
-
111
- verify(token: string, secret: string): boolean {
112
- return this._otp.verify(token, secret);
113
- }
114
- }
115
- ```
116
-
117
- ### Tolerance
118
-
119
- The default `TOTP_EPOCH_TOLERANCE` is 30 seconds (±1 time step):
120
-
121
- | `epochTolerance` | Accepted range |
122
- | ---------------- | ----------------- |
123
- | 0 | Current step only |
124
- | 30 | ±1 step (±30 s) |
125
- | 60 | ±2 steps (±60 s) |
126
- | 90 | ±3 steps (±90 s) |
127
-
128
- ---
129
-
130
- ## Error Handling
131
-
132
- `CryptoService` throws `CryptoValidationError` when provided with invalid input (e.g. empty UUID prefix). The error carries a `code` property set to `'CRYPTO_VALIDATION'`.
133
-
134
- ```typescript
135
- import { CryptoValidationError } from '@breadstone/archipel-platform-cryptography';
136
- ```
137
-
138
- ---
139
-
140
- ## API Reference
141
-
142
- See the full [API documentation](./api/) for all exported types and classes.