@codebucket/puppet-master 1.0.2 → 1.0.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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/src/index.ts +3 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,KAAK,IAAI,GAAG;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,KAAK,aAAa,GAAG;IACjB,aAAc,CAAC,EAAE,GAAG,CAAC;IACrB,WAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAW,CAAC,EAAE,GAAG,CAAC;IAClB,kBAAmB,CAAC,EAAE,GAAG,CAAC;IAC1B,OAAO,EAAG,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAElB,IAAI,EAAE,IAAI;IAShB,GAAG,CAAC,IAAI,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,KAAK,IAAI,GAAG;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,KAAK,aAAa,GAAG;IACjB,aAAc,CAAC,EAAE,GAAG,CAAC;IACrB,WAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAW,CAAC,EAAE,GAAG,CAAC;IAClB,kBAAmB,CAAC,EAAE,GAAG,CAAC;IAC1B,OAAO,EAAG,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAElB,IAAI,EAAE,IAAI;IAShB,GAAG,CAAC,IAAI,EAAE,aAAa;CAchC"}
|
package/dist/index.js
CHANGED
|
@@ -43,14 +43,15 @@ class PuppetMaster {
|
|
|
43
43
|
}
|
|
44
44
|
async pdf(opts) {
|
|
45
45
|
try {
|
|
46
|
-
const request = await this.axios.post("/pdf", {
|
|
46
|
+
const request = await this.axios.post("/pdf", { task: opts }, {
|
|
47
47
|
responseType: "stream"
|
|
48
48
|
});
|
|
49
49
|
await pipeline(request.data, fs_1.default.createWriteStream(opts.pdfPath));
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
52
|
if (err instanceof axios_1.AxiosError) {
|
|
53
|
-
|
|
53
|
+
console.log(err.response?.data);
|
|
54
|
+
throw new Error(err.response?.data?.message);
|
|
54
55
|
}
|
|
55
56
|
throw err;
|
|
56
57
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -34,13 +34,14 @@ export class PuppetMaster {
|
|
|
34
34
|
|
|
35
35
|
async pdf(opts: puppeteerOpts) {
|
|
36
36
|
try {
|
|
37
|
-
const request = await this.axios.post("/pdf", {
|
|
37
|
+
const request = await this.axios.post("/pdf", {task:opts}, {
|
|
38
38
|
responseType: "stream"
|
|
39
39
|
});
|
|
40
40
|
await pipeline(request.data, fs.createWriteStream(opts.pdfPath));
|
|
41
41
|
} catch (err) {
|
|
42
42
|
if (err instanceof AxiosError) {
|
|
43
|
-
|
|
43
|
+
console.log(err.response?.data);
|
|
44
|
+
throw new Error(err.response?.data?.message);
|
|
44
45
|
}
|
|
45
46
|
throw err;
|
|
46
47
|
}
|