import { jsonSchema } from "../../shared/src/json-schema.js";
import * as v from "../../shared/src/valita.js";
import { astSchema } from "./ast.js";
export const putOpSchema = v.object({
    op: v.literal('put'),
    hash: v.string(),
    ttl: v.number().optional(),
});
export const upPutOpSchema = putOpSchema.extend({
    // All fields are optional in this transitional period.
    // - ast is filled in for client queries
    // - name and args are filled in for custom queries
    ast: astSchema.optional(),
    name: v.string().optional(),
    args: v.readonly(v.array(jsonSchema)).optional(),
});
const delOpSchema = v.object({
    op: v.literal('del'),
    hash: v.string(),
});
const clearOpSchema = v.object({
    op: v.literal('clear'),
});
const patchOpSchema = v.union(putOpSchema, delOpSchema, clearOpSchema);
const upPatchOpSchema = v.union(upPutOpSchema, delOpSchema, clearOpSchema);
export const queriesPatchSchema = v.array(patchOpSchema);
export const upQueriesPatchSchema = v.array(upPatchOpSchema);
//# sourceMappingURL=queries-patch.js.map