@gls_spain/gps-common 27.0.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/.eslintrc.json +11 -0
- package/.idea/codeStyles/Project.xml +37 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/gps-common.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +45 -0
- package/.prettierignore +5 -0
- package/.prettierrc.json +13 -0
- package/.releaserc +17 -0
- package/CHANGELOG.md +848 -0
- package/README.md +122 -0
- package/errors/DatabaseNotEmptyError.js +9 -0
- package/errors/DefaultsDoNotExistError.js +9 -0
- package/errors/ExpeditionAlreadyExistsError.js +9 -0
- package/errors/ExpeditionCannotBeDeletedError.js +9 -0
- package/errors/ExpeditionCannotBeUpdatedError.js +9 -0
- package/errors/ExpeditionDoesNotExistError.js +9 -0
- package/errors/JobDoesNotExistError.js +9 -0
- package/errors/NetworkAlreadyExistsError.js +9 -0
- package/errors/NetworkCannotBeDeletedError.js +9 -0
- package/errors/NetworkDoesNotExistError.js +9 -0
- package/errors/RepresentativeAlreadyExistsError.js +9 -0
- package/errors/RepresentativeCannotBeDeletedError.js +9 -0
- package/errors/RepresentativeDoesNotExistError.js +9 -0
- package/errors/ShopAlreadyExistsError.js +9 -0
- package/errors/ShopCannotBeDeletedError.js +9 -0
- package/errors/ShopDoesNotExistError.js +9 -0
- package/errors/ShopNotEnabledError.js +9 -0
- package/errors/UserAlreadyExistsError.js +9 -0
- package/errors/UserCannotBeDeletedError.js +9 -0
- package/errors/UserCannotBeUpdatedError.js +9 -0
- package/errors/UserDoesNotExistError.js +9 -0
- package/errors/WrongNetworkError.js +9 -0
- package/errors/WrongPasswordError.js +9 -0
- package/errors/WrongShopError.js +9 -0
- package/errors/ZoneAlreadyExistsError.js +9 -0
- package/errors/ZoneCannotBeDeletedError.js +9 -0
- package/errors/ZoneDoesNotExistError.js +9 -0
- package/errors/index.js +88 -0
- package/index.js +9 -0
- package/index.test.js +35 -0
- package/jest.config.js +5 -0
- package/open-api-spec/index.js +2920 -0
- package/package.json +68 -0
- package/schemas/definitions/become.js +5 -0
- package/schemas/definitions/common.js +172 -0
- package/schemas/definitions/defaults.js +84 -0
- package/schemas/definitions/expeditions.js +637 -0
- package/schemas/definitions/init.js +37 -0
- package/schemas/definitions/integration-events.js +127 -0
- package/schemas/definitions/jobs.js +124 -0
- package/schemas/definitions/login.js +38 -0
- package/schemas/definitions/logout.js +8 -0
- package/schemas/definitions/networks.js +107 -0
- package/schemas/definitions/pods.js +37 -0
- package/schemas/definitions/representatives.js +178 -0
- package/schemas/definitions/shops.js +352 -0
- package/schemas/definitions/users.js +373 -0
- package/schemas/definitions/zones.js +92 -0
- package/schemas/index.js +335 -0
- package/scripts/build-documentation.js +40 -0
- package/scripts/build-json-schemas.js +35 -0
package/schemas/index.js
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
const { addMetadata, errorResponse: sourceErrorResponse } = require('@gls_spain/common-json-schemas');
|
|
2
|
+
const { initRequest, initResponse } = require('./definitions/init');
|
|
3
|
+
const { getDefaultsResponse, updateDefaultsRequest, updateDefaultsResponse } = require('./definitions/defaults');
|
|
4
|
+
const { loginResponse: sourceLoginResponse } = require('./definitions/login');
|
|
5
|
+
const { logoutResponse: sourceLogoutResponse } = require('./definitions/logout');
|
|
6
|
+
const { becomeRequest: sourceBecomeRequest } = require('./definitions/become');
|
|
7
|
+
const {
|
|
8
|
+
createSuperAdminRequest,
|
|
9
|
+
createSuperAdminResponse,
|
|
10
|
+
findSuperAdminsRequest,
|
|
11
|
+
findSuperAdminsResponse,
|
|
12
|
+
updateSuperAdminRequest,
|
|
13
|
+
updateSuperAdminResponse,
|
|
14
|
+
deleteSuperAdminRequest,
|
|
15
|
+
deleteSuperAdminResponse,
|
|
16
|
+
createNetworkAdminRequest,
|
|
17
|
+
createNetworkAdminResponse,
|
|
18
|
+
findNetworkAdminsRequest,
|
|
19
|
+
findNetworkAdminsResponse,
|
|
20
|
+
updateNetworkAdminRequest,
|
|
21
|
+
updateSelfNetworkAdminRequest,
|
|
22
|
+
updateNetworkAdminResponse,
|
|
23
|
+
deleteNetworkAdminRequest,
|
|
24
|
+
deleteNetworkAdminResponse,
|
|
25
|
+
createShopUserRequest,
|
|
26
|
+
createShopUserResponse,
|
|
27
|
+
findShopUsersSuperAdminRequest,
|
|
28
|
+
findShopUsersNetworkAdminRequest,
|
|
29
|
+
findShopUsersResponse,
|
|
30
|
+
updateShopUserRequest,
|
|
31
|
+
updateSelfShopUserRequest,
|
|
32
|
+
updateShopUserResponse,
|
|
33
|
+
deleteShopUserRequest,
|
|
34
|
+
deleteShopUserResponse,
|
|
35
|
+
} = require('./definitions/users');
|
|
36
|
+
const {
|
|
37
|
+
createNetworkRequest,
|
|
38
|
+
createNetworkResponse,
|
|
39
|
+
findNetworksRequest,
|
|
40
|
+
findNetworksResponse,
|
|
41
|
+
listNetworksNamesResponse,
|
|
42
|
+
updateNetworkRequest,
|
|
43
|
+
updateNetworkResponse,
|
|
44
|
+
deleteNetworkRequest,
|
|
45
|
+
deleteNetworkResponse,
|
|
46
|
+
} = require('./definitions/networks');
|
|
47
|
+
const {
|
|
48
|
+
createShopRequest,
|
|
49
|
+
createShopResponse,
|
|
50
|
+
findShopsSuperAdminRequest,
|
|
51
|
+
findShopsNetworkAdminRequest,
|
|
52
|
+
findShopsResponse,
|
|
53
|
+
updateShopRequest,
|
|
54
|
+
updateShopResponse,
|
|
55
|
+
deleteShopRequest,
|
|
56
|
+
deleteShopResponse,
|
|
57
|
+
} = require('./definitions/shops');
|
|
58
|
+
const {
|
|
59
|
+
createExpeditionRequest,
|
|
60
|
+
createExpeditionResponse,
|
|
61
|
+
findExpeditionsRequest,
|
|
62
|
+
findExpeditionsResponse,
|
|
63
|
+
updateExpeditionRequest,
|
|
64
|
+
updateExpeditionResponse,
|
|
65
|
+
deleteExpeditionRequest,
|
|
66
|
+
deleteExpeditionResponse,
|
|
67
|
+
redirectExpeditionRequest,
|
|
68
|
+
redirectExpeditionResponse,
|
|
69
|
+
scanExpeditionRequest,
|
|
70
|
+
scanExpeditionResponse,
|
|
71
|
+
processExpeditionsWithDriverRequest,
|
|
72
|
+
processExpeditionsWithCustomerRequest,
|
|
73
|
+
processExpeditionsResponse,
|
|
74
|
+
receiveAllExpeditionsFromDriverRequest,
|
|
75
|
+
receiveAllExpeditionsFromDriverResponse,
|
|
76
|
+
} = require('./definitions/expeditions');
|
|
77
|
+
const { findPodsRequest, findPodsResponse } = require('./definitions/pods');
|
|
78
|
+
const { findJobsRequest, findExpeditionJobsResponse, findShopsJobsResponse, findNetworksJobsResponse } = require('./definitions/jobs');
|
|
79
|
+
const {
|
|
80
|
+
createRepresentativeRequest,
|
|
81
|
+
createRepresentativeResponse,
|
|
82
|
+
findRepresentativesRequest,
|
|
83
|
+
findRepresentativesResponse,
|
|
84
|
+
listRepresentativesNamesResponse,
|
|
85
|
+
updateRepresentativeRequest,
|
|
86
|
+
updateRepresentativeResponse,
|
|
87
|
+
getRepresentativeCommissionsRequest,
|
|
88
|
+
getRepresentativeCommissionsResponse,
|
|
89
|
+
deleteRepresentativeRequest,
|
|
90
|
+
deleteRepresentativeResponse,
|
|
91
|
+
} = require('./definitions/representatives');
|
|
92
|
+
const {
|
|
93
|
+
createZoneRequest,
|
|
94
|
+
createZoneResponse,
|
|
95
|
+
listZonesNamesResponse,
|
|
96
|
+
findZonesRequest,
|
|
97
|
+
findZonesResponse,
|
|
98
|
+
updateZoneRequest,
|
|
99
|
+
updateZoneResponse,
|
|
100
|
+
deleteZoneRequest,
|
|
101
|
+
deleteZoneResponse,
|
|
102
|
+
} = require('./definitions/zones');
|
|
103
|
+
|
|
104
|
+
function request(schema, $id) {
|
|
105
|
+
return addMetadata(schema, $id);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function response(schema, $id) {
|
|
109
|
+
return addMetadata({ oneOf: [sourceErrorResponse(), schema] }, $id);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const errorResponse = addMetadata(sourceErrorResponse(), 'errorResponse');
|
|
113
|
+
|
|
114
|
+
const configInitRequest = request(initRequest(), 'configInitRequest');
|
|
115
|
+
const configInitResponse = response(initResponse(), 'configInitResponse');
|
|
116
|
+
const configDefaultsGetResponse = response(getDefaultsResponse(), 'configDefaultsGetResponse');
|
|
117
|
+
const configDefaultsUpdateRequest = request(updateDefaultsRequest(), 'configDefaultsUpdateRequest');
|
|
118
|
+
const configDefaultsUpdateResponse = response(updateDefaultsResponse(), 'configDefaultsUpdateResponse');
|
|
119
|
+
|
|
120
|
+
const loginResponse = response(sourceLoginResponse(), 'loginResponse');
|
|
121
|
+
const logoutResponse = response(sourceLogoutResponse(), 'logoutResponse');
|
|
122
|
+
const becomeRequest = request(sourceBecomeRequest(), 'becomeRequest');
|
|
123
|
+
|
|
124
|
+
const superAdminsCreateRequest = request(createSuperAdminRequest(), 'superAdminsCreateRequest');
|
|
125
|
+
const superAdminsCreateResponse = response(createSuperAdminResponse(), 'superAdminsCreateResponse');
|
|
126
|
+
const superAdminsFindRequest = request(findSuperAdminsRequest(), 'superAdminsFindRequest');
|
|
127
|
+
const superAdminsFindResponse = response(findSuperAdminsResponse(), 'superAdminsFindResponse');
|
|
128
|
+
const superAdminsUpdateRequest = request(updateSuperAdminRequest(), 'superAdminsUpdateRequest');
|
|
129
|
+
const superAdminsUpdateResponse = response(updateSuperAdminResponse(), 'superAdminsUpdateResponse');
|
|
130
|
+
const superAdminsDeleteRequest = request(deleteSuperAdminRequest(), 'superAdminsDeleteRequest');
|
|
131
|
+
const superAdminsDeleteResponse = response(deleteSuperAdminResponse(), 'superAdminsDeleteResponse');
|
|
132
|
+
|
|
133
|
+
const networksCreateRequest = request(createNetworkRequest(), 'networksCreateRequest');
|
|
134
|
+
const networksCreateResponse = response(createNetworkResponse(), 'networksCreateResponse');
|
|
135
|
+
const networksListNamesResponse = response(listNetworksNamesResponse(), 'networksListNamesResponse');
|
|
136
|
+
const networksFindRequest = request(findNetworksRequest(), 'networksFindRequest');
|
|
137
|
+
const networksFindResponse = response(findNetworksResponse(), 'networksFindResponse');
|
|
138
|
+
const networksUpdateRequest = request(updateNetworkRequest(), 'networksUpdateRequest');
|
|
139
|
+
const networksUpdateResponse = response(updateNetworkResponse(), 'networksUpdateResponse');
|
|
140
|
+
const networksDeleteRequest = request(deleteNetworkRequest(), 'networksDeleteRequest');
|
|
141
|
+
const networksDeleteResponse = response(deleteNetworkResponse(), 'networksDeleteResponse');
|
|
142
|
+
|
|
143
|
+
const networkAdminsCreateRequest = request(createNetworkAdminRequest(), 'networkAdminsCreateRequest');
|
|
144
|
+
const networkAdminsCreateResponse = response(createNetworkAdminResponse(), 'networkAdminsCreateResponse');
|
|
145
|
+
const networkAdminsFindRequest = request(findNetworkAdminsRequest(), 'networkAdminsFindRequest');
|
|
146
|
+
const networkAdminsFindResponse = response(findNetworkAdminsResponse(), 'networkAdminsFindResponse');
|
|
147
|
+
const networkAdminsUpdateRequest = request(updateNetworkAdminRequest(), 'networkAdminsUpdateRequest');
|
|
148
|
+
const networkAdminsUpdateSelfRequest = request(updateSelfNetworkAdminRequest(), 'networkAdminsUpdateSelfRequest');
|
|
149
|
+
const networkAdminsUpdateResponse = response(updateNetworkAdminResponse(), 'networkAdminsUpdateResponse');
|
|
150
|
+
const networkAdminsDeleteRequest = request(deleteNetworkAdminRequest(), 'networkAdminsDeleteRequest');
|
|
151
|
+
const networkAdminsDeleteResponse = response(deleteNetworkAdminResponse(), 'networkAdminsDeleteResponse');
|
|
152
|
+
|
|
153
|
+
const shopsCreateRequest = request(createShopRequest(), 'shopsCreateRequest');
|
|
154
|
+
const shopsCreateResponse = response(createShopResponse(), 'shopsCreateResponse');
|
|
155
|
+
const shopsFindSuperAdminRequest = request(findShopsSuperAdminRequest(), 'shopsFindSuperAdminRequest');
|
|
156
|
+
const shopsFindNetworkAdminRequest = request(findShopsNetworkAdminRequest(), 'shopsFindNetworkAdminRequest');
|
|
157
|
+
const shopsFindResponse = response(findShopsResponse(), 'shopsFindResponse');
|
|
158
|
+
const shopsUpdateRequest = request(updateShopRequest(), 'shopsUpdateRequest');
|
|
159
|
+
const shopsUpdateResponse = response(updateShopResponse(), 'shopsUpdateResponse');
|
|
160
|
+
const shopsDeleteRequest = request(deleteShopRequest(), 'shopsDeleteRequest');
|
|
161
|
+
const shopsDeleteResponse = response(deleteShopResponse(), 'shopsDeleteResponse');
|
|
162
|
+
|
|
163
|
+
const shopUsersCreateRequest = request(createShopUserRequest(), 'shopUsersCreateRequest');
|
|
164
|
+
const shopUsersCreateResponse = response(createShopUserResponse(), 'shopUsersCreateResponse');
|
|
165
|
+
const shopUsersFindSuperAdminRequest = request(findShopUsersSuperAdminRequest(), 'shopUsersFindSuperAdminRequest');
|
|
166
|
+
const shopUsersFindNetworkAdminRequest = request(findShopUsersNetworkAdminRequest(), 'shopUsersFindNetworkAdminRequest');
|
|
167
|
+
const shopUsersFindResponse = response(findShopUsersResponse(), 'shopUsersFindResponse');
|
|
168
|
+
const shopUsersUpdateRequest = request(updateShopUserRequest(), 'shopUsersUpdateRequest');
|
|
169
|
+
const shopUsersUpdateSelfRequest = request(updateSelfShopUserRequest(), 'shopUsersUpdateSelfRequest');
|
|
170
|
+
const shopUsersUpdateResponse = response(updateShopUserResponse(), 'shopUsersUpdateResponse');
|
|
171
|
+
const shopUsersDeleteRequest = request(deleteShopUserRequest(), 'shopUsersDeleteRequest');
|
|
172
|
+
const shopUsersDeleteResponse = response(deleteShopUserResponse(), 'shopUsersDeleteResponse');
|
|
173
|
+
|
|
174
|
+
const expeditionsCreateRequest = request(createExpeditionRequest(), 'expeditionsCreateRequest');
|
|
175
|
+
const expeditionsCreateResponse = response(createExpeditionResponse(), 'expeditionsCreateResponse');
|
|
176
|
+
const expeditionsFindRequest = request(findExpeditionsRequest(), 'expeditionsFindRequest');
|
|
177
|
+
const expeditionsFindResponse = response(findExpeditionsResponse(), 'expeditionsFindResponse');
|
|
178
|
+
const expeditionsUpdateRequest = request(updateExpeditionRequest(), 'expeditionsUpdateRequest');
|
|
179
|
+
const expeditionsUpdateResponse = response(updateExpeditionResponse(), 'expeditionsUpdateResponse');
|
|
180
|
+
const expeditionsDeleteRequest = request(deleteExpeditionRequest(), 'expeditionsDeleteRequest');
|
|
181
|
+
const expeditionsDeleteResponse = response(deleteExpeditionResponse(), 'expeditionsDeleteResponse');
|
|
182
|
+
const expeditionsRedirectRequest = request(redirectExpeditionRequest(), 'expeditionsRedirectRequest');
|
|
183
|
+
const expeditionsRedirectResponse = response(redirectExpeditionResponse(), 'expeditionsRedirectResponse');
|
|
184
|
+
const expeditionsScanRequest = request(scanExpeditionRequest(), 'expeditionsScanRequest');
|
|
185
|
+
const expeditionsScanResponse = response(scanExpeditionResponse(), 'expeditionsScanResponse');
|
|
186
|
+
const expeditionsProcessWithDriverRequest = request(processExpeditionsWithCustomerRequest(), 'expeditionsProcessWithCustomerRequest');
|
|
187
|
+
const expeditionsProcessWithCustomerRequest = request(processExpeditionsWithDriverRequest(), 'expeditionsProcessWithDriverRequest');
|
|
188
|
+
const expeditionsProcessResponse = response(processExpeditionsResponse(), 'expeditionsProcessResponse');
|
|
189
|
+
const expeditionsReceiveAllFromDriverRequest = request(receiveAllExpeditionsFromDriverRequest(), 'expeditionsReceiveAllFromDriverRequest');
|
|
190
|
+
const expeditionsReceiveAllFromDriverResponse = response(
|
|
191
|
+
receiveAllExpeditionsFromDriverResponse(),
|
|
192
|
+
'expeditionsReceiveAllFromDriverResponse',
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const podsFindRequest = request(findPodsRequest(), 'podsFindRequest');
|
|
196
|
+
const podsFindResponse = response(findPodsResponse(), 'podsFindResponse');
|
|
197
|
+
|
|
198
|
+
const jobsFindRequest = request(findJobsRequest(), 'jobsFindRequest');
|
|
199
|
+
const jobsFindExpeditionsResponse = response(findExpeditionJobsResponse(), 'jobsFindExpeditionsResponse');
|
|
200
|
+
const jobsFindShopsResponse = response(findShopsJobsResponse(), 'jobsFindShopsResponse');
|
|
201
|
+
const jobsFindNetworksResponse = response(findNetworksJobsResponse(), 'jobsFindNetworksResponse');
|
|
202
|
+
|
|
203
|
+
const representativesCreateRequest = request(createRepresentativeRequest(), 'representativesCreateRequest');
|
|
204
|
+
const representativesCreateResponse = response(createRepresentativeResponse(), 'representativesCreateResponse');
|
|
205
|
+
const representativesListNamesResponse = response(listRepresentativesNamesResponse(), 'representativesListNamesResponse');
|
|
206
|
+
const representativesFindRequest = request(findRepresentativesRequest(), 'representativesFindRequest');
|
|
207
|
+
const representativesFindResponse = response(findRepresentativesResponse(), 'representativesFindResponse');
|
|
208
|
+
const representativesUpdateRequest = request(updateRepresentativeRequest(), 'representativesUpdateRequest');
|
|
209
|
+
const representativesUpdateResponse = response(updateRepresentativeResponse(), 'representativesUpdateResponse');
|
|
210
|
+
const representativesGetCommissionsRequest = request(getRepresentativeCommissionsRequest(), 'representativesGetCommissionsRequest');
|
|
211
|
+
const representativesGetCommissionsResponse = response(getRepresentativeCommissionsResponse(), 'representativesGetCommissionsResponse');
|
|
212
|
+
const representativesDeleteRequest = request(deleteRepresentativeRequest(), 'representativesDeleteRequest');
|
|
213
|
+
const representativesDeleteResponse = response(deleteRepresentativeResponse(), 'representativesDeleteResponse');
|
|
214
|
+
|
|
215
|
+
const zonesCreateRequest = request(createZoneRequest(), 'zonesCreateRequest');
|
|
216
|
+
const zonesCreateResponse = response(createZoneResponse(), 'zonesCreateResponse');
|
|
217
|
+
const zonesListNamesResponse = response(listZonesNamesResponse(), 'zonesListNamesResponse');
|
|
218
|
+
const zonesFindRequest = request(findZonesRequest(), 'zonesFindRequest');
|
|
219
|
+
const zonesFindResponse = response(findZonesResponse(), 'zonesFindResponse');
|
|
220
|
+
const zonesUpdateRequest = request(updateZoneRequest(), 'zonesUpdateRequest');
|
|
221
|
+
const zonesUpdateResponse = response(updateZoneResponse(), 'zonesUpdateResponse');
|
|
222
|
+
const zonesDeleteRequest = request(deleteZoneRequest(), 'zonesDeleteRequest');
|
|
223
|
+
const zonesDeleteResponse = response(deleteZoneResponse(), 'zonesDeleteResponse');
|
|
224
|
+
|
|
225
|
+
module.exports = {
|
|
226
|
+
errorResponse,
|
|
227
|
+
|
|
228
|
+
configInitRequest,
|
|
229
|
+
configInitResponse,
|
|
230
|
+
configDefaultsGetResponse,
|
|
231
|
+
configDefaultsUpdateRequest,
|
|
232
|
+
configDefaultsUpdateResponse,
|
|
233
|
+
|
|
234
|
+
loginResponse,
|
|
235
|
+
logoutResponse,
|
|
236
|
+
becomeRequest,
|
|
237
|
+
|
|
238
|
+
superAdminsCreateRequest,
|
|
239
|
+
superAdminsCreateResponse,
|
|
240
|
+
superAdminsFindRequest,
|
|
241
|
+
superAdminsFindResponse,
|
|
242
|
+
superAdminsUpdateRequest,
|
|
243
|
+
superAdminsUpdateResponse,
|
|
244
|
+
superAdminsDeleteRequest,
|
|
245
|
+
superAdminsDeleteResponse,
|
|
246
|
+
|
|
247
|
+
networksCreateRequest,
|
|
248
|
+
networksCreateResponse,
|
|
249
|
+
networksListNamesResponse,
|
|
250
|
+
networksFindRequest,
|
|
251
|
+
networksFindResponse,
|
|
252
|
+
networksUpdateRequest,
|
|
253
|
+
networksUpdateResponse,
|
|
254
|
+
networksDeleteRequest,
|
|
255
|
+
networksDeleteResponse,
|
|
256
|
+
|
|
257
|
+
networkAdminsCreateRequest,
|
|
258
|
+
networkAdminsCreateResponse,
|
|
259
|
+
networkAdminsFindRequest,
|
|
260
|
+
networkAdminsFindResponse,
|
|
261
|
+
networkAdminsUpdateRequest,
|
|
262
|
+
networkAdminsUpdateSelfRequest,
|
|
263
|
+
networkAdminsUpdateResponse,
|
|
264
|
+
networkAdminsDeleteRequest,
|
|
265
|
+
networkAdminsDeleteResponse,
|
|
266
|
+
|
|
267
|
+
shopsCreateRequest,
|
|
268
|
+
shopsCreateResponse,
|
|
269
|
+
shopsFindSuperAdminRequest,
|
|
270
|
+
shopsFindNetworkAdminRequest,
|
|
271
|
+
shopsFindResponse,
|
|
272
|
+
shopsUpdateRequest,
|
|
273
|
+
shopsUpdateResponse,
|
|
274
|
+
shopsDeleteRequest,
|
|
275
|
+
shopsDeleteResponse,
|
|
276
|
+
|
|
277
|
+
shopUsersCreateRequest,
|
|
278
|
+
shopUsersCreateResponse,
|
|
279
|
+
shopUsersFindSuperAdminRequest,
|
|
280
|
+
shopUsersFindNetworkAdminRequest,
|
|
281
|
+
shopUsersFindResponse,
|
|
282
|
+
shopUsersUpdateRequest,
|
|
283
|
+
shopUsersUpdateSelfRequest,
|
|
284
|
+
shopUsersUpdateResponse,
|
|
285
|
+
shopUsersDeleteRequest,
|
|
286
|
+
shopUsersDeleteResponse,
|
|
287
|
+
|
|
288
|
+
expeditionsCreateRequest,
|
|
289
|
+
expeditionsCreateResponse,
|
|
290
|
+
expeditionsFindRequest,
|
|
291
|
+
expeditionsFindResponse,
|
|
292
|
+
expeditionsUpdateRequest,
|
|
293
|
+
expeditionsUpdateResponse,
|
|
294
|
+
expeditionsDeleteRequest,
|
|
295
|
+
expeditionsDeleteResponse,
|
|
296
|
+
expeditionsRedirectRequest,
|
|
297
|
+
expeditionsRedirectResponse,
|
|
298
|
+
expeditionsScanRequest,
|
|
299
|
+
expeditionsScanResponse,
|
|
300
|
+
expeditionsProcessWithDriverRequest,
|
|
301
|
+
expeditionsProcessWithCustomerRequest,
|
|
302
|
+
expeditionsProcessResponse,
|
|
303
|
+
expeditionsReceiveAllFromDriverRequest,
|
|
304
|
+
expeditionsReceiveAllFromDriverResponse,
|
|
305
|
+
|
|
306
|
+
podsFindRequest,
|
|
307
|
+
podsFindResponse,
|
|
308
|
+
|
|
309
|
+
jobsFindRequest,
|
|
310
|
+
jobsFindExpeditionsResponse,
|
|
311
|
+
jobsFindShopsResponse,
|
|
312
|
+
jobsFindNetworksResponse,
|
|
313
|
+
|
|
314
|
+
representativesCreateRequest,
|
|
315
|
+
representativesCreateResponse,
|
|
316
|
+
representativesListNamesResponse,
|
|
317
|
+
representativesFindRequest,
|
|
318
|
+
representativesFindResponse,
|
|
319
|
+
representativesUpdateRequest,
|
|
320
|
+
representativesUpdateResponse,
|
|
321
|
+
representativesGetCommissionsRequest,
|
|
322
|
+
representativesGetCommissionsResponse,
|
|
323
|
+
representativesDeleteRequest,
|
|
324
|
+
representativesDeleteResponse,
|
|
325
|
+
|
|
326
|
+
zonesCreateRequest,
|
|
327
|
+
zonesCreateResponse,
|
|
328
|
+
zonesListNamesResponse,
|
|
329
|
+
zonesFindRequest,
|
|
330
|
+
zonesFindResponse,
|
|
331
|
+
zonesUpdateRequest,
|
|
332
|
+
zonesUpdateResponse,
|
|
333
|
+
zonesDeleteRequest,
|
|
334
|
+
zonesDeleteResponse,
|
|
335
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const util = require('util');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const childProcess = require('child_process');
|
|
8
|
+
const winston = require('winston');
|
|
9
|
+
const { ColorConsoleTransport } = require('@gls_spain/winston-transports');
|
|
10
|
+
const yargs = require('yargs');
|
|
11
|
+
const openApiSpec = require('../open-api-spec');
|
|
12
|
+
|
|
13
|
+
const exec = util.promisify(childProcess.exec);
|
|
14
|
+
|
|
15
|
+
const { argv } = yargs
|
|
16
|
+
.option('output', { string: true, required: true, describe: 'path to the html file to create' })
|
|
17
|
+
.usage('Usage: build-documentation --output output_file');
|
|
18
|
+
|
|
19
|
+
const logger = winston.createLogger({ transports: new ColorConsoleTransport() });
|
|
20
|
+
|
|
21
|
+
async function buildDocumentation() {
|
|
22
|
+
const tmpDir = os.tmpdir();
|
|
23
|
+
const jsonPath = path.resolve(tmpDir, 'open-api-spec.json');
|
|
24
|
+
|
|
25
|
+
logger.info(`output file is: ${argv.output}`);
|
|
26
|
+
logger.info('creating output directory...');
|
|
27
|
+
fs.mkdirSync(path.dirname(path.resolve(argv.output)), { recursive: true });
|
|
28
|
+
|
|
29
|
+
logger.info('writing html file...');
|
|
30
|
+
fs.writeFileSync(jsonPath, JSON.stringify(openApiSpec, null, 2));
|
|
31
|
+
const redocCli = require.resolve('redoc-cli');
|
|
32
|
+
await exec(
|
|
33
|
+
`"${redocCli}" bundle ${jsonPath} --output ${argv.output} --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true --title="GLS Parcel Shops API"`,
|
|
34
|
+
);
|
|
35
|
+
logger.info('done');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildDocumentation()
|
|
39
|
+
.catch(error => logger.error(error))
|
|
40
|
+
.then(() => process.exit());
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const winston = require('winston');
|
|
6
|
+
const kebabCase = require('lodash/kebabCase');
|
|
7
|
+
const yargs = require('yargs');
|
|
8
|
+
const { ColorConsoleTransport } = require('@gls_spain/winston-transports');
|
|
9
|
+
const schemas = require('../schemas');
|
|
10
|
+
|
|
11
|
+
const { argv } = yargs
|
|
12
|
+
.option('output', { string: true, required: true, describe: 'directory path to put the json schemas in' })
|
|
13
|
+
.usage('Usage: build-schemas --output output_dir');
|
|
14
|
+
|
|
15
|
+
const logger = winston.createLogger({ transports: new ColorConsoleTransport() });
|
|
16
|
+
|
|
17
|
+
async function buildJsonSchemas() {
|
|
18
|
+
const schemasArray = Object.values(schemas);
|
|
19
|
+
logger.info(`found ${schemasArray.length} schemas`);
|
|
20
|
+
|
|
21
|
+
const outDirPath = path.resolve(argv.output);
|
|
22
|
+
logger.info(`output directory is: ${outDirPath}`);
|
|
23
|
+
|
|
24
|
+
logger.info('creating output directory...');
|
|
25
|
+
fs.mkdirSync(outDirPath, { recursive: true });
|
|
26
|
+
logger.info(`writing ${schemasArray.length} new files...`);
|
|
27
|
+
schemasArray.forEach(schema =>
|
|
28
|
+
fs.writeFileSync(path.resolve(outDirPath, `${kebabCase(schema.$id)}.json`), JSON.stringify(schema, null, 2)),
|
|
29
|
+
);
|
|
30
|
+
logger.info('done');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
buildJsonSchemas()
|
|
34
|
+
.catch(error => logger.error(error))
|
|
35
|
+
.then(() => process.exit());
|