@venizia/ignis-docs 0.0.5 → 0.0.6-0
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.
- package/package.json +1 -1
- package/wiki/best-practices/architecture-decisions.md +0 -8
- package/wiki/best-practices/code-style-standards/control-flow.md +1 -1
- package/wiki/best-practices/performance-optimization.md +3 -3
- package/wiki/best-practices/security-guidelines.md +2 -2
- package/wiki/best-practices/troubleshooting-tips.md +1 -1
- package/wiki/guides/core-concepts/components-guide.md +1 -1
- package/wiki/guides/core-concepts/components.md +2 -2
- package/wiki/guides/core-concepts/dependency-injection.md +1 -1
- package/wiki/guides/core-concepts/services.md +1 -1
- package/wiki/guides/tutorials/building-a-crud-api.md +1 -1
- package/wiki/guides/tutorials/ecommerce-api.md +2 -2
- package/wiki/guides/tutorials/realtime-chat.md +6 -6
- package/wiki/guides/tutorials/testing.md +1 -1
- package/wiki/references/base/bootstrapping.md +0 -2
- package/wiki/references/base/components.md +2 -2
- package/wiki/references/base/controllers.md +0 -1
- package/wiki/references/base/datasources.md +1 -1
- package/wiki/references/base/dependency-injection.md +1 -1
- package/wiki/references/base/filter-system/quick-reference.md +0 -14
- package/wiki/references/base/middlewares.md +0 -8
- package/wiki/references/base/providers.md +0 -9
- package/wiki/references/base/services.md +0 -1
- package/wiki/references/components/authentication/api.md +444 -0
- package/wiki/references/components/authentication/errors.md +177 -0
- package/wiki/references/components/authentication/index.md +571 -0
- package/wiki/references/components/authentication/usage.md +781 -0
- package/wiki/references/components/health-check.md +292 -103
- package/wiki/references/components/index.md +14 -12
- package/wiki/references/components/mail/api.md +505 -0
- package/wiki/references/components/mail/errors.md +176 -0
- package/wiki/references/components/mail/index.md +535 -0
- package/wiki/references/components/mail/usage.md +404 -0
- package/wiki/references/components/request-tracker.md +229 -25
- package/wiki/references/components/socket-io/api.md +1051 -0
- package/wiki/references/components/socket-io/errors.md +119 -0
- package/wiki/references/components/socket-io/index.md +410 -0
- package/wiki/references/components/socket-io/usage.md +322 -0
- package/wiki/references/components/static-asset/api.md +261 -0
- package/wiki/references/components/static-asset/errors.md +89 -0
- package/wiki/references/components/static-asset/index.md +617 -0
- package/wiki/references/components/static-asset/usage.md +364 -0
- package/wiki/references/components/swagger.md +390 -110
- package/wiki/references/components/template/api-page.md +125 -0
- package/wiki/references/components/template/errors-page.md +100 -0
- package/wiki/references/components/template/index.md +104 -0
- package/wiki/references/components/template/setup-page.md +134 -0
- package/wiki/references/components/template/single-page.md +132 -0
- package/wiki/references/components/template/usage-page.md +127 -0
- package/wiki/references/components/websocket/api.md +508 -0
- package/wiki/references/components/websocket/errors.md +123 -0
- package/wiki/references/components/websocket/index.md +453 -0
- package/wiki/references/components/websocket/usage.md +475 -0
- package/wiki/references/helpers/cron/index.md +224 -0
- package/wiki/references/helpers/crypto/index.md +537 -0
- package/wiki/references/helpers/env/index.md +214 -0
- package/wiki/references/helpers/error/index.md +232 -0
- package/wiki/references/helpers/index.md +16 -15
- package/wiki/references/helpers/inversion/index.md +608 -0
- package/wiki/references/helpers/logger/index.md +600 -0
- package/wiki/references/helpers/network/api.md +986 -0
- package/wiki/references/helpers/network/index.md +620 -0
- package/wiki/references/helpers/queue/index.md +589 -0
- package/wiki/references/helpers/redis/index.md +495 -0
- package/wiki/references/helpers/socket-io/api.md +497 -0
- package/wiki/references/helpers/socket-io/index.md +513 -0
- package/wiki/references/helpers/storage/api.md +705 -0
- package/wiki/references/helpers/storage/index.md +583 -0
- package/wiki/references/helpers/template/index.md +66 -0
- package/wiki/references/helpers/template/single-page.md +126 -0
- package/wiki/references/helpers/testing/index.md +510 -0
- package/wiki/references/helpers/types/index.md +512 -0
- package/wiki/references/helpers/uid/index.md +272 -0
- package/wiki/references/helpers/websocket/api.md +736 -0
- package/wiki/references/helpers/websocket/index.md +574 -0
- package/wiki/references/helpers/worker-thread/index.md +470 -0
- package/wiki/references/quick-reference.md +3 -18
- package/wiki/references/utilities/jsx.md +1 -8
- package/wiki/references/utilities/statuses.md +0 -7
- package/wiki/references/components/authentication.md +0 -476
- package/wiki/references/components/mail.md +0 -687
- package/wiki/references/components/socket-io.md +0 -562
- package/wiki/references/components/static-asset.md +0 -1277
- package/wiki/references/helpers/cron.md +0 -108
- package/wiki/references/helpers/crypto.md +0 -132
- package/wiki/references/helpers/env.md +0 -83
- package/wiki/references/helpers/error.md +0 -97
- package/wiki/references/helpers/inversion.md +0 -176
- package/wiki/references/helpers/logger.md +0 -296
- package/wiki/references/helpers/network.md +0 -396
- package/wiki/references/helpers/queue.md +0 -150
- package/wiki/references/helpers/redis.md +0 -142
- package/wiki/references/helpers/socket-io.md +0 -932
- package/wiki/references/helpers/storage.md +0 -665
- package/wiki/references/helpers/testing.md +0 -133
- package/wiki/references/helpers/types.md +0 -167
- package/wiki/references/helpers/uid.md +0 -167
- package/wiki/references/helpers/worker-thread.md +0 -178
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Error Reference Page Template (Tier 2 -- errors.md)
|
|
2
|
+
|
|
3
|
+
The "fix what's broken" page. A developer reads this when they encounter an error or unexpected behavior. Contains error tables organized by source and troubleshooting entries with cause/fix pairs.
|
|
4
|
+
|
|
5
|
+
Paired with [Setup](./setup-page), [Usage](./usage-page), and [API Reference](./api-page).
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
Always created alongside the other 3 pages for Tier 2 components.
|
|
10
|
+
|
|
11
|
+
## Page Structure
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# {Component Name} -- Error Reference
|
|
15
|
+
|
|
16
|
+
> Error codes, error conditions, and troubleshooting for the [{Component Name}](./) component.
|
|
17
|
+
|
|
18
|
+
## Error Reference
|
|
19
|
+
|
|
20
|
+
### {Error Source 1} (e.g., "Component Errors", "JWTTokenService Errors")
|
|
21
|
+
|
|
22
|
+
| Error / Condition | When It Occurs |
|
|
23
|
+
|-------------------|----------------|
|
|
24
|
+
| `Error message or code` | Trigger condition |
|
|
25
|
+
| `Another error` | Another trigger |
|
|
26
|
+
|
|
27
|
+
### {Error Source 2}
|
|
28
|
+
|
|
29
|
+
| Error / Condition | When It Occurs |
|
|
30
|
+
|-------------------|----------------|
|
|
31
|
+
| `Error message or code` | Trigger condition |
|
|
32
|
+
|
|
33
|
+
### {Error Source 3} (repeat as needed)
|
|
34
|
+
|
|
35
|
+
| Error / Condition | When It Occurs |
|
|
36
|
+
|-------------------|----------------|
|
|
37
|
+
| `Error message or code` | Trigger condition |
|
|
38
|
+
|
|
39
|
+
## Troubleshooting
|
|
40
|
+
|
|
41
|
+
### "{Exact error message or symptom}"
|
|
42
|
+
|
|
43
|
+
**Cause:** Why this happens.
|
|
44
|
+
|
|
45
|
+
**Fix:**
|
|
46
|
+
|
|
47
|
+
` ``typescript
|
|
48
|
+
// Fix example
|
|
49
|
+
` ``
|
|
50
|
+
|
|
51
|
+
### "{Another common issue}"
|
|
52
|
+
|
|
53
|
+
**Cause:** Why this happens.
|
|
54
|
+
|
|
55
|
+
**Fix:** How to resolve it.
|
|
56
|
+
|
|
57
|
+
### "{Third issue}"
|
|
58
|
+
|
|
59
|
+
**Cause:** Why this happens.
|
|
60
|
+
|
|
61
|
+
**Fix:**
|
|
62
|
+
|
|
63
|
+
` ``typescript
|
|
64
|
+
// Fix example
|
|
65
|
+
` ``
|
|
66
|
+
|
|
67
|
+
## See Also
|
|
68
|
+
|
|
69
|
+
- [Setup & Configuration](./) -- Quick reference, setup steps, configuration options
|
|
70
|
+
- [Usage & Examples](./usage) -- Usage patterns, examples, API endpoints
|
|
71
|
+
- [API Reference](./api) -- Architecture, method signatures, internals
|
|
72
|
+
|
|
73
|
+
- **Guides:**
|
|
74
|
+
- [Components](/guides/core-concepts/components) - Component system overview
|
|
75
|
+
|
|
76
|
+
- **Components:**
|
|
77
|
+
- [All Components](../index) - Built-in components list
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Rules
|
|
81
|
+
|
|
82
|
+
- **File name:** Always `errors.md` inside the component directory
|
|
83
|
+
- **Focus:** What can go wrong and how to fix it
|
|
84
|
+
- **Error Reference section:** Organize error tables by source class/module (e.g., "Component Errors", "TokenService Errors", "Controller Errors")
|
|
85
|
+
- **Error table columns:** Use `Error / Condition` and `When It Occurs`. Keep descriptions concise
|
|
86
|
+
- **Troubleshooting section:** Minimum 2 entries, maximum 10. Order by frequency -- most common issue first
|
|
87
|
+
- **Troubleshooting heading** uses the exact error message in quotes, or a clear symptom description
|
|
88
|
+
- **Cause** is 1-2 sentences explaining why
|
|
89
|
+
- **Fix** includes a code example when the fix involves code changes
|
|
90
|
+
- **No setup steps** on this page -- those are in `index.md`
|
|
91
|
+
- **No usage examples** on this page -- those are in `usage.md`
|
|
92
|
+
- **No architecture** on this page -- those are in `api.md`
|
|
93
|
+
- **No collapsible sections** -- show all content directly
|
|
94
|
+
- Use `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, `> [!IMPORTANT]` callouts
|
|
95
|
+
|
|
96
|
+
## Where to Find Error Messages
|
|
97
|
+
|
|
98
|
+
1. Component source: `component.ts` -- look for `throw getError()` and `ApplicationError`
|
|
99
|
+
2. Helper source: the underlying helper's error handling
|
|
100
|
+
3. Common misconfiguration patterns from the binding keys and options
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Component Documentation Template
|
|
2
|
+
|
|
3
|
+
Guide for writing consistent, professional component reference docs for Ignis.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
- **Setup-first** -- Get the reader to a working component as fast as possible
|
|
8
|
+
- **Show everything** -- No collapsible sections; use `####` sub-headings for verbose content
|
|
9
|
+
- **Scannable top-level** -- Tables, short code blocks, and callouts for navigation
|
|
10
|
+
- **Earn your section** -- Remove any section that doesn't apply to the component
|
|
11
|
+
|
|
12
|
+
## Tiers
|
|
13
|
+
|
|
14
|
+
| Tier | Structure | When to Use | Examples |
|
|
15
|
+
|------|-----------|-------------|----------|
|
|
16
|
+
| **Tier 1** | [Single page](./single-page) | 5 or fewer config options, straightforward behavior | Health Check, Request Tracker, Swagger |
|
|
17
|
+
| **Tier 2** | 4 pages | 6+ config options, multiple strategies/providers, architectural depth | Authentication, Mail, Socket.IO, WebSocket, Static Asset |
|
|
18
|
+
|
|
19
|
+
### Tier 1 -- Single Page
|
|
20
|
+
|
|
21
|
+
One file: `{component-slug}.md` (e.g., `health-check.md`). Contains everything: Quick Reference, Setup, Configuration, Binding Keys, Troubleshooting, See Also.
|
|
22
|
+
|
|
23
|
+
See [Single-Page Template](./single-page).
|
|
24
|
+
|
|
25
|
+
### Tier 2 -- Four Pages
|
|
26
|
+
|
|
27
|
+
A directory with 4 files:
|
|
28
|
+
|
|
29
|
+
| File | Page Title | Content | Template |
|
|
30
|
+
|------|-----------|---------|----------|
|
|
31
|
+
| `index.md` | Setup & Configuration | Quick ref, imports, setup steps 1-2, config tables, binding keys | [Template](./setup-page) |
|
|
32
|
+
| `usage.md` | Usage & Examples | Step 3 usage, patterns, flows, API endpoints, integration examples | [Template](./usage-page) |
|
|
33
|
+
| `api.md` | API Reference | Architecture diagrams, method signatures, internals, types | [Template](./api-page) |
|
|
34
|
+
| `errors.md` | Error Reference | Error tables by source, troubleshooting entries | [Template](./errors-page) |
|
|
35
|
+
|
|
36
|
+
#### Sidebar Pattern
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
{
|
|
40
|
+
text: 'ComponentName',
|
|
41
|
+
collapsed: true,
|
|
42
|
+
items: [
|
|
43
|
+
{ text: 'Setup & Configuration', link: '/references/components/slug/' },
|
|
44
|
+
{ text: 'Usage & Examples', link: '/references/components/slug/usage' },
|
|
45
|
+
{ text: 'API Reference', link: '/references/components/slug/api' },
|
|
46
|
+
{ text: 'Error Reference', link: '/references/components/slug/errors' },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Cross-Links
|
|
52
|
+
|
|
53
|
+
Every page in a Tier 2 set gets a `## See Also` footer linking to its 3 sibling pages (omit the current page):
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## See Also
|
|
57
|
+
|
|
58
|
+
- [Setup & Configuration](./) -- Quick reference, setup steps, configuration options
|
|
59
|
+
- [Usage & Examples](./usage) -- Usage patterns, examples, API endpoints
|
|
60
|
+
- [API Reference](./api) -- Architecture, method signatures, internals
|
|
61
|
+
- [Error Reference](./errors) -- Error tables and troubleshooting
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Add external links (guides, helpers, libraries) after the sibling links.
|
|
65
|
+
|
|
66
|
+
## Source Paths
|
|
67
|
+
|
|
68
|
+
When documenting a component, find source material here:
|
|
69
|
+
|
|
70
|
+
| What | Path |
|
|
71
|
+
|------|------|
|
|
72
|
+
| Binding keys | `packages/core/src/components/{name}/common/keys.ts` |
|
|
73
|
+
| Config types | `packages/core/src/components/{name}/common/types.ts` |
|
|
74
|
+
| Error messages | `packages/core/src/components/{name}/component.ts` -- look for `throw getError()` |
|
|
75
|
+
| Helper source | `packages/helpers/src/helpers/{name}/` |
|
|
76
|
+
|
|
77
|
+
## Callout Standard
|
|
78
|
+
|
|
79
|
+
Use **GitHub-style only** -- never `::: tip` or `::: warning`:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
> [!NOTE]
|
|
83
|
+
> Informational -- behavior clarification
|
|
84
|
+
|
|
85
|
+
> [!TIP]
|
|
86
|
+
> Suggestion or best practice
|
|
87
|
+
|
|
88
|
+
> [!WARNING]
|
|
89
|
+
> Gotcha, deprecation, or security concern
|
|
90
|
+
|
|
91
|
+
> [!IMPORTANT]
|
|
92
|
+
> Critical functionality impact
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Content Visibility
|
|
96
|
+
|
|
97
|
+
**All content is always visible** -- no `::: details` collapsible blocks.
|
|
98
|
+
|
|
99
|
+
Use `####` sub-headings to organize verbose content like:
|
|
100
|
+
- Import Paths
|
|
101
|
+
- Full Options Reference
|
|
102
|
+
- Type definitions
|
|
103
|
+
- API request/response schemas
|
|
104
|
+
- Source code examples
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Setup & Configuration Page Template (Tier 2 -- index.md)
|
|
2
|
+
|
|
3
|
+
The "get it working" page for complex components. Everything a developer needs on Day 1: what the component is, how to install it, how to configure it, and what binding keys it uses.
|
|
4
|
+
|
|
5
|
+
Paired with [Usage](./usage-page), [API Reference](./api-page), and [Error Reference](./errors-page).
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- Component has 6+ configuration options or multiple config groups
|
|
10
|
+
- Setup involves strategy selection, multiple providers, or multi-step integration
|
|
11
|
+
- There's enough depth to warrant separate Usage, API, and Error pages
|
|
12
|
+
|
|
13
|
+
## Page Structure
|
|
14
|
+
|
|
15
|
+
```markdown
|
|
16
|
+
# {Component Name}
|
|
17
|
+
|
|
18
|
+
{One-line description of what this component does.}
|
|
19
|
+
|
|
20
|
+
> [!IMPORTANT]
|
|
21
|
+
> {Only if there's a critical runtime/dependency note. Remove entirely if not needed.}
|
|
22
|
+
|
|
23
|
+
## Quick Reference
|
|
24
|
+
|
|
25
|
+
| Item | Value |
|
|
26
|
+
|------|-------|
|
|
27
|
+
| **Package** | `@venizia/ignis` |
|
|
28
|
+
| **Class** | `{ComponentClass}` |
|
|
29
|
+
| **Helper** | [`{HelperClass}`](/references/helpers/{slug}) |
|
|
30
|
+
| **Runtimes** | Both / Bun only |
|
|
31
|
+
|
|
32
|
+
| Sub-component | Purpose |
|
|
33
|
+
|---------------|---------|
|
|
34
|
+
| **ClassA** | What it does |
|
|
35
|
+
| **ClassB** | What it does |
|
|
36
|
+
|
|
37
|
+
#### Import Paths
|
|
38
|
+
|
|
39
|
+
` ``typescript
|
|
40
|
+
import { ComponentClass, BindingKeys } from '@venizia/ignis';
|
|
41
|
+
import type { IConfigOptions } from '@venizia/ignis';
|
|
42
|
+
` ``
|
|
43
|
+
|
|
44
|
+
## Setup
|
|
45
|
+
|
|
46
|
+
### Step 1: Bind Configuration
|
|
47
|
+
|
|
48
|
+
Show the minimum viable setup first, then variants.
|
|
49
|
+
|
|
50
|
+
` ``typescript
|
|
51
|
+
// Minimal setup
|
|
52
|
+
this.bind<IConfigType>({ key: Keys.CONFIG }).toValue({
|
|
53
|
+
// required fields only
|
|
54
|
+
});
|
|
55
|
+
` ``
|
|
56
|
+
|
|
57
|
+
> [!TIP]
|
|
58
|
+
> {Optional: point to other setup variants if applicable}
|
|
59
|
+
|
|
60
|
+
#### Alternative: {Variant Name} Setup
|
|
61
|
+
|
|
62
|
+
` ``typescript
|
|
63
|
+
// Full variant setup
|
|
64
|
+
` ``
|
|
65
|
+
|
|
66
|
+
### Step 2: Register Component
|
|
67
|
+
|
|
68
|
+
` ``typescript
|
|
69
|
+
this.component(ComponentClass);
|
|
70
|
+
` ``
|
|
71
|
+
|
|
72
|
+
> [!NOTE]
|
|
73
|
+
> Step 3 (using the component) is covered in [Usage & Examples](./usage).
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
Group options by logical sections when the component has multiple config interfaces.
|
|
78
|
+
|
|
79
|
+
### {Config Group 1} (`IConfigGroupOptions`)
|
|
80
|
+
|
|
81
|
+
| Option | Type | Default | Description |
|
|
82
|
+
|--------|------|---------|-------------|
|
|
83
|
+
| `option` | `string` | `'default'` | What it controls |
|
|
84
|
+
|
|
85
|
+
#### {IConfigGroupOptions} -- Full Reference
|
|
86
|
+
|
|
87
|
+
` ``typescript
|
|
88
|
+
interface IConfigGroupOptions {
|
|
89
|
+
// full interface
|
|
90
|
+
}
|
|
91
|
+
` ``
|
|
92
|
+
|
|
93
|
+
### {Config Group 2} (`IConfigGroup2Options`)
|
|
94
|
+
|
|
95
|
+
| Option | Type | Default | Description |
|
|
96
|
+
|--------|------|---------|-------------|
|
|
97
|
+
| `option` | `string` | `'default'` | What it controls |
|
|
98
|
+
|
|
99
|
+
## Binding Keys
|
|
100
|
+
|
|
101
|
+
| Key | Constant | Type | Required | Default |
|
|
102
|
+
|-----|----------|------|----------|---------|
|
|
103
|
+
| `@app/ns/key` | `Keys.CONSTANT` | `Type` | Yes/No | value or `--` |
|
|
104
|
+
|
|
105
|
+
> [!NOTE]
|
|
106
|
+
> {Any important notes about binding order or conditional requirements}
|
|
107
|
+
|
|
108
|
+
## See Also
|
|
109
|
+
|
|
110
|
+
- [Usage & Examples](./usage) -- Usage patterns, examples, API endpoints
|
|
111
|
+
- [API Reference](./api) -- Architecture, method signatures, internals
|
|
112
|
+
- [Error Reference](./errors) -- Error tables and troubleshooting
|
|
113
|
+
|
|
114
|
+
- **Guides:**
|
|
115
|
+
- [Components](/guides/core-concepts/components) - Component system overview
|
|
116
|
+
|
|
117
|
+
- **Components:**
|
|
118
|
+
- [All Components](../index) - Built-in components list
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Rules
|
|
122
|
+
|
|
123
|
+
- **File name:** Always `index.md` inside a directory named after the component
|
|
124
|
+
- **Focus:** Getting the developer from zero to configured. Setup, config, keys
|
|
125
|
+
- **Only Steps 1-2** on this page -- Step 3 (usage) goes in `usage.md`
|
|
126
|
+
- **No architecture diagrams** on this page -- those go in `api.md`
|
|
127
|
+
- **No internal lifecycle details** on this page -- those go in `api.md`
|
|
128
|
+
- **No error tables** on this page -- those go in `errors.md`
|
|
129
|
+
- **No troubleshooting** on this page -- those go in `errors.md`
|
|
130
|
+
- **Configuration groups:** When a component has multiple config interfaces, use `###` sub-headings per group
|
|
131
|
+
- **Setup variants:** Show minimal setup at the top level. Put alternative configurations under `####` sub-headings
|
|
132
|
+
- **See Also:** Always link to the 3 sibling pages first, then external links
|
|
133
|
+
- **No collapsible sections** -- show all content directly using `####` sub-headings for verbose content (full interfaces, alternative setups)
|
|
134
|
+
- Use `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, `> [!IMPORTANT]` callouts
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Single-Page Component Template (Tier 1)
|
|
2
|
+
|
|
3
|
+
For simple components with few configuration options and straightforward behavior (e.g., Health Check, Request Tracker, Swagger). Everything fits on one page.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Component has 5 or fewer configuration options
|
|
8
|
+
- No complex architecture worth diagramming
|
|
9
|
+
- Behavior is self-explanatory from setup alone
|
|
10
|
+
|
|
11
|
+
## Page Structure
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# {Component Name}
|
|
15
|
+
|
|
16
|
+
{One-line description of what this component does.}
|
|
17
|
+
|
|
18
|
+
> [!IMPORTANT]
|
|
19
|
+
> {Only if there's a critical runtime/dependency note. Remove entirely if not needed.}
|
|
20
|
+
|
|
21
|
+
## Quick Reference
|
|
22
|
+
|
|
23
|
+
| Item | Value |
|
|
24
|
+
|------|-------|
|
|
25
|
+
| **Package** | `@venizia/ignis` |
|
|
26
|
+
| **Class** | `{ComponentClass}` |
|
|
27
|
+
| **Helper** | [`{HelperClass}`](/references/helpers/{slug}) |
|
|
28
|
+
| **Runtimes** | Both / Bun only |
|
|
29
|
+
|
|
30
|
+
#### Import Paths
|
|
31
|
+
|
|
32
|
+
` ``typescript
|
|
33
|
+
import { ComponentClass, BindingKeys } from '@venizia/ignis';
|
|
34
|
+
import type { IConfigOptions } from '@venizia/ignis';
|
|
35
|
+
` ``
|
|
36
|
+
|
|
37
|
+
## Setup
|
|
38
|
+
|
|
39
|
+
### Step 1: Bind Configuration
|
|
40
|
+
|
|
41
|
+
` ``typescript
|
|
42
|
+
this.bind<IConfigType>({ key: Keys.CONFIG }).toValue({
|
|
43
|
+
// minimal config here
|
|
44
|
+
});
|
|
45
|
+
` ``
|
|
46
|
+
|
|
47
|
+
### Step 2: Register Component
|
|
48
|
+
|
|
49
|
+
` ``typescript
|
|
50
|
+
this.component(ComponentClass);
|
|
51
|
+
` ``
|
|
52
|
+
|
|
53
|
+
### Step 3: Use
|
|
54
|
+
|
|
55
|
+
` ``typescript
|
|
56
|
+
// How downstream code interacts with the component
|
|
57
|
+
` ``
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
| Option | Type | Default | Description |
|
|
62
|
+
|--------|------|---------|-------------|
|
|
63
|
+
| `option` | `string` | `'default'` | What it controls |
|
|
64
|
+
|
|
65
|
+
#### {IConfigType} -- Full Reference
|
|
66
|
+
|
|
67
|
+
` ``typescript
|
|
68
|
+
interface IConfigType {
|
|
69
|
+
// full interface
|
|
70
|
+
}
|
|
71
|
+
` ``
|
|
72
|
+
|
|
73
|
+
## Binding Keys
|
|
74
|
+
|
|
75
|
+
| Key | Constant | Type | Required | Default |
|
|
76
|
+
|-----|----------|------|----------|---------|
|
|
77
|
+
| `@app/ns/key` | `Keys.CONSTANT` | `Type` | Yes/No | value or `--` |
|
|
78
|
+
|
|
79
|
+
## API Endpoints
|
|
80
|
+
|
|
81
|
+
> Only include if the component exposes REST routes. Remove entirely if not.
|
|
82
|
+
|
|
83
|
+
| Method | Path | Description |
|
|
84
|
+
|--------|------|-------------|
|
|
85
|
+
| `GET` | `/path` | What it returns |
|
|
86
|
+
|
|
87
|
+
#### Request & Response Schemas
|
|
88
|
+
|
|
89
|
+
**GET /path**
|
|
90
|
+
|
|
91
|
+
Response `200`:
|
|
92
|
+
` ``json
|
|
93
|
+
{ "status": "ok" }
|
|
94
|
+
` ``
|
|
95
|
+
|
|
96
|
+
## Troubleshooting
|
|
97
|
+
|
|
98
|
+
### "{Exact error message or symptom}"
|
|
99
|
+
|
|
100
|
+
**Cause:** Why this happens.
|
|
101
|
+
|
|
102
|
+
**Fix:**
|
|
103
|
+
|
|
104
|
+
` ``typescript
|
|
105
|
+
// Fix example
|
|
106
|
+
` ``
|
|
107
|
+
|
|
108
|
+
### "{Another common issue}"
|
|
109
|
+
|
|
110
|
+
**Cause:** Why this happens.
|
|
111
|
+
|
|
112
|
+
**Fix:** How to resolve it.
|
|
113
|
+
|
|
114
|
+
## See Also
|
|
115
|
+
|
|
116
|
+
- **Guides:**
|
|
117
|
+
- [Components](/guides/core-concepts/components) - Component system overview
|
|
118
|
+
|
|
119
|
+
- **Components:**
|
|
120
|
+
- [All Components](./index) - Built-in components list
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Rules
|
|
124
|
+
|
|
125
|
+
- **One page, one component.** No sub-pages, no sub-directories.
|
|
126
|
+
- **File name:** `{component-slug}.md` (e.g., `health-check.md`, `swagger.md`)
|
|
127
|
+
- **Quick Reference helper row:** Only include if the component wraps a helper class.
|
|
128
|
+
- **API Endpoints section:** Only include if the component registers REST routes. Remove entirely otherwise.
|
|
129
|
+
- **Troubleshooting:** Minimum 2 entries, maximum 5.
|
|
130
|
+
- **See Also:** Inline at the bottom -- no separate page.
|
|
131
|
+
- **No collapsible sections** -- show all content directly using `####` sub-headings for verbose content (full interfaces, controller source, request/response schemas).
|
|
132
|
+
- Use `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, `> [!IMPORTANT]` callouts.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Usage & Examples Page Template (Tier 2 -- usage.md)
|
|
2
|
+
|
|
3
|
+
The "use it effectively" page. A developer reads this on Day 2 when they have the component running and need to integrate it into their application. Contains Step 3 from the setup flow, usage patterns, API endpoint specifications, and integration examples.
|
|
4
|
+
|
|
5
|
+
Paired with [Setup](./setup-page), [API Reference](./api-page), and [Error Reference](./errors-page).
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
Always created alongside the other 3 pages for Tier 2 components.
|
|
10
|
+
|
|
11
|
+
## Page Structure
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# {Component Name} -- Usage & Examples
|
|
15
|
+
|
|
16
|
+
> Usage patterns, integration examples, and API specifications for the [{Component Name}](./) component.
|
|
17
|
+
|
|
18
|
+
## Using the Component
|
|
19
|
+
|
|
20
|
+
Content from "Step 3" -- how downstream code interacts with what the component provides.
|
|
21
|
+
|
|
22
|
+
### {Primary Usage Pattern}
|
|
23
|
+
|
|
24
|
+
` ``typescript
|
|
25
|
+
// Main way to use this component
|
|
26
|
+
` ``
|
|
27
|
+
|
|
28
|
+
### {Secondary Usage Pattern}
|
|
29
|
+
|
|
30
|
+
` ``typescript
|
|
31
|
+
// Alternative usage
|
|
32
|
+
` ``
|
|
33
|
+
|
|
34
|
+
## {Feature Section} (repeat as needed)
|
|
35
|
+
|
|
36
|
+
Group usage examples by feature when the component has multiple capabilities.
|
|
37
|
+
|
|
38
|
+
### {Sub-feature}
|
|
39
|
+
|
|
40
|
+
` ``typescript
|
|
41
|
+
// Feature example
|
|
42
|
+
` ``
|
|
43
|
+
|
|
44
|
+
> [!TIP]
|
|
45
|
+
> {Best practice or recommendation}
|
|
46
|
+
|
|
47
|
+
## API Endpoints
|
|
48
|
+
|
|
49
|
+
> Only include if the component registers REST routes.
|
|
50
|
+
|
|
51
|
+
| Method | Path | Auth | Description |
|
|
52
|
+
|--------|------|------|-------------|
|
|
53
|
+
| `POST` | `/path` | Yes/No | What it does |
|
|
54
|
+
| `GET` | `/path` | Yes/No | What it returns |
|
|
55
|
+
|
|
56
|
+
### POST /path
|
|
57
|
+
|
|
58
|
+
**Request body:**
|
|
59
|
+
|
|
60
|
+
` ``json
|
|
61
|
+
{
|
|
62
|
+
"field": "value"
|
|
63
|
+
}
|
|
64
|
+
` ``
|
|
65
|
+
|
|
66
|
+
| Field | Type | Required | Constraints |
|
|
67
|
+
|-------|------|----------|-------------|
|
|
68
|
+
| `field` | `string` | Yes | Min 1, max 255 |
|
|
69
|
+
|
|
70
|
+
**Response `200`:**
|
|
71
|
+
|
|
72
|
+
` ``json
|
|
73
|
+
{
|
|
74
|
+
"result": "value"
|
|
75
|
+
}
|
|
76
|
+
` ``
|
|
77
|
+
|
|
78
|
+
### GET /path
|
|
79
|
+
|
|
80
|
+
**Response `200`:**
|
|
81
|
+
|
|
82
|
+
` ``json
|
|
83
|
+
{
|
|
84
|
+
"data": []
|
|
85
|
+
}
|
|
86
|
+
` ``
|
|
87
|
+
|
|
88
|
+
## {Integration Section} (optional)
|
|
89
|
+
|
|
90
|
+
### Frontend Integration
|
|
91
|
+
|
|
92
|
+
` ``typescript
|
|
93
|
+
// Client-side integration example
|
|
94
|
+
` ``
|
|
95
|
+
|
|
96
|
+
### {Advanced Pattern}
|
|
97
|
+
|
|
98
|
+
` ``typescript
|
|
99
|
+
// Advanced usage pattern
|
|
100
|
+
` ``
|
|
101
|
+
|
|
102
|
+
## See Also
|
|
103
|
+
|
|
104
|
+
- [Setup & Configuration](./) -- Quick reference, setup steps, configuration options
|
|
105
|
+
- [API Reference](./api) -- Architecture, method signatures, internals
|
|
106
|
+
- [Error Reference](./errors) -- Error tables and troubleshooting
|
|
107
|
+
|
|
108
|
+
- **Guides:**
|
|
109
|
+
- [Components](/guides/core-concepts/components) - Component system overview
|
|
110
|
+
|
|
111
|
+
- **Components:**
|
|
112
|
+
- [All Components](../index) - Built-in components list
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Rules
|
|
116
|
+
|
|
117
|
+
- **File name:** Always `usage.md` inside the component directory
|
|
118
|
+
- **Focus:** How to use the component after setup. Patterns, examples, flows, endpoints
|
|
119
|
+
- **Step 3 content lives here** -- the "Use in Services" part of the setup flow
|
|
120
|
+
- **API Endpoints:** Full request/response specifications go here, not in `api.md`. Show all status codes, all fields, all constraints
|
|
121
|
+
- **No setup steps** on this page -- those are in `index.md`
|
|
122
|
+
- **No architecture diagrams** on this page -- those go in `api.md`
|
|
123
|
+
- **No error tables** on this page -- those go in `errors.md`
|
|
124
|
+
- **Feature grouping:** When a component has multiple features (e.g., template engine, queue executors, verification generators), use `##` sections for each
|
|
125
|
+
- **Code-heavy page** -- every pattern should have a code example
|
|
126
|
+
- **No collapsible sections** -- show all content directly using `####` sub-headings
|
|
127
|
+
- Use `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, `> [!IMPORTANT]` callouts
|