Skip to content

Commit 6bc4f77

Browse files
committed
Deploy documentation v8.28.4
0 parents  commit 6bc4f77

6,488 files changed

Lines changed: 270248 additions & 0 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.

.nojekyll

Whitespace-only changes.

404.html

Lines changed: 36 additions & 0 deletions
Large diffs are not rendered by default.

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tsed.dev

agenda.svg

Lines changed: 30 additions & 0 deletions
Loading

ai/AGENTS.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Ts.ED AGENTS.md guide
2+
3+
This document provides an overview of the Ts.ED framework for AI assistants.
4+
5+
## Audience
6+
7+
You are an expert in TypeScript, Ts.ED, and scalable Node.js application development. You write functional,
8+
maintainable, performant, and accessible code following Ts.ED and TypeScript best practices.
9+
10+
# Objectives
11+
12+
- Scaffold or extend features using Ts.ED patterns (controllers, services, models/DTOs, middlewares, interceptors,
13+
pipes, validators, exception filters).
14+
- Generate code that compiles, follows decorators usage, and respects dependency injection.
15+
- Use the official Ts.ED documentation for API details and examples.
16+
17+
## Typical repository layout (adjust to your project)
18+
19+
layout:
20+
21+
```text
22+
src/
23+
controllers/
24+
services/
25+
models/
26+
middlewares/
27+
interceptors/
28+
protocols/ (auth strategies, guards)
29+
index.ts (server bootstrap)
30+
test/ or src/**/**.spec.ts
31+
package.json
32+
```
33+
34+
## Best practices for Ts.ED apps
35+
36+
- Keep controllers small; push logic to services for easier testing.
37+
- Use Model/DTOs and validation decorators to protect your routes.
38+
- Prefer dependency injection over manual singletons.
39+
- Use interceptors and middlewares for cross‑cutting concerns (logging, caching, metrics).
40+
- Document routes with OpenAPI where applicable and keep examples up‑to‑date.
41+
42+
## Troubleshooting
43+
44+
- "Validation doesn’t run" → ensure Model/DTO is used as parameter with `@BodyParams()` and decorators like
45+
`@Required()` are
46+
present.
47+
- "DI didn’t inject my service" → annotate with `@Injectable()` and ensure it’s discovered (standard directory
48+
structure/imports).
49+
- "Custom error shape" → write an exception filter with `@Catch()` or use built‑in exceptions.
50+
- "Types mismatch" → ensure DTOs are classes with explicit types; avoid loose `any` types.
51+
52+
## Conventions & scaffolding (CLI)
53+
54+
cli:
55+
name: @tsed/cli
56+
install: npm i -D @tsed/cli | yarn add -D @tsed/cli | pnpm add -D @tsed/cli | bun add -d @tsed/cli
57+
usage:
58+
59+
- tsed generate <resource>
60+
- The Ts.ED CLI is the canonical source of scaffolding and up-to-date conventions for Ts.ED.
61+
- Prefer using `tsed generate` to create controllers, services, DTOs, middlewares, interceptors, tests, etc.
62+
- When available, agents should call the CLI to ensure files, names, and boilerplate match the current best practices.
63+
64+
## Plugins & extensions
65+
66+
plugins: https://api.tsed.dev/rest/warehouse
67+
notes:
68+
69+
- Discover community and premium plugins to extend the framework (auth, logging, integrations, etc.).
70+
- Agents may query the API to suggest relevant plugins when the task involves external systems or advanced features.
71+
72+
## Authoritative docs (link instead of copying)
73+
74+
links:
75+
76+
- getting_started: https://tsed.dev/ai/introduction/getting-started.md
77+
- controllers: https://tsed.dev/ai/docs/controllers.md
78+
- routing: https://tsed.dev/ai/docs/routing.md
79+
- di_providers: https://tsed.dev/ai/docs/providers.md
80+
- models: https://tsed.dev/ai/docs/model.md
81+
- validation: https://tsed.dev/ai/docs/validation.md
82+
- middlewares: https://tsed.dev/ai/docs/middlewares.md
83+
- pipes: https://tsed.dev/ai/docs/pipes.md
84+
- interceptors: https://tsed.dev/ai/docs/interceptors.md
85+
- authentication: https://tsed.dev/ai/docs/authentication.md
86+
- exceptions: https://tsed.dev/ai/docs/exceptions.md
87+
- request_context: https://tsed.dev/ai/docs/request-context.md
88+
- swagger_openapi: https://tsed.dev/ai/tutorials/swagger.md
89+
- testing: https://tsed.dev/ai/docs/testing.md
90+
- best_practices: https://tsed.dev/ai/introduction/cheat-sheet.md
91+
- cli: https://tsed.dev/ai/docs/commands.md
92+
- plugins list: https://api.tsed.dev/rest/warehouse
93+
94+
## Guardrails for AI
95+
96+
rules:
97+
98+
- Prefer minimal diffs; mirror existing code style and naming.
99+
- Always use Ts.ED decorators and DI patterns (e.g., @Controller, @Injectable, @Inject, @UseBefore, @UseAfter,
100+
@PathParams, @BodyParams, @QueryParams).
101+
- Create DTOs with validation decorators (@Required, @MinLength, @Email, etc.).
102+
- Keep controllers thin; move business logic to services.
103+
- Keep serialization/validation consistent using Json Mapper and class annotations.
104+
- Update or add unit/integration tests near changed files.
105+
- When adding routes, include types, status codes, and example responses; update OpenAPI annotations when applicable.
106+
- Do not change package manager or framework choices.
107+
108+
## How the agent should operate
109+
110+
process:
111+
112+
- Read relevant sections in the links above before generating code.
113+
- Propose the smallest viable change and show a summary of edits.
114+
- Provide follow‑up commands to validate locally (build/test/start).
115+
- When adding new files, include short TSDoc comments and example usage where helpful.
116+
117+
## Common tasks (examples)
118+
119+
examples:
120+
121+
- title: Add a controller with CRUD endpoints
122+
prompt: |
123+
Create a Ts.ED controller `UsersController` under `src/controllers`. Use `@Controller("/users")`. Add `GET /:id`,
124+
`POST /`, and `PUT /:id` endpoints. Validate body with DTOs under `src/models` using Ts.ED validation decorators.
125+
Inject a `UsersService` for logic.
126+
- title: Create a DTO with validation
127+
prompt: |
128+
Create `UserModel` in `src/models` with `id?: string`, `email: string`, `password: string`. Use `@Email()` and
129+
`@MinLength(8)` as appropriate. Ensure it’s compatible with Ts.ED Json Mapper.
130+
- title: Add a service and inject it in a controller
131+
prompt: |
132+
Create `UsersService` in `src/services` annotated with `@Injectable()`. Provide methods `findById`, `create`,
133+
`update`. Inject it in `UsersController` via constructor and call methods.
134+
- title: Add middleware or interceptor
135+
prompt: |
136+
Create a logging middleware using `@Middleware()` and `@UseBefore()` on specific routes. Or create an interceptor with
137+
`@Interceptor()` and apply via `@UseAfter()`.
138+
- title: Exception handling
139+
prompt: |
140+
Use built‑in exceptions (e.g., `BadRequest`, `NotFound`) or create a custom `@Catch()` filter. Ensure consistent error
141+
response shape.
142+
- title: Tests
143+
prompt: |
144+
Add unit tests with your chosen test runner (Jest/Vitest). Co‑locate `*.spec.ts` near the code or under `test/`. Mock
145+
services and test controller logic.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
meta:
3+
- name: keywords
4+
description: api typescript node.js documentation InjectConfigSource decorator
5+
---
6+
# InjectConfigSource - @tsed/config
7+
8+
## Usage
9+
10+
```typescript
11+
import { InjectConfigSource } from "@tsed/config/src/decorators/injectConfigSource";
12+
```
13+
14+
> See [/packages/config/src/decorators/injectConfigSource.ts](https://github.com/tsedio/tsed/blob/v8.28.4/packages/config/src/decorators/injectConfigSource.ts#L0-L0).
15+
16+
## Overview
17+
18+
```ts
19+
function InjectConfigSource(name: string): any;
20+
```
21+
22+
- **name** (`string`): - The name of the configuration source to inject.
23+
24+
<!-- Description -->
25+
26+
## Description
27+
28+
Injects a specific configuration source by its name.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
meta:
3+
- name: keywords
4+
description: api typescript node.js documentation injectConfigSource function
5+
---
6+
# injectConfigSource - @tsed/config
7+
8+
## Usage
9+
10+
```typescript
11+
import { injectConfigSource } from "@tsed/config/src/fn/injectConfigSource";
12+
```
13+
14+
> See [/packages/config/src/fn/injectConfigSource.ts](https://github.com/tsedio/tsed/blob/v8.28.4/packages/config/src/fn/injectConfigSource.ts#L0-L0).
15+
16+
## Overview
17+
18+
```ts
19+
function injectConfigSource<T extends ConfigSource = ConfigSource>(name: string, opts?: Partial<Pick<InvokeOptions, "useOpts" | "rebuild" | "locals">>): T;
20+
```
21+
22+
- **name** (`string`): - The name of the configuration source to retrieve.
23+
24+
- **\[opts]** (`tring`): - invocation options to customize the behavior of the injection.
25+
26+
<!-- Description -->
27+
28+
## Description
29+
30+
Injects a configuration source by name and returns it as the specified type.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
meta:
3+
- name: keywords
4+
description: api typescript node.js documentation ConfigSourceOptions interface
5+
---
6+
# ConfigSourceOptions - @tsed/config
7+
8+
## Usage
9+
10+
```typescript
11+
import { ConfigSourceOptions } from "@tsed/config";
12+
```
13+
14+
> See [/packages/config/src/interfaces/ConfigSource.ts](https://github.com/tsedio/tsed/blob/v8.28.4/packages/config/src/interfaces/ConfigSource.ts#L0-L0).
15+
16+
## Overview
17+
18+
```ts
19+
interface ConfigSourceOptions<Opts = any> {
20+
name?: string;
21+
priority?: number;
22+
enabled?: boolean;
23+
use: Type<ConfigSource<Opts>>;
24+
options: Opts;
25+
validationSchema?: {
26+
toJSON(opts: Record<string, unknown>): Record<string, unknown> & {
27+
required?: string[];
28+
};
29+
};
30+
watch?: boolean;
31+
refreshOn?: "request" | "response";
32+
}
33+
```
34+
35+
<!-- Members -->
36+
37+
## name
38+
39+
```ts
40+
name?: string;
41+
```
42+
43+
The name of the configuration provider.
44+
45+
## priority
46+
47+
```ts
48+
priority?: number;
49+
```
50+
51+
The priority of the configuration provider. Higher priority providers will override values from lower priority providers.
52+
53+
## enabled
54+
55+
```ts
56+
enabled?: boolean;
57+
```
58+
59+
Whether to enable the configuration provider.
60+
61+
## use
62+
63+
```ts
64+
use: Type<ConfigSource<Opts>>;
65+
```
66+
67+
The ConfigSource to use for loading configuration values.
68+
69+
## options
70+
71+
```ts
72+
options: Opts;
73+
```
74+
75+
Options for the configuration provider.
76+
77+
## validationSchema
78+
79+
```ts
80+
validationSchema?: {
81+
toJSON(opts: Record<string, unknown>): Record<string, unknown> & {
82+
required?: string[];
83+
};
84+
};
85+
```
86+
87+
A JsonSchema instance to validate the configuration values against.
88+
89+
## watch
90+
91+
```ts
92+
watch?: boolean;
93+
```
94+
95+
Enable FileSystem Watch mode. ConfigSource must implement the `watch()` method.
96+
97+
## refreshOn
98+
99+
```ts
100+
refreshOn?: "request" | "response";
101+
```
102+
103+
Refresh strategy. Ts.ED can refresh ConfigSource during the "$onRequest" or "$onResponse" hook.
104+
105+
Note: refresh data during `$onRequest` can degrade performance depending on the ConfigSource type.
106+
We recommend to refresh data during the $onResponse hook (action are asynchronous).

0 commit comments

Comments
 (0)