oneie 3.6.28 → 3.6.30

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.
@@ -18,7 +18,7 @@ ai_context: |
18
18
 
19
19
  # Ontology Documentation Index
20
20
 
21
- **Complete navigation for all multi-ontology architecture documentation**
21
+ **Complete navigation for all ONE Ontology architecture documentation**
22
22
 
23
23
  **Version:** 1.0.0
24
24
  **Last Updated:** 2025-10-20
@@ -30,7 +30,8 @@ ai_context: |
30
30
 
31
31
  ### 📚 Complete Guide (Start Here)
32
32
 
33
- **[Multi-Ontology Complete Guide](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md)**
33
+ **[ONE Ontology Complete Guide](../../ONE Ontology-COMPLETE-GUIDE.md)**
34
+
34
35
  - **47 pages** of comprehensive documentation
35
36
  - Everything from quick start to advanced patterns
36
37
  - Migration guides, API reference, troubleshooting
@@ -39,6 +40,7 @@ ai_context: |
39
40
  ### ⚡ Quick Start
40
41
 
41
42
  **[Quick Start Guide](./ontology-quickstart.md)**
43
+
42
44
  - Get running in 5 minutes
43
45
  - Step-by-step setup instructions
44
46
  - Example implementations
@@ -47,6 +49,7 @@ ai_context: |
47
49
  ### 📖 Developer Guides
48
50
 
49
51
  **[Developer Guide](./ontology-developer-guide.md)**
52
+
50
53
  - Architecture deep dive
51
54
  - YAML format specification
52
55
  - Type generation internals
@@ -54,8 +57,9 @@ ai_context: |
54
57
  - **Recommended for:** Developers building features
55
58
 
56
59
  **[Migration Guide](./ontology-migration-guide.md)**
60
+
57
61
  - Step-by-step migration process
58
- - From hardcoded schema to multi-ontology
62
+ - From hardcoded schema to ONE Ontology
59
63
  - Data migration strategies
60
64
  - Rollback procedures
61
65
  - **Recommended for:** Teams migrating existing projects
@@ -63,6 +67,7 @@ ai_context: |
63
67
  ### 📝 Quick Reference
64
68
 
65
69
  **[Cheat Sheet](./ontology-cheatsheet.md)**
70
+
66
71
  - Quick commands
67
72
  - YAML templates
68
73
  - Common code patterns
@@ -125,22 +130,26 @@ All ontology specifications are in `/one/knowledge/`:
125
130
  ### Backend Components
126
131
 
127
132
  **[Ontology Loader README](../../backend/lib/ONTOLOGY-LOADER-README.md)**
133
+
128
134
  - Load and compose ontologies
129
135
  - API reference for loader functions
130
136
  - Usage patterns
131
137
  - Caching and performance
132
138
 
133
139
  **[Type Generator](../../backend/lib/type-generator.ts)**
140
+
134
141
  - Source code for TypeScript type generation
135
142
  - 338 lines of implementation
136
143
  - Generates unions, constants, type guards
137
144
 
138
145
  **[Ontology Validator](../../backend/lib/ontology-validator.ts)**
146
+
139
147
  - Source code for composition validation
140
148
  - 389 lines of implementation
141
149
  - Detects duplicates, circular dependencies, conflicts
142
150
 
143
151
  **[Generate Script](../../backend/scripts/generate-ontology-types.ts)**
152
+
144
153
  - CLI tool for type generation
145
154
  - 116 lines
146
155
  - Run: `bun run backend/scripts/generate-ontology-types.ts`
@@ -148,11 +157,13 @@ All ontology specifications are in `/one/knowledge/`:
148
157
  ### Generated Types
149
158
 
150
159
  **[Generated Types README](../../backend/convex/types/README.md)**
160
+
151
161
  - Documentation for auto-generated types
152
162
  - Usage examples
153
163
  - Type safety guide
154
164
 
155
165
  **[Generated Types Output](../../backend/convex/types/ontology.ts)**
166
+
156
167
  - Auto-generated TypeScript types
157
168
  - DO NOT EDIT MANUALLY
158
169
  - Regenerated on each build
@@ -160,12 +171,14 @@ All ontology specifications are in `/one/knowledge/`:
160
171
  ### Examples
161
172
 
162
173
  **[Ontology Usage Examples](../../backend/convex/examples/ontology-types-usage.ts)**
174
+
163
175
  - 9 real-world usage examples
164
176
  - Type validation patterns
165
177
  - Feature detection logic
166
178
  - Mutation and query examples
167
179
 
168
180
  **[Example Output](../../backend/convex/types/EXAMPLE-OUTPUT.md)**
181
+
169
182
  - Sample generated type files
170
183
  - Shows structure of generated code
171
184
 
@@ -174,12 +187,14 @@ All ontology specifications are in `/one/knowledge/`:
174
187
  ## Testing & Validation
175
188
 
176
189
  **[Test Report](../../backend/TEST-REPORT-ONTOLOGY.md)**
190
+
177
191
  - End-to-end test report
178
192
  - 33 tests, all passing (100%)
179
193
  - Performance benchmarks (75ms cold, 5ms cached)
180
194
  - Production readiness assessment
181
195
 
182
196
  **[Test Suite](../../backend/lib/__tests__/ontology.test.ts)**
197
+
183
198
  - Complete test suite (583 lines)
184
199
  - 8 test suites covering all functionality
185
200
  - Feature composition, type generation, validation, performance
@@ -188,13 +203,15 @@ All ontology specifications are in `/one/knowledge/`:
188
203
 
189
204
  ## Implementation Summaries
190
205
 
191
- **[Implementation Complete](../../MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md)**
206
+ **[Implementation Complete](../../ONE Ontology-IMPLEMENTATION-COMPLETE.md)**
207
+
192
208
  - Executive summary of completed work
193
209
  - Architecture overview
194
210
  - Feature ontologies breakdown
195
211
  - Success metrics
196
212
 
197
213
  **[Type Generator Summary](../../ONTOLOGY-TYPE-GENERATOR-SUMMARY.md)**
214
+
198
215
  - Type generation system overview
199
216
  - How it works
200
217
  - Generated code structure
@@ -206,6 +223,7 @@ All ontology specifications are in `/one/knowledge/`:
206
223
  ### Core Ontology Specification
207
224
 
208
225
  **[6-Dimension Ontology](./ontology.md)**
226
+
209
227
  - Complete specification (Version 1.0.0)
210
228
  - Groups, People, Things, Connections, Events, Knowledge
211
229
  - 66+ entity types
@@ -215,11 +233,13 @@ All ontology specifications are in `/one/knowledge/`:
215
233
  ### Related Concepts
216
234
 
217
235
  **[Rules](./rules.md)**
236
+
218
237
  - Golden rules for AI development
219
238
  - Ontology governance
220
239
  - Best practices
221
240
 
222
241
  **[Architecture](./architecture.md)**
242
+
223
243
  - System architecture overview
224
244
  - Layer explanations
225
245
  - Technology stack
@@ -251,27 +271,32 @@ bun run dev # Configured to run generator first
251
271
  ## File Locations
252
272
 
253
273
  ### Ontology Definitions
274
+
254
275
  - **Location:** `/one/knowledge/ontology-*.yaml`
255
276
  - **Format:** YAML
256
277
  - **Count:** 6 ontologies (core + 5 features)
257
278
 
258
279
  ### Generated Types
280
+
259
281
  - **Location:** `/backend/convex/types/ontology.ts`
260
282
  - **Format:** TypeScript
261
283
  - **Auto-generated:** YES (do not edit)
262
284
 
263
285
  ### Implementation
286
+
264
287
  - **Loader:** `/backend/lib/ontology-loader.ts`
265
288
  - **Validator:** `/backend/lib/ontology-validator.ts`
266
289
  - **Generator:** `/backend/lib/type-generator.ts`
267
290
  - **CLI:** `/backend/scripts/generate-ontology-types.ts`
268
291
 
269
292
  ### Tests
293
+
270
294
  - **Test Suite:** `/backend/lib/__tests__/ontology.test.ts`
271
295
  - **Test Report:** `/backend/TEST-REPORT-ONTOLOGY.md`
272
296
 
273
297
  ### Documentation
274
- - **Complete Guide:** `/MULTI-ONTOLOGY-COMPLETE-GUIDE.md`
298
+
299
+ - **Complete Guide:** `/ONE Ontology-COMPLETE-GUIDE.md`
275
300
  - **Quick Start:** `/one/knowledge/ontology-quickstart.md`
276
301
  - **Developer Guide:** `/one/knowledge/ontology-developer-guide.md`
277
302
  - **Migration Guide:** `/one/knowledge/ontology-migration-guide.md`
@@ -282,17 +307,17 @@ bun run dev # Configured to run generator first
282
307
 
283
308
  ## Documentation Statistics
284
309
 
285
- | Document | Pages | Words | Status |
286
- |----------|-------|-------|--------|
287
- | Complete Guide | 47 | ~12,000 | ✅ Complete |
288
- | Quick Start | 12 | ~3,500 | ✅ Complete |
289
- | Developer Guide | 18 | ~5,000 | ✅ Complete |
290
- | Migration Guide | 20 | ~6,000 | ✅ Complete |
291
- | Cheat Sheet | 8 | ~2,000 | ✅ Complete |
292
- | Loader README | 15 | ~4,500 | ✅ Complete |
293
- | Test Report | 12 | ~3,500 | ✅ Complete |
294
- | Implementation Summary | 14 | ~4,000 | ✅ Complete |
295
- | **TOTAL** | **146** | **~40,500** | **✅ Complete** |
310
+ | Document | Pages | Words | Status |
311
+ | ---------------------- | ------- | ----------- | --------------- |
312
+ | Complete Guide | 47 | ~12,000 | ✅ Complete |
313
+ | Quick Start | 12 | ~3,500 | ✅ Complete |
314
+ | Developer Guide | 18 | ~5,000 | ✅ Complete |
315
+ | Migration Guide | 20 | ~6,000 | ✅ Complete |
316
+ | Cheat Sheet | 8 | ~2,000 | ✅ Complete |
317
+ | Loader README | 15 | ~4,500 | ✅ Complete |
318
+ | Test Report | 12 | ~3,500 | ✅ Complete |
319
+ | Implementation Summary | 14 | ~4,000 | ✅ Complete |
320
+ | **TOTAL** | **146** | **~40,500** | **✅ Complete** |
296
321
 
297
322
  ---
298
323
 
@@ -301,7 +326,7 @@ bun run dev # Configured to run generator first
301
326
  ### For New Users
302
327
 
303
328
  1. Read [Quick Start Guide](./ontology-quickstart.md) (15 minutes)
304
- 2. Follow [Creating Your First Feature](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md#9-creating-your-first-feature) (30 minutes)
329
+ 2. Follow [Creating Your First Feature](../../ONE Ontology-COMPLETE-GUIDE.md#9-creating-your-first-feature) (30 minutes)
305
330
  3. Explore [Example Ontologies](./ontology-core.yaml) (15 minutes)
306
331
  4. Try [Usage Examples](../../backend/convex/examples/ontology-types-usage.ts) (20 minutes)
307
332
 
@@ -310,8 +335,8 @@ bun run dev # Configured to run generator first
310
335
  ### For Developers
311
336
 
312
337
  1. Read [Developer Guide](./ontology-developer-guide.md) (45 minutes)
313
- 2. Study [Type Generation System](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md#6-type-generation-system) (30 minutes)
314
- 3. Review [Advanced Patterns](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md#10-advanced-patterns) (30 minutes)
338
+ 2. Study [Type Generation System](../../ONE Ontology-COMPLETE-GUIDE.md#6-type-generation-system) (30 minutes)
339
+ 3. Review [Advanced Patterns](../../ONE Ontology-COMPLETE-GUIDE.md#10-advanced-patterns) (30 minutes)
315
340
  4. Explore [Test Suite](../../backend/lib/__tests__/ontology.test.ts) (30 minutes)
316
341
 
317
342
  **Total Time:** ~2 hours to mastery
@@ -332,10 +357,10 @@ bun run dev # Configured to run generator first
332
357
 
333
358
  ### Getting Help
334
359
 
335
- - **Documentation:** Start with [Complete Guide](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md)
360
+ - **Documentation:** Start with [Complete Guide](../../ONE Ontology-COMPLETE-GUIDE.md)
336
361
  - **Examples:** Check [Usage Examples](../../backend/convex/examples/ontology-types-usage.ts)
337
- - **Troubleshooting:** See [Troubleshooting Section](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md#13-troubleshooting)
338
- - **FAQs:** Read [FAQ Section](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md#14-faqs)
362
+ - **Troubleshooting:** See [Troubleshooting Section](../../ONE Ontology-COMPLETE-GUIDE.md#13-troubleshooting)
363
+ - **FAQs:** Read [FAQ Section](../../ONE Ontology-COMPLETE-GUIDE.md#14-faqs)
339
364
 
340
365
  ### Contributing
341
366
 
@@ -348,9 +373,9 @@ bun run dev # Configured to run generator first
348
373
 
349
374
  ## Version History
350
375
 
351
- | Version | Date | Changes |
352
- |---------|------|---------|
353
- | 1.0.0 | 2025-10-20 | Initial release - Complete documentation suite |
376
+ | Version | Date | Changes |
377
+ | ------- | ---------- | ---------------------------------------------- |
378
+ | 1.0.0 | 2025-10-20 | Initial release - Complete documentation suite |
354
379
 
355
380
  ---
356
381
 
@@ -359,7 +384,7 @@ bun run dev # Configured to run generator first
359
384
  **Choose your path:**
360
385
 
361
386
  - 🚀 **Get Started:** Read [Quick Start Guide](./ontology-quickstart.md)
362
- - 📚 **Learn Everything:** Read [Complete Guide](../../MULTI-ONTOLOGY-COMPLETE-GUIDE.md)
387
+ - 📚 **Learn Everything:** Read [Complete Guide](../../ONE Ontology-COMPLETE-GUIDE.md)
363
388
  - 🔧 **Build Features:** Follow [Developer Guide](./ontology-developer-guide.md)
364
389
  - 🔄 **Migrate:** Use [Migration Guide](./ontology-migration-guide.md)
365
390
  - 📝 **Quick Reference:** Bookmark [Cheat Sheet](./ontology-cheatsheet.md)
@@ -11,20 +11,20 @@ version: 1.0.0
11
11
  ai_context: |
12
12
  This document is part of the knowledge dimension in the ontology-quickstart.md category.
13
13
  Location: one/knowledge/ontology-quickstart.md
14
- Purpose: Documents multi-ontology architecture: quick start guide
14
+ Purpose: Documents ONE Ontology architecture: quick start guide
15
15
  Related dimensions: connections, events, groups, people, things
16
16
  For AI agents: Read this to understand ontology quickstart.
17
17
  ---
18
18
 
19
- # Multi-Ontology Architecture: Quick Start Guide
19
+ # ONE Ontology Architecture: Quick Start Guide
20
20
 
21
21
  **Version:** 1.0.0
22
22
  **Last Updated:** 2025-10-20
23
23
  **Status:** Complete
24
24
 
25
- ## What is the Multi-Ontology Architecture?
25
+ ## What is the ONE Ontology Architecture?
26
26
 
27
- The Multi-Ontology Architecture lets you extend the ONE Platform's core 6-dimension ontology with **feature-specific types**. Instead of hardcoding all possible entity types, features bring their own data models that compose cleanly.
27
+ The ONE Ontology Architecture lets you extend the ONE Platform's core 6-dimension ontology with **feature-specific types**. Instead of hardcoding all possible entity types, features bring their own data models that compose cleanly.
28
28
 
29
29
  ### Core Concept
30
30
 
@@ -79,6 +79,7 @@ bun run scripts/generate-ontology-types.ts
79
79
  ```
80
80
 
81
81
  This script:
82
+
82
83
  1. Reads all enabled feature ontologies from `/one/knowledge/ontology-*.yaml`
83
84
  2. Generates TypeScript types in `convex/types/ontology.ts`
84
85
  3. Creates validation functions and type guards
@@ -102,6 +103,7 @@ npx convex dev
102
103
  ```
103
104
 
104
105
  Convex will automatically:
106
+
105
107
  - Read the generated types
106
108
  - Update schema validation
107
109
  - Hot-reload with new types
@@ -192,9 +194,9 @@ Now use your new types in Convex mutations:
192
194
 
193
195
  ```typescript
194
196
  // backend/convex/mutations/products.ts
195
- import { mutation } from './_generated/server';
196
- import { v } from 'convex/values';
197
- import { isThingType } from './types/ontology';
197
+ import { mutation } from "./_generated/server";
198
+ import { v } from "convex/values";
199
+ import { isThingType } from "./types/ontology";
198
200
 
199
201
  export const createProduct = mutation({
200
202
  args: {
@@ -205,24 +207,24 @@ export const createProduct = mutation({
205
207
  },
206
208
  handler: async (ctx, args) => {
207
209
  // Type validation happens automatically!
208
- const productId = await ctx.db.insert('things', {
209
- type: 'product', // ✅ Validated against ontology
210
+ const productId = await ctx.db.insert("things", {
211
+ type: "product", // ✅ Validated against ontology
210
212
  name: args.name,
211
213
  properties: {
212
214
  sku: args.sku,
213
215
  price: args.price,
214
216
  inventory: args.inventory,
215
- description: '',
217
+ description: "",
216
218
  images: [],
217
219
  },
218
- status: 'active',
220
+ status: "active",
219
221
  createdAt: Date.now(),
220
222
  updatedAt: Date.now(),
221
223
  });
222
224
 
223
225
  // Log event
224
- await ctx.db.insert('events', {
225
- type: 'product_created', // ✅ Validated against ontology
226
+ await ctx.db.insert("events", {
227
+ type: "product_created", // ✅ Validated against ontology
226
228
  actorId: ctx.auth.getUserIdentity()?.tokenIdentifier,
227
229
  targetId: productId,
228
230
  timestamp: Date.now(),
@@ -244,22 +246,22 @@ export const createProduct = mutation({
244
246
  ### Check Available Types
245
247
 
246
248
  ```typescript
247
- import { THING_TYPES, CONNECTION_TYPES, EVENT_TYPES } from './types/ontology';
249
+ import { THING_TYPES, CONNECTION_TYPES, EVENT_TYPES } from "./types/ontology";
248
250
 
249
- console.log('Available thing types:', THING_TYPES);
251
+ console.log("Available thing types:", THING_TYPES);
250
252
  // Output: ['page', 'user', 'file', 'blog_post', 'product', ...]
251
253
 
252
- console.log('Available connection types:', CONNECTION_TYPES);
254
+ console.log("Available connection types:", CONNECTION_TYPES);
253
255
  // Output: ['created_by', 'posted_in', 'in_stock', ...]
254
256
 
255
- console.log('Available event types:', EVENT_TYPES);
257
+ console.log("Available event types:", EVENT_TYPES);
256
258
  // Output: ['thing_created', 'blog_post_published', 'product_created', ...]
257
259
  ```
258
260
 
259
261
  ### Validate User Input
260
262
 
261
263
  ```typescript
262
- import { isThingType, isConnectionType, isEventType } from './types/ontology';
264
+ import { isThingType, isConnectionType, isEventType } from "./types/ontology";
263
265
 
264
266
  // Validate thing type
265
267
  if (!isThingType(userInput)) {
@@ -280,30 +282,30 @@ if (!isEventType(eventType)) {
280
282
  ### Feature-Conditional Logic
281
283
 
282
284
  ```typescript
283
- import { hasFeature, ENABLED_FEATURES } from './types/ontology';
285
+ import { hasFeature, ENABLED_FEATURES } from "./types/ontology";
284
286
 
285
287
  // Check if feature is enabled
286
- if (hasFeature('blog')) {
288
+ if (hasFeature("blog")) {
287
289
  // Blog-specific logic
288
- console.log('Blog feature is enabled');
290
+ console.log("Blog feature is enabled");
289
291
  }
290
292
 
291
- if (hasFeature('products')) {
293
+ if (hasFeature("products")) {
292
294
  // Products-specific logic
293
- console.log('Products feature is enabled');
295
+ console.log("Products feature is enabled");
294
296
  }
295
297
 
296
298
  // List all enabled features
297
- console.log('Enabled features:', ENABLED_FEATURES);
299
+ console.log("Enabled features:", ENABLED_FEATURES);
298
300
  // Output: ['core', 'blog', 'products']
299
301
  ```
300
302
 
301
303
  ### Get Thing Type Schema
302
304
 
303
305
  ```typescript
304
- import { getThingTypeSchema } from './types/ontology';
306
+ import { getThingTypeSchema } from "./types/ontology";
305
307
 
306
- const productSchema = getThingTypeSchema('product');
308
+ const productSchema = getThingTypeSchema("product");
307
309
  console.log(productSchema);
308
310
  // Output:
309
311
  // {
@@ -327,11 +329,13 @@ console.log(productSchema);
327
329
  ### Problem: Type not found after adding feature
328
330
 
329
331
  **Symptom:**
332
+
330
333
  ```
331
334
  Error: Invalid thing type: "product"
332
335
  ```
333
336
 
334
337
  **Solution:**
338
+
335
339
  1. Verify feature is in `PUBLIC_FEATURES` environment variable
336
340
  2. Run `bun run scripts/generate-ontology-types.ts`
337
341
  3. Restart Convex dev server (`npx convex dev`)
@@ -341,6 +345,7 @@ Error: Invalid thing type: "product"
341
345
  ### Problem: Schema validation fails
342
346
 
343
347
  **Symptom:**
348
+
344
349
  ```
345
350
  Error: Validation failed for thing type "product"
346
351
  Property "price" expected number, got string
@@ -366,6 +371,7 @@ Supported property types: `string`, `number`, `boolean`, `object`, `string[]`, `
366
371
  ### Problem: Circular dependency error
367
372
 
368
373
  **Symptom:**
374
+
369
375
  ```
370
376
  Error: Circular dependency detected: blog → portfolio → blog
371
377
  ```
@@ -394,11 +400,13 @@ extends: core
394
400
  ### Problem: Feature not loading
395
401
 
396
402
  **Symptom:**
403
+
397
404
  ```
398
405
  ⚠️ Feature "products" not found, skipping
399
406
  ```
400
407
 
401
408
  **Solution:**
409
+
402
410
  1. Verify file exists: `/one/knowledge/ontology-products.yaml`
403
411
  2. Check file naming convention: `ontology-{feature}.yaml`
404
412
  3. Ensure YAML is valid (no syntax errors)
@@ -406,20 +414,20 @@ extends: core
406
414
 
407
415
  ```yaml
408
416
  # File: ontology-products.yaml
409
- feature: products # ✅ Must match filename
417
+ feature: products # ✅ Must match filename
410
418
  ```
411
419
 
412
420
  ---
413
421
 
414
422
  ## Example: Full CRUD Implementation
415
423
 
416
- Here's a complete example showing how to implement CRUD operations with the multi-ontology architecture:
424
+ Here's a complete example showing how to implement CRUD operations with the ONE Ontology architecture:
417
425
 
418
426
  ```typescript
419
427
  // backend/convex/mutations/products.ts
420
- import { mutation } from './_generated/server';
421
- import { v } from 'convex/values';
422
- import { isThingType } from './types/ontology';
428
+ import { mutation } from "./_generated/server";
429
+ import { v } from "convex/values";
430
+ import { isThingType } from "./types/ontology";
423
431
 
424
432
  // CREATE
425
433
  export const createProduct = mutation({
@@ -429,23 +437,23 @@ export const createProduct = mutation({
429
437
  price: v.number(),
430
438
  },
431
439
  handler: async (ctx, args) => {
432
- const productId = await ctx.db.insert('things', {
433
- type: 'product',
440
+ const productId = await ctx.db.insert("things", {
441
+ type: "product",
434
442
  name: args.name,
435
443
  properties: {
436
444
  sku: args.sku,
437
445
  price: args.price,
438
446
  inventory: 0,
439
- description: '',
447
+ description: "",
440
448
  images: [],
441
449
  },
442
- status: 'active',
450
+ status: "active",
443
451
  createdAt: Date.now(),
444
452
  updatedAt: Date.now(),
445
453
  });
446
454
 
447
- await ctx.db.insert('events', {
448
- type: 'product_created',
455
+ await ctx.db.insert("events", {
456
+ type: "product_created",
449
457
  actorId: ctx.auth.getUserIdentity()?.tokenIdentifier,
450
458
  targetId: productId,
451
459
  timestamp: Date.now(),
@@ -458,11 +466,11 @@ export const createProduct = mutation({
458
466
 
459
467
  // READ
460
468
  export const getProduct = query({
461
- args: { id: v.id('things') },
469
+ args: { id: v.id("things") },
462
470
  handler: async (ctx, { id }) => {
463
471
  const product = await ctx.db.get(id);
464
- if (!product || product.type !== 'product') {
465
- throw new Error('Product not found');
472
+ if (!product || product.type !== "product") {
473
+ throw new Error("Product not found");
466
474
  }
467
475
  return product;
468
476
  },
@@ -471,14 +479,14 @@ export const getProduct = query({
471
479
  // UPDATE
472
480
  export const updateProduct = mutation({
473
481
  args: {
474
- id: v.id('things'),
482
+ id: v.id("things"),
475
483
  price: v.optional(v.number()),
476
484
  inventory: v.optional(v.number()),
477
485
  },
478
486
  handler: async (ctx, args) => {
479
487
  const product = await ctx.db.get(args.id);
480
- if (!product || product.type !== 'product') {
481
- throw new Error('Product not found');
488
+ if (!product || product.type !== "product") {
489
+ throw new Error("Product not found");
482
490
  }
483
491
 
484
492
  await ctx.db.patch(args.id, {
@@ -490,8 +498,8 @@ export const updateProduct = mutation({
490
498
  updatedAt: Date.now(),
491
499
  });
492
500
 
493
- await ctx.db.insert('events', {
494
- type: 'product_updated',
501
+ await ctx.db.insert("events", {
502
+ type: "product_updated",
495
503
  actorId: ctx.auth.getUserIdentity()?.tokenIdentifier,
496
504
  targetId: args.id,
497
505
  timestamp: Date.now(),
@@ -507,15 +515,15 @@ export const updateProduct = mutation({
507
515
 
508
516
  // DELETE
509
517
  export const deleteProduct = mutation({
510
- args: { id: v.id('things') },
518
+ args: { id: v.id("things") },
511
519
  handler: async (ctx, { id }) => {
512
520
  await ctx.db.patch(id, {
513
- status: 'deleted',
521
+ status: "deleted",
514
522
  updatedAt: Date.now(),
515
523
  });
516
524
 
517
- await ctx.db.insert('events', {
518
- type: 'product_deleted',
525
+ await ctx.db.insert("events", {
526
+ type: "product_deleted",
519
527
  actorId: ctx.auth.getUserIdentity()?.tokenIdentifier,
520
528
  targetId: id,
521
529
  timestamp: Date.now(),
@@ -591,4 +599,4 @@ eventTypes:
591
599
 
592
600
  ---
593
601
 
594
- **You're now ready to build with the Multi-Ontology Architecture!** 🚀
602
+ **You're now ready to build with the ONE Ontology Architecture!** 🚀