processfocus 0.1.0-next.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/LICENSE.md +28 -0
- package/README.md +14 -0
- package/dist/auth-FmXptohB.mjs +275 -0
- package/dist/auth-config/src/lib/authentication-config.d.ts +146 -0
- package/dist/auth-config/src/lib/custom-entities-config.d.ts +47 -0
- package/dist/auth-config/src/lib/policies-config.d.ts +52 -0
- package/dist/auth-config/src/lib/provider-types.d.ts +194 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +2 -0
- package/dist/business-calendar/src/index.d.ts +10 -0
- package/dist/business-calendar/src/lib/calendar-config.d.ts +163 -0
- package/dist/business-calendar/src/lib/calendar-period.d.ts +88 -0
- package/dist/business-calendar/src/lib/calendar-service-impl.d.ts +19 -0
- package/dist/business-calendar/src/lib/calendar-service.d.ts +215 -0
- package/dist/business-calendar/src/lib/datetime-utils.d.ts +30 -0
- package/dist/business-calendar/src/lib/duration-calculator.d.ts +49 -0
- package/dist/business-calendar/src/lib/errors.d.ts +69 -0
- package/dist/business-calendar/src/lib/holiday-calculator.d.ts +61 -0
- package/dist/business-calendar/src/lib/holidays.d.ts +141 -0
- package/dist/business-calendar/src/lib/types.d.ts +110 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.mjs +1204 -0
- package/dist/form-client-representation/src/index.d.ts +6 -0
- package/dist/form-client-representation/src/lib/as-client-representation.d.ts +31 -0
- package/dist/form-client-representation/src/lib/client-form-definition.d.ts +17 -0
- package/dist/form-client-representation/src/lib/extract-annotations.d.ts +20 -0
- package/dist/form-client-representation/src/lib/plugin-registry.d.ts +6 -0
- package/dist/form-client-representation/src/lib/types.d.ts +239 -0
- package/dist/form-client-representation/src/lib/walker.d.ts +68 -0
- package/dist/form-rule/src/index.d.ts +3 -0
- package/dist/form-rule/src/lib/evaluator.d.ts +2 -0
- package/dist/form-rule/src/lib/paths.d.ts +9 -0
- package/dist/form-rule/src/lib/types.d.ts +89 -0
- package/dist/form-schema/src/index.d.ts +8 -0
- package/dist/form-schema/src/lib/annotation-helpers.d.ts +8 -0
- package/dist/form-schema/src/lib/deferred-value.d.ts +10 -0
- package/dist/form-schema/src/lib/email.d.ts +23 -0
- package/dist/form-schema/src/lib/field-count.d.ts +32 -0
- package/dist/form-schema/src/lib/form-annotations.d.ts +25 -0
- package/dist/form-schema/src/lib/form-schema.d.ts +459 -0
- package/dist/form-schema/src/lib/phone.d.ts +4 -0
- package/dist/form-schema/src/lib/property-signature.d.ts +3 -0
- package/dist/form-submission-schema/src/index.d.ts +2 -0
- package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +49 -0
- package/dist/form-submission-schema/src/lib/schema-defaults.d.ts +16 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.mjs +2 -0
- package/dist/frontend-manifest/src/index.d.ts +2 -0
- package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +25 -0
- package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +83 -0
- package/dist/frontend-plugin-host/src/index.d.ts +2 -0
- package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +124 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +3780 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.mjs +5 -0
- package/dist/paths-BkzLn-rG.mjs +282 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.mjs +84 -0
- package/dist/process/src/lib/app-icons.d.ts +52 -0
- package/dist/process/src/lib/brands.d.ts +20 -0
- package/dist/process/src/lib/document-store.d.ts +30 -0
- package/dist/process/src/lib/execution-failure-notifications.d.ts +14 -0
- package/dist/process/src/lib/flow-context.d.ts +181 -0
- package/dist/process/src/lib/flow-path.d.ts +123 -0
- package/dist/process/src/lib/form-authoring.d.ts +19 -0
- package/dist/process/src/lib/form-decoration.d.ts +13 -0
- package/dist/process/src/lib/form-defaults.d.ts +5 -0
- package/dist/process/src/lib/form.d.ts +557 -0
- package/dist/process/src/lib/invitation.d.ts +35 -0
- package/dist/process/src/lib/list.d.ts +447 -0
- package/dist/process/src/lib/lookup-accessor.d.ts +68 -0
- package/dist/process/src/lib/node_step.d.ts +68 -0
- package/dist/process/src/lib/org-unit.d.ts +53 -0
- package/dist/process/src/lib/org-utils.d.ts +56 -0
- package/dist/process/src/lib/organisation-frontend-plugin-manifest.d.ts +33 -0
- package/dist/process/src/lib/organisation.d.ts +166 -0
- package/dist/process/src/lib/phase.d.ts +16 -0
- package/dist/process/src/lib/process.d.ts +196 -0
- package/dist/process/src/lib/public-form-branding.d.ts +27 -0
- package/dist/process/src/lib/role.d.ts +29 -0
- package/dist/process/src/lib/schedule.d.ts +239 -0
- package/dist/process/src/lib/sla.d.ts +84 -0
- package/dist/process/src/lib/stats-view.d.ts +68 -0
- package/dist/process/src/lib/step.d.ts +130 -0
- package/dist/process/src/lib/system-step-executor.d.ts +130 -0
- package/dist/process/src/lib/system-step.d.ts +248 -0
- package/dist/sdk/src/auth.d.ts +4 -0
- package/dist/sdk/src/calendar.d.ts +1 -0
- package/dist/sdk/src/forms.d.ts +1 -0
- package/dist/sdk/src/index.d.ts +26 -0
- package/dist/sdk/src/manifest.d.ts +2 -0
- package/dist/sdk/src/plugin.d.ts +3 -0
- package/dist/sdk/src/testing.d.ts +9 -0
- package/dist/src-C-909PVQ.mjs +498 -0
- package/dist/testing.d.ts +9 -0
- package/dist/testing.mjs +5 -0
- package/package.json +67 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { OrganisationFrontendManifest, OrganisationFrontendManifestFormComponentPluginDeclaration, OrganisationFrontendPluginManifestClientPlugin, OrganisationFrontendPluginManifestJson, } from "./frontend-manifest/src/index.js";
|
|
2
|
+
export { ORGANISATION_FRONTEND_MANIFEST_FILE, ORGANISATION_FRONTEND_MANIFEST_VERSION, } from "./frontend-manifest/src/index.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region ../frontend-manifest/src/lib/frontend-manifest.ts
|
|
2
|
+
const ORGANISATION_FRONTEND_MANIFEST_FILE = "frontend-manifest.json";
|
|
3
|
+
const ORGANISATION_FRONTEND_MANIFEST_VERSION = 3;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ORGANISATION_FRONTEND_MANIFEST_FILE, ORGANISATION_FRONTEND_MANIFEST_VERSION };
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
//#region ../form-rule/src/lib/evaluator.ts
|
|
2
|
+
const unavailable = { available: false };
|
|
3
|
+
function evaluateFormRules(input) {
|
|
4
|
+
const targets = /* @__PURE__ */ new Map();
|
|
5
|
+
const paths = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const entry of input.baseState ?? []) setTargetState(paths, targets, entry.path, entry.state);
|
|
7
|
+
for (const rule of input.rules) {
|
|
8
|
+
const effects = evaluateExpression(rule.condition, input) === "match" ? rule.effects : rule.otherwise ?? [];
|
|
9
|
+
for (const effect of effects) setTargetState(paths, targets, effect.target, effect.state);
|
|
10
|
+
}
|
|
11
|
+
return { targets: effectiveTargets(paths, targets) };
|
|
12
|
+
}
|
|
13
|
+
function evaluateExpression(expression, input) {
|
|
14
|
+
switch (expression._tag) {
|
|
15
|
+
case "equals": return compareResolvedValues(resolveRuleValue(expression.left, input), resolveRuleValue(expression.right, input), literalEquals);
|
|
16
|
+
case "notEquals": return compareResolvedValues(resolveRuleValue(expression.left, input), resolveRuleValue(expression.right, input), (left, right) => !literalEquals(left, right));
|
|
17
|
+
case "in": return evaluateMembership(expression.value, expression.candidates, input);
|
|
18
|
+
case "notIn": return invertResult(evaluateMembership(expression.value, expression.candidates, input));
|
|
19
|
+
case "blank": {
|
|
20
|
+
const resolved = resolveRuleValue(expression.value, input);
|
|
21
|
+
return !resolved.available || isBlank(resolved.value) ? "match" : "noMatch";
|
|
22
|
+
}
|
|
23
|
+
case "present": {
|
|
24
|
+
const resolved = resolveRuleValue(expression.value, input);
|
|
25
|
+
return resolved.available && !isBlank(resolved.value) ? "match" : "noMatch";
|
|
26
|
+
}
|
|
27
|
+
case "and": return evaluateAnd(expression.expressions, input);
|
|
28
|
+
case "or": return evaluateOr(expression.expressions, input);
|
|
29
|
+
case "not": return invertResult(evaluateExpression(expression.expression, input));
|
|
30
|
+
case "numberOrder": return evaluateNumberOrder(expression.operator, expression.left, expression.right, input);
|
|
31
|
+
case "stringOrder": return evaluateStringOrder(expression.operator, expression.left, expression.right, input);
|
|
32
|
+
case "dateOrder": return evaluateDateOrder(expression.operator, expression.left, expression.right, input);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function compareResolvedValues(left, right, compare) {
|
|
36
|
+
if (!(left.available && right.available)) return "unavailable";
|
|
37
|
+
if (!(isRuleLiteral(left.value) && isRuleLiteral(right.value))) return "unavailable";
|
|
38
|
+
return compare(left.value, right.value) ? "match" : "noMatch";
|
|
39
|
+
}
|
|
40
|
+
function evaluateMembership(valueRef, candidatesRef, input) {
|
|
41
|
+
const value = resolveRuleValue(valueRef, input);
|
|
42
|
+
const candidates = resolveRuleValue(candidatesRef, input);
|
|
43
|
+
if (!(value.available && candidates.available && Array.isArray(candidates.value))) return "unavailable";
|
|
44
|
+
const memberValue = value.value;
|
|
45
|
+
if (!isRuleLiteral(memberValue) || !candidates.value.every(isRuleLiteral)) return "unavailable";
|
|
46
|
+
return candidates.value.some((candidate) => literalEquals(candidate, memberValue)) ? "match" : "noMatch";
|
|
47
|
+
}
|
|
48
|
+
function evaluateNumberOrder(operator, leftRef, rightRef, input) {
|
|
49
|
+
const left = resolveRuleValue(leftRef, input);
|
|
50
|
+
const right = resolveRuleValue(rightRef, input);
|
|
51
|
+
if (!(left.available && right.available)) return "unavailable";
|
|
52
|
+
if (!(typeof left.value === "number" && typeof right.value === "number")) return "unavailable";
|
|
53
|
+
return compareOrdered(operator, left.value, right.value) ? "match" : "noMatch";
|
|
54
|
+
}
|
|
55
|
+
function evaluateStringOrder(operator, leftRef, rightRef, input) {
|
|
56
|
+
const left = resolveRuleValue(leftRef, input);
|
|
57
|
+
const right = resolveRuleValue(rightRef, input);
|
|
58
|
+
if (!(left.available && right.available)) return "unavailable";
|
|
59
|
+
if (!(typeof left.value === "string" && typeof right.value === "string")) return "unavailable";
|
|
60
|
+
return compareOrdered(operator, left.value, right.value) ? "match" : "noMatch";
|
|
61
|
+
}
|
|
62
|
+
function evaluateDateOrder(operator, leftRef, rightRef, input) {
|
|
63
|
+
const left = resolveRuleValue(leftRef, input);
|
|
64
|
+
const right = resolveRuleValue(rightRef, input);
|
|
65
|
+
if (!(left.available && right.available)) return "unavailable";
|
|
66
|
+
if (!(typeof left.value === "string" && typeof right.value === "string")) return "unavailable";
|
|
67
|
+
const leftTime = parseIsoDateTime(left.value);
|
|
68
|
+
const rightTime = parseIsoDateTime(right.value);
|
|
69
|
+
if (leftTime === void 0 || rightTime === void 0) return "unavailable";
|
|
70
|
+
return compareDateTimes(operator, leftTime, rightTime) ? "match" : "noMatch";
|
|
71
|
+
}
|
|
72
|
+
function compareOrdered(operator, left, right) {
|
|
73
|
+
switch (operator) {
|
|
74
|
+
case "lt": return left < right;
|
|
75
|
+
case "lte": return left <= right;
|
|
76
|
+
case "gt": return left > right;
|
|
77
|
+
case "gte": return left >= right;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function compareDateTimes(operator, left, right) {
|
|
81
|
+
if (left.epochMilliseconds !== right.epochMilliseconds) return compareOrdered(operator, left.epochMilliseconds, right.epochMilliseconds);
|
|
82
|
+
return compareDecimalDigits(operator, left.subMillisecondDigits, right.subMillisecondDigits);
|
|
83
|
+
}
|
|
84
|
+
function compareDecimalDigits(operator, left, right) {
|
|
85
|
+
const width = Math.max(left.length, right.length);
|
|
86
|
+
const paddedLeft = left.padEnd(width, "0");
|
|
87
|
+
const paddedRight = right.padEnd(width, "0");
|
|
88
|
+
const comparison = paddedLeft === paddedRight ? 0 : paddedLeft < paddedRight ? -1 : 1;
|
|
89
|
+
switch (operator) {
|
|
90
|
+
case "lt": return comparison < 0;
|
|
91
|
+
case "lte": return comparison <= 0;
|
|
92
|
+
case "gt": return comparison > 0;
|
|
93
|
+
case "gte": return comparison >= 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function resolveRuleValue(ruleValue, input) {
|
|
97
|
+
switch (ruleValue._tag) {
|
|
98
|
+
case "literal": return {
|
|
99
|
+
available: true,
|
|
100
|
+
value: ruleValue.value
|
|
101
|
+
};
|
|
102
|
+
case "field": {
|
|
103
|
+
const values = ruleValue.source === "base" ? input.baseValues : input.values;
|
|
104
|
+
return values === void 0 ? unavailable : getPathValue(values, ruleValue.path);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function getPathValue(values, path) {
|
|
109
|
+
let current = values;
|
|
110
|
+
for (const segment of path) {
|
|
111
|
+
if (typeof segment === "number") {
|
|
112
|
+
if (!Array.isArray(current) || !Object.hasOwn(current, segment)) return unavailable;
|
|
113
|
+
current = current[segment];
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (!isRecord(current) || !Object.hasOwn(current, segment)) return unavailable;
|
|
117
|
+
current = current[segment];
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
available: true,
|
|
121
|
+
value: current
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function isBlank(value) {
|
|
125
|
+
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
126
|
+
}
|
|
127
|
+
function isRuleLiteral(value) {
|
|
128
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
|
|
129
|
+
return Array.isArray(value) && value.every(isRuleLiteral);
|
|
130
|
+
}
|
|
131
|
+
function isRecord(value) {
|
|
132
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
133
|
+
}
|
|
134
|
+
function literalEquals(left, right) {
|
|
135
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
136
|
+
if (!(Array.isArray(left) && Array.isArray(right))) return false;
|
|
137
|
+
return left.length === right.length && left.every((leftItem, index) => literalEquals(leftItem, right[index]));
|
|
138
|
+
}
|
|
139
|
+
return Object.is(left, right);
|
|
140
|
+
}
|
|
141
|
+
function evaluateAnd(expressions, input) {
|
|
142
|
+
let sawUnavailable = false;
|
|
143
|
+
for (const expression of expressions) {
|
|
144
|
+
const result = evaluateExpression(expression, input);
|
|
145
|
+
if (result === "noMatch") return "noMatch";
|
|
146
|
+
if (result === "unavailable") sawUnavailable = true;
|
|
147
|
+
}
|
|
148
|
+
return sawUnavailable ? "unavailable" : "match";
|
|
149
|
+
}
|
|
150
|
+
function evaluateOr(expressions, input) {
|
|
151
|
+
let sawUnavailable = false;
|
|
152
|
+
for (const expression of expressions) {
|
|
153
|
+
const result = evaluateExpression(expression, input);
|
|
154
|
+
if (result === "match") return "match";
|
|
155
|
+
if (result === "unavailable") sawUnavailable = true;
|
|
156
|
+
}
|
|
157
|
+
return sawUnavailable ? "unavailable" : "noMatch";
|
|
158
|
+
}
|
|
159
|
+
function invertResult(result) {
|
|
160
|
+
switch (result) {
|
|
161
|
+
case "match": return "noMatch";
|
|
162
|
+
case "noMatch": return "match";
|
|
163
|
+
case "unavailable": return "unavailable";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function setTargetState(paths, targets, path, state) {
|
|
167
|
+
const key = pathKey(path);
|
|
168
|
+
paths.set(key, path);
|
|
169
|
+
targets.set(key, {
|
|
170
|
+
...targets.get(key) ?? {},
|
|
171
|
+
...state
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function effectiveTargets(paths, targets) {
|
|
175
|
+
const entries = Array.from(paths.entries());
|
|
176
|
+
return entries.map(([key, path]) => {
|
|
177
|
+
const exact = targets.get(key) ?? {};
|
|
178
|
+
let inheritedHidden = false;
|
|
179
|
+
let inheritedDisabled = false;
|
|
180
|
+
for (const [candidateKey, candidatePath] of entries) {
|
|
181
|
+
if (candidateKey === key || !isAncestorPath(candidatePath, path)) continue;
|
|
182
|
+
const candidateState = targets.get(candidateKey);
|
|
183
|
+
inheritedHidden = inheritedHidden || candidateState?.hidden === true;
|
|
184
|
+
inheritedDisabled = inheritedDisabled || candidateState?.disabled === true;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
path,
|
|
188
|
+
state: {
|
|
189
|
+
...exact,
|
|
190
|
+
...inheritedHidden ? { hidden: true } : {},
|
|
191
|
+
...inheritedDisabled ? { disabled: true } : {}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function isAncestorPath(candidate, path) {
|
|
197
|
+
return candidate.length < path.length && candidate.every((segment, index) => segment === path[index]);
|
|
198
|
+
}
|
|
199
|
+
function pathKey(path) {
|
|
200
|
+
return JSON.stringify(path);
|
|
201
|
+
}
|
|
202
|
+
function parseIsoDateTime(value) {
|
|
203
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?)?$/.exec(value);
|
|
204
|
+
if (match === null) return;
|
|
205
|
+
const year = Number(match[1]);
|
|
206
|
+
const month = Number(match[2]);
|
|
207
|
+
const day = Number(match[3]);
|
|
208
|
+
const hour = match[4] === void 0 ? 0 : Number(match[4]);
|
|
209
|
+
const minute = match[5] === void 0 ? 0 : Number(match[5]);
|
|
210
|
+
const second = match[6] === void 0 ? 0 : Number(match[6]);
|
|
211
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month) || hour > 23 || minute > 59 || second > 59) return;
|
|
212
|
+
const fraction = match[7];
|
|
213
|
+
const timezone = match[8];
|
|
214
|
+
const normalized = match[4] === void 0 ? value : `${match[1]}-${match[2]}-${match[3]}T${match[4]}:${match[5]}:${match[6]}${fraction === void 0 ? "" : `.${fraction.slice(0, 3).padEnd(3, "0")}`}${timezone ?? "Z"}`;
|
|
215
|
+
const time = Date.parse(normalized);
|
|
216
|
+
if (!Number.isFinite(time)) return;
|
|
217
|
+
return {
|
|
218
|
+
epochMilliseconds: time,
|
|
219
|
+
subMillisecondDigits: fraction === void 0 || fraction.length <= 3 ? "" : fraction.slice(3).replace(/0+$/, "")
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function daysInMonth(year, month) {
|
|
223
|
+
return new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ../form-rule/src/lib/paths.ts
|
|
227
|
+
const collectRuleValuePaths = (value, paths) => {
|
|
228
|
+
if (value._tag === "field") paths.push(value.path);
|
|
229
|
+
};
|
|
230
|
+
const collectFormRuleConditionPaths = (expression, paths) => {
|
|
231
|
+
switch (expression._tag) {
|
|
232
|
+
case "equals":
|
|
233
|
+
case "notEquals":
|
|
234
|
+
case "numberOrder":
|
|
235
|
+
case "stringOrder":
|
|
236
|
+
case "dateOrder":
|
|
237
|
+
collectRuleValuePaths(expression.left, paths);
|
|
238
|
+
collectRuleValuePaths(expression.right, paths);
|
|
239
|
+
return;
|
|
240
|
+
case "in":
|
|
241
|
+
case "notIn":
|
|
242
|
+
collectRuleValuePaths(expression.value, paths);
|
|
243
|
+
collectRuleValuePaths(expression.candidates, paths);
|
|
244
|
+
return;
|
|
245
|
+
case "blank":
|
|
246
|
+
case "present":
|
|
247
|
+
collectRuleValuePaths(expression.value, paths);
|
|
248
|
+
return;
|
|
249
|
+
case "and":
|
|
250
|
+
case "or":
|
|
251
|
+
for (const child of expression.expressions) collectFormRuleConditionPaths(child, paths);
|
|
252
|
+
return;
|
|
253
|
+
case "not":
|
|
254
|
+
collectFormRuleConditionPaths(expression.expression, paths);
|
|
255
|
+
return;
|
|
256
|
+
default: throw new Error(`Unexpected form rule expression: ${JSON.stringify(expression)}`);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const formRuleConditionPaths = ({ expression }) => {
|
|
260
|
+
const paths = [];
|
|
261
|
+
collectFormRuleConditionPaths(expression, paths);
|
|
262
|
+
return paths;
|
|
263
|
+
};
|
|
264
|
+
const formRulePathReferencesFieldNames = ({ path, fieldNames }) => {
|
|
265
|
+
const fieldName = path.every((segment) => typeof segment === "string") ? path.join(".") : void 0;
|
|
266
|
+
if (fieldName !== void 0 && fieldNames.has(fieldName)) return true;
|
|
267
|
+
const rootFieldName = path[0];
|
|
268
|
+
return typeof rootFieldName === "string" && fieldNames.has(rootFieldName);
|
|
269
|
+
};
|
|
270
|
+
/** Whether any condition, effect, or otherwise path references a field name. */
|
|
271
|
+
const formRuleReferencesFieldNames = ({ rule, fieldNames }) => {
|
|
272
|
+
return [
|
|
273
|
+
...formRuleConditionPaths({ expression: rule.condition }),
|
|
274
|
+
...rule.effects.map((effect) => effect.target),
|
|
275
|
+
...rule.otherwise?.map((effect) => effect.target) ?? []
|
|
276
|
+
].some((path) => formRulePathReferencesFieldNames({
|
|
277
|
+
path,
|
|
278
|
+
fieldNames
|
|
279
|
+
}));
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
export { formRuleReferencesFieldNames as n, evaluateFormRules as r, formRuleConditionPaths as t };
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { ExecutionMenuActionRegistration, ExecutionMenuActionSelectContext, ExecutionMenuActionVisibilityContext, FormRenderer, FormRendererOptions, FormRendererRegistration, FrontendClientPluginGraphqlRequestError, FrontendClientPluginIdentity, FrontendClientPluginRegistration, FrontendPluginField, FrontendPluginForm, GraphqlClientConsumerProps, GraphqlRequester, OrganisationFrontendPlugin, OrganisationFrontendPluginFailure, OrganisationFrontendPluginHost, RegistrationDisposer, RegistrationRegistry, } from "./frontend-plugin-host/src/index.js";
|
|
2
|
+
export { DuplicatePluginRegistrationError, FRONTEND_PLUGIN_HOST_INTERFACE_VERSION, activateOrganisationFrontendPlugin, activateOrganisationFrontendPlugins, createRegistrationRegistry, } from "./frontend-plugin-host/src/index.js";
|
|
3
|
+
export type { OrganisationBrowserPluginArtifactProvider, OrganisationBrowserPluginBuildInput, OrganisationFrontendManifestPluginCategory, OrganisationFrontendPluginManifestClientPlugin, OrganisationFrontendPluginManifestJson, OrganisationFrontendPluginManifestProvider, } from "./process/src/lib/organisation-frontend-plugin-manifest.js";
|
package/dist/plugin.mjs
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region ../frontend-plugin-host/src/lib/frontend-plugin-host.ts
|
|
2
|
+
const FRONTEND_PLUGIN_HOST_INTERFACE_VERSION = 1;
|
|
3
|
+
var DuplicatePluginRegistrationError = class extends Error {
|
|
4
|
+
key;
|
|
5
|
+
constructor(key) {
|
|
6
|
+
super(`A organisation frontend plugin registration already exists for "${key}"`);
|
|
7
|
+
this.name = "DuplicatePluginRegistrationError";
|
|
8
|
+
this.key = key;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const createRegistrationRegistry = (getKey) => {
|
|
12
|
+
const registrations = /* @__PURE__ */ new Map();
|
|
13
|
+
return {
|
|
14
|
+
register(registration) {
|
|
15
|
+
const key = getKey(registration);
|
|
16
|
+
if (registrations.has(key)) throw new DuplicatePluginRegistrationError(key);
|
|
17
|
+
registrations.set(key, registration);
|
|
18
|
+
return () => {
|
|
19
|
+
if (registrations.get(key) === registration) registrations.delete(key);
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
get: (key) => registrations.get(key),
|
|
23
|
+
list: () => Array.from(registrations.values()),
|
|
24
|
+
reset(resetRegistration, onFailure) {
|
|
25
|
+
if (resetRegistration) for (const registration of registrations.values()) try {
|
|
26
|
+
resetRegistration(registration);
|
|
27
|
+
} catch (cause) {
|
|
28
|
+
try {
|
|
29
|
+
onFailure?.(cause, registration);
|
|
30
|
+
} catch {}
|
|
31
|
+
}
|
|
32
|
+
registrations.clear();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const activateOrganisationFrontendPlugin = async (plugin, host) => {
|
|
37
|
+
const disposers = [];
|
|
38
|
+
const register = (registerCapability) => (registration) => {
|
|
39
|
+
const dispose = registerCapability(registration);
|
|
40
|
+
disposers.push(dispose);
|
|
41
|
+
return dispose;
|
|
42
|
+
};
|
|
43
|
+
const transactionalHost = {
|
|
44
|
+
...host,
|
|
45
|
+
analytics: { register: register(host.analytics.register) },
|
|
46
|
+
formRenderers: { register: register(host.formRenderers.register) },
|
|
47
|
+
executionMenu: { register: register(host.executionMenu.register) }
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
await plugin.activate(transactionalHost);
|
|
51
|
+
} catch (cause) {
|
|
52
|
+
for (const dispose of disposers.reverse()) try {
|
|
53
|
+
dispose();
|
|
54
|
+
} catch {}
|
|
55
|
+
throw cause;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const activateOrganisationFrontendPlugins = async (plugins, host, onFailure) => {
|
|
59
|
+
const pluginIds = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const plugin of plugins) {
|
|
61
|
+
if (pluginIds.has(plugin.id)) {
|
|
62
|
+
try {
|
|
63
|
+
onFailure?.({
|
|
64
|
+
pluginId: plugin.id,
|
|
65
|
+
cause: new DuplicatePluginRegistrationError(plugin.id)
|
|
66
|
+
});
|
|
67
|
+
} catch {}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
pluginIds.add(plugin.id);
|
|
71
|
+
try {
|
|
72
|
+
await activateOrganisationFrontendPlugin(plugin, host);
|
|
73
|
+
} catch (cause) {
|
|
74
|
+
try {
|
|
75
|
+
onFailure?.({
|
|
76
|
+
pluginId: plugin.id,
|
|
77
|
+
cause
|
|
78
|
+
});
|
|
79
|
+
} catch {}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
export { DuplicatePluginRegistrationError, FRONTEND_PLUGIN_HOST_INTERFACE_VERSION, activateOrganisationFrontendPlugin, activateOrganisationFrontendPlugins, createRegistrationRegistry };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Construct, type IConstruct } from "constructs";
|
|
2
|
+
import type { Organisation } from "./organisation.js";
|
|
3
|
+
export interface AppIconMetadataIconProps {
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly publicPath?: string | undefined;
|
|
6
|
+
readonly rel?: string | undefined;
|
|
7
|
+
readonly type?: string | undefined;
|
|
8
|
+
readonly sizes?: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface AppIconManifestIconProps {
|
|
11
|
+
readonly source: string;
|
|
12
|
+
readonly sizes: string;
|
|
13
|
+
readonly publicPath?: string | undefined;
|
|
14
|
+
readonly type?: string | undefined;
|
|
15
|
+
readonly purpose?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface AppIconsProps {
|
|
18
|
+
readonly metadata?: ReadonlyArray<AppIconMetadataIconProps> | undefined;
|
|
19
|
+
readonly manifest?: ReadonlyArray<AppIconManifestIconProps> | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface OrganisationFrontendManifestMetadataIcon {
|
|
22
|
+
readonly url: string;
|
|
23
|
+
readonly rel: string;
|
|
24
|
+
readonly type?: string | undefined;
|
|
25
|
+
readonly sizes?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface OrganisationFrontendManifestWebAppManifestIcon {
|
|
28
|
+
readonly src: string;
|
|
29
|
+
readonly sizes: string;
|
|
30
|
+
readonly type?: string | undefined;
|
|
31
|
+
readonly purpose?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface OrganisationFrontendManifestAppIcons {
|
|
34
|
+
readonly metadata: ReadonlyArray<OrganisationFrontendManifestMetadataIcon>;
|
|
35
|
+
readonly manifest: ReadonlyArray<OrganisationFrontendManifestWebAppManifestIcon>;
|
|
36
|
+
}
|
|
37
|
+
export interface OrganisationFrontendManifestAppIconFile {
|
|
38
|
+
readonly sourcePath: string;
|
|
39
|
+
readonly publicPath: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class AppIcons extends Construct {
|
|
42
|
+
readonly isAppIcons: true;
|
|
43
|
+
readonly metadata: ReadonlyArray<AppIconMetadataIconProps>;
|
|
44
|
+
readonly manifest: ReadonlyArray<AppIconManifestIconProps>;
|
|
45
|
+
constructor(scope: IConstruct, id: string, props: AppIconsProps);
|
|
46
|
+
}
|
|
47
|
+
export declare const buildOrganisationFrontendManifestAppIcons: (org: Organisation, options?: {
|
|
48
|
+
readonly basePath?: string | undefined;
|
|
49
|
+
}) => OrganisationFrontendManifestAppIcons;
|
|
50
|
+
export declare const buildOrganisationFrontendManifestAppIconFiles: (org: Organisation, options?: {
|
|
51
|
+
readonly basePath?: string | undefined;
|
|
52
|
+
}) => ReadonlyArray<OrganisationFrontendManifestAppIconFile>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DocumentStore } from "./document-store.js";
|
|
2
|
+
import type { Form } from "./form.js";
|
|
3
|
+
import type { Invitation } from "./invitation.js";
|
|
4
|
+
import type { List } from "./list.js";
|
|
5
|
+
import type { OrgUnit } from "./org-unit.js";
|
|
6
|
+
import type { Organisation } from "./organisation.js";
|
|
7
|
+
import type { Process } from "./process.js";
|
|
8
|
+
import type { Role } from "./role.js";
|
|
9
|
+
import type { StatsView } from "./stats-view.js";
|
|
10
|
+
import type { Step } from "./step.js";
|
|
11
|
+
export declare const isDocumentStore: (value: unknown) => value is DocumentStore;
|
|
12
|
+
export declare const isForm: (value: unknown) => value is Form;
|
|
13
|
+
export declare const isInvitation: (value: unknown) => value is Invitation;
|
|
14
|
+
export declare const isList: (value: unknown) => value is List;
|
|
15
|
+
export declare const isOrgUnit: (value: unknown) => value is OrgUnit;
|
|
16
|
+
export declare const isOrganisation: (value: unknown) => value is Organisation;
|
|
17
|
+
export declare const isProcess: (value: unknown) => value is Process;
|
|
18
|
+
export declare const isRole: (value: unknown) => value is Role;
|
|
19
|
+
export declare const isStatsView: (value: unknown) => value is StatsView;
|
|
20
|
+
export declare const isStep: (value: unknown) => value is Step;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IConstruct } from "constructs";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
export interface DocumentStoreProps {
|
|
4
|
+
readonly acceptedTypes?: readonly string[];
|
|
5
|
+
readonly maxFileSize?: number;
|
|
6
|
+
readonly expirationDays?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A document store for file uploads and downloads.
|
|
10
|
+
*
|
|
11
|
+
* Attach this to an Organisation to enable presigned URL-based file
|
|
12
|
+
* operations. The runtime provides the actual storage implementation
|
|
13
|
+
* (local filesystem or S3).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* new DocumentStore(org, "document-store", {
|
|
18
|
+
* acceptedTypes: ["application/zip"],
|
|
19
|
+
* maxFileSize: 50 * 1024 * 1024, // 50MB
|
|
20
|
+
* expirationDays: 3, // Delete files after 3 days
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class DocumentStore extends Construct {
|
|
25
|
+
readonly acceptedTypes: readonly string[];
|
|
26
|
+
readonly maxFileSize: number;
|
|
27
|
+
readonly expirationDays: number | undefined;
|
|
28
|
+
readonly isDocumentStore = true;
|
|
29
|
+
constructor(scope: IConstruct, id: string, props?: DocumentStoreProps);
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { Organisation } from "./organisation.js";
|
|
3
|
+
import type { Role } from "./role.js";
|
|
4
|
+
export interface ExecutionFailureNotificationsProps {
|
|
5
|
+
readonly roles?: readonly Role[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Org-wide configuration for fatal execution failure notifications.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ExecutionFailureNotifications extends Construct {
|
|
11
|
+
readonly isExecutionFailureNotifications: true;
|
|
12
|
+
readonly roles: readonly Role[];
|
|
13
|
+
constructor(scope: Organisation, props?: ExecutionFailureNotificationsProps);
|
|
14
|
+
}
|