@cratis/stage.runtime 5.6.0 → 5.8.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/src/commandAvailability.d.ts +15 -0
- package/dist/src/index.js +439 -392
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from '@cratis/arc/commands';
|
|
2
|
+
/** What the server says a caller may do with a command for the data a screen is showing. */
|
|
3
|
+
export interface CommandAvailability {
|
|
4
|
+
/** Whether the server refused the command to this caller for these values. Anything else - answered, unanswered or failed - leaves the action offered. */
|
|
5
|
+
unavailable: boolean;
|
|
6
|
+
/** Why the server refused it, when it said. */
|
|
7
|
+
reason?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Asks the server whether the command is authorized for the values the screen is showing, without running it. The server decides, so a policy that
|
|
11
|
+
* reads recorded state, such as the plan of the asset on the screen, answers for that asset; the answer is asked again when the data the screen reads
|
|
12
|
+
* changes, so an action withheld for one plan is offered again when the plan changes, without a reload. Only a refusal withholds the action: an
|
|
13
|
+
* unanswered or failed probe leaves it offered, because the guard controls what is offered and never what the system accepts.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCommandAvailability(commandType: (new () => Command) | undefined, values: Record<string, unknown>, version: unknown): CommandAvailability;
|