@kapeta/local-cluster-service 0.19.3 → 0.19.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 +7 -0
- package/dist/cjs/src/definitionsManager.js +10 -2
- package/dist/cjs/src/repositoryManager.js +5 -2
- package/dist/esm/src/definitionsManager.js +10 -2
- package/dist/esm/src/repositoryManager.js +5 -2
- package/package.json +1 -1
- package/src/definitionsManager.ts +12 -4
- package/src/repositoryManager.ts +5 -2
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.19.4](https://github.com/kapetacom/local-cluster-service/compare/v0.19.3...v0.19.4) (2023-09-05)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Do not rename local sample if we already have ([095737e](https://github.com/kapetacom/local-cluster-service/commit/095737e7cfd94ec1e5dc8efcb178fbf88f67d783))
|
7
|
+
|
1
8
|
## [0.19.3](https://github.com/kapetacom/local-cluster-service/compare/v0.19.2...v0.19.3) (2023-09-05)
|
2
9
|
|
3
10
|
|
@@ -15,9 +15,12 @@ const nodejs_registry_utils_1 = require("@kapeta/nodejs-registry-utils");
|
|
15
15
|
const progressListener_1 = require("./progressListener");
|
16
16
|
const path_1 = __importDefault(require("path"));
|
17
17
|
exports.SAMPLE_PLAN_NAME = 'kapeta/sample-nodejs-plan';
|
18
|
-
function
|
18
|
+
function getRenamed(definition, targetHandle) {
|
19
19
|
const originalUri = (0, nodejs_utils_1.parseKapetaUri)(definition.definition.metadata.name);
|
20
|
-
|
20
|
+
return `${targetHandle}/${originalUri.name}`;
|
21
|
+
}
|
22
|
+
function applyHandleChange(definition, targetHandle) {
|
23
|
+
definition.definition.metadata.name = getRenamed(definition, targetHandle);
|
21
24
|
return definition;
|
22
25
|
}
|
23
26
|
function normalizeFilters(kindFilter) {
|
@@ -50,6 +53,11 @@ class DefinitionsManager {
|
|
50
53
|
// Not logged in yet, so we can't rewrite the sample plan
|
51
54
|
return definitions;
|
52
55
|
}
|
56
|
+
const newName = getRenamed(samplePlan, profile.handle);
|
57
|
+
if (definitions.some((d) => d.definition.metadata.name === newName && d.version === 'local')) {
|
58
|
+
// We already have a local version of the sample plan
|
59
|
+
return definitions;
|
60
|
+
}
|
53
61
|
console.log('Rewriting sample plan to use handle %s', profile.handle);
|
54
62
|
applyHandleChange(samplePlan, profile.handle);
|
55
63
|
const planDef = samplePlan.definition;
|
@@ -26,9 +26,9 @@ const DEFAULT_PROVIDERS = [
|
|
26
26
|
'kapeta/resource-type-web-fragment',
|
27
27
|
'kapeta/resource-type-mongodb',
|
28
28
|
'kapeta/resource-type-postgresql',
|
29
|
+
'kapeta/resource-type-smtp-client',
|
29
30
|
'kapeta/language-target-react-ts',
|
30
31
|
'kapeta/language-target-nodejs',
|
31
|
-
'kapeta/language-target-java-spring-boot',
|
32
32
|
];
|
33
33
|
class RepositoryManager extends node_events_1.EventEmitter {
|
34
34
|
_registryService;
|
@@ -84,7 +84,10 @@ class RepositoryManager extends node_events_1.EventEmitter {
|
|
84
84
|
throw e;
|
85
85
|
}
|
86
86
|
cacheManager_1.cacheManager.flush();
|
87
|
-
|
87
|
+
if (await definitionsManager_1.definitionsManager.exists(ref)) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
throw new Error(`Failed to install asset: ${ref}`);
|
88
91
|
};
|
89
92
|
};
|
90
93
|
const tasks = [];
|
@@ -15,9 +15,12 @@ const nodejs_registry_utils_1 = require("@kapeta/nodejs-registry-utils");
|
|
15
15
|
const progressListener_1 = require("./progressListener");
|
16
16
|
const path_1 = __importDefault(require("path"));
|
17
17
|
exports.SAMPLE_PLAN_NAME = 'kapeta/sample-nodejs-plan';
|
18
|
-
function
|
18
|
+
function getRenamed(definition, targetHandle) {
|
19
19
|
const originalUri = (0, nodejs_utils_1.parseKapetaUri)(definition.definition.metadata.name);
|
20
|
-
|
20
|
+
return `${targetHandle}/${originalUri.name}`;
|
21
|
+
}
|
22
|
+
function applyHandleChange(definition, targetHandle) {
|
23
|
+
definition.definition.metadata.name = getRenamed(definition, targetHandle);
|
21
24
|
return definition;
|
22
25
|
}
|
23
26
|
function normalizeFilters(kindFilter) {
|
@@ -50,6 +53,11 @@ class DefinitionsManager {
|
|
50
53
|
// Not logged in yet, so we can't rewrite the sample plan
|
51
54
|
return definitions;
|
52
55
|
}
|
56
|
+
const newName = getRenamed(samplePlan, profile.handle);
|
57
|
+
if (definitions.some((d) => d.definition.metadata.name === newName && d.version === 'local')) {
|
58
|
+
// We already have a local version of the sample plan
|
59
|
+
return definitions;
|
60
|
+
}
|
53
61
|
console.log('Rewriting sample plan to use handle %s', profile.handle);
|
54
62
|
applyHandleChange(samplePlan, profile.handle);
|
55
63
|
const planDef = samplePlan.definition;
|
@@ -26,9 +26,9 @@ const DEFAULT_PROVIDERS = [
|
|
26
26
|
'kapeta/resource-type-web-fragment',
|
27
27
|
'kapeta/resource-type-mongodb',
|
28
28
|
'kapeta/resource-type-postgresql',
|
29
|
+
'kapeta/resource-type-smtp-client',
|
29
30
|
'kapeta/language-target-react-ts',
|
30
31
|
'kapeta/language-target-nodejs',
|
31
|
-
'kapeta/language-target-java-spring-boot',
|
32
32
|
];
|
33
33
|
class RepositoryManager extends node_events_1.EventEmitter {
|
34
34
|
_registryService;
|
@@ -84,7 +84,10 @@ class RepositoryManager extends node_events_1.EventEmitter {
|
|
84
84
|
throw e;
|
85
85
|
}
|
86
86
|
cacheManager_1.cacheManager.flush();
|
87
|
-
|
87
|
+
if (await definitionsManager_1.definitionsManager.exists(ref)) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
throw new Error(`Failed to install asset: ${ref}`);
|
88
91
|
};
|
89
92
|
};
|
90
93
|
const tasks = [];
|
package/package.json
CHANGED
@@ -12,9 +12,12 @@ import Path from 'path';
|
|
12
12
|
|
13
13
|
export const SAMPLE_PLAN_NAME = 'kapeta/sample-nodejs-plan';
|
14
14
|
|
15
|
-
function
|
15
|
+
function getRenamed(definition: DefinitionInfo, targetHandle: string) {
|
16
16
|
const originalUri = parseKapetaUri(definition.definition.metadata.name);
|
17
|
-
|
17
|
+
return `${targetHandle}/${originalUri.name}`;
|
18
|
+
}
|
19
|
+
function applyHandleChange(definition: DefinitionInfo, targetHandle: string) {
|
20
|
+
definition.definition.metadata.name = getRenamed(definition, targetHandle);
|
18
21
|
return definition;
|
19
22
|
}
|
20
23
|
|
@@ -55,10 +58,15 @@ class DefinitionsManager {
|
|
55
58
|
return definitions;
|
56
59
|
}
|
57
60
|
|
58
|
-
|
61
|
+
const newName = getRenamed(samplePlan, profile.handle);
|
59
62
|
|
60
|
-
|
63
|
+
if (definitions.some((d) => d.definition.metadata.name === newName && d.version === 'local')) {
|
64
|
+
// We already have a local version of the sample plan
|
65
|
+
return definitions;
|
66
|
+
}
|
61
67
|
|
68
|
+
console.log('Rewriting sample plan to use handle %s', profile.handle);
|
69
|
+
applyHandleChange(samplePlan, profile.handle);
|
62
70
|
const planDef = samplePlan.definition as Plan;
|
63
71
|
|
64
72
|
const blockRefs = new Set<string>();
|
package/src/repositoryManager.ts
CHANGED
@@ -24,9 +24,9 @@ const DEFAULT_PROVIDERS = [
|
|
24
24
|
'kapeta/resource-type-web-fragment',
|
25
25
|
'kapeta/resource-type-mongodb',
|
26
26
|
'kapeta/resource-type-postgresql',
|
27
|
+
'kapeta/resource-type-smtp-client',
|
27
28
|
'kapeta/language-target-react-ts',
|
28
29
|
'kapeta/language-target-nodejs',
|
29
|
-
'kapeta/language-target-java-spring-boot',
|
30
30
|
];
|
31
31
|
|
32
32
|
class RepositoryManager extends EventEmitter {
|
@@ -90,7 +90,10 @@ class RepositoryManager extends EventEmitter {
|
|
90
90
|
throw e;
|
91
91
|
}
|
92
92
|
cacheManager.flush();
|
93
|
-
|
93
|
+
if (await definitionsManager.exists(ref)) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
throw new Error(`Failed to install asset: ${ref}`);
|
94
97
|
};
|
95
98
|
};
|
96
99
|
|