digital-products 2.1.3 → 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 (122) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +2 -0
  3. package/dist/api.js +7 -7
  4. package/dist/api.js.map +1 -1
  5. package/dist/app.js +6 -6
  6. package/dist/app.js.map +1 -1
  7. package/dist/client.d.ts +157 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +69 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/content.js +7 -7
  12. package/dist/content.js.map +1 -1
  13. package/dist/data.d.ts.map +1 -1
  14. package/dist/data.js +6 -6
  15. package/dist/data.js.map +1 -1
  16. package/dist/dataset.js +5 -5
  17. package/dist/dataset.js.map +1 -1
  18. package/dist/index.d.ts +92 -13
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +139 -15
  21. package/dist/index.js.map +1 -1
  22. package/dist/mcp.d.ts +1 -1
  23. package/dist/mcp.d.ts.map +1 -1
  24. package/dist/mcp.js +17 -10
  25. package/dist/mcp.js.map +1 -1
  26. package/dist/product.js +2 -2
  27. package/dist/product.js.map +1 -1
  28. package/dist/sdk.d.ts.map +1 -1
  29. package/dist/sdk.js +52 -16
  30. package/dist/sdk.js.map +1 -1
  31. package/dist/site.d.ts.map +1 -1
  32. package/dist/site.js +12 -8
  33. package/dist/site.js.map +1 -1
  34. package/dist/types.d.ts +830 -12
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/types.js +495 -2
  37. package/dist/types.js.map +1 -1
  38. package/dist/worker.d.ts +205 -0
  39. package/dist/worker.d.ts.map +1 -0
  40. package/dist/worker.js +356 -0
  41. package/dist/worker.js.map +1 -0
  42. package/package.json +29 -13
  43. package/src/api.ts +7 -7
  44. package/src/app.ts +6 -6
  45. package/src/client.ts +192 -0
  46. package/src/content.ts +7 -7
  47. package/src/data.ts +12 -7
  48. package/src/dataset.ts +5 -5
  49. package/src/index.ts +151 -15
  50. package/src/mcp.ts +18 -11
  51. package/src/product.ts +2 -2
  52. package/src/sdk.ts +54 -15
  53. package/src/site.ts +12 -8
  54. package/src/types.ts +821 -12
  55. package/src/worker.ts +525 -0
  56. package/test/product.test.ts +53 -198
  57. package/test/unified-types.test.ts +589 -0
  58. package/test/worker.test.ts +912 -0
  59. package/vitest.config.ts +42 -0
  60. package/wrangler.jsonc +36 -0
  61. package/.turbo/turbo-build.log +0 -5
  62. package/LICENSE +0 -21
  63. package/dist/features/define.d.ts +0 -63
  64. package/dist/features/define.d.ts.map +0 -1
  65. package/dist/features/define.js +0 -72
  66. package/dist/features/define.js.map +0 -1
  67. package/dist/features/flags.d.ts +0 -98
  68. package/dist/features/flags.d.ts.map +0 -1
  69. package/dist/features/flags.js +0 -145
  70. package/dist/features/flags.js.map +0 -1
  71. package/dist/features/toggles.d.ts +0 -75
  72. package/dist/features/toggles.d.ts.map +0 -1
  73. package/dist/features/toggles.js +0 -107
  74. package/dist/features/toggles.js.map +0 -1
  75. package/dist/tiers/define.d.ts +0 -63
  76. package/dist/tiers/define.d.ts.map +0 -1
  77. package/dist/tiers/define.js +0 -78
  78. package/dist/tiers/define.js.map +0 -1
  79. package/dist/tiers/entitlements.d.ts +0 -94
  80. package/dist/tiers/entitlements.d.ts.map +0 -1
  81. package/dist/tiers/entitlements.js +0 -94
  82. package/dist/tiers/entitlements.js.map +0 -1
  83. package/src/api.js +0 -128
  84. package/src/app.js +0 -106
  85. package/src/content.js +0 -77
  86. package/src/data.js +0 -106
  87. package/src/dataset.js +0 -49
  88. package/src/entities/ai.js +0 -858
  89. package/src/entities/content.js +0 -783
  90. package/src/entities/index.js +0 -88
  91. package/src/entities/interfaces.js +0 -929
  92. package/src/entities/lifecycle.js +0 -803
  93. package/src/entities/products.js +0 -797
  94. package/src/entities/web.js +0 -657
  95. package/src/features/define.ts +0 -130
  96. package/src/features/flags.ts +0 -247
  97. package/src/features/toggles.ts +0 -189
  98. package/src/index.js +0 -35
  99. package/src/mcp.js +0 -139
  100. package/src/pricing/billing.ts +0 -386
  101. package/src/pricing/plans.ts +0 -214
  102. package/src/product.js +0 -53
  103. package/src/registry.js +0 -31
  104. package/src/sdk.js +0 -127
  105. package/src/site.js +0 -112
  106. package/src/tiers/define.ts +0 -137
  107. package/src/tiers/entitlements.ts +0 -201
  108. package/src/types.js +0 -4
  109. package/test/analytics/events.test.ts +0 -319
  110. package/test/analytics/experiments.test.ts +0 -327
  111. package/test/features/define.test.ts +0 -187
  112. package/test/features/flags.test.ts +0 -259
  113. package/test/features/toggles.test.ts +0 -178
  114. package/test/lifecycle/stages.test.ts +0 -233
  115. package/test/lifecycle/transitions.test.ts +0 -207
  116. package/test/onboarding/flows.test.ts +0 -307
  117. package/test/pricing/billing.test.ts +0 -287
  118. package/test/pricing/plans.test.ts +0 -307
  119. package/test/roadmap/milestones.test.ts +0 -231
  120. package/test/roadmap/priorities.test.ts +0 -239
  121. package/test/tiers/define.test.ts +0 -192
  122. package/test/tiers/entitlements.test.ts +0 -220
@@ -1,657 +0,0 @@
1
- /**
2
- * Web Entity Types (Nouns)
3
- *
4
- * Web-based products: Site, Component, Widget, Theme
5
- *
6
- * @packageDocumentation
7
- */
8
- // =============================================================================
9
- // Site
10
- // =============================================================================
11
- /**
12
- * Site entity
13
- *
14
- * Website or web application.
15
- */
16
- export const Site = {
17
- singular: 'site',
18
- plural: 'sites',
19
- description: 'A website or web application',
20
- properties: {
21
- // Identity
22
- name: {
23
- type: 'string',
24
- description: 'Site name',
25
- },
26
- slug: {
27
- type: 'string',
28
- optional: true,
29
- description: 'URL-friendly identifier',
30
- },
31
- description: {
32
- type: 'string',
33
- optional: true,
34
- description: 'Site description',
35
- },
36
- // Type
37
- type: {
38
- type: 'string',
39
- description: 'Site type',
40
- examples: ['marketing', 'documentation', 'blog', 'e-commerce', 'portal', 'dashboard', 'landing'],
41
- },
42
- // Technology
43
- framework: {
44
- type: 'string',
45
- optional: true,
46
- description: 'Framework/generator',
47
- examples: ['next', 'nuxt', 'astro', 'gatsby', 'remix', 'sveltekit', 'eleventy', 'hugo'],
48
- },
49
- renderingMode: {
50
- type: 'string',
51
- optional: true,
52
- description: 'Rendering mode',
53
- examples: ['static', 'ssr', 'spa', 'hybrid', 'isr'],
54
- },
55
- // Domain
56
- domain: {
57
- type: 'string',
58
- optional: true,
59
- description: 'Primary domain',
60
- },
61
- customDomains: {
62
- type: 'string',
63
- array: true,
64
- optional: true,
65
- description: 'Custom domains',
66
- },
67
- subdomain: {
68
- type: 'string',
69
- optional: true,
70
- description: 'Subdomain',
71
- },
72
- // Hosting
73
- hosting: {
74
- type: 'string',
75
- optional: true,
76
- description: 'Hosting platform',
77
- examples: ['vercel', 'netlify', 'cloudflare', 'aws', 'gcp', 'self-hosted'],
78
- },
79
- cdnEnabled: {
80
- type: 'boolean',
81
- optional: true,
82
- description: 'CDN enabled',
83
- },
84
- // SEO
85
- title: {
86
- type: 'string',
87
- optional: true,
88
- description: 'Site title',
89
- },
90
- metaDescription: {
91
- type: 'string',
92
- optional: true,
93
- description: 'Meta description',
94
- },
95
- ogImage: {
96
- type: 'string',
97
- optional: true,
98
- description: 'Open Graph image URL',
99
- },
100
- // Analytics
101
- analyticsProvider: {
102
- type: 'string',
103
- optional: true,
104
- description: 'Analytics provider',
105
- examples: ['google', 'plausible', 'fathom', 'posthog', 'mixpanel'],
106
- },
107
- analyticsId: {
108
- type: 'string',
109
- optional: true,
110
- description: 'Analytics tracking ID',
111
- },
112
- // Performance
113
- lighthouseScore: {
114
- type: 'number',
115
- optional: true,
116
- description: 'Lighthouse performance score',
117
- },
118
- coreWebVitals: {
119
- type: 'json',
120
- optional: true,
121
- description: 'Core Web Vitals metrics',
122
- },
123
- // Status
124
- status: {
125
- type: 'string',
126
- description: 'Site status',
127
- examples: ['draft', 'development', 'staging', 'production', 'archived'],
128
- },
129
- },
130
- relationships: {
131
- product: {
132
- type: 'DigitalProduct',
133
- required: false,
134
- description: 'Parent product',
135
- },
136
- pages: {
137
- type: 'Page[]',
138
- description: 'Site pages',
139
- },
140
- deployments: {
141
- type: 'Deployment[]',
142
- description: 'Site deployments',
143
- },
144
- theme: {
145
- type: 'Theme',
146
- required: false,
147
- description: 'Applied theme',
148
- },
149
- },
150
- actions: [
151
- 'create',
152
- 'update',
153
- 'build',
154
- 'deploy',
155
- 'addDomain',
156
- 'removeDomain',
157
- 'updateSEO',
158
- 'archive',
159
- ],
160
- events: [
161
- 'created',
162
- 'updated',
163
- 'built',
164
- 'deployed',
165
- 'domainAdded',
166
- 'domainRemoved',
167
- 'seoUpdated',
168
- 'archived',
169
- ],
170
- };
171
- // =============================================================================
172
- // Component
173
- // =============================================================================
174
- /**
175
- * Component entity
176
- *
177
- * Reusable UI component.
178
- */
179
- export const Component = {
180
- singular: 'component',
181
- plural: 'components',
182
- description: 'A reusable UI component',
183
- properties: {
184
- // Identity
185
- name: {
186
- type: 'string',
187
- description: 'Component name',
188
- },
189
- slug: {
190
- type: 'string',
191
- optional: true,
192
- description: 'URL-friendly identifier',
193
- },
194
- description: {
195
- type: 'string',
196
- optional: true,
197
- description: 'Component description',
198
- },
199
- // Classification
200
- type: {
201
- type: 'string',
202
- description: 'Component type',
203
- examples: ['primitive', 'composite', 'layout', 'form', 'data-display', 'navigation', 'feedback'],
204
- },
205
- category: {
206
- type: 'string',
207
- optional: true,
208
- description: 'Component category',
209
- },
210
- // Technology
211
- framework: {
212
- type: 'string',
213
- description: 'Target framework',
214
- examples: ['react', 'vue', 'svelte', 'solid', 'angular', 'web-components'],
215
- },
216
- language: {
217
- type: 'string',
218
- optional: true,
219
- description: 'Language',
220
- examples: ['typescript', 'javascript'],
221
- },
222
- // Interface
223
- propsSchema: {
224
- type: 'json',
225
- optional: true,
226
- description: 'Props/attributes schema',
227
- },
228
- slotsSchema: {
229
- type: 'json',
230
- optional: true,
231
- description: 'Slots schema',
232
- },
233
- eventsSchema: {
234
- type: 'json',
235
- optional: true,
236
- description: 'Events emitted',
237
- },
238
- // Styling
239
- styleApproach: {
240
- type: 'string',
241
- optional: true,
242
- description: 'Styling approach',
243
- examples: ['css-modules', 'tailwind', 'styled-components', 'css-in-js', 'vanilla'],
244
- },
245
- themeable: {
246
- type: 'boolean',
247
- optional: true,
248
- description: 'Supports theming',
249
- },
250
- // Accessibility
251
- a11yCompliant: {
252
- type: 'boolean',
253
- optional: true,
254
- description: 'WCAG compliant',
255
- },
256
- a11yLevel: {
257
- type: 'string',
258
- optional: true,
259
- description: 'WCAG compliance level',
260
- examples: ['A', 'AA', 'AAA'],
261
- },
262
- // Package
263
- packageName: {
264
- type: 'string',
265
- optional: true,
266
- description: 'npm package name',
267
- },
268
- version: {
269
- type: 'string',
270
- optional: true,
271
- description: 'Component version',
272
- },
273
- // Documentation
274
- storybookUrl: {
275
- type: 'string',
276
- optional: true,
277
- description: 'Storybook URL',
278
- },
279
- docsUrl: {
280
- type: 'string',
281
- optional: true,
282
- description: 'Documentation URL',
283
- },
284
- // Status
285
- status: {
286
- type: 'string',
287
- description: 'Component status',
288
- examples: ['draft', 'alpha', 'beta', 'stable', 'deprecated'],
289
- },
290
- },
291
- relationships: {
292
- product: {
293
- type: 'DigitalProduct',
294
- required: false,
295
- description: 'Parent product',
296
- },
297
- variants: {
298
- type: 'ComponentVariant[]',
299
- description: 'Component variants',
300
- },
301
- dependencies: {
302
- type: 'Component[]',
303
- description: 'Dependent components',
304
- },
305
- },
306
- actions: [
307
- 'create',
308
- 'update',
309
- 'addVariant',
310
- 'removeVariant',
311
- 'publish',
312
- 'deprecate',
313
- ],
314
- events: [
315
- 'created',
316
- 'updated',
317
- 'variantAdded',
318
- 'variantRemoved',
319
- 'published',
320
- 'deprecated',
321
- ],
322
- };
323
- // =============================================================================
324
- // Widget
325
- // =============================================================================
326
- /**
327
- * Widget entity
328
- *
329
- * Embeddable UI element.
330
- */
331
- export const Widget = {
332
- singular: 'widget',
333
- plural: 'widgets',
334
- description: 'An embeddable UI element for external sites',
335
- properties: {
336
- // Identity
337
- name: {
338
- type: 'string',
339
- description: 'Widget name',
340
- },
341
- slug: {
342
- type: 'string',
343
- optional: true,
344
- description: 'URL-friendly identifier',
345
- },
346
- description: {
347
- type: 'string',
348
- optional: true,
349
- description: 'Widget description',
350
- },
351
- // Type
352
- type: {
353
- type: 'string',
354
- description: 'Widget type',
355
- examples: ['chat', 'form', 'badge', 'button', 'carousel', 'feed', 'player', 'tracker'],
356
- },
357
- // Embedding
358
- embedType: {
359
- type: 'string',
360
- description: 'Embed method',
361
- examples: ['script', 'iframe', 'web-component', 'react', 'snippet'],
362
- },
363
- embedCode: {
364
- type: 'string',
365
- optional: true,
366
- description: 'Embed code snippet',
367
- },
368
- scriptUrl: {
369
- type: 'string',
370
- optional: true,
371
- description: 'Widget script URL',
372
- },
373
- // Configuration
374
- configSchema: {
375
- type: 'json',
376
- optional: true,
377
- description: 'Configuration schema',
378
- },
379
- defaultConfig: {
380
- type: 'json',
381
- optional: true,
382
- description: 'Default configuration',
383
- },
384
- // Dimensions
385
- width: {
386
- type: 'string',
387
- optional: true,
388
- description: 'Default width',
389
- },
390
- height: {
391
- type: 'string',
392
- optional: true,
393
- description: 'Default height',
394
- },
395
- responsive: {
396
- type: 'boolean',
397
- optional: true,
398
- description: 'Responsive design',
399
- },
400
- // Styling
401
- customizable: {
402
- type: 'boolean',
403
- optional: true,
404
- description: 'Styling customizable',
405
- },
406
- themeOptions: {
407
- type: 'string',
408
- array: true,
409
- optional: true,
410
- description: 'Theme options',
411
- },
412
- // Security
413
- allowedDomains: {
414
- type: 'string',
415
- array: true,
416
- optional: true,
417
- description: 'Allowed embed domains',
418
- },
419
- sandboxed: {
420
- type: 'boolean',
421
- optional: true,
422
- description: 'Runs in sandbox',
423
- },
424
- // Metrics
425
- embedCount: {
426
- type: 'number',
427
- optional: true,
428
- description: 'Number of active embeds',
429
- },
430
- impressions: {
431
- type: 'number',
432
- optional: true,
433
- description: 'Total impressions',
434
- },
435
- // Status
436
- status: {
437
- type: 'string',
438
- description: 'Widget status',
439
- examples: ['draft', 'active', 'deprecated'],
440
- },
441
- version: {
442
- type: 'string',
443
- optional: true,
444
- description: 'Widget version',
445
- },
446
- },
447
- relationships: {
448
- product: {
449
- type: 'DigitalProduct',
450
- required: false,
451
- description: 'Parent product',
452
- },
453
- instances: {
454
- type: 'WidgetInstance[]',
455
- description: 'Widget instances',
456
- },
457
- },
458
- actions: [
459
- 'create',
460
- 'update',
461
- 'configure',
462
- 'publish',
463
- 'embed',
464
- 'deprecate',
465
- ],
466
- events: [
467
- 'created',
468
- 'updated',
469
- 'configured',
470
- 'published',
471
- 'embedded',
472
- 'deprecated',
473
- ],
474
- };
475
- // =============================================================================
476
- // Theme
477
- // =============================================================================
478
- /**
479
- * Theme entity
480
- *
481
- * Visual styling package.
482
- */
483
- export const Theme = {
484
- singular: 'theme',
485
- plural: 'themes',
486
- description: 'A visual styling package for sites or apps',
487
- properties: {
488
- // Identity
489
- name: {
490
- type: 'string',
491
- description: 'Theme name',
492
- },
493
- slug: {
494
- type: 'string',
495
- optional: true,
496
- description: 'URL-friendly identifier',
497
- },
498
- description: {
499
- type: 'string',
500
- optional: true,
501
- description: 'Theme description',
502
- },
503
- // Classification
504
- type: {
505
- type: 'string',
506
- description: 'Theme type',
507
- examples: ['light', 'dark', 'high-contrast', 'custom'],
508
- },
509
- style: {
510
- type: 'string',
511
- optional: true,
512
- description: 'Design style',
513
- examples: ['minimal', 'modern', 'classic', 'playful', 'corporate', 'brutalist'],
514
- },
515
- // Target
516
- targetPlatform: {
517
- type: 'string',
518
- optional: true,
519
- description: 'Target platform',
520
- examples: ['web', 'mobile', 'desktop', 'universal'],
521
- },
522
- targetFramework: {
523
- type: 'string',
524
- optional: true,
525
- description: 'Target framework',
526
- },
527
- // Colors
528
- colorPalette: {
529
- type: 'json',
530
- optional: true,
531
- description: 'Color palette',
532
- },
533
- primaryColor: {
534
- type: 'string',
535
- optional: true,
536
- description: 'Primary brand color',
537
- },
538
- accentColor: {
539
- type: 'string',
540
- optional: true,
541
- description: 'Accent color',
542
- },
543
- // Typography
544
- fontFamily: {
545
- type: 'string',
546
- optional: true,
547
- description: 'Primary font family',
548
- },
549
- headingFont: {
550
- type: 'string',
551
- optional: true,
552
- description: 'Heading font family',
553
- },
554
- fontSize: {
555
- type: 'json',
556
- optional: true,
557
- description: 'Font size scale',
558
- },
559
- // Spacing
560
- spacing: {
561
- type: 'json',
562
- optional: true,
563
- description: 'Spacing scale',
564
- },
565
- borderRadius: {
566
- type: 'json',
567
- optional: true,
568
- description: 'Border radius scale',
569
- },
570
- // Variables
571
- cssVariables: {
572
- type: 'json',
573
- optional: true,
574
- description: 'CSS custom properties',
575
- },
576
- designTokens: {
577
- type: 'json',
578
- optional: true,
579
- description: 'Design tokens',
580
- },
581
- // Preview
582
- previewUrl: {
583
- type: 'string',
584
- optional: true,
585
- description: 'Preview URL',
586
- },
587
- thumbnailUrl: {
588
- type: 'string',
589
- optional: true,
590
- description: 'Thumbnail image URL',
591
- },
592
- // Package
593
- packageName: {
594
- type: 'string',
595
- optional: true,
596
- description: 'npm package name',
597
- },
598
- version: {
599
- type: 'string',
600
- optional: true,
601
- description: 'Theme version',
602
- },
603
- // Status
604
- status: {
605
- type: 'string',
606
- description: 'Theme status',
607
- examples: ['draft', 'published', 'deprecated'],
608
- },
609
- },
610
- relationships: {
611
- product: {
612
- type: 'DigitalProduct',
613
- required: false,
614
- description: 'Parent product',
615
- },
616
- sites: {
617
- type: 'Site[]',
618
- description: 'Sites using this theme',
619
- },
620
- variants: {
621
- type: 'Theme[]',
622
- description: 'Theme variants',
623
- },
624
- },
625
- actions: [
626
- 'create',
627
- 'update',
628
- 'customize',
629
- 'publish',
630
- 'apply',
631
- 'export',
632
- 'deprecate',
633
- ],
634
- events: [
635
- 'created',
636
- 'updated',
637
- 'customized',
638
- 'published',
639
- 'applied',
640
- 'exported',
641
- 'deprecated',
642
- ],
643
- };
644
- // =============================================================================
645
- // Exports
646
- // =============================================================================
647
- export const WebEntities = {
648
- Site,
649
- Component,
650
- Widget,
651
- Theme,
652
- };
653
- export const WebCategories = {
654
- sites: ['Site'],
655
- ui: ['Component', 'Widget'],
656
- styling: ['Theme'],
657
- };