@dagger.io/dagger 0.15.1 → 0.15.3
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 +59 -6
- package/dist/src/api/client.gen.d.ts.map +1 -1
- package/dist/src/api/client.gen.js +52 -166
- 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/common/utils.d.ts +14 -14
- package/dist/src/module/decorators.d.ts.map +1 -1
- 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 +9 -3
- package/dist/src/module/entrypoint/register.d.ts.map +1 -1
- package/dist/src/module/entrypoint/register.js +23 -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/argument.d.ts +2 -1
- package/dist/src/module/introspector/dagger_module/argument.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/argument.js +3 -1
- package/dist/src/module/introspector/dagger_module/enum.d.ts +3 -2
- package/dist/src/module/introspector/dagger_module/enum.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/enum.js +5 -2
- package/dist/src/module/introspector/dagger_module/enumBase.d.ts +3 -2
- package/dist/src/module/introspector/dagger_module/enumBase.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/enumClass.d.ts +3 -2
- package/dist/src/module/introspector/dagger_module/enumClass.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/enumClass.js +5 -2
- package/dist/src/module/introspector/dagger_module/function.d.ts +2 -1
- package/dist/src/module/introspector/dagger_module/function.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/function.js +3 -1
- package/dist/src/module/introspector/dagger_module/index.d.ts +2 -0
- package/dist/src/module/introspector/dagger_module/index.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/index.js +2 -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/locatable.d.ts +12 -0
- package/dist/src/module/introspector/dagger_module/locatable.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/locatable.js +14 -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/object.d.ts +17 -2
- package/dist/src/module/introspector/dagger_module/object.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/object.js +19 -1
- package/dist/src/module/introspector/dagger_module/objectBase.d.ts +3 -2
- package/dist/src/module/introspector/dagger_module/objectBase.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/property.d.ts +2 -1
- package/dist/src/module/introspector/dagger_module/property.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/property.js +3 -1
- 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/dagger_module/typeObject.d.ts +24 -2
- package/dist/src/module/introspector/dagger_module/typeObject.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/typeObject.js +26 -1
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts +2 -1
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.js +3 -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 +14 -0
- package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -1
- package/dist/src/module/introspector/typescript_module/ast.js +37 -2
- package/dist/src/module/introspector/typescript_module/index.d.ts +1 -0
- package/dist/src/module/introspector/typescript_module/index.d.ts.map +1 -1
- package/dist/src/module/introspector/typescript_module/index.js +1 -0
- package/dist/src/module/introspector/typescript_module/location.d.ts +6 -0
- package/dist/src/module/introspector/typescript_module/location.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/location.js +1 -0
- package/dist/src/module/registry.d.ts.map +1 -1
- 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 +21 -21
|
@@ -14,6 +14,7 @@ export async function register(files, module) {
|
|
|
14
14
|
// Register the class Typedef object in Dagger
|
|
15
15
|
let typeDef = dag.typeDef().withObject(object.name, {
|
|
16
16
|
description: object.description,
|
|
17
|
+
sourceMap: addSourceMap(object),
|
|
17
18
|
});
|
|
18
19
|
// Register all functions (methods) to this object
|
|
19
20
|
Object.values(object.methods).forEach((method) => {
|
|
@@ -24,6 +25,7 @@ export async function register(files, module) {
|
|
|
24
25
|
if (field.isExposed) {
|
|
25
26
|
typeDef = typeDef.withField(field.alias ?? field.name, addTypeDef(field.type), {
|
|
26
27
|
description: field.description,
|
|
28
|
+
sourceMap: addSourceMap(field),
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
});
|
|
@@ -37,14 +39,26 @@ export async function register(files, module) {
|
|
|
37
39
|
Object.values(module.enums).forEach((enum_) => {
|
|
38
40
|
let typeDef = dag.typeDef().withEnum(enum_.name, {
|
|
39
41
|
description: enum_.description,
|
|
42
|
+
sourceMap: addSourceMap(enum_),
|
|
40
43
|
});
|
|
41
44
|
Object.values(enum_.values).forEach((value) => {
|
|
42
45
|
typeDef = typeDef.withEnumValue(value.value, {
|
|
43
46
|
description: value.description,
|
|
47
|
+
sourceMap: addSourceMap(value),
|
|
44
48
|
});
|
|
45
49
|
});
|
|
46
50
|
mod = mod.withEnum(typeDef);
|
|
47
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
|
+
});
|
|
48
62
|
// Call ID to actually execute the registration
|
|
49
63
|
return await mod.id();
|
|
50
64
|
}
|
|
@@ -61,6 +75,7 @@ function addFunction(fct) {
|
|
|
61
75
|
return dag
|
|
62
76
|
.function_(fct.alias ?? fct.name, addTypeDef(fct.returnType))
|
|
63
77
|
.withDescription(fct.description)
|
|
78
|
+
.withSourceMap(addSourceMap(fct))
|
|
64
79
|
.with(addArg(fct.arguments));
|
|
65
80
|
}
|
|
66
81
|
/**
|
|
@@ -71,6 +86,7 @@ function addArg(args) {
|
|
|
71
86
|
Object.values(args).forEach((arg) => {
|
|
72
87
|
const opts = {
|
|
73
88
|
description: arg.description,
|
|
89
|
+
sourceMap: addSourceMap(arg),
|
|
74
90
|
};
|
|
75
91
|
let typeDef = addTypeDef(arg.type);
|
|
76
92
|
if (arg.isOptional) {
|
|
@@ -127,13 +143,20 @@ function addTypeDef(type) {
|
|
|
127
143
|
return dag.typeDef().withKind(type.kind).withOptional(true);
|
|
128
144
|
case TypeDefKind.EnumKind:
|
|
129
145
|
return dag.typeDef().withEnum(type.name);
|
|
146
|
+
case TypeDefKind.InterfaceKind:
|
|
147
|
+
return dag.typeDef().withInterface(type.name);
|
|
130
148
|
default:
|
|
131
149
|
return dag.typeDef().withKind(type.kind);
|
|
132
150
|
}
|
|
133
151
|
}
|
|
152
|
+
function addSourceMap(object) {
|
|
153
|
+
const { filepath, line, column } = object.getLocation();
|
|
154
|
+
return dag.sourceMap(filepath, line, column);
|
|
155
|
+
}
|
|
134
156
|
function isPrimitiveType(type) {
|
|
135
157
|
return (type.kind === TypeDefKind.BooleanKind ||
|
|
136
158
|
type.kind === TypeDefKind.IntegerKind ||
|
|
137
159
|
type.kind === TypeDefKind.StringKind ||
|
|
160
|
+
type.kind === TypeDefKind.FloatKind ||
|
|
138
161
|
type.kind === TypeDefKind.EnumKind);
|
|
139
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("");
|
|
@@ -2,11 +2,12 @@ import ts from "typescript";
|
|
|
2
2
|
import { TypeDefKind } from "../../../api/client.gen.js";
|
|
3
3
|
import { TypeDef } from "../typedef.js";
|
|
4
4
|
import { AST } from "../typescript_module/index.js";
|
|
5
|
+
import { Locatable } from "./locatable.js";
|
|
5
6
|
import { References } from "./reference.js";
|
|
6
7
|
export type DaggerArguments = {
|
|
7
8
|
[name: string]: DaggerArgument;
|
|
8
9
|
};
|
|
9
|
-
export declare class DaggerArgument {
|
|
10
|
+
export declare class DaggerArgument extends Locatable {
|
|
10
11
|
private readonly node;
|
|
11
12
|
private readonly ast;
|
|
12
13
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/argument.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAA;AAEhE,qBAAa,
|
|
1
|
+
{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/argument.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAA;AAEhE,qBAAa,cAAe,SAAQ,SAAS;IAezC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAff,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,QAAQ,CAAC,CAAQ;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3B,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,YAAY,CAAC,EAAE,GAAG,CAAA;IAEzB,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,GAAG,EAAE,GAAG;IA+B3B;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,eAAe;IAShB,YAAY,IAAI,MAAM,GAAG,SAAS;IAWlC,mBAAmB,CAAC,UAAU,EAAE,UAAU;IAmBjD,MAAM;;;;;;;;;;;CAaP"}
|
|
@@ -3,7 +3,8 @@ import ts from "typescript";
|
|
|
3
3
|
import { IntrospectionError } from "../../../common/errors/index.js";
|
|
4
4
|
import { AST, isTypeDefResolved, resolveTypeDef, } from "../typescript_module/index.js";
|
|
5
5
|
import { ARGUMENT_DECORATOR } from "./decorator.js";
|
|
6
|
-
|
|
6
|
+
import { Locatable } from "./locatable.js";
|
|
7
|
+
export class DaggerArgument extends Locatable {
|
|
7
8
|
node;
|
|
8
9
|
ast;
|
|
9
10
|
name;
|
|
@@ -18,6 +19,7 @@ export class DaggerArgument {
|
|
|
18
19
|
defaultValue;
|
|
19
20
|
symbol;
|
|
20
21
|
constructor(node, ast) {
|
|
22
|
+
super(node);
|
|
21
23
|
this.node = node;
|
|
22
24
|
this.ast = ast;
|
|
23
25
|
this.symbol = this.ast.getSymbolOrThrow(node.name);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { AST } from "../typescript_module/index.js";
|
|
3
3
|
import { DaggerEnumBase, DaggerEnumBaseValue } from "./enumBase.js";
|
|
4
|
+
import { Locatable } from "./locatable.js";
|
|
4
5
|
export type DaggerEnums = {
|
|
5
6
|
[name: string]: DaggerEnum;
|
|
6
7
|
};
|
|
7
8
|
export type DaggerEnumValues = {
|
|
8
9
|
[name: string]: DaggerEnumValue;
|
|
9
10
|
};
|
|
10
|
-
export declare class DaggerEnumValue implements DaggerEnumBaseValue {
|
|
11
|
+
export declare class DaggerEnumValue extends Locatable implements DaggerEnumBaseValue {
|
|
11
12
|
private readonly node;
|
|
12
13
|
private readonly ast;
|
|
13
14
|
name: string;
|
|
@@ -20,7 +21,7 @@ export declare class DaggerEnumValue implements DaggerEnumBaseValue {
|
|
|
20
21
|
description: string;
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
export declare class DaggerEnum implements DaggerEnumBase {
|
|
24
|
+
export declare class DaggerEnum extends Locatable implements DaggerEnumBase {
|
|
24
25
|
private readonly node;
|
|
25
26
|
private readonly ast;
|
|
26
27
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAA;AACxD,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAA;AAElE,qBAAa,eAAgB,SAAQ,SAAU,YAAW,mBAAmB;IAQzE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IAE1B,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,GAAG,EAAE,GAAG;IAiB3B,MAAM;;;;CAMP;AAED,qBAAa,UAAW,SAAQ,SAAU,YAAW,cAAc;IAQ/D,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,gBAAgB,CAAK;IAEpC,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,eAAe,EACxB,GAAG,EAAE,GAAG;IAgB3B,MAAM;;;;;CAOP"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntrospectionError } from "../../../common/errors/index.js";
|
|
2
2
|
import { AST } from "../typescript_module/index.js";
|
|
3
|
-
|
|
3
|
+
import { Locatable } from "./locatable.js";
|
|
4
|
+
export class DaggerEnumValue extends Locatable {
|
|
4
5
|
node;
|
|
5
6
|
ast;
|
|
6
7
|
name;
|
|
@@ -8,6 +9,7 @@ export class DaggerEnumValue {
|
|
|
8
9
|
description;
|
|
9
10
|
symbol;
|
|
10
11
|
constructor(node, ast) {
|
|
12
|
+
super(node);
|
|
11
13
|
this.node = node;
|
|
12
14
|
this.ast = ast;
|
|
13
15
|
this.symbol = this.ast.getSymbolOrThrow(this.node.name);
|
|
@@ -26,7 +28,7 @@ export class DaggerEnumValue {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
|
-
export class DaggerEnum {
|
|
31
|
+
export class DaggerEnum extends Locatable {
|
|
30
32
|
node;
|
|
31
33
|
ast;
|
|
32
34
|
name;
|
|
@@ -34,6 +36,7 @@ export class DaggerEnum {
|
|
|
34
36
|
values = {};
|
|
35
37
|
symbol;
|
|
36
38
|
constructor(node, ast) {
|
|
39
|
+
super(node);
|
|
37
40
|
this.node = node;
|
|
38
41
|
this.ast = ast;
|
|
39
42
|
this.name = this.node.name.getText();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Locatable } from "./locatable.js";
|
|
2
|
+
export interface DaggerEnumBaseValue extends Locatable {
|
|
2
3
|
name: string;
|
|
3
4
|
value: string;
|
|
4
5
|
description: string;
|
|
@@ -6,7 +7,7 @@ export interface DaggerEnumBaseValue {
|
|
|
6
7
|
export type DaggerEnumBaseValues = {
|
|
7
8
|
[name: string]: DaggerEnumBaseValue;
|
|
8
9
|
};
|
|
9
|
-
export interface DaggerEnumBase {
|
|
10
|
+
export interface DaggerEnumBase extends Locatable {
|
|
10
11
|
name: string;
|
|
11
12
|
description: string;
|
|
12
13
|
values: DaggerEnumBaseValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumBase.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enumBase.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"enumBase.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enumBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAAE,CAAA;AAE1E,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { AST } from "../typescript_module/index.js";
|
|
3
3
|
import { DaggerEnumBase, DaggerEnumBaseValue } from "./enumBase.js";
|
|
4
|
+
import { Locatable } from "./locatable.js";
|
|
4
5
|
export type DaggerEnumClasses = {
|
|
5
6
|
[name: string]: DaggerEnumClass;
|
|
6
7
|
};
|
|
7
8
|
export type DaggerEnumClassValues = {
|
|
8
9
|
[name: string]: DaggerEnumClassValue;
|
|
9
10
|
};
|
|
10
|
-
export declare class DaggerEnumClassValue implements DaggerEnumBaseValue {
|
|
11
|
+
export declare class DaggerEnumClassValue extends Locatable implements DaggerEnumBaseValue {
|
|
11
12
|
private readonly node;
|
|
12
13
|
private readonly ast;
|
|
13
14
|
name: string;
|
|
@@ -20,7 +21,7 @@ export declare class DaggerEnumClassValue implements DaggerEnumBaseValue {
|
|
|
20
21
|
description: string;
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
export declare class DaggerEnumClass implements DaggerEnumBase {
|
|
24
|
+
export declare class DaggerEnumClass extends Locatable implements DaggerEnumBase {
|
|
24
25
|
private readonly node;
|
|
25
26
|
private readonly ast;
|
|
26
27
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumClass.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enumClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"enumClass.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enumClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,iBAAiB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAA;AAEnE,MAAM,MAAM,qBAAqB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAAA;CAAE,CAAA;AAE5E,qBAAa,oBACX,SAAQ,SACR,YAAW,mBAAmB;IAS5B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IAE1B,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,mBAAmB,EAC5B,GAAG,EAAE,GAAG;IAe3B,MAAM;;;;CAMP;AAED,qBAAa,eAAgB,SAAQ,SAAU,YAAW,cAAc;IAQpE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,qBAAqB,CAAK;IAEzC,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,gBAAgB,EACzB,GAAG,EAAE,GAAG;IAuB3B,MAAM;;;;;CAOP"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { IntrospectionError } from "../../../common/errors/index.js";
|
|
3
3
|
import { AST } from "../typescript_module/index.js";
|
|
4
|
-
|
|
4
|
+
import { Locatable } from "./locatable.js";
|
|
5
|
+
export class DaggerEnumClassValue extends Locatable {
|
|
5
6
|
node;
|
|
6
7
|
ast;
|
|
7
8
|
name;
|
|
@@ -9,6 +10,7 @@ export class DaggerEnumClassValue {
|
|
|
9
10
|
description;
|
|
10
11
|
symbol;
|
|
11
12
|
constructor(node, ast) {
|
|
13
|
+
super(node);
|
|
12
14
|
this.node = node;
|
|
13
15
|
this.ast = ast;
|
|
14
16
|
this.name = this.node.name.getText();
|
|
@@ -27,7 +29,7 @@ export class DaggerEnumClassValue {
|
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
export class DaggerEnumClass {
|
|
32
|
+
export class DaggerEnumClass extends Locatable {
|
|
31
33
|
node;
|
|
32
34
|
ast;
|
|
33
35
|
name;
|
|
@@ -35,6 +37,7 @@ export class DaggerEnumClass {
|
|
|
35
37
|
values = {};
|
|
36
38
|
symbol;
|
|
37
39
|
constructor(node, ast) {
|
|
40
|
+
super(node);
|
|
38
41
|
this.node = node;
|
|
39
42
|
this.ast = ast;
|
|
40
43
|
if (!this.node.name) {
|
|
@@ -3,11 +3,12 @@ import { TypeDefKind } from "../../../api/client.gen.js";
|
|
|
3
3
|
import { TypeDef } from "../typedef.js";
|
|
4
4
|
import { AST } from "../typescript_module/index.js";
|
|
5
5
|
import { DaggerArguments } from "./argument.js";
|
|
6
|
+
import { Locatable } from "./locatable.js";
|
|
6
7
|
import { References } from "./reference.js";
|
|
7
8
|
export type DaggerFunctions = {
|
|
8
9
|
[name: string]: DaggerFunction;
|
|
9
10
|
};
|
|
10
|
-
export declare class DaggerFunction {
|
|
11
|
+
export declare class DaggerFunction extends Locatable {
|
|
11
12
|
private readonly node;
|
|
12
13
|
private readonly ast;
|
|
13
14
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/function.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;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAA;AAEhE,qBAAa,
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/function.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;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAA;AAEhE,qBAAa,cAAe,SAAQ,SAAS;IAYzC,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,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,SAAS,EAAE,eAAe,CAAK;IAEtC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAC1B,GAAG,EAAE,GAAG;IAmB3B,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,QAAQ;IAaT,YAAY,IAAI,MAAM,EAAE;IAIxB,aAAa,IAAI,MAAM,EAAE;IAoBzB,mBAAmB,CAAC,UAAU,EAAE,UAAU;IAuB1C,MAAM;;;;;;;CASd"}
|
|
@@ -2,7 +2,8 @@ import { IntrospectionError } from "../../../common/errors/index.js";
|
|
|
2
2
|
import { AST, isTypeDefResolved, resolveTypeDef, } from "../typescript_module/index.js";
|
|
3
3
|
import { DaggerArgument } from "./argument.js";
|
|
4
4
|
import { FUNCTION_DECORATOR } from "./decorator.js";
|
|
5
|
-
|
|
5
|
+
import { Locatable } from "./locatable.js";
|
|
6
|
+
export class DaggerFunction extends Locatable {
|
|
6
7
|
node;
|
|
7
8
|
ast;
|
|
8
9
|
name;
|
|
@@ -14,6 +15,7 @@ export class DaggerFunction {
|
|
|
14
15
|
signature;
|
|
15
16
|
symbol;
|
|
16
17
|
constructor(node, ast) {
|
|
18
|
+
super(node);
|
|
17
19
|
this.node = node;
|
|
18
20
|
this.ast = ast;
|
|
19
21
|
this.symbol = this.ast.getSymbolOrThrow(node.name);
|
|
@@ -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"}
|
|
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"}
|