@code0-tech/triangulum 0.3.0 → 0.4.0
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/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataType, Flow,
|
|
1
|
+
import { DataType, Flow, FunctionDefinition, NodeFunction, ReferencePath } from '@code0-tech/sagittarius-graphql-types';
|
|
2
2
|
import { default as ts } from 'typescript';
|
|
3
3
|
import { VirtualTypeScriptEnvironment } from '@typescript/vfs';
|
|
4
4
|
/**
|
|
@@ -18,7 +18,7 @@ export interface ValidationResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Minimal TypeScript library definitions for the virtual compiler environment.
|
|
20
20
|
*/
|
|
21
|
-
export declare const MINIMAL_LIB = "\n interface Array<T> { \n [n: number]: T; \n length: number; \n }\n interface String { readonly length: number; }\n interface Number { }\n interface Boolean { }\n interface Object { }\n interface Function { }\n interface CallableFunction extends Function {}\n interface NewableFunction extends Function {}\n interface IArguments { }\n interface RegExp { }\n type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;\n";
|
|
21
|
+
export declare const MINIMAL_LIB = "\n interface Array<T> { \n [n: number]: T; \n length: number; \n }\n interface String { readonly length: number; }\n interface Number { }\n interface Boolean { }\n interface Object { }\n interface Function { }\n interface CallableFunction extends Function {}\n interface NewableFunction extends Function {}\n interface IArguments { }\n interface RegExp { }\n type Record<K extends keyof any, T> = { [P in K]: T; };\n type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;\n";
|
|
22
22
|
/**
|
|
23
23
|
* Common configuration for the TypeScript compiler host across different validation/inference tasks.
|
|
24
24
|
*/
|
|
@@ -39,13 +39,18 @@ export declare function getSharedTypeDeclarations(dataTypes?: DataType[]): strin
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function getTypeFromReferencePath(value: any, referencePath: ReferencePath[]): string;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Sanitizes an ID for use as a TypeScript variable name.
|
|
43
43
|
*/
|
|
44
|
-
export declare
|
|
44
|
+
export declare const sanitizeId: (id: string) => string;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Generates TypeScript source code for a flow, suitable for validation and type inference.
|
|
47
47
|
*/
|
|
48
|
-
export declare
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
export declare function generateFlowSourceCode(flow?: Flow, functions?: FunctionDefinition[], dataTypes?: DataType[], isForInference?: boolean): string;
|
|
49
|
+
export interface InferredTypes {
|
|
50
|
+
nodes: Map<string, string>;
|
|
51
|
+
parameters: Map<string, string[]>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Infers types for all nodes and parameters in a flow using the TypeScript compiler.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getInferredTypesFromFlow(flow?: Flow, functions?: FunctionDefinition[], dataTypes?: DataType[]): InferredTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DataType, Flow, FunctionDefinition, NodeFunction } from '@code0-tech/sagittarius-graphql-types';
|
|
2
|
-
import { ValidationResult } from '../utils';
|
|
3
|
-
/**
|
|
4
|
-
* Validates a single node's parameters and scope, then infers its return type.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getNodeValidation: (flow?: Flow, node?: NodeFunction, functions?: FunctionDefinition[], dataTypes?: DataType[]) => ValidationResult;
|