job type and schema
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sebastian Frank 2022-02-21 10:23:11 +01:00
parent c4cd7b35fc
commit de02d51100
Signed by: apairon
GPG Key ID: A0E05A8199CE3F57
3 changed files with 73 additions and 1 deletions

32
index.d.ts vendored
View File

@ -68,6 +68,35 @@ interface PostHookData {
data?: CollectionDocument
}
interface JobConfig {
/**
* meta object
*/
meta?: any
/**
* cron job interval specification
*/
cron?: string
/**
* job program type
*/
type: "javascript"
/**
* jobs program file
*/
file?: string
}
interface JobData {
/**
* job is object of job config
*/
job?: JobConfig
}
interface DbPackage {
/**
* read results from a collection
@ -529,7 +558,8 @@ interface PdfPackage {
export interface HookContext
extends GetHookData,
GetHookGetOnlyData,
PostHookData {
PostHookData,
JobData {
request(): {
method: string
remoteAddr: string

View File

@ -34,6 +34,21 @@
}
]
}
},
"jobs": {
"type": "array",
"description": "list of jobs in this project",
"items": {
"oneOf": [
{
"$comment": "for include tag",
"type": "string"
},
{
"$ref": "job.json"
}
]
}
}
},
"required": ["namespace"]

View File

@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "JSON Schema WMBasic cronjob configuration",
"description": "WMBasic cronjob linter",
"type": "object",
"additionalProperties": false,
"properties": {
"meta": {
"type": "object",
"description": "meta object used to pass parameters to identify cronjob",
"additionalProperties": true
},
"cron": {
"type": "string",
"description": "cronjob time/interval specification"
},
"type": {
"const": "javascript",
"description": "type of job"
},
"file": {
"type": "string",
"description": "javascript file relative to config.yml"
}
},
"required": ["type", "file"]
}