@zmdb/web 1.0.0-beta.1
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/LICENSE +674 -0
- package/README.md +49 -0
- package/dist/app/bridge.d.ts +12 -0
- package/dist/app/bridge.d.ts.map +1 -0
- package/dist/app/bridge.js +16 -0
- package/dist/app/bridge.js.map +1 -0
- package/dist/app/index.d.ts +23 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +47 -0
- package/dist/app/index.js.map +1 -0
- package/dist/bench/index.d.ts +68 -0
- package/dist/bench/index.d.ts.map +1 -0
- package/dist/bench/index.js +250 -0
- package/dist/bench/index.js.map +1 -0
- package/dist/compression/index.d.ts +13 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/index.js +211 -0
- package/dist/compression/index.js.map +1 -0
- package/dist/context/index.d.ts +74 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +118 -0
- package/dist/context/index.js.map +1 -0
- package/dist/contract/__fixtures__/http-client.generated.d.ts +70 -0
- package/dist/contract/__fixtures__/http-client.generated.d.ts.map +1 -0
- package/dist/contract/__fixtures__/http-client.generated.js +86 -0
- package/dist/contract/__fixtures__/http-client.generated.js.map +1 -0
- package/dist/contract/__fixtures__/http-convergence.d.ts +396 -0
- package/dist/contract/__fixtures__/http-convergence.d.ts.map +1 -0
- package/dist/contract/__fixtures__/http-convergence.js +425 -0
- package/dist/contract/__fixtures__/http-convergence.js.map +1 -0
- package/dist/contract/compiler/client.d.ts +12 -0
- package/dist/contract/compiler/client.d.ts.map +1 -0
- package/dist/contract/compiler/client.js +1293 -0
- package/dist/contract/compiler/client.js.map +1 -0
- package/dist/contract/compiler/index.d.ts +18 -0
- package/dist/contract/compiler/index.d.ts.map +1 -0
- package/dist/contract/compiler/index.js +1058 -0
- package/dist/contract/compiler/index.js.map +1 -0
- package/dist/contract/index.d.ts +237 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +22 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/csrf/index.d.ts +15 -0
- package/dist/csrf/index.d.ts.map +1 -0
- package/dist/csrf/index.js +218 -0
- package/dist/csrf/index.js.map +1 -0
- package/dist/data/index.d.ts +35 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +58 -0
- package/dist/data/index.js.map +1 -0
- package/dist/devtools/index.d.ts +74 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +552 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/dto-pipes/index.d.ts +45 -0
- package/dist/dto-pipes/index.d.ts.map +1 -0
- package/dist/dto-pipes/index.js +78 -0
- package/dist/dto-pipes/index.js.map +1 -0
- package/dist/gateways/index.d.ts +31 -0
- package/dist/gateways/index.d.ts.map +1 -0
- package/dist/gateways/index.js +138 -0
- package/dist/gateways/index.js.map +1 -0
- package/dist/health/index.d.ts +20 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +148 -0
- package/dist/health/index.js.map +1 -0
- package/dist/http-token.d.ts +2 -0
- package/dist/http-token.d.ts.map +1 -0
- package/dist/http-token.js +21 -0
- package/dist/http-token.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/index.d.ts +11 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +39 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/middleware/errors.d.ts +14 -0
- package/dist/middleware/errors.d.ts.map +1 -0
- package/dist/middleware/errors.js +18 -0
- package/dist/middleware/errors.js.map +1 -0
- package/dist/middleware/index.d.ts +46 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +64 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/modules/__fixtures__/large-graph.d.ts +239 -0
- package/dist/modules/__fixtures__/large-graph.d.ts.map +1 -0
- package/dist/modules/__fixtures__/large-graph.js +483 -0
- package/dist/modules/__fixtures__/large-graph.js.map +1 -0
- package/dist/openapi/__fixtures__/entities.d.ts +8 -0
- package/dist/openapi/__fixtures__/entities.d.ts.map +1 -0
- package/dist/openapi/__fixtures__/entities.js +4 -0
- package/dist/openapi/__fixtures__/entities.js.map +1 -0
- package/dist/openapi/__fixtures__/openapi-tools.fixture.d.ts +38 -0
- package/dist/openapi/__fixtures__/openapi-tools.fixture.d.ts.map +1 -0
- package/dist/openapi/__fixtures__/openapi-tools.fixture.js +172 -0
- package/dist/openapi/__fixtures__/openapi-tools.fixture.js.map +1 -0
- package/dist/openapi/__fixtures__/route-schemas.d.ts +2 -0
- package/dist/openapi/__fixtures__/route-schemas.d.ts.map +1 -0
- package/dist/openapi/__fixtures__/route-schemas.js +17 -0
- package/dist/openapi/__fixtures__/route-schemas.js.map +1 -0
- package/dist/openapi/index.d.ts +61 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +314 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/pipeline/guards.d.ts +9 -0
- package/dist/pipeline/guards.d.ts.map +1 -0
- package/dist/pipeline/guards.js +11 -0
- package/dist/pipeline/guards.js.map +1 -0
- package/dist/pipeline/index.d.ts +141 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +1624 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/routing/index.d.ts +40 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +162 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/static/index.d.ts +14 -0
- package/dist/static/index.d.ts.map +1 -0
- package/dist/static/index.js +348 -0
- package/dist/static/index.js.map +1 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +32 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/traced-router.d.ts +5 -0
- package/dist/traced-router.d.ts.map +1 -0
- package/dist/traced-router.js +6 -0
- package/dist/traced-router.js.map +1 -0
- package/dist/upload/index.d.ts +28 -0
- package/dist/upload/index.d.ts.map +1 -0
- package/dist/upload/index.js +410 -0
- package/dist/upload/index.js.map +1 -0
- package/dist/versioning/index.d.ts +35 -0
- package/dist/versioning/index.d.ts.map +1 -0
- package/dist/versioning/index.js +66 -0
- package/dist/versioning/index.js.map +1 -0
- package/dist/versioning/runtime.d.ts +5 -0
- package/dist/versioning/runtime.d.ts.map +1 -0
- package/dist/versioning/runtime.js +34 -0
- package/dist/versioning/runtime.js.map +1 -0
- package/package.json +143 -0
- package/src/app/bridge.ts +39 -0
- package/src/app/index.ts +76 -0
- package/src/bench/index.ts +329 -0
- package/src/compression/index.ts +255 -0
- package/src/context/index.ts +181 -0
- package/src/contract/__fixtures__/http-client.generated.ts +73 -0
- package/src/contract/__fixtures__/http-client.generated.ts.map +1 -0
- package/src/contract/__fixtures__/http-convergence.ts +564 -0
- package/src/contract/compiler/client.ts +1518 -0
- package/src/contract/compiler/index.ts +1457 -0
- package/src/contract/index.ts +266 -0
- package/src/csrf/index.ts +264 -0
- package/src/data/index.ts +65 -0
- package/src/devtools/index.ts +727 -0
- package/src/dto-pipes/index.ts +93 -0
- package/src/gateways/index.ts +180 -0
- package/src/health/index.ts +198 -0
- package/src/http-token.ts +22 -0
- package/src/index.ts +167 -0
- package/src/integrations/index.ts +50 -0
- package/src/middleware/errors.ts +17 -0
- package/src/middleware/index.ts +108 -0
- package/src/modules/__fixtures__/large-graph.ts +540 -0
- package/src/openapi/__fixtures__/entities.ts +19 -0
- package/src/openapi/__fixtures__/openapi-tools.fixture.ts +212 -0
- package/src/openapi/__fixtures__/route-schemas.ts +27 -0
- package/src/openapi/index.ts +483 -0
- package/src/pipeline/guards.ts +23 -0
- package/src/pipeline/index.ts +2041 -0
- package/src/routing/index.ts +201 -0
- package/src/static/index.ts +443 -0
- package/src/testing/index.ts +58 -0
- package/src/traced-router.ts +8 -0
- package/src/upload/index.ts +489 -0
- package/src/versioning/index.ts +106 -0
- package/src/versioning/runtime.ts +38 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// The one realistic fixture the graph tests read. Tests freeze for the epic "The module graph as
|
|
2
|
+
// a first-class object" (#598 / spec freeze #599); the frozen text is `../SPEC.md`'s
|
|
3
|
+
// `## Amendments (lazy modules and the graph's data source, #599)` and `../../devtools/SPEC.md`.
|
|
4
|
+
//
|
|
5
|
+
// One fixture rather than several toy ones, because a graph description is trivially correct for
|
|
6
|
+
// three providers and interesting for thirty: `AppModule` below is seven modules deep with mixed
|
|
7
|
+
// scopes, a provider whose only consumer is another provider's factory, two controllers sharing a
|
|
8
|
+
// token, a route that shadows another, and one lazily imported subtree. Every variant a finding
|
|
9
|
+
// test needs is a separate root exported from the same file so the shapes stay comparable.
|
|
10
|
+
//
|
|
11
|
+
// `__fixtures__/` is not reachable from any `exports` target, which is what makes it the one place
|
|
12
|
+
// under `packages/web/src` where a decorator may be *applied* (ARCHITECTURE.md directive 10 forbids
|
|
13
|
+
// that only on a path reachable from an entry point). `vitest.config.ts`'s `stage3Decorators()`
|
|
14
|
+
// plugin lowers any `.ts` file containing one, not only `*.spec.ts`, so this file runs under the
|
|
15
|
+
// suite unchanged.
|
|
16
|
+
import { Inject, createToken } from '@zmdb/app/di';
|
|
17
|
+
import { lazy, Module } from '@zmdb/app/modules';
|
|
18
|
+
import { Controller, Delete, Get, Post } from '../../routing/index.js';
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Tokens
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
export const CONFIG = createToken('CONFIG');
|
|
23
|
+
export const CLOCK = createToken('CLOCK');
|
|
24
|
+
export const REQUEST_ID = createToken('REQUEST_ID');
|
|
25
|
+
/** A space and a `#` in one description — `../../devtools/SPEC.md` §11.9's DOT quoting case. */
|
|
26
|
+
export const USER_CACHE = createToken('user cache #1');
|
|
27
|
+
export const POOL = createToken('POOL');
|
|
28
|
+
export const USERS_REPOSITORY = createToken('USERS_REPOSITORY');
|
|
29
|
+
export const INVOICES = createToken('INVOICES');
|
|
30
|
+
export const SEARCH_INDEX = createToken('SEARCH_INDEX');
|
|
31
|
+
export const ADMIN_POOL = createToken('ADMIN_POOL');
|
|
32
|
+
/** Every factory call the fixture makes, so a test can say which ran and how often. */
|
|
33
|
+
export const factoryCalls = [];
|
|
34
|
+
/** Every lifecycle hook the fixture runs, in order, so a test can say which ran and when. */
|
|
35
|
+
export const hookLog = [];
|
|
36
|
+
export function resetFactoryCalls() {
|
|
37
|
+
factoryCalls.length = 0;
|
|
38
|
+
hookLog.length = 0;
|
|
39
|
+
}
|
|
40
|
+
/** A promise a test resolves by hand, so a load can be held in flight across an `await`. */
|
|
41
|
+
export function gate() {
|
|
42
|
+
let open = () => { };
|
|
43
|
+
const promise = new Promise(resolve => {
|
|
44
|
+
open = resolve;
|
|
45
|
+
});
|
|
46
|
+
return { promise, open: () => open() };
|
|
47
|
+
}
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// The application graph
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
@Module({
|
|
52
|
+
providers: [
|
|
53
|
+
{ token: CONFIG, useValue: { url: 'postgres://localhost/app' } },
|
|
54
|
+
{
|
|
55
|
+
token: CLOCK,
|
|
56
|
+
useFactory: () => {
|
|
57
|
+
factoryCalls.push('CLOCK');
|
|
58
|
+
return { now: () => 0 };
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
token: REQUEST_ID,
|
|
63
|
+
useFactory: () => {
|
|
64
|
+
factoryCalls.push('REQUEST_ID');
|
|
65
|
+
return { id: factoryCalls.length };
|
|
66
|
+
},
|
|
67
|
+
scope: 'transient',
|
|
68
|
+
},
|
|
69
|
+
{ token: USER_CACHE, useValue: new Map() },
|
|
70
|
+
],
|
|
71
|
+
exports: [CONFIG, CLOCK],
|
|
72
|
+
})
|
|
73
|
+
export class CoreModule {
|
|
74
|
+
}
|
|
75
|
+
@Module({
|
|
76
|
+
imports: [CoreModule],
|
|
77
|
+
providers: [
|
|
78
|
+
{
|
|
79
|
+
token: POOL,
|
|
80
|
+
useFactory: (container) => {
|
|
81
|
+
factoryCalls.push('POOL');
|
|
82
|
+
return { dsn: container.resolve(CONFIG).url };
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
// The edge no description can see: `USERS_REPOSITORY` resolves `POOL` inside the factory
|
|
87
|
+
// body, so `POOL`'s only consumer is opaque (`../../devtools/SPEC.md` §2, §11.5).
|
|
88
|
+
token: USERS_REPOSITORY,
|
|
89
|
+
useFactory: (container) => {
|
|
90
|
+
factoryCalls.push('USERS_REPOSITORY');
|
|
91
|
+
const pool = container.resolve(POOL);
|
|
92
|
+
return { find: (id) => `${pool.dsn}#${id}` };
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
exports: [USERS_REPOSITORY],
|
|
97
|
+
})
|
|
98
|
+
export class DataModule {
|
|
99
|
+
}
|
|
100
|
+
@Controller('/users')
|
|
101
|
+
export class UsersController {
|
|
102
|
+
@Inject(USERS_REPOSITORY)
|
|
103
|
+
repository;
|
|
104
|
+
@Inject(CONFIG)
|
|
105
|
+
config;
|
|
106
|
+
// `/users/:id` is declared before `/users/me`, so it shadows it under first-match routing —
|
|
107
|
+
// the case `docs-site/content/web-devtools.md` says a route printout makes visible.
|
|
108
|
+
@Get('/:id')
|
|
109
|
+
byId() {
|
|
110
|
+
return 'byId';
|
|
111
|
+
}
|
|
112
|
+
@Get('/me')
|
|
113
|
+
me() {
|
|
114
|
+
return 'me';
|
|
115
|
+
}
|
|
116
|
+
@Post('/')
|
|
117
|
+
create() {
|
|
118
|
+
return 'created';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
@Module({ imports: [DataModule], controllers: [UsersController] })
|
|
122
|
+
export class UsersModule {
|
|
123
|
+
}
|
|
124
|
+
@Controller('/invoices')
|
|
125
|
+
export class BillingController {
|
|
126
|
+
// The second consumer of `USERS_REPOSITORY`, which is what `dependentsOf` has to report both of.
|
|
127
|
+
@Inject(USERS_REPOSITORY)
|
|
128
|
+
repository;
|
|
129
|
+
@Inject(INVOICES)
|
|
130
|
+
invoices;
|
|
131
|
+
@Get('/:id')
|
|
132
|
+
byId() {
|
|
133
|
+
return 'invoice';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
@Module({
|
|
137
|
+
imports: [DataModule],
|
|
138
|
+
providers: [
|
|
139
|
+
{
|
|
140
|
+
token: INVOICES,
|
|
141
|
+
useFactory: () => {
|
|
142
|
+
factoryCalls.push('INVOICES');
|
|
143
|
+
return { total: () => 0 };
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
controllers: [BillingController],
|
|
148
|
+
})
|
|
149
|
+
export class BillingModule {
|
|
150
|
+
}
|
|
151
|
+
@Controller('/search')
|
|
152
|
+
export class SearchController {
|
|
153
|
+
@Inject(SEARCH_INDEX)
|
|
154
|
+
index;
|
|
155
|
+
@Get('/')
|
|
156
|
+
query() {
|
|
157
|
+
return 'search';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
@Module({
|
|
161
|
+
imports: [CoreModule],
|
|
162
|
+
providers: [
|
|
163
|
+
{
|
|
164
|
+
token: SEARCH_INDEX,
|
|
165
|
+
useFactory: () => {
|
|
166
|
+
factoryCalls.push('SEARCH_INDEX');
|
|
167
|
+
return { size: 0 };
|
|
168
|
+
},
|
|
169
|
+
scope: 'transient',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
controllers: [SearchController],
|
|
173
|
+
})
|
|
174
|
+
export class SearchModule {
|
|
175
|
+
}
|
|
176
|
+
/** The lazily imported module's controller. It carries all three hooks, for §L12.8 and §L12.11. */
|
|
177
|
+
@Controller('/admin')
|
|
178
|
+
export class AdminController {
|
|
179
|
+
@Inject(ADMIN_POOL)
|
|
180
|
+
pool;
|
|
181
|
+
onModuleInit() {
|
|
182
|
+
hookLog.push('AdminController.onModuleInit');
|
|
183
|
+
}
|
|
184
|
+
onApplicationBootstrap() {
|
|
185
|
+
hookLog.push('AdminController.onApplicationBootstrap');
|
|
186
|
+
}
|
|
187
|
+
onShutdown() {
|
|
188
|
+
hookLog.push('AdminController.onShutdown');
|
|
189
|
+
}
|
|
190
|
+
@Get('/')
|
|
191
|
+
list() {
|
|
192
|
+
hookLog.push('AdminController.list');
|
|
193
|
+
return 'admin';
|
|
194
|
+
}
|
|
195
|
+
@Delete('/:id')
|
|
196
|
+
remove() {
|
|
197
|
+
return 'removed';
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
@Module({
|
|
201
|
+
providers: [
|
|
202
|
+
{
|
|
203
|
+
token: ADMIN_POOL,
|
|
204
|
+
useFactory: () => {
|
|
205
|
+
factoryCalls.push('ADMIN_POOL');
|
|
206
|
+
return { dsn: 'postgres://localhost/admin' };
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
controllers: [AdminController],
|
|
211
|
+
})
|
|
212
|
+
export class AdminModule {
|
|
213
|
+
}
|
|
214
|
+
/** The eager controller the lazy one has to tear down before (§L12.11). */
|
|
215
|
+
@Controller('/health')
|
|
216
|
+
export class HealthController {
|
|
217
|
+
@Inject(CLOCK)
|
|
218
|
+
clock;
|
|
219
|
+
onModuleInit() {
|
|
220
|
+
hookLog.push('HealthController.onModuleInit');
|
|
221
|
+
}
|
|
222
|
+
onApplicationBootstrap() {
|
|
223
|
+
hookLog.push('HealthController.onApplicationBootstrap');
|
|
224
|
+
}
|
|
225
|
+
onShutdown() {
|
|
226
|
+
hookLog.push('HealthController.onShutdown');
|
|
227
|
+
}
|
|
228
|
+
@Get('/')
|
|
229
|
+
check() {
|
|
230
|
+
return 'ok';
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** The fixture root: three eager subtrees, one lazy one, and a controller of its own. */
|
|
234
|
+
@Module({
|
|
235
|
+
imports: [UsersModule, BillingModule, SearchModule, lazy(AdminModule)],
|
|
236
|
+
controllers: [HealthController],
|
|
237
|
+
})
|
|
238
|
+
export class AppModule {
|
|
239
|
+
}
|
|
240
|
+
// ---------------------------------------------------------------------------
|
|
241
|
+
// Variants, one per finding and one per lazy rule
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
/**
|
|
244
|
+
* A real three-module cycle.
|
|
245
|
+
*
|
|
246
|
+
* The closing edge is pushed after all three classes exist because it cannot be written any other
|
|
247
|
+
* way: a decorator expression is evaluated before its class binding is initialised, so
|
|
248
|
+
* `imports: [CycleAppModule]` on the module `CycleAppModule` transitively imports is a
|
|
249
|
+
* `ReferenceError` at definition time. `def.imports` holds this array by reference, so mutating it
|
|
250
|
+
* afterwards is what a cycle across two files looks like from `compileModule`'s side — except for
|
|
251
|
+
* one difference recorded in the tests: a genuine ESM import cycle leaves `undefined` in the array
|
|
252
|
+
* instead, which is a different failure.
|
|
253
|
+
*/
|
|
254
|
+
const closingEdge = [];
|
|
255
|
+
@Module({ imports: closingEdge })
|
|
256
|
+
export class CycleUsersModule {
|
|
257
|
+
}
|
|
258
|
+
@Module({ imports: [CycleUsersModule] })
|
|
259
|
+
export class CycleBillingModule {
|
|
260
|
+
}
|
|
261
|
+
@Module({ imports: [CycleBillingModule] })
|
|
262
|
+
export class CycleAppModule {
|
|
263
|
+
}
|
|
264
|
+
closingEdge.push(CycleAppModule);
|
|
265
|
+
/** The ESM shape of the same mistake: the forward reference is `undefined` at decoration time. */
|
|
266
|
+
const undefinedEdge = [undefined];
|
|
267
|
+
@Module({ imports: undefinedEdge })
|
|
268
|
+
export class UninitialisedImportModule {
|
|
269
|
+
}
|
|
270
|
+
/** Two controllers registering `GET /reports/:id`. The first declared wins; §5's `shadowed-route`. */
|
|
271
|
+
@Controller('/reports')
|
|
272
|
+
export class ReportsController {
|
|
273
|
+
@Get('/:id')
|
|
274
|
+
byId() {
|
|
275
|
+
return 'first';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
@Controller('/reports')
|
|
279
|
+
export class ArchivedReportsController {
|
|
280
|
+
@Get('/:id')
|
|
281
|
+
byId() {
|
|
282
|
+
return 'second';
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
@Module({ controllers: [ReportsController, ArchivedReportsController] })
|
|
286
|
+
export class ShadowedRouteAppModule {
|
|
287
|
+
}
|
|
288
|
+
/** Two modules registering `CONFIG`; §5's `duplicate-provider` finding and startup refusal. */
|
|
289
|
+
@Module({ providers: [{ token: CONFIG, useValue: { url: 'first' } }] })
|
|
290
|
+
export class FirstConfigModule {
|
|
291
|
+
}
|
|
292
|
+
@Module({ providers: [{ token: CONFIG, useValue: { url: 'second' } }] })
|
|
293
|
+
export class SecondConfigModule {
|
|
294
|
+
}
|
|
295
|
+
@Module({ imports: [FirstConfigModule, SecondConfigModule] })
|
|
296
|
+
export class DuplicateProviderAppModule {
|
|
297
|
+
}
|
|
298
|
+
/** Two distinct tokens with one description. `createToken` derives no identity from it; §5's warning. */
|
|
299
|
+
export const DB_PRIMARY = createToken('db');
|
|
300
|
+
export const DB_REPLICA = createToken('db');
|
|
301
|
+
@Module({
|
|
302
|
+
providers: [
|
|
303
|
+
{ token: DB_PRIMARY, useValue: 'primary' },
|
|
304
|
+
{ token: DB_REPLICA, useValue: 'replica' },
|
|
305
|
+
],
|
|
306
|
+
})
|
|
307
|
+
export class AmbiguousTokenAppModule {
|
|
308
|
+
}
|
|
309
|
+
/** A controller injecting a token no module registers; §5's `unresolved-token`. */
|
|
310
|
+
export const NEVER_REGISTERED = createToken('NEVER_REGISTERED');
|
|
311
|
+
@Controller('/missing')
|
|
312
|
+
export class NeedsMissingController {
|
|
313
|
+
@Inject(NEVER_REGISTERED)
|
|
314
|
+
missing;
|
|
315
|
+
@Get('/')
|
|
316
|
+
read() {
|
|
317
|
+
return this.missing;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
@Module({ controllers: [NeedsMissingController] })
|
|
321
|
+
export class UnresolvedTokenAppModule {
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The unresolved-token variant with a provider that *would* run first, so a test can say whether
|
|
325
|
+
* anything was constructed before the refusal (§L12.6: "before any provider is constructed").
|
|
326
|
+
*/
|
|
327
|
+
@Module({
|
|
328
|
+
imports: [CoreModule],
|
|
329
|
+
controllers: [HealthController],
|
|
330
|
+
})
|
|
331
|
+
export class WarmModule {
|
|
332
|
+
}
|
|
333
|
+
@Module({ imports: [WarmModule, UnresolvedTokenAppModule] })
|
|
334
|
+
export class UnresolvedAfterWarmAppModule {
|
|
335
|
+
}
|
|
336
|
+
/** An eager controller injecting a token only the lazily imported module provides; §L3's last row. */
|
|
337
|
+
@Controller('/eager')
|
|
338
|
+
export class EagerNeedsAdminController {
|
|
339
|
+
@Inject(ADMIN_POOL)
|
|
340
|
+
pool;
|
|
341
|
+
@Get('/')
|
|
342
|
+
read() {
|
|
343
|
+
return this.pool.dsn;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
@Module({
|
|
347
|
+
imports: [lazy(AdminModule)],
|
|
348
|
+
controllers: [EagerNeedsAdminController],
|
|
349
|
+
})
|
|
350
|
+
export class EagerDependsOnLazyAppModule {
|
|
351
|
+
}
|
|
352
|
+
/** `Shared` reached lazily from one importer and eagerly from another; §L3 makes it eager. */
|
|
353
|
+
export const SHARED = createToken('SHARED');
|
|
354
|
+
@Module({
|
|
355
|
+
providers: [
|
|
356
|
+
{
|
|
357
|
+
token: SHARED,
|
|
358
|
+
useFactory: () => {
|
|
359
|
+
factoryCalls.push('SHARED');
|
|
360
|
+
return { n: 1 };
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
})
|
|
365
|
+
export class SharedModule {
|
|
366
|
+
}
|
|
367
|
+
@Module({ imports: [lazy(SharedModule)] })
|
|
368
|
+
export class LazyImporterModule {
|
|
369
|
+
}
|
|
370
|
+
@Module({ imports: [SharedModule] })
|
|
371
|
+
export class EagerImporterModule {
|
|
372
|
+
}
|
|
373
|
+
@Module({ imports: [LazyImporterModule, EagerImporterModule] })
|
|
374
|
+
export class LazyThenEagerAppModule {
|
|
375
|
+
}
|
|
376
|
+
@Module({ imports: [EagerImporterModule, LazyImporterModule] })
|
|
377
|
+
export class EagerThenLazyAppModule {
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A lazy subtree whose `useFactory` throws — §L7's terminal failure, §L12.9 and §L12.10.
|
|
381
|
+
*
|
|
382
|
+
* The throw is in a factory rather than a constructor because a factory is the case §L7 argues
|
|
383
|
+
* from (the socket that is already open when the next line throws), and because `factoryCalls`
|
|
384
|
+
* makes "ran exactly once" a countable claim rather than an inference.
|
|
385
|
+
*/
|
|
386
|
+
export const BROKEN_POOL = createToken('BROKEN_POOL');
|
|
387
|
+
@Controller('/broken')
|
|
388
|
+
export class BrokenController {
|
|
389
|
+
@Inject(BROKEN_POOL)
|
|
390
|
+
pool;
|
|
391
|
+
@Get('/')
|
|
392
|
+
read() {
|
|
393
|
+
return this.pool.dsn;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
@Module({
|
|
397
|
+
providers: [
|
|
398
|
+
{
|
|
399
|
+
token: BROKEN_POOL,
|
|
400
|
+
useFactory: () => {
|
|
401
|
+
factoryCalls.push('BROKEN_POOL');
|
|
402
|
+
throw new Error('fixture: the pool could not be opened');
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
controllers: [BrokenController],
|
|
407
|
+
})
|
|
408
|
+
export class BrokenModule {
|
|
409
|
+
}
|
|
410
|
+
@Module({ imports: [CoreModule, lazy(BrokenModule)], controllers: [HealthController] })
|
|
411
|
+
export class BrokenLazyAppModule {
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* A lazy subtree whose load cannot finish until a test opens the gate, so `status` can be observed
|
|
415
|
+
* at `'loading'` and `[Symbol.asyncDispose]` can be called mid-load (§L8, §L12.11).
|
|
416
|
+
*
|
|
417
|
+
* The gate is in `onModuleInit` and not in the factory on purpose: §L5 freezes wiring as one
|
|
418
|
+
* synchronous region with the hooks as the only `await`, so a hook is the only place a load is
|
|
419
|
+
* legitimately suspendable. A gate in a `useFactory` would be testing a shape the spec forbids.
|
|
420
|
+
*/
|
|
421
|
+
export const slowGate = gate();
|
|
422
|
+
@Controller('/slow')
|
|
423
|
+
export class SlowController {
|
|
424
|
+
async onModuleInit() {
|
|
425
|
+
hookLog.push('SlowController.onModuleInit:enter');
|
|
426
|
+
await slowGate.promise;
|
|
427
|
+
hookLog.push('SlowController.onModuleInit:exit');
|
|
428
|
+
}
|
|
429
|
+
@Get('/')
|
|
430
|
+
read() {
|
|
431
|
+
return 'slow';
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
@Module({ controllers: [SlowController] })
|
|
435
|
+
export class SlowModule {
|
|
436
|
+
}
|
|
437
|
+
@Module({ imports: [CoreModule, lazy(SlowModule)], controllers: [HealthController] })
|
|
438
|
+
export class SlowLazyAppModule {
|
|
439
|
+
}
|
|
440
|
+
/** A root with no `lazy()` anywhere, for the "costs nothing when unused" half of §L12.5. */
|
|
441
|
+
@Module({ imports: [UsersModule, BillingModule, SearchModule], controllers: [HealthController] })
|
|
442
|
+
export class EagerOnlyAppModule {
|
|
443
|
+
}
|
|
444
|
+
/** A module whose `name` is empty, standing in for a minified build; §5's `anonymous-class` warning. */
|
|
445
|
+
@Module({})
|
|
446
|
+
export class MangledModule {
|
|
447
|
+
}
|
|
448
|
+
Object.defineProperty(MangledModule, 'name', { value: '' });
|
|
449
|
+
/**
|
|
450
|
+
* Sixty value providers from one array, which is the fixture `--providers` has to refuse
|
|
451
|
+
* unfiltered (`../../devtools/SPEC.md` §8's fifty-node threshold). Providers are data, so the
|
|
452
|
+
* count needs no sixty class declarations.
|
|
453
|
+
*/
|
|
454
|
+
export const bulkTokens = Array.from({ length: 60 }, (_, index) => createToken(`bulk.${index}`));
|
|
455
|
+
const bulkProviders = bulkTokens.map((token, index) => ({ token, useValue: index }));
|
|
456
|
+
@Module({ providers: bulkProviders })
|
|
457
|
+
export class WideModule {
|
|
458
|
+
}
|
|
459
|
+
@Module({ imports: [WideModule, UsersModule] })
|
|
460
|
+
export class WideAppModule {
|
|
461
|
+
}
|
|
462
|
+
/** A controller subclassing a controller — `../../devtools/SPEC.md` §4's prototype-aliasing case. */
|
|
463
|
+
@Controller('/base')
|
|
464
|
+
export class BaseInjectController {
|
|
465
|
+
@Inject(CONFIG)
|
|
466
|
+
config;
|
|
467
|
+
@Get('/a')
|
|
468
|
+
a() {
|
|
469
|
+
return 'a';
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
export class DerivedInjectController extends BaseInjectController {
|
|
473
|
+
@Inject(CLOCK)
|
|
474
|
+
clock;
|
|
475
|
+
@Get('/b')
|
|
476
|
+
b() {
|
|
477
|
+
return 'b';
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
@Module({ imports: [CoreModule], controllers: [BaseInjectController, DerivedInjectController] })
|
|
481
|
+
export class SubclassedControllerAppModule {
|
|
482
|
+
}
|
|
483
|
+
//# sourceMappingURL=large-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"large-graph.js","sourceRoot":"","sources":["../../../src/modules/__fixtures__/large-graph.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,qFAAqF;AACrF,iGAAiG;AACjG,EAAE;AACF,iGAAiG;AACjG,iGAAiG;AACjG,kGAAkG;AAClG,gGAAgG;AAChG,2FAA2F;AAC3F,EAAE;AACF,mGAAmG;AACnG,oGAAoG;AACpG,gGAAgG;AAChG,iGAAiG;AACjG,mBAAmB;AAEnB,OAAO,EAAE,MAAM,EAAE,WAAW,EAA8B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAsC,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;A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ACpB,MAAM,OAAO,oBAAoB;IAC/B,CAAC,MAAM,CAAC,MAAM,CAAC;IACf,MAAM,CAA4B;IAElC,CAAC,GAAG,CAAC,IAAI,CAAC;IACV,CAAC;QACC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,oBAAoB;IAC/D,CAAC,MAAM,CAAC,KAAK,CAAC;IACd,KAAK,CAAqB;IAE1B,CAAC,GAAG,CAAC,IAAI,CAAC;IACV,CAAC;QACC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,EAAE,CAAC;AAChG,MAAM,OAAO,6BAA6B;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HasDefault, type Length, type PrimaryKey, type Sensitive, type Serial, type Sql, type Table } from '@zmdb/schema/tags';
|
|
2
|
+
export interface User extends Table<'users'> {
|
|
3
|
+
id: number & Sql<'integer'> & Serial & PrimaryKey;
|
|
4
|
+
email: string & Sql<'varchar'> & Length<255>;
|
|
5
|
+
createdAt: Date & Sql<'timestamp'> & HasDefault;
|
|
6
|
+
passwordHash: string & Sql<'text'> & Sensitive;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/openapi/__fixtures__/entities.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,KAAK,EACX,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,IAAK,SAAQ,KAAK,CAAC,OAAO,CAAC;IAC1C,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7C,SAAS,EAAE,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;IAChD,YAAY,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/openapi/__fixtures__/entities.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,oEAAoE;AAEpE,OAAO,EAQN,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { OpenApiGeneratedTool } from '@zmdb/ai/http';
|
|
2
|
+
import type { MaxLength } from '@zmdb/schema/tags';
|
|
3
|
+
export type ListUsersArguments = Readonly<Record<never, never>>;
|
|
4
|
+
export declare const listUsersTool: OpenApiGeneratedTool<ListUsersArguments>;
|
|
5
|
+
export type PostUsersArguments = {
|
|
6
|
+
readonly createdAt?: string;
|
|
7
|
+
readonly email: string & MaxLength<255>;
|
|
8
|
+
};
|
|
9
|
+
export declare const postUsersTool: OpenApiGeneratedTool<PostUsersArguments>;
|
|
10
|
+
export type GetUsersHealthArguments = Readonly<Record<never, never>>;
|
|
11
|
+
export declare const getUsersHealthTool: OpenApiGeneratedTool<GetUsersHealthArguments>;
|
|
12
|
+
export type DeleteUsersIdArguments = {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const deleteUsersIdTool: OpenApiGeneratedTool<DeleteUsersIdArguments>;
|
|
16
|
+
export type GetUsersIdArguments = {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const getUsersIdTool: OpenApiGeneratedTool<GetUsersIdArguments>;
|
|
20
|
+
export type PostUsersIdRolesArguments = {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const postUsersIdRolesTool: OpenApiGeneratedTool<PostUsersIdRolesArguments>;
|
|
24
|
+
export type PutUsersIdRolesRoleIdArguments = {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly roleId: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const putUsersIdRolesRoleIdTool: OpenApiGeneratedTool<PutUsersIdRolesRoleIdArguments>;
|
|
29
|
+
export declare const openApiTools: {
|
|
30
|
+
list_users: OpenApiGeneratedTool<Readonly<Record<never, never>>>;
|
|
31
|
+
post_users: OpenApiGeneratedTool<PostUsersArguments>;
|
|
32
|
+
get_users_health: OpenApiGeneratedTool<Readonly<Record<never, never>>>;
|
|
33
|
+
delete_users_id: OpenApiGeneratedTool<DeleteUsersIdArguments>;
|
|
34
|
+
get_users_id: OpenApiGeneratedTool<GetUsersIdArguments>;
|
|
35
|
+
post_users_id_roles: OpenApiGeneratedTool<PostUsersIdRolesArguments>;
|
|
36
|
+
put_users_id_roles_roleId: OpenApiGeneratedTool<PutUsersIdRolesRoleIdArguments>;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=openapi-tools.fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-tools.fixture.d.ts","sourceRoot":"","sources":["../../../src/openapi/__fixtures__/openapi-tools.fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,oBAAoB,CAAC,kBAAkB,CAkBlE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,SAAS,CAAC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