@rsdk/core 2.4.4-next.0 → 2.6.0-next.1
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/CHANGELOG.md +14 -0
- package/dist/config/parsers/url/exception.d.ts +7 -0
- package/dist/config/parsers/url/exception.js +25 -0
- package/dist/config/parsers/url/exception.js.map +1 -0
- package/dist/config/parsers/url/index.d.ts +1 -0
- package/dist/config/parsers/url/index.js +3 -0
- package/dist/config/parsers/url/index.js.map +1 -1
- package/dist/config/parsers/url/url.parser.d.ts +3 -0
- package/dist/config/parsers/url/url.parser.js +21 -1
- package/dist/config/parsers/url/url.parser.js.map +1 -1
- package/package.json +3 -3
- package/src/config/parsers/url/exception.ts +21 -0
- package/src/config/parsers/url/index.ts +1 -0
- package/src/config/parsers/url/url.parser.ts +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.6.0-next.1](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.0...v2.6.0-next.1) (2023-07-04)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **@rsdk/core:** unused check in url parser ([07f9140](https://github.com/R-Vision/rsdk/commit/07f91402aed2a3f13225e5bc70311de3341dcd2d))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add url-parser options ([7d589a9](https://github.com/R-Vision/rsdk/commit/7d589a9b822bc2f66825f2c67ddd6f44bd65e771))
|
|
15
|
+
|
|
16
|
+
# [2.5.0](https://github.com/R-Vision/rsdk/compare/v2.4.4-next.0...v2.5.0) (2023-06-23)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @rsdk/core
|
|
19
|
+
|
|
6
20
|
## [2.4.4-next.0](https://github.com/R-Vision/rsdk/compare/v2.4.3...v2.4.4-next.0) (2023-06-22)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @rsdk/core
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BootstrapException } from '../../../exceptions';
|
|
2
|
+
export declare class InvalidUrl extends BootstrapException {
|
|
3
|
+
constructor(str: string, cause: unknown);
|
|
4
|
+
}
|
|
5
|
+
export declare class InvalidProtocol extends BootstrapException {
|
|
6
|
+
constructor(expectedProtocol: string, protocol: string, url: URL);
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidProtocol = exports.InvalidUrl = void 0;
|
|
4
|
+
const exceptions_1 = require("../../../exceptions");
|
|
5
|
+
class InvalidUrl extends exceptions_1.BootstrapException {
|
|
6
|
+
constructor(str, cause) {
|
|
7
|
+
super(`Invalid url string: <${str}>`, {
|
|
8
|
+
cause,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.InvalidUrl = InvalidUrl;
|
|
13
|
+
class InvalidProtocol extends exceptions_1.BootstrapException {
|
|
14
|
+
constructor(expectedProtocol, protocol, url) {
|
|
15
|
+
super(`Invalid protocol: <${protocol}>, expected: ${expectedProtocol}`, {
|
|
16
|
+
details: {
|
|
17
|
+
protocol,
|
|
18
|
+
url,
|
|
19
|
+
expectedProtocol,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.InvalidProtocol = InvalidProtocol;
|
|
25
|
+
//# sourceMappingURL=exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../../src/config/parsers/url/exception.ts"],"names":[],"mappings":";;;AAAA,oDAAyD;AAEzD,MAAa,UAAW,SAAQ,+BAAkB;IAChD,YAAY,GAAW,EAAE,KAAc;QACrC,KAAK,CAAC,wBAAwB,GAAG,GAAG,EAAE;YACpC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AAND,gCAMC;AAED,MAAa,eAAgB,SAAQ,+BAAkB;IACrD,YAAY,gBAAwB,EAAE,QAAgB,EAAE,GAAQ;QAC9D,KAAK,CAAC,sBAAsB,QAAQ,gBAAgB,gBAAgB,EAAE,EAAE;YACtE,OAAO,EAAE;gBACP,QAAQ;gBACR,GAAG;gBACH,gBAAgB;aACjB;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAVD,0CAUC"}
|
|
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.InvalidUrl = void 0;
|
|
17
18
|
__exportStar(require("./url.parser"), exports);
|
|
19
|
+
var exception_1 = require("./exception");
|
|
20
|
+
Object.defineProperty(exports, "InvalidUrl", { enumerable: true, get: function () { return exception_1.InvalidUrl; } });
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/parsers/url/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/parsers/url/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,yCAAyC;AAAhC,uGAAA,UAAU,OAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
2
2
|
export declare class UrlParser implements PropertyParser<URL> {
|
|
3
|
+
readonly protocol?: string | undefined;
|
|
4
|
+
constructor(protocol?: string | undefined);
|
|
3
5
|
type(): string;
|
|
4
6
|
description(): string;
|
|
5
7
|
parse(value: RawConfigValue): URL;
|
|
8
|
+
private assertProtocol;
|
|
6
9
|
}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UrlParser = void 0;
|
|
4
4
|
const common_1 = require("@rsdk/common");
|
|
5
|
+
const exception_1 = require("./exception");
|
|
5
6
|
class UrlParser {
|
|
7
|
+
protocol;
|
|
8
|
+
constructor(protocol) {
|
|
9
|
+
this.protocol = protocol;
|
|
10
|
+
}
|
|
6
11
|
type() {
|
|
7
12
|
return 'URL';
|
|
8
13
|
}
|
|
@@ -11,7 +16,22 @@ class UrlParser {
|
|
|
11
16
|
}
|
|
12
17
|
parse(value) {
|
|
13
18
|
common_1.Assert.isString(value);
|
|
14
|
-
|
|
19
|
+
try {
|
|
20
|
+
const url = new URL(value);
|
|
21
|
+
this.assertProtocol(url);
|
|
22
|
+
return url;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
throw new exception_1.InvalidUrl(value, error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
assertProtocol(url) {
|
|
29
|
+
if (!this.protocol) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (url.protocol !== this.protocol) {
|
|
33
|
+
throw new exception_1.InvalidProtocol(this.protocol, url.protocol, url);
|
|
34
|
+
}
|
|
15
35
|
}
|
|
16
36
|
}
|
|
17
37
|
exports.UrlParser = UrlParser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.parser.js","sourceRoot":"","sources":["../../../../src/config/parsers/url/url.parser.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAItC,MAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"url.parser.js","sourceRoot":"","sources":["../../../../src/config/parsers/url/url.parser.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAItC,2CAA0D;AAE1D,MAAa,SAAS;IACC;IAArB,YAAqB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IAAG,CAAC;IAE1C,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,WAAW;QACT,OAAO,oCAAoC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,KAAqB;QACzB,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEvB,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;YAE3B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YACzB,OAAO,GAAG,CAAC;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,sBAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACpC;IACH,CAAC;IAEO,cAAc,CAAC,GAAQ;QAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE;YAClC,MAAM,IAAI,2BAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;SAC7D;IACH,CAAC;CACF;AAhCD,8BAgCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-next.1",
|
|
4
4
|
"description": "Nestjs based microservice chassis",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@nestjs/microservices": "^9.0.0",
|
|
33
33
|
"@rsdk/autodoc.protocol": "^2.4.2",
|
|
34
34
|
"@rsdk/common": "^2.4.2",
|
|
35
|
-
"@rsdk/decorators": "^2.
|
|
35
|
+
"@rsdk/decorators": "^2.5.0",
|
|
36
36
|
"@rsdk/logging": "^2.4.2",
|
|
37
37
|
"@rsdk/metadata": "^2.4.2",
|
|
38
38
|
"@rsdk/nest-tools": "^2.4.2",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
41
|
"rxjs": "^7.0.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "aa325d2181ddb9438fd4596bc2c793121ad3ef6f"
|
|
44
44
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BootstrapException } from '../../../exceptions';
|
|
2
|
+
|
|
3
|
+
export class InvalidUrl extends BootstrapException {
|
|
4
|
+
constructor(str: string, cause: unknown) {
|
|
5
|
+
super(`Invalid url string: <${str}>`, {
|
|
6
|
+
cause,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class InvalidProtocol extends BootstrapException {
|
|
12
|
+
constructor(expectedProtocol: string, protocol: string, url: URL) {
|
|
13
|
+
super(`Invalid protocol: <${protocol}>, expected: ${expectedProtocol}`, {
|
|
14
|
+
details: {
|
|
15
|
+
protocol,
|
|
16
|
+
url,
|
|
17
|
+
expectedProtocol,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -2,7 +2,11 @@ import { Assert } from '@rsdk/common';
|
|
|
2
2
|
|
|
3
3
|
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
4
|
|
|
5
|
+
import { InvalidProtocol, InvalidUrl } from './exception';
|
|
6
|
+
|
|
5
7
|
export class UrlParser implements PropertyParser<URL> {
|
|
8
|
+
constructor(readonly protocol?: string) {}
|
|
9
|
+
|
|
6
10
|
type(): string {
|
|
7
11
|
return 'URL';
|
|
8
12
|
}
|
|
@@ -14,6 +18,22 @@ export class UrlParser implements PropertyParser<URL> {
|
|
|
14
18
|
parse(value: RawConfigValue): URL {
|
|
15
19
|
Assert.isString(value);
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL(value);
|
|
23
|
+
|
|
24
|
+
this.assertProtocol(url);
|
|
25
|
+
return url;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw new InvalidUrl(value, error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private assertProtocol(url: URL): void {
|
|
32
|
+
if (!this.protocol) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (url.protocol !== this.protocol) {
|
|
36
|
+
throw new InvalidProtocol(this.protocol, url.protocol, url);
|
|
37
|
+
}
|
|
18
38
|
}
|
|
19
39
|
}
|