@cratis/arc 24.7.0 → 24.8.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/availability/Availability.ts +94 -19
- package/availability/AvailabilityReason.ts +7 -0
- package/availability/AvailableParts.ts +4 -0
- package/availability/ObserveAvailableParts.ts +22 -2
- package/availability/PartAvailability.ts +43 -0
- package/availability/UnavailablePart.ts +3 -0
- package/availability/askAvailability.ts +66 -0
- package/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_proxy_carries_its_identity.ts +24 -0
- package/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_server_lists_it_as_suspended.ts +20 -0
- package/availability/for_askAvailability/when_answering_for_a_part.ts +15 -0
- package/availability/index.ts +3 -0
- package/availability/isSuspended.ts +14 -0
- package/commands/CommandResult.ts +21 -0
- package/dist/cjs/availability/Availability.d.ts +18 -11
- package/dist/cjs/availability/Availability.d.ts.map +1 -1
- package/dist/cjs/availability/Availability.js +64 -12
- package/dist/cjs/availability/Availability.js.map +1 -1
- package/dist/cjs/availability/AvailabilityReason.d.ts +1 -0
- package/dist/cjs/availability/AvailabilityReason.d.ts.map +1 -1
- package/dist/cjs/availability/AvailabilityReason.js +6 -0
- package/dist/cjs/availability/AvailabilityReason.js.map +1 -1
- package/dist/cjs/availability/AvailableParts.d.ts +1 -0
- package/dist/cjs/availability/AvailableParts.d.ts.map +1 -1
- package/dist/cjs/availability/AvailableParts.js +5 -0
- package/dist/cjs/availability/AvailableParts.js.map +1 -1
- package/dist/cjs/availability/ObserveAvailableParts.d.ts +7 -1
- package/dist/cjs/availability/ObserveAvailableParts.d.ts.map +1 -1
- package/dist/cjs/availability/ObserveAvailableParts.js +10 -1
- package/dist/cjs/availability/ObserveAvailableParts.js.map +1 -1
- package/dist/cjs/availability/PartAvailability.d.ts +12 -0
- package/dist/cjs/availability/PartAvailability.d.ts.map +1 -0
- package/dist/cjs/availability/PartAvailability.js +41 -0
- package/dist/cjs/availability/PartAvailability.js.map +1 -0
- package/dist/cjs/availability/UnavailablePart.d.ts +1 -0
- package/dist/cjs/availability/UnavailablePart.d.ts.map +1 -1
- package/dist/cjs/availability/askAvailability.d.ts +6 -0
- package/dist/cjs/availability/askAvailability.d.ts.map +1 -0
- package/dist/cjs/availability/askAvailability.js +65 -0
- package/dist/cjs/availability/askAvailability.js.map +1 -0
- package/dist/cjs/availability/index.d.ts +3 -0
- package/dist/cjs/availability/index.d.ts.map +1 -1
- package/dist/cjs/availability/index.js +9 -0
- package/dist/cjs/availability/index.js.map +1 -1
- package/dist/cjs/availability/isSuspended.d.ts +5 -0
- package/dist/cjs/availability/isSuspended.d.ts.map +1 -0
- package/dist/cjs/availability/isSuspended.js +17 -0
- package/dist/cjs/availability/isSuspended.js.map +1 -0
- package/dist/cjs/commands/CommandResult.d.ts +2 -0
- package/dist/cjs/commands/CommandResult.d.ts.map +1 -1
- package/dist/cjs/commands/CommandResult.js +17 -0
- package/dist/cjs/commands/CommandResult.js.map +1 -1
- package/dist/cjs/reflection/PartIdentity.d.ts +8 -0
- package/dist/cjs/reflection/PartIdentity.d.ts.map +1 -0
- package/dist/cjs/reflection/PartIdentity.js +31 -0
- package/dist/cjs/reflection/PartIdentity.js.map +1 -0
- package/dist/cjs/reflection/index.d.ts +1 -0
- package/dist/cjs/reflection/index.d.ts.map +1 -1
- package/dist/cjs/reflection/index.js +2 -0
- package/dist/cjs/reflection/index.js.map +1 -1
- package/dist/esm/availability/Availability.d.ts +18 -11
- package/dist/esm/availability/Availability.d.ts.map +1 -1
- package/dist/esm/availability/Availability.js +64 -13
- package/dist/esm/availability/Availability.js.map +1 -1
- package/dist/esm/availability/AvailabilityReason.d.ts +1 -0
- package/dist/esm/availability/AvailabilityReason.d.ts.map +1 -1
- package/dist/esm/availability/AvailabilityReason.js +6 -1
- package/dist/esm/availability/AvailabilityReason.js.map +1 -1
- package/dist/esm/availability/AvailableParts.d.ts +1 -0
- package/dist/esm/availability/AvailableParts.d.ts.map +1 -1
- package/dist/esm/availability/AvailableParts.js +5 -0
- package/dist/esm/availability/AvailableParts.js.map +1 -1
- package/dist/esm/availability/ObserveAvailableParts.d.ts +7 -1
- package/dist/esm/availability/ObserveAvailableParts.d.ts.map +1 -1
- package/dist/esm/availability/ObserveAvailableParts.js +10 -1
- package/dist/esm/availability/ObserveAvailableParts.js.map +1 -1
- package/dist/esm/availability/PartAvailability.d.ts +12 -0
- package/dist/esm/availability/PartAvailability.d.ts.map +1 -0
- package/dist/esm/availability/PartAvailability.js +39 -0
- package/dist/esm/availability/PartAvailability.js.map +1 -0
- package/dist/esm/availability/UnavailablePart.d.ts +1 -0
- package/dist/esm/availability/UnavailablePart.d.ts.map +1 -1
- package/dist/esm/availability/askAvailability.d.ts +6 -0
- package/dist/esm/availability/askAvailability.d.ts.map +1 -0
- package/dist/esm/availability/askAvailability.js +62 -0
- package/dist/esm/availability/askAvailability.js.map +1 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_proxy_carries_its_identity.d.ts +2 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_proxy_carries_its_identity.d.ts.map +1 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_proxy_carries_its_identity.js +20 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_proxy_carries_its_identity.js.map +1 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_server_lists_it_as_suspended.d.ts +2 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_server_lists_it_as_suspended.d.ts.map +1 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_server_lists_it_as_suspended.js +16 -0
- package/dist/esm/availability/for_Availability/when_asking_whether_a_part_is_available/and_the_server_lists_it_as_suspended.js.map +1 -0
- package/dist/esm/availability/for_askAvailability/when_answering_for_a_part.d.ts +2 -0
- package/dist/esm/availability/for_askAvailability/when_answering_for_a_part.d.ts.map +1 -0
- package/dist/esm/availability/for_askAvailability/when_answering_for_a_part.js +11 -0
- package/dist/esm/availability/for_askAvailability/when_answering_for_a_part.js.map +1 -0
- package/dist/esm/availability/index.d.ts +3 -0
- package/dist/esm/availability/index.d.ts.map +1 -1
- package/dist/esm/availability/index.js +5 -2
- package/dist/esm/availability/index.js.map +1 -1
- package/dist/esm/availability/isSuspended.d.ts +5 -0
- package/dist/esm/availability/isSuspended.d.ts.map +1 -0
- package/dist/esm/availability/isSuspended.js +15 -0
- package/dist/esm/availability/isSuspended.js.map +1 -0
- package/dist/esm/commands/CommandResult.d.ts +2 -0
- package/dist/esm/commands/CommandResult.d.ts.map +1 -1
- package/dist/esm/commands/CommandResult.js +17 -0
- package/dist/esm/commands/CommandResult.js.map +1 -1
- package/dist/esm/reflection/PartIdentity.d.ts +8 -0
- package/dist/esm/reflection/PartIdentity.d.ts.map +1 -0
- package/dist/esm/reflection/PartIdentity.js +29 -0
- package/dist/esm/reflection/PartIdentity.js.map +1 -0
- package/dist/esm/reflection/index.d.ts +1 -0
- package/dist/esm/reflection/index.d.ts.map +1 -1
- package/dist/esm/reflection/index.js +1 -0
- package/dist/esm/reflection/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/reflection/PartIdentity.ts +21 -0
- package/reflection/index.ts +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class PartIdentity {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly module: string;
|
|
4
|
+
readonly feature: string;
|
|
5
|
+
readonly slice: string;
|
|
6
|
+
constructor(name: string, module: string, feature: string, slice: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=PartIdentity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartIdentity.d.ts","sourceRoot":"","sources":["../../../reflection/PartIdentity.ts"],"names":[],"mappings":"AAUA,qBAAa,YAAY;IAQT,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM;IAA5G,YAAqB,IAAI,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,EAAW,KAAK,EAAE,MAAM,EAC3G;CACJ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Represents which part of the application a generated command or query proxy is: the full name the server knows it
|
|
7
|
+
* by and the slice it belongs to.
|
|
8
|
+
* @remarks
|
|
9
|
+
* Generated proxies carry it as the static `part` member. It is identity only: the availability gate itself stays on the
|
|
10
|
+
* server, so a client asks the server whether the part is available and never decides on its own.
|
|
11
|
+
*/ class PartIdentity {
|
|
12
|
+
name;
|
|
13
|
+
module;
|
|
14
|
+
feature;
|
|
15
|
+
slice;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes a new instance of the {@link PartIdentity} class.
|
|
18
|
+
* @param name The full name of the command type, or of the type that declares the query, on the server.
|
|
19
|
+
* @param module The module the slice belongs to; empty when it has none.
|
|
20
|
+
* @param feature The feature the slice belongs to; empty when it has none.
|
|
21
|
+
* @param slice The slice itself; empty when it has none.
|
|
22
|
+
*/ constructor(name, module, feature, slice){
|
|
23
|
+
this.name = name;
|
|
24
|
+
this.module = module;
|
|
25
|
+
this.feature = feature;
|
|
26
|
+
this.slice = slice;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.PartIdentity = PartIdentity;
|
|
31
|
+
//# sourceMappingURL=PartIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartIdentity.js","sources":["../../../reflection/PartIdentity.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Represents which part of the application a generated command or query proxy is: the full name the server knows it\n * by and the slice it belongs to.\n * @remarks\n * Generated proxies carry it as the static `part` member. It is identity only: the availability gate itself stays on the\n * server, so a client asks the server whether the part is available and never decides on its own.\n */\nexport class PartIdentity {\n /**\n * Initializes a new instance of the {@link PartIdentity} class.\n * @param name The full name of the command type, or of the type that declares the query, on the server.\n * @param module The module the slice belongs to; empty when it has none.\n * @param feature The feature the slice belongs to; empty when it has none.\n * @param slice The slice itself; empty when it has none.\n */\n constructor(readonly name: string, readonly module: string, readonly feature: string, readonly slice: string) {\n }\n}\n"],"names":["PartIdentity","name","feature","module","slice"],"mappings":";;AAAA;AACA;AAEA;;;;;;AAMC,IACM,MAAMA,YAAAA,CAAAA;;;;;AACT;;;;;;AAMC,QACD,WAAA,CAAqBC,IAAY,EAAE,MAAuB,EAAWC,OAAe,EAAE,KAAsB,CAAE;aAAzFD,IAAAA,GAAAA,IAAAA;aAAuBE,MAAAA,GAAAA,MAAAA;aAAyBD,OAAAA,GAAAA,OAAAA;aAA0BE,KAAAA,GAAAA,KAAAA;AAC/F,IAAA;AACJ;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './IHaveParameters.js';
|
|
2
2
|
export * from './ParameterDescriptor.js';
|
|
3
3
|
export * from './ParametersHelper.js';
|
|
4
|
+
export * from './PartIdentity.js';
|
|
4
5
|
export * from './PropertyDescriptor.js';
|
|
5
6
|
export * from './SliceLocation.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../reflection/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../reflection/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ParameterDescriptor = require('./ParameterDescriptor.js');
|
|
4
4
|
var ParametersHelper = require('./ParametersHelper.js');
|
|
5
|
+
var PartIdentity = require('./PartIdentity.js');
|
|
5
6
|
var PropertyDescriptor = require('./PropertyDescriptor.js');
|
|
6
7
|
var SliceLocation = require('./SliceLocation.js');
|
|
7
8
|
|
|
@@ -10,6 +11,7 @@ var SliceLocation = require('./SliceLocation.js');
|
|
|
10
11
|
|
|
11
12
|
exports.ParameterDescriptor = ParameterDescriptor.ParameterDescriptor;
|
|
12
13
|
exports.ParametersHelper = ParametersHelper.ParametersHelper;
|
|
14
|
+
exports.PartIdentity = PartIdentity.PartIdentity;
|
|
13
15
|
exports.PropertyDescriptor = PropertyDescriptor.PropertyDescriptor;
|
|
14
16
|
exports.SliceLocation = SliceLocation.SliceLocation;
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../reflection/index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport * from './IHaveParameters.js';\nexport * from './ParameterDescriptor.js';\nexport * from './ParametersHelper.js';\nexport * from './PropertyDescriptor.js';\nexport * from './SliceLocation.js';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../reflection/index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport * from './IHaveParameters.js';\nexport * from './ParameterDescriptor.js';\nexport * from './ParametersHelper.js';\nexport * from './PartIdentity.js';\nexport * from './PropertyDescriptor.js';\nexport * from './SliceLocation.js';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;;;;;;"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { UnavailablePart } from './UnavailablePart.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { PartAvailability } from './PartAvailability.js';
|
|
3
|
+
interface Location {
|
|
4
|
+
readonly module: string;
|
|
5
|
+
readonly feature: string;
|
|
6
|
+
readonly slice: string;
|
|
7
|
+
}
|
|
8
|
+
interface Identity extends Location {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
}
|
|
11
|
+
export type AvailabilityPart = string | Identity | {
|
|
12
|
+
readonly part?: Identity;
|
|
13
|
+
readonly sliceLocation?: Location;
|
|
8
14
|
} | {
|
|
9
15
|
readonly constructor: {
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
readonly feature: string;
|
|
13
|
-
readonly slice: string;
|
|
14
|
-
};
|
|
16
|
+
readonly part?: Identity;
|
|
17
|
+
readonly sliceLocation?: Location;
|
|
15
18
|
};
|
|
16
19
|
};
|
|
20
|
+
export declare function partNameOf(part: AvailabilityPart): string | undefined;
|
|
17
21
|
export declare class Availability {
|
|
18
22
|
readonly unavailable: readonly UnavailablePart[];
|
|
19
23
|
readonly isKnown: boolean;
|
|
@@ -21,6 +25,9 @@ export declare class Availability {
|
|
|
21
25
|
static readonly everything: Availability;
|
|
22
26
|
constructor(unavailable: readonly UnavailablePart[], isKnown?: boolean);
|
|
23
27
|
isAvailable(part: AvailabilityPart): boolean;
|
|
28
|
+
availabilityOf(part: AvailabilityPart): PartAvailability;
|
|
24
29
|
filter<TItem>(items: readonly TItem[], partOf: (item: TItem) => AvailabilityPart | undefined): TItem[];
|
|
30
|
+
private find;
|
|
25
31
|
}
|
|
32
|
+
export {};
|
|
26
33
|
//# sourceMappingURL=Availability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Availability.d.ts","sourceRoot":"","sources":["../../../availability/Availability.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Availability.d.ts","sourceRoot":"","sources":["../../../availability/Availability.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,UAAU,QAAQ;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED,UAAU,QAAS,SAAQ,QAAQ;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAMD,MAAM,MAAM,gBAAgB,GACtB,MAAM,GACN,QAAQ,GACR;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;QAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAA;KAAE,CAAA;CAAE,CAAC;AAOhG,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAMrE;AAWD,qBAAa,YAAY;IAYT,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO;IAVvF,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAA+B;IAGpE,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAA8B;IAOtE,YAAqB,WAAW,EAAE,SAAS,eAAe,EAAE,EAAW,OAAO,GAAE,OAAc,EAC7F;IAQD,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAE3C;IAOD,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAOvD;IAQD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,gBAAgB,GAAG,SAAS,GAAG,KAAK,EAAE,CAKrG;IAED,OAAO,CAAC,IAAI;CAoBf"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
import { PartAvailability } from './PartAvailability.js';
|
|
2
|
+
|
|
1
3
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
4
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Gets the full name of a part, when it is known.
|
|
7
|
+
* @param part The full name, or a generated proxy or part identity.
|
|
8
|
+
* @returns The name the server knows the part by; undefined when the proxy does not carry one.
|
|
9
|
+
*/ function partNameOf(part) {
|
|
10
|
+
if (typeof part === 'string') {
|
|
11
|
+
return part;
|
|
12
|
+
}
|
|
13
|
+
return identityOf(part)?.name;
|
|
14
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* Represents what is available to the current context, from the last decision the server reported.
|
|
5
17
|
*
|
|
6
18
|
* Everything the server does not list is available. Until the first decision has arrived nothing is known, and
|
|
7
19
|
* nothing is reported as available, so a client never shows a part it has not been told it may show.
|
|
20
|
+
*
|
|
21
|
+
* This answers for the context alone, such as the tenant and the user. A gate that depends on the data a command or
|
|
22
|
+
* query is about, such as one vessel, is asked with `askAvailability` (or `useIsAvailable` in React), which sends the data.
|
|
8
23
|
*/ class Availability {
|
|
9
24
|
unavailable;
|
|
10
25
|
isKnown;
|
|
@@ -20,21 +35,22 @@
|
|
|
20
35
|
}
|
|
21
36
|
/**
|
|
22
37
|
* Determines whether a part is available.
|
|
23
|
-
* @param part The full name of a command or read model, or a generated proxy. A proxy is matched by the
|
|
24
|
-
* belongs to, so every part of a slice is hidden together, which is how navigation and screens are decided.
|
|
38
|
+
* @param part The full name of a command or read model, or a generated proxy. A proxy is matched by the part it is
|
|
39
|
+
* and by the slice it belongs to, so every part of a slice is hidden together, which is how navigation and screens are decided.
|
|
25
40
|
* @returns True when the part is available; false when it is not, or when nothing is known yet.
|
|
26
41
|
*/ isAvailable(part) {
|
|
42
|
+
return this.availabilityOf(part).isAvailable;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets whether, and if not why, a part is available.
|
|
46
|
+
* @param part The full name of a command or read model, or a generated proxy.
|
|
47
|
+
* @returns The {@link PartAvailability}; `NotAvailable` is told apart from `Suspended` by its reason.
|
|
48
|
+
*/ availabilityOf(part) {
|
|
27
49
|
if (!this.isKnown) {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
if (typeof part === 'string') {
|
|
31
|
-
return !this.unavailable.some((_)=>_.name === part);
|
|
32
|
-
}
|
|
33
|
-
const location = sliceLocationOf(part);
|
|
34
|
-
if (location === undefined || location.module === '' && location.feature === '' && location.slice === '') {
|
|
35
|
-
return true;
|
|
50
|
+
return PartAvailability.unknown;
|
|
36
51
|
}
|
|
37
|
-
|
|
52
|
+
const listed = this.find(part);
|
|
53
|
+
return listed === undefined ? PartAvailability.available : PartAvailability.refused(listed.reason);
|
|
38
54
|
}
|
|
39
55
|
/**
|
|
40
56
|
* Keeps the items whose part is available.
|
|
@@ -47,8 +63,43 @@
|
|
|
47
63
|
return part === undefined || this.isAvailable(part);
|
|
48
64
|
});
|
|
49
65
|
}
|
|
66
|
+
find(part) {
|
|
67
|
+
if (typeof part === 'string') {
|
|
68
|
+
return this.unavailable.find((_)=>_.name === part);
|
|
69
|
+
}
|
|
70
|
+
const identity = identityOf(part);
|
|
71
|
+
if (identity !== undefined) {
|
|
72
|
+
const byName = this.unavailable.find((_)=>_.name === identity.name);
|
|
73
|
+
if (byName !== undefined) {
|
|
74
|
+
return byName;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const location = locationOf(part, identity);
|
|
78
|
+
if (location === undefined || location.module === '' && location.feature === '' && location.slice === '') {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return this.unavailable.find((_)=>_.module === location.module && _.feature === location.feature && _.slice === location.slice);
|
|
82
|
+
}
|
|
50
83
|
}
|
|
51
|
-
function
|
|
84
|
+
function identityOf(part) {
|
|
85
|
+
// A proxy class declares its identity as the static `part`. An instance is read through its class only, because a
|
|
86
|
+
// command or query may itself have a property named `part`.
|
|
87
|
+
if (typeof part === 'function') {
|
|
88
|
+
return asIdentity(part.part);
|
|
89
|
+
}
|
|
90
|
+
return asIdentity(part) ?? asIdentity(part.constructor?.part);
|
|
91
|
+
}
|
|
92
|
+
function asIdentity(value) {
|
|
93
|
+
if (typeof value !== 'object' || value === null) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
const candidate = value;
|
|
97
|
+
return typeof candidate.name === 'string' && typeof candidate.module === 'string' && typeof candidate.feature === 'string' && typeof candidate.slice === 'string' ? value : undefined;
|
|
98
|
+
}
|
|
99
|
+
function locationOf(part, identity) {
|
|
100
|
+
if (identity !== undefined) {
|
|
101
|
+
return identity;
|
|
102
|
+
}
|
|
52
103
|
const own = part.sliceLocation;
|
|
53
104
|
if (own !== undefined) {
|
|
54
105
|
return own;
|
|
@@ -56,5 +107,5 @@ function sliceLocationOf(part) {
|
|
|
56
107
|
return part.constructor?.sliceLocation;
|
|
57
108
|
}
|
|
58
109
|
|
|
59
|
-
export { Availability };
|
|
110
|
+
export { Availability, partNameOf };
|
|
60
111
|
//# sourceMappingURL=Availability.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Availability.js","sources":["../../../availability/Availability.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UnavailablePart } from './UnavailablePart.js';\n\n/**\n * Something a client can ask about: the full name of a command or read model on the server, or a generated proxy\n * (class or instance) that carries the slice it belongs to.\n */\nexport type AvailabilityPart =\n | string\n | { readonly sliceLocation?: { readonly
|
|
1
|
+
{"version":3,"file":"Availability.js","sources":["../../../availability/Availability.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { UnavailablePart } from './UnavailablePart.js';\nimport { PartAvailability } from './PartAvailability.js';\n\ninterface Location {\n readonly module: string;\n readonly feature: string;\n readonly slice: string;\n}\n\ninterface Identity extends Location {\n readonly name: string;\n}\n\n/**\n * Something a client can ask about: the full name of a command or read model on the server, or a generated proxy\n * (class or instance) that carries the part it is and the slice it belongs to.\n */\nexport type AvailabilityPart =\n | string\n | Identity\n | { readonly part?: Identity; readonly sliceLocation?: Location }\n | { readonly constructor: { readonly part?: Identity; readonly sliceLocation?: Location } };\n\n/**\n * Gets the full name of a part, when it is known.\n * @param part The full name, or a generated proxy or part identity.\n * @returns The name the server knows the part by; undefined when the proxy does not carry one.\n */\nexport function partNameOf(part: AvailabilityPart): string | undefined {\n if (typeof part === 'string') {\n return part;\n }\n\n return identityOf(part)?.name;\n}\n\n/**\n * Represents what is available to the current context, from the last decision the server reported.\n *\n * Everything the server does not list is available. Until the first decision has arrived nothing is known, and\n * nothing is reported as available, so a client never shows a part it has not been told it may show.\n *\n * This answers for the context alone, such as the tenant and the user. A gate that depends on the data a command or\n * query is about, such as one vessel, is asked with `askAvailability` (or `useIsAvailable` in React), which sends the data.\n */\nexport class Availability {\n /** An availability that has not heard from the server yet. */\n static readonly unknown: Availability = new Availability([], false);\n\n /** An availability that treats every part as available, for hosts that do not use availability. */\n static readonly everything: Availability = new Availability([], true);\n\n /**\n * Initializes a new instance of {@link Availability}.\n * @param unavailable The parts the server reported as not available.\n * @param isKnown Whether a decision has arrived.\n */\n constructor(readonly unavailable: readonly UnavailablePart[], readonly isKnown: boolean = true) {\n }\n\n /**\n * Determines whether a part is available.\n * @param part The full name of a command or read model, or a generated proxy. A proxy is matched by the part it is\n * and by the slice it belongs to, so every part of a slice is hidden together, which is how navigation and screens are decided.\n * @returns True when the part is available; false when it is not, or when nothing is known yet.\n */\n isAvailable(part: AvailabilityPart): boolean {\n return this.availabilityOf(part).isAvailable;\n }\n\n /**\n * Gets whether, and if not why, a part is available.\n * @param part The full name of a command or read model, or a generated proxy.\n * @returns The {@link PartAvailability}; `NotAvailable` is told apart from `Suspended` by its reason.\n */\n availabilityOf(part: AvailabilityPart): PartAvailability {\n if (!this.isKnown) {\n return PartAvailability.unknown;\n }\n\n const listed = this.find(part);\n return listed === undefined ? PartAvailability.available : PartAvailability.refused(listed.reason);\n }\n\n /**\n * Keeps the items whose part is available.\n * @param items The items, for example navigation entries.\n * @param partOf Gets the part an item belongs to; an item without one is always kept.\n * @returns The items that are available.\n */\n filter<TItem>(items: readonly TItem[], partOf: (item: TItem) => AvailabilityPart | undefined): TItem[] {\n return items.filter(item => {\n const part = partOf(item);\n return part === undefined || this.isAvailable(part);\n });\n }\n\n private find(part: AvailabilityPart): UnavailablePart | undefined {\n if (typeof part === 'string') {\n return this.unavailable.find(_ => _.name === part);\n }\n\n const identity = identityOf(part);\n if (identity !== undefined) {\n const byName = this.unavailable.find(_ => _.name === identity.name);\n if (byName !== undefined) {\n return byName;\n }\n }\n\n const location = locationOf(part, identity);\n if (location === undefined || (location.module === '' && location.feature === '' && location.slice === '')) {\n return undefined;\n }\n\n return this.unavailable.find(_ => _.module === location.module && _.feature === location.feature && _.slice === location.slice);\n }\n}\n\nfunction identityOf(part: Exclude<AvailabilityPart, string>): Identity | undefined {\n // A proxy class declares its identity as the static `part`. An instance is read through its class only, because a\n // command or query may itself have a property named `part`.\n if (typeof part === 'function') {\n return asIdentity((part as { part?: unknown }).part);\n }\n\n return asIdentity(part) ?? asIdentity((part as { constructor?: { part?: unknown } }).constructor?.part);\n}\n\nfunction asIdentity(value: unknown): Identity | undefined {\n if (typeof value !== 'object' || value === null) {\n return undefined;\n }\n\n const candidate = value as Record<string, unknown>;\n return typeof candidate.name === 'string' && typeof candidate.module === 'string' && typeof candidate.feature === 'string' && typeof candidate.slice === 'string'\n ? value as Identity\n : undefined;\n}\n\nfunction locationOf(part: Exclude<AvailabilityPart, string>, identity: Identity | undefined): Location | undefined {\n if (identity !== undefined) {\n return identity;\n }\n\n const own = (part as { sliceLocation?: Location }).sliceLocation;\n if (own !== undefined) {\n return own;\n }\n\n return (part as { constructor?: { sliceLocation?: Location } }).constructor?.sliceLocation;\n}\n"],"names":["partNameOf","part","identityOf","name","Availability","unknown","everything","isKnown","unavailable","isAvailable","availabilityOf","PartAvailability","listed","find","undefined","available","refused","reason","filter","items","partOf","item","_","identity","byName","location","locationOf","module","feature","slice","asIdentity","value","candidate","own","sliceLocation"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailabilityReason.d.ts","sourceRoot":"","sources":["../../../availability/AvailabilityReason.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"AvailabilityReason.d.ts","sourceRoot":"","sources":["../../../availability/AvailabilityReason.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAO3C,eAAO,MAAM,SAAS,cAAc,CAAC"}
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* to the caller. It is distinct from being forbidden: availability decides whether a part exists for the caller at
|
|
6
6
|
* all, authorization decides what the caller may do in it.
|
|
7
7
|
*/ const NotAvailable = 'NotAvailable';
|
|
8
|
+
/**
|
|
9
|
+
* The authorization failure reason of a command or query result, and the reason of a part the server lists, when an
|
|
10
|
+
* operator has suspended the part. It is distinct from {@link NotAvailable}: a suspended part comes back when the
|
|
11
|
+
* suspension is lifted, so a client can say so instead of treating the part as gone.
|
|
12
|
+
*/ const Suspended = 'Suspended';
|
|
8
13
|
|
|
9
|
-
export { NotAvailable };
|
|
14
|
+
export { NotAvailable, Suspended };
|
|
10
15
|
//# sourceMappingURL=AvailabilityReason.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailabilityReason.js","sources":["../../../availability/AvailabilityReason.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The authorization failure reason of a command or query result when its part of the application is not available\n * to the caller. It is distinct from being forbidden: availability decides whether a part exists for the caller at\n * all, authorization decides what the caller may do in it.\n */\nexport const NotAvailable = 'NotAvailable';\n"],"names":["NotAvailable"],"mappings":"AAAA;AACA;AAEA;;;;IAKO,MAAMA,YAAAA,GAAe;;"}
|
|
1
|
+
{"version":3,"file":"AvailabilityReason.js","sources":["../../../availability/AvailabilityReason.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The authorization failure reason of a command or query result when its part of the application is not available\n * to the caller. It is distinct from being forbidden: availability decides whether a part exists for the caller at\n * all, authorization decides what the caller may do in it.\n */\nexport const NotAvailable = 'NotAvailable';\n\n/**\n * The authorization failure reason of a command or query result, and the reason of a part the server lists, when an\n * operator has suspended the part. It is distinct from {@link NotAvailable}: a suspended part comes back when the\n * suspension is lifted, so a client can say so instead of treating the part as gone.\n */\nexport const Suspended = 'Suspended';\n"],"names":["NotAvailable","Suspended"],"mappings":"AAAA;AACA;AAEA;;;;IAKO,MAAMA,YAAAA,GAAe;AAE5B;;;;IAKO,MAAMC,SAAAA,GAAY;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailableParts.d.ts","sourceRoot":"","sources":["../../../availability/AvailableParts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AvailableParts.d.ts","sourceRoot":"","sources":["../../../availability/AvailableParts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKvD,qBAAa,oBAAqB,YAAW,eAAe;IAExD,IAAI,SAAM;IAGV,MAAM,SAAM;IAGZ,OAAO,SAAM;IAGb,KAAK,SAAM;IAGX,MAAM,SAAgB;CACzB;AAKD,qBAAa,cAAc;IAEvB,WAAW,EAAE,oBAAoB,EAAE,CAAM;CAC5C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { field } from '@cratis/fundamentals';
|
|
2
|
+
import { NotAvailable } from './AvailabilityReason.js';
|
|
2
3
|
|
|
3
4
|
function _ts_decorate(decorators, target, key, desc) {
|
|
4
5
|
var c = arguments.length, r = c < 3 ? target : desc, d;
|
|
@@ -25,6 +26,7 @@ function _ts_metadata(metadataKey, metadataValue) {
|
|
|
25
26
|
module = '';
|
|
26
27
|
feature = '';
|
|
27
28
|
slice = '';
|
|
29
|
+
reason = NotAvailable;
|
|
28
30
|
}
|
|
29
31
|
_ts_decorate([
|
|
30
32
|
field(String)
|
|
@@ -38,6 +40,9 @@ _ts_decorate([
|
|
|
38
40
|
_ts_decorate([
|
|
39
41
|
field(String)
|
|
40
42
|
], UnavailablePartModel.prototype, "slice", void 0);
|
|
43
|
+
_ts_decorate([
|
|
44
|
+
field(String)
|
|
45
|
+
], UnavailablePartModel.prototype, "reason", void 0);
|
|
41
46
|
/**
|
|
42
47
|
* What is not available to the current context, as the server reports it. Everything not listed is available.
|
|
43
48
|
*/ class AvailableParts {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvailableParts.js","sources":["../../../availability/AvailableParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { field } from '@cratis/fundamentals';\nimport { UnavailablePart } from './UnavailablePart.js';\n\n/**\n * The part of an unavailable-parts message that names one part. Matches {@link UnavailablePart}.\n */\nexport class UnavailablePartModel implements UnavailablePart {\n @field(String)\n name = '';\n\n @field(String)\n module = '';\n\n @field(String)\n feature = '';\n\n @field(String)\n slice = '';\n}\n\n/**\n * What is not available to the current context, as the server reports it. Everything not listed is available.\n */\nexport class AvailableParts {\n @field(UnavailablePartModel, true)\n unavailable: UnavailablePartModel[] = [];\n}\n"],"names":["UnavailablePartModel","name","module","feature","slice","AvailableParts","unavailable"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AvailableParts.js","sources":["../../../availability/AvailableParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { field } from '@cratis/fundamentals';\nimport { NotAvailable } from './AvailabilityReason.js';\nimport { UnavailablePart } from './UnavailablePart.js';\n\n/**\n * The part of an unavailable-parts message that names one part. Matches {@link UnavailablePart}.\n */\nexport class UnavailablePartModel implements UnavailablePart {\n @field(String)\n name = '';\n\n @field(String)\n module = '';\n\n @field(String)\n feature = '';\n\n @field(String)\n slice = '';\n\n @field(String)\n reason = NotAvailable;\n}\n\n/**\n * What is not available to the current context, as the server reports it. Everything not listed is available.\n */\nexport class AvailableParts {\n @field(UnavailablePartModel, true)\n unavailable: UnavailablePartModel[] = [];\n}\n"],"names":["UnavailablePartModel","name","module","feature","slice","reason","NotAvailable","AvailableParts","unavailable"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOA;;AAEC,IACM,MAAMA,oBAAAA,CAAAA;AAETC,IAAAA,IAAAA,GAAO,EAAA;AAGPC,IAAAA,MAAAA,GAAS,EAAA;AAGTC,IAAAA,OAAAA,GAAU,EAAA;AAGVC,IAAAA,KAAAA,GAAQ,EAAA;AAGRC,IAAAA,MAAAA,GAASC,YAAAA;AACb;;;;;;;;;;;;;;;;AAEA;;AAEC,IACM,MAAMC,cAAAA,CAAAA;AAETC,IAAAA,WAAAA,GAAsC,EAAE;AAC5C;;;;;;"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { ObservableQueryFor } from '../queries/ObservableQueryFor.js';
|
|
2
2
|
import { ParameterDescriptor } from '../reflection/ParameterDescriptor.js';
|
|
3
3
|
import { AvailableParts } from './AvailableParts.js';
|
|
4
|
-
export
|
|
4
|
+
export interface ObserveAvailablePartsParameters {
|
|
5
|
+
part?: string;
|
|
6
|
+
arguments?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class ObserveAvailableParts extends ObservableQueryFor<AvailableParts, ObserveAvailablePartsParameters> {
|
|
5
9
|
readonly route = "/.cratis/availability";
|
|
6
10
|
readonly defaultValue: AvailableParts;
|
|
7
11
|
readonly parameterDescriptors: ParameterDescriptor[];
|
|
12
|
+
part?: string;
|
|
13
|
+
arguments?: string;
|
|
8
14
|
get requiredRequestParameters(): string[];
|
|
9
15
|
constructor();
|
|
10
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserveAvailableParts.d.ts","sourceRoot":"","sources":["../../../availability/ObserveAvailableParts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObserveAvailableParts.d.ts","sourceRoot":"","sources":["../../../availability/ObserveAvailableParts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,MAAM,WAAW,+BAA+B;IAE5C,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AASD,qBAAa,qBAAsB,SAAQ,kBAAkB,CAAC,cAAc,EAAE,+BAA+B,CAAC;IAC1G,QAAQ,CAAC,KAAK,2BAA2B;IACzC,QAAQ,CAAC,YAAY,iBAAwB;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,CAGlD;IAEF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,yBAAyB,IAAI,MAAM,EAAE,CAExC;IAED,cAEC;CACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObservableQueryFor } from '../queries/ObservableQueryFor.js';
|
|
2
|
+
import { ParameterDescriptor } from '../reflection/ParameterDescriptor.js';
|
|
2
3
|
import { AvailableParts } from './AvailableParts.js';
|
|
3
4
|
|
|
4
5
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -6,10 +7,18 @@ import { AvailableParts } from './AvailableParts.js';
|
|
|
6
7
|
/**
|
|
7
8
|
* Observes what is not available to the current context. It reports the current decision first and again every time
|
|
8
9
|
* it changes, so an open session updates without a reload.
|
|
10
|
+
*
|
|
11
|
+
* With `part` (and `arguments`) it answers for that one part and the data it is about: the part is listed when it is
|
|
12
|
+
* not available for those arguments, and the answer is empty when it is available.
|
|
9
13
|
*/ class ObserveAvailableParts extends ObservableQueryFor {
|
|
10
14
|
route = '/.cratis/availability';
|
|
11
15
|
defaultValue = new AvailableParts();
|
|
12
|
-
parameterDescriptors = [
|
|
16
|
+
parameterDescriptors = [
|
|
17
|
+
new ParameterDescriptor('arguments', String, false),
|
|
18
|
+
new ParameterDescriptor('part', String, false)
|
|
19
|
+
];
|
|
20
|
+
part;
|
|
21
|
+
arguments;
|
|
13
22
|
get requiredRequestParameters() {
|
|
14
23
|
return [];
|
|
15
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserveAvailableParts.js","sources":["../../../availability/ObserveAvailableParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ObservableQueryFor } from '../queries/ObservableQueryFor.js';\nimport { ParameterDescriptor } from '../reflection/ParameterDescriptor.js';\nimport { AvailableParts } from './AvailableParts.js';\n\n/**\n * Observes what is not available to the current context. It reports the current decision first and again every time\n * it changes, so an open session updates without a reload.\n */\nexport class ObserveAvailableParts extends ObservableQueryFor<AvailableParts> {\n readonly route = '/.cratis/availability';\n readonly defaultValue = new AvailableParts();\n readonly parameterDescriptors: ParameterDescriptor[] = [];\n\n get requiredRequestParameters(): string[] {\n return [];\n }\n\n constructor() {\n super(AvailableParts, false);\n }\n}\n"],"names":["ObserveAvailableParts","ObservableQueryFor","route","defaultValue","AvailableParts","parameterDescriptors","requiredRequestParameters"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObserveAvailableParts.js","sources":["../../../availability/ObserveAvailableParts.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ObservableQueryFor } from '../queries/ObservableQueryFor.js';\nimport { ParameterDescriptor } from '../reflection/ParameterDescriptor.js';\nimport { AvailableParts } from './AvailableParts.js';\n\n/**\n * The parameters of {@link ObserveAvailableParts}.\n */\nexport interface ObserveAvailablePartsParameters {\n /** The full name of one part to ask about. Every part is decided when it is not given. */\n part?: string;\n\n /** The arguments of that part as a JSON object, for a gate that reads `arguments.name`. */\n arguments?: string;\n}\n\n/**\n * Observes what is not available to the current context. It reports the current decision first and again every time\n * it changes, so an open session updates without a reload.\n *\n * With `part` (and `arguments`) it answers for that one part and the data it is about: the part is listed when it is\n * not available for those arguments, and the answer is empty when it is available.\n */\nexport class ObserveAvailableParts extends ObservableQueryFor<AvailableParts, ObserveAvailablePartsParameters> {\n readonly route = '/.cratis/availability';\n readonly defaultValue = new AvailableParts();\n readonly parameterDescriptors: ParameterDescriptor[] = [\n new ParameterDescriptor('arguments', String, false),\n new ParameterDescriptor('part', String, false),\n ];\n\n part?: string;\n arguments?: string;\n\n get requiredRequestParameters(): string[] {\n return [];\n }\n\n constructor() {\n super(AvailableParts, false);\n }\n}\n"],"names":["ObserveAvailableParts","ObservableQueryFor","route","defaultValue","AvailableParts","parameterDescriptors","ParameterDescriptor","String","part","arguments","requiredRequestParameters"],"mappings":";;;;AAAA;AACA;AAiBA;;;;;;IAOO,MAAMA,qBAAAA,SAA8BC,kBAAAA,CAAAA;AAC9BC,IAAAA,KAAAA,GAAQ,uBAAA;AACRC,IAAAA,YAAAA,GAAe,IAAIC,cAAAA,EAAAA;IACnBC,oBAAAA,GAA8C;QACnD,IAAIC,mBAAAA,CAAoB,aAAaC,MAAAA,EAAQ,KAAA,CAAA;QAC7C,IAAID,mBAAAA,CAAoB,QAAQC,MAAAA,EAAQ,KAAA;KAC3C;IAEDC,IAAAA;IACAC,SAAAA;AAEA,IAAA,IAAIC,yBAAAA,GAAsC;AACtC,QAAA,OAAO,EAAE;AACb,IAAA;IAEA,WAAA,EAAc;AACV,QAAA,KAAK,CAACN,cAAAA,EAAgB,KAAA,CAAA;AAC1B,IAAA;AACJ;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class PartAvailability {
|
|
2
|
+
readonly isAvailable: boolean;
|
|
3
|
+
readonly reason?: string | undefined;
|
|
4
|
+
readonly isKnown: boolean;
|
|
5
|
+
static readonly available: PartAvailability;
|
|
6
|
+
static readonly unknown: PartAvailability;
|
|
7
|
+
constructor(isAvailable: boolean, reason?: string | undefined, isKnown?: boolean);
|
|
8
|
+
get isNotAvailable(): boolean;
|
|
9
|
+
get isSuspended(): boolean;
|
|
10
|
+
static refused(reason?: string): PartAvailability;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=PartAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartAvailability.d.ts","sourceRoot":"","sources":["../../../availability/PartAvailability.ts"],"names":[],"mappings":"AAQA,qBAAa,gBAAgB;IAab,QAAQ,CAAC,WAAW,EAAE,OAAO;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO;IAX9F,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAA8B;IAGzE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAiD;IAQ1F,YAAqB,WAAW,EAAE,OAAO,EAAW,MAAM,CAAC,EAAE,MAAM,YAAA,EAAW,OAAO,GAAE,OAAc,EACpG;IAGD,IAAI,cAAc,IAAI,OAAO,CAE5B;IAGD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAOD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAEhD;CACJ"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Suspended, NotAvailable } from './AvailabilityReason.js';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* The answer to whether one part is available, optionally for the data it is about.
|
|
7
|
+
*/ class PartAvailability {
|
|
8
|
+
isAvailable;
|
|
9
|
+
reason;
|
|
10
|
+
isKnown;
|
|
11
|
+
/** The answer for a part that is available. */ static available = new PartAvailability(true);
|
|
12
|
+
/** The answer when the server has not told yet, or could not decide. Nothing is reported as available. */ static unknown = new PartAvailability(false, undefined, false);
|
|
13
|
+
/**
|
|
14
|
+
* Initializes a new instance of {@link PartAvailability}.
|
|
15
|
+
* @param isAvailable Whether the part is available.
|
|
16
|
+
* @param reason Why it is not: `NotAvailable` or `Suspended`; undefined when it is available or not known.
|
|
17
|
+
* @param isKnown Whether the server has decided.
|
|
18
|
+
*/ constructor(isAvailable, reason, isKnown = true){
|
|
19
|
+
this.isAvailable = isAvailable;
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
this.isKnown = isKnown;
|
|
22
|
+
}
|
|
23
|
+
/** Gets whether the part is not available for a reason other than a suspension. */ get isNotAvailable() {
|
|
24
|
+
return this.isKnown && !this.isAvailable && this.reason !== Suspended;
|
|
25
|
+
}
|
|
26
|
+
/** Gets whether an operator has suspended the part. It comes back when the suspension is lifted. */ get isSuspended() {
|
|
27
|
+
return this.isKnown && !this.isAvailable && this.reason === Suspended;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates the answer for a reason the server gave.
|
|
31
|
+
* @param reason The reason; a missing reason is `NotAvailable`.
|
|
32
|
+
* @returns The answer.
|
|
33
|
+
*/ static refused(reason) {
|
|
34
|
+
return new PartAvailability(false, reason ?? NotAvailable);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { PartAvailability };
|
|
39
|
+
//# sourceMappingURL=PartAvailability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartAvailability.js","sources":["../../../availability/PartAvailability.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { NotAvailable, Suspended } from './AvailabilityReason.js';\n\n/**\n * The answer to whether one part is available, optionally for the data it is about.\n */\nexport class PartAvailability {\n /** The answer for a part that is available. */\n static readonly available: PartAvailability = new PartAvailability(true);\n\n /** The answer when the server has not told yet, or could not decide. Nothing is reported as available. */\n static readonly unknown: PartAvailability = new PartAvailability(false, undefined, false);\n\n /**\n * Initializes a new instance of {@link PartAvailability}.\n * @param isAvailable Whether the part is available.\n * @param reason Why it is not: `NotAvailable` or `Suspended`; undefined when it is available or not known.\n * @param isKnown Whether the server has decided.\n */\n constructor(readonly isAvailable: boolean, readonly reason?: string, readonly isKnown: boolean = true) {\n }\n\n /** Gets whether the part is not available for a reason other than a suspension. */\n get isNotAvailable(): boolean {\n return this.isKnown && !this.isAvailable && this.reason !== Suspended;\n }\n\n /** Gets whether an operator has suspended the part. It comes back when the suspension is lifted. */\n get isSuspended(): boolean {\n return this.isKnown && !this.isAvailable && this.reason === Suspended;\n }\n\n /**\n * Creates the answer for a reason the server gave.\n * @param reason The reason; a missing reason is `NotAvailable`.\n * @returns The answer.\n */\n static refused(reason?: string): PartAvailability {\n return new PartAvailability(false, reason ?? NotAvailable);\n }\n}\n"],"names":["PartAvailability","available","unknown","undefined","reason","isKnown","isAvailable","isNotAvailable","Suspended","isSuspended","refused","NotAvailable"],"mappings":";;AAAA;AACA;AAIA;;AAEC,IACM,MAAMA,gBAAAA,CAAAA;;;;AACT,oDACA,OAAgBC,SAAAA,GAA8B,IAAID,iBAAiB,IAAA,CAAA;AAEnE,+GACA,OAAgBE,OAAAA,GAA4B,IAAIF,gBAAAA,CAAiB,KAAA,EAAOG,WAAW,KAAA,CAAA;AAEnF;;;;;QAMA,WAAA,CAAY,WAA6B,EAAWC,MAAe,EAAWC,OAAAA,GAAmB,IAAI,CAAE;aAAlFC,WAAAA,GAAAA,WAAAA;aAA+BF,MAAAA,GAAAA,MAAAA;aAA0BC,OAAAA,GAAAA,OAAAA;AAC9E,IAAA;wFAGA,IAAIE,cAAAA,GAA0B;AAC1B,QAAA,OAAO,IAAI,CAACF,OAAO,IAAI,CAAC,IAAI,CAACC,WAAW,IAAI,IAAI,CAACF,MAAM,KAAKI,SAAAA;AAChE,IAAA;yGAGA,IAAIC,WAAAA,GAAuB;AACvB,QAAA,OAAO,IAAI,CAACJ,OAAO,IAAI,CAAC,IAAI,CAACC,WAAW,IAAI,IAAI,CAACF,MAAM,KAAKI,SAAAA;AAChE,IAAA;AAEA;;;;QAKA,OAAOE,OAAAA,CAAQN,MAAe,EAAoB;QAC9C,OAAO,IAAIJ,gBAAAA,CAAiB,KAAA,EAAOI,MAAAA,IAAUO,YAAAA,CAAAA;AACjD,IAAA;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnavailablePart.d.ts","sourceRoot":"","sources":["../../../availability/UnavailablePart.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAGxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAGzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"UnavailablePart.d.ts","sourceRoot":"","sources":["../../../availability/UnavailablePart.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAGxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAGzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AvailabilityPart } from './Availability.js';
|
|
2
|
+
import { AvailableParts } from './AvailableParts.js';
|
|
3
|
+
import { PartAvailability } from './PartAvailability.js';
|
|
4
|
+
export declare function answerFor(name: string, parts: AvailableParts): PartAvailability;
|
|
5
|
+
export declare function askAvailability(part: AvailabilityPart, args?: Record<string, unknown>): Promise<PartAvailability>;
|
|
6
|
+
//# sourceMappingURL=askAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askAvailability.d.ts","sourceRoot":"","sources":["../../../availability/askAvailability.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAc,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,gBAAgB,CAG/E;AAeD,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgCjH"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { partNameOf } from './Availability.js';
|
|
2
|
+
import { ObserveAvailableParts } from './ObserveAvailableParts.js';
|
|
3
|
+
import { PartAvailability } from './PartAvailability.js';
|
|
4
|
+
|
|
5
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
6
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
7
|
+
/**
|
|
8
|
+
* Describes the answer to a question about one part from the server's list of what is not available.
|
|
9
|
+
* @param name The full name of the part that was asked about.
|
|
10
|
+
* @param parts What the server listed.
|
|
11
|
+
* @returns The {@link PartAvailability}.
|
|
12
|
+
*/ function answerFor(name, parts) {
|
|
13
|
+
const listed = parts.unavailable.find((_)=>_.name === name);
|
|
14
|
+
return listed === undefined ? PartAvailability.available : PartAvailability.refused(listed.reason);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Asks the server whether a part is available for the data it is about, for example one vessel.
|
|
18
|
+
*
|
|
19
|
+
* The server decides with the same gate it uses when the command or query runs, reading `arguments.name` from the
|
|
20
|
+
* arguments given here, so the client never holds a rule of its own. It answers once; use `useIsAvailable` in React
|
|
21
|
+
* to keep the answer current.
|
|
22
|
+
* @param part The full name of a command or read model, or a generated proxy.
|
|
23
|
+
* @param args The arguments of the command or query, by property name. Arguments are for deciding availability only;
|
|
24
|
+
* they never grant anything.
|
|
25
|
+
* @returns The {@link PartAvailability}. When the server could not decide, the answer is {@link PartAvailability.unknown},
|
|
26
|
+
* which is not a denial and not a grant: ask again.
|
|
27
|
+
* @throws When the proxy does not carry the part it is. Generate the proxies again.
|
|
28
|
+
*/ function askAvailability(part, args) {
|
|
29
|
+
const name = partNameOf(part);
|
|
30
|
+
if (name === undefined) {
|
|
31
|
+
return Promise.reject(new Error('The proxy does not carry the part it is. Generate the proxies again with the current ProxyGenerator.'));
|
|
32
|
+
}
|
|
33
|
+
return new Promise((resolve)=>{
|
|
34
|
+
const held = {};
|
|
35
|
+
let finished = false;
|
|
36
|
+
const finish = (answer)=>{
|
|
37
|
+
if (finished) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
finished = true;
|
|
41
|
+
held.subscription?.unsubscribe();
|
|
42
|
+
resolve(answer);
|
|
43
|
+
};
|
|
44
|
+
const query = new ObserveAvailableParts();
|
|
45
|
+
held.subscription = query.subscribe((result)=>{
|
|
46
|
+
if (result.isSuccess && result.isAuthorized && result.data?.unavailable !== undefined) {
|
|
47
|
+
finish(answerFor(name, result.data));
|
|
48
|
+
} else if (!result.isSuccess) {
|
|
49
|
+
finish(PartAvailability.unknown);
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
part: name,
|
|
53
|
+
arguments: JSON.stringify(args ?? {})
|
|
54
|
+
});
|
|
55
|
+
if (finished) {
|
|
56
|
+
held.subscription.unsubscribe();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { answerFor, askAvailability };
|
|
62
|
+
//# sourceMappingURL=askAvailability.js.map
|