@collective-intelligence/extensions-sdk-frontend-react 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -2
- package/dist/dashboard.d.ts +1 -0
- package/dist/dashboard.js +0 -0
- package/dist/frontend/diagnostics.d.ts +30 -0
- package/dist/frontend/index.d.ts +27 -0
- package/dist/frontend/index.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/load-state.d.ts +42 -0
- package/dist/runtime/sort-values.d.ts +1 -0
- package/dist/runtime/type-guards.d.ts +10 -0
- package/dist/studio-declarations.d.ts +71 -0
- package/dist/studio.d.ts +4 -0
- package/dist/studio.js +1 -0
- package/dist/ui-react.d.ts +1 -0
- package/dist/ui-react.js +0 -0
- package/dist/workflow.d.ts +1 -0
- package/dist/workflow.js +1 -0
- package/dist/workflows/catalog.d.ts +39 -0
- package/dist/workflows/contracts.d.ts +358 -0
- package/dist/workflows/default-template-ui/actions/catalog-node-chart-block.d.ts +7 -0
- package/dist/workflows/default-template-ui/actions/catalog-node-details-editor.d.ts +4 -0
- package/dist/workflows/default-template-ui/actions/catalog-text.d.ts +4 -0
- package/dist/workflows/default-template-ui/actions/translations.d.ts +3 -0
- package/dist/workflows/default-template-ui/declarations.d.ts +33 -0
- package/dist/workflows/default-template-ui/renderers.d.ts +9 -0
- package/dist/workflows/default-template-ui/triggers/translations.d.ts +4 -0
- package/dist/workflows/default-template-ui/triggers/trigger-details-editor.d.ts +4 -0
- package/dist/workflows/default-template-ui/triggers/trigger-expression-environment.d.ts +4 -0
- package/dist/workflows/expression-editor/expression-editor.d.ts +15 -0
- package/dist/workflows/expression-editor/index.d.ts +3 -0
- package/dist/workflows/expression-editor/source-browser.d.ts +29 -0
- package/dist/workflows/expression-editor/syntax-help-drawer.d.ts +5 -0
- package/dist/workflows/expression-editor/translations.d.ts +8 -0
- package/dist/workflows/expressions/domain.d.ts +59 -0
- package/dist/workflows/expressions/typing.d.ts +28 -0
- package/dist/workflows/field-configuration-resolver.d.ts +5 -0
- package/dist/workflows/field-editor/expression-slots.d.ts +35 -0
- package/dist/workflows/field-editor/index.d.ts +2 -0
- package/dist/workflows/field-editor/translations.d.ts +7 -0
- package/dist/workflows/field-editor/workflow-field-frame.d.ts +53 -0
- package/dist/workflows/field-resolver.d.ts +5 -0
- package/dist/workflows/field-type-select/catalog.d.ts +22 -0
- package/dist/workflows/field-type-select/field-type-select.d.ts +18 -0
- package/dist/workflows/index.d.ts +26 -0
- package/dist/workflows/node-presentation/node-presentation.d.ts +9 -0
- package/dist/workflows/options.d.ts +28 -0
- package/dist/workflows/runtime/field-bindings.d.ts +21 -0
- package/dist/workflows/runtime/field-visibility.d.ts +7 -0
- package/dist/workflows/runtime/load-workflow-module.d.ts +4 -0
- package/dist/workflows/runtime/workflow-template-details.d.ts +4 -0
- package/dist/workflows/workflow-runtime/remote-options-select-field.d.ts +4 -0
- package/dist/workflows/workflow-runtime/translations.d.ts +5 -0
- package/dist/workflows/workflow-types.d.ts +156 -0
- package/package.json +101 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { JsonValue, WorkflowJsonSchema } from "../contracts";
|
|
2
|
+
import type { AuthoredExpressionValue, ExpressionEnvironment, ExpressionValidation, ExpressionMode } from "../expressions/domain";
|
|
3
|
+
export interface WorkflowFieldFrameDraft {
|
|
4
|
+
mode: ExpressionMode;
|
|
5
|
+
fixed: JsonValue;
|
|
6
|
+
expression: string;
|
|
7
|
+
}
|
|
8
|
+
interface FixedControlProps {
|
|
9
|
+
controlId?: string;
|
|
10
|
+
describedBy?: string;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
labelledBy?: string;
|
|
13
|
+
onChange: (value: JsonValue) => void;
|
|
14
|
+
value: JsonValue;
|
|
15
|
+
}
|
|
16
|
+
interface ExpressionControlProps {
|
|
17
|
+
controlId?: string;
|
|
18
|
+
describedBy?: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
labelledBy?: string;
|
|
21
|
+
onChange: (source: string) => void;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
interface WorkflowFieldFrameDiagnostic {
|
|
25
|
+
code: string;
|
|
26
|
+
message: string;
|
|
27
|
+
severity: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const WorkflowFieldFrame: ({ allowExpression, allowFixed, controlId, diagnostics, expressionEditor, expressionMultiline, help, label, onValueChange, readOnly, renderExpression, renderFixed, required, sensitive, value }: {
|
|
30
|
+
allowExpression?: boolean;
|
|
31
|
+
allowFixed?: boolean;
|
|
32
|
+
controlId?: string;
|
|
33
|
+
diagnostics?: readonly WorkflowFieldFrameDiagnostic[];
|
|
34
|
+
expressionEditor?: {
|
|
35
|
+
environment?: ExpressionEnvironment;
|
|
36
|
+
error?: string;
|
|
37
|
+
loading?: boolean;
|
|
38
|
+
validate?: (source: string, signal: AbortSignal) => Promise<ExpressionValidation>;
|
|
39
|
+
/** Bound field schema; ranks suggestions by type compatibility. */
|
|
40
|
+
targetSchema?: WorkflowJsonSchema;
|
|
41
|
+
};
|
|
42
|
+
expressionMultiline?: boolean;
|
|
43
|
+
help?: string;
|
|
44
|
+
label: string;
|
|
45
|
+
onValueChange: (value: AuthoredExpressionValue) => void;
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
renderExpression?: (props: ExpressionControlProps) => React.ReactNode;
|
|
48
|
+
renderFixed: (props: FixedControlProps) => React.ReactNode;
|
|
49
|
+
required?: boolean;
|
|
50
|
+
sensitive?: boolean;
|
|
51
|
+
value: AuthoredExpressionValue;
|
|
52
|
+
}) => import("react").JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EffectiveWorkflowCatalog, JsonObject } from "../contracts";
|
|
2
|
+
import type { WorkflowFieldTypeCollection } from "./field-type-select";
|
|
3
|
+
type JsonSchema = JsonObject;
|
|
4
|
+
export interface AvailableWorkflowField {
|
|
5
|
+
catalogTemplateId: string;
|
|
6
|
+
configSchema: JsonSchema;
|
|
7
|
+
fqn: string;
|
|
8
|
+
version: string;
|
|
9
|
+
label: string;
|
|
10
|
+
schema: JsonSchema;
|
|
11
|
+
collectionKey: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AvailableWorkflowFieldCollection {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
weight: number;
|
|
17
|
+
fields: AvailableWorkflowField[];
|
|
18
|
+
}
|
|
19
|
+
export declare const fieldCollectionsFromCatalog: (catalog: EffectiveWorkflowCatalog | undefined, boundary: "input" | "output") => AvailableWorkflowFieldCollection[];
|
|
20
|
+
export declare const toFieldTypeCollection: (collection: AvailableWorkflowFieldCollection) => WorkflowFieldTypeCollection;
|
|
21
|
+
export declare const schemaForWorkflowField: (schema: JsonSchema, field: AvailableWorkflowField) => JsonSchema;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface WorkflowFieldTypeOption {
|
|
2
|
+
fqn: string;
|
|
3
|
+
version: string;
|
|
4
|
+
label: string;
|
|
5
|
+
searchTerms?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowFieldTypeCollection {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
options: readonly WorkflowFieldTypeOption[];
|
|
11
|
+
}
|
|
12
|
+
export declare const fieldTypeIdentity: (field: Pick<WorkflowFieldTypeOption, "fqn" | "version">) => string;
|
|
13
|
+
export declare const FieldTypeSelect: ({ collections, value, onChange, ariaLabel }: {
|
|
14
|
+
collections: readonly WorkflowFieldTypeCollection[];
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (option: WorkflowFieldTypeOption) => void;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { activateDashboardWorkflowCatalog, activateWorkflowCatalog, dashboardWorkflowPackage, parseWorkflowTemplateKind, resolveWorkflowField, resolveWorkflowTemplate, workflowCatalogSnapshot } from "./catalog";
|
|
2
|
+
export type { WorkflowCatalogResolution, WorkflowDeclarationMetadata } from "./catalog";
|
|
3
|
+
export { WorkflowFieldConfigurationResolver } from "./field-configuration-resolver";
|
|
4
|
+
export { WorkflowFieldResolver } from "./field-resolver";
|
|
5
|
+
export * from "./contracts";
|
|
6
|
+
export * from "./expressions/domain";
|
|
7
|
+
export * from "./field-editor";
|
|
8
|
+
export * from "./field-editor/expression-slots";
|
|
9
|
+
export * from "./field-type-select/catalog";
|
|
10
|
+
export * from "./field-type-select/field-type-select";
|
|
11
|
+
export { CatalogNodeChartBlock } from "./default-template-ui/actions/catalog-node-chart-block";
|
|
12
|
+
export { CatalogNodeDetailsEditor } from "./default-template-ui/actions/catalog-node-details-editor";
|
|
13
|
+
export { defaultWorkflowTemplateDeclarations } from "./default-template-ui/declarations";
|
|
14
|
+
export { renderDefaultActionChart, renderDefaultActionDetails, renderDefaultInputChart, renderDefaultInputDetails, renderDefaultOutputChart, renderDefaultOutputDetails, renderDefaultTriggerChart, renderDefaultTriggerDetails } from "./default-template-ui/renderers";
|
|
15
|
+
export { WorkflowTemplateDetails } from "./runtime/workflow-template-details";
|
|
16
|
+
export { patchWorkflowFieldPartDisplayValue, patchWorkflowFieldValue, readWorkflowFieldDisplayValue, readWorkflowBindingValue, readWorkflowFieldPartDisplayValue, readWorkflowFieldValue } from "./runtime/field-bindings";
|
|
17
|
+
export type { WorkflowFieldDisplayValue, WorkflowFieldValues } from "./runtime/field-bindings";
|
|
18
|
+
export { isWorkflowFieldVisible } from "./runtime/field-visibility";
|
|
19
|
+
export * from "../runtime/type-guards";
|
|
20
|
+
export { catalogText } from "./default-template-ui/actions/catalog-text";
|
|
21
|
+
export * from "./expression-editor";
|
|
22
|
+
export * from "./expression-editor/source-browser";
|
|
23
|
+
export * from "./options";
|
|
24
|
+
export { normalizeExpressionEnvironment, normalizeExpressionValidation } from "./expressions/domain";
|
|
25
|
+
export type { ExpressionEnvironment, ExpressionValidation } from "./expressions/domain";
|
|
26
|
+
export type { WorkflowCatalogNodeTemplate, WorkflowFieldComponentContext, WorkflowFieldConfigurationContext, WorkflowFieldConfigurationRender, WorkflowFieldRender, WorkflowTemplateChartData, WorkflowTemplateKind, WorkflowTemplateReference, WorkflowTemplateRender, WorkflowTemplateUiCommands, WorkflowTemplateUiContext, WorkflowValueContract } from "./workflow-types";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
export interface WorkflowNodePresentation {
|
|
3
|
+
label: string;
|
|
4
|
+
icon: ComponentType<{
|
|
5
|
+
className?: string;
|
|
6
|
+
}>;
|
|
7
|
+
tone: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const workflowNodePresentation: (kind: string) => WorkflowNodePresentation;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FieldOptionPage, JsonObject, JsonValue } from "@collective-intelligence/extensions-sdk";
|
|
2
|
+
import type { InfiniteData, UseInfiniteQueryOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
3
|
+
export type WorkflowFieldOptionsRequest = Readonly<{
|
|
4
|
+
catalogTemplateId: string;
|
|
5
|
+
config?: JsonObject;
|
|
6
|
+
cursor?: string | null;
|
|
7
|
+
dependencies: JsonObject;
|
|
8
|
+
limit: number;
|
|
9
|
+
organizationId: string;
|
|
10
|
+
ownerWorkflowId?: string;
|
|
11
|
+
partPath?: readonly string[];
|
|
12
|
+
search?: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
export type WorkflowFieldOptionsProvider = (request: WorkflowFieldOptionsRequest, signal?: AbortSignal) => Promise<FieldOptionPage<JsonValue>>;
|
|
15
|
+
type WorkflowFieldOptionsQueryInput = WorkflowFieldOptionsRequest & {
|
|
16
|
+
optionsProvider?: WorkflowFieldOptionsProvider;
|
|
17
|
+
};
|
|
18
|
+
type WorkflowFieldOptionsQueryKey = readonly [
|
|
19
|
+
"workflow-field-options",
|
|
20
|
+
WorkflowFieldOptionsRequest
|
|
21
|
+
];
|
|
22
|
+
type WorkflowFieldOptionsQueryOptions = Pick<UseQueryOptions<FieldOptionPage<JsonValue>, Error, FieldOptionPage<JsonValue>, WorkflowFieldOptionsQueryKey>, "queryFn" | "queryKey">;
|
|
23
|
+
type WorkflowFieldOptionsInfiniteQueryOptions = Pick<UseInfiniteQueryOptions<FieldOptionPage<JsonValue>, Error, InfiniteData<FieldOptionPage<JsonValue>>, WorkflowFieldOptionsQueryKey, string | null>, "getNextPageParam" | "initialPageParam" | "queryFn" | "queryKey">;
|
|
24
|
+
/** Installs the Host-owned options adapter for the current contribution graph. */
|
|
25
|
+
export declare const configureWorkflowFieldOptionsProvider: (provider: WorkflowFieldOptionsProvider | undefined) => void;
|
|
26
|
+
export declare const workflowFieldOptions: (input: WorkflowFieldOptionsQueryInput) => WorkflowFieldOptionsQueryOptions;
|
|
27
|
+
export declare const workflowFieldOptionsInfinite: (input: Omit<WorkflowFieldOptionsQueryInput, "cursor">) => WorkflowFieldOptionsInfiniteQueryOptions;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue, WorkflowFormField } from "../contracts";
|
|
2
|
+
type RuntimeValue = JsonValue | undefined;
|
|
3
|
+
export interface WorkflowFieldValues {
|
|
4
|
+
config: JsonObject;
|
|
5
|
+
inputs: JsonObject;
|
|
6
|
+
settings: JsonObject;
|
|
7
|
+
metadata?: JsonObject;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowFieldDisplayValue extends JsonObject {
|
|
10
|
+
label: string;
|
|
11
|
+
value: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
/** Reads a bound value, unwrapping fixed envelopes at every path segment. */
|
|
14
|
+
export declare const readWorkflowBindingValue: (values: WorkflowFieldValues, binding: WorkflowFormField["binding"]) => RuntimeValue;
|
|
15
|
+
export declare const readWorkflowFieldValue: (values: WorkflowFieldValues, field: WorkflowFormField) => RuntimeValue;
|
|
16
|
+
/** Retains unclaimed sibling values when a known catalog field is edited. */
|
|
17
|
+
export declare const patchWorkflowFieldValue: (values: WorkflowFieldValues, field: WorkflowFormField, nextValue: JsonValue, displayOption?: WorkflowFieldDisplayValue | null) => Partial<WorkflowFieldValues>;
|
|
18
|
+
export declare const readWorkflowFieldDisplayValue: (values: WorkflowFieldValues, field: WorkflowFormField) => WorkflowFieldDisplayValue | undefined;
|
|
19
|
+
export declare const readWorkflowFieldPartDisplayValue: (values: WorkflowFieldValues, field: WorkflowFormField, partPath: (string | number)[]) => WorkflowFieldDisplayValue | undefined;
|
|
20
|
+
export declare const patchWorkflowFieldPartDisplayValue: (values: WorkflowFieldValues, field: WorkflowFormField, partPath: (string | number)[], displayOption: WorkflowFieldDisplayValue | null) => Partial<WorkflowFieldValues>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowFormField } from "../contracts";
|
|
2
|
+
import type { WorkflowFieldValues } from "./field-bindings";
|
|
3
|
+
/**
|
|
4
|
+
* Evaluates declared visibility rules against authored node values. Stored
|
|
5
|
+
* values are `{mode: "fixed"}` envelopes; rules compare the plain value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isWorkflowFieldVisible: (field: Pick<WorkflowFormField, "visibleWhen">, values: WorkflowFieldValues) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FrontendComponentDeclaration } from "@collective-intelligence/extensions-sdk-frontend";
|
|
2
|
+
import type { HostedComponentModule } from "../../frontend";
|
|
3
|
+
/** Hosted workflow code must stay within the statically declared module graph. */
|
|
4
|
+
export declare const loadWorkflowModule: <Props extends object>(declaration: FrontendComponentDeclaration, role?: string) => Promise<HostedComponentModule<Props>>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { FieldOption } from "@collective-intelligence/extensions-sdk";
|
|
2
|
+
import type { ComponentType, ReactNode } from "react";
|
|
3
|
+
import { WorkflowTemplateKinds } from "@collective-intelligence/extensions-sdk";
|
|
4
|
+
import type { EffectiveWorkflowCatalog, EffectiveWorkflowCatalogTemplate, JsonObject, JsonValue, WorkflowFormField, WorkflowFieldProjection, WorkflowJsonSchema, WorkflowOutputContract, WorkflowPortContract, WorkflowTemplateContract } from "./contracts";
|
|
5
|
+
import type { ExpressionEnvironment, ExpressionValidation } from "./expressions/domain";
|
|
6
|
+
import type { WorkflowFieldOptionsProvider } from "./options";
|
|
7
|
+
import type { WorkflowFieldValues } from "./runtime/field-bindings";
|
|
8
|
+
export type WorkflowTemplateKind = (typeof WorkflowTemplateKinds)[number];
|
|
9
|
+
export declare const parseWorkflowTemplateKind: (value: string) => WorkflowTemplateKind | undefined;
|
|
10
|
+
export interface WorkflowTemplateReference {
|
|
11
|
+
fqn: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
}
|
|
15
|
+
export type WorkflowCatalogNodeTemplate = EffectiveWorkflowCatalogTemplate & {
|
|
16
|
+
contract: WorkflowTemplateContract;
|
|
17
|
+
kind: WorkflowTemplateKind;
|
|
18
|
+
};
|
|
19
|
+
export interface WorkflowValueContract {
|
|
20
|
+
jsonSchema: JsonObject;
|
|
21
|
+
fieldProjections?: WorkflowFieldProjection[];
|
|
22
|
+
}
|
|
23
|
+
export interface WorkflowTemplateUiCommands {
|
|
24
|
+
updateNodeConfiguration: (value: JsonObject) => void;
|
|
25
|
+
updateNodeValues?: (value: Partial<WorkflowFieldValues>) => void;
|
|
26
|
+
updateInputContract: (value: WorkflowValueContract) => void;
|
|
27
|
+
updateOutputContract: (value: WorkflowOutputContract) => void;
|
|
28
|
+
updateTriggerConfiguration?: (value: {
|
|
29
|
+
config?: JsonObject;
|
|
30
|
+
settings?: JsonObject;
|
|
31
|
+
inputBindings?: JsonObject;
|
|
32
|
+
invocation?: JsonObject;
|
|
33
|
+
}) => void;
|
|
34
|
+
closeDetails: () => void;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkflowTemplateChartData {
|
|
37
|
+
presentation?: {
|
|
38
|
+
icon: ComponentType<{
|
|
39
|
+
className?: string;
|
|
40
|
+
}>;
|
|
41
|
+
tone: string;
|
|
42
|
+
};
|
|
43
|
+
title?: string;
|
|
44
|
+
subtitle?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
summary?: string;
|
|
47
|
+
fields?: readonly string[];
|
|
48
|
+
onOpenDetails: () => void;
|
|
49
|
+
onAddFromPort?: (port: WorkflowPortContract) => void;
|
|
50
|
+
connectedOutputPortKeys?: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
export interface WorkflowFieldComponentContext {
|
|
53
|
+
field: WorkflowFormField;
|
|
54
|
+
value: JsonValue;
|
|
55
|
+
readOnly: boolean;
|
|
56
|
+
mode?: "configuration" | "value" | "read_only";
|
|
57
|
+
/** Issues of this field; `path` is relative to it, `[index]` for a list row. */
|
|
58
|
+
diagnostics: readonly {
|
|
59
|
+
code: string;
|
|
60
|
+
message: string;
|
|
61
|
+
severity: string;
|
|
62
|
+
path?: readonly (string | number)[];
|
|
63
|
+
}[];
|
|
64
|
+
options: readonly FieldOption<JsonValue>[];
|
|
65
|
+
selectedOption?: {
|
|
66
|
+
label: string;
|
|
67
|
+
value: JsonValue;
|
|
68
|
+
};
|
|
69
|
+
partDisplayValues?: Record<string, {
|
|
70
|
+
label: string;
|
|
71
|
+
value: JsonValue;
|
|
72
|
+
}>;
|
|
73
|
+
remoteOptions?: {
|
|
74
|
+
organizationId: string;
|
|
75
|
+
catalogTemplateId: string;
|
|
76
|
+
ownerWorkflowId?: string;
|
|
77
|
+
dependencies?: JsonObject;
|
|
78
|
+
config?: JsonObject;
|
|
79
|
+
optionsProvider?: WorkflowFieldOptionsProvider;
|
|
80
|
+
};
|
|
81
|
+
schema?: JsonObject;
|
|
82
|
+
supportsMapping: boolean;
|
|
83
|
+
expressionEditor?: {
|
|
84
|
+
environment?: ExpressionEnvironment;
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
error?: string;
|
|
87
|
+
validate?: (source: string, signal: AbortSignal) => Promise<ExpressionValidation>;
|
|
88
|
+
/** Bound field schema; ranks suggestions by type compatibility. */
|
|
89
|
+
targetSchema?: WorkflowJsonSchema;
|
|
90
|
+
};
|
|
91
|
+
expressionEditorForPath?: (path: (string | number)[]) => WorkflowFieldComponentContext["expressionEditor"];
|
|
92
|
+
onValueChange: (value: JsonValue, displayOption?: {
|
|
93
|
+
label: string;
|
|
94
|
+
value: JsonValue;
|
|
95
|
+
} | null) => void;
|
|
96
|
+
onPartDisplayValueChange?: (path: (string | number)[], displayOption: {
|
|
97
|
+
label: string;
|
|
98
|
+
value: JsonValue;
|
|
99
|
+
} | null) => void;
|
|
100
|
+
openConnectionCreator?: (connectionTemplateFqn: string, onCreated: (connectionId: string) => void) => void;
|
|
101
|
+
}
|
|
102
|
+
export interface WorkflowFieldConfigurationContext {
|
|
103
|
+
field: {
|
|
104
|
+
catalogTemplateId: string;
|
|
105
|
+
configSchema: JsonObject;
|
|
106
|
+
fqn: string;
|
|
107
|
+
label: string;
|
|
108
|
+
version: string;
|
|
109
|
+
};
|
|
110
|
+
config: JsonObject;
|
|
111
|
+
readOnly: boolean;
|
|
112
|
+
remoteOptions?: {
|
|
113
|
+
organizationId: string;
|
|
114
|
+
catalogTemplateId: string;
|
|
115
|
+
optionsProvider?: WorkflowFieldOptionsProvider;
|
|
116
|
+
};
|
|
117
|
+
onChange: (config: JsonObject) => void;
|
|
118
|
+
}
|
|
119
|
+
export interface WorkflowTemplateUiContext {
|
|
120
|
+
template: WorkflowCatalogNodeTemplate;
|
|
121
|
+
nodeId: string | null;
|
|
122
|
+
ports: readonly WorkflowPortContract[];
|
|
123
|
+
readOnly: boolean;
|
|
124
|
+
loading: boolean;
|
|
125
|
+
diagnostics: readonly {
|
|
126
|
+
code: string;
|
|
127
|
+
message: string;
|
|
128
|
+
severity: string;
|
|
129
|
+
path?: readonly (string | number)[];
|
|
130
|
+
}[];
|
|
131
|
+
workflowContracts?: {
|
|
132
|
+
inputContract: WorkflowValueContract;
|
|
133
|
+
outputContract: WorkflowOutputContract;
|
|
134
|
+
};
|
|
135
|
+
workflowCatalog?: EffectiveWorkflowCatalog;
|
|
136
|
+
organizationId?: string;
|
|
137
|
+
availableOutputPorts?: readonly {
|
|
138
|
+
value: string;
|
|
139
|
+
label: string;
|
|
140
|
+
}[];
|
|
141
|
+
trigger?: {
|
|
142
|
+
inputBindings: JsonObject;
|
|
143
|
+
invocation: JsonObject;
|
|
144
|
+
};
|
|
145
|
+
/** Live backend validator for the expression bound to one workflow input key. */
|
|
146
|
+
triggerInputExpressionValidator?: (inputKey: string) => ((source: string, signal: AbortSignal) => Promise<ExpressionValidation>) | undefined;
|
|
147
|
+
nodeValues?: WorkflowFieldValues;
|
|
148
|
+
getDynamicInputFieldContext?: (field: WorkflowFormField) => WorkflowFieldComponentContext;
|
|
149
|
+
isFieldVisible?: (field: WorkflowFormField) => boolean;
|
|
150
|
+
chart: WorkflowTemplateChartData;
|
|
151
|
+
getFieldContext?: (field: WorkflowFormField) => WorkflowFieldComponentContext;
|
|
152
|
+
commands: WorkflowTemplateUiCommands;
|
|
153
|
+
}
|
|
154
|
+
export type WorkflowTemplateRender = (context: WorkflowTemplateUiContext) => ReactNode;
|
|
155
|
+
export type WorkflowFieldRender = (context: WorkflowFieldComponentContext) => ReactNode;
|
|
156
|
+
export type WorkflowFieldConfigurationRender = (context: WorkflowFieldConfigurationContext) => ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collective-intelligence/extensions-sdk-frontend-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Public hosted React contribution contracts for Collective Intelligence extensions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"ci-source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./dashboard": {
|
|
21
|
+
"ci-source": "./src/dashboard.ts",
|
|
22
|
+
"types": "./dist/dashboard.d.ts",
|
|
23
|
+
"import": "./dist/dashboard.js",
|
|
24
|
+
"default": "./dist/dashboard.js"
|
|
25
|
+
},
|
|
26
|
+
"./workflow": {
|
|
27
|
+
"ci-source": "./src/workflow.ts",
|
|
28
|
+
"types": "./dist/workflows/index.d.ts",
|
|
29
|
+
"import": "./dist/workflow.js",
|
|
30
|
+
"default": "./dist/workflow.js"
|
|
31
|
+
},
|
|
32
|
+
"./studio": {
|
|
33
|
+
"ci-source": "./src/studio.ts",
|
|
34
|
+
"types": "./dist/studio.d.ts",
|
|
35
|
+
"import": "./dist/studio.js",
|
|
36
|
+
"default": "./dist/studio.js"
|
|
37
|
+
},
|
|
38
|
+
"./ui-react": {
|
|
39
|
+
"ci-source": "./src/ui-react.ts",
|
|
40
|
+
"types": "./dist/ui-react.d.ts",
|
|
41
|
+
"import": "./dist/ui-react.js",
|
|
42
|
+
"default": "./dist/ui-react.js"
|
|
43
|
+
},
|
|
44
|
+
"./frontend": {
|
|
45
|
+
"ci-source": "./src/frontend/index.tsx",
|
|
46
|
+
"types": "./dist/frontend/index.d.ts",
|
|
47
|
+
"import": "./dist/frontend/index.js",
|
|
48
|
+
"default": "./dist/frontend/index.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "bun tools/build.ts",
|
|
53
|
+
"test": "bun test src tools && bun run test:pack && vitest run test/frontend-runtime.test.tsx test/built-runtime.test.ts test/workflow-field-help.test.tsx",
|
|
54
|
+
"test:unit": "bun test src",
|
|
55
|
+
"test:pack": "bun tools/test-pack.ts",
|
|
56
|
+
"format": "oxfmt --write .",
|
|
57
|
+
"format:check": "oxfmt --check .",
|
|
58
|
+
"format:check:staged": "oxfmt --check",
|
|
59
|
+
"lint": "node \"../../../.agents/scripts/managed-lint-runner.mjs\" --scope \"packages/public/extensions-sdk-frontend-react\"",
|
|
60
|
+
"lint:staged": "oxlint --no-error-on-unmatched-pattern",
|
|
61
|
+
"prepack": "bun run build",
|
|
62
|
+
"type-check": "tsc --noEmit"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@collective-intelligence/extensions-sdk": "0.1.1",
|
|
66
|
+
"@collective-intelligence/extensions-sdk-frontend": "0.1.1"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@collective-intelligence/ui-react": "0.1.1",
|
|
70
|
+
"@tanstack/react-query": ">=5 <6",
|
|
71
|
+
"@xyflow/react": ">=12 <13",
|
|
72
|
+
"react": ">=18 <20",
|
|
73
|
+
"react-dom": ">=18 <20"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"@collective-intelligence/ui-react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@collective-intelligence/ui-react": "workspace:*",
|
|
85
|
+
"@oxlint/plugins": "1.85.0",
|
|
86
|
+
"@tanstack/react-query": "5.101.4",
|
|
87
|
+
"@testing-library/react": "^16.3.2",
|
|
88
|
+
"@types/bun": "1.3.14",
|
|
89
|
+
"@types/react": "^19.2.14",
|
|
90
|
+
"@types/react-dom": "^19.2.3",
|
|
91
|
+
"@xyflow/react": "^12.10.2",
|
|
92
|
+
"eslint-plugin-react-you-might-not-need-an-effect": "latest",
|
|
93
|
+
"jsdom": "^28.1.0",
|
|
94
|
+
"oxfmt": "0.66.0",
|
|
95
|
+
"oxlint": "1.82.0",
|
|
96
|
+
"react": "^19.2.8",
|
|
97
|
+
"react-dom": "^19.2.8",
|
|
98
|
+
"typescript": "5.9.3",
|
|
99
|
+
"ultracite": "7.10.7",
|
|
100
|
+
"vitest": "^3.2.7",
|
|
101
|
+
"es-module-lexer": "2.3.2"
|
|
102
|
+
}
|
|
103
|
+
}
|