digital-tools 2.1.1 → 2.3.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.
Files changed (293) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -0
  3. package/dist/client.d.ts +109 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +69 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/define.d.ts +2 -2
  8. package/dist/define.d.ts.map +1 -1
  9. package/dist/define.js +22 -20
  10. package/dist/define.js.map +1 -1
  11. package/dist/function-ref.d.ts +229 -0
  12. package/dist/function-ref.d.ts.map +1 -0
  13. package/dist/function-ref.js +28 -0
  14. package/dist/function-ref.js.map +1 -0
  15. package/dist/function-sugar.d.ts +57 -0
  16. package/dist/function-sugar.d.ts.map +1 -0
  17. package/dist/function-sugar.js +79 -0
  18. package/dist/function-sugar.js.map +1 -0
  19. package/dist/index.d.ts +10 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +24 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/providers/analytics/mixpanel.d.ts.map +1 -1
  24. package/dist/providers/analytics/mixpanel.js +21 -18
  25. package/dist/providers/analytics/mixpanel.js.map +1 -1
  26. package/dist/providers/calendar/cal-com.d.ts.map +1 -1
  27. package/dist/providers/calendar/cal-com.js +10 -10
  28. package/dist/providers/calendar/cal-com.js.map +1 -1
  29. package/dist/providers/calendar/google-calendar.d.ts.map +1 -1
  30. package/dist/providers/calendar/google-calendar.js +4 -4
  31. package/dist/providers/calendar/google-calendar.js.map +1 -1
  32. package/dist/providers/crm/hubspot.d.ts.map +1 -1
  33. package/dist/providers/crm/hubspot.js +107 -85
  34. package/dist/providers/crm/hubspot.js.map +1 -1
  35. package/dist/providers/development/github.d.ts.map +1 -1
  36. package/dist/providers/development/github.js +40 -43
  37. package/dist/providers/development/github.js.map +1 -1
  38. package/dist/providers/ecommerce/shopify.d.ts.map +1 -1
  39. package/dist/providers/ecommerce/shopify.js +79 -62
  40. package/dist/providers/ecommerce/shopify.js.map +1 -1
  41. package/dist/providers/email/resend.d.ts.map +1 -1
  42. package/dist/providers/email/resend.js +20 -16
  43. package/dist/providers/email/resend.js.map +1 -1
  44. package/dist/providers/email/sendgrid.d.ts.map +1 -1
  45. package/dist/providers/email/sendgrid.js +12 -9
  46. package/dist/providers/email/sendgrid.js.map +1 -1
  47. package/dist/providers/finance/stripe.d.ts.map +1 -1
  48. package/dist/providers/finance/stripe.js +44 -42
  49. package/dist/providers/finance/stripe.js.map +1 -1
  50. package/dist/providers/forms/typeform.d.ts.map +1 -1
  51. package/dist/providers/forms/typeform.js +68 -58
  52. package/dist/providers/forms/typeform.js.map +1 -1
  53. package/dist/providers/knowledge/notion.d.ts.map +1 -1
  54. package/dist/providers/knowledge/notion.js +75 -41
  55. package/dist/providers/knowledge/notion.js.map +1 -1
  56. package/dist/providers/marketing/mailchimp.d.ts.map +1 -1
  57. package/dist/providers/marketing/mailchimp.js +74 -61
  58. package/dist/providers/marketing/mailchimp.js.map +1 -1
  59. package/dist/providers/media/cloudinary.d.ts.map +1 -1
  60. package/dist/providers/media/cloudinary.js +30 -28
  61. package/dist/providers/media/cloudinary.js.map +1 -1
  62. package/dist/providers/messaging/slack.d.ts.map +1 -1
  63. package/dist/providers/messaging/slack.js +75 -58
  64. package/dist/providers/messaging/slack.js.map +1 -1
  65. package/dist/providers/messaging/twilio-sms.d.ts.map +1 -1
  66. package/dist/providers/messaging/twilio-sms.js +33 -15
  67. package/dist/providers/messaging/twilio-sms.js.map +1 -1
  68. package/dist/providers/project-management/linear.d.ts.map +1 -1
  69. package/dist/providers/project-management/linear.js +31 -27
  70. package/dist/providers/project-management/linear.js.map +1 -1
  71. package/dist/providers/spreadsheet/google-sheets.d.ts.map +1 -1
  72. package/dist/providers/spreadsheet/google-sheets.js +21 -18
  73. package/dist/providers/spreadsheet/google-sheets.js.map +1 -1
  74. package/dist/providers/spreadsheet/xlsx.d.ts.map +1 -1
  75. package/dist/providers/spreadsheet/xlsx.js +4 -4
  76. package/dist/providers/spreadsheet/xlsx.js.map +1 -1
  77. package/dist/providers/storage/index.js +1 -0
  78. package/dist/providers/storage/index.js.map +1 -1
  79. package/dist/providers/storage/s3.d.ts.map +1 -1
  80. package/dist/providers/storage/s3.js +36 -27
  81. package/dist/providers/storage/s3.js.map +1 -1
  82. package/dist/providers/support/zendesk.d.ts.map +1 -1
  83. package/dist/providers/support/zendesk.js +24 -25
  84. package/dist/providers/support/zendesk.js.map +1 -1
  85. package/dist/providers/tasks/todoist.d.ts.map +1 -1
  86. package/dist/providers/tasks/todoist.js +18 -18
  87. package/dist/providers/tasks/todoist.js.map +1 -1
  88. package/dist/providers/video-conferencing/google-meet.d.ts.map +1 -1
  89. package/dist/providers/video-conferencing/google-meet.js +11 -11
  90. package/dist/providers/video-conferencing/google-meet.js.map +1 -1
  91. package/dist/providers/video-conferencing/jitsi.js +14 -14
  92. package/dist/providers/video-conferencing/jitsi.js.map +1 -1
  93. package/dist/providers/video-conferencing/teams.d.ts.map +1 -1
  94. package/dist/providers/video-conferencing/teams.js +9 -7
  95. package/dist/providers/video-conferencing/teams.js.map +1 -1
  96. package/dist/providers/video-conferencing/zoom.d.ts.map +1 -1
  97. package/dist/providers/video-conferencing/zoom.js +26 -24
  98. package/dist/providers/video-conferencing/zoom.js.map +1 -1
  99. package/dist/tools/data.d.ts.map +1 -1
  100. package/dist/tools/data.js +5 -12
  101. package/dist/tools/data.js.map +1 -1
  102. package/dist/tools/index.d.ts +1 -0
  103. package/dist/tools/index.d.ts.map +1 -1
  104. package/dist/tools/index.js +1 -0
  105. package/dist/tools/index.js.map +1 -1
  106. package/dist/tools/system.d.ts +289 -0
  107. package/dist/tools/system.d.ts.map +1 -0
  108. package/dist/tools/system.js +752 -0
  109. package/dist/tools/system.js.map +1 -0
  110. package/dist/tools/web.d.ts.map +1 -1
  111. package/dist/tools/web.js +22 -10
  112. package/dist/tools/web.js.map +1 -1
  113. package/dist/track-record.d.ts +101 -0
  114. package/dist/track-record.d.ts.map +1 -0
  115. package/dist/track-record.js +17 -0
  116. package/dist/track-record.js.map +1 -0
  117. package/dist/types.d.ts +210 -9
  118. package/dist/types.d.ts.map +1 -1
  119. package/dist/verb-registration.d.ts +122 -0
  120. package/dist/verb-registration.d.ts.map +1 -0
  121. package/dist/verb-registration.js +176 -0
  122. package/dist/verb-registration.js.map +1 -0
  123. package/dist/worker.d.ts +93 -0
  124. package/dist/worker.d.ts.map +1 -0
  125. package/dist/worker.js +315 -0
  126. package/dist/worker.js.map +1 -0
  127. package/dist/wrap.d.ts +89 -0
  128. package/dist/wrap.d.ts.map +1 -0
  129. package/dist/wrap.js +225 -0
  130. package/dist/wrap.js.map +1 -0
  131. package/package.json +21 -4
  132. package/src/client.ts +136 -0
  133. package/src/define.ts +31 -37
  134. package/src/function-ref.ts +264 -0
  135. package/src/function-sugar.ts +134 -0
  136. package/src/index.ts +132 -10
  137. package/src/providers/analytics/mixpanel.ts +19 -18
  138. package/src/providers/calendar/cal-com.ts +29 -18
  139. package/src/providers/calendar/google-calendar.ts +20 -14
  140. package/src/providers/crm/hubspot.ts +225 -99
  141. package/src/providers/development/github.ts +206 -135
  142. package/src/providers/ecommerce/shopify.ts +250 -89
  143. package/src/providers/email/resend.ts +101 -28
  144. package/src/providers/email/sendgrid.ts +12 -9
  145. package/src/providers/finance/stripe.ts +128 -49
  146. package/src/providers/forms/typeform.ts +74 -58
  147. package/src/providers/knowledge/notion.ts +340 -88
  148. package/src/providers/marketing/mailchimp.ts +86 -70
  149. package/src/providers/media/cloudinary.ts +99 -41
  150. package/src/providers/messaging/slack.ts +283 -85
  151. package/src/providers/messaging/twilio-sms.ts +35 -15
  152. package/src/providers/project-management/linear.ts +143 -55
  153. package/src/providers/spreadsheet/google-sheets.ts +222 -56
  154. package/src/providers/spreadsheet/xlsx.ts +47 -16
  155. package/src/providers/storage/s3.ts +119 -47
  156. package/src/providers/support/zendesk.ts +196 -46
  157. package/src/providers/tasks/todoist.ts +20 -26
  158. package/src/providers/video-conferencing/google-meet.ts +17 -20
  159. package/src/providers/video-conferencing/jitsi.ts +14 -14
  160. package/src/providers/video-conferencing/teams.ts +14 -13
  161. package/src/providers/video-conferencing/zoom.ts +54 -49
  162. package/src/tools/data.ts +6 -16
  163. package/src/tools/index.ts +1 -0
  164. package/src/tools/system.ts +887 -0
  165. package/src/tools/web.ts +22 -10
  166. package/src/track-record.ts +106 -0
  167. package/src/types.ts +241 -13
  168. package/src/verb-registration.ts +197 -0
  169. package/src/worker.ts +370 -0
  170. package/src/wrap.ts +260 -0
  171. package/test/client.test.ts +146 -0
  172. package/test/communication-tools-extended.test.ts +734 -0
  173. package/test/data-tools-extended.test.ts +743 -0
  174. package/test/define-extended.test.ts +819 -0
  175. package/test/define.test.ts +150 -41
  176. package/test/entities.test.ts +623 -0
  177. package/test/extended-entities.test.ts +1228 -0
  178. package/test/provider-implementations.test.ts +725 -0
  179. package/test/provider-registry-extended.test.ts +583 -0
  180. package/test/providers/google-sheets.test.ts +851 -0
  181. package/test/providers/helpers.ts +554 -0
  182. package/test/providers/hubspot.test.ts +576 -0
  183. package/test/providers/slack.test.ts +932 -0
  184. package/test/providers/stripe.test.ts +701 -0
  185. package/test/providers.test.ts +578 -0
  186. package/test/system-tools-extended.test.ts +632 -0
  187. package/test/system.test.ts +673 -0
  188. package/test/tools.test.ts +15 -11
  189. package/test/types.test.ts +402 -0
  190. package/test/verb-registration.test.ts +395 -0
  191. package/test/web-tools.test.ts +553 -0
  192. package/test/worker-extended.test.ts +699 -0
  193. package/test/worker.test.ts +576 -0
  194. package/test/wrap.test.ts +366 -0
  195. package/tsconfig.json +3 -13
  196. package/vitest.config.ts +37 -0
  197. package/wrangler.jsonc +9 -0
  198. package/.turbo/turbo-build.log +0 -5
  199. package/dist/providers/voice/vapi.d.ts +0 -27
  200. package/dist/providers/voice/vapi.d.ts.map +0 -1
  201. package/dist/providers/voice/vapi.js +0 -440
  202. package/dist/providers/voice/vapi.js.map +0 -1
  203. package/src/define.js +0 -267
  204. package/src/entities/advertising.js +0 -999
  205. package/src/entities/ai.js +0 -756
  206. package/src/entities/analytics.js +0 -1588
  207. package/src/entities/automation.js +0 -601
  208. package/src/entities/communication.js +0 -1150
  209. package/src/entities/crm.js +0 -1386
  210. package/src/entities/design.js +0 -546
  211. package/src/entities/development.js +0 -2212
  212. package/src/entities/document.js +0 -874
  213. package/src/entities/ecommerce.js +0 -1429
  214. package/src/entities/experiment.js +0 -1039
  215. package/src/entities/finance.js +0 -3478
  216. package/src/entities/forms.js +0 -1892
  217. package/src/entities/hr.js +0 -661
  218. package/src/entities/identity.js +0 -997
  219. package/src/entities/index.js +0 -282
  220. package/src/entities/infrastructure.js +0 -1153
  221. package/src/entities/knowledge.js +0 -1438
  222. package/src/entities/marketing.js +0 -1610
  223. package/src/entities/media.js +0 -1634
  224. package/src/entities/notification.js +0 -1199
  225. package/src/entities/presentation.js +0 -1274
  226. package/src/entities/productivity.js +0 -1317
  227. package/src/entities/project-management.js +0 -1136
  228. package/src/entities/recruiting.js +0 -736
  229. package/src/entities/shipping.js +0 -509
  230. package/src/entities/signature.js +0 -1102
  231. package/src/entities/site.js +0 -222
  232. package/src/entities/spreadsheet.js +0 -1341
  233. package/src/entities/storage.js +0 -1198
  234. package/src/entities/support.js +0 -1166
  235. package/src/entities/video-conferencing.js +0 -1750
  236. package/src/entities/video.js +0 -950
  237. package/src/entities.js +0 -1663
  238. package/src/index.js +0 -74
  239. package/src/providers/analytics/index.js +0 -17
  240. package/src/providers/analytics/mixpanel.js +0 -255
  241. package/src/providers/calendar/cal-com.js +0 -303
  242. package/src/providers/calendar/google-calendar.js +0 -335
  243. package/src/providers/calendar/index.js +0 -20
  244. package/src/providers/crm/hubspot.js +0 -566
  245. package/src/providers/crm/index.js +0 -17
  246. package/src/providers/development/github.js +0 -472
  247. package/src/providers/development/index.js +0 -17
  248. package/src/providers/ecommerce/index.js +0 -17
  249. package/src/providers/ecommerce/shopify.js +0 -378
  250. package/src/providers/email/index.js +0 -20
  251. package/src/providers/email/resend.js +0 -258
  252. package/src/providers/email/sendgrid.js +0 -161
  253. package/src/providers/finance/index.js +0 -17
  254. package/src/providers/finance/stripe.js +0 -549
  255. package/src/providers/forms/index.js +0 -17
  256. package/src/providers/forms/typeform.js +0 -500
  257. package/src/providers/index.js +0 -123
  258. package/src/providers/knowledge/index.js +0 -17
  259. package/src/providers/knowledge/notion.js +0 -389
  260. package/src/providers/marketing/index.js +0 -17
  261. package/src/providers/marketing/mailchimp.js +0 -443
  262. package/src/providers/media/cloudinary.js +0 -318
  263. package/src/providers/media/index.js +0 -17
  264. package/src/providers/messaging/index.js +0 -20
  265. package/src/providers/messaging/slack.js +0 -393
  266. package/src/providers/messaging/twilio-sms.js +0 -249
  267. package/src/providers/project-management/index.js +0 -17
  268. package/src/providers/project-management/linear.js +0 -575
  269. package/src/providers/registry.js +0 -86
  270. package/src/providers/spreadsheet/google-sheets.js +0 -375
  271. package/src/providers/spreadsheet/index.js +0 -20
  272. package/src/providers/spreadsheet/xlsx.js +0 -423
  273. package/src/providers/storage/index.js +0 -24
  274. package/src/providers/storage/s3.js +0 -419
  275. package/src/providers/support/index.js +0 -17
  276. package/src/providers/support/zendesk.js +0 -373
  277. package/src/providers/tasks/index.js +0 -17
  278. package/src/providers/tasks/todoist.js +0 -286
  279. package/src/providers/types.js +0 -9
  280. package/src/providers/video-conferencing/google-meet.js +0 -286
  281. package/src/providers/video-conferencing/index.js +0 -31
  282. package/src/providers/video-conferencing/jitsi.js +0 -254
  283. package/src/providers/video-conferencing/teams.js +0 -270
  284. package/src/providers/video-conferencing/zoom.js +0 -332
  285. package/src/registry.js +0 -128
  286. package/src/tools/communication.js +0 -184
  287. package/src/tools/data.js +0 -205
  288. package/src/tools/index.js +0 -11
  289. package/src/tools/web.js +0 -137
  290. package/src/types.js +0 -10
  291. package/test/define.test.js +0 -306
  292. package/test/registry.test.js +0 -357
  293. package/test/tools.test.js +0 -363
@@ -1,1429 +0,0 @@
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
- };