@schorts/shared-kernel 2.2.3 → 2.2.4
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 +6 -0
- package/dist/cjs/value-objects/enum-value.js +1 -7
- package/dist/cjs/value-objects/enum-value.js.map +1 -1
- package/dist/esm/value-objects/enum-value.js +1 -7
- package/dist/esm/value-objects/enum-value.js.map +1 -1
- package/dist/types/value-objects/enum-value.d.ts +3 -4
- package/dist/types/value-objects/enum-value.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/value-objects/enum-value.ts +3 -8
package/CHANGELOG
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
### [2.2.4] - 2025-10-10
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Remove `Optional` param in the `EnumValue`. Instead allow null values in the `allowedTypes` array.
|
|
13
|
+
|
|
8
14
|
### [2.2.3] - 2025-10-10
|
|
9
15
|
|
|
10
16
|
### Changed
|
|
@@ -4,18 +4,12 @@ exports.EnumValue = void 0;
|
|
|
4
4
|
class EnumValue {
|
|
5
5
|
valueType = 'Enum';
|
|
6
6
|
allowedValues;
|
|
7
|
-
optional;
|
|
8
7
|
value;
|
|
9
|
-
constructor(allowedValues, value
|
|
8
|
+
constructor(allowedValues, value) {
|
|
10
9
|
this.allowedValues = allowedValues;
|
|
11
|
-
this.optional = optional;
|
|
12
10
|
this.value = value;
|
|
13
11
|
}
|
|
14
12
|
get isValid() {
|
|
15
|
-
if (this.optional && this.value === null)
|
|
16
|
-
return true;
|
|
17
|
-
if (!this.optional && this.value === null)
|
|
18
|
-
return false;
|
|
19
13
|
return this.allowedValues.includes(this.value);
|
|
20
14
|
}
|
|
21
15
|
equals(valueObject) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-value.js","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":";;;AAEA,MAAsB,SAAS;IACpB,SAAS,GAAG,MAAM,CAAC;IACnB,aAAa,CAAS;IACtB,
|
|
1
|
+
{"version":3,"file":"enum-value.js","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":";;;AAEA,MAAsB,SAAS;IACpB,SAAS,GAAG,MAAM,CAAC;IACnB,aAAa,CAAS;IACtB,KAAK,CAAO;IAErB,YAAY,aAAqB,EAAE,KAAW;QAC5C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAa,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,WAAoB;QACzB,IAAI,CAAC,CAAC,WAAW,YAAY,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAExD,OAAO,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK,CAAC;IAC1C,CAAC;CAGF;AAtBD,8BAsBC"}
|
|
@@ -4,18 +4,12 @@ exports.EnumValue = void 0;
|
|
|
4
4
|
class EnumValue {
|
|
5
5
|
valueType = 'Enum';
|
|
6
6
|
allowedValues;
|
|
7
|
-
optional;
|
|
8
7
|
value;
|
|
9
|
-
constructor(allowedValues, value
|
|
8
|
+
constructor(allowedValues, value) {
|
|
10
9
|
this.allowedValues = allowedValues;
|
|
11
|
-
this.optional = optional;
|
|
12
10
|
this.value = value;
|
|
13
11
|
}
|
|
14
12
|
get isValid() {
|
|
15
|
-
if (this.optional && this.value === null)
|
|
16
|
-
return true;
|
|
17
|
-
if (!this.optional && this.value === null)
|
|
18
|
-
return false;
|
|
19
13
|
return this.allowedValues.includes(this.value);
|
|
20
14
|
}
|
|
21
15
|
equals(valueObject) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-value.js","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":";;;AAEA,MAAsB,SAAS;IACpB,SAAS,GAAG,MAAM,CAAC;IACnB,aAAa,CAAS;IACtB,
|
|
1
|
+
{"version":3,"file":"enum-value.js","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":";;;AAEA,MAAsB,SAAS;IACpB,SAAS,GAAG,MAAM,CAAC;IACnB,aAAa,CAAS;IACtB,KAAK,CAAO;IAErB,YAAY,aAAqB,EAAE,KAAW;QAC5C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAa,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,WAAoB;QACzB,IAAI,CAAC,CAAC,WAAW,YAAY,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAExD,OAAO,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK,CAAC;IAC1C,CAAC;CAGF;AAtBD,8BAsBC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ValueObject } from './';
|
|
2
|
-
export declare abstract class EnumValue<Type extends string> implements ValueObject {
|
|
2
|
+
export declare abstract class EnumValue<Type extends string | null> implements ValueObject {
|
|
3
3
|
readonly valueType = "Enum";
|
|
4
4
|
readonly allowedValues: Type[];
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
constructor(allowedValues: Type[], value: Type | null, optional?: boolean);
|
|
5
|
+
readonly value: Type;
|
|
6
|
+
constructor(allowedValues: Type[], value: Type);
|
|
8
7
|
get isValid(): boolean;
|
|
9
8
|
equals(valueObject: unknown): boolean;
|
|
10
9
|
abstract readonly attributeName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-value.d.ts","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,8BAAsB,SAAS,CAAC,IAAI,SAAS,MAAM,CAAE,YAAW,WAAW;
|
|
1
|
+
{"version":3,"file":"enum-value.d.ts","sourceRoot":"","sources":["../../../src/value-objects/enum-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,8BAAsB,SAAS,CAAC,IAAI,SAAS,MAAM,GAAG,IAAI,CAAE,YAAW,WAAW;IAChF,QAAQ,CAAC,SAAS,UAAU;IAC5B,QAAQ,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;gBAET,aAAa,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI;IAK9C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,MAAM,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAOrC,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schorts/shared-kernel",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "A modular, type-safe foundation for building expressive, maintainable applications. This package provides core abstractions for domain modeling, HTTP integration, authentication, state management, and more — designed to be framework-agnostic and highly extensible.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { ValueObject } from './';
|
|
2
2
|
|
|
3
|
-
export abstract class EnumValue<Type extends string> implements ValueObject {
|
|
3
|
+
export abstract class EnumValue<Type extends string | null> implements ValueObject {
|
|
4
4
|
readonly valueType = 'Enum';
|
|
5
5
|
readonly allowedValues: Type[];
|
|
6
|
-
readonly
|
|
7
|
-
readonly value: Type | null;
|
|
6
|
+
readonly value: Type;
|
|
8
7
|
|
|
9
|
-
constructor(allowedValues: Type[], value: Type
|
|
8
|
+
constructor(allowedValues: Type[], value: Type) {
|
|
10
9
|
this.allowedValues = allowedValues;
|
|
11
|
-
this.optional = optional;
|
|
12
10
|
this.value = value;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
get isValid(): boolean {
|
|
16
|
-
if (this.optional && this.value === null) return true;
|
|
17
|
-
if (!this.optional && this.value === null) return false;
|
|
18
|
-
|
|
19
14
|
return this.allowedValues.includes(this.value as Type);
|
|
20
15
|
}
|
|
21
16
|
|