@dagger.io/dagger 0.3.2 → 0.3.4

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.
@@ -5,6 +5,7 @@ export { EngineSessionConnectParamsParseError } from "./EngineSessionConnectPara
5
5
  export { GraphQLRequestError } from "./GraphQLRequestError.js";
6
6
  export { InitEngineSessionBinaryError } from "./InitEngineSessionBinaryError.js";
7
7
  export { TooManyNestedObjectsError } from "./TooManyNestedObjectsError.js";
8
- export { EngineSessionEOFError } from "./EngineSessionEOFErrorOptions.js";
8
+ export { EngineSessionError } from "./EngineSessionErrorOptions.js";
9
9
  export { EngineSessionConnectionTimeoutError } from "./EngineSessionConnectionTimeoutError.js";
10
+ export { NotAwaitedRequestError } from "./NotAwaitedRequestError.js";
10
11
  export { ERROR_CODES } from "./errors-codes.js";
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../connect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,MAAM,MAAM,qBAAqB,CAAA;AAGxC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAA;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAC3B,EAAE,EAAE,WAAW,EACf,MAAM,GAAE,WAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CAuCf"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../connect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,MAAM,MAAM,qBAAqB,CAAA;AAGxC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAA;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAC3B,EAAE,EAAE,WAAW,EACf,MAAM,GAAE,WAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
package/dist/connect.js CHANGED
@@ -16,9 +16,6 @@ import { Bin, CLI_VERSION } from "./provisioning/index.js";
16
16
  */
17
17
  export function connect(cb, config = {}) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- // Create config with default values that may be overridden
20
- // by config if values are set.
21
- const _config = Object.assign({ Workdir: process.env["DAGGER_WORKDIR"] || process.cwd(), ConfigPath: process.env["DAGGER_CONFIG"] || "./dagger.json" }, config);
22
19
  let client;
23
20
  let close = null;
24
21
  // Prefer DAGGER_SESSION_PORT if set
@@ -38,7 +35,7 @@ export function connect(cb, config = {}) {
38
35
  // downloading the CLI and using that as the bin.
39
36
  const cliBin = process.env["_EXPERIMENTAL_DAGGER_CLI_BIN"];
40
37
  const engineConn = new Bin(cliBin, CLI_VERSION);
41
- client = yield engineConn.Connect(_config);
38
+ client = yield engineConn.Connect(config);
42
39
  close = () => engineConn.Close();
43
40
  }
44
41
  yield cb(client).finally(() => __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../provisioning/bin.ts"],"names":[],"mappings":"AAYA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAQzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAMzD;;GAEG;AACH,qBAAa,GAAI,YAAW,UAAU;IACpC,OAAO,CAAC,UAAU,CAAC,CAAmB;IAEtC,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;IAIR,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;YAOnC,WAAW;IAgEzB;;;OAGG;YACW,gBAAgB;YAgDhB,iBAAiB;IAmBzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;;;;;;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;IAatB,OAAO,CAAC,aAAa;IASrB,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"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../provisioning/bin.ts"],"names":[],"mappings":"AAYA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAQzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAMzD;;GAEG;AACH,qBAAa,GAAI,YAAW,UAAU;IACpC,OAAO,CAAC,UAAU,CAAC,CAAmB;IAEtC,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;IAIR,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;YAOnC,WAAW;IAgEzB;;;OAGG;YACW,gBAAgB;YA+ChB,iBAAiB;IA2BzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;;;;;;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;IAatB,OAAO,CAAC,aAAa;IASrB,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"}
@@ -26,7 +26,7 @@ import * as process from "process";
26
26
  import readline from "readline";
27
27
  import * as tar from "tar";
28
28
  import Client from "../api/client.gen.js";
29
- import { EngineSessionConnectionTimeoutError, EngineSessionConnectParamsParseError, EngineSessionEOFError, InitEngineSessionBinaryError, } from "../common/errors/index.js";
29
+ import { EngineSessionConnectionTimeoutError, EngineSessionConnectParamsParseError, EngineSessionError, InitEngineSessionBinaryError, } from "../common/errors/index.js";
30
30
  const CLI_HOST = "dl.dagger.io";
31
31
  let OVERRIDE_CLI_URL;
32
32
  let OVERRIDE_CHECKSUMS_URL;
@@ -103,6 +103,7 @@ export class Bin {
103
103
  * target this engine.
104
104
  */
105
105
  runEngineSession(binPath, opts) {
106
+ var _a;
106
107
  return __awaiter(this, void 0, void 0, function* () {
107
108
  const args = [binPath, "session"];
108
109
  if (opts.Workdir) {
@@ -112,14 +113,13 @@ export class Bin {
112
113
  args.push("--project", opts.Project);
113
114
  }
114
115
  this.subProcess = execaCommand(args.join(" "), {
115
- stderr: opts.LogOutput || "ignore",
116
+ stderr: opts.LogOutput || "pipe",
116
117
  reject: true,
117
118
  // Kill the process if parent exit.
118
119
  cleanup: true,
119
120
  });
120
121
  const stdoutReader = readline.createInterface({
121
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
122
- input: this.subProcess.stdout,
122
+ input: (_a = this.subProcess) === null || _a === void 0 ? void 0 : _a.stdout,
123
123
  });
124
124
  const timeOutDuration = 300000;
125
125
  const connectParams = (yield Promise.race([
@@ -139,6 +139,7 @@ export class Bin {
139
139
  readConnectParams(stdoutReader) {
140
140
  var _a, stdoutReader_1, stdoutReader_1_1;
141
141
  var _b, e_1, _c, _d;
142
+ var _e;
142
143
  return __awaiter(this, void 0, void 0, function* () {
143
144
  try {
144
145
  for (_a = true, stdoutReader_1 = __asyncValues(stdoutReader); stdoutReader_1_1 = yield stdoutReader_1.next(), _b = stdoutReader_1_1.done, !_b;) {
@@ -165,7 +166,17 @@ export class Bin {
165
166
  }
166
167
  finally { if (e_1) throw e_1.error; }
167
168
  }
168
- throw new EngineSessionEOFError("No line was found to parse the engine connect params");
169
+ // Need to find a better way to handle this part
170
+ // At this stage something wrong happened, `for await` didn't return anything
171
+ // await the subprocess to catch the error
172
+ try {
173
+ yield this.subProcess;
174
+ }
175
+ catch (_f) {
176
+ (_e = this.subProcess) === null || _e === void 0 ? void 0 : _e.catch((e) => {
177
+ throw new EngineSessionError(e.stderr);
178
+ });
179
+ }
169
180
  });
170
181
  }
171
182
  Close() {
@@ -1,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.3.10";
1
+ export declare const CLI_VERSION = "0.3.12";
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.3.10";
2
+ export const CLI_VERSION = "0.3.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dagger.io/dagger",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "author": "hello@dagger.io",
5
5
  "license": "Apache-2.0",
6
6
  "types": "./dist/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "@lifeomic/axios-fetch": "^3.0.1",
20
20
  "adm-zip": "^0.5.10",
21
21
  "env-paths": "^3.0.0",
22
- "execa": "^6.1.0",
22
+ "execa": "^7.0.0",
23
23
  "graphql": "^16.5.0",
24
24
  "graphql-request": "^5.1.0",
25
25
  "graphql-tag": "^2.12.6",
@@ -40,14 +40,14 @@
40
40
  "@types/mocha": "latest",
41
41
  "@types/node": "~16",
42
42
  "@types/tar": "^6.1.3",
43
- "@typescript-eslint/eslint-plugin": "^5.48.2",
44
- "@typescript-eslint/parser": "^5.49.0",
45
- "eslint": "^8.32.0",
43
+ "@typescript-eslint/eslint-plugin": "^5.52.0",
44
+ "@typescript-eslint/parser": "^5.52.0",
45
+ "eslint": "^8.34.0",
46
46
  "eslint-config-prettier": "^8.6.0",
47
47
  "eslint-plugin-prettier": "^4.2.1",
48
48
  "mocha": "^10.2.0",
49
- "prettier": "^2.8.3",
49
+ "prettier": "^2.8.4",
50
50
  "ts-node": "^10.9.1",
51
- "typescript": "^4.9.4"
51
+ "typescript": "^4.9.5"
52
52
  }
53
53
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"EngineSessionEOFErrorOptions.d.ts","sourceRoot":"","sources":["../../../common/errors/EngineSessionEOFErrorOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAG3E,KAAK,4BAA4B,GAAG,qBAAqB,CAAA;AAEzD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,IAAI,0BAAoC;IACxC,IAAI,SAAoC;IAExC;;OAEG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B;CAGpE"}