repzo 1.0.288 → 1.0.290
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/changelog.md +6 -0
- package/lib/index.d.ts +19 -2
- package/lib/index.js +37 -0
- package/lib/types/index.d.ts +222 -2
- package/package.json +1 -1
- package/src/index.ts +84 -0
- package/src/oas/bulk-export.yaml +272 -0
- package/src/oas/geo-zone.yaml +349 -0
- package/src/oas/rep.yaml +45 -0
- package/src/oas/settings.yaml +60 -0
- package/src/types/index.ts +283 -0
package/src/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ export const end_points = {
|
|
|
34
34
|
TAG: "tag",
|
|
35
35
|
WAREHOUSE: "warehouse",
|
|
36
36
|
ROUTE: "route",
|
|
37
|
+
GEO_ZONE: "geo-zone",
|
|
37
38
|
PRODUCT_MODIFIERS_GROUP: "product-modifiers-group",
|
|
38
39
|
CHANNEL: "client-channel",
|
|
39
40
|
SPECIALITY: "speciality",
|
|
@@ -157,6 +158,7 @@ export const end_points = {
|
|
|
157
158
|
CALENDAR: "calendar",
|
|
158
159
|
LINE_TARGET: "line-target",
|
|
159
160
|
BULK_IMPORT: "bulk-import",
|
|
161
|
+
BULK_EXPORT: "bulk-export",
|
|
160
162
|
DELIVERY_NOTE: "delivery-note",
|
|
161
163
|
RESERVATION: "reservation",
|
|
162
164
|
} as const;
|
|
@@ -182,6 +184,7 @@ export const availableService = [
|
|
|
182
184
|
"tag",
|
|
183
185
|
"warehouse",
|
|
184
186
|
"route",
|
|
187
|
+
"geoZone",
|
|
185
188
|
"productModifiersGroup",
|
|
186
189
|
"channel",
|
|
187
190
|
"speciality",
|
|
@@ -265,6 +268,7 @@ export const availableService = [
|
|
|
265
268
|
"calendar",
|
|
266
269
|
"lineTarget",
|
|
267
270
|
"bulkImport",
|
|
271
|
+
"bulkExport",
|
|
268
272
|
] as const;
|
|
269
273
|
export type AvailableService = (typeof availableService)[number];
|
|
270
274
|
|
|
@@ -1485,6 +1489,60 @@ export default class Repzo {
|
|
|
1485
1489
|
},
|
|
1486
1490
|
};
|
|
1487
1491
|
|
|
1492
|
+
geoZone = {
|
|
1493
|
+
_path: Repzo._end_points.GEO_ZONE,
|
|
1494
|
+
find: async (
|
|
1495
|
+
params?: Service.GeoZone.Find.Params,
|
|
1496
|
+
): Promise<Service.GeoZone.Find.Result> => {
|
|
1497
|
+
let res: Service.GeoZone.Find.Result = await this._fetch(
|
|
1498
|
+
this.svAPIEndpoint,
|
|
1499
|
+
this.geoZone._path,
|
|
1500
|
+
params,
|
|
1501
|
+
);
|
|
1502
|
+
return res;
|
|
1503
|
+
},
|
|
1504
|
+
get: async (
|
|
1505
|
+
id: Service.GeoZone.Get.ID,
|
|
1506
|
+
params?: Service.GeoZone.Get.Params,
|
|
1507
|
+
): Promise<Service.GeoZone.Get.Result> => {
|
|
1508
|
+
return await this._fetch(
|
|
1509
|
+
this.svAPIEndpoint,
|
|
1510
|
+
this.geoZone._path + `/${id}`,
|
|
1511
|
+
params,
|
|
1512
|
+
);
|
|
1513
|
+
},
|
|
1514
|
+
create: async (
|
|
1515
|
+
body: Service.GeoZone.Create.Body,
|
|
1516
|
+
): Promise<Service.GeoZone.Create.Result> => {
|
|
1517
|
+
let res = await this._create(
|
|
1518
|
+
this.svAPIEndpoint,
|
|
1519
|
+
this.geoZone._path,
|
|
1520
|
+
body,
|
|
1521
|
+
);
|
|
1522
|
+
return res;
|
|
1523
|
+
},
|
|
1524
|
+
update: async (
|
|
1525
|
+
id: Service.GeoZone.Update.ID,
|
|
1526
|
+
body: Service.GeoZone.Update.Body,
|
|
1527
|
+
): Promise<Service.GeoZone.Update.Result> => {
|
|
1528
|
+
let res: Service.GeoZone.Update.Result = await this._update(
|
|
1529
|
+
this.svAPIEndpoint,
|
|
1530
|
+
this.geoZone._path + `/${id}`,
|
|
1531
|
+
body,
|
|
1532
|
+
);
|
|
1533
|
+
return res;
|
|
1534
|
+
},
|
|
1535
|
+
remove: async (
|
|
1536
|
+
id: Service.GeoZone.Remove.ID,
|
|
1537
|
+
): Promise<Service.GeoZone.Remove.Result> => {
|
|
1538
|
+
let res: Service.GeoZone.Remove.Result = await this._delete(
|
|
1539
|
+
this.svAPIEndpoint,
|
|
1540
|
+
this.geoZone._path + `/${id}`,
|
|
1541
|
+
);
|
|
1542
|
+
return res;
|
|
1543
|
+
},
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1488
1546
|
productModifiersGroup = {
|
|
1489
1547
|
_path: Repzo._end_points.PRODUCT_MODIFIERS_GROUP,
|
|
1490
1548
|
find: async (
|
|
@@ -7374,6 +7432,32 @@ export default class Repzo {
|
|
|
7374
7432
|
},
|
|
7375
7433
|
};
|
|
7376
7434
|
|
|
7435
|
+
bulkExport = {
|
|
7436
|
+
_path: Repzo._end_points.BULK_EXPORT,
|
|
7437
|
+
find: async (
|
|
7438
|
+
params?: Service.BulkExport.Find.Params,
|
|
7439
|
+
): Promise<Service.BulkExport.Find.Result> => {
|
|
7440
|
+
let res: Service.BulkExport.Find.Result = await this._fetch(
|
|
7441
|
+
this.svAPIEndpoint,
|
|
7442
|
+
this.bulkExport._path,
|
|
7443
|
+
params,
|
|
7444
|
+
);
|
|
7445
|
+
return res;
|
|
7446
|
+
},
|
|
7447
|
+
create: async (
|
|
7448
|
+
params: Service.BulkExport.Create.Params,
|
|
7449
|
+
body: Service.BulkExport.Create.Body,
|
|
7450
|
+
): Promise<Service.BulkExport.Create.Result> => {
|
|
7451
|
+
let res = await this._create(
|
|
7452
|
+
this.svAPIEndpoint,
|
|
7453
|
+
this.bulkExport._path,
|
|
7454
|
+
body,
|
|
7455
|
+
params,
|
|
7456
|
+
);
|
|
7457
|
+
return res;
|
|
7458
|
+
},
|
|
7459
|
+
};
|
|
7460
|
+
|
|
7377
7461
|
deliveryNote = {
|
|
7378
7462
|
_path: Repzo._end_points.DELIVERY_NOTE,
|
|
7379
7463
|
find: async (
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Repzo API - Bulk Export
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: |
|
|
6
|
+
Exports large datasets to **Excel** or **Parquet**. Starting an export
|
|
7
|
+
(`POST /bulk-export`) creates a job for one of ~50 supported entity types
|
|
8
|
+
(`clients`, `products`, `contracts`, `reps`, ...) selected via the `type`
|
|
9
|
+
query parameter; the job runs the aggregation, writes the file to media
|
|
10
|
+
storage, and records a `status` and a download `link`. `GET /bulk-export`
|
|
11
|
+
lists the export jobs (see also `bulk-export-report`).
|
|
12
|
+
|
|
13
|
+
**Who calls it.** Back-office admins — the `creator` audit stamp is always
|
|
14
|
+
an admin, set server-side from the session token.
|
|
15
|
+
|
|
16
|
+
**Multi-tenancy & lifecycle.** Jobs are scoped by `company_namespace[]`
|
|
17
|
+
(injected from session — never sent in the body). A job moves through
|
|
18
|
+
`processing` then `success` / `fail`; on success, `link` (and the `media`
|
|
19
|
+
storage id) point at the generated file.
|
|
20
|
+
|
|
21
|
+
**Unsupported operations.** Only find (list jobs) and create (start a job)
|
|
22
|
+
are available. `GET /bulk-export/{id}`, `update`, `patch`, and `remove` are
|
|
23
|
+
rejected with `400`.
|
|
24
|
+
servers:
|
|
25
|
+
- url: https://sv.api.repzo.me
|
|
26
|
+
security:
|
|
27
|
+
- ApiKeyAuth: []
|
|
28
|
+
- JwtAuth: []
|
|
29
|
+
paths:
|
|
30
|
+
/bulk-export:
|
|
31
|
+
get:
|
|
32
|
+
summary: List bulk-export jobs
|
|
33
|
+
operationId: findBulkExports
|
|
34
|
+
parameters:
|
|
35
|
+
- in: query
|
|
36
|
+
name: _id
|
|
37
|
+
description: Filter by job `_id`. Pass once or as `?_id[]=...` for multiple.
|
|
38
|
+
schema:
|
|
39
|
+
oneOf:
|
|
40
|
+
- type: string
|
|
41
|
+
- type: array
|
|
42
|
+
items: { type: string }
|
|
43
|
+
- in: query
|
|
44
|
+
name: type
|
|
45
|
+
description: Filter by exported entity type.
|
|
46
|
+
schema:
|
|
47
|
+
$ref: "#/components/schemas/BulkExportType"
|
|
48
|
+
- in: query
|
|
49
|
+
name: status
|
|
50
|
+
description: Filter by job status.
|
|
51
|
+
schema:
|
|
52
|
+
type: string
|
|
53
|
+
enum: [processing, success, fail]
|
|
54
|
+
- in: query
|
|
55
|
+
name: export_type
|
|
56
|
+
description: Filter by output format.
|
|
57
|
+
schema:
|
|
58
|
+
type: string
|
|
59
|
+
enum: [excel, parquet]
|
|
60
|
+
- in: query
|
|
61
|
+
name: export
|
|
62
|
+
description: When truthy, schedule the export as an emailed job instead of returning it inline.
|
|
63
|
+
schema: { type: boolean }
|
|
64
|
+
- in: query
|
|
65
|
+
name: from_updatedAt
|
|
66
|
+
description: Cursor — jobs updated on or after this Unix timestamp (ms).
|
|
67
|
+
schema: { type: number }
|
|
68
|
+
- in: query
|
|
69
|
+
name: to_updatedAt
|
|
70
|
+
description: Cursor — jobs updated on or before this Unix timestamp (ms).
|
|
71
|
+
schema: { type: number }
|
|
72
|
+
- in: query
|
|
73
|
+
name: per_page
|
|
74
|
+
schema: { type: integer, minimum: 1, maximum: 50000 }
|
|
75
|
+
example: 20
|
|
76
|
+
- in: query
|
|
77
|
+
name: page
|
|
78
|
+
schema: { type: integer, minimum: 1 }
|
|
79
|
+
example: 1
|
|
80
|
+
responses:
|
|
81
|
+
"200":
|
|
82
|
+
description: A paginated list of export jobs.
|
|
83
|
+
content:
|
|
84
|
+
application/json:
|
|
85
|
+
schema:
|
|
86
|
+
$ref: "#/components/schemas/BulkExportFindResult"
|
|
87
|
+
post:
|
|
88
|
+
summary: Start a bulk export
|
|
89
|
+
operationId: createBulkExport
|
|
90
|
+
parameters:
|
|
91
|
+
- in: query
|
|
92
|
+
name: type
|
|
93
|
+
required: true
|
|
94
|
+
description: Entity type to export. Sent as a query parameter, not in the body.
|
|
95
|
+
schema:
|
|
96
|
+
$ref: "#/components/schemas/BulkExportType"
|
|
97
|
+
requestBody:
|
|
98
|
+
required: true
|
|
99
|
+
content:
|
|
100
|
+
application/json:
|
|
101
|
+
schema:
|
|
102
|
+
$ref: "#/components/schemas/BulkExportCreateBody"
|
|
103
|
+
responses:
|
|
104
|
+
"201":
|
|
105
|
+
description: The created export job — `status` reflects progress and `link` is populated when the file is ready.
|
|
106
|
+
content:
|
|
107
|
+
application/json:
|
|
108
|
+
schema:
|
|
109
|
+
$ref: "#/components/schemas/BulkExportSchema"
|
|
110
|
+
components:
|
|
111
|
+
securitySchemes:
|
|
112
|
+
ApiKeyAuth:
|
|
113
|
+
type: apiKey
|
|
114
|
+
in: header
|
|
115
|
+
name: api-key
|
|
116
|
+
description: |
|
|
117
|
+
Server-issued API key. Also accepted via the `x-api-key` header or the
|
|
118
|
+
`?apiKey=` query parameter as fallbacks.
|
|
119
|
+
JwtAuth:
|
|
120
|
+
type: apiKey
|
|
121
|
+
in: header
|
|
122
|
+
name: Authorization
|
|
123
|
+
description: |
|
|
124
|
+
Raw JWT in the `Authorization` header — **no `Bearer ` prefix**. Obtained
|
|
125
|
+
from `POST /authenticate` (admin login).
|
|
126
|
+
schemas:
|
|
127
|
+
BulkExportType:
|
|
128
|
+
type: string
|
|
129
|
+
description: One of the supported export entity types.
|
|
130
|
+
enum:
|
|
131
|
+
- clients
|
|
132
|
+
- products
|
|
133
|
+
- variants
|
|
134
|
+
- categories
|
|
135
|
+
- subCategories
|
|
136
|
+
- availabilityMsl
|
|
137
|
+
- availabilityMslWithProducts
|
|
138
|
+
- reps
|
|
139
|
+
- mslWithVariants
|
|
140
|
+
- jobCategories
|
|
141
|
+
- jobs
|
|
142
|
+
- tags
|
|
143
|
+
- routes
|
|
144
|
+
- routesWithClients
|
|
145
|
+
- plans
|
|
146
|
+
- planWithRules
|
|
147
|
+
- targetRulesWithClients
|
|
148
|
+
- rulesWithRoutes
|
|
149
|
+
- targetRulesWithReps
|
|
150
|
+
- adjustAccount
|
|
151
|
+
- rules
|
|
152
|
+
- warehouses
|
|
153
|
+
- productGroups
|
|
154
|
+
- priceListItems
|
|
155
|
+
- measureunit
|
|
156
|
+
- measureunitFamily
|
|
157
|
+
- lineTarget
|
|
158
|
+
- clientLineClassification
|
|
159
|
+
- retailExecutionPresets
|
|
160
|
+
- promotions
|
|
161
|
+
- customListItems
|
|
162
|
+
- assets
|
|
163
|
+
- assetUnits
|
|
164
|
+
- speciality
|
|
165
|
+
- clientLocation
|
|
166
|
+
- reminders
|
|
167
|
+
- admins
|
|
168
|
+
- companyGroup
|
|
169
|
+
- company
|
|
170
|
+
- variantBatch
|
|
171
|
+
- banksList
|
|
172
|
+
- clientUblInfo
|
|
173
|
+
- supplier
|
|
174
|
+
- contractInstallment
|
|
175
|
+
- targetRule
|
|
176
|
+
- contracts
|
|
177
|
+
- assetPartTypes
|
|
178
|
+
- assetParts
|
|
179
|
+
- clientUblInfo_JO
|
|
180
|
+
- clientUblInfo_SA
|
|
181
|
+
- nameSpaceFreshnessWindowCodes
|
|
182
|
+
BulkExportCreateBody:
|
|
183
|
+
type: object
|
|
184
|
+
description: |
|
|
185
|
+
Export options. `type` is sent as a query parameter (not in the body).
|
|
186
|
+
The `creator` audit stamp and `company_namespace` are normally injected
|
|
187
|
+
from session and can be omitted — both are optional here for
|
|
188
|
+
integration / cross-namespace callers.
|
|
189
|
+
properties:
|
|
190
|
+
export_type:
|
|
191
|
+
type: string
|
|
192
|
+
enum: [excel, parquet]
|
|
193
|
+
default: excel
|
|
194
|
+
columns:
|
|
195
|
+
type: object
|
|
196
|
+
additionalProperties: true
|
|
197
|
+
description: Map of column paths to include / label in the generated file.
|
|
198
|
+
name:
|
|
199
|
+
type: string
|
|
200
|
+
description: Optional label for the export job.
|
|
201
|
+
creator:
|
|
202
|
+
$ref: "#/components/schemas/BulkExportCreator"
|
|
203
|
+
company_namespace:
|
|
204
|
+
type: array
|
|
205
|
+
items: { type: string }
|
|
206
|
+
description: Tenant key — normally injected from session; optional, for cross-namespace callers.
|
|
207
|
+
BulkExportCreator:
|
|
208
|
+
type: object
|
|
209
|
+
description: Audit stamp of the admin who started the job. Set server-side from the session token — never sent by the client.
|
|
210
|
+
properties:
|
|
211
|
+
_id: { type: string }
|
|
212
|
+
type: { type: string, enum: [admin] }
|
|
213
|
+
name: { type: string }
|
|
214
|
+
admin: { type: string }
|
|
215
|
+
BulkExportSchema:
|
|
216
|
+
type: object
|
|
217
|
+
description: A bulk-export job document as stored.
|
|
218
|
+
properties:
|
|
219
|
+
_id: { type: string }
|
|
220
|
+
creator:
|
|
221
|
+
$ref: "#/components/schemas/BulkExportCreator"
|
|
222
|
+
type:
|
|
223
|
+
$ref: "#/components/schemas/BulkExportType"
|
|
224
|
+
status:
|
|
225
|
+
type: string
|
|
226
|
+
enum: [processing, success, fail]
|
|
227
|
+
messages:
|
|
228
|
+
type: array
|
|
229
|
+
items: { type: object }
|
|
230
|
+
_errors:
|
|
231
|
+
type: array
|
|
232
|
+
items: { type: object }
|
|
233
|
+
start_time: { type: integer, format: int64 }
|
|
234
|
+
end_time: { type: integer, format: int64 }
|
|
235
|
+
bucket_name: { type: string }
|
|
236
|
+
region: { type: string }
|
|
237
|
+
key: { type: string }
|
|
238
|
+
link: { type: string, description: Download URL of the generated file. }
|
|
239
|
+
media:
|
|
240
|
+
type: array
|
|
241
|
+
items: { type: string }
|
|
242
|
+
description: "Media-storage `_id`(s) of the generated file (ref `media-storage`)."
|
|
243
|
+
teams:
|
|
244
|
+
type: array
|
|
245
|
+
items: { type: string }
|
|
246
|
+
export_type:
|
|
247
|
+
type: string
|
|
248
|
+
enum: [excel, parquet]
|
|
249
|
+
row_count: { type: number }
|
|
250
|
+
company_namespace:
|
|
251
|
+
type: array
|
|
252
|
+
items: { type: string }
|
|
253
|
+
createdAt: { type: string, format: date-time }
|
|
254
|
+
updatedAt: { type: string, format: date-time }
|
|
255
|
+
BulkExportFindResult:
|
|
256
|
+
type: object
|
|
257
|
+
description: Paginated list of export jobs.
|
|
258
|
+
properties:
|
|
259
|
+
data:
|
|
260
|
+
type: array
|
|
261
|
+
items:
|
|
262
|
+
$ref: "#/components/schemas/BulkExportSchema"
|
|
263
|
+
total_result: { type: number }
|
|
264
|
+
current_count: { type: number }
|
|
265
|
+
total_pages: { type: number }
|
|
266
|
+
current_page: { type: number }
|
|
267
|
+
per_page: { type: number }
|
|
268
|
+
first_page_url: { type: string }
|
|
269
|
+
last_page_url: { type: string }
|
|
270
|
+
next_page_url: { type: string, nullable: true }
|
|
271
|
+
prev_page_url: { type: string, nullable: true }
|
|
272
|
+
path: { type: string }
|