Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fbl

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fbl - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

dist/src/plugins/prompts/BasePromptActionHandler.d.ts

4

dist/src/interfaces/IFlow.d.ts

@@ -5,3 +5,5 @@ export interface IFlow {

fbl?: string;
plugins?: string[];
plugins?: {
[name: string]: string;
};
applications?: string[];

@@ -8,0 +10,0 @@ };

@@ -15,3 +15,4 @@ "use strict";

const BaseExecutableActionHandler_1 = require("./BaseExecutableActionHandler");
const tmp = require('tmp-promise');
const typedi_1 = require("typedi");
const services_1 = require("../../services");
const version = require('../../../../package.json').version;

@@ -27,6 +28,6 @@ class ShellActionHandler extends BaseExecutableActionHandler_1.BaseExecutableActionHandler {

return __awaiter(this, void 0, void 0, function* () {
const file = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(file.path, options.script, 'utf8');
const file = yield typedi_1.Container.get(services_1.TempPathsRegistry).createTempFile();
yield util_1.promisify(fs_1.writeFile)(file, options.script, 'utf8');
const result = yield this.exec(snapshot, options.executable, [
file.path
file
], options.options);

@@ -33,0 +34,0 @@ yield this.assignTo(snapshot, context, options.assignTo, result);

@@ -14,5 +14,6 @@ "use strict";

const crypto_1 = require("crypto");
const tmp = require("tmp-promise");
const fs_1 = require("fs");
const util_1 = require("util");
const typedi_1 = require("typedi");
const services_1 = require("../../services");
class BaseCryptoActionHandler extends models_1.ActionHandler {

@@ -37,5 +38,5 @@ getValidationSchema() {

const cipher = crypto_1.createCipheriv(BaseCryptoActionHandler.encryptionAlgorithm, passwordHash.hash, iv);
const tmpFile = yield tmp.file();
const tmpFile = yield typedi_1.Container.get(services_1.TempPathsRegistry).createTempFile(true);
const rs = fs_1.createReadStream(file);
const ws = fs_1.createWriteStream(tmpFile.path);
const ws = fs_1.createWriteStream(tmpFile);
const writeAsync = (chunk) => {

@@ -56,3 +57,3 @@ return new Promise(resolve => {

});
yield util_1.promisify(fs_1.rename)(tmpFile.path, file);
yield util_1.promisify(fs_1.rename)(tmpFile, file);
});

@@ -82,4 +83,4 @@ }

const decipher = crypto_1.createDecipheriv(BaseCryptoActionHandler.encryptionAlgorithm, passwordHash.hash, iv);
const tmpFile = yield tmp.file();
const ws = fs_1.createWriteStream(tmpFile.path);
const tmpFile = yield typedi_1.Container.get(services_1.TempPathsRegistry).createTempFile(true);
const ws = fs_1.createWriteStream(tmpFile);
yield new Promise(resolve => {

@@ -92,3 +93,3 @@ rs.pipe(decipher).pipe(ws);

});
yield util_1.promisify(fs_1.rename)(tmpFile.path, file);
yield util_1.promisify(fs_1.rename)(tmpFile, file);
});

@@ -95,0 +96,0 @@ }

@@ -20,3 +20,2 @@ "use strict";

const version = require('../../../../package.json').version;
const tmp = require('tmp-promise');
class WriteToFileActionHandler extends models_1.ActionHandler {

@@ -36,6 +35,3 @@ getMetadata() {

else {
const tmpFile = yield tmp.file({
keep: true
});
file = tmpFile.path;
file = yield typedi_1.Container.get(services_1.TempPathsRegistry).createTempFile(true);
}

@@ -42,0 +38,0 @@ // create folders structure if needed

@@ -1,5 +0,6 @@

import { ActionHandler, ActionSnapshot } from '../../models';
import { ActionSnapshot } from '../../models';
import { IActionHandlerMetadata, IContext } from '../../interfaces';
import * as Joi from 'joi';
export declare class ConfirmActionHandler extends ActionHandler {
import { BasePromptActionHandler } from './BasePromptActionHandler';
export declare class ConfirmActionHandler extends BasePromptActionHandler {
private static metadata;

@@ -6,0 +7,0 @@ private static validationSchema;

@@ -11,8 +11,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../../models");
const Joi = require("joi");
const utils_1 = require("../../utils");
const BasePromptActionHandler_1 = require("./BasePromptActionHandler");
const version = require('../../../../package.json').version;
const prompts = require('prompts');
class ConfirmActionHandler extends models_1.ActionHandler {
class ConfirmActionHandler extends BasePromptActionHandler_1.BasePromptActionHandler {
getMetadata() {

@@ -26,8 +25,7 @@ return ConfirmActionHandler.metadata;

return __awaiter(this, void 0, void 0, function* () {
const value = (yield prompts({
const value = yield this.prompt({
type: 'confirm',
name: 'value',
initial: options.default,
message: options.message,
})).value;
});
/* istanbul ignore else */

@@ -34,0 +32,0 @@ if (options.assignResponseTo.ctx) {

@@ -1,5 +0,6 @@

import { ActionHandler, ActionSnapshot } from '../../models';
import { ActionSnapshot } from '../../models';
import { IActionHandlerMetadata, IContext } from '../../interfaces';
import * as Joi from 'joi';
export declare class MultiSelectActionHandler extends ActionHandler {
import { BasePromptActionHandler } from './BasePromptActionHandler';
export declare class MultiSelectActionHandler extends BasePromptActionHandler {
private static metadata;

@@ -6,0 +7,0 @@ private static validationSchema;

@@ -11,8 +11,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../../models");
const Joi = require("joi");
const utils_1 = require("../../utils");
const BasePromptActionHandler_1 = require("./BasePromptActionHandler");
const version = require('../../../../package.json').version;
const prompts = require('prompts');
class MultiSelectActionHandler extends models_1.ActionHandler {
class MultiSelectActionHandler extends BasePromptActionHandler_1.BasePromptActionHandler {
getMetadata() {

@@ -26,5 +25,4 @@ return MultiSelectActionHandler.metadata;

return __awaiter(this, void 0, void 0, function* () {
const value = (yield prompts({
const value = yield this.prompt({
type: 'multiselect',
name: 'value',
choices: options.options.map((o) => {

@@ -40,3 +38,3 @@ return {

hint: options.hint || '- Space to select. Return to submit'
})).value;
});
/* istanbul ignore else */

@@ -43,0 +41,0 @@ if (options.assignResponseTo.ctx) {

@@ -1,5 +0,6 @@

import { ActionHandler, ActionSnapshot } from '../../models';
import { ActionSnapshot } from '../../models';
import { IActionHandlerMetadata, IContext } from '../../interfaces';
import * as Joi from 'joi';
export declare class PromptActionHandler extends ActionHandler {
import { BasePromptActionHandler } from './BasePromptActionHandler';
export declare class PromptActionHandler extends BasePromptActionHandler {
private static metadata;

@@ -6,0 +7,0 @@ private static validationSchema;

@@ -11,9 +11,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../../models");
const jsonschema_1 = require("jsonschema");
const Joi = require("joi");
const utils_1 = require("../../utils");
const BasePromptActionHandler_1 = require("./BasePromptActionHandler");
const version = require('../../../../package.json').version;
const prompts = require('prompts');
class PromptActionHandler extends models_1.ActionHandler {
class PromptActionHandler extends BasePromptActionHandler_1.BasePromptActionHandler {
getMetadata() {

@@ -48,3 +47,3 @@ return PromptActionHandler.metadata;

const validator = new jsonschema_1.Validator();
let value = (yield prompts({
let value = yield this.prompt({
type: type,

@@ -54,3 +53,2 @@ float: float,

max: max,
name: 'value',
initial: options.default,

@@ -73,3 +71,3 @@ style: options.password ? 'password' : 'default',

}
})).value;
});
if (options.schema && options.schema.type !== 'string' && !isNaN(value)) {

@@ -76,0 +74,0 @@ value = Number(value);

@@ -1,5 +0,6 @@

import { ActionHandler, ActionSnapshot } from '../../models';
import { ActionSnapshot } from '../../models';
import { IActionHandlerMetadata, IContext } from '../../interfaces';
import * as Joi from 'joi';
export declare class SelectActionHandler extends ActionHandler {
import { BasePromptActionHandler } from './BasePromptActionHandler';
export declare class SelectActionHandler extends BasePromptActionHandler {
private static metadata;

@@ -6,0 +7,0 @@ private static validationSchema;

@@ -11,8 +11,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../../models");
const Joi = require("joi");
const utils_1 = require("../../utils");
const BasePromptActionHandler_1 = require("./BasePromptActionHandler");
const version = require('../../../../package.json').version;
const prompts = require('prompts');
class SelectActionHandler extends models_1.ActionHandler {
class SelectActionHandler extends BasePromptActionHandler_1.BasePromptActionHandler {
getMetadata() {

@@ -26,5 +25,4 @@ return SelectActionHandler.metadata;

return __awaiter(this, void 0, void 0, function* () {
const value = (yield prompts({
const value = yield this.prompt({
type: 'select',
name: 'value',
initial: options.default ? options.options.indexOf(options.default) : undefined,

@@ -38,3 +36,3 @@ choices: options.options.map((o) => {

message: options.message,
})).value;
});
/* istanbul ignore else */

@@ -41,0 +39,0 @@ if (options.assignResponseTo.ctx) {

import { FlowService, FBLService } from './index';
import { TempPathsRegistry } from './TempPathsRegistry';
export declare class CLIService {

@@ -16,2 +17,3 @@ static GLOBAL_CONFIG_PATH: string;

flowService: FlowService;
tempPathsRegistry: TempPathsRegistry;
run(): Promise<void>;

@@ -18,0 +20,0 @@ /**

@@ -31,2 +31,3 @@ "use strict";

const Joi = require("joi");
const TempPathsRegistry_1 = require("./TempPathsRegistry");
const prompts = require('prompts');

@@ -87,2 +88,4 @@ const requireg = require('requireg');

}
// remove all temp files and folders
yield this.tempPathsRegistry.cleanup();
if (!snapshot.successful) {

@@ -392,2 +395,6 @@ throw new Error('Execution failed.');

], CLIService.prototype, "flowService", void 0);
__decorate([
typedi_1.Inject(() => TempPathsRegistry_1.TempPathsRegistry),
__metadata("design:type", TempPathsRegistry_1.TempPathsRegistry)
], CLIService.prototype, "tempPathsRegistry", void 0);
CLIService = CLIService_1 = __decorate([

@@ -394,0 +401,0 @@ typedi_1.Service()

@@ -41,2 +41,13 @@ import { IContext, IFlow, IPlugin, IReporter } from '../interfaces';

/**
* Find plugin by its name
* @param {string} name
* @return {IPlugin | undefined}
*/
getPlugin(name: string): IPlugin | undefined;
/**
* Register single plugin
* @param {IPlugin} plugin
*/
registerPlugin(plugin: IPlugin): void;
/**
* Register plugins

@@ -47,5 +58,15 @@ * @param {IPlugin[]} plugins

/**
* Validate plugin
* @param {IPlugin} plugin
*/
validatePlugin(plugin: IPlugin): void;
/**
* Validate plugins to be compatible
*/
validatePlugins(): void;
/**
* Validate flow requirements
* @param {IFlow} flow
* @return {Promise<void>}
*/
validateFlowRequirements(flow: IFlow): Promise<void>;

@@ -52,0 +73,0 @@ /**

@@ -28,2 +28,3 @@ "use strict";

const shelljs_1 = require("shelljs");
const requireg = require('requireg');
const fblVersion = require('../../../package.json').version;

@@ -106,2 +107,30 @@ const joiStepSchemaExt = Joi.extend({

/**
* Find plugin by its name
* @param {string} name
* @return {IPlugin | undefined}
*/
getPlugin(name) {
return this.plugins[name];
}
/**
* Register single plugin
* @param {IPlugin} plugin
*/
registerPlugin(plugin) {
this.plugins[plugin.name] = plugin;
if (plugin.actionHandlers) {
plugin.actionHandlers.forEach(actionHander => {
this.actionHandlersRegistry.register(actionHander);
});
}
if (plugin.reporters) {
plugin.reporters.forEach(reporter => {
this.reporters[reporter.getName()] = reporter;
});
}
if (plugin.templateUtils) {
this.templateUtilityRegistry.register(...plugin.templateUtils);
}
}
/**
* Register plugins

@@ -112,54 +141,39 @@ * @param {IPlugin[]} plugins

plugins.forEach(plugin => {
this.plugins[plugin.name] = plugin;
if (plugin.actionHandlers) {
plugin.actionHandlers.forEach(actionHander => {
this.actionHandlersRegistry.register(actionHander);
});
}
if (plugin.reporters) {
plugin.reporters.forEach(reporter => {
this.reporters[reporter.getName()] = reporter;
});
}
if (plugin.templateUtils) {
this.templateUtilityRegistry.register(...plugin.templateUtils);
}
this.registerPlugin(plugin);
});
}
/**
* Validate plugins to be compatible
* Validate plugin
* @param {IPlugin} plugin
*/
validatePlugins() {
for (const name of Object.keys(this.plugins)) {
const plugin = this.plugins[name];
if (!semver.satisfies(fblVersion, plugin.requires.fbl)) {
if (this.allowUnsafePlugins) {
console.error(`${plugin.name}`.red + ' plugin is not compatible with current fbl version (' + `${fblVersion}`.red + ')');
validatePlugin(plugin) {
if (!semver.satisfies(fblVersion, plugin.requires.fbl)) {
if (this.allowUnsafePlugins) {
console.error(`${plugin.name}`.red + ' plugin is not compatible with current fbl version (' + `${fblVersion}`.red + ')');
}
else {
throw new Error(`${plugin.name} plugin is not compatible with current fbl version (${fblVersion})`);
}
}
if (plugin.requires.plugins) {
for (const dependencyPluginName of Object.keys(plugin.requires.plugins)) {
const dependencyPluginRequiredVersion = plugin.requires.plugins[dependencyPluginName];
const dependencyPlugin = this.plugins[dependencyPluginName];
if (!dependencyPlugin) {
if (this.allowUnsafePlugins) {
console.error(`${plugin.name}`.red + ' plugin requires missing plugin ' + `${dependencyPluginName}@${dependencyPluginRequiredVersion}`.red);
}
else {
throw new Error(`${plugin.name} plugin requires missing plugin ${dependencyPluginName}@${dependencyPluginRequiredVersion}`);
}
}
else {
throw new Error(`${plugin.name} plugin is not compatible with current fbl version (${fblVersion})`);
}
}
if (plugin.requires.plugins) {
for (const dependencyPluginName of Object.keys(plugin.requires.plugins)) {
const dependencyPluginRequiredVersion = plugin.requires.plugins[dependencyPluginName];
const dependencyPlugin = this.plugins[dependencyPluginName];
if (!dependencyPlugin) {
if (!semver.satisfies(dependencyPlugin.version, dependencyPluginRequiredVersion)) {
if (this.allowUnsafePlugins) {
console.error(`${plugin.name}`.red + ' plugin requires missing plugin ' + `${dependencyPluginName}@${dependencyPluginRequiredVersion}`.red);
console.error(`${plugin.name}`.red + ' plugin is not compatible with plugin ' + `${dependencyPluginName}@${dependencyPlugin.version}`.red);
}
else {
throw new Error(`${plugin.name} plugin requires missing plugin ${dependencyPluginName}@${dependencyPluginRequiredVersion}`);
throw new Error(`${plugin.name} plugin is not compatible with plugin ${dependencyPluginName}@${dependencyPlugin.version}`);
}
}
else {
if (!semver.satisfies(dependencyPlugin.version, dependencyPluginRequiredVersion)) {
if (this.allowUnsafePlugins) {
console.error(`${plugin.name}`.red + ' plugin is not compatible with plugin ' + `${dependencyPluginName}@${dependencyPlugin.version}`.red);
}
else {
throw new Error(`${plugin.name} plugin is not compatible with plugin ${dependencyPluginName}@${dependencyPlugin.version}`);
}
}
}
}

@@ -169,2 +183,15 @@ }

}
/**
* Validate plugins to be compatible
*/
validatePlugins() {
for (const name of Object.keys(this.plugins)) {
this.validatePlugin(this.plugins[name]);
}
}
/**
* Validate flow requirements
* @param {IFlow} flow
* @return {Promise<void>}
*/
validateFlowRequirements(flow) {

@@ -180,13 +207,19 @@ return __awaiter(this, void 0, void 0, function* () {

if (flow.requires.plugins) {
for (const pluginNameVersion of flow.requires.plugins) {
const chunks = pluginNameVersion.split('@');
const plugin = this.plugins[chunks[0]];
for (const pluginName of Object.keys(flow.requires.plugins)) {
const pluginExpectedVersion = flow.requires.plugins[pluginName];
let plugin = this.plugins[pluginName];
if (!plugin) {
errors.push(`required plugin ${chunks[0].green} is not registered`);
}
else {
if (!semver.satisfies(plugin.version, chunks[1])) {
errors.push(`actual plugin ${chunks[0].green} version ${plugin.version.green} doesn't satisfy required ${chunks[1].green}`);
try {
plugin = requireg(pluginName);
this.validatePlugin(plugin);
this.registerPlugin(plugin);
}
catch (e) {
errors.push(`required plugin ${pluginName.green} is not registered`);
plugin = null;
}
}
if (plugin && !semver.satisfies(plugin.version, pluginExpectedVersion)) {
errors.push(`actual plugin ${pluginName.green} version ${plugin.version.green} doesn't satisfy required ${pluginExpectedVersion.green}`);
}
}

@@ -221,3 +254,2 @@ }

return __awaiter(this, void 0, void 0, function* () {
yield this.validateFlowRequirements(flow);
const result = Joi.validate(flow, FBLService_1.validationSchema);

@@ -227,2 +259,3 @@ if (result.error) {

}
yield this.validateFlowRequirements(flow);
const idOrAlias = FBLService_1.extractIdOrAlias(flow.pipeline);

@@ -243,3 +276,3 @@ let metadata = FBLService_1.extractMetadata(flow.pipeline);

fbl: Joi.string().min(1),
plugins: Joi.array().items(Joi.string().regex(/[^@]+@[^@]+/i).min(1)).min(1),
plugins: Joi.object().min(1).pattern(/^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/, Joi.string().min(1)),
applications: Joi.array().items(Joi.string().min(1)).min(1)

@@ -246,0 +279,0 @@ }),

@@ -7,2 +7,3 @@ import { ActionHandlersRegistry } from './ActionHandlersRegistry';

import { TemplateUtilitiesRegistry } from './TemplateUtilitiesRegistry';
import { TempPathsRegistry } from './TempPathsRegistry';
export declare class FlowService {

@@ -21,2 +22,3 @@ private index;

templateUtilityRegistry: TemplateUtilitiesRegistry;
tempPathsRegistry: TempPathsRegistry;
/**

@@ -42,3 +44,3 @@ * Execute action

*/
private static downloadTarball;
private downloadTarball;
/**

@@ -49,3 +51,3 @@ * Extract tarball to temp dir

*/
private static extractTarball;
private extractTarball;
/**

@@ -57,2 +59,8 @@ * Recursively find index.yml in directory structure

recursivelyFindIndexFileInDir(path: string): Promise<string>;
/**
* Resolve flow, skipping checks if similar resolve action is already running
* @param {string} path
* @param {string} wd
* @return {Promise<string>}
*/
resolveFlowSkipChecks(path: string, wd: string): Promise<string>;

@@ -59,0 +67,0 @@ /**

@@ -34,4 +34,4 @@ "use strict";

const got = require("got");
const TempPathsRegistry_1 = require("./TempPathsRegistry");
const ejsLint = require('ejs-lint');
const tmp = require('tmp-promise');
let FlowService = FlowService_1 = class FlowService {

@@ -116,9 +116,7 @@ constructor() {

*/
static downloadTarball(url, redirectCount = 0) {
downloadTarball(url, redirectCount = 0) {
return __awaiter(this, void 0, void 0, function* () {
console.log(' -> Downloading tarball from remote URL: '.green + url);
const tarballFile = yield tmp.file({
postfix: '.tar.gz'
});
const ws = fs_1.createWriteStream(tarballFile.path);
const tarballFile = yield this.tempPathsRegistry.createTempFile(false, '.tar.gz');
const ws = fs_1.createWriteStream(tarballFile);
try {

@@ -135,6 +133,6 @@ yield new Promise((resolve, reject) => {

catch (e) {
yield util_1.promisify(fs_1.unlink)(tarballFile.path);
yield util_1.promisify(fs_1.unlink)(tarballFile);
throw e;
}
return tarballFile.path;
return tarballFile;
});

@@ -147,7 +145,7 @@ }

*/
static extractTarball(path) {
extractTarball(path) {
return __awaiter(this, void 0, void 0, function* () {
console.log(' -> Extracting tarball at path: '.green + path);
const tarball = path;
const result = (yield tmp.dir()).path;
const result = yield this.tempPathsRegistry.createTempDir();
yield tar_1.x({

@@ -190,2 +188,8 @@ file: tarball,

}
/**
* Resolve flow, skipping checks if similar resolve action is already running
* @param {string} path
* @param {string} wd
* @return {Promise<string>}
*/
resolveFlowSkipChecks(path, wd) {

@@ -195,3 +199,3 @@ return __awaiter(this, void 0, void 0, function* () {

if (path.startsWith('http://') || path.startsWith('https://')) {
absolutePath = yield FlowService_1.downloadTarball(path);
absolutePath = yield this.downloadTarball(path);
}

@@ -203,3 +207,3 @@ else {

if (absolutePath.endsWith('.tar.gz')) {
absolutePath = yield FlowService_1.extractTarball(absolutePath);
absolutePath = yield this.extractTarball(absolutePath);
}

@@ -360,2 +364,6 @@ // if path lead to directory - use index.yml inside it as a starting point

], FlowService.prototype, "templateUtilityRegistry", void 0);
__decorate([
typedi_1.Inject(() => TempPathsRegistry_1.TempPathsRegistry),
__metadata("design:type", TempPathsRegistry_1.TempPathsRegistry)
], FlowService.prototype, "tempPathsRegistry", void 0);
FlowService = FlowService_1 = __decorate([

@@ -362,0 +370,0 @@ typedi_1.Service(),

@@ -6,1 +6,2 @@ export * from './FBLService';

export * from './TemplateUtilitiesRegistry';
export * from './TempPathsRegistry';

@@ -11,2 +11,3 @@ "use strict";

__export(require("./TemplateUtilitiesRegistry"));
__export(require("./TempPathsRegistry"));
//# sourceMappingURL=index.js.map

@@ -32,5 +32,6 @@ export declare class FSUtil {

* @param {string} path
* @param {boolean} skipNotFound do not rise exception if file no longer exists
* @return {Promise<void>}
*/
static remove(path: string): Promise<void>;
static remove(path: string, skipNotFound?: boolean): Promise<void>;
/**

@@ -37,0 +38,0 @@ * Check if path represents a directory

@@ -102,7 +102,11 @@ "use strict";

* @param {string} path
* @param {boolean} skipNotFound do not rise exception if file no longer exists
* @return {Promise<void>}
*/
static remove(path) {
static remove(path, skipNotFound = false) {
return __awaiter(this, void 0, void 0, function* () {
if (!(yield existsAsync(path))) {
if (skipNotFound) {
return;
}
throw new Error(`Unable to find file or folder at path: ${path}`);

@@ -109,0 +113,0 @@ }

@@ -34,3 +34,2 @@ "use strict";

chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
const fblVersion = require('../../../package.json').version;

@@ -86,2 +85,3 @@ const execCmd = (cmd, args, answer, cwd) => __awaiter(this, void 0, void 0, function* () {

}
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();

@@ -92,2 +92,3 @@ });

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -114,14 +115,14 @@ version: '1.0.0',

};
const flowDir = yield tmp.dir();
const reportFile = yield tmp.file();
const contextFile = yield tmp.file();
const secretsFile = yield tmp.file();
const flowFile = `${flowDir.path}/flow.yml`;
const flowDir = yield tempPathsRegistry.createTempDir();
const reportFile = yield tempPathsRegistry.createTempFile();
const contextFile = yield tempPathsRegistry.createTempFile();
const secretsFile = yield tempPathsRegistry.createTempFile();
const flowFile = `${flowDir}/flow.yml`;
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
yield util_1.promisify(fs_1.writeFile)(contextFile.path, js_yaml_1.dump(customContextValues), 'utf8');
yield util_1.promisify(fs_1.writeFile)(secretsFile.path, js_yaml_1.dump(customSecretValues), 'utf8');
const cwdPath = flowDir.path.split(path_1.sep);
yield util_1.promisify(fs_1.writeFile)(contextFile, js_yaml_1.dump(customContextValues), 'utf8');
yield util_1.promisify(fs_1.writeFile)(secretsFile, js_yaml_1.dump(customSecretValues), 'utf8');
const cwdPath = flowDir.split(path_1.sep);
cwdPath.pop();
const cwd = cwdPath.join(path_1.sep);
const flowPath = `${path_1.basename(flowDir.path)}/flow.yml`;
const flowPath = `${path_1.basename(flowDir)}/flow.yml`;
const result = yield execCmd('node', [

@@ -131,7 +132,7 @@ `${__dirname}/../../src/cli.js`,

'-c', '$.ct=yes',
'-c', `$=@${contextFile.path}`,
'-c', `$=@${contextFile}`,
'-s', '$.st=yes',
'-p', `${__dirname}/../../src/plugins/flow`,
'-s', `$=@${secretsFile.path}`,
'-o', reportFile.path,
'-s', `$=@${secretsFile}`,
'-o', reportFile,
'-r', 'json',

@@ -141,3 +142,3 @@ flowPath

assert.strictEqual(result.code, 0);
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile.path, 'utf8');
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile, 'utf8');
assert(reportJson.length > 0);

@@ -160,2 +161,3 @@ const report = JSON.parse(reportJson);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -173,8 +175,8 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [
'dist/src/cli.js',
'-r', 'json',
flowFile.path
flowFile
]);

@@ -186,3 +188,3 @@ assert.strictEqual(result.code, 1);

'-o', '/tmp/report.json',
flowFile.path
flowFile
]);

@@ -195,3 +197,3 @@ assert.strictEqual(result.code, 1);

'-r', 'unknown',
flowFile.path
flowFile
]);

@@ -205,3 +207,3 @@ assert.strictEqual(result.code, 1);

'--report-option', 'test=@missing.file',
flowFile.path
flowFile
]);

@@ -214,2 +216,3 @@ assert.strictEqual(result.code, 1);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -228,4 +231,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [

@@ -235,3 +238,3 @@ 'dist/src/cli.js',

'-s', '$.st=yes',
flowFile.path
flowFile
], 'prompt_value');

@@ -243,2 +246,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -257,4 +261,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [

@@ -264,3 +268,3 @@ 'dist/src/cli.js',

'-s', '$.st.yes',
flowFile.path
flowFile
], 'prompt_value');

@@ -272,2 +276,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -294,9 +299,9 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
const reportFile = yield tmp.file();
const contextFile = yield tmp.file();
const secretsFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
yield util_1.promisify(fs_1.writeFile)(contextFile.path, js_yaml_1.dump(customContextValues), 'utf8');
yield util_1.promisify(fs_1.writeFile)(secretsFile.path, js_yaml_1.dump(customSecretValues), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
const reportFile = yield tempPathsRegistry.createTempFile();
const contextFile = yield tempPathsRegistry.createTempFile();
const secretsFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
yield util_1.promisify(fs_1.writeFile)(contextFile, js_yaml_1.dump(customContextValues), 'utf8');
yield util_1.promisify(fs_1.writeFile)(secretsFile, js_yaml_1.dump(customSecretValues), 'utf8');
const globalConfig = {

@@ -308,7 +313,7 @@ plugins: [

'$.ct=yes',
`$=@${contextFile.path}`
`$=@${contextFile}`
],
secrets: [
'$.st=yes',
`$=@${secretsFile.path}`
`$=@${secretsFile}`
],

@@ -322,8 +327,8 @@ 'no-colors': true,

'dist/src/cli.js',
'-o', reportFile.path,
'-o', reportFile,
'-r', 'json',
flowFile.path
flowFile
]);
assert.strictEqual(result.code, 0);
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile.path, 'utf8');
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile, 'utf8');
assert(reportJson.length > 0);

@@ -346,2 +351,3 @@ const report = JSON.parse(reportJson);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -357,8 +363,8 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -376,2 +382,3 @@ assert.strictEqual(result.code, 1);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -389,4 +396,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [

@@ -396,3 +403,3 @@ 'dist/src/cli.js',

'--no-colors',
flowFile.path
flowFile
]);

@@ -404,2 +411,3 @@ assert.strictEqual(result.code, 1);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -417,4 +425,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [

@@ -424,3 +432,3 @@ 'dist/src/cli.js',

'--no-colors',
flowFile.path
flowFile
]);

@@ -434,3 +442,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-plugins',
flowFile.path
flowFile
]);

@@ -443,2 +451,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -459,8 +468,8 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -473,3 +482,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-flows',
flowFile.path
flowFile
]);

@@ -482,2 +491,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const plugin = require('../../src/plugins/flow');

@@ -487,5 +497,5 @@ const flow = {

requires: {
plugins: [
`${plugin.name}@0.0.0`
]
plugins: {
[plugin.name]: '0.0.0'
}
},

@@ -502,8 +512,8 @@ pipeline: {

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -516,3 +526,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-flows',
flowFile.path
flowFile
]);

@@ -525,8 +535,9 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {
version: '1.0.0',
requires: {
plugins: [
'test@0.0.1'
]
plugins: {
test: '0.0.1'
}
},

@@ -543,8 +554,8 @@ pipeline: {

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -557,3 +568,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-flows',
flowFile.path
flowFile
]);

@@ -566,2 +577,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -584,8 +596,8 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -598,3 +610,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-flows',
flowFile.path
flowFile
]);

@@ -607,2 +619,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const plugin = require('../../src/plugins/flow');

@@ -613,5 +626,5 @@ const flow = {

fbl: `>=${fblVersion}`,
plugins: [
`${plugin.name}@~${plugin.version}`
],
plugins: {
[plugin.name]: `~${plugin.version}`
},
applications: [

@@ -631,8 +644,8 @@ 'echo'

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
'--no-colors',
flowFile.path
flowFile
]);

@@ -644,2 +657,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -657,4 +671,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [

@@ -664,3 +678,3 @@ 'dist/src/cli.js',

'--no-colors',
flowFile.path
flowFile
]);

@@ -674,3 +688,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-plugins',
flowFile.path
flowFile
]);

@@ -683,2 +697,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -696,4 +711,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
let result = yield execCmd('node', [

@@ -703,3 +718,3 @@ 'dist/src/cli.js',

'--no-colors',
flowFile.path
flowFile
]);

@@ -713,3 +728,3 @@ assert.strictEqual(result.code, 1);

'--unsafe-plugins',
flowFile.path
flowFile
]);

@@ -722,2 +737,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -735,4 +751,4 @@ version: '1.0.0',

};
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, js_yaml_1.dump(flow), 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [

@@ -742,3 +758,3 @@ 'dist/src/cli.js',

'--no-colors',
flowFile.path
flowFile
]);

@@ -750,2 +766,3 @@ assert.strictEqual(result.code, 0);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = [

@@ -766,15 +783,15 @@ 'version: 1.0.0',

].join('\n');
const flowFile = yield tmp.file();
const reportFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, flow, 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
const reportFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, flow, 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
'-o', reportFile.path,
'-o', reportFile,
'-r', 'json',
'--global-template-delimiter', '@',
'--local-template-delimiter', '&',
flowFile.path
flowFile
], 'prompt_value');
assert.strictEqual(result.code, 0);
const report = JSON.parse(yield util_1.promisify(fs_1.readFile)(reportFile.path, 'utf8'));
const report = JSON.parse(yield util_1.promisify(fs_1.readFile)(reportFile, 'utf8'));
const children = report.steps.filter((v) => v.type === 'child');

@@ -795,2 +812,3 @@ const contextSteps = children[children.length - 1].payload.steps.filter((v) => v.type === 'context');

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = [

@@ -804,7 +822,7 @@ 'version: 1.0.0',

].join('\n');
const flowFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(flowFile.path, flow, 'utf8');
const flowFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(flowFile, flow, 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
flowFile.path
flowFile
], 'prompt_value');

@@ -826,2 +844,3 @@ assert.strictEqual(result.code, 1);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -839,15 +858,15 @@ version: '1.0.0',

};
const reportFile = yield tmp.file();
const rootDir = yield tmp.dir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir.path, 'l1/index.yml/l3'));
const indexPath = path_1.join(rootDir.path, `l1/index.yml/l3/index.${extention}`);
const reportFile = yield tempPathsRegistry.createTempFile();
const rootDir = yield tempPathsRegistry.createTempDir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir, 'l1/index.yml/l3'));
const indexPath = path_1.join(rootDir, `l1/index.yml/l3/index.${extention}`);
yield util_1.promisify(fs_1.writeFile)(indexPath, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
'-o', reportFile.path,
'-o', reportFile,
'-r', 'json',
rootDir.path
rootDir
]);
assert.strictEqual(result.code, 0);
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile.path, 'utf8');
const reportJson = yield util_1.promisify(fs_1.readFile)(reportFile, 'utf8');
assert(reportJson.length > 0);

@@ -873,2 +892,3 @@ const report = JSON.parse(reportJson);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -886,9 +906,9 @@ version: '1.0.0',

};
const rootDir = yield tmp.dir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir.path, 'l1/l2/l3'));
const flowPath = path_1.join(rootDir.path, `l1/l2/l3/test.yml`);
const rootDir = yield tempPathsRegistry.createTempDir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir, 'l1/l2/l3'));
const flowPath = path_1.join(rootDir, `l1/l2/l3/test.yml`);
yield util_1.promisify(fs_1.writeFile)(flowPath, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
rootDir.path
rootDir
]);

@@ -900,2 +920,3 @@ assert.strictEqual(result.code, 1);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flow = {

@@ -913,10 +934,10 @@ version: '1.0.0',

};
const rootDir = yield tmp.dir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir.path, 'l1/l2/l3'));
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir.path, 'l1/l2/l4'));
const flowPath = path_1.join(rootDir.path, `l1/l2/l3/index.yml`);
const rootDir = yield tempPathsRegistry.createTempDir();
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir, 'l1/l2/l3'));
yield utils_1.FSUtil.mkdirp(path_1.join(rootDir, 'l1/l2/l4'));
const flowPath = path_1.join(rootDir, `l1/l2/l3/index.yml`);
yield util_1.promisify(fs_1.writeFile)(flowPath, js_yaml_1.dump(flow), 'utf8');
const result = yield execCmd('node', [
'dist/src/cli.js',
rootDir.path
rootDir
]);

@@ -923,0 +944,0 @@ assert.strictEqual(result.code, 1);

export declare class ContextValuesAssignmentActionHandlerTestSuite {
after(): void;
after(): Promise<void>;
failValidation(): Promise<void>;

@@ -4,0 +4,0 @@ passValidation(): Promise<void>;

@@ -34,6 +34,8 @@ "use strict";

chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let ContextValuesAssignmentActionHandlerTestSuite = class ContextValuesAssignmentActionHandlerTestSuite {
after() {
typedi_1.Container.reset();
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}

@@ -90,2 +92,3 @@ failValidation() {

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new ContextValuesAssignmentActionHandler_1.ContextValuesAssignmentActionHandler();

@@ -99,9 +102,9 @@ const context = ContextUtil_1.ContextUtil.generateEmptyContext();

};
const tmpFile = yield tmp.file();
const tmpFile = yield tempPathsRegistry.createTempFile();
// write to temp file
yield util_1.promisify(fs_1.writeFile)(tmpFile.path, js_yaml_1.dump(fileContent), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile, js_yaml_1.dump(fileContent), 'utf8');
const options = {
'$': {
inline: inlineContent,
files: [tmpFile.path]
files: [tmpFile]
}

@@ -129,2 +132,3 @@ };

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flowService = typedi_1.Container.get(services_1.FlowService);

@@ -140,5 +144,5 @@ flowService.debug = true;

};
const tmpFile = yield tmp.file();
const tmpFile = yield tempPathsRegistry.createTempFile();
// write to temp file
yield util_1.promisify(fs_1.writeFile)(tmpFile.path, js_yaml_1.dump(fileContent), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile, js_yaml_1.dump(fileContent), 'utf8');
const options = {

@@ -157,3 +161,3 @@ '$': {

'$.fromFile': {
files: [tmpFile.path]
files: [tmpFile]
}

@@ -169,4 +173,4 @@ };

// do the same with relative path
options['$.fromFile'].files = [path_1.basename(tmpFile.path)];
snapshot.wd = path_1.dirname(tmpFile.path);
options['$.fromFile'].files = [path_1.basename(tmpFile)];
snapshot.wd = path_1.dirname(tmpFile);
yield actionHandler.validate(options, context, snapshot);

@@ -182,2 +186,3 @@ yield actionHandler.execute(options, context, snapshot);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new ContextValuesAssignmentActionHandler_1.ContextValuesAssignmentActionHandler();

@@ -194,7 +199,7 @@ const context = ContextUtil_1.ContextUtil.generateEmptyContext();

};
const tmpFile1 = yield tmp.file();
const tmpFile2 = yield tmp.file();
const tmpFile1 = yield tempPathsRegistry.createTempFile();
const tmpFile2 = yield tempPathsRegistry.createTempFile();
// write to temp files
yield util_1.promisify(fs_1.writeFile)(tmpFile1.path, js_yaml_1.dump(file1Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile2.path, js_yaml_1.dump(file2Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile1, js_yaml_1.dump(file1Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile2, js_yaml_1.dump(file2Content), 'utf8');
const options = {

@@ -208,4 +213,4 @@ '$': {

files: [
tmpFile1.path,
tmpFile2.path
tmpFile1,
tmpFile2
]

@@ -223,6 +228,6 @@ }

options['$.fromFile'].files = [
path_1.basename(tmpFile1.path),
tmpFile2.path
path_1.basename(tmpFile1),
tmpFile2
];
snapshot.wd = path_1.dirname(tmpFile1.path);
snapshot.wd = path_1.dirname(tmpFile1);
yield actionHandler.validate(options, context, snapshot);

@@ -255,2 +260,3 @@ yield actionHandler.execute(options, context, snapshot);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new ContextValuesAssignmentActionHandler_1.ContextValuesAssignmentActionHandler();

@@ -261,8 +267,8 @@ const context = ContextUtil_1.ContextUtil.generateEmptyContext();

}];
const tmpFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(tmpFile.path, js_yaml_1.dump(fileContent), 'utf8');
const tmpFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(tmpFile, js_yaml_1.dump(fileContent), 'utf8');
const options = {
'$.fromFile': {
files: [
tmpFile.path
tmpFile
]

@@ -269,0 +275,0 @@ }

export declare class SecretValuesAssignmentActionHandlerTestSuite {
after(): void;
after(): Promise<void>;
failValidation(): Promise<void>;

@@ -4,0 +4,0 @@ passValidation(): Promise<void>;

@@ -30,10 +30,12 @@ "use strict";

const services_1 = require("../../../../src/services");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const utils_1 = require("../../../../src/utils");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let SecretValuesAssignmentActionHandlerTestSuite = class SecretValuesAssignmentActionHandlerTestSuite {
after() {
typedi_1.Container.reset();
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}

@@ -43,3 +45,3 @@ failValidation() {

const actionHandler = new SecretValuesAssignmentActionHandler_1.SecretValuesAssignmentActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -65,3 +67,3 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new SecretValuesAssignmentActionHandler_1.SecretValuesAssignmentActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -92,2 +94,3 @@ yield chai.expect(actionHandler.validate({

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flowService = typedi_1.Container.get(services_1.FlowService);

@@ -98,3 +101,3 @@ const actionHandlersRegistry = typedi_1.Container.get(services_1.ActionHandlersRegistry);

actionHandlersRegistry.register(actionHandler);
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
context.secrets.existing = {

@@ -106,5 +109,5 @@ value: 'value'

};
const tmpFile = yield tmp.file();
const tmpFile = yield tempPathsRegistry.createTempFile();
// write to temp file
yield util_1.promisify(fs_1.writeFile)(tmpFile.path, js_yaml_1.dump(fileContent), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile, js_yaml_1.dump(fileContent), 'utf8');
const options = {

@@ -122,3 +125,3 @@ '$': {

'$.fromFile': {
files: [tmpFile.path]
files: [tmpFile]
}

@@ -133,4 +136,4 @@ };

// do the same with relative path
options['$.fromFile'].files = [path_1.basename(tmpFile.path)];
snapshot = yield flowService.executeAction(path_1.dirname(tmpFile.path), actionHandler.getMetadata().id, {}, options, context);
options['$.fromFile'].files = [path_1.basename(tmpFile)];
snapshot = yield flowService.executeAction(path_1.dirname(tmpFile), actionHandler.getMetadata().id, {}, options, context);
assert.strictEqual(context.secrets.test, 123);

@@ -145,2 +148,3 @@ assert.strictEqual(context.secrets.existing.value, 'value');

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const flowService = typedi_1.Container.get(services_1.FlowService);

@@ -151,3 +155,3 @@ const actionHandlersRegistry = typedi_1.Container.get(services_1.ActionHandlersRegistry);

actionHandlersRegistry.register(actionHandler);
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
context.secrets.existing = {

@@ -162,7 +166,7 @@ value: 'value'

};
const tmpFile1 = yield tmp.file();
const tmpFile2 = yield tmp.file();
const tmpFile1 = yield tempPathsRegistry.createTempFile();
const tmpFile2 = yield tempPathsRegistry.createTempFile();
// write to temp files
yield util_1.promisify(fs_1.writeFile)(tmpFile1.path, js_yaml_1.dump(file1Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile2.path, js_yaml_1.dump(file2Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile1, js_yaml_1.dump(file1Content), 'utf8');
yield util_1.promisify(fs_1.writeFile)(tmpFile2, js_yaml_1.dump(file2Content), 'utf8');
const options = {

@@ -176,4 +180,4 @@ '$': {

files: [
tmpFile1.path,
tmpFile2.path
tmpFile1,
tmpFile2
]

@@ -190,6 +194,6 @@ }

options['$.fromFile'].files = [
path_1.basename(tmpFile1.path),
tmpFile2.path
path_1.basename(tmpFile1),
tmpFile2
];
snapshot = yield flowService.executeAction(path_1.dirname(tmpFile1.path), actionHandler.getMetadata().id, {}, options, context);
snapshot = yield flowService.executeAction(path_1.dirname(tmpFile1), actionHandler.getMetadata().id, {}, options, context);
assert.strictEqual(context.secrets.existing.value, 'value');

@@ -196,0 +200,0 @@ assert.strictEqual(context.secrets.other, 'other');

@@ -37,3 +37,2 @@ "use strict";

chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
class DummyActionHandler extends models_1.ActionHandler {

@@ -147,2 +146,3 @@ constructor(fn) {

return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();

@@ -176,2 +176,3 @@ for (const dummyServerWrapper of this.dummyServerWrappers) {

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandlersRegistry = typedi_1.Container.get(services_1.ActionHandlersRegistry);

@@ -191,4 +192,4 @@ let actionHandlerOptions = null;

};
const tmpFile = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(tmpFile.path, js_yaml_1.dump(subFlow), 'utf8');
const tmpFile = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(tmpFile, js_yaml_1.dump(subFlow), 'utf8');
const actionHandler = new AttachedFlowActionHandler_1.AttachedFlowActionHandler();

@@ -198,4 +199,4 @@ const context = utils_1.ContextUtil.generateEmptyContext();

const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
yield actionHandler.validate(tmpFile.path, context, snapshot);
yield actionHandler.execute(tmpFile.path, context, snapshot);
yield actionHandler.validate(tmpFile, context, snapshot);
yield actionHandler.execute(tmpFile, context, snapshot);
assert.strictEqual(actionHandlerOptions, true);

@@ -207,2 +208,3 @@ assert.strictEqual(actionHandlerContext.ctx.tst, 123);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandlersRegistry = typedi_1.Container.get(services_1.ActionHandlersRegistry);

@@ -222,4 +224,4 @@ let actionHandlerOptions = null;

};
const tmpDir = yield tmp.dir();
yield util_1.promisify(fs_1.writeFile)(path_1.join(tmpDir.path, 'index.yml'), js_yaml_1.dump(subFlow), 'utf8');
const tmpDir = yield tempPathsRegistry.createTempDir();
yield util_1.promisify(fs_1.writeFile)(path_1.join(tmpDir, 'index.yml'), js_yaml_1.dump(subFlow), 'utf8');
const actionHandler = new AttachedFlowActionHandler_1.AttachedFlowActionHandler();

@@ -229,4 +231,4 @@ const context = utils_1.ContextUtil.generateEmptyContext();

const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
yield actionHandler.validate(tmpDir.path, context, snapshot);
yield actionHandler.execute(tmpDir.path, context, snapshot);
yield actionHandler.validate(tmpDir, context, snapshot);
yield actionHandler.execute(tmpDir, context, snapshot);
assert.strictEqual(actionHandlerOptions, true);

@@ -417,2 +419,3 @@ assert.strictEqual(actionHandlerContext.ctx.tst, 123);

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandlersRegistry = typedi_1.Container.get(services_1.ActionHandlersRegistry);

@@ -431,5 +434,5 @@ const dummyActionHandler = new DummyActionHandler((opts, ctx) => {

};
const tmpDir = yield tmp.dir();
const indexYmlPath = path_1.join(tmpDir.path, 'index.yml');
const tarballPath = path_1.join(tmpDir.path, 'test.tar.gz');
const tmpDir = yield tempPathsRegistry.createTempDir();
const indexYmlPath = path_1.join(tmpDir, 'index.yml');
const tarballPath = path_1.join(tmpDir, 'test.tar.gz');
yield util_1.promisify(fs_1.writeFile)(indexYmlPath, js_yaml_1.dump(subFlow), 'utf8');

@@ -436,0 +439,0 @@ yield tar_1.c({

@@ -26,15 +26,21 @@ "use strict";

const util_1 = require("util");
const FSUtil_1 = require("../../../../src/utils/FSUtil");
const utils_1 = require("../../../../src/utils");
const os_1 = require("os");
const CopyPathActionHandler_1 = require("../../../../src/plugins/fs/CopyPathActionHandler");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const typedi_1 = require("typedi");
const services_1 = require("../../../../src/services");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let CopyPathActionHandlerTestSuite = class CopyPathActionHandlerTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new CopyPathActionHandler_1.CopyPathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -56,3 +62,3 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new CopyPathActionHandler_1.CopyPathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -67,14 +73,15 @@ yield chai.expect(actionHandler.validate({

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new CopyPathActionHandler_1.CopyPathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const tmpdir = yield tmp.dir();
yield FSUtil_1.FSUtil.mkdirp(path_1.resolve(tmpdir.path, 'l1', 'l2'));
let tmpfile = path_1.resolve(tmpdir.path, 'l1', 'l2', '1.txt');
const tmpdir = yield tempPathsRegistry.createTempDir();
yield utils_1.FSUtil.mkdirp(path_1.resolve(tmpdir, 'l1', 'l2'));
let tmpfile = path_1.resolve(tmpdir, 'l1', 'l2', '1.txt');
yield util_1.promisify(fs_1.writeFile)(tmpfile, '', 'utf8');
tmpfile = path_1.resolve(tmpdir.path, 'l1', 'l2', '2.txt');
tmpfile = path_1.resolve(tmpdir, 'l1', 'l2', '2.txt');
yield util_1.promisify(fs_1.writeFile)(tmpfile, '', 'utf8');
// copy file to folder without specifying a new name
let source = tmpfile;
let target = tmpdir.path + path_1.sep + 'l1' + path_1.sep;
let target = tmpdir + path_1.sep + 'l1' + path_1.sep;
yield actionHandler.execute({

@@ -87,4 +94,4 @@ from: source,

// copy file to folder with file name overriding
source = path_1.resolve(tmpdir.path, 'l1', 'l2', '1.txt');
target = path_1.resolve(tmpdir.path, 'l1', 'l2', 'm1.txt');
source = path_1.resolve(tmpdir, 'l1', 'l2', '1.txt');
target = path_1.resolve(tmpdir, 'l1', 'l2', 'm1.txt');
yield actionHandler.execute({

@@ -97,4 +104,4 @@ from: source,

// copy folder with name overriding
source = path_1.resolve(tmpdir.path, 'l1');
target = path_1.resolve(tmpdir.path, 'test2');
source = path_1.resolve(tmpdir, 'l1');
target = path_1.resolve(tmpdir, 'test2');
yield actionHandler.execute({

@@ -104,7 +111,7 @@ from: source,

}, context, snapshot);
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', 'l2', 'm1.txt')));
// copy folder contents into different folder;
source = target + path_1.sep;
target = path_1.resolve(tmpdir.path, 'test3');
target = path_1.resolve(tmpdir, 'test3');
yield actionHandler.execute({

@@ -114,6 +121,6 @@ from: source,

}, context, snapshot);
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test3', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test3', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test3', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test3', 'l2', 'm1.txt')));
});

@@ -124,3 +131,3 @@ }

const actionHandler = new CopyPathActionHandler_1.CopyPathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -127,0 +134,0 @@ yield chai.expect(actionHandler.execute({

@@ -28,12 +28,19 @@ "use strict";

const assert = require("assert");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const utils_1 = require("../../../../src/utils");
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let CryptoTestSuite = class CryptoTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new EncryptActionHandler_1.EncryptActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -62,5 +69,5 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new EncryptActionHandler_1.EncryptActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
actionHandler.validate({
yield actionHandler.validate({
password: 'secret',

@@ -70,3 +77,3 @@ include: ['/tmp'],

}, context, snapshot);
actionHandler.validate({
yield actionHandler.validate({
password: 'secret',

@@ -79,13 +86,14 @@ include: ['/tmp']

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const encryptActionHandler = new EncryptActionHandler_1.EncryptActionHandler();
const decryptActionHandler = new DecryptActionHandler_1.DecryptActionHandler();
const tmpDir = yield tmp.dir();
const tmpDir = yield tempPathsRegistry.createTempDir();
const writeFileAsync = util_1.promisify(fs_1.writeFile);
const readFileAsync = util_1.promisify(fs_1.readFile);
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, tmpDir.path, 0);
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, tmpDir, 0);
const files = [
path_1.join(tmpDir.path, 'a.txt'),
path_1.join(tmpDir.path, 'b.txt'),
path_1.join(tmpDir.path, 'c.ign'),
path_1.join(tmpDir, 'a.txt'),
path_1.join(tmpDir, 'b.txt'),
path_1.join(tmpDir, 'c.ign'),
];

@@ -92,0 +100,0 @@ const fileContent = 'test@'.repeat(100);

@@ -26,12 +26,19 @@ "use strict";

const assert = require("assert");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const utils_1 = require("../../../../src/utils");
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let MakeDirActionHandlerTestSuite = class MakeDirActionHandlerTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new MakeDirActionHandler_1.MakeDirActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -47,3 +54,3 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new MakeDirActionHandler_1.MakeDirActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -55,7 +62,8 @@ yield chai.expect(actionHandler.validate('/tmp/test', context, snapshot)).to.be.not.rejected;

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new MakeDirActionHandler_1.MakeDirActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const tmpdir = yield tmp.dir();
const path = path_1.resolve(tmpdir.path, 'l1');
const tmpdir = yield tempPathsRegistry.createTempDir();
const path = path_1.resolve(tmpdir, 'l1');
yield actionHandler.execute(path, context, snapshot);

@@ -62,0 +70,0 @@ assert(fs_1.existsSync(path));

@@ -27,14 +27,20 @@ "use strict";

const util_1 = require("util");
const FSUtil_1 = require("../../../../src/utils/FSUtil");
const utils_1 = require("../../../../src/utils");
const os_1 = require("os");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let MovePathActionHandlerTestSuite = class MovePathActionHandlerTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new MovePathActionHandler_1.MovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -56,3 +62,3 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new MovePathActionHandler_1.MovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -67,14 +73,15 @@ yield chai.expect(actionHandler.validate({

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new MovePathActionHandler_1.MovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const tmpdir = yield tmp.dir();
yield FSUtil_1.FSUtil.mkdirp(path_1.resolve(tmpdir.path, 'l1', 'l2'));
let tmpfile = path_1.resolve(tmpdir.path, 'l1', 'l2', '1.txt');
const tmpdir = yield tempPathsRegistry.createTempDir();
yield utils_1.FSUtil.mkdirp(path_1.resolve(tmpdir, 'l1', 'l2'));
let tmpfile = path_1.resolve(tmpdir, 'l1', 'l2', '1.txt');
yield util_1.promisify(fs_1.writeFile)(tmpfile, '', 'utf8');
tmpfile = path_1.resolve(tmpdir.path, 'l1', 'l2', '2.txt');
tmpfile = path_1.resolve(tmpdir, 'l1', 'l2', '2.txt');
yield util_1.promisify(fs_1.writeFile)(tmpfile, '', 'utf8');
// move file to folder without specifying a new name
let source = tmpfile;
let target = tmpdir.path + path_1.sep + 'l1' + path_1.sep;
let target = tmpdir + path_1.sep + 'l1' + path_1.sep;
yield actionHandler.execute({

@@ -86,4 +93,4 @@ from: source,

// move file to folder with file name overriding
source = path_1.resolve(tmpdir.path, 'l1', 'l2', '1.txt');
target = path_1.resolve(tmpdir.path, 'l1', 'l2', 'm1.txt');
source = path_1.resolve(tmpdir, 'l1', 'l2', '1.txt');
target = path_1.resolve(tmpdir, 'l1', 'l2', 'm1.txt');
yield actionHandler.execute({

@@ -95,4 +102,4 @@ from: source,

// move folder with name overriding
source = path_1.resolve(tmpdir.path, 'l1');
target = path_1.resolve(tmpdir.path, 'test2');
source = path_1.resolve(tmpdir, 'l1');
target = path_1.resolve(tmpdir, 'test2');
yield actionHandler.execute({

@@ -102,7 +109,7 @@ from: source,

}, context, snapshot);
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test2', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test2', 'l2', 'm1.txt')));
// move folder contents into different folder;
source = target + path_1.sep;
target = path_1.resolve(tmpdir.path, 'test3');
target = path_1.resolve(tmpdir, 'test3');
yield actionHandler.execute({

@@ -112,4 +119,4 @@ from: source,

}, context, snapshot);
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test3', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir.path, 'test3', 'l2', 'm1.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test3', '2.txt')));
assert(fs_1.existsSync(path_1.resolve(tmpdir, 'test3', 'l2', 'm1.txt')));
});

@@ -120,3 +127,3 @@ }

const actionHandler = new MovePathActionHandler_1.MovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -123,0 +130,0 @@ yield chai.expect(actionHandler.execute({

@@ -27,12 +27,19 @@ "use strict";

const util_1 = require("util");
const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const utils_1 = require("../../../../src/utils");
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let MakeDirActionHandlerTestSuite = class MakeDirActionHandlerTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new RemovePathActionHandler_1.RemovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -48,3 +55,3 @@ yield chai.expect(actionHandler.validate([], context, snapshot)).to.be.rejected;

const actionHandler = new RemovePathActionHandler_1.RemovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -56,15 +63,16 @@ yield chai.expect(actionHandler.validate('/tmp/test', context, snapshot)).to.be.not.rejected;

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new RemovePathActionHandler_1.RemovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const tmpdir = yield tmp.dir();
const path_l1 = path_1.resolve(tmpdir.path, 'l1');
const path_l2 = path_1.resolve(tmpdir.path, 'l1', 'l2');
const tmpdir = yield tempPathsRegistry.createTempDir();
const path_l1 = path_1.resolve(tmpdir, 'l1');
const path_l2 = path_1.resolve(tmpdir, 'l1', 'l2');
yield util_1.promisify(fs_1.mkdir)(path_l1);
yield util_1.promisify(fs_1.mkdir)(path_l2);
yield util_1.promisify(fs_1.writeFile)(path_1.resolve(tmpdir.path, 'test.txt'), '', 'utf8');
yield util_1.promisify(fs_1.writeFile)(path_1.resolve(tmpdir, 'test.txt'), '', 'utf8');
yield util_1.promisify(fs_1.writeFile)(path_1.resolve(path_l1, 'test.txt'), '', 'utf8');
yield util_1.promisify(fs_1.writeFile)(path_1.resolve(path_l2, 'test.txt'), '', 'utf8');
yield actionHandler.execute(tmpdir.path, context, snapshot);
const exist = yield util_1.promisify(fs_1.exists)(tmpdir.path);
yield actionHandler.execute(tmpdir, context, snapshot);
const exist = yield util_1.promisify(fs_1.exists)(tmpdir);
assert(!exist);

@@ -75,7 +83,8 @@ });

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new RemovePathActionHandler_1.RemovePathActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const tmpdir = yield tmp.dir();
const path_l1 = path_1.resolve(tmpdir.path, 'l1');
const tmpdir = yield tempPathsRegistry.createTempDir();
const path_l1 = path_1.resolve(tmpdir, 'l1');
yield chai.expect(actionHandler.execute(path_l1, context, snapshot)).to.be.rejected;

@@ -82,0 +91,0 @@ });

export declare class WriteToFileTestSuite {
after(): Promise<void>;
failValidation(): Promise<void>;

@@ -3,0 +4,0 @@ passValidation(): Promise<void>;

@@ -28,7 +28,14 @@ "use strict";

const ContextUtil_1 = require("../../../../src/utils/ContextUtil");
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const tmp = require('tmp-promise');
let WriteToFileTestSuite = class WriteToFileTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
failValidation() {

@@ -95,4 +102,5 @@ return __awaiter(this, void 0, void 0, function* () {

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new WriteToFileActionHandler_1.WriteToFileActionHandler();
const tmpFile = yield tmp.file();
const tmpFile = yield tempPathsRegistry.createTempFile();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();

@@ -102,3 +110,3 @@ const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

yield chai.expect(actionHandler.execute({
path: tmpFile.path,
path: tmpFile,
assignPathTo: {

@@ -110,6 +118,6 @@ ctx: '$.ct',

}, context, snapshot)).to.be.not.rejected;
const result = yield util_1.promisify(fs_1.readFile)(tmpFile.path, 'utf8');
const result = yield util_1.promisify(fs_1.readFile)(tmpFile, 'utf8');
assert.strictEqual(result, content);
assert.strictEqual(context.ctx.ct, tmpFile.path);
assert.strictEqual(context.secrets.st, tmpFile.path);
assert.strictEqual(context.ctx.ct, tmpFile);
assert.strictEqual(context.secrets.st, tmpFile);
});

@@ -119,16 +127,17 @@ }

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new WriteToFileActionHandler_1.WriteToFileActionHandler();
const templateFile = yield tmp.file();
const destinationFile = yield tmp.file();
const templateFile = yield tempPathsRegistry.createTempFile();
const destinationFile = yield tempPathsRegistry.createTempFile();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
const content = '<$- ctx.global $>-<%- ctx.local %>';
yield util_1.promisify(fs_1.writeFile)(templateFile.path, content, 'utf8');
yield util_1.promisify(fs_1.writeFile)(templateFile, content, 'utf8');
context.ctx.global = 'g';
context.ctx.local = 'l';
yield actionHandler.execute({
path: destinationFile.path,
contentFromFile: templateFile.path,
path: destinationFile,
contentFromFile: templateFile,
}, context, snapshot);
const result = yield util_1.promisify(fs_1.readFile)(destinationFile.path, 'utf8');
const result = yield util_1.promisify(fs_1.readFile)(destinationFile, 'utf8');
assert.strictEqual(result, 'g-l');

@@ -159,6 +168,7 @@ });

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new WriteToFileActionHandler_1.WriteToFileActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const tmpdir = yield tmp.dir();
const path = path_1.resolve(tmpdir.path, 'l1', 'l2', 'l3', 'test.txt');
const tmpdir = yield tempPathsRegistry.createTempDir();
const path = path_1.resolve(tmpdir, 'l1', 'l2', 'l3', 'test.txt');
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -176,8 +186,9 @@ const content = 'test';

return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const actionHandler = new WriteToFileActionHandler_1.WriteToFileActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const tmpdir = yield tmp.dir();
let path = path_1.resolve(tmpdir.path, 'l1', 'test.txt');
const tmpdir = yield tempPathsRegistry.createTempDir();
let path = path_1.resolve(tmpdir, 'l1', 'test.txt');
// write file on the folder level
fs_1.writeFileSync(path_1.resolve(tmpdir.path, 'l1'), '', 'utf8');
fs_1.writeFileSync(path_1.resolve(tmpdir, 'l1'), '', 'utf8');
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);

@@ -189,6 +200,6 @@ const content = 'test';

}, context, snapshot)).to.be.rejected;
path = path_1.resolve(tmpdir.path, 't1', 't2', 'test.txt');
path = path_1.resolve(tmpdir, 't1', 't2', 'test.txt');
// write file on the folder level
yield util_1.promisify(fs_1.mkdir)(path_1.resolve(tmpdir.path, 't1'));
fs_1.writeFileSync(path_1.resolve(tmpdir.path, 't1', 't2'), '', 'utf8');
yield util_1.promisify(fs_1.mkdir)(path_1.resolve(tmpdir, 't1'));
fs_1.writeFileSync(path_1.resolve(tmpdir, 't1', 't2'), '', 'utf8');
yield chai.expect(actionHandler.execute({

@@ -195,0 +206,0 @@ path: path,

@@ -32,7 +32,8 @@ "use strict";

* @param {string} name
* @param {boolean} [ctrl]
*/
const printChar = (char, name) => {
const printChar = (char, name, ctrl = false) => {
process.stdin.emit('keypress', char, {
ctrl: false,
name: name
ctrl,
name
});

@@ -231,2 +232,23 @@ };

}
cancelled() {
return __awaiter(this, void 0, void 0, function* () {
const actionHandler = new PromptActionHandler_1.PromptActionHandler();
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const snapshot = new models_1.ActionSnapshot('.', {}, '', 0);
yield Promise.all([
chai.expect(actionHandler.execute({
message: 'test',
assignResponseTo: {
ctx: '$.test'
}
}, context, snapshot), 'Prompt canceled by user').to.be.rejected,
new Promise(resolve => {
setTimeout(() => {
printChar('c', 'c', true);
resolve();
}, 50);
})
]);
});
}
};

@@ -269,2 +291,8 @@ __decorate([

], PromptActionHandlerTestSuite.prototype, "testStringWithValidation", null);
__decorate([
mocha_typescript_1.test(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PromptActionHandlerTestSuite.prototype, "cancelled", null);
PromptActionHandlerTestSuite = __decorate([

@@ -271,0 +299,0 @@ mocha_typescript_1.suite()

@@ -26,10 +26,18 @@ "use strict";

const assert = require("assert");
const tmp = require('tmp-promise');
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
let JsonReporterTestSuite = class JsonReporterTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
generate() {
return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const reporter = new JsonReporter_1.JsonReporter();
const file = yield tmp.file();
yield reporter.generate(file.path, {}, new models_1.ActionSnapshot('test', {}, '.', 0));
const strReport = yield util_1.promisify(fs_1.readFile)(file.path, 'utf8');
const file = yield tempPathsRegistry.createTempFile();
yield reporter.generate(file, {}, new models_1.ActionSnapshot('test', {}, '.', 0));
const strReport = yield util_1.promisify(fs_1.readFile)(file, 'utf8');
const report = JSON.parse(strReport);

@@ -36,0 +44,0 @@ // check if created time is valid and was reported less than a second ago

@@ -27,10 +27,18 @@ "use strict";

const js_yaml_1 = require("js-yaml");
const tmp = require('tmp-promise');
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
let YamlReporterTestSuite = class YamlReporterTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
generate() {
return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const reporter = new YamlReporter_1.YamlReporter();
const file = yield tmp.file();
yield reporter.generate(file.path, {}, new models_1.ActionSnapshot('test', {}, '.', 0));
const strReport = yield util_1.promisify(fs_1.readFile)(file.path, 'utf8');
const file = yield tempPathsRegistry.createTempFile();
yield reporter.generate(file, {}, new models_1.ActionSnapshot('test', {}, '.', 0));
const strReport = yield util_1.promisify(fs_1.readFile)(file, 'utf8');
const report = js_yaml_1.safeLoad(strReport);

@@ -37,0 +45,0 @@ // check if created time is valid and was reported less than a second ago

@@ -25,4 +25,11 @@ "use strict";

const fs_1 = require("fs");
const tmp = require('tmp-promise');
const services_1 = require("../../../../src/services");
const typedi_1 = require("typedi");
let FSTemplateUtilityTestSuite = class FSTemplateUtilityTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
getAbsolutePath() {

@@ -41,6 +48,7 @@ return __awaiter(this, void 0, void 0, function* () {

return __awaiter(this, void 0, void 0, function* () {
const file = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(file.path, 'test', 'utf8');
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const file = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(file, 'test', 'utf8');
const readText = new FSTemplateUtility_1.FSTemplateUtility().getUtilities('/tmp').fs.read.text;
const txt = readText(file.path);
const txt = readText(file);
assert.strictEqual(txt, 'test');

@@ -51,6 +59,7 @@ });

return __awaiter(this, void 0, void 0, function* () {
const file = yield tmp.file();
yield util_1.promisify(fs_1.writeFile)(file.path, 'test', 'utf8');
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const file = yield tempPathsRegistry.createTempFile();
yield util_1.promisify(fs_1.writeFile)(file, 'test', 'utf8');
const readBase64 = new FSTemplateUtility_1.FSTemplateUtility().getUtilities('/tmp').fs.read.base64;
const base64 = readBase64(file.path);
const base64 = readBase64(file);
assert.strictEqual(base64, 'dGVzdA==');

@@ -57,0 +66,0 @@ });

export declare class FBLServiceTestSuite {
after(): void;
pluginAutoInclude(): Promise<void>;
extractIdOrAliasMissingKey(): Promise<void>;

@@ -4,0 +5,0 @@ pipeline(): Promise<void>;

@@ -25,6 +25,8 @@ "use strict";

const services_1 = require("../../../src/services");
const ContextUtil_1 = require("../../../src/utils/ContextUtil");
const utils_1 = require("../../../src/utils");
const path_1 = require("path");
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const version = require('../../../../package.json').version;
class DummyActionHandler extends models_1.ActionHandler {

@@ -87,2 +89,20 @@ constructor(fn, skipExecution) {

}
pluginAutoInclude() {
return __awaiter(this, void 0, void 0, function* () {
const fbl = typedi_1.Container.get(services_1.FBLService);
yield fbl.validateFlowRequirements({
version: '1.0.0',
pipeline: {
[DummyActionHandler.ID]: 'tst'
},
requires: {
plugins: {
[path_1.join(__dirname, '../../../src/plugins/context')]: version
}
}
});
const plugin = fbl.getPlugin('flb.core.context');
assert(plugin);
});
}
extractIdOrAliasMissingKey() {

@@ -110,3 +130,3 @@ return __awaiter(this, void 0, void 0, function* () {

}), false));
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
context.ctx.var = 'test';

@@ -132,3 +152,3 @@ context.secrets.var = '123';

pipeline: {}
}, ContextUtil_1.ContextUtil.generateEmptyContext())).to.be.rejected;
}, utils_1.ContextUtil.generateEmptyContext())).to.be.rejected;
});

@@ -149,3 +169,3 @@ }

}
}, ContextUtil_1.ContextUtil.generateEmptyContext());
}, utils_1.ContextUtil.generateEmptyContext());
assert.strictEqual(result, null);

@@ -166,3 +186,3 @@ });

}
}, ContextUtil_1.ContextUtil.generateEmptyContext());
}, utils_1.ContextUtil.generateEmptyContext());
assert.strictEqual(snapshot.successful, false);

@@ -184,3 +204,3 @@ });

}
}, ContextUtil_1.ContextUtil.generateEmptyContext());
}, utils_1.ContextUtil.generateEmptyContext());
assert.strictEqual(snapshot.successful, false);

@@ -221,3 +241,3 @@ assert.strictEqual(snapshot.getSteps().find(s => s.type === 'failure').payload, 'Error: Could not find matching close tag for "<%-".');

requires: {
fbl: require('../../../../package.json').version
fbl: version
},

@@ -244,3 +264,3 @@ actionHandlers: [

}), false));
const context = ContextUtil_1.ContextUtil.generateEmptyContext();
const context = utils_1.ContextUtil.generateEmptyContext();
context.ctx.t1 = {

@@ -267,2 +287,8 @@ t2: {

__metadata("design:returntype", Promise)
], FBLServiceTestSuite.prototype, "pluginAutoInclude", null);
__decorate([
mocha_typescript_1.test(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], FBLServiceTestSuite.prototype, "extractIdOrAliasMissingKey", null);

@@ -269,0 +295,0 @@ __decorate([

@@ -27,6 +27,12 @@ "use strict";

const utils_1 = require("../../../src/utils");
const tmp = require('tmp-promise');
let FlowServiceTestSuite = class FlowServiceTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
resolveTemplate() {
return __awaiter(this, void 0, void 0, function* () {
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const tpl = [

@@ -46,5 +52,5 @@ 'version: 1.0.0',

// create temp file
const file = yield tmp.file();
const file = yield tempPathsRegistry.createTempFile();
// write template to file
yield util_1.promisify(fs_1.writeFile)(file.path, tpl, 'utf8');
yield util_1.promisify(fs_1.writeFile)(file, tpl, 'utf8');
// generate context

@@ -51,0 +57,0 @@ const context = utils_1.ContextUtil.generateEmptyContext();

@@ -23,13 +23,20 @@ "use strict";

const os_1 = require("os");
const FSUtil_1 = require("../../../src/utils/FSUtil");
const utils_1 = require("../../../src/utils");
const path_1 = require("path");
const fs_1 = require("fs");
const util_1 = require("util");
const tmp = require('tmp-promise');
const services_1 = require("../../../src/services");
const typedi_1 = require("typedi");
let FSUtilTestSuite = class FSUtilTestSuite {
after() {
return __awaiter(this, void 0, void 0, function* () {
yield typedi_1.Container.get(services_1.TempPathsRegistry).cleanup();
typedi_1.Container.reset();
});
}
getAbsolutePath() {
return __awaiter(this, void 0, void 0, function* () {
assert.strictEqual(FSUtil_1.FSUtil.getAbsolutePath('~/test.tst', '/tmp'), os_1.homedir() + '/test.tst');
assert.strictEqual(FSUtil_1.FSUtil.getAbsolutePath('/tmp/test.tst', '/var'), '/tmp/test.tst');
assert.strictEqual(FSUtil_1.FSUtil.getAbsolutePath('./test.tst', '/var'), '/var/test.tst');
assert.strictEqual(utils_1.FSUtil.getAbsolutePath('~/test.tst', '/tmp'), os_1.homedir() + '/test.tst');
assert.strictEqual(utils_1.FSUtil.getAbsolutePath('/tmp/test.tst', '/var'), '/tmp/test.tst');
assert.strictEqual(utils_1.FSUtil.getAbsolutePath('./test.tst', '/var'), '/var/test.tst');
});

@@ -39,8 +46,9 @@ }

return __awaiter(this, void 0, void 0, function* () {
const tmpDir = yield tmp.dir();
const tempPathsRegistry = typedi_1.Container.get(services_1.TempPathsRegistry);
const tmpDir = yield tempPathsRegistry.createTempDir();
const writeFileAsync = util_1.promisify(fs_1.writeFile);
const files = [
path_1.join(tmpDir.path, 'a.txt'),
path_1.join(tmpDir.path, 'b.txt'),
path_1.join(tmpDir.path, 'c.ign'),
path_1.join(tmpDir, 'a.txt'),
path_1.join(tmpDir, 'b.txt'),
path_1.join(tmpDir, 'c.ign'),
];

@@ -50,5 +58,5 @@ for (const file of files) {

}
let found = yield FSUtil_1.FSUtil.findFilesByMasks(['*.txt', '*.ign'], null, tmpDir.path);
let found = yield utils_1.FSUtil.findFilesByMasks(['*.txt', '*.ign'], null, tmpDir);
assert.deepStrictEqual(found, files);
found = yield FSUtil_1.FSUtil.findFilesByMasks(['*.txt'], ['*.ign'], tmpDir.path);
found = yield utils_1.FSUtil.findFilesByMasks(['*.txt'], ['*.ign'], tmpDir);
assert.deepStrictEqual(found, [

@@ -55,0 +63,0 @@ files[0], files[1]

@@ -7,4 +7,6 @@ # Tarball (packaging)

- File name should end with `.tar.gz`
- In root of the tarball `index.yml` should exist that represents the enty point of it.
- `index.yml` file should be located in root of the tarball or in any child directory if each parent dir has only one child.
E.g.:
## Reference tarball

@@ -11,0 +13,0 @@

{
"name": "fbl",
"version": "0.4.3",
"version": "0.4.4",
"description": "Command Line tool to automate any kind of work. Originally designed to help with deployments.",

@@ -66,3 +66,3 @@ "keywords": [

"mocha-typescript": "1.1.17",
"mochawesome": "3.0.3",
"mochawesome": "3.1.0",
"nyc": "12.0.2",

@@ -69,0 +69,0 @@ "rimraf": "2.6.2",

@@ -50,5 +50,5 @@ # FBL \(FireBlink Logistics\)

# [optional] fbl plugins and their semantic versioning
# [optional] fbl plugins and their required versions (semver)
plugins:
- fbl.plugin.ftpo@^0.1.0
fbl.plugin.ftpo: >=0.1.0

@@ -126,2 +126,6 @@ # [optional] native application/commands presented in the PATH environment variable

Read more about it [here](docs/tarball.md).
Read more about it [here](docs/tarball.md).
## Plugin Development
Follow [this link](https://github.com/FireBlinkLTD/fbl-plugin-template) to read more about plugin development.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc