Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 978450888c | |||
| 300592d1b5 |
@@ -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.git",
|
||||||
"sourceCommit": "d3e9e4b0f6d083d578dc7ce36e0f169023603116",
|
"sourceCommit": "e0d8da526c065f66ece8a8230a31be4168ccddcc",
|
||||||
"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"
|
||||||
|
|||||||
+53
-1
@@ -6,6 +6,7 @@ import {
|
|||||||
createClient,
|
createClient,
|
||||||
type Client,
|
type Client,
|
||||||
type HandlerContext,
|
type HandlerContext,
|
||||||
|
type Interceptor,
|
||||||
} from "@connectrpc/connect";
|
} from "@connectrpc/connect";
|
||||||
import {
|
import {
|
||||||
connectNodeAdapter,
|
connectNodeAdapter,
|
||||||
@@ -569,6 +570,46 @@ export const protoFieldsToJs = (
|
|||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const normalizeForCanonicalJson = (value: unknown): unknown => {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return value.map(normalizeForCanonicalJson);
|
||||||
|
}
|
||||||
|
if (!value || typeof value !== "object") {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(value)
|
||||||
|
.filter(([, entryValue]) => entryValue !== undefined)
|
||||||
|
.sort(([left], [right]) => left.localeCompare(right))
|
||||||
|
.map(([key, entryValue]) => [key, normalizeForCanonicalJson(entryValue)]),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const canonicalFieldParams = (
|
||||||
|
params: Record<string, Value> | undefined,
|
||||||
|
) =>
|
||||||
|
JSON.stringify(
|
||||||
|
normalizeForCanonicalJson(
|
||||||
|
Object.fromEntries(
|
||||||
|
Object.entries(params ?? {}).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
protoValueToJs(value),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
export const fieldOperationKey = (params: {
|
||||||
|
objectId: string;
|
||||||
|
fieldName: string;
|
||||||
|
input?: Record<string, Value>;
|
||||||
|
}) =>
|
||||||
|
[
|
||||||
|
params.objectId,
|
||||||
|
params.fieldName,
|
||||||
|
Buffer.from(canonicalFieldParams(params.input)).toString("base64url"),
|
||||||
|
].join(":");
|
||||||
|
|
||||||
const derivedDependencyToProto = (dependency: DerivedDependency) =>
|
const derivedDependencyToProto = (dependency: DerivedDependency) =>
|
||||||
create(DerivedDependencySchema, {
|
create(DerivedDependencySchema, {
|
||||||
kind: dependency.kind,
|
kind: dependency.kind,
|
||||||
@@ -679,9 +720,20 @@ export const serveQuixosPackageRuntime = <
|
|||||||
const host = process.env.QUIXOS_RUNTIME_HOST ?? "127.0.0.1";
|
const host = process.env.QUIXOS_RUNTIME_HOST ?? "127.0.0.1";
|
||||||
const port = Number(process.env.QUIXOS_RUNTIME_PORT ?? "0");
|
const port = Number(process.env.QUIXOS_RUNTIME_PORT ?? "0");
|
||||||
const caminoUrl = process.env.CAMINO_URL ?? "http://127.0.0.1:7310";
|
const caminoUrl = process.env.CAMINO_URL ?? "http://127.0.0.1:7310";
|
||||||
|
const runtimeToken = process.env.CAMINO_RUNTIME_AUTH_TOKEN ?? "";
|
||||||
|
const runtimeTokenInterceptor: Interceptor = (next) => async (request) => {
|
||||||
|
if (runtimeToken) {
|
||||||
|
request.header.set("x-camino-runtime-token", runtimeToken);
|
||||||
|
}
|
||||||
|
return await next(request);
|
||||||
|
};
|
||||||
const camino = createClient(
|
const camino = createClient(
|
||||||
CaminoService,
|
CaminoService,
|
||||||
createConnectTransport({ baseUrl: caminoUrl, httpVersion: "1.1" }),
|
createConnectTransport({
|
||||||
|
baseUrl: caminoUrl,
|
||||||
|
httpVersion: "1.1",
|
||||||
|
interceptors: runtimeToken ? [runtimeTokenInterceptor] : [],
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
const trackingCamino = createDependencyTrackingCaminoClient(camino);
|
const trackingCamino = createDependencyTrackingCaminoClient(camino);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user