@kapeta/local-cluster-service 0.51.0 → 0.51.1
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 +7 -0
- package/dist/cjs/src/storm/codegen.js +2 -0
- package/dist/cjs/src/storm/events.d.ts +10 -4
- package/dist/esm/src/storm/codegen.js +2 -0
- package/dist/esm/src/storm/events.d.ts +10 -4
- package/package.json +1 -1
- package/src/storm/codegen.ts +9 -7
- package/src/storm/events.ts +11 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.51.1](https://github.com/kapetacom/local-cluster-service/compare/v0.51.0...v0.51.1) (2024-06-05)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Add line numbers to chunks ([a60688e](https://github.com/kapetacom/local-cluster-service/commit/a60688e0341238160c6779ae43cae876a62e622d))
|
7
|
+
|
1
8
|
# [0.51.0](https://github.com/kapetacom/local-cluster-service/compare/v0.50.0...v0.51.0) (2024-06-05)
|
2
9
|
|
3
10
|
|
@@ -66,6 +66,7 @@ class SimulatedFileDelay {
|
|
66
66
|
});
|
67
67
|
const lines = this.file.payload.content.split('\n');
|
68
68
|
const delayPerLine = SIMULATED_DELAY / lines.length;
|
69
|
+
let lineNumber = 0;
|
69
70
|
for (const line of lines) {
|
70
71
|
await new Promise((resolve) => {
|
71
72
|
setTimeout(() => {
|
@@ -76,6 +77,7 @@ class SimulatedFileDelay {
|
|
76
77
|
payload: {
|
77
78
|
...commonPayload,
|
78
79
|
content: line,
|
80
|
+
lineNumber: lineNumber++,
|
79
81
|
},
|
80
82
|
});
|
81
83
|
resolve();
|
@@ -172,13 +172,19 @@ export interface StormEventFileState extends StormEventFileBase {
|
|
172
172
|
state: string;
|
173
173
|
};
|
174
174
|
}
|
175
|
-
export interface
|
176
|
-
type: 'FILE_DONE'
|
175
|
+
export interface StormEventFileDone extends StormEventFileBase {
|
176
|
+
type: 'FILE_DONE';
|
177
177
|
payload: StormEventFileBasePayload & {
|
178
178
|
content: string;
|
179
179
|
};
|
180
180
|
}
|
181
|
-
export
|
181
|
+
export interface StormEventFileChunk extends StormEventFileBase {
|
182
|
+
type: 'FILE_CHUNK';
|
183
|
+
payload: StormEventFileBasePayload & {
|
184
|
+
content: string;
|
185
|
+
lineNumber: number;
|
186
|
+
};
|
187
|
+
}
|
182
188
|
export interface StormEventBlockReady {
|
183
189
|
type: 'BLOCK_READY';
|
184
190
|
reason: string;
|
@@ -212,4 +218,4 @@ export interface StormEventPhases {
|
|
212
218
|
phaseType: StormEventPhaseType;
|
213
219
|
};
|
214
220
|
}
|
215
|
-
export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState |
|
221
|
+
export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventBlockReady | StormEventPhases;
|
@@ -66,6 +66,7 @@ class SimulatedFileDelay {
|
|
66
66
|
});
|
67
67
|
const lines = this.file.payload.content.split('\n');
|
68
68
|
const delayPerLine = SIMULATED_DELAY / lines.length;
|
69
|
+
let lineNumber = 0;
|
69
70
|
for (const line of lines) {
|
70
71
|
await new Promise((resolve) => {
|
71
72
|
setTimeout(() => {
|
@@ -76,6 +77,7 @@ class SimulatedFileDelay {
|
|
76
77
|
payload: {
|
77
78
|
...commonPayload,
|
78
79
|
content: line,
|
80
|
+
lineNumber: lineNumber++,
|
79
81
|
},
|
80
82
|
});
|
81
83
|
resolve();
|
@@ -172,13 +172,19 @@ export interface StormEventFileState extends StormEventFileBase {
|
|
172
172
|
state: string;
|
173
173
|
};
|
174
174
|
}
|
175
|
-
export interface
|
176
|
-
type: 'FILE_DONE'
|
175
|
+
export interface StormEventFileDone extends StormEventFileBase {
|
176
|
+
type: 'FILE_DONE';
|
177
177
|
payload: StormEventFileBasePayload & {
|
178
178
|
content: string;
|
179
179
|
};
|
180
180
|
}
|
181
|
-
export
|
181
|
+
export interface StormEventFileChunk extends StormEventFileBase {
|
182
|
+
type: 'FILE_CHUNK';
|
183
|
+
payload: StormEventFileBasePayload & {
|
184
|
+
content: string;
|
185
|
+
lineNumber: number;
|
186
|
+
};
|
187
|
+
}
|
182
188
|
export interface StormEventBlockReady {
|
183
189
|
type: 'BLOCK_READY';
|
184
190
|
reason: string;
|
@@ -212,4 +218,4 @@ export interface StormEventPhases {
|
|
212
218
|
phaseType: StormEventPhaseType;
|
213
219
|
};
|
214
220
|
}
|
215
|
-
export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState |
|
221
|
+
export type StormEvent = StormEventCreateBlock | StormEventCreateConnection | StormEventCreatePlanProperties | StormEventInvalidResponse | StormEventPlanRetry | StormEventCreateDSL | StormEventCreateDSLResource | StormEventError | StormEventScreen | StormEventScreenCandidate | StormEventFileLogical | StormEventFileState | StormEventFileDone | StormEventFileChunk | StormEventDone | StormEventDefinitionChange | StormEventErrorClassifier | StormEventCodeFix | StormEventBlockReady | StormEventPhases;
|
package/package.json
CHANGED
package/src/storm/codegen.ts
CHANGED
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
import { BlockDefinition } from '@kapeta/schemas';
|
16
16
|
import { codeGeneratorManager } from '../codeGeneratorManager';
|
17
17
|
import { STORM_ID, stormClient } from './stormClient';
|
18
|
-
import { StormEvent,
|
18
|
+
import { StormEvent, StormEventFileChunk, StormEventFileDone, StormEventFileLogical } from './events';
|
19
19
|
import { BlockDefinitionInfo, StormEventParser } from './event-parser';
|
20
20
|
import { StormFileImplementationPrompt, StormFileInfo, StormStream } from './stream';
|
21
21
|
import { KapetaURI, parseKapetaUri } from '@kapeta/nodejs-utils';
|
@@ -30,9 +30,9 @@ type ImplementationGenerator = (prompt: StormFileImplementationPrompt, conversat
|
|
30
30
|
const SIMULATED_DELAY = 1000;
|
31
31
|
|
32
32
|
class SimulatedFileDelay {
|
33
|
-
private readonly file:
|
33
|
+
private readonly file: StormEventFileDone;
|
34
34
|
public readonly stream;
|
35
|
-
constructor(file:
|
35
|
+
constructor(file: StormEventFileDone, stream: StormStream) {
|
36
36
|
this.file = file;
|
37
37
|
this.stream = stream;
|
38
38
|
}
|
@@ -54,6 +54,7 @@ class SimulatedFileDelay {
|
|
54
54
|
|
55
55
|
const lines = this.file.payload.content.split('\n');
|
56
56
|
const delayPerLine = SIMULATED_DELAY / lines.length;
|
57
|
+
let lineNumber = 0;
|
57
58
|
for (const line of lines) {
|
58
59
|
await new Promise<void>((resolve) => {
|
59
60
|
setTimeout(() => {
|
@@ -64,8 +65,9 @@ class SimulatedFileDelay {
|
|
64
65
|
payload: {
|
65
66
|
...commonPayload,
|
66
67
|
content: line,
|
68
|
+
lineNumber: lineNumber++,
|
67
69
|
},
|
68
|
-
} satisfies
|
70
|
+
} satisfies StormEventFileChunk);
|
69
71
|
resolve();
|
70
72
|
}, delayPerLine);
|
71
73
|
});
|
@@ -250,7 +252,7 @@ export class StormCodegen {
|
|
250
252
|
blockRef: ref,
|
251
253
|
instanceId: StormEventParser.toInstanceIdFromRef(ref),
|
252
254
|
},
|
253
|
-
} as
|
255
|
+
} as StormEventFileDone;
|
254
256
|
}
|
255
257
|
}
|
256
258
|
|
@@ -486,7 +488,7 @@ export class StormCodegen {
|
|
486
488
|
|
487
489
|
const basePath = this.getBasePath(uri.fullName);
|
488
490
|
const ref = uri.toNormalizedString();
|
489
|
-
const fileEvent:
|
491
|
+
const fileEvent: StormEventFileDone = {
|
490
492
|
type: 'FILE_DONE',
|
491
493
|
reason: 'File generated',
|
492
494
|
created: Date.now(),
|
@@ -526,7 +528,7 @@ export class StormCodegen {
|
|
526
528
|
blockRef: ref,
|
527
529
|
instanceId: StormEventParser.toInstanceIdFromRef(ref),
|
528
530
|
},
|
529
|
-
} satisfies
|
531
|
+
} satisfies StormEventFileDone);
|
530
532
|
}
|
531
533
|
|
532
534
|
/**
|
package/src/storm/events.ts
CHANGED
@@ -208,14 +208,20 @@ export interface StormEventFileState extends StormEventFileBase {
|
|
208
208
|
};
|
209
209
|
}
|
210
210
|
|
211
|
-
export interface
|
212
|
-
type: 'FILE_DONE'
|
211
|
+
export interface StormEventFileDone extends StormEventFileBase {
|
212
|
+
type: 'FILE_DONE';
|
213
213
|
payload: StormEventFileBasePayload & {
|
214
214
|
content: string;
|
215
215
|
};
|
216
216
|
}
|
217
217
|
|
218
|
-
export
|
218
|
+
export interface StormEventFileChunk extends StormEventFileBase {
|
219
|
+
type: 'FILE_CHUNK';
|
220
|
+
payload: StormEventFileBasePayload & {
|
221
|
+
content: string;
|
222
|
+
lineNumber: number;
|
223
|
+
};
|
224
|
+
}
|
219
225
|
|
220
226
|
export interface StormEventBlockReady {
|
221
227
|
type: 'BLOCK_READY';
|
@@ -268,7 +274,8 @@ export type StormEvent =
|
|
268
274
|
| StormEventScreenCandidate
|
269
275
|
| StormEventFileLogical
|
270
276
|
| StormEventFileState
|
271
|
-
|
|
277
|
+
| StormEventFileDone
|
278
|
+
| StormEventFileChunk
|
272
279
|
| StormEventDone
|
273
280
|
| StormEventDefinitionChange
|
274
281
|
| StormEventErrorClassifier
|