@bratislava/ginis-sdk 2.0.0 → 2.1.0
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 +2 -0
- package/dist/index.js +73 -5
- package/package.json +22 -26
package/dist/index.d.ts
CHANGED
|
@@ -1178,6 +1178,7 @@ type UdeSeznamDokumentuSejmuteDokumentyItem = z.infer<typeof dokumentySchema>;
|
|
|
1178
1178
|
type UdeSeznamDokumentuZruseneDokumentyItem = UdeSeznamDokumentuSejmuteDokumentyItem;
|
|
1179
1179
|
type UdeSeznamDokumentuResponse = z.infer<typeof seznamDokumentuResponseSchema>;
|
|
1180
1180
|
declare function seznamDokumentu(this: Ginis, bodyObj: UdeSeznamDokumentuRequest): Promise<UdeSeznamDokumentuResponse>;
|
|
1181
|
+
declare function seznamDokumentuFilterArchiv(this: Ginis, bodyObj: UdeSeznamDokumentuRequest): Promise<UdeSeznamDokumentuResponse>;
|
|
1181
1182
|
|
|
1182
1183
|
declare const seznamKategoriiRequestProperties: readonly ["Id-uredni-desky"];
|
|
1183
1184
|
/**
|
|
@@ -1208,6 +1209,7 @@ declare const _default: {
|
|
|
1208
1209
|
detailDokumentu: typeof detailDokumentu;
|
|
1209
1210
|
nacistSoubor: typeof nacistSoubor;
|
|
1210
1211
|
seznamDokumentu: typeof seznamDokumentu;
|
|
1212
|
+
seznamDokumentuFilterArchiv: typeof seznamDokumentuFilterArchiv;
|
|
1211
1213
|
seznamKategorii: typeof seznamKategorii;
|
|
1212
1214
|
};
|
|
1213
1215
|
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/ginis.ts
|
|
39
|
-
var
|
|
39
|
+
var import_lodash2 = require("lodash");
|
|
40
40
|
|
|
41
41
|
// src/api/gin/Detail-funkcniho-mista.ts
|
|
42
42
|
var import_zod = require("zod");
|
|
@@ -1561,6 +1561,7 @@ async function nacistSoubor(bodyObj) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
1563
|
// src/api/ude/Seznam-dokumentu.ts
|
|
1564
|
+
var import_lodash = require("lodash");
|
|
1564
1565
|
var import_zod17 = require("zod");
|
|
1565
1566
|
var seznamDokumentuRequestProperties = [
|
|
1566
1567
|
/**
|
|
@@ -1772,6 +1773,72 @@ async function seznamDokumentu(bodyObj) {
|
|
|
1772
1773
|
);
|
|
1773
1774
|
return await extractResponseJson(response.data, requestName2, seznamDokumentuResponseSchema);
|
|
1774
1775
|
}
|
|
1776
|
+
function getRecordIdsWithLatestArchiveDate(records) {
|
|
1777
|
+
let latestDate = null;
|
|
1778
|
+
const latestArchivedIds = [];
|
|
1779
|
+
for (const record of records) {
|
|
1780
|
+
const dateStr = record["Sejmuto-dne"];
|
|
1781
|
+
if (!dateStr) {
|
|
1782
|
+
return [];
|
|
1783
|
+
}
|
|
1784
|
+
const date = new Date(dateStr);
|
|
1785
|
+
if (!latestDate || date.getTime() > latestDate.getTime()) {
|
|
1786
|
+
latestDate = date;
|
|
1787
|
+
latestArchivedIds.splice(0);
|
|
1788
|
+
latestArchivedIds.push(record["Id-zaznamu"]);
|
|
1789
|
+
} else if (date.getTime() === latestDate.getTime()) {
|
|
1790
|
+
latestArchivedIds.push(record["Id-zaznamu"]);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
return latestArchivedIds;
|
|
1794
|
+
}
|
|
1795
|
+
function filterOutReplacedRecords(allRecords) {
|
|
1796
|
+
const latestVersionRecordIds = /* @__PURE__ */ new Set();
|
|
1797
|
+
const groupedByDocumentId = (0, import_lodash.groupBy)(allRecords, (doc) => doc["Id-dokumentu"] || doc["Id-zaznamu"]);
|
|
1798
|
+
for (const records of Object.values(groupedByDocumentId)) {
|
|
1799
|
+
if (records.length === 0) {
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
1802
|
+
getRecordIdsWithLatestArchiveDate(records).forEach(
|
|
1803
|
+
(recordId) => latestVersionRecordIds.add(recordId)
|
|
1804
|
+
);
|
|
1805
|
+
}
|
|
1806
|
+
return latestVersionRecordIds;
|
|
1807
|
+
}
|
|
1808
|
+
async function seznamDokumentuFilterArchiv(bodyObj) {
|
|
1809
|
+
const sanitizedParams = sanitizeParamBody(bodyObj);
|
|
1810
|
+
const requestedState = sanitizedParams["Stav"]?.value;
|
|
1811
|
+
if (requestedState === "vyveseno") {
|
|
1812
|
+
throw new GinisError(
|
|
1813
|
+
'GINIS SDK Error: Invalid request parameters. "Stav" cannot be "vyveseno".'
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
const CHANGES_EXPECTED_MONTHS = 1;
|
|
1817
|
+
const publishedUntil = sanitizedParams["Vyveseno-od-horni-mez"]?.value;
|
|
1818
|
+
let changeCutoffDate = void 0;
|
|
1819
|
+
if (publishedUntil) {
|
|
1820
|
+
const date = new Date(publishedUntil);
|
|
1821
|
+
date.setMonth(date.getMonth() + CHANGES_EXPECTED_MONTHS);
|
|
1822
|
+
changeCutoffDate = date.toISOString().split("T")[0];
|
|
1823
|
+
}
|
|
1824
|
+
const data = await this.ude.seznamDokumentu({
|
|
1825
|
+
...bodyObj,
|
|
1826
|
+
Stav: void 0,
|
|
1827
|
+
"Vyveseno-od-horni-mez": changeCutoffDate
|
|
1828
|
+
});
|
|
1829
|
+
const allRecords = data["Seznam-dokumentu"];
|
|
1830
|
+
const latestVersionRecordIds = filterOutReplacedRecords(allRecords);
|
|
1831
|
+
const filteredRecords = allRecords.filter((record) => {
|
|
1832
|
+
if (publishedUntil && record["Vyveseno-dne"] > publishedUntil) {
|
|
1833
|
+
return false;
|
|
1834
|
+
}
|
|
1835
|
+
if (requestedState && record.Stav !== requestedState) {
|
|
1836
|
+
return false;
|
|
1837
|
+
}
|
|
1838
|
+
return latestVersionRecordIds.has(record["Id-zaznamu"]);
|
|
1839
|
+
});
|
|
1840
|
+
return { ...data, "Seznam-dokumentu": filteredRecords };
|
|
1841
|
+
}
|
|
1775
1842
|
|
|
1776
1843
|
// src/api/ude/Seznam-kategorii.ts
|
|
1777
1844
|
var import_zod18 = require("zod");
|
|
@@ -1830,6 +1897,7 @@ var ude_default = {
|
|
|
1830
1897
|
detailDokumentu: detailDokumentu2,
|
|
1831
1898
|
nacistSoubor,
|
|
1832
1899
|
seznamDokumentu,
|
|
1900
|
+
seznamDokumentuFilterArchiv,
|
|
1833
1901
|
seznamKategorii
|
|
1834
1902
|
};
|
|
1835
1903
|
|
|
@@ -1846,10 +1914,10 @@ var Ginis = class {
|
|
|
1846
1914
|
...defaultConfig,
|
|
1847
1915
|
...config
|
|
1848
1916
|
};
|
|
1849
|
-
this.ssl = (0,
|
|
1850
|
-
this.pod = (0,
|
|
1851
|
-
this.gin = (0,
|
|
1852
|
-
this.ude = (0,
|
|
1917
|
+
this.ssl = (0, import_lodash2.mapValues)(ssl_default, (v) => (0, import_lodash2.bind)(v, this));
|
|
1918
|
+
this.pod = (0, import_lodash2.mapValues)(pod_default, (v) => (0, import_lodash2.bind)(v, this));
|
|
1919
|
+
this.gin = (0, import_lodash2.mapValues)(gin_default, (v) => (0, import_lodash2.bind)(v, this));
|
|
1920
|
+
this.ude = (0, import_lodash2.mapValues)(ude_default, (v) => (0, import_lodash2.bind)(v, this));
|
|
1853
1921
|
}
|
|
1854
1922
|
};
|
|
1855
1923
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/ginis-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
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,27 +32,26 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/bratislava/ginis-sdk#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "^7.28.
|
|
36
|
-
"@babel/preset-env": "^7.28.
|
|
37
|
-
"@babel/preset-typescript": "^7.
|
|
38
|
-
"@darraghor/eslint-plugin-nestjs-typed": "^6.
|
|
39
|
-
"@eslint/js": "^9.
|
|
40
|
-
"@eslint/json": "^0.
|
|
41
|
-
"@eslint/markdown": "^7.
|
|
35
|
+
"@babel/core": "^7.28.5",
|
|
36
|
+
"@babel/preset-env": "^7.28.5",
|
|
37
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
38
|
+
"@darraghor/eslint-plugin-nestjs-typed": "^6.9.3",
|
|
39
|
+
"@eslint/js": "^9.39.1",
|
|
40
|
+
"@eslint/json": "^0.14.0",
|
|
41
|
+
"@eslint/markdown": "^7.5.1",
|
|
42
42
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
43
43
|
"@types/eslint-plugin-security": "^3.0.0",
|
|
44
44
|
"@types/jest": "^30.0.0",
|
|
45
45
|
"@types/lodash": "^4.17.20",
|
|
46
|
-
"@types/uuid": "^10.0.0",
|
|
47
46
|
"@types/xml2js": "^0.4.14",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
49
|
-
"@typescript-eslint/parser": "^8.
|
|
50
|
-
"babel-jest": "^30.
|
|
51
|
-
"dotenv": "^17.2.
|
|
52
|
-
"eslint": "^9.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
48
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
49
|
+
"babel-jest": "^30.2.0",
|
|
50
|
+
"dotenv": "^17.2.3",
|
|
51
|
+
"eslint": "^9.39.1",
|
|
53
52
|
"eslint-config-prettier": "^10.1.8",
|
|
54
53
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
55
|
-
"eslint-plugin-jest": "^29.0
|
|
54
|
+
"eslint-plugin-jest": "^29.1.0",
|
|
56
55
|
"eslint-plugin-jest-async": "^1.0.3",
|
|
57
56
|
"eslint-plugin-no-unsanitized": "^4.1.4",
|
|
58
57
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -60,14 +59,14 @@
|
|
|
60
59
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
61
60
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
62
61
|
"eslint-plugin-xss": "^0.1.12",
|
|
63
|
-
"jest": "^30.
|
|
64
|
-
"jiti": "^2.
|
|
62
|
+
"jest": "^30.2.0",
|
|
63
|
+
"jiti": "^2.6.1",
|
|
65
64
|
"prettier": "^3.6.2",
|
|
66
|
-
"ts-jest": "^29.4.
|
|
65
|
+
"ts-jest": "^29.4.5",
|
|
67
66
|
"ts-loader": "^9.5.4",
|
|
68
|
-
"tsup": "^8.5.
|
|
69
|
-
"typescript": "^5.9.
|
|
70
|
-
"typescript-eslint": "^8.
|
|
67
|
+
"tsup": "^8.5.1",
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"typescript-eslint": "^8.46.4"
|
|
71
70
|
},
|
|
72
71
|
"overrides": {
|
|
73
72
|
"glob": "^11.0.3"
|
|
@@ -77,14 +76,11 @@
|
|
|
77
76
|
"npm": ">=10.2.x"
|
|
78
77
|
},
|
|
79
78
|
"dependencies": {
|
|
80
|
-
"axios": "^1.
|
|
81
|
-
"crypto-browserify": "^3.12.1",
|
|
79
|
+
"axios": "^1.13.2",
|
|
82
80
|
"lodash": "^4.17.21",
|
|
83
|
-
"stream-browserify": "^3.0.0",
|
|
84
|
-
"typescript": "5.9.2",
|
|
85
81
|
"uuid": "^11.1.0",
|
|
86
82
|
"xml2js": "^0.6.2",
|
|
87
|
-
"zod": "^4.1.
|
|
83
|
+
"zod": "^4.1.12"
|
|
88
84
|
},
|
|
89
85
|
"volta": {
|
|
90
86
|
"node": "22.14.0",
|