@gandalan/weblibs 1.5.18 → 1.5.19
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/JSDOC.md +661 -0
- package/api/business/ablageApi.js +106 -0
- package/api/business/anpassungApi.js +74 -0
- package/api/business/artikelApi.js +242 -0
- package/api/business/authApi.js +63 -0
- package/api/business/avApi.js +458 -0
- package/api/business/belegApi.js +365 -0
- package/api/business/belegPositionenApi.js +52 -0
- package/api/business/benutzerApi.js +96 -0
- package/api/business/fakturaApi.js +88 -0
- package/api/business/farbeApi.js +129 -0
- package/api/business/fileApi.js +72 -0
- package/api/business/historieApi.js +144 -0
- package/api/business/index.js +63 -0
- package/api/business/kontaktApi.js +70 -0
- package/api/business/lagerApi.js +162 -0
- package/api/business/lieferungApi.js +127 -0
- package/api/business/mailApi.js +41 -0
- package/api/business/mandantApi.js +137 -0
- package/api/business/materialApi.js +37 -0
- package/api/business/printApi.js +49 -0
- package/api/business/produktionApi.js +141 -0
- package/api/business/rechnungApi.js +155 -0
- package/api/business/serienApi.js +375 -0
- package/api/business/settingsApi.js +168 -0
- package/api/business/systemApi.js +209 -0
- package/api/business/uiApi.js +256 -0
- package/api/business/utilityApi.js +288 -0
- package/api/business/vorgangApi.js +128 -0
- package/api/dtos/allgemein.js +107 -0
- package/api/dtos/artikel.js +46 -0
- package/api/dtos/av.js +171 -0
- package/api/dtos/belege.js +614 -0
- package/api/dtos/benutzer.js +101 -0
- package/api/dtos/druck.js +50 -0
- package/api/dtos/faktura.js +128 -0
- package/api/dtos/farben.js +93 -0
- package/api/dtos/index.js +501 -0
- package/api/dtos/kunden.js +217 -0
- package/api/dtos/lager.js +66 -0
- package/api/dtos/mail.js +30 -0
- package/api/dtos/mandanten.js +60 -0
- package/api/dtos/nachrichten.js +18 -0
- package/api/dtos/produktGruppen.js +18 -0
- package/api/dtos/produktion.js +564 -0
- package/api/dtos/settings.js +172 -0
- package/api/dtos/technik.js +163 -0
- package/api/dtos/ui.js +496 -0
- package/api/dtos/webjob.js +12 -0
- package/api/fluentApi.js +10 -8
- package/api/fluentAuthManager.js +22 -14
- package/api/fluentRestClient.js +7 -7
- package/api/idasFluentApi.js +458 -0
- package/index.js +53 -6
- package/package.json +1 -1
package/JSDOC.md
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
# JSDoc Reference for WebLibs
|
|
2
|
+
|
|
3
|
+
This document records the JSDoc stabilization work done in `WebLibs` and defines the rules that must be followed going forward.
|
|
4
|
+
|
|
5
|
+
The goal is simple:
|
|
6
|
+
|
|
7
|
+
- No API member should degrade to `any` because of broken JSDoc.
|
|
8
|
+
- No DTO type should degrade to `any` because of missing exports, missing imports, or non-module files.
|
|
9
|
+
- Type information must stay discoverable in VS Code IntelliSense through `import("...").Type` and local typedef aliases.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## What Was Changed
|
|
13
|
+
|
|
14
|
+
The following classes of problems were fixed.
|
|
15
|
+
|
|
16
|
+
### 1. API typedef exports were completed
|
|
17
|
+
|
|
18
|
+
Several business API files did not export a stable API type alias, or exported it inconsistently.
|
|
19
|
+
|
|
20
|
+
The working pattern is:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
25
|
+
*/
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This pattern was added or standardized for affected business API files.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### 2. Circular API typing was removed
|
|
32
|
+
|
|
33
|
+
Some API factory functions used this pattern:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
/**
|
|
37
|
+
* @returns {ProduktionApi}
|
|
38
|
+
*/
|
|
39
|
+
export function createProduktionApi(fluentApi) {
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
while the same file also defined:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
47
|
+
*/
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
That is circular. The JS language service can collapse this to `any`.
|
|
51
|
+
|
|
52
|
+
The `@returns {XApi}` annotation was removed from those files when `XApi` was defined via `ReturnType<typeof createXApi>`.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### 3. `idasFluentApi` member typing was stabilized
|
|
56
|
+
|
|
57
|
+
`IDASFluentApi` was normalized so that business members are typed consistently through imported API aliases, for example:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {import("./business/produktionApi.js").ProduktionApi} ProduktionApi
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {import("./fluentApi.js").FluentApi & {
|
|
66
|
+
* produktion: ProduktionApi;
|
|
67
|
+
* }} IDASFluentApi
|
|
68
|
+
*/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This avoids ad hoc per-member typing strategies.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### 4. DTO script files were converted into actual ES modules
|
|
75
|
+
|
|
76
|
+
Some DTO files only contained `@typedef` declarations and no export. In practice, that can make `import("./file.js").Type` unstable or unusable.
|
|
77
|
+
|
|
78
|
+
These DTO files were converted into modules by adding:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
export {};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This was required in plain typedef-only files such as:
|
|
85
|
+
|
|
86
|
+
- `api/dtos/belege.js`
|
|
87
|
+
- `api/dtos/kunden.js`
|
|
88
|
+
- `api/dtos/produktion.js`
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### 5. DTO cross-file dependencies were fixed
|
|
92
|
+
|
|
93
|
+
Some DTOs referenced other DTOs from different files without importing them locally.
|
|
94
|
+
|
|
95
|
+
Example of the broken pattern:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
/**
|
|
99
|
+
* @typedef {Object} BelegDTO
|
|
100
|
+
* @property {BeleganschriftDTO} BelegAdresse
|
|
101
|
+
*/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
if `BeleganschriftDTO` lives in another file and is not imported locally.
|
|
105
|
+
|
|
106
|
+
That was fixed by either:
|
|
107
|
+
|
|
108
|
+
- adding a local typedef alias, or
|
|
109
|
+
- using an inline import in the property type.
|
|
110
|
+
|
|
111
|
+
Example:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
/** @typedef {import('./kunden.js').BeleganschriftDTO} BeleganschriftDTO */
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
or:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
* @property {import('./kunden.js').BeleganschriftDTO} BelegAdresse
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### 6. Missing DTO definitions in JSDoc were added
|
|
125
|
+
|
|
126
|
+
Several DTO names used by the API surface existed in C# or were referenced in JS but were not actually modeled in JSDoc. Missing DTO definitions were added where source information was available.
|
|
127
|
+
|
|
128
|
+
Examples added from source models:
|
|
129
|
+
|
|
130
|
+
- `RechnungsNummer`
|
|
131
|
+
- `ZusatztextDTO`
|
|
132
|
+
- `BelegPositionSonderwunschDTO`
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### 7. Business API method signatures were normalized
|
|
136
|
+
|
|
137
|
+
Inline method-level types like this were reduced:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
* @returns {Promise<import('../dtos/index.js').ProduktionsfreigabeItemDTO[]>}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
and replaced with local aliases at file top plus clean signatures:
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
/** @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO */
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @returns {Promise<ProduktionsfreigabeItemDTO[]>}
|
|
150
|
+
*/
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This is easier to read, easier to maintain, and resolves more reliably in IntelliSense.
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### 8. `FluentApi` typedef usage was standardized
|
|
157
|
+
|
|
158
|
+
Business API files must use:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
/** @typedef {import('../fluentApi.js').FluentApi} FluentApi */
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
and not:
|
|
165
|
+
|
|
166
|
+
- a hand-written fake `FluentApi` object type
|
|
167
|
+
- a missing typedef
|
|
168
|
+
- an import path without `.js`
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
## Files Touched By This Work
|
|
172
|
+
|
|
173
|
+
The exact set may evolve later, but the primary files changed during this stabilization were:
|
|
174
|
+
|
|
175
|
+
### API files
|
|
176
|
+
|
|
177
|
+
- `api/idasFluentApi.js`
|
|
178
|
+
- `api/business/benutzerApi.js`
|
|
179
|
+
- `api/business/artikelApi.js`
|
|
180
|
+
- `api/business/belegApi.js`
|
|
181
|
+
- `api/business/produktionApi.js`
|
|
182
|
+
- `api/business/fakturaApi.js`
|
|
183
|
+
- `api/business/settingsApi.js`
|
|
184
|
+
- `api/business/uiApi.js`
|
|
185
|
+
- `api/business/utilityApi.js`
|
|
186
|
+
- `api/business/serienApi.js`
|
|
187
|
+
- `api/business/kontaktApi.js`
|
|
188
|
+
- `api/business/belegPositionenApi.js`
|
|
189
|
+
- `api/business/materialApi.js`
|
|
190
|
+
|
|
191
|
+
### DTO files
|
|
192
|
+
|
|
193
|
+
- `api/dtos/index.js`
|
|
194
|
+
- `api/dtos/belege.js`
|
|
195
|
+
- `api/dtos/kunden.js`
|
|
196
|
+
- `api/dtos/produktion.js`
|
|
197
|
+
- `api/dtos/settings.js`
|
|
198
|
+
- `api/dtos/ui.js`
|
|
199
|
+
- `api/dtos/technik.js`
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## The Rules
|
|
203
|
+
|
|
204
|
+
These rules are mandatory if you want JSDoc discoverability to remain stable.
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
## Rule 1: Every DTO file must be an ES module
|
|
208
|
+
|
|
209
|
+
If a DTO file only contains typedefs, still add:
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
export {};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Why:
|
|
216
|
+
|
|
217
|
+
- `import("./file.js").Type` is far more reliable when the target file is a real module.
|
|
218
|
+
- Script files with only comments can cause type imports to degrade to `any`.
|
|
219
|
+
|
|
220
|
+
Applies to:
|
|
221
|
+
|
|
222
|
+
- DTO files
|
|
223
|
+
- Any pure-type helper JS file used as a JSDoc import target
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## Rule 2: Use `.js` in all JSDoc import paths
|
|
227
|
+
|
|
228
|
+
Always write:
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
import("../dtos/belege.js").VorgangDTO
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Never write:
|
|
235
|
+
|
|
236
|
+
```js
|
|
237
|
+
import("../dtos/belege").VorgangDTO
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Why:
|
|
241
|
+
|
|
242
|
+
- The repo is ESM.
|
|
243
|
+
- The JS language service resolves explicit file extensions more consistently.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## Rule 3: DTO files must import cross-file DTO dependencies locally
|
|
247
|
+
|
|
248
|
+
If a DTO property references a type from another DTO file, that dependency must be represented in the file itself.
|
|
249
|
+
|
|
250
|
+
Preferred forms:
|
|
251
|
+
|
|
252
|
+
```js
|
|
253
|
+
/** @typedef {import('./kunden.js').BeleganschriftDTO} BeleganschriftDTO */
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
or directly in the property:
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
* @property {import('./kunden.js').BeleganschriftDTO} BelegAdresse
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Never assume a type from another file is globally visible.
|
|
263
|
+
|
|
264
|
+
Why:
|
|
265
|
+
|
|
266
|
+
- Cross-file DTO references otherwise become weak links.
|
|
267
|
+
- A top-level DTO may exist, but nested properties can still collapse to `any`.
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## Rule 4: API files should define local type aliases at the top
|
|
271
|
+
|
|
272
|
+
At the top of each API file, create short local aliases for every DTO used in that file.
|
|
273
|
+
|
|
274
|
+
Example:
|
|
275
|
+
|
|
276
|
+
```js
|
|
277
|
+
/**
|
|
278
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
279
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO
|
|
280
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsInfoDTO} ProduktionsInfoDTO
|
|
281
|
+
*/
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Then use those aliases in method docs.
|
|
285
|
+
|
|
286
|
+
Why:
|
|
287
|
+
|
|
288
|
+
- Method signatures stay readable.
|
|
289
|
+
- Repeated inline import expressions are error-prone.
|
|
290
|
+
- VS Code resolves these aliases more reliably than repeated deep inline imports.
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
## Rule 5: Prefer direct DTO source imports over aggregate imports when practical
|
|
294
|
+
|
|
295
|
+
Preferred:
|
|
296
|
+
|
|
297
|
+
```js
|
|
298
|
+
/** @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO */
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Acceptable when the type truly belongs to the index layer:
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
/** @typedef {import('../dtos/index.js').LoginDTO} LoginDTO */
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Avoid defaulting everything to `dtos/index.js` when the concrete DTO source file is known.
|
|
308
|
+
|
|
309
|
+
Why:
|
|
310
|
+
|
|
311
|
+
- Fewer resolution layers.
|
|
312
|
+
- Easier debugging.
|
|
313
|
+
- Better discoverability of the true type owner.
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
## Rule 6: Do not use circular factory typedef patterns
|
|
317
|
+
|
|
318
|
+
Do not do this:
|
|
319
|
+
|
|
320
|
+
```js
|
|
321
|
+
/**
|
|
322
|
+
* @returns {ProduktionApi}
|
|
323
|
+
*/
|
|
324
|
+
export function createProduktionApi(...) {}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
328
|
+
*/
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
If the exported API type is defined through `ReturnType<typeof createXApi>`, then the factory should not also declare `@returns {XApi}`.
|
|
332
|
+
|
|
333
|
+
Correct pattern:
|
|
334
|
+
|
|
335
|
+
```js
|
|
336
|
+
/**
|
|
337
|
+
* @param {FluentApi} fluentApi
|
|
338
|
+
*/
|
|
339
|
+
export function createProduktionApi(fluentApi) {
|
|
340
|
+
return {
|
|
341
|
+
...
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
347
|
+
*/
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
## Rule 7: `idasFluentApi` members must use imported API aliases consistently
|
|
352
|
+
|
|
353
|
+
Correct pattern:
|
|
354
|
+
|
|
355
|
+
```js
|
|
356
|
+
/** @typedef {import('./business/produktionApi.js').ProduktionApi} ProduktionApi */
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @typedef {import('./fluentApi.js').FluentApi & {
|
|
360
|
+
* produktion: ProduktionApi;
|
|
361
|
+
* }} IDASFluentApi
|
|
362
|
+
*/
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Do not mix:
|
|
366
|
+
|
|
367
|
+
- imported alias types for some members
|
|
368
|
+
- inline `ReturnType<typeof import(...).createXApi>` for others
|
|
369
|
+
- unresolved local names for others
|
|
370
|
+
|
|
371
|
+
One consistent member strategy must be used.
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## Rule 8: Every API file must define `FluentApi` the same way
|
|
375
|
+
|
|
376
|
+
Always:
|
|
377
|
+
|
|
378
|
+
```js
|
|
379
|
+
/** @typedef {import('../fluentApi.js').FluentApi} FluentApi */
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Never:
|
|
383
|
+
|
|
384
|
+
- hand-write a fake subset object
|
|
385
|
+
- omit it and still write `@param {FluentApi}`
|
|
386
|
+
- use extensionless import paths
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
## Rule 9: Optional parameters must be documented exactly
|
|
390
|
+
|
|
391
|
+
If a parameter has a default value or is optional at call sites, mark it optional in JSDoc.
|
|
392
|
+
|
|
393
|
+
Correct forms:
|
|
394
|
+
|
|
395
|
+
```js
|
|
396
|
+
* @param {boolean} [includeDetails=true]
|
|
397
|
+
* @param {Date} [changedSince]
|
|
398
|
+
* @param {string} [statusText='']
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Rules:
|
|
402
|
+
|
|
403
|
+
- Use square brackets for optional parameters.
|
|
404
|
+
- Include the default if the runtime defines one.
|
|
405
|
+
- The JSDoc type must match the runtime type exactly.
|
|
406
|
+
- If `null` is accepted, include it explicitly.
|
|
407
|
+
|
|
408
|
+
Examples:
|
|
409
|
+
|
|
410
|
+
```js
|
|
411
|
+
* @param {Date | null} [changedSince=null]
|
|
412
|
+
* @param {boolean} [includeUIDefs=true]
|
|
413
|
+
* @param {string[]} belegGuids
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Do not omit optionality when the implementation has a default value.
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
## Rule 10: Method names, parameter names, and types must match runtime code exactly
|
|
420
|
+
|
|
421
|
+
JSDoc is not a sketch. It must match the code.
|
|
422
|
+
|
|
423
|
+
That means:
|
|
424
|
+
|
|
425
|
+
- parameter order must match the function signature
|
|
426
|
+
- parameter names must match the implementation
|
|
427
|
+
- optional/default markers must match runtime defaults
|
|
428
|
+
- return types must match actual API responses, not assumptions
|
|
429
|
+
|
|
430
|
+
If the runtime returns a decoded JWT claims object, do not document it as a Swagger login DTO.
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
## Rule 11: DTO property types must be concrete where possible
|
|
434
|
+
|
|
435
|
+
Prefer:
|
|
436
|
+
|
|
437
|
+
```js
|
|
438
|
+
* @property {string} VorgangGuid
|
|
439
|
+
* @property {number | null} VE_Menge
|
|
440
|
+
* @property {Array<BelegPositionDTO>} PositionsObjekte
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Avoid broad placeholders unless the source model is genuinely unknown.
|
|
444
|
+
|
|
445
|
+
Use placeholders only when:
|
|
446
|
+
|
|
447
|
+
- no source model exists in the repo
|
|
448
|
+
- the backend contract is genuinely unknown
|
|
449
|
+
- the placeholder is temporary and explicitly marked as such
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
## Rule 12: Placeholders are allowed, but they must be obvious and deliberate
|
|
453
|
+
|
|
454
|
+
If a DTO cannot yet be modeled concretely, keep the placeholder explicit:
|
|
455
|
+
|
|
456
|
+
```js
|
|
457
|
+
/** @typedef {Object} WebJobHistorieDTO */
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
and keep it centralized in `api/dtos/index.js` with a note that it is a placeholder.
|
|
461
|
+
|
|
462
|
+
Do not scatter placeholder definitions across business API files.
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
## Rule 13: Avoid duplicate semantic owners when possible
|
|
466
|
+
|
|
467
|
+
There are two patterns in this repo:
|
|
468
|
+
|
|
469
|
+
- concrete DTO file owns the actual shape
|
|
470
|
+
- `dtos/index.js` re-exports or aliases it for convenience
|
|
471
|
+
|
|
472
|
+
The concrete source file should remain the semantic owner of the shape.
|
|
473
|
+
|
|
474
|
+
Examples:
|
|
475
|
+
|
|
476
|
+
- `belege.js` owns `VorgangDTO`
|
|
477
|
+
- `produktion.js` owns `ProduktionsfreigabeItemDTO`
|
|
478
|
+
- `kunden.js` owns `KontaktDTO`
|
|
479
|
+
|
|
480
|
+
`dtos/index.js` may alias them, but should not silently replace a concrete definition with a weaker one.
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
## Rule 14: If a DTO file references types from C# sources, keep the JSDoc aligned to the source names
|
|
484
|
+
|
|
485
|
+
If you add or fix a DTO from C#:
|
|
486
|
+
|
|
487
|
+
- preserve the original name
|
|
488
|
+
- preserve nullability where clear
|
|
489
|
+
- preserve enum value meaning where clear
|
|
490
|
+
- preserve nested object types when known
|
|
491
|
+
|
|
492
|
+
Example fixes performed in this work came from C# source classes and enums.
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
## Rule 15: Use clean method-level JSDoc, not deep import expressions
|
|
496
|
+
|
|
497
|
+
Preferred:
|
|
498
|
+
|
|
499
|
+
```js
|
|
500
|
+
/** @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO */
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* @returns {Promise<ProduktionsfreigabeItemDTO[]>}
|
|
504
|
+
*/
|
|
505
|
+
getAllProduktionsfreigabeItems: () => fluentApi.get("ProduktionsfreigabeListe"),
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Avoid:
|
|
509
|
+
|
|
510
|
+
```js
|
|
511
|
+
/**
|
|
512
|
+
* @returns {Promise<import('../dtos/index.js').ProduktionsfreigabeItemDTO[]>}
|
|
513
|
+
*/
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
## Rule 16: Keep JSDoc formatting strict
|
|
518
|
+
|
|
519
|
+
Formatting affects readability and can affect tooling robustness.
|
|
520
|
+
|
|
521
|
+
Rules:
|
|
522
|
+
|
|
523
|
+
- keep indentation consistent with the file
|
|
524
|
+
- keep comment stars aligned
|
|
525
|
+
- do not leave malformed comment lines
|
|
526
|
+
- do not mix single-quote and double-quote styles against repo lint rules
|
|
527
|
+
- run lint fix after large edits in `WebLibs`
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
## Recommended Patterns
|
|
531
|
+
|
|
532
|
+
### Pattern A: DTO-only module
|
|
533
|
+
|
|
534
|
+
```js
|
|
535
|
+
/**
|
|
536
|
+
* @typedef {Object} ExampleDTO
|
|
537
|
+
* @property {string} Guid
|
|
538
|
+
* @property {number | null} Version
|
|
539
|
+
*/
|
|
540
|
+
|
|
541
|
+
export {};
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
### Pattern B: DTO with cross-file dependency
|
|
546
|
+
|
|
547
|
+
```js
|
|
548
|
+
/** @typedef {import('./kunden.js').KontaktDTO} KontaktDTO */
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* @typedef {Object} VorgangDTO
|
|
552
|
+
* @property {KontaktDTO} Kunde
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
export {};
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
### Pattern C: Business API file
|
|
560
|
+
|
|
561
|
+
```js
|
|
562
|
+
/**
|
|
563
|
+
* @typedef {import('../fluentApi.js').FluentApi} FluentApi
|
|
564
|
+
* @typedef {import('../dtos/produktion.js').ProduktionsfreigabeItemDTO} ProduktionsfreigabeItemDTO
|
|
565
|
+
*/
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* @param {FluentApi} fluentApi
|
|
569
|
+
*/
|
|
570
|
+
export function createProduktionApi(fluentApi) {
|
|
571
|
+
return {
|
|
572
|
+
/**
|
|
573
|
+
* @returns {Promise<ProduktionsfreigabeItemDTO[]>}
|
|
574
|
+
*/
|
|
575
|
+
getAllProduktionsfreigabeItems: () => fluentApi.get("ProduktionsfreigabeListe")
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @typedef {ReturnType<typeof createProduktionApi>} ProduktionApi
|
|
581
|
+
*/
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
### Pattern D: Optional parameter with default
|
|
586
|
+
|
|
587
|
+
```js
|
|
588
|
+
/**
|
|
589
|
+
* @param {boolean} [includeDetails=true]
|
|
590
|
+
* @param {Date | null} [changedSince=null]
|
|
591
|
+
* @returns {Promise<AblageDTO[]>}
|
|
592
|
+
*/
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
## Edge Cases Checklist
|
|
597
|
+
|
|
598
|
+
Before finishing any JSDoc work, verify all of the following.
|
|
599
|
+
|
|
600
|
+
### DTO checklist
|
|
601
|
+
|
|
602
|
+
- The DTO file is an ES module.
|
|
603
|
+
- Every cross-file DTO property type is imported locally or written as an inline import.
|
|
604
|
+
- Every enum-like type is documented with the correct primitive union or numeric union.
|
|
605
|
+
- Nullability is explicit.
|
|
606
|
+
- Arrays use `Type[]` or `Array<Type>` consistently.
|
|
607
|
+
- No referenced type name exists only in C# while missing from JSDoc.
|
|
608
|
+
- If a placeholder remains, it is explicit and centralized.
|
|
609
|
+
|
|
610
|
+
### API checklist
|
|
611
|
+
|
|
612
|
+
- `FluentApi` is imported with `.js`.
|
|
613
|
+
- DTOs used in method docs have top-of-file aliases.
|
|
614
|
+
- No inline `import('../dtos/index.js').Type` remains in `@param` or `@returns` unless there is a deliberate reason.
|
|
615
|
+
- Optional parameters use square-bracket syntax.
|
|
616
|
+
- Default values in code are reflected in JSDoc.
|
|
617
|
+
- There is no circular `@returns {XApi}` with `ReturnType<typeof createXApi>`.
|
|
618
|
+
- The exported `XApi` typedef exists at the end of the file.
|
|
619
|
+
|
|
620
|
+
### `idasFluentApi` checklist
|
|
621
|
+
|
|
622
|
+
- Every business member type is imported explicitly.
|
|
623
|
+
- All member properties use one consistent typing strategy.
|
|
624
|
+
- The `userInfo` type matches the runtime object shape, not a guessed backend DTO.
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
## Validation Workflow
|
|
628
|
+
|
|
629
|
+
Whenever you touch JSDoc in `WebLibs`, validate in this order.
|
|
630
|
+
|
|
631
|
+
1. Fix local file diagnostics.
|
|
632
|
+
2. Ensure DTO files are ES modules.
|
|
633
|
+
3. Ensure DTO cross-file property references are imported locally.
|
|
634
|
+
4. Ensure API files use local DTO aliases.
|
|
635
|
+
5. Ensure no circular API `ReturnType` patterns remain.
|
|
636
|
+
6. Run ESLint fix on changed files.
|
|
637
|
+
7. Restart the TS server if IntelliSense still shows stale `any`.
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
## Known Remaining Risk
|
|
641
|
+
|
|
642
|
+
`api/dtos/index.js` still contains some placeholder DTOs that were kept intentionally because no complete JSDoc source model was fully introduced in this pass.
|
|
643
|
+
|
|
644
|
+
That is acceptable for now as long as:
|
|
645
|
+
|
|
646
|
+
- they remain explicit placeholders
|
|
647
|
+
- they do not replace stronger concrete definitions
|
|
648
|
+
- they are upgraded when the source DTO shape becomes available
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
## Bottom Line
|
|
652
|
+
|
|
653
|
+
If you follow these rules, JSDoc discoverability in this repo stays stable.
|
|
654
|
+
|
|
655
|
+
The three most important requirements are:
|
|
656
|
+
|
|
657
|
+
1. DTO files must be ES modules.
|
|
658
|
+
2. DTO cross-file property types must be imported locally.
|
|
659
|
+
3. API files must use local typedef aliases and avoid circular or overly indirect typing.
|
|
660
|
+
|
|
661
|
+
If one of those three is violated, IntelliSense will often fall back to `any` even though the comments look valid at first glance.
|