@xfe-repo/web-app 1.3.15 → 1.3.16

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.
@@ -167,7 +167,7 @@ var configDeploy = function() {
167
167
  };
168
168
  var getJwtEnv = function() {
169
169
  var _ref = _async_to_generator(function() {
170
- var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, _ref, keyId, privateKeyPkcs8;
170
+ var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, JwkResponseJson, err, _, _1, _2, _ref, keyId, privateKeyPkcs8;
171
171
  return _ts_generator(this, function(_state) {
172
172
  switch(_state.label){
173
173
  case 0:
@@ -177,13 +177,48 @@ var getJwtEnv = function() {
177
177
  if (!aud) throw new Error("xfe.json 中的 jwt 配置不完整,请确保包含 aud 字段。");
178
178
  return [
179
179
  4,
180
- fetch("https://app.eshetang.com/jwk?appId=".concat(aud)).then(function(res) {
181
- return res.json();
182
- })
180
+ fetch("https://app.eshetang.com/jwk?appId=".concat(aud))
183
181
  ];
184
182
  case 1:
185
183
  jwkRes = _state.sent();
186
- _ref = (jwkRes === null || jwkRes === void 0 ? void 0 : jwkRes.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
184
+ if (!jwkRes.ok) {
185
+ throw new Error("远程获取密钥失败: ".concat(jwkRes.status, " ").concat(jwkRes.statusText));
186
+ }
187
+ _state.label = 2;
188
+ case 2:
189
+ _state.trys.push([
190
+ 2,
191
+ 4,
192
+ ,
193
+ 6
194
+ ]);
195
+ return [
196
+ 4,
197
+ jwkRes.json()
198
+ ];
199
+ case 3:
200
+ JwkResponseJson = _state.sent();
201
+ return [
202
+ 3,
203
+ 6
204
+ ];
205
+ case 4:
206
+ err = _state.sent();
207
+ _ = Error.bind;
208
+ _2 = (_1 = "远程获取密钥失败,响应解析错误: ".concat(err.message, ", response text: ")).concat;
209
+ return [
210
+ 4,
211
+ jwkRes.text()
212
+ ];
213
+ case 5:
214
+ throw new (_.apply(Error, [
215
+ void 0,
216
+ _2.apply(_1, [
217
+ _state.sent()
218
+ ])
219
+ ]));
220
+ case 6:
221
+ _ref = (JwkResponseJson === null || JwkResponseJson === void 0 ? void 0 : JwkResponseJson.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
187
222
  if (!keyId || !privateKeyPkcs8) throw new Error("未获取到项目签名密钥, 请检查aud是否正确: ".concat(aud));
188
223
  return [
189
224
  2,
package/dist/cli.js CHANGED
@@ -293,7 +293,7 @@ var configDeploy = function() {
293
293
  };
294
294
  var getJwtEnv = function() {
295
295
  var _ref = _async_to_generator(function() {
296
- var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, _ref, keyId, privateKeyPkcs8;
296
+ var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, JwkResponseJson, err, _, _1, _2, _ref, keyId, privateKeyPkcs8;
297
297
  return _ts_generator(this, function(_state) {
298
298
  switch(_state.label){
299
299
  case 0:
@@ -303,13 +303,48 @@ var getJwtEnv = function() {
303
303
  if (!aud) throw new Error("xfe.json 中的 jwt 配置不完整,请确保包含 aud 字段。");
304
304
  return [
305
305
  4,
306
- fetch("https://app.eshetang.com/jwk?appId=".concat(aud)).then(function(res) {
307
- return res.json();
308
- })
306
+ fetch("https://app.eshetang.com/jwk?appId=".concat(aud))
309
307
  ];
310
308
  case 1:
311
309
  jwkRes = _state.sent();
312
- _ref = (jwkRes === null || jwkRes === void 0 ? void 0 : jwkRes.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
310
+ if (!jwkRes.ok) {
311
+ throw new Error("远程获取密钥失败: ".concat(jwkRes.status, " ").concat(jwkRes.statusText));
312
+ }
313
+ _state.label = 2;
314
+ case 2:
315
+ _state.trys.push([
316
+ 2,
317
+ 4,
318
+ ,
319
+ 6
320
+ ]);
321
+ return [
322
+ 4,
323
+ jwkRes.json()
324
+ ];
325
+ case 3:
326
+ JwkResponseJson = _state.sent();
327
+ return [
328
+ 3,
329
+ 6
330
+ ];
331
+ case 4:
332
+ err = _state.sent();
333
+ _ = Error.bind;
334
+ _2 = (_1 = "远程获取密钥失败,响应解析错误: ".concat(err.message, ", response text: ")).concat;
335
+ return [
336
+ 4,
337
+ jwkRes.text()
338
+ ];
339
+ case 5:
340
+ throw new (_.apply(Error, [
341
+ void 0,
342
+ _2.apply(_1, [
343
+ _state.sent()
344
+ ])
345
+ ]));
346
+ case 6:
347
+ _ref = (JwkResponseJson === null || JwkResponseJson === void 0 ? void 0 : JwkResponseJson.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
313
348
  if (!keyId || !privateKeyPkcs8) throw new Error("未获取到项目签名密钥, 请检查aud是否正确: ".concat(aud));
314
349
  return [
315
350
  2,
package/dist/cli.mjs CHANGED
@@ -196,7 +196,7 @@ function _ts_generator(thisArg, body) {
196
196
  };
197
197
  }
198
198
  }
199
- import { configDeploy, getJwtEnv } from "./chunk-JNAYST2A.mjs";
199
+ import { configDeploy, getJwtEnv } from "./chunk-TFIAHV2G.mjs";
200
200
  // src/cli.ts
201
201
  import minimist from "minimist";
202
202
  import { execSync } from "child_process";
package/dist/config.js CHANGED
@@ -239,7 +239,7 @@ var configDeploy = function() {
239
239
  };
240
240
  var getJwtEnv = function() {
241
241
  var _ref = _async_to_generator(function() {
242
- var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, _ref, keyId, privateKeyPkcs8;
242
+ var xfeConfig, _xfeConfig_jwt, _xfeConfig_jwt_aud, aud, jwkRes, JwkResponseJson, err, _, _1, _2, _ref, keyId, privateKeyPkcs8;
243
243
  return _ts_generator(this, function(_state) {
244
244
  switch(_state.label){
245
245
  case 0:
@@ -249,13 +249,48 @@ var getJwtEnv = function() {
249
249
  if (!aud) throw new Error("xfe.json 中的 jwt 配置不完整,请确保包含 aud 字段。");
250
250
  return [
251
251
  4,
252
- fetch("https://app.eshetang.com/jwk?appId=".concat(aud)).then(function(res) {
253
- return res.json();
254
- })
252
+ fetch("https://app.eshetang.com/jwk?appId=".concat(aud))
255
253
  ];
256
254
  case 1:
257
255
  jwkRes = _state.sent();
258
- _ref = (jwkRes === null || jwkRes === void 0 ? void 0 : jwkRes.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
256
+ if (!jwkRes.ok) {
257
+ throw new Error("远程获取密钥失败: ".concat(jwkRes.status, " ").concat(jwkRes.statusText));
258
+ }
259
+ _state.label = 2;
260
+ case 2:
261
+ _state.trys.push([
262
+ 2,
263
+ 4,
264
+ ,
265
+ 6
266
+ ]);
267
+ return [
268
+ 4,
269
+ jwkRes.json()
270
+ ];
271
+ case 3:
272
+ JwkResponseJson = _state.sent();
273
+ return [
274
+ 3,
275
+ 6
276
+ ];
277
+ case 4:
278
+ err = _state.sent();
279
+ _ = Error.bind;
280
+ _2 = (_1 = "远程获取密钥失败,响应解析错误: ".concat(err.message, ", response text: ")).concat;
281
+ return [
282
+ 4,
283
+ jwkRes.text()
284
+ ];
285
+ case 5:
286
+ throw new (_.apply(Error, [
287
+ void 0,
288
+ _2.apply(_1, [
289
+ _state.sent()
290
+ ])
291
+ ]));
292
+ case 6:
293
+ _ref = (JwkResponseJson === null || JwkResponseJson === void 0 ? void 0 : JwkResponseJson.data) || {}, keyId = _ref.keyId, privateKeyPkcs8 = _ref.privateKeyPkcs8;
259
294
  if (!keyId || !privateKeyPkcs8) throw new Error("未获取到项目签名密钥, 请检查aud是否正确: ".concat(aud));
260
295
  return [
261
296
  2,
package/dist/config.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { configDeploy, getJwtEnv, loadXfeConfig } from "./chunk-JNAYST2A.mjs";
1
+ import { configDeploy, getJwtEnv, loadXfeConfig } from "./chunk-TFIAHV2G.mjs";
2
2
  export { configDeploy, getJwtEnv, loadXfeConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-app",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "bin": {
5
5
  "xfe-web": "./bin/index.js"
6
6
  },