@readme/httpsnippet 7.1.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +24 -25
- package/dist/{chunk-DTZD7L6R.mjs → chunk-IAWYVBVW.js} +78 -61
- package/dist/chunk-IAWYVBVW.js.map +1 -0
- package/dist/{chunk-BCCGHMCJ.mjs → chunk-KT7MO6Z4.js} +1 -1
- package/dist/{chunk-UEOS42PC.mjs → chunk-Y7NI4MMY.js} +1 -1
- package/dist/helpers/code-builder.cjs +65 -0
- package/dist/helpers/code-builder.cjs.map +1 -0
- package/dist/helpers/code-builder.js +1 -63
- package/dist/helpers/code-builder.js.map +1 -1
- package/dist/helpers/reducer.cjs +20 -0
- package/dist/helpers/reducer.cjs.map +1 -0
- package/dist/helpers/reducer.js +1 -18
- package/dist/helpers/reducer.js.map +1 -1
- package/dist/{index-c415b193.d.ts → index-babe3117.d.ts} +10 -6
- package/dist/{index-ae5e535e.d.ts → index-c8003aae.d.ts} +11 -7
- package/dist/index.cjs +3745 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.mts → index.d.cts} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +179 -3767
- package/dist/index.js.map +1 -1
- package/dist/targets/index.cjs +3512 -0
- package/dist/targets/index.cjs.map +1 -0
- package/dist/targets/{index.d.mts → index.d.cts} +3 -3
- package/dist/targets/index.d.ts +1 -1
- package/dist/targets/index.js +2 -3493
- package/dist/targets/index.js.map +1 -1
- package/package.json +36 -41
- package/dist/chunk-DTZD7L6R.mjs.map +0 -1
- package/dist/helpers/code-builder.mjs +0 -3
- package/dist/helpers/code-builder.mjs.map +0 -1
- package/dist/helpers/reducer.mjs +0 -3
- package/dist/helpers/reducer.mjs.map +0 -1
- package/dist/index.mjs +0 -287
- package/dist/index.mjs.map +0 -1
- package/dist/targets/index.mjs +0 -4
- package/dist/targets/index.mjs.map +0 -1
- /package/dist/{chunk-BCCGHMCJ.mjs.map → chunk-KT7MO6Z4.js.map} +0 -0
- /package/dist/{chunk-UEOS42PC.mjs.map → chunk-Y7NI4MMY.js.map} +0 -0
- /package/dist/helpers/{code-builder.d.mts → code-builder.d.cts} +0 -0
- /package/dist/helpers/{reducer.d.mts → reducer.d.cts} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/helpers/code-builder.ts
|
|
4
|
+
var DEFAULT_INDENTATION_CHARACTER = "";
|
|
5
|
+
var DEFAULT_LINE_JOIN = "\n";
|
|
6
|
+
var CodeBuilder = class {
|
|
7
|
+
/**
|
|
8
|
+
* Helper object to format and aggragate lines of code.
|
|
9
|
+
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
10
|
+
*/
|
|
11
|
+
constructor({ indent, join } = {}) {
|
|
12
|
+
this.postProcessors = [];
|
|
13
|
+
this.code = [];
|
|
14
|
+
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
15
|
+
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
16
|
+
/**
|
|
17
|
+
* Add given indentation level to given line of code
|
|
18
|
+
*/
|
|
19
|
+
this.indentLine = (line, indentationLevel = 0) => {
|
|
20
|
+
const indent = this.indentationCharacter.repeat(indentationLevel);
|
|
21
|
+
return `${indent}${line}`;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Add the line at the beginning of the current lines
|
|
25
|
+
*/
|
|
26
|
+
this.unshift = (line, indentationLevel) => {
|
|
27
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
28
|
+
this.code.unshift(newLine);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Add the line at the end of the current lines
|
|
32
|
+
*/
|
|
33
|
+
this.push = (line, indentationLevel) => {
|
|
34
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
35
|
+
this.code.push(newLine);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Add an empty line at the end of current lines
|
|
39
|
+
*/
|
|
40
|
+
this.blank = () => {
|
|
41
|
+
this.code.push("");
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
45
|
+
*/
|
|
46
|
+
this.join = () => {
|
|
47
|
+
const unreplacedCode = this.code.join(this.lineJoin);
|
|
48
|
+
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
49
|
+
return replacedOutput;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
53
|
+
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
54
|
+
*/
|
|
55
|
+
this.addPostProcessor = (postProcessor) => {
|
|
56
|
+
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
57
|
+
};
|
|
58
|
+
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
59
|
+
this.lineJoin = join ?? DEFAULT_LINE_JOIN;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.CodeBuilder = CodeBuilder;
|
|
64
|
+
//# sourceMappingURL=out.js.map
|
|
65
|
+
//# sourceMappingURL=code-builder.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/helpers/code-builder.ts"],"names":[],"mappings":";AAAA,IAAM,gCAAgC;AACtC,IAAM,oBAAoB;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,QAAQ,KAAK,IAAwB,CAAC,GAAG;AAZvD,0BAAkC,CAAC;AAEnC,gBAAiB,CAAC;AAElB,gCAA+B;AAE/B,oBAAW;AAcX;AAAA;AAAA;AAAA,sBAAa,CAAC,MAAc,mBAAmB,MAAM;AACnD,YAAM,SAAS,KAAK,qBAAqB,OAAO,gBAAgB;AAChE,aAAO,GAAG,MAAM,GAAG,IAAI;AAAA,IACzB;AAKA;AAAA;AAAA;AAAA,mBAAU,CAAC,MAAc,qBAA8B;AACrD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,QAAQ,OAAO;AAAA,IAC3B;AAKA;AAAA;AAAA;AAAA,gBAAO,CAAC,MAAc,qBAA8B;AAClD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,KAAK,OAAO;AAAA,IACxB;AAKA;AAAA;AAAA;AAAA,iBAAQ,MAAM;AACZ,WAAK,KAAK,KAAK,EAAE;AAAA,IACnB;AAKA;AAAA;AAAA;AAAA,gBAAO,MAAM;AACX,YAAM,iBAAiB,KAAK,KAAK,KAAK,KAAK,QAAQ;AACnD,YAAM,iBAAiB,KAAK,eAAe,OAAO,CAAC,aAAa,aAAa,SAAS,WAAW,GAAG,cAAc;AAClH,aAAO;AAAA,IACT;AAMA;AAAA;AAAA;AAAA;AAAA,4BAAmB,CAAC,kBAAiC;AACnD,WAAK,iBAAiB,CAAC,GAAG,KAAK,gBAAgB,aAAa;AAAA,IAC9D;AAlDE,SAAK,uBAAuB,UAAU;AACtC,SAAK,WAAW,QAAQ;AAAA,EAC1B;AAiDF","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
|
|
@@ -1,65 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// src/helpers/code-builder.ts
|
|
4
|
-
var DEFAULT_INDENTATION_CHARACTER = "";
|
|
5
|
-
var DEFAULT_LINE_JOIN = "\n";
|
|
6
|
-
var CodeBuilder = class {
|
|
7
|
-
/**
|
|
8
|
-
* Helper object to format and aggragate lines of code.
|
|
9
|
-
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
10
|
-
*/
|
|
11
|
-
constructor({ indent, join } = {}) {
|
|
12
|
-
this.postProcessors = [];
|
|
13
|
-
this.code = [];
|
|
14
|
-
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
15
|
-
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
16
|
-
/**
|
|
17
|
-
* Add given indentation level to given line of code
|
|
18
|
-
*/
|
|
19
|
-
this.indentLine = (line, indentationLevel = 0) => {
|
|
20
|
-
const indent = this.indentationCharacter.repeat(indentationLevel);
|
|
21
|
-
return `${indent}${line}`;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Add the line at the beginning of the current lines
|
|
25
|
-
*/
|
|
26
|
-
this.unshift = (line, indentationLevel) => {
|
|
27
|
-
const newLine = this.indentLine(line, indentationLevel);
|
|
28
|
-
this.code.unshift(newLine);
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Add the line at the end of the current lines
|
|
32
|
-
*/
|
|
33
|
-
this.push = (line, indentationLevel) => {
|
|
34
|
-
const newLine = this.indentLine(line, indentationLevel);
|
|
35
|
-
this.code.push(newLine);
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Add an empty line at the end of current lines
|
|
39
|
-
*/
|
|
40
|
-
this.blank = () => {
|
|
41
|
-
this.code.push("");
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
45
|
-
*/
|
|
46
|
-
this.join = () => {
|
|
47
|
-
const unreplacedCode = this.code.join(this.lineJoin);
|
|
48
|
-
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
49
|
-
return replacedOutput;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
53
|
-
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
54
|
-
*/
|
|
55
|
-
this.addPostProcessor = (postProcessor) => {
|
|
56
|
-
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
57
|
-
};
|
|
58
|
-
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
59
|
-
this.lineJoin = join ?? DEFAULT_LINE_JOIN;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
exports.CodeBuilder = CodeBuilder;
|
|
1
|
+
export { CodeBuilder } from '../chunk-Y7NI4MMY.js';
|
|
64
2
|
//# sourceMappingURL=out.js.map
|
|
65
3
|
//# sourceMappingURL=code-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/helpers/reducer.ts
|
|
4
|
+
var reducer = (accumulator, pair) => {
|
|
5
|
+
const currentValue = accumulator[pair.name];
|
|
6
|
+
if (currentValue === void 0) {
|
|
7
|
+
accumulator[pair.name] = pair.value;
|
|
8
|
+
return accumulator;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(currentValue)) {
|
|
11
|
+
currentValue.push(pair.value);
|
|
12
|
+
return accumulator;
|
|
13
|
+
}
|
|
14
|
+
accumulator[pair.name] = [currentValue, pair.value];
|
|
15
|
+
return accumulator;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.reducer = reducer;
|
|
19
|
+
//# sourceMappingURL=out.js.map
|
|
20
|
+
//# sourceMappingURL=reducer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,UAAU,CAA4C,aAAkC,SAAY;AAC/G,QAAM,eAAe,YAAY,KAAK,IAAI;AAC1C,MAAI,iBAAiB,QAAW;AAC9B,gBAAY,KAAK,IAAI,IAAI,KAAK;AAC9B,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,iBAAa,KAAK,KAAK,KAAK;AAC5B,WAAO;AAAA,EACT;AAGA,cAAY,KAAK,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;AAClD,SAAO;AACT","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
|
package/dist/helpers/reducer.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// src/helpers/reducer.ts
|
|
4
|
-
var reducer = (accumulator, pair) => {
|
|
5
|
-
const currentValue = accumulator[pair.name];
|
|
6
|
-
if (currentValue === void 0) {
|
|
7
|
-
accumulator[pair.name] = pair.value;
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
if (Array.isArray(currentValue)) {
|
|
11
|
-
currentValue.push(pair.value);
|
|
12
|
-
return accumulator;
|
|
13
|
-
}
|
|
14
|
-
accumulator[pair.name] = [currentValue, pair.value];
|
|
15
|
-
return accumulator;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.reducer = reducer;
|
|
1
|
+
export { reducer } from '../chunk-KT7MO6Z4.js';
|
|
19
2
|
//# sourceMappingURL=out.js.map
|
|
20
3
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as har_format from 'har-format';
|
|
2
2
|
import { Request as Request$1, PostDataCommon, Param } from 'har-format';
|
|
3
3
|
import { ReducedHelperObject } from './helpers/reducer.js';
|
|
4
|
-
import { UrlWithParsedQuery } from 'node:url';
|
|
5
4
|
import { CodeBuilderOptions } from './helpers/code-builder.js';
|
|
5
|
+
import { UrlWithParsedQuery } from 'node:url';
|
|
6
6
|
import { Merge } from 'type-fest';
|
|
7
7
|
|
|
8
8
|
type TargetId = keyof typeof targets;
|
|
9
9
|
type ClientId = string;
|
|
10
10
|
interface ClientInfo {
|
|
11
11
|
description: string;
|
|
12
|
+
extname: Extension;
|
|
12
13
|
key: ClientId;
|
|
13
14
|
link: string;
|
|
14
15
|
title: string;
|
|
@@ -22,7 +23,6 @@ type Extension = `.${string}` | null;
|
|
|
22
23
|
interface TargetInfo {
|
|
23
24
|
cli?: string;
|
|
24
25
|
default: string;
|
|
25
|
-
extname: Extension;
|
|
26
26
|
key: TargetId;
|
|
27
27
|
title: string;
|
|
28
28
|
}
|
|
@@ -60,7 +60,7 @@ interface AvailableTarget extends TargetInfo {
|
|
|
60
60
|
clients: ClientInfo[];
|
|
61
61
|
}
|
|
62
62
|
declare const availableTargets: () => AvailableTarget[];
|
|
63
|
-
declare const extname: (targetId: TargetId) => `.${string}
|
|
63
|
+
declare const extname: (targetId: TargetId, clientId: ClientId) => "" | `.${string}`;
|
|
64
64
|
|
|
65
65
|
/** is this wrong? yes. according to the spec (http://www.softwareishard.com/blog/har-12-spec/#postData) it's technically wrong since `params` and `text` are (by the spec) mutually exclusive. However, in practice, this is not what is often the case.
|
|
66
66
|
*
|
|
@@ -106,9 +106,13 @@ interface HTTPSnippetOptions {
|
|
|
106
106
|
harIsAlreadyEncoded?: boolean;
|
|
107
107
|
}
|
|
108
108
|
declare class HTTPSnippet {
|
|
109
|
+
initCalled: boolean;
|
|
110
|
+
entries: Entry[];
|
|
109
111
|
requests: Request[];
|
|
112
|
+
options: HTTPSnippetOptions;
|
|
110
113
|
constructor(input: HarEntry | HarRequest, opts?: HTTPSnippetOptions);
|
|
111
|
-
|
|
114
|
+
init(): Promise<this>;
|
|
115
|
+
prepare(harRequest: HarRequest, options: HTTPSnippetOptions): Promise<{
|
|
112
116
|
allHeaders: {
|
|
113
117
|
[x: string]: string | string[];
|
|
114
118
|
};
|
|
@@ -147,8 +151,8 @@ declare class HTTPSnippet {
|
|
|
147
151
|
cookiesObj: ReducedHelperObject;
|
|
148
152
|
headersObj: ReducedHelperObject;
|
|
149
153
|
queryObj: ReducedHelperObject;
|
|
150
|
-
}
|
|
151
|
-
convert
|
|
154
|
+
}>;
|
|
155
|
+
convert(targetId: TargetId, clientId?: ClientId, options?: any): Promise<string | false | string[]>;
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
export { ClientId as C, Extension as E, HarRequest as H, RequestExtras as R, TargetId as T, ClientInfo as a, Converter as b, Client as c, TargetInfo as d, Target as e, addTarget as f, isClient as g, addTargetClient as h, isTarget as i, Request as j, HTTPSnippetOptions as k, HTTPSnippet as l, availableTargets as m, extname as n, targets as t };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as har_format from 'har-format';
|
|
2
2
|
import { Request as Request$1, PostDataCommon, Param } from 'har-format';
|
|
3
|
-
import { ReducedHelperObject } from './helpers/reducer.
|
|
3
|
+
import { ReducedHelperObject } from './helpers/reducer.cjs';
|
|
4
|
+
import { CodeBuilderOptions } from './helpers/code-builder.cjs';
|
|
4
5
|
import { UrlWithParsedQuery } from 'node:url';
|
|
5
|
-
import { CodeBuilderOptions } from './helpers/code-builder.mjs';
|
|
6
6
|
import { Merge } from 'type-fest';
|
|
7
7
|
|
|
8
8
|
type TargetId = keyof typeof targets;
|
|
9
9
|
type ClientId = string;
|
|
10
10
|
interface ClientInfo {
|
|
11
11
|
description: string;
|
|
12
|
+
extname: Extension;
|
|
12
13
|
key: ClientId;
|
|
13
14
|
link: string;
|
|
14
15
|
title: string;
|
|
@@ -22,7 +23,6 @@ type Extension = `.${string}` | null;
|
|
|
22
23
|
interface TargetInfo {
|
|
23
24
|
cli?: string;
|
|
24
25
|
default: string;
|
|
25
|
-
extname: Extension;
|
|
26
26
|
key: TargetId;
|
|
27
27
|
title: string;
|
|
28
28
|
}
|
|
@@ -60,7 +60,7 @@ interface AvailableTarget extends TargetInfo {
|
|
|
60
60
|
clients: ClientInfo[];
|
|
61
61
|
}
|
|
62
62
|
declare const availableTargets: () => AvailableTarget[];
|
|
63
|
-
declare const extname: (targetId: TargetId) => `.${string}
|
|
63
|
+
declare const extname: (targetId: TargetId, clientId: ClientId) => "" | `.${string}`;
|
|
64
64
|
|
|
65
65
|
/** is this wrong? yes. according to the spec (http://www.softwareishard.com/blog/har-12-spec/#postData) it's technically wrong since `params` and `text` are (by the spec) mutually exclusive. However, in practice, this is not what is often the case.
|
|
66
66
|
*
|
|
@@ -106,9 +106,13 @@ interface HTTPSnippetOptions {
|
|
|
106
106
|
harIsAlreadyEncoded?: boolean;
|
|
107
107
|
}
|
|
108
108
|
declare class HTTPSnippet {
|
|
109
|
+
initCalled: boolean;
|
|
110
|
+
entries: Entry[];
|
|
109
111
|
requests: Request[];
|
|
112
|
+
options: HTTPSnippetOptions;
|
|
110
113
|
constructor(input: HarEntry | HarRequest, opts?: HTTPSnippetOptions);
|
|
111
|
-
|
|
114
|
+
init(): Promise<this>;
|
|
115
|
+
prepare(harRequest: HarRequest, options: HTTPSnippetOptions): Promise<{
|
|
112
116
|
allHeaders: {
|
|
113
117
|
[x: string]: string | string[];
|
|
114
118
|
};
|
|
@@ -147,8 +151,8 @@ declare class HTTPSnippet {
|
|
|
147
151
|
cookiesObj: ReducedHelperObject;
|
|
148
152
|
headersObj: ReducedHelperObject;
|
|
149
153
|
queryObj: ReducedHelperObject;
|
|
150
|
-
}
|
|
151
|
-
convert
|
|
154
|
+
}>;
|
|
155
|
+
convert(targetId: TargetId, clientId?: ClientId, options?: any): Promise<string | false | string[]>;
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
export { ClientId as C, Extension as E, HarRequest as H, RequestExtras as R, TargetId as T, ClientInfo as a, Converter as b, Client as c, TargetInfo as d, Target as e, addTarget as f, isClient as g, addTargetClient as h, isTarget as i, Request as j, HTTPSnippetOptions as k, HTTPSnippet as l, availableTargets as m, extname as n, targets as t };
|