commit c9202ed56c715cc25534563d820b37759f63fb53 Author: Timothy J. Aveni Date: Sat Jul 11 23:01:51 2026 -0700 Use textproto package descriptors diff --git a/package.json b/package.json new file mode 100644 index 0000000..e7c7011 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "@quixos/camino-package-runtime", + "version": "0.1.0", + "private": true, + "type": "module", + "exports": { + ".": { + "types": "./src/index.ts", + "default": "./src/index.ts" + } + }, + "scripts": { + "generate": "rm -rf src/camino src/quixos && protoc --plugin=protoc-gen-es=../todo-runtime/node_modules/.bin/protoc-gen-es --es_out=src --es_opt=target=ts,import_extension=js --proto_path=../../quixos-protocol/proto --proto_path=$QUIXOS_PROTO_PATH ../../quixos-protocol/proto/quixos/refs.proto ../../quixos-protocol/proto/quixos/runtime.proto ../../quixos-protocol/proto/camino/schema.proto ../../quixos-protocol/proto/camino/api.proto", + "typecheck": "npm run generate && tsc --noEmit" + }, + "dependencies": { + "@bufbuild/protobuf": "^2.12.1", + "@connectrpc/connect": "^2.1.2", + "@connectrpc/connect-node": "^2.1.2" + }, + "devDependencies": { + "@types/node": "^24", + "typescript": "^5.9.3" + } +} diff --git a/src/camino/api_pb.ts b/src/camino/api_pb.ts new file mode 100644 index 0000000..c545abd --- /dev/null +++ b/src/camino/api_pb.ts @@ -0,0 +1,856 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js" +// @generated from file camino/api.proto (package camino, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { ClassSchema } from "./schema_pb.js"; +import { file_camino_schema } from "./schema_pb.js"; +import type { FunctionRef } from "../quixos/refs_pb.js"; +import { file_quixos_refs } from "../quixos/refs_pb.js"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file camino/api.proto. + */ +export const file_camino_api: GenFile = /*@__PURE__*/ + fileDesc("ChBjYW1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lclNjaGVtYVJlc3BvbnNlEkYKC0xpc3RDbGFzc2VzEhouY2FtaW5vLkxpc3RDbGFzc2VzUmVxdWVzdBobLmNhbWluby5MaXN0Q2xhc3Nlc1Jlc3BvbnNlEkkKDENyZWF0ZU9iamVjdBIbLmNhbWluby5DcmVhdGVPYmplY3RSZXF1ZXN0GhwuY2FtaW5vLkNyZWF0ZU9iamVjdFJlc3BvbnNlEkAKCUdldE9iamVjdBIYLmNhbWluby5HZXRPYmplY3RSZXF1ZXN0GhkuY2FtaW5vLkdldE9iamVjdFJlc3BvbnNlEj0KCFNldEZpZWxkEhcuY2FtaW5vLlNldEZpZWxkUmVxdWVzdBoYLmNhbWluby5TZXRGaWVsZFJlc3BvbnNlEjoKB0FkZEVkZ2USFi5jYW1pbm8uQWRkRWRnZVJlcXVlc3QaFy5jYW1pbm8uQWRkRWRnZVJlc3BvbnNlEkAKCUxpc3RFZGdlcxIYLmNhbWluby5MaXN0RWRnZXNSZXF1ZXN0GhkuY2FtaW5vLkxpc3RFZGdlc1Jlc3BvbnNlEkMKClJlbW92ZUVkZ2USGS5jYW1pbm8uUmVtb3ZlRWRnZVJlcXVlc3QaGi5jYW1pbm8uUmVtb3ZlRWRnZVJlc3BvbnNlEjoKB0xpc3RPcHMSFi5jYW1pbm8uTGlzdE9wc1JlcXVlc3QaFy5jYW1pbm8uTGlzdE9wc1Jlc3BvbnNlEkUKC1dhdGNoT2JqZWN0EhouY2FtaW5vLldhdGNoT2JqZWN0UmVxdWVzdBoYLmNhbWluby5XYXRjaE9iamVjdEV2ZW50MAFiBnByb3RvMw", [file_camino_schema, file_quixos_refs]); + +/** + * @generated from message camino.RegisterSchemaRequest + */ +export type RegisterSchemaRequest = Message<"camino.RegisterSchemaRequest"> & { + /** + * @generated from field: string source_file = 1; + */ + sourceFile: string; +}; + +/** + * Describes the message camino.RegisterSchemaRequest. + * Use `create(RegisterSchemaRequestSchema)` to create a new message. + */ +export const RegisterSchemaRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 0); + +/** + * @generated from message camino.RegisterSchemaResponse + */ +export type RegisterSchemaResponse = Message<"camino.RegisterSchemaResponse"> & { + /** + * @generated from field: repeated string class_ids = 1; + */ + classIds: string[]; + + /** + * @generated from field: repeated camino.ClassSchema classes = 2; + */ + classes: ClassSchema[]; +}; + +/** + * Describes the message camino.RegisterSchemaResponse. + * Use `create(RegisterSchemaResponseSchema)` to create a new message. + */ +export const RegisterSchemaResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 1); + +/** + * @generated from message camino.ListClassesRequest + */ +export type ListClassesRequest = Message<"camino.ListClassesRequest"> & { +}; + +/** + * Describes the message camino.ListClassesRequest. + * Use `create(ListClassesRequestSchema)` to create a new message. + */ +export const ListClassesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 2); + +/** + * @generated from message camino.RegisteredClass + */ +export type RegisteredClass = Message<"camino.RegisteredClass"> & { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: camino.ClassSchema schema = 2; + */ + schema?: ClassSchema | undefined; +}; + +/** + * Describes the message camino.RegisteredClass. + * Use `create(RegisteredClassSchema)` to create a new message. + */ +export const RegisteredClassSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 3); + +/** + * @generated from message camino.ListClassesResponse + */ +export type ListClassesResponse = Message<"camino.ListClassesResponse"> & { + /** + * @generated from field: repeated camino.RegisteredClass classes = 1; + */ + classes: RegisteredClass[]; +}; + +/** + * Describes the message camino.ListClassesResponse. + * Use `create(ListClassesResponseSchema)` to create a new message. + */ +export const ListClassesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 4); + +/** + * @generated from message camino.NullValue + */ +export type NullValue = Message<"camino.NullValue"> & { +}; + +/** + * Describes the message camino.NullValue. + * Use `create(NullValueSchema)` to create a new message. + */ +export const NullValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 5); + +/** + * @generated from message camino.ObjectValue + */ +export type ObjectValue = Message<"camino.ObjectValue"> & { + /** + * @generated from field: map fields = 1; + */ + fields: { [key: string]: Value }; +}; + +/** + * Describes the message camino.ObjectValue. + * Use `create(ObjectValueSchema)` to create a new message. + */ +export const ObjectValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 6); + +/** + * @generated from message camino.ListValue + */ +export type ListValue = Message<"camino.ListValue"> & { + /** + * @generated from field: repeated camino.Value values = 1; + */ + values: Value[]; +}; + +/** + * Describes the message camino.ListValue. + * Use `create(ListValueSchema)` to create a new message. + */ +export const ListValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 7); + +/** + * @generated from message camino.RefValue + */ +export type RefValue = Message<"camino.RefValue"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; +}; + +/** + * Describes the message camino.RefValue. + * Use `create(RefValueSchema)` to create a new message. + */ +export const RefValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 8); + +/** + * @generated from message camino.CrdtValue + */ +export type CrdtValue = Message<"camino.CrdtValue"> & { + /** + * @generated from field: string type = 1; + */ + type: string; + + /** + * @generated from field: string encoding = 2; + */ + encoding: string; + + /** + * @generated from field: bytes payload = 3; + */ + payload: Uint8Array; +}; + +/** + * Describes the message camino.CrdtValue. + * Use `create(CrdtValueSchema)` to create a new message. + */ +export const CrdtValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 9); + +/** + * @generated from message camino.Value + */ +export type Value = Message<"camino.Value"> & { + /** + * @generated from oneof camino.Value.kind + */ + kind: { + /** + * @generated from field: camino.NullValue null_value = 1; + */ + value: NullValue; + case: "nullValue"; + } | { + /** + * @generated from field: bool bool_value = 2; + */ + value: boolean; + case: "boolValue"; + } | { + /** + * @generated from field: double number_value = 3; + */ + value: number; + case: "numberValue"; + } | { + /** + * @generated from field: string string_value = 4; + */ + value: string; + case: "stringValue"; + } | { + /** + * @generated from field: string integer_value = 5; + */ + value: string; + case: "integerValue"; + } | { + /** + * @generated from field: bytes bytes_value = 6; + */ + value: Uint8Array; + case: "bytesValue"; + } | { + /** + * @generated from field: camino.ObjectValue object_value = 7; + */ + value: ObjectValue; + case: "objectValue"; + } | { + /** + * @generated from field: camino.ListValue list_value = 8; + */ + value: ListValue; + case: "listValue"; + } | { + /** + * @generated from field: camino.RefValue ref_value = 9; + */ + value: RefValue; + case: "refValue"; + } | { + /** + * @generated from field: camino.CrdtValue crdt_value = 10; + */ + value: CrdtValue; + case: "crdtValue"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message camino.Value. + * Use `create(ValueSchema)` to create a new message. + */ +export const ValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 10); + +/** + * @generated from message camino.CreateObjectRequest + */ +export type CreateObjectRequest = Message<"camino.CreateObjectRequest"> & { + /** + * @generated from field: string class_id = 1; + */ + classId: string; + + /** + * @generated from field: map fields = 2; + */ + fields: { [key: string]: Value }; +}; + +/** + * Describes the message camino.CreateObjectRequest. + * Use `create(CreateObjectRequestSchema)` to create a new message. + */ +export const CreateObjectRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 11); + +/** + * @generated from message camino.CreateObjectResponse + */ +export type CreateObjectResponse = Message<"camino.CreateObjectResponse"> & { + /** + * @generated from field: camino.CaminoObject object = 1; + */ + object?: CaminoObject | undefined; +}; + +/** + * Describes the message camino.CreateObjectResponse. + * Use `create(CreateObjectResponseSchema)` to create a new message. + */ +export const CreateObjectResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 12); + +/** + * @generated from message camino.GetObjectRequest + */ +export type GetObjectRequest = Message<"camino.GetObjectRequest"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; +}; + +/** + * Describes the message camino.GetObjectRequest. + * Use `create(GetObjectRequestSchema)` to create a new message. + */ +export const GetObjectRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 13); + +/** + * @generated from message camino.GetObjectResponse + */ +export type GetObjectResponse = Message<"camino.GetObjectResponse"> & { + /** + * @generated from field: camino.CaminoObject object = 1; + */ + object?: CaminoObject | undefined; +}; + +/** + * Describes the message camino.GetObjectResponse. + * Use `create(GetObjectResponseSchema)` to create a new message. + */ +export const GetObjectResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 14); + +/** + * @generated from message camino.SetFieldRequest + */ +export type SetFieldRequest = Message<"camino.SetFieldRequest"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; + + /** + * @generated from field: string field_name = 2; + */ + fieldName: string; + + /** + * @generated from field: camino.Value value = 3; + */ + value?: Value | undefined; +}; + +/** + * Describes the message camino.SetFieldRequest. + * Use `create(SetFieldRequestSchema)` to create a new message. + */ +export const SetFieldRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 15); + +/** + * @generated from message camino.SetFieldResponse + */ +export type SetFieldResponse = Message<"camino.SetFieldResponse"> & { + /** + * @generated from field: camino.CaminoObject object = 1; + */ + object?: CaminoObject | undefined; +}; + +/** + * Describes the message camino.SetFieldResponse. + * Use `create(SetFieldResponseSchema)` to create a new message. + */ +export const SetFieldResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 16); + +/** + * @generated from message camino.AddEdgeRequest + */ +export type AddEdgeRequest = Message<"camino.AddEdgeRequest"> & { + /** + * @generated from field: string from_object_id = 1; + */ + fromObjectId: string; + + /** + * @generated from field: string source_field = 2; + */ + sourceField: string; + + /** + * @generated from field: string to_object_id = 3; + */ + toObjectId: string; + + /** + * @generated from field: map fields = 4; + */ + fields: { [key: string]: Value }; + + /** + * @generated from field: optional int32 ordinal = 5; + */ + ordinal?: number | undefined; +}; + +/** + * Describes the message camino.AddEdgeRequest. + * Use `create(AddEdgeRequestSchema)` to create a new message. + */ +export const AddEdgeRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 17); + +/** + * @generated from message camino.AddEdgeResponse + */ +export type AddEdgeResponse = Message<"camino.AddEdgeResponse"> & { + /** + * @generated from field: camino.CaminoEdge edge = 1; + */ + edge?: CaminoEdge | undefined; +}; + +/** + * Describes the message camino.AddEdgeResponse. + * Use `create(AddEdgeResponseSchema)` to create a new message. + */ +export const AddEdgeResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 18); + +/** + * @generated from message camino.ListEdgesRequest + */ +export type ListEdgesRequest = Message<"camino.ListEdgesRequest"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; +}; + +/** + * Describes the message camino.ListEdgesRequest. + * Use `create(ListEdgesRequestSchema)` to create a new message. + */ +export const ListEdgesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 19); + +/** + * @generated from message camino.ListEdgesResponse + */ +export type ListEdgesResponse = Message<"camino.ListEdgesResponse"> & { + /** + * @generated from field: repeated camino.CaminoEdge edges = 1; + */ + edges: CaminoEdge[]; +}; + +/** + * Describes the message camino.ListEdgesResponse. + * Use `create(ListEdgesResponseSchema)` to create a new message. + */ +export const ListEdgesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 20); + +/** + * @generated from message camino.RemoveEdgeRequest + */ +export type RemoveEdgeRequest = Message<"camino.RemoveEdgeRequest"> & { + /** + * @generated from field: string edge_id = 1; + */ + edgeId: string; +}; + +/** + * Describes the message camino.RemoveEdgeRequest. + * Use `create(RemoveEdgeRequestSchema)` to create a new message. + */ +export const RemoveEdgeRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 21); + +/** + * @generated from message camino.RemoveEdgeResponse + */ +export type RemoveEdgeResponse = Message<"camino.RemoveEdgeResponse"> & { + /** + * @generated from field: string edge_id = 1; + */ + edgeId: string; +}; + +/** + * Describes the message camino.RemoveEdgeResponse. + * Use `create(RemoveEdgeResponseSchema)` to create a new message. + */ +export const RemoveEdgeResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 22); + +/** + * @generated from message camino.ListOpsRequest + */ +export type ListOpsRequest = Message<"camino.ListOpsRequest"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; +}; + +/** + * Describes the message camino.ListOpsRequest. + * Use `create(ListOpsRequestSchema)` to create a new message. + */ +export const ListOpsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 23); + +/** + * @generated from message camino.ListOpsResponse + */ +export type ListOpsResponse = Message<"camino.ListOpsResponse"> & { + /** + * @generated from field: repeated camino.CaminoOp ops = 1; + */ + ops: CaminoOp[]; +}; + +/** + * Describes the message camino.ListOpsResponse. + * Use `create(ListOpsResponseSchema)` to create a new message. + */ +export const ListOpsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 24); + +/** + * @generated from message camino.WatchObjectRequest + */ +export type WatchObjectRequest = Message<"camino.WatchObjectRequest"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; + + /** + * @generated from field: string after_op_id = 2; + */ + afterOpId: string; + + /** + * @generated from field: bool include_snapshot = 3; + */ + includeSnapshot: boolean; +}; + +/** + * Describes the message camino.WatchObjectRequest. + * Use `create(WatchObjectRequestSchema)` to create a new message. + */ +export const WatchObjectRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 25); + +/** + * @generated from message camino.WatchObjectEvent + */ +export type WatchObjectEvent = Message<"camino.WatchObjectEvent"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; + + /** + * @generated from field: camino.CaminoObject snapshot = 2; + */ + snapshot?: CaminoObject | undefined; + + /** + * @generated from field: camino.CaminoOp op = 3; + */ + op?: CaminoOp | undefined; +}; + +/** + * Describes the message camino.WatchObjectEvent. + * Use `create(WatchObjectEventSchema)` to create a new message. + */ +export const WatchObjectEventSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 26); + +/** + * @generated from message camino.CaminoObject + */ +export type CaminoObject = Message<"camino.CaminoObject"> & { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string class_id = 2; + */ + classId: string; + + /** + * @generated from field: uint32 schema_version = 3; + */ + schemaVersion: number; + + /** + * @generated from field: string created_at = 4; + */ + createdAt: string; + + /** + * @generated from field: string updated_at = 5; + */ + updatedAt: string; + + /** + * @generated from field: map fields = 6; + */ + fields: { [key: string]: Value }; + + /** + * @generated from field: map field_revisions = 7; + */ + fieldRevisions: { [key: string]: bigint }; + + /** + * @generated from field: map field_conflicts = 8; + */ + fieldConflicts: { [key: string]: string }; +}; + +/** + * Describes the message camino.CaminoObject. + * Use `create(CaminoObjectSchema)` to create a new message. + */ +export const CaminoObjectSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 27); + +/** + * @generated from message camino.CaminoEdge + */ +export type CaminoEdge = Message<"camino.CaminoEdge"> & { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string edge_type_id = 2; + */ + edgeTypeId: string; + + /** + * @generated from field: string from_object_id = 3; + */ + fromObjectId: string; + + /** + * @generated from field: string to_object_id = 4; + */ + toObjectId: string; + + /** + * @generated from field: string source_field = 5; + */ + sourceField: string; + + /** + * @generated from field: string cardinality = 6; + */ + cardinality: string; + + /** + * @generated from field: string inverse = 7; + */ + inverse: string; + + /** + * @generated from field: map fields = 8; + */ + fields: { [key: string]: Value }; + + /** + * @generated from field: optional int32 ordinal = 9; + */ + ordinal?: number | undefined; + + /** + * @generated from field: string created_at = 10; + */ + createdAt: string; + + /** + * @generated from field: string updated_at = 11; + */ + updatedAt: string; +}; + +/** + * Describes the message camino.CaminoEdge. + * Use `create(CaminoEdgeSchema)` to create a new message. + */ +export const CaminoEdgeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 28); + +/** + * @generated from message camino.CaminoOp + */ +export type CaminoOp = Message<"camino.CaminoOp"> & { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string object_id = 2; + */ + objectId: string; + + /** + * @generated from field: string op_kind = 3; + */ + opKind: string; + + /** + * @generated from field: camino.Value payload = 4; + */ + payload?: Value | undefined; + + /** + * @generated from field: string actor = 5; + */ + actor: string; + + /** + * @generated from field: quixos.FunctionRef function_ref = 6; + */ + functionRef?: FunctionRef | undefined; + + /** + * @generated from field: string created_at = 7; + */ + createdAt: string; +}; + +/** + * Describes the message camino.CaminoOp. + * Use `create(CaminoOpSchema)` to create a new message. + */ +export const CaminoOpSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_api, 29); + +/** + * @generated from service camino.CaminoService + */ +export const CaminoService: GenService<{ + /** + * @generated from rpc camino.CaminoService.RegisterSchema + */ + registerSchema: { + methodKind: "unary"; + input: typeof RegisterSchemaRequestSchema; + output: typeof RegisterSchemaResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.ListClasses + */ + listClasses: { + methodKind: "unary"; + input: typeof ListClassesRequestSchema; + output: typeof ListClassesResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.CreateObject + */ + createObject: { + methodKind: "unary"; + input: typeof CreateObjectRequestSchema; + output: typeof CreateObjectResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.GetObject + */ + getObject: { + methodKind: "unary"; + input: typeof GetObjectRequestSchema; + output: typeof GetObjectResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.SetField + */ + setField: { + methodKind: "unary"; + input: typeof SetFieldRequestSchema; + output: typeof SetFieldResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.AddEdge + */ + addEdge: { + methodKind: "unary"; + input: typeof AddEdgeRequestSchema; + output: typeof AddEdgeResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.ListEdges + */ + listEdges: { + methodKind: "unary"; + input: typeof ListEdgesRequestSchema; + output: typeof ListEdgesResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.RemoveEdge + */ + removeEdge: { + methodKind: "unary"; + input: typeof RemoveEdgeRequestSchema; + output: typeof RemoveEdgeResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.ListOps + */ + listOps: { + methodKind: "unary"; + input: typeof ListOpsRequestSchema; + output: typeof ListOpsResponseSchema; + }, + /** + * @generated from rpc camino.CaminoService.WatchObject + */ + watchObject: { + methodKind: "server_streaming"; + input: typeof WatchObjectRequestSchema; + output: typeof WatchObjectEventSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_camino_api, 0); diff --git a/src/camino/schema_pb.ts b/src/camino/schema_pb.ts new file mode 100644 index 0000000..44a9aac --- /dev/null +++ b/src/camino/schema_pb.ts @@ -0,0 +1,525 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js" +// @generated from file camino/schema.proto (package camino, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { FunctionRef } from "../quixos/refs_pb.js"; +import { file_quixos_refs } from "../quixos/refs_pb.js"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file camino/schema.proto. + */ +export const file_camino_schema: GenFile = /*@__PURE__*/ + fileDesc("ChNjYW1pbm8vc2NoZW1hLnByb3RvEgZjYW1pbm8iSwoJU3ltYm9sUmVmEhEKCW5hbWVzcGFjZRgBIAEoCRIMCgRuYW1lGAIgASgJEg8KB3ZlcnNpb24YAyABKAkSDAoEaGFzaBgEIAEoCSIYCgNSZWYSEQoJb2JqZWN0X2lkGAEgASgJIhsKCENyZHRUZXh0Eg8KB3BheWxvYWQYASABKAwiHwoMQ3JkdFJpY2hUZXh0Eg8KB3BheWxvYWQYASABKAwiGwoIQ3JkdEpzb24SDwoHcGF5bG9hZBgBIAEoDCKDAgoLQ2xhc3NTY2hlbWESHQoCaWQYASABKAsyES5jYW1pbm8uU3ltYm9sUmVmEg8KB3ZlcnNpb24YAiABKA0SIwoGZmllbGRzGAMgAygLMhMuY2FtaW5vLkZpZWxkU2NoZW1hEiEKBWVkZ2VzGAQgAygLMhIuY2FtaW5vLkVkZ2VTY2hlbWESJQoHbWV0aG9kcxgFIAMoCzIULmNhbWluby5NZXRob2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A0SEgoKdG9fdmVyc2lvbhgCIAEoDRIlCghmdW5jdGlvbhgDIAEoCzITLnF1aXhvcy5GdW5jdGlvblJlZiKbAQoRRG9jUmVmRGVjbGFyYXRpb24SEgoKbG9jYWxfbmFtZRgBIAEoCRIfCgR0eXBlGAIgASgLMhEuY2FtaW5vLlN5bWJvbFJlZhInCgx0YXJnZXRfY2xhc3MYAyABKAsyES5jYW1pbm8uU3ltYm9sUmVmEigKCHN0cmVuZ3RoGAQgASgOMhYuY2FtaW5vLkRvY1JlZlN0cmVuZ3RoKmQKEENvbmZsaWN0U3RyYXRlZ3kSIQodQ09ORkxJQ1RfU1RSQVRFR1lfVU5TUEVDSUZJRUQQABILCgdSRVBMQUNFEAESFgoSUFJFU0VSVkVfQ09ORkxJQ1RTEAISCAoEQ1JEVBADKnoKC0NhcmRpbmFsaXR5EhsKF0NBUkRJTkFMSVRZX1VOU1BFQ0lGSUVEEAASEAoMT1BUSU9OQUxfT05FEAESDwoLRVhBQ1RMWV9PTkUQAhIICgRNQU5ZEAMSDwoLTUFOWV9VTklRVUUQBBIQCgxNQU5ZX09SREVSRUQQBSpUCg5Eb2NSZWZTdHJlbmd0aBIgChxET0NfUkVGX1NUUkVOR1RIX1VOU1BFQ0lGSUVEEAASDAoIU09GVF9SRUYQARISCg5QUk9KRUNURURfRURHRRACKmcKEEZpZWxkU3RvcmFnZUtpbmQSIgoeRklFTERfU1RPUkFHRV9LSU5EX1VOU1BFQ0lGSUVEEAASCgoGU1RPUkVEEAESCwoHREVSSVZFRBACEggKBExBWlkQAxIMCghFWFRFUk5BTBAEYgZwcm90bzM", [file_quixos_refs]); + +/** + * @generated from message camino.SymbolRef + */ +export type SymbolRef = Message<"camino.SymbolRef"> & { + /** + * @generated from field: string namespace = 1; + */ + namespace: string; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string version = 3; + */ + version: string; + + /** + * @generated from field: string hash = 4; + */ + hash: string; +}; + +/** + * Describes the message camino.SymbolRef. + * Use `create(SymbolRefSchema)` to create a new message. + */ +export const SymbolRefSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 0); + +/** + * @generated from message camino.Ref + */ +export type Ref = Message<"camino.Ref"> & { + /** + * @generated from field: string object_id = 1; + */ + objectId: string; +}; + +/** + * Describes the message camino.Ref. + * Use `create(RefSchema)` to create a new message. + */ +export const RefSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 1); + +/** + * @generated from message camino.CrdtText + */ +export type CrdtText = Message<"camino.CrdtText"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; +}; + +/** + * Describes the message camino.CrdtText. + * Use `create(CrdtTextSchema)` to create a new message. + */ +export const CrdtTextSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 2); + +/** + * @generated from message camino.CrdtRichText + */ +export type CrdtRichText = Message<"camino.CrdtRichText"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; +}; + +/** + * Describes the message camino.CrdtRichText. + * Use `create(CrdtRichTextSchema)` to create a new message. + */ +export const CrdtRichTextSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 3); + +/** + * @generated from message camino.CrdtJson + */ +export type CrdtJson = Message<"camino.CrdtJson"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; +}; + +/** + * Describes the message camino.CrdtJson. + * Use `create(CrdtJsonSchema)` to create a new message. + */ +export const CrdtJsonSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 4); + +/** + * @generated from message camino.ClassSchema + */ +export type ClassSchema = Message<"camino.ClassSchema"> & { + /** + * @generated from field: camino.SymbolRef id = 1; + */ + id?: SymbolRef | undefined; + + /** + * @generated from field: uint32 version = 2; + */ + version: number; + + /** + * @generated from field: repeated camino.FieldSchema fields = 3; + */ + fields: FieldSchema[]; + + /** + * @generated from field: repeated camino.EdgeSchema edges = 4; + */ + edges: EdgeSchema[]; + + /** + * @generated from field: repeated camino.MethodSchema methods = 5; + */ + methods: MethodSchema[]; + + /** + * @generated from field: repeated camino.MigrationSpec migrations = 6; + */ + migrations: MigrationSpec[]; + + /** + * @generated from field: string source_file = 7; + */ + sourceFile: string; + + /** + * @generated from field: string proto_message = 8; + */ + protoMessage: string; +}; + +/** + * Describes the message camino.ClassSchema. + * Use `create(ClassSchemaSchema)` to create a new message. + */ +export const ClassSchemaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 5); + +/** + * @generated from message camino.FieldSchema + */ +export type FieldSchema = Message<"camino.FieldSchema"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: uint32 tag = 2; + */ + tag: number; + + /** + * @generated from field: camino.TypeRef type = 3; + */ + type?: TypeRef | undefined; + + /** + * @generated from field: camino.ConflictStrategy conflict = 4; + */ + conflict: ConflictStrategy; + + /** + * @generated from field: bool repeated = 5; + */ + repeated: boolean; + + /** + * @generated from field: bool optional = 6; + */ + optional: boolean; + + /** + * @generated from field: camino.FieldStorage storage = 7; + */ + storage?: FieldStorage | undefined; +}; + +/** + * Describes the message camino.FieldSchema. + * Use `create(FieldSchemaSchema)` to create a new message. + */ +export const FieldSchemaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 6); + +/** + * @generated from message camino.FieldStorage + */ +export type FieldStorage = Message<"camino.FieldStorage"> & { + /** + * @generated from field: camino.FieldStorageKind kind = 1; + */ + kind: FieldStorageKind; + + /** + * @generated from field: quixos.FunctionRef resolver = 2; + */ + resolver?: FunctionRef | undefined; + + /** + * @generated from field: bool cache = 3; + */ + cache: boolean; +}; + +/** + * Describes the message camino.FieldStorage. + * Use `create(FieldStorageSchema)` to create a new message. + */ +export const FieldStorageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 7); + +/** + * @generated from message camino.TypeRef + */ +export type TypeRef = Message<"camino.TypeRef"> & { + /** + * @generated from field: string proto_type = 1; + */ + protoType: string; + + /** + * @generated from field: camino.SymbolRef symbol = 2; + */ + symbol?: SymbolRef | undefined; +}; + +/** + * Describes the message camino.TypeRef. + * Use `create(TypeRefSchema)` to create a new message. + */ +export const TypeRefSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 8); + +/** + * @generated from message camino.EdgeSchema + */ +export type EdgeSchema = Message<"camino.EdgeSchema"> & { + /** + * @generated from field: camino.SymbolRef id = 1; + */ + id?: SymbolRef | undefined; + + /** + * @generated from field: string source_field = 2; + */ + sourceField: string; + + /** + * @generated from field: camino.SymbolRef from_class = 3; + */ + fromClass?: SymbolRef | undefined; + + /** + * @generated from field: camino.SymbolRef to_class = 4; + */ + toClass?: SymbolRef | undefined; + + /** + * @generated from field: camino.Cardinality cardinality = 5; + */ + cardinality: Cardinality; + + /** + * @generated from field: string inverse = 6; + */ + inverse: string; + + /** + * @generated from field: repeated camino.FieldSchema fields = 7; + */ + fields: FieldSchema[]; +}; + +/** + * Describes the message camino.EdgeSchema. + * Use `create(EdgeSchemaSchema)` to create a new message. + */ +export const EdgeSchemaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 9); + +/** + * @generated from message camino.MethodSchema + */ +export type MethodSchema = Message<"camino.MethodSchema"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: quixos.FunctionRef function = 2; + */ + function?: FunctionRef | undefined; +}; + +/** + * Describes the message camino.MethodSchema. + * Use `create(MethodSchemaSchema)` to create a new message. + */ +export const MethodSchemaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 10); + +/** + * @generated from message camino.MigrationSpec + */ +export type MigrationSpec = Message<"camino.MigrationSpec"> & { + /** + * @generated from field: uint32 from_version = 1; + */ + fromVersion: number; + + /** + * @generated from field: uint32 to_version = 2; + */ + toVersion: number; + + /** + * @generated from field: quixos.FunctionRef function = 3; + */ + function?: FunctionRef | undefined; +}; + +/** + * Describes the message camino.MigrationSpec. + * Use `create(MigrationSpecSchema)` to create a new message. + */ +export const MigrationSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 11); + +/** + * @generated from message camino.DocRefDeclaration + */ +export type DocRefDeclaration = Message<"camino.DocRefDeclaration"> & { + /** + * @generated from field: string local_name = 1; + */ + localName: string; + + /** + * @generated from field: camino.SymbolRef type = 2; + */ + type?: SymbolRef | undefined; + + /** + * @generated from field: camino.SymbolRef target_class = 3; + */ + targetClass?: SymbolRef | undefined; + + /** + * @generated from field: camino.DocRefStrength strength = 4; + */ + strength: DocRefStrength; +}; + +/** + * Describes the message camino.DocRefDeclaration. + * Use `create(DocRefDeclarationSchema)` to create a new message. + */ +export const DocRefDeclarationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_camino_schema, 12); + +/** + * @generated from enum camino.ConflictStrategy + */ +export enum ConflictStrategy { + /** + * @generated from enum value: CONFLICT_STRATEGY_UNSPECIFIED = 0; + */ + CONFLICT_STRATEGY_UNSPECIFIED = 0, + + /** + * @generated from enum value: REPLACE = 1; + */ + REPLACE = 1, + + /** + * @generated from enum value: PRESERVE_CONFLICTS = 2; + */ + PRESERVE_CONFLICTS = 2, + + /** + * @generated from enum value: CRDT = 3; + */ + CRDT = 3, +} + +/** + * Describes the enum camino.ConflictStrategy. + */ +export const ConflictStrategySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_camino_schema, 0); + +/** + * @generated from enum camino.Cardinality + */ +export enum Cardinality { + /** + * @generated from enum value: CARDINALITY_UNSPECIFIED = 0; + */ + CARDINALITY_UNSPECIFIED = 0, + + /** + * @generated from enum value: OPTIONAL_ONE = 1; + */ + OPTIONAL_ONE = 1, + + /** + * @generated from enum value: EXACTLY_ONE = 2; + */ + EXACTLY_ONE = 2, + + /** + * @generated from enum value: MANY = 3; + */ + MANY = 3, + + /** + * @generated from enum value: MANY_UNIQUE = 4; + */ + MANY_UNIQUE = 4, + + /** + * @generated from enum value: MANY_ORDERED = 5; + */ + MANY_ORDERED = 5, +} + +/** + * Describes the enum camino.Cardinality. + */ +export const CardinalitySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_camino_schema, 1); + +/** + * @generated from enum camino.DocRefStrength + */ +export enum DocRefStrength { + /** + * @generated from enum value: DOC_REF_STRENGTH_UNSPECIFIED = 0; + */ + DOC_REF_STRENGTH_UNSPECIFIED = 0, + + /** + * @generated from enum value: SOFT_REF = 1; + */ + SOFT_REF = 1, + + /** + * @generated from enum value: PROJECTED_EDGE = 2; + */ + PROJECTED_EDGE = 2, +} + +/** + * Describes the enum camino.DocRefStrength. + */ +export const DocRefStrengthSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_camino_schema, 2); + +/** + * @generated from enum camino.FieldStorageKind + */ +export enum FieldStorageKind { + /** + * @generated from enum value: FIELD_STORAGE_KIND_UNSPECIFIED = 0; + */ + FIELD_STORAGE_KIND_UNSPECIFIED = 0, + + /** + * @generated from enum value: STORED = 1; + */ + STORED = 1, + + /** + * @generated from enum value: DERIVED = 2; + */ + DERIVED = 2, + + /** + * @generated from enum value: LAZY = 3; + */ + LAZY = 3, + + /** + * @generated from enum value: EXTERNAL = 4; + */ + EXTERNAL = 4, +} + +/** + * Describes the enum camino.FieldStorageKind. + */ +export const FieldStorageKindSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_camino_schema, 3); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..7b7ac91 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,309 @@ +import http from "node:http"; +import { create } from "@bufbuild/protobuf"; +import { createClient, type Client } from "@connectrpc/connect"; +import { + connectNodeAdapter, + createConnectTransport, +} from "@connectrpc/connect-node"; +import { + CaminoService, + CrdtValueSchema, + ListValueSchema, + NullValueSchema, + ObjectValueSchema, + RefValueSchema, + ValueSchema, + type Value, +} from "./camino/api_pb.js"; +import { + HandshakeResponseSchema, + InvokeResponseSchema, + PackageRuntime, + type InvokeRequest, +} from "./quixos/runtime_pb.js"; +import { FunctionRefSchema } from "./quixos/refs_pb.js"; + +declare const objectRefBrand: unique symbol; + +export type ObjectRef = string & { + readonly [objectRefBrand]: ClassId; +}; + +export type CaminoClient = Client; + +export type { InvokeRequest, Value }; + +export type Field = { + set(value: T): Promise; +}; + +export type RuntimeHandler = ( + context: Context, +) => Promise | unknown; + +export type RuntimeFunctionSpec = { + exportName: ExportName; + symbol: string; +}; + +const isRecord = (value: unknown): value is Record => + Boolean(value) && typeof value === "object" && !Array.isArray(value); + +const bytesToBase64 = (value: Uint8Array) => + Buffer.from(value).toString("base64"); + +const base64ToBytes = (value: string) => Buffer.from(value, "base64"); + +export const jsToProtoValue = (value: unknown): Value => { + if (value === null || value === undefined) { + return create(ValueSchema, { + kind: { + case: "nullValue", + value: create(NullValueSchema, {}), + }, + }); + } + if (typeof value === "boolean") { + return create(ValueSchema, { + kind: { case: "boolValue", value }, + }); + } + if (typeof value === "number") { + return create(ValueSchema, { + kind: { case: "numberValue", value }, + }); + } + if (typeof value === "bigint") { + return create(ValueSchema, { + kind: { case: "integerValue", value: value.toString() }, + }); + } + if (typeof value === "string") { + return create(ValueSchema, { + kind: { case: "stringValue", value }, + }); + } + if (value instanceof Uint8Array) { + return create(ValueSchema, { + kind: { case: "bytesValue", value }, + }); + } + if (Array.isArray(value)) { + return create(ValueSchema, { + kind: { + case: "listValue", + value: create(ListValueSchema, { + values: value.map(jsToProtoValue), + }), + }, + }); + } + if (isRecord(value)) { + if (typeof value.$caminoRef === "string") { + return create(ValueSchema, { + kind: { + case: "refValue", + value: create(RefValueSchema, { + objectId: value.$caminoRef, + }), + }, + }); + } + if ( + typeof value.$caminoBytes === "string" && + Object.keys(value).every((key) => key === "$caminoBytes") + ) { + return create(ValueSchema, { + kind: { + case: "bytesValue", + value: base64ToBytes(value.$caminoBytes), + }, + }); + } + if ( + typeof value.$caminoCrdtType === "string" && + typeof value.$caminoCrdtPayload === "string" + ) { + return create(ValueSchema, { + kind: { + case: "crdtValue", + value: create(CrdtValueSchema, { + type: value.$caminoCrdtType, + encoding: + typeof value.$caminoCrdtEncoding === "string" + ? value.$caminoCrdtEncoding + : "base64", + payload: base64ToBytes(value.$caminoCrdtPayload), + }), + }, + }); + } + return create(ValueSchema, { + kind: { + case: "objectValue", + value: create(ObjectValueSchema, { + fields: jsObjectToProtoFields(value), + }), + }, + }); + } + throw new Error(`Unsupported Camino RPC value: ${typeof value}`); +}; + +export const protoValueToJs = (value: Value | undefined): unknown => { + switch (value?.kind.case) { + case "nullValue": + case undefined: + return null; + case "boolValue": + case "numberValue": + case "stringValue": + return value.kind.value; + case "integerValue": + return value.kind.value; + case "bytesValue": + return bytesToBase64(value.kind.value); + case "listValue": + return value.kind.value.values.map(protoValueToJs); + case "objectValue": + return protoFieldsToJs(value.kind.value.fields); + case "refValue": + return value.kind.value.objectId; + case "crdtValue": + return { + $caminoCrdtType: value.kind.value.type, + $caminoCrdtEncoding: value.kind.value.encoding, + $caminoCrdtPayload: bytesToBase64(value.kind.value.payload), + }; + } +}; + +export const jsObjectToProtoFields = (value: Record) => + Object.fromEntries( + Object.entries(value) + .filter(([, fieldValue]) => fieldValue !== undefined) + .map(([key, fieldValue]) => [key, jsToProtoValue(fieldValue)]), + ); + +export const protoFieldsToJs = ( + fields: Record | undefined, +): Record => + Object.fromEntries( + Object.entries(fields ?? {}).map(([key, value]) => [ + key, + protoValueToJs(value), + ]), + ); + +export const objectRef = (objectId: string) => + objectId as ObjectRef; + +export const createField = ( + camino: CaminoClient, + objectId: string, + fieldName: string, +): Field => ({ + async set(value) { + await camino.setField({ + objectId, + fieldName, + value: jsToProtoValue(value), + }); + }, +}); + +export const serveQuixosPackageRuntime = < + Context, + Spec extends readonly RuntimeFunctionSpec[], +>(params: { + packageNamespace: string; + packageName: string; + runtimeProtocolVersion: string; + functions: Spec; + implementation: { + [Name in Spec[number]["exportName"]]: RuntimeHandler; + }; + createContext: (camino: CaminoClient, request: InvokeRequest) => Context; +}) => { + const host = process.env.QUIXOS_RUNTIME_HOST ?? "127.0.0.1"; + const port = Number(process.env.QUIXOS_RUNTIME_PORT ?? "0"); + const caminoUrl = process.env.CAMINO_URL ?? "http://127.0.0.1:7310"; + const camino = createClient( + CaminoService, + createConnectTransport({ baseUrl: caminoUrl, httpVersion: "1.1" }), + ); + + if (!Number.isInteger(port) || port <= 0) { + throw new Error("QUIXOS_RUNTIME_PORT must be a positive integer"); + } + + const functionRefs = params.functions.map((entry) => + create(FunctionRefSchema, { + packageNamespace: params.packageNamespace, + packageName: params.packageName, + symbol: entry.symbol, + }), + ); + + const handler = connectNodeAdapter({ + routes: (router) => { + router.service(PackageRuntime, { + async handshake() { + return create(HandshakeResponseSchema, { + packageNamespace: params.packageNamespace, + packageName: params.packageName, + runtimeProtocolVersion: params.runtimeProtocolVersion, + functions: functionRefs, + }); + }, + + async invoke(request) { + try { + const symbol = request.function?.symbol ?? ""; + const spec = params.functions.find( + (entry) => entry.symbol === symbol, + ); + if (!spec) { + throw new Error( + `Unknown ${params.packageName} function: ${symbol}`, + ); + } + const runtimeFunction = ( + params.implementation as Record> + )[spec.exportName]; + if (!runtimeFunction) { + throw new Error( + `Missing ${params.packageName} implementation export: ${spec.exportName}`, + ); + } + return create(InvokeResponseSchema, { + ok: true, + result: jsToProtoValue( + await runtimeFunction(params.createContext(camino, request)), + ), + }); + } catch (error) { + return create(InvokeResponseSchema, { + ok: false, + result: jsToProtoValue(null), + error: error instanceof Error ? error.message : String(error), + }); + } + }, + }); + }, + }); + + const server = http.createServer((request, response) => { + void handler(request, response); + }); + const close = () => server.close(() => process.exit(0)); + + server.listen(port, host, () => { + process.stderr.write( + `${params.packageName} listening on ${host}:${port}\n`, + ); + }); + process.on("SIGTERM", close); + process.on("SIGINT", close); +}; diff --git a/src/quixos/refs_pb.ts b/src/quixos/refs_pb.ts new file mode 100644 index 0000000..05a1adb --- /dev/null +++ b/src/quixos/refs_pb.ts @@ -0,0 +1,45 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js" +// @generated from file quixos/refs.proto (package quixos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file quixos/refs.proto. + */ +export const file_quixos_refs: GenFile = /*@__PURE__*/ + fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zImMKC0Z1bmN0aW9uUmVmEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIOCgZzeW1ib2wYAyABKAkSEwoLdmVyc2lvbl9yZWYYBCABKAliBnByb3RvMw"); + +/** + * @generated from message quixos.FunctionRef + */ +export type FunctionRef = Message<"quixos.FunctionRef"> & { + /** + * @generated from field: string package_namespace = 1; + */ + packageNamespace: string; + + /** + * @generated from field: string package_name = 2; + */ + packageName: string; + + /** + * @generated from field: string symbol = 3; + */ + symbol: string; + + /** + * @generated from field: string version_ref = 4; + */ + versionRef: string; +}; + +/** + * Describes the message quixos.FunctionRef. + * Use `create(FunctionRefSchema)` to create a new message. + */ +export const FunctionRefSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_quixos_refs, 0); diff --git a/src/quixos/runtime_pb.ts b/src/quixos/runtime_pb.ts new file mode 100644 index 0000000..8ffc7fe --- /dev/null +++ b/src/quixos/runtime_pb.ts @@ -0,0 +1,148 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js" +// @generated from file quixos/runtime.proto (package quixos.runtime, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Value } from "../camino/api_pb.js"; +import { file_camino_api } from "../camino/api_pb.js"; +import type { FunctionRef } from "./refs_pb.js"; +import { file_quixos_refs } from "./refs_pb.js"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file quixos/runtime.proto. + */ +export const file_quixos_runtime: GenFile = /*@__PURE__*/ + fileDesc("ChRxdWl4b3MvcnVudGltZS5wcm90bxIOcXVpeG9zLnJ1bnRpbWUiMQoQSGFuZHNoYWtlUmVxdWVzdBIdChVvcmNoX3Byb3RvY29sX3ZlcnNpb24YASABKAkijgEKEUhhbmRzaGFrZVJlc3BvbnNlEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIgChhydW50aW1lX3Byb3RvY29sX3ZlcnNpb24YAyABKAkSJgoJZnVuY3Rpb25zGAQgAygLMhMucXVpeG9zLkZ1bmN0aW9uUmVmItYBCg1JbnZva2VSZXF1ZXN0EhUKDWludm9jYXRpb25faWQYASABKAkSJQoIZnVuY3Rpb24YAiABKAsyEy5xdWl4b3MuRnVuY3Rpb25SZWYSEQoJb2JqZWN0X2lkGAMgASgJEjcKBWlucHV0GAQgAygLMigucXVpeG9zLnJ1bnRpbWUuSW52b2tlUmVxdWVzdC5JbnB1dEVudHJ5GjsKCklucHV0RW50cnkSCwoDa2V5GAEgASgJEhwKBXZhbHVlGAIgASgLMg0uY2FtaW5vLlZhbHVlOgI4ASJKCg5JbnZva2VSZXNwb25zZRIKCgJvaxgBIAEoCBIdCgZyZXN1bHQYAiABKAsyDS5jYW1pbm8uVmFsdWUSDQoFZXJyb3IYAyABKAkyqwEKDlBhY2thZ2VSdW50aW1lElAKCUhhbmRzaGFrZRIgLnF1aXhvcy5ydW50aW1lLkhhbmRzaGFrZVJlcXVlc3QaIS5xdWl4b3MucnVudGltZS5IYW5kc2hha2VSZXNwb25zZRJHCgZJbnZva2USHS5xdWl4b3MucnVudGltZS5JbnZva2VSZXF1ZXN0Gh4ucXVpeG9zLnJ1bnRpbWUuSW52b2tlUmVzcG9uc2ViBnByb3RvMw", [file_camino_api, file_quixos_refs]); + +/** + * @generated from message quixos.runtime.HandshakeRequest + */ +export type HandshakeRequest = Message<"quixos.runtime.HandshakeRequest"> & { + /** + * @generated from field: string orch_protocol_version = 1; + */ + orchProtocolVersion: string; +}; + +/** + * Describes the message quixos.runtime.HandshakeRequest. + * Use `create(HandshakeRequestSchema)` to create a new message. + */ +export const HandshakeRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_quixos_runtime, 0); + +/** + * @generated from message quixos.runtime.HandshakeResponse + */ +export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & { + /** + * @generated from field: string package_namespace = 1; + */ + packageNamespace: string; + + /** + * @generated from field: string package_name = 2; + */ + packageName: string; + + /** + * @generated from field: string runtime_protocol_version = 3; + */ + runtimeProtocolVersion: string; + + /** + * @generated from field: repeated quixos.FunctionRef functions = 4; + */ + functions: FunctionRef[]; +}; + +/** + * Describes the message quixos.runtime.HandshakeResponse. + * Use `create(HandshakeResponseSchema)` to create a new message. + */ +export const HandshakeResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_quixos_runtime, 1); + +/** + * @generated from message quixos.runtime.InvokeRequest + */ +export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & { + /** + * @generated from field: string invocation_id = 1; + */ + invocationId: string; + + /** + * @generated from field: quixos.FunctionRef function = 2; + */ + function?: FunctionRef | undefined; + + /** + * @generated from field: string object_id = 3; + */ + objectId: string; + + /** + * @generated from field: map input = 4; + */ + input: { [key: string]: Value }; +}; + +/** + * Describes the message quixos.runtime.InvokeRequest. + * Use `create(InvokeRequestSchema)` to create a new message. + */ +export const InvokeRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_quixos_runtime, 2); + +/** + * @generated from message quixos.runtime.InvokeResponse + */ +export type InvokeResponse = Message<"quixos.runtime.InvokeResponse"> & { + /** + * @generated from field: bool ok = 1; + */ + ok: boolean; + + /** + * @generated from field: camino.Value result = 2; + */ + result?: Value | undefined; + + /** + * @generated from field: string error = 3; + */ + error: string; +}; + +/** + * Describes the message quixos.runtime.InvokeResponse. + * Use `create(InvokeResponseSchema)` to create a new message. + */ +export const InvokeResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_quixos_runtime, 3); + +/** + * @generated from service quixos.runtime.PackageRuntime + */ +export const PackageRuntime: GenService<{ + /** + * @generated from rpc quixos.runtime.PackageRuntime.Handshake + */ + handshake: { + methodKind: "unary"; + input: typeof HandshakeRequestSchema; + output: typeof HandshakeResponseSchema; + }, + /** + * @generated from rpc quixos.runtime.PackageRuntime.Invoke + */ + invoke: { + methodKind: "unary"; + input: typeof InvokeRequestSchema; + output: typeof InvokeResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_quixos_runtime, 0); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d37040d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist" + }, + "include": ["src/**/*.ts"] +}