@orchesty/connector-flexi-bee 1.0.0 → 1.0.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/dist/package.json +4 -1
- package/package.json +4 -1
- package/CHANGELOG.md +0 -7
- package/coverage/clover.xml +0 -389
- package/coverage/coverage-final.json +0 -19
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -161
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/Batch/FlexiBeeFormaDopravyBatch.ts.html +0 -145
- package/coverage/lcov-report/src/Batch/FlexiBeeFormaUhradyBatch.ts.html +0 -148
- package/coverage/lcov-report/src/Batch/FlexiBeeGetSkladovyPohybBatch.ts.html +0 -139
- package/coverage/lcov-report/src/Batch/FlexiBeeObjednavkaPrijataBatch.ts.html +0 -145
- package/coverage/lcov-report/src/Batch/FlexiBeeObjednavkaVydanaBatch.ts.html +0 -145
- package/coverage/lcov-report/src/Batch/FlexiBeeSimpleIterator.ts.html +0 -295
- package/coverage/lcov-report/src/Batch/FlexiBeeSkladoveKartyBatch.ts.html +0 -298
- package/coverage/lcov-report/src/Batch/FlexiBeeStitkyBatch.ts.html +0 -145
- package/coverage/lcov-report/src/Batch/index.html +0 -221
- package/coverage/lcov-report/src/Connector/FlexiBeeCreateObjednavkaVydanaConnector.ts.html +0 -322
- package/coverage/lcov-report/src/Connector/FlexiBeeCreateSkladovyPohybConnector.ts.html +0 -346
- package/coverage/lcov-report/src/Connector/FlexiBeeGetCenikKartyConnector.ts.html +0 -829
- package/coverage/lcov-report/src/Connector/FlexiBeeGetObjednavkaVydanaConnector.ts.html +0 -316
- package/coverage/lcov-report/src/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.ts.html +0 -304
- package/coverage/lcov-report/src/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.ts.html +0 -322
- package/coverage/lcov-report/src/Connector/FlexiBeeUpdateSkladovyPohybConnector.ts.html +0 -361
- package/coverage/lcov-report/src/Connector/index.html +0 -206
- package/coverage/lcov-report/src/FexiBeeApplication.ts.html +0 -694
- package/coverage/lcov-report/src/FlexiBee.utils.ts.html +0 -142
- package/coverage/lcov-report/src/index.html +0 -131
- package/coverage/lcov-report/test/dataProvider.ts.html +0 -496
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov.info +0 -633
- package/jest.config.js +0 -13
- package/src/Batch/FlexiBeeFormaDopravyBatch.ts +0 -20
- package/src/Batch/FlexiBeeFormaUhradyBatch.ts +0 -21
- package/src/Batch/FlexiBeeGetSkladovyPohybBatch.ts +0 -18
- package/src/Batch/FlexiBeeObjednavkaPrijataBatch.ts +0 -20
- package/src/Batch/FlexiBeeObjednavkaVydanaBatch.ts +0 -20
- package/src/Batch/FlexiBeeSimpleIterator.ts +0 -70
- package/src/Batch/FlexiBeeSkladoveKartyBatch.ts +0 -71
- package/src/Batch/FlexiBeeStitkyBatch.ts +0 -20
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/mock.json +0 -18
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/mock.json +0 -19
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/input.json +0 -8
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/mock.json +0 -107
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/mock.json +0 -162
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/mock.json +0 -200
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/mock.json +0 -66
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/output.json +0 -11
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/input.json +0 -6
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/mock.json +0 -18
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/output.json +0 -11
- package/src/Batch/__tests__/FlexiBeeFormaDopravyBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeFormaUhradyBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeGetSkladovyPohybBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeObjednavkaPrijataBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeObjednavkaVydanaBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeSkladoveKartyBatch.ts +0 -17
- package/src/Batch/__tests__/FlexiBeeStitkyBatch.ts +0 -17
- package/src/Connector/FlexiBeeCreateNewContactConnector.ts +0 -98
- package/src/Connector/FlexiBeeCreateObjednavkaVydanaConnector.ts +0 -79
- package/src/Connector/FlexiBeeCreateSkladovyPohybConnector.ts +0 -87
- package/src/Connector/FlexiBeeGetCenikKartyConnector.ts +0 -248
- package/src/Connector/FlexiBeeGetContactsArrayConnector.ts +0 -28
- package/src/Connector/FlexiBeeGetObjednavkaVydanaConnector.ts +0 -77
- package/src/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.ts +0 -73
- package/src/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.ts +0 -79
- package/src/Connector/FlexiBeeUpdateSkladovyPohybConnector.ts +0 -92
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/input.json +0 -8
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/mock.json +0 -24
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/output.json +0 -12
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/input.json +0 -8
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/mock.json +0 -24
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/output.json +0 -12
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/input.json +0 -59
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/mock.json +0 -211
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/output.json +0 -261
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/input.json +0 -8
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/mock.json +0 -193
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/output.json +0 -187
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/input.json +0 -261
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/mock.json +0 -49
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/output.json +0 -301
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/input.json +0 -8
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/mock.json +0 -24
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/output.json +0 -12
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/input.json +0 -9
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/mock.json +0 -24
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/output.json +0 -12
- package/src/Connector/__tests__/FlexiBeeCreateObjednavkaVydanaConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeCreateSkladovyPohybConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeGetCenikKartyConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeGetObjednavkaVydanaConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeGetSarzeExpiraceKartyConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeUpdateObjednavkaPrijataConnector.ts +0 -17
- package/src/Connector/__tests__/FlexiBeeUpdateSkladovyPohybConnector.ts +0 -17
- package/src/FexiBeeApplication.ts +0 -203
- package/src/FlexiBee.utils.ts +0 -19
- package/src/types/FlexiBeeObjednavkaPrijata.ts +0 -153
- package/src/types/FlexiBeeObjednavkaVydana.ts +0 -188
- package/src/types/FlexiBeeSkladovyPohyb.ts +0 -97
- package/test/dataProvider.ts +0 -137
- package/tsconfig.json +0 -8
- package/tsconfig.prod.json +0 -13
- package/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"http": "PUT https://demo.flexibee.eu/c/demo/skladovy-pohyb",
|
|
3
|
-
"code": 200,
|
|
4
|
-
"body": {
|
|
5
|
-
"winstrom": {
|
|
6
|
-
"@version": "1.0",
|
|
7
|
-
"success": "true",
|
|
8
|
-
"stats": {
|
|
9
|
-
"created": "0",
|
|
10
|
-
"updated": "1",
|
|
11
|
-
"deleted": "0",
|
|
12
|
-
"skipped": "0",
|
|
13
|
-
"failed": "0"
|
|
14
|
-
},
|
|
15
|
-
"results": [
|
|
16
|
-
{
|
|
17
|
-
"id": "1",
|
|
18
|
-
"request-id": "1",
|
|
19
|
-
"ref": "/c/olaola_s_r_o_/skladovy-pohyb/1"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_CREATE_OBJEDNAVKA_VYDANA } from '../FlexiBeeCreateObjednavkaVydanaConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeCreateObjednavkaVydanaConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_CREATE_OBJEDNAVKA_VYDANA);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_CREATE_SKLADOVY_POHYB } from '../FlexiBeeCreateSkladovyPohybConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeCreateSkladovyPohybConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_CREATE_SKLADOVY_POHYB);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_GET_CENIK_KARTY_CONNECTOR } from '../FlexiBeeGetCenikKartyConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeGetCenikKartyConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_GET_CENIK_KARTY_CONNECTOR);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_GET_OBJEDNAVKA_VYDANA_CONNECTOR } from '../FlexiBeeGetObjednavkaVydanaConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeGetObjednavkaVydanaConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_GET_OBJEDNAVKA_VYDANA_CONNECTOR);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_GET_SARZE_EXPIRACE_KARTY_CONNECTOR } from '../FlexiBeeGetSarzeExpiraceKartyConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeGetSarzeExpiraceKartyConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_GET_SARZE_EXPIRACE_KARTY_CONNECTOR);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_UPDATE_OBJEDNAVKA_PRIJATA } from '../FlexiBeeUpdateObjednavkaPrijataConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeUpdateObjednavkaPrijataConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_UPDATE_OBJEDNAVKA_PRIJATA);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import { initFlexiBeeTest } from '../../../test/dataProvider';
|
|
4
|
-
import { FLEXI_BEE_UPDATE_SKLADOVY_POHYB } from '../FlexiBeeUpdateSkladovyPohybConnector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for FlexiBeeUpdateSkladovyPohybConnector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename);
|
|
11
|
-
initFlexiBeeTest();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(FLEXI_BEE_UPDATE_SKLADOVY_POHYB);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import CoreFormsEnum, { getFormName } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
|
|
2
|
-
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
3
|
-
import Field from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field';
|
|
4
|
-
import FieldType from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType';
|
|
5
|
-
import Form from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form';
|
|
6
|
-
import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
|
|
7
|
-
import {
|
|
8
|
-
ABasicApplication,
|
|
9
|
-
PASSWORD,
|
|
10
|
-
USER,
|
|
11
|
-
} from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
|
|
12
|
-
import DatabaseClient from '@orchesty/nodejs-sdk/dist/lib/Storage/Database/Client';
|
|
13
|
-
import CurlSender from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/CurlSender';
|
|
14
|
-
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
15
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
16
|
-
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
17
|
-
import { encode } from '@orchesty/nodejs-sdk/dist/lib/Utils/Base64';
|
|
18
|
-
import DateTimeUtils from '@orchesty/nodejs-sdk/dist/lib/Utils/DateTimeUtils';
|
|
19
|
-
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
20
|
-
|
|
21
|
-
export const CANNOT_GET_BODY = 'Cannot get body from response.';
|
|
22
|
-
export const TOKEN_NOT_SUCCESS = 'Token is not succeed returned';
|
|
23
|
-
|
|
24
|
-
export const FLEXIBEE_URL = 'flexibeeUrl';
|
|
25
|
-
|
|
26
|
-
const CLIENT_SETTINGS = 'client_settings';
|
|
27
|
-
const AUTH_SESSION_ID = 'authSessionId';
|
|
28
|
-
const REFRESH_TOKEN = 'refreshToken';
|
|
29
|
-
const CSRF_TOKEN = 'csrfToken';
|
|
30
|
-
const TOKEN_GET = 'token_get';
|
|
31
|
-
|
|
32
|
-
const AUTH = 'auth';
|
|
33
|
-
const AUTH_JSON = 'json';
|
|
34
|
-
const AUTH_HTTP = 'http';
|
|
35
|
-
|
|
36
|
-
const X_AUTH_SESSION_ID = 'X-authSessionId';
|
|
37
|
-
|
|
38
|
-
const TOKEN_MAX_LIFE = 60 * 30; // 30 min
|
|
39
|
-
|
|
40
|
-
const ENDPOINT_LOGIN = 'login-logout/login.json';
|
|
41
|
-
|
|
42
|
-
export const FLEXI_BEE_APPLICATION = 'flexibee';
|
|
43
|
-
|
|
44
|
-
interface IToken {
|
|
45
|
-
success: boolean;
|
|
46
|
-
[AUTH_SESSION_ID]: string;
|
|
47
|
-
[REFRESH_TOKEN]: string;
|
|
48
|
-
[CSRF_TOKEN]: string;
|
|
49
|
-
[TOKEN_GET]: number;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default class FlexiBeeApplication extends ABasicApplication {
|
|
53
|
-
|
|
54
|
-
public constructor(private readonly sender: CurlSender, private readonly dbClient: DatabaseClient) {
|
|
55
|
-
super();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public getName(): string {
|
|
59
|
-
return FLEXI_BEE_APPLICATION;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public getDescription(): string {
|
|
63
|
-
return 'Modern economic system designed for small companies';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public getPublicName(): string {
|
|
67
|
-
return 'FlexiBee';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public getLogo(): string {
|
|
71
|
-
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IlZyc3R2YV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAwIDEwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOnVybCgjU1ZHSURfMV8pO30KCS5zdDF7ZmlsbDojNjQ2MzYzO30KPC9zdHlsZT4KPGcgaWQ9IlZyc3R2YV8yXzFfIj4KCTxnIGlkPSJMb2dhIj4KCQk8Zz4KCQkJCgkJCQk8bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzFfIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjY2LjY5MjIiIHkxPSIyMC42Nzk0IiB4Mj0iNjYuNjkyMiIgeTI9Ijc4LjU2MDEiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCA5OS42MTk4KSI+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRjdCMzAwIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjEyIiBzdHlsZT0ic3RvcC1jb2xvcjojRjZBRjAzIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjI1IiBzdHlsZT0ic3RvcC1jb2xvcjojRjVBMjBCIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjM4IiBzdHlsZT0ic3RvcC1jb2xvcjojRjI4RTFBIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjUxIiBzdHlsZT0ic3RvcC1jb2xvcjojRUY3MTJFIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjY0IiBzdHlsZT0ic3RvcC1jb2xvcjojRUE0QjQ3Ii8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjc3IiBzdHlsZT0ic3RvcC1jb2xvcjojRTUxRTY2Ii8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIwLjg1IiBzdHlsZT0ic3RvcC1jb2xvcjojRTEwMDdCIi8+CgkJCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojRTEwMDdCIi8+CgkJCTwvbGluZWFyR3JhZGllbnQ+CgkJCTxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzMuNSwyMS4xIDY2LjksMjEuMSA5OS45LDc4LjkgNjYuNSw3OC45IAkJCSIvPgoJCQk8cG9seWdvbiBjbGFzcz0ic3QxIiBwb2ludHM9IjMzLjUsMjEuMSAwLjEsNzguOSAzMy41LDc4LjkgNjYuOSwyMS4xIAkJCSIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public async getRequestDto(
|
|
75
|
-
dto: AProcessDto,
|
|
76
|
-
applicationInstall: ApplicationInstall,
|
|
77
|
-
method: HttpMethods,
|
|
78
|
-
url?: string,
|
|
79
|
-
data?: unknown,
|
|
80
|
-
): Promise<RequestDto> {
|
|
81
|
-
let headers;
|
|
82
|
-
if (applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][AUTH] === AUTH_JSON) {
|
|
83
|
-
headers = {
|
|
84
|
-
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
85
|
-
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
86
|
-
[X_AUTH_SESSION_ID]: await this.getApiToken(applicationInstall, dto),
|
|
87
|
-
};
|
|
88
|
-
} else if (applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][AUTH] === AUTH_HTTP) {
|
|
89
|
-
headers = {
|
|
90
|
-
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
91
|
-
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
92
|
-
[CommonHeaders.AUTHORIZATION]: `Basic ${encode(`${applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][USER]}:${applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][PASSWORD]}`)}`,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return new RequestDto(url ?? '', method, dto, data, headers);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public getFormStack(): FormStack {
|
|
100
|
-
const authTypeField = new Field(FieldType.SELECT_BOX, AUTH, 'Authorize type', null, true);
|
|
101
|
-
|
|
102
|
-
authTypeField.setChoices([{ [AUTH_HTTP]: AUTH_HTTP }, { [AUTH_JSON]: AUTH_JSON }]);
|
|
103
|
-
|
|
104
|
-
const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
|
|
105
|
-
.addField(new Field(FieldType.TEXT, USER, 'User', null, true))
|
|
106
|
-
.addField(new Field(FieldType.TEXT, PASSWORD, 'Password', null, true))
|
|
107
|
-
.addField(new Field(FieldType.URL, FLEXIBEE_URL, 'Flexibee URL', null, true))
|
|
108
|
-
.addField(authTypeField);
|
|
109
|
-
|
|
110
|
-
return new FormStack().addForm(form);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
114
|
-
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
115
|
-
return authorizationForm?.[PASSWORD] && authorizationForm?.[FLEXIBEE_URL];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public getUrl(applicationInstall: ApplicationInstall, url?: string): string {
|
|
119
|
-
const host = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][FLEXIBEE_URL] ?? '';
|
|
120
|
-
|
|
121
|
-
if (!host) {
|
|
122
|
-
throw Error('There is no flexibee url');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return `${host}/${url}`;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private async getApiToken(applicationInstall: ApplicationInstall, dto: AProcessDto): Promise<string> {
|
|
129
|
-
let token = await this.getApiTokenFromSettings(applicationInstall);
|
|
130
|
-
|
|
131
|
-
if (!token) {
|
|
132
|
-
const res = await this.sender.send<IToken>(this.getApiTokenDto(applicationInstall, dto), [200]);
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
token = res.getJsonBody();
|
|
136
|
-
} catch (Throwable) {
|
|
137
|
-
throw Error(CANNOT_GET_BODY, { cause: Throwable });
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (!token.success) {
|
|
141
|
-
throw Error(TOKEN_NOT_SUCCESS);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
applicationInstall.addSettings(
|
|
145
|
-
{
|
|
146
|
-
[CLIENT_SETTINGS]: {
|
|
147
|
-
[AUTH_SESSION_ID]: token[AUTH_SESSION_ID],
|
|
148
|
-
[REFRESH_TOKEN]: token[REFRESH_TOKEN],
|
|
149
|
-
[CSRF_TOKEN]: token[CSRF_TOKEN],
|
|
150
|
-
[TOKEN_GET]: DateTimeUtils.getTimestamp(DateTimeUtils.getUtcDate()),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
);
|
|
154
|
-
const repository = this.dbClient.getApplicationRepository();
|
|
155
|
-
await repository.insert(applicationInstall);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return token[AUTH_SESSION_ID];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
private async getApiTokenFromSettings(
|
|
162
|
-
applicationInstall: ApplicationInstall,
|
|
163
|
-
): Promise<IToken | null> {
|
|
164
|
-
const repository = this.dbClient.getApplicationRepository();
|
|
165
|
-
await repository.findById(applicationInstall.getId());
|
|
166
|
-
const token = applicationInstall.getSettings()[CLIENT_SETTINGS] ?? [];
|
|
167
|
-
|
|
168
|
-
const date = DateTimeUtils.getUtcDate();
|
|
169
|
-
const valid = date.setMinutes(date.getMinutes() - TOKEN_MAX_LIFE);
|
|
170
|
-
|
|
171
|
-
if (token[AUTH_SESSION_ID] !== undefined && token[TOKEN_GET] !== undefined && token[TOKEN_GET] > valid) {
|
|
172
|
-
return token;
|
|
173
|
-
}
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
private getApiTokenDto(applicationInstall: ApplicationInstall, dto: AProcessDto): RequestDto {
|
|
178
|
-
const setting = applicationInstall.getSettings();
|
|
179
|
-
if (!this.isAuthorized(applicationInstall)) {
|
|
180
|
-
throw new Error('User is not authenticated');
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const user = setting[CoreFormsEnum.AUTHORIZATION_FORM][USER];
|
|
184
|
-
const password = setting[CoreFormsEnum.AUTHORIZATION_FORM][PASSWORD];
|
|
185
|
-
|
|
186
|
-
const headers = {
|
|
187
|
-
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
188
|
-
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
return new RequestDto(
|
|
192
|
-
this.getUrl(applicationInstall, ENDPOINT_LOGIN),
|
|
193
|
-
HttpMethods.POST,
|
|
194
|
-
dto,
|
|
195
|
-
JSON.stringify({
|
|
196
|
-
[USER]: user,
|
|
197
|
-
[PASSWORD]: password,
|
|
198
|
-
}),
|
|
199
|
-
headers,
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}
|
package/src/FlexiBee.utils.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param ref /c/demo/cenik/2.json
|
|
3
|
-
* @return string 2
|
|
4
|
-
*/
|
|
5
|
-
export function parseFlexiBeeId(ref: string): string {
|
|
6
|
-
const res = /\/(?<id>\d+)\.json/.exec(ref);
|
|
7
|
-
|
|
8
|
-
return res?.groups?.id ?? '';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param ref /c/demo/cenik/2.json
|
|
13
|
-
* @return string cenik/2.json
|
|
14
|
-
*/
|
|
15
|
-
export function parseFlexiBeeUri(ref: string): string {
|
|
16
|
-
const res = /(?<uri>[^/]+\/\d+.json)/.exec(ref);
|
|
17
|
-
|
|
18
|
-
return res?.groups?.uri ?? '';
|
|
19
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export interface FlexiBeeObjednavkaPrijata {
|
|
3
|
-
'external-ids': string[];
|
|
4
|
-
'id': string;
|
|
5
|
-
'lastUpdate': string;
|
|
6
|
-
'kod': string;
|
|
7
|
-
'zamekK': string;
|
|
8
|
-
'zamekK@showAs': string;
|
|
9
|
-
'cisDosle': string;
|
|
10
|
-
'varSym': string;
|
|
11
|
-
'cisSml': string;
|
|
12
|
-
'datObj': string;
|
|
13
|
-
'cisDodak': string;
|
|
14
|
-
'doprava': string;
|
|
15
|
-
'datVyst': string;
|
|
16
|
-
'datTermin': string;
|
|
17
|
-
'datReal': string;
|
|
18
|
-
'datSazbyDph': string;
|
|
19
|
-
'popis': string;
|
|
20
|
-
'poznam': string;
|
|
21
|
-
'uvodTxt': string;
|
|
22
|
-
'zavTxt': string;
|
|
23
|
-
'sumOsv': string;
|
|
24
|
-
'sumZklSniz': string;
|
|
25
|
-
'sumZklSniz2': string;
|
|
26
|
-
'sumZklZakl': string;
|
|
27
|
-
'sumZklCelkem': string;
|
|
28
|
-
'sumDphSniz': string;
|
|
29
|
-
'sumDphSniz2': string;
|
|
30
|
-
'sumDphZakl': string;
|
|
31
|
-
'sumDphCelkem': string;
|
|
32
|
-
'sumCelkSniz': string;
|
|
33
|
-
'sumCelkSniz2': string;
|
|
34
|
-
'sumCelkZakl': string;
|
|
35
|
-
'sumCelkem': string;
|
|
36
|
-
'sumOsvMen': string;
|
|
37
|
-
'sumZklSnizMen': string;
|
|
38
|
-
'sumZklSniz2Men': string;
|
|
39
|
-
'sumZklZaklMen': string;
|
|
40
|
-
'sumZklCelkemMen': string;
|
|
41
|
-
'sumDphZaklMen': string;
|
|
42
|
-
'sumDphSnizMen': string;
|
|
43
|
-
'sumDphSniz2Men': string;
|
|
44
|
-
'sumDphCelkemMen': string;
|
|
45
|
-
'sumCelkSnizMen': string;
|
|
46
|
-
'sumCelkSniz2Men': string;
|
|
47
|
-
'sumCelkZaklMen': string;
|
|
48
|
-
'sumCelkemMen': string;
|
|
49
|
-
'sumNaklady': string;
|
|
50
|
-
'slevaDokl': string;
|
|
51
|
-
'kurz': string;
|
|
52
|
-
'kurzMnozstvi': string;
|
|
53
|
-
'stavUzivK': string;
|
|
54
|
-
'stavUzivK@showAs': string;
|
|
55
|
-
'nazFirmy': string;
|
|
56
|
-
'ulice': string;
|
|
57
|
-
'mesto': string;
|
|
58
|
-
'psc': string;
|
|
59
|
-
'eanKod': string;
|
|
60
|
-
'ic': string;
|
|
61
|
-
'dic': string;
|
|
62
|
-
'pocetPriloh': string;
|
|
63
|
-
'postovniShodna': string;
|
|
64
|
-
'faNazev': string;
|
|
65
|
-
'faNazev2': string;
|
|
66
|
-
'faUlice': string;
|
|
67
|
-
'faMesto': string;
|
|
68
|
-
'faPsc': string;
|
|
69
|
-
'faEanKod': string;
|
|
70
|
-
'bezPolozek': string;
|
|
71
|
-
'szbDphSniz': string;
|
|
72
|
-
'szbDphSniz2': string;
|
|
73
|
-
'szbDphZakl': string;
|
|
74
|
-
'storno': string;
|
|
75
|
-
'zaokrJakSumK': string;
|
|
76
|
-
'zaokrJakSumK@showAs': string;
|
|
77
|
-
'zaokrNaSumK': string;
|
|
78
|
-
'zaokrNaSumK@showAs': string;
|
|
79
|
-
'zaokrJakDphK': string;
|
|
80
|
-
'zaokrNaDphK': string;
|
|
81
|
-
'metodaZaokrDoklK': string;
|
|
82
|
-
'metodaZaokrDoklK@showAs': string;
|
|
83
|
-
'vytvaretKorPol': string;
|
|
84
|
-
'stitky': string;
|
|
85
|
-
'typDokl': string;
|
|
86
|
-
'typDokl@ref': string;
|
|
87
|
-
'typDokl@showAs': string;
|
|
88
|
-
'mena': string;
|
|
89
|
-
'mena@ref': string;
|
|
90
|
-
'mena@showAs': string;
|
|
91
|
-
'konSym': string;
|
|
92
|
-
'firma': string;
|
|
93
|
-
'firma@ref': string;
|
|
94
|
-
'firma@showAs': string;
|
|
95
|
-
'stat': string;
|
|
96
|
-
'stat@ref': string;
|
|
97
|
-
'stat@showAs': string;
|
|
98
|
-
'faStat': string;
|
|
99
|
-
'faStat@ref': string;
|
|
100
|
-
'faStat@showAs': string;
|
|
101
|
-
'mistUrc': string;
|
|
102
|
-
'bankovniUcet': string;
|
|
103
|
-
'typDoklBan': string;
|
|
104
|
-
'statDph': string;
|
|
105
|
-
'statDph@ref': string;
|
|
106
|
-
'statDph@showAs': string;
|
|
107
|
-
'stredisko': string;
|
|
108
|
-
'stredisko@ref': string;
|
|
109
|
-
'stredisko@showAs': string;
|
|
110
|
-
'cinnost': string;
|
|
111
|
-
'zakazka': string;
|
|
112
|
-
'zakazka@ref': string;
|
|
113
|
-
'zakazka@showAs': string;
|
|
114
|
-
'uzivatel': string;
|
|
115
|
-
'uzivatel@ref': string;
|
|
116
|
-
'uzivatel@showAs': string;
|
|
117
|
-
'zodpOsoba': string;
|
|
118
|
-
'zodpOsoba@ref': string;
|
|
119
|
-
'zodpOsoba@showAs': string;
|
|
120
|
-
'kontaktOsoba': string;
|
|
121
|
-
'kontaktJmeno': string;
|
|
122
|
-
'kontaktEmail': string;
|
|
123
|
-
'kontaktTel': string;
|
|
124
|
-
'rada': string;
|
|
125
|
-
'rada@showAs': string;
|
|
126
|
-
'rada@if-not-found': string;
|
|
127
|
-
'rada@ref': string;
|
|
128
|
-
'smlouva': string;
|
|
129
|
-
'formaDopravy': string;
|
|
130
|
-
'formaDopravy@ref': string;
|
|
131
|
-
'formaDopravy@showAs': string;
|
|
132
|
-
'uuid': string;
|
|
133
|
-
'source': string;
|
|
134
|
-
'balikPocet': string;
|
|
135
|
-
'branchId': string;
|
|
136
|
-
'formaUhradyCis': string;
|
|
137
|
-
'formaUhradyCis@ref': string;
|
|
138
|
-
'formaUhradyCis@showAs': string;
|
|
139
|
-
'procReal': string;
|
|
140
|
-
'faktSouhrn': string;
|
|
141
|
-
'faktTxt': string;
|
|
142
|
-
'typDoklNabFak': string;
|
|
143
|
-
'typDoklNabFak@ref': string;
|
|
144
|
-
'typDoklNabFak@showAs': string;
|
|
145
|
-
'stavDoklObch': string;
|
|
146
|
-
'stavDoklObch@ref': string;
|
|
147
|
-
'stavDoklObch@showAs': string;
|
|
148
|
-
'skladCil': string;
|
|
149
|
-
'polozkyObchDokladu': {
|
|
150
|
-
'cenik@ref': string;
|
|
151
|
-
'mnozMj': string;
|
|
152
|
-
}[]
|
|
153
|
-
}
|