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.
- package/README-source.md +31 -2
- package/README.md +35 -5
- package/oclif.manifest.json +1 -1
- package/package.json +4 -2
- package/src/generators/index.js +49 -11
- package/src/generators/templates/dynamic-dropdown/triggers/people.js +6 -1
- package/src/generators/templates/gitignore +1 -0
- package/src/generators/templates/typescript/README.md +2 -16
- package/src/generators/templates/typescript/index.js +1 -1
- package/src/generators/templates/typescript/src/creates/movie.ts +3 -8
- package/src/generators/templates/typescript/src/index.ts +5 -9
- package/src/generators/templates/typescript/src/test/creates.test.ts +1 -2
- package/src/generators/templates/typescript/src/test/triggers.test.ts +2 -3
- package/src/generators/templates/typescript/src/triggers/movie.ts +4 -3
- package/src/generators/templates/typescript/tsconfig.json +11 -6
- package/src/oclif/ZapierBaseCommand.js +1 -1
- package/src/oclif/commands/invoke.js +413 -45
- package/src/utils/convert.js +2 -1
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Create, PerformFunction } from 'zapier-platform-core';
|
|
2
2
|
|
|
3
|
-
|
|
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 {
|
|
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
|
-
|
|
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,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PerformFunction, Trigger } from 'zapier-platform-core';
|
|
2
2
|
|
|
3
|
-
const perform = async (z
|
|
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": "
|
|
4
|
-
"module": "
|
|
5
|
-
"moduleResolution": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
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') : ''
|