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,1017 @@
1
+ /**
2
+ * Interface Entity Types (Nouns)
3
+ *
4
+ * API and integration products: API, SDK, MCP, Plugin, Integration, Webhook
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Noun } from 'ai-database'
10
+
11
+ // =============================================================================
12
+ // API
13
+ // =============================================================================
14
+
15
+ /**
16
+ * API entity
17
+ *
18
+ * Programmatic interface product.
19
+ */
20
+ export const API: Noun = {
21
+ singular: 'api',
22
+ plural: 'apis',
23
+ description: 'A programmatic interface for accessing functionality or data',
24
+
25
+ properties: {
26
+ // Identity
27
+ name: {
28
+ type: 'string',
29
+ description: 'API 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: 'API description',
40
+ },
41
+
42
+ // Classification
43
+ style: {
44
+ type: 'string',
45
+ description: 'API style',
46
+ examples: ['rest', 'graphql', 'rpc', 'grpc', 'websocket', 'soap', 'odata'],
47
+ },
48
+ category: {
49
+ type: 'string',
50
+ optional: true,
51
+ description: 'API category',
52
+ },
53
+
54
+ // Configuration
55
+ baseUrl: {
56
+ type: 'string',
57
+ optional: true,
58
+ description: 'Base URL',
59
+ },
60
+ version: {
61
+ type: 'string',
62
+ optional: true,
63
+ description: 'API version',
64
+ },
65
+ versioningStrategy: {
66
+ type: 'string',
67
+ optional: true,
68
+ description: 'Versioning strategy',
69
+ examples: ['url', 'header', 'query', 'none'],
70
+ },
71
+
72
+ // Specification
73
+ openApiSpec: {
74
+ type: 'string',
75
+ optional: true,
76
+ description: 'OpenAPI specification URL',
77
+ },
78
+ graphqlSchema: {
79
+ type: 'string',
80
+ optional: true,
81
+ description: 'GraphQL schema URL',
82
+ },
83
+
84
+ // Authentication
85
+ authMethods: {
86
+ type: 'string',
87
+ array: true,
88
+ optional: true,
89
+ description: 'Supported authentication methods',
90
+ examples: ['api-key', 'bearer', 'oauth2', 'basic', 'jwt', 'mtls'],
91
+ },
92
+ scopes: {
93
+ type: 'string',
94
+ array: true,
95
+ optional: true,
96
+ description: 'Available OAuth scopes',
97
+ },
98
+
99
+ // Rate Limiting
100
+ rateLimit: {
101
+ type: 'number',
102
+ optional: true,
103
+ description: 'Requests per minute limit',
104
+ },
105
+ rateLimitWindow: {
106
+ type: 'number',
107
+ optional: true,
108
+ description: 'Rate limit window in seconds',
109
+ },
110
+ burstLimit: {
111
+ type: 'number',
112
+ optional: true,
113
+ description: 'Burst request limit',
114
+ },
115
+
116
+ // Documentation
117
+ docsUrl: {
118
+ type: 'string',
119
+ optional: true,
120
+ description: 'API documentation URL',
121
+ },
122
+ changelogUrl: {
123
+ type: 'string',
124
+ optional: true,
125
+ description: 'Changelog URL',
126
+ },
127
+
128
+ // Status
129
+ status: {
130
+ type: 'string',
131
+ description: 'API status',
132
+ examples: ['draft', 'alpha', 'beta', 'stable', 'deprecated', 'sunset'],
133
+ },
134
+ },
135
+
136
+ relationships: {
137
+ product: {
138
+ type: 'DigitalProduct',
139
+ description: 'Parent product',
140
+ },
141
+ endpoints: {
142
+ type: 'Endpoint[]',
143
+ description: 'API endpoints',
144
+ },
145
+ sdks: {
146
+ type: 'SDK[]',
147
+ description: 'Available SDKs',
148
+ },
149
+ webhooks: {
150
+ type: 'Webhook[]',
151
+ description: 'Available webhooks',
152
+ },
153
+ },
154
+
155
+ actions: [
156
+ 'create',
157
+ 'update',
158
+ 'publish',
159
+ 'addEndpoint',
160
+ 'removeEndpoint',
161
+ 'updateRateLimit',
162
+ 'deprecate',
163
+ 'sunset',
164
+ ],
165
+
166
+ events: [
167
+ 'created',
168
+ 'updated',
169
+ 'published',
170
+ 'endpointAdded',
171
+ 'endpointRemoved',
172
+ 'rateLimitUpdated',
173
+ 'deprecated',
174
+ 'sunset',
175
+ ],
176
+ }
177
+
178
+ // =============================================================================
179
+ // Endpoint
180
+ // =============================================================================
181
+
182
+ /**
183
+ * Endpoint entity
184
+ *
185
+ * Individual API endpoint.
186
+ */
187
+ export const Endpoint: Noun = {
188
+ singular: 'endpoint',
189
+ plural: 'endpoints',
190
+ description: 'An individual API endpoint',
191
+
192
+ properties: {
193
+ // Identity
194
+ name: {
195
+ type: 'string',
196
+ description: 'Endpoint name',
197
+ },
198
+ description: {
199
+ type: 'string',
200
+ optional: true,
201
+ description: 'Endpoint description',
202
+ },
203
+
204
+ // HTTP
205
+ method: {
206
+ type: 'string',
207
+ description: 'HTTP method',
208
+ examples: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
209
+ },
210
+ path: {
211
+ type: 'string',
212
+ description: 'URL path pattern',
213
+ },
214
+
215
+ // Parameters
216
+ pathParams: {
217
+ type: 'json',
218
+ optional: true,
219
+ description: 'Path parameters schema',
220
+ },
221
+ queryParams: {
222
+ type: 'json',
223
+ optional: true,
224
+ description: 'Query parameters schema',
225
+ },
226
+ headers: {
227
+ type: 'json',
228
+ optional: true,
229
+ description: 'Required headers',
230
+ },
231
+
232
+ // Body
233
+ requestBody: {
234
+ type: 'json',
235
+ optional: true,
236
+ description: 'Request body schema',
237
+ },
238
+ responseBody: {
239
+ type: 'json',
240
+ optional: true,
241
+ description: 'Response body schema',
242
+ },
243
+ contentType: {
244
+ type: 'string',
245
+ optional: true,
246
+ description: 'Content type',
247
+ examples: ['application/json', 'multipart/form-data', 'text/plain'],
248
+ },
249
+
250
+ // Authentication
251
+ requiresAuth: {
252
+ type: 'boolean',
253
+ optional: true,
254
+ description: 'Requires authentication',
255
+ },
256
+ requiredScopes: {
257
+ type: 'string',
258
+ array: true,
259
+ optional: true,
260
+ description: 'Required OAuth scopes',
261
+ },
262
+
263
+ // Rate Limiting
264
+ rateLimit: {
265
+ type: 'number',
266
+ optional: true,
267
+ description: 'Endpoint-specific rate limit',
268
+ },
269
+
270
+ // Caching
271
+ cacheable: {
272
+ type: 'boolean',
273
+ optional: true,
274
+ description: 'Response is cacheable',
275
+ },
276
+ cacheTTL: {
277
+ type: 'number',
278
+ optional: true,
279
+ description: 'Cache TTL in seconds',
280
+ },
281
+
282
+ // Status
283
+ status: {
284
+ type: 'string',
285
+ description: 'Endpoint status',
286
+ examples: ['active', 'deprecated', 'removed'],
287
+ },
288
+ },
289
+
290
+ relationships: {
291
+ api: {
292
+ type: 'API',
293
+ description: 'Parent API',
294
+ },
295
+ },
296
+
297
+ actions: [
298
+ 'create',
299
+ 'update',
300
+ 'enable',
301
+ 'disable',
302
+ 'deprecate',
303
+ 'remove',
304
+ ],
305
+
306
+ events: [
307
+ 'created',
308
+ 'updated',
309
+ 'enabled',
310
+ 'disabled',
311
+ 'deprecated',
312
+ 'removed',
313
+ ],
314
+ }
315
+
316
+ // =============================================================================
317
+ // SDK
318
+ // =============================================================================
319
+
320
+ /**
321
+ * SDK entity
322
+ *
323
+ * Software development kit for consuming APIs.
324
+ */
325
+ export const SDK: Noun = {
326
+ singular: 'sdk',
327
+ plural: 'sdks',
328
+ description: 'A software development kit for accessing an API',
329
+
330
+ properties: {
331
+ // Identity
332
+ name: {
333
+ type: 'string',
334
+ description: 'SDK name',
335
+ },
336
+ description: {
337
+ type: 'string',
338
+ optional: true,
339
+ description: 'SDK description',
340
+ },
341
+
342
+ // Target
343
+ language: {
344
+ type: 'string',
345
+ description: 'Target programming language',
346
+ examples: ['typescript', 'javascript', 'python', 'go', 'rust', 'java', 'csharp', 'ruby', 'php', 'swift', 'kotlin'],
347
+ },
348
+ runtime: {
349
+ type: 'string',
350
+ optional: true,
351
+ description: 'Target runtime',
352
+ examples: ['node', 'bun', 'deno', 'browser', 'native'],
353
+ },
354
+
355
+ // Package
356
+ packageName: {
357
+ type: 'string',
358
+ optional: true,
359
+ description: 'Package name',
360
+ },
361
+ version: {
362
+ type: 'string',
363
+ optional: true,
364
+ description: 'Current version',
365
+ },
366
+ registry: {
367
+ type: 'string',
368
+ optional: true,
369
+ description: 'Package registry',
370
+ examples: ['npm', 'pypi', 'crates', 'maven', 'nuget', 'rubygems'],
371
+ },
372
+
373
+ // Installation
374
+ installCommand: {
375
+ type: 'string',
376
+ optional: true,
377
+ description: 'Installation command',
378
+ },
379
+
380
+ // Generation
381
+ generator: {
382
+ type: 'string',
383
+ optional: true,
384
+ description: 'SDK generator used',
385
+ examples: ['openapi-generator', 'swagger-codegen', 'fern', 'speakeasy', 'custom'],
386
+ },
387
+ autoGenerated: {
388
+ type: 'boolean',
389
+ optional: true,
390
+ description: 'Auto-generated from spec',
391
+ },
392
+
393
+ // Documentation
394
+ docsUrl: {
395
+ type: 'string',
396
+ optional: true,
397
+ description: 'SDK documentation URL',
398
+ },
399
+ repositoryUrl: {
400
+ type: 'string',
401
+ optional: true,
402
+ description: 'Source repository URL',
403
+ },
404
+
405
+ // Status
406
+ status: {
407
+ type: 'string',
408
+ description: 'SDK status',
409
+ examples: ['alpha', 'beta', 'stable', 'deprecated'],
410
+ },
411
+ },
412
+
413
+ relationships: {
414
+ api: {
415
+ type: 'API',
416
+ description: 'Parent API',
417
+ },
418
+ exports: {
419
+ type: 'SDKExport[]',
420
+ description: 'Exported functions/classes',
421
+ },
422
+ examples: {
423
+ type: 'SDKExample[]',
424
+ description: 'Code examples',
425
+ },
426
+ },
427
+
428
+ actions: [
429
+ 'create',
430
+ 'update',
431
+ 'generate',
432
+ 'publish',
433
+ 'deprecate',
434
+ ],
435
+
436
+ events: [
437
+ 'created',
438
+ 'updated',
439
+ 'generated',
440
+ 'published',
441
+ 'deprecated',
442
+ ],
443
+ }
444
+
445
+ // =============================================================================
446
+ // MCP
447
+ // =============================================================================
448
+
449
+ /**
450
+ * MCP entity
451
+ *
452
+ * Model Context Protocol server for AI tool integration.
453
+ */
454
+ export const MCP: Noun = {
455
+ singular: 'mcp',
456
+ plural: 'mcps',
457
+ description: 'A Model Context Protocol server providing AI tools',
458
+
459
+ properties: {
460
+ // Identity
461
+ name: {
462
+ type: 'string',
463
+ description: 'MCP server name',
464
+ },
465
+ description: {
466
+ type: 'string',
467
+ optional: true,
468
+ description: 'Server description',
469
+ },
470
+
471
+ // Transport
472
+ transport: {
473
+ type: 'string',
474
+ description: 'Transport protocol',
475
+ examples: ['stdio', 'http', 'websocket', 'sse'],
476
+ },
477
+
478
+ // Configuration
479
+ host: {
480
+ type: 'string',
481
+ optional: true,
482
+ description: 'Server host',
483
+ },
484
+ port: {
485
+ type: 'number',
486
+ optional: true,
487
+ description: 'Server port',
488
+ },
489
+ command: {
490
+ type: 'string',
491
+ optional: true,
492
+ description: 'Stdio command',
493
+ },
494
+ args: {
495
+ type: 'string',
496
+ array: true,
497
+ optional: true,
498
+ description: 'Command arguments',
499
+ },
500
+
501
+ // Capabilities
502
+ toolCount: {
503
+ type: 'number',
504
+ optional: true,
505
+ description: 'Number of tools provided',
506
+ },
507
+ resourceCount: {
508
+ type: 'number',
509
+ optional: true,
510
+ description: 'Number of resources provided',
511
+ },
512
+ promptCount: {
513
+ type: 'number',
514
+ optional: true,
515
+ description: 'Number of prompts provided',
516
+ },
517
+
518
+ // Authentication
519
+ authRequired: {
520
+ type: 'boolean',
521
+ optional: true,
522
+ description: 'Authentication required',
523
+ },
524
+ authType: {
525
+ type: 'string',
526
+ optional: true,
527
+ description: 'Authentication type',
528
+ examples: ['bearer', 'api-key', 'oauth2'],
529
+ },
530
+
531
+ // Status
532
+ status: {
533
+ type: 'string',
534
+ description: 'Server status',
535
+ examples: ['active', 'inactive', 'deprecated'],
536
+ },
537
+ },
538
+
539
+ relationships: {
540
+ product: {
541
+ type: 'DigitalProduct',
542
+ description: 'Parent product',
543
+ },
544
+ tools: {
545
+ type: 'Tool[]',
546
+ description: 'Available tools',
547
+ },
548
+ resources: {
549
+ type: 'Resource[]',
550
+ description: 'Available resources',
551
+ },
552
+ prompts: {
553
+ type: 'Prompt[]',
554
+ description: 'Available prompts',
555
+ },
556
+ },
557
+
558
+ actions: [
559
+ 'create',
560
+ 'update',
561
+ 'start',
562
+ 'stop',
563
+ 'restart',
564
+ 'addTool',
565
+ 'removeTool',
566
+ 'deprecate',
567
+ ],
568
+
569
+ events: [
570
+ 'created',
571
+ 'updated',
572
+ 'started',
573
+ 'stopped',
574
+ 'restarted',
575
+ 'toolAdded',
576
+ 'toolRemoved',
577
+ 'deprecated',
578
+ ],
579
+ }
580
+
581
+ // =============================================================================
582
+ // Plugin
583
+ // =============================================================================
584
+
585
+ /**
586
+ * Plugin entity
587
+ *
588
+ * Extension for existing platforms or applications.
589
+ */
590
+ export const Plugin: Noun = {
591
+ singular: 'plugin',
592
+ plural: 'plugins',
593
+ description: 'An extension that adds functionality to a platform',
594
+
595
+ properties: {
596
+ // Identity
597
+ name: {
598
+ type: 'string',
599
+ description: 'Plugin name',
600
+ },
601
+ slug: {
602
+ type: 'string',
603
+ optional: true,
604
+ description: 'URL-friendly identifier',
605
+ },
606
+ description: {
607
+ type: 'string',
608
+ optional: true,
609
+ description: 'Plugin description',
610
+ },
611
+
612
+ // Target
613
+ platform: {
614
+ type: 'string',
615
+ description: 'Target platform',
616
+ examples: ['vscode', 'chrome', 'figma', 'slack', 'notion', 'shopify', 'wordpress'],
617
+ },
618
+ platformVersion: {
619
+ type: 'string',
620
+ optional: true,
621
+ description: 'Minimum platform version',
622
+ },
623
+
624
+ // Package
625
+ version: {
626
+ type: 'string',
627
+ optional: true,
628
+ description: 'Plugin version',
629
+ },
630
+ author: {
631
+ type: 'string',
632
+ optional: true,
633
+ description: 'Plugin author',
634
+ },
635
+
636
+ // Capabilities
637
+ permissions: {
638
+ type: 'string',
639
+ array: true,
640
+ optional: true,
641
+ description: 'Required permissions',
642
+ },
643
+ extensionPoints: {
644
+ type: 'string',
645
+ array: true,
646
+ optional: true,
647
+ description: 'Extension points used',
648
+ },
649
+
650
+ // Distribution
651
+ marketplaceUrl: {
652
+ type: 'string',
653
+ optional: true,
654
+ description: 'Marketplace listing URL',
655
+ },
656
+ installCount: {
657
+ type: 'number',
658
+ optional: true,
659
+ description: 'Total install count',
660
+ },
661
+ rating: {
662
+ type: 'number',
663
+ optional: true,
664
+ description: 'Average rating',
665
+ },
666
+
667
+ // Status
668
+ status: {
669
+ type: 'string',
670
+ description: 'Plugin status',
671
+ examples: ['draft', 'review', 'published', 'suspended', 'deprecated'],
672
+ },
673
+ },
674
+
675
+ relationships: {
676
+ product: {
677
+ type: 'DigitalProduct',
678
+ description: 'Parent product',
679
+ },
680
+ versions: {
681
+ type: 'Version[]',
682
+ description: 'Plugin versions',
683
+ },
684
+ },
685
+
686
+ actions: [
687
+ 'create',
688
+ 'update',
689
+ 'submit',
690
+ 'publish',
691
+ 'update',
692
+ 'suspend',
693
+ 'deprecate',
694
+ ],
695
+
696
+ events: [
697
+ 'created',
698
+ 'updated',
699
+ 'submitted',
700
+ 'published',
701
+ 'suspended',
702
+ 'deprecated',
703
+ ],
704
+ }
705
+
706
+ // =============================================================================
707
+ // Integration
708
+ // =============================================================================
709
+
710
+ /**
711
+ * Integration entity
712
+ *
713
+ * Connection between two systems or platforms.
714
+ */
715
+ export const Integration: Noun = {
716
+ singular: 'integration',
717
+ plural: 'integrations',
718
+ description: 'A connection between systems enabling data or functionality sharing',
719
+
720
+ properties: {
721
+ // Identity
722
+ name: {
723
+ type: 'string',
724
+ description: 'Integration name',
725
+ },
726
+ slug: {
727
+ type: 'string',
728
+ optional: true,
729
+ description: 'URL-friendly identifier',
730
+ },
731
+ description: {
732
+ type: 'string',
733
+ optional: true,
734
+ description: 'Integration description',
735
+ },
736
+
737
+ // Connection
738
+ sourceSystem: {
739
+ type: 'string',
740
+ description: 'Source system',
741
+ },
742
+ targetSystem: {
743
+ type: 'string',
744
+ description: 'Target system',
745
+ },
746
+ direction: {
747
+ type: 'string',
748
+ description: 'Data flow direction',
749
+ examples: ['one-way', 'two-way', 'bidirectional'],
750
+ },
751
+
752
+ // Type
753
+ type: {
754
+ type: 'string',
755
+ description: 'Integration type',
756
+ examples: ['native', 'oauth', 'api-key', 'webhook', 'embedded', 'custom'],
757
+ },
758
+ protocol: {
759
+ type: 'string',
760
+ optional: true,
761
+ description: 'Integration protocol',
762
+ examples: ['rest', 'graphql', 'grpc', 'soap', 'sftp', 'custom'],
763
+ },
764
+
765
+ // Data
766
+ dataTypes: {
767
+ type: 'string',
768
+ array: true,
769
+ optional: true,
770
+ description: 'Types of data exchanged',
771
+ },
772
+ syncFrequency: {
773
+ type: 'string',
774
+ optional: true,
775
+ description: 'Sync frequency',
776
+ examples: ['realtime', 'hourly', 'daily', 'on-demand'],
777
+ },
778
+
779
+ // Configuration
780
+ configSchema: {
781
+ type: 'json',
782
+ optional: true,
783
+ description: 'Configuration schema',
784
+ },
785
+ requiredScopes: {
786
+ type: 'string',
787
+ array: true,
788
+ optional: true,
789
+ description: 'Required OAuth scopes',
790
+ },
791
+
792
+ // Status
793
+ status: {
794
+ type: 'string',
795
+ description: 'Integration status',
796
+ examples: ['draft', 'active', 'paused', 'deprecated'],
797
+ },
798
+ },
799
+
800
+ relationships: {
801
+ product: {
802
+ type: 'DigitalProduct',
803
+ description: 'Parent product',
804
+ },
805
+ sourceApi: {
806
+ type: 'API',
807
+ required: false,
808
+ description: 'Source API',
809
+ },
810
+ targetApi: {
811
+ type: 'API',
812
+ required: false,
813
+ description: 'Target API',
814
+ },
815
+ webhooks: {
816
+ type: 'Webhook[]',
817
+ description: 'Integration webhooks',
818
+ },
819
+ },
820
+
821
+ actions: [
822
+ 'create',
823
+ 'update',
824
+ 'configure',
825
+ 'activate',
826
+ 'pause',
827
+ 'sync',
828
+ 'test',
829
+ 'deprecate',
830
+ ],
831
+
832
+ events: [
833
+ 'created',
834
+ 'updated',
835
+ 'configured',
836
+ 'activated',
837
+ 'paused',
838
+ 'synced',
839
+ 'tested',
840
+ 'deprecated',
841
+ ],
842
+ }
843
+
844
+ // =============================================================================
845
+ // Webhook
846
+ // =============================================================================
847
+
848
+ /**
849
+ * Webhook entity
850
+ *
851
+ * Event-driven callback endpoint.
852
+ */
853
+ export const Webhook: Noun = {
854
+ singular: 'webhook',
855
+ plural: 'webhooks',
856
+ description: 'An event-driven HTTP callback endpoint',
857
+
858
+ properties: {
859
+ // Identity
860
+ name: {
861
+ type: 'string',
862
+ description: 'Webhook name',
863
+ },
864
+ description: {
865
+ type: 'string',
866
+ optional: true,
867
+ description: 'Webhook description',
868
+ },
869
+
870
+ // Events
871
+ events: {
872
+ type: 'string',
873
+ array: true,
874
+ description: 'Events that trigger this webhook',
875
+ },
876
+
877
+ // Endpoint
878
+ url: {
879
+ type: 'string',
880
+ description: 'Callback URL',
881
+ },
882
+ method: {
883
+ type: 'string',
884
+ optional: true,
885
+ description: 'HTTP method',
886
+ examples: ['POST', 'PUT'],
887
+ },
888
+
889
+ // Payload
890
+ payloadSchema: {
891
+ type: 'json',
892
+ optional: true,
893
+ description: 'Payload schema',
894
+ },
895
+ contentType: {
896
+ type: 'string',
897
+ optional: true,
898
+ description: 'Content type',
899
+ examples: ['application/json', 'application/x-www-form-urlencoded'],
900
+ },
901
+
902
+ // Security
903
+ secret: {
904
+ type: 'string',
905
+ optional: true,
906
+ description: 'Webhook secret for signature validation',
907
+ },
908
+ signatureHeader: {
909
+ type: 'string',
910
+ optional: true,
911
+ description: 'Header name for signature',
912
+ },
913
+ signatureAlgorithm: {
914
+ type: 'string',
915
+ optional: true,
916
+ description: 'Signature algorithm',
917
+ examples: ['hmac-sha256', 'hmac-sha1'],
918
+ },
919
+
920
+ // Delivery
921
+ retryPolicy: {
922
+ type: 'string',
923
+ optional: true,
924
+ description: 'Retry policy',
925
+ examples: ['none', 'exponential', 'linear', 'fixed'],
926
+ },
927
+ maxRetries: {
928
+ type: 'number',
929
+ optional: true,
930
+ description: 'Maximum retry attempts',
931
+ },
932
+ timeoutMs: {
933
+ type: 'number',
934
+ optional: true,
935
+ description: 'Request timeout in milliseconds',
936
+ },
937
+
938
+ // Status
939
+ status: {
940
+ type: 'string',
941
+ description: 'Webhook status',
942
+ examples: ['active', 'paused', 'failed', 'disabled'],
943
+ },
944
+ lastDeliveryAt: {
945
+ type: 'date',
946
+ optional: true,
947
+ description: 'Last successful delivery',
948
+ },
949
+ failureCount: {
950
+ type: 'number',
951
+ optional: true,
952
+ description: 'Consecutive failure count',
953
+ },
954
+ },
955
+
956
+ relationships: {
957
+ api: {
958
+ type: 'API',
959
+ required: false,
960
+ description: 'Parent API',
961
+ },
962
+ integration: {
963
+ type: 'Integration',
964
+ required: false,
965
+ description: 'Parent integration',
966
+ },
967
+ deliveries: {
968
+ type: 'WebhookDelivery[]',
969
+ description: 'Delivery history',
970
+ },
971
+ },
972
+
973
+ actions: [
974
+ 'create',
975
+ 'update',
976
+ 'enable',
977
+ 'disable',
978
+ 'test',
979
+ 'retry',
980
+ 'resetSecret',
981
+ 'delete',
982
+ ],
983
+
984
+ events: [
985
+ 'created',
986
+ 'updated',
987
+ 'enabled',
988
+ 'disabled',
989
+ 'tested',
990
+ 'delivered',
991
+ 'failed',
992
+ 'retried',
993
+ 'deleted',
994
+ ],
995
+ }
996
+
997
+ // =============================================================================
998
+ // Exports
999
+ // =============================================================================
1000
+
1001
+ export const InterfaceEntities = {
1002
+ API,
1003
+ Endpoint,
1004
+ SDK,
1005
+ MCP,
1006
+ Plugin,
1007
+ Integration,
1008
+ Webhook,
1009
+ }
1010
+
1011
+ export const InterfaceCategories = {
1012
+ apis: ['API', 'Endpoint'],
1013
+ sdks: ['SDK'],
1014
+ ai: ['MCP'],
1015
+ extensions: ['Plugin'],
1016
+ connections: ['Integration', 'Webhook'],
1017
+ } as const