@shushed/helpers 0.0.227-main-20260107094010 → 0.0.227

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.
Files changed (41) hide show
  1. package/dist/cjs/contracts/index.js +5 -1
  2. package/dist/cjs/contracts/product-draft.schema.json +159 -5
  3. package/dist/cjs/contracts/purchase-orderline.schema.json +135 -0
  4. package/dist/cjs/contracts/stock-movement.schema.json +144 -0
  5. package/dist/cjs/dist-dereferenced/index.js +5 -1
  6. package/dist/cjs/dist-dereferenced/messages/product-draft.js +1 -1
  7. package/dist/cjs/dist-dereferenced/product-draft.js +1 -1
  8. package/dist/cjs/dist-dereferenced/purchase-orderline.js +4 -0
  9. package/dist/cjs/dist-dereferenced/stock-movement.js +4 -0
  10. package/dist/cjs/dist-types/purchase-orderline.js +2 -0
  11. package/dist/cjs/dist-types/stock-movement.js +2 -0
  12. package/dist/cjs/src-public/airtable.js +96 -59
  13. package/dist/cjs/src-public/centra.js +56 -5
  14. package/dist/cjs/src-public/env.js +1 -1
  15. package/dist/cjs/src-public/index.js +3 -1
  16. package/dist/cjs/src-public/pubsub.js +35 -10
  17. package/dist/cjs/src-public/runtime.js +48 -9
  18. package/dist/cjs/src-public/sitoo.js +349 -0
  19. package/dist/cjs/src-public/utils.js +3 -0
  20. package/dist/package.json +3 -2
  21. package/dist/types/contracts/index.d.ts +2 -0
  22. package/dist/types/dist-dereferenced/index.d.ts +2 -0
  23. package/dist/types/dist-dereferenced/messages/product-draft.d.ts +148 -1
  24. package/dist/types/dist-dereferenced/product-draft.d.ts +148 -1
  25. package/dist/types/dist-dereferenced/purchase-orderline.d.ts +114 -0
  26. package/dist/types/dist-dereferenced/stock-movement.d.ts +110 -0
  27. package/dist/types/dist-types/index.d.ts +2 -0
  28. package/dist/types/dist-types/messages/product-draft.d.ts +23 -4
  29. package/dist/types/dist-types/product-draft.d.ts +23 -4
  30. package/dist/types/dist-types/purchase-orderline.d.ts +31 -0
  31. package/dist/types/dist-types/stock-movement.d.ts +30 -0
  32. package/dist/types/src-public/airtable.d.ts +0 -9
  33. package/dist/types/src-public/centra.d.ts +3 -0
  34. package/dist/types/src-public/env.d.ts +1 -1
  35. package/dist/types/src-public/index.d.ts +1 -0
  36. package/dist/types/src-public/pubsub.d.ts +4 -1
  37. package/dist/types/src-public/runtime.d.ts +17 -4
  38. package/dist/types/src-public/sitoo.d.ts +254 -0
  39. package/dist/types/src-public/types.d.ts +6 -0
  40. package/dist/types/src-public/utils.d.ts +1 -1
  41. package/package.json +4 -3
@@ -2,26 +2,39 @@ export type Currency = ("AFN" | "ALL" | "DZD" | "USD" | "EUR" | "AOA" | "XCD" |
2
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
3
  export type Country = ("AF" | "AX" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BQ" | "BA" | "BW" | "BV" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "CV" | "KH" | "CM" | "CA" | "KY" | "CF" | "TD" | "CL" | "CN" | "CX" | "CC" | "CO" | "KM" | "CD" | "CG" | "CK" | "CR" | "CI" | "HR" | "CU" | "CW" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "SZ" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "TF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GG" | "GN" | "GW" | "GY" | "HT" | "HM" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MK" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PT" | "PR" | "QA" | "RE" | "RO" | "RU" | "RW" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SB" | "SO" | "ZA" | "GS" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "UM" | "US" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "EH" | "YE" | "ZM" | "ZW");
4
4
  export interface __MainSchema {
5
- development_colourway_id: string;
6
- development_style_id: string;
5
+ development_colourway_id?: string;
6
+ development_style_id?: string;
7
+ centric_id?: string;
8
+ style_centric_id?: string;
7
9
  product_id: string;
8
- created_at: string;
10
+ created_at?: string;
11
+ erp_settings?: (string | null);
12
+ erp_created_at?: (string | null);
13
+ erp_export_settings?: ("Exportable to Website" | "Exportable to Next" | "Available to sell")[];
9
14
  is_colourway_approved?: boolean;
10
15
  product_name?: (string | null);
16
+ erp_name?: (string | null);
11
17
  colour_id: string;
12
18
  colour_label?: (string | null);
13
19
  style_id: string;
14
- season_id: string;
20
+ season_id?: string;
15
21
  size_curves?: {
16
22
  channel?: string;
17
23
  name?: string;
18
24
  [k: string]: unknown;
19
25
  }[];
20
26
  plm_buying_quantities?: BuyingQuantitiesChannel[];
27
+ store_grade?: (string | null);
21
28
  drops?: DropChannel[];
29
+ direct_stock_buffer?: (number | null);
30
+ qa_completed?: (boolean | null);
31
+ warehouse_instructions?: (string | null);
32
+ available_to_sell_from?: (string | null);
33
+ processing_time_warehouse?: (number | null);
22
34
  stock_type?: (string | null);
23
35
  block?: (string | null);
24
36
  packing_method?: (string | null);
37
+ packaging_code?: (string | null);
25
38
  is_bought_in_product?: (boolean | null);
26
39
  reprocess_method?: (string | null);
27
40
  is_carry_over?: (boolean | null);
@@ -89,6 +102,9 @@ export interface __MainSchema {
89
102
  length_measurement?: (string | null);
90
103
  fabric_composition?: (string | null);
91
104
  };
105
+ preorder_options?: ("Never" | "Default" | "Weeks" | null);
106
+ preorder_num_period?: (string | null);
107
+ vat_posting_group_code?: (string | null);
92
108
  retail_price?: (Money | null);
93
109
  cost?: {
94
110
  current_cost?: (Money | null);
@@ -97,6 +113,8 @@ export interface __MainSchema {
97
113
  commission_rate?: (number | null);
98
114
  freight_rate?: (number | null);
99
115
  duty_rate?: (number | null);
116
+ unit_cost?: (Money | null);
117
+ last_direct_cost?: (Money | null);
100
118
  };
101
119
  duty?: {
102
120
  [k: string]: unknown;
@@ -110,6 +128,7 @@ export interface __MainSchema {
110
128
  port_of_origin?: (string | null);
111
129
  moq?: (number | null);
112
130
  supplier_id?: (string | null);
131
+ erp_supplier_id?: (string | null);
113
132
  supplier_name?: (string | null);
114
133
  factory_id?: (string | null);
115
134
  };
@@ -0,0 +1,31 @@
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
+ qa_completed_date?: string;
21
+ unit_price?: (Money | null);
22
+ }
23
+ export interface Money {
24
+ value: number;
25
+ decimal_places: number;
26
+ currency: Currency;
27
+ lcy_value: number;
28
+ lcy_currency: LCYCurrency;
29
+ lcy_decimal_places: number;
30
+ }
31
+ 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>>;
@@ -1,5 +1,5 @@
1
1
  import { IncomingMessage } from "http";
2
- import { type PubSub } from "@google-cloud/pubsub";
2
+ import type { PubSub } from "@google-cloud/pubsub";
3
3
  import { RateLimiterRedis } from "rate-limiter-flexible";
4
4
  import PubSubHelper from "./pubsub";
5
5
  import Runtime, { Opts as RuntimeOpts } from './runtime';
@@ -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';
@@ -5,6 +5,8 @@ declare global {
5
5
  var HUSH_PUBSUB_PUBLISH_TOPICS: Record<string, Topic>;
6
6
  }
7
7
  export declare function isSubscriptionBigQuery(opts: SubscriptionOptionsBigQuery | SubscriptionOptionsPull): opts is SubscriptionOptionsBigQuery;
8
+ type PublishAttributesGenerator<T> = (payload: any) => T;
9
+ type PublishAttributes = PublishAttributesGenerator<Record<string, string>> | Record<string, string> | Record<string, PublishAttributesGenerator<string | boolean | number> | boolean | number>;
8
10
  export type Message = {
9
11
  buildshipId: string;
10
12
  subscriptionName?: string;
@@ -57,7 +59,8 @@ declare class PubSubHelper extends Runtime {
57
59
  publish(options: Partial<Message> & {
58
60
  topicName: string;
59
61
  sourceSystem: string;
60
- attributesGenerator?: (payload: any) => Record<string, string>;
62
+ extraAttributes?: PublishAttributes;
63
+ attributesGenerator?: PublishAttributesGenerator<Record<string, string>>;
61
64
  }, payloads: Array<MessageBody>): Promise<Array<string | Error>>;
62
65
  createOrUpdate(opts: {
63
66
  topicName: string;
@@ -6,11 +6,9 @@ export type Opts = {
6
6
  workflowId?: string;
7
7
  workflow?: {
8
8
  id: string;
9
+ nodeValues?: Record<string, any>;
9
10
  };
10
11
  triggerId?: string;
11
- trigger?: {
12
- id: string;
13
- };
14
12
  url?: string;
15
13
  runtimeUrl?: string;
16
14
  request?: {
@@ -21,6 +19,12 @@ export type Opts = {
21
19
  triggerEnv?: any;
22
20
  runtimeEnv?: string;
23
21
  };
22
+ trigger?: {
23
+ id?: string;
24
+ meta?: {
25
+ name?: string;
26
+ };
27
+ };
24
28
  session?: {
25
29
  executedNodes: {
26
30
  [key: string]: {
@@ -45,13 +49,22 @@ export declare class Logging implements ILogging {
45
49
  export default class Runtime {
46
50
  readonly workflowId: string;
47
51
  readonly triggerId: string;
52
+ readonly triggerName: string;
53
+ readonly triggerVersion: string;
48
54
  readonly envName: string;
49
55
  readonly pubSubPrefix: string;
50
56
  readonly systemEnvName: string;
51
57
  readonly runtimeUrl: string;
52
58
  readonly logging: ILogging;
53
- readonly workflowRoot: any | null;
59
+ readonly triggerDataProperties: Record<string, any> | undefined;
60
+ readonly triggerConfigProperties: Record<string, any> | undefined;
61
+ readonly triggerConfig: Record<string, any> | undefined;
62
+ readonly workflowRoot: {
63
+ state?: Record<string, any>;
64
+ [key: string]: any;
65
+ };
54
66
  constructor(opts: Opts | Runtime);
67
+ enhanceWorkflowReturn(triggerReturn: any, triggerConfig: any): any;
55
68
  private getRuntimeUrl;
56
69
  private getSystemEnvName;
57
70
  private get isDeployment();
@@ -0,0 +1,254 @@
1
+ import EnvEngine from './env';
2
+ import Runtime from './runtime';
3
+ export declare enum SitooOrderState {
4
+ Abandoned = -1,
5
+ Open = 0,
6
+ Closed = 10,
7
+ Cancelled = 20
8
+ }
9
+ export declare enum SitooOrderType {
10
+ Order = 10,
11
+ Booking = 100,
12
+ POSParked = 110
13
+ }
14
+ export declare enum SitooPaymentState {
15
+ None = 0,
16
+ Pending = 10,
17
+ Reserved = 15,
18
+ Successful = 20,
19
+ Cancelled = 30,
20
+ Failed = 40
21
+ }
22
+ export declare enum SitooOrderItemType {
23
+ Product = 10,
24
+ Discount = 20
25
+ }
26
+ export interface SitooMoney {
27
+ value: string;
28
+ decimalplaces: number;
29
+ currency: string;
30
+ }
31
+ export interface SitooOrderItemSalesTax {
32
+ name: string;
33
+ code?: string;
34
+ externalid?: string | null;
35
+ groupregion?: string | null;
36
+ moneytotal: SitooMoney;
37
+ moneytax: SitooMoney;
38
+ decimaltaxvalue: string;
39
+ }
40
+ export interface SitooOrderItem {
41
+ orderitemid: number;
42
+ orderitemtype: SitooOrderItemType;
43
+ productid?: number;
44
+ productname: string;
45
+ sku?: string;
46
+ productattributes?: string;
47
+ externalid?: string | null;
48
+ externalidaliased?: string | null;
49
+ unitlabel?: string;
50
+ decimalunitquantity?: string;
51
+ quantity: number;
52
+ decimalquantity?: string;
53
+ moneyrowprice: SitooMoney;
54
+ moneyrowdiscount?: SitooMoney;
55
+ moneyrow: SitooMoney;
56
+ vatvalue?: number;
57
+ deliveryinfo?: string | null;
58
+ salestaxes?: SitooOrderItemSalesTax[];
59
+ additionaldata?: Record<string, string>;
60
+ }
61
+ export interface SitooOrderPayment {
62
+ name: string;
63
+ moneyamount: SitooMoney;
64
+ externalid?: string | null;
65
+ reftype?: string | null;
66
+ refid?: string | null;
67
+ cardissuer?: string | null;
68
+ additionaldata?: Record<string, string>;
69
+ reservedpaymentid?: string | null;
70
+ }
71
+ export interface SitooOrderReservedPayment {
72
+ id: string;
73
+ name: string;
74
+ moneyreserved: SitooMoney;
75
+ externalid?: string | null;
76
+ reftype?: string | null;
77
+ refid?: string | null;
78
+ cardissuer?: string | null;
79
+ additionaldata?: Record<string, string>;
80
+ }
81
+ export interface SitooOrder {
82
+ orderid: number;
83
+ orderstate: SitooOrderState;
84
+ ordertype: SitooOrderType;
85
+ paymentstate: SitooPaymentState;
86
+ datecreated: number;
87
+ datemodified?: number;
88
+ orderdate?: number;
89
+ ordertypename?: string;
90
+ registerid?: string;
91
+ warehouseid?: number;
92
+ storeid?: number;
93
+ email?: string | null;
94
+ namefirst?: string;
95
+ namelast?: string;
96
+ company?: string;
97
+ phone?: string | null;
98
+ personalid?: string;
99
+ externalid?: string | null;
100
+ comment?: string | null;
101
+ commentinternal?: string | null;
102
+ currencycode?: string;
103
+ moneytotal: SitooMoney;
104
+ moneytotaldiscount?: SitooMoney;
105
+ moneyrounding?: SitooMoney;
106
+ moneytotalpayments?: SitooMoney;
107
+ moneytotalreservedpayments?: SitooMoney;
108
+ orderitems?: SitooOrderItem[];
109
+ payments?: SitooOrderPayment[];
110
+ reservedpayments?: SitooOrderReservedPayment[];
111
+ additionaldata?: Record<string, string>;
112
+ address?: string;
113
+ address2?: string;
114
+ zip?: string;
115
+ city?: string;
116
+ state?: string;
117
+ countryid?: string;
118
+ invoicenamefirst?: string;
119
+ invoicenamelast?: string;
120
+ invoicecompany?: string;
121
+ invoiceaddress?: string;
122
+ invoiceaddress2?: string;
123
+ invoicezip?: string;
124
+ invoicecity?: string;
125
+ invoicestate?: string;
126
+ invoicecountryid?: string;
127
+ }
128
+ export interface GetAllOrdersOptions {
129
+ fromTimestamp?: number;
130
+ untilTimestamp?: number;
131
+ filterByState?: SitooOrderState;
132
+ }
133
+ export interface SitooOrdersEnvelope {
134
+ totalcount: number;
135
+ items: SitooOrder[];
136
+ }
137
+ export interface UnitCost {
138
+ value: number;
139
+ decimal_places: number;
140
+ currency: string;
141
+ lcy_value: number;
142
+ lcy_currency: string;
143
+ lcy_decimal_places: number;
144
+ }
145
+ export interface StockMovementInput {
146
+ style_id: string;
147
+ colour_id: string;
148
+ size_code: string;
149
+ location_code: string;
150
+ last_updated_at?: string;
151
+ entry_no: string;
152
+ quantity: number;
153
+ document_no: string;
154
+ external_document_no?: string;
155
+ type: 'transfer' | 'negative adjustment' | 'positive adjustment' | 'purchase' | 'sale';
156
+ unit_cost?: UnitCost;
157
+ document_date?: string;
158
+ posting_date?: string;
159
+ created_at: string;
160
+ }
161
+ export type BasicSitooWarehouse = {
162
+ warehouseid: number;
163
+ warehousetype: string;
164
+ usetype: string;
165
+ storeid: number;
166
+ sellable: boolean;
167
+ name: string;
168
+ externalId: number;
169
+ };
170
+ export type BasicSitooStore = {
171
+ storeid: number;
172
+ name: string;
173
+ externalId: number;
174
+ };
175
+ export type BasicWarehouseTransaction = {
176
+ warehousetransactionid: number;
177
+ warehouseid: number;
178
+ datecreated: number;
179
+ transactiontype: number;
180
+ description: string;
181
+ orderdeliveryid: number | null;
182
+ shipmentid: number | null;
183
+ externalid: string | null;
184
+ reasoncode: string | null;
185
+ items: Array<{
186
+ decimalquantity: string;
187
+ decimaltotal: string;
188
+ moneypricein: string;
189
+ moneytotal: string;
190
+ moneyvalue: string;
191
+ sku: string;
192
+ }>;
193
+ };
194
+ export type WarehouseTransactionEnvelope = {
195
+ totalcount: number;
196
+ items: BasicWarehouseTransaction[];
197
+ };
198
+ export interface WarehouseTransactionSyncOptions {
199
+ preview?: boolean;
200
+ skuGenerator?: (styleId: string, colourId: string, sizeCode: string) => string;
201
+ }
202
+ export interface WarehouseTransactionSyncResult {
203
+ found: Array<{
204
+ entryNo: string;
205
+ transactionId: number;
206
+ }>;
207
+ missing: string[];
208
+ created: Array<{
209
+ entryNo: string;
210
+ transactionId: number;
211
+ }>;
212
+ errors: Array<{
213
+ entryNo: string;
214
+ error: string;
215
+ }>;
216
+ firestoreUpdated: boolean;
217
+ skipped: Array<{
218
+ entryNo: string;
219
+ reason: string;
220
+ }>;
221
+ }
222
+ export interface FirestoreCacheDocument {
223
+ [entryNo: string]: number;
224
+ }
225
+ export default class SitooHelper extends EnvEngine {
226
+ protected opts: {
227
+ accessToken: string;
228
+ sitooBaseUrl: string;
229
+ sitooSiteId: number;
230
+ };
231
+ shaToken: string;
232
+ baseUrl: string;
233
+ siteId: number;
234
+ constructor(options: ConstructorParameters<typeof Runtime>[0], opts: {
235
+ accessToken: string;
236
+ sitooBaseUrl: string;
237
+ sitooSiteId: number;
238
+ });
239
+ getAllOrders(options?: GetAllOrdersOptions): Promise<SitooOrder[]>;
240
+ getSitooWarehouses(): Promise<{
241
+ nameToId: Record<string, number>;
242
+ warehouses: Record<number, BasicSitooWarehouse>;
243
+ }>;
244
+ private fetchWarehouseTransactionsWithFilter;
245
+ private searchTransactionsInApi;
246
+ private batchAddWarehouseTransactions;
247
+ syncWarehouseTransactions(items: StockMovementInput[], options?: WarehouseTransactionSyncOptions): Promise<Array<{
248
+ entryNo: string;
249
+ transactionId: number;
250
+ } | Error | {
251
+ error: boolean;
252
+ message: string;
253
+ }>>;
254
+ }
@@ -53,6 +53,12 @@ export type TriggerOnExecuteOptions = {
53
53
  };
54
54
  getBuildShipFile: (x: any) => any;
55
55
  trigger: {
56
+ config: {
57
+ properties: Record<string, any>;
58
+ };
59
+ data: {
60
+ properties: Record<string, any>;
61
+ };
56
62
  meta: {
57
63
  fileUploadLimit: boolean;
58
64
  name: string;
@@ -34,7 +34,7 @@ declare global {
34
34
  var functionsCache: Record<string, (symbol: symbol, payload: any) => any>;
35
35
  }
36
36
  export declare const FUNCTION_EXPR_ERROR: unique symbol;
37
- export declare function createFunction(expression: string): (payload: any) => any;
37
+ export declare function createFunction(expression: string | ((payload: any) => any)): (payload: any) => any;
38
38
  export declare function createOnResponse(opts: {
39
39
  requiredFlag: string;
40
40
  }): (config: any & {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.227-main-20260107094010",
3
+ "version": "0.0.227",
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
- "@google-cloud/firestore": "^7.11.1"
24
+ "uuid": "^11.1.0"
24
25
  },
25
26
  "files": [
26
27
  "dist"