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

buildkite-graph

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buildkite-graph - npm Package Compare versions

Comparing version

to
5.6.0

10

dist/index.d.ts
import { Step } from './base';
import { Conditional } from './conditional';
import { KeyValue } from './key_value';
import { MutatorFn } from './serializers';
import { DotSerializer } from './serializers/dot';

@@ -19,2 +20,3 @@ import { JsonSerializer } from './serializers/json';

export { TriggerStep } from './steps/trigger';
export { MutatorFn } from './serializers';
export declare const serializers: {

@@ -32,2 +34,10 @@ DotSerializer: typeof DotSerializer;

explicitDependencies?: boolean;
/**
* Allows passing in a method that will be called on every Step in a topological sorted list of steps
* This mutator can mutate anything in a Step except things that can change the structural integrity of the DAG.
* i.e. the mutator must not mutate anything in Step dependencies or effective dependencies, and also must be
* mutated in place.
* Example: examples/mutate_graph.ts
*/
mutator?: MutatorFn;
};

@@ -34,0 +44,0 @@ export declare type ToJsonSerializationOptions = {

26

dist/index.js

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

const slugify_1 = __importDefault(require("@sindresorhus/slugify"));
const base_1 = require("./base");
const key_value_1 = require("./key_value");

@@ -17,4 +18,6 @@ const dot_1 = require("./serializers/dot");

const wait_1 = require("./steps/wait");
var base_1 = require("./base");
Object.defineProperty(exports, "Step", { enumerable: true, get: function () { return base_1.Step; } });
const lodash_1 = require("lodash");
const assert_1 = require("assert");
var base_2 = require("./base");
Object.defineProperty(exports, "Step", { enumerable: true, get: function () { return base_2.Step; } });
var conditional_1 = require("./conditional");

@@ -101,5 +104,22 @@ Object.defineProperty(exports, "Conditional", { enumerable: true, get: function () { return conditional_1.Conditional; } });

};
const steps = await this.toList(newOpts);
if (opts.mutator) {
for (const step of steps) {
if (!(step instanceof base_1.Step)) {
continue;
}
const deps = {
dependencies: new Set(step.dependencies),
effectDependencies: new Set(step.effectDependencies),
};
await opts.mutator(step);
assert_1.ok(lodash_1.isEqual(deps, {
dependencies: step.dependencies,
effectDependencies: step.effectDependencies,
}), 'mutator must not mutate dependencies or effects');
}
}
return {
env: await this.env.toJson(),
steps: await Promise.all((await this.toList(newOpts)).map((s) => s.toJson(newOpts))),
steps: await Promise.all(steps.map((s) => s.toJson(newOpts))),
};

@@ -106,0 +126,0 @@ }

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

import { Pipeline } from '../';
import { Pipeline, Step } from '../';
/**
* Step mutator callback signature; This function is called for every `Step` in a topologically sorted `Pipeline` when being passed to supporting serializers.
*
* @param entity the `Step` to be muted. Mutations must happen in-place (it is not possible to replace the `Step` as a whole and dependencies and effects must not be altered.
*/
export declare type MutatorFn = (entity: Step) => Promise<void>;
export interface Serializer<T> {
serialize(e: Pipeline): Promise<T>;
}

4

package.json
{
"name": "buildkite-graph",
"version": "5.5.0",
"version": "5.6.0",
"main": "dist/index.js",

@@ -18,2 +18,3 @@ "typings": "dist/index.d.ts",

"@types/node": "^15.12.5",
"@types/seedrandom": "^3.0.1",
"@types/uniqid": "^5.3.0",

@@ -30,2 +31,3 @@ "@typescript-eslint/eslint-plugin": "^4.28.1",

"rimraf": "^3.0.2",
"seedrandom": "^3.0.5",
"semantic-release": "^17.4.4",

@@ -32,0 +34,0 @@ "ts-jest": "^27.0.3",