move to be a general Analytics tool
This commit is contained in:
parent
77bd098ee7
commit
97de52456e
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1 +1 @@
|
||||
export { AnalyticsAccount } from './smartanalytics.classes.analyticsaccount';
|
||||
export { Analytics } from './smartanalytics.classes.analytics';
|
||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var smartanalytics_classes_analyticsaccount_1 = require("./smartanalytics.classes.analyticsaccount");
|
||||
exports.AnalyticsAccount = smartanalytics_classes_analyticsaccount_1.AnalyticsAccount;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFHQUE0RTtBQUFuRSxxRUFBQSxnQkFBZ0IsQ0FBQSJ9
|
||||
var smartanalytics_classes_analytics_1 = require("./smartanalytics.classes.analytics");
|
||||
exports.Analytics = smartanalytics_classes_analytics_1.Analytics;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVGQUE4RDtBQUFyRCx1REFBQSxTQUFTLENBQUEifQ==
|
13
dist/smartanalytics.classes.analytics.d.ts
vendored
Normal file
13
dist/smartanalytics.classes.analytics.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
export declare class Analytics {
|
||||
project: string;
|
||||
appName: string;
|
||||
apiEndPoint: string;
|
||||
secretKey: string;
|
||||
constructor(optionsArg: {
|
||||
projectArg: string;
|
||||
appNameArg: string;
|
||||
apiEndPointArg: string;
|
||||
secretKeyArg?: string;
|
||||
});
|
||||
recordEvent(identifierArg: string, analyticsDataArg: any): Promise<void>;
|
||||
}
|
41
dist/smartanalytics.classes.analytics.js
vendored
Normal file
41
dist/smartanalytics.classes.analytics.js
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smartanalytics.plugins");
|
||||
class Analytics {
|
||||
constructor(optionsArg) {
|
||||
this.secretKey = '';
|
||||
this.project = optionsArg.projectArg;
|
||||
this.appName = optionsArg.appNameArg;
|
||||
this.apiEndPoint = optionsArg.apiEndPointArg;
|
||||
if (optionsArg.secretKeyArg) {
|
||||
this.secretKey = optionsArg.secretKeyArg;
|
||||
}
|
||||
}
|
||||
recordEvent(identifierArg, analyticsDataArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let dataToSend = {
|
||||
project: this.project,
|
||||
appName: this.appName,
|
||||
identifier: identifierArg,
|
||||
analyticsData: analyticsDataArg
|
||||
};
|
||||
let dataToSendJson = JSON.stringify(dataToSend);
|
||||
yield plugins.smartrequest.post(this.apiEndPoint, {
|
||||
headers: {
|
||||
'authenticate': this.secretKey
|
||||
},
|
||||
requestBody: dataToSendJson
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Analytics = Analytics;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xh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NELFdBQVcsRUFBRSxjQUFjO2FBQzVCLENBQUMsQ0FBQTtRQUNKLENBQUM7S0FBQTtDQUNGO0FBbENELDhCQWtDQyJ9
|
@ -1,6 +0,0 @@
|
||||
export declare class AnalyticsAccount {
|
||||
appName: string;
|
||||
trackingId: string;
|
||||
constructor(appNameArg: string, trackingIdArg: string);
|
||||
sendEvent(eventCategoryArg: any, eventActionArg: any, eventLabelArg: string): void;
|
||||
}
|
14
dist/smartanalytics.classes.analyticsaccount.js
vendored
14
dist/smartanalytics.classes.analyticsaccount.js
vendored
@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const send = require("./smartanalytics.send");
|
||||
class AnalyticsAccount {
|
||||
constructor(appNameArg, trackingIdArg) {
|
||||
this.appName = appNameArg;
|
||||
this.trackingId = trackingIdArg;
|
||||
}
|
||||
sendEvent(eventCategoryArg, eventActionArg, eventLabelArg) {
|
||||
send.event(this.trackingId, this.appName, eventCategoryArg, eventActionArg, eventLabelArg);
|
||||
}
|
||||
}
|
||||
exports.AnalyticsAccount = AnalyticsAccount;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3NhY2NvdW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3NhY2NvdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsOENBQTZDO0FBRTdDO0lBR0UsWUFBWSxVQUFrQixFQUFFLGFBQXFCO1FBQ25ELElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFBO1FBQ3pCLElBQUksQ0FBQyxVQUFVLEdBQUcsYUFBYSxDQUFBO0lBQ2pDLENBQUM7SUFFRCxTQUFTLENBQUUsZ0JBQWdCLEVBQUUsY0FBYyxFQUFFLGFBQXFCO1FBQ2hFLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLGNBQWMsRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM1RixDQUFDO0NBQ0Y7QUFYRCw0Q0FXQyJ9
|
1
dist/smartanalytics.send.d.ts
vendored
1
dist/smartanalytics.send.d.ts
vendored
@ -1 +0,0 @@
|
||||
export declare let event: (trackingIdArg: string, appNameArg: string, eventCategoryArg: string, eventActionArg: any, eventLabelArg?: string) => void;
|
30
dist/smartanalytics.send.js
vendored
30
dist/smartanalytics.send.js
vendored
@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smartanalytics.plugins");
|
||||
exports.event = (trackingIdArg, appNameArg, eventCategoryArg, eventActionArg, eventLabelArg = 'null') => {
|
||||
let payload = 'v=1' +
|
||||
`&tid=${trackingIdArg}` +
|
||||
'&cid=555' +
|
||||
'&aip=1' +
|
||||
'&t=event' +
|
||||
`&ec=${eventCategoryArg}` +
|
||||
`&ea=${eventActionArg}` +
|
||||
`&el=${eventLabelArg}` +
|
||||
'&ev=300' +
|
||||
`&an=${appNameArg}`;
|
||||
send(payload);
|
||||
};
|
||||
let send = (requestBodyArg) => __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.smartrequest.post('https://www.google-analytics.com/collect', {
|
||||
requestBody: requestBodyArg
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3Muc2VuZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0YW5hbHl0aWNzLnNlbmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLG9EQUFtRDtBQUV4QyxRQUFBLEtBQUssR0FBRyxDQUFDLGFBQXFCLEVBQUUsVUFBa0IsRUFBRSxnQkFBd0IsRUFBRSxjQUFjLEVBQUUsZ0JBQXdCLE1BQU07SUFDckksSUFBSSxPQUFPLEdBQVcsS0FBSztRQUN6QixRQUFRLGFBQWEsRUFBRTtRQUN2QixVQUFVO1FBQ1YsUUFBUTtRQUNSLFVBQVU7UUFDVixPQUFPLGdCQUFnQixFQUFFO1FBQ3pCLE9BQU8sY0FBYyxFQUFFO1FBQ3ZCLE9BQU8sYUFBYSxFQUFFO1FBQ3RCLFNBQVM7UUFDVCxPQUFPLFVBQVUsRUFBRSxDQUFBO0lBQ3JCLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtBQUNmLENBQUMsQ0FBQTtBQUdELElBQUksSUFBSSxHQUFHLENBQU8sY0FBc0I7SUFDdEMsTUFBTSxPQUFPLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQywwQ0FBMEMsRUFBRTtRQUMxRSxXQUFXLEVBQUUsY0FBYztLQUM1QixDQUFDLENBQUE7QUFDSixDQUFDLENBQUEsQ0FBQSJ9
|
@ -15,7 +15,6 @@
|
||||
"typings-global": "^1.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"smartchai": "^1.0.3",
|
||||
"typings-test": "^1.0.3"
|
||||
"tapbundle": "^1.1.1"
|
||||
}
|
||||
}
|
||||
|
31
test/test.js
31
test/test.js
@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
require("typings-test");
|
||||
const smartanalytics = require("../dist/index");
|
||||
let testAccount;
|
||||
describe('smartanalytics', function () {
|
||||
it('should create a valid AnalyticsAccount', function () {
|
||||
testAccount = new smartanalytics.AnalyticsAccount('smartanalytics', 'UA-92592300-1');
|
||||
});
|
||||
it('should send a request to Google Analytics', function () {
|
||||
let doit = () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq');
|
||||
yield testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics');
|
||||
yield testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq');
|
||||
yield testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics');
|
||||
yield testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq');
|
||||
yield testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics');
|
||||
yield testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq');
|
||||
yield testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics');
|
||||
});
|
||||
doit();
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsd0JBQXFCO0FBSXJCLGdEQUErQztBQUUvQyxJ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BQUE7UUFDRCxJQUFJLEVBQUUsQ0FBQTtJQUNSLENBQUMsQ0FBQyxDQUFBO0FBQ0osQ0FBQyxDQUFDLENBQUEifQ==
|
36
test/test.ts
36
test/test.ts
@ -1,27 +1,27 @@
|
||||
import 'typings-test'
|
||||
import { expect, tap } from 'tapbundle'
|
||||
|
||||
import { expect } from 'smartchai'
|
||||
import * as smartanalytics from '../ts/index'
|
||||
|
||||
import * as smartanalytics from '../dist/index'
|
||||
let testAnalytics: smartanalytics.Analytics
|
||||
|
||||
let testAccount: smartanalytics.AnalyticsAccount
|
||||
|
||||
describe('smartanalytics', function () {
|
||||
it('should create a valid AnalyticsAccount', function () {
|
||||
testAccount = new smartanalytics.AnalyticsAccount('smartanalytics', 'UA-92592300-1')
|
||||
tap.test('should create a valid AnalyticsAccount', async () => {
|
||||
testAnalytics = new smartanalytics.Analytics({
|
||||
projectArg: 'pushrocks',
|
||||
appNameArg: 'smartanalytics',
|
||||
apiEndPointArg: 'pubapi-1.herokuapp.com/analytics'
|
||||
})
|
||||
})
|
||||
|
||||
it('should send a request to Google Analytics', function () {
|
||||
tap.test('should send a request to Google Analytics', async () => {
|
||||
let doit = async () => {
|
||||
await testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq')
|
||||
await testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics')
|
||||
await testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq')
|
||||
await testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics')
|
||||
await testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq')
|
||||
await testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics')
|
||||
await testAccount.sendEvent('npmtool', 'install', 'pushrocks/smartq')
|
||||
await testAccount.sendEvent('npmtool', 'started', 'pushrocks/smartanalytics')
|
||||
await testAnalytics.recordEvent('npmtool', {
|
||||
smoeValue: 'someData'
|
||||
})
|
||||
await testAnalytics.recordEvent('anotherTool', {
|
||||
someValue: 'someData'
|
||||
})
|
||||
}
|
||||
doit()
|
||||
})
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
@ -1 +1 @@
|
||||
export { AnalyticsAccount } from './smartanalytics.classes.analyticsaccount'
|
||||
export { Analytics } from './smartanalytics.classes.analytics'
|
||||
|
37
ts/smartanalytics.classes.analytics.ts
Normal file
37
ts/smartanalytics.classes.analytics.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import * as plugins from './smartanalytics.plugins'
|
||||
|
||||
export class Analytics {
|
||||
project: string
|
||||
appName: string
|
||||
apiEndPoint: string
|
||||
secretKey: string = ''
|
||||
constructor (optionsArg: {
|
||||
projectArg: string
|
||||
appNameArg: string
|
||||
apiEndPointArg: string
|
||||
secretKeyArg?: string
|
||||
}) {
|
||||
this.project = optionsArg.projectArg
|
||||
this.appName = optionsArg.appNameArg
|
||||
this.apiEndPoint = optionsArg.apiEndPointArg
|
||||
if (optionsArg.secretKeyArg) {
|
||||
this.secretKey = optionsArg.secretKeyArg
|
||||
}
|
||||
}
|
||||
|
||||
async recordEvent (identifierArg: string, analyticsDataArg: any) {
|
||||
let dataToSend = {
|
||||
project: this.project,
|
||||
appName: this.appName,
|
||||
identifier: identifierArg,
|
||||
analyticsData: analyticsDataArg
|
||||
}
|
||||
let dataToSendJson = JSON.stringify(dataToSend)
|
||||
await plugins.smartrequest.post(this.apiEndPoint, {
|
||||
headers: {
|
||||
'authenticate': this.secretKey
|
||||
},
|
||||
requestBody: dataToSendJson
|
||||
})
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import * as plugins from './smartanalytics.plugins'
|
||||
import * as send from './smartanalytics.send'
|
||||
|
||||
export class AnalyticsAccount {
|
||||
appName: string
|
||||
trackingId: string
|
||||
constructor(appNameArg: string, trackingIdArg: string) {
|
||||
this.appName = appNameArg
|
||||
this.trackingId = trackingIdArg
|
||||
}
|
||||
|
||||
sendEvent (eventCategoryArg, eventActionArg, eventLabelArg: string) {
|
||||
send.event(this.trackingId, this.appName, eventCategoryArg, eventActionArg, eventLabelArg)
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
import * as plugins from './smartanalytics.plugins'
|
||||
|
||||
export let event = (trackingIdArg: string, appNameArg: string, eventCategoryArg: string, eventActionArg, eventLabelArg: string = 'null') => {
|
||||
let payload: string = 'v=1' +
|
||||
`&tid=${trackingIdArg}` + // the tracking ID
|
||||
'&cid=555' +
|
||||
'&aip=1' + // anonymize the IP
|
||||
'&t=event' +
|
||||
`&ec=${eventCategoryArg}` + // event category
|
||||
`&ea=${eventActionArg}` + // event action
|
||||
`&el=${eventLabelArg}` + // event label
|
||||
'&ev=300' +
|
||||
`&an=${appNameArg}`
|
||||
send(payload)
|
||||
}
|
||||
|
||||
|
||||
let send = async (requestBodyArg: string) => {
|
||||
await plugins.smartrequest.post('https://www.google-analytics.com/collect', {
|
||||
requestBody: requestBodyArg
|
||||
})
|
||||
}
|
229
yarn.lock
229
yarn.lock
@ -19,14 +19,40 @@
|
||||
version "3.4.35"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900"
|
||||
|
||||
"@types/mocha@^2.2.31":
|
||||
version "2.2.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829"
|
||||
"@types/glob@*":
|
||||
version "5.0.32"
|
||||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.32.tgz#aec5cfe987c72f099fdb1184452986aa506d5e8f"
|
||||
dependencies:
|
||||
"@types/minimatch" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/minimatch@*":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550"
|
||||
|
||||
"@types/node@*":
|
||||
version "8.0.24"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1"
|
||||
|
||||
"@types/promises-a-plus@*":
|
||||
version "0.0.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||
|
||||
"@types/shelljs@^0.7.2":
|
||||
version "0.7.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
|
||||
dependencies:
|
||||
"@types/glob" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/which@^1.0.28":
|
||||
version "1.0.28"
|
||||
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
|
||||
|
||||
ansi-256-colors@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
||||
|
||||
assertion-error@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||
@ -35,6 +61,17 @@ balanced-match@^0.4.1:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
||||
|
||||
beautycolor@^1.0.7:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
|
||||
dependencies:
|
||||
ansi-256-colors "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
bindings@^1.2.1:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
|
||||
|
||||
brace-expansion@^1.0.0:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
||||
@ -74,10 +111,55 @@ deep-eql@^0.1.3:
|
||||
dependencies:
|
||||
type-detect "0.1.1"
|
||||
|
||||
define-properties@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
|
||||
dependencies:
|
||||
foreach "^2.0.5"
|
||||
object-keys "^1.0.8"
|
||||
|
||||
early@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
||||
dependencies:
|
||||
beautycolor "^1.0.7"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
es-abstract@^1.5.1:
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.0.tgz#3b00385e85729932beffa9163bbea1234e932914"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.0"
|
||||
has "^1.0.1"
|
||||
is-callable "^1.1.3"
|
||||
is-regex "^1.0.4"
|
||||
|
||||
es-to-primitive@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
|
||||
dependencies:
|
||||
is-callable "^1.1.1"
|
||||
is-date-object "^1.0.1"
|
||||
is-symbol "^1.0.1"
|
||||
|
||||
es6-error@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
|
||||
|
||||
foreach@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
|
||||
function-bind@^1.0.2, function-bind@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
|
||||
|
||||
glob@^7.0.0:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
||||
@ -89,6 +171,12 @@ glob@^7.0.0:
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
has@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
||||
dependencies:
|
||||
function-bind "^1.0.2"
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
@ -104,12 +192,74 @@ interpret@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
||||
|
||||
is-callable@^1.1.1, is-callable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
||||
|
||||
is-date-object@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
|
||||
|
||||
is-regex@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||
dependencies:
|
||||
has "^1.0.1"
|
||||
|
||||
is-symbol@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
|
||||
leakage@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
||||
dependencies:
|
||||
es6-error "^4.0.2"
|
||||
left-pad "^1.1.3"
|
||||
memwatch-next "^0.3.0"
|
||||
minimist "^1.2.0"
|
||||
pretty-bytes "^4.0.2"
|
||||
|
||||
left-pad@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
||||
|
||||
memwatch-next@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
||||
dependencies:
|
||||
bindings "^1.2.1"
|
||||
nan "^2.3.2"
|
||||
|
||||
minimatch@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||
dependencies:
|
||||
brace-expansion "^1.0.0"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
|
||||
nan@^2.3.2:
|
||||
version "2.6.2"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
||||
|
||||
object-keys@^1.0.8:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
||||
|
||||
object.getownpropertydescriptors@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.5.1"
|
||||
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
@ -120,6 +270,10 @@ path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
|
||||
pretty-bytes@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||
|
||||
rechoir@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||
@ -142,6 +296,14 @@ shelljs@^0.7.4:
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
shelljs@^0.7.8:
|
||||
version "0.7.8"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
||||
@ -153,6 +315,13 @@ smartchai@^1.0.3:
|
||||
chai-as-promised "^6.0.0"
|
||||
chai-string "^1.3.0"
|
||||
|
||||
smartdelay@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
|
||||
dependencies:
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
smartq@^1.1.0, smartq@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
||||
@ -160,6 +329,13 @@ smartq@^1.1.0, smartq@^1.1.1:
|
||||
typed-promisify "^0.3.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
smartq@^1.1.6:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
|
||||
dependencies:
|
||||
typings-global "^1.0.19"
|
||||
util.promisify "^1.0.0"
|
||||
|
||||
smartrequest@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.4.tgz#86af2163ae28f1031b01c2d8ad8c429733920611"
|
||||
@ -167,6 +343,28 @@ smartrequest@^1.0.4:
|
||||
smartq "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
smartshell@^1.0.6:
|
||||
version "1.0.13"
|
||||
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.13.tgz#277b34e6624df70003e0e3a6c900cd5ebab7eb92"
|
||||
dependencies:
|
||||
"@types/shelljs" "^0.7.2"
|
||||
"@types/which" "^1.0.28"
|
||||
shelljs "^0.7.8"
|
||||
smartq "^1.1.6"
|
||||
typings-global "^1.0.19"
|
||||
which "^1.2.14"
|
||||
|
||||
tapbundle@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.1.tgz#ec4172c0e82a77b1f6133fef2606311ede28a62d"
|
||||
dependencies:
|
||||
early "^2.1.1"
|
||||
leakage "^0.3.0"
|
||||
smartchai "^1.0.3"
|
||||
smartdelay "^1.0.3"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.19"
|
||||
|
||||
type-detect@0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
||||
@ -179,19 +377,32 @@ typed-promisify@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||
|
||||
typings-global@*, typings-global@^1.0.14:
|
||||
typings-global@^1.0.14:
|
||||
version "1.0.14"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.4"
|
||||
|
||||
typings-test@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
||||
typings-global@^1.0.16, typings-global@^1.0.19:
|
||||
version "1.0.20"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.20.tgz#3da769c54db538247c5d877d1d9e97eb2ec981ff"
|
||||
dependencies:
|
||||
"@types/mocha" "^2.2.31"
|
||||
typings-global "*"
|
||||
semver "^5.3.0"
|
||||
smartshell "^1.0.6"
|
||||
|
||||
util.promisify@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
object.getownpropertydescriptors "^2.0.3"
|
||||
|
||||
which@^1.2.14:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
|
Loading…
Reference in New Issue
Block a user