@bratislava/ginis-sdk 0.3.5 → 0.3.7
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/dist/index.d.ts +211 -0
- package/dist/index.js +197 -2
- package/package.json +2 -1
- package/dist/index.js.map +0 -7
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export { AxiosError } from 'axios';
|
|
2
|
+
|
|
3
|
+
type DetailDokumentuRequest = {
|
|
4
|
+
'Id-dokumentu': string;
|
|
5
|
+
'Vyradit-historii'?: string;
|
|
6
|
+
'Vyradit-obsah-spisu'?: string;
|
|
7
|
+
'Vyradit-prilohy'?: string;
|
|
8
|
+
'Vyradit-souvisejici'?: string;
|
|
9
|
+
'Id-esu'?: string;
|
|
10
|
+
'Vyradit-doruceni'?: string;
|
|
11
|
+
'Id-eu'?: string;
|
|
12
|
+
};
|
|
13
|
+
interface DetailDokumentuXrg {
|
|
14
|
+
WflDokument: WflDokument[];
|
|
15
|
+
Doruceni: Doruceni;
|
|
16
|
+
EDoruceni: EDoruceni;
|
|
17
|
+
HistorieDokumentu: HistorieDokumentu[];
|
|
18
|
+
CjDokumentu: CjDokumentu;
|
|
19
|
+
Atribut_Xrg_IxsExt: string;
|
|
20
|
+
}
|
|
21
|
+
interface CjDokumentu {
|
|
22
|
+
IdInitDokumentu: string;
|
|
23
|
+
Atribut_IdInitDokumentu_Externi: string;
|
|
24
|
+
IdVyrizDokumentu: string;
|
|
25
|
+
Atribut_IdVyrizDokumentu_Externi: string;
|
|
26
|
+
Atribut_IdVyrizDokumentu_Nil: string;
|
|
27
|
+
DenikCj: string;
|
|
28
|
+
RokCj: string;
|
|
29
|
+
PoradoveCisloCj: string;
|
|
30
|
+
ZnackaCj: string;
|
|
31
|
+
StavCj: string;
|
|
32
|
+
DatumEvidence: string;
|
|
33
|
+
IdZpusobVyrizeni: string;
|
|
34
|
+
Atribut_IdZpusobVyrizeni_Externi: string;
|
|
35
|
+
Atribut_IdZpusobVyrizeni_Nil: string;
|
|
36
|
+
DoplnekCj: string;
|
|
37
|
+
}
|
|
38
|
+
interface Doruceni {
|
|
39
|
+
IdDokumentu: string;
|
|
40
|
+
Atribut_IdDokumentu_Externi: string;
|
|
41
|
+
Stat: string;
|
|
42
|
+
DatumOdeslani: string;
|
|
43
|
+
ZnackaOdesilatele: string;
|
|
44
|
+
DatumZeDne: string;
|
|
45
|
+
PodaciCislo: string;
|
|
46
|
+
ZpusobDoruceni: string;
|
|
47
|
+
DruhZasilky: string;
|
|
48
|
+
DruhZachazeni: string;
|
|
49
|
+
DatumPrijmuPodani: string;
|
|
50
|
+
IdOdesilatele: string;
|
|
51
|
+
Atribut_IdOdesilatele_Externi: string;
|
|
52
|
+
PocetPriloh: string;
|
|
53
|
+
IdUzluPodani: string;
|
|
54
|
+
Atribut_IdUzluPodani_Externi: string;
|
|
55
|
+
PoradoveCisloPodani: string;
|
|
56
|
+
}
|
|
57
|
+
interface EDoruceni {
|
|
58
|
+
DatumPrijeti: string;
|
|
59
|
+
DatumDoruceni: string;
|
|
60
|
+
IdDsOdesilatele: string;
|
|
61
|
+
}
|
|
62
|
+
interface HistorieDokumentu {
|
|
63
|
+
IdDokumentu: string;
|
|
64
|
+
Atribut_IdDokumentu_Externi: string;
|
|
65
|
+
TextZmeny: string;
|
|
66
|
+
Poznamka: string;
|
|
67
|
+
DatumZmeny: string;
|
|
68
|
+
IdZmenuProvedl: string;
|
|
69
|
+
Atribut_IdZmenuProvedl_Externi: string;
|
|
70
|
+
IdKtgZmeny: string;
|
|
71
|
+
}
|
|
72
|
+
interface WflDokument {
|
|
73
|
+
IdDokumentu: string;
|
|
74
|
+
Atribut_IdDokumentu_Externi: string;
|
|
75
|
+
IdSpisu: string;
|
|
76
|
+
Atribut_IdSpisu_Externi: string;
|
|
77
|
+
PriznakSpisu: string;
|
|
78
|
+
PriznakCj: string;
|
|
79
|
+
IdFunkceVlastnika: string;
|
|
80
|
+
Atribut_IdFunkceVlastnika_Externi: string;
|
|
81
|
+
Vec: string;
|
|
82
|
+
Znacka: string;
|
|
83
|
+
StavDistribuce: string;
|
|
84
|
+
StavDokumentu: string;
|
|
85
|
+
IdAgendy: string;
|
|
86
|
+
IdTypuDokumentu: string;
|
|
87
|
+
PriznakDoruceni: string;
|
|
88
|
+
PriznakEvidenceSsl: string;
|
|
89
|
+
MistoVzniku: string;
|
|
90
|
+
DatumPodani: string;
|
|
91
|
+
PriznakFyzExistence: string;
|
|
92
|
+
PriznakElObrazu: string;
|
|
93
|
+
IdSouboru: string;
|
|
94
|
+
Atribut_IdSouboru_Externi: string;
|
|
95
|
+
JmenoSouboru: string;
|
|
96
|
+
PopisSouboru: string;
|
|
97
|
+
DatumZmeny: string;
|
|
98
|
+
IdZmenuProvedl: string;
|
|
99
|
+
Atribut_IdZmenuProvedl_Externi: string;
|
|
100
|
+
VerzeSouboru: string;
|
|
101
|
+
DatumZmenySouboru: string;
|
|
102
|
+
VelikostSouboru: string;
|
|
103
|
+
PriznakSouboruRo: string;
|
|
104
|
+
}
|
|
105
|
+
declare function detailDokumentu(this: Ginis, bodyObj: DetailDokumentuRequest): Promise<DetailDokumentuXrg>;
|
|
106
|
+
|
|
107
|
+
type PridatSouborRequest = {
|
|
108
|
+
'Id-dokumentu': string;
|
|
109
|
+
'Id-souboru'?: string;
|
|
110
|
+
'Jmeno-souboru': string;
|
|
111
|
+
'Typ-vazby': string;
|
|
112
|
+
'Popis-souboru'?: string;
|
|
113
|
+
'Podrobny-popis-souboru'?: string;
|
|
114
|
+
Data: string;
|
|
115
|
+
'Kontrola-podpisu'?: string;
|
|
116
|
+
'Priz-platna-verze'?: 0 | 1;
|
|
117
|
+
'Priz-archiv-verze'?: 0 | 1;
|
|
118
|
+
'Id-kategorie-typu-prilohy'?: string;
|
|
119
|
+
};
|
|
120
|
+
type PridatSouborXrg = {
|
|
121
|
+
Atribut_Xrg_ixsExt?: string;
|
|
122
|
+
PridatSoubor: Array<{
|
|
123
|
+
DatumZmeny: string;
|
|
124
|
+
IdSouboru: string;
|
|
125
|
+
VerzeSouboru: number;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
declare function pridatSoubor(this: Ginis, bodyObj: PridatSouborRequest): Promise<PridatSouborXrg>;
|
|
129
|
+
|
|
130
|
+
declare const _default$1: {
|
|
131
|
+
detailDokumentu: typeof detailDokumentu;
|
|
132
|
+
pridatSoubor: typeof pridatSoubor;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type DetailElPodaniRequest = {
|
|
136
|
+
'Id-zpravy'?: string;
|
|
137
|
+
'Id-el-podani'?: string;
|
|
138
|
+
'Id-esu'?: string;
|
|
139
|
+
'Id-eu'?: string;
|
|
140
|
+
'Zaradit-navazane'?: string;
|
|
141
|
+
};
|
|
142
|
+
type DetailElPodaniXrg = {
|
|
143
|
+
DetailElPodani: {
|
|
144
|
+
DatumPrijeti: string;
|
|
145
|
+
StavZpracovani: string;
|
|
146
|
+
DuvodOdmitnuti?: string;
|
|
147
|
+
StavPodaniKod: string;
|
|
148
|
+
StavPodaniText?: string;
|
|
149
|
+
StavOdpovediKod: string;
|
|
150
|
+
StavOdpovediText?: string;
|
|
151
|
+
IdDokumentu: string;
|
|
152
|
+
Vec?: string;
|
|
153
|
+
SpisZnacka?: string;
|
|
154
|
+
Znacka?: string;
|
|
155
|
+
}[];
|
|
156
|
+
NavazanyDokument?: {
|
|
157
|
+
IdDokumentu: string;
|
|
158
|
+
Vec?: string;
|
|
159
|
+
SpisZnacka?: string;
|
|
160
|
+
Znacka?: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
declare function detailElPodani(this: Ginis, bodyObj: DetailElPodaniRequest): Promise<DetailElPodaniXrg>;
|
|
164
|
+
|
|
165
|
+
declare const _default: {
|
|
166
|
+
detailElPodani: typeof detailElPodani;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
type GinisConfig = {
|
|
170
|
+
username: string;
|
|
171
|
+
password: string;
|
|
172
|
+
urls: {
|
|
173
|
+
ude?: string;
|
|
174
|
+
ssl?: string;
|
|
175
|
+
pod?: string;
|
|
176
|
+
};
|
|
177
|
+
debug?: boolean;
|
|
178
|
+
};
|
|
179
|
+
type _Ssl = typeof _default$1;
|
|
180
|
+
/**
|
|
181
|
+
* full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
|
|
182
|
+
*/
|
|
183
|
+
type Ssl = {
|
|
184
|
+
[P in keyof _Ssl]: OmitThisParameter<_Ssl[P]>;
|
|
185
|
+
};
|
|
186
|
+
type _Pod = typeof _default;
|
|
187
|
+
/**
|
|
188
|
+
* full POD service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=POD&language=cs-CZ&version=390
|
|
189
|
+
*/
|
|
190
|
+
type Pod = {
|
|
191
|
+
[P in keyof _Pod]: OmitThisParameter<_Pod[P]>;
|
|
192
|
+
};
|
|
193
|
+
declare class Ginis {
|
|
194
|
+
config: GinisConfig;
|
|
195
|
+
/**
|
|
196
|
+
* Exports functions of the api's with config and url values bound.
|
|
197
|
+
* See documentation of the api for request options.
|
|
198
|
+
* Inputs are typed objects, outputs unformatted xml.
|
|
199
|
+
*/
|
|
200
|
+
json: {
|
|
201
|
+
ssl: Ssl;
|
|
202
|
+
pod: Pod;
|
|
203
|
+
};
|
|
204
|
+
constructor(config: GinisConfig);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
declare class GinisError extends Error {
|
|
208
|
+
constructor(message: string);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export { Ginis, GinisConfig, GinisError };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,197 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
AxiosError: () => import_axios2.AxiosError,
|
|
34
|
+
Ginis: () => Ginis,
|
|
35
|
+
GinisError: () => GinisError
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
38
|
+
var import_axios2 = require("axios");
|
|
39
|
+
|
|
40
|
+
// src/utils/api.ts
|
|
41
|
+
var import_axios = __toESM(require("axios"));
|
|
42
|
+
var import_crypto = __toESM(require("crypto"));
|
|
43
|
+
var defaultAxiosConfig = {
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var makeAxiosRequest = async (axiosConfig, url, body, debug) => {
|
|
49
|
+
if (!url) {
|
|
50
|
+
throw new Error("Missing GINIS url for the service you are trying to reach.");
|
|
51
|
+
}
|
|
52
|
+
const requestConfig = axiosConfig || defaultAxiosConfig;
|
|
53
|
+
if (debug) {
|
|
54
|
+
console.log("########### GINIS REQUEST ###########");
|
|
55
|
+
console.log("headers: ", requestConfig.headers);
|
|
56
|
+
console.log("body: ", body);
|
|
57
|
+
console.log("########### GINIS REQUEST END ###########");
|
|
58
|
+
}
|
|
59
|
+
let responseAxios;
|
|
60
|
+
try {
|
|
61
|
+
responseAxios = await import_axios.default.post(url, body, requestConfig);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (debug) {
|
|
64
|
+
let anyError = error;
|
|
65
|
+
console.error(anyError);
|
|
66
|
+
console.log("########### GINIS ERROR RESPONSE ###########");
|
|
67
|
+
console.log("status: ", anyError?.response?.status);
|
|
68
|
+
console.log("statusText: ", anyError?.response?.statusText);
|
|
69
|
+
console.log("data: ", anyError?.response?.data);
|
|
70
|
+
console.log("########### GINIS RESPONSE END ###########");
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
if (debug) {
|
|
75
|
+
console.log("########### GINIS RESPONSE ###########");
|
|
76
|
+
console.log("status: ", responseAxios.status);
|
|
77
|
+
console.log("statusText: ", responseAxios.statusText);
|
|
78
|
+
console.log("data: ", responseAxios.data);
|
|
79
|
+
console.log("########### GINIS RESPONSE END ###########");
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
data: responseAxios.data,
|
|
83
|
+
status: responseAxios.status,
|
|
84
|
+
statusText: responseAxios.statusText
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
var getGRestHeader = (config, requestNamespace) => {
|
|
88
|
+
return {
|
|
89
|
+
RequestName: "Xrg",
|
|
90
|
+
RequestNamespace: requestNamespace,
|
|
91
|
+
User: config.username,
|
|
92
|
+
Password: config.password,
|
|
93
|
+
PasswordText: true,
|
|
94
|
+
Nonce: import_crypto.default.randomBytes(10).toString("base64"),
|
|
95
|
+
Created: (/* @__PURE__ */ new Date()).toISOString()
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// src/utils/errors.ts
|
|
100
|
+
var GinisError = class extends Error {
|
|
101
|
+
constructor(message) {
|
|
102
|
+
super(message);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/api/json/ssl/Detail-dokumentu.ts
|
|
107
|
+
async function detailDokumentu(bodyObj) {
|
|
108
|
+
const url = this.config.urls.ssl;
|
|
109
|
+
if (!url)
|
|
110
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
111
|
+
const response = await makeAxiosRequest(
|
|
112
|
+
void 0,
|
|
113
|
+
`${url}/json/Detail-dokumentu`,
|
|
114
|
+
{
|
|
115
|
+
GRestHeader: getGRestHeader(
|
|
116
|
+
this.config,
|
|
117
|
+
"http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-dokumentu/request/v_1.0.0.0"
|
|
118
|
+
),
|
|
119
|
+
Xrg: { "Detail-dokumentu": bodyObj }
|
|
120
|
+
},
|
|
121
|
+
this.config.debug
|
|
122
|
+
);
|
|
123
|
+
return response.data.Xrg;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/api/json/ssl/Pridat-soubor.ts
|
|
127
|
+
async function pridatSoubor(bodyObj) {
|
|
128
|
+
const url = this.config.urls.ssl;
|
|
129
|
+
if (!url)
|
|
130
|
+
throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
|
|
131
|
+
const response = await makeAxiosRequest(
|
|
132
|
+
void 0,
|
|
133
|
+
`${url}/json/Pridat-soubor`,
|
|
134
|
+
{
|
|
135
|
+
GRestHeader: getGRestHeader(
|
|
136
|
+
this.config,
|
|
137
|
+
"http://www.gordic.cz/xrg/ssl/wfl-dokument/pridat-soubor/request/v_1.0.0.0"
|
|
138
|
+
),
|
|
139
|
+
Xrg: { "Pridat-soubor": bodyObj }
|
|
140
|
+
},
|
|
141
|
+
this.config.debug
|
|
142
|
+
);
|
|
143
|
+
return response.data.Xrg;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/api/json/ssl/index.ts
|
|
147
|
+
var ssl_default = {
|
|
148
|
+
detailDokumentu,
|
|
149
|
+
pridatSoubor
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/api/json/pod/Detail-el-podani.ts
|
|
153
|
+
async function detailElPodani(bodyObj) {
|
|
154
|
+
const url = this.config.urls.pod;
|
|
155
|
+
if (!url)
|
|
156
|
+
throw new GinisError("GINIS SDK Error: Missing POD url in GINIS config");
|
|
157
|
+
const response = await makeAxiosRequest(
|
|
158
|
+
void 0,
|
|
159
|
+
`${url}/json/Detail-el-podani`,
|
|
160
|
+
{
|
|
161
|
+
GRestHeader: getGRestHeader(
|
|
162
|
+
this.config,
|
|
163
|
+
"http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0"
|
|
164
|
+
),
|
|
165
|
+
Xrg: { "Detail-el-podani": bodyObj }
|
|
166
|
+
},
|
|
167
|
+
this.config.debug
|
|
168
|
+
);
|
|
169
|
+
return response.data.Xrg;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/api/json/pod/index.ts
|
|
173
|
+
var pod_default = {
|
|
174
|
+
detailElPodani
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/ginis.ts
|
|
178
|
+
var import_lodash = require("lodash");
|
|
179
|
+
var defaultConfig = {};
|
|
180
|
+
var Ginis = class {
|
|
181
|
+
constructor(config) {
|
|
182
|
+
this.config = {
|
|
183
|
+
...defaultConfig,
|
|
184
|
+
...config
|
|
185
|
+
};
|
|
186
|
+
this.json = {
|
|
187
|
+
ssl: (0, import_lodash.mapValues)(ssl_default, (v) => (0, import_lodash.bind)(v, this)),
|
|
188
|
+
pod: (0, import_lodash.mapValues)(pod_default, (v) => (0, import_lodash.bind)(v, this))
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
193
|
+
0 && (module.exports = {
|
|
194
|
+
AxiosError,
|
|
195
|
+
Ginis,
|
|
196
|
+
GinisError
|
|
197
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/ginis-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "A small wrapper for most commonly used requests towards the Bratislava GINIS system",
|
|
5
5
|
"main": "dist/ginis-sdk",
|
|
6
6
|
"files": [
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"jest": "^29.1.2",
|
|
51
51
|
"ts-jest": "^29.0.3",
|
|
52
52
|
"ts-loader": "^9.4.1",
|
|
53
|
+
"tsup": "^7.2.0",
|
|
53
54
|
"typedoc": "^0.23.16",
|
|
54
55
|
"typedoc-theme-hierarchy": "^3.0.2",
|
|
55
56
|
"typescript-strict-plugin": "^2.1.0",
|
package/dist/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/utils/api.ts", "../src/utils/errors.ts", "../src/api/json/ssl/Detail-dokumentu.ts", "../src/api/json/ssl/Pridat-soubor.ts", "../src/api/json/ssl/index.ts", "../src/api/json/pod/Detail-el-podani.ts", "../src/api/json/pod/index.ts", "../src/ginis.ts"],
|
|
4
|
-
"sourcesContent": ["// exporting axios error for easier handling of possible throws\nimport { AxiosError } from 'axios'\nimport { Ginis, GinisConfig } from './ginis'\nimport { GinisError } from './utils/errors'\n\nexport { Ginis, GinisConfig, AxiosError, GinisError }\n", "import axios, { AxiosRequestConfig } from 'axios'\nimport crypto from 'crypto'\nimport type { GinisConfig } from '../ginis'\n\nconst defaultAxiosConfig: AxiosRequestConfig = {\n headers: {\n 'Content-Type': 'application/json',\n },\n}\n\nexport const makeAxiosRequest = async <T>(\n axiosConfig: AxiosRequestConfig | undefined,\n url: string | undefined,\n body: string | object,\n debug?: boolean\n) => {\n if (!url) {\n throw new Error('Missing GINIS url for the service you are trying to reach.')\n }\n\n const requestConfig = axiosConfig || defaultAxiosConfig\n\n if (debug) {\n console.log('########### GINIS REQUEST ###########')\n console.log('headers: ', requestConfig.headers)\n console.log('body: ', body)\n console.log('########### GINIS REQUEST END ###########')\n }\n let responseAxios\n try {\n responseAxios = await axios.post<T>(url, body, requestConfig)\n } catch (error) {\n if (debug) {\n let anyError = error as any\n console.error(anyError)\n console.log('########### GINIS ERROR RESPONSE ###########')\n console.log('status: ', anyError?.response?.status)\n console.log('statusText: ', anyError?.response?.statusText)\n console.log('data: ', anyError?.response?.data)\n console.log('########### GINIS RESPONSE END ###########')\n }\n throw error\n }\n if (debug) {\n console.log('########### GINIS RESPONSE ###########')\n console.log('status: ', responseAxios.status)\n console.log('statusText: ', responseAxios.statusText)\n console.log('data: ', responseAxios.data)\n console.log('########### GINIS RESPONSE END ###########')\n }\n return {\n data: responseAxios.data,\n status: responseAxios.status,\n statusText: responseAxios.statusText,\n }\n}\n\nexport type GRestHeader = {\n RequestName: string\n RequestNamespace: string\n User: string\n Password: string\n PasswordText: boolean\n Nonce: string\n Created: string\n}\n\nexport const getGRestHeader = (config: GinisConfig, requestNamespace: string): GRestHeader => {\n return {\n RequestName: 'Xrg',\n RequestNamespace: requestNamespace,\n User: config.username,\n Password: config.password,\n PasswordText: true,\n Nonce: crypto.randomBytes(10).toString('base64'),\n Created: new Date().toISOString(),\n }\n}\n", "// may get more data later\n// for now serves as a way to easily distinguish in client code by instance type\nexport class GinisError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n", "import type { Ginis } from '../../../ginis'\nimport { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'\nimport { GinisError } from '../../../utils/errors'\n\n// https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=Detail-dokumentu&type=request\nexport type DetailDokumentuRequest = {\n 'Id-dokumentu': string\n 'Vyradit-historii'?: string\n 'Vyradit-obsah-spisu'?: string\n 'Vyradit-prilohy'?: string\n 'Vyradit-souvisejici'?: string\n 'Id-esu'?: string\n 'Vyradit-doruceni'?: string\n 'Id-eu'?: string\n}\n\n// https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=Detail-dokumentu&type=response\nexport interface DetailDokumentuXrg {\n WflDokument: WflDokument[]\n Doruceni: Doruceni\n EDoruceni: EDoruceni\n HistorieDokumentu: HistorieDokumentu[]\n CjDokumentu: CjDokumentu\n Atribut_Xrg_IxsExt: string\n}\n\nexport interface CjDokumentu {\n IdInitDokumentu: string\n Atribut_IdInitDokumentu_Externi: string\n IdVyrizDokumentu: string\n Atribut_IdVyrizDokumentu_Externi: string\n Atribut_IdVyrizDokumentu_Nil: string\n DenikCj: string\n RokCj: string\n PoradoveCisloCj: string\n ZnackaCj: string\n StavCj: string\n DatumEvidence: string\n IdZpusobVyrizeni: string\n Atribut_IdZpusobVyrizeni_Externi: string\n Atribut_IdZpusobVyrizeni_Nil: string\n DoplnekCj: string\n}\n\nexport interface Doruceni {\n IdDokumentu: string\n Atribut_IdDokumentu_Externi: string\n Stat: string\n DatumOdeslani: string\n ZnackaOdesilatele: string\n DatumZeDne: string\n PodaciCislo: string\n ZpusobDoruceni: string\n DruhZasilky: string\n DruhZachazeni: string\n DatumPrijmuPodani: string\n IdOdesilatele: string\n Atribut_IdOdesilatele_Externi: string\n PocetPriloh: string\n IdUzluPodani: string\n Atribut_IdUzluPodani_Externi: string\n PoradoveCisloPodani: string\n}\n\nexport interface EDoruceni {\n DatumPrijeti: string\n DatumDoruceni: string\n IdDsOdesilatele: string\n}\n\nexport interface HistorieDokumentu {\n IdDokumentu: string\n Atribut_IdDokumentu_Externi: string\n TextZmeny: string\n Poznamka: string\n DatumZmeny: string\n IdZmenuProvedl: string\n Atribut_IdZmenuProvedl_Externi: string\n IdKtgZmeny: string\n}\n\nexport interface WflDokument {\n IdDokumentu: string\n Atribut_IdDokumentu_Externi: string\n IdSpisu: string\n Atribut_IdSpisu_Externi: string\n PriznakSpisu: string\n PriznakCj: string\n IdFunkceVlastnika: string\n Atribut_IdFunkceVlastnika_Externi: string\n Vec: string\n Znacka: string\n StavDistribuce: string\n StavDokumentu: string\n IdAgendy: string\n IdTypuDokumentu: string\n PriznakDoruceni: string\n PriznakEvidenceSsl: string\n MistoVzniku: string\n DatumPodani: string\n PriznakFyzExistence: string\n PriznakElObrazu: string\n IdSouboru: string\n Atribut_IdSouboru_Externi: string\n JmenoSouboru: string\n PopisSouboru: string\n DatumZmeny: string\n IdZmenuProvedl: string\n Atribut_IdZmenuProvedl_Externi: string\n VerzeSouboru: string\n DatumZmenySouboru: string\n VelikostSouboru: string\n PriznakSouboruRo: string\n}\n\nexport type DetailDokumentuResponse = {\n GRestHeader: GRestHeader\n Xrg: DetailDokumentuXrg\n}\n\nexport async function detailDokumentu(\n this: Ginis,\n bodyObj: DetailDokumentuRequest\n): Promise<DetailDokumentuXrg> {\n const url = this.config.urls.ssl\n if (!url) throw new GinisError('GINIS SDK Error: Missing SSL url in GINIS config')\n const response = await makeAxiosRequest<DetailDokumentuResponse>(\n undefined,\n `${url}/json/Detail-dokumentu`,\n {\n GRestHeader: getGRestHeader(\n this.config,\n 'http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-dokumentu/request/v_1.0.0.0'\n ),\n Xrg: { 'Detail-dokumentu': bodyObj },\n },\n this.config.debug\n )\n return response.data.Xrg\n}\n", "import type { Ginis } from '../../../ginis'\nimport { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'\nimport { GinisError } from '../../../utils/errors'\n\n// https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=pridat-soubor&type=request\nexport type PridatSouborRequest = {\n 'Id-dokumentu': string\n 'Id-souboru'?: string\n 'Jmeno-souboru': string\n 'Typ-vazby': string\n 'Popis-souboru'?: string\n 'Podrobny-popis-souboru'?: string\n Data: string\n 'Kontrola-podpisu'?: string\n 'Priz-platna-verze'?: 0 | 1\n 'Priz-archiv-verze'?: 0 | 1\n 'Id-kategorie-typu-prilohy'?: string\n}\n\n// https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=pridat-soubor&type=response\nexport type PridatSouborXrg = {\n Atribut_Xrg_ixsExt?: string\n PridatSoubor: Array<{\n DatumZmeny: string\n IdSouboru: string\n VerzeSouboru: number\n }>\n}\n\nexport type PridatSouborResponse = {\n GRestHeader: GRestHeader\n Xrg: PridatSouborXrg\n}\n\nexport async function pridatSoubor(\n this: Ginis,\n bodyObj: PridatSouborRequest\n): Promise<PridatSouborXrg> {\n const url = this.config.urls.ssl\n if (!url) throw new GinisError('GINIS SDK Error: Missing SSL url in GINIS config')\n const response = await makeAxiosRequest<PridatSouborResponse>(\n undefined,\n `${url}/json/Pridat-soubor`,\n {\n GRestHeader: getGRestHeader(\n this.config,\n 'http://www.gordic.cz/xrg/ssl/wfl-dokument/pridat-soubor/request/v_1.0.0.0'\n ),\n Xrg: { 'Pridat-soubor': bodyObj },\n },\n this.config.debug\n )\n return response.data.Xrg\n}\n", "import { detailDokumentu } from './Detail-dokumentu'\nimport { pridatSoubor } from './Pridat-soubor'\n\nexport default {\n detailDokumentu,\n pridatSoubor,\n}\n", "import type { Ginis } from '../../../ginis'\nimport { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'\nimport { GinisError } from '../../../utils/errors'\n\nexport type DetailElPodaniRequest = {\n 'Id-zpravy'?: string\n 'Id-el-podani'?: string\n 'Id-esu'?: string\n 'Id-eu'?: string\n 'Zaradit-navazane'?: string\n}\n\nexport type DetailElPodaniXrg = {\n DetailElPodani: {\n DatumPrijeti: string\n StavZpracovani: string\n DuvodOdmitnuti?: string\n StavPodaniKod: string\n StavPodaniText?: string\n StavOdpovediKod: string\n StavOdpovediText?: string\n IdDokumentu: string\n Vec?: string\n SpisZnacka?: string\n Znacka?: string\n }[]\n NavazanyDokument?: {\n IdDokumentu: string\n Vec?: string\n SpisZnacka?: string\n Znacka?: string\n }\n}\n\nexport type DetailElPodaniResponse = {\n GRestHeader: GRestHeader\n Xrg: DetailElPodaniXrg\n}\n\nexport async function detailElPodani(\n this: Ginis,\n bodyObj: DetailElPodaniRequest\n): Promise<DetailElPodaniXrg> {\n const url = this.config.urls.pod\n if (!url) throw new GinisError('GINIS SDK Error: Missing POD url in GINIS config')\n const response = await makeAxiosRequest<DetailElPodaniResponse>(\n undefined,\n `${url}/json/Detail-el-podani`,\n {\n GRestHeader: getGRestHeader(\n this.config,\n 'http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0'\n ),\n Xrg: { 'Detail-el-podani': bodyObj },\n },\n this.config.debug\n )\n return response.data.Xrg\n}\n", "import { detailElPodani } from './Detail-el-podani'\n\nexport default {\n detailElPodani,\n}\n", "import ssl from './api/json/ssl'\nimport pod from './api/json/pod'\nimport { bind, mapValues } from 'lodash'\n\nexport type GinisConfig = {\n username: string\n password: string\n urls: {\n ude?: string\n ssl?: string\n pod?: string\n }\n debug?: boolean\n}\n\n// presently empty, prepared in case we're to add default values in the future\nexport const defaultConfig = {}\n\ntype _Ssl = typeof ssl\n/**\n * full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390\n */\nexport type Ssl = {\n [P in keyof _Ssl]: OmitThisParameter<_Ssl[P]>\n}\n\ntype _Pod = typeof pod\n/**\n * full POD service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=POD&language=cs-CZ&version=390\n */\nexport type Pod = {\n [P in keyof _Pod]: OmitThisParameter<_Pod[P]>\n}\n\n// exports all services with server config bound to the one passed at construction\nexport class Ginis {\n config: GinisConfig\n /**\n * Exports functions of the api's with config and url values bound.\n * See documentation of the api for request options.\n * Inputs are typed objects, outputs unformatted xml.\n */\n json: {\n ssl: Ssl\n pod: Pod\n }\n\n constructor(config: GinisConfig) {\n this.config = {\n ...defaultConfig,\n ...config,\n }\n this.json = {\n ssl: mapValues(ssl, (v) => bind(v, this)),\n pod: mapValues(pod, (v) => bind(v, this)),\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["src_exports", "__export", "Ginis", "GinisError", "__toCommonJS", "import_axios", "import_axios", "import_crypto", "defaultAxiosConfig", "makeAxiosRequest", "axiosConfig", "url", "body", "debug", "_a", "_b", "_c", "requestConfig", "responseAxios", "axios", "error", "anyError", "getGRestHeader", "config", "requestNamespace", "crypto", "GinisError", "message", "detailDokumentu", "bodyObj", "url", "GinisError", "makeAxiosRequest", "getGRestHeader", "pridatSoubor", "bodyObj", "url", "GinisError", "makeAxiosRequest", "getGRestHeader", "ssl_default", "detailDokumentu", "pridatSoubor", "detailElPodani", "bodyObj", "url", "GinisError", "makeAxiosRequest", "getGRestHeader", "pod_default", "detailElPodani", "import_lodash", "defaultConfig", "Ginis", "config", "ssl_default", "v", "pod_default"]
|
|
7
|
-
}
|