New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@itly/plugin-testing

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itly/plugin-testing - npm Package Compare versions

Comparing version
2.0.1
to
2.0.2
+17
-0
CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

## [2.0.2](https://github.com/iterativelyhq/itly-sdk/compare/v2.0.1...v2.0.2) (2021-02-26)
### Bug Fixes
* added explicit "files" to package.json files ([3ca0c55](https://github.com/iterativelyhq/itly-sdk/commit/3ca0c55b828c66244a26738571aae5dca31425cf))
* added typed ItlyBrowser and ItlyNode ([77bee56](https://github.com/iterativelyhq/itly-sdk/commit/77bee562676845445e0aa63675990a6c003a3d92))
### Features
* added ESM support ([c265689](https://github.com/iterativelyhq/itly-sdk/commit/c2656892daddb36459e2a061b553890e616d04c2))
## [2.0.1](https://github.com/iterativelyhq/itly-sdk/compare/v2.0.0...v2.0.1) (2021-02-02)

@@ -8,0 +25,0 @@

+14
-6
{
"name": "@itly/plugin-testing",
"version": "2.0.1",
"version": "2.0.2",
"description": "Testing Plugin for Iteratively SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"module": "dist/esm/index.js",
"scripts": {
"prepublish": "yarn run build",
"build": "tsc",
"build": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
"test": "jest --runInBand"
},
"files": [
"LICENSE",
"CHANGELOG.md",
"README.md",
"dist/",
"package.json"
],
"keywords": [

@@ -21,3 +29,3 @@ "itly",

"devDependencies": {
"@itly/sdk": "2.0.1",
"@itly/sdk": "2.0.2",
"@types/jest": "^26.0.0",

@@ -31,3 +39,3 @@ "jest": "^26.0.1",

},
"gitHead": "dc04e7e3df3d04d796c7c2e7deb3d7afc76a4952"
"gitHead": "9e6ff0fbf0d414b97ef9f4552d8c3c00b2f8c0bd"
}
import { Plugin, Event as TrackingEvent } from '@itly/sdk';
export interface ITestingPlugin {
reset(): void;
all(userId?: string): TrackingEvent[];
ofType(ev: TrackingEvent, userId?: string): TrackingEvent[];
firstOfType(ev: TrackingEvent, userId?: string): TrackingEvent;
}
/**
* Testing Plugin for Iteratively SDK
*/
export declare class TestingPlugin extends Plugin implements ITestingPlugin {
private calls;
private readonly trackingMethods;
constructor();
reset(): void;
all(userId?: string): any[];
ofType(ctor: Function, userId?: string): TrackingEvent[];
firstOfType(ctor: Function, userId?: string): any;
alias(...args: any[]): void;
identify(...args: any[]): void;
group(...args: any[]): void;
page(...args: any[]): void;
track(...args: any[]): void;
private init;
private trackCall;
private safelyGetCalls;
private mapMethodArgs;
}
export default TestingPlugin;
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestingPlugin = void 0;
/* eslint-disable no-unused-vars, class-methods-use-this */
var sdk_1 = require("@itly/sdk");
/**
* Testing Plugin for Iteratively SDK
*/
var TestingPlugin = /** @class */ (function (_super) {
__extends(TestingPlugin, _super);
function TestingPlugin() {
var _this = _super.call(this, 'testing') || this;
_this.calls = new Map();
_this.trackingMethods = ['alias', 'identify', 'group', 'page', 'track'];
_this.init();
return _this;
}
TestingPlugin.prototype.reset = function () {
this.init();
};
TestingPlugin.prototype.all = function (userId) {
var calls = this.safelyGetCalls('track');
if (userId) {
return calls.reduce(function (acc, _a) {
var id = _a[0], ev = _a[1];
if (userId === id) {
return acc.concat(ev);
}
return acc;
}, []);
}
return calls.map(this.mapMethodArgs);
};
TestingPlugin.prototype.ofType = function (ctor, userId) {
return this.safelyGetCalls('track')
.filter(function (_a) {
var id = _a[0], ev = _a[1];
return ev instanceof ctor && (!userId || userId === id);
})
.map(function (_a) {
var ev = _a[1];
return ev;
});
};
TestingPlugin.prototype.firstOfType = function (ctor, userId) {
var tuple = this.safelyGetCalls('track').find(function (_a) {
var id = _a[0], ev = _a[1];
return ev instanceof ctor && (!userId || userId === id);
});
return tuple ? this.mapMethodArgs(tuple) : null;
};
TestingPlugin.prototype.alias = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.trackCall('alias', args);
};
TestingPlugin.prototype.identify = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.trackCall('identify', args);
};
TestingPlugin.prototype.group = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.trackCall('group', args);
};
TestingPlugin.prototype.page = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.trackCall('page', args);
};
TestingPlugin.prototype.track = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.trackCall('track', args);
};
TestingPlugin.prototype.init = function () {
var _this = this;
this.trackingMethods.forEach(function (methodName) {
_this.calls.set(methodName, []);
});
};
TestingPlugin.prototype.trackCall = function (methodName, args) {
this.safelyGetCalls(methodName).push(args);
};
TestingPlugin.prototype.safelyGetCalls = function (prop) {
return this.calls.get(prop) || [];
};
TestingPlugin.prototype.mapMethodArgs = function (_a) {
var id = _a[0], ev = _a[1];
return ev;
};
return TestingPlugin;
}(sdk_1.Plugin));
exports.TestingPlugin = TestingPlugin;
exports.default = TestingPlugin;
const base = require('../../jest.config.base.js');
const packageJson = require('./package.json');
module.exports = {
...base,
name: packageJson.name,
displayName: packageJson.name,
};