@gandalan/weblibs 1.5.22 → 1.5.23

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.
@@ -0,0 +1,85 @@
1
+ // Auto-generated NeherApp3 root type definitions.
2
+ // Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs
3
+
4
+ export type NeherApp3NotifyType = 0 | 1 | 2;
5
+
6
+ export type ArtikelstammEintrag = {
7
+ KatalogArtikelGuid?: string;
8
+ KatalogNummer?: string;
9
+ Katalognummer?: string;
10
+ Nummer?: string;
11
+ };
12
+
13
+ export type Variante = {
14
+ VarianteGuid?: string;
15
+ Name?: string;
16
+ Kuerzel?: string;
17
+ };
18
+
19
+ export type Werteliste = {
20
+ WerteListeGuid?: string;
21
+ Name?: string;
22
+ };
23
+
24
+ export type NeherApp3ArtikelstammCache = {
25
+ getArtikelStamm: () => Promise<ArtikelstammEintrag[]>;
26
+ getWarenGruppen: () => Promise<object[]>;
27
+ getArtikelByGuid: (guid: string) => Promise<ArtikelstammEintrag | undefined>;
28
+ getArtikelByKatalognummer: (nummer: string) => Promise<ArtikelstammEintrag | undefined>;
29
+ };
30
+
31
+ export type NeherApp3ErfassungCache = {
32
+ getVarianten: () => Promise<Variante[]>;
33
+ getVariante: (variantenNameOderKuerzel: string) => Promise<Variante | undefined>;
34
+ getWertelisten: () => Promise<Werteliste[]>;
35
+ getWerteliste: (name: string) => Promise<Werteliste | undefined>;
36
+ getScripts: () => Promise<object[]>;
37
+ createUIMachine: (v: Variante) => void;
38
+ };
39
+
40
+ export type NeherApp3Props = {
41
+ api: import("./fluentApi.js").FluentApi;
42
+ authManager?: import("./fluentAuthManager.js").FluentAuthManager;
43
+ idas: import("./idasFluentApi.js").IDASFluentApi;
44
+ mainCssPath?: string;
45
+ };
46
+
47
+ export type NeherApp3MenuItem = {
48
+ id?: string;
49
+ selected?: boolean;
50
+ icon?: string;
51
+ url?: string | null;
52
+ text: string;
53
+ parent?: string | null;
54
+ hidden?: boolean;
55
+ };
56
+
57
+ export type NeherApp3SetupContext = NeherApp3Props & { neherapp3: NeherApp3 };
58
+
59
+ export type NeherApp3Module = {
60
+ moduleName: string;
61
+ setup?: (context: NeherApp3SetupContext) => void | Promise<void>;
62
+ mount?: (node: HTMLElement, props: NeherApp3SetupContext) => void | Function;
63
+ embedUrl?: string;
64
+ extraCSS?: string[];
65
+ useShadowDom?: boolean;
66
+ };
67
+
68
+ export type NeherApp3ApiCollection = {
69
+ idas?: import("./idasFluentApi.js").IDASFluentApi;
70
+ hostingEnvironment?: import("./fluentApi.js").FluentApi;
71
+ };
72
+
73
+ export type NeherApp3CacheCollection = {
74
+ artikelstamm: NeherApp3ArtikelstammCache;
75
+ erfassung: NeherApp3ErfassungCache;
76
+ };
77
+
78
+ export type NeherApp3 = {
79
+ addMenuItem: (menuItem: NeherApp3MenuItem) => void;
80
+ addApp: (appModule: NeherApp3Module | string) => Promise<void>;
81
+ notify: (message: string, type?: NeherApp3NotifyType, cb?: Function) => void;
82
+ api: NeherApp3ApiCollection;
83
+ cache: NeherApp3CacheCollection;
84
+ };
85
+
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Auto-generated NeherApp3 root type definitions.
3
+ * Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs
4
+ */
5
+
6
+ /** @typedef {import("./fluentApi.js").FluentApi} FluentApi */
7
+ /** @typedef {import("./idasFluentApi.js").IDASFluentApi} IDASFluentApi */
8
+ /** @typedef {import("./fluentAuthManager.js").FluentAuthManager} FluentAuthManager */
9
+
10
+ /**
11
+ * @typedef {0 | 1 | 2} NeherApp3NotifyType
12
+ */
13
+
14
+ /**
15
+ * @typedef {Object} ArtikelstammEintrag
16
+ * @property {string} [KatalogArtikelGuid]
17
+ * @property {string} [KatalogNummer]
18
+ * @property {string} [Katalognummer]
19
+ * @property {string} [Nummer]
20
+ */
21
+
22
+ /**
23
+ * @typedef {Object} Variante
24
+ * @property {string} [VarianteGuid]
25
+ * @property {string} [Name]
26
+ * @property {string} [Kuerzel]
27
+ */
28
+
29
+ /**
30
+ * @typedef {Object} Werteliste
31
+ * @property {string} [WerteListeGuid]
32
+ * @property {string} [Name]
33
+ */
34
+
35
+ /**
36
+ * @typedef {Object} NeherApp3ArtikelstammCache
37
+ * @property {() => Promise<ArtikelstammEintrag[]>} getArtikelStamm
38
+ * @property {() => Promise<Object[]>} getWarenGruppen
39
+ * @property {(guid: string) => Promise<ArtikelstammEintrag | undefined>} getArtikelByGuid
40
+ * @property {(nummer: string) => Promise<ArtikelstammEintrag | undefined>} getArtikelByKatalognummer
41
+ */
42
+
43
+ /**
44
+ * @typedef {Object} NeherApp3ErfassungCache
45
+ * @property {() => Promise<Variante[]>} getVarianten
46
+ * @property {(variantenNameOderKuerzel: string) => Promise<Variante | undefined>} getVariante
47
+ * @property {() => Promise<Werteliste[]>} getWertelisten
48
+ * @property {(name: string) => Promise<Werteliste | undefined>} getWerteliste
49
+ * @property {() => Promise<Object[]>} getScripts
50
+ * @property {(v: Variante) => void} createUIMachine
51
+ */
52
+
53
+ /**
54
+ * @typedef {Object} NeherApp3Props
55
+ * @property {import("./fluentApi.js").FluentApi} api
56
+ * @property {import("./fluentAuthManager.js").FluentAuthManager} [authManager]
57
+ * @property {import("./idasFluentApi.js").IDASFluentApi} idas
58
+ * @property {string} [mainCssPath]
59
+ */
60
+
61
+ /**
62
+ * @typedef {Object} NeherApp3MenuItem
63
+ * @property {string} [id] - Unique identifier for the menu item (auto-generated if not provided)
64
+ * @property {boolean} [selected] - Indicates if the menu item is currently selected (managed by the menu system)
65
+ * @property {string} [icon] - URL to an icon
66
+ * @property {string | null} [url] - Relative URL to use for routes
67
+ * @property {string} text - Display text
68
+ * @property {string | null} [parent] - Parent menu item (optional). If not set, the item will be added to the top level menu.
69
+ * @property {boolean} [hidden] - If true, the menu item will not be displayed
70
+ */
71
+
72
+ /**
73
+ * @typedef {NeherApp3Props & { neherapp3: NeherApp3 }} NeherApp3SetupContext
74
+ */
75
+
76
+ /**
77
+ * @typedef {Object} NeherApp3Module
78
+ * @property {string} moduleName
79
+ * @property {(context: NeherApp3SetupContext) => void | Promise<void>} [setup]
80
+ * @property {(node: HTMLElement, props: NeherApp3SetupContext) => void | function} [mount] - Must return an optional unmount function
81
+ * @property {string} [embedUrl]
82
+ * @property {string[]} [extraCSS]
83
+ * @property {boolean} [useShadowDom] - If true, the app will be embedded in a shadow DOM. This is required for CSS isolation.
84
+ */
85
+
86
+ /**
87
+ * @typedef {Object} NeherApp3ApiCollection
88
+ * @property {import("./idasFluentApi.js").IDASFluentApi} [idas]
89
+ * @property {import("./fluentApi.js").FluentApi} [hostingEnvironment]
90
+ */
91
+
92
+ /**
93
+ * @typedef {Object} NeherApp3CacheCollection
94
+ * @property {NeherApp3ArtikelstammCache} artikelstamm
95
+ * @property {NeherApp3ErfassungCache} erfassung
96
+ */
97
+
98
+ /**
99
+ * @typedef {Object} NeherApp3
100
+ * @property {(menuItem: NeherApp3MenuItem) => void} addMenuItem
101
+ * @property {(appModule: NeherApp3Module | string) => Promise<void>} addApp
102
+ * @property {(message: string, type?: NeherApp3NotifyType, cb?: function) => void} notify - Shows a notification. Type defaults to 0 (info). Callback is optional.
103
+ * @property {NeherApp3ApiCollection} api
104
+ * @property {NeherApp3CacheCollection} cache
105
+ */
106
+
107
+ export {};
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from "./index.js";
3
3
  export type AblageApi = import("./api/business/ablageApi.js").AblageApi;
4
4
  export type AnpassungApi = import("./api/business/anpassungApi.js").AnpassungApi;
5
5
  export type ArtikelApi = import("./api/business/artikelApi.js").ArtikelApi;
6
- export type ArtikelstammEintrag = import("./index.js").ArtikelstammEintrag;
6
+ export type ArtikelstammEintrag = import("./api/neherApp3Types").ArtikelstammEintrag;
7
7
  export type AuthApi = import("./api/business/authApi.js").AuthApi;
8
8
  export type AvApi = import("./api/business/avApi.js").AvApi;
9
9
  export type BelegApi = import("./api/business/belegApi.js").BelegApi;
@@ -28,16 +28,16 @@ export type MailApi = import("./api/business/mailApi.js").MailApi;
28
28
  export type MandantApi = import("./api/business/mandantApi.js").MandantApi;
29
29
  export type MaterialApi = import("./api/business/materialApi.js").MaterialApi;
30
30
  export type MaterialDTO = import("./api/business/materialApi.js").MaterialDTO;
31
- export type NeherApp3 = import("./index.js").NeherApp3;
32
- export type NeherApp3ApiCollection = import("./index.js").NeherApp3ApiCollection;
33
- export type NeherApp3ArtikelstammCache = import("./index.js").NeherApp3ArtikelstammCache;
34
- export type NeherApp3CacheCollection = import("./index.js").NeherApp3CacheCollection;
35
- export type NeherApp3ErfassungCache = import("./index.js").NeherApp3ErfassungCache;
36
- export type NeherApp3MenuItem = import("./index.js").NeherApp3MenuItem;
37
- export type NeherApp3Module = import("./index.js").NeherApp3Module;
38
- export type NeherApp3NotifyType = import("./index.js").NeherApp3NotifyType;
39
- export type NeherApp3Props = import("./index.js").NeherApp3Props;
40
- export type NeherApp3SetupContext = import("./index.js").NeherApp3SetupContext;
31
+ export type NeherApp3 = import("./api/neherApp3Types").NeherApp3;
32
+ export type NeherApp3ApiCollection = import("./api/neherApp3Types").NeherApp3ApiCollection;
33
+ export type NeherApp3ArtikelstammCache = import("./api/neherApp3Types").NeherApp3ArtikelstammCache;
34
+ export type NeherApp3CacheCollection = import("./api/neherApp3Types").NeherApp3CacheCollection;
35
+ export type NeherApp3ErfassungCache = import("./api/neherApp3Types").NeherApp3ErfassungCache;
36
+ export type NeherApp3MenuItem = import("./api/neherApp3Types").NeherApp3MenuItem;
37
+ export type NeherApp3Module = import("./api/neherApp3Types").NeherApp3Module;
38
+ export type NeherApp3NotifyType = import("./api/neherApp3Types").NeherApp3NotifyType;
39
+ export type NeherApp3Props = import("./api/neherApp3Types").NeherApp3Props;
40
+ export type NeherApp3SetupContext = import("./api/neherApp3Types").NeherApp3SetupContext;
41
41
  export type PrintApi = import("./api/business/printApi.js").PrintApi;
42
42
  export type ProduktionApi = import("./api/business/produktionApi.js").ProduktionApi;
43
43
  export type RechnungApi = import("./api/business/rechnungApi.js").RechnungApi;
@@ -47,9 +47,9 @@ export type SettingsApi = import("./api/business/settingsApi.js").SettingsApi;
47
47
  export type SystemApi = import("./api/business/systemApi.js").SystemApi;
48
48
  export type UiApi = import("./api/business/uiApi.js").UiApi;
49
49
  export type UtilityApi = import("./api/business/utilityApi.js").UtilityApi;
50
- export type Variante = import("./index.js").Variante;
50
+ export type Variante = import("./api/neherApp3Types").Variante;
51
51
  export type VorgangApi = import("./api/business/vorgangApi.js").VorgangApi;
52
- export type Werteliste = import("./index.js").Werteliste;
52
+ export type Werteliste = import("./api/neherApp3Types").Werteliste;
53
53
  export type ApiVersionDTO = import("./api/dtos/index.js").ApiVersionDTO;
54
54
  export type ChangeDTO = import("./api/dtos/index.js").ChangeDTO;
55
55
  export type ChangeInfoDTO = import("./api/dtos/index.js").ChangeInfoDTO;
package/index.js CHANGED
@@ -266,103 +266,19 @@ export * from "./ui/index.js";
266
266
  * @typedef {import("./api/fluentApi").FluentApi} FluentApi
267
267
  * @typedef {import("./api/idasFluentApi").IDASFluentApi} IDASFluentApi
268
268
  * @typedef {import("./api/fluentAuthManager").FluentAuthManager} FluentAuthManager
269
- */
270
-
271
- /**
272
- * @typedef {0 | 1 | 2} NeherApp3NotifyType
273
- */
274
-
275
- /**
276
- * @typedef {Object} ArtikelstammEintrag
277
- * @property {string} [KatalogArtikelGuid]
278
- * @property {string} [KatalogNummer]
279
- * @property {string} [Katalognummer]
280
- * @property {string} [Nummer]
281
- */
282
-
283
- /**
284
- * @typedef {Object} Variante
285
- * @property {string} [VarianteGuid]
286
- * @property {string} [Name]
287
- * @property {string} [Kuerzel]
288
- */
289
-
290
- /**
291
- * @typedef {Object} Werteliste
292
- * @property {string} [WerteListeGuid]
293
- * @property {string} [Name]
294
- */
295
-
296
- /**
297
- * @typedef {Object} NeherApp3ArtikelstammCache
298
- * @property {() => Promise<ArtikelstammEintrag[]>} getArtikelStamm
299
- * @property {() => Promise<Object[]>} getWarenGruppen
300
- * @property {(guid: string) => Promise<ArtikelstammEintrag | undefined>} getArtikelByGuid
301
- * @property {(nummer: string) => Promise<ArtikelstammEintrag | undefined>} getArtikelByKatalognummer
302
- */
303
-
304
- /**
305
- * @typedef {Object} NeherApp3ErfassungCache
306
- * @property {() => Promise<Variante[]>} getVarianten
307
- * @property {(variantenNameOderKuerzel: string) => Promise<Variante | undefined>} getVariante
308
- * @property {() => Promise<Werteliste[]>} getWertelisten
309
- * @property {(name: string) => Promise<Werteliste | undefined>} getWerteliste
310
- * @property {() => Promise<Object[]>} getScripts
311
- * @property {(v: Variante) => void} createUIMachine
312
- */
313
-
314
- /**
315
- * @typedef {Object} NeherApp3Props
316
- * @property {FluentApi} api
317
- * @property {FluentAuthManager} [authManager]
318
- * @property {IDASFluentApi} idas
319
- * @property {string} [mainCssPath]
320
- */
321
-
322
- /**
323
- * @typedef {Object} NeherApp3MenuItem
324
- * @property {string} [id] - Unique identifier for the menu item (auto-generated if not provided)
325
- * @property {boolean} [selected] - Indicates if the menu item is currently selected (managed by the menu system)
326
- * @property {string} [icon] - URL to an icon
327
- * @property {string|null} [url] - Relative URL to use for routes
328
- * @property {string} text - Display text
329
- * @property {string|null} [parent] - Parent menu item (optional). If not set, the item will be added to the top level menu.
330
- * @property {boolean} [hidden] - If true, the menu item will not be displayed
331
- */
332
-
333
- /**
334
- * @typedef {NeherApp3Props & { neherapp3: NeherApp3 }} NeherApp3SetupContext
335
- */
336
-
337
- /**
338
- * @typedef {Object} NeherApp3Module
339
- * @property {string} moduleName
340
- * @property {(context: NeherApp3SetupContext) => (void | Promise<void>)} [setup]
341
- * @property {(node: HTMLElement, props: NeherApp3SetupContext) => (void | function)} [mount] Must return an optional unmount function
342
- * @property {string} [embedUrl]
343
- * @property {string[]} [extraCSS]
344
- * @property {boolean} [useShadowDom] - If true, the app will be embedded in a shadow DOM. This is required for CSS isolation.
345
- */
346
-
347
- /**
348
- * @typedef {Object} NeherApp3ApiCollection
349
- * @property {IDASFluentApi} [idas]
350
- * @property {FluentApi} [hostingEnvironment]
351
- */
352
-
353
- /**
354
- * @typedef {Object} NeherApp3CacheCollection
355
- * @property {NeherApp3ArtikelstammCache} artikelstamm
356
- * @property {NeherApp3ErfassungCache} erfassung
357
- */
358
-
359
- /**
360
- * @typedef {Object} NeherApp3
361
- * @property {(menuItem: NeherApp3MenuItem) => void} addMenuItem
362
- * @property {(appModule: NeherApp3Module | string) => Promise<void>} addApp
363
- * @property {(message: string, type?: NeherApp3NotifyType, cb?: function) => void} notify - Shows a notification. Type defaults to 0 (info). Callback is optional.
364
- * @property {NeherApp3ApiCollection} api
365
- * @property {NeherApp3CacheCollection} cache
269
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3NotifyType} NeherApp3NotifyType
270
+ * @typedef {import("./api/neherApp3Types.js").ArtikelstammEintrag} ArtikelstammEintrag
271
+ * @typedef {import("./api/neherApp3Types.js").Variante} Variante
272
+ * @typedef {import("./api/neherApp3Types.js").Werteliste} Werteliste
273
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3ArtikelstammCache} NeherApp3ArtikelstammCache
274
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3ErfassungCache} NeherApp3ErfassungCache
275
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3Props} NeherApp3Props
276
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3MenuItem} NeherApp3MenuItem
277
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3SetupContext} NeherApp3SetupContext
278
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3Module} NeherApp3Module
279
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3ApiCollection} NeherApp3ApiCollection
280
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3CacheCollection} NeherApp3CacheCollection
281
+ * @typedef {import("./api/neherApp3Types.js").NeherApp3} NeherApp3
366
282
  */
367
283
 
368
284
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.5.22",
3
+ "version": "1.5.23",
4
4
  "description": "WebLibs for Gandalan JS/TS projects",
5
5
  "keywords": [
6
6
  "gandalan"
@@ -11,6 +11,8 @@ const rootDtsPath = path.join(rootDir, "index.d.ts");
11
11
  const dtoIndexPath = path.join(rootDir, "api", "dtos", "index.js");
12
12
  const businessIndexPath = path.join(rootDir, "api", "business", "index.js");
13
13
  const uiIndexPath = path.join(rootDir, "ui", "index.js");
14
+ const neherApp3TypesJsPath = path.join(rootDir, "api", "neherApp3Types.js");
15
+ const neherApp3TypesDtsPath = path.join(rootDir, "api", "neherApp3Types.d.ts");
14
16
 
15
17
  const dtoLeafDirectory = path.join(rootDir, "api", "dtos");
16
18
  const businessLeafDirectory = path.join(rootDir, "api", "business");
@@ -25,6 +27,193 @@ const businessRootMarkerEnd = "// END GENERATED ROOT BUSINESS TYPEDEFS";
25
27
 
26
28
  const simpleImportTypePattern = /^import\((?:"|').+(?:"|')\)\.[A-Za-z0-9_$]+$/;
27
29
 
30
+ const rawType = (js, ts = js) => ({ kind: "raw", js, ts });
31
+ const refType = (name) => rawType(name);
32
+ const importType = (importPath, name) => rawType(`import("${importPath}").${name}`);
33
+ const arrayType = (elementType) => ({ kind: "array", elementType });
34
+ const promiseType = (valueType) => ({ kind: "promise", valueType });
35
+ const unionType = (...types) => ({ kind: "union", types });
36
+ const intersectionType = (...types) => ({ kind: "intersection", types });
37
+ const functionType = (params, returnType) => ({ kind: "function", params, returnType });
38
+ const objectLiteralType = (properties) => ({ kind: "objectLiteral", properties });
39
+
40
+ const stringType = refType("string");
41
+ const booleanType = refType("boolean");
42
+ const voidType = refType("void");
43
+ const jsObjectType = rawType("Object", "object");
44
+ const jsFunctionType = rawType("function", "Function");
45
+
46
+ const neherApp3JsImports = [
47
+ { importPath: "./fluentApi.js", name: "FluentApi" },
48
+ { importPath: "./idasFluentApi.js", name: "IDASFluentApi" },
49
+ { importPath: "./fluentAuthManager.js", name: "FluentAuthManager" }
50
+ ];
51
+
52
+ const neherApp3TypeDefinitions = [
53
+ {
54
+ kind: "alias",
55
+ name: "NeherApp3NotifyType",
56
+ type: unionType(rawType("0"), rawType("1"), rawType("2"))
57
+ },
58
+ {
59
+ kind: "object",
60
+ name: "ArtikelstammEintrag",
61
+ properties: [
62
+ { name: "KatalogArtikelGuid", type: stringType, optional: true },
63
+ { name: "KatalogNummer", type: stringType, optional: true },
64
+ { name: "Katalognummer", type: stringType, optional: true },
65
+ { name: "Nummer", type: stringType, optional: true }
66
+ ]
67
+ },
68
+ {
69
+ kind: "object",
70
+ name: "Variante",
71
+ properties: [
72
+ { name: "VarianteGuid", type: stringType, optional: true },
73
+ { name: "Name", type: stringType, optional: true },
74
+ { name: "Kuerzel", type: stringType, optional: true }
75
+ ]
76
+ },
77
+ {
78
+ kind: "object",
79
+ name: "Werteliste",
80
+ properties: [
81
+ { name: "WerteListeGuid", type: stringType, optional: true },
82
+ { name: "Name", type: stringType, optional: true }
83
+ ]
84
+ },
85
+ {
86
+ kind: "object",
87
+ name: "NeherApp3ArtikelstammCache",
88
+ properties: [
89
+ { name: "getArtikelStamm", type: functionType([], promiseType(arrayType(refType("ArtikelstammEintrag")))) },
90
+ { name: "getWarenGruppen", type: functionType([], promiseType(arrayType(jsObjectType))) },
91
+ {
92
+ name: "getArtikelByGuid",
93
+ type: functionType([{ name: "guid", type: stringType }], promiseType(unionType(refType("ArtikelstammEintrag"), rawType("undefined"))))
94
+ },
95
+ {
96
+ name: "getArtikelByKatalognummer",
97
+ type: functionType([{ name: "nummer", type: stringType }], promiseType(unionType(refType("ArtikelstammEintrag"), rawType("undefined"))))
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ kind: "object",
103
+ name: "NeherApp3ErfassungCache",
104
+ properties: [
105
+ { name: "getVarianten", type: functionType([], promiseType(arrayType(refType("Variante")))) },
106
+ {
107
+ name: "getVariante",
108
+ type: functionType([{ name: "variantenNameOderKuerzel", type: stringType }], promiseType(unionType(refType("Variante"), rawType("undefined"))))
109
+ },
110
+ { name: "getWertelisten", type: functionType([], promiseType(arrayType(refType("Werteliste")))) },
111
+ {
112
+ name: "getWerteliste",
113
+ type: functionType([{ name: "name", type: stringType }], promiseType(unionType(refType("Werteliste"), rawType("undefined"))))
114
+ },
115
+ { name: "getScripts", type: functionType([], promiseType(arrayType(jsObjectType))) },
116
+ { name: "createUIMachine", type: functionType([{ name: "v", type: refType("Variante") }], voidType) }
117
+ ]
118
+ },
119
+ {
120
+ kind: "object",
121
+ name: "NeherApp3Props",
122
+ properties: [
123
+ { name: "api", type: importType("./fluentApi.js", "FluentApi") },
124
+ { name: "authManager", type: importType("./fluentAuthManager.js", "FluentAuthManager"), optional: true },
125
+ { name: "idas", type: importType("./idasFluentApi.js", "IDASFluentApi") },
126
+ { name: "mainCssPath", type: stringType, optional: true }
127
+ ]
128
+ },
129
+ {
130
+ kind: "object",
131
+ name: "NeherApp3MenuItem",
132
+ properties: [
133
+ { name: "id", type: stringType, optional: true, description: "Unique identifier for the menu item (auto-generated if not provided)" },
134
+ { name: "selected", type: booleanType, optional: true, description: "Indicates if the menu item is currently selected (managed by the menu system)" },
135
+ { name: "icon", type: stringType, optional: true, description: "URL to an icon" },
136
+ { name: "url", type: unionType(stringType, rawType("null")), optional: true, description: "Relative URL to use for routes" },
137
+ { name: "text", type: stringType, description: "Display text" },
138
+ { name: "parent", type: unionType(stringType, rawType("null")), optional: true, description: "Parent menu item (optional). If not set, the item will be added to the top level menu." },
139
+ { name: "hidden", type: booleanType, optional: true, description: "If true, the menu item will not be displayed" }
140
+ ]
141
+ },
142
+ {
143
+ kind: "alias",
144
+ name: "NeherApp3SetupContext",
145
+ type: intersectionType(
146
+ refType("NeherApp3Props"),
147
+ objectLiteralType([{ name: "neherapp3", type: refType("NeherApp3") }])
148
+ )
149
+ },
150
+ {
151
+ kind: "object",
152
+ name: "NeherApp3Module",
153
+ properties: [
154
+ { name: "moduleName", type: stringType },
155
+ {
156
+ name: "setup",
157
+ type: functionType([{ name: "context", type: refType("NeherApp3SetupContext") }], unionType(voidType, promiseType(voidType))),
158
+ optional: true
159
+ },
160
+ {
161
+ name: "mount",
162
+ type: functionType(
163
+ [
164
+ { name: "node", type: refType("HTMLElement") },
165
+ { name: "props", type: refType("NeherApp3SetupContext") }
166
+ ],
167
+ unionType(voidType, jsFunctionType)
168
+ ),
169
+ optional: true,
170
+ description: "Must return an optional unmount function"
171
+ },
172
+ { name: "embedUrl", type: stringType, optional: true },
173
+ { name: "extraCSS", type: arrayType(stringType), optional: true },
174
+ { name: "useShadowDom", type: booleanType, optional: true, description: "If true, the app will be embedded in a shadow DOM. This is required for CSS isolation." }
175
+ ]
176
+ },
177
+ {
178
+ kind: "object",
179
+ name: "NeherApp3ApiCollection",
180
+ properties: [
181
+ { name: "idas", type: importType("./idasFluentApi.js", "IDASFluentApi"), optional: true },
182
+ { name: "hostingEnvironment", type: importType("./fluentApi.js", "FluentApi"), optional: true }
183
+ ]
184
+ },
185
+ {
186
+ kind: "object",
187
+ name: "NeherApp3CacheCollection",
188
+ properties: [
189
+ { name: "artikelstamm", type: refType("NeherApp3ArtikelstammCache") },
190
+ { name: "erfassung", type: refType("NeherApp3ErfassungCache") }
191
+ ]
192
+ },
193
+ {
194
+ kind: "object",
195
+ name: "NeherApp3",
196
+ properties: [
197
+ { name: "addMenuItem", type: functionType([{ name: "menuItem", type: refType("NeherApp3MenuItem") }], voidType) },
198
+ { name: "addApp", type: functionType([{ name: "appModule", type: unionType(refType("NeherApp3Module"), stringType) }], promiseType(voidType)) },
199
+ {
200
+ name: "notify",
201
+ type: functionType(
202
+ [
203
+ { name: "message", type: stringType },
204
+ { name: "type", type: refType("NeherApp3NotifyType"), optional: true },
205
+ { name: "cb", type: jsFunctionType, optional: true }
206
+ ],
207
+ voidType
208
+ ),
209
+ description: "Shows a notification. Type defaults to 0 (info). Callback is optional."
210
+ },
211
+ { name: "api", type: refType("NeherApp3ApiCollection") },
212
+ { name: "cache", type: refType("NeherApp3CacheCollection") }
213
+ ]
214
+ }
215
+ ];
216
+
28
217
  async function collectFiles(directoryPath, allowedExtensions) {
29
218
  const entries = await readdir(directoryPath, { withFileTypes: true });
30
219
  const files = [];
@@ -54,10 +243,109 @@ function toRelativeImportPath(fromFilePath, targetFilePath) {
54
243
  return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
55
244
  }
56
245
 
246
+ function toRelativeDtsImportPath(fromFilePath, targetFilePath) {
247
+ const importPath = toRelativeImportPath(fromFilePath, targetFilePath);
248
+
249
+ if (targetFilePath === path.join(rootDir, "api", "neherApp3Types.js")) {
250
+ return importPath.replace(/\.js$/, "");
251
+ }
252
+
253
+ return importPath;
254
+ }
255
+
57
256
  function getJSDocBlocks(source) {
58
257
  return source.match(/\/\*\*[\s\S]*?\*\//g) ?? [];
59
258
  }
60
259
 
260
+ function renderTypeExpression(typeExpression, format) {
261
+ switch (typeExpression.kind) {
262
+ case "raw":
263
+ return format === "js" ? typeExpression.js : typeExpression.ts;
264
+ case "array":
265
+ return `${renderTypeExpression(typeExpression.elementType, format)}[]`;
266
+ case "promise":
267
+ return `Promise<${renderTypeExpression(typeExpression.valueType, format)}>`;
268
+ case "union":
269
+ return typeExpression.types.map((type) => renderTypeExpression(type, format)).join(" | ");
270
+ case "intersection":
271
+ return typeExpression.types.map((type) => renderTypeExpression(type, format)).join(" & ");
272
+ case "function":
273
+ return `(${typeExpression.params.map((param) => `${param.name}${param.optional ? "?" : ""}: ${renderTypeExpression(param.type, format)}`).join(", ")}) => ${renderTypeExpression(typeExpression.returnType, format)}`;
274
+ case "objectLiteral":
275
+ return `{ ${typeExpression.properties.map((property) => `${property.name}${property.optional ? "?" : ""}: ${renderTypeExpression(property.type, format)}`).join("; ")} }`;
276
+ default:
277
+ throw new Error(`Unsupported type expression kind: ${typeExpression.kind}`);
278
+ }
279
+ }
280
+
281
+ function buildNeherApp3TypesJsSource() {
282
+ const lines = [
283
+ "/**",
284
+ " * Auto-generated NeherApp3 root type definitions.",
285
+ " * Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs",
286
+ " */",
287
+ ""
288
+ ];
289
+
290
+ for (const jsImport of neherApp3JsImports) {
291
+ lines.push(`/** @typedef {import("${jsImport.importPath}").${jsImport.name}} ${jsImport.name} */`);
292
+ }
293
+
294
+ lines.push("");
295
+
296
+ for (const definition of neherApp3TypeDefinitions) {
297
+ if (definition.kind === "alias") {
298
+ lines.push("/**");
299
+ lines.push(` * @typedef {${renderTypeExpression(definition.type, "js")}} ${definition.name}`);
300
+ lines.push(" */");
301
+ lines.push("");
302
+ continue;
303
+ }
304
+
305
+ lines.push("/**");
306
+ lines.push(` * @typedef {Object} ${definition.name}`);
307
+
308
+ for (const property of definition.properties) {
309
+ const propertyName = property.optional ? `[${property.name}]` : property.name;
310
+ const propertyLine = ` * @property {${renderTypeExpression(property.type, "js")}} ${propertyName}`;
311
+ lines.push(property.description ? `${propertyLine} - ${property.description}` : propertyLine);
312
+ }
313
+
314
+ lines.push(" */");
315
+ lines.push("");
316
+ }
317
+
318
+ lines.push("export {};");
319
+ return `${lines.join("\n")}\n`;
320
+ }
321
+
322
+ function buildNeherApp3TypesDtsSource() {
323
+ const lines = [
324
+ "// Auto-generated NeherApp3 root type definitions.",
325
+ "// Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs",
326
+ ""
327
+ ];
328
+
329
+ for (const definition of neherApp3TypeDefinitions) {
330
+ if (definition.kind === "alias") {
331
+ lines.push(`export type ${definition.name} = ${renderTypeExpression(definition.type, "ts")};`);
332
+ lines.push("");
333
+ continue;
334
+ }
335
+
336
+ lines.push(`export type ${definition.name} = {`);
337
+
338
+ for (const property of definition.properties) {
339
+ lines.push(` ${property.name}${property.optional ? "?" : ""}: ${renderTypeExpression(property.type, "ts")};`);
340
+ }
341
+
342
+ lines.push("};");
343
+ lines.push("");
344
+ }
345
+
346
+ return `${lines.join("\n")}\n`;
347
+ }
348
+
61
349
  function normalizeJSDocBlock(block) {
62
350
  return block
63
351
  .replace(/^\/\*\*/, "")
@@ -401,7 +689,8 @@ function buildRootDts(dtoAliases, sourceByFilePath, allJsFilesByDirectory) {
401
689
  }
402
690
 
403
691
  const relativeImportPath = `./${toPosixRelativePath(entry.filePath)}`;
404
- lines.push(`export type ${entry.name} = import("${relativeImportPath}").${entry.name};`);
692
+ const dtsImportPath = toRelativeDtsImportPath(rootDtsPath, entry.filePath);
693
+ lines.push(`export type ${entry.name} = import("${dtsImportPath}").${entry.name};`);
405
694
  }
406
695
 
407
696
  for (const alias of dtoAliases) {
@@ -440,14 +729,19 @@ const businessAliases = buildBusinessAliases(businessLeafFiles, sourceByFilePath
440
729
  const generatedDtoIndexSource = buildDtoIndexSource(dtoAliases);
441
730
  const generatedBusinessIndexSource = buildBusinessIndexSource(businessAliases);
442
731
  const generatedUiIndexSource = buildUiIndexSource(uiLeafFiles, sourceByFilePath);
732
+ const generatedNeherApp3TypesJsSource = buildNeherApp3TypesJsSource();
733
+ const generatedNeherApp3TypesDtsSource = buildNeherApp3TypesDtsSource();
443
734
 
444
735
  await writeFile(dtoIndexPath, generatedDtoIndexSource);
445
736
  await writeFile(businessIndexPath, generatedBusinessIndexSource);
446
737
  await writeFile(uiIndexPath, generatedUiIndexSource);
738
+ await writeFile(neherApp3TypesJsPath, generatedNeherApp3TypesJsSource);
739
+ await writeFile(neherApp3TypesDtsPath, generatedNeherApp3TypesDtsSource);
447
740
 
448
741
  sourceByFilePath.set(dtoIndexPath, generatedDtoIndexSource);
449
742
  sourceByFilePath.set(businessIndexPath, generatedBusinessIndexSource);
450
743
  sourceByFilePath.set(uiIndexPath, generatedUiIndexSource);
744
+ sourceByFilePath.set(neherApp3TypesJsPath, generatedNeherApp3TypesJsSource);
451
745
 
452
746
  const dtoRootBlock = buildRootAliasBlock(
453
747
  dtoRootMarkerStart,
@@ -485,5 +779,7 @@ await writeFile(rootDtsPath, generatedRootDts);
485
779
  console.log(`Updated ${toPosixRelativePath(dtoIndexPath)} with ${dtoAliases.length} generated DTO aliases.`);
486
780
  console.log(`Updated ${toPosixRelativePath(businessIndexPath)} with ${businessAliases.length} generated business API exports.`);
487
781
  console.log(`Updated ${toPosixRelativePath(uiIndexPath)} with ${uiLeafFiles.length} generated UI exports.`);
782
+ console.log(`Updated ${toPosixRelativePath(neherApp3TypesJsPath)} generated NeherApp3 JSDoc type exports.`);
783
+ console.log(`Updated ${toPosixRelativePath(neherApp3TypesDtsPath)} generated NeherApp3 declaration exports.`);
488
784
  console.log(`Updated ${toPosixRelativePath(rootIndexPath)} generated JSDoc alias blocks.`);
489
785
  console.log(`Wrote ${toPosixRelativePath(rootDtsPath)} with full package type exports.`);