@dagger.io/dagger 0.15.2 → 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.
Files changed (39) hide show
  1. package/dist/src/api/client.gen.d.ts +8 -5
  2. package/dist/src/api/client.gen.d.ts.map +1 -1
  3. package/dist/src/api/client.gen.js +30 -164
  4. package/dist/src/common/context.d.ts +1 -1
  5. package/dist/src/common/context.d.ts.map +1 -1
  6. package/dist/src/common/context.js +2 -2
  7. package/dist/src/module/entrypoint/invoke.d.ts.map +1 -1
  8. package/dist/src/module/entrypoint/invoke.js +10 -0
  9. package/dist/src/module/entrypoint/load.d.ts.map +1 -1
  10. package/dist/src/module/entrypoint/load.js +6 -1
  11. package/dist/src/module/entrypoint/register.d.ts.map +1 -1
  12. package/dist/src/module/entrypoint/register.js +13 -0
  13. package/dist/src/module/executor.d.ts +5 -0
  14. package/dist/src/module/executor.d.ts.map +1 -1
  15. package/dist/src/module/executor.js +110 -1
  16. package/dist/src/module/introspector/case_convertor.d.ts.map +1 -1
  17. package/dist/src/module/introspector/case_convertor.js +7 -9
  18. package/dist/src/module/introspector/dagger_module/index.d.ts +1 -0
  19. package/dist/src/module/introspector/dagger_module/index.d.ts.map +1 -1
  20. package/dist/src/module/introspector/dagger_module/index.js +1 -0
  21. package/dist/src/module/introspector/dagger_module/interface.d.ts +25 -0
  22. package/dist/src/module/introspector/dagger_module/interface.d.ts.map +1 -0
  23. package/dist/src/module/introspector/dagger_module/interface.js +56 -0
  24. package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts +32 -0
  25. package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts.map +1 -0
  26. package/dist/src/module/introspector/dagger_module/interfaceFunction.js +87 -0
  27. package/dist/src/module/introspector/dagger_module/module.d.ts +16 -1
  28. package/dist/src/module/introspector/dagger_module/module.d.ts.map +1 -1
  29. package/dist/src/module/introspector/dagger_module/module.js +36 -2
  30. package/dist/src/module/introspector/dagger_module/reference.d.ts +1 -1
  31. package/dist/src/module/introspector/dagger_module/reference.d.ts.map +1 -1
  32. package/dist/src/module/introspector/typedef.d.ts +8 -1
  33. package/dist/src/module/introspector/typedef.d.ts.map +1 -1
  34. package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -1
  35. package/dist/src/module/introspector/typescript_module/ast.js +9 -2
  36. package/dist/src/provisioning/bin.js +1 -1
  37. package/dist/src/provisioning/default.d.ts +1 -1
  38. package/dist/src/provisioning/default.js +1 -1
  39. package/package.json +15 -15
@@ -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,CAoBzD"}
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
- .replace(/[^a-zA-Z0-9]/g, " ") // Replace non-alphanumeric characters with spaces
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
- if (words.length === 0) {
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("");
@@ -11,4 +11,5 @@ export * from "./reference.js";
11
11
  export * from "./typeObject.js";
12
12
  export * from "./decorator.js";
13
13
  export * from "./locatable.js";
14
+ export * from "./interface.js";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -11,3 +11,4 @@ export * from "./reference.js";
11
11
  export * from "./typeObject.js";
12
12
  export * from "./decorator.js";
13
13
  export * from "./locatable.js";
14
+ export * from "./interface.js";
@@ -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 a class, recursively find the references of the object.
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;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAInD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAoDd,IAAI,EAAE,MAAM;IACnB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IArDb;;;;;;;;;;;;;;;;;;;OAmBG;IACI,OAAO,EAAE,iBAAiB,CAAK;IAEtC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,KAAK,EAAE,eAAe,CAAK;IAC3B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAEtC,OAAO,CAAC,UAAU,CAAiB;gBAG1B,IAAI,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,GAAG;IAkClB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IAmHzB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IAsExB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB,MAAM;;;;;;CAQP"}
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 a class, recursively find the references of the object.
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;AAEnC,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"}
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/reference.ts"],"names":[],"mappings":"A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};
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,IA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AE,QAAQ,GAAG,QAAQ,EACzB,QAAQ,SAAI,GACX,CAAC,GAAG,SAAS;IA4BT,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAYjD,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAY/C,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAY/C,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM;IAMvC,eAAe,CACpB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS;IA4DnC,OAAO,CAAC,yCAAyC;IAoB1C,4BAA4B,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,GAAG;CAkDpE"}
@@ -187,8 +187,15 @@ export class AST {
187
187
  tsTypeToTypeDef(node, type) {
188
188
  if (type.flags & ts.TypeFlags.String)
189
189
  return { kind: TypeDefKind.StringKind };
190
- if (type.flags & ts.TypeFlags.Number)
190
+ if (type.flags & ts.TypeFlags.Number) {
191
+ // Float will be interpreted as number by the TypeScript compiler so we need to check if the
192
+ // text is "float" to know if it's a float or an integer.
193
+ // It can also be interpreted as a reference, but this is handled separately at an upper level.
194
+ if (node.getText().includes("float")) {
195
+ return { kind: TypeDefKind.FloatKind };
196
+ }
191
197
  return { kind: TypeDefKind.IntegerKind };
198
+ }
192
199
  if (type.flags & ts.TypeFlags.Boolean)
193
200
  return { kind: TypeDefKind.BooleanKind };
194
201
  if (type.flags & ts.TypeFlags.Void)
@@ -230,7 +237,7 @@ export class AST {
230
237
  const type = typeof value;
231
238
  switch (type) {
232
239
  case "string":
233
- case "number":
240
+ case "number": // float is also included here
234
241
  case "bigint":
235
242
  case "boolean":
236
243
  case "object":
@@ -316,7 +316,7 @@ export class Bin {
316
316
  await new Promise((resolve, reject) => {
317
317
  archiveResp.body?.pipe(archiveFile);
318
318
  archiveResp.body?.on("error", reject);
319
- archiveFile.on("finish", resolve);
319
+ archiveFile.on("finish", () => resolve(undefined));
320
320
  });
321
321
  const actualChecksum = crypto
322
322
  .createHash("sha256")
@@ -1,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.15.2";
1
+ export declare const CLI_VERSION = "0.15.3";
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.15.2";
2
+ export const CLI_VERSION = "0.15.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dagger.io/dagger",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "author": "hello@dagger.io",
5
5
  "license": "Apache-2.0",
6
6
  "types": "./dist/index.d.ts",
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "main": "dist/src/index.js",
19
19
  "dependencies": {
20
- "@grpc/grpc-js": "^1.12.4",
20
+ "@grpc/grpc-js": "^1.12.5",
21
21
  "@lifeomic/axios-fetch": "^3.1.0",
22
22
  "@opentelemetry/api": "^1.9.0",
23
- "@opentelemetry/exporter-trace-otlp-http": "^0.56.0",
24
- "@opentelemetry/sdk-metrics": "^1.29.0",
25
- "@opentelemetry/sdk-node": "^0.56.0",
23
+ "@opentelemetry/exporter-trace-otlp-http": "^0.57.1",
24
+ "@opentelemetry/sdk-metrics": "^1.30.1",
25
+ "@opentelemetry/sdk-node": "^0.57.1",
26
26
  "@opentelemetry/semantic-conventions": "^1.25.1",
27
27
  "adm-zip": "^0.5.16",
28
28
  "env-paths": "^3.0.0",
@@ -34,7 +34,7 @@
34
34
  "node-fetch": "^3.3.2",
35
35
  "reflect-metadata": "^0.2.2",
36
36
  "tar": "^7.4.2",
37
- "typescript": "^5.7.2"
37
+ "typescript": "^5.7.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsc",
@@ -50,20 +50,20 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@eslint/js": "^10.0.0",
53
- "@trivago/prettier-plugin-sort-imports": "^5.2.0",
53
+ "@trivago/prettier-plugin-sort-imports": "^5.2.1",
54
54
  "@types/adm-zip": "^0.5.7",
55
55
  "@types/mocha": "^10.0.7",
56
- "@types/node": "~22.10.2",
56
+ "@types/node": "~22.10.10",
57
57
  "@types/tar": "^6.1.13",
58
- "@typescript-eslint/eslint-plugin": "^8.18.0",
59
- "@typescript-eslint/parser": "^8.18.0",
60
- "eslint": "^9.17.0",
61
- "eslint-config-prettier": "^9.1.0",
62
- "eslint-plugin-prettier": "^5.2.1",
63
- "mocha": "^11.0.1",
58
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
59
+ "@typescript-eslint/parser": "^8.21.0",
60
+ "eslint": "^9.19.0",
61
+ "eslint-config-prettier": "^10.0.1",
62
+ "eslint-plugin-prettier": "^5.2.3",
63
+ "mocha": "^11.1.0",
64
64
  "prettier": "^3.4.2",
65
65
  "ts-node": "^10.9.2",
66
66
  "tsx": "^4.19.2",
67
- "typescript-eslint": "^8.18.0"
67
+ "typescript-eslint": "^8.21.0"
68
68
  }
69
69
  }