@cratis/arc 22.145.0 → 22.147.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/dist/cjs/reflection/SliceLocation.d.ts +2 -0
- package/dist/cjs/reflection/SliceLocation.d.ts.map +1 -1
- package/dist/cjs/reflection/SliceLocation.js +12 -0
- package/dist/cjs/reflection/SliceLocation.js.map +1 -1
- package/dist/esm/reflection/SliceLocation.d.ts +2 -0
- package/dist/esm/reflection/SliceLocation.d.ts.map +1 -1
- package/dist/esm/reflection/SliceLocation.js +12 -0
- package/dist/esm/reflection/SliceLocation.js.map +1 -1
- package/dist/esm/reflection/for_SliceLocation/when_checking_if_it_is_empty.d.ts +2 -0
- package/dist/esm/reflection/for_SliceLocation/when_checking_if_it_is_empty.d.ts.map +1 -0
- package/dist/esm/reflection/for_SliceLocation/when_checking_if_it_is_empty.js +7 -0
- package/dist/esm/reflection/for_SliceLocation/when_checking_if_it_is_empty.js.map +1 -0
- package/dist/esm/reflection/for_SliceLocation/when_comparing.d.ts +2 -0
- package/dist/esm/reflection/for_SliceLocation/when_comparing.d.ts.map +1 -0
- package/dist/esm/reflection/for_SliceLocation/when_comparing.js +9 -0
- package/dist/esm/reflection/for_SliceLocation/when_comparing.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/reflection/SliceLocation.ts +16 -0
- package/reflection/for_SliceLocation/when_checking_if_it_is_empty.ts +10 -0
- package/reflection/for_SliceLocation/when_comparing.ts +13 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@cratis/arc",
|
|
4
|
-
"version": "22.
|
|
4
|
+
"version": "22.147.0",
|
|
5
5
|
"description": "TypeScript command, query, validation, identity, and messaging runtime for Cratis Arc — the CQRS application framework for ASP.NET Core — used by generated proxies.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cratis",
|
|
@@ -68,6 +68,22 @@ export class SliceLocation {
|
|
|
68
68
|
return SliceLocation.empty;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Gets whether every part is empty, meaning nothing is known about where something lives.
|
|
73
|
+
*/
|
|
74
|
+
get isEmpty(): boolean {
|
|
75
|
+
return this.module.length === 0 && this.feature.length === 0 && this.slice.length === 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Checks whether another slice location has the same module, feature and slice.
|
|
80
|
+
* @param other The slice location to compare with.
|
|
81
|
+
* @returns True when all parts are equal, false otherwise.
|
|
82
|
+
*/
|
|
83
|
+
equals(other: SliceLocation): boolean {
|
|
84
|
+
return this.module === other.module && this.feature === other.feature && this.slice === other.slice;
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
/**
|
|
72
88
|
* Gets the parts that are set, joined with a forward slash.
|
|
73
89
|
* @returns The slice location as a path, for example `Billing/Invoices/Pay`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SliceLocation } from '../SliceLocation.js';
|
|
5
|
+
|
|
6
|
+
describe('when checking if it is empty', () => {
|
|
7
|
+
it('should be empty when every part is empty', () => SliceLocation.empty.isEmpty.should.be.true);
|
|
8
|
+
it('should not be empty when only the slice is set', () => new SliceLocation('', '', 'Pay').isEmpty.should.be.false);
|
|
9
|
+
it('should not be empty when only the module is set', () => new SliceLocation('Billing', '', '').isEmpty.should.be.false);
|
|
10
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SliceLocation } from '../SliceLocation.js';
|
|
5
|
+
|
|
6
|
+
describe('when comparing', () => {
|
|
7
|
+
const location = new SliceLocation('Billing', 'Invoices', 'Pay');
|
|
8
|
+
|
|
9
|
+
it('should be equal to a location with the same parts', () => location.equals(new SliceLocation('Billing', 'Invoices', 'Pay')).should.be.true);
|
|
10
|
+
it('should not be equal when the module differs', () => location.equals(new SliceLocation('Sales', 'Invoices', 'Pay')).should.be.false);
|
|
11
|
+
it('should not be equal when the feature differs', () => location.equals(new SliceLocation('Billing', 'Orders', 'Pay')).should.be.false);
|
|
12
|
+
it('should not be equal when the slice differs', () => location.equals(new SliceLocation('Billing', 'Invoices', 'List')).should.be.false);
|
|
13
|
+
});
|