Compare commits
58 Commits
aec3a348b1
...
exported
| Author | SHA1 | Date | |
|---|---|---|---|
| 86933aa97f | |||
| 437dbbc850 | |||
| 45477f3b07 | |||
| 446fd4e36e | |||
| dac9c48856 | |||
| d0dca13ff9 | |||
| f42d70a4fe | |||
| 424ebec92e | |||
| b86dbe2dfa | |||
| 1982c6fff1 | |||
| 13d2d0b1ee | |||
| c1330ae8e3 | |||
| 7e69e675ba | |||
| 99101ad206 | |||
| 169c0cdc37 | |||
| 47efd9659d | |||
| cd2b04dc8c | |||
| fc838413c5 | |||
| 5bb8ee876d | |||
| 0e183516c0 | |||
| 2319b1f637 | |||
| 0854822923 | |||
| 0d3c013c07 | |||
| bee4452852 | |||
| d3d050d9cb | |||
| e8a175504a | |||
| 3dd4e9a1ad | |||
| 62ae43ee40 | |||
| 110e41b268 | |||
| 2b7035fe81 | |||
| 8480674212 | |||
| 79fbee2b32 | |||
| a2fe7e4f5e | |||
| 652ac8e53e | |||
| 0907f97803 | |||
| ce6ae8f662 | |||
| 549c4539d5 | |||
| fa9e77e75c | |||
| a998690446 | |||
| 46c8950a75 | |||
| 2de080c09f | |||
| c15a8a51fa | |||
| d83f82c90f | |||
| b7b4a63155 | |||
| 04614be2c9 | |||
| 16b344c0ad | |||
| 385a5bd595 | |||
| 9771b0803e | |||
| 2dfba87179 | |||
| ab46f4f136 | |||
| 673575fc54 | |||
| dcdbd525fb | |||
| 5d3bd68a63 | |||
| 5c6f9b9de5 | |||
| 69441e9465 | |||
| 6c3542d2ea | |||
| 833518c3ea | |||
| e564cfeb32 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"sourceRepo": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos.git",
|
"sourceRepo": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos",
|
||||||
"sourceCommit": "9e02a6add77fb8f36c8d242c7a135069cabc783b",
|
"sourceCommit": "7efe88cdfc5244727d80239c79845b44d1e79ccb",
|
||||||
"sourcePath": "quixos-instance/packages/camino-package-runtime",
|
"sourcePath": "quixos-instance/packages/camino-package-runtime",
|
||||||
"exportName": "camino-package-runtime",
|
"exportName": "camino-package-runtime",
|
||||||
"mirrorRemote": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git"
|
"mirrorRemote": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-package-runtime.git"
|
||||||
|
|||||||
Binary file not shown.
+15
-1
@@ -1,5 +1,5 @@
|
|||||||
approvedGitRepositories:
|
approvedGitRepositories:
|
||||||
- https://gitea-external.egads.tutti.syntaxblitz.net/quixos/*
|
- "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/*"
|
||||||
|
|
||||||
enableScripts: true
|
enableScripts: true
|
||||||
|
|
||||||
@@ -9,6 +9,20 @@ individualNixPackaging: true
|
|||||||
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
supportedArchitectures:
|
||||||
|
os:
|
||||||
|
- current
|
||||||
|
- linux
|
||||||
|
cpu:
|
||||||
|
- current
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
|
libc:
|
||||||
|
- current
|
||||||
|
- glibc
|
||||||
|
|
||||||
|
npmMinimalAgeGate: 0
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- checksum: 271de9a785321a37c564b8e2a6b5cd689850b20572d5fee8ec0a6b8e7a5d4cfb59e533524af2b4a537e00da12828abd062eaec6978556e3dd9149a020db2591b
|
- checksum: 271de9a785321a37c564b8e2a6b5cd689850b20572d5fee8ec0a6b8e7a5d4cfb59e533524af2b4a537e00da12828abd062eaec6978556e3dd9149a020db2591b
|
||||||
path: .yarn/plugins/yarn-plugin-nixify.cjs
|
path: .yarn/plugins/yarn-plugin-nixify.cjs
|
||||||
|
|||||||
Vendored
+103
@@ -0,0 +1,103 @@
|
|||||||
|
import { type Value } from "./camino/api_pb.js";
|
||||||
|
import { liveValue, type RuntimeHandler, type DerivedHandler } from "./index.js";
|
||||||
|
export type { QxObjectRef } from "./references.js";
|
||||||
|
declare const watchBrand: unique symbol;
|
||||||
|
export type QxWatchHandle = string & {
|
||||||
|
readonly [watchBrand]: true;
|
||||||
|
};
|
||||||
|
export type MessageBinding<T> = {
|
||||||
|
encode(value: T): Value;
|
||||||
|
decode(value: Value): T;
|
||||||
|
};
|
||||||
|
export type QxLiveValue = ReturnType<typeof liveValue>;
|
||||||
|
export type BindingValue<B> = B extends MessageBinding<infer T> ? T : never;
|
||||||
|
export type QxHandler<C, O> = (context: C) => O | Promise<O>;
|
||||||
|
export type QxDerived<C, O> = {
|
||||||
|
kind: "derived";
|
||||||
|
get: QxHandler<C, O>;
|
||||||
|
};
|
||||||
|
export type QxSession<C> = {
|
||||||
|
id: string;
|
||||||
|
run<T>(work: (context: C) => Promise<T>): Promise<T>;
|
||||||
|
close(): Promise<void>;
|
||||||
|
};
|
||||||
|
export type QxContextLifecycle<C> = {
|
||||||
|
signal?: AbortSignal;
|
||||||
|
openSession?: () => Promise<QxSession<C>>;
|
||||||
|
};
|
||||||
|
declare const contractView: unique symbol;
|
||||||
|
/** Generated exact closed contract. A descriptor is type evidence, never authority. */
|
||||||
|
export type QxInterfaceContract<View> = {
|
||||||
|
readonly interfaceRevisionId: string;
|
||||||
|
readonly operations: Record<string, QxOperationSpec>;
|
||||||
|
readonly [contractView]: (value: View) => View;
|
||||||
|
};
|
||||||
|
export declare const defineQxInterfaceContract: <View>(interfaceRevisionId: string, operations: Record<string, QxOperationSpec>) => QxInterfaceContract<View>;
|
||||||
|
export type QxConformer = {
|
||||||
|
tryConform<View>(object: import("./references.js").QxObjectRef, contract: QxInterfaceContract<View>): Promise<View | undefined>;
|
||||||
|
};
|
||||||
|
export declare const qxDerived: <C, O>(get: QxHandler<C, O>) => QxDerived<C, O>;
|
||||||
|
/** Versioned binding ABI. This mirrors the language-neutral value IR. */
|
||||||
|
export type QxValueType = {
|
||||||
|
kind: "builtin";
|
||||||
|
name: "unit" | "watch-handle";
|
||||||
|
} | {
|
||||||
|
kind: "scalar";
|
||||||
|
name: string;
|
||||||
|
} | {
|
||||||
|
kind: "message";
|
||||||
|
descriptorId: string;
|
||||||
|
} | {
|
||||||
|
kind: "record";
|
||||||
|
fields: Record<string, QxValueType>;
|
||||||
|
} | {
|
||||||
|
kind: "object-ref";
|
||||||
|
expectation: unknown;
|
||||||
|
} | {
|
||||||
|
kind: "optional" | "list";
|
||||||
|
value: QxValueType;
|
||||||
|
};
|
||||||
|
export type QxOperationSpec = {
|
||||||
|
id: string;
|
||||||
|
inputType: QxValueType;
|
||||||
|
outputType: QxValueType;
|
||||||
|
};
|
||||||
|
export type QxPortSpec = {
|
||||||
|
kind: "query";
|
||||||
|
id: string;
|
||||||
|
definitionDigest: string;
|
||||||
|
variables: QxValueType;
|
||||||
|
output: QxValueType;
|
||||||
|
watch: boolean;
|
||||||
|
} | {
|
||||||
|
kind: "state";
|
||||||
|
id: string;
|
||||||
|
valueType: QxValueType;
|
||||||
|
primitives: string[];
|
||||||
|
} | {
|
||||||
|
kind: "edge";
|
||||||
|
id: string;
|
||||||
|
primitives: string[];
|
||||||
|
} | {
|
||||||
|
kind: "interface";
|
||||||
|
id: string;
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
operations: Record<string, QxOperationSpec>;
|
||||||
|
} | {
|
||||||
|
kind: "constructor";
|
||||||
|
id: string;
|
||||||
|
inputType: QxValueType;
|
||||||
|
};
|
||||||
|
export type QxHandlerSpec = {
|
||||||
|
receiver?: "none";
|
||||||
|
inputType: QxValueType;
|
||||||
|
outputType: QxValueType;
|
||||||
|
eventType?: QxValueType;
|
||||||
|
ports: Record<string, QxPortSpec>;
|
||||||
|
};
|
||||||
|
export type QxMessages = Record<string, MessageBinding<any>>;
|
||||||
|
export declare const decodeQxValue: (type: QxValueType, value: Value | undefined, messages: QxMessages) => any;
|
||||||
|
export declare const encodeQxValue: (type: QxValueType, value: any, messages: QxMessages) => Value;
|
||||||
|
/** The sole unchecked cast connects generated contracts to the dynamic RPC runtime. */
|
||||||
|
export declare const bindQxHandler: <C, O>(spec: QxHandlerSpec, handler: QxHandler<C, O> | QxDerived<C, O>, messages: QxMessages) => RuntimeHandler | DerivedHandler;
|
||||||
|
//# sourceMappingURL=bindings.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAGL,SAAS,EAGT,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AACxC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AACrE,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAAE,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;IAAC,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAA;CAAE,CAAC;AACrF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5E,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7D,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,SAAS,CA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C,EAAE,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAAE,GAC3G;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,WAAW,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AA6B7D,eAAO,MAAM,aAAa,SAAU,WAAW,SAAS,KAAK,GAAG,SAAS,YAAY,UAAU,KAAG,GAyCjG,CAAC;AAOF,eAAO,MAAM,aAAa,SAAU,WAAW,SAAS,GAAG,YAAY,UAAU,KAAG,KA8BnF,CAAC;AAmBF,uFAAuF;AACvF,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,QAC1B,aAAa,WACV,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,YAChC,UAAU,KACnB,cAAc,GAAG,cAgInB,CAAC"}
|
||||||
Vendored
+247
@@ -0,0 +1,247 @@
|
|||||||
|
import { create } from "@bufbuild/protobuf";
|
||||||
|
import { ValueSchema, ObjectValueSchema } from "./camino/api_pb.js";
|
||||||
|
import { derived, jsToProtoValue, liveValue, protoValueToJs, } from "./index.js";
|
||||||
|
import { assertReferenceFree, referenceToWire } from "./references.js";
|
||||||
|
import { decodeQuerySnapshot } from "./queries.js";
|
||||||
|
export const defineQxInterfaceContract = (interfaceRevisionId, operations) => Object.freeze({ interfaceRevisionId, operations });
|
||||||
|
export const qxDerived = (get) => ({ kind: "derived", get });
|
||||||
|
const bindInterfaceView = (target, contract, messages) => ({
|
||||||
|
objectId: target.objectId,
|
||||||
|
contract,
|
||||||
|
live: Object.fromEntries(Object.entries(contract.operations).map(([name, operation]) => [
|
||||||
|
name,
|
||||||
|
(input) => target.live(operation.id, inputFields(operation.inputType, input, messages)),
|
||||||
|
])),
|
||||||
|
...Object.fromEntries(Object.entries(contract.operations).map(([name, operation]) => [
|
||||||
|
name,
|
||||||
|
async (input) => decodeQxValue(operation.outputType, (await target.live(operation.id, inputFields(operation.inputType, input, messages))).$quixosValue, messages),
|
||||||
|
])),
|
||||||
|
});
|
||||||
|
// Conversion belongs at the binding boundary. It does not add orchestrator validation.
|
||||||
|
export const decodeQxValue = (type, value, messages) => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit")
|
||||||
|
return null;
|
||||||
|
if (type.kind === "optional" && !value)
|
||||||
|
return null;
|
||||||
|
if (!value)
|
||||||
|
throw new Error("Missing QX wire value");
|
||||||
|
if (type.kind === "record") {
|
||||||
|
if (value.kind.case !== "objectValue")
|
||||||
|
throw new Error("Expected QX record");
|
||||||
|
const fields = value.kind.value.fields;
|
||||||
|
if (Object.keys(fields).some((name) => !Object.hasOwn(type.fields, name)))
|
||||||
|
throw new Error("Unexpected QX record field");
|
||||||
|
return Object.fromEntries(Object.entries(type.fields).map(([name, field]) => [name, decodeQxValue(field, fields[name], messages)]));
|
||||||
|
}
|
||||||
|
if (type.kind === "optional")
|
||||||
|
return value.kind.case === "nullValue" ? null : decodeQxValue(type.value, value, messages);
|
||||||
|
if (type.kind === "list") {
|
||||||
|
if (value.kind.case !== "listValue")
|
||||||
|
throw new Error("Expected QX list");
|
||||||
|
return value.kind.value.values.map((entry) => decodeQxValue(type.value, entry, messages));
|
||||||
|
}
|
||||||
|
if (type.kind === "message") {
|
||||||
|
assertReferenceFree(protoValueToJs(value));
|
||||||
|
const decoded = requireMessage(messages, type.descriptorId).decode(value);
|
||||||
|
assertReferenceFree(decoded);
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
if (type.kind === "object-ref") {
|
||||||
|
if (value.kind.case !== "refValue")
|
||||||
|
throw new Error("Expected a declared RPC object reference");
|
||||||
|
return protoValueToJs(value);
|
||||||
|
}
|
||||||
|
if (value.kind.case === "refValue")
|
||||||
|
throw new Error("Reference supplied to a non-reference value");
|
||||||
|
if (type.kind === "scalar") {
|
||||||
|
if (type.name === "int64" || type.name === "uint64") {
|
||||||
|
if (value.kind.case !== "integerValue")
|
||||||
|
throw new Error("Expected QX integer");
|
||||||
|
return BigInt(value.kind.value);
|
||||||
|
}
|
||||||
|
if (type.name === "bytes") {
|
||||||
|
if (value.kind.case !== "bytesValue")
|
||||||
|
throw new Error("Expected QX bytes");
|
||||||
|
return value.kind.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return protoValueToJs(value);
|
||||||
|
};
|
||||||
|
const requireMessage = (messages, id) => {
|
||||||
|
const binding = messages[id];
|
||||||
|
if (!binding)
|
||||||
|
throw new Error(`Missing message binding ${id}`);
|
||||||
|
return binding;
|
||||||
|
};
|
||||||
|
export const encodeQxValue = (type, value, messages) => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit")
|
||||||
|
return jsToProtoValue(null);
|
||||||
|
if (type.kind === "record") {
|
||||||
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
||||||
|
throw new Error("Expected QX record");
|
||||||
|
if (Object.keys(value).some((name) => !Object.hasOwn(type.fields, name)))
|
||||||
|
throw new Error("Unexpected QX record field");
|
||||||
|
const fields = Object.fromEntries(Object.entries(type.fields).map(([name, field]) => {
|
||||||
|
if (!Object.hasOwn(value, name) && field.kind !== "optional")
|
||||||
|
throw new Error(`Missing QX record field ${name}`);
|
||||||
|
return [name, encodeQxValue(field, value[name] ?? (field.kind === "optional" ? null : value[name]), messages)];
|
||||||
|
}));
|
||||||
|
return create(ValueSchema, { kind: { case: "objectValue", value: create(ObjectValueSchema, { fields }) } });
|
||||||
|
}
|
||||||
|
if (type.kind === "optional")
|
||||||
|
return value === null ? jsToProtoValue(null) : encodeQxValue(type.value, value, messages);
|
||||||
|
if (type.kind === "list")
|
||||||
|
return jsToProtoValue(value.map((entry) => liveValue(encodeQxValue(type.value, entry, messages))));
|
||||||
|
if (type.kind === "object-ref") {
|
||||||
|
referenceToWire(value);
|
||||||
|
return jsToProtoValue(value);
|
||||||
|
}
|
||||||
|
assertReferenceFree(value);
|
||||||
|
if (type.kind === "message") {
|
||||||
|
const encoded = requireMessage(messages, type.descriptorId).encode(value);
|
||||||
|
assertReferenceFree(protoValueToJs(encoded));
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
return jsToProtoValue(value);
|
||||||
|
};
|
||||||
|
const inputValue = (context, type) => {
|
||||||
|
if (type.kind === "message" || type.kind === "record")
|
||||||
|
return create(ValueSchema, {
|
||||||
|
kind: { case: "objectValue", value: create(ObjectValueSchema, { fields: context.inputProto }) },
|
||||||
|
});
|
||||||
|
return context.inputProto.value;
|
||||||
|
};
|
||||||
|
const inputFields = (type, value, messages) => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit")
|
||||||
|
return {};
|
||||||
|
const encoded = encodeQxValue(type, value, messages);
|
||||||
|
if (type.kind === "message" || type.kind === "record") {
|
||||||
|
if (encoded.kind.case !== "objectValue")
|
||||||
|
throw new Error("Message inputs must encode an object value");
|
||||||
|
return Object.fromEntries(Object.entries(encoded.kind.value.fields).map(([key, entry]) => [key, liveValue(entry)]));
|
||||||
|
}
|
||||||
|
return { value: liveValue(encoded) };
|
||||||
|
};
|
||||||
|
/** The sole unchecked cast connects generated contracts to the dynamic RPC runtime. */
|
||||||
|
export const bindQxHandler = (spec, handler, messages) => {
|
||||||
|
const bindContext = (raw) => {
|
||||||
|
const ports = Object.fromEntries(Object.entries(spec.ports).map(([name, port]) => {
|
||||||
|
switch (port.kind) {
|
||||||
|
case "state": {
|
||||||
|
const state = raw.state(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
...(port.primitives.includes("read")
|
||||||
|
? {
|
||||||
|
get: async () => decodeQxValue(port.valueType, (await state.live()).$quixosValue, messages),
|
||||||
|
live: () => state.live(),
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
...(port.primitives.includes("write")
|
||||||
|
? {
|
||||||
|
set: async (value) => state.set(liveValue(encodeQxValue(port.valueType, value, messages))),
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "edge": {
|
||||||
|
const edge = raw.edge(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
...Object.fromEntries(port.primitives.map((primitive) => [
|
||||||
|
primitive,
|
||||||
|
edge[primitive],
|
||||||
|
])),
|
||||||
|
...(port.primitives.includes("resolve") ? { collection: edge.collection } : {}),
|
||||||
|
...(port.primitives.includes("resolve") &&
|
||||||
|
port.primitives.includes("connect") &&
|
||||||
|
port.primitives.includes("disconnect")
|
||||||
|
? { replace: edge.replace }
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "interface": {
|
||||||
|
const target = raw.interface(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
bindInterfaceView(target, defineQxInterfaceContract(port.interfaceRevisionId, port.operations), messages),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "query": {
|
||||||
|
const query = raw.query(port.id);
|
||||||
|
const variablesToWire = (variables) => {
|
||||||
|
const value = encodeQxValue(port.variables, variables, messages);
|
||||||
|
if (value.kind.case !== "objectValue")
|
||||||
|
throw new Error("QUERY_VARIABLE_INVALID");
|
||||||
|
return value.kind.value.fields;
|
||||||
|
};
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
async execute(variables) {
|
||||||
|
const response = await query.execute(variablesToWire(variables), port.definitionDigest);
|
||||||
|
if (response.pending.length || response.errors.length)
|
||||||
|
throw new Error("QUERY_INCOMPLETE");
|
||||||
|
return decodeQxValue(port.output, response.value, messages);
|
||||||
|
},
|
||||||
|
...(port.watch
|
||||||
|
? {
|
||||||
|
async *watch(variables, signal) {
|
||||||
|
for await (const event of query.watch(variablesToWire(variables), signal, port.definitionDigest)) {
|
||||||
|
if (!event.snapshot)
|
||||||
|
throw new Error("QUERY_SNAPSHOT_MISSING");
|
||||||
|
yield decodeQuerySnapshot(event.snapshot, port.output, event.runId, event.sequence);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "constructor":
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
construct: (input) => raw.constructor(port.id).construct(inputFields(port.inputType, input, messages)),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
return {
|
||||||
|
conform: {
|
||||||
|
async tryConform(object, contract) {
|
||||||
|
const target = await raw.tryConform(object, contract.interfaceRevisionId);
|
||||||
|
return target
|
||||||
|
? bindInterfaceView(target, contract, messages)
|
||||||
|
: undefined;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...(spec.receiver === "none" ? {} : { objectId: raw.objectId }),
|
||||||
|
signal: raw.signal,
|
||||||
|
...(spec.receiver !== "none" && raw.openSession
|
||||||
|
? {
|
||||||
|
openSession: async () => {
|
||||||
|
const session = await raw.openSession();
|
||||||
|
return {
|
||||||
|
id: session.id,
|
||||||
|
close: () => session.close(),
|
||||||
|
run: (work) => session.run((next) => work(bindContext(next))),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
input: decodeQxValue(spec.inputType, inputValue(raw, spec.inputType), messages),
|
||||||
|
ports,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const execute = async (raw) => {
|
||||||
|
const context = bindContext(raw);
|
||||||
|
const value = await (typeof handler === "function" ? handler(context) : handler.get(context));
|
||||||
|
return liveValue(encodeQxValue(spec.eventType ?? spec.outputType, value, messages));
|
||||||
|
};
|
||||||
|
return typeof handler === "function" ? execute : derived(execute);
|
||||||
|
};
|
||||||
Vendored
+897
-271
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+170
-75
File diff suppressed because one or more lines are too long
Vendored
+1120
-595
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+205
-154
File diff suppressed because one or more lines are too long
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=codegen-ts-runtime.d.ts.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"codegen-ts-runtime.d.ts","sourceRoot":"","sources":["../src/codegen-ts-runtime.ts"],"names":[],"mappings":""}
|
|
||||||
Vendored
-524
@@ -1,524 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
import fs from "node:fs";
|
|
||||||
import path from "node:path";
|
|
||||||
import protobuf from "protobufjs";
|
|
||||||
import { compileCaminoSchema, loadCaminoSchemaRoot, } from "./schema-compiler.js";
|
|
||||||
const usage = () => {
|
|
||||||
console.error("Usage: camino-codegen-ts-runtime [--react-only] <class-schema.camino.proto> <out-dir> [implementation-import]");
|
|
||||||
process.exit(1);
|
|
||||||
};
|
|
||||||
const required = (value) => value ?? usage();
|
|
||||||
const stringLiteral = (value) => JSON.stringify(value);
|
|
||||||
const upperFirst = (value) => value.length === 0 ? value : `${value[0]?.toUpperCase()}${value.slice(1)}`;
|
|
||||||
const lowerFirst = (value) => value.length === 0 ? value : `${value[0]?.toLowerCase()}${value.slice(1)}`;
|
|
||||||
const camel = (value) => value
|
|
||||||
.split(/[^a-zA-Z0-9]+/)
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((part, index) => index === 0 ? lowerFirst(part) : upperFirst(lowerFirst(part)))
|
|
||||||
.join("");
|
|
||||||
const isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value);
|
|
||||||
const classId = (schema) => `${schema.id.namespace}:${schema.id.name}:${schema.id.version}:${schema.id.hash ?? ""}`;
|
|
||||||
const symbolId = (value) => `${value.namespace}:${value.name}:${value.version}:${value.hash ?? ""}`;
|
|
||||||
const normalizedProtoType = (value) => value.replace(/^\./, "");
|
|
||||||
const declarationName = (value) => value.name;
|
|
||||||
const tsTypeForTypeRef = (type, root) => {
|
|
||||||
if (type.symbol) {
|
|
||||||
return `ObjectRef<${stringLiteral(symbolId(type.symbol))}>`;
|
|
||||||
}
|
|
||||||
if (type.enumValues && type.enumValues.length > 0) {
|
|
||||||
return type.enumValues.map(stringLiteral).join(" | ");
|
|
||||||
}
|
|
||||||
const protoType = normalizedProtoType(type.protoType);
|
|
||||||
switch (protoType) {
|
|
||||||
case "string":
|
|
||||||
case "google.protobuf.StringValue":
|
|
||||||
return "string";
|
|
||||||
case "bool":
|
|
||||||
case "google.protobuf.BoolValue":
|
|
||||||
return "boolean";
|
|
||||||
case "double":
|
|
||||||
case "float":
|
|
||||||
case "google.protobuf.DoubleValue":
|
|
||||||
case "google.protobuf.FloatValue":
|
|
||||||
case "int32":
|
|
||||||
case "sint32":
|
|
||||||
case "sfixed32":
|
|
||||||
case "uint32":
|
|
||||||
case "fixed32":
|
|
||||||
case "int64":
|
|
||||||
case "sint64":
|
|
||||||
case "sfixed64":
|
|
||||||
case "uint64":
|
|
||||||
case "fixed64":
|
|
||||||
case "google.protobuf.Int32Value":
|
|
||||||
case "google.protobuf.UInt32Value":
|
|
||||||
case "google.protobuf.Int64Value":
|
|
||||||
case "google.protobuf.UInt64Value":
|
|
||||||
return "number";
|
|
||||||
case "bytes":
|
|
||||||
case "google.protobuf.BytesValue":
|
|
||||||
return "Uint8Array";
|
|
||||||
default:
|
|
||||||
if (protoType === "google.protobuf.Empty") {
|
|
||||||
return "Record<string, never>";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const reflected = root?.lookup(protoType);
|
|
||||||
if (reflected instanceof protobuf.Type || reflected instanceof protobuf.Enum) {
|
|
||||||
return declarationName(reflected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// Unknown imported message types remain opaque at this codegen boundary.
|
|
||||||
}
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const tsTypeForField = (field, root) => tsTypeForTypeRef(field.type, root);
|
|
||||||
const tsValueTypeForField = (field, root) => field.repeated ? `${tsTypeForField(field, root)}[]` : tsTypeForField(field, root);
|
|
||||||
const tsFieldApiType = (field, root) => field.conflict === "crdt"
|
|
||||||
? `CrdtField<${tsValueTypeForField(field, root)}>`
|
|
||||||
: `Field<${tsValueTypeForField(field, root)}>`;
|
|
||||||
const functionExportName = (fn, fallback) => {
|
|
||||||
if (isIdentifier(fn.symbol)) {
|
|
||||||
return fn.symbol;
|
|
||||||
}
|
|
||||||
const fallbackName = camel(fallback);
|
|
||||||
if (isIdentifier(fallbackName)) {
|
|
||||||
return fallbackName;
|
|
||||||
}
|
|
||||||
throw new Error(`Cannot generate TS export name for function ${fn.symbol}`);
|
|
||||||
};
|
|
||||||
const generatedWarning = `// @generated by camino-codegen-ts-runtime. Do not edit.\n`;
|
|
||||||
const scalarTsType = (field, root) => {
|
|
||||||
const primitive = tsTypeForTypeRef({ protoType: field.type }, root);
|
|
||||||
if (primitive !== "unknown") {
|
|
||||||
return primitive;
|
|
||||||
}
|
|
||||||
const resolved = field.resolvedType;
|
|
||||||
if (resolved instanceof protobuf.Type || resolved instanceof protobuf.Enum) {
|
|
||||||
return declarationName(resolved);
|
|
||||||
}
|
|
||||||
return "unknown";
|
|
||||||
};
|
|
||||||
const collectProtoDeclarations = (root, types) => {
|
|
||||||
const declarations = new Map();
|
|
||||||
const visit = (value) => {
|
|
||||||
const key = value.fullName;
|
|
||||||
if (declarations.has(key)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
declarations.set(key, value);
|
|
||||||
if (value instanceof protobuf.Type) {
|
|
||||||
for (const field of value.fieldsArray) {
|
|
||||||
if (field.resolvedType instanceof protobuf.Type ||
|
|
||||||
field.resolvedType instanceof protobuf.Enum) {
|
|
||||||
visit(field.resolvedType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (const type of types) {
|
|
||||||
if (type.symbol || !type.protoType) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const reflected = root.lookup(normalizedProtoType(type.protoType));
|
|
||||||
if (reflected instanceof protobuf.Type || reflected instanceof protobuf.Enum) {
|
|
||||||
visit(reflected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// Opaque imported types are represented as unknown by the generated API.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [...declarations.values()]
|
|
||||||
.map((value) => {
|
|
||||||
if (value instanceof protobuf.Enum) {
|
|
||||||
return `export type ${declarationName(value)} = ${Object.keys(value.values)
|
|
||||||
.map(stringLiteral)
|
|
||||||
.join(" | ")};`;
|
|
||||||
}
|
|
||||||
const fields = value.fieldsArray.map((field) => {
|
|
||||||
const fieldType = scalarTsType(field, root);
|
|
||||||
const valueType = field.map
|
|
||||||
? `Record<string, ${fieldType}>`
|
|
||||||
: field.repeated
|
|
||||||
? `${fieldType}[]`
|
|
||||||
: fieldType;
|
|
||||||
return ` ${JSON.stringify(field.name)}${field.optional ? "?" : ""}: ${valueType};`;
|
|
||||||
});
|
|
||||||
return `export type ${declarationName(value)} = {\n${fields.join("\n")}\n};`;
|
|
||||||
})
|
|
||||||
.join("\n\n");
|
|
||||||
};
|
|
||||||
const fieldTypeId = (field) => field.type.symbol ? symbolId(field.type.symbol) : field.type.protoType;
|
|
||||||
const crdtStorageTypeId = (field) => field.type.protoType ||
|
|
||||||
(field.type.symbol
|
|
||||||
? `${field.type.symbol.namespace}.${field.type.symbol.name}`
|
|
||||||
: fieldTypeId(field));
|
|
||||||
const fieldStorageId = (field) => field.ops && field.storage.kind === "stored" ? "derived" : field.storage.kind;
|
|
||||||
const interfaceTypeName = (implementation) => `${implementation.interface.name}Ref`;
|
|
||||||
const renderInterfaceRefTypes = (schema) => schema.implements
|
|
||||||
.map((implementation) => {
|
|
||||||
const typeParams = implementation.typeBindings.map((binding) => binding.name);
|
|
||||||
const generic = typeParams.length > 0 ? `<${typeParams.join(", ")}>` : "";
|
|
||||||
const bindings = typeParams.length > 0
|
|
||||||
? typeParams
|
|
||||||
.map((param) => ` readonly ${param}: ${param};`)
|
|
||||||
.join("\n")
|
|
||||||
: " readonly value: unknown;";
|
|
||||||
return `export type ${interfaceTypeName(implementation)}${generic} = ObjectRef<string> & {
|
|
||||||
readonly $caminoInterfaces: {
|
|
||||||
readonly ${stringLiteral(symbolId(implementation.interface))}: {
|
|
||||||
${bindings}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};`;
|
|
||||||
})
|
|
||||||
.join("\n\n");
|
|
||||||
const interfaceMixins = (schema, root) => schema.implements.map((implementation) => {
|
|
||||||
const typeArgs = implementation.typeBindings.map((binding) => tsTypeForTypeRef(binding.type, root));
|
|
||||||
return `${interfaceTypeName(implementation)}${typeArgs.length > 0 ? `<${typeArgs.join(", ")}>` : ""}`;
|
|
||||||
});
|
|
||||||
const operationFunctionSpecs = (schema) => schema.fields.flatMap((field) => {
|
|
||||||
const serviceName = field.ops?.service.replace(/^\./, "");
|
|
||||||
if (!serviceName) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const service = schema.operationServices.find((candidate) => candidate.fullName === serviceName);
|
|
||||||
if (!service) {
|
|
||||||
throw new Error(`${schema.id.name}.${field.name} points to missing operation service ${field.ops?.service}`);
|
|
||||||
}
|
|
||||||
return service.operations.map((operation) => ({
|
|
||||||
exportName: functionExportName(operation.function, `${field.name}_${operation.name}`),
|
|
||||||
symbol: operation.function.symbol,
|
|
||||||
...(operation.function.operation
|
|
||||||
? { operation: operation.function.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: operation.function.packageNamespace,
|
|
||||||
packageName: operation.function.packageName,
|
|
||||||
field: {
|
|
||||||
name: field.name,
|
|
||||||
type: fieldTypeId(field),
|
|
||||||
storage: fieldStorageId(field),
|
|
||||||
conflict: field.conflict,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
const renderRuntime = (schema, root) => {
|
|
||||||
const className = schema.id.name;
|
|
||||||
const objectTypeName = `${className}Object`;
|
|
||||||
const refTypeName = `${className}Ref`;
|
|
||||||
const contextTypeName = `${className}Context`;
|
|
||||||
const implementationTypeName = `${className}Implementation`;
|
|
||||||
const serveName = `serve${className}Runtime`;
|
|
||||||
const createObjectName = `create${className}Object`;
|
|
||||||
const interfaceRefTypes = renderInterfaceRefTypes(schema);
|
|
||||||
const refType = [`ObjectRef<${stringLiteral(classId(schema))}>`, ...interfaceMixins(schema, root)]
|
|
||||||
.join(" & ");
|
|
||||||
const edgeFields = new Set(schema.edges.map((edge) => edge.sourceField));
|
|
||||||
const writableFields = schema.fields.filter((field) => field.storage.kind === "stored" &&
|
|
||||||
!field.ops &&
|
|
||||||
!edgeFields.has(field.name));
|
|
||||||
const functionSpecs = [
|
|
||||||
...(schema.constructorSpec
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
exportName: functionExportName(schema.constructorSpec.function, "constructor"),
|
|
||||||
symbol: schema.constructorSpec.function.symbol,
|
|
||||||
...(schema.constructorSpec.function.operation
|
|
||||||
? { operation: schema.constructorSpec.function.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: schema.constructorSpec.function.packageNamespace,
|
|
||||||
packageName: schema.constructorSpec.function.packageName,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
...schema.methods.map((method) => ({
|
|
||||||
exportName: functionExportName(method.function, method.name),
|
|
||||||
symbol: method.function.symbol,
|
|
||||||
...(method.function.operation ? { operation: method.function.operation } : {}),
|
|
||||||
packageNamespace: method.function.packageNamespace,
|
|
||||||
packageName: method.function.packageName,
|
|
||||||
})),
|
|
||||||
...schema.fields.flatMap((field) => field.storage.resolver
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
exportName: functionExportName(field.storage.resolver, field.name),
|
|
||||||
symbol: field.storage.resolver.symbol,
|
|
||||||
...(field.storage.resolver.operation
|
|
||||||
? { operation: field.storage.resolver.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: field.storage.resolver.packageNamespace,
|
|
||||||
packageName: field.storage.resolver.packageName,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
...operationFunctionSpecs(schema),
|
|
||||||
];
|
|
||||||
const firstFunction = functionSpecs[0];
|
|
||||||
if (!firstFunction) {
|
|
||||||
throw new Error(`${schema.id.name} has no runtime functions to generate`);
|
|
||||||
}
|
|
||||||
const mixedPackage = functionSpecs.find((spec) => spec.packageNamespace !== firstFunction.packageNamespace ||
|
|
||||||
spec.packageName !== firstFunction.packageName);
|
|
||||||
if (mixedPackage) {
|
|
||||||
throw new Error(`${schema.id.name} points to multiple packages; v0 TS runtime generation expects one package`);
|
|
||||||
}
|
|
||||||
return `${generatedWarning}import {
|
|
||||||
type CaminoClient,
|
|
||||||
createCrdtField,
|
|
||||||
createField,
|
|
||||||
type CrdtField,
|
|
||||||
type Field,
|
|
||||||
type FieldOperation,
|
|
||||||
type InvokeRequest,
|
|
||||||
objectRef,
|
|
||||||
type ObjectRef,
|
|
||||||
type RuntimeHandler,
|
|
||||||
serveQuixosPackageRuntime,
|
|
||||||
} from "@quixos/camino-package-runtime";
|
|
||||||
|
|
||||||
${collectProtoDeclarations(root, schema.implements.flatMap((entry) => entry.typeBindings.map((binding) => binding.type)))}
|
|
||||||
|
|
||||||
${interfaceRefTypes ? `${interfaceRefTypes}\n\n` : ""}export type ${refTypeName} = ${refType};
|
|
||||||
|
|
||||||
export type ${objectTypeName} = {
|
|
||||||
id: ${refTypeName};
|
|
||||||
${writableFields
|
|
||||||
.map((field) => ` ${camel(field.name)}: ${tsFieldApiType(field, root)};`)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ${contextTypeName} = {
|
|
||||||
object: ${objectTypeName};
|
|
||||||
camino: CaminoClient;
|
|
||||||
request: InvokeRequest;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ${implementationTypeName} = {
|
|
||||||
${functionSpecs
|
|
||||||
.map((spec) => spec.operation
|
|
||||||
? ` ${spec.exportName}: FieldOperation<${contextTypeName}>;`
|
|
||||||
: ` ${spec.exportName}: RuntimeHandler<${contextTypeName}>;`)
|
|
||||||
.filter((line, index, lines) => lines.indexOf(line) === index)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
|
|
||||||
const packageNamespace = ${stringLiteral(firstFunction.packageNamespace)};
|
|
||||||
const packageName = ${stringLiteral(firstFunction.packageName)};
|
|
||||||
const runtimeProtocolVersion = ${stringLiteral("camino-orch-v0")};
|
|
||||||
|
|
||||||
const functions = [
|
|
||||||
${functionSpecs
|
|
||||||
.map((spec) => ` { exportName: ${stringLiteral(spec.exportName)}, symbol: ${stringLiteral(spec.symbol)}${spec.operation ? `, operation: ${stringLiteral(spec.operation)}` : ""}${spec.field
|
|
||||||
? `, field: { name: ${stringLiteral(spec.field.name)}, type: ${stringLiteral(spec.field.type)}, storage: ${stringLiteral(spec.field.storage)}, conflict: ${stringLiteral(spec.field.conflict)} }`
|
|
||||||
: ""} },`)
|
|
||||||
.join("\n")}
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
export const ${createObjectName} = (
|
|
||||||
camino: CaminoClient,
|
|
||||||
objectId: string,
|
|
||||||
): ${objectTypeName} => {
|
|
||||||
const id = objectRef<${stringLiteral(classId(schema))}>(objectId) as ${refTypeName};
|
|
||||||
return {
|
|
||||||
id,
|
|
||||||
${writableFields
|
|
||||||
.map((fieldSchema) => fieldSchema.conflict === "crdt"
|
|
||||||
? ` ${camel(fieldSchema.name)}: createCrdtField(camino, id, ${stringLiteral(fieldSchema.name)}, ${stringLiteral(crdtStorageTypeId(fieldSchema))}),`
|
|
||||||
: ` ${camel(fieldSchema.name)}: createField(camino, id, ${stringLiteral(fieldSchema.name)}),`)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const create${className}Context = (
|
|
||||||
camino: CaminoClient,
|
|
||||||
request: InvokeRequest,
|
|
||||||
): ${contextTypeName} => ({
|
|
||||||
object: ${createObjectName}(camino, request.objectId),
|
|
||||||
camino,
|
|
||||||
request,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ${serveName} = (implementation: ${implementationTypeName}) => {
|
|
||||||
serveQuixosPackageRuntime({
|
|
||||||
packageNamespace,
|
|
||||||
packageName,
|
|
||||||
runtimeProtocolVersion,
|
|
||||||
functions,
|
|
||||||
implementation,
|
|
||||||
createContext: create${className}Context,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
const implementationNamed = (schema, name) => schema.implements.find((entry) => entry.interface.namespace === "quixos.react" &&
|
|
||||||
entry.interface.name === name);
|
|
||||||
const requiredBinding = (implementation, name) => {
|
|
||||||
const binding = implementation.typeBindings.find((entry) => entry.name === name);
|
|
||||||
if (!binding) {
|
|
||||||
throw new Error(`${implementation.interface.name} implementation is missing ${name}`);
|
|
||||||
}
|
|
||||||
return binding.type;
|
|
||||||
};
|
|
||||||
const renderReactClient = (schema, root) => {
|
|
||||||
const react = implementationNamed(schema, "ReactComponent");
|
|
||||||
const componentFor = implementationNamed(schema, "ReactComponentFor");
|
|
||||||
if (!react || !componentFor) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const renderProps = requiredBinding(react, "RenderProps");
|
|
||||||
const action = requiredBinding(react, "Action");
|
|
||||||
const object = requiredBinding(componentFor, "Object");
|
|
||||||
if (!object.symbol) {
|
|
||||||
throw new Error(`${schema.id.name}.ReactComponentFor.Object must bind a class symbol`);
|
|
||||||
}
|
|
||||||
const edge = schema.edges.find((candidate) => candidate.sourceField === "for_object");
|
|
||||||
if (!edge) {
|
|
||||||
throw new Error(`${schema.id.name} must declare its ReactComponentFor edge`);
|
|
||||||
}
|
|
||||||
const componentEndpoint = edge.fromEndpoint.projection === "for_object"
|
|
||||||
? edge.fromEndpoint
|
|
||||||
: edge.toEndpoint.projection === "for_object"
|
|
||||||
? edge.toEndpoint
|
|
||||||
: undefined;
|
|
||||||
const objectEndpoint = componentEndpoint === edge.fromEndpoint ? edge.toEndpoint : edge.fromEndpoint;
|
|
||||||
if (!componentEndpoint || !objectEndpoint.projection) {
|
|
||||||
throw new Error(`${schema.id.name}.for_object edge has no inverse projection`);
|
|
||||||
}
|
|
||||||
if (componentEndpoint.cardinality !== "exactly_one") {
|
|
||||||
throw new Error(`${schema.id.name}.for_object must have exactly_one cardinality`);
|
|
||||||
}
|
|
||||||
if (!objectEndpoint.materialization ||
|
|
||||||
symbolId(objectEndpoint.materialization.class) !== symbolId(schema.id)) {
|
|
||||||
throw new Error(`${schema.id.name}.${objectEndpoint.projection} must materialize ${classId(schema)}`);
|
|
||||||
}
|
|
||||||
const className = schema.id.name;
|
|
||||||
const componentName = className.endsWith("ReactComponent")
|
|
||||||
? `${className.slice(0, -"ReactComponent".length)}Component`
|
|
||||||
: className;
|
|
||||||
const propsTypeName = `${componentName}Props`;
|
|
||||||
const renderPropsType = tsTypeForTypeRef(renderProps, root);
|
|
||||||
const actionType = tsTypeForTypeRef(action, root);
|
|
||||||
const objectType = tsTypeForTypeRef(object, root);
|
|
||||||
const declarations = collectProtoDeclarations(root, [renderProps, action]);
|
|
||||||
return `${generatedWarning}import {
|
|
||||||
createReactComponentFor,
|
|
||||||
type ReactComponentHostProps,
|
|
||||||
type ObjectRef,
|
|
||||||
} from "@quixos/camino-react-runtime";
|
|
||||||
|
|
||||||
${declarations}
|
|
||||||
|
|
||||||
export type ${propsTypeName} = {
|
|
||||||
forObject: ${objectType};
|
|
||||||
} & ${renderPropsType} & ReactComponentHostProps<${actionType}>;
|
|
||||||
|
|
||||||
export const ${componentName} = createReactComponentFor<
|
|
||||||
${objectType},
|
|
||||||
${renderPropsType},
|
|
||||||
${actionType}
|
|
||||||
>({
|
|
||||||
componentClassId: ${stringLiteral(classId(schema))},
|
|
||||||
projection: ${stringLiteral(objectEndpoint.projection)},
|
|
||||||
});
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
const reactRuntimeDeclaration = `${generatedWarning}declare module "@quixos/camino-react-runtime" {
|
|
||||||
import type * as AutomergeNamespace from "@automerge/automerge";
|
|
||||||
|
|
||||||
export type ObjectRef<ClassId extends string> = string & {
|
|
||||||
readonly $caminoClass: ClassId;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type LiveFieldProp<T> = {
|
|
||||||
value: T;
|
|
||||||
source: {
|
|
||||||
objectId: string;
|
|
||||||
fieldName: string;
|
|
||||||
fieldType?: string;
|
|
||||||
fieldStorage?: string;
|
|
||||||
conflictStrategy?: string;
|
|
||||||
revision?: string | number | bigint;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ReactComponentHostProps<Action> = {
|
|
||||||
onAction?: (action: Action) => void;
|
|
||||||
fallback?: unknown;
|
|
||||||
className?: string;
|
|
||||||
style?: Record<string, string | number | undefined>;
|
|
||||||
onError?: (error: Error) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ReactComponentImplementationProps<CaminoProps, RenderProps, Action> = {
|
|
||||||
camino: CaminoProps;
|
|
||||||
render: RenderProps;
|
|
||||||
dispatch: (action: Action) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createReactComponentFor: <
|
|
||||||
ForObject extends ObjectRef<string>,
|
|
||||||
RenderProps extends object,
|
|
||||||
Action,
|
|
||||||
>(config: {
|
|
||||||
componentClassId: string;
|
|
||||||
projection: string;
|
|
||||||
}) => (props: {
|
|
||||||
forObject: ForObject;
|
|
||||||
} & RenderProps & ReactComponentHostProps<Action>) => any;
|
|
||||||
|
|
||||||
export const callObjectMethod: <Result = unknown>(
|
|
||||||
object: ObjectRef<string>,
|
|
||||||
methodName: string,
|
|
||||||
input?: Record<string, unknown>,
|
|
||||||
) => Promise<Result>;
|
|
||||||
|
|
||||||
export const h: (...args: any[]) => any;
|
|
||||||
export const useLiveField: <T>(
|
|
||||||
field: LiveFieldProp<T>,
|
|
||||||
) => [T, (value: T) => void | Promise<void>];
|
|
||||||
export const Automerge: typeof AutomergeNamespace;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
const renderServer = (schema, implementationImport) => {
|
|
||||||
const className = schema.id.name;
|
|
||||||
return `${generatedWarning}import * as implementation from ${stringLiteral(implementationImport)};
|
|
||||||
import { serve${className}Runtime } from "./${schema.id.namespace}.${className}.runtime.js";
|
|
||||||
|
|
||||||
serve${className}Runtime(implementation);
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
const main = async () => {
|
|
||||||
const reactOnly = process.argv[2] === "--react-only";
|
|
||||||
const offset = reactOnly ? 1 : 0;
|
|
||||||
const sourceFile = required(process.argv[2 + offset]);
|
|
||||||
const outDir = required(process.argv[3 + offset]);
|
|
||||||
const implementationImport = process.argv[4 + offset] ?? "../task.impl.js";
|
|
||||||
const compiled = await compileCaminoSchema(sourceFile);
|
|
||||||
const { root } = await loadCaminoSchemaRoot(sourceFile);
|
|
||||||
if (compiled.classes.length !== 1) {
|
|
||||||
throw new Error(`Expected exactly one Camino class in ${sourceFile}, found ${compiled.classes.length}`);
|
|
||||||
}
|
|
||||||
const schema = compiled.classes[0];
|
|
||||||
if (!schema) {
|
|
||||||
throw new Error(`No Camino class found in ${sourceFile}`);
|
|
||||||
}
|
|
||||||
fs.mkdirSync(outDir, { recursive: true });
|
|
||||||
const baseName = `${schema.id.namespace}.${schema.id.name}`;
|
|
||||||
const reactClient = renderReactClient(schema, root);
|
|
||||||
if (!reactOnly) {
|
|
||||||
fs.writeFileSync(path.join(outDir, `${baseName}.runtime.ts`), renderRuntime(schema, root));
|
|
||||||
fs.writeFileSync(path.join(outDir, `${baseName}.server.ts`), renderServer(schema, implementationImport));
|
|
||||||
}
|
|
||||||
if (reactClient) {
|
|
||||||
fs.writeFileSync(path.join(outDir, `${baseName}.react.ts`), reactClient);
|
|
||||||
fs.writeFileSync(path.join(outDir, "camino-react-runtime.d.ts"), reactRuntimeDeclaration);
|
|
||||||
}
|
|
||||||
else if (reactOnly) {
|
|
||||||
throw new Error(`${schema.id.name} does not implement ReactComponentFor`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
await main();
|
|
||||||
Vendored
+106
-98
@@ -1,110 +1,118 @@
|
|||||||
import { type Client } from "@connectrpc/connect";
|
import http from "node:http";
|
||||||
import { type CaminoAutomergeDoc } from "@quixos/camino-datatypes/crdt-automerge";
|
import { type QxObjectRef } from "./references.js";
|
||||||
import { CaminoService, type Value } from "./camino/api_pb.js";
|
export * from "./bindings.js";
|
||||||
import { type InvokeRequest } from "./quixos/runtime_pb.js";
|
export * from "./queries.js";
|
||||||
declare const objectRefBrand: unique symbol;
|
export { relationshipMap, relationshipList, relationshipSet } from "./relationships.js";
|
||||||
export type ObjectRef<ClassId extends string> = string & {
|
export { createMigrationContext, migrationObjectId, serveMigration, type MigrationContext, type MigrationInput, type MigrationOutput, type MigrationEdge, } from "./migration.js";
|
||||||
readonly [objectRefBrand]: ClassId;
|
import { type Client, type ConnectRouter } from "@connectrpc/connect";
|
||||||
};
|
import { CaminoService, type Value, type QueryResponse } from "./camino/api_pb.js";
|
||||||
|
import { OrchestratorRuntime } from "./quixos/orch_pb.js";
|
||||||
export type CaminoClient = Client<typeof CaminoService>;
|
export type CaminoClient = Client<typeof CaminoService>;
|
||||||
export type { InvokeRequest, Value };
|
export type OrchClient = Client<typeof OrchestratorRuntime>;
|
||||||
export type DerivedDependency = {
|
export type RuntimeDependency = {
|
||||||
kind: "object";
|
kind: "state";
|
||||||
objectId: string;
|
objectId: string;
|
||||||
|
attachmentId: string;
|
||||||
} | {
|
} | {
|
||||||
kind: "field";
|
kind: "edge";
|
||||||
objectId: string;
|
objectId: string;
|
||||||
fieldName: string;
|
attachmentId: string;
|
||||||
} | {
|
projectionId: string;
|
||||||
kind: "edges";
|
|
||||||
objectId: string;
|
|
||||||
sourceField?: string;
|
|
||||||
};
|
};
|
||||||
export declare const recordDerivedDependency: (dependency: DerivedDependency) => void;
|
export declare const objectRef: (reference: QxObjectRef) => QxObjectRef<string>;
|
||||||
export declare const getActiveDerivedDependencies: () => DerivedDependency[];
|
export declare const liveValue: (value: Value) => {
|
||||||
export declare const runWithDerivedDependencyTracking: <T>(fn: () => Promise<T> | T) => Promise<{
|
$quixosValue: Value;
|
||||||
value: T;
|
};
|
||||||
dependencies: DerivedDependency[];
|
export declare const jsToProtoValue: (value: unknown) => Value;
|
||||||
}>;
|
export declare const protoValueToJs: (value: Value | undefined) => unknown;
|
||||||
export type Field<T> = {
|
export declare const protoFieldsToJs: (fields: Record<string, Value>) => {
|
||||||
get(): Promise<T | undefined>;
|
[k: string]: unknown;
|
||||||
|
};
|
||||||
|
export type StatePort<T = unknown> = {
|
||||||
|
slotId: string;
|
||||||
|
get(): Promise<T>;
|
||||||
|
live(): Promise<ReturnType<typeof liveValue>>;
|
||||||
set(value: T): Promise<void>;
|
set(value: T): Promise<void>;
|
||||||
};
|
};
|
||||||
export type CrdtField<T> = Field<CaminoAutomergeDoc<T>> & {
|
export type EdgePort = {
|
||||||
change(fn: (doc: {
|
edgeTypeId: string;
|
||||||
value: T;
|
projectionId: string;
|
||||||
}) => void): Promise<CaminoAutomergeDoc<T>>;
|
resolve(): Promise<QxObjectRef[]>;
|
||||||
replaceFromJson(value: T): Promise<void>;
|
connect(target: QxObjectRef): Promise<void>;
|
||||||
|
disconnect(target: QxObjectRef): Promise<void>;
|
||||||
|
collection(): Promise<RelationshipCollection>;
|
||||||
|
replace(entries: RelationshipEntry[], expectedRevision: bigint): Promise<RelationshipCollection>;
|
||||||
};
|
};
|
||||||
export type LiveFieldValue<T> = {
|
export type RelationshipEntry<T extends QxObjectRef = QxObjectRef> = {
|
||||||
$caminoValue: T;
|
edgeId?: string;
|
||||||
$caminoSource: {
|
target: T;
|
||||||
field: {
|
key?: string | boolean | bigint;
|
||||||
objectId: string;
|
|
||||||
fieldName: string;
|
|
||||||
fieldType?: string;
|
|
||||||
fieldStorage?: string;
|
|
||||||
conflictStrategy?: string;
|
|
||||||
revision?: number | string | bigint;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
export declare const liveFieldValue: <T>(params: {
|
export type RelationshipCollection<T extends QxObjectRef = QxObjectRef> = {
|
||||||
value: T;
|
revision: bigint;
|
||||||
|
entries: RelationshipEntry<T>[];
|
||||||
|
};
|
||||||
|
export type InterfacePort = {
|
||||||
|
objectId: QxObjectRef;
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
invoke(operationId: string, input?: Record<string, unknown>): Promise<unknown>;
|
||||||
|
live(operationId: string, input?: Record<string, unknown>): Promise<ReturnType<typeof liveValue>>;
|
||||||
|
};
|
||||||
|
export type ConstructorPort = {
|
||||||
|
atomId: string;
|
||||||
|
construct(input?: Record<string, unknown>): Promise<QxObjectRef>;
|
||||||
|
};
|
||||||
|
export type QueryPort = {
|
||||||
|
queryId: string;
|
||||||
|
execute(variables: Record<string, Value>, expectedDefinitionDigest?: string): Promise<QueryResponse>;
|
||||||
|
watch(variables: Record<string, Value>, signal: AbortSignal, expectedDefinitionDigest?: string): AsyncIterable<import("./quixos/orch_pb.js").QueryEvent>;
|
||||||
|
};
|
||||||
|
export type RuntimePort = StatePort | EdgePort | InterfacePort | ConstructorPort | QueryPort;
|
||||||
|
export type RuntimeContext = {
|
||||||
|
tryConform(object: QxObjectRef, interfaceRevisionId: string): Promise<InterfacePort | undefined>;
|
||||||
|
/** Cooperative cancellation. Completion is acknowledged only after the handler returns. */
|
||||||
|
signal?: AbortSignal;
|
||||||
|
openSession?: () => Promise<RuntimeSession>;
|
||||||
|
objectId: QxObjectRef;
|
||||||
|
input: Record<string, unknown>;
|
||||||
|
inputProto: Record<string, Value>;
|
||||||
|
ports: ReadonlyMap<string, RuntimePort>;
|
||||||
|
state<T = unknown>(portId: string): StatePort<T>;
|
||||||
|
edge(portId: string): EdgePort;
|
||||||
|
interface(portId: string): InterfacePort;
|
||||||
|
constructor(portId: string): ConstructorPort;
|
||||||
|
query(portId: string): QueryPort;
|
||||||
|
};
|
||||||
|
export type RuntimeSession = {
|
||||||
|
id: string;
|
||||||
|
run<T>(work: (context: RuntimeContext) => Promise<T>): Promise<T>;
|
||||||
|
/** Close the external resource first, then close its host retention/session. */
|
||||||
|
close(): Promise<void>;
|
||||||
|
};
|
||||||
|
export declare class RuntimeAuthorityError extends Error {
|
||||||
|
readonly retryable: boolean;
|
||||||
|
constructor(message: string);
|
||||||
|
}
|
||||||
|
export declare const createRuntimeContext: (camino: CaminoClient, orch: OrchClient, request: RuntimeRequest) => RuntimeContext;
|
||||||
|
export type RuntimeHandler = (context: RuntimeContext) => unknown | Promise<unknown>;
|
||||||
|
export type DerivedHandler = {
|
||||||
|
kind: "derived";
|
||||||
|
get: RuntimeHandler;
|
||||||
|
};
|
||||||
|
export declare const derived: (get: RuntimeHandler) => DerivedHandler;
|
||||||
|
export declare const createPackageRuntimeRoutes: (config: {
|
||||||
|
packageRevisionId: string;
|
||||||
|
exports: Record<string, RuntimeHandler | DerivedHandler>;
|
||||||
|
caminoUrl?: string;
|
||||||
|
orchUrl?: string;
|
||||||
|
}) => (router: ConnectRouter) => ConnectRouter;
|
||||||
|
export declare const servePackageRuntime: (config: {
|
||||||
|
packageRevisionId: string;
|
||||||
|
exports: Record<string, RuntimeHandler | DerivedHandler>;
|
||||||
|
}) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
||||||
|
type RuntimeRequest = {
|
||||||
objectId: string;
|
objectId: string;
|
||||||
fieldName: string;
|
input: Record<string, Value>;
|
||||||
fieldType?: string;
|
dependencies: import("./quixos/refs_pb.js").InjectedDependency[];
|
||||||
fieldStorage?: string;
|
|
||||||
conflictStrategy?: string;
|
|
||||||
revision?: number | string | bigint;
|
|
||||||
}) => LiveFieldValue<T>;
|
|
||||||
export type RuntimeHandler<Context> = (context: Context) => Promise<unknown> | unknown;
|
|
||||||
export type FieldOperation<Context> = {
|
|
||||||
get?: RuntimeHandler<Context>;
|
|
||||||
set?: RuntimeHandler<Context>;
|
|
||||||
watchStart?: RuntimeHandler<Context>;
|
|
||||||
watchStop?: RuntimeHandler<Context>;
|
|
||||||
};
|
};
|
||||||
export declare const fieldOps: <Context>(operation: FieldOperation<Context>) => FieldOperation<Context>;
|
|
||||||
export declare const derivedWithDeps: <Context>(operation: {
|
|
||||||
get: RuntimeHandler<Context>;
|
|
||||||
}) => FieldOperation<Context>;
|
|
||||||
export type RuntimeFunctionSpec<ExportName extends string = string> = {
|
|
||||||
exportName: ExportName;
|
|
||||||
symbol: string;
|
|
||||||
operation?: string;
|
|
||||||
field?: {
|
|
||||||
name: string;
|
|
||||||
type?: string;
|
|
||||||
storage?: string;
|
|
||||||
conflict?: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
type FieldCodec = {
|
|
||||||
fieldType?: string;
|
|
||||||
conflictStrategy?: string;
|
|
||||||
};
|
|
||||||
export declare const jsToProtoValue: (value: unknown, codec?: FieldCodec) => Value;
|
|
||||||
export declare const protoValueToJs: (value: Value | undefined) => unknown;
|
|
||||||
export declare const jsObjectToProtoFields: (value: Record<string, unknown>) => {
|
|
||||||
[k: string]: Value;
|
|
||||||
};
|
|
||||||
export declare const protoFieldsToJs: (fields: Record<string, Value> | undefined) => Record<string, unknown>;
|
|
||||||
export declare const canonicalFieldParams: (params: Record<string, Value> | undefined) => string;
|
|
||||||
export declare const fieldOperationKey: (params: {
|
|
||||||
objectId: string;
|
|
||||||
fieldName: string;
|
|
||||||
input?: Record<string, Value>;
|
|
||||||
}) => string;
|
|
||||||
export declare const objectRef: <ClassId extends string>(objectId: string) => ObjectRef<ClassId>;
|
|
||||||
export declare const createField: <T>(camino: CaminoClient, objectId: string, fieldName: string, codec?: FieldCodec) => Field<T>;
|
|
||||||
export declare const createCrdtField: <T>(camino: CaminoClient, objectId: string, fieldName: string, fieldType: string) => CrdtField<T>;
|
|
||||||
export declare const serveQuixosPackageRuntime: <Context, Spec extends readonly RuntimeFunctionSpec[]>(params: {
|
|
||||||
packageNamespace: string;
|
|
||||||
packageName: string;
|
|
||||||
runtimeProtocolVersion: string;
|
|
||||||
functions: Spec;
|
|
||||||
implementation: { [Name in Spec[number]["exportName"]]: RuntimeHandler<Context> | FieldOperation<Context>; };
|
|
||||||
createContext: (camino: CaminoClient, request: InvokeRequest) => Context;
|
|
||||||
}) => void;
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,MAAM,EAGZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EACL,aAAa,EASb,KAAK,KAAK,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAOL,KAAK,aAAa,EAGnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAE5C,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,MAAM,IAAI,MAAM,GAAG;IACvD,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAExD,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAErC,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EA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AaA,CAAC;AACF,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7B,YAAY,EAAE,OAAO,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;CAClE,CAAC"}
|
||||||
Vendored
+601
-675
File diff suppressed because it is too large
Load Diff
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/** Execution completion, not HTTP disconnection, is the drain boundary. */
|
||||||
|
export declare const createInvocationRegistry: () => {
|
||||||
|
begin(id: string): {
|
||||||
|
signal: AbortSignal;
|
||||||
|
finish(failed?: boolean): void;
|
||||||
|
};
|
||||||
|
status(id: string): {
|
||||||
|
invocationId: string;
|
||||||
|
state: string;
|
||||||
|
};
|
||||||
|
cancel(id: string): {
|
||||||
|
invocationId: string;
|
||||||
|
state: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=invocations.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"invocations.d.ts","sourceRoot":"","sources":["../src/invocations.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB;IAGjC,KAAK,KAAK,MAAM;QASZ,MAAM;QACN,MAAM;;IAKV,MAAM,KAAK,MAAM;QACN,YAAY;QAAM,KAAK;;IAElC,MAAM,KAAK,MAAM;;;;CASpB,CAAC"}
|
||||||
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
/** Execution completion, not HTTP disconnection, is the drain boundary. */
|
||||||
|
export const createInvocationRegistry = () => {
|
||||||
|
const entries = new Map();
|
||||||
|
return {
|
||||||
|
begin(id) {
|
||||||
|
if (!id || entries.has(id))
|
||||||
|
throw new Error("Invocation ID is missing or already used; invocations are never replayed implicitly");
|
||||||
|
// Completed identities remain until process retirement. A bounded process
|
||||||
|
// may reject new work; it must not evict and accidentally replay a call.
|
||||||
|
if (entries.size >= 100_000)
|
||||||
|
throw new Error("Invocation registry full; explicit runtime retirement required");
|
||||||
|
const entry = { state: "running", controller: new AbortController() };
|
||||||
|
entries.set(id, entry);
|
||||||
|
return {
|
||||||
|
signal: entry.controller.signal,
|
||||||
|
finish(failed = false) {
|
||||||
|
entry.state = failed ? "failed" : "completed";
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
status(id) {
|
||||||
|
return { invocationId: id, state: entries.get(id)?.state ?? "unknown" };
|
||||||
|
},
|
||||||
|
cancel(id) {
|
||||||
|
const entry = entries.get(id);
|
||||||
|
if (entry && ["running", "cancellation-requested"].includes(entry.state)) {
|
||||||
|
entry.state = "cancellation-requested";
|
||||||
|
entry.controller.abort();
|
||||||
|
}
|
||||||
|
return this.status(id);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
Vendored
+72
@@ -0,0 +1,72 @@
|
|||||||
|
export type MigrationInput = {
|
||||||
|
schemaVersion: 1;
|
||||||
|
executionId: string;
|
||||||
|
exportId: string;
|
||||||
|
ports: {
|
||||||
|
name: string;
|
||||||
|
binding: string;
|
||||||
|
view: "old" | "new";
|
||||||
|
access: ("read" | "write" | "create" | "edge")[];
|
||||||
|
atomId?: string;
|
||||||
|
attachedAtomId?: string;
|
||||||
|
defaultValue?: unknown;
|
||||||
|
states?: {
|
||||||
|
objectId: string;
|
||||||
|
value: unknown;
|
||||||
|
}[];
|
||||||
|
edges?: MigrationEdge[];
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
export type MigrationEdge = {
|
||||||
|
id: string;
|
||||||
|
edgeTypeId: string;
|
||||||
|
firstObjectId: string;
|
||||||
|
secondObjectId: string;
|
||||||
|
firstProjectionId: string;
|
||||||
|
secondProjectionId: string;
|
||||||
|
firstOrdinal?: number;
|
||||||
|
secondOrdinal?: number;
|
||||||
|
firstKeyJson?: string;
|
||||||
|
secondKeyJson?: string;
|
||||||
|
};
|
||||||
|
export type MigrationOutput = {
|
||||||
|
schemaVersion: 1;
|
||||||
|
executionId: string;
|
||||||
|
writes: {
|
||||||
|
port: string;
|
||||||
|
objectId: string;
|
||||||
|
value: unknown;
|
||||||
|
}[];
|
||||||
|
creates: {
|
||||||
|
port: string;
|
||||||
|
logicalKey: string;
|
||||||
|
objectId: string;
|
||||||
|
}[];
|
||||||
|
edgeReplacements: {
|
||||||
|
port: string;
|
||||||
|
edges: MigrationEdge[];
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
export type MigrationContext = {
|
||||||
|
enumerate(port: string): {
|
||||||
|
objectId: string;
|
||||||
|
value: unknown;
|
||||||
|
}[];
|
||||||
|
read(port: string, objectId: string): unknown;
|
||||||
|
write(port: string, objectId: string, value: unknown): void;
|
||||||
|
create(port: string, logicalKey: string): string;
|
||||||
|
edges(port: string): MigrationEdge[];
|
||||||
|
replaceEdges(port: string, edges: MigrationEdge[]): void;
|
||||||
|
};
|
||||||
|
export declare const migrationObjectId: (executionId: string, port: string, logicalKey: string) => string;
|
||||||
|
/** No ordinary RuntimeContext or network/database clients are supplied here.
|
||||||
|
* Process isolation belongs to the host, not this convenience API. */
|
||||||
|
export declare const createMigrationContext: (input: MigrationInput) => {
|
||||||
|
context: MigrationContext;
|
||||||
|
result: () => MigrationOutput;
|
||||||
|
};
|
||||||
|
/** Entrypoint for an immutable package's dedicated bin/migrate executable.
|
||||||
|
* stdout is protocol-only; send diagnostics to stderr. The host independently
|
||||||
|
* validates every write, helper identity, contract, and completion receipt. */
|
||||||
|
export declare const serveMigration: (exports: Record<string, (context: MigrationContext) => void | Promise<void>>) => Promise<void>;
|
||||||
|
//# sourceMappingURL=migration.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,CAAC,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAA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E,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,EAAE,CAAC;CAC9D,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAChE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5D,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACjD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAAC;IACrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;CAC1D,CAAC;AACF,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,QAAQ,MAAM,cAAc,MAAM,WAGnE,CAAC;AAErB;sEACsE;AACtE,eAAO,MAAM,sBAAsB,UAAW,cAAc;;;CAgF3D,CAAC;AAEF;;+EAE+E;AAC/E,eAAO,MAAM,cAAc,YAAmB,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,kBAgBhH,CAAC"}
|
||||||
Vendored
+108
@@ -0,0 +1,108 @@
|
|||||||
|
import { createHash } from "node:crypto";
|
||||||
|
export const migrationObjectId = (executionId, port, logicalKey) => `obj:migration:${createHash("sha256")
|
||||||
|
.update(JSON.stringify([executionId, port, logicalKey]))
|
||||||
|
.digest("hex")}`;
|
||||||
|
/** No ordinary RuntimeContext or network/database clients are supplied here.
|
||||||
|
* Process isolation belongs to the host, not this convenience API. */
|
||||||
|
export const createMigrationContext = (input) => {
|
||||||
|
if (input.schemaVersion !== 1 ||
|
||||||
|
!input.executionId ||
|
||||||
|
new Set(input.ports.map((entry) => entry.name)).size !== input.ports.length)
|
||||||
|
throw new Error("Invalid migration input");
|
||||||
|
const output = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
executionId: input.executionId,
|
||||||
|
writes: [],
|
||||||
|
creates: [],
|
||||||
|
edgeReplacements: [],
|
||||||
|
};
|
||||||
|
const port = (name, access) => {
|
||||||
|
const selected = input.ports.find((entry) => entry.name === name);
|
||||||
|
if (!selected?.access.includes(access) || (selected.view === "old" && access !== "read"))
|
||||||
|
throw new Error(`Migration port ${name} does not grant ${access}`);
|
||||||
|
return selected;
|
||||||
|
};
|
||||||
|
const context = {
|
||||||
|
enumerate(name) {
|
||||||
|
const selected = port(name, "read"), states = structuredClone(selected.states ?? []);
|
||||||
|
if (selected.view === "new" && Object.hasOwn(selected, "defaultValue"))
|
||||||
|
for (const helper of output.creates) {
|
||||||
|
if (input.ports.find((entry) => entry.name === helper.port)?.atomId === selected.attachedAtomId &&
|
||||||
|
!states.some((entry) => entry.objectId === helper.objectId))
|
||||||
|
states.push({ objectId: helper.objectId, value: structuredClone(selected.defaultValue) });
|
||||||
|
}
|
||||||
|
if (selected.view === "new")
|
||||||
|
for (const write of output.writes) {
|
||||||
|
if (input.ports.find((entry) => entry.name === write.port)?.binding !== selected.binding)
|
||||||
|
continue;
|
||||||
|
const existing = states.findIndex((entry) => entry.objectId === write.objectId), entry = { objectId: write.objectId, value: structuredClone(write.value) };
|
||||||
|
if (existing < 0)
|
||||||
|
states.push(entry);
|
||||||
|
else
|
||||||
|
states[existing] = entry;
|
||||||
|
}
|
||||||
|
return states.sort((a, b) => (a.objectId < b.objectId ? -1 : a.objectId > b.objectId ? 1 : 0));
|
||||||
|
},
|
||||||
|
read(name, objectId) {
|
||||||
|
return context.enumerate(name).find((entry) => entry.objectId === objectId)?.value;
|
||||||
|
},
|
||||||
|
write(name, objectId, value) {
|
||||||
|
port(name, "write");
|
||||||
|
const previous = output.writes.findIndex((entry) => entry.port === name && entry.objectId === objectId);
|
||||||
|
const entry = { port: name, objectId, value: structuredClone(value) };
|
||||||
|
if (previous < 0)
|
||||||
|
output.writes.push(entry);
|
||||||
|
else
|
||||||
|
output.writes[previous] = entry;
|
||||||
|
},
|
||||||
|
create(name, logicalKey) {
|
||||||
|
port(name, "create");
|
||||||
|
if (!logicalKey || logicalKey.length > 1024)
|
||||||
|
throw new Error("Migration creation requires a bounded stable logical key");
|
||||||
|
const objectId = migrationObjectId(input.executionId, name, logicalKey);
|
||||||
|
if (!output.creates.some((entry) => entry.objectId === objectId))
|
||||||
|
output.creates.push({ port: name, logicalKey, objectId });
|
||||||
|
return objectId;
|
||||||
|
},
|
||||||
|
edges(name) {
|
||||||
|
const selected = port(name, "read");
|
||||||
|
const replacement = selected.view === "new"
|
||||||
|
? output.edgeReplacements.find((entry) => input.ports.find((candidate) => candidate.name === entry.port)?.binding === selected.binding)
|
||||||
|
: undefined;
|
||||||
|
return structuredClone(replacement?.edges ?? selected.edges ?? []);
|
||||||
|
},
|
||||||
|
replaceEdges(name, edges) {
|
||||||
|
port(name, "edge");
|
||||||
|
const previous = output.edgeReplacements.findIndex((entry) => entry.port === name);
|
||||||
|
const entry = { port: name, edges: structuredClone(edges) };
|
||||||
|
if (previous < 0)
|
||||||
|
output.edgeReplacements.push(entry);
|
||||||
|
else
|
||||||
|
output.edgeReplacements[previous] = entry;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return { context, result: () => structuredClone(output) };
|
||||||
|
};
|
||||||
|
/** Entrypoint for an immutable package's dedicated bin/migrate executable.
|
||||||
|
* stdout is protocol-only; send diagnostics to stderr. The host independently
|
||||||
|
* validates every write, helper identity, contract, and completion receipt. */
|
||||||
|
export const serveMigration = async (exports) => {
|
||||||
|
const chunks = [];
|
||||||
|
let bytes = 0;
|
||||||
|
for await (const chunk of process.stdin) {
|
||||||
|
bytes += chunk.length;
|
||||||
|
if (bytes > 16 * 1024 * 1024)
|
||||||
|
throw new Error("Migration input exceeds 16 MiB");
|
||||||
|
chunks.push(Buffer.from(chunk));
|
||||||
|
}
|
||||||
|
const input = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
||||||
|
const implementation = Object.hasOwn(exports, input.exportId) ? exports[input.exportId] : undefined;
|
||||||
|
if (!implementation)
|
||||||
|
throw new Error("Unknown migration export");
|
||||||
|
const execution = createMigrationContext(input);
|
||||||
|
await implementation(execution.context);
|
||||||
|
const result = JSON.stringify(execution.result());
|
||||||
|
if (Buffer.byteLength(result) > 16 * 1024 * 1024)
|
||||||
|
throw new Error("Migration output exceeds 16 MiB");
|
||||||
|
process.stdout.write(`${result}\n`);
|
||||||
|
};
|
||||||
Vendored
+38
@@ -0,0 +1,38 @@
|
|||||||
|
import { type QxValueType } from "./bindings.js";
|
||||||
|
import type { QueryResponse } from "./camino/api_pb.js";
|
||||||
|
import type { QxObjectRef } from "./references.js";
|
||||||
|
export type QxQueryPartial<T> = T extends QxObjectRef ? T : T extends readonly (infer Item)[] ? QxQueryPartial<Item>[] : T extends object ? {
|
||||||
|
[Key in keyof T]?: QxQueryPartial<T[Key]>;
|
||||||
|
} : T;
|
||||||
|
export type QxQuerySnapshot<T> = {
|
||||||
|
runId: string;
|
||||||
|
sequence: bigint;
|
||||||
|
dataVersion: string;
|
||||||
|
bindingDigest: string;
|
||||||
|
consistency: string;
|
||||||
|
fields: {
|
||||||
|
path: readonly (string | number)[];
|
||||||
|
status: "pending" | "error";
|
||||||
|
error?: string;
|
||||||
|
}[];
|
||||||
|
} & ({
|
||||||
|
status: "ready";
|
||||||
|
data: T;
|
||||||
|
} | {
|
||||||
|
status: "partial";
|
||||||
|
data: QxQueryPartial<T>;
|
||||||
|
});
|
||||||
|
declare const queryTypes: unique symbol;
|
||||||
|
/** Generated shape evidence, not permission to run a query. */
|
||||||
|
export interface QxQueryDescriptor<Variables, Result, Root extends string = string> {
|
||||||
|
readonly id: string;
|
||||||
|
readonly definitionDigest: string;
|
||||||
|
readonly rootInterfaceRevisionId: Root;
|
||||||
|
readonly variables: QxValueType;
|
||||||
|
readonly output: QxValueType;
|
||||||
|
readonly watch: boolean;
|
||||||
|
readonly [queryTypes]?: (variables: Variables, result: Result) => [Variables, Result];
|
||||||
|
}
|
||||||
|
export declare function decodeQuerySnapshot<T>(response: QueryResponse, output: QxValueType, runId: string, sequence: bigint): QxQuerySnapshot<T>;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=queries.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,WAAW,GACjD,CAAC,GACD,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GAC/B,cAAc,CAAC,IAAI,CAAC,EAAE,GACtB,CAAC,SAAS,MAAM,GACd;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GAC7C,CAAC,CAAC;AACV,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;QAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/F,GAAG,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAC;AACpF,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AACxC,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;IAChF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,uBAAuB,EAAE,IAAI,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACvF;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,eAAe,CAAC,CAAC,CAAC,CA6CpB"}
|
||||||
Vendored
+57
@@ -0,0 +1,57 @@
|
|||||||
|
import { decodeQxValue } from "./bindings.js";
|
||||||
|
export function decodeQuerySnapshot(response, output, runId, sequence) {
|
||||||
|
if (response.preparationToken || response.residualWindows.length || response.relationalCaptures.length)
|
||||||
|
throw new Error("QUERY_RESULT_UNFINISHED: private preparation is not a query result");
|
||||||
|
const fields = [
|
||||||
|
...response.pending.map((field) => ({ path: field.path, status: "pending" })),
|
||||||
|
...response.errors.map((field) => ({ path: field.path, status: "error", error: field.error })),
|
||||||
|
].map((field) => ({
|
||||||
|
...field,
|
||||||
|
path: field.path.map((part) => {
|
||||||
|
if (part.part.case !== "field" && part.part.case !== "index")
|
||||||
|
throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
return part.part.value;
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
// Pending/error values are absent, not successful nulls of a scalar type.
|
||||||
|
const shape = structuredClone(output);
|
||||||
|
for (const field of fields) {
|
||||||
|
let cursor = shape;
|
||||||
|
for (const [index, part] of field.path.entries()) {
|
||||||
|
while (cursor.kind === "optional")
|
||||||
|
cursor = cursor.value;
|
||||||
|
const last = index === field.path.length - 1;
|
||||||
|
if (typeof part === "string" && cursor.kind === "record" && cursor.fields[part]) {
|
||||||
|
if (last)
|
||||||
|
cursor.fields[part] = { kind: "optional", value: cursor.fields[part] };
|
||||||
|
else
|
||||||
|
cursor = cursor.fields[part];
|
||||||
|
}
|
||||||
|
else if (typeof part === "number" && cursor.kind === "list")
|
||||||
|
cursor = cursor.value;
|
||||||
|
else
|
||||||
|
throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const data = decodeQxValue(shape, response.value, {});
|
||||||
|
for (const field of fields) {
|
||||||
|
let cursor = data;
|
||||||
|
for (const [index, part] of field.path.entries()) {
|
||||||
|
if (!cursor || typeof cursor !== "object")
|
||||||
|
throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
if (index === field.path.length - 1)
|
||||||
|
delete cursor[part];
|
||||||
|
else
|
||||||
|
cursor = cursor[part];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
runId,
|
||||||
|
sequence,
|
||||||
|
dataVersion: response.dataVersion,
|
||||||
|
bindingDigest: response.bindingDigest,
|
||||||
|
consistency: response.consistency,
|
||||||
|
fields,
|
||||||
|
...(fields.length ? { status: "partial", data } : { status: "ready", data }),
|
||||||
|
};
|
||||||
|
}
|
||||||
Vendored
+891
@@ -0,0 +1,891 @@
|
|||||||
|
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
||||||
|
import type { CaminoObject, CrdtValue, QueryPathPart, QueryRequestSchema, QueryResponse, QueryResponseSchema, Value } from "../camino/api_pb.js";
|
||||||
|
import type { InstalledQuery } from "../camino/schema_pb.js";
|
||||||
|
import type { PackageDescriptor } from "./package_pb.js";
|
||||||
|
import type { CapabilityRef, ConformanceWitness, FieldEditing, PackageExportRef } from "./refs_pb.js";
|
||||||
|
import type { DerivedDependency } from "./runtime_pb.js";
|
||||||
|
import type { Message } from "@bufbuild/protobuf";
|
||||||
|
/**
|
||||||
|
* Describes the file quixos/orch.proto.
|
||||||
|
*/
|
||||||
|
export declare const file_quixos_orch: GenFile;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.QueryEvent
|
||||||
|
*/
|
||||||
|
export type QueryEvent = Message<"quixos.orch.QueryEvent"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string run_id = 1;
|
||||||
|
*/
|
||||||
|
runId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: uint64 sequence = 2;
|
||||||
|
*/
|
||||||
|
sequence: bigint;
|
||||||
|
/**
|
||||||
|
* @generated from field: string kind = 3;
|
||||||
|
*/
|
||||||
|
kind: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.QueryResponse snapshot = 4;
|
||||||
|
*/
|
||||||
|
snapshot?: QueryResponse | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated camino.QueryPathPart path = 5;
|
||||||
|
*/
|
||||||
|
path: QueryPathPart[];
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.Value value = 6;
|
||||||
|
*/
|
||||||
|
value?: Value | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string error = 7;
|
||||||
|
*/
|
||||||
|
error: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.QueryEvent.
|
||||||
|
* Use `create(QueryEventSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const QueryEventSchema: GenMessage<QueryEvent>;
|
||||||
|
/**
|
||||||
|
* Exact closed interface lookup; no policy selection or competing conformances.
|
||||||
|
*
|
||||||
|
* @generated from message quixos.orch.TryConformRequest
|
||||||
|
*/
|
||||||
|
export type TryConformRequest = Message<"quixos.orch.TryConformRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 1;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 2;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.TryConformRequest.
|
||||||
|
* Use `create(TryConformRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const TryConformRequestSchema: GenMessage<TryConformRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.TryConformResponse
|
||||||
|
*/
|
||||||
|
export type TryConformResponse = Message<"quixos.orch.TryConformResponse"> & {
|
||||||
|
/**
|
||||||
|
* Absent only when this object lacks a known contract. Other failures are errors.
|
||||||
|
*
|
||||||
|
* @generated from field: quixos.ConformanceWitness conformance = 1;
|
||||||
|
*/
|
||||||
|
conformance?: ConformanceWitness | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.TryConformResponse.
|
||||||
|
* Use `create(TryConformResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const TryConformResponseSchema: GenMessage<TryConformResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ConstructObjectRequest
|
||||||
|
*/
|
||||||
|
export type ConstructObjectRequest = Message<"quixos.orch.ConstructObjectRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string atom_id = 1;
|
||||||
|
*/
|
||||||
|
atomId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: map<string, camino.Value> input = 2;
|
||||||
|
*/
|
||||||
|
input: {
|
||||||
|
[key: string]: Value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ConstructObjectRequest.
|
||||||
|
* Use `create(ConstructObjectRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ConstructObjectRequestSchema: GenMessage<ConstructObjectRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ConstructObjectResponse
|
||||||
|
*/
|
||||||
|
export type ConstructObjectResponse = Message<"quixos.orch.ConstructObjectResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.CaminoObject object = 1;
|
||||||
|
*/
|
||||||
|
object?: CaminoObject | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ConstructObjectResponse.
|
||||||
|
* Use `create(ConstructObjectResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ConstructObjectResponseSchema: GenMessage<ConstructObjectResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ResolveOrConstructRelatedObjectRequest
|
||||||
|
*/
|
||||||
|
export type ResolveOrConstructRelatedObjectRequest = Message<"quixos.orch.ResolveOrConstructRelatedObjectRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 1;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 2;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string member_id = 3;
|
||||||
|
*/
|
||||||
|
memberId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ResolveOrConstructRelatedObjectRequest.
|
||||||
|
* Use `create(ResolveOrConstructRelatedObjectRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ResolveOrConstructRelatedObjectRequestSchema: GenMessage<ResolveOrConstructRelatedObjectRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ResolveOrConstructRelatedObjectResponse
|
||||||
|
*/
|
||||||
|
export type ResolveOrConstructRelatedObjectResponse = Message<"quixos.orch.ResolveOrConstructRelatedObjectResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.CaminoObject object = 1;
|
||||||
|
*/
|
||||||
|
object?: CaminoObject | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: bool constructed = 2;
|
||||||
|
*/
|
||||||
|
constructed: boolean;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ResolveOrConstructRelatedObjectResponse.
|
||||||
|
* Use `create(ResolveOrConstructRelatedObjectResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ResolveOrConstructRelatedObjectResponseSchema: GenMessage<ResolveOrConstructRelatedObjectResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.InvokeCapabilityRequest
|
||||||
|
*/
|
||||||
|
export type InvokeCapabilityRequest = Message<"quixos.orch.InvokeCapabilityRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.CapabilityRef capability = 1;
|
||||||
|
*/
|
||||||
|
capability?: CapabilityRef | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 2;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: map<string, camino.Value> input = 3;
|
||||||
|
*/
|
||||||
|
input: {
|
||||||
|
[key: string]: Value;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Identifies one logical client mutation across the capability and Camino
|
||||||
|
* layers so a live-value controller can recognize its own confirmation.
|
||||||
|
*
|
||||||
|
* @generated from field: string client_mutation_id = 4;
|
||||||
|
*/
|
||||||
|
clientMutationId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.InvokeCapabilityRequest.
|
||||||
|
* Use `create(InvokeCapabilityRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvokeCapabilityRequestSchema: GenMessage<InvokeCapabilityRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.InvokeClassCapabilityRequest
|
||||||
|
*/
|
||||||
|
export type InvokeClassCapabilityRequest = Message<"quixos.orch.InvokeClassCapabilityRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string conformance_id = 1;
|
||||||
|
*/
|
||||||
|
conformanceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string operation_id = 2;
|
||||||
|
*/
|
||||||
|
operationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: map<string, camino.Value> input = 3;
|
||||||
|
*/
|
||||||
|
input: {
|
||||||
|
[key: string]: Value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.InvokeClassCapabilityRequest.
|
||||||
|
* Use `create(InvokeClassCapabilityRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvokeClassCapabilityRequestSchema: GenMessage<InvokeClassCapabilityRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.InvokeCapabilityResponse
|
||||||
|
*/
|
||||||
|
export type InvokeCapabilityResponse = Message<"quixos.orch.InvokeCapabilityResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.orch.Activation activation = 2;
|
||||||
|
*/
|
||||||
|
activation?: Activation | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: bool ok = 3;
|
||||||
|
*/
|
||||||
|
ok: boolean;
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.Value result = 4;
|
||||||
|
*/
|
||||||
|
result?: Value | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string error = 5;
|
||||||
|
*/
|
||||||
|
error: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.runtime.DerivedDependency dependencies = 6;
|
||||||
|
*/
|
||||||
|
dependencies: DerivedDependency[];
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.FieldEditing field_editing = 7;
|
||||||
|
*/
|
||||||
|
fieldEditing?: FieldEditing | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.InvokeCapabilityResponse.
|
||||||
|
* Use `create(InvokeCapabilityResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvokeCapabilityResponseSchema: GenMessage<InvokeCapabilityResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.EditCapabilityFieldRequest
|
||||||
|
*/
|
||||||
|
export type EditCapabilityFieldRequest = Message<"quixos.orch.EditCapabilityFieldRequest"> & {
|
||||||
|
/**
|
||||||
|
* The public getter; setter must belong to the same value member.
|
||||||
|
*
|
||||||
|
* @generated from field: quixos.CapabilityRef capability = 1;
|
||||||
|
*/
|
||||||
|
capability?: CapabilityRef | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 2;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string setter_operation_id = 3;
|
||||||
|
*/
|
||||||
|
setterOperationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string binding_digest = 4;
|
||||||
|
*/
|
||||||
|
bindingDigest: string;
|
||||||
|
/**
|
||||||
|
* @generated from oneof quixos.orch.EditCapabilityFieldRequest.edit
|
||||||
|
*/
|
||||||
|
edit: {
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.CrdtValue update = 5;
|
||||||
|
*/
|
||||||
|
value: CrdtValue;
|
||||||
|
case: "update";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.Value replacement = 7;
|
||||||
|
*/
|
||||||
|
value: Value;
|
||||||
|
case: "replacement";
|
||||||
|
} | {
|
||||||
|
case: undefined;
|
||||||
|
value?: undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from field: string client_mutation_id = 6;
|
||||||
|
*/
|
||||||
|
clientMutationId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.EditCapabilityFieldRequest.
|
||||||
|
* Use `create(EditCapabilityFieldRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const EditCapabilityFieldRequestSchema: GenMessage<EditCapabilityFieldRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.WatchCapabilityRequest
|
||||||
|
*/
|
||||||
|
export type WatchCapabilityRequest = Message<"quixos.orch.WatchCapabilityRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.CapabilityRef capability = 1;
|
||||||
|
*/
|
||||||
|
capability?: CapabilityRef | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 2;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: map<string, camino.Value> input = 3;
|
||||||
|
*/
|
||||||
|
input: {
|
||||||
|
[key: string]: Value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.WatchCapabilityRequest.
|
||||||
|
* Use `create(WatchCapabilityRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const WatchCapabilityRequestSchema: GenMessage<WatchCapabilityRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.WatchCapabilityEvent
|
||||||
|
*/
|
||||||
|
export type WatchCapabilityEvent = Message<"quixos.orch.WatchCapabilityEvent"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.orch.Activation activation = 2;
|
||||||
|
*/
|
||||||
|
activation?: Activation | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string watch_id = 3;
|
||||||
|
*/
|
||||||
|
watchId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.Value value = 4;
|
||||||
|
*/
|
||||||
|
value?: Value | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.runtime.DerivedDependency dependencies = 5;
|
||||||
|
*/
|
||||||
|
dependencies: DerivedDependency[];
|
||||||
|
/**
|
||||||
|
* @generated from field: string error = 6;
|
||||||
|
*/
|
||||||
|
error: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: bool initial = 7;
|
||||||
|
*/
|
||||||
|
initial: boolean;
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.FieldEditing field_editing = 8;
|
||||||
|
*/
|
||||||
|
fieldEditing?: FieldEditing | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.WatchCapabilityEvent.
|
||||||
|
* Use `create(WatchCapabilityEventSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const WatchCapabilityEventSchema: GenMessage<WatchCapabilityEvent>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.GetWorkspaceRequest
|
||||||
|
*/
|
||||||
|
export type GetWorkspaceRequest = Message<"quixos.orch.GetWorkspaceRequest"> & {
|
||||||
|
/**
|
||||||
|
* Revision polling must not download the entire interface graph.
|
||||||
|
*
|
||||||
|
* @generated from field: bool include_interface_contracts = 1;
|
||||||
|
*/
|
||||||
|
includeInterfaceContracts: boolean;
|
||||||
|
/**
|
||||||
|
* @generated from field: bool include_query_contracts = 2;
|
||||||
|
*/
|
||||||
|
includeQueryContracts: boolean;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.GetWorkspaceRequest.
|
||||||
|
* Use `create(GetWorkspaceRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const GetWorkspaceRequestSchema: GenMessage<GetWorkspaceRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.GetWorkspaceResponse
|
||||||
|
*/
|
||||||
|
export type GetWorkspaceResponse = Message<"quixos.orch.GetWorkspaceResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_id = 1;
|
||||||
|
*/
|
||||||
|
workspaceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_revision_id = 2;
|
||||||
|
*/
|
||||||
|
workspaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string source_root_commit = 3;
|
||||||
|
*/
|
||||||
|
sourceRootCommit: string;
|
||||||
|
/**
|
||||||
|
* Checked constructors whose wire input can be empty. The create panel uses
|
||||||
|
* class factory conformances instead of this constructor inventory.
|
||||||
|
*
|
||||||
|
* @generated from field: repeated string empty_input_constructible_atom_ids = 4;
|
||||||
|
*/
|
||||||
|
emptyInputConstructibleAtomIds: string[];
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.CapabilityInputContract capability_inputs = 5;
|
||||||
|
*/
|
||||||
|
capabilityInputs: CapabilityInputContract[];
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.ConstructorInputContract constructor_inputs = 6;
|
||||||
|
*/
|
||||||
|
constructorInputs: ConstructorInputContract[];
|
||||||
|
/**
|
||||||
|
* Exact closed interface contracts used by checked presentation consumers.
|
||||||
|
*
|
||||||
|
* @generated from field: string interfaces_json = 7;
|
||||||
|
*/
|
||||||
|
interfacesJson: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.ClassCapability class_capabilities = 8;
|
||||||
|
*/
|
||||||
|
classCapabilities: ClassCapability[];
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.QueryDescription queries = 9;
|
||||||
|
*/
|
||||||
|
queries: QueryDescription[];
|
||||||
|
/**
|
||||||
|
* @generated from field: uint32 active_query_executions = 10;
|
||||||
|
*/
|
||||||
|
activeQueryExecutions: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.GetWorkspaceResponse.
|
||||||
|
* Use `create(GetWorkspaceResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const GetWorkspaceResponseSchema: GenMessage<GetWorkspaceResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.QueryDescription
|
||||||
|
*/
|
||||||
|
export type QueryDescription = Message<"quixos.orch.QueryDescription"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string id = 1;
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string name = 2;
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 3;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string document = 4;
|
||||||
|
*/
|
||||||
|
document: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string schema = 5;
|
||||||
|
*/
|
||||||
|
schema: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated string source_files = 6;
|
||||||
|
*/
|
||||||
|
sourceFiles: string[];
|
||||||
|
/**
|
||||||
|
* @generated from field: string effects_json = 7;
|
||||||
|
*/
|
||||||
|
effectsJson: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: camino.InstalledQuery plan = 8;
|
||||||
|
*/
|
||||||
|
plan?: InstalledQuery | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.QueryDescription.
|
||||||
|
* Use `create(QueryDescriptionSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const QueryDescriptionSchema: GenMessage<QueryDescription>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ClassCapability
|
||||||
|
*/
|
||||||
|
export type ClassCapability = Message<"quixos.orch.ClassCapability"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string conformance_id = 1;
|
||||||
|
*/
|
||||||
|
conformanceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string atom_id = 2;
|
||||||
|
*/
|
||||||
|
atomId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 3;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string definition_id = 4;
|
||||||
|
*/
|
||||||
|
definitionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string operation_id = 5;
|
||||||
|
*/
|
||||||
|
operationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string input_type_json = 6;
|
||||||
|
*/
|
||||||
|
inputTypeJson: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string output_type_json = 7;
|
||||||
|
*/
|
||||||
|
outputTypeJson: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ClassCapability.
|
||||||
|
* Use `create(ClassCapabilitySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ClassCapabilitySchema: GenMessage<ClassCapability>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.CapabilityInputContract
|
||||||
|
*/
|
||||||
|
export type CapabilityInputContract = Message<"quixos.orch.CapabilityInputContract"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 1;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string operation_id = 2;
|
||||||
|
*/
|
||||||
|
operationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string type_json = 3;
|
||||||
|
*/
|
||||||
|
typeJson: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.CapabilityInputContract.
|
||||||
|
* Use `create(CapabilityInputContractSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const CapabilityInputContractSchema: GenMessage<CapabilityInputContract>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ConstructorInputContract
|
||||||
|
*/
|
||||||
|
export type ConstructorInputContract = Message<"quixos.orch.ConstructorInputContract"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string atom_id = 1;
|
||||||
|
*/
|
||||||
|
atomId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string type_json = 2;
|
||||||
|
*/
|
||||||
|
typeJson: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ConstructorInputContract.
|
||||||
|
* Use `create(ConstructorInputContractSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ConstructorInputContractSchema: GenMessage<ConstructorInputContract>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListActivationsRequest
|
||||||
|
*/
|
||||||
|
export type ListActivationsRequest = Message<"quixos.orch.ListActivationsRequest"> & {};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListActivationsRequest.
|
||||||
|
* Use `create(ListActivationsRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListActivationsRequestSchema: GenMessage<ListActivationsRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListPackageDescriptorsRequest
|
||||||
|
*/
|
||||||
|
export type ListPackageDescriptorsRequest = Message<"quixos.orch.ListPackageDescriptorsRequest"> & {};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListPackageDescriptorsRequest.
|
||||||
|
* Use `create(ListPackageDescriptorsRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListPackageDescriptorsRequestSchema: GenMessage<ListPackageDescriptorsRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListPackageDescriptorsResponse
|
||||||
|
*/
|
||||||
|
export type ListPackageDescriptorsResponse = Message<"quixos.orch.ListPackageDescriptorsResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.PackageDescriptor descriptors = 1;
|
||||||
|
*/
|
||||||
|
descriptors: PackageDescriptor[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListPackageDescriptorsResponse.
|
||||||
|
* Use `create(ListPackageDescriptorsResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListPackageDescriptorsResponseSchema: GenMessage<ListPackageDescriptorsResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListPackageRuntimesRequest
|
||||||
|
*/
|
||||||
|
export type ListPackageRuntimesRequest = Message<"quixos.orch.ListPackageRuntimesRequest"> & {};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListPackageRuntimesRequest.
|
||||||
|
* Use `create(ListPackageRuntimesRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListPackageRuntimesRequestSchema: GenMessage<ListPackageRuntimesRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListPackageRuntimesResponse
|
||||||
|
*/
|
||||||
|
export type ListPackageRuntimesResponse = Message<"quixos.orch.ListPackageRuntimesResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.PackageRuntimeStatus runtimes = 1;
|
||||||
|
*/
|
||||||
|
runtimes: PackageRuntimeStatus[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListPackageRuntimesResponse.
|
||||||
|
* Use `create(ListPackageRuntimesResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListPackageRuntimesResponseSchema: GenMessage<ListPackageRuntimesResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.ListActivationsResponse
|
||||||
|
*/
|
||||||
|
export type ListActivationsResponse = Message<"quixos.orch.ListActivationsResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.orch.Activation activations = 1;
|
||||||
|
*/
|
||||||
|
activations: Activation[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.ListActivationsResponse.
|
||||||
|
* Use `create(ListActivationsResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ListActivationsResponseSchema: GenMessage<ListActivationsResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.CloseActivationRequest
|
||||||
|
*/
|
||||||
|
export type CloseActivationRequest = Message<"quixos.orch.CloseActivationRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string activation_id = 1;
|
||||||
|
*/
|
||||||
|
activationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string reason = 2;
|
||||||
|
*/
|
||||||
|
reason: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.CloseActivationRequest.
|
||||||
|
* Use `create(CloseActivationRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const CloseActivationRequestSchema: GenMessage<CloseActivationRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.CloseActivationResponse
|
||||||
|
*/
|
||||||
|
export type CloseActivationResponse = Message<"quixos.orch.CloseActivationResponse"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.orch.Activation activation = 1;
|
||||||
|
*/
|
||||||
|
activation?: Activation | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.CloseActivationResponse.
|
||||||
|
* Use `create(CloseActivationResponseSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const CloseActivationResponseSchema: GenMessage<CloseActivationResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.Activation
|
||||||
|
*/
|
||||||
|
export type Activation = Message<"quixos.orch.Activation"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string activation_id = 1;
|
||||||
|
*/
|
||||||
|
activationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.PackageExportRef export = 2;
|
||||||
|
*/
|
||||||
|
export?: PackageExportRef | undefined;
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 3;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string state = 4;
|
||||||
|
*/
|
||||||
|
state: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: uint32 demand = 5;
|
||||||
|
*/
|
||||||
|
demand: number;
|
||||||
|
/**
|
||||||
|
* @generated from field: string opened_at = 6;
|
||||||
|
*/
|
||||||
|
openedAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string last_used_at = 7;
|
||||||
|
*/
|
||||||
|
lastUsedAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string idle_deadline_at = 8;
|
||||||
|
*/
|
||||||
|
idleDeadlineAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string closed_at = 9;
|
||||||
|
*/
|
||||||
|
closedAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string close_reason = 10;
|
||||||
|
*/
|
||||||
|
closeReason: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.Activation.
|
||||||
|
* Use `create(ActivationSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ActivationSchema: GenMessage<Activation>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.orch.PackageRuntimeStatus
|
||||||
|
*/
|
||||||
|
export type PackageRuntimeStatus = Message<"quixos.orch.PackageRuntimeStatus"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_key = 1;
|
||||||
|
*/
|
||||||
|
runtimeKey: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 2;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string source_repository = 3;
|
||||||
|
*/
|
||||||
|
sourceRepository: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string source_commit = 4;
|
||||||
|
*/
|
||||||
|
sourceCommit: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string build_target = 5;
|
||||||
|
*/
|
||||||
|
buildTarget: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string server_path = 6;
|
||||||
|
*/
|
||||||
|
serverPath: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: uint32 pid = 7;
|
||||||
|
*/
|
||||||
|
pid: number;
|
||||||
|
/**
|
||||||
|
* @generated from field: string state = 8;
|
||||||
|
*/
|
||||||
|
state: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string started_at = 9;
|
||||||
|
*/
|
||||||
|
startedAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string last_handshake_at = 10;
|
||||||
|
*/
|
||||||
|
lastHandshakeAt: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_protocol_version = 11;
|
||||||
|
*/
|
||||||
|
runtimeProtocolVersion: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: uint32 advertised_export_count = 12;
|
||||||
|
*/
|
||||||
|
advertisedExportCount: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.orch.PackageRuntimeStatus.
|
||||||
|
* Use `create(PackageRuntimeStatusSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const PackageRuntimeStatusSchema: GenMessage<PackageRuntimeStatus>;
|
||||||
|
/**
|
||||||
|
* @generated from service quixos.orch.OrchestratorRuntime
|
||||||
|
*/
|
||||||
|
export declare const OrchestratorRuntime: GenService<{
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ExecuteQuery
|
||||||
|
*/
|
||||||
|
executeQuery: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof QueryRequestSchema;
|
||||||
|
output: typeof QueryResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.WatchQuery
|
||||||
|
*/
|
||||||
|
watchQuery: {
|
||||||
|
methodKind: "server_streaming";
|
||||||
|
input: typeof QueryRequestSchema;
|
||||||
|
output: typeof QueryEventSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.TryConform
|
||||||
|
*/
|
||||||
|
tryConform: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof TryConformRequestSchema;
|
||||||
|
output: typeof TryConformResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.InvokeCapability
|
||||||
|
*/
|
||||||
|
invokeCapability: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvokeCapabilityRequestSchema;
|
||||||
|
output: typeof InvokeCapabilityResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.EditCapabilityField
|
||||||
|
*/
|
||||||
|
editCapabilityField: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof EditCapabilityFieldRequestSchema;
|
||||||
|
output: typeof InvokeCapabilityResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.InvokeClassCapability
|
||||||
|
*/
|
||||||
|
invokeClassCapability: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvokeClassCapabilityRequestSchema;
|
||||||
|
output: typeof InvokeCapabilityResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.WatchCapability
|
||||||
|
*/
|
||||||
|
watchCapability: {
|
||||||
|
methodKind: "server_streaming";
|
||||||
|
input: typeof WatchCapabilityRequestSchema;
|
||||||
|
output: typeof WatchCapabilityEventSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ConstructObject
|
||||||
|
*/
|
||||||
|
constructObject: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof ConstructObjectRequestSchema;
|
||||||
|
output: typeof ConstructObjectResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ResolveOrConstructRelatedObject
|
||||||
|
*/
|
||||||
|
resolveOrConstructRelatedObject: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof ResolveOrConstructRelatedObjectRequestSchema;
|
||||||
|
output: typeof ResolveOrConstructRelatedObjectResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.GetWorkspace
|
||||||
|
*/
|
||||||
|
getWorkspace: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof GetWorkspaceRequestSchema;
|
||||||
|
output: typeof GetWorkspaceResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ListPackageDescriptors
|
||||||
|
*/
|
||||||
|
listPackageDescriptors: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof ListPackageDescriptorsRequestSchema;
|
||||||
|
output: typeof ListPackageDescriptorsResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ListPackageRuntimes
|
||||||
|
*/
|
||||||
|
listPackageRuntimes: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof ListPackageRuntimesRequestSchema;
|
||||||
|
output: typeof ListPackageRuntimesResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.ListActivations
|
||||||
|
*/
|
||||||
|
listActivations: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof ListActivationsRequestSchema;
|
||||||
|
output: typeof ListActivationsResponseSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.orch.OrchestratorRuntime.CloseActivation
|
||||||
|
*/
|
||||||
|
closeActivation: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof CloseActivationRequestSchema;
|
||||||
|
output: typeof CloseActivationResponseSchema;
|
||||||
|
};
|
||||||
|
}>;
|
||||||
|
//# sourceMappingURL=orch_pb.d.ts.map
|
||||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+162
File diff suppressed because one or more lines are too long
Vendored
+51
@@ -0,0 +1,51 @@
|
|||||||
|
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
||||||
|
import type { Message } from "@bufbuild/protobuf";
|
||||||
|
/**
|
||||||
|
* Describes the file quixos/package.proto.
|
||||||
|
*/
|
||||||
|
export declare const file_quixos_package: GenFile;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.PackageDescriptor
|
||||||
|
*/
|
||||||
|
export type PackageDescriptor = Message<"quixos.PackageDescriptor"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_id = 1;
|
||||||
|
*/
|
||||||
|
packageId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 2;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_protocol_version = 3;
|
||||||
|
*/
|
||||||
|
runtimeProtocolVersion: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.RuntimeExport exports = 4;
|
||||||
|
*/
|
||||||
|
exports: RuntimeExport[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageDescriptor.
|
||||||
|
* Use `create(PackageDescriptorSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const PackageDescriptorSchema: GenMessage<PackageDescriptor>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.RuntimeExport
|
||||||
|
*/
|
||||||
|
export type RuntimeExport = Message<"quixos.RuntimeExport"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string export_id = 1;
|
||||||
|
*/
|
||||||
|
exportId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_symbol = 2;
|
||||||
|
*/
|
||||||
|
runtimeSymbol: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.RuntimeExport.
|
||||||
|
* Use `create(RuntimeExportSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const RuntimeExportSchema: GenMessage<RuntimeExport>;
|
||||||
|
//# sourceMappingURL=package_pb.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"package_pb.d.ts","sourceRoot":"","sources":["../../src/quixos/package_pb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OACgT,CAAC;AAEnV;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,0BAA0B,CAAC,GAAG;IACpE;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,UAAU,CAAC,iBAAiB,CAC7B,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,sBAAsB,CAAC,GAAG;IAC5D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,aAAa,CACrB,CAAC"}
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js"
|
||||||
|
// @generated from file quixos/package.proto (package quixos, syntax proto3)
|
||||||
|
/* eslint-disable */
|
||||||
|
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
||||||
|
/**
|
||||||
|
* Describes the file quixos/package.proto.
|
||||||
|
*/
|
||||||
|
export const file_quixos_package = /*@__PURE__*/ fileDesc("ChRxdWl4b3MvcGFja2FnZS5wcm90bxIGcXVpeG9zIo4BChFQYWNrYWdlRGVzY3JpcHRvchISCgpwYWNrYWdlX2lkGAEgASgJEhsKE3BhY2thZ2VfcmV2aXNpb25faWQYAiABKAkSIAoYcnVudGltZV9wcm90b2NvbF92ZXJzaW9uGAMgASgJEiYKB2V4cG9ydHMYBCADKAsyFS5xdWl4b3MuUnVudGltZUV4cG9ydCI6Cg1SdW50aW1lRXhwb3J0EhEKCWV4cG9ydF9pZBgBIAEoCRIWCg5ydW50aW1lX3N5bWJvbBgCIAEoCWIGcHJvdG8z");
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageDescriptor.
|
||||||
|
* Use `create(PackageDescriptorSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const PackageDescriptorSchema = /*@__PURE__*/ messageDesc(file_quixos_package, 0);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.RuntimeExport.
|
||||||
|
* Use `create(RuntimeExportSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const RuntimeExportSchema = /*@__PURE__*/ messageDesc(file_quixos_package, 1);
|
||||||
Vendored
+191
-20
@@ -1,37 +1,208 @@
|
|||||||
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
||||||
import type { Message } from "@bufbuild/protobuf";
|
import type { Message } from "@bufbuild/protobuf";
|
||||||
/**
|
/**
|
||||||
* Describes the file quixos/refs.proto.
|
* Describes the file quixos/refs.proto.
|
||||||
*/
|
*/
|
||||||
export declare const file_quixos_refs: GenFile;
|
export declare const file_quixos_refs: GenFile;
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.FunctionRef
|
* @generated from message quixos.CapabilityRef
|
||||||
*/
|
*/
|
||||||
export type FunctionRef = Message<"quixos.FunctionRef"> & {
|
export type CapabilityRef = Message<"quixos.CapabilityRef"> & {
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_namespace = 1;
|
* @generated from field: string interface_revision_id = 1;
|
||||||
*/
|
*/
|
||||||
packageNamespace: string;
|
interfaceRevisionId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_name = 2;
|
* @generated from field: string operation_id = 2;
|
||||||
*/
|
*/
|
||||||
packageName: string;
|
operationId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string symbol = 3;
|
* Optional fence for a view acquired through TryConform. Not an authority grant.
|
||||||
|
*
|
||||||
|
* @generated from field: quixos.ConformanceWitness conformance = 3;
|
||||||
*/
|
*/
|
||||||
symbol: string;
|
conformance?: ConformanceWitness | undefined;
|
||||||
/**
|
|
||||||
* @generated from field: string version_ref = 4;
|
|
||||||
*/
|
|
||||||
versionRef: string;
|
|
||||||
/**
|
|
||||||
* @generated from field: string operation = 5;
|
|
||||||
*/
|
|
||||||
operation: string;
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.FunctionRef.
|
* Describes the message quixos.CapabilityRef.
|
||||||
* Use `create(FunctionRefSchema)` to create a new message.
|
* Use `create(CapabilityRefSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export declare const FunctionRefSchema: GenMessage<FunctionRef>;
|
export declare const CapabilityRefSchema: GenMessage<CapabilityRef>;
|
||||||
|
/**
|
||||||
|
* Resolved native editing semantics. A source snapshot alone grants no writer.
|
||||||
|
*
|
||||||
|
* @generated from message quixos.FieldEditing
|
||||||
|
*/
|
||||||
|
export type FieldEditing = Message<"quixos.FieldEditing"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string getter_operation_id = 1;
|
||||||
|
*/
|
||||||
|
getterOperationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string setter_operation_id = 2;
|
||||||
|
*/
|
||||||
|
setterOperationId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string document_type = 3;
|
||||||
|
*/
|
||||||
|
documentType: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string binding_digest = 4;
|
||||||
|
*/
|
||||||
|
bindingDigest: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.FieldEditing.Mode mode = 5;
|
||||||
|
*/
|
||||||
|
mode: FieldEditing_Mode;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.FieldEditing.
|
||||||
|
* Use `create(FieldEditingSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const FieldEditingSchema: GenMessage<FieldEditing>;
|
||||||
|
/**
|
||||||
|
* @generated from enum quixos.FieldEditing.Mode
|
||||||
|
*/
|
||||||
|
export declare enum FieldEditing_Mode {
|
||||||
|
/**
|
||||||
|
* @generated from enum value: UNSPECIFIED = 0;
|
||||||
|
*/
|
||||||
|
UNSPECIFIED = 0,
|
||||||
|
/**
|
||||||
|
* @generated from enum value: REGISTER = 1;
|
||||||
|
*/
|
||||||
|
REGISTER = 1,
|
||||||
|
/**
|
||||||
|
* @generated from enum value: CRDT = 2;
|
||||||
|
*/
|
||||||
|
CRDT = 2
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Describes the enum quixos.FieldEditing.Mode.
|
||||||
|
*/
|
||||||
|
export declare const FieldEditing_ModeSchema: GenEnum<FieldEditing_Mode>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.ConformanceWitness
|
||||||
|
*/
|
||||||
|
export type ConformanceWitness = Message<"quixos.ConformanceWitness"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 1;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 2;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string conformance_id = 3;
|
||||||
|
*/
|
||||||
|
conformanceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_revision_id = 4;
|
||||||
|
*/
|
||||||
|
workspaceRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_epoch = 5;
|
||||||
|
*/
|
||||||
|
workspaceEpoch: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.ConformanceWitness.
|
||||||
|
* Use `create(ConformanceWitnessSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const ConformanceWitnessSchema: GenMessage<ConformanceWitness>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.PackageExportRef
|
||||||
|
*/
|
||||||
|
export type PackageExportRef = Message<"quixos.PackageExportRef"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 1;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string export_id = 2;
|
||||||
|
*/
|
||||||
|
exportId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageExportRef.
|
||||||
|
* Use `create(PackageExportRefSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const PackageExportRefSchema: GenMessage<PackageExportRef>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.InjectedDependency
|
||||||
|
*/
|
||||||
|
export type InjectedDependency = Message<"quixos.InjectedDependency"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string port_id = 1;
|
||||||
|
*/
|
||||||
|
portId: string;
|
||||||
|
/**
|
||||||
|
* @generated from oneof quixos.InjectedDependency.binding
|
||||||
|
*/
|
||||||
|
binding: {
|
||||||
|
/**
|
||||||
|
* @generated from field: string state_slot_id = 2;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "stateSlotId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.EdgeDependency edge = 3;
|
||||||
|
*/
|
||||||
|
value: EdgeDependency;
|
||||||
|
case: "edge";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 4;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "interfaceRevisionId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string constructor_atom_id = 5;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "constructorAtomId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string query_id = 7;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "queryId";
|
||||||
|
} | {
|
||||||
|
case: undefined;
|
||||||
|
value?: undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Defaults to the invocation receiver. A checked dependency traversal can
|
||||||
|
* select a related object explicitly before the package runtime starts.
|
||||||
|
*
|
||||||
|
* @generated from field: string object_id = 6;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.InjectedDependency.
|
||||||
|
* Use `create(InjectedDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InjectedDependencySchema: GenMessage<InjectedDependency>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.EdgeDependency
|
||||||
|
*/
|
||||||
|
export type EdgeDependency = Message<"quixos.EdgeDependency"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string edge_type_id = 1;
|
||||||
|
*/
|
||||||
|
edgeTypeId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string projection_id = 2;
|
||||||
|
*/
|
||||||
|
projectionId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.EdgeDependency.
|
||||||
|
* Use `create(EdgeDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const EdgeDependencySchema: GenMessage<EdgeDependency>;
|
||||||
//# sourceMappingURL=refs_pb.d.ts.map
|
//# sourceMappingURL=refs_pb.d.ts.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"refs_pb.d.ts","sourceRoot":"","sources":["../../src/quixos/refs_pb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO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ACH,OAAO,EAAE;QACP;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,aAAa,CAAC;KACrB,GAAG;QACF;;WAEG;QACH,KAAK,EAAE,cAAc,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG;QACF;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,qBAAqB,CAAC;KAC7B,GAAG;QACF;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,mBAAmB,CAAC;KAC3B,GAAG;QACF;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,SAAS,CAAC;KACjB,GAAG;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,UAAU,CAAC,kBAAkB,CAClC,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,GAAG;IAC9D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,CAAC,cAAc,CAC1B,CAAC"}
|
||||||
Vendored
+52
-5
@@ -1,13 +1,60 @@
|
|||||||
// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js"
|
// @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)
|
// @generated from file quixos/refs.proto (package quixos, syntax proto3)
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
||||||
/**
|
/**
|
||||||
* Describes the file quixos/refs.proto.
|
* Describes the file quixos/refs.proto.
|
||||||
*/
|
*/
|
||||||
export const file_quixos_refs = /*@__PURE__*/ fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zInYKC0Z1bmN0aW9uUmVmEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIOCgZzeW1ib2wYAyABKAkSEwoLdmVyc2lvbl9yZWYYBCABKAkSEQoJb3BlcmF0aW9uGAUgASgJYgZwcm90bzM");
|
export const file_quixos_refs = /*@__PURE__*/ fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zInUKDUNhcGFiaWxpdHlSZWYSHQoVaW50ZXJmYWNlX3JldmlzaW9uX2lkGAEgASgJEhQKDG9wZXJhdGlvbl9pZBgCIAEoCRIvCgtjb25mb3JtYW5jZRgDIAEoCzIaLnF1aXhvcy5Db25mb3JtYW5jZVdpdG5lc3Mi0QEKDEZpZWxkRWRpdGluZxIbChNnZXR0ZXJfb3BlcmF0aW9uX2lkGAEgASgJEhsKE3NldHRlcl9vcGVyYXRpb25faWQYAiABKAkSFQoNZG9jdW1lbnRfdHlwZRgDIAEoCRIWCg5iaW5kaW5nX2RpZ2VzdBgEIAEoCRInCgRtb2RlGAUgASgOMhkucXVpeG9zLkZpZWxkRWRpdGluZy5Nb2RlIi8KBE1vZGUSDwoLVU5TUEVDSUZJRUQQABIMCghSRUdJU1RFUhABEggKBENSRFQQAiKWAQoSQ29uZm9ybWFuY2VXaXRuZXNzEhEKCW9iamVjdF9pZBgBIAEoCRIdChVpbnRlcmZhY2VfcmV2aXNpb25faWQYAiABKAkSFgoOY29uZm9ybWFuY2VfaWQYAyABKAkSHQoVd29ya3NwYWNlX3JldmlzaW9uX2lkGAQgASgJEhcKD3dvcmtzcGFjZV9lcG9jaBgFIAEoCSJCChBQYWNrYWdlRXhwb3J0UmVmEhsKE3BhY2thZ2VfcmV2aXNpb25faWQYASABKAkSEQoJZXhwb3J0X2lkGAIgASgJItgBChJJbmplY3RlZERlcGVuZGVuY3kSDwoHcG9ydF9pZBgBIAEoCRIXCg1zdGF0ZV9zbG90X2lkGAIgASgJSAASJgoEZWRnZRgDIAEoCzIWLnF1aXhvcy5FZGdlRGVwZW5kZW5jeUgAEh8KFWludGVyZmFjZV9yZXZpc2lvbl9pZBgEIAEoCUgAEh0KE2NvbnN0cnVjdG9yX2F0b21faWQYBSABKAlIABISCghxdWVyeV9pZBgHIAEoCUgAEhEKCW9iamVjdF9pZBgGIAEoCUIJCgdiaW5kaW5nIj0KDkVkZ2VEZXBlbmRlbmN5EhQKDGVkZ2VfdHlwZV9pZBgBIAEoCRIVCg1wcm9qZWN0aW9uX2lkGAIgASgJYgZwcm90bzM");
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.FunctionRef.
|
* Describes the message quixos.CapabilityRef.
|
||||||
* Use `create(FunctionRefSchema)` to create a new message.
|
* Use `create(CapabilityRefSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const FunctionRefSchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 0);
|
export const CapabilityRefSchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 0);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.FieldEditing.
|
||||||
|
* Use `create(FieldEditingSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const FieldEditingSchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 1);
|
||||||
|
/**
|
||||||
|
* @generated from enum quixos.FieldEditing.Mode
|
||||||
|
*/
|
||||||
|
export var FieldEditing_Mode;
|
||||||
|
(function (FieldEditing_Mode) {
|
||||||
|
/**
|
||||||
|
* @generated from enum value: UNSPECIFIED = 0;
|
||||||
|
*/
|
||||||
|
FieldEditing_Mode[FieldEditing_Mode["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
||||||
|
/**
|
||||||
|
* @generated from enum value: REGISTER = 1;
|
||||||
|
*/
|
||||||
|
FieldEditing_Mode[FieldEditing_Mode["REGISTER"] = 1] = "REGISTER";
|
||||||
|
/**
|
||||||
|
* @generated from enum value: CRDT = 2;
|
||||||
|
*/
|
||||||
|
FieldEditing_Mode[FieldEditing_Mode["CRDT"] = 2] = "CRDT";
|
||||||
|
})(FieldEditing_Mode || (FieldEditing_Mode = {}));
|
||||||
|
/**
|
||||||
|
* Describes the enum quixos.FieldEditing.Mode.
|
||||||
|
*/
|
||||||
|
export const FieldEditing_ModeSchema = /*@__PURE__*/ enumDesc(file_quixos_refs, 1, 0);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.ConformanceWitness.
|
||||||
|
* Use `create(ConformanceWitnessSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const ConformanceWitnessSchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 2);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageExportRef.
|
||||||
|
* Use `create(PackageExportRefSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const PackageExportRefSchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 3);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.InjectedDependency.
|
||||||
|
* Use `create(InjectedDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InjectedDependencySchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 4);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.EdgeDependency.
|
||||||
|
* Use `create(EdgeDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const EdgeDependencySchema = /*@__PURE__*/ messageDesc(file_quixos_refs, 5);
|
||||||
|
|||||||
Vendored
+136
-18
@@ -1,6 +1,6 @@
|
|||||||
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
||||||
import type { Value } from "../camino/api_pb.js";
|
import type { Value } from "../camino/api_pb.js";
|
||||||
import type { FunctionRef } from "./refs_pb.js";
|
import type { InjectedDependency, PackageExportRef } from "./refs_pb.js";
|
||||||
import type { Message } from "@bufbuild/protobuf";
|
import type { Message } from "@bufbuild/protobuf";
|
||||||
/**
|
/**
|
||||||
* Describes the file quixos/runtime.proto.
|
* Describes the file quixos/runtime.proto.
|
||||||
@@ -14,6 +14,10 @@ export type HandshakeRequest = Message<"quixos.runtime.HandshakeRequest"> & {
|
|||||||
* @generated from field: string orch_protocol_version = 1;
|
* @generated from field: string orch_protocol_version = 1;
|
||||||
*/
|
*/
|
||||||
orchProtocolVersion: string;
|
orchProtocolVersion: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string nonce = 2;
|
||||||
|
*/
|
||||||
|
nonce: string;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.HandshakeRequest.
|
* Describes the message quixos.runtime.HandshakeRequest.
|
||||||
@@ -25,27 +29,105 @@ export declare const HandshakeRequestSchema: GenMessage<HandshakeRequest>;
|
|||||||
*/
|
*/
|
||||||
export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & {
|
export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & {
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_namespace = 1;
|
* @generated from field: string package_revision_id = 1;
|
||||||
*/
|
*/
|
||||||
packageNamespace: string;
|
packageRevisionId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_name = 2;
|
* @generated from field: string runtime_protocol_version = 2;
|
||||||
*/
|
|
||||||
packageName: string;
|
|
||||||
/**
|
|
||||||
* @generated from field: string runtime_protocol_version = 3;
|
|
||||||
*/
|
*/
|
||||||
runtimeProtocolVersion: string;
|
runtimeProtocolVersion: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: repeated quixos.FunctionRef functions = 4;
|
* @generated from field: repeated string export_ids = 3;
|
||||||
*/
|
*/
|
||||||
functions: FunctionRef[];
|
exportIds: string[];
|
||||||
|
/**
|
||||||
|
* @generated from field: string instance_id = 4;
|
||||||
|
*/
|
||||||
|
instanceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string authentication_proof = 5;
|
||||||
|
*/
|
||||||
|
authenticationProof: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated string capabilities = 6;
|
||||||
|
*/
|
||||||
|
capabilities: string[];
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.HandshakeResponse.
|
* Describes the message quixos.runtime.HandshakeResponse.
|
||||||
* Use `create(HandshakeResponseSchema)` to create a new message.
|
* Use `create(HandshakeResponseSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export declare const HandshakeResponseSchema: GenMessage<HandshakeResponse>;
|
export declare const HandshakeResponseSchema: GenMessage<HandshakeResponse>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationContext
|
||||||
|
*/
|
||||||
|
export type InvocationContext = Message<"quixos.runtime.InvocationContext"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_epoch = 1;
|
||||||
|
*/
|
||||||
|
workspaceEpoch: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string instance_id = 2;
|
||||||
|
*/
|
||||||
|
instanceId: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string binding_digest = 3;
|
||||||
|
*/
|
||||||
|
bindingDigest: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string grant = 4;
|
||||||
|
*/
|
||||||
|
grant: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: string session_id = 5;
|
||||||
|
*/
|
||||||
|
sessionId: string;
|
||||||
|
/**
|
||||||
|
* Host-selected owner; packages must not invent workspace-local ownership.
|
||||||
|
*
|
||||||
|
* @generated from field: string owner_conformance_id = 6;
|
||||||
|
*/
|
||||||
|
ownerConformanceId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationContext.
|
||||||
|
* Use `create(InvocationContextSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvocationContextSchema: GenMessage<InvocationContext>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationControlRequest
|
||||||
|
*/
|
||||||
|
export type InvocationControlRequest = Message<"quixos.runtime.InvocationControlRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationControlRequest.
|
||||||
|
* Use `create(InvocationControlRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvocationControlRequestSchema: GenMessage<InvocationControlRequest>;
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationStatus
|
||||||
|
*/
|
||||||
|
export type InvocationStatus = Message<"quixos.runtime.InvocationStatus"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
/**
|
||||||
|
* unknown, running, cancellation-requested, completed, failed
|
||||||
|
*
|
||||||
|
* @generated from field: string state = 2;
|
||||||
|
*/
|
||||||
|
state: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationStatus.
|
||||||
|
* Use `create(InvocationStatusSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export declare const InvocationStatusSchema: GenMessage<InvocationStatus>;
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.InvokeRequest
|
* @generated from message quixos.runtime.InvokeRequest
|
||||||
*/
|
*/
|
||||||
@@ -55,9 +137,9 @@ export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & {
|
|||||||
*/
|
*/
|
||||||
invocationId: string;
|
invocationId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: quixos.FunctionRef function = 2;
|
* @generated from field: quixos.PackageExportRef export = 2;
|
||||||
*/
|
*/
|
||||||
function?: FunctionRef | undefined;
|
export?: PackageExportRef | undefined;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string object_id = 3;
|
* @generated from field: string object_id = 3;
|
||||||
*/
|
*/
|
||||||
@@ -68,6 +150,14 @@ export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & {
|
|||||||
input: {
|
input: {
|
||||||
[key: string]: Value;
|
[key: string]: Value;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.InjectedDependency dependencies = 5;
|
||||||
|
*/
|
||||||
|
dependencies: InjectedDependency[];
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.runtime.InvocationContext context = 6;
|
||||||
|
*/
|
||||||
|
context?: InvocationContext | undefined;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.InvokeRequest.
|
* Describes the message quixos.runtime.InvokeRequest.
|
||||||
@@ -90,6 +180,10 @@ export type InvokeResponse = Message<"quixos.runtime.InvokeResponse"> & {
|
|||||||
* @generated from field: string error = 3;
|
* @generated from field: string error = 3;
|
||||||
*/
|
*/
|
||||||
error: string;
|
error: string;
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.runtime.DerivedDependency dependencies = 4;
|
||||||
|
*/
|
||||||
|
dependencies: DerivedDependency[];
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.InvokeResponse.
|
* Describes the message quixos.runtime.InvokeResponse.
|
||||||
@@ -105,9 +199,9 @@ export type WatchRequest = Message<"quixos.runtime.WatchRequest"> & {
|
|||||||
*/
|
*/
|
||||||
invocationId: string;
|
invocationId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: quixos.FunctionRef function = 2;
|
* @generated from field: quixos.PackageExportRef export = 2;
|
||||||
*/
|
*/
|
||||||
function?: FunctionRef | undefined;
|
export?: PackageExportRef | undefined;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string object_id = 3;
|
* @generated from field: string object_id = 3;
|
||||||
*/
|
*/
|
||||||
@@ -118,6 +212,14 @@ export type WatchRequest = Message<"quixos.runtime.WatchRequest"> & {
|
|||||||
input: {
|
input: {
|
||||||
[key: string]: Value;
|
[key: string]: Value;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.InjectedDependency dependencies = 5;
|
||||||
|
*/
|
||||||
|
dependencies: InjectedDependency[];
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.runtime.InvocationContext context = 6;
|
||||||
|
*/
|
||||||
|
context?: InvocationContext | undefined;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.WatchRequest.
|
* Describes the message quixos.runtime.WatchRequest.
|
||||||
@@ -137,13 +239,13 @@ export type DerivedDependency = Message<"quixos.runtime.DerivedDependency"> & {
|
|||||||
*/
|
*/
|
||||||
objectId: string;
|
objectId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string field_name = 3;
|
* @generated from field: string attachment_id = 3;
|
||||||
*/
|
*/
|
||||||
fieldName: string;
|
attachmentId: string;
|
||||||
/**
|
/**
|
||||||
* @generated from field: string source_field = 4;
|
* @generated from field: string projection_id = 4;
|
||||||
*/
|
*/
|
||||||
sourceField: string;
|
projectionId: string;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.DerivedDependency.
|
* Describes the message quixos.runtime.DerivedDependency.
|
||||||
@@ -208,5 +310,21 @@ export declare const PackageRuntime: GenService<{
|
|||||||
input: typeof WatchRequestSchema;
|
input: typeof WatchRequestSchema;
|
||||||
output: typeof WatchEventSchema;
|
output: typeof WatchEventSchema;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.runtime.PackageRuntime.GetInvocationStatus
|
||||||
|
*/
|
||||||
|
getInvocationStatus: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvocationControlRequestSchema;
|
||||||
|
output: typeof InvocationStatusSchema;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.runtime.PackageRuntime.CancelInvocation
|
||||||
|
*/
|
||||||
|
cancelInvocation: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvocationControlRequestSchema;
|
||||||
|
output: typeof InvocationStatusSchema;
|
||||||
|
};
|
||||||
}>;
|
}>;
|
||||||
//# sourceMappingURL=runtime_pb.d.ts.map
|
//# sourceMappingURL=runtime_pb.d.ts.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"runtime_pb.d.ts","sourceRoot":"","sources":["../../src/quixos/runtime_pb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OACwoD,CAAC;AAE3qD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,iCAAiC,CAAC,GAAG;IAC1E;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,UAAU,CAAC,gBAAgB,CAC3B,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,kCAAkC,CAAC,GAAG;IAC5E;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,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C,CAAC"}
|
||||||
Vendored
+21
-6
@@ -7,7 +7,7 @@ import { file_quixos_refs } from "./refs_pb.js";
|
|||||||
/**
|
/**
|
||||||
* Describes the file quixos/runtime.proto.
|
* Describes the file quixos/runtime.proto.
|
||||||
*/
|
*/
|
||||||
export const file_quixos_runtime = /*@__PURE__*/ fileDesc("ChRxdWl4b3MvcnVudGltZS5wcm90bxIOcXVpeG9zLnJ1bnRpbWUiMQoQSGFuZHNoYWtlUmVxdWVzdBIdChVvcmNoX3Byb3RvY29sX3ZlcnNpb24YASABKAkijgEKEUhhbmRzaGFrZVJlc3BvbnNlEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIgChhydW50aW1lX3Byb3RvY29sX3ZlcnNpb24YAyABKAkSJgoJZnVuY3Rpb25zGAQgAygLMhMucXVpeG9zLkZ1bmN0aW9uUmVmItYBCg1JbnZva2VSZXF1ZXN0EhUKDWludm9jYXRpb25faWQYASABKAkSJQoIZnVuY3Rpb24YAiABKAsyEy5xdWl4b3MuRnVuY3Rpb25SZWYSEQoJb2JqZWN0X2lkGAMgASgJEjcKBWlucHV0GAQgAygLMigucXVpeG9zLnJ1bnRpbWUuSW52b2tlUmVxdWVzdC5JbnB1dEVudHJ5GjsKCklucHV0RW50cnkSCwoDa2V5GAEgASgJEhwKBXZhbHVlGAIgASgLMg0uY2FtaW5vLlZhbHVlOgI4ASJKCg5JbnZva2VSZXNwb25zZRIKCgJvaxgBIAEoCBIdCgZyZXN1bHQYAiABKAsyDS5jYW1pbm8uVmFsdWUSDQoFZXJyb3IYAyABKAki1AEKDFdhdGNoUmVxdWVzdBIVCg1pbnZvY2F0aW9uX2lkGAEgASgJEiUKCGZ1bmN0aW9uGAIgASgLMhMucXVpeG9zLkZ1bmN0aW9uUmVmEhEKCW9iamVjdF9pZBgDIAEoCRI2CgVpbnB1dBgEIAMoCzInLnF1aXhvcy5ydW50aW1lLldhdGNoUmVxdWVzd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HZXRJbnZvY2F0aW9uU3RhdHVzEigucXVpeG9zLnJ1bnRpbWUuSW52b2NhdGlvbkNvbnRyb2xSZXF1ZXN0GiAucXVpeG9zLnJ1bnRpbWUuSW52b2NhdGlvblN0YXR1cxJeChBDYW5jZWxJbnZvY2F0aW9uEigucXVpeG9zLnJ1bnRpbWUuSW52b2NhdGlvbkNvbnRyb2xSZXF1ZXN0GiAucXVpeG9zLnJ1bnRpbWUuSW52b2NhdGlvblN0YXR1c2IGcHJvdG8z", [file_camino_api, file_quixos_refs]);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.HandshakeRequest.
|
* Describes the message quixos.runtime.HandshakeRequest.
|
||||||
* Use `create(HandshakeRequestSchema)` to create a new message.
|
* Use `create(HandshakeRequestSchema)` to create a new message.
|
||||||
@@ -18,31 +18,46 @@ export const HandshakeRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runt
|
|||||||
* Use `create(HandshakeResponseSchema)` to create a new message.
|
* Use `create(HandshakeResponseSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const HandshakeResponseSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 1);
|
export const HandshakeResponseSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 1);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationContext.
|
||||||
|
* Use `create(InvocationContextSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationContextSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 2);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationControlRequest.
|
||||||
|
* Use `create(InvocationControlRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationControlRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 3);
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationStatus.
|
||||||
|
* Use `create(InvocationStatusSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationStatusSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 4);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.InvokeRequest.
|
* Describes the message quixos.runtime.InvokeRequest.
|
||||||
* Use `create(InvokeRequestSchema)` to create a new message.
|
* Use `create(InvokeRequestSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const InvokeRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 2);
|
export const InvokeRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 5);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.InvokeResponse.
|
* Describes the message quixos.runtime.InvokeResponse.
|
||||||
* Use `create(InvokeResponseSchema)` to create a new message.
|
* Use `create(InvokeResponseSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const InvokeResponseSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 3);
|
export const InvokeResponseSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 6);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.WatchRequest.
|
* Describes the message quixos.runtime.WatchRequest.
|
||||||
* Use `create(WatchRequestSchema)` to create a new message.
|
* Use `create(WatchRequestSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const WatchRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 4);
|
export const WatchRequestSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 7);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.DerivedDependency.
|
* Describes the message quixos.runtime.DerivedDependency.
|
||||||
* Use `create(DerivedDependencySchema)` to create a new message.
|
* Use `create(DerivedDependencySchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const DerivedDependencySchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 5);
|
export const DerivedDependencySchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 8);
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.runtime.WatchEvent.
|
* Describes the message quixos.runtime.WatchEvent.
|
||||||
* Use `create(WatchEventSchema)` to create a new message.
|
* Use `create(WatchEventSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const WatchEventSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 6);
|
export const WatchEventSchema = /*@__PURE__*/ messageDesc(file_quixos_runtime, 9);
|
||||||
/**
|
/**
|
||||||
* @generated from service quixos.runtime.PackageRuntime
|
* @generated from service quixos.runtime.PackageRuntime
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
declare const referenceBrand: unique symbol;
|
||||||
|
export interface QxObjectRef<Identity extends string = string> {
|
||||||
|
readonly [referenceBrand]: {
|
||||||
|
readonly [K in Identity]: true;
|
||||||
|
};
|
||||||
|
equals(other: QxObjectRef<string>): boolean;
|
||||||
|
}
|
||||||
|
export declare const isObjectReference: (value: unknown) => value is QxObjectRef;
|
||||||
|
/** Internal transport boundary; intentionally not exported from the SDK entry. */
|
||||||
|
export declare const referenceFromWire: (id: string) => QxObjectRef;
|
||||||
|
export declare const referenceToWire: (value: unknown) => string;
|
||||||
|
export declare const assertReferenceFree: (value: unknown, seen?: Set<object>) => void;
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=references.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAC5C,MAAM,WAAW,WAAW,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC3D,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE;QAAE,QAAQ,EAAE,CAAC,IAAI,QAAQ,GAAG,IAAI;KAAE,CAAC;IAC9D,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;CAC7C;AAmBD,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAAK,IAAI,WACU,CAAC;AAEvE,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,OAAQ,MAAM,KAAG,WAG9C,CAAC;AACF,eAAO,MAAM,eAAe,UAAW,OAAO,KAAG,MAGhD,CAAC;AACF,eAAO,MAAM,mBAAmB,UAAW,OAAO,yBAA6B,IAU9E,CAAC"}
|
||||||
Vendored
+46
@@ -0,0 +1,46 @@
|
|||||||
|
/** Opaque runtime identity. The wire codec, never ordinary package state, owns
|
||||||
|
* the raw ID. These handles do not themselves confer authority or a lease. */
|
||||||
|
const identities = new WeakMap();
|
||||||
|
class Reference {
|
||||||
|
constructor(id) {
|
||||||
|
identities.set(this, id);
|
||||||
|
Object.freeze(this);
|
||||||
|
}
|
||||||
|
equals(other) {
|
||||||
|
return isObjectReference(other) && identities.get(this) === identities.get(other);
|
||||||
|
}
|
||||||
|
toJSON() {
|
||||||
|
throw new Error("Object references cannot be serialized into ordinary data");
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
throw new Error("Object references cannot be coerced to strings");
|
||||||
|
}
|
||||||
|
[Symbol.toPrimitive]() {
|
||||||
|
throw new Error("Object references cannot be coerced to scalar values");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const isObjectReference = (value) => typeof value === "object" && value !== null && identities.has(value);
|
||||||
|
/** Internal transport boundary; intentionally not exported from the SDK entry. */
|
||||||
|
export const referenceFromWire = (id) => {
|
||||||
|
if (typeof id !== "string" || !id)
|
||||||
|
throw new Error("Missing object reference identity");
|
||||||
|
return new Reference(id);
|
||||||
|
};
|
||||||
|
export const referenceToWire = (value) => {
|
||||||
|
if (!isObjectReference(value))
|
||||||
|
throw new Error("Expected an opaque object reference, not a raw ID");
|
||||||
|
return identities.get(value);
|
||||||
|
};
|
||||||
|
export const assertReferenceFree = (value, seen = new Set()) => {
|
||||||
|
if (!value || typeof value !== "object")
|
||||||
|
return;
|
||||||
|
if (isObjectReference(value))
|
||||||
|
throw new Error("Managed references belong in declared RPC references or graph relationships, not ordinary state/messages");
|
||||||
|
if (seen.has(value))
|
||||||
|
throw new Error("Cyclic ordinary data");
|
||||||
|
seen.add(value);
|
||||||
|
if (!(value instanceof Uint8Array))
|
||||||
|
for (const child of Object.values(value))
|
||||||
|
assertReferenceFree(child, seen);
|
||||||
|
seen.delete(value);
|
||||||
|
};
|
||||||
Vendored
+30
@@ -0,0 +1,30 @@
|
|||||||
|
import type { QxObjectRef } from "./references.js";
|
||||||
|
import type { RelationshipCollection, RelationshipEntry } from "./index.js";
|
||||||
|
type Key = string | boolean | bigint;
|
||||||
|
type Port<T extends QxObjectRef> = {
|
||||||
|
collection(): Promise<RelationshipCollection<T>>;
|
||||||
|
replace(entries: RelationshipEntry<T>[], expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
};
|
||||||
|
/** Helpers never retry a failed CAS or silently overwrite concurrent edits. */
|
||||||
|
export declare const relationshipMap: <T extends QxObjectRef, K extends Key = Key>(port: Port<T>) => {
|
||||||
|
read: () => Promise<RelationshipCollection<T>>;
|
||||||
|
get(key: K): Promise<{
|
||||||
|
revision: bigint;
|
||||||
|
value: T | undefined;
|
||||||
|
}>;
|
||||||
|
set(key: K, target: T, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
delete(key: K, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
};
|
||||||
|
export declare const relationshipList: <T extends QxObjectRef>(port: Port<T>) => {
|
||||||
|
read: () => Promise<RelationshipCollection<T>>;
|
||||||
|
insert(index: number, target: T, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
move(edgeId: string, index: number, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
delete(edgeId: string, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
};
|
||||||
|
export declare const relationshipSet: <T extends QxObjectRef>(port: Port<T>) => {
|
||||||
|
read: () => Promise<RelationshipCollection<T>>;
|
||||||
|
add(target: T, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
delete(target: T, expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
};
|
||||||
|
export {};
|
||||||
|
//# sourceMappingURL=relationships.d.ts.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../src/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5E,KAAK,GAAG,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AACrC,KAAK,IAAI,CAAC,CAAC,SAAS,WAAW,IAAI;IACjC,UAAU,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;CACxG,CAAC;AAMF,+EAA+E;AAC/E,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,GAAG,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC;IACvF,IAAI;IACE,GAAG,MAAM,CAAC;;;;IAIV,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,MAAM;IAO/C,MAAM,MAAM,CAAC,oBAAoB,MAAM;CAO7C,CAAC;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW,QAAQ,IAAI,CAAC,CAAC,CAAC;IACnE,IAAI;IACE,MAAM,QAAQ,MAAM,UAAU,CAAC,oBAAoB,MAAM;IAOzD,IAAI,SAAS,MAAM,SAAS,MAAM,oBAAoB,MAAM;IAS5D,MAAM,SAAS,MAAM,oBAAoB,MAAM;CAQrD,CAAC;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,QAAQ,IAAI,CAAC,CAAC,CAAC;IAClE,IAAI;IACE,GAAG,SAAS,CAAC,oBAAoB,MAAM;IAKvC,MAAM,SAAS,CAAC,oBAAoB,MAAM;CAOhD,CAAC"}
|
||||||
Vendored
+63
@@ -0,0 +1,63 @@
|
|||||||
|
const checked = async (port, revision) => {
|
||||||
|
const snapshot = await port.collection();
|
||||||
|
if (snapshot.revision !== revision)
|
||||||
|
throw new Error("STALE_COLLECTION_REVISION");
|
||||||
|
return snapshot;
|
||||||
|
};
|
||||||
|
/** Helpers never retry a failed CAS or silently overwrite concurrent edits. */
|
||||||
|
export const relationshipMap = (port) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async get(key) {
|
||||||
|
const snapshot = await port.collection();
|
||||||
|
return { revision: snapshot.revision, value: snapshot.entries.find((entry) => entry.key === key)?.target };
|
||||||
|
},
|
||||||
|
async set(key, target, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
const entries = snapshot.entries.filter((entry) => entry.key !== key);
|
||||||
|
const existing = snapshot.entries.find((entry) => entry.key === key && entry.target.equals(target));
|
||||||
|
entries.push(existing ?? { key, target });
|
||||||
|
return port.replace(entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(key, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
return port.replace(snapshot.entries.filter((entry) => entry.key !== key), expectedRevision);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const relationshipList = (port) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async insert(index, target, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (!Number.isSafeInteger(index) || index < 0 || index > snapshot.entries.length)
|
||||||
|
throw new Error("List index out of bounds");
|
||||||
|
snapshot.entries.splice(index, 0, { target });
|
||||||
|
return port.replace(snapshot.entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async move(edgeId, index, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
const prior = snapshot.entries.findIndex((entry) => entry.edgeId === edgeId);
|
||||||
|
if (prior < 0 || !Number.isSafeInteger(index) || index < 0 || index >= snapshot.entries.length)
|
||||||
|
throw new Error("Unknown list entry or invalid index");
|
||||||
|
const [entry] = snapshot.entries.splice(prior, 1);
|
||||||
|
snapshot.entries.splice(index, 0, entry);
|
||||||
|
return port.replace(snapshot.entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(edgeId, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (!snapshot.entries.some((entry) => entry.edgeId === edgeId))
|
||||||
|
throw new Error("Unknown list entry");
|
||||||
|
return port.replace(snapshot.entries.filter((entry) => entry.edgeId !== edgeId), expectedRevision);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const relationshipSet = (port) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async add(target, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (snapshot.entries.some((entry) => entry.target.equals(target)))
|
||||||
|
return snapshot;
|
||||||
|
return port.replace([...snapshot.entries, { target }], expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(target, expectedRevision) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
return port.replace(snapshot.entries.filter((entry) => !entry.target.equals(target)), expectedRevision);
|
||||||
|
},
|
||||||
|
});
|
||||||
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
import protobuf from "protobufjs";
|
|
||||||
import type { SchemaCompileResult } from "./schema-ir.js";
|
|
||||||
export declare const loadCaminoSchemaRoot: (sourceFile: string) => Promise<{
|
|
||||||
absoluteSourceFile: string;
|
|
||||||
root: protobuf.Root;
|
|
||||||
}>;
|
|
||||||
export declare const compileCaminoSchema: (sourceFile: string) => Promise<SchemaCompileResult>;
|
|
||||||
//# sourceMappingURL=schema-compiler.d.ts.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"schema-compiler.d.ts","sourceRoot":"","sources":["../src/schema-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,EAeV,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AA02BxB,eAAO,MAAM,oBAAoB,GAC/B,YAAY,MAAM,KACjB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAE,CAqC7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,YAAY,MAAM,KACjB,OAAO,CAAC,mBAAmB,CAsC7B,CAAC"}
|
|
||||||
Vendored
-721
@@ -1,721 +0,0 @@
|
|||||||
import fs from "node:fs";
|
|
||||||
import path from "node:path";
|
|
||||||
import protobuf from "protobufjs";
|
|
||||||
const CLASS_OPTION = "(camino.class)";
|
|
||||||
const INTERFACE_OPTION = "(camino.interface)";
|
|
||||||
const IMPLEMENTS_OPTION = "(camino.implements)";
|
|
||||||
const CONSTRUCTOR_OPTION = "(camino.constructor)";
|
|
||||||
const METHOD_OPTION = "(camino.method)";
|
|
||||||
const MIGRATION_OPTION = "(camino.migration)";
|
|
||||||
const CONFLICT_OPTION = "(camino.conflict)";
|
|
||||||
const EDGE_OPTION = "(camino.edge)";
|
|
||||||
const FIELD_STORAGE_OPTION = "(camino.field_storage)";
|
|
||||||
const FIELD_OPS_OPTION = "(camino.field_ops)";
|
|
||||||
const INTERFACE_FIELD_OPTION = "(camino.interface_field)";
|
|
||||||
const DISPLAY_LABEL_OPTION = "(camino.display_label)";
|
|
||||||
const IMPL_OPTION = "(camino.impl)";
|
|
||||||
const SCHEMA_NAMESPACE_OPTION = "(camino.schema_namespace)";
|
|
||||||
const SCHEMA_VERSION_OPTION = "(camino.schema_version)";
|
|
||||||
const enumName = (value) => String(value)
|
|
||||||
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
||||||
.replace(/-/g, "_")
|
|
||||||
.toUpperCase();
|
|
||||||
const lowerEnumName = (value) => enumName(value).toLowerCase();
|
|
||||||
const getOption = (options, name) => {
|
|
||||||
if (!options) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (Object.hasOwn(options, name)) {
|
|
||||||
return options[name];
|
|
||||||
}
|
|
||||||
const bareName = name.replace(/^\((.*)\)$/, "$1");
|
|
||||||
if (Object.hasOwn(options, bareName)) {
|
|
||||||
return options[bareName];
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
const getParsedOptions = (reflection) => {
|
|
||||||
const parsedOptions = reflection
|
|
||||||
.parsedOptions;
|
|
||||||
return Array.isArray(parsedOptions)
|
|
||||||
? parsedOptions.filter((option) => Boolean(option) && typeof option === "object" && !Array.isArray(option))
|
|
||||||
: [];
|
|
||||||
};
|
|
||||||
const getReflectionOptions = (reflection, name) => {
|
|
||||||
const parsedValues = getParsedOptions(reflection).flatMap((option) => {
|
|
||||||
const value = getOption(option, name);
|
|
||||||
return value === undefined ? [] : [value];
|
|
||||||
});
|
|
||||||
if (parsedValues.length > 0) {
|
|
||||||
return parsedValues;
|
|
||||||
}
|
|
||||||
const value = getOption(reflection.options, name);
|
|
||||||
return value === undefined ? [] : [value];
|
|
||||||
};
|
|
||||||
const getReflectionOption = (reflection, name) => getReflectionOptions(reflection, name)[0];
|
|
||||||
const asObject = (value) => value && typeof value === "object" && !Array.isArray(value)
|
|
||||||
? value
|
|
||||||
: undefined;
|
|
||||||
const asArray = (value) => Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
||||||
const readString = (object, key) => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "string" ? value : undefined;
|
|
||||||
};
|
|
||||||
const readNumber = (object, key) => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "number" && Number.isFinite(value)
|
|
||||||
? value
|
|
||||||
: undefined;
|
|
||||||
};
|
|
||||||
const readBoolean = (object, key) => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "boolean" ? value : undefined;
|
|
||||||
};
|
|
||||||
const symbolRefFromOption = (value, fallback) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
namespace: readString(object, "namespace") ?? fallback.namespace,
|
|
||||||
name: readString(object, "name") ?? fallback.name,
|
|
||||||
version: readString(object, "version") ?? fallback.version,
|
|
||||||
...(readString(object, "hash")
|
|
||||||
? { hash: readString(object, "hash") }
|
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const typeRefFromOption = (value, fallbackVersion) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const symbol = asObject(object.symbol)
|
|
||||||
? symbolRefFromOption(object.symbol, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: fallbackVersion,
|
|
||||||
})
|
|
||||||
: undefined;
|
|
||||||
const protoType = readString(object, "proto_type")?.replace(/^\./, "");
|
|
||||||
const symbolProtoType = symbol?.namespace && symbol.name ? `${symbol.namespace}.${symbol.name}` : "";
|
|
||||||
const resolvedProtoType = protoType ?? symbolProtoType;
|
|
||||||
if (!resolvedProtoType) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
protoType: resolvedProtoType,
|
|
||||||
...(symbol?.namespace && symbol.name ? { symbol } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const interfaceFieldContractFromOption = (value, schemaVersion) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const type = typeRefFromOption(object.type, schemaVersion);
|
|
||||||
const refTargetTypeParam = readString(object, "ref_target_type_param");
|
|
||||||
const edgeCardinality = object.edge_cardinality === undefined
|
|
||||||
? undefined
|
|
||||||
: cardinalityFromOption(object.edge_cardinality);
|
|
||||||
return {
|
|
||||||
required: readBoolean(object, "required") ?? false,
|
|
||||||
readable: readBoolean(object, "readable") ?? false,
|
|
||||||
writable: readBoolean(object, "writable") ?? false,
|
|
||||||
watchable: readBoolean(object, "watchable") ?? false,
|
|
||||||
...(readString(object, "type_param")
|
|
||||||
? { typeParam: readString(object, "type_param") }
|
|
||||||
: {}),
|
|
||||||
...(type ? { type } : {}),
|
|
||||||
...(refTargetTypeParam ? { refTargetTypeParam } : {}),
|
|
||||||
...(edgeCardinality ? { edgeCardinality } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const functionRefFromOption = (value) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
throw new Error("Expected function ref option object");
|
|
||||||
}
|
|
||||||
const packageNamespace = readString(object, "package_namespace");
|
|
||||||
const packageName = readString(object, "package_name");
|
|
||||||
const symbol = readString(object, "symbol");
|
|
||||||
if (!packageNamespace || !packageName || !symbol) {
|
|
||||||
throw new Error("Function ref requires package_namespace, package_name, and symbol");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
packageNamespace,
|
|
||||||
packageName,
|
|
||||||
symbol,
|
|
||||||
...(readString(object, "operation")
|
|
||||||
? { operation: readString(object, "operation") }
|
|
||||||
: {}),
|
|
||||||
...(readString(object, "version_ref")
|
|
||||||
? { versionRef: readString(object, "version_ref") }
|
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const conflictFromOption = (value) => {
|
|
||||||
const normalized = enumName(value);
|
|
||||||
if (!value || normalized === "CONFLICT_STRATEGY_UNSPECIFIED") {
|
|
||||||
return "preserve_conflicts";
|
|
||||||
}
|
|
||||||
if (normalized === "REPLACE") {
|
|
||||||
return "replace";
|
|
||||||
}
|
|
||||||
if (normalized === "PRESERVE_CONFLICTS") {
|
|
||||||
return "preserve_conflicts";
|
|
||||||
}
|
|
||||||
if (normalized === "CRDT") {
|
|
||||||
return "crdt";
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino conflict strategy: ${String(value)}`);
|
|
||||||
};
|
|
||||||
const cardinalityFromOption = (value) => {
|
|
||||||
const normalized = lowerEnumName(value);
|
|
||||||
if (!value || normalized === "cardinality_unspecified") {
|
|
||||||
return "many";
|
|
||||||
}
|
|
||||||
if (normalized === "optional_one" ||
|
|
||||||
normalized === "exactly_one" ||
|
|
||||||
normalized === "many" ||
|
|
||||||
normalized === "many_unique" ||
|
|
||||||
normalized === "many_ordered" ||
|
|
||||||
normalized === "many_unique_ordered") {
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino cardinality: ${String(value)}`);
|
|
||||||
};
|
|
||||||
const fieldStorageKindFromOption = (value) => {
|
|
||||||
if (value === 5) {
|
|
||||||
return "static_final";
|
|
||||||
}
|
|
||||||
const normalized = lowerEnumName(value);
|
|
||||||
if (!value || normalized === "field_storage_kind_unspecified") {
|
|
||||||
return "stored";
|
|
||||||
}
|
|
||||||
if (normalized === "stored" ||
|
|
||||||
normalized === "derived" ||
|
|
||||||
normalized === "lazy" ||
|
|
||||||
normalized === "external" ||
|
|
||||||
normalized === "static_final") {
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino field storage kind: ${String(value)}`);
|
|
||||||
};
|
|
||||||
const fieldStorageFromOption = (value) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return {
|
|
||||||
kind: "stored",
|
|
||||||
cache: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const kind = fieldStorageKindFromOption(object.kind);
|
|
||||||
const resolver = object.resolver === undefined
|
|
||||||
? undefined
|
|
||||||
: functionRefFromOption(object.resolver);
|
|
||||||
if ((kind === "derived" || kind === "lazy" || kind === "external") && !resolver) {
|
|
||||||
throw new Error(`${kind} field storage requires resolver`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
kind,
|
|
||||||
...(resolver ? { resolver } : {}),
|
|
||||||
cache: object.cache === true,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const fieldOpsFromOption = (value) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const implementation = enumName(object.implementation);
|
|
||||||
if (implementation !== "SERVICE") {
|
|
||||||
throw new Error(`Unsupported Camino field implementation: ${String(object.implementation)}`);
|
|
||||||
}
|
|
||||||
const service = readString(object, "service");
|
|
||||||
if (!service) {
|
|
||||||
throw new Error("SERVICE field_ops requires service");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
implementation: "service",
|
|
||||||
service,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const extractFileDefaults = (sourceFile) => {
|
|
||||||
const text = fs.readFileSync(sourceFile, "utf8");
|
|
||||||
const packageMatch = /^\s*package\s+([a-zA-Z0-9_.]+)\s*;/m.exec(text);
|
|
||||||
const namespaceMatch = /^\s*option\s+\(camino\.schema_namespace\)\s*=\s*"([^"]+)"\s*;/m.exec(text);
|
|
||||||
const versionMatch = /^\s*option\s+\(camino\.schema_version\)\s*=\s*"([^"]+)"\s*;/m.exec(text);
|
|
||||||
return {
|
|
||||||
packageName: packageMatch?.[1] ?? "",
|
|
||||||
schemaNamespace: namespaceMatch?.[1] ?? packageMatch?.[1] ?? "",
|
|
||||||
schemaVersion: versionMatch?.[1] ?? "1",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const protoSymbolFromReflection = (reflection, fallbackVersion) => {
|
|
||||||
if (!reflection?.fullName) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const parts = reflection.fullName.replace(/^\./, "").split(".");
|
|
||||||
const name = parts.pop();
|
|
||||||
if (!name) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
namespace: parts.join("."),
|
|
||||||
name,
|
|
||||||
version: fallbackVersion,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const typeRefForField = (field, schemaVersion) => {
|
|
||||||
const symbol = protoSymbolFromReflection(field.resolvedType, schemaVersion);
|
|
||||||
const enumValues = field.resolvedType instanceof protobuf.Enum
|
|
||||||
? Object.entries(field.resolvedType.values)
|
|
||||||
.filter(([_name, value]) => value !== 0)
|
|
||||||
.map(([name]) => name)
|
|
||||||
: undefined;
|
|
||||||
return {
|
|
||||||
protoType: field.type,
|
|
||||||
...(symbol ? { symbol } : {}),
|
|
||||||
...(enumValues ? { enumValues } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const typeRefForType = (type, fallbackType, schemaVersion) => {
|
|
||||||
const symbol = protoSymbolFromReflection(type ?? null, schemaVersion);
|
|
||||||
return {
|
|
||||||
protoType: type?.fullName?.replace(/^\./, "") ?? fallbackType,
|
|
||||||
...(symbol ? { symbol } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const fieldSchemaFromField = (field, schemaVersion) => {
|
|
||||||
const storage = fieldStorageFromOption(getReflectionOption(field, FIELD_STORAGE_OPTION));
|
|
||||||
const ops = fieldOpsFromOption(getReflectionOption(field, FIELD_OPS_OPTION));
|
|
||||||
if (ops && storage.kind !== "stored" && storage.kind !== "static_final") {
|
|
||||||
throw new Error(`Field ${field.fullName} cannot declare both field_ops and package-resolved storage`);
|
|
||||||
}
|
|
||||||
if (storage.kind === "static_final" && !ops) {
|
|
||||||
throw new Error(`Field ${field.fullName} with static_final storage requires field_ops`);
|
|
||||||
}
|
|
||||||
const interfaceContract = interfaceFieldContractFromOption(getReflectionOption(field, INTERFACE_FIELD_OPTION), schemaVersion);
|
|
||||||
return {
|
|
||||||
name: field.name,
|
|
||||||
tag: field.id,
|
|
||||||
type: typeRefForField(field, schemaVersion),
|
|
||||||
conflict: conflictFromOption(getReflectionOption(field, CONFLICT_OPTION)),
|
|
||||||
repeated: field.repeated,
|
|
||||||
optional: field.optional,
|
|
||||||
storage,
|
|
||||||
...(ops ? { ops } : {}),
|
|
||||||
...(interfaceContract ? { interfaceContract } : {}),
|
|
||||||
isDisplayLabel: getReflectionOption(field, DISPLAY_LABEL_OPTION) === true,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const isManyCardinality = (cardinality) => cardinality === "many" ||
|
|
||||||
cardinality === "many_unique" ||
|
|
||||||
cardinality === "many_ordered" ||
|
|
||||||
cardinality === "many_unique_ordered";
|
|
||||||
const materializationFromOption = (value, fallbackVersion) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const classRef = symbolRefFromOption(object.class, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: fallbackVersion,
|
|
||||||
});
|
|
||||||
if (!classRef.name) {
|
|
||||||
throw new Error("Edge materialization requires class");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
class: classRef,
|
|
||||||
connectProjection: readString(object, "connect_projection") ?? "",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const endpointFromOption = (params) => {
|
|
||||||
const object = asObject(params.option);
|
|
||||||
const classRef = asObject(object?.class)
|
|
||||||
? symbolRefFromOption(object?.class, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: params.fallbackVersion,
|
|
||||||
})
|
|
||||||
: params.fallbackClass;
|
|
||||||
const interfaceRef = asObject(object?.interface)
|
|
||||||
? symbolRefFromOption(object?.interface, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: params.fallbackVersion,
|
|
||||||
})
|
|
||||||
: undefined;
|
|
||||||
const projection = readString(object, "projection") ?? params.fallbackProjection;
|
|
||||||
const cardinality = object?.cardinality === undefined
|
|
||||||
? params.fallbackCardinality
|
|
||||||
: cardinalityFromOption(object.cardinality);
|
|
||||||
const materialization = materializationFromOption(object?.materialize, params.fallbackVersion);
|
|
||||||
if (!classRef?.name && !interfaceRef?.name) {
|
|
||||||
throw new Error(`Edge endpoint ${projection} requires class or interface`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...(classRef?.name ? { class: classRef } : {}),
|
|
||||||
...(interfaceRef?.name ? { interface: interfaceRef } : {}),
|
|
||||||
projection,
|
|
||||||
cardinality,
|
|
||||||
indexed: readBoolean(object, "indexed") ?? false,
|
|
||||||
...(materialization ? { materialization } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const symbolKey = (ref) => ref ? [ref.namespace, ref.name, ref.version, ref.hash ?? ""].join(":") : "";
|
|
||||||
const endpointRoleKey = (endpoint) => [
|
|
||||||
symbolKey(endpoint.class),
|
|
||||||
symbolKey(endpoint.interface),
|
|
||||||
endpoint.projection,
|
|
||||||
endpoint.cardinality,
|
|
||||||
].join("|");
|
|
||||||
const normalizeEdgeEndpoints = (params) => {
|
|
||||||
if (params.directionality === "directed") {
|
|
||||||
return {
|
|
||||||
fromEndpoint: params.fromEndpoint,
|
|
||||||
toEndpoint: params.toEndpoint,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return endpointRoleKey(params.fromEndpoint) <= endpointRoleKey(params.toEndpoint)
|
|
||||||
? {
|
|
||||||
fromEndpoint: params.fromEndpoint,
|
|
||||||
toEndpoint: params.toEndpoint,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
fromEndpoint: params.toEndpoint,
|
|
||||||
toEndpoint: params.fromEndpoint,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const symbolArrayFromOption = (value, defaults) => asArray(value)
|
|
||||||
.map((item) => symbolRefFromOption(item, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
}))
|
|
||||||
.filter((symbol) => Boolean(symbol.name));
|
|
||||||
const isStringType = (type) => type.protoType === "string" || type.protoType === "google.protobuf.StringValue";
|
|
||||||
const validateDisplayLabelFields = (type, fields, operationServices) => {
|
|
||||||
const displayLabelFields = fields.filter((field) => field.isDisplayLabel);
|
|
||||||
if (displayLabelFields.length > 1) {
|
|
||||||
throw new Error(`Class ${type.fullName} declares multiple Camino display label fields`);
|
|
||||||
}
|
|
||||||
const displayLabelField = displayLabelFields[0];
|
|
||||||
if (!displayLabelField) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!displayLabelField.ops) {
|
|
||||||
if (!isStringType(displayLabelField.type)) {
|
|
||||||
throw new Error(`Display label field ${type.fullName}.${displayLabelField.name} must have string type`);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const serviceName = displayLabelField.ops.service.replace(/^\./, "");
|
|
||||||
const getOperation = operationServices
|
|
||||||
.find((service) => service.fullName === serviceName)
|
|
||||||
?.operations.find((operation) => operation.name === "Get");
|
|
||||||
if (!getOperation || !isStringType(getOperation.outputType)) {
|
|
||||||
throw new Error(`Display label field ${type.fullName}.${displayLabelField.name} must resolve to string`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const typeBindingFromOption = (value, schemaVersion) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const name = readString(object, "name");
|
|
||||||
const type = typeRefFromOption(object.type, schemaVersion);
|
|
||||||
if (!name || !type) {
|
|
||||||
throw new Error("Interface type_binding requires name and type");
|
|
||||||
}
|
|
||||||
return { name, type };
|
|
||||||
};
|
|
||||||
const interfaceImplementationFromOption = (value, defaults) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
throw new Error("Expected implements option object");
|
|
||||||
}
|
|
||||||
const interfaceId = symbolRefFromOption(object.interface, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
if (!interfaceId.name) {
|
|
||||||
throw new Error("implements option requires interface name");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
interface: interfaceId,
|
|
||||||
typeBindings: asArray(object.type_binding)
|
|
||||||
.map((binding) => typeBindingFromOption(binding, defaults.schemaVersion))
|
|
||||||
.filter((binding) => Boolean(binding)),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const serviceName = (service) => service.fullName.replace(/^\./, "");
|
|
||||||
const operationFromMethod = (method, schemaVersion) => {
|
|
||||||
const fn = functionRefFromOption(getReflectionOption(method, IMPL_OPTION));
|
|
||||||
const methodWithTypes = method;
|
|
||||||
return {
|
|
||||||
name: method.name,
|
|
||||||
inputType: typeRefForType(methodWithTypes.resolvedRequestType, method.requestType, schemaVersion),
|
|
||||||
outputType: typeRefForType(methodWithTypes.resolvedResponseType, method.responseType, schemaVersion),
|
|
||||||
function: fn,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const operationServiceFromService = (service, schemaVersion) => ({
|
|
||||||
name: service.name,
|
|
||||||
fullName: serviceName(service),
|
|
||||||
operations: service.methodsArray.map((method) => operationFromMethod(method, schemaVersion)),
|
|
||||||
});
|
|
||||||
const classSchemaFromType = (type, sourceFile, defaults, operationServices) => {
|
|
||||||
const classOption = asObject(getReflectionOption(type, CLASS_OPTION));
|
|
||||||
if (!classOption) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const fallbackClassRef = {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: type.name,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
};
|
|
||||||
const classId = symbolRefFromOption(classOption.id, fallbackClassRef);
|
|
||||||
const classVersion = readNumber(classOption, "version") ?? Number(classId.version);
|
|
||||||
if (!Number.isInteger(classVersion) || classVersion <= 0) {
|
|
||||||
throw new Error(`Class ${type.fullName} has invalid Camino class version`);
|
|
||||||
}
|
|
||||||
const fields = type.fieldsArray.map((field) => fieldSchemaFromField(field, defaults.schemaVersion));
|
|
||||||
validateDisplayLabelFields(type, fields, operationServices);
|
|
||||||
const edges = type.fieldsArray.flatMap((field) => {
|
|
||||||
const edgeOption = asObject(getReflectionOption(field, EDGE_OPTION));
|
|
||||||
if (!edgeOption) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const legacyTargetClass = symbolRefFromOption(edgeOption.target, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const cardinality = cardinalityFromOption(edgeOption.cardinality);
|
|
||||||
const declaredFromEndpoint = endpointFromOption({
|
|
||||||
option: edgeOption.this_endpoint,
|
|
||||||
fallbackClass: classId,
|
|
||||||
fallbackProjection: field.name,
|
|
||||||
fallbackCardinality: cardinality,
|
|
||||||
fallbackVersion: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const declaredToEndpoint = endpointFromOption({
|
|
||||||
option: edgeOption.other_endpoint,
|
|
||||||
fallbackClass: legacyTargetClass.name ? legacyTargetClass : undefined,
|
|
||||||
fallbackProjection: readString(edgeOption, "inverse") ?? "",
|
|
||||||
fallbackCardinality: "many",
|
|
||||||
fallbackVersion: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
if (!declaredToEndpoint.projection) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`);
|
|
||||||
}
|
|
||||||
const sourceType = typeRefForField(field, defaults.schemaVersion);
|
|
||||||
if (sourceType.symbol?.namespace !== "camino" ||
|
|
||||||
sourceType.symbol.name !== "Ref") {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
|
||||||
}
|
|
||||||
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
|
||||||
if (isMany && !field.repeated) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must be repeated for ${declaredFromEndpoint.cardinality}`);
|
|
||||||
}
|
|
||||||
if (!isMany && field.repeated) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must not be repeated for ${declaredFromEndpoint.cardinality}`);
|
|
||||||
}
|
|
||||||
const directionality = edgeOption.undirected === true ? "undirected" : "directed";
|
|
||||||
const { fromEndpoint, toEndpoint } = normalizeEdgeEndpoints({
|
|
||||||
directionality,
|
|
||||||
fromEndpoint: declaredFromEndpoint,
|
|
||||||
toEndpoint: declaredToEndpoint,
|
|
||||||
});
|
|
||||||
const edgeId = symbolRefFromOption(edgeOption.id, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: `${type.name}.${field.name}`,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const fallbackToClass = toEndpoint.class ?? {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: "",
|
|
||||||
};
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
id: edgeId,
|
|
||||||
directionality,
|
|
||||||
sourceField: fromEndpoint.projection,
|
|
||||||
fromClass: fromEndpoint.class ?? classId,
|
|
||||||
toClass: fallbackToClass,
|
|
||||||
cardinality: fromEndpoint.cardinality,
|
|
||||||
...(toEndpoint.projection
|
|
||||||
? { inverse: toEndpoint.projection }
|
|
||||||
: {}),
|
|
||||||
fields: [],
|
|
||||||
fromEndpoint,
|
|
||||||
toEndpoint,
|
|
||||||
declaringClass: classId,
|
|
||||||
tags: symbolArrayFromOption(edgeOption.tag, defaults),
|
|
||||||
implements: symbolArrayFromOption(edgeOption.implements, defaults),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
|
||||||
const methods = getReflectionOptions(type, METHOD_OPTION)
|
|
||||||
.map(asObject)
|
|
||||||
.filter((option) => Boolean(option))
|
|
||||||
.map((option) => {
|
|
||||||
const name = readString(option, "name");
|
|
||||||
if (!name) {
|
|
||||||
throw new Error(`Method option on ${type.fullName} requires name`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
function: functionRefFromOption(option.function),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const migrations = getReflectionOptions(type, MIGRATION_OPTION)
|
|
||||||
.map(asObject)
|
|
||||||
.filter((option) => Boolean(option))
|
|
||||||
.map((option) => {
|
|
||||||
const fromVersion = readNumber(option, "from_version");
|
|
||||||
const toVersion = readNumber(option, "to_version");
|
|
||||||
if (!fromVersion || !toVersion) {
|
|
||||||
throw new Error(`Migration option on ${type.fullName} requires versions`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
fromVersion,
|
|
||||||
toVersion,
|
|
||||||
function: functionRefFromOption(option.function),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const constructorOption = asObject(getReflectionOption(type, CONSTRUCTOR_OPTION));
|
|
||||||
const constructorSpec = constructorOption
|
|
||||||
? { function: functionRefFromOption(constructorOption.function) }
|
|
||||||
: undefined;
|
|
||||||
return {
|
|
||||||
id: classId,
|
|
||||||
version: classVersion,
|
|
||||||
fields,
|
|
||||||
edges,
|
|
||||||
methods,
|
|
||||||
migrations,
|
|
||||||
operationServices,
|
|
||||||
implements: getReflectionOptions(type, IMPLEMENTS_OPTION).map((option) => interfaceImplementationFromOption(option, defaults)),
|
|
||||||
...(constructorSpec ? { constructorSpec } : {}),
|
|
||||||
sourceFile,
|
|
||||||
protoMessage: type.fullName,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const interfaceSchemaFromType = (type, sourceFile, defaults) => {
|
|
||||||
const interfaceOption = asObject(getReflectionOption(type, INTERFACE_OPTION));
|
|
||||||
if (!interfaceOption) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const classOption = asObject(getReflectionOption(type, CLASS_OPTION));
|
|
||||||
if (classOption) {
|
|
||||||
throw new Error(`${type.fullName} cannot be both a Camino class and interface`);
|
|
||||||
}
|
|
||||||
const fallbackInterfaceRef = {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: type.name,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
};
|
|
||||||
const interfaceId = symbolRefFromOption(interfaceOption.id, fallbackInterfaceRef);
|
|
||||||
const interfaceVersion = readNumber(interfaceOption, "version") ?? Number(interfaceId.version);
|
|
||||||
if (!Number.isInteger(interfaceVersion) || interfaceVersion <= 0) {
|
|
||||||
throw new Error(`Interface ${type.fullName} has invalid Camino interface version`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id: interfaceId,
|
|
||||||
version: interfaceVersion,
|
|
||||||
fields: type.fieldsArray.map((field) => fieldSchemaFromField(field, defaults.schemaVersion)),
|
|
||||||
sourceFile,
|
|
||||||
protoMessage: type.fullName,
|
|
||||||
typeParameters: asArray(interfaceOption.type_parameter)
|
|
||||||
.map((entry) => String(entry).trim())
|
|
||||||
.filter(Boolean),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const walkTypes = (namespace, visit) => {
|
|
||||||
for (const nested of namespace.nestedArray) {
|
|
||||||
if (nested instanceof protobuf.Type) {
|
|
||||||
visit(nested);
|
|
||||||
walkTypes(nested, visit);
|
|
||||||
}
|
|
||||||
else if (nested instanceof protobuf.Namespace) {
|
|
||||||
walkTypes(nested, visit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const walkServices = (namespace, visit) => {
|
|
||||||
for (const nested of namespace.nestedArray) {
|
|
||||||
if (nested instanceof protobuf.Service) {
|
|
||||||
visit(nested);
|
|
||||||
}
|
|
||||||
else if (nested instanceof protobuf.Namespace) {
|
|
||||||
walkServices(nested, visit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export const loadCaminoSchemaRoot = async (sourceFile) => {
|
|
||||||
const absoluteSourceFile = path.resolve(sourceFile);
|
|
||||||
const root = new protobuf.Root();
|
|
||||||
const envIncludeDirs = [
|
|
||||||
process.env.QUIXOS_PROTO_PATH,
|
|
||||||
process.env.CAMINO_PROTO_PATH,
|
|
||||||
]
|
|
||||||
.filter((value) => Boolean(value))
|
|
||||||
.join(path.delimiter)
|
|
||||||
.split(path.delimiter)
|
|
||||||
.map((entry) => entry.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((entry) => path.resolve(entry));
|
|
||||||
const includeDirs = [
|
|
||||||
path.dirname(absoluteSourceFile),
|
|
||||||
path.resolve("../../quixos-protocol/proto"),
|
|
||||||
path.resolve("quixos-protocol/proto"),
|
|
||||||
path.resolve("proto"),
|
|
||||||
...envIncludeDirs,
|
|
||||||
];
|
|
||||||
root.resolvePath = (origin, target) => {
|
|
||||||
if (path.isAbsolute(target) && fs.existsSync(target)) {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
const originDir = origin ? path.dirname(origin) : undefined;
|
|
||||||
const candidates = [
|
|
||||||
...(originDir ? [path.resolve(originDir, target)] : []),
|
|
||||||
...includeDirs.map((dir) => path.resolve(dir, target)),
|
|
||||||
];
|
|
||||||
const found = candidates.find((candidate) => fs.existsSync(candidate));
|
|
||||||
return found ?? target;
|
|
||||||
};
|
|
||||||
await root.load(absoluteSourceFile, { keepCase: true });
|
|
||||||
root.resolveAll();
|
|
||||||
return { absoluteSourceFile, root };
|
|
||||||
};
|
|
||||||
export const compileCaminoSchema = async (sourceFile) => {
|
|
||||||
const { absoluteSourceFile, root } = await loadCaminoSchemaRoot(sourceFile);
|
|
||||||
const defaults = extractFileDefaults(absoluteSourceFile);
|
|
||||||
const operationServices = [];
|
|
||||||
walkServices(root, (service) => {
|
|
||||||
operationServices.push(operationServiceFromService(service, defaults.schemaVersion));
|
|
||||||
});
|
|
||||||
const classes = [];
|
|
||||||
const interfaces = [];
|
|
||||||
walkTypes(root, (type) => {
|
|
||||||
const interfaceSchema = interfaceSchemaFromType(type, absoluteSourceFile, defaults);
|
|
||||||
if (interfaceSchema) {
|
|
||||||
interfaces.push(interfaceSchema);
|
|
||||||
}
|
|
||||||
const classSchema = classSchemaFromType(type, absoluteSourceFile, defaults, operationServices);
|
|
||||||
if (classSchema) {
|
|
||||||
classes.push(classSchema);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
sourceFile: absoluteSourceFile,
|
|
||||||
classes,
|
|
||||||
interfaces,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
Vendored
-138
@@ -1,138 +0,0 @@
|
|||||||
export type SymbolRef = {
|
|
||||||
namespace: string;
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
hash?: string;
|
|
||||||
};
|
|
||||||
export type FunctionRef = {
|
|
||||||
packageNamespace: string;
|
|
||||||
packageName: string;
|
|
||||||
symbol: string;
|
|
||||||
operation?: string;
|
|
||||||
versionRef?: string;
|
|
||||||
};
|
|
||||||
export type ConflictStrategy = "replace" | "preserve_conflicts" | "crdt";
|
|
||||||
export type Cardinality = "optional_one" | "exactly_one" | "many" | "many_unique" | "many_ordered" | "many_unique_ordered";
|
|
||||||
export type EdgeDirectionality = "directed" | "undirected";
|
|
||||||
export type EdgeMaterialization = {
|
|
||||||
class: SymbolRef;
|
|
||||||
connectProjection: string;
|
|
||||||
};
|
|
||||||
export type FieldStorageKind = "stored" | "derived" | "lazy" | "external" | "static_final";
|
|
||||||
export type FieldStorage = {
|
|
||||||
kind: FieldStorageKind;
|
|
||||||
resolver?: FunctionRef;
|
|
||||||
cache: boolean;
|
|
||||||
};
|
|
||||||
export type FieldOps = {
|
|
||||||
implementation: "service";
|
|
||||||
service: string;
|
|
||||||
};
|
|
||||||
export type TypeRef = {
|
|
||||||
protoType: string;
|
|
||||||
symbol?: SymbolRef;
|
|
||||||
enumValues?: string[];
|
|
||||||
};
|
|
||||||
export type TypeBinding = {
|
|
||||||
name: string;
|
|
||||||
type: TypeRef;
|
|
||||||
};
|
|
||||||
export type InterfaceFieldContract = {
|
|
||||||
required: boolean;
|
|
||||||
readable: boolean;
|
|
||||||
writable: boolean;
|
|
||||||
watchable: boolean;
|
|
||||||
typeParam?: string;
|
|
||||||
type?: TypeRef;
|
|
||||||
refTargetTypeParam?: string;
|
|
||||||
edgeCardinality?: Cardinality;
|
|
||||||
};
|
|
||||||
export type InterfaceImplementation = {
|
|
||||||
interface: SymbolRef;
|
|
||||||
typeBindings: TypeBinding[];
|
|
||||||
};
|
|
||||||
export type FieldSchema = {
|
|
||||||
name: string;
|
|
||||||
tag: number;
|
|
||||||
type: TypeRef;
|
|
||||||
conflict: ConflictStrategy;
|
|
||||||
repeated: boolean;
|
|
||||||
optional: boolean;
|
|
||||||
storage: FieldStorage;
|
|
||||||
ops?: FieldOps;
|
|
||||||
interfaceContract?: InterfaceFieldContract;
|
|
||||||
isDisplayLabel: boolean;
|
|
||||||
};
|
|
||||||
export type EdgeEndpointSchema = {
|
|
||||||
class?: SymbolRef;
|
|
||||||
interface?: SymbolRef;
|
|
||||||
projection: string;
|
|
||||||
cardinality: Cardinality;
|
|
||||||
indexed: boolean;
|
|
||||||
materialization?: EdgeMaterialization;
|
|
||||||
};
|
|
||||||
export type EdgeSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
directionality: EdgeDirectionality;
|
|
||||||
sourceField: string;
|
|
||||||
fromClass: SymbolRef;
|
|
||||||
toClass: SymbolRef;
|
|
||||||
cardinality: Cardinality;
|
|
||||||
inverse?: string;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
fromEndpoint: EdgeEndpointSchema;
|
|
||||||
toEndpoint: EdgeEndpointSchema;
|
|
||||||
declaringClass: SymbolRef;
|
|
||||||
tags: SymbolRef[];
|
|
||||||
implements: SymbolRef[];
|
|
||||||
};
|
|
||||||
export type MethodSchema = {
|
|
||||||
name: string;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
export type MigrationSpec = {
|
|
||||||
fromVersion: number;
|
|
||||||
toVersion: number;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
export type ConstructorSpec = {
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
export type OperationSchema = {
|
|
||||||
name: string;
|
|
||||||
inputType: TypeRef;
|
|
||||||
outputType: TypeRef;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
export type OperationServiceSchema = {
|
|
||||||
name: string;
|
|
||||||
fullName: string;
|
|
||||||
operations: OperationSchema[];
|
|
||||||
};
|
|
||||||
export type ClassSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
version: number;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
edges: EdgeSchema[];
|
|
||||||
methods: MethodSchema[];
|
|
||||||
migrations: MigrationSpec[];
|
|
||||||
operationServices: OperationServiceSchema[];
|
|
||||||
implements: InterfaceImplementation[];
|
|
||||||
constructorSpec?: ConstructorSpec;
|
|
||||||
sourceFile: string;
|
|
||||||
protoMessage: string;
|
|
||||||
};
|
|
||||||
export type InterfaceSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
version: number;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
sourceFile: string;
|
|
||||||
protoMessage: string;
|
|
||||||
typeParameters: string[];
|
|
||||||
};
|
|
||||||
export type SchemaCompileResult = {
|
|
||||||
sourceFile: string;
|
|
||||||
classes: ClassSchema[];
|
|
||||||
interfaces: InterfaceSchema[];
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=schema-ir.d.ts.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"schema-ir.d.ts","sourceRoot":"","sources":["../src/schema-ir.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,oBAAoB,GACpB,MAAM,CAAC;AAEX,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,aAAa,GACb,MAAM,GACN,aAAa,GACb,cAAc,GACd,qBAAqB,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,SAAS,CAAC;IACjB,iBAAi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_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784395768,
|
"lastModified": 1789723189,
|
||||||
"narHash": "sha256-g03xOnzJHiL/edNV6nqURtaPqiapq2uCm7wQTZh4b5s=",
|
"narHash": "sha256-IsiBSkuu/d2IgASVi4S1ZdKk1mTglS+HMJWrNYQohJM=",
|
||||||
"ref": "refs/heads/exported",
|
"ref": "refs/tags/quixos-reachability/b0d31ba51c4c1c49ec2ba715c99e5f5327505d01",
|
||||||
"rev": "e6b34535afa6e94a118e1f9d082054855e7df632",
|
"rev": "b0d31ba51c4c1c49ec2ba715c99e5f5327505d01",
|
||||||
"revCount": 24,
|
"revCount": 92,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git"
|
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"ref": "refs/heads/exported",
|
"ref": "refs/tags/quixos-reachability/b0d31ba51c4c1c49ec2ba715c99e5f5327505d01",
|
||||||
"rev": "e6b34535afa6e94a118e1f9d082054855e7df632",
|
"rev": "b0d31ba51c4c1c49ec2ba715c99e5f5327505d01",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git"
|
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git"
|
||||||
}
|
}
|
||||||
@@ -92,17 +92,17 @@
|
|||||||
"quixosNixHelpers": {
|
"quixosNixHelpers": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1783914102,
|
"lastModified": 1788574090,
|
||||||
"narHash": "sha256-A9EnXxKaODNrSUpw1IlUBR8fe4px5I+wNJFUFGbZY7c=",
|
"narHash": "sha256-bSgc0LS2Ub01fnE14VqazdZzFuVPl4sykmA2d1l4kDs=",
|
||||||
"ref": "refs/heads/exported",
|
"ref": "refs/tags/quixos-reachability/7177130c0365f2fa58ea4877366e1c5d17db4c01",
|
||||||
"rev": "1f0c39b01501d646fe97dfc6e5777ccab0bde2f1",
|
"rev": "7177130c0365f2fa58ea4877366e1c5d17db4c01",
|
||||||
"revCount": 6,
|
"revCount": 4,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"ref": "refs/heads/exported",
|
"ref": "refs/tags/quixos-reachability/7177130c0365f2fa58ea4877366e1c5d17db4c01",
|
||||||
"rev": "1f0c39b01501d646fe97dfc6e5777ccab0bde2f1",
|
"rev": "7177130c0365f2fa58ea4877366e1c5d17db4c01",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
"url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,33 +4,72 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
quixos-protocol.url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git?ref=refs/heads/exported&rev=e6b34535afa6e94a118e1f9d082054855e7df632";
|
quixos-protocol.url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-protocol.git?ref=refs/tags/quixos-reachability/b0d31ba51c4c1c49ec2ba715c99e5f5327505d01&rev=b0d31ba51c4c1c49ec2ba715c99e5f5327505d01";
|
||||||
quixosNixHelpers = {
|
quixosNixHelpers = {
|
||||||
url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?ref=refs/heads/exported&rev=1f0c39b01501d646fe97dfc6e5777ccab0bde2f1";
|
url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?ref=refs/tags/quixos-reachability/7177130c0365f2fa58ea4877366e1c5d17db4c01&rev=7177130c0365f2fa58ea4877366e1c5d17db4c01";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ nixpkgs, flake-utils, quixosNixHelpers, ... }:
|
outputs =
|
||||||
|
inputs@{
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
quixosNixHelpers,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
quixosHelpers = import "${quixosNixHelpers}/quixos-package-helpers.nix";
|
quixosHelpers = import "${quixosNixHelpers}/quixos-package-helpers.nix";
|
||||||
in
|
packageOutputs = quixosHelpers.mkCaminoTsYarnNixifyFlake {
|
||||||
quixosHelpers.mkCaminoTsYarnNixifyFlake {
|
inherit inputs nixpkgs flake-utils;
|
||||||
inherit inputs nixpkgs flake-utils;
|
packageRoot = ./.;
|
||||||
packageRoot = ./.;
|
sourceName = "quixos-camino-package-runtime-source";
|
||||||
sourceName = "quixos-camino-package-runtime-source";
|
promptName = "camino-package-runtime";
|
||||||
promptName = "camino-package-runtime";
|
nativeBuildInputs = { pkgs, ... }: [
|
||||||
nativeBuildInputs = { pkgs, ... }: [
|
pkgs.protobuf
|
||||||
pkgs.protobuf
|
];
|
||||||
];
|
buildEnv =
|
||||||
buildEnv = { inputs, pkgs, system }: {
|
{
|
||||||
QUIXOS_PROTO_PATH = "${pkgs.protobuf}/include:${inputs.quixos-protocol.packages.${system}.default}/proto";
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
QUIXOS_PROTO_PATH = "${pkgs.protobuf}/include:${
|
||||||
|
inputs.quixos-protocol.packages.${system}.default
|
||||||
|
}/proto";
|
||||||
|
};
|
||||||
|
devShellPackages = { pkgs, ... }: [
|
||||||
|
pkgs.protobuf
|
||||||
|
];
|
||||||
|
devShellHook =
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
''
|
||||||
|
export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:${
|
||||||
|
inputs.quixos-protocol.packages.${system}.default
|
||||||
|
}/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
devShellPackages = { pkgs, ... }: [
|
in
|
||||||
pkgs.protobuf
|
packageOutputs
|
||||||
];
|
// flake-utils.lib.eachDefaultSystem (
|
||||||
devShellHook = { inputs, pkgs, system, ... }: ''
|
system:
|
||||||
export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:${inputs.quixos-protocol.packages.${system}.default}/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}"
|
let
|
||||||
'';
|
pkgs = import nixpkgs { inherit system; };
|
||||||
};
|
builtPackage = packageOutputs.packages.${system}.default;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
checks.dist-current = pkgs.runCommand "camino-package-runtime-dist-current" { } ''
|
||||||
|
diff --recursive --unified \
|
||||||
|
${./dist} \
|
||||||
|
${builtPackage}/libexec/-quixos-camino-package-runtime/dist
|
||||||
|
touch "$out"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-12
@@ -2,13 +2,10 @@
|
|||||||
"name": "@quixos/camino-package-runtime",
|
"name": "@quixos/camino-package-runtime",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "yarn@4.14.1",
|
"packageManager": "yarn@4.18.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"bin": {
|
|
||||||
"camino-codegen-ts-runtime": "dist/codegen-ts-runtime.js"
|
|
||||||
},
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
@@ -16,21 +13,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn generate && tsc -p tsconfig.json",
|
"build": "rm -rf dist && yarn generate && tsc -p tsconfig.json",
|
||||||
"generate": "rm -rf src/camino src/quixos && protoc --es_out=src --es_opt=target=ts,import_extension=js --proto_path=$QUIXOS_PROTO_PATH quixos/refs.proto quixos/runtime.proto camino/schema.proto camino/api.proto",
|
"generate": "rm -rf src/camino src/quixos && protoc --experimental_allow_proto3_optional --es_out=src --es_opt=target=ts,import_extension=js --proto_path=$QUIXOS_PROTO_PATH quixos/refs.proto quixos/runtime.proto quixos/orch.proto quixos/package.proto camino/schema.proto camino/api.proto",
|
||||||
"typecheck": "yarn generate && tsc --noEmit"
|
"typecheck": "yarn generate && tsc --noEmit",
|
||||||
|
"test": "yarn build && node --test test/*.test.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automerge/automerge": "^3.3.0",
|
|
||||||
"@bufbuild/protobuf": "^2.12.1",
|
"@bufbuild/protobuf": "^2.12.1",
|
||||||
"@connectrpc/connect": "^2.1.2",
|
"@connectrpc/connect": "^2.1.2",
|
||||||
"@connectrpc/connect-node": "^2.1.2",
|
"@connectrpc/connect-node": "^2.1.2"
|
||||||
"@quixos/camino-datatypes": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-datatypes.git#commit=70f9f45eb7ca23643f1b8220a203d7b3b7aa5bf4",
|
|
||||||
"protobufjs": "^7.5.4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bufbuild/protoc-gen-es": "^2.12.1",
|
"@bufbuild/protoc-gen-es": "^2.12.1",
|
||||||
"@types/node": "^24",
|
"@types/node": "^24",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^7.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+325
@@ -0,0 +1,325 @@
|
|||||||
|
import { create } from "@bufbuild/protobuf";
|
||||||
|
import { ValueSchema, ObjectValueSchema, type Value } from "./camino/api_pb.js";
|
||||||
|
import {
|
||||||
|
derived,
|
||||||
|
jsToProtoValue,
|
||||||
|
liveValue,
|
||||||
|
protoValueToJs,
|
||||||
|
type RuntimeContext,
|
||||||
|
type RuntimeHandler,
|
||||||
|
type DerivedHandler,
|
||||||
|
} from "./index.js";
|
||||||
|
|
||||||
|
export type { QxObjectRef } from "./references.js";
|
||||||
|
import { assertReferenceFree, referenceToWire } from "./references.js";
|
||||||
|
import { decodeQuerySnapshot } from "./queries.js";
|
||||||
|
declare const watchBrand: unique symbol;
|
||||||
|
export type QxWatchHandle = string & { readonly [watchBrand]: true };
|
||||||
|
export type MessageBinding<T> = { encode(value: T): Value; decode(value: Value): T };
|
||||||
|
export type QxLiveValue = ReturnType<typeof liveValue>;
|
||||||
|
export type BindingValue<B> = B extends MessageBinding<infer T> ? T : never;
|
||||||
|
export type QxHandler<C, O> = (context: C) => O | Promise<O>;
|
||||||
|
export type QxDerived<C, O> = { kind: "derived"; get: QxHandler<C, O> };
|
||||||
|
export type QxSession<C> = { id: string; run<T>(work: (context: C) => Promise<T>): Promise<T>; close(): Promise<void> };
|
||||||
|
export type QxContextLifecycle<C> = { signal?: AbortSignal; openSession?: () => Promise<QxSession<C>> };
|
||||||
|
declare const contractView: unique symbol;
|
||||||
|
/** Generated exact closed contract. A descriptor is type evidence, never authority. */
|
||||||
|
export type QxInterfaceContract<View> = {
|
||||||
|
readonly interfaceRevisionId: string;
|
||||||
|
readonly operations: Record<string, QxOperationSpec>;
|
||||||
|
readonly [contractView]: (value: View) => View;
|
||||||
|
};
|
||||||
|
export const defineQxInterfaceContract = <View>(
|
||||||
|
interfaceRevisionId: string,
|
||||||
|
operations: Record<string, QxOperationSpec>,
|
||||||
|
): QxInterfaceContract<View> => Object.freeze({ interfaceRevisionId, operations }) as QxInterfaceContract<View>;
|
||||||
|
export type QxConformer = {
|
||||||
|
tryConform<View>(
|
||||||
|
object: import("./references.js").QxObjectRef,
|
||||||
|
contract: QxInterfaceContract<View>,
|
||||||
|
): Promise<View | undefined>;
|
||||||
|
};
|
||||||
|
export const qxDerived = <C, O>(get: QxHandler<C, O>): QxDerived<C, O> => ({ kind: "derived", get });
|
||||||
|
|
||||||
|
/** Versioned binding ABI. This mirrors the language-neutral value IR. */
|
||||||
|
export type QxValueType =
|
||||||
|
| { kind: "builtin"; name: "unit" | "watch-handle" }
|
||||||
|
| { kind: "scalar"; name: string }
|
||||||
|
| { kind: "message"; descriptorId: string }
|
||||||
|
| { kind: "record"; fields: Record<string, QxValueType> }
|
||||||
|
| { kind: "object-ref"; expectation: unknown }
|
||||||
|
| { kind: "optional" | "list"; value: QxValueType };
|
||||||
|
export type QxOperationSpec = { id: string; inputType: QxValueType; outputType: QxValueType };
|
||||||
|
export type QxPortSpec =
|
||||||
|
| { kind: "query"; id: string; definitionDigest: string; variables: QxValueType; output: QxValueType; watch: boolean }
|
||||||
|
| { kind: "state"; id: string; valueType: QxValueType; primitives: string[] }
|
||||||
|
| { kind: "edge"; id: string; primitives: string[] }
|
||||||
|
| { kind: "interface"; id: string; interfaceRevisionId: string; operations: Record<string, QxOperationSpec> }
|
||||||
|
| { kind: "constructor"; id: string; inputType: QxValueType };
|
||||||
|
export type QxHandlerSpec = {
|
||||||
|
receiver?: "none";
|
||||||
|
inputType: QxValueType;
|
||||||
|
outputType: QxValueType;
|
||||||
|
eventType?: QxValueType;
|
||||||
|
ports: Record<string, QxPortSpec>;
|
||||||
|
};
|
||||||
|
export type QxMessages = Record<string, MessageBinding<any>>;
|
||||||
|
|
||||||
|
const bindInterfaceView = (
|
||||||
|
target: import("./index.js").InterfacePort,
|
||||||
|
contract: QxInterfaceContract<unknown>,
|
||||||
|
messages: QxMessages,
|
||||||
|
) => ({
|
||||||
|
objectId: target.objectId,
|
||||||
|
contract,
|
||||||
|
live: Object.fromEntries(
|
||||||
|
Object.entries(contract.operations).map(([name, operation]) => [
|
||||||
|
name,
|
||||||
|
(input: unknown) => target.live(operation.id, inputFields(operation.inputType, input, messages)),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
...Object.fromEntries(
|
||||||
|
Object.entries(contract.operations).map(([name, operation]) => [
|
||||||
|
name,
|
||||||
|
async (input: unknown) =>
|
||||||
|
decodeQxValue(
|
||||||
|
operation.outputType,
|
||||||
|
(await target.live(operation.id, inputFields(operation.inputType, input, messages))).$quixosValue,
|
||||||
|
messages,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Conversion belongs at the binding boundary. It does not add orchestrator validation.
|
||||||
|
export const decodeQxValue = (type: QxValueType, value: Value | undefined, messages: QxMessages): any => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit") return null;
|
||||||
|
if (type.kind === "optional" && !value) return null;
|
||||||
|
if (!value) throw new Error("Missing QX wire value");
|
||||||
|
if (type.kind === "record") {
|
||||||
|
if (value.kind.case !== "objectValue") throw new Error("Expected QX record");
|
||||||
|
const fields = value.kind.value.fields;
|
||||||
|
if (Object.keys(fields).some((name) => !Object.hasOwn(type.fields, name)))
|
||||||
|
throw new Error("Unexpected QX record field");
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(type.fields).map(([name, field]) => [name, decodeQxValue(field, fields[name], messages)]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (type.kind === "optional")
|
||||||
|
return value.kind.case === "nullValue" ? null : decodeQxValue(type.value, value, messages);
|
||||||
|
if (type.kind === "list") {
|
||||||
|
if (value.kind.case !== "listValue") throw new Error("Expected QX list");
|
||||||
|
return value.kind.value.values.map((entry) => decodeQxValue(type.value, entry, messages));
|
||||||
|
}
|
||||||
|
if (type.kind === "message") {
|
||||||
|
assertReferenceFree(protoValueToJs(value));
|
||||||
|
const decoded = requireMessage(messages, type.descriptorId).decode(value);
|
||||||
|
assertReferenceFree(decoded);
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
if (type.kind === "object-ref") {
|
||||||
|
if (value.kind.case !== "refValue") throw new Error("Expected a declared RPC object reference");
|
||||||
|
return protoValueToJs(value);
|
||||||
|
}
|
||||||
|
if (value.kind.case === "refValue") throw new Error("Reference supplied to a non-reference value");
|
||||||
|
if (type.kind === "scalar") {
|
||||||
|
if (type.name === "int64" || type.name === "uint64") {
|
||||||
|
if (value.kind.case !== "integerValue") throw new Error("Expected QX integer");
|
||||||
|
return BigInt(value.kind.value);
|
||||||
|
}
|
||||||
|
if (type.name === "bytes") {
|
||||||
|
if (value.kind.case !== "bytesValue") throw new Error("Expected QX bytes");
|
||||||
|
return value.kind.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return protoValueToJs(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const requireMessage = (messages: QxMessages, id: string) => {
|
||||||
|
const binding = messages[id];
|
||||||
|
if (!binding) throw new Error(`Missing message binding ${id}`);
|
||||||
|
return binding;
|
||||||
|
};
|
||||||
|
export const encodeQxValue = (type: QxValueType, value: any, messages: QxMessages): Value => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit") return jsToProtoValue(null);
|
||||||
|
if (type.kind === "record") {
|
||||||
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Expected QX record");
|
||||||
|
if (Object.keys(value).some((name) => !Object.hasOwn(type.fields, name)))
|
||||||
|
throw new Error("Unexpected QX record field");
|
||||||
|
const fields = Object.fromEntries(
|
||||||
|
Object.entries(type.fields).map(([name, field]) => {
|
||||||
|
if (!Object.hasOwn(value, name) && field.kind !== "optional")
|
||||||
|
throw new Error(`Missing QX record field ${name}`);
|
||||||
|
return [name, encodeQxValue(field, value[name] ?? (field.kind === "optional" ? null : value[name]), messages)];
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return create(ValueSchema, { kind: { case: "objectValue", value: create(ObjectValueSchema, { fields }) } });
|
||||||
|
}
|
||||||
|
if (type.kind === "optional")
|
||||||
|
return value === null ? jsToProtoValue(null) : encodeQxValue(type.value, value, messages);
|
||||||
|
if (type.kind === "list")
|
||||||
|
return jsToProtoValue(value.map((entry: unknown) => liveValue(encodeQxValue(type.value, entry, messages))));
|
||||||
|
if (type.kind === "object-ref") {
|
||||||
|
referenceToWire(value);
|
||||||
|
return jsToProtoValue(value);
|
||||||
|
}
|
||||||
|
assertReferenceFree(value);
|
||||||
|
if (type.kind === "message") {
|
||||||
|
const encoded = requireMessage(messages, type.descriptorId).encode(value);
|
||||||
|
assertReferenceFree(protoValueToJs(encoded));
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
return jsToProtoValue(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const inputValue = (context: RuntimeContext, type: QxValueType) => {
|
||||||
|
if (type.kind === "message" || type.kind === "record")
|
||||||
|
return create(ValueSchema, {
|
||||||
|
kind: { case: "objectValue", value: create(ObjectValueSchema, { fields: context.inputProto }) },
|
||||||
|
});
|
||||||
|
return context.inputProto.value;
|
||||||
|
};
|
||||||
|
const inputFields = (type: QxValueType, value: unknown, messages: QxMessages): Record<string, unknown> => {
|
||||||
|
if (type.kind === "builtin" && type.name === "unit") return {};
|
||||||
|
const encoded = encodeQxValue(type, value, messages);
|
||||||
|
if (type.kind === "message" || type.kind === "record") {
|
||||||
|
if (encoded.kind.case !== "objectValue") throw new Error("Message inputs must encode an object value");
|
||||||
|
return Object.fromEntries(Object.entries(encoded.kind.value.fields).map(([key, entry]) => [key, liveValue(entry)]));
|
||||||
|
}
|
||||||
|
return { value: liveValue(encoded) };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The sole unchecked cast connects generated contracts to the dynamic RPC runtime. */
|
||||||
|
export const bindQxHandler = <C, O>(
|
||||||
|
spec: QxHandlerSpec,
|
||||||
|
handler: QxHandler<C, O> | QxDerived<C, O>,
|
||||||
|
messages: QxMessages,
|
||||||
|
): RuntimeHandler | DerivedHandler => {
|
||||||
|
const bindContext = (raw: RuntimeContext): C => {
|
||||||
|
const ports = Object.fromEntries(
|
||||||
|
Object.entries(spec.ports).map(([name, port]) => {
|
||||||
|
switch (port.kind) {
|
||||||
|
case "state": {
|
||||||
|
const state = raw.state(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
...(port.primitives.includes("read")
|
||||||
|
? {
|
||||||
|
get: async () => decodeQxValue(port.valueType, (await state.live()).$quixosValue, messages),
|
||||||
|
live: () => state.live(),
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
...(port.primitives.includes("write")
|
||||||
|
? {
|
||||||
|
set: async (value: unknown) =>
|
||||||
|
state.set(liveValue(encodeQxValue(port.valueType, value, messages))),
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "edge": {
|
||||||
|
const edge = raw.edge(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
...Object.fromEntries(
|
||||||
|
port.primitives.map((primitive) => [
|
||||||
|
primitive,
|
||||||
|
edge[primitive as "resolve" | "connect" | "disconnect"],
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
...(port.primitives.includes("resolve") ? { collection: edge.collection } : {}),
|
||||||
|
...(port.primitives.includes("resolve") &&
|
||||||
|
port.primitives.includes("connect") &&
|
||||||
|
port.primitives.includes("disconnect")
|
||||||
|
? { replace: edge.replace }
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "interface": {
|
||||||
|
const target = raw.interface(port.id);
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
bindInterfaceView(target, defineQxInterfaceContract(port.interfaceRevisionId, port.operations), messages),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "query": {
|
||||||
|
const query = raw.query(port.id);
|
||||||
|
const variablesToWire = (variables: unknown) => {
|
||||||
|
const value = encodeQxValue(port.variables, variables, messages);
|
||||||
|
if (value.kind.case !== "objectValue") throw new Error("QUERY_VARIABLE_INVALID");
|
||||||
|
return value.kind.value.fields;
|
||||||
|
};
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
async execute(variables: unknown) {
|
||||||
|
const response = await query.execute(variablesToWire(variables), port.definitionDigest);
|
||||||
|
if (response.pending.length || response.errors.length) throw new Error("QUERY_INCOMPLETE");
|
||||||
|
return decodeQxValue(port.output, response.value, messages);
|
||||||
|
},
|
||||||
|
...(port.watch
|
||||||
|
? {
|
||||||
|
async *watch(variables: unknown, signal: AbortSignal) {
|
||||||
|
for await (const event of query.watch(
|
||||||
|
variablesToWire(variables),
|
||||||
|
signal,
|
||||||
|
port.definitionDigest,
|
||||||
|
)) {
|
||||||
|
if (!event.snapshot) throw new Error("QUERY_SNAPSHOT_MISSING");
|
||||||
|
yield decodeQuerySnapshot(event.snapshot, port.output, event.runId, event.sequence);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case "constructor":
|
||||||
|
return [
|
||||||
|
name,
|
||||||
|
{
|
||||||
|
construct: (input: unknown) =>
|
||||||
|
raw.constructor(port.id).construct(inputFields(port.inputType, input, messages)),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
conform: {
|
||||||
|
async tryConform<View>(object: import("./references.js").QxObjectRef, contract: QxInterfaceContract<View>) {
|
||||||
|
const target = await raw.tryConform(object, contract.interfaceRevisionId);
|
||||||
|
return target
|
||||||
|
? (bindInterfaceView(target, contract as QxInterfaceContract<unknown>, messages) as View)
|
||||||
|
: undefined;
|
||||||
|
},
|
||||||
|
} satisfies QxConformer,
|
||||||
|
...(spec.receiver === "none" ? {} : { objectId: raw.objectId }),
|
||||||
|
signal: raw.signal,
|
||||||
|
...(spec.receiver !== "none" && raw.openSession
|
||||||
|
? {
|
||||||
|
openSession: async () => {
|
||||||
|
const session = await raw.openSession!();
|
||||||
|
return {
|
||||||
|
id: session.id,
|
||||||
|
close: () => session.close(),
|
||||||
|
run: <T>(work: (context: C) => Promise<T>) => session.run((next) => work(bindContext(next))),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
input: decodeQxValue(spec.inputType, inputValue(raw, spec.inputType), messages),
|
||||||
|
ports,
|
||||||
|
} as C;
|
||||||
|
};
|
||||||
|
const execute = async (raw: RuntimeContext) => {
|
||||||
|
const context = bindContext(raw);
|
||||||
|
const value = await (typeof handler === "function" ? handler(context) : handler.get(context));
|
||||||
|
return liveValue(encodeQxValue(spec.eventType ?? spec.outputType, value, messages));
|
||||||
|
};
|
||||||
|
return typeof handler === "function" ? execute : derived(execute);
|
||||||
|
};
|
||||||
+1083
-338
File diff suppressed because one or more lines are too long
+1292
-728
File diff suppressed because one or more lines are too long
@@ -1,679 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
import fs from "node:fs";
|
|
||||||
import path from "node:path";
|
|
||||||
import protobuf from "protobufjs";
|
|
||||||
import {
|
|
||||||
compileCaminoSchema,
|
|
||||||
loadCaminoSchemaRoot,
|
|
||||||
} from "./schema-compiler.js";
|
|
||||||
import type {
|
|
||||||
ClassSchema,
|
|
||||||
FieldSchema,
|
|
||||||
FunctionRef,
|
|
||||||
InterfaceImplementation,
|
|
||||||
TypeRef,
|
|
||||||
} from "./schema-ir.js";
|
|
||||||
|
|
||||||
const usage = (): never => {
|
|
||||||
console.error(
|
|
||||||
"Usage: camino-codegen-ts-runtime [--react-only] <class-schema.camino.proto> <out-dir> [implementation-import]",
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
const required = (value: string | undefined) => value ?? usage();
|
|
||||||
|
|
||||||
const stringLiteral = (value: string) => JSON.stringify(value);
|
|
||||||
|
|
||||||
const upperFirst = (value: string) =>
|
|
||||||
value.length === 0 ? value : `${value[0]?.toUpperCase()}${value.slice(1)}`;
|
|
||||||
|
|
||||||
const lowerFirst = (value: string) =>
|
|
||||||
value.length === 0 ? value : `${value[0]?.toLowerCase()}${value.slice(1)}`;
|
|
||||||
|
|
||||||
const camel = (value: string) =>
|
|
||||||
value
|
|
||||||
.split(/[^a-zA-Z0-9]+/)
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((part, index) =>
|
|
||||||
index === 0 ? lowerFirst(part) : upperFirst(lowerFirst(part)),
|
|
||||||
)
|
|
||||||
.join("");
|
|
||||||
|
|
||||||
const isIdentifier = (value: string) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value);
|
|
||||||
|
|
||||||
const classId = (schema: ClassSchema) =>
|
|
||||||
`${schema.id.namespace}:${schema.id.name}:${schema.id.version}:${
|
|
||||||
schema.id.hash ?? ""
|
|
||||||
}`;
|
|
||||||
|
|
||||||
const symbolId = (value: { namespace: string; name: string; version: string; hash?: string }) =>
|
|
||||||
`${value.namespace}:${value.name}:${value.version}:${value.hash ?? ""}`;
|
|
||||||
|
|
||||||
const normalizedProtoType = (value: string) => value.replace(/^\./, "");
|
|
||||||
|
|
||||||
const declarationName = (value: protobuf.Type | protobuf.Enum) => value.name;
|
|
||||||
|
|
||||||
const tsTypeForTypeRef = (
|
|
||||||
type: TypeRef,
|
|
||||||
root?: protobuf.Root,
|
|
||||||
): string => {
|
|
||||||
if (type.symbol) {
|
|
||||||
return `ObjectRef<${stringLiteral(symbolId(type.symbol))}>`;
|
|
||||||
}
|
|
||||||
if (type.enumValues && type.enumValues.length > 0) {
|
|
||||||
return type.enumValues.map(stringLiteral).join(" | ");
|
|
||||||
}
|
|
||||||
const protoType = normalizedProtoType(type.protoType);
|
|
||||||
switch (protoType) {
|
|
||||||
case "string":
|
|
||||||
case "google.protobuf.StringValue":
|
|
||||||
return "string";
|
|
||||||
case "bool":
|
|
||||||
case "google.protobuf.BoolValue":
|
|
||||||
return "boolean";
|
|
||||||
case "double":
|
|
||||||
case "float":
|
|
||||||
case "google.protobuf.DoubleValue":
|
|
||||||
case "google.protobuf.FloatValue":
|
|
||||||
case "int32":
|
|
||||||
case "sint32":
|
|
||||||
case "sfixed32":
|
|
||||||
case "uint32":
|
|
||||||
case "fixed32":
|
|
||||||
case "int64":
|
|
||||||
case "sint64":
|
|
||||||
case "sfixed64":
|
|
||||||
case "uint64":
|
|
||||||
case "fixed64":
|
|
||||||
case "google.protobuf.Int32Value":
|
|
||||||
case "google.protobuf.UInt32Value":
|
|
||||||
case "google.protobuf.Int64Value":
|
|
||||||
case "google.protobuf.UInt64Value":
|
|
||||||
return "number";
|
|
||||||
case "bytes":
|
|
||||||
case "google.protobuf.BytesValue":
|
|
||||||
return "Uint8Array";
|
|
||||||
default:
|
|
||||||
if (protoType === "google.protobuf.Empty") {
|
|
||||||
return "Record<string, never>";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const reflected = root?.lookup(protoType);
|
|
||||||
if (reflected instanceof protobuf.Type || reflected instanceof protobuf.Enum) {
|
|
||||||
return declarationName(reflected);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Unknown imported message types remain opaque at this codegen boundary.
|
|
||||||
}
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const tsTypeForField = (field: FieldSchema, root?: protobuf.Root): string =>
|
|
||||||
tsTypeForTypeRef(field.type, root);
|
|
||||||
|
|
||||||
const tsValueTypeForField = (field: FieldSchema, root?: protobuf.Root) =>
|
|
||||||
field.repeated ? `${tsTypeForField(field, root)}[]` : tsTypeForField(field, root);
|
|
||||||
|
|
||||||
const tsFieldApiType = (field: FieldSchema, root?: protobuf.Root) =>
|
|
||||||
field.conflict === "crdt"
|
|
||||||
? `CrdtField<${tsValueTypeForField(field, root)}>`
|
|
||||||
: `Field<${tsValueTypeForField(field, root)}>`;
|
|
||||||
|
|
||||||
const functionExportName = (fn: FunctionRef, fallback: string) => {
|
|
||||||
if (isIdentifier(fn.symbol)) {
|
|
||||||
return fn.symbol;
|
|
||||||
}
|
|
||||||
const fallbackName = camel(fallback);
|
|
||||||
if (isIdentifier(fallbackName)) {
|
|
||||||
return fallbackName;
|
|
||||||
}
|
|
||||||
throw new Error(`Cannot generate TS export name for function ${fn.symbol}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const generatedWarning = `// @generated by camino-codegen-ts-runtime. Do not edit.\n`;
|
|
||||||
|
|
||||||
const scalarTsType = (field: protobuf.Field, root: protobuf.Root): string => {
|
|
||||||
const primitive = tsTypeForTypeRef({ protoType: field.type }, root);
|
|
||||||
if (primitive !== "unknown") {
|
|
||||||
return primitive;
|
|
||||||
}
|
|
||||||
const resolved = field.resolvedType;
|
|
||||||
if (resolved instanceof protobuf.Type || resolved instanceof protobuf.Enum) {
|
|
||||||
return declarationName(resolved);
|
|
||||||
}
|
|
||||||
return "unknown";
|
|
||||||
};
|
|
||||||
|
|
||||||
const collectProtoDeclarations = (
|
|
||||||
root: protobuf.Root,
|
|
||||||
types: TypeRef[],
|
|
||||||
) => {
|
|
||||||
const declarations = new Map<string, protobuf.Type | protobuf.Enum>();
|
|
||||||
const visit = (value: protobuf.Type | protobuf.Enum) => {
|
|
||||||
const key = value.fullName;
|
|
||||||
if (declarations.has(key)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
declarations.set(key, value);
|
|
||||||
if (value instanceof protobuf.Type) {
|
|
||||||
for (const field of value.fieldsArray) {
|
|
||||||
if (
|
|
||||||
field.resolvedType instanceof protobuf.Type ||
|
|
||||||
field.resolvedType instanceof protobuf.Enum
|
|
||||||
) {
|
|
||||||
visit(field.resolvedType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (const type of types) {
|
|
||||||
if (type.symbol || !type.protoType) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const reflected = root.lookup(normalizedProtoType(type.protoType));
|
|
||||||
if (reflected instanceof protobuf.Type || reflected instanceof protobuf.Enum) {
|
|
||||||
visit(reflected);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Opaque imported types are represented as unknown by the generated API.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [...declarations.values()]
|
|
||||||
.map((value) => {
|
|
||||||
if (value instanceof protobuf.Enum) {
|
|
||||||
return `export type ${declarationName(value)} = ${Object.keys(value.values)
|
|
||||||
.map(stringLiteral)
|
|
||||||
.join(" | ")};`;
|
|
||||||
}
|
|
||||||
const fields = value.fieldsArray.map((field) => {
|
|
||||||
const fieldType = scalarTsType(field, root);
|
|
||||||
const valueType = field.map
|
|
||||||
? `Record<string, ${fieldType}>`
|
|
||||||
: field.repeated
|
|
||||||
? `${fieldType}[]`
|
|
||||||
: fieldType;
|
|
||||||
return ` ${JSON.stringify(field.name)}${field.optional ? "?" : ""}: ${valueType};`;
|
|
||||||
});
|
|
||||||
return `export type ${declarationName(value)} = {\n${fields.join("\n")}\n};`;
|
|
||||||
})
|
|
||||||
.join("\n\n");
|
|
||||||
};
|
|
||||||
|
|
||||||
type FunctionSpec = {
|
|
||||||
exportName: string;
|
|
||||||
symbol: string;
|
|
||||||
operation?: string;
|
|
||||||
packageNamespace: string;
|
|
||||||
packageName: string;
|
|
||||||
field?: {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
storage: string;
|
|
||||||
conflict: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const fieldTypeId = (field: FieldSchema) =>
|
|
||||||
field.type.symbol ? symbolId(field.type.symbol) : field.type.protoType;
|
|
||||||
|
|
||||||
const crdtStorageTypeId = (field: FieldSchema) =>
|
|
||||||
field.type.protoType ||
|
|
||||||
(field.type.symbol
|
|
||||||
? `${field.type.symbol.namespace}.${field.type.symbol.name}`
|
|
||||||
: fieldTypeId(field));
|
|
||||||
|
|
||||||
const fieldStorageId = (field: FieldSchema) =>
|
|
||||||
field.ops && field.storage.kind === "stored" ? "derived" : field.storage.kind;
|
|
||||||
|
|
||||||
const interfaceTypeName = (implementation: InterfaceImplementation) =>
|
|
||||||
`${implementation.interface.name}Ref`;
|
|
||||||
|
|
||||||
const renderInterfaceRefTypes = (schema: ClassSchema) =>
|
|
||||||
schema.implements
|
|
||||||
.map((implementation) => {
|
|
||||||
const typeParams = implementation.typeBindings.map((binding) => binding.name);
|
|
||||||
const generic =
|
|
||||||
typeParams.length > 0 ? `<${typeParams.join(", ")}>` : "";
|
|
||||||
const bindings =
|
|
||||||
typeParams.length > 0
|
|
||||||
? typeParams
|
|
||||||
.map((param) => ` readonly ${param}: ${param};`)
|
|
||||||
.join("\n")
|
|
||||||
: " readonly value: unknown;";
|
|
||||||
return `export type ${interfaceTypeName(implementation)}${generic} = ObjectRef<string> & {
|
|
||||||
readonly $caminoInterfaces: {
|
|
||||||
readonly ${stringLiteral(symbolId(implementation.interface))}: {
|
|
||||||
${bindings}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};`;
|
|
||||||
})
|
|
||||||
.join("\n\n");
|
|
||||||
|
|
||||||
const interfaceMixins = (schema: ClassSchema, root: protobuf.Root) =>
|
|
||||||
schema.implements.map((implementation) => {
|
|
||||||
const typeArgs = implementation.typeBindings.map((binding) =>
|
|
||||||
tsTypeForTypeRef(binding.type, root),
|
|
||||||
);
|
|
||||||
return `${interfaceTypeName(implementation)}${
|
|
||||||
typeArgs.length > 0 ? `<${typeArgs.join(", ")}>` : ""
|
|
||||||
}`;
|
|
||||||
});
|
|
||||||
|
|
||||||
const operationFunctionSpecs = (schema: ClassSchema): FunctionSpec[] =>
|
|
||||||
schema.fields.flatMap((field) => {
|
|
||||||
const serviceName = field.ops?.service.replace(/^\./, "");
|
|
||||||
if (!serviceName) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const service = schema.operationServices.find(
|
|
||||||
(candidate) => candidate.fullName === serviceName,
|
|
||||||
);
|
|
||||||
if (!service) {
|
|
||||||
throw new Error(
|
|
||||||
`${schema.id.name}.${field.name} points to missing operation service ${field.ops?.service}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return service.operations.map((operation) => ({
|
|
||||||
exportName: functionExportName(
|
|
||||||
operation.function,
|
|
||||||
`${field.name}_${operation.name}`,
|
|
||||||
),
|
|
||||||
symbol: operation.function.symbol,
|
|
||||||
...(operation.function.operation
|
|
||||||
? { operation: operation.function.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: operation.function.packageNamespace,
|
|
||||||
packageName: operation.function.packageName,
|
|
||||||
field: {
|
|
||||||
name: field.name,
|
|
||||||
type: fieldTypeId(field),
|
|
||||||
storage: fieldStorageId(field),
|
|
||||||
conflict: field.conflict,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
const renderRuntime = (schema: ClassSchema, root: protobuf.Root) => {
|
|
||||||
const className = schema.id.name;
|
|
||||||
const objectTypeName = `${className}Object`;
|
|
||||||
const refTypeName = `${className}Ref`;
|
|
||||||
const contextTypeName = `${className}Context`;
|
|
||||||
const implementationTypeName = `${className}Implementation`;
|
|
||||||
const serveName = `serve${className}Runtime`;
|
|
||||||
const createObjectName = `create${className}Object`;
|
|
||||||
const interfaceRefTypes = renderInterfaceRefTypes(schema);
|
|
||||||
const refType =
|
|
||||||
[ `ObjectRef<${stringLiteral(classId(schema))}>`, ...interfaceMixins(schema, root)]
|
|
||||||
.join(" & ");
|
|
||||||
const edgeFields = new Set(schema.edges.map((edge) => edge.sourceField));
|
|
||||||
const writableFields = schema.fields.filter(
|
|
||||||
(field) =>
|
|
||||||
field.storage.kind === "stored" &&
|
|
||||||
!field.ops &&
|
|
||||||
!edgeFields.has(field.name),
|
|
||||||
);
|
|
||||||
const functionSpecs = [
|
|
||||||
...(schema.constructorSpec
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
exportName: functionExportName(
|
|
||||||
schema.constructorSpec.function,
|
|
||||||
"constructor",
|
|
||||||
),
|
|
||||||
symbol: schema.constructorSpec.function.symbol,
|
|
||||||
...(schema.constructorSpec.function.operation
|
|
||||||
? { operation: schema.constructorSpec.function.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: schema.constructorSpec.function.packageNamespace,
|
|
||||||
packageName: schema.constructorSpec.function.packageName,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
...schema.methods.map((method) => ({
|
|
||||||
exportName: functionExportName(method.function, method.name),
|
|
||||||
symbol: method.function.symbol,
|
|
||||||
...(method.function.operation ? { operation: method.function.operation } : {}),
|
|
||||||
packageNamespace: method.function.packageNamespace,
|
|
||||||
packageName: method.function.packageName,
|
|
||||||
})),
|
|
||||||
...schema.fields.flatMap((field) =>
|
|
||||||
field.storage.resolver
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
exportName: functionExportName(field.storage.resolver, field.name),
|
|
||||||
symbol: field.storage.resolver.symbol,
|
|
||||||
...(field.storage.resolver.operation
|
|
||||||
? { operation: field.storage.resolver.operation }
|
|
||||||
: {}),
|
|
||||||
packageNamespace: field.storage.resolver.packageNamespace,
|
|
||||||
packageName: field.storage.resolver.packageName,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [],
|
|
||||||
),
|
|
||||||
...operationFunctionSpecs(schema),
|
|
||||||
];
|
|
||||||
const firstFunction = functionSpecs[0];
|
|
||||||
if (!firstFunction) {
|
|
||||||
throw new Error(`${schema.id.name} has no runtime functions to generate`);
|
|
||||||
}
|
|
||||||
const mixedPackage = functionSpecs.find(
|
|
||||||
(spec) =>
|
|
||||||
spec.packageNamespace !== firstFunction.packageNamespace ||
|
|
||||||
spec.packageName !== firstFunction.packageName,
|
|
||||||
);
|
|
||||||
if (mixedPackage) {
|
|
||||||
throw new Error(
|
|
||||||
`${schema.id.name} points to multiple packages; v0 TS runtime generation expects one package`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${generatedWarning}import {
|
|
||||||
type CaminoClient,
|
|
||||||
createCrdtField,
|
|
||||||
createField,
|
|
||||||
type CrdtField,
|
|
||||||
type Field,
|
|
||||||
type FieldOperation,
|
|
||||||
type InvokeRequest,
|
|
||||||
objectRef,
|
|
||||||
type ObjectRef,
|
|
||||||
type RuntimeHandler,
|
|
||||||
serveQuixosPackageRuntime,
|
|
||||||
} from "@quixos/camino-package-runtime";
|
|
||||||
|
|
||||||
${collectProtoDeclarations(root, schema.implements.flatMap((entry) => entry.typeBindings.map((binding) => binding.type)))}
|
|
||||||
|
|
||||||
${interfaceRefTypes ? `${interfaceRefTypes}\n\n` : ""}export type ${refTypeName} = ${refType};
|
|
||||||
|
|
||||||
export type ${objectTypeName} = {
|
|
||||||
id: ${refTypeName};
|
|
||||||
${writableFields
|
|
||||||
.map(
|
|
||||||
(field) =>
|
|
||||||
` ${camel(field.name)}: ${tsFieldApiType(field, root)};`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ${contextTypeName} = {
|
|
||||||
object: ${objectTypeName};
|
|
||||||
camino: CaminoClient;
|
|
||||||
request: InvokeRequest;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ${implementationTypeName} = {
|
|
||||||
${functionSpecs
|
|
||||||
.map((spec) =>
|
|
||||||
spec.operation
|
|
||||||
? ` ${spec.exportName}: FieldOperation<${contextTypeName}>;`
|
|
||||||
: ` ${spec.exportName}: RuntimeHandler<${contextTypeName}>;`,
|
|
||||||
)
|
|
||||||
.filter((line, index, lines) => lines.indexOf(line) === index)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
|
|
||||||
const packageNamespace = ${stringLiteral(firstFunction.packageNamespace)};
|
|
||||||
const packageName = ${stringLiteral(firstFunction.packageName)};
|
|
||||||
const runtimeProtocolVersion = ${stringLiteral("camino-orch-v0")};
|
|
||||||
|
|
||||||
const functions = [
|
|
||||||
${functionSpecs
|
|
||||||
.map(
|
|
||||||
(spec) =>
|
|
||||||
` { exportName: ${stringLiteral(spec.exportName)}, symbol: ${stringLiteral(spec.symbol)}${
|
|
||||||
spec.operation ? `, operation: ${stringLiteral(spec.operation)}` : ""
|
|
||||||
}${
|
|
||||||
spec.field
|
|
||||||
? `, field: { name: ${stringLiteral(spec.field.name)}, type: ${stringLiteral(spec.field.type)}, storage: ${stringLiteral(spec.field.storage)}, conflict: ${stringLiteral(spec.field.conflict)} }`
|
|
||||||
: ""
|
|
||||||
} },`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
export const ${createObjectName} = (
|
|
||||||
camino: CaminoClient,
|
|
||||||
objectId: string,
|
|
||||||
): ${objectTypeName} => {
|
|
||||||
const id = objectRef<${stringLiteral(classId(schema))}>(objectId) as ${refTypeName};
|
|
||||||
return {
|
|
||||||
id,
|
|
||||||
${writableFields
|
|
||||||
.map(
|
|
||||||
(fieldSchema) =>
|
|
||||||
fieldSchema.conflict === "crdt"
|
|
||||||
? ` ${camel(fieldSchema.name)}: createCrdtField(camino, id, ${stringLiteral(fieldSchema.name)}, ${stringLiteral(crdtStorageTypeId(fieldSchema))}),`
|
|
||||||
: ` ${camel(fieldSchema.name)}: createField(camino, id, ${stringLiteral(fieldSchema.name)}),`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const create${className}Context = (
|
|
||||||
camino: CaminoClient,
|
|
||||||
request: InvokeRequest,
|
|
||||||
): ${contextTypeName} => ({
|
|
||||||
object: ${createObjectName}(camino, request.objectId),
|
|
||||||
camino,
|
|
||||||
request,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ${serveName} = (implementation: ${implementationTypeName}) => {
|
|
||||||
serveQuixosPackageRuntime({
|
|
||||||
packageNamespace,
|
|
||||||
packageName,
|
|
||||||
runtimeProtocolVersion,
|
|
||||||
functions,
|
|
||||||
implementation,
|
|
||||||
createContext: create${className}Context,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const implementationNamed = (schema: ClassSchema, name: string) =>
|
|
||||||
schema.implements.find(
|
|
||||||
(entry) =>
|
|
||||||
entry.interface.namespace === "quixos.react" &&
|
|
||||||
entry.interface.name === name,
|
|
||||||
);
|
|
||||||
|
|
||||||
const requiredBinding = (
|
|
||||||
implementation: InterfaceImplementation,
|
|
||||||
name: string,
|
|
||||||
) => {
|
|
||||||
const binding = implementation.typeBindings.find((entry) => entry.name === name);
|
|
||||||
if (!binding) {
|
|
||||||
throw new Error(
|
|
||||||
`${implementation.interface.name} implementation is missing ${name}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return binding.type;
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderReactClient = (schema: ClassSchema, root: protobuf.Root) => {
|
|
||||||
const react = implementationNamed(schema, "ReactComponent");
|
|
||||||
const componentFor = implementationNamed(schema, "ReactComponentFor");
|
|
||||||
if (!react || !componentFor) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const renderProps = requiredBinding(react, "RenderProps");
|
|
||||||
const action = requiredBinding(react, "Action");
|
|
||||||
const object = requiredBinding(componentFor, "Object");
|
|
||||||
if (!object.symbol) {
|
|
||||||
throw new Error(`${schema.id.name}.ReactComponentFor.Object must bind a class symbol`);
|
|
||||||
}
|
|
||||||
const edge = schema.edges.find((candidate) => candidate.sourceField === "for_object");
|
|
||||||
if (!edge) {
|
|
||||||
throw new Error(`${schema.id.name} must declare its ReactComponentFor edge`);
|
|
||||||
}
|
|
||||||
const componentEndpoint =
|
|
||||||
edge.fromEndpoint.projection === "for_object"
|
|
||||||
? edge.fromEndpoint
|
|
||||||
: edge.toEndpoint.projection === "for_object"
|
|
||||||
? edge.toEndpoint
|
|
||||||
: undefined;
|
|
||||||
const objectEndpoint =
|
|
||||||
componentEndpoint === edge.fromEndpoint ? edge.toEndpoint : edge.fromEndpoint;
|
|
||||||
if (!componentEndpoint || !objectEndpoint.projection) {
|
|
||||||
throw new Error(`${schema.id.name}.for_object edge has no inverse projection`);
|
|
||||||
}
|
|
||||||
if (componentEndpoint.cardinality !== "exactly_one") {
|
|
||||||
throw new Error(`${schema.id.name}.for_object must have exactly_one cardinality`);
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!objectEndpoint.materialization ||
|
|
||||||
symbolId(objectEndpoint.materialization.class) !== symbolId(schema.id)
|
|
||||||
) {
|
|
||||||
throw new Error(
|
|
||||||
`${schema.id.name}.${objectEndpoint.projection} must materialize ${classId(schema)}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const className = schema.id.name;
|
|
||||||
const componentName = className.endsWith("ReactComponent")
|
|
||||||
? `${className.slice(0, -"ReactComponent".length)}Component`
|
|
||||||
: className;
|
|
||||||
const propsTypeName = `${componentName}Props`;
|
|
||||||
const renderPropsType = tsTypeForTypeRef(renderProps, root);
|
|
||||||
const actionType = tsTypeForTypeRef(action, root);
|
|
||||||
const objectType = tsTypeForTypeRef(object, root);
|
|
||||||
const declarations = collectProtoDeclarations(root, [renderProps, action]);
|
|
||||||
|
|
||||||
return `${generatedWarning}import {
|
|
||||||
createReactComponentFor,
|
|
||||||
type ReactComponentHostProps,
|
|
||||||
type ObjectRef,
|
|
||||||
} from "@quixos/camino-react-runtime";
|
|
||||||
|
|
||||||
${declarations}
|
|
||||||
|
|
||||||
export type ${propsTypeName} = {
|
|
||||||
forObject: ${objectType};
|
|
||||||
} & ${renderPropsType} & ReactComponentHostProps<${actionType}>;
|
|
||||||
|
|
||||||
export const ${componentName} = createReactComponentFor<
|
|
||||||
${objectType},
|
|
||||||
${renderPropsType},
|
|
||||||
${actionType}
|
|
||||||
>({
|
|
||||||
componentClassId: ${stringLiteral(classId(schema))},
|
|
||||||
projection: ${stringLiteral(objectEndpoint.projection)},
|
|
||||||
});
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const reactRuntimeDeclaration = `${generatedWarning}declare module "@quixos/camino-react-runtime" {
|
|
||||||
import type * as AutomergeNamespace from "@automerge/automerge";
|
|
||||||
|
|
||||||
export type ObjectRef<ClassId extends string> = string & {
|
|
||||||
readonly $caminoClass: ClassId;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type LiveFieldProp<T> = {
|
|
||||||
value: T;
|
|
||||||
source: {
|
|
||||||
objectId: string;
|
|
||||||
fieldName: string;
|
|
||||||
fieldType?: string;
|
|
||||||
fieldStorage?: string;
|
|
||||||
conflictStrategy?: string;
|
|
||||||
revision?: string | number | bigint;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ReactComponentHostProps<Action> = {
|
|
||||||
onAction?: (action: Action) => void;
|
|
||||||
fallback?: unknown;
|
|
||||||
className?: string;
|
|
||||||
style?: Record<string, string | number | undefined>;
|
|
||||||
onError?: (error: Error) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ReactComponentImplementationProps<CaminoProps, RenderProps, Action> = {
|
|
||||||
camino: CaminoProps;
|
|
||||||
render: RenderProps;
|
|
||||||
dispatch: (action: Action) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createReactComponentFor: <
|
|
||||||
ForObject extends ObjectRef<string>,
|
|
||||||
RenderProps extends object,
|
|
||||||
Action,
|
|
||||||
>(config: {
|
|
||||||
componentClassId: string;
|
|
||||||
projection: string;
|
|
||||||
}) => (props: {
|
|
||||||
forObject: ForObject;
|
|
||||||
} & RenderProps & ReactComponentHostProps<Action>) => any;
|
|
||||||
|
|
||||||
export const callObjectMethod: <Result = unknown>(
|
|
||||||
object: ObjectRef<string>,
|
|
||||||
methodName: string,
|
|
||||||
input?: Record<string, unknown>,
|
|
||||||
) => Promise<Result>;
|
|
||||||
|
|
||||||
export const h: (...args: any[]) => any;
|
|
||||||
export const useLiveField: <T>(
|
|
||||||
field: LiveFieldProp<T>,
|
|
||||||
) => [T, (value: T) => void | Promise<void>];
|
|
||||||
export const Automerge: typeof AutomergeNamespace;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const renderServer = (schema: ClassSchema, implementationImport: string) => {
|
|
||||||
const className = schema.id.name;
|
|
||||||
return `${generatedWarning}import * as implementation from ${stringLiteral(implementationImport)};
|
|
||||||
import { serve${className}Runtime } from "./${schema.id.namespace}.${className}.runtime.js";
|
|
||||||
|
|
||||||
serve${className}Runtime(implementation);
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const main = async () => {
|
|
||||||
const reactOnly = process.argv[2] === "--react-only";
|
|
||||||
const offset = reactOnly ? 1 : 0;
|
|
||||||
const sourceFile = required(process.argv[2 + offset]);
|
|
||||||
const outDir = required(process.argv[3 + offset]);
|
|
||||||
const implementationImport = process.argv[4 + offset] ?? "../task.impl.js";
|
|
||||||
const compiled = await compileCaminoSchema(sourceFile);
|
|
||||||
const { root } = await loadCaminoSchemaRoot(sourceFile);
|
|
||||||
if (compiled.classes.length !== 1) {
|
|
||||||
throw new Error(
|
|
||||||
`Expected exactly one Camino class in ${sourceFile}, found ${compiled.classes.length}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const schema = compiled.classes[0];
|
|
||||||
if (!schema) {
|
|
||||||
throw new Error(`No Camino class found in ${sourceFile}`);
|
|
||||||
}
|
|
||||||
fs.mkdirSync(outDir, { recursive: true });
|
|
||||||
const baseName = `${schema.id.namespace}.${schema.id.name}`;
|
|
||||||
const reactClient = renderReactClient(schema, root);
|
|
||||||
if (!reactOnly) {
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(outDir, `${baseName}.runtime.ts`),
|
|
||||||
renderRuntime(schema, root),
|
|
||||||
);
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(outDir, `${baseName}.server.ts`),
|
|
||||||
renderServer(schema, implementationImport),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (reactClient) {
|
|
||||||
fs.writeFileSync(path.join(outDir, `${baseName}.react.ts`), reactClient);
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(outDir, "camino-react-runtime.d.ts"),
|
|
||||||
reactRuntimeDeclaration,
|
|
||||||
);
|
|
||||||
} else if (reactOnly) {
|
|
||||||
throw new Error(`${schema.id.name} does not implement ReactComponentFor`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
await main();
|
|
||||||
+764
-1030
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
|||||||
|
/** Execution completion, not HTTP disconnection, is the drain boundary. */
|
||||||
|
export const createInvocationRegistry = () => {
|
||||||
|
const entries = new Map<string, { state: string; controller: AbortController }>();
|
||||||
|
return {
|
||||||
|
begin(id: string) {
|
||||||
|
if (!id || entries.has(id))
|
||||||
|
throw new Error("Invocation ID is missing or already used; invocations are never replayed implicitly");
|
||||||
|
// Completed identities remain until process retirement. A bounded process
|
||||||
|
// may reject new work; it must not evict and accidentally replay a call.
|
||||||
|
if (entries.size >= 100_000) throw new Error("Invocation registry full; explicit runtime retirement required");
|
||||||
|
const entry = { state: "running", controller: new AbortController() };
|
||||||
|
entries.set(id, entry);
|
||||||
|
return {
|
||||||
|
signal: entry.controller.signal,
|
||||||
|
finish(failed = false) {
|
||||||
|
entry.state = failed ? "failed" : "completed";
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
status(id: string) {
|
||||||
|
return { invocationId: id, state: entries.get(id)?.state ?? "unknown" };
|
||||||
|
},
|
||||||
|
cancel(id: string) {
|
||||||
|
const entry = entries.get(id);
|
||||||
|
if (entry && ["running", "cancellation-requested"].includes(entry.state)) {
|
||||||
|
entry.state = "cancellation-requested";
|
||||||
|
entry.controller.abort();
|
||||||
|
}
|
||||||
|
return this.status(id);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
import { createHash } from "node:crypto";
|
||||||
|
|
||||||
|
export type MigrationInput = {
|
||||||
|
schemaVersion: 1;
|
||||||
|
executionId: string;
|
||||||
|
exportId: string;
|
||||||
|
ports: {
|
||||||
|
name: string;
|
||||||
|
binding: string;
|
||||||
|
view: "old" | "new";
|
||||||
|
access: ("read" | "write" | "create" | "edge")[];
|
||||||
|
atomId?: string;
|
||||||
|
attachedAtomId?: string;
|
||||||
|
defaultValue?: unknown;
|
||||||
|
states?: { objectId: string; value: unknown }[];
|
||||||
|
edges?: MigrationEdge[];
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
export type MigrationEdge = {
|
||||||
|
id: string;
|
||||||
|
edgeTypeId: string;
|
||||||
|
firstObjectId: string;
|
||||||
|
secondObjectId: string;
|
||||||
|
firstProjectionId: string;
|
||||||
|
secondProjectionId: string;
|
||||||
|
firstOrdinal?: number;
|
||||||
|
secondOrdinal?: number;
|
||||||
|
firstKeyJson?: string;
|
||||||
|
secondKeyJson?: string;
|
||||||
|
};
|
||||||
|
export type MigrationOutput = {
|
||||||
|
schemaVersion: 1;
|
||||||
|
executionId: string;
|
||||||
|
writes: { port: string; objectId: string; value: unknown }[];
|
||||||
|
creates: { port: string; logicalKey: string; objectId: string }[];
|
||||||
|
edgeReplacements: { port: string; edges: MigrationEdge[] }[];
|
||||||
|
};
|
||||||
|
export type MigrationContext = {
|
||||||
|
enumerate(port: string): { objectId: string; value: unknown }[];
|
||||||
|
read(port: string, objectId: string): unknown;
|
||||||
|
write(port: string, objectId: string, value: unknown): void;
|
||||||
|
create(port: string, logicalKey: string): string;
|
||||||
|
edges(port: string): MigrationEdge[];
|
||||||
|
replaceEdges(port: string, edges: MigrationEdge[]): void;
|
||||||
|
};
|
||||||
|
export const migrationObjectId = (executionId: string, port: string, logicalKey: string) =>
|
||||||
|
`obj:migration:${createHash("sha256")
|
||||||
|
.update(JSON.stringify([executionId, port, logicalKey]))
|
||||||
|
.digest("hex")}`;
|
||||||
|
|
||||||
|
/** No ordinary RuntimeContext or network/database clients are supplied here.
|
||||||
|
* Process isolation belongs to the host, not this convenience API. */
|
||||||
|
export const createMigrationContext = (input: MigrationInput) => {
|
||||||
|
if (
|
||||||
|
input.schemaVersion !== 1 ||
|
||||||
|
!input.executionId ||
|
||||||
|
new Set(input.ports.map((entry) => entry.name)).size !== input.ports.length
|
||||||
|
)
|
||||||
|
throw new Error("Invalid migration input");
|
||||||
|
const output: MigrationOutput = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
executionId: input.executionId,
|
||||||
|
writes: [],
|
||||||
|
creates: [],
|
||||||
|
edgeReplacements: [],
|
||||||
|
};
|
||||||
|
const port = (name: string, access: string) => {
|
||||||
|
const selected = input.ports.find((entry) => entry.name === name);
|
||||||
|
if (!selected?.access.includes(access as "read") || (selected.view === "old" && access !== "read"))
|
||||||
|
throw new Error(`Migration port ${name} does not grant ${access}`);
|
||||||
|
return selected;
|
||||||
|
};
|
||||||
|
const context: MigrationContext = {
|
||||||
|
enumerate(name) {
|
||||||
|
const selected = port(name, "read"),
|
||||||
|
states = structuredClone(selected.states ?? []);
|
||||||
|
if (selected.view === "new" && Object.hasOwn(selected, "defaultValue"))
|
||||||
|
for (const helper of output.creates) {
|
||||||
|
if (
|
||||||
|
input.ports.find((entry) => entry.name === helper.port)?.atomId === selected.attachedAtomId &&
|
||||||
|
!states.some((entry) => entry.objectId === helper.objectId)
|
||||||
|
)
|
||||||
|
states.push({ objectId: helper.objectId, value: structuredClone(selected.defaultValue) });
|
||||||
|
}
|
||||||
|
if (selected.view === "new")
|
||||||
|
for (const write of output.writes) {
|
||||||
|
if (input.ports.find((entry) => entry.name === write.port)?.binding !== selected.binding) continue;
|
||||||
|
const existing = states.findIndex((entry) => entry.objectId === write.objectId),
|
||||||
|
entry = { objectId: write.objectId, value: structuredClone(write.value) };
|
||||||
|
if (existing < 0) states.push(entry);
|
||||||
|
else states[existing] = entry;
|
||||||
|
}
|
||||||
|
return states.sort((a, b) => (a.objectId < b.objectId ? -1 : a.objectId > b.objectId ? 1 : 0));
|
||||||
|
},
|
||||||
|
read(name, objectId) {
|
||||||
|
return context.enumerate(name).find((entry) => entry.objectId === objectId)?.value;
|
||||||
|
},
|
||||||
|
write(name, objectId, value) {
|
||||||
|
port(name, "write");
|
||||||
|
const previous = output.writes.findIndex((entry) => entry.port === name && entry.objectId === objectId);
|
||||||
|
const entry = { port: name, objectId, value: structuredClone(value) };
|
||||||
|
if (previous < 0) output.writes.push(entry);
|
||||||
|
else output.writes[previous] = entry;
|
||||||
|
},
|
||||||
|
create(name, logicalKey) {
|
||||||
|
port(name, "create");
|
||||||
|
if (!logicalKey || logicalKey.length > 1024)
|
||||||
|
throw new Error("Migration creation requires a bounded stable logical key");
|
||||||
|
const objectId = migrationObjectId(input.executionId, name, logicalKey);
|
||||||
|
if (!output.creates.some((entry) => entry.objectId === objectId))
|
||||||
|
output.creates.push({ port: name, logicalKey, objectId });
|
||||||
|
return objectId;
|
||||||
|
},
|
||||||
|
edges(name) {
|
||||||
|
const selected = port(name, "read");
|
||||||
|
const replacement =
|
||||||
|
selected.view === "new"
|
||||||
|
? output.edgeReplacements.find(
|
||||||
|
(entry) => input.ports.find((candidate) => candidate.name === entry.port)?.binding === selected.binding,
|
||||||
|
)
|
||||||
|
: undefined;
|
||||||
|
return structuredClone(replacement?.edges ?? selected.edges ?? []);
|
||||||
|
},
|
||||||
|
replaceEdges(name, edges) {
|
||||||
|
port(name, "edge");
|
||||||
|
const previous = output.edgeReplacements.findIndex((entry) => entry.port === name);
|
||||||
|
const entry = { port: name, edges: structuredClone(edges) };
|
||||||
|
if (previous < 0) output.edgeReplacements.push(entry);
|
||||||
|
else output.edgeReplacements[previous] = entry;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return { context, result: () => structuredClone(output) };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Entrypoint for an immutable package's dedicated bin/migrate executable.
|
||||||
|
* stdout is protocol-only; send diagnostics to stderr. The host independently
|
||||||
|
* validates every write, helper identity, contract, and completion receipt. */
|
||||||
|
export const serveMigration = async (exports: Record<string, (context: MigrationContext) => void | Promise<void>>) => {
|
||||||
|
const chunks: Buffer[] = [];
|
||||||
|
let bytes = 0;
|
||||||
|
for await (const chunk of process.stdin) {
|
||||||
|
bytes += chunk.length;
|
||||||
|
if (bytes > 16 * 1024 * 1024) throw new Error("Migration input exceeds 16 MiB");
|
||||||
|
chunks.push(Buffer.from(chunk));
|
||||||
|
}
|
||||||
|
const input = JSON.parse(Buffer.concat(chunks).toString("utf8")) as MigrationInput;
|
||||||
|
const implementation = Object.hasOwn(exports, input.exportId) ? exports[input.exportId] : undefined;
|
||||||
|
if (!implementation) throw new Error("Unknown migration export");
|
||||||
|
const execution = createMigrationContext(input);
|
||||||
|
await implementation(execution.context);
|
||||||
|
const result = JSON.stringify(execution.result());
|
||||||
|
if (Buffer.byteLength(result) > 16 * 1024 * 1024) throw new Error("Migration output exceeds 16 MiB");
|
||||||
|
process.stdout.write(`${result}\n`);
|
||||||
|
};
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import { decodeQxValue, type QxValueType } from "./bindings.js";
|
||||||
|
import type { QueryResponse } from "./camino/api_pb.js";
|
||||||
|
import type { QxObjectRef } from "./references.js";
|
||||||
|
|
||||||
|
export type QxQueryPartial<T> = T extends QxObjectRef
|
||||||
|
? T
|
||||||
|
: T extends readonly (infer Item)[]
|
||||||
|
? QxQueryPartial<Item>[]
|
||||||
|
: T extends object
|
||||||
|
? { [Key in keyof T]?: QxQueryPartial<T[Key]> }
|
||||||
|
: T;
|
||||||
|
export type QxQuerySnapshot<T> = {
|
||||||
|
runId: string;
|
||||||
|
sequence: bigint;
|
||||||
|
dataVersion: string;
|
||||||
|
bindingDigest: string;
|
||||||
|
consistency: string;
|
||||||
|
fields: { path: readonly (string | number)[]; status: "pending" | "error"; error?: string }[];
|
||||||
|
} & ({ status: "ready"; data: T } | { status: "partial"; data: QxQueryPartial<T> });
|
||||||
|
declare const queryTypes: unique symbol;
|
||||||
|
/** Generated shape evidence, not permission to run a query. */
|
||||||
|
export interface QxQueryDescriptor<Variables, Result, Root extends string = string> {
|
||||||
|
readonly id: string;
|
||||||
|
readonly definitionDigest: string;
|
||||||
|
readonly rootInterfaceRevisionId: Root;
|
||||||
|
readonly variables: QxValueType;
|
||||||
|
readonly output: QxValueType;
|
||||||
|
readonly watch: boolean;
|
||||||
|
readonly [queryTypes]?: (variables: Variables, result: Result) => [Variables, Result];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function decodeQuerySnapshot<T>(
|
||||||
|
response: QueryResponse,
|
||||||
|
output: QxValueType,
|
||||||
|
runId: string,
|
||||||
|
sequence: bigint,
|
||||||
|
): QxQuerySnapshot<T> {
|
||||||
|
if (response.preparationToken || response.residualWindows.length || response.relationalCaptures.length)
|
||||||
|
throw new Error("QUERY_RESULT_UNFINISHED: private preparation is not a query result");
|
||||||
|
const fields = [
|
||||||
|
...response.pending.map((field) => ({ path: field.path, status: "pending" as const })),
|
||||||
|
...response.errors.map((field) => ({ path: field.path, status: "error" as const, error: field.error })),
|
||||||
|
].map((field) => ({
|
||||||
|
...field,
|
||||||
|
path: field.path.map((part) => {
|
||||||
|
if (part.part.case !== "field" && part.part.case !== "index") throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
return part.part.value;
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
// Pending/error values are absent, not successful nulls of a scalar type.
|
||||||
|
const shape = structuredClone(output);
|
||||||
|
for (const field of fields) {
|
||||||
|
let cursor = shape;
|
||||||
|
for (const [index, part] of field.path.entries()) {
|
||||||
|
while (cursor.kind === "optional") cursor = cursor.value;
|
||||||
|
const last = index === field.path.length - 1;
|
||||||
|
if (typeof part === "string" && cursor.kind === "record" && cursor.fields[part]) {
|
||||||
|
if (last) cursor.fields[part] = { kind: "optional", value: cursor.fields[part]! };
|
||||||
|
else cursor = cursor.fields[part]!;
|
||||||
|
} else if (typeof part === "number" && cursor.kind === "list") cursor = cursor.value;
|
||||||
|
else throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const data = decodeQxValue(shape, response.value, {}) as Record<string, unknown>;
|
||||||
|
for (const field of fields) {
|
||||||
|
let cursor: unknown = data;
|
||||||
|
for (const [index, part] of field.path.entries()) {
|
||||||
|
if (!cursor || typeof cursor !== "object") throw new Error("QUERY_PATCH_INVALID");
|
||||||
|
if (index === field.path.length - 1) delete (cursor as Record<string | number, unknown>)[part];
|
||||||
|
else cursor = (cursor as Record<string | number, unknown>)[part];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
runId,
|
||||||
|
sequence,
|
||||||
|
dataVersion: response.dataVersion,
|
||||||
|
bindingDigest: response.bindingDigest,
|
||||||
|
consistency: response.consistency,
|
||||||
|
fields,
|
||||||
|
...(fields.length ? { status: "partial", data } : { status: "ready", data }),
|
||||||
|
} as QxQuerySnapshot<T>;
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,68 @@
|
|||||||
|
// @generated by protoc-gen-es v2.12.1 with parameter "target=ts,import_extension=js"
|
||||||
|
// @generated from file quixos/package.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/package.proto.
|
||||||
|
*/
|
||||||
|
export const file_quixos_package: GenFile = /*@__PURE__*/
|
||||||
|
fileDesc("ChRxdWl4b3MvcGFja2FnZS5wcm90bxIGcXVpeG9zIo4BChFQYWNrYWdlRGVzY3JpcHRvchISCgpwYWNrYWdlX2lkGAEgASgJEhsKE3BhY2thZ2VfcmV2aXNpb25faWQYAiABKAkSIAoYcnVudGltZV9wcm90b2NvbF92ZXJzaW9uGAMgASgJEiYKB2V4cG9ydHMYBCADKAsyFS5xdWl4b3MuUnVudGltZUV4cG9ydCI6Cg1SdW50aW1lRXhwb3J0EhEKCWV4cG9ydF9pZBgBIAEoCRIWCg5ydW50aW1lX3N5bWJvbBgCIAEoCWIGcHJvdG8z");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.PackageDescriptor
|
||||||
|
*/
|
||||||
|
export type PackageDescriptor = Message<"quixos.PackageDescriptor"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_id = 1;
|
||||||
|
*/
|
||||||
|
packageId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 2;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_protocol_version = 3;
|
||||||
|
*/
|
||||||
|
runtimeProtocolVersion: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.RuntimeExport exports = 4;
|
||||||
|
*/
|
||||||
|
exports: RuntimeExport[];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageDescriptor.
|
||||||
|
* Use `create(PackageDescriptorSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const PackageDescriptorSchema: GenMessage<PackageDescriptor> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_package, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.RuntimeExport
|
||||||
|
*/
|
||||||
|
export type RuntimeExport = Message<"quixos.RuntimeExport"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string export_id = 1;
|
||||||
|
*/
|
||||||
|
exportId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string runtime_symbol = 2;
|
||||||
|
*/
|
||||||
|
runtimeSymbol: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.RuntimeExport.
|
||||||
|
* Use `create(RuntimeExportSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const RuntimeExportSchema: GenMessage<RuntimeExport> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_package, 1);
|
||||||
|
|
||||||
+222
-24
@@ -2,50 +2,248 @@
|
|||||||
// @generated from file quixos/refs.proto (package quixos, syntax proto3)
|
// @generated from file quixos/refs.proto (package quixos, syntax proto3)
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
||||||
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
||||||
import type { Message } from "@bufbuild/protobuf";
|
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("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zInYKC0Z1bmN0aW9uUmVmEhkKEXBhY2thZ2VfbmFtZXNwYWNlGAEgASgJEhQKDHBhY2thZ2VfbmFtZRgCIAEoCRIOCgZzeW1ib2wYAyABKAkSEwoLdmVyc2lvbl9yZWYYBCABKAkSEQoJb3BlcmF0aW9uGAUgASgJYgZwcm90bzM");
|
fileDesc("ChFxdWl4b3MvcmVmcy5wcm90bxIGcXVpeG9zInUKDUNhcGFiaWxpdHlSZWYSHQoVaW50ZXJmYWNlX3JldmlzaW9uX2lkGAEgASgJEhQKDG9wZXJhdGlvbl9pZBgCIAEoCRIvCgtjb25mb3JtYW5jZRgDIAEoCzIaLnF1aXhvcy5Db25mb3JtYW5jZVdpdG5lc3Mi0QEKDEZpZWxkRWRpdGluZxIbChNnZXR0ZXJfb3BlcmF0aW9uX2lkGAEgASgJEhsKE3NldHRlcl9vcGVyYXRpb25faWQYAiABKAkSFQoNZG9jdW1lbnRfdHlwZRgDIAEoCRIWCg5iaW5kaW5nX2RpZ2VzdBgEIAEoCRInCgRtb2RlGAUgASgOMhkucXVpeG9zLkZpZWxkRWRpdGluZy5Nb2RlIi8KBE1vZGUSDwoLVU5TUEVDSUZJRUQQABIMCghSRUdJU1RFUhABEggKBENSRFQQAiKWAQoSQ29uZm9ybWFuY2VXaXRuZXNzEhEKCW9iamVjdF9pZBgBIAEoCRIdChVpbnRlcmZhY2VfcmV2aXNpb25faWQYAiABKAkSFgoOY29uZm9ybWFuY2VfaWQYAyABKAkSHQoVd29ya3NwYWNlX3JldmlzaW9uX2lkGAQgASgJEhcKD3dvcmtzcGFjZV9lcG9jaBgFIAEoCSJCChBQYWNrYWdlRXhwb3J0UmVmEhsKE3BhY2thZ2VfcmV2aXNpb25faWQYASABKAkSEQoJZXhwb3J0X2lkGAIgASgJItgBChJJbmplY3RlZERlcGVuZGVuY3kSDwoHcG9ydF9pZBgBIAEoCRIXCg1zdGF0ZV9zbG90X2lkGAIgASgJSAASJgoEZWRnZRgDIAEoCzIWLnF1aXhvcy5FZGdlRGVwZW5kZW5jeUgAEh8KFWludGVyZmFjZV9yZXZpc2lvbl9pZBgEIAEoCUgAEh0KE2NvbnN0cnVjdG9yX2F0b21faWQYBSABKAlIABISCghxdWVyeV9pZBgHIAEoCUgAEhEKCW9iamVjdF9pZBgGIAEoCUIJCgdiaW5kaW5nIj0KDkVkZ2VEZXBlbmRlbmN5EhQKDGVkZ2VfdHlwZV9pZBgBIAEoCRIVCg1wcm9qZWN0aW9uX2lkGAIgASgJYgZwcm90bzM");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.FunctionRef
|
* @generated from message quixos.CapabilityRef
|
||||||
*/
|
*/
|
||||||
export type FunctionRef = Message<"quixos.FunctionRef"> & {
|
export type CapabilityRef = Message<"quixos.CapabilityRef"> & {
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_namespace = 1;
|
* @generated from field: string interface_revision_id = 1;
|
||||||
*/
|
*/
|
||||||
packageNamespace: string;
|
interfaceRevisionId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_name = 2;
|
* @generated from field: string operation_id = 2;
|
||||||
*/
|
*/
|
||||||
packageName: string;
|
operationId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string symbol = 3;
|
* Optional fence for a view acquired through TryConform. Not an authority grant.
|
||||||
|
*
|
||||||
|
* @generated from field: quixos.ConformanceWitness conformance = 3;
|
||||||
*/
|
*/
|
||||||
symbol: string;
|
conformance?: ConformanceWitness | undefined;
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated from field: string version_ref = 4;
|
|
||||||
*/
|
|
||||||
versionRef: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated from field: string operation = 5;
|
|
||||||
*/
|
|
||||||
operation: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the message quixos.FunctionRef.
|
* Describes the message quixos.CapabilityRef.
|
||||||
* Use `create(FunctionRefSchema)` to create a new message.
|
* Use `create(CapabilityRefSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const FunctionRefSchema: GenMessage<FunctionRef> = /*@__PURE__*/
|
export const CapabilityRefSchema: GenMessage<CapabilityRef> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_refs, 0);
|
messageDesc(file_quixos_refs, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolved native editing semantics. A source snapshot alone grants no writer.
|
||||||
|
*
|
||||||
|
* @generated from message quixos.FieldEditing
|
||||||
|
*/
|
||||||
|
export type FieldEditing = Message<"quixos.FieldEditing"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string getter_operation_id = 1;
|
||||||
|
*/
|
||||||
|
getterOperationId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string setter_operation_id = 2;
|
||||||
|
*/
|
||||||
|
setterOperationId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string document_type = 3;
|
||||||
|
*/
|
||||||
|
documentType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string binding_digest = 4;
|
||||||
|
*/
|
||||||
|
bindingDigest: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.FieldEditing.Mode mode = 5;
|
||||||
|
*/
|
||||||
|
mode: FieldEditing_Mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.FieldEditing.
|
||||||
|
* Use `create(FieldEditingSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const FieldEditingSchema: GenMessage<FieldEditing> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_refs, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from enum quixos.FieldEditing.Mode
|
||||||
|
*/
|
||||||
|
export enum FieldEditing_Mode {
|
||||||
|
/**
|
||||||
|
* @generated from enum value: UNSPECIFIED = 0;
|
||||||
|
*/
|
||||||
|
UNSPECIFIED = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from enum value: REGISTER = 1;
|
||||||
|
*/
|
||||||
|
REGISTER = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from enum value: CRDT = 2;
|
||||||
|
*/
|
||||||
|
CRDT = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the enum quixos.FieldEditing.Mode.
|
||||||
|
*/
|
||||||
|
export const FieldEditing_ModeSchema: GenEnum<FieldEditing_Mode> = /*@__PURE__*/
|
||||||
|
enumDesc(file_quixos_refs, 1, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.ConformanceWitness
|
||||||
|
*/
|
||||||
|
export type ConformanceWitness = Message<"quixos.ConformanceWitness"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string object_id = 1;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 2;
|
||||||
|
*/
|
||||||
|
interfaceRevisionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string conformance_id = 3;
|
||||||
|
*/
|
||||||
|
conformanceId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_revision_id = 4;
|
||||||
|
*/
|
||||||
|
workspaceRevisionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_epoch = 5;
|
||||||
|
*/
|
||||||
|
workspaceEpoch: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.ConformanceWitness.
|
||||||
|
* Use `create(ConformanceWitnessSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const ConformanceWitnessSchema: GenMessage<ConformanceWitness> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_refs, 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.PackageExportRef
|
||||||
|
*/
|
||||||
|
export type PackageExportRef = Message<"quixos.PackageExportRef"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string package_revision_id = 1;
|
||||||
|
*/
|
||||||
|
packageRevisionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string export_id = 2;
|
||||||
|
*/
|
||||||
|
exportId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.PackageExportRef.
|
||||||
|
* Use `create(PackageExportRefSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const PackageExportRefSchema: GenMessage<PackageExportRef> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_refs, 3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.InjectedDependency
|
||||||
|
*/
|
||||||
|
export type InjectedDependency = Message<"quixos.InjectedDependency"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string port_id = 1;
|
||||||
|
*/
|
||||||
|
portId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from oneof quixos.InjectedDependency.binding
|
||||||
|
*/
|
||||||
|
binding: {
|
||||||
|
/**
|
||||||
|
* @generated from field: string state_slot_id = 2;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "stateSlotId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.EdgeDependency edge = 3;
|
||||||
|
*/
|
||||||
|
value: EdgeDependency;
|
||||||
|
case: "edge";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string interface_revision_id = 4;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "interfaceRevisionId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string constructor_atom_id = 5;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "constructorAtomId";
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* @generated from field: string query_id = 7;
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
case: "queryId";
|
||||||
|
} | { case: undefined; value?: undefined };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defaults to the invocation receiver. A checked dependency traversal can
|
||||||
|
* select a related object explicitly before the package runtime starts.
|
||||||
|
*
|
||||||
|
* @generated from field: string object_id = 6;
|
||||||
|
*/
|
||||||
|
objectId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.InjectedDependency.
|
||||||
|
* Use `create(InjectedDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InjectedDependencySchema: GenMessage<InjectedDependency> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_refs, 4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.EdgeDependency
|
||||||
|
*/
|
||||||
|
export type EdgeDependency = Message<"quixos.EdgeDependency"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string edge_type_id = 1;
|
||||||
|
*/
|
||||||
|
edgeTypeId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string projection_id = 2;
|
||||||
|
*/
|
||||||
|
projectionId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.EdgeDependency.
|
||||||
|
* Use `create(EdgeDependencySchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const EdgeDependencySchema: GenMessage<EdgeDependency> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_refs, 5);
|
||||||
|
|
||||||
|
|||||||
+166
-25
@@ -6,7 +6,7 @@ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegen
|
|||||||
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
||||||
import type { Value } from "../camino/api_pb.js";
|
import type { Value } from "../camino/api_pb.js";
|
||||||
import { file_camino_api } from "../camino/api_pb.js";
|
import { file_camino_api } from "../camino/api_pb.js";
|
||||||
import type { FunctionRef } from "./refs_pb.js";
|
import type { InjectedDependency, PackageExportRef } from "./refs_pb.js";
|
||||||
import { file_quixos_refs } from "./refs_pb.js";
|
import { file_quixos_refs } from "./refs_pb.js";
|
||||||
import type { Message } from "@bufbuild/protobuf";
|
import type { Message } from "@bufbuild/protobuf";
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ import type { Message } from "@bufbuild/protobuf";
|
|||||||
* Describes the file quixos/runtime.proto.
|
* Describes the file quixos/runtime.proto.
|
||||||
*/
|
*/
|
||||||
export const file_quixos_runtime: GenFile = /*@__PURE__*/
|
export const file_quixos_runtime: GenFile = /*@__PURE__*/
|
||||||
fileDesc("ChRxdWl4b3MvcnVudGltZS5wcm90bxIOcXVpeG9zLnJ1bnRpbWUiMQoQSG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JvdG8z", [file_camino_api, file_quixos_refs]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.HandshakeRequest
|
* @generated from message quixos.runtime.HandshakeRequest
|
||||||
@@ -24,6 +24,11 @@ export type HandshakeRequest = Message<"quixos.runtime.HandshakeRequest"> & {
|
|||||||
* @generated from field: string orch_protocol_version = 1;
|
* @generated from field: string orch_protocol_version = 1;
|
||||||
*/
|
*/
|
||||||
orchProtocolVersion: string;
|
orchProtocolVersion: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string nonce = 2;
|
||||||
|
*/
|
||||||
|
nonce: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,24 +43,34 @@ export const HandshakeRequestSchema: GenMessage<HandshakeRequest> = /*@__PURE__*
|
|||||||
*/
|
*/
|
||||||
export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & {
|
export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & {
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_namespace = 1;
|
* @generated from field: string package_revision_id = 1;
|
||||||
*/
|
*/
|
||||||
packageNamespace: string;
|
packageRevisionId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string package_name = 2;
|
* @generated from field: string runtime_protocol_version = 2;
|
||||||
*/
|
|
||||||
packageName: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated from field: string runtime_protocol_version = 3;
|
|
||||||
*/
|
*/
|
||||||
runtimeProtocolVersion: string;
|
runtimeProtocolVersion: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: repeated quixos.FunctionRef functions = 4;
|
* @generated from field: repeated string export_ids = 3;
|
||||||
*/
|
*/
|
||||||
functions: FunctionRef[];
|
exportIds: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string instance_id = 4;
|
||||||
|
*/
|
||||||
|
instanceId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string authentication_proof = 5;
|
||||||
|
*/
|
||||||
|
authenticationProof: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated string capabilities = 6;
|
||||||
|
*/
|
||||||
|
capabilities: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +80,91 @@ export type HandshakeResponse = Message<"quixos.runtime.HandshakeResponse"> & {
|
|||||||
export const HandshakeResponseSchema: GenMessage<HandshakeResponse> = /*@__PURE__*/
|
export const HandshakeResponseSchema: GenMessage<HandshakeResponse> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 1);
|
messageDesc(file_quixos_runtime, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationContext
|
||||||
|
*/
|
||||||
|
export type InvocationContext = Message<"quixos.runtime.InvocationContext"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string workspace_epoch = 1;
|
||||||
|
*/
|
||||||
|
workspaceEpoch: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string instance_id = 2;
|
||||||
|
*/
|
||||||
|
instanceId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string binding_digest = 3;
|
||||||
|
*/
|
||||||
|
bindingDigest: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string grant = 4;
|
||||||
|
*/
|
||||||
|
grant: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: string session_id = 5;
|
||||||
|
*/
|
||||||
|
sessionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Host-selected owner; packages must not invent workspace-local ownership.
|
||||||
|
*
|
||||||
|
* @generated from field: string owner_conformance_id = 6;
|
||||||
|
*/
|
||||||
|
ownerConformanceId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationContext.
|
||||||
|
* Use `create(InvocationContextSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationContextSchema: GenMessage<InvocationContext> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_runtime, 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationControlRequest
|
||||||
|
*/
|
||||||
|
export type InvocationControlRequest = Message<"quixos.runtime.InvocationControlRequest"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationControlRequest.
|
||||||
|
* Use `create(InvocationControlRequestSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationControlRequestSchema: GenMessage<InvocationControlRequest> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_runtime, 3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from message quixos.runtime.InvocationStatus
|
||||||
|
*/
|
||||||
|
export type InvocationStatus = Message<"quixos.runtime.InvocationStatus"> & {
|
||||||
|
/**
|
||||||
|
* @generated from field: string invocation_id = 1;
|
||||||
|
*/
|
||||||
|
invocationId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* unknown, running, cancellation-requested, completed, failed
|
||||||
|
*
|
||||||
|
* @generated from field: string state = 2;
|
||||||
|
*/
|
||||||
|
state: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the message quixos.runtime.InvocationStatus.
|
||||||
|
* Use `create(InvocationStatusSchema)` to create a new message.
|
||||||
|
*/
|
||||||
|
export const InvocationStatusSchema: GenMessage<InvocationStatus> = /*@__PURE__*/
|
||||||
|
messageDesc(file_quixos_runtime, 4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.InvokeRequest
|
* @generated from message quixos.runtime.InvokeRequest
|
||||||
*/
|
*/
|
||||||
@@ -75,9 +175,9 @@ export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & {
|
|||||||
invocationId: string;
|
invocationId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: quixos.FunctionRef function = 2;
|
* @generated from field: quixos.PackageExportRef export = 2;
|
||||||
*/
|
*/
|
||||||
function?: FunctionRef | undefined;
|
export?: PackageExportRef | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string object_id = 3;
|
* @generated from field: string object_id = 3;
|
||||||
@@ -88,6 +188,16 @@ export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & {
|
|||||||
* @generated from field: map<string, camino.Value> input = 4;
|
* @generated from field: map<string, camino.Value> input = 4;
|
||||||
*/
|
*/
|
||||||
input: { [key: string]: Value };
|
input: { [key: string]: Value };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.InjectedDependency dependencies = 5;
|
||||||
|
*/
|
||||||
|
dependencies: InjectedDependency[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.runtime.InvocationContext context = 6;
|
||||||
|
*/
|
||||||
|
context?: InvocationContext | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +205,7 @@ export type InvokeRequest = Message<"quixos.runtime.InvokeRequest"> & {
|
|||||||
* Use `create(InvokeRequestSchema)` to create a new message.
|
* Use `create(InvokeRequestSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const InvokeRequestSchema: GenMessage<InvokeRequest> = /*@__PURE__*/
|
export const InvokeRequestSchema: GenMessage<InvokeRequest> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 2);
|
messageDesc(file_quixos_runtime, 5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.InvokeResponse
|
* @generated from message quixos.runtime.InvokeResponse
|
||||||
@@ -115,6 +225,11 @@ export type InvokeResponse = Message<"quixos.runtime.InvokeResponse"> & {
|
|||||||
* @generated from field: string error = 3;
|
* @generated from field: string error = 3;
|
||||||
*/
|
*/
|
||||||
error: string;
|
error: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.runtime.DerivedDependency dependencies = 4;
|
||||||
|
*/
|
||||||
|
dependencies: DerivedDependency[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +237,7 @@ export type InvokeResponse = Message<"quixos.runtime.InvokeResponse"> & {
|
|||||||
* Use `create(InvokeResponseSchema)` to create a new message.
|
* Use `create(InvokeResponseSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const InvokeResponseSchema: GenMessage<InvokeResponse> = /*@__PURE__*/
|
export const InvokeResponseSchema: GenMessage<InvokeResponse> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 3);
|
messageDesc(file_quixos_runtime, 6);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.WatchRequest
|
* @generated from message quixos.runtime.WatchRequest
|
||||||
@@ -134,9 +249,9 @@ export type WatchRequest = Message<"quixos.runtime.WatchRequest"> & {
|
|||||||
invocationId: string;
|
invocationId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: quixos.FunctionRef function = 2;
|
* @generated from field: quixos.PackageExportRef export = 2;
|
||||||
*/
|
*/
|
||||||
function?: FunctionRef | undefined;
|
export?: PackageExportRef | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string object_id = 3;
|
* @generated from field: string object_id = 3;
|
||||||
@@ -147,6 +262,16 @@ export type WatchRequest = Message<"quixos.runtime.WatchRequest"> & {
|
|||||||
* @generated from field: map<string, camino.Value> input = 4;
|
* @generated from field: map<string, camino.Value> input = 4;
|
||||||
*/
|
*/
|
||||||
input: { [key: string]: Value };
|
input: { [key: string]: Value };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: repeated quixos.InjectedDependency dependencies = 5;
|
||||||
|
*/
|
||||||
|
dependencies: InjectedDependency[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generated from field: quixos.runtime.InvocationContext context = 6;
|
||||||
|
*/
|
||||||
|
context?: InvocationContext | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +279,7 @@ export type WatchRequest = Message<"quixos.runtime.WatchRequest"> & {
|
|||||||
* Use `create(WatchRequestSchema)` to create a new message.
|
* Use `create(WatchRequestSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const WatchRequestSchema: GenMessage<WatchRequest> = /*@__PURE__*/
|
export const WatchRequestSchema: GenMessage<WatchRequest> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 4);
|
messageDesc(file_quixos_runtime, 7);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.DerivedDependency
|
* @generated from message quixos.runtime.DerivedDependency
|
||||||
@@ -171,14 +296,14 @@ export type DerivedDependency = Message<"quixos.runtime.DerivedDependency"> & {
|
|||||||
objectId: string;
|
objectId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string field_name = 3;
|
* @generated from field: string attachment_id = 3;
|
||||||
*/
|
*/
|
||||||
fieldName: string;
|
attachmentId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from field: string source_field = 4;
|
* @generated from field: string projection_id = 4;
|
||||||
*/
|
*/
|
||||||
sourceField: string;
|
projectionId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +311,7 @@ export type DerivedDependency = Message<"quixos.runtime.DerivedDependency"> & {
|
|||||||
* Use `create(DerivedDependencySchema)` to create a new message.
|
* Use `create(DerivedDependencySchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const DerivedDependencySchema: GenMessage<DerivedDependency> = /*@__PURE__*/
|
export const DerivedDependencySchema: GenMessage<DerivedDependency> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 5);
|
messageDesc(file_quixos_runtime, 8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from message quixos.runtime.WatchEvent
|
* @generated from message quixos.runtime.WatchEvent
|
||||||
@@ -223,7 +348,7 @@ export type WatchEvent = Message<"quixos.runtime.WatchEvent"> & {
|
|||||||
* Use `create(WatchEventSchema)` to create a new message.
|
* Use `create(WatchEventSchema)` to create a new message.
|
||||||
*/
|
*/
|
||||||
export const WatchEventSchema: GenMessage<WatchEvent> = /*@__PURE__*/
|
export const WatchEventSchema: GenMessage<WatchEvent> = /*@__PURE__*/
|
||||||
messageDesc(file_quixos_runtime, 6);
|
messageDesc(file_quixos_runtime, 9);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated from service quixos.runtime.PackageRuntime
|
* @generated from service quixos.runtime.PackageRuntime
|
||||||
@@ -253,6 +378,22 @@ export const PackageRuntime: GenService<{
|
|||||||
input: typeof WatchRequestSchema;
|
input: typeof WatchRequestSchema;
|
||||||
output: typeof WatchEventSchema;
|
output: typeof WatchEventSchema;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.runtime.PackageRuntime.GetInvocationStatus
|
||||||
|
*/
|
||||||
|
getInvocationStatus: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvocationControlRequestSchema;
|
||||||
|
output: typeof InvocationStatusSchema;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @generated from rpc quixos.runtime.PackageRuntime.CancelInvocation
|
||||||
|
*/
|
||||||
|
cancelInvocation: {
|
||||||
|
methodKind: "unary";
|
||||||
|
input: typeof InvocationControlRequestSchema;
|
||||||
|
output: typeof InvocationStatusSchema;
|
||||||
|
},
|
||||||
}> = /*@__PURE__*/
|
}> = /*@__PURE__*/
|
||||||
serviceDesc(file_quixos_runtime, 0);
|
serviceDesc(file_quixos_runtime, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/** Opaque runtime identity. The wire codec, never ordinary package state, owns
|
||||||
|
* the raw ID. These handles do not themselves confer authority or a lease. */
|
||||||
|
const identities = new WeakMap<object, string>();
|
||||||
|
declare const referenceBrand: unique symbol;
|
||||||
|
export interface QxObjectRef<Identity extends string = string> {
|
||||||
|
readonly [referenceBrand]: { readonly [K in Identity]: true };
|
||||||
|
equals(other: QxObjectRef<string>): boolean;
|
||||||
|
}
|
||||||
|
class Reference {
|
||||||
|
constructor(id: string) {
|
||||||
|
identities.set(this, id);
|
||||||
|
Object.freeze(this);
|
||||||
|
}
|
||||||
|
equals(other: unknown) {
|
||||||
|
return isObjectReference(other) && identities.get(this) === identities.get(other);
|
||||||
|
}
|
||||||
|
toJSON(): never {
|
||||||
|
throw new Error("Object references cannot be serialized into ordinary data");
|
||||||
|
}
|
||||||
|
toString(): never {
|
||||||
|
throw new Error("Object references cannot be coerced to strings");
|
||||||
|
}
|
||||||
|
[Symbol.toPrimitive](): never {
|
||||||
|
throw new Error("Object references cannot be coerced to scalar values");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const isObjectReference = (value: unknown): value is QxObjectRef =>
|
||||||
|
typeof value === "object" && value !== null && identities.has(value);
|
||||||
|
|
||||||
|
/** Internal transport boundary; intentionally not exported from the SDK entry. */
|
||||||
|
export const referenceFromWire = (id: string): QxObjectRef => {
|
||||||
|
if (typeof id !== "string" || !id) throw new Error("Missing object reference identity");
|
||||||
|
return new Reference(id) as unknown as QxObjectRef;
|
||||||
|
};
|
||||||
|
export const referenceToWire = (value: unknown): string => {
|
||||||
|
if (!isObjectReference(value)) throw new Error("Expected an opaque object reference, not a raw ID");
|
||||||
|
return identities.get(value)!;
|
||||||
|
};
|
||||||
|
export const assertReferenceFree = (value: unknown, seen = new Set<object>()): void => {
|
||||||
|
if (!value || typeof value !== "object") return;
|
||||||
|
if (isObjectReference(value))
|
||||||
|
throw new Error(
|
||||||
|
"Managed references belong in declared RPC references or graph relationships, not ordinary state/messages",
|
||||||
|
);
|
||||||
|
if (seen.has(value)) throw new Error("Cyclic ordinary data");
|
||||||
|
seen.add(value);
|
||||||
|
if (!(value instanceof Uint8Array)) for (const child of Object.values(value)) assertReferenceFree(child, seen);
|
||||||
|
seen.delete(value);
|
||||||
|
};
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import type { QxObjectRef } from "./references.js";
|
||||||
|
import type { RelationshipCollection, RelationshipEntry } from "./index.js";
|
||||||
|
type Key = string | boolean | bigint;
|
||||||
|
type Port<T extends QxObjectRef> = {
|
||||||
|
collection(): Promise<RelationshipCollection<T>>;
|
||||||
|
replace(entries: RelationshipEntry<T>[], expectedRevision: bigint): Promise<RelationshipCollection<T>>;
|
||||||
|
};
|
||||||
|
const checked = async <T extends QxObjectRef>(port: Port<T>, revision: bigint) => {
|
||||||
|
const snapshot = await port.collection();
|
||||||
|
if (snapshot.revision !== revision) throw new Error("STALE_COLLECTION_REVISION");
|
||||||
|
return snapshot;
|
||||||
|
};
|
||||||
|
/** Helpers never retry a failed CAS or silently overwrite concurrent edits. */
|
||||||
|
export const relationshipMap = <T extends QxObjectRef, K extends Key = Key>(port: Port<T>) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async get(key: K) {
|
||||||
|
const snapshot = await port.collection();
|
||||||
|
return { revision: snapshot.revision, value: snapshot.entries.find((entry) => entry.key === key)?.target };
|
||||||
|
},
|
||||||
|
async set(key: K, target: T, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
const entries = snapshot.entries.filter((entry) => entry.key !== key);
|
||||||
|
const existing = snapshot.entries.find((entry) => entry.key === key && entry.target.equals(target));
|
||||||
|
entries.push(existing ?? { key, target });
|
||||||
|
return port.replace(entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(key: K, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
return port.replace(
|
||||||
|
snapshot.entries.filter((entry) => entry.key !== key),
|
||||||
|
expectedRevision,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const relationshipList = <T extends QxObjectRef>(port: Port<T>) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async insert(index: number, target: T, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (!Number.isSafeInteger(index) || index < 0 || index > snapshot.entries.length)
|
||||||
|
throw new Error("List index out of bounds");
|
||||||
|
snapshot.entries.splice(index, 0, { target });
|
||||||
|
return port.replace(snapshot.entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async move(edgeId: string, index: number, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
const prior = snapshot.entries.findIndex((entry) => entry.edgeId === edgeId);
|
||||||
|
if (prior < 0 || !Number.isSafeInteger(index) || index < 0 || index >= snapshot.entries.length)
|
||||||
|
throw new Error("Unknown list entry or invalid index");
|
||||||
|
const [entry] = snapshot.entries.splice(prior, 1);
|
||||||
|
snapshot.entries.splice(index, 0, entry);
|
||||||
|
return port.replace(snapshot.entries, expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(edgeId: string, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (!snapshot.entries.some((entry) => entry.edgeId === edgeId)) throw new Error("Unknown list entry");
|
||||||
|
return port.replace(
|
||||||
|
snapshot.entries.filter((entry) => entry.edgeId !== edgeId),
|
||||||
|
expectedRevision,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const relationshipSet = <T extends QxObjectRef>(port: Port<T>) => ({
|
||||||
|
read: () => port.collection(),
|
||||||
|
async add(target: T, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
if (snapshot.entries.some((entry) => entry.target.equals(target))) return snapshot;
|
||||||
|
return port.replace([...snapshot.entries, { target }], expectedRevision);
|
||||||
|
},
|
||||||
|
async delete(target: T, expectedRevision: bigint) {
|
||||||
|
const snapshot = await checked(port, expectedRevision);
|
||||||
|
return port.replace(
|
||||||
|
snapshot.entries.filter((entry) => !entry.target.equals(target)),
|
||||||
|
expectedRevision,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,978 +0,0 @@
|
|||||||
import fs from "node:fs";
|
|
||||||
import path from "node:path";
|
|
||||||
import protobuf from "protobufjs";
|
|
||||||
import type {
|
|
||||||
Cardinality,
|
|
||||||
ClassSchema,
|
|
||||||
ConflictStrategy,
|
|
||||||
FieldSchema,
|
|
||||||
FieldStorage,
|
|
||||||
FieldStorageKind,
|
|
||||||
FunctionRef,
|
|
||||||
InterfaceFieldContract,
|
|
||||||
InterfaceImplementation,
|
|
||||||
InterfaceSchema,
|
|
||||||
MethodSchema,
|
|
||||||
OperationSchema,
|
|
||||||
OperationServiceSchema,
|
|
||||||
MigrationSpec,
|
|
||||||
SchemaCompileResult,
|
|
||||||
SymbolRef,
|
|
||||||
EdgeDirectionality,
|
|
||||||
TypeRef,
|
|
||||||
} from "./schema-ir.js";
|
|
||||||
|
|
||||||
type OptionBag = Record<string, unknown>;
|
|
||||||
|
|
||||||
const CLASS_OPTION = "(camino.class)";
|
|
||||||
const INTERFACE_OPTION = "(camino.interface)";
|
|
||||||
const IMPLEMENTS_OPTION = "(camino.implements)";
|
|
||||||
const CONSTRUCTOR_OPTION = "(camino.constructor)";
|
|
||||||
const METHOD_OPTION = "(camino.method)";
|
|
||||||
const MIGRATION_OPTION = "(camino.migration)";
|
|
||||||
const CONFLICT_OPTION = "(camino.conflict)";
|
|
||||||
const EDGE_OPTION = "(camino.edge)";
|
|
||||||
const FIELD_STORAGE_OPTION = "(camino.field_storage)";
|
|
||||||
const FIELD_OPS_OPTION = "(camino.field_ops)";
|
|
||||||
const INTERFACE_FIELD_OPTION = "(camino.interface_field)";
|
|
||||||
const DISPLAY_LABEL_OPTION = "(camino.display_label)";
|
|
||||||
const IMPL_OPTION = "(camino.impl)";
|
|
||||||
const SCHEMA_NAMESPACE_OPTION = "(camino.schema_namespace)";
|
|
||||||
const SCHEMA_VERSION_OPTION = "(camino.schema_version)";
|
|
||||||
|
|
||||||
const enumName = (value: unknown) =>
|
|
||||||
String(value)
|
|
||||||
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
||||||
.replace(/-/g, "_")
|
|
||||||
.toUpperCase();
|
|
||||||
|
|
||||||
const lowerEnumName = (value: unknown) => enumName(value).toLowerCase();
|
|
||||||
|
|
||||||
const getOption = (
|
|
||||||
options: OptionBag | undefined,
|
|
||||||
name: string,
|
|
||||||
): unknown => {
|
|
||||||
if (!options) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (Object.hasOwn(options, name)) {
|
|
||||||
return options[name];
|
|
||||||
}
|
|
||||||
const bareName = name.replace(/^\((.*)\)$/, "$1");
|
|
||||||
if (Object.hasOwn(options, bareName)) {
|
|
||||||
return options[bareName];
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getParsedOptions = (
|
|
||||||
reflection: protobuf.ReflectionObject,
|
|
||||||
): OptionBag[] => {
|
|
||||||
const parsedOptions = (reflection as unknown as { parsedOptions?: unknown })
|
|
||||||
.parsedOptions;
|
|
||||||
return Array.isArray(parsedOptions)
|
|
||||||
? parsedOptions.filter(
|
|
||||||
(option): option is OptionBag =>
|
|
||||||
Boolean(option) && typeof option === "object" && !Array.isArray(option),
|
|
||||||
)
|
|
||||||
: [];
|
|
||||||
};
|
|
||||||
|
|
||||||
const getReflectionOptions = (
|
|
||||||
reflection: protobuf.ReflectionObject,
|
|
||||||
name: string,
|
|
||||||
): unknown[] => {
|
|
||||||
const parsedValues = getParsedOptions(reflection).flatMap((option) => {
|
|
||||||
const value = getOption(option, name);
|
|
||||||
return value === undefined ? [] : [value];
|
|
||||||
});
|
|
||||||
if (parsedValues.length > 0) {
|
|
||||||
return parsedValues;
|
|
||||||
}
|
|
||||||
const value = getOption(reflection.options, name);
|
|
||||||
return value === undefined ? [] : [value];
|
|
||||||
};
|
|
||||||
|
|
||||||
const getReflectionOption = (
|
|
||||||
reflection: protobuf.ReflectionObject,
|
|
||||||
name: string,
|
|
||||||
): unknown => getReflectionOptions(reflection, name)[0];
|
|
||||||
|
|
||||||
const asObject = (value: unknown): OptionBag | undefined =>
|
|
||||||
value && typeof value === "object" && !Array.isArray(value)
|
|
||||||
? (value as OptionBag)
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const asArray = (value: unknown): unknown[] =>
|
|
||||||
Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
||||||
|
|
||||||
const readString = (
|
|
||||||
object: OptionBag | undefined,
|
|
||||||
key: string,
|
|
||||||
): string | undefined => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "string" ? value : undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const readNumber = (
|
|
||||||
object: OptionBag | undefined,
|
|
||||||
key: string,
|
|
||||||
): number | undefined => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "number" && Number.isFinite(value)
|
|
||||||
? value
|
|
||||||
: undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const readBoolean = (
|
|
||||||
object: OptionBag | undefined,
|
|
||||||
key: string,
|
|
||||||
): boolean | undefined => {
|
|
||||||
const value = object?.[key];
|
|
||||||
return typeof value === "boolean" ? value : undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const symbolRefFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
fallback: SymbolRef,
|
|
||||||
): SymbolRef => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
namespace: readString(object, "namespace") ?? fallback.namespace,
|
|
||||||
name: readString(object, "name") ?? fallback.name,
|
|
||||||
version: readString(object, "version") ?? fallback.version,
|
|
||||||
...(readString(object, "hash")
|
|
||||||
? { hash: readString(object, "hash") }
|
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const typeRefFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
fallbackVersion: string,
|
|
||||||
): TypeRef | undefined => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const symbol = asObject(object.symbol)
|
|
||||||
? symbolRefFromOption(object.symbol, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: fallbackVersion,
|
|
||||||
})
|
|
||||||
: undefined;
|
|
||||||
const protoType = readString(object, "proto_type")?.replace(/^\./, "");
|
|
||||||
const symbolProtoType =
|
|
||||||
symbol?.namespace && symbol.name ? `${symbol.namespace}.${symbol.name}` : "";
|
|
||||||
const resolvedProtoType = protoType ?? symbolProtoType;
|
|
||||||
if (!resolvedProtoType) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
protoType: resolvedProtoType,
|
|
||||||
...(symbol?.namespace && symbol.name ? { symbol } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const interfaceFieldContractFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
schemaVersion: string,
|
|
||||||
): InterfaceFieldContract | undefined => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const type = typeRefFromOption(object.type, schemaVersion);
|
|
||||||
const refTargetTypeParam = readString(object, "ref_target_type_param");
|
|
||||||
const edgeCardinality =
|
|
||||||
object.edge_cardinality === undefined
|
|
||||||
? undefined
|
|
||||||
: cardinalityFromOption(object.edge_cardinality);
|
|
||||||
return {
|
|
||||||
required: readBoolean(object, "required") ?? false,
|
|
||||||
readable: readBoolean(object, "readable") ?? false,
|
|
||||||
writable: readBoolean(object, "writable") ?? false,
|
|
||||||
watchable: readBoolean(object, "watchable") ?? false,
|
|
||||||
...(readString(object, "type_param")
|
|
||||||
? { typeParam: readString(object, "type_param") }
|
|
||||||
: {}),
|
|
||||||
...(type ? { type } : {}),
|
|
||||||
...(refTargetTypeParam ? { refTargetTypeParam } : {}),
|
|
||||||
...(edgeCardinality ? { edgeCardinality } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const functionRefFromOption = (value: unknown): FunctionRef => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
throw new Error("Expected function ref option object");
|
|
||||||
}
|
|
||||||
const packageNamespace = readString(object, "package_namespace");
|
|
||||||
const packageName = readString(object, "package_name");
|
|
||||||
const symbol = readString(object, "symbol");
|
|
||||||
if (!packageNamespace || !packageName || !symbol) {
|
|
||||||
throw new Error("Function ref requires package_namespace, package_name, and symbol");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
packageNamespace,
|
|
||||||
packageName,
|
|
||||||
symbol,
|
|
||||||
...(readString(object, "operation")
|
|
||||||
? { operation: readString(object, "operation") }
|
|
||||||
: {}),
|
|
||||||
...(readString(object, "version_ref")
|
|
||||||
? { versionRef: readString(object, "version_ref") }
|
|
||||||
: {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const conflictFromOption = (value: unknown): ConflictStrategy => {
|
|
||||||
const normalized = enumName(value);
|
|
||||||
if (!value || normalized === "CONFLICT_STRATEGY_UNSPECIFIED") {
|
|
||||||
return "preserve_conflicts";
|
|
||||||
}
|
|
||||||
if (normalized === "REPLACE") {
|
|
||||||
return "replace";
|
|
||||||
}
|
|
||||||
if (normalized === "PRESERVE_CONFLICTS") {
|
|
||||||
return "preserve_conflicts";
|
|
||||||
}
|
|
||||||
if (normalized === "CRDT") {
|
|
||||||
return "crdt";
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino conflict strategy: ${String(value)}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const cardinalityFromOption = (value: unknown): Cardinality => {
|
|
||||||
const normalized = lowerEnumName(value);
|
|
||||||
if (!value || normalized === "cardinality_unspecified") {
|
|
||||||
return "many";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalized === "optional_one" ||
|
|
||||||
normalized === "exactly_one" ||
|
|
||||||
normalized === "many" ||
|
|
||||||
normalized === "many_unique" ||
|
|
||||||
normalized === "many_ordered" ||
|
|
||||||
normalized === "many_unique_ordered"
|
|
||||||
) {
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino cardinality: ${String(value)}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fieldStorageKindFromOption = (value: unknown): FieldStorageKind => {
|
|
||||||
if (value === 5) {
|
|
||||||
return "static_final";
|
|
||||||
}
|
|
||||||
const normalized = lowerEnumName(value);
|
|
||||||
if (!value || normalized === "field_storage_kind_unspecified") {
|
|
||||||
return "stored";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalized === "stored" ||
|
|
||||||
normalized === "derived" ||
|
|
||||||
normalized === "lazy" ||
|
|
||||||
normalized === "external" ||
|
|
||||||
normalized === "static_final"
|
|
||||||
) {
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown Camino field storage kind: ${String(value)}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fieldStorageFromOption = (value: unknown): FieldStorage => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return {
|
|
||||||
kind: "stored",
|
|
||||||
cache: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const kind = fieldStorageKindFromOption(object.kind);
|
|
||||||
const resolver = object.resolver === undefined
|
|
||||||
? undefined
|
|
||||||
: functionRefFromOption(object.resolver);
|
|
||||||
if ((kind === "derived" || kind === "lazy" || kind === "external") && !resolver) {
|
|
||||||
throw new Error(`${kind} field storage requires resolver`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
kind,
|
|
||||||
...(resolver ? { resolver } : {}),
|
|
||||||
cache: object.cache === true,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const fieldOpsFromOption = (value: unknown) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const implementation = enumName(object.implementation);
|
|
||||||
if (implementation !== "SERVICE") {
|
|
||||||
throw new Error(
|
|
||||||
`Unsupported Camino field implementation: ${String(object.implementation)}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const service = readString(object, "service");
|
|
||||||
if (!service) {
|
|
||||||
throw new Error("SERVICE field_ops requires service");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
implementation: "service" as const,
|
|
||||||
service,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractFileDefaults = (sourceFile: string) => {
|
|
||||||
const text = fs.readFileSync(sourceFile, "utf8");
|
|
||||||
const packageMatch = /^\s*package\s+([a-zA-Z0-9_.]+)\s*;/m.exec(text);
|
|
||||||
const namespaceMatch =
|
|
||||||
/^\s*option\s+\(camino\.schema_namespace\)\s*=\s*"([^"]+)"\s*;/m.exec(
|
|
||||||
text,
|
|
||||||
);
|
|
||||||
const versionMatch =
|
|
||||||
/^\s*option\s+\(camino\.schema_version\)\s*=\s*"([^"]+)"\s*;/m.exec(text);
|
|
||||||
|
|
||||||
return {
|
|
||||||
packageName: packageMatch?.[1] ?? "",
|
|
||||||
schemaNamespace: namespaceMatch?.[1] ?? packageMatch?.[1] ?? "",
|
|
||||||
schemaVersion: versionMatch?.[1] ?? "1",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const protoSymbolFromReflection = (
|
|
||||||
reflection: protobuf.ReflectionObject | null,
|
|
||||||
fallbackVersion: string,
|
|
||||||
): SymbolRef | undefined => {
|
|
||||||
if (!reflection?.fullName) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const parts = reflection.fullName.replace(/^\./, "").split(".");
|
|
||||||
const name = parts.pop();
|
|
||||||
if (!name) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
namespace: parts.join("."),
|
|
||||||
name,
|
|
||||||
version: fallbackVersion,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const typeRefForField = (
|
|
||||||
field: protobuf.Field,
|
|
||||||
schemaVersion: string,
|
|
||||||
): TypeRef => {
|
|
||||||
const symbol = protoSymbolFromReflection(field.resolvedType, schemaVersion);
|
|
||||||
const enumValues =
|
|
||||||
field.resolvedType instanceof protobuf.Enum
|
|
||||||
? Object.entries(field.resolvedType.values)
|
|
||||||
.filter(([_name, value]) => value !== 0)
|
|
||||||
.map(([name]) => name)
|
|
||||||
: undefined;
|
|
||||||
return {
|
|
||||||
protoType: field.type,
|
|
||||||
...(symbol ? { symbol } : {}),
|
|
||||||
...(enumValues ? { enumValues } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const typeRefForType = (
|
|
||||||
type: protobuf.Type | undefined,
|
|
||||||
fallbackType: string,
|
|
||||||
schemaVersion: string,
|
|
||||||
): TypeRef => {
|
|
||||||
const symbol = protoSymbolFromReflection(type ?? null, schemaVersion);
|
|
||||||
return {
|
|
||||||
protoType: type?.fullName?.replace(/^\./, "") ?? fallbackType,
|
|
||||||
...(symbol ? { symbol } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const fieldSchemaFromField = (
|
|
||||||
field: protobuf.Field,
|
|
||||||
schemaVersion: string,
|
|
||||||
): FieldSchema => {
|
|
||||||
const storage = fieldStorageFromOption(
|
|
||||||
getReflectionOption(field, FIELD_STORAGE_OPTION),
|
|
||||||
);
|
|
||||||
const ops = fieldOpsFromOption(getReflectionOption(field, FIELD_OPS_OPTION));
|
|
||||||
if (ops && storage.kind !== "stored" && storage.kind !== "static_final") {
|
|
||||||
throw new Error(
|
|
||||||
`Field ${field.fullName} cannot declare both field_ops and package-resolved storage`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (storage.kind === "static_final" && !ops) {
|
|
||||||
throw new Error(`Field ${field.fullName} with static_final storage requires field_ops`);
|
|
||||||
}
|
|
||||||
const interfaceContract = interfaceFieldContractFromOption(
|
|
||||||
getReflectionOption(field, INTERFACE_FIELD_OPTION),
|
|
||||||
schemaVersion,
|
|
||||||
);
|
|
||||||
return {
|
|
||||||
name: field.name,
|
|
||||||
tag: field.id,
|
|
||||||
type: typeRefForField(field, schemaVersion),
|
|
||||||
conflict: conflictFromOption(getReflectionOption(field, CONFLICT_OPTION)),
|
|
||||||
repeated: field.repeated,
|
|
||||||
optional: field.optional,
|
|
||||||
storage,
|
|
||||||
...(ops ? { ops } : {}),
|
|
||||||
...(interfaceContract ? { interfaceContract } : {}),
|
|
||||||
isDisplayLabel: getReflectionOption(field, DISPLAY_LABEL_OPTION) === true,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const isManyCardinality = (cardinality: Cardinality) =>
|
|
||||||
cardinality === "many" ||
|
|
||||||
cardinality === "many_unique" ||
|
|
||||||
cardinality === "many_ordered" ||
|
|
||||||
cardinality === "many_unique_ordered";
|
|
||||||
|
|
||||||
const materializationFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
fallbackVersion: string,
|
|
||||||
) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const classRef = symbolRefFromOption(object.class, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: fallbackVersion,
|
|
||||||
});
|
|
||||||
if (!classRef.name) {
|
|
||||||
throw new Error("Edge materialization requires class");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
class: classRef,
|
|
||||||
connectProjection: readString(object, "connect_projection") ?? "",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const endpointFromOption = (params: {
|
|
||||||
option: unknown;
|
|
||||||
fallbackClass?: SymbolRef;
|
|
||||||
fallbackProjection: string;
|
|
||||||
fallbackCardinality: Cardinality;
|
|
||||||
fallbackVersion: string;
|
|
||||||
}) => {
|
|
||||||
const object = asObject(params.option);
|
|
||||||
const classRef = asObject(object?.class)
|
|
||||||
? symbolRefFromOption(object?.class, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: params.fallbackVersion,
|
|
||||||
})
|
|
||||||
: params.fallbackClass;
|
|
||||||
const interfaceRef = asObject(object?.interface)
|
|
||||||
? symbolRefFromOption(object?.interface, {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: params.fallbackVersion,
|
|
||||||
})
|
|
||||||
: undefined;
|
|
||||||
const projection = readString(object, "projection") ?? params.fallbackProjection;
|
|
||||||
const cardinality = object?.cardinality === undefined
|
|
||||||
? params.fallbackCardinality
|
|
||||||
: cardinalityFromOption(object.cardinality);
|
|
||||||
const materialization = materializationFromOption(
|
|
||||||
object?.materialize,
|
|
||||||
params.fallbackVersion,
|
|
||||||
);
|
|
||||||
if (!classRef?.name && !interfaceRef?.name) {
|
|
||||||
throw new Error(`Edge endpoint ${projection} requires class or interface`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...(classRef?.name ? { class: classRef } : {}),
|
|
||||||
...(interfaceRef?.name ? { interface: interfaceRef } : {}),
|
|
||||||
projection,
|
|
||||||
cardinality,
|
|
||||||
indexed: readBoolean(object, "indexed") ?? false,
|
|
||||||
...(materialization ? { materialization } : {}),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const symbolKey = (ref: SymbolRef | undefined) =>
|
|
||||||
ref ? [ref.namespace, ref.name, ref.version, ref.hash ?? ""].join(":") : "";
|
|
||||||
|
|
||||||
const endpointRoleKey = (endpoint: ReturnType<typeof endpointFromOption>) =>
|
|
||||||
[
|
|
||||||
symbolKey(endpoint.class),
|
|
||||||
symbolKey(endpoint.interface),
|
|
||||||
endpoint.projection,
|
|
||||||
endpoint.cardinality,
|
|
||||||
].join("|");
|
|
||||||
|
|
||||||
const normalizeEdgeEndpoints = (params: {
|
|
||||||
directionality: "directed" | "undirected";
|
|
||||||
fromEndpoint: ReturnType<typeof endpointFromOption>;
|
|
||||||
toEndpoint: ReturnType<typeof endpointFromOption>;
|
|
||||||
}) => {
|
|
||||||
if (params.directionality === "directed") {
|
|
||||||
return {
|
|
||||||
fromEndpoint: params.fromEndpoint,
|
|
||||||
toEndpoint: params.toEndpoint,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return endpointRoleKey(params.fromEndpoint) <= endpointRoleKey(params.toEndpoint)
|
|
||||||
? {
|
|
||||||
fromEndpoint: params.fromEndpoint,
|
|
||||||
toEndpoint: params.toEndpoint,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
fromEndpoint: params.toEndpoint,
|
|
||||||
toEndpoint: params.fromEndpoint,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const symbolArrayFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
defaults: ReturnType<typeof extractFileDefaults>,
|
|
||||||
) =>
|
|
||||||
asArray(value)
|
|
||||||
.map((item) =>
|
|
||||||
symbolRefFromOption(item, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.filter((symbol) => Boolean(symbol.name));
|
|
||||||
|
|
||||||
const isStringType = (type: TypeRef) =>
|
|
||||||
type.protoType === "string" || type.protoType === "google.protobuf.StringValue";
|
|
||||||
|
|
||||||
const validateDisplayLabelFields = (
|
|
||||||
type: protobuf.Type,
|
|
||||||
fields: FieldSchema[],
|
|
||||||
operationServices: OperationServiceSchema[],
|
|
||||||
) => {
|
|
||||||
const displayLabelFields = fields.filter((field) => field.isDisplayLabel);
|
|
||||||
if (displayLabelFields.length > 1) {
|
|
||||||
throw new Error(
|
|
||||||
`Class ${type.fullName} declares multiple Camino display label fields`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const displayLabelField = displayLabelFields[0];
|
|
||||||
if (!displayLabelField) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!displayLabelField.ops) {
|
|
||||||
if (!isStringType(displayLabelField.type)) {
|
|
||||||
throw new Error(
|
|
||||||
`Display label field ${type.fullName}.${displayLabelField.name} must have string type`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const serviceName = displayLabelField.ops.service.replace(/^\./, "");
|
|
||||||
const getOperation = operationServices
|
|
||||||
.find((service) => service.fullName === serviceName)
|
|
||||||
?.operations.find((operation) => operation.name === "Get");
|
|
||||||
if (!getOperation || !isStringType(getOperation.outputType)) {
|
|
||||||
throw new Error(
|
|
||||||
`Display label field ${type.fullName}.${displayLabelField.name} must resolve to string`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const typeBindingFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
schemaVersion: string,
|
|
||||||
) => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const name = readString(object, "name");
|
|
||||||
const type = typeRefFromOption(object.type, schemaVersion);
|
|
||||||
if (!name || !type) {
|
|
||||||
throw new Error("Interface type_binding requires name and type");
|
|
||||||
}
|
|
||||||
return { name, type };
|
|
||||||
};
|
|
||||||
|
|
||||||
const interfaceImplementationFromOption = (
|
|
||||||
value: unknown,
|
|
||||||
defaults: ReturnType<typeof extractFileDefaults>,
|
|
||||||
): InterfaceImplementation => {
|
|
||||||
const object = asObject(value);
|
|
||||||
if (!object) {
|
|
||||||
throw new Error("Expected implements option object");
|
|
||||||
}
|
|
||||||
const interfaceId = symbolRefFromOption(object.interface, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
if (!interfaceId.name) {
|
|
||||||
throw new Error("implements option requires interface name");
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
interface: interfaceId,
|
|
||||||
typeBindings: asArray(object.type_binding)
|
|
||||||
.map((binding) => typeBindingFromOption(binding, defaults.schemaVersion))
|
|
||||||
.filter((binding): binding is NonNullable<typeof binding> =>
|
|
||||||
Boolean(binding),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const serviceName = (service: protobuf.Service) =>
|
|
||||||
service.fullName.replace(/^\./, "");
|
|
||||||
|
|
||||||
const operationFromMethod = (
|
|
||||||
method: protobuf.Method,
|
|
||||||
schemaVersion: string,
|
|
||||||
): OperationSchema => {
|
|
||||||
const fn = functionRefFromOption(getReflectionOption(method, IMPL_OPTION));
|
|
||||||
const methodWithTypes = method as protobuf.Method & {
|
|
||||||
resolvedRequestType?: protobuf.Type;
|
|
||||||
resolvedResponseType?: protobuf.Type;
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
name: method.name,
|
|
||||||
inputType: typeRefForType(
|
|
||||||
methodWithTypes.resolvedRequestType,
|
|
||||||
method.requestType,
|
|
||||||
schemaVersion,
|
|
||||||
),
|
|
||||||
outputType: typeRefForType(
|
|
||||||
methodWithTypes.resolvedResponseType,
|
|
||||||
method.responseType,
|
|
||||||
schemaVersion,
|
|
||||||
),
|
|
||||||
function: fn,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const operationServiceFromService = (
|
|
||||||
service: protobuf.Service,
|
|
||||||
schemaVersion: string,
|
|
||||||
): OperationServiceSchema => ({
|
|
||||||
name: service.name,
|
|
||||||
fullName: serviceName(service),
|
|
||||||
operations: service.methodsArray.map((method) =>
|
|
||||||
operationFromMethod(method, schemaVersion),
|
|
||||||
),
|
|
||||||
});
|
|
||||||
|
|
||||||
const classSchemaFromType = (
|
|
||||||
type: protobuf.Type,
|
|
||||||
sourceFile: string,
|
|
||||||
defaults: ReturnType<typeof extractFileDefaults>,
|
|
||||||
operationServices: OperationServiceSchema[],
|
|
||||||
): ClassSchema | undefined => {
|
|
||||||
const classOption = asObject(getReflectionOption(type, CLASS_OPTION));
|
|
||||||
if (!classOption) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fallbackClassRef = {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: type.name,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
};
|
|
||||||
const classId = symbolRefFromOption(classOption.id, fallbackClassRef);
|
|
||||||
const classVersion = readNumber(classOption, "version") ?? Number(classId.version);
|
|
||||||
if (!Number.isInteger(classVersion) || classVersion <= 0) {
|
|
||||||
throw new Error(`Class ${type.fullName} has invalid Camino class version`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fields = type.fieldsArray.map((field) =>
|
|
||||||
fieldSchemaFromField(field, defaults.schemaVersion),
|
|
||||||
);
|
|
||||||
validateDisplayLabelFields(type, fields, operationServices);
|
|
||||||
const edges = type.fieldsArray.flatMap((field) => {
|
|
||||||
const edgeOption = asObject(getReflectionOption(field, EDGE_OPTION));
|
|
||||||
if (!edgeOption) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const legacyTargetClass = symbolRefFromOption(edgeOption.target, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: "",
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const cardinality = cardinalityFromOption(edgeOption.cardinality);
|
|
||||||
const declaredFromEndpoint = endpointFromOption({
|
|
||||||
option: edgeOption.this_endpoint,
|
|
||||||
fallbackClass: classId,
|
|
||||||
fallbackProjection: field.name,
|
|
||||||
fallbackCardinality: cardinality,
|
|
||||||
fallbackVersion: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const declaredToEndpoint = endpointFromOption({
|
|
||||||
option: edgeOption.other_endpoint,
|
|
||||||
fallbackClass: legacyTargetClass.name ? legacyTargetClass : undefined,
|
|
||||||
fallbackProjection: readString(edgeOption, "inverse") ?? "",
|
|
||||||
fallbackCardinality: "many",
|
|
||||||
fallbackVersion: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
if (!declaredToEndpoint.projection) {
|
|
||||||
throw new Error(
|
|
||||||
`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const sourceType = typeRefForField(field, defaults.schemaVersion);
|
|
||||||
if (
|
|
||||||
sourceType.symbol?.namespace !== "camino" ||
|
|
||||||
sourceType.symbol.name !== "Ref"
|
|
||||||
) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
|
||||||
}
|
|
||||||
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
|
||||||
if (isMany && !field.repeated) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must be repeated for ${declaredFromEndpoint.cardinality}`);
|
|
||||||
}
|
|
||||||
if (!isMany && field.repeated) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must not be repeated for ${declaredFromEndpoint.cardinality}`);
|
|
||||||
}
|
|
||||||
const directionality: EdgeDirectionality =
|
|
||||||
edgeOption.undirected === true ? "undirected" : "directed";
|
|
||||||
const { fromEndpoint, toEndpoint } = normalizeEdgeEndpoints({
|
|
||||||
directionality,
|
|
||||||
fromEndpoint: declaredFromEndpoint,
|
|
||||||
toEndpoint: declaredToEndpoint,
|
|
||||||
});
|
|
||||||
const edgeId = symbolRefFromOption(edgeOption.id, {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: `${type.name}.${field.name}`,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
});
|
|
||||||
const fallbackToClass = toEndpoint.class ?? {
|
|
||||||
namespace: "",
|
|
||||||
name: "",
|
|
||||||
version: "",
|
|
||||||
};
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
id: edgeId,
|
|
||||||
directionality,
|
|
||||||
sourceField: fromEndpoint.projection,
|
|
||||||
fromClass: fromEndpoint.class ?? classId,
|
|
||||||
toClass: fallbackToClass,
|
|
||||||
cardinality: fromEndpoint.cardinality,
|
|
||||||
...(toEndpoint.projection
|
|
||||||
? { inverse: toEndpoint.projection }
|
|
||||||
: {}),
|
|
||||||
fields: [],
|
|
||||||
fromEndpoint,
|
|
||||||
toEndpoint,
|
|
||||||
declaringClass: classId,
|
|
||||||
tags: symbolArrayFromOption(edgeOption.tag, defaults),
|
|
||||||
implements: symbolArrayFromOption(edgeOption.implements, defaults),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
const methods: MethodSchema[] = getReflectionOptions(type, METHOD_OPTION)
|
|
||||||
.map(asObject)
|
|
||||||
.filter((option): option is OptionBag => Boolean(option))
|
|
||||||
.map((option) => {
|
|
||||||
const name = readString(option, "name");
|
|
||||||
if (!name) {
|
|
||||||
throw new Error(`Method option on ${type.fullName} requires name`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
function: functionRefFromOption(option.function),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const migrations: MigrationSpec[] = getReflectionOptions(type, MIGRATION_OPTION)
|
|
||||||
.map(asObject)
|
|
||||||
.filter((option): option is OptionBag => Boolean(option))
|
|
||||||
.map((option) => {
|
|
||||||
const fromVersion = readNumber(option, "from_version");
|
|
||||||
const toVersion = readNumber(option, "to_version");
|
|
||||||
if (!fromVersion || !toVersion) {
|
|
||||||
throw new Error(`Migration option on ${type.fullName} requires versions`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
fromVersion,
|
|
||||||
toVersion,
|
|
||||||
function: functionRefFromOption(option.function),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const constructorOption = asObject(
|
|
||||||
getReflectionOption(type, CONSTRUCTOR_OPTION),
|
|
||||||
);
|
|
||||||
const constructorSpec = constructorOption
|
|
||||||
? { function: functionRefFromOption(constructorOption.function) }
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: classId,
|
|
||||||
version: classVersion,
|
|
||||||
fields,
|
|
||||||
edges,
|
|
||||||
methods,
|
|
||||||
migrations,
|
|
||||||
operationServices,
|
|
||||||
implements: getReflectionOptions(type, IMPLEMENTS_OPTION).map((option) =>
|
|
||||||
interfaceImplementationFromOption(option, defaults),
|
|
||||||
),
|
|
||||||
...(constructorSpec ? { constructorSpec } : {}),
|
|
||||||
sourceFile,
|
|
||||||
protoMessage: type.fullName,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const interfaceSchemaFromType = (
|
|
||||||
type: protobuf.Type,
|
|
||||||
sourceFile: string,
|
|
||||||
defaults: ReturnType<typeof extractFileDefaults>,
|
|
||||||
): InterfaceSchema | undefined => {
|
|
||||||
const interfaceOption = asObject(getReflectionOption(type, INTERFACE_OPTION));
|
|
||||||
if (!interfaceOption) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const classOption = asObject(getReflectionOption(type, CLASS_OPTION));
|
|
||||||
if (classOption) {
|
|
||||||
throw new Error(`${type.fullName} cannot be both a Camino class and interface`);
|
|
||||||
}
|
|
||||||
const fallbackInterfaceRef = {
|
|
||||||
namespace: defaults.schemaNamespace,
|
|
||||||
name: type.name,
|
|
||||||
version: defaults.schemaVersion,
|
|
||||||
};
|
|
||||||
const interfaceId = symbolRefFromOption(
|
|
||||||
interfaceOption.id,
|
|
||||||
fallbackInterfaceRef,
|
|
||||||
);
|
|
||||||
const interfaceVersion =
|
|
||||||
readNumber(interfaceOption, "version") ?? Number(interfaceId.version);
|
|
||||||
if (!Number.isInteger(interfaceVersion) || interfaceVersion <= 0) {
|
|
||||||
throw new Error(`Interface ${type.fullName} has invalid Camino interface version`);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id: interfaceId,
|
|
||||||
version: interfaceVersion,
|
|
||||||
fields: type.fieldsArray.map((field) =>
|
|
||||||
fieldSchemaFromField(field, defaults.schemaVersion),
|
|
||||||
),
|
|
||||||
sourceFile,
|
|
||||||
protoMessage: type.fullName,
|
|
||||||
typeParameters: asArray(interfaceOption.type_parameter)
|
|
||||||
.map((entry) => String(entry).trim())
|
|
||||||
.filter(Boolean),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const walkTypes = (
|
|
||||||
namespace: protobuf.NamespaceBase,
|
|
||||||
visit: (type: protobuf.Type) => void,
|
|
||||||
) => {
|
|
||||||
for (const nested of namespace.nestedArray) {
|
|
||||||
if (nested instanceof protobuf.Type) {
|
|
||||||
visit(nested);
|
|
||||||
walkTypes(nested, visit);
|
|
||||||
} else if (nested instanceof protobuf.Namespace) {
|
|
||||||
walkTypes(nested, visit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const walkServices = (
|
|
||||||
namespace: protobuf.NamespaceBase,
|
|
||||||
visit: (service: protobuf.Service) => void,
|
|
||||||
) => {
|
|
||||||
for (const nested of namespace.nestedArray) {
|
|
||||||
if (nested instanceof protobuf.Service) {
|
|
||||||
visit(nested);
|
|
||||||
} else if (nested instanceof protobuf.Namespace) {
|
|
||||||
walkServices(nested, visit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const loadCaminoSchemaRoot = async (
|
|
||||||
sourceFile: string,
|
|
||||||
): Promise<{ absoluteSourceFile: string; root: protobuf.Root }> => {
|
|
||||||
const absoluteSourceFile = path.resolve(sourceFile);
|
|
||||||
const root = new protobuf.Root();
|
|
||||||
const envIncludeDirs = [
|
|
||||||
process.env.QUIXOS_PROTO_PATH,
|
|
||||||
process.env.CAMINO_PROTO_PATH,
|
|
||||||
]
|
|
||||||
.filter((value): value is string => Boolean(value))
|
|
||||||
.join(path.delimiter)
|
|
||||||
.split(path.delimiter)
|
|
||||||
.map((entry) => entry.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((entry) => path.resolve(entry));
|
|
||||||
const includeDirs = [
|
|
||||||
path.dirname(absoluteSourceFile),
|
|
||||||
path.resolve("../../quixos-protocol/proto"),
|
|
||||||
path.resolve("quixos-protocol/proto"),
|
|
||||||
path.resolve("proto"),
|
|
||||||
...envIncludeDirs,
|
|
||||||
];
|
|
||||||
root.resolvePath = (origin, target) => {
|
|
||||||
if (path.isAbsolute(target) && fs.existsSync(target)) {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
const originDir = origin ? path.dirname(origin) : undefined;
|
|
||||||
const candidates = [
|
|
||||||
...(originDir ? [path.resolve(originDir, target)] : []),
|
|
||||||
...includeDirs.map((dir) => path.resolve(dir, target)),
|
|
||||||
];
|
|
||||||
const found = candidates.find((candidate) => fs.existsSync(candidate));
|
|
||||||
return found ?? target;
|
|
||||||
};
|
|
||||||
|
|
||||||
await root.load(absoluteSourceFile, { keepCase: true });
|
|
||||||
root.resolveAll();
|
|
||||||
|
|
||||||
return { absoluteSourceFile, root };
|
|
||||||
};
|
|
||||||
|
|
||||||
export const compileCaminoSchema = async (
|
|
||||||
sourceFile: string,
|
|
||||||
): Promise<SchemaCompileResult> => {
|
|
||||||
const { absoluteSourceFile, root } = await loadCaminoSchemaRoot(sourceFile);
|
|
||||||
const defaults = extractFileDefaults(absoluteSourceFile);
|
|
||||||
|
|
||||||
const operationServices: OperationServiceSchema[] = [];
|
|
||||||
walkServices(root, (service) => {
|
|
||||||
operationServices.push(
|
|
||||||
operationServiceFromService(service, defaults.schemaVersion),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const classes: ClassSchema[] = [];
|
|
||||||
const interfaces: InterfaceSchema[] = [];
|
|
||||||
walkTypes(root, (type) => {
|
|
||||||
const interfaceSchema = interfaceSchemaFromType(
|
|
||||||
type,
|
|
||||||
absoluteSourceFile,
|
|
||||||
defaults,
|
|
||||||
);
|
|
||||||
if (interfaceSchema) {
|
|
||||||
interfaces.push(interfaceSchema);
|
|
||||||
}
|
|
||||||
const classSchema = classSchemaFromType(
|
|
||||||
type,
|
|
||||||
absoluteSourceFile,
|
|
||||||
defaults,
|
|
||||||
operationServices,
|
|
||||||
);
|
|
||||||
if (classSchema) {
|
|
||||||
classes.push(classSchema);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
sourceFile: absoluteSourceFile,
|
|
||||||
classes,
|
|
||||||
interfaces,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
export type SymbolRef = {
|
|
||||||
namespace: string;
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
hash?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FunctionRef = {
|
|
||||||
packageNamespace: string;
|
|
||||||
packageName: string;
|
|
||||||
symbol: string;
|
|
||||||
operation?: string;
|
|
||||||
versionRef?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ConflictStrategy =
|
|
||||||
| "replace"
|
|
||||||
| "preserve_conflicts"
|
|
||||||
| "crdt";
|
|
||||||
|
|
||||||
export type Cardinality =
|
|
||||||
| "optional_one"
|
|
||||||
| "exactly_one"
|
|
||||||
| "many"
|
|
||||||
| "many_unique"
|
|
||||||
| "many_ordered"
|
|
||||||
| "many_unique_ordered";
|
|
||||||
|
|
||||||
export type EdgeDirectionality = "directed" | "undirected";
|
|
||||||
|
|
||||||
export type EdgeMaterialization = {
|
|
||||||
class: SymbolRef;
|
|
||||||
connectProjection: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FieldStorageKind =
|
|
||||||
| "stored"
|
|
||||||
| "derived"
|
|
||||||
| "lazy"
|
|
||||||
| "external"
|
|
||||||
| "static_final";
|
|
||||||
|
|
||||||
export type FieldStorage = {
|
|
||||||
kind: FieldStorageKind;
|
|
||||||
resolver?: FunctionRef;
|
|
||||||
cache: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FieldOps = {
|
|
||||||
implementation: "service";
|
|
||||||
service: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TypeRef = {
|
|
||||||
protoType: string;
|
|
||||||
symbol?: SymbolRef;
|
|
||||||
enumValues?: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TypeBinding = {
|
|
||||||
name: string;
|
|
||||||
type: TypeRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type InterfaceFieldContract = {
|
|
||||||
required: boolean;
|
|
||||||
readable: boolean;
|
|
||||||
writable: boolean;
|
|
||||||
watchable: boolean;
|
|
||||||
typeParam?: string;
|
|
||||||
type?: TypeRef;
|
|
||||||
refTargetTypeParam?: string;
|
|
||||||
edgeCardinality?: Cardinality;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type InterfaceImplementation = {
|
|
||||||
interface: SymbolRef;
|
|
||||||
typeBindings: TypeBinding[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type FieldSchema = {
|
|
||||||
name: string;
|
|
||||||
tag: number;
|
|
||||||
type: TypeRef;
|
|
||||||
conflict: ConflictStrategy;
|
|
||||||
repeated: boolean;
|
|
||||||
optional: boolean;
|
|
||||||
storage: FieldStorage;
|
|
||||||
ops?: FieldOps;
|
|
||||||
interfaceContract?: InterfaceFieldContract;
|
|
||||||
isDisplayLabel: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type EdgeEndpointSchema = {
|
|
||||||
class?: SymbolRef;
|
|
||||||
interface?: SymbolRef;
|
|
||||||
projection: string;
|
|
||||||
cardinality: Cardinality;
|
|
||||||
indexed: boolean;
|
|
||||||
materialization?: EdgeMaterialization;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type EdgeSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
directionality: EdgeDirectionality;
|
|
||||||
sourceField: string;
|
|
||||||
fromClass: SymbolRef;
|
|
||||||
toClass: SymbolRef;
|
|
||||||
cardinality: Cardinality;
|
|
||||||
inverse?: string;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
fromEndpoint: EdgeEndpointSchema;
|
|
||||||
toEndpoint: EdgeEndpointSchema;
|
|
||||||
declaringClass: SymbolRef;
|
|
||||||
tags: SymbolRef[];
|
|
||||||
implements: SymbolRef[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type MethodSchema = {
|
|
||||||
name: string;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type MigrationSpec = {
|
|
||||||
fromVersion: number;
|
|
||||||
toVersion: number;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ConstructorSpec = {
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type OperationSchema = {
|
|
||||||
name: string;
|
|
||||||
inputType: TypeRef;
|
|
||||||
outputType: TypeRef;
|
|
||||||
function: FunctionRef;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type OperationServiceSchema = {
|
|
||||||
name: string;
|
|
||||||
fullName: string;
|
|
||||||
operations: OperationSchema[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ClassSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
version: number;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
edges: EdgeSchema[];
|
|
||||||
methods: MethodSchema[];
|
|
||||||
migrations: MigrationSpec[];
|
|
||||||
operationServices: OperationServiceSchema[];
|
|
||||||
implements: InterfaceImplementation[];
|
|
||||||
constructorSpec?: ConstructorSpec;
|
|
||||||
sourceFile: string;
|
|
||||||
protoMessage: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type InterfaceSchema = {
|
|
||||||
id: SymbolRef;
|
|
||||||
version: number;
|
|
||||||
fields: FieldSchema[];
|
|
||||||
sourceFile: string;
|
|
||||||
protoMessage: string;
|
|
||||||
typeParameters: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SchemaCompileResult = {
|
|
||||||
sourceFile: string;
|
|
||||||
classes: ClassSchema[];
|
|
||||||
interfaces: InterfaceSchema[];
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { referenceFromWire } from "../dist/references.js";
|
||||||
|
import {
|
||||||
|
bindQxHandler,
|
||||||
|
decodeQxValue,
|
||||||
|
encodeQxValue,
|
||||||
|
jsToProtoValue,
|
||||||
|
liveValue,
|
||||||
|
protoValueToJs,
|
||||||
|
} from "../dist/index.js";
|
||||||
|
const scalar = (name) => ({ kind: "scalar", name });
|
||||||
|
const unit = { kind: "builtin", name: "unit" };
|
||||||
|
test("free function handlers never acquire a receiver or object session", async () => {
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
{ receiver: "none", inputType: unit, outputType: unit, ports: {} },
|
||||||
|
async (context) => {
|
||||||
|
assert.equal("objectId" in context, false);
|
||||||
|
assert.equal("openSession" in context, false);
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
await handler({
|
||||||
|
inputProto: {},
|
||||||
|
get objectId() {
|
||||||
|
throw new Error("no receiver exists");
|
||||||
|
},
|
||||||
|
openSession() {
|
||||||
|
assert.fail("no object session");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test("React props no longer have an opaque-message reference escape hatch", () => {
|
||||||
|
const descriptorId = "org.quixos.web-studio.ReactProps";
|
||||||
|
const reference = referenceFromWire("obj:task");
|
||||||
|
const type = { kind: "message", descriptorId };
|
||||||
|
const messages = { [descriptorId]: { encode: jsToProtoValue, decode: protoValueToJs } };
|
||||||
|
assert.throws(() => encodeQxValue(type, { subject: reference }, messages), /Managed references/);
|
||||||
|
assert.throws(() => decodeQxValue(type, jsToProtoValue({ subject: reference }), messages), /Managed references/);
|
||||||
|
});
|
||||||
|
test("declared record inputs preserve opaque references without opening message codecs", async () => {
|
||||||
|
const target = referenceFromWire("obj:board");
|
||||||
|
const type = {
|
||||||
|
kind: "record",
|
||||||
|
fields: {
|
||||||
|
target: { kind: "object-ref", expectation: { kind: "atom", atomId: "board" } },
|
||||||
|
x: scalar("double"),
|
||||||
|
note: { kind: "optional", value: scalar("string") },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const encoded = encodeQxValue(type, { target, x: 12 }, {});
|
||||||
|
const decoded = decodeQxValue(type, encoded, {});
|
||||||
|
assert.ok(decoded.target.equals(target));
|
||||||
|
assert.equal(decoded.x, 12);
|
||||||
|
assert.equal(decoded.note, null);
|
||||||
|
assert.throws(() => JSON.stringify(decoded), /cannot be serialized/);
|
||||||
|
assert.throws(() => encodeQxValue(type, { target, x: 12, hidden: target }, {}), /Unexpected/);
|
||||||
|
assert.throws(() => encodeQxValue(type, { x: 12 }, {}), /Missing/);
|
||||||
|
assert.throws(() => encodeQxValue(type, { target: "obj:board", x: 12 }, {}), /opaque object reference/);
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
{ inputType: type, outputType: unit, ports: {} },
|
||||||
|
async (context) => {
|
||||||
|
assert.ok(context.input.target.equals(target));
|
||||||
|
assert.equal(context.input.x, 12);
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
await handler({ objectId: target, inputProto: encoded.kind.value.fields });
|
||||||
|
});
|
||||||
|
test("typed sessions rebind ports and cancellation to each acquired invocation", async () => {
|
||||||
|
const first = new AbortController(),
|
||||||
|
second = new AbortController();
|
||||||
|
let closed = false;
|
||||||
|
const context = (value, signal) => ({
|
||||||
|
objectId: referenceFromWire("obj:owner"),
|
||||||
|
inputProto: {},
|
||||||
|
signal,
|
||||||
|
state: () => ({ live: async () => liveValue(jsToProtoValue(value)) }),
|
||||||
|
});
|
||||||
|
const raw = {
|
||||||
|
...context(1n, first.signal),
|
||||||
|
openSession: async () => ({
|
||||||
|
id: "session:test",
|
||||||
|
run: (work) => work(context(2n, second.signal)),
|
||||||
|
close: async () => {
|
||||||
|
closed = true;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
{
|
||||||
|
inputType: unit,
|
||||||
|
outputType: unit,
|
||||||
|
ports: { counter: { kind: "state", id: "counter", valueType: scalar("int64"), primitives: ["read"] } },
|
||||||
|
},
|
||||||
|
async (bound) => {
|
||||||
|
assert.equal(bound.signal, first.signal);
|
||||||
|
const session = await bound.openSession();
|
||||||
|
await session.run(async (next) => {
|
||||||
|
assert.equal(next.signal, second.signal);
|
||||||
|
assert.equal(await next.ports.counter.get(), 2n);
|
||||||
|
assert.equal(next.openSession, undefined);
|
||||||
|
});
|
||||||
|
await session.close();
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
await handler(raw);
|
||||||
|
assert.equal(closed, true);
|
||||||
|
});
|
||||||
|
test("binding codecs round trip nested bytes, 64-bit integers, nulls, and references", () => {
|
||||||
|
const values = [
|
||||||
|
[scalar("int64"), -(2n ** 63n)],
|
||||||
|
[scalar("uint64"), 2n ** 64n - 1n],
|
||||||
|
[scalar("bytes"), new Uint8Array([0, 255])],
|
||||||
|
[{ kind: "list", value: { kind: "optional", value: scalar("int64") } }, [null, 2n ** 60n]],
|
||||||
|
[{ kind: "object-ref", expectation: { kind: "atom", atomId: "thing" } }, referenceFromWire("obj:thing")],
|
||||||
|
];
|
||||||
|
for (const [type, value] of values) assert.deepEqual(decodeQxValue(type, encodeQxValue(type, value, {}), {}), value);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("opaque references pass declared RPC boundaries but cannot enter ordinary data", () => {
|
||||||
|
const reference = referenceFromWire("obj:thing");
|
||||||
|
const type = { kind: "object-ref", expectation: { kind: "atom", atomId: "thing" } };
|
||||||
|
const roundtrip = decodeQxValue(type, encodeQxValue(type, reference, {}), {});
|
||||||
|
assert.equal(reference.equals(roundtrip), true);
|
||||||
|
assert.equal(reference.equals(referenceFromWire("obj:other")), false);
|
||||||
|
assert.throws(() => JSON.stringify({ nested: [reference] }), /cannot be serialized/);
|
||||||
|
assert.throws(() => String(reference), /cannot be coerced/);
|
||||||
|
assert.throws(() => encodeQxValue(type, "obj:thing", {}), /opaque/);
|
||||||
|
assert.throws(() => encodeQxValue(scalar("string"), reference, {}), /Managed references/);
|
||||||
|
const message = { kind: "message", descriptorId: "Payload" };
|
||||||
|
assert.throws(
|
||||||
|
() => encodeQxValue(message, { nested: reference }, { Payload: { encode: jsToProtoValue } }),
|
||||||
|
/Managed references/,
|
||||||
|
);
|
||||||
|
assert.throws(
|
||||||
|
() => encodeQxValue(message, {}, { Payload: { encode: () => jsToProtoValue(reference) } }),
|
||||||
|
/Managed references/,
|
||||||
|
);
|
||||||
|
assert.throws(
|
||||||
|
() => decodeQxValue(message, jsToProtoValue(reference), { Payload: { decode: () => ({}) } }),
|
||||||
|
/Managed references/,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
test("typed state and interface ports preserve declared values and exact operation IDs", async () => {
|
||||||
|
const spec = {
|
||||||
|
inputType: scalar("int64"),
|
||||||
|
outputType: scalar("bytes"),
|
||||||
|
ports: {
|
||||||
|
data: { kind: "state", id: "state-id", valueType: scalar("int64"), primitives: ["read", "write"] },
|
||||||
|
reader: {
|
||||||
|
kind: "interface",
|
||||||
|
id: "interface-id",
|
||||||
|
operations: { "payload.get": { id: "get-id", inputType: unit, outputType: scalar("bytes") } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let written;
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
spec,
|
||||||
|
async ({ input, ports }) => {
|
||||||
|
assert.equal(input, 2n ** 60n);
|
||||||
|
assert.equal(await ports.data.get(), 9n);
|
||||||
|
assert.deepEqual((await ports.data.live()).$quixosValue, jsToProtoValue(9n));
|
||||||
|
assert.ok(ports.reader.objectId.equals(referenceFromWire("obj:reader")));
|
||||||
|
assert.deepEqual((await ports.reader.live["payload.get"]()).$quixosValue, jsToProtoValue(new Uint8Array([7])));
|
||||||
|
await ports.data.set(input);
|
||||||
|
return ports.reader["payload.get"]();
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
const result = await handler({
|
||||||
|
inputProto: { value: jsToProtoValue(2n ** 60n) },
|
||||||
|
objectId: "obj",
|
||||||
|
state: (id) => {
|
||||||
|
assert.equal(id, "state-id");
|
||||||
|
return {
|
||||||
|
live: async () => liveValue(jsToProtoValue(9n)),
|
||||||
|
set: async (value) => {
|
||||||
|
written = value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
interface: (id) => {
|
||||||
|
assert.equal(id, "interface-id");
|
||||||
|
return {
|
||||||
|
objectId: referenceFromWire("obj:reader"),
|
||||||
|
live: async (operation, input) => {
|
||||||
|
assert.equal(operation, "get-id");
|
||||||
|
assert.deepEqual(input, {});
|
||||||
|
return liveValue(jsToProtoValue(new Uint8Array([7])));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
assert.equal(written.$quixosValue.kind.value, String(2n ** 60n));
|
||||||
|
assert.deepEqual(result.$quixosValue.kind.value, new Uint8Array([7]));
|
||||||
|
});
|
||||||
|
test("external message bindings and derived event types are used at the boundary", async () => {
|
||||||
|
const message = { kind: "message", descriptorId: "Payload" };
|
||||||
|
const messages = { Payload: { encode: jsToProtoValue, decode: protoValueToJs } };
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
{ inputType: message, outputType: { kind: "builtin", name: "watch-handle" }, eventType: message, ports: {} },
|
||||||
|
{ kind: "derived", get: ({ input }) => ({ value: input.title }) },
|
||||||
|
messages,
|
||||||
|
);
|
||||||
|
assert.equal(handler.kind, "derived");
|
||||||
|
const result = await handler.get({ objectId: "obj", inputProto: { title: jsToProtoValue("hello") } });
|
||||||
|
assert.deepEqual(protoValueToJs(result.$quixosValue), { value: "hello" });
|
||||||
|
assert.throws(() => encodeQxValue(message, {}, {}), /Missing message binding/);
|
||||||
|
});
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { bindQxHandler, createRuntimeContext, defineQxInterfaceContract, jsToProtoValue } from "../dist/index.js";
|
||||||
|
import { referenceFromWire } from "../dist/references.js";
|
||||||
|
|
||||||
|
const unit = { kind: "builtin", name: "unit" };
|
||||||
|
test("generated conformance views use checked codecs and retain their fence on invocation", async () => {
|
||||||
|
const contract = defineQxInterfaceContract("Named", {
|
||||||
|
"name.get": { id: "get", inputType: unit, outputType: { kind: "scalar", name: "string" } },
|
||||||
|
});
|
||||||
|
const object = referenceFromWire("object");
|
||||||
|
const witness = {
|
||||||
|
objectId: "object",
|
||||||
|
interfaceRevisionId: "Named",
|
||||||
|
workspaceEpoch: "1",
|
||||||
|
workspaceRevisionId: "w",
|
||||||
|
conformanceId: "named",
|
||||||
|
};
|
||||||
|
const requests = [];
|
||||||
|
const raw = createRuntimeContext(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
async tryConform(request) {
|
||||||
|
requests.push(request);
|
||||||
|
return { conformance: witness };
|
||||||
|
},
|
||||||
|
async invokeCapability(request) {
|
||||||
|
for (const key of Object.keys(witness)) assert.equal(request.capability.conformance[key], witness[key]);
|
||||||
|
assert.deepEqual(request.input, {});
|
||||||
|
return { ok: true, result: jsToProtoValue("Hello"), dependencies: [] };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ objectId: "object", input: {}, dependencies: [] },
|
||||||
|
);
|
||||||
|
const handler = bindQxHandler(
|
||||||
|
{ inputType: unit, outputType: unit, ports: {} },
|
||||||
|
async (context) => {
|
||||||
|
const view = await context.conform.tryConform(object, contract);
|
||||||
|
assert.ok(view.objectId.equals(object));
|
||||||
|
assert.equal(view.contract, contract);
|
||||||
|
assert.equal(await view["name.get"](), "Hello");
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
await handler(raw);
|
||||||
|
assert.deepEqual(requests, [{ objectId: "object", interfaceRevisionId: "Named" }]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("package discovery preserves absence and denied errors and refuses raw IDs", async () => {
|
||||||
|
const request = { objectId: "object", input: {}, dependencies: [] };
|
||||||
|
const raw = createRuntimeContext(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
async tryConform() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
request,
|
||||||
|
);
|
||||||
|
assert.equal(await raw.tryConform(referenceFromWire("object"), "Missing"), undefined);
|
||||||
|
await assert.rejects(raw.tryConform("object", "Named"), /opaque object reference/);
|
||||||
|
const denied = createRuntimeContext(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
async tryConform() {
|
||||||
|
throw Error("permission denied");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
request,
|
||||||
|
);
|
||||||
|
await assert.rejects(denied.tryConform(referenceFromWire("object"), "Named"), /permission denied/);
|
||||||
|
});
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import fs from "node:fs/promises";
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import crypto from "node:crypto";
|
||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
|
||||||
|
test("supervised SDK reads a credential file and proves instance identity without an environment token", async (t) => {
|
||||||
|
const directory = await fs.mkdtemp(path.join(os.tmpdir(), "qx-sdk-credential-"));
|
||||||
|
t.after(() => fs.rm(directory, { recursive: true, force: true }));
|
||||||
|
const token = crypto.randomBytes(32).toString("hex");
|
||||||
|
const filename = path.join(directory, "process-token");
|
||||||
|
await fs.writeFile(filename, token, { mode: 0o600 });
|
||||||
|
const env = {
|
||||||
|
...process.env,
|
||||||
|
CAMINO_RUNTIME_AUTH_TOKEN_FILE: filename,
|
||||||
|
CAMINO_RUNTIME_AUTH_REQUIRED: "1",
|
||||||
|
QUIXOS_RUNTIME_INSTANCE_ID: "instance:test",
|
||||||
|
};
|
||||||
|
delete env.CAMINO_RUNTIME_AUTH_TOKEN;
|
||||||
|
const result = spawnSync(
|
||||||
|
process.execPath,
|
||||||
|
[
|
||||||
|
"--input-type=module",
|
||||||
|
"-e",
|
||||||
|
`
|
||||||
|
import {createPackageRuntimeRoutes} from ${JSON.stringify(new URL("../dist/index.js", import.meta.url).href)};
|
||||||
|
createPackageRuntimeRoutes({packageRevisionId:'package:test',exports:{}})({
|
||||||
|
service(_type, implementation) { console.log(JSON.stringify(implementation.handshake({nonce:'challenge'}))); }
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
],
|
||||||
|
{ env, encoding: "utf8" },
|
||||||
|
);
|
||||||
|
assert.equal(result.status, 0, result.stderr);
|
||||||
|
const handshake = JSON.parse(result.stdout);
|
||||||
|
assert.equal(
|
||||||
|
handshake.authenticationProof,
|
||||||
|
crypto
|
||||||
|
.createHmac("sha256", token)
|
||||||
|
.update(JSON.stringify(["challenge", "instance:test", "package:test"]))
|
||||||
|
.digest("hex"),
|
||||||
|
);
|
||||||
|
assert.ok(handshake.capabilities.includes("epoch-grants-v1"));
|
||||||
|
assert.ok(!result.stdout.includes(token));
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { createInvocationRegistry } from "../dist/invocations.js";
|
||||||
|
|
||||||
|
test("cancel requests do not acknowledge execution completion or allow replay", () => {
|
||||||
|
const registry = createInvocationRegistry();
|
||||||
|
const execution = registry.begin("call-1");
|
||||||
|
assert.equal(registry.cancel("call-1").state, "cancellation-requested");
|
||||||
|
assert.equal(execution.signal.aborted, true);
|
||||||
|
assert.equal(registry.status("call-1").state, "cancellation-requested");
|
||||||
|
execution.finish();
|
||||||
|
assert.equal(registry.status("call-1").state, "completed");
|
||||||
|
assert.throws(() => registry.begin("call-1"), /already used/);
|
||||||
|
assert.equal(registry.status("missing").state, "unknown");
|
||||||
|
});
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { createMigrationContext, migrationObjectId } from "../dist/migration.js";
|
||||||
|
test("migration context offers restricted ports and deterministic helper identities", () => {
|
||||||
|
const input = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
executionId: "operation:transition",
|
||||||
|
exportId: "migrate",
|
||||||
|
ports: [
|
||||||
|
{
|
||||||
|
name: "old",
|
||||||
|
binding: "slot:name",
|
||||||
|
view: "old",
|
||||||
|
access: ["read"],
|
||||||
|
states: [{ objectId: "obj:one", value: "Alice" }],
|
||||||
|
},
|
||||||
|
{ name: "new", binding: "slot:name", view: "new", access: ["write"] },
|
||||||
|
{ name: "newRead", binding: "slot:name", view: "new", access: ["read"] },
|
||||||
|
{ name: "helpers", binding: "atom:helper", view: "new", access: ["create"] },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const { context, result } = createMigrationContext(input);
|
||||||
|
assert.equal(context.read("old", "obj:one"), "Alice");
|
||||||
|
assert.throws(() => context.write("old", "obj:one", "Bob"), /does not grant/);
|
||||||
|
assert.throws(() => context.read("new", "obj:one"), /does not grant/);
|
||||||
|
context.write("new", "obj:one", "Alice");
|
||||||
|
assert.equal(context.read("newRead", "obj:one"), "Alice");
|
||||||
|
context.write("new", "obj:one", "Bob");
|
||||||
|
assert.equal(context.read("newRead", "obj:one"), "Bob");
|
||||||
|
assert.equal(context.read("old", "obj:one"), "Alice");
|
||||||
|
const helper = context.create("helpers", "one");
|
||||||
|
assert.equal(helper, migrationObjectId(input.executionId, "helpers", "one"));
|
||||||
|
assert.equal(context.create("helpers", "one"), helper);
|
||||||
|
assert.equal(result().creates.length, 1);
|
||||||
|
assert.deepEqual(input.ports[0].states, [{ objectId: "obj:one", value: "Alice" }]);
|
||||||
|
});
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { create } from "@bufbuild/protobuf";
|
||||||
|
import { QueryResponseSchema } from "../dist/camino/api_pb.js";
|
||||||
|
import { InjectedDependencySchema } from "../dist/quixos/refs_pb.js";
|
||||||
|
import { createRuntimeContext, decodeQuerySnapshot, jsToProtoValue, protoValueToJs } from "../dist/index.js";
|
||||||
|
|
||||||
|
test("private relational captures cannot be decoded as a completed public query", () => {
|
||||||
|
const response = create(QueryResponseSchema, { relationalCaptures: [{ rootObjectId: "obj:private" }] });
|
||||||
|
assert.throws(
|
||||||
|
() => decodeQuerySnapshot(response, { kind: "record", fields: {} }, "run", 1n),
|
||||||
|
/QUERY_RESULT_UNFINISHED/,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("query ports carry only an injected query identity and root", async () => {
|
||||||
|
let seen;
|
||||||
|
const context = createRuntimeContext(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
executeQuery: async (request) => {
|
||||||
|
seen = request;
|
||||||
|
return create(QueryResponseSchema);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
objectId: "obj:receiver",
|
||||||
|
input: {},
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "list",
|
||||||
|
objectId: "obj:collection",
|
||||||
|
binding: { case: "queryId", value: "pkg@1:upcoming" },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await context.query("list").execute({ first: jsToProtoValue(30) }, "checked-definition");
|
||||||
|
assert.equal(seen.expectedDefinitionDigest, "checked-definition");
|
||||||
|
assert.equal(seen.objectId, "obj:collection");
|
||||||
|
assert.equal(seen.queryId, "pkg@1:upcoming");
|
||||||
|
assert.equal(protoValueToJs(seen.variables.first), 30);
|
||||||
|
assert.throws(() => context.query("not-injected"), /Missing/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("query snapshots distinguish an unavailable scalar from a successful null", () => {
|
||||||
|
const output = {
|
||||||
|
kind: "record",
|
||||||
|
fields: { title: { kind: "scalar", name: "string" }, score: { kind: "scalar", name: "int64" } },
|
||||||
|
};
|
||||||
|
const response = create(QueryResponseSchema, {
|
||||||
|
value: jsToProtoValue({ title: "Native title", score: null }),
|
||||||
|
pending: [{ path: [{ part: { case: "field", value: "score" } }] }],
|
||||||
|
});
|
||||||
|
const snapshot = decodeQuerySnapshot(response, output, "run1", 1n);
|
||||||
|
assert.equal(snapshot.status, "partial");
|
||||||
|
assert.deepEqual(snapshot.data, { title: "Native title" });
|
||||||
|
assert.deepEqual(snapshot.fields, [{ path: ["score"], status: "pending" }]);
|
||||||
|
assert.equal(output.fields.score.kind, "scalar");
|
||||||
|
response.pending = [];
|
||||||
|
response.value = jsToProtoValue({ title: "Native title", score: 9007199254740993n });
|
||||||
|
assert.equal(decodeQuerySnapshot(response, output, "run1", 2n).data.score, 9007199254740993n);
|
||||||
|
});
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { relationshipMap, relationshipList, relationshipSet } from "../dist/index.js";
|
||||||
|
import { referenceFromWire } from "../dist/references.js";
|
||||||
|
test("relationship helpers preserve handles and require explicit collection revisions", async () => {
|
||||||
|
let current = { revision: 0n, entries: [] },
|
||||||
|
serial = 0;
|
||||||
|
const port = {
|
||||||
|
collection: async () => ({ revision: current.revision, entries: current.entries.map((entry) => ({ ...entry })) }),
|
||||||
|
replace: async (entries, revision) => {
|
||||||
|
assert.equal(revision, current.revision);
|
||||||
|
current = {
|
||||||
|
revision: revision + 1n,
|
||||||
|
entries: entries.map((entry) => ({ ...entry, edgeId: entry.edgeId ?? `edge:${++serial}` })),
|
||||||
|
};
|
||||||
|
return port.collection();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const a = referenceFromWire("obj:a"),
|
||||||
|
b = referenceFromWire("obj:b");
|
||||||
|
const map = relationshipMap(port);
|
||||||
|
await map.set("a1", a, 0n);
|
||||||
|
assert.equal((await map.get("a1")).value.equals(a), true);
|
||||||
|
await assert.rejects(() => map.set("b1", b, 0n), /STALE_COLLECTION/);
|
||||||
|
await map.delete("a1", 1n);
|
||||||
|
const list = relationshipList(port);
|
||||||
|
const inserted = await list.insert(0, a, 2n);
|
||||||
|
await list.insert(1, b, 3n);
|
||||||
|
const moved = await list.move(inserted.entries[0].edgeId, 1, 4n);
|
||||||
|
assert.equal(moved.entries[1].target.equals(a), true);
|
||||||
|
const set = relationshipSet(port);
|
||||||
|
const unchanged = await set.add(referenceFromWire("obj:a"), 5n);
|
||||||
|
assert.equal(unchanged.revision, 5n);
|
||||||
|
});
|
||||||
@@ -0,0 +1,421 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import http from "node:http";
|
||||||
|
import test from "node:test";
|
||||||
|
import { referenceFromWire } from "../dist/references.js";
|
||||||
|
import { create } from "@bufbuild/protobuf";
|
||||||
|
import { createClient } from "@connectrpc/connect";
|
||||||
|
import { connectNodeAdapter, createConnectTransport } from "@connectrpc/connect-node";
|
||||||
|
import {
|
||||||
|
createPackageRuntimeRoutes,
|
||||||
|
createRuntimeContext,
|
||||||
|
derived,
|
||||||
|
jsToProtoValue,
|
||||||
|
liveValue,
|
||||||
|
protoValueToJs,
|
||||||
|
} from "../dist/index.js";
|
||||||
|
import {
|
||||||
|
CaminoObjectSchema,
|
||||||
|
CaminoService,
|
||||||
|
CrdtValueSchema,
|
||||||
|
StateValueSourceSchema,
|
||||||
|
ValueSchema,
|
||||||
|
ValueSourceSchema,
|
||||||
|
} from "../dist/camino/api_pb.js";
|
||||||
|
import { EdgeDependencySchema, InjectedDependencySchema, PackageExportRefSchema } from "../dist/quixos/refs_pb.js";
|
||||||
|
import { InvokeCapabilityResponseSchema, OrchestratorRuntime } from "../dist/quixos/orch_pb.js";
|
||||||
|
import { DerivedDependencySchema, PackageRuntime } from "../dist/quixos/runtime_pb.js";
|
||||||
|
|
||||||
|
const listen = async (routes) => {
|
||||||
|
const server = http.createServer((request, response) => void connectNodeAdapter({ routes })(request, response));
|
||||||
|
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||||
|
const address = server.address();
|
||||||
|
assert.ok(address && typeof address === "object");
|
||||||
|
return {
|
||||||
|
url: `http://127.0.0.1:${address.port}`,
|
||||||
|
close: async () => {
|
||||||
|
server.closeAllConnections();
|
||||||
|
await new Promise((resolve) => server.close(resolve));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test("generic values preserve nested values and object references", () => {
|
||||||
|
const value = jsToProtoValue({
|
||||||
|
title: "A task",
|
||||||
|
target: referenceFromWire("obj:target"),
|
||||||
|
tags: ["one", "two"],
|
||||||
|
});
|
||||||
|
assert.deepEqual(protoValueToJs(value), {
|
||||||
|
title: "A task",
|
||||||
|
target: referenceFromWire("obj:target"),
|
||||||
|
tags: ["one", "two"],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("live values preserve writable CRDT source identity through derivation", () => {
|
||||||
|
const value = create(ValueSchema, {
|
||||||
|
kind: { case: "stringValue", value: "notes" },
|
||||||
|
source: create(ValueSourceSchema, {
|
||||||
|
state: create(StateValueSourceSchema, {
|
||||||
|
objectId: "obj:task",
|
||||||
|
slotId: "slot:task:notes",
|
||||||
|
revision: 7n,
|
||||||
|
crdtSnapshot: create(CrdtValueSchema, {
|
||||||
|
type: "quixos.automerge-document.v1",
|
||||||
|
encoding: "automerge-snapshot-v1",
|
||||||
|
payload: new Uint8Array([1, 2, 3]),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const forwarded = jsToProtoValue(liveValue(value));
|
||||||
|
assert.equal(forwarded.source?.state?.objectId, "obj:task");
|
||||||
|
assert.equal(forwarded.source?.state?.slotId, "slot:task:notes");
|
||||||
|
assert.equal(forwarded.source?.state?.revision, 7n);
|
||||||
|
assert.deepEqual(forwarded.source?.state?.crdtSnapshot?.payload, new Uint8Array([1, 2, 3]));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("runtime context exposes only explicitly injected ports", async () => {
|
||||||
|
const writes = [];
|
||||||
|
const camino = {
|
||||||
|
readState: async ({ objectId, slotId }) => ({
|
||||||
|
value: jsToProtoValue(`${objectId}/${slotId}`),
|
||||||
|
}),
|
||||||
|
writeState: async (request) => {
|
||||||
|
writes.push(request);
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
resolveEdge: async () => ({ edges: [] }),
|
||||||
|
connectEdge: async () => ({}),
|
||||||
|
};
|
||||||
|
const context = createRuntimeContext(
|
||||||
|
camino,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
objectId: "obj:task",
|
||||||
|
input: {},
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:title",
|
||||||
|
binding: { case: "stateSlotId", value: "slot:task:title" },
|
||||||
|
}),
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:children",
|
||||||
|
binding: {
|
||||||
|
case: "edge",
|
||||||
|
value: create(EdgeDependencySchema, {
|
||||||
|
edgeTypeId: "edge:task:children",
|
||||||
|
projectionId: "projection:task:children",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(await context.state("port:title").get(), "obj:task/slot:task:title");
|
||||||
|
await context.state("port:title").set("Changed");
|
||||||
|
assert.equal(writes.length, 1);
|
||||||
|
assert.equal("camino" in context, false);
|
||||||
|
assert.equal("orch" in context, false);
|
||||||
|
assert.throws(() => context.state("port:not-injected"), /Missing slotId dependency/);
|
||||||
|
assert.throws(() => context.interface("port:title"), /Missing interfaceRevisionId dependency/);
|
||||||
|
assert.deepEqual(await context.edge("port:children").resolve(), []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("injected ports preserve an explicitly traversed object through PackageRuntime RPC", async () => {
|
||||||
|
const reads = [];
|
||||||
|
const caminoServer = await listen((router) =>
|
||||||
|
router.service(CaminoService, {
|
||||||
|
readState: (request) => {
|
||||||
|
reads.push(request);
|
||||||
|
return { value: jsToProtoValue("Project name") };
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const runtimeServer = await listen(
|
||||||
|
createPackageRuntimeRoutes({
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
caminoUrl: caminoServer.url,
|
||||||
|
exports: {
|
||||||
|
"export:test:value": (context) => context.state("port:value").get(),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const client = createClient(
|
||||||
|
PackageRuntime,
|
||||||
|
createConnectTransport({
|
||||||
|
baseUrl: runtimeServer.url,
|
||||||
|
httpVersion: "1.1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
const response = await client.invoke({
|
||||||
|
export: create(PackageExportRefSchema, {
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
exportId: "export:test:value",
|
||||||
|
}),
|
||||||
|
objectId: "obj:component",
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:value",
|
||||||
|
objectId: "obj:project",
|
||||||
|
binding: { case: "stateSlotId", value: "slot:project:name" },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
assert.equal(response.ok, true);
|
||||||
|
assert.equal(protoValueToJs(response.result), "Project name");
|
||||||
|
assert.equal(reads.length, 1);
|
||||||
|
assert.equal(reads[0]?.objectId, "obj:project");
|
||||||
|
} finally {
|
||||||
|
await runtimeServer.close();
|
||||||
|
await caminoServer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("interface views invoke a related object and propagate transitive live dependencies", async () => {
|
||||||
|
const invocations = [];
|
||||||
|
const sourceValue = create(ValueSchema, {
|
||||||
|
kind: { case: "stringValue", value: "Project name" },
|
||||||
|
source: create(ValueSourceSchema, {
|
||||||
|
state: create(StateValueSourceSchema, {
|
||||||
|
objectId: "obj:project",
|
||||||
|
slotId: "slot:project:name",
|
||||||
|
revision: 4n,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
const orchServer = await listen((router) =>
|
||||||
|
router.service(OrchestratorRuntime, {
|
||||||
|
invokeCapability: (request) => {
|
||||||
|
invocations.push(request);
|
||||||
|
return create(InvokeCapabilityResponseSchema, {
|
||||||
|
ok: true,
|
||||||
|
result: sourceValue,
|
||||||
|
dependencies: [
|
||||||
|
create(DerivedDependencySchema, {
|
||||||
|
kind: "state",
|
||||||
|
objectId: "obj:project",
|
||||||
|
attachmentId: "slot:project:name",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const runtimeServer = await listen(
|
||||||
|
createPackageRuntimeRoutes({
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
orchUrl: orchServer.url,
|
||||||
|
exports: {
|
||||||
|
"export:test:value": derived((context) => context.interface("port:named").live("operation:named:name:get")),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const client = createClient(
|
||||||
|
PackageRuntime,
|
||||||
|
createConnectTransport({
|
||||||
|
baseUrl: runtimeServer.url,
|
||||||
|
httpVersion: "1.1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
const response = await client.invoke({
|
||||||
|
export: create(PackageExportRefSchema, {
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
exportId: "export:test:value",
|
||||||
|
}),
|
||||||
|
objectId: "obj:component",
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:named",
|
||||||
|
objectId: "obj:project",
|
||||||
|
binding: { case: "interfaceRevisionId", value: "interface:named@1" },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
assert.equal(response.ok, true);
|
||||||
|
assert.equal(invocations[0]?.objectId, "obj:project");
|
||||||
|
assert.equal(invocations[0]?.capability?.interfaceRevisionId, "interface:named@1");
|
||||||
|
assert.equal(response.dependencies[0]?.objectId, "obj:project");
|
||||||
|
assert.equal(response.dependencies[0]?.attachmentId, "slot:project:name");
|
||||||
|
assert.equal(response.result?.source?.state?.revision, 4n);
|
||||||
|
} finally {
|
||||||
|
await runtimeServer.close();
|
||||||
|
await orchServer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("derived interface views reread after their transitive subscriptions become live", async () => {
|
||||||
|
let current = "before subscription";
|
||||||
|
let invocationCount = 0;
|
||||||
|
const caminoServer = await listen((router) =>
|
||||||
|
router.service(CaminoService, {
|
||||||
|
watchObject: async function* (request, context) {
|
||||||
|
// Model a write racing the first nested capability read. Camino makes
|
||||||
|
// the subscription live before yielding this snapshot.
|
||||||
|
current = "after subscription";
|
||||||
|
yield {
|
||||||
|
objectId: request.objectId,
|
||||||
|
snapshot: create(CaminoObjectSchema, {
|
||||||
|
id: request.objectId,
|
||||||
|
atomId: "atom:project",
|
||||||
|
workspaceRevisionId: "workspace:test@1",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
await new Promise((resolve) => context.signal.addEventListener("abort", resolve, { once: true }));
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const orchServer = await listen((router) =>
|
||||||
|
router.service(OrchestratorRuntime, {
|
||||||
|
invokeCapability: () => {
|
||||||
|
invocationCount += 1;
|
||||||
|
return create(InvokeCapabilityResponseSchema, {
|
||||||
|
ok: true,
|
||||||
|
result: jsToProtoValue(current),
|
||||||
|
dependencies: [
|
||||||
|
create(DerivedDependencySchema, {
|
||||||
|
kind: "state",
|
||||||
|
objectId: "obj:project",
|
||||||
|
attachmentId: "slot:project:name",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const runtimeServer = await listen(
|
||||||
|
createPackageRuntimeRoutes({
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
caminoUrl: caminoServer.url,
|
||||||
|
orchUrl: orchServer.url,
|
||||||
|
exports: {
|
||||||
|
"export:test:value": derived((context) => context.interface("port:named").invoke("operation:named:name:get")),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const client = createClient(
|
||||||
|
PackageRuntime,
|
||||||
|
createConnectTransport({
|
||||||
|
baseUrl: runtimeServer.url,
|
||||||
|
httpVersion: "1.1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const controller = new AbortController();
|
||||||
|
try {
|
||||||
|
const stream = client
|
||||||
|
.watch(
|
||||||
|
{
|
||||||
|
export: create(PackageExportRefSchema, {
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
exportId: "export:test:value",
|
||||||
|
}),
|
||||||
|
objectId: "obj:component",
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:named",
|
||||||
|
objectId: "obj:project",
|
||||||
|
binding: { case: "interfaceRevisionId", value: "interface:named@1" },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ signal: controller.signal },
|
||||||
|
)
|
||||||
|
[Symbol.asyncIterator]();
|
||||||
|
const initial = await stream.next();
|
||||||
|
assert.equal(protoValueToJs(initial.value?.value), "after subscription");
|
||||||
|
assert.equal(invocationCount, 2);
|
||||||
|
} finally {
|
||||||
|
controller.abort();
|
||||||
|
await runtimeServer.close();
|
||||||
|
await orchServer.close();
|
||||||
|
await caminoServer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("derived watches subscribe before reading and emit only real changes", async () => {
|
||||||
|
let current = "before";
|
||||||
|
let subscribed = false;
|
||||||
|
const changes = [];
|
||||||
|
const caminoServer = await listen((router) =>
|
||||||
|
router.service(CaminoService, {
|
||||||
|
readState: () => {
|
||||||
|
assert.equal(subscribed, true, "the dependency stream must be live before the state read");
|
||||||
|
return { value: jsToProtoValue(current) };
|
||||||
|
},
|
||||||
|
watchObject: async function* (request, context) {
|
||||||
|
subscribed = true;
|
||||||
|
yield {
|
||||||
|
objectId: request.objectId,
|
||||||
|
snapshot: create(CaminoObjectSchema, {
|
||||||
|
id: request.objectId,
|
||||||
|
atomId: "atom:test",
|
||||||
|
workspaceRevisionId: "workspace:test@1",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
while (!context.signal.aborted) {
|
||||||
|
const changed = await new Promise((resolve) => {
|
||||||
|
const finish = () => resolve(true);
|
||||||
|
changes.push(finish);
|
||||||
|
context.signal.addEventListener("abort", () => resolve(false), { once: true });
|
||||||
|
});
|
||||||
|
if (!changed) return;
|
||||||
|
yield { objectId: request.objectId };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const runtimeServer = await listen(
|
||||||
|
createPackageRuntimeRoutes({
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
caminoUrl: caminoServer.url,
|
||||||
|
exports: {
|
||||||
|
"export:test:value": derived((context) => context.state("port:value").get()),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const client = createClient(
|
||||||
|
PackageRuntime,
|
||||||
|
createConnectTransport({
|
||||||
|
baseUrl: runtimeServer.url,
|
||||||
|
httpVersion: "1.1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const controller = new AbortController();
|
||||||
|
try {
|
||||||
|
const stream = client
|
||||||
|
.watch(
|
||||||
|
{
|
||||||
|
export: create(PackageExportRefSchema, {
|
||||||
|
packageRevisionId: "package:test@1",
|
||||||
|
exportId: "export:test:value",
|
||||||
|
}),
|
||||||
|
objectId: "obj:test",
|
||||||
|
dependencies: [
|
||||||
|
create(InjectedDependencySchema, {
|
||||||
|
portId: "port:value",
|
||||||
|
binding: { case: "stateSlotId", value: "slot:test:value" },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ signal: controller.signal },
|
||||||
|
)
|
||||||
|
[Symbol.asyncIterator]();
|
||||||
|
const initial = await stream.next();
|
||||||
|
assert.equal(protoValueToJs(initial.value?.value), "before");
|
||||||
|
assert.equal(initial.value?.initial, true);
|
||||||
|
|
||||||
|
current = "after";
|
||||||
|
changes.shift()?.();
|
||||||
|
const updated = await stream.next();
|
||||||
|
assert.equal(protoValueToJs(updated.value?.value), "after");
|
||||||
|
assert.equal(updated.value?.initial, false);
|
||||||
|
} finally {
|
||||||
|
controller.abort();
|
||||||
|
await runtimeServer.close();
|
||||||
|
await caminoServer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
+3
-1
@@ -7,9 +7,11 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"types": ["node"],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"outDir": "dist"
|
"outDir": "dist",
|
||||||
|
"rootDir": "src"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-19
@@ -7,8 +7,8 @@
|
|||||||
let
|
let
|
||||||
|
|
||||||
yarnBin = fetchurl {
|
yarnBin = fetchurl {
|
||||||
url = "https://repo.yarnpkg.com/4.14.1/packages/yarnpkg-cli/bin/yarn.js";
|
url = "https://repo.yarnpkg.com/4.18.0/packages/yarnpkg-cli/bin/yarn.js";
|
||||||
hash = "sha512-ZN9EgFWy03uiadfbU1pGm42pP47xFAwl/XqDwAqPuqyyFMoOAlU7kqLFTO94u2fQtIF/qwIAHfDiT6wPrMw7Qg==";
|
hash = "sha512-/Lhxb+fNDuzhQf/Bi5IZOp35IEwbqDGJwoiDUiP8C75kr0c7qw1emSen2utcryuwfrJ4fMkzjKBA6hJfKh8vfg==";
|
||||||
};
|
};
|
||||||
|
|
||||||
cacheFolder = ".yarn/cache";
|
cacheFolder = ".yarn/cache";
|
||||||
@@ -156,35 +156,22 @@ let
|
|||||||
overriddenProject = optionalOverride overrideAttrs project;
|
overriddenProject = optionalOverride overrideAttrs project;
|
||||||
|
|
||||||
cacheEntries = {
|
cacheEntries = {
|
||||||
"@automerge/automerge@npm:3.3.0" = { filename = "@automerge-automerge-npm-3.3.0-3f6661ca17-74b3a8ef9e.zip"; hash = "sha512-dLOo7548v0B2DomHJ+za1RKOUv0rBTgJRUrnsrhbTsZHw8uipjXNv4MfIxVzGtQl2jenhLeb8TvIbsKKfpKv8g=="; };
|
|
||||||
"@bufbuild/protobuf@npm:2.12.1" = { filename = "@bufbuild-protobuf-npm-2.12.1-d8afb467b3-2d40cfe4ec.zip"; hash = "sha512-LUDP5Ow7sOPwarLih3HcXcVm6qywVfvok9dWIbBAfQJy1I9ApJCtR97YOe1UFRThr3G7E68CSzrjbvDFbVbdqQ=="; };
|
"@bufbuild/protobuf@npm:2.12.1" = { filename = "@bufbuild-protobuf-npm-2.12.1-d8afb467b3-2d40cfe4ec.zip"; hash = "sha512-LUDP5Ow7sOPwarLih3HcXcVm6qywVfvok9dWIbBAfQJy1I9ApJCtR97YOe1UFRThr3G7E68CSzrjbvDFbVbdqQ=="; };
|
||||||
"@bufbuild/protoc-gen-es@npm:2.12.1" = { filename = "@bufbuild-protoc-gen-es-npm-2.12.1-6e9387fcb8-0e2805376d.zip"; hash = "sha512-DigFN22Lmj/OD9OdkPZa4dH/vqMSvi2tk2f3xyEqvFHcKleC531iqPhh7De9xtG9MM+sVRDRJCeCzXA/kH4f9Q=="; };
|
"@bufbuild/protoc-gen-es@npm:2.12.1" = { filename = "@bufbuild-protoc-gen-es-npm-2.12.1-6e9387fcb8-0e2805376d.zip"; hash = "sha512-DigFN22Lmj/OD9OdkPZa4dH/vqMSvi2tk2f3xyEqvFHcKleC531iqPhh7De9xtG9MM+sVRDRJCeCzXA/kH4f9Q=="; };
|
||||||
"@bufbuild/protoplugin@npm:2.12.1" = { filename = "@bufbuild-protoplugin-npm-2.12.1-e1aebb80bf-c7b401ab31.zip"; hash = "sha512-x7QBqzHZSsaCXLm75c/3XQXSjuINRnskt6XUKZuaygZmhuo5t6OoRTuLWgGD+qd4HoP8LliAZhgHudMVX3Hr6Q=="; };
|
"@bufbuild/protoplugin@npm:2.12.1" = { filename = "@bufbuild-protoplugin-npm-2.12.1-e1aebb80bf-c7b401ab31.zip"; hash = "sha512-x7QBqzHZSsaCXLm75c/3XQXSjuINRnskt6XUKZuaygZmhuo5t6OoRTuLWgGD+qd4HoP8LliAZhgHudMVX3Hr6Q=="; };
|
||||||
"@connectrpc/connect-node@npm:2.1.2" = { filename = "@connectrpc-connect-node-npm-2.1.2-021434d5d5-ba8b0c9384.zip"; hash = "sha512-uosMk4TDgps3eqeoJtwM1Qpgk1J9LscBRgSRKDYzbqlgSitazqQrEEd/i+RWnknd7WbKD8d/X1sCcDXgKeE+qQ=="; };
|
"@connectrpc/connect-node@npm:2.1.2" = { filename = "@connectrpc-connect-node-npm-2.1.2-021434d5d5-ba8b0c9384.zip"; hash = "sha512-uosMk4TDgps3eqeoJtwM1Qpgk1J9LscBRgSRKDYzbqlgSitazqQrEEd/i+RWnknd7WbKD8d/X1sCcDXgKeE+qQ=="; };
|
||||||
"@connectrpc/connect@npm:2.1.2" = { filename = "@connectrpc-connect-npm-2.1.2-ab34825de3-4e15000890.zip"; hash = "sha512-ThUACJAjt1Lv1E+pQKWuHh+gDhvrxLoM7ScruTWSDYw7hbd0UOZErUQruMqaJ1sMFxNviWuo7/A2F4Ex2wHWFQ=="; };
|
"@connectrpc/connect@npm:2.1.2" = { filename = "@connectrpc-connect-npm-2.1.2-ab34825de3-4e15000890.zip"; hash = "sha512-ThUACJAjt1Lv1E+pQKWuHh+gDhvrxLoM7ScruTWSDYw7hbd0UOZErUQruMqaJ1sMFxNviWuo7/A2F4Ex2wHWFQ=="; };
|
||||||
"@protobufjs/aspromise@npm:1.1.2" = { filename = "@protobufjs-aspromise-npm-1.1.2-71d00b938f-a83343a468.zip"; hash = "sha512-qDNDpGj/W17Gv/Nv14imTIOeSKB/+fT4E1ZPWMr0TQEc1lBO0hR780g1vXp90hBwUq91WWHGsJj9iQK09lANDw=="; };
|
|
||||||
"@protobufjs/base64@npm:1.1.2" = { filename = "@protobufjs-base64-npm-1.1.2-cd8ca6814a-eec925e681.zip"; hash = "sha512-7skl5oEIGvGQuO4jH5utMQHhiau8GC/yedprUx59vSpW8fMG83qAsb6eAKotJxaQ0I3MXzJvccnu2FRmdcjK9g=="; };
|
|
||||||
"@protobufjs/codegen@npm:2.0.5" = { filename = "@protobufjs-codegen-npm-2.0.5-bb74ff329d-1b8a2ae56e.zip"; hash = "sha512-G4oq5W7mClbp0gXNS2ByoVA8UGm467kFcQ+XT/AJig0HAGQcE34KjZje3xRCMVahBqlDNpXL9SV0gQ9VAA/cqw=="; };
|
|
||||||
"@protobufjs/eventemitter@npm:1.1.1" = { filename = "@protobufjs-eventemitter-npm-1.1.1-dbe0dfc812-8e06193d46.zip"; hash = "sha512-jgYZPUYpxefAnU+MLduo/E36c58BSfM6HZAVaNNbt7i1J3pOhFK6873QswL9WZzyVdGTJnqpOgpHR+I80HPErA=="; };
|
|
||||||
"@protobufjs/fetch@npm:1.1.1" = { filename = "@protobufjs-fetch-npm-1.1.1-b98d5396a8-a497ff5433.zip"; hash = "sha512-pJf/VDOFToV38EJ5g+o5uRE7SagSD5RRUpHXYzJwYdLDAT5g4k6kNtCR2vrgGg9usYZ+OxYWBF2Wox2LPGRu1A=="; };
|
|
||||||
"@protobufjs/float@npm:1.0.2" = { filename = "@protobufjs-float-npm-1.0.2-5678f64d08-18f2bdede7.zip"; hash = "sha512-GPK97edv/PAXBwivFcnJ22JZt3HmuExRsG3zSpwznbvuwmfRTOC93SCswUKx2YDZg9MUNDmN9/mOsMlKDreQaQ=="; };
|
|
||||||
"@protobufjs/path@npm:1.1.2" = { filename = "@protobufjs-path-npm-1.1.2-641d08de76-cece0a938e.zip"; hash = "sha512-zs4Kk45/Xf0voD+MFPLxz4sNbhOscyb/TJbqMR7/1ft64LunVPv1BTEq8uOFACUMkOaFBrl8AjYKQ3k9iKDYtA=="; };
|
|
||||||
"@protobufjs/pool@npm:1.1.0" = { filename = "@protobufjs-pool-npm-1.1.0-47a76f96a1-eda2718b7f.zip"; hash = "sha512-7aJxi38iKsbmrTb3WKku+Q0mUmAmoZ9PF/Zo9F4DBqW9c03vP0j1H4E0rgl4tiYqXFF8CLEVpVF1bRo6rfzwOA=="; };
|
|
||||||
"@protobufjs/utf8@npm:1.1.2" = { filename = "@protobufjs-utf8-npm-1.1.2-9c7ca5968f-975c6e2c03.zip"; hash = "sha512-l1xuLAMZvVDBdTHRhrU3qIy00yBePKkpfNhCtjHTQdoO4/8WvoZWzSZgdW3HU7KcimoUwK2O1gLB+R3fIuez8w=="; };
|
|
||||||
"@quixos/camino-datatypes@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-datatypes.git#commit=70f9f45eb7ca23643f1b8220a203d7b3b7aa5bf4" = { filename = "@quixos-camino-datatypes-https-bd0d21d1d2-24717b0ac3.zip"; hash = "sha512-JHF7CsMfaNsZzxtrxO0Uqkw73ZRZnQOZm+NlttlSgXQ0wI6jlvCdw3MJzLcNxsGEmYrMSjrdgvspcIRi3ydm2w=="; };
|
|
||||||
"@types/node@npm:24.13.3" = { filename = "@types-node-npm-24.13.3-b512a0bbeb-a5bc08f49b.zip"; hash = "sha512-pbwI9JuVgdzcqQ4CzXcZejx5mECAdmSULlzVFhpVPU0q6AZPfjKUQQ10jX0Ji1wYSL5/pQwG8pxBk6sWvk5Z6w=="; };
|
"@types/node@npm:24.13.3" = { filename = "@types-node-npm-24.13.3-b512a0bbeb-a5bc08f49b.zip"; hash = "sha512-pbwI9JuVgdzcqQ4CzXcZejx5mECAdmSULlzVFhpVPU0q6AZPfjKUQQ10jX0Ji1wYSL5/pQwG8pxBk6sWvk5Z6w=="; };
|
||||||
"@types/node@npm:26.1.1" = { filename = "@types-node-npm-26.1.1-7a7a9f32f4-25ac509319.zip"; hash = "sha512-JaxQkxlXNt0HTVAnrbuoVhe8lR1aQVBuvTuQcwSKy3IzYT84ItX5uUR/nAhByR9jh8Rig5FnZ+PvefI5F0UsRg=="; };
|
"@typescript/typescript-linux-arm64@npm:7.0.2" = { filename = "@typescript-typescript-linux-arm64-npm-7.0.2-9cacfc53a0-10c0.zip"; hash = "sha512-s4c7nGT/lQIw6x0IfrL0b3ECy/D0g7UoDLdiIWJoM6EGXk5N/dmXdxUdA8Cr3hV/3nO2BYKTQ6Ai8/zGhiSQ3A=="; };
|
||||||
|
"@typescript/typescript-linux-x64@npm:7.0.2" = { filename = "@typescript-typescript-linux-x64-npm-7.0.2-8dd7ff8d24-10c0.zip"; hash = "sha512-k9EUK5CZ3OOPnyslp8SAAonHJpnpPmlaulppI/NmFyCzNs3UN/TLPUkyQia3KIxgbyTzKoXI5L5fl8Uj9bJ7Cg=="; };
|
||||||
"@typescript/vfs@npm:1.6.4" = { filename = "@typescript-vfs-npm-1.6.4-78935c9d3e-acb9de42f2.zip"; hash = "sha512-rLneQvI/2j9149eQC6EG7zI6L0588OSpTbtFfibTU8pjuzUZPtGjL8hzPzrlkJlhKykLBr1iIWlIYb65v7YvYg=="; };
|
"@typescript/vfs@npm:1.6.4" = { filename = "@typescript-vfs-npm-1.6.4-78935c9d3e-acb9de42f2.zip"; hash = "sha512-rLneQvI/2j9149eQC6EG7zI6L0588OSpTbtFfibTU8pjuzUZPtGjL8hzPzrlkJlhKykLBr1iIWlIYb65v7YvYg=="; };
|
||||||
"debug@npm:4.4.3" = { filename = "debug-npm-4.4.3-0105c6123a-d79136ec6c.zip"; hash = "sha512-15E27GyD7L79D2pVk9pqnJHsTX3cS1TIg9bnHsmsy19noaXpbQCjKBlrW1yG02XpjYo6cIVqrxa057GYXmf1pg=="; };
|
"debug@npm:4.4.3" = { filename = "debug-npm-4.4.3-0105c6123a-d79136ec6c.zip"; hash = "sha512-15E27GyD7L79D2pVk9pqnJHsTX3cS1TIg9bnHsmsy19noaXpbQCjKBlrW1yG02XpjYo6cIVqrxa057GYXmf1pg=="; };
|
||||||
"long@npm:5.3.2" = { filename = "long-npm-5.3.2-f80d0f7d39-7130fe1cbc.zip"; hash = "sha512-cTD+HLzi3KBnNLNbcNOAyj9wJxx/iFLJIqfGLIbE418MOSkFZeynEzxiWQjUDhJqxXwCsbGkY2uUV9d+HmC5gQ=="; };
|
|
||||||
"ms@npm:2.1.3" = { filename = "ms-npm-2.1.3-81ff3cfac1-d924b57e73.zip"; hash = "sha512-2SS1fnMSs7Y60h/Fs9wK9eeNYaH8fPtUV+2vJjJr9ivlMHzIf/toYu8cKzOwIzzbXU8BxMlYzA1mCUi2Wih6SA=="; };
|
"ms@npm:2.1.3" = { filename = "ms-npm-2.1.3-81ff3cfac1-d924b57e73.zip"; hash = "sha512-2SS1fnMSs7Y60h/Fs9wK9eeNYaH8fPtUV+2vJjJr9ivlMHzIf/toYu8cKzOwIzzbXU8BxMlYzA1mCUi2Wih6SA=="; };
|
||||||
"protobufjs@npm:7.6.5" = { filename = "protobufjs-npm-7.6.5-ff4a872120-863eaca9c6.zip"; hash = "sha512-hj6sqcb0W/z7h4fFRfU+nGaWUH4yjjmBtGQ8EtNd9/KCYCHBDj/TC+80LBOo6dMGVHusnAhJ7jv1D3cKEvAdxQ=="; };
|
|
||||||
"typescript@npm:5.4.5" = { filename = "typescript-npm-5.4.5-8568a42232-2954022ada.zip"; hash = "sha512-KVQCKto0D9PWqeK45TT2XVfJLV85iaJjdUp4q6VJ9+ZSmswZIZE1YKS4FsRtzn30pNKfnxGj3A1CE7t20EMlHg=="; };
|
"typescript@npm:5.4.5" = { filename = "typescript-npm-5.4.5-8568a42232-2954022ada.zip"; hash = "sha512-KVQCKto0D9PWqeK45TT2XVfJLV85iaJjdUp4q6VJ9+ZSmswZIZE1YKS4FsRtzn30pNKfnxGj3A1CE7t20EMlHg=="; };
|
||||||
"typescript@npm:5.9.3" = { filename = "typescript-npm-5.9.3-48715be868-6bd7552ce3.zip"; hash = "sha512-a9dVLOOfl+cR21qgSPb5mVtT8cUvfYZnwavcFwDGinajCPV5zTCc5rU2Rt606aG+fIE6k7qvCijM1TajAnDhxQ=="; };
|
"typescript@npm:7.0.2" = { filename = "typescript-npm-7.0.2-0bde2bcec5-3dcee51ec8.zip"; hash = "sha512-Pc7lHsjDMkkjJbzb999ItmZodR8SfmIq59QbbHFusZGEQkpF4U93UPUPNAIyOItp5ih4WRVfBqXOLfdvEssxzw=="; };
|
||||||
"typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::version=5.4.5&hash=5adc0c" = { filename = "typescript-patch-6e159bfddb-db2ad2a16c.zip"; hash = "sha512-2yrSoWyoKfUEJ+6x2hVeekXlmO7HsIbYtOi6ROWiNfdY5gbWgcZpkiMNP8O4mVhl5f0LIqLJVIbQsyAPgwcuyQ=="; };
|
"typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::version=5.4.5&hash=5adc0c" = { filename = "typescript-patch-6e159bfddb-db2ad2a16c.zip"; hash = "sha512-2yrSoWyoKfUEJ+6x2hVeekXlmO7HsIbYtOi6ROWiNfdY5gbWgcZpkiMNP8O4mVhl5f0LIqLJVIbQsyAPgwcuyQ=="; };
|
||||||
"typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5" = { filename = "typescript-patch-6fda4d02cf-ad09fdf7a7.zip"; hash = "sha512-rQn996dWgU3OZbxgwWV7QNREUTRoWO6iMOEPLpWiidkYO24y5cEelazAzMIUtPNiidytS/GIawrbhNcR0zakMA=="; };
|
"typescript@patch:typescript@npm%3A7.0.2#optional!builtin<compat/typescript>::version=7.0.2&hash=3bafbf" = { filename = "typescript-patch-4859cbaf66-6b3cdc369c.zip"; hash = "sha512-azzcNpzYKdRuAHNOpkIz7oRBnCglrY/kCJFa3ed6vO1LeiQB9+7VF9VKek9dHBhpdTy5kBjfHCFZx2HZ8zSDpg=="; };
|
||||||
"undici-types@npm:7.18.2" = { filename = "undici-types-npm-7.18.2-3e6d69d829-85a7918911.zip"; hash = "sha512-haeRiRE6I4lZ16ZHNo5PfFVZw6QE69uPxEiBRc6UJvzYIlKoRKMCeY38Djfm+xeP9IHtA7xMr2NMV1fZ70NSHQ=="; };
|
"undici-types@npm:7.18.2" = { filename = "undici-types-npm-7.18.2-3e6d69d829-85a7918911.zip"; hash = "sha512-haeRiRE6I4lZ16ZHNo5PfFVZw6QE69uPxEiBRc6UJvzYIlKoRKMCeY38Djfm+xeP9IHtA7xMr2NMV1fZ70NSHQ=="; };
|
||||||
"undici-types@npm:8.3.0" = { filename = "undici-types-npm-8.3.0-d34470de3e-c8aa7e2fbe.zip"; hash = "sha512-yKp+L76/zlGWVNr63A7OWb6IjSzK8YD7RJXah157U20kVjRcOEBpx+bz6cmrdDXwdJV9owbxQjQ+7ob/gEiFWg=="; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in overriddenProject
|
in overriddenProject
|
||||||
|
|||||||
@@ -2,16 +2,9 @@
|
|||||||
# Manual changes might be lost - proceed with caution!
|
# Manual changes might be lost - proceed with caution!
|
||||||
|
|
||||||
__metadata:
|
__metadata:
|
||||||
version: 9
|
version: 10
|
||||||
cacheKey: 10c0
|
cacheKey: 10c0
|
||||||
|
|
||||||
"@automerge/automerge@npm:^3.3.0":
|
|
||||||
version: 3.3.0
|
|
||||||
resolution: "@automerge/automerge@npm:3.3.0"
|
|
||||||
checksum: 10c0/74b3a8ef9e3cbf40760e898727ecdad5128e52fd2b053809454ae7b2b85b4ec647c3cba2a635cdbf831f2315731ad425da37a784b79bf13bc86ec28a7e92aff2
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@bufbuild/protobuf@npm:2.12.1, @bufbuild/protobuf@npm:^2.12.1":
|
"@bufbuild/protobuf@npm:2.12.1, @bufbuild/protobuf@npm:^2.12.1":
|
||||||
version: 2.12.1
|
version: 2.12.1
|
||||||
resolution: "@bufbuild/protobuf@npm:2.12.1"
|
resolution: "@bufbuild/protobuf@npm:2.12.1"
|
||||||
@@ -66,107 +59,19 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@protobufjs/aspromise@npm:^1.1.1, @protobufjs/aspromise@npm:^1.1.2":
|
|
||||||
version: 1.1.2
|
|
||||||
resolution: "@protobufjs/aspromise@npm:1.1.2"
|
|
||||||
checksum: 10c0/a83343a468ff5b5ec6bff36fd788a64c839e48a07ff9f4f813564f58caf44d011cd6504ed2147bf34835bd7a7dd2107052af755961c6b098fd8902b4f6500d0f
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/base64@npm:^1.1.2":
|
|
||||||
version: 1.1.2
|
|
||||||
resolution: "@protobufjs/base64@npm:1.1.2"
|
|
||||||
checksum: 10c0/eec925e681081af190b8ee231f9bad3101e189abbc182ff279da6b531e7dbd2a56f1f306f37a80b1be9e00aa2d271690d08dcc5f326f71c9eed8546675c8caf6
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/codegen@npm:^2.0.5":
|
|
||||||
version: 2.0.5
|
|
||||||
resolution: "@protobufjs/codegen@npm:2.0.5"
|
|
||||||
checksum: 10c0/1b8a2ae56ee60a56e9d205cd4b6072a1503c5069b8ebb905710f974ff0098a0d0700641c137e0a8d98dedf14423156a106a9433695cbf52574810f55000fdcab
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/eventemitter@npm:^1.1.1":
|
|
||||||
version: 1.1.1
|
|
||||||
resolution: "@protobufjs/eventemitter@npm:1.1.1"
|
|
||||||
checksum: 10c0/8e06193d4629c5e7c09d4f8c2ddba8fc4dfa739f0149f33a1d901568d35bb7b8b5277a4e8452baf3bdd0b302fd599cf255d193267aa93a0a4747e23cd073c4ac
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/fetch@npm:^1.1.1":
|
|
||||||
version: 1.1.1
|
|
||||||
resolution: "@protobufjs/fetch@npm:1.1.1"
|
|
||||||
dependencies:
|
|
||||||
"@protobufjs/aspromise": "npm:^1.1.1"
|
|
||||||
checksum: 10c0/a497ff5433854e8577f0427983ea39b9113b49a8120f94515291d763327061d2c3013e60e24ea436d091dafae01a0f6eb1867e3b1616045d96a31d8b3c646ed4
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/float@npm:^1.0.2":
|
|
||||||
version: 1.0.2
|
|
||||||
resolution: "@protobufjs/float@npm:1.0.2"
|
|
||||||
checksum: 10c0/18f2bdede76ffcf0170708af15c9c9db6259b771e6b84c51b06df34a9c339dbbeec267d14ce0bddd20acc142b1d980d983d31434398df7f98eb0c94a0eb79069
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/path@npm:^1.1.2":
|
|
||||||
version: 1.1.2
|
|
||||||
resolution: "@protobufjs/path@npm:1.1.2"
|
|
||||||
checksum: 10c0/cece0a938e7f5dfd2fa03f8c14f2f1cf8b0d6e13ac7326ff4c96ea311effd5fb7ae0bba754fbf505312af2e38500250c90e68506b97c02360a43793d88a0d8b4
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/pool@npm:^1.1.0":
|
|
||||||
version: 1.1.0
|
|
||||||
resolution: "@protobufjs/pool@npm:1.1.0"
|
|
||||||
checksum: 10c0/eda2718b7f222ac6e6ad36f758a92ef90d26526026a19f4f17f668f45e0306a5bd734def3f48f51f8134ae0978b6262a5c517c08b115a551756d1a3aadfcf038
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@protobufjs/utf8@npm:^1.1.1":
|
|
||||||
version: 1.1.2
|
|
||||||
resolution: "@protobufjs/utf8@npm:1.1.2"
|
|
||||||
checksum: 10c0/975c6e2c0319bd50c17531d186b537a88cb4d3205e3ca9297cd842b631d341da0ee3ff16be8656cd2660756dc753b29c8a6a14c0ad8ed602c1f91ddf22e7b3f3
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@quixos/camino-datatypes@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-datatypes.git#commit=70f9f45eb7ca23643f1b8220a203d7b3b7aa5bf4":
|
|
||||||
version: 0.1.0
|
|
||||||
resolution: "@quixos/camino-datatypes@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-datatypes.git#commit=70f9f45eb7ca23643f1b8220a203d7b3b7aa5bf4"
|
|
||||||
dependencies:
|
|
||||||
"@automerge/automerge": "npm:^3.3.0"
|
|
||||||
checksum: 10c0/24717b0ac31f68db19cf1b6bc4ed14aa4c3bdd94599d03999be365b6d952817434c08ea396f09dc37309ccb70dc6c184998acc4a3add82fb29708462df2766db
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@quixos/camino-package-runtime@workspace:.":
|
"@quixos/camino-package-runtime@workspace:.":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@quixos/camino-package-runtime@workspace:."
|
resolution: "@quixos/camino-package-runtime@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@automerge/automerge": "npm:^3.3.0"
|
|
||||||
"@bufbuild/protobuf": "npm:^2.12.1"
|
"@bufbuild/protobuf": "npm:^2.12.1"
|
||||||
"@bufbuild/protoc-gen-es": "npm:^2.12.1"
|
"@bufbuild/protoc-gen-es": "npm:^2.12.1"
|
||||||
"@connectrpc/connect": "npm:^2.1.2"
|
"@connectrpc/connect": "npm:^2.1.2"
|
||||||
"@connectrpc/connect-node": "npm:^2.1.2"
|
"@connectrpc/connect-node": "npm:^2.1.2"
|
||||||
"@quixos/camino-datatypes": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/camino-datatypes.git#commit=70f9f45eb7ca23643f1b8220a203d7b3b7aa5bf4"
|
|
||||||
"@types/node": "npm:^24"
|
"@types/node": "npm:^24"
|
||||||
protobufjs: "npm:^7.5.4"
|
typescript: "npm:^7.0.2"
|
||||||
typescript: "npm:^5.9.3"
|
|
||||||
bin:
|
|
||||||
camino-codegen-ts-runtime: dist/codegen-ts-runtime.js
|
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@types/node@npm:>=13.7.0":
|
|
||||||
version: 26.1.1
|
|
||||||
resolution: "@types/node@npm:26.1.1"
|
|
||||||
dependencies:
|
|
||||||
undici-types: "npm:~8.3.0"
|
|
||||||
checksum: 10c0/25ac5093195736dd074d5027adbba85617bc951d5a41506ebd3b9073048acb7233613f3822d5f9b9447f9c0841c91f6387c46283916767e3ef79f23917452c46
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@types/node@npm:^24":
|
"@types/node@npm:^24":
|
||||||
version: 24.13.3
|
version: 24.13.3
|
||||||
resolution: "@types/node@npm:24.13.3"
|
resolution: "@types/node@npm:24.13.3"
|
||||||
@@ -176,6 +81,146 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-aix-ppc64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-aix-ppc64@npm:7.0.2"
|
||||||
|
conditions: os=aix & cpu=ppc64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-darwin-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-darwin-arm64@npm:7.0.2"
|
||||||
|
conditions: os=darwin & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-darwin-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-darwin-x64@npm:7.0.2"
|
||||||
|
conditions: os=darwin & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-freebsd-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-freebsd-arm64@npm:7.0.2"
|
||||||
|
conditions: os=freebsd & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-freebsd-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-freebsd-x64@npm:7.0.2"
|
||||||
|
conditions: os=freebsd & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-arm64@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-arm@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-arm@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=arm
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-loong64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-loong64@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=loong64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-mips64el@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-mips64el@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=mips64el
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-ppc64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-ppc64@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=ppc64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-riscv64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-riscv64@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=riscv64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-s390x@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-s390x@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=s390x
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-linux-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-linux-x64@npm:7.0.2"
|
||||||
|
conditions: os=linux & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-netbsd-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-netbsd-arm64@npm:7.0.2"
|
||||||
|
conditions: os=netbsd & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-netbsd-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-netbsd-x64@npm:7.0.2"
|
||||||
|
conditions: os=netbsd & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-openbsd-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-openbsd-arm64@npm:7.0.2"
|
||||||
|
conditions: os=openbsd & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-openbsd-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-openbsd-x64@npm:7.0.2"
|
||||||
|
conditions: os=openbsd & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-sunos-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-sunos-x64@npm:7.0.2"
|
||||||
|
conditions: os=sunos & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-win32-arm64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-win32-arm64@npm:7.0.2"
|
||||||
|
conditions: os=win32 & cpu=arm64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@typescript/typescript-win32-x64@npm:7.0.2":
|
||||||
|
version: 7.0.2
|
||||||
|
resolution: "@typescript/typescript-win32-x64@npm:7.0.2"
|
||||||
|
conditions: os=win32 & cpu=x64
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@typescript/vfs@npm:^1.6.2":
|
"@typescript/vfs@npm:^1.6.2":
|
||||||
version: 1.6.4
|
version: 1.6.4
|
||||||
resolution: "@typescript/vfs@npm:1.6.4"
|
resolution: "@typescript/vfs@npm:1.6.4"
|
||||||
@@ -199,13 +244,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"long@npm:^5.3.2":
|
|
||||||
version: 5.3.2
|
|
||||||
resolution: "long@npm:5.3.2"
|
|
||||||
checksum: 10c0/7130fe1cbce2dca06734b35b70d380ca3f70271c7f8852c922a7c62c86c4e35f0c39290565eca7133c625908d40e126ac57c02b1b1a4636b9457d77e1e60b981
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"ms@npm:^2.1.3":
|
"ms@npm:^2.1.3":
|
||||||
version: 2.1.3
|
version: 2.1.3
|
||||||
resolution: "ms@npm:2.1.3"
|
resolution: "ms@npm:2.1.3"
|
||||||
@@ -213,25 +251,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"protobufjs@npm:^7.5.4":
|
|
||||||
version: 7.6.5
|
|
||||||
resolution: "protobufjs@npm:7.6.5"
|
|
||||||
dependencies:
|
|
||||||
"@protobufjs/aspromise": "npm:^1.1.2"
|
|
||||||
"@protobufjs/base64": "npm:^1.1.2"
|
|
||||||
"@protobufjs/codegen": "npm:^2.0.5"
|
|
||||||
"@protobufjs/eventemitter": "npm:^1.1.1"
|
|
||||||
"@protobufjs/fetch": "npm:^1.1.1"
|
|
||||||
"@protobufjs/float": "npm:^1.0.2"
|
|
||||||
"@protobufjs/path": "npm:^1.1.2"
|
|
||||||
"@protobufjs/pool": "npm:^1.1.0"
|
|
||||||
"@protobufjs/utf8": "npm:^1.1.1"
|
|
||||||
"@types/node": "npm:>=13.7.0"
|
|
||||||
long: "npm:^5.3.2"
|
|
||||||
checksum: 10c0/863eaca9c6f45bfcfb8787c545f53e9c6696507e328e3981b4643c12d35df7f2826021c10e3fd30bef342c13a8e9d306547bac9c0849ee3bf50f770a12f01dc5
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"typescript@npm:5.4.5":
|
"typescript@npm:5.4.5":
|
||||||
version: 5.4.5
|
version: 5.4.5
|
||||||
resolution: "typescript@npm:5.4.5"
|
resolution: "typescript@npm:5.4.5"
|
||||||
@@ -242,13 +261,74 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typescript@npm:^5.9.3":
|
"typescript@npm:^7.0.2":
|
||||||
version: 5.9.3
|
version: 7.0.2
|
||||||
resolution: "typescript@npm:5.9.3"
|
resolution: "typescript@npm:7.0.2"
|
||||||
|
dependencies:
|
||||||
|
"@typescript/typescript-aix-ppc64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-darwin-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-darwin-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-freebsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-freebsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-arm": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-loong64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-mips64el": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-ppc64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-riscv64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-s390x": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-netbsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-netbsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-openbsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-openbsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-sunos-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-win32-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-win32-x64": "npm:7.0.2"
|
||||||
|
dependenciesMeta:
|
||||||
|
"@typescript/typescript-aix-ppc64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-darwin-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-darwin-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-freebsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-freebsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-arm":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-loong64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-mips64el":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-ppc64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-riscv64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-s390x":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-netbsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-netbsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-openbsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-openbsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-sunos-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-win32-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-win32-x64":
|
||||||
|
optional: true
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
checksum: 10c0/3dcee51ec8c332492325bcdbf7df48b66668751f127e622ae7d41b6c716eb19184424a45e14f7750f50f340232388b69e6287859155f06a5ce2df76f12cb31cf
|
||||||
checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5
|
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -262,13 +342,74 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typescript@patch:typescript@npm%3A^5.9.3#optional!builtin<compat/typescript>":
|
"typescript@patch:typescript@npm%3A^7.0.2#optional!builtin<compat/typescript>":
|
||||||
version: 5.9.3
|
version: 7.0.2
|
||||||
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
|
resolution: "typescript@patch:typescript@npm%3A7.0.2#optional!builtin<compat/typescript>::version=7.0.2&hash=3bafbf"
|
||||||
|
dependencies:
|
||||||
|
"@typescript/typescript-aix-ppc64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-darwin-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-darwin-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-freebsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-freebsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-arm": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-loong64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-mips64el": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-ppc64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-riscv64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-s390x": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-linux-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-netbsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-netbsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-openbsd-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-openbsd-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-sunos-x64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-win32-arm64": "npm:7.0.2"
|
||||||
|
"@typescript/typescript-win32-x64": "npm:7.0.2"
|
||||||
|
dependenciesMeta:
|
||||||
|
"@typescript/typescript-aix-ppc64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-darwin-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-darwin-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-freebsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-freebsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-arm":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-loong64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-mips64el":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-ppc64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-riscv64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-s390x":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-linux-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-netbsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-netbsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-openbsd-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-openbsd-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-sunos-x64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-win32-arm64":
|
||||||
|
optional: true
|
||||||
|
"@typescript/typescript-win32-x64":
|
||||||
|
optional: true
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
checksum: 10c0/6b3cdc369cd829d46e00734ea64233ee84419c2825ad8fe408915adde77abced4b7a2401f7eed517d54a7a4f5d1c1869753cb99018df1c2159c761d9f33483a6
|
||||||
checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
|
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -278,10 +419,3 @@ __metadata:
|
|||||||
checksum: 10c0/85a79189113a238959d7a647368e4f7c5559c3a404ebdb8fc4488145ce9426fcd82252a844a302798dfc0e37e6fb178ff481ed03bc4caf634c5757d9ef43521d
|
checksum: 10c0/85a79189113a238959d7a647368e4f7c5559c3a404ebdb8fc4488145ce9426fcd82252a844a302798dfc0e37e6fb178ff481ed03bc4caf634c5757d9ef43521d
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"undici-types@npm:~8.3.0":
|
|
||||||
version: 8.3.0
|
|
||||||
resolution: "undici-types@npm:8.3.0"
|
|
||||||
checksum: 10c0/c8aa7e2fbebfce519654dafadc0ece59be888d2ccaf180fb4495da875e7b536d2456345c384069c7e6f3e9c9ab7435f074957da306f142343eee86ff8048855a
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|||||||
Reference in New Issue
Block a user