repzo 1.0.289 → 1.0.291

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/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",
@@ -62,6 +63,7 @@ export const end_points = {
62
63
  VOID_SETTLEMENT: "void-settlement",
63
64
  CHECK: "checks",
64
65
  DAY: "day",
66
+ DAY_SHIFT: "day-shift",
65
67
  RECEIVING_MATERIAL: "receiving-material",
66
68
  ADJUST_ACCOUNT: "adjust-account",
67
69
  TRANSFER: "transfer",
@@ -157,6 +159,7 @@ export const end_points = {
157
159
  CALENDAR: "calendar",
158
160
  LINE_TARGET: "line-target",
159
161
  BULK_IMPORT: "bulk-import",
162
+ BULK_EXPORT: "bulk-export",
160
163
  DELIVERY_NOTE: "delivery-note",
161
164
  RESERVATION: "reservation",
162
165
  } as const;
@@ -182,6 +185,7 @@ export const availableService = [
182
185
  "tag",
183
186
  "warehouse",
184
187
  "route",
188
+ "geoZone",
185
189
  "productModifiersGroup",
186
190
  "channel",
187
191
  "speciality",
@@ -209,6 +213,7 @@ export const availableService = [
209
213
  "voidSettlement",
210
214
  "check",
211
215
  "day",
216
+ "dayShift",
212
217
  "receivingMaterial",
213
218
  "adjustAccount",
214
219
  "transfer",
@@ -265,6 +270,7 @@ export const availableService = [
265
270
  "calendar",
266
271
  "lineTarget",
267
272
  "bulkImport",
273
+ "bulkExport",
268
274
  ] as const;
269
275
  export type AvailableService = (typeof availableService)[number];
270
276
 
@@ -1485,6 +1491,60 @@ export default class Repzo {
1485
1491
  },
1486
1492
  };
1487
1493
 
1494
+ geoZone = {
1495
+ _path: Repzo._end_points.GEO_ZONE,
1496
+ find: async (
1497
+ params?: Service.GeoZone.Find.Params,
1498
+ ): Promise<Service.GeoZone.Find.Result> => {
1499
+ let res: Service.GeoZone.Find.Result = await this._fetch(
1500
+ this.svAPIEndpoint,
1501
+ this.geoZone._path,
1502
+ params,
1503
+ );
1504
+ return res;
1505
+ },
1506
+ get: async (
1507
+ id: Service.GeoZone.Get.ID,
1508
+ params?: Service.GeoZone.Get.Params,
1509
+ ): Promise<Service.GeoZone.Get.Result> => {
1510
+ return await this._fetch(
1511
+ this.svAPIEndpoint,
1512
+ this.geoZone._path + `/${id}`,
1513
+ params,
1514
+ );
1515
+ },
1516
+ create: async (
1517
+ body: Service.GeoZone.Create.Body,
1518
+ ): Promise<Service.GeoZone.Create.Result> => {
1519
+ let res = await this._create(
1520
+ this.svAPIEndpoint,
1521
+ this.geoZone._path,
1522
+ body,
1523
+ );
1524
+ return res;
1525
+ },
1526
+ update: async (
1527
+ id: Service.GeoZone.Update.ID,
1528
+ body: Service.GeoZone.Update.Body,
1529
+ ): Promise<Service.GeoZone.Update.Result> => {
1530
+ let res: Service.GeoZone.Update.Result = await this._update(
1531
+ this.svAPIEndpoint,
1532
+ this.geoZone._path + `/${id}`,
1533
+ body,
1534
+ );
1535
+ return res;
1536
+ },
1537
+ remove: async (
1538
+ id: Service.GeoZone.Remove.ID,
1539
+ ): Promise<Service.GeoZone.Remove.Result> => {
1540
+ let res: Service.GeoZone.Remove.Result = await this._delete(
1541
+ this.svAPIEndpoint,
1542
+ this.geoZone._path + `/${id}`,
1543
+ );
1544
+ return res;
1545
+ },
1546
+ };
1547
+
1488
1548
  productModifiersGroup = {
1489
1549
  _path: Repzo._end_points.PRODUCT_MODIFIERS_GROUP,
1490
1550
  find: async (
@@ -2749,6 +2809,65 @@ export default class Repzo {
2749
2809
  },
2750
2810
  };
2751
2811
 
2812
+ dayShift = {
2813
+ _path: Repzo._end_points.DAY_SHIFT,
2814
+
2815
+ find: async (
2816
+ params?: Service.DayShift.Find.Params,
2817
+ ): Promise<Service.DayShift.Find.Result> => {
2818
+ let res: Service.DayShift.Find.Result = await this._fetch(
2819
+ this.svAPIEndpoint,
2820
+ this.dayShift._path,
2821
+ params,
2822
+ );
2823
+ return res;
2824
+ },
2825
+
2826
+ get: async (
2827
+ id: Service.DayShift.Get.ID,
2828
+ params?: Service.DayShift.Get.Params,
2829
+ ): Promise<Service.DayShift.Get.Result> => {
2830
+ return await this._fetch(
2831
+ this.svAPIEndpoint,
2832
+ this.dayShift._path + `/${id}`,
2833
+ params,
2834
+ );
2835
+ },
2836
+
2837
+ create: async (
2838
+ body: Service.DayShift.Create.Body,
2839
+ ): Promise<Service.DayShift.Create.Result> => {
2840
+ let res = await this._create(
2841
+ this.svAPIEndpoint,
2842
+ this.dayShift._path,
2843
+ body,
2844
+ );
2845
+ return res;
2846
+ },
2847
+
2848
+ update: async (
2849
+ id: Service.DayShift.Update.ID,
2850
+ body: Service.DayShift.Update.Body,
2851
+ ): Promise<Service.DayShift.Update.Result> => {
2852
+ let res: Service.DayShift.Update.Result = await this._update(
2853
+ this.svAPIEndpoint,
2854
+ this.dayShift._path + `/${id}`,
2855
+ body,
2856
+ );
2857
+ return res;
2858
+ },
2859
+
2860
+ remove: async (
2861
+ id: Service.DayShift.Remove.ID,
2862
+ ): Promise<Service.DayShift.Remove.Result> => {
2863
+ let res: Service.DayShift.Remove.Result = await this._delete(
2864
+ this.svAPIEndpoint,
2865
+ this.dayShift._path + `/${id}`,
2866
+ );
2867
+ return res;
2868
+ },
2869
+ };
2870
+
2752
2871
  receivingMaterial = {
2753
2872
  _path: Repzo._end_points.RECEIVING_MATERIAL,
2754
2873
 
@@ -7374,6 +7493,32 @@ export default class Repzo {
7374
7493
  },
7375
7494
  };
7376
7495
 
7496
+ bulkExport = {
7497
+ _path: Repzo._end_points.BULK_EXPORT,
7498
+ find: async (
7499
+ params?: Service.BulkExport.Find.Params,
7500
+ ): Promise<Service.BulkExport.Find.Result> => {
7501
+ let res: Service.BulkExport.Find.Result = await this._fetch(
7502
+ this.svAPIEndpoint,
7503
+ this.bulkExport._path,
7504
+ params,
7505
+ );
7506
+ return res;
7507
+ },
7508
+ create: async (
7509
+ params: Service.BulkExport.Create.Params,
7510
+ body: Service.BulkExport.Create.Body,
7511
+ ): Promise<Service.BulkExport.Create.Result> => {
7512
+ let res = await this._create(
7513
+ this.svAPIEndpoint,
7514
+ this.bulkExport._path,
7515
+ body,
7516
+ params,
7517
+ );
7518
+ return res;
7519
+ },
7520
+ };
7521
+
7377
7522
  deliveryNote = {
7378
7523
  _path: Repzo._end_points.DELIVERY_NOTE,
7379
7524
  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 }