zapier-platform-core 12.1.0 → 12.2.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/package.json +3 -3
- package/src/tools/schema.js +34 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zapier-platform-core",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.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/",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"engineStrict": true,
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@zapier/secret-scrubber": "^1.0.
|
|
43
|
+
"@zapier/secret-scrubber": "^1.0.7",
|
|
44
44
|
"bluebird": "3.7.2",
|
|
45
45
|
"content-disposition": "0.5.3",
|
|
46
46
|
"dotenv": "9.0.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"node-fetch": "2.6.7",
|
|
52
52
|
"oauth-sign": "0.9.0",
|
|
53
53
|
"semver": "7.3.5",
|
|
54
|
-
"zapier-platform-schema": "12.
|
|
54
|
+
"zapier-platform-schema": "12.2.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"adm-zip": "0.5.5",
|
package/src/tools/schema.js
CHANGED
|
@@ -14,7 +14,7 @@ const convertResourceDos = (appRaw) => {
|
|
|
14
14
|
const triggers = {};
|
|
15
15
|
const searches = {};
|
|
16
16
|
const creates = {};
|
|
17
|
-
const
|
|
17
|
+
const searchCreates = {};
|
|
18
18
|
|
|
19
19
|
_.each(appRaw.resources, (resource) => {
|
|
20
20
|
let search, create, trigger;
|
|
@@ -54,8 +54,7 @@ const convertResourceDos = (appRaw) => {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (search && create && isVisible(search) && isVisible(create)) {
|
|
57
|
-
|
|
58
|
-
// key: `${resource.key}SearchOrCreate`,
|
|
57
|
+
searchCreates[search.key] = {
|
|
59
58
|
key: `${search.key}`, // For now this is a Zapier editor limitation (has to match search)
|
|
60
59
|
display: {
|
|
61
60
|
label: `Find or Create ${resource.noun}`,
|
|
@@ -64,11 +63,19 @@ const convertResourceDos = (appRaw) => {
|
|
|
64
63
|
search: search.key,
|
|
65
64
|
create: create.key,
|
|
66
65
|
};
|
|
67
|
-
searchOrCreates[searchOrCreate.key] = searchOrCreate;
|
|
68
66
|
}
|
|
69
67
|
});
|
|
70
68
|
|
|
71
|
-
|
|
69
|
+
const extras = { triggers, searches, creates };
|
|
70
|
+
|
|
71
|
+
// searchAndCreates is an alias for searchOrCreates. Schema validation makes sure only one of them is defined.
|
|
72
|
+
if (appRaw.searchAndCreates) {
|
|
73
|
+
extras.searchAndCreates = searchCreates;
|
|
74
|
+
} else {
|
|
75
|
+
extras.searchOrCreates = searchCreates;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return extras;
|
|
72
79
|
};
|
|
73
80
|
|
|
74
81
|
/* When a trigger/search/create (action) links to a resource, we walk up to
|
|
@@ -106,7 +113,13 @@ const compileApp = (appRaw) => {
|
|
|
106
113
|
appRaw = schemaTools.findSourceRequireFunctions(appRaw);
|
|
107
114
|
const extras = convertResourceDos(appRaw);
|
|
108
115
|
|
|
109
|
-
const actions = [
|
|
116
|
+
const actions = [
|
|
117
|
+
'triggers',
|
|
118
|
+
'searches',
|
|
119
|
+
'creates',
|
|
120
|
+
'searchOrCreates',
|
|
121
|
+
'searchAndCreates',
|
|
122
|
+
];
|
|
110
123
|
let problemKeys = [];
|
|
111
124
|
|
|
112
125
|
actions.forEach((a) => {
|
|
@@ -132,11 +145,21 @@ const compileApp = (appRaw) => {
|
|
|
132
145
|
appRaw.triggers = _.extend({}, extras.triggers, appRaw.triggers || {});
|
|
133
146
|
appRaw.searches = _.extend({}, extras.searches, appRaw.searches || {});
|
|
134
147
|
appRaw.creates = _.extend({}, extras.creates, appRaw.creates || {});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
148
|
+
|
|
149
|
+
// searchAndCreates is an alias for searchOrCreates. Schema validation makes sure only one of them is defined.
|
|
150
|
+
// If the searchAndCreates key exists, we use it and avoid adding a searchOrCreates key to the appRaw object.
|
|
151
|
+
// Otherwise, we add a searchOrCreates object to the appRaw object, which defaults to an empty object.
|
|
152
|
+
if (appRaw.searchAndCreates) {
|
|
153
|
+
appRaw.searchAndCreates = {
|
|
154
|
+
...extras.searchAndCreates,
|
|
155
|
+
...appRaw.searchAndCreates,
|
|
156
|
+
};
|
|
157
|
+
} else {
|
|
158
|
+
appRaw.searchOrCreates = {
|
|
159
|
+
...extras.searchOrCreates,
|
|
160
|
+
...appRaw.searchOrCreates,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
140
163
|
|
|
141
164
|
_.each(appRaw.triggers, (trigger) => {
|
|
142
165
|
appRaw.triggers[trigger.key] = copyPropertiesFromResource(
|