@gls_spain/gps-common 34.9.2 → 34.9.4
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/.eslintignore +1 -1
- package/.eslintrc.json +11 -11
- package/.idea/codeStyles/Project.xml +36 -36
- package/.idea/codeStyles/codeStyleConfig.xml +4 -4
- package/.idea/gps-common.iml +11 -11
- package/.idea/inspectionProfiles/Project_Default.xml +6 -6
- package/.idea/jsLibraryMappings.xml +5 -5
- package/.idea/misc.xml +5 -5
- package/.idea/modules.xml +7 -7
- package/.idea/prettier.xml +6 -6
- package/.idea/scopes/Source_files.xml +2 -2
- package/.idea/vcs.xml +5 -5
- package/.prettierignore +4 -4
- package/.prettierrc.json +13 -13
- package/.releaserc +17 -17
- package/CHANGELOG.md +1271 -1257
- package/README.md +103 -103
- package/errors/CountersDoNotExistError.js +11 -11
- package/errors/DatabaseNotEmptyError.js +11 -11
- package/errors/DefaultsDoNotExistError.js +11 -11
- package/errors/ExpeditionAlreadyExistsError.js +11 -11
- package/errors/ExpeditionCannotBeDeletedError.js +11 -11
- package/errors/ExpeditionCannotBeUpdatedError.js +11 -11
- package/errors/ExpeditionDoesNotExistError.js +11 -11
- package/errors/GLSRecordingError.js +11 -11
- package/errors/GLSSpainError.js +11 -11
- package/errors/InconsistentSalesSettingsError.js +11 -11
- package/errors/InvalidSaleDestinationError.js +11 -11
- package/errors/LabelDoesNotExistError.js +11 -11
- package/errors/NetworkAlreadyExistsError.js +11 -11
- package/errors/NetworkCannotBeDeletedError.js +11 -11
- package/errors/NetworkCannotBeUpdatedError.js +11 -11
- package/errors/NetworkDoesNotExistError.js +11 -11
- package/errors/RepresentativeAlreadyExistsError.js +11 -11
- package/errors/RepresentativeCannotBeDeletedError.js +11 -11
- package/errors/RepresentativeDoesNotExistError.js +11 -11
- package/errors/SaleAlreadyExistsError.js +11 -11
- package/errors/SaleDoesNotExistError.js +11 -11
- package/errors/ShopAlreadyExistsError.js +11 -11
- package/errors/ShopCannotBeDeletedError.js +11 -11
- package/errors/ShopCannotBeUpdatedError.js +11 -11
- package/errors/ShopCannotSellError.js +11 -11
- package/errors/ShopDoesNotExistError.js +11 -11
- package/errors/ShopNotEnabledError.js +11 -11
- package/errors/UserAlreadyExistsError.js +11 -11
- package/errors/UserCannotBeDeletedError.js +11 -11
- package/errors/UserCannotBeUpdatedError.js +11 -11
- package/errors/UserDoesNotExistError.js +11 -11
- package/errors/WrongNetworkError.js +11 -11
- package/errors/WrongPasswordError.js +11 -11
- package/errors/WrongShopError.js +11 -11
- package/errors/ZoneAlreadyExistsError.js +11 -11
- package/errors/ZoneCannotBeDeletedError.js +11 -11
- package/errors/ZoneDoesNotExistError.js +11 -11
- package/errors/index.js +118 -118
- package/index.js +9 -9
- package/index.test.js +36 -36
- package/jest.config.js +5 -5
- package/open-api-spec/index.js +3715 -3715
- package/package.json +65 -69
- package/schemas/definitions/become.js +5 -5
- package/schemas/definitions/common.js +462 -451
- package/schemas/definitions/counters.js +43 -43
- package/schemas/definitions/defaults.js +140 -140
- package/schemas/definitions/expeditions.js +867 -867
- package/schemas/definitions/gls-spain-integration-events.js +139 -139
- package/schemas/definitions/historic-records.js +90 -90
- package/schemas/definitions/integrations.js +38 -38
- package/schemas/definitions/login.js +38 -38
- package/schemas/definitions/logout.js +8 -8
- package/schemas/definitions/networks.js +123 -123
- package/schemas/definitions/pods.js +26 -26
- package/schemas/definitions/representatives.js +194 -194
- package/schemas/definitions/sales.js +253 -249
- package/schemas/definitions/shops.js +413 -404
- package/schemas/definitions/users.js +337 -337
- package/schemas/definitions/zones.js +92 -92
- package/schemas/index.js +400 -400
- package/scripts/build-documentation.js +40 -40
- package/scripts/build-json-schemas.js +35 -35
- package/.idea/workspace.xml +0 -699
package/errors/index.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
const DatabaseNotEmptyError = require('./DatabaseNotEmptyError');
|
|
2
|
-
const UserDoesNotExistError = require('./UserDoesNotExistError');
|
|
3
|
-
const UserAlreadyExistsError = require('./UserAlreadyExistsError');
|
|
4
|
-
const UserCannotBeUpdatedError = require('./UserCannotBeUpdatedError');
|
|
5
|
-
const UserCannotBeDeletedError = require('./UserCannotBeDeletedError');
|
|
6
|
-
const NetworkDoesNotExistError = require('./NetworkDoesNotExistError');
|
|
7
|
-
const NetworkAlreadyExistsError = require('./NetworkAlreadyExistsError');
|
|
8
|
-
const NetworkCannotBeUpdatedError = require('./NetworkCannotBeUpdatedError');
|
|
9
|
-
const NetworkCannotBeDeletedError = require('./NetworkCannotBeDeletedError');
|
|
10
|
-
const WrongNetworkError = require('./WrongNetworkError');
|
|
11
|
-
const ShopDoesNotExistError = require('./ShopDoesNotExistError');
|
|
12
|
-
const ShopAlreadyExistsError = require('./ShopAlreadyExistsError');
|
|
13
|
-
const ShopCannotBeUpdatedError = require('./ShopCannotBeUpdatedError');
|
|
14
|
-
const ShopCannotBeDeletedError = require('./ShopCannotBeDeletedError');
|
|
15
|
-
const ShopCannotSellError = require('./ShopCannotSellError');
|
|
16
|
-
const ShopNotEnabledError = require('./ShopNotEnabledError');
|
|
17
|
-
const WrongShopError = require('./WrongShopError');
|
|
18
|
-
const WrongPasswordError = require('./WrongPasswordError');
|
|
19
|
-
const ExpeditionDoesNotExistError = require('./ExpeditionDoesNotExistError');
|
|
20
|
-
const ExpeditionAlreadyExistsError = require('./ExpeditionAlreadyExistsError');
|
|
21
|
-
const ExpeditionCannotBeUpdatedError = require('./ExpeditionCannotBeUpdatedError');
|
|
22
|
-
const ExpeditionCannotBeDeletedError = require('./ExpeditionCannotBeDeletedError');
|
|
23
|
-
const DefaultsDoNotExistError = require('./DefaultsDoNotExistError');
|
|
24
|
-
const CountersDoNotExistError = require('./CountersDoNotExistError');
|
|
25
|
-
const RepresentativeDoesNotExistError = require('./RepresentativeDoesNotExistError');
|
|
26
|
-
const RepresentativeAlreadyExistsError = require('./RepresentativeAlreadyExistsError');
|
|
27
|
-
const RepresentativeCannotBeDeletedError = require('./RepresentativeCannotBeDeletedError');
|
|
28
|
-
const ZoneDoesNotExistError = require('./ZoneDoesNotExistError');
|
|
29
|
-
const ZoneAlreadyExistsError = require('./ZoneAlreadyExistsError');
|
|
30
|
-
const ZoneCannotBeDeletedError = require('./ZoneCannotBeDeletedError');
|
|
31
|
-
const SaleDoesNotExistError = require('./SaleDoesNotExistError');
|
|
32
|
-
const SaleAlreadyExistsError = require('./SaleAlreadyExistsError');
|
|
33
|
-
const InconsistentSalesSettingsError = require('./InconsistentSalesSettingsError');
|
|
34
|
-
const InvalidSaleDestinationError = require('./InvalidSaleDestinationError');
|
|
35
|
-
const GLSSpainError = require('./GLSSpainError');
|
|
36
|
-
const GLSRecordingError = require('./GLSRecordingError');
|
|
37
|
-
const LabelDoesNotExistError = require('./LabelDoesNotExistError');
|
|
38
|
-
|
|
39
|
-
const errorsNames = {
|
|
40
|
-
DatabaseNotEmptyError: 'DatabaseNotEmptyError',
|
|
41
|
-
UserDoesNotExistError: 'UserDoesNotExistError',
|
|
42
|
-
UserAlreadyExistsError: 'UserAlreadyExistsError',
|
|
43
|
-
UserCannotBeUpdatedError: 'UserCannotBeUpdatedError',
|
|
44
|
-
UserCannotBeDeletedError: 'UserCannotBeDeletedError',
|
|
45
|
-
NetworkDoesNotExistError: 'NetworkDoesNotExistError',
|
|
46
|
-
NetworkAlreadyExistsError: 'NetworkAlreadyExistsError',
|
|
47
|
-
NetworkCannotBeUpdatedError: 'NetworkCannotBeUpdatedError',
|
|
48
|
-
NetworkCannotBeDeletedError: 'NetworkCannotBeDeletedError',
|
|
49
|
-
WrongNetworkError: 'WrongNetworkError',
|
|
50
|
-
ShopDoesNotExistError: 'ShopDoesNotExistError',
|
|
51
|
-
ShopAlreadyExistsError: 'ShopAlreadyExistsError',
|
|
52
|
-
ShopCannotBeUpdatedError: 'ShopCannotBeUpdatedError',
|
|
53
|
-
ShopCannotBeDeletedError: 'ShopCannotBeDeletedError',
|
|
54
|
-
ShopCannotSellError: 'ShopCannotSellError',
|
|
55
|
-
ShopNotEnabledError: 'ShopNotEnabledError',
|
|
56
|
-
WrongShopError: 'WrongShopError',
|
|
57
|
-
WrongPasswordError: 'WrongPasswordError',
|
|
58
|
-
ExpeditionDoesNotExistError: 'ExpeditionDoesNotExistError',
|
|
59
|
-
ExpeditionAlreadyExistsError: 'ExpeditionAlreadyExistsError',
|
|
60
|
-
ExpeditionCannotBeUpdatedError: 'ExpeditionCannotBeUpdatedError',
|
|
61
|
-
ExpeditionCannotBeDeletedError: 'ExpeditionCannotBeDeletedError',
|
|
62
|
-
DefaultsDoNotExistError: 'DefaultsDoNotExistError',
|
|
63
|
-
CountersDoNotExistError: 'CountersDoNotExistError',
|
|
64
|
-
RepresentativeDoesNotExistError: 'RepresentativeDoesNotExistError',
|
|
65
|
-
RepresentativeAlreadyExistsError: 'RepresentativeAlreadyExistsError',
|
|
66
|
-
RepresentativeCannotBeDeletedError: 'RepresentativeCannotBeDeletedError',
|
|
67
|
-
ZoneDoesNotExistError: 'ZoneDoesNotExistError',
|
|
68
|
-
ZoneAlreadyExistsError: 'ZoneAlreadyExistsError',
|
|
69
|
-
ZoneCannotBeDeletedError: 'ZoneCannotBeDeletedError',
|
|
70
|
-
SaleDoesNotExistError: 'SaleDoesNotExistError',
|
|
71
|
-
SaleAlreadyExistsError: 'SaleAlreadyExistsError',
|
|
72
|
-
InconsistentSalesSettingsError: 'InconsistentSalesSettingsError',
|
|
73
|
-
InvalidSaleDestinationError: 'InvalidSaleDestinationError',
|
|
74
|
-
GLSSpainError: 'GLSSpainError',
|
|
75
|
-
GLSRecordingError: 'GLSRecordingError',
|
|
76
|
-
LabelDoesNotExistError: 'LabelDoesNotExistError',
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
module.exports = {
|
|
80
|
-
DatabaseNotEmptyError,
|
|
81
|
-
UserDoesNotExistError,
|
|
82
|
-
UserAlreadyExistsError,
|
|
83
|
-
UserCannotBeUpdatedError,
|
|
84
|
-
UserCannotBeDeletedError,
|
|
85
|
-
NetworkDoesNotExistError,
|
|
86
|
-
NetworkAlreadyExistsError,
|
|
87
|
-
NetworkCannotBeUpdatedError,
|
|
88
|
-
NetworkCannotBeDeletedError,
|
|
89
|
-
WrongNetworkError,
|
|
90
|
-
ShopDoesNotExistError,
|
|
91
|
-
ShopAlreadyExistsError,
|
|
92
|
-
ShopCannotBeUpdatedError,
|
|
93
|
-
ShopCannotBeDeletedError,
|
|
94
|
-
ShopCannotSellError,
|
|
95
|
-
ShopNotEnabledError,
|
|
96
|
-
WrongShopError,
|
|
97
|
-
WrongPasswordError,
|
|
98
|
-
ExpeditionDoesNotExistError,
|
|
99
|
-
ExpeditionAlreadyExistsError,
|
|
100
|
-
ExpeditionCannotBeUpdatedError,
|
|
101
|
-
ExpeditionCannotBeDeletedError,
|
|
102
|
-
DefaultsDoNotExistError,
|
|
103
|
-
CountersDoNotExistError,
|
|
104
|
-
RepresentativeDoesNotExistError,
|
|
105
|
-
RepresentativeAlreadyExistsError,
|
|
106
|
-
RepresentativeCannotBeDeletedError,
|
|
107
|
-
ZoneDoesNotExistError,
|
|
108
|
-
ZoneAlreadyExistsError,
|
|
109
|
-
ZoneCannotBeDeletedError,
|
|
110
|
-
SaleDoesNotExistError,
|
|
111
|
-
SaleAlreadyExistsError,
|
|
112
|
-
InconsistentSalesSettingsError,
|
|
113
|
-
InvalidSaleDestinationError,
|
|
114
|
-
GLSSpainError,
|
|
115
|
-
GLSRecordingError,
|
|
116
|
-
LabelDoesNotExistError,
|
|
117
|
-
errorsNames,
|
|
118
|
-
};
|
|
1
|
+
const DatabaseNotEmptyError = require('./DatabaseNotEmptyError');
|
|
2
|
+
const UserDoesNotExistError = require('./UserDoesNotExistError');
|
|
3
|
+
const UserAlreadyExistsError = require('./UserAlreadyExistsError');
|
|
4
|
+
const UserCannotBeUpdatedError = require('./UserCannotBeUpdatedError');
|
|
5
|
+
const UserCannotBeDeletedError = require('./UserCannotBeDeletedError');
|
|
6
|
+
const NetworkDoesNotExistError = require('./NetworkDoesNotExistError');
|
|
7
|
+
const NetworkAlreadyExistsError = require('./NetworkAlreadyExistsError');
|
|
8
|
+
const NetworkCannotBeUpdatedError = require('./NetworkCannotBeUpdatedError');
|
|
9
|
+
const NetworkCannotBeDeletedError = require('./NetworkCannotBeDeletedError');
|
|
10
|
+
const WrongNetworkError = require('./WrongNetworkError');
|
|
11
|
+
const ShopDoesNotExistError = require('./ShopDoesNotExistError');
|
|
12
|
+
const ShopAlreadyExistsError = require('./ShopAlreadyExistsError');
|
|
13
|
+
const ShopCannotBeUpdatedError = require('./ShopCannotBeUpdatedError');
|
|
14
|
+
const ShopCannotBeDeletedError = require('./ShopCannotBeDeletedError');
|
|
15
|
+
const ShopCannotSellError = require('./ShopCannotSellError');
|
|
16
|
+
const ShopNotEnabledError = require('./ShopNotEnabledError');
|
|
17
|
+
const WrongShopError = require('./WrongShopError');
|
|
18
|
+
const WrongPasswordError = require('./WrongPasswordError');
|
|
19
|
+
const ExpeditionDoesNotExistError = require('./ExpeditionDoesNotExistError');
|
|
20
|
+
const ExpeditionAlreadyExistsError = require('./ExpeditionAlreadyExistsError');
|
|
21
|
+
const ExpeditionCannotBeUpdatedError = require('./ExpeditionCannotBeUpdatedError');
|
|
22
|
+
const ExpeditionCannotBeDeletedError = require('./ExpeditionCannotBeDeletedError');
|
|
23
|
+
const DefaultsDoNotExistError = require('./DefaultsDoNotExistError');
|
|
24
|
+
const CountersDoNotExistError = require('./CountersDoNotExistError');
|
|
25
|
+
const RepresentativeDoesNotExistError = require('./RepresentativeDoesNotExistError');
|
|
26
|
+
const RepresentativeAlreadyExistsError = require('./RepresentativeAlreadyExistsError');
|
|
27
|
+
const RepresentativeCannotBeDeletedError = require('./RepresentativeCannotBeDeletedError');
|
|
28
|
+
const ZoneDoesNotExistError = require('./ZoneDoesNotExistError');
|
|
29
|
+
const ZoneAlreadyExistsError = require('./ZoneAlreadyExistsError');
|
|
30
|
+
const ZoneCannotBeDeletedError = require('./ZoneCannotBeDeletedError');
|
|
31
|
+
const SaleDoesNotExistError = require('./SaleDoesNotExistError');
|
|
32
|
+
const SaleAlreadyExistsError = require('./SaleAlreadyExistsError');
|
|
33
|
+
const InconsistentSalesSettingsError = require('./InconsistentSalesSettingsError');
|
|
34
|
+
const InvalidSaleDestinationError = require('./InvalidSaleDestinationError');
|
|
35
|
+
const GLSSpainError = require('./GLSSpainError');
|
|
36
|
+
const GLSRecordingError = require('./GLSRecordingError');
|
|
37
|
+
const LabelDoesNotExistError = require('./LabelDoesNotExistError');
|
|
38
|
+
|
|
39
|
+
const errorsNames = {
|
|
40
|
+
DatabaseNotEmptyError: 'DatabaseNotEmptyError',
|
|
41
|
+
UserDoesNotExistError: 'UserDoesNotExistError',
|
|
42
|
+
UserAlreadyExistsError: 'UserAlreadyExistsError',
|
|
43
|
+
UserCannotBeUpdatedError: 'UserCannotBeUpdatedError',
|
|
44
|
+
UserCannotBeDeletedError: 'UserCannotBeDeletedError',
|
|
45
|
+
NetworkDoesNotExistError: 'NetworkDoesNotExistError',
|
|
46
|
+
NetworkAlreadyExistsError: 'NetworkAlreadyExistsError',
|
|
47
|
+
NetworkCannotBeUpdatedError: 'NetworkCannotBeUpdatedError',
|
|
48
|
+
NetworkCannotBeDeletedError: 'NetworkCannotBeDeletedError',
|
|
49
|
+
WrongNetworkError: 'WrongNetworkError',
|
|
50
|
+
ShopDoesNotExistError: 'ShopDoesNotExistError',
|
|
51
|
+
ShopAlreadyExistsError: 'ShopAlreadyExistsError',
|
|
52
|
+
ShopCannotBeUpdatedError: 'ShopCannotBeUpdatedError',
|
|
53
|
+
ShopCannotBeDeletedError: 'ShopCannotBeDeletedError',
|
|
54
|
+
ShopCannotSellError: 'ShopCannotSellError',
|
|
55
|
+
ShopNotEnabledError: 'ShopNotEnabledError',
|
|
56
|
+
WrongShopError: 'WrongShopError',
|
|
57
|
+
WrongPasswordError: 'WrongPasswordError',
|
|
58
|
+
ExpeditionDoesNotExistError: 'ExpeditionDoesNotExistError',
|
|
59
|
+
ExpeditionAlreadyExistsError: 'ExpeditionAlreadyExistsError',
|
|
60
|
+
ExpeditionCannotBeUpdatedError: 'ExpeditionCannotBeUpdatedError',
|
|
61
|
+
ExpeditionCannotBeDeletedError: 'ExpeditionCannotBeDeletedError',
|
|
62
|
+
DefaultsDoNotExistError: 'DefaultsDoNotExistError',
|
|
63
|
+
CountersDoNotExistError: 'CountersDoNotExistError',
|
|
64
|
+
RepresentativeDoesNotExistError: 'RepresentativeDoesNotExistError',
|
|
65
|
+
RepresentativeAlreadyExistsError: 'RepresentativeAlreadyExistsError',
|
|
66
|
+
RepresentativeCannotBeDeletedError: 'RepresentativeCannotBeDeletedError',
|
|
67
|
+
ZoneDoesNotExistError: 'ZoneDoesNotExistError',
|
|
68
|
+
ZoneAlreadyExistsError: 'ZoneAlreadyExistsError',
|
|
69
|
+
ZoneCannotBeDeletedError: 'ZoneCannotBeDeletedError',
|
|
70
|
+
SaleDoesNotExistError: 'SaleDoesNotExistError',
|
|
71
|
+
SaleAlreadyExistsError: 'SaleAlreadyExistsError',
|
|
72
|
+
InconsistentSalesSettingsError: 'InconsistentSalesSettingsError',
|
|
73
|
+
InvalidSaleDestinationError: 'InvalidSaleDestinationError',
|
|
74
|
+
GLSSpainError: 'GLSSpainError',
|
|
75
|
+
GLSRecordingError: 'GLSRecordingError',
|
|
76
|
+
LabelDoesNotExistError: 'LabelDoesNotExistError',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
module.exports = {
|
|
80
|
+
DatabaseNotEmptyError,
|
|
81
|
+
UserDoesNotExistError,
|
|
82
|
+
UserAlreadyExistsError,
|
|
83
|
+
UserCannotBeUpdatedError,
|
|
84
|
+
UserCannotBeDeletedError,
|
|
85
|
+
NetworkDoesNotExistError,
|
|
86
|
+
NetworkAlreadyExistsError,
|
|
87
|
+
NetworkCannotBeUpdatedError,
|
|
88
|
+
NetworkCannotBeDeletedError,
|
|
89
|
+
WrongNetworkError,
|
|
90
|
+
ShopDoesNotExistError,
|
|
91
|
+
ShopAlreadyExistsError,
|
|
92
|
+
ShopCannotBeUpdatedError,
|
|
93
|
+
ShopCannotBeDeletedError,
|
|
94
|
+
ShopCannotSellError,
|
|
95
|
+
ShopNotEnabledError,
|
|
96
|
+
WrongShopError,
|
|
97
|
+
WrongPasswordError,
|
|
98
|
+
ExpeditionDoesNotExistError,
|
|
99
|
+
ExpeditionAlreadyExistsError,
|
|
100
|
+
ExpeditionCannotBeUpdatedError,
|
|
101
|
+
ExpeditionCannotBeDeletedError,
|
|
102
|
+
DefaultsDoNotExistError,
|
|
103
|
+
CountersDoNotExistError,
|
|
104
|
+
RepresentativeDoesNotExistError,
|
|
105
|
+
RepresentativeAlreadyExistsError,
|
|
106
|
+
RepresentativeCannotBeDeletedError,
|
|
107
|
+
ZoneDoesNotExistError,
|
|
108
|
+
ZoneAlreadyExistsError,
|
|
109
|
+
ZoneCannotBeDeletedError,
|
|
110
|
+
SaleDoesNotExistError,
|
|
111
|
+
SaleAlreadyExistsError,
|
|
112
|
+
InconsistentSalesSettingsError,
|
|
113
|
+
InvalidSaleDestinationError,
|
|
114
|
+
GLSSpainError,
|
|
115
|
+
GLSRecordingError,
|
|
116
|
+
LabelDoesNotExistError,
|
|
117
|
+
errorsNames,
|
|
118
|
+
};
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const errors = require('./errors');
|
|
2
|
-
const openApiSpec = require('./open-api-spec');
|
|
3
|
-
const schemas = require('./schemas');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
errors,
|
|
7
|
-
openApiSpec,
|
|
8
|
-
schemas,
|
|
9
|
-
};
|
|
1
|
+
const errors = require('./errors');
|
|
2
|
+
const openApiSpec = require('./open-api-spec');
|
|
3
|
+
const schemas = require('./schemas');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
errors,
|
|
7
|
+
openApiSpec,
|
|
8
|
+
schemas,
|
|
9
|
+
};
|
package/index.test.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const Ajv = require('ajv');
|
|
2
|
-
const { lenientDatetimeFormat, timezoneFormat, normalizeKeyword, trimKeyword } = require('@gls_spain/ajv-options');
|
|
3
|
-
const { errors, openApiSpec, schemas } = require('./index');
|
|
4
|
-
|
|
5
|
-
describe('#errors', () => {
|
|
6
|
-
test('should all be subclasses of Error', () => {
|
|
7
|
-
Object.values(errors)
|
|
8
|
-
.filter(error => typeof error === 'function')
|
|
9
|
-
.forEach(ErrorClass => {
|
|
10
|
-
expect(ErrorClass.prototype).toBeInstanceOf(Error);
|
|
11
|
-
const error = new ErrorClass();
|
|
12
|
-
expect(error.name).toBe(ErrorClass.name);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('#openApiSpec', () => {
|
|
18
|
-
test('should be an object', () => {
|
|
19
|
-
expect(openApiSpec).toBeInstanceOf(Object);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('#schemas', () => {
|
|
24
|
-
test('should all be unique valid json schemas', () => {
|
|
25
|
-
const ajv = Ajv({ formats: { 'date-time': lenientDatetimeFormat, timezone: timezoneFormat } });
|
|
26
|
-
ajv.addKeyword('normalize', normalizeKeyword);
|
|
27
|
-
ajv.addKeyword('trim', trimKeyword);
|
|
28
|
-
Object.values(schemas).forEach(schema => {
|
|
29
|
-
try {
|
|
30
|
-
ajv.compile(schema);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw new Error(`schema ${schema.$id} error: ${error.message}`);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
1
|
+
const Ajv = require('ajv');
|
|
2
|
+
const { lenientDatetimeFormat, timezoneFormat, normalizeKeyword, trimKeyword } = require('@gls_spain/ajv-options');
|
|
3
|
+
const { errors, openApiSpec, schemas } = require('./index');
|
|
4
|
+
|
|
5
|
+
describe('#errors', () => {
|
|
6
|
+
test('should all be subclasses of Error', () => {
|
|
7
|
+
Object.values(errors)
|
|
8
|
+
.filter(error => typeof error === 'function')
|
|
9
|
+
.forEach(ErrorClass => {
|
|
10
|
+
expect(ErrorClass.prototype).toBeInstanceOf(Error);
|
|
11
|
+
const error = new ErrorClass();
|
|
12
|
+
expect(error.name).toBe(ErrorClass.name);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('#openApiSpec', () => {
|
|
18
|
+
test('should be an object', () => {
|
|
19
|
+
expect(openApiSpec).toBeInstanceOf(Object);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('#schemas', () => {
|
|
24
|
+
test('should all be unique valid json schemas', () => {
|
|
25
|
+
const ajv = Ajv({ formats: { 'date-time': lenientDatetimeFormat, timezone: timezoneFormat } });
|
|
26
|
+
ajv.addKeyword('normalize', normalizeKeyword);
|
|
27
|
+
ajv.addKeyword('trim', trimKeyword);
|
|
28
|
+
Object.values(schemas).forEach(schema => {
|
|
29
|
+
try {
|
|
30
|
+
ajv.compile(schema);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw new Error(`schema ${schema.$id} error: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
package/jest.config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
testEnvironment: 'node',
|
|
3
|
-
collectCoverage: true,
|
|
4
|
-
transformIgnorePatterns: ['/node_modules/(?!(@gls_spain/*)/)'],
|
|
5
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'node',
|
|
3
|
+
collectCoverage: true,
|
|
4
|
+
transformIgnorePatterns: ['/node_modules/(?!(@gls_spain/*)/)'],
|
|
5
|
+
};
|