@rsdk/core 4.11.0-next.1 → 4.11.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/CHANGELOG.md +9 -1
- package/dist/config/parsers/string/string.parser.d.ts +2 -0
- package/dist/config/parsers/string/string.parser.js +11 -0
- package/dist/config/parsers/string/string.parser.js.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +2 -2
- package/src/config/parsers/string/string.parser.ts +7 -0
- package/src/config/parsers/string/string.spec.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
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
|
+
## [4.11.0](https://github.com/R-Vision/rsdk/compare/v4.11.0-next.0...v4.11.0) (2024-07-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add KAFKA_CONSUMER_GROUP env ([#248](https://github.com/R-Vision/rsdk/issues/248)) ([966922e](https://github.com/R-Vision/rsdk/commit/966922eda900a71df3bc260a1eb7cf6a3dc7e5c1))
|
|
11
|
+
|
|
6
12
|
## [4.11.0-next.1](https://github.com/R-Vision/rsdk/compare/v4.11.0-next.0...v4.11.0-next.1) (2024-07-04)
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* add KAFKA_CONSUMER_GROUP env ([#248](https://github.com/R-Vision/rsdk/issues/248)) ([966922e](https://github.com/R-Vision/rsdk/commit/966922eda900a71df3bc260a1eb7cf6a3dc7e5c1))
|
|
9
17
|
|
|
10
18
|
## [4.11.0-next.0](https://github.com/R-Vision/rsdk/compare/v4.10.2...v4.11.0-next.0) (2024-07-04)
|
|
11
19
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PropertyParser } from '../../types';
|
|
2
2
|
export declare class StringParser implements PropertyParser<string> {
|
|
3
|
+
private readonly pattern?;
|
|
4
|
+
constructor(pattern?: RegExp | undefined);
|
|
3
5
|
type(): string;
|
|
4
6
|
description(): string;
|
|
5
7
|
parse(value: unknown): string;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.StringParser = void 0;
|
|
4
7
|
const common_1 = require("@rsdk/common");
|
|
8
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
5
9
|
class StringParser {
|
|
10
|
+
pattern;
|
|
11
|
+
constructor(pattern) {
|
|
12
|
+
this.pattern = pattern;
|
|
13
|
+
}
|
|
6
14
|
type() {
|
|
7
15
|
return 'string';
|
|
8
16
|
}
|
|
@@ -11,6 +19,9 @@ class StringParser {
|
|
|
11
19
|
}
|
|
12
20
|
parse(value) {
|
|
13
21
|
common_1.Assert.isString(value);
|
|
22
|
+
if (this.pattern) {
|
|
23
|
+
(0, node_assert_1.default)(this.pattern.test(value));
|
|
24
|
+
}
|
|
14
25
|
return value;
|
|
15
26
|
}
|
|
16
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.parser.js","sourceRoot":"","sources":["../../../../src/config/parsers/string/string.parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.parser.js","sourceRoot":"","sources":["../../../../src/config/parsers/string/string.parser.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,8DAAiC;AAIjC,MAAa,YAAY;IACM;IAA7B,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,IAAI;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,WAAW;QACT,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,KAAc;QAClB,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEvB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAA,qBAAM,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AApBD,oCAoBC"}
|
package/jest.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@rsdk/jest/jest.config');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/core",
|
|
3
|
-
"version": "4.11.0
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Nestjs based microservice chassis",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
37
37
|
"rxjs": "^7.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a5238ec89d715d08fa1088e558131a64dcb96de1"
|
|
40
40
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Assert } from '@rsdk/common';
|
|
2
|
+
import assert from 'node:assert';
|
|
2
3
|
|
|
3
4
|
import type { PropertyParser } from '../../types';
|
|
4
5
|
|
|
5
6
|
export class StringParser implements PropertyParser<string> {
|
|
7
|
+
constructor(private readonly pattern?: RegExp) {}
|
|
8
|
+
|
|
6
9
|
type(): string {
|
|
7
10
|
return 'string';
|
|
8
11
|
}
|
|
@@ -14,6 +17,10 @@ export class StringParser implements PropertyParser<string> {
|
|
|
14
17
|
parse(value: unknown): string {
|
|
15
18
|
Assert.isString(value);
|
|
16
19
|
|
|
20
|
+
if (this.pattern) {
|
|
21
|
+
assert(this.pattern.test(value));
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
return value;
|
|
18
25
|
}
|
|
19
26
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StringParser } from './string.parser';
|
|
2
|
+
|
|
3
|
+
describe('StringMatcher', () => {
|
|
4
|
+
it('match', () => {
|
|
5
|
+
const parser = new StringParser(/^[a-z]+$/);
|
|
6
|
+
|
|
7
|
+
expect(parser.parse('abcd')).toBe('abcd');
|
|
8
|
+
expect(() => parser.parse('1234')).toThrow();
|
|
9
|
+
});
|
|
10
|
+
});
|