@shushed/helpers 0.0.223 → 0.0.224-main-20251222140743

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.
@@ -1,119 +0,0 @@
1
- import EnvEngine from './env';
2
- import Runtime from './runtime';
3
- export interface UnitCost {
4
- value: number;
5
- decimal_places: number;
6
- currency: string;
7
- lcy_value: number;
8
- lcy_currency: string;
9
- lcy_decimal_places: number;
10
- }
11
- export interface StockMovementInput {
12
- style_id: string;
13
- colour_id: string;
14
- size_code: string;
15
- location_code: string;
16
- last_updated_at?: string;
17
- entry_no: string;
18
- quantity: number;
19
- document_no: string;
20
- external_document_no?: string;
21
- type: 'transfer' | 'negative adjustment' | 'positive adjustment' | 'purchase' | 'sale';
22
- unit_cost?: UnitCost;
23
- document_date?: string;
24
- posting_date?: string;
25
- created_at: string;
26
- }
27
- export type BasicSitooWarehouse = {
28
- warehouseid: number;
29
- warehousetype: string;
30
- usetype: string;
31
- storeid: number;
32
- sellable: boolean;
33
- name: string;
34
- externalId: number;
35
- };
36
- export type BasicSitooStore = {
37
- storeid: number;
38
- name: string;
39
- externalId: number;
40
- };
41
- export type BasicWarehouseTransaction = {
42
- warehousetransactionid: number;
43
- warehouseid: number;
44
- datecreated: number;
45
- transactiontype: number;
46
- description: string;
47
- orderdeliveryid: number | null;
48
- shipmentid: number | null;
49
- externalid: string | null;
50
- reasoncode: string | null;
51
- items: Array<{
52
- decimalquantity: string;
53
- decimaltotal: string;
54
- moneypricein: string;
55
- moneytotal: string;
56
- moneyvalue: string;
57
- sku: string;
58
- }>;
59
- };
60
- export type WarehouseTransactionEnvelope = {
61
- totalcount: number;
62
- items: BasicWarehouseTransaction[];
63
- };
64
- export interface WarehouseTransactionSyncOptions {
65
- preview?: boolean;
66
- skuGenerator?: (styleId: string, colourId: string, sizeCode: string) => string;
67
- }
68
- export interface WarehouseTransactionSyncResult {
69
- found: Array<{
70
- entryNo: string;
71
- transactionId: number;
72
- }>;
73
- missing: string[];
74
- created: Array<{
75
- entryNo: string;
76
- transactionId: number;
77
- }>;
78
- errors: Array<{
79
- entryNo: string;
80
- error: string;
81
- }>;
82
- firestoreUpdated: boolean;
83
- skipped: Array<{
84
- entryNo: string;
85
- reason: string;
86
- }>;
87
- }
88
- export interface FirestoreCacheDocument {
89
- [entryNo: string]: number;
90
- }
91
- export default class SitooHelper extends EnvEngine {
92
- protected opts: {
93
- accessToken: string;
94
- sitooBaseUrl: string;
95
- sitooSiteId: number;
96
- };
97
- shaToken: string;
98
- baseUrl: string;
99
- siteId: number;
100
- constructor(options: ConstructorParameters<typeof Runtime>[0], opts: {
101
- accessToken: string;
102
- sitooBaseUrl: string;
103
- sitooSiteId: number;
104
- });
105
- getSitooWarehouses(): Promise<{
106
- nameToId: Record<string, number>;
107
- warehouses: Record<number, BasicSitooWarehouse>;
108
- }>;
109
- private fetchWarehouseTransactionsWithFilter;
110
- private searchTransactionsInApi;
111
- private batchAddWarehouseTransactions;
112
- syncWarehouseTransactions(items: StockMovementInput[], options?: WarehouseTransactionSyncOptions): Promise<Array<{
113
- entryNo: string;
114
- transactionId: number;
115
- } | Error | {
116
- error: boolean;
117
- message: string;
118
- }>>;
119
- }