@flowgram.ai/variable-core 0.1.6 → 0.1.8
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 +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.d.mts
CHANGED
|
@@ -874,6 +874,11 @@ declare namespace ASTFactory {
|
|
|
874
874
|
declare const injectToAST: (serviceIdentifier: interfaces.ServiceIdentifier) => (target: any, propertyKey: string) => any;
|
|
875
875
|
declare const postConstructAST: () => (target: any, propertyKey: string) => void;
|
|
876
876
|
|
|
877
|
+
declare function isMatchAST<TargetASTNode extends ASTNode>(node?: ASTNode, targetType?: {
|
|
878
|
+
kind: string;
|
|
879
|
+
new (...args: any[]): TargetASTNode;
|
|
880
|
+
}): node is TargetASTNode;
|
|
881
|
+
|
|
877
882
|
declare class Scope<ScopeMeta extends Record<string, any> = Record<string, any>> {
|
|
878
883
|
/**
|
|
879
884
|
* Scope 唯一索引
|
|
@@ -993,4 +998,4 @@ declare class VariableFieldKeyRenameService {
|
|
|
993
998
|
dispose(): void;
|
|
994
999
|
}
|
|
995
1000
|
|
|
996
|
-
export { ASTFactory, ASTKind, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, DataNode, EnumerateExpression, type EnumerateExpressionJSON, ExpressionList, type ExpressionListJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, 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, VariableTable, injectToAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
|
|
1001
|
+
export { ASTFactory, ASTKind, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, DataNode, EnumerateExpression, type EnumerateExpressionJSON, ExpressionList, type ExpressionListJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, 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, VariableTable, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -874,6 +874,11 @@ declare namespace ASTFactory {
|
|
|
874
874
|
declare const injectToAST: (serviceIdentifier: interfaces.ServiceIdentifier) => (target: any, propertyKey: string) => any;
|
|
875
875
|
declare const postConstructAST: () => (target: any, propertyKey: string) => void;
|
|
876
876
|
|
|
877
|
+
declare function isMatchAST<TargetASTNode extends ASTNode>(node?: ASTNode, targetType?: {
|
|
878
|
+
kind: string;
|
|
879
|
+
new (...args: any[]): TargetASTNode;
|
|
880
|
+
}): node is TargetASTNode;
|
|
881
|
+
|
|
877
882
|
declare class Scope<ScopeMeta extends Record<string, any> = Record<string, any>> {
|
|
878
883
|
/**
|
|
879
884
|
* Scope 唯一索引
|
|
@@ -993,4 +998,4 @@ declare class VariableFieldKeyRenameService {
|
|
|
993
998
|
dispose(): void;
|
|
994
999
|
}
|
|
995
1000
|
|
|
996
|
-
export { ASTFactory, ASTKind, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, DataNode, EnumerateExpression, type EnumerateExpressionJSON, ExpressionList, type ExpressionListJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, 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, VariableTable, injectToAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
|
|
1001
|
+
export { ASTFactory, ASTKind, ASTNode, ASTNodeFlags, type ASTNodeJSON, type ASTNodeRegistry, ASTRegisters, ArrayType, BaseExpression, BaseType, BaseVariableField, BooleanType, type CreateASTParams, DataNode, EnumerateExpression, type EnumerateExpressionJSON, ExpressionList, type ExpressionListJSON, type GetKindJSON, type GetKindJSONOrKind, type GlobalEventActionType, 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, VariableTable, injectToAST, isMatchAST, postConstructAST, useAvailableVariables, useCurrentScope, useScopeAvailable, useScopeContext };
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ __export(src_exports, {
|
|
|
64
64
|
VariableFieldKeyRenameService: () => VariableFieldKeyRenameService,
|
|
65
65
|
VariableTable: () => VariableTable,
|
|
66
66
|
injectToAST: () => injectToAST,
|
|
67
|
+
isMatchAST: () => isMatchAST,
|
|
67
68
|
postConstructAST: () => postConstructAST,
|
|
68
69
|
useAvailableVariables: () => useAvailableVariables,
|
|
69
70
|
useCurrentScope: () => useCurrentScope,
|
|
@@ -243,6 +244,9 @@ function parseTypeJsonOrKind(typeJSONOrKind) {
|
|
|
243
244
|
function getAllChildren(ast) {
|
|
244
245
|
return [...ast.children, ...ast.children.map((_child) => getAllChildren(_child)).flat()];
|
|
245
246
|
}
|
|
247
|
+
function isMatchAST(node, targetType) {
|
|
248
|
+
return node?.kind === targetType?.kind;
|
|
249
|
+
}
|
|
246
250
|
|
|
247
251
|
// src/ast/flags.ts
|
|
248
252
|
var ASTNodeFlags = /* @__PURE__ */ ((ASTNodeFlags2) => {
|
|
@@ -2058,6 +2062,7 @@ function useAvailableVariables() {
|
|
|
2058
2062
|
VariableFieldKeyRenameService,
|
|
2059
2063
|
VariableTable,
|
|
2060
2064
|
injectToAST,
|
|
2065
|
+
isMatchAST,
|
|
2061
2066
|
postConstructAST,
|
|
2062
2067
|
useAvailableVariables,
|
|
2063
2068
|
useCurrentScope,
|