@flowgram.ai/variable-core 0.2.0 → 0.2.2

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.d.mts CHANGED
@@ -494,29 +494,6 @@ declare class MapNode extends ASTNode<MapNodeJSON> {
494
494
  get(key: string): ASTNode | undefined;
495
495
  }
496
496
 
497
- declare namespace VarJSONSchema {
498
- type BasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
499
- interface ISchema<T = string> {
500
- type?: T;
501
- default?: any;
502
- title?: string;
503
- description?: string;
504
- enum?: (string | number)[];
505
- properties?: Record<string, ISchema<T>>;
506
- additionalProperties?: ISchema<T>;
507
- items?: ISchema<T>;
508
- required?: string[];
509
- $ref?: string;
510
- extra?: {
511
- index?: number;
512
- weak?: boolean;
513
- formComponent?: string;
514
- [key: string]: any;
515
- };
516
- }
517
- type IBasicSchema = ISchema<BasicType>;
518
- }
519
-
520
497
  declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any> extends ASTNode<JSON, InjectOpts> {
521
498
  flags: number;
522
499
  /**
@@ -534,41 +511,28 @@ declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any
534
511
  * @returns
535
512
  */
536
513
  toJSON(): ASTNodeJSON;
537
- /**
538
- * Get Standard JSON Schema for current base type
539
- * @returns
540
- */
541
- toJSONSchema(): VarJSONSchema.ISchema;
542
- /**
543
- * Check if the type is equal with json schema
544
- */
545
- isEqualWithJSONSchema(schema: VarJSONSchema.ISchema | VarJSONSchema.ISchema[]): boolean;
546
514
  }
547
515
 
548
516
  declare class StringType extends BaseType {
549
517
  flags: ASTNodeFlags;
550
518
  static kind: string;
551
519
  fromJSON(): void;
552
- toJSONSchema(): VarJSONSchema.ISchema;
553
520
  }
554
521
 
555
522
  declare class IntegerType extends BaseType {
556
523
  flags: ASTNodeFlags;
557
524
  static kind: string;
558
525
  fromJSON(): void;
559
- toJSONSchema(): VarJSONSchema.ISchema;
560
526
  }
561
527
 
562
528
  declare class BooleanType extends BaseType {
563
529
  static kind: string;
564
530
  fromJSON(): void;
565
- toJSONSchema(): VarJSONSchema.ISchema;
566
531
  }
567
532
 
568
533
  declare class NumberType extends BaseType {
569
534
  static kind: string;
570
535
  fromJSON(): void;
571
- toJSONSchema(): VarJSONSchema.ISchema;
572
536
  }
573
537
 
574
538
  interface ArrayJSON {
@@ -608,7 +572,6 @@ declare class MapType extends BaseType<MapJSON> {
608
572
  */
609
573
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
610
574
  toJSON(): ASTNodeJSON;
611
- toJSONSchema(): VarJSONSchema.ISchema;
612
575
  }
613
576
 
614
577
  type PropertyJSON<VariableMeta = any> = BaseVariableFieldJSON<VariableMeta> & {
@@ -648,7 +611,6 @@ declare class ObjectType extends BaseType<ObjectJSON> {
648
611
  * @returns
649
612
  */
650
613
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
651
- toJSONSchema(): VarJSONSchema.ISchema;
652
614
  }
653
615
 
654
616
  interface UnionJSON {
@@ -664,7 +626,6 @@ declare class CustomType extends BaseType<CustomTypeJSON> {
664
626
  get typeName(): string;
665
627
  fromJSON(json: CustomTypeJSON): void;
666
628
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
667
- toJSONSchema(): VarJSONSchema.ISchema;
668
629
  }
669
630
 
670
631
  type ExpressionRefs = (BaseVariableField | undefined)[];
@@ -953,18 +914,6 @@ declare namespace ASTFactory {
953
914
  wrapFor: ASTNodeJSON;
954
915
  kind: ASTKind;
955
916
  };
956
- /**
957
- * Converts a JSON schema to an Abstract Syntax Tree (AST) representation.
958
- * This function recursively processes the JSON schema and creates corresponding AST nodes.
959
- *
960
- * For more information on JSON Schema, refer to the official documentation:
961
- * https://json-schema.org/
962
- *
963
- *
964
- * @param jsonSchema - The JSON schema to convert.
965
- * @returns An AST node representing the JSON schema, or undefined if the schema type is not recognized.
966
- */
967
- function createTypeASTFromSchema(jsonSchema: VarJSONSchema.ISchema): ASTNodeJSON | undefined;
968
917
  /**
969
918
  * 通过 AST Class 创建
970
919
  */
@@ -1112,4 +1061,4 @@ declare class VariableFieldKeyRenameService {
1112
1061
  dispose(): void;
1113
1062
  }
1114
1063
 
1115
- export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, KeyPathExpressionV2, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VarJSONSchema, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
1064
+ export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, KeyPathExpressionV2, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
package/dist/index.d.ts CHANGED
@@ -494,29 +494,6 @@ declare class MapNode extends ASTNode<MapNodeJSON> {
494
494
  get(key: string): ASTNode | undefined;
495
495
  }
496
496
 
497
- declare namespace VarJSONSchema {
498
- type BasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
499
- interface ISchema<T = string> {
500
- type?: T;
501
- default?: any;
502
- title?: string;
503
- description?: string;
504
- enum?: (string | number)[];
505
- properties?: Record<string, ISchema<T>>;
506
- additionalProperties?: ISchema<T>;
507
- items?: ISchema<T>;
508
- required?: string[];
509
- $ref?: string;
510
- extra?: {
511
- index?: number;
512
- weak?: boolean;
513
- formComponent?: string;
514
- [key: string]: any;
515
- };
516
- }
517
- type IBasicSchema = ISchema<BasicType>;
518
- }
519
-
520
497
  declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any> extends ASTNode<JSON, InjectOpts> {
521
498
  flags: number;
522
499
  /**
@@ -534,41 +511,28 @@ declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any
534
511
  * @returns
535
512
  */
536
513
  toJSON(): ASTNodeJSON;
537
- /**
538
- * Get Standard JSON Schema for current base type
539
- * @returns
540
- */
541
- toJSONSchema(): VarJSONSchema.ISchema;
542
- /**
543
- * Check if the type is equal with json schema
544
- */
545
- isEqualWithJSONSchema(schema: VarJSONSchema.ISchema | VarJSONSchema.ISchema[]): boolean;
546
514
  }
547
515
 
548
516
  declare class StringType extends BaseType {
549
517
  flags: ASTNodeFlags;
550
518
  static kind: string;
551
519
  fromJSON(): void;
552
- toJSONSchema(): VarJSONSchema.ISchema;
553
520
  }
554
521
 
555
522
  declare class IntegerType extends BaseType {
556
523
  flags: ASTNodeFlags;
557
524
  static kind: string;
558
525
  fromJSON(): void;
559
- toJSONSchema(): VarJSONSchema.ISchema;
560
526
  }
561
527
 
562
528
  declare class BooleanType extends BaseType {
563
529
  static kind: string;
564
530
  fromJSON(): void;
565
- toJSONSchema(): VarJSONSchema.ISchema;
566
531
  }
567
532
 
568
533
  declare class NumberType extends BaseType {
569
534
  static kind: string;
570
535
  fromJSON(): void;
571
- toJSONSchema(): VarJSONSchema.ISchema;
572
536
  }
573
537
 
574
538
  interface ArrayJSON {
@@ -608,7 +572,6 @@ declare class MapType extends BaseType<MapJSON> {
608
572
  */
609
573
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
610
574
  toJSON(): ASTNodeJSON;
611
- toJSONSchema(): VarJSONSchema.ISchema;
612
575
  }
613
576
 
614
577
  type PropertyJSON<VariableMeta = any> = BaseVariableFieldJSON<VariableMeta> & {
@@ -648,7 +611,6 @@ declare class ObjectType extends BaseType<ObjectJSON> {
648
611
  * @returns
649
612
  */
650
613
  protected customStrongEqual(targetTypeJSON: ASTNodeJSON): boolean;
651
- toJSONSchema(): VarJSONSchema.ISchema;
652
614
  }
653
615
 
654
616
  interface UnionJSON {
@@ -664,7 +626,6 @@ declare class CustomType extends BaseType<CustomTypeJSON> {
664
626
  get typeName(): string;
665
627
  fromJSON(json: CustomTypeJSON): void;
666
628
  isTypeEqual(targetTypeJSONOrKind?: ASTNodeJSONOrKind): boolean;
667
- toJSONSchema(): VarJSONSchema.ISchema;
668
629
  }
669
630
 
670
631
  type ExpressionRefs = (BaseVariableField | undefined)[];
@@ -953,18 +914,6 @@ declare namespace ASTFactory {
953
914
  wrapFor: ASTNodeJSON;
954
915
  kind: ASTKind;
955
916
  };
956
- /**
957
- * Converts a JSON schema to an Abstract Syntax Tree (AST) representation.
958
- * This function recursively processes the JSON schema and creates corresponding AST nodes.
959
- *
960
- * For more information on JSON Schema, refer to the official documentation:
961
- * https://json-schema.org/
962
- *
963
- *
964
- * @param jsonSchema - The JSON schema to convert.
965
- * @returns An AST node representing the JSON schema, or undefined if the schema type is not recognized.
966
- */
967
- function createTypeASTFromSchema(jsonSchema: VarJSONSchema.ISchema): ASTNodeJSON | undefined;
968
917
  /**
969
918
  * 通过 AST Class 创建
970
919
  */
@@ -1112,4 +1061,4 @@ declare class VariableFieldKeyRenameService {
1112
1061
  dispose(): void;
1113
1062
  }
1114
1063
 
1115
- export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, KeyPathExpressionV2, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VarJSONSchema, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
1064
+ export { ASTFactory, ASTKind, ASTMatch, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, CustomType, type CustomTypeJSON, DataNode, EnumerateExpression, type EnumerateExpressionJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, type IVariableTable, IntegerType, KeyPathExpression, type KeyPathExpressionJSON$1 as KeyPathExpressionJSON, KeyPathExpressionV2, ListNode, type ListNodeJSON, MapNode, type MapNodeJSON, MapType, NumberType, type ObjectJSON, type ObjectPropertiesChangeAction, ObjectType, Property, type PropertyJSON, Scope, ScopeChain, ScopeOutputData, ScopeProvider, StringType, type UnionJSON, VariableContainerModule, VariableDeclaration, type VariableDeclarationJSON, VariableDeclarationList, type VariableDeclarationListChangeAction, type VariableDeclarationListJSON, VariableEngine, VariableEngineProvider, VariableFieldKeyRenameService, WrapArrayExpression, type WrapArrayExpressionJSON, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
package/dist/index.js CHANGED
@@ -289,7 +289,7 @@ var ASTKind = /* @__PURE__ */ ((ASTKind2) => {
289
289
  })(ASTKind || {});
290
290
 
291
291
  // src/ast/ast-registers.ts
292
- var import_lodash4 = require("lodash");
292
+ var import_lodash3 = require("lodash");
293
293
  var import_inversify3 = require("inversify");
294
294
 
295
295
  // src/ast/utils/inversify.ts
@@ -608,106 +608,6 @@ var ASTNode = class _ASTNode {
608
608
  }
609
609
  };
610
610
 
611
- // src/ast/factory.ts
612
- var import_lodash = require("lodash");
613
- var ASTFactory;
614
- ((ASTFactory2) => {
615
- ASTFactory2.createString = () => ({ kind: "String" /* String */ });
616
- ASTFactory2.createNumber = () => ({ kind: "Number" /* Number */ });
617
- ASTFactory2.createBoolean = () => ({ kind: "Boolean" /* Boolean */ });
618
- ASTFactory2.createInteger = () => ({ kind: "Integer" /* Integer */ });
619
- ASTFactory2.createObject = (json) => ({
620
- kind: "Object" /* Object */,
621
- ...json
622
- });
623
- ASTFactory2.createArray = (json) => ({
624
- kind: "Array" /* Array */,
625
- ...json
626
- });
627
- ASTFactory2.createMap = (json) => ({
628
- kind: "Map" /* Map */,
629
- ...json
630
- });
631
- ASTFactory2.createUnion = (json) => ({
632
- kind: "Union" /* Union */,
633
- ...json
634
- });
635
- ASTFactory2.createCustomType = (json) => ({
636
- kind: "CustomType" /* CustomType */,
637
- ...json
638
- });
639
- ASTFactory2.createVariableDeclaration = (json) => ({
640
- kind: "VariableDeclaration" /* VariableDeclaration */,
641
- ...json
642
- });
643
- ASTFactory2.createProperty = (json) => ({
644
- kind: "Property" /* Property */,
645
- ...json
646
- });
647
- ASTFactory2.createVariableDeclarationList = (json) => ({
648
- kind: "VariableDeclarationList" /* VariableDeclarationList */,
649
- ...json
650
- });
651
- ASTFactory2.createEnumerateExpression = (json) => ({
652
- kind: "EnumerateExpression" /* EnumerateExpression */,
653
- ...json
654
- });
655
- ASTFactory2.createKeyPathExpression = (json) => ({
656
- kind: "KeyPathExpression" /* KeyPathExpression */,
657
- ...json
658
- });
659
- ASTFactory2.createWrapArrayExpression = (json) => ({
660
- kind: "WrapArrayExpression" /* WrapArrayExpression */,
661
- ...json
662
- });
663
- function createTypeASTFromSchema(jsonSchema) {
664
- const { type, extra } = jsonSchema || {};
665
- const { weak = false } = extra || {};
666
- if (!type) {
667
- return void 0;
668
- }
669
- switch (type) {
670
- case "object":
671
- if (weak) {
672
- return { kind: "Object" /* Object */, weak: true };
673
- }
674
- return ASTFactory2.createObject({
675
- properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => ((0, import_lodash.get)(a?.[1], "extra.index") || 0) - ((0, import_lodash.get)(b?.[1], "extra.index") || 0)).map(([key, _property]) => ({
676
- key,
677
- type: createTypeASTFromSchema(_property),
678
- meta: { description: _property.description }
679
- }))
680
- });
681
- case "array":
682
- if (weak) {
683
- return { kind: "Array" /* Array */, weak: true };
684
- }
685
- return ASTFactory2.createArray({
686
- items: createTypeASTFromSchema(jsonSchema.items)
687
- });
688
- case "map":
689
- if (weak) {
690
- return { kind: "Map" /* Map */, weak: true };
691
- }
692
- return ASTFactory2.createMap({
693
- valueType: createTypeASTFromSchema(jsonSchema.additionalProperties)
694
- });
695
- case "string":
696
- return ASTFactory2.createString();
697
- case "number":
698
- return ASTFactory2.createNumber();
699
- case "boolean":
700
- return ASTFactory2.createBoolean();
701
- case "integer":
702
- return ASTFactory2.createInteger();
703
- default:
704
- return ASTFactory2.createCustomType({ typeName: type });
705
- }
706
- }
707
- ASTFactory2.createTypeASTFromSchema = createTypeASTFromSchema;
708
- ASTFactory2.create = (targetType, json) => ({ kind: targetType.kind, ...json });
709
- })(ASTFactory || (ASTFactory = {}));
710
-
711
611
  // src/ast/type/base-type.ts
712
612
  var BaseType = class extends ASTNode {
713
613
  constructor() {
@@ -743,28 +643,6 @@ var BaseType = class extends ASTNode {
743
643
  kind: this.kind
744
644
  };
745
645
  }
746
- /**
747
- * Get Standard JSON Schema for current base type
748
- * @returns
749
- */
750
- toJSONSchema() {
751
- return {
752
- type: this.kind.toLowerCase()
753
- };
754
- }
755
- /**
756
- * Check if the type is equal with json schema
757
- */
758
- isEqualWithJSONSchema(schema) {
759
- if (Array.isArray(schema)) {
760
- return this.isTypeEqual(
761
- ASTFactory.createUnion({
762
- types: schema.map((_schema) => ASTFactory.createTypeASTFromSchema(_schema)).filter(Boolean)
763
- })
764
- );
765
- }
766
- return this.isTypeEqual(ASTFactory.createTypeASTFromSchema(schema));
767
- }
768
646
  };
769
647
 
770
648
  // src/ast/type/array.ts
@@ -824,11 +702,6 @@ var StringType = class extends BaseType {
824
702
  }
825
703
  fromJSON() {
826
704
  }
827
- toJSONSchema() {
828
- return {
829
- type: "string"
830
- };
831
- }
832
705
  };
833
706
  StringType.kind = "String" /* String */;
834
707
 
@@ -840,11 +713,6 @@ var IntegerType = class extends BaseType {
840
713
  }
841
714
  fromJSON() {
842
715
  }
843
- toJSONSchema() {
844
- return {
845
- type: "integer"
846
- };
847
- }
848
716
  };
849
717
  IntegerType.kind = "Integer" /* Integer */;
850
718
 
@@ -852,11 +720,6 @@ IntegerType.kind = "Integer" /* Integer */;
852
720
  var BooleanType = class extends BaseType {
853
721
  fromJSON() {
854
722
  }
855
- toJSONSchema() {
856
- return {
857
- type: "boolean"
858
- };
859
- }
860
723
  };
861
724
  BooleanType.kind = "Boolean" /* Boolean */;
862
725
 
@@ -864,11 +727,6 @@ BooleanType.kind = "Boolean" /* Boolean */;
864
727
  var NumberType = class extends BaseType {
865
728
  fromJSON() {
866
729
  }
867
- toJSONSchema() {
868
- return {
869
- type: "number"
870
- };
871
- }
872
730
  };
873
731
  NumberType.kind = "Number" /* Number */;
874
732
 
@@ -915,18 +773,12 @@ var MapType = class extends BaseType {
915
773
  valueType: this.valueType?.toJSON()
916
774
  };
917
775
  }
918
- toJSONSchema() {
919
- return {
920
- type: "map",
921
- additionalProperties: this.valueType?.toJSONSchema()
922
- };
923
- }
924
776
  };
925
777
  // public flags: ASTNodeFlags = ASTNodeFlags.DrilldownType | ASTNodeFlags.EnumerateType;
926
778
  MapType.kind = "Map" /* Map */;
927
779
 
928
780
  // src/ast/type/object.ts
929
- var import_lodash2 = require("lodash");
781
+ var import_lodash = require("lodash");
930
782
  var ObjectType = class extends BaseType {
931
783
  constructor() {
932
784
  super(...arguments);
@@ -1006,21 +858,12 @@ var ObjectType = class extends BaseType {
1006
858
  const targetProperties = targetTypeJSON.properties || [];
1007
859
  const sourcePropertyKeys = Array.from(this.propertyTable.keys());
1008
860
  const targetPropertyKeys = targetProperties.map((_target) => _target.key);
1009
- const isKeyStrongEqual = !(0, import_lodash2.xor)(sourcePropertyKeys, targetPropertyKeys).length;
861
+ const isKeyStrongEqual = !(0, import_lodash.xor)(sourcePropertyKeys, targetPropertyKeys).length;
1010
862
  return isKeyStrongEqual && targetProperties.every((targetProperty) => {
1011
863
  const sourceProperty = this.propertyTable.get(targetProperty.key);
1012
864
  return sourceProperty && sourceProperty.key === targetProperty.key && sourceProperty.type?.isTypeEqual(targetProperty?.type);
1013
865
  });
1014
866
  }
1015
- toJSONSchema() {
1016
- return {
1017
- type: "object",
1018
- properties: this.properties.reduce((acc, _property) => {
1019
- acc[_property.key] = _property.type?.toJSONSchema();
1020
- return acc;
1021
- }, {})
1022
- };
1023
- }
1024
867
  };
1025
868
  ObjectType.kind = "Object" /* Object */;
1026
869
 
@@ -1044,11 +887,6 @@ var CustomType = class extends BaseType {
1044
887
  }
1045
888
  return targetTypeJSON?.kind === this.kind && targetTypeJSON?.typeName === this.typeName;
1046
889
  }
1047
- toJSONSchema() {
1048
- return {
1049
- type: this._typeName
1050
- };
1051
- }
1052
890
  };
1053
891
  CustomType.kind = "CustomType" /* CustomType */;
1054
892
 
@@ -1216,12 +1054,12 @@ EnumerateExpression.kind = "EnumerateExpression" /* EnumerateExpression */;
1216
1054
  var import_fast_equals4 = require("fast-equals");
1217
1055
 
1218
1056
  // src/ast/utils/expression.ts
1219
- var import_lodash3 = require("lodash");
1057
+ var import_lodash2 = require("lodash");
1220
1058
  function getAllRefs(ast) {
1221
1059
  return getAllChildren(ast).filter((_child) => _child.flags & 4 /* Expression */).map((_child) => _child.refs).flat().filter(Boolean);
1222
1060
  }
1223
1061
  function checkRefCycle(curr, refNodes) {
1224
- if ((0, import_lodash3.intersection)(curr.scope.coverScopes, refNodes.map((_ref) => _ref?.scope).filter(Boolean)).length === 0) {
1062
+ if ((0, import_lodash2.intersection)(curr.scope.coverScopes, refNodes.map((_ref) => _ref?.scope).filter(Boolean)).length === 0) {
1225
1063
  return false;
1226
1064
  }
1227
1065
  const visited = /* @__PURE__ */ new Set();
@@ -1233,7 +1071,7 @@ function checkRefCycle(curr, refNodes) {
1233
1071
  queue.push(ref);
1234
1072
  }
1235
1073
  }
1236
- return (0, import_lodash3.intersection)(Array.from(visited), getParentFields(curr)).length > 0;
1074
+ return (0, import_lodash2.intersection)(Array.from(visited), getParentFields(curr)).length > 0;
1237
1075
  }
1238
1076
 
1239
1077
  // src/ast/expression/keypath-expression-v2.ts
@@ -1652,7 +1490,7 @@ var ASTRegisters = class {
1652
1490
  this.registerAST(Property);
1653
1491
  this.registerAST(VariableDeclaration);
1654
1492
  this.registerAST(VariableDeclarationList);
1655
- this.registerAST(KeyPathExpression);
1493
+ this.registerAST(KeyPathExpressionV2);
1656
1494
  this.registerAST(EnumerateExpression);
1657
1495
  this.registerAST(WrapArrayExpression);
1658
1496
  this.registerAST(MapNode);
@@ -1678,7 +1516,7 @@ var ASTRegisters = class {
1678
1516
  injector?.() || {}
1679
1517
  );
1680
1518
  node.changeLocked = true;
1681
- node.fromJSON((0, import_lodash4.omit)(json, ["key", "kind"]));
1519
+ node.fromJSON((0, import_lodash3.omit)(json, ["key", "kind"]));
1682
1520
  node.changeLocked = false;
1683
1521
  if (Reflect.hasMetadata(POST_CONSTRUCT_AST_SYMBOL, node)) {
1684
1522
  const postConstructKey = Reflect.getMetadata(POST_CONSTRUCT_AST_SYMBOL, node);
@@ -1710,6 +1548,60 @@ ASTRegisters = __decorateClass([
1710
1548
  (0, import_inversify3.injectable)()
1711
1549
  ], ASTRegisters);
1712
1550
 
1551
+ // src/ast/factory.ts
1552
+ var ASTFactory;
1553
+ ((ASTFactory2) => {
1554
+ ASTFactory2.createString = () => ({ kind: "String" /* String */ });
1555
+ ASTFactory2.createNumber = () => ({ kind: "Number" /* Number */ });
1556
+ ASTFactory2.createBoolean = () => ({ kind: "Boolean" /* Boolean */ });
1557
+ ASTFactory2.createInteger = () => ({ kind: "Integer" /* Integer */ });
1558
+ ASTFactory2.createObject = (json) => ({
1559
+ kind: "Object" /* Object */,
1560
+ ...json
1561
+ });
1562
+ ASTFactory2.createArray = (json) => ({
1563
+ kind: "Array" /* Array */,
1564
+ ...json
1565
+ });
1566
+ ASTFactory2.createMap = (json) => ({
1567
+ kind: "Map" /* Map */,
1568
+ ...json
1569
+ });
1570
+ ASTFactory2.createUnion = (json) => ({
1571
+ kind: "Union" /* Union */,
1572
+ ...json
1573
+ });
1574
+ ASTFactory2.createCustomType = (json) => ({
1575
+ kind: "CustomType" /* CustomType */,
1576
+ ...json
1577
+ });
1578
+ ASTFactory2.createVariableDeclaration = (json) => ({
1579
+ kind: "VariableDeclaration" /* VariableDeclaration */,
1580
+ ...json
1581
+ });
1582
+ ASTFactory2.createProperty = (json) => ({
1583
+ kind: "Property" /* Property */,
1584
+ ...json
1585
+ });
1586
+ ASTFactory2.createVariableDeclarationList = (json) => ({
1587
+ kind: "VariableDeclarationList" /* VariableDeclarationList */,
1588
+ ...json
1589
+ });
1590
+ ASTFactory2.createEnumerateExpression = (json) => ({
1591
+ kind: "EnumerateExpression" /* EnumerateExpression */,
1592
+ ...json
1593
+ });
1594
+ ASTFactory2.createKeyPathExpression = (json) => ({
1595
+ kind: "KeyPathExpression" /* KeyPathExpression */,
1596
+ ...json
1597
+ });
1598
+ ASTFactory2.createWrapArrayExpression = (json) => ({
1599
+ kind: "WrapArrayExpression" /* WrapArrayExpression */,
1600
+ ...json
1601
+ });
1602
+ ASTFactory2.create = (targetType, json) => ({ kind: targetType.kind, ...json });
1603
+ })(ASTFactory || (ASTFactory = {}));
1604
+
1713
1605
  // src/scope/datas/scope-output-data.ts
1714
1606
  var ScopeOutputData = class {
1715
1607
  constructor(scope) {
@@ -1794,7 +1686,7 @@ var ScopeOutputData = class {
1794
1686
 
1795
1687
  // src/scope/datas/scope-available-data.ts
1796
1688
  var import_rxjs4 = require("rxjs");
1797
- var import_lodash5 = require("lodash");
1689
+ var import_lodash4 = require("lodash");
1798
1690
  var import_fast_equals7 = require("fast-equals");
1799
1691
  var import_utils5 = require("@flowgram.ai/utils");
1800
1692
  var import_utils6 = require("@flowgram.ai/utils");
@@ -1809,7 +1701,7 @@ var ScopeAvailableData = class {
1809
1701
  */
1810
1702
  this.variables$ = this.refresh$.pipe(
1811
1703
  // 输出变量是否 version 发生变化
1812
- (0, import_rxjs4.map)(() => (0, import_lodash5.flatten)(this.depScopes.map((scope) => scope.output.variables || []))),
1704
+ (0, import_rxjs4.map)(() => (0, import_lodash4.flatten)(this.depScopes.map((scope) => scope.output.variables || []))),
1813
1705
  // 变量列表浅比较
1814
1706
  (0, import_rxjs4.distinctUntilChanged)(import_fast_equals7.shallowEqual),
1815
1707
  (0, import_rxjs4.share)()
@@ -2091,7 +1983,7 @@ VariableEngine = __decorateClass([
2091
1983
  ], VariableEngine);
2092
1984
 
2093
1985
  // src/services/variable-field-key-rename-service.ts
2094
- var import_lodash6 = require("lodash");
1986
+ var import_lodash5 = require("lodash");
2095
1987
  var import_inversify7 = require("inversify");
2096
1988
  var import_utils10 = require("@flowgram.ai/utils");
2097
1989
  var VariableFieldKeyRenameService = class {
@@ -2134,7 +2026,7 @@ var VariableFieldKeyRenameService = class {
2134
2026
  this.renameEmitter.fire(renameNodeInfo);
2135
2027
  }
2136
2028
  notifyFieldsDispose(prev, next) {
2137
- const removedFields = (0, import_lodash6.difference)(prev || [], next || []);
2029
+ const removedFields = (0, import_lodash5.difference)(prev || [], next || []);
2138
2030
  removedFields.forEach((_field) => this.disposeInListEmitter.fire(_field));
2139
2031
  }
2140
2032
  init() {