@arascreative/erp-client 0.0.0-stage → 1.1.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/dist/generated/api.d.ts +2282 -0
- package/dist/generated/api.d.ts.map +1 -0
- package/dist/generated/api.js +961 -0
- package/dist/generated/zod.d.ts +1087 -0
- package/dist/generated/zod.d.ts.map +1 -0
- package/dist/generated/zod.js +404 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +13 -0
- package/package.json +57 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/generated/zod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;EAGtC,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;EAGpB,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUxB,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;EAGrC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUtC,CAAA;AACF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAyC,CAAA;AAG7E;;;G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GAEG;AACH,eAAO,MAAM,WAAW;;;;;;EAEtB,CAAA"}
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.21.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* TSNX API
|
|
5
|
+
* OpenAPI spec version: 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as zod from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* Stores an HttpOnly antiforgery cookie and returns the request token and header name. Send both on subsequent identity requests that change data.
|
|
10
|
+
* @summary Get an antiforgery token
|
|
11
|
+
*/
|
|
12
|
+
export const getAntiforgeryTokenResponse = zod.object({
|
|
13
|
+
"requestToken": zod.string(),
|
|
14
|
+
"headerName": zod.string()
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new server-side session with the configured absolute lifetime and rotates the antiforgery token. Use the returned requestToken for subsequent requests.
|
|
18
|
+
* @summary Sign in with email and password
|
|
19
|
+
*/
|
|
20
|
+
export const loginBody = zod.object({
|
|
21
|
+
"email": zod.string(),
|
|
22
|
+
"passwordPlain": zod.string()
|
|
23
|
+
});
|
|
24
|
+
export const loginResponse = zod.object({
|
|
25
|
+
"user": zod.object({
|
|
26
|
+
"id": zod.string(),
|
|
27
|
+
"email": zod.string(),
|
|
28
|
+
"username": zod.string(),
|
|
29
|
+
"kind": zod.string()
|
|
30
|
+
}),
|
|
31
|
+
"expiresAt": zod.string(),
|
|
32
|
+
"requestToken": zod.string(),
|
|
33
|
+
"headerName": zod.string()
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* @summary Get the current signed-in user
|
|
37
|
+
*/
|
|
38
|
+
export const getCurrentUserResponse = zod.object({
|
|
39
|
+
"user": zod.object({
|
|
40
|
+
"id": zod.string(),
|
|
41
|
+
"email": zod.string(),
|
|
42
|
+
"username": zod.string(),
|
|
43
|
+
"kind": zod.string()
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* @summary Revoke the current session and clear its cookie
|
|
48
|
+
*/
|
|
49
|
+
export const logoutResponse = zod.object({
|
|
50
|
+
"requestToken": zod.string(),
|
|
51
|
+
"headerName": zod.string()
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Creates the single owner account for the tenant. Use this endpoint only once per deployment.
|
|
55
|
+
* @summary Create the owner account
|
|
56
|
+
*/
|
|
57
|
+
export const createOwnerBody = zod.object({
|
|
58
|
+
"email": zod.string(),
|
|
59
|
+
"username": zod.string(),
|
|
60
|
+
"passwordPlain": zod.string()
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* @summary Search addresses by keyword
|
|
64
|
+
*/
|
|
65
|
+
export const searchAddressesQueryParams = zod.object({
|
|
66
|
+
"keyword": zod.string(),
|
|
67
|
+
"limit": zod.number().optional()
|
|
68
|
+
});
|
|
69
|
+
export const searchAddressesResponseItem = zod.object({
|
|
70
|
+
"addressId": zod.string(),
|
|
71
|
+
"externalId": zod.string().nullable(),
|
|
72
|
+
"destinationCode": zod.string(),
|
|
73
|
+
"originCode": zod.string(),
|
|
74
|
+
"provinceName": zod.string(),
|
|
75
|
+
"cityName": zod.string(),
|
|
76
|
+
"districtName": zod.string(),
|
|
77
|
+
"subDistrictName": zod.string(),
|
|
78
|
+
"zipCode": zod.string()
|
|
79
|
+
});
|
|
80
|
+
export const searchAddressesResponse = zod.array(searchAddressesResponseItem);
|
|
81
|
+
/**
|
|
82
|
+
* Creates a pending file metadata record and generates a presigned S3 upload URL for direct client-to-storage upload.
|
|
83
|
+
* @summary Initiate direct file upload to storage
|
|
84
|
+
*/
|
|
85
|
+
export const initiateUploadBody = zod.object({
|
|
86
|
+
"originalName": zod.string(),
|
|
87
|
+
"mimeType": zod.string(),
|
|
88
|
+
"sizeBytes": zod.number(),
|
|
89
|
+
"checksum": zod.string(),
|
|
90
|
+
"purpose": zod.string(),
|
|
91
|
+
"expiresInSeconds": zod.number().optional()
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Uploads a file directly with base64 encoded content, verifies against purpose policy, stores to S3, and activates immediately.
|
|
95
|
+
* @summary Direct upload file
|
|
96
|
+
*/
|
|
97
|
+
export const uploadFileBody = zod.object({
|
|
98
|
+
"originalName": zod.string(),
|
|
99
|
+
"mimeType": zod.string(),
|
|
100
|
+
"contentBase64": zod.string(),
|
|
101
|
+
"purpose": zod.string(),
|
|
102
|
+
"uploadedBy": zod.string().optional()
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Toggles the active state of a warehouse. Soft-deleted warehouses cannot be toggled.
|
|
106
|
+
* @summary Toggle warehouse active status
|
|
107
|
+
*/
|
|
108
|
+
export const toggleWarehouseStatusParams = zod.object({
|
|
109
|
+
"id": zod.string()
|
|
110
|
+
});
|
|
111
|
+
export const toggleWarehouseStatusResponse = zod.object({
|
|
112
|
+
"isActive": zod.boolean()
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Activates or deactivates a stock item.
|
|
116
|
+
* @summary Change stock item active status
|
|
117
|
+
*/
|
|
118
|
+
export const changeStockItemStatusParams = zod.object({
|
|
119
|
+
"id": zod.string()
|
|
120
|
+
});
|
|
121
|
+
export const changeStockItemStatusBody = zod.object({
|
|
122
|
+
"status": zod.string()
|
|
123
|
+
});
|
|
124
|
+
export const changeStockItemStatusResponse = zod.object({
|
|
125
|
+
"status": zod.string()
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* Verifies that physical object was written to storage provider, verifies checksum, and transitions file to ACTIVE.
|
|
129
|
+
* @summary Complete direct file upload
|
|
130
|
+
*/
|
|
131
|
+
export const completeUploadParams = zod.object({
|
|
132
|
+
"id": zod.string()
|
|
133
|
+
});
|
|
134
|
+
export const completeUploadBody = zod.object({
|
|
135
|
+
"actualChecksum": zod.string().optional()
|
|
136
|
+
});
|
|
137
|
+
export const completeUploadResponse = zod.object({
|
|
138
|
+
"id": zod.string(),
|
|
139
|
+
"status": zod.string(),
|
|
140
|
+
"activatedAt": zod.string()
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Generates a public CDN URL (for public files) or a time-limited signed download URL (for private files).
|
|
144
|
+
* @summary Get file download or CDN access URL
|
|
145
|
+
*/
|
|
146
|
+
export const getFileAccessUrlParams = zod.object({
|
|
147
|
+
"id": zod.string()
|
|
148
|
+
});
|
|
149
|
+
export const getFileAccessUrlQueryParams = zod.object({
|
|
150
|
+
"expiresInSeconds": zod.number().optional()
|
|
151
|
+
});
|
|
152
|
+
export const getFileAccessUrlResponse = zod.object({
|
|
153
|
+
"fileId": zod.string(),
|
|
154
|
+
"url": zod.string(),
|
|
155
|
+
"isPublic": zod.boolean(),
|
|
156
|
+
"expiresAt": zod.string()
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Retrieves warehouse details by its identifier. Returns 404 if not found or soft-deleted.
|
|
160
|
+
* @summary Get warehouse by ID
|
|
161
|
+
*/
|
|
162
|
+
export const getWarehouseByIdParams = zod.object({
|
|
163
|
+
"id": zod.string()
|
|
164
|
+
});
|
|
165
|
+
export const getWarehouseByIdResponse = zod.object({
|
|
166
|
+
"id": zod.string(),
|
|
167
|
+
"name": zod.string(),
|
|
168
|
+
"pic": zod.object({
|
|
169
|
+
"name": zod.string(),
|
|
170
|
+
"phone": zod.string()
|
|
171
|
+
}),
|
|
172
|
+
"address": zod.object({
|
|
173
|
+
"addressId": zod.string(),
|
|
174
|
+
"destinationCode": zod.string().nullable(),
|
|
175
|
+
"provinceName": zod.string().nullable(),
|
|
176
|
+
"cityName": zod.string().nullable(),
|
|
177
|
+
"districtName": zod.string().nullable(),
|
|
178
|
+
"subDistrictName": zod.string().nullable(),
|
|
179
|
+
"zipCode": zod.string().nullable()
|
|
180
|
+
}),
|
|
181
|
+
"fullAddressText": zod.string().nullable(),
|
|
182
|
+
"isActive": zod.boolean(),
|
|
183
|
+
"createdAt": zod.string(),
|
|
184
|
+
"updatedAt": zod.string()
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* Updates warehouse name, person in charge, and address. Increments version on update.
|
|
188
|
+
* @summary Update warehouse
|
|
189
|
+
*/
|
|
190
|
+
export const updateWarehouseParams = zod.object({
|
|
191
|
+
"id": zod.string()
|
|
192
|
+
});
|
|
193
|
+
export const updateWarehouseBody = zod.object({
|
|
194
|
+
"name": zod.string(),
|
|
195
|
+
"picName": zod.string(),
|
|
196
|
+
"picPhone": zod.string(),
|
|
197
|
+
"addressId": zod.string(),
|
|
198
|
+
"fullAddressText": zod.string().nullish()
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* Soft-deletes a warehouse by setting its deletedAt timestamp. Cannot delete active warehouses.
|
|
202
|
+
* @summary Delete warehouse
|
|
203
|
+
*/
|
|
204
|
+
export const deleteWarehouseParams = zod.object({
|
|
205
|
+
"id": zod.string()
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Updates a stock item name, SKU, or image. Increments version on update.
|
|
209
|
+
* @summary Update stock item
|
|
210
|
+
*/
|
|
211
|
+
export const updateStockItemParams = zod.object({
|
|
212
|
+
"id": zod.string()
|
|
213
|
+
});
|
|
214
|
+
export const updateStockItemBody = zod.object({
|
|
215
|
+
"name": zod.string(),
|
|
216
|
+
"sku": zod.string(),
|
|
217
|
+
"imageFileId": zod.string().nullish()
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* Soft-deletes a stock item by setting its deletedAt timestamp. Cannot delete active stock items.
|
|
221
|
+
* @summary Delete stock item
|
|
222
|
+
*/
|
|
223
|
+
export const deleteStockItemParams = zod.object({
|
|
224
|
+
"id": zod.string()
|
|
225
|
+
});
|
|
226
|
+
/**
|
|
227
|
+
* Retrieves active stored file metadata by its ID.
|
|
228
|
+
* @summary Get stored file by ID
|
|
229
|
+
*/
|
|
230
|
+
export const getStoredFileByIdParams = zod.object({
|
|
231
|
+
"id": zod.string()
|
|
232
|
+
});
|
|
233
|
+
export const getStoredFileByIdResponse = zod.object({
|
|
234
|
+
"id": zod.string(),
|
|
235
|
+
"originalName": zod.string(),
|
|
236
|
+
"mimeType": zod.string(),
|
|
237
|
+
"sizeBytes": zod.number(),
|
|
238
|
+
"checksum": zod.string(),
|
|
239
|
+
"storageKey": zod.string(),
|
|
240
|
+
"status": zod.string(),
|
|
241
|
+
"visibility": zod.string(),
|
|
242
|
+
"purpose": zod.string(),
|
|
243
|
+
"uploadedBy": zod.string(),
|
|
244
|
+
"expiresAt": zod.string(),
|
|
245
|
+
"createdAt": zod.string(),
|
|
246
|
+
"activatedAt": zod.string(),
|
|
247
|
+
"deletedAt": zod.string()
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* Marks a stored file as DELETED. Files in active use by other modules cannot be deleted.
|
|
251
|
+
* @summary Soft delete stored file
|
|
252
|
+
*/
|
|
253
|
+
export const deleteStoredFileParams = zod.object({
|
|
254
|
+
"id": zod.string()
|
|
255
|
+
});
|
|
256
|
+
/**
|
|
257
|
+
* @summary Health check
|
|
258
|
+
*/
|
|
259
|
+
export const getHealthResponse = zod.object({
|
|
260
|
+
"status": zod.string(),
|
|
261
|
+
"timestamp": zod.string()
|
|
262
|
+
});
|
|
263
|
+
/**
|
|
264
|
+
* Creates a new warehouse with an address resolved from the Address service and an initial active state.
|
|
265
|
+
* @summary Create a new warehouse
|
|
266
|
+
*/
|
|
267
|
+
export const createWarehouseBody = zod.object({
|
|
268
|
+
"name": zod.string(),
|
|
269
|
+
"picName": zod.string(),
|
|
270
|
+
"picPhone": zod.string(),
|
|
271
|
+
"addressId": zod.string(),
|
|
272
|
+
"fullAddressText": zod.string().nullish()
|
|
273
|
+
});
|
|
274
|
+
/**
|
|
275
|
+
* Retrieves a filtered list of warehouses. Excludes soft-deleted warehouses.
|
|
276
|
+
* @summary List all warehouses
|
|
277
|
+
*/
|
|
278
|
+
export const listWarehousesQueryParams = zod.object({
|
|
279
|
+
"search": zod.string().optional(),
|
|
280
|
+
"isActive": zod.boolean().optional()
|
|
281
|
+
});
|
|
282
|
+
export const listWarehousesResponse = zod.object({
|
|
283
|
+
"0": zod.object({
|
|
284
|
+
"id": zod.string(),
|
|
285
|
+
"name": zod.string(),
|
|
286
|
+
"pic": zod.object({
|
|
287
|
+
"name": zod.string(),
|
|
288
|
+
"phone": zod.string()
|
|
289
|
+
}),
|
|
290
|
+
"address": zod.object({
|
|
291
|
+
"addressId": zod.string(),
|
|
292
|
+
"destinationCode": zod.string().nullable(),
|
|
293
|
+
"provinceName": zod.string().nullable(),
|
|
294
|
+
"cityName": zod.string().nullable(),
|
|
295
|
+
"districtName": zod.string().nullable(),
|
|
296
|
+
"subDistrictName": zod.string().nullable(),
|
|
297
|
+
"zipCode": zod.string().nullable()
|
|
298
|
+
}),
|
|
299
|
+
"fullAddressText": zod.string().nullable(),
|
|
300
|
+
"isActive": zod.boolean(),
|
|
301
|
+
"createdAt": zod.string(),
|
|
302
|
+
"updatedAt": zod.string()
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
/**
|
|
306
|
+
* Lists paginated stock movements with optional filtering by itemId, batchId, warehouseId, and sorting.
|
|
307
|
+
* @summary List stock movements
|
|
308
|
+
*/
|
|
309
|
+
export const listStockMovementsQueryParams = zod.object({
|
|
310
|
+
"itemId": zod.string().optional(),
|
|
311
|
+
"batchId": zod.string().optional(),
|
|
312
|
+
"warehouseId": zod.string().optional(),
|
|
313
|
+
"page": zod.number().optional(),
|
|
314
|
+
"pageSize": zod.number().optional(),
|
|
315
|
+
"orderBy": zod.string().optional(),
|
|
316
|
+
"descending": zod.boolean().optional()
|
|
317
|
+
});
|
|
318
|
+
export const listStockMovementsResponse = zod.object({
|
|
319
|
+
"items": zod.array(zod.object({
|
|
320
|
+
"id": zod.string(),
|
|
321
|
+
"itemId": zod.string(),
|
|
322
|
+
"itemName": zod.string(),
|
|
323
|
+
"warehouseId": zod.string(),
|
|
324
|
+
"warehouseName": zod.string(),
|
|
325
|
+
"batchId": zod.string().nullable(),
|
|
326
|
+
"direction": zod.string(),
|
|
327
|
+
"quantity": zod.number(),
|
|
328
|
+
"sourceType": zod.string(),
|
|
329
|
+
"sourceReferenceId": zod.string().nullable(),
|
|
330
|
+
"externalReferenceNo": zod.string().nullable(),
|
|
331
|
+
"note": zod.string().nullable(),
|
|
332
|
+
"createdAt": zod.string(),
|
|
333
|
+
"recordedBy": zod.string().nullable(),
|
|
334
|
+
"receivedBy": zod.string().nullable()
|
|
335
|
+
})),
|
|
336
|
+
"page": zod.number(),
|
|
337
|
+
"pageSize": zod.number(),
|
|
338
|
+
"totalCount": zod.number(),
|
|
339
|
+
"totalPages": zod.number(),
|
|
340
|
+
"hasNextPage": zod.boolean(),
|
|
341
|
+
"hasPreviousPage": zod.boolean()
|
|
342
|
+
});
|
|
343
|
+
/**
|
|
344
|
+
* Creates a new stock item with a unique SKU and name.
|
|
345
|
+
* @summary Create a new stock item
|
|
346
|
+
*/
|
|
347
|
+
export const createStockItemBody = zod.object({
|
|
348
|
+
"name": zod.string(),
|
|
349
|
+
"sku": zod.string(),
|
|
350
|
+
"imageFileId": zod.string().nullish()
|
|
351
|
+
});
|
|
352
|
+
/**
|
|
353
|
+
* Lists paginated stock items with aggregate on-hand, reserved, and available stock levels. Optionally filters by warehouseId, search, and isActive status.
|
|
354
|
+
* @summary List stock items
|
|
355
|
+
*/
|
|
356
|
+
export const listStockItemsQueryParams = zod.object({
|
|
357
|
+
"warehouseId": zod.string().optional(),
|
|
358
|
+
"search": zod.string().optional(),
|
|
359
|
+
"isActive": zod.boolean().optional(),
|
|
360
|
+
"page": zod.number().optional(),
|
|
361
|
+
"pageSize": zod.number().optional(),
|
|
362
|
+
"orderBy": zod.string().optional(),
|
|
363
|
+
"descending": zod.boolean().optional()
|
|
364
|
+
});
|
|
365
|
+
export const listStockItemsResponse = zod.object({
|
|
366
|
+
"items": zod.array(zod.object({
|
|
367
|
+
"id": zod.string(),
|
|
368
|
+
"sku": zod.string(),
|
|
369
|
+
"name": zod.string(),
|
|
370
|
+
"isActive": zod.boolean(),
|
|
371
|
+
"onHandQty": zod.number(),
|
|
372
|
+
"reservedQty": zod.number(),
|
|
373
|
+
"availableQty": zod.number()
|
|
374
|
+
})),
|
|
375
|
+
"page": zod.number(),
|
|
376
|
+
"pageSize": zod.number(),
|
|
377
|
+
"totalCount": zod.number(),
|
|
378
|
+
"totalPages": zod.number(),
|
|
379
|
+
"hasNextPage": zod.boolean(),
|
|
380
|
+
"hasPreviousPage": zod.boolean()
|
|
381
|
+
});
|
|
382
|
+
/**
|
|
383
|
+
* Records a new batch receipt into a warehouse and updates stock levels atomically.
|
|
384
|
+
* @summary Create a new stock batch
|
|
385
|
+
*/
|
|
386
|
+
export const createBatchBody = zod.object({
|
|
387
|
+
"itemId": zod.string(),
|
|
388
|
+
"warehouseId": zod.string(),
|
|
389
|
+
"receivedAt": zod.string(),
|
|
390
|
+
"receivedQty": zod.number(),
|
|
391
|
+
"sourceType": zod.string(),
|
|
392
|
+
"unitCost": zod.number(),
|
|
393
|
+
"expiresOn": zod.string().nullish(),
|
|
394
|
+
"externalReferenceNo": zod.string().nullish(),
|
|
395
|
+
"note": zod.string().nullish(),
|
|
396
|
+
"receivedBy": zod.string().nullish(),
|
|
397
|
+
"recordedBy": zod.string().nullish()
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* @summary API welcome message
|
|
401
|
+
*/
|
|
402
|
+
export const getResponse = zod.object({
|
|
403
|
+
"message": zod.string()
|
|
404
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { getGetHealthUrl, zodSchemas } from './index.js';
|
|
3
|
+
describe('@arascreative/erp-client', () => {
|
|
4
|
+
it('exports api url helpers', () => {
|
|
5
|
+
expect(typeof getGetHealthUrl).toBe('function');
|
|
6
|
+
expect(getGetHealthUrl()).toBe('/health');
|
|
7
|
+
});
|
|
8
|
+
it('exports zod schemas', () => {
|
|
9
|
+
expect(zodSchemas.loginBody).toBeDefined();
|
|
10
|
+
const parsed = zodSchemas.loginBody.safeParse({ email: 'test@example.com', passwordPlain: 'secret' });
|
|
11
|
+
expect(parsed.success).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arascreative/erp-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./zod": {
|
|
14
|
+
"types": "./dist/generated/zod.d.ts",
|
|
15
|
+
"import": "./dist/generated/zod.js",
|
|
16
|
+
"default": "./dist/generated/zod.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"tsnx": {
|
|
26
|
+
"name": "ArasERP.Client",
|
|
27
|
+
"type": "library"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@tanstack/react-query": "^5.0.0",
|
|
31
|
+
"react": ">=18.0.0",
|
|
32
|
+
"zod": "^3.20.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@tanstack/react-query": {
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"react": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"zod": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@tanstack/react-query": "^5.67.2",
|
|
47
|
+
"@types/node": "^22.13.9",
|
|
48
|
+
"@types/react": "^19.3.0",
|
|
49
|
+
"orval": "^7.6.0",
|
|
50
|
+
"react": "^19.3.1",
|
|
51
|
+
"typescript": "^5.8.2",
|
|
52
|
+
"vitest": "latest",
|
|
53
|
+
"zod": "^3.24.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"codegen": "orval",
|
|
57
|
+
"build": "tsc -b",
|
|
58
|
+
"clean": "tsc -b --clean"
|
|
59
|
+
}
|
|
6
60
|
}
|
package/README.md
DELETED