@cratis/event-models 0.278.2 → 0.279.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/Cards/cardColors.d.ts +2 -0
- package/dist/Messages/EventModelMessages.d.ts +3 -0
- package/dist/Model/SliceSpecification.d.ts +4 -0
- package/dist/Model/SpecificationWhenQuery.d.ts +7 -0
- package/dist/Model/index.d.ts +1 -0
- package/dist/Specifications/SpecificationAddPicker.d.ts +2 -1
- package/dist/Specifications/SpecificationEditing.d.ts +9 -0
- package/dist/Specifications/SpecificationItemKind.d.ts +2 -1
- package/dist/Specifications/ThenSection.d.ts +3 -2
- package/dist/Specifications/WhenSection.d.ts +3 -2
- package/dist/Specifications/index.d.ts +2 -0
- package/dist/Specifications/queryArguments.d.ts +4 -0
- package/dist/Specifications/specificationQueryMode.d.ts +16 -0
- package/dist/event-model-document.schema.json +41 -0
- package/dist/index.js +4199 -3945
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -18,6 +18,8 @@ export declare const eventCardColors: CardColors;
|
|
|
18
18
|
export declare const commandCardColors: CardColors;
|
|
19
19
|
/** Read model card colors — lime green. */
|
|
20
20
|
export declare const readModelCardColors: CardColors;
|
|
21
|
+
/** Query card colors — indigo, the query a State View specification runs; distinct from every other artifact. */
|
|
22
|
+
export declare const queryCardColors: CardColors;
|
|
21
23
|
/** Projection card colors — pink, the output translator's mapping of private events onto its public event. */
|
|
22
24
|
export declare const projectionCardColors: CardColors;
|
|
23
25
|
/** Capture (change data capture) card colors — teal, the input translator's mapping of incoming events onto private events. */
|
|
@@ -207,6 +207,9 @@ export interface EventModelMessages {
|
|
|
207
207
|
error: string;
|
|
208
208
|
missingRule: string;
|
|
209
209
|
defineReadModel: string;
|
|
210
|
+
addQuery: string;
|
|
211
|
+
addReadModel: string;
|
|
212
|
+
addResult: string;
|
|
210
213
|
removeItem: string;
|
|
211
214
|
noEvents: string;
|
|
212
215
|
redeliverGivenEvent: string;
|
|
@@ -8,6 +8,7 @@ import type { SpecificationReadModel } from './SpecificationReadModel';
|
|
|
8
8
|
import type { SpecificationRedelivery } from './SpecificationRedelivery';
|
|
9
9
|
import type { SpecificationRunOutcome } from './SpecificationRunOutcome';
|
|
10
10
|
import type { SpecificationThenEvent } from './SpecificationThenEvent';
|
|
11
|
+
import type { SpecificationWhenQuery } from './SpecificationWhenQuery';
|
|
11
12
|
import type { SpecificationWhenEvent } from './SpecificationWhenEvent';
|
|
12
13
|
export interface SliceSpecification {
|
|
13
14
|
id: Guid;
|
|
@@ -21,9 +22,12 @@ export interface SliceSpecification {
|
|
|
21
22
|
whenEvent?: SpecificationWhenEvent;
|
|
22
23
|
whenRedelivered?: SpecificationRedelivery;
|
|
23
24
|
caller?: SpecificationCaller;
|
|
25
|
+
whenQuery?: SpecificationWhenQuery;
|
|
24
26
|
givenReadModel?: SpecificationReadModel;
|
|
27
|
+
givenReadModels?: SpecificationReadModel[];
|
|
25
28
|
thenEvents: SpecificationThenEvent[];
|
|
26
29
|
thenReadModel?: SpecificationReadModel;
|
|
30
|
+
thenReadModels?: SpecificationReadModel[];
|
|
27
31
|
thenNoEvents?: boolean;
|
|
28
32
|
thenErrors: SpecificationError[];
|
|
29
33
|
collapsed: boolean;
|
package/dist/Model/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export * from './SpecificationRedelivery';
|
|
|
56
56
|
export * from './SpecificationRunOutcome';
|
|
57
57
|
export * from './SpecificationThenEvent';
|
|
58
58
|
export * from './SpecificationWhenEvent';
|
|
59
|
+
export * from './SpecificationWhenQuery';
|
|
59
60
|
export * from './StickyNote';
|
|
60
61
|
export * from './StickyNoteColour';
|
|
61
62
|
export * from './TranslationDirection';
|
|
@@ -11,5 +11,6 @@ export interface SpecificationAddPickerProps<TOption> {
|
|
|
11
11
|
errors?: readonly SpecificationAddExtra[];
|
|
12
12
|
statements?: readonly SpecificationAddExtra[];
|
|
13
13
|
groups?: readonly SpecificationAddGroup[];
|
|
14
|
+
color?: string;
|
|
14
15
|
}
|
|
15
|
-
export declare const SpecificationAddPicker: <TOption>({ options, nameOf, onChosen, errors, statements, groups }: SpecificationAddPickerProps<TOption>) => React.JSX.Element;
|
|
16
|
+
export declare const SpecificationAddPicker: <TOption>({ options, nameOf, onChosen, errors, statements, groups, color }: SpecificationAddPickerProps<TOption>) => React.JSX.Element;
|
|
@@ -30,5 +30,14 @@ export interface SpecificationEditing {
|
|
|
30
30
|
onWhenRedeliveryRemoved?: (sliceId: Guid, specificationId: Guid) => void;
|
|
31
31
|
onWhenEventValuesSet?: (sliceId: Guid, specificationId: Guid, eventId: Guid, name: string, values: Record<string, unknown>, eventSourceId?: string) => void;
|
|
32
32
|
onWhenEventRemoved?: (sliceId: Guid, specificationId: Guid) => void;
|
|
33
|
+
onWhenQuerySet?: (sliceId: Guid, specificationId: Guid, queryItemId: Guid, name: string) => void;
|
|
34
|
+
onWhenQueryArgumentsSet?: (sliceId: Guid, specificationId: Guid, values: Record<string, unknown>) => void;
|
|
35
|
+
onWhenQueryRemoved?: (sliceId: Guid, specificationId: Guid) => void;
|
|
36
|
+
onGivenReadModelAdded?: (sliceId: Guid, specificationId: Guid, itemId: Guid, readModelId: Guid, name: string) => void;
|
|
37
|
+
onGivenReadModelItemValuesSet?: (sliceId: Guid, specificationId: Guid, itemId: Guid, values: Record<string, unknown>) => void;
|
|
38
|
+
onGivenReadModelItemRemoved?: (sliceId: Guid, specificationId: Guid, itemId: Guid) => void;
|
|
39
|
+
onThenResultAdded?: (sliceId: Guid, specificationId: Guid, itemId: Guid, readModelId: Guid, name: string) => void;
|
|
40
|
+
onThenResultValuesSet?: (sliceId: Guid, specificationId: Guid, itemId: Guid, readModelId: Guid, name: string, values: Record<string, unknown>) => void;
|
|
41
|
+
onThenResultRemoved?: (sliceId: Guid, specificationId: Guid, itemId: Guid) => void;
|
|
33
42
|
onSpecificationItemOpened?: (item: SpecificationItemToOpen) => void;
|
|
34
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { Guid } from '@cratis/fundamentals';
|
|
3
|
-
import type { CommandItem, EventItem, ReadModelItem, SliceSpecification } from '../Model';
|
|
3
|
+
import type { CommandItem, EventItem, QueryItem, ReadModelItem, SliceSpecification } from '../Model';
|
|
4
4
|
import { SliceType } from '../Model';
|
|
5
5
|
import type { SpecificationAddGroup } from './SpecificationAddGroup';
|
|
6
6
|
export interface ThenSectionProps {
|
|
@@ -13,6 +13,7 @@ export interface ThenSectionProps {
|
|
|
13
13
|
renamedEventNames?: Readonly<Record<string, string>>;
|
|
14
14
|
extra?: ReactNode;
|
|
15
15
|
extraGroups?: readonly SpecificationAddGroup[];
|
|
16
|
+
queries?: readonly QueryItem[];
|
|
16
17
|
onItemsChanged?: (events: number, errors: number) => void;
|
|
17
18
|
}
|
|
18
|
-
export declare const ThenSection: ({ sliceId, sliceType, specification, events, command, readModel, renamedEventNames, extra, extraGroups, onItemsChanged }: ThenSectionProps) => import("react").JSX.Element;
|
|
19
|
+
export declare const ThenSection: ({ sliceId, sliceType, specification, events, command, readModel, renamedEventNames, extra, extraGroups, queries, onItemsChanged }: ThenSectionProps) => import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Guid } from '@cratis/fundamentals';
|
|
2
|
-
import type { AutomationTrigger, CommandItem, EventItem, SliceSpecification } from '../Model';
|
|
2
|
+
import type { AutomationTrigger, CommandItem, EventItem, QueryItem, SliceSpecification } from '../Model';
|
|
3
3
|
import { SliceType } from '../Model';
|
|
4
4
|
import { type ObservedEvent } from './redeliverableGivens';
|
|
5
5
|
export interface WhenSectionProps {
|
|
@@ -12,5 +12,6 @@ export interface WhenSectionProps {
|
|
|
12
12
|
inputEvents?: readonly ObservedEvent[];
|
|
13
13
|
trigger?: AutomationTrigger;
|
|
14
14
|
sliceName?: string;
|
|
15
|
+
queries?: readonly QueryItem[];
|
|
15
16
|
}
|
|
16
|
-
export declare const WhenSection: ({ sliceId, sliceType, specification, command, renamedCommandName, events, inputEvents, trigger, sliceName }: WhenSectionProps) => import("react").JSX.Element;
|
|
17
|
+
export declare const WhenSection: ({ sliceId, sliceType, specification, command, renamedCommandName, events, inputEvents, trigger, sliceName, queries }: WhenSectionProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { JsonSchema } from '@cratis/components/types';
|
|
2
|
+
import { type QueryItem } from '../Model';
|
|
3
|
+
export declare const queryArgumentSchema: (query: Pick<QueryItem, 'parameters'>) => JsonSchema | undefined;
|
|
4
|
+
export declare const queryReturnsMany: (query: Pick<QueryItem, 'parameters' | 'resultShape'>) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Guid } from '@cratis/fundamentals';
|
|
2
|
+
import type { SliceSpecification } from '../Model';
|
|
3
|
+
export interface SpecificationQueryModes {
|
|
4
|
+
get(specificationId: string): string | false | undefined;
|
|
5
|
+
set(specificationId: string, queryItemId: Guid | undefined): void;
|
|
6
|
+
clear(specificationId: string): void;
|
|
7
|
+
subscribe(listener: () => void): () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const createSpecificationQueryModes: () => SpecificationQueryModes;
|
|
10
|
+
export declare const SpecificationQueryModesContext: import("react").Context<SpecificationQueryModes>;
|
|
11
|
+
export interface SpecificationQueryMode {
|
|
12
|
+
isQueryMode: boolean;
|
|
13
|
+
queryItemId?: Guid;
|
|
14
|
+
}
|
|
15
|
+
export declare const useSpecificationQueryMode: (specification: Pick<SliceSpecification, 'id' | 'whenQuery'>) => SpecificationQueryMode;
|
|
16
|
+
export declare const useSetSpecificationQuery: () => (specificationId: Guid, queryItemId: Guid | undefined) => void;
|
|
@@ -975,9 +975,20 @@
|
|
|
975
975
|
"$ref": "#/$defs/SpecificationRedelivery",
|
|
976
976
|
"description": "One of the given events, told again to the reaction of an automation or translator slice. When present, it is the whole When."
|
|
977
977
|
},
|
|
978
|
+
"whenQuery": {
|
|
979
|
+
"$ref": "#/$defs/SpecificationWhenQuery",
|
|
980
|
+
"description": "The query the specification runs as its action. When present, the specification is in query mode."
|
|
981
|
+
},
|
|
978
982
|
"givenReadModel": {
|
|
979
983
|
"$ref": "#/$defs/SpecificationReadModel"
|
|
980
984
|
},
|
|
985
|
+
"givenReadModels": {
|
|
986
|
+
"type": "array",
|
|
987
|
+
"description": "The read models a query-mode specification starts from, each with the values it holds.",
|
|
988
|
+
"items": {
|
|
989
|
+
"$ref": "#/$defs/SpecificationReadModel"
|
|
990
|
+
}
|
|
991
|
+
},
|
|
981
992
|
"givenContexts": {
|
|
982
993
|
"type": "array",
|
|
983
994
|
"items": {
|
|
@@ -1000,6 +1011,13 @@
|
|
|
1000
1011
|
"$ref": "#/$defs/SpecificationReadModel",
|
|
1001
1012
|
"description": "The read model, and the values in it, the specification expects afterwards."
|
|
1002
1013
|
},
|
|
1014
|
+
"thenReadModels": {
|
|
1015
|
+
"type": "array",
|
|
1016
|
+
"description": "What a query-mode specification expects the query to return: one read model for a query that returns one item, several otherwise.",
|
|
1017
|
+
"items": {
|
|
1018
|
+
"$ref": "#/$defs/SpecificationReadModel"
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1003
1021
|
"thenNoEvents": {
|
|
1004
1022
|
"type": "boolean",
|
|
1005
1023
|
"description": "The specification expects nothing to be appended. An empty Then means the outcome is not authored yet, so this is stated on its own."
|
|
@@ -1109,6 +1127,29 @@
|
|
|
1109
1127
|
}
|
|
1110
1128
|
}
|
|
1111
1129
|
},
|
|
1130
|
+
"SpecificationWhenQuery": {
|
|
1131
|
+
"type": "object",
|
|
1132
|
+
"required": [
|
|
1133
|
+
"queryItemId"
|
|
1134
|
+
],
|
|
1135
|
+
"properties": {
|
|
1136
|
+
"queryItemId": {
|
|
1137
|
+
"$ref": "#/$defs/Guid"
|
|
1138
|
+
},
|
|
1139
|
+
"name": {
|
|
1140
|
+
"type": "string"
|
|
1141
|
+
},
|
|
1142
|
+
"arguments": {
|
|
1143
|
+
"type": "object",
|
|
1144
|
+
"additionalProperties": true,
|
|
1145
|
+
"description": "What the query's parameters are given."
|
|
1146
|
+
},
|
|
1147
|
+
"legacy": {
|
|
1148
|
+
"type": "boolean",
|
|
1149
|
+
"description": "The query was stored on an older specification, which is shown but not edited."
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1112
1153
|
"SpecificationRedelivery": {
|
|
1113
1154
|
"type": "object",
|
|
1114
1155
|
"required": [
|