screwdriver-api 8.0.81 → 8.0.83

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.81",
3
+ "version": "8.0.83",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -166,26 +166,22 @@ module.exports = () => ({
166
166
  }
167
167
 
168
168
  if (badges) {
169
- if (!oldPipeline.badges) {
170
- oldPipeline.badges = badges;
171
- } else {
172
- const updatedBadges = {
173
- ...oldPipeline.badges
174
- };
175
-
176
- Object.keys(badges).forEach(badgeKey => {
177
- if (Object.keys(badges[badgeKey]).length > 0) {
178
- updatedBadges[badgeKey] = badges[badgeKey];
179
- } else {
180
- delete updatedBadges[badgeKey];
181
- }
182
- });
169
+ const updatedBadges = {
170
+ ...oldPipeline.badges
171
+ };
183
172
 
184
- if (Object.keys(updatedBadges).length === 0) {
185
- delete oldPipeline.badges;
173
+ Object.keys(badges).forEach(badgeKey => {
174
+ if (Object.keys(badges[badgeKey]).length > 0) {
175
+ updatedBadges[badgeKey] = badges[badgeKey];
186
176
  } else {
187
- oldPipeline.badges = updatedBadges;
177
+ updatedBadges[badgeKey] = {};
188
178
  }
179
+ });
180
+
181
+ if (Object.keys(updatedBadges).length === 0) {
182
+ oldPipeline.badges = {};
183
+ } else {
184
+ oldPipeline.badges = updatedBadges;
189
185
  }
190
186
  }
191
187
 
@@ -15,8 +15,7 @@ const providerSchema = joi
15
15
  .string()
16
16
  .valid('all', 'none', 'branch', 'fork', 'all-admin', 'none-admin', 'branch-admin', 'fork-admin')
17
17
  .optional(),
18
- chainPR: joi.boolean().optional(),
19
- maxBytes: joi.number().integer().optional()
18
+ chainPR: joi.boolean().optional()
20
19
  })
21
20
  .unknown(false);
22
21
 
@@ -44,6 +43,7 @@ const webhooksPlugin = {
44
43
  joi.object().pattern(joi.string(), providerSchema).min(1).required(),
45
44
  'Invalid config for plugin-webhooks'
46
45
  );
46
+ const maxBytes = parseInt(options.maxBytes, 10) || DEFAULT_MAX_BYTES;
47
47
 
48
48
  server.route({
49
49
  method: 'POST',
@@ -58,7 +58,7 @@ const webhooksPlugin = {
58
58
  }
59
59
  },
60
60
  payload: {
61
- maxBytes: parseInt(pluginOptions.maxBytes, 10) || DEFAULT_MAX_BYTES,
61
+ maxBytes,
62
62
  parse: false,
63
63
  output: 'stream'
64
64
  },