@tego/core 1.3.44 → 1.3.46

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.
@@ -86,12 +86,18 @@ const _AesEncryptor = class _AesEncryptor {
86
86
  }
87
87
  }
88
88
  static async getKeyPath(appName) {
89
- const appKeyPath = import_node_path.default.resolve(process.cwd(), "storage", "apps", appName, "aes_key.dat");
89
+ const appKeyPath = import_node_path.default.resolve(process.env.TEGO_RUNTIME_HOME, "storage", "apps", appName, "aes_key.dat");
90
90
  const appKeyExists = await import_fs_extra.default.exists(appKeyPath);
91
91
  if (appKeyExists) {
92
92
  return appKeyPath;
93
93
  }
94
- const envKeyPath = import_node_path.default.resolve(process.cwd(), "storage", "environment-variables", appName, "aes_key.dat");
94
+ const envKeyPath = import_node_path.default.resolve(
95
+ process.env.TEGO_RUNTIME_HOME,
96
+ "storage",
97
+ "environment-variables",
98
+ appName,
99
+ "aes_key.dat"
100
+ );
95
101
  const envKeyExists = await import_fs_extra.default.exists(envKeyPath);
96
102
  if (envKeyExists) {
97
103
  return envKeyPath;
@@ -40,7 +40,7 @@ var start_default = /* @__PURE__ */ __name((app) => {
40
40
  app.command("start").auth().option("--db-sync").option("--quickstart").action(async (...cliArgs) => {
41
41
  const [options] = cliArgs;
42
42
  app.logger.debug("start options", options);
43
- const file = (0, import_node_path.resolve)(process.cwd(), "storage/app-upgrading");
43
+ const file = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, "storage/app-upgrading");
44
44
  const upgrading = await (0, import_utils.fsExists)(file);
45
45
  if (upgrading) {
46
46
  await app.upgrade();
@@ -71,12 +71,12 @@ const _Gateway = class _Gateway extends import_node_events.EventEmitter {
71
71
  this.ipcSocketServer = null;
72
72
  __privateAdd(this, _port, process.env.APP_PORT ? parseInt(process.env.APP_PORT) : null);
73
73
  __privateAdd(this, _host, "0.0.0.0");
74
- this.socketPath = (0, import_node_path.resolve)(process.cwd(), "storage", "gateway.sock");
74
+ this.socketPath = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, "storage", "gateway.sock");
75
75
  this.handlers = /* @__PURE__ */ new Map();
76
76
  this.loggers = new import_utils.Registry();
77
77
  this.reset();
78
78
  if (process.env.SOCKET_PATH) {
79
- this.socketPath = (0, import_node_path.resolve)(process.cwd(), process.env.SOCKET_PATH);
79
+ this.socketPath = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, process.env.SOCKET_PATH);
80
80
  }
81
81
  }
82
82
  static getInstance(options = {}) {
@@ -163,16 +163,11 @@ const _Gateway = class _Gateway extends import_node_events.EventEmitter {
163
163
  }
164
164
  const { pathname } = (0, import_node_url.parse)(req.url);
165
165
  const { PLUGIN_STATICS_PATH, APP_PUBLIC_PATH } = process.env;
166
- if (pathname.endsWith("/__umi/api/bundle-status")) {
167
- res.statusCode = 200;
168
- res.end("ok");
169
- return;
170
- }
171
166
  if (pathname.startsWith(APP_PUBLIC_PATH + "storage/uploads/")) {
172
167
  req.url = req.url.substring(APP_PUBLIC_PATH.length - 1);
173
168
  await compress(req, res);
174
169
  return (0, import_serve_handler.default)(req, res, {
175
- public: (0, import_node_path.resolve)(process.cwd()),
170
+ public: (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME),
176
171
  directoryListing: false
177
172
  });
178
173
  }
@@ -255,7 +250,7 @@ const _Gateway = class _Gateway extends import_node_events.EventEmitter {
255
250
  if (!process.env.IS_DEV_CMD) {
256
251
  return;
257
252
  }
258
- const file = (0, import_node_path.resolve)(process.cwd(), "storage/app.watch.ts");
253
+ const file = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, "storage/app.watch.ts");
259
254
  if (!import_node_fs.default.existsSync(file)) {
260
255
  await import_node_fs.default.promises.writeFile(file, `export const watchId = '${(0, import_utils.uid)()}';`, "utf-8");
261
256
  }
@@ -390,7 +385,7 @@ const _Gateway = class _Gateway extends import_node_events.EventEmitter {
390
385
  (_b = this.wsServer) == null ? void 0 : _b.close();
391
386
  }
392
387
  static async getIPCSocketClient() {
393
- const socketPath = (0, import_node_path.resolve)(process.cwd(), process.env.SOCKET_PATH || "storage/gateway.sock");
388
+ const socketPath = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, process.env.SOCKET_PATH || "storage/gateway.sock");
394
389
  try {
395
390
  return await import_ipc_socket_client.IPCSocketClient.getConnection(socketPath);
396
391
  } catch (error) {
package/lib/helper.js CHANGED
@@ -149,7 +149,7 @@ const getCommandFullName = /* @__PURE__ */ __name((command) => {
149
149
  return names.join(".");
150
150
  }, "getCommandFullName");
151
151
  const tsxRerunning = /* @__PURE__ */ __name(async () => {
152
- const file = (0, import_node_path.resolve)(process.cwd(), "storage/app.watch.ts");
152
+ const file = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, "storage/app.watch.ts");
153
153
  await import_node_fs.default.promises.writeFile(file, `export const watchId = '${(0, import_utils.uid)()}';`, "utf-8");
154
154
  }, "tsxRerunning");
155
155
  const enablePerfHooks = /* @__PURE__ */ __name((app) => {
@@ -53,12 +53,16 @@ var resource_default = {
53
53
  }
54
54
  app.runAsCLI(["pm", "add", values.packageName, ...args], { from: "user" });
55
55
  } else if (ctx.file) {
56
- const tmpDir = import_node_path.default.resolve(process.cwd(), "storage", "tmp");
56
+ const tmpDir = import_node_path.default.resolve(process.env.TEGO_RUNTIME_HOME, "storage", "tmp");
57
57
  try {
58
58
  await import_node_fs.default.promises.mkdir(tmpDir, { recursive: true });
59
59
  } catch (error) {
60
60
  }
61
- const tempFile = import_node_path.default.join(process.cwd(), "storage/tmp", (0, import_utils.uid)() + import_node_path.default.extname(ctx.file.originalname));
61
+ const tempFile = import_node_path.default.join(
62
+ process.env.TEGO_RUNTIME_HOME,
63
+ "storage/tmp",
64
+ (0, import_utils.uid)() + import_node_path.default.extname(ctx.file.originalname)
65
+ );
62
66
  await import_node_fs.default.promises.writeFile(tempFile, ctx.file.buffer, "binary");
63
67
  app.runAsCLI(["pm", "add", tempFile], { from: "user" });
64
68
  } else if (values.compressedFileUrl) {
@@ -85,12 +89,16 @@ var resource_default = {
85
89
  }
86
90
  if (ctx.file) {
87
91
  values.packageName = ctx.request.body.packageName;
88
- const tmpDir = import_node_path.default.resolve(process.cwd(), "storage", "tmp");
92
+ const tmpDir = import_node_path.default.resolve(process.env.TEGO_RUNTIME_HOME, "storage", "tmp");
89
93
  try {
90
94
  await import_node_fs.default.promises.mkdir(tmpDir, { recursive: true });
91
95
  } catch (error) {
92
96
  }
93
- const tempFile = import_node_path.default.join(process.cwd(), "storage/tmp", (0, import_utils.uid)() + import_node_path.default.extname(ctx.file.originalname));
97
+ const tempFile = import_node_path.default.join(
98
+ process.env.TEGO_RUNTIME_HOME,
99
+ "storage/tmp",
100
+ (0, import_utils.uid)() + import_node_path.default.extname(ctx.file.originalname)
101
+ );
94
102
  await import_node_fs.default.promises.writeFile(tempFile, ctx.file.buffer, "binary");
95
103
  args.push(`--url=${tempFile}`);
96
104
  }
@@ -781,7 +781,7 @@ const _PluginManager = class _PluginManager {
781
781
  } else {
782
782
  await this.upgradeByNpm(options);
783
783
  }
784
- const file = (0, import_node_path.resolve)(process.cwd(), "storage/app-upgrading");
784
+ const file = (0, import_node_path.resolve)(process.env.TEGO_RUNTIME_HOME, "storage/app-upgrading");
785
785
  await import_promises.default.writeFile(file, "", "utf-8");
786
786
  await this.app.upgrade();
787
787
  }
@@ -82,7 +82,7 @@ async function getTempDir() {
82
82
  __name(getTempDir, "getTempDir");
83
83
  function getPluginStoragePath() {
84
84
  const pluginStoragePath = process.env.PLUGIN_STORAGE_PATH || import_constants.DEFAULT_PLUGIN_STORAGE_PATH;
85
- return import_node_path.default.isAbsolute(pluginStoragePath) ? pluginStoragePath : import_node_path.default.join(process.cwd(), pluginStoragePath);
85
+ return import_node_path.default.isAbsolute(pluginStoragePath) ? pluginStoragePath : import_node_path.default.join(process.env.TEGO_RUNTIME_HOME, pluginStoragePath);
86
86
  }
87
87
  __name(getPluginStoragePath, "getPluginStoragePath");
88
88
  function getLocalPluginPackagesPathArr() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tego/core",
3
- "version": "1.3.44",
3
+ "version": "1.3.46",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -31,17 +31,17 @@
31
31
  "winston": "^3.17.0",
32
32
  "ws": "^8.18.0",
33
33
  "xpipe": "^1.0.8",
34
- "@tachybase/acl": "1.3.44",
35
- "@tachybase/auth": "1.3.44",
36
- "@tachybase/actions": "1.3.44",
37
- "@tachybase/database": "1.3.44",
38
- "@tachybase/data-source": "1.3.44",
39
- "@tachybase/cache": "1.3.44",
40
- "@tachybase/di": "1.3.44",
41
- "@tachybase/globals": "1.3.44",
42
- "@tachybase/resourcer": "1.3.44",
43
- "@tachybase/logger": "1.3.44",
44
- "@tachybase/utils": "1.3.44"
34
+ "@tachybase/acl": "1.3.46",
35
+ "@tachybase/actions": "1.3.46",
36
+ "@tachybase/cache": "1.3.46",
37
+ "@tachybase/auth": "1.3.46",
38
+ "@tachybase/data-source": "1.3.46",
39
+ "@tachybase/di": "1.3.46",
40
+ "@tachybase/resourcer": "1.3.46",
41
+ "@tachybase/logger": "1.3.46",
42
+ "@tachybase/database": "1.3.46",
43
+ "@tachybase/globals": "1.3.46",
44
+ "@tachybase/utils": "1.3.46"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/fs-extra": "11.0.4",