Files
package-project-runtime/src/messages.ts
T

12 lines
602 B
TypeScript
Raw Normal View History

import { encodeQxValue, decodeQxValue, type MessageBinding, type QxValueType } from "@quixos/camino-package-runtime";
type SearchDocument = { title: string; subtitle: string; keywords: string[] };
const schema: QxValueType = { kind: "record", fields: {
title: { kind: "scalar", name: "string" }, subtitle: { kind: "scalar", name: "string" },
keywords: { kind: "list", value: { kind: "scalar", name: "string" } },
}};
export const searchDocumentBinding: MessageBinding<SearchDocument> = {
encode: value => encodeQxValue(schema, value, {}),
decode: value => decodeQxValue(schema, value, {}),
};