zapier-platform-cli 17.0.1 → 17.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/oclif.manifest.json
CHANGED
package/package.json
CHANGED
package/src/generators/index.js
CHANGED
|
@@ -290,9 +290,9 @@ class ProjectGenerator extends Generator {
|
|
|
290
290
|
{
|
|
291
291
|
type: 'list',
|
|
292
292
|
name: 'module',
|
|
293
|
-
choices: ['
|
|
293
|
+
choices: ['esm', 'commonjs'],
|
|
294
294
|
message: 'Choose module type:',
|
|
295
|
-
default: '
|
|
295
|
+
default: 'esm',
|
|
296
296
|
},
|
|
297
297
|
]);
|
|
298
298
|
this.options.module = this.answers.module;
|
|
@@ -20,7 +20,10 @@ export default {
|
|
|
20
20
|
getAccessToken: {
|
|
21
21
|
url: `${API_URL}/oauth/access-token`,
|
|
22
22
|
method: 'POST',
|
|
23
|
-
|
|
23
|
+
headers: {
|
|
24
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
25
|
+
},
|
|
26
|
+
body: {
|
|
24
27
|
client_id: '{{process.env.CLIENT_ID}}',
|
|
25
28
|
client_secret: '{{process.env.CLIENT_SECRET}}',
|
|
26
29
|
code: '{{bundle.inputData.code}}',
|
|
@@ -31,7 +34,10 @@ export default {
|
|
|
31
34
|
refreshAccessToken: {
|
|
32
35
|
url: `${API_URL}/oauth/refresh-token`,
|
|
33
36
|
method: 'POST',
|
|
34
|
-
|
|
37
|
+
headers: {
|
|
38
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
39
|
+
},
|
|
40
|
+
body: {
|
|
35
41
|
client_id: '{{process.env.CLIENT_ID}}',
|
|
36
42
|
client_secret: '{{process.env.CLIENT_SECRET}}',
|
|
37
43
|
refresh_token: '{{bundle.authData.refresh_token}}',
|
package/src/utils/build.js
CHANGED
package/src/utils/local.js
CHANGED
|
@@ -228,7 +228,10 @@ const loadAppRawUsingImport = async (
|
|
|
228
228
|
try {
|
|
229
229
|
// zapierwrapper.mjs is only available since zapier-platform-core v17.
|
|
230
230
|
// And only zapierwrapper.mjs exposes appRaw just for this use case.
|
|
231
|
-
|
|
231
|
+
// Convert path to file:// URL for Windows compatibility with ESM imports
|
|
232
|
+
const pathForUrl = path.resolve(wrapperPath).replace(/\\/g, '/');
|
|
233
|
+
const wrapperUrl = new URL(`file:///${pathForUrl.replace(/^\//, '')}`);
|
|
234
|
+
appRaw = (await import(wrapperUrl.href)).appRaw;
|
|
232
235
|
} catch (err) {
|
|
233
236
|
if (err.name === 'SyntaxError') {
|
|
234
237
|
// Run a separate process to print the line number of the SyntaxError.
|
|
@@ -251,7 +254,8 @@ const loadAppRawUsingImport = async (
|
|
|
251
254
|
};
|
|
252
255
|
|
|
253
256
|
const loadAppRawUsingRequire = (appDir) => {
|
|
254
|
-
|
|
257
|
+
const normalizedPath = path.resolve(appDir);
|
|
258
|
+
let appRaw = require(normalizedPath);
|
|
255
259
|
if (appRaw && appRaw.default) {
|
|
256
260
|
// Node.js 22+ supports using require() to import ESM.
|
|
257
261
|
// For Node.js < 20.17.0, require() will throw an error on ESM.
|
|
@@ -325,7 +329,10 @@ const getLocalAppHandler = async ({
|
|
|
325
329
|
|
|
326
330
|
// Assumes the entry point of zapier-platform-core is index.js
|
|
327
331
|
const coreEntryPoint = path.join(corePackageDir, 'index.js');
|
|
328
|
-
|
|
332
|
+
// Convert path to file:// URL for Windows compatibility with ESM imports
|
|
333
|
+
const pathForUrl = path.resolve(coreEntryPoint).replace(/\\/g, '/');
|
|
334
|
+
const coreEntryUrl = new URL(`file:///${pathForUrl.replace(/^\//, '')}`);
|
|
335
|
+
const zapier = (await import(coreEntryUrl.href)).default;
|
|
329
336
|
|
|
330
337
|
const handler = zapier.createAppHandler(appRaw);
|
|
331
338
|
if (handler.length === 3) {
|
|
@@ -360,6 +367,7 @@ const localAppCommand = async (event, appDir, shouldDeleteWrapper = true) => {
|
|
|
360
367
|
appDir,
|
|
361
368
|
shouldDeleteWrapper,
|
|
362
369
|
});
|
|
370
|
+
|
|
363
371
|
if (handler.length === 3) {
|
|
364
372
|
// < 17: function handler(event, ctx, callback)
|
|
365
373
|
return new Promise((resolve, reject) => {
|