@tonytang99/integration-canonical 1.0.0 → 1.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/README.md +414 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -15
- package/dist/index.js.map +1 -1
- package/dist/schemas/customer.d.ts +746 -0
- package/dist/schemas/customer.d.ts.map +1 -0
- package/dist/schemas/customer.js +282 -0
- package/dist/schemas/customer.js.map +1 -0
- package/dist/schemas/index.d.ts +13 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +33 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/inventory.d.ts +1642 -0
- package/dist/schemas/inventory.d.ts.map +1 -0
- package/dist/schemas/inventory.js +302 -0
- package/dist/schemas/inventory.js.map +1 -0
- package/dist/schemas/order.d.ts +1339 -0
- package/dist/schemas/order.d.ts.map +1 -0
- package/dist/schemas/order.js +310 -0
- package/dist/schemas/order.js.map +1 -0
- package/dist/schemas/product.d.ts +717 -0
- package/dist/schemas/product.d.ts.map +1 -0
- package/dist/schemas/product.js +303 -0
- package/dist/schemas/product.js.map +1 -0
- package/dist/slots.d.ts +572 -0
- package/dist/slots.d.ts.map +1 -0
- package/dist/slots.js +20 -0
- package/dist/slots.js.map +1 -0
- package/dist/types/common.d.ts +284 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +401 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/enrichments.d.ts +378 -0
- package/dist/types/enrichments.d.ts.map +1 -0
- package/dist/types/enrichments.js +96 -0
- package/dist/types/enrichments.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,9 +1,422 @@
|
|
|
1
1
|
# @tonytang99/integration-canonical
|
|
2
2
|
|
|
3
|
-
Canonical data models for integration
|
|
3
|
+
Canonical data models for the integration platform. These schemas provide a standardized intermediate format for data flowing between different e-commerce and ERP systems.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @tonytang99/integration-canonical
|
|
9
9
|
```
|
|
10
|
+
|
|
11
|
+
## Philosophy
|
|
12
|
+
|
|
13
|
+
The canonical schema is the **common language** spoken between all systems. Instead of building direct integrations between every pair of systems (N×N complexity), we transform data to/from canonical format (2N complexity).
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
BigCommerce → Canonical → MYOB
|
|
17
|
+
Adobe Commerce → Canonical → NetSuite
|
|
18
|
+
Shopify → Canonical → Xero
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Common Types
|
|
22
|
+
|
|
23
|
+
### Money
|
|
24
|
+
|
|
25
|
+
Money is represented in **minor units** (cents) to avoid floating-point precision issues.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { MoneySchema, MoneyHelper, type Money } from '@tonytang99/integration-canonical';
|
|
29
|
+
|
|
30
|
+
// Create money from dollars
|
|
31
|
+
const price = MoneyHelper.fromMajor(19.99, 'USD');
|
|
32
|
+
// { amount: 1999, currency: 'USD' }
|
|
33
|
+
|
|
34
|
+
// Convert to dollars
|
|
35
|
+
MoneyHelper.toMajor(price); // 19.99
|
|
36
|
+
|
|
37
|
+
// Format for display
|
|
38
|
+
MoneyHelper.format(price, 'en-US'); // "$19.99"
|
|
39
|
+
|
|
40
|
+
// Math operations
|
|
41
|
+
const total = MoneyHelper.add(
|
|
42
|
+
{ amount: 1999, currency: 'USD' },
|
|
43
|
+
{ amount: 500, currency: 'USD' }
|
|
44
|
+
); // { amount: 2499, currency: 'USD' }
|
|
45
|
+
|
|
46
|
+
const discounted = MoneyHelper.multiply(
|
|
47
|
+
{ amount: 1999, currency: 'USD' },
|
|
48
|
+
0.9
|
|
49
|
+
); // 10% off
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Why Minor Units?
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// ❌ BAD: Floating point errors
|
|
56
|
+
0.1 + 0.2 // 0.30000000000000004
|
|
57
|
+
|
|
58
|
+
// ✅ GOOD: Integer math
|
|
59
|
+
10 + 20 // 30 (representing $0.30)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Address
|
|
63
|
+
|
|
64
|
+
Comprehensive address schema supporting international addresses.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { AddressSchema, AddressHelper, type Address } from '@tonytang99/integration-canonical';
|
|
68
|
+
|
|
69
|
+
const address: Address = {
|
|
70
|
+
street1: '123 Main Street',
|
|
71
|
+
street2: 'Suite 100',
|
|
72
|
+
city: 'San Francisco',
|
|
73
|
+
state: 'California',
|
|
74
|
+
stateCode: 'CA',
|
|
75
|
+
postalCode: '94102',
|
|
76
|
+
country: 'United States',
|
|
77
|
+
countryCode: 'US',
|
|
78
|
+
|
|
79
|
+
// Optional contact info
|
|
80
|
+
firstName: 'John',
|
|
81
|
+
lastName: 'Doe',
|
|
82
|
+
company: 'Acme Corp',
|
|
83
|
+
phone: '555-1234',
|
|
84
|
+
email: 'john@acme.com',
|
|
85
|
+
|
|
86
|
+
// Metadata
|
|
87
|
+
type: 'billing',
|
|
88
|
+
isDefault: true,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Format address
|
|
92
|
+
AddressHelper.format(address);
|
|
93
|
+
// Output:
|
|
94
|
+
// Acme Corp
|
|
95
|
+
// John Doe
|
|
96
|
+
// 123 Main Street
|
|
97
|
+
// Suite 100
|
|
98
|
+
// San Francisco, CA, 94102
|
|
99
|
+
// United States
|
|
100
|
+
|
|
101
|
+
// Single line
|
|
102
|
+
AddressHelper.formatSingleLine(address);
|
|
103
|
+
// "Acme Corp, John Doe, 123 Main Street, Suite 100, San Francisco, CA, 94102, United States"
|
|
104
|
+
|
|
105
|
+
// Validate postal code
|
|
106
|
+
AddressHelper.isValidPostalCode('94102', 'US'); // true
|
|
107
|
+
AddressHelper.isValidPostalCode('941', 'US'); // false
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Phone Number
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { PhoneNumberSchema, PhoneNumberHelper } from '@tonytang99/integration-canonical';
|
|
114
|
+
|
|
115
|
+
const phone = {
|
|
116
|
+
number: '5551234567',
|
|
117
|
+
countryCode: '+1',
|
|
118
|
+
extension: '123',
|
|
119
|
+
type: 'mobile',
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
PhoneNumberHelper.format(phone); // "+1 5551234567 ext. 123"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Product Schema
|
|
126
|
+
|
|
127
|
+
Normalized product representation supporting:
|
|
128
|
+
- Simple products
|
|
129
|
+
- Products with variants (size, color, etc.)
|
|
130
|
+
- Pricing with compare-at prices (sales)
|
|
131
|
+
- Inventory tracking
|
|
132
|
+
- Images and media
|
|
133
|
+
- Physical properties (weight, dimensions)
|
|
134
|
+
- SEO metadata
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import {
|
|
138
|
+
CanonicalProductSchema,
|
|
139
|
+
ProductHelper,
|
|
140
|
+
MoneyHelper,
|
|
141
|
+
type CanonicalProduct
|
|
142
|
+
} from '@tonytang99/integration-canonical';
|
|
143
|
+
|
|
144
|
+
const product: CanonicalProduct = {
|
|
145
|
+
id: 'prod_123',
|
|
146
|
+
sku: 'WGT-ABC-001',
|
|
147
|
+
name: 'Premium Widget',
|
|
148
|
+
description: 'A high-quality widget for all your needs',
|
|
149
|
+
|
|
150
|
+
price: MoneyHelper.fromMajor(29.99, 'USD'),
|
|
151
|
+
compareAtPrice: MoneyHelper.fromMajor(39.99, 'USD'), // "Was $39.99"
|
|
152
|
+
|
|
153
|
+
inventory: {
|
|
154
|
+
quantity: 100,
|
|
155
|
+
tracked: true,
|
|
156
|
+
allowBackorder: false,
|
|
157
|
+
lowStockLevel: 10,
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
weight: {
|
|
161
|
+
value: 2.5,
|
|
162
|
+
unit: 'kg',
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
dimensions: {
|
|
166
|
+
length: 30,
|
|
167
|
+
width: 20,
|
|
168
|
+
height: 10,
|
|
169
|
+
unit: 'cm',
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
categories: ['widgets', 'premium'],
|
|
173
|
+
brand: 'Acme',
|
|
174
|
+
|
|
175
|
+
images: [
|
|
176
|
+
{
|
|
177
|
+
url: 'https://cdn.example.com/widget-1.jpg',
|
|
178
|
+
altText: 'Premium Widget Front View',
|
|
179
|
+
sortOrder: 1,
|
|
180
|
+
isThumbnail: true,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
|
|
184
|
+
isVisible: true,
|
|
185
|
+
availability: 'available',
|
|
186
|
+
condition: 'new',
|
|
187
|
+
|
|
188
|
+
metadata: {
|
|
189
|
+
source: 'bigcommerce',
|
|
190
|
+
sourceId: '12345',
|
|
191
|
+
createdAt: '2024-01-01T00:00:00Z',
|
|
192
|
+
updatedAt: '2024-01-30T10:00:00Z',
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// Validate
|
|
197
|
+
CanonicalProductSchema.parse(product); // throws if invalid
|
|
198
|
+
|
|
199
|
+
// Helper functions
|
|
200
|
+
ProductHelper.isInStock(product); // true
|
|
201
|
+
ProductHelper.isLowStock(product); // false (100 > 10)
|
|
202
|
+
|
|
203
|
+
const displayPrice = ProductHelper.getDisplayPrice(product);
|
|
204
|
+
// {
|
|
205
|
+
// price: { amount: 2999, currency: 'USD' },
|
|
206
|
+
// isOnSale: true,
|
|
207
|
+
// discount: { amount: 1000, currency: 'USD' }
|
|
208
|
+
// }
|
|
209
|
+
|
|
210
|
+
const thumbnail = ProductHelper.getThumbnail(product);
|
|
211
|
+
// { url: '...', altText: '...', isThumbnail: true }
|
|
212
|
+
|
|
213
|
+
const weightInKg = ProductHelper.getWeightInKg(product); // 2.5
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Product Variants
|
|
217
|
+
|
|
218
|
+
For products with options (size, color, etc.):
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const tshirt: CanonicalProduct = {
|
|
222
|
+
id: 'prod_tshirt',
|
|
223
|
+
sku: 'TSHIRT-BASE',
|
|
224
|
+
name: 'Premium T-Shirt',
|
|
225
|
+
price: MoneyHelper.fromMajor(24.99, 'USD'),
|
|
226
|
+
|
|
227
|
+
hasVariants: true,
|
|
228
|
+
variants: [
|
|
229
|
+
{
|
|
230
|
+
id: 'var_1',
|
|
231
|
+
sku: 'TSHIRT-RED-M',
|
|
232
|
+
options: {
|
|
233
|
+
color: 'Red',
|
|
234
|
+
size: 'Medium',
|
|
235
|
+
},
|
|
236
|
+
inventory: {
|
|
237
|
+
quantity: 50,
|
|
238
|
+
tracked: true,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: 'var_2',
|
|
243
|
+
sku: 'TSHIRT-BLU-L',
|
|
244
|
+
options: {
|
|
245
|
+
color: 'Blue',
|
|
246
|
+
size: 'Large',
|
|
247
|
+
},
|
|
248
|
+
inventory: {
|
|
249
|
+
quantity: 30,
|
|
250
|
+
tracked: true,
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
|
|
255
|
+
inventory: {
|
|
256
|
+
quantity: 80, // Total across all variants
|
|
257
|
+
tracked: true,
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
metadata: {
|
|
261
|
+
source: 'bigcommerce',
|
|
262
|
+
sourceId: '67890',
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// Get specific variant
|
|
267
|
+
const variant = ProductHelper.getVariantBySku(tshirt, 'TSHIRT-RED-M');
|
|
268
|
+
|
|
269
|
+
// Get total inventory
|
|
270
|
+
const total = ProductHelper.getTotalInventory(tshirt); // 80
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Design Principles
|
|
274
|
+
|
|
275
|
+
### 1. Explicit Over Implicit
|
|
276
|
+
|
|
277
|
+
All fields are explicitly typed. No `any` types unless absolutely necessary.
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// ✅ Good
|
|
281
|
+
price: MoneySchema
|
|
282
|
+
|
|
283
|
+
// ❌ Bad
|
|
284
|
+
price: z.any()
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### 2. Required vs Optional
|
|
288
|
+
|
|
289
|
+
Core fields are required. System-specific fields are optional.
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
{
|
|
293
|
+
sku: z.string(), // Required - every product has a SKU
|
|
294
|
+
name: z.string(), // Required - every product has a name
|
|
295
|
+
brand: z.string().optional(), // Optional - not all systems track brand
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 3. Metadata for System-Specific Data
|
|
300
|
+
|
|
301
|
+
Use `metadata` and `customFields` for data that doesn't fit the core schema.
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
{
|
|
305
|
+
metadata: {
|
|
306
|
+
source: 'bigcommerce',
|
|
307
|
+
sourceId: '12345',
|
|
308
|
+
externalIds: {
|
|
309
|
+
myob: 'STOCK-ABC',
|
|
310
|
+
netsuite: 'ITEM-999',
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
customFields: {
|
|
314
|
+
bigcommerce_product_type: 'physical',
|
|
315
|
+
myob_default_location: 'WAREHOUSE-A',
|
|
316
|
+
},
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### 4. Validation at Boundaries
|
|
321
|
+
|
|
322
|
+
Validate when data enters or leaves the canonical format.
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
// ✅ Validate when transforming TO canonical
|
|
326
|
+
const canonical = CanonicalProductSchema.parse(transformed);
|
|
327
|
+
|
|
328
|
+
// ✅ Validate when transforming FROM canonical
|
|
329
|
+
const myobData = MyobStockItemSchema.parse(transformed);
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Common Patterns
|
|
333
|
+
|
|
334
|
+
### Transforming TO Canonical
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import { CanonicalProductSchema, MoneyHelper } from '@tonytang99/integration-canonical';
|
|
338
|
+
|
|
339
|
+
function bigCommerceToCanonical(bcProduct: any): CanonicalProduct {
|
|
340
|
+
const canonical = {
|
|
341
|
+
id: String(bcProduct.id),
|
|
342
|
+
sku: bcProduct.sku,
|
|
343
|
+
name: bcProduct.name,
|
|
344
|
+
price: MoneyHelper.fromMajor(bcProduct.price, 'USD'),
|
|
345
|
+
inventory: {
|
|
346
|
+
quantity: bcProduct.inventory_level,
|
|
347
|
+
tracked: bcProduct.inventory_tracking !== 'none',
|
|
348
|
+
},
|
|
349
|
+
metadata: {
|
|
350
|
+
source: 'bigcommerce',
|
|
351
|
+
sourceId: String(bcProduct.id),
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// Validate before returning
|
|
356
|
+
return CanonicalProductSchema.parse(canonical);
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Transforming FROM Canonical
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
function canonicalToMyob(product: CanonicalProduct) {
|
|
364
|
+
return {
|
|
365
|
+
InventoryID: product.sku,
|
|
366
|
+
Description: product.name,
|
|
367
|
+
BasePrice: MoneyHelper.toMajor(product.price),
|
|
368
|
+
QuantityOnHand: product.inventory.quantity,
|
|
369
|
+
// ... more MYOB fields
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Testing
|
|
375
|
+
|
|
376
|
+
```typescript
|
|
377
|
+
import { CanonicalProductSchema, MoneyHelper } from '@tonytang99/integration-canonical';
|
|
378
|
+
|
|
379
|
+
describe('Product transformation', () => {
|
|
380
|
+
it('should transform BC product to canonical', () => {
|
|
381
|
+
const bcProduct = {
|
|
382
|
+
id: 123,
|
|
383
|
+
sku: 'ABC',
|
|
384
|
+
name: 'Widget',
|
|
385
|
+
price: 19.99,
|
|
386
|
+
inventory_level: 50,
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const canonical = {
|
|
390
|
+
id: '123',
|
|
391
|
+
sku: 'ABC',
|
|
392
|
+
name: 'Widget',
|
|
393
|
+
price: MoneyHelper.fromMajor(19.99, 'USD'),
|
|
394
|
+
inventory: {
|
|
395
|
+
quantity: 50,
|
|
396
|
+
tracked: true,
|
|
397
|
+
},
|
|
398
|
+
metadata: {
|
|
399
|
+
source: 'bigcommerce',
|
|
400
|
+
sourceId: '123',
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// This will throw if schema is invalid
|
|
405
|
+
expect(() => CanonicalProductSchema.parse(canonical)).not.toThrow();
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Future Schemas
|
|
411
|
+
|
|
412
|
+
Coming soon:
|
|
413
|
+
- `CanonicalOrder` - Orders and line items
|
|
414
|
+
- `CanonicalCustomer` - Customer data
|
|
415
|
+
- `CanonicalInventory` - Inventory movements
|
|
416
|
+
- `CanonicalCategory` - Product categories
|
|
417
|
+
- `CanonicalPayment` - Payment transactions
|
|
418
|
+
- `CanonicalShipment` - Shipping information
|
|
419
|
+
|
|
420
|
+
## License
|
|
421
|
+
|
|
422
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { MoneySchema, MoneyHelper, CurrencyCode, type Money, AddressSchema, MinimalAddressSchema, AddressHelper, AddressType, CountryCode, type Address, type MinimalAddress, PhoneNumberSchema, PhoneNumberHelper, type PhoneNumber, } from './types/common';
|
|
2
|
+
export { CanonicalProductSchema, MinimalProductSchema, ProductImageSchema, ProductVariantSchema, ProductWeightSchema, ProductDimensionsSchema, ProductAvailability, ProductCondition, type CanonicalProduct, type MinimalProduct, type ProductImage, type ProductVariant, type ProductWeight, type ProductDimensions, ProductHelper, } from './schemas/product';
|
|
3
|
+
export { CanonicalOrderSchema, OrderLineItemSchema, OrderCustomerSchema, ShippingMethodSchema, PaymentMethodSchema, OrderDiscountSchema, TaxLineSchema, OrderStatus, PaymentStatus, FulfillmentStatus, type CanonicalOrder, type OrderLineItem, type OrderCustomer, type ShippingMethod, type PaymentMethod, type OrderDiscount, type TaxLine, OrderHelper, } from './schemas/order';
|
|
4
|
+
export { CanonicalCustomerSchema, CustomerAddressSchema, CustomerStatsSchema, CustomerGroupSchema, CustomerStatus, type CanonicalCustomer, type CustomerAddress, type CustomerStats, type CustomerGroup, CustomerHelper, } from './schemas/customer';
|
|
5
|
+
export { CanonicalInventorySchema, InventoryLocationSchema, InventoryLevelSchema, InventoryMovementSchema, LocationType, InventoryMovementType, type CanonicalInventory, type InventoryLocation, type InventoryLevel, type InventoryMovement, InventoryHelper, } from './schemas/inventory';
|
|
2
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,KAAK,KAAK,EAGV,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,WAAW,EACX,KAAK,OAAO,EACZ,KAAK,cAAc,EAGnB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAEL,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EAGvB,mBAAmB,EACnB,gBAAgB,EAGhB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAGtB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EACX,aAAa,EACb,iBAAiB,EAGjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,OAAO,EAGZ,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAEL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EAGnB,cAAc,EAGd,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAGlB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAEL,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EAGvB,YAAY,EACZ,qBAAqB,EAGrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAGtB,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
2
|
+
// packages/canonical/src/index.ts
|
|
16
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
4
|
+
exports.InventoryHelper = exports.InventoryMovementType = exports.LocationType = exports.InventoryMovementSchema = exports.InventoryLevelSchema = exports.InventoryLocationSchema = exports.CanonicalInventorySchema = exports.CustomerHelper = exports.CustomerStatus = exports.CustomerGroupSchema = exports.CustomerStatsSchema = exports.CustomerAddressSchema = exports.CanonicalCustomerSchema = exports.OrderHelper = exports.FulfillmentStatus = exports.PaymentStatus = exports.OrderStatus = exports.TaxLineSchema = exports.OrderDiscountSchema = exports.PaymentMethodSchema = exports.ShippingMethodSchema = exports.OrderCustomerSchema = exports.OrderLineItemSchema = exports.CanonicalOrderSchema = exports.ProductHelper = exports.ProductCondition = exports.ProductAvailability = exports.ProductDimensionsSchema = exports.ProductWeightSchema = exports.ProductVariantSchema = exports.ProductImageSchema = exports.MinimalProductSchema = exports.CanonicalProductSchema = exports.PhoneNumberHelper = exports.PhoneNumberSchema = exports.CountryCode = exports.AddressType = exports.AddressHelper = exports.MinimalAddressSchema = exports.AddressSchema = exports.CurrencyCode = exports.MoneyHelper = exports.MoneySchema = void 0;
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// COMMON TYPES
|
|
7
|
+
// ============================================================================
|
|
8
|
+
var common_1 = require("./types/common");
|
|
9
|
+
// Money
|
|
10
|
+
Object.defineProperty(exports, "MoneySchema", { enumerable: true, get: function () { return common_1.MoneySchema; } });
|
|
11
|
+
Object.defineProperty(exports, "MoneyHelper", { enumerable: true, get: function () { return common_1.MoneyHelper; } });
|
|
12
|
+
Object.defineProperty(exports, "CurrencyCode", { enumerable: true, get: function () { return common_1.CurrencyCode; } });
|
|
13
|
+
// Address
|
|
14
|
+
Object.defineProperty(exports, "AddressSchema", { enumerable: true, get: function () { return common_1.AddressSchema; } });
|
|
15
|
+
Object.defineProperty(exports, "MinimalAddressSchema", { enumerable: true, get: function () { return common_1.MinimalAddressSchema; } });
|
|
16
|
+
Object.defineProperty(exports, "AddressHelper", { enumerable: true, get: function () { return common_1.AddressHelper; } });
|
|
17
|
+
Object.defineProperty(exports, "AddressType", { enumerable: true, get: function () { return common_1.AddressType; } });
|
|
18
|
+
Object.defineProperty(exports, "CountryCode", { enumerable: true, get: function () { return common_1.CountryCode; } });
|
|
19
|
+
// Phone
|
|
20
|
+
Object.defineProperty(exports, "PhoneNumberSchema", { enumerable: true, get: function () { return common_1.PhoneNumberSchema; } });
|
|
21
|
+
Object.defineProperty(exports, "PhoneNumberHelper", { enumerable: true, get: function () { return common_1.PhoneNumberHelper; } });
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// PRODUCT
|
|
24
|
+
// ============================================================================
|
|
25
|
+
var product_1 = require("./schemas/product");
|
|
26
|
+
// Schemas
|
|
27
|
+
Object.defineProperty(exports, "CanonicalProductSchema", { enumerable: true, get: function () { return product_1.CanonicalProductSchema; } });
|
|
28
|
+
Object.defineProperty(exports, "MinimalProductSchema", { enumerable: true, get: function () { return product_1.MinimalProductSchema; } });
|
|
29
|
+
Object.defineProperty(exports, "ProductImageSchema", { enumerable: true, get: function () { return product_1.ProductImageSchema; } });
|
|
30
|
+
Object.defineProperty(exports, "ProductVariantSchema", { enumerable: true, get: function () { return product_1.ProductVariantSchema; } });
|
|
31
|
+
Object.defineProperty(exports, "ProductWeightSchema", { enumerable: true, get: function () { return product_1.ProductWeightSchema; } });
|
|
32
|
+
Object.defineProperty(exports, "ProductDimensionsSchema", { enumerable: true, get: function () { return product_1.ProductDimensionsSchema; } });
|
|
33
|
+
// Enums
|
|
34
|
+
Object.defineProperty(exports, "ProductAvailability", { enumerable: true, get: function () { return product_1.ProductAvailability; } });
|
|
35
|
+
Object.defineProperty(exports, "ProductCondition", { enumerable: true, get: function () { return product_1.ProductCondition; } });
|
|
36
|
+
// Helpers
|
|
37
|
+
Object.defineProperty(exports, "ProductHelper", { enumerable: true, get: function () { return product_1.ProductHelper; } });
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// ORDER
|
|
40
|
+
// ============================================================================
|
|
41
|
+
var order_1 = require("./schemas/order");
|
|
42
|
+
// Schemas
|
|
43
|
+
Object.defineProperty(exports, "CanonicalOrderSchema", { enumerable: true, get: function () { return order_1.CanonicalOrderSchema; } });
|
|
44
|
+
Object.defineProperty(exports, "OrderLineItemSchema", { enumerable: true, get: function () { return order_1.OrderLineItemSchema; } });
|
|
45
|
+
Object.defineProperty(exports, "OrderCustomerSchema", { enumerable: true, get: function () { return order_1.OrderCustomerSchema; } });
|
|
46
|
+
Object.defineProperty(exports, "ShippingMethodSchema", { enumerable: true, get: function () { return order_1.ShippingMethodSchema; } });
|
|
47
|
+
Object.defineProperty(exports, "PaymentMethodSchema", { enumerable: true, get: function () { return order_1.PaymentMethodSchema; } });
|
|
48
|
+
Object.defineProperty(exports, "OrderDiscountSchema", { enumerable: true, get: function () { return order_1.OrderDiscountSchema; } });
|
|
49
|
+
Object.defineProperty(exports, "TaxLineSchema", { enumerable: true, get: function () { return order_1.TaxLineSchema; } });
|
|
50
|
+
// Enums
|
|
51
|
+
Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return order_1.OrderStatus; } });
|
|
52
|
+
Object.defineProperty(exports, "PaymentStatus", { enumerable: true, get: function () { return order_1.PaymentStatus; } });
|
|
53
|
+
Object.defineProperty(exports, "FulfillmentStatus", { enumerable: true, get: function () { return order_1.FulfillmentStatus; } });
|
|
54
|
+
// Helpers
|
|
55
|
+
Object.defineProperty(exports, "OrderHelper", { enumerable: true, get: function () { return order_1.OrderHelper; } });
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// CUSTOMER
|
|
58
|
+
// ============================================================================
|
|
59
|
+
var customer_1 = require("./schemas/customer");
|
|
60
|
+
// Schemas
|
|
61
|
+
Object.defineProperty(exports, "CanonicalCustomerSchema", { enumerable: true, get: function () { return customer_1.CanonicalCustomerSchema; } });
|
|
62
|
+
Object.defineProperty(exports, "CustomerAddressSchema", { enumerable: true, get: function () { return customer_1.CustomerAddressSchema; } });
|
|
63
|
+
Object.defineProperty(exports, "CustomerStatsSchema", { enumerable: true, get: function () { return customer_1.CustomerStatsSchema; } });
|
|
64
|
+
Object.defineProperty(exports, "CustomerGroupSchema", { enumerable: true, get: function () { return customer_1.CustomerGroupSchema; } });
|
|
65
|
+
// Enums
|
|
66
|
+
Object.defineProperty(exports, "CustomerStatus", { enumerable: true, get: function () { return customer_1.CustomerStatus; } });
|
|
67
|
+
// Helpers
|
|
68
|
+
Object.defineProperty(exports, "CustomerHelper", { enumerable: true, get: function () { return customer_1.CustomerHelper; } });
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// INVENTORY
|
|
71
|
+
// ============================================================================
|
|
72
|
+
var inventory_1 = require("./schemas/inventory");
|
|
73
|
+
// Schemas
|
|
74
|
+
Object.defineProperty(exports, "CanonicalInventorySchema", { enumerable: true, get: function () { return inventory_1.CanonicalInventorySchema; } });
|
|
75
|
+
Object.defineProperty(exports, "InventoryLocationSchema", { enumerable: true, get: function () { return inventory_1.InventoryLocationSchema; } });
|
|
76
|
+
Object.defineProperty(exports, "InventoryLevelSchema", { enumerable: true, get: function () { return inventory_1.InventoryLevelSchema; } });
|
|
77
|
+
Object.defineProperty(exports, "InventoryMovementSchema", { enumerable: true, get: function () { return inventory_1.InventoryMovementSchema; } });
|
|
78
|
+
// Enums
|
|
79
|
+
Object.defineProperty(exports, "LocationType", { enumerable: true, get: function () { return inventory_1.LocationType; } });
|
|
80
|
+
Object.defineProperty(exports, "InventoryMovementType", { enumerable: true, get: function () { return inventory_1.InventoryMovementType; } });
|
|
81
|
+
// Helpers
|
|
82
|
+
Object.defineProperty(exports, "InventoryHelper", { enumerable: true, get: function () { return inventory_1.InventoryHelper; } });
|
|
18
83
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AAElC,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAC/E,yCAoBwB;AAnBtB,QAAQ;AACR,qGAAA,WAAW,OAAA;AACX,qGAAA,WAAW,OAAA;AACX,sGAAA,YAAY,OAAA;AAGZ,UAAU;AACV,uGAAA,aAAa,OAAA;AACb,8GAAA,oBAAoB,OAAA;AACpB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,qGAAA,WAAW,OAAA;AAIX,QAAQ;AACR,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AAInB,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAC/E,6CAuB2B;AAtBzB,UAAU;AACV,iHAAA,sBAAsB,OAAA;AACtB,+GAAA,oBAAoB,OAAA;AACpB,6GAAA,kBAAkB,OAAA;AAClB,+GAAA,oBAAoB,OAAA;AACpB,8GAAA,mBAAmB,OAAA;AACnB,kHAAA,uBAAuB,OAAA;AAEvB,QAAQ;AACR,8GAAA,mBAAmB,OAAA;AACnB,2GAAA,gBAAgB,OAAA;AAUhB,UAAU;AACV,wGAAA,aAAa,OAAA;AAGf,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAC/E,yCA0ByB;AAzBvB,UAAU;AACV,6GAAA,oBAAoB,OAAA;AACpB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,6GAAA,oBAAoB,OAAA;AACpB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,sGAAA,aAAa,OAAA;AAEb,QAAQ;AACR,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AAWjB,UAAU;AACV,oGAAA,WAAW,OAAA;AAGb,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAC/E,+CAkB4B;AAjB1B,UAAU;AACV,mHAAA,uBAAuB,OAAA;AACvB,iHAAA,qBAAqB,OAAA;AACrB,+GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;AAEnB,QAAQ;AACR,0GAAA,cAAc,OAAA;AAQd,UAAU;AACV,0GAAA,cAAc,OAAA;AAGhB,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAC/E,iDAmB6B;AAlB3B,UAAU;AACV,qHAAA,wBAAwB,OAAA;AACxB,oHAAA,uBAAuB,OAAA;AACvB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AAEvB,QAAQ;AACR,yGAAA,YAAY,OAAA;AACZ,kHAAA,qBAAqB,OAAA;AAQrB,UAAU;AACV,4GAAA,eAAe,OAAA"}
|