Adds jobs endpoint protected by masterKey (#2560)
* Adds jobs endpoint protected by masterKey * Adds connection timeout for 15 minutes in jobs * Refactors pushStatusHandler into StatusHandler * Adds reporting of _JobStatus * Only accept strings as messages * Adds test for masterKey basic auth * Adds CloudCodeRouter for cloud_code endpoint of job status, enable Jobs feature on dashboard * xit racing test
This commit is contained in:
@@ -87,6 +87,14 @@ const defaultColumns = Object.freeze({
|
||||
"sentPerType": {type:'Object'},
|
||||
"failedPerType":{type:'Object'},
|
||||
},
|
||||
_JobStatus: {
|
||||
"jobName": {type: 'String'},
|
||||
"source": {type: 'String'},
|
||||
"status": {type: 'String'},
|
||||
"message": {type: 'String'},
|
||||
"params": {type: 'Object'}, // params received when calling the job
|
||||
"finishedAt": {type: 'Date'}
|
||||
},
|
||||
_Hooks: {
|
||||
"functionName": {type:'String'},
|
||||
"className": {type:'String'},
|
||||
@@ -104,9 +112,9 @@ const requiredColumns = Object.freeze({
|
||||
_Role: ["name", "ACL"]
|
||||
});
|
||||
|
||||
const systemClasses = Object.freeze(['_User', '_Installation', '_Role', '_Session', '_Product', '_PushStatus']);
|
||||
const systemClasses = Object.freeze(['_User', '_Installation', '_Role', '_Session', '_Product', '_PushStatus', '_JobStatus']);
|
||||
|
||||
const volatileClasses = Object.freeze(['_PushStatus', '_Hooks', '_GlobalConfig']);
|
||||
const volatileClasses = Object.freeze(['_JobStatus', '_PushStatus', '_Hooks', '_GlobalConfig']);
|
||||
|
||||
// 10 alpha numberic chars + uppercase
|
||||
const userIdRegex = /^[a-zA-Z0-9]{10}$/;
|
||||
@@ -275,7 +283,12 @@ const _PushStatusSchema = convertSchemaToAdapterSchema(injectDefaultSchema({
|
||||
fields: {},
|
||||
classLevelPermissions: {}
|
||||
}));
|
||||
const VolatileClassesSchemas = [_HooksSchema, _PushStatusSchema, _GlobalConfigSchema];
|
||||
const _JobStatusSchema = convertSchemaToAdapterSchema(injectDefaultSchema({
|
||||
className: "_JobStatus",
|
||||
fields: {},
|
||||
classLevelPermissions: {}
|
||||
}));
|
||||
const VolatileClassesSchemas = [_HooksSchema, _JobStatusSchema, _PushStatusSchema, _GlobalConfigSchema];
|
||||
|
||||
const dbTypeMatchesObjectType = (dbType, objectType) => {
|
||||
if (dbType.type !== objectType.type) return false;
|
||||
|
||||
Reference in New Issue
Block a user