refactor: v0.0.12

This commit is contained in:
wss-git 2021-07-16 17:20:05 +08:00
parent a8d9741e8b
commit a1934b1630
12 changed files with 102 additions and 69 deletions

View File

@ -123,7 +123,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/53beb96/src/index.ts#L17">index.ts:17</a></li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/a8d9741/src/index.ts#L17">index.ts:17</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
@ -146,7 +146,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/53beb96/src/index.ts#L101">index.ts:101</a></li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/a8d9741/src/index.ts#L93">index.ts:93</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -174,7 +174,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/53beb96/src/index.ts#L10">index.ts:10</a></li>
<li>Defined in <a href="https://github.com/devsapp/fc-remote-invoke/blob/a8d9741/src/index.ts#L10">index.ts:10</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>

View File

@ -91,7 +91,7 @@
"sources": [
{
"fileName": "index.ts",
"line": 101,
"line": 93,
"character": 21
}
],

21
lib/common/help.d.ts vendored
View File

@ -5,21 +5,30 @@ declare const _default: ({
} | {
header: string;
optionList: ({
name: string;
description: string;
type: StringConstructor;
alias?: undefined;
} | {
name: string;
description: string;
alias: string;
type: StringConstructor;
} | {
name: string;
description: string;
type: BooleanConstructor;
alias?: undefined;
})[];
content?: undefined;
} | {
header: string;
optionList: {
name: string;
description: string;
alias: string;
type: BooleanConstructor;
} | {
name: string;
description: string;
type: StringConstructor;
alias?: undefined;
})[];
}[];
content?: undefined;
} | {
header: string;

View File

@ -15,13 +15,11 @@ exports.default = [
{
name: 'invocation-type',
description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")',
alias: 't',
type: String,
},
{
name: 'event',
description: 'Event data (strings) passed to the function during invocation (default: "").Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: 'e',
type: String,
},
{
@ -33,7 +31,6 @@ exports.default = [
{
name: 'event-stdin',
description: 'Read from standard input, to support script pipeline.Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: 's',
type: Boolean,
},
{
@ -51,6 +48,11 @@ exports.default = [
description: 'Specify function name in cli mode',
type: String,
},
{
name: 'domain-name',
description: 'Specify custom domain name in cli mode',
type: String,
},
],
},
{
@ -98,4 +100,4 @@ exports.default = [
],
},
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vaGVscC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlO0lBQ2I7UUFDRSxNQUFNLEVBQUUsUUFBUTtRQUNoQixPQUFPLEVBQUUsa0NBQWtDO0tBQzVDO0lBQ0Q7UUFDRSxNQUFNLEVBQUUsT0FBTztRQUNmLE9BQU8sRUFBRSxzQkFBc0I7S0FDaEM7SUFDRDtRQUNFLE1BQU0sRUFBRSxTQUFTO1FBQ2pCLFVBQVUsRUFBRTtZQUNWO2dCQUNFLElBQUksRUFBRSxpQkFBaUI7Z0JBQ3ZCLFdBQVcsRUFBRSx3RkFBd0Y7Z0JBQ3JHLEtBQUssRUFBRSxHQUFHO2dCQUNWLElBQUksRUFBRSxNQUFNO2FBQ2I7WUFDRDtnQkFDRSxJQUFJLEVBQUUsT0FBTztnQkFDYixXQUFXLEVBQUUsK0pBQStKO2dCQUM1SyxLQUFLLEVBQUUsR0FBRztnQkFDVixJQUFJLEVBQUUsTUFBTTthQ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UNFLE1BQU0sRUFBRSxtQkFBbUI7UUFDM0IsT0FBTyxFQUFFO1lBQ1A7Z0JBQ0UsT0FBTyxFQUFFLGlHQUFpRzthQUMzRztZQUNEO2dCQUNFLE9BQU8sRUFBRSx3R0FBd0c7YUFDbEg7WUFDRDtnQkFDRSxPQUFPLEVBQUUsNkZBQTZGO2FBQ3ZHO1lBQ0Q7Z0JBQ0UsT0FBTyxFQUFFLHdIQUF3SDthQUNsSTtTQUNGO0tBQ0Y7Q0FDRixDQUFBIn0=

View File

@ -48,33 +48,29 @@ class FcRemoteInvoke {
});
}
handlerInputs(inputs) {
var _a, _b;
var _a, _b, _c, _d, _e, _f;
return __awaiter(this, void 0, void 0, function* () {
const credentials = yield core.getCredential((_a = inputs === null || inputs === void 0 ? void 0 : inputs.project) === null || _a === void 0 ? void 0 : _a.access);
// 去除 args 的行首以及行尾的空格
const args = ((inputs === null || inputs === void 0 ? void 0 : inputs.args) || '').replace(/(^\s*)|(\s*$)/g, '');
logger_1.default.debug(`input args: ${args}`);
const parsedArgs = core.commandParse({ args }, {
boolean: ['help', 'event-stdin'],
string: ['invocation-type', 'event', 'event-file', 'region', 'service-name', 'function-name', 'qualifier'],
string: ['invocation-type', 'event', 'event-file', 'region', 'domain-name', 'service-name', 'function-name', 'qualifier'],
alias: {
'help': 'h',
'event': 'e',
'invocation-type': 't',
'event-file': 'f',
'event-stdin': 's',
}
});
const argsData = (parsedArgs === null || parsedArgs === void 0 ? void 0 : parsedArgs.data) || {};
logger_1.default.debug(`command parse: ${JSON.stringify(argsData)}`);
if (argsData.help) {
return {
credentials,
credentials: inputs.credentials,
isHelp: true,
};
}
// await StdoutFormatter.initStdout();
const { e: event, f: eventFile, s: eventStdin, t: invocationType = 'sync', } = argsData;
const { e: event, f: eventFile, 'event-file': eventStdin, 'invocation-type': invocationType = 'sync', 'domain-name': domainName, } = argsData;
const eventPayload = { event, eventFile, eventStdin };
// @ts-ignore: 判断三个值有几个真
const eventFlag = !!event + !!eventFile + !!eventStdin;
@ -87,24 +83,24 @@ class FcRemoteInvoke {
if (!['sync', 'async'].includes(invocationType)) {
throw new Error('invocation-type enum value sync, async.');
}
if (!domainName && !(inputs === null || inputs === void 0 ? void 0 : inputs.credentials)) {
inputs.credentials = yield core.getCredential((_a = inputs === null || inputs === void 0 ? void 0 : inputs.project) === null || _a === void 0 ? void 0 : _a.access);
}
logger_1.default.debug(`input props: ${JSON.stringify(inputs.props)}`);
let props = {
region: argsData.region,
serviceName: argsData['service-name'],
functionName: argsData['function-name'],
const props = {
region: argsData.region || ((_b = inputs.props) === null || _b === void 0 ? void 0 : _b.region),
serviceName: argsData['service-name'] || ((_c = inputs.props) === null || _c === void 0 ? void 0 : _c.serviceName),
functionName: argsData['function-name'] || ((_d = inputs.props) === null || _d === void 0 ? void 0 : _d.functionName),
domainName: domainName || ((_e = inputs.props) === null || _e === void 0 ? void 0 : _e.domainName),
qualifier: argsData.qualifier || ((_f = inputs.props) === null || _f === void 0 ? void 0 : _f.qualifier),
};
logger_1.default.debug(`input args props: ${JSON.stringify(props)}`);
if (!entity_1.isProperties(props)) {
props = inputs.props;
}
logger_1.default.debug(`props: ${JSON.stringify(props)}`);
if (!entity_1.isProperties(props)) {
throw new Error('region/serviceName(service-name)/functionName(function-name) can not be empty.');
}
props.qualifier = argsData.qualifier || ((_b = inputs.props) === null || _b === void 0 ? void 0 : _b.qualifier);
return {
props,
credentials,
credentials: inputs.credentials,
eventPayload,
isHelp: false,
invocationType: lodash_1.default.upperFirst(invocationType),
@ -124,10 +120,10 @@ class FcRemoteInvoke {
core.help(help_1.default);
return;
}
const remoteInvoke = new remote_invoke_1.default(props.region, credentials);
const remoteInvoke = new remote_invoke_1.default(props.region, credentials, props.domainName);
yield remoteInvoke.invoke(props, eventPayload, { invocationType });
});
}
}
exports.default = FcRemoteInvoke;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291c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LEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxjQUFjLEVBQUUsQ0FBQyxDQUFDO1FBQ3JFLENBQUM7S0FBQTtDQUNGO0FBdEdELGlDQXNHQyJ9

View File

@ -24,6 +24,7 @@ export interface IProperties {
serviceName: string;
functionName: string;
qualifier?: string;
domainName?: string;
}
export declare function isProperties(args: any): args is IProperties;
export interface IEventPayload {

View File

@ -2,7 +2,10 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.isProperties = void 0;
function isProperties(args) {
return args && args.region && args.serviceName && args.functionName;
if (!args) {
return false;
}
return args.domainName || (args.region && args.serviceName && args.functionName);
}
exports.isProperties = isProperties;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50aXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludGVyZmFjZS9lbnRpdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBNkJBLFNBQWdCLFlBQVksQ0FBQyxJQUFTO0lBQ3BDLE9BQU8sSUFBSSxJQUFJLElBQUksQ0FBQyxNQUFNLElBQUksSUFBSSxDQUFDLFdBQVcsSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDO0FBQ3RFLENBQUM7QUFGRCxvQ0FFQyJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50aXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludGVyZmFjZS9lbnRpdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBOEJBLFNBQWdCLFlBQVksQ0FBQyxJQUFTO0lBQ3BDLElBQUksQ0FBQyxJQUFJLEVBQUU7UUFDVCxPQUFPLEtBQUssQ0FBQztLQUNkO0lBQ0QsT0FBTyxJQUFJLENBQUMsVUFBVSxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sSUFBSSxJQUFJLENBQUMsV0FBVyxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBRTtBQUNwRixDQUFDO0FBTEQsb0NBS0MifQ==

View File

@ -2,10 +2,11 @@ import { IProperties, IEventPayload } from '../interface/entity';
export default class RemoteInvoke {
fcClient: any;
accountId: string;
constructor(region: string, credentials: any);
constructor(region: string, credentials: any, domainName: any);
invoke(props: IProperties, eventPayload: IEventPayload, { invocationType }: {
invocationType: any;
}): Promise<void>;
requestDomain(url: string, event: string): Promise<void>;
getHttpTrigger(serviceName: any, functionName: any): Promise<any>;
eventInvoke({ serviceName, functionName, event, qualifier, invocationType }: {
serviceName: any;
@ -33,4 +34,6 @@ export default class RemoteInvoke {
path: any;
body: any;
};
private showLog;
private getJsonEvent;
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "fc-remote-invoke",
"version": "0.0.11",
"version": "0.0.12",
"description": "This is a component demo for Serverless Devs Tool ",
"keywords": [
"Serverless",

View File

@ -2,7 +2,7 @@ Type: Component
Name: fc-remote-invoke
Provider:
- 其它
Version: 0.0.11
Version: 0.0.12
Description: 初始化component模板
HomePage: https://www.serverless-devs.com
Tags: #标签详情

View File

@ -2,7 +2,7 @@ import _ from 'lodash';
import * as core from '@serverless-devs/core';
import logger from './common/logger';
import HELP from './common/help';
import { InputProps, ICredentials, isProperties, IProperties } from './interface/entity';
import { InputProps, isProperties, IProperties } from './interface/entity';
// import StdoutFormatter from './common/stdout-formatter';
import RemoteInvoke from './lib/remote-invoke';