All files / schemas/oada/service job.schema.cts

100% Statements 114/114
100% Branches 0/0
100% Functions 0/0
100% Lines 114/114

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 1151x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * @license
 * Copyright 2022 Open Ag Data Alliance
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 */
 
import type { JSONSchema8 as Schema } from 'jsonschema8';
 
const schema: Schema = {
  $id: 'https://formats.openag.io/oada/service/job.schema.json',
  $schema: 'http://json-schema.org/draft-07/schema#',
  description: 'The format for an @oada/jobs job queue job.',
  type: 'object',
  properties: {
    service: {
      description: 'Service name which job is for',
      type: 'string',
    },
    type: {
      description: 'Service specific identifier of job type',
      type: 'string',
    },
    config: {
      description: 'Job spceific configuration object',
      type: 'object',
    },
    result: {
      description: 'Final result of job',
      type: 'object',
    },
    status: {
      description: 'Current status of job',
      type: 'string',
    },
    updates: {
      description:
        'A list of updates as job progresses. Keys shall be sorted in time order.',
      type: 'object',
      additionalProperties: {
        $ref: './job/update.schema.json',
      },
    },
  },
  required: ['service', 'type'],
  examples: [
    {
      service: 'shares',
      type: 'trading-partner',
      config: {
        'resource': {
          _id: 'resources/TESTCOI1',
        },
        'trading-partner': {
          _id: 'resources/1b0yRTKhv21Rkbkt32PSokJOOrs_TP_LEGACYFARM',
        },
        'path':
          '/bookmarks/trellisfw/trading-partners/1b0yRTKhv21Rkbkt32PSokJOOrs_TP_LEGACYFARM/bookmarks/trellisfw/cois',
      },
      status: 'pending',
      updates: {
        '1bF4ELuQwqU3CjDOsn2NF0d7Deu': {
          status: 'started',
          time: '2018-11-14T20:20:39+00:00',
        },
        '1bF4GjXWJvj6FJEXCiAj8DatQTD': {
          status: 'pending',
          time: '2018-11-13T20:20:39+00:00',
          information: 'Share requires manual approval',
        },
      },
    },
    {
      service: 'shares',
      type: 'trading-partner',
      config: {
        'resource': {
          _id: 'resources/TESTCOI1',
        },
        'trading-partner': {
          _id: 'resources/1b0yRTKhv21Rkbkt32PSokJOOrs_TP_LEGACYFARM',
        },
        'path':
          '/bookmarks/trellisfw/trading-partners/1b0yRTKhv21Rkbkt32PSokJOOrs_TP_LEGACYFARM/bookmarks/trellisfw/cois',
      },
      status: 'success',
      results: {
        path: '/bookmarks/new/path',
      },
      updates: {
        '1bWH1wv07R4XEhwyK2T3wJ2kLMo': {
          status: 'success',
          time: '2018-11-15T20:20:39+00:00',
          information: {
            approved: 'john',
          },
        },
        '1bF4ELuQwqU3CjDOsn2NF0d7Deu': {
          status: 'started',
          time: '2018-11-14T20:20:39+00:00',
        },
        '1bF4GjXWJvj6FJEXCiAj8DatQTD': {
          status: 'pending',
          time: '2018-11-13T20:20:39+00:00',
          information: 'Share requires manual approval',
        },
      },
    },
  ],
};
 
export = schema;