@seayoo-web/finder 2.0.10 → 2.0.12

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/dist/index.cjs CHANGED
@@ -60,6 +60,11 @@ function getSystemTempDir() {
60
60
  }
61
61
  return dir;
62
62
  }
63
+ const nodeVersion = +process.version.replace(/\..+/, "").slice(1);
64
+ if (nodeVersion < 20) {
65
+ process.emitWarning = function() {
66
+ };
67
+ }
63
68
  async function request({
64
69
  url,
65
70
  method,
@@ -138,24 +143,21 @@ async function deploy(option) {
138
143
  throw `部署缺少认证信息(user & key)`.bgRed;
139
144
  }
140
145
  const zipMockName = `${Date.now()}${Math.random().toString(16).slice(-3)}.zip`;
141
- const { status, message, data } = await request({
146
+ const { status, data } = await request({
142
147
  url: `${getFinderServerFullPath(targetServer)}${FinderApiPaths.deploy}?target=${encodeURIComponent(pure(target))}`,
143
148
  method: "POST",
144
149
  headers: { user, key },
145
150
  data: {
146
151
  path: zipMockName,
147
152
  file: { buffer, filename: zipMockName, contentType: "application/octet-stream" },
148
- payload: JSON.stringify(payload || "")
153
+ payload: payload ? JSON.stringify(payload) : ""
149
154
  }
150
155
  });
151
156
  if (status !== 200) {
152
- throw `${`部署接口错误(${status})`.bgRed} ${message || ""}.red`;
153
- }
154
- if (!data || typeof data !== "object") {
155
- throw `部署接口响应错误,请自行检查是否部署成功。`.bgRed + JSON.stringify(data).red;
157
+ throw `部署接口错误(status ${status})`.red;
156
158
  }
157
- if ("err" in data || !("data" in data) || typeof data.data !== "string") {
158
- throw `部署接口错误。`.bgRed + JSON.stringify(data).red;
159
+ if (!data || typeof data !== "object" || "err" in data && data.err || !("data" in data) || typeof data.data !== "string") {
160
+ throw `部署接口响应错误。 ${JSON.stringify(data)}`.red;
159
161
  }
160
162
  const url = data.data;
161
163
  if (debug) {
package/dist/index.js CHANGED
@@ -58,6 +58,11 @@ function getSystemTempDir() {
58
58
  }
59
59
  return dir;
60
60
  }
61
+ const nodeVersion = +process.version.replace(/\..+/, "").slice(1);
62
+ if (nodeVersion < 20) {
63
+ process.emitWarning = function() {
64
+ };
65
+ }
61
66
  async function request({
62
67
  url,
63
68
  method,
@@ -136,24 +141,21 @@ async function deploy(option) {
136
141
  throw `部署缺少认证信息(user & key)`.bgRed;
137
142
  }
138
143
  const zipMockName = `${Date.now()}${Math.random().toString(16).slice(-3)}.zip`;
139
- const { status, message, data } = await request({
144
+ const { status, data } = await request({
140
145
  url: `${getFinderServerFullPath(targetServer)}${FinderApiPaths.deploy}?target=${encodeURIComponent(pure(target))}`,
141
146
  method: "POST",
142
147
  headers: { user, key },
143
148
  data: {
144
149
  path: zipMockName,
145
150
  file: { buffer, filename: zipMockName, contentType: "application/octet-stream" },
146
- payload: JSON.stringify(payload || "")
151
+ payload: payload ? JSON.stringify(payload) : ""
147
152
  }
148
153
  });
149
154
  if (status !== 200) {
150
- throw `${`部署接口错误(${status})`.bgRed} ${message || ""}.red`;
151
- }
152
- if (!data || typeof data !== "object") {
153
- throw `部署接口响应错误,请自行检查是否部署成功。`.bgRed + JSON.stringify(data).red;
155
+ throw `部署接口错误(status ${status})`.red;
154
156
  }
155
- if ("err" in data || !("data" in data) || typeof data.data !== "string") {
156
- throw `部署接口错误。`.bgRed + JSON.stringify(data).red;
157
+ if (!data || typeof data !== "object" || "err" in data && data.err || !("data" in data) || typeof data.data !== "string") {
158
+ throw `部署接口响应错误。 ${JSON.stringify(data)}`.red;
157
159
  }
158
160
  const url = data.data;
159
161
  if (debug) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/finder",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "agent for web finder",
5
5
  "type": "module",
6
6
  "source": "index.ts",