@dagger.io/dagger 0.9.6 → 0.9.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/api/client.gen.d.ts +809 -501
- package/dist/api/client.gen.d.ts.map +1 -1
- package/dist/api/client.gen.js +1601 -570
- package/dist/common/utils.d.ts +3 -0
- package/dist/common/utils.d.ts.map +1 -1
- package/dist/entrypoint/entrypoint.d.ts +1 -1
- package/dist/entrypoint/entrypoint.d.ts.map +1 -1
- package/dist/entrypoint/entrypoint.js +13 -25
- package/dist/entrypoint/invoke.d.ts +14 -6
- package/dist/entrypoint/invoke.d.ts.map +1 -1
- package/dist/entrypoint/invoke.js +21 -8
- package/dist/entrypoint/load.d.ts +42 -5
- package/dist/entrypoint/load.d.ts.map +1 -1
- package/dist/entrypoint/load.js +121 -26
- package/dist/entrypoint/register.d.ts +3 -2
- package/dist/entrypoint/register.d.ts.map +1 -1
- package/dist/entrypoint/register.js +17 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/introspector/registry/registry.d.ts +1 -9
- package/dist/introspector/registry/registry.d.ts.map +1 -1
- package/dist/introspector/registry/registry.js +9 -36
- package/dist/introspector/scanner/scan.d.ts +6 -2
- package/dist/introspector/scanner/scan.d.ts.map +1 -1
- package/dist/introspector/scanner/scan.js +31 -20
- package/dist/introspector/scanner/typeDefs.d.ts +16 -7
- package/dist/introspector/scanner/typeDefs.d.ts.map +1 -1
- package/dist/introspector/scanner/utils.js +6 -6
- package/dist/provisioning/default.d.ts +1 -1
- package/dist/provisioning/default.js +1 -1
- package/package.json +7 -6
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ClassTypeDef, FunctionTypedef } from "./typeDefs.js";
|
|
2
2
|
export type ScanResult = {
|
|
3
|
-
classes:
|
|
4
|
-
|
|
3
|
+
classes: {
|
|
4
|
+
[name: string]: ClassTypeDef;
|
|
5
|
+
};
|
|
6
|
+
functions: {
|
|
7
|
+
[name: string]: FunctionTypedef;
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
10
|
/**
|
|
7
11
|
* Scan the list of TypeScript File using the TypeScript compiler API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/scan.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EAIZ,eAAe,EAChB,MAAM,eAAe,CAAA;AAStB,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/scan.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EAIZ,eAAe,EAChB,MAAM,eAAe,CAAA;AAStB,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;KAAE,CAAA;IACzC,SAAS,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAA;CAC/C,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CA+BhD"}
|
|
@@ -20,8 +20,8 @@ export function scan(files) {
|
|
|
20
20
|
const program = ts.createProgram(files, { experimentalDecorators: true });
|
|
21
21
|
const checker = program.getTypeChecker();
|
|
22
22
|
const metadata = {
|
|
23
|
-
classes:
|
|
24
|
-
functions:
|
|
23
|
+
classes: {},
|
|
24
|
+
functions: {},
|
|
25
25
|
};
|
|
26
26
|
for (const file of program.getSourceFiles()) {
|
|
27
27
|
// Ignore type declaration files.
|
|
@@ -31,7 +31,8 @@ export function scan(files) {
|
|
|
31
31
|
ts.forEachChild(file, (node) => {
|
|
32
32
|
// Handle class
|
|
33
33
|
if (ts.isClassDeclaration(node) && isObject(node)) {
|
|
34
|
-
|
|
34
|
+
const classTypeDef = introspectClass(checker, node);
|
|
35
|
+
metadata.classes[classTypeDef.name] = classTypeDef;
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -65,8 +66,8 @@ function introspectClass(checker, node) {
|
|
|
65
66
|
name,
|
|
66
67
|
description,
|
|
67
68
|
constructor: undefined,
|
|
68
|
-
fields:
|
|
69
|
-
methods:
|
|
69
|
+
fields: {},
|
|
70
|
+
methods: {},
|
|
70
71
|
};
|
|
71
72
|
// Loop through all members in the class to get their metadata.
|
|
72
73
|
node.members.forEach((member) => {
|
|
@@ -76,12 +77,13 @@ function introspectClass(checker, node) {
|
|
|
76
77
|
}
|
|
77
78
|
// Handle method from the class.
|
|
78
79
|
if (ts.isMethodDeclaration(member) && isFunction(member)) {
|
|
79
|
-
|
|
80
|
+
const fctTypeDef = introspectMethod(checker, member);
|
|
81
|
+
metadata.methods[fctTypeDef.name] = fctTypeDef;
|
|
80
82
|
}
|
|
81
83
|
// Handle public properties from the class.
|
|
82
|
-
if (ts.isPropertyDeclaration(member)
|
|
83
|
-
|
|
84
|
-
metadata.fields.
|
|
84
|
+
if (ts.isPropertyDeclaration(member)) {
|
|
85
|
+
const fieldTypeDef = introspectProperty(checker, member);
|
|
86
|
+
metadata.fields[fieldTypeDef.name] = fieldTypeDef;
|
|
85
87
|
}
|
|
86
88
|
});
|
|
87
89
|
return metadata;
|
|
@@ -100,27 +102,33 @@ function introspectProperty(checker, property) {
|
|
|
100
102
|
throw new UnknownDaggerError(`could not get property symbol: ${property.name.getText()}`, {});
|
|
101
103
|
}
|
|
102
104
|
const { name, typeName, description } = serializeSymbol(checker, propertySymbol);
|
|
103
|
-
return {
|
|
105
|
+
return {
|
|
106
|
+
name,
|
|
107
|
+
description,
|
|
108
|
+
typeDef: typeNameToTypedef(typeName),
|
|
109
|
+
isExposed: isPublicProperty(property),
|
|
110
|
+
};
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
106
113
|
* Introspect the constructor of the class and return its metadata.
|
|
107
114
|
*/
|
|
108
115
|
function introspectConstructor(checker, constructor) {
|
|
109
|
-
const args = constructor.parameters.
|
|
116
|
+
const args = constructor.parameters.reduce((acc, param) => {
|
|
110
117
|
const paramSymbol = checker.getSymbolAtLocation(param.name);
|
|
111
118
|
if (!paramSymbol) {
|
|
112
119
|
throw new UnknownDaggerError(`could not get constructor param: ${param.name.getText()}`, {});
|
|
113
120
|
}
|
|
114
121
|
const { name, typeName, description } = serializeSymbol(checker, paramSymbol);
|
|
115
122
|
const { optional, defaultValue } = isOptional(paramSymbol);
|
|
116
|
-
|
|
123
|
+
acc[name] = {
|
|
117
124
|
name,
|
|
118
125
|
description,
|
|
119
126
|
typeDef: typeNameToTypedef(typeName),
|
|
120
127
|
optional,
|
|
121
128
|
defaultValue,
|
|
122
129
|
};
|
|
123
|
-
|
|
130
|
+
return acc;
|
|
131
|
+
}, {});
|
|
124
132
|
return { args };
|
|
125
133
|
}
|
|
126
134
|
/**
|
|
@@ -146,13 +154,16 @@ function introspectMethod(checker, method) {
|
|
|
146
154
|
return {
|
|
147
155
|
name: methodMetadata.name,
|
|
148
156
|
description: methodMetadata.description,
|
|
149
|
-
args: methodSignature.params.
|
|
150
|
-
name
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
args: methodSignature.params.reduce((acc, { name, typeName, description, optional, defaultValue }) => {
|
|
158
|
+
acc[name] = {
|
|
159
|
+
name,
|
|
160
|
+
typeDef: typeNameToTypedef(typeName),
|
|
161
|
+
description,
|
|
162
|
+
optional,
|
|
163
|
+
defaultValue,
|
|
164
|
+
};
|
|
165
|
+
return acc;
|
|
166
|
+
}, {}),
|
|
156
167
|
returnType: typeNameToTypedef(methodSignature.returnType),
|
|
157
168
|
};
|
|
158
169
|
}
|
|
@@ -9,14 +9,14 @@ export type BaseTypeDef = {
|
|
|
9
9
|
* Extends the base type def if it's an object to add its name.
|
|
10
10
|
*/
|
|
11
11
|
export type ObjectTypeDef = BaseTypeDef & {
|
|
12
|
-
kind: TypeDefKind.
|
|
12
|
+
kind: TypeDefKind.ObjectKind;
|
|
13
13
|
name: string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Extends the base if it's a list to add its subtype.
|
|
17
17
|
*/
|
|
18
18
|
export type ListTypeDef = BaseTypeDef & {
|
|
19
|
-
kind: TypeDefKind.
|
|
19
|
+
kind: TypeDefKind.ListKind;
|
|
20
20
|
typeDef: TypeDef<TypeDefKind>;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -26,7 +26,7 @@ export type ListTypeDef = BaseTypeDef & {
|
|
|
26
26
|
* If it's type of kind list, it transforms the BaseTypeDef into an ObjectTypeDef.
|
|
27
27
|
* If it's a type of kind list, it transforms the BaseTypeDef into a ListTypeDef.
|
|
28
28
|
*/
|
|
29
|
-
export type TypeDef<T extends BaseTypeDef["kind"]> = T extends TypeDefKind.
|
|
29
|
+
export type TypeDef<T extends BaseTypeDef["kind"]> = T extends TypeDefKind.ObjectKind ? ObjectTypeDef : T extends TypeDefKind.ListKind ? ListTypeDef : BaseTypeDef;
|
|
30
30
|
/**
|
|
31
31
|
* The type of field in a class
|
|
32
32
|
*/
|
|
@@ -34,6 +34,7 @@ export type FieldTypeDef = {
|
|
|
34
34
|
name: string;
|
|
35
35
|
description: string;
|
|
36
36
|
typeDef: TypeDef<TypeDefKind>;
|
|
37
|
+
isExposed: boolean;
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
40
|
* The type of function argument in a method or function.
|
|
@@ -51,11 +52,15 @@ export type FunctionArg = {
|
|
|
51
52
|
export type FunctionTypedef = {
|
|
52
53
|
name: string;
|
|
53
54
|
description: string;
|
|
54
|
-
args:
|
|
55
|
+
args: {
|
|
56
|
+
[name: string]: FunctionArg;
|
|
57
|
+
};
|
|
55
58
|
returnType: TypeDef<TypeDefKind>;
|
|
56
59
|
};
|
|
57
60
|
export type ConstructorTypeDef = {
|
|
58
|
-
args:
|
|
61
|
+
args: {
|
|
62
|
+
[name: string]: FunctionArg;
|
|
63
|
+
};
|
|
59
64
|
};
|
|
60
65
|
/**
|
|
61
66
|
* A type of Class.
|
|
@@ -63,8 +68,12 @@ export type ConstructorTypeDef = {
|
|
|
63
68
|
export type ClassTypeDef = {
|
|
64
69
|
name: string;
|
|
65
70
|
description: string;
|
|
66
|
-
fields:
|
|
71
|
+
fields: {
|
|
72
|
+
[name: string]: FieldTypeDef;
|
|
73
|
+
};
|
|
67
74
|
constructor?: ConstructorTypeDef;
|
|
68
|
-
methods:
|
|
75
|
+
methods: {
|
|
76
|
+
[name: string]: FunctionTypedef;
|
|
77
|
+
};
|
|
69
78
|
};
|
|
70
79
|
//# sourceMappingURL=typeDefs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeDefs.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/typeDefs.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,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAC9B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,IAC/C,CAAC,SAAS,WAAW,CAAC,UAAU,GAC5B,aAAa,GACb,CAAC,SAAS,WAAW,CAAC,QAAQ,GAC9B,WAAW,GACX,WAAW,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG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AAC,CAAA;CAC9B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IACrC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;CACtC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;KAAE,CAAA;IACxC,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAA;CAC7C,CAAA"}
|
|
@@ -102,22 +102,22 @@ export function typeNameToTypedef(typeName) {
|
|
|
102
102
|
// the type of list
|
|
103
103
|
if (typeName.endsWith("[]")) {
|
|
104
104
|
return {
|
|
105
|
-
kind: TypeDefKind.
|
|
105
|
+
kind: TypeDefKind.ListKind,
|
|
106
106
|
typeDef: typeNameToTypedef(typeName.slice(0, typeName.length - 2)),
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
switch (typeName) {
|
|
110
110
|
case "string":
|
|
111
|
-
return { kind: TypeDefKind.
|
|
111
|
+
return { kind: TypeDefKind.StringKind };
|
|
112
112
|
case "number":
|
|
113
|
-
return { kind: TypeDefKind.
|
|
113
|
+
return { kind: TypeDefKind.IntegerKind };
|
|
114
114
|
case "boolean":
|
|
115
|
-
return { kind: TypeDefKind.
|
|
115
|
+
return { kind: TypeDefKind.BooleanKind };
|
|
116
116
|
case "void":
|
|
117
|
-
return { kind: TypeDefKind.
|
|
117
|
+
return { kind: TypeDefKind.VoidKind };
|
|
118
118
|
default:
|
|
119
119
|
return {
|
|
120
|
-
kind: TypeDefKind.
|
|
120
|
+
kind: TypeDefKind.ObjectKind,
|
|
121
121
|
name: typeName,
|
|
122
122
|
};
|
|
123
123
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.9.
|
|
1
|
+
export declare const CLI_VERSION = "0.9.8";
|
|
2
2
|
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Code generated by dagger. DO NOT EDIT.
|
|
2
|
-
export const CLI_VERSION = "0.9.
|
|
2
|
+
export const CLI_VERSION = "0.9.8";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dagger.io/dagger",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"author": "hello@dagger.io",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,9 +23,11 @@
|
|
|
23
23
|
"graphql": "^16.8.0",
|
|
24
24
|
"graphql-request": "^6.1.0",
|
|
25
25
|
"graphql-tag": "^2.12.6",
|
|
26
|
-
"node-color-log": "^
|
|
26
|
+
"node-color-log": "^11.0.0",
|
|
27
27
|
"node-fetch": "^3.3.1",
|
|
28
|
-
"
|
|
28
|
+
"reflect-metadata": "^0.2.1",
|
|
29
|
+
"tar": "^6.1.13",
|
|
30
|
+
"typescript": "^5.3.3"
|
|
29
31
|
},
|
|
30
32
|
"scripts": {
|
|
31
33
|
"build": "tsc",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
|
41
43
|
"@types/adm-zip": "^0.5.0",
|
|
42
44
|
"@types/mocha": "latest",
|
|
43
|
-
"@types/node": "~
|
|
45
|
+
"@types/node": "~20",
|
|
44
46
|
"@types/tar": "^6.1.4",
|
|
45
47
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
46
48
|
"@typescript-eslint/parser": "^5.62.0",
|
|
@@ -49,7 +51,6 @@
|
|
|
49
51
|
"eslint-plugin-prettier": "^4.2.1",
|
|
50
52
|
"mocha": "^10.2.0",
|
|
51
53
|
"prettier": "^2.8.7",
|
|
52
|
-
"ts-node": "^10.9.1"
|
|
53
|
-
"typescript": "^5.3.3"
|
|
54
|
+
"ts-node": "^10.9.1"
|
|
54
55
|
}
|
|
55
56
|
}
|