@kapeta/local-cluster-service 0.51.2 → 0.51.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/CHANGELOG.md +14 -0
- package/dist/cjs/src/storm/event-parser.js +2 -2
- package/dist/cjs/src/storm/routes.js +7 -6
- package/dist/esm/src/storm/event-parser.js +2 -2
- package/dist/esm/src/storm/routes.js +7 -6
- package/package.json +1 -1
- package/src/storm/codegen.ts +1 -1
- package/src/storm/event-parser.ts +2 -2
- package/src/storm/routes.ts +7 -7
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [0.51.4](https://github.com/kapetacom/local-cluster-service/compare/v0.51.3...v0.51.4) (2024-06-10)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* handle asset renames during block create [CORE-3032] ([#170](https://github.com/kapetacom/local-cluster-service/issues/170)) ([c01c6a8](https://github.com/kapetacom/local-cluster-service/commit/c01c6a8dd3b3cc36f804cb58dd54e0b8cf90ff88))
|
7
|
+
|
8
|
+
## [0.51.3](https://github.com/kapetacom/local-cluster-service/compare/v0.51.2...v0.51.3) (2024-06-07)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* ignore semantics ([06a4e60](https://github.com/kapetacom/local-cluster-service/commit/06a4e608ecacc7b7d47145c55617a62f75012dd7))
|
14
|
+
|
1
15
|
## [0.51.2](https://github.com/kapetacom/local-cluster-service/compare/v0.51.1...v0.51.2) (2024-06-06)
|
2
16
|
|
3
17
|
|
@@ -291,8 +291,8 @@ class StormEventParser {
|
|
291
291
|
},
|
292
292
|
};
|
293
293
|
}
|
294
|
-
const clientTypes = kaplang_core_1.DSLDataTypeParser.parse(clientConsumerBlock.content.spec.entities.source.value);
|
295
|
-
const apiTypes = kaplang_core_1.DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value);
|
294
|
+
const clientTypes = kaplang_core_1.DSLDataTypeParser.parse(clientConsumerBlock.content.spec.entities.source.value, { ignoreSemantics: true });
|
295
|
+
const apiTypes = kaplang_core_1.DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value, { ignoreSemantics: true });
|
296
296
|
apiTypes.forEach((apiType) => {
|
297
297
|
if (clientTypes.some((clientType) => clientType.name === apiType.name)) {
|
298
298
|
// Already exists
|
@@ -109,18 +109,19 @@ router.post('/block/create', async (req, res) => {
|
|
109
109
|
const createRequest = JSON.parse(req.stringBody ?? '{}');
|
110
110
|
try {
|
111
111
|
const ymlPath = path_1.default.join(createRequest.newPath, 'kapeta.yml');
|
112
|
-
const
|
113
|
-
|
112
|
+
const isExisting = await fs_extra_1.default.pathExists(createRequest.tmpPath);
|
113
|
+
// The tmp folder might have a different name, so we need to update the asset after moving it over
|
114
|
+
if (isExisting) {
|
115
|
+
await fs_extra_1.default.remove(`${createRequest.tmpPath}/kapeta.yml`);
|
114
116
|
await fs_extra_1.default.move(createRequest.tmpPath, createRequest.newPath, {
|
115
117
|
overwrite: true,
|
116
118
|
});
|
117
|
-
res.send(await assetManager_1.assetManager.updateAsset(asset.ref, createRequest.definition));
|
118
|
-
}
|
119
|
-
else {
|
120
|
-
res.send(asset);
|
121
119
|
}
|
120
|
+
const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition);
|
121
|
+
res.send(asset);
|
122
122
|
}
|
123
123
|
catch (err) {
|
124
|
+
console.error('err');
|
124
125
|
res.status(500).send({ error: err.message });
|
125
126
|
}
|
126
127
|
});
|
@@ -291,8 +291,8 @@ class StormEventParser {
|
|
291
291
|
},
|
292
292
|
};
|
293
293
|
}
|
294
|
-
const clientTypes = kaplang_core_1.DSLDataTypeParser.parse(clientConsumerBlock.content.spec.entities.source.value);
|
295
|
-
const apiTypes = kaplang_core_1.DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value);
|
294
|
+
const clientTypes = kaplang_core_1.DSLDataTypeParser.parse(clientConsumerBlock.content.spec.entities.source.value, { ignoreSemantics: true });
|
295
|
+
const apiTypes = kaplang_core_1.DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value, { ignoreSemantics: true });
|
296
296
|
apiTypes.forEach((apiType) => {
|
297
297
|
if (clientTypes.some((clientType) => clientType.name === apiType.name)) {
|
298
298
|
// Already exists
|
@@ -109,18 +109,19 @@ router.post('/block/create', async (req, res) => {
|
|
109
109
|
const createRequest = JSON.parse(req.stringBody ?? '{}');
|
110
110
|
try {
|
111
111
|
const ymlPath = path_1.default.join(createRequest.newPath, 'kapeta.yml');
|
112
|
-
const
|
113
|
-
|
112
|
+
const isExisting = await fs_extra_1.default.pathExists(createRequest.tmpPath);
|
113
|
+
// The tmp folder might have a different name, so we need to update the asset after moving it over
|
114
|
+
if (isExisting) {
|
115
|
+
await fs_extra_1.default.remove(`${createRequest.tmpPath}/kapeta.yml`);
|
114
116
|
await fs_extra_1.default.move(createRequest.tmpPath, createRequest.newPath, {
|
115
117
|
overwrite: true,
|
116
118
|
});
|
117
|
-
res.send(await assetManager_1.assetManager.updateAsset(asset.ref, createRequest.definition));
|
118
|
-
}
|
119
|
-
else {
|
120
|
-
res.send(asset);
|
121
119
|
}
|
120
|
+
const [asset] = await assetManager_1.assetManager.createAsset(ymlPath, createRequest.definition);
|
121
|
+
res.send(asset);
|
122
122
|
}
|
123
123
|
catch (err) {
|
124
|
+
console.error('err');
|
124
125
|
res.status(500).send({ error: err.message });
|
125
126
|
}
|
126
127
|
});
|
package/package.json
CHANGED
package/src/storm/codegen.ts
CHANGED
@@ -23,7 +23,7 @@ import { KapetaURI, parseKapetaUri } from '@kapeta/nodejs-utils';
|
|
23
23
|
import { writeFile } from 'fs/promises';
|
24
24
|
import path, { join } from 'path';
|
25
25
|
import os from 'node:os';
|
26
|
-
import {
|
26
|
+
import { readFileSync, writeFileSync } from 'fs';
|
27
27
|
import Path from 'path';
|
28
28
|
import YAML from "yaml";
|
29
29
|
|
@@ -431,9 +431,9 @@ export class StormEventParser {
|
|
431
431
|
}
|
432
432
|
|
433
433
|
const clientTypes = DSLDataTypeParser.parse(
|
434
|
-
clientConsumerBlock.content.spec.entities.source!.value
|
434
|
+
clientConsumerBlock.content.spec.entities.source!.value, {ignoreSemantics: true}
|
435
435
|
);
|
436
|
-
const apiTypes = DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value);
|
436
|
+
const apiTypes = DSLDataTypeParser.parse(apiProviderBlock.content.spec.entities?.source?.value, {ignoreSemantics: true});
|
437
437
|
|
438
438
|
apiTypes.forEach((apiType) => {
|
439
439
|
if (clientTypes.some((clientType) => clientType.name === apiType.name)) {
|
package/src/storm/routes.ts
CHANGED
@@ -144,19 +144,19 @@ router.post('/block/create', async (req: KapetaBodyRequest, res: Response) => {
|
|
144
144
|
|
145
145
|
try {
|
146
146
|
const ymlPath = Path.join(createRequest.newPath, 'kapeta.yml');
|
147
|
+
const isExisting = await FS.pathExists(createRequest.tmpPath);
|
147
148
|
|
148
|
-
|
149
|
-
|
150
|
-
|
149
|
+
// The tmp folder might have a different name, so we need to update the asset after moving it over
|
150
|
+
if (isExisting) {
|
151
|
+
await FS.remove(`${createRequest.tmpPath}/kapeta.yml`);
|
151
152
|
await FS.move(createRequest.tmpPath, createRequest.newPath, {
|
152
153
|
overwrite: true,
|
153
154
|
});
|
154
|
-
|
155
|
-
res.send(await assetManager.updateAsset(asset.ref, createRequest.definition));
|
156
|
-
} else {
|
157
|
-
res.send(asset);
|
158
155
|
}
|
156
|
+
const [asset] = await assetManager.createAsset(ymlPath, createRequest.definition);
|
157
|
+
res.send(asset);
|
159
158
|
} catch (err: any) {
|
159
|
+
console.error('err');
|
160
160
|
res.status(500).send({ error: err.message });
|
161
161
|
}
|
162
162
|
});
|