@gandalan/weblibs 1.5.24 → 1.5.26

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/index.d.ts CHANGED
@@ -1,6 +1,22 @@
1
1
  export * from "./index.js";
2
-
3
- export type AblageApi = ReturnType<typeof createAblageApi>;
2
+ export { IDASFactory } from "./api/IDAS.js";
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
+
11
+ export type AblageApi = {
12
+ get: (guid: string) => Promise<AblageDTO>;
13
+ getAll: (changedSince?: Date, includeDetails?: boolean) => Promise<AblageDTO[]>;
14
+ save: (dto: AblageDTO) => Promise<void>;
15
+ delete: (guid: string) => Promise<void>;
16
+ serienFachverteilung: (serieGuid: string) => Promise<FachzuordnungResultDTO>;
17
+ fachverteilung: (avGuids: string[]) => Promise<FachzuordnungResultDTO>;
18
+ fach: { get: (guid: string) => Promise<AblageFachDTO>; getAll: (changedSince?: Date, includeDetails?: boolean) => Promise<AblageFachDTO[]>; save: (dto: AblageFachDTO) => Promise<void>; delete: (guid: string) => Promise<void> };
19
+ };
4
20
 
5
21
  export type AblageDTO = {
6
22
  AblageGuid: string;
@@ -69,7 +85,13 @@ export type AdresseDTO = {
69
85
  AdditionalProperties: Record<string, PropertyValueCollection>;
70
86
  };
71
87
 
72
- export type AnpassungApi = ReturnType<typeof createAnpassungApi>;
88
+ export type AnpassungApi = {
89
+ getAll: () => Promise<AnpassungDTO[]>;
90
+ save: (dto: AnpassungDTO) => Promise<void>;
91
+ delete: (anpassungGuid: string) => Promise<void>;
92
+ runWebJob: () => Promise<void>;
93
+ vorlage: { getAll: () => Promise<AnpassungVorlageDTO[]>; get: (guid: string) => Promise<AnpassungVorlageDTO>; save: (dto: AnpassungVorlageDTO) => Promise<void>; delete: (guid: string) => Promise<void> };
94
+ };
73
95
 
74
96
  export type ApiVersionDTO = {
75
97
  Version: string;
@@ -84,7 +106,35 @@ export type AppActivationStatusDTO = {
84
106
  KundenMandantIstAktiv: boolean;
85
107
  };
86
108
 
87
- export type ArtikelApi = ReturnType<typeof createArtikelApi>;
109
+ export type ArtikelApi = {
110
+ getAll: (changedSince?: Date) => Promise<WarenGruppeDTO[]>;
111
+ saveArtikel: (artikel: KatalogArtikelDTO) => Promise<KatalogArtikelDTO>;
112
+ deleteArtikel: (artikel: KatalogArtikelDTO) => Promise<void>;
113
+ getAllIndiDaten: (changedSince?: Date) => Promise<KatalogArtikelIndiDatenDTO[]>;
114
+ saveArtikelIndiDaten: (daten: KatalogArtikelIndiDatenDTO) => Promise<void>;
115
+ deleteArtikelIndiDaten: (daten: KatalogArtikelIndiDatenDTO) => Promise<void>;
116
+ getAllWarenGruppen: () => Promise<WarenGruppeDTO[]>;
117
+ saveWarenGruppe: (dto: WarenGruppeDTO) => Promise<void>;
118
+ getAllProduktGruppen: (includeFamilien?: boolean) => Promise<ProduktGruppeDTO[]>;
119
+ saveProduktGruppe: (produktGruppe: ProduktGruppeDTO) => Promise<ProduktGruppeDTO>;
120
+ getAllProduktFamilien: (includeVarianten?: boolean) => Promise<ProduktFamilieDTO[]>;
121
+ saveProduktFamilie: (produktFamilie: ProduktFamilieDTO) => Promise<ProduktFamilieDTO>;
122
+ getAllKomponenten: () => Promise<KomponenteDTO[]>;
123
+ saveKomponente: (dto: KomponenteDTO) => Promise<void>;
124
+ getAllVarianten: () => Promise<VarianteDTO[]>;
125
+ getAllVariantenGuids: () => Promise<string[]>;
126
+ getAllVariantenChanges: (changedSince?: Date) => Promise<string[]>;
127
+ getVariante: (varianteGuid: string, includeUIDefs?: boolean, includeKonfigs?: boolean) => Promise<VarianteDTO>;
128
+ saveVariante: (variante: VarianteDTO) => Promise<VarianteDTO>;
129
+ cacheWebJob: () => Promise<void>;
130
+ getAllKonturen: () => Promise<KonturDTO[]>;
131
+ saveKontur: (dto: KonturDTO) => Promise<void>;
132
+ getAllSchnitte: () => Promise<SchnittDTO[]>;
133
+ saveSchnitt: (dto: SchnittDTO) => Promise<void>;
134
+ berechneSonderfarben: (belegGuid: string) => Promise<BelegDTO>;
135
+ getBenutzerVarianten: (benutzerGuid: string, mitSperrliste: boolean) => Promise<VarianteDTO[]>;
136
+ resetCacheVariantenListen: () => Promise<void>;
137
+ };
88
138
 
89
139
  export type ArtikelstammEintrag = {
90
140
  KatalogArtikelGuid?: string;
@@ -106,9 +156,58 @@ export type AufpreisAnpassungDTO = {
106
156
  Aufpreis: number;
107
157
  };
108
158
 
109
- export type AuthApi = ReturnType<typeof createAuthApi>;
110
-
111
- export type AvApi = ReturnType<typeof createAvApi>;
159
+ export type AuthApi = {
160
+ authenticate: (dto: LoginDTO) => Promise<string>;
161
+ authenticateForFunction: (email: string) => Promise<string>;
162
+ refreshToken: (token: string) => Promise<string>;
163
+ createServiceToken: (dto?: CreateServiceTokenRequestDTO) => Promise<string>;
164
+ removeExpiredTokens: () => Promise<void>;
165
+ getFremdAppAuthToken: (fremdApp: string) => Promise<UserAuthTokenDTO>;
166
+ };
167
+
168
+ export type AvApi = {
169
+ getAll: (includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
170
+ getAllChangedSince: (changedSince: Date, includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
171
+ getBySerie: (serieGuid: string, includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
172
+ getByVorgang: (vorgangGuid: string, includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
173
+ getByVorgangGuids: (vorgangGuids: string[], includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
174
+ getByBelegPosition: (belegpositionGuid: string) => Promise<BelegPositionAVDTO[]>;
175
+ getById: (avGuid: string) => Promise<BelegPositionAVDTO>;
176
+ getByPCode: (pcode: string, includeOriginalBeleg?: boolean, includeProdDaten?: boolean) => Promise<BelegPositionAVDTO[]>;
177
+ searchByPCode: (search: string) => Promise<BelegPositionAVDTO[]>;
178
+ save: (position: BelegPositionAVDTO) => Promise<void>;
179
+ saveList: (positionen: BelegPositionAVDTO[]) => Promise<BelegPositionAVDTO[]>;
180
+ saveToSerie: (serieGuid: string, positionGuids: string[]) => Promise<BelegPositionAVDTO[]>;
181
+ berechnen: (guids: string[]) => Promise<void>;
182
+ delete: (guid: string) => Promise<void>;
183
+ deleteList: (guids: string[]) => Promise<void>;
184
+ serienZuordnen: (belegGuid: string, positionSerieItems: PositionSerieItemDTO[]) => Promise<void>;
185
+ preProcess: (dto: BerechnungParameterDTO) => Promise<BerechnungParameterDTO>;
186
+ postProcess: (dto: BelegPositionAVDTO) => Promise<ProduktionsDatenDTO>;
187
+ reserviert: { getAll: () => Promise<AVReserviertItemDTO[]>; getBySerie: (serieGuid: string) => Promise<AVReserviertItemDTO[]> };
188
+ runAvBerechnung: (id: string, mandantId: number) => Promise<void>;
189
+ calculateItems: () => Promise<void>;
190
+ getCalculateItemList: () => Promise<MandantAndBelegPosGuidDTO[]>;
191
+ checkAvPositionCount: (belegPosGuid: string, mandantId: number) => Promise<string[]>;
192
+ avBerechnungCloudProcess: (parameter: BerechnungParameterDTO) => Promise<BerechnungParameterDTO>;
193
+ calculateAvPosition: (mandantId: number, avPosGuid: string) => Promise<void>;
194
+ putCalculationInfo: (calculationInfoDTO: CalculationInfoDTO) => Promise<CalculationInfoDTO>;
195
+ getCalculationInfo: (mandantId: number, belegPosGuid: string) => Promise<CalculationInfoDTO>;
196
+ getIncompleteCalculationInfos: () => Promise<CalculationInfoDTO[]>;
197
+ getInCalculationCount: () => Promise<number>;
198
+ calculateKapazitaetForFunction: (positionGuid: string, mandantID: number) => Promise<void>;
199
+ calculateKapazitaetForAv: (avPositionGuids: string[], mandantID: number) => Promise<void>;
200
+ calculateKapazitaetItems: () => Promise<void>;
201
+ getAvReportVorgaenge: (request: AvReportVorgangRequestDto) => Promise<AvReportVorgangDto[]>;
202
+ getSaegeDatenHistorie: (saegeDatenHistorieGuid: string, includeSaegeDatei?: boolean, includeMeldungen?: boolean) => Promise<SaegeDatenHistorieDTO>;
203
+ getSaegeDatenHistorieForSerie: (serieGuid: string, includeSaegeDatei?: boolean, includeMeldungen?: boolean) => Promise<SaegeDatenHistorieDTO[]>;
204
+ getSaegeDatenHistorieSince: (sinceWhen: Date, includeSaegeDatei?: boolean, includeMeldungen?: boolean) => Promise<SaegeDatenHistorieDTO[]>;
205
+ saveSaegeDatenHistorie: (dto: SaegeDatenHistorieDTO) => Promise<SaegeDatenResultDTO>;
206
+ saveSaegeDatenHistorieBulk: (dtos: SaegeDatenHistorieDTO[]) => Promise<void>;
207
+ getAllMaterialBearbeitungsMethoden: () => Promise<MaterialBearbeitungsMethodeDTO[]>;
208
+ saveMaterialBearbeitungsMethode: (dto: MaterialBearbeitungsMethodeDTO) => Promise<void>;
209
+ material: { serieBerechnen: (serieGuid: string) => Promise<void>; getForSerie: (serieGuid: string) => Promise<MaterialbedarfDTO[]>; getOffenerBedarfV2: (serieGuid: string, filterCsvExportedMaterial?: boolean) => Promise<MaterialbedarfDTO[]>; getOffenerBedarf: (serieGuid: string) => Promise<MaterialbedarfDTO[]>; resetForSerie: (serieGuid: string) => Promise<void>; berechnenForFunction: (serieGuid: string, mandantId: number) => Promise<string[]>; resetFromAvPosForFunction: (avPosGuid: string, mandantId: number) => Promise<string[]>; addOrUpdate: (dto: MaterialbedarfDTO) => Promise<SerienMaterialEditDTO>; delete: (materialbedarfGuid: string) => Promise<void> };
210
+ };
112
211
 
113
212
  export type AVReserviertItemDTO = {
114
213
  Variante: string;
@@ -228,7 +327,45 @@ export type BeleganschriftDTO = {
228
327
  AnzeigeName: string;
229
328
  };
230
329
 
231
- export type BelegApi = ReturnType<typeof createBelegApi>;
330
+ export type BelegApi = {
331
+ getBelegStatus: (belegGuid: string) => Promise<BelegStatusDTO>;
332
+ setBelegStatus: (belegGuid: string, statusCode: string, statusText?: string) => Promise<BelegStatusDTO>;
333
+ belegKopieren: (belegGuid: string, neueBelegArt: string, saldenKopieren?: boolean) => Promise<VorgangDTO>;
334
+ belegWechsel: (dto: BelegartWechselDTO) => Promise<VorgangDTO>;
335
+ belegLoeschen: (belegGuid: string) => Promise<VorgangDTO>;
336
+ ladeVorgangsListeByJahr: (jahr: number, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<VorgangListItemDTO[]>;
337
+ ladeVorgangsListeByStatus: (status: string, jahr: number, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<VorgangListItemDTO[]>;
338
+ ladeVorgangsListeByStatusAndDate: (status: string, jahr: number, changedSince: Date, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<VorgangListItemDTO[]>;
339
+ ladeVorgangsListe: (jahr: number, status: string, changedSince: Date, art?: string, includeArchive?: boolean, includeOthersData?: boolean, search?: string, includeASP?: boolean, includeAdditionalProperties?: boolean) => Promise<VorgangListItemDTO[]>;
340
+ ladeVorgangsListeByKunde: (kundeGuid: string) => Promise<VorgangListItemDTO[]>;
341
+ updateVorgangStatusTableForFunction: (dto: VorgangStatusTableDTO) => Promise<void>;
342
+ getNotCalculatedVorgangStatusTableForFunction: () => Promise<VorgangStatusTableDTO[]>;
343
+ vorgangReaktivieren: (dto: BelegartWechselDTO) => Promise<VorgangDTO>;
344
+ ladeLieferscheinListeByJahr: (jahr: number) => Promise<BaseListItemDTO[]>;
345
+ ladeLieferscheinListeByStatus: (status: string, jahr: number) => Promise<BaseListItemDTO[]>;
346
+ ladeLieferscheinListeByStatusAndDate: (status: string, jahr: number, changedSince: Date) => Promise<BaseListItemDTO[]>;
347
+ ladeLieferscheinListe: (jahr: number, status: string, changedSince: Date, art?: string, includeArchive?: boolean, includeOthersData?: boolean, search?: string) => Promise<BaseListItemDTO[]>;
348
+ getVorgangByLieferscheinGuid: (lieferscheinGuid: string) => Promise<VorgangDTO>;
349
+ getLieferscheinStatus: (vorgangGuid: string) => Promise<VorgangStatusDTO>;
350
+ setLieferscheinStatus: (vorgangGuid: string, statusCode: string) => Promise<VorgangStatusDTO>;
351
+ getVorgangHistorie: (vorgangGuid: string, includeBelege?: boolean, includePositionen?: boolean) => Promise<VorgangHistorienDTO>;
352
+ getBelegHistorie: (belegGuid: string, includePositionen?: boolean) => Promise<BelegHistorienDTO>;
353
+ getBelegPositionHistorie: (positionGuid: string) => Promise<BelegPositionHistorienDTO>;
354
+ getSerieHistorieSince: (sinceWhen: Date) => Promise<SerieHistorieDTO[]>;
355
+ getSerieHistorie: (serieGuid: string) => Promise<SerieHistorieDTO[]>;
356
+ addVorgangHistorie: (vorgangGuid: string, historyDto: VorgangHistorieDTO) => Promise<void>;
357
+ addBelegHistorie: (belegGuid: string, historyDto: BelegHistorieDTO) => Promise<void>;
358
+ addBelegPositionHistorie: (positionGuid: string, historyDto: BelegPositionHistorieDTO) => Promise<void>;
359
+ addSerieHistorie: (historyDto: SerieHistorieDTO) => Promise<void>;
360
+ addVorgangHistorieFromFunction: (vorgangGuid: string, historyDto: VorgangHistorieDTO, mandantID: number) => Promise<void>;
361
+ addBelegPositionHistorieFromFunction: (positionGuid: string, historyDto: BelegPositionHistorieDTO, mandantID: number) => Promise<void>;
362
+ addSerieHistorieFromFunction: (historyDto: SerieHistorieDTO, mandantID: number) => Promise<void>;
363
+ getLetzterBearbeiter: (belegGuid: string) => Promise<string>;
364
+ getLetzteBearbeiter: (belegGuids: string[]) => Promise<Record<string, string>>;
365
+ positionStornieren: (positionGuid: string) => Promise<void>;
366
+ belegStornieren: (belegGuid: string) => Promise<void>;
367
+ fremdfertigungBestellen: (belegGuid: string) => Promise<void>;
368
+ };
232
369
 
233
370
  export type BelegArt = 0|1|2|3|4|5|6|7|8|9|10|11|12|13;
234
371
 
@@ -591,7 +728,16 @@ export type BelegWorkflow = {
591
728
  Steps: Array<BelegArt>;
592
729
  };
593
730
 
594
- export type BenutzerApi = ReturnType<typeof createBenutzerApi>;
731
+ export type BenutzerApi = {
732
+ getBenutzerListe: (mandant: string, mitRollenUndRechten?: boolean) => Promise<BenutzerDTO[]>;
733
+ getBenutzer: (benutzer: string, mitRollenUndRechten?: boolean) => Promise<BenutzerDTO>;
734
+ saveBenutzerList: (list: BenutzerDTO[]) => Promise<void>;
735
+ saveBenutzer: (benutzer: BenutzerDTO) => Promise<any>;
736
+ passwortReset: (benutzerName: string) => Promise<any>;
737
+ passwortAendern: (passwortAendernData: PasswortAendernDTO) => Promise<any>;
738
+ sicSyncWebJob: () => Promise<any>;
739
+ getRollenAll: () => Promise<RolleDTO[]>;
740
+ };
595
741
 
596
742
  export type BenutzerDTO = {
597
743
  Rollen: RolleDTO[];
@@ -761,11 +907,37 @@ export type FachzuordnungResultDTO = {
761
907
  OverCapacity: boolean;
762
908
  };
763
909
 
764
- export type FakturaApi = ReturnType<typeof createFakturaApi>;
910
+ export type FakturaApi = {
911
+ getVorgangKennzeichen: (vorgangGuid: string) => Promise<string>;
912
+ getBelegKennzeichen: (belegGuid: string) => Promise<string>;
913
+ getBelegPositionKennzeichen: (belegPositionGuid: string) => Promise<string>;
914
+ getBelegPositionAvKennzeichen: (belegPositionAvGuid: string) => Promise<string>;
915
+ setVorgangKennzeichen: (dto: SetFakturaDTO) => Promise<string>;
916
+ setBelegKennzeichen: (dto: SetFakturaDTO) => Promise<string>;
917
+ setBelegPositionKennzeichen: (dto: SetFakturaDTO) => Promise<string>;
918
+ setBelegPositionAvKennzeichen: (dto: SetFakturaDTO) => Promise<string>;
919
+ setFakturaInAbAuto: () => Promise<void>;
920
+ };
765
921
 
766
922
  export type FarbArt = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
767
923
 
768
- export type FarbeApi = ReturnType<typeof createFarbeApi>;
924
+ export type FarbeApi = {
925
+ getAllFarben: () => Promise<FarbeDTO[]>;
926
+ saveFarbe: (dto: FarbeDTO) => Promise<void>;
927
+ getAllOberflaechen: () => Promise<OberflaecheDTO[]>;
928
+ saveOberflaeche: (dto: OberflaecheDTO) => Promise<void>;
929
+ getAllFarbGruppen: () => Promise<FarbGruppeDTO[]>;
930
+ saveFarbGruppe: (dto: FarbGruppeDTO) => Promise<void>;
931
+ getAllFarbKuerzel: () => Promise<FarbKuerzelDTO[]>;
932
+ saveFarbKuerzel: (dto: FarbKuerzelDTO) => Promise<void>;
933
+ getAllFarbKuerzelGruppen: () => Promise<FarbKuerzelGruppeDTO[]>;
934
+ saveFarbKuerzelGruppe: (dto: FarbKuerzelGruppeDTO) => Promise<void>;
935
+ getFarbgruppenaufpreise: () => Promise<FarbgruppenaufpreiseDTO[]>;
936
+ saveFarbgruppenaufpreise: (dto: FarbgruppenaufpreiseDTO) => Promise<void>;
937
+ getAllProduzentenFarbGruppen: () => Promise<ProduzentenFarbGruppeDTO[]>;
938
+ saveProduzentenFarbGruppe: (dto: ProduzentenFarbGruppeDTO) => Promise<void>;
939
+ deleteProduzentenFarbGruppe: (produzentenFarbGruppeGuid: string) => Promise<void>;
940
+ };
769
941
 
770
942
  export type FarbeDTO = {
771
943
  FarbItemGuid: string;
@@ -838,7 +1010,12 @@ export type FarbKuerzelGruppeDTO = {
838
1010
  ChangedDate: string;
839
1011
  };
840
1012
 
841
- export type FileApi = ReturnType<typeof createFileApi>;
1013
+ export type FileApi = {
1014
+ get: (name: string) => Promise<Uint8Array>;
1015
+ getList: () => Promise<FileInfoDTO[]>;
1016
+ getZipped: (fileNames: string[]) => Promise<Uint8Array>;
1017
+ data: { get: (filename: string) => Promise<Uint8Array>; getList: (directory?: string) => Promise<FileInfoDTO[]>; save: (fileName: string, data: Uint8Array) => Promise<void>; delete: (filename: string) => Promise<void> };
1018
+ };
842
1019
 
843
1020
  export type FluentApi = {
844
1021
  baseUrl: string;
@@ -990,7 +1167,22 @@ export type GuidListDTO = {
990
1167
  GuidList: Array<string>;
991
1168
  };
992
1169
 
993
- export type HistorieApi = ReturnType<typeof createHistorieApi>;
1170
+ export type HistorieApi = {
1171
+ getVorgangHistorie: (vorgangGuid: string, includeBelege?: boolean, includePositionen?: boolean) => Promise<VorgangHistorienDTO>;
1172
+ getBelegHistorie: (belegGuid: string, includePositionen?: boolean) => Promise<BelegHistorienDTO>;
1173
+ getBelegPositionHistorie: (positionGuid: string) => Promise<BelegPositionHistorienDTO>;
1174
+ getSerieHistorieSince: (sinceWhen: Date) => Promise<SerieHistorieDTO[]>;
1175
+ getSerieHistorie: (serieGuid: string) => Promise<SerieHistorieDTO[]>;
1176
+ addVorgangHistorie: (vorgangGuid: string, historyDto: VorgangHistorieDTO) => Promise<void>;
1177
+ addBelegHistorie: (belegGuid: string, historyDto: BelegHistorieDTO) => Promise<void>;
1178
+ addBelegPositionHistorie: (positionGuid: string, historyDto: BelegPositionHistorieDTO) => Promise<void>;
1179
+ addSerieHistorie: (historyDto: SerieHistorieDTO) => Promise<void>;
1180
+ addVorgangHistorieFromFunction: (vorgangGuid: string, historyDto: VorgangHistorieDTO, mandantID: number) => Promise<void>;
1181
+ addBelegPositionHistorieFromFunction: (positionGuid: string, historyDto: BelegPositionHistorieDTO, mandantID: number) => Promise<void>;
1182
+ addSerieHistorieFromFunction: (historyDto: SerieHistorieDTO, mandantID: number) => Promise<void>;
1183
+ getLetzterBearbeiter: (belegGuid: string) => Promise<string>;
1184
+ getLetzteBearbeiter: (belegGuids: string[]) => Promise<Record<string, string>>;
1185
+ };
994
1186
 
995
1187
  export type IDASFluentApi = FluentApi & {
996
1188
  vorgang: VorgangApi;
@@ -1465,7 +1657,21 @@ export type KonturElementDTO = {
1465
1657
  ChangedDate: Date;
1466
1658
  };
1467
1659
 
1468
- export type LagerApi = ReturnType<typeof createLagerApi>;
1660
+ export type LagerApi = {
1661
+ get: (guid: string) => Promise<LagerbestandDTO>;
1662
+ getFromGuidList: (guids: string[]) => Promise<LagerbestandDTO[]>;
1663
+ getAll: (changedSince?: Date) => Promise<LagerbestandDTO[]>;
1664
+ getUnterschreitungEisernerBestand: () => Promise<LagerbestandDTO[]>;
1665
+ buchung: (buchung: LagerbuchungDTO) => Promise<LagerbestandDTO>;
1666
+ buchungListe: (buchungen: LagerbuchungDTO[]) => Promise<LagerbestandDTO[]>;
1667
+ save: (dto: LagerbestandDTO) => Promise<void>;
1668
+ saveListe: (dtos: LagerbestandDTO[]) => Promise<string[]>;
1669
+ delete: (guid: string) => Promise<void>;
1670
+ getHistorie: (vonDatum: Date, bisDatum: Date, mitLagerbuchungen?: boolean, mitReservierungen?: boolean, katalogArtikelGuid?: string) => Promise<LagerbuchungDTO[]>;
1671
+ reservierung: { get: (guid: string) => Promise<LagerReservierungDTO>; getAll: (artikelnummer?: string, farbkuerzel?: string, farbcode?: string, bezug?: string, oberflaeche?: string, changedSince?: Date) => Promise<LagerReservierungDTO[]>; save: (dtos: LagerReservierungDTO[]) => Promise<void>; delete: (guids: string[]) => Promise<void> };
1672
+ getProduzentenMandantIds: () => Promise<number[]>;
1673
+ initializeBestand: (mandantID: number) => Promise<number[]>;
1674
+ };
1469
1675
 
1470
1676
  export type LagerbestandDTO = {
1471
1677
  LagerbestandGuid: string;
@@ -1526,7 +1732,16 @@ export type LagerReservierungDTO = {
1526
1732
 
1527
1733
  export type LayoutBelegDruckDTO = ILayoutBelegDruck;
1528
1734
 
1529
- export type LieferungApi = ReturnType<typeof createLieferungApi>;
1735
+ export type LieferungApi = {
1736
+ getAllLieferzusagen: (serieGuid: string, lieferant?: string) => Promise<LieferzusageDTO[]>;
1737
+ getLieferzusagenCount: (serieGuid: string, lieferant?: string) => Promise<number>;
1738
+ materialZusagen: (lieferzusage: LieferzusageDTO) => Promise<string>;
1739
+ materialZusagenListe: (lieferzusagen: LieferzusageDTO[]) => Promise<string>;
1740
+ resetLieferzusage: (lieferzusageGuid: string) => Promise<void>;
1741
+ resetLieferzusagen: (lieferzusagenGuids: string[]) => Promise<string>;
1742
+ resetLieferzusagenBySerie: (serieGuid: string, lieferant?: string) => Promise<void>;
1743
+ gesamt: { getAll: (stichTag?: Date) => Promise<GesamtLieferzusageDTO[]>; save: (dto: GesamtLieferzusageDTO) => Promise<void>; saveListe: (dtoSet: GesamtLieferzusageDTO[]) => Promise<string>; serieBuchen: (serieGuid: string) => Promise<void>; delete: (gesamtLieferzusageGuid: string) => Promise<void>; deleteListe: (gesamtLieferzusagenGuids: string[]) => Promise<string> };
1744
+ };
1530
1745
 
1531
1746
  export type Lieferungstyp = 0|1|2;
1532
1747
 
@@ -1558,7 +1773,10 @@ export type LoginDTO = {
1558
1773
  AppToken: string;
1559
1774
  };
1560
1775
 
1561
- export type MailApi = ReturnType<typeof createMailApi>;
1776
+ export type MailApi = {
1777
+ send: (job: MailJobInfo, attachments?: string[]) => Promise<JobStatusResponseDTO>;
1778
+ getStatus: (guid: string) => Promise<JobStatusEntryDTO[]>;
1779
+ };
1562
1780
 
1563
1781
  export type MailJobInfo = {
1564
1782
  JobGuid: string;
@@ -1575,7 +1793,13 @@ export type MandantAndBelegPosGuidDTO = {
1575
1793
  BelegPositionGuid: string;
1576
1794
  };
1577
1795
 
1578
- export type MandantApi = ReturnType<typeof createMandantApi>;
1796
+ export type MandantApi = {
1797
+ abgleichen: (list: MandantDTO[]) => Promise<MandantDTO[]>;
1798
+ anlegen: (mandant: MandantDTO) => Promise<MandantDTO>;
1799
+ ladenMitFilter: (filter: string) => Promise<MandantDTO[]>;
1800
+ admin: { ladenMitFilter: (filter: string, onlyHaendler: boolean, onlyProduzenten: boolean) => Promise<MandantDTO[]>; laden: (guid: string) => Promise<MandantDTO>; umziehen: (mandantGuid: string, zielMandantGuid: string) => Promise<void>; addAdminRechte: (email: string) => Promise<void> };
1801
+ app: { getStatusByKunde: (kundeGuid: string) => Promise<AppActivationStatusDTO>; setStatusByKunde: (data: AppActivationStatusDTO) => Promise<AppActivationStatusDTO>; getAll: () => Promise<MandantDTO[]>; getBenutzerByKunde: (kundeGuid: string) => Promise<BenutzerDTO[]>; createOrUpdateBenutzer: (kundeGuid: string, data: BenutzerDTO, pwSenden?: boolean, passwort?: string) => Promise<BenutzerDTO>; deleteBenutzer: (kundeGuid: string, data: BenutzerDTO) => Promise<void>; aktiviere: (adminEmail: string) => Promise<void> };
1802
+ };
1579
1803
 
1580
1804
  export type MandantDTO = {
1581
1805
  Name: string;
@@ -1877,7 +2101,12 @@ export type PreisermittlungsEinstellungenDTO = {
1877
2101
  ChangedDate: string;
1878
2102
  };
1879
2103
 
1880
- export type PrintApi = ReturnType<typeof createPrintApi>;
2104
+ export type PrintApi = {
2105
+ pdfErzeugen: (belegGuid: string) => Promise<Uint8Array>;
2106
+ xpsErzeugen: (belegGuid: string) => Promise<Uint8Array>;
2107
+ pdfV2: (belegGuid: string, email: string) => Promise<Uint8Array>;
2108
+ briefbogenLaden: () => Promise<Uint8Array>;
2109
+ };
1881
2110
 
1882
2111
  export type ProduktFamilieDTO = {
1883
2112
  ProduktFamilieGuid: string;
@@ -1927,7 +2156,23 @@ export type ProduktGruppeDTO = {
1927
2156
  ChangedDate: string;
1928
2157
  };
1929
2158
 
1930
- export type ProduktionApi = ReturnType<typeof createProduktionApi>;
2159
+ export type ProduktionApi = {
2160
+ produktionBerechnen: (belegPositionsGuid: string) => Promise<string>;
2161
+ getProduktion: (belegPositionsGuid: string) => Promise<BearbeitungDTO[]>;
2162
+ getMaterialBedarf: (belegPositionsGuid: string) => Promise<MaterialbedarfDTO[]>;
2163
+ addProduktionsfreigabe: (dto: BelegartWechselDTO) => Promise<VorgangDTO>;
2164
+ produktionsfreigabeWebJob: () => Promise<void>;
2165
+ getAllProduktionsfreigabeItems: () => Promise<ProduktionsfreigabeItemDTO[]>;
2166
+ getProduktionsfreigabeInfo: (belegGuids: string[]) => Promise<Record<string, Date>>;
2167
+ getAllProduktionsStatus: () => Promise<ProduktionsStatusDTO[]>;
2168
+ getProduktionsStatus: (guid: string) => Promise<ProduktionsStatusDTO>;
2169
+ saveProduktionsStatus: (status: ProduktionsStatusDTO) => Promise<void>;
2170
+ saveProduktionsStatusHistorie: (avGuid: string, historie: ProduktionsStatusHistorieDTO) => Promise<void>;
2171
+ getProduktionsInfo: (vorgangGuid: string) => Promise<ProduktionsInfoDTO>;
2172
+ ibos1ProduktionBerechnen: (belegPositionsGuid: string) => Promise<string>;
2173
+ ibos1PositionTesten: (belegPositionsGuid: string) => Promise<string>;
2174
+ getIbos1Produktion: (guid: string) => Promise<string>;
2175
+ };
1931
2176
 
1932
2177
  export type ProduktionProduktfamilieSettingsDTO = {
1933
2178
  GroupName: string;
@@ -2127,7 +2372,15 @@ export type ProfilKuerzelDTO = {
2127
2372
 
2128
2373
  export type PropertyValueCollection = object;
2129
2374
 
2130
- export type RechnungApi = ReturnType<typeof createRechnungApi>;
2375
+ export type RechnungApi = {
2376
+ getAllAbFakturierbar: () => Promise<BelegeInfoDTO[]>;
2377
+ getAllDruckbar: (printedSince?: Date) => Promise<BelegeInfoDTO[]>;
2378
+ getAllExportierbar: (exportedSince?: Date) => Promise<BelegeInfoDTO[]>;
2379
+ setBelegePrinted: (belegListe: string[]) => Promise<void>;
2380
+ setBelegeExported: (belegListe: string[]) => Promise<void>;
2381
+ erstelleRechnungen: (belegeWechsel: BelegartWechselDTO[]) => Promise<Record<string, string>>;
2382
+ sammel: { erstellen: (dto: CreateSammelrechnungDTO) => Promise<SammelrechnungListItemDTO>; getNotPrinted: (printedSince?: Date) => Promise<SammelrechnungListItemDTO[]>; getNotExported: (exportedSince?: Date) => Promise<SammelrechnungListItemDTO[]>; get: (guid: string, includeBelegDruckDTO: boolean) => Promise<SammelrechnungDTO>; getPossibleRechnungen: () => Promise<BelegeInfoDTO[]>; update: (dto: SammelrechnungDTO) => Promise<SammelrechnungDTO>; addRechnung: (belegGuid: string, sammelrechnungGuid: string) => Promise<SammelrechnungListItemDTO>; setAlsGedruckt: (guidListe: string[], setEinzel?: boolean) => Promise<void>; setAlsFibuUebergeben: (guidListe: string[], setEinzel?: boolean) => Promise<void>; search: (term: string) => Promise<SammelrechnungListItemDTO[]> };
2383
+ };
2131
2384
 
2132
2385
  export type RechnungsNummer = 0|1;
2133
2386
 
@@ -2401,7 +2654,28 @@ export type Settings = {
2401
2654
  authUrl: string;
2402
2655
  };
2403
2656
 
2404
- export type SettingsApi = ReturnType<typeof createSettingsApi>;
2657
+ export type SettingsApi = {
2658
+ getAllSettings: () => Promise<Record<string, object>>;
2659
+ saveSetting: (key: string, value: object) => Promise<void>;
2660
+ getPreiskonditionen: () => Promise<PreisermittlungsEinstellungenDTO>;
2661
+ savePreiskonditionen: (konditionen: string) => Promise<string>;
2662
+ getAllKonfigSatzInfo: () => Promise<KonfigSatzInfoDTO[]>;
2663
+ saveKonfigSatzInfo: (konfigSatzInfo: KonfigSatzInfoDTO) => Promise<KonfigSatzInfoDTO>;
2664
+ getAllWertelisten: (includeAutoWerteListen: boolean) => Promise<WerteListeDTO[]>;
2665
+ getWerteliste: (wertelisteGuid: string, includeAutoWerteListen?: boolean) => Promise<WerteListeDTO>;
2666
+ saveWerteliste: (dto: WerteListeDTO) => Promise<void>;
2667
+ getAllContracts: () => Promise<ContractDTO[]>;
2668
+ saveContract: (dto: ContractDTO) => Promise<ContractDTO>;
2669
+ deleteContract: (dto: ContractDTO) => Promise<void>;
2670
+ getAllTemplates: () => Promise<TemplateDTO[]>;
2671
+ getTemplate: (id: string) => Promise<TemplateDTO>;
2672
+ saveTemplate: (dto: TemplateDTO) => Promise<void>;
2673
+ deleteTemplate: (templateGuid: string) => Promise<void>;
2674
+ getChangeInfo: () => Promise<ChangeInfoDTO>;
2675
+ getUpdateInfo: () => Promise<UpdateInfoDTO>;
2676
+ getDataMigrationHistoryVersion: () => Promise<number>;
2677
+ setDataMigrationHistoryVersion: (newVersion: number) => Promise<void>;
2678
+ };
2405
2679
 
2406
2680
  export type SLKServerSettingsDTO = {
2407
2681
  SLKNichtAktiv: boolean;
@@ -2412,7 +2686,14 @@ export type SonderwuenscheDTO = {
2412
2686
  Wert: string;
2413
2687
  };
2414
2688
 
2415
- export type SystemApi = ReturnType<typeof createSystemApi>;
2689
+ export type SystemApi = {
2690
+ getChanges: (typeName: string, changedSince: Date) => Promise<ChangeDTO[]>;
2691
+ deleteOldChanges: () => Promise<void>;
2692
+ tagInfo: { getAll: (changedSince?: Date) => Promise<TagInfoDTO[]>; getSuggestions: (changedSince?: Date) => Promise<TagInfoDTO[]>; get: (objectGuid: string) => Promise<TagInfoDTO[]>; getForGuidList: (guidList: string[]) => Promise<Record<string, TagInfoDTO[]>>; getForFremdfertigungGuidList: (guidList: string[]) => Promise<Record<string, TagInfoDTO[]>>; addOrUpdate: (dto: TagInfoDTO) => Promise<void>; delete: (dto: TagInfoDTO) => Promise<void>; getVorlagen: () => Promise<TagVorlageDTO[]>; addOrUpdateVorlage: (dto: TagVorlageDTO) => Promise<void>; deleteVorlage: (tagVorlageGuid: string) => Promise<void>; getForFunction: (objectGuid: string, mandantID: number) => Promise<TagInfoDTO[]>; getListForFunction: (guidList: string[], mandantID: number) => Promise<Record<string, TagInfoDTO[]>>; addForFunction: (dto: TagInfoDTO, mandantID: number) => Promise<void>; deleteForFunction: (dto: TagInfoDTO, mandantID: number) => Promise<void>; cleanUp: () => Promise<void> };
2693
+ filter: { getAll: () => Promise<FilterItemDTO[]>; get: (id: string) => Promise<FilterItemDTO>; getByContext: (context: string) => Promise<FilterItemDTO[]>; save: (dto: FilterItemDTO) => Promise<void> };
2694
+ getChangeInfo: () => Promise<ChangeInfoDTO>;
2695
+ getUpdateInfo: () => Promise<UpdateInfoDTO>;
2696
+ };
2416
2697
 
2417
2698
  export type TagInfoDTO = {
2418
2699
  ObjectGuid: string;
@@ -2448,7 +2729,38 @@ export type TemplateDTO = {
2448
2729
  Benutzer: string;
2449
2730
  };
2450
2731
 
2451
- export type UiApi = ReturnType<typeof createUiApi>;
2732
+ export type UiApi = {
2733
+ getAllUiDefinitions: () => Promise<UIDefinitionDTO[]>;
2734
+ getUiDefinition: (guid: string) => Promise<UIDefinitionDTO>;
2735
+ saveUiDefinition: (uiDefinition: UIDefinitionDTO) => Promise<UIDefinitionDTO>;
2736
+ getAllUiScripts: () => Promise<UIScriptDTO[]>;
2737
+ getUiScript: (name: string) => Promise<UIScriptDTO>;
2738
+ getUiScriptForFunction: (name: string) => Promise<UIScriptDTO>;
2739
+ saveUiScript: (dto: UIScriptDTO) => Promise<void>;
2740
+ deleteUiScript: (guid: string) => Promise<void>;
2741
+ getAllUiFeldInfo: () => Promise<UIEingabeFeldInfoDTO[]>;
2742
+ saveUiEingabeFeldInfo: (uiEingabeFeldInfo: UIEingabeFeldInfoDTO) => Promise<UIEingabeFeldInfoDTO>;
2743
+ getAllTagInfo: (changedSince?: Date) => Promise<TagInfoDTO[]>;
2744
+ getTagInfoSuggestions: (changedSince?: Date) => Promise<TagInfoDTO[]>;
2745
+ getTagInfo: (objectGuid: string) => Promise<TagInfoDTO[]>;
2746
+ getTagInfoForGuidList: (guidList: string[]) => Promise<Record<string, TagInfoDTO[]>>;
2747
+ getTagInfoForFremdfertigungGuidList: (guidList: string[]) => Promise<Record<string, TagInfoDTO[]>>;
2748
+ addOrUpdateTagInfo: (dto: TagInfoDTO) => Promise<void>;
2749
+ deleteTagInfo: (dto: TagInfoDTO) => Promise<void>;
2750
+ getTagVorlagen: () => Promise<TagVorlageDTO[]>;
2751
+ addOrUpdateTagVorlage: (dto: TagVorlageDTO) => Promise<void>;
2752
+ deleteTagVorlage: (tagVorlageGuid: string) => Promise<void>;
2753
+ getTagInfoForFunction: (objectGuid: string, mandantID: number) => Promise<TagInfoDTO[]>;
2754
+ getTagInfoListForFunction: (guidList: string[], mandantID: number) => Promise<Record<string, TagInfoDTO[]>>;
2755
+ addTagInfoForFunction: (dto: TagInfoDTO, mandantID: number) => Promise<void>;
2756
+ deleteTagInfoForFunction: (dto: TagInfoDTO, mandantID: number) => Promise<void>;
2757
+ cleanUpTagInfos: () => Promise<void>;
2758
+ getAllFilters: () => Promise<FilterItemDTO[]>;
2759
+ getFilter: (id: string) => Promise<FilterItemDTO>;
2760
+ getFiltersByContext: (context: string) => Promise<FilterItemDTO[]>;
2761
+ saveFilter: (dto: FilterItemDTO) => Promise<void>;
2762
+ translate: (language: string, text: string) => Promise<string | null>;
2763
+ };
2452
2764
 
2453
2765
  export type UIDefinitionDTO = {
2454
2766
  UIDefinitionGuid: string;
@@ -2562,7 +2874,35 @@ export type UserAuthTokenDTO = {
2562
2874
  Mandant: MandantDTO | null;
2563
2875
  };
2564
2876
 
2565
- export type UtilityApi = ReturnType<typeof createUtilityApi>;
2877
+ export type UtilityApi = {
2878
+ addWebJobHistorie: (historyDto: WebJobHistorieDTO) => Promise<void>;
2879
+ deleteOldWebJobHistorie: () => Promise<void>;
2880
+ getCutOptimization: (materialbedarfDtos: MaterialbedarfDTO[]) => Promise<Record<string, MaterialbedarfCutOptimization>>;
2881
+ getGesamtMaterialbedarf: (optionen: ZusammenfassungsOptionen, stangenoptimierung: boolean, stichTag?: Date, bedarfAb?: Date, filterCsvExportedMaterial?: boolean) => Promise<GesamtMaterialbedarfGetReturn>;
2882
+ gesamtBedarfUpdateLiefertag: (mandantId: number, posGuid: string) => Promise<void>;
2883
+ recalculateGesamtbedarf: (mandantId: number, avPosGuid: string) => Promise<void>;
2884
+ erzeugeVorgangBeiBeschichter: (vorgang: VorgangDTO, mGuid: string, produzentenKundenNummer: string) => Promise<VorgangDTO>;
2885
+ erzeugeBestellVorgang: (vorgang: VorgangDTO) => Promise<VorgangDTO>;
2886
+ erzeugeReklamationBeiBeschichter: (vorgang: VorgangDTO, quellVorgang: string, mGuid: string, produzentenKundenNummer: string) => Promise<VorgangDTO>;
2887
+ updateStatusBeimProduzenten: (vorgangGuid: string, status: string, externeReferenz?: string) => Promise<void>;
2888
+ getMaterialBestellungenByJahr: (jahr: number) => Promise<BaseListItemDTO[]>;
2889
+ getMaterialBestellungen: () => Promise<BaseListItemDTO[]>;
2890
+ requestNewsletterByGuid: (guid: string) => Promise<void>;
2891
+ requestNewsletterByMail: (mail: string) => Promise<void>;
2892
+ deleteNewsletterByMail: (mail: string) => Promise<void>;
2893
+ deleteNewsletterByGuid: (guid: string) => Promise<void>;
2894
+ getBackupVorgangGuids: (email: string, year?: number, onlyBills?: boolean) => Promise<string[]>;
2895
+ getBackupVorgang: (email: string, guid: string, onlyBills?: boolean) => Promise<VorgangExtendedDTO>;
2896
+ requestBackup: (email: string, onlyBills: boolean, year: number) => Promise<void>;
2897
+ ladeBestellungen: (jahr?: number, includeAbgeholte?: boolean) => Promise<BestellungListItemDTO[]>;
2898
+ resetBestellungen: (resetAb: Date) => Promise<void>;
2899
+ ladeMaterialBestellungen: (jahr?: number, vorgangStatusText?: string, includeAbgeholte?: boolean, includeArchive?: boolean, includeAllTypes?: boolean, includeArtosGeloeschtFlag?: boolean) => Promise<MaterialBestellungListItemDTO[]>;
2900
+ ladeMaterialBestellungenVonBis: (vonDatum: Date, bisDatum: Date, vorgangStatusText?: string, includeAbgeholte?: boolean, includeArchive?: boolean, includeAllTypes?: boolean, includeArtosGeloeschtFlag?: boolean) => Promise<MaterialBestellungListItemDTO[]>;
2901
+ resetMaterialBestellungen: (resetAb: Date) => Promise<void>;
2902
+ getGsqlBeleg: (belegGuid: string) => Promise<string>;
2903
+ getAllNotifications: () => Promise<NachrichtenDTO[]>;
2904
+ getOneBenutzerByKunde: (kundeGuid: string, email: string) => Promise<BenutzerDTO | undefined>;
2905
+ };
2566
2906
 
2567
2907
  export type Variante = {
2568
2908
  VarianteGuid?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.5.24",
3
+ "version": "1.5.26",
4
4
  "description": "WebLibs for Gandalan JS/TS projects",
5
5
  "keywords": [
6
6
  "gandalan"
@@ -18,14 +18,24 @@ const dtoLeafDirectory = path.join(rootDir, "api", "dtos");
18
18
  const businessLeafDirectory = path.join(rootDir, "api", "business");
19
19
  const uiLeafDirectory = path.join(rootDir, "ui");
20
20
 
21
- const sourceDirectories = ["api", "ui"];
22
-
23
21
  const dtoRootMarkerStart = "// BEGIN GENERATED ROOT DTO TYPEDEFS";
24
22
  const dtoRootMarkerEnd = "// END GENERATED ROOT DTO TYPEDEFS";
25
23
  const businessRootMarkerStart = "// BEGIN GENERATED ROOT BUSINESS TYPEDEFS";
26
24
  const businessRootMarkerEnd = "// END GENERATED ROOT BUSINESS TYPEDEFS";
27
25
 
26
+ const rootValueExportStatements = [
27
+ "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\";"
35
+ ];
36
+
28
37
  const simpleImportTypePattern = /^import\((?:"|').+(?:"|')\)\.[A-Za-z0-9_$]+$/;
38
+ const returnTypeOfCreateApiPattern = /^ReturnType<\s*typeof\s+(create[A-Za-z0-9_$]+Api)\s*>$/;
29
39
 
30
40
  const rawType = (js, ts = js) => ({ kind: "raw", js, ts });
31
41
  const refType = (name) => rawType(name);
@@ -243,16 +253,6 @@ function toRelativeImportPath(fromFilePath, targetFilePath) {
243
253
  return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
244
254
  }
245
255
 
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
-
256
256
  function getJSDocBlocks(source) {
257
257
  return source.match(/\/\*\*[\s\S]*?\*\//g) ?? [];
258
258
  }
@@ -356,6 +356,569 @@ function normalizeJSDocBlock(block) {
356
356
  .trim();
357
357
  }
358
358
 
359
+ function skipQuotedString(source, startIndex, quoteCharacter) {
360
+ let index = startIndex + 1;
361
+
362
+ while (index < source.length) {
363
+ const character = source[index];
364
+
365
+ if (character === "\\") {
366
+ index += 2;
367
+ continue;
368
+ }
369
+
370
+ if (character === quoteCharacter) {
371
+ return index + 1;
372
+ }
373
+
374
+ index += 1;
375
+ }
376
+
377
+ return source.length;
378
+ }
379
+
380
+ function skipBlockComment(source, startIndex) {
381
+ const endIndex = source.indexOf("*/", startIndex + 2);
382
+ return endIndex === -1 ? source.length : endIndex + 2;
383
+ }
384
+
385
+ function skipLineComment(source, startIndex) {
386
+ const endIndex = source.indexOf("\n", startIndex + 2);
387
+ return endIndex === -1 ? source.length : endIndex + 1;
388
+ }
389
+
390
+ function findMatchingDelimiter(source, startIndex, openCharacter, closeCharacter) {
391
+ let depth = 1;
392
+
393
+ for (let index = startIndex + 1; index < source.length; index += 1) {
394
+ const character = source[index];
395
+ const nextCharacter = source[index + 1];
396
+
397
+ if (character === "\"" || character === "'") {
398
+ index = skipQuotedString(source, index, character) - 1;
399
+ continue;
400
+ }
401
+
402
+ if (character === "`") {
403
+ index = skipTemplateLiteral(source, index) - 1;
404
+ continue;
405
+ }
406
+
407
+ if (character === "/" && nextCharacter === "*") {
408
+ index = skipBlockComment(source, index) - 1;
409
+ continue;
410
+ }
411
+
412
+ if (character === "/" && nextCharacter === "/") {
413
+ index = skipLineComment(source, index) - 1;
414
+ continue;
415
+ }
416
+
417
+ if (character === openCharacter) {
418
+ depth += 1;
419
+ continue;
420
+ }
421
+
422
+ if (character === closeCharacter) {
423
+ depth -= 1;
424
+
425
+ if (depth === 0) {
426
+ return index;
427
+ }
428
+ }
429
+ }
430
+
431
+ return -1;
432
+ }
433
+
434
+ function skipTemplateLiteral(source, startIndex) {
435
+ let index = startIndex + 1;
436
+
437
+ while (index < source.length) {
438
+ const character = source[index];
439
+
440
+ if (character === "\\") {
441
+ index += 2;
442
+ continue;
443
+ }
444
+
445
+ if (character === "`") {
446
+ return index + 1;
447
+ }
448
+
449
+ if (character === "$" && source[index + 1] === "{") {
450
+ const closingIndex = findMatchingDelimiter(source, index + 1, "{", "}");
451
+
452
+ if (closingIndex === -1) {
453
+ return source.length;
454
+ }
455
+
456
+ index = closingIndex + 1;
457
+ continue;
458
+ }
459
+
460
+ index += 1;
461
+ }
462
+
463
+ return source.length;
464
+ }
465
+
466
+ function skipWhitespace(value, startIndex) {
467
+ let index = startIndex;
468
+
469
+ while (index < value.length && /\s/u.test(value[index])) {
470
+ index += 1;
471
+ }
472
+
473
+ return index;
474
+ }
475
+
476
+ function skipWhitespaceAndComments(source, startIndex) {
477
+ let index = startIndex;
478
+
479
+ while (index < source.length) {
480
+ index = skipWhitespace(source, index);
481
+
482
+ if (source.startsWith("/**", index) || source.startsWith("/*", index)) {
483
+ index = skipBlockComment(source, index);
484
+ continue;
485
+ }
486
+
487
+ if (source.startsWith("//", index)) {
488
+ index = skipLineComment(source, index);
489
+ continue;
490
+ }
491
+
492
+ break;
493
+ }
494
+
495
+ return index;
496
+ }
497
+
498
+ function isIdentifierStart(character) {
499
+ return /[A-Za-z_$]/u.test(character);
500
+ }
501
+
502
+ function isIdentifierPart(character) {
503
+ return /[A-Za-z0-9_$]/u.test(character);
504
+ }
505
+
506
+ function buildFunctionTypeExpressionFromJSDoc(block) {
507
+ const normalizedBlock = normalizeJSDocBlock(block);
508
+ const params = extractParamEntries(normalizedBlock);
509
+ const returns = extractReturnsEntry(normalizedBlock)?.typeExpression ?? "void";
510
+
511
+ return `(${params.map((param) => `${param.name}${param.optional ? "?" : ""}: ${param.typeExpression}`).join(", ")}) => ${returns}`;
512
+ }
513
+
514
+ function buildObjectLiteralTypeExpression(properties) {
515
+ return `{ ${properties.map((property) => `${property.name}${property.optional ? "?" : ""}: ${property.typeExpression}`).join("; ")} }`;
516
+ }
517
+
518
+ function parseFunctionParameterTypes(jsDocBlock) {
519
+ if (!jsDocBlock) {
520
+ return new Map();
521
+ }
522
+
523
+ const normalizedBlock = normalizeJSDocBlock(jsDocBlock);
524
+ const params = extractParamEntries(normalizedBlock);
525
+
526
+ return new Map(params.map((param) => [param.name, param.typeExpression]));
527
+ }
528
+
529
+ function readLeadingJSDoc(source, startIndex) {
530
+ let index = startIndex;
531
+ let jsDocBlock = null;
532
+
533
+ while (index < source.length) {
534
+ index = skipWhitespace(source, index);
535
+
536
+ if (source.startsWith("/**", index)) {
537
+ const endIndex = skipBlockComment(source, index);
538
+ jsDocBlock = source.slice(index, endIndex);
539
+ index = endIndex;
540
+ continue;
541
+ }
542
+
543
+ if (source.startsWith("/*", index)) {
544
+ index = skipBlockComment(source, index);
545
+ continue;
546
+ }
547
+
548
+ if (source.startsWith("//", index)) {
549
+ index = skipLineComment(source, index);
550
+ continue;
551
+ }
552
+
553
+ break;
554
+ }
555
+
556
+ return {
557
+ jsDocBlock,
558
+ nextIndex: index
559
+ };
560
+ }
561
+
562
+ function findExpressionEnd(source, startIndex) {
563
+ let braceDepth = 0;
564
+ let bracketDepth = 0;
565
+ let parenDepth = 0;
566
+
567
+ for (let index = startIndex; index < source.length; index += 1) {
568
+ const character = source[index];
569
+ const nextCharacter = source[index + 1];
570
+
571
+ if (character === "\"" || character === "'") {
572
+ index = skipQuotedString(source, index, character) - 1;
573
+ continue;
574
+ }
575
+
576
+ if (character === "`") {
577
+ index = skipTemplateLiteral(source, index) - 1;
578
+ continue;
579
+ }
580
+
581
+ if (character === "/" && nextCharacter === "*") {
582
+ index = skipBlockComment(source, index) - 1;
583
+ continue;
584
+ }
585
+
586
+ if (character === "/" && nextCharacter === "/") {
587
+ index = skipLineComment(source, index) - 1;
588
+ continue;
589
+ }
590
+
591
+ if (character === "{") {
592
+ braceDepth += 1;
593
+ continue;
594
+ }
595
+
596
+ if (character === "}") {
597
+ if (braceDepth === 0 && bracketDepth === 0 && parenDepth === 0) {
598
+ return index;
599
+ }
600
+
601
+ braceDepth = Math.max(0, braceDepth - 1);
602
+ continue;
603
+ }
604
+
605
+ if (character === "[") {
606
+ bracketDepth += 1;
607
+ continue;
608
+ }
609
+
610
+ if (character === "]") {
611
+ bracketDepth = Math.max(0, bracketDepth - 1);
612
+ continue;
613
+ }
614
+
615
+ if (character === "(") {
616
+ parenDepth += 1;
617
+ continue;
618
+ }
619
+
620
+ if (character === ")") {
621
+ parenDepth = Math.max(0, parenDepth - 1);
622
+ continue;
623
+ }
624
+
625
+ if (character === "," && braceDepth === 0 && bracketDepth === 0 && parenDepth === 0) {
626
+ return index;
627
+ }
628
+ }
629
+
630
+ return source.length;
631
+ }
632
+
633
+ function inferTypeExpressionFromInitializer(initializerSource, scopeTypeMap) {
634
+ const trimmedInitializer = initializerSource.trim();
635
+
636
+ if (!trimmedInitializer) {
637
+ return "any";
638
+ }
639
+
640
+ if (scopeTypeMap.has(trimmedInitializer)) {
641
+ return scopeTypeMap.get(trimmedInitializer);
642
+ }
643
+
644
+ if (trimmedInitializer === "null") {
645
+ return "null";
646
+ }
647
+
648
+ if (trimmedInitializer === "true" || trimmedInitializer === "false") {
649
+ return "boolean";
650
+ }
651
+
652
+ if (/^[-+]?\d+(?:\.\d+)?$/u.test(trimmedInitializer)) {
653
+ return "number";
654
+ }
655
+
656
+ if ((trimmedInitializer.startsWith("\"") && trimmedInitializer.endsWith("\"")) || (trimmedInitializer.startsWith("'") && trimmedInitializer.endsWith("'"))) {
657
+ return "string";
658
+ }
659
+
660
+ return "any";
661
+ }
662
+
663
+ function parseObjectLiteralProperties(objectSource, scopeTypeMap) {
664
+ if (!objectSource.startsWith("{")) {
665
+ throw new Error("Expected object literal source to start with '{'.");
666
+ }
667
+
668
+ const properties = [];
669
+ let index = 1;
670
+
671
+ while (index < objectSource.length) {
672
+ const { jsDocBlock, nextIndex } = readLeadingJSDoc(objectSource, index);
673
+ index = nextIndex;
674
+
675
+ if (objectSource[index] === "}") {
676
+ break;
677
+ }
678
+
679
+ let propertyName = null;
680
+
681
+ if (objectSource.startsWith("async", index) && !isIdentifierPart(objectSource[index + 5] ?? "")) {
682
+ index = skipWhitespace(objectSource, index + 5);
683
+ }
684
+
685
+ if (objectSource[index] === "\"" || objectSource[index] === "'") {
686
+ const quoteCharacter = objectSource[index];
687
+ const endIndex = skipQuotedString(objectSource, index, quoteCharacter);
688
+ propertyName = objectSource.slice(index + 1, endIndex - 1);
689
+ index = endIndex;
690
+ } else if (isIdentifierStart(objectSource[index] ?? "")) {
691
+ const nameStart = index;
692
+ index += 1;
693
+
694
+ while (index < objectSource.length && isIdentifierPart(objectSource[index])) {
695
+ index += 1;
696
+ }
697
+
698
+ propertyName = objectSource.slice(nameStart, index);
699
+ }
700
+
701
+ if (!propertyName) {
702
+ index += 1;
703
+ continue;
704
+ }
705
+
706
+ index = skipWhitespaceAndComments(objectSource, index);
707
+
708
+ let typeExpression = "any";
709
+ let optional = false;
710
+
711
+ if (objectSource[index] === ":") {
712
+ index = skipWhitespaceAndComments(objectSource, index + 1);
713
+
714
+ if (objectSource[index] === "{") {
715
+ const objectEndIndex = findMatchingDelimiter(objectSource, index, "{", "}");
716
+
717
+ if (objectEndIndex === -1) {
718
+ throw new Error(`Could not find end of nested object literal for property ${propertyName}`);
719
+ }
720
+
721
+ const nestedProperties = parseObjectLiteralProperties(objectSource.slice(index, objectEndIndex + 1), scopeTypeMap);
722
+ typeExpression = buildObjectLiteralTypeExpression(nestedProperties);
723
+ index = objectEndIndex + 1;
724
+ } else {
725
+ const expressionEndIndex = findExpressionEnd(objectSource, index);
726
+ const initializerSource = objectSource.slice(index, expressionEndIndex);
727
+ typeExpression = jsDocBlock ? buildFunctionTypeExpressionFromJSDoc(jsDocBlock) : inferTypeExpressionFromInitializer(initializerSource, scopeTypeMap);
728
+ index = expressionEndIndex;
729
+ }
730
+ } else if (objectSource[index] === "(") {
731
+ const paramsEndIndex = findMatchingDelimiter(objectSource, index, "(", ")");
732
+
733
+ if (paramsEndIndex === -1) {
734
+ throw new Error(`Could not find end of parameter list for property ${propertyName}`);
735
+ }
736
+
737
+ index = skipWhitespaceAndComments(objectSource, paramsEndIndex + 1);
738
+
739
+ if (objectSource[index] === "{") {
740
+ const methodEndIndex = findMatchingDelimiter(objectSource, index, "{", "}");
741
+
742
+ if (methodEndIndex === -1) {
743
+ throw new Error(`Could not find end of method body for property ${propertyName}`);
744
+ }
745
+
746
+ index = methodEndIndex + 1;
747
+ }
748
+
749
+ typeExpression = jsDocBlock ? buildFunctionTypeExpressionFromJSDoc(jsDocBlock) : "(...args: any[]) => any";
750
+ } else {
751
+ typeExpression = scopeTypeMap.get(propertyName) ?? "any";
752
+ }
753
+
754
+ properties.push({
755
+ name: propertyName,
756
+ optional,
757
+ typeExpression
758
+ });
759
+
760
+ index = skipWhitespaceAndComments(objectSource, index);
761
+
762
+ if (objectSource[index] === ",") {
763
+ index += 1;
764
+ }
765
+ }
766
+
767
+ return properties;
768
+ }
769
+
770
+ function getNearestLeadingJSDoc(source, startIndex) {
771
+ let cursor = startIndex;
772
+
773
+ while (cursor > 0 && /\s/u.test(source[cursor - 1])) {
774
+ cursor -= 1;
775
+ }
776
+
777
+ if (!source.startsWith("*/", cursor - 2)) {
778
+ return null;
779
+ }
780
+
781
+ const blockStartIndex = source.lastIndexOf("/**", cursor - 2);
782
+ return blockStartIndex === -1 ? null : source.slice(blockStartIndex, cursor);
783
+ }
784
+
785
+ function extractCreateFunctionInfo(source, createFunctionName) {
786
+ const functionPattern = new RegExp(`export\\s+(?:async\\s+)?function\\s+${createFunctionName}\\s*\\(`);
787
+ const functionMatch = functionPattern.exec(source);
788
+
789
+ if (functionMatch) {
790
+ const functionIndex = functionMatch.index;
791
+ const functionBodyStartIndex = source.indexOf("{", functionIndex);
792
+ const functionBodyEndIndex = functionBodyStartIndex === -1 ? -1 : findMatchingDelimiter(source, functionBodyStartIndex, "{", "}");
793
+
794
+ if (functionBodyStartIndex === -1 || functionBodyEndIndex === -1) {
795
+ return null;
796
+ }
797
+
798
+ return {
799
+ jsDocBlock: getNearestLeadingJSDoc(source, functionIndex),
800
+ bodySource: source.slice(functionBodyStartIndex + 1, functionBodyEndIndex)
801
+ };
802
+ }
803
+
804
+ const constPattern = new RegExp(`export\\s+const\\s+${createFunctionName}\\s*=\\s*(?:async\\s*)?\\([^)]*\\)\\s*=>\\s*\\{`);
805
+ const constMatch = constPattern.exec(source);
806
+
807
+ if (!constMatch) {
808
+ return null;
809
+ }
810
+
811
+ const arrowBodyStartIndex = source.indexOf("{", constMatch.index);
812
+ const arrowBodyEndIndex = arrowBodyStartIndex === -1 ? -1 : findMatchingDelimiter(source, arrowBodyStartIndex, "{", "}");
813
+
814
+ if (arrowBodyStartIndex === -1 || arrowBodyEndIndex === -1) {
815
+ return null;
816
+ }
817
+
818
+ return {
819
+ jsDocBlock: getNearestLeadingJSDoc(source, constMatch.index),
820
+ bodySource: source.slice(arrowBodyStartIndex + 1, arrowBodyEndIndex)
821
+ };
822
+ }
823
+
824
+ function extractTopLevelReturnedObjectSource(functionBodySource, createFunctionName) {
825
+ let braceDepth = 0;
826
+ let bracketDepth = 0;
827
+ let parenDepth = 0;
828
+
829
+ for (let index = 0; index < functionBodySource.length; index += 1) {
830
+ const character = functionBodySource[index];
831
+ const nextCharacter = functionBodySource[index + 1];
832
+
833
+ if (character === "\"" || character === "'") {
834
+ index = skipQuotedString(functionBodySource, index, character) - 1;
835
+ continue;
836
+ }
837
+
838
+ if (character === "`") {
839
+ index = skipTemplateLiteral(functionBodySource, index) - 1;
840
+ continue;
841
+ }
842
+
843
+ if (character === "/" && nextCharacter === "*") {
844
+ index = skipBlockComment(functionBodySource, index) - 1;
845
+ continue;
846
+ }
847
+
848
+ if (character === "/" && nextCharacter === "/") {
849
+ index = skipLineComment(functionBodySource, index) - 1;
850
+ continue;
851
+ }
852
+
853
+ if (character === "{") {
854
+ braceDepth += 1;
855
+ continue;
856
+ }
857
+
858
+ if (character === "}") {
859
+ braceDepth = Math.max(0, braceDepth - 1);
860
+ continue;
861
+ }
862
+
863
+ if (character === "[") {
864
+ bracketDepth += 1;
865
+ continue;
866
+ }
867
+
868
+ if (character === "]") {
869
+ bracketDepth = Math.max(0, bracketDepth - 1);
870
+ continue;
871
+ }
872
+
873
+ if (character === "(") {
874
+ parenDepth += 1;
875
+ continue;
876
+ }
877
+
878
+ if (character === ")") {
879
+ parenDepth = Math.max(0, parenDepth - 1);
880
+ continue;
881
+ }
882
+
883
+ if (braceDepth === 0 && bracketDepth === 0 && parenDepth === 0 && functionBodySource.startsWith("return", index) && !isIdentifierPart(functionBodySource[index - 1] ?? "") && !isIdentifierPart(functionBodySource[index + 6] ?? "")) {
884
+ const objectStartIndex = skipWhitespaceAndComments(functionBodySource, index + 6);
885
+
886
+ if (functionBodySource[objectStartIndex] !== "{") {
887
+ continue;
888
+ }
889
+
890
+ const objectEndIndex = findMatchingDelimiter(functionBodySource, objectStartIndex, "{", "}");
891
+
892
+ if (objectEndIndex === -1) {
893
+ throw new Error(`Could not find end of returned object literal for ${createFunctionName}`);
894
+ }
895
+
896
+ return functionBodySource.slice(objectStartIndex, objectEndIndex + 1);
897
+ }
898
+ }
899
+
900
+ throw new Error(`Could not find top-level returned object literal for ${createFunctionName}`);
901
+ }
902
+
903
+ function inferReturnTypeObjectEntry(source, filePath, typeName, createFunctionName) {
904
+ const functionInfo = extractCreateFunctionInfo(source, createFunctionName);
905
+
906
+ if (!functionInfo) {
907
+ return null;
908
+ }
909
+
910
+ const returnedObjectSource = extractTopLevelReturnedObjectSource(functionInfo.bodySource, createFunctionName);
911
+ const scopeTypeMap = parseFunctionParameterTypes(functionInfo.jsDocBlock);
912
+ const properties = parseObjectLiteralProperties(returnedObjectSource, scopeTypeMap);
913
+
914
+ return {
915
+ kind: "object",
916
+ name: typeName,
917
+ properties,
918
+ filePath
919
+ };
920
+ }
921
+
359
922
  function parseBracketedType(rest) {
360
923
  if (!rest.startsWith("{")) {
361
924
  return null;
@@ -578,6 +1141,17 @@ function extractPublicTypeEntries(source, filePath) {
578
1141
  const typedefEntry = extractTypedefEntry(block);
579
1142
 
580
1143
  if (typedefEntry) {
1144
+ const inferredCreateApiName = typedefEntry.typeExpression.match(returnTypeOfCreateApiPattern)?.[1] ?? null;
1145
+
1146
+ if (inferredCreateApiName) {
1147
+ const inferredObjectEntry = inferReturnTypeObjectEntry(source, filePath, typedefEntry.name, inferredCreateApiName);
1148
+
1149
+ if (inferredObjectEntry) {
1150
+ entries.push(inferredObjectEntry);
1151
+ continue;
1152
+ }
1153
+ }
1154
+
581
1155
  if (!isSimpleImportAlias(typedefEntry.typeExpression)) {
582
1156
  entries.push({ ...typedefEntry, filePath });
583
1157
  }
@@ -926,6 +1500,7 @@ function replaceGeneratedBlock(source, startMarker, endMarker, generatedBlock, t
926
1500
  function buildRootDts(publicTypeEntries) {
927
1501
  const lines = [
928
1502
  "export * from \"./index.js\";",
1503
+ ...rootValueExportStatements,
929
1504
  ""
930
1505
  ];
931
1506