New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atomist/rug

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomist/rug - npm Package Compare versions

Comparing version 1.0.0-m.2 to 1.0.0-m.3

model/ArtifactContainerView.js

1

ast/AstHelper.js

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

var r = this.pexe.scalar(f, pathExpression);
//console.log(`Reparsed=${r}`)
return r;

@@ -22,0 +21,0 @@ }

@@ -1,6 +0,10 @@

import { TreeNode, TextTreeNode, ParentAwareTreeNode, PathExpressionEngine } from "../tree/PathExpression"
import * as treeHelper from "../tree/TreeHelper"
import { File } from "../model/Core";
import {
ParentAwareTreeNode,
PathExpressionEngine,
TextTreeNode,
TreeNode,
} from "../tree/PathExpression";
import * as treeHelper from "../tree/TreeHelper";
import { File } from "../model/Core"
/**

@@ -11,3 +15,3 @@ * Superclass for working with ASTs

public constructor(public pexe: PathExpressionEngine) {}
public constructor(public pexe: PathExpressionEngine) { }

@@ -17,14 +21,12 @@ /**

*/
protected reparseNodeUnderFile(languageNode: TextTreeNode, type: String): TextTreeNode {
let f = treeHelper.findAncestorWithTag<File>(languageNode, "File")
protected reparseNodeUnderFile(languageNode: TextTreeNode, type: string): TextTreeNode {
const f = treeHelper.findAncestorWithTag<File>(languageNode, "File");
if (f) {
let pathExpression = `/${type}()`
let r = this.pexe.scalar<File,TextTreeNode>(f, pathExpression)
//console.log(`Reparsed=${r}`)
return r
const pathExpression = `/${type}()`;
const r = this.pexe.scalar<File, TextTreeNode>(f, pathExpression);
return r;
} else {
throw new Error(`Cannot find File parent`);
}
else {
throw new Error(`Cannot find File parent`)
}
}
}
}

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

Object.defineProperty(exports, "__esModule", { value: true });
var TextTreeNodeOps_1 = require("../ast/TextTreeNodeOps");
var TransformingPathExpressionEngine_1 = require("../tree/TransformingPathExpressionEngine");
var TextTreeNodeOps_1 = require("../ast/TextTreeNodeOps");
/**

@@ -33,3 +33,3 @@ * Can be used directly or via a subclass that provides a strategy

var combined = _this.unify(n, ops);
//console.log(`ops=${ops}, combined=${combined}`)
// console.log(`ops=${ops}, combined=${combined}`)
return combined;

@@ -39,14 +39,8 @@ }) || this;

}
/**
* Add all functions from right to left.
* Also copies state, which may be needed for functions to work.
*/
DecoratingPathExpressionEngine.prototype.unify = function (base, enricher) {
var monkeyableBase = base;
for (var id in enricher) {
var fun = enricher[id];
monkeyableBase[id] = fun;
//console.log(`Adding function ${id} from right to left: ${fun} from source ${enricher}`)
}
return monkeyableBase;
DecoratingPathExpressionEngine.prototype.save = function (n, expr) {
var hits = [];
this.with(n, expr, function (node) {
hits.push(node);
});
return hits;
};

@@ -72,8 +66,14 @@ /**

};
DecoratingPathExpressionEngine.prototype.save = function (n, expr) {
var hits = [];
this.with(n, expr, function (n) {
hits.push(n);
});
return hits;
/**
* Add all functions from right to left.
* Also copies state, which may be needed for functions to work.
*/
DecoratingPathExpressionEngine.prototype.unify = function (base, enricher) {
var monkeyableBase = base;
// tslint:disable-next-line:forin
for (var id in enricher) {
var fun = enricher[id];
monkeyableBase[id] = fun;
}
return monkeyableBase;
};

@@ -80,0 +80,0 @@ return DecoratingPathExpressionEngine;

@@ -1,4 +0,4 @@

import { PathExpressionEngine, TreeNode } from "../tree/PathExpression"
import { TransformingPathExpressionEngine } from "../tree/TransformingPathExpressionEngine"
import { TextTreeNodeOps, RichTextTreeNode } from "../ast/TextTreeNodeOps"
import { RichTextTreeNode, TextTreeNodeOps } from "../ast/TextTreeNodeOps";
import { PathExpressionEngine, TreeNode } from "../tree/PathExpression";
import { TransformingPathExpressionEngine } from "../tree/TransformingPathExpressionEngine";

@@ -15,28 +15,21 @@ /**

constructor(delegate: PathExpressionEngine) {
super(delegate, n => {
super(delegate, (n) => {
// Also need to parameterize module
let ops = this.decoratorFor(n)
let ops = this.decoratorFor(n);
if (ops == null) {
ops = new TextTreeNodeOps(n, delegate)
ops = new TextTreeNodeOps(n, delegate);
}
let combined = this.unify(n, ops)
//console.log(`ops=${ops}, combined=${combined}`)
return combined
})
const combined = this.unify(n, ops);
// console.log(`ops=${ops}, combined=${combined}`)
return combined;
});
}
/**
* Add all functions from right to left.
* Also copies state, which may be needed for functions to work.
*/
private unify<T, U>(base: T, enricher: U): T & U {
let monkeyableBase = base as any
for (let id in enricher) {
let fun = (<any>enricher)[id]
monkeyableBase[id] = fun
//console.log(`Adding function ${id} from right to left: ${fun} from source ${enricher}`)
}
return monkeyableBase as T & U;
public save<N extends RichTextTreeNode>(n: TreeNode, expr: string): N[] {
const hits = [];
this.with(n, expr, (node) => {
hits.push(node);
});
return hits;
}
/**

@@ -46,3 +39,3 @@ * Template method subclasses can use to find the decorator for this node.

* Implementations don't need to catch the error if a class cannot
* be instantiated: It will be caught in this class. They can also
* be instantiated: It will be caught in this class. They can also
* return null if unresolved. Default implementation returns null.

@@ -52,3 +45,3 @@ * @param n TreeNode to decorate

protected decoratorFor(n: TreeNode): any {
return null
return null;
}

@@ -62,13 +55,18 @@

protected decoratorClassName(n: TreeNode) {
return n.nodeName().charAt(0).toUpperCase() + n.nodeName().substr(1) + "Ops"
return n.nodeName().charAt(0).toUpperCase() + n.nodeName().substr(1) + "Ops";
}
public save<N extends RichTextTreeNode>(n: TreeNode, expr: string): N[] {
let hits = [];
this.with(n, expr, n => {
hits.push(n);
});
return hits;
/**
* Add all functions from right to left.
* Also copies state, which may be needed for functions to work.
*/
private unify<T, U>(base: T, enricher: U): T & U {
const monkeyableBase = base as any;
// tslint:disable-next-line:forin
for (const id in enricher) {
const fun = (enricher as any)[id];
monkeyableBase[id] = fun;
}
return monkeyableBase as T & U;
}
}
}

@@ -1,4 +0,3 @@

import { Project } from "../../model/Core";
import { PathExpression, TextTreeNode } from "../../tree/PathExpression";
import { Project } from "../../model/Core";

@@ -8,3 +7,3 @@ /**

*/
export class Catch extends PathExpression<Project,TextTreeNode> {
export class Catch extends PathExpression<Project, TextTreeNode> {

@@ -18,5 +17,4 @@ constructor(exception: string) {

export function annotatedClass(typeName: string) {
return `normalClassDeclaration${withAnnotation(typeName)}`
return `normalClassDeclaration${withAnnotation(typeName)}`;
}

@@ -23,0 +21,0 @@

@@ -13,3 +13,3 @@ "use strict";

this.name = this.nameNode().value();
if (methodDeclaration.methodModifier)
if (methodDeclaration.methodModifier) {
methodDeclaration.methodModifier

@@ -20,12 +20,14 @@ .filter(function (mm) { return mm.annotation !== undefined; })

});
if (methodDeclaration.methodHeader.annotation)
}
if (methodDeclaration.methodHeader.annotation) {
this.annotations.concat(methodDeclaration.methodHeader.annotation
.map(function (ann) { return new AnnotationWrapper(ann); }));
}
}
Method.prototype.rename = function (newName) {
this.nameNode().update(newName);
};
Method.prototype.nameNode = function () {
return this.methodDeclaration.methodHeader.methodDeclarator.Identifier;
};
Method.prototype.rename = function (newName) {
this.nameNode().update(newName);
};
return Method;

@@ -37,8 +39,11 @@ }());

this.annotation = annotation;
if (this.annotation.markerAnnotation != undefined)
if (this.annotation.markerAnnotation !== undefined) {
this.typeName = this.annotation.markerAnnotation.typeName.value();
else if (this.annotation.normalAnnotation != undefined)
}
else if (this.annotation.normalAnnotation !== undefined) {
this.typeName = this.annotation.normalAnnotation.typeName.value();
else
}
else {
this.typeName = this.annotation.singleElementAnnotation.typeName.value();
}
}

@@ -45,0 +50,0 @@ return AnnotationWrapper;

@@ -1,2 +0,1 @@

import { RichTextTreeNode } from "../TextTreeNodeOps";

@@ -9,44 +8,45 @@

annotations: AnnotationWrapper[] = [];
public annotations: AnnotationWrapper[] = [];
public filePath: string = this.methodDeclaration.containingFile().path;
public name: string = this.nameNode().value();
constructor(public methodDeclaration: MethodDeclaration) {
if (methodDeclaration.methodModifier)
if (methodDeclaration.methodModifier) {
methodDeclaration.methodModifier
.filter(mm => mm.annotation !== undefined)
.forEach(mm =>
this.annotations.push(new AnnotationWrapper(mm.annotation))
);
.filter((mm) => mm.annotation !== undefined)
.forEach((mm) =>
this.annotations.push(new AnnotationWrapper(mm.annotation)),
);
}
if (methodDeclaration.methodHeader.annotation)
if (methodDeclaration.methodHeader.annotation) {
this.annotations.concat(methodDeclaration.methodHeader.annotation
.map(ann => new AnnotationWrapper(ann)));
.map((ann) => new AnnotationWrapper(ann)));
}
}
public rename(newName: string): void {
this.nameNode().update(newName);
}
private nameNode(): RichTextTreeNode {
return this.methodDeclaration.methodHeader.methodDeclarator.Identifier;
}
filePath: string = this.methodDeclaration.containingFile().path;
name: string = this.nameNode().value();
rename(newName: string): void {
this.nameNode().update(newName);
}
}
export class AnnotationWrapper {
typeName: string;
public typeName: string;
constructor(private annotation: Annotation) {
if (this.annotation.markerAnnotation != undefined)
if (this.annotation.markerAnnotation !== undefined) {
this.typeName = this.annotation.markerAnnotation.typeName.value();
else if (this.annotation.normalAnnotation != undefined)
} else if (this.annotation.normalAnnotation !== undefined) {
this.typeName = this.annotation.normalAnnotation.typeName.value();
else
} else {
this.typeName = this.annotation.singleElementAnnotation.typeName.value();
}
}
}

@@ -60,5 +60,5 @@

/**
methodDeclaration
: methodModifier* methodHeader methodBody
*/
* methodDeclaration
* : methodModifier* methodHeader methodBody
*/
export interface MethodDeclaration extends RichTextTreeNode {

@@ -65,0 +65,0 @@

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

var hits2 = eng.save(root, pe2);
console.log("hits1=" + hits1 + "\nhits2=" + hits2 + "\nlen1=" + hits1.length + "\nlen2=" + hits2.length);
return hits1.concat(hits2);

@@ -23,10 +22,10 @@ }

}
Method.prototype.rename = function (newName) {
this.nameNode().update(newName);
};
Method.prototype.nameNode = function () {
return this.eng.scalar(this.methodDeclaration, "/methodHeader/methodDeclarator/Identifier");
};
Method.prototype.rename = function (newName) {
this.nameNode().update(newName);
};
return Method;
}());
exports.Method = Method;

@@ -1,15 +0,14 @@

import { DecoratingPathExpressionEngine } from "../DecoratingPathExpressionEngine";
import { RichTextTreeNode } from "../TextTreeNodeOps";
import { DecoratingPathExpressionEngine } from "../DecoratingPathExpressionEngine";
export function union(eng: DecoratingPathExpressionEngine, root: RichTextTreeNode, pe1: string, pe2: string): RichTextTreeNode[] {
let hits1: RichTextTreeNode[] = eng.save<RichTextTreeNode>(root, pe1)
let hits2: RichTextTreeNode[] = eng.save<RichTextTreeNode>(root, pe2)
console.log("hits1=" + hits1 + "\nhits2=" + hits2 + "\nlen1=" + hits1.length + "\nlen2=" + hits2.length);
export function union(
eng: DecoratingPathExpressionEngine,
root: RichTextTreeNode,
pe1: string,
pe2: string): RichTextTreeNode[] {
const hits1: RichTextTreeNode[] = eng.save<RichTextTreeNode>(root, pe1);
const hits2: RichTextTreeNode[] = eng.save<RichTextTreeNode>(root, pe2);
return hits1.concat(hits2);
}
/**

@@ -20,24 +19,20 @@ * Convenient class to wrap Java methods, hiding AST navigation.

annotations: RichTextTreeNode[] = [];
public annotations: RichTextTreeNode[] = [];
public filePath: string = this.methodDeclaration.containingFile().path;
public name: string = this.nameNode().value();
constructor(private eng: DecoratingPathExpressionEngine, public methodDeclaration: RichTextTreeNode) {
this.annotations = union(eng, this.methodDeclaration,
"/methodHeader//annotation",
"//methodModifier//annotation"
);
"/methodHeader//annotation",
"//methodModifier//annotation",
);
}
public rename(newName: string): void {
this.nameNode().update(newName);
}
private nameNode(): RichTextTreeNode {
return this.eng.scalar<RichTextTreeNode,RichTextTreeNode>(this.methodDeclaration,
"/methodHeader/methodDeclarator/Identifier");
return this.eng.scalar<RichTextTreeNode, RichTextTreeNode>(this.methodDeclaration,
"/methodHeader/methodDeclarator/Identifier");
}
filePath: string = this.methodDeclaration.containingFile().path;
name: string = this.nameNode().value();
rename(newName: string): void {
this.nameNode().update(newName);
}
}
}

@@ -0,7 +1,6 @@

import { TreeNode } from "../../tree/PathExpression";
import { DecoratingPathExpressionEngine } from "../DecoratingPathExpressionEngine";
import {TreeNode} from "../../tree/PathExpression"
import {DecoratingPathExpressionEngine} from "../DecoratingPathExpressionEngine"
import * as scala from "./Types";
import * as scala from "./Types"
/**

@@ -14,14 +13,13 @@ * PathExpressionEngine decorator that returns Scala type mixins

protected decoratorFor(n: TreeNode): any {
let className = this.decoratorClassName(n)
const className = this.decoratorClassName(n);
// Dynamically instantiate the class with the given name in the
// target module
try {
let ops = new scala[className](n, this.delegate)
return ops
}
catch (e) {
const ops = new scala[className](n, this.delegate);
return ops;
} catch (e) {
// Not an error. We just don't have a special type for this
return null
return null;
}
}
}
}

@@ -44,6 +44,7 @@ /**

var fullNewImport = "import " + newImport;
if (this.node.value().indexOf(fullNewImport) == -1) {
if (this.node.value().indexOf(fullNewImport) === -1) {
var pkg = this.packageName();
if (pkg)
if (pkg) {
pkg.update(pkg.value() + "\n\n" + fullNewImport);
}
else {

@@ -88,3 +89,2 @@ // Not in a package. Just put at the top of the class

TermApplyInfixOps.prototype.reverseShould = function () {
//console.log(`Containing file=${this.containingFile()}`)
var termSelect = this.node.termSelect;

@@ -94,3 +94,2 @@ var termApply = this.node.termApply;

var newValue = "assert(" + termSelect.value() + " === " + termApply.children()[1].value() + ")";
//console.log(`Replacing [${shouldTerm.value()}] with [${newValue}]`)
this.node.update(newValue);

@@ -97,0 +96,0 @@ }

/**
* Module containing Scala types.
* Module containing Scala types.
* Interfaces with "Nav" suffix have 1:1 mapping to grammar productions

@@ -8,11 +8,12 @@ * (with upper camel case).

* Ultimately, such interfaces can be generated.
*
*
* Classes with "Ops" suffix are additional operations.
*/
import { TextTreeNode } from "../../tree/PathExpression"
import { TextTreeNodeOps } from "../TextTreeNodeOps"
import { TextTreeNode } from "../../tree/PathExpression";
import { TextTreeNodeOps } from "../TextTreeNodeOps";
// tslint:disable-next-line:no-empty-interface
export interface SourceNav extends TextTreeNode {
}

@@ -25,9 +26,8 @@

*/
packageName(): TextTreeNode {
public packageName(): TextTreeNode {
try {
return this.pexe.scalar<TextTreeNode,TextTreeNode>(this.node, "/pkg/termSelect")
return this.pexe.scalar<TextTreeNode, TextTreeNode>(this.node, "/pkg/termSelect");
} catch (e) {
return null;
}
catch (e) {
return null
}
}

@@ -38,12 +38,12 @@

*/
addImport(newImport: string): void {
let fullNewImport = `import ${newImport}`
public addImport(newImport: string): void {
const fullNewImport = `import ${newImport}`;
if (this.node.value().indexOf(fullNewImport) == -1) {
let pkg = this.packageName()
if (pkg)
pkg.update(`${pkg.value()}\n\n${fullNewImport}`)
else {
if (this.node.value().indexOf(fullNewImport) === -1) {
const pkg = this.packageName();
if (pkg) {
pkg.update(`${pkg.value()}\n\n${fullNewImport}`);
} else {
// Not in a package. Just put at the top of the class
this.prepend(`${fullNewImport}\n\n`)
this.prepend(`${fullNewImport}\n\n`);
}

@@ -57,10 +57,10 @@ }

*/
export type Source = SourceNav & SourceOps
export type Source = SourceNav & SourceOps;
export interface DefnClassNav extends TextTreeNode {
typeName: string
typeName: string;
template: TextTreeNode
template: TextTreeNode;
}

@@ -73,16 +73,13 @@

*/
addToStartOfBody(what: string) {
public addToStartOfBody(what: string) {
// TODO what if type body is empty?
let firstStatement = this.node.template.children()[0] as TextTreeNode
firstStatement.update(`${what}\n\n${firstStatement.value()}`)
const firstStatement = this.node.template.children()[0] as TextTreeNode;
firstStatement.update(`${what}\n\n${firstStatement.value()}`);
}
}
export type DefnClass = DefnClassNav & DefnClassOps
export type DefnClass = DefnClassNav & DefnClassOps;
export interface TermApplyNav extends TextTreeNode {
termName(): string
termName(): string;
}

@@ -94,11 +91,7 @@

export type TermApply = TermApplyNav & TermApplyOps
export type TermApply = TermApplyNav & TermApplyOps;
export interface TermApplyInfixNav extends TextTreeNode {
termSelect: any
termApply: any
termSelect: any;
termApply: any;
}

@@ -108,11 +101,9 @@

reverseShould() {
//console.log(`Containing file=${this.containingFile()}`)
let termSelect = this.node.termSelect;
let termApply = this.node.termApply;
public reverseShould() {
const termSelect = this.node.termSelect;
const termApply = this.node.termApply;
if (termApply != null && ["be", "equal"].indexOf(termApply.termName.value()) > -1) {
let newValue = `assert(${termSelect.value()} === ${termApply.children()[1].value()})`;
//console.log(`Replacing [${shouldTerm.value()}] with [${newValue}]`)
this.node.update(newValue)
const newValue = `assert(${termSelect.value()} === ${termApply.children()[1].value()})`;
this.node.update(newValue);
}

@@ -123,2 +114,2 @@ }

export type TermApplyInfix = TermApplyInfixNav & TermApplyInfixOps
export type TermApplyInfix = TermApplyInfixNav & TermApplyInfixOps;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AstHelper_1 = require("./AstHelper");
var RugOperation_1 = require("../operations/RugOperation");
var treeHelper = require("../tree/TreeHelper");
var RugOperation_1 = require("../operations/RugOperation");
/**

@@ -7,0 +7,0 @@ * Base class for decorators on node.

@@ -1,9 +0,8 @@

import {PathExpressionEngine,TextTreeNode} from "../tree/PathExpression"
import {AstHelper} from "./AstHelper"
import * as treeHelper from "../tree/TreeHelper"
import {ReviewComment,Severity} from "../operations/RugOperation"
import { AstHelper } from "./AstHelper";
import { File } from "../model/Core";
import { ReviewComment, Severity } from "../operations/RugOperation";
import { PathExpressionEngine, TextTreeNode } from "../tree/PathExpression";
import * as treeHelper from "../tree/TreeHelper";
import {File} from "../model/Core"
/**
/**
* Base class for decorators on node.

@@ -16,3 +15,3 @@ * Allows us to get to the containing File and update text.

protected astHelper: AstHelper
protected astHelper: AstHelper;

@@ -26,3 +25,3 @@ /**

constructor(protected node: N, public pexe: PathExpressionEngine) {
this.astHelper = new AstHelper(pexe)
this.astHelper = new AstHelper(pexe);
}

@@ -33,4 +32,4 @@

*/
delete() {
this.node.update("")
public delete() {
this.node.update("");
}

@@ -43,4 +42,4 @@

*/
append(what: string) {
this.node.update(`${this.node.value()}${what}`)
public append(what: string) {
this.node.update(`${this.node.value()}${what}`);
}

@@ -53,4 +52,4 @@

*/
prepend(what: string) {
this.node.update(`${what}${this.node.value()}`)
public prepend(what: string) {
this.node.update(`${what}${this.node.value()}`);
}

@@ -61,4 +60,4 @@

*/
containingFile(): File {
return treeHelper.findAncestorWithTag<File>(this.node, "File")
public containingFile(): File {
return treeHelper.findAncestorWithTag<File>(this.node, "File");
}

@@ -69,12 +68,12 @@

*/
commentConcerning(comment: string, severity: Severity): ReviewComment {
const f = this.containingFile();
let line = 1;
let col = 1;
const point = this.node.formatInfo.start;
if (point) {
line = point.lineNumberFrom1;
col = point.columnNumberFrom1;
}
return new ReviewComment(f.project.name, comment, severity, f.path, line, col);
public commentConcerning(comment: string, severity: Severity): ReviewComment {
const f = this.containingFile();
let line = 1;
let col = 1;
const point = this.node.formatInfo.start;
if (point) {
line = point.lineNumberFrom1;
col = point.columnNumberFrom1;
}
return new ReviewComment(f.project.name, comment, severity, f.path, line, col);
}

@@ -85,4 +84,4 @@

*/
addCommentConcerning(comments: ReviewComment[], comment: string, severity: Severity) {
comments.push(this.commentConcerning(comment, severity))
public addCommentConcerning(comments: ReviewComment[], comment: string, severity: Severity) {
comments.push(this.commentConcerning(comment, severity));
}

@@ -96,2 +95,2 @@

*/
export type RichTextTreeNode = TextTreeNode & TextTreeNodeOps<TextTreeNode>
export type RichTextTreeNode = TextTreeNode & TextTreeNodeOps<TextTreeNode>;

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

function structurallyEquivalent(a, b) {
if (a.nodeName() !== b.nodeName())
if (a.nodeName() !== b.nodeName()) {
return false;
if (a.children().length != b.children().length)
}
if (a.children().length !== b.children().length) {
return false;
if (a.value() === b.value())
}
if (a.value() === b.value()) {
return true;
}
for (var i = 0; i < a.children().length; i++) {

@@ -15,0 +18,0 @@ var ax = a.children()[i];

import { TextTreeNode } from "../tree/PathExpression"
import { TextTreeNode } from "../tree/PathExpression";

@@ -8,10 +8,13 @@ /**

export function structurallyEquivalent(a: TextTreeNode, b: TextTreeNode): boolean {
if (a.nodeName() !== b.nodeName())
if (a.nodeName() !== b.nodeName()) {
return false;
}
if (a.children().length != b.children().length)
if (a.children().length !== b.children().length) {
return false;
}
if (a.value() === b.value())
if (a.value() === b.value()) {
return true;
}

@@ -26,2 +29,2 @@ for (let i = 0; i < a.children().length; i++) {

return true;
}
}

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

var newValue = "\"" + to + "\"";
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue);

@@ -45,9 +44,11 @@ };

var raw = node.value();
if (raw.charAt(0) != '>')
if (raw.charAt(0) !== ">") {
throw new Error("Illegal argument: Must begin with >");
if (raw.charAt(1) != '\n')
}
if (raw.charAt(1) !== "\n") {
throw new Error("Illegal argument: Must begin with >\n");
}
var index = 2;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -60,6 +61,6 @@ }

return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n') + '\n';
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n") + "\n";
};

@@ -81,9 +82,11 @@ YamlFoldedBlockScalar.prototype.updateText = function (to) {

var raw = node.value();
if (raw.charAt(0) != '>' && raw.charAt(1) != '-')
if (raw.charAt(0) !== ">" && raw.charAt(1) !== "-") {
throw new Error("Illegal argument: Must begin with >-");
if (raw.charAt(2) != '\n')
}
if (raw.charAt(2) !== "\n") {
throw new Error("Illegal argument: Must begin with >-\n");
}
var index = 3;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -96,6 +99,6 @@ }

return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n');
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n");
};

@@ -117,9 +120,11 @@ YamlFoldedBlockWithStripChomping.prototype.updateText = function (to) {

var raw = node.value();
if (raw.charAt(0) != '>' && raw.charAt(1) != '+')
if (raw.charAt(0) !== ">" && raw.charAt(1) !== "+") {
throw new Error("Illegal argument: Must begin with >+");
if (raw.charAt(2) != '\n')
}
if (raw.charAt(2) !== "\n") {
throw new Error("Illegal argument: Must begin with >+\n");
}
var index = 3;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -132,8 +137,8 @@ }

var raw = this.node.value();
var newlines = raw.match(new RegExp('\n+$'));
var newlines = raw.match(new RegExp("\n+$"));
return raw.substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n')
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n")
+ newlines[0].toString();

@@ -156,9 +161,11 @@ };

var raw = node.value();
if (raw.charAt(0) != '|')
if (raw.charAt(0) !== "|") {
throw new Error("Illegal argument: Must begin with |");
if (raw.charAt(1) != '\n')
}
if (raw.charAt(1) !== "\n") {
throw new Error("Illegal argument: Must begin with |\n");
}
var index = 2;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -171,4 +178,4 @@ }

return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '\n');
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "\n");
};

@@ -190,9 +197,11 @@ YamlLiteralBlockScalar.prototype.updateText = function (to) {

var raw = node.value();
if (raw.charAt(0) != '|' && raw.charAt(1) != '-')
if (raw.charAt(0) !== "|" && raw.charAt(1) !== "-") {
throw new Error("Illegal argument: Must begin with |-");
if (raw.charAt(2) != '\n')
}
if (raw.charAt(2) !== "\n") {
throw new Error("Illegal argument: Must begin with |-\n");
}
var index = 3;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -205,4 +214,4 @@ }

return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '');
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "");
};

@@ -224,9 +233,11 @@ YamlLiteralBlockWithStripChomping.prototype.updateText = function (to) {

var raw = node.value();
if (raw.charAt(0) != '|' && raw.charAt(1) != '+')
if (raw.charAt(0) !== "|" && raw.charAt(1) !== "+") {
throw new Error("Illegal argument: Must begin with |+");
if (raw.charAt(2) != '\n')
}
if (raw.charAt(2) !== "\n") {
throw new Error("Illegal argument: Must begin with |+\n");
}
var index = 3;
var ch = raw.charAt(index);
while (ch == ' ' || ch == '\t' || ch == '\n') {
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);

@@ -239,6 +250,6 @@ }

var raw = this.node.value();
var newlines = raw.match(new RegExp('\n+$'));
var newlines = raw.match(new RegExp("\n+$"));
return raw.substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
+ newlines[0].toString();

@@ -260,3 +271,3 @@ };

this.node = node;
this.items = node.value().trim().split('\n');
this.items = node.value().trim().split("\n");
}

@@ -270,4 +281,4 @@ /**

var lastItem = this.items[this.items.length - 1];
this.items.push(lastItem.substring(0, lastItem.indexOf('-')) + '- ' + elem);
var newValue = this.items.join('\n') + '\n';
this.items.push(lastItem.substring(0, lastItem.indexOf("-")) + "- " + elem);
var newValue = this.items.join("\n") + "\n";
this.node.update(newValue);

@@ -283,6 +294,6 @@ // console.log(this.node.value())

var lastItem = this.items[this.items.length - 1];
var index = this.items.indexOf(lastItem.substring(0, lastItem.indexOf('-')) + '- ' + elem);
var index = this.items.indexOf(lastItem.substring(0, lastItem.indexOf("-")) + "- " + elem);
if (index > -1) {
this.items.splice(index, 1);
var newValue = this.items.join('\n') + '\n';
var newValue = this.items.join("\n") + "\n";
this.node.update(newValue);

@@ -289,0 +300,0 @@ // console.log(this.node.value())

@@ -1,2 +0,2 @@

import {TextTreeNode} from "../../tree/PathExpression";
import { TextTreeNode } from "../../tree/PathExpression";

@@ -12,3 +12,3 @@ /**

*/
text(): string
text(): string;

@@ -18,6 +18,6 @@ /**

*/
updateText(to: string): void
updateText(to: string): void;
}
export type YamlString = YamlStringOps & TextTreeNode
export type YamlString = YamlStringOps & TextTreeNode;

@@ -32,8 +32,8 @@ /**

text() {
return this.node.value()
public text() {
return this.node.value();
}
updateText(to: string) {
this.node.update(to)
public updateText(to: string) {
this.node.update(to);
}

@@ -50,10 +50,9 @@ }

text() {
return this.node.value().slice(1, this.node.value().length - 1)
public text() {
return this.node.value().slice(1, this.node.value().length - 1);
}
updateText(to: string) {
let newValue = `"${to}"`
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
public updateText(to: string) {
const newValue = `"${to}"`;
this.node.update(newValue);
}

@@ -68,30 +67,32 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '>') throw new Error("Illegal argument: Must begin with >")
if (raw.charAt(1) != '\n') throw new Error("Illegal argument: Must begin with >\n")
let index = 2
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== ">") { throw new Error("Illegal argument: Must begin with >"); }
if (raw.charAt(1) !== "\n") {
throw new Error("Illegal argument: Must begin with >\n");
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(2)
let index = 2;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(2);
}
text() {
public text() {
return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n') + '\n'
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n") + "\n";
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -106,30 +107,30 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '>' && raw.charAt(1) != '-') throw new Error("Illegal argument: Must begin with >-")
if (raw.charAt(2) != '\n') throw new Error("Illegal argument: Must begin with >-\n")
let index = 3
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== ">" && raw.charAt(1) !== "-") { throw new Error("Illegal argument: Must begin with >-"); }
if (raw.charAt(2) !== "\n") { throw new Error("Illegal argument: Must begin with >-\n"); }
let index = 3;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(3)
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(3);
}
text() {
public text() {
return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n')
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n");
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -144,33 +145,33 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '>' && raw.charAt(1) != '+') throw new Error("Illegal argument: Must begin with >+")
if (raw.charAt(2) != '\n') throw new Error("Illegal argument: Must begin with >+\n")
let index = 3
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== ">" && raw.charAt(1) !== "+") { throw new Error("Illegal argument: Must begin with >+"); }
if (raw.charAt(2) !== "\n") { throw new Error("Illegal argument: Must begin with >+\n"); }
let index = 3;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(3)
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(3);
}
text() {
let raw = this.node.value();
let newlines = raw.match(new RegExp('\n+$'))
public text() {
const raw = this.node.value();
const newlines = raw.match(new RegExp("\n+$"));
return raw.substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp('([^\n])\n([^\n])', 'g'), '$1 $2')
.replace(new RegExp('\n\n', 'g'), '\n')
+ newlines[0].toString()
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
.replace(new RegExp("([^\n])\n([^\n])", "g"), "$1 $2")
.replace(new RegExp("\n\n", "g"), "\n")
+ newlines[0].toString();
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -185,28 +186,28 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '|') throw new Error("Illegal argument: Must begin with |")
if (raw.charAt(1) != '\n') throw new Error("Illegal argument: Must begin with |\n")
let index = 2
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== "|") { throw new Error("Illegal argument: Must begin with |"); }
if (raw.charAt(1) !== "\n") { throw new Error("Illegal argument: Must begin with |\n"); }
let index = 2;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(2)
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(2);
}
text() {
public text() {
return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '\n')
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "\n");
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -221,28 +222,28 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '|' && raw.charAt(1) != '-') throw new Error("Illegal argument: Must begin with |-")
if (raw.charAt(2) != '\n') throw new Error("Illegal argument: Must begin with |-\n")
let index = 3
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== "|" && raw.charAt(1) !== "-") { throw new Error("Illegal argument: Must begin with |-"); }
if (raw.charAt(2) !== "\n") { throw new Error("Illegal argument: Must begin with |-\n"); }
let index = 3;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(3)
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(3);
}
text() {
public text() {
return this.node.value().substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "");
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -257,31 +258,31 @@ }

// Indent for each line
private indent: string
private leading: string
private indent: string;
private leading: string;
constructor(private node: TextTreeNode) {
let raw = node.value()
if (raw.charAt(0) != '|' && raw.charAt(1) != '+') throw new Error("Illegal argument: Must begin with |+")
if (raw.charAt(2) != '\n') throw new Error("Illegal argument: Must begin with |+\n")
let index = 3
let ch = raw.charAt(index)
while (ch == ' ' || ch == '\t' || ch == '\n') {
ch = raw.charAt(++index)
const raw = node.value();
if (raw.charAt(0) !== "|" && raw.charAt(1) !== "+") { throw new Error("Illegal argument: Must begin with |+"); }
if (raw.charAt(2) !== "\n") { throw new Error("Illegal argument: Must begin with |+\n"); }
let index = 3;
let ch = raw.charAt(index);
while (ch === " " || ch === "\t" || ch === "\n") {
ch = raw.charAt(++index);
}
this.leading = raw.substr(0, index)
this.indent = this.leading.substring(3)
this.leading = raw.substr(0, index);
this.indent = this.leading.substring(3);
}
text() {
let raw = this.node.value();
let newlines = raw.match(new RegExp('\n+$'))
public text() {
const raw = this.node.value();
const newlines = raw.match(new RegExp("\n+$"));
return raw.substr(this.leading.length)
.replace(new RegExp('^' + this.indent, 'mg'), '')
.replace(new RegExp('\n+$'), '')
+ newlines[0].toString()
.replace(new RegExp("^" + this.indent, "mg"), "")
.replace(new RegExp("\n+$"), "")
+ newlines[0].toString();
}
updateText(to: string) {
let newValue = `${this.leading}${to}`
public updateText(to: string) {
const newValue = `${this.leading}${to}`;
// console.log(`Update from [${this.node.value()}] to [${newValue}]`)
this.node.update(newValue)
this.node.update(newValue);
}

@@ -295,6 +296,6 @@ }

private items: String[]
private items: string[];
constructor(private node: TextTreeNode) {
this.items = node.value().trim().split('\n')
this.items = node.value().trim().split("\n");
}

@@ -307,7 +308,7 @@

*/
addElement(elem: string) {
let lastItem = this.items[this.items.length - 1]
this.items.push(lastItem.substring(0, lastItem.indexOf('-')) + '- ' + elem)
let newValue = this.items.join('\n') + '\n'
this.node.update(newValue)
public addElement(elem: string) {
const lastItem = this.items[this.items.length - 1];
this.items.push(lastItem.substring(0, lastItem.indexOf("-")) + "- " + elem);
const newValue = this.items.join("\n") + "\n";
this.node.update(newValue);
// console.log(this.node.value())

@@ -321,9 +322,9 @@ }

*/
removeElement(elem: string) {
let lastItem = this.items[this.items.length - 1]
let index = this.items.indexOf(lastItem.substring(0, lastItem.indexOf('-')) + '- ' + elem)
public removeElement(elem: string) {
const lastItem = this.items[this.items.length - 1];
const index = this.items.indexOf(lastItem.substring(0, lastItem.indexOf("-")) + "- " + elem);
if (index > -1) {
this.items.splice(index, 1)
let newValue = this.items.join('\n') + '\n'
this.node.update(newValue)
this.items.splice(index, 1);
const newValue = this.items.join("\n") + "\n";
this.node.update(newValue);
// console.log(this.node.value())

@@ -338,7 +339,7 @@ }

*/
updateKey(key: string) {
this.node.update(key) // this currently only updates the value
public updateKey(key: string) {
this.node.update(key); // this currently only updates the value
}
}
export type YamlSequence = YamlSequenceOps & TextTreeNode
export type YamlSequence = YamlSequenceOps & TextTreeNode;

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

Object.defineProperty(exports, "__esModule", { value: true });
var DecoratingPathExpressionEngine_1 = require("../DecoratingPathExpressionEngine");
var helper = require("../../tree/TreeHelper");
var DecoratingPathExpressionEngine_1 = require("../DecoratingPathExpressionEngine");
var yaml = require("./Types");

@@ -33,7 +33,7 @@ /**

return new yaml.YamlQuotedValue(ttn);
case '>':
case ">":
switch (ttn.value().charAt(1)) {
case '-':
case "-":
return new yaml.YamlFoldedBlockWithStripChomping(ttn);
case '+':
case "+":
return new yaml.YamlFoldedBlockWithKeepChomping(ttn);

@@ -43,7 +43,7 @@ default:

}
case '|':
case "|":
switch (ttn.value().charAt(1)) {
case '-':
case "-":
return new yaml.YamlLiteralBlockWithStripChomping(ttn);
case '+':
case "+":
return new yaml.YamlLiteralBlockWithKeepChomping(ttn);

@@ -50,0 +50,0 @@ default:

@@ -1,4 +0,5 @@

import {TreeNode, TextTreeNode} from "../../tree/PathExpression";
import { DecoratingPathExpressionEngine } from "../DecoratingPathExpressionEngine";
import { TextTreeNode, TreeNode } from "../../tree/PathExpression";
import * as helper from "../../tree/TreeHelper";
import {DecoratingPathExpressionEngine} from "../DecoratingPathExpressionEngine";
import * as yaml from "./Types";

@@ -12,4 +13,4 @@

protected decoratorFor(n: TreeNode): any {
if ((<any>n).value) { // It's a text node
let ttn = n as TextTreeNode
if ((n as any).value) { // It's a text node
const ttn = n as TextTreeNode;

@@ -20,31 +21,31 @@ // console.log(`Decorating [${n}] with tags [${n.nodeTags()}]`)

case '"':
return new yaml.YamlQuotedValue(ttn)
case '>':
return new yaml.YamlQuotedValue(ttn);
case ">":
switch (ttn.value().charAt(1)) {
case '-':
return new yaml.YamlFoldedBlockWithStripChomping(ttn)
case '+':
return new yaml.YamlFoldedBlockWithKeepChomping(ttn)
case "-":
return new yaml.YamlFoldedBlockWithStripChomping(ttn);
case "+":
return new yaml.YamlFoldedBlockWithKeepChomping(ttn);
default:
return new yaml.YamlFoldedBlockScalar(ttn)
return new yaml.YamlFoldedBlockScalar(ttn);
}
case '|':
case "|":
switch (ttn.value().charAt(1)) {
case '-':
return new yaml.YamlLiteralBlockWithStripChomping(ttn)
case '+':
return new yaml.YamlLiteralBlockWithKeepChomping(ttn)
case "-":
return new yaml.YamlLiteralBlockWithStripChomping(ttn);
case "+":
return new yaml.YamlLiteralBlockWithKeepChomping(ttn);
default:
return new yaml.YamlLiteralBlockScalar(ttn)
return new yaml.YamlLiteralBlockScalar(ttn);
}
default:
return new yaml.YamlRawValue(ttn)
return new yaml.YamlRawValue(ttn);
}
} else if (helper.hasTag(n, "Sequence")) {
return new yaml.YamlSequenceOps(ttn)
return new yaml.YamlSequenceOps(ttn);
}
}
// If we didn't match anything
return null
return null;
}
}

@@ -29,11 +29,4 @@ /*

/**
* Evaluate, i.e., compile and execute, JavaScript code.
* DEPRECATED - Cause the operation to fail with a fatal error
*
* @param arg0 {any}
*/
eval(arg0: any): void;
/**
* Cause the operation to fail with a fatal error
*
* @param msg {string} The message to be displayed

@@ -44,3 +37,3 @@ */

/**
* Cause the editor to print to the console. Useful for debugging if running editors locally.
* DEPRECATED - Cause the editor to print to the console. Useful for debugging if running editors locally.
*

@@ -47,0 +40,0 @@ * @param msg {string} The message to be displayed

@@ -18,2 +18,3 @@ /*

import { ArtifactContainer } from "./ArtifactContainer";
import { ArtifactContainerView } from "./ArtifactContainerView";
import { BodyDeclarationView } from "./BodyDeclarationView";

@@ -56,6 +57,6 @@ import { BuildViewMutatingFunctions } from "./BuildViewMutatingFunctions";

import { ProjectDecorating } from "./ProjectDecorating";
import { ProjectView } from "./ProjectView";
import { Properties } from "./Properties";
import { PythonFile } from "./PythonFile";
import { ScalaFile } from "./ScalaFile";
import { SpringBootProject } from "./SpringBootProject";
import { TypeDeclarationView } from "./TypeDeclarationView";

@@ -69,2 +70,3 @@ import { ViewSupport } from "./ViewSupport";

export { ArtifactContainer };
export { ArtifactContainerView };
export { BodyDeclarationView };

@@ -107,6 +109,6 @@ export { BuildViewMutatingFunctions };

export { ProjectDecorating };
export { ProjectView };
export { Properties };
export { PythonFile };
export { ScalaFile };
export { SpringBootProject };
export { TypeDeclarationView };

@@ -113,0 +115,0 @@ export { ViewSupport };

@@ -20,2 +20,3 @@ /*

import { ArtifactContainer } from "./ArtifactContainer";
import { ArtifactContainerView } from "./ArtifactContainerView";
import { CommonViewOperations } from "./CommonViewOperations";

@@ -29,3 +30,3 @@ import { MutableView } from "./MutableView";

*/
interface Directory extends ArtifactContainer, CommonViewOperations, MutableView {
interface Directory extends ArtifactContainer, ArtifactContainerView, CommonViewOperations, MutableView {

@@ -32,0 +33,0 @@ /**

@@ -70,3 +70,3 @@ /*

/**
* Is this a Java file?
* DEPRECATED - Is this a Java file?
*

@@ -78,3 +78,3 @@ * @property {boolean} isJava

/**
* Is this a Scala file?
* DEPRECATED - Is this a Scala file?
*

@@ -100,3 +100,3 @@ * @property {boolean} isScala

/**
* Does the file name (not path) contain the given string?
* DEPRECATED - Does the file name (not path) contain the given string?
*

@@ -103,0 +103,0 @@ * @param what {string} The string to use when looking for it in the file name or path

@@ -32,7 +32,7 @@ /*

*
* @returns {File}
* @property {File} file
*/
file(): File;
readonly file: File;
}

@@ -51,3 +51,3 @@ /*

/**
* Is this file well-formed?
* DEPRECATED - Is this file well-formed?
*

@@ -54,0 +54,0 @@ * @property {boolean} isWellFormed

@@ -31,14 +31,7 @@ /*

*
* @returns {any[]}
* @returns {TreeNode[]}
*/
children(): any[];
children(): TreeNode[];
/**
* Name of the node
*
* @returns {string}
*/
nodeName(): string;
/**
* Tags attached to the node

@@ -60,21 +53,14 @@ *

*
* @returns {TreeNode}
* @property {TreeNode} parent
*/
parent(): TreeNode;
readonly parent: TreeNode;
/**
* Path of the file
* Path to the file
*
* @returns {string}
* @property {string} path
*/
path(): string;
readonly path: string;
/**
* Node content
*
* @returns {string}
*/
value(): string;
}

@@ -32,5 +32,5 @@ /*

*
* @returns {File}
* @property {File} now
*/
now(): File;
readonly now: File;

@@ -40,7 +40,7 @@ /**

*
* @returns {File}
* @property {File} old
*/
old(): File;
readonly old: File;
}

@@ -19,4 +19,5 @@ /*

import { ProjectContext } from "@atomist/rug/operations/ProjectEditor";
import { FileImpact } from "./FileImpact";
import { Project } from "./Project";
export { Impact };

@@ -30,14 +31,35 @@

/**
* Project after impact
*
* @property {Project} after
*/
readonly after: Project;
/**
* Project before impact
*
* @property {Project} before
*/
readonly before: Project;
/**
* Virtual project composed of files changed in this commit
*
* @property {Project} changed
*/
readonly changed: Project;
/**
* Children
*
* @returns {any[]}
* @returns {TreeNode[]}
*/
children(): any[];
children(): TreeNode[];
/**
* Name of the node
* File impacts in this commit
*
* @returns {string}
* @property {FileImpact[]} files
*/
nodeName(): string;
readonly files: FileImpact[];

@@ -61,14 +83,7 @@ /**

*
* @returns {TreeNode}
* @property {TreeNode} parent
*/
parent(): TreeNode;
readonly parent: TreeNode;
/**
* Node content
*
* @returns {string}
*/
value(): string;
}

@@ -20,2 +20,4 @@ /*

import { ProjectDecorating } from "./ProjectDecorating";
import { ProjectView } from "./ProjectView";
import { ArtifactContainerView } from "./ArtifactContainerView";
import { ChangeLogging } from "./ChangeLogging";

@@ -30,3 +32,3 @@ import { CommonViewOperations } from "./CommonViewOperations";

*/
interface JavaProject extends ProjectDecorating, ChangeLogging, CommonViewOperations, MutableView {
interface JavaProject extends ProjectDecorating, ProjectView, ArtifactContainerView, ChangeLogging, CommonViewOperations, MutableView {

@@ -33,0 +35,0 @@ /**

@@ -32,3 +32,3 @@ /*

/**
* Return this line's content
* DEPRECATED - Return this line's content
*

@@ -35,0 +35,0 @@ * @returns {string}

@@ -31,5 +31,5 @@ /*

*
* @returns {any[]}
* @returns {TreeNode[]}
*/
children(): any[];
children(): TreeNode[];

@@ -36,0 +36,0 @@ /**

@@ -31,5 +31,5 @@ /*

*
* @returns {any[]}
* @returns {TreeNode[]}
*/
children(): any[];
children(): TreeNode[];

@@ -36,0 +36,0 @@ /**

@@ -20,3 +20,7 @@ /*

import { ArtifactContainer } from "./ArtifactContainer";
import { File } from "./File";
import { ProjectView } from "./ProjectView";
import { ArtifactContainerView } from "./ArtifactContainerView";
import { ChangeLogging } from "./ChangeLogging";
import { CommonViewOperations } from "./CommonViewOperations";
import { MutableView } from "./MutableView";

@@ -26,5 +30,5 @@ export { Project };

/*
* Project
* Type for a project. Supports global operations. Consider using file and other lower types by preference as projectoperations can be inefficient.
*/
interface Project extends ArtifactContainer {
interface Project extends ArtifactContainer, ProjectView, ArtifactContainerView, ChangeLogging, CommonViewOperations, MutableView {

@@ -63,16 +67,2 @@ /**

/**
* Return a new Project View based on the original backing object (normally the .atomist/ directory)
*
* @returns {Project}
*/
backingArchiveProject(): Project;
/**
* Provides access additional context, such as the PathExpressionEngine
*
* @property {ProjectContext} context
*/
readonly context: ProjectContext;
/**
* Copy the given file from the editor's backing archive to the same path in project being edited. Fail the editor if it isn't found or if the destination already exists

@@ -138,10 +128,2 @@ *

/**
* The number of files directly in this directory
*
* @param path {string} The path to use
* @returns {number}
*/
countFilesInDirectory(path: string): number;
/**
* Deletes a directory with the given path

@@ -161,9 +143,2 @@ *

/**
* Describe a change we made to this object
*
* @param arg0 {string}
*/
describeChange(arg0: string): void;
/**
* Edit with the given editor

@@ -177,34 +152,2 @@ *

/**
* Does a file with the given path exist and have the expected content?
*
* @param path {string} The path to use
* @param content {string} The content to check
* @returns {boolean}
*/
fileContains(path: string, content: string): boolean;
/**
* The total number of files in this project
*
* @property {number} fileCount
*/
readonly fileCount: number;
/**
* Does a file with the given path exist and have the expected content?
*
* @param path {string} The path to use
* @param content {string} The content to check against the given file
* @returns {boolean}
*/
fileHasContent(path: string, content: string): boolean;
/**
* Files in this archive
*
* @property {File[]} files
*/
readonly files: File[];
/**
* Makes a file executable

@@ -242,20 +185,2 @@ *

/**
* Return the name of the project. If it's in GitHub, it will be the repo name. If it's on the local filesystem it will be the directory name
*
* @property {string} name
*/
readonly name: string;
/**
* Return the path expression to this point in the given file
*
* @param arg0 {string}
* @param arg1 {string}
* @param arg2 {number}
* @param arg3 {number}
* @returns {string}
*/
pathTo(arg0: string, arg1: string, arg2: number, arg3: number): string;
/**
* Don't use. Merely intended to simplify the life of the Rug to TypeScript transpiler.

@@ -291,10 +216,3 @@ *

/**
* Node content
*
* @returns {string}
*/
value(): string;
}

@@ -31,16 +31,9 @@ /*

*
* @returns {any[]}
* @returns {TreeNode[]}
*/
children(): any[];
children(): TreeNode[];
/**
* Evaluate, i.e., compile and execute, JavaScript code.
* DEPRECATED - Cause the operation to fail with a fatal error
*
* @param arg0 {any}
*/
eval(arg0: any): void;
/**
* Cause the operation to fail with a fatal error
*
* @param msg {string} The message to be displayed

@@ -65,3 +58,3 @@ */

/**
* Cause the editor to print to the console. Useful for debugging if running editors locally.
* DEPRECATED - Cause the editor to print to the console. Useful for debugging if running editors locally.
*

@@ -68,0 +61,0 @@ * @param msg {string} The message to be displayed

@@ -20,2 +20,4 @@ /*

import { FileArtifactBacked } from "./FileArtifactBacked";
import { MutableView } from "./MutableView";
import { CommonViewOperations } from "./CommonViewOperations";

@@ -25,5 +27,5 @@ export { Xml };

/*
* Xml
* XML
*/
interface Xml extends FileArtifactBacked {
interface Xml extends FileArtifactBacked, MutableView, CommonViewOperations {

@@ -30,0 +32,0 @@ /**

@@ -11,12 +11,17 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
//used by annotation functions
// used by annotation functions
function set_metadata(obj, key, value) {
Object.defineProperty(obj, key, { value: value, writable: false, enumerable: true });
Object.defineProperty(obj, key, {
value: value,
writable: false,
enumerable: false,
configurable: true,
});
}
function get_metadata(obj, key) {
var desc = Object.getOwnPropertyDescriptor(obj, key);
if ((desc == null || desc == undefined) && (obj.prototype != undefined)) {
if ((desc == null || desc === undefined) && (obj.prototype !== undefined)) {
desc = Object.getOwnPropertyDescriptor(obj.prototype, key);
}
if (desc != null || desc != undefined) {
if (desc != null || desc !== undefined) {
return desc.value;

@@ -27,4 +32,4 @@ }

/**
* Decorator for parameters. Adds to object properties
*/
* Decorator for parameters. Adds to object properties
*/
function Parameter(details) {

@@ -37,4 +42,4 @@ return function (target, propertyKey) {

var copy = __assign({}, details);
copy["name"] = propertyKey;
copy["decorated"] = true;
copy.name = propertyKey;
copy.decorated = true;
params.push(copy);

@@ -46,4 +51,4 @@ set_metadata(target, "__parameters", params);

/**
* Map a local field to some other cnofiguration item in a different system
**/
* Map a local field to some other configuration item in a different system
*/
function MappedParameter(foreignKey) {

@@ -62,6 +67,7 @@ return function (target, localKey) {

/**
* Decorator for editors. Use this intead of implementing the editor interface.
*/
* Decorator for editors. Use this instead of implementing the editor interface.
*/
function ruglike(fn, kind, msg) {
return function (name, description) {
return function (nameOrDescription, description) {
// tslint:disable-next-line:ban-types
return function (ctr) {

@@ -71,5 +77,10 @@ if (typeof ctr.prototype[fn] !== "function") {

}
ctr.prototype["__name"] = name;
ctr.prototype["__description"] = description;
ctr.prototype["__kind"] = kind;
if (description === undefined) {
set_metadata(ctr.prototype, "__description", nameOrDescription);
}
else {
set_metadata(ctr.prototype, "__description", description);
set_metadata(ctr.prototype, "__name", nameOrDescription);
}
ctr.prototype.__kind = kind;
};

@@ -87,14 +98,15 @@ };

var EventHandler = function (name, description, expression) {
// tslint:disable-next-line:ban-types
return function (ctr) {
if (typeof ctr.prototype["handle"] !== "function") {
if (typeof ctr.prototype.handle !== "function") {
throw new Error("handle must be a function with first parameter = Match<R,N>");
}
ctr.prototype["__name"] = name;
ctr.prototype["__description"] = description;
ctr.prototype["__kind"] = "event-handler";
if (typeof expression == 'string') {
ctr.prototype["__expression"] = expression;
set_metadata(ctr.prototype, "__name", name);
set_metadata(ctr.prototype, "__description", description);
set_metadata(ctr.prototype, "__kind", "event-handler");
if (typeof expression === "string") {
set_metadata(ctr.prototype, "__expression", expression);
}
else {
ctr.prototype["__expression"] = expression.expression;
set_metadata(ctr.prototype, "__expression", expression.expression);
}

@@ -105,4 +117,4 @@ };

/**
* Decorator for tags. Sets tags on the class
*/
* Decorator for tags. Sets tags on the class
*/
function Tags() {

@@ -114,3 +126,3 @@ var tags = [];

return function (target) {
target.prototype["__tags"] = tags;
set_metadata(target.prototype, "__tags", tags);
};

@@ -125,3 +137,3 @@ }

return function (target) {
target.prototype["__intent"] = intent;
set_metadata(target.prototype, "__intent", intent);
};

@@ -136,10 +148,11 @@ }

return function (target) {
if (target.prototype["__secrets"] == null) {
target.prototype["__secrets"] = [];
var current = get_metadata(target.prototype, "__secrets");
if (current == null) {
current = [];
}
target.prototype["__secrets"] = target.prototype["__secrets"].concat(secrets);
set_metadata(target.prototype, "__secrets", current.concat(secrets));
};
}
exports.Secrets = Secrets;
//for parameters to ResponseHandlers to do response body coercion
// for parameters to ResponseHandlers to do response body coercion
function ParseJson(target, propertyKey, parameterIndex) {

@@ -146,0 +159,0 @@ set_metadata(target, "__coercion", "JSON");

@@ -1,125 +0,150 @@

import {BaseParameter} from './RugOperation'
import {PathExpression} from '../tree/PathExpression'
import { PathExpression } from "../tree/PathExpression";
import { BaseParameter } from "./RugOperation";
//used by annotation functions
// used by annotation functions
function set_metadata(obj: any, key: string, value: any){
Object.defineProperty(obj, key, {value: value, writable: false, enumerable: true})
function set_metadata(obj: any, key: string, value: any) {
Object.defineProperty(obj, key,
{
value,
writable: false,
enumerable: false,
configurable: true,
});
}
function get_metadata(obj: any, key: string){
let desc = Object.getOwnPropertyDescriptor(obj, key);
if((desc == null || desc == undefined) && (obj.prototype != undefined)){
desc = Object.getOwnPropertyDescriptor(obj.prototype, key);
}
if(desc != null || desc != undefined){
return desc.value;
}
return null;
function get_metadata(obj: any, key: string) {
let desc = Object.getOwnPropertyDescriptor(obj, key);
if ((desc == null || desc === undefined) && (obj.prototype !== undefined)) {
desc = Object.getOwnPropertyDescriptor(obj.prototype, key);
}
if (desc != null || desc !== undefined) {
return desc.value;
}
return null;
}
/**
* Decorator for parameters. Adds to object properties
*/
* Decorator for parameters. Adds to object properties
*/
function Parameter(details: BaseParameter) {
return function (target: any, propertyKey: string) {
var params = get_metadata(target, "__parameters");
if(params == null){
params = []
return (target: any, propertyKey: string) => {
let params = get_metadata(target, "__parameters");
if (params == null) {
params = [];
}
var copy: any = {... details}
copy["name"] = propertyKey
copy["decorated"] = true
const copy: any = { ...details };
copy.name = propertyKey;
copy.decorated = true;
params.push(copy);
set_metadata(target, "__parameters", params);
}
};
}
/**
* Map a local field to some other cnofiguration item in a different system
**/
* Map a local field to some other configuration item in a different system
*/
function MappedParameter(foreignKey: string) {
return function (target: any, localKey: string) {
var params = get_metadata(target, "__mappedParameters");
if(params == null){
params = []
return (target: any, localKey: string) => {
let params = get_metadata(target, "__mappedParameters");
if (params == null) {
params = [];
}
var param = {localKey: localKey, foreignKey: foreignKey}
const param = { localKey, foreignKey };
params.push(param);
set_metadata(target, "__mappedParameters", params);
}
};
}
/**
* Decorator for editors. Use this intead of implementing the editor interface.
*/
* Decorator for editors. Use this instead of implementing the editor interface.
*/
function ruglike(fn: string, kind: string, msg: string) {
return function (name: string, description: string) {
return function(ctr: Function) {
return (nameOrDescription: string, description?: string) => {
// tslint:disable-next-line:ban-types
return (ctr: Function) => {
if (typeof ctr.prototype[fn] !== "function") {
throw new Error(`${msg}`)
throw new Error(`${msg}`);
}
ctr.prototype["__name"] = name;
ctr.prototype["__description"] = description
ctr.prototype["__kind"] = kind
}
}
if (description === undefined) {
set_metadata(ctr.prototype, "__description", nameOrDescription);
} else {
set_metadata(ctr.prototype, "__description", description);
set_metadata(ctr.prototype, "__name", nameOrDescription);
}
ctr.prototype.__kind = kind;
};
};
}
let Generator = ruglike("populate","generator", "populate must be a function with first parameter = Project")
let Editor = ruglike("edit", "editor", "edit must be a function with first parameter = Project")
let CommandHandler = ruglike("handle", "command-handler", "handle must be a function with first parameter = HandlerContext")
let ResponseHandler = ruglike("handle", "response-handler", "handle must be a function with first parameter = Response<T>")
const Generator = ruglike(
"populate",
"generator",
"populate must be a function with first parameter = Project");
let EventHandler = function (name: string, description: string, expression: PathExpression<any,any> | string) {
return function(ctr: Function) {
if (typeof ctr.prototype["handle"] !== "function") {
throw new Error("handle must be a function with first parameter = Match<R,N>")
const Editor = ruglike(
"edit",
"editor",
"edit must be a function with first parameter = Project");
const CommandHandler = ruglike(
"handle",
"command-handler",
"handle must be a function with first parameter = HandlerContext");
const ResponseHandler = ruglike(
"handle",
"response-handler",
"handle must be a function with first parameter = Response<T>");
const EventHandler = (name: string, description: string, expression: PathExpression<any, any> | string) => {
// tslint:disable-next-line:ban-types
return (ctr: Function) => {
if (typeof ctr.prototype.handle !== "function") {
throw new Error("handle must be a function with first parameter = Match<R,N>");
}
ctr.prototype["__name"] = name;
ctr.prototype["__description"] = description
ctr.prototype["__kind"] = "event-handler"
if(typeof expression == 'string'){
ctr.prototype["__expression"] = expression;
}else{
ctr.prototype["__expression"] = expression.expression;
set_metadata(ctr.prototype, "__name", name);
set_metadata(ctr.prototype, "__description", description);
set_metadata(ctr.prototype, "__kind", "event-handler");
if (typeof expression === "string") {
set_metadata(ctr.prototype, "__expression", expression);
} else {
set_metadata(ctr.prototype, "__expression", expression.expression);
}
}
}
};
};
/**
* Decorator for tags. Sets tags on the class
*/
* Decorator for tags. Sets tags on the class
*/
function Tags(...tags: string[]) {
return function(target: any) {
target.prototype["__tags"] = tags
}
return (target: any) => {
set_metadata(target.prototype, "__tags", tags);
};
}
function Intent(...intent: string[]) {
return function(target: any) {
target.prototype["__intent"] = intent
}
return (target: any) => {
set_metadata(target.prototype, "__intent", intent);
};
}
function Secrets(...secrets: string[]) {
return function(target: any) {
if(target.prototype["__secrets"] == null) {
target.prototype["__secrets"] = []
return (target: any) => {
let current = get_metadata(target.prototype, "__secrets");
if (current == null) {
current = [];
}
target.prototype["__secrets"] = target.prototype["__secrets"].concat(secrets);
}
set_metadata(target.prototype, "__secrets", current.concat(secrets));
};
}
//for parameters to ResponseHandlers to do response body coercion
function ParseJson(target: Object, propertyKey: string | symbol, parameterIndex: number) {
// for parameters to ResponseHandlers to do response body coercion
function ParseJson(target: object, propertyKey: string | symbol, parameterIndex: number) {
set_metadata(target, "__coercion", "JSON");
}
export {Parameter, Secrets, Tags, Intent, MappedParameter}
export {Editor, Generator}
export {ParseJson}
export {ResponseHandler, CommandHandler, EventHandler}
export { Parameter, Secrets, Tags, Intent, MappedParameter };
export { Editor, Generator };
export { ParseJson };
export { ResponseHandler, CommandHandler, EventHandler };

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

exports.Presentable = Presentable;
/**
* Get an editor instruction to run a GitHub Pull Request
*/
var GitHubPullRequest = (function () {
function GitHubPullRequest(baseBranch) {
if (baseBranch === void 0) { baseBranch = "master"; }
this.baseBranch = baseBranch;
this.kind = "github-pull-request";
}
return GitHubPullRequest;
}());
exports.GitHubPullRequest = GitHubPullRequest;
/**
* Get an editor instruction to run a GitHub Pull Request
*/
var GitHubBranch = (function () {
function GitHubBranch(baseBranch, headBranch) {
if (baseBranch === void 0) { baseBranch = "master"; }
this.baseBranch = baseBranch;
this.headBranch = headBranch;
this.kind = "github-branch";
}
return GitHubBranch;
}());
exports.GitHubBranch = GitHubBranch;
var Status;

@@ -67,8 +92,8 @@ (function (Status) {

}
EventPlan.ofMessage = function (m) {
return new EventPlan().add(m);
};
EventPlan.prototype.add = function (msg) {
return _super.prototype.add.call(this, msg);
};
EventPlan.ofMessage = function (m) {
return new EventPlan().add(m);
};
return EventPlan;

@@ -85,8 +110,8 @@ }(Plan));

}
CommandPlan.ofMessage = function (m) {
return new CommandPlan().add(m);
};
CommandPlan.prototype.add = function (msg) {
return _super.prototype.add.call(this, msg);
};
CommandPlan.ofMessage = function (m) {
return new CommandPlan().add(m);
};
return CommandPlan;

@@ -103,17 +128,10 @@ }(Plan));

exports.MessageMimeTypes = MessageMimeTypes;
/**
* Represents the response to the bot from a command
*/
var ResponseMessage = (function () {
function ResponseMessage(body, contentType) {
this.kind = "response";
this.contentType = MessageMimeTypes.PLAIN_TEXT;
var LocallyRenderedMessage = (function () {
function LocallyRenderedMessage() {
this.usernames = [];
this.channelNames = [];
this.body = body;
if (contentType) {
this.contentType = contentType;
}
this.contentType = MessageMimeTypes.PLAIN_TEXT;
this.instructions = [];
}
ResponseMessage.prototype.addAddress = function (address) {
LocallyRenderedMessage.prototype.addAddress = function (address) {
if (address instanceof UserAddress) {

@@ -127,4 +145,24 @@ this.usernames.push(address.username);

};
LocallyRenderedMessage.prototype.addAction = function (instruction) {
this.instructions.push(instruction);
return this;
};
return LocallyRenderedMessage;
}());
/**
* Represents the response to the bot from a command
*/
var ResponseMessage = (function (_super) {
__extends(ResponseMessage, _super);
function ResponseMessage(body, contentType) {
var _this = _super.call(this) || this;
_this.kind = "response";
_this.body = body;
if (contentType) {
_this.contentType = contentType;
}
return _this;
}
return ResponseMessage;
}());
}(LocallyRenderedMessage));
exports.ResponseMessage = ResponseMessage;

@@ -148,25 +186,16 @@ var UserAddress = (function () {

*/
var DirectedMessage = (function () {
var DirectedMessage = (function (_super) {
__extends(DirectedMessage, _super);
function DirectedMessage(body, address, contentType) {
this.kind = "directed";
this.contentType = MessageMimeTypes.PLAIN_TEXT;
this.usernames = [];
this.channelNames = [];
this.body = body;
var _this = _super.call(this) || this;
_this.kind = "directed";
_this.body = body;
if (contentType) {
this.contentType = contentType;
_this.contentType = contentType;
}
this.addAddress(address);
_this.addAddress(address);
return _this;
}
DirectedMessage.prototype.addAddress = function (address) {
if (address instanceof UserAddress) {
this.usernames.push(address.username);
}
else {
this.channelNames.push(address.channelName);
}
return this;
};
return DirectedMessage;
}());
}(LocallyRenderedMessage));
exports.DirectedMessage = DirectedMessage;

@@ -173,0 +202,0 @@ /**

@@ -1,33 +0,40 @@

import { GraphNode, TreeNode, PathExpressionEngine, PathExpression, Match } from "../tree/PathExpression"
import { Parameter } from "./RugOperation"
import {
GraphNode,
Match,
PathExpression,
PathExpressionEngine,
TreeNode,
} from "../tree/PathExpression";
import { Parameter } from "./RugOperation";
export interface RugCoordinate {
readonly name: string
readonly group: string
readonly artifact: string
readonly name: string;
readonly group: string;
readonly artifact: string;
}
type InstructionKind = "generate" | "edit" | "execute" | "respond" | "command"
type InstructionKind = "generate" | "edit" | "execute" | "respond" | "command";
export interface Instruction<T extends InstructionKind> {
readonly name: string | RugCoordinate
readonly parameters?: {}
readonly kind: T
readonly name: string | RugCoordinate;
readonly parameters?: {};
readonly kind: T;
}
export class EventRespondable<T extends Edit | Generate | Execute> {
instruction: T
onSuccess?: EventPlan | EventMessage | Respond
onError?: EventPlan | EventMessage | Respond
public instruction: T;
public onSuccess?: EventPlan | EventMessage | Respond;
public onError?: EventPlan | EventMessage | Respond;
}
export class CommandRespondable<T extends Edit | Generate | Execute | Command> {
instruction: T
onSuccess?: CommandPlan | CommandMessage | Respond
onError?: CommandPlan | CommandMessage | Respond
public instruction: T;
public onSuccess?: CommandPlan | CommandMessage | Respond;
public onError?: CommandPlan | CommandMessage | Respond;
}
export class Presentable<T extends InstructionKind> {
instruction: Instruction<T> | PresentableGenerate | PresentableEdit
label?: string
public instruction: Instruction<T> | PresentableGenerate | PresentableEdit;
public label?: string;
public id?: string;
}

@@ -37,39 +44,72 @@

// in the future, we could add things like github urls, orgs etc.
interface ProjectReference {}
// tslint:disable-next-line:no-empty-interface
interface ProjectReference { }
export interface ProjectInstruction<T extends InstructionKind> extends Instruction<T> {
project: string | ProjectReference
project: string | ProjectReference;
}
export interface Edit extends ProjectInstruction<"edit"> {}
type EditorTargetKind = "direct" | "github-pull-request" | "github-branch";
/**
* How should the `edit` be applied? PR details etc.
*/
export interface EditorTarget<T extends EditorTargetKind> {
kind: T;
baseBranch: string;
}
//extends ProjectInstruction because we need to know the project name
export interface Generate extends ProjectInstruction<"generate"> {}
/**
* Get an editor instruction to run a GitHub Pull Request
*/
export class GitHubPullRequest implements EditorTarget<"github-pull-request"> {
public kind: "github-pull-request" = "github-pull-request";
public title?: string; // title of the PR
public body?: string; // body of the PR (defaults to editor changelog)
public headBranch?: string; // name of PR source branch (default auto-generated)
constructor(public baseBranch: string = "master") { }
}
//because in a message, we may not know project name yet
/**
* Get an editor instruction to run a GitHub Pull Request
*/
export class GitHubBranch implements EditorTarget<"github-branch"> {
public kind: "github-branch" = "github-branch";
constructor(public baseBranch: string = "master", public headBranch?: string) { }
}
// tslint:disable-next-line:no-empty-interface
export interface Edit extends ProjectInstruction<"edit"> {
target?: EditorTarget<EditorTargetKind>;
}
// extends ProjectInstruction because we need to know the project name
// tslint:disable-next-line:no-empty-interface
export interface Generate extends ProjectInstruction<"generate"> { }
// because in a message, we may not know project name yet
export interface PresentableGenerate extends Instruction<"generate"> {
project?: string | ProjectReference
project?: string | ProjectReference;
}
//because in a message, we may not know project name yet
// because in a message, we may not know project name yet
export interface PresentableEdit extends Instruction<"edit"> {
project?: string | ProjectReference
project?: string | ProjectReference;
}
export interface Execute extends Instruction<"execute"> {}
// tslint:disable-next-line:no-empty-interface
export interface Execute extends Instruction<"execute"> { }
// tslint:disable-next-line:no-empty-interface
export interface Respond extends Instruction<"respond"> { }
// tslint:disable-next-line:no-empty-interface
export interface Command extends Instruction<"command"> { }
export interface Respond extends Instruction<"respond"> {}
export interface Command extends Instruction<"command"> {}
export interface HandleCommand {
handle(ctx: HandlerContext): CommandPlan
handle(ctx: HandlerContext): CommandPlan;
}
export interface HandleEvent<R extends GraphNode, M extends GraphNode> {
handle(root: Match<R, M>): EventPlan
handle(root: Match<R, M>): EventPlan;
}
export interface HandleResponse<T> {
handle(response: Response<T>): EventPlan | CommandPlan
handle(response: Response<T>): EventPlan | CommandPlan;
}

@@ -87,5 +127,5 @@

*/
teamId: string
teamId: string;
pathExpressionEngine: PathExpressionEngine
pathExpressionEngine: PathExpressionEngine;

@@ -96,3 +136,3 @@ /**

*/
contextRoot: GraphNode
contextRoot: GraphNode;
}

@@ -102,13 +142,13 @@

failure,
success
success,
}
export interface Response<T> {
msg: string
code: number
status: Status
body: T
msg: string;
code: number;
status: Status;
body: T;
}
type Respondable = EventRespondable<any> | CommandRespondable<any>
type Respondable = EventRespondable<any> | CommandRespondable<any>;

@@ -122,5 +162,5 @@ /**

instructions: Respondable[] = [];
public instructions: Respondable[] = [];
messages: PlanMessage[] = [];
public messages: PlanMessage[] = [];

@@ -137,7 +177,6 @@ public add?(thing: Respondable | PlanMessage): this {

type EventMessage = LifecycleMessage | DirectedMessage;
type EventMessage = LifecycleMessage | DirectedMessage
type CommandMessage = ResponseMessage | DirectedMessage;
type CommandMessage = ResponseMessage | DirectedMessage
/**

@@ -148,9 +187,9 @@ * For returning from Event Handlers

public static ofMessage(m: EventMessage): EventPlan {
return new EventPlan().add(m);
}
public add?(msg: EventMessage | EventRespondable<any>): this {
return super.add(msg);
}
static ofMessage(m: EventMessage): EventPlan {
return new EventPlan().add(m);
}
}

@@ -163,41 +202,33 @@

public static ofMessage(m: CommandMessage): CommandPlan {
return new CommandPlan().add(m);
}
public add?(msg: CommandMessage | CommandRespondable<any>): this {
return super.add(msg);
}
static ofMessage(m: CommandMessage): CommandPlan {
return new CommandPlan().add(m);
}
}
export type MessageMimeType = "application/x-atomist-slack+json" | "text/plain"
export type MessageMimeType = "application/x-atomist-slack+json" | "text/plain";
export abstract class MessageMimeTypes {
public static SLACK_JSON: MessageMimeType = "application/x-atomist-slack+json"
public static PLAIN_TEXT: MessageMimeType = "text/plain"
public static SLACK_JSON: MessageMimeType = "application/x-atomist-slack+json";
public static PLAIN_TEXT: MessageMimeType = "text/plain";
}
type MessageKind = "response" | "lifecycle" | "directed"
type MessageKind = "response" | "lifecycle" | "directed";
interface Message<T extends MessageKind> {
kind: T
kind: T;
}
/**
* Represents the response to the bot from a command
*/
export class ResponseMessage implements Message<"response"> {
abstract class LocallyRenderedMessage<T extends MessageKind> implements Message<T> {
public kind: T;
kind: "response" = "response"
body: string;
contentType: MessageMimeType = MessageMimeTypes.PLAIN_TEXT
usernames?: string[] = [];
channelNames?: string[] = [];
public usernames?: string[] = [];
public channelNames?: string[] = [];
constructor(body: string, contentType?: MessageMimeType) {
this.body = body;
if (contentType) {
this.contentType = contentType;
}
}
public contentType: MessageMimeType = MessageMimeTypes.PLAIN_TEXT;
public body: string;
public instructions?: Array<Presentable<any>> = [];

@@ -207,4 +238,3 @@ public addAddress?(address: MessageAddress): this {

this.usernames.push(address.username);
}
else {
} else {
this.channelNames.push(address.channelName);

@@ -214,4 +244,24 @@ }

}
public addAction?(instruction: Presentable<any>): this {
this.instructions.push(instruction);
return this;
}
}
/**
* Represents the response to the bot from a command
*/
export class ResponseMessage extends LocallyRenderedMessage<"response"> {
public kind: "response" = "response";
constructor(body: string, contentType?: MessageMimeType) {
super();
this.body = body;
if (contentType) {
this.contentType = contentType;
}
}
}
export class UserAddress {

@@ -225,3 +275,3 @@ constructor(public username: string) { }

export type MessageAddress = UserAddress | ChannelAddress
export type MessageAddress = UserAddress | ChannelAddress;

@@ -231,11 +281,7 @@ /**

*/
export class DirectedMessage implements Message<"directed"> {
export class DirectedMessage extends LocallyRenderedMessage<"directed"> {
public kind: "directed" = "directed";
kind: "directed" = "directed"
contentType: MessageMimeType = MessageMimeTypes.PLAIN_TEXT
body: string;
usernames?: string[] = [];
channelNames?: string[] = [];
constructor(body: string, address: MessageAddress, contentType?: MessageMimeType) {
super();
this.body = body;

@@ -247,12 +293,2 @@ if (contentType) {

}
public addAddress?(address: MessageAddress): this {
if (address instanceof UserAddress) {
this.usernames.push(address.username);
}
else {
this.channelNames.push(address.channelName);
}
return this;
}
}

@@ -263,8 +299,8 @@

*/
export class LifecycleMessage implements Message<"lifecycle">{
export class LifecycleMessage implements Message<"lifecycle"> {
kind: "lifecycle" = "lifecycle"
node: GraphNode;
instructions?: Presentable<any>[] = [];
lifecycleId: string;
public kind: "lifecycle" = "lifecycle";
public node: GraphNode;
public instructions?: Array<Presentable<any>> = [];
public lifecycleId: string;

@@ -282,12 +318,11 @@ constructor(node: GraphNode, lifecycleId: string) {

export type PlanMessage = ResponseMessage | DirectedMessage | LifecycleMessage
export type PlanMessage = ResponseMessage | DirectedMessage | LifecycleMessage;
export abstract class MappedParameters {
static readonly GITHUB_REPO_OWNER: string = "atomist://github/repository/owner"
static readonly GITHUB_REPOSITORY: string = "atomist://github/repository"
static readonly SLACK_CHANNEL: string = "atomist://slack/channel"
static readonly SLACK_TEAM: string = "atomist://slack/team"
static readonly SLACK_USER: string = "atomist://slack/user"
static readonly GITHUB_WEBHOOK_URL: string = "atomist://github_webhook_url"
public static readonly GITHUB_REPO_OWNER: string = "atomist://github/repository/owner";
public static readonly GITHUB_REPOSITORY: string = "atomist://github/repository";
public static readonly SLACK_CHANNEL: string = "atomist://slack/channel";
public static readonly SLACK_TEAM: string = "atomist://slack/team";
public static readonly SLACK_USER: string = "atomist://slack/user";
public static readonly GITHUB_WEBHOOK_URL: string = "atomist://github_webhook_url";
}

@@ -1,4 +0,4 @@

import {Project} from "../model/Core"
import {RugOperation} from "./RugOperation"
import {PathExpressionEngine} from "../tree/PathExpression"
import { Project } from "../model/Core";
import { PathExpressionEngine } from "../tree/PathExpression";
import { RugOperation } from "./RugOperation";

@@ -10,3 +10,3 @@ export interface ProjectContext {

*/
pathExpressionEngine: PathExpressionEngine
pathExpressionEngine: PathExpressionEngine;
}

@@ -19,3 +19,3 @@

*/
edit(project: Project, params?: {}): void
edit(project: Project, params?: {}): void;
}

@@ -22,0 +22,0 @@

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

import {Project} from "../model/Core"
import {RugOperation} from "./RugOperation"
import { Project } from "../model/Core";
import { RugOperation } from "./RugOperation";
interface PopulateProject {
populate(emptyProject: Project, params?: {})
populate(emptyProject: Project, params?: {});
}

@@ -14,2 +14,2 @@ /**

export {ProjectGenerator, PopulateProject}
export { ProjectGenerator, PopulateProject };

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

Pattern.any = "@any";
// tslint:disable-next-line:variable-name
Pattern.group_id = "@group_id";
// tslint:disable-next-line:variable-name
Pattern.artifact_id = "@artifact_id";
// tslint:disable-next-line:variable-name
Pattern.java_class = "@java_class";
// tslint:disable-next-line:variable-name
Pattern.java_identifier = "@java_identifier";
// tslint:disable-next-line:variable-name
Pattern.java_package = "@java_package";
// tslint:disable-next-line:variable-name
Pattern.project_name = "@project_name";
// tslint:disable-next-line:variable-name
Pattern.port = "@port";
// tslint:disable-next-line:variable-name
Pattern.ruby_class = "@ruby_class";
// tslint:disable-next-line:variable-name
Pattern.ruby_identifier = "@ruby_identifier";
// tslint:disable-next-line:variable-name
Pattern.semantic_version = "@semantic_version";
// tslint:disable-next-line:variable-name
Pattern.version_range = "@version_range";

@@ -25,0 +36,0 @@ Pattern.uuid = "@uuid";

@@ -0,4 +1,3 @@

import { PathExpression, PathExpressionEngine } from "../tree/PathExpression";
import {PathExpressionEngine, PathExpression} from "../tree/PathExpression"
/**

@@ -8,6 +7,6 @@ * Superinterface for all Rug operations, enabling cataloging.

interface RugOperation {
readonly name: string
readonly tags?: string[]
readonly description: string
readonly parameters?: Parameter[]
readonly name: string;
readonly tags?: string[];
readonly description: string;
readonly parameters?: Parameter[];
}

@@ -19,36 +18,46 @@

abstract class Pattern {
public static url: string ="@java_package"
public static any: string ="@any"
public static group_id: string ="@group_id"
public static artifact_id: string = "@artifact_id"
public static java_class: string ="@java_class"
public static java_identifier: string ="@java_identifier"
public static java_package: string ="@java_package"
public static project_name: string ="@project_name"
public static port: string ="@port"
public static ruby_class: string ="@ruby_class"
public static ruby_identifier: string ="@ruby_identifier"
public static semantic_version: string ="@semantic_version"
public static version_range: string ="@version_range"
public static uuid: string ="@uuid"
public static url: string = "@java_package";
public static any: string = "@any";
// tslint:disable-next-line:variable-name
public static group_id: string = "@group_id";
// tslint:disable-next-line:variable-name
public static artifact_id: string = "@artifact_id";
// tslint:disable-next-line:variable-name
public static java_class: string = "@java_class";
// tslint:disable-next-line:variable-name
public static java_identifier: string = "@java_identifier";
// tslint:disable-next-line:variable-name
public static java_package: string = "@java_package";
// tslint:disable-next-line:variable-name
public static project_name: string = "@project_name";
// tslint:disable-next-line:variable-name
public static port: string = "@port";
// tslint:disable-next-line:variable-name
public static ruby_class: string = "@ruby_class";
// tslint:disable-next-line:variable-name
public static ruby_identifier: string = "@ruby_identifier";
// tslint:disable-next-line:variable-name
public static semantic_version: string = "@semantic_version";
// tslint:disable-next-line:variable-name
public static version_range: string = "@version_range";
public static uuid: string = "@uuid";
}
interface BaseParameter {
readonly pattern: string
readonly required?: boolean
readonly description?: string
readonly displayName?: string
readonly validInput?: string
readonly displayable?: boolean
readonly maxLength?: number
readonly minLength?: number
readonly tags?: string[]
readonly pattern: string;
readonly required?: boolean;
readonly description?: string;
readonly displayName?: string;
readonly validInput?: string;
readonly displayable?: boolean;
readonly maxLength?: number;
readonly minLength?: number;
readonly tags?: string[];
}
interface Parameter extends BaseParameter{
readonly name: string
readonly default?: string
interface Parameter extends BaseParameter {
readonly name: string;
readonly default?: string;
}
/**

@@ -58,5 +67,5 @@ * Status of an operation.

enum Status {
Success,
NoChange,
Error
Success,
NoChange,
Error,
}

@@ -68,5 +77,5 @@

class Result {
constructor(
public status: Status,
public message: string = "") {}
constructor(
public status: Status,
public message: string = "") { }
}

@@ -81,3 +90,3 @@

Major,
Broken
Broken,
}

@@ -90,11 +99,10 @@

constructor(
public projectName: string,
public comment: string,
public severity: Severity,
public fileName?: string,
public line?: number,
public column?: number) {}
public projectName: string,
public comment: string,
public severity: Severity,
public fileName?: string,
public line?: number,
public column?: number) { }
}
export {RugOperation, Parameter, Pattern, Result, Status, ReviewComment, Severity, BaseParameter}
export { RugOperation, Parameter, Pattern, Result, Status, ReviewComment, Severity, BaseParameter };
{
"name": "@atomist/rug",
"version": "1.0.0-m.2",
"description": "TypeScript model for Atomist editors, generators etc",
"version": "1.0.0-m.3",
"description": "TypeScript model for Atomist Rugs, see http://docs.atomist.com/",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -0,3 +1,19 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./WellKnownSteps");
function Given(s, f) {

@@ -38,4 +54,1 @@ com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Given(s, f);

exports.rugAssertEqual = rugAssertEqual;
// Import well-known step definitions. It's nicer
// to have them in a separate file.
require("./WellKnownSteps.js");

@@ -1,7 +0,24 @@

import { ScenarioWorld, RepoId } from "../ScenarioWorld"
import { Result } from "../Result"
import { CommandPlan, EventPlan, Plan } from "../../operations/Handlers"
import { GraphNode } from "../../tree/PathExpression"
import { Project } from "../../model/Core"
/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Project } from "../../model/Project";
import { CommandPlan, EventPlan, Plan } from "../../operations/Handlers";
import { GraphNode } from "../../tree/PathExpression";
import { Result } from "../Result";
import { RepoId, ScenarioWorld } from "../ScenarioWorld";
import "./WellKnownSteps";
/**

@@ -19,6 +36,6 @@ * All handler scenario worlds expose the plan,

/**
* Add this node to the root context so it can
* Add this node to the root context so it can
* be matched by path expressions other than event handler expressions
*/
addToRootContext(n: GraphNode): void
addToRootContext(n: GraphNode): void;

@@ -35,3 +52,3 @@ /**

*/
plan(): T
plan(): T;

@@ -41,3 +58,3 @@ /**

*/
planFor(handlerName: string): T
planFor(handlerName: string): T;

@@ -47,8 +64,9 @@ /**

*/
planCount(): number
planCount(): number;
/**
* Are all plan(s) internally valid? Do the referenced commands and project operations exist?
*/
planIsInternallyValid(): boolean
* Are all plan(s) internally valid?
* Do the referenced commands and project operations exist?
*/
planIsInternallyValid(): boolean;

@@ -61,3 +79,3 @@ }

*/
export interface CommandHandlerScenarioWorld extends HandlerScenarioWorld<CommandPlan> {
export interface CommandHandlerScenarioWorld extends HandlerScenarioWorld<CommandPlan> {

@@ -68,3 +86,3 @@ /**

*/
commandHandler(name: string): any
commandHandler(name: string): any;

@@ -74,3 +92,3 @@ /**

*/
invokeHandler(commandHandler: any, params?: {})
invokeHandler(commandHandler: any, params?: {});

@@ -85,3 +103,3 @@ }

*/
registerHandler(name: string): any
registerHandler(name: string): any;

@@ -91,31 +109,29 @@ /**

*/
sendEvent(n: GraphNode): void
sendEvent(n: GraphNode): void;
}
// Callback for given and when steps
type SetupCallback = (HandlerScenarioWorld, ...args) => void
type SetupCallback = (HandlerScenarioWorld, ...args) => void;
type ThenCallback = (HandlerScenarioWorld?, ...args) => Result | boolean | void
type ThenCallback = (HandlerScenarioWorld?, ...args) => Result | boolean | void;
interface Definitions {
Given(s: string, f: SetupCallback): void
Given(s: string, f: SetupCallback): void;
When(s: string, f: SetupCallback): void
When(s: string, f: SetupCallback): void;
Then(s: string, f: ThenCallback): void
Then(s: string, f: ThenCallback): void;
}
// Registered with Nashorn by the test runner
declare var com_atomist_rug_test_gherkin_GherkinRunner$_definitions: Definitions
// Registered with Nashorn by the test runner
declare const com_atomist_rug_test_gherkin_GherkinRunner$_definitions: Definitions;
export function Given(s: string, f: SetupCallback) {
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Given(s, f)
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Given(s, f);
}
export function When(s: string, f: SetupCallback) {
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.When(s, f)
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.When(s, f);
}

@@ -131,3 +147,3 @@

export function Then(s: string, f: ThenCallback) {
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Then(s, f)
com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Then(s, f);
}

@@ -150,6 +166,1 @@

}
// Import well-known step definitions. It's nicer
// to have them in a separate file.
import "./WellKnownSteps.js"

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";

@@ -5,7 +20,37 @@ Object.defineProperty(exports, "__esModule", { value: true });

// Register well-known steps
Core_1.Then("parameters were invalid", function (world) {
return world.invalidParameters() != null;
/**
* Nothing. Typical starting point for command handler testing.
*/
Core_1.Given("nothing", function (w) {
return;
});
/**
* Generic event handler registrtion.
*/
Core_1.Given("([a-zA-Z0-9]+) handler", function (w, handlerName) {
w.registerHandler(handlerName);
});
/**
* No event handler was triggered.
*/
Core_1.Then("no handler fired", function (w) {
return w.plan() === null;
});
/**
* Valid command handler parameters.
*/
Core_1.Then("handler parameters were valid", function (w) {
return w.invalidParameters() === null;
});
/**
* Invalid command handler parameters.
*/
Core_1.Then("handler parameters were invalid", function (w) {
return w.invalidParameters() !== null;
});
/**
* The returned plan has no messages.
*/
Core_1.Then("plan has no messages", function (world) {
return world.plan().messages().length == 0;
return world.plan().messages.length === 0;
});

@@ -1,11 +0,63 @@

import {Given, When, Then} from "./Core"
/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
CommandHandlerScenarioWorld, EventHandlerScenarioWorld, Given, Then, When,
} from "./Core";
// Register well-known steps
Then("parameters were invalid", world =>
world.invalidParameters() != null
)
/**
* Nothing. Typical starting point for command handler testing.
*/
Given("nothing", (w: CommandHandlerScenarioWorld) => {
return;
});
Then("plan has no messages", world => {
return world.plan().messages().length == 0
})
/**
* Generic event handler registrtion.
*/
Given("([a-zA-Z0-9]+) handler", (w: EventHandlerScenarioWorld, handlerName: string) => {
w.registerHandler(handlerName);
});
/**
* No event handler was triggered.
*/
Then("no handler fired", (w: EventHandlerScenarioWorld) => {
return w.plan() === null;
});
/**
* Valid command handler parameters.
*/
Then("handler parameters were valid", (w: CommandHandlerScenarioWorld) => {
return w.invalidParameters() === null;
});
/**
* Invalid command handler parameters.
*/
Then("handler parameters were invalid", (w: CommandHandlerScenarioWorld) => {
return w.invalidParameters() !== null;
});
/**
* The returned plan has no messages.
*/
Then("plan has no messages", (world: CommandHandlerScenarioWorld | EventHandlerScenarioWorld) => {
return world.plan().messages.length === 0;
});

@@ -0,3 +1,19 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./WellKnownSteps");
function Given(s, f) {

@@ -31,4 +47,1 @@ com_atomist_rug_test_gherkin_GherkinRunner$_definitions.Given(s, f);

exports.rugAssertEqual = rugAssertEqual;
// Import well-known step definitions. It's nicer
// to have them in a separate file.
require("./WellKnownSteps.js");

@@ -1,6 +0,23 @@

import { Project } from "../../model/Core";
/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Project } from "../../model/Project";
import { ProjectEditor } from "../../operations/ProjectEditor";
import { ProjectGenerator } from "../../operations/ProjectGenerator";
import { Result } from "../Result";
import { ScenarioWorld } from "../ScenarioWorld";
import { Result } from "../Result";
import "./WellKnownSteps";

@@ -39,3 +56,3 @@ /**

/**
* How many modifications did editors in this scenario make? Note
* Did the editor make modifications in this scenario? Note
* the initial population of a project prior to entering the

@@ -45,3 +62,3 @@ * generator 'populate' method does not contribute to the number

*/
modificationsMade(): number;
modificationsMade(): boolean;

@@ -60,7 +77,6 @@ /**

// Callback for given and when steps
type SetupCallback = (Project, ProjectScenarioWorld?, ...args) => void
type SetupCallback = (Project, ProjectScenarioWorld?, ...args) => void;
type ThenCallback = (Project, ProjectScenarioWorld?, ...args) => Result | boolean | void
type ThenCallback = (Project, ProjectScenarioWorld?, ...args) => Result | boolean | void;
interface Definitions {

@@ -76,4 +92,4 @@

// Registered with Nashorn by the test runner
declare var com_atomist_rug_test_gherkin_GherkinRunner$_definitions: Definitions
// Registered with Nashorn by the test runner
declare const com_atomist_rug_test_gherkin_GherkinRunner$_definitions: Definitions;

@@ -107,6 +123,1 @@ export function Given(s: string, f: SetupCallback) {

}
// Import well-known step definitions. It's nicer
// to have them in a separate file.
import "./WellKnownSteps.js";

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";

@@ -2,0 +17,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,4 +0,19 @@

import {Project} from "../../model/Core"
import {File} from "../../model/Core"
/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { File, Project } from "../../model/Core";
/**

@@ -11,11 +26,11 @@ * Pretty list the files in project

.join("\n\t")
}`
}`;
}
function fileSummary(f: File): string {
return `file:[${f.path}];length:${f.contentLength}`
return `file:[${f.path}];length:${f.contentLength}`;
}
function dumpFile(f: File): string {
return `${fileSummary(f)}\n[${f.content}]`
return `${fileSummary(f)}\n[${f.content}]`;
}

@@ -28,9 +43,8 @@

// TODO what if it's a directory?
let f = p.findFile(path)
const f = p.findFile(path);
if (f) {
return dumpFile(f)
return dumpFile(f);
} else {
return `What is the sound of one hand clapping: Nothing found at [${path}]`;
}
else {
return `What is the sound of one hand clapping: Nothing found at [${path}]`
}
}
}

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";

@@ -7,22 +22,25 @@ Object.defineProperty(exports, "__esModule", { value: true });

/**
* Empty project
* Empty project.
*/
Core_1.Given("an empty project", function (p) {
/* Nothing to do */
return;
});
/**
* Cloned content from GitHub
* Cloned content from GitHub.
*/
Core_1.Given("github ([^/]+)/([^/]+)", function (p, world, owner, name) {
Core_1.Given("github ([^/]+)/([^/]+)", function (p, w, owner, name) {
var repo = new ScenarioWorld_1.CloneInfo(owner, name);
var project = world.cloneRepo(repo);
world.setProject(project);
var project = w.cloneRepo(repo);
w.setProject(project);
});
Core_1.Given("github ([^/]+)/([^/]+)/([^/]+)", function (p, world, owner, name, branch) {
/**
* Cloned branch from GitHub.
*/
Core_1.Given("github ([^/]+)/([^/]+)/([^/]+)", function (p, w, owner, name, branch) {
var repo = new ScenarioWorld_1.CloneInfo(owner, name).withBranch(branch);
var project = world.cloneRepo(repo);
world.setProject(project);
var project = w.cloneRepo(repo);
w.setProject(project);
});
/**
* ArchiveRoot project
* The entire contents of the Rug archive project.
*/

@@ -33,47 +51,54 @@ Core_1.Given("the archive root", function (p) {

/**
* The contents of this archive, excluding Atomist content
* The contents of this archive, excluding Atomist content.
*/
Core_1.Given("archive non Atomist content", function (p) {
p.copyEditorBackingProject("");
p.copyEditorBackingProject();
});
/**
* Editor made changes
* Editor made changes.
*/
Core_1.Then("changes were made", function (p, world) {
return world.modificationsMade();
Core_1.Then("changes were made", function (p, w) {
return w.modificationsMade();
});
/**
* Editor made NoChange
* Editor made NoChange.
*/
Core_1.Then("no changes were made", function (p, world) {
return !world.modificationsMade();
Core_1.Then("no changes were made", function (p, w) {
return !w.modificationsMade();
});
/**
* Valid parameters
* Valid parameters.
*/
Core_1.Then("parameters were valid", function (p, world) {
return world.invalidParameters() == null;
Core_1.Then("parameters were valid", function (p, w) {
return w.invalidParameters() === null;
});
/**
* Invalid parameters
* Invalid parameters.
*/
Core_1.Then("parameters were invalid", function (p, world) {
return world.invalidParameters() != null;
Core_1.Then("parameters were invalid", function (p, w) {
return w.invalidParameters() !== null;
});
/**
* Generic file existence check.
*/
Core_1.Then("file at ([^ ]+) should exist", function (p, w, path) {
var f = p.findFile(path);
if (f == null)
throw new Error("File at [" + path + "] expected, but not found");
return p.fileExists(path);
});
Core_1.Then("file at ([^ ]+) should contain (.*)", function (p, w, path, lookFor) {
var f = p.findFile(path);
if (f == null)
throw new Error("File at [" + path + "] expected, but not found");
var idx = f.content.indexOf(lookFor);
if (idx == -1)
throw new Error("File at [" + path + "] did not contain [" + lookFor + "]. Content was\n" + f.content);
/**
* Generic file content check.
*/
Core_1.Then("file at ([^ ]+) should contain (.*)", function (p, w, path, searchString) {
return p.fileContains(path, searchString);
});
/**
* When step should fail
* When step should fail.
*/
Core_1.Then("it should fail", function (p, world) { return world.failed(); });
Core_1.Then("it should fail", function (p, w) {
w.failed();
});
/**
* The scenario was aborted due to an exception being thrown.
*/
Core_1.Then("the scenario aborted", function (p, w) {
w.aborted();
});

@@ -1,32 +0,58 @@

import { Given, When, Then } from "./Core"
import { CloneInfo } from "../ScenarioWorld"
/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Given, ProjectScenarioWorld, Then, When } from "./Core";
import { CloneInfo } from "../ScenarioWorld";
import { Project } from "../../model/Project";
// Register well-known steps
/**
* Empty project
* Empty project.
*/
Given("an empty project", p => {
/* Nothing to do */
Given("an empty project", (p: Project) => {
return;
});
/**
* Cloned content from GitHub
* Cloned content from GitHub.
*/
Given("github ([^/]+)/([^/]+)", (p, world, owner: string, name: string) => {
const repo = new CloneInfo(owner, name);
const project = world.cloneRepo(repo);
world.setProject(project);
});
Given("github ([^/]+)/([^/]+)",
(p: Project, w: ProjectScenarioWorld, owner: string, name: string) => {
const repo = new CloneInfo(owner, name);
const project = w.cloneRepo(repo);
w.setProject(project);
},
);
Given("github ([^/]+)/([^/]+)/([^/]+)", (p, world, owner: string, name: string, branch) => {
const repo = new CloneInfo(owner, name).withBranch(branch);
const project = world.cloneRepo(repo);
world.setProject(project);
});
/**
* Cloned branch from GitHub.
*/
Given("github ([^/]+)/([^/]+)/([^/]+)",
(p: Project, w: ProjectScenarioWorld, owner: string, name: string, branch: string) => {
const repo = new CloneInfo(owner, name).withBranch(branch);
const project = w.cloneRepo(repo);
w.setProject(project);
},
);
/**
* ArchiveRoot project
* The entire contents of the Rug archive project.
*/
Given("the archive root", p => {
Given("the archive root", (p: Project) => {
p.copyEditorBackingFilesPreservingPath("");

@@ -36,55 +62,64 @@ });

/**
* The contents of this archive, excluding Atomist content
* The contents of this archive, excluding Atomist content.
*/
Given("archive non Atomist content", p => {
p.copyEditorBackingProject("");
Given("archive non Atomist content", (p: Project) => {
p.copyEditorBackingProject();
});
/**
* Editor made changes
* Editor made changes.
*/
Then("changes were made", (p, world) => {
return world.modificationsMade();
Then("changes were made", (p: Project, w: ProjectScenarioWorld) => {
return w.modificationsMade();
});
/**
* Editor made NoChange
* Editor made NoChange.
*/
Then("no changes were made", (p, world) => {
return !world.modificationsMade();
Then("no changes were made", (p: Project, w: ProjectScenarioWorld) => {
return !w.modificationsMade();
});
/**
* Valid parameters
* Valid parameters.
*/
Then("parameters were valid", (p, world) => {
return world.invalidParameters() == null;
Then("parameters were valid", (p: Project, w: ProjectScenarioWorld) => {
return w.invalidParameters() === null;
});
/**
* Invalid parameters
* Invalid parameters.
*/
Then("parameters were invalid", (p, world) => {
return world.invalidParameters() != null;
Then("parameters were invalid", (p: Project, w: ProjectScenarioWorld) => {
return w.invalidParameters() !== null;
});
Then("file at ([^ ]+) should exist", (p, w, path: string) => {
const f = p.findFile(path);
if (f == null)
throw new Error(`File at [${path}] expected, but not found`);
/**
* Generic file existence check.
*/
Then("file at ([^ ]+) should exist", (p: Project, w: ProjectScenarioWorld, path: string) => {
return p.fileExists(path);
});
Then("file at ([^ ]+) should contain (.*)", (p, w, path: string, lookFor: string) => {
const f = p.findFile(path);
if (f == null)
throw new Error(`File at [${path}] expected, but not found`)
const idx = f.content.indexOf(lookFor);
if (idx == -1)
throw new Error(`File at [${path}] did not contain [${lookFor}]. Content was\n${f.content}`)
/**
* Generic file content check.
*/
Then("file at ([^ ]+) should contain (.*)",
(p: Project, w: ProjectScenarioWorld, path: string, searchString: string) => {
return p.fileContains(path, searchString);
},
);
/**
* When step should fail.
*/
Then("it should fail", (p: Project, w: ProjectScenarioWorld) => {
w.failed();
});
/**
* When step should fail
* The scenario was aborted due to an exception being thrown.
*/
Then("it should fail", (p, world) => world.failed())
Then("the scenario aborted", (p: Project, w: ProjectScenarioWorld) => {
w.aborted();
});

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";

@@ -2,0 +17,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,17 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**

@@ -6,9 +22,8 @@ * Result of executing a single test.

constructor(public result: boolean, public message: string) {}
public static Success: Result = new Result(true, "OK");
static Success: Result = new Result(true, "OK")
static Failure(why: string): Result {
return new Result(false, why)
public static Failure(why: string): Result {
return new Result(false, why);
}
}
constructor(public result: boolean, public message: string) { }
}

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";

@@ -2,0 +17,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,16 @@

/*
* Copyright © 2017 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -63,3 +78,2 @@ import { Project } from "../model/Project";

/**

@@ -78,3 +92,3 @@ * Information necessary to clone a repo

constructor(public owner: string, public name: string) {}
constructor(public owner: string, public name: string) { }

@@ -100,2 +114,2 @@ public withBranch(branch: string): CloneInfo {

}
}
}

@@ -0,9 +1,13 @@

import { HandlerContext } from "../operations/Handlers";
/**
* Returned when a PathExpression is evaluated
* Returned when a PathExpression is evaluated. Also the context for an event handler.
*/
interface Match<R extends GraphNode,N extends GraphNode> {
interface Match<R extends GraphNode,N extends GraphNode> extends HandlerContext {
root: R
root: R;
matches: N[]
matches: N[];
}

@@ -10,0 +14,0 @@

@@ -23,3 +23,6 @@ "use strict";

root: this.nodeTransform(m1.root),
matches: m1.matches.map(function (n) { return _this.nodeTransform(n); })
matches: m1.matches.map(function (n) { return _this.nodeTransform(n); }),
pathExpressionEngine: m1.pathExpressionEngine,
teamId: m1.teamId,
contextRoot: m1.contextRoot,
};

@@ -31,5 +34,3 @@ return m2;

this.delegate.with(root, expr, function (n) {
//console.log("Intercepted with")
var transformed = _this.nodeTransform(n);
//console.log(`Transformed is ${transformed}`)
f(transformed);

@@ -36,0 +37,0 @@ });

@@ -1,3 +0,4 @@

import {PathExpressionEngine,PathExpression,Match,DynamicType,GraphNode,TreeNode} from "./PathExpression"
import { PathExpressionEngine, PathExpression, Match, DynamicType, GraphNode, TreeNode } from "./PathExpression";
/**

@@ -13,4 +14,4 @@ * Convenient superclass that wraps an existing PathExpressionEngine

addType(dt: DynamicType): this {
this.delegate = this.delegate.addType(dt)
return this
this.delegate = this.delegate.addType(dt);
return this;
}

@@ -21,8 +22,11 @@

evaluate<R extends TreeNode,N extends TreeNode>(root: R, expr: PathExpression<R,N> | string): Match<R,N> {
let m1 = this.delegate.evaluate(root, expr)
let m1 = this.delegate.evaluate(root, expr);
let m2 = {
root: this.nodeTransform(m1.root) as R,
matches: m1.matches.map(n => this.nodeTransform(n)) as any
}
return m2
matches: m1.matches.map(n => this.nodeTransform(n)) as any,
pathExpressionEngine: m1.pathExpressionEngine,
teamId: m1.teamId,
contextRoot: m1.contextRoot,
};
return m2;
}

@@ -33,6 +37,4 @@

this.delegate.with(root, expr, n => {
//console.log("Intercepted with")
let transformed = this.nodeTransform(n)
//console.log(`Transformed is ${transformed}`)
f(transformed as N)
let transformed = this.nodeTransform(n);
f(transformed as N);
})

@@ -42,7 +44,7 @@ }

scalar<R extends TreeNode,N extends TreeNode>(root: R, expr: PathExpression<R,N> | string): N {
return this.nodeTransform(this.delegate.scalar<R,N>(root, expr)) as N
return this.nodeTransform(this.delegate.scalar<R,N>(root, expr)) as N;
}
as<N extends TreeNode>(root, name: string): N {
return this.nodeTransform(this.delegate.as<N>(root, name)) as N
return this.nodeTransform(this.delegate.as<N>(root, name)) as N;
}

@@ -53,3 +55,3 @@

return this.delegate.children<N>(root, name)
.map(n => this.nodeTransform(n) as N)
.map(n => this.nodeTransform(n) as N);
}

@@ -63,5 +65,5 @@

f: (n: N) => void): void {
this.with(root, pe.expression, f)
this.with(root, pe.expression, f);
}
}
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