zcatalyst-cli 1.22.0 → 1.22.1

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.
@@ -34,7 +34,8 @@ exports.default = (req, res, next) => {
34
34
  break;
35
35
  case 'OAuth':
36
36
  const oauthHeader = req.get('authorization');
37
- if (oauthHeader !== undefined) {
37
+ const userType = req.headers['x-zc-user-type'];
38
+ if (oauthHeader !== undefined && userType === 'admin') {
38
39
  accumulator[0] = type;
39
40
  accumulator[1] = oauthHeader;
40
41
  }
@@ -45,6 +46,13 @@ exports.default = (req, res, next) => {
45
46
  accumulator[0] = type;
46
47
  accumulator[1] = csrfToken;
47
48
  }
49
+ else {
50
+ const authHeader = req.get('authorization');
51
+ if (authHeader !== undefined) {
52
+ accumulator[0] = type;
53
+ accumulator[1] = authHeader;
54
+ }
55
+ }
48
56
  break;
49
57
  }
50
58
  return accumulator;
@@ -169,7 +169,7 @@ class Command {
169
169
  arg: [(0, ansi_colors_1.bold)(cmd.name()), (0, ansi_colors_1.bold)('CI=true catalyst help')]
170
170
  }));
171
171
  }
172
- if (programArgs.slice(-1)[0].args.length > argCount &&
172
+ if (programArgs.slice(-1)[0].args.filter((_arg) => _arg.trim() !== '').length > argCount &&
173
173
  !this.allowUnknownOptions) {
174
174
  return (0, errorOut_1.default)(new index_js_1.default('Too many arguments', {
175
175
  exit: 1,
@@ -1,7 +1,8 @@
1
1
  import { IFnTarget } from '../../fn-utils/lib/common.js';
2
2
  import { TAppSailServerDetails } from './appsail.js';
3
+ import { TSlateServerDetails } from './slate.js';
3
4
  export declare function client(): Promise<void>;
4
5
  export declare function functions(): Promise<Array<IFnTarget>>;
5
6
  export declare function apig(): Promise<void>;
6
7
  export declare function appsail(): Promise<Array<TAppSailServerDetails>>;
7
- export declare function slate(): Promise<void>;
8
+ export declare function slate(): Promise<Array<TSlateServerDetails>>;
@@ -86,8 +86,8 @@ function appsail() {
86
86
  exports.appsail = appsail;
87
87
  function slate() {
88
88
  return __awaiter(this, void 0, void 0, function* () {
89
- const appSailModule = yield Promise.resolve().then(() => __importStar(require('./slate.js')));
90
- yield appSailModule.default();
89
+ const slateModule = yield Promise.resolve().then(() => __importStar(require('./slate.js')));
90
+ return slateModule.default();
91
91
  });
92
92
  }
93
93
  exports.slate = slate;
@@ -8,5 +8,5 @@ export type TSlateServerDetails = ISlateConfig & {
8
8
  kill: boolean;
9
9
  };
10
10
  };
11
- declare const _default: () => Promise<void>;
11
+ declare const _default: () => Promise<Array<TSlateServerDetails>>;
12
12
  export default _default;
@@ -24,7 +24,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
24
24
  const optionTargets = slate_utils_1.slateUtils.filterTargets(allTargets || []);
25
25
  if (optionTargets.length === 0) {
26
26
  (0, logger_1.debug)('Slate targets are empty');
27
- return;
27
+ return [];
28
28
  }
29
29
  const validated = (0, slate_utils_1.validateServeCommand)(optionTargets);
30
30
  const filledTargets = yield Promise.all(validated.map((targ) => __awaiter(void 0, void 0, void 0, function* () {
@@ -46,4 +46,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
46
46
  return Object.assign(Object.assign({}, targ), { port: { slate: slatePort, proxy: proxyPort }, trigger: { kill: false } });
47
47
  })));
48
48
  runtime_store_1.default.set('context.slate.targets', filledTargets);
49
+ return filledTargets;
49
50
  });
@@ -136,7 +136,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
136
136
  }
137
137
  }
138
138
  if (serveTargets.includes('slate')) {
139
- const slates = runtime_store_1.default.get('context.slate.targets', []);
139
+ const slates = yield features.slate();
140
140
  const validSlates = slates.filter((slate) => {
141
141
  if (!slate.validity.valid) {
142
142
  (0, index_1.warning)('skipping serve of Slate service [' +
@@ -23,7 +23,6 @@ const logger_1 = __importDefault(require("../../../../express_middlewares/logger
23
23
  const project_1 = __importDefault(require("../../../../express_middlewares/project"));
24
24
  const unknown_req_proxy_1 = __importDefault(require("./unknown-req-proxy"));
25
25
  const url_rewriter_1 = __importDefault(require("../../../../express_middlewares/url-rewriter"));
26
- const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
27
26
  const constants_1 = require("../../../../util_modules/constants");
28
27
  const js_1 = require("../../../../util_modules/js");
29
28
  const index_1 = require("../../../../util_modules/logger/index");
@@ -35,6 +34,7 @@ const appsail_1 = require("./appsail");
35
34
  const web_client_1 = require("./web-client");
36
35
  const functions_1 = require("./functions");
37
36
  const slate_1 = require("./slate");
37
+ const apig_1 = __importDefault(require("../../../features/apig"));
38
38
  function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDetails }) {
39
39
  var _a, _b;
40
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -49,7 +49,7 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
49
49
  key: (0, project_2.getDomainKey)(),
50
50
  env_name: (0, project_2.getEnvName)()
51
51
  };
52
- const rules = runtime_store_1.default.get('context.apig.local.config', -1);
52
+ const rules = (yield (0, apig_1.default)()) || -1;
53
53
  const customProxyUrl = (0, option_1.getOptionValue)('proxy');
54
54
  const app = (0, express_1.default)();
55
55
  let systemRoutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {