debugbear
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -6,10 +6,19 @@ import { analyzePage } from "./analyzePage"; | ||
let pollIntervalAdjustmentFactor = 1; | ||
export class DebugBear { | ||
pages: PagesApiClient; | ||
// projects: ProjectsApiClient; | ||
// collaborators: CollaboratorsApiClient; | ||
projects: ProjectsApiClient; | ||
collaborators: CollaboratorsApiClient; | ||
constructor(apiKey: string) { | ||
if ( | ||
typeof arguments[1] === "object" && | ||
arguments[1].pollIntervalAdjustmentFactorForTest | ||
) { | ||
pollIntervalAdjustmentFactor = | ||
arguments[1].pollIntervalAdjustmentFactorForTest; | ||
} | ||
this.pages = new PagesApiClient(apiKey); | ||
// this.projects = new ProjectsApiClient(apiKey); | ||
// this.collaborators = new CollaboratorsApiClient(apiKey); | ||
this.projects = new ProjectsApiClient(apiKey); | ||
this.collaborators = new CollaboratorsApiClient(apiKey); | ||
} | ||
@@ -21,3 +30,3 @@ } | ||
let timeWaited = 0; | ||
const interval = 4000; | ||
const interval = 4000 * pollIntervalAdjustmentFactor; | ||
@@ -104,7 +113,4 @@ let resp; | ||
buildTitle?: string; | ||
loginStepOverrides?: { | ||
password?: string; | ||
username?: string; | ||
}; | ||
customHeaders?: { [key: string]: string }; | ||
userFlowReplacements?: { [key: string]: string }; | ||
inferBuildInfo?: boolean; | ||
@@ -111,0 +117,0 @@ ngrokWebPort?: boolean; |
export declare class DebugBear { | ||
pages: PagesApiClient; | ||
projects: ProjectsApiClient; | ||
collaborators: CollaboratorsApiClient; | ||
constructor(apiKey: string); | ||
} | ||
declare class ProjectsApiClient { | ||
private apiKey; | ||
constructor(apiKey: string); | ||
get(): Promise<any>; | ||
create({ name }: { | ||
name: any; | ||
}): Promise<any>; | ||
} | ||
declare class CollaboratorsApiClient { | ||
private apiKey; | ||
constructor(apiKey: string); | ||
create(projectId: any, { email }: { | ||
email: string; | ||
}): Promise<any>; | ||
get(projectId: any): Promise<any>; | ||
} | ||
declare class PagesApiClient { | ||
@@ -19,9 +37,8 @@ private apiKey; | ||
buildTitle?: string; | ||
loginStepOverrides?: { | ||
password?: string; | ||
username?: string; | ||
}; | ||
customHeaders?: { | ||
[key: string]: string; | ||
}; | ||
userFlowReplacements?: { | ||
[key: string]: string; | ||
}; | ||
inferBuildInfo?: boolean; | ||
@@ -28,0 +45,0 @@ ngrokWebPort?: boolean; |
@@ -41,9 +41,13 @@ "use strict"; | ||
var getNgrokTunnelPublicUrl_1 = require("./getNgrokTunnelPublicUrl"); | ||
var pollIntervalAdjustmentFactor = 1; | ||
var DebugBear = /** @class */ (function () { | ||
// projects: ProjectsApiClient; | ||
// collaborators: CollaboratorsApiClient; | ||
function DebugBear(apiKey) { | ||
if (typeof arguments[1] === "object" && | ||
arguments[1].pollIntervalAdjustmentFactorForTest) { | ||
pollIntervalAdjustmentFactor = | ||
arguments[1].pollIntervalAdjustmentFactorForTest; | ||
} | ||
this.pages = new PagesApiClient(apiKey); | ||
// this.projects = new ProjectsApiClient(apiKey); | ||
// this.collaborators = new CollaboratorsApiClient(apiKey); | ||
this.projects = new ProjectsApiClient(apiKey); | ||
this.collaborators = new CollaboratorsApiClient(apiKey); | ||
} | ||
@@ -61,3 +65,3 @@ return DebugBear; | ||
timeWaited = 0; | ||
interval = 4000; | ||
interval = 4000 * pollIntervalAdjustmentFactor; | ||
_a.label = 1; | ||
@@ -64,0 +68,0 @@ case 1: |
@@ -62,4 +62,4 @@ "use strict"; | ||
.option("--buildTitle <buildTitle>", "title of the build, e.g. a commit message") | ||
.option("--loginStep.username <loginStep.username>") | ||
.option("--loginStep.password <loginStep.password>") | ||
// .option("--loginStep.username <loginStep.username>") | ||
// .option("--loginStep.password <loginStep.password>") | ||
.option("--customHeader <customHeader>", "custom header, name and value separated by a colon", function collect(value, previous) { | ||
@@ -73,2 +73,10 @@ var _a; | ||
}) | ||
.option("--userFlowReplacement <replacement>", "string to be replaced in user flow, name and value separated by a colon", function collect(value, previous) { | ||
var _a; | ||
var parts = value.split(":"); | ||
if (parts.length !== 2) { | ||
throw Error("User flow replacement needs to have two parts separated by a colon"); | ||
} | ||
return Object.assign(previous || {}, (_a = {}, _a[parts[0]] = parts[1], _a)); | ||
}) | ||
.action(function (url) { | ||
@@ -118,3 +126,4 @@ urlValue = url; | ||
}, { | ||
customHeaders: program.customHeader | ||
customHeaders: program.customHeader, | ||
userFlowReplacements: program.userFlowReplacement | ||
}, lodash_1.pick(program, [ | ||
@@ -121,0 +130,0 @@ "pageId", |
{ | ||
"name": "debugbear", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "API/CLI for DebugBearAnalyze pages with DebugBear. Analyze pages on demand on demand or as part of your Continuous Integration process.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,4 +29,4 @@ import * as commander from "commander"; | ||
) | ||
.option("--loginStep.username <loginStep.username>") | ||
.option("--loginStep.password <loginStep.password>") | ||
// .option("--loginStep.username <loginStep.username>") | ||
// .option("--loginStep.password <loginStep.password>") | ||
.option( | ||
@@ -45,2 +45,15 @@ "--customHeader <customHeader>", | ||
) | ||
.option( | ||
"--userFlowReplacement <replacement>", | ||
"string to be replaced in user flow, name and value separated by a colon", | ||
function collect(value, previous) { | ||
const parts = value.split(":"); | ||
if (parts.length !== 2) { | ||
throw Error( | ||
"User flow replacement needs to have two parts separated by a colon" | ||
); | ||
} | ||
return Object.assign(previous || {}, { [parts[0]]: parts[1] }); | ||
} | ||
) | ||
.action(function(url) { | ||
@@ -96,3 +109,4 @@ urlValue = url; | ||
{ | ||
customHeaders: program.customHeader | ||
customHeaders: program.customHeader, | ||
userFlowReplacements: program.userFlowReplacement | ||
}, | ||
@@ -99,0 +113,0 @@ pick(program, [ |
55980
31
1357