zapier-platform-core 17.0.0 → 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/index.mjs ADDED
@@ -0,0 +1,21 @@
1
+ import zapier from './src/index.js';
2
+ import packageJson from './package.json' with { type: 'json' };
3
+ import _tools from './src/tools/exported.js';
4
+ zapier.version = packageJson.version;
5
+ zapier.tools = _tools;
6
+ // Allows `import { ... } from 'zapier-platform-core'`
7
+ export const {
8
+ createAppHandler,
9
+ createAppTester,
10
+ defineApp,
11
+ defineCreate,
12
+ defineInputField,
13
+ defineInputFields,
14
+ defineSearch,
15
+ defineTrigger,
16
+ integrationTestHandler,
17
+ tools,
18
+ version,
19
+ } = zapier;
20
+ // Allows `import zapier from 'zapier-platform-core'`
21
+ export default zapier;
package/package.json CHANGED
@@ -1,16 +1,26 @@
1
1
  {
2
2
  "name": "zapier-platform-core",
3
- "version": "17.0.0",
3
+ "version": "17.0.2",
4
4
  "description": "The core SDK for CLI apps in the Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",
7
7
  "author": "Zapier Engineering <contact@zapier.com>",
8
8
  "license": "SEE LICENSE IN LICENSE",
9
- "main": "index.js",
10
9
  "types": "types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "require": "./index.js",
13
+ "import": "./index.mjs",
14
+ "types": "./types/index.d.ts"
15
+ },
16
+ "./src/*": {
17
+ "require": "./src/*.js"
18
+ }
19
+ },
11
20
  "files": [
12
21
  "/include/",
13
22
  "/index.js",
23
+ "/index.mjs",
14
24
  "/src/",
15
25
  "/types/"
16
26
  ],
@@ -52,7 +62,7 @@
52
62
  "node-fetch": "2.7.0",
53
63
  "oauth-sign": "0.9.0",
54
64
  "semver": "7.7.1",
55
- "zapier-platform-schema": "17.0.0"
65
+ "zapier-platform-schema": "17.0.2"
56
66
  },
57
67
  "devDependencies": {
58
68
  "@types/node-fetch": "^2.6.11",
@@ -177,7 +177,7 @@ const loadApp = async (event, rpc, appRawOrPath) => {
177
177
  };
178
178
 
179
179
  const createLambdaHandler = (appRawOrPath) => {
180
- const handler = async (event, context = {}) => {
180
+ const handlerPromise = async (event, context = {}) => {
181
181
  // If we're running out of memory or file descriptors, force exit the process.
182
182
  // The backend will try again via @retry(ProcessExitedException).
183
183
  checkMemory(event);
@@ -273,6 +273,21 @@ const createLambdaHandler = (appRawOrPath) => {
273
273
  });
274
274
  };
275
275
 
276
+ // For backwards compatibility with older versions of Zapier CLI,
277
+ // support both callback and Promise styles
278
+ const handler = (event, context = {}, callback) => {
279
+ // If callback is provided, indicating <v17, call it
280
+ if (typeof callback === 'function') {
281
+ handlerPromise(event, context)
282
+ .then((result) => callback(null, result))
283
+ .catch((err) => callback(err));
284
+ return;
285
+ }
286
+
287
+ // If no callback is provided, indicating >=v17, return a Promise
288
+ return handlerPromise(event, context);
289
+ };
290
+
276
291
  return handler;
277
292
  };
278
293
 
@@ -4,7 +4,7 @@
4
4
  * files, and/or the schema-to-ts tool and run its CLI to regenerate
5
5
  * these typings.
6
6
  *
7
- * zapier-platform-schema version: 16.5.1
7
+ * zapier-platform-schema version: 17.0.1
8
8
  * schema-to-ts compiler version: 0.1.0
9
9
  */
10
10
  import type {