@kapeta/local-cluster-service 0.24.3 → 0.25.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.
Files changed (243) hide show
  1. package/.eslintrc.cjs +8 -0
  2. package/.github/workflows/check-license.yml +18 -0
  3. package/CHANGELOG.md +24 -0
  4. package/LICENSE +38 -21
  5. package/README.md +4 -0
  6. package/definitions.d.ts +5 -0
  7. package/dist/cjs/index.d.ts +4 -0
  8. package/dist/cjs/index.js +16 -2
  9. package/dist/cjs/src/RepositoryWatcher.d.ts +4 -0
  10. package/dist/cjs/src/RepositoryWatcher.js +4 -0
  11. package/dist/cjs/src/api.d.ts +4 -0
  12. package/dist/cjs/src/api.js +4 -0
  13. package/dist/cjs/src/assetManager.d.ts +4 -0
  14. package/dist/cjs/src/assetManager.js +4 -0
  15. package/dist/cjs/src/assets/routes.d.ts +4 -0
  16. package/dist/cjs/src/assets/routes.js +4 -0
  17. package/dist/cjs/src/attachments/routes.d.ts +4 -0
  18. package/dist/cjs/src/attachments/routes.js +4 -0
  19. package/dist/cjs/src/authManager.d.ts +4 -0
  20. package/dist/cjs/src/authManager.js +4 -0
  21. package/dist/cjs/src/cacheManager.d.ts +4 -0
  22. package/dist/cjs/src/cacheManager.js +4 -0
  23. package/dist/cjs/src/clusterService.d.ts +4 -0
  24. package/dist/cjs/src/clusterService.js +4 -0
  25. package/dist/cjs/src/codeGeneratorManager.d.ts +4 -0
  26. package/dist/cjs/src/codeGeneratorManager.js +4 -0
  27. package/dist/cjs/src/config/routes.d.ts +4 -0
  28. package/dist/cjs/src/config/routes.js +4 -0
  29. package/dist/cjs/src/configManager.d.ts +4 -0
  30. package/dist/cjs/src/configManager.js +4 -0
  31. package/dist/cjs/src/containerManager.d.ts +4 -0
  32. package/dist/cjs/src/containerManager.js +4 -0
  33. package/dist/cjs/src/definitionsManager.d.ts +4 -0
  34. package/dist/cjs/src/definitionsManager.js +4 -0
  35. package/dist/cjs/src/filesystem/routes.d.ts +4 -0
  36. package/dist/cjs/src/filesystem/routes.js +4 -0
  37. package/dist/cjs/src/filesystemManager.d.ts +4 -0
  38. package/dist/cjs/src/filesystemManager.js +4 -0
  39. package/dist/cjs/src/identities/routes.d.ts +4 -0
  40. package/dist/cjs/src/identities/routes.js +4 -0
  41. package/dist/cjs/src/instanceManager.d.ts +4 -0
  42. package/dist/cjs/src/instanceManager.js +4 -0
  43. package/dist/cjs/src/instances/routes.d.ts +4 -0
  44. package/dist/cjs/src/instances/routes.js +4 -0
  45. package/dist/cjs/src/middleware/cors.d.ts +4 -0
  46. package/dist/cjs/src/middleware/cors.js +4 -0
  47. package/dist/cjs/src/middleware/kapeta.d.ts +4 -0
  48. package/dist/cjs/src/middleware/kapeta.js +4 -0
  49. package/dist/cjs/src/middleware/stringBody.d.ts +4 -0
  50. package/dist/cjs/src/middleware/stringBody.js +4 -0
  51. package/dist/cjs/src/networkManager.d.ts +4 -0
  52. package/dist/cjs/src/networkManager.js +4 -0
  53. package/dist/cjs/src/operatorManager.d.ts +4 -0
  54. package/dist/cjs/src/operatorManager.js +4 -0
  55. package/dist/cjs/src/progressListener.d.ts +4 -0
  56. package/dist/cjs/src/progressListener.js +4 -0
  57. package/dist/cjs/src/providerManager.d.ts +4 -0
  58. package/dist/cjs/src/providerManager.js +4 -0
  59. package/dist/cjs/src/providers/routes.d.ts +4 -0
  60. package/dist/cjs/src/providers/routes.js +4 -0
  61. package/dist/cjs/src/proxy/routes.d.ts +4 -0
  62. package/dist/cjs/src/proxy/routes.js +4 -0
  63. package/dist/cjs/src/proxy/types/rest.d.ts +4 -0
  64. package/dist/cjs/src/proxy/types/rest.js +4 -0
  65. package/dist/cjs/src/proxy/types/web.d.ts +4 -0
  66. package/dist/cjs/src/proxy/types/web.js +4 -0
  67. package/dist/cjs/src/repositoryManager.d.ts +4 -0
  68. package/dist/cjs/src/repositoryManager.js +4 -0
  69. package/dist/cjs/src/serviceManager.d.ts +4 -0
  70. package/dist/cjs/src/serviceManager.js +4 -0
  71. package/dist/cjs/src/socketManager.d.ts +4 -0
  72. package/dist/cjs/src/socketManager.js +4 -0
  73. package/dist/cjs/src/storageService.d.ts +4 -0
  74. package/dist/cjs/src/storageService.js +4 -0
  75. package/dist/cjs/src/taskManager.d.ts +4 -0
  76. package/dist/cjs/src/taskManager.js +4 -0
  77. package/dist/cjs/src/tasks/routes.d.ts +4 -0
  78. package/dist/cjs/src/tasks/routes.js +4 -0
  79. package/dist/cjs/src/traffic/routes.d.ts +4 -0
  80. package/dist/cjs/src/traffic/routes.js +4 -0
  81. package/dist/cjs/src/types.d.ts +4 -0
  82. package/dist/cjs/src/types.js +4 -0
  83. package/dist/cjs/src/utils/BlockInstanceRunner.d.ts +4 -0
  84. package/dist/cjs/src/utils/BlockInstanceRunner.js +5 -1
  85. package/dist/cjs/src/utils/DefaultProviderInstaller.d.ts +4 -0
  86. package/dist/cjs/src/utils/DefaultProviderInstaller.js +4 -0
  87. package/dist/cjs/src/utils/LogData.d.ts +4 -0
  88. package/dist/cjs/src/utils/LogData.js +4 -0
  89. package/dist/cjs/src/utils/commandLineUtils.d.ts +5 -0
  90. package/dist/cjs/src/utils/commandLineUtils.js +11 -1
  91. package/dist/cjs/src/utils/pathTemplateParser.d.ts +4 -0
  92. package/dist/cjs/src/utils/pathTemplateParser.js +4 -0
  93. package/dist/cjs/src/utils/utils.d.ts +4 -0
  94. package/dist/cjs/src/utils/utils.js +4 -0
  95. package/dist/cjs/start.d.ts +4 -0
  96. package/dist/cjs/start.js +4 -0
  97. package/dist/cjs/test/proxy/types/rest.test.d.ts +4 -0
  98. package/dist/cjs/test/proxy/types/rest.test.js +4 -0
  99. package/dist/cjs/test/utils/pathTemplateParser.test.d.ts +4 -0
  100. package/dist/cjs/test/utils/pathTemplateParser.test.js +4 -0
  101. package/dist/esm/index.d.ts +4 -0
  102. package/dist/esm/index.js +16 -2
  103. package/dist/esm/src/RepositoryWatcher.d.ts +4 -0
  104. package/dist/esm/src/RepositoryWatcher.js +4 -0
  105. package/dist/esm/src/api.d.ts +4 -0
  106. package/dist/esm/src/api.js +4 -0
  107. package/dist/esm/src/assetManager.d.ts +4 -0
  108. package/dist/esm/src/assetManager.js +4 -0
  109. package/dist/esm/src/assets/routes.d.ts +4 -0
  110. package/dist/esm/src/assets/routes.js +4 -0
  111. package/dist/esm/src/attachments/routes.d.ts +4 -0
  112. package/dist/esm/src/attachments/routes.js +4 -0
  113. package/dist/esm/src/authManager.d.ts +4 -0
  114. package/dist/esm/src/authManager.js +4 -0
  115. package/dist/esm/src/cacheManager.d.ts +4 -0
  116. package/dist/esm/src/cacheManager.js +4 -0
  117. package/dist/esm/src/clusterService.d.ts +4 -0
  118. package/dist/esm/src/clusterService.js +4 -0
  119. package/dist/esm/src/codeGeneratorManager.d.ts +4 -0
  120. package/dist/esm/src/codeGeneratorManager.js +4 -0
  121. package/dist/esm/src/config/routes.d.ts +4 -0
  122. package/dist/esm/src/config/routes.js +4 -0
  123. package/dist/esm/src/configManager.d.ts +4 -0
  124. package/dist/esm/src/configManager.js +4 -0
  125. package/dist/esm/src/containerManager.d.ts +4 -0
  126. package/dist/esm/src/containerManager.js +4 -0
  127. package/dist/esm/src/definitionsManager.d.ts +4 -0
  128. package/dist/esm/src/definitionsManager.js +4 -0
  129. package/dist/esm/src/filesystem/routes.d.ts +4 -0
  130. package/dist/esm/src/filesystem/routes.js +4 -0
  131. package/dist/esm/src/filesystemManager.d.ts +4 -0
  132. package/dist/esm/src/filesystemManager.js +4 -0
  133. package/dist/esm/src/identities/routes.d.ts +4 -0
  134. package/dist/esm/src/identities/routes.js +4 -0
  135. package/dist/esm/src/instanceManager.d.ts +4 -0
  136. package/dist/esm/src/instanceManager.js +4 -0
  137. package/dist/esm/src/instances/routes.d.ts +4 -0
  138. package/dist/esm/src/instances/routes.js +4 -0
  139. package/dist/esm/src/middleware/cors.d.ts +4 -0
  140. package/dist/esm/src/middleware/cors.js +4 -0
  141. package/dist/esm/src/middleware/kapeta.d.ts +4 -0
  142. package/dist/esm/src/middleware/kapeta.js +4 -0
  143. package/dist/esm/src/middleware/stringBody.d.ts +4 -0
  144. package/dist/esm/src/middleware/stringBody.js +4 -0
  145. package/dist/esm/src/networkManager.d.ts +4 -0
  146. package/dist/esm/src/networkManager.js +4 -0
  147. package/dist/esm/src/operatorManager.d.ts +4 -0
  148. package/dist/esm/src/operatorManager.js +4 -0
  149. package/dist/esm/src/progressListener.d.ts +4 -0
  150. package/dist/esm/src/progressListener.js +4 -0
  151. package/dist/esm/src/providerManager.d.ts +4 -0
  152. package/dist/esm/src/providerManager.js +4 -0
  153. package/dist/esm/src/providers/routes.d.ts +4 -0
  154. package/dist/esm/src/providers/routes.js +4 -0
  155. package/dist/esm/src/proxy/routes.d.ts +4 -0
  156. package/dist/esm/src/proxy/routes.js +4 -0
  157. package/dist/esm/src/proxy/types/rest.d.ts +4 -0
  158. package/dist/esm/src/proxy/types/rest.js +4 -0
  159. package/dist/esm/src/proxy/types/web.d.ts +4 -0
  160. package/dist/esm/src/proxy/types/web.js +4 -0
  161. package/dist/esm/src/repositoryManager.d.ts +4 -0
  162. package/dist/esm/src/repositoryManager.js +4 -0
  163. package/dist/esm/src/serviceManager.d.ts +4 -0
  164. package/dist/esm/src/serviceManager.js +4 -0
  165. package/dist/esm/src/socketManager.d.ts +4 -0
  166. package/dist/esm/src/socketManager.js +4 -0
  167. package/dist/esm/src/storageService.d.ts +4 -0
  168. package/dist/esm/src/storageService.js +4 -0
  169. package/dist/esm/src/taskManager.d.ts +4 -0
  170. package/dist/esm/src/taskManager.js +4 -0
  171. package/dist/esm/src/tasks/routes.d.ts +4 -0
  172. package/dist/esm/src/tasks/routes.js +4 -0
  173. package/dist/esm/src/traffic/routes.d.ts +4 -0
  174. package/dist/esm/src/traffic/routes.js +4 -0
  175. package/dist/esm/src/types.d.ts +4 -0
  176. package/dist/esm/src/types.js +4 -0
  177. package/dist/esm/src/utils/BlockInstanceRunner.d.ts +4 -0
  178. package/dist/esm/src/utils/BlockInstanceRunner.js +5 -1
  179. package/dist/esm/src/utils/DefaultProviderInstaller.d.ts +4 -0
  180. package/dist/esm/src/utils/DefaultProviderInstaller.js +4 -0
  181. package/dist/esm/src/utils/LogData.d.ts +4 -0
  182. package/dist/esm/src/utils/LogData.js +4 -0
  183. package/dist/esm/src/utils/commandLineUtils.d.ts +5 -0
  184. package/dist/esm/src/utils/commandLineUtils.js +11 -1
  185. package/dist/esm/src/utils/pathTemplateParser.d.ts +4 -0
  186. package/dist/esm/src/utils/pathTemplateParser.js +4 -0
  187. package/dist/esm/src/utils/utils.d.ts +4 -0
  188. package/dist/esm/src/utils/utils.js +4 -0
  189. package/dist/esm/start.d.ts +4 -0
  190. package/dist/esm/start.js +4 -0
  191. package/dist/esm/test/proxy/types/rest.test.d.ts +4 -0
  192. package/dist/esm/test/proxy/types/rest.test.js +4 -0
  193. package/dist/esm/test/utils/pathTemplateParser.test.d.ts +4 -0
  194. package/dist/esm/test/utils/pathTemplateParser.test.js +4 -0
  195. package/index.ts +18 -3
  196. package/package.json +8 -4
  197. package/src/RepositoryWatcher.ts +5 -0
  198. package/src/api.ts +5 -0
  199. package/src/assetManager.ts +5 -0
  200. package/src/assets/routes.ts +5 -0
  201. package/src/attachments/routes.ts +5 -0
  202. package/src/authManager.ts +5 -0
  203. package/src/cacheManager.ts +5 -0
  204. package/src/clusterService.ts +5 -0
  205. package/src/codeGeneratorManager.ts +5 -0
  206. package/src/config/routes.ts +5 -0
  207. package/src/configManager.ts +5 -0
  208. package/src/containerManager.ts +5 -0
  209. package/src/definitionsManager.ts +5 -0
  210. package/src/filesystem/routes.ts +5 -0
  211. package/src/filesystemManager.ts +5 -0
  212. package/src/identities/routes.ts +5 -0
  213. package/src/instanceManager.ts +5 -0
  214. package/src/instances/routes.ts +5 -0
  215. package/src/middleware/cors.ts +5 -0
  216. package/src/middleware/kapeta.ts +5 -0
  217. package/src/middleware/stringBody.ts +5 -0
  218. package/src/networkManager.ts +5 -0
  219. package/src/operatorManager.ts +5 -0
  220. package/src/progressListener.ts +5 -0
  221. package/src/providerManager.ts +5 -0
  222. package/src/providers/routes.ts +5 -0
  223. package/src/proxy/routes.ts +5 -0
  224. package/src/proxy/types/rest.ts +5 -0
  225. package/src/proxy/types/web.ts +5 -0
  226. package/src/repositoryManager.ts +5 -0
  227. package/src/serviceManager.ts +5 -0
  228. package/src/socketManager.ts +5 -0
  229. package/src/storageService.ts +5 -0
  230. package/src/taskManager.ts +5 -0
  231. package/src/tasks/routes.ts +5 -0
  232. package/src/traffic/routes.ts +5 -0
  233. package/src/types.ts +5 -0
  234. package/src/utils/BlockInstanceRunner.ts +6 -1
  235. package/src/utils/DefaultProviderInstaller.ts +5 -0
  236. package/src/utils/LogData.ts +5 -0
  237. package/src/utils/commandLineUtils.ts +11 -0
  238. package/src/utils/pathTemplateParser.ts +5 -0
  239. package/src/utils/utils.ts +5 -0
  240. package/start.ts +5 -0
  241. package/test/proxy/types/rest.test.ts +5 -0
  242. package/test/utils/pathTemplateParser.test.ts +5 -0
  243. package/tsconfig.json +2 -1
@@ -1,2 +1,7 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  export declare function hasCLI(): Promise<boolean>;
2
6
  export declare function ensureCLI(): Promise<import("../taskManager").Task<void> | null>;
7
+ export declare function ensureCLICommands(): Promise<void>;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureCLI = exports.hasCLI = void 0;
7
+ exports.ensureCLICommands = exports.ensureCLI = exports.hasCLI = void 0;
4
8
  const nodejs_process_1 = require("@kapeta/nodejs-process");
5
9
  const taskManager_1 = require("../taskManager");
6
10
  async function hasCLI() {
@@ -21,3 +25,9 @@ async function ensureCLI() {
21
25
  });
22
26
  }
23
27
  exports.ensureCLI = ensureCLI;
28
+ function ensureCLICommands() {
29
+ console.log('Run `kap init` to ensure default commands are installed');
30
+ const process = (0, nodejs_process_1.spawn)('kap', ['init'], { shell: true });
31
+ return process.wait();
32
+ }
33
+ exports.ensureCLICommands = ensureCLICommands;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  import { StringMap } from '../types';
2
6
  /**
3
7
  * A path template is a string that can be used to match a path and extract variables from it.
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.pathTemplateParser = exports.PathTemplate = void 0;
4
8
  const TYPE_VARIABLE = 'variable';
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  import { EntityList } from '@kapeta/schemas';
2
6
  import { AnyMap } from '../types';
3
7
  export declare function getBlockInstanceContainerName(systemId: string, instanceId: string): string;
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
8
  };
@@ -1 +1,5 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  export {};
package/dist/esm/start.js CHANGED
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
8
  };
@@ -1 +1,5 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  export {};
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  const rest_1 = require("../../../src/proxy/types/rest");
4
8
  describe('getRestMethodId', () => {
@@ -1 +1,5 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
1
5
  export {};
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright 2023 Kapeta Inc.
4
+ * SPDX-License-Identifier: BUSL-1.1
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  const pathTemplateParser_1 = require("../../src/utils/pathTemplateParser");
4
8
  describe('pathTemplateParser', () => {
package/index.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { clusterService } from './src/clusterService';
2
7
  import { storageService } from './src/storageService';
3
8
  import { serviceManager } from './src/serviceManager';
@@ -21,7 +26,8 @@ import APIRoutes from './src/api';
21
26
  import { getBindHost } from './src/utils/utils';
22
27
  import request from 'request';
23
28
  import { repositoryManager } from './src/repositoryManager';
24
- import { ensureCLI } from './src/utils/commandLineUtils';
29
+ import { taskManager } from './src/taskManager';
30
+ import { ensureCLI, ensureCLICommands } from './src/utils/commandLineUtils';
25
31
  import { defaultProviderInstaller } from './src/utils/DefaultProviderInstaller';
26
32
  import { authManager } from './src/authManager';
27
33
  import { codeGeneratorManager } from './src/codeGeneratorManager';
@@ -179,7 +185,7 @@ export default {
179
185
  storageService.put('cluster', 'host', host);
180
186
  }
181
187
 
182
- return new Promise(async (resolve, reject) => {
188
+ return new Promise((resolve, reject) => {
183
189
  if (!currentServer) {
184
190
  reject(new Error(`Current server wasn't set`));
185
191
  return;
@@ -196,11 +202,20 @@ export default {
196
202
 
197
203
  currentServer.listen(port, bindHost, async () => {
198
204
  try {
199
- ensureCLI().catch((e: any) => console.error('Failed to install CLI.', e));
205
+ const ensureCLITask = await ensureCLI();
206
+ if (ensureCLITask) {
207
+ await taskManager.waitFor((t) => t === ensureCLITask);
208
+ }
200
209
  } catch (e: any) {
201
210
  console.error('Failed to install CLI.', e);
202
211
  }
203
212
 
213
+ try {
214
+ await ensureCLICommands();
215
+ } catch (error) {
216
+ console.error('Failed to ensure default CLI commands', error);
217
+ }
218
+
204
219
  try {
205
220
  // Start installation process for all default providers
206
221
  await repositoryManager.ensureDefaultProviders();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.24.3",
3
+ "version": "0.25.1",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -24,8 +24,12 @@
24
24
  "keywords": [
25
25
  "kapeta"
26
26
  ],
27
- "author": "Henrik Hofmeister <hh@kapeta.com>",
28
- "license": "MIT",
27
+ "license": "BUSL-1.1",
28
+ "author": {
29
+ "email": "engineering@kapeta.com",
30
+ "name": "Kapeta",
31
+ "url": "https://kapeta.com"
32
+ },
29
33
  "bugs": {
30
34
  "url": "https://github.com/kapetacom/local-cluster-service/issues"
31
35
  },
@@ -51,7 +55,7 @@
51
55
  "@kapeta/nodejs-utils": "<2",
52
56
  "@kapeta/schemas": "<2",
53
57
  "@kapeta/sdk-config": "<2",
54
- "@kapeta/web-microfrontend": "^0.2.1",
58
+ "@kapeta/web-microfrontend": "<2",
55
59
  "@types/dockerode": "^3.3.19",
56
60
  "@types/stream-json": "^1.7.3",
57
61
  "async-lock": "^1.4.0",
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import chokidar, { FSWatcher } from 'chokidar';
2
7
  import ClusterConfiguration, { Definition, DefinitionInfo } from '@kapeta/local-cluster-config';
3
8
  import FS from 'fs-extra';
package/src/api.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { corsHandler } from './middleware/cors';
3
8
  import { KapetaAPI } from '@kapeta/nodejs-api-client';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'node:path';
2
7
  import FS from 'fs-extra';
3
8
  import YAML from 'yaml';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { Request, Response } from 'express';
3
8
  import YAML from 'yaml';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { KapetaAPI } from '@kapeta/nodejs-api-client';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { EventEmitter } from 'node:events';
2
7
  import Path from 'node:path';
3
8
  import chokidar, { FSWatcher } from 'chokidar';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import NodeCache from 'node-cache';
2
7
 
3
8
  const DEFAULT_CACHE_TTL = 60 * 1000; // 1 min
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { normalizeKapetaUri } from '@kapeta/nodejs-utils';
2
7
 
3
8
  const net = require('net');
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'path';
2
7
  import { registry as Targets, BlockCodeGenerator, CodeWriter } from '@kapeta/codegen';
3
8
  import { BlockDefinition } from '@kapeta/schemas';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { configManager, SYSTEM_ID } from '../configManager';
3
8
  import { serviceManager } from '../serviceManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { EnrichedAsset } from './assetManager';
2
7
  import { BlockInstance } from '@kapeta/schemas';
3
8
  import { storageService } from './storageService';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'path';
2
7
  import { storageService } from './storageService';
3
8
  import os from 'os';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import ClusterConfiguration, { DefinitionInfo } from '@kapeta/local-cluster-config';
2
7
  import { parseKapetaUri, normalizeKapetaUri } from '@kapeta/nodejs-utils';
3
8
  import { cacheManager, doCached } from './cacheManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { stringBody, StringBodyRequest } from '../middleware/stringBody';
3
8
  import { filesystemManager } from '../filesystemManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'path';
2
7
  import FS from 'fs';
3
8
  import FSExtra from 'fs-extra';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { KapetaAPI } from '@kapeta/nodejs-api-client';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import _ from 'lodash';
2
7
  import request from 'request';
3
8
  import AsyncLock from 'async-lock';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { instanceManager } from '../instanceManager';
3
8
  import { serviceManager } from '../serviceManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { NextFunction, Request, Response } from 'express';
2
7
 
3
8
  export function corsHandler(req: Request, res: Response, next: NextFunction) {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { NextFunction, Request, Response } from 'express';
2
7
  import { EnvironmentType } from '../types';
3
8
  import { normalizeKapetaUri } from '@kapeta/nodejs-utils';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { NextFunction, Request, Response } from 'express';
2
7
 
3
8
  export type StringBodyRequest = Request<any> & {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { Connection } from '@kapeta/schemas';
2
7
  import uuid from 'node-uuid';
3
8
  import { SimpleRequest, SimpleResponse } from './types';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { DefinitionInfo } from '@kapeta/local-cluster-config';
2
7
  import Path from 'path';
3
8
  import md5 from 'md5';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { spawn } from '@kapeta/nodejs-process';
2
7
  import { socketManager } from './socketManager';
3
8
  import { LogEntry } from './types';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'path';
2
7
  import FSExtra from 'fs-extra';
3
8
  import { definitionsManager } from './definitionsManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { providerManager } from '../providerManager';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { Request, Response } from 'express';
3
8
  import { Resource } from '@kapeta/schemas';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import _ from 'lodash';
2
7
  import request from 'request';
3
8
  import Path from 'path';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import request from 'request';
2
7
  import _ from 'lodash';
3
8
  import { networkManager } from '../../networkManager';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import os from 'node:os';
2
7
  import { socketManager } from './socketManager';
3
8
  import { Dependency } from '@kapeta/schemas';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import _ from 'lodash';
2
7
  import { clusterService } from './clusterService';
3
8
  import { storageService } from './storageService';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import _ from 'lodash';
2
7
  import { Socket, Server } from 'socket.io';
3
8
  import { normalizeKapetaUri } from '@kapeta/nodejs-utils';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import _ from 'lodash';
2
7
  import FS from 'fs';
3
8
  import FSExtra from 'fs-extra';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  /**
2
7
  * Class that handles processing background tasks.
3
8
  */
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { Request, Response } from 'express';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Router from 'express-promise-router';
2
7
  import { Request, Response } from 'express';
3
8
  import { networkManager } from '../networkManager';
package/src/types.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import express from 'express';
2
7
  import { Connection, Resource } from '@kapeta/schemas';
3
8
  import { StringBodyRequest } from './middleware/stringBody';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import FS from 'node:fs';
2
7
  import ClusterConfig, { DefinitionInfo } from '@kapeta/local-cluster-config';
3
8
  import { getBindHost, getBlockInstanceContainerName, readYML } from './utils';
@@ -153,7 +158,7 @@ export class BlockInstanceRunner {
153
158
  if (!FS.existsSync(baseDir)) {
154
159
  throw new Error(
155
160
  `Local block not registered correctly - expected symlink here: ${baseDir}.\n` +
156
- `Make sure you've run "blockctl registry link" in your local directory to connect it to Kapeta`
161
+ `Make sure you've run "kap registry link" in your local directory to connect it to Kapeta`
157
162
  );
158
163
  }
159
164
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import Path from 'node:path';
2
7
  import OS from 'node:os';
3
8
  import ClusterConfiguration from '@kapeta/local-cluster-config';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { LogEntry, LogLevel, LogSource } from '../types';
2
7
 
3
8
  const MAX_LINES = 1000;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { spawn, hasApp } from '@kapeta/nodejs-process';
2
7
  import { taskManager } from '../taskManager';
3
8
 
@@ -24,3 +29,9 @@ export async function ensureCLI() {
24
29
  }
25
30
  );
26
31
  }
32
+
33
+ export function ensureCLICommands() {
34
+ console.log('Run `kap init` to ensure default commands are installed');
35
+ const process = spawn('kap', ['init'], { shell: true });
36
+ return process.wait();
37
+ }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import { StringMap } from '../types';
2
7
 
3
8
  const TYPE_VARIABLE = 'variable';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright 2023 Kapeta Inc.
3
+ * SPDX-License-Identifier: BUSL-1.1
4
+ */
5
+
1
6
  import FS from 'node:fs';
2
7
  import YAML from 'yaml';
3
8
  import { parseKapetaUri } from '@kapeta/nodejs-utils';