exisjs 0.5.10 → 0.5.12
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/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/oauth/core.d.ts +96 -0
- package/dist/auth/oauth/core.d.ts.map +1 -0
- package/dist/auth/oauth/core.js +203 -0
- package/dist/auth/oauth/core.js.map +1 -0
- package/dist/auth/oauth/index.d.ts +45 -0
- package/dist/auth/oauth/index.d.ts.map +1 -0
- package/dist/auth/oauth/index.js +64 -0
- package/dist/auth/oauth/index.js.map +1 -0
- package/dist/auth/oauth/middleware.d.ts +63 -0
- package/dist/auth/oauth/middleware.d.ts.map +1 -0
- package/dist/auth/oauth/middleware.js +164 -0
- package/dist/auth/oauth/middleware.js.map +1 -0
- package/dist/auth/oauth/providers/custom.d.ts +41 -0
- package/dist/auth/oauth/providers/custom.d.ts.map +1 -0
- package/dist/auth/oauth/providers/custom.js +204 -0
- package/dist/auth/oauth/providers/custom.js.map +1 -0
- package/dist/auth/oauth/providers/discord.d.ts +23 -0
- package/dist/auth/oauth/providers/discord.d.ts.map +1 -0
- package/dist/auth/oauth/providers/discord.js +130 -0
- package/dist/auth/oauth/providers/discord.js.map +1 -0
- package/dist/auth/oauth/providers/facebook.d.ts +28 -0
- package/dist/auth/oauth/providers/facebook.d.ts.map +1 -0
- package/dist/auth/oauth/providers/facebook.js +124 -0
- package/dist/auth/oauth/providers/facebook.js.map +1 -0
- package/dist/auth/oauth/providers/github.d.ts +25 -0
- package/dist/auth/oauth/providers/github.d.ts.map +1 -0
- package/dist/auth/oauth/providers/github.js +132 -0
- package/dist/auth/oauth/providers/github.js.map +1 -0
- package/dist/auth/oauth/providers/google.d.ts +23 -0
- package/dist/auth/oauth/providers/google.d.ts.map +1 -0
- package/dist/auth/oauth/providers/google.js +134 -0
- package/dist/auth/oauth/providers/google.js.map +1 -0
- package/dist/auth/oauth/providers/microsoft.d.ts +28 -0
- package/dist/auth/oauth/providers/microsoft.d.ts.map +1 -0
- package/dist/auth/oauth/providers/microsoft.js +136 -0
- package/dist/auth/oauth/providers/microsoft.js.map +1 -0
- package/dist/auth/oauth/types.d.ts +158 -0
- package/dist/auth/oauth/types.d.ts.map +1 -0
- package/dist/auth/oauth/types.js +4 -0
- package/dist/auth/oauth/types.js.map +1 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +0 -1
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/database/adapters/mongodb.d.ts +58 -0
- package/dist/database/adapters/mongodb.d.ts.map +1 -0
- package/dist/database/adapters/mongodb.js +264 -0
- package/dist/database/adapters/mongodb.js.map +1 -0
- package/dist/database/adapters/mysql.d.ts +27 -0
- package/dist/database/adapters/mysql.d.ts.map +1 -0
- package/dist/database/adapters/mysql.js +188 -0
- package/dist/database/adapters/mysql.js.map +1 -0
- package/dist/database/adapters/postgres.d.ts +28 -0
- package/dist/database/adapters/postgres.d.ts.map +1 -0
- package/dist/database/adapters/postgres.js +174 -0
- package/dist/database/adapters/postgres.js.map +1 -0
- package/dist/database/adapters/sqlite.d.ts +27 -0
- package/dist/database/adapters/sqlite.d.ts.map +1 -0
- package/dist/database/adapters/sqlite.js +149 -0
- package/dist/database/adapters/sqlite.js.map +1 -0
- package/dist/database/index.d.ts +42 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +58 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/manager.d.ts +114 -0
- package/dist/database/manager.d.ts.map +1 -0
- package/dist/database/manager.js +269 -0
- package/dist/database/manager.js.map +1 -0
- package/dist/database/migration.d.ts +57 -0
- package/dist/database/migration.d.ts.map +1 -0
- package/dist/database/migration.js +329 -0
- package/dist/database/migration.js.map +1 -0
- package/dist/database/query-builder.d.ts +89 -0
- package/dist/database/query-builder.d.ts.map +1 -0
- package/dist/database/query-builder.js +353 -0
- package/dist/database/query-builder.js.map +1 -0
- package/dist/database/types.d.ts +184 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +4 -0
- package/dist/database/types.js.map +1 -0
- package/dist/docs/ARCHITECTURE.md +349 -0
- package/dist/docs/BENCHMARKS.md +36 -0
- package/dist/docs/README.md +34 -0
- package/dist/docs/content/README.md +44 -0
- package/dist/docs/content/adapters.mdx +199 -0
- package/dist/docs/content/cache.mdx +239 -0
- package/dist/docs/content/circuit-breaker.mdx +130 -0
- package/dist/docs/content/cli/commands.mdx +214 -0
- package/dist/docs/content/cli/overview.mdx +92 -0
- package/dist/docs/content/cli/usage.mdx +61 -0
- package/dist/docs/content/config.mdx +214 -0
- package/dist/docs/content/controllers.mdx +241 -0
- package/dist/docs/content/cron.mdx +109 -0
- package/dist/docs/content/database.mdx +209 -0
- package/dist/docs/content/dataloader.mdx +170 -0
- package/dist/docs/content/decorators.mdx +204 -0
- package/dist/docs/content/errors.mdx +344 -0
- package/dist/docs/content/exisjs-mcp.mdx +97 -0
- package/dist/docs/content/gateways.mdx +376 -0
- package/dist/docs/content/installation.mdx +210 -0
- package/dist/docs/content/introduction.mdx +96 -0
- package/dist/docs/content/middleware.mdx +441 -0
- package/dist/docs/content/modules.mdx +144 -0
- package/dist/docs/content/oauth.mdx +179 -0
- package/dist/docs/content/providers.mdx +147 -0
- package/dist/docs/content/queues.mdx +177 -0
- package/dist/docs/content/requests.mdx +293 -0
- package/dist/docs/content/responses.mdx +271 -0
- package/dist/docs/content/routing.mdx +541 -0
- package/dist/docs/content/rpc.mdx +146 -0
- package/dist/docs/content/security.mdx +294 -0
- package/dist/docs/content/sse.mdx +159 -0
- package/dist/docs/content/structure.mdx +116 -0
- package/dist/docs/content/testing.mdx +139 -0
- package/dist/docs/content/validation.mdx +249 -0
- package/dist/docs/content/websockets.mdx +289 -0
- package/dist/docs/integrations/README.md +23 -0
- package/dist/docs/integrations/jwt.mdx +151 -0
- package/dist/docs/integrations/mongo.mdx +183 -0
- package/dist/docs/integrations/observability.mdx +125 -0
- package/dist/docs/integrations/openai.mdx +108 -0
- package/dist/docs/integrations/postgres.mdx +190 -0
- package/dist/docs/integrations/posthog.mdx +122 -0
- package/dist/docs/integrations/redis.mdx +141 -0
- package/dist/docs/integrations/resend.mdx +117 -0
- package/dist/docs/integrations/s3.mdx +122 -0
- package/dist/docs/integrations/swagger.mdx +113 -0
- package/dist/docs/reference/README.md +3 -0
- package/dist/docs/reference/adapters.mdx +130 -0
- package/dist/docs/reference/auth.mdx +183 -0
- package/dist/docs/reference/cache.mdx +132 -0
- package/dist/docs/reference/circuit-breaker.mdx +71 -0
- package/dist/docs/reference/config.mdx +118 -0
- package/dist/docs/reference/context.mdx +168 -0
- package/dist/docs/reference/dataloader.mdx +91 -0
- package/dist/docs/reference/decorators.mdx +293 -0
- package/dist/docs/reference/di.mdx +123 -0
- package/dist/docs/reference/error.mdx +170 -0
- package/dist/docs/reference/exis.mdx +124 -0
- package/dist/docs/reference/middleware.mdx +304 -0
- package/dist/docs/reference/plugin.mdx +113 -0
- package/dist/docs/reference/queue.mdx +155 -0
- package/dist/docs/reference/router.mdx +248 -0
- package/dist/docs/reference/sanitize.mdx +130 -0
- package/dist/docs/reference/storage.mdx +116 -0
- package/dist/docs/reference/swagger.mdx +132 -0
- package/dist/docs/reference/testing.mdx +145 -0
- package/dist/docs/reference/validator.mdx +186 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/compression.d.ts +12 -0
- package/dist/middleware/compression.d.ts.map +1 -1
- package/dist/middleware/compression.js +61 -99
- package/dist/middleware/compression.js.map +1 -1
- package/dist/middleware/middleware.d.ts.map +1 -1
- package/dist/middleware/middleware.js +25 -8
- package/dist/middleware/middleware.js.map +1 -1
- package/dist/middleware/security.d.ts.map +1 -1
- package/dist/middleware/security.js +6 -3
- package/dist/middleware/security.js.map +1 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/router.js +11 -7
- package/dist/router/router.js.map +1 -1
- package/dist/server/bootstrapper.js +1 -1
- package/dist/server/bootstrapper.js.map +1 -1
- package/dist/server/bun-adapter.d.ts.map +1 -1
- package/dist/server/bun-adapter.js +2 -2
- package/dist/server/bun-adapter.js.map +1 -1
- package/dist/server/request-handler.d.ts +7 -0
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/server/request-handler.js +37 -2
- package/dist/server/request-handler.js.map +1 -1
- package/dist/server/request.d.ts.map +1 -1
- package/dist/server/request.js +4 -6
- package/dist/server/request.js.map +1 -1
- package/dist/server/route-scanner.d.ts.map +1 -1
- package/dist/server/route-scanner.js +4 -1
- package/dist/server/route-scanner.js.map +1 -1
- package/dist/server/uws-adapter.d.ts +5 -3
- package/dist/server/uws-adapter.d.ts.map +1 -1
- package/dist/server/uws-adapter.js +39 -4
- package/dist/server/uws-adapter.js.map +1 -1
- package/dist/server/ws-orchestrator.d.ts.map +1 -1
- package/dist/server/ws-orchestrator.js +4 -13
- package/dist/server/ws-orchestrator.js.map +1 -1
- package/package.json +17 -10
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Testing"
|
|
3
|
+
description: "Strict API Reference for all Testing utilities and mocking objects."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Testing (`exisjs/testing`)
|
|
7
|
+
|
|
8
|
+
This document provides the strict API signatures and TypeScript interfaces exported by the `exisjs/testing` module. For high-level testing guides, see the [Testing Guide](/docs/testing).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Native Node Runner Exports
|
|
13
|
+
|
|
14
|
+
ExisJS fully re-exports the native `node:test` runner methods, ensuring maximum IDE compatibility while providing powerful internal enhancements (like `.each()`).
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
export function test(name: string, fn?: TestFunction): void
|
|
18
|
+
export function test(name: string, options: TestOptions, fn?: TestFunction): void
|
|
19
|
+
|
|
20
|
+
export function describe(name: string, fn?: TestFunction): void
|
|
21
|
+
export function it(name: string, fn?: TestFunction): void
|
|
22
|
+
|
|
23
|
+
export function before(fn: HookFunction): void
|
|
24
|
+
export function after(fn: HookFunction): void
|
|
25
|
+
export function beforeEach(fn: HookFunction): void
|
|
26
|
+
export function afterEach(fn: HookFunction): void
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Parametrized Tests (`.each`)
|
|
30
|
+
All test blocks (`test`, `describe`, `it`) support a Jest-like `.each()` signature.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
test.each([
|
|
34
|
+
[1, 1, 2],
|
|
35
|
+
[2, 3, 5]
|
|
36
|
+
])('adds %d and %d to equal %d', (a, b, expected) => {
|
|
37
|
+
assert.equal(a + b, expected)
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Context Management
|
|
44
|
+
|
|
45
|
+
### `createTestContext`
|
|
46
|
+
Automatically handles booting an ExisJS `App`, processing its startup hooks, and safely closing all database and worker connections. Returns a `TestApp` client for performing HTTP requests.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
function createTestContext(app: App | typeof Class): TestApp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `registerCleanup`
|
|
53
|
+
Allows third-party plugins or custom test setups to register a global cleanup function that will be executed when the test runner terminates.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
function registerCleanup(fn: () => Promise<void> | void): void
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## HTTP Client (TestApp & TestRequest)
|
|
62
|
+
|
|
63
|
+
The `TestApp` interface provides a fluent API for making HTTP requests directly against your application without binding to a network port.
|
|
64
|
+
|
|
65
|
+
### `TestApp`
|
|
66
|
+
```typescript
|
|
67
|
+
interface TestApp {
|
|
68
|
+
get(path: string): TestRequest
|
|
69
|
+
post(path: string): TestRequest
|
|
70
|
+
put(path: string): TestRequest
|
|
71
|
+
patch(path: string): TestRequest
|
|
72
|
+
delete(path: string): TestRequest
|
|
73
|
+
options(path: string): TestRequest
|
|
74
|
+
head(path: string): TestRequest
|
|
75
|
+
request(method: string, path: string): TestRequest
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `TestRequest`
|
|
80
|
+
Supports chaining headers, bodies, and assertions. Once `.execute()` is called (or awaited), it returns a `TestResponse`.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
class TestRequest {
|
|
84
|
+
send(body: unknown): this
|
|
85
|
+
set(header: string, value: string): this
|
|
86
|
+
|
|
87
|
+
// Assertions
|
|
88
|
+
expect(status: number): this
|
|
89
|
+
expect(header: string, value: string | RegExp): this
|
|
90
|
+
expect(body: unknown): this
|
|
91
|
+
|
|
92
|
+
// Execution
|
|
93
|
+
execute(): Promise<TestResponse>
|
|
94
|
+
then<T>(onfulfilled: (res: TestResponse) => T): Promise<T>
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `TestResponse`
|
|
99
|
+
```typescript
|
|
100
|
+
interface TestResponse {
|
|
101
|
+
status: number
|
|
102
|
+
headers: Record<string, string | string[] | undefined>
|
|
103
|
+
body: any // The parsed JSON payload (if applicable)
|
|
104
|
+
text: string // The raw string response
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Mocks & Spies (`ex`)
|
|
111
|
+
|
|
112
|
+
The `ex` object provides a Jest-compatible API wrapper over the native `node:test` mocking utilities.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const ex = {
|
|
116
|
+
// Spies
|
|
117
|
+
fn: (impl?: Function) => MockFunction,
|
|
118
|
+
spyOn: (obj: any, methodName: string) => MockFunction,
|
|
119
|
+
|
|
120
|
+
// Modules
|
|
121
|
+
mock: (specifier: string, factory?: () => any) => void,
|
|
122
|
+
|
|
123
|
+
// Timers
|
|
124
|
+
setSystemTime: (time: number | Date) => void,
|
|
125
|
+
advanceTimersByTime: (ms: number) => void,
|
|
126
|
+
useFakeTimers: () => void,
|
|
127
|
+
useRealTimers: () => void,
|
|
128
|
+
|
|
129
|
+
clearAllMocks: () => void
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `MockFunction` Extensions
|
|
134
|
+
ExisJS extends the native `MockFunction` returned by `ex.fn()` and `ex.spyOn()` with Jest-like helpers:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
interface MockFunction {
|
|
138
|
+
mockRestore(): void
|
|
139
|
+
mockImplementation(impl: Function): this
|
|
140
|
+
mockResolvedValue(val: any): this
|
|
141
|
+
mockReturnValue(val: any): this
|
|
142
|
+
mockRejectedValue(err: any): this
|
|
143
|
+
mockClear(): void
|
|
144
|
+
}
|
|
145
|
+
```
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Validation"
|
|
3
|
+
description: "API Reference for ExisJS built-in Schema Validator (tex)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Validation (`tex`)
|
|
7
|
+
|
|
8
|
+
ExisJS ships with a blazingly fast, zero-dependency validation library out of the box, exposed as `tex` from `exisjs/validator`. It is powered by a high-performance Rust engine, fully isomorphic, and deeply integrated with TypeScript and OpenAPI (Swagger).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Core Types
|
|
13
|
+
|
|
14
|
+
The `tex` object provides factory functions for every common primitive and data structure.
|
|
15
|
+
|
|
16
|
+
- `tex.string()`: Validates a string.
|
|
17
|
+
- `tex.number()`: Validates a number.
|
|
18
|
+
- `tex.boolean()`: Validates a boolean.
|
|
19
|
+
- `tex.email()`: Validates standard email formatting.
|
|
20
|
+
- `tex.enum(['A', 'B'])`: Validates against a specific set of allowed strings.
|
|
21
|
+
|
|
22
|
+
### Objects & Arrays
|
|
23
|
+
|
|
24
|
+
- `tex.object({ ... })`: Validates an object against a strict shape.
|
|
25
|
+
- `tex.array(schema)`: Validates an array of items matching the given schema.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
const UserProfile = tex.object({
|
|
29
|
+
id: tex.string(),
|
|
30
|
+
tags: tex.array(tex.string()),
|
|
31
|
+
role: tex.enum(['admin', 'user'])
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Usage in Routes
|
|
38
|
+
|
|
39
|
+
ExisJS tightly integrates the `tex` validator directly into its routing layer, providing immediate TypeScript inference for `ctx.body`, `@Body()`, and other parameters.
|
|
40
|
+
|
|
41
|
+
**Class-Based (OOP)**
|
|
42
|
+
```typescript filename="src/http/users/route.ts"
|
|
43
|
+
import { Controller, Post, Body } from 'exisjs/decorators'
|
|
44
|
+
import { tex } from 'exisjs/validator'
|
|
45
|
+
|
|
46
|
+
const CreateUserSchema = tex.object({ email: tex.email() })
|
|
47
|
+
|
|
48
|
+
@Controller('/users')
|
|
49
|
+
export default class UserController {
|
|
50
|
+
@Post('/', { body: CreateUserSchema })
|
|
51
|
+
createUser(@Body() body: any) {
|
|
52
|
+
return { success: true, email: body.email }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Functional**
|
|
58
|
+
```typescript filename="src/http/users/route.ts"
|
|
59
|
+
import { controller, route } from 'exisjs/router'
|
|
60
|
+
import { tex } from 'exisjs/validator'
|
|
61
|
+
|
|
62
|
+
const CreateUserSchema = tex.object({ email: tex.email() })
|
|
63
|
+
|
|
64
|
+
export default controller({
|
|
65
|
+
createUser: route.post('/users', {
|
|
66
|
+
body: CreateUserSchema,
|
|
67
|
+
async handle(ctx) {
|
|
68
|
+
// ctx.body is strictly inferred as { email: string }
|
|
69
|
+
return { success: true, email: ctx.body.email }
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Type Options
|
|
78
|
+
|
|
79
|
+
All validators accept an options object that allows you to configure validation constraints and behaviors.
|
|
80
|
+
|
|
81
|
+
- `optional`: Marks the field as optional (allows `undefined`).
|
|
82
|
+
- `coerce`: Instructs the ultra-fast Rust engine to automatically convert types when possible before validating. For example, converting `"123"` into a number, or `3000` into a string.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Type Conversion Examples using { coerce: true }
|
|
86
|
+
const EnvSchema = tex.object({
|
|
87
|
+
// Converts string "3000" from process.env to number 3000
|
|
88
|
+
PORT: tex.number({ coerce: true }),
|
|
89
|
+
|
|
90
|
+
// Converts boolean 'false' or number '0' to string "false" / "0"
|
|
91
|
+
ID_AS_STRING: tex.string({ coerce: true }),
|
|
92
|
+
|
|
93
|
+
// Converts string "true" or number '1' to boolean true
|
|
94
|
+
ENABLE_FEATURE: tex.boolean({ coerce: true })
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### String Options
|
|
99
|
+
- `min`: Enforces a minimum string length.
|
|
100
|
+
- `max`: Enforces a maximum string length.
|
|
101
|
+
|
|
102
|
+
### Number Options
|
|
103
|
+
- `min`: Enforces a minimum numeric value.
|
|
104
|
+
- `max`: Enforces a maximum numeric value.
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
const User = tex.object({
|
|
108
|
+
id: tex.string(),
|
|
109
|
+
email: tex.email(),
|
|
110
|
+
password: tex.string({ min: 8, max: 100 }),
|
|
111
|
+
age: tex.number({ min: 13, optional: true })
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Custom Data Manipulation
|
|
118
|
+
|
|
119
|
+
### `.sanitize(...fns)`
|
|
120
|
+
Runs one or more synchronous sanitization functions over the data **before** the Rust validation executes. Use this for complex object transformations or string formatting. ExisJS provides a rich suite of built-in sanitizers through the `exisjs/sanitize` module.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { sanitize } from 'exisjs/sanitize'
|
|
124
|
+
|
|
125
|
+
// Built-in sanitization
|
|
126
|
+
const CleanString = tex.string().sanitize(sanitize.trim, sanitize.toLowerCase)
|
|
127
|
+
|
|
128
|
+
// Custom data transformation
|
|
129
|
+
const WhiteListIPs = tex.array(tex.string())
|
|
130
|
+
.sanitize((val) => typeof val === 'string' ? val.split(',') : val)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `.refine(fn, message)`
|
|
134
|
+
Runs custom validation logic **after** the Rust validation executes. Useful for complex business logic that cannot be expressed purely with basic schema types.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const PasswordConfirm = tex.object({
|
|
138
|
+
password: tex.string(),
|
|
139
|
+
confirm: tex.string()
|
|
140
|
+
}).refine((data) => data.password === data.confirm, "Passwords must match")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Type Inference
|
|
146
|
+
|
|
147
|
+
You can extract the raw TypeScript interface directly from any schema using the `ResolveSchema` utility.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { tex, type ResolveSchema } from 'exisjs/validator'
|
|
151
|
+
|
|
152
|
+
const ProfileSchema = tex.object({
|
|
153
|
+
name: tex.string(),
|
|
154
|
+
age: tex.number({ optional: true })
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
// Resolves to: { name: string; age?: number | undefined }
|
|
158
|
+
type Profile = ResolveSchema<typeof ProfileSchema>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Integrations
|
|
164
|
+
|
|
165
|
+
Because the ExisJS Validator is native to the framework, it is tightly coupled with our database and documentation adapters.
|
|
166
|
+
|
|
167
|
+
### OpenAPI Generation
|
|
168
|
+
The `TexEngine` automatically converts validation schemas into strictly compliant OpenAPI/Swagger JSON schemas when attached to routes. This powers the zero-config ExisJS Swagger integration without any manual YAML authoring.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Environment Validation
|
|
173
|
+
|
|
174
|
+
You can safely parse and validate your environment variables at startup using the standard `.parse()` method.
|
|
175
|
+
|
|
176
|
+
```typescript filename="env.ts"
|
|
177
|
+
import { tex } from 'exisjs/validator'
|
|
178
|
+
|
|
179
|
+
// Validates process.env synchronously. Crashes the app on boot with a
|
|
180
|
+
// beautiful error message if validation fails.
|
|
181
|
+
export const env = tex.object({
|
|
182
|
+
PORT: tex.number({ coerce: true, optional: true }),
|
|
183
|
+
DATABASE_URL: tex.string(),
|
|
184
|
+
JWT_SECRET: tex.string({ min: 32 })
|
|
185
|
+
}).parse(process.env)
|
|
186
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export { defineConfig } from './utils/config';
|
|
|
5
5
|
export { createLogger } from './utils/logger';
|
|
6
6
|
export { parseEnv, loadEnv } from './utils/env';
|
|
7
7
|
export { CircuitBreaker, CircuitBreakerError, CircuitState, } from './utils/circuit-breaker';
|
|
8
|
+
export { db, createDatabase, DatabaseManager } from './database';
|
|
9
|
+
export { Migrator } from './database/migration';
|
|
10
|
+
export { QueryBuilder } from './database/query-builder';
|
|
11
|
+
export type { DatabaseConfig, DatabaseDialect, DatabaseAdapter, QueryResult, ExecuteResult, Transaction, } from './database/types';
|
|
8
12
|
export type { ExisConfig, ExisPlugin, ExisPluginInstance, Logger, CorsConfig, LoggerConfig, HookRequest, } from './types';
|
|
9
13
|
export interface ExisUser {
|
|
10
14
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,E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BAAkB,EAClB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAA;AAGhB,MAAM,WAAW,QAAQ;CAAG"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CircuitState = exports.CircuitBreakerError = exports.CircuitBreaker = exports.loadEnv = exports.parseEnv = exports.createLogger = exports.defineConfig = exports.getActiveApp = exports.exis = void 0;
|
|
3
|
+
exports.QueryBuilder = exports.Migrator = exports.DatabaseManager = exports.createDatabase = exports.db = exports.CircuitState = exports.CircuitBreakerError = exports.CircuitBreaker = exports.loadEnv = exports.parseEnv = exports.createLogger = exports.defineConfig = exports.getActiveApp = exports.exis = void 0;
|
|
4
4
|
require("./utils/env");
|
|
5
5
|
// ─── Core ─────────────────────────────────────────────────────────────────────
|
|
6
6
|
var define_1 = require("./server/define");
|
|
@@ -20,4 +20,13 @@ var circuit_breaker_1 = require("./utils/circuit-breaker");
|
|
|
20
20
|
Object.defineProperty(exports, "CircuitBreaker", { enumerable: true, get: function () { return circuit_breaker_1.CircuitBreaker; } });
|
|
21
21
|
Object.defineProperty(exports, "CircuitBreakerError", { enumerable: true, get: function () { return circuit_breaker_1.CircuitBreakerError; } });
|
|
22
22
|
Object.defineProperty(exports, "CircuitState", { enumerable: true, get: function () { return circuit_breaker_1.CircuitState; } });
|
|
23
|
+
// ─── Database ─────────────────────────────────────────────────────────────────
|
|
24
|
+
var database_1 = require("./database");
|
|
25
|
+
Object.defineProperty(exports, "db", { enumerable: true, get: function () { return database_1.db; } });
|
|
26
|
+
Object.defineProperty(exports, "createDatabase", { enumerable: true, get: function () { return database_1.createDatabase; } });
|
|
27
|
+
Object.defineProperty(exports, "DatabaseManager", { enumerable: true, get: function () { return database_1.DatabaseManager; } });
|
|
28
|
+
var migration_1 = require("./database/migration");
|
|
29
|
+
Object.defineProperty(exports, "Migrator", { enumerable: true, get: function () { return migration_1.Migrator; } });
|
|
30
|
+
var query_builder_1 = require("./database/query-builder");
|
|
31
|
+
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return query_builder_1.QueryBuilder; } });
|
|
23
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uBAAoB;AAEpB,iFAAiF;AACjF,0CAAmD;AAA1C,8FAAA,SAAS,OAAQ;AAC1B,oCAAqD;AAAlC,mGAAA,YAAY,OAAA;AAC/B,yCAA6C;AAApC,sGAAA,YAAY,OAAA;AAErB,iFAAiF;AACjF,yCAA6C;AAApC,sGAAA,YAAY,OAAA;AAErB,mCAA+C;AAAtC,+FAAA,QAAQ,OAAA;AAAE,8FAAA,OAAO,OAAA;AAE1B,8EAA8E;AAE9E,2DAIgC;AAH9B,iHAAA,cAAc,OAAA;AACd,sHAAA,mBAAmB,OAAA;AACnB,+GAAA,YAAY,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uBAAoB;AAEpB,iFAAiF;AACjF,0CAAmD;AAA1C,8FAAA,SAAS,OAAQ;AAC1B,oCAAqD;AAAlC,mGAAA,YAAY,OAAA;AAC/B,yCAA6C;AAApC,sGAAA,YAAY,OAAA;AAErB,iFAAiF;AACjF,yCAA6C;AAApC,sGAAA,YAAY,OAAA;AAErB,mCAA+C;AAAtC,+FAAA,QAAQ,OAAA;AAAE,8FAAA,OAAO,OAAA;AAE1B,8EAA8E;AAE9E,2DAIgC;AAH9B,iHAAA,cAAc,OAAA;AACd,sHAAA,mBAAmB,OAAA;AACnB,+GAAA,YAAY,OAAA;AAGd,iFAAiF;AACjF,uCAAgE;AAAvD,8FAAA,EAAE,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AAC5C,kDAA+C;AAAtC,qGAAA,QAAQ,OAAA;AACjB,0DAAuD;AAA9C,6GAAA,YAAY,OAAA"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { Handler } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Compression middleware — optimized to avoid monkey-patching ServerResponse methods.
|
|
4
|
+
*
|
|
5
|
+
* Previous implementation replaced res.raw.write/end/setHeader/writeHead with new closures
|
|
6
|
+
* on every request, which:
|
|
7
|
+
* 1. Created 5+ closure objects per request (GC pressure)
|
|
8
|
+
* 2. Destroyed V8's hidden class optimization for ServerResponse
|
|
9
|
+
*
|
|
10
|
+
* This version hooks into the ExisResponse's _onFinish callback and overrides the
|
|
11
|
+
* high-level json()/send()/end() methods on ExisResponse instead. Since ExisResponse
|
|
12
|
+
* is our own object (and already pooled), modifying it doesn't deoptimize Node internals.
|
|
13
|
+
*/
|
|
2
14
|
export declare function compression(): Handler;
|
|
3
15
|
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../src/middleware/compression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,UAAU,CAAA;AAE1D,wBAAgB,WAAW,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../src/middleware/compression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,UAAU,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAiFrC"}
|
|
@@ -5,6 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.compression = compression;
|
|
7
7
|
const node_zlib_1 = __importDefault(require("node:zlib"));
|
|
8
|
+
/**
|
|
9
|
+
* Compression middleware — optimized to avoid monkey-patching ServerResponse methods.
|
|
10
|
+
*
|
|
11
|
+
* Previous implementation replaced res.raw.write/end/setHeader/writeHead with new closures
|
|
12
|
+
* on every request, which:
|
|
13
|
+
* 1. Created 5+ closure objects per request (GC pressure)
|
|
14
|
+
* 2. Destroyed V8's hidden class optimization for ServerResponse
|
|
15
|
+
*
|
|
16
|
+
* This version hooks into the ExisResponse's _onFinish callback and overrides the
|
|
17
|
+
* high-level json()/send()/end() methods on ExisResponse instead. Since ExisResponse
|
|
18
|
+
* is our own object (and already pooled), modifying it doesn't deoptimize Node internals.
|
|
19
|
+
*/
|
|
8
20
|
function compression() {
|
|
9
21
|
return (req, res, next) => {
|
|
10
22
|
const acceptEncoding = req.headers['accept-encoding'] || '';
|
|
@@ -19,115 +31,65 @@ function compression() {
|
|
|
19
31
|
if (!encoding || req.method === 'HEAD') {
|
|
20
32
|
return next();
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
: undefined;
|
|
29
|
-
res.raw.setHeader = function (name, value) {
|
|
30
|
-
if (name.toLowerCase() === 'content-length') {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
return originalRawSetHeader(name, value);
|
|
34
|
-
};
|
|
35
|
-
if (originalRawWriteHead) {
|
|
36
|
-
res.raw.writeHead = function (statusCode, reasonOrHeaders, headers) {
|
|
37
|
-
const actualHeaders = headers || reasonOrHeaders;
|
|
38
|
-
if (actualHeaders && typeof actualHeaders === 'object') {
|
|
39
|
-
const cleaned = {};
|
|
40
|
-
for (const [k, v] of Object.entries(actualHeaders)) {
|
|
41
|
-
if (k.toLowerCase() !== 'content-length') {
|
|
42
|
-
cleaned[k] = v;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (headers) {
|
|
46
|
-
reasonOrHeaders = cleaned;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
reasonOrHeaders = cleaned;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return originalRawWriteHead(statusCode, reasonOrHeaders, headers);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
let onFinishCallback;
|
|
56
|
-
const startCompression = () => {
|
|
57
|
-
if (stream)
|
|
58
|
-
return; // already started
|
|
59
|
-
originalRawSetHeader('Content-Encoding', encoding);
|
|
60
|
-
originalRawSetHeader('Vary', 'Accept-Encoding');
|
|
61
|
-
if (encoding === 'br') {
|
|
62
|
-
stream = node_zlib_1.default.createBrotliCompress();
|
|
63
|
-
}
|
|
64
|
-
else if (encoding === 'gzip') {
|
|
65
|
-
stream = node_zlib_1.default.createGzip();
|
|
66
|
-
}
|
|
67
|
-
else if (encoding === 'deflate') {
|
|
68
|
-
stream = node_zlib_1.default.createDeflate();
|
|
69
|
-
}
|
|
70
|
-
if (stream) {
|
|
71
|
-
stream.on('data', (chunk) => {
|
|
72
|
-
originalWrite(chunk);
|
|
73
|
-
});
|
|
74
|
-
stream.on('end', () => {
|
|
75
|
-
originalEnd(undefined, undefined, onFinishCallback);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
res.raw.write = function (chunk, encodingOrCb, cb) {
|
|
34
|
+
// Store originals from the ExisResponse wrapper (our own object — safe to override)
|
|
35
|
+
const originalEnd = res.end.bind(res);
|
|
36
|
+
const selectedEncoding = encoding;
|
|
37
|
+
// Override ExisResponse.end() to compress the final payload in a single pass.
|
|
38
|
+
// This avoids touching ServerResponse's hidden class entirely.
|
|
39
|
+
res.end = function (data) {
|
|
80
40
|
if (res.raw.writableEnded)
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
86
|
-
}
|
|
87
|
-
return originalWrite(chunk, encodingOrCb, cb);
|
|
88
|
-
};
|
|
89
|
-
let ended = false;
|
|
90
|
-
res.raw.end = function (chunk, encodingOrCb, cb) {
|
|
91
|
-
if (res.raw.writableEnded || ended)
|
|
92
|
-
return this;
|
|
93
|
-
ended = true;
|
|
94
|
-
let callback;
|
|
95
|
-
let encodingArg;
|
|
96
|
-
if (typeof chunk === 'function') {
|
|
97
|
-
callback = chunk;
|
|
98
|
-
chunk = undefined;
|
|
99
|
-
}
|
|
100
|
-
else if (typeof encodingOrCb === 'function') {
|
|
101
|
-
callback = encodingOrCb;
|
|
102
|
-
encodingOrCb = undefined;
|
|
103
|
-
}
|
|
104
|
-
else if (typeof cb === 'function') {
|
|
105
|
-
callback = cb;
|
|
41
|
+
return;
|
|
42
|
+
// Skip compression for empty responses
|
|
43
|
+
if (!data) {
|
|
44
|
+
originalEnd(data);
|
|
45
|
+
return;
|
|
106
46
|
}
|
|
107
|
-
|
|
108
|
-
|
|
47
|
+
const buf = typeof data === 'string'
|
|
48
|
+
? Buffer.from(data, 'utf8')
|
|
49
|
+
: Buffer.isBuffer(data)
|
|
50
|
+
? data
|
|
51
|
+
: Buffer.from(String(data), 'utf8');
|
|
52
|
+
// For small payloads (< 1KB), compression overhead outweighs savings
|
|
53
|
+
if (buf.length < 1024) {
|
|
54
|
+
originalEnd(data);
|
|
55
|
+
return;
|
|
109
56
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
57
|
+
// Set encoding headers
|
|
58
|
+
res.raw.setHeader('Content-Encoding', selectedEncoding);
|
|
59
|
+
res.raw.setHeader('Vary', 'Accept-Encoding');
|
|
60
|
+
// Remove Content-Length since compressed size will differ
|
|
61
|
+
res.raw.removeHeader('Content-Length');
|
|
62
|
+
// Compress synchronously for small-to-medium payloads to avoid extra async overhead
|
|
63
|
+
let compressed;
|
|
64
|
+
try {
|
|
65
|
+
if (selectedEncoding === 'br') {
|
|
66
|
+
compressed = node_zlib_1.default.brotliCompressSync(buf);
|
|
67
|
+
}
|
|
68
|
+
else if (selectedEncoding === 'gzip') {
|
|
69
|
+
compressed = node_zlib_1.default.gzipSync(buf);
|
|
118
70
|
}
|
|
119
71
|
else {
|
|
120
|
-
|
|
72
|
+
compressed = node_zlib_1.default.deflateSync(buf);
|
|
121
73
|
}
|
|
122
74
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
75
|
+
catch {
|
|
76
|
+
// If compression fails, send uncompressed
|
|
77
|
+
originalEnd(data);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
res.raw.setHeader('Content-Length', compressed.length);
|
|
81
|
+
// Fire _onFinish callbacks via the original end path
|
|
82
|
+
if (res._onFinish.length > 0) {
|
|
83
|
+
res.raw.end(compressed, () => {
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
85
|
+
for (let i = 0; i < res._onFinish.length; i++) {
|
|
86
|
+
res._onFinish[i]();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
126
89
|
}
|
|
127
90
|
else {
|
|
128
|
-
|
|
91
|
+
res.raw.end(compressed);
|
|
129
92
|
}
|
|
130
|
-
return this;
|
|
131
93
|
};
|
|
132
94
|
next();
|
|
133
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../src/middleware/compression.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../src/middleware/compression.ts"],"names":[],"mappings":";;;;;AAeA,kCAiFC;AAhGD,0DAA4B;AAG5B;;;;;;;;;;;GAWG;AACH,SAAgB,WAAW;IACzB,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAI,EAAE,EAAE;QAC3C,MAAM,cAAc,GAAI,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAY,IAAI,EAAE,CAAA;QAEvE,qBAAqB;QACrB,IAAI,QAAQ,GAAqC,IAAI,CAAA;QACrD,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,QAAQ,GAAG,IAAI,CAAA;aAC7C,I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
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EACL,eAAe,EAEhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,SAAS,EAEV,MAAM,kBAAkB,CAAA;AAKzB,wBAAgB,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,OAAO,CAwFrD;AAMD,wBAAgB,SAAS,IAAI,OAAO,CAenC;AAID,wBAAgB,aAAa,CAC3B,cAAc,GAAE,MAAM,GAAG,YAAiB,GACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EACL,eAAe,EAEhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,SAAS,EAEV,MAAM,kBAAkB,CAAA;AAKzB,wBAAgB,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,OAAO,CAwFrD;AAMD,wBAAgB,SAAS,IAAI,OAAO,CAenC;AAID,wBAAgB,aAAa,CAC3B,cAAc,GAAE,MAAM,GAAG,YAAiB,GACzC,OAAO,CAqDT;AAID,eAAO,MAAM,QAAQ,EAAE,OAQtB,CAAA;AAID,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,aAAa,EACb,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAA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