@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.1
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/LICENSE +17 -0
- package/README.md +229 -2
- package/bin/nuwah-contract-check-rules.d.mts +41 -0
- package/bin/nuwah-contract-check-rules.mjs +333 -0
- package/bin/nuwah-contract-check.mjs +64 -0
- package/dist/accounting.d.ts +1417 -0
- package/dist/accounting.js +274 -0
- package/dist/active-org.d.ts +13 -0
- package/dist/active-org.js +59 -0
- package/dist/actors.d.ts +448 -0
- package/dist/actors.js +143 -0
- package/dist/ai.d.ts +359 -0
- package/dist/ai.js +229 -0
- package/dist/analytics.d.ts +37 -0
- package/dist/analytics.js +8 -0
- package/dist/atlas.d.ts +291 -0
- package/dist/atlas.js +78 -0
- package/dist/audit.d.ts +193 -0
- package/dist/audit.js +26 -0
- package/dist/authentication.d.ts +119 -0
- package/dist/authentication.js +83 -0
- package/dist/awards.d.ts +38 -0
- package/dist/awards.js +10 -0
- package/dist/blueprint/document.d.ts +178 -0
- package/dist/blueprint/document.js +17 -0
- package/dist/blueprint/index.d.ts +3 -0
- package/dist/blueprint/index.js +5 -0
- package/dist/blueprint/manifest.d.ts +105 -0
- package/dist/blueprint/manifest.js +11 -0
- package/dist/blueprint/validate.d.ts +14 -0
- package/dist/blueprint/validate.js +416 -0
- package/dist/bookings-directory.d.ts +118 -0
- package/dist/bookings-directory.js +289 -0
- package/dist/bookings-extra.d.ts +1448 -0
- package/dist/bookings-extra.js +582 -0
- package/dist/bookings.d.ts +1365 -0
- package/dist/bookings.js +305 -0
- package/dist/builder-code.d.ts +164 -0
- package/dist/builder-code.js +12 -0
- package/dist/builder-core-gaps.d.ts +83 -0
- package/dist/builder-core-gaps.js +8 -0
- package/dist/builder-repos.d.ts +73 -0
- package/dist/builder-repos.js +37 -0
- package/dist/builder.d.ts +730 -0
- package/dist/builder.js +105 -0
- package/dist/campaigns.d.ts +105 -0
- package/dist/campaigns.js +25 -0
- package/dist/catalogs.d.ts +188 -0
- package/dist/catalogs.js +36 -0
- package/dist/commerce-ai.d.ts +182 -0
- package/dist/commerce-ai.js +27 -0
- package/dist/connections.d.ts +278 -0
- package/dist/connections.js +96 -0
- package/dist/content-control.d.ts +121 -0
- package/dist/content-control.js +23 -0
- package/dist/contributions.d.ts +560 -0
- package/dist/contributions.js +140 -0
- package/dist/conversation-assist.d.ts +154 -0
- package/dist/conversation-assist.js +51 -0
- package/dist/conversation-info.d.ts +219 -0
- package/dist/conversation-info.js +43 -0
- package/dist/crm.d.ts +533 -0
- package/dist/crm.js +142 -0
- package/dist/dashboards.d.ts +119 -0
- package/dist/dashboards.js +22 -0
- package/dist/delegations.d.ts +161 -0
- package/dist/delegations.js +39 -0
- package/dist/docs.d.ts +289 -0
- package/dist/docs.js +49 -0
- package/dist/documents.d.ts +317 -0
- package/dist/documents.js +84 -0
- package/dist/drafts.d.ts +132 -0
- package/dist/drafts.js +56 -0
- package/dist/engagements.d.ts +133 -0
- package/dist/engagements.js +15 -0
- package/dist/event-stream.d.ts +54 -0
- package/dist/event-stream.js +228 -0
- package/dist/exchanges.d.ts +447 -0
- package/dist/exchanges.js +145 -0
- package/dist/exports.d.ts +113 -0
- package/dist/exports.js +81 -0
- package/dist/feeds.d.ts +228 -0
- package/dist/feeds.js +52 -0
- package/dist/files.d.ts +56 -0
- package/dist/files.js +55 -0
- package/dist/finance-insights.d.ts +41 -0
- package/dist/finance-insights.js +61 -0
- package/dist/fixed-assets.d.ts +155 -0
- package/dist/fixed-assets.js +28 -0
- package/dist/fulfilment-jobs.d.ts +405 -0
- package/dist/fulfilment-jobs.js +76 -0
- package/dist/fulfilment.d.ts +205 -0
- package/dist/fulfilment.js +39 -0
- package/dist/hr.d.ts +350 -0
- package/dist/hr.js +94 -0
- package/dist/http.d.ts +124 -0
- package/dist/http.js +392 -0
- package/dist/inbox.d.ts +206 -0
- package/dist/inbox.js +36 -0
- package/dist/index.d.ts +384 -0
- package/dist/index.js +294 -0
- package/dist/insights.d.ts +176 -0
- package/dist/insights.js +52 -0
- package/dist/inventory.d.ts +797 -0
- package/dist/inventory.js +120 -0
- package/dist/list-query.d.ts +211 -0
- package/dist/list-query.js +158 -0
- package/dist/listings.d.ts +381 -0
- package/dist/listings.js +173 -0
- package/dist/location-sharing.d.ts +83 -0
- package/dist/location-sharing.js +20 -0
- package/dist/marketplace.d.ts +268 -0
- package/dist/marketplace.js +59 -0
- package/dist/matching.d.ts +103 -0
- package/dist/matching.js +22 -0
- package/dist/media.d.ts +221 -0
- package/dist/media.js +239 -0
- package/dist/metrics.d.ts +125 -0
- package/dist/metrics.js +45 -0
- package/dist/moderation.d.ts +240 -0
- package/dist/moderation.js +40 -0
- package/dist/money.d.ts +41 -0
- package/dist/money.js +79 -0
- package/dist/my-data.d.ts +266 -0
- package/dist/my-data.js +32 -0
- package/dist/names.d.ts +14 -0
- package/dist/names.js +17 -0
- package/dist/occasions.d.ts +256 -0
- package/dist/occasions.js +40 -0
- package/dist/onboarding.d.ts +88 -0
- package/dist/onboarding.js +38 -0
- package/dist/pagination.d.ts +204 -0
- package/dist/pagination.js +141 -0
- package/dist/party-baseline-attributes.d.ts +245 -0
- package/dist/party-baseline-attributes.js +36 -0
- package/dist/party.d.ts +401 -0
- package/dist/party.js +56 -0
- package/dist/patient.d.ts +161 -0
- package/dist/patient.js +45 -0
- package/dist/payroll.d.ts +378 -0
- package/dist/payroll.js +60 -0
- package/dist/person-addresses.d.ts +88 -0
- package/dist/person-addresses.js +18 -0
- package/dist/person-cart.d.ts +250 -0
- package/dist/person-cart.js +63 -0
- package/dist/person-chat-assist.d.ts +47 -0
- package/dist/person-chat-assist.js +13 -0
- package/dist/person-data-webhooks.d.ts +72 -0
- package/dist/person-data-webhooks.js +86 -0
- package/dist/person-data.d.ts +212 -0
- package/dist/person-data.js +162 -0
- package/dist/person-locations.d.ts +54 -0
- package/dist/person-locations.js +6 -0
- package/dist/person-messaging.d.ts +405 -0
- package/dist/person-messaging.js +112 -0
- package/dist/person-notifications.d.ts +319 -0
- package/dist/person-notifications.js +164 -0
- package/dist/personalisation.d.ts +21 -0
- package/dist/personalisation.js +8 -0
- package/dist/platform.d.ts +63 -0
- package/dist/platform.js +45 -0
- package/dist/portfolio.d.ts +163 -0
- package/dist/portfolio.js +28 -0
- package/dist/pos.d.ts +743 -0
- package/dist/pos.js +129 -0
- package/dist/procurement.d.ts +664 -0
- package/dist/procurement.js +157 -0
- package/dist/promotions.d.ts +169 -0
- package/dist/promotions.js +39 -0
- package/dist/publications.d.ts +583 -0
- package/dist/publications.js +164 -0
- package/dist/ranking.d.ts +43 -0
- package/dist/ranking.js +34 -0
- package/dist/ratings.d.ts +293 -0
- package/dist/ratings.js +109 -0
- package/dist/reactions.d.ts +123 -0
- package/dist/reactions.js +41 -0
- package/dist/recipient-orders.d.ts +294 -0
- package/dist/recipient-orders.js +73 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.js +8 -0
- package/dist/reporting.d.ts +107 -0
- package/dist/reporting.js +56 -0
- package/dist/sales.d.ts +270 -0
- package/dist/sales.js +66 -0
- package/dist/shares.d.ts +105 -0
- package/dist/shares.js +27 -0
- package/dist/shop.d.ts +993 -0
- package/dist/shop.js +215 -0
- package/dist/shopping-assistant.d.ts +65 -0
- package/dist/shopping-assistant.js +14 -0
- package/dist/spaces.d.ts +422 -0
- package/dist/spaces.js +118 -0
- package/dist/stored-value.d.ts +754 -0
- package/dist/stored-value.js +177 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +2 -0
- package/dist/vault.d.ts +290 -0
- package/dist/vault.js +55 -0
- package/dist/vertical-runtime.d.ts +17 -0
- package/dist/vertical-runtime.js +8 -0
- package/dist/vite/build-manifest-plugin.d.ts +42 -0
- package/dist/vite/build-manifest-plugin.js +42 -0
- package/dist/vite/first-paint-plugin.d.ts +26 -0
- package/dist/vite/first-paint-plugin.js +57 -0
- package/dist/wishlists.d.ts +591 -0
- package/dist/wishlists.js +188 -0
- package/dist/workbench.d.ts +114 -0
- package/dist/workbench.js +22 -0
- package/dist/workspace.d.ts +190 -0
- package/dist/workspace.js +41 -0
- package/package.json +52 -4
- package/templates/extension-image.Dockerfile +38 -0
- package/templates/nuwah-vertical.yml +102 -0
- package/templates/vertical-app/.env.example +34 -0
- package/templates/vertical-app/README.md +108 -0
- package/templates/vertical-app/github/workflows/ci.yml +51 -0
- package/templates/vertical-app/gitignore +5 -0
- package/templates/vertical-app/index.html +12 -0
- package/templates/vertical-app/package.json +28 -0
- package/templates/vertical-app/src/App.tsx +64 -0
- package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
- package/templates/vertical-app/src/blueprint/screens.ts +15 -0
- package/templates/vertical-app/src/env.d.ts +18 -0
- package/templates/vertical-app/src/index.css +139 -0
- package/templates/vertical-app/src/lib/i18n.ts +5 -0
- package/templates/vertical-app/src/lib/iam.ts +19 -0
- package/templates/vertical-app/src/lib/operations.ts +93 -0
- package/templates/vertical-app/src/lib/router.ts +24 -0
- package/templates/vertical-app/src/lib/sdk.ts +21 -0
- package/templates/vertical-app/src/lib/theme.ts +18 -0
- package/templates/vertical-app/src/lib/words.ts +39 -0
- package/templates/vertical-app/src/main.tsx +25 -0
- package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
- package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
- package/templates/vertical-app/src/pages/Home.tsx +36 -0
- package/templates/vertical-app/tsconfig.json +24 -0
- package/templates/vertical-app/vite.config.ts +23 -0
- package/templates/vertical-ci.yml +192 -0
|
@@ -0,0 +1,797 @@
|
|
|
1
|
+
import type { Http } from './http.js';
|
|
2
|
+
import type { ListQuery, Paginated } from './types.js';
|
|
3
|
+
export type CostingMethod = 'fifo' | 'weighted_average' | 'standard';
|
|
4
|
+
export type BarcodeType = 'ean13' | 'upc' | 'qr' | 'code128' | 'gs1' | 'other';
|
|
5
|
+
export interface ItemBarcode {
|
|
6
|
+
id: string;
|
|
7
|
+
tenant_id?: string;
|
|
8
|
+
item_id: string;
|
|
9
|
+
barcode: string;
|
|
10
|
+
barcode_type: BarcodeType;
|
|
11
|
+
is_primary: boolean;
|
|
12
|
+
label: string | null;
|
|
13
|
+
created_at?: string;
|
|
14
|
+
updated_at?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InventoryItem {
|
|
17
|
+
id: string;
|
|
18
|
+
parent_item_id: string | null;
|
|
19
|
+
tenant_id?: string;
|
|
20
|
+
sku: string;
|
|
21
|
+
name_en: string;
|
|
22
|
+
name_ar: string;
|
|
23
|
+
description_en: string | null;
|
|
24
|
+
description_ar: string | null;
|
|
25
|
+
category_id: string | null;
|
|
26
|
+
uom_id: string | null;
|
|
27
|
+
costing_method: CostingMethod;
|
|
28
|
+
reorder_point: string | null;
|
|
29
|
+
reorder_quantity: string | null;
|
|
30
|
+
track_serial: boolean;
|
|
31
|
+
track_batch: boolean;
|
|
32
|
+
is_expiry_tracked: boolean;
|
|
33
|
+
standard_cost: string | null;
|
|
34
|
+
is_active: boolean;
|
|
35
|
+
is_purchasable: boolean;
|
|
36
|
+
is_saleable: boolean;
|
|
37
|
+
weight_kilograms: string | null;
|
|
38
|
+
volume_cubic_meters: string | null;
|
|
39
|
+
barcode_primary: string | null;
|
|
40
|
+
requires_gs1_serialization: boolean;
|
|
41
|
+
gs1_application_identifiers: Record<string, unknown> | unknown[] | null;
|
|
42
|
+
allows_negative_stock_override: boolean | null;
|
|
43
|
+
created_at: string | null;
|
|
44
|
+
updated_at: string | null;
|
|
45
|
+
deleted_at: string | null;
|
|
46
|
+
/** Eager-loaded on show/create/variants. */
|
|
47
|
+
category?: ItemCategory | null;
|
|
48
|
+
uom?: Record<string, unknown> | null;
|
|
49
|
+
barcodes?: ItemBarcode[];
|
|
50
|
+
variants?: InventoryItem[];
|
|
51
|
+
attribute_values?: Array<Record<string, unknown>>;
|
|
52
|
+
}
|
|
53
|
+
export interface CreateItemBarcodeInput {
|
|
54
|
+
id?: string;
|
|
55
|
+
barcode: string;
|
|
56
|
+
barcode_type?: BarcodeType;
|
|
57
|
+
is_primary?: boolean;
|
|
58
|
+
label?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface CreateItemAttributeValueInput {
|
|
61
|
+
attribute_template_id: string;
|
|
62
|
+
text_value?: string | null;
|
|
63
|
+
number_value?: number | null;
|
|
64
|
+
boolean_value?: boolean | null;
|
|
65
|
+
option_ids?: string[] | null;
|
|
66
|
+
}
|
|
67
|
+
export interface CreateItemInput {
|
|
68
|
+
sku: string;
|
|
69
|
+
name_en: string;
|
|
70
|
+
name_ar: string;
|
|
71
|
+
description_en?: string | null;
|
|
72
|
+
description_ar?: string | null;
|
|
73
|
+
category_id?: string | null;
|
|
74
|
+
uom_id?: string | null;
|
|
75
|
+
parent_item_id?: string | null;
|
|
76
|
+
costing_method?: CostingMethod;
|
|
77
|
+
reorder_point?: number | null;
|
|
78
|
+
reorder_quantity?: number | null;
|
|
79
|
+
track_serial?: boolean;
|
|
80
|
+
track_batch?: boolean;
|
|
81
|
+
is_expiry_tracked?: boolean;
|
|
82
|
+
standard_cost?: number | null;
|
|
83
|
+
is_active?: boolean;
|
|
84
|
+
is_purchasable?: boolean;
|
|
85
|
+
is_saleable?: boolean;
|
|
86
|
+
weight_kilograms?: number | null;
|
|
87
|
+
volume_cubic_meters?: number | null;
|
|
88
|
+
barcode_primary?: string | null;
|
|
89
|
+
requires_gs1_serialization?: boolean;
|
|
90
|
+
gs1_application_identifiers?: unknown[] | null;
|
|
91
|
+
allows_negative_stock_override?: boolean | null;
|
|
92
|
+
attribute_values?: CreateItemAttributeValueInput[];
|
|
93
|
+
barcodes?: CreateItemBarcodeInput[];
|
|
94
|
+
}
|
|
95
|
+
export type UpdateItemInput = Partial<Pick<CreateItemInput, 'sku' | 'name_en' | 'name_ar' | 'description_en' | 'description_ar' | 'category_id' | 'uom_id' | 'costing_method' | 'is_active' | 'is_purchasable' | 'is_saleable' | 'track_serial' | 'track_batch' | 'is_expiry_tracked' | 'requires_gs1_serialization' | 'standard_cost' | 'reorder_point' | 'reorder_quantity' | 'weight_kilograms' | 'volume_cubic_meters' | 'barcode_primary' | 'gs1_application_identifiers' | 'allows_negative_stock_override' | 'attribute_values' | 'barcodes'>>;
|
|
96
|
+
/**
|
|
97
|
+
* `ItemController@index` reads EXACTLY these filters. `warehouse_id` and
|
|
98
|
+
* `is_active` were declared here and silently ignored by the server — a filter
|
|
99
|
+
* that type-checks and filters nothing is worse than no filter, so they are
|
|
100
|
+
* gone. `archived` (any value) flips the list to soft-deleted items only.
|
|
101
|
+
*/
|
|
102
|
+
export interface ItemListQuery extends ListQuery {
|
|
103
|
+
category_id?: string;
|
|
104
|
+
costing_method?: CostingMethod;
|
|
105
|
+
uom_id?: string;
|
|
106
|
+
archived?: boolean | 1;
|
|
107
|
+
search?: string;
|
|
108
|
+
/** Only items that can (true) or cannot (false) be sold. Omit for both. */
|
|
109
|
+
is_saleable?: boolean;
|
|
110
|
+
/** Only active (true) or inactive (false) items. Omit for both. */
|
|
111
|
+
is_active?: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface StockItemRef {
|
|
114
|
+
id: string;
|
|
115
|
+
sku: string;
|
|
116
|
+
name_en: string;
|
|
117
|
+
name_ar: string;
|
|
118
|
+
}
|
|
119
|
+
export interface StockWarehouseRef {
|
|
120
|
+
id: string;
|
|
121
|
+
name_en: string;
|
|
122
|
+
name_ar: string;
|
|
123
|
+
code: string | null;
|
|
124
|
+
}
|
|
125
|
+
/** Eager-loaded bin stub on a movement (`bin:id,name,bin_type`). */
|
|
126
|
+
export interface StockBinRef {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
bin_type: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Row from `GET /stock/levels` — the recomputable projection of current stock.
|
|
133
|
+
* The composite PK is (item_id, warehouse_id, bin_id), so there is NO `id`: a
|
|
134
|
+
* row key has to be built from all three.
|
|
135
|
+
*/
|
|
136
|
+
export interface StockLevel {
|
|
137
|
+
item_id: string;
|
|
138
|
+
warehouse_id: string;
|
|
139
|
+
bin_id: string;
|
|
140
|
+
tenant_id?: string;
|
|
141
|
+
quantity_on_hand: string;
|
|
142
|
+
quantity_reserved: string;
|
|
143
|
+
quantity_available: string;
|
|
144
|
+
total_cost_value: string;
|
|
145
|
+
last_movement_at: string | null;
|
|
146
|
+
updated_at: string;
|
|
147
|
+
item: StockItemRef;
|
|
148
|
+
warehouse: StockWarehouseRef;
|
|
149
|
+
}
|
|
150
|
+
export type MovementType = 'purchase_receipt' | 'sales_issue' | 'transfer_out' | 'transfer_in' | 'adjustment_up' | 'adjustment_down' | 'write_off' | 'customer_return' | 'supplier_return' | 'opening_balance';
|
|
151
|
+
/** Row from `GET /stock/movements` (append-only ledger). */
|
|
152
|
+
export interface StockMovement {
|
|
153
|
+
id: string;
|
|
154
|
+
tenant_id?: string;
|
|
155
|
+
item_id: string;
|
|
156
|
+
warehouse_id: string;
|
|
157
|
+
bin_id: string | null;
|
|
158
|
+
movement_type: MovementType;
|
|
159
|
+
direction: 'in' | 'out';
|
|
160
|
+
quantity: string;
|
|
161
|
+
cost_per_unit: string;
|
|
162
|
+
total_cost: string;
|
|
163
|
+
currency_code: string;
|
|
164
|
+
reference_type: string | null;
|
|
165
|
+
reference_id: string | null;
|
|
166
|
+
batch_id: string | null;
|
|
167
|
+
reversal_of_id: string | null;
|
|
168
|
+
notes: string | null;
|
|
169
|
+
posted_at: string;
|
|
170
|
+
item: StockItemRef;
|
|
171
|
+
warehouse: StockWarehouseRef;
|
|
172
|
+
/** Eager-loaded `bin:id,name,bin_type` — null when the movement names no bin. */
|
|
173
|
+
bin: StockBinRef | null;
|
|
174
|
+
}
|
|
175
|
+
export interface StockLevelQuery extends ListQuery {
|
|
176
|
+
warehouse_id?: string;
|
|
177
|
+
item_id?: string;
|
|
178
|
+
search?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface StockMovementQuery extends ListQuery {
|
|
181
|
+
item_id?: string;
|
|
182
|
+
warehouse_id?: string;
|
|
183
|
+
movement_type?: MovementType;
|
|
184
|
+
direction?: 'in' | 'out';
|
|
185
|
+
date_from?: string;
|
|
186
|
+
date_to?: string;
|
|
187
|
+
}
|
|
188
|
+
export interface Warehouse {
|
|
189
|
+
id: string;
|
|
190
|
+
tenant_id?: string;
|
|
191
|
+
name_en: string;
|
|
192
|
+
name_ar: string;
|
|
193
|
+
code: string | null;
|
|
194
|
+
address_line1: string | null;
|
|
195
|
+
address_line2: string | null;
|
|
196
|
+
city: string | null;
|
|
197
|
+
country_code: string;
|
|
198
|
+
is_active: boolean;
|
|
199
|
+
allows_negative_stock: boolean;
|
|
200
|
+
created_at: string | null;
|
|
201
|
+
updated_at: string | null;
|
|
202
|
+
}
|
|
203
|
+
export interface CreateWarehouseInput {
|
|
204
|
+
name_en: string;
|
|
205
|
+
name_ar: string;
|
|
206
|
+
code?: string | null;
|
|
207
|
+
address_line1?: string | null;
|
|
208
|
+
address_line2?: string | null;
|
|
209
|
+
city?: string | null;
|
|
210
|
+
country_code?: string;
|
|
211
|
+
is_active?: boolean;
|
|
212
|
+
allows_negative_stock?: boolean;
|
|
213
|
+
}
|
|
214
|
+
export type UpdateWarehouseInput = Partial<CreateWarehouseInput>;
|
|
215
|
+
/** The bin types the `inventory.bins` discriminator allows (spec §5.5). */
|
|
216
|
+
export type BinType = 'receiving' | 'storage' | 'shipping' | 'quarantine' | 'damaged' | 'virtual';
|
|
217
|
+
/**
|
|
218
|
+
* A storage bin inside a warehouse — the sub-place Inventory owns (Bookings owns
|
|
219
|
+
* `space`). Append-only `created_at`; the table carries NO `updated_at`.
|
|
220
|
+
*/
|
|
221
|
+
export interface WarehouseBin {
|
|
222
|
+
id: string;
|
|
223
|
+
warehouse_id: string;
|
|
224
|
+
parent_id: string | null;
|
|
225
|
+
tenant_id?: string;
|
|
226
|
+
name: string;
|
|
227
|
+
bin_type: string;
|
|
228
|
+
sort_order: number | null;
|
|
229
|
+
barcode: string | null;
|
|
230
|
+
is_active: boolean;
|
|
231
|
+
created_at: string | null;
|
|
232
|
+
/** Present on the `/bins` tree endpoint (roots carry their nested children). */
|
|
233
|
+
childrenRecursive?: WarehouseBin[];
|
|
234
|
+
}
|
|
235
|
+
export interface CreateBinInput {
|
|
236
|
+
name: string;
|
|
237
|
+
bin_type?: string;
|
|
238
|
+
parent_id?: string | null;
|
|
239
|
+
barcode?: string | null;
|
|
240
|
+
is_active?: boolean;
|
|
241
|
+
sort_order?: number;
|
|
242
|
+
}
|
|
243
|
+
export type UpdateBinInput = Partial<CreateBinInput>;
|
|
244
|
+
export interface ItemCategory {
|
|
245
|
+
id: string;
|
|
246
|
+
tenant_id?: string;
|
|
247
|
+
parent_id: string | null;
|
|
248
|
+
name_en: string;
|
|
249
|
+
name_ar: string;
|
|
250
|
+
code: string | null;
|
|
251
|
+
sort_order: number;
|
|
252
|
+
is_active: boolean;
|
|
253
|
+
created_at: string | null;
|
|
254
|
+
updated_at: string | null;
|
|
255
|
+
childrenRecursive?: ItemCategory[];
|
|
256
|
+
}
|
|
257
|
+
export interface CreateCategoryInput {
|
|
258
|
+
parent_id?: string | null;
|
|
259
|
+
name_en: string;
|
|
260
|
+
name_ar: string;
|
|
261
|
+
code?: string | null;
|
|
262
|
+
sort_order?: number;
|
|
263
|
+
is_active?: boolean;
|
|
264
|
+
}
|
|
265
|
+
export type UpdateCategoryInput = Partial<CreateCategoryInput>;
|
|
266
|
+
export type AdjustmentType = 'count' | 'correction' | 'write_off';
|
|
267
|
+
export type AdjustmentStatus = 'draft' | 'counting' | 'under_review' | 'approved' | 'posted' | 'cancelled';
|
|
268
|
+
/** Row from `GET /adjustments` (hand-built). */
|
|
269
|
+
export interface AdjustmentListItem {
|
|
270
|
+
uuid: string;
|
|
271
|
+
adjustment_number: string;
|
|
272
|
+
adjustment_type: AdjustmentType;
|
|
273
|
+
adjustment_date: string | null;
|
|
274
|
+
status: AdjustmentStatus;
|
|
275
|
+
warehouse: {
|
|
276
|
+
name: {
|
|
277
|
+
en: string | null;
|
|
278
|
+
ar: string | null;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
total_variance_value: string;
|
|
282
|
+
lines_count: number;
|
|
283
|
+
requires_approval: boolean;
|
|
284
|
+
}
|
|
285
|
+
export interface AdjustmentLine {
|
|
286
|
+
uuid: string;
|
|
287
|
+
item_id: string;
|
|
288
|
+
bin_id: string | null;
|
|
289
|
+
item: {
|
|
290
|
+
sku: string;
|
|
291
|
+
name_en: string;
|
|
292
|
+
name_ar: string;
|
|
293
|
+
} | null;
|
|
294
|
+
/** Snapshotted from live stock by `start-counting`; 0 while the doc is a draft. */
|
|
295
|
+
system_quantity: string;
|
|
296
|
+
counted_quantity: string | null;
|
|
297
|
+
/** POSTGRES GENERATED column (counted − system) — read-only, never sent. */
|
|
298
|
+
variance_quantity: string | null;
|
|
299
|
+
cost_per_unit: string;
|
|
300
|
+
/** POSTGRES GENERATED column (variance × cost) — read-only, never sent. */
|
|
301
|
+
variance_value: string | null;
|
|
302
|
+
lot_number: string | null;
|
|
303
|
+
expiry_date: string | null;
|
|
304
|
+
notes: string | null;
|
|
305
|
+
sort_order: number;
|
|
306
|
+
}
|
|
307
|
+
/** Full shape from `GET /adjustments/{uuid}`. */
|
|
308
|
+
export interface AdjustmentDetail {
|
|
309
|
+
uuid: string;
|
|
310
|
+
adjustment_number: string;
|
|
311
|
+
adjustment_type: AdjustmentType;
|
|
312
|
+
adjustment_date: string | null;
|
|
313
|
+
warehouse_id: string;
|
|
314
|
+
warehouse: {
|
|
315
|
+
name: {
|
|
316
|
+
en: string | null;
|
|
317
|
+
ar: string | null;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
reason: string | null;
|
|
321
|
+
notes: string | null;
|
|
322
|
+
status: AdjustmentStatus;
|
|
323
|
+
total_variance_value: string;
|
|
324
|
+
requires_approval: boolean;
|
|
325
|
+
submitted_at: string | null;
|
|
326
|
+
approved_at: string | null;
|
|
327
|
+
posted_at: string | null;
|
|
328
|
+
cancelled_at: string | null;
|
|
329
|
+
lines: AdjustmentLine[];
|
|
330
|
+
}
|
|
331
|
+
export interface CreateAdjustmentLineInput {
|
|
332
|
+
/**
|
|
333
|
+
* The EXISTING line this entry updates, on `update` only. The server upserts
|
|
334
|
+
* by uuid so a counting-stage save keeps that line's `system_quantity`
|
|
335
|
+
* snapshot; a line sent without one is created fresh with a ZEROED snapshot,
|
|
336
|
+
* and a line left out of the payload is DELETED.
|
|
337
|
+
*/
|
|
338
|
+
uuid?: string;
|
|
339
|
+
item_id: string;
|
|
340
|
+
bin_id?: string | null;
|
|
341
|
+
counted_quantity?: number | null;
|
|
342
|
+
cost_per_unit?: number | null;
|
|
343
|
+
lot_number?: string | null;
|
|
344
|
+
expiry_date?: string | null;
|
|
345
|
+
notes?: string | null;
|
|
346
|
+
}
|
|
347
|
+
export interface CreateAdjustmentInput {
|
|
348
|
+
adjustment_type: AdjustmentType;
|
|
349
|
+
/** Calendar date `YYYY-MM-DD` (a `date` column, not an instant). */
|
|
350
|
+
adjustment_date: string;
|
|
351
|
+
/** A site holding the `stock` role — take it from `warehouses.list()`. */
|
|
352
|
+
warehouse_id: string;
|
|
353
|
+
reason?: string | null;
|
|
354
|
+
notes?: string | null;
|
|
355
|
+
/**
|
|
356
|
+
* Stored and echoed back, but it gates NOTHING: `post` requires `approved`
|
|
357
|
+
* whatever this says, so approval is never actually optional.
|
|
358
|
+
*/
|
|
359
|
+
requires_approval?: boolean;
|
|
360
|
+
lines: CreateAdjustmentLineInput[];
|
|
361
|
+
}
|
|
362
|
+
export type UpdateAdjustmentInput = Partial<CreateAdjustmentInput>;
|
|
363
|
+
export interface AdjustmentListQuery extends ListQuery {
|
|
364
|
+
status?: AdjustmentStatus;
|
|
365
|
+
warehouse_id?: string;
|
|
366
|
+
adjustment_type?: AdjustmentType;
|
|
367
|
+
date_from?: string;
|
|
368
|
+
date_to?: string;
|
|
369
|
+
}
|
|
370
|
+
/** `store`/`update` return just `{ uuid }` — re-fetch via `get`. */
|
|
371
|
+
export interface AdjustmentRef {
|
|
372
|
+
uuid: string;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The lifecycle of a store-to-store transfer:
|
|
376
|
+
* draft → in_transit → received (`StockTransferStatus`)
|
|
377
|
+
*
|
|
378
|
+
* `ship` writes a `transfer_out` movement off the SOURCE store; `receive` writes
|
|
379
|
+
* the matching `transfer_in` onto the DESTINATION at the cost captured when it
|
|
380
|
+
* shipped. Between the two the goods are on nobody's count.
|
|
381
|
+
*/
|
|
382
|
+
export type TransferStatus = 'draft' | 'in_transit' | 'received' | 'cancelled';
|
|
383
|
+
/** Row from `GET /transfers` (hand-built). */
|
|
384
|
+
export interface TransferListItem {
|
|
385
|
+
uuid: string;
|
|
386
|
+
transfer_number: string;
|
|
387
|
+
transfer_date: string | null;
|
|
388
|
+
status: TransferStatus;
|
|
389
|
+
from_warehouse: {
|
|
390
|
+
name: {
|
|
391
|
+
en: string | null;
|
|
392
|
+
ar: string | null;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
to_warehouse: {
|
|
396
|
+
name: {
|
|
397
|
+
en: string | null;
|
|
398
|
+
ar: string | null;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
lines_count: number;
|
|
402
|
+
}
|
|
403
|
+
export interface TransferLine {
|
|
404
|
+
uuid: string;
|
|
405
|
+
item_id: string;
|
|
406
|
+
item: {
|
|
407
|
+
sku: string;
|
|
408
|
+
name_en: string;
|
|
409
|
+
name_ar: string;
|
|
410
|
+
} | null;
|
|
411
|
+
quantity_requested: string;
|
|
412
|
+
/** Written by `ship` (= requested); `'0.0000'` until then. */
|
|
413
|
+
quantity_shipped: string;
|
|
414
|
+
/** Written by `receive` (= shipped); `'0.0000'` until then. */
|
|
415
|
+
quantity_received: string;
|
|
416
|
+
/** Overwritten by `ship` with the issue cost the costing engine computed. */
|
|
417
|
+
cost_per_unit: string;
|
|
418
|
+
lot_number: string | null;
|
|
419
|
+
expiry_date: string | null;
|
|
420
|
+
sort_order: number;
|
|
421
|
+
}
|
|
422
|
+
/** Full shape from `GET /transfers/{uuid}`. */
|
|
423
|
+
export interface TransferDetail {
|
|
424
|
+
uuid: string;
|
|
425
|
+
transfer_number: string;
|
|
426
|
+
transfer_date: string | null;
|
|
427
|
+
from_warehouse_id: string;
|
|
428
|
+
to_warehouse_id: string;
|
|
429
|
+
from_warehouse: {
|
|
430
|
+
name: {
|
|
431
|
+
en: string | null;
|
|
432
|
+
ar: string | null;
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
to_warehouse: {
|
|
436
|
+
name: {
|
|
437
|
+
en: string | null;
|
|
438
|
+
ar: string | null;
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
notes: string | null;
|
|
442
|
+
status: TransferStatus;
|
|
443
|
+
shipped_at: string | null;
|
|
444
|
+
received_at: string | null;
|
|
445
|
+
cancelled_at: string | null;
|
|
446
|
+
lines: TransferLine[];
|
|
447
|
+
}
|
|
448
|
+
export interface CreateTransferLineInput {
|
|
449
|
+
item_id: string;
|
|
450
|
+
quantity_requested: number | string;
|
|
451
|
+
/** Leave unset to let the costing engine price the issue at ship time. */
|
|
452
|
+
cost_per_unit?: number | null;
|
|
453
|
+
lot_number?: string | null;
|
|
454
|
+
expiry_date?: string | null;
|
|
455
|
+
}
|
|
456
|
+
export interface CreateTransferInput {
|
|
457
|
+
/** Calendar date `YYYY-MM-DD`. */
|
|
458
|
+
transfer_date: string;
|
|
459
|
+
/** A site holding the `stock` role; must DIFFER from `to_warehouse_id`. */
|
|
460
|
+
from_warehouse_id: string;
|
|
461
|
+
to_warehouse_id: string;
|
|
462
|
+
/** Optional source/destination bin inside each store. */
|
|
463
|
+
from_bin_id?: string | null;
|
|
464
|
+
to_bin_id?: string | null;
|
|
465
|
+
notes?: string | null;
|
|
466
|
+
lines: CreateTransferLineInput[];
|
|
467
|
+
}
|
|
468
|
+
/** `update` REPLACES the line set wholesale when `lines` is present. */
|
|
469
|
+
export type UpdateTransferInput = Partial<CreateTransferInput>;
|
|
470
|
+
export interface TransferListQuery extends ListQuery {
|
|
471
|
+
status?: TransferStatus;
|
|
472
|
+
from_warehouse_id?: string;
|
|
473
|
+
to_warehouse_id?: string;
|
|
474
|
+
}
|
|
475
|
+
/** `store`/`update` return just `{ uuid }` — re-fetch via `get`. */
|
|
476
|
+
export interface TransferRef {
|
|
477
|
+
uuid: string;
|
|
478
|
+
}
|
|
479
|
+
export interface UnitOfMeasure {
|
|
480
|
+
id: string;
|
|
481
|
+
tenant_id?: string;
|
|
482
|
+
name_en: string;
|
|
483
|
+
name_ar: string;
|
|
484
|
+
symbol: string;
|
|
485
|
+
is_base: boolean;
|
|
486
|
+
is_active: boolean;
|
|
487
|
+
created_at: string | null;
|
|
488
|
+
updated_at: string | null;
|
|
489
|
+
}
|
|
490
|
+
export interface UomConversion {
|
|
491
|
+
id: string;
|
|
492
|
+
tenant_id?: string;
|
|
493
|
+
from_uom_id: string;
|
|
494
|
+
to_uom_id: string;
|
|
495
|
+
/** bcmath decimal string: 1 from-unit = `factor` to-units. */
|
|
496
|
+
factor: string;
|
|
497
|
+
created_at: string | null;
|
|
498
|
+
updated_at: string | null;
|
|
499
|
+
fromUom?: UnitOfMeasure | null;
|
|
500
|
+
toUom?: UnitOfMeasure | null;
|
|
501
|
+
}
|
|
502
|
+
/** `GET /uom` answers with BOTH collections and NO pagination envelope. */
|
|
503
|
+
export interface UomIndex {
|
|
504
|
+
uoms: UnitOfMeasure[];
|
|
505
|
+
conversions: UomConversion[];
|
|
506
|
+
}
|
|
507
|
+
export interface CreateUomInput {
|
|
508
|
+
name_en: string;
|
|
509
|
+
name_ar: string;
|
|
510
|
+
symbol: string;
|
|
511
|
+
is_base?: boolean;
|
|
512
|
+
is_active?: boolean;
|
|
513
|
+
}
|
|
514
|
+
export type UpdateUomInput = Partial<CreateUomInput>;
|
|
515
|
+
export interface CreateUomConversionInput {
|
|
516
|
+
from_uom_id: string;
|
|
517
|
+
to_uom_id: string;
|
|
518
|
+
factor: number | string;
|
|
519
|
+
}
|
|
520
|
+
export type InventoryGoodsReceiptStatus = 'draft' | 'confirmed' | 'posted' | 'cancelled';
|
|
521
|
+
export interface InventoryGoodsReceiptListItem {
|
|
522
|
+
uuid: string;
|
|
523
|
+
receipt_number: string;
|
|
524
|
+
receipt_date: string | null;
|
|
525
|
+
status: InventoryGoodsReceiptStatus;
|
|
526
|
+
warehouse_name: {
|
|
527
|
+
en: string | null;
|
|
528
|
+
ar: string | null;
|
|
529
|
+
} | null;
|
|
530
|
+
purchase_order_number: string | null;
|
|
531
|
+
lines_count: number;
|
|
532
|
+
}
|
|
533
|
+
export interface InventoryGoodsReceiptLine {
|
|
534
|
+
id: string;
|
|
535
|
+
goods_receipt_id: string;
|
|
536
|
+
purchase_order_line_id: string | null;
|
|
537
|
+
item_id: string;
|
|
538
|
+
quantity_received: string;
|
|
539
|
+
unit_cost: string;
|
|
540
|
+
batch_number: string | null;
|
|
541
|
+
gtin: string | null;
|
|
542
|
+
expiry_date: string | null;
|
|
543
|
+
serial_numbers: string[] | null;
|
|
544
|
+
bin_id: string | null;
|
|
545
|
+
stock_movement_id: string | null;
|
|
546
|
+
item?: StockItemRef;
|
|
547
|
+
}
|
|
548
|
+
/** Full raw `InventoryGoodsReceipt` model from `GET /goods-receipts/{uuid}`. */
|
|
549
|
+
export interface InventoryGoodsReceipt {
|
|
550
|
+
id: string;
|
|
551
|
+
tenant_id?: string;
|
|
552
|
+
goods_receipt_number: string;
|
|
553
|
+
purchase_order_id: string | null;
|
|
554
|
+
warehouse_id: string;
|
|
555
|
+
status: InventoryGoodsReceiptStatus;
|
|
556
|
+
received_at: string | null;
|
|
557
|
+
supplier_delivery_note: string | null;
|
|
558
|
+
notes: string | null;
|
|
559
|
+
confirmed_at: string | null;
|
|
560
|
+
created_at: string | null;
|
|
561
|
+
updated_at: string | null;
|
|
562
|
+
lines?: InventoryGoodsReceiptLine[];
|
|
563
|
+
warehouse?: StockWarehouseRef;
|
|
564
|
+
purchaseOrder?: {
|
|
565
|
+
id: string;
|
|
566
|
+
purchase_order_number: string;
|
|
567
|
+
} | null;
|
|
568
|
+
}
|
|
569
|
+
export interface InventoryGoodsReceiptListQuery extends ListQuery {
|
|
570
|
+
status?: InventoryGoodsReceiptStatus;
|
|
571
|
+
warehouse_id?: string;
|
|
572
|
+
search?: string;
|
|
573
|
+
}
|
|
574
|
+
export type PurchaseOrderStatus = 'draft' | 'submitted' | 'approved' | 'partially_received' | 'fully_received' | 'cancelled';
|
|
575
|
+
/** Row from `GET /purchase-orders` (hand-built). `supplier_name` is always null. */
|
|
576
|
+
export interface PurchaseOrderListItem {
|
|
577
|
+
uuid: string;
|
|
578
|
+
order_number: string;
|
|
579
|
+
order_date: string | null;
|
|
580
|
+
expected_delivery_date: string | null;
|
|
581
|
+
status: PurchaseOrderStatus;
|
|
582
|
+
currency_code: string;
|
|
583
|
+
total: string;
|
|
584
|
+
supplier_name: string | null;
|
|
585
|
+
lines_count: number;
|
|
586
|
+
}
|
|
587
|
+
export interface PurchaseOrderLine {
|
|
588
|
+
id: string;
|
|
589
|
+
purchase_order_id: string;
|
|
590
|
+
item_id: string;
|
|
591
|
+
quantity_ordered: string;
|
|
592
|
+
quantity_received: string;
|
|
593
|
+
unit_cost: string;
|
|
594
|
+
total_cost: string;
|
|
595
|
+
unit_of_measure: string;
|
|
596
|
+
notes: string | null;
|
|
597
|
+
item?: StockItemRef;
|
|
598
|
+
}
|
|
599
|
+
/** Full raw `PurchaseOrder` model from `GET /purchase-orders/{uuid}`. */
|
|
600
|
+
export interface PurchaseOrder {
|
|
601
|
+
id: string;
|
|
602
|
+
tenant_id?: string;
|
|
603
|
+
purchase_order_number: string;
|
|
604
|
+
supplier_id: string | null;
|
|
605
|
+
status: PurchaseOrderStatus;
|
|
606
|
+
expected_delivery: string | null;
|
|
607
|
+
warehouse_id: string;
|
|
608
|
+
currency_code: string;
|
|
609
|
+
notes: string | null;
|
|
610
|
+
notes_ar: string | null;
|
|
611
|
+
approved_at: string | null;
|
|
612
|
+
created_at: string | null;
|
|
613
|
+
updated_at: string | null;
|
|
614
|
+
lines: PurchaseOrderLine[];
|
|
615
|
+
warehouse?: StockWarehouseRef;
|
|
616
|
+
}
|
|
617
|
+
export interface CreatePurchaseOrderLineInput {
|
|
618
|
+
item_id: string;
|
|
619
|
+
quantity_ordered: number | string;
|
|
620
|
+
unit_cost: number | string;
|
|
621
|
+
unit_of_measure?: string | null;
|
|
622
|
+
notes?: string | null;
|
|
623
|
+
}
|
|
624
|
+
export interface CreatePurchaseOrderInput {
|
|
625
|
+
warehouse_id: string;
|
|
626
|
+
supplier_id?: string | null;
|
|
627
|
+
currency_code?: string;
|
|
628
|
+
expected_delivery?: string | null;
|
|
629
|
+
notes?: string | null;
|
|
630
|
+
notes_ar?: string | null;
|
|
631
|
+
lines: CreatePurchaseOrderLineInput[];
|
|
632
|
+
}
|
|
633
|
+
export interface UpdatePurchaseOrderInput {
|
|
634
|
+
supplier_id?: string | null;
|
|
635
|
+
currency_code?: string;
|
|
636
|
+
expected_delivery?: string | null;
|
|
637
|
+
notes?: string | null;
|
|
638
|
+
notes_ar?: string | null;
|
|
639
|
+
lines?: CreatePurchaseOrderLineInput[];
|
|
640
|
+
}
|
|
641
|
+
export interface PurchaseOrderListQuery extends ListQuery {
|
|
642
|
+
status?: PurchaseOrderStatus;
|
|
643
|
+
search?: string;
|
|
644
|
+
date_from?: string;
|
|
645
|
+
date_to?: string;
|
|
646
|
+
}
|
|
647
|
+
/** One line of a goods receipt against an approved PO. Unit cost is taken from the PO line. */
|
|
648
|
+
export interface ReceivePurchaseOrderLineInput {
|
|
649
|
+
/** The `purchase_order_lines.id` being received against. */
|
|
650
|
+
po_line_id: string;
|
|
651
|
+
/** Quantity received on this receipt (bcmath decimal string or number). */
|
|
652
|
+
quantity: number | string;
|
|
653
|
+
/** Required when the item is batch-tracked. */
|
|
654
|
+
batch_number?: string | null;
|
|
655
|
+
/** Required when the item requires GS1 serialization. */
|
|
656
|
+
gtin?: string | null;
|
|
657
|
+
/** Required when the item is expiry-tracked (ISO date). */
|
|
658
|
+
expiry_date?: string | null;
|
|
659
|
+
/** Required, one per unit, when the item is serial-tracked. */
|
|
660
|
+
serial_numbers?: string[] | null;
|
|
661
|
+
/** Optional destination bin/location within the PO warehouse. */
|
|
662
|
+
location_id?: string | null;
|
|
663
|
+
}
|
|
664
|
+
export interface ReceivePurchaseOrderInput {
|
|
665
|
+
lines: ReceivePurchaseOrderLineInput[];
|
|
666
|
+
/** Supervisor override authorising the middle over-receipt tolerance band. */
|
|
667
|
+
allow_over_receipt?: boolean;
|
|
668
|
+
}
|
|
669
|
+
export declare function createInventoryNamespace(http: Http): {
|
|
670
|
+
items: {
|
|
671
|
+
/** GET /api/inventory/items — paginated `{data, meta}`. */
|
|
672
|
+
list: (query?: ItemListQuery) => Promise<Paginated<InventoryItem>>;
|
|
673
|
+
/** GET /api/inventory/items/{id} */
|
|
674
|
+
get: (id: string) => Promise<InventoryItem>;
|
|
675
|
+
/** POST /api/inventory/items */
|
|
676
|
+
create: (input: CreateItemInput) => Promise<InventoryItem>;
|
|
677
|
+
/** PUT /api/inventory/items/{id} */
|
|
678
|
+
update: (id: string, input: UpdateItemInput) => Promise<InventoryItem>;
|
|
679
|
+
/** POST /api/inventory/items/{id}/archive — 204. */
|
|
680
|
+
archive: (id: string) => Promise<void>;
|
|
681
|
+
/** POST /api/inventory/items/{id}/restore */
|
|
682
|
+
restore: (id: string) => Promise<InventoryItem>;
|
|
683
|
+
/** GET /api/inventory/items/{id}/variants — bare array. */
|
|
684
|
+
variants: (id: string) => Promise<InventoryItem[]>;
|
|
685
|
+
};
|
|
686
|
+
stock: {
|
|
687
|
+
/** GET /api/inventory/stock/levels — paginated `{data, meta}`. */
|
|
688
|
+
levels: (query?: StockLevelQuery) => Promise<Paginated<StockLevel>>;
|
|
689
|
+
/** GET /api/inventory/stock/movements — paginated `{data, meta}`. */
|
|
690
|
+
movements: (query?: StockMovementQuery) => Promise<Paginated<StockMovement>>;
|
|
691
|
+
};
|
|
692
|
+
warehouses: {
|
|
693
|
+
/** GET /api/inventory/warehouses — paginated `{data, meta}`. */
|
|
694
|
+
list: (query?: ListQuery) => Promise<Paginated<Warehouse>>;
|
|
695
|
+
/** GET /api/inventory/warehouses/{id} */
|
|
696
|
+
get: (id: string) => Promise<Warehouse>;
|
|
697
|
+
/** POST /api/inventory/warehouses */
|
|
698
|
+
create: (input: CreateWarehouseInput) => Promise<Warehouse>;
|
|
699
|
+
/** PUT /api/inventory/warehouses/{id} */
|
|
700
|
+
update: (id: string, input: UpdateWarehouseInput) => Promise<Warehouse>;
|
|
701
|
+
/**
|
|
702
|
+
* GET /api/inventory/warehouses/{id}/bins — bare tree array of ROOT
|
|
703
|
+
* bins, each carrying `childrenRecursive`.
|
|
704
|
+
*/
|
|
705
|
+
bins: (id: string) => Promise<WarehouseBin[]>;
|
|
706
|
+
/** POST /api/inventory/warehouses/{id}/bins */
|
|
707
|
+
createBin: (warehouseId: string, input: CreateBinInput) => Promise<WarehouseBin>;
|
|
708
|
+
/** PUT /api/inventory/warehouses/{id}/bins/{binId} */
|
|
709
|
+
updateBin: (warehouseId: string, binId: string, input: UpdateBinInput) => Promise<WarehouseBin>;
|
|
710
|
+
};
|
|
711
|
+
uom: {
|
|
712
|
+
/** GET /api/inventory/uom — `{uoms, conversions}`, NOT paginated. */
|
|
713
|
+
list: () => Promise<UomIndex>;
|
|
714
|
+
/** POST /api/inventory/uom */
|
|
715
|
+
create: (input: CreateUomInput) => Promise<UnitOfMeasure>;
|
|
716
|
+
/** PUT /api/inventory/uom/{id} */
|
|
717
|
+
update: (id: string, input: UpdateUomInput) => Promise<UnitOfMeasure>;
|
|
718
|
+
/** POST /api/inventory/uom/conversions — returns it with both units loaded. */
|
|
719
|
+
createConversion: (input: CreateUomConversionInput) => Promise<UomConversion>;
|
|
720
|
+
/** DELETE /api/inventory/uom/conversions/{id} — 204. */
|
|
721
|
+
removeConversion: (id: string) => Promise<void>;
|
|
722
|
+
};
|
|
723
|
+
categories: {
|
|
724
|
+
/** GET /api/inventory/categories — bare tree array (no envelope). */
|
|
725
|
+
list: () => Promise<ItemCategory[]>;
|
|
726
|
+
/** POST /api/inventory/categories */
|
|
727
|
+
create: (input: CreateCategoryInput) => Promise<ItemCategory>;
|
|
728
|
+
/** PUT /api/inventory/categories/{id} */
|
|
729
|
+
update: (id: string, input: UpdateCategoryInput) => Promise<ItemCategory>;
|
|
730
|
+
};
|
|
731
|
+
adjustments: {
|
|
732
|
+
/** GET /api/inventory/adjustments — paginated `{data, meta}`. */
|
|
733
|
+
list: (query?: AdjustmentListQuery) => Promise<Paginated<AdjustmentListItem>>;
|
|
734
|
+
/** GET /api/inventory/adjustments/{uuid} */
|
|
735
|
+
get: (uuid: string) => Promise<AdjustmentDetail>;
|
|
736
|
+
/** POST /api/inventory/adjustments — returns `{ uuid }`. */
|
|
737
|
+
create: (input: CreateAdjustmentInput) => Promise<AdjustmentRef>;
|
|
738
|
+
/** PUT /api/inventory/adjustments/{uuid} — returns `{ uuid }`. */
|
|
739
|
+
update: (uuid: string, input: UpdateAdjustmentInput) => Promise<AdjustmentRef>;
|
|
740
|
+
/** DELETE /api/inventory/adjustments/{uuid} — 204. */
|
|
741
|
+
remove: (uuid: string) => Promise<void>;
|
|
742
|
+
/** POST /api/inventory/adjustments/{uuid}/start-counting */
|
|
743
|
+
startCounting: (uuid: string) => Promise<{
|
|
744
|
+
status: AdjustmentStatus;
|
|
745
|
+
}>;
|
|
746
|
+
/** POST /api/inventory/adjustments/{uuid}/submit-for-review */
|
|
747
|
+
submitForReview: (uuid: string) => Promise<{
|
|
748
|
+
status: AdjustmentStatus;
|
|
749
|
+
}>;
|
|
750
|
+
/** POST /api/inventory/adjustments/{uuid}/send-back-to-counting */
|
|
751
|
+
sendBackToCounting: (uuid: string) => Promise<{
|
|
752
|
+
status: AdjustmentStatus;
|
|
753
|
+
}>;
|
|
754
|
+
/** POST /api/inventory/adjustments/{uuid}/approve */
|
|
755
|
+
approve: (uuid: string) => Promise<{
|
|
756
|
+
status: AdjustmentStatus;
|
|
757
|
+
}>;
|
|
758
|
+
/** POST /api/inventory/adjustments/{uuid}/post */
|
|
759
|
+
post: (uuid: string) => Promise<{
|
|
760
|
+
status: AdjustmentStatus;
|
|
761
|
+
total_variance_value: string;
|
|
762
|
+
}>;
|
|
763
|
+
/** POST /api/inventory/adjustments/{uuid}/cancel */
|
|
764
|
+
cancel: (uuid: string) => Promise<{
|
|
765
|
+
status: AdjustmentStatus;
|
|
766
|
+
}>;
|
|
767
|
+
};
|
|
768
|
+
transfers: {
|
|
769
|
+
/** GET /api/inventory/transfers — paginated `{data, meta}`. */
|
|
770
|
+
list: (query?: TransferListQuery) => Promise<Paginated<TransferListItem>>;
|
|
771
|
+
/** GET /api/inventory/transfers/{uuid} */
|
|
772
|
+
get: (uuid: string) => Promise<TransferDetail>;
|
|
773
|
+
/** POST /api/inventory/transfers — returns `{ uuid }`; starts `draft`. */
|
|
774
|
+
create: (input: CreateTransferInput) => Promise<TransferRef>;
|
|
775
|
+
/** PUT /api/inventory/transfers/{uuid} — DRAFT ONLY (422 otherwise). */
|
|
776
|
+
update: (uuid: string, input: UpdateTransferInput) => Promise<TransferRef>;
|
|
777
|
+
/** DELETE /api/inventory/transfers/{uuid} — DRAFT ONLY; 204. */
|
|
778
|
+
remove: (uuid: string) => Promise<void>;
|
|
779
|
+
/** POST /api/inventory/transfers/{uuid}/ship — deducts source stock. */
|
|
780
|
+
ship: (uuid: string) => Promise<{
|
|
781
|
+
status: TransferStatus;
|
|
782
|
+
}>;
|
|
783
|
+
/** POST /api/inventory/transfers/{uuid}/receive — credits destination stock. */
|
|
784
|
+
receive: (uuid: string) => Promise<{
|
|
785
|
+
status: TransferStatus;
|
|
786
|
+
}>;
|
|
787
|
+
/** POST /api/inventory/transfers/{uuid}/cancel */
|
|
788
|
+
cancel: (uuid: string) => Promise<{
|
|
789
|
+
status: TransferStatus;
|
|
790
|
+
}>;
|
|
791
|
+
};
|
|
792
|
+
goodsReceipts: {
|
|
793
|
+
list: (query?: InventoryGoodsReceiptListQuery) => Promise<Paginated<InventoryGoodsReceiptListItem>>;
|
|
794
|
+
get: (uuid: string) => Promise<InventoryGoodsReceipt>;
|
|
795
|
+
};
|
|
796
|
+
};
|
|
797
|
+
export type InventoryNamespace = ReturnType<typeof createInventoryNamespace>;
|