@cratis/screenplay-language 4.52.0 → 4.54.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/README.md +15 -0
- package/dist/TypeReferenceSymbol.d.ts +8 -0
- package/dist/TypeReferenceSymbol.d.ts.map +1 -0
- package/dist/bundles/chunk-GJX4NJYC.js +4836 -0
- package/dist/bundles/chunk-GJX4NJYC.js.map +7 -0
- package/dist/bundles/index.js +1417 -0
- package/dist/bundles/index.js.map +7 -0
- package/dist/bundles/sub-languages/capture/index.js +677 -0
- package/dist/bundles/sub-languages/capture/index.js.map +7 -0
- package/dist/bundles/sub-languages/projection/index.js +1647 -0
- package/dist/bundles/sub-languages/projection/index.js.map +7 -0
- package/dist/code-actions.d.ts +3 -0
- package/dist/code-actions.d.ts.map +1 -0
- package/dist/completion-items.d.ts +1 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.d.ts.map +1 -1
- package/dist/completions.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +3 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/hover-content.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts +1 -0
- package/dist/language.d.ts.map +1 -1
- package/dist/production-destinations.d.ts.map +1 -1
- package/dist/symbols.d.ts +4 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -1
- package/package.json +13 -9
- package/DestinationHint.ts +0 -8
- package/ProductionSymbol.ts +0 -11
- package/completion-items.ts +0 -261
- package/completion-planner.ts +0 -167
- package/completions.ts +0 -156
- package/diagnostic-codes.ts +0 -43
- package/diagnostics.ts +0 -55
- package/dist/DestinationHint.js +0 -4
- package/dist/DestinationHint.js.map +0 -1
- package/dist/ProductionSymbol.js +0 -4
- package/dist/ProductionSymbol.js.map +0 -1
- package/dist/completion-items.js +0 -228
- package/dist/completion-items.js.map +0 -1
- package/dist/completion-planner.js +0 -143
- package/dist/completion-planner.js.map +0 -1
- package/dist/completions.js +0 -101
- package/dist/completions.js.map +0 -1
- package/dist/diagnostic-codes.js +0 -41
- package/dist/diagnostic-codes.js.map +0 -1
- package/dist/diagnostics.js +0 -50
- package/dist/diagnostics.js.map +0 -1
- package/dist/document-context.js +0 -85
- package/dist/document-context.js.map +0 -1
- package/dist/event-analysis-source.js +0 -19
- package/dist/event-analysis-source.js.map +0 -1
- package/dist/event-context-catalog.js +0 -116
- package/dist/event-context-catalog.js.map +0 -1
- package/dist/event-context.js +0 -88
- package/dist/event-context.js.map +0 -1
- package/dist/file-imports.js +0 -58
- package/dist/file-imports.js.map +0 -1
- package/dist/file-references.js +0 -70
- package/dist/file-references.js.map +0 -1
- package/dist/hover-content.js +0 -98
- package/dist/hover-content.js.map +0 -1
- package/dist/hover.js +0 -15
- package/dist/hover.js.map +0 -1
- package/dist/index.js +0 -61
- package/dist/index.js.map +0 -1
- package/dist/inlay-hints.js +0 -15
- package/dist/inlay-hints.js.map +0 -1
- package/dist/inline-event-validation.js +0 -131
- package/dist/inline-event-validation.js.map +0 -1
- package/dist/keyword-docs.js +0 -148
- package/dist/keyword-docs.js.map +0 -1
- package/dist/language.js +0 -196
- package/dist/language.js.map +0 -1
- package/dist/production-destinations.js +0 -32
- package/dist/production-destinations.js.map +0 -1
- package/dist/sub-language-registry.js +0 -18
- package/dist/sub-language-registry.js.map +0 -1
- package/dist/sub-languages/capture/CompletionProvider.js +0 -332
- package/dist/sub-languages/capture/CompletionProvider.js.map +0 -1
- package/dist/sub-languages/capture/HoverProvider.js +0 -87
- package/dist/sub-languages/capture/HoverProvider.js.map +0 -1
- package/dist/sub-languages/capture/Validator.js +0 -72
- package/dist/sub-languages/capture/Validator.js.map +0 -1
- package/dist/sub-languages/capture/index.js +0 -58
- package/dist/sub-languages/capture/index.js.map +0 -1
- package/dist/sub-languages/capture/language.js +0 -160
- package/dist/sub-languages/capture/language.js.map +0 -1
- package/dist/sub-languages/cdl.js +0 -74
- package/dist/sub-languages/cdl.js.map +0 -1
- package/dist/sub-languages/pdl.js +0 -73
- package/dist/sub-languages/pdl.js.map +0 -1
- package/dist/sub-languages/projection/CodeActionProvider.js +0 -93
- package/dist/sub-languages/projection/CodeActionProvider.js.map +0 -1
- package/dist/sub-languages/projection/CompletionProvider.js +0 -595
- package/dist/sub-languages/projection/CompletionProvider.js.map +0 -1
- package/dist/sub-languages/projection/HoverProvider.js +0 -333
- package/dist/sub-languages/projection/HoverProvider.js.map +0 -1
- package/dist/sub-languages/projection/Validator.js +0 -388
- package/dist/sub-languages/projection/Validator.js.map +0 -1
- package/dist/sub-languages/projection/index.js +0 -160
- package/dist/sub-languages/projection/index.js.map +0 -1
- package/dist/sub-languages/projection/language.js +0 -171
- package/dist/sub-languages/projection/language.js.map +0 -1
- package/dist/symbols.js +0 -275
- package/dist/symbols.js.map +0 -1
- package/dist/themes/screenplay-dark.js +0 -30
- package/dist/themes/screenplay-dark.js.map +0 -1
- package/dist/themes/screenplay-light.js +0 -30
- package/dist/themes/screenplay-light.js.map +0 -1
- package/dist/tokens.js +0 -147
- package/dist/tokens.js.map +0 -1
- package/dist/validation.js +0 -248
- package/dist/validation.js.map +0 -1
- package/document-context.ts +0 -93
- package/event-analysis-source.ts +0 -18
- package/event-context-catalog.ts +0 -135
- package/event-context.ts +0 -119
- package/file-imports.ts +0 -70
- package/file-references.ts +0 -87
- package/for_documentContext/when_stripping_comments.ts +0 -32
- package/for_eventContext/when_resolving_generated_catalog_vectors.ts +0 -15
- package/for_eventGenerations/when_editing_event_generations.ts +0 -57
- package/for_fileImports/when_finding_file_imports.ts +0 -38
- package/for_fileReferences/when_recognizing_an_absolute_path/with_paths_of_every_shape.ts +0 -26
- package/for_fileReferences/when_scanning_a_document/inside_a_code_fence.ts +0 -26
- package/for_fileReferences/when_scanning_a_document/with_a_bare_file_keyword.ts +0 -19
- package/for_fileReferences/when_scanning_a_document/with_a_file_directive.ts +0 -30
- package/for_fileReferences/when_scanning_a_document/with_a_property_named_file.ts +0 -25
- package/for_fileReferences/when_scanning_a_document/with_a_trailing_comment.ts +0 -25
- package/for_fileReferences/when_scanning_a_document/with_directives_on_several_constructs.ts +0 -41
- package/for_importablePaths/when_listing_what_a_document_can_import.ts +0 -34
- package/for_inlineEvents/when_analyzing_many_inline_events.ts +0 -59
- package/for_inlineEvents/when_authoring_inline_events.ts +0 -149
- package/for_inlineEvents/when_completing_many_events.ts +0 -49
- package/for_inlineEvents/when_indexing_command_production_ownership.ts +0 -79
- package/for_planCompletions/when_completing_a_file_import.ts +0 -26
- package/for_planCompletions/when_completing_a_specification_query.ts +0 -24
- package/for_planCompletions/when_completing_a_specification_step.ts +0 -42
- package/for_planCompletions/when_completing_an_absent_read_model.ts +0 -14
- package/for_planCompletions/when_completing_reaction_reads.ts +0 -36
- package/for_projectionCompletionProvider/when_completing_an_event_context_path.ts +0 -102
- package/for_projectionHoverProvider/when_hovering_an_event_context_path.ts +0 -44
- package/for_projectionValidator/when_validating_a_projection_with_variants.ts +0 -128
- package/for_projectionValidator/when_validating_event_context_paths.ts +0 -31
- package/for_scanDocument/when_scanning_a_query/with_a_dotted_return_type.ts +0 -34
- package/for_scanDocument/when_scanning_aliased_reads.ts +0 -33
- package/for_scanDocument/when_scanning_many_commands.ts +0 -47
- package/for_tokens/when_highlighting_a_file_import.ts +0 -18
- package/for_tokens/when_highlighting_event_metadata.ts +0 -63
- package/for_tokens/when_highlighting_specification_steps.ts +0 -28
- package/for_validateLines/when_validating_a_document/with_a_problem_of_every_coded_kind.ts +0 -77
- package/for_validateLines/when_validating_a_document/with_an_unknown_policy.ts +0 -33
- package/for_validateLines/when_validating_a_file_placed_by_an_import/with_names_declared_in_other_files.ts +0 -43
- package/for_validateLines/when_validating_event_context_paths/in_a_projection.ts +0 -97
- package/for_validateLines/when_validating_file_imports/at_every_level.ts +0 -36
- package/for_validateLines/when_validating_production_destinations/with_an_available_identifier.ts +0 -120
- package/hover-content.ts +0 -117
- package/hover.ts +0 -23
- package/index.ts +0 -125
- package/inlay-hints.ts +0 -17
- package/inline-event-validation.ts +0 -115
- package/keyword-docs.ts +0 -152
- package/language.ts +0 -212
- package/production-destinations.ts +0 -32
- package/sub-language-registry.ts +0 -42
- package/sub-languages/capture/CompletionProvider.ts +0 -365
- package/sub-languages/capture/HoverProvider.ts +0 -99
- package/sub-languages/capture/Validator.ts +0 -97
- package/sub-languages/capture/index.ts +0 -72
- package/sub-languages/capture/language.ts +0 -176
- package/sub-languages/cdl.ts +0 -76
- package/sub-languages/pdl.ts +0 -75
- package/sub-languages/projection/CodeActionProvider.ts +0 -123
- package/sub-languages/projection/CompletionProvider.ts +0 -660
- package/sub-languages/projection/HoverProvider.ts +0 -377
- package/sub-languages/projection/Validator.ts +0 -441
- package/sub-languages/projection/index.ts +0 -223
- package/sub-languages/projection/language.ts +0 -193
- package/symbols.ts +0 -374
- package/themes/screenplay-dark.ts +0 -33
- package/themes/screenplay-light.ts +0 -33
- package/tokens.ts +0 -174
- package/validation.ts +0 -443
- package/vitest.setup.ts +0 -5
package/dist/hover-content.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
import { enclosingChain, fenceMap, indentOf } from './document-context';
|
|
4
|
-
import { directBody, scanDocument } from './symbols';
|
|
5
|
-
import { eventAnalysisSource } from './event-analysis-source';
|
|
6
|
-
import { getSubLanguage } from './sub-language-registry';
|
|
7
|
-
import { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';
|
|
8
|
-
// Produces the hover markdown for a word at a position, without any editor
|
|
9
|
-
// dependency — the Monaco service and the VSCode extension share this content.
|
|
10
|
-
// Columns are 1-based, matching both editors' word-at-position APIs.
|
|
11
|
-
export function hoverContent(lines, lineIndex, word, startColumn, endColumn) {
|
|
12
|
-
const fences = fenceMap(lines);
|
|
13
|
-
if (fences[lineIndex])
|
|
14
|
-
return null;
|
|
15
|
-
const line = lines[lineIndex] ?? '';
|
|
16
|
-
const before = line.charAt(startColumn - 2);
|
|
17
|
-
if (before === '@') {
|
|
18
|
-
const doc = attributeDocs[word];
|
|
19
|
-
if (doc)
|
|
20
|
-
return doc;
|
|
21
|
-
}
|
|
22
|
-
if (before === '$' || before === '.') {
|
|
23
|
-
const variable = line.substring(0, endColumn - 1).match(/\$[\w.]*$/)?.[0];
|
|
24
|
-
if (variable) {
|
|
25
|
-
const doc = contextVariableDocs[variable] ??
|
|
26
|
-
(variable.startsWith('$env') ? contextVariableDocs['$env'] : undefined);
|
|
27
|
-
if (doc)
|
|
28
|
-
return doc;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const symbols = scanDocument(lines);
|
|
32
|
-
const concept = symbols.concepts.find((candidate) => candidate.name === word);
|
|
33
|
-
if (concept) {
|
|
34
|
-
const attributes = concept.attributes.length ? ` ${concept.attributes.join(' ')}` : '';
|
|
35
|
-
const values = concept.enumValues.length
|
|
36
|
-
? `\n\nValues: ${concept.enumValues.join(', ')}`
|
|
37
|
-
: '';
|
|
38
|
-
const reasons = Object.entries(concept.attributeReasons)
|
|
39
|
-
.map(([attribute, reason]) => `\n\n**@${attribute}** — ${reason}`)
|
|
40
|
-
.join('');
|
|
41
|
-
return `\`\`\`screenplay\nconcept ${concept.name} : ${concept.primitive}${attributes}\n\`\`\`${reasons}${values}`;
|
|
42
|
-
}
|
|
43
|
-
const type = symbols.types.find((candidate) => candidate.name === word);
|
|
44
|
-
if (type) {
|
|
45
|
-
const properties = type.properties
|
|
46
|
-
.map((property) => `${property.name} ${property.type}`)
|
|
47
|
-
.join('\n');
|
|
48
|
-
return `\`\`\`screenplay\ntype ${type.name}\n${properties}\n\`\`\``;
|
|
49
|
-
}
|
|
50
|
-
const policy = symbols.policies.find((candidate) => candidate.name === word);
|
|
51
|
-
if (policy) {
|
|
52
|
-
const body = policy.requires.length ? policy.requires.join('\n') : '(custom C#)';
|
|
53
|
-
return `\`\`\`screenplay\npolicy ${policy.name}\n${body}\n\`\`\``;
|
|
54
|
-
}
|
|
55
|
-
const event = symbols.events.find((candidate) => candidate.name === word && candidate.line === lineIndex) ??
|
|
56
|
-
symbols.events.filter((candidate) => candidate.name === word)
|
|
57
|
-
.sort((left, right) => (right.generation ?? 1) - (left.generation ?? 1))[0];
|
|
58
|
-
if (event) {
|
|
59
|
-
const properties = event.properties
|
|
60
|
-
.map((property) => `${property.name} ${property.type}`)
|
|
61
|
-
.join('\n');
|
|
62
|
-
return `\`\`\`screenplay\nevent ${event.name}${event.generation !== undefined ? ` generation ${event.generation}` : ''}\n${properties}\n\`\`\``;
|
|
63
|
-
}
|
|
64
|
-
const command = symbols.commands.find((candidate) => candidate.name === word);
|
|
65
|
-
if (command && command.properties.length > 0) {
|
|
66
|
-
const properties = command.properties
|
|
67
|
-
.map((property) => `${property.name} ${property.type}${property.isIdentifier ? ' identifier' : ''}`)
|
|
68
|
-
.join('\n');
|
|
69
|
-
return `\`\`\`screenplay\ncommand ${command.name}\n${properties}\n\`\`\``;
|
|
70
|
-
}
|
|
71
|
-
// Sub-language keywords take precedence inside their construct.
|
|
72
|
-
const chain = enclosingChain(lines, fences, lineIndex, indentOf(line));
|
|
73
|
-
for (const construct of [line.trim().split(/\s+/)[0], ...chain]) {
|
|
74
|
-
const subLanguage = getSubLanguage(construct ?? '');
|
|
75
|
-
const doc = subLanguage?.hovers?.[word];
|
|
76
|
-
if (doc)
|
|
77
|
-
return doc;
|
|
78
|
-
}
|
|
79
|
-
if (word === 'reads' && (chain[0] === 'every' || chain[0] === 'at') && chain.includes('reaction')) {
|
|
80
|
-
return '**reads** — Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.';
|
|
81
|
-
}
|
|
82
|
-
const step = line.trim().match(/^(given|when|then)\s+(?:no\s+)?(\w+)/);
|
|
83
|
-
if (step && step[2] === word && chain[0] === 'specification' && specificationKeywordDocs[word]) {
|
|
84
|
-
return `**${word}** — ${specificationKeywordDocs[word]}`;
|
|
85
|
-
}
|
|
86
|
-
if (word === 'id' || word === 'documentation') {
|
|
87
|
-
const source = eventAnalysisSource(lines);
|
|
88
|
-
const inEvent = symbols.events.some(event => directBody(source, fences, event.line, indentOf(source[event.line])).includes(lineIndex));
|
|
89
|
-
const directive = word === 'id' ? /^\s*id\s+"/.test(source[lineIndex]) : /^\s*documentation\s*$/.test(source[lineIndex]);
|
|
90
|
-
if (!inEvent || !directive || startColumn !== indentOf(line) + 1)
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const keywordDoc = keywordDocs[word];
|
|
94
|
-
if (keywordDoc)
|
|
95
|
-
return `**${word}** — ${keywordDoc}`;
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=hover-content.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hover-content.js","sourceRoot":"","sources":["../hover-content.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE3G,2EAA2E;AAC3E,+EAA+E;AAC/E,qEAAqE;AACrE,MAAM,UAAU,YAAY,CACxB,KAAe,EACf,SAAiB,EACjB,IAAY,EACZ,WAAmB,EACnB,SAAiB;IAEjB,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KAAK,IAAI,QAAQ,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7D,CAAC;IAED,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QACvI,MAAM,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,WAAW,KAAK,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;IAClF,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,UAAU;QAAE,OAAO,KAAK,IAAI,QAAQ,UAAU,EAAE,CAAC;IAErD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/dist/hover.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
import { hoverContent } from './hover-content';
|
|
4
|
-
export function createHoverProvider() {
|
|
5
|
-
return {
|
|
6
|
-
provideHover(model, position) {
|
|
7
|
-
const word = model.getWordAtPosition(position);
|
|
8
|
-
if (!word)
|
|
9
|
-
return null;
|
|
10
|
-
const content = hoverContent(model.getLinesContent(), position.lineNumber - 1, word.word, word.startColumn, word.endColumn);
|
|
11
|
-
return content ? { contents: [{ value: content }] } : null;
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=hover.js.map
|
package/dist/hover.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../hover.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,mBAAmB;IAC/B,OAAO;QACH,YAAY,CAAC,KAAK,EAAE,QAAQ;YACxB,MAAM,IAAI,GAAG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YAEvB,MAAM,OAAO,GAAG,YAAY,CACxB,KAAK,CAAC,eAAe,EAAE,EACvB,QAAQ,CAAC,UAAU,GAAG,CAAC,EACvB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,SAAS,CACjB,CAAC;YACF,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/D,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
import { languageConfiguration, languageExtensionPoint, languageId, } from './language';
|
|
4
|
-
import { createTokensProvider } from './tokens';
|
|
5
|
-
import { createCompletionProvider } from './completions';
|
|
6
|
-
import { createHoverProvider } from './hover';
|
|
7
|
-
import { createInlayHintsProvider } from './inlay-hints';
|
|
8
|
-
import { attachDiagnostics } from './diagnostics';
|
|
9
|
-
import { getSubLanguage, getSubLanguages, onSubLanguagesChanged, registerSubLanguage, } from './sub-language-registry';
|
|
10
|
-
import { pdl } from './sub-languages/pdl';
|
|
11
|
-
import { cdl } from './sub-languages/cdl';
|
|
12
|
-
import { screenplayDark, screenplayDarkThemeName } from './themes/screenplay-dark';
|
|
13
|
-
import { screenplayLight, screenplayLightThemeName } from './themes/screenplay-light';
|
|
14
|
-
const registeredInstances = new Set();
|
|
15
|
-
function applyTokensProvider(monaco) {
|
|
16
|
-
monaco.languages.setMonarchTokensProvider(languageId, createTokensProvider(getSubLanguages()));
|
|
17
|
-
}
|
|
18
|
-
// Sub-languages registered after register() recompose the tokenizer on the fly.
|
|
19
|
-
onSubLanguagesChanged(() => registeredInstances.forEach(applyTokensProvider));
|
|
20
|
-
// Registers the built-in PDL and CDL sub-languages. Hosts that do not go through
|
|
21
|
-
// register() — such as the VSCode extension — call this before using the registry.
|
|
22
|
-
export function ensureBuiltInSubLanguages() {
|
|
23
|
-
if (!getSubLanguage('projection'))
|
|
24
|
-
registerSubLanguage('projection', pdl);
|
|
25
|
-
if (!getSubLanguage('capture'))
|
|
26
|
-
registerSubLanguage('capture', cdl);
|
|
27
|
-
}
|
|
28
|
-
export function register(monaco, options = {}) {
|
|
29
|
-
if (registeredInstances.has(monaco))
|
|
30
|
-
return;
|
|
31
|
-
ensureBuiltInSubLanguages();
|
|
32
|
-
registeredInstances.add(monaco);
|
|
33
|
-
monaco.languages.register(languageExtensionPoint);
|
|
34
|
-
monaco.languages.setLanguageConfiguration(languageId, languageConfiguration);
|
|
35
|
-
applyTokensProvider(monaco);
|
|
36
|
-
monaco.languages.registerCompletionItemProvider(languageId, createCompletionProvider(monaco, options));
|
|
37
|
-
monaco.languages.registerHoverProvider(languageId, createHoverProvider());
|
|
38
|
-
monaco.languages.registerInlayHintsProvider(languageId, createInlayHintsProvider());
|
|
39
|
-
monaco.editor.defineTheme(screenplayDarkThemeName, screenplayDark);
|
|
40
|
-
monaco.editor.defineTheme(screenplayLightThemeName, screenplayLight);
|
|
41
|
-
attachDiagnostics(monaco);
|
|
42
|
-
}
|
|
43
|
-
export { causedByProperties, clauseKeywords, codeBlockTags, conceptAttributes, constructKeywords, contextRoots, languageId, primitiveTypes, sliceTypes, } from './language';
|
|
44
|
-
export { getSubLanguage, getSubLanguages, registerSubLanguage } from './sub-language-registry';
|
|
45
|
-
export { pdl } from './sub-languages/pdl';
|
|
46
|
-
export { cdl } from './sub-languages/cdl';
|
|
47
|
-
export { screenplayDarkThemeName } from './themes/screenplay-dark';
|
|
48
|
-
export { screenplayLightThemeName } from './themes/screenplay-light';
|
|
49
|
-
export { enclosingChain, fenceMap, firstWord, indentOf } from './document-context';
|
|
50
|
-
export { fileReferenceKeyword, fileReferenceOn, fileReferences, isAbsoluteFileReferencePath, } from './file-references';
|
|
51
|
-
export { fileImportOn, fileImports, importablePaths, isFileImportLine } from './file-imports';
|
|
52
|
-
export { builtInTriggerNames, knownEventNames, knownTriggerNames, knownTypeNames, mergeSymbols, scanDocument } from './symbols';
|
|
53
|
-
export { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';
|
|
54
|
-
export { eventContextMemberAt, eventContextMembers, eventContextMembersAfter, eventContextPaths, namesEventContextMember } from './event-context';
|
|
55
|
-
export { contextVariableItems, producesItems, specificationStepItems } from './completion-items';
|
|
56
|
-
export { completionEntriesFor, planCompletions } from './completion-planner';
|
|
57
|
-
export { hoverContent } from './hover-content';
|
|
58
|
-
export { validateLines } from './validation';
|
|
59
|
-
export { destinationHints, productionDestinations } from './production-destinations';
|
|
60
|
-
export { diagnosticCodes } from './diagnostic-codes';
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qG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,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EACH,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,2BAA2B,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAG9F,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAchI,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC3G,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAElJ,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAIrF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/inlay-hints.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
import { destinationHints } from './production-destinations';
|
|
4
|
-
export function createInlayHintsProvider() {
|
|
5
|
-
return {
|
|
6
|
-
provideInlayHints(model, range) {
|
|
7
|
-
const hints = destinationHints(model.getLinesContent()).filter(hint => hint.line + 1 >= range.startLineNumber && hint.line + 1 <= range.endLineNumber);
|
|
8
|
-
return {
|
|
9
|
-
hints: hints.map(hint => ({ position: { lineNumber: hint.line + 1, column: hint.column }, label: hint.label, paddingLeft: true })),
|
|
10
|
-
dispose() { },
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=inlay-hints.js.map
|
package/dist/inlay-hints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inlay-hints.js","sourceRoot":"","sources":["../inlay-hints.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,UAAU,wBAAwB;IACpC,OAAO;QACH,iBAAiB,CAAC,KAAK,EAAE,KAAK;YAC1B,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,eAAe,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;YACvJ,OAAO;gBACH,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;gBAClI,OAAO,KAAI,CAAC;aACf,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
import { diagnosticCodes } from './diagnostic-codes';
|
|
4
|
-
import { fenceMap, indentOf } from './document-context';
|
|
5
|
-
import { productionDestinations } from './production-destinations';
|
|
6
|
-
import { eventAnalysisSource } from './event-analysis-source';
|
|
7
|
-
import { directBody } from './symbols';
|
|
8
|
-
const reserved = new Set(['namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);
|
|
9
|
-
const quotedId = /^id\s+"((?:[^"\\]|\\.)*)"$/;
|
|
10
|
-
export function validateInlineEvents(lines, symbols, application) {
|
|
11
|
-
lines = eventAnalysisSource(lines);
|
|
12
|
-
const issues = [];
|
|
13
|
-
const fences = fenceMap(lines);
|
|
14
|
-
const documentationBlocks = nonemptyMarkdownBlocks(lines, fences);
|
|
15
|
-
const commandProductions = new Set(symbols.commands.flatMap(command => command.productionHeaders ?? []));
|
|
16
|
-
const eventCounts = new Map();
|
|
17
|
-
const importedNames = new Set();
|
|
18
|
-
for (const document of [symbols, application]) {
|
|
19
|
-
for (const event of document.events)
|
|
20
|
-
eventCounts.set(event.name, (eventCounts.get(event.name) ?? 0) + 1);
|
|
21
|
-
for (const imported of document.imports)
|
|
22
|
-
importedNames.add(imported.shortName);
|
|
23
|
-
}
|
|
24
|
-
const report = (line, code, message, severity = 'error') => {
|
|
25
|
-
issues.push({ line, startColumn: indentOf(lines[line]) + 1, endColumn: lines[line].length + 1, code, message, severity });
|
|
26
|
-
};
|
|
27
|
-
for (const event of symbols.events) {
|
|
28
|
-
const body = directBody(lines, fences, event.line, indentOf(lines[event.line]));
|
|
29
|
-
if (event.inline) {
|
|
30
|
-
const properties = new Set();
|
|
31
|
-
for (const property of event.properties) {
|
|
32
|
-
if (properties.has(property.name))
|
|
33
|
-
report(property.line, diagnosticCodes.duplicateDeclaration, `Event '${event.name}' already declares property '${property.name}'.`);
|
|
34
|
-
properties.add(property.name);
|
|
35
|
-
}
|
|
36
|
-
if (!commandProductions.has(event.line))
|
|
37
|
-
report(event.line, diagnosticCodes.inlineEventOutsideCommand, 'Inline events can only be declared inside commands.');
|
|
38
|
-
if (event.generation !== undefined)
|
|
39
|
-
report(event.line, diagnosticCodes.inlineEventGeneration, 'Inline events are generation 1; extract the event before declaring generations.');
|
|
40
|
-
if ((eventCounts.get(event.name) ?? 0) > 1 || importedNames.has(event.name)) {
|
|
41
|
-
report(event.line, diagnosticCodes.inlineEventCollision, `Inline event '${event.name}' collides with another declaration or import.`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
let hasId = false;
|
|
45
|
-
let hasDocumentation = false;
|
|
46
|
-
for (const index of body) {
|
|
47
|
-
const text = lines[index].trim();
|
|
48
|
-
const keyword = text.split(/\s+/)[0];
|
|
49
|
-
if (event.inline && keyword === 'generation')
|
|
50
|
-
report(index, diagnosticCodes.inlineEventGeneration, 'Inline events are generation 1; extract the event before declaring generations.');
|
|
51
|
-
if (event.inline && keyword === 'origin')
|
|
52
|
-
report(index, diagnosticCodes.reservedProductionMetadata, 'An inline event is local to its command and cannot declare origin.');
|
|
53
|
-
// Property-shaped metadata names stay properties, whether standalone or typed mappings.
|
|
54
|
-
if (/^(?:id|description|documentation)\s+[\w.]+(?:\[\])?\??(?:\s*=.*)?$/.test(text))
|
|
55
|
-
continue;
|
|
56
|
-
if (keyword === 'id') {
|
|
57
|
-
const match = text.match(quotedId);
|
|
58
|
-
if (hasId || match === null || match[1].trim().length === 0)
|
|
59
|
-
report(index, diagnosticCodes.invalidEventId, 'Expected one nonempty id "<old-name>".');
|
|
60
|
-
else if (match[1] === event.name)
|
|
61
|
-
report(index, diagnosticCodes.redundantEventId, 'This id repeats the event name; remove it.', 'information');
|
|
62
|
-
hasId = true;
|
|
63
|
-
}
|
|
64
|
-
if (keyword === 'documentation') {
|
|
65
|
-
let next = index + 1;
|
|
66
|
-
while (next < lines.length && lines[next].trim().length === 0)
|
|
67
|
-
next++;
|
|
68
|
-
if (hasDocumentation || text !== 'documentation' || lines[next]?.trim() !== '```markdown' || indentOf(lines[next]) <= indentOf(lines[index]) ||
|
|
69
|
-
!documentationBlocks.has(next)) {
|
|
70
|
-
report(index, diagnosticCodes.invalidEventDocumentation, 'Expected one nonempty fenced markdown documentation block.');
|
|
71
|
-
}
|
|
72
|
-
hasDocumentation = true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Also cover reaction productions without a backward ancestry walk per metadata line.
|
|
77
|
-
const productionIndents = [];
|
|
78
|
-
for (let index = 0; index < lines.length; index++) {
|
|
79
|
-
if (fences[index] || lines[index].trim().length === 0)
|
|
80
|
-
continue;
|
|
81
|
-
const indent = indentOf(lines[index]);
|
|
82
|
-
while (productionIndents.length > 0 && productionIndents[productionIndents.length - 1] >= indent)
|
|
83
|
-
productionIndents.pop();
|
|
84
|
-
const keyword = lines[index].trim().split(/\s+/)[0];
|
|
85
|
-
if (reserved.has(keyword) && productionIndents.length > 0) {
|
|
86
|
-
report(index, diagnosticCodes.reservedProductionMetadata, `'${keyword}' is system-assigned production metadata.`);
|
|
87
|
-
}
|
|
88
|
-
if (keyword === 'produces')
|
|
89
|
-
productionIndents.push(indent);
|
|
90
|
-
}
|
|
91
|
-
for (const command of symbols.commands) {
|
|
92
|
-
const { identifier, mixed } = productionDestinations(command);
|
|
93
|
-
for (const production of command.produces ?? []) {
|
|
94
|
-
if (mixed && production.target === undefined)
|
|
95
|
-
report(production.line, diagnosticCodes.explicitProducesTargetsRequired, `Production '${production.name}' must state for explicitly when destinations differ.`);
|
|
96
|
-
const destination = production.target ?? (production.inline ? identifier : undefined);
|
|
97
|
-
if (identifier === undefined || destination !== identifier)
|
|
98
|
-
continue;
|
|
99
|
-
for (const mapping of production.mappings.filter(mapping => mapping.source === identifier)) {
|
|
100
|
-
report(mapping.line, diagnosticCodes.eventSourceIdInPayload, `The payload copies '${identifier}', which already identifies the event source.`, production.inline ? 'warning' : 'information');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return issues;
|
|
105
|
-
}
|
|
106
|
-
// Record complete, nonempty Markdown fences once. Validation must not scan a suffix
|
|
107
|
-
// for every documentation directive, especially while its opener is still being typed.
|
|
108
|
-
function nonemptyMarkdownBlocks(lines, fences) {
|
|
109
|
-
const blocks = new Set();
|
|
110
|
-
let opening;
|
|
111
|
-
let content = false;
|
|
112
|
-
for (let index = 0; index < lines.length; index++) {
|
|
113
|
-
if (!fences[index])
|
|
114
|
-
continue;
|
|
115
|
-
const text = lines[index].trim();
|
|
116
|
-
if (opening === undefined) {
|
|
117
|
-
opening = index;
|
|
118
|
-
content = false;
|
|
119
|
-
}
|
|
120
|
-
else if (text === '```') {
|
|
121
|
-
if (content && lines[opening].trim() === '```markdown')
|
|
122
|
-
blocks.add(opening);
|
|
123
|
-
opening = undefined;
|
|
124
|
-
}
|
|
125
|
-
else if (text.length > 0) {
|
|
126
|
-
content = true;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return blocks;
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=inline-event-validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-event-validation.js","sourceRoot":"","sources":["../inline-event-validation.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAkB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AAGxD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,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C,CAAC;YAClM,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,oFAAoF;AACpF,uFAAuF;AACvF,SAAS,sBAAsB,CAAC,KAAe,EAAE,MAAiB;IAC9D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,IAAI,OAA2B,CAAC;IAChC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,SAAS;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,GAAG,KAAK,CAAC;YAChB,OAAO,GAAG,KAAK,CAAC;QACpB,CAAC;aAAM,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACxB,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,aAAa;gBAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC5E,OAAO,GAAG,SAAS,CAAC;QACxB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/keyword-docs.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
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
|
-
import { eventContextPaths } from './event-context';
|
|
4
|
-
export const keywordDocs = {
|
|
5
|
-
domain: 'The domain the file belongs to — optional, at most one per file, before everything else.',
|
|
6
|
-
import: 'Imports a type from another module by its qualified name — `import Module.Type` — making it available by its short name; or, quoted, other `.play` files by path or glob — `import "Orders/**/*.play"`, relative to this file\'s folder. Written inside a module or feature, a file import places the imported files there: their top level is that module\'s or feature\'s body.',
|
|
7
|
-
concept: 'A formalized value type wrapping a primitive. Attributes such as `@pii` travel with every usage, optionally with a `<attribute> reason "..."` line saying why.',
|
|
8
|
-
type: 'A composite value type — a named shape built from several properties, referenced by events, commands and other types the same way a concept is.',
|
|
9
|
-
reason: 'Records why a concept attribute applies — the purpose, the lawful basis, whose subject the value lives under. Written as `pii reason "..."` in the concept body.',
|
|
10
|
-
identifier: 'Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.',
|
|
11
|
-
policy: 'A named authorization rule referenced by commands and queries. Multiple policies AND together.',
|
|
12
|
-
persona: 'A named role interacting with the application, with an optional description and its associated policies.',
|
|
13
|
-
authentication: 'Declares the identity providers of the application — at most one block per file.',
|
|
14
|
-
provider: 'A named identity provider within `authentication`, with free-form `name value` settings.',
|
|
15
|
-
description: 'A human-readable description of a module, feature, slice, persona, or command — the first body line, as a quoted single line or a fenced ```text block for multiple lines.',
|
|
16
|
-
module: 'The top-level namespace — maps to a bounded context.',
|
|
17
|
-
layout: 'A reusable screen template with named slots.',
|
|
18
|
-
template: 'Declares the named slots of a layout.',
|
|
19
|
-
feature: 'A vertical slice grouping. Features nest arbitrarily deep.',
|
|
20
|
-
slice: 'The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.',
|
|
21
|
-
event: 'An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.',
|
|
22
|
-
documentation: 'Authoring-only event documentation in a fenced ```markdown block. It does not change executable model bytes.',
|
|
23
|
-
id: 'Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.',
|
|
24
|
-
command: 'An imperative intent. Declares authorization, validation, and what events it produces — declaratively, or via a full handler.',
|
|
25
|
-
query: 'A read-side entry point mapping to a return type, with an optional description, parameters and performer.',
|
|
26
|
-
observable: 'Qualifies a query return type as a live read — `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.',
|
|
27
|
-
performer: 'The code that performs a query — a `file <Path>` reference or an inline `csharp`/`sql` block. The query\'s counterpart to a command handler.',
|
|
28
|
-
from: 'Fills a query parameter from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.',
|
|
29
|
-
projection: 'Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).',
|
|
30
|
-
capture: 'Converts external data into events, using the embedded Change Data Capture Language (CDL).',
|
|
31
|
-
reaction: 'Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own — `file`/code is optional realization metadata.',
|
|
32
|
-
trigger: 'Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.',
|
|
33
|
-
where: 'Narrows which occurrences actually run the reaction.',
|
|
34
|
-
contains: 'Text comparison — true when the left string holds the right one anywhere.',
|
|
35
|
-
every: 'Runs a reaction on an interval — `every 15 minutes`, `every 1 day`.',
|
|
36
|
-
invokes: 'A command a reaction hands on. A command is asked for, not produced — it may still be rejected.',
|
|
37
|
-
screen: 'A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.',
|
|
38
|
-
constraint: 'A server-side rule enforced in the Chronicle kernel before events are committed.',
|
|
39
|
-
authorize: 'References the policies that must all pass for the construct to execute.',
|
|
40
|
-
validate: 'Declarative validation rules, or `validate` followed by ```csharp for imperative rules — on commands and concepts.',
|
|
41
|
-
produces: 'References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.',
|
|
42
|
-
reads: 'Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. Repeated views require unique aliases. Runtime binding is not yet supported for command or reaction reads.',
|
|
43
|
-
as: 'Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.',
|
|
44
|
-
handler: 'A fully imperative command implementation — a `file <Path>` reference or an inline `csharp` block, instead of `produces`.',
|
|
45
|
-
when: 'Guards a produced event or a capture append with a condition.',
|
|
46
|
-
rule: 'Names a predicate. Bare, it states that a constraint exists without expressing what it computes — nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.',
|
|
47
|
-
require: 'A policy condition: `authenticated`, `role "..."`, or `claim "..." matches ...`.',
|
|
48
|
-
authenticated: 'Requires an authenticated caller.',
|
|
49
|
-
role: 'Requires the caller to have the given role.',
|
|
50
|
-
claim: 'Requires a claim on the caller to match a subject or value.',
|
|
51
|
-
subject: 'The subject (identity) of the caller.',
|
|
52
|
-
data: 'Binds a read model to a screen through a query.',
|
|
53
|
-
action: 'Makes a command available as an action on a screen.',
|
|
54
|
-
navigate: 'Navigates to a screen, optionally passing a parameter with `by`.',
|
|
55
|
-
section: 'A named structural section of a screen.',
|
|
56
|
-
table: 'A table widget over a read model or child collection.',
|
|
57
|
-
summary: 'A summary widget showing labeled fields.',
|
|
58
|
-
column: 'A table column bound to a property.',
|
|
59
|
-
field: 'A summary field bound to a property.',
|
|
60
|
-
title: 'The display title of a screen or section.',
|
|
61
|
-
label: 'The display label of an action, column, or field.',
|
|
62
|
-
unique: 'A uniqueness constraint — `unique <property> on <EventType>` or `unique event <EventType>`.',
|
|
63
|
-
concurrency: 'The concurrency scope enforced when the command appends events — dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.',
|
|
64
|
-
eventSource: 'Concurrency dimension — scope the check to the event source id of the command.',
|
|
65
|
-
sourceType: 'Concurrency dimension — scope the check to an event source type.',
|
|
66
|
-
streamType: 'Concurrency dimension — scope the check to an event stream type.',
|
|
67
|
-
streamId: 'Concurrency dimension — scope the check to an event stream id.',
|
|
68
|
-
tag: 'Attaches a tag to appended events — a static identifier or string, or a `$context.` expression resolved at append time.',
|
|
69
|
-
seed: 'Declares events to seed into the event store per event source id — multiple blocks accumulate.',
|
|
70
|
-
for: 'Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.',
|
|
71
|
-
readmodel: 'Read model state in a specification — `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.',
|
|
72
|
-
no: 'A keyed absence assertion: `then no readmodel <View> for <key>`.',
|
|
73
|
-
arguments: 'The values supplied to a query asserted by `then query`.',
|
|
74
|
-
result: 'One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.',
|
|
75
|
-
clock: 'The instant a specification happens at - `given clock "2026-10-05T08:00:00Z"` fixes when everything occurs; `when clock "<instant>"` is the clock reaching it, as the action.',
|
|
76
|
-
exactly: 'Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.',
|
|
77
|
-
file: 'Delegates the implementation to an external file; the Screenplay contract stays visible.',
|
|
78
|
-
by: 'Introduces the identifying parameter.',
|
|
79
|
-
via: 'Connects screen data to the query that supplies it.',
|
|
80
|
-
filter: 'An optional query filter parameter.',
|
|
81
|
-
on: 'The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.',
|
|
82
|
-
message: 'The validation message reported when the rule fails.',
|
|
83
|
-
matches: 'Matches a value against a regular expression or a named pattern such as `email`.',
|
|
84
|
-
all: 'Applies a comparison to every element of a collection.',
|
|
85
|
-
max: 'Maximum length or value.',
|
|
86
|
-
min: 'Minimum length or value.',
|
|
87
|
-
length: 'Constrains the exact length of a value.',
|
|
88
|
-
today: 'The current date.',
|
|
89
|
-
empty: 'Used with `not empty` — the value must be present.',
|
|
90
|
-
not: 'Negates a validation condition, as in `not empty`.',
|
|
91
|
-
and: 'Both conditions must hold.',
|
|
92
|
-
or: 'Either condition may hold.',
|
|
93
|
-
csharp: 'An inline C# block whose opening fence is ```csharp.',
|
|
94
|
-
sql: 'An inline SQL block between triple backticks — a query performer written against a relational store.',
|
|
95
|
-
typescript: 'An inline TypeScript block between triple backticks.',
|
|
96
|
-
react: 'An inline React/TSX block; receives the surrounding data contract as `Props`.',
|
|
97
|
-
html: 'An inline static HTML block.',
|
|
98
|
-
StateChange: 'Slice type — a command → events flow; something that changes the system.',
|
|
99
|
-
StateView: 'Slice type — a query + projection + screen; something that reads the system.',
|
|
100
|
-
Automation: 'Slice type — a reaction or reducer; something that runs when something happens.',
|
|
101
|
-
Translate: 'Slice type — a capture; converts external data into events.',
|
|
102
|
-
Uuid: 'Primitive type — a universally unique identifier.',
|
|
103
|
-
String: 'Primitive type — a string of characters.',
|
|
104
|
-
Int: 'Primitive type — an integer number.',
|
|
105
|
-
Decimal: 'Primitive type — a decimal number.',
|
|
106
|
-
Bool: 'Primitive type — true or false.',
|
|
107
|
-
Date: 'Primitive type — a date without time.',
|
|
108
|
-
DateTime: 'Primitive type — a date and time.',
|
|
109
|
-
Enum: 'An enumeration concept with a fixed set of values.',
|
|
110
|
-
};
|
|
111
|
-
// What the words of a specification's steps mean there - where 'trigger', 'capture' and 'query' name what the
|
|
112
|
-
// scenario exercises rather than declare one.
|
|
113
|
-
export const specificationKeywordDocs = {
|
|
114
|
-
clock: keywordDocs.clock,
|
|
115
|
-
trigger: '`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.',
|
|
116
|
-
capture: '`given capture <Capture>` - a record the capture\'s source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.',
|
|
117
|
-
query: '`when query <Query>` - the query is performed, as the action, with its arguments on the lines beneath; assert what it returns with `then result` or `then no result`. `then query` instead asserts a query after another action.',
|
|
118
|
-
result: '`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing.',
|
|
119
|
-
};
|
|
120
|
-
export const attributeDocs = {
|
|
121
|
-
pii: '`@pii` — the value is personally identifiable information; Chronicle manages and erases it automatically wherever the concept is used. Add `pii reason "..."` in the concept body to record why.',
|
|
122
|
-
sensitive: '`@sensitive` — the value is sensitive; Chronicle applies its sensitivity rules automatically wherever the concept is used. Add `sensitive reason "..."` in the concept body to record why.',
|
|
123
|
-
};
|
|
124
|
-
export const contextVariableDocs = {
|
|
125
|
-
'$context.occurred': 'When the command or query was received.',
|
|
126
|
-
'$context.tenant': 'The tenant the command or query is executing for.',
|
|
127
|
-
'$context.command': 'The command being handled, shaped by its `command` declaration.',
|
|
128
|
-
'$context.arguments': 'The arguments of the query being performed.',
|
|
129
|
-
'$context.causedBy': 'The identity that caused the command or query — `subject`, `name`, `userName`.',
|
|
130
|
-
'$context.causedBy.subject': 'The subject of the identity that caused the command or query.',
|
|
131
|
-
'$context.causedBy.name': 'The display name of the identity that caused the command or query.',
|
|
132
|
-
'$context.causedBy.userName': 'The user name of the identity that caused the command or query.',
|
|
133
|
-
'$context.causation': 'What caused the command or query — `type`, `occurred`, `properties`.',
|
|
134
|
-
'$context.causation.type': 'What caused the command or query — a command, a reactor, a schedule.',
|
|
135
|
-
'$context.identity': 'The caller a decision is made about — `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.',
|
|
136
|
-
'$context.identity.id': 'The identifier of the caller from the auth token.',
|
|
137
|
-
'$context.identity.name': 'The display name of the caller.',
|
|
138
|
-
'$context.identity.userName': 'The user name of the caller.',
|
|
139
|
-
'$context.identity.isAuthenticated': 'Whether the caller is authenticated.',
|
|
140
|
-
'$context.identity.roles': 'The roles the caller holds.',
|
|
141
|
-
'$context.identity.claims': 'The claims the caller carries — `$context.identity.claims.<name>` reads one.',
|
|
142
|
-
'$env': 'An environment variable, e.g. `$env.SERVICE_NAME`.',
|
|
143
|
-
'$secrets': 'An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` — stays symbolic in the compiled tree.',
|
|
144
|
-
'$strings': 'A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.',
|
|
145
|
-
// Every $eventContext path the event-context catalog lists, for projections.
|
|
146
|
-
...Object.fromEntries(eventContextPaths.map((path) => [`$eventContext.${path.path}`, path.description])),
|
|
147
|
-
};
|
|
148
|
-
//# sourceMappingURL=keyword-docs.js.map
|
package/dist/keyword-docs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyword-docs.js","sourceRoot":"","sources":["../keyword-docs.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAA2B;IAC/C,MAAM,EAAE,0FAA0F;IAClG,MAAM,EAAE,mXAAmX;IAC3X,OAAO,EAAE,gKAAgK;IACzK,IAAI,EAAE,iJAAiJ;IACvJ,MAAM,EAAE,kKAAkK;IAC1K,UAAU,EAAE,sIAAsI;IAClJ,MAAM,EAAE,gGAAgG;IACxG,OAAO,EAAE,0GAA0G;IACnH,cAAc,EAAE,kFAAkF;IAClG,QAAQ,EAAE,0FAA0F;IACpG,WAAW,EAAE,4KAA4K;IACzL,MAAM,EAAE,sDAAsD;IAC9D,MAAM,EAAE,8CAA8C;IACtD,QAAQ,EAAE,uCAAuC;IACjD,OAAO,EAAE,4DAA4D;IACrE,KAAK,EAAE,kFAAkF;IACzF,KAAK,EAAE,uLAAuL;IAC9L,aAAa,EAAE,8GAA8G;IAC7H,EAAE,EAAE,kIAAkI;IACtI,OAAO,EAAE,+HAA+H;IACxI,KAAK,EAAE,2GAA2G;IAClH,UAAU,EAAE,6JAA6J;IACzK,SAAS,EAAE,8IAA8I;IACzJ,IAAI,EAAE,8HAA8H;IACpI,UAAU,EAAE,0GAA0G;IACtH,OAAO,EAAE,4FAA4F;IACrG,QAAQ,EAAE,4KAA4K;IACtL,OAAO,EAAE,4KAA4K;IACrL,KAAK,EAAE,sDAAsD;IAC7D,QAAQ,EAAE,2EAA2E;IACrF,KAAK,EAAE,qEAAqE;IAC5E,OAAO,EAAE,iGAAiG;IAC1G,MAAM,EAAE,sGAAsG;IAC9G,UAAU,EAAE,kFAAkF;IAC9F,SAAS,EAAE,0EAA0E;IACrF,QAA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