@dryvcode/author 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +341 -0
- package/dist/behavior/duration.d.ts +7 -0
- package/dist/behavior/duration.d.ts.map +1 -0
- package/dist/behavior/duration.js +20 -0
- package/dist/behavior/duration.js.map +1 -0
- package/dist/behavior/event.d.ts +23 -0
- package/dist/behavior/event.d.ts.map +1 -0
- package/dist/behavior/event.js +57 -0
- package/dist/behavior/event.js.map +1 -0
- package/dist/behavior/failure.d.ts +19 -0
- package/dist/behavior/failure.d.ts.map +1 -0
- package/dist/behavior/failure.js +48 -0
- package/dist/behavior/failure.js.map +1 -0
- package/dist/behavior/index.d.ts +6 -0
- package/dist/behavior/index.d.ts.map +1 -0
- package/dist/behavior/index.js +6 -0
- package/dist/behavior/index.js.map +1 -0
- package/dist/behavior/operation.d.ts +72 -0
- package/dist/behavior/operation.d.ts.map +1 -0
- package/dist/behavior/operation.js +193 -0
- package/dist/behavior/operation.js.map +1 -0
- package/dist/behavior/policy.d.ts +29 -0
- package/dist/behavior/policy.d.ts.map +1 -0
- package/dist/behavior/policy.js +80 -0
- package/dist/behavior/policy.js.map +1 -0
- package/dist/composition/application.d.ts +28 -0
- package/dist/composition/application.d.ts.map +1 -0
- package/dist/composition/application.js +64 -0
- package/dist/composition/application.js.map +1 -0
- package/dist/composition/feature.d.ts +37 -0
- package/dist/composition/feature.d.ts.map +1 -0
- package/dist/composition/feature.js +82 -0
- package/dist/composition/feature.js.map +1 -0
- package/dist/composition/index.d.ts +3 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/index.js +3 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/contracts/behavior.d.ts +106 -0
- package/dist/contracts/behavior.d.ts.map +1 -0
- package/dist/contracts/behavior.js +2 -0
- package/dist/contracts/behavior.js.map +1 -0
- package/dist/contracts/composition.d.ts +20 -0
- package/dist/contracts/composition.d.ts.map +1 -0
- package/dist/contracts/composition.js +2 -0
- package/dist/contracts/composition.js.map +1 -0
- package/dist/contracts/definitions.d.ts +286 -0
- package/dist/contracts/definitions.d.ts.map +1 -0
- package/dist/contracts/definitions.js +35 -0
- package/dist/contracts/definitions.js.map +1 -0
- package/dist/contracts/expressions.d.ts +44 -0
- package/dist/contracts/expressions.d.ts.map +1 -0
- package/dist/contracts/expressions.js +2 -0
- package/dist/contracts/expressions.js.map +1 -0
- package/dist/contracts/foundation.d.ts +141 -0
- package/dist/contracts/foundation.d.ts.map +1 -0
- package/dist/contracts/foundation.js +2 -0
- package/dist/contracts/foundation.js.map +1 -0
- package/dist/contracts/index.d.ts +10 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +10 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/interaction.d.ts +52 -0
- package/dist/contracts/interaction.d.ts.map +1 -0
- package/dist/contracts/interaction.js +2 -0
- package/dist/contracts/interaction.js.map +1 -0
- package/dist/contracts/interfaces.d.ts +73 -0
- package/dist/contracts/interfaces.d.ts.map +1 -0
- package/dist/contracts/interfaces.js +2 -0
- package/dist/contracts/interfaces.js.map +1 -0
- package/dist/contracts/orchestration.d.ts +56 -0
- package/dist/contracts/orchestration.d.ts.map +1 -0
- package/dist/contracts/orchestration.js +2 -0
- package/dist/contracts/orchestration.js.map +1 -0
- package/dist/contracts/project.d.ts +70 -0
- package/dist/contracts/project.d.ts.map +1 -0
- package/dist/contracts/project.js +2 -0
- package/dist/contracts/project.js.map +1 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/storage.d.ts +23 -0
- package/dist/data/storage.d.ts.map +1 -0
- package/dist/data/storage.js +93 -0
- package/dist/data/storage.js.map +1 -0
- package/dist/definitions/expressions/expression.d.ts +49 -0
- package/dist/definitions/expressions/expression.d.ts.map +1 -0
- package/dist/definitions/expressions/expression.js +181 -0
- package/dist/definitions/expressions/expression.js.map +1 -0
- package/dist/definitions/expressions/index.d.ts +2 -0
- package/dist/definitions/expressions/index.d.ts.map +1 -0
- package/dist/definitions/expressions/index.js +2 -0
- package/dist/definitions/expressions/index.js.map +1 -0
- package/dist/definitions/index.d.ts +7 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/index.js +7 -0
- package/dist/definitions/index.js.map +1 -0
- package/dist/definitions/properties/advanced.d.ts +27 -0
- package/dist/definitions/properties/advanced.d.ts.map +1 -0
- package/dist/definitions/properties/advanced.js +95 -0
- package/dist/definitions/properties/advanced.js.map +1 -0
- package/dist/definitions/properties/base.d.ts +29 -0
- package/dist/definitions/properties/base.d.ts.map +1 -0
- package/dist/definitions/properties/base.js +60 -0
- package/dist/definitions/properties/base.js.map +1 -0
- package/dist/definitions/properties/composite.d.ts +14 -0
- package/dist/definitions/properties/composite.d.ts.map +1 -0
- package/dist/definitions/properties/composite.js +41 -0
- package/dist/definitions/properties/composite.js.map +1 -0
- package/dist/definitions/properties/enumeration.d.ts +17 -0
- package/dist/definitions/properties/enumeration.d.ts.map +1 -0
- package/dist/definitions/properties/enumeration.js +48 -0
- package/dist/definitions/properties/enumeration.js.map +1 -0
- package/dist/definitions/properties/generic.d.ts +22 -0
- package/dist/definitions/properties/generic.d.ts.map +1 -0
- package/dist/definitions/properties/generic.js +61 -0
- package/dist/definitions/properties/generic.js.map +1 -0
- package/dist/definitions/properties/index.d.ts +12 -0
- package/dist/definitions/properties/index.d.ts.map +1 -0
- package/dist/definitions/properties/index.js +3 -0
- package/dist/definitions/properties/index.js.map +1 -0
- package/dist/definitions/properties/metadata.d.ts +6 -0
- package/dist/definitions/properties/metadata.d.ts.map +1 -0
- package/dist/definitions/properties/metadata.js +4 -0
- package/dist/definitions/properties/metadata.js.map +1 -0
- package/dist/definitions/properties/primitive.d.ts +66 -0
- package/dist/definitions/properties/primitive.d.ts.map +1 -0
- package/dist/definitions/properties/primitive.js +266 -0
- package/dist/definitions/properties/primitive.js.map +1 -0
- package/dist/definitions/properties/property.d.ts +171 -0
- package/dist/definitions/properties/property.d.ts.map +1 -0
- package/dist/definitions/properties/property.js +211 -0
- package/dist/definitions/properties/property.js.map +1 -0
- package/dist/definitions/properties/temporal.d.ts +37 -0
- package/dist/definitions/properties/temporal.d.ts.map +1 -0
- package/dist/definitions/properties/temporal.js +115 -0
- package/dist/definitions/properties/temporal.js.map +1 -0
- package/dist/definitions/schemas/field.d.ts +123 -0
- package/dist/definitions/schemas/field.d.ts.map +1 -0
- package/dist/definitions/schemas/field.js +329 -0
- package/dist/definitions/schemas/field.js.map +1 -0
- package/dist/definitions/schemas/index.d.ts +6 -0
- package/dist/definitions/schemas/index.d.ts.map +1 -0
- package/dist/definitions/schemas/index.js +6 -0
- package/dist/definitions/schemas/index.js.map +1 -0
- package/dist/definitions/schemas/projection.d.ts +90 -0
- package/dist/definitions/schemas/projection.d.ts.map +1 -0
- package/dist/definitions/schemas/projection.js +146 -0
- package/dist/definitions/schemas/projection.js.map +1 -0
- package/dist/definitions/schemas/relation.d.ts +12 -0
- package/dist/definitions/schemas/relation.d.ts.map +1 -0
- package/dist/definitions/schemas/relation.js +27 -0
- package/dist/definitions/schemas/relation.js.map +1 -0
- package/dist/definitions/schemas/schema.d.ts +46 -0
- package/dist/definitions/schemas/schema.d.ts.map +1 -0
- package/dist/definitions/schemas/schema.js +134 -0
- package/dist/definitions/schemas/schema.js.map +1 -0
- package/dist/definitions/schemas/source.d.ts +30 -0
- package/dist/definitions/schemas/source.d.ts.map +1 -0
- package/dist/definitions/schemas/source.js +73 -0
- package/dist/definitions/schemas/source.js.map +1 -0
- package/dist/definitions/types/expressions.d.ts +28 -0
- package/dist/definitions/types/expressions.d.ts.map +1 -0
- package/dist/definitions/types/expressions.js +81 -0
- package/dist/definitions/types/expressions.js.map +1 -0
- package/dist/definitions/types/index.d.ts +4 -0
- package/dist/definitions/types/index.d.ts.map +1 -0
- package/dist/definitions/types/index.js +4 -0
- package/dist/definitions/types/index.js.map +1 -0
- package/dist/definitions/types/parameter.d.ts +9 -0
- package/dist/definitions/types/parameter.d.ts.map +1 -0
- package/dist/definitions/types/parameter.js +24 -0
- package/dist/definitions/types/parameter.js.map +1 -0
- package/dist/definitions/types/spec.d.ts +26 -0
- package/dist/definitions/types/spec.d.ts.map +1 -0
- package/dist/definitions/types/spec.js +74 -0
- package/dist/definitions/types/spec.js.map +1 -0
- package/dist/foundation/declaration.d.ts +24 -0
- package/dist/foundation/declaration.d.ts.map +1 -0
- package/dist/foundation/declaration.js +43 -0
- package/dist/foundation/declaration.js.map +1 -0
- package/dist/foundation/group.d.ts +55 -0
- package/dist/foundation/group.d.ts.map +1 -0
- package/dist/foundation/group.js +199 -0
- package/dist/foundation/group.js.map +1 -0
- package/dist/foundation/index.d.ts +7 -0
- package/dist/foundation/index.d.ts.map +1 -0
- package/dist/foundation/index.js +7 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/foundation/metadata.d.ts +22 -0
- package/dist/foundation/metadata.d.ts.map +1 -0
- package/dist/foundation/metadata.js +43 -0
- package/dist/foundation/metadata.js.map +1 -0
- package/dist/foundation/ref.d.ts +200 -0
- package/dist/foundation/ref.d.ts.map +1 -0
- package/dist/foundation/ref.js +230 -0
- package/dist/foundation/ref.js.map +1 -0
- package/dist/foundation/scope.d.ts +13 -0
- package/dist/foundation/scope.d.ts.map +1 -0
- package/dist/foundation/scope.js +63 -0
- package/dist/foundation/scope.js.map +1 -0
- package/dist/foundation/value-declaration.d.ts +9 -0
- package/dist/foundation/value-declaration.d.ts.map +1 -0
- package/dist/foundation/value-declaration.js +2 -0
- package/dist/foundation/value-declaration.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/index.d.ts +3 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +3 -0
- package/dist/interaction/index.js.map +1 -0
- package/dist/interaction/part.d.ts +58 -0
- package/dist/interaction/part.d.ts.map +1 -0
- package/dist/interaction/part.js +178 -0
- package/dist/interaction/part.js.map +1 -0
- package/dist/interaction/view.d.ts +34 -0
- package/dist/interaction/view.d.ts.map +1 -0
- package/dist/interaction/view.js +109 -0
- package/dist/interaction/view.js.map +1 -0
- package/dist/interfaces/facet.d.ts +6 -0
- package/dist/interfaces/facet.d.ts.map +1 -0
- package/dist/interfaces/facet.js +2 -0
- package/dist/interfaces/facet.js.map +1 -0
- package/dist/interfaces/http.d.ts +39 -0
- package/dist/interfaces/http.d.ts.map +1 -0
- package/dist/interfaces/http.js +109 -0
- package/dist/interfaces/http.js.map +1 -0
- package/dist/interfaces/index.d.ts +7 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +7 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/representation.d.ts +14 -0
- package/dist/interfaces/representation.d.ts.map +1 -0
- package/dist/interfaces/representation.js +25 -0
- package/dist/interfaces/representation.js.map +1 -0
- package/dist/interfaces/schedule.d.ts +14 -0
- package/dist/interfaces/schedule.d.ts.map +1 -0
- package/dist/interfaces/schedule.js +46 -0
- package/dist/interfaces/schedule.js.map +1 -0
- package/dist/interfaces/surface.d.ts +22 -0
- package/dist/interfaces/surface.d.ts.map +1 -0
- package/dist/interfaces/surface.js +44 -0
- package/dist/interfaces/surface.js.map +1 -0
- package/dist/interfaces/websocket.d.ts +11 -0
- package/dist/interfaces/websocket.d.ts.map +1 -0
- package/dist/interfaces/websocket.js +25 -0
- package/dist/interfaces/websocket.js.map +1 -0
- package/dist/orchestration/index.d.ts +4 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +4 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/steps.d.ts +41 -0
- package/dist/orchestration/steps.d.ts.map +1 -0
- package/dist/orchestration/steps.js +105 -0
- package/dist/orchestration/steps.js.map +1 -0
- package/dist/orchestration/value-source.d.ts +8 -0
- package/dist/orchestration/value-source.d.ts.map +1 -0
- package/dist/orchestration/value-source.js +10 -0
- package/dist/orchestration/value-source.js.map +1 -0
- package/dist/orchestration/workflow.d.ts +38 -0
- package/dist/orchestration/workflow.d.ts.map +1 -0
- package/dist/orchestration/workflow.js +116 -0
- package/dist/orchestration/workflow.js.map +1 -0
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +2 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/project.d.ts +27 -0
- package/dist/project/project.d.ts.map +1 -0
- package/dist/project/project.js +161 -0
- package/dist/project/project.js.map +1 -0
- package/dist/project/registry.d.ts +33 -0
- package/dist/project/registry.d.ts.map +1 -0
- package/dist/project/registry.js +58 -0
- package/dist/project/registry.js.map +1 -0
- package/dist/project/snapshot.d.ts +4 -0
- package/dist/project/snapshot.d.ts.map +1 -0
- package/dist/project/snapshot.js +15 -0
- package/dist/project/snapshot.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
2
|
+
import { OperationPortRef as OperationPort, valuePortState, } from "../foundation/ref.js";
|
|
3
|
+
import { explanation, normalizeTags, optionalDescription, optionalOwner, optionalOrigin, optionalSemanticMetadata, requireText, } from "../foundation/metadata.js";
|
|
4
|
+
import { resolveDuration } from "./duration.js";
|
|
5
|
+
export class OperationDeclaration extends Declaration {
|
|
6
|
+
_description;
|
|
7
|
+
_role;
|
|
8
|
+
_tags = [];
|
|
9
|
+
_explanations = [];
|
|
10
|
+
_inputs = [];
|
|
11
|
+
_outputs = [];
|
|
12
|
+
_failures = [];
|
|
13
|
+
_emits = [];
|
|
14
|
+
_authenticated = false;
|
|
15
|
+
_policies = [];
|
|
16
|
+
_mode = "sync";
|
|
17
|
+
_timeout;
|
|
18
|
+
_rateLimit;
|
|
19
|
+
_cache;
|
|
20
|
+
_transaction;
|
|
21
|
+
_retry;
|
|
22
|
+
_idempotency;
|
|
23
|
+
_audit;
|
|
24
|
+
_invalidates = [];
|
|
25
|
+
_facets = {};
|
|
26
|
+
constructor() {
|
|
27
|
+
super("operation");
|
|
28
|
+
}
|
|
29
|
+
description(value) {
|
|
30
|
+
this._description = requireText(value, "operation description");
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
role(value) {
|
|
34
|
+
this._role = value;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
tags(...values) {
|
|
38
|
+
this._tags = [...normalizeTags(values, "operation tags")];
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
explain(kind, text) {
|
|
42
|
+
this._explanations.push(explanation(kind, text, "operation explanation"));
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
inputs(...values) {
|
|
46
|
+
this._inputs = [...values];
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
outputs(...values) {
|
|
50
|
+
this._outputs = [...values];
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
input(index) {
|
|
54
|
+
return new OperationPort(this.ref(), "input", index);
|
|
55
|
+
}
|
|
56
|
+
output(index) {
|
|
57
|
+
return new OperationPort(this.ref(), "output", index);
|
|
58
|
+
}
|
|
59
|
+
failures(...values) {
|
|
60
|
+
this._failures = [...values];
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
emits(...values) {
|
|
64
|
+
this._emits = [...values];
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
authenticated(value = true) {
|
|
68
|
+
this._authenticated = value;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
requires(...values) {
|
|
72
|
+
this._policies = [...values];
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
mode(value) {
|
|
76
|
+
this._mode = value;
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
async(value = true) {
|
|
80
|
+
this._mode = value ? "async" : "sync";
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
timeout(value) {
|
|
84
|
+
this._timeout = resolveDuration(value, "operation timeout");
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
rateLimit(options) {
|
|
88
|
+
if (!Number.isInteger(options.limit) || options.limit <= 0) {
|
|
89
|
+
throw new TypeError("rate limit must be a positive integer");
|
|
90
|
+
}
|
|
91
|
+
this._rateLimit = {
|
|
92
|
+
limit: options.limit,
|
|
93
|
+
window: resolveDuration(options.window, "rate limit window"),
|
|
94
|
+
};
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
cache(options) {
|
|
98
|
+
this._cache = { ttl: resolveDuration(options.ttl, "cache ttl") };
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
transactional(required = true) {
|
|
102
|
+
this._transaction = { required };
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
retry(options) {
|
|
106
|
+
if (!Number.isInteger(options.maxAttempts) || options.maxAttempts < 1) {
|
|
107
|
+
throw new TypeError("retry maxAttempts must be >= 1");
|
|
108
|
+
}
|
|
109
|
+
this._retry = {
|
|
110
|
+
maxAttempts: options.maxAttempts,
|
|
111
|
+
...(options.backoff === undefined
|
|
112
|
+
? {}
|
|
113
|
+
: { backoff: resolveDuration(options.backoff, "retry backoff") }),
|
|
114
|
+
};
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
idempotentBy(input) {
|
|
118
|
+
this._idempotency = { key: this.input(input).toState() };
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
audit(required = true) {
|
|
122
|
+
this._audit = { required };
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
invalidates(...values) {
|
|
126
|
+
this._invalidates = [...values];
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
/** Operation reachability, at most one facet per kind (decision 0012). */
|
|
130
|
+
facets(values) {
|
|
131
|
+
for (const [kind, facet] of Object.entries(values)) {
|
|
132
|
+
if (facet !== undefined && facet.toState().kind !== kind) {
|
|
133
|
+
throw new TypeError(`facets.${kind} must be a ${kind} facet`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
this._facets = { ...values };
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
toState() {
|
|
140
|
+
const access = {
|
|
141
|
+
authenticated: this._authenticated,
|
|
142
|
+
policies: this._policies.map((value) => value.ref()),
|
|
143
|
+
};
|
|
144
|
+
const execution = {
|
|
145
|
+
mode: this._mode,
|
|
146
|
+
...(this._timeout === undefined ? {} : { timeout: this._timeout }),
|
|
147
|
+
...(this._rateLimit === undefined ? {} : { rateLimit: this._rateLimit }),
|
|
148
|
+
...(this._cache === undefined ? {} : { cache: this._cache }),
|
|
149
|
+
...(this._transaction === undefined
|
|
150
|
+
? {}
|
|
151
|
+
: { transaction: this._transaction }),
|
|
152
|
+
...(this._retry === undefined ? {} : { retry: this._retry }),
|
|
153
|
+
...(this._idempotency === undefined
|
|
154
|
+
? {}
|
|
155
|
+
: { idempotency: this._idempotency }),
|
|
156
|
+
...(this._audit === undefined ? {} : { audit: this._audit }),
|
|
157
|
+
invalidates: this._invalidates.map((value) => value.ref()),
|
|
158
|
+
};
|
|
159
|
+
const facets = {
|
|
160
|
+
...(this._facets.http === undefined
|
|
161
|
+
? {}
|
|
162
|
+
: { http: this._facets.http.toState() }),
|
|
163
|
+
...(this._facets.websocket === undefined
|
|
164
|
+
? {}
|
|
165
|
+
: {
|
|
166
|
+
websocket: this._facets.websocket.toState(),
|
|
167
|
+
}),
|
|
168
|
+
...(this._facets.schedule === undefined
|
|
169
|
+
? {}
|
|
170
|
+
: { schedule: this._facets.schedule.toState() }),
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
identity: this.identity,
|
|
174
|
+
kind: "operation",
|
|
175
|
+
...(this._role === undefined ? {} : { role: this._role }),
|
|
176
|
+
inputs: this._inputs.map(valuePortState),
|
|
177
|
+
outputs: this._outputs.map(valuePortState),
|
|
178
|
+
failures: this._failures.map((value) => value.ref()),
|
|
179
|
+
emits: this._emits.map((value) => value.ref()),
|
|
180
|
+
access,
|
|
181
|
+
execution,
|
|
182
|
+
facets,
|
|
183
|
+
...optionalDescription(this._description),
|
|
184
|
+
...optionalSemanticMetadata(this._tags, this._explanations),
|
|
185
|
+
...optionalOwner(this._group, this._feature),
|
|
186
|
+
...optionalOrigin(this._origin),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export function operation() {
|
|
191
|
+
return new OperationDeclaration();
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/behavior/operation.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAWvD,OAAO,EACL,gBAAgB,IAAI,aAAa,EACjC,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc1E,MAAM,OAAO,oBAGX,SAAQ,WAAwB;IAGxB,YAAY,CAAU;IACtB,KAAK,CAAsB;IAC3B,KAAK,GAAa,EAAE,CAAC;IACrB,aAAa,GAAuB,EAAE,CAAC;IACvC,OAAO,GAAkB,EAAE,CAAC;IAC5B,QAAQ,GAAkB,EAAE,CAAC;IAC7B,SAAS,GAAiB,EAAE,CAAC;IAC7B,MAAM,GAAe,EAAE,CAAC;IACxB,cAAc,GAAG,KAAK,CAAC;IACvB,SAAS,GAAgB,EAAE,CAAC;IAC5B,KAAK,GAAkB,MAAM,CAAC;IAC9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C,OAAO,EAAwB,EAAE,CAAC;SACzE,CAAC;QACF,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,WAAW;YACjB,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YACzD,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YACxC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC;YAC1C,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACpD,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YAC9C,MAAM;YACN,SAAS;YACT,MAAM;YACN,GAAG,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;YAC3D,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;YAC5C,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;SAChC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PolicyRoleState } from "../contracts/index.js";
|
|
2
|
+
import type { ExplanationKindState, PolicyState, PropertyDeclarationKind, QueryDomain } from "../contracts/index.js";
|
|
3
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
4
|
+
import type { ExpressionRef, PropertyRef, RefFieldMap, SchemaRef } from "../foundation/ref.js";
|
|
5
|
+
export interface PolicyOptions {
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
}
|
|
8
|
+
export type PolicyValueRef = PropertyRef<PropertyDeclarationKind, unknown, QueryDomain> | SchemaRef<RefFieldMap>;
|
|
9
|
+
export type PolicyContextInput = Readonly<Record<string, PolicyValueRef>>;
|
|
10
|
+
export declare class PolicyDeclaration extends Declaration<"policy"> {
|
|
11
|
+
private _description?;
|
|
12
|
+
private _role?;
|
|
13
|
+
private _requires?;
|
|
14
|
+
private _provides?;
|
|
15
|
+
private _rule?;
|
|
16
|
+
private _tags;
|
|
17
|
+
private _explanations;
|
|
18
|
+
constructor(options?: PolicyOptions);
|
|
19
|
+
description(value: string): this;
|
|
20
|
+
role(value: PolicyRoleState): this;
|
|
21
|
+
tags(...values: readonly string[]): this;
|
|
22
|
+
explain(kind: ExplanationKindState, text: string): this;
|
|
23
|
+
requires<const T extends PolicyContextInput>(value: T): this;
|
|
24
|
+
provides<const T extends PolicyContextInput>(value: T): this;
|
|
25
|
+
rule(value: ExpressionRef<boolean>): this;
|
|
26
|
+
toState(): PolicyState;
|
|
27
|
+
}
|
|
28
|
+
export declare function policy(options?: PolicyOptions): PolicyDeclaration;
|
|
29
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/behavior/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EACV,oBAAoB,EAGpB,WAAW,EACX,uBAAuB,EACvB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACV,MAAM,kBAAkB,CAAC;AAW1B,MAAM,WAAW,aAAa;IAC5B,QAAQ,C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|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
2
|
+
import { explanation, normalizeTags, optionalDescription, optionalOwner, optionalOrigin, optionalSemanticMetadata, requireText, } from "../foundation/metadata.js";
|
|
3
|
+
function contextState(value) {
|
|
4
|
+
const result = {};
|
|
5
|
+
for (const key of Object.keys(value).sort()) {
|
|
6
|
+
requireText(key, "policy context name");
|
|
7
|
+
result[key] = value[key].ref();
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
export class PolicyDeclaration extends Declaration {
|
|
12
|
+
_description;
|
|
13
|
+
_role;
|
|
14
|
+
_requires;
|
|
15
|
+
_provides;
|
|
16
|
+
_rule;
|
|
17
|
+
_tags = [];
|
|
18
|
+
_explanations = [];
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
super("policy");
|
|
21
|
+
if (options.description !== undefined) {
|
|
22
|
+
this.description(options.description);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
description(value) {
|
|
26
|
+
this._description = requireText(value, "policy description");
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
role(value) {
|
|
30
|
+
this._role = value;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
tags(...values) {
|
|
34
|
+
this._tags = [...normalizeTags(values, "policy tags")];
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
explain(kind, text) {
|
|
38
|
+
this._explanations.push(explanation(kind, text, "policy explanation"));
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
requires(value) {
|
|
42
|
+
this._requires = contextState(value);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
provides(value) {
|
|
46
|
+
this._provides = contextState(value);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
rule(value) {
|
|
50
|
+
this._rule = value;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
toState() {
|
|
54
|
+
const context = this._requires === undefined && this._provides === undefined
|
|
55
|
+
? undefined
|
|
56
|
+
: {
|
|
57
|
+
...(this._requires === undefined
|
|
58
|
+
? {}
|
|
59
|
+
: { requires: this._requires }),
|
|
60
|
+
...(this._provides === undefined
|
|
61
|
+
? {}
|
|
62
|
+
: { provides: this._provides }),
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
identity: this.identity,
|
|
66
|
+
kind: "policy",
|
|
67
|
+
...(this._role === undefined ? {} : { role: this._role }),
|
|
68
|
+
...(context === undefined ? {} : { context }),
|
|
69
|
+
...(this._rule === undefined ? {} : { rule: this._rule.ref() }),
|
|
70
|
+
...optionalDescription(this._description),
|
|
71
|
+
...optionalOwner(this._group, this._feature),
|
|
72
|
+
...optionalSemanticMetadata(this._tags, this._explanations),
|
|
73
|
+
...optionalOrigin(this._origin),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function policy(options = {}) {
|
|
78
|
+
return new PolicyDeclaration(options);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/behavior/policy.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOvD,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAY/B,SAAS,YAAY,CACnB,KAAyB;IAEzB,MAAM,MAAM,GAAmC,EAAE,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C,WAAW,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAE,CAAC,GAAG,E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IAAI,CAAC,aAAa,CAAC;YAC3D,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;SAChC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,MAAM,CAAC,OAAO,GAAkB,EAAE;IAChD,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ApplicationState, ExplanationKindState } from "../contracts/index.js";
|
|
2
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
3
|
+
import type { GroupDeclaration } from "../foundation/group.js";
|
|
4
|
+
import type { PolicyRef, SurfaceRef } from "../foundation/ref.js";
|
|
5
|
+
import { type ScopeFacetsInput } from "../foundation/scope.js";
|
|
6
|
+
export interface ApplicationOptions {
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ApplicationDeclaration extends Declaration<"application"> {
|
|
10
|
+
private _description?;
|
|
11
|
+
private _groups;
|
|
12
|
+
private _policies;
|
|
13
|
+
private _scopeFacets?;
|
|
14
|
+
private _surfaces;
|
|
15
|
+
private _tags;
|
|
16
|
+
private _explanations;
|
|
17
|
+
constructor(options?: ApplicationOptions);
|
|
18
|
+
description(value: string): this;
|
|
19
|
+
tags(...values: readonly string[]): this;
|
|
20
|
+
explain(kind: ExplanationKindState, text: string): this;
|
|
21
|
+
groups(...values: readonly GroupDeclaration[]): this;
|
|
22
|
+
policies(...values: readonly PolicyRef[]): this;
|
|
23
|
+
facets(value: ScopeFacetsInput): this;
|
|
24
|
+
surfaces(...values: readonly SurfaceRef[]): this;
|
|
25
|
+
toState(): ApplicationState;
|
|
26
|
+
}
|
|
27
|
+
export declare function application(options?: ApplicationOptions): ApplicationDeclaration;
|
|
28
|
+
//# sourceMappingURL=application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/composition/application.ts"],"names":[],"mappings":"AAAA,OAAO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CACF;AAED,wBAAgB,WAAW,CACzB,OAAO,GAAE,kBAAuB,GAC/B,sBAAsB,CAExB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
2
|
+
import { explanation, normalizeTags, optionalDescription, optionalGroup, optionalOrigin, optionalSemanticMetadata, requireText, } from "../foundation/metadata.js";
|
|
3
|
+
import { normalizeScopeFacets, } from "../foundation/scope.js";
|
|
4
|
+
export class ApplicationDeclaration extends Declaration {
|
|
5
|
+
_description;
|
|
6
|
+
_groups = [];
|
|
7
|
+
_policies = [];
|
|
8
|
+
_scopeFacets;
|
|
9
|
+
_surfaces = [];
|
|
10
|
+
_tags = [];
|
|
11
|
+
_explanations = [];
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
super("application");
|
|
14
|
+
if (options.description !== undefined) {
|
|
15
|
+
this.description(options.description);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
description(value) {
|
|
19
|
+
this._description = requireText(value, "application description");
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
tags(...values) {
|
|
23
|
+
this._tags = [...normalizeTags(values, "application tags")];
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
explain(kind, text) {
|
|
27
|
+
this._explanations.push(explanation(kind, text, "application explanation"));
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
groups(...values) {
|
|
31
|
+
this._groups = values.map((value) => value.ref());
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
policies(...values) {
|
|
35
|
+
this._policies = [...values];
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
facets(value) {
|
|
39
|
+
this._scopeFacets = normalizeScopeFacets(value);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
surfaces(...values) {
|
|
43
|
+
this._surfaces = [...values];
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
toState() {
|
|
47
|
+
return {
|
|
48
|
+
identity: this.identity,
|
|
49
|
+
kind: "application",
|
|
50
|
+
groups: [...this._groups],
|
|
51
|
+
policies: this._policies.map((value) => value.ref()),
|
|
52
|
+
...(this._scopeFacets === undefined ? {} : { facets: this._scopeFacets }),
|
|
53
|
+
surfaces: this._surfaces.map((value) => value.ref()),
|
|
54
|
+
...optionalDescription(this._description),
|
|
55
|
+
...optionalGroup(this._group),
|
|
56
|
+
...optionalSemanticMetadata(this._tags, this._explanations),
|
|
57
|
+
...optionalOrigin(this._origin),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function application(options = {}) {
|
|
62
|
+
return new ApplicationDeclaration(options);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/composition/application.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,GAErB,MAAM,oBAAoB,CAAC;AAM5B,MAAM,OAAO,sBAAuB,SAAQ,WAA0B;IAC5D,YAAY,CAAU;IACtB,OAAO,GAA8B,EAAE,CAAC;IACxC,SAAS,GAAgB,EAAE,CAAC;IAC5B,YAAY,CAAoB;IAChC,SAAS,GAAiB,EAAE,CAAC;IAC7B,KAAK,GAAa,EAAE,CAAC;IACrB,aAAa,GAAuB,EAAE,CAAC;IAE/C,YAAY,OAAO,GAAuB,EAAE;QAC1C,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IA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,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;YACzE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACpD,GAAG,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YAC7B,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;YAC3D,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;SAChC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,OAAO,GAAuB,EAAE;IAEhC,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ExplanationKindState, FeatureState } from "../contracts/index.js";
|
|
2
|
+
import type { SchemaFieldMap } from "../definitions/schemas/field.js";
|
|
3
|
+
import type { SchemaDeclaration } from "../definitions/schemas/schema.js";
|
|
4
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
5
|
+
import type { RefMap } from "../foundation/ref.js";
|
|
6
|
+
import type { RegistryMap } from "../project/registry.js";
|
|
7
|
+
type PropertyDeclaration = Declaration<"primitive"> | Declaration<"enum"> | Declaration<"composite"> | Declaration<"literal"> | Declaration<"union"> | Declaration<"record"> | Declaration<"tuple"> | Declaration<"generic"> | Declaration<"temporal">;
|
|
8
|
+
/**
|
|
9
|
+
* A named unit of meaning owned by exactly one Group.
|
|
10
|
+
*
|
|
11
|
+
* A Feature is a registration scope: declarations registered through it belong to the
|
|
12
|
+
* Feature's Group and name the Feature as their owner. Declarations registered directly on
|
|
13
|
+
* the Group have no Feature and are owned by the Group.
|
|
14
|
+
*/
|
|
15
|
+
export declare class FeatureDeclaration extends Declaration<"feature"> {
|
|
16
|
+
#private;
|
|
17
|
+
private _description?;
|
|
18
|
+
private _tags;
|
|
19
|
+
private _explanations;
|
|
20
|
+
constructor();
|
|
21
|
+
description(value: string): this;
|
|
22
|
+
tags(...values: readonly string[]): this;
|
|
23
|
+
explain(kind: ExplanationKindState, text: string): this;
|
|
24
|
+
properties<T extends Readonly<Record<string, PropertyDeclaration>>>(values: T): RefMap<T>;
|
|
25
|
+
schemas<T extends Readonly<Record<string, SchemaDeclaration<SchemaFieldMap, SchemaFieldMap>>>>(values: T): RefMap<T>;
|
|
26
|
+
expressions<T extends RegistryMap<"expressions">>(values: T): RefMap<T>;
|
|
27
|
+
policies<T extends RegistryMap<"policies">>(values: T): RefMap<T>;
|
|
28
|
+
failures<T extends RegistryMap<"failures">>(values: T): RefMap<T>;
|
|
29
|
+
events<T extends RegistryMap<"events">>(values: T): RefMap<T>;
|
|
30
|
+
operations<T extends RegistryMap<"operations">>(values: T): RefMap<T>;
|
|
31
|
+
views<T extends RegistryMap<"views">>(values: T): RefMap<T>;
|
|
32
|
+
workflows<T extends RegistryMap<"workflows">>(values: T): RefMap<T>;
|
|
33
|
+
toState(): FeatureState;
|
|
34
|
+
}
|
|
35
|
+
export declare function feature(): FeatureDeclaration;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../src/composition/feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;A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C,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAEtE;IAED,QAAQ,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAEhE;IAED,QAAQ,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAEhE;IAED,MAAM,CAAC,CAAC,SAAS,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAE5D;IAED,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAEpE;IAED,KAAK,CAAC,CAAC,SAAS,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAE1D;IAED,SAAS,CAAC,CAAC,SAAS,WAAW,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAElE;IAEQ,OAAO,IAAI,YAAY,CAY/B;CACF;AAED,wBAAgB,OAAO,IAAI,kBAAkB,CAE5C"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Declaration } from "../foundation/declaration.js";
|
|
2
|
+
import { explanation, normalizeTags, optionalDescription, optionalOrigin, optionalSemanticMetadata, requireText, } from "../foundation/metadata.js";
|
|
3
|
+
/**
|
|
4
|
+
* A named unit of meaning owned by exactly one Group.
|
|
5
|
+
*
|
|
6
|
+
* A Feature is a registration scope: declarations registered through it belong to the
|
|
7
|
+
* Feature's Group and name the Feature as their owner. Declarations registered directly on
|
|
8
|
+
* the Group have no Feature and are owned by the Group.
|
|
9
|
+
*/
|
|
10
|
+
export class FeatureDeclaration extends Declaration {
|
|
11
|
+
_description;
|
|
12
|
+
_tags = [];
|
|
13
|
+
_explanations = [];
|
|
14
|
+
constructor() {
|
|
15
|
+
super("feature");
|
|
16
|
+
}
|
|
17
|
+
description(value) {
|
|
18
|
+
this._description = requireText(value, "feature description");
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
tags(...values) {
|
|
22
|
+
this._tags = [...normalizeTags(values, "feature tags")];
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
explain(kind, text) {
|
|
26
|
+
this._explanations.push(explanation(kind, text, "feature explanation"));
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
#owner() {
|
|
30
|
+
if (this._group === undefined) {
|
|
31
|
+
throw new TypeError("Feature must be registered on a Group before it can own declarations");
|
|
32
|
+
}
|
|
33
|
+
return this._group;
|
|
34
|
+
}
|
|
35
|
+
#register(registry, values) {
|
|
36
|
+
return this.#owner()._registerOwned(registry, values, this);
|
|
37
|
+
}
|
|
38
|
+
properties(values) {
|
|
39
|
+
return this.#owner().properties(values, this);
|
|
40
|
+
}
|
|
41
|
+
schemas(values) {
|
|
42
|
+
return this.#register("schemas", values);
|
|
43
|
+
}
|
|
44
|
+
expressions(values) {
|
|
45
|
+
return this.#register("expressions", values);
|
|
46
|
+
}
|
|
47
|
+
policies(values) {
|
|
48
|
+
return this.#register("policies", values);
|
|
49
|
+
}
|
|
50
|
+
failures(values) {
|
|
51
|
+
return this.#register("failures", values);
|
|
52
|
+
}
|
|
53
|
+
events(values) {
|
|
54
|
+
return this.#register("events", values);
|
|
55
|
+
}
|
|
56
|
+
operations(values) {
|
|
57
|
+
return this.#register("operations", values);
|
|
58
|
+
}
|
|
59
|
+
views(values) {
|
|
60
|
+
return this.#register("views", values);
|
|
61
|
+
}
|
|
62
|
+
workflows(values) {
|
|
63
|
+
return this.#register("workflows", values);
|
|
64
|
+
}
|
|
65
|
+
toState() {
|
|
66
|
+
if (this._group === undefined) {
|
|
67
|
+
throw new TypeError("Feature must be registered on a Group");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
identity: this.identity,
|
|
71
|
+
kind: "feature",
|
|
72
|
+
group: this._group.ref(),
|
|
73
|
+
...optionalDescription(this._description),
|
|
74
|
+
...optionalSemanticMetadata(this._tags, this._explanations),
|
|
75
|
+
...optionalOrigin(this._origin),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function feature() {
|
|
80
|
+
return new FeatureDeclaration();
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../../src/composition/feature.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvD,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAe/B;;;;;;GAMG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAsB;IACpD,YAAY,CAAU;IACtB,KAAK,GAAa,EAAE,CAAC;IACrB,aAAa,GAAuB,EAAE,CAAC;IAE/C;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,KAAa;QACvB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,GAAG,MAAyB;QAC/B,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,IAA0B,EAAE,IAAY;QAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC;QACxE,OAA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,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAEQ,OAAO;QACd,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACxB,GAAG,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;YAC3D,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;SAChC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,kBAAkB,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|