@dagger.io/dagger 0.9.8 → 0.9.10

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 (32) hide show
  1. package/dist/api/client.gen.d.ts +348 -49
  2. package/dist/api/client.gen.d.ts.map +1 -1
  3. package/dist/api/client.gen.js +537 -100
  4. package/dist/entrypoint/entrypoint.js +2 -1
  5. package/dist/entrypoint/invoke.d.ts.map +1 -1
  6. package/dist/entrypoint/invoke.js +25 -5
  7. package/dist/entrypoint/load.d.ts +43 -1
  8. package/dist/entrypoint/load.d.ts.map +1 -1
  9. package/dist/entrypoint/load.js +109 -2
  10. package/dist/entrypoint/register.d.ts.map +1 -1
  11. package/dist/entrypoint/register.js +7 -3
  12. package/dist/introspector/decorators/decorators.d.ts +3 -3
  13. package/dist/introspector/decorators/decorators.d.ts.map +1 -1
  14. package/dist/introspector/registry/registry.d.ts +5 -3
  15. package/dist/introspector/registry/registry.d.ts.map +1 -1
  16. package/dist/introspector/registry/registry.js +20 -28
  17. package/dist/introspector/scanner/metadata.d.ts +1 -0
  18. package/dist/introspector/scanner/metadata.d.ts.map +1 -1
  19. package/dist/introspector/scanner/scan.d.ts +5 -1
  20. package/dist/introspector/scanner/scan.d.ts.map +1 -1
  21. package/dist/introspector/scanner/scan.js +38 -5
  22. package/dist/introspector/scanner/serialize.d.ts.map +1 -1
  23. package/dist/introspector/scanner/serialize.js +8 -2
  24. package/dist/introspector/scanner/typeDefs.d.ts +3 -0
  25. package/dist/introspector/scanner/typeDefs.d.ts.map +1 -1
  26. package/dist/introspector/scanner/utils.d.ts +18 -2
  27. package/dist/introspector/scanner/utils.d.ts.map +1 -1
  28. package/dist/introspector/scanner/utils.js +85 -12
  29. package/dist/provisioning/default.d.ts +1 -1
  30. package/dist/provisioning/default.d.ts.map +1 -1
  31. package/dist/provisioning/default.js +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"typeDefs.d.ts","sourceRoot":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 +2,33 @@ import ts from "typescript";
2
2
  import { TypeDefKind } from "../../api/client.gen.js";
3
3
  import { TypeDef } from "./typeDefs.js";
4
4
  /**
5
- * Return true if the given class declaration has the decorator @obj on
5
+ * Return true if the given class declaration has the decorator @obj() on
6
6
  * top of its declaration.
7
7
  * @param object
8
8
  */
9
9
  export declare function isObject(object: ts.ClassDeclaration): boolean;
10
10
  /**
11
- * Return true if the given method has the decorator @fct on top
11
+ * Check if the class is the main object of the module.
12
+ *
13
+ * @param classtName The name of the class to check.
14
+ * @param moduleName The name of the module.
15
+ */
16
+ export declare function isMainObject(className: string, moduleName: string): boolean;
17
+ /**
18
+ * Return true if the given method has the decorator @fct() on top
12
19
  * of its declaration.
13
20
  *
14
21
  * @param method The method to check
15
22
  */
16
23
  export declare function isFunction(method: ts.MethodDeclaration): boolean;
24
+ /**
25
+ * Return true if the given property has the decorator @field() on top
26
+ * of its declaration.
27
+ *
28
+ * @param property The property to check
29
+ */
30
+ export declare function isField(property: ts.PropertyDeclaration): boolean;
31
+ export declare function getAlias(elem: ts.HasDecorators, kind: "field" | "func"): string | undefined;
17
32
  /**
18
33
  * Return true if the given property is public.
19
34
  *
@@ -54,6 +69,7 @@ type OptionalValue = {
54
69
  * @param param The param to check.
55
70
  */
56
71
  export declare function isOptional(param: ts.Symbol): OptionalValue;
72
+ export declare function isVariadic(param: ts.Symbol): boolean;
57
73
  /**
58
74
  * Convert a typename into a Dagger Typedef using dynamic typing.
59
75
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,GAAG,OAAO,CAM7D;A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;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,GAAG,OAAO,CAe1E;AAED,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,GAAG,aAAa,CAwB1D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,GAAG,OAAO,CAcpD;AAaD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBxE"}
@@ -1,24 +1,89 @@
1
1
  import ts from "typescript";
2
2
  import { TypeDefKind } from "../../api/client.gen.js";
3
3
  /**
4
- * Return true if the given class declaration has the decorator @obj on
4
+ * Return true if the given class declaration has the decorator @obj() on
5
5
  * top of its declaration.
6
6
  * @param object
7
7
  */
8
8
  export function isObject(object) {
9
- return (ts
10
- .getDecorators(object)
11
- ?.find((d) => d.expression.getText() === "object") !== undefined);
9
+ return (ts.getDecorators(object)?.find((d) => {
10
+ if (ts.isCallExpression(d.expression)) {
11
+ return d.expression.expression.getText() === "object";
12
+ }
13
+ return false;
14
+ }) !== undefined);
12
15
  }
13
16
  /**
14
- * Return true if the given method has the decorator @fct on top
17
+ * Check if the class is the main object of the module.
18
+ *
19
+ * @param classtName The name of the class to check.
20
+ * @param moduleName The name of the module.
21
+ */
22
+ export function isMainObject(className, moduleName) {
23
+ const toPascalCase = (input) => {
24
+ const words = input
25
+ .replace(/[^a-zA-Z0-9]/g, " ") // Replace non-alphanumeric characters with spaces
26
+ .split(/\s+/)
27
+ .filter((word) => word.length > 0);
28
+ if (words.length === 0) {
29
+ return ""; // No valid words found
30
+ }
31
+ // It's an edge case when moduleName is already in PascalCase or camelCase
32
+ if (words.length === 1) {
33
+ return words[0].charAt(0).toUpperCase() + words[0].slice(1);
34
+ }
35
+ const pascalCase = words
36
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
37
+ .join("");
38
+ return pascalCase;
39
+ };
40
+ return toPascalCase(moduleName) === className;
41
+ }
42
+ /**
43
+ * Return true if the given method has the decorator @fct() on top
15
44
  * of its declaration.
16
45
  *
17
46
  * @param method The method to check
18
47
  */
19
48
  export function isFunction(method) {
20
- return (ts.getDecorators(method)?.find((d) => d.expression.getText() === "func") !==
21
- undefined);
49
+ return (ts.getDecorators(method)?.find((d) => {
50
+ if (ts.isCallExpression(d.expression)) {
51
+ return d.expression.expression.getText() === "func";
52
+ }
53
+ return false;
54
+ }) !== undefined);
55
+ }
56
+ /**
57
+ * Return true if the given property has the decorator @field() on top
58
+ * of its declaration.
59
+ *
60
+ * @param property The property to check
61
+ */
62
+ export function isField(property) {
63
+ return (ts.getDecorators(property)?.find((d) => {
64
+ if (ts.isCallExpression(d.expression)) {
65
+ return d.expression.expression.getText() === "field";
66
+ }
67
+ return false;
68
+ }) !== undefined);
69
+ }
70
+ export function getAlias(elem, kind) {
71
+ const decorator = ts.getDecorators(elem)?.find((d) => {
72
+ if (ts.isCallExpression(d.expression)) {
73
+ return d.expression.expression.getText() === kind;
74
+ }
75
+ return false;
76
+ });
77
+ if (!decorator) {
78
+ return undefined;
79
+ }
80
+ const expression = decorator.expression;
81
+ const args = expression.arguments;
82
+ const alias = args[0]?.getText();
83
+ if (alias) {
84
+ return JSON.parse(alias.replace(/'/g, '"'));
85
+ }
86
+ return undefined;
22
87
  }
23
88
  /**
24
89
  * Return true if the given property is public.
@@ -45,11 +110,7 @@ export function isFunction(method) {
45
110
  * @param property The property to check on.
46
111
  */
47
112
  export function isPublicProperty(property) {
48
- const decorators = ts.getDecorators(property);
49
- if (!decorators) {
50
- return false;
51
- }
52
- if (decorators.find((d) => d.expression.getText() === "field") === undefined) {
113
+ if (!isField(property)) {
53
114
  return false;
54
115
  }
55
116
  const modifiers = ts.getModifiers(property);
@@ -87,6 +148,18 @@ export function isOptional(param) {
87
148
  }
88
149
  return result;
89
150
  }
151
+ export function isVariadic(param) {
152
+ const declarations = param.getDeclarations();
153
+ // Only check if the parameters actually have declarations
154
+ if (declarations && declarations.length > 0) {
155
+ const parameterDeclaration = declarations[0];
156
+ // Convert the symbol declaration into Parameter
157
+ if (ts.isParameter(parameterDeclaration)) {
158
+ return parameterDeclaration.dotDotDotToken !== undefined;
159
+ }
160
+ }
161
+ return false;
162
+ }
90
163
  function formatDefaultValue(value) {
91
164
  const isSingleQuoteString = () => value.startsWith("'") && value.endsWith("'");
92
165
  if (isSingleQuoteString()) {
@@ -1,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.9.8";
1
+ export declare const CLI_VERSION = "0.9.10";
2
2
  //# sourceMappingURL=default.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../provisioning/default.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,UAAU,CAAA"}
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../provisioning/default.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,WAAW,CAAA"}
@@ -1,2 +1,2 @@
1
1
  // Code generated by dagger. DO NOT EDIT.
2
- export const CLI_VERSION = "0.9.8";
2
+ export const CLI_VERSION = "0.9.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dagger.io/dagger",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "author": "hello@dagger.io",
5
5
  "license": "Apache-2.0",
6
6
  "types": "./dist/index.d.ts",