zapier-platform-cli 15.16.1 → 15.17.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.
@@ -1,11 +1,6 @@
1
- import { Bundle, ZObject } from 'zapier-platform-core';
1
+ import { Create, PerformFunction } from 'zapier-platform-core';
2
2
 
3
- // You can optionally add add the shape of the inputData in bundle, which will pass that
4
- // info down into the function and tests
5
- const perform = async (
6
- z: ZObject,
7
- bundle: Bundle<{ title: string; year: number }>
8
- ) => {
3
+ const perform: PerformFunction = async (z, bundle) => {
9
4
  const response = await z.request({
10
5
  method: 'POST',
11
6
  url: 'https://auth-json-server.zapier-staging.com/movies',
@@ -37,4 +32,4 @@ export default {
37
32
  title: 'example',
38
33
  },
39
34
  },
40
- };
35
+ } satisfies Create;
@@ -1,16 +1,12 @@
1
- import { Bundle, HttpRequestOptions, ZObject } from 'zapier-platform-core';
1
+ import type { App, BeforeRequestMiddleware } from 'zapier-platform-core';
2
2
 
3
3
  import MovieCreate from './creates/movie';
4
4
  import MovieTrigger from './triggers/movie';
5
5
  import { version as platformVersion } from 'zapier-platform-core';
6
6
 
7
- const { version } = require('../package.json');
7
+ import packageJson from '../package.json';
8
8
 
9
- const addApiKeyHeader = (
10
- req: HttpRequestOptions,
11
- z: ZObject,
12
- bundle: Bundle
13
- ) => {
9
+ const addApiKeyHeader: BeforeRequestMiddleware = (req, z, bundle) => {
14
10
  // Hard-coded api key just to demo. DON'T do auth like this for your production app!
15
11
  req.headers = req.headers || {};
16
12
  req.headers['X-Api-Key'] = 'secret';
@@ -18,7 +14,7 @@ const addApiKeyHeader = (
18
14
  };
19
15
 
20
16
  export default {
21
- version,
17
+ version: packageJson.version,
22
18
  platformVersion,
23
19
 
24
20
  beforeRequest: [addApiKeyHeader],
@@ -30,4 +26,4 @@ export default {
30
26
  creates: {
31
27
  [MovieCreate.key]: MovieCreate,
32
28
  },
33
- };
29
+ } satisfies App;
@@ -1,6 +1,5 @@
1
- /* globals describe, expect, test */
2
-
3
1
  import { createAppTester, tools } from 'zapier-platform-core';
2
+ import { describe, test, expect } from 'vitest';
4
3
 
5
4
  import App from '../index';
6
5
 
@@ -1,6 +1,5 @@
1
- /* globals describe, expect, test */
2
-
3
- import { Bundle, createAppTester, tools } from 'zapier-platform-core';
1
+ import { createAppTester, tools } from 'zapier-platform-core';
2
+ import { describe, test, expect } from 'vitest';
4
3
 
5
4
  import App from '../index';
6
5
 
@@ -1,6 +1,6 @@
1
- import { Bundle, ZObject } from 'zapier-platform-core';
1
+ import { PerformFunction, Trigger } from 'zapier-platform-core';
2
2
 
3
- const perform = async (z: ZObject, bundle: Bundle) => {
3
+ const perform: PerformFunction = async (z, bundle) => {
4
4
  const response = await z.request(
5
5
  'https://auth-json-server.zapier-staging.com/movies'
6
6
  );
@@ -17,10 +17,11 @@ export default {
17
17
  },
18
18
 
19
19
  operation: {
20
+ type: 'polling',
20
21
  perform,
21
22
  sample: {
22
23
  id: '1',
23
24
  title: 'example',
24
25
  },
25
26
  },
26
- };
27
+ } satisfies Trigger;
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2019",
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "lib": ["esnext"],
7
- "outDir": "./lib",
3
+ "target": "ESNext",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "resolveJsonModule": true,
7
+ "esModuleInterop": true,
8
+ "isolatedModules": true,
9
+ "skipLibCheck": true,
10
+ "outDir": "./dist",
8
11
  "rootDir": "./src",
9
12
  "strict": true
10
- }
13
+ },
14
+ "include": ["./src/**/*.ts"],
15
+ "exclude": ["./**/*.test.ts"]
11
16
  }
@@ -304,7 +304,7 @@ class ZapierBaseCommand extends Command {
304
304
  )
305
305
  .filter(Boolean);
306
306
 
307
- const descriptionParts = this.description.split('\n').filter(Boolean);
307
+ const descriptionParts = this.description.split('\n\n').filter(Boolean);
308
308
  const blurb = descriptionParts[0];
309
309
  const lengthyDescription = colors.stripColors(
310
310
  descriptionParts.length > 1 ? descriptionParts.slice(1).join('\n\n') : ''