Skip to content

Commit d9ca638

Browse files
authored
Docs updates (#55)
* version bumps * wip * tmp * wip * wip * wip * more files * more * wip * registries * more * wip selectors * synapse * registration flow * connection handling * state propagation * testing 1 * moving stuff * cleanup * Update documentation links for Scheduler, Configuration Sourcing, and Lifecycle events * Remove Testing section from navigation and update documentation links for Core Framework * testing * include contributions * docs: Update links in fixtures and hass documentation for consistency
1 parent 4474d27 commit d9ca638

218 files changed

Lines changed: 6314 additions & 3178 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

blog/01-building-a-basic-automation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function WeatherReport({ scheduler, logger, hass }: TServiceParams) {
170170
}
171171
```
172172

173-
> See [Scheduler](/docs/core/tools/scheduler) for more specific documentation.
173+
> See [Scheduler](/docs/core/services/builtin/core_scheduler) for more specific documentation.
174174
175175
## 🎬 Bringing it all together
176176

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: AsyncLocalStorage (ALS)
3+
---
4+
5+
AsyncLocalStorage (ALS) is a Node.js feature that allows you to store data that is accessible throughout an entire async operation chain, without explicitly passing it through every function call. The Digital Alchemy framework provides special support for ALS to enable request-level context tracking and correlation.
6+
7+
Think of it as a "thread-local storage" for async operations - data stored in ALS is automatically available to all code that runs within the same async context, regardless of how deep the call stack goes.
8+
9+
## How ALS Works in the Framework
10+
11+
### 1. ALS Service
12+
13+
The framework provides an ALS service that manages the storage context:
14+
15+
```typescript
16+
type AlsExtension = {
17+
asyncStorage: () => AsyncLocalStorage<AsyncLocalData>;
18+
getStore: () => AsyncLocalData;
19+
run(data: AsyncLocalData, callback: () => TBlackHole): void;
20+
enterWith(data: AsyncLocalData): void;
21+
getLogData: () => AsyncLogData;
22+
};
23+
```
24+
25+
### 2. Logger Integration
26+
27+
When ALS is enabled in logger configuration, the framework automatically:
28+
29+
- Extracts ALS data from the current context
30+
- Merges it into log messages
31+
- Provides timing information if available
32+
33+
```typescript
34+
MY_APP.bootstrap({
35+
loggerOptions: {
36+
als: true // Enable ALS integration
37+
}
38+
});
39+
```
40+
41+
##
42+
43+
## ALS Data Structure
44+
45+
The framework expects ALS data to follow this structure:
46+
47+
```typescript
48+
interface AsyncLocalData {
49+
logs: AsyncLogData;
50+
http?: RequestLocals;
51+
}
52+
53+
interface AsyncLogData {
54+
reqId?: string;
55+
correlationId?: string;
56+
startTime?: number;
57+
[key: string]: unknown;
58+
}
59+
```
File renamed without changes.

docs/core/advanced/bootstrap.md

Whitespace-only changes.

docs/core/advanced/breaking-out.md

Whitespace-only changes.

docs/core/advanced/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Advanced
3+
id: core_advanced
4+
sidebar_position: 5
5+
description: ""
6+
---

docs/core/advanced/lifecycle.md

Whitespace-only changes.

docs/core/advanced/loaded-modules.md

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- Bootstrap overrides -->

0 commit comments

Comments
 (0)