Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
67 changed files with 6814366 additions and 0 deletions
52
vendor/zapier-platform/packages/schema/lib/schemas/AppFlagsSchema.js
vendored
Normal file
52
vendor/zapier-platform/packages/schema/lib/schemas/AppFlagsSchema.js
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
module.exports = makeSchema({
|
||||
id: '/AppFlagsSchema',
|
||||
description: 'Codifies high-level options for your integration.',
|
||||
type: 'object',
|
||||
properties: {
|
||||
skipHttpPatch: {
|
||||
description:
|
||||
"By default, Zapier patches the core `http` module so that all requests (including those from 3rd-party SDKs) can be logged. Set this to true if you're seeing issues using an SDK (such as AWS).",
|
||||
type: 'boolean',
|
||||
},
|
||||
skipThrowForStatus: {
|
||||
description:
|
||||
'Starting in `core` version `10.0.0`, `response.throwForStatus()` was called by default. We introduced a per-request way to opt-out of this behavior. This flag takes that a step further and controls that behavior integration-wide **for requests made using `z.request()`**. Unless they specify otherwise (per-request, or via middleware), [Shorthand requests](https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md#shorthand-http-requests) _always_ call `throwForStatus()`. `z.request()` calls can also ignore this flag if they set `skipThrowForStatus` directly. It is important to note that for oauth2 or session auths with `authRefresh:true`, `401` status codes will throw a `RefreshAuthError` regardless of `skipThrowForStatus`, and will need to be handled manually if intervention is required.',
|
||||
type: 'boolean',
|
||||
},
|
||||
throwForThrottlingEarly: {
|
||||
description:
|
||||
'Starting in `core` version `18.0.0`, 429 (throttling) responses throw a `ThrottledError` before `afterResponse` middleware runs by default. Set this flag to `true` to preserve the old behavior where `afterResponse` middleware can see and handle 429 responses. This flag can be overridden per-request by setting `throwForThrottlingEarly` directly on the request options.',
|
||||
type: 'boolean',
|
||||
},
|
||||
cleanInputData: {
|
||||
description:
|
||||
'If true, Zapier removes empty strings, `null`, `undefined`, and empty Arrays or objects from `bundle.inputData` recursively before passing it to your `perform*` function. If you want to handle empty values yourself in your code, explicitly set this to false. This is a global flag that affects all the triggers and actions in your integration. The `cleanInputData` flag in `operation` takes precedence over this one.',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{
|
||||
skipHttpPatch: true,
|
||||
skipThrowForStatus: false,
|
||||
throwForThrottlingEarly: true,
|
||||
},
|
||||
{
|
||||
skipHttpPatch: false,
|
||||
skipThrowForStatus: true,
|
||||
throwForThrottlingEarly: false,
|
||||
},
|
||||
{ throwForThrottlingEarly: true },
|
||||
{},
|
||||
],
|
||||
antiExamples: [
|
||||
{ example: { foo: true }, reason: 'Invalid key.' },
|
||||
{ example: { skipHttpPatch: 'yes' }, reason: 'Invalid value.' },
|
||||
{ example: { skipThrowForStatus: 'no' }, reason: 'Invalid value.' },
|
||||
{ example: { throwForThrottlingEarly: 'yes' }, reason: 'Invalid value.' },
|
||||
],
|
||||
});
|
||||
160
vendor/zapier-platform/packages/schema/lib/schemas/AppSchema.js
vendored
Normal file
160
vendor/zapier-platform/packages/schema/lib/schemas/AppSchema.js
vendored
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const AuthenticationSchema = require('./AuthenticationSchema');
|
||||
const FlatObjectSchema = require('./FlatObjectSchema');
|
||||
const ResourcesSchema = require('./ResourcesSchema');
|
||||
const TriggersSchema = require('./TriggersSchema');
|
||||
const ReadBulksSchema = require('./BulkReadsSchema');
|
||||
const SearchesSchema = require('./SearchesSchema');
|
||||
const CreatesSchema = require('./CreatesSchema');
|
||||
const SearchOrCreatesSchema = require('./SearchOrCreatesSchema');
|
||||
const SearchAndCreatesSchema = require('./SearchAndCreatesSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
const VersionSchema = require('./VersionSchema');
|
||||
const MiddlewaresSchema = require('./MiddlewaresSchema');
|
||||
const HydratorsSchema = require('./HydratorsSchema');
|
||||
const AppFlagsSchema = require('./AppFlagsSchema');
|
||||
const ThrottleObjectSchema = require('./ThrottleObjectSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AppSchema',
|
||||
description: 'Represents a full app.',
|
||||
type: 'object',
|
||||
required: ['version', 'platformVersion'],
|
||||
properties: {
|
||||
version: {
|
||||
description: 'A version identifier for your code.',
|
||||
$ref: VersionSchema.id,
|
||||
},
|
||||
platformVersion: {
|
||||
description:
|
||||
'A version identifier for the Zapier execution environment.',
|
||||
$ref: VersionSchema.id,
|
||||
},
|
||||
beforeApp: {
|
||||
description:
|
||||
'EXPERIMENTAL: Before the perform method is called on your app, you can modify the execution context.',
|
||||
$ref: MiddlewaresSchema.id,
|
||||
},
|
||||
afterApp: {
|
||||
description:
|
||||
'EXPERIMENTAL: After the perform method is called on your app, you can modify the response.',
|
||||
$ref: MiddlewaresSchema.id,
|
||||
},
|
||||
authentication: {
|
||||
description: 'Choose what scheme your API uses for authentication.',
|
||||
$ref: AuthenticationSchema.id,
|
||||
},
|
||||
requestTemplate: {
|
||||
description:
|
||||
'Define a request mixin, great for setting custom headers, content-types, etc.',
|
||||
$ref: RequestSchema.id,
|
||||
},
|
||||
beforeRequest: {
|
||||
description:
|
||||
'Before an HTTP request is sent via our `z.request()` client, you can modify it.',
|
||||
$ref: MiddlewaresSchema.id,
|
||||
},
|
||||
afterResponse: {
|
||||
description:
|
||||
'After an HTTP response is recieved via our `z.request()` client, you can modify it.',
|
||||
$ref: MiddlewaresSchema.id,
|
||||
},
|
||||
hydrators: {
|
||||
description:
|
||||
"An optional bank of named functions that you can use in `z.hydrate('someName')` to lazily load data.",
|
||||
$ref: HydratorsSchema.id,
|
||||
},
|
||||
resources: {
|
||||
description:
|
||||
'All the resources for your app. Zapier will take these and generate the relevent triggers/searches/creates automatically.',
|
||||
$ref: ResourcesSchema.id,
|
||||
},
|
||||
triggers: {
|
||||
description:
|
||||
'All the triggers for your app. You can add your own here, or Zapier will automatically register any from the list/hook methods on your resources.',
|
||||
$ref: TriggersSchema.id,
|
||||
},
|
||||
bulkReads: {
|
||||
description:
|
||||
'All of the read bulks (GETs) your app exposes to retrieve resources in batches.',
|
||||
$ref: ReadBulksSchema.id,
|
||||
},
|
||||
searches: {
|
||||
description:
|
||||
'All the searches for your app. You can add your own here, or Zapier will automatically register any from the search method on your resources.',
|
||||
$ref: SearchesSchema.id,
|
||||
},
|
||||
creates: {
|
||||
description:
|
||||
'All the creates for your app. You can add your own here, or Zapier will automatically register any from the create method on your resources.',
|
||||
$ref: CreatesSchema.id,
|
||||
},
|
||||
searchOrCreates: {
|
||||
description:
|
||||
'All the search-or-create combos for your app. You can create your own here, or Zapier will automatically register any from resources that define a search, a create, and a get (or define a searchOrCreate directly). Register non-resource search-or-creates here as well.',
|
||||
$ref: SearchOrCreatesSchema.id,
|
||||
},
|
||||
searchAndCreates: {
|
||||
description: 'An alias for "searchOrCreates".',
|
||||
$ref: SearchAndCreatesSchema.id,
|
||||
},
|
||||
flags: {
|
||||
description: 'Top-level app options',
|
||||
$ref: AppFlagsSchema.id,
|
||||
},
|
||||
throttle: {
|
||||
description: `Zapier uses this configuration to apply throttling when the limit for the window is exceeded. When set here, it is the default throttle configuration used on each action of the integration. And when set in an action's operation object, it gets overwritten for that action only.`,
|
||||
$ref: ThrottleObjectSchema.id,
|
||||
},
|
||||
legacy: {
|
||||
description:
|
||||
'**INTERNAL USE ONLY**. Zapier uses this to hold properties from a legacy Web Builder app.',
|
||||
type: 'object',
|
||||
docAnnotation: {
|
||||
hide: true,
|
||||
},
|
||||
},
|
||||
firehoseWebhooks: {
|
||||
description:
|
||||
'**INTERNAL USE ONLY**. Zapier uses this for internal webhook app configurations.',
|
||||
type: 'object',
|
||||
docAnnotation: {
|
||||
hide: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [{ version: '1.0.0', platformVersion: '10.1.2' }],
|
||||
antiExamples: [
|
||||
{
|
||||
example: { version: 'v1.0.0', platformVersion: '10.1.2' },
|
||||
reason: 'Invalid value for version.',
|
||||
},
|
||||
{
|
||||
example: { version: '1.0.0', platformVersion: 'v10.1.2' },
|
||||
reason: 'Invalid value for platformVersion.',
|
||||
},
|
||||
],
|
||||
},
|
||||
[
|
||||
AuthenticationSchema,
|
||||
FlatObjectSchema,
|
||||
ResourcesSchema,
|
||||
ReadBulksSchema,
|
||||
TriggersSchema,
|
||||
SearchesSchema,
|
||||
CreatesSchema,
|
||||
SearchOrCreatesSchema,
|
||||
SearchAndCreatesSchema,
|
||||
RequestSchema,
|
||||
VersionSchema,
|
||||
MiddlewaresSchema,
|
||||
HydratorsSchema,
|
||||
AppFlagsSchema,
|
||||
ThrottleObjectSchema,
|
||||
],
|
||||
);
|
||||
131
vendor/zapier-platform/packages/schema/lib/schemas/AuthFieldSchema.js
vendored
Normal file
131
vendor/zapier-platform/packages/schema/lib/schemas/AuthFieldSchema.js
vendored
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const FieldChoicesSchema = require('./FieldChoicesSchema');
|
||||
const PlainFieldSchema = require('./PlainFieldSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthFieldSchema',
|
||||
description: `Field schema specialized for authentication fields. ${PlainFieldSchema.schema.description}`,
|
||||
required: ['key'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
...PlainFieldSchema.schema.properties,
|
||||
children: {
|
||||
type: 'array',
|
||||
items: { $ref: '/AuthFieldSchema' },
|
||||
description:
|
||||
'An array of child fields that define the structure of a sub-object for this field. Usually used for line items.',
|
||||
minItems: 1,
|
||||
},
|
||||
helpText: {
|
||||
description:
|
||||
'A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.',
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 1000,
|
||||
},
|
||||
type: {
|
||||
description: 'The type of this value used to be.',
|
||||
type: 'string',
|
||||
enum: [
|
||||
'string',
|
||||
'number',
|
||||
'boolean',
|
||||
'datetime',
|
||||
'copy',
|
||||
'password',
|
||||
'integer',
|
||||
'text',
|
||||
],
|
||||
},
|
||||
required: {
|
||||
description:
|
||||
'If this value is required or not. This defaults to `true`.',
|
||||
type: 'boolean',
|
||||
},
|
||||
placeholder: {
|
||||
description: 'An example value that is not saved.',
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
},
|
||||
choices: {
|
||||
description:
|
||||
'An object of machine keys and human values to populate a static dropdown.',
|
||||
$ref: FieldChoicesSchema.id,
|
||||
},
|
||||
computed: {
|
||||
description:
|
||||
'Is this field automatically populated (and hidden from the user)? Note: Only OAuth and Session Auth support fields with this key.',
|
||||
type: 'boolean',
|
||||
},
|
||||
inputFormat: {
|
||||
description:
|
||||
'Useful when you expect the input to be part of a longer string. Put "{{input}}" in place of the user\'s input (IE: "https://{{input}}.yourdomain.com").',
|
||||
type: 'string',
|
||||
// TODO: Check if it contains one and ONLY ONE '{{input}}'
|
||||
pattern: '^.*{{input}}.*$',
|
||||
},
|
||||
isNoSecret: {
|
||||
description:
|
||||
'Indicates if this authentication field is safe to e.g. be stored without encryption or displayed (not a secret).',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
|
||||
// Add examples and anti-examples specifically for basic & custom auth
|
||||
examples: [
|
||||
// Basic Auth - email & password
|
||||
{
|
||||
key: 'email',
|
||||
type: 'string',
|
||||
isNoSecret: true,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
type: 'password',
|
||||
isNoSecret: false,
|
||||
required: true,
|
||||
},
|
||||
|
||||
// Custom Auth - api key
|
||||
{
|
||||
key: 'api_key',
|
||||
type: 'string',
|
||||
isNoSecret: false,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
||||
antiExamples: [
|
||||
{
|
||||
example: {
|
||||
key: 'password',
|
||||
type: 'password',
|
||||
isNoSecret: true,
|
||||
required: true,
|
||||
},
|
||||
reason:
|
||||
'"password" is a sensitive field and cannot have isNoSecret set as true.',
|
||||
},
|
||||
{
|
||||
example: {
|
||||
key: 'api_key',
|
||||
isNoSecret: true,
|
||||
},
|
||||
reason:
|
||||
'"api_key" is a sensitive field and cannot have isNoSecret set as true.',
|
||||
},
|
||||
{
|
||||
example: {
|
||||
type: 'string',
|
||||
isNoSecret: false,
|
||||
},
|
||||
reason: 'Missing required key: key',
|
||||
},
|
||||
],
|
||||
},
|
||||
[FieldChoicesSchema, PlainFieldSchema],
|
||||
);
|
||||
67
vendor/zapier-platform/packages/schema/lib/schemas/AuthFieldsSchema.js
vendored
Normal file
67
vendor/zapier-platform/packages/schema/lib/schemas/AuthFieldsSchema.js
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const AuthFieldSchema = require('./AuthFieldSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthFieldsSchema',
|
||||
description: 'An array or collection of authentication fields.',
|
||||
type: 'array',
|
||||
items: {
|
||||
oneOf: [{ $ref: AuthFieldSchema.id }],
|
||||
},
|
||||
// Some complete examples
|
||||
examples: [
|
||||
// 1) Basic Auth: username (safe) + password (not safe)
|
||||
[
|
||||
{ key: 'username', type: 'string', isNoSecret: true, required: true },
|
||||
{
|
||||
key: 'password',
|
||||
type: 'password',
|
||||
isNoSecret: false,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
||||
// 2) Just a single auth field for custom usage (e.g., api_key)
|
||||
[{ key: 'api_key', type: 'string', isNoSecret: false, required: true }],
|
||||
|
||||
// 3) Mix of fields for extended usage
|
||||
[
|
||||
{ key: 'email', type: 'string', isNoSecret: true },
|
||||
{ key: 'password', type: 'password', required: true },
|
||||
{ key: 'mfa_token', type: 'string', isNoSecret: false },
|
||||
],
|
||||
],
|
||||
|
||||
// Anti-examples showing invalid arrays or invalid field objects
|
||||
antiExamples: [
|
||||
{
|
||||
example: {},
|
||||
reason: 'Must be an array (currently an object).',
|
||||
},
|
||||
{
|
||||
example: [{ key: 'password', isNoSecret: true }],
|
||||
reason:
|
||||
'"password" is a sensitive field and cannot have isNoSecret set as true.',
|
||||
},
|
||||
{
|
||||
example: [{ key: 'api_key', isNoSecret: true }],
|
||||
reason:
|
||||
'"api_key" is a sensitive field and cannot have isNoSecret set as true.',
|
||||
},
|
||||
{
|
||||
example: [{ isNoSecret: false }],
|
||||
reason: 'Missing required "key" property.',
|
||||
},
|
||||
{
|
||||
example: [{ key: 'username', type: 'string', isNoSecret: true }, 12345],
|
||||
reason:
|
||||
'Array item 12345 is not an object (must match AuthFieldSchema).',
|
||||
},
|
||||
],
|
||||
},
|
||||
[AuthFieldSchema],
|
||||
);
|
||||
14
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationBasicConfigSchema.js
vendored
Normal file
14
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationBasicConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
module.exports = makeSchema({
|
||||
id: '/AuthenticationBasicConfigSchema',
|
||||
description:
|
||||
'Config for Basic Authentication. No extra properties are required to setup Basic Auth, so you can leave this empty if your app uses Basic Auth.',
|
||||
type: 'object',
|
||||
properties: {},
|
||||
additionalProperties: false,
|
||||
examples: [{}],
|
||||
antiExamples: [{ example: { foo: true }, reason: 'Invalid key.' }],
|
||||
});
|
||||
37
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationCustomConfigSchema.js
vendored
Normal file
37
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationCustomConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthenticationCustomConfigSchema',
|
||||
description:
|
||||
'Config for custom authentication (like API keys). No extra properties are required to setup this auth type, so you can leave this empty if your app uses a custom auth method.',
|
||||
type: 'object',
|
||||
properties: {
|
||||
sendCode: {
|
||||
description:
|
||||
'EXPERIMENTAL: Define the call Zapier should make to send the OTP code.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{},
|
||||
{
|
||||
sendCode: {
|
||||
url: 'https://example.com/api/send',
|
||||
headers: { Authorization: `Bearer {{process.env.API_KEY}}` },
|
||||
body: {
|
||||
to_phone_number: '{{bundle.inputData.phone_number}}',
|
||||
code: '{{bundle.inputData.code}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
antiExamples: [{ example: { foo: true }, reason: 'Invalid key.' }],
|
||||
},
|
||||
[RequestSchema, FunctionSchema],
|
||||
);
|
||||
14
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationDigestConfigSchema.js
vendored
Normal file
14
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationDigestConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
module.exports = makeSchema({
|
||||
id: '/AuthenticationDigestConfigSchema',
|
||||
description:
|
||||
'Config for Digest Authentication. No extra properties are required to setup Digest Auth, so you can leave this empty if your app uses Digets Auth.',
|
||||
type: 'object',
|
||||
properties: {},
|
||||
additionalProperties: false,
|
||||
examples: [{}],
|
||||
antiExamples: [{ example: { foo: true }, reason: 'Invalid key.' }],
|
||||
});
|
||||
53
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationOAuth1ConfigSchema.js
vendored
Normal file
53
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationOAuth1ConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RedirectRequestSchema = require('./RedirectRequestSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthenticationOAuth1ConfigSchema',
|
||||
description: 'Config for OAuth1 authentication.',
|
||||
type: 'object',
|
||||
required: ['getRequestToken', 'authorizeUrl', 'getAccessToken'],
|
||||
properties: {
|
||||
getRequestToken: {
|
||||
description:
|
||||
'Define where Zapier will acquire a request token which is used for the rest of the three legged authentication process.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
authorizeUrl: {
|
||||
description:
|
||||
'Define where Zapier will redirect the user to authorize our app. Typically, you should append an `oauth_token` querystring parameter to the request.',
|
||||
oneOf: [
|
||||
{ $ref: RedirectRequestSchema.id },
|
||||
{ $ref: FunctionSchema.id },
|
||||
],
|
||||
},
|
||||
getAccessToken: {
|
||||
description: 'Define how Zapier fetches an access token from the API',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{
|
||||
getRequestToken: { require: 'some/path/to/file.js' },
|
||||
authorizeUrl: { require: 'some/path/to/file2.js' },
|
||||
getAccessToken: { require: 'some/path/to/file3.js' },
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
example: {
|
||||
getRequestToken: { require: 'some/path/to/file.js' },
|
||||
authorizeUrl: { require: 'some/path/to/file2.js' },
|
||||
},
|
||||
reason: 'Missing required key.',
|
||||
},
|
||||
],
|
||||
},
|
||||
[FunctionSchema, RedirectRequestSchema, RequestSchema],
|
||||
);
|
||||
78
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationOAuth2ConfigSchema.js
vendored
Normal file
78
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationOAuth2ConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RedirectRequestSchema = require('./RedirectRequestSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthenticationOAuth2ConfigSchema',
|
||||
description: 'Config for OAuth2 authentication.',
|
||||
type: 'object',
|
||||
required: ['authorizeUrl', 'getAccessToken'],
|
||||
properties: {
|
||||
authorizeUrl: {
|
||||
description:
|
||||
'Define where Zapier will redirect the user to authorize our app. Note: we append the redirect URL and state parameters to return value of this function.',
|
||||
oneOf: [
|
||||
{ $ref: RedirectRequestSchema.id },
|
||||
{ $ref: FunctionSchema.id },
|
||||
],
|
||||
},
|
||||
getAccessToken: {
|
||||
description: 'Define how Zapier fetches an access token from the API',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
refreshAccessToken: {
|
||||
description:
|
||||
'Define how Zapier will refresh the access token from the API',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
codeParam: {
|
||||
description:
|
||||
'Define a non-standard code param Zapier should scrape instead.',
|
||||
type: 'string',
|
||||
},
|
||||
scope: {
|
||||
description: 'What scope should Zapier request?',
|
||||
type: 'string',
|
||||
},
|
||||
autoRefresh: {
|
||||
description:
|
||||
'Should Zapier invoke `refreshAccessToken` when we receive an error for a 401 response?',
|
||||
type: 'boolean',
|
||||
},
|
||||
enablePkce: {
|
||||
description: 'Should Zapier use PKCE for OAuth2?',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{
|
||||
authorizeUrl: { require: 'some/path/to/file.js' },
|
||||
getAccessToken: { require: 'some/path/to/file2.js' },
|
||||
},
|
||||
{
|
||||
authorizeUrl: { require: 'some/path/to/file.js' },
|
||||
getAccessToken: { require: 'some/path/to/file2.js' },
|
||||
refreshAccessToken: { require: 'some/path/to/file3.js' },
|
||||
codeParam: 'unique_code',
|
||||
scope: 'read/write',
|
||||
autoRefresh: true,
|
||||
enablePkce: true,
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
example: {
|
||||
authorizeUrl: { require: 'some/path/to/file.js' },
|
||||
},
|
||||
reason: 'Missing required key getAccessToken.',
|
||||
},
|
||||
],
|
||||
},
|
||||
[FunctionSchema, RedirectRequestSchema, RequestSchema],
|
||||
);
|
||||
118
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationSchema.js
vendored
Normal file
118
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const AuthenticationBasicConfigSchema = require('./AuthenticationBasicConfigSchema.js');
|
||||
const AuthenticationCustomConfigSchema = require('./AuthenticationCustomConfigSchema.js');
|
||||
const AuthenticationDigestConfigSchema = require('./AuthenticationDigestConfigSchema.js');
|
||||
const AuthenticationOAuth1ConfigSchema = require('./AuthenticationOAuth1ConfigSchema.js');
|
||||
const AuthenticationOAuth2ConfigSchema = require('./AuthenticationOAuth2ConfigSchema.js');
|
||||
const AuthenticationSessionConfigSchema = require('./AuthenticationSessionConfigSchema.js');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
const AuthFieldsSchema = require('./AuthFieldsSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthenticationSchema',
|
||||
description: 'Represents authentication schemes.',
|
||||
type: 'object',
|
||||
required: ['type', 'test'],
|
||||
properties: {
|
||||
type: {
|
||||
description: 'Choose which scheme you want to use.',
|
||||
type: 'string',
|
||||
enum: ['basic', 'custom', 'digest', 'oauth1', 'oauth2', 'session'],
|
||||
},
|
||||
test: {
|
||||
description:
|
||||
'A function or request that confirms the authentication is working.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
fields: {
|
||||
description:
|
||||
'Fields you can request from the user before they connect your app to Zapier.',
|
||||
$ref: AuthFieldsSchema.id,
|
||||
},
|
||||
connectionLabel: {
|
||||
description:
|
||||
'A string with variables, function, or request that returns the connection label for the authenticated user.',
|
||||
anyOf: [
|
||||
{ $ref: RequestSchema.id },
|
||||
{ $ref: FunctionSchema.id },
|
||||
{ type: 'string' },
|
||||
],
|
||||
},
|
||||
// this is preferred to laying out config: anyOf: [...]
|
||||
basicConfig: { $ref: AuthenticationBasicConfigSchema.id },
|
||||
customConfig: { $ref: AuthenticationCustomConfigSchema.id },
|
||||
digestConfig: { $ref: AuthenticationDigestConfigSchema.id },
|
||||
oauth1Config: { $ref: AuthenticationOAuth1ConfigSchema.id },
|
||||
oauth2Config: { $ref: AuthenticationOAuth2ConfigSchema.id },
|
||||
sessionConfig: { $ref: AuthenticationSessionConfigSchema.id },
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{
|
||||
type: 'basic',
|
||||
test: '$func$2$f$',
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
test: '$func$2$f$',
|
||||
fields: [{ key: 'abc' }],
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
test: '$func$2$f$',
|
||||
connectionLabel: '{{bundle.inputData.abc}}',
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
test: '$func$2$f$',
|
||||
connectionLabel: '$func$2$f$',
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
test: '$func$2$f$',
|
||||
connectionLabel: { url: 'abc' },
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
example: {},
|
||||
reason: 'Missing required keys: type and test',
|
||||
},
|
||||
{
|
||||
example: '$func$2$f$',
|
||||
reason: 'Must be object',
|
||||
},
|
||||
{
|
||||
example: {
|
||||
type: 'unknown',
|
||||
test: '$func$2$f$',
|
||||
},
|
||||
reason: 'Invalid value for key: type',
|
||||
},
|
||||
{
|
||||
example: {
|
||||
type: 'custom',
|
||||
test: '$func$2$f$',
|
||||
fields: '$func$2$f$',
|
||||
},
|
||||
reason: 'Invalid value for key: fields',
|
||||
},
|
||||
],
|
||||
},
|
||||
[
|
||||
FunctionSchema,
|
||||
RequestSchema,
|
||||
AuthFieldsSchema,
|
||||
AuthenticationBasicConfigSchema,
|
||||
AuthenticationCustomConfigSchema,
|
||||
AuthenticationDigestConfigSchema,
|
||||
AuthenticationOAuth1ConfigSchema,
|
||||
AuthenticationOAuth2ConfigSchema,
|
||||
AuthenticationSessionConfigSchema,
|
||||
],
|
||||
);
|
||||
31
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationSessionConfigSchema.js
vendored
Normal file
31
vendor/zapier-platform/packages/schema/lib/schemas/AuthenticationSessionConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/AuthenticationSessionConfigSchema',
|
||||
description: 'Config for session authentication.',
|
||||
type: 'object',
|
||||
required: ['perform'],
|
||||
properties: {
|
||||
perform: {
|
||||
description:
|
||||
'Define how Zapier fetches the additional authData needed to make API calls.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [{ perform: { require: 'some/path/to/file.js' } }],
|
||||
antiExamples: [
|
||||
{
|
||||
example: {},
|
||||
reason: 'Missing required key: perform',
|
||||
},
|
||||
],
|
||||
},
|
||||
[FunctionSchema, RequestSchema],
|
||||
);
|
||||
63
vendor/zapier-platform/packages/schema/lib/schemas/BasicActionOperationSchema.js
vendored
Normal file
63
vendor/zapier-platform/packages/schema/lib/schemas/BasicActionOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
const BasicOperationSchema = require('./BasicOperationSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicActionOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicOperationSchema.schema),
|
||||
);
|
||||
|
||||
BasicActionOperationSchema.id = '/BasicActionOperationSchema';
|
||||
BasicActionOperationSchema.description =
|
||||
'Represents the fundamental mechanics of a search/create.';
|
||||
|
||||
BasicActionOperationSchema.properties = {
|
||||
resource: BasicActionOperationSchema.properties.resource,
|
||||
perform: BasicActionOperationSchema.properties.perform,
|
||||
performResume: {
|
||||
description:
|
||||
'A function that parses data from a perform (which uses z.generateCallbackUrl()) and callback request to resume this action.',
|
||||
$ref: FunctionSchema.id,
|
||||
},
|
||||
performGet: {
|
||||
description:
|
||||
'How will Zapier get a single record? If you find yourself reaching for this - consider resources and their built-in get methods.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
inputFields: BasicActionOperationSchema.properties.inputFields,
|
||||
inputFieldGroups: BasicActionOperationSchema.properties.inputFieldGroups,
|
||||
outputFields: BasicActionOperationSchema.properties.outputFields,
|
||||
sample: BasicActionOperationSchema.properties.sample,
|
||||
lock: BasicActionOperationSchema.properties.lock,
|
||||
throttle: BasicActionOperationSchema.properties.throttle,
|
||||
cleanInputData: BasicActionOperationSchema.properties.cleanInputData,
|
||||
};
|
||||
|
||||
BasicActionOperationSchema.examples = [
|
||||
{
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
sample: { id: 42, name: 'Hooli' },
|
||||
},
|
||||
];
|
||||
|
||||
BasicActionOperationSchema.antiExamples = [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that sample is only required if display isn't true / top-level resource doesn't have sample
|
||||
example: {
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
},
|
||||
reason:
|
||||
'Missing required key: sample. Note - This is only invalid if `display` is not explicitly set to true and if it does not belong to a resource that has a sample.',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicActionOperationSchema,
|
||||
BasicOperationSchema.dependencies,
|
||||
);
|
||||
61
vendor/zapier-platform/packages/schema/lib/schemas/BasicCreateOperationSchema.js
vendored
Normal file
61
vendor/zapier-platform/packages/schema/lib/schemas/BasicCreateOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const BasicActionOperationSchema = require('./BasicActionOperationSchema');
|
||||
const BufferConfigSchema = require('./BufferConfigSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicCreateOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicActionOperationSchema.schema),
|
||||
);
|
||||
|
||||
BasicCreateOperationSchema.id = '/BasicCreateOperationSchema';
|
||||
BasicCreateOperationSchema.description =
|
||||
'Represents the fundamental mechanics of a create.';
|
||||
|
||||
BasicCreateOperationSchema.properties.perform = {
|
||||
description:
|
||||
"How will Zapier get the data? This can be a function like `(z) => [{id: 123}]` or a request like `{url: 'http...'}`. Exactly one of `perform` or `performBuffer` must be defined. If you choose to define `buffer` and `performBuffer`, you must omit `perform`.",
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace', // replace or append
|
||||
value: 'no (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
BasicCreateOperationSchema.properties.buffer = {
|
||||
description:
|
||||
'Currently an **internal-only** feature. Zapier uses this configuration for creating objects in bulk with `performBuffer`.',
|
||||
$ref: BufferConfigSchema.id,
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace', // replace or append
|
||||
value: 'no (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
BasicCreateOperationSchema.properties.performBuffer = {
|
||||
description:
|
||||
'Currently an **internal-only** feature. A function to create objects in bulk with. `buffer` and `performBuffer` must either both be defined or neither. Additionally, only one of `perform` or `performBuffer` can be defined. If you choose to define `perform`, you must omit `buffer` and `performBuffer`.',
|
||||
$ref: FunctionSchema.id,
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace', // replace or append
|
||||
value: 'no (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
delete BasicCreateOperationSchema.required;
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicCreateOperationSchema,
|
||||
BasicActionOperationSchema.dependencies.concat(BufferConfigSchema),
|
||||
);
|
||||
78
vendor/zapier-platform/packages/schema/lib/schemas/BasicDisplaySchema.js
vendored
Normal file
78
vendor/zapier-platform/packages/schema/lib/schemas/BasicDisplaySchema.js
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
module.exports = makeSchema({
|
||||
id: '/BasicDisplaySchema',
|
||||
description: 'Represents user information for a trigger, search, or create.',
|
||||
type: 'object',
|
||||
properties: {
|
||||
label: {
|
||||
description:
|
||||
'A short label like "New Record" or "Create Record in Project". Optional if `hidden` is true.',
|
||||
type: 'string',
|
||||
minLength: 2,
|
||||
maxLength: 64,
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
description: {
|
||||
description:
|
||||
'A description of what this trigger, search, or create does. Optional if `hidden` is true.',
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 1000,
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
directions: {
|
||||
description:
|
||||
'A short blurb that can explain how to get this working. EG: how and where to copy-paste a static hook URL into your application. Only evaluated for static webhooks.',
|
||||
type: 'string',
|
||||
minLength: 12,
|
||||
maxLength: 1000,
|
||||
},
|
||||
hidden: {
|
||||
description: 'Should this operation be unselectable by users?',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
examples: [
|
||||
{ hidden: true },
|
||||
{ label: 'New Thing', description: 'Gets a new thing for you.' },
|
||||
{
|
||||
label: 'New Thing',
|
||||
description: 'Gets a new thing for you.',
|
||||
directions: 'This is how you use the thing.',
|
||||
hidden: false,
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that description is required if hidden is false
|
||||
example: {
|
||||
label: 'New Thing',
|
||||
hidden: false,
|
||||
},
|
||||
reason: 'Missing required key: description',
|
||||
},
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that description is required if hidden is false
|
||||
example: {
|
||||
description: 'Gets a new thing for you.',
|
||||
hidden: false,
|
||||
},
|
||||
reason: 'Missing required key: label',
|
||||
},
|
||||
],
|
||||
});
|
||||
119
vendor/zapier-platform/packages/schema/lib/schemas/BasicHookOperationSchema.js
vendored
Normal file
119
vendor/zapier-platform/packages/schema/lib/schemas/BasicHookOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
const BasicOperationSchema = require('./BasicOperationSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicHookOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicOperationSchema.schema),
|
||||
);
|
||||
|
||||
const hookTechnicallyRequired =
|
||||
'Note: this is required for public apps to ensure the best UX for the end-user. For private apps, this is strongly recommended for testing REST Hooks. Otherwise, you can ignore warnings about this property with the `--without-style` flag during `zapier-platform push`.';
|
||||
|
||||
BasicHookOperationSchema.id = '/BasicHookOperationSchema';
|
||||
|
||||
BasicHookOperationSchema.description =
|
||||
'Represents the inbound mechanics of hooks with optional subscribe/unsubscribe. Defers to list for fields.';
|
||||
|
||||
BasicHookOperationSchema.properties = {
|
||||
type: {
|
||||
description:
|
||||
'Must be explicitly set to `"hook"` unless this hook is defined as part of a resource, in which case it\'s optional.',
|
||||
type: 'string',
|
||||
enum: ['hook'],
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
resource: BasicHookOperationSchema.properties.resource,
|
||||
perform: {
|
||||
description: 'A function that processes the inbound webhook request.',
|
||||
$ref: FunctionSchema.id,
|
||||
},
|
||||
performList: {
|
||||
description:
|
||||
'Fetch a list of items on demand during testing instead of waiting for a hook. You can also consider resources and their built-in hook/list methods. ' +
|
||||
hookTechnicallyRequired,
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
canPaginate: {
|
||||
description:
|
||||
'Does this endpoint support pagination via temporary cursor storage?',
|
||||
type: 'boolean',
|
||||
},
|
||||
performSubscribe: {
|
||||
description:
|
||||
'Takes a URL and any necessary data from the user and subscribes. ' +
|
||||
hookTechnicallyRequired,
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
performUnsubscribe: {
|
||||
description:
|
||||
'Takes a URL and data from a previous subscribe call and unsubscribes. ' +
|
||||
hookTechnicallyRequired,
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
inputFields: BasicHookOperationSchema.properties.inputFields,
|
||||
inputFieldGroups: BasicHookOperationSchema.properties.inputFieldGroups,
|
||||
outputFields: BasicHookOperationSchema.properties.outputFields,
|
||||
sample: BasicHookOperationSchema.properties.sample,
|
||||
cleanInputData: BasicHookOperationSchema.properties.cleanInputData,
|
||||
};
|
||||
|
||||
BasicHookOperationSchema.examples = [
|
||||
{
|
||||
type: 'hook',
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
performList: { require: 'some/path/to/file2.js' },
|
||||
performSubscribe: { require: 'some/path/to/file3.js' },
|
||||
performUnsubscribe: { require: 'some/path/to/file4.js' },
|
||||
sample: { id: 42, name: 'Hooli' },
|
||||
},
|
||||
];
|
||||
|
||||
BasicHookOperationSchema.antiExamples = [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that sample is only required if display isn't true / top-level resource doesn't have sample
|
||||
example: {
|
||||
type: 'hook',
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
performList: { require: 'some/path/to/file2.js' },
|
||||
performSubscribe: { require: 'some/path/to/file3.js' },
|
||||
performUnsubscribe: { require: 'some/path/to/file4.js' },
|
||||
},
|
||||
reason:
|
||||
'Missing required key: sample. Note - This is only invalid if `display` is not explicitly set to true and if it does not belong to a resource that has a sample.',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicHookOperationSchema,
|
||||
BasicOperationSchema.dependencies,
|
||||
);
|
||||
100
vendor/zapier-platform/packages/schema/lib/schemas/BasicHookToPollOperationSchema.js
vendored
Normal file
100
vendor/zapier-platform/packages/schema/lib/schemas/BasicHookToPollOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
const BasicOperationSchema = require('./BasicOperationSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicHookToPollOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicOperationSchema.schema),
|
||||
);
|
||||
|
||||
BasicHookToPollOperationSchema.id = '/BasicHookToPollOperationSchema';
|
||||
|
||||
BasicHookToPollOperationSchema.description =
|
||||
'Represents the inbound mechanics of hook to poll style triggers. Defers to list for fields.';
|
||||
|
||||
BasicHookToPollOperationSchema.docAnnotation = {
|
||||
hide: true,
|
||||
};
|
||||
|
||||
BasicHookToPollOperationSchema.required = [
|
||||
'performList',
|
||||
'performSubscribe',
|
||||
'performUnsubscribe',
|
||||
];
|
||||
|
||||
BasicHookToPollOperationSchema.properties = {
|
||||
type: {
|
||||
description: 'Must be explicitly set to `"hook_to_poll"`.',
|
||||
type: 'string',
|
||||
enum: ['hook_to_poll'],
|
||||
required: {
|
||||
type: 'replace',
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
performList: {
|
||||
description:
|
||||
'Similar a polling trigger, but checks for new data when a webhook is received, instead of every few minutes',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
canPaginate: {
|
||||
description:
|
||||
'Does this endpoint support pagination via temporary cursor storage?',
|
||||
type: 'boolean',
|
||||
},
|
||||
performSubscribe: {
|
||||
description:
|
||||
'Takes a URL and any necessary data from the user and subscribes. ',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
performUnsubscribe: {
|
||||
description:
|
||||
'Takes a URL and data from a previous subscribe call and unsubscribes. ',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
inputFields: BasicHookToPollOperationSchema.properties.inputFields,
|
||||
inputFieldGroups: BasicHookToPollOperationSchema.properties.inputFieldGroups,
|
||||
outputFields: BasicHookToPollOperationSchema.properties.outputFields,
|
||||
sample: BasicHookToPollOperationSchema.properties.sample,
|
||||
cleanInputData: BasicHookToPollOperationSchema.properties.cleanInputData,
|
||||
maxPollingDelay: {
|
||||
description:
|
||||
'The maximum amount of time to wait between polling requests in seconds. Minimum value is 20s and will default to 20 if not set, or set to a lower value.',
|
||||
type: 'integer',
|
||||
},
|
||||
};
|
||||
|
||||
BasicHookToPollOperationSchema.examples = [
|
||||
{
|
||||
type: 'hook_to_poll',
|
||||
performList: { require: 'some/path/to/file2.js' },
|
||||
performSubscribe: { require: 'some/path/to/file3.js' },
|
||||
performUnsubscribe: { require: 'some/path/to/file4.js' },
|
||||
sample: { id: 42, name: 'Hooli' },
|
||||
},
|
||||
];
|
||||
|
||||
BasicHookToPollOperationSchema.antiExamples = [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that sample is only required if display isn't true
|
||||
example: {
|
||||
type: 'hook_to_poll',
|
||||
performList: { require: 'some/path/to/file2.js' },
|
||||
performSubscribe: { require: 'some/path/to/file3.js' },
|
||||
performUnsubscribe: { require: 'some/path/to/file4.js' },
|
||||
},
|
||||
reason:
|
||||
'Missing required key: sample. Note - This is only invalid if `display` is not explicitly set to true',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicHookToPollOperationSchema,
|
||||
BasicOperationSchema.dependencies,
|
||||
);
|
||||
107
vendor/zapier-platform/packages/schema/lib/schemas/BasicOperationSchema.js
vendored
Normal file
107
vendor/zapier-platform/packages/schema/lib/schemas/BasicOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
const ResultsSchema = require('./ResultsSchema');
|
||||
const KeySchema = require('./KeySchema');
|
||||
const LockObjectSchema = require('./LockObjectSchema');
|
||||
const ThrottleObjectSchema = require('./ThrottleObjectSchema');
|
||||
const InputFieldsSchema = require('./InputFieldsSchema');
|
||||
const InputFieldGroupsSchema = require('./InputFieldGroupsSchema');
|
||||
const OutputFieldsSchema = require('./OutputFieldsSchema');
|
||||
|
||||
module.exports = makeSchema(
|
||||
{
|
||||
id: '/BasicOperationSchema',
|
||||
description:
|
||||
'Represents the fundamental mechanics of triggers, searches, or creates.',
|
||||
type: 'object',
|
||||
required: ['perform'],
|
||||
properties: {
|
||||
resource: {
|
||||
description:
|
||||
'Optionally reference and extends a resource. Allows Zapier to automatically tie together samples, lists and hooks, greatly improving the UX. EG: if you had another trigger reusing a resource but filtering the results.',
|
||||
$ref: KeySchema.id,
|
||||
},
|
||||
perform: {
|
||||
description:
|
||||
"How will Zapier get the data? This can be a function like `(z) => [{id: 123}]` or a request like `{url: 'http...'}`.",
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
inputFields: {
|
||||
description:
|
||||
'What should the form a user sees and configures look like?',
|
||||
$ref: InputFieldsSchema.id,
|
||||
},
|
||||
inputFieldGroups: {
|
||||
description:
|
||||
'Defines groups for organizing input fields in the UI. Each group can have a key, label, and emphasis styling.',
|
||||
$ref: InputFieldGroupsSchema.id,
|
||||
},
|
||||
outputFields: {
|
||||
description:
|
||||
'What fields of data will this return? Will use resource outputFields if missing, will also use sample if available.',
|
||||
$ref: OutputFieldsSchema.id,
|
||||
},
|
||||
sample: {
|
||||
description:
|
||||
'What does a sample of data look like? Will use resource sample if missing. Requirement waived if `display.hidden` is true or if this belongs to a resource that has a top-level sample',
|
||||
type: 'object',
|
||||
// TODO: require id, ID, Id property?
|
||||
minProperties: 1,
|
||||
docAnnotation: {
|
||||
required: {
|
||||
type: 'replace', // replace or append
|
||||
value: '**yes** (with exceptions, see description)',
|
||||
},
|
||||
},
|
||||
},
|
||||
lock: {
|
||||
description:
|
||||
'Zapier uses this configuration to ensure this action is performed one at a time per scope (avoid concurrency).',
|
||||
$ref: LockObjectSchema.id,
|
||||
},
|
||||
throttle: {
|
||||
description:
|
||||
'Zapier uses this configuration to apply throttling when the limit for the window is exceeded.',
|
||||
$ref: ThrottleObjectSchema.id,
|
||||
},
|
||||
cleanInputData: {
|
||||
description:
|
||||
'If true, Zapier removes empty strings, `null`, `undefined`, and empty Arrays or objects from `bundle.inputData` recursively before passing it to your `perform*` function. If you want to handle empty values yourself in your code, explicitly set this to false. There is also a global flag with the same name in `App.flags`. This one takes precedence over the global one.',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
examples: [
|
||||
{
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
sample: { id: 42, name: 'Hooli' },
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that sample is only required if display isn't true / top-level resource doesn't have sample
|
||||
example: {
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
},
|
||||
reason:
|
||||
'Missing required key: sample. Note - This is only invalid if `display` is not explicitly set to true and if it does not belong to a resource that has a sample.',
|
||||
},
|
||||
],
|
||||
additionalProperties: false,
|
||||
},
|
||||
[
|
||||
InputFieldsSchema,
|
||||
InputFieldGroupsSchema,
|
||||
OutputFieldsSchema,
|
||||
FunctionSchema,
|
||||
KeySchema,
|
||||
LockObjectSchema,
|
||||
RequestSchema,
|
||||
ResultsSchema,
|
||||
ThrottleObjectSchema,
|
||||
],
|
||||
);
|
||||
44
vendor/zapier-platform/packages/schema/lib/schemas/BasicPollingOperationSchema.js
vendored
Normal file
44
vendor/zapier-platform/packages/schema/lib/schemas/BasicPollingOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
const BasicOperationSchema = require('./BasicOperationSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicPollingOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicOperationSchema.schema),
|
||||
);
|
||||
|
||||
BasicPollingOperationSchema.id = '/BasicPollingOperationSchema';
|
||||
BasicPollingOperationSchema.description =
|
||||
'Represents the fundamental mechanics of a trigger.';
|
||||
|
||||
BasicPollingOperationSchema.properties = {
|
||||
type: {
|
||||
// TODO: not a fan of this...
|
||||
description:
|
||||
'Clarify how this operation works (polling == pull or hook == push).',
|
||||
type: 'string',
|
||||
default: 'polling',
|
||||
enum: ['polling'], // notification?
|
||||
},
|
||||
resource: BasicPollingOperationSchema.properties.resource,
|
||||
perform: BasicPollingOperationSchema.properties.perform,
|
||||
canPaginate: {
|
||||
description:
|
||||
'Does this endpoint support pagination via temporary cursor storage?',
|
||||
type: 'boolean',
|
||||
},
|
||||
inputFields: BasicPollingOperationSchema.properties.inputFields,
|
||||
inputFieldGroups: BasicPollingOperationSchema.properties.inputFieldGroups,
|
||||
outputFields: BasicPollingOperationSchema.properties.outputFields,
|
||||
sample: BasicPollingOperationSchema.properties.sample,
|
||||
throttle: BasicPollingOperationSchema.properties.throttle,
|
||||
cleanInputData: BasicPollingOperationSchema.properties.cleanInputData,
|
||||
};
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicPollingOperationSchema,
|
||||
BasicOperationSchema.dependencies,
|
||||
);
|
||||
67
vendor/zapier-platform/packages/schema/lib/schemas/BasicSearchOperationSchema.js
vendored
Normal file
67
vendor/zapier-platform/packages/schema/lib/schemas/BasicSearchOperationSchema.js
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
const { SKIP_KEY } = require('../constants');
|
||||
|
||||
const BasicOperationSchema = require('./BasicOperationSchema');
|
||||
const FunctionSchema = require('./FunctionSchema');
|
||||
const RequestSchema = require('./RequestSchema');
|
||||
|
||||
// TODO: would be nice to deep merge these instead
|
||||
// or maybe use allOf which is built into json-schema
|
||||
const BasicSearchOperationSchema = JSON.parse(
|
||||
JSON.stringify(BasicOperationSchema.schema),
|
||||
);
|
||||
|
||||
BasicSearchOperationSchema.id = '/BasicSearchOperationSchema';
|
||||
BasicSearchOperationSchema.description =
|
||||
'Represents the fundamental mechanics of a search.';
|
||||
|
||||
BasicSearchOperationSchema.properties = {
|
||||
resource: BasicSearchOperationSchema.properties.resource,
|
||||
perform: BasicSearchOperationSchema.properties.perform,
|
||||
performResume: {
|
||||
description:
|
||||
'A function that parses data from a perform (which uses z.generateCallbackUrl()) and callback request to resume this action.',
|
||||
$ref: FunctionSchema.id,
|
||||
},
|
||||
performGet: {
|
||||
description:
|
||||
'How will Zapier get a single record? If you find yourself reaching for this - consider resources and their built-in get methods.',
|
||||
oneOf: [{ $ref: RequestSchema.id }, { $ref: FunctionSchema.id }],
|
||||
},
|
||||
canPaginate: {
|
||||
description: 'Does this search support pagination?',
|
||||
type: 'boolean',
|
||||
},
|
||||
inputFields: BasicSearchOperationSchema.properties.inputFields,
|
||||
inputFieldGroups: BasicSearchOperationSchema.properties.inputFieldGroups,
|
||||
outputFields: BasicSearchOperationSchema.properties.outputFields,
|
||||
sample: BasicSearchOperationSchema.properties.sample,
|
||||
lock: BasicSearchOperationSchema.properties.lock,
|
||||
throttle: BasicSearchOperationSchema.properties.throttle,
|
||||
cleanInputData: BasicSearchOperationSchema.properties.cleanInputData,
|
||||
};
|
||||
|
||||
BasicSearchOperationSchema.examples = [
|
||||
{
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
sample: { id: 42, name: 'Hooli' },
|
||||
},
|
||||
];
|
||||
|
||||
BasicSearchOperationSchema.antiExamples = [
|
||||
{
|
||||
[SKIP_KEY]: true, // Cannot validate that sample is only required if display isn't true / top-level resource doesn't have sample
|
||||
example: {
|
||||
perform: { require: 'some/path/to/file.js' },
|
||||
},
|
||||
reason:
|
||||
'Missing required key: sample. Note - This is only invalid if `display` is not explicitly set to true and if it does not belong to a resource that has a sample.',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = makeSchema(
|
||||
BasicSearchOperationSchema,
|
||||
BasicOperationSchema.dependencies,
|
||||
);
|
||||
48
vendor/zapier-platform/packages/schema/lib/schemas/BufferConfigSchema.js
vendored
Normal file
48
vendor/zapier-platform/packages/schema/lib/schemas/BufferConfigSchema.js
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
const makeSchema = require('../utils/makeSchema');
|
||||
|
||||
module.exports = makeSchema({
|
||||
id: '/BufferConfigSchema',
|
||||
description:
|
||||
'Currently an **internal-only** feature. Zapier uses this configuration for creating objects in bulk.',
|
||||
type: 'object',
|
||||
required: ['groupedBy', 'limit'],
|
||||
properties: {
|
||||
groupedBy: {
|
||||
description:
|
||||
'The list of keys of input fields to group bulk-create with. The actual user data provided for the fields will be used during execution. Note that a required input field should be referenced to get user data always.',
|
||||
type: 'array',
|
||||
minItems: 1,
|
||||
},
|
||||
limit: {
|
||||
description:
|
||||
"The maximum number of items to call `performBuffer` with. **Note** that it is capped by the platform to prevent exceeding the [AWS Lambda's request/response payload size quota of 6 MB](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#function-configuration-deployment-and-execution). Also, the execution is time-bound; we recommend reducing it upon consistent timeout.",
|
||||
type: 'integer',
|
||||
},
|
||||
},
|
||||
examples: [
|
||||
{
|
||||
groupedBy: ['workspace', 'sheet'],
|
||||
limit: 100,
|
||||
},
|
||||
],
|
||||
antiExamples: [
|
||||
{
|
||||
example: {
|
||||
groupedBy: [],
|
||||
limit: 100,
|
||||
},
|
||||
reason: 'Empty groupedBy list provided: `[]`.',
|
||||
},
|
||||
{
|
||||
example: { groupedBy: ['workspace'] },
|
||||
reason: 'Missing required key: `limit`.',
|
||||
},
|
||||
{
|
||||
example: { limit: 1 },
|
||||
reason: 'Missing required key: `groupedBy`.',
|
||||
},
|
||||
],
|
||||
additionalProperties: false,
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue