@dagger.io/dagger 0.10.1 → 0.10.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 (56) hide show
  1. package/dist/api/client.gen.d.ts +80 -5
  2. package/dist/api/client.gen.d.ts.map +1 -1
  3. package/dist/api/client.gen.js +168 -5
  4. package/dist/api/utils.d.ts.map +1 -1
  5. package/dist/api/utils.js +6 -2
  6. package/dist/common/errors/ExecError.d.ts.map +1 -1
  7. package/dist/entrypoint/context.d.ts +8 -0
  8. package/dist/entrypoint/context.d.ts.map +1 -0
  9. package/dist/entrypoint/invoke.d.ts +3 -9
  10. package/dist/entrypoint/invoke.d.ts.map +1 -1
  11. package/dist/entrypoint/invoke.js +17 -28
  12. package/dist/entrypoint/load.d.ts +29 -69
  13. package/dist/entrypoint/load.d.ts.map +1 -1
  14. package/dist/entrypoint/load.js +93 -173
  15. package/dist/entrypoint/register.d.ts +2 -2
  16. package/dist/entrypoint/register.d.ts.map +1 -1
  17. package/dist/entrypoint/register.js +12 -12
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/introspector/scanner/abtractions/argument.d.ts +75 -0
  21. package/dist/introspector/scanner/abtractions/argument.d.ts.map +1 -0
  22. package/dist/introspector/scanner/abtractions/argument.js +137 -0
  23. package/dist/introspector/scanner/abtractions/constructor.d.ts +16 -0
  24. package/dist/introspector/scanner/abtractions/constructor.d.ts.map +1 -0
  25. package/dist/introspector/scanner/abtractions/constructor.js +42 -0
  26. package/dist/introspector/scanner/abtractions/method.d.ts +51 -0
  27. package/dist/introspector/scanner/abtractions/method.d.ts.map +1 -0
  28. package/dist/introspector/scanner/abtractions/method.js +105 -0
  29. package/dist/introspector/scanner/abtractions/module.d.ts +18 -0
  30. package/dist/introspector/scanner/abtractions/module.d.ts.map +1 -0
  31. package/dist/introspector/scanner/abtractions/module.js +59 -0
  32. package/dist/introspector/scanner/abtractions/object.d.ts +37 -0
  33. package/dist/introspector/scanner/abtractions/object.d.ts.map +1 -0
  34. package/dist/introspector/scanner/abtractions/object.js +94 -0
  35. package/dist/introspector/scanner/abtractions/property.d.ts +46 -0
  36. package/dist/introspector/scanner/abtractions/property.d.ts.map +1 -0
  37. package/dist/introspector/scanner/abtractions/property.js +93 -0
  38. package/dist/introspector/scanner/scan.d.ts +2 -1
  39. package/dist/introspector/scanner/scan.d.ts.map +1 -1
  40. package/dist/introspector/scanner/scan.js +2 -181
  41. package/dist/introspector/scanner/serialize.d.ts +0 -24
  42. package/dist/introspector/scanner/serialize.d.ts.map +1 -1
  43. package/dist/introspector/scanner/serialize.js +0 -53
  44. package/dist/introspector/scanner/typeDefs.d.ts +3 -3
  45. package/dist/introspector/scanner/typeDefs.d.ts.map +1 -1
  46. package/dist/introspector/scanner/utils.d.ts +1 -57
  47. package/dist/introspector/scanner/utils.d.ts.map +1 -1
  48. package/dist/introspector/scanner/utils.js +16 -149
  49. package/dist/provisioning/bin.d.ts.map +1 -1
  50. package/dist/provisioning/bin.js +10 -4
  51. package/dist/provisioning/default.d.ts +1 -1
  52. package/dist/provisioning/default.js +1 -1
  53. package/package.json +5 -2
  54. package/dist/introspector/scanner/metadata.d.ts +0 -24
  55. package/dist/introspector/scanner/metadata.d.ts.map +0 -1
  56. /package/dist/{introspector/scanner/metadata.js → entrypoint/context.js} +0 -0
@@ -13,31 +13,22 @@ export function isObject(object) {
13
13
  return false;
14
14
  }) !== undefined);
15
15
  }
16
- /**
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;
16
+ export function toPascalCase(input) {
17
+ const words = input
18
+ .replace(/[^a-zA-Z0-9]/g, " ") // Replace non-alphanumeric characters with spaces
19
+ .split(/\s+/)
20
+ .filter((word) => word.length > 0);
21
+ if (words.length === 0) {
22
+ return ""; // No valid words found
23
+ }
24
+ // It's an edge case when moduleName is already in PascalCase or camelCase
25
+ if (words.length === 1) {
26
+ return words[0].charAt(0).toUpperCase() + words[0].slice(1);
27
+ }
28
+ const pascalCase = words
29
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
30
+ .join("");
31
+ return pascalCase;
41
32
  }
42
33
  /**
43
34
  * Return true if the given method has the decorator @fct() on top
@@ -53,130 +44,6 @@ export function isFunction(method) {
53
44
  return false;
54
45
  }) !== undefined);
55
46
  }
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;
87
- }
88
- /**
89
- * Return true if the given property is public.
90
- *
91
- * This function actually in work the reverse, it checks if the property
92
- * isn't private nor protected.
93
- *
94
- * It returns true if the property has no modifiers since no keyword
95
- * has been set on the property.
96
- *
97
- * Example
98
- * ```
99
- * class Human {
100
- * private age = 22 // Return false
101
- * protected familyName = "Doe" // Return false
102
- *
103
- * @field
104
- * name = "John" // Return true
105
- *
106
- * city = "Paris" // Return false because there's no decorator
107
- * }
108
- * ```
109
- *
110
- * @param property The property to check on.
111
- */
112
- export function isPublicProperty(property) {
113
- if (!isField(property)) {
114
- return false;
115
- }
116
- const modifiers = ts.getModifiers(property);
117
- if (!modifiers) {
118
- return true;
119
- }
120
- return !modifiers.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword ||
121
- modifier.kind === ts.SyntaxKind.ProtectedKeyword);
122
- }
123
- /**
124
- * Return true if the parameter is optional.
125
- *
126
- * This only means optionals marked with `?`, or "nullable" types defined
127
- * with `| null`, to match the API's meaning of "optional".
128
- *
129
- * If there's a default value, its expression is returned in the result.
130
- *
131
- * @param param The param to check.
132
- */
133
- export function isOptional(param) {
134
- const result = { optional: false };
135
- const declarations = param.getDeclarations();
136
- // Only check if the parameters actually have declarations
137
- if (declarations && declarations.length > 0) {
138
- const parameterDeclaration = declarations[0];
139
- // Convert the symbol declaration into Parameter
140
- if (ts.isParameter(parameterDeclaration)) {
141
- // Check for ? notation
142
- result.optional = parameterDeclaration.questionToken !== undefined;
143
- // Check for `<xx>|null` notation to see if the field is nullable
144
- if (parameterDeclaration.type) {
145
- if (ts.isUnionTypeNode(parameterDeclaration.type)) {
146
- for (const _type of parameterDeclaration.type.types) {
147
- if (_type.getText() === "null") {
148
- result.optional = true;
149
- break;
150
- }
151
- }
152
- }
153
- }
154
- if (parameterDeclaration.initializer !== undefined) {
155
- result.defaultValue = formatDefaultValue(parameterDeclaration.initializer.getText());
156
- }
157
- }
158
- }
159
- return result;
160
- }
161
- export function isVariadic(param) {
162
- const declarations = param.getDeclarations();
163
- // Only check if the parameters actually have declarations
164
- if (declarations && declarations.length > 0) {
165
- const parameterDeclaration = declarations[0];
166
- // Convert the symbol declaration into Parameter
167
- if (ts.isParameter(parameterDeclaration)) {
168
- return parameterDeclaration.dotDotDotToken !== undefined;
169
- }
170
- }
171
- return false;
172
- }
173
- function formatDefaultValue(value) {
174
- const isSingleQuoteString = () => value.startsWith("'") && value.endsWith("'");
175
- if (isSingleQuoteString()) {
176
- return `"${value.slice(1, value.length - 1)}"`;
177
- }
178
- return value;
179
- }
180
47
  /**
181
48
  * Convert a typename into a Dagger Typedef using dynamic typing.
182
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../provisioning/bin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAgB/C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAiB,MAAM,iBAAiB,CAAA;AAMxE;;GAEG;AACH,qBAAa,GAAI,YAAW,UAAU;IACpC,OAAO,CAAC,WAAW,CAAC,CAAmB;IAEvC,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,UAAU,CAAC,CAAQ;IAE3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAKxB;IAED,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAW;gBAErC,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAKjD,IAAI,IAAI,MAAM;IAId,IAAI,UAAU,IAAI,iBAAiB,GAAG,SAAS,CAE9C;IAEK,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;YAgB1C,WAAW;IAgEzB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;OAGG;YACW,gBAAgB;YAqEhB,iBAAiB;IA2BzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAU5B;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO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;OAOG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc;YAOR,WAAW;YAkBX,gBAAgB;YAWhB,cAAc;IA4C5B;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD;AAGD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE1D"}
@@ -68,7 +68,9 @@ export class Bin {
68
68
  }
69
69
  catch (e) {
70
70
  fs.rmSync(tmpBinDownloadDir, { recursive: true });
71
- throw new InitEngineSessionBinaryError(`failed to download dagger cli binary: ${e}`, { cause: e });
71
+ throw new InitEngineSessionBinaryError(`failed to download dagger cli binary: ${e}`, {
72
+ cause: e,
73
+ });
72
74
  }
73
75
  // Remove all temporary binary files
74
76
  // Ignore current dagger cli or other files that have not be
@@ -158,7 +160,9 @@ export class Bin {
158
160
  this.readConnectParams(stdoutReader),
159
161
  new Promise((_, reject) => {
160
162
  setTimeout(() => {
161
- reject(new EngineSessionConnectionTimeoutError("Engine connection timeout", { timeOutDuration }));
163
+ reject(new EngineSessionConnectionTimeoutError("Engine connection timeout", {
164
+ timeOutDuration,
165
+ }));
162
166
  }, timeOutDuration).unref(); // long timeout to account for extensions, though that should be optimized in future
163
167
  }),
164
168
  ]));
@@ -169,12 +173,14 @@ export class Bin {
169
173
  }
170
174
  async readConnectParams(stdoutReader) {
171
175
  for await (const line of stdoutReader) {
172
- // parse the the line as json-encoded connect params
176
+ // parse the line as json-encoded connect params
173
177
  const connectParams = JSON.parse(line);
174
178
  if (connectParams.port && connectParams.session_token) {
175
179
  return connectParams;
176
180
  }
177
- throw new EngineSessionConnectParamsParseError(`invalid connect params: ${line}`, { parsedLine: line });
181
+ throw new EngineSessionConnectParamsParseError(`invalid connect params: ${line}`, {
182
+ parsedLine: line,
183
+ });
178
184
  }
179
185
  // Need to find a better way to handle this part
180
186
  // At this stage something wrong happened, `for await` didn't return anything
@@ -1,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.10.1";
1
+ export declare const CLI_VERSION = "0.10.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.10.1";
2
+ export const CLI_VERSION = "0.10.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dagger.io/dagger",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "author": "hello@dagger.io",
5
5
  "license": "Apache-2.0",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,10 @@
32
32
  "scripts": {
33
33
  "build": "tsc",
34
34
  "watch": "tsc -w",
35
- "test": "mocha",
35
+ "test": "yarn run test:node && yarn run test:bun",
36
+ "test:bun": "bun run --bun mocha",
37
+ "test:node": "mocha",
38
+ "test:generate-scan": "tsx ./introspector/test/testdata/generate_expected_scan.ts",
36
39
  "lint": "yarn eslint --max-warnings=0 .",
37
40
  "fmt": "yarn eslint --fix .",
38
41
  "docs:lint": "yarn eslint -c .eslintrc-docs.cjs --max-warnings=0 --resolve-plugins-relative-to=./ --ext=.js,.ts,.mjs,.mts ../../docs/current_docs",
@@ -1,24 +0,0 @@
1
- /**
2
- * Metadata of a variable (called symbol in the TypeScript compiler)
3
- */
4
- export type SymbolMetadata = {
5
- name: string;
6
- description: string;
7
- typeName: string;
8
- };
9
- /**
10
- * Metadata of a function or method parameter.
11
- */
12
- export type ParamMetadata = SymbolMetadata & {
13
- optional: boolean;
14
- defaultValue?: string;
15
- isVariadic: boolean;
16
- };
17
- /**
18
- * Metadata of a function's signature.
19
- */
20
- export type SignatureMetadata = {
21
- params: ParamMetadata[];
22
- returnType: string;
23
- };
24
- //# sourceMappingURL=metadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}