@bratislava/ginis-sdk 0.1.2 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bratislava/ginis-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "A small wrapper for most commonly used requests towards the Bratislava GINIS system",
5
5
  "main": "dist/ginis-sdk.js",
6
6
  "types": "dist/ginis-sdk.d.ts",
@@ -58,8 +58,10 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "axios": "^1.3.2",
61
+ "crypto-browserify": "^3.12.0",
61
62
  "lodash": "^4.17.21",
62
- "typescript": "^4.8.4"
63
+ "stream-browserify": "^3.0.0",
64
+ "typescript": "5.1.6"
63
65
  },
64
66
  "volta": {
65
67
  "node": "16.19.0"
@@ -0,0 +1,59 @@
1
+ import type { Ginis } from '../../../ginis'
2
+ import { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'
3
+ import { GinisError } from '../../../utils/errors'
4
+
5
+ export type DetailElPodaniRequest = {
6
+ 'Id-zpravy'?: string
7
+ 'Id-el-podani'?: string
8
+ 'Id-esu'?: string
9
+ 'Id-eu'?: string
10
+ 'Zaradit-navazane'?: string
11
+ }
12
+
13
+ export type DetailElPodaniXrg = {
14
+ DetailElPodani: {
15
+ DatumPrijeti: string
16
+ StavZpracovani: string
17
+ DuvodOdmitnuti?: string
18
+ StavPodaniKod: string
19
+ StavPodaniText?: string
20
+ StavOdpovediKod: string
21
+ StavOdpovediText?: string
22
+ IdDokumentu: string
23
+ Vec?: string
24
+ SpisZnacka?: string
25
+ Znacka?: string
26
+ }[]
27
+ NavazanyDokument?: {
28
+ IdDokumentu: string
29
+ Vec?: string
30
+ SpisZnacka?: string
31
+ Znacka?: string
32
+ }
33
+ }
34
+
35
+ export type DetailElPodaniResponse = {
36
+ GRestHeader: GRestHeader
37
+ Xrg: DetailElPodaniXrg
38
+ }
39
+
40
+ export async function detailElPodani(
41
+ this: Ginis,
42
+ bodyObj: DetailElPodaniRequest
43
+ ): Promise<DetailElPodaniXrg> {
44
+ const url = this.config.urls.pod
45
+ if (!url) throw new GinisError('GINIS SDK Error: Missing POD url in GINIS config')
46
+ const response = await makeAxiosRequest<DetailElPodaniResponse>(
47
+ undefined,
48
+ `${url}/json/Detail-el-podani`,
49
+ {
50
+ GRestHeader: getGRestHeader(
51
+ this.config,
52
+ 'http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0'
53
+ ),
54
+ Xrg: { 'Detail-el-podani': bodyObj },
55
+ },
56
+ this.config.debug
57
+ )
58
+ return response.data.Xrg
59
+ }
@@ -0,0 +1,27 @@
1
+ import { Ginis } from '../../../../index'
2
+
3
+ jest.setTimeout(20000)
4
+
5
+ describe('Detail-el-podani', () => {
6
+ let ginis: Ginis
7
+ beforeAll(() => {
8
+ console.log(
9
+ 'Loading GINIS credentials from .env - make sure you have correct local configuration.'
10
+ )
11
+ ginis = new Ginis({
12
+ urls: {
13
+ pod: 'http://172.25.1.195/gordic/ginis/ws/POD01/Pod.svc',
14
+ },
15
+ username: process.env['GINIS_USERNAME']!,
16
+ password: process.env['GINIS_PASSWORD']!,
17
+ debug: false,
18
+ })
19
+ })
20
+
21
+ test('Basic request', async () => {
22
+ const data = await ginis.json.pod.detailElPodani({
23
+ 'Id-zpravy': '4f700d05-9989-4798-a469-1b05f03c9cb7',
24
+ })
25
+ expect(data.DetailElPodani[0]?.IdDokumentu).toBe('MAG0X03RZA55')
26
+ })
27
+ })
@@ -0,0 +1,5 @@
1
+ import { detailElPodani } from './Detail-el-podani'
2
+
3
+ export default {
4
+ detailElPodani,
5
+ }
@@ -0,0 +1,140 @@
1
+ import type { Ginis } from '../../../ginis'
2
+ import { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'
3
+ import { GinisError } from '../../../utils/errors'
4
+
5
+ // https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=Detail-dokumentu&type=request
6
+ export type DetailDokumentuRequest = {
7
+ 'Id-dokumentu': string
8
+ 'Vyradit-historii'?: string
9
+ 'Vyradit-obsah-spisu'?: string
10
+ 'Vyradit-prilohy'?: string
11
+ 'Vyradit-souvisejici'?: string
12
+ 'Id-esu'?: string
13
+ 'Vyradit-doruceni'?: string
14
+ 'Id-eu'?: string
15
+ }
16
+
17
+ // https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=Detail-dokumentu&type=response
18
+ export interface DetailDokumentuXrg {
19
+ WflDokument: WflDokument[]
20
+ Doruceni: Doruceni
21
+ EDoruceni: EDoruceni
22
+ HistorieDokumentu: HistorieDokumentu[]
23
+ CjDokumentu: CjDokumentu
24
+ Atribut_Xrg_IxsExt: string
25
+ }
26
+
27
+ export interface CjDokumentu {
28
+ IdInitDokumentu: string
29
+ Atribut_IdInitDokumentu_Externi: string
30
+ IdVyrizDokumentu: string
31
+ Atribut_IdVyrizDokumentu_Externi: string
32
+ Atribut_IdVyrizDokumentu_Nil: string
33
+ DenikCj: string
34
+ RokCj: string
35
+ PoradoveCisloCj: string
36
+ ZnackaCj: string
37
+ StavCj: string
38
+ DatumEvidence: string
39
+ IdZpusobVyrizeni: string
40
+ Atribut_IdZpusobVyrizeni_Externi: string
41
+ Atribut_IdZpusobVyrizeni_Nil: string
42
+ DoplnekCj: string
43
+ }
44
+
45
+ export interface Doruceni {
46
+ IdDokumentu: string
47
+ Atribut_IdDokumentu_Externi: string
48
+ Stat: string
49
+ DatumOdeslani: string
50
+ ZnackaOdesilatele: string
51
+ DatumZeDne: string
52
+ PodaciCislo: string
53
+ ZpusobDoruceni: string
54
+ DruhZasilky: string
55
+ DruhZachazeni: string
56
+ DatumPrijmuPodani: string
57
+ IdOdesilatele: string
58
+ Atribut_IdOdesilatele_Externi: string
59
+ PocetPriloh: string
60
+ IdUzluPodani: string
61
+ Atribut_IdUzluPodani_Externi: string
62
+ PoradoveCisloPodani: string
63
+ }
64
+
65
+ export interface EDoruceni {
66
+ DatumPrijeti: string
67
+ DatumDoruceni: string
68
+ IdDsOdesilatele: string
69
+ }
70
+
71
+ export interface HistorieDokumentu {
72
+ IdDokumentu: string
73
+ Atribut_IdDokumentu_Externi: string
74
+ TextZmeny: string
75
+ Poznamka: string
76
+ DatumZmeny: string
77
+ IdZmenuProvedl: string
78
+ Atribut_IdZmenuProvedl_Externi: string
79
+ IdKtgZmeny: string
80
+ }
81
+
82
+ export interface WflDokument {
83
+ IdDokumentu: string
84
+ Atribut_IdDokumentu_Externi: string
85
+ IdSpisu: string
86
+ Atribut_IdSpisu_Externi: string
87
+ PriznakSpisu: string
88
+ PriznakCj: string
89
+ IdFunkceVlastnika: string
90
+ Atribut_IdFunkceVlastnika_Externi: string
91
+ Vec: string
92
+ Znacka: string
93
+ StavDistribuce: string
94
+ StavDokumentu: string
95
+ IdAgendy: string
96
+ IdTypuDokumentu: string
97
+ PriznakDoruceni: string
98
+ PriznakEvidenceSsl: string
99
+ MistoVzniku: string
100
+ DatumPodani: string
101
+ PriznakFyzExistence: string
102
+ PriznakElObrazu: string
103
+ IdSouboru: string
104
+ Atribut_IdSouboru_Externi: string
105
+ JmenoSouboru: string
106
+ PopisSouboru: string
107
+ DatumZmeny: string
108
+ IdZmenuProvedl: string
109
+ Atribut_IdZmenuProvedl_Externi: string
110
+ VerzeSouboru: string
111
+ DatumZmenySouboru: string
112
+ VelikostSouboru: string
113
+ PriznakSouboruRo: string
114
+ }
115
+
116
+ export type DetailDokumentuResponse = {
117
+ GRestHeader: GRestHeader
118
+ Xrg: DetailDokumentuXrg
119
+ }
120
+
121
+ export async function detailDokumentu(
122
+ this: Ginis,
123
+ bodyObj: DetailDokumentuRequest
124
+ ): Promise<DetailDokumentuXrg> {
125
+ const url = this.config.urls.ssl
126
+ if (!url) throw new GinisError('GINIS SDK Error: Missing SSL url in GINIS config')
127
+ const response = await makeAxiosRequest<DetailDokumentuResponse>(
128
+ undefined,
129
+ `${url}/json/Detail-dokumentu`,
130
+ {
131
+ GRestHeader: getGRestHeader(
132
+ this.config,
133
+ 'http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-dokumentu/request/v_1.0.0.0'
134
+ ),
135
+ Xrg: { 'Detail-dokumentu': bodyObj },
136
+ },
137
+ this.config.debug
138
+ )
139
+ return response.data.Xrg
140
+ }
@@ -0,0 +1,54 @@
1
+ import type { Ginis } from '../../../ginis'
2
+ import { makeAxiosRequest, getGRestHeader, GRestHeader } from '../../../utils/api'
3
+ import { GinisError } from '../../../utils/errors'
4
+
5
+ // https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=pridat-soubor&type=request
6
+ export type PridatSouborRequest = {
7
+ 'Id-dokumentu': string
8
+ 'Id-souboru'?: string
9
+ 'Jmeno-souboru': string
10
+ 'Typ-vazby': string
11
+ 'Popis-souboru'?: string
12
+ 'Podrobny-popis-souboru'?: string
13
+ Data: string
14
+ 'Kontrola-podpisu'?: string
15
+ 'Priz-platna-verze'?: 0 | 1
16
+ 'Priz-archiv-verze'?: 0 | 1
17
+ 'Id-kategorie-typu-prilohy'?: string
18
+ }
19
+
20
+ // https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=SSL&version=390&methodName=pridat-soubor&type=response
21
+ export type PridatSouborXrg = {
22
+ Atribut_Xrg_ixsExt?: string
23
+ PridatSoubor: Array<{
24
+ DatumZmeny: string
25
+ IdSouboru: string
26
+ VerzeSouboru: number
27
+ }>
28
+ }
29
+
30
+ export type PridatSouborResponse = {
31
+ GRestHeader: GRestHeader
32
+ Xrg: PridatSouborXrg
33
+ }
34
+
35
+ export async function pridatSoubor(
36
+ this: Ginis,
37
+ bodyObj: PridatSouborRequest
38
+ ): Promise<PridatSouborXrg> {
39
+ const url = this.config.urls.ssl
40
+ if (!url) throw new GinisError('GINIS SDK Error: Missing SSL url in GINIS config')
41
+ const response = await makeAxiosRequest<PridatSouborResponse>(
42
+ undefined,
43
+ `${url}/json/Pridat-soubor`,
44
+ {
45
+ GRestHeader: getGRestHeader(
46
+ this.config,
47
+ 'http://www.gordic.cz/xrg/ssl/wfl-dokument/pridat-soubor/request/v_1.0.0.0'
48
+ ),
49
+ Xrg: { 'Pridat-soubor': bodyObj },
50
+ },
51
+ this.config.debug
52
+ )
53
+ return response.data.Xrg
54
+ }
@@ -0,0 +1,27 @@
1
+ import { Ginis } from '../../../../index'
2
+
3
+ jest.setTimeout(20000)
4
+
5
+ describe('Detail-dokumentu', () => {
6
+ let ginis: Ginis
7
+ beforeAll(() => {
8
+ console.log(
9
+ 'Loading GINIS credentials from .env - make sure you have correct local configuration.'
10
+ )
11
+ ginis = new Ginis({
12
+ urls: {
13
+ ssl: 'http://172.25.1.195/gordic/ginis/ws/SSL01_BRA/Ssl.svc',
14
+ },
15
+ username: process.env['GINIS_USERNAME']!,
16
+ password: process.env['GINIS_PASSWORD']!,
17
+ debug: false,
18
+ })
19
+ })
20
+
21
+ test('Basic request', async () => {
22
+ const data = await ginis.json.ssl.detailDokumentu({
23
+ 'Id-dokumentu': 'MAG0X03RYYSN',
24
+ })
25
+ expect(data?.HistorieDokumentu?.length).toBeGreaterThan(0)
26
+ })
27
+ })
@@ -0,0 +1,37 @@
1
+ import { Ginis } from '../../../../index'
2
+ const fs = require('fs').promises
3
+
4
+ jest.setTimeout(20000)
5
+
6
+ describe('Pridat-soubor', () => {
7
+ let ginis: Ginis
8
+ beforeAll(() => {
9
+ console.log(
10
+ 'Loading GINIS credentials from .env - make sure you have correct local configuration.'
11
+ )
12
+ ginis = new Ginis({
13
+ urls: {
14
+ ssl: 'http://172.25.1.195/gordic/ginis/ws/SSL01_BRA/Ssl.svc',
15
+ },
16
+ username: process.env['GINIS_USERNAME']!,
17
+ password: process.env['GINIS_PASSWORD']!,
18
+ debug: false,
19
+ })
20
+ })
21
+
22
+ test('Basic request', async () => {
23
+ console.log('start reading')
24
+ const contents = await fs.readFile('./src/api/json/ssl/__tests__/raw-data.bin', {
25
+ encoding: 'base64',
26
+ })
27
+ console.log('done reading ')
28
+
29
+ const data = await ginis.json.ssl.pridatSoubor({
30
+ 'Id-dokumentu': 'MAG0X03RYYSN',
31
+ 'Jmeno-souboru': 'raw-data.bin',
32
+ 'Typ-vazby': 'elektronicka-priloha',
33
+ Data: contents,
34
+ })
35
+ expect(data['PridatSoubor'][0]?.['VerzeSouboru']).toBeTruthy()
36
+ })
37
+ })
@@ -0,0 +1,7 @@
1
+ import { detailDokumentu } from './Detail-dokumentu'
2
+ import { pridatSoubor } from './Pridat-soubor'
3
+
4
+ export default {
5
+ detailDokumentu,
6
+ pridatSoubor,
7
+ }
@@ -1,10 +1,10 @@
1
1
  // full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
2
2
  import type { AxiosRequestConfig } from 'axios'
3
- import type { GinisConfig } from '../ginis'
4
- import { makeAxiosRequest } from '../utils/api'
3
+ import type { GinisConfig } from '../../ginis'
4
+ import { makeAxiosRequest } from '../../utils/api'
5
5
 
6
6
  /**
7
- * full docs https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
7
+ * full docs https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=pridat-soubor&type=request
8
8
  */
9
9
  export type pridatSoubor = {
10
10
  'Id-dokumentu'?: string
@@ -1,7 +1,7 @@
1
1
  // full UDE service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
2
2
  import type { AxiosRequestConfig } from 'axios'
3
- import type { GinisConfig } from '../ginis'
4
- import { makeAxiosRequest } from '../utils/api'
3
+ import type { GinisConfig } from '../../ginis'
4
+ import { makeAxiosRequest } from '../../utils/api'
5
5
 
6
6
  /**
7
7
  * Full docs: https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
package/src/ginis.ts CHANGED
@@ -1,6 +1,5 @@
1
- import ude from './api/ude'
2
- import ssl from './api/ssl'
3
- import type { OmitFirstTwoArgs } from './utils/types'
1
+ import ssl from './api/json/ssl'
2
+ import pod from './api/json/pod'
4
3
  import { bind, mapValues } from 'lodash'
5
4
 
6
5
  export type GinisConfig = {
@@ -9,6 +8,7 @@ export type GinisConfig = {
9
8
  urls: {
10
9
  ude?: string
11
10
  ssl?: string
11
+ pod?: string
12
12
  }
13
13
  debug?: boolean
14
14
  }
@@ -16,20 +16,20 @@ export type GinisConfig = {
16
16
  // presently empty, prepared in case we're to add default values in the future
17
17
  export const defaultConfig = {}
18
18
 
19
- type _Ude = typeof ude
19
+ type _Ssl = typeof ssl
20
20
  /**
21
- * full UDE service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=UDE&language=cs-CZ&version=390
21
+ * full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
22
22
  */
23
- export type Ude = {
24
- [P in keyof _Ude]: OmitFirstTwoArgs<_Ude[P]>
23
+ export type Ssl = {
24
+ [P in keyof _Ssl]: OmitThisParameter<_Ssl[P]>
25
25
  }
26
26
 
27
- type _Ssl = typeof ssl
27
+ type _Pod = typeof pod
28
28
  /**
29
- * full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
29
+ * full POD service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=POD&language=cs-CZ&version=390
30
30
  */
31
- export type Ssl = {
32
- [P in keyof _Ssl]: OmitFirstTwoArgs<_Ssl[P]>
31
+ export type Pod = {
32
+ [P in keyof _Pod]: OmitThisParameter<_Pod[P]>
33
33
  }
34
34
 
35
35
  // exports all services with server config bound to the one passed at construction
@@ -40,9 +40,9 @@ export class Ginis {
40
40
  * See documentation of the api for request options.
41
41
  * Inputs are typed objects, outputs unformatted xml.
42
42
  */
43
- xml: {
44
- ude: Ude
43
+ json: {
45
44
  ssl: Ssl
45
+ pod: Pod
46
46
  }
47
47
 
48
48
  constructor(config: GinisConfig) {
@@ -50,15 +50,9 @@ export class Ginis {
50
50
  ...defaultConfig,
51
51
  ...config,
52
52
  }
53
- this.xml = {
54
- ude: mapValues(
55
- ude,
56
- (v) => bind(v, this, this.config, this.config.urls.ude) as OmitFirstTwoArgs<typeof v>
57
- ),
58
- ssl: mapValues(
59
- ssl,
60
- (v) => bind(v, this, this.config, this.config.urls.ssl) as OmitFirstTwoArgs<typeof v>
61
- ),
53
+ this.json = {
54
+ ssl: mapValues(ssl, (v) => bind(v, this)),
55
+ pod: mapValues(pod, (v) => bind(v, this)),
62
56
  }
63
57
  }
64
58
  }
package/src/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // exporting axios error for easier handling of possible throws
2
+ import { AxiosError } from 'axios'
1
3
  import { Ginis, GinisConfig } from './ginis'
4
+ import { GinisError } from './utils/errors'
2
5
 
3
- export { Ginis, GinisConfig }
6
+ export { Ginis, GinisConfig, AxiosError, GinisError }
package/src/utils/api.ts CHANGED
@@ -1,26 +1,43 @@
1
1
  import axios, { AxiosRequestConfig } from 'axios'
2
+ import crypto from 'crypto'
3
+ import type { GinisConfig } from '../ginis'
2
4
 
3
- export const makeAxiosRequest = async (
4
- axiosConfig: AxiosRequestConfig,
5
+ const defaultAxiosConfig: AxiosRequestConfig = {
6
+ headers: {
7
+ 'Content-Type': 'application/json',
8
+ },
9
+ }
10
+
11
+ export const makeAxiosRequest = async <T>(
12
+ axiosConfig: AxiosRequestConfig | undefined,
5
13
  url: string | undefined,
6
- body: string,
14
+ body: string | object,
7
15
  debug?: boolean
8
16
  ) => {
9
17
  if (!url) {
10
18
  throw new Error('Missing GINIS url for the service you are trying to reach.')
11
19
  }
20
+
21
+ const requestConfig = axiosConfig || defaultAxiosConfig
22
+
12
23
  if (debug) {
13
24
  console.log('########### GINIS REQUEST ###########')
14
- console.log('headers: ', axiosConfig.headers)
25
+ console.log('headers: ', requestConfig.headers)
15
26
  console.log('body: ', body)
16
27
  console.log('########### GINIS REQUEST END ###########')
17
28
  }
18
29
  let responseAxios
19
30
  try {
20
- responseAxios = await axios.post(url, body, axiosConfig)
31
+ responseAxios = await axios.post<T>(url, body, requestConfig)
21
32
  } catch (error) {
22
33
  if (debug) {
23
- console.error(error)
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 ###########')
24
41
  }
25
42
  throw error
26
43
  }
@@ -37,3 +54,25 @@ export const makeAxiosRequest = async (
37
54
  statusText: responseAxios.statusText,
38
55
  }
39
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
+ }
@@ -0,0 +1,7 @@
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
+ }
package/tsconfig.json CHANGED
@@ -8,6 +8,7 @@
8
8
  "target": "es2021",
9
9
  "allowJs": true,
10
10
  "strict": true,
11
+ "strictBindCallApply": true,
11
12
  "esModuleInterop": true,
12
13
  "skipLibCheck": true,
13
14
  "forceConsistentCasingInFileNames": true,
@@ -22,7 +23,6 @@
22
23
  "noUncheckedIndexedAccess": true,
23
24
  "noUnusedLocals": true,
24
25
  "noUnusedParameters": true,
25
- "importsNotUsedAsValues": "error",
26
26
  "checkJs": true,
27
27
  "declaration": true,
28
28
  "declarationMap": true,
package/webpack.config.js CHANGED
@@ -15,6 +15,10 @@ module.exports = {
15
15
  },
16
16
  resolve: {
17
17
  extensions: ['.tsx', '.ts', '.js'],
18
+ fallback: {
19
+ crypto: require.resolve('crypto-browserify'),
20
+ stream: require.resolve('stream-browserify'),
21
+ },
18
22
  },
19
23
  output: {
20
24
  path: path.resolve(__dirname, 'dist'),
@@ -1,30 +0,0 @@
1
- import { Ginis } from '../src/index'
2
-
3
- describe('SSL', () => {
4
- let ginis: Ginis
5
- beforeAll(() => {
6
- console.log(
7
- 'Loading GINIS credentials from .env - make sure you have correct local configuration.'
8
- )
9
- ginis = new Ginis({
10
- urls: {
11
- ssl: 'http://172.25.1.195/gordic/ginis/ws/SSL01_BRA/Ssl.svc',
12
- },
13
- username: process.env.GINIS_USERNAME,
14
- password: process.env.GINIS_PASSWORD,
15
- debug: true,
16
- })
17
- })
18
-
19
- test('Uradna tabula: MAG0AWO0A03L - Vyveseno', async () => {
20
- const { data } = await ginis.xml.ssl.pridatSoubor({
21
- 'Id-dokumentu': 'MAG0X03RYYSN',
22
- 'Jmeno-souboru': 'test.png',
23
- 'Typ-vazby': 'elektronicka-priloha',
24
- 'Id-souboru': 'MAG00C1B194M',
25
- Data: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=',
26
- })
27
- // expected to replace a file with given id
28
- expect(data).toContain('<Id-souboru externi="false">MAG00C1B194M</Id-souboru>')
29
- })
30
- })
@@ -1,27 +0,0 @@
1
- import { Ginis } from '../src/index'
2
-
3
- describe('UDE', () => {
4
- let ginis: Ginis
5
- beforeAll(() => {
6
- console.log(
7
- 'Loading GINIS credentials from .env - make sure you have correct local configuration.'
8
- )
9
- ginis = new Ginis({
10
- urls: {
11
- ude: 'http://172.25.1.195/gordic/ginis/ws/Ude01/Ude.svc',
12
- },
13
- username: process.env.GINIS_USERNAME,
14
- password: process.env.GINIS_PASSWORD,
15
- debug: true,
16
- })
17
- })
18
-
19
- test('Uradna tabula: MAG0AWO0A03L - Vyveseno', async () => {
20
- const { data } = await ginis.xml.ude.seznamDokumentu({
21
- Stav: 'vyveseno',
22
- 'Id-uredni-desky': 'MAG0AWO0A03L',
23
- })
24
- // expect to get at least one entry, entries typically contain ids
25
- expect(data).toContain('<Id-zaznamu>')
26
- })
27
- })