@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.
- package/index.cjs +21 -0
- package/index.js +1 -21
- package/package.json +4 -4
- package/src/{aiEditor.mjs → aiEditor.cjs} +56 -22
- package/src/aiEditor.js +22 -56
- package/src/auth.cjs +72 -0
- package/src/auth.js +18 -48
- package/src/{builder.mjs → builder.cjs} +44 -11
- package/src/builder.js +11 -44
- package/src/{capacitorApp.mjs → capacitorApp.cjs} +42 -9
- package/src/capacitorApp.js +9 -42
- package/src/commandDecorators/{argMeta.mjs → argMeta.cjs} +34 -3
- package/src/commandDecorators/argMeta.js +3 -34
- package/src/commandDecorators/{command.mjs → command.cjs} +70 -37
- package/src/commandDecorators/command.js +37 -70
- package/src/commandDecorators/commandMeta.cjs +30 -0
- package/src/commandDecorators/commandMeta.js +2 -25
- package/src/commandDecorators/index.cjs +29 -0
- package/src/commandDecorators/index.js +5 -29
- package/src/commandDecorators/targetMeta.cjs +57 -0
- package/src/commandDecorators/targetMeta.js +2 -26
- package/src/commandDecorators/types.cjs +15 -0
- package/src/commandDecorators/types.js +0 -15
- package/src/constants.cjs +47 -0
- package/src/constants.js +4 -33
- package/src/createTunnel.cjs +49 -0
- package/src/createTunnel.js +4 -27
- package/src/{dependencyScanner.mjs → dependencyScanner.cjs} +38 -5
- package/src/dependencyScanner.js +5 -38
- package/src/{executors.mjs → executors.cjs} +123 -89
- package/src/executors.d.ts +1 -1
- package/src/executors.js +89 -123
- package/src/{extractDeps.mjs → extractDeps.cjs} +25 -2
- package/src/extractDeps.js +2 -25
- package/src/getCredentials.cjs +44 -0
- package/src/getCredentials.js +6 -39
- package/src/getModelFileData.cjs +66 -0
- package/src/getModelFileData.js +6 -39
- package/src/{getRelatedCnsts.mjs → getRelatedCnsts.cjs} +48 -9
- package/src/getRelatedCnsts.js +9 -48
- package/src/index.cjs +53 -0
- package/src/index.js +17 -53
- package/src/selectModel.cjs +46 -0
- package/src/selectModel.js +6 -39
- package/src/streamAi.cjs +62 -0
- package/src/streamAi.js +7 -30
- package/src/types.cjs +15 -0
- package/src/types.js +0 -15
- package/src/uploadRelease.cjs +85 -0
- package/src/uploadRelease.js +15 -48
- package/index.mjs +0 -1
- package/src/auth.mjs +0 -42
- package/src/commandDecorators/commandMeta.mjs +0 -7
- package/src/commandDecorators/index.mjs +0 -5
- package/src/commandDecorators/targetMeta.mjs +0 -33
- package/src/commandDecorators/types.mjs +0 -0
- package/src/constants.mjs +0 -18
- package/src/createTunnel.mjs +0 -26
- package/src/getCredentials.mjs +0 -11
- package/src/getModelFileData.mjs +0 -33
- package/src/index.mjs +0 -17
- package/src/selectModel.mjs +0 -13
- package/src/streamAi.mjs +0 -39
- package/src/types.mjs +0 -0
- package/src/uploadRelease.mjs +0 -52
package/src/streamAi.js
CHANGED
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 streamAi_exports = {};
|
|
19
|
-
__export(streamAi_exports, {
|
|
20
|
-
streamAi: () => streamAi
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(streamAi_exports);
|
|
23
|
-
var import_prompts = require("@langchain/core/prompts");
|
|
24
|
-
var import_runnables = require("@langchain/core/runnables");
|
|
25
|
-
var import_openai = require("@langchain/openai");
|
|
1
|
+
import { PromptTemplate } from "@langchain/core/prompts";
|
|
2
|
+
import { RunnableSequence } from "@langchain/core/runnables";
|
|
3
|
+
import { ChatOpenAI } from "@langchain/openai";
|
|
26
4
|
const streamAi = async (question, callback = (chunk) => {
|
|
27
5
|
process.stdout.write(chunk);
|
|
28
6
|
}) => {
|
|
29
7
|
const createStreamingModel = (apiKey = process.env.DEEPSEEK_API_KEY) => {
|
|
30
8
|
if (!apiKey)
|
|
31
9
|
throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
|
|
32
|
-
return new
|
|
10
|
+
return new ChatOpenAI({
|
|
33
11
|
modelName: "deepseek-reasoner",
|
|
34
12
|
temperature: 0.7,
|
|
35
13
|
streaming: true,
|
|
@@ -38,7 +16,7 @@ const streamAi = async (question, callback = (chunk) => {
|
|
|
38
16
|
});
|
|
39
17
|
};
|
|
40
18
|
const createProcessingChain = () => {
|
|
41
|
-
return
|
|
19
|
+
return RunnableSequence.from([PromptTemplate.fromTemplate(`Answer concisely: {question}`), createStreamingModel()]);
|
|
42
20
|
};
|
|
43
21
|
try {
|
|
44
22
|
const chain = createProcessingChain();
|
|
@@ -56,7 +34,6 @@ const streamAi = async (question, callback = (chunk) => {
|
|
|
56
34
|
throw new Error("Failed to stream response");
|
|
57
35
|
}
|
|
58
36
|
};
|
|
59
|
-
|
|
60
|
-
0 && (module.exports = {
|
|
37
|
+
export {
|
|
61
38
|
streamAi
|
|
62
|
-
}
|
|
39
|
+
};
|
package/src/types.cjs
ADDED
|
@@ -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);
|
package/src/types.js
CHANGED
|
@@ -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,85 @@
|
|
|
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 uploadRelease_exports = {};
|
|
29
|
+
__export(uploadRelease_exports, {
|
|
30
|
+
uploadRelease: () => uploadRelease
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(uploadRelease_exports);
|
|
33
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
34
|
+
var import_form_data = __toESM(require("form-data"), 1);
|
|
35
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
36
|
+
const uploadRelease = async (projectName, {
|
|
37
|
+
workspaceRoot,
|
|
38
|
+
environment,
|
|
39
|
+
buildNum,
|
|
40
|
+
platformVersion,
|
|
41
|
+
local
|
|
42
|
+
}) => {
|
|
43
|
+
const basePath = local ? "http://localhost:8080/backend" : "https://akasys.akamir.com/backend";
|
|
44
|
+
const buildPath = `${workspaceRoot}/releases/builds/${projectName}-release.tar.gz`;
|
|
45
|
+
const appBuildPath = `${workspaceRoot}/releases/builds/${projectName}-appBuild.zip`;
|
|
46
|
+
const sourcePath = `${workspaceRoot}/releases/sources/${projectName}-source.tar.gz`;
|
|
47
|
+
const formData = new import_form_data.default();
|
|
48
|
+
const build = import_fs.default.readFileSync(buildPath);
|
|
49
|
+
const source = import_fs.default.readFileSync(sourcePath);
|
|
50
|
+
const appBuild = import_fs.default.readFileSync(appBuildPath);
|
|
51
|
+
const buildStat = import_fs.default.statSync(buildPath);
|
|
52
|
+
const sourceStat = import_fs.default.statSync(sourcePath);
|
|
53
|
+
const appBuildStat = import_fs.default.statSync(appBuildPath);
|
|
54
|
+
formData.append("files", build, `${projectName}-release.tar.gz`);
|
|
55
|
+
formData.append("files", source, `${projectName}-source.tar.gz`);
|
|
56
|
+
formData.append("files", appBuild, `${projectName}-appBuild.zip`);
|
|
57
|
+
formData.append(
|
|
58
|
+
"metas",
|
|
59
|
+
JSON.stringify([
|
|
60
|
+
{ lastModifiedAt: buildStat.mtime, size: buildStat.size },
|
|
61
|
+
{ lastModifiedAt: sourceStat.mtime, size: sourceStat.size },
|
|
62
|
+
{ lastModifiedAt: appBuildStat.mtime, size: appBuildStat.size }
|
|
63
|
+
])
|
|
64
|
+
);
|
|
65
|
+
formData.append("type", "release");
|
|
66
|
+
try {
|
|
67
|
+
const [buildFile, sourceFile, appBuildFile] = (await import_axios.default.post(`${basePath}/file/addFilesRestApi`, formData)).data;
|
|
68
|
+
const major = platformVersion ? parseInt(platformVersion.split(".")[0]) : 1;
|
|
69
|
+
const minor = platformVersion ? parseInt(platformVersion.split(".")[1]) : 0;
|
|
70
|
+
const patch = platformVersion ? parseInt(platformVersion.split(".")[2]) : 0;
|
|
71
|
+
const latestRelease = await import_axios.default.get(
|
|
72
|
+
`${basePath}/release/findVersionRelease?appName=${projectName}&branch=${environment}&major=${major}&minor=${minor}`
|
|
73
|
+
);
|
|
74
|
+
const release = (await import_axios.default.post(
|
|
75
|
+
`${basePath}/release/pushRelease/${projectName}/${environment}/${major}/${minor}/${sourceFile.id}/${buildFile.id}/${appBuildFile.id}`
|
|
76
|
+
)).data;
|
|
77
|
+
return release;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
uploadRelease
|
|
85
|
+
});
|
package/src/uploadRelease.js
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 uploadRelease_exports = {};
|
|
29
|
-
__export(uploadRelease_exports, {
|
|
30
|
-
uploadRelease: () => uploadRelease
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(uploadRelease_exports);
|
|
33
|
-
var import_axios = __toESM(require("axios"));
|
|
34
|
-
var import_form_data = __toESM(require("form-data"));
|
|
35
|
-
var import_fs = __toESM(require("fs"));
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import FormData from "form-data";
|
|
3
|
+
import fs from "fs";
|
|
36
4
|
const uploadRelease = async (projectName, {
|
|
37
5
|
workspaceRoot,
|
|
38
6
|
environment,
|
|
@@ -44,13 +12,13 @@ const uploadRelease = async (projectName, {
|
|
|
44
12
|
const buildPath = `${workspaceRoot}/releases/builds/${projectName}-release.tar.gz`;
|
|
45
13
|
const appBuildPath = `${workspaceRoot}/releases/builds/${projectName}-appBuild.zip`;
|
|
46
14
|
const sourcePath = `${workspaceRoot}/releases/sources/${projectName}-source.tar.gz`;
|
|
47
|
-
const formData = new
|
|
48
|
-
const build =
|
|
49
|
-
const source =
|
|
50
|
-
const appBuild =
|
|
51
|
-
const buildStat =
|
|
52
|
-
const sourceStat =
|
|
53
|
-
const appBuildStat =
|
|
15
|
+
const formData = new FormData();
|
|
16
|
+
const build = fs.readFileSync(buildPath);
|
|
17
|
+
const source = fs.readFileSync(sourcePath);
|
|
18
|
+
const appBuild = fs.readFileSync(appBuildPath);
|
|
19
|
+
const buildStat = fs.statSync(buildPath);
|
|
20
|
+
const sourceStat = fs.statSync(sourcePath);
|
|
21
|
+
const appBuildStat = fs.statSync(appBuildPath);
|
|
54
22
|
formData.append("files", build, `${projectName}-release.tar.gz`);
|
|
55
23
|
formData.append("files", source, `${projectName}-source.tar.gz`);
|
|
56
24
|
formData.append("files", appBuild, `${projectName}-appBuild.zip`);
|
|
@@ -64,14 +32,14 @@ const uploadRelease = async (projectName, {
|
|
|
64
32
|
);
|
|
65
33
|
formData.append("type", "release");
|
|
66
34
|
try {
|
|
67
|
-
const [buildFile, sourceFile, appBuildFile] = (await
|
|
35
|
+
const [buildFile, sourceFile, appBuildFile] = (await axios.post(`${basePath}/file/addFilesRestApi`, formData)).data;
|
|
68
36
|
const major = platformVersion ? parseInt(platformVersion.split(".")[0]) : 1;
|
|
69
37
|
const minor = platformVersion ? parseInt(platformVersion.split(".")[1]) : 0;
|
|
70
38
|
const patch = platformVersion ? parseInt(platformVersion.split(".")[2]) : 0;
|
|
71
|
-
const latestRelease = await
|
|
39
|
+
const latestRelease = await axios.get(
|
|
72
40
|
`${basePath}/release/findVersionRelease?appName=${projectName}&branch=${environment}&major=${major}&minor=${minor}`
|
|
73
41
|
);
|
|
74
|
-
const release = (await
|
|
42
|
+
const release = (await axios.post(
|
|
75
43
|
`${basePath}/release/pushRelease/${projectName}/${environment}/${major}/${minor}/${sourceFile.id}/${buildFile.id}/${appBuildFile.id}`
|
|
76
44
|
)).data;
|
|
77
45
|
return release;
|
|
@@ -79,7 +47,6 @@ const uploadRelease = async (projectName, {
|
|
|
79
47
|
return null;
|
|
80
48
|
}
|
|
81
49
|
};
|
|
82
|
-
|
|
83
|
-
0 && (module.exports = {
|
|
50
|
+
export {
|
|
84
51
|
uploadRelease
|
|
85
|
-
}
|
|
52
|
+
};
|
package/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src";
|
package/src/auth.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import {
|
|
3
|
-
akanCloudBackendUrl,
|
|
4
|
-
akanCloudHost,
|
|
5
|
-
basePath,
|
|
6
|
-
configPath,
|
|
7
|
-
defaultAkanGlobalConfig,
|
|
8
|
-
defaultHostConfig
|
|
9
|
-
} from "./constants";
|
|
10
|
-
const getAkanGlobalConfig = () => {
|
|
11
|
-
const akanConfig = fs.existsSync(configPath) ? JSON.parse(fs.readFileSync(configPath, "utf8")) : defaultAkanGlobalConfig;
|
|
12
|
-
return akanConfig;
|
|
13
|
-
};
|
|
14
|
-
const setAkanGlobalConfig = (akanConfig) => {
|
|
15
|
-
fs.mkdirSync(basePath, { recursive: true });
|
|
16
|
-
fs.writeFileSync(configPath, JSON.stringify(akanConfig, null, 2));
|
|
17
|
-
};
|
|
18
|
-
const getHostConfig = (host = akanCloudHost) => {
|
|
19
|
-
const akanConfig = getAkanGlobalConfig();
|
|
20
|
-
return akanConfig.cloudHost[host] ?? defaultHostConfig;
|
|
21
|
-
};
|
|
22
|
-
const setHostConfig = (host = akanCloudHost, config = {}) => {
|
|
23
|
-
const akanConfig = getAkanGlobalConfig();
|
|
24
|
-
akanConfig[host] = config;
|
|
25
|
-
setAkanGlobalConfig(akanConfig);
|
|
26
|
-
};
|
|
27
|
-
const getSelf = async (token) => {
|
|
28
|
-
try {
|
|
29
|
-
const res = await fetch(`${akanCloudBackendUrl}/user/getSelf`, { headers: { Authorization: `Bearer ${token}` } });
|
|
30
|
-
const user = await res.json();
|
|
31
|
-
return user;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
getAkanGlobalConfig,
|
|
38
|
-
getHostConfig,
|
|
39
|
-
getSelf,
|
|
40
|
-
setAkanGlobalConfig,
|
|
41
|
-
setHostConfig
|
|
42
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const getTargetMetas = (command) => {
|
|
2
|
-
const targetMetaMap = Reflect.getMetadata("target", command.prototype);
|
|
3
|
-
if (!targetMetaMap)
|
|
4
|
-
throw new Error(`TargetMeta is not defined for ${command.name}`);
|
|
5
|
-
return [...targetMetaMap.values()];
|
|
6
|
-
};
|
|
7
|
-
const getTargetMetaMapOnPrototype = (prototype) => {
|
|
8
|
-
const targetMetaMap = Reflect.getMetadata("target", prototype);
|
|
9
|
-
return targetMetaMap ?? /* @__PURE__ */ new Map();
|
|
10
|
-
};
|
|
11
|
-
const setTargetMetaMapOnPrototype = (prototype, targetMetaMap) => {
|
|
12
|
-
Reflect.defineMetadata("target", targetMetaMap, prototype);
|
|
13
|
-
};
|
|
14
|
-
const getTarget = (type) => (targetOption = {}) => {
|
|
15
|
-
return (prototype, key, descriptor) => {
|
|
16
|
-
const metadataMap = getTargetMetaMapOnPrototype(prototype);
|
|
17
|
-
metadataMap.set(key, {
|
|
18
|
-
key,
|
|
19
|
-
descriptor,
|
|
20
|
-
targetOption: { ...targetOption, type }
|
|
21
|
-
});
|
|
22
|
-
setTargetMetaMapOnPrototype(prototype, metadataMap);
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const Target = {
|
|
26
|
-
Public: getTarget("public"),
|
|
27
|
-
Cloud: getTarget("cloud"),
|
|
28
|
-
Dev: getTarget("dev")
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
Target,
|
|
32
|
-
getTargetMetas
|
|
33
|
-
};
|
|
File without changes
|
package/src/constants.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { homedir } from "os";
|
|
2
|
-
const basePath = `${homedir()}/.akan`;
|
|
3
|
-
const configPath = `${basePath}/config.json`;
|
|
4
|
-
const akanCloudHost = process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? "http://localhost" : "https://akasys-debug.akamir.com";
|
|
5
|
-
//! Temp
|
|
6
|
-
const akanCloudBackendUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":8080" : ""}/backend`;
|
|
7
|
-
const akanCloudClientUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":4200" : ""}`;
|
|
8
|
-
const defaultHostConfig = {};
|
|
9
|
-
const defaultAkanGlobalConfig = { cloudHost: {}, llm: null };
|
|
10
|
-
export {
|
|
11
|
-
akanCloudBackendUrl,
|
|
12
|
-
akanCloudClientUrl,
|
|
13
|
-
akanCloudHost,
|
|
14
|
-
basePath,
|
|
15
|
-
configPath,
|
|
16
|
-
defaultAkanGlobalConfig,
|
|
17
|
-
defaultHostConfig
|
|
18
|
-
};
|
package/src/createTunnel.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createTunnel as create } from "tunnel-ssh";
|
|
2
|
-
const getSshTunnelOptions = (app, environment) => {
|
|
3
|
-
const { serveDomain, repoName } = app.workspace.getBaseDevEnv();
|
|
4
|
-
return {
|
|
5
|
-
host: `${app.name}-${environment}.${serveDomain}`,
|
|
6
|
-
port: process.env.SSH_TUNNEL_PORT ? parseInt(process.env.SSH_TUNNEL_PORT) : 32767,
|
|
7
|
-
username: process.env.SSH_TUNNEL_USERNAME ?? "root",
|
|
8
|
-
password: process.env.SSH_TUNNEL_PASSWORD ?? repoName
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
const createTunnel = async ({ app, environment, port = 27017 }) => {
|
|
12
|
-
const tunnelOptions = { autoClose: true, reconnectOnError: true };
|
|
13
|
-
const sshOptions = getSshTunnelOptions(app, environment);
|
|
14
|
-
const serverOptions = { port };
|
|
15
|
-
const forwardOptions = {
|
|
16
|
-
srcAddr: "0.0.0.0",
|
|
17
|
-
srcPort: port,
|
|
18
|
-
dstAddr: `mongo-0.mongo-svc.${app.name}-${environment}`,
|
|
19
|
-
dstPort: 27017
|
|
20
|
-
};
|
|
21
|
-
const [server, client] = await create(tunnelOptions, serverOptions, sshOptions, forwardOptions);
|
|
22
|
-
return `localhost:${port}`;
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
createTunnel
|
|
26
|
-
};
|
package/src/getCredentials.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import yaml from "js-yaml";
|
|
3
|
-
const getCredentials = (app, environment) => {
|
|
4
|
-
const secret = yaml.load(
|
|
5
|
-
fs.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8")
|
|
6
|
-
);
|
|
7
|
-
return secret[environment];
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
getCredentials
|
|
11
|
-
};
|
package/src/getModelFileData.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
const getModelFileData = (modulePath, modelName) => {
|
|
3
|
-
const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
|
|
4
|
-
const moduleName = modulePath.split("/")[1];
|
|
5
|
-
const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
|
|
6
|
-
const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
|
|
7
|
-
const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
|
|
8
|
-
const constantFileStr = fs.readFileSync(constantFilePath, "utf8");
|
|
9
|
-
const unitFileStr = fs.readFileSync(unitFilePath, "utf8");
|
|
10
|
-
const viewFileStr = fs.readFileSync(viewFilePath, "utf8");
|
|
11
|
-
const constantFileLines = constantFileStr.split("\n");
|
|
12
|
-
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
13
|
-
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
14
|
-
const importModelNames = importLocalPaths.map((path) => path.split("/")[1]).filter((name) => !name.startsWith("_"));
|
|
15
|
-
const hasImportScalar = !!importLocalPaths.map((path) => path.split("/")[1]).filter((name) => name.startsWith("_")).length;
|
|
16
|
-
return {
|
|
17
|
-
moduleType,
|
|
18
|
-
moduleName,
|
|
19
|
-
modelName,
|
|
20
|
-
constantFilePath,
|
|
21
|
-
unitFilePath,
|
|
22
|
-
viewFilePath,
|
|
23
|
-
importModelNames,
|
|
24
|
-
hasImportScalar,
|
|
25
|
-
importLibNames,
|
|
26
|
-
constantFileStr,
|
|
27
|
-
unitFileStr,
|
|
28
|
-
viewFileStr
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
getModelFileData
|
|
33
|
-
};
|
package/src/index.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from "./createTunnel";
|
|
2
|
-
export * from "./getCredentials";
|
|
3
|
-
export * from "./uploadRelease";
|
|
4
|
-
export * from "./getModelFileData";
|
|
5
|
-
export * from "./getRelatedCnsts";
|
|
6
|
-
export * from "./selectModel";
|
|
7
|
-
export * from "./streamAi";
|
|
8
|
-
export * from "./executors";
|
|
9
|
-
export * from "./dependencyScanner";
|
|
10
|
-
export * from "./constants";
|
|
11
|
-
export * from "./auth";
|
|
12
|
-
export * from "./types";
|
|
13
|
-
export * from "./capacitorApp";
|
|
14
|
-
export * from "./extractDeps";
|
|
15
|
-
export * from "./commandDecorators";
|
|
16
|
-
export * from "./aiEditor";
|
|
17
|
-
export * from "./builder";
|
package/src/selectModel.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { select } from "@inquirer/prompts";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
const selectModel = async (modulePath) => {
|
|
4
|
-
const modelNames = fs.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
5
|
-
const modelName = await select({
|
|
6
|
-
message: "Select the model to create the unit for",
|
|
7
|
-
choices: modelNames.map((name) => ({ name, value: name }))
|
|
8
|
-
});
|
|
9
|
-
return modelName;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
selectModel
|
|
13
|
-
};
|
package/src/streamAi.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { PromptTemplate } from "@langchain/core/prompts";
|
|
2
|
-
import { RunnableSequence } from "@langchain/core/runnables";
|
|
3
|
-
import { ChatOpenAI } from "@langchain/openai";
|
|
4
|
-
const streamAi = async (question, callback = (chunk) => {
|
|
5
|
-
process.stdout.write(chunk);
|
|
6
|
-
}) => {
|
|
7
|
-
const createStreamingModel = (apiKey = process.env.DEEPSEEK_API_KEY) => {
|
|
8
|
-
if (!apiKey)
|
|
9
|
-
throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
|
|
10
|
-
return new ChatOpenAI({
|
|
11
|
-
modelName: "deepseek-reasoner",
|
|
12
|
-
temperature: 0.7,
|
|
13
|
-
streaming: true,
|
|
14
|
-
// Enable streaming
|
|
15
|
-
configuration: { baseURL: "https://api.deepseek.com/v1", apiKey }
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
const createProcessingChain = () => {
|
|
19
|
-
return RunnableSequence.from([PromptTemplate.fromTemplate(`Answer concisely: {question}`), createStreamingModel()]);
|
|
20
|
-
};
|
|
21
|
-
try {
|
|
22
|
-
const chain = createProcessingChain();
|
|
23
|
-
const stream = await chain.stream({ question });
|
|
24
|
-
let fullResponse = "";
|
|
25
|
-
for await (const chunk of stream) {
|
|
26
|
-
const content = chunk.content;
|
|
27
|
-
if (typeof content === "string") {
|
|
28
|
-
fullResponse += content;
|
|
29
|
-
callback(content);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return { content: fullResponse };
|
|
33
|
-
} catch (error) {
|
|
34
|
-
throw new Error("Failed to stream response");
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
streamAi
|
|
39
|
-
};
|
package/src/types.mjs
DELETED
|
File without changes
|
package/src/uploadRelease.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import FormData from "form-data";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
const uploadRelease = async (projectName, {
|
|
5
|
-
workspaceRoot,
|
|
6
|
-
environment,
|
|
7
|
-
buildNum,
|
|
8
|
-
platformVersion,
|
|
9
|
-
local
|
|
10
|
-
}) => {
|
|
11
|
-
const basePath = local ? "http://localhost:8080/backend" : "https://akasys.akamir.com/backend";
|
|
12
|
-
const buildPath = `${workspaceRoot}/releases/builds/${projectName}-release.tar.gz`;
|
|
13
|
-
const appBuildPath = `${workspaceRoot}/releases/builds/${projectName}-appBuild.zip`;
|
|
14
|
-
const sourcePath = `${workspaceRoot}/releases/sources/${projectName}-source.tar.gz`;
|
|
15
|
-
const formData = new FormData();
|
|
16
|
-
const build = fs.readFileSync(buildPath);
|
|
17
|
-
const source = fs.readFileSync(sourcePath);
|
|
18
|
-
const appBuild = fs.readFileSync(appBuildPath);
|
|
19
|
-
const buildStat = fs.statSync(buildPath);
|
|
20
|
-
const sourceStat = fs.statSync(sourcePath);
|
|
21
|
-
const appBuildStat = fs.statSync(appBuildPath);
|
|
22
|
-
formData.append("files", build, `${projectName}-release.tar.gz`);
|
|
23
|
-
formData.append("files", source, `${projectName}-source.tar.gz`);
|
|
24
|
-
formData.append("files", appBuild, `${projectName}-appBuild.zip`);
|
|
25
|
-
formData.append(
|
|
26
|
-
"metas",
|
|
27
|
-
JSON.stringify([
|
|
28
|
-
{ lastModifiedAt: buildStat.mtime, size: buildStat.size },
|
|
29
|
-
{ lastModifiedAt: sourceStat.mtime, size: sourceStat.size },
|
|
30
|
-
{ lastModifiedAt: appBuildStat.mtime, size: appBuildStat.size }
|
|
31
|
-
])
|
|
32
|
-
);
|
|
33
|
-
formData.append("type", "release");
|
|
34
|
-
try {
|
|
35
|
-
const [buildFile, sourceFile, appBuildFile] = (await axios.post(`${basePath}/file/addFilesRestApi`, formData)).data;
|
|
36
|
-
const major = platformVersion ? parseInt(platformVersion.split(".")[0]) : 1;
|
|
37
|
-
const minor = platformVersion ? parseInt(platformVersion.split(".")[1]) : 0;
|
|
38
|
-
const patch = platformVersion ? parseInt(platformVersion.split(".")[2]) : 0;
|
|
39
|
-
const latestRelease = await axios.get(
|
|
40
|
-
`${basePath}/release/findVersionRelease?appName=${projectName}&branch=${environment}&major=${major}&minor=${minor}`
|
|
41
|
-
);
|
|
42
|
-
const release = (await axios.post(
|
|
43
|
-
`${basePath}/release/pushRelease/${projectName}/${environment}/${major}/${minor}/${sourceFile.id}/${buildFile.id}/${appBuildFile.id}`
|
|
44
|
-
)).data;
|
|
45
|
-
return release;
|
|
46
|
-
} catch (e) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
export {
|
|
51
|
-
uploadRelease
|
|
52
|
-
};
|