@flowgram.ai/variable-core 0.1.12 → 0.1.14
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/esm/index.js +31 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -103,6 +103,7 @@ var ASTKind = /* @__PURE__ */ ((ASTKind2) => {
|
|
|
103
103
|
ASTKind2["Map"] = "Map";
|
|
104
104
|
ASTKind2["Union"] = "Union";
|
|
105
105
|
ASTKind2["Any"] = "Any";
|
|
106
|
+
ASTKind2["CustomType"] = "CustomType";
|
|
106
107
|
ASTKind2["Property"] = "Property";
|
|
107
108
|
ASTKind2["VariableDeclaration"] = "VariableDeclaration";
|
|
108
109
|
ASTKind2["VariableDeclarationList"] = "VariableDeclarationList";
|
|
@@ -676,6 +677,29 @@ var ObjectType = class extends BaseType {
|
|
|
676
677
|
};
|
|
677
678
|
ObjectType.kind = "Object" /* Object */;
|
|
678
679
|
|
|
680
|
+
// src/ast/type/custom-type.ts
|
|
681
|
+
var CustomType = class extends BaseType {
|
|
682
|
+
get typeName() {
|
|
683
|
+
return this._typeName;
|
|
684
|
+
}
|
|
685
|
+
fromJSON(json) {
|
|
686
|
+
if (this._typeName !== json.typeName) {
|
|
687
|
+
this._typeName = json.typeName;
|
|
688
|
+
this.fireChange();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
isTypeEqual(targetTypeJSONOrKind) {
|
|
692
|
+
const targetTypeJSON = parseTypeJsonOrKind(targetTypeJSONOrKind);
|
|
693
|
+
if (targetTypeJSON?.kind === "Union" /* Union */) {
|
|
694
|
+
return (targetTypeJSON?.types || [])?.some(
|
|
695
|
+
(_subType) => this.isTypeEqual(_subType)
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
return targetTypeJSON?.kind === this.kind && targetTypeJSON?.typeName === this.typeName;
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
CustomType.kind = "CustomType" /* CustomType */;
|
|
702
|
+
|
|
679
703
|
// src/ast/expression/base-expression.ts
|
|
680
704
|
import {
|
|
681
705
|
distinctUntilChanged as distinctUntilChanged2,
|
|
@@ -1271,6 +1295,7 @@ var ASTRegisters = class {
|
|
|
1271
1295
|
this.registerAST(ObjectType);
|
|
1272
1296
|
this.registerAST(ArrayType);
|
|
1273
1297
|
this.registerAST(MapType);
|
|
1298
|
+
this.registerAST(CustomType);
|
|
1274
1299
|
this.registerAST(Property);
|
|
1275
1300
|
this.registerAST(VariableDeclaration);
|
|
1276
1301
|
this.registerAST(VariableDeclarationList);
|
|
@@ -1355,6 +1380,10 @@ var ASTFactory;
|
|
|
1355
1380
|
kind: "Union" /* Union */,
|
|
1356
1381
|
...json
|
|
1357
1382
|
});
|
|
1383
|
+
ASTFactory2.createCustomType = (json) => ({
|
|
1384
|
+
kind: "CustomType" /* CustomType */,
|
|
1385
|
+
...json
|
|
1386
|
+
});
|
|
1358
1387
|
ASTFactory2.createVariableDeclaration = (json) => ({
|
|
1359
1388
|
kind: "VariableDeclaration" /* VariableDeclaration */,
|
|
1360
1389
|
...json
|
|
@@ -1375,6 +1404,7 @@ var ASTFactory;
|
|
|
1375
1404
|
kind: "KeyPathExpression" /* KeyPathExpression */,
|
|
1376
1405
|
...json
|
|
1377
1406
|
});
|
|
1407
|
+
ASTFactory2.create = (targetType, json) => ({ kind: targetType.kind, ...json });
|
|
1378
1408
|
})(ASTFactory || (ASTFactory = {}));
|
|
1379
1409
|
|
|
1380
1410
|
// src/scope/variable-table.ts
|
|
@@ -1997,6 +2027,7 @@ export {
|
|
|
1997
2027
|
BaseType,
|
|
1998
2028
|
BaseVariableField,
|
|
1999
2029
|
BooleanType,
|
|
2030
|
+
CustomType,
|
|
2000
2031
|
DataNode,
|
|
2001
2032
|
EnumerateExpression,
|
|
2002
2033
|
ExpressionList,
|