processfocus 0.1.0-next.2 → 0.1.0-next.4

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.
Files changed (67) hide show
  1. package/dist/{auth-FmXptohB.mjs → auth-DWWupwJA.mjs} +57 -24
  2. package/dist/auth-config/src/lib/authentication-config.d.ts +13 -8
  3. package/dist/auth-config/src/lib/aws-role-binding.d.ts +21 -0
  4. package/dist/auth-config/src/lib/provider-types.d.ts +87 -76
  5. package/dist/auth-config/src/lib/workload-trust.d.ts +41 -0
  6. package/dist/auth.mjs +1 -2
  7. package/dist/business-calendar/src/lib/calendar-config.d.ts +73 -76
  8. package/dist/business-calendar/src/lib/calendar-period.d.ts +30 -30
  9. package/dist/business-calendar/src/lib/calendar-service.d.ts +10 -10
  10. package/dist/business-calendar/src/lib/datetime-utils.d.ts +1 -1
  11. package/dist/business-calendar/src/lib/holidays.d.ts +40 -40
  12. package/dist/business-calendar/src/lib/types.d.ts +29 -29
  13. package/dist/calendar.mjs +73 -63
  14. package/dist/form-schema/src/index.d.ts +4 -1
  15. package/dist/form-schema/src/lib/annotation-helpers.d.ts +2 -2
  16. package/dist/form-schema/src/lib/email.d.ts +2 -2
  17. package/dist/form-schema/src/lib/field-count.d.ts +2 -2
  18. package/dist/form-schema/src/lib/form-annotations.d.ts +6 -0
  19. package/dist/form-schema/src/lib/form-presentation.d.ts +30 -0
  20. package/dist/form-schema/src/lib/form-schema.d.ts +64 -34
  21. package/dist/form-schema/src/lib/number-from-string.d.ts +3 -0
  22. package/dist/form-schema/src/lib/phone.d.ts +2 -2
  23. package/dist/form-schema/src/lib/public-completion-correction.d.ts +5 -0
  24. package/dist/form-schema/src/lib/search-lookup-items.d.ts +3 -0
  25. package/dist/form-submission-schema/src/index.d.ts +3 -0
  26. package/dist/form-submission-schema/src/lib/executable-rules.d.ts +43 -0
  27. package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +33 -10
  28. package/dist/form-submission-schema/src/lib/json-schema.d.ts +3 -0
  29. package/dist/form-submission-schema/src/lib/submission-utils.d.ts +19 -0
  30. package/dist/forms.mjs +26 -2
  31. package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +9 -0
  32. package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +8 -6
  33. package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +11 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.mjs +466 -972
  36. package/dist/manifest.mjs +1 -2
  37. package/dist/plugin.mjs +1 -2
  38. package/dist/process/src/lib/form-authoring.d.ts +1 -1
  39. package/dist/process/src/lib/form-decoration.d.ts +3 -3
  40. package/dist/process/src/lib/form.d.ts +61 -97
  41. package/dist/process/src/lib/list.d.ts +36 -23
  42. package/dist/process/src/lib/lookup-accessor.d.ts +4 -1
  43. package/dist/process/src/lib/organisation.d.ts +14 -0
  44. package/dist/process/src/lib/process.d.ts +24 -2
  45. package/dist/process/src/lib/schedule.d.ts +1 -1
  46. package/dist/process/src/lib/step.d.ts +13 -3
  47. package/dist/process/src/lib/system-step-executor.d.ts +4 -4
  48. package/dist/process/src/lib/system-step.d.ts +11 -1
  49. package/dist/sdk/src/index.d.ts +1 -1
  50. package/dist/sdk/src/testing.d.ts +0 -1
  51. package/dist/{src-C-909PVQ.mjs → src-BQ55-khF.mjs} +118 -66
  52. package/dist/testing.d.ts +0 -1
  53. package/dist/testing.mjs +2 -4
  54. package/package.json +4 -4
  55. package/dist/form-client-representation/src/index.d.ts +0 -6
  56. package/dist/form-client-representation/src/lib/as-client-representation.d.ts +0 -31
  57. package/dist/form-client-representation/src/lib/client-form-definition.d.ts +0 -17
  58. package/dist/form-client-representation/src/lib/extract-annotations.d.ts +0 -20
  59. package/dist/form-client-representation/src/lib/plugin-registry.d.ts +0 -6
  60. package/dist/form-client-representation/src/lib/types.d.ts +0 -239
  61. package/dist/form-client-representation/src/lib/walker.d.ts +0 -68
  62. package/dist/form-rule/src/index.d.ts +0 -3
  63. package/dist/form-rule/src/lib/evaluator.d.ts +0 -2
  64. package/dist/form-rule/src/lib/paths.d.ts +0 -9
  65. package/dist/form-rule/src/lib/types.d.ts +0 -89
  66. package/dist/form-schema/src/lib/property-signature.d.ts +0 -3
  67. package/dist/paths-BkzLn-rG.mjs +0 -282
@@ -1,282 +0,0 @@
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 };