/** * Array of the changes to this resource and its ancestor changes to descendant resources * @example * ```json * [ * { * "resource_id": "resources/default:resources_bookmarks_123", * "path": "", * "body": { * "rocks": { * "_rev": 1 * }, * "_rev": 1 * }, * "type": "merge" * }, * { * "resource_id": "resources/default:resources_rocks_123", * "path": "/rocks", * "body": { * "test": "abc", * "_rev": 1 * }, * "type": "merge" * } * ] * ``` * * * File automatically generated using json-schema-to-typescript. * ! DO NOT MODIFY IT BY HAND ! * Instead, modify the source file ./oada/change/v2.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/change/v2.schema.json} */ export declare const $id = "https://formats.openag.io/oada/change/v2.schema.json"; /** * JSON Schema used to generate this type * @see {@link https://formats.openag.io/oada/change/v2.schema.json} */ export declare const schema: { readonly $id: "https://formats.openag.io/oada/change/v2.schema.json"; readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly title: "Array-based change representation (OADA v2)"; readonly description: "Array of the changes to this resource and its ancestor changes to descendant resources"; readonly definitions: { readonly change: { readonly description: "An element of a change array representing a single change to a single resource"; readonly allOf: readonly [{ readonly type: "object"; readonly required: readonly ["type", "body", "path", "resource_id"]; readonly properties: { readonly type: { readonly description: "Indicates the type of change that occurred."; readonly enum: readonly ["merge", "delete"]; }; readonly path: { readonly description: "JSON Pointer to the descendant of this resource which changed (or \"\" for this resource)"; readonly $ref: "../../oada.schema.json#/definitions/path"; }; readonly resource_id: { readonly description: "The `_id` of the resource which actually changed"; readonly $ref: "../../oada.schema.json#/definitions/_id"; }; }; }, { readonly oneOf: readonly [{ readonly type: "object"; readonly required: readonly ["body"]; readonly properties: { readonly body: { readonly $comment: "Should probably narrow this schema down"; readonly description: "The contents of what changed"; readonly type: "object"; readonly required: readonly ["_rev"]; readonly properties: { readonly _rev: { readonly $ref: "../../oada.schema.json#/definitions/_rev"; }; }; }; }; }, { readonly type: "object"; readonly required: readonly ["type", "body"]; readonly properties: { readonly type: { readonly enum: readonly ["delete"]; }; readonly body: { readonly type: "null"; }; }; }]; }]; }; }; readonly type: "array"; readonly items: { readonly $ref: "#/definitions/change"; }; readonly examples: readonly [readonly [{ readonly resource_id: "resources/default:resources_bookmarks_123"; readonly path: ""; readonly body: { readonly rocks: { readonly _rev: 1; }; readonly _rev: 1; }; readonly type: "merge"; }, { readonly resource_id: "resources/default:resources_rocks_123"; readonly path: "/rocks"; readonly body: { readonly test: "abc"; readonly _rev: 1; }; readonly type: "merge"; }]]; }; /** * Returns true if `val` is a @type `ArrayBasedChangeRepresentationOADAV2`, false otherwise */ export declare function is(val: unknown): val is ArrayBasedChangeRepresentationOADAV2; /** * Asserts that `val` is a @type `ArrayBasedChangeRepresentationOADAV2` */ export declare function assert(val: unknown): asserts val is ArrayBasedChangeRepresentationOADAV2; /** * Array of the changes to this resource and its ancestor changes to descendant resources * @example * ```json * [ * { * "resource_id": "resources/default:resources_bookmarks_123", * "path": "", * "body": { * "rocks": { * "_rev": 1 * }, * "_rev": 1 * }, * "type": "merge" * }, * { * "resource_id": "resources/default:resources_rocks_123", * "path": "/rocks", * "body": { * "test": "abc", * "_rev": 1 * }, * "type": "merge" * } * ] * ``` * */ export default ArrayBasedChangeRepresentationOADAV2; /** * An element of a change array representing a single change to a single resource */ export type Change = { /** * 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; }); /** * Array of the changes to this resource and its ancestor changes to descendant resources */ export type ArrayBasedChangeRepresentationOADAV2 = Change[];