zapier-platform-schema 15.7.3 → 15.8.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.
@@ -637,7 +637,7 @@
637
637
  "enum": ["free", "trial", "paid"]
638
638
  },
639
639
  "retry": {
640
- "description": "The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`.",
640
+ "description": "The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`. NOTE that it has no effect on polling triggers and should not be set.",
641
641
  "type": "boolean"
642
642
  }
643
643
  },
@@ -717,6 +717,15 @@
717
717
  "type": "string"
718
718
  }
719
719
  },
720
+ "retry": {
721
+ "description": "The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`. NOTE that it has no effect on polling triggers and should not be set.",
722
+ "type": "boolean"
723
+ },
724
+ "filter": {
725
+ "description": "EXPERIMENTAL: Account-based attribute to override the throttle by. You can set to one of the following: \"free\", \"trial\", \"paid\". Therefore, the throttle scope would be automatically set to \"account\" and ONLY the accounts based on the specified filter will have their requests throttled based on the throttle overrides while the rest are throttled based on the original configuration.",
726
+ "type": "string",
727
+ "enum": ["free", "trial", "paid"]
728
+ },
720
729
  "overrides": {
721
730
  "description": "EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.",
722
731
  "type": "array",
@@ -919,10 +928,6 @@
919
928
  "value": "**yes** (with exceptions, see description)"
920
929
  }
921
930
  }
922
- },
923
- "throttle": {
924
- "description": "Zapier uses this configuration to apply throttling when the limit for the window is exceeded.",
925
- "$ref": "/ThrottleObjectSchema"
926
931
  }
927
932
  },
928
933
  "additionalProperties": false
@@ -1494,7 +1499,8 @@
1494
1499
  "description": "Any unique key can be used and its values will be validated against the SearchOrCreateSchema.",
1495
1500
  "$ref": "/SearchOrCreateSchema"
1496
1501
  }
1497
- }
1502
+ },
1503
+ "additionalProperties": false
1498
1504
  },
1499
1505
  "AuthenticationSchema": {
1500
1506
  "id": "/AuthenticationSchema",
@@ -1602,7 +1608,8 @@
1602
1608
  "description": "Any unique key can be used and its values will be validated against the SearchSchema.",
1603
1609
  "$ref": "/SearchSchema"
1604
1610
  }
1605
- }
1611
+ },
1612
+ "additionalProperties": false
1606
1613
  },
1607
1614
  "CreatesSchema": {
1608
1615
  "id": "/CreatesSchema",
@@ -1613,7 +1620,8 @@
1613
1620
  "description": "Any unique key can be used and its values will be validated against the CreateSchema.",
1614
1621
  "$ref": "/CreateSchema"
1615
1622
  }
1616
- }
1623
+ },
1624
+ "additionalProperties": false
1617
1625
  },
1618
1626
  "SearchAndCreatesSchema": {
1619
1627
  "id": "/SearchAndCreatesSchema",
@@ -1624,7 +1632,8 @@
1624
1632
  "description": "Any unique key can be used and its values will be validated against the SearchOrCreateSchema.",
1625
1633
  "$ref": "/SearchOrCreateSchema"
1626
1634
  }
1627
- }
1635
+ },
1636
+ "additionalProperties": false
1628
1637
  },
1629
1638
  "VersionSchema": {
1630
1639
  "id": "/VersionSchema",
@@ -18,6 +18,7 @@ const checks = [
18
18
  require('./matchingKeys'),
19
19
  require('./labelWhenVisible'),
20
20
  require('./uniqueInputFieldKeys'),
21
+ require('./pollingThrottle'),
21
22
  ];
22
23
 
23
24
  const runFunctionalConstraints = (definition, mainSchema) => {
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ const _ = require('lodash');
4
+ const jsonschema = require('jsonschema');
5
+
6
+ const pollingThrottle = (definition) => {
7
+ const errors = [];
8
+ const actionType = 'triggers';
9
+
10
+ if (definition[actionType]) {
11
+ _.each(definition[actionType], (actionDef) => {
12
+ if (
13
+ actionDef.operation &&
14
+ actionDef.operation.throttle &&
15
+ _.has(actionDef.operation.throttle, 'retry') &&
16
+ (!actionDef.operation.type || actionDef.operation.type === 'polling')
17
+ ) {
18
+ errors.push(
19
+ new jsonschema.ValidationError(
20
+ 'must not use the "retry" field for a polling trigger.',
21
+ actionDef.operation.throttle,
22
+ '/ThrottleObjectSchema',
23
+ `instance.${actionType}.${actionDef.key}.operation.throttle`,
24
+ 'invalid',
25
+ 'throttle'
26
+ )
27
+ );
28
+ }
29
+ });
30
+ }
31
+
32
+ return errors;
33
+ };
34
+
35
+ module.exports = pollingThrottle;
@@ -83,7 +83,6 @@ BasicHookOperationSchema.properties = {
83
83
  inputFields: BasicHookOperationSchema.properties.inputFields,
84
84
  outputFields: BasicHookOperationSchema.properties.outputFields,
85
85
  sample: BasicHookOperationSchema.properties.sample,
86
- throttle: BasicHookOperationSchema.properties.throttle,
87
86
  };
88
87
 
89
88
  BasicHookOperationSchema.examples = [
@@ -17,6 +17,7 @@ module.exports = makeSchema(
17
17
  $ref: CreateSchema.id,
18
18
  },
19
19
  },
20
+ additionalProperties: false,
20
21
  examples: [
21
22
  {
22
23
  createRecipe: {
@@ -18,6 +18,7 @@ module.exports = makeSchema(
18
18
  $ref: SearchOrCreateSchema.id,
19
19
  },
20
20
  },
21
+ additionalProperties: false,
21
22
  examples: [
22
23
  {
23
24
  searchOrCreateWidgets: {
@@ -17,6 +17,7 @@ module.exports = makeSchema(
17
17
  $ref: SearchSchema.id,
18
18
  },
19
19
  },
20
+ additionalProperties: false,
20
21
  examples: [
21
22
  {
22
23
  recipe: {
@@ -36,6 +36,16 @@ module.exports = makeSchema(
36
36
  type: 'string',
37
37
  },
38
38
  },
39
+ retry: {
40
+ description:
41
+ 'The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`. NOTE that it has no effect on polling triggers and should not be set.',
42
+ type: 'boolean',
43
+ },
44
+ filter: {
45
+ description: `EXPERIMENTAL: Account-based attribute to override the throttle by. You can set to one of the following: "free", "trial", "paid". Therefore, the throttle scope would be automatically set to "account" and ONLY the accounts based on the specified filter will have their requests throttled based on the throttle overrides while the rest are throttled based on the original configuration.`,
46
+ type: 'string',
47
+ enum: ['free', 'trial', 'paid'],
48
+ },
39
49
  overrides: {
40
50
  description:
41
51
  'EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.',
@@ -72,11 +82,13 @@ module.exports = makeSchema(
72
82
  limit: 10,
73
83
  key: 'random_key-{{bundle.inputData.test_field}}',
74
84
  scope: ['action', 'auth'],
85
+ retry: false,
75
86
  },
76
87
  {
77
88
  window: 3600,
78
89
  limit: 10,
79
90
  scope: ['auth'],
91
+ retry: false,
80
92
  overrides: [
81
93
  {
82
94
  window: 3600,
@@ -26,7 +26,7 @@ module.exports = makeSchema({
26
26
  },
27
27
  retry: {
28
28
  description:
29
- 'The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`.',
29
+ 'The effect of throttling on the tasks of the action. `true` means throttled tasks are automatically retried after some delay, while `false` means tasks are held without retry. It defaults to `true`. NOTE that it has no effect on polling triggers and should not be set.',
30
30
  type: 'boolean',
31
31
  },
32
32
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-schema",
3
- "version": "15.7.3",
3
+ "version": "15.8.0",
4
4
  "description": "Schema definition for CLI apps in the Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",