screwdriver-data-schema 21.28.4 → 22.0.1

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.
@@ -27,11 +27,7 @@ const CREATE_MODEL = {
27
27
  };
28
28
 
29
29
  const MODEL = {
30
- id: Joi.number()
31
- .integer()
32
- .positive()
33
- .description('Identifier of this pipeline')
34
- .example(123345),
30
+ id: Joi.number().integer().positive().description('Identifier of this pipeline').example(123345),
35
31
 
36
32
  name: Scm.repoName.optional(),
37
33
 
@@ -50,23 +46,15 @@ const MODEL = {
50
46
 
51
47
  scmRepo: Scm.repo,
52
48
 
53
- createTime: Joi.string()
54
- .isoDate()
55
- .description('When this pipeline was created'),
49
+ createTime: Joi.string().isoDate().description('When this pipeline was created'),
56
50
 
57
- admins: Joi.object()
58
- .description('Admins of this Pipeline')
59
- .example({ myself: true }),
51
+ admins: Joi.object().description('Admins of this Pipeline').example({ myself: true }),
60
52
 
61
53
  workflowGraph: WorkflowGraph.workflowGraph.description('Graph representation of the workflow'),
62
54
 
63
55
  annotations: Annotations.annotations.description('Pipeline-level annotations'),
64
56
 
65
- lastEventId: Joi.number()
66
- .integer()
67
- .positive()
68
- .description('Identifier of last event')
69
- .example(123345),
57
+ lastEventId: Joi.number().integer().positive().description('Identifier of last event').example(123345),
70
58
 
71
59
  configPipelineId: Joi.number()
72
60
  .integer()
package/models/secret.js CHANGED
@@ -5,23 +5,13 @@ const mutate = require('../lib/mutate');
5
5
  const Job = require('../config/job');
6
6
 
7
7
  const MODEL = {
8
- id: Joi.number()
9
- .integer()
10
- .positive()
11
- .description('Identifier of this secret')
12
- .example(123345),
8
+ id: Joi.number().integer().positive().description('Identifier of this secret').example(123345),
13
9
 
14
- pipelineId: Joi.number()
15
- .integer()
16
- .positive()
17
- .description('pipeline associated with the secret')
18
- .example(123345),
10
+ pipelineId: Joi.number().integer().positive().description('pipeline associated with the secret').example(123345),
19
11
 
20
12
  name: Job.secret.description('Name of the secret').example('NPM_TOKEN'),
21
13
 
22
- value: Joi.string()
23
- .description('value of the secret')
24
- .example('2d991790bab1ac8576097ca87f170df73410b55c'),
14
+ value: Joi.string().description('value of the secret').example('2d991790bab1ac8576097ca87f170df73410b55c'),
25
15
 
26
16
  allowInPR: Joi.boolean().description('flag to denote if the secret can be shown in PR builds')
27
17
  };
package/models/stage.js CHANGED
@@ -4,43 +4,19 @@ const Joi = require('joi');
4
4
  const Regex = require('../config/regex');
5
5
 
6
6
  const MODEL = {
7
- id: Joi.number()
8
- .integer()
9
- .positive()
10
- .example(12345),
7
+ id: Joi.number().integer().positive().example(12345),
11
8
 
12
- pipelineId: Joi.number()
13
- .integer()
14
- .positive()
15
- .description('Pipeline associated with the Stage')
16
- .example(123345),
9
+ pipelineId: Joi.number().integer().positive().description('Pipeline associated with the Stage').example(123345),
17
10
 
18
- name: Joi.string()
19
- .regex(Regex.STAGE_NAME)
20
- .max(110)
21
- .description('Name of the Stage')
22
- .example('deploy'),
11
+ name: Joi.string().regex(Regex.STAGE_NAME).max(110).description('Name of the Stage').example('deploy'),
23
12
 
24
13
  jobIds: Joi.array()
25
- .items(
26
- Joi.number()
27
- .integer()
28
- .positive()
29
- .description('Identifier for this job')
30
- .example(123345)
31
- )
14
+ .items(Joi.number().integer().positive().description('Identifier for this job').example(123345))
32
15
  .description('Job IDs in this Stage'),
33
16
 
34
- description: Joi.string()
35
- .max(256)
36
- .description('Description of the Stage')
37
- .example('Deploys canary jobs'),
17
+ description: Joi.string().max(256).description('Description of the Stage').example('Deploys canary jobs'),
38
18
 
39
- groupEventId: Joi.number()
40
- .integer()
41
- .positive()
42
- .description('Identifier of the group event')
43
- .example(123345)
19
+ groupEventId: Joi.number().integer().positive().description('Identifier of the group event').example(123345)
44
20
  };
45
21
 
46
22
  module.exports = {
package/models/step.js CHANGED
@@ -4,46 +4,24 @@ const Joi = require('joi');
4
4
  const mutate = require('../lib/mutate');
5
5
 
6
6
  const MODEL = {
7
- id: Joi.number()
8
- .integer()
9
- .positive()
10
- .description('Identifier of this Step')
11
- .example(123345),
12
-
13
- buildId: Joi.number()
14
- .integer()
15
- .positive()
16
- .description('Identifier of the parent Build')
17
- .example(123345),
18
-
19
- name: Joi.string()
20
- .max(64)
21
- .description('Name of the Step')
22
- .example('install'),
23
-
24
- command: Joi.string()
25
- .description('Command of the Step to execute')
26
- .example('npm install'),
27
-
28
- code: Joi.number()
29
- .integer()
30
- .description('Exit code')
31
- .example(1),
32
-
33
- startTime: Joi.string()
34
- .isoDate()
35
- .description('When this Step started')
36
- .example('2017-01-06T01:49:50.384359267Z'),
7
+ id: Joi.number().integer().positive().description('Identifier of this Step').example(123345),
8
+
9
+ buildId: Joi.number().integer().positive().description('Identifier of the parent Build').example(123345),
10
+
11
+ name: Joi.string().max(64).description('Name of the Step').example('install'),
12
+
13
+ command: Joi.string().description('Command of the Step to execute').example('npm install'),
14
+
15
+ code: Joi.number().integer().description('Exit code').example(1),
16
+
17
+ startTime: Joi.string().isoDate().description('When this Step started').example('2017-01-06T01:49:50.384359267Z'),
37
18
 
38
19
  endTime: Joi.string()
39
20
  .isoDate()
40
21
  .description('When this Step stopped running')
41
22
  .example('2017-01-06T01:49:51.676057192Z'),
42
23
 
43
- lines: Joi.number()
44
- .integer()
45
- .description('Number of Step log lines')
46
- .example(100)
24
+ lines: Joi.number().integer().description('Number of Step log lines').example(100)
47
25
  };
48
26
 
49
27
  module.exports = {
@@ -6,20 +6,10 @@ const Template = require('../config/template');
6
6
  const pipelineId = require('./pipeline').base.extract('id');
7
7
 
8
8
  const MODEL = {
9
- id: Joi.number()
10
- .integer()
11
- .positive()
12
- .description('Identifier of this template')
13
- .example(123345),
14
- labels: Joi.array()
15
- .items(Joi.string())
16
- .description('Labels for template')
17
- .example(['stable', 'latest', 'beta']),
9
+ id: Joi.number().integer().positive().description('Identifier of this template').example(123345),
10
+ labels: Joi.array().items(Joi.string()).description('Labels for template').example(['stable', 'latest', 'beta']),
18
11
  config: Template.config,
19
- name: Joi.string()
20
- .max(64)
21
- .description('Template name')
22
- .example('nodejs/lib'),
12
+ name: Joi.string().max(64).description('Template name').example('nodejs/lib'),
23
13
  version: Template.version,
24
14
  description: Template.description,
25
15
  maintainer: Template.maintainer,
@@ -4,21 +4,14 @@ const Joi = require('joi');
4
4
  const Template = require('../config/template');
5
5
 
6
6
  const MODEL = {
7
- id: Joi.number()
8
- .integer()
9
- .positive()
10
- .description('Identifier of this template tag')
11
- .example(123345),
7
+ id: Joi.number().integer().positive().description('Identifier of this template tag').example(123345),
12
8
  createTime: Joi.string()
13
9
  .isoDate()
14
10
  .max(32)
15
11
  .description('When this template tag was created')
16
12
  .example('2038-01-19T03:14:08.131Z'),
17
13
  namespace: Template.namespace,
18
- name: Joi.string()
19
- .max(64)
20
- .description('Template name')
21
- .example('nodejs/lib'),
14
+ name: Joi.string().max(64).description('Template name').example('nodejs/lib'),
22
15
  tag: Template.templateTag,
23
16
  version: Template.exactVersion
24
17
  };
package/models/token.js CHANGED
@@ -9,9 +9,7 @@ const HASH_LENGTH = 512;
9
9
  const HASH_BASE64_LENGTH = Math.ceil(HASH_LENGTH / 6);
10
10
 
11
11
  const MODEL = {
12
- id: Joi.number()
13
- .integer()
14
- .positive(),
12
+ id: Joi.number().integer().positive(),
15
13
 
16
14
  hash: Joi.string()
17
15
  // Using https://www.npmjs.com/package/base64url
@@ -19,21 +17,11 @@ const MODEL = {
19
17
  .length(HASH_BASE64_LENGTH)
20
18
  .description('Hashed token value'),
21
19
 
22
- userId: Joi.number()
23
- .integer()
24
- .positive()
25
- .description('User ID'),
20
+ userId: Joi.number().integer().positive().description('User ID'),
26
21
 
27
- pipelineId: Joi.number()
28
- .integer()
29
- .positive()
30
- .description('Pipeline ID')
31
- .example(123345),
22
+ pipelineId: Joi.number().integer().positive().description('Pipeline ID').example(123345),
32
23
 
33
- name: Joi.string()
34
- .max(128)
35
- .description('Token name')
36
- .example('Mobile token'),
24
+ name: Joi.string().max(128).description('Token name').example('Mobile token'),
37
25
 
38
26
  description: Joi.string()
39
27
  .max(256)
@@ -41,10 +29,7 @@ const MODEL = {
41
29
  .description('Token description')
42
30
  .example('Used to authenticate the mobile app'),
43
31
 
44
- lastUsed: Joi.string()
45
- .isoDate()
46
- .allow('')
47
- .description('Last used')
32
+ lastUsed: Joi.string().isoDate().allow('').description('Last used')
48
33
  };
49
34
 
50
35
  module.exports = {
@@ -54,9 +39,7 @@ module.exports = {
54
39
  * @property base
55
40
  * @type {Joi}
56
41
  */
57
- base: Joi.object(MODEL)
58
- .without('userId', 'pipelineId')
59
- .label('Token'),
42
+ base: Joi.object(MODEL).without('userId', 'pipelineId').label('Token'),
60
43
 
61
44
  /**
62
45
  * All the available properties of Job
package/models/trigger.js CHANGED
@@ -4,30 +4,19 @@ const Joi = require('joi');
4
4
  const Regex = require('../config/regex');
5
5
 
6
6
  const MODEL = {
7
- id: Joi.number()
8
- .integer()
9
- .positive()
10
- .example(12345),
7
+ id: Joi.number().integer().positive().example(12345),
11
8
 
12
9
  src: Joi.alternatives()
13
10
  .try(
14
- Joi.string()
15
- .regex(Regex.EXTERNAL_TRIGGER)
16
- .max(128),
17
- Joi.string()
18
- .regex(Regex.EXTERNAL_TRIGGER_AND)
19
- .max(128)
11
+ Joi.string().regex(Regex.EXTERNAL_TRIGGER).max(128),
12
+ Joi.string().regex(Regex.EXTERNAL_TRIGGER_AND).max(128)
20
13
  )
21
14
  .example('~sd@1234:component'),
22
15
 
23
16
  dest: Joi.alternatives()
24
17
  .try(
25
- Joi.string()
26
- .regex(Regex.EXTERNAL_TRIGGER)
27
- .max(128),
28
- Joi.string()
29
- .regex(Regex.EXTERNAL_TRIGGER_AND)
30
- .max(128)
18
+ Joi.string().regex(Regex.EXTERNAL_TRIGGER).max(128),
19
+ Joi.string().regex(Regex.EXTERNAL_TRIGGER_AND).max(128)
31
20
  )
32
21
  .example('~sd@5678:test')
33
22
  };
package/models/user.js CHANGED
@@ -7,16 +7,9 @@ const scmContext = pipelineBaseSchema.extract('scmContext');
7
7
  const Settings = require('../config/settings');
8
8
 
9
9
  const MODEL = {
10
- id: Joi.number()
11
- .integer()
12
- .positive()
13
- .description('Identifier of this user')
14
- .example(123345),
10
+ id: Joi.number().integer().positive().description('Identifier of this user').example(123345),
15
11
 
16
- username: Joi.string()
17
- .max(128)
18
- .description('Username')
19
- .example('batman123'),
12
+ username: Joi.string().max(128).description('Username').example('batman123'),
20
13
 
21
14
  token: Joi.string().description('Github token'),
22
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "21.28.4",
3
+ "version": "22.0.1",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,22 +40,22 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "chai": "^4.3.6",
43
- "eslint": "^7.32.0",
44
- "eslint-config-screwdriver": "^5.0.1",
45
- "js-yaml": "^3.14.1",
46
- "mocha": "^9.2.0",
43
+ "eslint": "^8.27.0",
44
+ "eslint-config-screwdriver": "^7.0.0",
45
+ "js-yaml": "^4.1.0",
46
+ "mocha": "^10.1.0",
47
47
  "mocha-multi-reporters": "^1.5.1",
48
48
  "mocha-sonarqube-reporter": "^1.0.2",
49
49
  "mysql2": "^1.7.0",
50
50
  "npx": "^10.2.2",
51
- "nyc": "^15.0.0",
51
+ "nyc": "^15.1.0",
52
52
  "pg": "^7.18.2",
53
- "sequelize": "^6.24.0",
54
- "sequelize-cli": "^6.5.1",
55
- "sqlite3": "^4.2.0"
53
+ "sequelize": "^6.25.3",
54
+ "sequelize-cli": "^6.5.2",
55
+ "sqlite3": "^5.1.2"
56
56
  },
57
57
  "dependencies": {
58
- "cron-parser": "^4.5.0",
59
- "joi": "^17.6.2"
58
+ "cron-parser": "^4.6.0",
59
+ "joi": "^17.7.0"
60
60
  }
61
61
  }
@@ -4,18 +4,13 @@ const Joi = require('joi');
4
4
  const table = Joi.string().required();
5
5
  const SCHEMA_ID = Joi.object().keys({
6
6
  table,
7
- params: Joi.object()
8
- .min(1)
9
- .required()
7
+ params: Joi.object().min(1).required()
10
8
  });
11
9
  const SCHEMA_UPDATE = Joi.object().keys({
12
10
  table,
13
11
  params: Joi.object()
14
12
  .keys({
15
- id: Joi.number()
16
- .integer()
17
- .positive()
18
- .required()
13
+ id: Joi.number().integer().positive().required()
19
14
  })
20
15
  .unknown(true)
21
16
  .min(2)
@@ -23,48 +18,25 @@ const SCHEMA_UPDATE = Joi.object().keys({
23
18
  });
24
19
  const SCHEMA_SAVE = Joi.object().keys({
25
20
  table,
26
- params: Joi.object()
27
- .unknown(true)
28
- .min(1)
29
- .required()
21
+ params: Joi.object().unknown(true).min(1).required()
30
22
  });
31
- const SCHEMA_SEARCH_FIELD = Joi.string()
32
- .max(100)
33
- .required();
34
- const SCHEMA_SEARCH_KEYWORD = Joi.alternatives().try(
35
- Joi.string()
36
- .max(200)
37
- .required(),
38
- Joi.number().required()
39
- );
23
+ const SCHEMA_SEARCH_FIELD = Joi.string().max(100).required();
24
+ const SCHEMA_SEARCH_KEYWORD = Joi.alternatives().try(Joi.string().max(200).required(), Joi.number().required());
40
25
  const SCHEMA_SCAN = Joi.object().keys({
41
26
  table,
42
27
  params: Joi.object(),
43
28
  paginate: Joi.object().keys({
44
- count: Joi.number()
45
- .integer()
46
- .positive()
47
- .required(),
48
- page: Joi.number()
49
- .integer()
50
- .positive()
51
- .required()
29
+ count: Joi.number().integer().positive().required(),
30
+ page: Joi.number().integer().positive().required()
52
31
  }),
53
32
  search: Joi.object().keys({
54
33
  field: Joi.alternatives().try(Joi.array().items(SCHEMA_SEARCH_FIELD), SCHEMA_SEARCH_FIELD),
55
34
  keyword: Joi.alternatives().try(Joi.array().items(SCHEMA_SEARCH_KEYWORD), SCHEMA_SEARCH_KEYWORD)
56
35
  }),
57
- sort: Joi.string()
58
- .lowercase()
59
- .valid('ascending', 'descending')
60
- .default('descending'),
36
+ sort: Joi.string().lowercase().valid('ascending', 'descending').default('descending'),
61
37
  sortBy: Joi.string().max(100),
62
- exclude: Joi.array()
63
- .items(Joi.string().max(100))
64
- .max(100),
65
- groupBy: Joi.array()
66
- .items(Joi.string().max(100))
67
- .max(100),
38
+ exclude: Joi.array().items(Joi.string().max(100)).max(100),
39
+ groupBy: Joi.array().items(Joi.string().max(100)).max(100),
68
40
  startTime: Joi.string().isoDate(),
69
41
  endTime: Joi.string().isoDate(),
70
42
  timeKey: Joi.string(),
@@ -38,17 +38,10 @@ const buildSchemaObj = {
38
38
  pipelineId,
39
39
  buildClusterName: models.buildCluster.base.extract('name'),
40
40
  container: models.build.base.extract('container').required(),
41
- apiUri: Joi.string()
42
- .uri()
43
- .required()
44
- .label('API URI'),
45
- token: Joi.string()
46
- .required()
47
- .label('Build JWT'),
41
+ apiUri: Joi.string().uri().required().label('API URI'),
42
+ token: Joi.string().required().label('Build JWT'),
48
43
  enqueueTime: Joi.date().iso(),
49
- isPR: Joi.boolean()
50
- .optional()
51
- .default(true),
44
+ isPR: Joi.boolean().optional().default(true),
52
45
  prParentJobId: jobId.optional()
53
46
  };
54
47
  const SCHEMA_START = Joi.object()
@@ -66,10 +59,7 @@ const SCHEMA_STOP = Joi.object()
66
59
  token: Joi.string().label('Build JWT'),
67
60
  pipelineId,
68
61
  provider: Provider.provider.optional(),
69
- apiUri: Joi.string()
70
- .uri()
71
- .required()
72
- .label('API URI'),
62
+ apiUri: Joi.string().uri().required().label('API URI'),
73
63
  jobName
74
64
  })
75
65
  .unknown(true) // allow other fields
@@ -3,9 +3,7 @@
3
3
  const Joi = require('joi');
4
4
  const STATUSES = require('../models/build').allStatuses;
5
5
  const SCHEMA_STATUS = Joi.string().valid(...STATUSES);
6
- const SCHEMA_BUILD_SETTINGS = Joi.object()
7
- .keys({})
8
- .unknown(true);
6
+ const SCHEMA_BUILD_SETTINGS = Joi.object().keys({}).unknown(true);
9
7
  const SCHEMA_SCM_REPO = Joi.object()
10
8
  .keys({
11
9
  name: Joi.string().required()
@@ -23,9 +21,7 @@ const SCHEMA_BUILD_DATA = {
23
21
  jobName: Joi.string(),
24
22
  build: Joi.object()
25
23
  .keys({
26
- id: Joi.number()
27
- .integer()
28
- .required()
24
+ id: Joi.number().integer().required()
29
25
  })
30
26
  .unknown(true),
31
27
  event: Joi.object(),
package/plugins/scm.js CHANGED
@@ -10,10 +10,7 @@ const checkoutUrl = models.pipeline.create.extract('checkoutUrl').required();
10
10
  const hook = core.scm.hook.required();
11
11
  const jobName = models.job.base.extract('name').optional();
12
12
  const pipelineId = models.pipeline.base.extract('id').optional();
13
- const prNum = core.scm.hook
14
- .extract('prNum')
15
- .allow(null)
16
- .optional();
13
+ const prNum = core.scm.hook.extract('prNum').allow(null).optional();
17
14
  const rootDir = Scm.rootDir.optional();
18
15
  const scmContext = models.pipeline.base.extract('scmContext').optional();
19
16
  const scmRepo = Scm.repo.optional();
@@ -128,17 +125,11 @@ const UPDATE_COMMIT_STATUS = Joi.object()
128
125
  .required()
129
126
  .valid(...SCM_STATUSES),
130
127
  jobName,
131
- url: Joi.string()
132
- .uri()
133
- .required(),
128
+ url: Joi.string().uri().required(),
134
129
  pipelineId,
135
130
  scmContext,
136
- context: Joi.string()
137
- .max(100)
138
- .optional(),
139
- description: Joi.string()
140
- .max(200)
141
- .optional()
131
+ context: Joi.string().max(100).optional(),
132
+ description: Joi.string().max(200).optional()
142
133
  })
143
134
  .required();
144
135
 
@@ -156,9 +147,7 @@ const GET_FILE = Joi.object()
156
147
  const GET_CHANGED_FILES_INPUT = Joi.object()
157
148
  .keys({
158
149
  type,
159
- webhookConfig: Joi.object()
160
- .allow(null)
161
- .required(),
150
+ webhookConfig: Joi.object().allow(null).required(),
162
151
  token,
163
152
  scmContext,
164
153
  scmUri: scmUri.optional(),
@@ -166,12 +155,7 @@ const GET_CHANGED_FILES_INPUT = Joi.object()
166
155
  })
167
156
  .required();
168
157
 
169
- const GET_CHANGED_FILES_OUTPUT = Joi.alternatives().try(
170
- Joi.array()
171
- .items(Joi.string())
172
- .required(),
173
- null
174
- );
158
+ const GET_CHANGED_FILES_OUTPUT = Joi.alternatives().try(Joi.array().items(Joi.string()).required(), null);
175
159
 
176
160
  const PARSE_HOOK = Joi.alternatives().try(hook, null);
177
161