@bratislava/ginis-sdk 2.1.3 → 2.2.1
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/README.md +1 -1
- package/dist/index.d.ts +36 -15
- package/dist/index.js +401 -130
- package/package.json +28 -44
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A small wrapper for most commonly used requests towards the GINIS system. Made t
|
|
|
10
10
|
|
|
11
11
|
## Using the library
|
|
12
12
|
|
|
13
|
-
To understand how the structure of `Ginis` and `urls` part of the config relates to the GINIS system, read the [GINIS section](
|
|
13
|
+
To understand how the structure of `Ginis` and `urls` part of the config relates to the GINIS system, read the [GINIS section](./docs/GINIS.md) of our documentation site.
|
|
14
14
|
|
|
15
15
|
You'll need the GINIS credentials. If interacting with the Bratislava deployment, you also need to be connected through VPN or on internal network.
|
|
16
16
|
|
package/dist/index.d.ts
CHANGED
|
@@ -191,7 +191,7 @@ declare const najdiEsuSchema: z.ZodObject<{
|
|
|
191
191
|
Aktivita: z.ZodString;
|
|
192
192
|
}, z.core.$strip>;
|
|
193
193
|
declare const najdiEsuResponseSchema: z.ZodObject<{
|
|
194
|
-
'Najdi-esu': z.
|
|
194
|
+
'Najdi-esu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
195
195
|
'Id-esu': z.ZodString;
|
|
196
196
|
'Typ-esu': z.ZodOptional<z.ZodString>;
|
|
197
197
|
Nazev: z.ZodOptional<z.ZodString>;
|
|
@@ -262,7 +262,7 @@ declare const detailElPodaniResponseSchema: z.ZodObject<{
|
|
|
262
262
|
'Spis-znacka': z.ZodOptional<z.ZodString>;
|
|
263
263
|
Znacka: z.ZodOptional<z.ZodString>;
|
|
264
264
|
}, z.core.$strip>;
|
|
265
|
-
'Navazany-dokument': z.
|
|
265
|
+
'Navazany-dokument': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
266
266
|
'Id-dokumentu': z.ZodString;
|
|
267
267
|
Vec: z.ZodOptional<z.ZodString>;
|
|
268
268
|
'Spis-znacka': z.ZodOptional<z.ZodString>;
|
|
@@ -506,7 +506,7 @@ declare const detailDokumentuResponseSchema$1: z.ZodObject<{
|
|
|
506
506
|
'Datum-doruceni': z.ZodOptional<z.ZodString>;
|
|
507
507
|
'Id-ds-odesilatele': z.ZodString;
|
|
508
508
|
}, z.core.$strip>>;
|
|
509
|
-
'Historie-dokumentu': z.
|
|
509
|
+
'Historie-dokumentu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
510
510
|
'Id-dokumentu': z.ZodString;
|
|
511
511
|
'Text-zmeny': z.ZodOptional<z.ZodString>;
|
|
512
512
|
Poznamka: z.ZodOptional<z.ZodString>;
|
|
@@ -552,7 +552,7 @@ declare const detailDokumentuResponseSchema$1: z.ZodObject<{
|
|
|
552
552
|
'Poradove-cislo-spisu': z.ZodString;
|
|
553
553
|
'Doplnek-cj': z.ZodOptional<z.ZodString>;
|
|
554
554
|
}, z.core.$strip>>;
|
|
555
|
-
'Ssl-obsah-spis': z.
|
|
555
|
+
'Ssl-obsah-spis': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
556
556
|
'Id-spisu': z.ZodString;
|
|
557
557
|
'Id-vlozeneho-dokumentu': z.ZodString;
|
|
558
558
|
'Poradove-cislo': z.ZodOptional<z.ZodString>;
|
|
@@ -580,7 +580,7 @@ declare const detailDokumentuResponseSchema$1: z.ZodObject<{
|
|
|
580
580
|
'Id-zpusob-vyrizeni': z.ZodOptional<z.ZodString>;
|
|
581
581
|
'Doplnek-cj': z.ZodOptional<z.ZodString>;
|
|
582
582
|
}, z.core.$strip>>;
|
|
583
|
-
'Prilohy-dokumentu': z.
|
|
583
|
+
'Prilohy-dokumentu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
584
584
|
'Poradove-cislo': z.ZodString;
|
|
585
585
|
Titulek: z.ZodOptional<z.ZodString>;
|
|
586
586
|
Popis: z.ZodOptional<z.ZodString>;
|
|
@@ -597,13 +597,13 @@ declare const detailDokumentuResponseSchema$1: z.ZodObject<{
|
|
|
597
597
|
'Kategorie-prilohy-txt': z.ZodOptional<z.ZodString>;
|
|
598
598
|
'Priznak-souboru-ro': z.ZodOptional<z.ZodString>;
|
|
599
599
|
}, z.core.$strip>>>>;
|
|
600
|
-
'Souvisejici-dokumenty': z.
|
|
600
|
+
'Souvisejici-dokumenty': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
601
601
|
'Typ-vazby': z.ZodString;
|
|
602
602
|
'Id-dokumentu': z.ZodString;
|
|
603
603
|
Poznamka: z.ZodOptional<z.ZodString>;
|
|
604
604
|
'Id-agendy': z.ZodString;
|
|
605
605
|
}, z.core.$strip>>>>;
|
|
606
|
-
Spisovna: z.
|
|
606
|
+
Spisovna: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
607
607
|
'Stav-ulozeni-kod': z.ZodString;
|
|
608
608
|
'Stav-ulozeni': z.ZodString;
|
|
609
609
|
'Datum-skartace': z.ZodOptional<z.ZodString>;
|
|
@@ -704,7 +704,7 @@ declare const stavPrehleduSchema: z.ZodObject<{
|
|
|
704
704
|
'Radku-celkem': z.ZodString;
|
|
705
705
|
}, z.core.$strip>;
|
|
706
706
|
declare const prehledDokumentuResponseSchema: z.ZodObject<{
|
|
707
|
-
'Prehled-dokumentu': z.
|
|
707
|
+
'Prehled-dokumentu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
708
708
|
'Id-dokumentu': z.ZodString;
|
|
709
709
|
'Id-spisu': z.ZodString;
|
|
710
710
|
'Priznak-spisu': z.ZodString;
|
|
@@ -995,7 +995,7 @@ declare const detailDokumentuResponseSchema: z.ZodObject<{
|
|
|
995
995
|
'Celkova-castka-sml': z.ZodOptional<z.ZodString>;
|
|
996
996
|
'Mena-sml': z.ZodOptional<z.ZodString>;
|
|
997
997
|
}, z.core.$strip>>;
|
|
998
|
-
'Soubory-dokumentu': z.
|
|
998
|
+
'Soubory-dokumentu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
999
999
|
'Id-souboru': z.ZodString;
|
|
1000
1000
|
Nazev: z.ZodString;
|
|
1001
1001
|
Velikost: z.ZodOptional<z.ZodString>;
|
|
@@ -1003,7 +1003,7 @@ declare const detailDokumentuResponseSchema: z.ZodObject<{
|
|
|
1003
1003
|
Poznamka: z.ZodOptional<z.ZodString>;
|
|
1004
1004
|
'Priznak-podpis': z.ZodOptional<z.ZodString>;
|
|
1005
1005
|
}, z.core.$strip>>>>;
|
|
1006
|
-
'Protistrany-sml': z.
|
|
1006
|
+
'Protistrany-sml': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1007
1007
|
'Typ-protistrany': z.ZodOptional<z.ZodString>;
|
|
1008
1008
|
Subjekt: z.ZodOptional<z.ZodString>;
|
|
1009
1009
|
'Nazev-sub': z.ZodOptional<z.ZodString>;
|
|
@@ -1040,7 +1040,27 @@ declare const nacistSouborResponseSchema: z.ZodObject<{
|
|
|
1040
1040
|
}, z.core.$strip>;
|
|
1041
1041
|
type UdeNacistSouborNacistSoubor = z.infer<typeof nacistSouborSchema>;
|
|
1042
1042
|
type UdeNacistSouborResponse = z.infer<typeof nacistSouborResponseSchema>;
|
|
1043
|
+
type UdeNacistSouborStream = Readable & {
|
|
1044
|
+
response: Promise<UdeNacistSouborResponse>;
|
|
1045
|
+
};
|
|
1043
1046
|
declare function nacistSoubor(this: Ginis, bodyObj: UdeNacistSouborRequest): Promise<UdeNacistSouborResponse>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Streaming variant downloading files from GINIS UDE (Úřední deska) service.
|
|
1049
|
+
*
|
|
1050
|
+
* **Why this exists:** The non-streaming version loads the entire SOAP XML
|
|
1051
|
+
* response into memory, parses it with xml2js, then base64-decodes the file.
|
|
1052
|
+
* For large files (50-200+ MB) this causes memory spikes of several GB
|
|
1053
|
+
* (the base64 string + parsed object + decoded buffer all coexist in memory).
|
|
1054
|
+
*
|
|
1055
|
+
* `UdeNacistSouborResponse` is exposed via a promise in `response` attribute.
|
|
1056
|
+
* The attribute `Data` in the response will always have value "placeholder",
|
|
1057
|
+
* as the actual data will be available in the readable stream instead.
|
|
1058
|
+
*
|
|
1059
|
+
* @param bodyObj - Request parameters. See `UdeNacistSouborRequest` type for details.
|
|
1060
|
+
* @returns Stream of decoded binary data with response data available in `response` attribute.
|
|
1061
|
+
* @throws {GinisError} on network errors, SOAP faults, or malformed responses.
|
|
1062
|
+
*/
|
|
1063
|
+
declare function nacistSouborStream(this: Ginis, bodyObj: UdeNacistSouborRequest): Promise<UdeNacistSouborStream>;
|
|
1044
1064
|
|
|
1045
1065
|
/**
|
|
1046
1066
|
* Full docs: https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
|
|
@@ -1121,7 +1141,7 @@ declare const dokumentySchema: z.ZodObject<{
|
|
|
1121
1141
|
'Datum-zmeny': z.ZodOptional<z.ZodString>;
|
|
1122
1142
|
}, z.core.$strip>;
|
|
1123
1143
|
declare const seznamDokumentuResponseSchema: z.ZodObject<{
|
|
1124
|
-
'Seznam-dokumentu': z.
|
|
1144
|
+
'Seznam-dokumentu': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1125
1145
|
'Id-zaznamu': z.ZodString;
|
|
1126
1146
|
Stav: z.ZodOptional<z.ZodString>;
|
|
1127
1147
|
Kategorie: z.ZodString;
|
|
@@ -1164,11 +1184,11 @@ declare const seznamDokumentuResponseSchema: z.ZodObject<{
|
|
|
1164
1184
|
'Celkova-castka-sml': z.ZodOptional<z.ZodString>;
|
|
1165
1185
|
'Mena-sml': z.ZodOptional<z.ZodString>;
|
|
1166
1186
|
}, z.core.$strip>>>>;
|
|
1167
|
-
'Sejmute-dokumenty': z.
|
|
1187
|
+
'Sejmute-dokumenty': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1168
1188
|
'Id-zaznamu': z.ZodOptional<z.ZodString>;
|
|
1169
1189
|
'Datum-zmeny': z.ZodOptional<z.ZodString>;
|
|
1170
1190
|
}, z.core.$strip>>>>;
|
|
1171
|
-
'Zrusene-dokumenty': z.
|
|
1191
|
+
'Zrusene-dokumenty': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1172
1192
|
'Id-zaznamu': z.ZodOptional<z.ZodString>;
|
|
1173
1193
|
'Datum-zmeny': z.ZodOptional<z.ZodString>;
|
|
1174
1194
|
}, z.core.$strip>>>>;
|
|
@@ -1194,7 +1214,7 @@ declare const seznamKategoriiSchema: z.ZodObject<{
|
|
|
1194
1214
|
'Pocet-archiv': z.ZodString;
|
|
1195
1215
|
}, z.core.$strip>;
|
|
1196
1216
|
declare const seznamKategoriiResponseSchema: z.ZodObject<{
|
|
1197
|
-
'Seznam-kategorii': z.
|
|
1217
|
+
'Seznam-kategorii': z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1198
1218
|
'Id-kategorie': z.ZodString;
|
|
1199
1219
|
Nazev: z.ZodOptional<z.ZodString>;
|
|
1200
1220
|
'Pocet-vyveseno': z.ZodString;
|
|
@@ -1208,6 +1228,7 @@ declare function seznamKategorii(this: Ginis, bodyObj: UdeSeznamKategoriiRequest
|
|
|
1208
1228
|
declare const _default: {
|
|
1209
1229
|
detailDokumentu: typeof detailDokumentu;
|
|
1210
1230
|
nacistSoubor: typeof nacistSoubor;
|
|
1231
|
+
nacistSouborStream: typeof nacistSouborStream;
|
|
1211
1232
|
seznamDokumentu: typeof seznamDokumentu;
|
|
1212
1233
|
seznamDokumentuFilterArchiv: typeof seznamDokumentuFilterArchiv;
|
|
1213
1234
|
seznamKategorii: typeof seznamKategorii;
|
|
@@ -1267,4 +1288,4 @@ declare class GinisError extends Error {
|
|
|
1267
1288
|
constructor(message: string, axiosError?: AxiosError);
|
|
1268
1289
|
}
|
|
1269
1290
|
|
|
1270
|
-
export { type GinDetailFunkcnihoMistaDetailFunkcnihoMista, type GinDetailFunkcnihoMistaRequest, type GinDetailFunkcnihoMistaResponse, type GinDetailReferentaDetailReferenta, type GinDetailReferentaRequest, type GinDetailReferentaResponse, type GinEditEsuRequestVytvorEsu, type GinEditEsuResponse, type GinEditEsuVytvorEsu, type GinNajdiEsuNajdiEsuItem, type GinNajdiEsuRequest, type GinNajdiEsuResponse, Ginis, type GinisConfig, GinisError, type PodDetailElPodaniDetailElPodani, type PodDetailElPodaniNavazanyDokumentItem, type PodDetailElPodaniRequest, type PodDetailElPodaniResponse, type SslDetailDokumentuCjDokumentu, type SslDetailDokumentuDoruceni, type SslDetailDokumentuEDoruceni, type SslDetailDokumentuHistorieDokumentuItem, type SslDetailDokumentuPrilohyDokumentuItem, type SslDetailDokumentuRequest, type SslDetailDokumentuResponse, type SslDetailDokumentuSouvisejiciDokumentyItem, type SslDetailDokumentuSpisovnaItem, type SslDetailDokumentuSslDokument, type SslDetailDokumentuSslObsahSpisItem, type SslDetailDokumentuSslSpis, type SslDetailDokumentuVlozenoDoSpisu, type SslDetailDokumentuWflDokument, type SslNastavitVlastnostDokumentuNastavitVlastnostDokumentu, type SslNastavitVlastnostDokumentuRequest, type SslNastavitVlastnostDokumentuResponse, type SslPrehledDokumentuPrehledDokumentuItem, type SslPrehledDokumentuRequest, type SslPrehledDokumentuRequestRizeniPrehledu, type SslPrehledDokumentuResponse, type SslPrehledDokumentuStavPrehledu, type SslPridatSouborPridatSoubor, type SslPridatSouborRequest, type SslPridatSouborResponse, type SslPrideleniPrideleni, type SslPrideleniRequest, type SslPrideleniResponse, type SslZalozCjRequest, type SslZalozCjResponse, type SslZalozCjZalozCj, type SslZalozPisemnostRequestDoruceni, type SslZalozPisemnostRequestSslDokument, type SslZalozPisemnostRequestWflDokument, type SslZalozPisemnostResponse, type SslZalozPisemnostZalozPisemnost, type SslZalozitVlastnostDokumentuRequest, type SslZalozitVlastnostDokumentuResponse, type SslZalozitVlastnostDokumentuZalozitVlastnostDokumentu, type UdeDetailDokumentuDetailDokumentu, type UdeDetailDokumentuProtistranySmlItem, type UdeDetailDokumentuRequest, type UdeDetailDokumentuResponse, type UdeDetailDokumentuSouboryDokumentuItem, type UdeNacistSouborNacistSoubor, type UdeNacistSouborRequest, type UdeNacistSouborResponse, type UdeSeznamDokumentuRequest, type UdeSeznamDokumentuResponse, type UdeSeznamDokumentuSejmuteDokumentyItem, type UdeSeznamDokumentuSeznamDokumentuItem, type UdeSeznamDokumentuZruseneDokumentyItem, type UdeSeznamKategoriiRequest, type UdeSeznamKategoriiResponse, type UdeSeznamKategoriiSeznamKategoriiItem };
|
|
1291
|
+
export { type GinDetailFunkcnihoMistaDetailFunkcnihoMista, type GinDetailFunkcnihoMistaRequest, type GinDetailFunkcnihoMistaResponse, type GinDetailReferentaDetailReferenta, type GinDetailReferentaRequest, type GinDetailReferentaResponse, type GinEditEsuRequestVytvorEsu, type GinEditEsuResponse, type GinEditEsuVytvorEsu, type GinNajdiEsuNajdiEsuItem, type GinNajdiEsuRequest, type GinNajdiEsuResponse, Ginis, type GinisConfig, GinisError, type PodDetailElPodaniDetailElPodani, type PodDetailElPodaniNavazanyDokumentItem, type PodDetailElPodaniRequest, type PodDetailElPodaniResponse, type SslDetailDokumentuCjDokumentu, type SslDetailDokumentuDoruceni, type SslDetailDokumentuEDoruceni, type SslDetailDokumentuHistorieDokumentuItem, type SslDetailDokumentuPrilohyDokumentuItem, type SslDetailDokumentuRequest, type SslDetailDokumentuResponse, type SslDetailDokumentuSouvisejiciDokumentyItem, type SslDetailDokumentuSpisovnaItem, type SslDetailDokumentuSslDokument, type SslDetailDokumentuSslObsahSpisItem, type SslDetailDokumentuSslSpis, type SslDetailDokumentuVlozenoDoSpisu, type SslDetailDokumentuWflDokument, type SslNastavitVlastnostDokumentuNastavitVlastnostDokumentu, type SslNastavitVlastnostDokumentuRequest, type SslNastavitVlastnostDokumentuResponse, type SslPrehledDokumentuPrehledDokumentuItem, type SslPrehledDokumentuRequest, type SslPrehledDokumentuRequestRizeniPrehledu, type SslPrehledDokumentuResponse, type SslPrehledDokumentuStavPrehledu, type SslPridatSouborPridatSoubor, type SslPridatSouborRequest, type SslPridatSouborResponse, type SslPrideleniPrideleni, type SslPrideleniRequest, type SslPrideleniResponse, type SslZalozCjRequest, type SslZalozCjResponse, type SslZalozCjZalozCj, type SslZalozPisemnostRequestDoruceni, type SslZalozPisemnostRequestSslDokument, type SslZalozPisemnostRequestWflDokument, type SslZalozPisemnostResponse, type SslZalozPisemnostZalozPisemnost, type SslZalozitVlastnostDokumentuRequest, type SslZalozitVlastnostDokumentuResponse, type SslZalozitVlastnostDokumentuZalozitVlastnostDokumentu, type UdeDetailDokumentuDetailDokumentu, type UdeDetailDokumentuProtistranySmlItem, type UdeDetailDokumentuRequest, type UdeDetailDokumentuResponse, type UdeDetailDokumentuSouboryDokumentuItem, type UdeNacistSouborNacistSoubor, type UdeNacistSouborRequest, type UdeNacistSouborResponse, type UdeNacistSouborStream, type UdeSeznamDokumentuRequest, type UdeSeznamDokumentuResponse, type UdeSeznamDokumentuSejmuteDokumentyItem, type UdeSeznamDokumentuSeznamDokumentuItem, type UdeSeznamDokumentuZruseneDokumentyItem, type UdeSeznamKategoriiRequest, type UdeSeznamKategoriiResponse, type UdeSeznamKategoriiSeznamKategoriiItem };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,8 @@ var import_zod = require("zod");
|
|
|
43
43
|
|
|
44
44
|
// src/utils/api.ts
|
|
45
45
|
var import_axios = __toESM(require("axios"));
|
|
46
|
+
var import_stream = require("stream");
|
|
47
|
+
var import_consumers = require("stream/consumers");
|
|
46
48
|
|
|
47
49
|
// src/utils/errors.ts
|
|
48
50
|
var GinisError = class extends Error {
|
|
@@ -77,7 +79,7 @@ async function makeAxiosRequest(axiosConfig, url, body, debug) {
|
|
|
77
79
|
responseAxios = await import_axios.default.post(url, body, requestConfig);
|
|
78
80
|
} catch (error) {
|
|
79
81
|
if (!(0, import_axios.isAxiosError)(error)) {
|
|
80
|
-
throw makeResponseDetailError(error);
|
|
82
|
+
throw await makeResponseDetailError(error);
|
|
81
83
|
}
|
|
82
84
|
if (debug) {
|
|
83
85
|
console.log("########### GINIS ERROR RESPONSE ###########");
|
|
@@ -86,7 +88,7 @@ async function makeAxiosRequest(axiosConfig, url, body, debug) {
|
|
|
86
88
|
console.log("data: ", error.response?.data);
|
|
87
89
|
console.log("########### GINIS RESPONSE END ###########");
|
|
88
90
|
}
|
|
89
|
-
throw makeResponseDetailError(error, error.response?.data);
|
|
91
|
+
throw await makeResponseDetailError(error, error.response?.data);
|
|
90
92
|
}
|
|
91
93
|
if (debug) {
|
|
92
94
|
console.log("########### GINIS RESPONSE ###########");
|
|
@@ -97,27 +99,36 @@ async function makeAxiosRequest(axiosConfig, url, body, debug) {
|
|
|
97
99
|
}
|
|
98
100
|
return responseAxios;
|
|
99
101
|
}
|
|
100
|
-
function makeResponseDetailError(error, responseData = null) {
|
|
102
|
+
async function makeResponseDetailError(error, responseData = null) {
|
|
101
103
|
if (!(error instanceof Error)) {
|
|
102
104
|
return new GinisError(
|
|
103
105
|
"Non-error passed to throwErrorFaultDetail in ginis-sdk. This should never happen."
|
|
104
106
|
);
|
|
105
107
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
+
const responseText = await (async () => {
|
|
109
|
+
if (responseData instanceof import_stream.Readable) {
|
|
110
|
+
return await (0, import_consumers.text)(responseData);
|
|
111
|
+
}
|
|
112
|
+
if (typeof responseData === "string") {
|
|
113
|
+
return responseData;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
})();
|
|
117
|
+
const errorDetail = responseText ? `${error.message}\r
|
|
118
|
+
Error response details: ${responseText}` : error.message;
|
|
108
119
|
if ((0, import_axios.isAxiosError)(error)) {
|
|
109
120
|
return new GinisError(errorDetail, error);
|
|
110
121
|
}
|
|
111
122
|
return new GinisError(errorDetail);
|
|
112
123
|
}
|
|
113
124
|
|
|
114
|
-
// src/utils/request-
|
|
115
|
-
var
|
|
125
|
+
// src/utils/request-utils.ts
|
|
126
|
+
var import_stream2 = require("stream");
|
|
116
127
|
var import_xml2js = require("xml2js");
|
|
117
|
-
function createXmlRequestConfig(
|
|
128
|
+
function createXmlRequestConfig(requestName3, requestNamespace3) {
|
|
118
129
|
return {
|
|
119
130
|
headers: {
|
|
120
|
-
SOAPAction: `${
|
|
131
|
+
SOAPAction: `${requestNamespace3}/${requestName3}`,
|
|
121
132
|
"Content-Type": "text/xml; charset=utf-8"
|
|
122
133
|
}
|
|
123
134
|
};
|
|
@@ -170,13 +181,13 @@ function createXmlRequestBody(config, requestInfo) {
|
|
|
170
181
|
</s:Body>
|
|
171
182
|
</s:Envelope>`.replaceAll(/\s*(<[^>]+>)\s*/g, "$1");
|
|
172
183
|
}
|
|
173
|
-
async function extractResponseJson(responseXml,
|
|
184
|
+
async function extractResponseJson(responseXml, requestName3, responseSchema) {
|
|
174
185
|
try {
|
|
175
186
|
const response = await (0, import_xml2js.parseStringPromise)(responseXml, {
|
|
176
187
|
explicitArray: false,
|
|
177
188
|
ignoreAttrs: true
|
|
178
189
|
});
|
|
179
|
-
const xrgContent = response?.["s:Envelope"]?.["s:Body"]?.[`${
|
|
190
|
+
const xrgContent = response?.["s:Envelope"]?.["s:Body"]?.[`${requestName3}Response`]?.[`${requestName3}Result`]?.Xrg;
|
|
180
191
|
return responseSchema.parse(xrgContent === "" ? {} : xrgContent);
|
|
181
192
|
} catch (error) {
|
|
182
193
|
const message = error instanceof Error ? `: ${error.toString()}` : "";
|
|
@@ -184,10 +195,10 @@ async function extractResponseJson(responseXml, requestName2, responseSchema) {
|
|
|
184
195
|
Response: ${responseXml}`);
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
|
-
function createMultipartRequestConfig(
|
|
198
|
+
function createMultipartRequestConfig(requestName3, requestNamespace3, boundary, requestContentId) {
|
|
188
199
|
return {
|
|
189
200
|
headers: {
|
|
190
|
-
SOAPAction: `${
|
|
201
|
+
SOAPAction: `${requestNamespace3}/${requestName3}`,
|
|
191
202
|
"Content-Type": `multipart/related;type="application/xop+xml";boundary="${boundary}";start="<${requestContentId}>";start-info="text/xml"`,
|
|
192
203
|
"MIME-version": "1.0"
|
|
193
204
|
}
|
|
@@ -213,7 +224,7 @@ Content-Type: application/octet-stream\r
|
|
|
213
224
|
`;
|
|
214
225
|
const closingBoundary = `\r
|
|
215
226
|
--${boundary}--`;
|
|
216
|
-
const requestBody = new
|
|
227
|
+
const requestBody = new import_stream2.PassThrough();
|
|
217
228
|
requestBody.write(mainRequest);
|
|
218
229
|
fileStream.pipe(requestBody, { end: false });
|
|
219
230
|
fileStream.on("end", () => {
|
|
@@ -221,7 +232,7 @@ Content-Type: application/octet-stream\r
|
|
|
221
232
|
});
|
|
222
233
|
return requestBody;
|
|
223
234
|
}
|
|
224
|
-
async function extractMultipartResponseJson(responseString,
|
|
235
|
+
async function extractMultipartResponseJson(responseString, requestName3, responseSchema) {
|
|
225
236
|
const startTag = "<s:Envelope";
|
|
226
237
|
const endTag = "</s:Envelope>";
|
|
227
238
|
let responseXml;
|
|
@@ -237,7 +248,7 @@ async function extractMultipartResponseJson(responseString, requestName2, respon
|
|
|
237
248
|
Response: ${responseString}`
|
|
238
249
|
);
|
|
239
250
|
}
|
|
240
|
-
return await extractResponseJson(responseXml,
|
|
251
|
+
return await extractResponseJson(responseXml, requestName3, responseSchema);
|
|
241
252
|
}
|
|
242
253
|
|
|
243
254
|
// src/api/gin/Detail-funkcniho-mista.ts
|
|
@@ -279,22 +290,24 @@ var detailFunkcnihoMistaResponseSchema = import_zod.z.object({
|
|
|
279
290
|
});
|
|
280
291
|
async function detailFunkcnihoMista(bodyObj) {
|
|
281
292
|
const url = this.config.urls.gin;
|
|
282
|
-
if (!url)
|
|
283
|
-
|
|
284
|
-
|
|
293
|
+
if (!url) {
|
|
294
|
+
throw new GinisError("GINIS SDK Error: Missing GIN url in GINIS config");
|
|
295
|
+
}
|
|
296
|
+
const requestName3 = "Detail-funkcniho-mista";
|
|
297
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-gin/v_1.0.0.0";
|
|
285
298
|
const response = await makeAxiosRequest(
|
|
286
|
-
createXmlRequestConfig(
|
|
299
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
287
300
|
url,
|
|
288
301
|
createXmlRequestBody(this.config, {
|
|
289
|
-
name:
|
|
290
|
-
namespace:
|
|
302
|
+
name: requestName3,
|
|
303
|
+
namespace: requestNamespace3,
|
|
291
304
|
xrgNamespace: "http://www.gordic.cz/xrg/gin/detail-funkcniho-mista/request/v_1.0.0.0",
|
|
292
305
|
paramsBodies: [bodyObj],
|
|
293
306
|
paramOrders: detailFunkcnihoMistaParamOrders
|
|
294
307
|
}),
|
|
295
308
|
this.config.debug
|
|
296
309
|
);
|
|
297
|
-
return await extractResponseJson(response.data,
|
|
310
|
+
return await extractResponseJson(response.data, requestName3, detailFunkcnihoMistaResponseSchema);
|
|
298
311
|
}
|
|
299
312
|
|
|
300
313
|
// src/api/gin/Detail-referenta.ts
|
|
@@ -347,22 +360,24 @@ var detailReferentaResponseSchema = import_zod2.z.object({
|
|
|
347
360
|
});
|
|
348
361
|
async function detailReferenta(bodyObj) {
|
|
349
362
|
const url = this.config.urls.gin;
|
|
350
|
-
if (!url)
|
|
351
|
-
|
|
352
|
-
|
|
363
|
+
if (!url) {
|
|
364
|
+
throw new GinisError("GINIS SDK Error: Missing GIN url in GINIS config");
|
|
365
|
+
}
|
|
366
|
+
const requestName3 = "Detail-referenta";
|
|
367
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-gin/v_1.0.0.0";
|
|
353
368
|
const response = await makeAxiosRequest(
|
|
354
|
-
createXmlRequestConfig(
|
|
369
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
355
370
|
url,
|
|
356
371
|
createXmlRequestBody(this.config, {
|
|
357
|
-
name:
|
|
358
|
-
namespace:
|
|
372
|
+
name: requestName3,
|
|
373
|
+
namespace: requestNamespace3,
|
|
359
374
|
xrgNamespace: "http://www.gordic.cz/xrg/gin/detail-referenta/request/v_1.0.0.0",
|
|
360
375
|
paramsBodies: [bodyObj],
|
|
361
376
|
paramOrders: detailReferentaParamOrders
|
|
362
377
|
}),
|
|
363
378
|
this.config.debug
|
|
364
379
|
);
|
|
365
|
-
return await extractResponseJson(response.data,
|
|
380
|
+
return await extractResponseJson(response.data, requestName3, detailReferentaResponseSchema);
|
|
366
381
|
}
|
|
367
382
|
|
|
368
383
|
// src/api/gin/Edit-esu.ts
|
|
@@ -436,22 +451,24 @@ var editEsuResponseSchema = import_zod3.z.object({
|
|
|
436
451
|
});
|
|
437
452
|
async function editEsu(bodyObj) {
|
|
438
453
|
const url = this.config.urls.gin;
|
|
439
|
-
if (!url)
|
|
440
|
-
|
|
441
|
-
|
|
454
|
+
if (!url) {
|
|
455
|
+
throw new GinisError("GINIS SDK Error: Missing GIN url in GINIS config");
|
|
456
|
+
}
|
|
457
|
+
const requestName3 = "Edit-esu";
|
|
458
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-gin/v_1.0.0.0";
|
|
442
459
|
const response = await makeAxiosRequest(
|
|
443
|
-
createXmlRequestConfig(
|
|
460
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
444
461
|
url,
|
|
445
462
|
createXmlRequestBody(this.config, {
|
|
446
|
-
name:
|
|
447
|
-
namespace:
|
|
463
|
+
name: requestName3,
|
|
464
|
+
namespace: requestNamespace3,
|
|
448
465
|
xrgNamespace: "http://www.gordic.cz/xrg/gin/esu/vytvor-esu/request/v_1.0.0.0",
|
|
449
466
|
paramsBodies: [bodyObj],
|
|
450
467
|
paramOrders: editEsuParamOrders
|
|
451
468
|
}),
|
|
452
469
|
this.config.debug
|
|
453
470
|
);
|
|
454
|
-
return await extractResponseJson(response.data,
|
|
471
|
+
return await extractResponseJson(response.data, requestName3, editEsuResponseSchema);
|
|
455
472
|
}
|
|
456
473
|
|
|
457
474
|
// src/api/gin/Najdi-esu.ts
|
|
@@ -461,7 +478,9 @@ var import_zod5 = require("zod");
|
|
|
461
478
|
var import_zod4 = require("zod");
|
|
462
479
|
function coercedArray(schema) {
|
|
463
480
|
return import_zod4.z.preprocess((val) => {
|
|
464
|
-
if (val === void 0 || Array.isArray(val))
|
|
481
|
+
if (val === void 0 || Array.isArray(val)) {
|
|
482
|
+
return val;
|
|
483
|
+
}
|
|
465
484
|
return schema.safeParse(val).success ? [val] : val;
|
|
466
485
|
}, import_zod4.z.array(schema).default([]));
|
|
467
486
|
}
|
|
@@ -556,22 +575,24 @@ var najdiEsuResponseSchema = import_zod5.z.object({
|
|
|
556
575
|
});
|
|
557
576
|
async function najdiEsu(requestNajdiEsu, requestRizeniPrehledu) {
|
|
558
577
|
const url = this.config.urls.gin;
|
|
559
|
-
if (!url)
|
|
560
|
-
|
|
561
|
-
|
|
578
|
+
if (!url) {
|
|
579
|
+
throw new GinisError("GINIS SDK Error: Missing GIN url in GINIS config");
|
|
580
|
+
}
|
|
581
|
+
const requestName3 = "Najdi-esu";
|
|
582
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-gin/v_1.0.0.0";
|
|
562
583
|
const response = await makeAxiosRequest(
|
|
563
|
-
createXmlRequestConfig(
|
|
584
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
564
585
|
url,
|
|
565
586
|
createXmlRequestBody(this.config, {
|
|
566
|
-
name:
|
|
567
|
-
namespace:
|
|
587
|
+
name: requestName3,
|
|
588
|
+
namespace: requestNamespace3,
|
|
568
589
|
xrgNamespace: "http://www.gordic.cz/xrg/gin/esu/najdi-esu/request/v_1.0.0.0",
|
|
569
590
|
paramsBodies: [requestNajdiEsu, requestRizeniPrehledu],
|
|
570
591
|
paramOrders: najdiEsuParamOrders
|
|
571
592
|
}),
|
|
572
593
|
this.config.debug
|
|
573
594
|
);
|
|
574
|
-
return await extractResponseJson(response.data,
|
|
595
|
+
return await extractResponseJson(response.data, requestName3, najdiEsuResponseSchema);
|
|
575
596
|
}
|
|
576
597
|
|
|
577
598
|
// src/api/gin/index.ts
|
|
@@ -622,22 +643,24 @@ var detailElPodaniResponseSchema = import_zod6.z.object({
|
|
|
622
643
|
});
|
|
623
644
|
async function detailElPodani(bodyObj) {
|
|
624
645
|
const url = this.config.urls.pod;
|
|
625
|
-
if (!url)
|
|
626
|
-
|
|
627
|
-
|
|
646
|
+
if (!url) {
|
|
647
|
+
throw new GinisError("GINIS SDK Error: Missing POD url in GINIS config");
|
|
648
|
+
}
|
|
649
|
+
const requestName3 = "Detail-el-podani";
|
|
650
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-pod/v_1.0.0.0";
|
|
628
651
|
const response = await makeAxiosRequest(
|
|
629
|
-
createXmlRequestConfig(
|
|
652
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
630
653
|
url,
|
|
631
654
|
createXmlRequestBody(this.config, {
|
|
632
|
-
name:
|
|
633
|
-
namespace:
|
|
655
|
+
name: requestName3,
|
|
656
|
+
namespace: requestNamespace3,
|
|
634
657
|
xrgNamespace: "http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0",
|
|
635
658
|
paramsBodies: [bodyObj],
|
|
636
659
|
paramOrders: detailElPodaniParamOrders
|
|
637
660
|
}),
|
|
638
661
|
this.config.debug
|
|
639
662
|
);
|
|
640
|
-
return await extractResponseJson(response.data,
|
|
663
|
+
return await extractResponseJson(response.data, requestName3, detailElPodaniResponseSchema);
|
|
641
664
|
}
|
|
642
665
|
|
|
643
666
|
// src/api/pod/index.ts
|
|
@@ -845,22 +868,24 @@ var detailDokumentuResponseSchema = import_zod7.z.object({
|
|
|
845
868
|
});
|
|
846
869
|
async function detailDokumentu(bodyObj) {
|
|
847
870
|
const url = this.config.urls.ssl;
|
|
848
|
-
if (!url)
|
|
849
|
-
|
|
850
|
-
|
|
871
|
+
if (!url) {
|
|
872
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
873
|
+
}
|
|
874
|
+
const requestName3 = "Detail-dokumentu";
|
|
875
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
851
876
|
const response = await makeAxiosRequest(
|
|
852
|
-
createXmlRequestConfig(
|
|
877
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
853
878
|
url,
|
|
854
879
|
createXmlRequestBody(this.config, {
|
|
855
|
-
name:
|
|
856
|
-
namespace:
|
|
880
|
+
name: requestName3,
|
|
881
|
+
namespace: requestNamespace3,
|
|
857
882
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-dokumentu/request/v_1.0.0.0",
|
|
858
883
|
paramsBodies: [bodyObj],
|
|
859
884
|
paramOrders: detailDokumentuParamOrders
|
|
860
885
|
}),
|
|
861
886
|
this.config.debug
|
|
862
887
|
);
|
|
863
|
-
return await extractResponseJson(response.data,
|
|
888
|
+
return await extractResponseJson(response.data, requestName3, detailDokumentuResponseSchema);
|
|
864
889
|
}
|
|
865
890
|
|
|
866
891
|
// src/api/ssl/Nastavit-vlastnost-dokumentu.ts
|
|
@@ -897,15 +922,17 @@ var nastavitVlastnostDokumentuResponseSchema = import_zod8.z.object({
|
|
|
897
922
|
});
|
|
898
923
|
async function nastavitVlastnostDokumentu(bodyObj) {
|
|
899
924
|
const url = this.config.urls.ssl;
|
|
900
|
-
if (!url)
|
|
901
|
-
|
|
902
|
-
|
|
925
|
+
if (!url) {
|
|
926
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
927
|
+
}
|
|
928
|
+
const requestName3 = "Nastavit-vlastnost-dokumentu";
|
|
929
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
903
930
|
const response = await makeAxiosRequest(
|
|
904
|
-
createXmlRequestConfig(
|
|
931
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
905
932
|
url,
|
|
906
933
|
createXmlRequestBody(this.config, {
|
|
907
|
-
name:
|
|
908
|
-
namespace:
|
|
934
|
+
name: requestName3,
|
|
935
|
+
namespace: requestNamespace3,
|
|
909
936
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/nastavit-vlastnost-dokumentu/request/v_1.0.0.0",
|
|
910
937
|
paramsBodies: [bodyObj],
|
|
911
938
|
paramOrders: nastavitVlastnostDokumentuParamOrders
|
|
@@ -914,7 +941,7 @@ async function nastavitVlastnostDokumentu(bodyObj) {
|
|
|
914
941
|
);
|
|
915
942
|
return await extractResponseJson(
|
|
916
943
|
response.data,
|
|
917
|
-
|
|
944
|
+
requestName3,
|
|
918
945
|
nastavitVlastnostDokumentuResponseSchema
|
|
919
946
|
);
|
|
920
947
|
}
|
|
@@ -1012,26 +1039,28 @@ var prehledDokumentuResponseSchema = import_zod9.z.object({
|
|
|
1012
1039
|
});
|
|
1013
1040
|
async function prehledDokumentu(requestPrehledDokumentu, requestRizeniPrehledu) {
|
|
1014
1041
|
const url = this.config.urls.ssl;
|
|
1015
|
-
if (!url)
|
|
1016
|
-
|
|
1017
|
-
|
|
1042
|
+
if (!url) {
|
|
1043
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1044
|
+
}
|
|
1045
|
+
const requestName3 = "Prehled-dokumentu";
|
|
1046
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
1018
1047
|
const response = await makeAxiosRequest(
|
|
1019
|
-
createXmlRequestConfig(
|
|
1048
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1020
1049
|
url,
|
|
1021
1050
|
createXmlRequestBody(this.config, {
|
|
1022
|
-
name:
|
|
1023
|
-
namespace:
|
|
1051
|
+
name: requestName3,
|
|
1052
|
+
namespace: requestNamespace3,
|
|
1024
1053
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/prehled-dokumentu/request/v_1.0.0.0",
|
|
1025
1054
|
paramsBodies: [requestPrehledDokumentu, requestRizeniPrehledu],
|
|
1026
1055
|
paramOrders: prehledDokumentuParamOrders
|
|
1027
1056
|
}),
|
|
1028
1057
|
this.config.debug
|
|
1029
1058
|
);
|
|
1030
|
-
return await extractResponseJson(response.data,
|
|
1059
|
+
return await extractResponseJson(response.data, requestName3, prehledDokumentuResponseSchema);
|
|
1031
1060
|
}
|
|
1032
1061
|
|
|
1033
1062
|
// src/api/ssl/Pridat-soubor.ts
|
|
1034
|
-
var
|
|
1063
|
+
var import_stream3 = require("stream");
|
|
1035
1064
|
var import_uuid = require("uuid");
|
|
1036
1065
|
var import_zod10 = require("zod");
|
|
1037
1066
|
var pridatSouborRequestProperties = [
|
|
@@ -1066,7 +1095,9 @@ var requestNamespace = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
|
1066
1095
|
var requestXrgNamespace = "http://www.gordic.cz/xrg/ssl/wfl-dokument/pridat-soubor/request/v_1.0.0.0";
|
|
1067
1096
|
async function pridatSoubor(bodyObj) {
|
|
1068
1097
|
const url = this.config.urls.ssl;
|
|
1069
|
-
if (!url)
|
|
1098
|
+
if (!url) {
|
|
1099
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1100
|
+
}
|
|
1070
1101
|
const requestInfo = {
|
|
1071
1102
|
name: requestName,
|
|
1072
1103
|
namespace: requestNamespace,
|
|
@@ -1085,14 +1116,16 @@ async function pridatSoubor(bodyObj) {
|
|
|
1085
1116
|
async function pridatSouborMtom(bodyObj, fileStream) {
|
|
1086
1117
|
let fileContent = fileStream;
|
|
1087
1118
|
if (!fileContent) {
|
|
1088
|
-
fileContent = new
|
|
1119
|
+
fileContent = new import_stream3.Readable({
|
|
1089
1120
|
read() {
|
|
1090
1121
|
this.push(null);
|
|
1091
1122
|
}
|
|
1092
1123
|
});
|
|
1093
1124
|
}
|
|
1094
1125
|
const url = this.config.urls.ssl_mtom;
|
|
1095
|
-
if (!url)
|
|
1126
|
+
if (!url) {
|
|
1127
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1128
|
+
}
|
|
1096
1129
|
const requestInfo = {
|
|
1097
1130
|
name: requestName,
|
|
1098
1131
|
namespace: requestNamespace,
|
|
@@ -1151,22 +1184,24 @@ var prideleniResponseSchema = import_zod11.z.object({
|
|
|
1151
1184
|
});
|
|
1152
1185
|
async function prideleni(bodyObj) {
|
|
1153
1186
|
const url = this.config.urls.ssl;
|
|
1154
|
-
if (!url)
|
|
1155
|
-
|
|
1156
|
-
|
|
1187
|
+
if (!url) {
|
|
1188
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1189
|
+
}
|
|
1190
|
+
const requestName3 = "Prideleni";
|
|
1191
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
1157
1192
|
const response = await makeAxiosRequest(
|
|
1158
|
-
createXmlRequestConfig(
|
|
1193
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1159
1194
|
url,
|
|
1160
1195
|
createXmlRequestBody(this.config, {
|
|
1161
|
-
name:
|
|
1162
|
-
namespace:
|
|
1196
|
+
name: requestName3,
|
|
1197
|
+
namespace: requestNamespace3,
|
|
1163
1198
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/prideleni/request/v_1.0.0.0",
|
|
1164
1199
|
paramsBodies: [bodyObj],
|
|
1165
1200
|
paramOrders: prideleniParamOrders
|
|
1166
1201
|
}),
|
|
1167
1202
|
this.config.debug
|
|
1168
1203
|
);
|
|
1169
|
-
return await extractResponseJson(response.data,
|
|
1204
|
+
return await extractResponseJson(response.data, requestName3, prideleniResponseSchema);
|
|
1170
1205
|
}
|
|
1171
1206
|
|
|
1172
1207
|
// src/api/ssl/Zaloz-cj.ts
|
|
@@ -1191,22 +1226,24 @@ var zalozCjResponseSchema = import_zod12.z.object({
|
|
|
1191
1226
|
});
|
|
1192
1227
|
async function zalozCj(bodyObj) {
|
|
1193
1228
|
const url = this.config.urls.ssl;
|
|
1194
|
-
if (!url)
|
|
1195
|
-
|
|
1196
|
-
|
|
1229
|
+
if (!url) {
|
|
1230
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1231
|
+
}
|
|
1232
|
+
const requestName3 = "Zaloz-cj";
|
|
1233
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
1197
1234
|
const response = await makeAxiosRequest(
|
|
1198
|
-
createXmlRequestConfig(
|
|
1235
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1199
1236
|
url,
|
|
1200
1237
|
createXmlRequestBody(this.config, {
|
|
1201
|
-
name:
|
|
1202
|
-
namespace:
|
|
1238
|
+
name: requestName3,
|
|
1239
|
+
namespace: requestNamespace3,
|
|
1203
1240
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/zaloz-cj/request/v_1.0.0.0",
|
|
1204
1241
|
paramsBodies: [bodyObj],
|
|
1205
1242
|
paramOrders: zalozCjParamOrders
|
|
1206
1243
|
}),
|
|
1207
1244
|
this.config.debug
|
|
1208
1245
|
);
|
|
1209
|
-
return await extractResponseJson(response.data,
|
|
1246
|
+
return await extractResponseJson(response.data, requestName3, zalozCjResponseSchema);
|
|
1210
1247
|
}
|
|
1211
1248
|
|
|
1212
1249
|
// src/api/ssl/Zaloz-pisemnost.ts
|
|
@@ -1278,22 +1315,24 @@ var zalozPisemnostResponseSchema = import_zod13.z.object({
|
|
|
1278
1315
|
});
|
|
1279
1316
|
async function zalozPisemnost(requestWflDokument, requestDoruceni, requestSslDokument) {
|
|
1280
1317
|
const url = this.config.urls.ssl;
|
|
1281
|
-
if (!url)
|
|
1282
|
-
|
|
1283
|
-
|
|
1318
|
+
if (!url) {
|
|
1319
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1320
|
+
}
|
|
1321
|
+
const requestName3 = "Zaloz-pisemnost";
|
|
1322
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
1284
1323
|
const response = await makeAxiosRequest(
|
|
1285
|
-
createXmlRequestConfig(
|
|
1324
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1286
1325
|
url,
|
|
1287
1326
|
createXmlRequestBody(this.config, {
|
|
1288
|
-
name:
|
|
1289
|
-
namespace:
|
|
1327
|
+
name: requestName3,
|
|
1328
|
+
namespace: requestNamespace3,
|
|
1290
1329
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/zaloz-pisemnost/request/v_1.0.0.0",
|
|
1291
1330
|
paramsBodies: [requestWflDokument, requestDoruceni, requestSslDokument],
|
|
1292
1331
|
paramOrders: prehledDokumentuParamOrders2
|
|
1293
1332
|
}),
|
|
1294
1333
|
this.config.debug
|
|
1295
1334
|
);
|
|
1296
|
-
return await extractResponseJson(response.data,
|
|
1335
|
+
return await extractResponseJson(response.data, requestName3, zalozPisemnostResponseSchema);
|
|
1297
1336
|
}
|
|
1298
1337
|
|
|
1299
1338
|
// src/api/ssl/Zalozit-vlastnost-dokumentu.ts
|
|
@@ -1322,15 +1361,17 @@ var zalozitVlastnostDokumentuResponseSchema = import_zod14.z.object({
|
|
|
1322
1361
|
});
|
|
1323
1362
|
async function zalozitVlastnostDokumentu(bodyObj) {
|
|
1324
1363
|
const url = this.config.urls.ssl;
|
|
1325
|
-
if (!url)
|
|
1326
|
-
|
|
1327
|
-
|
|
1364
|
+
if (!url) {
|
|
1365
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
1366
|
+
}
|
|
1367
|
+
const requestName3 = "Zalozit-vlastnost-dokumentu";
|
|
1368
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ssl/v_1.0.0.0";
|
|
1328
1369
|
const response = await makeAxiosRequest(
|
|
1329
|
-
createXmlRequestConfig(
|
|
1370
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1330
1371
|
url,
|
|
1331
1372
|
createXmlRequestBody(this.config, {
|
|
1332
|
-
name:
|
|
1333
|
-
namespace:
|
|
1373
|
+
name: requestName3,
|
|
1374
|
+
namespace: requestNamespace3,
|
|
1334
1375
|
xrgNamespace: "http://www.gordic.cz/xrg/ssl/wfl-dokument/zalozit-vlastnost-dokumentu/request/v_1.0.0.0",
|
|
1335
1376
|
paramsBodies: [bodyObj],
|
|
1336
1377
|
paramOrders: zalozitVlastnostDokumentuParamOrders
|
|
@@ -1339,7 +1380,7 @@ async function zalozitVlastnostDokumentu(bodyObj) {
|
|
|
1339
1380
|
);
|
|
1340
1381
|
return await extractResponseJson(
|
|
1341
1382
|
response.data,
|
|
1342
|
-
|
|
1383
|
+
requestName3,
|
|
1343
1384
|
zalozitVlastnostDokumentuResponseSchema
|
|
1344
1385
|
);
|
|
1345
1386
|
}
|
|
@@ -1491,26 +1532,217 @@ var detailDokumentuResponseSchema2 = import_zod15.z.object({
|
|
|
1491
1532
|
});
|
|
1492
1533
|
async function detailDokumentu2(bodyObj) {
|
|
1493
1534
|
const url = this.config.urls.ude;
|
|
1494
|
-
if (!url)
|
|
1495
|
-
|
|
1496
|
-
|
|
1535
|
+
if (!url) {
|
|
1536
|
+
throw new GinisError("GINIS SDK Error: Missing UDE url in GINIS config");
|
|
1537
|
+
}
|
|
1538
|
+
const requestName3 = "Detail-dokumentu";
|
|
1539
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0";
|
|
1497
1540
|
const response = await makeAxiosRequest(
|
|
1498
|
-
createXmlRequestConfig(
|
|
1541
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1499
1542
|
url,
|
|
1500
1543
|
createXmlRequestBody(this.config, {
|
|
1501
|
-
name:
|
|
1502
|
-
namespace:
|
|
1544
|
+
name: requestName3,
|
|
1545
|
+
namespace: requestNamespace3,
|
|
1503
1546
|
xrgNamespace: "http://www.gordic.cz/xrg/ude/detail-dokumentu/request/v_1.0.0.0",
|
|
1504
1547
|
paramsBodies: [bodyObj],
|
|
1505
1548
|
paramOrders: detailDokumentuParamOrders2
|
|
1506
1549
|
}),
|
|
1507
1550
|
this.config.debug
|
|
1508
1551
|
);
|
|
1509
|
-
return await extractResponseJson(response.data,
|
|
1552
|
+
return await extractResponseJson(response.data, requestName3, detailDokumentuResponseSchema2);
|
|
1510
1553
|
}
|
|
1511
1554
|
|
|
1512
1555
|
// src/api/ude/Nacist-soubor.ts
|
|
1556
|
+
var import_stream5 = require("stream");
|
|
1513
1557
|
var import_zod16 = require("zod");
|
|
1558
|
+
|
|
1559
|
+
// src/utils/stream-utils.ts
|
|
1560
|
+
var import_stream4 = require("stream");
|
|
1561
|
+
var DATA_OPEN = "<Data>";
|
|
1562
|
+
var DATA_CLOSE = "</Data>";
|
|
1563
|
+
var DATA_PLACEHOLDER = `${DATA_OPEN}placeholder${DATA_CLOSE}`;
|
|
1564
|
+
var XmlBase64DataStreamParser = class extends import_stream4.Transform {
|
|
1565
|
+
responseValidation;
|
|
1566
|
+
resolveResponse;
|
|
1567
|
+
rejectResponse;
|
|
1568
|
+
responseSettled = false;
|
|
1569
|
+
/** Parsed response payload resolved when stream parsing/validation completes. */
|
|
1570
|
+
response;
|
|
1571
|
+
/** Accumulates XML bytes before <Data> — only a few hundred bytes. */
|
|
1572
|
+
headerBuf = "";
|
|
1573
|
+
/**
|
|
1574
|
+
* Holds the last 6 chars of each data chunk. This is needed because
|
|
1575
|
+
* `</Data>` (7 chars) could be split across two HTTP chunks — without
|
|
1576
|
+
* this buffer we might accidentally decode part of the closing tag as base64.
|
|
1577
|
+
*/
|
|
1578
|
+
dataTailBuf = "";
|
|
1579
|
+
/**
|
|
1580
|
+
* Holds 0-3 leftover base64 characters between chunks. Base64 decoding
|
|
1581
|
+
* requires input lengths that are multiples of 4, so any remainder from
|
|
1582
|
+
* the previous chunk is prepended to the next one.
|
|
1583
|
+
*/
|
|
1584
|
+
base64Rem = "";
|
|
1585
|
+
/**
|
|
1586
|
+
* A lightweight copy of the full XML response with the huge base64 content
|
|
1587
|
+
* replaced by `<Data>placeholder</Data>`. Used in `_flush` for zod validation
|
|
1588
|
+
* of the SOAP envelope structure without holding the actual file data in memory.
|
|
1589
|
+
*/
|
|
1590
|
+
skeleton = "";
|
|
1591
|
+
state = "header";
|
|
1592
|
+
constructor(config) {
|
|
1593
|
+
super();
|
|
1594
|
+
this.responseValidation = config.responseValidation;
|
|
1595
|
+
this.response = new Promise((resolve, reject) => {
|
|
1596
|
+
this.resolveResponse = resolve;
|
|
1597
|
+
this.rejectResponse = reject;
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
_transform(chunk, _encoding, callback) {
|
|
1601
|
+
try {
|
|
1602
|
+
const str = chunk.toString("utf-8");
|
|
1603
|
+
if (this.state === "header") {
|
|
1604
|
+
this.handleHeader(str);
|
|
1605
|
+
} else if (this.state === "data") {
|
|
1606
|
+
this.handleData(str);
|
|
1607
|
+
} else {
|
|
1608
|
+
this.handleTail(str);
|
|
1609
|
+
}
|
|
1610
|
+
callback();
|
|
1611
|
+
} catch (error) {
|
|
1612
|
+
callback(error instanceof Error ? error : new Error(String(error)));
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Called when the input stream ends. Validates the skeleton XML via
|
|
1617
|
+
* `extractResponseJson` using configured `requestName` and `responseSchema`
|
|
1618
|
+
* from constructor config. If the SOAP envelope is malformed, contains a
|
|
1619
|
+
* fault, or is missing required fields, the stream emits an error.
|
|
1620
|
+
*
|
|
1621
|
+
* Validation runs _after_ all data chunks have been pushed but _before_
|
|
1622
|
+
* the 'end' event — so the consumer's error handler will fire if it fails.
|
|
1623
|
+
*/
|
|
1624
|
+
_flush(callback) {
|
|
1625
|
+
if (this.state === "data") {
|
|
1626
|
+
const error = new GinisError("Response stream ended before </Data> was found");
|
|
1627
|
+
this.setResponseError(error);
|
|
1628
|
+
callback(error);
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
if (this.state === "header") {
|
|
1632
|
+
this.skeleton = this.headerBuf;
|
|
1633
|
+
}
|
|
1634
|
+
extractResponseJson(
|
|
1635
|
+
this.skeleton,
|
|
1636
|
+
this.responseValidation.requestName,
|
|
1637
|
+
this.responseValidation.responseSchema
|
|
1638
|
+
).then((parsedResponse) => {
|
|
1639
|
+
this.setResponseValue(parsedResponse);
|
|
1640
|
+
callback();
|
|
1641
|
+
}).catch((error) => {
|
|
1642
|
+
const responseError = error instanceof Error ? error : new GinisError(String(error));
|
|
1643
|
+
this.setResponseError(responseError);
|
|
1644
|
+
callback(responseError);
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
_destroy(error, callback) {
|
|
1648
|
+
if (error) {
|
|
1649
|
+
this.setResponseError(error);
|
|
1650
|
+
}
|
|
1651
|
+
callback(error);
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Accumulates the XML header. Once `<Data>` is found, saves everything
|
|
1655
|
+
* before it to the skeleton (with a placeholder instead of actual base64),
|
|
1656
|
+
* emits `'ready'` so the outer function knows data is flowing, and
|
|
1657
|
+
* transitions to the `data` state.
|
|
1658
|
+
*/
|
|
1659
|
+
handleHeader(str) {
|
|
1660
|
+
this.headerBuf += str;
|
|
1661
|
+
const dataOpenIndex = this.headerBuf.indexOf(DATA_OPEN);
|
|
1662
|
+
if (dataOpenIndex === -1) {
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
const afterData = this.headerBuf.substring(dataOpenIndex + DATA_OPEN.length);
|
|
1666
|
+
this.skeleton = this.headerBuf.substring(0, dataOpenIndex) + DATA_PLACEHOLDER;
|
|
1667
|
+
this.headerBuf = "";
|
|
1668
|
+
this.state = "data";
|
|
1669
|
+
this.emit("ready");
|
|
1670
|
+
if (afterData.length > 0) {
|
|
1671
|
+
this.handleData(afterData);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Processes a chunk of base64 text from inside `<Data>...</Data>`.
|
|
1676
|
+
* Prepends the previous tail buffer and checks for the closing tag.
|
|
1677
|
+
* When `</Data>` is found, appends the trailing XML to the skeleton
|
|
1678
|
+
* and transitions to the `tail` state.
|
|
1679
|
+
*/
|
|
1680
|
+
handleData(str) {
|
|
1681
|
+
const combined = this.dataTailBuf + str;
|
|
1682
|
+
const dataCloseIndex = combined.indexOf(DATA_CLOSE);
|
|
1683
|
+
if (dataCloseIndex !== -1) {
|
|
1684
|
+
this.decodeBase64(combined.substring(0, dataCloseIndex));
|
|
1685
|
+
this.flushBase64();
|
|
1686
|
+
this.dataTailBuf = "";
|
|
1687
|
+
this.skeleton += combined.substring(dataCloseIndex + DATA_CLOSE.length);
|
|
1688
|
+
this.state = "tail";
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const tailSize = DATA_CLOSE.length - 1;
|
|
1692
|
+
if (combined.length > tailSize) {
|
|
1693
|
+
this.decodeBase64(combined.substring(0, combined.length - tailSize));
|
|
1694
|
+
this.dataTailBuf = combined.substring(combined.length - tailSize);
|
|
1695
|
+
} else {
|
|
1696
|
+
this.dataTailBuf = combined;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Collects the closing XML tags after `</Data>` into the skeleton.
|
|
1701
|
+
* These are only a few bytes, and are needed for zod validation in `_flush`.
|
|
1702
|
+
*/
|
|
1703
|
+
handleTail(str) {
|
|
1704
|
+
this.skeleton += str;
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Decodes a chunk of base64 text to binary and pushes it downstream.
|
|
1708
|
+
* Only decodes up to the last multiple-of-4 boundary; leftover chars
|
|
1709
|
+
* (0-3) are saved in `base64Rem` and prepended to the next chunk.
|
|
1710
|
+
*/
|
|
1711
|
+
decodeBase64(str) {
|
|
1712
|
+
if (str.length === 0) {
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
const full = this.base64Rem + str;
|
|
1716
|
+
const aligned = full.length - full.length % 4;
|
|
1717
|
+
if (aligned > 0) {
|
|
1718
|
+
this.push(Buffer.from(full.substring(0, aligned), "base64"));
|
|
1719
|
+
}
|
|
1720
|
+
this.base64Rem = full.substring(aligned);
|
|
1721
|
+
}
|
|
1722
|
+
/** Decodes and pushes any remaining base64 chars (final padding). */
|
|
1723
|
+
flushBase64() {
|
|
1724
|
+
if (this.base64Rem.length > 0) {
|
|
1725
|
+
this.push(Buffer.from(this.base64Rem, "base64"));
|
|
1726
|
+
this.base64Rem = "";
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
setResponseValue(value) {
|
|
1730
|
+
if (this.responseSettled) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
this.responseSettled = true;
|
|
1734
|
+
this.resolveResponse(value);
|
|
1735
|
+
}
|
|
1736
|
+
setResponseError(error) {
|
|
1737
|
+
if (this.responseSettled) {
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
this.responseSettled = true;
|
|
1741
|
+
this.rejectResponse(error);
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
// src/api/ude/Nacist-soubor.ts
|
|
1514
1746
|
var nacistSouborRequestProperties = ["Id-souboru"];
|
|
1515
1747
|
var nacistSouborParamOrders = [
|
|
1516
1748
|
{
|
|
@@ -1537,18 +1769,21 @@ var nacistSouborResponseSchema = import_zod16.z.object({
|
|
|
1537
1769
|
*/
|
|
1538
1770
|
"Nacist-soubor": nacistSouborSchema.optional()
|
|
1539
1771
|
});
|
|
1772
|
+
var requestName2 = "Nacist-soubor";
|
|
1773
|
+
var requestNamespace2 = "http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0";
|
|
1774
|
+
var requestXrgNamespace2 = "http://www.gordic.cz/xrg/ude/nacist-soubor/request/v_1.0.0.0";
|
|
1540
1775
|
async function nacistSoubor(bodyObj) {
|
|
1541
1776
|
const url = this.config.urls.ude;
|
|
1542
|
-
if (!url)
|
|
1543
|
-
|
|
1544
|
-
|
|
1777
|
+
if (!url) {
|
|
1778
|
+
throw new GinisError("GINIS SDK Error: Missing UDE url in GINIS config");
|
|
1779
|
+
}
|
|
1545
1780
|
const response = await makeAxiosRequest(
|
|
1546
1781
|
createXmlRequestConfig(requestName2, requestNamespace2),
|
|
1547
1782
|
url,
|
|
1548
1783
|
createXmlRequestBody(this.config, {
|
|
1549
1784
|
name: requestName2,
|
|
1550
1785
|
namespace: requestNamespace2,
|
|
1551
|
-
xrgNamespace:
|
|
1786
|
+
xrgNamespace: requestXrgNamespace2,
|
|
1552
1787
|
paramsBodies: [bodyObj],
|
|
1553
1788
|
paramOrders: nacistSouborParamOrders
|
|
1554
1789
|
}),
|
|
@@ -1556,6 +1791,37 @@ async function nacistSoubor(bodyObj) {
|
|
|
1556
1791
|
);
|
|
1557
1792
|
return await extractResponseJson(response.data, requestName2, nacistSouborResponseSchema);
|
|
1558
1793
|
}
|
|
1794
|
+
async function nacistSouborStream(bodyObj) {
|
|
1795
|
+
const url = this.config.urls.ude;
|
|
1796
|
+
if (!url) {
|
|
1797
|
+
throw new GinisError("GINIS SDK Error: Missing UDE url in GINIS config");
|
|
1798
|
+
}
|
|
1799
|
+
const response = await makeAxiosRequest(
|
|
1800
|
+
{ ...createXmlRequestConfig(requestName2, requestNamespace2), responseType: "stream" },
|
|
1801
|
+
url,
|
|
1802
|
+
createXmlRequestBody(this.config, {
|
|
1803
|
+
name: requestName2,
|
|
1804
|
+
namespace: requestNamespace2,
|
|
1805
|
+
xrgNamespace: requestXrgNamespace2,
|
|
1806
|
+
paramsBodies: [bodyObj],
|
|
1807
|
+
paramOrders: nacistSouborParamOrders
|
|
1808
|
+
}),
|
|
1809
|
+
this.config.debug
|
|
1810
|
+
);
|
|
1811
|
+
const parser = new XmlBase64DataStreamParser({
|
|
1812
|
+
responseValidation: {
|
|
1813
|
+
requestName: requestName2,
|
|
1814
|
+
responseSchema: nacistSouborResponseSchema
|
|
1815
|
+
}
|
|
1816
|
+
});
|
|
1817
|
+
(0, import_stream5.pipeline)(response.data, parser, (error) => {
|
|
1818
|
+
if (error && !parser.destroyed) {
|
|
1819
|
+
parser.destroy(error instanceof Error ? error : new Error(String(error)));
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
parser.response.catch(() => void 0);
|
|
1823
|
+
return parser;
|
|
1824
|
+
}
|
|
1559
1825
|
|
|
1560
1826
|
// src/api/ude/Seznam-dokumentu.ts
|
|
1561
1827
|
var import_lodash = require("lodash");
|
|
@@ -1753,22 +2019,24 @@ var seznamDokumentuResponseSchema = import_zod17.z.object({
|
|
|
1753
2019
|
});
|
|
1754
2020
|
async function seznamDokumentu(bodyObj) {
|
|
1755
2021
|
const url = this.config.urls.ude;
|
|
1756
|
-
if (!url)
|
|
1757
|
-
|
|
1758
|
-
|
|
2022
|
+
if (!url) {
|
|
2023
|
+
throw new GinisError("GINIS SDK Error: Missing UDE url in GINIS config");
|
|
2024
|
+
}
|
|
2025
|
+
const requestName3 = "Seznam-dokumentu";
|
|
2026
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0";
|
|
1759
2027
|
const response = await makeAxiosRequest(
|
|
1760
|
-
createXmlRequestConfig(
|
|
2028
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1761
2029
|
url,
|
|
1762
2030
|
createXmlRequestBody(this.config, {
|
|
1763
|
-
name:
|
|
1764
|
-
namespace:
|
|
2031
|
+
name: requestName3,
|
|
2032
|
+
namespace: requestNamespace3,
|
|
1765
2033
|
xrgNamespace: "http://www.gordic.cz/xrg/ude/seznam-dokumentu/request/v_1.0.0.0",
|
|
1766
2034
|
paramsBodies: [bodyObj],
|
|
1767
2035
|
paramOrders: seznamDokumentuParamOrders
|
|
1768
2036
|
}),
|
|
1769
2037
|
this.config.debug
|
|
1770
2038
|
);
|
|
1771
|
-
return await extractResponseJson(response.data,
|
|
2039
|
+
return await extractResponseJson(response.data, requestName3, seznamDokumentuResponseSchema);
|
|
1772
2040
|
}
|
|
1773
2041
|
function getRecordIdsWithLatestArchiveDate(records) {
|
|
1774
2042
|
let latestDate = null;
|
|
@@ -1871,28 +2139,31 @@ var seznamKategoriiResponseSchema = import_zod18.z.object({
|
|
|
1871
2139
|
});
|
|
1872
2140
|
async function seznamKategorii(bodyObj) {
|
|
1873
2141
|
const url = this.config.urls.ude;
|
|
1874
|
-
if (!url)
|
|
1875
|
-
|
|
1876
|
-
|
|
2142
|
+
if (!url) {
|
|
2143
|
+
throw new GinisError("GINIS SDK Error: Missing UDE url in GINIS config");
|
|
2144
|
+
}
|
|
2145
|
+
const requestName3 = "Seznam-kategorii";
|
|
2146
|
+
const requestNamespace3 = "http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0";
|
|
1877
2147
|
const response = await makeAxiosRequest(
|
|
1878
|
-
createXmlRequestConfig(
|
|
2148
|
+
createXmlRequestConfig(requestName3, requestNamespace3),
|
|
1879
2149
|
url,
|
|
1880
2150
|
createXmlRequestBody(this.config, {
|
|
1881
|
-
name:
|
|
1882
|
-
namespace:
|
|
2151
|
+
name: requestName3,
|
|
2152
|
+
namespace: requestNamespace3,
|
|
1883
2153
|
xrgNamespace: "http://www.gordic.cz/xrg/ude/seznam-kategorii/request/v_1.0.0.0",
|
|
1884
2154
|
paramsBodies: [bodyObj],
|
|
1885
2155
|
paramOrders: seznamKategoriiParamOrders
|
|
1886
2156
|
}),
|
|
1887
2157
|
this.config.debug
|
|
1888
2158
|
);
|
|
1889
|
-
return await extractResponseJson(response.data,
|
|
2159
|
+
return await extractResponseJson(response.data, requestName3, seznamKategoriiResponseSchema);
|
|
1890
2160
|
}
|
|
1891
2161
|
|
|
1892
2162
|
// src/api/ude/index.ts
|
|
1893
2163
|
var ude_default = {
|
|
1894
2164
|
detailDokumentu: detailDokumentu2,
|
|
1895
2165
|
nacistSoubor,
|
|
2166
|
+
nacistSouborStream,
|
|
1896
2167
|
seznamDokumentu,
|
|
1897
2168
|
seznamDokumentuFilterArchiv,
|
|
1898
2169
|
seznamKategorii
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/ginis-sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A small wrapper for most commonly used requests towards the Bratislava GINIS system",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -32,58 +32,42 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/bratislava/ginis-sdk#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "
|
|
36
|
-
"@babel/preset-env": "
|
|
37
|
-
"@babel/preset-typescript": "
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"eslint-config-prettier": "^10.1.8",
|
|
53
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
54
|
-
"eslint-plugin-jest": "^29.13.0",
|
|
55
|
-
"eslint-plugin-jest-async": "^1.0.3",
|
|
56
|
-
"eslint-plugin-no-unsanitized": "^4.1.4",
|
|
57
|
-
"eslint-plugin-node": "^11.1.0",
|
|
58
|
-
"eslint-plugin-security": "^3.0.1",
|
|
59
|
-
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
60
|
-
"eslint-plugin-sonarjs": "^3.0.6",
|
|
61
|
-
"eslint-plugin-xss": "^0.1.12",
|
|
62
|
-
"jest": "^30.2.0",
|
|
63
|
-
"jiti": "^2.6.1",
|
|
64
|
-
"prettier": "^3.8.1",
|
|
65
|
-
"ts-jest": "^29.4.6",
|
|
66
|
-
"ts-loader": "^9.5.4",
|
|
67
|
-
"tsup": "^8.5.1",
|
|
68
|
-
"typescript": "^5.9.3",
|
|
69
|
-
"typescript-eslint": "^8.55.0"
|
|
35
|
+
"@babel/core": "7.29.7",
|
|
36
|
+
"@babel/preset-env": "7.29.7",
|
|
37
|
+
"@babel/preset-typescript": "7.29.7",
|
|
38
|
+
"@bratislava/eslint-config": "0.17.0",
|
|
39
|
+
"@types/jest": "30.0.0",
|
|
40
|
+
"@types/lodash": "4.17.24",
|
|
41
|
+
"@types/xml2js": "0.4.14",
|
|
42
|
+
"babel-jest": "30.4.1",
|
|
43
|
+
"dotenv": "17.4.2",
|
|
44
|
+
"eslint": "9.39.5",
|
|
45
|
+
"jest": "30.4.2",
|
|
46
|
+
"jiti": "2.7.0",
|
|
47
|
+
"prettier": "3.9.6",
|
|
48
|
+
"ts-jest": "29.4.12",
|
|
49
|
+
"ts-loader": "9.6.2",
|
|
50
|
+
"tsup": "8.5.1",
|
|
51
|
+
"typescript": "5.9.3"
|
|
70
52
|
},
|
|
71
53
|
"overrides": {
|
|
72
|
-
"
|
|
54
|
+
"esbuild": "0.28.1",
|
|
55
|
+
"glob": "13.0.6",
|
|
56
|
+
"minimatch": "10.2.4"
|
|
73
57
|
},
|
|
74
58
|
"engines": {
|
|
75
59
|
"node": ">=20.9.x",
|
|
76
60
|
"npm": ">=10.2.x"
|
|
77
61
|
},
|
|
78
62
|
"dependencies": {
|
|
79
|
-
"axios": "
|
|
80
|
-
"lodash": "
|
|
81
|
-
"uuid": "
|
|
82
|
-
"xml2js": "
|
|
83
|
-
"zod": "
|
|
63
|
+
"axios": "1.18.1",
|
|
64
|
+
"lodash": "4.18.1",
|
|
65
|
+
"uuid": "11.1.1",
|
|
66
|
+
"xml2js": "0.6.2",
|
|
67
|
+
"zod": "4.4.3"
|
|
84
68
|
},
|
|
85
69
|
"volta": {
|
|
86
|
-
"node": "
|
|
87
|
-
"npm": "11.
|
|
70
|
+
"node": "24.16.0",
|
|
71
|
+
"npm": "11.13.0"
|
|
88
72
|
}
|
|
89
73
|
}
|