feeef 0.10.0 → 0.11.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/build/index.js +640 -2
- package/build/index.js.map +1 -1
- package/build/src/core/batch.d.ts +63 -0
- package/build/src/core/entities/finance.d.ts +355 -0
- package/build/src/core/entities/inventory.d.ts +80 -0
- package/build/src/core/entities/store.d.ts +83 -0
- package/build/src/feeef/feeef.d.ts +10 -0
- package/build/src/feeef/repositories/finance.d.ts +156 -0
- package/build/src/feeef/repositories/inventory.d.ts +159 -0
- package/build/src/feeef/repositories/orders.d.ts +16 -0
- package/build/src/feeef/repositories/repository.d.ts +34 -0
- package/build/src/feeef/repositories/transfers.d.ts +1 -1
- package/build/src/feeef/services/integrations.d.ts +16 -0
- package/build/src/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for AIP-style batch operations (`:batchDelete`, `:batchUpdate`, …).
|
|
3
|
+
*
|
|
4
|
+
* Repositories override {@link ModelRepository.deleteMany} / `updateMany` / `createMany`
|
|
5
|
+
* when the API supports them. HTTP 200 does not mean all items succeeded — always
|
|
6
|
+
* inspect `summary` and `failedRequests`.
|
|
7
|
+
*/
|
|
8
|
+
export interface BatchRpcStatus {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
details?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface BatchSummary {
|
|
14
|
+
total: number;
|
|
15
|
+
succeeded: number;
|
|
16
|
+
failed: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function batchSummaryHasFailures(summary: BatchSummary): boolean;
|
|
19
|
+
export declare function batchSummaryAllFailed(summary: BatchSummary): boolean;
|
|
20
|
+
export interface BatchResult<T = void> {
|
|
21
|
+
resources?: T[];
|
|
22
|
+
failedRequests: Record<string, BatchRpcStatus>;
|
|
23
|
+
summary: BatchSummary;
|
|
24
|
+
code?: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BatchDeleteRequest {
|
|
28
|
+
projectId: string;
|
|
29
|
+
names: string[];
|
|
30
|
+
returnPartialSuccess?: boolean;
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface BatchUpdateManyRequest {
|
|
34
|
+
projectId: string;
|
|
35
|
+
names: string[];
|
|
36
|
+
updateMask: string[];
|
|
37
|
+
returnPartialSuccess?: boolean;
|
|
38
|
+
requestId?: string;
|
|
39
|
+
/** Hoisted patch fields (storageClass, warehouseId, …). */
|
|
40
|
+
fields?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface BatchCreateManyRequest {
|
|
43
|
+
projectId: string;
|
|
44
|
+
items: Record<string, unknown>[];
|
|
45
|
+
returnPartialSuccess?: boolean;
|
|
46
|
+
requestId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface BatchReleaseRequest {
|
|
49
|
+
projectId: string;
|
|
50
|
+
names: string[];
|
|
51
|
+
returnPartialSuccess?: boolean;
|
|
52
|
+
requestId?: string;
|
|
53
|
+
toJson?(): Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export declare function parseBatchRpcStatus(json: Record<string, unknown>): BatchRpcStatus;
|
|
56
|
+
export declare function parseBatchSummary(json: Record<string, unknown>): BatchSummary;
|
|
57
|
+
/**
|
|
58
|
+
* Parses batch API response from success or 400 ABORTED body.
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseBatchResult<T = void>(data: unknown, resourceFromJson?: (json: Record<string, unknown>) => T): BatchResult<T>;
|
|
61
|
+
export declare function batchDeleteBody(request: BatchDeleteRequest): Record<string, unknown>;
|
|
62
|
+
export declare function batchUpdateManyBody(request: BatchUpdateManyRequest): Record<string, unknown>;
|
|
63
|
+
export declare function batchReleaseBody(request: BatchReleaseRequest): Record<string, unknown>;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finance module entities (Phase 1: procurement). Project-scoped, mirroring the
|
|
3
|
+
* backend Lucid models. Money values are returned as numbers (decimal(14,2)).
|
|
4
|
+
*/
|
|
5
|
+
export type PurchaseOrderStatus = 'draft' | 'sent' | 'partial' | 'received' | 'cancelled';
|
|
6
|
+
export type PurchaseReceiptStatus = 'draft' | 'posted' | 'voided';
|
|
7
|
+
export interface Supplier {
|
|
8
|
+
id: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code?: string | null;
|
|
12
|
+
phone?: string | null;
|
|
13
|
+
email?: string | null;
|
|
14
|
+
taxId?: string | null;
|
|
15
|
+
address?: Record<string, any> | null;
|
|
16
|
+
paymentTerms?: string | null;
|
|
17
|
+
metadata?: Record<string, any>;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
deletedAt?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateSupplierInput {
|
|
23
|
+
projectId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
code?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
taxId?: string;
|
|
29
|
+
address?: Record<string, any>;
|
|
30
|
+
paymentTerms?: string;
|
|
31
|
+
metadata?: Record<string, any>;
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateSupplierInput {
|
|
34
|
+
name?: string;
|
|
35
|
+
code?: string | null;
|
|
36
|
+
phone?: string | null;
|
|
37
|
+
email?: string | null;
|
|
38
|
+
taxId?: string | null;
|
|
39
|
+
address?: Record<string, any> | null;
|
|
40
|
+
paymentTerms?: string | null;
|
|
41
|
+
metadata?: Record<string, any>;
|
|
42
|
+
}
|
|
43
|
+
export interface PurchaseOrderItem {
|
|
44
|
+
sku: string;
|
|
45
|
+
productId?: string | null;
|
|
46
|
+
variantPath?: string;
|
|
47
|
+
qtyOrdered: number;
|
|
48
|
+
qtyReceived?: number;
|
|
49
|
+
unitCost: number;
|
|
50
|
+
warehouseId?: string | null;
|
|
51
|
+
batch?: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface PurchaseOrder {
|
|
54
|
+
id: string;
|
|
55
|
+
projectId: string;
|
|
56
|
+
supplierId: string;
|
|
57
|
+
status: PurchaseOrderStatus;
|
|
58
|
+
reference?: string | null;
|
|
59
|
+
expectedAt?: string | null;
|
|
60
|
+
notes?: string | null;
|
|
61
|
+
items: PurchaseOrderItem[];
|
|
62
|
+
currency?: string | null;
|
|
63
|
+
subtotal: number;
|
|
64
|
+
createdByUserId?: string | null;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
export interface CreatePurchaseOrderInput {
|
|
69
|
+
projectId: string;
|
|
70
|
+
supplierId: string;
|
|
71
|
+
reference?: string;
|
|
72
|
+
expectedAt?: string;
|
|
73
|
+
notes?: string;
|
|
74
|
+
items?: PurchaseOrderItem[];
|
|
75
|
+
currency?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface UpdatePurchaseOrderInput {
|
|
78
|
+
reference?: string | null;
|
|
79
|
+
expectedAt?: string | null;
|
|
80
|
+
notes?: string | null;
|
|
81
|
+
items?: PurchaseOrderItem[];
|
|
82
|
+
currency?: string | null;
|
|
83
|
+
}
|
|
84
|
+
export interface PurchaseReceiptLine {
|
|
85
|
+
id: string;
|
|
86
|
+
purchaseReceiptId: string;
|
|
87
|
+
lineNo: number;
|
|
88
|
+
sku: string;
|
|
89
|
+
productId?: string | null;
|
|
90
|
+
variantPath: string;
|
|
91
|
+
batch: string;
|
|
92
|
+
inventoryObjectId?: string | null;
|
|
93
|
+
qtyReceived: number;
|
|
94
|
+
unitCost: number;
|
|
95
|
+
lineTotal: number;
|
|
96
|
+
poLineIndex?: number | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
}
|
|
99
|
+
export interface PurchaseReceipt {
|
|
100
|
+
id: string;
|
|
101
|
+
projectId: string;
|
|
102
|
+
supplierId: string;
|
|
103
|
+
purchaseOrderId?: string | null;
|
|
104
|
+
warehouseId?: string | null;
|
|
105
|
+
status: PurchaseReceiptStatus;
|
|
106
|
+
reference?: string | null;
|
|
107
|
+
receivedAt: string;
|
|
108
|
+
postedAt?: string | null;
|
|
109
|
+
voidedAt?: string | null;
|
|
110
|
+
notes?: string | null;
|
|
111
|
+
totalCost: number;
|
|
112
|
+
isPosted?: boolean;
|
|
113
|
+
createdByUserId?: string | null;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
lines?: PurchaseReceiptLine[];
|
|
117
|
+
}
|
|
118
|
+
export interface PurchaseReceiptLineInput {
|
|
119
|
+
sku: string;
|
|
120
|
+
productId?: string | null;
|
|
121
|
+
variantPath?: string;
|
|
122
|
+
batch?: string | null;
|
|
123
|
+
qtyReceived: number;
|
|
124
|
+
unitCost: number;
|
|
125
|
+
poLineIndex?: number | null;
|
|
126
|
+
}
|
|
127
|
+
export interface CreatePurchaseReceiptInput {
|
|
128
|
+
projectId: string;
|
|
129
|
+
supplierId: string;
|
|
130
|
+
purchaseOrderId?: string | null;
|
|
131
|
+
warehouseId?: string | null;
|
|
132
|
+
reference?: string;
|
|
133
|
+
receivedAt?: string;
|
|
134
|
+
notes?: string;
|
|
135
|
+
lines: PurchaseReceiptLineInput[];
|
|
136
|
+
}
|
|
137
|
+
export type FinancialAccountType = 'cash' | 'bank' | 'ewallet';
|
|
138
|
+
export type SupplierBillStatus = 'draft' | 'open' | 'partial' | 'paid' | 'void';
|
|
139
|
+
export type ExpenseStatus = 'draft' | 'recorded' | 'voided';
|
|
140
|
+
export interface FinancialAccount {
|
|
141
|
+
id: string;
|
|
142
|
+
projectId: string;
|
|
143
|
+
name: string;
|
|
144
|
+
type: FinancialAccountType;
|
|
145
|
+
currency?: string | null;
|
|
146
|
+
openingBalance: number;
|
|
147
|
+
isDefault: boolean;
|
|
148
|
+
metadata?: Record<string, any>;
|
|
149
|
+
/** Present on `show` (derived). */
|
|
150
|
+
balance?: number;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
deletedAt?: string | null;
|
|
154
|
+
}
|
|
155
|
+
export interface CreateFinancialAccountInput {
|
|
156
|
+
projectId: string;
|
|
157
|
+
name: string;
|
|
158
|
+
type?: FinancialAccountType;
|
|
159
|
+
currency?: string;
|
|
160
|
+
openingBalance?: number;
|
|
161
|
+
isDefault?: boolean;
|
|
162
|
+
metadata?: Record<string, any>;
|
|
163
|
+
}
|
|
164
|
+
export interface UpdateFinancialAccountInput {
|
|
165
|
+
name?: string;
|
|
166
|
+
type?: FinancialAccountType;
|
|
167
|
+
currency?: string | null;
|
|
168
|
+
openingBalance?: number;
|
|
169
|
+
isDefault?: boolean;
|
|
170
|
+
metadata?: Record<string, any>;
|
|
171
|
+
}
|
|
172
|
+
export interface SupplierBill {
|
|
173
|
+
id: string;
|
|
174
|
+
projectId: string;
|
|
175
|
+
supplierId: string;
|
|
176
|
+
purchaseReceiptId?: string | null;
|
|
177
|
+
reference?: string | null;
|
|
178
|
+
billDate: string;
|
|
179
|
+
dueDate?: string | null;
|
|
180
|
+
currency?: string | null;
|
|
181
|
+
totalAmount: number;
|
|
182
|
+
paidAmount: number;
|
|
183
|
+
balanceDue?: number;
|
|
184
|
+
status: SupplierBillStatus;
|
|
185
|
+
notes?: string | null;
|
|
186
|
+
createdByUserId?: string | null;
|
|
187
|
+
createdAt: string;
|
|
188
|
+
updatedAt: string;
|
|
189
|
+
payments?: SupplierPayment[];
|
|
190
|
+
}
|
|
191
|
+
export interface CreateSupplierBillInput {
|
|
192
|
+
projectId: string;
|
|
193
|
+
supplierId: string;
|
|
194
|
+
purchaseReceiptId?: string | null;
|
|
195
|
+
reference?: string;
|
|
196
|
+
billDate: string;
|
|
197
|
+
dueDate?: string | null;
|
|
198
|
+
currency?: string;
|
|
199
|
+
totalAmount: number;
|
|
200
|
+
notes?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface SupplierPayment {
|
|
203
|
+
id: string;
|
|
204
|
+
projectId: string;
|
|
205
|
+
supplierBillId: string;
|
|
206
|
+
financialAccountId: string;
|
|
207
|
+
amount: number;
|
|
208
|
+
paidAt: string;
|
|
209
|
+
method?: string | null;
|
|
210
|
+
reference?: string | null;
|
|
211
|
+
createdByUserId?: string | null;
|
|
212
|
+
createdAt: string;
|
|
213
|
+
updatedAt: string;
|
|
214
|
+
}
|
|
215
|
+
export interface PaySupplierBillInput {
|
|
216
|
+
projectId: string;
|
|
217
|
+
financialAccountId: string;
|
|
218
|
+
amount: number;
|
|
219
|
+
paidAt?: string | null;
|
|
220
|
+
method?: string | null;
|
|
221
|
+
reference?: string | null;
|
|
222
|
+
allowOverpay?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface CustomerPayment {
|
|
225
|
+
id: string;
|
|
226
|
+
projectId: string;
|
|
227
|
+
orderId: string;
|
|
228
|
+
financialAccountId: string;
|
|
229
|
+
amount: number;
|
|
230
|
+
receivedAt: string;
|
|
231
|
+
method?: string | null;
|
|
232
|
+
reference?: string | null;
|
|
233
|
+
createdByUserId?: string | null;
|
|
234
|
+
createdAt: string;
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
}
|
|
237
|
+
export interface CollectCustomerPaymentInput {
|
|
238
|
+
projectId: string;
|
|
239
|
+
financialAccountId: string;
|
|
240
|
+
amount: number;
|
|
241
|
+
receivedAt?: string | null;
|
|
242
|
+
method?: string | null;
|
|
243
|
+
reference?: string | null;
|
|
244
|
+
allowOverpay?: boolean;
|
|
245
|
+
}
|
|
246
|
+
export interface Receivable {
|
|
247
|
+
orderId: string;
|
|
248
|
+
storeId: string;
|
|
249
|
+
total: number;
|
|
250
|
+
paid: number;
|
|
251
|
+
balanceDue: number;
|
|
252
|
+
status: string;
|
|
253
|
+
deliveryStatus: string;
|
|
254
|
+
codInTransit: boolean;
|
|
255
|
+
}
|
|
256
|
+
export interface ExpenseCategory {
|
|
257
|
+
id: string;
|
|
258
|
+
projectId: string;
|
|
259
|
+
name: string;
|
|
260
|
+
parentId?: string | null;
|
|
261
|
+
metadata?: Record<string, any>;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
deletedAt?: string | null;
|
|
265
|
+
}
|
|
266
|
+
export interface CreateExpenseCategoryInput {
|
|
267
|
+
projectId: string;
|
|
268
|
+
name: string;
|
|
269
|
+
parentId?: string | null;
|
|
270
|
+
metadata?: Record<string, any>;
|
|
271
|
+
}
|
|
272
|
+
export interface UpdateExpenseCategoryInput {
|
|
273
|
+
name?: string;
|
|
274
|
+
parentId?: string | null;
|
|
275
|
+
metadata?: Record<string, any>;
|
|
276
|
+
}
|
|
277
|
+
export interface Expense {
|
|
278
|
+
id: string;
|
|
279
|
+
projectId: string;
|
|
280
|
+
categoryId?: string | null;
|
|
281
|
+
supplierId?: string | null;
|
|
282
|
+
financialAccountId?: string | null;
|
|
283
|
+
amount: number;
|
|
284
|
+
currency?: string | null;
|
|
285
|
+
spentAt: string;
|
|
286
|
+
paymentMethod?: string | null;
|
|
287
|
+
status: ExpenseStatus;
|
|
288
|
+
reference?: string | null;
|
|
289
|
+
note?: string | null;
|
|
290
|
+
attachments: any[];
|
|
291
|
+
createdByUserId?: string | null;
|
|
292
|
+
createdAt: string;
|
|
293
|
+
updatedAt: string;
|
|
294
|
+
deletedAt?: string | null;
|
|
295
|
+
}
|
|
296
|
+
export interface CreateExpenseInput {
|
|
297
|
+
projectId: string;
|
|
298
|
+
categoryId?: string | null;
|
|
299
|
+
supplierId?: string | null;
|
|
300
|
+
financialAccountId?: string | null;
|
|
301
|
+
amount: number;
|
|
302
|
+
currency?: string;
|
|
303
|
+
spentAt: string;
|
|
304
|
+
paymentMethod?: string | null;
|
|
305
|
+
status?: ExpenseStatus;
|
|
306
|
+
reference?: string | null;
|
|
307
|
+
note?: string | null;
|
|
308
|
+
attachments?: any[];
|
|
309
|
+
}
|
|
310
|
+
export interface UpdateExpenseInput {
|
|
311
|
+
categoryId?: string | null;
|
|
312
|
+
supplierId?: string | null;
|
|
313
|
+
financialAccountId?: string | null;
|
|
314
|
+
amount?: number;
|
|
315
|
+
currency?: string | null;
|
|
316
|
+
spentAt?: string;
|
|
317
|
+
paymentMethod?: string | null;
|
|
318
|
+
status?: ExpenseStatus;
|
|
319
|
+
reference?: string | null;
|
|
320
|
+
note?: string | null;
|
|
321
|
+
attachments?: any[];
|
|
322
|
+
}
|
|
323
|
+
export interface FinanceOverview {
|
|
324
|
+
cash: number;
|
|
325
|
+
inventoryValuation: number;
|
|
326
|
+
accountsReceivable: number;
|
|
327
|
+
accountsPayable: number;
|
|
328
|
+
netPosition: number;
|
|
329
|
+
}
|
|
330
|
+
export interface AgingResult {
|
|
331
|
+
buckets: {
|
|
332
|
+
label: string;
|
|
333
|
+
amount: number;
|
|
334
|
+
}[];
|
|
335
|
+
total: number;
|
|
336
|
+
}
|
|
337
|
+
export interface CashPosition {
|
|
338
|
+
accounts: {
|
|
339
|
+
id: string;
|
|
340
|
+
name: string;
|
|
341
|
+
type: FinancialAccountType;
|
|
342
|
+
currency?: string | null;
|
|
343
|
+
balance: number;
|
|
344
|
+
}[];
|
|
345
|
+
total: number;
|
|
346
|
+
}
|
|
347
|
+
export interface PnlReport {
|
|
348
|
+
from: string | null;
|
|
349
|
+
to: string | null;
|
|
350
|
+
revenue: number;
|
|
351
|
+
cogs: number;
|
|
352
|
+
grossProfit: number;
|
|
353
|
+
expenses: number;
|
|
354
|
+
netProfit: number;
|
|
355
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface Project {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface InventoryWarehouse {
|
|
8
|
+
id: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InventoryObject {
|
|
17
|
+
id: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
namespace: string;
|
|
20
|
+
sku: string;
|
|
21
|
+
batch: string;
|
|
22
|
+
warehouseId?: string;
|
|
23
|
+
storageClass: string;
|
|
24
|
+
key: string;
|
|
25
|
+
quantityOnHand: number;
|
|
26
|
+
quantityReserved: number;
|
|
27
|
+
quantityAvailable: number;
|
|
28
|
+
receivedAt: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface InventoryMovement {
|
|
34
|
+
id: string;
|
|
35
|
+
projectId: string;
|
|
36
|
+
objectId: string;
|
|
37
|
+
type: 'in' | 'out' | 'adjust' | 'reserve' | 'release' | 'consume';
|
|
38
|
+
quantityDelta: number;
|
|
39
|
+
balanceAfter: number;
|
|
40
|
+
reason?: string;
|
|
41
|
+
correlationRef?: string;
|
|
42
|
+
metadata?: Record<string, any>;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface InventoryReservation {
|
|
46
|
+
id: string;
|
|
47
|
+
projectId: string;
|
|
48
|
+
holderRef: string;
|
|
49
|
+
metadata?: Record<string, any>;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
expiresAt?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface InventoryAlias {
|
|
54
|
+
id: string;
|
|
55
|
+
projectId: string;
|
|
56
|
+
namespace: string;
|
|
57
|
+
sku: string;
|
|
58
|
+
alias: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
}
|
|
61
|
+
export interface InventoryReceiveInput {
|
|
62
|
+
projectId: string;
|
|
63
|
+
namespace: string;
|
|
64
|
+
sku: string;
|
|
65
|
+
batch?: string;
|
|
66
|
+
quantity: number;
|
|
67
|
+
warehouseId?: string;
|
|
68
|
+
storageClass?: string;
|
|
69
|
+
metadata?: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
export interface InventoryDeltaInput {
|
|
72
|
+
objectId: string;
|
|
73
|
+
quantityDelta: number;
|
|
74
|
+
}
|
|
75
|
+
export interface InventoryApplyDeltasInput {
|
|
76
|
+
projectId: string;
|
|
77
|
+
deltas: InventoryDeltaInput[];
|
|
78
|
+
reason: string;
|
|
79
|
+
correlationRef?: string;
|
|
80
|
+
}
|
|
@@ -45,6 +45,8 @@ export interface StoreEntity {
|
|
|
45
45
|
members?: Record<string, StoreMember>;
|
|
46
46
|
/** Active full-site template (`store_templates.id`) when set. */
|
|
47
47
|
templateId?: string | null;
|
|
48
|
+
/** Linked inventory project ID for stock management. */
|
|
49
|
+
projectId?: string | null;
|
|
48
50
|
}
|
|
49
51
|
export declare const generatePublicStoreIntegrations: (integrations: StoreIntegrations | null | undefined) => PublicStoreIntegrations | null;
|
|
50
52
|
export declare const generatePublicStoreIntegrationCustomFields: (customFields: any | null | undefined) => PublicCustomFieldsIntegration | null | undefined;
|
|
@@ -247,6 +249,51 @@ export interface CreateStoreInviteInput {
|
|
|
247
249
|
expiresAt?: string;
|
|
248
250
|
metadata?: Record<string, any>;
|
|
249
251
|
}
|
|
252
|
+
/** How order sync handles line items with no inventory bucket for their SKU. */
|
|
253
|
+
export type MissingInventoryBucketPolicy = 'ignore' | 'reject';
|
|
254
|
+
/** When an order field equals `equals`, apply the parent lifecycle list (reserve / release / consume). */
|
|
255
|
+
export interface InventoryLifecycleRule {
|
|
256
|
+
id: string;
|
|
257
|
+
dimension: PixelStatusDimension;
|
|
258
|
+
equals: string;
|
|
259
|
+
}
|
|
260
|
+
export interface InventoryIntegration {
|
|
261
|
+
reserve_on: OrderStatus[];
|
|
262
|
+
unreserve_on: OrderStatus[];
|
|
263
|
+
consume_on: OrderStatus[];
|
|
264
|
+
reserve_rules?: InventoryLifecycleRule[];
|
|
265
|
+
unreserve_rules?: InventoryLifecycleRule[];
|
|
266
|
+
consume_rules?: InventoryLifecycleRule[];
|
|
267
|
+
/**
|
|
268
|
+
* `ignore` — skip untracked SKUs and continue the order save.
|
|
269
|
+
* `reject` — block the order with a stock validation error.
|
|
270
|
+
* @default ignore
|
|
271
|
+
*/
|
|
272
|
+
missing_bucket_policy?: MissingInventoryBucketPolicy;
|
|
273
|
+
}
|
|
274
|
+
export type FinancePdfPaperSize = 'a4' | 'letter' | 'a5' | 'legal';
|
|
275
|
+
/** Layout and content options for finance PDF documents. */
|
|
276
|
+
export interface FinancePdfSettings {
|
|
277
|
+
paperSize: FinancePdfPaperSize;
|
|
278
|
+
showQrCode: boolean;
|
|
279
|
+
showLogo: boolean;
|
|
280
|
+
showStoreContact: boolean;
|
|
281
|
+
showSupplierDetails: boolean;
|
|
282
|
+
showDocumentId: boolean;
|
|
283
|
+
showFooter: boolean;
|
|
284
|
+
showStatusBadge: boolean;
|
|
285
|
+
showSignatureLines: boolean;
|
|
286
|
+
showPaymentHistory: boolean;
|
|
287
|
+
footerNote: string;
|
|
288
|
+
}
|
|
289
|
+
/** Order → finance behavior: when revenue/COGS are recognized for an order. */
|
|
290
|
+
export interface FinanceIntegration {
|
|
291
|
+
/** Order statuses at which revenue + COGS are recognized (receivable opens). */
|
|
292
|
+
recognize_on: OrderStatus[];
|
|
293
|
+
/** Cash-basis metrics cutoff — payments/expenses before this are ignored. */
|
|
294
|
+
activated_at?: string | null;
|
|
295
|
+
pdf?: FinancePdfSettings;
|
|
296
|
+
}
|
|
250
297
|
export interface StoreConfigs {
|
|
251
298
|
currencies: StoreCurrencyConfig[];
|
|
252
299
|
selectedCurrency: string;
|
|
@@ -257,6 +304,8 @@ export interface StoreConfigs {
|
|
|
257
304
|
customStatusMappings?: CustomStatusMapping[];
|
|
258
305
|
/** Feature flag to enable custom statuses across the app */
|
|
259
306
|
customStatusEnabled?: boolean;
|
|
307
|
+
inventory_integration?: InventoryIntegration;
|
|
308
|
+
finance_integration?: FinanceIntegration;
|
|
260
309
|
}
|
|
261
310
|
export interface CustomStatusMapping {
|
|
262
311
|
/** The custom status name (e.g., "not_respond", "phone_closed_1") */
|
|
@@ -734,6 +783,18 @@ export interface StoreIntegrations {
|
|
|
734
783
|
mdmExpress?: MdmExpressIntegration;
|
|
735
784
|
security?: SecurityIntegration;
|
|
736
785
|
dispatcher?: DispatcherIntegration;
|
|
786
|
+
inventory?: StoreInventoryIntegration;
|
|
787
|
+
finance?: StoreFinanceIntegration;
|
|
788
|
+
}
|
|
789
|
+
/** Marketplace inventory module (billing + active toggle). */
|
|
790
|
+
export interface StoreInventoryIntegration {
|
|
791
|
+
active: boolean;
|
|
792
|
+
metadata?: Record<string, any>;
|
|
793
|
+
}
|
|
794
|
+
/** Finance module (procurement + accounting) billing + active toggle. */
|
|
795
|
+
export interface StoreFinanceIntegration {
|
|
796
|
+
active: boolean;
|
|
797
|
+
metadata?: Record<string, any>;
|
|
737
798
|
}
|
|
738
799
|
export declare enum StoreSubscriptionStatus {
|
|
739
800
|
active = "active",
|
|
@@ -743,8 +804,26 @@ export declare enum StoreSubscriptionType {
|
|
|
743
804
|
free = "free",
|
|
744
805
|
premium = "premium",
|
|
745
806
|
vip = "vip",
|
|
807
|
+
ultra = "ultra",
|
|
746
808
|
custom = "custom"
|
|
747
809
|
}
|
|
810
|
+
/** Per-integration billing lifecycle (stored on store.subscription.integrations). */
|
|
811
|
+
export declare enum IntegrationBillingStatus {
|
|
812
|
+
active = "active",
|
|
813
|
+
grace = "grace",
|
|
814
|
+
past_due = "past_due",
|
|
815
|
+
canceled = "canceled"
|
|
816
|
+
}
|
|
817
|
+
export interface StoreIntegrationSubscription {
|
|
818
|
+
startAt: DateTime;
|
|
819
|
+
expiresAt: DateTime | null;
|
|
820
|
+
status: IntegrationBillingStatus;
|
|
821
|
+
/** Price snapshot from last successful charge (DZD). */
|
|
822
|
+
price: number;
|
|
823
|
+
autoRenew: boolean;
|
|
824
|
+
failedAttempts: number;
|
|
825
|
+
nextRetryAt: DateTime | null;
|
|
826
|
+
}
|
|
748
827
|
export interface StoreSubscription {
|
|
749
828
|
type: StoreSubscriptionType;
|
|
750
829
|
name: string;
|
|
@@ -755,6 +834,8 @@ export interface StoreSubscription {
|
|
|
755
834
|
consumed: number;
|
|
756
835
|
remaining: number;
|
|
757
836
|
metadata: Record<string, any>;
|
|
837
|
+
/** Per-integration paid subscriptions (billing only; credentials stay in store.integrations). */
|
|
838
|
+
integrations?: Record<string, StoreIntegrationSubscription>;
|
|
758
839
|
}
|
|
759
840
|
/**
|
|
760
841
|
* Input data for creating a new store
|
|
@@ -782,6 +863,7 @@ export interface StoreCreateInput {
|
|
|
782
863
|
tiktokPixelIds?: string[];
|
|
783
864
|
googleAnalyticsId?: string;
|
|
784
865
|
googleTagsId?: string;
|
|
866
|
+
projectId?: string;
|
|
785
867
|
}
|
|
786
868
|
/**
|
|
787
869
|
* Input data for updating an existing store
|
|
@@ -810,6 +892,7 @@ export interface StoreUpdateInput {
|
|
|
810
892
|
googleAnalyticsId?: string;
|
|
811
893
|
googleTagsId?: string;
|
|
812
894
|
integrations?: StoreIntegrations;
|
|
895
|
+
projectId?: string;
|
|
813
896
|
}
|
|
814
897
|
/**
|
|
815
898
|
* Store summary data
|
|
@@ -16,6 +16,8 @@ import { CurrencyRepository } from './repositories/currencies.js';
|
|
|
16
16
|
import { ShippingPriceRepository } from './repositories/shipping_prices.js';
|
|
17
17
|
import { ShippingMethodRepository } from './repositories/shipping_methods.js';
|
|
18
18
|
import { FeedbackRepository } from './repositories/feedbacks.js';
|
|
19
|
+
import { InventoryRepository } from './repositories/inventory.js';
|
|
20
|
+
import { FinanceRepository } from './repositories/finance.js';
|
|
19
21
|
import { ProductLandingPageTemplatesRepository } from './repositories/product_landing_page_templates.js';
|
|
20
22
|
import { ProductLandingPagesRepository } from './repositories/product_landing_pages.js';
|
|
21
23
|
import { ImagePromptTemplatesRepository } from './repositories/image_prompt_templates.js';
|
|
@@ -160,6 +162,14 @@ export declare class FeeeF {
|
|
|
160
162
|
* The repository for managing feedbacks.
|
|
161
163
|
*/
|
|
162
164
|
feedbacks: FeedbackRepository;
|
|
165
|
+
/**
|
|
166
|
+
* The repository for managing inventory.
|
|
167
|
+
*/
|
|
168
|
+
inventory: InventoryRepository;
|
|
169
|
+
/**
|
|
170
|
+
* The repository for managing finance (procurement: suppliers, POs, receipts).
|
|
171
|
+
*/
|
|
172
|
+
finance: FinanceRepository;
|
|
163
173
|
/**
|
|
164
174
|
* The cart service for managing the cart.
|
|
165
175
|
*/
|