@dagger.io/dagger 0.15.2 → 0.15.4
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/src/api/client.gen.d.ts +58 -17
- package/dist/src/api/client.gen.d.ts.map +1 -1
- package/dist/src/api/client.gen.js +106 -181
- package/dist/src/common/context.d.ts +1 -1
- package/dist/src/common/context.d.ts.map +1 -1
- package/dist/src/common/context.js +2 -2
- package/dist/src/module/entrypoint/invoke.d.ts.map +1 -1
- package/dist/src/module/entrypoint/invoke.js +10 -0
- package/dist/src/module/entrypoint/load.d.ts.map +1 -1
- package/dist/src/module/entrypoint/load.js +6 -1
- package/dist/src/module/entrypoint/register.d.ts.map +1 -1
- package/dist/src/module/entrypoint/register.js +13 -0
- package/dist/src/module/executor.d.ts +5 -0
- package/dist/src/module/executor.d.ts.map +1 -1
- package/dist/src/module/executor.js +110 -1
- package/dist/src/module/introspector/case_convertor.d.ts.map +1 -1
- package/dist/src/module/introspector/case_convertor.js +7 -9
- package/dist/src/module/introspector/dagger_module/index.d.ts +1 -0
- package/dist/src/module/introspector/dagger_module/index.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/index.js +1 -0
- package/dist/src/module/introspector/dagger_module/interface.d.ts +25 -0
- package/dist/src/module/introspector/dagger_module/interface.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/interface.js +56 -0
- package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts +32 -0
- package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/interfaceFunction.js +87 -0
- package/dist/src/module/introspector/dagger_module/module.d.ts +16 -1
- package/dist/src/module/introspector/dagger_module/module.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/module.js +36 -2
- package/dist/src/module/introspector/dagger_module/reference.d.ts +1 -1
- package/dist/src/module/introspector/dagger_module/reference.d.ts.map +1 -1
- package/dist/src/module/introspector/typedef.d.ts +8 -1
- package/dist/src/module/introspector/typedef.d.ts.map +1 -1
- package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -1
- package/dist/src/module/introspector/typescript_module/ast.js +9 -2
- package/dist/src/provisioning/bin.js +1 -1
- package/dist/src/provisioning/default.d.ts +1 -1
- package/dist/src/provisioning/default.js +1 -1
- package/package.json +15 -15
|
@@ -49,6 +49,16 @@ export async function register(files, module) {
|
|
|
49
49
|
});
|
|
50
50
|
mod = mod.withEnum(typeDef);
|
|
51
51
|
});
|
|
52
|
+
// Register all interfaces defined by this module
|
|
53
|
+
Object.values(module.interfaces).forEach((interface_) => {
|
|
54
|
+
let typeDef = dag.typeDef().withInterface(interface_.name, {
|
|
55
|
+
description: interface_.description,
|
|
56
|
+
});
|
|
57
|
+
Object.values(interface_.functions).forEach((function_) => {
|
|
58
|
+
typeDef = typeDef.withFunction(addFunction(function_));
|
|
59
|
+
});
|
|
60
|
+
mod = mod.withInterface(typeDef);
|
|
61
|
+
});
|
|
52
62
|
// Call ID to actually execute the registration
|
|
53
63
|
return await mod.id();
|
|
54
64
|
}
|
|
@@ -133,6 +143,8 @@ function addTypeDef(type) {
|
|
|
133
143
|
return dag.typeDef().withKind(type.kind).withOptional(true);
|
|
134
144
|
case TypeDefKind.EnumKind:
|
|
135
145
|
return dag.typeDef().withEnum(type.name);
|
|
146
|
+
case TypeDefKind.InterfaceKind:
|
|
147
|
+
return dag.typeDef().withInterface(type.name);
|
|
136
148
|
default:
|
|
137
149
|
return dag.typeDef().withKind(type.kind);
|
|
138
150
|
}
|
|
@@ -145,5 +157,6 @@ function isPrimitiveType(type) {
|
|
|
145
157
|
return (type.kind === TypeDefKind.BooleanKind ||
|
|
146
158
|
type.kind === TypeDefKind.IntegerKind ||
|
|
147
159
|
type.kind === TypeDefKind.StringKind ||
|
|
160
|
+
type.kind === TypeDefKind.FloatKind ||
|
|
148
161
|
type.kind === TypeDefKind.EnumKind);
|
|
149
162
|
}
|
|
@@ -10,6 +10,11 @@ export declare class Executor {
|
|
|
10
10
|
constructor(modules: Module[], daggerModule: DaggerModule);
|
|
11
11
|
private getExportedObject;
|
|
12
12
|
buildClass(object: string, state: State): any;
|
|
13
|
+
/**
|
|
14
|
+
* Transform a Dagger interface identifier into an implementation of this
|
|
15
|
+
* interface serves as module call binding to reach the true implementation.
|
|
16
|
+
*/
|
|
17
|
+
buildInterface(iface: string, id: string): any;
|
|
13
18
|
getResult(object: string, method: string, state: State, inputs: Args): Promise<any>;
|
|
14
19
|
}
|
|
15
20
|
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/module/executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/module/executor.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,aAAa,CAAA;AAMhC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAIpE,MAAM,MAAM,KAAK,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAE/C,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE1C,qBAAa,QAAQ;aAED,OAAO,EAAE,MAAM,EAAE;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADb,OAAO,EAAE,MAAM,EAAE,EAChB,YAAY,EAAE,YAAY;IAG7C,OAAO,CAAC,iBAAiB;IAUzB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,GAAG;IAqB7C;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,GAAG;IAiBxC,SAAS,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,IAAI,GACX,OAAO,CAAC,GAAG,CAAC;CAchB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { dag, TypeDefKind } from "../api/client.gen.js";
|
|
2
|
+
import { Context } from "../common/context.js";
|
|
1
3
|
import { FunctionNotFound } from "../common/errors/index.js";
|
|
4
|
+
import { Connection } from "../common/graphql/connection.js";
|
|
2
5
|
export class Executor {
|
|
3
6
|
modules;
|
|
4
7
|
daggerModule;
|
|
@@ -17,7 +20,7 @@ export class Executor {
|
|
|
17
20
|
buildClass(object, state) {
|
|
18
21
|
const daggerObject = this.daggerModule.objects[object];
|
|
19
22
|
if (!daggerObject) {
|
|
20
|
-
throw new FunctionNotFound(`Object ${object} not found in the
|
|
23
|
+
throw new FunctionNotFound(`Object ${object} not found in the module`);
|
|
21
24
|
}
|
|
22
25
|
switch (daggerObject.kind()) {
|
|
23
26
|
case "class": {
|
|
@@ -31,6 +34,18 @@ export class Executor {
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Transform a Dagger interface identifier into an implementation of this
|
|
39
|
+
* interface serves as module call binding to reach the true implementation.
|
|
40
|
+
*/
|
|
41
|
+
buildInterface(iface, id) {
|
|
42
|
+
const interfaceObject = this.daggerModule.interfaces[iface];
|
|
43
|
+
if (!interfaceObject) {
|
|
44
|
+
throw new Error(`Interface ${iface} not found in the module`);
|
|
45
|
+
}
|
|
46
|
+
const ifaceImpl = new InterfaceWrapper(this, this.daggerModule, `${this.daggerModule.name}${iface}`, id, interfaceObject.functions);
|
|
47
|
+
return ifaceImpl;
|
|
48
|
+
}
|
|
34
49
|
async getResult(object, method, state, inputs) {
|
|
35
50
|
const obj = this.getExportedObject(object);
|
|
36
51
|
if (method === "") {
|
|
@@ -43,3 +58,97 @@ export class Executor {
|
|
|
43
58
|
return await builtObj[method](...Object.values(inputs));
|
|
44
59
|
}
|
|
45
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Interface Wrapper serves as dynaminc module binding so the module can
|
|
63
|
+
* call function of this interface.
|
|
64
|
+
* Because the actual interface implementation can come from any external modules,
|
|
65
|
+
* all resolution are done by API Call.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* interface Example {
|
|
70
|
+
* foo: () => Promise<string>
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* class Test {
|
|
74
|
+
* @func()
|
|
75
|
+
* async callFoo(example: Example): Promise<string> {
|
|
76
|
+
* // <- This example argument here is actually the Interface Wrapper, and `foo` will,
|
|
77
|
+
* // directly execute the API call to reach the given implementation.
|
|
78
|
+
* return example.foo()
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
class InterfaceWrapper {
|
|
84
|
+
executor;
|
|
85
|
+
module;
|
|
86
|
+
ifaceName;
|
|
87
|
+
ifaceId;
|
|
88
|
+
fcts;
|
|
89
|
+
_ctx;
|
|
90
|
+
constructor(executor, module, ifaceName, ifaceId, fcts) {
|
|
91
|
+
this.executor = executor;
|
|
92
|
+
this.module = module;
|
|
93
|
+
this.ifaceName = ifaceName;
|
|
94
|
+
this.ifaceId = ifaceId;
|
|
95
|
+
this.fcts = fcts;
|
|
96
|
+
this._ctx = new Context([], new Connection(dag.getGQLClient()));
|
|
97
|
+
// Load the interface by its identifier
|
|
98
|
+
this._ctx = this._ctx.select(`load${ifaceName}FromID`, { id: ifaceId });
|
|
99
|
+
Object.entries(fcts).forEach(([name, fct]) => {
|
|
100
|
+
const argKeys = Object.keys(fct.arguments);
|
|
101
|
+
// Dynamically adding functions of the interface and it's resolvers.
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
this[name] = async (...args) => {
|
|
104
|
+
// Fill up arguments of that function.
|
|
105
|
+
const argsPayload = {};
|
|
106
|
+
for (let i = 0; i < argKeys.length; i++) {
|
|
107
|
+
if (args[i] !== undefined) {
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
argsPayload[argKeys[i]] = args[i];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
this._ctx = this._ctx.select(name, argsPayload);
|
|
113
|
+
// If the function is returning an IDable, we don't need to execute it
|
|
114
|
+
// since it will be resolved later.
|
|
115
|
+
if (fct.returnType.kind === TypeDefKind.InterfaceKind ||
|
|
116
|
+
fct.returnType.kind === TypeDefKind.ObjectKind) {
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
// If the function is returning a list, we may need to load the sub-objects
|
|
120
|
+
if (fct.returnType.kind === TypeDefKind.ListKind) {
|
|
121
|
+
const listTypeDef = fct.returnType
|
|
122
|
+
.typeDef;
|
|
123
|
+
// If the list is an object or an interface, then we need to load the sub-objects.
|
|
124
|
+
if (listTypeDef.kind === TypeDefKind.ObjectKind ||
|
|
125
|
+
listTypeDef.kind === TypeDefKind.InterfaceKind) {
|
|
126
|
+
const typedef = listTypeDef;
|
|
127
|
+
// Resolves the call to get the list of IDs to load
|
|
128
|
+
const ids = await this._ctx
|
|
129
|
+
.select("id")
|
|
130
|
+
.execute();
|
|
131
|
+
// If the return type is an interface defined by that module, we need to load it through
|
|
132
|
+
// the interface wrapper
|
|
133
|
+
if (this.module.interfaces[typedef.name]) {
|
|
134
|
+
return await Promise.all(ids.map(({ id }) => new InterfaceWrapper(this.executor, module, `${this.module.name}${typedef.name}`, id, this.module.interfaces[typedef.name].functions)));
|
|
135
|
+
}
|
|
136
|
+
// Otherwise, we can just load the objects from the API
|
|
137
|
+
return await Promise.all(
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
ids.map(({ id }) => dag[`load${listTypeDef.name}FromID`](id)));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return await this._ctx.execute();
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* ID function to make the interface IDeable when serialized as return value to the
|
|
148
|
+
* Dagger API.
|
|
149
|
+
*/
|
|
150
|
+
async id() {
|
|
151
|
+
const ctx = this._ctx.select("id");
|
|
152
|
+
return await ctx.execute();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case_convertor.d.ts","sourceRoot":"","sources":["../../../../src/module/introspector/case_convertor.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"case_convertor.d.ts","sourceRoot":"","sources":["../../../../src/module/introspector/case_convertor.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBzD"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
export function convertToPascalCase(input) {
|
|
2
|
+
// Handle empty string case
|
|
3
|
+
if (!input) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
// Split on word boundaries before uppercase letters, numbers, and special characters
|
|
2
7
|
const words = input
|
|
3
|
-
.
|
|
4
|
-
.split(/\s+/)
|
|
8
|
+
.split(/(?=[A-Z0-9])|[^a-zA-Z0-9]|(?<=[a-zA-Z])(?=\d)|(?<=\d)(?=[a-zA-Z])/g)
|
|
5
9
|
.filter((word) => word.length > 0);
|
|
6
|
-
|
|
7
|
-
return ""; // No valid words found
|
|
8
|
-
}
|
|
9
|
-
// It's an edge case when moduleName is already in PascalCase or camelCase
|
|
10
|
-
if (words.length === 1) {
|
|
11
|
-
return words[0].charAt(0).toUpperCase() + words[0].slice(1);
|
|
12
|
-
}
|
|
10
|
+
// Convert each word to proper case
|
|
13
11
|
const pascalCase = words
|
|
14
12
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
15
13
|
.join("");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { AST } from "../typescript_module/index.js";
|
|
3
|
+
import { DaggerInterfaceFunctions } from "./interfaceFunction.js";
|
|
4
|
+
import { Locatable } from "./locatable.js";
|
|
5
|
+
import { References } from "./reference.js";
|
|
6
|
+
export type DaggerInterfaces = {
|
|
7
|
+
[name: string]: DaggerInterface;
|
|
8
|
+
};
|
|
9
|
+
export declare class DaggerInterface extends Locatable {
|
|
10
|
+
private readonly node;
|
|
11
|
+
private readonly ast;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
functions: DaggerInterfaceFunctions;
|
|
15
|
+
private symbol;
|
|
16
|
+
constructor(node: ts.InterfaceDeclaration, ast: AST);
|
|
17
|
+
getReferences(): string[];
|
|
18
|
+
propagateReferences(references: References): void;
|
|
19
|
+
toJSON(): {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
functions: DaggerInterfaceFunctions;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAEL,wBAAwB,EACzB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAA;AAElE,qBAAa,eAAgB,SAAQ,SAAS;IAO1C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,wBAAwB,CAAK;IAC/C,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,GAAG,EAAE,GAAG;IAoCpB,aAAa,IAAI,MAAM,EAAE;IAQzB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAMjD,MAAM;;;;;CAOd"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { IntrospectionError } from "../../../common/errors/index.js";
|
|
3
|
+
import { AST } from "../typescript_module/index.js";
|
|
4
|
+
import { DaggerInterfaceFunction, } from "./interfaceFunction.js";
|
|
5
|
+
import { Locatable } from "./locatable.js";
|
|
6
|
+
export class DaggerInterface extends Locatable {
|
|
7
|
+
node;
|
|
8
|
+
ast;
|
|
9
|
+
name;
|
|
10
|
+
description;
|
|
11
|
+
functions = {};
|
|
12
|
+
symbol;
|
|
13
|
+
constructor(node, ast) {
|
|
14
|
+
super(node);
|
|
15
|
+
this.node = node;
|
|
16
|
+
this.ast = ast;
|
|
17
|
+
if (!this.node.name) {
|
|
18
|
+
throw new IntrospectionError(`could not resolve name of interface at ${AST.getNodePosition(node)}`);
|
|
19
|
+
}
|
|
20
|
+
this.name = this.node.name.getText();
|
|
21
|
+
this.symbol = this.ast.getSymbolOrThrow(this.node.name);
|
|
22
|
+
this.description = this.ast.getDocFromSymbol(this.symbol);
|
|
23
|
+
for (const member of this.node.members) {
|
|
24
|
+
if (!ts.isPropertySignature(member) && !ts.isMethodSignature(member)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Check if it's a function
|
|
28
|
+
if ((member.type && ts.isFunctionTypeNode(member.type)) ||
|
|
29
|
+
ts.isMethodSignature(member)) {
|
|
30
|
+
const daggerInterfaceFunction = new DaggerInterfaceFunction(member, this.ast);
|
|
31
|
+
this.functions[daggerInterfaceFunction.name] = daggerInterfaceFunction;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
// TODO(TomChv): Add support for fields
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
getReferences() {
|
|
38
|
+
const references = [];
|
|
39
|
+
for (const fn of Object.values(this.functions)) {
|
|
40
|
+
references.push(...fn.getReferences());
|
|
41
|
+
}
|
|
42
|
+
return references.filter((v, i, arr) => arr.indexOf(v) === i);
|
|
43
|
+
}
|
|
44
|
+
propagateReferences(references) {
|
|
45
|
+
for (const fn of Object.values(this.functions)) {
|
|
46
|
+
fn.propagateReferences(references);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
toJSON() {
|
|
50
|
+
return {
|
|
51
|
+
name: this.name,
|
|
52
|
+
description: this.description,
|
|
53
|
+
functions: this.functions,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { TypeDefKind } from "../../../api/client.gen.js";
|
|
3
|
+
import { TypeDef } from "../typedef.js";
|
|
4
|
+
import { AST } from "../typescript_module/index.js";
|
|
5
|
+
import { DaggerArguments } from "./argument.js";
|
|
6
|
+
import { Locatable } from "./locatable.js";
|
|
7
|
+
import { References } from "./reference.js";
|
|
8
|
+
export type DaggerInterfaceFunctions = {
|
|
9
|
+
[name: string]: DaggerInterfaceFunction;
|
|
10
|
+
};
|
|
11
|
+
export declare class DaggerInterfaceFunction extends Locatable {
|
|
12
|
+
private readonly node;
|
|
13
|
+
private readonly ast;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
private _returnTypeRef?;
|
|
17
|
+
returnType?: TypeDef<TypeDefKind>;
|
|
18
|
+
arguments: DaggerArguments;
|
|
19
|
+
alias: undefined;
|
|
20
|
+
private symbol;
|
|
21
|
+
private signature?;
|
|
22
|
+
constructor(node: ts.PropertySignature | ts.MethodSignature, ast: AST);
|
|
23
|
+
getReferences(): string[];
|
|
24
|
+
propagateReferences(references: References): void;
|
|
25
|
+
toJSON(): {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
arguments: DaggerArguments;
|
|
29
|
+
returnType: TypeDef<TypeDefKind> | undefined;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=interfaceFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaceFunction.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/interfaceFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAkB,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,CAAA;CACxC,CAAA;AAED,qBAAa,uBAAwB,SAAQ,SAAS;IAYlD,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAZf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,cAAc,CAAC,CAAQ;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IACjC,SAAS,EAAE,eAAe,CAAK;IAE/B,KAAK,EAAE,SAAS,CAAA;IACvB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,SAAS,CAAC,CAAc;gBAGb,IAAI,EAAE,EAAE,CAAC,iBAAiB,GAAG,EAAE,CAAC,eAAe,EAC/C,GAAG,EAAE,GAAG;IA2CpB,aAAa,IAAI,MAAM,EAAE;IAqBzB,mBAAmB,CAAC,UAAU,EAAE,UAAU;IAuB1C,MAAM;;;;;;CAQd"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { IntrospectionError } from "../../../common/errors/index.js";
|
|
3
|
+
import { AST, isTypeDefResolved, resolveTypeDef, } from "../typescript_module/index.js";
|
|
4
|
+
import { DaggerArgument } from "./argument.js";
|
|
5
|
+
import { Locatable } from "./locatable.js";
|
|
6
|
+
export class DaggerInterfaceFunction extends Locatable {
|
|
7
|
+
node;
|
|
8
|
+
ast;
|
|
9
|
+
name;
|
|
10
|
+
description;
|
|
11
|
+
_returnTypeRef;
|
|
12
|
+
returnType;
|
|
13
|
+
arguments = {};
|
|
14
|
+
// Just a placeholder to be compatible with `Method` during registration
|
|
15
|
+
alias;
|
|
16
|
+
symbol;
|
|
17
|
+
signature;
|
|
18
|
+
constructor(node, ast) {
|
|
19
|
+
super(node);
|
|
20
|
+
this.node = node;
|
|
21
|
+
this.ast = ast;
|
|
22
|
+
if (!this.node.name) {
|
|
23
|
+
throw new IntrospectionError(`could not resolve name of interface function at ${AST.getNodePosition(node)}`);
|
|
24
|
+
}
|
|
25
|
+
this.name = this.node.name.getText();
|
|
26
|
+
this.symbol = this.ast.getSymbolOrThrow(this.node.name);
|
|
27
|
+
this.description = this.ast.getDocFromSymbol(this.symbol);
|
|
28
|
+
// If it's a method signature, we can directly use it to get the signature props
|
|
29
|
+
// If it's a property kind signature, we need to get the signature from the type
|
|
30
|
+
// Examle:
|
|
31
|
+
// interface Foo {
|
|
32
|
+
// bar(): void // <- this is a method signature
|
|
33
|
+
// baz: () => string // <- this is a property kind signature
|
|
34
|
+
// }
|
|
35
|
+
const nodeType = this.node.type && ts.isFunctionTypeNode(this.node.type)
|
|
36
|
+
? this.node.type
|
|
37
|
+
: this.node;
|
|
38
|
+
const signature = this.ast.getSignatureFromFunctionOrThrow(nodeType);
|
|
39
|
+
for (const parameter of nodeType.parameters) {
|
|
40
|
+
this.arguments[parameter.name.getText()] = new DaggerArgument(parameter, this.ast);
|
|
41
|
+
}
|
|
42
|
+
const signatureReturnType = signature.getReturnType();
|
|
43
|
+
const typedef = this.ast.tsTypeToTypeDef(this.node, signatureReturnType);
|
|
44
|
+
if (typedef === undefined || !isTypeDefResolved(typedef)) {
|
|
45
|
+
this._returnTypeRef = this.ast.typeToStringType(signatureReturnType);
|
|
46
|
+
}
|
|
47
|
+
this.returnType = typedef;
|
|
48
|
+
}
|
|
49
|
+
getReferences() {
|
|
50
|
+
const references = [];
|
|
51
|
+
if (this._returnTypeRef &&
|
|
52
|
+
(this.returnType === undefined || !isTypeDefResolved(this.returnType))) {
|
|
53
|
+
references.push(this._returnTypeRef);
|
|
54
|
+
}
|
|
55
|
+
for (const argument of Object.values(this.arguments)) {
|
|
56
|
+
const reference = argument.getReference();
|
|
57
|
+
if (reference) {
|
|
58
|
+
references.push(reference);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return references;
|
|
62
|
+
}
|
|
63
|
+
propagateReferences(references) {
|
|
64
|
+
for (const argument of Object.values(this.arguments)) {
|
|
65
|
+
argument.propagateReferences(references);
|
|
66
|
+
}
|
|
67
|
+
if (!this._returnTypeRef) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (this.returnType && isTypeDefResolved(this.returnType)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const typeDef = references[this._returnTypeRef];
|
|
74
|
+
if (!typeDef) {
|
|
75
|
+
throw new IntrospectionError(`could not find type reference for ${this._returnTypeRef} at ${AST.getNodePosition(this.node)}.`);
|
|
76
|
+
}
|
|
77
|
+
this.returnType = resolveTypeDef(this.returnType, typeDef);
|
|
78
|
+
}
|
|
79
|
+
toJSON() {
|
|
80
|
+
return {
|
|
81
|
+
name: this.name,
|
|
82
|
+
description: this.description,
|
|
83
|
+
arguments: this.arguments,
|
|
84
|
+
returnType: this.returnType,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Module from "node:module";
|
|
2
2
|
import { AST } from "../typescript_module/index.js";
|
|
3
3
|
import { DaggerEnumsBase } from "./enumBase.js";
|
|
4
|
+
import { DaggerInterfaces } from "./interface.js";
|
|
4
5
|
import { DaggerObjectsBase } from "./objectBase.js";
|
|
5
6
|
/**
|
|
6
7
|
* DaggerModule represents a TypeScript module with a set of files
|
|
@@ -60,6 +61,18 @@ export declare class DaggerModule {
|
|
|
60
61
|
* ```
|
|
61
62
|
*/
|
|
62
63
|
enums: DaggerEnumsBase;
|
|
64
|
+
/**
|
|
65
|
+
* An interface is declared using the `interface` keyword.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* export interface Example {
|
|
70
|
+
* foo: (): string
|
|
71
|
+
* asyncFoo: (): Promise<string>
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
interfaces: DaggerInterfaces;
|
|
63
76
|
description: string | undefined;
|
|
64
77
|
private references;
|
|
65
78
|
constructor(name: string, userModule: Module[], ast: AST);
|
|
@@ -72,8 +85,9 @@ export declare class DaggerModule {
|
|
|
72
85
|
* - classes
|
|
73
86
|
* - enums
|
|
74
87
|
* - scalars
|
|
88
|
+
* - interfaces
|
|
75
89
|
*
|
|
76
|
-
* If the reference is an object or
|
|
90
|
+
* If the reference is an object, a class or an interface, recursively find the references of the object.
|
|
77
91
|
*
|
|
78
92
|
* *Note*: If a class is referenced but not exported and not decorated with `@object()`, we throw an error
|
|
79
93
|
* because we aim to be explicit. (TomChv: Should we change this behaviour?)
|
|
@@ -105,6 +119,7 @@ export declare class DaggerModule {
|
|
|
105
119
|
description: string | undefined;
|
|
106
120
|
objects: DaggerObjectsBase;
|
|
107
121
|
enums: DaggerEnumsBase;
|
|
122
|
+
interfaces: DaggerInterfaces;
|
|
108
123
|
};
|
|
109
124
|
}
|
|
110
125
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/module.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAKhC,OAAO,EAEL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AAGtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/module.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAKhC,OAAO,EAEL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AAGtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAInD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAuEd,IAAI,EAAE,MAAM;IACnB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IAxEb;;;;;;;;;;;;;;;;;;;OAmBG;IACI,OAAO,EAAE,iBAAiB,CAAK;IAEtC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,KAAK,EAAE,eAAe,CAAK;IAElC;;;;;;;;;;OAUG;IACI,UAAU,EAAE,gBAAgB,CAAK;IAEjC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAEtC,OAAO,CAAC,UAAU,CAKjB;gBAGQ,IAAI,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,GAAG;IAkClB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IAkIzB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IAsExB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB,MAAM;;;;;;;CASP"}
|
|
@@ -5,6 +5,7 @@ import { findModuleByExportedName, AST, CLIENT_GEN_FILE, } from "../typescript_m
|
|
|
5
5
|
import { ENUM_DECORATOR, OBJECT_DECORATOR } from "./decorator.js";
|
|
6
6
|
import { DaggerEnum } from "./enum.js";
|
|
7
7
|
import { DaggerEnumClass } from "./enumClass.js";
|
|
8
|
+
import { DaggerInterface } from "./interface.js";
|
|
8
9
|
import { DaggerObject } from "./object.js";
|
|
9
10
|
import { DaggerTypeObject } from "./typeObject.js";
|
|
10
11
|
/**
|
|
@@ -65,8 +66,25 @@ export class DaggerModule {
|
|
|
65
66
|
* ```
|
|
66
67
|
*/
|
|
67
68
|
enums = {};
|
|
69
|
+
/**
|
|
70
|
+
* An interface is declared using the `interface` keyword.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* export interface Example {
|
|
75
|
+
* foo: (): string
|
|
76
|
+
* asyncFoo: (): Promise<string>
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
interfaces = {};
|
|
68
81
|
description;
|
|
69
|
-
references = {
|
|
82
|
+
references = {
|
|
83
|
+
// Float is a special case, it's an alias of number but it serves to declare a float type
|
|
84
|
+
// in the Dagger API.
|
|
85
|
+
// So we auto register it because it will be detected as a referenced type by the introspector.
|
|
86
|
+
float: { kind: TypeDefKind.FloatKind },
|
|
87
|
+
};
|
|
70
88
|
constructor(name, userModule, ast) {
|
|
71
89
|
this.name = name;
|
|
72
90
|
this.userModule = userModule;
|
|
@@ -99,8 +117,9 @@ export class DaggerModule {
|
|
|
99
117
|
* - classes
|
|
100
118
|
* - enums
|
|
101
119
|
* - scalars
|
|
120
|
+
* - interfaces
|
|
102
121
|
*
|
|
103
|
-
* If the reference is an object or
|
|
122
|
+
* If the reference is an object, a class or an interface, recursively find the references of the object.
|
|
104
123
|
*
|
|
105
124
|
* *Note*: If a class is referenced but not exported and not decorated with `@object()`, we throw an error
|
|
106
125
|
* because we aim to be explicit. (TomChv: Should we change this behaviour?)
|
|
@@ -164,6 +183,17 @@ export class DaggerModule {
|
|
|
164
183
|
// There should be no reference in enums.
|
|
165
184
|
continue;
|
|
166
185
|
}
|
|
186
|
+
const interfaceRef = this.ast.findResolvedNodeByName(reference, ts.SyntaxKind.InterfaceDeclaration);
|
|
187
|
+
if (interfaceRef) {
|
|
188
|
+
const daggerInterface = new DaggerInterface(interfaceRef.node, this.ast);
|
|
189
|
+
this.interfaces[daggerInterface.name] = daggerInterface;
|
|
190
|
+
this.references[daggerInterface.name] = {
|
|
191
|
+
kind: TypeDefKind.InterfaceKind,
|
|
192
|
+
name: daggerInterface.name,
|
|
193
|
+
};
|
|
194
|
+
this.resolveReferences(daggerInterface.getReferences());
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
167
197
|
const typeAliasRef = this.ast.findResolvedNodeByName(reference, ts.SyntaxKind.TypeAliasDeclaration);
|
|
168
198
|
if (typeAliasRef) {
|
|
169
199
|
// The resolution is to big so we split it in a sub function.
|
|
@@ -248,6 +278,9 @@ export class DaggerModule {
|
|
|
248
278
|
for (const object of Object.values(this.objects)) {
|
|
249
279
|
object.propagateReferences(this.references);
|
|
250
280
|
}
|
|
281
|
+
for (const interface_ of Object.values(this.interfaces)) {
|
|
282
|
+
interface_.propagateReferences(this.references);
|
|
283
|
+
}
|
|
251
284
|
}
|
|
252
285
|
/**
|
|
253
286
|
* Get the top level comment of the file that contains the module entrypoint.
|
|
@@ -270,6 +303,7 @@ export class DaggerModule {
|
|
|
270
303
|
description: this.description,
|
|
271
304
|
objects: this.objects,
|
|
272
305
|
enums: this.enums,
|
|
306
|
+
interfaces: this.interfaces,
|
|
273
307
|
};
|
|
274
308
|
}
|
|
275
309
|
}
|
|
@@ -3,7 +3,7 @@ import { TypeDef } from "../typedef.js";
|
|
|
3
3
|
export type References = {
|
|
4
4
|
[name: string]: TypeDef<TypeDefKind>;
|
|
5
5
|
};
|
|
6
|
-
export type ReferencableType = TypeDef<TypeDefKind.ObjectKind> | TypeDef<TypeDefKind.EnumKind> | TypeDef<TypeDefKind.ScalarKind>;
|
|
6
|
+
export type ReferencableType = TypeDef<TypeDefKind.ObjectKind> | TypeDef<TypeDefKind.EnumKind> | TypeDef<TypeDefKind.FloatKind> | TypeDef<TypeDefKind.ScalarKind> | TypeDef<TypeDefKind.InterfaceKind>;
|
|
7
7
|
export declare function isKindArray(type: TypeDef<TypeDefKind>): type is TypeDef<TypeDefKind.ListKind>;
|
|
8
8
|
export declare function isKindObject(type: TypeDef<TypeDefKind>): type is TypeDef<TypeDefKind.ObjectKind>;
|
|
9
9
|
export declare function isKindEnum(type: TypeDef<TypeDefKind>): type is TypeDef<TypeDefKind.EnumKind>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GACxB,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GAC7B,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GACxB,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GAC7B,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,GAC9B,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;AAEtC,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GACzB,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAEvC;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GACzB,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAEzC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GACzB,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAEvC;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GACzB,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAEzC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAazE;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GACzB,OAAO,CAAC,WAAW,CAAC,CAMtB"}
|
|
@@ -19,6 +19,13 @@ export type EnumTypeDef = BaseTypeDef & {
|
|
|
19
19
|
kind: TypeDefKind.EnumKind;
|
|
20
20
|
name: string;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Extends the base type def if it's an interface to add its name
|
|
24
|
+
*/
|
|
25
|
+
export type InterfaceTypeDef = BaseTypeDef & {
|
|
26
|
+
kind: TypeDefKind.InterfaceKind;
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
22
29
|
/**
|
|
23
30
|
* Extends the base typedef if it's a scalar to add its name and real type.
|
|
24
31
|
*/
|
|
@@ -41,5 +48,5 @@ export type ListTypeDef = BaseTypeDef & {
|
|
|
41
48
|
* If it's type of kind object, it transforms the BaseTypeDef into an ObjectTypeDef.
|
|
42
49
|
* If it's a type of kind list, it transforms the BaseTypeDef into a ListTypeDef.
|
|
43
50
|
*/
|
|
44
|
-
export type TypeDef<T extends BaseTypeDef["kind"]> = T extends TypeDefKind.ScalarKind ? ScalarTypeDef : T extends TypeDefKind.ObjectKind ? ObjectTypeDef : T extends TypeDefKind.ListKind ? ListTypeDef : T extends TypeDefKind.EnumKind ? EnumTypeDef : BaseTypeDef;
|
|
51
|
+
export type TypeDef<T extends BaseTypeDef["kind"]> = T extends TypeDefKind.ScalarKind ? ScalarTypeDef : T extends TypeDefKind.ObjectKind ? ObjectTypeDef : T extends TypeDefKind.ListKind ? ListTypeDef : T extends TypeDefKind.EnumKind ? EnumTypeDef : T extends TypeDefKind.InterfaceKind ? InterfaceTypeDef : BaseTypeDef;
|
|
45
52
|
//# sourceMappingURL=typedef.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedef.d.ts","sourceRoot":"","sources":["../../../../src/module/introspector/typedef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,WAAW,CAAC,UAAU,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,WAAW,CAAC,UAAU,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAC9B,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MA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