@cratis/screenplay-language 4.16.0 → 4.18.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/completion-items.ts +7 -1
- package/diagnostic-codes.ts +5 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-items.js +6 -1
- package/dist/completion-items.js.map +1 -1
- package/dist/diagnostic-codes.d.ts +5 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/diagnostic-codes.js +5 -0
- package/dist/diagnostic-codes.js.map +1 -1
- package/dist/event-context-catalog.d.ts +14 -0
- package/dist/event-context-catalog.d.ts.map +1 -0
- package/dist/event-context-catalog.js +116 -0
- package/dist/event-context-catalog.js.map +1 -0
- package/dist/event-context.d.ts +38 -0
- package/dist/event-context.d.ts.map +1 -0
- package/dist/event-context.js +88 -0
- package/dist/event-context.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/keyword-docs.js +3 -1
- package/dist/keyword-docs.js.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/language.js +29 -0
- package/dist/language.js.map +1 -1
- package/dist/sub-languages/projection/CompletionProvider.d.ts +1 -0
- package/dist/sub-languages/projection/CompletionProvider.d.ts.map +1 -1
- package/dist/sub-languages/projection/CompletionProvider.js +39 -69
- package/dist/sub-languages/projection/CompletionProvider.js.map +1 -1
- package/dist/sub-languages/projection/HoverProvider.d.ts +1 -0
- package/dist/sub-languages/projection/HoverProvider.d.ts.map +1 -1
- package/dist/sub-languages/projection/HoverProvider.js +36 -4
- package/dist/sub-languages/projection/HoverProvider.js.map +1 -1
- package/dist/sub-languages/projection/Validator.d.ts.map +1 -1
- package/dist/sub-languages/projection/Validator.js +14 -0
- package/dist/sub-languages/projection/Validator.js.map +1 -1
- package/dist/sub-languages/projection/language.d.ts.map +1 -1
- package/dist/sub-languages/projection/language.js +0 -2
- package/dist/sub-languages/projection/language.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +52 -0
- package/dist/validation.js.map +1 -1
- package/event-context-catalog.ts +135 -0
- package/event-context.ts +119 -0
- package/for_eventContext/when_resolving_generated_catalog_vectors.ts +15 -0
- package/for_projectionCompletionProvider/when_completing_an_event_context_path.ts +102 -0
- package/for_projectionHoverProvider/when_hovering_an_event_context_path.ts +44 -0
- package/for_projectionValidator/when_validating_event_context_paths.ts +31 -0
- package/for_validateLines/when_validating_a_document/with_a_problem_of_every_coded_kind.ts +7 -0
- package/for_validateLines/when_validating_event_context_paths/in_a_projection.ts +97 -0
- package/index.ts +2 -0
- package/keyword-docs.ts +4 -1
- package/language.ts +29 -0
- package/package.json +1 -1
- package/sub-languages/projection/CompletionProvider.ts +47 -72
- package/sub-languages/projection/HoverProvider.ts +40 -4
- package/sub-languages/projection/Validator.ts +15 -0
- package/sub-languages/projection/language.ts +0 -2
- package/validation.ts +59 -0
package/dist/validation.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { causedByProperties, contextRoots, identityProperties, primitiveTypes, sliceTypes } from './language';
|
|
4
4
|
import { diagnosticCodes } from './diagnostic-codes';
|
|
5
5
|
import { fenceMap, indentOf } from './document-context';
|
|
6
|
+
import { resolveEventContextPath } from './event-context';
|
|
6
7
|
import { knownEventNames, knownTypeNames, scanDocument, } from './symbols';
|
|
7
8
|
function issue(severity, line, startColumn, length, message, code) {
|
|
8
9
|
return { severity, message, line, startColumn, endColumn: startColumn + length, code };
|
|
@@ -142,6 +143,7 @@ export function validateLines(lines) {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
}
|
|
146
|
+
issues.push(...validateEventContextPaths(lines, fences));
|
|
145
147
|
const fenceLines = lines
|
|
146
148
|
.map((line, index) => ({ line, index }))
|
|
147
149
|
.filter(({ line }) => /^\s*```\s*$/.test(line));
|
|
@@ -151,4 +153,54 @@ export function validateLines(lines) {
|
|
|
151
153
|
}
|
|
152
154
|
return issues;
|
|
153
155
|
}
|
|
156
|
+
// A mapping target: the first word of a mapping line, after the keyword that opens it if there is one.
|
|
157
|
+
const mappingTarget = /^(?:(?:increment|decrement|count|clear|add|subtract|set)\s+)?@?([$\w.]+)(?=\s|=|$)/;
|
|
158
|
+
// Every $eventContext.<path> - in an expression or as the dynamic key of a mapping target - checked against the
|
|
159
|
+
// event-context catalog the way the compiler checks it (Parsing/EventContextPathValidator.cs).
|
|
160
|
+
export function validateEventContextPaths(lines, fences) {
|
|
161
|
+
const issues = [];
|
|
162
|
+
const names = (members) => members.map((member) => member.name).join(', ');
|
|
163
|
+
for (let index = 0; index < lines.length; index++) {
|
|
164
|
+
const line = lines[index];
|
|
165
|
+
if (fences[index])
|
|
166
|
+
continue;
|
|
167
|
+
for (const match of line.matchAll(/(\.)?\$eventContext((?:\.(?:\w+(?:\(\))?)?)*)/g)) {
|
|
168
|
+
const token = match[0].substring(match[1]?.length ?? 0);
|
|
169
|
+
const written = match[2];
|
|
170
|
+
if (written.length === 0) {
|
|
171
|
+
// A bare $eventContext names nothing only as a dynamic key; in an expression the compiler rejects it as invalid.
|
|
172
|
+
if (match[1]) {
|
|
173
|
+
issues.push(issue('error', index, (match.index ?? 0) + 2, token.length, `'$eventContext' names no member - expected one of ${names(resolveEventContextPath('').expected)}.`, diagnosticCodes.missingEventContextPath));
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const path = written.substring(1);
|
|
178
|
+
const resolution = resolveEventContextPath(path);
|
|
179
|
+
const column = (match.index ?? 0) + (match[1]?.length ?? 0) + 1;
|
|
180
|
+
switch (resolution.status) {
|
|
181
|
+
case 'missing':
|
|
182
|
+
issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' names no member - expected one of ${names(resolution.expected)}.`, diagnosticCodes.missingEventContextPath));
|
|
183
|
+
break;
|
|
184
|
+
case 'unknownMember':
|
|
185
|
+
issues.push(issue('warning', index, column, token.length, `Unknown event context member '${resolution.segment}' in '$eventContext.${path}' - expected one of ${names(resolution.expected)}.`, diagnosticCodes.unknownEventContextMember));
|
|
186
|
+
break;
|
|
187
|
+
case 'unknownSubPath': {
|
|
188
|
+
const has = resolution.expected.length === 0 ? 'no members to address' : `members ${names(resolution.expected)}`;
|
|
189
|
+
issues.push(issue('warning', index, column, token.length, `Unknown event context path '$eventContext.${path}' - '${resolution.member?.name}' (${resolution.member?.type}) has ${has}.`, diagnosticCodes.unknownEventContextPath));
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case 'belowCollection':
|
|
193
|
+
issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' cannot resolve - '${resolution.member?.name}' is a collection (${resolution.member?.type}) and cannot be addressed below.`, diagnosticCodes.eventContextPathBelowCollection));
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Only $eventContext resolves in a dynamic key; any other $ source is kept as the literal key text.
|
|
198
|
+
const target = line.trim().match(mappingTarget)?.[1];
|
|
199
|
+
const source = target?.match(/\.\$(\w+)/)?.[1];
|
|
200
|
+
if (target && source && source !== 'eventContext') {
|
|
201
|
+
issues.push(tokenIssue('warning', index, line, target, `Dynamic dictionary key '$${source}' in '${target}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${source}' becomes the key.`, diagnosticCodes.unresolvedDynamicKeySource));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return issues;
|
|
205
|
+
}
|
|
154
206
|
//# sourceMappingURL=validation.js.map
|
package/dist/validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../validation.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,C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E,IAAI,sBAAsB,UAAU,CAAC,MAAM,EAAE,IAAI,kCAAkC,EAAE,eAAe,CAAC,+BAA+B,CAAC,CAAC,CAAC;oBAC/P,MAAM;YACd,CAAC;QACL,CAAC;QAED,oGAAoG;QACpG,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;YAChD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B,MAAM,SAAS,MAAM,+EAA+E,MAAM,oBAAoB,EAAE,eAAe,CAAC,0BAA0B,CAAC,CAAC,CAAC;QACpQ,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
// Generated from Cratis.Screenplay.Syntax.EventContextCatalog - do not edit by hand. The spec
|
|
5
|
+
// Syntax/for_EventContextCatalog/when_holding_the_editor_catalog_to_it fails when this file drifts; rerun
|
|
6
|
+
// it with SCREENPLAY_REGENERATE_EVENT_CONTEXT=1 to rewrite it.
|
|
7
|
+
|
|
8
|
+
export type EventContextMemberKind = 'value' | 'composite' | 'collection' | 'function';
|
|
9
|
+
|
|
10
|
+
export interface EventContextMember {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly type: string;
|
|
13
|
+
readonly kind: EventContextMemberKind;
|
|
14
|
+
readonly description: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface EventContextPath extends EventContextMember {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const eventContextRootType = 'EventContext';
|
|
22
|
+
|
|
23
|
+
// The members of each type a path passes through, keyed by type name.
|
|
24
|
+
export const eventContextTypes: Readonly<Record<string, readonly EventContextMember[]>> = {
|
|
25
|
+
'EventContext': [
|
|
26
|
+
{ name: 'eventType', type: 'EventType', kind: 'composite', description: 'The type of the event - its identifier, generation and whether it is a tombstone.' },
|
|
27
|
+
{ name: 'eventSourceType', type: 'EventSourceType', kind: 'value', description: 'The type of the event source the event was appended to.' },
|
|
28
|
+
{ name: 'eventSourceId', type: 'EventSourceId', kind: 'value', description: 'The identifier of the event source the event was appended to - the value $eventSourceId resolves.' },
|
|
29
|
+
{ name: 'eventStreamType', type: 'EventStreamType', kind: 'value', description: 'The type of the event stream the event belongs to.' },
|
|
30
|
+
{ name: 'eventStreamId', type: 'EventStreamId', kind: 'value', description: 'The identifier of the event stream the event belongs to.' },
|
|
31
|
+
{ name: 'sequenceNumber', type: 'EventSequenceNumber', kind: 'value', description: 'The position of the event in its event sequence.' },
|
|
32
|
+
{ name: 'occurred', type: 'DateTimeOffset', kind: 'value', description: 'When the event occurred - the time it was appended unless one was given.' },
|
|
33
|
+
{ name: 'eventStore', type: 'EventStoreName', kind: 'value', description: 'The name of the event store the event belongs to.' },
|
|
34
|
+
{ name: 'namespace', type: 'EventStoreNamespaceName', kind: 'value', description: 'The namespace within the event store the event belongs to.' },
|
|
35
|
+
{ name: 'correlationId', type: 'CorrelationId', kind: 'value', description: 'The correlation identifier the event was appended with.' },
|
|
36
|
+
{ name: 'causation', type: 'IEnumerable<Causation>', kind: 'collection', description: 'The chain of causes that led to the event - a collection, not addressable below.' },
|
|
37
|
+
{ name: 'causedBy', type: 'Identity', kind: 'composite', description: 'The identity that caused the event.' },
|
|
38
|
+
{ name: 'tags', type: 'IEnumerable<Tag>', kind: 'collection', description: 'The tags the event was appended with - a collection, not addressable below.' },
|
|
39
|
+
{ name: 'hash', type: 'EventHash', kind: 'value', description: 'The hash of the event content.' },
|
|
40
|
+
{ name: 'observationState', type: 'EventObservationState', kind: 'value', description: 'Whether the observer sees the event for the first time or again on replay - differs between live processing and replay.' },
|
|
41
|
+
{ name: 'subject', type: 'Subject', kind: 'value', description: 'The compliance subject the event is about - the event source identifier unless one was given.' },
|
|
42
|
+
{ name: 'subjectIsEventSourceId', type: 'bool', kind: 'value', description: 'Whether the subject is the event source identifier.' },
|
|
43
|
+
],
|
|
44
|
+
'EventType': [
|
|
45
|
+
{ name: 'id', type: 'EventTypeId', kind: 'value', description: 'The identifier of the event type.' },
|
|
46
|
+
{ name: 'generation', type: 'EventTypeGeneration', kind: 'value', description: 'The generation of the event type.' },
|
|
47
|
+
{ name: 'tombstone', type: 'bool', kind: 'value', description: 'Whether the event is a tombstone event.' },
|
|
48
|
+
],
|
|
49
|
+
'EventSourceType': [
|
|
50
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
51
|
+
],
|
|
52
|
+
'EventSourceId': [
|
|
53
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
54
|
+
],
|
|
55
|
+
'EventStreamType': [
|
|
56
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
57
|
+
],
|
|
58
|
+
'EventStreamId': [
|
|
59
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
60
|
+
],
|
|
61
|
+
'EventSequenceNumber': [
|
|
62
|
+
{ name: 'value', type: 'ulong', kind: 'value', description: 'The underlying ulong value.' },
|
|
63
|
+
],
|
|
64
|
+
'DateTimeOffset': [
|
|
65
|
+
{ name: 'Week', type: 'int', kind: 'function', description: 'The ISO 8601 week of the year the value falls in.' },
|
|
66
|
+
],
|
|
67
|
+
'EventStoreName': [
|
|
68
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
69
|
+
],
|
|
70
|
+
'EventStoreNamespaceName': [
|
|
71
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
72
|
+
],
|
|
73
|
+
'CorrelationId': [
|
|
74
|
+
{ name: 'value', type: 'Guid', kind: 'value', description: 'The underlying Guid value.' },
|
|
75
|
+
],
|
|
76
|
+
'Identity': [
|
|
77
|
+
{ name: 'subject', type: 'string', kind: 'value', description: 'The subject identifier of the identity.' },
|
|
78
|
+
{ name: 'name', type: 'string', kind: 'value', description: 'The display name of the identity.' },
|
|
79
|
+
{ name: 'userName', type: 'string', kind: 'value', description: 'The user name of the identity.' },
|
|
80
|
+
{ name: 'onBehalfOf', type: 'Identity', kind: 'composite', description: 'The identity this identity acted on behalf of, if any - an identity with the same members.' },
|
|
81
|
+
],
|
|
82
|
+
'EventHash': [
|
|
83
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
84
|
+
],
|
|
85
|
+
'Subject': [
|
|
86
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
87
|
+
],
|
|
88
|
+
'EventTypeId': [
|
|
89
|
+
{ name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
90
|
+
],
|
|
91
|
+
'EventTypeGeneration': [
|
|
92
|
+
{ name: 'value', type: 'uint', kind: 'value', description: 'The underlying uint value.' },
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Every path the catalog lists, depth first in declaration order.
|
|
97
|
+
export const eventContextPaths: readonly EventContextPath[] = [
|
|
98
|
+
{ path: 'eventType', name: 'eventType', type: 'EventType', kind: 'composite', description: 'The type of the event - its identifier, generation and whether it is a tombstone.' },
|
|
99
|
+
{ path: 'eventType.id', name: 'id', type: 'EventTypeId', kind: 'value', description: 'The identifier of the event type.' },
|
|
100
|
+
{ path: 'eventType.id.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
101
|
+
{ path: 'eventType.generation', name: 'generation', type: 'EventTypeGeneration', kind: 'value', description: 'The generation of the event type.' },
|
|
102
|
+
{ path: 'eventType.generation.value', name: 'value', type: 'uint', kind: 'value', description: 'The underlying uint value.' },
|
|
103
|
+
{ path: 'eventType.tombstone', name: 'tombstone', type: 'bool', kind: 'value', description: 'Whether the event is a tombstone event.' },
|
|
104
|
+
{ path: 'eventSourceType', name: 'eventSourceType', type: 'EventSourceType', kind: 'value', description: 'The type of the event source the event was appended to.' },
|
|
105
|
+
{ path: 'eventSourceType.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
106
|
+
{ path: 'eventSourceId', name: 'eventSourceId', type: 'EventSourceId', kind: 'value', description: 'The identifier of the event source the event was appended to - the value $eventSourceId resolves.' },
|
|
107
|
+
{ path: 'eventSourceId.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
108
|
+
{ path: 'eventStreamType', name: 'eventStreamType', type: 'EventStreamType', kind: 'value', description: 'The type of the event stream the event belongs to.' },
|
|
109
|
+
{ path: 'eventStreamType.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
110
|
+
{ path: 'eventStreamId', name: 'eventStreamId', type: 'EventStreamId', kind: 'value', description: 'The identifier of the event stream the event belongs to.' },
|
|
111
|
+
{ path: 'eventStreamId.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
112
|
+
{ path: 'sequenceNumber', name: 'sequenceNumber', type: 'EventSequenceNumber', kind: 'value', description: 'The position of the event in its event sequence.' },
|
|
113
|
+
{ path: 'sequenceNumber.value', name: 'value', type: 'ulong', kind: 'value', description: 'The underlying ulong value.' },
|
|
114
|
+
{ path: 'occurred', name: 'occurred', type: 'DateTimeOffset', kind: 'value', description: 'When the event occurred - the time it was appended unless one was given.' },
|
|
115
|
+
{ path: 'occurred.Week', name: 'Week', type: 'int', kind: 'function', description: 'The ISO 8601 week of the year the value falls in.' },
|
|
116
|
+
{ path: 'eventStore', name: 'eventStore', type: 'EventStoreName', kind: 'value', description: 'The name of the event store the event belongs to.' },
|
|
117
|
+
{ path: 'eventStore.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
118
|
+
{ path: 'namespace', name: 'namespace', type: 'EventStoreNamespaceName', kind: 'value', description: 'The namespace within the event store the event belongs to.' },
|
|
119
|
+
{ path: 'namespace.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
120
|
+
{ path: 'correlationId', name: 'correlationId', type: 'CorrelationId', kind: 'value', description: 'The correlation identifier the event was appended with.' },
|
|
121
|
+
{ path: 'correlationId.value', name: 'value', type: 'Guid', kind: 'value', description: 'The underlying Guid value.' },
|
|
122
|
+
{ path: 'causation', name: 'causation', type: 'IEnumerable<Causation>', kind: 'collection', description: 'The chain of causes that led to the event - a collection, not addressable below.' },
|
|
123
|
+
{ path: 'causedBy', name: 'causedBy', type: 'Identity', kind: 'composite', description: 'The identity that caused the event.' },
|
|
124
|
+
{ path: 'causedBy.subject', name: 'subject', type: 'string', kind: 'value', description: 'The subject identifier of the identity.' },
|
|
125
|
+
{ path: 'causedBy.name', name: 'name', type: 'string', kind: 'value', description: 'The display name of the identity.' },
|
|
126
|
+
{ path: 'causedBy.userName', name: 'userName', type: 'string', kind: 'value', description: 'The user name of the identity.' },
|
|
127
|
+
{ path: 'causedBy.onBehalfOf', name: 'onBehalfOf', type: 'Identity', kind: 'composite', description: 'The identity this identity acted on behalf of, if any - an identity with the same members.' },
|
|
128
|
+
{ path: 'tags', name: 'tags', type: 'IEnumerable<Tag>', kind: 'collection', description: 'The tags the event was appended with - a collection, not addressable below.' },
|
|
129
|
+
{ path: 'hash', name: 'hash', type: 'EventHash', kind: 'value', description: 'The hash of the event content.' },
|
|
130
|
+
{ path: 'hash.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
131
|
+
{ path: 'observationState', name: 'observationState', type: 'EventObservationState', kind: 'value', description: 'Whether the observer sees the event for the first time or again on replay - differs between live processing and replay.' },
|
|
132
|
+
{ path: 'subject', name: 'subject', type: 'Subject', kind: 'value', description: 'The compliance subject the event is about - the event source identifier unless one was given.' },
|
|
133
|
+
{ path: 'subject.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },
|
|
134
|
+
{ path: 'subjectIsEventSourceId', name: 'subjectIsEventSourceId', type: 'bool', kind: 'value', description: 'Whether the subject is the event source identifier.' },
|
|
135
|
+
];
|
package/event-context.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
// Reads the generated event-context catalog. Every editor surface that describes $eventContext - projection
|
|
5
|
+
// completion and hover, and the host editor's context-variable docs and completions - goes through here, so
|
|
6
|
+
// none of them carries a list of its own.
|
|
7
|
+
|
|
8
|
+
import { eventContextPaths, eventContextRootType, eventContextTypes } from './event-context-catalog';
|
|
9
|
+
import type { EventContextMember, EventContextPath } from './event-context-catalog';
|
|
10
|
+
|
|
11
|
+
export { eventContextPaths };
|
|
12
|
+
export type { EventContextMember, EventContextPath };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether a written path segment names a member. Mirrors EventContextMember.IsNamedBy in the compiler: a property
|
|
16
|
+
* resolves camelCase or with only its first character uppercased; a function resolves by its exact name, with or
|
|
17
|
+
* without parentheses.
|
|
18
|
+
*/
|
|
19
|
+
export function namesEventContextMember(member: EventContextMember, segment: string): boolean {
|
|
20
|
+
if (member.kind === 'function') {
|
|
21
|
+
return segment === member.name || segment === `${member.name}()`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const declared = member.name[0].toUpperCase() + member.name.slice(1);
|
|
25
|
+
return segment === declared || (segment.length > 0 && segment[0].toUpperCase() + segment.slice(1) === declared);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The members of the event context itself - the first segment of every path. */
|
|
29
|
+
export const eventContextMembers: readonly EventContextMember[] = eventContextTypes[eventContextRootType];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The members that may follow the given segments after `$eventContext.`, or undefined when the segments do not
|
|
33
|
+
* resolve or stop at a collection or function, below which nothing is addressable.
|
|
34
|
+
*/
|
|
35
|
+
export function eventContextMembersAfter(segments: readonly string[]): readonly EventContextMember[] | undefined {
|
|
36
|
+
let members = eventContextMembers;
|
|
37
|
+
for (const segment of segments) {
|
|
38
|
+
const member = members.find((candidate) => namesEventContextMember(candidate, segment));
|
|
39
|
+
if (!member || member.kind === 'collection' || member.kind === 'function') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
members = eventContextTypes[member.type] ?? [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return members;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The member the given segments name, or undefined when they do not resolve. */
|
|
50
|
+
export function eventContextMemberAt(segments: readonly string[]): EventContextMember | undefined {
|
|
51
|
+
if (segments.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const members = eventContextMembersAfter(segments.slice(0, -1));
|
|
56
|
+
return members?.find((member) => namesEventContextMember(member, segments[segments.length - 1]));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The outcome of resolving a path against the catalog. Mirrors EventContextPathStatus in the compiler. */
|
|
60
|
+
export type EventContextPathStatus = 'known' | 'missing' | 'unknownMember' | 'unknownSubPath' | 'belowCollection';
|
|
61
|
+
|
|
62
|
+
/** A path resolved against the catalog. Mirrors EventContextPathResolution in the compiler. */
|
|
63
|
+
export interface EventContextPathResolution {
|
|
64
|
+
readonly status: EventContextPathStatus;
|
|
65
|
+
readonly member?: EventContextMember;
|
|
66
|
+
readonly segment?: string;
|
|
67
|
+
readonly expected: readonly EventContextMember[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolves a path, as written after `$eventContext.`, the way EventContextCatalog.Resolve in the compiler does, so the
|
|
72
|
+
* editor reports what the compiler reports.
|
|
73
|
+
*/
|
|
74
|
+
export function resolveEventContextPath(path: string): EventContextPathResolution {
|
|
75
|
+
let current: EventContextMember | undefined;
|
|
76
|
+
let expected = eventContextMembers;
|
|
77
|
+
for (const segment of path.split('.')) {
|
|
78
|
+
if (segment.length === 0) {
|
|
79
|
+
return { status: 'missing', member: current, expected };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (current?.kind === 'collection') {
|
|
83
|
+
return { status: 'belowCollection', member: current, segment, expected: [] };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const next = expected.find((member) => namesEventContextMember(member, segment));
|
|
87
|
+
if (!next) {
|
|
88
|
+
return { status: current ? 'unknownSubPath' : 'unknownMember', member: current, segment, expected };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
current = next;
|
|
92
|
+
expected = next.kind === 'function' ? [] : eventContextTypes[next.type] ?? [];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { status: 'known', member: current, expected: [] };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Markdown describing $eventContext and its members, for hovers. */
|
|
99
|
+
export function describeEventContext(): string {
|
|
100
|
+
return [
|
|
101
|
+
'**$eventContext**',
|
|
102
|
+
'',
|
|
103
|
+
'Metadata about the event being projected. Paths are checked against the event-context catalog; `causation` and `tags` are collections and cannot be addressed below.',
|
|
104
|
+
'',
|
|
105
|
+
'**Members:**',
|
|
106
|
+
...eventContextMembers.map((member) => `- \`${member.name}\` (${member.type}) - ${member.description}`),
|
|
107
|
+
].join('\n');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Markdown describing one member of the event context, for hovers. */
|
|
111
|
+
export function describeEventContextMember(path: string, member: EventContextMember): string {
|
|
112
|
+
const below = member.kind === 'collection' || member.kind === 'function' ? [] : eventContextTypes[member.type] ?? [];
|
|
113
|
+
const lines = [`**$eventContext.${path}**: \`${member.type}\``, '', member.description];
|
|
114
|
+
if (below.length > 0) {
|
|
115
|
+
lines.push('', `**Members:** ${below.map((child) => `\`${child.name}\``).join(', ')}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return lines.join('\n');
|
|
119
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { describe, expect, it } from 'vitest';
|
|
5
|
+
import vectors from '../event-context-resolution-vectors.json';
|
|
6
|
+
import { resolveEventContextPath } from '../event-context';
|
|
7
|
+
|
|
8
|
+
describe('when resolving paths generated from the C# event-context catalog', () => {
|
|
9
|
+
it('agrees with C# on every known, missing and invalid path', () => {
|
|
10
|
+
expect(vectors.length).toBeGreaterThan(50);
|
|
11
|
+
for (const vector of vectors) {
|
|
12
|
+
expect(resolveEventContextPath(vector.path).status, vector.path).toBe(vector.status);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { describe, beforeEach, it } from 'vitest';
|
|
5
|
+
import type { editor, languages, Position } from 'monaco-editor';
|
|
6
|
+
import { CompletionProvider } from '../sub-languages/projection/CompletionProvider';
|
|
7
|
+
import { eventContextMembers } from '../event-context';
|
|
8
|
+
|
|
9
|
+
function complete(line: string): string[] {
|
|
10
|
+
const lines = ['projection Statistics => StatisticsReadModel', ' all', line];
|
|
11
|
+
const model = {
|
|
12
|
+
getLineContent: (lineNumber: number) => lines[lineNumber - 1],
|
|
13
|
+
getWordAtPosition: () => null,
|
|
14
|
+
} as unknown as editor.ITextModel;
|
|
15
|
+
const position = { lineNumber: 3, column: line.length + 1 } as Position;
|
|
16
|
+
const result = new CompletionProvider().provideCompletionItems(model, position) as languages.CompletionList;
|
|
17
|
+
return result.suggestions.map((suggestion) => suggestion.label as string);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('when completing the first segment of an event context path', () => {
|
|
21
|
+
let labels: string[];
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
labels = complete(' lastSeen = $eventContext.');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should offer every member of the catalog', () => {
|
|
28
|
+
labels.should.have.members(eventContextMembers.map((member) => member.name));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should offer the event store', () => {
|
|
32
|
+
labels.should.include('eventStore');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should offer the namespace', () => {
|
|
36
|
+
labels.should.include('namespace');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should not offer a causation identifier', () => {
|
|
40
|
+
labels.should.not.include('causationId');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('when completing below a composite member of an event context path', () => {
|
|
45
|
+
let labels: string[];
|
|
46
|
+
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
labels = complete(' by = $eventContext.causedBy.');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should offer the members of the identity', () => {
|
|
52
|
+
labels.should.have.members(['subject', 'name', 'userName', 'onBehalfOf']);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('when completing a dynamic dictionary key', () => {
|
|
57
|
+
let labels: string[];
|
|
58
|
+
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
labels = complete(' count eventCountByType.$eventContext.eventType.');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should offer the members of the event type', () => {
|
|
64
|
+
labels.should.have.members(['id', 'generation', 'tombstone']);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe('when completing below a collection of the event context', () => {
|
|
69
|
+
let labels: string[];
|
|
70
|
+
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
labels = complete(' x = $eventContext.causation.');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should offer nothing', () => {
|
|
76
|
+
labels.should.be.empty;
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('when completing the week of when the event occurred', () => {
|
|
81
|
+
let labels: string[];
|
|
82
|
+
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
labels = complete(' week = $eventContext.occurred.');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should offer the derived week', () => {
|
|
88
|
+
labels.should.have.members(['Week']);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('when completing below the caused by short form', () => {
|
|
93
|
+
let labels: string[];
|
|
94
|
+
|
|
95
|
+
beforeEach(() => {
|
|
96
|
+
labels = complete(' by = $causedBy.onBehalfOf.');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should offer the members of the identity it acted for', () => {
|
|
100
|
+
labels.should.have.members(['subject', 'name', 'userName', 'onBehalfOf']);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { describe, beforeEach, it } from 'vitest';
|
|
5
|
+
import type { editor, languages, Position } from 'monaco-editor';
|
|
6
|
+
import { HoverProvider } from '../sub-languages/projection/HoverProvider';
|
|
7
|
+
import { eventContextMembers } from '../event-context';
|
|
8
|
+
|
|
9
|
+
const line = ' type = $eventContext.eventType.id';
|
|
10
|
+
|
|
11
|
+
function hover(word: string): string {
|
|
12
|
+
const startColumn = line.lastIndexOf(word) + 1;
|
|
13
|
+
const lines = ['projection Statistics => StatisticsReadModel', ' all', line];
|
|
14
|
+
const model = {
|
|
15
|
+
getLineContent: (lineNumber: number) => lines[lineNumber - 1],
|
|
16
|
+
getWordAtPosition: () => ({ word, startColumn, endColumn: startColumn + word.length }),
|
|
17
|
+
} as unknown as editor.ITextModel;
|
|
18
|
+
const result = new HoverProvider().provideHover(model, { lineNumber: 3, column: startColumn } as Position) as languages.Hover;
|
|
19
|
+
return (result.contents[0] as { value: string }).value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('when hovering the event context', () => {
|
|
23
|
+
let content: string;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
content = hover('$eventContext');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should list every member of the catalog', () => {
|
|
30
|
+
eventContextMembers.every((member) => content.includes(`\`${member.name}\``)).should.be.true;
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('when hovering a member of an event context path that is also a keyword', () => {
|
|
35
|
+
let content: string;
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
content = hover('id');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should describe the member rather than the keyword', () => {
|
|
42
|
+
content.should.include('$eventContext.eventType.id');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { describe, it, expect } from 'vitest';
|
|
5
|
+
import type { editor } from 'monaco-editor';
|
|
6
|
+
import { Validator } from '../sub-languages/projection/Validator';
|
|
7
|
+
|
|
8
|
+
const modelFor = (content: string): editor.ITextModel => ({ getValue: () => content }) as editor.ITextModel;
|
|
9
|
+
|
|
10
|
+
describe('when validating event context paths in the standalone projection editor', () => {
|
|
11
|
+
const markers = new Validator().validate(modelFor([
|
|
12
|
+
'projection Orders',
|
|
13
|
+
' from OrderPlaced',
|
|
14
|
+
' bad = $eventContext.unknown',
|
|
15
|
+
' badPath = $eventContext.eventType.unknown',
|
|
16
|
+
' badCollection = $eventContext.tags.value',
|
|
17
|
+
' missing = $eventContext.',
|
|
18
|
+
' totals.$causedBy.subject = quantity',
|
|
19
|
+
' good = $eventContext.occurred.Week()',
|
|
20
|
+
].join('\n')));
|
|
21
|
+
|
|
22
|
+
it('reports each catalog diagnostic with its source line and severity', () => {
|
|
23
|
+
expect(markers.filter(marker => typeof marker.code === 'string').map(marker => [marker.code, marker.startLineNumber, marker.severity])).toEqual([
|
|
24
|
+
['PLAY0295', 3, 4],
|
|
25
|
+
['PLAY0296', 4, 4],
|
|
26
|
+
['PLAY0297', 5, 8],
|
|
27
|
+
['PLAY0298', 6, 8],
|
|
28
|
+
['PLAY0299', 7, 4],
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -27,6 +27,13 @@ const document = [
|
|
|
27
27
|
' registeredBy = $context.wat',
|
|
28
28
|
' causedBy = $context.causedBy.wat',
|
|
29
29
|
' department = $context.identity.wat',
|
|
30
|
+
' projection Statistics => StatisticsReadModel',
|
|
31
|
+
' from InvoiceRegistered',
|
|
32
|
+
' cause = $eventContext.causationId',
|
|
33
|
+
' typeName = $eventContext.eventType.name',
|
|
34
|
+
' firstCause = $eventContext.causation.occurred',
|
|
35
|
+
' nothing = $eventContext.',
|
|
36
|
+
' count byUser.$causedBy.subject',
|
|
30
37
|
' query Overdue => OverdueReadModel[]',
|
|
31
38
|
' performer',
|
|
32
39
|
' csharp',
|