interaqt 0.7.3 → 0.7.4
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.md +46 -7
- package/agent/agentspace/knowledge/generator/computation-analysis.md +53 -36
- package/agent/agentspace/knowledge/generator/data-analysis.md +276 -49
- package/agent/agentspace/knowledge/generator/integration-implementation-handler.md +550 -0
- package/agent/agentspace/prompt/requirement_analysis_refactor.md +1 -1
- package/dist/index.js +217 -215
- package/dist/index.js.map +1 -1
- package/dist/storage/erstorage/RecordQueryAgent.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
This guide explains how to analyze data requirements using the new requirement artifacts (`requirements/data-concepts.json
|
|
5
|
+
This guide explains how to analyze data requirements using the new requirement artifacts (`requirements/{module}.data-concepts.json`, `requirements/{module}.interactions-design.json`, and `requirements/{module}.integration.json`) to produce a comprehensive data design for interaqt implementations. The analysis leverages pre-extracted data concepts, interaction specifications, and external integration requirements to determine entity lifecycles, property dependencies, and computation methods.
|
|
6
|
+
|
|
7
|
+
**IMPORTANT**: Read the current module name from `.currentmodule` file in project root, and use it to construct the file paths. For example, if `.currentmodule` contains `user-management`, then the paths would be:
|
|
8
|
+
- `requirements/user-management.data-concepts.json`
|
|
9
|
+
- `requirements/user-management.interactions-design.json`
|
|
10
|
+
- `requirements/user-management.integration.json`
|
|
6
11
|
|
|
7
12
|
## Important Note on Interaction References
|
|
8
13
|
|
|
@@ -19,26 +24,41 @@ This applies to all interaction-related fields including:
|
|
|
19
24
|
|
|
20
25
|
## Input Artifacts
|
|
21
26
|
|
|
22
|
-
### 1. requirements/data-concepts.json
|
|
27
|
+
### 1. requirements/{module}.data-concepts.json
|
|
23
28
|
Contains pre-extracted data concepts:
|
|
24
29
|
- **Entities**: Core business objects with their properties
|
|
25
30
|
- **Relations**: Connections between entities
|
|
26
31
|
- **Dictionaries**: Global data and system-wide configurations
|
|
27
32
|
- **Views**: Pre-defined data queries and filters
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
Note: Replace `{module}` with the value from `.currentmodule` file.
|
|
35
|
+
|
|
36
|
+
### 2. requirements/{module}.interactions-design.json
|
|
30
37
|
Contains interaction specifications showing:
|
|
31
38
|
- **Data operations**: What each interaction creates, reads, updates, or deletes
|
|
32
39
|
- **Data constraints**: How data is modified or created
|
|
33
40
|
- **Validation rules**: Business rules and constraints
|
|
34
41
|
|
|
42
|
+
Note: Replace `{module}` with the value from `.currentmodule` file.
|
|
43
|
+
|
|
44
|
+
### 3. requirements/{module}.integration.json
|
|
45
|
+
Contains external system integration requirements:
|
|
46
|
+
- **Integration flows**: Descriptions of interactions with external systems
|
|
47
|
+
- **Asynchronous operations**: Payment processing, AIGC generation, file storage, etc.
|
|
48
|
+
- **System boundaries**: What happens in current system vs external systems
|
|
49
|
+
- **Data flow**: How data moves between systems
|
|
50
|
+
|
|
51
|
+
Note: Replace `{module}` with the value from `.currentmodule` file. This file is used to identify integration event entities for tracking asynchronous external system responses.
|
|
52
|
+
|
|
35
53
|
## Analysis Process
|
|
36
54
|
|
|
37
55
|
### Step 1: Import Core Data Concepts
|
|
38
56
|
|
|
39
|
-
#### 1.1 Import Entities from requirements/data-concepts.json
|
|
57
|
+
#### 1.1 Import Entities from requirements/{module}.data-concepts.json
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
First, read the module name from `.currentmodule` file in project root to get the current module name.
|
|
60
|
+
|
|
61
|
+
Then read the entities directly from `requirements/{module}.data-concepts.json`. Each entity already includes:
|
|
42
62
|
- Name and description
|
|
43
63
|
- Properties with types and purposes
|
|
44
64
|
- Computed property indicators
|
|
@@ -48,19 +68,100 @@ Read the entities directly from `requirements/data-concepts.json`. Each entity a
|
|
|
48
68
|
|
|
49
69
|
#### 1.2 Import Dictionaries
|
|
50
70
|
|
|
51
|
-
Read dictionaries from `requirements/data-concepts.json`. These represent:
|
|
71
|
+
Read dictionaries from `requirements/{module}.data-concepts.json`. These represent:
|
|
52
72
|
- System-wide configurations
|
|
53
73
|
- Global statistics
|
|
54
74
|
- Shared validation rules
|
|
55
75
|
- Cross-entity aggregates
|
|
56
76
|
|
|
77
|
+
#### 1.3 Identify Integration Event Entities
|
|
78
|
+
|
|
79
|
+
Read integration requirements from `requirements/{module}.integration.json` (using the module name from `.currentmodule`).
|
|
80
|
+
|
|
81
|
+
**Identify Asynchronous External Calls:**
|
|
82
|
+
For each integration in the file, analyze whether it involves asynchronous responses:
|
|
83
|
+
- Webhook callbacks from external systems
|
|
84
|
+
- Polling-based status checks
|
|
85
|
+
- Delayed processing results (payment confirmations, AIGC generation results, etc.)
|
|
86
|
+
|
|
87
|
+
**Create Event Entities for Asynchronous Integrations:**
|
|
88
|
+
For each asynchronous integration identified, create a corresponding event entity following this pattern:
|
|
89
|
+
|
|
90
|
+
**Naming Convention:**
|
|
91
|
+
- `{IntegrationName}Event` (e.g., `PaymentEvent`, `AIGCEvent`, `FileUploadEvent`)
|
|
92
|
+
- Use the integration name from `requirements/{module}.integration.json`
|
|
93
|
+
|
|
94
|
+
**Event Entity Characteristics:**
|
|
95
|
+
- **Immutable**: Can only be created, never updated or deleted
|
|
96
|
+
- **Append-only**: New events are added to track state changes
|
|
97
|
+
- **Source of Truth**: Business data in the system should be computed based on these events
|
|
98
|
+
|
|
99
|
+
**Event Entity Properties:**
|
|
100
|
+
Based on the integration's `flow_description` and `current_system_data`, determine what properties the event should capture:
|
|
101
|
+
- External system's response data (transaction IDs, status codes, results)
|
|
102
|
+
- Timestamp of when the event was received
|
|
103
|
+
- Reference to related entities in current system (User.id, Order.id, etc.)
|
|
104
|
+
- Any relevant metadata from the external system
|
|
105
|
+
|
|
106
|
+
**Example:**
|
|
107
|
+
```json
|
|
108
|
+
// From requirements/{module}.integration.json:
|
|
109
|
+
{
|
|
110
|
+
"id": "INT001",
|
|
111
|
+
"name": "PaymentProcessing",
|
|
112
|
+
"external_system": "Stripe",
|
|
113
|
+
"flow_description": "...Stripe processes payment...returns payment result..."
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Generated Event Entity:
|
|
117
|
+
"PaymentEvent": {
|
|
118
|
+
"purpose": "Records payment status updates received from Stripe",
|
|
119
|
+
"isIntegrationEvent": true,
|
|
120
|
+
"properties": {
|
|
121
|
+
"transactionId": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"purpose": "External payment transaction ID from Stripe"
|
|
124
|
+
},
|
|
125
|
+
"eventType": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"purpose": "Type of External payment event type"
|
|
128
|
+
},
|
|
129
|
+
"paymentStatus": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"purpose": "Status returned by Stripe (success, failed, pending)"
|
|
132
|
+
},
|
|
133
|
+
"amount": {
|
|
134
|
+
"type": "number",
|
|
135
|
+
"purpose": "Payment amount"
|
|
136
|
+
},
|
|
137
|
+
"timestamp": {
|
|
138
|
+
"type": "date",
|
|
139
|
+
"purpose": "When the payment result was received"
|
|
140
|
+
},
|
|
141
|
+
"userId": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"purpose": "Reference to User who initiated payment"
|
|
144
|
+
},
|
|
145
|
+
"orderId": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"purpose": "Reference to Order being paid for"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Documentation:**
|
|
154
|
+
- Document the relationship between event entities and business entities
|
|
155
|
+
- Explain how business data should be computed from these events
|
|
156
|
+
- Note that other entities' properties may depend on these event entities
|
|
157
|
+
|
|
57
158
|
### Step 2: Analyze Entity Lifecycles Using Interactions
|
|
58
159
|
|
|
59
|
-
For **EACH entity** in data-concepts.json
|
|
160
|
+
For **EACH entity** in `requirements/{module}.data-concepts.json`:
|
|
60
161
|
|
|
61
162
|
#### 2.1 Determine Creation Pattern
|
|
62
163
|
|
|
63
|
-
Analyze `requirements/interactions-design.json` to identify how entities are created:
|
|
164
|
+
Analyze `requirements/{module}.interactions-design.json` (using the module name from `.currentmodule`) to identify how entities are created:
|
|
64
165
|
|
|
65
166
|
**Step A: Find Creation Interactions**
|
|
66
167
|
1. Search all interactions where the entity appears in `interactions.specification.data.creates`
|
|
@@ -73,6 +174,10 @@ Analyze `requirements/interactions-design.json` to identify how entities are cre
|
|
|
73
174
|
**Step B: Determine Creation Type**
|
|
74
175
|
Analyze the creation pattern:
|
|
75
176
|
|
|
177
|
+
- **integration-event**: Entity is an event entity for external system integration
|
|
178
|
+
- Identified in Step 1.3 from `requirements/{module}.integration.json`
|
|
179
|
+
- Created when external system sends asynchronous responses (webhooks, callbacks)
|
|
180
|
+
|
|
76
181
|
- **interaction-created**: Entity is created independently by interactions
|
|
77
182
|
- Entity appears alone in `data.creates`
|
|
78
183
|
- Or is the primary entity being created
|
|
@@ -84,7 +189,7 @@ Analyze the creation pattern:
|
|
|
84
189
|
|
|
85
190
|
- **derived**: Entity is filtered/computed from other entities
|
|
86
191
|
- No interactions directly create it
|
|
87
|
-
- Views in data-concepts.json are typically derived
|
|
192
|
+
- Views in `requirements/{module}.data-concepts.json` are typically derived
|
|
88
193
|
|
|
89
194
|
- **mutation-derived**: Entity is created from record mutation events
|
|
90
195
|
- Not directly in any interaction's `data.creates`
|
|
@@ -114,7 +219,7 @@ Analyze the creation pattern:
|
|
|
114
219
|
// Bed is created-with-parent (parent: Dormitory) with creation details
|
|
115
220
|
|
|
116
221
|
// For mutation-derived entity (not in any interaction's creates):
|
|
117
|
-
// In data-concepts.json: "UserActivityLog: Records all user actions"
|
|
222
|
+
// In requirements/{module}.data-concepts.json: "UserActivityLog: Records all user actions"
|
|
118
223
|
// In interactions: No interaction directly creates UserActivityLog
|
|
119
224
|
// In descriptions: "Activity logs are automatically created when users perform actions"
|
|
120
225
|
// Result: UserActivityLog is mutation-derived
|
|
@@ -139,7 +244,7 @@ For **EACH property** of every entity:
|
|
|
139
244
|
|
|
140
245
|
#### 3.1 Identify Data Dependencies
|
|
141
246
|
|
|
142
|
-
From data-concepts.json
|
|
247
|
+
From `requirements/{module}.data-concepts.json`, check if property is marked as `computed`:
|
|
143
248
|
- If `computed: true`, examine the `computation` field
|
|
144
249
|
- List all entities/relations/properties mentioned in `computation.dependencies`
|
|
145
250
|
- These become the property's `dataDependencies`
|
|
@@ -151,7 +256,7 @@ From data-concepts.json, check if property is marked as `computed`:
|
|
|
151
256
|
|
|
152
257
|
#### 3.2 Identify Interaction Dependencies
|
|
153
258
|
|
|
154
|
-
Search interactions-design.json to find which interactions modify this property:
|
|
259
|
+
Search `requirements/{module}.interactions-design.json` (using the module name from `.currentmodule`) to find which interactions modify this property:
|
|
155
260
|
1. Look for entity property in `data.updates` (e.g., "User.behaviorScore")
|
|
156
261
|
2. Look for entity in `data.creates` (properties set at creation)
|
|
157
262
|
3. List all matching interactions as `interactionDependencies` (use interaction **names**, not IDs)
|
|
@@ -159,7 +264,7 @@ Search interactions-design.json to find which interactions modify this property:
|
|
|
159
264
|
#### 3.3 Determine Computation Method
|
|
160
265
|
|
|
161
266
|
Transform the computation description using semantic best practices:
|
|
162
|
-
- **Don't copy directly** from data-concepts.json
|
|
267
|
+
- **Don't copy directly** from `requirements/{module}.data-concepts.json`
|
|
163
268
|
- Apply the "Best Practices for Computation Design" principles
|
|
164
269
|
- Use semantic computations (Count, Every, Any, Summation, etc.) where possible
|
|
165
270
|
- Decompose complex calculations into intermediate properties
|
|
@@ -176,7 +281,7 @@ Based on the analysis:
|
|
|
176
281
|
|
|
177
282
|
#### 4.1 Import Relation Structure
|
|
178
283
|
|
|
179
|
-
Read relations from data-concepts.json:
|
|
284
|
+
Read relations from `requirements/{module}.data-concepts.json` (using the module name from `.currentmodule`):
|
|
180
285
|
- Source and target entities
|
|
181
286
|
- Cardinality
|
|
182
287
|
- Relation properties
|
|
@@ -193,18 +298,64 @@ Similar to entities, analyze how relations are created:
|
|
|
193
298
|
- Dependencies from the creates entry
|
|
194
299
|
3. Analyze creation context
|
|
195
300
|
|
|
196
|
-
**Determine Creation Type**:
|
|
197
|
-
|
|
198
|
-
|
|
301
|
+
**Determine Creation Type - MANDATORY ALGORITHM**:
|
|
302
|
+
|
|
303
|
+
**🔴 CRITICAL: Follow this exact decision algorithm for EACH relation:**
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
FOR each Relation found in interaction's data.creates:
|
|
307
|
+
|
|
308
|
+
STEP 1: Check if relation NOT in any interaction's data.creates
|
|
309
|
+
→ IF TRUE: Type = "mutation-derived"
|
|
310
|
+
→ STOP
|
|
311
|
+
|
|
312
|
+
STEP 2: Check the SAME interaction's data.creates array
|
|
313
|
+
→ Find all Entities in the same creates array
|
|
314
|
+
|
|
315
|
+
STEP 3: Check relation's dependencies field
|
|
316
|
+
→ IF dependencies contains ANY Entity from STEP 2:
|
|
317
|
+
→ Type = "created-with-entity"
|
|
318
|
+
→ parent = that Entity name
|
|
319
|
+
→ STOP
|
|
320
|
+
|
|
321
|
+
STEP 4: Check description for keywords
|
|
322
|
+
→ IF description contains "newly created" OR "just created" OR "connecting to created":
|
|
323
|
+
→ Type = "created-with-entity"
|
|
324
|
+
→ parent = the Entity being referenced
|
|
325
|
+
→ STOP
|
|
326
|
+
|
|
327
|
+
STEP 5: Default case (relation only, no entity in same creates)
|
|
328
|
+
→ Type = "interaction-created"
|
|
329
|
+
→ parent = null
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Type Definitions**:
|
|
333
|
+
- **integration-event**: Relation created from external system events (rare, most integration events are entities)
|
|
334
|
+
- Would be identified if a relation needs to track external system relationships
|
|
335
|
+
- Immutable and append-only like integration-event entities
|
|
336
|
+
|
|
337
|
+
- **created-with-entity**: Relation created together with an entity in the SAME interaction
|
|
338
|
+
- **Key signal**: Relation's dependencies include an Entity that is ALSO in the same `data.creates` array
|
|
339
|
+
- **Key signal**: Description mentions "newly created" or "connecting to created" entity
|
|
340
|
+
- The relation should be created automatically by the entity's Transform computation
|
|
341
|
+
- Set `parent` to the entity name
|
|
342
|
+
|
|
343
|
+
- **interaction-created**: Relation created independently (no entity being created in same interaction)
|
|
344
|
+
- **Key signal**: Relation is the ONLY item in `data.creates`, or
|
|
345
|
+
- **Key signal**: All entities in dependencies already exist (not being created in same interaction)
|
|
346
|
+
- The relation needs its own Transform computation
|
|
347
|
+
|
|
199
348
|
- **derived**: Computed from data conditions
|
|
349
|
+
|
|
200
350
|
- **mutation-derived**: Created from record mutation events
|
|
201
351
|
- Not directly in any interaction's `data.creates`
|
|
202
352
|
- Created by reactive computations responding to entity/relation changes
|
|
203
353
|
- Common for maintaining referential integrity or creating audit trails
|
|
204
354
|
|
|
205
|
-
**
|
|
355
|
+
**Examples with Algorithm Applied**:
|
|
356
|
+
|
|
206
357
|
```json
|
|
207
|
-
//
|
|
358
|
+
// Example 1: interaction-created
|
|
208
359
|
// "AssignUserToBed": "data": {
|
|
209
360
|
// "creates": [{
|
|
210
361
|
// "target": "UserBedAssignment",
|
|
@@ -212,26 +363,47 @@ Similar to entities, analyze how relations are created:
|
|
|
212
363
|
// "dependencies": ["User", "Bed", "AvailabilityCheck"]
|
|
213
364
|
// }]
|
|
214
365
|
// }
|
|
215
|
-
//
|
|
366
|
+
// Analysis:
|
|
367
|
+
// - STEP 2: Same creates array has: [] (no entities)
|
|
368
|
+
// - STEP 3: Dependencies ["User", "Bed"] are NOT in creates array
|
|
369
|
+
// - STEP 5: Result = interaction-created
|
|
216
370
|
|
|
217
|
-
//
|
|
371
|
+
// Example 2: created-with-entity
|
|
218
372
|
// "CreatePost": "data": {
|
|
219
373
|
// "creates": [
|
|
220
374
|
// {"target": "Post", "description": "Create new post", "dependencies": ["User"]},
|
|
221
375
|
// {"target": "PostAuthorRelation", "description": "Link post to author", "dependencies": ["Post", "User"]}
|
|
222
376
|
// ]
|
|
223
377
|
// }
|
|
224
|
-
//
|
|
378
|
+
// Analysis for PostAuthorRelation:
|
|
379
|
+
// - STEP 2: Same creates array has: ["Post"]
|
|
380
|
+
// - STEP 3: Dependencies contain "Post" which IS in creates array
|
|
381
|
+
// - Result = created-with-entity (parent: "Post")
|
|
382
|
+
|
|
383
|
+
// Example 3: created-with-entity (donate module case)
|
|
384
|
+
// "RechargeGifts": "data": {
|
|
385
|
+
// "creates": [
|
|
386
|
+
// {"target": "RechargeRecord", "description": "Create new recharge record...", "dependencies": []},
|
|
387
|
+
// {"target": "UserRechargeRelation", "description": "Create relation connecting current User to the newly created RechargeRecord", "dependencies": ["User", "RechargeRecord"]}
|
|
388
|
+
// ]
|
|
389
|
+
// }
|
|
390
|
+
// Analysis for UserRechargeRelation:
|
|
391
|
+
// - STEP 2: Same creates array has: ["RechargeRecord"]
|
|
392
|
+
// - STEP 3: Dependencies contain "RechargeRecord" which IS in creates array
|
|
393
|
+
// - STEP 4: Description contains "newly created"
|
|
394
|
+
// - Result = created-with-entity (parent: "RechargeRecord")
|
|
225
395
|
|
|
226
|
-
//
|
|
396
|
+
// Example 4: mutation-derived
|
|
227
397
|
// UserFollowRelation not in any interaction's creates
|
|
228
398
|
// Description: "Automatically created when user likes multiple posts by same author"
|
|
229
|
-
//
|
|
399
|
+
// Analysis:
|
|
400
|
+
// - STEP 1: NOT in any creates array
|
|
401
|
+
// - Result = mutation-derived
|
|
230
402
|
```
|
|
231
403
|
|
|
232
404
|
### Step 5: Transform Dictionaries to Analysis Format
|
|
233
405
|
|
|
234
|
-
For each dictionary in data-concepts.json:
|
|
406
|
+
For each dictionary in `requirements/{module}.data-concepts.json` (using the module name from `.currentmodule`):
|
|
235
407
|
|
|
236
408
|
#### 5.1 Analyze Usage Patterns
|
|
237
409
|
|
|
@@ -330,14 +502,6 @@ Decompose into intermediate semantic computations:
|
|
|
330
502
|
}
|
|
331
503
|
```
|
|
332
504
|
|
|
333
|
-
### Benefits of This Approach
|
|
334
|
-
|
|
335
|
-
1. **Clarity**: Each property has a single, clear purpose
|
|
336
|
-
2. **Reusability**: Intermediate properties can be used by multiple consumers
|
|
337
|
-
3. **Performance**: System can optimize semantic computations
|
|
338
|
-
4. **Maintainability**: Changes to business logic are localized
|
|
339
|
-
5. **Testability**: Each computation can be validated independently
|
|
340
|
-
|
|
341
505
|
### When to Create Intermediate Properties
|
|
342
506
|
|
|
343
507
|
Create intermediate computed properties when you find yourself:
|
|
@@ -358,12 +522,13 @@ Transform the analyzed data into the standard output format:
|
|
|
358
522
|
{
|
|
359
523
|
"entities": {
|
|
360
524
|
"[EntityName]": {
|
|
361
|
-
"purpose": "[From data-concepts.json description]",
|
|
525
|
+
"purpose": "[From requirements/{module}.data-concepts.json description]",
|
|
526
|
+
"isIntegrationEvent": "[true if this is an integration event entity, false otherwise]",
|
|
362
527
|
"dataDependencies": "[Dependencies identified in Step 2]",
|
|
363
528
|
"computationMethod": "[Creation pattern description]",
|
|
364
529
|
"lifecycle": {
|
|
365
530
|
"creation": {
|
|
366
|
-
"type": "[interaction-created | derived | created-with-parent | mutation-derived]",
|
|
531
|
+
"type": "[integration-event | interaction-created | derived | created-with-parent | mutation-derived]",
|
|
367
532
|
"parent": "[Parent entity name if created-with-parent]",
|
|
368
533
|
"creationInteractions": [
|
|
369
534
|
{
|
|
@@ -374,8 +539,8 @@ Transform the analyzed data into the standard output format:
|
|
|
374
539
|
]
|
|
375
540
|
},
|
|
376
541
|
"deletion": {
|
|
377
|
-
"canBeDeleted": "[true/false based on Step 2.2]",
|
|
378
|
-
"deletionType": "[soft-delete | hard-delete | auto-delete]",
|
|
542
|
+
"canBeDeleted": "[true/false based on Step 2.2, always false for integration-event entities]",
|
|
543
|
+
"deletionType": "[soft-delete | hard-delete | auto-delete | none for integration-event]",
|
|
379
544
|
"deletionInteractions": [
|
|
380
545
|
{
|
|
381
546
|
"name": "[Interaction name]",
|
|
@@ -387,8 +552,8 @@ Transform the analyzed data into the standard output format:
|
|
|
387
552
|
},
|
|
388
553
|
"properties": {
|
|
389
554
|
"[propertyName]": {
|
|
390
|
-
"type": "[From data-concepts.json]",
|
|
391
|
-
"purpose": "[From data-concepts.json or inferred]",
|
|
555
|
+
"type": "[From requirements/{module}.data-concepts.json]",
|
|
556
|
+
"purpose": "[From requirements/{module}.data-concepts.json or inferred]",
|
|
392
557
|
"controlType": "[From Step 3.4]",
|
|
393
558
|
"dataDependencies": "[From Step 3.1]",
|
|
394
559
|
"interactionDependencies": "[From Step 3.2]",
|
|
@@ -400,17 +565,17 @@ Transform the analyzed data into the standard output format:
|
|
|
400
565
|
},
|
|
401
566
|
"relations": {
|
|
402
567
|
"[RelationName]": {
|
|
403
|
-
"type": "[From data-concepts.json cardinality]",
|
|
404
|
-
"purpose": "[From data-concepts.json description]",
|
|
405
|
-
"sourceEntity": "[From data-concepts.json]",
|
|
406
|
-
"targetEntity": "[From data-concepts.json]",
|
|
568
|
+
"type": "[From requirements/{module}.data-concepts.json cardinality]",
|
|
569
|
+
"purpose": "[From requirements/{module}.data-concepts.json description]",
|
|
570
|
+
"sourceEntity": "[From requirements/{module}.data-concepts.json]",
|
|
571
|
+
"targetEntity": "[From requirements/{module}.data-concepts.json]",
|
|
407
572
|
"sourceProperty": "[Inferred or specified]",
|
|
408
573
|
"targetProperty": "[Inferred or specified]",
|
|
409
574
|
"dataDependencies": "[Always includes source and target entities]",
|
|
410
575
|
"computationMethod": "[From Step 4.2]",
|
|
411
576
|
"lifecycle": {
|
|
412
577
|
"creation": {
|
|
413
|
-
"type": "[interaction-created | created-with-entity | derived | mutation-derived]",
|
|
578
|
+
"type": "[integration-event | interaction-created | created-with-entity | derived | mutation-derived]",
|
|
414
579
|
"parent": "[If created-with-entity]",
|
|
415
580
|
"creationInteractions": [
|
|
416
581
|
{
|
|
@@ -441,7 +606,7 @@ Transform the analyzed data into the standard output format:
|
|
|
441
606
|
},
|
|
442
607
|
"dictionaries": {
|
|
443
608
|
"[DictionaryName]": {
|
|
444
|
-
"purpose": "[From data-concepts.json description]",
|
|
609
|
+
"purpose": "[From requirements/{module}.data-concepts.json description]",
|
|
445
610
|
"type": "[object with key types]",
|
|
446
611
|
"dataDependencies": "[From Step 5.2]",
|
|
447
612
|
"interactionDependencies": "[From Step 5.2]",
|
|
@@ -551,13 +716,75 @@ Entity created by different interactions with different logic:
|
|
|
551
716
|
}
|
|
552
717
|
```
|
|
553
718
|
|
|
719
|
+
### 6. Integration Event Entity
|
|
720
|
+
Event entity for tracking asynchronous external system responses:
|
|
721
|
+
```json
|
|
722
|
+
"PaymentEvent": {
|
|
723
|
+
"purpose": "Records payment status updates received from Stripe payment gateway",
|
|
724
|
+
"isIntegrationEvent": true,
|
|
725
|
+
"dataDependencies": [],
|
|
726
|
+
"computationMethod": "Created when webhook receives payment status from Stripe",
|
|
727
|
+
"lifecycle": {
|
|
728
|
+
"creation": {
|
|
729
|
+
"type": "integration-event",
|
|
730
|
+
"parent": null,
|
|
731
|
+
"creationInteractions": []
|
|
732
|
+
},
|
|
733
|
+
"deletion": {
|
|
734
|
+
"canBeDeleted": false,
|
|
735
|
+
"deletionType": "none",
|
|
736
|
+
"deletionInteractions": []
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
"properties": {
|
|
740
|
+
"transactionId": {
|
|
741
|
+
"type": "string",
|
|
742
|
+
"purpose": "External payment transaction ID from Stripe",
|
|
743
|
+
"controlType": "creation-only",
|
|
744
|
+
"dataDependencies": [],
|
|
745
|
+
"interactionDependencies": [],
|
|
746
|
+
"computationMethod": "Set from Stripe webhook payload",
|
|
747
|
+
"initialValue": "From external system response"
|
|
748
|
+
},
|
|
749
|
+
"paymentStatus": {
|
|
750
|
+
"type": "string",
|
|
751
|
+
"purpose": "Payment status (success, failed, pending)",
|
|
752
|
+
"controlType": "creation-only",
|
|
753
|
+
"dataDependencies": [],
|
|
754
|
+
"interactionDependencies": [],
|
|
755
|
+
"computationMethod": "Set from Stripe webhook payload",
|
|
756
|
+
"initialValue": "From external system response"
|
|
757
|
+
},
|
|
758
|
+
"timestamp": {
|
|
759
|
+
"type": "date",
|
|
760
|
+
"purpose": "When the payment event was received",
|
|
761
|
+
"controlType": "creation-only",
|
|
762
|
+
"dataDependencies": [],
|
|
763
|
+
"interactionDependencies": [],
|
|
764
|
+
"computationMethod": "Current server timestamp when event is created",
|
|
765
|
+
"initialValue": "now()"
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
Note: Other business entities (like `Order.paymentStatus`, `User.premiumUntil`) should be computed based on these event entities to maintain reactive consistency.
|
|
772
|
+
|
|
554
773
|
## Validation Checklist
|
|
555
774
|
|
|
556
|
-
- [ ]
|
|
557
|
-
- [ ] All
|
|
558
|
-
- [ ] All
|
|
775
|
+
- [ ] Read module name from `.currentmodule` file in project root
|
|
776
|
+
- [ ] All entities from `requirements/{module}.data-concepts.json` are analyzed
|
|
777
|
+
- [ ] All relations from `requirements/{module}.data-concepts.json` are analyzed
|
|
778
|
+
- [ ] All dictionaries from `requirements/{module}.data-concepts.json` are analyzed
|
|
779
|
+
- [ ] Integration event entities identified from `requirements/{module}.integration.json`
|
|
780
|
+
- [ ] Event entities properly marked with `isIntegrationEvent: true`
|
|
781
|
+
- [ ] Event entities have lifecycle.creation.type set to "integration-event"
|
|
782
|
+
- [ ] Event entities have deletion.canBeDeleted set to false
|
|
559
783
|
- [ ] Creation patterns identified for each entity/relation
|
|
560
|
-
- [ ]
|
|
784
|
+
- [ ] **🔴 CRITICAL: For EACH relation, executed the 5-step algorithm in Step 4.2 to determine lifecycle type**
|
|
785
|
+
- [ ] **🔴 CRITICAL: For relations with type "created-with-entity", verified parent field is set correctly**
|
|
786
|
+
- [ ] **🔴 CRITICAL: For relations in same creates array as entities, checked dependencies to identify created-with-entity pattern**
|
|
787
|
+
- [ ] Interaction dependencies found by searching `requirements/{module}.interactions-design.json`
|
|
561
788
|
- [ ] Data dependencies match computed property definitions
|
|
562
789
|
- [ ] Lifecycle patterns are consistent with business logic
|
|
563
790
|
- [ ] Parent-child relationships properly identified
|