import { jsonObjectSchema } from "../../shared/src/json-schema.js";
import "../../shared/src/valita.js";
import { rowSchema } from "./data.js";
import { primaryKeyValueRecordSchema } from "./primary-key.js";
import { object, string, literal, array, union } from "@badrap/valita";
const putOpSchema = object({
  op: literal("put"),
  tableName: string(),
  value: rowSchema
});
const updateOpSchema = object({
  op: literal("update"),
  tableName: string(),
  id: primaryKeyValueRecordSchema,
  merge: jsonObjectSchema.optional(),
  constrain: array(string()).optional()
});
const delOpSchema = object({
  op: literal("del"),
  tableName: string(),
  id: primaryKeyValueRecordSchema
});
const clearOpSchema = object({
  op: literal("clear")
});
const rowPatchOpSchema = union(
  putOpSchema,
  updateOpSchema,
  delOpSchema,
  clearOpSchema
);
const rowsPatchSchema = array(rowPatchOpSchema);
export {
  rowsPatchSchema
};
//# sourceMappingURL=row-patch.js.map
