feat: upgrade version from 0.0.15 to 0.0.16

This commit is contained in:
千风 2021-08-09 17:23:58 +08:00 committed by git-qfzhang
parent 6ea73bf213
commit c3127e9425
14 changed files with 4 additions and 758 deletions

View File

@ -14,3 +14,4 @@ package-lok.json
README.md
./example
./.signore

View File

@ -1,103 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = [
{
header: 'Invoke',
content: 'Invoke/trigger online functions.',
},
{
header: 'Usage',
content: '$ s invoke <options>',
},
{
header: 'Options',
optionList: [
{
name: 'invocation-type',
description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")',
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#特别说明]',
type: String,
},
{
name: 'event-file',
description: 'Event funtion: A file containing event data passed to the function during invoke. Http function: A file containing http request options sent to http trigger. Format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: 'f',
type: String,
},
{
name: 'event-stdin',
description: 'Read from standard input, to support script pipeline.Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
type: Boolean,
},
{
name: 'region',
description: 'Specify region in cli mode',
type: String,
},
{
name: 'service-name',
description: 'Specify service name in cli mode',
type: String,
},
{
name: 'function-name',
description: 'Specify function name in cli mode',
type: String,
},
{
name: 'domain-name',
description: 'Specify custom domain name in cli mode',
type: String,
},
],
},
{
header: 'Global Options',
optionList: [
{
name: 'access',
description: 'Specify key alias.',
alias: 'a',
type: Boolean,
},
{
name: 'help',
description: 'fc-remote-invoke help for command.',
alias: 'h',
type: Boolean,
},
],
},
{
header: 'Examples with Yaml',
content: [
'$ s invoke',
'$ s <ProjectName> invoke',
'$ s exec -- invoke --invocation-type sync --event <payload>',
'$ s exec -- invoke --event-file <file-path>',
'$ s exec -- invoke --event-stdin',
],
},
{
header: 'Examples with CLI',
content: [
{
example: '$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event <payload>',
},
{
example: '$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event-file <file-path>',
},
{
example: '$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event-stdin',
},
{
example: '\nYou also can refer to the usage of fc-api and execute [s cli fc-api -h] for help. $ s cli fc-api invokeFunction -h',
},
],
},
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vaGVscC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlO0lBQ2I7UUFDRSxNQUFNLEVBQUUsUUFBUTtRQUNoQixPQUFPLEVBQUUsa0NBQWtDO0tBQzVDO0lBQ0Q7UUFDRSxNQUFNLEVBQUUsT0FBTztRQUNmLE9BQU8sRUFBRSxzQkFBc0I7S0FDaEM7SUFDRDtRQUNFLE1BQU0sRUFBRSxTQUFTO1FBQ2pCLFVBQVUsRUFBRTtZQUNWO2dCQUNFLElBQUksRUFBRSxpQkFBaUI7Z0JBQ3ZCLFdBQVcsRUFBRSx3RkFBd0Y7Z0JBQ3JHLElBQUksRUFBRSxNQUFNO2FBQ2I7WUFDRDtnQkFDRSxJQUFJLEVBQUUsT0FBTztnQkFDYixXQUFXLEVBQUUsK0pBQStKO2dCQUM1SyxJQUFJLEVBQUUsTUFBTTthQUNiO1lBQ0Q7Z0JBQ0UsSUFBSSxFQUFFLFlBQVk7Z0JBQ2xCLFdBQVcsRUFBRSxtT0FBbU87Z0JBQ2hQLEtBQUssRUFBRSxHQUFHO2dCQUNWLElBQUksRUFBRSxNQUFNO2FBQ2I7WUFDRDtnQkFDRSxJQUFJLEVBQUUsYUFBYTtnQkFDbkIsV0FBVyxFQUFFLHdJQUF3STtnQkFDckosSUFBSSxFQUFFLE9BQU87YUFDZDtZQUNEO2dCQUNFLElBQUksRUFBRSxRQUFRO2dCQUNkLFdBQVcsRUFBRSw0QkF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UsNkZBQTZGO2FBQ3ZHO1lBQ0Q7Z0JBQ0UsT0FBTyxFQUFFLHdIQUF3SDthQUNsSTtTQUNGO0tBQ0Y7Q0FDRixDQUFBIn0=

View File

@ -1,5 +0,0 @@
export declare function getConfig(key: string): any;
export declare function getProfileFile(): {};
export declare function getDefaultProfilePath(): string;
declare const i18n: any;
export default i18n;

View File

@ -1,45 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultProfilePath = exports.getProfileFile = exports.getConfig = void 0;
const os_1 = __importDefault(require("os"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const js_yaml_1 = __importDefault(require("js-yaml"));
const i18n_1 = require("i18n");
function getConfig(key) {
const profile = getProfileFile();
return profile[key];
}
exports.getConfig = getConfig;
function getProfileFile() {
let profileResult = {};
try {
const profileFilePath = getDefaultProfilePath();
profileResult = js_yaml_1.default.load(fs_1.default.readFileSync(profileFilePath, 'utf8')) || {};
}
catch (e) {
console.log(e);
}
return profileResult;
}
exports.getProfileFile = getProfileFile;
function getDefaultProfilePath() {
return path_1.default.join(os_1.default.homedir(), '.s', 'set-config.yml');
}
exports.getDefaultProfilePath = getDefaultProfilePath;
const i18n = new i18n_1.I18n({
locales: ['en', 'zh'],
directory: path_1.default.join(__dirname, '..', '..', 'locales'),
});
const locale = getConfig('locale');
if (locale) {
i18n.setLocale(locale);
}
else {
i18n.setLocale('en');
}
exports.default = i18n;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaTE4bi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vaTE4bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSw0Q0FBb0I7QUFDcEIsNENBQW9CO0FBQ3BCLGdEQUF3Qjt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UMsQ0FBQztBQUNuQyxJQUFJLE1BQU0sRUFBRTtJQUNSLElBQUksQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLENBQUM7Q0FDMUI7S0FBTTtJQUNILElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7Q0FDeEI7QUFFRCxrQkFBZSxJQUFJLENBQUMifQ==

View File

@ -1,33 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const i18n_1 = __importDefault(require("./i18n"));
const core_1 = require("@serverless-devs/core");
class ComponentLogger {
static setContent(content) {
ComponentLogger.CONTENT = content;
}
static log(m, color) {
core_1.Logger.log(i18n_1.default.__(m) || m, color);
}
static info(m) {
core_1.Logger.info(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static debug(m) {
core_1.Logger.debug(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static error(m) {
core_1.Logger.error(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static warning(m) {
core_1.Logger.warn(ComponentLogger.CONTENT, i18n_1.default.__(m) || m);
}
static success(m) {
core_1.Logger.log(i18n_1.default.__(m) || m, 'green');
}
}
exports.default = ComponentLogger;
ComponentLogger.CONTENT = 'FC-REMOTE-INVOKE';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbW1vbi9sb2dnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSxrREFBMEI7QUFDMUIsZ0RBQStDO0FBRS9DLE1BQXFCLGVBQWU7SUFFbEMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxPQUFPO1FBQ3ZCLGVBQWUsQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO0lB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LENBQUMsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUN2QyxDQUFDOztBQTFCSCxrQ0EyQkM7QUExQlEsdUJBQU8sR0FBRyxrQkFBa0IsQ0FBQyJ9

View File

@ -1,21 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@serverless-devs/core");
class StdoutFormatter {
static initStdout() {
return __awaiter(this, void 0, void 0, function* () {
this.stdoutFormatter = yield core_1.loadComponent('devsapp/stdout-formatter');
});
}
}
exports.default = StdoutFormatter;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Rkb3V0LWZvcm1hdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vc3Rkb3V0LWZvcm1hdHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBLGdEQUFzRDtBQUV0RCxNQUFxQixlQUFlO0lBR2xDLE1BQU0sQ0FBTyxVQUFVOztZQUNyQixJQUFJLENBQUMsZUFBZSxHQUFHLE1BQU0sb0JBQWEsQ0FBQywwQkFBMEIsQ0FBQyxDQUFDO1FBQ3pFLENBQUM7S0FBQTtDQUNGO0FBTkQsa0NBTUMifQ==

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,62 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fc2_1 = __importDefault(require("@alicloud/fc2"));
const core = __importStar(require("@serverless-devs/core"));
class Client {
static buildFcClient(region, credentials) {
return __awaiter(this, void 0, void 0, function* () {
return new fc2_1.default(credentials.AccountID, {
accessKeyID: credentials.AccessKeyID,
accessKeySecret: credentials.AccessKeySecret,
securityToken: credentials.SecurityToken,
region,
endpoint: yield this.getFcEndpoint(),
timeout: 6000000,
});
});
}
static getFcEndpoint() {
return __awaiter(this, void 0, void 0, function* () {
const fcDefault = yield core.loadComponent('devsapp/fc-default');
const fcEndpoint = yield fcDefault.get({ args: 'fc-endpoint' });
if (!fcEndpoint) {
return undefined;
}
const enableFcEndpoint = yield fcDefault.get({ args: 'enable-fc-endpoint' });
return (enableFcEndpoint === true || enableFcEndpoint === 'true') ? fcEndpoint : undefined;
});
}
}
exports.default = Client;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi9jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsd0RBQStCO0FBQy9CLDREQUE4QztBQUc5QyxNQUFxQixNQUFNO0lBQ3pCLE1BQU0sQ0FBTyxhQUFhLENBQUMsTUFBYyxFQUFFLFdBQXlCOztZQUNsRSxPQUFPLElBQUksYUFBRSxDQUFDLFdBQVcsQ0FBQyxTQUFTLEVBQUU7Z0JBQ25DLFdBQVcsRUFBRSxXQUFXLENBQUMsV0FBVztnQkFDcEMsZUFBZSxFQUFFLFdBQVcsQ0FBQyxlQUFlO2dCQUM1QyxhQUFhLEVBQUUsV0FBVyxDQUFDLGFBQWE7Z0JBQ3hDLE1BQU07Z0JBQ04sUUFBUSxFQUFFLE1BQU0sSUFBSSxDQUFDLGFBQWEsRUFBRTtnQkFDcEMsT0FBTyxFQUFFLE9BQU87YUFDakIsQ0FBQyxDQUFBO1FBQ0osQ0FBQztLQUFBO0lBRU8sTUFBTSxDQUFPLGFBQWE7O1lBQ2hDLE1BQU0sU0FBUyxHQUFHLE1BQU0sSUFBSSxDQUFDLGFBQWEsQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO1lBQ2pFLE1BQU0sVUFBVSxHQUFXLE1BQU0sU0FBUyxDQUFDLEdBQUcsQ0FBQyxFQUFFLElBQUksRUFBRSxhQUFhLEVBQUUsQ0FBQyxDQUFDO1lBQ3hFLElBQUksQ0FBQyxVQUFVLEVBQUU7Z0JBQUUsT0FBTyxTQUFTLENBQUM7YUFBRTtZQUN0QyxNQUFNLGdCQUFnQixHQUFRLE1BQU0sU0FBUyxDQUFDLEdBQUcsQ0FBQyxFQUFFLElBQUksRUFBRSxvQkFBb0IsRUFBRSxDQUFDLENBQUM7WUFDbEYsT0FBTyxDQUFDLGdCQUFnQixLQUFLLElBQUksSUFBSSxnQkFBZ0IsS0FBSyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUM7UUFDN0YsQ0FBQztLQUFBO0NBQ0Y7QUFuQkQseUJBbUJDIn0=

View File

@ -1,68 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const lodash_1 = require("lodash");
const readline_1 = __importDefault(require("readline"));
const logger_1 = __importDefault(require("../common/logger"));
const stdin_1 = require("./stdin");
class File {
static getEvent(eventFile) {
return __awaiter(this, void 0, void 0, function* () {
let event = yield stdin_1.getStdin(); // read from pipes
if (!eventFile)
return event;
return yield new Promise((resolve, reject) => {
let input;
if (eventFile === '-') { // read from stdin
logger_1.default.log('Reading event data from stdin, which can be ended with Enter then Ctrl+D');
input = process.stdin;
}
else {
input = fs_extra_1.default.createReadStream(eventFile, {
encoding: 'utf-8'
});
}
const rl = readline_1.default.createInterface({
input,
output: process.stdout
});
event = '';
rl.on('line', (line) => {
event += line;
});
rl.on('close', () => resolve(event));
rl.on('SIGINT', () => reject(new Error('^C')));
});
});
}
static eventPriority(eventPriority) {
return __awaiter(this, void 0, void 0, function* () {
let eventFile;
if (lodash_1.isString(eventPriority.event)) {
return eventPriority.event;
}
else if (eventPriority.eventStdin) {
eventFile = '-';
}
else if (eventPriority.eventFile) {
eventFile = path_1.default.resolve(process.cwd(), eventPriority.eventFile);
}
return yield this.getEvent(eventFile);
});
}
}
exports.default = File;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2V2ZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBQUEsZ0RBQXdCO0FBQ3hCLHdEQUEwQjtBQUMxQixtQ0FBa0M7QUFDbEMsd0RBQWdDO0FBQ2hDLDhEQUFzQztBQUN0QyxtQ0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FcEMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxRQUFRLEVBQUUsR0FBRyxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQTtZQUNoRCxDQUFDLENBQUMsQ0FBQTtRQUNKLENBQUM7S0FBQTtJQUVELE1BQU0sQ0FBTyxhQUFhLENBQUMsYUFBYTs7WUFDdEMsSUFBSSxTQUFpQixDQUFDO1lBRXRCLElBQUksaUJBQVEsQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLEVBQUU7Z0JBQ2pDLE9BQU8sYUFBYSxDQUFDLEtBQUssQ0FBQzthQUM1QjtpQkFBTSxJQUFJLGFBQWEsQ0FBQyxVQUFVLEVBQUU7Z0JBQ25DLFNBQVMsR0FBRyxHQUFHLENBQUM7YUFDakI7aUJBQU0sSUFBSSxhQUFhLENBQUMsU0FBUyxFQUFFO2dCQUNsQyxTQUFTLEdBQUcsY0FBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsYUFBYSxDQUFDLFNBQVMsQ0FBQyxDQUFDO2FBQ2xFO1lBRUQsT0FBTyxNQUFNLElBQUksQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLENBQUE7UUFDdkMsQ0FBQztLQUFBO0NBQ0Y7QUE5Q0QsdUJBOENDIn0=

File diff suppressed because one or more lines are too long

View File

@ -1,69 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStdin = void 0;
const { stdin } = process;
function getStdin() {
var e_1, _a;
return __awaiter(this, void 0, void 0, function* () {
let result = '';
if (stdin.isTTY) {
return result;
}
stdin.setEncoding('utf8');
try {
for (var stdin_1 = __asyncValues(stdin), stdin_1_1; stdin_1_1 = yield stdin_1.next(), !stdin_1_1.done;) {
const chunk = stdin_1_1.value;
result += chunk;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (stdin_1_1 && !stdin_1_1.done && (_a = stdin_1.return)) yield _a.call(stdin_1);
}
finally { if (e_1) throw e_1.error; }
}
return result;
});
}
exports.getStdin = getStdin;
getStdin.buffer = () => __awaiter(void 0, void 0, void 0, function* () {
var e_2, _a;
const result = [];
let length = 0;
if (stdin.isTTY) {
return Buffer.concat([]);
}
try {
for (var stdin_2 = __asyncValues(stdin), stdin_2_1; stdin_2_1 = yield stdin_2.next(), !stdin_2_1.done;) {
const chunk = stdin_2_1.value;
result.push(chunk);
length += chunk.length;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (stdin_2_1 && !stdin_2_1.done && (_a = stdin_2.return)) yield _a.call(stdin_2);
}
finally { if (e_2) throw e_2.error; }
}
return Buffer.concat(result, length);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RkaW4uanMiLCJzb3VyY2VS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UFBTSxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsQ0FBQztBQUN0QyxDQUFDLENBQUEsQ0FBQyJ9

View File

@ -1,6 +1,6 @@
{
"name": "fc-remote-invoke",
"version": "0.0.15",
"version": "0.0.16",
"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.15
Version: 0.0.16
Description: 初始化component模板
HomePage: https://www.serverless-devs.com
Tags: #标签详情