build: run build
This commit is contained in:
parent
921e32f5db
commit
2c3bcc6164
|
@ -5,5 +5,3 @@ node_modules
|
|||
package-lock.json
|
||||
.idea
|
||||
.vscode
|
||||
lib
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
declare const _default: ({
|
||||
header: string;
|
||||
content: string;
|
||||
optionList?: undefined;
|
||||
} | {
|
||||
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;
|
||||
}[];
|
||||
content?: undefined;
|
||||
} | {
|
||||
header: string;
|
||||
content: string[];
|
||||
optionList?: undefined;
|
||||
} | {
|
||||
header: string;
|
||||
content: {
|
||||
example: string;
|
||||
}[];
|
||||
optionList?: undefined;
|
||||
})[];
|
||||
export default _default;
|
|
@ -0,0 +1,10 @@
|
|||
export default class ComponentLogger {
|
||||
static CONTENT: string;
|
||||
static setContent(content: any): void;
|
||||
static log(m: any, color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'whiteBright' | 'gray'): void;
|
||||
static info(m: any): void;
|
||||
static debug(m: any): void;
|
||||
static error(m: any): void;
|
||||
static warning(m: any): void;
|
||||
static success(m: any): void;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
export default class StdoutFormatter {
|
||||
static stdoutFormatter: any;
|
||||
static initStdout(): Promise<void>;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { InputProps } from './interface/entity';
|
||||
export default class FcRemoteInvoke {
|
||||
/**
|
||||
* event 函数本地调试
|
||||
* @param inputs
|
||||
* @returns
|
||||
*/
|
||||
invoke(inputs: InputProps): Promise<any>;
|
||||
private report;
|
||||
private handlerInputs;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,34 @@
|
|||
export interface ICredentials {
|
||||
AccountID?: string;
|
||||
AccessKeyID?: string;
|
||||
AccessKeySecret?: string;
|
||||
SecurityToken?: string;
|
||||
}
|
||||
export interface InputProps {
|
||||
props?: IProperties;
|
||||
credentials: ICredentials;
|
||||
appName: string;
|
||||
project: {
|
||||
component: string;
|
||||
access: string;
|
||||
projectName: string;
|
||||
};
|
||||
command: string;
|
||||
args: string;
|
||||
path: {
|
||||
configPath: string;
|
||||
};
|
||||
}
|
||||
export interface IProperties {
|
||||
region: string;
|
||||
serviceName: string;
|
||||
functionName: string;
|
||||
qualifier?: string;
|
||||
domainName?: string;
|
||||
}
|
||||
export declare function isProperties(args: any): args is IProperties;
|
||||
export interface IEventPayload {
|
||||
event?: string;
|
||||
eventFile?: string;
|
||||
eventStdin?: boolean;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { ICredentials } from '../interface/entity';
|
||||
export default class Client {
|
||||
static buildFcClient(region: string, credentials: ICredentials): Promise<any>;
|
||||
private static getFcEndpoint;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
export default class File {
|
||||
static getEvent(eventFile: any): Promise<unknown>;
|
||||
static eventPriority(eventPriority: any): Promise<any>;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export default function handlerBody(contentType: string, body: any): any;
|
|
@ -0,0 +1,39 @@
|
|||
import { IProperties, IEventPayload } from '../interface/entity';
|
||||
export default class RemoteInvoke {
|
||||
fcClient: any;
|
||||
accountId: string;
|
||||
constructor(fcClient: any, accountId: string);
|
||||
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;
|
||||
functionName: any;
|
||||
event: any;
|
||||
qualifier?: string;
|
||||
invocationType: any;
|
||||
}): Promise<void>;
|
||||
httpInvoke({ region, serviceName, functionName, event, qualifier }: {
|
||||
region: any;
|
||||
serviceName: any;
|
||||
functionName: any;
|
||||
event: any;
|
||||
qualifier: any;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* @param event: { body, headers, method, queries, path }
|
||||
* path 组装后的路径 /proxy/serviceName/functionName/path ,
|
||||
*/
|
||||
request(event: any): Promise<void>;
|
||||
handlerHttpParmase(event: any): {
|
||||
headers: any;
|
||||
queries: any;
|
||||
method: any;
|
||||
path: any;
|
||||
body: any;
|
||||
};
|
||||
private showLog;
|
||||
private getJsonEvent;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference types="node" />
|
||||
export declare function getStdin(): Promise<string>;
|
||||
export declare namespace getStdin {
|
||||
var buffer: () => Promise<Buffer>;
|
||||
}
|
|
@ -30,9 +30,11 @@
|
|||
"dependencies": {
|
||||
"@alicloud/fc2": "^2.2.2",
|
||||
"@serverless-devs/core": "^0.0.*",
|
||||
"form-data": "^4.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"got": "^11.8.2",
|
||||
"lodash": "^4.17.21",
|
||||
"qs": "^6.10.1",
|
||||
"readline": "^1.3.0"
|
||||
},
|
||||
"autoInstall": false,
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import _ from 'lodash';
|
||||
import qs from 'qs';
|
||||
import FormData from 'form-data';
|
||||
|
||||
export default function handlerBody(contentType: string, body: any) {
|
||||
if (contentType.includes('text/') || contentType.includes('application/json') || contentType.includes('application/xml')) {
|
||||
if (_.isString(body)) return body;
|
||||
try {
|
||||
return JSON.stringify(body);
|
||||
} catch (_ex) {
|
||||
return body.toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (contentType.includes('application/x-www-form-urlencoded')) {
|
||||
return qs.stringify(body, { indices: false });
|
||||
}
|
||||
|
||||
if (contentType.includes('multipart/form-data')) {
|
||||
const form = new FormData();
|
||||
try {
|
||||
const newBody = _.isObject(body) ? body : JSON.parse(body);
|
||||
for (const [key, value] of Object.entries(newBody)) {
|
||||
form.append(key, value);
|
||||
}
|
||||
return form;
|
||||
} catch (_ex) {
|
||||
throw new Error(`Handler body error: The request header is ${contentType}, but the request body is not an object`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
Loading…
Reference in New Issue