@akanjs/devkit 0.0.54 → 0.0.56
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 +17 -0
- package/package.json +22 -2
- package/src/aiEditor.cjs +46 -0
- package/src/auth.cjs +64 -0
- package/src/baseDevEnv.cjs +45 -0
- package/src/capacitorApp.cjs +153 -0
- package/src/commandDecorators/argMeta.cjs +67 -0
- package/src/commandDecorators/command.cjs +160 -0
- package/src/commandDecorators/commandMeta.cjs +26 -0
- package/src/commandDecorators/index.cjs +21 -0
- package/src/commandDecorators/targetMeta.cjs +52 -0
- package/src/commandDecorators/types.cjs +15 -0
- package/src/constants.cjs +37 -0
- package/src/createTunnel.cjs +37 -0
- package/src/dependencyScanner.cjs +159 -0
- package/src/dependencyScanner.js +0 -0
- package/src/executors.cjs +592 -0
- package/src/extractDeps.cjs +99 -0
- package/src/getCredentials.cjs +40 -0
- package/src/getDependencies.cjs +51 -0
- package/src/getModelFileData.cjs +62 -0
- package/src/getRelatedCnsts.cjs +138 -0
- package/src/index.cjs +34 -0
- package/src/installExternalLib.cjs +29 -0
- package/src/selectModel.cjs +42 -0
- package/src/streamAi.cjs +56 -0
- package/src/types.cjs +15 -0
- package/src/types.d.ts +1 -0
- package/src/uploadRelease.cjs +81 -0
|
@@ -0,0 +1,40 @@
|
|
|
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 getCredentials_exports = {};
|
|
29
|
+
__export(getCredentials_exports, {
|
|
30
|
+
getCredentials: () => getCredentials
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getCredentials_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
34
|
+
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
35
|
+
const getCredentials = (app, environment) => {
|
|
36
|
+
const secret = import_js_yaml.default.load(
|
|
37
|
+
import_fs.default.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8")
|
|
38
|
+
);
|
|
39
|
+
return secret[environment];
|
|
40
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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 getDependencies_exports = {};
|
|
19
|
+
__export(getDependencies_exports, {
|
|
20
|
+
getDependencies: () => getDependencies
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(getDependencies_exports);
|
|
23
|
+
var import_devkit = require("@nx/devkit");
|
|
24
|
+
const addLibDepSet = (depName, { libDepSet, npmDepSet, dependencies }) => {
|
|
25
|
+
const deps = dependencies[depName];
|
|
26
|
+
if (!deps)
|
|
27
|
+
throw new Error(`No dependencies found for project or library ${depName}`);
|
|
28
|
+
for (const dep of deps) {
|
|
29
|
+
if (dep.target.startsWith("npm:"))
|
|
30
|
+
npmDepSet.add(dep.target);
|
|
31
|
+
else if (libDepSet.has(dep.target))
|
|
32
|
+
continue;
|
|
33
|
+
else {
|
|
34
|
+
libDepSet.add(dep.target);
|
|
35
|
+
addLibDepSet(dep.target, { libDepSet, npmDepSet, dependencies });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getDependencies = async (projectName) => {
|
|
40
|
+
const graph = await (0, import_devkit.createProjectGraphAsync)();
|
|
41
|
+
const [libDepSet, npmDepSet] = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
|
|
42
|
+
const dependencies = graph.dependencies;
|
|
43
|
+
const projectDeps = dependencies[projectName];
|
|
44
|
+
if (!projectDeps)
|
|
45
|
+
throw new Error(`No dependencies found for project ${projectName}`);
|
|
46
|
+
addLibDepSet(projectName, { libDepSet, npmDepSet, dependencies });
|
|
47
|
+
return {
|
|
48
|
+
libDeps: [...libDepSet.values()],
|
|
49
|
+
npmDeps: [...npmDepSet.values()].map((depName) => depName.replace("npm:", ""))
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 getModelFileData_exports = {};
|
|
29
|
+
__export(getModelFileData_exports, {
|
|
30
|
+
getModelFileData: () => getModelFileData
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getModelFileData_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
34
|
+
const getModelFileData = (modulePath, modelName) => {
|
|
35
|
+
const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
|
|
36
|
+
const moduleName = modulePath.split("/")[1];
|
|
37
|
+
const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
|
|
38
|
+
const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
|
|
39
|
+
const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
|
|
40
|
+
const constantFileStr = import_fs.default.readFileSync(constantFilePath, "utf8");
|
|
41
|
+
const unitFileStr = import_fs.default.readFileSync(unitFilePath, "utf8");
|
|
42
|
+
const viewFileStr = import_fs.default.readFileSync(viewFilePath, "utf8");
|
|
43
|
+
const constantFileLines = constantFileStr.split("\n");
|
|
44
|
+
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
45
|
+
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
46
|
+
const importModelNames = importLocalPaths.map((path) => path.split("/")[1]).filter((name) => !name.startsWith("_"));
|
|
47
|
+
const hasImportScalar = !!importLocalPaths.map((path) => path.split("/")[1]).filter((name) => name.startsWith("_")).length;
|
|
48
|
+
return {
|
|
49
|
+
moduleType,
|
|
50
|
+
moduleName,
|
|
51
|
+
modelName,
|
|
52
|
+
constantFilePath,
|
|
53
|
+
unitFilePath,
|
|
54
|
+
viewFilePath,
|
|
55
|
+
importModelNames,
|
|
56
|
+
hasImportScalar,
|
|
57
|
+
importLibNames,
|
|
58
|
+
constantFileStr,
|
|
59
|
+
unitFileStr,
|
|
60
|
+
viewFileStr
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
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 getRelatedCnsts_exports = {};
|
|
29
|
+
__export(getRelatedCnsts_exports, {
|
|
30
|
+
getRelatedCnsts: () => getRelatedCnsts
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getRelatedCnsts_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
34
|
+
var import_ora = __toESM(require("ora"), 1);
|
|
35
|
+
var ts = __toESM(require("typescript"), 1);
|
|
36
|
+
const getRelatedCnsts = (constantFilePath) => {
|
|
37
|
+
const tsConfigPath = `./tsconfig.json`;
|
|
38
|
+
const configFile = ts.readConfigFile(tsConfigPath, (path) => {
|
|
39
|
+
return ts.sys.readFile(path);
|
|
40
|
+
});
|
|
41
|
+
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
42
|
+
configFile.config,
|
|
43
|
+
ts.sys,
|
|
44
|
+
import_fs.default.realpathSync(tsConfigPath).replace(/[^/\\]+$/, "")
|
|
45
|
+
);
|
|
46
|
+
const propertyMap = /* @__PURE__ */ new Map();
|
|
47
|
+
function findPropertyOriginAll(filePath) {
|
|
48
|
+
const program = ts.createProgram([filePath], parsedConfig.options);
|
|
49
|
+
const checker = program.getTypeChecker();
|
|
50
|
+
const source = program.getSourceFile(filePath);
|
|
51
|
+
if (!source)
|
|
52
|
+
return null;
|
|
53
|
+
function visit(node) {
|
|
54
|
+
if (!source)
|
|
55
|
+
return;
|
|
56
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
57
|
+
const left = node.expression;
|
|
58
|
+
const right = node.name;
|
|
59
|
+
const { line } = ts.getLineAndCharacterOfPosition(source, node.getStart());
|
|
60
|
+
//!Field.Prop 거르기가 빡세네.
|
|
61
|
+
const sourceLines = source.getFullText().split("\n");
|
|
62
|
+
if (ts.isIdentifier(left) && sourceLines.length && (sourceLines[line].includes(`@Field.Prop(() => ${left.text}.${right.text}`) || sourceLines[line].includes(`base.Filter(${left.text}.${right.text},`))) {
|
|
63
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
64
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
65
|
+
const key = symbol.declarations[0].getSourceFile().fileName.split("/").pop()?.split(".")[0] ?? "";
|
|
66
|
+
const property = propertyMap.get(key);
|
|
67
|
+
const isScalar = symbol.declarations[0].getSourceFile().fileName.includes("_");
|
|
68
|
+
const filePath2 = symbol.declarations[0].getSourceFile().fileName.replace(`${ts.sys.getCurrentDirectory()}/`, "");
|
|
69
|
+
if (property) {
|
|
70
|
+
propertyMap.set(`${left.text}.${right.text}`, {
|
|
71
|
+
filePath: filePath2,
|
|
72
|
+
isLibModule: true,
|
|
73
|
+
isImport: false,
|
|
74
|
+
libName: left.text,
|
|
75
|
+
isScalar
|
|
76
|
+
});
|
|
77
|
+
} else
|
|
78
|
+
propertyMap.set(key, {
|
|
79
|
+
filePath: filePath2,
|
|
80
|
+
isLibModule: true,
|
|
81
|
+
isImport: false,
|
|
82
|
+
libName: left.text,
|
|
83
|
+
isScalar
|
|
84
|
+
});
|
|
85
|
+
findPropertyOriginAll(filePath2);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} else if (ts.isImportDeclaration(node)) {
|
|
89
|
+
const importPath = node.moduleSpecifier.getText().slice(1, -1);
|
|
90
|
+
if (importPath.startsWith(".")) {
|
|
91
|
+
const resolved = ts.resolveModuleName(importPath, filePath, parsedConfig.options, ts.sys).resolvedModule?.resolvedFileName;
|
|
92
|
+
const moduleName = importPath.split("/").pop()?.split(".")[0] ?? "";
|
|
93
|
+
const property = propertyMap.get(moduleName);
|
|
94
|
+
const isScalar = importPath.includes("_");
|
|
95
|
+
if (moduleName && resolved && (!property || property.filePath !== resolved)) {
|
|
96
|
+
propertyMap.set(moduleName, {
|
|
97
|
+
filePath: resolved,
|
|
98
|
+
isLibModule: false,
|
|
99
|
+
isImport: true,
|
|
100
|
+
isScalar
|
|
101
|
+
});
|
|
102
|
+
findPropertyOriginAll(resolved);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ts.forEachChild(node, visit);
|
|
107
|
+
}
|
|
108
|
+
visit(source);
|
|
109
|
+
return propertyMap;
|
|
110
|
+
}
|
|
111
|
+
function findPropertyOrigin(filePath, aliasName, libName) {
|
|
112
|
+
const program = ts.createProgram([filePath], parsedConfig.options);
|
|
113
|
+
const checker = program.getTypeChecker();
|
|
114
|
+
const source = program.getSourceFile(filePath);
|
|
115
|
+
const propertyMap2 = /* @__PURE__ */ new Map();
|
|
116
|
+
if (!source)
|
|
117
|
+
return null;
|
|
118
|
+
function visit(node) {
|
|
119
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
120
|
+
const left = node.expression;
|
|
121
|
+
const right = node.name;
|
|
122
|
+
if (ts.isIdentifier(left) && left.text === aliasName && right.text === libName) {
|
|
123
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
124
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
125
|
+
return symbol.declarations[0].getSourceFile().fileName;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return ts.forEachChild(node, visit) || null;
|
|
130
|
+
}
|
|
131
|
+
return visit(source);
|
|
132
|
+
}
|
|
133
|
+
const spinner = (0, import_ora.default)("Finding property origin...");
|
|
134
|
+
spinner.start();
|
|
135
|
+
const paths = findPropertyOriginAll(constantFilePath);
|
|
136
|
+
spinner.succeed("property origin found.");
|
|
137
|
+
return { paths };
|
|
138
|
+
};
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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 src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./baseDevEnv"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./createTunnel"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./getCredentials"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./getDependencies"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./uploadRelease"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./getModelFileData"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./getRelatedCnsts"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./selectModel"), module.exports);
|
|
25
|
+
__reExport(src_exports, require("./streamAi"), module.exports);
|
|
26
|
+
__reExport(src_exports, require("./executors"), module.exports);
|
|
27
|
+
__reExport(src_exports, require("./dependencyScanner"), module.exports);
|
|
28
|
+
__reExport(src_exports, require("./constants"), module.exports);
|
|
29
|
+
__reExport(src_exports, require("./auth"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
31
|
+
__reExport(src_exports, require("./capacitorApp"), module.exports);
|
|
32
|
+
__reExport(src_exports, require("./extractDeps"), module.exports);
|
|
33
|
+
__reExport(src_exports, require("./commandDecorators"), module.exports);
|
|
34
|
+
__reExport(src_exports, require("./installExternalLib"), module.exports);
|
|
@@ -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 __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 installExternalLib_exports = {};
|
|
19
|
+
__export(installExternalLib_exports, {
|
|
20
|
+
installExternalLib: () => installExternalLib
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(installExternalLib_exports);
|
|
23
|
+
const utilGitRepo = "git@github.com:akan-team/util.git";
|
|
24
|
+
const sharedGitRepo = "git@github.com:akan-team/shared.git";
|
|
25
|
+
const installExternalLib = async (libName, workspace) => {
|
|
26
|
+
workspace.log(`Installing ${libName} library as git subtree...`);
|
|
27
|
+
await workspace.exec(`git remote add ${libName} git@github.com:akan-team/${libName}.git`);
|
|
28
|
+
await workspace.exec(`git subtree add --prefix=libs/${libName} ${libName} main`);
|
|
29
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 selectModel_exports = {};
|
|
29
|
+
__export(selectModel_exports, {
|
|
30
|
+
selectModel: () => selectModel
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(selectModel_exports);
|
|
33
|
+
var import_prompts = require("@inquirer/prompts");
|
|
34
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
35
|
+
const selectModel = async (modulePath) => {
|
|
36
|
+
const modelNames = import_fs.default.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
37
|
+
const modelName = await (0, import_prompts.select)({
|
|
38
|
+
message: "Select the model to create the unit for",
|
|
39
|
+
choices: modelNames.map((name) => ({ name, value: name }))
|
|
40
|
+
});
|
|
41
|
+
return modelName;
|
|
42
|
+
};
|
package/src/streamAi.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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 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");
|
|
26
|
+
const streamAi = async (question, callback) => {
|
|
27
|
+
const createStreamingModel = (apiKey = process.env.DEEPSEEK_API_KEY) => {
|
|
28
|
+
if (!apiKey)
|
|
29
|
+
throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
|
|
30
|
+
return new import_openai.ChatOpenAI({
|
|
31
|
+
modelName: "deepseek-reasoner",
|
|
32
|
+
temperature: 0.7,
|
|
33
|
+
streaming: true,
|
|
34
|
+
// Enable streaming
|
|
35
|
+
configuration: { baseURL: "https://api.deepseek.com/v1", apiKey }
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const createProcessingChain = () => {
|
|
39
|
+
return import_runnables.RunnableSequence.from([import_prompts.PromptTemplate.fromTemplate(`Answer concisely: {question}`), createStreamingModel()]);
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const chain = createProcessingChain();
|
|
43
|
+
const stream = await chain.stream({ question });
|
|
44
|
+
let fullResponse = "";
|
|
45
|
+
for await (const chunk of stream) {
|
|
46
|
+
const content = chunk.content;
|
|
47
|
+
if (typeof content === "string") {
|
|
48
|
+
fullResponse += content;
|
|
49
|
+
callback(content);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { content: fullResponse };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
throw new Error("Failed to stream response");
|
|
55
|
+
}
|
|
56
|
+
};
|
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.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface PackageJson {
|
|
|
9
9
|
devDependencies?: Record<string, string>;
|
|
10
10
|
peerDependencies?: Record<string, string>;
|
|
11
11
|
engines?: Record<string, string>;
|
|
12
|
+
exports?: Record<string, Record<string, string>>;
|
|
12
13
|
}
|
|
13
14
|
export interface TsConfigJson {
|
|
14
15
|
extends?: string;
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
};
|