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