@gandalan/weblibs 1.5.24 → 1.5.25

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