@shushed/helpers 0.0.227-main-20260107085003 → 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
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Order = exports.MarketingPref = exports.CustomerSegment = exports.Asset = exports.DevelopmentColour = exports.Category = exports.ProductCategory = exports.Product = exports.ProductDraft = exports.Total = exports.Money = exports.Country = exports.Currency = void 0;
20
+ exports.Order = exports.PurchaseOrderline = exports.StockMovement = exports.MarketingPref = exports.CustomerSegment = exports.Asset = exports.DevelopmentColour = exports.Category = exports.ProductCategory = exports.Product = exports.ProductDraft = exports.Total = exports.Money = exports.Country = exports.Currency = void 0;
21
21
  var currency_schema_json_1 = require("./currency.schema.json");
22
22
  Object.defineProperty(exports, "Currency", { enumerable: true, get: function () { return __importDefault(currency_schema_json_1).default; } });
23
23
  var country_schema_json_1 = require("./country.schema.json");
@@ -42,6 +42,10 @@ var customer_segment_schema_json_1 = require("./customer-segment.schema.json");
42
42
  Object.defineProperty(exports, "CustomerSegment", { enumerable: true, get: function () { return __importDefault(customer_segment_schema_json_1).default; } });
43
43
  var marketing_preferences_schema_json_1 = require("./marketing-preferences.schema.json");
44
44
  Object.defineProperty(exports, "MarketingPref", { enumerable: true, get: function () { return __importDefault(marketing_preferences_schema_json_1).default; } });
45
+ var stock_movement_schema_json_1 = require("./stock-movement.schema.json");
46
+ Object.defineProperty(exports, "StockMovement", { enumerable: true, get: function () { return __importDefault(stock_movement_schema_json_1).default; } });
47
+ var purchase_orderline_schema_json_1 = require("./purchase-orderline.schema.json");
48
+ Object.defineProperty(exports, "PurchaseOrderline", { enumerable: true, get: function () { return __importDefault(purchase_orderline_schema_json_1).default; } });
45
49
  __exportStar(require("./order"), exports);
46
50
  var order_schema_json_1 = require("./order.schema.json");
47
51
  Object.defineProperty(exports, "Order", { enumerable: true, get: function () { return __importDefault(order_schema_json_1).default; } });
@@ -15,6 +15,18 @@
15
15
  "pattern": "^[A-Z]{2}\\d{2}[A-Z]+?-\\d{6}$",
16
16
  "description": "HS_Style_DevCode_String from Object Style; must match format like 'AW20FTW-000004'."
17
17
  },
18
+ "centric_id": {
19
+ "type": [
20
+ "string"
21
+ ],
22
+ "description": "Centric ID of the colourway"
23
+ },
24
+ "style_centric_id": {
25
+ "type": [
26
+ "string"
27
+ ],
28
+ "description": "Centric ID of the style"
29
+ },
18
30
  "product_id": {
19
31
  "type": [
20
32
  "string"
@@ -34,6 +46,32 @@
34
46
  ]
35
47
  }
36
48
  },
49
+ "erp_settings": {
50
+ "type": [
51
+ "string",
52
+ "null"
53
+ ]
54
+ },
55
+ "erp_created_at": {
56
+ "type": [
57
+ "string",
58
+ "null"
59
+ ],
60
+ "format": "date-time",
61
+ "description": "Items API response created_at"
62
+ },
63
+ "erp_export_settings": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string",
67
+ "enum": [
68
+ "Exportable to Website",
69
+ "Exportable to Next",
70
+ "Available to sell"
71
+ ]
72
+ },
73
+ "description": "HS_Colorway_Fabric_and_Care from Object Colorway - Example: Fabric unlined, do not tumble dry"
74
+ },
37
75
  "is_colourway_approved": {
38
76
  "type": "boolean",
39
77
  "description": "Is the colourway approved"
@@ -45,6 +83,13 @@
45
83
  ],
46
84
  "description": "HS_Style_OfficialName_String from Object Style - Example: Midi Cord Dress. Does not indiciate the colour of the level. Used to represented product name in the channels. "
47
85
  },
86
+ "erp_name": {
87
+ "type": [
88
+ "string",
89
+ "null"
90
+ ],
91
+ "description": "Items API response description"
92
+ },
48
93
  "colour_id": {
49
94
  "type": "string",
50
95
  "description": "ID of the colour inside the colour library. Part of the product ID (for the 000697-3203 it would be 3203). Warning! The id dos not link to a single generally-understood colour. I.e. leopard print has ~40 different colour ids. Instead it links to SPECIFIC leopard print ordered for this specific material (specific shared of Navy Dusk Blue etc.)"
@@ -108,6 +153,13 @@
108
153
  }
109
154
  }
110
155
  },
156
+ "store_grade": {
157
+ "type": [
158
+ "string",
159
+ "null"
160
+ ],
161
+ "description": "Items API response store_grade_group_hu"
162
+ },
111
163
  "drops": {
112
164
  "type": "array",
113
165
  "items": {
@@ -124,6 +176,42 @@
124
176
  }
125
177
  }
126
178
  },
179
+ "direct_stock_buffer": {
180
+ "type": [
181
+ "number",
182
+ "null"
183
+ ],
184
+ "description": "Items API response safe_level_hu"
185
+ },
186
+ "qa_completed": {
187
+ "type": [
188
+ "boolean",
189
+ "null"
190
+ ],
191
+ "description": "Whether QA has been completed for this product"
192
+ },
193
+ "warehouse_instructions": {
194
+ "type": [
195
+ "string",
196
+ "null"
197
+ ],
198
+ "description": "Items API response warehouse_instructions_hu"
199
+ },
200
+ "available_to_sell_from": {
201
+ "type": [
202
+ "string",
203
+ "null"
204
+ ],
205
+ "format": "date-time",
206
+ "description": "Date from which the product is available to sell"
207
+ },
208
+ "processing_time_warehouse": {
209
+ "type": [
210
+ "number",
211
+ "null"
212
+ ],
213
+ "description": "Processing time at the warehouse in days"
214
+ },
127
215
  "stock_type": {
128
216
  "type": [
129
217
  "string",
@@ -145,6 +233,13 @@
145
233
  ],
146
234
  "description": "HS_StyleAttr_DeliveryMethod_Enum from Object StyleAttributes"
147
235
  },
236
+ "packaging_code": {
237
+ "type": [
238
+ "string",
239
+ "null"
240
+ ],
241
+ "description": "Items API response packaging_code_tnp"
242
+ },
148
243
  "is_bought_in_product": {
149
244
  "type": [
150
245
  "boolean",
@@ -607,6 +702,33 @@
607
702
  }
608
703
  }
609
704
  },
705
+ "preorder_options": {
706
+ "type": [
707
+ "string",
708
+ "null"
709
+ ],
710
+ "enum": [
711
+ "Never",
712
+ "Default",
713
+ "Weeks",
714
+ null
715
+ ],
716
+ "description": "Items API response pre_orderable_hu"
717
+ },
718
+ "preorder_num_period": {
719
+ "type": [
720
+ "string",
721
+ "null"
722
+ ],
723
+ "description": "Items API response i.e. 5W"
724
+ },
725
+ "vat_posting_group_code": {
726
+ "type": [
727
+ "string",
728
+ "null"
729
+ ],
730
+ "description": "Items API response vat_prod_posting_group"
731
+ },
610
732
  "retail_price": {
611
733
  "oneOf": [
612
734
  {
@@ -671,6 +793,28 @@
671
793
  "null"
672
794
  ],
673
795
  "description": "The decimal value of the duty rate"
796
+ },
797
+ "unit_cost": {
798
+ "oneOf": [
799
+ {
800
+ "$ref": "https://shushed.example.com/money.schema.json"
801
+ },
802
+ {
803
+ "type": "null"
804
+ }
805
+ ],
806
+ "description": "Items API response unit_cost"
807
+ },
808
+ "last_direct_cost": {
809
+ "oneOf": [
810
+ {
811
+ "$ref": "https://shushed.example.com/money.schema.json"
812
+ },
813
+ {
814
+ "type": "null"
815
+ }
816
+ ],
817
+ "description": "Items API response last_direct_cost"
674
818
  }
675
819
  }
676
820
  },
@@ -695,6 +839,13 @@
695
839
  "null"
696
840
  ],
697
841
  "description": "Commodity rate in the format 'C0/101888|DutyRate'"
842
+ },
843
+ "tariff_no": {
844
+ "type": [
845
+ "string",
846
+ "null"
847
+ ],
848
+ "description": "Items API response tariff_no"
698
849
  }
699
850
  },
700
851
  "payment_terms": {
@@ -753,6 +904,13 @@
753
904
  ],
754
905
  "description": "Supplier ID in the format 'SUP00099', where 'SUP' is followed by exactly five digits - Example: HCM PORT (VIETNAM LCL)"
755
906
  },
907
+ "erp_supplier_id": {
908
+ "type": [
909
+ "string",
910
+ "null"
911
+ ],
912
+ "description": "Items API response vendor_no"
913
+ },
756
914
  "supplier_name": {
757
915
  "type": [
758
916
  "string",
@@ -771,12 +929,8 @@
771
929
  }
772
930
  },
773
931
  "required": [
774
- "development_colourway_id",
775
- "development_style_id",
776
932
  "product_id",
777
933
  "colour_id",
778
- "style_id",
779
- "created_at",
780
- "season_id"
934
+ "style_id"
781
935
  ]
782
936
  }
@@ -0,0 +1,135 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://shushed.example.com/stock-move.schema.json",
4
+ "title": "Stock Movement Schema",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "style_id": {
9
+ "type": "string",
10
+ "minLength": 1,
11
+ "faker": {
12
+ "custom.style": []
13
+ },
14
+ "description": "Style Code - Example: 000697"
15
+ },
16
+ "colour_id": {
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "faker": {
20
+ "custom.color": []
21
+ },
22
+ "description": "Colour Code - Example: 3203"
23
+ },
24
+ "product_id": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "description": "Combination of style_id and colour_id"
28
+ },
29
+ "size_code": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "description": "Variant code, e.g., XS, M, XL, ONE, or numeric like 10, 37, 40"
33
+ },
34
+ "sku": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "description": "Full sku of the product_id + size_code"
38
+ },
39
+ "season_id": {
40
+ "type": "string",
41
+ "description": "Code must match format like 'AW20'"
42
+ },
43
+ "drop": {
44
+ "type": "string",
45
+ "description": "Code for the drop i.e. AUGUST"
46
+ },
47
+ "document_line_no": {
48
+ "type": "string",
49
+ "description": "Line number for the document of the Purchase Line"
50
+ },
51
+ "document_no": {
52
+ "type": "string",
53
+ "description": "Document No for this purchase line"
54
+ },
55
+ "created_at": {
56
+ "type": "string",
57
+ "format": "date-time",
58
+ "description": "Date time of the creation of the record. Preferably creation time of the item ledger entry",
59
+ "faker": {
60
+ "date.between": [
61
+ "2024-01-01T00:00:00.000Z",
62
+ "2025-04-30T00:00:00.000Z"
63
+ ]
64
+ }
65
+ },
66
+ "location_code": {
67
+ "type": "string",
68
+ "description": "Valid location code like 001-DR, JL200, HEADOFFICE"
69
+ },
70
+ "quantity": {
71
+ "type": "number"
72
+ },
73
+ "quantity_received": {
74
+ "type": "number"
75
+ },
76
+ "quantity_to_receive": {
77
+ "type": "number"
78
+ },
79
+ "last_modified_at": {
80
+ "type": "string",
81
+ "format": "date-time",
82
+ "description": "Datetime of the last created_at in the history",
83
+ "faker": {
84
+ "date.between": [
85
+ "2024-01-01T00:00:00.000Z",
86
+ "2025-04-30T00:00:00.000Z"
87
+ ]
88
+ }
89
+ },
90
+ "expected_date": {
91
+ "type": "string",
92
+ "format": "date-time",
93
+ "description": "Datetime of item expected date in the inventory. Since the day is expected always keep to the ISO 00:00 of any day",
94
+ "faker": {
95
+ "date.between": [
96
+ "2024-01-01T00:00:00.000Z",
97
+ "2025-04-30T00:00:00.000Z"
98
+ ]
99
+ }
100
+ },
101
+ "qa_completed_date": {
102
+ "type": "string",
103
+ "format": "date-time",
104
+ "description": "Date of completing QA. Useful to calculate the available to sell date: Available to Sell Date = QA Completed Date + Processing Days. The system looks up the Item and its Style Colour nH settings: Check Reprocess Method: If Style Colour nH.\"Reprocess Method HU\" is 'Standard': If Use Default Processing Time HU is True, it adds Inventory Setup.\"Default Processing (Days)\". If Use Default Processing Time HU is False, it adds Style Colour nH.\"Torque Processing (Days)\". If Reprocess Method HU is not 'Standard' (or if no Style/Item record is found), it adds 0 days (so Available Date = QA Date).",
105
+ "faker": {
106
+ "date.between": [
107
+ "2024-01-01T00:00:00.000Z",
108
+ "2025-04-30T00:00:00.000Z"
109
+ ]
110
+ }
111
+ },
112
+ "unit_price": {
113
+ "oneOf": [
114
+ {
115
+ "$ref": "https://shushed.example.com/money.schema.json"
116
+ },
117
+ {
118
+ "type": "null"
119
+ }
120
+ ],
121
+ "description": "Cost/Price of unit, can be null"
122
+ }
123
+ },
124
+ "required": [
125
+ "document_no",
126
+ "document_line_no",
127
+ "style_id",
128
+ "colour_id",
129
+ "size_code",
130
+ "sku",
131
+ "product_id",
132
+ "season_id",
133
+ "drop"
134
+ ]
135
+ }
@@ -0,0 +1,144 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://shushed.example.com/stock-move.schema.json",
4
+ "title": "Stock Movement Schema",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "style_id": {
9
+ "type": "string",
10
+ "minLength": 1,
11
+ "faker": {
12
+ "custom.style": []
13
+ },
14
+ "description": "Style Code - Example: 000697"
15
+ },
16
+ "colour_id": {
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "faker": {
20
+ "custom.color": []
21
+ },
22
+ "description": "Colour Code - Example: 3203"
23
+ },
24
+ "size_code": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "description": "Variant code, e.g., XS, M, XL, ONE, or numeric like 10, 37, 40"
28
+ },
29
+ "location_code": {
30
+ "type": "string",
31
+ "pattern": "^\\d{3}-[A-Z]+$|^[A-Z]{2,}-?[A-Z]*$|^[A-Z]{2,}\\d{3}$",
32
+ "description": "Valid location code like 001-DR, JL200, HEADOFFICE"
33
+ },
34
+ "source_system": {
35
+ "type": "string",
36
+ "enum": [
37
+ "bc",
38
+ "centra",
39
+ "sitoo"
40
+ ]
41
+ },
42
+ "quantity": {
43
+ "type": "integer",
44
+ "minimum": 0,
45
+ "description": "Quantity of stock available on hand"
46
+ },
47
+ "description": {
48
+ "type": "string"
49
+ },
50
+ "entry_no": {
51
+ "type": "string",
52
+ "description": "BC Entry no. Should be empty for other systems"
53
+ },
54
+ "external_entry_no": {
55
+ "type": "string",
56
+ "description": "External Entry no. Might be empty for other systems"
57
+ },
58
+ "document_no": {
59
+ "type": "string",
60
+ "description": "BC Document no. Should be empty for other systems"
61
+ },
62
+ "external_document_no": {
63
+ "type": "string",
64
+ "description": "Original document i.e. Sitoo ID that caused the change"
65
+ },
66
+ "type": {
67
+ "type": "string",
68
+ "enum": [
69
+ "transfer",
70
+ "negative adjustment",
71
+ "positive adjustment",
72
+ "purchase",
73
+ "sale"
74
+ ]
75
+ },
76
+ "unit_cost": {
77
+ "oneOf": [
78
+ {
79
+ "$ref": "https://shushed.example.com/money.schema.json"
80
+ },
81
+ {
82
+ "type": "null"
83
+ }
84
+ ],
85
+ "description": "Cost per unit, can be null"
86
+ },
87
+ "document_date": {
88
+ "type": "string",
89
+ "format": "date",
90
+ "description": "Date of the creation of the document. Preferably creation time of the item ledger entry",
91
+ "faker": {
92
+ "date.between": [
93
+ "2024-01-01",
94
+ "2025-04-30"
95
+ ]
96
+ }
97
+ },
98
+ "posting_date": {
99
+ "type": "string",
100
+ "format": "date",
101
+ "description": "Date of posting the record in BC. This should be empty for non-BC systems. Preferably creation time of the item ledger entry",
102
+ "faker": {
103
+ "date.between": [
104
+ "2024-01-01",
105
+ "2025-04-30"
106
+ ]
107
+ }
108
+ },
109
+ "created_at": {
110
+ "type": "string",
111
+ "format": "date-time",
112
+ "description": "Date time of the creation of the record. Preferably creation time of the item ledger entry",
113
+ "faker": {
114
+ "date.between": [
115
+ "2024-01-01T00:00:00.000Z",
116
+ "2025-04-30T00:00:00.000Z"
117
+ ]
118
+ }
119
+ },
120
+ "last_modified_at": {
121
+ "type": "string",
122
+ "format": "date-time",
123
+ "description": "Datetime of the last created_at in the history",
124
+ "faker": {
125
+ "date.between": [
126
+ "2024-01-01T00:00:00.000Z",
127
+ "2025-04-30T00:00:00.000Z"
128
+ ]
129
+ }
130
+ }
131
+ },
132
+ "required": [
133
+ "style_id",
134
+ "source_system",
135
+ "location_code",
136
+ "colour_id",
137
+ "size_code",
138
+ "last_modified_at",
139
+ "quantity",
140
+ "created_at",
141
+ "document_date",
142
+ "type"
143
+ ]
144
+ }
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Order = exports.Messages = exports.Total = exports.Stock = exports.Product = exports.ProductDraft = exports.ProductCategory = exports.Price = exports.Money = exports.MarketingPreferences = exports.DevelopmentColour = exports.CustomerSegment = exports.Currency = exports.Country = exports.Category = exports.Asset = void 0;
39
+ exports.Order = exports.Messages = exports.Total = exports.Stock = exports.StockMovement = exports.PurchaseOrderline = exports.Product = exports.ProductDraft = exports.ProductCategory = exports.Price = exports.Money = exports.MarketingPreferences = exports.DevelopmentColour = exports.CustomerSegment = exports.Currency = exports.Country = exports.Category = exports.Asset = void 0;
40
40
  var asset_1 = require("./asset");
41
41
  Object.defineProperty(exports, "Asset", { enumerable: true, get: function () { return __importDefault(asset_1).default; } });
42
42
  var category_1 = require("./category");
@@ -61,6 +61,10 @@ var product_draft_1 = require("./product-draft");
61
61
  Object.defineProperty(exports, "ProductDraft", { enumerable: true, get: function () { return __importDefault(product_draft_1).default; } });
62
62
  var product_1 = require("./product");
63
63
  Object.defineProperty(exports, "Product", { enumerable: true, get: function () { return __importDefault(product_1).default; } });
64
+ var purchase_orderline_1 = require("./purchase-orderline");
65
+ Object.defineProperty(exports, "PurchaseOrderline", { enumerable: true, get: function () { return __importDefault(purchase_orderline_1).default; } });
66
+ var stock_movement_1 = require("./stock-movement");
67
+ Object.defineProperty(exports, "StockMovement", { enumerable: true, get: function () { return __importDefault(stock_movement_1).default; } });
64
68
  var stock_1 = require("./stock");
65
69
  Object.defineProperty(exports, "Stock", { enumerable: true, get: function () { return __importDefault(stock_1).default; } });
66
70
  var total_1 = require("./total");