processfocus 0.1.0-next.1 → 0.1.0-next.3

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 +485 -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 +79 -97
  41. package/dist/process/src/lib/list.d.ts +45 -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
package/dist/manifest.mjs CHANGED
@@ -1,5 +1,4 @@
1
- //#region ../frontend-manifest/src/lib/frontend-manifest.ts
1
+ // ../frontend-manifest/src/lib/frontend-manifest.ts
2
2
  const ORGANISATION_FRONTEND_MANIFEST_FILE = "frontend-manifest.json";
3
3
  const ORGANISATION_FRONTEND_MANIFEST_VERSION = 3;
4
- //#endregion
5
4
  export { ORGANISATION_FRONTEND_MANIFEST_FILE, ORGANISATION_FRONTEND_MANIFEST_VERSION };
package/dist/plugin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../frontend-plugin-host/src/lib/frontend-plugin-host.ts
1
+ // ../frontend-plugin-host/src/lib/frontend-plugin-host.ts
2
2
  const FRONTEND_PLUGIN_HOST_INTERFACE_VERSION = 1;
3
3
  var DuplicatePluginRegistrationError = class extends Error {
4
4
  key;
@@ -80,5 +80,4 @@ const activateOrganisationFrontendPlugins = async (plugins, host, onFailure) =>
80
80
  }
81
81
  }
82
82
  };
83
- //#endregion
84
83
  export { DuplicatePluginRegistrationError, FRONTEND_PLUGIN_HOST_INTERFACE_VERSION, activateOrganisationFrontendPlugin, activateOrganisationFrontendPlugins, createRegistrationRegistry };
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { type DeferredValue, type StructuralOnlyMarker } from "../../../form-schema/src/index.js";
3
3
  import type { FlowContext, FormStepMeta, StepMeta } from "./flow-context.js";
4
- type StructuralContent = Schema.Schema.Any & StructuralOnlyMarker;
4
+ type StructuralContent = Schema.Top & StructuralOnlyMarker;
5
5
  type Resolver<State, Steps extends Record<string, StepMeta | FormStepMeta>, Item, A> = (state: State, ctx: FlowContext<Steps>, item: Item) => A;
6
6
  export interface FormAuthoring<State, Steps extends Record<string, StepMeta | FormStepMeta>, Item> {
7
7
  readonly value: <A>(resolve: Resolver<State, Steps, Item, A>, fallback?: NoInfer<A>) => DeferredValue<A>;
@@ -1,4 +1,4 @@
1
- import { Schema, SchemaAST } from "effect";
1
+ import { Schema, type SchemaAST } from "effect";
2
2
  declare const FormDecorationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
3
  readonly _tag: "FormDecorationError";
4
4
  } & Readonly<A>;
@@ -7,7 +7,7 @@ export declare class FormDecorationError extends FormDecorationError_base<{
7
7
  readonly message: string;
8
8
  }> {
9
9
  }
10
- export declare const decorateAst: (original: SchemaAST.AST, value: unknown, path: string) => SchemaAST.AST;
10
+ export declare const decorateAst: (original: SchemaAST.AST, value: unknown, path: string, inputAst?: SchemaAST.AST) => SchemaAST.AST;
11
11
  /** Preserve property transformations and exact field types during safe resolution. */
12
- export declare const mapFormFields: <Fields extends Schema.Struct.Fields>(fields: Fields, map: (ast: SchemaAST.AST, name: string) => SchemaAST.AST, mapAnnotations?: (annotations: SchemaAST.Annotations, ast: SchemaAST.AST, name: string, side: "input" | "output") => SchemaAST.Annotations, mapOutput?: (ast: SchemaAST.AST, name: string) => SchemaAST.AST) => Fields;
12
+ export declare const mapFormFields: <Fields extends Schema.Struct.Fields>(fields: Fields, map: (ast: SchemaAST.AST, name: string) => SchemaAST.AST, mapAnnotations?: (annotations: Record<PropertyKey, unknown>, ast: SchemaAST.AST, name: string, side: "input" | "output") => Record<PropertyKey, unknown>, mapOutput?: (ast: SchemaAST.AST, name: string) => SchemaAST.AST) => Fields;
13
13
  export {};
@@ -1,14 +1,12 @@
1
1
  import type { StoredEmailAttachment } from "@processfocus/runtime";
2
- import { type DateTime, Effect, Schema } from "effect";
3
- import { type ClientFormDefinition, type WalkError } from "../../../form-client-representation/src/index.js";
4
- import { type FormRule, type FormRuleEvaluationResult, type FormRuleExpression, type FormRuleLiteral, type FormRulePath, type FormRuleTargetState, type FormRuleValues } from "../../../form-rule/src/index.js";
5
- import { type CalendarSlotItem, type FlattenMarker, type LookupItem, type ReadOnlyMarker, type StableFormFields, type StructuralOnlyMarker, type TableFieldMarker } from "../../../form-schema/src/index.js";
2
+ import { type DateTime, type Duration, Effect, Schema } from "effect";
3
+ import { type CalendarSlotItem, type FormPresentation, type LookupFieldMetadata, type LookupItem, type LookupMarker, type StableFormFields } from "../../../form-schema/src/index.js";
6
4
  import { type DeepWritable } from "../../../form-submission-schema/src/index.js";
7
- import type { FlowContext, FormStepMeta, StepMeta, SummaryContext } from "./flow-context.js";
8
- import type { FlowPath } from "./flow-path.js";
5
+ import type { FlowContext, FormStepMeta, MergeFormStep, MergeSteps, StepMeta, SummaryContext } from "./flow-context.js";
6
+ import { type FlowPath, type MergeState } from "./flow-path.js";
9
7
  import { type FormAuthoring } from "./form-authoring.js";
10
8
  import { LookupAccessor, type LookupOverride, type LookupOverrideStore } from "./lookup-accessor.js";
11
- import type { InferFormSchemaType, Process } from "./process.js";
9
+ import type { InferFormSchemaType, Process, ResolveStepOutput } from "./process.js";
12
10
  import type { Role } from "./role.js";
13
11
  import { type IStepScope, Step, type StepProps } from "./step.js";
14
12
  import { type AuthorTaggedError, type ForEachConfig, NotAForEachStepError } from "./system-step.js";
@@ -30,58 +28,27 @@ export declare const countLeafFields: (value: unknown) => number;
30
28
  type FormDefaults<TInput extends Schema.Struct.Fields> = {
31
29
  [K in keyof TInput]: DeepWritable<Schema.Schema.Type<TInput[K]>>;
32
30
  };
33
- export declare const FormRuleSelf: unique symbol;
34
- type RuleLiteralFor<T> = Extract<T, FormRuleLiteral>;
35
- type RuleComparable<T> = RuleLiteralFor<Exclude<T, undefined>>;
36
- type RuleOrderComparable<T> = Extract<RuleComparable<T>, string | number>;
37
- type Prettify<T> = {
38
- readonly [K in keyof T]: T[K];
39
- } & {};
40
- type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer I) => void ? I : never;
41
- interface FormRuleValueAccessor<T> {
42
- readonly equals: (value: RuleComparable<T>) => FormRuleExpression;
43
- readonly notEquals: (value: RuleComparable<T>) => FormRuleExpression;
44
- readonly in: (values: readonly RuleComparable<T>[]) => FormRuleExpression;
45
- readonly notIn: (values: readonly RuleComparable<T>[]) => FormRuleExpression;
46
- readonly blank: () => FormRuleExpression;
47
- readonly present: () => FormRuleExpression;
48
- readonly lt: (value: RuleOrderComparable<T>) => FormRuleExpression;
49
- readonly lte: (value: RuleOrderComparable<T>) => FormRuleExpression;
50
- readonly gt: (value: RuleOrderComparable<T>) => FormRuleExpression;
51
- readonly gte: (value: RuleOrderComparable<T>) => FormRuleExpression;
52
- }
53
- type RuleField<Field> = Field extends {
54
- readonly from: infer From;
55
- } ? RuleField<From> : Field;
56
- type FormRuleValueAccessorEntry<TInput extends Schema.Struct.Fields, K extends keyof TInput & string> = RuleField<TInput[K]> extends ReadOnlyMarker | StructuralOnlyMarker ? Record<never, never> : TInput[K] extends FlattenMarker ? TInput[K] extends Schema.Struct<infer NestedFields> ? FormRuleValueAccessors<NestedFields> : Record<never, never> : {
57
- readonly [P in K]: RuleField<TInput[K]> extends Schema.Struct<infer NestedFields> ? FormRuleValueAccessors<NestedFields> : FormRuleValueAccessor<Schema.Schema.Type<TInput[K]>>;
58
- };
59
- type FormRuleValueAccessors<TInput extends Schema.Struct.Fields> = Prettify<UnionToIntersection<{
60
- readonly [K in keyof TInput & string]: FormRuleValueAccessorEntry<TInput, K>;
61
- }[keyof TInput & string]>>;
62
- type LeafFormRuleTargetState = FormRuleTargetState;
63
- type ContainerFormRuleTargetState = Omit<FormRuleTargetState, "required">;
64
- type StaticDisplayFormRuleTargetState = Omit<FormRuleTargetState, "required">;
65
- export type FormRuleTargetTree<TInput extends Schema.Struct.Fields> = {
66
- readonly [K in keyof TInput & string]?: RuleField<TInput[K]> extends StructuralOnlyMarker | ReadOnlyMarker ? StaticDisplayFormRuleTargetState : RuleField<TInput[K]> extends TableFieldMarker ? StaticDisplayFormRuleTargetState : RuleField<TInput[K]> extends Schema.Struct<infer NestedFields> ? (FormRuleTargetTree<NestedFields> & {
67
- readonly [FormRuleSelf]?: ContainerFormRuleTargetState;
68
- }) | (TInput[K] extends Schema.Struct<infer _Fields> ? never : LeafFormRuleTargetState) : LeafFormRuleTargetState;
69
- };
70
- interface AuthoredFormRule<TInput extends Schema.Struct.Fields> {
71
- readonly effects: (effects: FormRuleTargetTree<TInput>, otherwise?: FormRuleTargetTree<TInput>) => FormRule;
72
- }
73
- interface FormRuleAuthor<TInput extends Schema.Struct.Fields> {
74
- readonly when: (condition: FormRuleExpression) => AuthoredFormRule<TInput>;
75
- readonly and: (...expressions: readonly FormRuleExpression[]) => FormRuleExpression;
76
- readonly or: (...expressions: readonly FormRuleExpression[]) => FormRuleExpression;
77
- readonly not: (expression: FormRuleExpression) => FormRuleExpression;
78
- }
79
31
  /**
80
32
  * Summary type for todo cards.
81
33
  * Record where keys are labels and values are the display strings.
82
34
  * Using Record prevents duplicate labels.
83
35
  */
84
36
  export type Summary = Record<string, string>;
37
+ declare const FormSubmissionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
38
+ readonly _tag: "FormSubmissionError";
39
+ } & Readonly<A>;
40
+ /** Client-safe rejection from an authored form submission callback. */
41
+ export declare class FormSubmissionError extends FormSubmissionError_base<{
42
+ readonly field: string;
43
+ readonly message: string;
44
+ }> {
45
+ }
46
+ /** An unauthenticated process start, independent of External Participants. */
47
+ export interface FormAnonymousPageConfig {
48
+ /** Stable address segment. Use an unguessable value for private reception pages. */
49
+ readonly address: string;
50
+ readonly afterSubmit: "restart" | "thank-you";
51
+ }
85
52
  export interface FormEmbedConfig {
86
53
  readonly sites: readonly string[];
87
54
  readonly thankYou: string;
@@ -134,6 +101,13 @@ export interface FormPublicCompletionConfig<TState, TSteps extends Record<string
134
101
  /** Public form supporting copy override for this completion link. */
135
102
  readonly formDescription?: string;
136
103
  }
104
+ type FormBindings<F extends Schema.Struct.Fields> = {
105
+ readonly [K in keyof F]?: FormPresentation & {
106
+ readonly default?: F[K]["Encoded"];
107
+ } & (F[K] extends LookupMarker ? {
108
+ readonly query?: LookupFieldMetadata["query"];
109
+ } : unknown);
110
+ };
137
111
  /**
138
112
  * Base props shared by all Form steps.
139
113
  */
@@ -193,7 +167,16 @@ interface FormStepPropsBase<TState, TSteps extends Record<string, StepMeta | For
193
167
  * })
194
168
  * ```
195
169
  */
196
- readonly form: (helpers: FormAuthoring<TState, TSteps, TItem>) => StaticFormDeclaration<TInput>;
170
+ readonly form: Schema.Struct<TInput> | ((helpers: FormAuthoring<TState, TSteps, TItem>) => StaticFormDeclaration<TInput>);
171
+ /** Server-only request bindings; fields and their value contracts remain static. */
172
+ readonly bindings?: (state: TState, ctx: FlowContext<TSteps>, item: TItem) => FormBindings<TInput>;
173
+ /** Browser-safe module exporting the same static schema supplied to form. */
174
+ readonly browser?: {
175
+ readonly entrypoint: string;
176
+ readonly exportName: string;
177
+ /** Server-only, request-local public data keyed by submitted field path. */
178
+ readonly resolvePluginConfiguration?: () => Effect.Effect<Readonly<Record<string, unknown>>, never, unknown>;
179
+ };
197
180
  /**
198
181
  * Function to compute summary for todo cards.
199
182
  * Returns contextual information displayed on the todo card.
@@ -221,6 +204,12 @@ interface FormStepPropsBase<TState, TSteps extends Record<string, StepMeta | For
221
204
  * it before persisting `to_do.assigned_to_provider_user`.
222
205
  */
223
206
  readonly assignee?: (state: TState, ctx: FlowContext<TSteps>, item: TItem) => AssigneeResult;
207
+ /**
208
+ * Persist domain data after validation, inside the submission transaction.
209
+ * Failure rolls back submission. Completion retries can rerun this callback:
210
+ * use transactional database writes, never irreversible external effects.
211
+ */
212
+ readonly onSubmit?: (input: InferFormSchemaType<TInput>) => Effect.Effect<void, FormSubmissionError, unknown>;
224
213
  /**
225
214
  * Optional struct-level validation that runs after individual field
226
215
  * validation during schema decode. Receives the flat decoded struct
@@ -255,6 +244,7 @@ interface FormStepPropsBase<TState, TSteps extends Record<string, StepMeta | For
255
244
  * Optional configuration for rendering this start form as an anonymous embed.
256
245
  * Allowed sites are exact origins only.
257
246
  */
247
+ readonly anonymousPage?: FormAnonymousPageConfig;
258
248
  readonly embed?: FormEmbedConfig;
259
249
  /**
260
250
  * Optional external completion email for non-start forms. The regular role
@@ -341,6 +331,7 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
341
331
  * Request-local resolution of the static declaration's lazy expressions.
342
332
  */
343
333
  private _formFn;
334
+ private readonly _onSubmit;
344
335
  /**
345
336
  * The summary function, stored for computing summary from process state.
346
337
  */
@@ -366,17 +357,27 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
366
357
  * Lookup query overrides set via `this.lookups.<field>.setQuery()`.
367
358
  */
368
359
  private _lookupOverrides;
369
- /**
370
- * Typed accessors for lookup fields.
371
- * Use `this.lookups.<field>.setQuery()` for independent lookups or
372
- * `this.lookups.<field>.dependsOn([...]).setQuery()` for dependent lookups.
373
- */
374
- static readonly self: symbol;
360
+ private _lookupResolvers;
361
+ _setLookupResolver(fieldName: string, resolve: NonNullable<LookupFieldMetadata["resolve"]>): void;
362
+ resolveLookupSelection(fieldName: string, value: string, fields?: Schema.Struct.Fields): Effect.Effect<LookupItem | null, unknown, unknown>;
375
363
  readonly isForm = true;
364
+ /** Attach a deadline. The owner output is not yet available. */
365
+ onDeadline<TOutput extends Schema.Struct.Fields | undefined, THandlerId extends string, THandlerIsForm extends boolean = false>(name: string, options: {
366
+ readonly handler: Step<TState, TOutput, THandlerId, THandlerIsForm, false>;
367
+ readonly interrupting?: boolean;
368
+ } & ({
369
+ readonly after: Duration.Duration;
370
+ readonly at?: never;
371
+ } | {
372
+ readonly at: (state: TState) => DateTime.DateTime;
373
+ readonly after?: never;
374
+ })): FlowPath<MergeState<TState, ResolveStepOutput<TOutput, THandlerIsForm>>, TOutput, THandlerIsForm extends true ? MergeFormStep<TSteps, THandlerId> : MergeSteps<TSteps, THandlerId>>;
376
375
  readonly lookups: {
377
376
  readonly [K in keyof TInput & string]: LookupAccessor<TInput, K>;
378
377
  };
379
- private _rules;
378
+ readonly sharedSchema: Schema.Struct<TInput>;
379
+ readonly browser: FormProps<TState, TSteps, TInput, TItem>["browser"];
380
+ readonly anonymousPage: FormAnonymousPageConfig | undefined;
380
381
  readonly embed: FormEmbedConfig | undefined;
381
382
  readonly supportingRoles: readonly Role[] | undefined;
382
383
  readonly publicCompletion: FormPublicCompletionConfig<TState, TSteps, TItem> | undefined;
@@ -395,14 +396,16 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
395
396
  * Used by the schema generator to emit per-lookup GraphQL queries.
396
397
  */
397
398
  lookupOverrides(): ReadonlyMap<string, LookupOverride>;
398
- /**
399
- * Append browser-safe form rules authored against typed field accessors and
400
- * a typed target tree matching this form's schema.
401
- */
402
- rules(build: (values: FormRuleValueAccessors<TInput>, rule: FormRuleAuthor<TInput>) => readonly FormRule[]): this;
403
- authoritativeFormRules(): readonly FormRule[];
404
- flattenRuleTargetPath(path: FormRulePath): FormRulePath;
405
- evaluateFormRules(values: FormRuleValues, baseValues?: FormRuleValues): FormRuleEvaluationResult;
399
+ private _prefill;
400
+ /** Fresh selection-dependent values. Concealed fields still travel on submission. */
401
+ prefillOn<const K extends keyof TInput & string, const F extends keyof Schema.Struct.Type<TInput> & keyof TInput & string>(dependency: K, options: {
402
+ fields: readonly F[];
403
+ concealed?: readonly F[];
404
+ load: (value: string) => Effect.Effect<Pick<Schema.Struct.Type<TInput>, F>, unknown, unknown>;
405
+ }): this;
406
+ prefillQuery(): typeof this._prefill;
407
+ prefillQueryName(): string;
408
+ submissionPath(path: readonly (string | number)[]): readonly (string | number)[];
406
409
  /**
407
410
  * Returns the GraphQL query name for a dependent lookup field.
408
411
  * E.g. `lookupDevopsAddEnvironmentInputEnvironmentDetailsStageId`
@@ -418,7 +421,9 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
418
421
  * Returns Schema.Struct(fields), optionally refined with a struct-level
419
422
  * filterEffect when a `validate` callback was provided.
420
423
  */
421
- get outputSchema(): Schema.Schema.Any;
424
+ get outputSchema(): Schema.Top;
425
+ /** Invoke only after the runtime has validated and authorized the submission. */
426
+ executeSubmit(input: InferFormSchemaType<TInput>): Effect.Effect<void, FormSubmissionError, unknown>;
422
427
  /**
423
428
  * Get the flat submission validation schema for this form.
424
429
  * Returns submissionSchema(fields) (wrapper fields flattened, read-only/
@@ -428,7 +433,7 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
428
433
  * Used by start/complete resolvers for server-side validation where
429
434
  * wrapper nesting should not affect persisted state shape.
430
435
  */
431
- get submissionEffectSchema(): Schema.Schema.Any;
436
+ get submissionEffectSchema(): Schema.Top;
432
437
  /**
433
438
  * Get the forEach items for this form.
434
439
  * Returns the array of items, where each item is context data for one form instance.
@@ -499,32 +504,6 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
499
504
  * This keeps start-step metadata from leaking symbolic defaults to clients.
500
505
  */
501
506
  resolveInitialDefaults(currentProviderUser?: string): Effect.Effect<Record<string, unknown>, never>;
502
- /**
503
- * Get the client representation for this form's fields.
504
- * Used for rendering the form in the UI.
505
- *
506
- * Post-processes the representation to add `dependencies` and `queryName`
507
- * to any lookup components that have dependent overrides.
508
- *
509
- * @returns Effect that produces the client representation
510
- */
511
- private buildClientComponents;
512
- private buildClientFormDefinition;
513
- private resolveDynamicTextBlockComponent;
514
- private resolveDynamicTextBlocks;
515
- private buildRenderableClientFormDefinition;
516
- clientFormDefinition(): Effect.Effect<ClientFormDefinition, WalkError>;
517
- renderableClientFormDefinition(): Effect.Effect<ClientFormDefinition, WalkError, unknown>;
518
- clientFormDefinitionWithState(state: Record<string, unknown>, ctx: FlowContext<TSteps>, item?: unknown): Effect.Effect<ClientFormDefinition, WalkError>;
519
- renderableClientFormDefinitionWithState(state: Record<string, unknown>, ctx: FlowContext<TSteps>, item?: unknown): Effect.Effect<ClientFormDefinition, WalkError, unknown>;
520
- /**
521
- * Get the submission schema for form validation.
522
- * Excludes read-only fields and removes additionalProperties constraint
523
- * to allow form values to include read-only fields.
524
- *
525
- * @returns JSON schema object
526
- */
527
- submissionSchema(): Record<string, unknown>;
528
507
  /**
529
508
  * Execute a lookup query for a specific field in this form.
530
509
  *
@@ -543,6 +522,9 @@ export declare class Form<TState = Record<string, never>, TSteps extends Record<
543
522
  private _runCalendarSlotQuery;
544
523
  executeCalendarSlots(fieldName: string): Effect.Effect<ReadonlyArray<CalendarSlotItem>, unknown, unknown>;
545
524
  executeCalendarSlotsWithState(fieldName: string, state: TState, ctx: FlowContext<TSteps>, item?: TItem): Effect.Effect<ReadonlyArray<CalendarSlotItem>, unknown, unknown>;
525
+ /** Encoded authoritative values, without form-initialization placeholders. */
526
+ resolveOriginalValues(processState: Record<string, unknown>, ctx: FlowContext<TSteps>, item?: unknown, currentProviderUser?: string): Effect.Effect<Record<string, unknown>, never>;
527
+ resolvePresentation(processState: Record<string, unknown>, ctx: FlowContext<TSteps>, item?: unknown): Record<string, FormPresentation>;
546
528
  /**
547
529
  * Resolves all default values for this Form given the current process state.
548
530
  * Re-executes the form function with state to get fields with state-based defaults.
@@ -1,11 +1,10 @@
1
1
  import { Construct } from "constructs";
2
2
  import type { Schema } from "effect";
3
3
  import { type Effect, Effect as EffectModule } from "effect";
4
- import type { JsonSchema7Root } from "effect/JSONSchema";
5
- import { type ClientFormDefinition, type WalkError } from "../../../form-client-representation/src/index.js";
6
4
  import { type MetricBreakdownControl } from "../../../form-schema/src/index.js";
7
- import { type DeepWritable, type FlattenFields, submissionSchemaSync as makeSubmissionSchema } from "../../../form-submission-schema/src/index.js";
5
+ import { type DeepWritable, type FlattenFields, type FlattenFieldsKeepingReadOnly, submissionSchemaSync as makeSubmissionSchema } from "../../../form-submission-schema/src/index.js";
8
6
  import type { OrgUnit } from "./org-unit.js";
7
+ import type { Process } from "./process.js";
9
8
  import type { Role } from "./role.js";
10
9
  declare const ListItemQueryNotDefinedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
11
10
  readonly _tag: "ListItemQueryNotDefinedError";
@@ -138,8 +137,18 @@ export type ListQueryFunction<TOutput extends Schema.Struct.Fields, R = never> =
138
137
  /**
139
138
  * Function type for fetching a single list item by ID.
140
139
  * Returns the item or null if not found.
140
+ *
141
+ * The returned data is flat: wrapper fields are visual-only containers whose
142
+ * children flatten into the parent, structural-only elements are omitted, and
143
+ * read-only fields stay because they are display data. This matches the
144
+ * flattened GraphQL detail type and the browser renderer's value paths.
145
+ */
146
+ export type ListItemQueryFunction<TForm extends Schema.Struct.Fields, R = never> = (id: string, ctx?: ListItemQueryContext) => Effect.Effect<ListItemDetail<TForm> | null, never, R>;
147
+ /**
148
+ * Type for the data an item query returns for a list form: flattened wrapper
149
+ * fields, no structural-only elements, read-only fields kept.
141
150
  */
142
- export type ListItemQueryFunction<TForm extends Schema.Struct.Fields, R = never> = (id: string, ctx?: ListItemQueryContext) => Effect.Effect<OutputItem<TForm> | null, never, R>;
151
+ export type ListItemDetail<TForm extends Schema.Struct.Fields> = FlattenFieldsKeepingReadOnly<TForm> extends infer F extends Schema.Struct.Fields ? Schema.Schema.Type<Schema.Struct<F>> : never;
143
152
  /**
144
153
  * Type for the update input, flattening wrapper fields and excluding
145
154
  * structural/read-only elements.
@@ -174,6 +183,12 @@ export interface ListProps<TOutput extends Schema.Struct.Fields, R = never, TFor
174
183
  readonly roles: readonly [Role, ...Role[]];
175
184
  /** Output schema defining the shape of list items `query` should return */
176
185
  readonly output: TOutput;
186
+ /** Optional button opening this process's single start form. Uses its start permission. */
187
+ readonly startProcess?: Process;
188
+ /** Additional starts alongside the primary start button. */
189
+ readonly additionalStartProcesses?: readonly Process[];
190
+ /** Reveal this process's Anonymous Page to callers who may view the List. */
191
+ readonly anonymousPage?: Process;
177
192
  /** Default page size (default: 20, max: 100) */
178
193
  readonly defaultPageSize?: number;
179
194
  /** Query function returning paginated results */
@@ -182,7 +197,12 @@ export interface ListProps<TOutput extends Schema.Struct.Fields, R = never, TFor
182
197
  readonly exportOutput?: TExportOutput;
183
198
  /** Optional export query overriding the normal list query for CSV exports */
184
199
  readonly exportQuery?: ListQueryFunction<ListExportOutputFields<TOutput, TExportOutput>, R>;
185
- /** Optional form schema defining detail view fields (can differ from output) */
200
+ /** Portable detail/edit schema export, loaded from the organisation artifact. */
201
+ readonly browser?: {
202
+ readonly entrypoint: string;
203
+ readonly exportName: string;
204
+ };
205
+ /** Static detail/edit fields from the same exported schema. */
186
206
  readonly form?: () => TForm;
187
207
  /** Optional query function for fetching a single item by ID */
188
208
  readonly itemQuery?: ListItemQueryFunction<TForm, R>;
@@ -192,6 +212,10 @@ export interface ListProps<TOutput extends Schema.Struct.Fields, R = never, TFor
192
212
  readonly delete?: ListDeleteFunction<R>;
193
213
  /** Opt-in creation, with an independent form and server-owned record ID. */
194
214
  readonly create?: {
215
+ readonly browser?: {
216
+ readonly entrypoint: string;
217
+ readonly exportName: string;
218
+ };
195
219
  readonly form: () => TCreate;
196
220
  readonly submit: (input: ListCreateInput<TCreate>) => Effect.Effect<string, ListCreateError, R>;
197
221
  };
@@ -235,6 +259,8 @@ export declare const MAX_PAGE_SIZE = 100;
235
259
  export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.Fields, R = never, TId extends string = string, TForm extends Schema.Struct.Fields = Schema.Struct.Fields, TExportOutput extends Schema.Struct.Fields | undefined = undefined, TCreate extends Schema.Struct.Fields = Schema.Struct.Fields> extends Construct {
236
260
  readonly isList = true;
237
261
  private readonly _create?;
262
+ readonly browser: ListProps<TOutput, R, TForm, TExportOutput, TCreate>["browser"];
263
+ readonly createBrowser: NonNullable<ListProps<TOutput, R, TForm, TExportOutput, TCreate>["create"]>["browser"];
238
264
  readonly createFormFields: TCreate | undefined;
239
265
  /** Display name for the list */
240
266
  readonly name: string;
@@ -246,6 +272,17 @@ export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.F
246
272
  readonly roles: readonly [Role, ...Role[]];
247
273
  /** Output schema defining the shape of list items */
248
274
  readonly output: TOutput;
275
+ /** Start button metadata; visibility is authorized separately from List access. */
276
+ readonly startProcess: {
277
+ readonly path: string;
278
+ readonly name: string;
279
+ readonly startStepPath: string;
280
+ } | undefined;
281
+ readonly additionalStartProcesses: ReadonlyArray<NonNullable<List["startProcess"]>>;
282
+ readonly anonymousPage: {
283
+ readonly name: string;
284
+ readonly path: string;
285
+ } | undefined;
249
286
  /** Default page size */
250
287
  readonly defaultPageSize: number;
251
288
  /** The query function */
@@ -277,12 +314,10 @@ export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.F
277
314
  createInputTypeName(): string;
278
315
  createSubmissionSchema(): ReturnType<typeof makeSubmissionSchema<TCreate>> | null;
279
316
  createFormMetadata(currentProviderUser?: string): EffectModule.Effect<{
280
- readonly formDefinition: ClientFormDefinition;
281
317
  readonly defaultValues: Record<string, DeepWritable<unknown>>;
282
- readonly jsonSchema: JsonSchema7Root;
283
318
  readonly createMutationName: string;
284
319
  readonly createInputTypeName: string;
285
- } | null, WalkError>;
320
+ } | null, never>;
286
321
  executeCreate(input: ListCreateInput<TCreate>): Effect.Effect<string, ListCreateError | ListCreateNotDefinedError, R>;
287
322
  /**
288
323
  * Get the GraphQL query name for this list.
@@ -346,7 +381,7 @@ export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.F
346
381
  * @param id - The ID of the item to fetch
347
382
  * @returns Effect producing the item or null
348
383
  */
349
- executeItemQuery(id: string, ctx?: ListItemQueryContext): Effect.Effect<OutputItem<TForm> | null, ListItemQueryNotDefinedError, R>;
384
+ executeItemQuery(id: string, ctx?: ListItemQueryContext): Effect.Effect<ListItemDetail<TForm> | null, ListItemQueryNotDefinedError, R>;
350
385
  /**
351
386
  * Get declared generic controls that can be passed to the item query.
352
387
  */
@@ -361,19 +396,6 @@ export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.F
361
396
  * Returns empty array if no form is defined.
362
397
  */
363
398
  formColumns(): ListColumn[];
364
- /**
365
- * Generate the browser-safe form definition for the form fields.
366
- * List forms do not currently support dynamic rules, so the canonical rule
367
- * channel is always an empty array.
368
- * Returns null if no form is defined.
369
- */
370
- clientFormDefinition(): EffectModule.Effect<ClientFormDefinition | null, WalkError>;
371
- /**
372
- * Generate JSON Schema for the form's submittable fields.
373
- * Strips read-only and structural-only fields; removes additionalProperties.
374
- * Returns null if no form is defined.
375
- */
376
- formSubmissionSchema(): Record<string, unknown> | null;
377
399
  /**
378
400
  * Get default values for the form fields.
379
401
  * Returns null if no form is defined.
@@ -428,7 +450,7 @@ export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.F
428
450
  * Get editable form fields as a record (excludes FormReadOnly fields).
429
451
  * Useful for schema generation where the full field schemas are needed.
430
452
  */
431
- editableFormFields(): Record<string, Schema.Schema.AnyNoContext>;
453
+ editableFormFields(): Record<string, Schema.Codec<unknown, unknown>>;
432
454
  /**
433
455
  * Get column metadata for editable form fields only.
434
456
  * Returns columns for fields NOT annotated with FormReadOnly.
@@ -1,5 +1,5 @@
1
1
  import type { Effect, Schema } from "effect";
2
- import type { LookupItem } from "../../../form-schema/src/index.js";
2
+ import type { LookupFieldMetadata, LookupItem } from "../../../form-schema/src/index.js";
3
3
  /**
4
4
  * Input for independent lookup queries — just filter.
5
5
  */
@@ -29,6 +29,7 @@ export interface LookupOverride {
29
29
  * Storage interface so accessors can write back without depending on Form.
30
30
  */
31
31
  export interface LookupOverrideStore {
32
+ _setLookupResolver(fieldName: string, resolve: NonNullable<LookupFieldMetadata["resolve"]>): void;
32
33
  _setLookupOverride(fieldName: string, override: LookupOverride): void;
33
34
  }
34
35
  /**
@@ -45,6 +46,8 @@ export declare class LookupAccessor<TInput extends Schema.Struct.Fields, K exten
45
46
  * Set the query for an independent lookup (no dependencies).
46
47
  */
47
48
  setQuery(query: (input: QueryInput, limit: number) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>): void;
49
+ /** Server-owned eligibility and label lookup, independent of search mode. */
50
+ setResolver(resolve: NonNullable<LookupFieldMetadata["resolve"]>): void;
48
51
  /**
49
52
  * Declare dependencies on other lookup fields, returning a builder
50
53
  * whose `setQuery` receives the dependency values as typed input.
@@ -1,3 +1,6 @@
1
+ import type { DocumentStoreService, EmailSender, NotificationDeliveryConfig } from "@processfocus/runtime";
2
+ import type { Layer } from "effect";
3
+ import type { HttpClient } from "effect/http";
1
4
  import type { BusinessCalendarConfig } from "../../../business-calendar/src/index.js";
2
5
  import type { DocumentStore } from "./document-store.js";
3
6
  import type { Form } from "./form.js";
@@ -17,7 +20,12 @@ export declare const validateTimeZone: (timeZone: string) => void;
17
20
  * The real organisation lives in the organisation package, and has
18
21
  * various helper methods to use it.
19
22
  */
23
+ type NotificationEmailLayer = Layer.Layer<EmailSender | NotificationDeliveryConfig, unknown, DocumentStoreService | HttpClient.HttpClient>;
20
24
  export interface OrganisationProps {
25
+ /** Platform branch or exact commit selected for a hosted deploy. */
26
+ readonly platformRef?: string | undefined;
27
+ /** Official repository for platformRef. Defaults to the private monorepo. */
28
+ readonly platformSource?: "private" | "public" | undefined;
21
29
  /**
22
30
  * Full name of organisation.
23
31
  */
@@ -45,6 +53,8 @@ export interface OrganisationProps {
45
53
  * Default when no calendar is specified: a 24/7 calendar.
46
54
  */
47
55
  readonly businessCalendar?: BusinessCalendarConfig | undefined;
56
+ /** The same notification layer used by the job worker, independent of other job services. */
57
+ readonly notificationEmailLayer?: (() => NotificationEmailLayer) | undefined;
48
58
  }
49
59
  /**
50
60
  * Represents the root organizational unit.
@@ -70,6 +80,8 @@ export declare class Organisation extends OrgUnitClass {
70
80
  * IANA timezone identifier (e.g., "Europe/Amsterdam", "America/New_York").
71
81
  */
72
82
  readonly timeZone: string;
83
+ readonly platformRef: string | undefined;
84
+ readonly platformSource: OrganisationProps["platformSource"];
73
85
  /**
74
86
  * BCP 47 locale used for organisation-authored date/time display.
75
87
  */
@@ -79,6 +91,7 @@ export declare class Organisation extends OrgUnitClass {
79
91
  * Defines working hours, holidays, and special periods.
80
92
  */
81
93
  readonly businessCalendar?: BusinessCalendarConfig | undefined;
94
+ readonly notificationEmailLayer: OrganisationProps["notificationEmailLayer"];
82
95
  constructor(props: OrganisationProps);
83
96
  /**
84
97
  * Find a step by its path relative to the organisation root.
@@ -164,3 +177,4 @@ export declare class Organisation extends OrgUnitClass {
164
177
  orphanElse: string[];
165
178
  }>;
166
179
  }
180
+ export {};
@@ -1,11 +1,11 @@
1
1
  import { Construct } from "constructs";
2
- import type { Schema } from "effect";
2
+ import { type Effect, type Schema } from "effect";
3
3
  import { MultiDirectedGraph as DirectedGraph } from "graphology";
4
4
  import type { DayOfMonth, TimeOfDay } from "../../../business-calendar/src/index.js";
5
5
  import type { FlattenFields } from "../../../form-submission-schema/src/index.js";
6
6
  import type { CamelCase, FlowContext, FormStepMeta, StepMeta } from "./flow-context.js";
7
7
  import { type FlowPath } from "./flow-path.js";
8
- import type { Form } from "./form.js";
8
+ import type { Form, FormSubmissionError } from "./form.js";
9
9
  import type { OrgUnit } from "./org-unit.js";
10
10
  import type { Role } from "./role.js";
11
11
  import type { ScheduledTime } from "./schedule.js";
@@ -43,6 +43,14 @@ export interface MonthlyProcessCron {
43
43
  readonly timeZone?: string | undefined;
44
44
  }
45
45
  export type ProcessCron = HourlyProcessCron | DailyProcessCron | WeeklyProcessCron | MonthlyProcessCron;
46
+ declare const ProcessActivationConflict_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
47
+ readonly _tag: "ProcessActivationConflict";
48
+ } & Readonly<A>;
49
+ export declare class ProcessActivationConflict extends ProcessActivationConflict_base<{
50
+ readonly executionId: string;
51
+ readonly message: string;
52
+ }> {
53
+ }
46
54
  export interface ProcessProps {
47
55
  /**
48
56
  * Name of process.
@@ -75,6 +83,17 @@ export interface ProcessProps {
75
83
  * Only supported for processes with exactly one system start step.
76
84
  */
77
85
  readonly cron?: ProcessCron;
86
+ /**
87
+ * Check domain admission after writing the active execution, before committing
88
+ * or dispatching work. Also check caller-supplied receipt replays before
89
+ * returning the receipt or recovering dispatch. This callback must only do
90
+ * transactional database work.
91
+ */
92
+ readonly validateActivation?: (input: {
93
+ readonly kind: "activation" | "receipt";
94
+ readonly executionId: string;
95
+ readonly state: Readonly<Record<string, unknown>>;
96
+ }) => Effect.Effect<void, FormSubmissionError | ProcessActivationConflict, unknown>;
78
97
  }
79
98
  /**
80
99
  * Condition function type for flow edges.
@@ -95,6 +114,8 @@ export type Condition<TState, TSteps extends Record<string, StepMeta> = Record<s
95
114
  */
96
115
  export type ScheduleFn<TState, TSteps extends Record<string, StepMeta> = Record<string, never>> = (state: TState, ctx: FlowContext<TSteps>) => ScheduledTime;
97
116
  export interface EdgeAttributes<TState> {
117
+ deadlineName?: string | undefined;
118
+ interrupting?: boolean | undefined;
98
119
  condition?: Condition<TState> | undefined;
99
120
  conditionText?: string | undefined;
100
121
  schedule?: ScheduleFn<TState, any> | undefined;
@@ -194,3 +215,4 @@ export declare class Process extends Construct implements IProcessHolder {
194
215
  path: string;
195
216
  }>;
196
217
  }
218
+ export {};
@@ -172,7 +172,7 @@ export declare const Schedule: {
172
172
  * @param duration - Duration to add (DurationInput accepts string like "1 hour")
173
173
  * @returns A ClockTimeSchedule marker resolved at execution time
174
174
  */
175
- clockTime(from: DateTime.DateTime, duration: Duration.DurationInput): ClockTimeSchedule;
175
+ clockTime(from: DateTime.DateTime, duration: Duration.Input): ClockTimeSchedule;
176
176
  /**
177
177
  * Create a from-point schedule marker.
178
178
  *