@akanjs/devkit 0.0.89 → 0.0.91

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 (68) hide show
  1. package/index.js +21 -1
  2. package/index.mjs +1 -0
  3. package/package.json +5 -4
  4. package/src/aiEditor.d.ts +14 -0
  5. package/src/aiEditor.js +110 -21
  6. package/src/aiEditor.mjs +124 -0
  7. package/src/auth.js +48 -18
  8. package/src/auth.mjs +42 -0
  9. package/src/capacitorApp.js +42 -9
  10. package/src/{capacitorApp.cjs → capacitorApp.mjs} +9 -42
  11. package/src/commandDecorators/argMeta.js +34 -3
  12. package/src/commandDecorators/{argMeta.cjs → argMeta.mjs} +3 -34
  13. package/src/commandDecorators/command.js +68 -35
  14. package/src/commandDecorators/{command.cjs → command.mjs} +35 -68
  15. package/src/commandDecorators/commandMeta.js +25 -2
  16. package/src/commandDecorators/commandMeta.mjs +7 -0
  17. package/src/commandDecorators/index.js +29 -5
  18. package/src/commandDecorators/index.mjs +5 -0
  19. package/src/commandDecorators/targetMeta.js +26 -2
  20. package/src/commandDecorators/targetMeta.mjs +33 -0
  21. package/src/commandDecorators/types.js +15 -0
  22. package/src/commandDecorators/types.mjs +0 -0
  23. package/src/constants.d.ts +8 -1
  24. package/src/constants.js +34 -5
  25. package/src/constants.mjs +18 -0
  26. package/src/createTunnel.js +27 -4
  27. package/src/createTunnel.mjs +26 -0
  28. package/src/dependencyScanner.js +38 -5
  29. package/src/{dependencyScanner.cjs → dependencyScanner.mjs} +5 -38
  30. package/src/executors.d.ts +21 -1
  31. package/src/executors.js +172 -84
  32. package/src/{executors.cjs → executors.mjs} +138 -118
  33. package/src/extractDeps.js +25 -2
  34. package/src/{extractDeps.cjs → extractDeps.mjs} +2 -25
  35. package/src/getCredentials.js +39 -6
  36. package/src/getCredentials.mjs +11 -0
  37. package/src/getModelFileData.js +39 -6
  38. package/src/getModelFileData.mjs +33 -0
  39. package/src/getRelatedCnsts.d.ts +52 -8
  40. package/src/getRelatedCnsts.js +205 -54
  41. package/src/getRelatedCnsts.mjs +221 -0
  42. package/src/index.js +51 -16
  43. package/src/index.mjs +16 -0
  44. package/src/selectModel.js +39 -6
  45. package/src/selectModel.mjs +13 -0
  46. package/src/streamAi.js +30 -7
  47. package/src/streamAi.mjs +39 -0
  48. package/src/types.js +15 -0
  49. package/src/types.mjs +0 -0
  50. package/src/uploadRelease.js +48 -15
  51. package/src/uploadRelease.mjs +52 -0
  52. package/index.cjs +0 -21
  53. package/src/aiEditor.cjs +0 -92
  54. package/src/auth.cjs +0 -72
  55. package/src/commandDecorators/commandMeta.cjs +0 -30
  56. package/src/commandDecorators/index.cjs +0 -29
  57. package/src/commandDecorators/targetMeta.cjs +0 -57
  58. package/src/commandDecorators/types.cjs +0 -15
  59. package/src/constants.cjs +0 -47
  60. package/src/createTunnel.cjs +0 -49
  61. package/src/getCredentials.cjs +0 -44
  62. package/src/getModelFileData.cjs +0 -66
  63. package/src/getRelatedCnsts.cjs +0 -142
  64. package/src/index.cjs +0 -51
  65. package/src/selectModel.cjs +0 -46
  66. package/src/streamAi.cjs +0 -62
  67. package/src/types.cjs +0 -15
  68. package/src/uploadRelease.cjs +0 -85
@@ -0,0 +1,33 @@
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
+ };
@@ -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);
File without changes
@@ -1,3 +1,4 @@
1
+ import type { SupportedLlmModel } from "./aiEditor";
1
2
  export declare const basePath: string;
2
3
  export declare const configPath: string;
3
4
  export declare const akanCloudHost: string;
@@ -14,6 +15,12 @@ export interface HostConfig {
14
15
  }
15
16
  export declare const defaultHostConfig: HostConfig;
16
17
  export interface AkanGlobalConfig {
17
- [key: string]: HostConfig;
18
+ cloudHost: {
19
+ [key: string]: HostConfig;
20
+ };
21
+ llm: {
22
+ model: SupportedLlmModel;
23
+ apiKey: string;
24
+ } | null;
18
25
  }
19
26
  export declare const defaultAkanGlobalConfig: AkanGlobalConfig;
package/src/constants.js CHANGED
@@ -1,13 +1,42 @@
1
- import { homedir } from "os";
2
- const basePath = `${homedir()}/.akan`;
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`;
3
31
  const configPath = `${basePath}/config.json`;
4
32
  const akanCloudHost = process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? "http://localhost" : "https://akasys-debug.akamir.com";
5
33
  //! Temp
6
34
  const akanCloudBackendUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":8080" : ""}/backend`;
7
35
  const akanCloudClientUrl = `${akanCloudHost}${process.env.NEXT_PUBLIC_OPERATION_MODE === "local" ? ":4200" : ""}`;
8
36
  const defaultHostConfig = {};
9
- const defaultAkanGlobalConfig = {};
10
- export {
37
+ const defaultAkanGlobalConfig = { cloudHost: {}, llm: null };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
11
40
  akanCloudBackendUrl,
12
41
  akanCloudClientUrl,
13
42
  akanCloudHost,
@@ -15,4 +44,4 @@ export {
15
44
  configPath,
16
45
  defaultAkanGlobalConfig,
17
46
  defaultHostConfig
18
- };
47
+ });
@@ -0,0 +1,18 @@
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
+ };
@@ -1,4 +1,26 @@
1
- import { createTunnel as create } from "tunnel-ssh";
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");
2
24
  const getSshTunnelOptions = (app, environment) => {
3
25
  const { serveDomain, repoName } = app.workspace.getBaseDevEnv();
4
26
  return {
@@ -18,9 +40,10 @@ const createTunnel = async ({ app, environment, port = 27017 }) => {
18
40
  dstAddr: `mongo-0.mongo-svc.${app.name}-${environment}`,
19
41
  dstPort: 27017
20
42
  };
21
- const [server, client] = await create(tunnelOptions, serverOptions, sshOptions, forwardOptions);
43
+ const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
22
44
  return `localhost:${port}`;
23
45
  };
24
- export {
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
25
48
  createTunnel
26
- };
49
+ });
@@ -0,0 +1,26 @@
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
+ };
@@ -1,6 +1,38 @@
1
- import * as fs from "fs";
2
- import * as path from "path";
3
- import * as ts from "typescript";
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 dependencyScanner_exports = {};
29
+ __export(dependencyScanner_exports, {
30
+ TypeScriptDependencyScanner: () => TypeScriptDependencyScanner
31
+ });
32
+ module.exports = __toCommonJS(dependencyScanner_exports);
33
+ var fs = __toESM(require("fs"));
34
+ var path = __toESM(require("path"));
35
+ var ts = __toESM(require("typescript"));
4
36
  class TypeScriptDependencyScanner {
5
37
  constructor(directory) {
6
38
  this.directory = directory;
@@ -143,6 +175,7 @@ class TypeScriptDependencyScanner {
143
175
  return graph;
144
176
  }
145
177
  }
146
- export {
178
+ // Annotate the CommonJS export names for ESM import in node:
179
+ 0 && (module.exports = {
147
180
  TypeScriptDependencyScanner
148
- };
181
+ });
@@ -1,38 +1,6 @@
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 dependencyScanner_exports = {};
29
- __export(dependencyScanner_exports, {
30
- TypeScriptDependencyScanner: () => TypeScriptDependencyScanner
31
- });
32
- module.exports = __toCommonJS(dependencyScanner_exports);
33
- var fs = __toESM(require("fs"), 1);
34
- var path = __toESM(require("path"), 1);
35
- var ts = __toESM(require("typescript"), 1);
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import * as ts from "typescript";
36
4
  class TypeScriptDependencyScanner {
37
5
  constructor(directory) {
38
6
  this.directory = directory;
@@ -175,7 +143,6 @@ class TypeScriptDependencyScanner {
175
143
  return graph;
176
144
  }
177
145
  }
178
- // Annotate the CommonJS export names for ESM import in node:
179
- 0 && (module.exports = {
146
+ export {
180
147
  TypeScriptDependencyScanner
181
- });
148
+ };
@@ -61,6 +61,7 @@ export declare class WorkspaceExecutor extends Executor {
61
61
  getSyss(): Promise<[string[], string[]]>;
62
62
  getPkgs(): Promise<string[]>;
63
63
  setTsPaths(type: "app" | "lib", name: string): this;
64
+ getDirInModule(basePath: string, name: string): Promise<string[]>;
64
65
  commit(message: string, { init, add }?: {
65
66
  init?: boolean;
66
67
  add?: boolean;
@@ -69,6 +70,10 @@ export declare class WorkspaceExecutor extends Executor {
69
70
  filepath: string;
70
71
  content: string;
71
72
  }[]>;
73
+ getViewFiles(): Promise<{
74
+ filepath: string;
75
+ content: string;
76
+ }[]>;
72
77
  }
73
78
  interface SysExecutorOptions {
74
79
  workspace?: WorkspaceExecutor;
@@ -81,6 +86,7 @@ export declare class SysExecutor extends Executor {
81
86
  type: "app" | "lib";
82
87
  constructor({ workspace, name, type }: SysExecutorOptions);
83
88
  getConfig(command?: string): Promise<LibConfigResult>;
89
+ getModules(): Promise<string[]>;
84
90
  scan({ tsconfig, akanConfig, }: {
85
91
  tsconfig?: TsConfigJson;
86
92
  akanConfig: AppConfigResult | LibConfigResult;
@@ -94,7 +100,21 @@ export declare class SysExecutor extends Executor {
94
100
  getDatabaseModules(): Promise<string[]>;
95
101
  getServiceModules(): Promise<string[]>;
96
102
  getScalarModules(): Promise<string[]>;
97
- getViewModules(): Promise<string[]>;
103
+ getViewComponents(): Promise<string[]>;
104
+ getUnitComponents(): Promise<string[]>;
105
+ getTemplateComponents(): Promise<string[]>;
106
+ getViewsSourceCode(): Promise<{
107
+ filepath: string;
108
+ content: string;
109
+ }[]>;
110
+ getUnitsSourceCode(): Promise<{
111
+ filepath: string;
112
+ content: string;
113
+ }[]>;
114
+ getTemplatesSourceCode(): Promise<{
115
+ filepath: string;
116
+ content: string;
117
+ }[]>;
98
118
  getScalarConstantFiles(): Promise<{
99
119
  filepath: string;
100
120
  content: string;