digital-products 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 (80) hide show
  1. package/CHANGELOG.md +17 -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 +20 -4
  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/src/api.js +0 -128
  63. package/src/app.js +0 -106
  64. package/src/content.js +0 -77
  65. package/src/data.js +0 -106
  66. package/src/dataset.js +0 -49
  67. package/src/entities/ai.js +0 -858
  68. package/src/entities/content.js +0 -783
  69. package/src/entities/index.js +0 -88
  70. package/src/entities/interfaces.js +0 -929
  71. package/src/entities/lifecycle.js +0 -803
  72. package/src/entities/products.js +0 -797
  73. package/src/entities/web.js +0 -657
  74. package/src/index.js +0 -35
  75. package/src/mcp.js +0 -139
  76. package/src/product.js +0 -53
  77. package/src/registry.js +0 -31
  78. package/src/sdk.js +0 -127
  79. package/src/site.js +0 -112
  80. package/src/types.js +0 -4
package/dist/types.d.ts CHANGED
@@ -1,9 +1,795 @@
1
1
  /**
2
- * Core types for digital products
2
+ * @packageDocumentation
3
+ * @module digital-products
4
+ *
5
+ * Digital product types for schema.org.ai
6
+ *
7
+ * This package provides product types using JSON-LD conventions:
8
+ * - {@link Product} - Base product interface
9
+ * - {@link App} - Application (web, mobile, desktop)
10
+ * - {@link API} - API with versioning and auth
11
+ * - {@link Site} - Website (marketing, docs, blog)
12
+ * - {@link Service} - Backend service
13
+ * - {@link Feature} - Product feature with lifecycle
14
+ *
15
+ * All types use `$id` and `$type` fields (JSON-LD style).
16
+ *
17
+ * ## Unified Types (Recommended)
18
+ *
19
+ * The unified types use JSON-LD conventions with `$id` and `$type`:
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { createApp, isApp, AppSchema } from 'digital-products'
24
+ *
25
+ * const app = createApp({
26
+ * $id: 'my-app',
27
+ * name: 'My App',
28
+ * description: 'An app',
29
+ * platform: 'web',
30
+ * url: 'https://example.com'
31
+ * })
32
+ *
33
+ * if (isApp(data)) {
34
+ * console.log(data.platform)
35
+ * }
36
+ * ```
37
+ *
38
+ * ## Legacy Definition Types
39
+ *
40
+ * The `*Definition` types (AppDefinition, APIDefinition, etc.) are maintained
41
+ * for backwards compatibility. New code should use the unified types.
3
42
  */
4
- import type { SimpleSchema } from 'ai-functions';
43
+ import { z } from 'zod';
44
+ type SimpleSchema = Record<string, unknown>;
5
45
  /**
6
- * Base digital product definition
46
+ * Product - Base interface for digital products
47
+ *
48
+ * All digital products (App, API, Site, Service) extend this base.
49
+ * Uses JSON-LD conventions with `$id` and `$type`.
50
+ *
51
+ * The `$id` field is a unique identifier URI for the product.
52
+ * The `$type` field identifies this as a Product type.
53
+ *
54
+ * @see https://schema.org.ai/Product
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const product = createProduct({
59
+ * $id: 'https://schema.org.ai/products/acme',
60
+ * name: 'Acme Product',
61
+ * description: 'A digital product'
62
+ * })
63
+ * // product.status === 'active' (default)
64
+ * // product.$type === 'https://schema.org.ai/Product'
65
+ * ```
66
+ */
67
+ export interface Product {
68
+ /** Unique identifier URI (JSON-LD `@id` equivalent) */
69
+ $id: string;
70
+ /** Type URI (JSON-LD `@type` equivalent) */
71
+ $type: 'https://schema.org.ai/Product';
72
+ /** Human-readable name */
73
+ name: string;
74
+ /** Description of the product */
75
+ description: string;
76
+ /** Product status - defaults to 'active' when created via factory */
77
+ status: 'active' | 'inactive' | 'archived';
78
+ }
79
+ /**
80
+ * Zod schema for validating Product objects
81
+ *
82
+ * Use this schema for runtime validation of Product data.
83
+ *
84
+ * @see {@link Product}
85
+ * @see {@link isProduct}
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const result = ProductSchema.safeParse(data)
90
+ * if (result.success) {
91
+ * console.log(result.data.name)
92
+ * }
93
+ * ```
94
+ */
95
+ export declare const ProductSchema: z.ZodObject<{
96
+ $id: z.ZodString;
97
+ $type: z.ZodLiteral<"https://schema.org.ai/Product">;
98
+ name: z.ZodString;
99
+ description: z.ZodString;
100
+ status: z.ZodEnum<["active", "inactive", "archived"]>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ $id: string;
103
+ $type: "https://schema.org.ai/Product";
104
+ status: "active" | "inactive" | "archived";
105
+ name: string;
106
+ description: string;
107
+ }, {
108
+ $id: string;
109
+ $type: "https://schema.org.ai/Product";
110
+ status: "active" | "inactive" | "archived";
111
+ name: string;
112
+ description: string;
113
+ }>;
114
+ /**
115
+ * Type guard to check if an object is a valid Product
116
+ *
117
+ * Uses Zod schema validation under the hood for comprehensive checking.
118
+ *
119
+ * @param obj - Object to validate
120
+ * @returns True if valid Product (JSON-LD style with $id/$type)
121
+ *
122
+ * @see {@link Product}
123
+ * @see {@link ProductSchema}
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * if (isProduct(data)) {
128
+ * // TypeScript knows data is Product here
129
+ * console.log(data.$id, data.name)
130
+ * }
131
+ * ```
132
+ */
133
+ export declare function isProduct(obj: unknown): obj is Product;
134
+ /**
135
+ * Factory function to create a new Product
136
+ *
137
+ * Automatically sets `$type` to 'https://schema.org.ai/Product' and
138
+ * defaults `status` to 'active' if not provided.
139
+ *
140
+ * @param input - Product data (status defaults to 'active')
141
+ * @returns Complete Product with $type auto-filled
142
+ *
143
+ * @see {@link Product}
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const product = createProduct({
148
+ * $id: 'https://schema.org.ai/products/acme',
149
+ * name: 'Acme Product',
150
+ * description: 'A digital product'
151
+ * })
152
+ * // product.status === 'active'
153
+ * // product.$type === 'https://schema.org.ai/Product'
154
+ * ```
155
+ */
156
+ export declare function createProduct(input: Omit<Product, '$type' | 'status'> & {
157
+ status?: Product['status'];
158
+ }): Product;
159
+ /**
160
+ * App - Application product (web, mobile, desktop)
161
+ *
162
+ * Interactive user-facing applications that run on various platforms
163
+ * including web browsers, mobile devices, and desktops.
164
+ *
165
+ * Extends {@link Product} with platform-specific fields.
166
+ *
167
+ * @see https://schema.org.ai/App
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const app = createApp({
172
+ * $id: 'https://schema.org.ai/apps/dashboard',
173
+ * name: 'Dashboard',
174
+ * description: 'Admin dashboard',
175
+ * platform: 'web',
176
+ * url: 'https://dashboard.example.com'
177
+ * })
178
+ * // app.$type === 'https://schema.org.ai/App'
179
+ * // app.status === 'active' (default)
180
+ * ```
181
+ */
182
+ export interface App extends Omit<Product, '$type'> {
183
+ /** Type URI for App (JSON-LD `@type` equivalent) */
184
+ $type: 'https://schema.org.ai/App';
185
+ /** Platform the app runs on - web, mobile, desktop, or api */
186
+ platform: 'web' | 'mobile' | 'desktop' | 'api';
187
+ /** URL where the app is hosted or accessible */
188
+ url: string;
189
+ }
190
+ /**
191
+ * Zod schema for validating App objects
192
+ *
193
+ * Use this schema for runtime validation of App data.
194
+ *
195
+ * @see {@link App}
196
+ * @see {@link isApp}
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * const result = AppSchema.safeParse(data)
201
+ * if (result.success) {
202
+ * console.log(result.data.platform, result.data.url)
203
+ * }
204
+ * ```
205
+ */
206
+ export declare const AppSchema: z.ZodObject<{
207
+ $id: z.ZodString;
208
+ $type: z.ZodLiteral<"https://schema.org.ai/App">;
209
+ name: z.ZodString;
210
+ description: z.ZodString;
211
+ status: z.ZodEnum<["active", "inactive", "archived"]>;
212
+ platform: z.ZodEnum<["web", "mobile", "desktop", "api"]>;
213
+ url: z.ZodString;
214
+ }, "strip", z.ZodTypeAny, {
215
+ $id: string;
216
+ $type: "https://schema.org.ai/App";
217
+ status: "active" | "inactive" | "archived";
218
+ name: string;
219
+ description: string;
220
+ platform: "web" | "mobile" | "desktop" | "api";
221
+ url: string;
222
+ }, {
223
+ $id: string;
224
+ $type: "https://schema.org.ai/App";
225
+ status: "active" | "inactive" | "archived";
226
+ name: string;
227
+ description: string;
228
+ platform: "web" | "mobile" | "desktop" | "api";
229
+ url: string;
230
+ }>;
231
+ /**
232
+ * Type guard to check if an object is a valid App
233
+ *
234
+ * Uses Zod schema validation under the hood.
235
+ *
236
+ * @param obj - Object to validate
237
+ * @returns True if valid App (JSON-LD style with $id/$type and platform/url)
238
+ *
239
+ * @see {@link App}
240
+ * @see {@link AppSchema}
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * if (isApp(data)) {
245
+ * // TypeScript knows data is App here
246
+ * console.log(data.platform, data.url)
247
+ * }
248
+ * ```
249
+ */
250
+ export declare function isApp(obj: unknown): obj is App;
251
+ /**
252
+ * Factory function to create a new App
253
+ *
254
+ * Automatically sets `$type` to 'https://schema.org.ai/App' and
255
+ * defaults `status` to 'active' if not provided.
256
+ *
257
+ * @param input - App data (status defaults to 'active')
258
+ * @returns Complete App with $type auto-filled
259
+ *
260
+ * @see {@link App}
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * const app = createApp({
265
+ * $id: 'https://schema.org.ai/apps/dashboard',
266
+ * name: 'Dashboard',
267
+ * description: 'Admin dashboard',
268
+ * platform: 'web',
269
+ * url: 'https://dashboard.example.com'
270
+ * })
271
+ * ```
272
+ */
273
+ export declare function createApp(input: Omit<App, '$type' | 'status'> & {
274
+ status?: App['status'];
275
+ }): App;
276
+ /**
277
+ * API - API product with versioning and auth
278
+ *
279
+ * Programmatic interfaces for other software to consume.
280
+ * Includes versioning and authentication configuration.
281
+ *
282
+ * Extends {@link Product} with API-specific fields.
283
+ *
284
+ * @see https://schema.org.ai/API
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * const api = createAPI({
289
+ * $id: 'https://schema.org.ai/apis/users',
290
+ * name: 'Users API',
291
+ * description: 'User management API',
292
+ * baseUrl: 'https://api.example.com/v1',
293
+ * version: '1.0.0',
294
+ * authentication: 'bearer'
295
+ * })
296
+ * // api.$type === 'https://schema.org.ai/API'
297
+ * ```
298
+ */
299
+ export interface API extends Omit<Product, '$type'> {
300
+ /** Type URI for API (JSON-LD `@type` equivalent) */
301
+ $type: 'https://schema.org.ai/API';
302
+ /** Base URL for API endpoints */
303
+ baseUrl: string;
304
+ /** API version string (e.g., '1.0.0', 'v2') */
305
+ version: string;
306
+ /** Authentication method - bearer token, API key, OAuth, or none */
307
+ authentication: 'bearer' | 'api_key' | 'oauth' | 'none';
308
+ }
309
+ /**
310
+ * Zod schema for validating API objects
311
+ *
312
+ * Use this schema for runtime validation of API data.
313
+ *
314
+ * @see {@link API}
315
+ * @see {@link isAPI}
316
+ *
317
+ * @example
318
+ * ```typescript
319
+ * const result = APISchema.safeParse(data)
320
+ * if (result.success) {
321
+ * console.log(result.data.baseUrl, result.data.version)
322
+ * }
323
+ * ```
324
+ */
325
+ export declare const APISchema: z.ZodObject<{
326
+ $id: z.ZodString;
327
+ $type: z.ZodLiteral<"https://schema.org.ai/API">;
328
+ name: z.ZodString;
329
+ description: z.ZodString;
330
+ status: z.ZodEnum<["active", "inactive", "archived"]>;
331
+ baseUrl: z.ZodString;
332
+ version: z.ZodString;
333
+ authentication: z.ZodEnum<["bearer", "api_key", "oauth", "none"]>;
334
+ }, "strip", z.ZodTypeAny, {
335
+ $id: string;
336
+ $type: "https://schema.org.ai/API";
337
+ status: "active" | "inactive" | "archived";
338
+ name: string;
339
+ description: string;
340
+ baseUrl: string;
341
+ version: string;
342
+ authentication: "bearer" | "api_key" | "oauth" | "none";
343
+ }, {
344
+ $id: string;
345
+ $type: "https://schema.org.ai/API";
346
+ status: "active" | "inactive" | "archived";
347
+ name: string;
348
+ description: string;
349
+ baseUrl: string;
350
+ version: string;
351
+ authentication: "bearer" | "api_key" | "oauth" | "none";
352
+ }>;
353
+ /**
354
+ * Type guard to check if an object is a valid API
355
+ *
356
+ * Uses Zod schema validation under the hood.
357
+ *
358
+ * @param obj - Object to validate
359
+ * @returns True if valid API (JSON-LD style with baseUrl, version, authentication)
360
+ *
361
+ * @see {@link API}
362
+ * @see {@link APISchema}
363
+ *
364
+ * @example
365
+ * ```typescript
366
+ * if (isAPI(data)) {
367
+ * // TypeScript knows data is API here
368
+ * console.log(data.baseUrl, data.authentication)
369
+ * }
370
+ * ```
371
+ */
372
+ export declare function isAPI(obj: unknown): obj is API;
373
+ /**
374
+ * Factory function to create a new API
375
+ *
376
+ * Automatically sets `$type` to 'https://schema.org.ai/API' and
377
+ * defaults `status` to 'active' if not provided.
378
+ *
379
+ * @param input - API data (status defaults to 'active')
380
+ * @returns Complete API with $type auto-filled
381
+ *
382
+ * @see {@link API}
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * const api = createAPI({
387
+ * $id: 'https://schema.org.ai/apis/users',
388
+ * name: 'Users API',
389
+ * description: 'User management API',
390
+ * baseUrl: 'https://api.example.com/v1',
391
+ * version: '1.0.0',
392
+ * authentication: 'bearer'
393
+ * })
394
+ * ```
395
+ */
396
+ export declare function createAPI(input: Omit<API, '$type' | 'status'> & {
397
+ status?: API['status'];
398
+ }): API;
399
+ /**
400
+ * Site - Website product (marketing, docs, blog)
401
+ *
402
+ * Content-focused websites including marketing pages, documentation sites,
403
+ * blogs, and web applications.
404
+ *
405
+ * Extends {@link Product} with site-specific fields.
406
+ *
407
+ * @see https://schema.org.ai/Site
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * const site = createSite({
412
+ * $id: 'https://schema.org.ai/sites/docs',
413
+ * name: 'Documentation',
414
+ * description: 'Product documentation site',
415
+ * url: 'https://docs.example.com',
416
+ * siteType: 'docs'
417
+ * })
418
+ * // site.$type === 'https://schema.org.ai/Site'
419
+ * ```
420
+ */
421
+ export interface Site extends Omit<Product, '$type'> {
422
+ /** Type URI for Site (JSON-LD `@type` equivalent) */
423
+ $type: 'https://schema.org.ai/Site';
424
+ /** URL of the site */
425
+ url: string;
426
+ /** Type of website - marketing, docs, blog, or app */
427
+ siteType: 'marketing' | 'docs' | 'blog' | 'app';
428
+ }
429
+ /**
430
+ * Zod schema for validating Site objects
431
+ *
432
+ * Use this schema for runtime validation of Site data.
433
+ *
434
+ * @see {@link Site}
435
+ * @see {@link isSite}
436
+ *
437
+ * @example
438
+ * ```typescript
439
+ * const result = SiteSchema.safeParse(data)
440
+ * if (result.success) {
441
+ * console.log(result.data.url, result.data.siteType)
442
+ * }
443
+ * ```
444
+ */
445
+ export declare const SiteSchema: z.ZodObject<{
446
+ $id: z.ZodString;
447
+ $type: z.ZodLiteral<"https://schema.org.ai/Site">;
448
+ name: z.ZodString;
449
+ description: z.ZodString;
450
+ status: z.ZodEnum<["active", "inactive", "archived"]>;
451
+ url: z.ZodString;
452
+ siteType: z.ZodEnum<["marketing", "docs", "blog", "app"]>;
453
+ }, "strip", z.ZodTypeAny, {
454
+ $id: string;
455
+ $type: "https://schema.org.ai/Site";
456
+ status: "active" | "inactive" | "archived";
457
+ name: string;
458
+ description: string;
459
+ url: string;
460
+ siteType: "marketing" | "docs" | "blog" | "app";
461
+ }, {
462
+ $id: string;
463
+ $type: "https://schema.org.ai/Site";
464
+ status: "active" | "inactive" | "archived";
465
+ name: string;
466
+ description: string;
467
+ url: string;
468
+ siteType: "marketing" | "docs" | "blog" | "app";
469
+ }>;
470
+ /**
471
+ * Type guard to check if an object is a valid Site
472
+ *
473
+ * Uses Zod schema validation under the hood.
474
+ *
475
+ * @param obj - Object to validate
476
+ * @returns True if valid Site (JSON-LD style with url and siteType)
477
+ *
478
+ * @see {@link Site}
479
+ * @see {@link SiteSchema}
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * if (isSite(data)) {
484
+ * // TypeScript knows data is Site here
485
+ * console.log(data.url, data.siteType)
486
+ * }
487
+ * ```
488
+ */
489
+ export declare function isSite(obj: unknown): obj is Site;
490
+ /**
491
+ * Factory function to create a new Site
492
+ *
493
+ * Automatically sets `$type` to 'https://schema.org.ai/Site' and
494
+ * defaults `status` to 'active' if not provided.
495
+ *
496
+ * @param input - Site data (status defaults to 'active')
497
+ * @returns Complete Site with $type auto-filled
498
+ *
499
+ * @see {@link Site}
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * const site = createSite({
504
+ * $id: 'https://schema.org.ai/sites/docs',
505
+ * name: 'Documentation',
506
+ * description: 'Product documentation site',
507
+ * url: 'https://docs.example.com',
508
+ * siteType: 'docs'
509
+ * })
510
+ * ```
511
+ */
512
+ export declare function createSite(input: Omit<Site, '$type' | 'status'> & {
513
+ status?: Site['status'];
514
+ }): Site;
515
+ /**
516
+ * Service - Backend service product
517
+ *
518
+ * Backend services with optional endpoints. Services are typically
519
+ * internal components that power applications and APIs.
520
+ *
521
+ * Unlike {@link API}, Service represents internal infrastructure
522
+ * rather than public programmatic interfaces.
523
+ *
524
+ * @see https://schema.org.ai/Service
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * const service = createService({
529
+ * $id: 'https://schema.org.ai/services/auth',
530
+ * name: 'Auth Service',
531
+ * description: 'Authentication and authorization service',
532
+ * endpoints: ['/login', '/logout', '/refresh']
533
+ * })
534
+ * // service.$type === 'https://schema.org.ai/Service'
535
+ * // service.status === 'active' (default)
536
+ * ```
537
+ */
538
+ export interface Service {
539
+ /** Unique identifier URI (JSON-LD `@id` equivalent) */
540
+ $id: string;
541
+ /** Type URI (JSON-LD `@type` equivalent) */
542
+ $type: 'https://schema.org.ai/Service';
543
+ /** Human-readable name */
544
+ name: string;
545
+ /** Description of the service */
546
+ description: string;
547
+ /** Service status - defaults to 'active' when created via factory */
548
+ status: 'active' | 'inactive' | 'archived';
549
+ /** Optional list of endpoint paths this service exposes */
550
+ endpoints?: string[];
551
+ }
552
+ /**
553
+ * Zod schema for validating Service objects
554
+ *
555
+ * Use this schema for runtime validation of Service data.
556
+ *
557
+ * @see {@link Service}
558
+ * @see {@link isService}
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * const result = ServiceSchema.safeParse(data)
563
+ * if (result.success) {
564
+ * console.log(result.data.name, result.data.endpoints)
565
+ * }
566
+ * ```
567
+ */
568
+ export declare const ServiceSchema: z.ZodObject<{
569
+ $id: z.ZodString;
570
+ $type: z.ZodLiteral<"https://schema.org.ai/Service">;
571
+ name: z.ZodString;
572
+ description: z.ZodString;
573
+ status: z.ZodEnum<["active", "inactive", "archived"]>;
574
+ endpoints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
575
+ }, "strip", z.ZodTypeAny, {
576
+ $id: string;
577
+ $type: "https://schema.org.ai/Service";
578
+ status: "active" | "inactive" | "archived";
579
+ name: string;
580
+ description: string;
581
+ endpoints?: string[] | undefined;
582
+ }, {
583
+ $id: string;
584
+ $type: "https://schema.org.ai/Service";
585
+ status: "active" | "inactive" | "archived";
586
+ name: string;
587
+ description: string;
588
+ endpoints?: string[] | undefined;
589
+ }>;
590
+ /**
591
+ * Type guard to check if an object is a valid Service
592
+ *
593
+ * Uses Zod schema validation under the hood.
594
+ *
595
+ * @param obj - Object to validate
596
+ * @returns True if valid Service (JSON-LD style with optional endpoints)
597
+ *
598
+ * @see {@link Service}
599
+ * @see {@link ServiceSchema}
600
+ *
601
+ * @example
602
+ * ```typescript
603
+ * if (isService(data)) {
604
+ * // TypeScript knows data is Service here
605
+ * console.log(data.name, data.endpoints)
606
+ * }
607
+ * ```
608
+ */
609
+ export declare function isService(obj: unknown): obj is Service;
610
+ /**
611
+ * Factory function to create a new Service
612
+ *
613
+ * Automatically sets `$type` to 'https://schema.org.ai/Service' and
614
+ * defaults `status` to 'active' if not provided.
615
+ *
616
+ * @param input - Service data (status defaults to 'active')
617
+ * @returns Complete Service with $type auto-filled
618
+ *
619
+ * @see {@link Service}
620
+ *
621
+ * @example
622
+ * ```typescript
623
+ * const service = createService({
624
+ * $id: 'https://schema.org.ai/services/auth',
625
+ * name: 'Auth Service',
626
+ * description: 'Authentication service',
627
+ * endpoints: ['/login', '/logout']
628
+ * })
629
+ * ```
630
+ */
631
+ export declare function createService(input: Omit<Service, '$type' | 'status'> & {
632
+ status?: Service['status'];
633
+ }): Service;
634
+ /**
635
+ * Feature lifecycle status type
636
+ *
637
+ * Represents the lifecycle stage of a feature:
638
+ * - `draft` - Feature is being designed/developed (default)
639
+ * - `beta` - Feature is available for testing
640
+ * - `ga` - Feature is generally available (stable)
641
+ * - `deprecated` - Feature is being phased out
642
+ *
643
+ * @see {@link Feature}
644
+ */
645
+ export type FeatureStatus = 'draft' | 'beta' | 'ga' | 'deprecated';
646
+ /**
647
+ * Feature - Product feature with lifecycle status
648
+ *
649
+ * Individual features within a product. Features have their own
650
+ * lifecycle status independent of the parent product.
651
+ *
652
+ * @see https://schema.org.ai/Feature
653
+ *
654
+ * @example
655
+ * ```typescript
656
+ * const feature = createFeature({
657
+ * $id: 'https://schema.org.ai/features/dark-mode',
658
+ * name: 'Dark Mode',
659
+ * description: 'Toggle dark theme',
660
+ * productId: 'https://schema.org.ai/products/dashboard',
661
+ * status: 'ga'
662
+ * })
663
+ * // feature.$type === 'https://schema.org.ai/Feature'
664
+ * ```
665
+ *
666
+ * @example Feature lifecycle progression
667
+ * ```typescript
668
+ * // Feature starts as draft
669
+ * const feature = createFeature({
670
+ * $id: 'new-feature',
671
+ * name: 'New Feature',
672
+ * description: 'A new feature',
673
+ * productId: 'my-product'
674
+ * })
675
+ * // feature.status === 'draft' (default)
676
+ *
677
+ * // Later, promote to beta, then ga, or deprecate
678
+ * ```
679
+ */
680
+ export interface Feature {
681
+ /** Unique identifier URI (JSON-LD `@id` equivalent) */
682
+ $id: string;
683
+ /** Type URI (JSON-LD `@type` equivalent) */
684
+ $type: 'https://schema.org.ai/Feature';
685
+ /** Human-readable name */
686
+ name: string;
687
+ /** Description of the feature */
688
+ description: string;
689
+ /** Reference to parent product $id */
690
+ productId: string;
691
+ /** Feature lifecycle status - defaults to 'draft' when created via factory */
692
+ status: FeatureStatus;
693
+ }
694
+ /**
695
+ * Zod schema for validating Feature objects
696
+ *
697
+ * Use this schema for runtime validation of Feature data.
698
+ *
699
+ * @see {@link Feature}
700
+ * @see {@link isFeature}
701
+ *
702
+ * @example
703
+ * ```typescript
704
+ * const result = FeatureSchema.safeParse(data)
705
+ * if (result.success) {
706
+ * console.log(result.data.name, result.data.status)
707
+ * }
708
+ * ```
709
+ */
710
+ export declare const FeatureSchema: z.ZodObject<{
711
+ $id: z.ZodString;
712
+ $type: z.ZodLiteral<"https://schema.org.ai/Feature">;
713
+ name: z.ZodString;
714
+ description: z.ZodString;
715
+ productId: z.ZodString;
716
+ status: z.ZodEnum<["draft", "beta", "ga", "deprecated"]>;
717
+ }, "strip", z.ZodTypeAny, {
718
+ $id: string;
719
+ $type: "https://schema.org.ai/Feature";
720
+ status: "draft" | "beta" | "ga" | "deprecated";
721
+ name: string;
722
+ description: string;
723
+ productId: string;
724
+ }, {
725
+ $id: string;
726
+ $type: "https://schema.org.ai/Feature";
727
+ status: "draft" | "beta" | "ga" | "deprecated";
728
+ name: string;
729
+ description: string;
730
+ productId: string;
731
+ }>;
732
+ /**
733
+ * Type guard to check if an object is a valid Feature
734
+ *
735
+ * Uses Zod schema validation under the hood.
736
+ *
737
+ * @param obj - Object to validate
738
+ * @returns True if valid Feature (JSON-LD style with productId and lifecycle status)
739
+ *
740
+ * @see {@link Feature}
741
+ * @see {@link FeatureSchema}
742
+ *
743
+ * @example
744
+ * ```typescript
745
+ * if (isFeature(data)) {
746
+ * // TypeScript knows data is Feature here
747
+ * console.log(data.name, data.status, data.productId)
748
+ * }
749
+ * ```
750
+ */
751
+ export declare function isFeature(obj: unknown): obj is Feature;
752
+ /**
753
+ * Factory function to create a new Feature
754
+ *
755
+ * Automatically sets `$type` to 'https://schema.org.ai/Feature' and
756
+ * defaults `status` to 'draft' if not provided.
757
+ *
758
+ * @param input - Feature data (status defaults to 'draft')
759
+ * @returns Complete Feature with $type auto-filled
760
+ *
761
+ * @see {@link Feature}
762
+ * @see {@link FeatureStatus}
763
+ *
764
+ * @example
765
+ * ```typescript
766
+ * const feature = createFeature({
767
+ * $id: 'https://schema.org.ai/features/dark-mode',
768
+ * name: 'Dark Mode',
769
+ * description: 'Toggle dark theme',
770
+ * productId: 'https://schema.org.ai/products/dashboard'
771
+ * })
772
+ * // feature.status === 'draft' (default)
773
+ * ```
774
+ */
775
+ export declare function createFeature(input: Omit<Feature, '$type' | 'status'> & {
776
+ status?: FeatureStatus;
777
+ }): Feature;
778
+ /**
779
+ * Base digital product definition for builder pattern
780
+ *
781
+ * Used by ProductBuilder and related fluent APIs.
782
+ * Uses `id` (without $ prefix) for builder ergonomics.
783
+ *
784
+ * @example
785
+ * ```typescript
786
+ * const product: DigitalProduct = {
787
+ * id: 'my-product',
788
+ * name: 'My Product',
789
+ * description: 'A product',
790
+ * version: '1.0.0'
791
+ * }
792
+ * ```
7
793
  */
8
794
  export interface DigitalProduct {
9
795
  /** Unique identifier for this product */
@@ -22,7 +808,11 @@ export interface DigitalProduct {
22
808
  status?: 'draft' | 'active' | 'deprecated';
23
809
  }
24
810
  /**
25
- * Application definition - interactive user-facing software
811
+ * Application definition for builder pattern
812
+ *
813
+ * Used by AppBuilder for fluent API definitions.
814
+ *
815
+ * @see {@link App} for JSON-LD compatible type
26
816
  */
27
817
  export interface AppDefinition extends DigitalProduct {
28
818
  type: 'app';
@@ -91,7 +881,11 @@ export interface AuthConfig {
91
881
  protectedRoutes?: string[];
92
882
  }
93
883
  /**
94
- * API definition - programmatic interface
884
+ * API definition for builder pattern
885
+ *
886
+ * Used by APIBuilder for fluent API definitions.
887
+ *
888
+ * @see {@link API} for JSON-LD compatible type
95
889
  */
96
890
  export interface APIDefinition extends DigitalProduct {
97
891
  type: 'api';
@@ -162,7 +956,9 @@ export interface RateLimitConfig {
162
956
  onExceeded?: 'reject' | 'queue' | 'custom';
163
957
  }
164
958
  /**
165
- * Content definition - text/media content
959
+ * Content definition for builder pattern
960
+ *
961
+ * Defines text/media content structure for the Content builder.
166
962
  */
167
963
  export interface ContentDefinition extends DigitalProduct {
168
964
  type: 'content';
@@ -200,7 +996,9 @@ export interface WorkflowDefinition {
200
996
  }[];
201
997
  }
202
998
  /**
203
- * Data definition - structured data/database
999
+ * Data definition for builder pattern
1000
+ *
1001
+ * Defines structured data/database schemas for the Data builder.
204
1002
  */
205
1003
  export interface DataDefinition extends DigitalProduct {
206
1004
  type: 'data';
@@ -255,7 +1053,9 @@ export interface ValidationRule {
255
1053
  message?: string;
256
1054
  }
257
1055
  /**
258
- * Dataset definition - curated data collection
1056
+ * Dataset definition for builder pattern
1057
+ *
1058
+ * Defines curated data collection structure for the Dataset builder.
259
1059
  */
260
1060
  export interface DatasetDefinition extends DigitalProduct {
261
1061
  type: 'dataset';
@@ -273,7 +1073,11 @@ export interface DatasetDefinition extends DigitalProduct {
273
1073
  updateFrequency?: 'realtime' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'static';
274
1074
  }
275
1075
  /**
276
- * Site definition - website/documentation
1076
+ * Site definition for builder pattern
1077
+ *
1078
+ * Used by SiteBuilder for fluent API definitions.
1079
+ *
1080
+ * @see {@link Site} for JSON-LD compatible type
277
1081
  */
278
1082
  export interface SiteDefinition extends DigitalProduct {
279
1083
  type: 'site';
@@ -348,7 +1152,9 @@ export interface AnalyticsConfig {
348
1152
  config?: Record<string, unknown>;
349
1153
  }
350
1154
  /**
351
- * MCP (Model Context Protocol) server definition
1155
+ * MCP (Model Context Protocol) server definition for builder pattern
1156
+ *
1157
+ * Defines MCP server structure for the MCP builder.
352
1158
  */
353
1159
  export interface MCPDefinition extends DigitalProduct {
354
1160
  type: 'mcp';
@@ -417,7 +1223,9 @@ export interface MCPConfig {
417
1223
  };
418
1224
  }
419
1225
  /**
420
- * SDK (Software Development Kit) definition
1226
+ * SDK (Software Development Kit) definition for builder pattern
1227
+ *
1228
+ * Defines SDK structure for the SDK builder.
421
1229
  */
422
1230
  export interface SDKDefinition extends DigitalProduct {
423
1231
  type: 'sdk';
@@ -482,11 +1290,17 @@ export interface DeploymentTarget {
482
1290
  env?: Record<string, string>;
483
1291
  }
484
1292
  /**
485
- * Union of all product types
1293
+ * Union of all builder pattern product definition types
1294
+ *
1295
+ * Represents any product definition created through the builder API.
1296
+ * For JSON-LD compatible types, use Product, App, API, Site, Service, Feature.
486
1297
  */
487
1298
  export type ProductDefinition = AppDefinition | APIDefinition | ContentDefinition | DataDefinition | DatasetDefinition | SiteDefinition | MCPDefinition | SDKDefinition;
488
1299
  /**
489
1300
  * Product builder - chainable API for creating products
1301
+ *
1302
+ * Provides a fluent interface for building ProductDefinition types.
1303
+ * For simpler creation, use factory functions (createProduct, createApp, etc.).
490
1304
  */
491
1305
  export interface ProductBuilder<T extends ProductDefinition> {
492
1306
  /** Set product ID */
@@ -508,6 +1322,9 @@ export interface ProductBuilder<T extends ProductDefinition> {
508
1322
  }
509
1323
  /**
510
1324
  * Product registry for storing products
1325
+ *
1326
+ * Registry for managing legacy ProductDefinition types.
1327
+ * Provides CRUD operations for products by ID.
511
1328
  */
512
1329
  export interface ProductRegistry {
513
1330
  /** Register a product */
@@ -525,4 +1342,5 @@ export interface ProductRegistry {
525
1342
  /** Clear all products */
526
1343
  clear(): void;
527
1344
  }
1345
+ export {};
528
1346
  //# sourceMappingURL=types.d.ts.map