@fayz-ai/inventory 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/chunk-2FXO63QV.js +1732 -0
- package/dist/chunk-2FXO63QV.js.map +1 -0
- package/dist/chunk-52AJ7H2W.js +116 -0
- package/dist/chunk-52AJ7H2W.js.map +1 -0
- package/dist/chunk-AFUR3HLA.js +84 -0
- package/dist/chunk-AFUR3HLA.js.map +1 -0
- package/dist/chunk-EF5LVTOC.js +65 -0
- package/dist/chunk-EF5LVTOC.js.map +1 -0
- package/dist/chunk-GBIFZCEN.js +33 -0
- package/dist/chunk-GBIFZCEN.js.map +1 -0
- package/dist/chunk-GDEIBHAB.js +14 -0
- package/dist/chunk-GDEIBHAB.js.map +1 -0
- package/dist/chunk-JN5AZ656.js +35 -0
- package/dist/chunk-JN5AZ656.js.map +1 -0
- package/dist/chunk-JX7NCXJQ.js +15 -0
- package/dist/chunk-JX7NCXJQ.js.map +1 -0
- package/dist/chunk-MCWG3PMP.js +549 -0
- package/dist/chunk-MCWG3PMP.js.map +1 -0
- package/dist/chunk-RUOX7OOY.js +30 -0
- package/dist/chunk-RUOX7OOY.js.map +1 -0
- package/dist/chunk-SZXUGORU.js +13 -0
- package/dist/chunk-SZXUGORU.js.map +1 -0
- package/dist/chunk-W36J5END.js +48 -0
- package/dist/chunk-W36J5END.js.map +1 -0
- package/dist/chunk-YZDGJBJD.js +53 -0
- package/dist/chunk-YZDGJBJD.js.map +1 -0
- package/dist/data/mock.d.ts +3 -0
- package/dist/data/mock.d.ts.map +1 -0
- package/dist/data/mock.js +10 -0
- package/dist/data/mock.js.map +1 -0
- package/dist/data/provider.d.ts +120 -0
- package/dist/data/provider.d.ts.map +1 -0
- package/dist/data/provider.js +3 -0
- package/dist/data/provider.js.map +1 -0
- package/dist/data/supabase.d.ts +3 -0
- package/dist/data/supabase.d.ts.map +1 -0
- package/dist/data/supabase.js +13 -0
- package/dist/data/supabase.js.map +1 -0
- package/dist/data/tables.d.ts +25 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tables.js +3 -0
- package/dist/data/tables.js.map +1 -0
- package/dist/domain/consumption.d.ts +33 -0
- package/dist/domain/consumption.d.ts.map +1 -0
- package/dist/domain/consumption.js +3 -0
- package/dist/domain/consumption.js.map +1 -0
- package/dist/domain/count.d.ts +85 -0
- package/dist/domain/count.d.ts.map +1 -0
- package/dist/domain/count.js +3 -0
- package/dist/domain/count.js.map +1 -0
- package/dist/domain/movement.d.ts +101 -0
- package/dist/domain/movement.d.ts.map +1 -0
- package/dist/domain/movement.js +3 -0
- package/dist/domain/movement.js.map +1 -0
- package/dist/domain/product.d.ts +245 -0
- package/dist/domain/product.d.ts.map +1 -0
- package/dist/domain/product.js +3 -0
- package/dist/domain/product.js.map +1 -0
- package/dist/domain/query.d.ts +12 -0
- package/dist/domain/query.d.ts.map +1 -0
- package/dist/domain/query.js +3 -0
- package/dist/domain/query.js.map +1 -0
- package/dist/domain/recipe-sheet.d.ts +133 -0
- package/dist/domain/recipe-sheet.d.ts.map +1 -0
- package/dist/domain/recipe-sheet.js +3 -0
- package/dist/domain/recipe-sheet.js.map +1 -0
- package/dist/domain/recipe.d.ts +138 -0
- package/dist/domain/recipe.d.ts.map +1 -0
- package/dist/domain/recipe.js +3 -0
- package/dist/domain/recipe.js.map +1 -0
- package/dist/domain/reference-data.d.ts +37 -0
- package/dist/domain/reference-data.d.ts.map +1 -0
- package/dist/domain/reference-data.js +3 -0
- package/dist/domain/reference-data.js.map +1 -0
- package/dist/domain/stock.d.ts +132 -0
- package/dist/domain/stock.d.ts.map +1 -0
- package/dist/domain/stock.js +5 -0
- package/dist/domain/stock.js.map +1 -0
- package/dist/domain/usage-audit.d.ts +95 -0
- package/dist/domain/usage-audit.d.ts.map +1 -0
- package/dist/domain/usage-audit.js +3 -0
- package/dist/domain/usage-audit.js.map +1 -0
- package/dist/lib/idempotency.d.ts +4 -0
- package/dist/lib/idempotency.d.ts.map +1 -0
- package/dist/lib/idempotency.js +3 -0
- package/dist/lib/idempotency.js.map +1 -0
- package/dist/store.d.ts +52 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +193 -0
- package/dist/store.js.map +1 -0
- package/package.json +50 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { DateRange } from './query';
|
|
2
|
+
export type MovementType = 'entry' | 'exit' | 'adjustment' | 'transfer' | 'loss';
|
|
3
|
+
/** The ledger's own words, fixed by a CHECK constraint on `plg_inventory_stock_movements.kind`. */
|
|
4
|
+
export type LedgerKind = 'in' | 'out' | 'transfer' | 'adjust' | 'reverse';
|
|
5
|
+
export interface StockMovement {
|
|
6
|
+
id: string;
|
|
7
|
+
productId: string;
|
|
8
|
+
productName?: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
movementType: MovementType;
|
|
11
|
+
unitCost: number;
|
|
12
|
+
totalCost: number;
|
|
13
|
+
stockLocationId?: string;
|
|
14
|
+
stockLocationName?: string;
|
|
15
|
+
destinationLocationId?: string;
|
|
16
|
+
destinationLocationName?: string;
|
|
17
|
+
supplierId?: string;
|
|
18
|
+
supplierName?: string;
|
|
19
|
+
documentNumber?: string;
|
|
20
|
+
/** `nfe`, `manual`, `transfer`… — what tells whether the source document can be opened. */
|
|
21
|
+
documentType?: string;
|
|
22
|
+
/** The stock operation that wrote this movement; the way back to the document that caused it. */
|
|
23
|
+
operationId?: string;
|
|
24
|
+
measurementUnitId?: string;
|
|
25
|
+
measurementUnitAbbreviation?: string;
|
|
26
|
+
reason?: string;
|
|
27
|
+
notes?: string;
|
|
28
|
+
batchNumber?: string;
|
|
29
|
+
expirationDate?: string;
|
|
30
|
+
movementDate: string;
|
|
31
|
+
userId?: string;
|
|
32
|
+
userName?: string;
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CreateStockMovementInput {
|
|
38
|
+
productId: string;
|
|
39
|
+
quantity: number;
|
|
40
|
+
movementType: MovementType;
|
|
41
|
+
unitCost?: number;
|
|
42
|
+
stockLocationId?: string;
|
|
43
|
+
destinationLocationId?: string;
|
|
44
|
+
supplierId?: string;
|
|
45
|
+
documentNumber?: string;
|
|
46
|
+
reason?: string;
|
|
47
|
+
notes?: string;
|
|
48
|
+
movementDate?: string;
|
|
49
|
+
batchNumber?: string;
|
|
50
|
+
expirationDate?: string;
|
|
51
|
+
/** Stable for every retry of the same operator action. */
|
|
52
|
+
idempotencyKey?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface MovementQuery {
|
|
55
|
+
productId?: string;
|
|
56
|
+
movementType?: MovementType | MovementType[];
|
|
57
|
+
stockLocationId?: string;
|
|
58
|
+
dateRange?: DateRange;
|
|
59
|
+
search?: string;
|
|
60
|
+
page?: number;
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface MovementTypeSpec {
|
|
64
|
+
value: MovementType;
|
|
65
|
+
/** i18n key under the plugin's `inventory.movementType` namespace. */
|
|
66
|
+
labelKey: string;
|
|
67
|
+
/** lucide icon name, resolved by the host's icon map. */
|
|
68
|
+
icon: string;
|
|
69
|
+
/** What the quantity does to the on-hand total. */
|
|
70
|
+
effect: 'increase' | 'decrease' | 'set' | 'move';
|
|
71
|
+
}
|
|
72
|
+
export declare const MOVEMENT_TYPES: readonly MovementTypeSpec[];
|
|
73
|
+
export declare const MOVEMENT_TYPE_VALUES: readonly MovementType[];
|
|
74
|
+
/** Portuguese spellings pre-SDK apps imported; kept beside the canonical list so an import cannot drift from what the UI renders. */
|
|
75
|
+
export declare const LEGACY_PT_MOVEMENT_TYPE: Readonly<Record<string, MovementType>>;
|
|
76
|
+
/** Any known spelling (canonical, ledger or legacy Portuguese) to a MovementType; undefined when unrecognised. */
|
|
77
|
+
export declare function normalizeMovementType(raw: string): MovementType | undefined;
|
|
78
|
+
export declare function movementTypeSpec(value: string): MovementTypeSpec | undefined;
|
|
79
|
+
export declare function ledgerKind(type: MovementType | string): LedgerKind;
|
|
80
|
+
/** The ledger's sign check: an `out` or a `transfer` leaves negative, an `in` arrives positive. */
|
|
81
|
+
export declare function signedLedgerQuantity(kind: LedgerKind, quantity: number): number;
|
|
82
|
+
/** How a movement changes its source slot: an adjustment is the counted truth, everything else a delta. */
|
|
83
|
+
export declare function sourcePositionChange(type: MovementType, quantity: number): {
|
|
84
|
+
mode: 'add' | 'set';
|
|
85
|
+
amount: number;
|
|
86
|
+
};
|
|
87
|
+
/** What undoing a movement does to its source slot; the destination of a transfer gives back `-quantity`. */
|
|
88
|
+
export declare function reversedSourceDelta(type: MovementType, quantity: number): number;
|
|
89
|
+
/** What a movement does to the product's on-hand total when no slot decides it. */
|
|
90
|
+
export declare function onHandDelta(type: MovementType, quantity: number): number;
|
|
91
|
+
export declare function movementNeedsReason(type: MovementType): boolean;
|
|
92
|
+
export declare function movementNeedsDestination(type: MovementType): boolean;
|
|
93
|
+
export declare function movementTakesSupplier(type: MovementType): boolean;
|
|
94
|
+
export declare function canRecordMovement(input: {
|
|
95
|
+
movementType: MovementType;
|
|
96
|
+
quantity: number;
|
|
97
|
+
reason?: string;
|
|
98
|
+
destinationLocationId?: string;
|
|
99
|
+
}): boolean;
|
|
100
|
+
export declare function emptyMovementTally(): Record<MovementType, number>;
|
|
101
|
+
//# sourceMappingURL=movement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movement.d.ts","sourceRoot":"","sources":["../../src/domain/movement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAA;AAEhF,mGAAmG;AACnG,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,KAAK,GAAG,UAAU,GAAG,QAA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ES, canRecordMovement, emptyMovementTally, ledgerKind, movementNeedsDestination, movementNeedsReason, movementTakesSupplier, movementTypeSpec, normalizeMovementType, onHandDelta, reversedSourceDelta, signedLedgerQuantity, sourcePositionChange } from '../chunk-AFUR3HLA.js';
|
|
2
|
+
//# sourceMappingURL=movement.js.map
|
|
3
|
+
//# sourceMappingURL=movement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"movement.js"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
export type ProductType = 'ingredient' | 'sale' | 'intermediate' | 'asset';
|
|
2
|
+
export type ProductPurpose = 'purchase' | 'sale' | 'both' | 'internal';
|
|
3
|
+
/** The seven independent switches; a product can be several things at once, each one opening its own ficha. */
|
|
4
|
+
export interface ProductClassification {
|
|
5
|
+
isIngredient: boolean;
|
|
6
|
+
isForSale: boolean;
|
|
7
|
+
isIntermediate: boolean;
|
|
8
|
+
isAsset: boolean;
|
|
9
|
+
isProduced: boolean;
|
|
10
|
+
isResale: boolean;
|
|
11
|
+
trackByUnitLabel: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ProductIngredientInfo {
|
|
14
|
+
minimumQuantity?: number;
|
|
15
|
+
maximumQuantity?: number;
|
|
16
|
+
/** Sits above the minimum: the balance at which buying should start. */
|
|
17
|
+
reorderPoint?: number;
|
|
18
|
+
leadTimeDays?: number;
|
|
19
|
+
shelfLifeDays?: number;
|
|
20
|
+
storageTemperature?: string;
|
|
21
|
+
allowedSupplierIds?: string[];
|
|
22
|
+
notes?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ProductSaleInfo {
|
|
25
|
+
menuDescription?: string;
|
|
26
|
+
allergens?: string;
|
|
27
|
+
preparationTimeMinutes?: number;
|
|
28
|
+
servesQuantity?: number;
|
|
29
|
+
calories?: number;
|
|
30
|
+
soldByWeight?: boolean;
|
|
31
|
+
highlightDelivery?: boolean;
|
|
32
|
+
availableForDelivery?: boolean;
|
|
33
|
+
availableForCounter?: boolean;
|
|
34
|
+
notes?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ProductSaleChannel {
|
|
37
|
+
channel: string;
|
|
38
|
+
price: number;
|
|
39
|
+
active?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ProductIntermediateInfo {
|
|
42
|
+
yieldPercentage?: number;
|
|
43
|
+
preparationTimeMinutes?: number;
|
|
44
|
+
shelfLifeHours?: number;
|
|
45
|
+
batchSize?: number;
|
|
46
|
+
batchUnitId?: string;
|
|
47
|
+
storageInstructions?: string;
|
|
48
|
+
notes?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ProductAssetInfo {
|
|
51
|
+
assetValue?: number;
|
|
52
|
+
residualValue?: number;
|
|
53
|
+
usefulLifeMonths?: number;
|
|
54
|
+
depreciationRate?: number;
|
|
55
|
+
serialNumber?: string;
|
|
56
|
+
acquisitionDate?: string;
|
|
57
|
+
warrantyExpiryDate?: string;
|
|
58
|
+
assetStatus?: string;
|
|
59
|
+
assetLocation?: string;
|
|
60
|
+
responsiblePersonId?: string;
|
|
61
|
+
insurancePolicy?: string;
|
|
62
|
+
lastMaintenanceDate?: string;
|
|
63
|
+
nextMaintenanceDate?: string;
|
|
64
|
+
notes?: string;
|
|
65
|
+
}
|
|
66
|
+
/** The product's exception to its tax group; `undefined` means "whatever the group says", never zero. */
|
|
67
|
+
export interface ProductTaxInfo {
|
|
68
|
+
taxGroupId?: string;
|
|
69
|
+
ncm?: string;
|
|
70
|
+
cest?: string;
|
|
71
|
+
icmsOrigin?: string;
|
|
72
|
+
icmsRate?: number;
|
|
73
|
+
cfop?: string;
|
|
74
|
+
cst?: string;
|
|
75
|
+
pisSituation?: string;
|
|
76
|
+
pisRate?: number;
|
|
77
|
+
cofinsSituation?: string;
|
|
78
|
+
cofinsRate?: number;
|
|
79
|
+
baseCalculationMode?: string;
|
|
80
|
+
benefitCode?: string;
|
|
81
|
+
povertyFundRate?: number;
|
|
82
|
+
ibsCbsSituation?: string;
|
|
83
|
+
ibsCbsClassification?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface ProductBarcode {
|
|
86
|
+
id?: string;
|
|
87
|
+
barcode: string;
|
|
88
|
+
barcodeType?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
isPrimary?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** One sellable form of a product (size, colour). The default one stands for a product with none. */
|
|
93
|
+
export interface ProductVariant {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
sku?: string;
|
|
97
|
+
isDefault: boolean;
|
|
98
|
+
isActive: boolean;
|
|
99
|
+
/** Units in stock across the units the person can see. */
|
|
100
|
+
onHand: number;
|
|
101
|
+
}
|
|
102
|
+
export interface ProductGeneralExtras {
|
|
103
|
+
commissionPercent?: number;
|
|
104
|
+
chartAccountId?: string;
|
|
105
|
+
/** How much of `contentUnitId` fits in one stock unit. */
|
|
106
|
+
contentPerUnit?: number;
|
|
107
|
+
contentUnitId?: string;
|
|
108
|
+
avgPurchasePrice?: number;
|
|
109
|
+
avgPurchasePriceUpdatedAt?: string;
|
|
110
|
+
professionalResalePrice?: number;
|
|
111
|
+
requireBatchForStock?: boolean;
|
|
112
|
+
requireExpiryForStock?: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface Product {
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
sku?: string;
|
|
119
|
+
barcode?: string;
|
|
120
|
+
brand?: string;
|
|
121
|
+
categoryId?: string;
|
|
122
|
+
categoryName?: string;
|
|
123
|
+
/** Derived from `classification`; see `derivedProductType`. */
|
|
124
|
+
productType: ProductType;
|
|
125
|
+
purpose?: ProductPurpose;
|
|
126
|
+
classification?: ProductClassification;
|
|
127
|
+
ingredientInfo?: ProductIngredientInfo;
|
|
128
|
+
saleInfo?: ProductSaleInfo;
|
|
129
|
+
saleChannels?: ProductSaleChannel[];
|
|
130
|
+
intermediateInfo?: ProductIntermediateInfo;
|
|
131
|
+
assetInfo?: ProductAssetInfo;
|
|
132
|
+
taxInfo?: ProductTaxInfo;
|
|
133
|
+
currentQuantity: number;
|
|
134
|
+
minQuantity: number;
|
|
135
|
+
maxQuantity?: number;
|
|
136
|
+
costPrice: number;
|
|
137
|
+
salePrice?: number;
|
|
138
|
+
measurementUnitId?: string;
|
|
139
|
+
measurementUnitName?: string;
|
|
140
|
+
purchaseUnitId?: string;
|
|
141
|
+
/** How many measurement units fit in one purchase unit. 1 when they are the same. */
|
|
142
|
+
conversionFactor?: number;
|
|
143
|
+
isActive: boolean;
|
|
144
|
+
supplierId?: string;
|
|
145
|
+
supplierName?: string;
|
|
146
|
+
defaultLocationId?: string;
|
|
147
|
+
imageUrl?: string;
|
|
148
|
+
extras?: ProductGeneralExtras;
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
150
|
+
tenantId: string;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ProductCategory {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
parentId?: string;
|
|
158
|
+
isActive: boolean;
|
|
159
|
+
tenantId: string;
|
|
160
|
+
createdAt: string;
|
|
161
|
+
updatedAt: string;
|
|
162
|
+
}
|
|
163
|
+
export interface MeasurementUnit {
|
|
164
|
+
id: string;
|
|
165
|
+
name: string;
|
|
166
|
+
abbreviation: string;
|
|
167
|
+
isActive: boolean;
|
|
168
|
+
tenantId: string;
|
|
169
|
+
createdAt: string;
|
|
170
|
+
}
|
|
171
|
+
export interface Supplier {
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
documentNumber?: string;
|
|
175
|
+
phone?: string;
|
|
176
|
+
}
|
|
177
|
+
export interface CreateProductInput {
|
|
178
|
+
name: string;
|
|
179
|
+
description?: string;
|
|
180
|
+
sku?: string;
|
|
181
|
+
barcode?: string;
|
|
182
|
+
brand?: string;
|
|
183
|
+
categoryId?: string;
|
|
184
|
+
productType: ProductType;
|
|
185
|
+
purpose?: ProductPurpose;
|
|
186
|
+
minQuantity?: number;
|
|
187
|
+
maxQuantity?: number;
|
|
188
|
+
costPrice?: number;
|
|
189
|
+
salePrice?: number;
|
|
190
|
+
measurementUnitId?: string;
|
|
191
|
+
purchaseUnitId?: string;
|
|
192
|
+
conversionFactor?: number;
|
|
193
|
+
supplierId?: string;
|
|
194
|
+
defaultLocationId?: string;
|
|
195
|
+
imageUrl?: string;
|
|
196
|
+
classification?: Partial<ProductClassification>;
|
|
197
|
+
extras?: ProductGeneralExtras;
|
|
198
|
+
ingredientInfo?: ProductIngredientInfo;
|
|
199
|
+
saleInfo?: ProductSaleInfo;
|
|
200
|
+
saleChannels?: ProductSaleChannel[];
|
|
201
|
+
intermediateInfo?: ProductIntermediateInfo;
|
|
202
|
+
assetInfo?: ProductAssetInfo;
|
|
203
|
+
taxInfo?: ProductTaxInfo;
|
|
204
|
+
metadata?: Record<string, unknown>;
|
|
205
|
+
}
|
|
206
|
+
export interface ProductQuery {
|
|
207
|
+
productType?: ProductType;
|
|
208
|
+
categoryId?: string;
|
|
209
|
+
search?: string;
|
|
210
|
+
lowStockOnly?: boolean;
|
|
211
|
+
isActive?: boolean;
|
|
212
|
+
page?: number;
|
|
213
|
+
pageSize?: number;
|
|
214
|
+
}
|
|
215
|
+
/** The one type the list facet shows; sale wins because that is what the counter calls the thing. */
|
|
216
|
+
export declare function derivedProductType(c: Partial<ProductClassification> | undefined, fallback?: string): ProductType;
|
|
217
|
+
/** Markup over cost, in percent. Null when either price is not filled in: zero means "not registered", not "free". */
|
|
218
|
+
export declare function marginPercent(salePrice: number, costPrice: number): number | null;
|
|
219
|
+
/** On-hand × cost. Null when there is stock but no cost: the value is unknown, not zero. */
|
|
220
|
+
export declare function stockValue(quantity: number, costPrice: number): number | null;
|
|
221
|
+
export declare const PRODUCT_IMAGE_MAX_BYTES: number;
|
|
222
|
+
/** Why a file cannot be a product photo, in the words the screen shows; undefined when it can. */
|
|
223
|
+
export declare function productImageProblem(file: {
|
|
224
|
+
type: string;
|
|
225
|
+
size: number;
|
|
226
|
+
}): string | undefined;
|
|
227
|
+
/** The first barcode a product gets is its primary one unless the caller says otherwise. */
|
|
228
|
+
export declare function isNewBarcodePrimary(input: Pick<ProductBarcode, 'isPrimary'>, existingCount: number): boolean;
|
|
229
|
+
/** A choice group of a product sold (Complementos): «Ponto da carne». */
|
|
230
|
+
export interface ProductOptionGroup {
|
|
231
|
+
id?: string;
|
|
232
|
+
name: string;
|
|
233
|
+
isActive: boolean;
|
|
234
|
+
isRequired: boolean;
|
|
235
|
+
minSelections: number;
|
|
236
|
+
maxSelections: number;
|
|
237
|
+
items: ProductOptionItem[];
|
|
238
|
+
}
|
|
239
|
+
export interface ProductOptionItem {
|
|
240
|
+
id?: string;
|
|
241
|
+
name: string;
|
|
242
|
+
priceAdjustment: number;
|
|
243
|
+
isActive: boolean;
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/domain/product.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAA;AAE1E,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEtE,+GAA+G;AAC/G,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;I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BAAiB,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"product.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface DateRange {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PaginatedResult<T> {
|
|
6
|
+
data: T[];
|
|
7
|
+
total: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function paginate<T>(items: T[], page?: number, pageSize?: number): PaginatedResult<T>;
|
|
10
|
+
/** `YYYY-MM-DD` in local time, `days` from `from`. */
|
|
11
|
+
export declare function isoDayFrom(from: Date, days?: number): string;
|
|
12
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/domain/query.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,SAAI,EAAE,QAAQ,SAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAGnF;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,SAAI,GAAG,MAAM,CAIvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"query.js"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { MeasurementUnit } from './product';
|
|
2
|
+
export type { MeasurementUnit };
|
|
3
|
+
export type RecipeOutputType = 'main' | 'coproduct' | 'byproduct' | 'waste';
|
|
4
|
+
/** A product a sheet yields besides (or instead of) its own product. */
|
|
5
|
+
export interface RecipeOutput {
|
|
6
|
+
id?: string;
|
|
7
|
+
productId: string;
|
|
8
|
+
productName?: string;
|
|
9
|
+
outputType: RecipeOutputType;
|
|
10
|
+
expectedQuantity: number;
|
|
11
|
+
measurementUnitId?: string;
|
|
12
|
+
/** % of the order cost; null on every line = split by market value. */
|
|
13
|
+
costShare?: number | null;
|
|
14
|
+
}
|
|
15
|
+
export interface ProductionStation {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
unitId?: string;
|
|
19
|
+
}
|
|
20
|
+
/** What an ingredient brings to a sheet line: its cost and its base unit. */
|
|
21
|
+
export interface IngredientInfo {
|
|
22
|
+
productId: string;
|
|
23
|
+
name: string;
|
|
24
|
+
/** Cost of one base unit — `products.cost`. */
|
|
25
|
+
cost: number;
|
|
26
|
+
/** The unit the stored quantity is in. Falls back to the unit the product
|
|
27
|
+
* already has on other sheet lines when the catalogue row carries none. */
|
|
28
|
+
baseUnitId?: string;
|
|
29
|
+
}
|
|
30
|
+
/** The whole sheet as the editor reads and writes it. */
|
|
31
|
+
export interface RecipeSheet {
|
|
32
|
+
id?: string;
|
|
33
|
+
productId: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
yieldQuantity: number;
|
|
37
|
+
yieldUnitId?: string;
|
|
38
|
+
yieldMode: 'portion' | 'batch';
|
|
39
|
+
preparationTimeMinutes?: number;
|
|
40
|
+
instructions?: string;
|
|
41
|
+
groups: RecipeSheetGroup[];
|
|
42
|
+
outputs: RecipeOutput[];
|
|
43
|
+
}
|
|
44
|
+
export interface RecipeSheetGroup {
|
|
45
|
+
name: string;
|
|
46
|
+
stationId?: string;
|
|
47
|
+
preparationNotes?: string;
|
|
48
|
+
estimatedMinutes?: number;
|
|
49
|
+
ingredients: RecipeSheetLine[];
|
|
50
|
+
}
|
|
51
|
+
export interface RecipeSheetLine {
|
|
52
|
+
productId: string;
|
|
53
|
+
/** In the ingredient's base unit. */
|
|
54
|
+
quantity: number;
|
|
55
|
+
unitId?: string;
|
|
56
|
+
displayUnitId?: string;
|
|
57
|
+
notes?: string;
|
|
58
|
+
}
|
|
59
|
+
/** One row of the Fichas Técnicas list: every produced product, sheet or not. */
|
|
60
|
+
export interface RecipeListRow {
|
|
61
|
+
productId: string;
|
|
62
|
+
productName: string;
|
|
63
|
+
imageUrl?: string;
|
|
64
|
+
categoryName?: string;
|
|
65
|
+
isForSale: boolean;
|
|
66
|
+
isIntermediate: boolean;
|
|
67
|
+
recipeId?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
ingredientCount: number;
|
|
70
|
+
yieldQuantity?: number;
|
|
71
|
+
yieldUnitAbbr?: string;
|
|
72
|
+
preparationTimeMinutes?: number;
|
|
73
|
+
/** Cost of the whole sheet (sum of lines). */
|
|
74
|
+
cost: number;
|
|
75
|
+
salePrice: number;
|
|
76
|
+
}
|
|
77
|
+
/** A whole sheet as the spreadsheet export lays it out. */
|
|
78
|
+
export interface RecipeExportSheet {
|
|
79
|
+
productId: string;
|
|
80
|
+
productName: string;
|
|
81
|
+
categoryName?: string;
|
|
82
|
+
salePrice: number;
|
|
83
|
+
/** False for a produced product still waiting for its sheet. */
|
|
84
|
+
hasSheet: boolean;
|
|
85
|
+
yieldQuantity?: number;
|
|
86
|
+
yieldUnitAbbr?: string;
|
|
87
|
+
preparationTimeMinutes?: number;
|
|
88
|
+
groups: Array<{
|
|
89
|
+
name: string;
|
|
90
|
+
lines: Array<{
|
|
91
|
+
ingredientId: string;
|
|
92
|
+
ingredientName: string;
|
|
93
|
+
ingredientSku?: string;
|
|
94
|
+
unitAbbr?: string;
|
|
95
|
+
quantity: number;
|
|
96
|
+
unitCost: number;
|
|
97
|
+
}>;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
/** A product a sheet can be made for — sold, intermediate or already produced. */
|
|
101
|
+
export interface RecipeCandidate {
|
|
102
|
+
productId: string;
|
|
103
|
+
name: string;
|
|
104
|
+
imageUrl?: string;
|
|
105
|
+
categoryName?: string;
|
|
106
|
+
salePrice: number;
|
|
107
|
+
kind: 'sale' | 'intermediate' | 'produced';
|
|
108
|
+
hasRecipe: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface RecipeAiSuggestion {
|
|
111
|
+
yieldQuantity?: number;
|
|
112
|
+
yieldUnitId?: string;
|
|
113
|
+
preparationTimeMinutes?: number;
|
|
114
|
+
generalDescription?: string;
|
|
115
|
+
groups: Array<{
|
|
116
|
+
name: string;
|
|
117
|
+
stationId?: string;
|
|
118
|
+
preparationNotes?: string;
|
|
119
|
+
ingredients: Array<{
|
|
120
|
+
productId?: string;
|
|
121
|
+
productNameHint?: string;
|
|
122
|
+
quantity: number;
|
|
123
|
+
unitId?: string;
|
|
124
|
+
notes?: string;
|
|
125
|
+
}>;
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
export interface IngredientCostSuggestion {
|
|
129
|
+
suggestedPrice: number;
|
|
130
|
+
unitAbbreviation?: string;
|
|
131
|
+
reasoning?: string;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=recipe-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-sheet.d.ts","sourceRoot":"","sources":["../../src/domain/recipe-sheet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,YAAY,EAAE,eAAe,EAAE,CAAA;AAE/B,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,CAAA;AAE3E,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EA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