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