@kapeta/local-cluster-service 0.53.3 → 0.53.5
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/CHANGELOG.md +17 -0
- package/dist/cjs/src/storm/codegen.js +8 -1
- package/dist/cjs/src/storm/event-parser.js +35 -9
- package/dist/cjs/src/storm/events.d.ts +9 -1
- package/dist/cjs/test/storm/event-parser.test.js +18 -0
- package/dist/cjs/test/storm/simple-blog-events.json +470 -0
- package/dist/esm/src/storm/codegen.js +8 -1
- package/dist/esm/src/storm/event-parser.js +35 -9
- package/dist/esm/src/storm/events.d.ts +9 -1
- package/dist/esm/test/storm/event-parser.test.js +18 -0
- package/dist/esm/test/storm/simple-blog-events.json +470 -0
- package/package.json +1 -1
- package/src/storm/codegen.ts +8 -1
- package/src/storm/event-parser.ts +39 -11
- package/src/storm/events.ts +11 -1
- package/test/storm/event-parser.test.ts +19 -0
- package/test/storm/simple-blog-events.json +470 -0
- package/tsconfig.json +2 -1
@@ -26,7 +26,7 @@ import {
|
|
26
26
|
DSLAPIParser,
|
27
27
|
DSLController,
|
28
28
|
DSLConverters,
|
29
|
-
DSLDataTypeParser,
|
29
|
+
DSLDataTypeParser, DSLEntityType,
|
30
30
|
DSLMethod,
|
31
31
|
DSLParser,
|
32
32
|
KAPLANG_ID,
|
@@ -324,6 +324,17 @@ export class StormEventParser {
|
|
324
324
|
evt.payload.toBlockId = StormEventParser.toInstanceId(handle, evt.payload.toComponent);
|
325
325
|
this.connections.push(evt.payload);
|
326
326
|
break;
|
327
|
+
case 'API_RETRY':
|
328
|
+
Object.values(this.blocks).forEach((block) => {
|
329
|
+
block.types = [];
|
330
|
+
block.apis = [];
|
331
|
+
});
|
332
|
+
break;
|
333
|
+
case 'MODEL_RETRY':
|
334
|
+
Object.values(this.blocks).forEach((block) => {
|
335
|
+
block.models = [];
|
336
|
+
});
|
337
|
+
break;
|
327
338
|
}
|
328
339
|
|
329
340
|
return this.toResult(handle);
|
@@ -526,7 +537,7 @@ export class StormEventParser {
|
|
526
537
|
|
527
538
|
const blockSpec = blockDefinitionInfo.content.spec;
|
528
539
|
|
529
|
-
|
540
|
+
const apiResources: { [key: string]: Resource | undefined } = {};
|
530
541
|
let dbResource: Resource | undefined = undefined;
|
531
542
|
|
532
543
|
blockInfo.resources.forEach((resource) => {
|
@@ -535,10 +546,7 @@ export class StormEventParser {
|
|
535
546
|
};
|
536
547
|
switch (resource.type) {
|
537
548
|
case 'API':
|
538
|
-
|
539
|
-
break;
|
540
|
-
}
|
541
|
-
apiResource = {
|
549
|
+
const apiResource = {
|
542
550
|
kind: this.toResourceKind(resource.type),
|
543
551
|
metadata: {
|
544
552
|
name: resource.name,
|
@@ -554,6 +562,7 @@ export class StormEventParser {
|
|
554
562
|
} satisfies SourceCode,
|
555
563
|
},
|
556
564
|
};
|
565
|
+
apiResources[resource.name] = apiResource;
|
557
566
|
blockSpec.providers!.push(apiResource);
|
558
567
|
break;
|
559
568
|
case 'CLIENT':
|
@@ -635,11 +644,30 @@ export class StormEventParser {
|
|
635
644
|
}
|
636
645
|
});
|
637
646
|
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
});
|
642
|
-
|
647
|
+
blockInfo.apis.forEach((api) => {
|
648
|
+
const dslApi = DSLAPIParser.parse(api, {
|
649
|
+
ignoreSemantics: true,
|
650
|
+
}) as (DSLMethod | DSLController)[];
|
651
|
+
|
652
|
+
let exactMatch = false;
|
653
|
+
if (dslApi[0] && dslApi[0].type == DSLEntityType.CONTROLLER) {
|
654
|
+
const name = dslApi[0].name.toLowerCase();
|
655
|
+
const apiResourceName = Object.keys(apiResources).find((key) => key.indexOf(name) > -1);
|
656
|
+
if (apiResourceName) {
|
657
|
+
const exactResource = apiResources[apiResourceName];
|
658
|
+
exactResource!.spec.source.value += api + '\n\n';
|
659
|
+
exactMatch = true;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
|
663
|
+
if (!exactMatch) {
|
664
|
+
// if we couldn't place the given api on the exact resource we just park it on the first
|
665
|
+
// available rest resource
|
666
|
+
const firstKey = Object.keys(apiResources)[0];
|
667
|
+
const firstEntry = apiResources[firstKey];
|
668
|
+
firstEntry!.spec.source.value += api + '\n\n';
|
669
|
+
}
|
670
|
+
});
|
643
671
|
|
644
672
|
blockInfo.types.forEach((type) => {
|
645
673
|
blockSpec.entities!.source!.value += type + '\n';
|
package/src/storm/events.ts
CHANGED
@@ -118,6 +118,15 @@ export interface StormEventCreateDSLResource extends Omit<StormEventCreateDSL, '
|
|
118
118
|
};
|
119
119
|
}
|
120
120
|
|
121
|
+
export interface StormEventCreateDSLRetry {
|
122
|
+
type: 'API_RETRY' | 'MODEL_RETRY';
|
123
|
+
reason: string;
|
124
|
+
created: number;
|
125
|
+
payload: {
|
126
|
+
error: string[];
|
127
|
+
};
|
128
|
+
}
|
129
|
+
|
121
130
|
export interface StormEventError {
|
122
131
|
type: 'INVALID_RESPONSE' | 'ERROR_INTERNAL';
|
123
132
|
reason: string;
|
@@ -320,4 +329,5 @@ export type StormEvent =
|
|
320
329
|
| StormEventErrorDetails
|
321
330
|
| StormEventBlockReady
|
322
331
|
| StormEventPhases
|
323
|
-
| StormEventBlockStatus
|
332
|
+
| StormEventBlockStatus
|
333
|
+
| StormEventCreateDSLRetry;
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
import { StormEventParser } from '../../src/storm/event-parser';
|
7
7
|
import { StormEvent } from '../../src/storm/events';
|
8
|
+
import simpleBlogEvents from './simple-blog-events.json';
|
8
9
|
|
9
10
|
const parserOptions = {
|
10
11
|
serviceKind: 'kapeta/block-service:local',
|
@@ -179,4 +180,22 @@ describe('event-parser', () => {
|
|
179
180
|
expect(result.plan.spec.connections[0].provider.blockId).toBe(serviceBlockInstance.id);
|
180
181
|
expect(result.plan.spec.connections[0].provider.resourceName).toBe(apiResource?.metadata.name);
|
181
182
|
});
|
183
|
+
|
184
|
+
it('it will split api into correct provider', () => {
|
185
|
+
const events = simpleBlogEvents as StormEvent[];
|
186
|
+
const parser = new StormEventParser(parserOptions);
|
187
|
+
events.forEach((event) => parser.processEvent('kapeta', event));
|
188
|
+
|
189
|
+
const result = parser.toResult('kapeta');
|
190
|
+
|
191
|
+
const blogService = result.blocks.find((block) => block.aiName === 'blog-service');
|
192
|
+
expect(blogService).toBeDefined();
|
193
|
+
expect(blogService?.content).toBeDefined();
|
194
|
+
|
195
|
+
const apiProviders = blogService?.content?.spec?.providers?.filter((provider) => provider.kind === 'kapeta/block-type-api:local');
|
196
|
+
expect(apiProviders).toBeDefined();
|
197
|
+
expect(apiProviders!.length).toBe(2);
|
198
|
+
expect(apiProviders!["0"].spec.source.value).not.toBe('');
|
199
|
+
expect(apiProviders!["1"].spec.source.value).not.toBe('');
|
200
|
+
});
|
182
201
|
});
|
@@ -0,0 +1,470 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "MODEL_RESPONSE",
|
4
|
+
"reason": "",
|
5
|
+
"payload": {
|
6
|
+
"text": "Certainly! Here's how you can design a simple blog system. It will consist of a backend block for managing posts and users, a frontend block for displaying the blog, and a gateway block for making the blog publicly accessible."
|
7
|
+
},
|
8
|
+
"created": 1718365003668
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"type": "CREATE_PLAN_PROPERTIES",
|
12
|
+
"reason": "Define the properties for the plan itself",
|
13
|
+
"payload": {
|
14
|
+
"description": "A simple blog system with a backend for managing posts and users, a frontend for displaying the blog, and a gateway for making the blog publicly accessible.",
|
15
|
+
"name": "Simple Blog"
|
16
|
+
},
|
17
|
+
"created": 1718365004184
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "CREATE_BLOCK",
|
21
|
+
"reason": "The system needs a backend to handle posts and users",
|
22
|
+
"payload": {
|
23
|
+
"description": "Handles posts and users",
|
24
|
+
"name": "blog-service",
|
25
|
+
"resources": [
|
26
|
+
{
|
27
|
+
"description": "Stores blog posts",
|
28
|
+
"name": "posts",
|
29
|
+
"type": "DATABASE"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"description": "Stores user information",
|
33
|
+
"name": "users",
|
34
|
+
"type": "DATABASE"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"description": "Handles blog posts",
|
38
|
+
"name": "posts",
|
39
|
+
"type": "API"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"description": "Handles user information",
|
43
|
+
"name": "users",
|
44
|
+
"type": "API"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"description": "Handles JWT token generation and validation",
|
48
|
+
"name": "jwt-provider",
|
49
|
+
"type": "JWTPROVIDER"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"description": "Sends emails for user registration and password reset",
|
53
|
+
"name": "smtp-client",
|
54
|
+
"type": "SMTPCLIENT"
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"type": "BACKEND",
|
58
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
59
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
60
|
+
},
|
61
|
+
"created": 1718365005843
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"type": "CREATE_BLOCK",
|
65
|
+
"reason": "The system needs a frontend to display the blog",
|
66
|
+
"payload": {
|
67
|
+
"description": "Displays the blog",
|
68
|
+
"name": "blog-ui",
|
69
|
+
"resources": [
|
70
|
+
{
|
71
|
+
"description": "Fetches blog posts from the backend",
|
72
|
+
"name": "posts",
|
73
|
+
"type": "CLIENT"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"description": "Handles user authentication and registration",
|
77
|
+
"name": "users",
|
78
|
+
"type": "CLIENT"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"description": "Displays the main page of the blog",
|
82
|
+
"name": "main",
|
83
|
+
"type": "WEBPAGE"
|
84
|
+
}
|
85
|
+
],
|
86
|
+
"type": "FRONTEND",
|
87
|
+
"blockRef": "kapeta://kapeta/blog-ui:local",
|
88
|
+
"instanceId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
89
|
+
},
|
90
|
+
"created": 1718365006823
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"type": "CREATE_BLOCK",
|
94
|
+
"reason": "The system needs a gateway to make the blog publicly accessible",
|
95
|
+
"payload": {
|
96
|
+
"description": "Makes the blog publicly accessible",
|
97
|
+
"name": "gateway",
|
98
|
+
"resources": [
|
99
|
+
{
|
100
|
+
"description": "Makes the posts API public under '/posts' path",
|
101
|
+
"name": "posts",
|
102
|
+
"path": "/posts",
|
103
|
+
"type": "CLIENT"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"description": "Makes the main page public under '/' path",
|
107
|
+
"name": "main",
|
108
|
+
"path": "/",
|
109
|
+
"type": "WEBFRAGMENT"
|
110
|
+
}
|
111
|
+
],
|
112
|
+
"type": "GATEWAY",
|
113
|
+
"blockRef": "kapeta://kapeta/gateway:local",
|
114
|
+
"instanceId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
115
|
+
},
|
116
|
+
"created": 1718365007689
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"type": "CREATE_CONNECTION",
|
120
|
+
"reason": "The frontend needs to fetch blog posts from the backend",
|
121
|
+
"payload": {
|
122
|
+
"fromComponent": "blog-service",
|
123
|
+
"fromResource": "posts",
|
124
|
+
"fromResourceType": "API",
|
125
|
+
"toComponent": "blog-ui",
|
126
|
+
"toResource": "posts",
|
127
|
+
"toResourceType": "CLIENT",
|
128
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
129
|
+
"toBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
130
|
+
},
|
131
|
+
"created": 1718365008108
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"type": "CREATE_CONNECTION",
|
135
|
+
"reason": "The frontend needs to handle user authentication and registration",
|
136
|
+
"payload": {
|
137
|
+
"fromComponent": "blog-service",
|
138
|
+
"fromResource": "users",
|
139
|
+
"fromResourceType": "API",
|
140
|
+
"toComponent": "blog-ui",
|
141
|
+
"toResource": "users",
|
142
|
+
"toResourceType": "CLIENT",
|
143
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
144
|
+
"toBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
145
|
+
},
|
146
|
+
"created": 1718365008526
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"type": "CREATE_CONNECTION",
|
150
|
+
"reason": "The gateway needs to make the posts API publicly accessible",
|
151
|
+
"payload": {
|
152
|
+
"fromComponent": "blog-service",
|
153
|
+
"fromResource": "posts",
|
154
|
+
"fromResourceType": "API",
|
155
|
+
"toComponent": "gateway",
|
156
|
+
"toResource": "posts",
|
157
|
+
"toResourceType": "CLIENT",
|
158
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
159
|
+
"toBlockId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
160
|
+
},
|
161
|
+
"created": 1718365008990
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"type": "CREATE_CONNECTION",
|
165
|
+
"reason": "The gateway needs to make the main page publicly accessible",
|
166
|
+
"payload": {
|
167
|
+
"fromComponent": "blog-ui",
|
168
|
+
"fromResource": "main",
|
169
|
+
"fromResourceType": "WEBPAGE",
|
170
|
+
"toComponent": "gateway",
|
171
|
+
"toResource": "main",
|
172
|
+
"toResourceType": "WEBFRAGMENT",
|
173
|
+
"fromBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d",
|
174
|
+
"toBlockId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
175
|
+
},
|
176
|
+
"created": 1718365009823
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"type": "CREATE_CONNECTION",
|
180
|
+
"reason": "The blog service needs to be able to authenticate requests",
|
181
|
+
"payload": {
|
182
|
+
"fromComponent": "blog-service",
|
183
|
+
"fromResource": "jwt-provider",
|
184
|
+
"fromResourceType": "JWTPROVIDER",
|
185
|
+
"toComponent": "blog-service",
|
186
|
+
"toResource": "jwt-consumer",
|
187
|
+
"toResourceType": "JWTCONSUMER",
|
188
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
189
|
+
"toBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
190
|
+
},
|
191
|
+
"created": 1718365009974
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"type": "PLAN_RETRY",
|
195
|
+
"reason": "Found issues in the response but will try again",
|
196
|
+
"payload": {
|
197
|
+
"agent": "plan",
|
198
|
+
"errors": [
|
199
|
+
"Resource jwt-consumer is not defined for component blog-service in connection: 'blog-service.jwt-provider.JWTPROVIDER' to 'blog-service.jwt-consumer.JWTCONSUMER'"
|
200
|
+
]
|
201
|
+
},
|
202
|
+
"created": 1718365010012
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"type": "MODEL_RESPONSE",
|
206
|
+
"reason": "",
|
207
|
+
"payload": {
|
208
|
+
"text": "Certainly! Here's how you can design a simple blog system. It will consist of a backend block for managing posts and users, a frontend block for displaying the blog, and a gateway block for making the blog publicly accessible."
|
209
|
+
},
|
210
|
+
"created": 1718365011059
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"type": "CREATE_PLAN_PROPERTIES",
|
214
|
+
"reason": "Define the properties for the plan itself",
|
215
|
+
"payload": {
|
216
|
+
"description": "A simple blog system with a backend for managing posts and users, a frontend for displaying the blog, and a gateway for making the blog publicly accessible.",
|
217
|
+
"name": "Simple Blog"
|
218
|
+
},
|
219
|
+
"created": 1718365011625
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"type": "CREATE_BLOCK",
|
223
|
+
"reason": "The system needs a backend to handle posts and users",
|
224
|
+
"payload": {
|
225
|
+
"description": "Handles posts and users",
|
226
|
+
"name": "blog-service",
|
227
|
+
"resources": [
|
228
|
+
{
|
229
|
+
"description": "Stores blog posts",
|
230
|
+
"name": "posts",
|
231
|
+
"type": "DATABASE"
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"description": "Stores user information",
|
235
|
+
"name": "users",
|
236
|
+
"type": "DATABASE"
|
237
|
+
},
|
238
|
+
{
|
239
|
+
"description": "Handles blog posts",
|
240
|
+
"name": "posts",
|
241
|
+
"type": "API"
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"description": "Handles user information",
|
245
|
+
"name": "users",
|
246
|
+
"type": "API"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"description": "Handles JWT token generation and validation",
|
250
|
+
"name": "jwt-provider",
|
251
|
+
"type": "JWTPROVIDER"
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"description": "Handles JWT token validation",
|
255
|
+
"name": "jwt-consumer",
|
256
|
+
"type": "JWTCONSUMER"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"description": "Sends emails for user registration and password reset",
|
260
|
+
"name": "smtp-client",
|
261
|
+
"type": "SMTPCLIENT"
|
262
|
+
}
|
263
|
+
],
|
264
|
+
"type": "BACKEND",
|
265
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
266
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
267
|
+
},
|
268
|
+
"created": 1718365013238
|
269
|
+
},
|
270
|
+
{
|
271
|
+
"type": "CREATE_BLOCK",
|
272
|
+
"reason": "The system needs a frontend to display the blog",
|
273
|
+
"payload": {
|
274
|
+
"description": "Displays the blog",
|
275
|
+
"name": "blog-ui",
|
276
|
+
"resources": [
|
277
|
+
{
|
278
|
+
"description": "Fetches blog posts from the backend",
|
279
|
+
"name": "posts",
|
280
|
+
"type": "CLIENT"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"description": "Handles user authentication and registration",
|
284
|
+
"name": "users",
|
285
|
+
"type": "CLIENT"
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"description": "Displays the main page of the blog",
|
289
|
+
"name": "main",
|
290
|
+
"type": "WEBPAGE"
|
291
|
+
}
|
292
|
+
],
|
293
|
+
"type": "FRONTEND",
|
294
|
+
"blockRef": "kapeta://kapeta/blog-ui:local",
|
295
|
+
"instanceId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
296
|
+
},
|
297
|
+
"created": 1718365014077
|
298
|
+
},
|
299
|
+
{
|
300
|
+
"type": "CREATE_BLOCK",
|
301
|
+
"reason": "The system needs a gateway to make the blog publicly accessible",
|
302
|
+
"payload": {
|
303
|
+
"description": "Makes the blog publicly accessible",
|
304
|
+
"name": "gateway",
|
305
|
+
"resources": [
|
306
|
+
{
|
307
|
+
"description": "Makes the posts API public under '/posts' path",
|
308
|
+
"name": "posts",
|
309
|
+
"path": "/posts",
|
310
|
+
"type": "CLIENT"
|
311
|
+
},
|
312
|
+
{
|
313
|
+
"description": "Makes the main page public under '/' path",
|
314
|
+
"name": "main",
|
315
|
+
"path": "/",
|
316
|
+
"type": "WEBFRAGMENT"
|
317
|
+
}
|
318
|
+
],
|
319
|
+
"type": "GATEWAY",
|
320
|
+
"blockRef": "kapeta://kapeta/gateway:local",
|
321
|
+
"instanceId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
322
|
+
},
|
323
|
+
"created": 1718365015029
|
324
|
+
},
|
325
|
+
{
|
326
|
+
"type": "CREATE_CONNECTION",
|
327
|
+
"reason": "The frontend needs to fetch blog posts from the backend",
|
328
|
+
"payload": {
|
329
|
+
"fromComponent": "blog-service",
|
330
|
+
"fromResource": "posts",
|
331
|
+
"fromResourceType": "API",
|
332
|
+
"toComponent": "blog-ui",
|
333
|
+
"toResource": "posts",
|
334
|
+
"toResourceType": "CLIENT",
|
335
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
336
|
+
"toBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
337
|
+
},
|
338
|
+
"created": 1718365015463
|
339
|
+
},
|
340
|
+
{
|
341
|
+
"type": "CREATE_CONNECTION",
|
342
|
+
"reason": "The frontend needs to handle user authentication and registration",
|
343
|
+
"payload": {
|
344
|
+
"fromComponent": "blog-service",
|
345
|
+
"fromResource": "users",
|
346
|
+
"fromResourceType": "API",
|
347
|
+
"toComponent": "blog-ui",
|
348
|
+
"toResource": "users",
|
349
|
+
"toResourceType": "CLIENT",
|
350
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
351
|
+
"toBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d"
|
352
|
+
},
|
353
|
+
"created": 1718365016463
|
354
|
+
},
|
355
|
+
{
|
356
|
+
"type": "CREATE_CONNECTION",
|
357
|
+
"reason": "The gateway needs to make the posts API publicly accessible",
|
358
|
+
"payload": {
|
359
|
+
"fromComponent": "blog-service",
|
360
|
+
"fromResource": "posts",
|
361
|
+
"fromResourceType": "API",
|
362
|
+
"toComponent": "gateway",
|
363
|
+
"toResource": "posts",
|
364
|
+
"toResourceType": "CLIENT",
|
365
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
366
|
+
"toBlockId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
367
|
+
},
|
368
|
+
"created": 1718365016884
|
369
|
+
},
|
370
|
+
{
|
371
|
+
"type": "CREATE_CONNECTION",
|
372
|
+
"reason": "The gateway needs to make the main page publicly accessible",
|
373
|
+
"payload": {
|
374
|
+
"fromComponent": "blog-ui",
|
375
|
+
"fromResource": "main",
|
376
|
+
"fromResourceType": "WEBPAGE",
|
377
|
+
"toComponent": "gateway",
|
378
|
+
"toResource": "main",
|
379
|
+
"toResourceType": "WEBFRAGMENT",
|
380
|
+
"fromBlockId": "79761687-1528-5f8f-8036-b8d49e23b49d",
|
381
|
+
"toBlockId": "f7327a25-7fc2-57b6-99e6-1b7e07378790"
|
382
|
+
},
|
383
|
+
"created": 1718365017299
|
384
|
+
},
|
385
|
+
{
|
386
|
+
"type": "CREATE_CONNECTION",
|
387
|
+
"reason": "The blog service needs to be able to authenticate requests",
|
388
|
+
"payload": {
|
389
|
+
"fromComponent": "blog-service",
|
390
|
+
"fromResource": "jwt-provider",
|
391
|
+
"fromResourceType": "JWTPROVIDER",
|
392
|
+
"toComponent": "blog-service",
|
393
|
+
"toResource": "jwt-consumer",
|
394
|
+
"toResourceType": "JWTCONSUMER",
|
395
|
+
"fromBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
396
|
+
"toBlockId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
397
|
+
},
|
398
|
+
"created": 1718365017692
|
399
|
+
},
|
400
|
+
{
|
401
|
+
"type": "CREATE_TYPE",
|
402
|
+
"reason": "",
|
403
|
+
"payload": {
|
404
|
+
"blockName": "blog-service",
|
405
|
+
"content": "type Post {\n\tid: string\n\ttitle: string\n\tcontent: string\n\tauthorId: string\n\tcreatedAt: date\n\tupdatedAt: date\n}",
|
406
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
407
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
408
|
+
},
|
409
|
+
"created": 1718365018773
|
410
|
+
},
|
411
|
+
{
|
412
|
+
"type": "CREATE_TYPE",
|
413
|
+
"reason": "",
|
414
|
+
"payload": {
|
415
|
+
"blockName": "blog-service",
|
416
|
+
"content": "type User {\n\tid: string\n\tusername: string\n\temail: string\n\tpassword: string\n\tcreatedAt: date\n\tupdatedAt: date\n}",
|
417
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
418
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b"
|
419
|
+
},
|
420
|
+
"created": 1718365019329
|
421
|
+
},
|
422
|
+
{
|
423
|
+
"type": "CREATE_API",
|
424
|
+
"reason": "",
|
425
|
+
"payload": {
|
426
|
+
"blockName": "blog-service",
|
427
|
+
"content": "controller Post(\"/posts\") {\n\n\t@GET(\"/\")\n\tgetPosts():Post[]\n\t\n\t@GET(\"/{id}\")\n\tgetPost(@Path(\"id\") id:string):Post\n\t\n\t@POST(\"/\")\n\tcreatePost(@Body post:Post):Post\n\t\n\t@PUT(\"/{id}\")\n\tupdatePost(@Path(\"id\") id:string, @Body post:Post):Post\n\t\n\t@DELETE(\"/{id}\")\n\tdeletePost(@Path(\"id\") id:string):void\n}",
|
428
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
429
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
430
|
+
"resourceName": "posts"
|
431
|
+
},
|
432
|
+
"created": 1718365020235
|
433
|
+
},
|
434
|
+
{
|
435
|
+
"type": "CREATE_API",
|
436
|
+
"reason": "",
|
437
|
+
"payload": {
|
438
|
+
"blockName": "blog-service",
|
439
|
+
"content": "controller User(\"/users\") {\n\n\t@GET(\"/\")\n\tgetUsers():User[]\n\t\n\t@GET(\"/{id}\")\n\tgetUser(@Path(\"id\") id:string):User\n\t\n\t@POST(\"/\")\n\tcreateUser(@Body user:User):User\n\t\n\t@PUT(\"/{id}\")\n\tupdateUser(@Path(\"id\") id:string, @Body user:User):User\n\t\n\t@DELETE(\"/{id}\")\n\tdeleteUser(@Path(\"id\") id:string):void\n}",
|
440
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
441
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
442
|
+
"resourceName": "posts"
|
443
|
+
},
|
444
|
+
"created": 1718365020558
|
445
|
+
},
|
446
|
+
{
|
447
|
+
"type": "CREATE_MODEL",
|
448
|
+
"reason": "",
|
449
|
+
"payload": {
|
450
|
+
"blockName": "blog-service",
|
451
|
+
"content": "type Post {\n\t@Id\n\tid: string\n\ttitle: string\n\tcontent: string\n\tauthorId: string\n\tcreatedAt: date\n\tupdatedAt: date\n}",
|
452
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
453
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
454
|
+
"resourceName": "posts"
|
455
|
+
},
|
456
|
+
"created": 1718365022396
|
457
|
+
},
|
458
|
+
{
|
459
|
+
"type": "CREATE_MODEL",
|
460
|
+
"reason": "",
|
461
|
+
"payload": {
|
462
|
+
"blockName": "blog-service",
|
463
|
+
"content": "type User {\n\t@Id\n\tid: string\n\tusername: string\n\temail: string\n\tpassword: string\n\tcreatedAt: date\n\tupdatedAt: date\n}",
|
464
|
+
"blockRef": "kapeta://kapeta/blog-service:local",
|
465
|
+
"instanceId": "d8d25816-bb83-5797-9881-a6282fe7a20b",
|
466
|
+
"resourceName": "posts"
|
467
|
+
},
|
468
|
+
"created": 1718365022826
|
469
|
+
}
|
470
|
+
]
|