@shushed/helpers 0.0.223-redis-fix-20251222110941 → 0.0.223
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/dist/cjs/contracts/index.js +5 -1
- package/dist/cjs/contracts/purchase-orderline.schema.json +124 -0
- package/dist/cjs/contracts/stock-movement.schema.json +144 -0
- package/dist/cjs/dist-dereferenced/index.js +5 -1
- package/dist/cjs/dist-dereferenced/purchase-orderline.js +4 -0
- package/dist/cjs/dist-dereferenced/stock-movement.js +4 -0
- package/dist/cjs/dist-types/purchase-orderline.js +2 -0
- package/dist/cjs/dist-types/stock-movement.js +2 -0
- package/dist/cjs/src-public/airtable.js +96 -59
- package/dist/cjs/src-public/centra.js +56 -5
- package/dist/cjs/src-public/env.js +3 -6
- package/dist/cjs/src-public/index.js +3 -1
- package/dist/cjs/src-public/sitoo.js +279 -0
- package/dist/package.json +3 -2
- package/dist/types/contracts/index.d.ts +2 -0
- package/dist/types/dist-dereferenced/index.d.ts +2 -0
- package/dist/types/dist-dereferenced/purchase-orderline.d.ts +110 -0
- package/dist/types/dist-dereferenced/stock-movement.d.ts +110 -0
- package/dist/types/dist-types/index.d.ts +2 -0
- package/dist/types/dist-types/purchase-orderline.d.ts +30 -0
- package/dist/types/dist-types/stock-movement.d.ts +30 -0
- package/dist/types/src-public/airtable.d.ts +0 -9
- package/dist/types/src-public/centra.d.ts +3 -0
- package/dist/types/src-public/index.d.ts +1 -0
- package/dist/types/src-public/sitoo.d.ts +119 -0
- package/package.json +4 -3
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
declare const schema: {
|
|
2
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
3
|
+
readonly title: "Stock Movement Schema";
|
|
4
|
+
readonly type: "object";
|
|
5
|
+
readonly additionalProperties: false;
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly style_id: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly minLength: 1;
|
|
10
|
+
};
|
|
11
|
+
readonly colour_id: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly minLength: 1;
|
|
14
|
+
};
|
|
15
|
+
readonly size_code: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly minLength: 1;
|
|
18
|
+
};
|
|
19
|
+
readonly location_code: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly pattern: "^\\d{3}-[A-Z]+$|^[A-Z]{2,}-?[A-Z]*$|^[A-Z]{2,}\\d{3}$";
|
|
22
|
+
};
|
|
23
|
+
readonly source_system: {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly enum: readonly ["bc", "centra", "sitoo"];
|
|
26
|
+
};
|
|
27
|
+
readonly quantity: {
|
|
28
|
+
readonly type: "integer";
|
|
29
|
+
readonly minimum: 0;
|
|
30
|
+
};
|
|
31
|
+
readonly entry_no: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
};
|
|
34
|
+
readonly external_entry_no: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
};
|
|
37
|
+
readonly document_no: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
};
|
|
40
|
+
readonly external_document_no: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
43
|
+
readonly type: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly enum: readonly ["transfer", "negative adjustment", "positive adjustment", "purchase", "sale"];
|
|
46
|
+
};
|
|
47
|
+
readonly unit_cost: {
|
|
48
|
+
readonly oneOf: readonly [{
|
|
49
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
50
|
+
readonly title: "Money";
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly additionalProperties: false;
|
|
53
|
+
readonly properties: {
|
|
54
|
+
readonly value: {
|
|
55
|
+
readonly type: "integer";
|
|
56
|
+
readonly minimum: 0;
|
|
57
|
+
};
|
|
58
|
+
readonly decimal_places: {
|
|
59
|
+
readonly type: "integer";
|
|
60
|
+
readonly minimum: 0;
|
|
61
|
+
readonly maximum: 4;
|
|
62
|
+
};
|
|
63
|
+
readonly currency: {
|
|
64
|
+
readonly title: "Currency";
|
|
65
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
readonly enum: readonly ["AFN", "ALL", "DZD", "USD", "EUR", "AOA", "XCD", "ARS", "AMD", "AWG", "AUD", "AZN", "BSD", "BHD", "BDT", "BBD", "BYN", "BZD", "XOF", "BMD", "BTN", "INR", "BOB", "BOV", "BAM", "BWP", "NOK", "BRL", "BND", "BGN", "BIF", "CVE", "KHR", "XAF", "CAD", "KYD", "CLF", "CLP", "CNY", "COP", "COU", "KMF", "CDF", "NZD", "CRC", "CUC", "CUP", "ANG", "CZK", "DKK", "DJF", "DOP", "EGP", "SVC", "ERN", "ETB", "FKP", "FJD", "XPF", "GMD", "GEL", "GHS", "GIP", "GTQ", "GBP", "GNF", "GYD", "HTG", "HNL", "HKD", "HUF", "ISK", "IDR", "XDR", "IRR", "IQD", "ILS", "JMD", "JPY", "JOD", "KZT", "KES", "KPW", "KRW", "KWD", "KGS", "LAK", "LBP", "LSL", "ZAR", "LRD", "LYD", "CHF", "MOP", "MGA", "MWK", "MYR", "MVR", "MRU", "MUR", "XUA", "MXN", "MXV", "MDL", "MNT", "MAD", "MZN", "MMK", "NAD", "NPR", "NIO", "NGN", "OMR", "PKR", "PAB", "PGK", "PYG", "PEN", "PHP", "PLN", "QAR", "MKD", "RON", "RUB", "RWF", "SHP", "WST", "STN", "SAR", "RSD", "SCR", "SLE", "SGD", "XSU", "SBD", "SOS", "SSP", "LKR", "SDG", "SRD", "SZL", "SEK", "CHE", "CHW", "SYP", "TWD", "TJS", "TZS", "THB", "TOP", "TTD", "TND", "TRY", "TMT", "UGX", "UAH", "AED", "USN", "UYI", "UYU", "UZS", "VUV", "VEF", "VED", "VND", "YER", "ZMW", "ZWL"];
|
|
68
|
+
};
|
|
69
|
+
readonly lcy_value: {
|
|
70
|
+
readonly type: "integer";
|
|
71
|
+
readonly minimum: 0;
|
|
72
|
+
};
|
|
73
|
+
readonly lcy_currency: {
|
|
74
|
+
readonly title: "LCY Currency";
|
|
75
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
readonly enum: readonly ["AFN", "ALL", "DZD", "USD", "EUR", "AOA", "XCD", "ARS", "AMD", "AWG", "AUD", "AZN", "BSD", "BHD", "BDT", "BBD", "BYN", "BZD", "XOF", "BMD", "BTN", "INR", "BOB", "BOV", "BAM", "BWP", "NOK", "BRL", "BND", "BGN", "BIF", "CVE", "KHR", "XAF", "CAD", "KYD", "CLF", "CLP", "CNY", "COP", "COU", "KMF", "CDF", "NZD", "CRC", "CUC", "CUP", "ANG", "CZK", "DKK", "DJF", "DOP", "EGP", "SVC", "ERN", "ETB", "FKP", "FJD", "XPF", "GMD", "GEL", "GHS", "GIP", "GTQ", "GBP", "GNF", "GYD", "HTG", "HNL", "HKD", "HUF", "ISK", "IDR", "XDR", "IRR", "IQD", "ILS", "JMD", "JPY", "JOD", "KZT", "KES", "KPW", "KRW", "KWD", "KGS", "LAK", "LBP", "LSL", "ZAR", "LRD", "LYD", "CHF", "MOP", "MGA", "MWK", "MYR", "MVR", "MRU", "MUR", "XUA", "MXN", "MXV", "MDL", "MNT", "MAD", "MZN", "MMK", "NAD", "NPR", "NIO", "NGN", "OMR", "PKR", "PAB", "PGK", "PYG", "PEN", "PHP", "PLN", "QAR", "MKD", "RON", "RUB", "RWF", "SHP", "WST", "STN", "SAR", "RSD", "SCR", "SLE", "SGD", "XSU", "SBD", "SOS", "SSP", "LKR", "SDG", "SRD", "SZL", "SEK", "CHE", "CHW", "SYP", "TWD", "TJS", "TZS", "THB", "TOP", "TTD", "TND", "TRY", "TMT", "UGX", "UAH", "AED", "USN", "UYI", "UYU", "UZS", "VUV", "VEF", "VED", "VND", "YER", "ZMW", "ZWL"];
|
|
78
|
+
};
|
|
79
|
+
readonly lcy_decimal_places: {
|
|
80
|
+
readonly type: "integer";
|
|
81
|
+
readonly minimum: 0;
|
|
82
|
+
readonly maximum: 4;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly required: readonly ["value", "currency", "lcy_value", "lcy_currency", "decimal_places", "lcy_decimal_places"];
|
|
86
|
+
}, {
|
|
87
|
+
readonly type: "null";
|
|
88
|
+
}];
|
|
89
|
+
};
|
|
90
|
+
readonly document_date: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly format: "date";
|
|
93
|
+
};
|
|
94
|
+
readonly posting_date: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly format: "date";
|
|
97
|
+
};
|
|
98
|
+
readonly created_at: {
|
|
99
|
+
readonly type: "string";
|
|
100
|
+
readonly format: "date-time";
|
|
101
|
+
};
|
|
102
|
+
readonly last_modified_at: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly format: "date-time";
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
readonly required: readonly ["style_id", "source_system", "location_code", "colour_id", "size_code", "last_modified_at", "quantity", "created_at", "document_date", "type"];
|
|
108
|
+
readonly $id: "https://shushed.example.com/stock-move.schema.json";
|
|
109
|
+
};
|
|
110
|
+
export default schema;
|
|
@@ -10,6 +10,8 @@ export { default as Price } from './price';
|
|
|
10
10
|
export { default as ProductCategory } from './product-category';
|
|
11
11
|
export { default as ProductDraft } from './product-draft';
|
|
12
12
|
export { default as Product } from './product';
|
|
13
|
+
export { default as PurchaseOrderline } from './purchase-orderline';
|
|
14
|
+
export { default as StockMovement } from './stock-movement';
|
|
13
15
|
export { default as Stock } from './stock';
|
|
14
16
|
export { default as Total } from './total';
|
|
15
17
|
export * as Messages from './messages';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type Currency = ("AFN" | "ALL" | "DZD" | "USD" | "EUR" | "AOA" | "XCD" | "ARS" | "AMD" | "AWG" | "AUD" | "AZN" | "BSD" | "BHD" | "BDT" | "BBD" | "BYN" | "BZD" | "XOF" | "BMD" | "BTN" | "INR" | "BOB" | "BOV" | "BAM" | "BWP" | "NOK" | "BRL" | "BND" | "BGN" | "BIF" | "CVE" | "KHR" | "XAF" | "CAD" | "KYD" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "KMF" | "CDF" | "NZD" | "CRC" | "CUC" | "CUP" | "ANG" | "CZK" | "DKK" | "DJF" | "DOP" | "EGP" | "SVC" | "ERN" | "ETB" | "FKP" | "FJD" | "XPF" | "GMD" | "GEL" | "GHS" | "GIP" | "GTQ" | "GBP" | "GNF" | "GYD" | "HTG" | "HNL" | "HKD" | "HUF" | "ISK" | "IDR" | "XDR" | "IRR" | "IQD" | "ILS" | "JMD" | "JPY" | "JOD" | "KZT" | "KES" | "KPW" | "KRW" | "KWD" | "KGS" | "LAK" | "LBP" | "LSL" | "ZAR" | "LRD" | "LYD" | "CHF" | "MOP" | "MGA" | "MWK" | "MYR" | "MVR" | "MRU" | "MUR" | "XUA" | "MXN" | "MXV" | "MDL" | "MNT" | "MAD" | "MZN" | "MMK" | "NAD" | "NPR" | "NIO" | "NGN" | "OMR" | "PKR" | "PAB" | "PGK" | "PYG" | "PEN" | "PHP" | "PLN" | "QAR" | "MKD" | "RON" | "RUB" | "RWF" | "SHP" | "WST" | "STN" | "SAR" | "RSD" | "SCR" | "SLE" | "SGD" | "XSU" | "SBD" | "SOS" | "SSP" | "LKR" | "SDG" | "SRD" | "SZL" | "SEK" | "CHE" | "CHW" | "SYP" | "TWD" | "TJS" | "TZS" | "THB" | "TOP" | "TTD" | "TND" | "TRY" | "TMT" | "UGX" | "UAH" | "AED" | "USN" | "UYI" | "UYU" | "UZS" | "VUV" | "VEF" | "VED" | "VND" | "YER" | "ZMW" | "ZWL");
|
|
2
|
+
export type LCYCurrency = ("AFN" | "ALL" | "DZD" | "USD" | "EUR" | "AOA" | "XCD" | "ARS" | "AMD" | "AWG" | "AUD" | "AZN" | "BSD" | "BHD" | "BDT" | "BBD" | "BYN" | "BZD" | "XOF" | "BMD" | "BTN" | "INR" | "BOB" | "BOV" | "BAM" | "BWP" | "NOK" | "BRL" | "BND" | "BGN" | "BIF" | "CVE" | "KHR" | "XAF" | "CAD" | "KYD" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "KMF" | "CDF" | "NZD" | "CRC" | "CUC" | "CUP" | "ANG" | "CZK" | "DKK" | "DJF" | "DOP" | "EGP" | "SVC" | "ERN" | "ETB" | "FKP" | "FJD" | "XPF" | "GMD" | "GEL" | "GHS" | "GIP" | "GTQ" | "GBP" | "GNF" | "GYD" | "HTG" | "HNL" | "HKD" | "HUF" | "ISK" | "IDR" | "XDR" | "IRR" | "IQD" | "ILS" | "JMD" | "JPY" | "JOD" | "KZT" | "KES" | "KPW" | "KRW" | "KWD" | "KGS" | "LAK" | "LBP" | "LSL" | "ZAR" | "LRD" | "LYD" | "CHF" | "MOP" | "MGA" | "MWK" | "MYR" | "MVR" | "MRU" | "MUR" | "XUA" | "MXN" | "MXV" | "MDL" | "MNT" | "MAD" | "MZN" | "MMK" | "NAD" | "NPR" | "NIO" | "NGN" | "OMR" | "PKR" | "PAB" | "PGK" | "PYG" | "PEN" | "PHP" | "PLN" | "QAR" | "MKD" | "RON" | "RUB" | "RWF" | "SHP" | "WST" | "STN" | "SAR" | "RSD" | "SCR" | "SLE" | "SGD" | "XSU" | "SBD" | "SOS" | "SSP" | "LKR" | "SDG" | "SRD" | "SZL" | "SEK" | "CHE" | "CHW" | "SYP" | "TWD" | "TJS" | "TZS" | "THB" | "TOP" | "TTD" | "TND" | "TRY" | "TMT" | "UGX" | "UAH" | "AED" | "USN" | "UYI" | "UYU" | "UZS" | "VUV" | "VEF" | "VED" | "VND" | "YER" | "ZMW" | "ZWL");
|
|
3
|
+
export interface __MainSchema {
|
|
4
|
+
style_id: string;
|
|
5
|
+
colour_id: string;
|
|
6
|
+
product_id: string;
|
|
7
|
+
size_code: string;
|
|
8
|
+
sku: string;
|
|
9
|
+
season_id: string;
|
|
10
|
+
drop: string;
|
|
11
|
+
document_line_no: string;
|
|
12
|
+
document_no: string;
|
|
13
|
+
created_at?: string;
|
|
14
|
+
location_code?: string;
|
|
15
|
+
quantity?: number;
|
|
16
|
+
quantity_received?: number;
|
|
17
|
+
quantity_to_receive?: number;
|
|
18
|
+
last_modified_at?: string;
|
|
19
|
+
expected_date?: string;
|
|
20
|
+
unit_price?: (Money | null);
|
|
21
|
+
}
|
|
22
|
+
export interface Money {
|
|
23
|
+
value: number;
|
|
24
|
+
decimal_places: number;
|
|
25
|
+
currency: Currency;
|
|
26
|
+
lcy_value: number;
|
|
27
|
+
lcy_currency: LCYCurrency;
|
|
28
|
+
lcy_decimal_places: number;
|
|
29
|
+
}
|
|
30
|
+
export default __MainSchema;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type Currency = ("AFN" | "ALL" | "DZD" | "USD" | "EUR" | "AOA" | "XCD" | "ARS" | "AMD" | "AWG" | "AUD" | "AZN" | "BSD" | "BHD" | "BDT" | "BBD" | "BYN" | "BZD" | "XOF" | "BMD" | "BTN" | "INR" | "BOB" | "BOV" | "BAM" | "BWP" | "NOK" | "BRL" | "BND" | "BGN" | "BIF" | "CVE" | "KHR" | "XAF" | "CAD" | "KYD" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "KMF" | "CDF" | "NZD" | "CRC" | "CUC" | "CUP" | "ANG" | "CZK" | "DKK" | "DJF" | "DOP" | "EGP" | "SVC" | "ERN" | "ETB" | "FKP" | "FJD" | "XPF" | "GMD" | "GEL" | "GHS" | "GIP" | "GTQ" | "GBP" | "GNF" | "GYD" | "HTG" | "HNL" | "HKD" | "HUF" | "ISK" | "IDR" | "XDR" | "IRR" | "IQD" | "ILS" | "JMD" | "JPY" | "JOD" | "KZT" | "KES" | "KPW" | "KRW" | "KWD" | "KGS" | "LAK" | "LBP" | "LSL" | "ZAR" | "LRD" | "LYD" | "CHF" | "MOP" | "MGA" | "MWK" | "MYR" | "MVR" | "MRU" | "MUR" | "XUA" | "MXN" | "MXV" | "MDL" | "MNT" | "MAD" | "MZN" | "MMK" | "NAD" | "NPR" | "NIO" | "NGN" | "OMR" | "PKR" | "PAB" | "PGK" | "PYG" | "PEN" | "PHP" | "PLN" | "QAR" | "MKD" | "RON" | "RUB" | "RWF" | "SHP" | "WST" | "STN" | "SAR" | "RSD" | "SCR" | "SLE" | "SGD" | "XSU" | "SBD" | "SOS" | "SSP" | "LKR" | "SDG" | "SRD" | "SZL" | "SEK" | "CHE" | "CHW" | "SYP" | "TWD" | "TJS" | "TZS" | "THB" | "TOP" | "TTD" | "TND" | "TRY" | "TMT" | "UGX" | "UAH" | "AED" | "USN" | "UYI" | "UYU" | "UZS" | "VUV" | "VEF" | "VED" | "VND" | "YER" | "ZMW" | "ZWL");
|
|
2
|
+
export type LCYCurrency = ("AFN" | "ALL" | "DZD" | "USD" | "EUR" | "AOA" | "XCD" | "ARS" | "AMD" | "AWG" | "AUD" | "AZN" | "BSD" | "BHD" | "BDT" | "BBD" | "BYN" | "BZD" | "XOF" | "BMD" | "BTN" | "INR" | "BOB" | "BOV" | "BAM" | "BWP" | "NOK" | "BRL" | "BND" | "BGN" | "BIF" | "CVE" | "KHR" | "XAF" | "CAD" | "KYD" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "KMF" | "CDF" | "NZD" | "CRC" | "CUC" | "CUP" | "ANG" | "CZK" | "DKK" | "DJF" | "DOP" | "EGP" | "SVC" | "ERN" | "ETB" | "FKP" | "FJD" | "XPF" | "GMD" | "GEL" | "GHS" | "GIP" | "GTQ" | "GBP" | "GNF" | "GYD" | "HTG" | "HNL" | "HKD" | "HUF" | "ISK" | "IDR" | "XDR" | "IRR" | "IQD" | "ILS" | "JMD" | "JPY" | "JOD" | "KZT" | "KES" | "KPW" | "KRW" | "KWD" | "KGS" | "LAK" | "LBP" | "LSL" | "ZAR" | "LRD" | "LYD" | "CHF" | "MOP" | "MGA" | "MWK" | "MYR" | "MVR" | "MRU" | "MUR" | "XUA" | "MXN" | "MXV" | "MDL" | "MNT" | "MAD" | "MZN" | "MMK" | "NAD" | "NPR" | "NIO" | "NGN" | "OMR" | "PKR" | "PAB" | "PGK" | "PYG" | "PEN" | "PHP" | "PLN" | "QAR" | "MKD" | "RON" | "RUB" | "RWF" | "SHP" | "WST" | "STN" | "SAR" | "RSD" | "SCR" | "SLE" | "SGD" | "XSU" | "SBD" | "SOS" | "SSP" | "LKR" | "SDG" | "SRD" | "SZL" | "SEK" | "CHE" | "CHW" | "SYP" | "TWD" | "TJS" | "TZS" | "THB" | "TOP" | "TTD" | "TND" | "TRY" | "TMT" | "UGX" | "UAH" | "AED" | "USN" | "UYI" | "UYU" | "UZS" | "VUV" | "VEF" | "VED" | "VND" | "YER" | "ZMW" | "ZWL");
|
|
3
|
+
export interface __MainSchema {
|
|
4
|
+
style_id: string;
|
|
5
|
+
colour_id: string;
|
|
6
|
+
size_code: string;
|
|
7
|
+
location_code: string;
|
|
8
|
+
source_system: ("bc" | "centra" | "sitoo");
|
|
9
|
+
quantity: number;
|
|
10
|
+
description?: string;
|
|
11
|
+
entry_no?: string;
|
|
12
|
+
external_entry_no?: string;
|
|
13
|
+
document_no?: string;
|
|
14
|
+
external_document_no?: string;
|
|
15
|
+
type: ("transfer" | "negative adjustment" | "positive adjustment" | "purchase" | "sale");
|
|
16
|
+
unit_cost?: (Money | null);
|
|
17
|
+
document_date: string;
|
|
18
|
+
posting_date?: string;
|
|
19
|
+
created_at: string;
|
|
20
|
+
last_modified_at: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Money {
|
|
23
|
+
value: number;
|
|
24
|
+
decimal_places: number;
|
|
25
|
+
currency: Currency;
|
|
26
|
+
lcy_value: number;
|
|
27
|
+
lcy_currency: LCYCurrency;
|
|
28
|
+
lcy_decimal_places: number;
|
|
29
|
+
}
|
|
30
|
+
export default __MainSchema;
|
|
@@ -45,15 +45,6 @@ declare class AirtableHelper<T extends Record<string, string>, K extends keyof T
|
|
|
45
45
|
fieldsToMergeOn?: Array<keyof T>;
|
|
46
46
|
primaryKeyWritable?: boolean;
|
|
47
47
|
typecast?: boolean;
|
|
48
|
-
}, callIdx?: number, collectedResult?: {
|
|
49
|
-
updatedRecords: Array<string>;
|
|
50
|
-
createdRecords: Array<string>;
|
|
51
|
-
records: Array<{
|
|
52
|
-
id: string;
|
|
53
|
-
fields: {
|
|
54
|
-
[key in T[keyof T]]: any;
|
|
55
|
-
};
|
|
56
|
-
} | Error>;
|
|
57
48
|
}): Promise<{
|
|
58
49
|
updatedRecords: Array<string>;
|
|
59
50
|
createdRecords: Array<string>;
|
|
@@ -140,6 +140,8 @@ export default class CentraHelper extends EnvEngine {
|
|
|
140
140
|
getCacheKeyForCountryCode(countryCode: string): string;
|
|
141
141
|
getCacheKeyForMarkets(): string;
|
|
142
142
|
getCacheKeyForMarket(marketExternalId: string): string;
|
|
143
|
+
getCacheKeyForCampaigns(): string;
|
|
144
|
+
getCacheKeyForCampaign(campaignName: string): string;
|
|
143
145
|
getCacheKeyForSizeCharts(): string;
|
|
144
146
|
getCacheKeyForCountries(): string;
|
|
145
147
|
getCacheKeyForCountry(countryIso2Code: string): string;
|
|
@@ -163,6 +165,7 @@ export default class CentraHelper extends EnvEngine {
|
|
|
163
165
|
private fetchCentraVariants;
|
|
164
166
|
getCentraWarehouses(externalIds?: string[] | null | undefined, alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicCentraWarehouse>>;
|
|
165
167
|
getCentraPricelists(names?: string[] | null | undefined, alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicPricelist>>;
|
|
168
|
+
getCentraCampaigns(alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicCentraMarket>>;
|
|
166
169
|
getCentraMarkets(alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicCentraMarket>>;
|
|
167
170
|
getCentraCountries(iso2Codes?: string[] | null | undefined, alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicCentraCountry>>;
|
|
168
171
|
getCentraSizeCharts(externalIds?: string[] | null | undefined, alwaysFetch?: boolean): Promise<Error | Record<string, Error | BasicCentraSizeChart>>;
|
|
@@ -17,3 +17,4 @@ export { default as setHeaders } from './setHeaders';
|
|
|
17
17
|
export { type CentraError, type CentraErrors, type BasicCentraCountry, type BasicCentraMarket, type BasicCentraSizeChart, type BasicPricelist, type BasicCentraWarehouse, type BasicCentraCampaign, type BasicCentraProduct, type BasicCentraVariant, type BasicCentraDisplay } from './centra';
|
|
18
18
|
export { default as RateLimit, RedisConnectionError } from './rateLimit';
|
|
19
19
|
export { type TriggerOnCreateOptions, type TriggerOnExecuteOptions, type NodeOptions, type RNConfiguration, type TriggerExtraOptions } from './types';
|
|
20
|
+
export { default as SitooHelper, type UnitCost, type StockMovementInput, type BasicSitooWarehouse, type BasicSitooStore, type BasicWarehouseTransaction, type WarehouseTransactionEnvelope, type WarehouseTransactionSyncOptions } from './sitoo';
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shushed/helpers",
|
|
3
|
-
"version": "0.0.223
|
|
3
|
+
"version": "0.0.223",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@google-cloud/firestore": "^7.11.1",
|
|
8
9
|
"@hackylabs/deep-redact": "^2.2.1",
|
|
9
10
|
"ajv": "^8.17.1",
|
|
10
11
|
"ajv-formats": "^3.0.1",
|
|
@@ -12,15 +13,15 @@
|
|
|
12
13
|
"jose": "^6.0.11",
|
|
13
14
|
"lodash.chunk": "^4.2.0",
|
|
14
15
|
"lodash.clonedeep": "^4.5.0",
|
|
16
|
+
"lodash.groupby": "^4.6.0",
|
|
15
17
|
"lodash.isequal": "^4.5.0",
|
|
16
18
|
"lodash.omit": "^4.5.0",
|
|
17
19
|
"lodash.pick": "^4.4.0",
|
|
18
20
|
"mime-types": "^3.0.1",
|
|
19
21
|
"p-limit": "^7.1.1",
|
|
20
22
|
"rate-limiter-flexible": "^7.2.0",
|
|
21
|
-
"uuid": "^11.1.0",
|
|
22
23
|
"redis": "^5.6.0",
|
|
23
|
-
"
|
|
24
|
+
"uuid": "^11.1.0"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"dist"
|