zapier-platform-core 17.4.0 → 17.5.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/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const zapier = require('./src');
2
2
  zapier.version = require('./package.json').version;
3
3
  zapier.tools = require('./src/tools/exported');
4
+ zapier.errors = require('./src/errors');
4
5
  module.exports = zapier;
package/index.mjs CHANGED
@@ -1,8 +1,10 @@
1
1
  import zapier from './src/index.js';
2
2
  import packageJson from './package.json' with { type: 'json' };
3
3
  import _tools from './src/tools/exported.js';
4
+ import _errors from './src/errors.js';
4
5
  zapier.version = packageJson.version;
5
6
  zapier.tools = _tools;
7
+ zapier.errors = _errors;
6
8
  // Allows `import { ... } from 'zapier-platform-core'`
7
9
  export const {
8
10
  createAppHandler,
@@ -16,6 +18,7 @@ export const {
16
18
  integrationTestHandler,
17
19
  tools,
18
20
  version,
21
+ errors,
19
22
  } = zapier;
20
23
  // Allows `import zapier from 'zapier-platform-core'`
21
24
  export default zapier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-core",
3
- "version": "17.4.0",
3
+ "version": "17.5.0",
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/",
@@ -56,14 +56,14 @@
56
56
  "content-disposition": "0.5.4",
57
57
  "dotenv": "16.5.0",
58
58
  "fernet": "^0.3.3",
59
- "form-data": "4.0.1",
59
+ "form-data": "4.0.4",
60
60
  "lodash": "4.17.21",
61
61
  "mime-types": "2.1.35",
62
62
  "node-abort-controller": "3.1.1",
63
63
  "node-fetch": "2.7.0",
64
64
  "oauth-sign": "0.9.0",
65
65
  "semver": "7.7.1",
66
- "zapier-platform-schema": "17.4.0"
66
+ "zapier-platform-schema": "17.5.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/node-fetch": "^2.6.11",
package/types/custom.d.ts CHANGED
@@ -10,7 +10,12 @@ import { Headers } from 'node-fetch';
10
10
 
11
11
  // The EXPORTED OBJECT
12
12
  export const version: string;
13
- export const tools: { env: { inject: (filename?: string) => void } };
13
+ export const tools: {
14
+ env: { inject: (filename?: string) => void };
15
+ };
16
+ export const errors: ErrorsModule;
17
+
18
+
14
19
 
15
20
  // see: https://github.com/zapier/zapier-platform-cli/issues/339#issue-336888249
16
21
  export const createAppTester: (
@@ -138,19 +143,30 @@ export interface Bundle<
138
143
  targetUrl?: string;
139
144
  }
140
145
 
141
- declare class AppError extends Error {
142
- constructor(message: string, code?: string, status?: number);
143
- }
144
- declare class HaltedError extends Error {}
145
- declare class ExpiredAuthError extends Error {}
146
- declare class RefreshAuthError extends Error {}
147
- declare class ThrottledError extends Error {
148
- constructor(message: string, delay?: number);
149
- }
150
- declare class ResponseError extends Error {
151
- constructor(response: HttpResponse);
146
+ // Error class types that match the runtime structure from src/errors.js
147
+ type ErrorConstructor = new (message?: string) => Error;
148
+ type AppErrorConstructor = new (message: string, code?: string, status?: number) => Error;
149
+ type ThrottledErrorConstructor = new (message: string, delay?: number) => Error;
150
+ type ResponseErrorConstructor = new (response: HttpResponse) => Error;
151
+
152
+ interface ErrorsModule {
153
+ Error: AppErrorConstructor;
154
+ HaltedError: ErrorConstructor;
155
+ ExpiredAuthError: ErrorConstructor;
156
+ RefreshAuthError: ErrorConstructor;
157
+ ThrottledError: ThrottledErrorConstructor;
158
+ ResponseError: ResponseErrorConstructor;
159
+ CheckError: ErrorConstructor;
160
+ DehydrateError: ErrorConstructor;
161
+ MethodDoesNotExist: ErrorConstructor;
162
+ NotImplementedError: ErrorConstructor;
163
+ RequireModuleError: ErrorConstructor;
164
+ StashedBundleError: ErrorConstructor;
165
+ StopRequestError: ErrorConstructor;
166
+ handleError: (...args: any[]) => never;
152
167
  }
153
168
 
169
+
154
170
  // copied http stuff from external typings
155
171
  export interface HttpRequestOptions {
156
172
  agent?: Agent;
@@ -286,14 +302,7 @@ export interface ZObject {
286
302
  input_encoding?: string,
287
303
  ) => string;
288
304
 
289
- errors: {
290
- Error: typeof AppError;
291
- HaltedError: typeof HaltedError;
292
- ExpiredAuthError: typeof ExpiredAuthError;
293
- RefreshAuthError: typeof RefreshAuthError;
294
- ThrottledError: typeof ThrottledError;
295
- ResponseError: typeof ResponseError;
296
- };
305
+ errors: ErrorsModule;
297
306
 
298
307
  cache: {
299
308
  get: (key: string) => Promise<any>;
@@ -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: 17.3.1
7
+ * zapier-platform-schema version: 17.4.0
8
8
  * schema-to-ts compiler version: 0.1.0
9
9
  */
10
10
  import type {
@@ -704,7 +704,15 @@ export interface AuthField {
704
704
  label?: string;
705
705
 
706
706
  /** The type of this value used to be. */
707
- type?: 'string' | 'number' | 'boolean' | 'datetime' | 'copy' | 'password';
707
+ type?:
708
+ | 'string'
709
+ | 'number'
710
+ | 'boolean'
711
+ | 'datetime'
712
+ | 'copy'
713
+ | 'password'
714
+ | 'integer'
715
+ | 'text';
708
716
 
709
717
  /** If this value is required or not. This defaults to `true`. */
710
718
  required?: boolean;