@flowgram.ai/variable-core 0.4.7 → 0.4.9

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
@@ -627,10 +627,21 @@ declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any
627
627
  * SPDX-License-Identifier: MIT
628
628
  */
629
629
 
630
+ interface StringJSON {
631
+ /**
632
+ * https://json-schema.org/understanding-json-schema/reference/type#format
633
+ */
634
+ format?: string;
635
+ }
630
636
  declare class StringType extends BaseType {
631
637
  flags: ASTNodeFlags;
632
638
  static kind: string;
633
- fromJSON(): void;
639
+ protected _format?: string;
640
+ /**
641
+ * https://json-schema.org/understanding-json-schema/reference/type#format
642
+ */
643
+ get format(): string | undefined;
644
+ fromJSON(json?: StringJSON): void;
634
645
  }
635
646
 
636
647
  /**
@@ -1034,7 +1045,8 @@ declare namespace ASTFactory {
1034
1045
  * 类型相关
1035
1046
  * @returns
1036
1047
  */
1037
- const createString: () => {
1048
+ const createString: (json?: StringJSON) => {
1049
+ format?: string;
1038
1050
  kind: ASTKind;
1039
1051
  };
1040
1052
  const createNumber: () => {
package/dist/index.d.ts CHANGED
@@ -627,10 +627,21 @@ declare abstract class BaseType<JSON extends ASTNodeJSON = any, InjectOpts = any
627
627
  * SPDX-License-Identifier: MIT
628
628
  */
629
629
 
630
+ interface StringJSON {
631
+ /**
632
+ * https://json-schema.org/understanding-json-schema/reference/type#format
633
+ */
634
+ format?: string;
635
+ }
630
636
  declare class StringType extends BaseType {
631
637
  flags: ASTNodeFlags;
632
638
  static kind: string;
633
- fromJSON(): void;
639
+ protected _format?: string;
640
+ /**
641
+ * https://json-schema.org/understanding-json-schema/reference/type#format
642
+ */
643
+ get format(): string | undefined;
644
+ fromJSON(json?: StringJSON): void;
634
645
  }
635
646
 
636
647
  /**
@@ -1034,7 +1045,8 @@ declare namespace ASTFactory {
1034
1045
  * 类型相关
1035
1046
  * @returns
1036
1047
  */
1037
- const createString: () => {
1048
+ const createString: (json?: StringJSON) => {
1049
+ format?: string;
1038
1050
  kind: ASTKind;
1039
1051
  };
1040
1052
  const createNumber: () => {
package/dist/index.js CHANGED
@@ -729,7 +729,17 @@ var StringType = class extends BaseType {
729
729
  super(...arguments);
730
730
  this.flags = 8 /* BasicType */;
731
731
  }
732
- fromJSON() {
732
+ /**
733
+ * https://json-schema.org/understanding-json-schema/reference/type#format
734
+ */
735
+ get format() {
736
+ return this._format;
737
+ }
738
+ fromJSON(json) {
739
+ if (json?.format !== this._format) {
740
+ this._format = json?.format;
741
+ this.fireChange();
742
+ }
733
743
  }
734
744
  };
735
745
  StringType.kind = "String" /* String */;
@@ -1589,7 +1599,10 @@ ASTRegisters = __decorateClass([
1589
1599
  // src/ast/factory.ts
1590
1600
  var ASTFactory;
1591
1601
  ((ASTFactory2) => {
1592
- ASTFactory2.createString = () => ({ kind: "String" /* String */ });
1602
+ ASTFactory2.createString = (json) => ({
1603
+ kind: "String" /* String */,
1604
+ ...json || {}
1605
+ });
1593
1606
  ASTFactory2.createNumber = () => ({ kind: "Number" /* Number */ });
1594
1607
  ASTFactory2.createBoolean = () => ({ kind: "Boolean" /* Boolean */ });
1595
1608
  ASTFactory2.createInteger = () => ({ kind: "Integer" /* Integer */ });