interaqt 0.3.1 → 0.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/agent/.claude/agents/computation-generation-handler.md +1 -3
- package/agent/.claude/agents/requirements-analysis-handler.md +43 -3
- package/agent/agentspace/knowledge/generator/api-reference.md +538 -101
- package/agent/agentspace/knowledge/generator/computation-analysis.md +22 -20
- package/agent/agentspace/knowledge/generator/computation-implementation.md +62 -38
- package/agent/agentspace/knowledge/generator/data-analysis.md +23 -2
- package/dist/index.js +2977 -2976
- package/dist/index.js.map +1 -1
- package/dist/runtime/ComputationSourceMap.d.ts +11 -21
- package/dist/runtime/ComputationSourceMap.d.ts.map +1 -1
- package/dist/runtime/Controller.d.ts +2 -2
- package/dist/runtime/MonoSystem.d.ts.map +1 -1
- package/dist/runtime/Scheduler.d.ts +6 -6
- package/dist/runtime/Scheduler.d.ts.map +1 -1
- package/dist/runtime/System.d.ts +5 -0
- package/dist/runtime/System.d.ts.map +1 -1
- package/dist/runtime/computations/Computation.d.ts +4 -9
- package/dist/runtime/computations/Computation.d.ts.map +1 -1
- package/dist/runtime/computations/StateMachine.d.ts +4 -7
- package/dist/runtime/computations/StateMachine.d.ts.map +1 -1
- package/dist/runtime/computations/Transform.d.ts +7 -1
- package/dist/runtime/computations/Transform.d.ts.map +1 -1
- package/dist/runtime/computations/TransitionFinder.d.ts +2 -2
- package/dist/runtime/computations/TransitionFinder.d.ts.map +1 -1
- package/dist/shared/StateTransfer.d.ts +15 -5
- package/dist/shared/StateTransfer.d.ts.map +1 -1
- package/dist/shared/Transform.d.ts +17 -3
- package/dist/shared/Transform.d.ts.map +1 -1
- package/package.json +1 -1
- package/agent/.claude/agents/requirements-analysis-handler-bak.md +0 -530
|
@@ -134,7 +134,7 @@ For each element:
|
|
|
134
134
|
2. For properties, check controlType first:
|
|
135
135
|
- If `creation-only` or `derived-with-parent` → use `_owner`
|
|
136
136
|
- If `independent` → apply standard dependency analysis rules
|
|
137
|
-
3. Apply the appropriate rules based on creation type
|
|
137
|
+
3. Apply the appropriate rules based on creation type
|
|
138
138
|
4. For entities/relations that can be hard-deleted, use Transform + HardDeletionProperty with StateMachine
|
|
139
139
|
|
|
140
140
|
### Step 3: Generate Output Document
|
|
@@ -149,7 +149,7 @@ Create `docs/computation-analysis.json` with this structure:
|
|
|
149
149
|
"entityAnalysis": {
|
|
150
150
|
"purpose": "<from data-design.json>",
|
|
151
151
|
"lifecycle": "<directly copy from lifecycle field in data-design.json>",
|
|
152
|
-
"computationDecision": "<Transform/
|
|
152
|
+
"computationDecision": "<Transform/_parent:[ParentName]/None based on rules>",
|
|
153
153
|
"reasoning": "<automated based on lifecycle and deletion capability>",
|
|
154
154
|
"calculationMethod": "<from computationMethod>"
|
|
155
155
|
},
|
|
@@ -175,7 +175,7 @@ Create `docs/computation-analysis.json` with this structure:
|
|
|
175
175
|
"relationAnalysis": {
|
|
176
176
|
"purpose": "<from data-design.json>",
|
|
177
177
|
"lifecycle": "<directly copy from lifecycle field in data-design.json>",
|
|
178
|
-
"computationDecision": "<Transform/_parent:[ParentName]
|
|
178
|
+
"computationDecision": "<Transform/_parent:[ParentName] based on rules>",
|
|
179
179
|
"reasoning": "<automated based on lifecycle>",
|
|
180
180
|
"calculationMethod": "<from computationMethod>"
|
|
181
181
|
}
|
|
@@ -223,11 +223,12 @@ Examples:
|
|
|
223
223
|
├─ lifecycle.creation.type: "interaction-created" + canBeDeleted: true (soft)? → Transform + status StateMachine
|
|
224
224
|
├─ lifecycle.creation.type: "interaction-created" + canBeDeleted: false? → Transform with InteractionEventEntity
|
|
225
225
|
└─ lifecycle.creation.type: "derived"? → Transform from source entity
|
|
226
|
+
└─ lifecycle.creation.type: "mutation-derived"? → Transform from record mutation event
|
|
226
227
|
|
|
227
228
|
2. Relation Lifecycle?
|
|
228
229
|
├─ lifecycle.creation.type: "created-with-entity"? → _parent:[parent]
|
|
229
230
|
├─ Can be deleted? → Transform/parent + HardDeletionProperty with StateMachine
|
|
230
|
-
├─ Needs audit trail? →
|
|
231
|
+
├─ Needs audit trail? → Transform + status StateMachine (soft delete)
|
|
231
232
|
└─ Never deleted? → Transform (if interaction-created) or _parent:[parent]
|
|
232
233
|
|
|
233
234
|
3. Property Value?
|
|
@@ -244,22 +245,6 @@ Examples:
|
|
|
244
245
|
└─ Check computationMethod → Map to Count/Summation/Custom
|
|
245
246
|
```
|
|
246
247
|
|
|
247
|
-
## Implementation Checklist
|
|
248
|
-
|
|
249
|
-
- [ ] Parse `data-design.json` completely
|
|
250
|
-
- [ ] Apply mapping rules for every entity (check deletion capability)
|
|
251
|
-
- [ ] Check `controlType` for every property first
|
|
252
|
-
- [ ] Apply mapping rules for properties based on `controlType`
|
|
253
|
-
- [ ] Apply mapping rules for every relation
|
|
254
|
-
- [ ] Apply mapping rules for every dictionary
|
|
255
|
-
- [ ] Format all dependencies correctly
|
|
256
|
-
- [ ] Separate `dependencies` and `interactionDependencies`
|
|
257
|
-
- [ ] Add `InteractionEventEntity` when needed
|
|
258
|
-
- [ ] Verify properties with `controlType: "creation-only"` or `"derived-with-parent"` use `_owner`
|
|
259
|
-
- [ ] Verify Transform + HardDeletionProperty is used for deletable entities (hard-delete)
|
|
260
|
-
- [ ] Verify Transform + HardDeletionProperty is used for deletable relations (hard-delete)
|
|
261
|
-
- [ ] Generate complete `computation-analysis.json`
|
|
262
|
-
|
|
263
248
|
## Common Patterns
|
|
264
249
|
|
|
265
250
|
### Timestamps
|
|
@@ -305,3 +290,20 @@ Before finalizing, verify:
|
|
|
305
290
|
8. All dependencies are properly formatted with specific properties
|
|
306
291
|
9. `InteractionEventEntity` is included when interactions are dependencies
|
|
307
292
|
10. The parent name in `_parent:[ParentName]` matches `lifecycle.creation.parent`
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
## Implementation Checklist
|
|
296
|
+
|
|
297
|
+
- [ ] Parse `data-design.json` completely
|
|
298
|
+
- [ ] Apply mapping rules for every entity (check deletion capability)
|
|
299
|
+
- [ ] Check `controlType` for every property first
|
|
300
|
+
- [ ] Apply mapping rules for properties based on `controlType`
|
|
301
|
+
- [ ] Apply mapping rules for every relation
|
|
302
|
+
- [ ] Apply mapping rules for every dictionary
|
|
303
|
+
- [ ] Format all dependencies correctly
|
|
304
|
+
- [ ] Separate `dependencies` and `interactionDependencies`
|
|
305
|
+
- [ ] Add `InteractionEventEntity` when needed
|
|
306
|
+
- [ ] Verify properties with `controlType: "creation-only"` or `"derived-with-parent"` use `_owner`
|
|
307
|
+
- [ ] Verify Transform + HardDeletionProperty is used for deletable entities (hard-delete)
|
|
308
|
+
- [ ] Verify Transform + HardDeletionProperty is used for deletable relations (hard-delete)
|
|
309
|
+
- [ ] Generate complete `computation-analysis.json`
|
|
@@ -94,8 +94,14 @@ When using `InteractionEventEntity` as the Transform input source, understand th
|
|
|
94
94
|
name: 'Style'
|
|
95
95
|
});
|
|
96
96
|
Style.computation = Transform.create({
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
eventDeps: {
|
|
98
|
+
StyleInteraction: {
|
|
99
|
+
recordName: InteractionEventEntity.name,
|
|
100
|
+
type: 'create'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
callback: function(mutationEvent) {
|
|
104
|
+
const event = mutationEvent.record;
|
|
99
105
|
if (event.interactionName === 'UpdateStyle') {
|
|
100
106
|
// This will CREATE a new Style, not update existing!
|
|
101
107
|
return { id: event.payload.id, ... } // WRONG!
|
|
@@ -115,7 +121,7 @@ When using `InteractionEventEntity` as the Transform input source, understand th
|
|
|
115
121
|
trigger: UpdateStyleInteraction,
|
|
116
122
|
current: updatedState,
|
|
117
123
|
next: updatedState,
|
|
118
|
-
computeTarget: (
|
|
124
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
119
125
|
})
|
|
120
126
|
]
|
|
121
127
|
});
|
|
@@ -133,7 +139,7 @@ When using `InteractionEventEntity` as the Transform input source, understand th
|
|
|
133
139
|
trigger: DeleteStyleInteraction,
|
|
134
140
|
current: activeState,
|
|
135
141
|
next: deletedState,
|
|
136
|
-
computeTarget: (
|
|
142
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
137
143
|
})
|
|
138
144
|
]
|
|
139
145
|
});
|
|
@@ -179,8 +185,14 @@ export const Style = Entity.create({
|
|
|
179
185
|
});
|
|
180
186
|
// Transform in Entity's computation property
|
|
181
187
|
Style.computation = Transform.create({
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
eventDeps: {
|
|
189
|
+
StyleInteraction: {
|
|
190
|
+
recordName: InteractionEventEntity.name,
|
|
191
|
+
type: 'create'
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
callback: function(mutationEvent) {
|
|
195
|
+
const event = mutationEvent.record;
|
|
184
196
|
if (event.interactionName === 'CreateStyle') {
|
|
185
197
|
return {
|
|
186
198
|
label: event.payload.label,
|
|
@@ -238,8 +250,14 @@ export const OrderItemRelation = Relation.create({
|
|
|
238
250
|
|
|
239
251
|
|
|
240
252
|
Order.computation = Transform.create({
|
|
241
|
-
|
|
242
|
-
|
|
253
|
+
eventDeps: {
|
|
254
|
+
OrderInteraction: {
|
|
255
|
+
recordName: InteractionEventEntity.name,
|
|
256
|
+
type: 'create'
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
callback: function(mutationEvent) {
|
|
260
|
+
const event = mutationEvent.record;
|
|
243
261
|
if (event.interactionName === 'CreateOrder') {
|
|
244
262
|
return {
|
|
245
263
|
orderNumber: event.payload.orderNumber,
|
|
@@ -374,13 +392,13 @@ statusProperty.computation = StateMachine.create({
|
|
|
374
392
|
current: draftState,
|
|
375
393
|
next: activeState,
|
|
376
394
|
trigger: PublishStyle,
|
|
377
|
-
computeTarget: (
|
|
395
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
378
396
|
}),
|
|
379
397
|
StateTransfer.create({
|
|
380
398
|
current: activeState,
|
|
381
399
|
next: offlineState,
|
|
382
400
|
trigger: DeleteStyle,
|
|
383
|
-
computeTarget: (
|
|
401
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
384
402
|
})
|
|
385
403
|
]
|
|
386
404
|
});
|
|
@@ -404,7 +422,7 @@ const UpdateStyle = Interaction.create({
|
|
|
404
422
|
// Define state node with computeValue
|
|
405
423
|
const updatedState = StateNode.create({
|
|
406
424
|
name: 'updated',
|
|
407
|
-
computeValue: () => Math.floor(Date.now()/1000) // Returns timestamp in seconds when state is entered
|
|
425
|
+
computeValue: (lastValue, mutationEvent) => Math.floor(Date.now()/1000) // Returns timestamp in seconds when state is entered
|
|
408
426
|
});
|
|
409
427
|
|
|
410
428
|
const updatedAtProperty = Property.create({
|
|
@@ -420,7 +438,7 @@ updatedAtProperty.computation = StateMachine.create({
|
|
|
420
438
|
current: updatedState,
|
|
421
439
|
next: updatedState, // Self-loop to same state
|
|
422
440
|
trigger: UpdateStyle,
|
|
423
|
-
computeTarget: (
|
|
441
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
424
442
|
})
|
|
425
443
|
]
|
|
426
444
|
});
|
|
@@ -428,7 +446,7 @@ updatedAtProperty.computation = StateMachine.create({
|
|
|
428
446
|
|
|
429
447
|
#### StateMachine with Event Context in computeValue
|
|
430
448
|
|
|
431
|
-
The `computeValue` function can access the
|
|
449
|
+
The `computeValue` function can access the mutation event as a second parameter, allowing you to use interaction context (user, payload) from `mutationEvent.record` in value computation:
|
|
432
450
|
|
|
433
451
|
```typescript
|
|
434
452
|
// Track who made changes and what was changed
|
|
@@ -448,21 +466,21 @@ const UpdateArticle = Interaction.create({
|
|
|
448
466
|
// State node that captures user and payload information
|
|
449
467
|
const modifiedState = StateNode.create({
|
|
450
468
|
name: 'modified',
|
|
451
|
-
// computeValue receives (lastValue,
|
|
452
|
-
computeValue: (lastValue,
|
|
469
|
+
// computeValue receives (lastValue, mutationEvent) parameters
|
|
470
|
+
computeValue: (lastValue, mutationEvent) => {
|
|
453
471
|
// Access user who triggered the update
|
|
454
|
-
const modifier =
|
|
472
|
+
const modifier = mutationEvent?.record?.user?.name || mutationEvent?.record?.user?.id || 'anonymous';
|
|
455
473
|
|
|
456
474
|
// Access payload to see what was changed
|
|
457
475
|
const changes = [];
|
|
458
|
-
if (
|
|
459
|
-
if (
|
|
476
|
+
if (mutationEvent?.record?.payload?.title) changes.push('title');
|
|
477
|
+
if (mutationEvent?.record?.payload?.content) changes.push('content');
|
|
460
478
|
|
|
461
479
|
return {
|
|
462
480
|
modifiedAt: Math.floor(Date.now()/1000),
|
|
463
481
|
modifiedBy: modifier,
|
|
464
482
|
changedFields: changes,
|
|
465
|
-
updateReason:
|
|
483
|
+
updateReason: mutationEvent?.record?.payload?.updateReason || 'No reason provided',
|
|
466
484
|
// Preserve previous modification history
|
|
467
485
|
previousModifications: lastValue?.previousModifications || []
|
|
468
486
|
};
|
|
@@ -483,7 +501,7 @@ modificationInfoProperty.computation = StateMachine.create({
|
|
|
483
501
|
current: modifiedState,
|
|
484
502
|
next: modifiedState,
|
|
485
503
|
trigger: UpdateArticle,
|
|
486
|
-
computeTarget: (
|
|
504
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
487
505
|
})
|
|
488
506
|
]
|
|
489
507
|
});
|
|
@@ -502,25 +520,25 @@ const ApproveRequest = Interaction.create({
|
|
|
502
520
|
|
|
503
521
|
const approvedState = StateNode.create({
|
|
504
522
|
name: 'approved',
|
|
505
|
-
computeValue: (lastValue,
|
|
523
|
+
computeValue: (lastValue, mutationEvent) => {
|
|
506
524
|
// Capture complete approval context from event
|
|
507
525
|
return {
|
|
508
526
|
status: 'approved',
|
|
509
527
|
approvedAt: Math.floor(Date.now()/1000),
|
|
510
528
|
approvedBy: {
|
|
511
|
-
id:
|
|
512
|
-
name:
|
|
513
|
-
role:
|
|
529
|
+
id: mutationEvent?.record?.user?.id,
|
|
530
|
+
name: mutationEvent?.record?.user?.name,
|
|
531
|
+
role: mutationEvent?.record?.user?.role
|
|
514
532
|
},
|
|
515
|
-
approvalComments:
|
|
533
|
+
approvalComments: mutationEvent?.record?.payload?.comments,
|
|
516
534
|
// Keep approval history
|
|
517
535
|
approvalHistory: [
|
|
518
536
|
...(lastValue?.approvalHistory || []),
|
|
519
537
|
{
|
|
520
538
|
action: 'approved',
|
|
521
539
|
timestamp: Math.floor(Date.now()/1000),
|
|
522
|
-
user:
|
|
523
|
-
comments:
|
|
540
|
+
user: mutationEvent?.record?.user?.name || 'unknown',
|
|
541
|
+
comments: mutationEvent?.record?.payload?.comments
|
|
524
542
|
}
|
|
525
543
|
]
|
|
526
544
|
};
|
|
@@ -528,11 +546,11 @@ const approvedState = StateNode.create({
|
|
|
528
546
|
});
|
|
529
547
|
```
|
|
530
548
|
|
|
531
|
-
**Key Points about
|
|
532
|
-
- The `
|
|
533
|
-
-
|
|
549
|
+
**Key Points about MutationEvent Parameter:**
|
|
550
|
+
- The `mutationEvent` parameter is optional and may be `undefined` during initial state setup
|
|
551
|
+
- Access the interaction context through `mutationEvent.record`: `user`, `payload`, `interactionName`, etc.
|
|
534
552
|
- Useful for audit trails, tracking who made changes, and capturing interaction-specific data
|
|
535
|
-
- Always use optional chaining (`?.`) when accessing
|
|
553
|
+
- Always use optional chaining (`?.`) when accessing mutationEvent properties as it may be undefined
|
|
536
554
|
|
|
537
555
|
|
|
538
556
|
### 3. Custom - Complete User Control (USE WITH CAUTION!)
|
|
@@ -747,8 +765,14 @@ export const Style = Entity.create({
|
|
|
747
765
|
]
|
|
748
766
|
});
|
|
749
767
|
Style.computation = Transform.create({
|
|
750
|
-
|
|
751
|
-
|
|
768
|
+
eventDeps: {
|
|
769
|
+
StyleInteraction: {
|
|
770
|
+
recordName: InteractionEventEntity.name,
|
|
771
|
+
type: 'create'
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
callback: (mutationEvent) => {
|
|
775
|
+
const event = mutationEvent.record;
|
|
752
776
|
if (event.interactionName === 'CreateStyle') {
|
|
753
777
|
return {
|
|
754
778
|
label: event.payload.label,
|
|
@@ -780,7 +804,7 @@ export const UpdateStyle = Interaction.create({
|
|
|
780
804
|
// Property with update tracking
|
|
781
805
|
const updatedState = StateNode.create({
|
|
782
806
|
name: 'updated',
|
|
783
|
-
computeValue: () => Math.floor(Date.now()/1000)
|
|
807
|
+
computeValue: (lastValue, mutationEvent) => Math.floor(Date.now()/1000)
|
|
784
808
|
});
|
|
785
809
|
|
|
786
810
|
const updatedAtProperty = Property.create({
|
|
@@ -795,7 +819,7 @@ updatedAtProperty.computation = StateMachine.create({
|
|
|
795
819
|
current: updatedState,
|
|
796
820
|
next: updatedState,
|
|
797
821
|
trigger: UpdateStyle,
|
|
798
|
-
computeTarget: (
|
|
822
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
799
823
|
})
|
|
800
824
|
]
|
|
801
825
|
});
|
|
@@ -831,7 +855,7 @@ statusProperty.computation = StateMachine.create({
|
|
|
831
855
|
current: activeState,
|
|
832
856
|
next: offlineState,
|
|
833
857
|
trigger: DeleteStyle,
|
|
834
|
-
computeTarget: (
|
|
858
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
835
859
|
})
|
|
836
860
|
]
|
|
837
861
|
});
|
|
@@ -888,7 +912,7 @@ Property.create({
|
|
|
888
912
|
// ✅ CORRECT: Updated at - updates on changes (in seconds)
|
|
889
913
|
const updatedState = StateNode.create({
|
|
890
914
|
name: 'updated',
|
|
891
|
-
computeValue: () => Math.floor(Date.now()/1000) // Always convert to seconds!
|
|
915
|
+
computeValue: (lastValue, mutationEvent) => Math.floor(Date.now()/1000) // Always convert to seconds!
|
|
892
916
|
});
|
|
893
917
|
|
|
894
918
|
const updatedAtProperty = Property.create({
|
|
@@ -903,7 +927,7 @@ updatedAtProperty.computation = StateMachine.create({
|
|
|
903
927
|
current: updatedState,
|
|
904
928
|
next: updatedState,
|
|
905
929
|
trigger: UpdateInteraction,
|
|
906
|
-
computeTarget: (
|
|
930
|
+
computeTarget: (mutationEvent) => ({ id: mutationEvent.record.payload.id })
|
|
907
931
|
})
|
|
908
932
|
]
|
|
909
933
|
});
|
|
@@ -81,6 +81,12 @@ Analyze the creation pattern:
|
|
|
81
81
|
- **derived**: Entity is filtered/computed from other entities
|
|
82
82
|
- No interactions directly create it
|
|
83
83
|
- Views in data-concepts.json are typically derived
|
|
84
|
+
|
|
85
|
+
- **mutation-derived**: Entity is created from record mutation events
|
|
86
|
+
- Not directly in any interaction's `data.creates`
|
|
87
|
+
- Created by reactive computations (e.g., Transform) responding to other entities' creation/update/deletion
|
|
88
|
+
- Check for descriptions mentioning "when X is created/updated/deleted, create Y"
|
|
89
|
+
- Often used for audit logs, history tracking, or event-driven workflows
|
|
84
90
|
|
|
85
91
|
**Example Analysis**:
|
|
86
92
|
```json
|
|
@@ -92,6 +98,12 @@ Analyze the creation pattern:
|
|
|
92
98
|
"Automatically create individual bed entities for each bed"
|
|
93
99
|
]
|
|
94
100
|
// Result: Dormitory is interaction-created, Bed is created-with-parent (parent: Dormitory)
|
|
101
|
+
|
|
102
|
+
// For mutation-derived entity (not in any interaction's creates):
|
|
103
|
+
// In data-concepts.json: "UserActivityLog: Records all user actions"
|
|
104
|
+
// In interactions: No interaction directly creates UserActivityLog
|
|
105
|
+
// In descriptions: "Activity logs are automatically created when users perform actions"
|
|
106
|
+
// Result: UserActivityLog is mutation-derived
|
|
95
107
|
```
|
|
96
108
|
|
|
97
109
|
#### 2.2 Determine Deletion Pattern
|
|
@@ -164,6 +176,10 @@ Similar to entities, analyze how relations are created:
|
|
|
164
176
|
- **interaction-created**: Relation created independently
|
|
165
177
|
- **created-with-entity**: Created when source/target entity is created
|
|
166
178
|
- **derived**: Computed from data conditions
|
|
179
|
+
- **mutation-derived**: Created from record mutation events
|
|
180
|
+
- Not directly in any interaction's `data.creates`
|
|
181
|
+
- Created by reactive computations responding to entity/relation changes
|
|
182
|
+
- Common for maintaining referential integrity or creating audit trails
|
|
167
183
|
|
|
168
184
|
**Example**:
|
|
169
185
|
```json
|
|
@@ -174,6 +190,11 @@ Similar to entities, analyze how relations are created:
|
|
|
174
190
|
// If it appeared with entity creation:
|
|
175
191
|
// "CreatePost": "data": { "creates": ["Post", "PostAuthorRelation"] }
|
|
176
192
|
// Result: PostAuthorRelation is created-with-entity (Post)
|
|
193
|
+
|
|
194
|
+
// For mutation-derived relation:
|
|
195
|
+
// UserFollowRelation not in any interaction's creates
|
|
196
|
+
// Description: "Automatically created when user likes multiple posts by same author"
|
|
197
|
+
// Result: UserFollowRelation is mutation-derived
|
|
177
198
|
```
|
|
178
199
|
|
|
179
200
|
### Step 5: Transform Dictionaries to Analysis Format
|
|
@@ -310,7 +331,7 @@ Transform the analyzed data into the standard output format:
|
|
|
310
331
|
"computationMethod": "[Creation pattern description]",
|
|
311
332
|
"lifecycle": {
|
|
312
333
|
"creation": {
|
|
313
|
-
"type": "[interaction-created | derived | created-with-parent]",
|
|
334
|
+
"type": "[interaction-created | derived | created-with-parent | mutation-derived]",
|
|
314
335
|
"parent": "[Parent entity name if created-with-parent]",
|
|
315
336
|
"creationInteractions": "[List from Step 2.1]"
|
|
316
337
|
},
|
|
@@ -345,7 +366,7 @@ Transform the analyzed data into the standard output format:
|
|
|
345
366
|
"computationMethod": "[From Step 4.2]",
|
|
346
367
|
"lifecycle": {
|
|
347
368
|
"creation": {
|
|
348
|
-
"type": "[
|
|
369
|
+
"type": "[interaction-created | created-with-entity | derived | mutation-derived]",
|
|
349
370
|
"parent": "[If created-with-entity]",
|
|
350
371
|
"creationInteractions": "[From Step 4.2]"
|
|
351
372
|
},
|