hat.mariner.common

 1import importlib.resources
 2
 3from hat import json
 4
 5
 6with importlib.resources.as_file(importlib.resources.files(__package__) /
 7                                 'json_schema_repo.json') as _path:
 8    json_schema_repo: json.SchemaRepository = json.merge_schema_repositories(
 9        json.json_schema_repo,
10        json.decode_file(_path))
11    """JSON schema repository"""
json_schema_repo: dict[str, typing.Dict[str, ForwardRef('Data')]] = {'hat-json://path.yaml': {'$schema': 'https://json-schema.org/draft/2020-12/schema', '$id': 'hat-json://path.yaml', 'title': 'JSON Path', 'oneOf': [{'type': 'string'}, {'type': 'integer'}, {'type': 'array', 'items': {'$ref': 'hat-json://path.yaml'}}]}, 'hat-json://logging.yaml': {'$schema': 'https://json-schema.org/draft/2020-12/schema', '$id': 'hat-json://logging.yaml', 'title': 'Logging', 'description': 'Logging configuration', 'type': 'object', 'required': ['version'], 'properties': {'version': {'title': 'Version', 'type': 'integer', 'default': 1}, 'formatters': {'title': 'Formatters', 'type': 'object', 'patternProperties': {'.+': {'title': 'Formatter', 'type': 'object', 'properties': {'format': {'title': 'Format', 'type': 'string', 'default': None}, 'datefmt': {'title': 'Date format', 'type': 'string', 'default': None}}}}}, 'filters': {'title': 'Filters', 'type': 'object', 'patternProperties': {'.+': {'title': 'Filter', 'type': 'object', 'properties': {'name': {'title': 'Logger name', 'type': 'string', 'default': ''}}}}}, 'handlers': {'title': 'Handlers', 'type': 'object', 'patternProperties': {'.+': {'title': 'Handler', 'type': 'object', 'description': 'Additional properties are passed as keyword arguments to\nconstructor\n', 'required': ['class'], 'properties': {'class': {'title': 'Class', 'type': 'string'}, 'level': {'title': 'Level', 'type': 'string'}, 'formatter': {'title': 'Formatter', 'type': 'string'}, 'filters': {'title': 'Filters', 'type': 'array', 'items': {'title': 'Filter id', 'type': 'string'}}}}}}, 'loggers': {'title': 'Loggers', 'type': 'object', 'patternProperties': {'.+': {'title': 'Logger', 'type': 'object', 'properties': {'level': {'title': 'Level', 'type': 'string'}, 'propagate': {'title': 'Propagate', 'type': 'boolean'}, 'filters': {'title': 'Filters', 'type': 'array', 'items': {'title': 'Filter id', 'type': 'string'}}, 'handlers': {'title': 'Handlers', 'type': 'array', 'items': {'title': 'Handler id', 'type': 'string'}}}}}}, 'root': {'title': 'Root logger', 'type': 'object', 'properties': {'level': {'title': 'Level', 'type': 'string'}, 'filters': {'title': 'Filters', 'type': 'array', 'items': {'title': 'Filter id', 'type': 'string'}}, 'handlers': {'title': 'Handlers', 'type': 'array', 'items': {'title': 'Handler id', 'type': 'string'}}}}, 'incremental': {'title': 'Incremental configuration', 'type': 'boolean', 'default': False}, 'disable_existing_loggers': {'title': 'Disable existing loggers', 'type': 'boolean', 'default': True}}}, 'hat-mariner://server.yaml': {'$schema': 'https://json-schema.org/draft/2020-12/schema', '$id': 'hat-mariner://server.yaml', 'title': 'Mariner Server', 'description': "Mariner Server's configuration", 'type': 'object', 'required': ['name', 'mariner', 'eventer', 'clients'], 'properties': {'type': {'const': 'mariner', 'description': 'configuration type identification'}, 'version': {'type': 'string', 'description': 'component version'}, 'log': {'$ref': 'hat-json://logging.yaml'}, 'name': {'type': 'string', 'description': 'component name'}, 'mariner': {'type': 'object', 'required': ['host', 'port'], 'properties': {'host': {'type': 'string', 'default': '127.0.0.1'}, 'port': {'type': 'integer', 'default': 23014}}}, 'eventer': {'type': 'object', 'required': ['host', 'port', 'token'], 'properties': {'host': {'type': 'string', 'default': '127.0.0.1'}, 'port': {'type': 'integer', 'default': 23012}, 'token': {'type': ['null', 'string']}}}, 'clients': {'type': 'array', 'items': {'type': 'object', 'required': ['name', 'token', 'subscriptions'], 'properties': {'name': {'type': 'string'}, 'token': {'type': ['null', 'string']}, 'subscriptions': {'type': 'array', 'items': {'type': 'array', 'items': {'type': 'string'}}}}}}}}, 'hat-mariner://mariner.yaml': {'$schema': 'https://json-schema.org/draft/2020-12/schema', '$id': 'hat-mariner://mariner.yaml', 'title': 'Mariner communication messages', 'oneOf': [{'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/init_req'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/init_res'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/status'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/events'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/register_req'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/register_res'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/query_req'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/query_res'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/ping_req'}, {'$ref': 'hat-mariner://mariner.yaml#/$defs/messages/ping_res'}], '$defs': {'messages': {'init_req': {'type': 'object', 'required': ['msg_type', 'client_name', 'client_token', 'subscriptions', 'server_id', 'persisted'], 'properties': {'msg_type': {'const': 'init_req'}, 'client_name': {'type': 'string'}, 'client_token': {'type': ['string', 'null']}, 'subscriptions': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_type'}}, 'server_id': {'type': ['integer', 'null']}, 'persisted': {'type': 'boolean'}}}, 'init_res': {'oneOf': [{'type': 'object', 'required': ['msg_type', 'success', 'status'], 'properties': {'msg_type': {'const': 'init_res'}, 'success': {'const': True}, 'status': {'$ref': 'hat-mariner://mariner.yaml#/$defs/status'}}}, {'type': 'object', 'required': ['msg_type', 'success', 'error'], 'properties': {'msg_type': {'const': 'init_res'}, 'success': {'const': False}, 'error': {'type': 'string'}}}]}, 'status': {'type': 'object', 'required': ['msg_type', 'status'], 'properties': {'msg_type': {'const': 'status'}, 'status': {'$ref': 'hat-mariner://mariner.yaml#/$defs/status'}}}, 'events': {'type': 'object', 'required': ['msg_type', 'events'], 'properties': {'msg_type': {'const': 'events'}, 'events': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event'}}}}, 'register_req': {'type': 'object', 'required': ['msg_type', 'register_id', 'register_events'], 'properties': {'msg_type': {'const': 'register_req'}, 'register_id': {'type': 'integer'}, 'register_events': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/register_event'}}}}, 'register_res': {'oneOf': [{'type': 'object', 'required': ['msg_type', 'register_id', 'success', 'events'], 'properties': {'msg_type': {'const': 'register_res'}, 'register_id': {'type': 'integer'}, 'success': {'const': True}, 'events': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event'}}}}, {'type': 'object', 'required': ['msg_type', 'register_id', 'success'], 'properties': {'msg_type': {'const': 'register_res'}, 'register_id': {'type': 'integer'}, 'success': {'const': False}}}]}, 'query_req': {'oneOf': [{'type': 'object', 'required': ['msg_type', 'query_id', 'query_type'], 'properties': {'msg_type': {'const': 'query_req'}, 'query_id': {'type': 'integer'}, 'query_type': {'const': 'latest'}, 'event_types': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_type'}}}}, {'type': 'object', 'required': ['msg_type', 'query_id', 'query_type', 'order', 'order_by'], 'properties': {'msg_type': {'const': 'query_req'}, 'query_id': {'type': 'integer'}, 'query_type': {'const': 'timeseries'}, 'event_types': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_type'}}, 't_from': {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}, 't_to': {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}, 'source_t_from': {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}, 'source_t_to': {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}, 'order': {'$ref': 'hat-mariner://mariner.yaml#/$defs/order'}, 'order_by': {'$ref': 'hat-mariner://mariner.yaml#/$defs/order_by'}, 'max_results': {'type': 'integer'}, 'last_event_id': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_id'}}}, {'type': 'object', 'required': ['msg_type', 'query_id', 'query_type', 'server_id', 'persisted'], 'properties': {'msg_type': {'const': 'query_req'}, 'query_id': {'type': 'integer'}, 'query_type': {'const': 'server'}, 'server_id': {'type': 'integer'}, 'persisted': {'type': 'boolean'}, 'max_results': {'type': 'integer'}, 'last_event_id': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_id'}}}]}, 'query_res': {'type': 'object', 'required': ['msg_type', 'query_id', 'events', 'more_follows'], 'properties': {'msg_type': {'const': 'query_res'}, 'query_id': {'type': 'integer'}, 'events': {'type': 'array', 'items': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event'}}, 'more_follows': {'type': 'boolean'}}}, 'ping_req': {'type': 'object', 'required': ['msg_type', 'ping_id'], 'properties': {'msg_type': {'const': 'ping_req'}, 'ping_id': {'type': 'integer'}}}, 'ping_res': {'type': 'object', 'required': ['msg_type', 'ping_id'], 'properties': {'msg_type': {'const': 'ping_res'}, 'ping_id': {'type': 'integer'}}}}, 'status': {'enum': ['STANDBY', 'OPERATIONAL']}, 'timestamp': {'type': 'object', 'required': ['s', 'us'], 'properties': {'s': {'type': 'integer'}, 'us': {'type': 'integer'}}}, 'event_id': {'type': 'object', 'required': ['server', 'session', 'instance'], 'properties': {'server': {'type': 'integer'}, 'session': {'type': 'integer'}, 'instance': {'type': 'integer'}}}, 'order': {'enum': ['DESCENDING', 'ASCENDING']}, 'order_by': {'enum': ['TIMESTAMP', 'SOURCE_TIMESTAMP']}, 'event_type': {'type': 'array', 'items': {'type': 'string'}}, 'payload': {'oneOf': [{'type': 'object', 'required': ['payload_type', 'data_type', 'data'], 'properties': {'payload_type': {'const': 'binary'}, 'data_type': {'type': 'string'}, 'data': {'type': 'string'}}}, {'type': 'object', 'required': ['payload_type', 'data'], 'properties': {'payload_type': {'const': 'json'}}}]}, 'event': {'type': 'object', 'required': ['id', 'type', 'timestamp', 'source_timestamp', 'payload'], 'properties': {'id': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_id'}, 'type': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_type'}, 'timestamp': {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}, 'source_timestamp': {'oneOf': ['null', {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}]}, 'payload': {'oneOf': ['null', {'$ref': 'hat-mariner://mariner.yaml#/$defs/payload'}]}}}, 'register_event': {'type': 'object', 'required': ['type', 'source_timestamp', 'payload'], 'properties': {'type': {'$ref': 'hat-mariner://mariner.yaml#/$defs/event_type'}, 'source_timestamp': {'oneOf': ['null', {'$ref': 'hat-mariner://mariner.yaml#/$defs/timestamp'}]}, 'payload': {'oneOf': ['null', {'$ref': 'hat-mariner://mariner.yaml#/$defs/payload'}]}}}}}}