screwdriver-api 8.0.43 → 8.0.45

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.43",
3
+ "version": "8.0.45",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,6 +6,7 @@ const schema = require('screwdriver-data-schema');
6
6
  const pipelineIdSchema = schema.models.pipeline.base.extract('id');
7
7
  const nameSchema = schema.models.stage.base.extract('name');
8
8
  const stageListSchema = schema.models.stage.list;
9
+ const STAGE_PR_PATTERN = `PR-%:%`;
9
10
 
10
11
  module.exports = () => ({
11
12
  method: 'GET',
@@ -21,7 +22,7 @@ module.exports = () => ({
21
22
 
22
23
  handler: async (request, h) => {
23
24
  const { pipelineFactory, stageFactory } = request.server.app;
24
- const { name, sort, sortBy, page, count } = request.query;
25
+ const { name, sort, sortBy, page, count, type } = request.query;
25
26
  const pipelineId = request.params.id;
26
27
 
27
28
  return pipelineFactory
@@ -36,6 +37,15 @@ module.exports = () => ({
36
37
  sort
37
38
  };
38
39
 
40
+ if (type === 'pr') {
41
+ config.search = {
42
+ field: 'name',
43
+ // Do a search for PR-%:% in stage name
44
+ // See https://www.w3schools.com/sql/sql_like.asp for syntax
45
+ keyword: STAGE_PR_PATTERN
46
+ };
47
+ }
48
+
39
49
  if (name) {
40
50
  config.params = {
41
51
  ...config.params,
@@ -74,6 +84,7 @@ module.exports = () => ({
74
84
  query: schema.api.pagination.concat(
75
85
  joi.object({
76
86
  name: nameSchema,
87
+ type: joi.string().valid('', 'pr').label('Stage type filter (pr)').optional(),
77
88
  search: joi.forbidden() // we don't support search for Pipeline list stages
78
89
  })
79
90
  )