@loadmill/universal 0.3.32 → 0.3.36
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/dist/manipulation-utils.d.ts +1 -1
- package/dist/uri-utils.js +1 -1
- package/dist/uri-utils.js.map +1 -1
- package/package.json +5 -2
- package/src/uri-utils.ts +1 -1
- package/test/cron-utils.spec.js +2 -0
- package/test/manipulation-utils.spec.js +2 -0
- package/test/object-map.spec.js +1 -0
- package/test/uri-utils.spec.ts +72 -0
- package/yarn-error.log +69 -0
- package/test/uri-utils.spec.js +0 -38
|
@@ -3,7 +3,7 @@ export declare function firstKey(obj: any): string;
|
|
|
3
3
|
export declare function objToSingletonArray(obj: {}, sort?: boolean): {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
}[];
|
|
6
|
-
export declare function firstKeyComparator(o1: any, o2: any):
|
|
6
|
+
export declare function firstKeyComparator(o1: any, o2: any): 0 | 1 | -1;
|
|
7
7
|
/**
|
|
8
8
|
* {"a":1, "b":2} => [{"a":1}, {"b":2}]
|
|
9
9
|
*/
|
package/dist/uri-utils.js
CHANGED
|
@@ -39,7 +39,7 @@ function stripProtocol(urlish) {
|
|
|
39
39
|
if (isUrlStartsWithSupportedProtocol(urlish, '://')) {
|
|
40
40
|
var url = new urijs_1.default(urlish);
|
|
41
41
|
var protocolLength = url.protocol().length;
|
|
42
|
-
return urlish.substring(protocolLength, urlish.length);
|
|
42
|
+
return urlish.substring(protocolLength + 3, urlish.length);
|
|
43
43
|
}
|
|
44
44
|
return urlish;
|
|
45
45
|
}
|
package/dist/uri-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uri-utils.js","sourceRoot":"","sources":["../src/uri-utils.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,IAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAE3D,IAAM,gCAAg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E,CAAC,MAAM,CAAC;QAC7C,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;KAC5D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,sCAQC;AAED,SAAgB,UAAU,CAAC,OAAe;IACxC,OAAO,eAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,OAAe;IACxC,OAAO,eAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,MAAc,EAAE,eAAyB;IAClE,OAAO,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,UAAC,cAAc;QAC3C,OAAA,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC;IAAnC,CAAmC,CACpC,CAAC;AACJ,CAAC;AAJD,gCAIC;AAED,SAAgB,UAAU,CAAE,GAAW;IACrC,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAFD,gCAEC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,OAAe,EAAE,OAAe;IACnD,OAAO,OAAO,KAAK,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadmill/universal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
4
4
|
"description": "Loadmill universal utilities",
|
|
5
5
|
"main": "dist/",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"ts-watch": "rimraf dist && tsc -w -p tsconfig.json",
|
|
10
10
|
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
11
11
|
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
12
|
-
"prepublish": "yarn build"
|
|
12
|
+
"prepublish": "yarn build",
|
|
13
|
+
"unit-test": "run-p unit-test-*",
|
|
14
|
+
"unit-test-ts": "mocha --require ts-node/register/transpile-only --ui tdd \"test/uri-utils.spec.ts\"",
|
|
15
|
+
"unit-test-js": "mocha --ui tdd \"test/*.spec.js\""
|
|
13
16
|
},
|
|
14
17
|
"engines": {
|
|
15
18
|
"node": ">=12.0.0"
|
package/src/uri-utils.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function stripProtocol(urlish: string) {
|
|
|
36
36
|
if (isUrlStartsWithSupportedProtocol(urlish, '://')) {
|
|
37
37
|
const url = new URI(urlish);
|
|
38
38
|
const protocolLength = url.protocol().length;
|
|
39
|
-
return urlish.substring(protocolLength, urlish.length);
|
|
39
|
+
return urlish.substring(protocolLength + 3, urlish.length);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
return urlish;
|
package/test/cron-utils.spec.js
CHANGED
package/test/object-map.spec.js
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { describe, it } from 'mocha';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
|
|
4
|
+
import { isVerified, stripProtocol } from '../src/uri-utils';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe('domain-utils', () => {
|
|
8
|
+
describe('isVerified', () => {
|
|
9
|
+
it('true when domains are the same', () => {
|
|
10
|
+
const resolved = 'www.rivi.com';
|
|
11
|
+
expect(isVerified(resolved, [resolved])).to.eql(true);
|
|
12
|
+
});
|
|
13
|
+
it('false when domains aren\'t the same', () => {
|
|
14
|
+
const resolvedA = 'www.rivi.com';
|
|
15
|
+
const resolvedB = 'www.shimi.com';
|
|
16
|
+
expect(isVerified(resolvedA, [resolvedB])).to.eql(false);
|
|
17
|
+
});
|
|
18
|
+
it('true when parent include the child', () => {
|
|
19
|
+
const child = 'shimi.rivi.com';
|
|
20
|
+
const paernt = 'rivi.com';
|
|
21
|
+
expect(isVerified(child, [paernt])).to.eql(true);
|
|
22
|
+
});
|
|
23
|
+
it('false when parent include the child with *', () => {
|
|
24
|
+
const child = 'shimi.rivi.com';
|
|
25
|
+
const paernt = '*.rivi.com';
|
|
26
|
+
expect(isVerified(child, [paernt])).to.eql(false);
|
|
27
|
+
});
|
|
28
|
+
it('false when parent include the child with two *', () => {
|
|
29
|
+
const child = 'shimi.rivi.com';
|
|
30
|
+
const paernt = '**.rivi.com';
|
|
31
|
+
expect(isVerified(child, [paernt])).to.eql(false);
|
|
32
|
+
});
|
|
33
|
+
it('false when parent include the child with two *.', () => {
|
|
34
|
+
const child = 'shimi.rivi.com';
|
|
35
|
+
const paernt = '*.*.rivi.com';
|
|
36
|
+
expect(isVerified(child, [paernt])).to.eql(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('stripProtocol', () => {
|
|
40
|
+
|
|
41
|
+
const nakedUrl = 'rivi.com';
|
|
42
|
+
const wwwUrl = 'www.rivi.com';
|
|
43
|
+
const httpUrl = 'http://' + wwwUrl;
|
|
44
|
+
const httpsUrl = 'https://' + wwwUrl;
|
|
45
|
+
const wsUrl = 'ws://' + wwwUrl;
|
|
46
|
+
const wssUrl = 'wss://' + wwwUrl;
|
|
47
|
+
const wrongProtocolUrl = 'wss:/' + wwwUrl;
|
|
48
|
+
|
|
49
|
+
it('should return the same for naked domain', () => {
|
|
50
|
+
expect(stripProtocol(nakedUrl)).to.eql(nakedUrl);
|
|
51
|
+
});
|
|
52
|
+
it('should return the same for wwwUrl', () => {
|
|
53
|
+
expect(stripProtocol(wwwUrl)).to.eql(wwwUrl);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should return wwwUrl for httpUrl domain', () => {
|
|
57
|
+
expect(stripProtocol(httpUrl)).to.eql(wwwUrl);
|
|
58
|
+
});
|
|
59
|
+
it('should return wwwUrl for httpsUrl domain', () => {
|
|
60
|
+
expect(stripProtocol(httpsUrl)).to.eql(wwwUrl);
|
|
61
|
+
});
|
|
62
|
+
it('should return wwwUrl for wsUrl domain', () => {
|
|
63
|
+
expect(stripProtocol(wsUrl)).to.eql(wwwUrl);
|
|
64
|
+
});
|
|
65
|
+
it('should return wwwUrl for wssUrl domain', () => {
|
|
66
|
+
expect(stripProtocol(wssUrl)).to.eql(wwwUrl);
|
|
67
|
+
});
|
|
68
|
+
it('should return with wrong protocol for wrong protocol domain', () => {
|
|
69
|
+
expect(stripProtocol(wrongProtocolUrl)).to.eql(wrongProtocolUrl);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
package/yarn-error.log
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/yigal/.nvm/versions/node/v14.18.0/bin/node /Users/yigal/.nvm/versions/node/v14.18.0/bin/yarn unit-test
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/usr/local/opt/postgresql@9.6/bin:/Users/yigal/.nvm/versions/node/v14.18.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.15
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
14.18.0
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin x64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
SyntaxError: /Users/yigal/ws/lm/loadmill/packages/universal/package.json: Unexpected string in JSON at position 533
|
|
18
|
+
at JSON.parse (<anonymous>)
|
|
19
|
+
at /Users/yigal/.nvm/versions/node/v14.18.0/lib/node_modules/yarn/lib/cli.js:1625:59
|
|
20
|
+
at Generator.next (<anonymous>)
|
|
21
|
+
at step (/Users/yigal/.nvm/versions/node/v14.18.0/lib/node_modules/yarn/lib/cli.js:310:30)
|
|
22
|
+
at /Users/yigal/.nvm/versions/node/v14.18.0/lib/node_modules/yarn/lib/cli.js:321:13
|
|
23
|
+
|
|
24
|
+
npm manifest:
|
|
25
|
+
{
|
|
26
|
+
"name": "@loadmill/universal",
|
|
27
|
+
"version": "0.3.34",
|
|
28
|
+
"description": "Loadmill universal utilities",
|
|
29
|
+
"main": "dist/",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"module": "src/",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"ts-watch": "rimraf dist && tsc -w -p tsconfig.json",
|
|
34
|
+
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
35
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
36
|
+
"prepublish": "yarn build",
|
|
37
|
+
"unit-test": "run-p unit-test-*",
|
|
38
|
+
"unit-test-ts": "mocha --require ts-node/register/transpile-only --ui tdd \"test/uri-utils.spec.ts\""
|
|
39
|
+
"unit-test-js": "mocha --require --ui tdd \"test/*.spec.js\""
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=12.0.0"
|
|
43
|
+
},
|
|
44
|
+
"license": "Apache-2.0",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/source-map-support": "^0.4.0",
|
|
47
|
+
"@types/stack-trace": "^0.0.29"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"chalk": "^4.1.0",
|
|
51
|
+
"circular-json": "^0.5.1",
|
|
52
|
+
"country-list": "^2.1.0",
|
|
53
|
+
"cron-parser": "^2.13.0",
|
|
54
|
+
"cronstrue": "^1.83.0",
|
|
55
|
+
"dayjs": "^1.10.5",
|
|
56
|
+
"log4js": "3.0.4",
|
|
57
|
+
"quickselect": "^2.0.0",
|
|
58
|
+
"source-map-support": "^0.5.0",
|
|
59
|
+
"stack-trace": "^0.0.10",
|
|
60
|
+
"urijs": "^1.18.1",
|
|
61
|
+
"uuid": "^3.0.1"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
yarn manifest:
|
|
66
|
+
No manifest
|
|
67
|
+
|
|
68
|
+
Lockfile:
|
|
69
|
+
No lockfile
|
package/test/uri-utils.spec.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { expect } = require('chai');
|
|
2
|
-
|
|
3
|
-
const { isVerified } = require('../dist/uri-utils');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
describe('domain-utils', () => {
|
|
7
|
-
describe('isVerified', () => {
|
|
8
|
-
it('true when domains are the same', () => {
|
|
9
|
-
const resolved = 'www.rivi.com';
|
|
10
|
-
expect(isVerified(resolved, [resolved])).to.eql(true);
|
|
11
|
-
});
|
|
12
|
-
it('false when domains aren\'t the same', () => {
|
|
13
|
-
const resolvedA = 'www.rivi.com';
|
|
14
|
-
const resolvedB = 'www.shimi.com';
|
|
15
|
-
expect(isVerified(resolvedA, [resolvedB])).to.eql(false);
|
|
16
|
-
});
|
|
17
|
-
it('true when parent include the child', () => {
|
|
18
|
-
const child = 'shimi.rivi.com';
|
|
19
|
-
const paernt = 'rivi.com';
|
|
20
|
-
expect(isVerified(child, [paernt])).to.eql(true);
|
|
21
|
-
});
|
|
22
|
-
it('false when parent include the child with *', () => {
|
|
23
|
-
const child = 'shimi.rivi.com';
|
|
24
|
-
const paernt = '*.rivi.com';
|
|
25
|
-
expect(isVerified(child, [paernt])).to.eql(false);
|
|
26
|
-
});
|
|
27
|
-
it('false when parent include the child with two *', () => {
|
|
28
|
-
const child = 'shimi.rivi.com';
|
|
29
|
-
const paernt = '**.rivi.com';
|
|
30
|
-
expect(isVerified(child, [paernt])).to.eql(false);
|
|
31
|
-
});
|
|
32
|
-
it('false when parent include the child with two *.', () => {
|
|
33
|
-
const child = 'shimi.rivi.com';
|
|
34
|
-
const paernt = '*.*.rivi.com';
|
|
35
|
-
expect(isVerified(child, [paernt])).to.eql(false);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|