@arascreative/erp-client 0.0.0-stage → 1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/generated/zod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;EAEtC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;EAExC,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;EAEtC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;EAExC,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;EAEjC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;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QpC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjC,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY1B,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;EAEtB,CAAA"}
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * ArasERP V1 API
5
+ * Enterprise Resource Planning Backend API
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from 'zod';
9
+ /**
10
+ * Stores an HttpOnly antiforgery cookie and returns the request token and header name. Send both on subsequent identity requests that change data.
11
+ * @summary Get an antiforgery token
12
+ */
13
+ export const getAntiforgeryTokenResponse = zod.object({
14
+ "requestToken": zod.string(),
15
+ "headerName": zod.string()
16
+ });
17
+ /**
18
+ * Creates a new server-side session with the configured absolute lifetime and rotates the antiforgery token. Use the returned requestToken for subsequent requests.
19
+ * @summary Sign in with email and password
20
+ */
21
+ export const loginBody = zod.object({
22
+ "email": zod.string(),
23
+ "passwordPlain": zod.string()
24
+ });
25
+ export const loginResponse = zod.object({
26
+ "user": zod.object({
27
+ "id": zod.string(),
28
+ "email": zod.string(),
29
+ "username": zod.string(),
30
+ "kind": zod.string()
31
+ }),
32
+ "expiresAt": zod.string(),
33
+ "requestToken": zod.string(),
34
+ "headerName": zod.string()
35
+ });
36
+ /**
37
+ * @summary Get the current signed-in user
38
+ */
39
+ export const getCurrentUserResponse = zod.object({
40
+ "user": zod.object({
41
+ "id": zod.string(),
42
+ "email": zod.string(),
43
+ "username": zod.string(),
44
+ "kind": zod.string()
45
+ })
46
+ });
47
+ /**
48
+ * @summary Revoke the current session and clear its cookie
49
+ */
50
+ export const logoutResponse = zod.object({
51
+ "requestToken": zod.string(),
52
+ "headerName": zod.string()
53
+ });
54
+ /**
55
+ * Creates the single owner account for the tenant. Use this endpoint only once per deployment.
56
+ * @summary Create the owner account
57
+ */
58
+ export const createOwnerBody = zod.object({
59
+ "email": zod.string(),
60
+ "username": zod.string(),
61
+ "passwordPlain": zod.string()
62
+ });
63
+ /**
64
+ * @summary Search addresses by keyword
65
+ */
66
+ export const searchAddressesQueryParams = zod.object({
67
+ "keyword": zod.string(),
68
+ "limit": zod.number().optional()
69
+ });
70
+ export const searchAddressesResponseItem = zod.object({
71
+ "addressId": zod.string(),
72
+ "externalId": zod.string().nullable(),
73
+ "destinationCode": zod.string(),
74
+ "originCode": zod.string(),
75
+ "provinceName": zod.string(),
76
+ "cityName": zod.string(),
77
+ "districtName": zod.string(),
78
+ "subDistrictName": zod.string(),
79
+ "zipCode": zod.string()
80
+ });
81
+ export const searchAddressesResponse = zod.array(searchAddressesResponseItem);
82
+ /**
83
+ * Toggles the active state of a warehouse. Soft-deleted warehouses cannot be toggled.
84
+ * @summary Toggle warehouse active status
85
+ */
86
+ export const toggleWarehouseStatusParams = zod.object({
87
+ "id": zod.string()
88
+ });
89
+ export const toggleWarehouseStatusResponse = zod.object({
90
+ "isActive": zod.boolean()
91
+ });
92
+ /**
93
+ * Activates or deactivates a stock item.
94
+ * @summary Change stock item active status
95
+ */
96
+ export const changeStockItemStatusParams = zod.object({
97
+ "id": zod.string()
98
+ });
99
+ export const changeStockItemStatusBody = zod.object({
100
+ "status": zod.string()
101
+ });
102
+ export const changeStockItemStatusResponse = zod.object({
103
+ "status": zod.string()
104
+ });
105
+ /**
106
+ * Retrieves warehouse details by its identifier. Returns 404 if not found or soft-deleted.
107
+ * @summary Get warehouse by ID
108
+ */
109
+ export const getWarehouseByIdParams = zod.object({
110
+ "id": zod.string()
111
+ });
112
+ export const getWarehouseByIdResponse = zod.object({
113
+ "id": zod.string(),
114
+ "name": zod.string(),
115
+ "pic": zod.object({
116
+ "name": zod.string(),
117
+ "phone": zod.string()
118
+ }),
119
+ "address": zod.object({
120
+ "addressId": zod.string(),
121
+ "destinationCode": zod.string().nullable(),
122
+ "provinceName": zod.string().nullable(),
123
+ "cityName": zod.string().nullable(),
124
+ "districtName": zod.string().nullable(),
125
+ "subDistrictName": zod.string().nullable(),
126
+ "zipCode": zod.string().nullable()
127
+ }),
128
+ "fullAddressText": zod.string().nullable(),
129
+ "isActive": zod.boolean(),
130
+ "createdAt": zod.string(),
131
+ "updatedAt": zod.string()
132
+ });
133
+ /**
134
+ * Updates warehouse name, person in charge, and address. Increments version on update.
135
+ * @summary Update warehouse
136
+ */
137
+ export const updateWarehouseParams = zod.object({
138
+ "id": zod.string()
139
+ });
140
+ export const updateWarehouseBody = zod.object({
141
+ "name": zod.string(),
142
+ "picName": zod.string(),
143
+ "picPhone": zod.string(),
144
+ "addressId": zod.string(),
145
+ "fullAddressText": zod.string().nullish()
146
+ });
147
+ /**
148
+ * Soft-deletes a warehouse by setting its deletedAt timestamp. Cannot delete active warehouses.
149
+ * @summary Delete warehouse
150
+ */
151
+ export const deleteWarehouseParams = zod.object({
152
+ "id": zod.string()
153
+ });
154
+ /**
155
+ * Updates a stock item name, SKU, or image. Increments version on update.
156
+ * @summary Update stock item
157
+ */
158
+ export const updateStockItemParams = zod.object({
159
+ "id": zod.string()
160
+ });
161
+ export const updateStockItemBody = zod.object({
162
+ "name": zod.string(),
163
+ "sku": zod.string(),
164
+ "imageFileId": zod.string().nullish()
165
+ });
166
+ /**
167
+ * Soft-deletes a stock item by setting its deletedAt timestamp. Cannot delete active stock items.
168
+ * @summary Delete stock item
169
+ */
170
+ export const deleteStockItemParams = zod.object({
171
+ "id": zod.string()
172
+ });
173
+ /**
174
+ * @summary Health check
175
+ */
176
+ export const getHealthResponse = zod.object({
177
+ "status": zod.string(),
178
+ "timestamp": zod.string()
179
+ });
180
+ /**
181
+ * Creates a new warehouse with an address resolved from the Address service and an initial active state.
182
+ * @summary Create a new warehouse
183
+ */
184
+ export const createWarehouseBody = zod.object({
185
+ "name": zod.string(),
186
+ "picName": zod.string(),
187
+ "picPhone": zod.string(),
188
+ "addressId": zod.string(),
189
+ "fullAddressText": zod.string().nullish()
190
+ });
191
+ /**
192
+ * Retrieves a filtered list of warehouses. Excludes soft-deleted warehouses.
193
+ * @summary List all warehouses
194
+ */
195
+ export const listWarehousesQueryParams = zod.object({
196
+ "search": zod.string().optional(),
197
+ "isActive": zod.boolean().optional()
198
+ });
199
+ export const listWarehousesResponse = zod.object({
200
+ "0": zod.object({
201
+ "id": zod.string(),
202
+ "name": zod.string(),
203
+ "pic": zod.object({
204
+ "name": zod.string(),
205
+ "phone": zod.string()
206
+ }),
207
+ "address": zod.object({
208
+ "addressId": zod.string(),
209
+ "destinationCode": zod.string().nullable(),
210
+ "provinceName": zod.string().nullable(),
211
+ "cityName": zod.string().nullable(),
212
+ "districtName": zod.string().nullable(),
213
+ "subDistrictName": zod.string().nullable(),
214
+ "zipCode": zod.string().nullable()
215
+ }),
216
+ "fullAddressText": zod.string().nullable(),
217
+ "isActive": zod.boolean(),
218
+ "createdAt": zod.string(),
219
+ "updatedAt": zod.string()
220
+ })
221
+ });
222
+ /**
223
+ * Lists paginated stock movements with optional filtering by itemId, batchId, warehouseId, and sorting.
224
+ * @summary List stock movements
225
+ */
226
+ export const listStockMovementsQueryParams = zod.object({
227
+ "itemId": zod.string().optional(),
228
+ "batchId": zod.string().optional(),
229
+ "warehouseId": zod.string().optional(),
230
+ "page": zod.number().optional(),
231
+ "pageSize": zod.number().optional(),
232
+ "orderBy": zod.string().optional(),
233
+ "descending": zod.boolean().optional()
234
+ });
235
+ export const listStockMovementsResponse = zod.object({
236
+ "items": zod.array(zod.object({
237
+ "id": zod.string(),
238
+ "itemId": zod.string(),
239
+ "itemName": zod.string(),
240
+ "warehouseId": zod.string(),
241
+ "warehouseName": zod.string(),
242
+ "batchId": zod.string().nullable(),
243
+ "direction": zod.string(),
244
+ "quantity": zod.number(),
245
+ "sourceType": zod.string(),
246
+ "sourceReferenceId": zod.string().nullable(),
247
+ "externalReferenceNo": zod.string().nullable(),
248
+ "note": zod.string().nullable(),
249
+ "createdAt": zod.string(),
250
+ "recordedBy": zod.string().nullable(),
251
+ "receivedBy": zod.string().nullable()
252
+ })),
253
+ "page": zod.number(),
254
+ "pageSize": zod.number(),
255
+ "totalCount": zod.number(),
256
+ "totalPages": zod.number(),
257
+ "hasNextPage": zod.boolean(),
258
+ "hasPreviousPage": zod.boolean()
259
+ });
260
+ /**
261
+ * Creates a new stock item with a unique SKU and name.
262
+ * @summary Create a new stock item
263
+ */
264
+ export const createStockItemBody = zod.object({
265
+ "name": zod.string(),
266
+ "sku": zod.string(),
267
+ "imageFileId": zod.string().nullish()
268
+ });
269
+ /**
270
+ * Lists paginated stock items with aggregate on-hand, reserved, and available stock levels. Optionally filters by warehouseId, search, and isActive status.
271
+ * @summary List stock items
272
+ */
273
+ export const listStockItemsQueryParams = zod.object({
274
+ "warehouseId": zod.string().optional(),
275
+ "search": zod.string().optional(),
276
+ "isActive": zod.boolean().optional(),
277
+ "page": zod.number().optional(),
278
+ "pageSize": zod.number().optional(),
279
+ "orderBy": zod.string().optional(),
280
+ "descending": zod.boolean().optional()
281
+ });
282
+ export const listStockItemsResponse = zod.object({
283
+ "items": zod.array(zod.object({
284
+ "id": zod.string(),
285
+ "sku": zod.string(),
286
+ "name": zod.string(),
287
+ "isActive": zod.boolean(),
288
+ "onHandQty": zod.number(),
289
+ "reservedQty": zod.number(),
290
+ "availableQty": zod.number()
291
+ })),
292
+ "page": zod.number(),
293
+ "pageSize": zod.number(),
294
+ "totalCount": zod.number(),
295
+ "totalPages": zod.number(),
296
+ "hasNextPage": zod.boolean(),
297
+ "hasPreviousPage": zod.boolean()
298
+ });
299
+ /**
300
+ * Records a new batch receipt into a warehouse and updates stock levels atomically.
301
+ * @summary Create a new stock batch
302
+ */
303
+ export const createBatchBody = zod.object({
304
+ "itemId": zod.string(),
305
+ "warehouseId": zod.string(),
306
+ "receivedAt": zod.string(),
307
+ "receivedQty": zod.number(),
308
+ "sourceType": zod.string(),
309
+ "unitCost": zod.number(),
310
+ "expiresOn": zod.string().nullish(),
311
+ "externalReferenceNo": zod.string().nullish(),
312
+ "note": zod.string().nullish(),
313
+ "receivedBy": zod.string().nullish(),
314
+ "recordedBy": zod.string().nullish()
315
+ });
316
+ /**
317
+ * @summary API welcome message
318
+ */
319
+ export const getResponse = zod.object({
320
+ "message": zod.string()
321
+ });
@@ -0,0 +1,3 @@
1
+ export * from './generated/api.js';
2
+ export * as zodSchemas from './generated/zod.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export * from './generated/api.js';
2
+ export * as zodSchemas from './generated/zod.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -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": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.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
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.