@skillful-ai/piece-latex-to-pdf 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillful-ai/piece-latex-to-pdf",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/index.js CHANGED
@@ -5,15 +5,16 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
5
  const shared_1 = require("@activepieces/shared");
6
6
  const auth_1 = require("./lib/auth");
7
7
  const compile_latex_1 = require("./lib/actions/compile-latex");
8
+ const compile_zip_1 = require("./lib/actions/compile-zip");
8
9
  exports.latexToPdf = (0, pieces_framework_1.createPiece)({
9
10
  displayName: "LaTeX to PDF",
10
- description: "Compile LaTeX documents to PDF using a cloud compilation service. Supports pdflatex and xelatex compilers with multiple output formats.",
11
+ description: "Compile LaTeX documents to PDF using a cloud compilation service. Supports pdflatex and xelatex compilers with multiple output formats. Can compile single .tex files or ZIP projects with images.",
11
12
  auth: auth_1.latexToPdfAuth,
12
13
  minimumSupportedRelease: "0.36.1",
13
14
  logoUrl: "https://cdn.activepieces.com/pieces/latex.png",
14
15
  authors: ["skillful-ai"],
15
16
  categories: [shared_1.PieceCategory.CORE],
16
- actions: [compile_latex_1.compileLatex],
17
+ actions: [compile_latex_1.compileLatex, compile_zip_1.compileZip],
17
18
  triggers: [],
18
19
  });
19
20
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/latex-to-pdf/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,qCAA4C;AAC5C,+DAA2D;AAE9C,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yIAAyI;IACtJ,IAAI,EAAE,qBAAc;IACpB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,4BAAY,CAAC;IACvB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/latex-to-pdf/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,qCAA4C;AAC5C,+DAA2D;AAC3D,2DAAuD;AAE1C,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,oMAAoM;IACjN,IAAI,EAAE,qBAAc;IACpB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,4BAAY,EAAE,wBAAU,CAAC;IACnC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const compileZip: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ serviceUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
4
+ }>, {
5
+ zipFile: import("@activepieces/pieces-framework").FileProperty<true>;
6
+ mainFile: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ compiler: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ outputFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
9
+ }>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compileZip = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../auth");
7
+ const common_1 = require("../common");
8
+ exports.compileZip = (0, pieces_framework_1.createAction)({
9
+ name: "compile_zip",
10
+ displayName: "Compile LaTeX Project (ZIP)",
11
+ description: "Compile a ZIP file containing LaTeX source and images to PDF. The ZIP must contain a main.tex file (or specify the main file path).",
12
+ auth: auth_1.latexToPdfAuth,
13
+ props: {
14
+ zipFile: pieces_framework_1.Property.File({
15
+ displayName: "ZIP File",
16
+ description: "A ZIP archive containing main.tex and any images/assets. Can be created using 'Files Helper → Zip Files' action.",
17
+ required: true,
18
+ }),
19
+ mainFile: pieces_framework_1.Property.ShortText({
20
+ displayName: "Main File",
21
+ description: "Path to the main .tex file inside the ZIP (relative to ZIP root)",
22
+ required: true,
23
+ defaultValue: "main.tex",
24
+ }),
25
+ compiler: pieces_framework_1.Property.StaticDropdown({
26
+ displayName: "Compiler",
27
+ description: "LaTeX compiler to use for compilation",
28
+ required: true,
29
+ defaultValue: "xelatex",
30
+ options: {
31
+ options: [
32
+ { label: "XeLaTeX (recommended for Unicode/fonts)", value: "xelatex" },
33
+ { label: "pdfLaTeX (traditional)", value: "pdflatex" },
34
+ ],
35
+ },
36
+ }),
37
+ outputFormat: pieces_framework_1.Property.StaticDropdown({
38
+ displayName: "Output Format",
39
+ description: "How to return the compiled PDF",
40
+ required: true,
41
+ defaultValue: "url",
42
+ options: {
43
+ options: [
44
+ { label: "URL (presigned download link)", value: "url" },
45
+ { label: "Base64 (embedded in response)", value: "base64" },
46
+ ],
47
+ },
48
+ }),
49
+ },
50
+ run(context) {
51
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+ var _a, _b, _c, _d, _e, _f, _g;
53
+ const { zipFile, mainFile, compiler, outputFormat } = context.propsValue;
54
+ const auth = context.auth;
55
+ // Validate inputs
56
+ if (!zipFile) {
57
+ return {
58
+ success: false,
59
+ error: "ZIP file is required",
60
+ };
61
+ }
62
+ if (!(mainFile === null || mainFile === void 0 ? void 0 : mainFile.trim())) {
63
+ return {
64
+ success: false,
65
+ error: "Main file path is required",
66
+ };
67
+ }
68
+ try {
69
+ const serviceUrl = (0, common_1.getServiceUrl)(auth);
70
+ const headers = (0, common_1.buildHeaders)(auth);
71
+ // zipFile.base64 contains the Base64-encoded content
72
+ // zipFile.filename contains the original filename
73
+ const fileContent = zipFile.base64;
74
+ const filename = ((_a = zipFile.filename) === null || _a === void 0 ? void 0 : _a.endsWith(".zip"))
75
+ ? zipFile.filename
76
+ : "project.zip";
77
+ // 1. Submit for compilation
78
+ const submitResponse = yield (0, common_1.submitCompilation)(serviceUrl, {
79
+ file_content: fileContent,
80
+ filename: filename,
81
+ main_file: mainFile.trim(),
82
+ compiler: compiler,
83
+ output_format: outputFormat,
84
+ }, headers);
85
+ // 2. Poll until completion
86
+ const result = yield (0, common_1.pollForCompletion)(serviceUrl, submitResponse.job_id, headers);
87
+ // 3. Process result
88
+ if (result.status === "failed") {
89
+ return {
90
+ success: false,
91
+ error: result.error_message || result.message || "Compilation failed",
92
+ jobId: result.job_id,
93
+ logUrl: (_b = result.result) === null || _b === void 0 ? void 0 : _b.log_url,
94
+ };
95
+ }
96
+ // Success
97
+ return {
98
+ success: true,
99
+ jobId: result.job_id,
100
+ pdfUrl: (_c = result.result) === null || _c === void 0 ? void 0 : _c.pdf_url,
101
+ pdfBase64: (_d = result.result) === null || _d === void 0 ? void 0 : _d.pdf_base64,
102
+ logUrl: (_e = result.result) === null || _e === void 0 ? void 0 : _e.log_url,
103
+ durationMs: (_f = result.result) === null || _f === void 0 ? void 0 : _f.duration_ms,
104
+ pdfSizeBytes: (_g = result.result) === null || _g === void 0 ? void 0 : _g.pdf_size_bytes,
105
+ compiler,
106
+ mainFile: mainFile.trim(),
107
+ };
108
+ }
109
+ catch (error) {
110
+ const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
111
+ return {
112
+ success: false,
113
+ error: errorMessage,
114
+ };
115
+ }
116
+ });
117
+ },
118
+ });
119
+ //# sourceMappingURL=compile-zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-zip.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/latex-to-pdf/src/lib/actions/compile-zip.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAyD;AACzD,sCAOmB;AAEN,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,qIAAqI;IAClJ,IAAI,EAAE,qBAAc;IACpB,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACrB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,kHAAkH;YAC/H,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,kEAAkE;YAC/E,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,UAAU;SACzB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,SAAS;YACvB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,yCAAyC,EAAE,KAAK,EAAE,SAAS,EAAE;oBACtE,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,UAAU,EAAE;iBACvD;aACF;SACF,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACpC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gB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