yakuza0 2.21.11 → 2.22.1-beta.0

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 (2) hide show
  1. package/package.json +2 -1
  2. package/utils/inclusive.js +63 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.21.11",
3
+ "version": "2.22.1-beta.0",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
+ "@alicloud/acm-sdk": "^1.0.1",
23
24
  "@babel/plugin-transform-runtime": "^7.12.10",
24
25
  "@commitlint/config-conventional": "^12.1.1",
25
26
  "@commitlint/format": "^12.1.1",
@@ -69,6 +69,10 @@ var _getPort = require('get-port');
69
69
 
70
70
  var _getPort2 = _interopRequireDefault(_getPort);
71
71
 
72
+ var _acmSdk = require('@alicloud/acm-sdk');
73
+
74
+ var _acmSdk2 = _interopRequireDefault(_acmSdk);
75
+
72
76
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
73
77
 
74
78
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -189,7 +193,7 @@ var render = function () {
189
193
  ykPkg = _ref.pkg,
190
194
  dkyModeDef = _ref.dkyModeDef;
191
195
 
192
- var _ykConfig, ykConf, processEnv, imageKeyOrigin, aliasDir, conf, cspLoop, setConfValue, setConfCSP, setConf, hostname, port, ykServer, orbAddr, directives, tip, serverConfStr;
196
+ var _ykConfig, ykConf, processEnv, imageKeyOrigin, aliasDir, conf, cspLoop, setConfValue, setConfCSP, setConf, client, content, acmConf, hostname, port, ykServer, orbAddr, directives, tip, serverConfStr;
193
197
 
194
198
  return _regenerator2.default.wrap(function _callee2$(_context2) {
195
199
  while (1) {
@@ -484,6 +488,18 @@ var render = function () {
484
488
  // ...mainConf.server && mainConf.server.om && mainConf.server.om.router,
485
489
  // ...ykConf.server && ykConf.server.om && ykConf.server.om.router,
486
490
  }
491
+ },
492
+ edas: {
493
+ enabled: false,
494
+ dataId: '',
495
+ group: '',
496
+ options: {
497
+ // endpoint: '', // check this from acm console
498
+ // namespace: '', // check this from acm console
499
+ // accessKey: '', // check this from acm console
500
+ // secretKey: '', // check this from acm console
501
+ requestTimeout: 6000 // timeout(ms),default 6s
502
+ }
487
503
  }
488
504
  },
489
505
  extend: {
@@ -682,11 +698,13 @@ var render = function () {
682
698
  });
683
699
  }
684
700
 
685
- conf.router.config = _yakuza._.mapValues(conf.router.config, function (v) {
701
+ conf.router.config = _yakuza._.forEach(conf.router.config, function (v, k) {
686
702
  if (conf.inImage && conf.cmd === 'server container') {
687
703
  v.enabled = false;
688
704
  }
689
- return v;
705
+ // return v
706
+ delete conf.router.config[k];
707
+ conf.router.config[k.toLowerCase()] = _yakuza._.cloneDeep(v);
690
708
  });
691
709
 
692
710
  // env
@@ -715,38 +733,63 @@ var render = function () {
715
733
  }
716
734
  });
717
735
 
718
- _context2.t0 = conf.dkyMode;
719
- _context2.next = _context2.t0 === "dev" ? 17 : _context2.t0 === "normal" ? 20 : _context2.t0 === "prod" ? 23 : _context2.t0 === "stupid" ? 29 : _context2.t0 === "tire" ? 37 : 43;
736
+ if (!conf.server.edas.enabled) {
737
+ _context2.next = 27;
738
+ break;
739
+ }
740
+
741
+ _context2.prev = 15;
742
+ client = new _acmSdk2.default(conf.server.edas.options);
743
+ _context2.next = 19;
744
+ return client.getConfig(conf.server.edas.dataId, conf.server.edas.group);
745
+
746
+ case 19:
747
+ content = _context2.sent;
748
+ acmConf = JSON.parse(content);
749
+
750
+ setConf(acmConf);
751
+ _context2.next = 27;
752
+ break;
753
+
754
+ case 24:
755
+ _context2.prev = 24;
756
+ _context2.t0 = _context2['catch'](15);
757
+
758
+ console.log(_context2.t0);
759
+
760
+ case 27:
761
+ _context2.t1 = conf.dkyMode;
762
+ _context2.next = _context2.t1 === "dev" ? 30 : _context2.t1 === "normal" ? 33 : _context2.t1 === "prod" ? 36 : _context2.t1 === "stupid" ? 42 : _context2.t1 === "tire" ? 50 : 56;
720
763
  break;
721
764
 
722
- case 17:
765
+ case 30:
723
766
  // conf.security.encrypt = "none";
724
767
  // conf.security.stupid = false;
725
768
  // conf.security.helmet = true;
726
769
  // conf.server.f5Offline = false;
727
770
  conf.security.isDev = true;
728
771
  conf.dev = true;
729
- return _context2.abrupt('break', 43);
772
+ return _context2.abrupt('break', 56);
730
773
 
731
- case 20:
774
+ case 33:
732
775
  // conf.security.encrypt = "none";
733
776
  // conf.security.stupid = false;
734
777
  // conf.security.helmet = true;
735
778
  // conf.server.f5Offline = false;
736
779
  conf.security.isNormal = true;
737
780
  conf.dev = false;
738
- return _context2.abrupt('break', 43);
781
+ return _context2.abrupt('break', 56);
739
782
 
740
- case 23:
783
+ case 36:
741
784
  conf.security.encrypt = "sm";
742
785
  conf.security.stupid = false;
743
786
  conf.security.helmet = true;
744
787
  // conf.server.f5Offline = false;
745
788
  conf.security.isProd = true;
746
789
  conf.dev = false;
747
- return _context2.abrupt('break', 43);
790
+ return _context2.abrupt('break', 56);
748
791
 
749
- case 29:
792
+ case 42:
750
793
  conf.security.encrypt = "sm";
751
794
  conf.security.stupid = true;
752
795
  conf.security.helmet = true;
@@ -755,18 +798,18 @@ var render = function () {
755
798
  conf.server.csp.enabled = true;
756
799
  conf.server.sri.enabled = true;
757
800
  conf.dev = false;
758
- return _context2.abrupt('break', 43);
801
+ return _context2.abrupt('break', 56);
759
802
 
760
- case 37:
803
+ case 50:
761
804
  conf.security.encrypt = "none";
762
805
  conf.security.stupid = false;
763
806
  conf.security.helmet = false;
764
807
  // conf.server.f5Offline = false;
765
808
  conf.security.isTire = true;
766
809
  conf.dev = false;
767
- return _context2.abrupt('break', 43);
810
+ return _context2.abrupt('break', 56);
768
811
 
769
- case 43:
812
+ case 56:
770
813
 
771
814
  // conf.router.config['app.examples'].enabled = true;
772
815
  if (conf.server.yk4Addr) {
@@ -866,7 +909,7 @@ var render = function () {
866
909
  conf.server.csp.directives = directives;
867
910
 
868
911
  // const appPortUsed = [];
869
- _context2.next = 64;
912
+ _context2.next = 77;
870
913
  return _yakuza._.asyncMap(conf.router.config, function () {
871
914
  var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(v, key) {
872
915
  var name, arr, length, num;
@@ -1049,7 +1092,7 @@ var render = function () {
1049
1092
  };
1050
1093
  }());
1051
1094
 
1052
- case 64:
1095
+ case 77:
1053
1096
  // console.log(conf.router.config);
1054
1097
 
1055
1098
  conf.shareRule.app = conf.shareRule.app.map(function (ap) {
@@ -1171,12 +1214,12 @@ var render = function () {
1171
1214
 
1172
1215
  return _context2.abrupt('return', { conf: conf });
1173
1216
 
1174
- case 75:
1217
+ case 88:
1175
1218
  case 'end':
1176
1219
  return _context2.stop();
1177
1220
  }
1178
1221
  }
1179
- }, _callee2, undefined);
1222
+ }, _callee2, undefined, [[15, 24]]);
1180
1223
  }));
1181
1224
 
1182
1225
  return function render(_x) {