@famir/http-tools 0.0.3 → 0.0.5
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/README.md +10 -1
- package/dist/body.d.ts +3 -3
- package/dist/body.js +2 -2
- package/dist/body.js.map +1 -1
- package/dist/body.test.d.ts +1 -0
- package/dist/body.test.js +175 -0
- package/dist/body.test.js.map +1 -0
- package/dist/cheerio.js.map +1 -1
- package/dist/content-type.d.ts +2 -3
- package/dist/content-type.js +2 -7
- package/dist/content-type.js.map +1 -1
- package/dist/cookies.d.ts +1 -1
- package/dist/cookies.js +2 -2
- package/dist/cookies.js.map +1 -1
- package/dist/cookies.test.d.ts +1 -0
- package/dist/cookies.test.js +365 -0
- package/dist/cookies.test.js.map +1 -0
- package/dist/headers.d.ts +1 -0
- package/dist/headers.js +5 -2
- package/dist/headers.js.map +1 -1
- package/dist/headers.test.d.ts +1 -0
- package/dist/headers.test.js +314 -0
- package/dist/headers.test.js.map +1 -0
- package/dist/isbot.js.map +1 -1
- package/dist/message.d.ts +4 -4
- package/dist/message.js +7 -7
- package/dist/message.js.map +1 -1
- package/dist/message.test.d.ts +1 -0
- package/dist/message.test.js +138 -0
- package/dist/message.test.js.map +1 -0
- package/dist/method.js.map +1 -1
- package/dist/method.test.d.ts +1 -0
- package/dist/method.test.js +89 -0
- package/dist/method.test.js.map +1 -0
- package/dist/query-string.d.ts +4 -6
- package/dist/query-string.js +2 -7
- package/dist/query-string.js.map +1 -1
- package/dist/rewrite-url.js.map +1 -1
- package/dist/rewrite-url.test.d.ts +1 -0
- package/dist/rewrite-url.test.js +322 -0
- package/dist/rewrite-url.test.js.map +1 -0
- package/dist/status.js.map +1 -1
- package/dist/status.test.d.ts +1 -0
- package/dist/status.test.js +106 -0
- package/dist/status.test.js.map +1 -0
- package/dist/ua-parser.js.map +1 -1
- package/dist/url.d.ts +3 -3
- package/dist/url.js.map +1 -1
- package/dist/url.test.d.ts +1 -0
- package/dist/url.test.js +201 -0
- package/dist/url.test.js.map +1 -0
- package/package.json +12 -8
package/dist/method.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sourceRoot":"","sources":["../src/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAA;AAO5D,MAAM,OAAO,cAAc;
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../src/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAA;AAO5D,MAAM,OAAO,cAAc;IAMzB,MAAM,CAAC,WAAW;QAChB,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IASD,MAAM,CAAC,OAAO,CAAC,GAAoC;QACjD,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;QAED,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC9C,CAAC;IASD,MAAM,CAAC,UAAU,CAAC,KAAa;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QAErC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;QAED,OAAO,IAAI,cAAc,CAAC,SAAS,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,CAAY;IAOnB,YAAY,MAAkB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAOD,KAAK;QACH,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAED,SAAS,GAAY,KAAK,CAAA;IAO1B,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAOD,MAAM;QACJ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QAErB,OAAO,IAAI,CAAA;IACb,CAAC;IAOD,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IASD,GAAG,CAAC,MAAkB;QACpB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAEzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QAErB,OAAO,IAAI,CAAA;IACb,CAAC;IAQD,EAAE,CAAC,GAA8B;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { HttpMethodWrap } from './method.js';
|
|
4
|
+
describe('HttpMethodWrap', () => {
|
|
5
|
+
describe('fromScratch', () => {
|
|
6
|
+
it('should create wrapper from scratch', () => {
|
|
7
|
+
const method = HttpMethodWrap.fromScratch();
|
|
8
|
+
assert.strictEqual(method.get(), 'GET');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('fromReq', () => {
|
|
12
|
+
it('should create wrapper from request object', () => {
|
|
13
|
+
const req = { method: 'PosT' };
|
|
14
|
+
const method = HttpMethodWrap.fromReq(req);
|
|
15
|
+
assert.strictEqual(method.get(), 'POST');
|
|
16
|
+
});
|
|
17
|
+
it('should throw if request method is not defined', () => {
|
|
18
|
+
const req = { method: undefined };
|
|
19
|
+
assert.throws(() => HttpMethodWrap.fromReq(req), /not defined/);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('fromString', () => {
|
|
23
|
+
it('should create wrapper from string', () => {
|
|
24
|
+
const method = HttpMethodWrap.fromString('PuT');
|
|
25
|
+
assert.strictEqual(method.get(), 'PUT');
|
|
26
|
+
});
|
|
27
|
+
it('should throw on unknown method', () => {
|
|
28
|
+
assert.throws(() => HttpMethodWrap.fromString('INVALID'), /not known/);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('clone', () => {
|
|
32
|
+
it('should clone wrapper', () => {
|
|
33
|
+
const original = new HttpMethodWrap('POST');
|
|
34
|
+
const cloned = original.clone();
|
|
35
|
+
assert.deepStrictEqual(cloned, original);
|
|
36
|
+
assert.notStrictEqual(cloned, original);
|
|
37
|
+
});
|
|
38
|
+
it('should clone has independent state', () => {
|
|
39
|
+
const original = new HttpMethodWrap('HEAD');
|
|
40
|
+
const cloned = original.clone();
|
|
41
|
+
assert.strictEqual(cloned.get(), 'HEAD');
|
|
42
|
+
cloned.set('GET');
|
|
43
|
+
assert.strictEqual(original.get(), 'HEAD');
|
|
44
|
+
assert.strictEqual(cloned.get(), 'GET');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('freeze', () => {
|
|
48
|
+
it('should freeze and prevent modifications', () => {
|
|
49
|
+
const method = HttpMethodWrap.fromScratch();
|
|
50
|
+
method.freeze();
|
|
51
|
+
assert.strictEqual(method.isFrozen, true);
|
|
52
|
+
assert.throws(() => method.set('POST'), /frozen/);
|
|
53
|
+
});
|
|
54
|
+
it('should return this for chaining', () => {
|
|
55
|
+
const method = HttpMethodWrap.fromScratch();
|
|
56
|
+
const that = method.freeze();
|
|
57
|
+
assert.strictEqual(that, method);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('get/set', () => {
|
|
61
|
+
it('should get method value', () => {
|
|
62
|
+
const method = new HttpMethodWrap('PATCH');
|
|
63
|
+
assert.strictEqual(method.get(), 'PATCH');
|
|
64
|
+
});
|
|
65
|
+
it('should set and get method value', () => {
|
|
66
|
+
const method = HttpMethodWrap.fromScratch();
|
|
67
|
+
method.set('DELETE');
|
|
68
|
+
assert.strictEqual(method.get(), 'DELETE');
|
|
69
|
+
});
|
|
70
|
+
it('should return this for chaining', () => {
|
|
71
|
+
const method = HttpMethodWrap.fromScratch();
|
|
72
|
+
const that = method.set('OPTIONS');
|
|
73
|
+
assert.strictEqual(that, method);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('is check', () => {
|
|
77
|
+
it('should check single method', () => {
|
|
78
|
+
const method = new HttpMethodWrap('GET');
|
|
79
|
+
assert.strictEqual(method.is('GET'), true);
|
|
80
|
+
assert.strictEqual(method.is('POST'), false);
|
|
81
|
+
});
|
|
82
|
+
it('should check multiple methods', () => {
|
|
83
|
+
const method = new HttpMethodWrap('HEAD');
|
|
84
|
+
assert.strictEqual(method.is(['GET', 'HEAD']), true);
|
|
85
|
+
assert.strictEqual(method.is(['PATCH', 'PUT']), false);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=method.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.test.js","sourceRoot":"","sources":["../src/method.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,aAAa,EAAE,GAAG,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CAAC,CAAA;YACxC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;YAC1C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;YACzC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;YACpD,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/query-string.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare function parseQueryString(value: string, options: HttpParseQueryStringOptions): HttpQueryString;
|
|
6
|
-
export declare function formatQueryString(queryString: HttpQueryString, options: HttpFormatQueryStringOptions): string;
|
|
1
|
+
export { IParseBaseOptions as ParseQueryStringOptions } from 'qs';
|
|
2
|
+
export { IStringifyBaseOptions as FormatQueryStringOptions } from 'qs';
|
|
3
|
+
export { parse as parseQueryString } from 'qs';
|
|
4
|
+
export { stringify as formatQueryString } from 'qs';
|
package/dist/query-string.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
return qs.parse(value.trim(), options);
|
|
4
|
-
}
|
|
5
|
-
export function formatQueryString(queryString, options) {
|
|
6
|
-
return qs.stringify(queryString, options);
|
|
7
|
-
}
|
|
1
|
+
export { parse as parseQueryString } from 'qs';
|
|
2
|
+
export { stringify as formatQueryString } from 'qs';
|
|
8
3
|
//# sourceMappingURL=query-string.js.map
|
package/dist/query-string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-string.js","sourceRoot":"","sources":["../src/query-string.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-string.js","sourceRoot":"","sources":["../src/query-string.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAM9C,OAAO,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,IAAI,CAAA"}
|
package/dist/rewrite-url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-url.js","sourceRoot":"","sources":["../src/rewrite-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rewrite-url.js","sourceRoot":"","sources":["../src/rewrite-url.ts"],"names":[],"mappings":"AA6BA,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,GAAY,EACZ,OAA2B,EAC3B,OAA2B;IAE3B,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,GAAG;YAChC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC;YAC3C,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;QAE7C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;QAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;QAE7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,GAAG;YAC5B,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC;YACvC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;QAEzC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;YACzC,MAAM,OAAO,GAAG,SAAS;gBACvB,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzC,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEjC,MAAM,WAAW,GAAG,SAAS;gBAC3B,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzC,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEjC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { rewriteUrl } from './rewrite-url.js';
|
|
4
|
+
describe('rewriteUrl', () => {
|
|
5
|
+
describe('basic rewriting (forward)', () => {
|
|
6
|
+
it('should rewrite with protocol and separator', () => {
|
|
7
|
+
const text = 'Check http://donor.com/path and https://donor.com/secure';
|
|
8
|
+
const target = {
|
|
9
|
+
donorSecure: false,
|
|
10
|
+
donorHost: 'donor.com',
|
|
11
|
+
mirrorSecure: true,
|
|
12
|
+
mirrorHost: 'mirror.com',
|
|
13
|
+
};
|
|
14
|
+
const schemes = [['://', true]];
|
|
15
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
16
|
+
assert.strictEqual(result.includes('https://mirror.com/path'), true);
|
|
17
|
+
});
|
|
18
|
+
it.skip('should rewrite without protocol', () => {
|
|
19
|
+
const text = 'Urls: //donor.com/path and //donor.com/other';
|
|
20
|
+
const target = {
|
|
21
|
+
donorSecure: false,
|
|
22
|
+
donorHost: 'donor.com',
|
|
23
|
+
mirrorSecure: false,
|
|
24
|
+
mirrorHost: 'mirror.com',
|
|
25
|
+
};
|
|
26
|
+
const schemes = [['://', false]];
|
|
27
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
28
|
+
assert.strictEqual(result.includes('//mirror.com/path'), true);
|
|
29
|
+
});
|
|
30
|
+
it('should preserve URLs not matching target', () => {
|
|
31
|
+
const text = 'http://other.com/path and http://donor.com/path';
|
|
32
|
+
const target = {
|
|
33
|
+
donorSecure: false,
|
|
34
|
+
donorHost: 'donor.com',
|
|
35
|
+
mirrorSecure: false,
|
|
36
|
+
mirrorHost: 'mirror.com',
|
|
37
|
+
};
|
|
38
|
+
const schemes = [['://', true]];
|
|
39
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
40
|
+
assert.strictEqual(result.includes('http://other.com/path'), true);
|
|
41
|
+
assert.strictEqual(result.includes('http://mirror.com/path'), true);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('reverse rewriting', () => {
|
|
45
|
+
it('should reverse rewrite mirror to donor', () => {
|
|
46
|
+
const text = 'Response from https://mirror.com/api';
|
|
47
|
+
const target = {
|
|
48
|
+
donorSecure: false,
|
|
49
|
+
donorHost: 'donor.com',
|
|
50
|
+
mirrorSecure: true,
|
|
51
|
+
mirrorHost: 'mirror.com',
|
|
52
|
+
};
|
|
53
|
+
const schemes = [['://', true]];
|
|
54
|
+
const result = rewriteUrl(text, true, [target], schemes);
|
|
55
|
+
assert.strictEqual(result.includes('http://donor.com/api'), true);
|
|
56
|
+
});
|
|
57
|
+
it('should reverse with protocol changes', () => {
|
|
58
|
+
const text = 'Content has https://mirror.example.org/resource';
|
|
59
|
+
const target = {
|
|
60
|
+
donorSecure: true,
|
|
61
|
+
donorHost: 'original.com',
|
|
62
|
+
mirrorSecure: true,
|
|
63
|
+
mirrorHost: 'mirror.example.org',
|
|
64
|
+
};
|
|
65
|
+
const schemes = [['://', true]];
|
|
66
|
+
const result = rewriteUrl(text, true, [target], schemes);
|
|
67
|
+
assert.strictEqual(result.includes('https://original.com/resource'), true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('multiple schemes', () => {
|
|
71
|
+
it('should rewrite with multiple separators', () => {
|
|
72
|
+
const text = 'http://donor.com and //donor.com and data:url';
|
|
73
|
+
const target = {
|
|
74
|
+
donorSecure: false,
|
|
75
|
+
donorHost: 'donor.com',
|
|
76
|
+
mirrorSecure: false,
|
|
77
|
+
mirrorHost: 'mirror.com',
|
|
78
|
+
};
|
|
79
|
+
const schemes = [
|
|
80
|
+
['://', true],
|
|
81
|
+
['//', false],
|
|
82
|
+
];
|
|
83
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
84
|
+
assert.strictEqual(result.includes('http://mirror.com'), true);
|
|
85
|
+
assert.strictEqual(result.includes('//mirror.com'), true);
|
|
86
|
+
});
|
|
87
|
+
it('should handle encoded separators', () => {
|
|
88
|
+
const text = 'Data: %3A%2F%2Fdonor.com and %2F%2Fdonor.com';
|
|
89
|
+
const target = {
|
|
90
|
+
donorSecure: false,
|
|
91
|
+
donorHost: 'donor.com',
|
|
92
|
+
mirrorSecure: false,
|
|
93
|
+
mirrorHost: 'mirror.com',
|
|
94
|
+
};
|
|
95
|
+
const schemes = [
|
|
96
|
+
['%3A%2F%2F', true],
|
|
97
|
+
['%2F%2F', false],
|
|
98
|
+
];
|
|
99
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
100
|
+
assert.strictEqual(result.includes('%3A%2F%2Fmirror.com'), true);
|
|
101
|
+
assert.strictEqual(result.includes('%2F%2Fmirror.com'), true);
|
|
102
|
+
});
|
|
103
|
+
it.skip('should handle unicode escaped separators', () => {
|
|
104
|
+
const text = 'Escaped: \\u003A\\u002F\\u002Fdonor.com';
|
|
105
|
+
const target = {
|
|
106
|
+
donorSecure: false,
|
|
107
|
+
donorHost: 'donor.com',
|
|
108
|
+
mirrorSecure: false,
|
|
109
|
+
mirrorHost: 'mirror.com',
|
|
110
|
+
};
|
|
111
|
+
const schemes = [['\\u003A\\u002F\\u002F', true]];
|
|
112
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
113
|
+
assert.strictEqual(result.includes('\\u003A\\u002F\\u002Fmirror.com'), true);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('multiple targets', () => {
|
|
117
|
+
it('should rewrite multiple targets sequentially', () => {
|
|
118
|
+
const text = 'http://donor1.com/path1 and http://donor2.com/path2';
|
|
119
|
+
const targets = [
|
|
120
|
+
{
|
|
121
|
+
donorSecure: false,
|
|
122
|
+
donorHost: 'donor1.com',
|
|
123
|
+
mirrorSecure: false,
|
|
124
|
+
mirrorHost: 'mirror1.com',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
donorSecure: false,
|
|
128
|
+
donorHost: 'donor2.com',
|
|
129
|
+
mirrorSecure: false,
|
|
130
|
+
mirrorHost: 'mirror2.com',
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
const schemes = [['://', true]];
|
|
134
|
+
const result = rewriteUrl(text, false, targets, schemes);
|
|
135
|
+
assert.strictEqual(result.includes('http://mirror1.com/path1'), true);
|
|
136
|
+
assert.strictEqual(result.includes('http://mirror2.com/path2'), true);
|
|
137
|
+
});
|
|
138
|
+
it('should handle overlapping targets independently', () => {
|
|
139
|
+
const text = 'http://sub.donor.com/api';
|
|
140
|
+
const targets = [
|
|
141
|
+
{
|
|
142
|
+
donorSecure: false,
|
|
143
|
+
donorHost: 'donor.com',
|
|
144
|
+
mirrorSecure: false,
|
|
145
|
+
mirrorHost: 'mirror.com',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
donorSecure: false,
|
|
149
|
+
donorHost: 'sub.donor.com',
|
|
150
|
+
mirrorSecure: false,
|
|
151
|
+
mirrorHost: 'sub.mirror.com',
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
const schemes = [['://', true]];
|
|
155
|
+
const result = rewriteUrl(text, false, targets, schemes);
|
|
156
|
+
assert.strictEqual(result.includes('mirror'), true);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
describe('protocol switching', () => {
|
|
160
|
+
it('should switch from http to https', () => {
|
|
161
|
+
const text = 'http://donor.com/secure';
|
|
162
|
+
const target = {
|
|
163
|
+
donorSecure: false,
|
|
164
|
+
donorHost: 'donor.com',
|
|
165
|
+
mirrorSecure: true,
|
|
166
|
+
mirrorHost: 'mirror.com',
|
|
167
|
+
};
|
|
168
|
+
const schemes = [['://', true]];
|
|
169
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
170
|
+
assert.strictEqual(result.includes('https://mirror.com/secure'), true);
|
|
171
|
+
});
|
|
172
|
+
it('should switch from https to http', () => {
|
|
173
|
+
const text = 'https://donor.com/public';
|
|
174
|
+
const target = {
|
|
175
|
+
donorSecure: true,
|
|
176
|
+
donorHost: 'donor.com',
|
|
177
|
+
mirrorSecure: false,
|
|
178
|
+
mirrorHost: 'mirror.com',
|
|
179
|
+
};
|
|
180
|
+
const schemes = [['://', true]];
|
|
181
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
182
|
+
assert.strictEqual(result.includes('http://mirror.com/public'), true);
|
|
183
|
+
});
|
|
184
|
+
it('should maintain same protocol when both secure', () => {
|
|
185
|
+
const text = 'https://donor.com/path';
|
|
186
|
+
const target = {
|
|
187
|
+
donorSecure: true,
|
|
188
|
+
donorHost: 'donor.com',
|
|
189
|
+
mirrorSecure: true,
|
|
190
|
+
mirrorHost: 'mirror.com',
|
|
191
|
+
};
|
|
192
|
+
const schemes = [['://', true]];
|
|
193
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
194
|
+
assert.strictEqual(result.includes('https://mirror.com/path'), true);
|
|
195
|
+
});
|
|
196
|
+
it('should maintain same protocol when both insecure', () => {
|
|
197
|
+
const text = 'http://donor.com/path';
|
|
198
|
+
const target = {
|
|
199
|
+
donorSecure: false,
|
|
200
|
+
donorHost: 'donor.com',
|
|
201
|
+
mirrorSecure: false,
|
|
202
|
+
mirrorHost: 'mirror.com',
|
|
203
|
+
};
|
|
204
|
+
const schemes = [['://', true]];
|
|
205
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
206
|
+
assert.strictEqual(result.includes('http://mirror.com/path'), true);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
describe('edge cases', () => {
|
|
210
|
+
it('should handle empty text', () => {
|
|
211
|
+
const result = rewriteUrl('', false, [], []);
|
|
212
|
+
assert.strictEqual(result, '');
|
|
213
|
+
});
|
|
214
|
+
it('should handle empty targets', () => {
|
|
215
|
+
const text = 'http://donor.com/path';
|
|
216
|
+
const result = rewriteUrl(text, false, [], [['://', true]]);
|
|
217
|
+
assert.strictEqual(result, text);
|
|
218
|
+
});
|
|
219
|
+
it('should handle empty schemes', () => {
|
|
220
|
+
const text = 'http://donor.com/path';
|
|
221
|
+
const target = {
|
|
222
|
+
donorSecure: false,
|
|
223
|
+
donorHost: 'donor.com',
|
|
224
|
+
mirrorSecure: false,
|
|
225
|
+
mirrorHost: 'mirror.com',
|
|
226
|
+
};
|
|
227
|
+
const result = rewriteUrl(text, false, [target], []);
|
|
228
|
+
assert.strictEqual(result, text);
|
|
229
|
+
});
|
|
230
|
+
it('should handle subdomains', () => {
|
|
231
|
+
const text = 'https://api.donor.com/v1 and https://donor.com';
|
|
232
|
+
const target = {
|
|
233
|
+
donorSecure: true,
|
|
234
|
+
donorHost: 'donor.com',
|
|
235
|
+
mirrorSecure: true,
|
|
236
|
+
mirrorHost: 'mirror.com',
|
|
237
|
+
};
|
|
238
|
+
const schemes = [['://', true]];
|
|
239
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
240
|
+
assert.strictEqual(result.includes('api.donor.com'), true);
|
|
241
|
+
assert.strictEqual(result.includes('https://mirror.com'), true);
|
|
242
|
+
});
|
|
243
|
+
it('should handle ports in URLs', () => {
|
|
244
|
+
const text = 'http://donor.com:8080/path';
|
|
245
|
+
const target = {
|
|
246
|
+
donorSecure: false,
|
|
247
|
+
donorHost: 'donor.com',
|
|
248
|
+
mirrorSecure: false,
|
|
249
|
+
mirrorHost: 'mirror.com',
|
|
250
|
+
};
|
|
251
|
+
const schemes = [['://', true]];
|
|
252
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
253
|
+
assert.strictEqual(result.includes('http://mirror.com:8080'), true);
|
|
254
|
+
});
|
|
255
|
+
it('should handle case-sensitive matching', () => {
|
|
256
|
+
const text = 'http://Donor.com and http://donor.com';
|
|
257
|
+
const target = {
|
|
258
|
+
donorSecure: false,
|
|
259
|
+
donorHost: 'donor.com',
|
|
260
|
+
mirrorSecure: false,
|
|
261
|
+
mirrorHost: 'mirror.com',
|
|
262
|
+
};
|
|
263
|
+
const schemes = [['://', true]];
|
|
264
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
265
|
+
assert.strictEqual(result.includes('Donor.com'), true);
|
|
266
|
+
assert.strictEqual(result.includes('http://mirror.com'), true);
|
|
267
|
+
});
|
|
268
|
+
it('should handle multiple occurrences of same URL', () => {
|
|
269
|
+
const text = 'Link1: http://donor.com/a, Link2: http://donor.com/b, Link3: http://donor.com/c';
|
|
270
|
+
const target = {
|
|
271
|
+
donorSecure: false,
|
|
272
|
+
donorHost: 'donor.com',
|
|
273
|
+
mirrorSecure: false,
|
|
274
|
+
mirrorHost: 'mirror.com',
|
|
275
|
+
};
|
|
276
|
+
const schemes = [['://', true]];
|
|
277
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
278
|
+
const count = (result.match(/mirror\.com/g) || []).length;
|
|
279
|
+
assert.strictEqual(count, 3);
|
|
280
|
+
});
|
|
281
|
+
it('should preserve query strings and fragments', () => {
|
|
282
|
+
const text = 'http://donor.com/path?key=value#section';
|
|
283
|
+
const target = {
|
|
284
|
+
donorSecure: false,
|
|
285
|
+
donorHost: 'donor.com',
|
|
286
|
+
mirrorSecure: false,
|
|
287
|
+
mirrorHost: 'mirror.com',
|
|
288
|
+
};
|
|
289
|
+
const schemes = [['://', true]];
|
|
290
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
291
|
+
assert.strictEqual(result.includes('http://mirror.com/path?key=value#section'), true);
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
describe('protocol flag in schemes', () => {
|
|
295
|
+
it('should include protocol when withProto is true', () => {
|
|
296
|
+
const text = 'http://donor.com/path';
|
|
297
|
+
const target = {
|
|
298
|
+
donorSecure: false,
|
|
299
|
+
donorHost: 'donor.com',
|
|
300
|
+
mirrorSecure: false,
|
|
301
|
+
mirrorHost: 'mirror.com',
|
|
302
|
+
};
|
|
303
|
+
const schemes = [['://', true]];
|
|
304
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
305
|
+
assert.strictEqual(result.includes('http://mirror.com'), true);
|
|
306
|
+
});
|
|
307
|
+
it.skip('should exclude protocol when withProto is false', () => {
|
|
308
|
+
const text = '//donor.com/path';
|
|
309
|
+
const target = {
|
|
310
|
+
donorSecure: false,
|
|
311
|
+
donorHost: 'donor.com',
|
|
312
|
+
mirrorSecure: false,
|
|
313
|
+
mirrorHost: 'mirror.com',
|
|
314
|
+
};
|
|
315
|
+
const schemes = [['://', false]];
|
|
316
|
+
const result = rewriteUrl(text, false, [target], schemes);
|
|
317
|
+
assert.strictEqual(result.includes('//mirror.com'), true);
|
|
318
|
+
assert.strictEqual(result.includes('http://'), false);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
//# sourceMappingURL=rewrite-url.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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QACvD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,cAAc;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,cAAc;IAMzB,MAAM,CAAC,WAAW;QAChB,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IAED,OAAO,CAAQ;IAOf,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAOD,KAAK;QACH,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAED,SAAS,GAAY,KAAK,CAAA;IAO1B,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAOD,MAAM;QACJ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QAErB,OAAO,IAAI,CAAA;IACb,CAAC;IAOD,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IASD,GAAG,CAAC,MAAc;QAChB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAEzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QAErB,OAAO,IAAI,CAAA;IACb,CAAC;IAOD,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAOD,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAOD,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAOD,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAOD,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IAOD,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAChC,CAAC;IAQD,KAAK;QACH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAE3B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;QAEhB,OAAO,IAAI,CAAA;IACb,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IAEO,OAAO,CAAC,GAAW,EAAE,GAAW;QACtC,OAAO,IAAI,CAAC,OAAO,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
import { HttpStatusWrap } from './status.js';
|
|
4
|
+
describe('HttpStatusWrap', () => {
|
|
5
|
+
describe('fromScratch', () => {
|
|
6
|
+
it('should create wrapper from scratch', () => {
|
|
7
|
+
const status = HttpStatusWrap.fromScratch();
|
|
8
|
+
assert.strictEqual(status.get(), 0);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('clone', () => {
|
|
12
|
+
it('should clone wrapper', () => {
|
|
13
|
+
const original = new HttpStatusWrap(200);
|
|
14
|
+
const cloned = original.clone();
|
|
15
|
+
assert.deepStrictEqual(cloned, original);
|
|
16
|
+
assert.notStrictEqual(cloned, original);
|
|
17
|
+
});
|
|
18
|
+
it('should clone has independent state', () => {
|
|
19
|
+
const original = new HttpStatusWrap(400);
|
|
20
|
+
const cloned = original.clone();
|
|
21
|
+
assert.strictEqual(cloned.get(), 400);
|
|
22
|
+
cloned.set(500);
|
|
23
|
+
assert.strictEqual(original.get(), 400);
|
|
24
|
+
assert.strictEqual(cloned.get(), 500);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe('freeze', () => {
|
|
28
|
+
it('should freeze and prevent modifications', () => {
|
|
29
|
+
const status = HttpStatusWrap.fromScratch();
|
|
30
|
+
status.freeze();
|
|
31
|
+
assert.strictEqual(status.isFrozen, true);
|
|
32
|
+
assert.throws(() => status.set(200), /frozen/);
|
|
33
|
+
});
|
|
34
|
+
it('should return this for chaining', () => {
|
|
35
|
+
const status = HttpStatusWrap.fromScratch();
|
|
36
|
+
const that = status.freeze();
|
|
37
|
+
assert.strictEqual(that, status);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe('get/set', () => {
|
|
41
|
+
it('should get status value', () => {
|
|
42
|
+
const status = new HttpStatusWrap(200);
|
|
43
|
+
assert.strictEqual(status.get(), 200);
|
|
44
|
+
});
|
|
45
|
+
it('should set and get status value', () => {
|
|
46
|
+
const status = HttpStatusWrap.fromScratch();
|
|
47
|
+
status.set(500);
|
|
48
|
+
assert.strictEqual(status.get(), 500);
|
|
49
|
+
});
|
|
50
|
+
it('should return this for chaining', () => {
|
|
51
|
+
const status = HttpStatusWrap.fromScratch();
|
|
52
|
+
const that = status.set(301);
|
|
53
|
+
assert.strictEqual(that, status);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
describe('status checks', () => {
|
|
57
|
+
it('should check information status', () => {
|
|
58
|
+
const status = HttpStatusWrap.fromScratch();
|
|
59
|
+
assert.strictEqual(status.set(100).isInformation(), true);
|
|
60
|
+
assert.strictEqual(status.set(199).isInformation(), true);
|
|
61
|
+
assert.strictEqual(status.set(200).isInformation(), false);
|
|
62
|
+
});
|
|
63
|
+
it('should check success status', () => {
|
|
64
|
+
const status = HttpStatusWrap.fromScratch();
|
|
65
|
+
assert.strictEqual(status.set(200).isSuccess(), true);
|
|
66
|
+
assert.strictEqual(status.set(299).isSuccess(), true);
|
|
67
|
+
assert.strictEqual(status.set(300).isSuccess(), false);
|
|
68
|
+
});
|
|
69
|
+
it('should check redirect status', () => {
|
|
70
|
+
const status = HttpStatusWrap.fromScratch();
|
|
71
|
+
assert.strictEqual(status.set(300).isRedirect(), true);
|
|
72
|
+
assert.strictEqual(status.set(399).isRedirect(), true);
|
|
73
|
+
assert.strictEqual(status.set(400).isRedirect(), false);
|
|
74
|
+
});
|
|
75
|
+
it('should check client error status', () => {
|
|
76
|
+
const status = HttpStatusWrap.fromScratch();
|
|
77
|
+
assert.strictEqual(status.set(400).isClientError(), true);
|
|
78
|
+
assert.strictEqual(status.set(499).isClientError(), true);
|
|
79
|
+
assert.strictEqual(status.set(500).isClientError(), false);
|
|
80
|
+
});
|
|
81
|
+
it('should check server error status', () => {
|
|
82
|
+
const status = HttpStatusWrap.fromScratch();
|
|
83
|
+
assert.strictEqual(status.set(500).isServerError(), true);
|
|
84
|
+
assert.strictEqual(status.set(599).isServerError(), true);
|
|
85
|
+
assert.strictEqual(status.set(600).isServerError(), false);
|
|
86
|
+
});
|
|
87
|
+
it('should check unknown status', () => {
|
|
88
|
+
const status = HttpStatusWrap.fromScratch();
|
|
89
|
+
assert.strictEqual(status.set(999).isUnknown(), true);
|
|
90
|
+
assert.strictEqual(status.set(200).isUnknown(), false);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
describe('reset', () => {
|
|
94
|
+
it('should reset to default value', () => {
|
|
95
|
+
const status = new HttpStatusWrap(404);
|
|
96
|
+
status.reset();
|
|
97
|
+
assert.strictEqual(status.get(), 0);
|
|
98
|
+
});
|
|
99
|
+
it('should return this for chaining', () => {
|
|
100
|
+
const status = HttpStatusWrap.fromScratch();
|
|
101
|
+
const that = status.reset();
|
|
102
|
+
assert.strictEqual(that, status);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=status.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.test.js","sourceRoot":"","sources":["../src/status.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,EAAE,CAAA;YAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;YAC9B,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;YACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAA;YAC/B,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;YACxC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;YACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAA;YAC/B,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,G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AC,CAAC,CAAA"}
|
package/dist/ua-parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ua-parser.js","sourceRoot":"","sources":["../src/ua-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ua-parser.js","sourceRoot":"","sources":["../src/ua-parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA"}
|