zapier-platform-schema 15.18.0 → 15.19.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "15.18.0",
2
+ "version": "15.19.0",
3
3
  "schemas": {
4
4
  "AppSchema": {
5
5
  "id": "/AppSchema",
@@ -149,6 +149,27 @@
149
149
  }
150
150
  ]
151
151
  },
152
+ "FieldMetaSchema": {
153
+ "id": "/FieldMetaSchema",
154
+ "type": "object",
155
+ "description": "Allows for additional metadata to be stored on the field.",
156
+ "patternProperties": {
157
+ "[^\\s]+": {
158
+ "description": "Only string, integer or boolean values are allowed.",
159
+ "anyOf": [
160
+ {
161
+ "type": "string"
162
+ },
163
+ {
164
+ "type": "integer"
165
+ },
166
+ {
167
+ "type": "boolean"
168
+ }
169
+ ]
170
+ }
171
+ }
172
+ },
152
173
  "FieldSchema": {
153
174
  "id": "/FieldSchema",
154
175
  "description": "Defines a field an app either needs as input, or gives as output. In addition to the requirements below, the following keys are mutually exclusive:\n\n* `children` & `list`\n* `children` & `dict`\n* `children` & `type`\n* `children` & `placeholder`\n* `children` & `helpText`\n* `children` & `default`\n* `dict` & `list`\n* `dynamic` & `dict`\n* `dynamic` & `choices`",
@@ -249,6 +270,10 @@
249
270
  "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\").",
250
271
  "type": "string",
251
272
  "pattern": "^.*{{input}}.*$"
273
+ },
274
+ "meta": {
275
+ "description": "Allows for additional metadata to be stored on the field. Supports simple key-values only (no sub-objects or arrays).",
276
+ "$ref": "/FieldMetaSchema"
252
277
  }
253
278
  },
254
279
  "additionalProperties": false
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ const makeSchema = require('../utils/makeSchema');
4
+
5
+ module.exports = makeSchema({
6
+ id: '/FieldMetaSchema',
7
+ type: 'object',
8
+ description: 'Allows for additional metadata to be stored on the field.',
9
+ patternProperties: {
10
+ '[^\\s]+': {
11
+ description: 'Only string, integer or boolean values are allowed.',
12
+ anyOf: [{ type: 'string' }, { type: 'integer' }, { type: 'boolean' }],
13
+ },
14
+ },
15
+ examples: [
16
+ { shouldCapitalize: true },
17
+ { shouldCapitalize: true, internalType: 'datetime' },
18
+ ],
19
+ antiExamples: [
20
+ {
21
+ example: { databank: { primaryContact: 'abc' } },
22
+ reason: 'No complex values allowed',
23
+ },
24
+ {
25
+ example: { needsProcessing: null },
26
+ reason: 'No null values allowed',
27
+ },
28
+ ],
29
+ });
@@ -6,6 +6,8 @@ const RefResourceSchema = require('./RefResourceSchema');
6
6
 
7
7
  const FieldChoicesSchema = require('./FieldChoicesSchema');
8
8
 
9
+ const FieldMetaSchema = require('./FieldMetaSchema');
10
+
9
11
  const { INCOMPATIBLE_FIELD_SCHEMA_KEYS } = require('../constants');
10
12
 
11
13
  // the following takes an array of string arrays (string[][]) and returns the follwing string:
@@ -137,6 +139,11 @@ module.exports = makeSchema(
137
139
  // TODO: Check if it contains one and ONLY ONE '{{input}}'
138
140
  pattern: '^.*{{input}}.*$',
139
141
  },
142
+ meta: {
143
+ description:
144
+ 'Allows for additional metadata to be stored on the field. Supports simple key-values only (no sub-objects or arrays).',
145
+ $ref: FieldMetaSchema.id,
146
+ },
140
147
  },
141
148
  examples: [
142
149
  { key: 'abc' },
@@ -148,6 +155,15 @@ module.exports = makeSchema(
148
155
  },
149
156
  { key: 'abc', children: [{ key: 'abc' }] },
150
157
  { key: 'abc', type: 'integer', helpText: 'neat' },
158
+ {
159
+ key: 'abc',
160
+ type: 'integer',
161
+ meta: {
162
+ internalType: 'numeric',
163
+ should_call_api: true,
164
+ display_order: 1,
165
+ },
166
+ },
151
167
  ],
152
168
  antiExamples: [
153
169
  {
@@ -190,5 +206,5 @@ module.exports = makeSchema(
190
206
  ],
191
207
  additionalProperties: false,
192
208
  },
193
- [RefResourceSchema, FieldChoicesSchema]
209
+ [RefResourceSchema, FieldChoicesSchema, FieldMetaSchema]
194
210
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-schema",
3
- "version": "15.18.0",
3
+ "version": "15.19.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/",