zapier-platform-schema 15.6.0 → 15.6.2

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,5 +1,5 @@
1
1
  {
2
- "version": "15.6.0",
2
+ "version": "15.6.2",
3
3
  "schemas": {
4
4
  "AppSchema": {
5
5
  "id": "/AppSchema",
@@ -617,6 +617,32 @@
617
617
  ]
618
618
  }
619
619
  },
620
+ "ThrottleOverrideObjectSchema": {
621
+ "id": "/ThrottleOverrideObjectSchema",
622
+ "description": "EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.",
623
+ "type": "object",
624
+ "required": ["window", "limit", "filter"],
625
+ "properties": {
626
+ "window": {
627
+ "description": "The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.",
628
+ "type": "integer"
629
+ },
630
+ "limit": {
631
+ "description": "The maximum number of invocations for an action, allowed within the timeframe window.",
632
+ "type": "integer"
633
+ },
634
+ "filter": {
635
+ "description": "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.",
636
+ "type": "string",
637
+ "enum": ["free", "trial", "paid"]
638
+ },
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`.",
641
+ "type": "boolean"
642
+ }
643
+ },
644
+ "additionalProperties": false
645
+ },
620
646
  "DynamicFieldsSchema": {
621
647
  "id": "/DynamicFieldsSchema",
622
648
  "description": "Like [/FieldsSchema](#fieldsschema) but you can provide functions to create dynamic or custom fields.",
@@ -694,22 +720,9 @@
694
720
  "overrides": {
695
721
  "description": "EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.",
696
722
  "type": "array",
723
+ "minItems": 1,
697
724
  "items": {
698
- "type": "object",
699
- "properties": {
700
- "window": {
701
- "description": "The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.",
702
- "type": "integer"
703
- },
704
- "limit": {
705
- "description": "The maximum number of invocations for an action, allowed within the timeframe window.",
706
- "type": "integer"
707
- },
708
- "filter": {
709
- "description": "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.",
710
- "type": "string"
711
- }
712
- }
725
+ "$ref": "/ThrottleOverrideObjectSchema"
713
726
  }
714
727
  }
715
728
  },
@@ -2,120 +2,118 @@
2
2
 
3
3
  const makeSchema = require('../utils/makeSchema');
4
4
 
5
- module.exports = makeSchema({
6
- id: '/ThrottleObjectSchema',
7
- description:
8
- 'Zapier uses this configuration to apply throttling when the limit for the window is exceeded. **NOTE:** The final key used for the throttling is formed as a combination of all the configurations; key, window, limit, and scope. To share a limit across multiple actions in an integration, each should have the same configuration set without "action" in the scope.',
9
- type: 'object',
10
- required: ['window', 'limit'],
11
- properties: {
12
- window: {
13
- description:
14
- 'The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.',
15
- type: 'integer',
16
- },
17
- limit: {
18
- description:
19
- 'The maximum number of invocations for an action, allowed within the timeframe window.',
20
- type: 'integer',
21
- },
22
- key: {
23
- description:
24
- 'The key to throttle with in combination with the scope. User data provided for the input fields can be used in the key with the use of the curly braces referencing. For example, to access the user data provided for the input field "test_field", use `{{bundle.inputData.test_field}}`. Note that a required input field should be referenced to get user data always.',
25
- type: 'string',
26
- minLength: 1,
27
- },
28
- scope: {
29
- description: `The granularity to throttle by. You can set the scope to one or more of the following: 'user' - Throttles based on user ids. 'auth' - Throttles based on auth ids. 'account' - Throttles based on account ids for all users under a single account. 'action' - Throttles the action it is set on separately from other actions. By default, throttling is scoped to the action and account.`,
30
- type: 'array',
31
- items: {
32
- enum: ['user', 'auth', 'account', 'action'],
5
+ const ThrottleOverrideObjectSchema = require('./ThrottleOverrideObjectSchema');
6
+
7
+ module.exports = makeSchema(
8
+ {
9
+ id: '/ThrottleObjectSchema',
10
+ description:
11
+ 'Zapier uses this configuration to apply throttling when the limit for the window is exceeded. **NOTE:** The final key used for the throttling is formed as a combination of all the configurations; key, window, limit, and scope. To share a limit across multiple actions in an integration, each should have the same configuration set without "action" in the scope.',
12
+ type: 'object',
13
+ required: ['window', 'limit'],
14
+ properties: {
15
+ window: {
16
+ description:
17
+ 'The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.',
18
+ type: 'integer',
19
+ },
20
+ limit: {
21
+ description:
22
+ 'The maximum number of invocations for an action, allowed within the timeframe window.',
23
+ type: 'integer',
24
+ },
25
+ key: {
26
+ description:
27
+ 'The key to throttle with in combination with the scope. User data provided for the input fields can be used in the key with the use of the curly braces referencing. For example, to access the user data provided for the input field "test_field", use `{{bundle.inputData.test_field}}`. Note that a required input field should be referenced to get user data always.',
33
28
  type: 'string',
29
+ minLength: 1,
34
30
  },
35
- },
36
- overrides: {
37
- description: 'EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.',
38
- type: 'array',
39
- items: {
40
- type: 'object',
41
- properties: {
42
- window: {
43
- description:
44
- 'The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.',
45
- type: 'integer',
46
- },
47
- limit: {
48
- description:
49
- 'The maximum number of invocations for an action, allowed within the timeframe window.',
50
- type: 'integer',
51
- },
52
- filter: {
53
- description: `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.`,
54
- type: 'string',
55
- },
56
- }
31
+ scope: {
32
+ description: `The granularity to throttle by. You can set the scope to one or more of the following: 'user' - Throttles based on user ids. 'auth' - Throttles based on auth ids. 'account' - Throttles based on account ids for all users under a single account. 'action' - Throttles the action it is set on separately from other actions. By default, throttling is scoped to the action and account.`,
33
+ type: 'array',
34
+ items: {
35
+ enum: ['user', 'auth', 'account', 'action'],
36
+ type: 'string',
37
+ },
38
+ },
39
+ overrides: {
40
+ description:
41
+ 'EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.',
42
+ type: 'array',
43
+ minItems: 1,
44
+ items: {
45
+ $ref: ThrottleOverrideObjectSchema.id,
46
+ },
57
47
  },
58
48
  },
59
- },
60
- examples: [
61
- {
62
- window: 60,
63
- limit: 100,
64
- },
65
- {
66
- window: 600,
67
- limit: 100,
68
- scope: ['account', 'user'],
69
- },
70
- {
71
- window: 3600,
72
- limit: 10,
73
- scope: ['auth'],
74
- },
75
- {
76
- window: 3600,
77
- limit: 10,
78
- key: 'random_key',
79
- scope: [], // this ensures neither the default nor any of the scope options is used
80
- },
81
- {
82
- window: 3600,
83
- limit: 10,
84
- key: 'random_key-{{bundle.inputData.test_field}}',
85
- scope: ['action', 'auth'],
86
- },
87
- {
88
- window: 3600,
89
- limit: 10,
90
- scope: ['auth'],
91
- overrides: [{
92
- window: 3600,
93
- limit: 2,
94
- filter: 'free',
95
- }],
96
- },
97
- ],
98
- antiExamples: [
99
- {
100
- example: {
49
+ examples: [
50
+ {
101
51
  window: 60,
102
52
  limit: 100,
103
- scope: ['zap'],
104
53
  },
105
- reason: 'Invalid scope provided: `zap`.',
106
- },
107
- {
108
- example: {limit: 10},
109
- reason: 'Missing required key: `window`.',
110
- },
111
- {
112
- example: {window: 600},
113
- reason: 'Missing required key: `limit`.',
114
- },
115
- {
116
- example: {},
117
- reason: 'Missing required keys: `window` and `limit`.',
118
- },
119
- ],
120
- additionalProperties: false,
121
- });
54
+ {
55
+ window: 600,
56
+ limit: 100,
57
+ scope: ['account', 'user'],
58
+ },
59
+ {
60
+ window: 3600,
61
+ limit: 10,
62
+ scope: ['auth'],
63
+ },
64
+ {
65
+ window: 3600,
66
+ limit: 10,
67
+ key: 'random_key',
68
+ scope: [], // this ensures neither the default nor any of the scope options is used
69
+ },
70
+ {
71
+ window: 3600,
72
+ limit: 10,
73
+ key: 'random_key-{{bundle.inputData.test_field}}',
74
+ scope: ['action', 'auth'],
75
+ },
76
+ {
77
+ window: 3600,
78
+ limit: 10,
79
+ scope: ['auth'],
80
+ overrides: [
81
+ {
82
+ window: 3600,
83
+ limit: 2,
84
+ filter: 'free',
85
+ retry: false,
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ antiExamples: [
91
+ {
92
+ example: {
93
+ window: 60,
94
+ limit: 100,
95
+ scope: ['zap'],
96
+ },
97
+ reason: 'Invalid scope provided: `zap`.',
98
+ },
99
+ {
100
+ example: { limit: 10 },
101
+ reason: 'Missing required key: `window`.',
102
+ },
103
+ {
104
+ example: { window: 600 },
105
+ reason: 'Missing required key: `limit`.',
106
+ },
107
+ {
108
+ example: { window: 600, limit: 100, overrides: [] },
109
+ reason: 'The overrides needs at least one item.',
110
+ },
111
+ {
112
+ example: {},
113
+ reason: 'Missing required keys: `window` and `limit`.',
114
+ },
115
+ ],
116
+ additionalProperties: false,
117
+ },
118
+ [ThrottleOverrideObjectSchema]
119
+ );
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ const makeSchema = require('../utils/makeSchema');
4
+
5
+ module.exports = makeSchema({
6
+ id: '/ThrottleOverrideObjectSchema',
7
+ description:
8
+ 'EXPERIMENTAL: Overrides the original throttle configuration based on a Zapier account attribute.',
9
+ type: 'object',
10
+ required: ['window', 'limit', 'filter'],
11
+ properties: {
12
+ window: {
13
+ description:
14
+ 'The timeframe, in seconds, within which the system tracks the number of invocations for an action. The number of invocations begins at zero at the start of each window.',
15
+ type: 'integer',
16
+ },
17
+ limit: {
18
+ description:
19
+ 'The maximum number of invocations for an action, allowed within the timeframe window.',
20
+ type: 'integer',
21
+ },
22
+ filter: {
23
+ description: `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.`,
24
+ type: 'string',
25
+ enum: ['free', 'trial', 'paid'],
26
+ },
27
+ retry: {
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`.',
30
+ type: 'boolean',
31
+ },
32
+ },
33
+ examples: [
34
+ {
35
+ window: 60,
36
+ limit: 100,
37
+ filter: 'free',
38
+ },
39
+ {
40
+ window: 60,
41
+ limit: 100,
42
+ filter: 'paid',
43
+ retry: false,
44
+ },
45
+ {
46
+ window: 60,
47
+ limit: 100,
48
+ filter: 'trial',
49
+ retry: true,
50
+ },
51
+ ],
52
+ antiExamples: [
53
+ {
54
+ example: { limit: 10 },
55
+ reason: 'Missing required key: `window` and `filter`.',
56
+ },
57
+ {
58
+ example: { window: 600 },
59
+ reason: 'Missing required key: `limit` and `filter`.',
60
+ },
61
+ {
62
+ example: { filter: 'trial' },
63
+ reason: 'Missing required key: `window` and `limit`.',
64
+ },
65
+ {
66
+ example: {},
67
+ reason: 'Missing required keys: `window`, `limit`, and `filter`.',
68
+ },
69
+ ],
70
+ additionalProperties: false,
71
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-schema",
3
- "version": "15.6.0",
3
+ "version": "15.6.2",
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/",