@akanjs/devkit 0.0.97 → 0.0.99

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 (65) hide show
  1. package/index.cjs +21 -0
  2. package/index.js +1 -21
  3. package/package.json +4 -4
  4. package/src/{aiEditor.mjs → aiEditor.cjs} +56 -22
  5. package/src/aiEditor.js +22 -56
  6. package/src/auth.cjs +72 -0
  7. package/src/auth.js +18 -48
  8. package/src/{builder.mjs → builder.cjs} +44 -11
  9. package/src/builder.js +11 -44
  10. package/src/{capacitorApp.mjs → capacitorApp.cjs} +42 -9
  11. package/src/capacitorApp.js +9 -42
  12. package/src/commandDecorators/{argMeta.mjs → argMeta.cjs} +34 -3
  13. package/src/commandDecorators/argMeta.js +3 -34
  14. package/src/commandDecorators/{command.mjs → command.cjs} +70 -37
  15. package/src/commandDecorators/command.js +37 -70
  16. package/src/commandDecorators/commandMeta.cjs +30 -0
  17. package/src/commandDecorators/commandMeta.js +2 -25
  18. package/src/commandDecorators/index.cjs +29 -0
  19. package/src/commandDecorators/index.js +5 -29
  20. package/src/commandDecorators/targetMeta.cjs +57 -0
  21. package/src/commandDecorators/targetMeta.js +2 -26
  22. package/src/commandDecorators/types.cjs +15 -0
  23. package/src/commandDecorators/types.js +0 -15
  24. package/src/constants.cjs +47 -0
  25. package/src/constants.js +4 -33
  26. package/src/createTunnel.cjs +49 -0
  27. package/src/createTunnel.js +4 -27
  28. package/src/{dependencyScanner.mjs → dependencyScanner.cjs} +38 -5
  29. package/src/dependencyScanner.js +5 -38
  30. package/src/{executors.mjs → executors.cjs} +123 -89
  31. package/src/executors.d.ts +1 -1
  32. package/src/executors.js +89 -123
  33. package/src/{extractDeps.mjs → extractDeps.cjs} +25 -2
  34. package/src/extractDeps.js +2 -25
  35. package/src/getCredentials.cjs +44 -0
  36. package/src/getCredentials.js +6 -39
  37. package/src/getModelFileData.cjs +66 -0
  38. package/src/getModelFileData.js +6 -39
  39. package/src/{getRelatedCnsts.mjs → getRelatedCnsts.cjs} +48 -9
  40. package/src/getRelatedCnsts.js +9 -48
  41. package/src/index.cjs +53 -0
  42. package/src/index.js +17 -53
  43. package/src/selectModel.cjs +46 -0
  44. package/src/selectModel.js +6 -39
  45. package/src/streamAi.cjs +62 -0
  46. package/src/streamAi.js +7 -30
  47. package/src/types.cjs +15 -0
  48. package/src/types.js +0 -15
  49. package/src/uploadRelease.cjs +85 -0
  50. package/src/uploadRelease.js +15 -48
  51. package/index.mjs +0 -1
  52. package/src/auth.mjs +0 -42
  53. package/src/commandDecorators/commandMeta.mjs +0 -7
  54. package/src/commandDecorators/index.mjs +0 -5
  55. package/src/commandDecorators/targetMeta.mjs +0 -33
  56. package/src/commandDecorators/types.mjs +0 -0
  57. package/src/constants.mjs +0 -18
  58. package/src/createTunnel.mjs +0 -26
  59. package/src/getCredentials.mjs +0 -11
  60. package/src/getModelFileData.mjs +0 -33
  61. package/src/index.mjs +0 -17
  62. package/src/selectModel.mjs +0 -13
  63. package/src/streamAi.mjs +0 -39
  64. package/src/types.mjs +0 -0
  65. package/src/uploadRelease.mjs +0 -52
@@ -1,43 +1,11 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var command_exports = {};
29
- __export(command_exports, {
30
- runCommands: () => runCommands
31
- });
32
- module.exports = __toCommonJS(command_exports);
33
- var import_common = require("@akanjs/common");
34
- var import_prompts = require("@inquirer/prompts");
35
- var import_chalk = __toESM(require("chalk"));
36
- var import_commander = require("commander");
37
- var import_fs = __toESM(require("fs"));
38
- var import_executors = require("../executors");
39
- var import_argMeta = require("./argMeta");
40
- var import_targetMeta = require("./targetMeta");
1
+ import { Logger } from "@akanjs/common";
2
+ import { confirm, input, select } from "@inquirer/prompts";
3
+ import chalk from "chalk";
4
+ import { program } from "commander";
5
+ import fs from "fs";
6
+ import { AppExecutor, LibExecutor, PkgExecutor, WorkspaceExecutor } from "../executors";
7
+ import { getArgMetas } from "./argMeta";
8
+ import { getTargetMetas } from "./targetMeta";
41
9
  const camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
42
10
  const handleOption = (programCommand, argMeta) => {
43
11
  const {
@@ -75,20 +43,20 @@ const getOptionValue = async (argMeta, opt) => {
75
43
  else if (nullable)
76
44
  return null;
77
45
  if (choices) {
78
- const choice = await (0, import_prompts.select)({
46
+ const choice = await select({
79
47
  message: ask ?? desc ?? `Select the ${name} value`,
80
48
  choices: choices.map((choice2) => choice2.toString())
81
49
  });
82
50
  return choice;
83
51
  } else if (type === "boolean") {
84
52
  const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
85
- return await (0, import_prompts.confirm)({ message });
53
+ return await confirm({ message });
86
54
  } else {
87
55
  const message = ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
88
56
  if (argMeta.argsOption.nullable)
89
- return await (0, import_prompts.input)({ message });
57
+ return await input({ message });
90
58
  else
91
- return convertOptionValue(await (0, import_prompts.input)({ message }), type ?? "string");
59
+ return convertOptionValue(await input({ message }), type ?? "string");
92
60
  }
93
61
  };
94
62
  const getArgumentValue = async (argMeta, value, workspace) => {
@@ -98,46 +66,46 @@ const getArgumentValue = async (argMeta, value, workspace) => {
98
66
  const [appNames, libNames] = await workspace.getSyss();
99
67
  if (sysType === "sys") {
100
68
  if (value && appNames.includes(value))
101
- return import_executors.AppExecutor.from(workspace, value);
69
+ return AppExecutor.from(workspace, value);
102
70
  else if (value && libNames.includes(value))
103
- return import_executors.LibExecutor.from(workspace, value);
71
+ return LibExecutor.from(workspace, value);
104
72
  else {
105
- const sysName = await (0, import_prompts.select)({
73
+ const sysName = await select({
106
74
  message: `Select the App or Lib name`,
107
75
  choices: [...appNames, ...libNames]
108
76
  });
109
77
  if (appNames.includes(sysName))
110
- return import_executors.AppExecutor.from(workspace, sysName);
78
+ return AppExecutor.from(workspace, sysName);
111
79
  else if (libNames.includes(sysName))
112
- return import_executors.LibExecutor.from(workspace, sysName);
80
+ return LibExecutor.from(workspace, sysName);
113
81
  else
114
82
  throw new Error(`Invalid system name: ${sysName}`);
115
83
  }
116
84
  } else if (sysType === "app") {
117
85
  if (value && appNames.includes(value))
118
- return import_executors.AppExecutor.from(workspace, value);
119
- const appName = await (0, import_prompts.select)({ message: `Select the ${sysType} name`, choices: appNames });
120
- return import_executors.AppExecutor.from(workspace, appName);
86
+ return AppExecutor.from(workspace, value);
87
+ const appName = await select({ message: `Select the ${sysType} name`, choices: appNames });
88
+ return AppExecutor.from(workspace, appName);
121
89
  } else if (sysType === "lib") {
122
90
  if (value && libNames.includes(value))
123
- return import_executors.LibExecutor.from(workspace, value);
124
- const libName = await (0, import_prompts.select)({ message: `Select the ${sysType} name`, choices: libNames });
125
- return import_executors.LibExecutor.from(workspace, libName);
91
+ return LibExecutor.from(workspace, value);
92
+ const libName = await select({ message: `Select the ${sysType} name`, choices: libNames });
93
+ return LibExecutor.from(workspace, libName);
126
94
  } else if (sysType === "pkg") {
127
95
  const pkgs = await workspace.getPkgs();
128
96
  if (value && pkgs.includes(value))
129
- return import_executors.PkgExecutor.from(workspace, value);
130
- const pkgName = await (0, import_prompts.select)({ message: `Select the ${sysType} name`, choices: pkgs });
131
- return import_executors.PkgExecutor.from(workspace, pkgName);
97
+ return PkgExecutor.from(workspace, value);
98
+ const pkgName = await select({ message: `Select the ${sysType} name`, choices: pkgs });
99
+ return PkgExecutor.from(workspace, pkgName);
132
100
  } else
133
101
  throw new Error(`Invalid system type: ${argMeta.type}`);
134
102
  };
135
103
  const runCommands = async (...commands) => {
136
- const hasPackageJson = import_fs.default.existsSync(`${__dirname}/package.json`);
137
- const version = hasPackageJson ? JSON.parse(import_fs.default.readFileSync(`${__dirname}/package.json`, "utf8")).version : "0.0.1";
138
- import_commander.program.version(version).description("Akan CLI");
104
+ const hasPackageJson = fs.existsSync(`${__dirname}/package.json`);
105
+ const version = hasPackageJson ? JSON.parse(fs.readFileSync(`${__dirname}/package.json`, "utf8")).version : "0.0.1";
106
+ program.version(version).description("Akan CLI");
139
107
  for (const command of commands) {
140
- const targetMetas = (0, import_targetMeta.getTargetMetas)(command);
108
+ const targetMetas = getTargetMetas(command);
141
109
  for (const targetMeta of targetMetas) {
142
110
  const kebabKey = camelToKebabCase(targetMeta.key);
143
111
  const commandNames = targetMeta.targetOption.short === true ? [
@@ -145,10 +113,10 @@ const runCommands = async (...commands) => {
145
113
  typeof targetMeta.targetOption.short === "string" ? targetMeta.targetOption.short : kebabKey.split("-").map((s) => s.slice(0, 1)).join("")
146
114
  ] : [kebabKey];
147
115
  for (const commandName of commandNames) {
148
- let programCommand = import_commander.program.command(commandName, {
116
+ let programCommand = program.command(commandName, {
149
117
  hidden: targetMeta.targetOption.devOnly
150
118
  });
151
- const [allArgMetas] = (0, import_argMeta.getArgMetas)(command, targetMeta.key);
119
+ const [allArgMetas] = getArgMetas(command, targetMeta.key);
152
120
  for (const argMeta of allArgMetas) {
153
121
  if (argMeta.type === "Option")
154
122
  programCommand = handleOption(programCommand, argMeta);
@@ -164,7 +132,7 @@ const runCommands = async (...commands) => {
164
132
  const cmdArgs = args.slice(0, args.length - 2);
165
133
  const opt = args[args.length - 2];
166
134
  const commandArgs = [];
167
- const workspace = import_executors.WorkspaceExecutor.fromRoot();
135
+ const workspace = WorkspaceExecutor.fromRoot();
168
136
  for (const argMeta of allArgMetas) {
169
137
  if (argMeta.type === "Option")
170
138
  commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt);
@@ -176,15 +144,14 @@ const runCommands = async (...commands) => {
176
144
  await cmd[targetMeta.key](...commandArgs);
177
145
  } catch (e) {
178
146
  const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
179
- import_common.Logger.error(`Command Error: ${import_chalk.default.red(errMsg)}`);
147
+ Logger.error(`Command Error: ${chalk.red(errMsg)}`);
180
148
  }
181
149
  });
182
150
  }
183
151
  }
184
152
  }
185
- await import_commander.program.parseAsync(process.argv);
153
+ await program.parseAsync(process.argv);
186
154
  };
187
- // Annotate the CommonJS export names for ESM import in node:
188
- 0 && (module.exports = {
155
+ export {
189
156
  runCommands
190
- });
157
+ };
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var commandMeta_exports = {};
19
+ __export(commandMeta_exports, {
20
+ Commands: () => Commands
21
+ });
22
+ module.exports = __toCommonJS(commandMeta_exports);
23
+ const Commands = () => {
24
+ return function(target) {
25
+ };
26
+ };
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ Commands
30
+ });
@@ -1,30 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var commandMeta_exports = {};
19
- __export(commandMeta_exports, {
20
- Commands: () => Commands
21
- });
22
- module.exports = __toCommonJS(commandMeta_exports);
23
1
  const Commands = () => {
24
2
  return function(target) {
25
3
  };
26
4
  };
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
5
+ export {
29
6
  Commands
30
- });
7
+ };
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var commandDecorators_exports = {};
16
+ module.exports = __toCommonJS(commandDecorators_exports);
17
+ __reExport(commandDecorators_exports, require("./argMeta"), module.exports);
18
+ __reExport(commandDecorators_exports, require("./commandMeta"), module.exports);
19
+ __reExport(commandDecorators_exports, require("./targetMeta"), module.exports);
20
+ __reExport(commandDecorators_exports, require("./types"), module.exports);
21
+ __reExport(commandDecorators_exports, require("./command"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./argMeta"),
25
+ ...require("./commandMeta"),
26
+ ...require("./targetMeta"),
27
+ ...require("./types"),
28
+ ...require("./command")
29
+ });
@@ -1,29 +1,5 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var commandDecorators_exports = {};
16
- module.exports = __toCommonJS(commandDecorators_exports);
17
- __reExport(commandDecorators_exports, require("./argMeta"), module.exports);
18
- __reExport(commandDecorators_exports, require("./commandMeta"), module.exports);
19
- __reExport(commandDecorators_exports, require("./targetMeta"), module.exports);
20
- __reExport(commandDecorators_exports, require("./types"), module.exports);
21
- __reExport(commandDecorators_exports, require("./command"), module.exports);
22
- // Annotate the CommonJS export names for ESM import in node:
23
- 0 && (module.exports = {
24
- ...require("./argMeta"),
25
- ...require("./commandMeta"),
26
- ...require("./targetMeta"),
27
- ...require("./types"),
28
- ...require("./command")
29
- });
1
+ export * from "./argMeta";
2
+ export * from "./commandMeta";
3
+ export * from "./targetMeta";
4
+ export * from "./types";
5
+ export * from "./command";
@@ -0,0 +1,57 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var targetMeta_exports = {};
19
+ __export(targetMeta_exports, {
20
+ Target: () => Target,
21
+ getTargetMetas: () => getTargetMetas
22
+ });
23
+ module.exports = __toCommonJS(targetMeta_exports);
24
+ const getTargetMetas = (command) => {
25
+ const targetMetaMap = Reflect.getMetadata("target", command.prototype);
26
+ if (!targetMetaMap)
27
+ throw new Error(`TargetMeta is not defined for ${command.name}`);
28
+ return [...targetMetaMap.values()];
29
+ };
30
+ const getTargetMetaMapOnPrototype = (prototype) => {
31
+ const targetMetaMap = Reflect.getMetadata("target", prototype);
32
+ return targetMetaMap ?? /* @__PURE__ */ new Map();
33
+ };
34
+ const setTargetMetaMapOnPrototype = (prototype, targetMetaMap) => {
35
+ Reflect.defineMetadata("target", targetMetaMap, prototype);
36
+ };
37
+ const getTarget = (type) => (targetOption = {}) => {
38
+ return (prototype, key, descriptor) => {
39
+ const metadataMap = getTargetMetaMapOnPrototype(prototype);
40
+ metadataMap.set(key, {
41
+ key,
42
+ descriptor,
43
+ targetOption: { ...targetOption, type }
44
+ });
45
+ setTargetMetaMapOnPrototype(prototype, metadataMap);
46
+ };
47
+ };
48
+ const Target = {
49
+ Public: getTarget("public"),
50
+ Cloud: getTarget("cloud"),
51
+ Dev: getTarget("dev")
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ Target,
56
+ getTargetMetas
57
+ });
@@ -1,26 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var targetMeta_exports = {};
19
- __export(targetMeta_exports, {
20
- Target: () => Target,
21
- getTargetMetas: () => getTargetMetas
22
- });
23
- module.exports = __toCommonJS(targetMeta_exports);
24
1
  const getTargetMetas = (command) => {
25
2
  const targetMetaMap = Reflect.getMetadata("target", command.prototype);
26
3
  if (!targetMetaMap)
@@ -50,8 +27,7 @@ const Target = {
50
27
  Cloud: getTarget("cloud"),
51
28
  Dev: getTarget("dev")
52
29
  };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
30
+ export {
55
31
  Target,
56
32
  getTargetMetas
57
- });
33
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var types_exports = {};
15
+ module.exports = __toCommonJS(types_exports);
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var types_exports = {};
15
- module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ akanCloudBackendUrl: () => akanCloudBackendUrl,
21
+ akanCloudClientUrl: () => akanCloudClientUrl,
22
+ akanCloudHost: () => akanCloudHost,
23
+ basePath: () => basePath,
24
+ configPath: () => configPath,
25
+ defaultAkanGlobalConfig: () => defaultAkanGlobalConfig,
26
+ defaultHostConfig: () => defaultHostConfig
27
+ });
28
+ module.exports = __toCommonJS(constants_exports);
29
+ var import_os = require("os");
30
+ const basePath = `${(0, import_os.homedir)()}/.akan`;
31
+ const configPath = `${basePath}/config.json`;
32
+ const akanCloudHost = process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? "http://localhost" : "https://akasys-debug.akamir.com";
33
+ //! Temp
34
+ const akanCloudBackendUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":8080" : ""}/backend`;
35
+ const akanCloudClientUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":4200" : ""}`;
36
+ const defaultHostConfig = {};
37
+ const defaultAkanGlobalConfig = { cloudHost: {}, llm: null };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ akanCloudBackendUrl,
41
+ akanCloudClientUrl,
42
+ akanCloudHost,
43
+ basePath,
44
+ configPath,
45
+ defaultAkanGlobalConfig,
46
+ defaultHostConfig
47
+ });
package/src/constants.js CHANGED
@@ -1,33 +1,5 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var constants_exports = {};
19
- __export(constants_exports, {
20
- akanCloudBackendUrl: () => akanCloudBackendUrl,
21
- akanCloudClientUrl: () => akanCloudClientUrl,
22
- akanCloudHost: () => akanCloudHost,
23
- basePath: () => basePath,
24
- configPath: () => configPath,
25
- defaultAkanGlobalConfig: () => defaultAkanGlobalConfig,
26
- defaultHostConfig: () => defaultHostConfig
27
- });
28
- module.exports = __toCommonJS(constants_exports);
29
- var import_os = require("os");
30
- const basePath = `${(0, import_os.homedir)()}/.akan`;
1
+ import { homedir } from "os";
2
+ const basePath = `${homedir()}/.akan`;
31
3
  const configPath = `${basePath}/config.json`;
32
4
  const akanCloudHost = process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? "http://localhost" : "https://akasys-debug.akamir.com";
33
5
  //! Temp
@@ -35,8 +7,7 @@ const akanCloudBackendUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION
35
7
  const akanCloudClientUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":4200" : ""}`;
36
8
  const defaultHostConfig = {};
37
9
  const defaultAkanGlobalConfig = { cloudHost: {}, llm: null };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
10
+ export {
40
11
  akanCloudBackendUrl,
41
12
  akanCloudClientUrl,
42
13
  akanCloudHost,
@@ -44,4 +15,4 @@ const defaultAkanGlobalConfig = { cloudHost: {}, llm: null };
44
15
  configPath,
45
16
  defaultAkanGlobalConfig,
46
17
  defaultHostConfig
47
- });
18
+ };
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var createTunnel_exports = {};
19
+ __export(createTunnel_exports, {
20
+ createTunnel: () => createTunnel
21
+ });
22
+ module.exports = __toCommonJS(createTunnel_exports);
23
+ var import_tunnel_ssh = require("tunnel-ssh");
24
+ const getSshTunnelOptions = (app, environment) => {
25
+ const { serveDomain, repoName } = app.workspace.getBaseDevEnv();
26
+ return {
27
+ host: `${app.name}-${environment}.${serveDomain}`,
28
+ port: process.env.SSH_TUNNEL_PORT ? parseInt(process.env.SSH_TUNNEL_PORT) : 32767,
29
+ username: process.env.SSH_TUNNEL_USERNAME ?? "root",
30
+ password: process.env.SSH_TUNNEL_PASSWORD ?? repoName
31
+ };
32
+ };
33
+ const createTunnel = async ({ app, environment, port = 27017 }) => {
34
+ const tunnelOptions = { autoClose: true, reconnectOnError: true };
35
+ const sshOptions = getSshTunnelOptions(app, environment);
36
+ const serverOptions = { port };
37
+ const forwardOptions = {
38
+ srcAddr: "0.0.0.0",
39
+ srcPort: port,
40
+ dstAddr: `mongo-0.mongo-svc.${app.name}-${environment}`,
41
+ dstPort: 27017
42
+ };
43
+ const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
44
+ return `localhost:${port}`;
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ createTunnel
49
+ });
@@ -1,26 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var createTunnel_exports = {};
19
- __export(createTunnel_exports, {
20
- createTunnel: () => createTunnel
21
- });
22
- module.exports = __toCommonJS(createTunnel_exports);
23
- var import_tunnel_ssh = require("tunnel-ssh");
1
+ import { createTunnel as create } from "tunnel-ssh";
24
2
  const getSshTunnelOptions = (app, environment) => {
25
3
  const { serveDomain, repoName } = app.workspace.getBaseDevEnv();
26
4
  return {
@@ -40,10 +18,9 @@ const createTunnel = async ({ app, environment, port = 27017 }) => {
40
18
  dstAddr: `mongo-0.mongo-svc.${app.name}-${environment}`,
41
19
  dstPort: 27017
42
20
  };
43
- const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
21
+ const [server, client] = await create(tunnelOptions, serverOptions, sshOptions, forwardOptions);
44
22
  return `localhost:${port}`;
45
23
  };
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
24
+ export {
48
25
  createTunnel
49
- });
26
+ };