@bratislava/ginis-sdk 0.3.2 → 0.3.5

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.
Files changed (87) hide show
  1. package/dist/index.js +2 -0
  2. package/dist/index.js.map +7 -0
  3. package/package.json +8 -3
  4. package/.env.example +0 -2
  5. package/.eslintrc.json +0 -84
  6. package/.github/dependabot.yml +0 -11
  7. package/.github/workflows/publish.yml +0 -18
  8. package/.github/workflows/pull.yml +0 -38
  9. package/.prettierrc +0 -7
  10. package/babel.config.js +0 -6
  11. package/dist/api/json/pod/Detail-el-podani.d.ts +0 -36
  12. package/dist/api/json/pod/Detail-el-podani.d.ts.map +0 -1
  13. package/dist/api/json/pod/__tests__/Detail-el-podani.test.d.ts +0 -2
  14. package/dist/api/json/pod/__tests__/Detail-el-podani.test.d.ts.map +0 -1
  15. package/dist/api/json/pod/index.d.ts +0 -6
  16. package/dist/api/json/pod/index.d.ts.map +0 -1
  17. package/dist/api/json/ssl/Detail-dokumentu.d.ts +0 -110
  18. package/dist/api/json/ssl/Detail-dokumentu.d.ts.map +0 -1
  19. package/dist/api/json/ssl/Pridat-soubor.d.ts +0 -29
  20. package/dist/api/json/ssl/Pridat-soubor.d.ts.map +0 -1
  21. package/dist/api/json/ssl/__tests__/Detail-dokumentu.test.d.ts +0 -2
  22. package/dist/api/json/ssl/__tests__/Detail-dokumentu.test.d.ts.map +0 -1
  23. package/dist/api/json/ssl/__tests__/Pridat-soubor.test.d.ts +0 -2
  24. package/dist/api/json/ssl/__tests__/Pridat-soubor.test.d.ts.map +0 -1
  25. package/dist/api/json/ssl/index.d.ts +0 -8
  26. package/dist/api/json/ssl/index.d.ts.map +0 -1
  27. package/dist/api/xml/ssl.d.ts +0 -35
  28. package/dist/api/xml/ssl.d.ts.map +0 -1
  29. package/dist/api/xml/ude.d.ts +0 -103
  30. package/dist/api/xml/ude.d.ts.map +0 -1
  31. package/dist/ginis-sdk.js +0 -3
  32. package/dist/ginis-sdk.js.LICENSE.txt +0 -10
  33. package/dist/ginis.d.ts +0 -42
  34. package/dist/ginis.d.ts.map +0 -1
  35. package/dist/index.d.ts +0 -5
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/utils/api.d.ts +0 -18
  38. package/dist/utils/api.d.ts.map +0 -1
  39. package/dist/utils/errors.d.ts +0 -4
  40. package/dist/utils/errors.d.ts.map +0 -1
  41. package/dist/utils/types.d.ts +0 -3
  42. package/dist/utils/types.d.ts.map +0 -1
  43. package/docs/.nojekyll +0 -1
  44. package/docs/assets/26e93147f10415a0ed4a.svg +0 -6
  45. package/docs/assets/75c9471662e97ee24f29.svg +0 -7
  46. package/docs/assets/custom.css +0 -1
  47. package/docs/assets/custom.js +0 -1
  48. package/docs/assets/db90e4df2373980c497d.svg +0 -9
  49. package/docs/assets/highlight.css +0 -92
  50. package/docs/assets/main.js +0 -58
  51. package/docs/assets/search.js +0 -1
  52. package/docs/assets/style.css +0 -1280
  53. package/docs/classes/index.Ginis.html +0 -115
  54. package/docs/functions/api_ssl.pridatSoubor-1.html +0 -73
  55. package/docs/functions/api_ude.seznamDokumentu-1.html +0 -73
  56. package/docs/index.html +0 -110
  57. package/docs/modules/api_ssl.html +0 -75
  58. package/docs/modules/api_ude.html +0 -75
  59. package/docs/modules/index.html +0 -71
  60. package/docs/modules.html +0 -62
  61. package/docs/types/api_ssl.pridatSoubor.html +0 -87
  62. package/docs/types/api_ude.seznamDokumentu.html +0 -171
  63. package/docs/types/index.GinisConfig.html +0 -76
  64. package/docs/variables/api_ssl.default.html +0 -80
  65. package/docs/variables/api_ude.default.html +0 -80
  66. package/ginis.d.ts +0 -41
  67. package/jest.config.js +0 -1
  68. package/src/api/json/pod/Detail-el-podani.ts +0 -59
  69. package/src/api/json/pod/__tests__/Detail-el-podani.test.ts +0 -27
  70. package/src/api/json/pod/index.ts +0 -5
  71. package/src/api/json/ssl/Detail-dokumentu.ts +0 -140
  72. package/src/api/json/ssl/Pridat-soubor.ts +0 -54
  73. package/src/api/json/ssl/__tests__/Detail-dokumentu.test.ts +0 -27
  74. package/src/api/json/ssl/__tests__/Pridat-soubor.test.ts +0 -37
  75. package/src/api/json/ssl/__tests__/raw-data.bin +0 -0
  76. package/src/api/json/ssl/index.ts +0 -7
  77. package/src/api/xml/ssl.ts +0 -71
  78. package/src/api/xml/ude.ts +0 -141
  79. package/src/ginis.ts +0 -58
  80. package/src/index.ts +0 -6
  81. package/src/utils/api.ts +0 -78
  82. package/src/utils/errors.ts +0 -7
  83. package/src/utils/types.ts +0 -7
  84. package/tsconfig.json +0 -37
  85. package/tsconfig.spec.json +0 -5
  86. package/typedoc.json +0 -9
  87. package/webpack.config.js +0 -42
@@ -1,141 +0,0 @@
1
- // full UDE service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
2
- import type { AxiosRequestConfig } from 'axios'
3
- import type { GinisConfig } from '../../ginis'
4
- import { makeAxiosRequest } from '../../utils/api'
5
-
6
- /**
7
- * Full docs: https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
8
- */
9
- export type seznamDokumentu = {
10
- /**
11
- * UDE - Vrátit pouze informace evidované v GINIS modulu Úřední deska. Tj. základní informace o vyvěšeném záznamu. Elementy: Id-zaznamu ... Id-dokumentu.
12
- * UDEWFL - Když byl záznam vyvěšen z GINIS modulu, jsou o něm dotaženy základní informace (další možno získat voláním XRG-SSL). Elementy: Id-zaznamu ... Id-dokumentu + Puvod-dokumentu ... Cj-spisu
13
- * UDESML - Když byl záznam vyvěšen z GINIS modulu SML, jsou o něm dotaženy informace. Elementy: Id-zaznamu ... Id-dokumentu + Cislo-sml ... Odbor-sml.
14
- * UDEWFLSML - Informace UDE + WFL + SML. Vrátí vše.
15
- */
16
- 'Vratit-info'?: 'UDE' | 'UDEWFL' | 'UDESML' | 'UDEWFLSML'
17
- /**
18
- * vyveseno - vyvěšeno
19
- * sejmuto - sejmuto
20
- */
21
- Stav?: string
22
- 'Id-uredni-desky'?: string
23
- 'Id-kategorie'?: string
24
- /**
25
- * ISO-string date format
26
- */
27
- 'Vyveseno-od'?: string
28
- /**
29
- * ISO-string date format
30
- */
31
- 'Vyveseno-od-horni-mez'?: string
32
- /**
33
- * ISO-string date format
34
- */
35
- 'Sejmuto-od'?: string
36
- /**
37
- * ISO-string date format
38
- */
39
- 'Sejmuto-od-horni-mez'?: string
40
- /**
41
- * Název záznamu. Hledáno přes LIKE "%hodnota%" bez ohledu na diakritiku a velikost písmen (na db stroji Informix s ohledem na diakritiku)
42
- * Max 254 chars
43
- */
44
- Nazev?: string
45
- /**
46
- * Popis záznamu. Hledáno přes LIKE "%hodnota%" bez ohledu na diakritiku a velikost písmen (na db stroji Informix s ohledem na diakritiku)
47
- * Max 254 chars
48
- */
49
- Popis?: string
50
- Zdroj?: string
51
- /**
52
- * rucni-evidence - ruční evidence
53
- * elektronicke-podani - elektronické podání
54
- * datova-schranka - datová schránka
55
- * interface-xrg - interface, xrg
56
- */
57
- 'Puvod-dokumentu'?: string
58
- 'Odesilatel-dokumentu'?: string
59
- 'Cj-spisu'?: string
60
- /**
61
- * ISO-string date-time format
62
- */
63
- 'Datum-zmeny'?: string
64
- /**
65
- * ISO-string date-time format
66
- */
67
- 'Datum-zmeny-horni-mez'?: string
68
- 'Cislo-sml'?: string
69
- 'Typ-sml'?: string
70
- 'Nazev-sml'?: string
71
- 'Nazev-sub-sml'?: string
72
- 'Prijmeni-sub-sml'?: string
73
- 'Jmeno-sub-sml'?: string
74
- 'Ico-sub-sml'?: string
75
- 'Obec-sub-sml'?: string
76
- 'Ulice-sub-sml'?: string
77
- 'Cor-sub-sml'?: string
78
- 'Cpop-sub-sml'?: string
79
- 'Psc-sub-sml'?: string
80
- 'Typ-sub-sml'?: string
81
- /**
82
- * ISO-string date format
83
- */
84
- 'Datum-uzavreni-sml-od'?: string
85
- /**
86
- * ISO-string date format
87
- */
88
- 'Datum-uzavreni-sml-do'?: string
89
- 'Odbor-sml'?: string
90
- 'Celkova-castka-od-sml'?: string
91
- 'Celkova-castka-do-sml'?: string
92
- 'Mena-sml'?: string
93
- }
94
-
95
- export const seznamDokumentu = async (
96
- config: GinisConfig,
97
- url: string | undefined,
98
- bodyObj: seznamDokumentu
99
- ) => {
100
- const axiosConfig: AxiosRequestConfig = {
101
- headers: {
102
- 'Content-Type': 'text/xml; charset=utf-8',
103
- SOAPAction: 'http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0/Seznam-dokumentu',
104
- },
105
- }
106
- const body = `
107
- <s:Envelope
108
- xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
109
- xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
110
- <s:Header>
111
- <o:Security s:mustUnderstand="1"
112
- xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
113
- <o:UsernameToken u:Id="uuid-ea5d8d3d-df90-4b69-b034-9026f34a3f21-1">
114
- <o:Username>${config.username}</o:Username>
115
- <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">${
116
- config.password
117
- }</o:Password>
118
- </o:UsernameToken>
119
- </o:Security>
120
- </s:Header>
121
- <s:Body>
122
- <Seznam-dokumentu
123
- xmlns="http://www.gordic.cz/svc/xrg-ude/v_1.0.0.0">
124
- <requestXml>
125
- <Xrg
126
- xmlns="http://www.gordic.cz/xrg/ude/seznam-dokumentu/request/v_1.0.0.0">
127
- <Seznam-dokumentu>
128
- ${Object.entries(bodyObj).map(([key, value]) => `<${key}>${value}</${key}>`)}
129
- </Seznam-dokumentu>
130
- </Xrg>
131
- </requestXml>
132
- </Seznam-dokumentu>
133
- </s:Body>
134
- </s:Envelope>
135
- `
136
- return makeAxiosRequest(axiosConfig, url, body, config.debug)
137
- }
138
-
139
- export default {
140
- seznamDokumentu,
141
- }
package/src/ginis.ts DELETED
@@ -1,58 +0,0 @@
1
- import ssl from './api/json/ssl'
2
- import pod from './api/json/pod'
3
- import { bind, mapValues } from 'lodash'
4
-
5
- export type GinisConfig = {
6
- username: string
7
- password: string
8
- urls: {
9
- ude?: string
10
- ssl?: string
11
- pod?: string
12
- }
13
- debug?: boolean
14
- }
15
-
16
- // presently empty, prepared in case we're to add default values in the future
17
- export const defaultConfig = {}
18
-
19
- type _Ssl = typeof ssl
20
- /**
21
- * full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
22
- */
23
- export type Ssl = {
24
- [P in keyof _Ssl]: OmitThisParameter<_Ssl[P]>
25
- }
26
-
27
- type _Pod = typeof pod
28
- /**
29
- * full POD service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=POD&language=cs-CZ&version=390
30
- */
31
- export type Pod = {
32
- [P in keyof _Pod]: OmitThisParameter<_Pod[P]>
33
- }
34
-
35
- // exports all services with server config bound to the one passed at construction
36
- export class Ginis {
37
- config: GinisConfig
38
- /**
39
- * Exports functions of the api's with config and url values bound.
40
- * See documentation of the api for request options.
41
- * Inputs are typed objects, outputs unformatted xml.
42
- */
43
- json: {
44
- ssl: Ssl
45
- pod: Pod
46
- }
47
-
48
- constructor(config: GinisConfig) {
49
- this.config = {
50
- ...defaultConfig,
51
- ...config,
52
- }
53
- this.json = {
54
- ssl: mapValues(ssl, (v) => bind(v, this)),
55
- pod: mapValues(pod, (v) => bind(v, this)),
56
- }
57
- }
58
- }
package/src/index.ts DELETED
@@ -1,6 +0,0 @@
1
- // exporting axios error for easier handling of possible throws
2
- import { AxiosError } from 'axios'
3
- import { Ginis, GinisConfig } from './ginis'
4
- import { GinisError } from './utils/errors'
5
-
6
- export { Ginis, GinisConfig, AxiosError, GinisError }
package/src/utils/api.ts DELETED
@@ -1,78 +0,0 @@
1
- import axios, { AxiosRequestConfig } from 'axios'
2
- import crypto from 'crypto'
3
- import type { GinisConfig } from '../ginis'
4
-
5
- const defaultAxiosConfig: AxiosRequestConfig = {
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- },
9
- }
10
-
11
- export const makeAxiosRequest = async <T>(
12
- axiosConfig: AxiosRequestConfig | undefined,
13
- url: string | undefined,
14
- body: string | object,
15
- debug?: boolean
16
- ) => {
17
- if (!url) {
18
- throw new Error('Missing GINIS url for the service you are trying to reach.')
19
- }
20
-
21
- const requestConfig = axiosConfig || defaultAxiosConfig
22
-
23
- if (debug) {
24
- console.log('########### GINIS REQUEST ###########')
25
- console.log('headers: ', requestConfig.headers)
26
- console.log('body: ', body)
27
- console.log('########### GINIS REQUEST END ###########')
28
- }
29
- let responseAxios
30
- try {
31
- responseAxios = await axios.post<T>(url, body, requestConfig)
32
- } catch (error) {
33
- if (debug) {
34
- let anyError = error as any
35
- console.error(anyError)
36
- console.log('########### GINIS ERROR RESPONSE ###########')
37
- console.log('status: ', anyError?.response?.status)
38
- console.log('statusText: ', anyError?.response?.statusText)
39
- console.log('data: ', anyError?.response?.data)
40
- console.log('########### GINIS RESPONSE END ###########')
41
- }
42
- throw error
43
- }
44
- if (debug) {
45
- console.log('########### GINIS RESPONSE ###########')
46
- console.log('status: ', responseAxios.status)
47
- console.log('statusText: ', responseAxios.statusText)
48
- console.log('data: ', responseAxios.data)
49
- console.log('########### GINIS RESPONSE END ###########')
50
- }
51
- return {
52
- data: responseAxios.data,
53
- status: responseAxios.status,
54
- statusText: responseAxios.statusText,
55
- }
56
- }
57
-
58
- export type GRestHeader = {
59
- RequestName: string
60
- RequestNamespace: string
61
- User: string
62
- Password: string
63
- PasswordText: boolean
64
- Nonce: string
65
- Created: string
66
- }
67
-
68
- export const getGRestHeader = (config: GinisConfig, requestNamespace: string): GRestHeader => {
69
- return {
70
- RequestName: 'Xrg',
71
- RequestNamespace: requestNamespace,
72
- User: config.username,
73
- Password: config.password,
74
- PasswordText: true,
75
- Nonce: crypto.randomBytes(10).toString('base64'),
76
- Created: new Date().toISOString(),
77
- }
78
- }
@@ -1,7 +0,0 @@
1
- // may get more data later
2
- // for now serves as a way to easily distinguish in client code by instance type
3
- export class GinisError extends Error {
4
- constructor(message: string) {
5
- super(message)
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- export type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R
2
- ? (...args: P) => R
3
- : never
4
-
5
- export type OmitFirstTwoArgs<F> = F extends (x: any, y: any, ...args: infer P) => infer R
6
- ? (...args: P) => R
7
- : never
package/tsconfig.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "display": "Node 16 + ESM + Strictest",
4
- "compilerOptions": {
5
- "outDir": "dist",
6
- "lib": ["es2021"],
7
- "module": "es2022",
8
- "target": "es2021",
9
- "allowJs": true,
10
- "strict": true,
11
- "strictBindCallApply": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "moduleResolution": "node",
16
- "allowUnusedLabels": false,
17
- "allowUnreachableCode": false,
18
- "exactOptionalPropertyTypes": true,
19
- "noFallthroughCasesInSwitch": true,
20
- "noImplicitOverride": true,
21
- "noImplicitReturns": true,
22
- "noPropertyAccessFromIndexSignature": true,
23
- "noUncheckedIndexedAccess": true,
24
- "noUnusedLocals": true,
25
- "noUnusedParameters": true,
26
- "checkJs": true,
27
- "declaration": true,
28
- "declarationMap": true,
29
- "plugins": [
30
- {
31
- "name": "typescript-strict-plugin"
32
- }
33
- ]
34
- },
35
- "include": ["src/**/*"],
36
- "exclude": ["dist", "docs", "node_modules", "bin"]
37
- }
@@ -1,5 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "types": ["jest", "node"]
4
- }
5
- }
package/typedoc.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["./src/index.ts", "./src/api/ssl.ts", "./src/api/ude.ts"],
4
- "entryPointStrategy": "Expand",
5
- "plugin": ["typedoc-theme-hierarchy"],
6
- "theme": "hierarchy",
7
- "name": "GINIS SDK",
8
- "out": "docs"
9
- }
package/webpack.config.js DELETED
@@ -1,42 +0,0 @@
1
- const path = require('path')
2
- const ESLintPlugin = require('eslint-webpack-plugin')
3
-
4
- module.exports = {
5
- entry: './src/index.ts',
6
- devtool: 'inline-source-map',
7
- module: {
8
- rules: [
9
- {
10
- test: /\.tsx?$/,
11
- use: 'ts-loader',
12
- exclude: /node_modules/,
13
- },
14
- ],
15
- },
16
- resolve: {
17
- extensions: ['.tsx', '.ts', '.js'],
18
- fallback: {
19
- crypto: require.resolve('crypto-browserify'),
20
- stream: require.resolve('stream-browserify'),
21
- },
22
- },
23
- output: {
24
- path: path.resolve(__dirname, 'dist'),
25
- filename: 'ginis-sdk.js',
26
- globalObject: 'this',
27
- library: {
28
- name: 'ginis-sdk',
29
- type: 'umd',
30
- },
31
- },
32
- mode: 'production',
33
- plugins: [new ESLintPlugin()],
34
- externals: {
35
- lodash: {
36
- commonjs: 'lodash',
37
- commonjs2: 'lodash',
38
- amd: 'lodash',
39
- root: '_',
40
- },
41
- },
42
- }