@flowgram.ai/form-materials 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1518,7 +1518,7 @@ function PropertyEdit(props) {
1518
1518
  BlurInput,
1519
1519
  {
1520
1520
  disabled: readonly,
1521
- placeholder: config?.placeholder ?? "Input Variable Name",
1521
+ placeholder: config?.placeholder ?? import_editor14.I18n.t("Input Variable Name"),
1522
1522
  size: "small",
1523
1523
  value: name,
1524
1524
  onChange: (value2) => onChange("name", value2)
@@ -3014,6 +3014,7 @@ function VariableTagInject2() {
3014
3014
  }
3015
3015
 
3016
3016
  // src/components/json-editor-with-variables/index.tsx
3017
+ var import_editor26 = require("@flowgram.ai/editor");
3017
3018
  function findAllMatches(inputString, regex) {
3018
3019
  const globalRegex = new RegExp(
3019
3020
  regex,
@@ -3047,7 +3048,7 @@ function JsonEditorWithVariables(props) {
3047
3048
  CodeEditor,
3048
3049
  {
3049
3050
  languageId: "json",
3050
- activeLinePlaceholder: "Press '@' to Select variable",
3051
+ activeLinePlaceholder: import_editor26.I18n.t("Press '@' to Select variable"),
3051
3052
  ...props,
3052
3053
  options: {
3053
3054
  transformer,
@@ -3061,7 +3062,7 @@ function JsonEditorWithVariables(props) {
3061
3062
 
3062
3063
  // src/components/inputs-values/index.tsx
3063
3064
  var import_react51 = __toESM(require("react"));
3064
- var import_editor26 = require("@flowgram.ai/editor");
3065
+ var import_editor27 = require("@flowgram.ai/editor");
3065
3066
  var import_semi_ui23 = require("@douyinfe/semi-ui");
3066
3067
  var import_semi_icons9 = require("@douyinfe/semi-icons");
3067
3068
 
@@ -3102,7 +3103,7 @@ function InputsValues({
3102
3103
  size: "small",
3103
3104
  value: item.key,
3104
3105
  onChange: (v) => updateKey(item.id, v),
3105
- placeholder: import_editor26.I18n.t("Input Key")
3106
+ placeholder: import_editor27.I18n.t("Input Key")
3106
3107
  }
3107
3108
  ), /* @__PURE__ */ import_react51.default.createElement(
3108
3109
  InjectDynamicValueInput,
@@ -3139,7 +3140,7 @@ function InputsValues({
3139
3140
  schema: { type: "string" }
3140
3141
  })
3141
3142
  },
3142
- import_editor26.I18n.t("Add")
3143
+ import_editor27.I18n.t("Add")
3143
3144
  ));
3144
3145
  }
3145
3146
 
@@ -3252,7 +3253,7 @@ function SchemaTree(props) {
3252
3253
  // src/components/display-outputs/index.tsx
3253
3254
  var import_react54 = __toESM(require("react"));
3254
3255
  var import_json_schema9 = require("@flowgram.ai/json-schema");
3255
- var import_editor27 = require("@flowgram.ai/editor");
3256
+ var import_editor28 = require("@flowgram.ai/editor");
3256
3257
 
3257
3258
  // src/components/display-schema-tag/index.tsx
3258
3259
  var import_react53 = __toESM(require("react"));
@@ -3305,8 +3306,8 @@ var DisplayOutputsWrapper = import_styled_components13.default.div`
3305
3306
 
3306
3307
  // src/components/display-outputs/index.tsx
3307
3308
  function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3308
- const scope = (0, import_editor27.useCurrentScope)();
3309
- const refresh = (0, import_editor27.useRefresh)();
3309
+ const scope = (0, import_editor28.useCurrentScope)();
3310
+ const refresh = (0, import_editor28.useRefresh)();
3310
3311
  (0, import_react54.useEffect)(() => {
3311
3312
  if (!displayFromScope) {
3312
3313
  return () => null;
@@ -3341,9 +3342,9 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3341
3342
  // src/components/display-flow-value/index.tsx
3342
3343
  var import_react55 = __toESM(require("react"));
3343
3344
  var import_json_schema10 = require("@flowgram.ai/json-schema");
3344
- var import_editor28 = require("@flowgram.ai/editor");
3345
+ var import_editor29 = require("@flowgram.ai/editor");
3345
3346
  function DisplayFlowValue({ value, title, showIconInTree }) {
3346
- const available = (0, import_editor28.useScopeAvailable)();
3347
+ const available = (0, import_editor29.useScopeAvailable)();
3347
3348
  const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3348
3349
  const schema = (0, import_react55.useMemo)(() => {
3349
3350
  if (value?.type === "ref") {
@@ -3371,7 +3372,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3371
3372
  // src/components/display-inputs-values/index.tsx
3372
3373
  var import_react56 = __toESM(require("react"));
3373
3374
  var import_lodash8 = require("lodash");
3374
- var import_editor29 = require("@flowgram.ai/editor");
3375
+ var import_editor30 = require("@flowgram.ai/editor");
3375
3376
 
3376
3377
  // src/components/display-inputs-values/styles.ts
3377
3378
  var import_styled_components14 = __toESM(require("styled-components"));
@@ -3407,7 +3408,7 @@ function DisplayInputsValueAllInTag({
3407
3408
  title,
3408
3409
  showIconInTree
3409
3410
  }) {
3410
- const available = (0, import_editor29.useScopeAvailable)();
3411
+ const available = (0, import_editor30.useScopeAvailable)();
3411
3412
  const schema = (0, import_react56.useMemo)(
3412
3413
  () => FlowValueUtils.inferJsonSchema(value, available.scope),
3413
3414
  [available.version, value]
@@ -3417,7 +3418,7 @@ function DisplayInputsValueAllInTag({
3417
3418
 
3418
3419
  // src/components/assign-rows/index.tsx
3419
3420
  var import_react59 = __toESM(require("react"));
3420
- var import_editor30 = require("@flowgram.ai/editor");
3421
+ var import_editor31 = require("@flowgram.ai/editor");
3421
3422
  var import_semi_ui27 = require("@douyinfe/semi-ui");
3422
3423
  var import_semi_icons11 = require("@douyinfe/semi-icons");
3423
3424
 
@@ -3504,7 +3505,7 @@ function AssignRow(props) {
3504
3505
  // src/components/assign-rows/index.tsx
3505
3506
  function AssignRows(props) {
3506
3507
  const { name, readonly } = props;
3507
- return /* @__PURE__ */ import_react59.default.createElement(import_editor30.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react59.default.createElement(
3508
+ return /* @__PURE__ */ import_react59.default.createElement(import_editor31.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react59.default.createElement(
3508
3509
  AssignRow,
3509
3510
  {
3510
3511
  key: childField.key,
@@ -3538,7 +3539,7 @@ function AssignRows(props) {
3538
3539
 
3539
3540
  // src/components/inputs-values-tree/index.tsx
3540
3541
  var import_react63 = __toESM(require("react"));
3541
- var import_editor32 = require("@flowgram.ai/editor");
3542
+ var import_editor33 = require("@flowgram.ai/editor");
3542
3543
  var import_semi_ui29 = require("@douyinfe/semi-ui");
3543
3544
  var import_semi_icons14 = require("@douyinfe/semi-icons");
3544
3545
 
@@ -3648,7 +3649,7 @@ var IconAddChildren2 = () => /* @__PURE__ */ import_react60.default.createElemen
3648
3649
 
3649
3650
  // src/components/inputs-values-tree/row.tsx
3650
3651
  var import_react62 = __toESM(require("react"));
3651
- var import_editor31 = require("@flowgram.ai/editor");
3652
+ var import_editor32 = require("@flowgram.ai/editor");
3652
3653
  var import_semi_ui28 = require("@douyinfe/semi-ui");
3653
3654
  var import_semi_icons13 = require("@douyinfe/semi-icons");
3654
3655
 
@@ -3705,7 +3706,7 @@ var AddObjectChildStrategy = {
3705
3706
  size: "small",
3706
3707
  disabled: true,
3707
3708
  style: { pointerEvents: "none" },
3708
- value: import_editor31.I18n.t("Configure via child fields")
3709
+ value: import_editor32.I18n.t("Configure via child fields")
3709
3710
  }
3710
3711
  )
3711
3712
  };
@@ -3746,7 +3747,7 @@ function InputValueRow(props) {
3746
3747
  size: "small",
3747
3748
  value: keyName,
3748
3749
  onChange: (v) => onUpdateKey?.(v),
3749
- placeholder: import_editor31.I18n.t("Input Key")
3750
+ placeholder: import_editor32.I18n.t("Input Key")
3750
3751
  }
3751
3752
  ), /* @__PURE__ */ import_react62.default.createElement(
3752
3753
  InjectDynamicValueInput,
@@ -3846,34 +3847,34 @@ function InputsValuesTree(props) {
3846
3847
  });
3847
3848
  }
3848
3849
  },
3849
- import_editor32.I18n.t("Add")
3850
+ import_editor33.I18n.t("Add")
3850
3851
  ));
3851
3852
  }
3852
3853
 
3853
3854
  // src/effects/provide-batch-input/index.ts
3854
- var import_editor33 = require("@flowgram.ai/editor");
3855
- var provideBatchInputEffect = (0, import_editor33.createEffectFromVariableProvider)({
3855
+ var import_editor34 = require("@flowgram.ai/editor");
3856
+ var provideBatchInputEffect = (0, import_editor34.createEffectFromVariableProvider)({
3856
3857
  private: true,
3857
3858
  parse: (value, ctx) => [
3858
- import_editor33.ASTFactory.createVariableDeclaration({
3859
+ import_editor34.ASTFactory.createVariableDeclaration({
3859
3860
  key: `${ctx.node.id}_locals`,
3860
3861
  meta: {
3861
- title: (0, import_editor33.getNodeForm)(ctx.node)?.getValueIn("title"),
3862
+ title: (0, import_editor34.getNodeForm)(ctx.node)?.getValueIn("title"),
3862
3863
  icon: ctx.node.getNodeRegistry().info?.icon
3863
3864
  },
3864
- type: import_editor33.ASTFactory.createObject({
3865
+ type: import_editor34.ASTFactory.createObject({
3865
3866
  properties: [
3866
- import_editor33.ASTFactory.createProperty({
3867
+ import_editor34.ASTFactory.createProperty({
3867
3868
  key: "item",
3868
- initializer: import_editor33.ASTFactory.createEnumerateExpression({
3869
- enumerateFor: import_editor33.ASTFactory.createKeyPathExpression({
3869
+ initializer: import_editor34.ASTFactory.createEnumerateExpression({
3870
+ enumerateFor: import_editor34.ASTFactory.createKeyPathExpression({
3870
3871
  keyPath: value.content || []
3871
3872
  })
3872
3873
  })
3873
3874
  }),
3874
- import_editor33.ASTFactory.createProperty({
3875
+ import_editor34.ASTFactory.createProperty({
3875
3876
  key: "index",
3876
- type: import_editor33.ASTFactory.createNumber()
3877
+ type: import_editor34.ASTFactory.createNumber()
3877
3878
  })
3878
3879
  ]
3879
3880
  })
@@ -3882,13 +3883,13 @@ var provideBatchInputEffect = (0, import_editor33.createEffectFromVariableProvid
3882
3883
  });
3883
3884
 
3884
3885
  // src/effects/auto-rename-ref/index.ts
3885
- var import_editor34 = require("@flowgram.ai/editor");
3886
+ var import_editor35 = require("@flowgram.ai/editor");
3886
3887
  var autoRenameRefEffect = [
3887
3888
  {
3888
- event: import_editor34.DataEvent.onValueInit,
3889
+ event: import_editor35.DataEvent.onValueInit,
3889
3890
  effect: (params) => {
3890
3891
  const { context, form, name } = params;
3891
- const renameService = context.node.getService(import_editor34.VariableFieldKeyRenameService);
3892
+ const renameService = context.node.getService(import_editor35.VariableFieldKeyRenameService);
3892
3893
  const disposable = renameService.onRename(({ before, after }) => {
3893
3894
  const beforeKeyPath = [
3894
3895
  ...before.parentFields.map((_field) => _field.key).reverse(),
@@ -3946,13 +3947,13 @@ function traverseRef(name, value, cb) {
3946
3947
 
3947
3948
  // src/effects/provide-json-schema-outputs/index.ts
3948
3949
  var import_json_schema11 = require("@flowgram.ai/json-schema");
3949
- var import_editor35 = require("@flowgram.ai/editor");
3950
- var provideJsonSchemaOutputs = (0, import_editor35.createEffectFromVariableProvider)({
3950
+ var import_editor36 = require("@flowgram.ai/editor");
3951
+ var provideJsonSchemaOutputs = (0, import_editor36.createEffectFromVariableProvider)({
3951
3952
  parse: (value, ctx) => [
3952
- import_editor35.ASTFactory.createVariableDeclaration({
3953
+ import_editor36.ASTFactory.createVariableDeclaration({
3953
3954
  key: `${ctx.node.id}`,
3954
3955
  meta: {
3955
- title: (0, import_editor35.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3956
+ title: (0, import_editor36.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3956
3957
  icon: ctx.node.getNodeRegistry().info?.icon
3957
3958
  },
3958
3959
  type: import_json_schema11.JsonSchemaUtils.schemaToAST(value)
@@ -3961,12 +3962,12 @@ var provideJsonSchemaOutputs = (0, import_editor35.createEffectFromVariableProvi
3961
3962
  });
3962
3963
 
3963
3964
  // src/effects/sync-variable-title/index.ts
3964
- var import_editor36 = require("@flowgram.ai/editor");
3965
+ var import_editor37 = require("@flowgram.ai/editor");
3965
3966
  var syncVariableTitle = [
3966
3967
  {
3967
- event: import_editor36.DataEvent.onValueChange,
3968
+ event: import_editor37.DataEvent.onValueChange,
3968
3969
  effect: ({ value, context }) => {
3969
- context.node.getData(import_editor36.FlowNodeVariableData).allScopes.forEach((_scope) => {
3970
+ context.node.getData(import_editor37.FlowNodeVariableData).allScopes.forEach((_scope) => {
3970
3971
  _scope.output.variables.forEach((_var) => {
3971
3972
  _var.updateMeta({
3972
3973
  ..._var.meta || {},
@@ -3981,14 +3982,14 @@ var syncVariableTitle = [
3981
3982
 
3982
3983
  // src/effects/validate-when-variable-sync/index.ts
3983
3984
  var import_lodash10 = require("lodash");
3984
- var import_editor37 = require("@flowgram.ai/editor");
3985
+ var import_editor38 = require("@flowgram.ai/editor");
3985
3986
  var validateWhenVariableSync = ({
3986
3987
  scope
3987
3988
  } = {}) => [
3988
3989
  {
3989
- event: import_editor37.DataEvent.onValueInit,
3990
+ event: import_editor38.DataEvent.onValueInit,
3990
3991
  effect: ({ context, form }) => {
3991
- const nodeScope = scope === "private" ? (0, import_editor37.getNodePrivateScope)(context.node) : (0, import_editor37.getNodeScope)(context.node);
3992
+ const nodeScope = scope === "private" ? (0, import_editor38.getNodePrivateScope)(context.node) : (0, import_editor38.getNodeScope)(context.node);
3992
3993
  const disposable = nodeScope.available.onListOrAnyVarChange(() => {
3993
3994
  if (!(0, import_lodash10.isEmpty)(form.state.errors)) {
3994
3995
  form.validate();
@@ -4000,16 +4001,16 @@ var validateWhenVariableSync = ({
4000
4001
  ];
4001
4002
 
4002
4003
  // src/effects/listen-ref-value-change/index.ts
4003
- var import_editor38 = require("@flowgram.ai/editor");
4004
+ var import_editor39 = require("@flowgram.ai/editor");
4004
4005
  var listenRefValueChange = (cb) => [
4005
4006
  {
4006
- event: import_editor38.DataEvent.onValueInitOrChange,
4007
+ event: import_editor39.DataEvent.onValueInitOrChange,
4007
4008
  effect: (params) => {
4008
4009
  const { context, value } = params;
4009
4010
  if (value?.type !== "ref") {
4010
4011
  return () => null;
4011
4012
  }
4012
- const disposable = (0, import_editor38.getNodeScope)(context.node).available.trackByKeyPath(
4013
+ const disposable = (0, import_editor39.getNodeScope)(context.node).available.trackByKeyPath(
4013
4014
  value?.content || [],
4014
4015
  (v) => {
4015
4016
  cb({ ...params, variable: v });
@@ -4024,16 +4025,16 @@ var listenRefValueChange = (cb) => [
4024
4025
 
4025
4026
  // src/effects/listen-ref-schema-change/index.ts
4026
4027
  var import_json_schema12 = require("@flowgram.ai/json-schema");
4027
- var import_editor39 = require("@flowgram.ai/editor");
4028
+ var import_editor40 = require("@flowgram.ai/editor");
4028
4029
  var listenRefSchemaChange = (cb) => [
4029
4030
  {
4030
- event: import_editor39.DataEvent.onValueInitOrChange,
4031
+ event: import_editor40.DataEvent.onValueInitOrChange,
4031
4032
  effect: (params) => {
4032
4033
  const { context, value } = params;
4033
4034
  if (value?.type !== "ref") {
4034
4035
  return () => null;
4035
4036
  }
4036
- const disposable = (0, import_editor39.getNodeScope)(context.node).available.trackByKeyPath(
4037
+ const disposable = (0, import_editor40.getNodeScope)(context.node).available.trackByKeyPath(
4037
4038
  value?.content || [],
4038
4039
  (_type) => {
4039
4040
  cb({ ...params, schema: import_json_schema12.JsonSchemaUtils.astToSchema(_type) });
@@ -4050,21 +4051,21 @@ var listenRefSchemaChange = (cb) => [
4050
4051
  ];
4051
4052
 
4052
4053
  // src/form-plugins/batch-outputs-plugin/index.ts
4053
- var import_editor40 = require("@flowgram.ai/editor");
4054
- var provideBatchOutputsEffect = (0, import_editor40.createEffectFromVariableProvider)({
4054
+ var import_editor41 = require("@flowgram.ai/editor");
4055
+ var provideBatchOutputsEffect = (0, import_editor41.createEffectFromVariableProvider)({
4055
4056
  parse: (value, ctx) => [
4056
- import_editor40.ASTFactory.createVariableDeclaration({
4057
+ import_editor41.ASTFactory.createVariableDeclaration({
4057
4058
  key: `${ctx.node.id}`,
4058
4059
  meta: {
4059
- title: (0, import_editor40.getNodeForm)(ctx.node)?.getValueIn("title"),
4060
+ title: (0, import_editor41.getNodeForm)(ctx.node)?.getValueIn("title"),
4060
4061
  icon: ctx.node.getNodeRegistry().info?.icon
4061
4062
  },
4062
- type: import_editor40.ASTFactory.createObject({
4063
+ type: import_editor41.ASTFactory.createObject({
4063
4064
  properties: Object.entries(value).map(
4064
- ([_key, value2]) => import_editor40.ASTFactory.createProperty({
4065
+ ([_key, value2]) => import_editor41.ASTFactory.createProperty({
4065
4066
  key: _key,
4066
- initializer: import_editor40.ASTFactory.createWrapArrayExpression({
4067
- wrapFor: import_editor40.ASTFactory.createKeyPathExpression({
4067
+ initializer: import_editor41.ASTFactory.createWrapArrayExpression({
4068
+ wrapFor: import_editor41.ASTFactory.createKeyPathExpression({
4068
4069
  keyPath: value2?.content || []
4069
4070
  })
4070
4071
  })
@@ -4074,7 +4075,7 @@ var provideBatchOutputsEffect = (0, import_editor40.createEffectFromVariableProv
4074
4075
  })
4075
4076
  ]
4076
4077
  });
4077
- var createBatchOutputsFormPlugin = (0, import_editor40.defineFormPluginCreator)({
4078
+ var createBatchOutputsFormPlugin = (0, import_editor41.defineFormPluginCreator)({
4078
4079
  name: "batch-outputs-plugin",
4079
4080
  onSetupFormMeta({ mergeEffect }, { outputKey }) {
4080
4081
  mergeEffect({
@@ -4082,7 +4083,7 @@ var createBatchOutputsFormPlugin = (0, import_editor40.defineFormPluginCreator)(
4082
4083
  });
4083
4084
  },
4084
4085
  onInit(ctx, { outputKey }) {
4085
- const chainTransformService = ctx.node.getService(import_editor40.ScopeChainTransformService);
4086
+ const chainTransformService = ctx.node.getService(import_editor41.ScopeChainTransformService);
4086
4087
  const batchNodeType = ctx.node.flowNodeType;
4087
4088
  const transformerId = `${batchNodeType}-outputs`;
4088
4089
  if (chainTransformService.hasTransformer(transformerId)) {
@@ -4092,21 +4093,21 @@ var createBatchOutputsFormPlugin = (0, import_editor40.defineFormPluginCreator)(
4092
4093
  transformCovers: (covers, ctx2) => {
4093
4094
  const node = ctx2.scope.meta?.node;
4094
4095
  if (node?.parent?.flowNodeType === batchNodeType) {
4095
- return [...covers, (0, import_editor40.getNodeScope)(node.parent)];
4096
+ return [...covers, (0, import_editor41.getNodeScope)(node.parent)];
4096
4097
  }
4097
4098
  return covers;
4098
4099
  },
4099
4100
  transformDeps(scopes, ctx2) {
4100
4101
  const scopeMeta = ctx2.scope.meta;
4101
- if (scopeMeta?.type === import_editor40.FlowNodeScopeType.private) {
4102
+ if (scopeMeta?.type === import_editor41.FlowNodeScopeType.private) {
4102
4103
  return scopes;
4103
4104
  }
4104
4105
  const node = scopeMeta?.node;
4105
4106
  if (node?.flowNodeType === batchNodeType) {
4106
4107
  const childBlocks = node.blocks;
4107
4108
  return [
4108
- (0, import_editor40.getNodePrivateScope)(node),
4109
- ...childBlocks.map((_childBlock) => (0, import_editor40.getNodeScope)(_childBlock))
4109
+ (0, import_editor41.getNodePrivateScope)(node),
4110
+ ...childBlocks.map((_childBlock) => (0, import_editor41.getNodeScope)(_childBlock))
4110
4111
  ];
4111
4112
  }
4112
4113
  return scopes;
@@ -4117,8 +4118,8 @@ var createBatchOutputsFormPlugin = (0, import_editor40.defineFormPluginCreator)(
4117
4118
 
4118
4119
  // src/form-plugins/infer-inputs-plugin/index.ts
4119
4120
  var import_lodash11 = require("lodash");
4120
- var import_editor41 = require("@flowgram.ai/editor");
4121
- var createInferInputsPlugin = (0, import_editor41.defineFormPluginCreator)({
4121
+ var import_editor42 = require("@flowgram.ai/editor");
4122
+ var createInferInputsPlugin = (0, import_editor42.defineFormPluginCreator)({
4122
4123
  onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
4123
4124
  if (!sourceKey || !targetKey) {
4124
4125
  return;
@@ -4129,7 +4130,7 @@ var createInferInputsPlugin = (0, import_editor41.defineFormPluginCreator)({
4129
4130
  targetKey,
4130
4131
  FlowValueUtils.inferJsonSchema(
4131
4132
  (0, import_lodash11.get)(formData, sourceKey),
4132
- scope === "private" ? (0, import_editor41.getNodePrivateScope)(ctx.node) : (0, import_editor41.getNodeScope)(ctx.node)
4133
+ scope === "private" ? (0, import_editor42.getNodePrivateScope)(ctx.node) : (0, import_editor42.getNodeScope)(ctx.node)
4133
4134
  )
4134
4135
  );
4135
4136
  return formData;
@@ -4140,32 +4141,32 @@ var createInferInputsPlugin = (0, import_editor41.defineFormPluginCreator)({
4140
4141
  // src/form-plugins/infer-assign-plugin/index.ts
4141
4142
  var import_lodash12 = require("lodash");
4142
4143
  var import_json_schema13 = require("@flowgram.ai/json-schema");
4143
- var import_editor42 = require("@flowgram.ai/editor");
4144
- var createInferAssignPlugin = (0, import_editor42.defineFormPluginCreator)({
4144
+ var import_editor43 = require("@flowgram.ai/editor");
4145
+ var createInferAssignPlugin = (0, import_editor43.defineFormPluginCreator)({
4145
4146
  onSetupFormMeta({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
4146
4147
  if (!assignKey || !outputKey) {
4147
4148
  return;
4148
4149
  }
4149
4150
  mergeEffect({
4150
- [assignKey]: (0, import_editor42.createEffectFromVariableProvider)({
4151
+ [assignKey]: (0, import_editor43.createEffectFromVariableProvider)({
4151
4152
  parse: (value, ctx) => {
4152
4153
  const declareRows = (0, import_lodash12.uniqBy)(
4153
4154
  value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
4154
4155
  "left"
4155
4156
  );
4156
4157
  return [
4157
- import_editor42.ASTFactory.createVariableDeclaration({
4158
+ import_editor43.ASTFactory.createVariableDeclaration({
4158
4159
  key: `${ctx.node.id}`,
4159
4160
  meta: {
4160
- title: (0, import_editor42.getNodeForm)(ctx.node)?.getValueIn("title"),
4161
+ title: (0, import_editor43.getNodeForm)(ctx.node)?.getValueIn("title"),
4161
4162
  icon: ctx.node.getNodeRegistry().info?.icon
4162
4163
  },
4163
- type: import_editor42.ASTFactory.createObject({
4164
+ type: import_editor43.ASTFactory.createObject({
4164
4165
  properties: declareRows.map(
4165
- (_v) => import_editor42.ASTFactory.createProperty({
4166
+ (_v) => import_editor43.ASTFactory.createProperty({
4166
4167
  key: _v.left,
4167
4168
  type: _v.right?.type === "constant" ? import_json_schema13.JsonSchemaUtils.schemaToAST(_v.right?.schema || {}) : void 0,
4168
- initializer: _v.right?.type === "ref" ? import_editor42.ASTFactory.createKeyPathExpression({
4169
+ initializer: _v.right?.type === "ref" ? import_editor43.ASTFactory.createKeyPathExpression({
4169
4170
  keyPath: _v.right?.content || []
4170
4171
  }) : {}
4171
4172
  })
@@ -4180,7 +4181,7 @@ var createInferAssignPlugin = (0, import_editor42.defineFormPluginCreator)({
4180
4181
  (0, import_lodash12.set)(
4181
4182
  formData,
4182
4183
  outputKey,
4183
- import_json_schema13.JsonSchemaUtils.astToSchema((0, import_editor42.getNodeScope)(ctx.node).output.variables?.[0]?.type)
4184
+ import_json_schema13.JsonSchemaUtils.astToSchema((0, import_editor43.getNodeScope)(ctx.node).output.variables?.[0]?.type)
4184
4185
  );
4185
4186
  return formData;
4186
4187
  });
@@ -4189,7 +4190,7 @@ var createInferAssignPlugin = (0, import_editor42.defineFormPluginCreator)({
4189
4190
 
4190
4191
  // src/validate/validate-flow-value/index.tsx
4191
4192
  var import_lodash13 = require("lodash");
4192
- var import_editor43 = require("@flowgram.ai/editor");
4193
+ var import_editor44 = require("@flowgram.ai/editor");
4193
4194
  function validateFlowValue(value, ctx) {
4194
4195
  const { node, required, errorMessages } = ctx;
4195
4196
  const {
@@ -4198,15 +4199,15 @@ function validateFlowValue(value, ctx) {
4198
4199
  } = errorMessages || {};
4199
4200
  if (required && ((0, import_lodash13.isNil)(value) || (0, import_lodash13.isNil)(value?.content) || value?.content === "")) {
4200
4201
  return {
4201
- level: import_editor43.FeedbackLevel.Error,
4202
+ level: import_editor44.FeedbackLevel.Error,
4202
4203
  message: requiredMessage
4203
4204
  };
4204
4205
  }
4205
4206
  if (value?.type === "ref") {
4206
- const variable = (0, import_editor43.getNodeScope)(node).available.getByKeyPath(value?.content || []);
4207
+ const variable = (0, import_editor44.getNodeScope)(node).available.getByKeyPath(value?.content || []);
4207
4208
  if (!variable) {
4208
4209
  return {
4209
- level: import_editor43.FeedbackLevel.Error,
4210
+ level: import_editor44.FeedbackLevel.Error,
4210
4211
  message: unknownVariableMessage
4211
4212
  };
4212
4213
  }
@@ -4214,10 +4215,10 @@ function validateFlowValue(value, ctx) {
4214
4215
  if (value?.type === "template") {
4215
4216
  const allRefs = FlowValueUtils.getTemplateKeyPaths(value);
4216
4217
  for (const ref of allRefs) {
4217
- const variable = (0, import_editor43.getNodeScope)(node).available.getByKeyPath(ref);
4218
+ const variable = (0, import_editor44.getNodeScope)(node).available.getByKeyPath(ref);
4218
4219
  if (!variable) {
4219
4220
  return {
4220
- level: import_editor43.FeedbackLevel.Error,
4221
+ level: import_editor44.FeedbackLevel.Error,
4221
4222
  message: unknownVariableMessage
4222
4223
  };
4223
4224
  }