digital-tools 2.0.2 → 2.1.1
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/CHANGELOG.md +17 -0
- package/package.json +3 -4
- package/src/define.js +267 -0
- package/src/entities/advertising.js +999 -0
- package/src/entities/ai.js +756 -0
- package/src/entities/analytics.js +1588 -0
- package/src/entities/automation.js +601 -0
- package/src/entities/communication.js +1150 -0
- package/src/entities/crm.js +1386 -0
- package/src/entities/design.js +546 -0
- package/src/entities/development.js +2212 -0
- package/src/entities/document.js +874 -0
- package/src/entities/ecommerce.js +1429 -0
- package/src/entities/experiment.js +1039 -0
- package/src/entities/finance.js +3478 -0
- package/src/entities/forms.js +1892 -0
- package/src/entities/hr.js +661 -0
- package/src/entities/identity.js +997 -0
- package/src/entities/index.js +282 -0
- package/src/entities/infrastructure.js +1153 -0
- package/src/entities/knowledge.js +1438 -0
- package/src/entities/marketing.js +1610 -0
- package/src/entities/media.js +1634 -0
- package/src/entities/notification.js +1199 -0
- package/src/entities/presentation.js +1274 -0
- package/src/entities/productivity.js +1317 -0
- package/src/entities/project-management.js +1136 -0
- package/src/entities/recruiting.js +736 -0
- package/src/entities/shipping.js +509 -0
- package/src/entities/signature.js +1102 -0
- package/src/entities/site.js +222 -0
- package/src/entities/spreadsheet.js +1341 -0
- package/src/entities/storage.js +1198 -0
- package/src/entities/support.js +1166 -0
- package/src/entities/video-conferencing.js +1750 -0
- package/src/entities/video.js +950 -0
- package/src/entities.js +1663 -0
- package/src/index.js +74 -0
- package/src/providers/analytics/index.js +17 -0
- package/src/providers/analytics/mixpanel.js +255 -0
- package/src/providers/calendar/cal-com.js +303 -0
- package/src/providers/calendar/google-calendar.js +335 -0
- package/src/providers/calendar/index.js +20 -0
- package/src/providers/crm/hubspot.js +566 -0
- package/src/providers/crm/index.js +17 -0
- package/src/providers/development/github.js +472 -0
- package/src/providers/development/index.js +17 -0
- package/src/providers/ecommerce/index.js +17 -0
- package/src/providers/ecommerce/shopify.js +378 -0
- package/src/providers/email/index.js +20 -0
- package/src/providers/email/resend.js +258 -0
- package/src/providers/email/sendgrid.js +161 -0
- package/src/providers/finance/index.js +17 -0
- package/src/providers/finance/stripe.js +549 -0
- package/src/providers/forms/index.js +17 -0
- package/src/providers/forms/typeform.js +500 -0
- package/src/providers/index.js +123 -0
- package/src/providers/knowledge/index.js +17 -0
- package/src/providers/knowledge/notion.js +389 -0
- package/src/providers/marketing/index.js +17 -0
- package/src/providers/marketing/mailchimp.js +443 -0
- package/src/providers/media/cloudinary.js +318 -0
- package/src/providers/media/index.js +17 -0
- package/src/providers/messaging/index.js +20 -0
- package/src/providers/messaging/slack.js +393 -0
- package/src/providers/messaging/twilio-sms.js +249 -0
- package/src/providers/project-management/index.js +17 -0
- package/src/providers/project-management/linear.js +575 -0
- package/src/providers/registry.js +86 -0
- package/src/providers/spreadsheet/google-sheets.js +375 -0
- package/src/providers/spreadsheet/index.js +20 -0
- package/src/providers/spreadsheet/xlsx.js +423 -0
- package/src/providers/storage/index.js +24 -0
- package/src/providers/storage/s3.js +419 -0
- package/src/providers/support/index.js +17 -0
- package/src/providers/support/zendesk.js +373 -0
- package/src/providers/tasks/index.js +17 -0
- package/src/providers/tasks/todoist.js +286 -0
- package/src/providers/types.js +9 -0
- package/src/providers/video-conferencing/google-meet.js +286 -0
- package/src/providers/video-conferencing/index.js +31 -0
- package/src/providers/video-conferencing/jitsi.js +254 -0
- package/src/providers/video-conferencing/teams.js +270 -0
- package/src/providers/video-conferencing/zoom.js +332 -0
- package/src/registry.js +128 -0
- package/src/tools/communication.js +184 -0
- package/src/tools/data.js +205 -0
- package/src/tools/index.js +11 -0
- package/src/tools/web.js +137 -0
- package/src/types.js +10 -0
- package/test/define.test.js +306 -0
- package/test/registry.test.js +357 -0
- package/test/tools.test.js +363 -0
|
@@ -0,0 +1,1429 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E-Commerce Entity Types (Nouns)
|
|
3
|
+
*
|
|
4
|
+
* Semantic type definitions for e-commerce digital tools that can be used by
|
|
5
|
+
* both remote human workers AND AI agents. Each entity defines:
|
|
6
|
+
* - Properties: The data fields
|
|
7
|
+
* - Actions: Operations that can be performed (Verbs)
|
|
8
|
+
* - Events: State changes that occur
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Product
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Product entity
|
|
17
|
+
*
|
|
18
|
+
* Represents a product that can be sold in an e-commerce store
|
|
19
|
+
*/
|
|
20
|
+
export const Product = {
|
|
21
|
+
singular: 'product',
|
|
22
|
+
plural: 'products',
|
|
23
|
+
description: 'A product that can be sold in an e-commerce store',
|
|
24
|
+
properties: {
|
|
25
|
+
// Identity
|
|
26
|
+
sku: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Stock Keeping Unit - unique product identifier',
|
|
29
|
+
},
|
|
30
|
+
name: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Product name',
|
|
33
|
+
},
|
|
34
|
+
slug: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
optional: true,
|
|
37
|
+
description: 'URL-friendly version of the product name',
|
|
38
|
+
},
|
|
39
|
+
// Content
|
|
40
|
+
description: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
optional: true,
|
|
43
|
+
description: 'Product description',
|
|
44
|
+
},
|
|
45
|
+
shortDescription: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
optional: true,
|
|
48
|
+
description: 'Brief product summary',
|
|
49
|
+
},
|
|
50
|
+
features: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
array: true,
|
|
53
|
+
optional: true,
|
|
54
|
+
description: 'List of product features',
|
|
55
|
+
},
|
|
56
|
+
specifications: {
|
|
57
|
+
type: 'json',
|
|
58
|
+
optional: true,
|
|
59
|
+
description: 'Technical specifications and attributes',
|
|
60
|
+
},
|
|
61
|
+
// Pricing
|
|
62
|
+
price: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
description: 'Base price of the product',
|
|
65
|
+
},
|
|
66
|
+
compareAtPrice: {
|
|
67
|
+
type: 'number',
|
|
68
|
+
optional: true,
|
|
69
|
+
description: 'Original price for comparison (for showing discounts)',
|
|
70
|
+
},
|
|
71
|
+
cost: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
optional: true,
|
|
74
|
+
description: 'Cost of goods (for internal use)',
|
|
75
|
+
},
|
|
76
|
+
currency: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Currency code (USD, EUR, etc.)',
|
|
79
|
+
examples: ['USD', 'EUR', 'GBP', 'CAD'],
|
|
80
|
+
},
|
|
81
|
+
// Media
|
|
82
|
+
images: {
|
|
83
|
+
type: 'url',
|
|
84
|
+
array: true,
|
|
85
|
+
optional: true,
|
|
86
|
+
description: 'Product image URLs',
|
|
87
|
+
},
|
|
88
|
+
featuredImage: {
|
|
89
|
+
type: 'url',
|
|
90
|
+
optional: true,
|
|
91
|
+
description: 'Primary product image URL',
|
|
92
|
+
},
|
|
93
|
+
videos: {
|
|
94
|
+
type: 'url',
|
|
95
|
+
array: true,
|
|
96
|
+
optional: true,
|
|
97
|
+
description: 'Product video URLs',
|
|
98
|
+
},
|
|
99
|
+
// Categorization
|
|
100
|
+
category: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
optional: true,
|
|
103
|
+
description: 'Product category',
|
|
104
|
+
},
|
|
105
|
+
tags: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
array: true,
|
|
108
|
+
optional: true,
|
|
109
|
+
description: 'Tags for organization and search',
|
|
110
|
+
},
|
|
111
|
+
brand: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
optional: true,
|
|
114
|
+
description: 'Product brand or manufacturer',
|
|
115
|
+
},
|
|
116
|
+
// Inventory
|
|
117
|
+
trackInventory: {
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
optional: true,
|
|
120
|
+
description: 'Whether to track inventory for this product',
|
|
121
|
+
},
|
|
122
|
+
inventoryQuantity: {
|
|
123
|
+
type: 'number',
|
|
124
|
+
optional: true,
|
|
125
|
+
description: 'Available inventory quantity',
|
|
126
|
+
},
|
|
127
|
+
lowStockThreshold: {
|
|
128
|
+
type: 'number',
|
|
129
|
+
optional: true,
|
|
130
|
+
description: 'Quantity at which low stock warning triggers',
|
|
131
|
+
},
|
|
132
|
+
// Variants
|
|
133
|
+
hasVariants: {
|
|
134
|
+
type: 'boolean',
|
|
135
|
+
optional: true,
|
|
136
|
+
description: 'Whether product has variants (size, color, etc.)',
|
|
137
|
+
},
|
|
138
|
+
variantOptions: {
|
|
139
|
+
type: 'json',
|
|
140
|
+
optional: true,
|
|
141
|
+
description: 'Available variant options (e.g., sizes, colors)',
|
|
142
|
+
},
|
|
143
|
+
// Status
|
|
144
|
+
status: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
description: 'Product status: draft, active, archived',
|
|
147
|
+
examples: ['draft', 'active', 'archived'],
|
|
148
|
+
},
|
|
149
|
+
published: {
|
|
150
|
+
type: 'boolean',
|
|
151
|
+
optional: true,
|
|
152
|
+
description: 'Whether the product is publicly visible',
|
|
153
|
+
},
|
|
154
|
+
publishedAt: {
|
|
155
|
+
type: 'datetime',
|
|
156
|
+
optional: true,
|
|
157
|
+
description: 'When the product was published',
|
|
158
|
+
},
|
|
159
|
+
// Shipping
|
|
160
|
+
weight: {
|
|
161
|
+
type: 'number',
|
|
162
|
+
optional: true,
|
|
163
|
+
description: 'Product weight for shipping',
|
|
164
|
+
},
|
|
165
|
+
weightUnit: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
optional: true,
|
|
168
|
+
description: 'Weight unit: lb, kg, oz, g',
|
|
169
|
+
examples: ['lb', 'kg', 'oz', 'g'],
|
|
170
|
+
},
|
|
171
|
+
dimensions: {
|
|
172
|
+
type: 'json',
|
|
173
|
+
optional: true,
|
|
174
|
+
description: 'Product dimensions (length, width, height)',
|
|
175
|
+
},
|
|
176
|
+
requiresShipping: {
|
|
177
|
+
type: 'boolean',
|
|
178
|
+
optional: true,
|
|
179
|
+
description: 'Whether product requires physical shipping',
|
|
180
|
+
},
|
|
181
|
+
// SEO
|
|
182
|
+
metaTitle: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
optional: true,
|
|
185
|
+
description: 'SEO meta title',
|
|
186
|
+
},
|
|
187
|
+
metaDescription: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
optional: true,
|
|
190
|
+
description: 'SEO meta description',
|
|
191
|
+
},
|
|
192
|
+
// Metrics
|
|
193
|
+
viewCount: {
|
|
194
|
+
type: 'number',
|
|
195
|
+
optional: true,
|
|
196
|
+
description: 'Number of times product has been viewed',
|
|
197
|
+
},
|
|
198
|
+
salesCount: {
|
|
199
|
+
type: 'number',
|
|
200
|
+
optional: true,
|
|
201
|
+
description: 'Total number of units sold',
|
|
202
|
+
},
|
|
203
|
+
averageRating: {
|
|
204
|
+
type: 'number',
|
|
205
|
+
optional: true,
|
|
206
|
+
description: 'Average customer rating (e.g., 4.5)',
|
|
207
|
+
},
|
|
208
|
+
reviewCount: {
|
|
209
|
+
type: 'number',
|
|
210
|
+
optional: true,
|
|
211
|
+
description: 'Number of customer reviews',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
relationships: {
|
|
215
|
+
variants: {
|
|
216
|
+
type: 'ProductVariant[]',
|
|
217
|
+
backref: 'product',
|
|
218
|
+
description: 'Product variants (different sizes, colors, etc.)',
|
|
219
|
+
},
|
|
220
|
+
reviews: {
|
|
221
|
+
type: 'Review[]',
|
|
222
|
+
backref: 'product',
|
|
223
|
+
description: 'Customer reviews for this product',
|
|
224
|
+
},
|
|
225
|
+
inventory: {
|
|
226
|
+
type: 'Inventory',
|
|
227
|
+
backref: 'product',
|
|
228
|
+
description: 'Inventory tracking information',
|
|
229
|
+
},
|
|
230
|
+
orderItems: {
|
|
231
|
+
type: 'OrderItem[]',
|
|
232
|
+
backref: 'product',
|
|
233
|
+
description: 'Order items containing this product',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
actions: [
|
|
237
|
+
'create',
|
|
238
|
+
'update',
|
|
239
|
+
'publish',
|
|
240
|
+
'unpublish',
|
|
241
|
+
'archive',
|
|
242
|
+
'delete',
|
|
243
|
+
'duplicate',
|
|
244
|
+
'addVariant',
|
|
245
|
+
'removeVariant',
|
|
246
|
+
'updatePrice',
|
|
247
|
+
'updateInventory',
|
|
248
|
+
'addImage',
|
|
249
|
+
'removeImage',
|
|
250
|
+
'addToCart',
|
|
251
|
+
'addToWishlist',
|
|
252
|
+
'view',
|
|
253
|
+
'review',
|
|
254
|
+
],
|
|
255
|
+
events: [
|
|
256
|
+
'created',
|
|
257
|
+
'updated',
|
|
258
|
+
'published',
|
|
259
|
+
'unpublished',
|
|
260
|
+
'archived',
|
|
261
|
+
'deleted',
|
|
262
|
+
'duplicated',
|
|
263
|
+
'variantAdded',
|
|
264
|
+
'variantRemoved',
|
|
265
|
+
'priceChanged',
|
|
266
|
+
'inventoryUpdated',
|
|
267
|
+
'imageAdded',
|
|
268
|
+
'imageRemoved',
|
|
269
|
+
'viewed',
|
|
270
|
+
'addedToCart',
|
|
271
|
+
'addedToWishlist',
|
|
272
|
+
'purchased',
|
|
273
|
+
'reviewed',
|
|
274
|
+
'outOfStock',
|
|
275
|
+
'lowStock',
|
|
276
|
+
],
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Product variant entity
|
|
280
|
+
*
|
|
281
|
+
* Represents a variant of a product (e.g., size, color)
|
|
282
|
+
*/
|
|
283
|
+
export const ProductVariant = {
|
|
284
|
+
singular: 'product variant',
|
|
285
|
+
plural: 'product variants',
|
|
286
|
+
description: 'A variant of a product with different options (size, color, etc.)',
|
|
287
|
+
properties: {
|
|
288
|
+
// Identity
|
|
289
|
+
sku: {
|
|
290
|
+
type: 'string',
|
|
291
|
+
description: 'Unique SKU for this variant',
|
|
292
|
+
},
|
|
293
|
+
title: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'Variant title (e.g., "Large / Blue")',
|
|
296
|
+
},
|
|
297
|
+
// Options
|
|
298
|
+
option1: {
|
|
299
|
+
type: 'string',
|
|
300
|
+
optional: true,
|
|
301
|
+
description: 'First option value (e.g., "Large")',
|
|
302
|
+
},
|
|
303
|
+
option2: {
|
|
304
|
+
type: 'string',
|
|
305
|
+
optional: true,
|
|
306
|
+
description: 'Second option value (e.g., "Blue")',
|
|
307
|
+
},
|
|
308
|
+
option3: {
|
|
309
|
+
type: 'string',
|
|
310
|
+
optional: true,
|
|
311
|
+
description: 'Third option value',
|
|
312
|
+
},
|
|
313
|
+
// Pricing
|
|
314
|
+
price: {
|
|
315
|
+
type: 'number',
|
|
316
|
+
description: 'Variant price (overrides product price)',
|
|
317
|
+
},
|
|
318
|
+
compareAtPrice: {
|
|
319
|
+
type: 'number',
|
|
320
|
+
optional: true,
|
|
321
|
+
description: 'Original price for comparison',
|
|
322
|
+
},
|
|
323
|
+
cost: {
|
|
324
|
+
type: 'number',
|
|
325
|
+
optional: true,
|
|
326
|
+
description: 'Cost of goods for this variant',
|
|
327
|
+
},
|
|
328
|
+
// Inventory
|
|
329
|
+
inventoryQuantity: {
|
|
330
|
+
type: 'number',
|
|
331
|
+
description: 'Available inventory quantity',
|
|
332
|
+
},
|
|
333
|
+
inventoryPolicy: {
|
|
334
|
+
type: 'string',
|
|
335
|
+
optional: true,
|
|
336
|
+
description: 'How to handle out-of-stock: deny, continue',
|
|
337
|
+
examples: ['deny', 'continue'],
|
|
338
|
+
},
|
|
339
|
+
// Media
|
|
340
|
+
image: {
|
|
341
|
+
type: 'url',
|
|
342
|
+
optional: true,
|
|
343
|
+
description: 'Variant-specific image URL',
|
|
344
|
+
},
|
|
345
|
+
position: {
|
|
346
|
+
type: 'number',
|
|
347
|
+
optional: true,
|
|
348
|
+
description: 'Display position/order',
|
|
349
|
+
},
|
|
350
|
+
// Physical
|
|
351
|
+
weight: {
|
|
352
|
+
type: 'number',
|
|
353
|
+
optional: true,
|
|
354
|
+
description: 'Variant weight (overrides product weight)',
|
|
355
|
+
},
|
|
356
|
+
barcode: {
|
|
357
|
+
type: 'string',
|
|
358
|
+
optional: true,
|
|
359
|
+
description: 'Barcode/UPC for this variant',
|
|
360
|
+
},
|
|
361
|
+
// Status
|
|
362
|
+
available: {
|
|
363
|
+
type: 'boolean',
|
|
364
|
+
description: 'Whether variant is available for purchase',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
relationships: {
|
|
368
|
+
product: {
|
|
369
|
+
type: 'Product',
|
|
370
|
+
backref: 'variants',
|
|
371
|
+
description: 'Parent product',
|
|
372
|
+
},
|
|
373
|
+
inventory: {
|
|
374
|
+
type: 'Inventory',
|
|
375
|
+
backref: 'variant',
|
|
376
|
+
description: 'Inventory tracking for this variant',
|
|
377
|
+
},
|
|
378
|
+
orderItems: {
|
|
379
|
+
type: 'OrderItem[]',
|
|
380
|
+
backref: 'variant',
|
|
381
|
+
description: 'Order items for this variant',
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
actions: [
|
|
385
|
+
'create',
|
|
386
|
+
'update',
|
|
387
|
+
'delete',
|
|
388
|
+
'updatePrice',
|
|
389
|
+
'updateInventory',
|
|
390
|
+
'enable',
|
|
391
|
+
'disable',
|
|
392
|
+
'addToCart',
|
|
393
|
+
],
|
|
394
|
+
events: [
|
|
395
|
+
'created',
|
|
396
|
+
'updated',
|
|
397
|
+
'deleted',
|
|
398
|
+
'priceChanged',
|
|
399
|
+
'inventoryUpdated',
|
|
400
|
+
'enabled',
|
|
401
|
+
'disabled',
|
|
402
|
+
'purchased',
|
|
403
|
+
'outOfStock',
|
|
404
|
+
'restocked',
|
|
405
|
+
],
|
|
406
|
+
};
|
|
407
|
+
// =============================================================================
|
|
408
|
+
// Order
|
|
409
|
+
// =============================================================================
|
|
410
|
+
/**
|
|
411
|
+
* Order entity
|
|
412
|
+
*
|
|
413
|
+
* Represents a customer order
|
|
414
|
+
*/
|
|
415
|
+
export const Order = {
|
|
416
|
+
singular: 'order',
|
|
417
|
+
plural: 'orders',
|
|
418
|
+
description: 'A customer order containing one or more products',
|
|
419
|
+
properties: {
|
|
420
|
+
// Identity
|
|
421
|
+
orderNumber: {
|
|
422
|
+
type: 'string',
|
|
423
|
+
description: 'Unique order number (human-readable)',
|
|
424
|
+
},
|
|
425
|
+
// Status
|
|
426
|
+
status: {
|
|
427
|
+
type: 'string',
|
|
428
|
+
description: 'Order status: pending, confirmed, processing, shipped, delivered, cancelled, refunded',
|
|
429
|
+
examples: ['pending', 'confirmed', 'processing', 'shipped', 'delivered', 'cancelled', 'refunded'],
|
|
430
|
+
},
|
|
431
|
+
fulfillmentStatus: {
|
|
432
|
+
type: 'string',
|
|
433
|
+
optional: true,
|
|
434
|
+
description: 'Fulfillment status: unfulfilled, partial, fulfilled',
|
|
435
|
+
examples: ['unfulfilled', 'partial', 'fulfilled'],
|
|
436
|
+
},
|
|
437
|
+
paymentStatus: {
|
|
438
|
+
type: 'string',
|
|
439
|
+
description: 'Payment status: pending, paid, partial, refunded, failed',
|
|
440
|
+
examples: ['pending', 'paid', 'partial', 'refunded', 'failed'],
|
|
441
|
+
},
|
|
442
|
+
// Amounts
|
|
443
|
+
subtotal: {
|
|
444
|
+
type: 'number',
|
|
445
|
+
description: 'Subtotal before tax and shipping',
|
|
446
|
+
},
|
|
447
|
+
shippingCost: {
|
|
448
|
+
type: 'number',
|
|
449
|
+
optional: true,
|
|
450
|
+
description: 'Shipping cost',
|
|
451
|
+
},
|
|
452
|
+
taxAmount: {
|
|
453
|
+
type: 'number',
|
|
454
|
+
optional: true,
|
|
455
|
+
description: 'Total tax amount',
|
|
456
|
+
},
|
|
457
|
+
discountAmount: {
|
|
458
|
+
type: 'number',
|
|
459
|
+
optional: true,
|
|
460
|
+
description: 'Total discount amount applied',
|
|
461
|
+
},
|
|
462
|
+
total: {
|
|
463
|
+
type: 'number',
|
|
464
|
+
description: 'Total amount charged',
|
|
465
|
+
},
|
|
466
|
+
currency: {
|
|
467
|
+
type: 'string',
|
|
468
|
+
description: 'Currency code',
|
|
469
|
+
examples: ['USD', 'EUR', 'GBP', 'CAD'],
|
|
470
|
+
},
|
|
471
|
+
// Shipping
|
|
472
|
+
shippingMethod: {
|
|
473
|
+
type: 'string',
|
|
474
|
+
optional: true,
|
|
475
|
+
description: 'Selected shipping method',
|
|
476
|
+
},
|
|
477
|
+
shippingAddress: {
|
|
478
|
+
type: 'json',
|
|
479
|
+
description: 'Shipping address details',
|
|
480
|
+
},
|
|
481
|
+
billingAddress: {
|
|
482
|
+
type: 'json',
|
|
483
|
+
optional: true,
|
|
484
|
+
description: 'Billing address details',
|
|
485
|
+
},
|
|
486
|
+
trackingNumber: {
|
|
487
|
+
type: 'string',
|
|
488
|
+
optional: true,
|
|
489
|
+
description: 'Shipping tracking number',
|
|
490
|
+
},
|
|
491
|
+
trackingUrl: {
|
|
492
|
+
type: 'url',
|
|
493
|
+
optional: true,
|
|
494
|
+
description: 'URL to track shipment',
|
|
495
|
+
},
|
|
496
|
+
// Payment
|
|
497
|
+
paymentMethod: {
|
|
498
|
+
type: 'string',
|
|
499
|
+
optional: true,
|
|
500
|
+
description: 'Payment method used: card, paypal, bank_transfer, etc.',
|
|
501
|
+
examples: ['card', 'paypal', 'bank_transfer', 'apple_pay', 'google_pay'],
|
|
502
|
+
},
|
|
503
|
+
paymentReference: {
|
|
504
|
+
type: 'string',
|
|
505
|
+
optional: true,
|
|
506
|
+
description: 'Payment gateway transaction reference',
|
|
507
|
+
},
|
|
508
|
+
// Customer
|
|
509
|
+
customerEmail: {
|
|
510
|
+
type: 'string',
|
|
511
|
+
description: 'Customer email address',
|
|
512
|
+
},
|
|
513
|
+
customerPhone: {
|
|
514
|
+
type: 'string',
|
|
515
|
+
optional: true,
|
|
516
|
+
description: 'Customer phone number',
|
|
517
|
+
},
|
|
518
|
+
// Discounts
|
|
519
|
+
couponCode: {
|
|
520
|
+
type: 'string',
|
|
521
|
+
optional: true,
|
|
522
|
+
description: 'Applied coupon code',
|
|
523
|
+
},
|
|
524
|
+
// Metadata
|
|
525
|
+
notes: {
|
|
526
|
+
type: 'string',
|
|
527
|
+
optional: true,
|
|
528
|
+
description: 'Order notes or special instructions',
|
|
529
|
+
},
|
|
530
|
+
tags: {
|
|
531
|
+
type: 'string',
|
|
532
|
+
array: true,
|
|
533
|
+
optional: true,
|
|
534
|
+
description: 'Tags for organization',
|
|
535
|
+
},
|
|
536
|
+
source: {
|
|
537
|
+
type: 'string',
|
|
538
|
+
optional: true,
|
|
539
|
+
description: 'Order source: web, mobile, phone, pos',
|
|
540
|
+
examples: ['web', 'mobile', 'phone', 'pos'],
|
|
541
|
+
},
|
|
542
|
+
// Timestamps
|
|
543
|
+
placedAt: {
|
|
544
|
+
type: 'datetime',
|
|
545
|
+
optional: true,
|
|
546
|
+
description: 'When the order was placed',
|
|
547
|
+
},
|
|
548
|
+
confirmedAt: {
|
|
549
|
+
type: 'datetime',
|
|
550
|
+
optional: true,
|
|
551
|
+
description: 'When the order was confirmed',
|
|
552
|
+
},
|
|
553
|
+
shippedAt: {
|
|
554
|
+
type: 'datetime',
|
|
555
|
+
optional: true,
|
|
556
|
+
description: 'When the order was shipped',
|
|
557
|
+
},
|
|
558
|
+
deliveredAt: {
|
|
559
|
+
type: 'datetime',
|
|
560
|
+
optional: true,
|
|
561
|
+
description: 'When the order was delivered',
|
|
562
|
+
},
|
|
563
|
+
cancelledAt: {
|
|
564
|
+
type: 'datetime',
|
|
565
|
+
optional: true,
|
|
566
|
+
description: 'When the order was cancelled',
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
relationships: {
|
|
570
|
+
customer: {
|
|
571
|
+
type: 'Customer',
|
|
572
|
+
backref: 'orders',
|
|
573
|
+
description: 'Customer who placed the order',
|
|
574
|
+
},
|
|
575
|
+
items: {
|
|
576
|
+
type: 'OrderItem[]',
|
|
577
|
+
backref: 'order',
|
|
578
|
+
description: 'Line items in this order',
|
|
579
|
+
},
|
|
580
|
+
discount: {
|
|
581
|
+
type: 'Discount',
|
|
582
|
+
required: false,
|
|
583
|
+
description: 'Applied discount/coupon',
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
actions: [
|
|
587
|
+
'create',
|
|
588
|
+
'update',
|
|
589
|
+
'confirm',
|
|
590
|
+
'process',
|
|
591
|
+
'fulfill',
|
|
592
|
+
'ship',
|
|
593
|
+
'deliver',
|
|
594
|
+
'cancel',
|
|
595
|
+
'refund',
|
|
596
|
+
'addItem',
|
|
597
|
+
'removeItem',
|
|
598
|
+
'updateAddress',
|
|
599
|
+
'applyDiscount',
|
|
600
|
+
'removeDiscount',
|
|
601
|
+
'sendNotification',
|
|
602
|
+
'print',
|
|
603
|
+
'export',
|
|
604
|
+
],
|
|
605
|
+
events: [
|
|
606
|
+
'created',
|
|
607
|
+
'updated',
|
|
608
|
+
'confirmed',
|
|
609
|
+
'processing',
|
|
610
|
+
'fulfilled',
|
|
611
|
+
'shipped',
|
|
612
|
+
'delivered',
|
|
613
|
+
'cancelled',
|
|
614
|
+
'refunded',
|
|
615
|
+
'itemAdded',
|
|
616
|
+
'itemRemoved',
|
|
617
|
+
'addressUpdated',
|
|
618
|
+
'discountApplied',
|
|
619
|
+
'discountRemoved',
|
|
620
|
+
'notificationSent',
|
|
621
|
+
'printed',
|
|
622
|
+
'exported',
|
|
623
|
+
],
|
|
624
|
+
};
|
|
625
|
+
/**
|
|
626
|
+
* Order item entity
|
|
627
|
+
*
|
|
628
|
+
* Represents a line item in an order
|
|
629
|
+
*/
|
|
630
|
+
export const OrderItem = {
|
|
631
|
+
singular: 'order item',
|
|
632
|
+
plural: 'order items',
|
|
633
|
+
description: 'A line item in an order',
|
|
634
|
+
properties: {
|
|
635
|
+
// Product Info
|
|
636
|
+
productName: {
|
|
637
|
+
type: 'string',
|
|
638
|
+
description: 'Product name (snapshot at time of order)',
|
|
639
|
+
},
|
|
640
|
+
variantTitle: {
|
|
641
|
+
type: 'string',
|
|
642
|
+
optional: true,
|
|
643
|
+
description: 'Variant title if applicable',
|
|
644
|
+
},
|
|
645
|
+
sku: {
|
|
646
|
+
type: 'string',
|
|
647
|
+
optional: true,
|
|
648
|
+
description: 'Product or variant SKU',
|
|
649
|
+
},
|
|
650
|
+
// Quantity & Price
|
|
651
|
+
quantity: {
|
|
652
|
+
type: 'number',
|
|
653
|
+
description: 'Quantity ordered',
|
|
654
|
+
},
|
|
655
|
+
price: {
|
|
656
|
+
type: 'number',
|
|
657
|
+
description: 'Unit price at time of order',
|
|
658
|
+
},
|
|
659
|
+
subtotal: {
|
|
660
|
+
type: 'number',
|
|
661
|
+
description: 'Line item subtotal (price × quantity)',
|
|
662
|
+
},
|
|
663
|
+
discountAmount: {
|
|
664
|
+
type: 'number',
|
|
665
|
+
optional: true,
|
|
666
|
+
description: 'Discount applied to this line item',
|
|
667
|
+
},
|
|
668
|
+
taxAmount: {
|
|
669
|
+
type: 'number',
|
|
670
|
+
optional: true,
|
|
671
|
+
description: 'Tax for this line item',
|
|
672
|
+
},
|
|
673
|
+
total: {
|
|
674
|
+
type: 'number',
|
|
675
|
+
description: 'Line item total',
|
|
676
|
+
},
|
|
677
|
+
// Fulfillment
|
|
678
|
+
fulfillmentStatus: {
|
|
679
|
+
type: 'string',
|
|
680
|
+
optional: true,
|
|
681
|
+
description: 'Fulfillment status: unfulfilled, fulfilled, returned',
|
|
682
|
+
examples: ['unfulfilled', 'fulfilled', 'returned'],
|
|
683
|
+
},
|
|
684
|
+
quantityFulfilled: {
|
|
685
|
+
type: 'number',
|
|
686
|
+
optional: true,
|
|
687
|
+
description: 'Quantity that has been fulfilled',
|
|
688
|
+
},
|
|
689
|
+
// Metadata
|
|
690
|
+
image: {
|
|
691
|
+
type: 'url',
|
|
692
|
+
optional: true,
|
|
693
|
+
description: 'Product image URL',
|
|
694
|
+
},
|
|
695
|
+
requiresShipping: {
|
|
696
|
+
type: 'boolean',
|
|
697
|
+
optional: true,
|
|
698
|
+
description: 'Whether this item requires shipping',
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
relationships: {
|
|
702
|
+
order: {
|
|
703
|
+
type: 'Order',
|
|
704
|
+
backref: 'items',
|
|
705
|
+
description: 'Parent order',
|
|
706
|
+
},
|
|
707
|
+
product: {
|
|
708
|
+
type: 'Product',
|
|
709
|
+
backref: 'orderItems',
|
|
710
|
+
description: 'The product ordered',
|
|
711
|
+
},
|
|
712
|
+
variant: {
|
|
713
|
+
type: 'ProductVariant',
|
|
714
|
+
required: false,
|
|
715
|
+
backref: 'orderItems',
|
|
716
|
+
description: 'The variant ordered if applicable',
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
actions: [
|
|
720
|
+
'add',
|
|
721
|
+
'update',
|
|
722
|
+
'remove',
|
|
723
|
+
'fulfill',
|
|
724
|
+
'unfulfill',
|
|
725
|
+
'return',
|
|
726
|
+
'refund',
|
|
727
|
+
],
|
|
728
|
+
events: [
|
|
729
|
+
'added',
|
|
730
|
+
'updated',
|
|
731
|
+
'removed',
|
|
732
|
+
'fulfilled',
|
|
733
|
+
'unfulfilled',
|
|
734
|
+
'returned',
|
|
735
|
+
'refunded',
|
|
736
|
+
],
|
|
737
|
+
};
|
|
738
|
+
// =============================================================================
|
|
739
|
+
// Cart
|
|
740
|
+
// =============================================================================
|
|
741
|
+
/**
|
|
742
|
+
* Shopping cart entity
|
|
743
|
+
*
|
|
744
|
+
* Represents a customer's shopping cart
|
|
745
|
+
*/
|
|
746
|
+
export const Cart = {
|
|
747
|
+
singular: 'cart',
|
|
748
|
+
plural: 'carts',
|
|
749
|
+
description: 'A shopping cart containing products to be purchased',
|
|
750
|
+
properties: {
|
|
751
|
+
// Status
|
|
752
|
+
status: {
|
|
753
|
+
type: 'string',
|
|
754
|
+
description: 'Cart status: active, abandoned, completed',
|
|
755
|
+
examples: ['active', 'abandoned', 'completed'],
|
|
756
|
+
},
|
|
757
|
+
// Amounts
|
|
758
|
+
subtotal: {
|
|
759
|
+
type: 'number',
|
|
760
|
+
optional: true,
|
|
761
|
+
description: 'Subtotal of all items',
|
|
762
|
+
},
|
|
763
|
+
discountAmount: {
|
|
764
|
+
type: 'number',
|
|
765
|
+
optional: true,
|
|
766
|
+
description: 'Total discount amount',
|
|
767
|
+
},
|
|
768
|
+
total: {
|
|
769
|
+
type: 'number',
|
|
770
|
+
optional: true,
|
|
771
|
+
description: 'Total cart value',
|
|
772
|
+
},
|
|
773
|
+
currency: {
|
|
774
|
+
type: 'string',
|
|
775
|
+
description: 'Currency code',
|
|
776
|
+
examples: ['USD', 'EUR', 'GBP', 'CAD'],
|
|
777
|
+
},
|
|
778
|
+
// Item Count
|
|
779
|
+
itemCount: {
|
|
780
|
+
type: 'number',
|
|
781
|
+
optional: true,
|
|
782
|
+
description: 'Total number of items in cart',
|
|
783
|
+
},
|
|
784
|
+
uniqueItemCount: {
|
|
785
|
+
type: 'number',
|
|
786
|
+
optional: true,
|
|
787
|
+
description: 'Number of unique products in cart',
|
|
788
|
+
},
|
|
789
|
+
// Discounts
|
|
790
|
+
couponCode: {
|
|
791
|
+
type: 'string',
|
|
792
|
+
optional: true,
|
|
793
|
+
description: 'Applied coupon code',
|
|
794
|
+
},
|
|
795
|
+
// Session
|
|
796
|
+
token: {
|
|
797
|
+
type: 'string',
|
|
798
|
+
optional: true,
|
|
799
|
+
description: 'Cart token for anonymous users',
|
|
800
|
+
},
|
|
801
|
+
expiresAt: {
|
|
802
|
+
type: 'datetime',
|
|
803
|
+
optional: true,
|
|
804
|
+
description: 'When the cart expires',
|
|
805
|
+
},
|
|
806
|
+
// Metadata
|
|
807
|
+
notes: {
|
|
808
|
+
type: 'string',
|
|
809
|
+
optional: true,
|
|
810
|
+
description: 'Customer notes or special instructions',
|
|
811
|
+
},
|
|
812
|
+
lastActivityAt: {
|
|
813
|
+
type: 'datetime',
|
|
814
|
+
optional: true,
|
|
815
|
+
description: 'Last time cart was modified',
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
relationships: {
|
|
819
|
+
customer: {
|
|
820
|
+
type: 'Customer',
|
|
821
|
+
required: false,
|
|
822
|
+
backref: 'carts',
|
|
823
|
+
description: 'Customer who owns this cart (if logged in)',
|
|
824
|
+
},
|
|
825
|
+
items: {
|
|
826
|
+
type: 'OrderItem[]',
|
|
827
|
+
description: 'Items in the cart',
|
|
828
|
+
},
|
|
829
|
+
discount: {
|
|
830
|
+
type: 'Discount',
|
|
831
|
+
required: false,
|
|
832
|
+
description: 'Applied discount/coupon',
|
|
833
|
+
},
|
|
834
|
+
},
|
|
835
|
+
actions: [
|
|
836
|
+
'create',
|
|
837
|
+
'addItem',
|
|
838
|
+
'removeItem',
|
|
839
|
+
'updateItem',
|
|
840
|
+
'clear',
|
|
841
|
+
'applyCoupon',
|
|
842
|
+
'removeCoupon',
|
|
843
|
+
'checkout',
|
|
844
|
+
'abandon',
|
|
845
|
+
'recover',
|
|
846
|
+
'merge',
|
|
847
|
+
],
|
|
848
|
+
events: [
|
|
849
|
+
'created',
|
|
850
|
+
'itemAdded',
|
|
851
|
+
'itemRemoved',
|
|
852
|
+
'itemUpdated',
|
|
853
|
+
'cleared',
|
|
854
|
+
'couponApplied',
|
|
855
|
+
'couponRemoved',
|
|
856
|
+
'checkedOut',
|
|
857
|
+
'abandoned',
|
|
858
|
+
'recovered',
|
|
859
|
+
'merged',
|
|
860
|
+
],
|
|
861
|
+
};
|
|
862
|
+
// =============================================================================
|
|
863
|
+
// Customer
|
|
864
|
+
// =============================================================================
|
|
865
|
+
/**
|
|
866
|
+
* Customer entity
|
|
867
|
+
*
|
|
868
|
+
* Represents an e-commerce customer
|
|
869
|
+
*/
|
|
870
|
+
export const Customer = {
|
|
871
|
+
singular: 'customer',
|
|
872
|
+
plural: 'customers',
|
|
873
|
+
description: 'An e-commerce customer',
|
|
874
|
+
properties: {
|
|
875
|
+
// Identity
|
|
876
|
+
email: {
|
|
877
|
+
type: 'string',
|
|
878
|
+
description: 'Customer email address',
|
|
879
|
+
},
|
|
880
|
+
firstName: {
|
|
881
|
+
type: 'string',
|
|
882
|
+
optional: true,
|
|
883
|
+
description: 'First name',
|
|
884
|
+
},
|
|
885
|
+
lastName: {
|
|
886
|
+
type: 'string',
|
|
887
|
+
optional: true,
|
|
888
|
+
description: 'Last name',
|
|
889
|
+
},
|
|
890
|
+
phone: {
|
|
891
|
+
type: 'string',
|
|
892
|
+
optional: true,
|
|
893
|
+
description: 'Phone number',
|
|
894
|
+
},
|
|
895
|
+
// Account
|
|
896
|
+
acceptsMarketing: {
|
|
897
|
+
type: 'boolean',
|
|
898
|
+
optional: true,
|
|
899
|
+
description: 'Whether customer accepts marketing emails',
|
|
900
|
+
},
|
|
901
|
+
emailVerified: {
|
|
902
|
+
type: 'boolean',
|
|
903
|
+
optional: true,
|
|
904
|
+
description: 'Whether email has been verified',
|
|
905
|
+
},
|
|
906
|
+
// Status
|
|
907
|
+
status: {
|
|
908
|
+
type: 'string',
|
|
909
|
+
optional: true,
|
|
910
|
+
description: 'Customer status: active, disabled, invited',
|
|
911
|
+
examples: ['active', 'disabled', 'invited'],
|
|
912
|
+
},
|
|
913
|
+
// Addresses
|
|
914
|
+
defaultAddress: {
|
|
915
|
+
type: 'json',
|
|
916
|
+
optional: true,
|
|
917
|
+
description: 'Default shipping address',
|
|
918
|
+
},
|
|
919
|
+
addresses: {
|
|
920
|
+
type: 'json',
|
|
921
|
+
array: true,
|
|
922
|
+
optional: true,
|
|
923
|
+
description: 'Saved addresses',
|
|
924
|
+
},
|
|
925
|
+
// Metadata
|
|
926
|
+
notes: {
|
|
927
|
+
type: 'string',
|
|
928
|
+
optional: true,
|
|
929
|
+
description: 'Internal notes about the customer',
|
|
930
|
+
},
|
|
931
|
+
tags: {
|
|
932
|
+
type: 'string',
|
|
933
|
+
array: true,
|
|
934
|
+
optional: true,
|
|
935
|
+
description: 'Customer tags for segmentation',
|
|
936
|
+
},
|
|
937
|
+
// Statistics
|
|
938
|
+
orderCount: {
|
|
939
|
+
type: 'number',
|
|
940
|
+
optional: true,
|
|
941
|
+
description: 'Total number of orders',
|
|
942
|
+
},
|
|
943
|
+
totalSpent: {
|
|
944
|
+
type: 'number',
|
|
945
|
+
optional: true,
|
|
946
|
+
description: 'Total amount spent',
|
|
947
|
+
},
|
|
948
|
+
averageOrderValue: {
|
|
949
|
+
type: 'number',
|
|
950
|
+
optional: true,
|
|
951
|
+
description: 'Average order value',
|
|
952
|
+
},
|
|
953
|
+
// Timestamps
|
|
954
|
+
lastOrderAt: {
|
|
955
|
+
type: 'datetime',
|
|
956
|
+
optional: true,
|
|
957
|
+
description: 'Date of last order',
|
|
958
|
+
},
|
|
959
|
+
firstOrderAt: {
|
|
960
|
+
type: 'datetime',
|
|
961
|
+
optional: true,
|
|
962
|
+
description: 'Date of first order',
|
|
963
|
+
},
|
|
964
|
+
},
|
|
965
|
+
relationships: {
|
|
966
|
+
orders: {
|
|
967
|
+
type: 'Order[]',
|
|
968
|
+
backref: 'customer',
|
|
969
|
+
description: 'Customer orders',
|
|
970
|
+
},
|
|
971
|
+
carts: {
|
|
972
|
+
type: 'Cart[]',
|
|
973
|
+
backref: 'customer',
|
|
974
|
+
description: 'Customer shopping carts',
|
|
975
|
+
},
|
|
976
|
+
reviews: {
|
|
977
|
+
type: 'Review[]',
|
|
978
|
+
backref: 'customer',
|
|
979
|
+
description: 'Product reviews written by this customer',
|
|
980
|
+
},
|
|
981
|
+
},
|
|
982
|
+
actions: [
|
|
983
|
+
'create',
|
|
984
|
+
'update',
|
|
985
|
+
'delete',
|
|
986
|
+
'enable',
|
|
987
|
+
'disable',
|
|
988
|
+
'invite',
|
|
989
|
+
'addAddress',
|
|
990
|
+
'updateAddress',
|
|
991
|
+
'removeAddress',
|
|
992
|
+
'setDefaultAddress',
|
|
993
|
+
'sendEmail',
|
|
994
|
+
'addNote',
|
|
995
|
+
'tag',
|
|
996
|
+
'untag',
|
|
997
|
+
'merge',
|
|
998
|
+
'export',
|
|
999
|
+
],
|
|
1000
|
+
events: [
|
|
1001
|
+
'created',
|
|
1002
|
+
'updated',
|
|
1003
|
+
'deleted',
|
|
1004
|
+
'enabled',
|
|
1005
|
+
'disabled',
|
|
1006
|
+
'invited',
|
|
1007
|
+
'addressAdded',
|
|
1008
|
+
'addressUpdated',
|
|
1009
|
+
'addressRemoved',
|
|
1010
|
+
'defaultAddressSet',
|
|
1011
|
+
'emailSent',
|
|
1012
|
+
'noteAdded',
|
|
1013
|
+
'tagged',
|
|
1014
|
+
'untagged',
|
|
1015
|
+
'merged',
|
|
1016
|
+
'exported',
|
|
1017
|
+
'orderPlaced',
|
|
1018
|
+
'emailVerified',
|
|
1019
|
+
],
|
|
1020
|
+
};
|
|
1021
|
+
// =============================================================================
|
|
1022
|
+
// Inventory
|
|
1023
|
+
// =============================================================================
|
|
1024
|
+
/**
|
|
1025
|
+
* Inventory entity
|
|
1026
|
+
*
|
|
1027
|
+
* Tracks inventory for products and variants
|
|
1028
|
+
*/
|
|
1029
|
+
export const Inventory = {
|
|
1030
|
+
singular: 'inventory',
|
|
1031
|
+
plural: 'inventories',
|
|
1032
|
+
description: 'Inventory tracking for a product or variant',
|
|
1033
|
+
properties: {
|
|
1034
|
+
// Quantity
|
|
1035
|
+
quantity: {
|
|
1036
|
+
type: 'number',
|
|
1037
|
+
description: 'Available quantity',
|
|
1038
|
+
},
|
|
1039
|
+
reservedQuantity: {
|
|
1040
|
+
type: 'number',
|
|
1041
|
+
optional: true,
|
|
1042
|
+
description: 'Quantity reserved for pending orders',
|
|
1043
|
+
},
|
|
1044
|
+
availableQuantity: {
|
|
1045
|
+
type: 'number',
|
|
1046
|
+
optional: true,
|
|
1047
|
+
description: 'Quantity available for new orders',
|
|
1048
|
+
},
|
|
1049
|
+
// Thresholds
|
|
1050
|
+
lowStockThreshold: {
|
|
1051
|
+
type: 'number',
|
|
1052
|
+
optional: true,
|
|
1053
|
+
description: 'Threshold for low stock warning',
|
|
1054
|
+
},
|
|
1055
|
+
isLowStock: {
|
|
1056
|
+
type: 'boolean',
|
|
1057
|
+
optional: true,
|
|
1058
|
+
description: 'Whether inventory is below threshold',
|
|
1059
|
+
},
|
|
1060
|
+
isOutOfStock: {
|
|
1061
|
+
type: 'boolean',
|
|
1062
|
+
optional: true,
|
|
1063
|
+
description: 'Whether inventory is out of stock',
|
|
1064
|
+
},
|
|
1065
|
+
// Policy
|
|
1066
|
+
allowBackorder: {
|
|
1067
|
+
type: 'boolean',
|
|
1068
|
+
optional: true,
|
|
1069
|
+
description: 'Whether to allow backorders when out of stock',
|
|
1070
|
+
},
|
|
1071
|
+
trackInventory: {
|
|
1072
|
+
type: 'boolean',
|
|
1073
|
+
description: 'Whether to track inventory for this item',
|
|
1074
|
+
},
|
|
1075
|
+
// Location
|
|
1076
|
+
location: {
|
|
1077
|
+
type: 'string',
|
|
1078
|
+
optional: true,
|
|
1079
|
+
description: 'Warehouse or location name',
|
|
1080
|
+
},
|
|
1081
|
+
bin: {
|
|
1082
|
+
type: 'string',
|
|
1083
|
+
optional: true,
|
|
1084
|
+
description: 'Bin or shelf location',
|
|
1085
|
+
},
|
|
1086
|
+
// Metadata
|
|
1087
|
+
lastRestockedAt: {
|
|
1088
|
+
type: 'datetime',
|
|
1089
|
+
optional: true,
|
|
1090
|
+
description: 'Last time inventory was restocked',
|
|
1091
|
+
},
|
|
1092
|
+
lastCountedAt: {
|
|
1093
|
+
type: 'datetime',
|
|
1094
|
+
optional: true,
|
|
1095
|
+
description: 'Last physical inventory count',
|
|
1096
|
+
},
|
|
1097
|
+
},
|
|
1098
|
+
relationships: {
|
|
1099
|
+
product: {
|
|
1100
|
+
type: 'Product',
|
|
1101
|
+
required: false,
|
|
1102
|
+
backref: 'inventory',
|
|
1103
|
+
description: 'Product being tracked',
|
|
1104
|
+
},
|
|
1105
|
+
variant: {
|
|
1106
|
+
type: 'ProductVariant',
|
|
1107
|
+
required: false,
|
|
1108
|
+
backref: 'inventory',
|
|
1109
|
+
description: 'Variant being tracked',
|
|
1110
|
+
},
|
|
1111
|
+
},
|
|
1112
|
+
actions: [
|
|
1113
|
+
'create',
|
|
1114
|
+
'update',
|
|
1115
|
+
'adjust',
|
|
1116
|
+
'reserve',
|
|
1117
|
+
'release',
|
|
1118
|
+
'restock',
|
|
1119
|
+
'count',
|
|
1120
|
+
'transfer',
|
|
1121
|
+
'setThreshold',
|
|
1122
|
+
],
|
|
1123
|
+
events: [
|
|
1124
|
+
'created',
|
|
1125
|
+
'updated',
|
|
1126
|
+
'adjusted',
|
|
1127
|
+
'reserved',
|
|
1128
|
+
'released',
|
|
1129
|
+
'restocked',
|
|
1130
|
+
'counted',
|
|
1131
|
+
'transferred',
|
|
1132
|
+
'thresholdSet',
|
|
1133
|
+
'lowStock',
|
|
1134
|
+
'outOfStock',
|
|
1135
|
+
'backInStock',
|
|
1136
|
+
],
|
|
1137
|
+
};
|
|
1138
|
+
// =============================================================================
|
|
1139
|
+
// Discount
|
|
1140
|
+
// =============================================================================
|
|
1141
|
+
/**
|
|
1142
|
+
* Discount entity
|
|
1143
|
+
*
|
|
1144
|
+
* Represents a discount code or coupon
|
|
1145
|
+
*/
|
|
1146
|
+
export const Discount = {
|
|
1147
|
+
singular: 'discount',
|
|
1148
|
+
plural: 'discounts',
|
|
1149
|
+
description: 'A discount code or coupon',
|
|
1150
|
+
properties: {
|
|
1151
|
+
// Identity
|
|
1152
|
+
code: {
|
|
1153
|
+
type: 'string',
|
|
1154
|
+
description: 'Discount code (e.g., "SAVE20")',
|
|
1155
|
+
},
|
|
1156
|
+
name: {
|
|
1157
|
+
type: 'string',
|
|
1158
|
+
optional: true,
|
|
1159
|
+
description: 'Internal name for the discount',
|
|
1160
|
+
},
|
|
1161
|
+
// Type
|
|
1162
|
+
type: {
|
|
1163
|
+
type: 'string',
|
|
1164
|
+
description: 'Discount type: percentage, fixed_amount, free_shipping',
|
|
1165
|
+
examples: ['percentage', 'fixed_amount', 'free_shipping'],
|
|
1166
|
+
},
|
|
1167
|
+
value: {
|
|
1168
|
+
type: 'number',
|
|
1169
|
+
description: 'Discount value (percentage or amount)',
|
|
1170
|
+
},
|
|
1171
|
+
// Conditions
|
|
1172
|
+
minimumPurchase: {
|
|
1173
|
+
type: 'number',
|
|
1174
|
+
optional: true,
|
|
1175
|
+
description: 'Minimum purchase amount required',
|
|
1176
|
+
},
|
|
1177
|
+
minimumQuantity: {
|
|
1178
|
+
type: 'number',
|
|
1179
|
+
optional: true,
|
|
1180
|
+
description: 'Minimum quantity of items required',
|
|
1181
|
+
},
|
|
1182
|
+
appliesToProducts: {
|
|
1183
|
+
type: 'string',
|
|
1184
|
+
array: true,
|
|
1185
|
+
optional: true,
|
|
1186
|
+
description: 'Product IDs this discount applies to',
|
|
1187
|
+
},
|
|
1188
|
+
appliesToCategories: {
|
|
1189
|
+
type: 'string',
|
|
1190
|
+
array: true,
|
|
1191
|
+
optional: true,
|
|
1192
|
+
description: 'Categories this discount applies to',
|
|
1193
|
+
},
|
|
1194
|
+
excludedProducts: {
|
|
1195
|
+
type: 'string',
|
|
1196
|
+
array: true,
|
|
1197
|
+
optional: true,
|
|
1198
|
+
description: 'Product IDs excluded from discount',
|
|
1199
|
+
},
|
|
1200
|
+
// Usage
|
|
1201
|
+
usageLimit: {
|
|
1202
|
+
type: 'number',
|
|
1203
|
+
optional: true,
|
|
1204
|
+
description: 'Maximum number of times code can be used',
|
|
1205
|
+
},
|
|
1206
|
+
usageCount: {
|
|
1207
|
+
type: 'number',
|
|
1208
|
+
optional: true,
|
|
1209
|
+
description: 'Number of times code has been used',
|
|
1210
|
+
},
|
|
1211
|
+
usageLimitPerCustomer: {
|
|
1212
|
+
type: 'number',
|
|
1213
|
+
optional: true,
|
|
1214
|
+
description: 'Max uses per customer',
|
|
1215
|
+
},
|
|
1216
|
+
oneTimeUse: {
|
|
1217
|
+
type: 'boolean',
|
|
1218
|
+
optional: true,
|
|
1219
|
+
description: 'Whether code can only be used once',
|
|
1220
|
+
},
|
|
1221
|
+
// Validity
|
|
1222
|
+
startsAt: {
|
|
1223
|
+
type: 'datetime',
|
|
1224
|
+
optional: true,
|
|
1225
|
+
description: 'When discount becomes active',
|
|
1226
|
+
},
|
|
1227
|
+
endsAt: {
|
|
1228
|
+
type: 'datetime',
|
|
1229
|
+
optional: true,
|
|
1230
|
+
description: 'When discount expires',
|
|
1231
|
+
},
|
|
1232
|
+
active: {
|
|
1233
|
+
type: 'boolean',
|
|
1234
|
+
description: 'Whether discount is currently active',
|
|
1235
|
+
},
|
|
1236
|
+
// Metadata
|
|
1237
|
+
description: {
|
|
1238
|
+
type: 'string',
|
|
1239
|
+
optional: true,
|
|
1240
|
+
description: 'Description of the discount',
|
|
1241
|
+
},
|
|
1242
|
+
},
|
|
1243
|
+
relationships: {
|
|
1244
|
+
orders: {
|
|
1245
|
+
type: 'Order[]',
|
|
1246
|
+
description: 'Orders that used this discount',
|
|
1247
|
+
},
|
|
1248
|
+
},
|
|
1249
|
+
actions: [
|
|
1250
|
+
'create',
|
|
1251
|
+
'update',
|
|
1252
|
+
'activate',
|
|
1253
|
+
'deactivate',
|
|
1254
|
+
'delete',
|
|
1255
|
+
'apply',
|
|
1256
|
+
'remove',
|
|
1257
|
+
'extend',
|
|
1258
|
+
'duplicate',
|
|
1259
|
+
],
|
|
1260
|
+
events: [
|
|
1261
|
+
'created',
|
|
1262
|
+
'updated',
|
|
1263
|
+
'activated',
|
|
1264
|
+
'deactivated',
|
|
1265
|
+
'deleted',
|
|
1266
|
+
'applied',
|
|
1267
|
+
'removed',
|
|
1268
|
+
'extended',
|
|
1269
|
+
'duplicated',
|
|
1270
|
+
'expired',
|
|
1271
|
+
'limitReached',
|
|
1272
|
+
],
|
|
1273
|
+
};
|
|
1274
|
+
// =============================================================================
|
|
1275
|
+
// Review
|
|
1276
|
+
// =============================================================================
|
|
1277
|
+
/**
|
|
1278
|
+
* Review entity
|
|
1279
|
+
*
|
|
1280
|
+
* Represents a product review
|
|
1281
|
+
*/
|
|
1282
|
+
export const Review = {
|
|
1283
|
+
singular: 'review',
|
|
1284
|
+
plural: 'reviews',
|
|
1285
|
+
description: 'A customer review of a product',
|
|
1286
|
+
properties: {
|
|
1287
|
+
// Rating
|
|
1288
|
+
rating: {
|
|
1289
|
+
type: 'number',
|
|
1290
|
+
description: 'Star rating (typically 1-5)',
|
|
1291
|
+
},
|
|
1292
|
+
// Content
|
|
1293
|
+
title: {
|
|
1294
|
+
type: 'string',
|
|
1295
|
+
optional: true,
|
|
1296
|
+
description: 'Review title or headline',
|
|
1297
|
+
},
|
|
1298
|
+
body: {
|
|
1299
|
+
type: 'string',
|
|
1300
|
+
description: 'Review text content',
|
|
1301
|
+
},
|
|
1302
|
+
// Author
|
|
1303
|
+
authorName: {
|
|
1304
|
+
type: 'string',
|
|
1305
|
+
optional: true,
|
|
1306
|
+
description: 'Name of reviewer',
|
|
1307
|
+
},
|
|
1308
|
+
authorEmail: {
|
|
1309
|
+
type: 'string',
|
|
1310
|
+
optional: true,
|
|
1311
|
+
description: 'Email of reviewer',
|
|
1312
|
+
},
|
|
1313
|
+
verified: {
|
|
1314
|
+
type: 'boolean',
|
|
1315
|
+
optional: true,
|
|
1316
|
+
description: 'Whether reviewer is a verified purchaser',
|
|
1317
|
+
},
|
|
1318
|
+
// Status
|
|
1319
|
+
status: {
|
|
1320
|
+
type: 'string',
|
|
1321
|
+
description: 'Review status: pending, published, rejected',
|
|
1322
|
+
examples: ['pending', 'published', 'rejected'],
|
|
1323
|
+
},
|
|
1324
|
+
publishedAt: {
|
|
1325
|
+
type: 'datetime',
|
|
1326
|
+
optional: true,
|
|
1327
|
+
description: 'When review was published',
|
|
1328
|
+
},
|
|
1329
|
+
// Engagement
|
|
1330
|
+
helpful: {
|
|
1331
|
+
type: 'number',
|
|
1332
|
+
optional: true,
|
|
1333
|
+
description: 'Number of "helpful" votes',
|
|
1334
|
+
},
|
|
1335
|
+
notHelpful: {
|
|
1336
|
+
type: 'number',
|
|
1337
|
+
optional: true,
|
|
1338
|
+
description: 'Number of "not helpful" votes',
|
|
1339
|
+
},
|
|
1340
|
+
// Media
|
|
1341
|
+
images: {
|
|
1342
|
+
type: 'url',
|
|
1343
|
+
array: true,
|
|
1344
|
+
optional: true,
|
|
1345
|
+
description: 'Customer-submitted images',
|
|
1346
|
+
},
|
|
1347
|
+
videos: {
|
|
1348
|
+
type: 'url',
|
|
1349
|
+
array: true,
|
|
1350
|
+
optional: true,
|
|
1351
|
+
description: 'Customer-submitted videos',
|
|
1352
|
+
},
|
|
1353
|
+
// Metadata
|
|
1354
|
+
source: {
|
|
1355
|
+
type: 'string',
|
|
1356
|
+
optional: true,
|
|
1357
|
+
description: 'Review source: website, email, imported',
|
|
1358
|
+
examples: ['website', 'email', 'imported'],
|
|
1359
|
+
},
|
|
1360
|
+
},
|
|
1361
|
+
relationships: {
|
|
1362
|
+
product: {
|
|
1363
|
+
type: 'Product',
|
|
1364
|
+
backref: 'reviews',
|
|
1365
|
+
description: 'Product being reviewed',
|
|
1366
|
+
},
|
|
1367
|
+
customer: {
|
|
1368
|
+
type: 'Customer',
|
|
1369
|
+
required: false,
|
|
1370
|
+
backref: 'reviews',
|
|
1371
|
+
description: 'Customer who wrote the review',
|
|
1372
|
+
},
|
|
1373
|
+
},
|
|
1374
|
+
actions: [
|
|
1375
|
+
'create',
|
|
1376
|
+
'update',
|
|
1377
|
+
'publish',
|
|
1378
|
+
'unpublish',
|
|
1379
|
+
'approve',
|
|
1380
|
+
'reject',
|
|
1381
|
+
'delete',
|
|
1382
|
+
'markHelpful',
|
|
1383
|
+
'markNotHelpful',
|
|
1384
|
+
'reply',
|
|
1385
|
+
'flag',
|
|
1386
|
+
],
|
|
1387
|
+
events: [
|
|
1388
|
+
'created',
|
|
1389
|
+
'updated',
|
|
1390
|
+
'published',
|
|
1391
|
+
'unpublished',
|
|
1392
|
+
'approved',
|
|
1393
|
+
'rejected',
|
|
1394
|
+
'deleted',
|
|
1395
|
+
'markedHelpful',
|
|
1396
|
+
'markedNotHelpful',
|
|
1397
|
+
'replied',
|
|
1398
|
+
'flagged',
|
|
1399
|
+
],
|
|
1400
|
+
};
|
|
1401
|
+
// =============================================================================
|
|
1402
|
+
// Export all entities as a schema
|
|
1403
|
+
// =============================================================================
|
|
1404
|
+
/**
|
|
1405
|
+
* All e-commerce entity types
|
|
1406
|
+
*/
|
|
1407
|
+
export const EcommerceEntities = {
|
|
1408
|
+
Product,
|
|
1409
|
+
ProductVariant,
|
|
1410
|
+
Order,
|
|
1411
|
+
OrderItem,
|
|
1412
|
+
Cart,
|
|
1413
|
+
Customer,
|
|
1414
|
+
Inventory,
|
|
1415
|
+
Discount,
|
|
1416
|
+
Review,
|
|
1417
|
+
};
|
|
1418
|
+
/**
|
|
1419
|
+
* Entity categories for organization
|
|
1420
|
+
*/
|
|
1421
|
+
export const EcommerceCategories = {
|
|
1422
|
+
products: ['Product', 'ProductVariant'],
|
|
1423
|
+
orders: ['Order', 'OrderItem'],
|
|
1424
|
+
cart: ['Cart'],
|
|
1425
|
+
customers: ['Customer'],
|
|
1426
|
+
inventory: ['Inventory'],
|
|
1427
|
+
marketing: ['Discount'],
|
|
1428
|
+
reviews: ['Review'],
|
|
1429
|
+
};
|