@mdf.js/openc2-core
Version:
MMS - API Core - OpenC2
72 lines • 2.64 kB
JavaScript
"use strict";
/**
* Copyright 2024 Mytra Control S.L. All rights reserved.
*
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.commandMessage = exports.responseMessage = exports.message = void 0;
const commonProperties = {
content_type: { $ref: 'control.message.contentType.schema.json#' },
status: { $ref: 'control.message.status.schema.json#' },
request_id: { $ref: 'control.message.requestId.schema.json#' },
created: { $ref: 'control.message.created.schema.json#' },
from: { $ref: 'control.message.from.schema.json#' },
to: { $ref: 'control.message.to.schema.json#' },
};
const schema = 'http://json-schema.org/draft-07/schema#';
exports.message = {
$schema: schema,
$id: 'control.message.schema.json',
title: 'Command and control message schema',
type: 'object',
discriminator: { propertyName: 'msg_type' },
oneOf: [
{
properties: {
...commonProperties,
content: { $ref: 'control.message.content.command.schema.json#' },
msg_type: { const: 'command' },
},
required: ['content_type', 'msg_type', 'created', 'content'],
additionalProperties: false,
},
{
properties: {
...commonProperties,
content: { $ref: 'control.message.content.response.schema.json#' },
msg_type: { const: 'response' },
},
required: ['content_type', 'msg_type', 'created', 'content'],
additionalProperties: false,
},
],
};
exports.responseMessage = {
$schema: schema,
$id: 'control.response_message.schema.json',
title: 'Response message schema',
type: 'object',
properties: {
...commonProperties,
content: { $ref: 'control.message.content.response.schema.json#' },
msg_type: { const: 'response' },
},
required: ['content_type', 'msg_type', 'created', 'content'],
additionalProperties: false,
};
exports.commandMessage = {
$schema: schema,
$id: 'control.command_message.schema.json',
title: 'Command message schema',
type: 'object',
properties: {
...commonProperties,
content: { $ref: 'control.message.content.command.schema.json#' },
msg_type: { const: 'command' },
},
required: ['content_type', 'msg_type', 'created', 'content'],
additionalProperties: false,
};
//# sourceMappingURL=message.schema.js.map