@schorts/shared-kernel 2.3.1 → 2.3.3
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 +12 -0
- package/README.md +4 -0
- package/dist/cjs/rbac/exceptions/index.js +6 -0
- package/dist/cjs/rbac/exceptions/index.js.map +1 -0
- package/dist/cjs/rbac/exceptions/not-authorized.js +7 -0
- package/dist/cjs/rbac/exceptions/not-authorized.js.map +1 -0
- package/dist/cjs/rbac/index.js +15 -0
- package/dist/cjs/rbac/index.js.map +1 -1
- package/dist/cjs/value-objects/exceptions/value-not-valid.js +3 -0
- package/dist/cjs/value-objects/exceptions/value-not-valid.js.map +1 -0
- package/dist/cjs/value-objects/exceptions/values-not-valid.js.map +1 -1
- package/dist/esm/rbac/exceptions/index.js +6 -0
- package/dist/esm/rbac/exceptions/index.js.map +1 -0
- package/dist/esm/rbac/exceptions/not-authorized.js +7 -0
- package/dist/esm/rbac/exceptions/not-authorized.js.map +1 -0
- package/dist/esm/rbac/index.js +15 -0
- package/dist/esm/rbac/index.js.map +1 -1
- package/dist/esm/value-objects/exceptions/value-not-valid.js +3 -0
- package/dist/esm/value-objects/exceptions/value-not-valid.js.map +1 -0
- package/dist/esm/value-objects/exceptions/values-not-valid.js.map +1 -1
- package/dist/types/rbac/exceptions/index.d.ts +2 -0
- package/dist/types/rbac/exceptions/index.d.ts.map +1 -0
- package/dist/types/rbac/exceptions/not-authorized.d.ts +3 -0
- package/dist/types/rbac/exceptions/not-authorized.d.ts.map +1 -0
- package/dist/types/rbac/index.d.ts +1 -0
- package/dist/types/rbac/index.d.ts.map +1 -1
- package/dist/types/value-objects/exceptions/index.d.ts +1 -0
- package/dist/types/value-objects/exceptions/index.d.ts.map +1 -1
- package/dist/types/value-objects/exceptions/value-not-valid.d.ts +4 -0
- package/dist/types/value-objects/exceptions/value-not-valid.d.ts.map +1 -0
- package/dist/types/value-objects/exceptions/values-not-valid.d.ts +3 -2
- package/dist/types/value-objects/exceptions/values-not-valid.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/rbac/exceptions/index.ts +1 -0
- package/src/rbac/exceptions/not-authorized.ts +1 -0
- package/src/rbac/index.ts +1 -0
- package/src/value-objects/exceptions/index.ts +1 -0
- package/src/value-objects/exceptions/value-not-valid.ts +3 -0
- package/src/value-objects/exceptions/values-not-valid.ts +4 -2
package/CHANGELOG
CHANGED
|
@@ -5,6 +5,18 @@ 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.3.3] - 2025-10-11
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `ValueNotValid` exception.
|
|
13
|
+
|
|
14
|
+
## [2.3.2] - 2025-10-11
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Added `NotAuthorized` exception.
|
|
19
|
+
|
|
8
20
|
## [2.3.1] - 2025-10-11
|
|
9
21
|
|
|
10
22
|
### Changed
|
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@ npm install @schorts/shared-kernel --save
|
|
|
15
15
|
- **AuthProvider:** Abstract interface for authentication strategies.
|
|
16
16
|
- **RequireAuthDecorator:** Method-level decorator for enforcing authentication.
|
|
17
17
|
|
|
18
|
+
### 🛡️ RBAC (Role-Based Access Control)
|
|
19
|
+
- **RBACPolicy:** Abstract base class for defining role-based permission logic. Supports wildcard actions (manage) and resources (*), ownership checks, and composable access control strategies.
|
|
20
|
+
- **Permission:** Lightweight value object representing an action-resource pair (e.g., read:orders, manage:*).
|
|
21
|
+
|
|
18
22
|
### 📊 Criteria
|
|
19
23
|
|
|
20
24
|
- **Criteria:** Fluent query builder for filtering, sorting, and pagination.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotAuthorized = void 0;
|
|
4
|
+
var not_authorized_1 = require("./not-authorized");
|
|
5
|
+
Object.defineProperty(exports, "NotAuthorized", { enumerable: true, get: function () { return not_authorized_1.NotAuthorized; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rbac/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-authorized.js","sourceRoot":"","sources":["../../../../src/rbac/exceptions/not-authorized.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;CAAG;AAA3C,sCAA2C"}
|
package/dist/cjs/rbac/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.RBACPolicy = void 0;
|
|
4
18
|
var rbac_policy_1 = require("./rbac-policy");
|
|
5
19
|
Object.defineProperty(exports, "RBACPolicy", { enumerable: true, get: function () { return rbac_policy_1.RBACPolicy; } });
|
|
20
|
+
__exportStar(require("./exceptions"), exports);
|
|
6
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/value-not-valid.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"values-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAe,SAAQ,KAAK;IAC9B,MAAM,CAAuB;IAEtC,YAAY,MAA4B;QACtC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AARD,wCAQC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotAuthorized = void 0;
|
|
4
|
+
var not_authorized_1 = require("./not-authorized");
|
|
5
|
+
Object.defineProperty(exports, "NotAuthorized", { enumerable: true, get: function () { return not_authorized_1.NotAuthorized; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rbac/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-authorized.js","sourceRoot":"","sources":["../../../../src/rbac/exceptions/not-authorized.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;CAAG;AAA3C,sCAA2C"}
|
package/dist/esm/rbac/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.RBACPolicy = void 0;
|
|
4
18
|
var rbac_policy_1 = require("./rbac-policy");
|
|
5
19
|
Object.defineProperty(exports, "RBACPolicy", { enumerable: true, get: function () { return rbac_policy_1.RBACPolicy; } });
|
|
20
|
+
__exportStar(require("./exceptions"), exports);
|
|
6
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/value-not-valid.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"values-not-valid.js","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAe,SAAQ,KAAK;IAC9B,MAAM,CAAuB;IAEtC,YAAY,MAA4B;QACtC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AARD,wCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rbac/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-authorized.d.ts","sourceRoot":"","sources":["../../../../src/rbac/exceptions/not-authorized.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rbac/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-not-valid.d.ts","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/value-not-valid.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ValueNotValid } from "./value-not-valid";
|
|
1
2
|
export declare class ValuesNotValid extends Error {
|
|
2
|
-
readonly errors: Array<
|
|
3
|
-
constructor(errors: Array<
|
|
3
|
+
readonly errors: Array<ValueNotValid>;
|
|
4
|
+
constructor(errors: Array<ValueNotValid>);
|
|
4
5
|
}
|
|
5
6
|
//# sourceMappingURL=values-not-valid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values-not-valid.d.ts","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"values-not-valid.d.ts","sourceRoot":"","sources":["../../../../src/value-objects/exceptions/values-not-valid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAE1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC;CAKzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schorts/shared-kernel",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
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",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NotAuthorized } from "./not-authorized";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class NotAuthorized extends Error {}
|
package/src/rbac/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ValueNotValid } from "./value-not-valid";
|
|
2
|
+
|
|
1
3
|
export class ValuesNotValid extends Error {
|
|
2
|
-
readonly errors: Array<
|
|
4
|
+
readonly errors: Array<ValueNotValid>;
|
|
3
5
|
|
|
4
|
-
constructor(errors: Array<
|
|
6
|
+
constructor(errors: Array<ValueNotValid>) {
|
|
5
7
|
super();
|
|
6
8
|
|
|
7
9
|
this.errors = errors;
|