@pittica/drive-folder-qrcode 1.4.1 → 2.0.0

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/LICENSE CHANGED
@@ -186,7 +186,7 @@ Apache License
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2024 Pittica S.r.l.
189
+ Copyright 2024-2025 Pittica S.r.l.
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -12,11 +12,33 @@ Creates QR codes from Google Drive folder names.
12
12
  - Google Drive API v3 enabled on Service Account.
13
13
  - A Service Account and Drives shared with it.
14
14
 
15
+ ## Environment Variables
16
+
17
+ | Variable | Type | Default | Notes |
18
+ |----------------------------------|---------|---------|--------------------------------------------------|
19
+ | GOOGLE_APPLICATION_CREDENTIALS | String | null | Google JSON credentials default file path. |
20
+ | DRIVE_QRCODER_GOOGLE_CREDENTIALS | String | null | Google JSON credentials content. |
21
+ | DRIVE_QRCODER_SOURCE | String | null | Google Drive source folder ID. |
22
+ | DRIVE_QRCODER_DESTINATION_DRIVE | String | null | Google Drive destination folder ID. |
23
+ | DRIVE_QRCODER_DESTINATION_LOCAL | String | null | Local destination folder path. |
24
+ | DRIVE_QRCODER_SIZE | Integer | 300 | QR code image size. |
25
+ | DRIVE_QRCODER_MARGIN | Integer | 15 | Image margin size. |
26
+ | DRIVE_QRCODER_ROUNDED | Boolean | False | Indicates whether the image has rounde borders. |
27
+ | DRIVE_QRCODER_FORMAT | String | PDF | Output format. Possibile formats "SVG" or "PDF". |
28
+ | DRIVE_QRCODER_COLOR_FORE | String | #000000 | Foreground color. |
29
+ | DRIVE_QRCODER_COLOR_DOTS | String | #000000 | QR code dots color. |
30
+ | DRIVE_QRCODER_COLOR_SQUARE | String | #000000 | Inner square color. |
31
+ | DRIVE_QRCODER_COLOR_BACKGROUND | String | #ffffff | Background color. |
32
+ | DRIVE_QRCODER_COLOR_BORDER | String | #ffffff | Border color. |
33
+ | DRIVE_QRCODER_FONT_COLOR | String | #000000 | Font color. |
34
+ | DRIVE_QRCODER_FONT_PATH | String | null | Font file path. |
35
+ | DRIVE_QRCODER_FONT_FAMILY | String | Arial | Font family name. |
36
+
15
37
  ## Copyright
16
38
 
17
39
  This project is licensed.
18
40
 
19
- Copyright 2024 **Pittica S.r.l.**.
41
+ Copyright 2024-2025 **Pittica S.r.l.**.
20
42
 
21
43
  - [pittica.com](https://pittica.com)
22
44
  - [info@pittica.com](mailto:info@pittica.com)
@@ -5,7 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _googleapis = require("googleapis");
8
- // Copyright 2024 Pittica S.r.l.
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
11
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Copyright 2024-2025 Pittica S.r.l.
9
20
  //
10
21
  // Licensed under the Apache License, Version 2.0 (the "License");
11
22
  // you may not use this file except in compliance with the License.
@@ -18,13 +29,387 @@ var _googleapis = require("googleapis");
18
29
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
30
  // See the License for the specific language governing permissions and
20
31
  // limitations under the License.
21
- var _default = exports["default"] = function _default() {
22
- var credentials = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
23
- return _googleapis.google.drive({
24
- version: "v3",
25
- auth: new _googleapis.google.auth.GoogleAuth({
26
- keyFile: credentials || process.env.GOOGLE_APPLICATION_CREDENTIALS,
32
+ /**
33
+ * Google Drive client.
34
+ */
35
+ var Client = exports["default"] = /*#__PURE__*/function () {
36
+ /**
37
+ * Creates a new instance of the Client class.
38
+ *
39
+ * @param {string|object|null} credentials Credentials object or JSON file path.
40
+ */
41
+ function Client() {
42
+ var credentials = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
43
+ _classCallCheck(this, Client);
44
+ _defineProperty(this, "_client", null);
45
+ var payload = {
27
46
  scopes: ["https://www.googleapis.com/auth/drive"]
28
- })
29
- });
30
- };
47
+ };
48
+ if (_typeof(credentials) === "object") {
49
+ payload.credentials = credentials;
50
+ } else {
51
+ if (_fs["default"].existsSync(credentials)) {
52
+ payload.credentials = require(credentials);
53
+ } else {
54
+ if (process.env.DRIVE_QRCODER_GOOGLE_CREDENTIALS) {
55
+ payload.credentials = JSON.parse(process.env.DRIVE_QRCODER_GOOGLE_CREDENTIALS);
56
+ } else {
57
+ payload.keyFile = process.env.GOOGLE_APPLICATION_CREDENTIALS;
58
+ }
59
+ }
60
+ }
61
+ this._client = _googleapis.google.drive({
62
+ version: "v3",
63
+ auth: new _googleapis.google.auth.GoogleAuth(payload)
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Lists all subfolders in the folder with the given ID.
69
+ *
70
+ * @param {string} id Folder ID.
71
+ * @returns {Array} All subfolders in the folder with the given ID.
72
+ */
73
+ return _createClass(Client, [{
74
+ key: "list",
75
+ value: (function () {
76
+ var _list = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
77
+ var files, token, results;
78
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
79
+ while (1) switch (_context.prev = _context.next) {
80
+ case 0:
81
+ files = [];
82
+ token = null;
83
+ case 2:
84
+ if (!true) {
85
+ _context.next = 18;
86
+ break;
87
+ }
88
+ _context.next = 5;
89
+ return this.paginator(id, token);
90
+ case 5:
91
+ results = _context.sent;
92
+ if (!results) {
93
+ _context.next = 15;
94
+ break;
95
+ }
96
+ results.files.forEach(function (file) {
97
+ return files.push(file);
98
+ });
99
+ if (results.nextPageToken) {
100
+ _context.next = 12;
101
+ break;
102
+ }
103
+ return _context.abrupt("break", 18);
104
+ case 12:
105
+ token = results.nextPageToken;
106
+ case 13:
107
+ _context.next = 16;
108
+ break;
109
+ case 15:
110
+ return _context.abrupt("break", 18);
111
+ case 16:
112
+ _context.next = 2;
113
+ break;
114
+ case 18:
115
+ return _context.abrupt("return", files);
116
+ case 19:
117
+ case "end":
118
+ return _context.stop();
119
+ }
120
+ }, _callee, this);
121
+ }));
122
+ function list(_x) {
123
+ return _list.apply(this, arguments);
124
+ }
125
+ return list;
126
+ }()
127
+ /**
128
+ * Lists all subfolders in the folder with the given ID by page.
129
+ *
130
+ * @param {string} id Folder ID.
131
+ * @param {string} pageToken Page token.
132
+ * @returns {Array} All subfolders in the folder with the given ID.
133
+ */
134
+ )
135
+ }, {
136
+ key: "paginator",
137
+ value: (function () {
138
+ var _paginator = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id) {
139
+ var pageToken,
140
+ _args2 = arguments;
141
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
142
+ while (1) switch (_context2.prev = _context2.next) {
143
+ case 0:
144
+ pageToken = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
145
+ _context2.next = 3;
146
+ return this._client.files.list({
147
+ q: "'".concat(id, "' in parents AND mimeType = 'application/vnd.google-apps.folder' AND trashed = false"),
148
+ pageToken: pageToken,
149
+ pageSize: 15,
150
+ spaces: "drive",
151
+ fields: "nextPageToken, files(id, name, webViewLink)",
152
+ includeItemsFromAllDrives: true,
153
+ supportsAllDrives: true
154
+ }).then(function (_ref) {
155
+ var data = _ref.data;
156
+ return data;
157
+ })["catch"](function (_ref2) {
158
+ var code = _ref2.code,
159
+ errors = _ref2.errors;
160
+ if (errors) {
161
+ errors.forEach(function (_ref3) {
162
+ var message = _ref3.message;
163
+ return console.error(code, message);
164
+ });
165
+ } else {
166
+ console.error(code);
167
+ }
168
+ return null;
169
+ });
170
+ case 3:
171
+ return _context2.abrupt("return", _context2.sent);
172
+ case 4:
173
+ case "end":
174
+ return _context2.stop();
175
+ }
176
+ }, _callee2, this);
177
+ }));
178
+ function paginator(_x2) {
179
+ return _paginator.apply(this, arguments);
180
+ }
181
+ return paginator;
182
+ }()
183
+ /**
184
+ * Creates a file in the given Drive folder.
185
+ *
186
+ * @param {Drive} client Google Drive client instance.
187
+ * @param {string} folder Folder ID.
188
+ * @param {string} content File content.
189
+ * @param {string} name File name.
190
+ * @param {string} mimeType MIME type in "type/sub" format.
191
+ * @returns {File} The created file.
192
+ */
193
+ )
194
+ }, {
195
+ key: "createFile",
196
+ value: (function () {
197
+ var _createFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(folder, content, name, mimeType) {
198
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
199
+ while (1) switch (_context3.prev = _context3.next) {
200
+ case 0:
201
+ _context3.next = 2;
202
+ return this._client.files.create({
203
+ requestBody: {
204
+ name: name,
205
+ parents: [folder]
206
+ },
207
+ media: {
208
+ mimeType: mimeType,
209
+ body: content
210
+ },
211
+ fields: ["id", "name"],
212
+ uploadType: "multipart",
213
+ supportsAllDrives: true
214
+ }).then(function (_ref4) {
215
+ var data = _ref4.data,
216
+ status = _ref4.status;
217
+ if (status >= 200 && status < 300) {
218
+ console.info("QR code for \"".concat(folder, "\", \"").concat(data.id, "\", created."));
219
+ } else {
220
+ console.error("Error creating QR code for \"".concat(folder, "\"."));
221
+ }
222
+ return data;
223
+ })["catch"](function (_ref5) {
224
+ var code = _ref5.code,
225
+ errors = _ref5.errors;
226
+ errors.forEach(function (_ref6) {
227
+ var message = _ref6.message,
228
+ reason = _ref6.reason;
229
+ return console.error("".concat(code, " | ").concat(reason, " | ").concat(message));
230
+ });
231
+ console.error("Error creating QR code for \"".concat(folder, "\"."));
232
+ });
233
+ case 2:
234
+ return _context3.abrupt("return", _context3.sent);
235
+ case 3:
236
+ case "end":
237
+ return _context3.stop();
238
+ }
239
+ }, _callee3, this);
240
+ }));
241
+ function createFile(_x3, _x4, _x5, _x6) {
242
+ return _createFile.apply(this, arguments);
243
+ }
244
+ return createFile;
245
+ }()
246
+ /**
247
+ * Creates a file in the given Drive folder, whether it doesn't exist.
248
+ *
249
+ * @param {string} folder Folder ID.
250
+ * @param {string} content File content.
251
+ * @param {string} name File name.
252
+ * @param {string} mimeType MIME type in "type/sub" format.
253
+ * @returns {File} The created file.
254
+ */
255
+ )
256
+ }, {
257
+ key: "uploadFile",
258
+ value: (function () {
259
+ var _uploadFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(folder, content, name, mimeType) {
260
+ var _this = this;
261
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
262
+ while (1) switch (_context6.prev = _context6.next) {
263
+ case 0:
264
+ _context6.next = 2;
265
+ return this._client.files.list({
266
+ q: "'".concat(folder, "' in parents AND mimeType = '").concat(mimeType, "' AND name = '").concat(name, "' AND trashed = false"),
267
+ pageSize: 1,
268
+ fields: "files(id, name, trashed, webViewLink)",
269
+ spaces: "drive",
270
+ includeItemsFromAllDrives: true,
271
+ supportsAllDrives: true
272
+ }).then(/*#__PURE__*/function () {
273
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref7) {
274
+ var files;
275
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
276
+ while (1) switch (_context4.prev = _context4.next) {
277
+ case 0:
278
+ files = _ref7.data.files;
279
+ if (!(files.length > 0)) {
280
+ _context4.next = 8;
281
+ break;
282
+ }
283
+ console.info("QR code for \"".concat(folder, "\", \"").concat(files[0].name, "\", already exists."), files[0].webViewLink);
284
+ _context4.next = 5;
285
+ return _this._client.files.get({
286
+ fileId: files[0].id,
287
+ alt: "media",
288
+ supportsAllDrives: true
289
+ });
290
+ case 5:
291
+ return _context4.abrupt("return", _context4.sent);
292
+ case 8:
293
+ _context4.next = 10;
294
+ return _this.createFile(folder, content, name, mimeType);
295
+ case 10:
296
+ return _context4.abrupt("return", _context4.sent);
297
+ case 11:
298
+ case "end":
299
+ return _context4.stop();
300
+ }
301
+ }, _callee4);
302
+ }));
303
+ return function (_x1) {
304
+ return _ref8.apply(this, arguments);
305
+ };
306
+ }())["catch"](/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
307
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
308
+ while (1) switch (_context5.prev = _context5.next) {
309
+ case 0:
310
+ _context5.next = 2;
311
+ return _this.createFile(folder, content, name, mimeType);
312
+ case 2:
313
+ return _context5.abrupt("return", _context5.sent);
314
+ case 3:
315
+ case "end":
316
+ return _context5.stop();
317
+ }
318
+ }, _callee5);
319
+ })));
320
+ case 2:
321
+ return _context6.abrupt("return", _context6.sent);
322
+ case 3:
323
+ case "end":
324
+ return _context6.stop();
325
+ }
326
+ }, _callee6, this);
327
+ }));
328
+ function uploadFile(_x7, _x8, _x9, _x0) {
329
+ return _uploadFile.apply(this, arguments);
330
+ }
331
+ return uploadFile;
332
+ }()
333
+ /**
334
+ * Determines whether the given file name exists in the given folder.
335
+ *
336
+ * @param {string} folder Folder ID.
337
+ * @param {string} name File name.
338
+ * @returns {boolean} A value indicating whether the given file name exists in the given folder.
339
+ */
340
+ )
341
+ }, {
342
+ key: "hasFile",
343
+ value: (function () {
344
+ var _hasFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(folder, name) {
345
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
346
+ while (1) switch (_context7.prev = _context7.next) {
347
+ case 0:
348
+ _context7.next = 2;
349
+ return this._client.files.list({
350
+ q: "'".concat(folder, "' in parents AND name = '").concat(name, "' AND trashed = false"),
351
+ pageSize: 1,
352
+ fields: "files(id)",
353
+ spaces: "drive",
354
+ includeItemsFromAllDrives: true,
355
+ supportsAllDrives: true
356
+ }).then(function (_ref0) {
357
+ var files = _ref0.data.files;
358
+ return files.length > 0;
359
+ })["catch"](function () {
360
+ return false;
361
+ });
362
+ case 2:
363
+ return _context7.abrupt("return", _context7.sent);
364
+ case 3:
365
+ case "end":
366
+ return _context7.stop();
367
+ }
368
+ }, _callee7, this);
369
+ }));
370
+ function hasFile(_x10, _x11) {
371
+ return _hasFile.apply(this, arguments);
372
+ }
373
+ return hasFile;
374
+ }()
375
+ /**
376
+ * Counts the files contained in scan and destination folders.
377
+ *
378
+ * @param {string} drive Scan folder ID.
379
+ * @param {string} output Destination folder ID.
380
+ * @returns {object} Count of the files in the given folders.
381
+ */
382
+ )
383
+ }, {
384
+ key: "count",
385
+ value: (function () {
386
+ var _count = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(drive, output) {
387
+ var folders, existings;
388
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
389
+ while (1) switch (_context8.prev = _context8.next) {
390
+ case 0:
391
+ _context8.next = 2;
392
+ return this.list(drive);
393
+ case 2:
394
+ folders = _context8.sent;
395
+ _context8.next = 5;
396
+ return this.list(output);
397
+ case 5:
398
+ existings = _context8.sent;
399
+ return _context8.abrupt("return", {
400
+ "in": folders.length,
401
+ out: existings.length
402
+ });
403
+ case 7:
404
+ case "end":
405
+ return _context8.stop();
406
+ }
407
+ }, _callee8, this);
408
+ }));
409
+ function count(_x12, _x13) {
410
+ return _count.apply(this, arguments);
411
+ }
412
+ return count;
413
+ }())
414
+ }]);
415
+ }();
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _generate = _interopRequireDefault(require("./generate"));
8
+ var _generator = _interopRequireDefault(require("./generator"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
11
11
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } // Copyright 2024 Pittica S.r.l.
12
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } // Copyright 2024-2025 Pittica S.r.l.
13
13
  //
14
14
  // Licensed under the Apache License, Version 2.0 (the "License");
15
15
  // you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ var _default = exports["default"] = /*#__PURE__*/function () {
28
28
  format,
29
29
  credentials,
30
30
  captionCallback,
31
+ generator,
31
32
  _args = arguments;
32
33
  return _regeneratorRuntime().wrap(function _callee$(_context) {
33
34
  while (1) switch (_context.prev = _context.next) {
@@ -36,11 +37,12 @@ var _default = exports["default"] = /*#__PURE__*/function () {
36
37
  format = _args.length > 8 && _args[8] !== undefined ? _args[8] : "PDF";
37
38
  credentials = _args.length > 9 && _args[9] !== undefined ? _args[9] : null;
38
39
  captionCallback = _args.length > 10 && _args[10] !== undefined ? _args[10] : null;
39
- _context.next = 6;
40
- return (0, _generate["default"])(drive, output, logo, colors, font, size, margin, rounded, credentials, format, false, captionCallback);
41
- case 6:
42
- return _context.abrupt("return", _context.sent);
40
+ generator = new _generator["default"](false, credentials);
41
+ _context.next = 7;
42
+ return generator.generate(drive, output, logo, colors, font, size, margin, rounded, format, captionCallback);
43
43
  case 7:
44
+ return _context.abrupt("return", _context.sent);
45
+ case 8:
44
46
  case "end":
45
47
  return _context.stop();
46
48
  }