Add Camino service-backed custom fields

This commit is contained in:
Timothy J. Aveni
2026-07-12 11:24:33 -07:00
parent c9202ed56c
commit b343e91078
3 changed files with 242 additions and 19 deletions
+184 -12
View File
@@ -12,7 +12,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file camino/schema.proto. * Describes the file camino/schema.proto.
*/ */
export const file_camino_schema: GenFile = /*@__PURE__*/ export const file_camino_schema: GenFile = /*@__PURE__*/
fileDesc("ChNjYW1pbm8vc2NoZW1hLnByb3RvEgZjYW1pbm8iSwoJU3ltYm9sUmVmEhEKCW5hbWVzcGFjZRgBIAEoCRIMCgRuYW1lGAIgASgJEg8KB3ZlcnNpb24YAyABKAkSDAoEaGFzaBgEIAEoCSIYCgNSZWYSEQoJb2JqZWN0X2lkGAEgASgJIhsKCENyZHRUZXh0Eg8KB3BheWxvYWQYASABKAwiHwoMQ3JkdFJpY2hUZXh0Eg8KB3BheWxvYWQYASABKAwiGwoIQ3JkdEpzb24SDwoHcGF5bG9hZBgBIAEoDCKDAgoLQ2xhc3NTY2hlbWESHQoCaWQYASABKAsyES5jYW1pbm8uU3ltYm9sUmVmEg8KB3ZlcnNpb24YAiABKA0SIwoGZmllbGRzGAMgAygLMhMuY2FtaW5vLkZpZWxkU2NoZW1hEiEKBWVkZ2VzGAQgAygLMhIuY2FtaW5vLkVkZ2VTY2hlbWESJQoHbWV0aG9kcxgFIAMoCzIULmNhbWluby5NZXRob2RTY2hlbWESKQoKbWlncmF0aW9ucxgGIAMoCzIVLmNhbWluby5NaWdyYXRpb25TcGVjEhMKC3NvdXJjZV9maWxlGAcgASgJEhUKDXByb3RvX21lc3NhZ2UYCCABKAkivgEKC0ZpZWxkU2NoZW1hEgwKBG5hbWUYASABKAkSCwoDdGFnGAIgASgNEh0KBHR5cGUYAyABKAsyDy5jYW1pbm8uVHlwZVJlZhIqCghjb25mbGljdBgEIAEoDjIYLmNhbWluby5Db25mbGljdFN0cmF0ZWd5EhAKCHJlcGVhdGVkGAUgASgIEhAKC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F0ZWd5EiEKHUNPTkZMSUNUX1NUUkFURUdZX1VOU1BFQ0lGSUVEEAASCwoHUkVQTEFDRRABEhYKElBSRVNFUlZFX0NPTkZMSUNUUxACEggKBENSRFQQAyp6CgtDYXJkaW5hbGl0eRIbChdDQVJESU5BTElUWV9VTlNQRUNJRklFRBAAEhAKDE9QVElPTkFMX09ORRABEg8KC0VYQUNUTFlfT05FEAISCAoETUFOWRADEg8KC01BTllfVU5JUVVFEAQSEAoMTUFOWV9PUkRFUkVEEAUqVAoORG9jUmVmU3RyZW5ndGgSIAocRE9DX1JFRl9TVFJFTkdUSF9VTlNQRUNJRklFRBAAEgwKCFNPRlRfUkVGEAESEgoOUFJPSkVDVEVEX0VER0UQAipnChBGaWVsZFN0b3JhZ2VLaW5kEiIKHkZJRUxEX1NUT1JBR0VfS0lORF9VTlNQRUNJRklFRBAAEgoKBlNUT1JFRBABEgsKB0RFUklWRUQQAhIICgRMQVpZEAMSDAoIRVhURVJOQUwQBCpIChNGaWVsZEltcGxlbWVudGF0aW9uEiQKIEZJRUxEX0lNUExFTUVOVEFUSU9OX1VOU1BFQ0lGSUVEEAASCwoHU0VSVklDRRABYgZwcm90bzM", [file_quixos_refs]);
/** /**
* @generated from message camino.SymbolRef * @generated from message camino.SymbolRef
@@ -63,6 +63,66 @@ export type Ref = Message<"camino.Ref"> & {
export const RefSchema: GenMessage<Ref> = /*@__PURE__*/ export const RefSchema: GenMessage<Ref> = /*@__PURE__*/
messageDesc(file_camino_schema, 1); messageDesc(file_camino_schema, 1);
/**
* @generated from message camino.CustomField
*/
export type CustomField = Message<"camino.CustomField"> & {
};
/**
* Describes the message camino.CustomField.
* Use `create(CustomFieldSchema)` to create a new message.
*/
export const CustomFieldSchema: GenMessage<CustomField> = /*@__PURE__*/
messageDesc(file_camino_schema, 2);
/**
* @generated from message camino.WatchStartResult
*/
export type WatchStartResult = Message<"camino.WatchStartResult"> & {
/**
* @generated from field: string watch_id = 1;
*/
watchId: string;
};
/**
* Describes the message camino.WatchStartResult.
* Use `create(WatchStartResultSchema)` to create a new message.
*/
export const WatchStartResultSchema: GenMessage<WatchStartResult> = /*@__PURE__*/
messageDesc(file_camino_schema, 3);
/**
* @generated from message camino.WatchStopRequest
*/
export type WatchStopRequest = Message<"camino.WatchStopRequest"> & {
/**
* @generated from field: string watch_id = 1;
*/
watchId: string;
};
/**
* Describes the message camino.WatchStopRequest.
* Use `create(WatchStopRequestSchema)` to create a new message.
*/
export const WatchStopRequestSchema: GenMessage<WatchStopRequest> = /*@__PURE__*/
messageDesc(file_camino_schema, 4);
/**
* @generated from message camino.WatchStopResult
*/
export type WatchStopResult = Message<"camino.WatchStopResult"> & {
};
/**
* Describes the message camino.WatchStopResult.
* Use `create(WatchStopResultSchema)` to create a new message.
*/
export const WatchStopResultSchema: GenMessage<WatchStopResult> = /*@__PURE__*/
messageDesc(file_camino_schema, 5);
/** /**
* @generated from message camino.CrdtText * @generated from message camino.CrdtText
*/ */
@@ -78,7 +138,7 @@ export type CrdtText = Message<"camino.CrdtText"> & {
* Use `create(CrdtTextSchema)` to create a new message. * Use `create(CrdtTextSchema)` to create a new message.
*/ */
export const CrdtTextSchema: GenMessage<CrdtText> = /*@__PURE__*/ export const CrdtTextSchema: GenMessage<CrdtText> = /*@__PURE__*/
messageDesc(file_camino_schema, 2); messageDesc(file_camino_schema, 6);
/** /**
* @generated from message camino.CrdtRichText * @generated from message camino.CrdtRichText
@@ -95,7 +155,7 @@ export type CrdtRichText = Message<"camino.CrdtRichText"> & {
* Use `create(CrdtRichTextSchema)` to create a new message. * Use `create(CrdtRichTextSchema)` to create a new message.
*/ */
export const CrdtRichTextSchema: GenMessage<CrdtRichText> = /*@__PURE__*/ export const CrdtRichTextSchema: GenMessage<CrdtRichText> = /*@__PURE__*/
messageDesc(file_camino_schema, 3); messageDesc(file_camino_schema, 7);
/** /**
* @generated from message camino.CrdtJson * @generated from message camino.CrdtJson
@@ -112,7 +172,7 @@ export type CrdtJson = Message<"camino.CrdtJson"> & {
* Use `create(CrdtJsonSchema)` to create a new message. * Use `create(CrdtJsonSchema)` to create a new message.
*/ */
export const CrdtJsonSchema: GenMessage<CrdtJson> = /*@__PURE__*/ export const CrdtJsonSchema: GenMessage<CrdtJson> = /*@__PURE__*/
messageDesc(file_camino_schema, 4); messageDesc(file_camino_schema, 8);
/** /**
* @generated from message camino.ClassSchema * @generated from message camino.ClassSchema
@@ -157,6 +217,11 @@ export type ClassSchema = Message<"camino.ClassSchema"> & {
* @generated from field: string proto_message = 8; * @generated from field: string proto_message = 8;
*/ */
protoMessage: string; protoMessage: string;
/**
* @generated from field: repeated camino.OperationServiceSchema operation_services = 9;
*/
operationServices: OperationServiceSchema[];
}; };
/** /**
@@ -164,7 +229,7 @@ export type ClassSchema = Message<"camino.ClassSchema"> & {
* Use `create(ClassSchemaSchema)` to create a new message. * Use `create(ClassSchemaSchema)` to create a new message.
*/ */
export const ClassSchemaSchema: GenMessage<ClassSchema> = /*@__PURE__*/ export const ClassSchemaSchema: GenMessage<ClassSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 5); messageDesc(file_camino_schema, 9);
/** /**
* @generated from message camino.FieldSchema * @generated from message camino.FieldSchema
@@ -204,6 +269,11 @@ export type FieldSchema = Message<"camino.FieldSchema"> & {
* @generated from field: camino.FieldStorage storage = 7; * @generated from field: camino.FieldStorage storage = 7;
*/ */
storage?: FieldStorage | undefined; storage?: FieldStorage | undefined;
/**
* @generated from field: camino.FieldOps ops = 8;
*/
ops?: FieldOps | undefined;
}; };
/** /**
@@ -211,7 +281,7 @@ export type FieldSchema = Message<"camino.FieldSchema"> & {
* Use `create(FieldSchemaSchema)` to create a new message. * Use `create(FieldSchemaSchema)` to create a new message.
*/ */
export const FieldSchemaSchema: GenMessage<FieldSchema> = /*@__PURE__*/ export const FieldSchemaSchema: GenMessage<FieldSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 6); messageDesc(file_camino_schema, 10);
/** /**
* @generated from message camino.FieldStorage * @generated from message camino.FieldStorage
@@ -238,7 +308,7 @@ export type FieldStorage = Message<"camino.FieldStorage"> & {
* Use `create(FieldStorageSchema)` to create a new message. * Use `create(FieldStorageSchema)` to create a new message.
*/ */
export const FieldStorageSchema: GenMessage<FieldStorage> = /*@__PURE__*/ export const FieldStorageSchema: GenMessage<FieldStorage> = /*@__PURE__*/
messageDesc(file_camino_schema, 7); messageDesc(file_camino_schema, 11);
/** /**
* @generated from message camino.TypeRef * @generated from message camino.TypeRef
@@ -260,7 +330,29 @@ export type TypeRef = Message<"camino.TypeRef"> & {
* Use `create(TypeRefSchema)` to create a new message. * Use `create(TypeRefSchema)` to create a new message.
*/ */
export const TypeRefSchema: GenMessage<TypeRef> = /*@__PURE__*/ export const TypeRefSchema: GenMessage<TypeRef> = /*@__PURE__*/
messageDesc(file_camino_schema, 8); messageDesc(file_camino_schema, 12);
/**
* @generated from message camino.FieldOps
*/
export type FieldOps = Message<"camino.FieldOps"> & {
/**
* @generated from field: camino.FieldImplementation implementation = 1;
*/
implementation: FieldImplementation;
/**
* @generated from field: string service = 2;
*/
service: string;
};
/**
* Describes the message camino.FieldOps.
* Use `create(FieldOpsSchema)` to create a new message.
*/
export const FieldOpsSchema: GenMessage<FieldOps> = /*@__PURE__*/
messageDesc(file_camino_schema, 13);
/** /**
* @generated from message camino.EdgeSchema * @generated from message camino.EdgeSchema
@@ -307,7 +399,7 @@ export type EdgeSchema = Message<"camino.EdgeSchema"> & {
* Use `create(EdgeSchemaSchema)` to create a new message. * Use `create(EdgeSchemaSchema)` to create a new message.
*/ */
export const EdgeSchemaSchema: GenMessage<EdgeSchema> = /*@__PURE__*/ export const EdgeSchemaSchema: GenMessage<EdgeSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 9); messageDesc(file_camino_schema, 14);
/** /**
* @generated from message camino.MethodSchema * @generated from message camino.MethodSchema
@@ -329,7 +421,7 @@ export type MethodSchema = Message<"camino.MethodSchema"> & {
* Use `create(MethodSchemaSchema)` to create a new message. * Use `create(MethodSchemaSchema)` to create a new message.
*/ */
export const MethodSchemaSchema: GenMessage<MethodSchema> = /*@__PURE__*/ export const MethodSchemaSchema: GenMessage<MethodSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 10); messageDesc(file_camino_schema, 15);
/** /**
* @generated from message camino.MigrationSpec * @generated from message camino.MigrationSpec
@@ -356,7 +448,66 @@ export type MigrationSpec = Message<"camino.MigrationSpec"> & {
* Use `create(MigrationSpecSchema)` to create a new message. * Use `create(MigrationSpecSchema)` to create a new message.
*/ */
export const MigrationSpecSchema: GenMessage<MigrationSpec> = /*@__PURE__*/ export const MigrationSpecSchema: GenMessage<MigrationSpec> = /*@__PURE__*/
messageDesc(file_camino_schema, 11); messageDesc(file_camino_schema, 16);
/**
* @generated from message camino.OperationSchema
*/
export type OperationSchema = Message<"camino.OperationSchema"> & {
/**
* @generated from field: string name = 1;
*/
name: string;
/**
* @generated from field: camino.TypeRef input_type = 2;
*/
inputType?: TypeRef | undefined;
/**
* @generated from field: camino.TypeRef output_type = 3;
*/
outputType?: TypeRef | undefined;
/**
* @generated from field: quixos.FunctionRef function = 4;
*/
function?: FunctionRef | undefined;
};
/**
* Describes the message camino.OperationSchema.
* Use `create(OperationSchemaSchema)` to create a new message.
*/
export const OperationSchemaSchema: GenMessage<OperationSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 17);
/**
* @generated from message camino.OperationServiceSchema
*/
export type OperationServiceSchema = Message<"camino.OperationServiceSchema"> & {
/**
* @generated from field: string name = 1;
*/
name: string;
/**
* @generated from field: string full_name = 2;
*/
fullName: string;
/**
* @generated from field: repeated camino.OperationSchema operations = 3;
*/
operations: OperationSchema[];
};
/**
* Describes the message camino.OperationServiceSchema.
* Use `create(OperationServiceSchemaSchema)` to create a new message.
*/
export const OperationServiceSchemaSchema: GenMessage<OperationServiceSchema> = /*@__PURE__*/
messageDesc(file_camino_schema, 18);
/** /**
* @generated from message camino.DocRefDeclaration * @generated from message camino.DocRefDeclaration
@@ -388,7 +539,7 @@ export type DocRefDeclaration = Message<"camino.DocRefDeclaration"> & {
* Use `create(DocRefDeclarationSchema)` to create a new message. * Use `create(DocRefDeclarationSchema)` to create a new message.
*/ */
export const DocRefDeclarationSchema: GenMessage<DocRefDeclaration> = /*@__PURE__*/ export const DocRefDeclarationSchema: GenMessage<DocRefDeclaration> = /*@__PURE__*/
messageDesc(file_camino_schema, 12); messageDesc(file_camino_schema, 19);
/** /**
* @generated from enum camino.ConflictStrategy * @generated from enum camino.ConflictStrategy
@@ -523,3 +674,24 @@ export enum FieldStorageKind {
*/ */
export const FieldStorageKindSchema: GenEnum<FieldStorageKind> = /*@__PURE__*/ export const FieldStorageKindSchema: GenEnum<FieldStorageKind> = /*@__PURE__*/
enumDesc(file_camino_schema, 3); enumDesc(file_camino_schema, 3);
/**
* @generated from enum camino.FieldImplementation
*/
export enum FieldImplementation {
/**
* @generated from enum value: FIELD_IMPLEMENTATION_UNSPECIFIED = 0;
*/
FIELD_IMPLEMENTATION_UNSPECIFIED = 0,
/**
* @generated from enum value: SERVICE = 1;
*/
SERVICE = 1,
}
/**
* Describes the enum camino.FieldImplementation.
*/
export const FieldImplementationSchema: GenEnum<FieldImplementation> = /*@__PURE__*/
enumDesc(file_camino_schema, 4);
+52 -6
View File
@@ -34,6 +34,7 @@ export type CaminoClient = Client<typeof CaminoService>;
export type { InvokeRequest, Value }; export type { InvokeRequest, Value };
export type Field<T> = { export type Field<T> = {
get(): Promise<T | undefined>;
set(value: T): Promise<void>; set(value: T): Promise<void>;
}; };
@@ -41,9 +42,25 @@ export type RuntimeHandler<Context> = (
context: Context, context: Context,
) => Promise<unknown> | unknown; ) => Promise<unknown> | unknown;
export type FieldOperation<Context> = {
get?: RuntimeHandler<Context>;
set?: RuntimeHandler<Context>;
watchStart?: RuntimeHandler<Context>;
watchStop?: RuntimeHandler<Context>;
};
export const fieldOps = <Context>(
operation: FieldOperation<Context>,
): FieldOperation<Context> => operation;
export const derivedWithDeps = <Context>(operation: {
get: RuntimeHandler<Context>;
}): FieldOperation<Context> => fieldOps(operation);
export type RuntimeFunctionSpec<ExportName extends string = string> = { export type RuntimeFunctionSpec<ExportName extends string = string> = {
exportName: ExportName; exportName: ExportName;
symbol: string; symbol: string;
operation?: string;
}; };
const isRecord = (value: unknown): value is Record<string, unknown> => const isRecord = (value: unknown): value is Record<string, unknown> =>
@@ -203,6 +220,10 @@ export const createField = <T>(
objectId: string, objectId: string,
fieldName: string, fieldName: string,
): Field<T> => ({ ): Field<T> => ({
async get() {
const response = await camino.getObject({ objectId });
return protoValueToJs(response.object?.fields[fieldName]) as T | undefined;
},
async set(value) { async set(value) {
await camino.setField({ await camino.setField({
objectId, objectId,
@@ -221,7 +242,9 @@ export const serveQuixosPackageRuntime = <
runtimeProtocolVersion: string; runtimeProtocolVersion: string;
functions: Spec; functions: Spec;
implementation: { implementation: {
[Name in Spec[number]["exportName"]]: RuntimeHandler<Context>; [Name in Spec[number]["exportName"]]:
| RuntimeHandler<Context>
| FieldOperation<Context>;
}; };
createContext: (camino: CaminoClient, request: InvokeRequest) => Context; createContext: (camino: CaminoClient, request: InvokeRequest) => Context;
}) => { }) => {
@@ -242,6 +265,7 @@ export const serveQuixosPackageRuntime = <
packageNamespace: params.packageNamespace, packageNamespace: params.packageNamespace,
packageName: params.packageName, packageName: params.packageName,
symbol: entry.symbol, symbol: entry.symbol,
operation: entry.operation ?? "",
}), }),
); );
@@ -261,19 +285,41 @@ export const serveQuixosPackageRuntime = <
try { try {
const symbol = request.function?.symbol ?? ""; const symbol = request.function?.symbol ?? "";
const spec = params.functions.find( const spec = params.functions.find(
(entry) => entry.symbol === symbol, (entry) =>
entry.symbol === symbol &&
(entry.operation ?? "") === (request.function?.operation ?? ""),
); );
if (!spec) { if (!spec) {
throw new Error( throw new Error(
`Unknown ${params.packageName} function: ${symbol}`, `Unknown ${params.packageName} function: ${symbol}${
request.function?.operation
? `.${request.function.operation}`
: ""
}`,
); );
} }
const runtimeFunction = ( const implementationExport = (
params.implementation as Record<string, RuntimeHandler<Context>> params.implementation as Record<
string,
RuntimeHandler<Context> | FieldOperation<Context>
>
)[spec.exportName]; )[spec.exportName];
const runtimeFunction =
spec.operation && typeof implementationExport === "object"
? implementationExport[spec.operation as keyof FieldOperation<Context>]
: implementationExport;
if (!runtimeFunction) { if (!runtimeFunction) {
throw new Error( throw new Error(
`Missing ${params.packageName} implementation export: ${spec.exportName}`, `Missing ${params.packageName} implementation export: ${spec.exportName}${
spec.operation ? `.${spec.operation}` : ""
}`,
);
}
if (typeof runtimeFunction !== "function") {
throw new Error(
`${params.packageName} implementation export is not callable: ${spec.exportName}${
spec.operation ? `.${spec.operation}` : ""
}`,
); );
} }
return create(InvokeResponseSchema, { return create(InvokeResponseSchema, {
+6 -1
View File
@@ -10,7 +10,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file quixos/refs.proto. * Describes the file quixos/refs.proto.
*/ */
export const file_quixos_refs: GenFile = /*@__PURE__*/ export const file_quixos_refs: GenFile = /*@__PURE__*/
fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zImMKC0Z1bmN0aW9uUmVmEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIOCgZzeW1ib2wYAyABKAkSEwoLdmVyc2lvbl9yZWYYBCABKAliBnByb3RvMw"); fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zInYKC0Z1bmN0aW9uUmVmEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIOCgZzeW1ib2wYAyABKAkSEwoLdmVyc2lvbl9yZWYYBCABKAkSEQoJb3BlcmF0aW9uGAUgASgJYgZwcm90bzM");
/** /**
* @generated from message quixos.FunctionRef * @generated from message quixos.FunctionRef
@@ -35,6 +35,11 @@ export type FunctionRef = Message<"quixos.FunctionRef"> & {
* @generated from field: string version_ref = 4; * @generated from field: string version_ref = 4;
*/ */
versionRef: string; versionRef: string;
/**
* @generated from field: string operation = 5;
*/
operation: string;
}; };
/** /**