/** * This is the format of an OADA websocket change notification (server to client) * * * File automatically generated using json-schema-to-typescript. * ! DO NOT MODIFY IT BY HAND ! * Instead, modify the source file ./oada/websockets/change.schema.json of @oada/formats * and run `$ yarn build` to regenerate this file. * * @packageDocumentation */ /** * `$id` of the source schema * @see {@link https://formats.openag.io/oada/websockets/change.schema.json} */ export declare const $id = "https://formats.openag.io/oada/websockets/change.schema.json"; /** * JSON Schema used to generate this type * @see {@link https://formats.openag.io/oada/websockets/change.schema.json} */ export declare const schema: { readonly $id: "https://formats.openag.io/oada/websockets/change.schema.json"; readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly title: "Websocket change representation"; readonly description: "This is the format of an OADA websocket change notification (server to client)"; readonly definitions: { readonly id: { readonly description: "The id a WATCH request"; readonly $ref: "request.schema.json#/properties/requestId"; }; }; readonly type: "object"; readonly required: readonly ["requestId", "resourceId", "change"]; readonly properties: { readonly requestId: { readonly description: "List of WATCH requests that should receive this change"; readonly type: "array"; readonly minItems: 1; readonly items: { readonly $ref: "#/definitions/id"; }; }; readonly resourceId: { readonly description: "The `_id` of the resource which received the change"; readonly $ref: "../../oada.schema.json#/definitions/_id"; }; readonly change: { readonly $ref: "../change.schema.json#"; }; }; }; /** * Returns true if `val` is a @type `WebsocketChangeRepresentation`, false otherwise */ export declare function is(val: unknown): val is WebsocketChangeRepresentation; /** * Asserts that `val` is a @type `WebsocketChangeRepresentation` */ export declare function assert(val: unknown): asserts val is WebsocketChangeRepresentation; /** * This is the format of an OADA websocket change notification (server to client) * */ export default WebsocketChangeRepresentation; /** * The id a WATCH request * * This interface was referenced by `WebsocketChangeRepresentation`'s JSON-Schema * via the `definition` "id". */ export type Id = string; /** * Wrapper type for any version of an OADA change document. */ export type HttpsFormatsOpenagIoOadaChangeSchemaJson = HttpsFormatsOpenagIoOadaChangeV1SchemaJson | ArrayBasedChangeRepresentationOADAV2; /** * Array of the changes to this resource and its ancestor changes to descendant resources */ export type ArrayBasedChangeRepresentationOADAV2 = ({ /** * Indicates the type of change that occurred. */ type: 'merge' | 'delete'; /** * JSON Pointer to the descendant of this resource which changed (or "" for this resource) */ path: string; /** * The `_id` of the resource which actually changed */ resource_id: string; [k: string]: unknown; } & ({ /** * The contents of what changed */ body: { /** * _rev is the revision for a resource in the OADA API. */ _rev: number; [k: string]: unknown; }; [k: string]: unknown; } | { type: 'delete'; body: null; [k: string]: unknown; }))[]; /** * This is the format of an OADA websocket change notification (server to client) */ export interface WebsocketChangeRepresentation { /** * List of WATCH requests that should receive this change * * @minItems 1 */ requestId: [Id, ...Id[]]; /** * The `_id` of the resource which received the change */ resourceId: string; change: HttpsFormatsOpenagIoOadaChangeSchemaJson; [k: string]: unknown; } /** * Tree-based change representation (OADA v1) */ export interface HttpsFormatsOpenagIoOadaChangeV1SchemaJson { /** * Indicates the type of change that occurred. * * This interface was referenced by `HttpsFormatsOpenagIoOadaChangeV1SchemaJson`'s JSON-Schema * via the `definition` "type". */ type: 'merge' | 'delete'; /** * The contents of what was changed. */ body: { [k: string]: unknown; }; [k: string]: unknown; }