@gandalan/weblibs 1.5.27 → 1.5.29
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 +170 -528
- package/api/neherApp3Types.js +1 -0
- package/index.d.ts +1 -6
- package/index.js +4 -23
- package/package.json +2 -2
- package/scripts/{generate-root-dto-typedefs.mjs → generate-dts.mjs} +2 -293
- package/api/neherApp3Types.d.ts +0 -85
package/api/neherApp3Types.js
CHANGED
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
* @property {(message: string, type?: NeherApp3NotifyType, cb?: function) => void} notify - Shows a notification. Type defaults to 0 (info). Callback is optional.
|
|
103
103
|
* @property {NeherApp3ApiCollection} api
|
|
104
104
|
* @property {NeherApp3CacheCollection} cache
|
|
105
|
+
* @property {boolean} isEmbedded - Indicates if the app is embedded inside i3
|
|
105
106
|
*/
|
|
106
107
|
|
|
107
108
|
export {};
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export * from "./index.js";
|
|
2
2
|
export { IDASFactory } from "./api/IDAS.js";
|
|
3
3
|
export { RESTClient } from "./api/RESTClient.js";
|
|
4
|
-
export { initIDAS } from "./api/authUtils.js";
|
|
5
|
-
export { createApi, fluentApi } from "./api/fluentApi.js";
|
|
6
|
-
export { createIDASApi, idasFluentApi } from "./api/idasFluentApi.js";
|
|
7
|
-
export { createAuthManager, fluentIdasAuthManager } from "./api/fluentAuthManager.js";
|
|
8
|
-
export { fetchEnvConfig } from "./api/fluentEnvUtils.js";
|
|
9
|
-
export { restClient } from "./api/fluentRestClient.js";
|
|
10
4
|
export function createApi(): FluentApi;
|
|
11
5
|
export function fluentApi(url: string, authManager: FluentAuthManager | null, serviceName: string): FluentApi;
|
|
12
6
|
export function createIDASApi(): IDASFluentApi;
|
|
@@ -1967,6 +1961,7 @@ export type NeherApp3 = {
|
|
|
1967
1961
|
notify: (message: string, type?: NeherApp3NotifyType, cb?: Function) => void;
|
|
1968
1962
|
api: NeherApp3ApiCollection;
|
|
1969
1963
|
cache: NeherApp3CacheCollection;
|
|
1964
|
+
isEmbedded: boolean;
|
|
1970
1965
|
};
|
|
1971
1966
|
|
|
1972
1967
|
export type NeherApp3ApiCollection = {
|
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export * from "./api/dtos/index.js";
|
|
|
18
18
|
|
|
19
19
|
// BEGIN GENERATED ROOT DTO TYPEDEFS
|
|
20
20
|
// DTO Type Definitions - copied to the package root for stable JSDoc imports
|
|
21
|
-
// This block is generated by scripts/generate-
|
|
21
|
+
// This block is generated by scripts/generate-dts.mjs from ./api/dtos/index.js
|
|
22
22
|
/** @typedef {import("./api/dtos/index.js").ApiVersionDTO} ApiVersionDTO */
|
|
23
23
|
/** @typedef {import("./api/dtos/index.js").ChangeDTO} ChangeDTO */
|
|
24
24
|
/** @typedef {import("./api/dtos/index.js").ChangeInfoDTO} ChangeInfoDTO */
|
|
@@ -232,7 +232,7 @@ export * from "./ui/index.js";
|
|
|
232
232
|
|
|
233
233
|
// BEGIN GENERATED ROOT BUSINESS TYPEDEFS
|
|
234
234
|
// Business API Type Definitions - copied to the package root for stable JSDoc imports
|
|
235
|
-
// This block is generated by scripts/generate-
|
|
235
|
+
// This block is generated by scripts/generate-dts.mjs from ./api/business/index.js
|
|
236
236
|
/** @typedef {import("./api/business/index.js").AblageApi} AblageApi */
|
|
237
237
|
/** @typedef {import("./api/business/index.js").AnpassungApi} AnpassungApi */
|
|
238
238
|
/** @typedef {import("./api/business/index.js").ArtikelApi} ArtikelApi */
|
|
@@ -262,29 +262,10 @@ export * from "./ui/index.js";
|
|
|
262
262
|
/** @typedef {import("./api/business/index.js").VorgangApi} VorgangApi */
|
|
263
263
|
// END GENERATED ROOT BUSINESS TYPEDEFS
|
|
264
264
|
|
|
265
|
-
/**
|
|
266
|
-
* @typedef {import("./api/fluentApi").FluentApi} FluentApi
|
|
267
|
-
* @typedef {import("./api/idasFluentApi").IDASFluentApi} IDASFluentApi
|
|
268
|
-
* @typedef {import("./api/fluentAuthManager").FluentAuthManager} FluentAuthManager
|
|
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
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
265
|
/**
|
|
285
266
|
* Global NeherApp3 instance
|
|
286
|
-
* @type {NeherApp3}
|
|
267
|
+
* @type {import("./api/neherApp3Types.js").NeherApp3}
|
|
287
268
|
* @global
|
|
288
269
|
*/
|
|
289
|
-
globalThis.neherapp3 = /** @type {NeherApp3} */ (globalThis.neherapp3 || {});
|
|
270
|
+
globalThis.neherapp3 = /** @type {import("./api/neherApp3Types.js").NeherApp3} */ (globalThis.neherapp3 || {});
|
|
290
271
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gandalan/weblibs",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.29",
|
|
4
4
|
"description": "WebLibs for Gandalan JS/TS projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gandalan"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"typings": "index.d.ts",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"generate:
|
|
18
|
+
"generate:dts": "node ./scripts/generate-dts.mjs",
|
|
19
19
|
"lint": "eslint .",
|
|
20
20
|
"lint:prod": "eslint .",
|
|
21
21
|
"lint:fix": "eslint . --fix"
|
|
@@ -11,8 +11,6 @@ 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");
|
|
16
14
|
|
|
17
15
|
const dtoLeafDirectory = path.join(rootDir, "api", "dtos");
|
|
18
16
|
const businessLeafDirectory = path.join(rootDir, "api", "business");
|
|
@@ -25,13 +23,7 @@ const businessRootMarkerEnd = "// END GENERATED ROOT BUSINESS TYPEDEFS";
|
|
|
25
23
|
|
|
26
24
|
const rootValueExportStatements = [
|
|
27
25
|
"export { IDASFactory } from \"./api/IDAS.js\";",
|
|
28
|
-
"export { RESTClient } from \"./api/RESTClient.js\";"
|
|
29
|
-
"export { initIDAS } from \"./api/authUtils.js\";",
|
|
30
|
-
"export { createApi, fluentApi } from \"./api/fluentApi.js\";",
|
|
31
|
-
"export { createIDASApi, idasFluentApi } from \"./api/idasFluentApi.js\";",
|
|
32
|
-
"export { createAuthManager, fluentIdasAuthManager } from \"./api/fluentAuthManager.js\";",
|
|
33
|
-
"export { fetchEnvConfig } from \"./api/fluentEnvUtils.js\";",
|
|
34
|
-
"export { restClient } from \"./api/fluentRestClient.js\";"
|
|
26
|
+
"export { RESTClient } from \"./api/RESTClient.js\";"
|
|
35
27
|
];
|
|
36
28
|
|
|
37
29
|
const rootFunctionDeclarationStatements = [
|
|
@@ -49,193 +41,6 @@ const rootFunctionDeclarationStatements = [
|
|
|
49
41
|
const simpleImportTypePattern = /^import\((?:"|').+(?:"|')\)\.[A-Za-z0-9_$]+$/;
|
|
50
42
|
const returnTypeOfCreateApiPattern = /^ReturnType<\s*typeof\s+(create[A-Za-z0-9_$]+Api)\s*>$/;
|
|
51
43
|
|
|
52
|
-
const rawType = (js, ts = js) => ({ kind: "raw", js, ts });
|
|
53
|
-
const refType = (name) => rawType(name);
|
|
54
|
-
const importType = (importPath, name) => rawType(`import("${importPath}").${name}`);
|
|
55
|
-
const arrayType = (elementType) => ({ kind: "array", elementType });
|
|
56
|
-
const promiseType = (valueType) => ({ kind: "promise", valueType });
|
|
57
|
-
const unionType = (...types) => ({ kind: "union", types });
|
|
58
|
-
const intersectionType = (...types) => ({ kind: "intersection", types });
|
|
59
|
-
const functionType = (params, returnType) => ({ kind: "function", params, returnType });
|
|
60
|
-
const objectLiteralType = (properties) => ({ kind: "objectLiteral", properties });
|
|
61
|
-
|
|
62
|
-
const stringType = refType("string");
|
|
63
|
-
const booleanType = refType("boolean");
|
|
64
|
-
const voidType = refType("void");
|
|
65
|
-
const jsObjectType = rawType("Object", "object");
|
|
66
|
-
const jsFunctionType = rawType("function", "Function");
|
|
67
|
-
|
|
68
|
-
const neherApp3JsImports = [
|
|
69
|
-
{ importPath: "./fluentApi.js", name: "FluentApi" },
|
|
70
|
-
{ importPath: "./idasFluentApi.js", name: "IDASFluentApi" },
|
|
71
|
-
{ importPath: "./fluentAuthManager.js", name: "FluentAuthManager" }
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
const neherApp3TypeDefinitions = [
|
|
75
|
-
{
|
|
76
|
-
kind: "alias",
|
|
77
|
-
name: "NeherApp3NotifyType",
|
|
78
|
-
type: unionType(rawType("0"), rawType("1"), rawType("2"))
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
kind: "object",
|
|
82
|
-
name: "ArtikelstammEintrag",
|
|
83
|
-
properties: [
|
|
84
|
-
{ name: "KatalogArtikelGuid", type: stringType, optional: true },
|
|
85
|
-
{ name: "KatalogNummer", type: stringType, optional: true },
|
|
86
|
-
{ name: "Katalognummer", type: stringType, optional: true },
|
|
87
|
-
{ name: "Nummer", type: stringType, optional: true }
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
kind: "object",
|
|
92
|
-
name: "Variante",
|
|
93
|
-
properties: [
|
|
94
|
-
{ name: "VarianteGuid", type: stringType, optional: true },
|
|
95
|
-
{ name: "Name", type: stringType, optional: true },
|
|
96
|
-
{ name: "Kuerzel", type: stringType, optional: true }
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
kind: "object",
|
|
101
|
-
name: "Werteliste",
|
|
102
|
-
properties: [
|
|
103
|
-
{ name: "WerteListeGuid", type: stringType, optional: true },
|
|
104
|
-
{ name: "Name", type: stringType, optional: true }
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
kind: "object",
|
|
109
|
-
name: "NeherApp3ArtikelstammCache",
|
|
110
|
-
properties: [
|
|
111
|
-
{ name: "getArtikelStamm", type: functionType([], promiseType(arrayType(refType("ArtikelstammEintrag")))) },
|
|
112
|
-
{ name: "getWarenGruppen", type: functionType([], promiseType(arrayType(jsObjectType))) },
|
|
113
|
-
{
|
|
114
|
-
name: "getArtikelByGuid",
|
|
115
|
-
type: functionType([{ name: "guid", type: stringType }], promiseType(unionType(refType("ArtikelstammEintrag"), rawType("undefined"))))
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "getArtikelByKatalognummer",
|
|
119
|
-
type: functionType([{ name: "nummer", type: stringType }], promiseType(unionType(refType("ArtikelstammEintrag"), rawType("undefined"))))
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
kind: "object",
|
|
125
|
-
name: "NeherApp3ErfassungCache",
|
|
126
|
-
properties: [
|
|
127
|
-
{ name: "getVarianten", type: functionType([], promiseType(arrayType(refType("Variante")))) },
|
|
128
|
-
{
|
|
129
|
-
name: "getVariante",
|
|
130
|
-
type: functionType([{ name: "variantenNameOderKuerzel", type: stringType }], promiseType(unionType(refType("Variante"), rawType("undefined"))))
|
|
131
|
-
},
|
|
132
|
-
{ name: "getWertelisten", type: functionType([], promiseType(arrayType(refType("Werteliste")))) },
|
|
133
|
-
{
|
|
134
|
-
name: "getWerteliste",
|
|
135
|
-
type: functionType([{ name: "name", type: stringType }], promiseType(unionType(refType("Werteliste"), rawType("undefined"))))
|
|
136
|
-
},
|
|
137
|
-
{ name: "getScripts", type: functionType([], promiseType(arrayType(jsObjectType))) },
|
|
138
|
-
{ name: "createUIMachine", type: functionType([{ name: "v", type: refType("Variante") }], voidType) }
|
|
139
|
-
]
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
kind: "object",
|
|
143
|
-
name: "NeherApp3Props",
|
|
144
|
-
properties: [
|
|
145
|
-
{ name: "api", type: importType("./fluentApi.js", "FluentApi") },
|
|
146
|
-
{ name: "authManager", type: importType("./fluentAuthManager.js", "FluentAuthManager"), optional: true },
|
|
147
|
-
{ name: "idas", type: importType("./idasFluentApi.js", "IDASFluentApi") },
|
|
148
|
-
{ name: "mainCssPath", type: stringType, optional: true }
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
kind: "object",
|
|
153
|
-
name: "NeherApp3MenuItem",
|
|
154
|
-
properties: [
|
|
155
|
-
{ name: "id", type: stringType, optional: true, description: "Unique identifier for the menu item (auto-generated if not provided)" },
|
|
156
|
-
{ name: "selected", type: booleanType, optional: true, description: "Indicates if the menu item is currently selected (managed by the menu system)" },
|
|
157
|
-
{ name: "icon", type: stringType, optional: true, description: "URL to an icon" },
|
|
158
|
-
{ name: "url", type: unionType(stringType, rawType("null")), optional: true, description: "Relative URL to use for routes" },
|
|
159
|
-
{ name: "text", type: stringType, description: "Display text" },
|
|
160
|
-
{ 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." },
|
|
161
|
-
{ name: "hidden", type: booleanType, optional: true, description: "If true, the menu item will not be displayed" }
|
|
162
|
-
]
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
kind: "alias",
|
|
166
|
-
name: "NeherApp3SetupContext",
|
|
167
|
-
type: intersectionType(
|
|
168
|
-
refType("NeherApp3Props"),
|
|
169
|
-
objectLiteralType([{ name: "neherapp3", type: refType("NeherApp3") }])
|
|
170
|
-
)
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
kind: "object",
|
|
174
|
-
name: "NeherApp3Module",
|
|
175
|
-
properties: [
|
|
176
|
-
{ name: "moduleName", type: stringType },
|
|
177
|
-
{
|
|
178
|
-
name: "setup",
|
|
179
|
-
type: functionType([{ name: "context", type: refType("NeherApp3SetupContext") }], unionType(voidType, promiseType(voidType))),
|
|
180
|
-
optional: true
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "mount",
|
|
184
|
-
type: functionType(
|
|
185
|
-
[
|
|
186
|
-
{ name: "node", type: refType("HTMLElement") },
|
|
187
|
-
{ name: "props", type: refType("NeherApp3SetupContext") }
|
|
188
|
-
],
|
|
189
|
-
unionType(voidType, jsFunctionType)
|
|
190
|
-
),
|
|
191
|
-
optional: true,
|
|
192
|
-
description: "Must return an optional unmount function"
|
|
193
|
-
},
|
|
194
|
-
{ name: "embedUrl", type: stringType, optional: true },
|
|
195
|
-
{ name: "extraCSS", type: arrayType(stringType), optional: true },
|
|
196
|
-
{ name: "useShadowDom", type: booleanType, optional: true, description: "If true, the app will be embedded in a shadow DOM. This is required for CSS isolation." }
|
|
197
|
-
]
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
kind: "object",
|
|
201
|
-
name: "NeherApp3ApiCollection",
|
|
202
|
-
properties: [
|
|
203
|
-
{ name: "idas", type: importType("./idasFluentApi.js", "IDASFluentApi"), optional: true },
|
|
204
|
-
{ name: "hostingEnvironment", type: importType("./fluentApi.js", "FluentApi"), optional: true }
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
kind: "object",
|
|
209
|
-
name: "NeherApp3CacheCollection",
|
|
210
|
-
properties: [
|
|
211
|
-
{ name: "artikelstamm", type: refType("NeherApp3ArtikelstammCache") },
|
|
212
|
-
{ name: "erfassung", type: refType("NeherApp3ErfassungCache") }
|
|
213
|
-
]
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
kind: "object",
|
|
217
|
-
name: "NeherApp3",
|
|
218
|
-
properties: [
|
|
219
|
-
{ name: "addMenuItem", type: functionType([{ name: "menuItem", type: refType("NeherApp3MenuItem") }], voidType) },
|
|
220
|
-
{ name: "addApp", type: functionType([{ name: "appModule", type: unionType(refType("NeherApp3Module"), stringType) }], promiseType(voidType)) },
|
|
221
|
-
{
|
|
222
|
-
name: "notify",
|
|
223
|
-
type: functionType(
|
|
224
|
-
[
|
|
225
|
-
{ name: "message", type: stringType },
|
|
226
|
-
{ name: "type", type: refType("NeherApp3NotifyType"), optional: true },
|
|
227
|
-
{ name: "cb", type: jsFunctionType, optional: true }
|
|
228
|
-
],
|
|
229
|
-
voidType
|
|
230
|
-
),
|
|
231
|
-
description: "Shows a notification. Type defaults to 0 (info). Callback is optional."
|
|
232
|
-
},
|
|
233
|
-
{ name: "api", type: refType("NeherApp3ApiCollection") },
|
|
234
|
-
{ name: "cache", type: refType("NeherApp3CacheCollection") }
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
];
|
|
238
|
-
|
|
239
44
|
async function collectFiles(directoryPath, allowedExtensions) {
|
|
240
45
|
const entries = await readdir(directoryPath, { withFileTypes: true });
|
|
241
46
|
const files = [];
|
|
@@ -269,95 +74,6 @@ function getJSDocBlocks(source) {
|
|
|
269
74
|
return source.match(/\/\*\*[\s\S]*?\*\//g) ?? [];
|
|
270
75
|
}
|
|
271
76
|
|
|
272
|
-
function renderTypeExpression(typeExpression, format) {
|
|
273
|
-
switch (typeExpression.kind) {
|
|
274
|
-
case "raw":
|
|
275
|
-
return format === "js" ? typeExpression.js : typeExpression.ts;
|
|
276
|
-
case "array":
|
|
277
|
-
return `${renderTypeExpression(typeExpression.elementType, format)}[]`;
|
|
278
|
-
case "promise":
|
|
279
|
-
return `Promise<${renderTypeExpression(typeExpression.valueType, format)}>`;
|
|
280
|
-
case "union":
|
|
281
|
-
return typeExpression.types.map((type) => renderTypeExpression(type, format)).join(" | ");
|
|
282
|
-
case "intersection":
|
|
283
|
-
return typeExpression.types.map((type) => renderTypeExpression(type, format)).join(" & ");
|
|
284
|
-
case "function":
|
|
285
|
-
return `(${typeExpression.params.map((param) => `${param.name}${param.optional ? "?" : ""}: ${renderTypeExpression(param.type, format)}`).join(", ")}) => ${renderTypeExpression(typeExpression.returnType, format)}`;
|
|
286
|
-
case "objectLiteral":
|
|
287
|
-
return `{ ${typeExpression.properties.map((property) => `${property.name}${property.optional ? "?" : ""}: ${renderTypeExpression(property.type, format)}`).join("; ")} }`;
|
|
288
|
-
default:
|
|
289
|
-
throw new Error(`Unsupported type expression kind: ${typeExpression.kind}`);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function buildNeherApp3TypesJsSource() {
|
|
294
|
-
const lines = [
|
|
295
|
-
"/**",
|
|
296
|
-
" * Auto-generated NeherApp3 root type definitions.",
|
|
297
|
-
" * Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs",
|
|
298
|
-
" */",
|
|
299
|
-
""
|
|
300
|
-
];
|
|
301
|
-
|
|
302
|
-
for (const jsImport of neherApp3JsImports) {
|
|
303
|
-
lines.push(`/** @typedef {import("${jsImport.importPath}").${jsImport.name}} ${jsImport.name} */`);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
lines.push("");
|
|
307
|
-
|
|
308
|
-
for (const definition of neherApp3TypeDefinitions) {
|
|
309
|
-
if (definition.kind === "alias") {
|
|
310
|
-
lines.push("/**");
|
|
311
|
-
lines.push(` * @typedef {${renderTypeExpression(definition.type, "js")}} ${definition.name}`);
|
|
312
|
-
lines.push(" */");
|
|
313
|
-
lines.push("");
|
|
314
|
-
continue;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
lines.push("/**");
|
|
318
|
-
lines.push(` * @typedef {Object} ${definition.name}`);
|
|
319
|
-
|
|
320
|
-
for (const property of definition.properties) {
|
|
321
|
-
const propertyName = property.optional ? `[${property.name}]` : property.name;
|
|
322
|
-
const propertyLine = ` * @property {${renderTypeExpression(property.type, "js")}} ${propertyName}`;
|
|
323
|
-
lines.push(property.description ? `${propertyLine} - ${property.description}` : propertyLine);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
lines.push(" */");
|
|
327
|
-
lines.push("");
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
lines.push("export {};");
|
|
331
|
-
return `${lines.join("\n")}\n`;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function buildNeherApp3TypesDtsSource() {
|
|
335
|
-
const lines = [
|
|
336
|
-
"// Auto-generated NeherApp3 root type definitions.",
|
|
337
|
-
"// Do not modify manually - changes will be overwritten by scripts/generate-root-dto-typedefs.mjs",
|
|
338
|
-
""
|
|
339
|
-
];
|
|
340
|
-
|
|
341
|
-
for (const definition of neherApp3TypeDefinitions) {
|
|
342
|
-
if (definition.kind === "alias") {
|
|
343
|
-
lines.push(`export type ${definition.name} = ${renderTypeExpression(definition.type, "ts")};`);
|
|
344
|
-
lines.push("");
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
lines.push(`export type ${definition.name} = {`);
|
|
349
|
-
|
|
350
|
-
for (const property of definition.properties) {
|
|
351
|
-
lines.push(` ${property.name}${property.optional ? "?" : ""}: ${renderTypeExpression(property.type, "ts")};`);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
lines.push("};");
|
|
355
|
-
lines.push("");
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return `${lines.join("\n")}\n`;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
77
|
function normalizeJSDocBlock(block) {
|
|
362
78
|
return block
|
|
363
79
|
.replace(/^\/\*\*/, "")
|
|
@@ -1485,7 +1201,7 @@ function buildRootAliasBlock(startMarker, endMarker, description, aliases, impor
|
|
|
1485
1201
|
const lines = [
|
|
1486
1202
|
startMarker,
|
|
1487
1203
|
description,
|
|
1488
|
-
`// This block is generated by scripts/generate-
|
|
1204
|
+
`// This block is generated by scripts/generate-dts.mjs from ${importPath}`,
|
|
1489
1205
|
...aliases.map((alias) => {
|
|
1490
1206
|
const name = nameSelector(alias);
|
|
1491
1207
|
return `/** @typedef {import("${importPath}").${name}} ${name} */`;
|
|
@@ -1558,19 +1274,14 @@ const publicTypeEntries = [
|
|
|
1558
1274
|
const generatedDtoIndexSource = buildDtoIndexSource(dtoAliases);
|
|
1559
1275
|
const generatedBusinessIndexSource = buildBusinessIndexSource(businessAliases);
|
|
1560
1276
|
const generatedUiIndexSource = buildUiIndexSource(uiLeafFiles, sourceByFilePath);
|
|
1561
|
-
const generatedNeherApp3TypesJsSource = buildNeherApp3TypesJsSource();
|
|
1562
|
-
const generatedNeherApp3TypesDtsSource = buildNeherApp3TypesDtsSource();
|
|
1563
1277
|
|
|
1564
1278
|
await writeFile(dtoIndexPath, generatedDtoIndexSource);
|
|
1565
1279
|
await writeFile(businessIndexPath, generatedBusinessIndexSource);
|
|
1566
1280
|
await writeFile(uiIndexPath, generatedUiIndexSource);
|
|
1567
|
-
await writeFile(neherApp3TypesJsPath, generatedNeherApp3TypesJsSource);
|
|
1568
|
-
await writeFile(neherApp3TypesDtsPath, generatedNeherApp3TypesDtsSource);
|
|
1569
1281
|
|
|
1570
1282
|
sourceByFilePath.set(dtoIndexPath, generatedDtoIndexSource);
|
|
1571
1283
|
sourceByFilePath.set(businessIndexPath, generatedBusinessIndexSource);
|
|
1572
1284
|
sourceByFilePath.set(uiIndexPath, generatedUiIndexSource);
|
|
1573
|
-
sourceByFilePath.set(neherApp3TypesJsPath, generatedNeherApp3TypesJsSource);
|
|
1574
1285
|
|
|
1575
1286
|
const dtoRootBlock = buildRootAliasBlock(
|
|
1576
1287
|
dtoRootMarkerStart,
|
|
@@ -1603,7 +1314,5 @@ await writeFile(rootDtsPath, generatedRootDts);
|
|
|
1603
1314
|
console.log(`Updated ${toPosixRelativePath(dtoIndexPath)} with ${dtoAliases.length} generated DTO aliases.`);
|
|
1604
1315
|
console.log(`Updated ${toPosixRelativePath(businessIndexPath)} with ${businessAliases.length} generated business API exports.`);
|
|
1605
1316
|
console.log(`Updated ${toPosixRelativePath(uiIndexPath)} with ${uiLeafFiles.length} generated UI exports.`);
|
|
1606
|
-
console.log(`Updated ${toPosixRelativePath(neherApp3TypesJsPath)} generated NeherApp3 JSDoc type exports.`);
|
|
1607
|
-
console.log(`Updated ${toPosixRelativePath(neherApp3TypesDtsPath)} generated NeherApp3 declaration exports.`);
|
|
1608
1317
|
console.log(`Updated ${toPosixRelativePath(rootIndexPath)} generated JSDoc alias blocks.`);
|
|
1609
1318
|
console.log(`Wrote ${toPosixRelativePath(rootDtsPath)} with full package type exports.`);
|
package/api/neherApp3Types.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
|