mlform 0.1.15 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{builtins-CcS-sHJa.js → builtins-STiTwaH9.js} +102 -107
- package/dist/mlform/builtins.mjs +2 -2
- package/dist/mlform/kit.mjs +251 -231
- package/dist/mlform/primitives.mjs +1 -1
- package/dist/mlform/runtime.mjs +3 -3
- package/dist/mlform/schema.mjs +2 -2
- package/dist/mlform/transport.mjs +1 -1
- package/dist/{primitives-9obTthA6.js → primitives-BcXt2QWI.js} +83 -53
- package/dist/{runtime-Bn_x46y-.js → runtime-Eo_q4pgg.js} +610 -506
- package/dist/schema-CNKKJZRx.js +173 -0
- package/dist/{transport-D173EDlB.js → transport-Cloa_erk.js} +204 -196
- package/dist/types/src/builtins/constants.d.ts +0 -4
- package/dist/types/src/builtins/definitions/fields/series-helpers.d.ts +1 -0
- package/dist/types/src/builtins/definitions/shared.d.ts +1 -1
- package/dist/types/src/kit/mount-types.d.ts +2 -0
- package/dist/types/src/kit/view-core-types.d.ts +4 -1
- package/dist/types/src/primitives/components/form-root-templates.d.ts +3 -1
- package/dist/types/src/primitives/components/form-root.d.ts +3 -1
- package/dist/types/src/primitives/components/report-frame.d.ts +2 -1
- package/dist/types/src/primitives/controller-types.d.ts +46 -2
- package/dist/types/src/primitives/types.d.ts +6 -2
- package/dist/types/src/runtime/index.d.ts +4 -2
- package/dist/types/src/runtime/submission/index.d.ts +2 -0
- package/dist/types/src/runtime/submission/multi-backend.d.ts +25 -0
- package/dist/types/src/runtime/submission/request.d.ts +14 -0
- package/dist/types/src/runtime/submission/snapshot.d.ts +12 -0
- package/dist/types/src/runtime/types/behavior.d.ts +4 -0
- package/dist/types/src/runtime/types/field.d.ts +1 -0
- package/dist/types/src/runtime/types/form.d.ts +4 -0
- package/dist/types/src/runtime/types/transport.d.ts +11 -2
- package/dist/types/src/schema/index.d.ts +2 -0
- package/dist/types/src/schema/mapped-to.d.ts +3 -2
- package/dist/types/src/schema/onehot-display.d.ts +15 -0
- package/dist/types/src/schema/report-context.d.ts +17 -0
- package/dist/types/src/schema/types/field.d.ts +1 -0
- package/dist/types/src/schema/types/report.d.ts +7 -2
- package/dist/types/src/schema/types/submit.d.ts +31 -1
- package/dist/types/src/transport/types/core.d.ts +19 -2
- package/package.json +2 -1
- package/dist/schema-DYDo_1VV.js +0 -95
|
@@ -2,10 +2,6 @@ export declare const builtinReportKinds: {
|
|
|
2
2
|
readonly classifier: "classifier";
|
|
3
3
|
readonly regressor: "regressor";
|
|
4
4
|
};
|
|
5
|
-
export declare const builtinLegacyOutputTypes: {
|
|
6
|
-
readonly classifier: "classifier";
|
|
7
|
-
readonly regressor: "regressor";
|
|
8
|
-
};
|
|
9
5
|
export declare const builtinFieldKinds: {
|
|
10
6
|
readonly text: "text";
|
|
11
7
|
readonly number: "number";
|
|
@@ -40,6 +40,7 @@ export declare const seriesFieldSchema: z.ZodObject<{
|
|
|
40
40
|
"reset-on-hide": "reset-on-hide";
|
|
41
41
|
}>>;
|
|
42
42
|
includeInSubmission: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
displayKey: z.ZodOptional<z.ZodString>;
|
|
43
44
|
mappedTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>]>>;
|
|
44
45
|
valuePath: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
45
46
|
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -22,6 +22,7 @@ export declare const baseFieldShape: {
|
|
|
22
22
|
"reset-on-hide": "reset-on-hide";
|
|
23
23
|
}>>;
|
|
24
24
|
includeInSubmission: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
displayKey: z.ZodOptional<z.ZodString>;
|
|
25
26
|
mappedTo: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>]>>;
|
|
26
27
|
valuePath: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
27
28
|
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -38,7 +39,6 @@ export declare const optionSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject
|
|
|
38
39
|
label: z.ZodString;
|
|
39
40
|
value: z.ZodString;
|
|
40
41
|
}, z.core.$strip>]>;
|
|
41
|
-
export declare const resolveLegacyOutput: (result: SubmitResult, kind: string) => unknown;
|
|
42
42
|
export declare const makeFieldDescriptor: (component: string, config: NormalizedFieldConfig, valueExtras: Record<string, unknown>) => {
|
|
43
43
|
component: string;
|
|
44
44
|
props: {
|
|
@@ -2,6 +2,7 @@ import { AttachedDesignSystem, DesignSystemConfig, DesignSystemRegistry, Resolve
|
|
|
2
2
|
import { FormController, FormHooks, FormSchema, FormValidator, InactiveFieldPolicy, Registry, RuntimeBehavior, Transport } from '../../runtime';
|
|
3
3
|
import { PrimitiveContainerStrategy, PrimitiveRegistry, PrimitiveReportTransport, PrimitiveTextOverrides, PrimitiveDescriptorRegistry } from '../../primitives';
|
|
4
4
|
import { FormLayoutConfig } from './layout-types';
|
|
5
|
+
export type MountedReportFetchMode = "lazy" | "all" | "none";
|
|
5
6
|
export interface KitDesignSystemSnapshot extends Omit<DesignSystemConfig, "mode" | "theme" | "recipe"> {
|
|
6
7
|
mode: NonNullable<DesignSystemConfig["mode"]>;
|
|
7
8
|
theme: NonNullable<DesignSystemConfig["theme"]>;
|
|
@@ -35,6 +36,7 @@ export interface MountFormOptions {
|
|
|
35
36
|
layout?: FormLayoutConfig;
|
|
36
37
|
containerStrategy?: PrimitiveContainerStrategy;
|
|
37
38
|
reportPane?: "auto" | "always" | "hidden";
|
|
39
|
+
reportFetchMode?: MountedReportFetchMode;
|
|
38
40
|
reportTransport?: PrimitiveReportTransport;
|
|
39
41
|
labels?: KitLabels;
|
|
40
42
|
primitiveText?: PrimitiveTextOverrides;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FieldDescriptor, PrimitiveDescriptorRegistry, ReportDescriptor } from '../../primitives';
|
|
2
|
-
import { FieldController, FieldStateSnapshot, FormController, FormHooks, FormSchema, FormState, FormValidationResult, FormValidator, InactiveFieldPolicy, Registry, ReportController, ReportStateSnapshot, RuntimeBehavior, SubmitOptions, SubmitResult, Transport } from '../../runtime';
|
|
2
|
+
import { FieldController, FieldStateSnapshot, FormController, FormHooks, FormSchema, FormState, FormValidationResult, FormValidator, InactiveFieldPolicy, Registry, ReportController, ReportStateSnapshot, RuntimeBehavior, PipelineResult, SubmitOptions, SubmitResult, Transport } from '../../runtime';
|
|
3
3
|
import { LayoutReferences } from './layout-utils';
|
|
4
4
|
import { FormLayoutConfig, ResolvedFormLayout, ResolvedFormLayoutNode } from './layout-types';
|
|
5
5
|
import { PanelState } from './panel-nav';
|
|
6
|
+
import { MountedReportFetchMode } from './mount-types';
|
|
6
7
|
export interface WizardState {
|
|
7
8
|
stepIndex: number;
|
|
8
9
|
stepCount: number;
|
|
@@ -77,6 +78,7 @@ export interface CreateFormViewOptions {
|
|
|
77
78
|
listenerErrorPolicy?: "ignore" | "throw-aggregate";
|
|
78
79
|
onListenerError?: (error: unknown) => void;
|
|
79
80
|
layout?: FormLayoutConfig;
|
|
81
|
+
reportFetchMode?: MountedReportFetchMode;
|
|
80
82
|
}
|
|
81
83
|
export interface FormViewController {
|
|
82
84
|
readonly form: FormController;
|
|
@@ -93,6 +95,7 @@ export interface FormViewController {
|
|
|
93
95
|
getLayoutReferences(): LayoutReferences;
|
|
94
96
|
validate(): Promise<FormValidationResult>;
|
|
95
97
|
submit(options?: SubmitOptions): Promise<SubmitResult>;
|
|
98
|
+
submitPipeline(options?: SubmitOptions): Promise<PipelineResult>;
|
|
96
99
|
reset(): void;
|
|
97
100
|
subscribe(listener: (snapshot: FormViewSnapshot) => void): () => void;
|
|
98
101
|
nextStep(): Promise<boolean>;
|
|
@@ -2,7 +2,7 @@ import { TemplateResult } from 'lit';
|
|
|
2
2
|
import { PrimitiveFormController } from '../controller-types';
|
|
3
3
|
import { PrimitiveDescriptorRegistry } from '../descriptors';
|
|
4
4
|
import { PrimitiveText } from '../constants';
|
|
5
|
-
import { PrimitiveRegistry, PrimitiveReportTransport } from '../types';
|
|
5
|
+
import { PrimitiveRegistry, PrimitiveReportFetchMode, PrimitiveReportTransport } from '../types';
|
|
6
6
|
import { FormRenderState } from './form-root-state';
|
|
7
7
|
import { PresentedField, PresentedReport } from './form-root-presenters';
|
|
8
8
|
export declare const renderStackedLayout: (options: {
|
|
@@ -20,6 +20,7 @@ export declare const renderStackedLayout: (options: {
|
|
|
20
20
|
validatingLabel: string;
|
|
21
21
|
submittingLabel: string;
|
|
22
22
|
reportTransport: PrimitiveReportTransport | undefined;
|
|
23
|
+
reportFetchMode: PrimitiveReportFetchMode;
|
|
23
24
|
onSubmitRequest: () => Promise<void>;
|
|
24
25
|
}) => TemplateResult;
|
|
25
26
|
export declare const renderSplitLayout: (options: {
|
|
@@ -37,5 +38,6 @@ export declare const renderSplitLayout: (options: {
|
|
|
37
38
|
validatingLabel: string;
|
|
38
39
|
submittingLabel: string;
|
|
39
40
|
reportTransport: PrimitiveReportTransport | undefined;
|
|
41
|
+
reportFetchMode: PrimitiveReportFetchMode;
|
|
40
42
|
onSubmitRequest: () => Promise<void>;
|
|
41
43
|
}) => TemplateResult;
|
|
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import { PrimitiveDescriptorRegistry } from '../descriptors';
|
|
3
3
|
import { PrimitiveFormController } from '../controller-types';
|
|
4
4
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
5
|
-
import { PrimitiveLayout, PrimitiveRegistry, PrimitiveReportTransport } from '../types';
|
|
5
|
+
import { PrimitiveLayout, PrimitiveRegistry, PrimitiveReportTransport, PrimitiveReportFetchMode, PrimitiveSubmitExecutionResult } from '../types';
|
|
6
6
|
export declare class PrimitiveFormElement extends LitElement {
|
|
7
7
|
#private;
|
|
8
8
|
static styles: import('lit').CSSResult;
|
|
@@ -18,6 +18,8 @@ export declare class PrimitiveFormElement extends LitElement {
|
|
|
18
18
|
accessor reportPane: "auto" | "always" | "hidden";
|
|
19
19
|
accessor text: PrimitiveText;
|
|
20
20
|
accessor reportTransport: PrimitiveReportTransport | undefined;
|
|
21
|
+
accessor reportFetchMode: PrimitiveReportFetchMode;
|
|
22
|
+
accessor submitHandler: (() => Promise<PrimitiveSubmitExecutionResult>) | undefined;
|
|
21
23
|
private accessor formState;
|
|
22
24
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
23
25
|
connectedCallback(): void;
|
|
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import { PrimitiveReportController, PrimitiveSubmitResult } from '../controller-types';
|
|
3
3
|
import { ReportDescriptor } from '../descriptors';
|
|
4
4
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
5
|
-
import { PrimitiveReportTransport, PrimitiveRegistry } from '../types';
|
|
5
|
+
import { PrimitiveReportFetchMode, PrimitiveReportTransport, PrimitiveRegistry } from '../types';
|
|
6
6
|
export declare class PrimitiveReportFrameElement extends LitElement {
|
|
7
7
|
#private;
|
|
8
8
|
static styles: import('lit').CSSResult;
|
|
@@ -10,6 +10,7 @@ export declare class PrimitiveReportFrameElement extends LitElement {
|
|
|
10
10
|
accessor registry: PrimitiveRegistry | undefined;
|
|
11
11
|
accessor text: PrimitiveText;
|
|
12
12
|
accessor transport: PrimitiveReportTransport | undefined;
|
|
13
|
+
accessor fetchMode: PrimitiveReportFetchMode;
|
|
13
14
|
accessor lastResult: PrimitiveSubmitResult | null;
|
|
14
15
|
accessor descriptor: ReportDescriptor | null;
|
|
15
16
|
private accessor resolvedDescriptor;
|
|
@@ -18,15 +18,50 @@ export interface PrimitiveReportStateSnapshot {
|
|
|
18
18
|
}
|
|
19
19
|
export interface PrimitiveSubmitResult {
|
|
20
20
|
backend?: string;
|
|
21
|
+
inputs?: PrimitiveSubmissionInputRecord[];
|
|
22
|
+
displayValues?: Record<string, unknown>;
|
|
23
|
+
modelValues?: Record<string, unknown>;
|
|
21
24
|
values: Record<string, unknown>;
|
|
22
25
|
fieldValues: Record<string, unknown>;
|
|
23
26
|
serializedValues: Record<string, unknown>;
|
|
24
27
|
serializedFieldValues: Record<string, unknown>;
|
|
25
|
-
reports:
|
|
28
|
+
reports: readonly unknown[];
|
|
29
|
+
reportContexts?: Record<string, PrimitiveReportContext>;
|
|
26
30
|
reportStates: Record<string, unknown>;
|
|
27
31
|
meta: Record<string, unknown>;
|
|
28
32
|
raw: unknown;
|
|
29
33
|
}
|
|
34
|
+
export interface PrimitivePipelineResult {
|
|
35
|
+
submitResult: PrimitiveSubmitResult;
|
|
36
|
+
reportFetchResults: Record<string, unknown>;
|
|
37
|
+
reportFetchErrors: Record<string, string>;
|
|
38
|
+
artifacts: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export interface PrimitiveSubmissionInputRecord {
|
|
41
|
+
fieldId: string;
|
|
42
|
+
displayKey?: string;
|
|
43
|
+
label: string;
|
|
44
|
+
value: unknown;
|
|
45
|
+
serializedValue: unknown;
|
|
46
|
+
mappedTo?: string | number;
|
|
47
|
+
modelValues: Record<string, unknown>;
|
|
48
|
+
visible: boolean;
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface PrimitiveReportContext {
|
|
52
|
+
reportId: string;
|
|
53
|
+
kind: string;
|
|
54
|
+
label?: string;
|
|
55
|
+
mappedTo?: unknown;
|
|
56
|
+
target?: string | number;
|
|
57
|
+
targetKey?: string;
|
|
58
|
+
backend?: string;
|
|
59
|
+
displayValues: Record<string, unknown>;
|
|
60
|
+
modelValues: Record<string, unknown>;
|
|
61
|
+
reports: readonly unknown[];
|
|
62
|
+
meta: Record<string, unknown>;
|
|
63
|
+
raw: unknown;
|
|
64
|
+
}
|
|
30
65
|
export interface PrimitiveFormState {
|
|
31
66
|
status: PrimitiveFormStatus;
|
|
32
67
|
submitCount: number;
|
|
@@ -78,14 +113,23 @@ export interface PrimitiveFormController {
|
|
|
78
113
|
equality?: (left: T, right: T) => boolean;
|
|
79
114
|
}): () => void;
|
|
80
115
|
}
|
|
116
|
+
export interface PrimitiveSubmitExecutionResult {
|
|
117
|
+
result: PrimitiveSubmitResult;
|
|
118
|
+
pipelineResult?: PrimitivePipelineResult;
|
|
119
|
+
}
|
|
81
120
|
export interface PrimitiveReportRequest {
|
|
82
121
|
reportId: string;
|
|
83
122
|
backend?: string;
|
|
123
|
+
inputs?: PrimitiveSubmissionInputRecord[];
|
|
124
|
+
displayValues?: Record<string, unknown>;
|
|
125
|
+
modelValues?: Record<string, unknown>;
|
|
84
126
|
values: Record<string, unknown>;
|
|
85
127
|
fieldValues: Record<string, unknown>;
|
|
86
128
|
serializedValues: Record<string, unknown>;
|
|
87
129
|
serializedFieldValues: Record<string, unknown>;
|
|
88
|
-
reports:
|
|
130
|
+
reports: readonly unknown[];
|
|
131
|
+
reportContext?: PrimitiveReportContext;
|
|
132
|
+
reportContexts?: Record<string, PrimitiveReportContext>;
|
|
89
133
|
meta: Record<string, unknown>;
|
|
90
134
|
raw: unknown;
|
|
91
135
|
signal?: AbortSignal;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { PrimitiveFieldController, PrimitiveFormController, PrimitiveFormStatus, PrimitiveReportRequest, PrimitiveReportController, PrimitiveSubmitResult, PrimitiveFormState } from './controller-types';
|
|
1
|
+
import { PrimitiveFieldController, PrimitiveFormController, PrimitiveFormStatus, PrimitivePipelineResult, PrimitiveReportRequest, PrimitiveReportController, PrimitiveSubmitResult, PrimitiveSubmitExecutionResult, PrimitiveFormState } from './controller-types';
|
|
2
2
|
import { PrimitiveText, PrimitiveTextOverrides } from './constants';
|
|
3
3
|
import { FieldDescriptor, PrimitiveDescriptorRegistry, ReportDescriptor } from './descriptors';
|
|
4
4
|
export type PrimitiveLayout = "stacked" | "split";
|
|
5
5
|
export type PrimitiveContainerStrategy = "error" | "replace";
|
|
6
|
-
export type
|
|
6
|
+
export type PrimitiveReportFetchMode = "lazy" | "all" | "none";
|
|
7
|
+
export type { PrimitivePipelineResult, PrimitiveReportRequest, PrimitiveSubmitExecutionResult };
|
|
7
8
|
export interface PrimitiveRegistry {
|
|
8
9
|
registerField(component: string, tagName: string): PrimitiveRegistry;
|
|
9
10
|
unregisterField(component: string): PrimitiveRegistry;
|
|
@@ -35,6 +36,8 @@ export interface MountFormOptions {
|
|
|
35
36
|
text?: PrimitiveTextOverrides;
|
|
36
37
|
/** Optional transport for report renderers that fetch extra data after submit. */
|
|
37
38
|
reportTransport?: PrimitiveReportTransport;
|
|
39
|
+
reportFetchMode?: PrimitiveReportFetchMode;
|
|
40
|
+
submitHandler?: () => Promise<PrimitiveSubmitExecutionResult>;
|
|
38
41
|
}
|
|
39
42
|
export interface MountedForm {
|
|
40
43
|
readonly form: PrimitiveFormController;
|
|
@@ -84,6 +87,7 @@ export interface PrimitiveSubmitSuccessDetail {
|
|
|
84
87
|
form: PrimitiveFormController;
|
|
85
88
|
state: PrimitiveFormState;
|
|
86
89
|
result: PrimitiveSubmitResult;
|
|
90
|
+
pipelineResult?: PrimitivePipelineResult;
|
|
87
91
|
}
|
|
88
92
|
export interface PrimitiveSubmitErrorDetail {
|
|
89
93
|
form: PrimitiveFormController;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { executeFormPipeline, executeReportFetches } from './submission';
|
|
1
|
+
export { createSubmissionSnapshot, executeFormPipeline, executeReportFetches } from './submission';
|
|
2
|
+
export { createMultiBackendSubmissionSnapshot, executeMultiBackendPipeline } from './submission';
|
|
3
|
+
export type { CreateMultiBackendSubmissionSnapshotOptions, CreateSubmissionSnapshotOptions, ExecuteMultiBackendPipelineOptions, MultiBackendPipelineResult, MultiBackendRunResult, MultiBackendSubmit, SubmissionSnapshot, } from './submission';
|
|
2
4
|
export { EngineError, ReportPayloadError, RegistryError, SubmissionAbortedError, SubmitError, TransportError, transportErrorCodes, ValidationError, } from './errors';
|
|
3
5
|
export type { TransportErrorCode } from './errors';
|
|
4
6
|
export { createForm, createForm as createFormRuntime } from './form';
|
|
5
7
|
export { defaultEquality, shallowArrayEquality, shallowEquality, shallowObjectEquality, } from './equality';
|
|
6
8
|
export { identity, isPromiseLike } from './utils';
|
|
7
|
-
export type { AllConditions, AfterSubmitContext, AfterValidateContext, AnyConditions, BaseFieldConfig, BaseReportConfig, BeforeSubmitContext, BeforeValidateContext, CreateFormConfig, DeclarativeFieldCondition, AfterReportFetchContext, FieldValidationFnContext, FieldValueAdapter, FieldConfig, FieldComparisonCondition, FieldCondition, FieldConditionContext, FieldController, FieldDefinition, FieldStateSnapshot, FieldStatus, FieldValueCondition, FieldValidationContext, FieldValidationResult, FormController, FormHooks, FormSchema, FormState, FormStatusCondition, FormStatus, FormValidator, FormValidationContext, FormValidationIssue, FormValidationResult, InactiveFieldPolicy, MaybePromise, NormalizedFieldConfig, NormalizedReportConfig, Registry, ReportConfig, ReportController, ReportDefinition, ReportFetchContext, ReportFetchErrorContext, ReportFetchExecutionContext, ReportFetchExecutionResult, ReportFetchFactory, ReportFetchRequest, ReportFetchStatus, ReportFetchTransport, ReportResolveContext, ReportStateSnapshot, ReportStatus, PipelineArtifactAdapter, PipelineArtifactContext, PipelineResult, ExecuteFormPipelineOptions, SelectorSubscriptionOptions, SubmitCountCondition, SubmitErrorContext, SubmitOptions, SubmitRequest, SubmitRequestTransportContext, SubmitResult, Transport, TransportAuthKind, TransportBackpressureMode, TransportCapabilities, TransportConsistency, TransportDeliveryMode, TransportPolicyContext, TransportSession, TransportSessionEvent, TransportSessionMessage, TransportStreamEvent, TransportResponse, NotCondition, RuntimeBehavior, RuntimeBehaviorContext, RuntimeBehaviorSubmissionRecords, RuntimeBehaviorValueChangeEvent, } from './types';
|
|
9
|
+
export type { AllConditions, AfterSubmitContext, AfterValidateContext, AnyConditions, BaseFieldConfig, BaseReportConfig, BeforeSubmitContext, BeforeValidateContext, CreateFormConfig, DeclarativeFieldCondition, AfterReportFetchContext, FieldValidationFnContext, FieldValueAdapter, FieldConfig, FieldComparisonCondition, FieldCondition, FieldConditionContext, FieldController, FieldDefinition, FieldStateSnapshot, FieldStatus, FieldValueCondition, FieldValidationContext, FieldValidationResult, FormController, FormHooks, FormSchema, FormState, FormStatusCondition, FormStatus, FormValidator, FormValidationContext, FormValidationIssue, FormValidationResult, InactiveFieldPolicy, MaybePromise, NormalizedFieldConfig, NormalizedReportConfig, Registry, ReportConfig, ReportController, ReportDefinition, ReportFetchContext, ReportFetchErrorContext, ReportFetchExecutionContext, ReportFetchExecutionResult, ReportFetchFactory, ReportFetchRequest, ReportFetchStatus, ReportFetchTransport, ReportResolveContext, ReportStateSnapshot, ReportStatus, PipelineArtifactAdapter, PipelineArtifactContext, PipelineResult, ExecuteFormPipelineOptions, SelectorSubscriptionOptions, SubmitCountCondition, SubmitErrorContext, SubmitOptions, SubmitRequest, SubmitRequestTransportContext, SubmitResult, SubmissionInputRecord, Transport, TransportAuthKind, TransportBackpressureMode, TransportCapabilities, TransportConsistency, TransportDeliveryMode, TransportPolicyContext, TransportSession, TransportSessionEvent, TransportSessionMessage, TransportStreamEvent, TransportResponse, NotCondition, RuntimeBehavior, RuntimeBehaviorContext, RuntimeBehaviorSubmissionRecords, RuntimeBehaviorValueChangeEvent, } from './types';
|
|
8
10
|
export type FieldHandle = import('./types').FieldController;
|
|
9
11
|
export type ReportHandle = import('./types').ReportController;
|
|
10
12
|
export type FormRuntime = import('./types').FormController;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FormController, SubmitResult } from '../types';
|
|
2
|
+
import { SubmissionSnapshot } from './snapshot';
|
|
3
|
+
export interface MultiBackendSubmit {
|
|
4
|
+
backend: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
export interface MultiBackendRunResult {
|
|
8
|
+
backend: string;
|
|
9
|
+
snapshot: SubmissionSnapshot;
|
|
10
|
+
submitResult?: SubmitResult;
|
|
11
|
+
reportFetchResults: Record<string, unknown>;
|
|
12
|
+
reportFetchErrors: Record<string, string>;
|
|
13
|
+
skippedReportIds: string[];
|
|
14
|
+
error?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface ExecuteMultiBackendPipelineOptions {
|
|
17
|
+
form: FormController;
|
|
18
|
+
backends: readonly (string | MultiBackendSubmit)[];
|
|
19
|
+
reportFetchMode?: "none" | "all";
|
|
20
|
+
continueOnError?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface MultiBackendPipelineResult {
|
|
23
|
+
runs: Record<string, MultiBackendRunResult>;
|
|
24
|
+
}
|
|
25
|
+
export declare const executeMultiBackendPipeline: ({ form, backends, reportFetchMode, continueOnError, }: ExecuteMultiBackendPipelineOptions) => Promise<MultiBackendPipelineResult>;
|
|
@@ -9,7 +9,21 @@ type SubmissionField = {
|
|
|
9
9
|
};
|
|
10
10
|
serialize(): unknown;
|
|
11
11
|
};
|
|
12
|
+
export type SubmissionInputRecord = {
|
|
13
|
+
fieldId: string;
|
|
14
|
+
displayKey?: string;
|
|
15
|
+
label: string;
|
|
16
|
+
value: unknown;
|
|
17
|
+
serializedValue: unknown;
|
|
18
|
+
mappedTo?: string | number;
|
|
19
|
+
modelValues: Record<string, unknown>;
|
|
20
|
+
visible: boolean;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
};
|
|
12
23
|
export type SubmissionValueRecords = {
|
|
24
|
+
inputs: SubmissionInputRecord[];
|
|
25
|
+
displayValues: Record<string, unknown>;
|
|
26
|
+
modelValues: Record<string, unknown>;
|
|
13
27
|
values: Record<string, unknown>;
|
|
14
28
|
fieldValues: Record<string, unknown>;
|
|
15
29
|
serializedValues: Record<string, unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormController, InactiveFieldPolicy } from '../types';
|
|
2
|
+
import { SubmissionValueRecords } from './request';
|
|
3
|
+
export interface CreateSubmissionSnapshotOptions {
|
|
4
|
+
backend?: string;
|
|
5
|
+
inactiveFieldPolicy?: InactiveFieldPolicy;
|
|
6
|
+
}
|
|
7
|
+
export type SubmissionSnapshot = SubmissionValueRecords;
|
|
8
|
+
export declare const createSubmissionSnapshot: (form: Pick<FormController, "fields">, options?: CreateSubmissionSnapshotOptions) => SubmissionSnapshot;
|
|
9
|
+
export interface CreateMultiBackendSubmissionSnapshotOptions extends Omit<CreateSubmissionSnapshotOptions, "backend"> {
|
|
10
|
+
backends: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const createMultiBackendSubmissionSnapshot: (form: Pick<FormController, "fields">, options: CreateMultiBackendSubmissionSnapshotOptions) => Record<string, SubmissionSnapshot>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Registry } from '../../../schema';
|
|
2
|
+
import { SubmissionInputRecord } from '../../../transport';
|
|
2
3
|
import { FieldHandle } from './field';
|
|
3
4
|
import { FormStatus } from './form';
|
|
4
5
|
type MaybePromise<T> = T | PromiseLike<T>;
|
|
@@ -8,6 +9,9 @@ export interface RuntimeBehaviorValueChangeEvent {
|
|
|
8
9
|
values: Record<string, unknown>;
|
|
9
10
|
}
|
|
10
11
|
export interface RuntimeBehaviorSubmissionRecords {
|
|
12
|
+
inputs: SubmissionInputRecord[];
|
|
13
|
+
displayValues: Record<string, unknown>;
|
|
14
|
+
modelValues: Record<string, unknown>;
|
|
11
15
|
values: Record<string, unknown>;
|
|
12
16
|
fieldValues: Record<string, unknown>;
|
|
13
17
|
serializedValues: Record<string, unknown>;
|
|
@@ -100,6 +100,10 @@ export interface FormController {
|
|
|
100
100
|
readonly reports: readonly ReportController[];
|
|
101
101
|
readonly state: FormState;
|
|
102
102
|
getField(id: string): FieldController | undefined;
|
|
103
|
+
getFieldByDisplayKey(displayKey: string): FieldController | undefined;
|
|
104
|
+
getFieldByMappedTo(target: string | number, options?: {
|
|
105
|
+
backend?: string;
|
|
106
|
+
}): FieldController | undefined;
|
|
103
107
|
getReport(id: string): ReportController | undefined;
|
|
104
108
|
getValues(): Record<string, unknown>;
|
|
105
109
|
setValues(values: Record<string, unknown>): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SubmitRequest as BaseSubmitRequest, Transport as BaseTransport, TransportStreamEvent as BaseTransportStreamEvent } from '../../../transport';
|
|
1
|
+
import { SubmitRequest as BaseSubmitRequest, Transport as BaseTransport, SubmissionInputRecord, TransportStreamEvent as BaseTransportStreamEvent } from '../../../transport';
|
|
2
2
|
import { SubmitResult as SchemaSubmitResult } from '../../../schema';
|
|
3
3
|
import { NormalizedFieldConfig } from './field';
|
|
4
4
|
import { NormalizedReportConfig, ReportStateSnapshot } from './report';
|
|
5
|
-
export type { CapabilityRequirement, CircuitBreakerSharedState, CircuitBreakerStateSnapshot, RateLimitLeaseRequest, SharedRateLimiter, SharedRateLimiterLease, SubmitRequestMetadata, SubmitRequestTransportContext, TransportAuthKind, TransportBackpressureMode, TransportCacheEntry, TransportCacheStore, TransportCapabilities, TransportCollection, TransportConsistency, TransportDeliveryMode, TransportHealthSnapshot, TransportHealthState, TransportPolicyContext, TransportResponse, TransportSession, TransportSessionCloseEvent, TransportSessionErrorEvent, TransportSessionEvent, TransportSessionMessage, TransportSessionMessageEvent, TransportSessionMetaEvent, TransportSessionProgressEvent, TransportSessionResultEvent, TransportStreamChunkEvent, TransportStreamErrorEvent, TransportStreamMetaEvent, TransportStreamProgressEvent, TransportStreamReportPatchEvent, TransportStreamReportReplaceEvent, } from '../../../transport';
|
|
5
|
+
export type { CapabilityRequirement, CircuitBreakerSharedState, CircuitBreakerStateSnapshot, RateLimitLeaseRequest, SharedRateLimiter, SharedRateLimiterLease, SubmissionInputRecord, SubmitRequestMetadata, SubmitRequestTransportContext, TransportAuthKind, TransportBackpressureMode, TransportCacheEntry, TransportCacheStore, TransportCapabilities, TransportCollection, TransportConsistency, TransportDeliveryMode, TransportHealthSnapshot, TransportHealthState, TransportPolicyContext, TransportResponse, TransportSession, TransportSessionCloseEvent, TransportSessionErrorEvent, TransportSessionEvent, TransportSessionMessage, TransportSessionMessageEvent, TransportSessionMetaEvent, TransportSessionProgressEvent, TransportSessionResultEvent, TransportStreamChunkEvent, TransportStreamErrorEvent, TransportStreamMetaEvent, TransportStreamProgressEvent, TransportStreamReportPatchEvent, TransportStreamReportReplaceEvent, } from '../../../transport';
|
|
6
6
|
export type SubmitRequest = BaseSubmitRequest<NormalizedFieldConfig, NormalizedReportConfig>;
|
|
7
7
|
export type SubmitResult = SchemaSubmitResult<ReportStateSnapshot>;
|
|
8
8
|
export type Transport = BaseTransport<NormalizedFieldConfig, NormalizedReportConfig>;
|
|
@@ -13,6 +13,9 @@ export interface SubmitOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export interface BeforeSubmitContext {
|
|
15
15
|
backend?: string;
|
|
16
|
+
inputs: SubmissionInputRecord[];
|
|
17
|
+
displayValues: Record<string, unknown>;
|
|
18
|
+
modelValues: Record<string, unknown>;
|
|
16
19
|
values: Record<string, unknown>;
|
|
17
20
|
fieldValues: Record<string, unknown>;
|
|
18
21
|
serializedValues: Record<string, unknown>;
|
|
@@ -22,6 +25,9 @@ export interface BeforeSubmitContext {
|
|
|
22
25
|
}
|
|
23
26
|
export interface AfterSubmitContext {
|
|
24
27
|
backend?: string;
|
|
28
|
+
inputs: SubmissionInputRecord[];
|
|
29
|
+
displayValues: Record<string, unknown>;
|
|
30
|
+
modelValues: Record<string, unknown>;
|
|
25
31
|
values: Record<string, unknown>;
|
|
26
32
|
fieldValues: Record<string, unknown>;
|
|
27
33
|
serializedValues: Record<string, unknown>;
|
|
@@ -31,6 +37,9 @@ export interface AfterSubmitContext {
|
|
|
31
37
|
}
|
|
32
38
|
export interface SubmitErrorContext {
|
|
33
39
|
backend?: string;
|
|
40
|
+
inputs: SubmissionInputRecord[];
|
|
41
|
+
displayValues: Record<string, unknown>;
|
|
42
|
+
modelValues: Record<string, unknown>;
|
|
34
43
|
values: Record<string, unknown>;
|
|
35
44
|
fieldValues: Record<string, unknown>;
|
|
36
45
|
serializedValues: Record<string, unknown>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { normalizeSchemaId } from './ids';
|
|
2
2
|
export * from './mapped-to';
|
|
3
3
|
export * from './normalize';
|
|
4
|
+
export * from './onehot-display';
|
|
5
|
+
export * from './report-context';
|
|
4
6
|
export { createReportFetchRequest } from './report-fetch-request';
|
|
5
7
|
export * from './registry';
|
|
6
8
|
export type * from './types/field';
|
|
@@ -2,10 +2,11 @@ export type MappedToTarget = string | number;
|
|
|
2
2
|
export type MappedTo = MappedToTarget | Record<string, MappedToTarget | null | undefined>;
|
|
3
3
|
export declare const resolveMappedTo: (mappedTo: MappedTo | undefined, backend: string | undefined) => MappedToTarget | undefined;
|
|
4
4
|
export declare const mappedToKey: (target: MappedToTarget) => string;
|
|
5
|
+
export declare const resolveMappedTargets: (mappedTo: MappedTo | undefined, backend: string | undefined) => MappedToTarget[];
|
|
5
6
|
export declare const resolveMappedReportPayload: (report: {
|
|
7
|
+
id?: string;
|
|
6
8
|
mappedTo?: MappedTo;
|
|
7
9
|
}, result: {
|
|
8
10
|
backend?: string;
|
|
9
|
-
reports:
|
|
10
|
-
raw: unknown;
|
|
11
|
+
reports: readonly unknown[];
|
|
11
12
|
}) => unknown;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MappedTo } from './mapped-to';
|
|
2
|
+
export type OneHotDisplayOption = {
|
|
3
|
+
label?: string;
|
|
4
|
+
value: string;
|
|
5
|
+
mappedTo?: MappedTo;
|
|
6
|
+
};
|
|
7
|
+
export type OneHotDisplayField = {
|
|
8
|
+
id?: string;
|
|
9
|
+
kind?: string;
|
|
10
|
+
options?: readonly OneHotDisplayOption[];
|
|
11
|
+
};
|
|
12
|
+
export interface ResolveOneHotDisplayValueOptions {
|
|
13
|
+
backend?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const resolveOneHotDisplayValue: (field: OneHotDisplayField, modelValues: Record<string, unknown>, options?: ResolveOneHotDisplayValueOptions) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MappedTo } from './mapped-to';
|
|
2
|
+
import { NormalizedReportConfig } from './types/report';
|
|
3
|
+
import { ReportContext, SubmitResult } from './types/submit';
|
|
4
|
+
type ReportContextSource = Pick<SubmitResult, "backend"> & {
|
|
5
|
+
reportContexts?: Record<string, ReportContext>;
|
|
6
|
+
};
|
|
7
|
+
type ReportContextLookup = string | number | {
|
|
8
|
+
id?: string;
|
|
9
|
+
mappedTo?: MappedTo;
|
|
10
|
+
config?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
mappedTo?: MappedTo;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const createReportContexts: (reports: readonly NormalizedReportConfig[], result: Pick<SubmitResult, "backend" | "displayValues" | "modelValues" | "serializedValues" | "reports" | "meta" | "raw">) => Record<string, ReportContext>;
|
|
16
|
+
export declare const getReportContext: (source: ReportContextSource, lookup: ReportContextLookup) => ReportContext | undefined;
|
|
17
|
+
export {};
|
|
@@ -20,6 +20,7 @@ export interface BaseFieldConfig {
|
|
|
20
20
|
asyncValidationDebounceMs?: number;
|
|
21
21
|
inactiveFieldPolicy?: InactiveFieldPolicy;
|
|
22
22
|
includeInSubmission?: boolean;
|
|
23
|
+
displayKey?: string;
|
|
23
24
|
mappedTo?: MappedTo;
|
|
24
25
|
valuePath?: string | string[];
|
|
25
26
|
defaultValue?: unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZodType } from 'zod';
|
|
2
2
|
import { MaybePromise } from './field';
|
|
3
3
|
import { MappedTo } from '../mapped-to';
|
|
4
|
-
import { SubmitResult } from './submit';
|
|
4
|
+
import { ReportContext, SubmitResult, SubmissionInputRecord } from './submit';
|
|
5
5
|
export type ReportStatus = "idle" | "loading" | "ready" | "error";
|
|
6
6
|
export type ReportFetchStatus = ReportStatus;
|
|
7
7
|
export type ReportPayloadValidationPolicy = "report-error" | "fail-submit";
|
|
@@ -36,11 +36,16 @@ export interface ReportResolveContext<TConfig extends ReportConfig = ReportConfi
|
|
|
36
36
|
export interface ReportFetchRequest {
|
|
37
37
|
reportId: string;
|
|
38
38
|
backend?: string;
|
|
39
|
+
inputs?: SubmissionInputRecord[];
|
|
40
|
+
displayValues?: Record<string, unknown>;
|
|
41
|
+
modelValues?: Record<string, unknown>;
|
|
39
42
|
values: Record<string, unknown>;
|
|
40
43
|
fieldValues: Record<string, unknown>;
|
|
41
44
|
serializedValues: Record<string, unknown>;
|
|
42
45
|
serializedFieldValues: Record<string, unknown>;
|
|
43
|
-
reports:
|
|
46
|
+
reports: readonly unknown[];
|
|
47
|
+
reportContext?: ReportContext;
|
|
48
|
+
reportContexts?: Record<string, ReportContext>;
|
|
44
49
|
meta: Record<string, unknown>;
|
|
45
50
|
raw: unknown;
|
|
46
51
|
signal?: AbortSignal;
|
|
@@ -1,10 +1,40 @@
|
|
|
1
|
+
import { MappedTo } from '../mapped-to';
|
|
2
|
+
export interface SubmissionInputRecord {
|
|
3
|
+
fieldId: string;
|
|
4
|
+
displayKey?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: unknown;
|
|
7
|
+
serializedValue: unknown;
|
|
8
|
+
mappedTo?: string | number;
|
|
9
|
+
modelValues: Record<string, unknown>;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ReportContext {
|
|
14
|
+
reportId: string;
|
|
15
|
+
kind: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
mappedTo?: MappedTo;
|
|
18
|
+
target?: string | number;
|
|
19
|
+
targetKey?: string;
|
|
20
|
+
backend?: string;
|
|
21
|
+
displayValues: Record<string, unknown>;
|
|
22
|
+
modelValues: Record<string, unknown>;
|
|
23
|
+
reports: readonly unknown[];
|
|
24
|
+
meta: Record<string, unknown>;
|
|
25
|
+
raw: unknown;
|
|
26
|
+
}
|
|
1
27
|
export interface SubmitResult<TReportState = unknown> {
|
|
2
28
|
backend?: string;
|
|
29
|
+
inputs?: SubmissionInputRecord[];
|
|
30
|
+
displayValues?: Record<string, unknown>;
|
|
31
|
+
modelValues?: Record<string, unknown>;
|
|
3
32
|
values: Record<string, unknown>;
|
|
4
33
|
fieldValues: Record<string, unknown>;
|
|
5
34
|
serializedValues: Record<string, unknown>;
|
|
6
35
|
serializedFieldValues: Record<string, unknown>;
|
|
7
|
-
reports:
|
|
36
|
+
reports: readonly unknown[];
|
|
37
|
+
reportContexts?: Record<string, ReportContext>;
|
|
8
38
|
reportStates: Record<string, TReportState>;
|
|
9
39
|
meta: Record<string, unknown>;
|
|
10
40
|
raw: unknown;
|
|
@@ -17,8 +17,22 @@ export interface SubmitRequestTransportContext {
|
|
|
17
17
|
export interface SubmitRequestMetadata {
|
|
18
18
|
estimatedPayloadBytes?: number;
|
|
19
19
|
}
|
|
20
|
+
export interface SubmissionInputRecord {
|
|
21
|
+
fieldId: string;
|
|
22
|
+
displayKey?: string;
|
|
23
|
+
label: string;
|
|
24
|
+
value: unknown;
|
|
25
|
+
serializedValue: unknown;
|
|
26
|
+
mappedTo?: string | number;
|
|
27
|
+
modelValues: Record<string, unknown>;
|
|
28
|
+
visible: boolean;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
}
|
|
20
31
|
export interface SubmitRequest<TField extends Record<string, unknown> = Record<string, unknown>, TReport extends Record<string, unknown> = Record<string, unknown>> {
|
|
21
32
|
backend?: string;
|
|
33
|
+
inputs?: SubmissionInputRecord[];
|
|
34
|
+
displayValues?: Record<string, unknown>;
|
|
35
|
+
modelValues?: Record<string, unknown>;
|
|
22
36
|
values: Record<string, unknown>;
|
|
23
37
|
fieldValues: Record<string, unknown>;
|
|
24
38
|
serializedValues: Record<string, unknown>;
|
|
@@ -30,17 +44,20 @@ export interface SubmitRequest<TField extends Record<string, unknown> = Record<s
|
|
|
30
44
|
signal?: AbortSignal;
|
|
31
45
|
}
|
|
32
46
|
export interface TransportResponse {
|
|
33
|
-
reports?:
|
|
47
|
+
reports?: readonly unknown[];
|
|
34
48
|
meta?: Record<string, unknown>;
|
|
35
49
|
raw?: unknown;
|
|
36
50
|
}
|
|
37
51
|
export interface SubmitResult<TReportState extends Record<string, unknown> = Record<string, unknown>> {
|
|
38
52
|
backend?: string;
|
|
53
|
+
inputs?: SubmissionInputRecord[];
|
|
54
|
+
displayValues?: Record<string, unknown>;
|
|
55
|
+
modelValues?: Record<string, unknown>;
|
|
39
56
|
values: Record<string, unknown>;
|
|
40
57
|
fieldValues: Record<string, unknown>;
|
|
41
58
|
serializedValues: Record<string, unknown>;
|
|
42
59
|
serializedFieldValues: Record<string, unknown>;
|
|
43
|
-
reports:
|
|
60
|
+
reports: readonly unknown[];
|
|
44
61
|
reportStates: Record<string, TReportState>;
|
|
45
62
|
meta: Record<string, unknown>;
|
|
46
63
|
raw: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlform",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Composable form generation utilities for machine learning backend integration",
|
|
6
6
|
"keywords": [
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@types/node": "^25.9.3",
|
|
93
93
|
"jsdom": "^29.1.1",
|
|
94
|
+
"playwright": "^1.61.0",
|
|
94
95
|
"typescript": "~6.0.3",
|
|
95
96
|
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
96
97
|
"vite-plugin-dts": "^5.0.2",
|