@flowgram.ai/test-run-plugin 0.1.0-alpha.23 → 0.1.0-alpha.25
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/.rush/temp/chunked-rush-logs/test-run-plugin.build.chunks.jsonl +9 -9
- package/.rush/temp/package-deps_build.json +4 -4
- package/.rush/temp/shrinkwrap-deps.json +3 -2
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/rush-logs/test-run-plugin.build.log +9 -9
- package/src/services/pipeline/pipeline.ts +14 -2
- package/src/services/pipeline/plugin.ts +2 -0
- package/src/services/test-run.ts +8 -0
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
{"kind":"O","text":"\u001b[34mCLI\u001b[39m Target: es2020\n"}
|
|
10
10
|
{"kind":"O","text":"\u001b[34mCJS\u001b[39m Build start\n"}
|
|
11
11
|
{"kind":"O","text":"\u001b[34mESM\u001b[39m Build start\n"}
|
|
12
|
-
{"kind":"O","text":"\u001b[32mCJS\u001b[39m \u001b[1mdist/index.js \u001b[22m\u001b[
|
|
13
|
-
{"kind":"O","text":"\u001b[32mCJS\u001b[39m \u001b[1mdist/index.js.map \u001b[22m\u001b[32m45.
|
|
14
|
-
{"kind":"O","text":"\u001b[32mCJS\u001b[39m ⚡️ Build success in
|
|
15
|
-
{"kind":"O","text":"\u001b[32mESM\u001b[39m \u001b[1mdist/esm/index.js \u001b[22m\u001b[
|
|
16
|
-
{"kind":"O","text":"\u001b[32mESM\u001b[39m \u001b[1mdist/esm/index.js.map \u001b[22m\u001b[
|
|
17
|
-
{"kind":"O","text":"\u001b[32mESM\u001b[39m ⚡️ Build success in
|
|
12
|
+
{"kind":"O","text":"\u001b[32mCJS\u001b[39m \u001b[1mdist/index.js \u001b[22m\u001b[32m23.12 KB\u001b[39m\n"}
|
|
13
|
+
{"kind":"O","text":"\u001b[32mCJS\u001b[39m \u001b[1mdist/index.js.map \u001b[22m\u001b[32m45.85 KB\u001b[39m\n"}
|
|
14
|
+
{"kind":"O","text":"\u001b[32mCJS\u001b[39m ⚡️ Build success in 172ms\n"}
|
|
15
|
+
{"kind":"O","text":"\u001b[32mESM\u001b[39m \u001b[1mdist/esm/index.js \u001b[22m\u001b[32m20.37 KB\u001b[39m\n"}
|
|
16
|
+
{"kind":"O","text":"\u001b[32mESM\u001b[39m \u001b[1mdist/esm/index.js.map \u001b[22m\u001b[32m45.46 KB\u001b[39m\n"}
|
|
17
|
+
{"kind":"O","text":"\u001b[32mESM\u001b[39m ⚡️ Build success in 172ms\n"}
|
|
18
18
|
{"kind":"O","text":"\u001b[34mDTS\u001b[39m Build start\n"}
|
|
19
|
-
{"kind":"O","text":"\u001b[32mDTS\u001b[39m ⚡️ Build success in
|
|
20
|
-
{"kind":"O","text":"\u001b[32mDTS\u001b[39m \u001b[1mdist/index.d.ts \u001b[22m\u001b[
|
|
21
|
-
{"kind":"O","text":"\u001b[32mDTS\u001b[39m \u001b[1mdist/index.d.mts \u001b[22m\u001b[
|
|
19
|
+
{"kind":"O","text":"\u001b[32mDTS\u001b[39m ⚡️ Build success in 3936ms\n"}
|
|
20
|
+
{"kind":"O","text":"\u001b[32mDTS\u001b[39m \u001b[1mdist/index.d.ts \u001b[22m\u001b[32m10.08 KB\u001b[39m\n"}
|
|
21
|
+
{"kind":"O","text":"\u001b[32mDTS\u001b[39m \u001b[1mdist/index.d.mts \u001b[22m\u001b[32m10.08 KB\u001b[39m\n"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"packages/plugins/test-run-plugin/.eslintrc.cjs": "6b30cfc55136d429873e780785bf8d775edaaa74",
|
|
4
|
-
"packages/plugins/test-run-plugin/.rush/temp/shrinkwrap-deps.json": "
|
|
4
|
+
"packages/plugins/test-run-plugin/.rush/temp/shrinkwrap-deps.json": "6ece261deac38ba5a71ac725aa27322fabfd50e1",
|
|
5
5
|
"packages/plugins/test-run-plugin/package.json": "3a87c5172b572e4d8481d020b5a1202d5b6e4ea1",
|
|
6
6
|
"packages/plugins/test-run-plugin/src/create-test-run-plugin.ts": "f763c673e16d2fd477165ea63ec18bd97dd4a14e",
|
|
7
7
|
"packages/plugins/test-run-plugin/src/form-engine/contexts.ts": "dbd003d0c9d9e17fcff7fba4acbce7ac5cd63692",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"packages/plugins/test-run-plugin/src/services/index.ts": "bf5fe718bd42ad1d24e3c24d642616b906c92e09",
|
|
36
36
|
"packages/plugins/test-run-plugin/src/services/pipeline/factory.ts": "e544306b491c8f5cad4e3cdac8f592e937672d62",
|
|
37
37
|
"packages/plugins/test-run-plugin/src/services/pipeline/index.ts": "4460a114ce25af6d1025a128446945708a08f229",
|
|
38
|
-
"packages/plugins/test-run-plugin/src/services/pipeline/pipeline.ts": "
|
|
39
|
-
"packages/plugins/test-run-plugin/src/services/pipeline/plugin.ts": "
|
|
38
|
+
"packages/plugins/test-run-plugin/src/services/pipeline/pipeline.ts": "5eb13bace55243b612fa9ea8adfd1cb16e17e2d4",
|
|
39
|
+
"packages/plugins/test-run-plugin/src/services/pipeline/plugin.ts": "11ff1405359c5eb867cfb631acaa8ecf08844561",
|
|
40
40
|
"packages/plugins/test-run-plugin/src/services/pipeline/tap.ts": "28d34971bc230cd2611024faa9e8d5a3267fccb8",
|
|
41
41
|
"packages/plugins/test-run-plugin/src/services/store.ts": "afef7ad6de5b9d9a9ad84fbb0821cb34bdacd75c",
|
|
42
|
-
"packages/plugins/test-run-plugin/src/services/test-run.ts": "
|
|
42
|
+
"packages/plugins/test-run-plugin/src/services/test-run.ts": "390ae59a7341da6dfb42a62fce4ec1c7ddabe20b",
|
|
43
43
|
"packages/plugins/test-run-plugin/src/types.ts": "c0064de0b332ac8d23e74971b19406f9c1849445",
|
|
44
44
|
"packages/plugins/test-run-plugin/tsconfig.json": "4b7a4f197dc4f9c62c2938fb3b77780944ad7675"
|
|
45
45
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"../../packages/plugins/test-run-plugin": "../../packages/plugins/test-run-plugin:
|
|
2
|
+
"../../packages/plugins/test-run-plugin": "../../packages/plugins/test-run-plugin:epHhT6yApwYvxVgAeLSl+etcgvSZOpqgZaSBG/lww3E=:",
|
|
3
3
|
"@esbuild/aix-ppc64@0.25.9": "sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==",
|
|
4
4
|
"@esbuild/android-arm64@0.25.9": "sha512-IDrddSmpSv51ftWslJMvl3Q2ZT98fUSL2/rlUXuVqRXHCs5EUF1/f+jbjF5+NG9UffUDMCiTyh8iec7u8RlTLg==",
|
|
5
5
|
"@esbuild/android-arm@0.25.9": "sha512-5WNI1DaMtxQ7t7B6xa572XMXpHAaI/9Hnhk8lcxF4zVN4xstUgTlvuGDorBguKEnZO70qwEcLpfifMLoxiPqHQ==",
|
|
@@ -151,11 +151,12 @@
|
|
|
151
151
|
"tsx@4.19.4": "sha512-gK5GVzDkJK1SI1zwHf32Mqxf2tSJkNx+eYcNly5+nHvWqXUJYUkWBQtKauoESz3ymezAI++ZwT855x5p5eop+Q==",
|
|
152
152
|
"typescript@5.9.2": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
|
153
153
|
"ufo@1.6.1": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==",
|
|
154
|
+
"use-sync-external-store@1.6.0(react@18.3.1)": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",
|
|
154
155
|
"webidl-conversions@4.0.2": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
|
|
155
156
|
"whatwg-url@7.1.0": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
|
|
156
157
|
"which@2.0.2": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
|
157
158
|
"wrap-ansi@7.0.0": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
|
158
159
|
"wrap-ansi@8.1.0": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
|
159
160
|
"yaml@2.8.1": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
|
|
160
|
-
"zustand@5.0.8(@types/react@18.3.24)(immer@10.1.3)(react@18.3.1)": "sha512-gyPKpIaxY9XcO2vSMrLbiER7QMAMGOQZVRdJ6Zi782jkbzZygq5GI9nG8g+sMgitRtndwaBSl7uiqC49o1SSiw=="
|
|
161
|
+
"zustand@5.0.8(@types/react@18.3.24)(immer@10.1.3)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1))": "sha512-gyPKpIaxY9XcO2vSMrLbiER7QMAMGOQZVRdJ6Zi782jkbzZygq5GI9nG8g+sMgitRtndwaBSl7uiqC49o1SSiw=="
|
|
161
162
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -462,6 +462,13 @@ var TestRunService = class {
|
|
|
462
462
|
pipeline.init(options);
|
|
463
463
|
return pipeline;
|
|
464
464
|
}
|
|
465
|
+
disposePipeline(id) {
|
|
466
|
+
const pipeline = this.pipelineEntities.get(id);
|
|
467
|
+
if (pipeline) {
|
|
468
|
+
this.pipelineEntities.delete(id);
|
|
469
|
+
pipeline.dispose();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
465
472
|
connectPipeline(pipeline) {
|
|
466
473
|
if (this.pipelineBindings.get(pipeline.id)) {
|
|
467
474
|
return;
|
|
@@ -557,6 +564,7 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
557
564
|
setData: (next) => set((state) => ({ ...state, data: { ...state.data, ...next } }))
|
|
558
565
|
}));
|
|
559
566
|
this.id = nanoid2();
|
|
567
|
+
this.plugins = [];
|
|
560
568
|
this.prepare = new Tap();
|
|
561
569
|
this.onProgressEmitter = new Emitter3();
|
|
562
570
|
this.onProgress = this.onProgressEmitter.event;
|
|
@@ -577,6 +585,7 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
577
585
|
for (const PluginClass of plugins) {
|
|
578
586
|
const plugin = this.container.resolve(PluginClass);
|
|
579
587
|
plugin.apply(this);
|
|
588
|
+
this.plugins.push(plugin);
|
|
580
589
|
}
|
|
581
590
|
}
|
|
582
591
|
registerExecute(fn) {
|
|
@@ -627,6 +636,14 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
627
636
|
this.status = "canceled";
|
|
628
637
|
}
|
|
629
638
|
dispose() {
|
|
639
|
+
this.status = "disposed";
|
|
640
|
+
this.plugins.forEach((p) => {
|
|
641
|
+
if (p.dispose) {
|
|
642
|
+
p.dispose();
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
this.onProgressEmitter.dispose();
|
|
646
|
+
this.onFinishedEmitter.dispose();
|
|
630
647
|
}
|
|
631
648
|
};
|
|
632
649
|
TestRunPipelineEntity = __decorateClass([
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create-test-run-plugin.ts","../../src/services/form/form.ts","../../src/services/config.ts","../../src/form-engine/form/form.tsx","../../src/form-engine/hooks/use-create-form.ts","../../src/form-engine/utils.ts","../../src/form-engine/model/index.ts","../../src/form-engine/hooks/use-field.ts","../../src/form-engine/contexts.ts","../../src/form-engine/hooks/use-form.ts","../../src/form-engine/fields/schema-field.tsx","../../src/form-engine/fields/recursion-field.tsx","../../src/form-engine/fields/reactive-field.tsx","../../src/form-engine/fields/object-field.tsx","../../src/form-engine/fields/general-field.tsx","../../src/form-engine/fields/create-field.tsx","../../src/services/form/factory.ts","../../src/services/form/manager.ts","../../src/services/test-run.ts","../../src/services/pipeline/factory.ts","../../src/services/pipeline/pipeline.ts","../../src/services/pipeline/tap.ts","../../src/services/store.ts","../../src/reactive/hooks/use-create-form.ts","../../src/reactive/hooks/use-test-run-service.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';\nimport {\n TestRunService,\n TestRunPipelineEntity,\n TestRunPipelineFactory,\n TestRunConfig,\n defineConfig,\n} from './services';\n\nexport const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({\n onBind: ({ bind }, opt) => {\n /** service */\n bind(TestRunService).toSelf().inSingletonScope();\n /** config */\n bind(TestRunConfig).toConstantValue(defineConfig(opt));\n /** form manager */\n bind(TestRunFormManager).toSelf().inSingletonScope();\n /** form entity */\n bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {\n const e = context.container.resolve(TestRunFormEntity);\n return e;\n });\n /** pipeline entity */\n bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(\n (context) => () => {\n const e = context.container.resolve(TestRunPipelineEntity);\n e.container = context.container.createChild();\n return e;\n }\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement, type ReactNode } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport { injectable, inject } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { TestRunConfig } from '../config';\nimport { FormSchema, FormEngine, type FormInstance, type FormEngineProps } from '../../form-engine';\n\nexport type FormRenderProps = Omit<\n FormEngineProps,\n 'schema' | 'components' | 'onMounted' | 'onUnmounted'\n>;\n\n@injectable()\nexport class TestRunFormEntity {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n private _schema: FormSchema;\n\n private initialized = false;\n\n id = nanoid();\n\n form: FormInstance | null = null;\n\n onFormMountedEmitter = new Emitter<FormInstance>();\n\n onFormMounted = this.onFormMountedEmitter.event;\n\n onFormUnmountedEmitter = new Emitter<void>();\n\n onFormUnmounted = this.onFormUnmountedEmitter.event;\n\n get schema() {\n return this._schema;\n }\n\n init(options: { schema: FormSchema }) {\n if (this.initialized) return;\n\n this._schema = options.schema;\n this.initialized = true;\n }\n\n render(props?: FormRenderProps): ReactNode {\n if (!this.initialized) {\n return null;\n }\n const { children, ...restProps } = props || {};\n return createElement(\n FormEngine,\n {\n schema: this.schema,\n components: this.config.components,\n onMounted: (instance) => {\n this.form = instance;\n this.onFormMountedEmitter.fire(instance);\n },\n onUnmounted: this.onFormUnmountedEmitter.fire.bind(this.onFormUnmountedEmitter),\n ...restProps,\n },\n children\n );\n }\n\n dispose() {\n this._schema = {};\n this.form = null;\n this.onFormMountedEmitter.dispose();\n this.onFormUnmountedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FlowNodeType, FlowNodeEntity } from '@flowgram.ai/document';\n\nimport type { MaybePromise } from '../types';\nimport type { FormSchema, FormComponents } from '../form-engine';\nimport type { TestRunPipelinePlugin } from './pipeline';\n\ntype PropertiesFunctionParams = {\n node: FlowNodeEntity;\n};\nexport type NodeMap = Record<FlowNodeType, NodeTestConfig>;\nexport interface NodeTestConfig {\n /** Enable node TestRun */\n enabled?: boolean;\n /** Input schema properties */\n properties?:\n | Record<string, FormSchema>\n | ((params: PropertiesFunctionParams) => MaybePromise<Record<string, FormSchema>>);\n}\n\nexport interface TestRunConfig {\n components: FormComponents;\n nodes: NodeMap;\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\nexport const TestRunConfig = Symbol('TestRunConfig');\nexport const defineConfig = (config: Partial<TestRunConfig>) => {\n const defaultConfig: TestRunConfig = {\n components: {},\n nodes: {},\n plugins: [],\n };\n return {\n ...defaultConfig,\n ...config,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Form } from '@flowgram.ai/form';\n\nimport { FormSchema, FormComponents } from '../types';\nimport { useCreateForm, type UseCreateFormOptions } from '../hooks';\nimport { createSchemaField } from '../fields';\n\nconst SchemaField = createSchemaField({});\n\nexport type FormEngineProps = React.PropsWithChildren<\n {\n /** Form schema */\n schema: FormSchema;\n /** form material map */\n components?: FormComponents;\n } & UseCreateFormOptions\n>;\n\nexport const FormEngine: React.FC<FormEngineProps> = ({\n schema,\n components,\n children,\n ...props\n}) => {\n const { model, control } = useCreateForm(schema, props);\n\n return (\n <Form control={control}>\n <SchemaField model={model} components={components}>\n {children}\n </SchemaField>\n </Form>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo } from 'react';\n\nimport type { OnFormValuesChangePayload } from '@flowgram.ai/form-core';\nimport { createForm, ValidateTrigger, type IForm } from '@flowgram.ai/form';\n\nimport { createValidate } from '../utils';\nimport { FormSchema, FormSchemaValidate } from '../types';\nimport { FormSchemaModel } from '../model';\n\nexport interface FormInstance {\n model: FormSchemaModel;\n form: IForm;\n}\nexport interface UseCreateFormOptions {\n defaultValues?: any;\n validate?: Record<string, FormSchemaValidate>;\n validateTrigger?: ValidateTrigger;\n onMounted?: (form: FormInstance) => void;\n onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;\n onUnmounted?: () => void;\n}\n\nexport const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {\n const { form, control } = useMemo(\n () =>\n createForm({\n validate: {\n ...createValidate(schema),\n ...options.validate,\n },\n validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,\n }),\n [schema]\n );\n\n const model = useMemo(\n () => new FormSchemaModel({ type: 'object', ...schema, defaultValue: options.defaultValues }),\n [schema]\n );\n\n /** Lifecycle and event binding */\n useEffect(() => {\n if (options.onMounted) {\n options.onMounted({ model, form });\n }\n const disposable = control._formModel.onFormValuesChange((payload) => {\n if (options.onFormValuesChange) {\n options.onFormValuesChange(payload);\n }\n });\n return () => {\n disposable.dispose();\n if (options.onUnmounted) {\n options.onUnmounted();\n }\n };\n }, [control]);\n\n return {\n form,\n control,\n model,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement } from 'react';\n\nimport type { FormSchema, FormSchemaValidate, FormComponentProps } from './types';\n\n/** Splice form item unique name */\nexport const getUniqueFieldName = (...args: (string | undefined)[]) =>\n args.filter((path) => path).join('.');\n\nexport const mergeFieldPath = (path?: string[], name?: string) =>\n [...(path || []), name].filter((i): i is string => Boolean(i));\n\n/** Create validation rules */\nexport const createValidate = (schema: FormSchema) => {\n const rules: Record<string, FormSchemaValidate> = {};\n\n visit(schema);\n\n return rules;\n\n function visit(current: FormSchema, name?: string) {\n if (name && current['x-validator']) {\n rules[name] = current['x-validator'];\n }\n if (current.type === 'object' && current.properties) {\n Object.entries(current.properties).forEach(([key, value]) => {\n visit(value, getUniqueFieldName(name, key));\n });\n }\n }\n};\n\nexport const connect = <T = any>(\n Component: React.FunctionComponent<any>,\n mapProps: (p: FormComponentProps) => T\n) => {\n const Connected = (props: FormComponentProps) => {\n const mappedProps = mapProps(props);\n return createElement(Component, mappedProps, (mappedProps as any).children);\n };\n\n return Connected;\n};\n\nexport const isFormEmpty = (schema: FormSchema) => {\n /** is not general field and not has children */\n const isEmpty = (s: FormSchema): boolean => {\n if (!s.type || s.type === 'object' || !s.name) {\n return Object.entries(schema.properties || {})\n .map(([key, value]) => ({\n name: key,\n ...value,\n }))\n .every(isFormEmpty);\n }\n return false;\n };\n\n return isEmpty(schema);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ReactiveState } from '@flowgram.ai/reactive';\n\nimport { getUniqueFieldName, mergeFieldPath } from '../utils';\nimport { FormSchema, FormSchemaType, FormSchemaModelState } from '../types';\n\nexport class FormSchemaModel implements FormSchema {\n name?: string;\n\n type?: FormSchemaType;\n\n defaultValue?: any;\n\n properties?: Record<string, FormSchema>;\n\n ['x-index']?: number;\n\n ['x-component']?: string;\n\n ['x-component-props']?: Record<string, unknown>;\n\n ['x-decorator']?: string;\n\n ['x-decorator-props']?: Record<string, unknown>;\n\n [key: string]: any;\n\n path: string[] = [];\n\n state = new ReactiveState<FormSchemaModelState>({ disabled: false });\n\n get componentType() {\n return this['x-component'];\n }\n\n get componentProps() {\n return this['x-component-props'];\n }\n\n get decoratorType() {\n return this['x-decorator'];\n }\n\n get decoratorProps() {\n return this['x-decorator-props'];\n }\n\n get uniqueName() {\n return getUniqueFieldName(...this.path);\n }\n\n constructor(json: FormSchema, path: string[] = []) {\n this.fromJSON(json);\n this.path = path;\n }\n\n private fromJSON(json: FormSchema) {\n Object.entries(json).forEach(([key, value]) => {\n this[key] = value;\n });\n }\n\n getPropertyList() {\n const orderProperties: FormSchemaModel[] = [];\n const unOrderProperties: FormSchemaModel[] = [];\n Object.entries(this.properties || {}).forEach(([key, item]) => {\n const index = item['x-index'];\n const defaultValues = this.defaultValue;\n /**\n * The upper layer's default value has a higher priority than its own default value,\n * because the upper layer's default value ultimately comes from the outside world.\n */\n if (typeof defaultValues === 'object' && defaultValues !== null && key in defaultValues) {\n item.defaultValue = defaultValues[key];\n }\n const current = new FormSchemaModel(item, mergeFieldPath(this.path, key));\n if (index !== undefined && !isNaN(index)) {\n orderProperties[index] = current;\n } else {\n unOrderProperties.push(current);\n }\n });\n return orderProperties.concat(unOrderProperties).filter((item) => !!item);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FieldModelContext } from '../contexts';\n\nexport const useFieldModel = () => useContext(FieldModelContext);\nexport const useFieldState = () => useObserve(useFieldModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createContext } from 'react';\n\nimport type { FormComponents } from './types';\nimport type { FormSchemaModel } from './model';\n\n/** Model context for each form item */\nexport const FieldModelContext = createContext<FormSchemaModel>({} as any);\n/** The form's model context */\nexport const FormModelContext = createContext<FormSchemaModel>({} as any);\n/** Context of material component map */\nexport const ComponentsContext = createContext<FormComponents>({});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FormModelContext } from '../contexts';\n\nexport const useFormModel = () => useContext(FormModelContext);\nexport const useFormState = () => useObserve(useFormModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState } from 'react';\n\nimport type { FormComponents } from '../types';\nimport { FormSchemaModel } from '../model';\nimport { ComponentsContext, FormModelContext } from '../contexts';\nimport { RecursionField } from './recursion-field';\n\nexport interface SchemaFieldProps {\n model: FormSchemaModel;\n components: FormComponents;\n}\nexport const SchemaField: React.FC<React.PropsWithChildren<SchemaFieldProps>> = ({\n components,\n model,\n children,\n}) => {\n /** Only initialized once, dynamic is not supported */\n const [innerComponents] = useState(() => components);\n return (\n <ComponentsContext.Provider value={innerComponents}>\n <FormModelContext.Provider value={model}>\n <RecursionField model={model} />\n {children}\n </FormModelContext.Provider>\n </ComponentsContext.Provider>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useMemo } from 'react';\n\nimport { FormSchemaModel } from '../model';\nimport { ObjectField } from './object-field';\nimport { GeneralField } from './general-field';\n\ninterface RecursionFieldProps {\n model: FormSchemaModel;\n}\n\nexport const RecursionField: React.FC<RecursionFieldProps> = ({ model }) => {\n const properties = useMemo(() => model.getPropertyList(), [model]);\n\n /** general field has no children */\n if (model.type !== 'object') {\n return <GeneralField model={model} />;\n }\n\n return (\n <ObjectField model={model}>\n {properties.map((item) => (\n <RecursionField key={item.uniqueName} model={item} />\n ))}\n </ObjectField>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\nimport React from 'react';\n\nimport { useFormState } from '../hooks/use-form';\nimport { useFieldModel, useFieldState } from '../hooks/use-field';\nimport { ComponentsContext } from '../contexts';\n\ninterface ReactiveFieldProps {\n componentProps?: Record<string, unknown>;\n decoratorProps?: Record<string, unknown>;\n}\n\nexport const ReactiveField: React.FC<React.PropsWithChildren<ReactiveFieldProps>> = (props) => {\n const formState = useFormState();\n const model = useFieldModel();\n const modelState = useFieldState();\n const components = useContext(ComponentsContext);\n\n const disabled = modelState.disabled || formState.disabled;\n const componentRender = () => {\n if (!model.componentType || !components[model.componentType]) {\n return props.children;\n }\n return React.createElement(\n components[model.componentType],\n {\n disabled,\n ...model.componentProps,\n ...props.componentProps,\n },\n props.children\n );\n };\n\n const decoratorRender = (children: React.ReactNode) => {\n if (!model.decoratorType || !components[model.decoratorType]) {\n return <>{children}</>;\n }\n return React.createElement(\n components[model.decoratorType],\n {\n type: model.type,\n required: model.required,\n ...model.decoratorProps,\n ...props.decoratorProps,\n },\n children\n );\n };\n\n return decoratorRender(componentRender());\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\nimport { ReactiveField } from './reactive-field';\n\nexport interface ObjectFieldProps {\n model: FormSchemaModel;\n}\n\nexport const ObjectField: React.FC<React.PropsWithChildren<ObjectFieldProps>> = ({\n model,\n children,\n}) => (\n <FieldModelContext.Provider value={model}>\n <ReactiveField>{children}</ReactiveField>\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Field } from '@flowgram.ai/form';\n\nimport { ReactiveField } from './reactive-field';\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\n\nexport interface GeneralFieldProps {\n model: FormSchemaModel;\n}\n\nexport const GeneralField: React.FC<GeneralFieldProps> = ({ model }) => (\n <FieldModelContext.Provider value={model}>\n <Field\n name={model.uniqueName}\n defaultValue={model.defaultValue}\n render={({ field, fieldState }) => (\n <ReactiveField\n componentProps={{\n value: field.value,\n onChange: field.onChange,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ...fieldState,\n }}\n decoratorProps={fieldState}\n />\n )}\n />\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { SchemaField, type SchemaFieldProps } from './schema-field';\nimport { FormComponents } from '../types';\n\ntype InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &\n Pick<Partial<SchemaFieldProps>, 'components'>;\n\nexport interface CreateSchemaFieldOptions {\n components?: FormComponents;\n}\nexport const createSchemaField = (options: CreateSchemaFieldOptions) => {\n const InnerSchemaField: React.FC<PropsWithChildren<InnerSchemaFieldProps>> = ({\n components,\n ...props\n }) => (\n <SchemaField\n components={{\n ...options.components,\n ...components,\n }}\n {...props}\n />\n );\n\n return InnerSchemaField;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunFormEntity } from './form';\n\nexport const TestRunFormFactory = Symbol('TestRunFormFactory');\nexport type TestRunFormFactory = () => TestRunFormEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\n\nimport type { TestRunFormEntity } from './form';\nimport { TestRunFormFactory } from './factory';\n\n@injectable()\nexport class TestRunFormManager {\n @inject(TestRunFormFactory) private readonly factory: TestRunFormFactory;\n\n private entities = new Map<string, TestRunFormEntity>();\n\n createForm() {\n return this.factory();\n }\n\n getForm(id: string) {\n return this.entities.get(id);\n }\n\n getAllForm() {\n return Array.from(this.entities);\n }\n\n disposeForm(id: string) {\n const form = this.entities.get(id);\n if (!form) {\n return;\n }\n form.dispose();\n this.entities.delete(id);\n }\n\n disposeAllForm() {\n for (const id of this.entities.keys()) {\n this.disposeForm(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity, FlowNodeType } from '@flowgram.ai/document';\n\nimport { TestRunPipelineFactory } from './pipeline/factory';\nimport { TestRunFormManager } from './form';\nimport { FormSchema } from '../form-engine';\nimport { TestRunPipelineEntity, type TestRunPipelineEntityOptions } from './pipeline';\nimport { TestRunConfig } from './config';\n\n@injectable()\nexport class TestRunService {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n @inject(TestRunPipelineFactory) private readonly pipelineFactory: TestRunPipelineFactory;\n\n @inject(TestRunFormManager) readonly formManager: TestRunFormManager;\n\n pipelineEntities = new Map<string, TestRunPipelineEntity>();\n\n pipelineBindings = new Map<string, Disposable>();\n\n onPipelineProgressEmitter = new Emitter();\n\n onPipelineProgress = this.onPipelineProgressEmitter.event;\n\n onPipelineFinishedEmitter = new Emitter();\n\n onPipelineFinished = this.onPipelineFinishedEmitter.event;\n\n public isEnabled(nodeType: FlowNodeType) {\n const config = this.config.nodes[nodeType];\n return config && config?.enabled !== false;\n }\n\n async toSchema(node: FlowNodeEntity) {\n const nodeType = node.flowNodeType;\n const config = this.config.nodes[nodeType];\n if (!this.isEnabled(nodeType)) {\n return {};\n }\n const properties =\n typeof config.properties === 'function'\n ? await config.properties({ node })\n : config.properties;\n\n return {\n type: 'object',\n properties,\n };\n }\n\n createFormWithSchema(schema: FormSchema) {\n const form = this.formManager.createForm();\n form.init({ schema });\n return form;\n }\n\n async createForm(node: FlowNodeEntity) {\n const schema = await this.toSchema(node);\n return this.createFormWithSchema(schema);\n }\n\n createPipeline(options: TestRunPipelineEntityOptions) {\n const pipeline = this.pipelineFactory();\n this.pipelineEntities.set(pipeline.id, pipeline);\n pipeline.init(options);\n return pipeline;\n }\n\n connectPipeline(pipeline: TestRunPipelineEntity) {\n if (this.pipelineBindings.get(pipeline.id)) {\n return;\n }\n const disposable = new DisposableCollection(\n pipeline.onProgress(this.onPipelineProgressEmitter.fire.bind(this.onPipelineProgressEmitter)),\n pipeline.onFinished(this.onPipelineFinishedEmitter.fire.bind(this.onPipelineFinishedEmitter))\n );\n this.pipelineBindings.set(pipeline.id, disposable);\n }\n\n disconnectPipeline(id: string) {\n if (this.pipelineBindings.has(id)) {\n const disposable = this.pipelineBindings.get(id);\n disposable?.dispose();\n this.pipelineBindings.delete(id);\n }\n }\n\n disconnectAllPipeline() {\n for (const id of this.pipelineBindings.keys()) {\n this.disconnectPipeline(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunPipelineEntity } from './pipeline';\n\nexport const TestRunPipelineFactory = Symbol('TestRunPipelineFactory');\nexport type TestRunPipelineFactory = () => TestRunPipelineEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { StoreApi } from 'zustand';\nimport { nanoid } from 'nanoid';\nimport { injectable, interfaces } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { Tap } from './tap';\nimport type { TestRunPipelinePlugin } from './plugin';\nimport { StoreService } from '../store';\nexport interface TestRunPipelineEntityOptions {\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\ninterface TestRunPipelineEntityState<T = any> {\n status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished';\n data?: T;\n result?: any;\n getData: () => T;\n setData: (next: any) => void;\n}\n\nexport interface TestRunPipelineEntityCtx<T = any> {\n id: string;\n store: StoreApi<TestRunPipelineEntityState<T>>;\n operate: {\n update: (data: any) => void;\n cancel: () => void;\n };\n}\n\nconst initialState: Omit<TestRunPipelineEntityState, 'getData' | 'setData'> = {\n status: 'idle',\n data: {},\n};\n\n@injectable()\nexport class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {\n container: interfaces.Container | undefined;\n\n id = nanoid();\n\n prepare = new Tap<TestRunPipelineEntityCtx>();\n\n private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n private progress?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n get status() {\n return this.getState().status;\n }\n\n set status(next: TestRunPipelineEntityState['status']) {\n this.setState({ status: next });\n }\n\n onProgressEmitter = new Emitter<any>();\n\n onProgress = this.onProgressEmitter.event;\n\n onFinishedEmitter = new Emitter();\n\n onFinished = this.onFinishedEmitter.event;\n\n constructor() {\n super((set, get) => ({\n ...initialState,\n getData: () => get().data || {},\n setData: (next: any) => set((state) => ({ ...state, data: { ...state.data, ...next } })),\n }));\n }\n\n public init(options: TestRunPipelineEntityOptions) {\n if (!this.container) {\n return;\n }\n const { plugins } = options;\n for (const PluginClass of plugins) {\n const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);\n plugin.apply(this);\n }\n }\n\n public registerExecute(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.execute = fn;\n }\n\n public registerProgress(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.progress = fn;\n }\n\n async start<T>(options?: { data: T }) {\n const { data } = options || {};\n if (this.status !== 'idle') {\n return;\n }\n /** initialization data */\n this.setState({ data });\n const ctx: TestRunPipelineEntityCtx = {\n id: this.id,\n store: this.store,\n operate: {\n update: this.update.bind(this),\n cancel: this.cancel.bind(this),\n },\n };\n\n this.status = 'preparing';\n await this.prepare.call(ctx);\n if (this.status !== 'preparing') {\n return;\n }\n\n this.status = 'executing';\n if (this.execute) {\n await this.execute(ctx);\n }\n if (this.progress) {\n await this.progress(ctx);\n }\n if (this.status === 'executing') {\n this.status = 'finished';\n this.onFinishedEmitter.fire(this.getState().result);\n }\n }\n\n update(result: any) {\n this.setState({ result });\n this.onProgressEmitter.fire(result);\n }\n\n cancel() {\n if ((this.status = 'preparing')) {\n this.prepare.freeze();\n }\n this.status = 'canceled';\n }\n\n dispose() {}\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MaybePromise } from '../../types';\n\ninterface TapValue<T> {\n name: string;\n fn: (arg: T) => MaybePromise<void>;\n}\n\nexport class Tap<T> {\n private taps: TapValue<T>[] = [];\n\n private frozen = false;\n\n tap(name: string, fn: TapValue<T>['fn']) {\n this.taps.push({ name, fn });\n }\n\n async call(ctx: T) {\n for (const tap of this.taps) {\n if (this.frozen) {\n return;\n }\n await tap.fn(ctx);\n }\n }\n\n freeze() {\n this.frozen = true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createStore } from 'zustand/vanilla';\nimport type { StoreApi, StateCreator } from 'zustand';\nimport { injectable, unmanaged } from 'inversify';\n/**\n * 包含 Store 的 Service\n */\n@injectable()\nexport class StoreService<State> {\n store: StoreApi<State>;\n\n get getState() {\n return this.store.getState.bind(this.store);\n }\n\n get setState() {\n return this.store.setState.bind(this.store);\n }\n\n constructor(@unmanaged() stateCreator: StateCreator<State>) {\n this.store = createStore(stateCreator);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { DisposableCollection } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { TestRunFormEntity } from '../../services/form/form';\nimport { FormEngineProps, isFormEmpty } from '../../form-engine';\nimport { useTestRunService } from './use-test-run-service';\n\ninterface UseFormOptions {\n node?: FlowNodeEntity;\n /** form loading */\n loadingRenderer?: React.ReactNode;\n /** form empty */\n emptyRenderer?: React.ReactNode;\n defaultValues?: FormEngineProps['defaultValues'];\n onMounted?: FormEngineProps['onMounted'];\n onUnmounted?: FormEngineProps['onUnmounted'];\n onFormValuesChange?: FormEngineProps['onFormValuesChange'];\n}\n\nexport const useCreateForm = ({\n node,\n loadingRenderer,\n emptyRenderer,\n defaultValues,\n onMounted,\n onUnmounted,\n onFormValuesChange,\n}: UseFormOptions) => {\n const testRun = useTestRunService();\n const [loading, setLoading] = useState(false);\n const [form, setForm] = useState<TestRunFormEntity | null>(null);\n const renderer = useMemo(() => {\n if (loading || !form) {\n return loadingRenderer;\n }\n\n const isEmpty = isFormEmpty(form.schema);\n\n return form.render({\n defaultValues,\n onFormValuesChange,\n children: isEmpty ? emptyRenderer : null,\n });\n }, [form, loading]);\n\n const compute = async () => {\n if (!node) {\n return;\n }\n try {\n setLoading(true);\n const formEntity = await testRun.createForm(node);\n setForm(formEntity);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n compute();\n }, [node]);\n\n useEffect(() => {\n if (!form) {\n return;\n }\n const disposable = new DisposableCollection(\n form.onFormMounted((data) => {\n onMounted?.(data);\n }),\n form.onFormUnmounted(() => {\n onUnmounted?.();\n })\n );\n return () => disposable.dispose();\n }, [form]);\n\n return {\n renderer,\n loading,\n form,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { TestRunService } from '../../services/test-run';\n\nexport const useTestRunService = () => useService<TestRunService>(TestRunService);\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAS,2BAA2B;;;ACApC,SAAS,iBAAAA,sBAAqC;AAE9C,SAAS,cAAc;AACvB,SAAS,YAAY,cAAc;AACnC,SAAS,eAAe;;;ACqBjB,IAAM,gBAAgB,OAAO,eAAe;AAC5C,IAAM,eAAe,CAAC,WAAmC;AAC9D,QAAM,gBAA+B;AAAA,IACnC,YAAY,CAAC;AAAA,IACb,OAAO,CAAC;AAAA,IACR,SAAS,CAAC;AAAA,EACZ;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;;;ACpCA,SAAS,YAAY;;;ACArB,SAAS,WAAW,eAAe;AAGnC,SAAS,YAAY,uBAAmC;;;ACHxD,SAAS,qBAAqB;AAKvB,IAAM,qBAAqB,IAAI,SACpC,KAAK,OAAO,CAAC,SAAS,IAAI,EAAE,KAAK,GAAG;AAE/B,IAAM,iBAAiB,CAAC,MAAiB,SAC9C,CAAC,GAAI,QAAQ,CAAC,GAAI,IAAI,EAAE,OAAO,CAAC,MAAmB,QAAQ,CAAC,CAAC;AAGxD,IAAM,iBAAiB,CAAC,WAAuB;AACpD,QAAM,QAA4C,CAAC;AAEnD,QAAM,MAAM;AAE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AAK,gBAAgB,MAAM;AACzB,sBAAc;AAAA,MAChB,CAAC;AAAA,IACH;AACA,WAAO,MAAM,WAAW,QAAQ;AAAA,EAClC,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["createElement","useContext","useObserve","useContext","useObserve","useMemo","useContext","useContext","jsx","jsx","jsx","useMemo","jsx","jsx","jsx","SchemaField","createElement","inject","injectable","inject","injectable","inject","injectable","Emitter","Emitter","inject","injectable","nanoid","injectable","Emitter","injectable","injectable","nanoid","Emitter","injectable","useEffect","useMemo","useState","DisposableCollection","useCreateForm","useState","useMemo","useEffect","DisposableCollection"]}
|
|
1
|
+
{"version":3,"sources":["../../src/create-test-run-plugin.ts","../../src/services/form/form.ts","../../src/services/config.ts","../../src/form-engine/form/form.tsx","../../src/form-engine/hooks/use-create-form.ts","../../src/form-engine/utils.ts","../../src/form-engine/model/index.ts","../../src/form-engine/hooks/use-field.ts","../../src/form-engine/contexts.ts","../../src/form-engine/hooks/use-form.ts","../../src/form-engine/fields/schema-field.tsx","../../src/form-engine/fields/recursion-field.tsx","../../src/form-engine/fields/reactive-field.tsx","../../src/form-engine/fields/object-field.tsx","../../src/form-engine/fields/general-field.tsx","../../src/form-engine/fields/create-field.tsx","../../src/services/form/factory.ts","../../src/services/form/manager.ts","../../src/services/test-run.ts","../../src/services/pipeline/factory.ts","../../src/services/pipeline/pipeline.ts","../../src/services/pipeline/tap.ts","../../src/services/store.ts","../../src/reactive/hooks/use-create-form.ts","../../src/reactive/hooks/use-test-run-service.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';\nimport {\n TestRunService,\n TestRunPipelineEntity,\n TestRunPipelineFactory,\n TestRunConfig,\n defineConfig,\n} from './services';\n\nexport const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({\n onBind: ({ bind }, opt) => {\n /** service */\n bind(TestRunService).toSelf().inSingletonScope();\n /** config */\n bind(TestRunConfig).toConstantValue(defineConfig(opt));\n /** form manager */\n bind(TestRunFormManager).toSelf().inSingletonScope();\n /** form entity */\n bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {\n const e = context.container.resolve(TestRunFormEntity);\n return e;\n });\n /** pipeline entity */\n bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(\n (context) => () => {\n const e = context.container.resolve(TestRunPipelineEntity);\n e.container = context.container.createChild();\n return e;\n }\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement, type ReactNode } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport { injectable, inject } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { TestRunConfig } from '../config';\nimport { FormSchema, FormEngine, type FormInstance, type FormEngineProps } from '../../form-engine';\n\nexport type FormRenderProps = Omit<\n FormEngineProps,\n 'schema' | 'components' | 'onMounted' | 'onUnmounted'\n>;\n\n@injectable()\nexport class TestRunFormEntity {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n private _schema: FormSchema;\n\n private initialized = false;\n\n id = nanoid();\n\n form: FormInstance | null = null;\n\n onFormMountedEmitter = new Emitter<FormInstance>();\n\n onFormMounted = this.onFormMountedEmitter.event;\n\n onFormUnmountedEmitter = new Emitter<void>();\n\n onFormUnmounted = this.onFormUnmountedEmitter.event;\n\n get schema() {\n return this._schema;\n }\n\n init(options: { schema: FormSchema }) {\n if (this.initialized) return;\n\n this._schema = options.schema;\n this.initialized = true;\n }\n\n render(props?: FormRenderProps): ReactNode {\n if (!this.initialized) {\n return null;\n }\n const { children, ...restProps } = props || {};\n return createElement(\n FormEngine,\n {\n schema: this.schema,\n components: this.config.components,\n onMounted: (instance) => {\n this.form = instance;\n this.onFormMountedEmitter.fire(instance);\n },\n onUnmounted: this.onFormUnmountedEmitter.fire.bind(this.onFormUnmountedEmitter),\n ...restProps,\n },\n children\n );\n }\n\n dispose() {\n this._schema = {};\n this.form = null;\n this.onFormMountedEmitter.dispose();\n this.onFormUnmountedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FlowNodeType, FlowNodeEntity } from '@flowgram.ai/document';\n\nimport type { MaybePromise } from '../types';\nimport type { FormSchema, FormComponents } from '../form-engine';\nimport type { TestRunPipelinePlugin } from './pipeline';\n\ntype PropertiesFunctionParams = {\n node: FlowNodeEntity;\n};\nexport type NodeMap = Record<FlowNodeType, NodeTestConfig>;\nexport interface NodeTestConfig {\n /** Enable node TestRun */\n enabled?: boolean;\n /** Input schema properties */\n properties?:\n | Record<string, FormSchema>\n | ((params: PropertiesFunctionParams) => MaybePromise<Record<string, FormSchema>>);\n}\n\nexport interface TestRunConfig {\n components: FormComponents;\n nodes: NodeMap;\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\nexport const TestRunConfig = Symbol('TestRunConfig');\nexport const defineConfig = (config: Partial<TestRunConfig>) => {\n const defaultConfig: TestRunConfig = {\n components: {},\n nodes: {},\n plugins: [],\n };\n return {\n ...defaultConfig,\n ...config,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Form } from '@flowgram.ai/form';\n\nimport { FormSchema, FormComponents } from '../types';\nimport { useCreateForm, type UseCreateFormOptions } from '../hooks';\nimport { createSchemaField } from '../fields';\n\nconst SchemaField = createSchemaField({});\n\nexport type FormEngineProps = React.PropsWithChildren<\n {\n /** Form schema */\n schema: FormSchema;\n /** form material map */\n components?: FormComponents;\n } & UseCreateFormOptions\n>;\n\nexport const FormEngine: React.FC<FormEngineProps> = ({\n schema,\n components,\n children,\n ...props\n}) => {\n const { model, control } = useCreateForm(schema, props);\n\n return (\n <Form control={control}>\n <SchemaField model={model} components={components}>\n {children}\n </SchemaField>\n </Form>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo } from 'react';\n\nimport type { OnFormValuesChangePayload } from '@flowgram.ai/form-core';\nimport { createForm, ValidateTrigger, type IForm } from '@flowgram.ai/form';\n\nimport { createValidate } from '../utils';\nimport { FormSchema, FormSchemaValidate } from '../types';\nimport { FormSchemaModel } from '../model';\n\nexport interface FormInstance {\n model: FormSchemaModel;\n form: IForm;\n}\nexport interface UseCreateFormOptions {\n defaultValues?: any;\n validate?: Record<string, FormSchemaValidate>;\n validateTrigger?: ValidateTrigger;\n onMounted?: (form: FormInstance) => void;\n onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;\n onUnmounted?: () => void;\n}\n\nexport const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {\n const { form, control } = useMemo(\n () =>\n createForm({\n validate: {\n ...createValidate(schema),\n ...options.validate,\n },\n validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,\n }),\n [schema]\n );\n\n const model = useMemo(\n () => new FormSchemaModel({ type: 'object', ...schema, defaultValue: options.defaultValues }),\n [schema]\n );\n\n /** Lifecycle and event binding */\n useEffect(() => {\n if (options.onMounted) {\n options.onMounted({ model, form });\n }\n const disposable = control._formModel.onFormValuesChange((payload) => {\n if (options.onFormValuesChange) {\n options.onFormValuesChange(payload);\n }\n });\n return () => {\n disposable.dispose();\n if (options.onUnmounted) {\n options.onUnmounted();\n }\n };\n }, [control]);\n\n return {\n form,\n control,\n model,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement } from 'react';\n\nimport type { FormSchema, FormSchemaValidate, FormComponentProps } from './types';\n\n/** Splice form item unique name */\nexport const getUniqueFieldName = (...args: (string | undefined)[]) =>\n args.filter((path) => path).join('.');\n\nexport const mergeFieldPath = (path?: string[], name?: string) =>\n [...(path || []), name].filter((i): i is string => Boolean(i));\n\n/** Create validation rules */\nexport const createValidate = (schema: FormSchema) => {\n const rules: Record<string, FormSchemaValidate> = {};\n\n visit(schema);\n\n return rules;\n\n function visit(current: FormSchema, name?: string) {\n if (name && current['x-validator']) {\n rules[name] = current['x-validator'];\n }\n if (current.type === 'object' && current.properties) {\n Object.entries(current.properties).forEach(([key, value]) => {\n visit(value, getUniqueFieldName(name, key));\n });\n }\n }\n};\n\nexport const connect = <T = any>(\n Component: React.FunctionComponent<any>,\n mapProps: (p: FormComponentProps) => T\n) => {\n const Connected = (props: FormComponentProps) => {\n const mappedProps = mapProps(props);\n return createElement(Component, mappedProps, (mappedProps as any).children);\n };\n\n return Connected;\n};\n\nexport const isFormEmpty = (schema: FormSchema) => {\n /** is not general field and not has children */\n const isEmpty = (s: FormSchema): boolean => {\n if (!s.type || s.type === 'object' || !s.name) {\n return Object.entries(schema.properties || {})\n .map(([key, value]) => ({\n name: key,\n ...value,\n }))\n .every(isFormEmpty);\n }\n return false;\n };\n\n return isEmpty(schema);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ReactiveState } from '@flowgram.ai/reactive';\n\nimport { getUniqueFieldName, mergeFieldPath } from '../utils';\nimport { FormSchema, FormSchemaType, FormSchemaModelState } from '../types';\n\nexport class FormSchemaModel implements FormSchema {\n name?: string;\n\n type?: FormSchemaType;\n\n defaultValue?: any;\n\n properties?: Record<string, FormSchema>;\n\n ['x-index']?: number;\n\n ['x-component']?: string;\n\n ['x-component-props']?: Record<string, unknown>;\n\n ['x-decorator']?: string;\n\n ['x-decorator-props']?: Record<string, unknown>;\n\n [key: string]: any;\n\n path: string[] = [];\n\n state = new ReactiveState<FormSchemaModelState>({ disabled: false });\n\n get componentType() {\n return this['x-component'];\n }\n\n get componentProps() {\n return this['x-component-props'];\n }\n\n get decoratorType() {\n return this['x-decorator'];\n }\n\n get decoratorProps() {\n return this['x-decorator-props'];\n }\n\n get uniqueName() {\n return getUniqueFieldName(...this.path);\n }\n\n constructor(json: FormSchema, path: string[] = []) {\n this.fromJSON(json);\n this.path = path;\n }\n\n private fromJSON(json: FormSchema) {\n Object.entries(json).forEach(([key, value]) => {\n this[key] = value;\n });\n }\n\n getPropertyList() {\n const orderProperties: FormSchemaModel[] = [];\n const unOrderProperties: FormSchemaModel[] = [];\n Object.entries(this.properties || {}).forEach(([key, item]) => {\n const index = item['x-index'];\n const defaultValues = this.defaultValue;\n /**\n * The upper layer's default value has a higher priority than its own default value,\n * because the upper layer's default value ultimately comes from the outside world.\n */\n if (typeof defaultValues === 'object' && defaultValues !== null && key in defaultValues) {\n item.defaultValue = defaultValues[key];\n }\n const current = new FormSchemaModel(item, mergeFieldPath(this.path, key));\n if (index !== undefined && !isNaN(index)) {\n orderProperties[index] = current;\n } else {\n unOrderProperties.push(current);\n }\n });\n return orderProperties.concat(unOrderProperties).filter((item) => !!item);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FieldModelContext } from '../contexts';\n\nexport const useFieldModel = () => useContext(FieldModelContext);\nexport const useFieldState = () => useObserve(useFieldModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createContext } from 'react';\n\nimport type { FormComponents } from './types';\nimport type { FormSchemaModel } from './model';\n\n/** Model context for each form item */\nexport const FieldModelContext = createContext<FormSchemaModel>({} as any);\n/** The form's model context */\nexport const FormModelContext = createContext<FormSchemaModel>({} as any);\n/** Context of material component map */\nexport const ComponentsContext = createContext<FormComponents>({});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FormModelContext } from '../contexts';\n\nexport const useFormModel = () => useContext(FormModelContext);\nexport const useFormState = () => useObserve(useFormModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState } from 'react';\n\nimport type { FormComponents } from '../types';\nimport { FormSchemaModel } from '../model';\nimport { ComponentsContext, FormModelContext } from '../contexts';\nimport { RecursionField } from './recursion-field';\n\nexport interface SchemaFieldProps {\n model: FormSchemaModel;\n components: FormComponents;\n}\nexport const SchemaField: React.FC<React.PropsWithChildren<SchemaFieldProps>> = ({\n components,\n model,\n children,\n}) => {\n /** Only initialized once, dynamic is not supported */\n const [innerComponents] = useState(() => components);\n return (\n <ComponentsContext.Provider value={innerComponents}>\n <FormModelContext.Provider value={model}>\n <RecursionField model={model} />\n {children}\n </FormModelContext.Provider>\n </ComponentsContext.Provider>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useMemo } from 'react';\n\nimport { FormSchemaModel } from '../model';\nimport { ObjectField } from './object-field';\nimport { GeneralField } from './general-field';\n\ninterface RecursionFieldProps {\n model: FormSchemaModel;\n}\n\nexport const RecursionField: React.FC<RecursionFieldProps> = ({ model }) => {\n const properties = useMemo(() => model.getPropertyList(), [model]);\n\n /** general field has no children */\n if (model.type !== 'object') {\n return <GeneralField model={model} />;\n }\n\n return (\n <ObjectField model={model}>\n {properties.map((item) => (\n <RecursionField key={item.uniqueName} model={item} />\n ))}\n </ObjectField>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\nimport React from 'react';\n\nimport { useFormState } from '../hooks/use-form';\nimport { useFieldModel, useFieldState } from '../hooks/use-field';\nimport { ComponentsContext } from '../contexts';\n\ninterface ReactiveFieldProps {\n componentProps?: Record<string, unknown>;\n decoratorProps?: Record<string, unknown>;\n}\n\nexport const ReactiveField: React.FC<React.PropsWithChildren<ReactiveFieldProps>> = (props) => {\n const formState = useFormState();\n const model = useFieldModel();\n const modelState = useFieldState();\n const components = useContext(ComponentsContext);\n\n const disabled = modelState.disabled || formState.disabled;\n const componentRender = () => {\n if (!model.componentType || !components[model.componentType]) {\n return props.children;\n }\n return React.createElement(\n components[model.componentType],\n {\n disabled,\n ...model.componentProps,\n ...props.componentProps,\n },\n props.children\n );\n };\n\n const decoratorRender = (children: React.ReactNode) => {\n if (!model.decoratorType || !components[model.decoratorType]) {\n return <>{children}</>;\n }\n return React.createElement(\n components[model.decoratorType],\n {\n type: model.type,\n required: model.required,\n ...model.decoratorProps,\n ...props.decoratorProps,\n },\n children\n );\n };\n\n return decoratorRender(componentRender());\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\nimport { ReactiveField } from './reactive-field';\n\nexport interface ObjectFieldProps {\n model: FormSchemaModel;\n}\n\nexport const ObjectField: React.FC<React.PropsWithChildren<ObjectFieldProps>> = ({\n model,\n children,\n}) => (\n <FieldModelContext.Provider value={model}>\n <ReactiveField>{children}</ReactiveField>\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Field } from '@flowgram.ai/form';\n\nimport { ReactiveField } from './reactive-field';\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\n\nexport interface GeneralFieldProps {\n model: FormSchemaModel;\n}\n\nexport const GeneralField: React.FC<GeneralFieldProps> = ({ model }) => (\n <FieldModelContext.Provider value={model}>\n <Field\n name={model.uniqueName}\n defaultValue={model.defaultValue}\n render={({ field, fieldState }) => (\n <ReactiveField\n componentProps={{\n value: field.value,\n onChange: field.onChange,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ...fieldState,\n }}\n decoratorProps={fieldState}\n />\n )}\n />\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { SchemaField, type SchemaFieldProps } from './schema-field';\nimport { FormComponents } from '../types';\n\ntype InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &\n Pick<Partial<SchemaFieldProps>, 'components'>;\n\nexport interface CreateSchemaFieldOptions {\n components?: FormComponents;\n}\nexport const createSchemaField = (options: CreateSchemaFieldOptions) => {\n const InnerSchemaField: React.FC<PropsWithChildren<InnerSchemaFieldProps>> = ({\n components,\n ...props\n }) => (\n <SchemaField\n components={{\n ...options.components,\n ...components,\n }}\n {...props}\n />\n );\n\n return InnerSchemaField;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunFormEntity } from './form';\n\nexport const TestRunFormFactory = Symbol('TestRunFormFactory');\nexport type TestRunFormFactory = () => TestRunFormEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\n\nimport type { TestRunFormEntity } from './form';\nimport { TestRunFormFactory } from './factory';\n\n@injectable()\nexport class TestRunFormManager {\n @inject(TestRunFormFactory) private readonly factory: TestRunFormFactory;\n\n private entities = new Map<string, TestRunFormEntity>();\n\n createForm() {\n return this.factory();\n }\n\n getForm(id: string) {\n return this.entities.get(id);\n }\n\n getAllForm() {\n return Array.from(this.entities);\n }\n\n disposeForm(id: string) {\n const form = this.entities.get(id);\n if (!form) {\n return;\n }\n form.dispose();\n this.entities.delete(id);\n }\n\n disposeAllForm() {\n for (const id of this.entities.keys()) {\n this.disposeForm(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity, FlowNodeType } from '@flowgram.ai/document';\n\nimport { TestRunPipelineFactory } from './pipeline/factory';\nimport { TestRunFormManager } from './form';\nimport { FormSchema } from '../form-engine';\nimport { TestRunPipelineEntity, type TestRunPipelineEntityOptions } from './pipeline';\nimport { TestRunConfig } from './config';\n\n@injectable()\nexport class TestRunService {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n @inject(TestRunPipelineFactory) private readonly pipelineFactory: TestRunPipelineFactory;\n\n @inject(TestRunFormManager) readonly formManager: TestRunFormManager;\n\n pipelineEntities = new Map<string, TestRunPipelineEntity>();\n\n pipelineBindings = new Map<string, Disposable>();\n\n onPipelineProgressEmitter = new Emitter();\n\n onPipelineProgress = this.onPipelineProgressEmitter.event;\n\n onPipelineFinishedEmitter = new Emitter();\n\n onPipelineFinished = this.onPipelineFinishedEmitter.event;\n\n public isEnabled(nodeType: FlowNodeType) {\n const config = this.config.nodes[nodeType];\n return config && config?.enabled !== false;\n }\n\n async toSchema(node: FlowNodeEntity) {\n const nodeType = node.flowNodeType;\n const config = this.config.nodes[nodeType];\n if (!this.isEnabled(nodeType)) {\n return {};\n }\n const properties =\n typeof config.properties === 'function'\n ? await config.properties({ node })\n : config.properties;\n\n return {\n type: 'object',\n properties,\n };\n }\n\n createFormWithSchema(schema: FormSchema) {\n const form = this.formManager.createForm();\n form.init({ schema });\n return form;\n }\n\n async createForm(node: FlowNodeEntity) {\n const schema = await this.toSchema(node);\n return this.createFormWithSchema(schema);\n }\n\n createPipeline(options: TestRunPipelineEntityOptions) {\n const pipeline = this.pipelineFactory();\n this.pipelineEntities.set(pipeline.id, pipeline);\n pipeline.init(options);\n return pipeline;\n }\n\n disposePipeline(id: string) {\n const pipeline = this.pipelineEntities.get(id);\n if (pipeline) {\n this.pipelineEntities.delete(id);\n pipeline.dispose();\n }\n }\n\n connectPipeline(pipeline: TestRunPipelineEntity) {\n if (this.pipelineBindings.get(pipeline.id)) {\n return;\n }\n const disposable = new DisposableCollection(\n pipeline.onProgress(this.onPipelineProgressEmitter.fire.bind(this.onPipelineProgressEmitter)),\n pipeline.onFinished(this.onPipelineFinishedEmitter.fire.bind(this.onPipelineFinishedEmitter))\n );\n this.pipelineBindings.set(pipeline.id, disposable);\n }\n\n disconnectPipeline(id: string) {\n if (this.pipelineBindings.has(id)) {\n const disposable = this.pipelineBindings.get(id);\n disposable?.dispose();\n this.pipelineBindings.delete(id);\n }\n }\n\n disconnectAllPipeline() {\n for (const id of this.pipelineBindings.keys()) {\n this.disconnectPipeline(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunPipelineEntity } from './pipeline';\n\nexport const TestRunPipelineFactory = Symbol('TestRunPipelineFactory');\nexport type TestRunPipelineFactory = () => TestRunPipelineEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { StoreApi } from 'zustand';\nimport { nanoid } from 'nanoid';\nimport { injectable, interfaces } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { Tap } from './tap';\nimport type { TestRunPipelinePlugin } from './plugin';\nimport { StoreService } from '../store';\nexport interface TestRunPipelineEntityOptions {\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\ninterface TestRunPipelineEntityState<T = any> {\n status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';\n data?: T;\n result?: any;\n getData: () => T;\n setData: (next: any) => void;\n}\n\nexport interface TestRunPipelineEntityCtx<T = any> {\n id: string;\n store: StoreApi<TestRunPipelineEntityState<T>>;\n operate: {\n update: (data: any) => void;\n cancel: () => void;\n };\n}\n\nconst initialState: Omit<TestRunPipelineEntityState, 'getData' | 'setData'> = {\n status: 'idle',\n data: {},\n};\n\n@injectable()\nexport class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {\n container: interfaces.Container | undefined;\n\n id = nanoid();\n\n plugins: TestRunPipelinePlugin[] = [];\n\n prepare = new Tap<TestRunPipelineEntityCtx>();\n\n private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n private progress?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n get status() {\n return this.getState().status;\n }\n\n set status(next: TestRunPipelineEntityState['status']) {\n this.setState({ status: next });\n }\n\n onProgressEmitter = new Emitter<any>();\n\n onProgress = this.onProgressEmitter.event;\n\n onFinishedEmitter = new Emitter();\n\n onFinished = this.onFinishedEmitter.event;\n\n constructor() {\n super((set, get) => ({\n ...initialState,\n getData: () => get().data || {},\n setData: (next: any) => set((state) => ({ ...state, data: { ...state.data, ...next } })),\n }));\n }\n\n public init(options: TestRunPipelineEntityOptions) {\n if (!this.container) {\n return;\n }\n const { plugins } = options;\n for (const PluginClass of plugins) {\n const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);\n plugin.apply(this);\n this.plugins.push(plugin);\n }\n }\n\n public registerExecute(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.execute = fn;\n }\n\n public registerProgress(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.progress = fn;\n }\n\n async start<T>(options?: { data: T }) {\n const { data } = options || {};\n if (this.status !== 'idle') {\n return;\n }\n /** initialization data */\n this.setState({ data });\n const ctx: TestRunPipelineEntityCtx = {\n id: this.id,\n store: this.store,\n operate: {\n update: this.update.bind(this),\n cancel: this.cancel.bind(this),\n },\n };\n\n this.status = 'preparing';\n await this.prepare.call(ctx);\n if (this.status !== 'preparing') {\n return;\n }\n\n this.status = 'executing';\n if (this.execute) {\n await this.execute(ctx);\n }\n if (this.progress) {\n await this.progress(ctx);\n }\n if (this.status === 'executing') {\n this.status = 'finished';\n this.onFinishedEmitter.fire(this.getState().result);\n }\n }\n\n update(result: any) {\n this.setState({ result });\n this.onProgressEmitter.fire(result);\n }\n\n cancel() {\n if ((this.status = 'preparing')) {\n this.prepare.freeze();\n }\n this.status = 'canceled';\n }\n\n dispose() {\n this.status = 'disposed';\n this.plugins.forEach((p) => {\n if (p.dispose) {\n p.dispose();\n }\n });\n this.onProgressEmitter.dispose();\n this.onFinishedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MaybePromise } from '../../types';\n\ninterface TapValue<T> {\n name: string;\n fn: (arg: T) => MaybePromise<void>;\n}\n\nexport class Tap<T> {\n private taps: TapValue<T>[] = [];\n\n private frozen = false;\n\n tap(name: string, fn: TapValue<T>['fn']) {\n this.taps.push({ name, fn });\n }\n\n async call(ctx: T) {\n for (const tap of this.taps) {\n if (this.frozen) {\n return;\n }\n await tap.fn(ctx);\n }\n }\n\n freeze() {\n this.frozen = true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createStore } from 'zustand/vanilla';\nimport type { StoreApi, StateCreator } from 'zustand';\nimport { injectable, unmanaged } from 'inversify';\n/**\n * 包含 Store 的 Service\n */\n@injectable()\nexport class StoreService<State> {\n store: StoreApi<State>;\n\n get getState() {\n return this.store.getState.bind(this.store);\n }\n\n get setState() {\n return this.store.setState.bind(this.store);\n }\n\n constructor(@unmanaged() stateCreator: StateCreator<State>) {\n this.store = createStore(stateCreator);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { DisposableCollection } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { TestRunFormEntity } from '../../services/form/form';\nimport { FormEngineProps, isFormEmpty } from '../../form-engine';\nimport { useTestRunService } from './use-test-run-service';\n\ninterface UseFormOptions {\n node?: FlowNodeEntity;\n /** form loading */\n loadingRenderer?: React.ReactNode;\n /** form empty */\n emptyRenderer?: React.ReactNode;\n defaultValues?: FormEngineProps['defaultValues'];\n onMounted?: FormEngineProps['onMounted'];\n onUnmounted?: FormEngineProps['onUnmounted'];\n onFormValuesChange?: FormEngineProps['onFormValuesChange'];\n}\n\nexport const useCreateForm = ({\n node,\n loadingRenderer,\n emptyRenderer,\n defaultValues,\n onMounted,\n onUnmounted,\n onFormValuesChange,\n}: UseFormOptions) => {\n const testRun = useTestRunService();\n const [loading, setLoading] = useState(false);\n const [form, setForm] = useState<TestRunFormEntity | null>(null);\n const renderer = useMemo(() => {\n if (loading || !form) {\n return loadingRenderer;\n }\n\n const isEmpty = isFormEmpty(form.schema);\n\n return form.render({\n defaultValues,\n onFormValuesChange,\n children: isEmpty ? emptyRenderer : null,\n });\n }, [form, loading]);\n\n const compute = async () => {\n if (!node) {\n return;\n }\n try {\n setLoading(true);\n const formEntity = await testRun.createForm(node);\n setForm(formEntity);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n compute();\n }, [node]);\n\n useEffect(() => {\n if (!form) {\n return;\n }\n const disposable = new DisposableCollection(\n form.onFormMounted((data) => {\n onMounted?.(data);\n }),\n form.onFormUnmounted(() => {\n onUnmounted?.();\n })\n );\n return () => disposable.dispose();\n }, [form]);\n\n return {\n renderer,\n loading,\n form,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { TestRunService } from '../../services/test-run';\n\nexport const useTestRunService = () => useService<TestRunService>(TestRunService);\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAS,2BAA2B;;;ACApC,SAAS,iBAAAA,sBAAqC;AAE9C,SAAS,cAAc;AACvB,SAAS,YAAY,cAAc;AACnC,SAAS,eAAe;;;ACqBjB,IAAM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","useContext","useContext","jsx","jsx","jsx","useMemo","jsx","jsx","jsx","SchemaField","createElement","inject","injectable","inject","injectable","inject","injectable","Emitter","Emitter","inject","injectable","nanoid","injectable","Emitter","injectable","injectable","nanoid","Emitter","injectable","useEffect","useMemo","useState","DisposableCollection","useCreateForm","useState","useMemo","useEffect","DisposableCollection"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -175,6 +175,7 @@ declare class Tap<T> {
|
|
|
175
175
|
interface TestRunPipelinePlugin {
|
|
176
176
|
name: string;
|
|
177
177
|
apply(pipeline: TestRunPipelineEntity): void;
|
|
178
|
+
dispose?: () => void;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/**
|
|
@@ -199,7 +200,7 @@ interface TestRunPipelineEntityOptions {
|
|
|
199
200
|
plugins: (new () => TestRunPipelinePlugin)[];
|
|
200
201
|
}
|
|
201
202
|
interface TestRunPipelineEntityState<T = any> {
|
|
202
|
-
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished';
|
|
203
|
+
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';
|
|
203
204
|
data?: T;
|
|
204
205
|
result?: any;
|
|
205
206
|
getData: () => T;
|
|
@@ -216,6 +217,7 @@ interface TestRunPipelineEntityCtx<T = any> {
|
|
|
216
217
|
declare class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {
|
|
217
218
|
container: interfaces.Container | undefined;
|
|
218
219
|
id: string;
|
|
220
|
+
plugins: TestRunPipelinePlugin[];
|
|
219
221
|
prepare: Tap<TestRunPipelineEntityCtx<any>>;
|
|
220
222
|
private execute?;
|
|
221
223
|
private progress?;
|
|
@@ -258,6 +260,7 @@ declare class TestRunService {
|
|
|
258
260
|
createFormWithSchema(schema: FormSchema): TestRunFormEntity;
|
|
259
261
|
createForm(node: FlowNodeEntity): Promise<TestRunFormEntity>;
|
|
260
262
|
createPipeline(options: TestRunPipelineEntityOptions): TestRunPipelineEntity;
|
|
263
|
+
disposePipeline(id: string): void;
|
|
261
264
|
connectPipeline(pipeline: TestRunPipelineEntity): void;
|
|
262
265
|
disconnectPipeline(id: string): void;
|
|
263
266
|
disconnectAllPipeline(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -175,6 +175,7 @@ declare class Tap<T> {
|
|
|
175
175
|
interface TestRunPipelinePlugin {
|
|
176
176
|
name: string;
|
|
177
177
|
apply(pipeline: TestRunPipelineEntity): void;
|
|
178
|
+
dispose?: () => void;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/**
|
|
@@ -199,7 +200,7 @@ interface TestRunPipelineEntityOptions {
|
|
|
199
200
|
plugins: (new () => TestRunPipelinePlugin)[];
|
|
200
201
|
}
|
|
201
202
|
interface TestRunPipelineEntityState<T = any> {
|
|
202
|
-
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished';
|
|
203
|
+
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';
|
|
203
204
|
data?: T;
|
|
204
205
|
result?: any;
|
|
205
206
|
getData: () => T;
|
|
@@ -216,6 +217,7 @@ interface TestRunPipelineEntityCtx<T = any> {
|
|
|
216
217
|
declare class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {
|
|
217
218
|
container: interfaces.Container | undefined;
|
|
218
219
|
id: string;
|
|
220
|
+
plugins: TestRunPipelinePlugin[];
|
|
219
221
|
prepare: Tap<TestRunPipelineEntityCtx<any>>;
|
|
220
222
|
private execute?;
|
|
221
223
|
private progress?;
|
|
@@ -258,6 +260,7 @@ declare class TestRunService {
|
|
|
258
260
|
createFormWithSchema(schema: FormSchema): TestRunFormEntity;
|
|
259
261
|
createForm(node: FlowNodeEntity): Promise<TestRunFormEntity>;
|
|
260
262
|
createPipeline(options: TestRunPipelineEntityOptions): TestRunPipelineEntity;
|
|
263
|
+
disposePipeline(id: string): void;
|
|
261
264
|
connectPipeline(pipeline: TestRunPipelineEntity): void;
|
|
262
265
|
disconnectPipeline(id: string): void;
|
|
263
266
|
disconnectAllPipeline(): void;
|
package/dist/index.js
CHANGED
|
@@ -500,6 +500,13 @@ var TestRunService = class {
|
|
|
500
500
|
pipeline.init(options);
|
|
501
501
|
return pipeline;
|
|
502
502
|
}
|
|
503
|
+
disposePipeline(id) {
|
|
504
|
+
const pipeline = this.pipelineEntities.get(id);
|
|
505
|
+
if (pipeline) {
|
|
506
|
+
this.pipelineEntities.delete(id);
|
|
507
|
+
pipeline.dispose();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
503
510
|
connectPipeline(pipeline) {
|
|
504
511
|
if (this.pipelineBindings.get(pipeline.id)) {
|
|
505
512
|
return;
|
|
@@ -595,6 +602,7 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
595
602
|
setData: (next) => set((state) => ({ ...state, data: { ...state.data, ...next } }))
|
|
596
603
|
}));
|
|
597
604
|
this.id = (0, import_nanoid2.nanoid)();
|
|
605
|
+
this.plugins = [];
|
|
598
606
|
this.prepare = new Tap();
|
|
599
607
|
this.onProgressEmitter = new import_utils6.Emitter();
|
|
600
608
|
this.onProgress = this.onProgressEmitter.event;
|
|
@@ -615,6 +623,7 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
615
623
|
for (const PluginClass of plugins) {
|
|
616
624
|
const plugin = this.container.resolve(PluginClass);
|
|
617
625
|
plugin.apply(this);
|
|
626
|
+
this.plugins.push(plugin);
|
|
618
627
|
}
|
|
619
628
|
}
|
|
620
629
|
registerExecute(fn) {
|
|
@@ -665,6 +674,14 @@ var TestRunPipelineEntity = class extends StoreService {
|
|
|
665
674
|
this.status = "canceled";
|
|
666
675
|
}
|
|
667
676
|
dispose() {
|
|
677
|
+
this.status = "disposed";
|
|
678
|
+
this.plugins.forEach((p) => {
|
|
679
|
+
if (p.dispose) {
|
|
680
|
+
p.dispose();
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
this.onProgressEmitter.dispose();
|
|
684
|
+
this.onFinishedEmitter.dispose();
|
|
668
685
|
}
|
|
669
686
|
};
|
|
670
687
|
TestRunPipelineEntity = __decorateClass([
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/create-test-run-plugin.ts","../src/services/form/form.ts","../src/services/config.ts","../src/form-engine/form/form.tsx","../src/form-engine/hooks/use-create-form.ts","../src/form-engine/utils.ts","../src/form-engine/model/index.ts","../src/form-engine/hooks/use-field.ts","../src/form-engine/contexts.ts","../src/form-engine/hooks/use-form.ts","../src/form-engine/fields/schema-field.tsx","../src/form-engine/fields/recursion-field.tsx","../src/form-engine/fields/reactive-field.tsx","../src/form-engine/fields/object-field.tsx","../src/form-engine/fields/general-field.tsx","../src/form-engine/fields/create-field.tsx","../src/services/form/factory.ts","../src/services/form/manager.ts","../src/services/test-run.ts","../src/services/pipeline/factory.ts","../src/services/pipeline/pipeline.ts","../src/services/pipeline/tap.ts","../src/services/store.ts","../src/reactive/hooks/use-create-form.ts","../src/reactive/hooks/use-test-run-service.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { createTestRunPlugin } from './create-test-run-plugin';\nexport { useCreateForm, useTestRunService } from './reactive';\n\nexport {\n FormEngine,\n connect,\n type FormInstance,\n type FormEngineProps,\n type FormSchema,\n type FormComponentProps,\n} from './form-engine';\n\nexport {\n type TestRunPipelinePlugin,\n TestRunPipelineEntity,\n type TestRunPipelineEntityCtx,\n type TestRunConfig,\n} from './services';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';\nimport {\n TestRunService,\n TestRunPipelineEntity,\n TestRunPipelineFactory,\n TestRunConfig,\n defineConfig,\n} from './services';\n\nexport const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({\n onBind: ({ bind }, opt) => {\n /** service */\n bind(TestRunService).toSelf().inSingletonScope();\n /** config */\n bind(TestRunConfig).toConstantValue(defineConfig(opt));\n /** form manager */\n bind(TestRunFormManager).toSelf().inSingletonScope();\n /** form entity */\n bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {\n const e = context.container.resolve(TestRunFormEntity);\n return e;\n });\n /** pipeline entity */\n bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(\n (context) => () => {\n const e = context.container.resolve(TestRunPipelineEntity);\n e.container = context.container.createChild();\n return e;\n }\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement, type ReactNode } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport { injectable, inject } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { TestRunConfig } from '../config';\nimport { FormSchema, FormEngine, type FormInstance, type FormEngineProps } from '../../form-engine';\n\nexport type FormRenderProps = Omit<\n FormEngineProps,\n 'schema' | 'components' | 'onMounted' | 'onUnmounted'\n>;\n\n@injectable()\nexport class TestRunFormEntity {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n private _schema: FormSchema;\n\n private initialized = false;\n\n id = nanoid();\n\n form: FormInstance | null = null;\n\n onFormMountedEmitter = new Emitter<FormInstance>();\n\n onFormMounted = this.onFormMountedEmitter.event;\n\n onFormUnmountedEmitter = new Emitter<void>();\n\n onFormUnmounted = this.onFormUnmountedEmitter.event;\n\n get schema() {\n return this._schema;\n }\n\n init(options: { schema: FormSchema }) {\n if (this.initialized) return;\n\n this._schema = options.schema;\n this.initialized = true;\n }\n\n render(props?: FormRenderProps): ReactNode {\n if (!this.initialized) {\n return null;\n }\n const { children, ...restProps } = props || {};\n return createElement(\n FormEngine,\n {\n schema: this.schema,\n components: this.config.components,\n onMounted: (instance) => {\n this.form = instance;\n this.onFormMountedEmitter.fire(instance);\n },\n onUnmounted: this.onFormUnmountedEmitter.fire.bind(this.onFormUnmountedEmitter),\n ...restProps,\n },\n children\n );\n }\n\n dispose() {\n this._schema = {};\n this.form = null;\n this.onFormMountedEmitter.dispose();\n this.onFormUnmountedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FlowNodeType, FlowNodeEntity } from '@flowgram.ai/document';\n\nimport type { MaybePromise } from '../types';\nimport type { FormSchema, FormComponents } from '../form-engine';\nimport type { TestRunPipelinePlugin } from './pipeline';\n\ntype PropertiesFunctionParams = {\n node: FlowNodeEntity;\n};\nexport type NodeMap = Record<FlowNodeType, NodeTestConfig>;\nexport interface NodeTestConfig {\n /** Enable node TestRun */\n enabled?: boolean;\n /** Input schema properties */\n properties?:\n | Record<string, FormSchema>\n | ((params: PropertiesFunctionParams) => MaybePromise<Record<string, FormSchema>>);\n}\n\nexport interface TestRunConfig {\n components: FormComponents;\n nodes: NodeMap;\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\nexport const TestRunConfig = Symbol('TestRunConfig');\nexport const defineConfig = (config: Partial<TestRunConfig>) => {\n const defaultConfig: TestRunConfig = {\n components: {},\n nodes: {},\n plugins: [],\n };\n return {\n ...defaultConfig,\n ...config,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Form } from '@flowgram.ai/form';\n\nimport { FormSchema, FormComponents } from '../types';\nimport { useCreateForm, type UseCreateFormOptions } from '../hooks';\nimport { createSchemaField } from '../fields';\n\nconst SchemaField = createSchemaField({});\n\nexport type FormEngineProps = React.PropsWithChildren<\n {\n /** Form schema */\n schema: FormSchema;\n /** form material map */\n components?: FormComponents;\n } & UseCreateFormOptions\n>;\n\nexport const FormEngine: React.FC<FormEngineProps> = ({\n schema,\n components,\n children,\n ...props\n}) => {\n const { model, control } = useCreateForm(schema, props);\n\n return (\n <Form control={control}>\n <SchemaField model={model} components={components}>\n {children}\n </SchemaField>\n </Form>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo } from 'react';\n\nimport type { OnFormValuesChangePayload } from '@flowgram.ai/form-core';\nimport { createForm, ValidateTrigger, type IForm } from '@flowgram.ai/form';\n\nimport { createValidate } from '../utils';\nimport { FormSchema, FormSchemaValidate } from '../types';\nimport { FormSchemaModel } from '../model';\n\nexport interface FormInstance {\n model: FormSchemaModel;\n form: IForm;\n}\nexport interface UseCreateFormOptions {\n defaultValues?: any;\n validate?: Record<string, FormSchemaValidate>;\n validateTrigger?: ValidateTrigger;\n onMounted?: (form: FormInstance) => void;\n onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;\n onUnmounted?: () => void;\n}\n\nexport const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {\n const { form, control } = useMemo(\n () =>\n createForm({\n validate: {\n ...createValidate(schema),\n ...options.validate,\n },\n validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,\n }),\n [schema]\n );\n\n const model = useMemo(\n () => new FormSchemaModel({ type: 'object', ...schema, defaultValue: options.defaultValues }),\n [schema]\n );\n\n /** Lifecycle and event binding */\n useEffect(() => {\n if (options.onMounted) {\n options.onMounted({ model, form });\n }\n const disposable = control._formModel.onFormValuesChange((payload) => {\n if (options.onFormValuesChange) {\n options.onFormValuesChange(payload);\n }\n });\n return () => {\n disposable.dispose();\n if (options.onUnmounted) {\n options.onUnmounted();\n }\n };\n }, [control]);\n\n return {\n form,\n control,\n model,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement } from 'react';\n\nimport type { FormSchema, FormSchemaValidate, FormComponentProps } from './types';\n\n/** Splice form item unique name */\nexport const getUniqueFieldName = (...args: (string | undefined)[]) =>\n args.filter((path) => path).join('.');\n\nexport const mergeFieldPath = (path?: string[], name?: string) =>\n [...(path || []), name].filter((i): i is string => Boolean(i));\n\n/** Create validation rules */\nexport const createValidate = (schema: FormSchema) => {\n const rules: Record<string, FormSchemaValidate> = {};\n\n visit(schema);\n\n return rules;\n\n function visit(current: FormSchema, name?: string) {\n if (name && current['x-validator']) {\n rules[name] = current['x-validator'];\n }\n if (current.type === 'object' && current.properties) {\n Object.entries(current.properties).forEach(([key, value]) => {\n visit(value, getUniqueFieldName(name, key));\n });\n }\n }\n};\n\nexport const connect = <T = any>(\n Component: React.FunctionComponent<any>,\n mapProps: (p: FormComponentProps) => T\n) => {\n const Connected = (props: FormComponentProps) => {\n const mappedProps = mapProps(props);\n return createElement(Component, mappedProps, (mappedProps as any).children);\n };\n\n return Connected;\n};\n\nexport const isFormEmpty = (schema: FormSchema) => {\n /** is not general field and not has children */\n const isEmpty = (s: FormSchema): boolean => {\n if (!s.type || s.type === 'object' || !s.name) {\n return Object.entries(schema.properties || {})\n .map(([key, value]) => ({\n name: key,\n ...value,\n }))\n .every(isFormEmpty);\n }\n return false;\n };\n\n return isEmpty(schema);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ReactiveState } from '@flowgram.ai/reactive';\n\nimport { getUniqueFieldName, mergeFieldPath } from '../utils';\nimport { FormSchema, FormSchemaType, FormSchemaModelState } from '../types';\n\nexport class FormSchemaModel implements FormSchema {\n name?: string;\n\n type?: FormSchemaType;\n\n defaultValue?: any;\n\n properties?: Record<string, FormSchema>;\n\n ['x-index']?: number;\n\n ['x-component']?: string;\n\n ['x-component-props']?: Record<string, unknown>;\n\n ['x-decorator']?: string;\n\n ['x-decorator-props']?: Record<string, unknown>;\n\n [key: string]: any;\n\n path: string[] = [];\n\n state = new ReactiveState<FormSchemaModelState>({ disabled: false });\n\n get componentType() {\n return this['x-component'];\n }\n\n get componentProps() {\n return this['x-component-props'];\n }\n\n get decoratorType() {\n return this['x-decorator'];\n }\n\n get decoratorProps() {\n return this['x-decorator-props'];\n }\n\n get uniqueName() {\n return getUniqueFieldName(...this.path);\n }\n\n constructor(json: FormSchema, path: string[] = []) {\n this.fromJSON(json);\n this.path = path;\n }\n\n private fromJSON(json: FormSchema) {\n Object.entries(json).forEach(([key, value]) => {\n this[key] = value;\n });\n }\n\n getPropertyList() {\n const orderProperties: FormSchemaModel[] = [];\n const unOrderProperties: FormSchemaModel[] = [];\n Object.entries(this.properties || {}).forEach(([key, item]) => {\n const index = item['x-index'];\n const defaultValues = this.defaultValue;\n /**\n * The upper layer's default value has a higher priority than its own default value,\n * because the upper layer's default value ultimately comes from the outside world.\n */\n if (typeof defaultValues === 'object' && defaultValues !== null && key in defaultValues) {\n item.defaultValue = defaultValues[key];\n }\n const current = new FormSchemaModel(item, mergeFieldPath(this.path, key));\n if (index !== undefined && !isNaN(index)) {\n orderProperties[index] = current;\n } else {\n unOrderProperties.push(current);\n }\n });\n return orderProperties.concat(unOrderProperties).filter((item) => !!item);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FieldModelContext } from '../contexts';\n\nexport const useFieldModel = () => useContext(FieldModelContext);\nexport const useFieldState = () => useObserve(useFieldModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createContext } from 'react';\n\nimport type { FormComponents } from './types';\nimport type { FormSchemaModel } from './model';\n\n/** Model context for each form item */\nexport const FieldModelContext = createContext<FormSchemaModel>({} as any);\n/** The form's model context */\nexport const FormModelContext = createContext<FormSchemaModel>({} as any);\n/** Context of material component map */\nexport const ComponentsContext = createContext<FormComponents>({});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FormModelContext } from '../contexts';\n\nexport const useFormModel = () => useContext(FormModelContext);\nexport const useFormState = () => useObserve(useFormModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState } from 'react';\n\nimport type { FormComponents } from '../types';\nimport { FormSchemaModel } from '../model';\nimport { ComponentsContext, FormModelContext } from '../contexts';\nimport { RecursionField } from './recursion-field';\n\nexport interface SchemaFieldProps {\n model: FormSchemaModel;\n components: FormComponents;\n}\nexport const SchemaField: React.FC<React.PropsWithChildren<SchemaFieldProps>> = ({\n components,\n model,\n children,\n}) => {\n /** Only initialized once, dynamic is not supported */\n const [innerComponents] = useState(() => components);\n return (\n <ComponentsContext.Provider value={innerComponents}>\n <FormModelContext.Provider value={model}>\n <RecursionField model={model} />\n {children}\n </FormModelContext.Provider>\n </ComponentsContext.Provider>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useMemo } from 'react';\n\nimport { FormSchemaModel } from '../model';\nimport { ObjectField } from './object-field';\nimport { GeneralField } from './general-field';\n\ninterface RecursionFieldProps {\n model: FormSchemaModel;\n}\n\nexport const RecursionField: React.FC<RecursionFieldProps> = ({ model }) => {\n const properties = useMemo(() => model.getPropertyList(), [model]);\n\n /** general field has no children */\n if (model.type !== 'object') {\n return <GeneralField model={model} />;\n }\n\n return (\n <ObjectField model={model}>\n {properties.map((item) => (\n <RecursionField key={item.uniqueName} model={item} />\n ))}\n </ObjectField>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\nimport React from 'react';\n\nimport { useFormState } from '../hooks/use-form';\nimport { useFieldModel, useFieldState } from '../hooks/use-field';\nimport { ComponentsContext } from '../contexts';\n\ninterface ReactiveFieldProps {\n componentProps?: Record<string, unknown>;\n decoratorProps?: Record<string, unknown>;\n}\n\nexport const ReactiveField: React.FC<React.PropsWithChildren<ReactiveFieldProps>> = (props) => {\n const formState = useFormState();\n const model = useFieldModel();\n const modelState = useFieldState();\n const components = useContext(ComponentsContext);\n\n const disabled = modelState.disabled || formState.disabled;\n const componentRender = () => {\n if (!model.componentType || !components[model.componentType]) {\n return props.children;\n }\n return React.createElement(\n components[model.componentType],\n {\n disabled,\n ...model.componentProps,\n ...props.componentProps,\n },\n props.children\n );\n };\n\n const decoratorRender = (children: React.ReactNode) => {\n if (!model.decoratorType || !components[model.decoratorType]) {\n return <>{children}</>;\n }\n return React.createElement(\n components[model.decoratorType],\n {\n type: model.type,\n required: model.required,\n ...model.decoratorProps,\n ...props.decoratorProps,\n },\n children\n );\n };\n\n return decoratorRender(componentRender());\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\nimport { ReactiveField } from './reactive-field';\n\nexport interface ObjectFieldProps {\n model: FormSchemaModel;\n}\n\nexport const ObjectField: React.FC<React.PropsWithChildren<ObjectFieldProps>> = ({\n model,\n children,\n}) => (\n <FieldModelContext.Provider value={model}>\n <ReactiveField>{children}</ReactiveField>\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Field } from '@flowgram.ai/form';\n\nimport { ReactiveField } from './reactive-field';\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\n\nexport interface GeneralFieldProps {\n model: FormSchemaModel;\n}\n\nexport const GeneralField: React.FC<GeneralFieldProps> = ({ model }) => (\n <FieldModelContext.Provider value={model}>\n <Field\n name={model.uniqueName}\n defaultValue={model.defaultValue}\n render={({ field, fieldState }) => (\n <ReactiveField\n componentProps={{\n value: field.value,\n onChange: field.onChange,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ...fieldState,\n }}\n decoratorProps={fieldState}\n />\n )}\n />\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { SchemaField, type SchemaFieldProps } from './schema-field';\nimport { FormComponents } from '../types';\n\ntype InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &\n Pick<Partial<SchemaFieldProps>, 'components'>;\n\nexport interface CreateSchemaFieldOptions {\n components?: FormComponents;\n}\nexport const createSchemaField = (options: CreateSchemaFieldOptions) => {\n const InnerSchemaField: React.FC<PropsWithChildren<InnerSchemaFieldProps>> = ({\n components,\n ...props\n }) => (\n <SchemaField\n components={{\n ...options.components,\n ...components,\n }}\n {...props}\n />\n );\n\n return InnerSchemaField;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunFormEntity } from './form';\n\nexport const TestRunFormFactory = Symbol('TestRunFormFactory');\nexport type TestRunFormFactory = () => TestRunFormEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\n\nimport type { TestRunFormEntity } from './form';\nimport { TestRunFormFactory } from './factory';\n\n@injectable()\nexport class TestRunFormManager {\n @inject(TestRunFormFactory) private readonly factory: TestRunFormFactory;\n\n private entities = new Map<string, TestRunFormEntity>();\n\n createForm() {\n return this.factory();\n }\n\n getForm(id: string) {\n return this.entities.get(id);\n }\n\n getAllForm() {\n return Array.from(this.entities);\n }\n\n disposeForm(id: string) {\n const form = this.entities.get(id);\n if (!form) {\n return;\n }\n form.dispose();\n this.entities.delete(id);\n }\n\n disposeAllForm() {\n for (const id of this.entities.keys()) {\n this.disposeForm(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity, FlowNodeType } from '@flowgram.ai/document';\n\nimport { TestRunPipelineFactory } from './pipeline/factory';\nimport { TestRunFormManager } from './form';\nimport { FormSchema } from '../form-engine';\nimport { TestRunPipelineEntity, type TestRunPipelineEntityOptions } from './pipeline';\nimport { TestRunConfig } from './config';\n\n@injectable()\nexport class TestRunService {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n @inject(TestRunPipelineFactory) private readonly pipelineFactory: TestRunPipelineFactory;\n\n @inject(TestRunFormManager) readonly formManager: TestRunFormManager;\n\n pipelineEntities = new Map<string, TestRunPipelineEntity>();\n\n pipelineBindings = new Map<string, Disposable>();\n\n onPipelineProgressEmitter = new Emitter();\n\n onPipelineProgress = this.onPipelineProgressEmitter.event;\n\n onPipelineFinishedEmitter = new Emitter();\n\n onPipelineFinished = this.onPipelineFinishedEmitter.event;\n\n public isEnabled(nodeType: FlowNodeType) {\n const config = this.config.nodes[nodeType];\n return config && config?.enabled !== false;\n }\n\n async toSchema(node: FlowNodeEntity) {\n const nodeType = node.flowNodeType;\n const config = this.config.nodes[nodeType];\n if (!this.isEnabled(nodeType)) {\n return {};\n }\n const properties =\n typeof config.properties === 'function'\n ? await config.properties({ node })\n : config.properties;\n\n return {\n type: 'object',\n properties,\n };\n }\n\n createFormWithSchema(schema: FormSchema) {\n const form = this.formManager.createForm();\n form.init({ schema });\n return form;\n }\n\n async createForm(node: FlowNodeEntity) {\n const schema = await this.toSchema(node);\n return this.createFormWithSchema(schema);\n }\n\n createPipeline(options: TestRunPipelineEntityOptions) {\n const pipeline = this.pipelineFactory();\n this.pipelineEntities.set(pipeline.id, pipeline);\n pipeline.init(options);\n return pipeline;\n }\n\n connectPipeline(pipeline: TestRunPipelineEntity) {\n if (this.pipelineBindings.get(pipeline.id)) {\n return;\n }\n const disposable = new DisposableCollection(\n pipeline.onProgress(this.onPipelineProgressEmitter.fire.bind(this.onPipelineProgressEmitter)),\n pipeline.onFinished(this.onPipelineFinishedEmitter.fire.bind(this.onPipelineFinishedEmitter))\n );\n this.pipelineBindings.set(pipeline.id, disposable);\n }\n\n disconnectPipeline(id: string) {\n if (this.pipelineBindings.has(id)) {\n const disposable = this.pipelineBindings.get(id);\n disposable?.dispose();\n this.pipelineBindings.delete(id);\n }\n }\n\n disconnectAllPipeline() {\n for (const id of this.pipelineBindings.keys()) {\n this.disconnectPipeline(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunPipelineEntity } from './pipeline';\n\nexport const TestRunPipelineFactory = Symbol('TestRunPipelineFactory');\nexport type TestRunPipelineFactory = () => TestRunPipelineEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { StoreApi } from 'zustand';\nimport { nanoid } from 'nanoid';\nimport { injectable, interfaces } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { Tap } from './tap';\nimport type { TestRunPipelinePlugin } from './plugin';\nimport { StoreService } from '../store';\nexport interface TestRunPipelineEntityOptions {\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\ninterface TestRunPipelineEntityState<T = any> {\n status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished';\n data?: T;\n result?: any;\n getData: () => T;\n setData: (next: any) => void;\n}\n\nexport interface TestRunPipelineEntityCtx<T = any> {\n id: string;\n store: StoreApi<TestRunPipelineEntityState<T>>;\n operate: {\n update: (data: any) => void;\n cancel: () => void;\n };\n}\n\nconst initialState: Omit<TestRunPipelineEntityState, 'getData' | 'setData'> = {\n status: 'idle',\n data: {},\n};\n\n@injectable()\nexport class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {\n container: interfaces.Container | undefined;\n\n id = nanoid();\n\n prepare = new Tap<TestRunPipelineEntityCtx>();\n\n private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n private progress?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n get status() {\n return this.getState().status;\n }\n\n set status(next: TestRunPipelineEntityState['status']) {\n this.setState({ status: next });\n }\n\n onProgressEmitter = new Emitter<any>();\n\n onProgress = this.onProgressEmitter.event;\n\n onFinishedEmitter = new Emitter();\n\n onFinished = this.onFinishedEmitter.event;\n\n constructor() {\n super((set, get) => ({\n ...initialState,\n getData: () => get().data || {},\n setData: (next: any) => set((state) => ({ ...state, data: { ...state.data, ...next } })),\n }));\n }\n\n public init(options: TestRunPipelineEntityOptions) {\n if (!this.container) {\n return;\n }\n const { plugins } = options;\n for (const PluginClass of plugins) {\n const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);\n plugin.apply(this);\n }\n }\n\n public registerExecute(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.execute = fn;\n }\n\n public registerProgress(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.progress = fn;\n }\n\n async start<T>(options?: { data: T }) {\n const { data } = options || {};\n if (this.status !== 'idle') {\n return;\n }\n /** initialization data */\n this.setState({ data });\n const ctx: TestRunPipelineEntityCtx = {\n id: this.id,\n store: this.store,\n operate: {\n update: this.update.bind(this),\n cancel: this.cancel.bind(this),\n },\n };\n\n this.status = 'preparing';\n await this.prepare.call(ctx);\n if (this.status !== 'preparing') {\n return;\n }\n\n this.status = 'executing';\n if (this.execute) {\n await this.execute(ctx);\n }\n if (this.progress) {\n await this.progress(ctx);\n }\n if (this.status === 'executing') {\n this.status = 'finished';\n this.onFinishedEmitter.fire(this.getState().result);\n }\n }\n\n update(result: any) {\n this.setState({ result });\n this.onProgressEmitter.fire(result);\n }\n\n cancel() {\n if ((this.status = 'preparing')) {\n this.prepare.freeze();\n }\n this.status = 'canceled';\n }\n\n dispose() {}\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MaybePromise } from '../../types';\n\ninterface TapValue<T> {\n name: string;\n fn: (arg: T) => MaybePromise<void>;\n}\n\nexport class Tap<T> {\n private taps: TapValue<T>[] = [];\n\n private frozen = false;\n\n tap(name: string, fn: TapValue<T>['fn']) {\n this.taps.push({ name, fn });\n }\n\n async call(ctx: T) {\n for (const tap of this.taps) {\n if (this.frozen) {\n return;\n }\n await tap.fn(ctx);\n }\n }\n\n freeze() {\n this.frozen = true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createStore } from 'zustand/vanilla';\nimport type { StoreApi, StateCreator } from 'zustand';\nimport { injectable, unmanaged } from 'inversify';\n/**\n * 包含 Store 的 Service\n */\n@injectable()\nexport class StoreService<State> {\n store: StoreApi<State>;\n\n get getState() {\n return this.store.getState.bind(this.store);\n }\n\n get setState() {\n return this.store.setState.bind(this.store);\n }\n\n constructor(@unmanaged() stateCreator: StateCreator<State>) {\n this.store = createStore(stateCreator);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { DisposableCollection } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { TestRunFormEntity } from '../../services/form/form';\nimport { FormEngineProps, isFormEmpty } from '../../form-engine';\nimport { useTestRunService } from './use-test-run-service';\n\ninterface UseFormOptions {\n node?: FlowNodeEntity;\n /** form loading */\n loadingRenderer?: React.ReactNode;\n /** form empty */\n emptyRenderer?: React.ReactNode;\n defaultValues?: FormEngineProps['defaultValues'];\n onMounted?: FormEngineProps['onMounted'];\n onUnmounted?: FormEngineProps['onUnmounted'];\n onFormValuesChange?: FormEngineProps['onFormValuesChange'];\n}\n\nexport const useCreateForm = ({\n node,\n loadingRenderer,\n emptyRenderer,\n defaultValues,\n onMounted,\n onUnmounted,\n onFormValuesChange,\n}: UseFormOptions) => {\n const testRun = useTestRunService();\n const [loading, setLoading] = useState(false);\n const [form, setForm] = useState<TestRunFormEntity | null>(null);\n const renderer = useMemo(() => {\n if (loading || !form) {\n return loadingRenderer;\n }\n\n const isEmpty = isFormEmpty(form.schema);\n\n return form.render({\n defaultValues,\n onFormValuesChange,\n children: isEmpty ? emptyRenderer : null,\n });\n }, [form, loading]);\n\n const compute = async () => {\n if (!node) {\n return;\n }\n try {\n setLoading(true);\n const formEntity = await testRun.createForm(node);\n setForm(formEntity);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n compute();\n }, [node]);\n\n useEffect(() => {\n if (!form) {\n return;\n }\n const disposable = new DisposableCollection(\n form.onFormMounted((data) => {\n onMounted?.(data);\n }),\n form.onFormUnmounted(() => {\n onUnmounted?.();\n })\n );\n return () => disposable.dispose();\n }, [form]);\n\n return {\n renderer,\n loading,\n form,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { TestRunService } from '../../services/test-run';\n\nexport const useTestRunService = () => useService<TestRunService>(TestRunService);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACKA,kBAAoC;;;ACApC,IAAAC,iBAA8C;AAE9C,oBAAuB;AACvB,uBAAmC;AACnC,IAAAC,gBAAwB;;;ACqBjB,IAAM,gBAAgB,OAAO,eAAe;AAC5C,IAAM,eAAe,CAAC,WAAmC;AAC9D,QAAM,gBAA+B;AAAA,IACnC,YAAY,CAAC;AAAA,IACb,OAAO,CAAC;AAAA,IACR,SAAS,CAAC;AAAA,EACZ;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;;;ACpCA,IAAAC,eAAqB;;;AC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T;AAAA,IACF;AACA,UAAM,aAAa,IAAI;AAAA,MACrB,KAAK,cAAc,CAAC,SAAS;AAC3B,oBAAY,IAAI;AAAA,MAClB,CAAC;AAAA,MACD,KAAK,gBAAgB,MAAM;AACzB,sBAAc;AAAA,MAChB,CAAC;AAAA,IACH;AACA,WAAO,MAAM,WAAW,QAAQ;AAAA,EAClC,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["useCreateForm","import_react","import_utils","import_form","import_react","import_react","import_reactive","import_react","import_react","import_reactive","import_react","import_react","import_react","React","import_jsx_runtime","import_form","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","SchemaField","import_inversify","import_inversify","import_utils","import_nanoid","import_inversify","import_utils","import_inversify","import_react","import_utils","import_core","useCreateForm"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/create-test-run-plugin.ts","../src/services/form/form.ts","../src/services/config.ts","../src/form-engine/form/form.tsx","../src/form-engine/hooks/use-create-form.ts","../src/form-engine/utils.ts","../src/form-engine/model/index.ts","../src/form-engine/hooks/use-field.ts","../src/form-engine/contexts.ts","../src/form-engine/hooks/use-form.ts","../src/form-engine/fields/schema-field.tsx","../src/form-engine/fields/recursion-field.tsx","../src/form-engine/fields/reactive-field.tsx","../src/form-engine/fields/object-field.tsx","../src/form-engine/fields/general-field.tsx","../src/form-engine/fields/create-field.tsx","../src/services/form/factory.ts","../src/services/form/manager.ts","../src/services/test-run.ts","../src/services/pipeline/factory.ts","../src/services/pipeline/pipeline.ts","../src/services/pipeline/tap.ts","../src/services/store.ts","../src/reactive/hooks/use-create-form.ts","../src/reactive/hooks/use-test-run-service.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { createTestRunPlugin } from './create-test-run-plugin';\nexport { useCreateForm, useTestRunService } from './reactive';\n\nexport {\n FormEngine,\n connect,\n type FormInstance,\n type FormEngineProps,\n type FormSchema,\n type FormComponentProps,\n} from './form-engine';\n\nexport {\n type TestRunPipelinePlugin,\n TestRunPipelineEntity,\n type TestRunPipelineEntityCtx,\n type TestRunConfig,\n} from './services';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';\nimport {\n TestRunService,\n TestRunPipelineEntity,\n TestRunPipelineFactory,\n TestRunConfig,\n defineConfig,\n} from './services';\n\nexport const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({\n onBind: ({ bind }, opt) => {\n /** service */\n bind(TestRunService).toSelf().inSingletonScope();\n /** config */\n bind(TestRunConfig).toConstantValue(defineConfig(opt));\n /** form manager */\n bind(TestRunFormManager).toSelf().inSingletonScope();\n /** form entity */\n bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {\n const e = context.container.resolve(TestRunFormEntity);\n return e;\n });\n /** pipeline entity */\n bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(\n (context) => () => {\n const e = context.container.resolve(TestRunPipelineEntity);\n e.container = context.container.createChild();\n return e;\n }\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement, type ReactNode } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport { injectable, inject } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { TestRunConfig } from '../config';\nimport { FormSchema, FormEngine, type FormInstance, type FormEngineProps } from '../../form-engine';\n\nexport type FormRenderProps = Omit<\n FormEngineProps,\n 'schema' | 'components' | 'onMounted' | 'onUnmounted'\n>;\n\n@injectable()\nexport class TestRunFormEntity {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n private _schema: FormSchema;\n\n private initialized = false;\n\n id = nanoid();\n\n form: FormInstance | null = null;\n\n onFormMountedEmitter = new Emitter<FormInstance>();\n\n onFormMounted = this.onFormMountedEmitter.event;\n\n onFormUnmountedEmitter = new Emitter<void>();\n\n onFormUnmounted = this.onFormUnmountedEmitter.event;\n\n get schema() {\n return this._schema;\n }\n\n init(options: { schema: FormSchema }) {\n if (this.initialized) return;\n\n this._schema = options.schema;\n this.initialized = true;\n }\n\n render(props?: FormRenderProps): ReactNode {\n if (!this.initialized) {\n return null;\n }\n const { children, ...restProps } = props || {};\n return createElement(\n FormEngine,\n {\n schema: this.schema,\n components: this.config.components,\n onMounted: (instance) => {\n this.form = instance;\n this.onFormMountedEmitter.fire(instance);\n },\n onUnmounted: this.onFormUnmountedEmitter.fire.bind(this.onFormUnmountedEmitter),\n ...restProps,\n },\n children\n );\n }\n\n dispose() {\n this._schema = {};\n this.form = null;\n this.onFormMountedEmitter.dispose();\n this.onFormUnmountedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FlowNodeType, FlowNodeEntity } from '@flowgram.ai/document';\n\nimport type { MaybePromise } from '../types';\nimport type { FormSchema, FormComponents } from '../form-engine';\nimport type { TestRunPipelinePlugin } from './pipeline';\n\ntype PropertiesFunctionParams = {\n node: FlowNodeEntity;\n};\nexport type NodeMap = Record<FlowNodeType, NodeTestConfig>;\nexport interface NodeTestConfig {\n /** Enable node TestRun */\n enabled?: boolean;\n /** Input schema properties */\n properties?:\n | Record<string, FormSchema>\n | ((params: PropertiesFunctionParams) => MaybePromise<Record<string, FormSchema>>);\n}\n\nexport interface TestRunConfig {\n components: FormComponents;\n nodes: NodeMap;\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\nexport const TestRunConfig = Symbol('TestRunConfig');\nexport const defineConfig = (config: Partial<TestRunConfig>) => {\n const defaultConfig: TestRunConfig = {\n components: {},\n nodes: {},\n plugins: [],\n };\n return {\n ...defaultConfig,\n ...config,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Form } from '@flowgram.ai/form';\n\nimport { FormSchema, FormComponents } from '../types';\nimport { useCreateForm, type UseCreateFormOptions } from '../hooks';\nimport { createSchemaField } from '../fields';\n\nconst SchemaField = createSchemaField({});\n\nexport type FormEngineProps = React.PropsWithChildren<\n {\n /** Form schema */\n schema: FormSchema;\n /** form material map */\n components?: FormComponents;\n } & UseCreateFormOptions\n>;\n\nexport const FormEngine: React.FC<FormEngineProps> = ({\n schema,\n components,\n children,\n ...props\n}) => {\n const { model, control } = useCreateForm(schema, props);\n\n return (\n <Form control={control}>\n <SchemaField model={model} components={components}>\n {children}\n </SchemaField>\n </Form>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo } from 'react';\n\nimport type { OnFormValuesChangePayload } from '@flowgram.ai/form-core';\nimport { createForm, ValidateTrigger, type IForm } from '@flowgram.ai/form';\n\nimport { createValidate } from '../utils';\nimport { FormSchema, FormSchemaValidate } from '../types';\nimport { FormSchemaModel } from '../model';\n\nexport interface FormInstance {\n model: FormSchemaModel;\n form: IForm;\n}\nexport interface UseCreateFormOptions {\n defaultValues?: any;\n validate?: Record<string, FormSchemaValidate>;\n validateTrigger?: ValidateTrigger;\n onMounted?: (form: FormInstance) => void;\n onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;\n onUnmounted?: () => void;\n}\n\nexport const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {\n const { form, control } = useMemo(\n () =>\n createForm({\n validate: {\n ...createValidate(schema),\n ...options.validate,\n },\n validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,\n }),\n [schema]\n );\n\n const model = useMemo(\n () => new FormSchemaModel({ type: 'object', ...schema, defaultValue: options.defaultValues }),\n [schema]\n );\n\n /** Lifecycle and event binding */\n useEffect(() => {\n if (options.onMounted) {\n options.onMounted({ model, form });\n }\n const disposable = control._formModel.onFormValuesChange((payload) => {\n if (options.onFormValuesChange) {\n options.onFormValuesChange(payload);\n }\n });\n return () => {\n disposable.dispose();\n if (options.onUnmounted) {\n options.onUnmounted();\n }\n };\n }, [control]);\n\n return {\n form,\n control,\n model,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createElement } from 'react';\n\nimport type { FormSchema, FormSchemaValidate, FormComponentProps } from './types';\n\n/** Splice form item unique name */\nexport const getUniqueFieldName = (...args: (string | undefined)[]) =>\n args.filter((path) => path).join('.');\n\nexport const mergeFieldPath = (path?: string[], name?: string) =>\n [...(path || []), name].filter((i): i is string => Boolean(i));\n\n/** Create validation rules */\nexport const createValidate = (schema: FormSchema) => {\n const rules: Record<string, FormSchemaValidate> = {};\n\n visit(schema);\n\n return rules;\n\n function visit(current: FormSchema, name?: string) {\n if (name && current['x-validator']) {\n rules[name] = current['x-validator'];\n }\n if (current.type === 'object' && current.properties) {\n Object.entries(current.properties).forEach(([key, value]) => {\n visit(value, getUniqueFieldName(name, key));\n });\n }\n }\n};\n\nexport const connect = <T = any>(\n Component: React.FunctionComponent<any>,\n mapProps: (p: FormComponentProps) => T\n) => {\n const Connected = (props: FormComponentProps) => {\n const mappedProps = mapProps(props);\n return createElement(Component, mappedProps, (mappedProps as any).children);\n };\n\n return Connected;\n};\n\nexport const isFormEmpty = (schema: FormSchema) => {\n /** is not general field and not has children */\n const isEmpty = (s: FormSchema): boolean => {\n if (!s.type || s.type === 'object' || !s.name) {\n return Object.entries(schema.properties || {})\n .map(([key, value]) => ({\n name: key,\n ...value,\n }))\n .every(isFormEmpty);\n }\n return false;\n };\n\n return isEmpty(schema);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ReactiveState } from '@flowgram.ai/reactive';\n\nimport { getUniqueFieldName, mergeFieldPath } from '../utils';\nimport { FormSchema, FormSchemaType, FormSchemaModelState } from '../types';\n\nexport class FormSchemaModel implements FormSchema {\n name?: string;\n\n type?: FormSchemaType;\n\n defaultValue?: any;\n\n properties?: Record<string, FormSchema>;\n\n ['x-index']?: number;\n\n ['x-component']?: string;\n\n ['x-component-props']?: Record<string, unknown>;\n\n ['x-decorator']?: string;\n\n ['x-decorator-props']?: Record<string, unknown>;\n\n [key: string]: any;\n\n path: string[] = [];\n\n state = new ReactiveState<FormSchemaModelState>({ disabled: false });\n\n get componentType() {\n return this['x-component'];\n }\n\n get componentProps() {\n return this['x-component-props'];\n }\n\n get decoratorType() {\n return this['x-decorator'];\n }\n\n get decoratorProps() {\n return this['x-decorator-props'];\n }\n\n get uniqueName() {\n return getUniqueFieldName(...this.path);\n }\n\n constructor(json: FormSchema, path: string[] = []) {\n this.fromJSON(json);\n this.path = path;\n }\n\n private fromJSON(json: FormSchema) {\n Object.entries(json).forEach(([key, value]) => {\n this[key] = value;\n });\n }\n\n getPropertyList() {\n const orderProperties: FormSchemaModel[] = [];\n const unOrderProperties: FormSchemaModel[] = [];\n Object.entries(this.properties || {}).forEach(([key, item]) => {\n const index = item['x-index'];\n const defaultValues = this.defaultValue;\n /**\n * The upper layer's default value has a higher priority than its own default value,\n * because the upper layer's default value ultimately comes from the outside world.\n */\n if (typeof defaultValues === 'object' && defaultValues !== null && key in defaultValues) {\n item.defaultValue = defaultValues[key];\n }\n const current = new FormSchemaModel(item, mergeFieldPath(this.path, key));\n if (index !== undefined && !isNaN(index)) {\n orderProperties[index] = current;\n } else {\n unOrderProperties.push(current);\n }\n });\n return orderProperties.concat(unOrderProperties).filter((item) => !!item);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FieldModelContext } from '../contexts';\n\nexport const useFieldModel = () => useContext(FieldModelContext);\nexport const useFieldState = () => useObserve(useFieldModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createContext } from 'react';\n\nimport type { FormComponents } from './types';\nimport type { FormSchemaModel } from './model';\n\n/** Model context for each form item */\nexport const FieldModelContext = createContext<FormSchemaModel>({} as any);\n/** The form's model context */\nexport const FormModelContext = createContext<FormSchemaModel>({} as any);\n/** Context of material component map */\nexport const ComponentsContext = createContext<FormComponents>({});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\n\nimport { useObserve } from '@flowgram.ai/reactive';\n\nimport { FormModelContext } from '../contexts';\n\nexport const useFormModel = () => useContext(FormModelContext);\nexport const useFormState = () => useObserve(useFormModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState } from 'react';\n\nimport type { FormComponents } from '../types';\nimport { FormSchemaModel } from '../model';\nimport { ComponentsContext, FormModelContext } from '../contexts';\nimport { RecursionField } from './recursion-field';\n\nexport interface SchemaFieldProps {\n model: FormSchemaModel;\n components: FormComponents;\n}\nexport const SchemaField: React.FC<React.PropsWithChildren<SchemaFieldProps>> = ({\n components,\n model,\n children,\n}) => {\n /** Only initialized once, dynamic is not supported */\n const [innerComponents] = useState(() => components);\n return (\n <ComponentsContext.Provider value={innerComponents}>\n <FormModelContext.Provider value={model}>\n <RecursionField model={model} />\n {children}\n </FormModelContext.Provider>\n </ComponentsContext.Provider>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useMemo } from 'react';\n\nimport { FormSchemaModel } from '../model';\nimport { ObjectField } from './object-field';\nimport { GeneralField } from './general-field';\n\ninterface RecursionFieldProps {\n model: FormSchemaModel;\n}\n\nexport const RecursionField: React.FC<RecursionFieldProps> = ({ model }) => {\n const properties = useMemo(() => model.getPropertyList(), [model]);\n\n /** general field has no children */\n if (model.type !== 'object') {\n return <GeneralField model={model} />;\n }\n\n return (\n <ObjectField model={model}>\n {properties.map((item) => (\n <RecursionField key={item.uniqueName} model={item} />\n ))}\n </ObjectField>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useContext } from 'react';\nimport React from 'react';\n\nimport { useFormState } from '../hooks/use-form';\nimport { useFieldModel, useFieldState } from '../hooks/use-field';\nimport { ComponentsContext } from '../contexts';\n\ninterface ReactiveFieldProps {\n componentProps?: Record<string, unknown>;\n decoratorProps?: Record<string, unknown>;\n}\n\nexport const ReactiveField: React.FC<React.PropsWithChildren<ReactiveFieldProps>> = (props) => {\n const formState = useFormState();\n const model = useFieldModel();\n const modelState = useFieldState();\n const components = useContext(ComponentsContext);\n\n const disabled = modelState.disabled || formState.disabled;\n const componentRender = () => {\n if (!model.componentType || !components[model.componentType]) {\n return props.children;\n }\n return React.createElement(\n components[model.componentType],\n {\n disabled,\n ...model.componentProps,\n ...props.componentProps,\n },\n props.children\n );\n };\n\n const decoratorRender = (children: React.ReactNode) => {\n if (!model.decoratorType || !components[model.decoratorType]) {\n return <>{children}</>;\n }\n return React.createElement(\n components[model.decoratorType],\n {\n type: model.type,\n required: model.required,\n ...model.decoratorProps,\n ...props.decoratorProps,\n },\n children\n );\n };\n\n return decoratorRender(componentRender());\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\nimport { ReactiveField } from './reactive-field';\n\nexport interface ObjectFieldProps {\n model: FormSchemaModel;\n}\n\nexport const ObjectField: React.FC<React.PropsWithChildren<ObjectFieldProps>> = ({\n model,\n children,\n}) => (\n <FieldModelContext.Provider value={model}>\n <ReactiveField>{children}</ReactiveField>\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Field } from '@flowgram.ai/form';\n\nimport { ReactiveField } from './reactive-field';\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelContext } from '../contexts';\n\nexport interface GeneralFieldProps {\n model: FormSchemaModel;\n}\n\nexport const GeneralField: React.FC<GeneralFieldProps> = ({ model }) => (\n <FieldModelContext.Provider value={model}>\n <Field\n name={model.uniqueName}\n defaultValue={model.defaultValue}\n render={({ field, fieldState }) => (\n <ReactiveField\n componentProps={{\n value: field.value,\n onChange: field.onChange,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ...fieldState,\n }}\n decoratorProps={fieldState}\n />\n )}\n />\n </FieldModelContext.Provider>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport { SchemaField, type SchemaFieldProps } from './schema-field';\nimport { FormComponents } from '../types';\n\ntype InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &\n Pick<Partial<SchemaFieldProps>, 'components'>;\n\nexport interface CreateSchemaFieldOptions {\n components?: FormComponents;\n}\nexport const createSchemaField = (options: CreateSchemaFieldOptions) => {\n const InnerSchemaField: React.FC<PropsWithChildren<InnerSchemaFieldProps>> = ({\n components,\n ...props\n }) => (\n <SchemaField\n components={{\n ...options.components,\n ...components,\n }}\n {...props}\n />\n );\n\n return InnerSchemaField;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunFormEntity } from './form';\n\nexport const TestRunFormFactory = Symbol('TestRunFormFactory');\nexport type TestRunFormFactory = () => TestRunFormEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\n\nimport type { TestRunFormEntity } from './form';\nimport { TestRunFormFactory } from './factory';\n\n@injectable()\nexport class TestRunFormManager {\n @inject(TestRunFormFactory) private readonly factory: TestRunFormFactory;\n\n private entities = new Map<string, TestRunFormEntity>();\n\n createForm() {\n return this.factory();\n }\n\n getForm(id: string) {\n return this.entities.get(id);\n }\n\n getAllForm() {\n return Array.from(this.entities);\n }\n\n disposeForm(id: string) {\n const form = this.entities.get(id);\n if (!form) {\n return;\n }\n form.dispose();\n this.entities.delete(id);\n }\n\n disposeAllForm() {\n for (const id of this.entities.keys()) {\n this.disposeForm(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity, FlowNodeType } from '@flowgram.ai/document';\n\nimport { TestRunPipelineFactory } from './pipeline/factory';\nimport { TestRunFormManager } from './form';\nimport { FormSchema } from '../form-engine';\nimport { TestRunPipelineEntity, type TestRunPipelineEntityOptions } from './pipeline';\nimport { TestRunConfig } from './config';\n\n@injectable()\nexport class TestRunService {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n @inject(TestRunPipelineFactory) private readonly pipelineFactory: TestRunPipelineFactory;\n\n @inject(TestRunFormManager) readonly formManager: TestRunFormManager;\n\n pipelineEntities = new Map<string, TestRunPipelineEntity>();\n\n pipelineBindings = new Map<string, Disposable>();\n\n onPipelineProgressEmitter = new Emitter();\n\n onPipelineProgress = this.onPipelineProgressEmitter.event;\n\n onPipelineFinishedEmitter = new Emitter();\n\n onPipelineFinished = this.onPipelineFinishedEmitter.event;\n\n public isEnabled(nodeType: FlowNodeType) {\n const config = this.config.nodes[nodeType];\n return config && config?.enabled !== false;\n }\n\n async toSchema(node: FlowNodeEntity) {\n const nodeType = node.flowNodeType;\n const config = this.config.nodes[nodeType];\n if (!this.isEnabled(nodeType)) {\n return {};\n }\n const properties =\n typeof config.properties === 'function'\n ? await config.properties({ node })\n : config.properties;\n\n return {\n type: 'object',\n properties,\n };\n }\n\n createFormWithSchema(schema: FormSchema) {\n const form = this.formManager.createForm();\n form.init({ schema });\n return form;\n }\n\n async createForm(node: FlowNodeEntity) {\n const schema = await this.toSchema(node);\n return this.createFormWithSchema(schema);\n }\n\n createPipeline(options: TestRunPipelineEntityOptions) {\n const pipeline = this.pipelineFactory();\n this.pipelineEntities.set(pipeline.id, pipeline);\n pipeline.init(options);\n return pipeline;\n }\n\n disposePipeline(id: string) {\n const pipeline = this.pipelineEntities.get(id);\n if (pipeline) {\n this.pipelineEntities.delete(id);\n pipeline.dispose();\n }\n }\n\n connectPipeline(pipeline: TestRunPipelineEntity) {\n if (this.pipelineBindings.get(pipeline.id)) {\n return;\n }\n const disposable = new DisposableCollection(\n pipeline.onProgress(this.onPipelineProgressEmitter.fire.bind(this.onPipelineProgressEmitter)),\n pipeline.onFinished(this.onPipelineFinishedEmitter.fire.bind(this.onPipelineFinishedEmitter))\n );\n this.pipelineBindings.set(pipeline.id, disposable);\n }\n\n disconnectPipeline(id: string) {\n if (this.pipelineBindings.has(id)) {\n const disposable = this.pipelineBindings.get(id);\n disposable?.dispose();\n this.pipelineBindings.delete(id);\n }\n }\n\n disconnectAllPipeline() {\n for (const id of this.pipelineBindings.keys()) {\n this.disconnectPipeline(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunPipelineEntity } from './pipeline';\n\nexport const TestRunPipelineFactory = Symbol('TestRunPipelineFactory');\nexport type TestRunPipelineFactory = () => TestRunPipelineEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { StoreApi } from 'zustand';\nimport { nanoid } from 'nanoid';\nimport { injectable, interfaces } from 'inversify';\nimport { Emitter } from '@flowgram.ai/utils';\n\nimport { Tap } from './tap';\nimport type { TestRunPipelinePlugin } from './plugin';\nimport { StoreService } from '../store';\nexport interface TestRunPipelineEntityOptions {\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\ninterface TestRunPipelineEntityState<T = any> {\n status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';\n data?: T;\n result?: any;\n getData: () => T;\n setData: (next: any) => void;\n}\n\nexport interface TestRunPipelineEntityCtx<T = any> {\n id: string;\n store: StoreApi<TestRunPipelineEntityState<T>>;\n operate: {\n update: (data: any) => void;\n cancel: () => void;\n };\n}\n\nconst initialState: Omit<TestRunPipelineEntityState, 'getData' | 'setData'> = {\n status: 'idle',\n data: {},\n};\n\n@injectable()\nexport class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {\n container: interfaces.Container | undefined;\n\n id = nanoid();\n\n plugins: TestRunPipelinePlugin[] = [];\n\n prepare = new Tap<TestRunPipelineEntityCtx>();\n\n private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n private progress?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n get status() {\n return this.getState().status;\n }\n\n set status(next: TestRunPipelineEntityState['status']) {\n this.setState({ status: next });\n }\n\n onProgressEmitter = new Emitter<any>();\n\n onProgress = this.onProgressEmitter.event;\n\n onFinishedEmitter = new Emitter();\n\n onFinished = this.onFinishedEmitter.event;\n\n constructor() {\n super((set, get) => ({\n ...initialState,\n getData: () => get().data || {},\n setData: (next: any) => set((state) => ({ ...state, data: { ...state.data, ...next } })),\n }));\n }\n\n public init(options: TestRunPipelineEntityOptions) {\n if (!this.container) {\n return;\n }\n const { plugins } = options;\n for (const PluginClass of plugins) {\n const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);\n plugin.apply(this);\n this.plugins.push(plugin);\n }\n }\n\n public registerExecute(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.execute = fn;\n }\n\n public registerProgress(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.progress = fn;\n }\n\n async start<T>(options?: { data: T }) {\n const { data } = options || {};\n if (this.status !== 'idle') {\n return;\n }\n /** initialization data */\n this.setState({ data });\n const ctx: TestRunPipelineEntityCtx = {\n id: this.id,\n store: this.store,\n operate: {\n update: this.update.bind(this),\n cancel: this.cancel.bind(this),\n },\n };\n\n this.status = 'preparing';\n await this.prepare.call(ctx);\n if (this.status !== 'preparing') {\n return;\n }\n\n this.status = 'executing';\n if (this.execute) {\n await this.execute(ctx);\n }\n if (this.progress) {\n await this.progress(ctx);\n }\n if (this.status === 'executing') {\n this.status = 'finished';\n this.onFinishedEmitter.fire(this.getState().result);\n }\n }\n\n update(result: any) {\n this.setState({ result });\n this.onProgressEmitter.fire(result);\n }\n\n cancel() {\n if ((this.status = 'preparing')) {\n this.prepare.freeze();\n }\n this.status = 'canceled';\n }\n\n dispose() {\n this.status = 'disposed';\n this.plugins.forEach((p) => {\n if (p.dispose) {\n p.dispose();\n }\n });\n this.onProgressEmitter.dispose();\n this.onFinishedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MaybePromise } from '../../types';\n\ninterface TapValue<T> {\n name: string;\n fn: (arg: T) => MaybePromise<void>;\n}\n\nexport class Tap<T> {\n private taps: TapValue<T>[] = [];\n\n private frozen = false;\n\n tap(name: string, fn: TapValue<T>['fn']) {\n this.taps.push({ name, fn });\n }\n\n async call(ctx: T) {\n for (const tap of this.taps) {\n if (this.frozen) {\n return;\n }\n await tap.fn(ctx);\n }\n }\n\n freeze() {\n this.frozen = true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createStore } from 'zustand/vanilla';\nimport type { StoreApi, StateCreator } from 'zustand';\nimport { injectable, unmanaged } from 'inversify';\n/**\n * 包含 Store 的 Service\n */\n@injectable()\nexport class StoreService<State> {\n store: StoreApi<State>;\n\n get getState() {\n return this.store.getState.bind(this.store);\n }\n\n get setState() {\n return this.store.setState.bind(this.store);\n }\n\n constructor(@unmanaged() stateCreator: StateCreator<State>) {\n this.store = createStore(stateCreator);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { DisposableCollection } from '@flowgram.ai/utils';\nimport type { FlowNodeEntity } from '@flowgram.ai/document';\n\nimport { TestRunFormEntity } from '../../services/form/form';\nimport { FormEngineProps, isFormEmpty } from '../../form-engine';\nimport { useTestRunService } from './use-test-run-service';\n\ninterface UseFormOptions {\n node?: FlowNodeEntity;\n /** form loading */\n loadingRenderer?: React.ReactNode;\n /** form empty */\n emptyRenderer?: React.ReactNode;\n defaultValues?: FormEngineProps['defaultValues'];\n onMounted?: FormEngineProps['onMounted'];\n onUnmounted?: FormEngineProps['onUnmounted'];\n onFormValuesChange?: FormEngineProps['onFormValuesChange'];\n}\n\nexport const useCreateForm = ({\n node,\n loadingRenderer,\n emptyRenderer,\n defaultValues,\n onMounted,\n onUnmounted,\n onFormValuesChange,\n}: UseFormOptions) => {\n const testRun = useTestRunService();\n const [loading, setLoading] = useState(false);\n const [form, setForm] = useState<TestRunFormEntity | null>(null);\n const renderer = useMemo(() => {\n if (loading || !form) {\n return loadingRenderer;\n }\n\n const isEmpty = isFormEmpty(form.schema);\n\n return form.render({\n defaultValues,\n onFormValuesChange,\n children: isEmpty ? emptyRenderer : null,\n });\n }, [form, loading]);\n\n const compute = async () => {\n if (!node) {\n return;\n }\n try {\n setLoading(true);\n const formEntity = await testRun.createForm(node);\n setForm(formEntity);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n compute();\n }, [node]);\n\n useEffect(() => {\n if (!form) {\n return;\n }\n const disposable = new DisposableCollection(\n form.onFormMounted((data) => {\n onMounted?.(data);\n }),\n form.onFormUnmounted(() => {\n onUnmounted?.();\n })\n );\n return () => disposable.dispose();\n }, [form]);\n\n return {\n renderer,\n loading,\n form,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { TestRunService } from '../../services/test-run';\n\nexport const useTestRunService = () => useService<TestRunService>(TestRunService);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACKA,kBAAoC;;;ACApC,IAAAC,iBAA8C;AAE9C,oBAAuB;AACvB,uBAAmC;AACnC,IAAAC,gBAAwB;;;ACqBjB,IAAM,gBAAgB,OAAO,eAAe;AAC5C,IAAM,eAAe,CAAC,WAAmC;AAC9D,QAAM,gBAA+B;AAAA,IACnC,YAAY,CAAC;AAAA,IACb,OAAO,CAAC;AAAA,IACR,SAAS,CAAC;AAAA,EACZ;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;;;ACpCA,IAAAC,eAAqB;;;ACArB,IAAAC,gBAAmC;AAGnC,kBAAwD;;;ACHxD,mBAA8B;AAKvB,IAAM,qBAAqB,IAAI,SACpC,KAAK,OAAO,CAAC,SAAS,IAAI,EAAE,KAAK,GAAG;AAE/B,IAAM,iBAAiB,CAAC,MAAiB,SAC9C,CAAC,GAAI,QAAQ,CAAC,GAAI,IAAI,EAAE,OAAO,CAAC,MAAmB,QAAQ,CAAC,CAAC;AAGxD,IAAM,iBAAiB,CAAC,WAAuB;AACpD,QAAM,QAA4C,CAAC;AAEnD,QAAM,MAAM;AAEZ,SAAO;AAEP,WAAS,MAAM,SAAqB,MAAe;AACjD,QAAI,QAAQ,QAAQ,aAAa,GAAG;AAClC,YAAM,IAAI,IAAI,QAAQ,aAAa;AAAA,IACrC;AACA,QAAI,QAAQ,SAAS,Y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AAAA,MAClB,CAAC;AAAA,MACD,KAAK,gBAAgB,MAAM;AACzB,sBAAc;AAAA,MAChB,CAAC;AAAA,IACH;AACA,WAAO,MAAM,WAAW,QAAQ;AAAA,EAClC,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["useCreateForm","import_react","import_utils","import_form","import_react","import_react","import_reactive","import_react","import_react","import_reactive","import_react","import_react","import_react","React","import_jsx_runtime","import_form","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","SchemaField","import_inversify","import_inversify","import_utils","import_nanoid","import_inversify","import_utils","import_inversify","import_react","import_utils","import_core","useCreateForm"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/test-run-plugin",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.25",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
"inversify": "^6.0.1",
|
|
17
17
|
"nanoid": "^5.0.9",
|
|
18
18
|
"zustand": "^5.0.8",
|
|
19
|
-
"@flowgram.ai/form-core": "0.1.0-alpha.
|
|
20
|
-
"@flowgram.ai/
|
|
21
|
-
"@flowgram.ai/
|
|
22
|
-
"@flowgram.ai/document": "0.1.0-alpha.
|
|
23
|
-
"@flowgram.ai/form": "0.1.0-alpha.
|
|
24
|
-
"@flowgram.ai/reactive": "0.1.0-alpha.
|
|
19
|
+
"@flowgram.ai/form-core": "0.1.0-alpha.25",
|
|
20
|
+
"@flowgram.ai/core": "0.1.0-alpha.25",
|
|
21
|
+
"@flowgram.ai/utils": "0.1.0-alpha.25",
|
|
22
|
+
"@flowgram.ai/document": "0.1.0-alpha.25",
|
|
23
|
+
"@flowgram.ai/form": "0.1.0-alpha.25",
|
|
24
|
+
"@flowgram.ai/reactive": "0.1.0-alpha.25"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"react": "^18",
|
|
28
28
|
"@types/react": "^18",
|
|
29
29
|
"tsup": "^8.0.1",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
31
|
-
"@flowgram.ai/eslint-config": "0.1.0-alpha.
|
|
32
|
-
"@flowgram.ai/ts-config": "0.1.0-alpha.
|
|
31
|
+
"@flowgram.ai/eslint-config": "0.1.0-alpha.25",
|
|
32
|
+
"@flowgram.ai/ts-config": "0.1.0-alpha.25"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=16.8"
|
|
@@ -9,13 +9,13 @@ CLI tsup v8.5.0
|
|
|
9
9
|
CLI Target: es2020
|
|
10
10
|
CJS Build start
|
|
11
11
|
ESM Build start
|
|
12
|
-
CJS dist/index.js
|
|
13
|
-
CJS dist/index.js.map 45.
|
|
14
|
-
CJS ⚡️ Build success in
|
|
15
|
-
ESM dist/esm/index.js
|
|
16
|
-
ESM dist/esm/index.js.map
|
|
17
|
-
ESM ⚡️ Build success in
|
|
12
|
+
CJS dist/index.js 23.12 KB
|
|
13
|
+
CJS dist/index.js.map 45.85 KB
|
|
14
|
+
CJS ⚡️ Build success in 172ms
|
|
15
|
+
ESM dist/esm/index.js 20.37 KB
|
|
16
|
+
ESM dist/esm/index.js.map 45.46 KB
|
|
17
|
+
ESM ⚡️ Build success in 172ms
|
|
18
18
|
DTS Build start
|
|
19
|
-
DTS ⚡️ Build success in
|
|
20
|
-
DTS dist/index.d.ts
|
|
21
|
-
DTS dist/index.d.mts
|
|
19
|
+
DTS ⚡️ Build success in 3936ms
|
|
20
|
+
DTS dist/index.d.ts 10.08 KB
|
|
21
|
+
DTS dist/index.d.mts 10.08 KB
|
|
@@ -16,7 +16,7 @@ export interface TestRunPipelineEntityOptions {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface TestRunPipelineEntityState<T = any> {
|
|
19
|
-
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished';
|
|
19
|
+
status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';
|
|
20
20
|
data?: T;
|
|
21
21
|
result?: any;
|
|
22
22
|
getData: () => T;
|
|
@@ -43,6 +43,8 @@ export class TestRunPipelineEntity extends StoreService<TestRunPipelineEntitySta
|
|
|
43
43
|
|
|
44
44
|
id = nanoid();
|
|
45
45
|
|
|
46
|
+
plugins: TestRunPipelinePlugin[] = [];
|
|
47
|
+
|
|
46
48
|
prepare = new Tap<TestRunPipelineEntityCtx>();
|
|
47
49
|
|
|
48
50
|
private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;
|
|
@@ -81,6 +83,7 @@ export class TestRunPipelineEntity extends StoreService<TestRunPipelineEntitySta
|
|
|
81
83
|
for (const PluginClass of plugins) {
|
|
82
84
|
const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);
|
|
83
85
|
plugin.apply(this);
|
|
86
|
+
this.plugins.push(plugin);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -139,5 +142,14 @@ export class TestRunPipelineEntity extends StoreService<TestRunPipelineEntitySta
|
|
|
139
142
|
this.status = 'canceled';
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
dispose() {
|
|
145
|
+
dispose() {
|
|
146
|
+
this.status = 'disposed';
|
|
147
|
+
this.plugins.forEach((p) => {
|
|
148
|
+
if (p.dispose) {
|
|
149
|
+
p.dispose();
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
this.onProgressEmitter.dispose();
|
|
153
|
+
this.onFinishedEmitter.dispose();
|
|
154
|
+
}
|
|
143
155
|
}
|
package/src/services/test-run.ts
CHANGED
|
@@ -73,6 +73,14 @@ export class TestRunService {
|
|
|
73
73
|
return pipeline;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
disposePipeline(id: string) {
|
|
77
|
+
const pipeline = this.pipelineEntities.get(id);
|
|
78
|
+
if (pipeline) {
|
|
79
|
+
this.pipelineEntities.delete(id);
|
|
80
|
+
pipeline.dispose();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
76
84
|
connectPipeline(pipeline: TestRunPipelineEntity) {
|
|
77
85
|
if (this.pipelineBindings.get(pipeline.id)) {
|
|
78
86
|
return;
|