@qlever-llc/trellis 0.10.1-rc.6 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/generated-sdk/auth/api.d.ts +1 -4
- package/esm/generated-sdk/auth/api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/api.js +1 -4
- package/esm/generated-sdk/auth/client.d.ts +0 -8
- package/esm/generated-sdk/auth/client.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
- package/esm/generated-sdk/auth/mod.d.ts.map +1 -1
- package/esm/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/auth/types.d.ts.map +1 -1
- package/esm/generated-sdk/health/api.d.ts.map +1 -1
- package/esm/generated-sdk/health/client.d.ts.map +1 -1
- package/esm/generated-sdk/health/contract.d.ts.map +1 -1
- package/esm/generated-sdk/health/mod.d.ts.map +1 -1
- package/esm/generated-sdk/health/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/health/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/health/types.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/client.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/types.d.ts.map +1 -1
- package/esm/generated-sdk/state/api.d.ts.map +1 -1
- package/esm/generated-sdk/state/client.d.ts.map +1 -1
- package/esm/generated-sdk/state/contract.d.ts.map +1 -1
- package/esm/generated-sdk/state/mod.d.ts.map +1 -1
- package/esm/generated-sdk/state/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/state/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/state/types.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/api.d.ts +1 -4
- package/esm/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/api.js +1 -4
- package/esm/generated-sdk/trellis-core/client.d.ts +2 -14
- package/esm/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/esm/npm/src/sdk/auth.d.ts.map +1 -1
- package/esm/npm/src/sdk/core.d.ts.map +1 -1
- package/esm/npm/src/sdk/health.d.ts.map +1 -1
- package/esm/npm/src/sdk/jobs.d.ts.map +1 -1
- package/esm/npm/src/sdk/state.d.ts.map +1 -1
- package/package.json +2 -2
- package/script/generated-sdk/auth/api.d.ts +1 -4
- package/script/generated-sdk/auth/api.d.ts.map +1 -1
- package/script/generated-sdk/auth/api.js +1 -4
- package/script/generated-sdk/auth/client.d.ts +0 -8
- package/script/generated-sdk/auth/client.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.d.ts.map +1 -1
- package/script/generated-sdk/auth/mod.d.ts.map +1 -1
- package/script/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/script/generated-sdk/auth/types.d.ts.map +1 -1
- package/script/generated-sdk/health/api.d.ts.map +1 -1
- package/script/generated-sdk/health/client.d.ts.map +1 -1
- package/script/generated-sdk/health/contract.d.ts.map +1 -1
- package/script/generated-sdk/health/mod.d.ts.map +1 -1
- package/script/generated-sdk/health/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/health/schemas.d.ts.map +1 -1
- package/script/generated-sdk/health/types.d.ts.map +1 -1
- package/script/generated-sdk/jobs/api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/client.d.ts.map +1 -1
- package/script/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/script/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/script/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/script/generated-sdk/jobs/types.d.ts.map +1 -1
- package/script/generated-sdk/state/api.d.ts.map +1 -1
- package/script/generated-sdk/state/client.d.ts.map +1 -1
- package/script/generated-sdk/state/contract.d.ts.map +1 -1
- package/script/generated-sdk/state/mod.d.ts.map +1 -1
- package/script/generated-sdk/state/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/state/schemas.d.ts.map +1 -1
- package/script/generated-sdk/state/types.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/api.d.ts +1 -4
- package/script/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/api.js +1 -4
- package/script/generated-sdk/trellis-core/client.d.ts +2 -14
- package/script/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/script/npm/src/sdk/auth.d.ts.map +1 -1
- package/script/npm/src/sdk/core.d.ts.map +1 -1
- package/script/npm/src/sdk/health.d.ts.map +1 -1
- package/script/npm/src/sdk/jobs.d.ts.map +1 -1
- package/script/npm/src/sdk/state.d.ts.map +1 -1
- package/src/sdk/_generated/auth/api.ts +47 -0
- package/src/sdk/_generated/auth/client.ts +207 -0
- package/src/sdk/_generated/auth/contract.ts +67 -0
- package/src/sdk/_generated/auth/mod.ts +7 -0
- package/src/sdk/_generated/auth/owned_api.ts +609 -0
- package/src/sdk/_generated/auth/schemas.ts +279 -0
- package/src/sdk/_generated/auth/types.ts +378 -0
- package/src/sdk/_generated/core/api.ts +47 -0
- package/src/sdk/_generated/core/client.ts +53 -0
- package/src/sdk/_generated/core/contract.ts +67 -0
- package/src/sdk/_generated/core/mod.ts +6 -0
- package/src/sdk/_generated/core/owned_api.ts +51 -0
- package/src/sdk/_generated/core/schemas.ts +17 -0
- package/src/sdk/_generated/core/types.ts +40 -0
- package/src/sdk/_generated/health/api.ts +47 -0
- package/src/sdk/_generated/health/client.ts +45 -0
- package/src/sdk/_generated/health/contract.ts +67 -0
- package/src/sdk/_generated/health/mod.ts +6 -0
- package/src/sdk/_generated/health/owned_api.ts +25 -0
- package/src/sdk/_generated/health/schemas.ts +3 -0
- package/src/sdk/_generated/health/types.ts +19 -0
- package/src/sdk/_generated/jobs/api.ts +58 -0
- package/src/sdk/_generated/jobs/client.ts +78 -0
- package/src/sdk/_generated/jobs/contract.ts +67 -0
- package/src/sdk/_generated/jobs/mod.ts +6 -0
- package/src/sdk/_generated/jobs/owned_api.ts +126 -0
- package/src/sdk/_generated/jobs/schemas.ts +39 -0
- package/src/sdk/_generated/jobs/types.ts +92 -0
- package/src/sdk/_generated/state/api.ts +50 -0
- package/src/sdk/_generated/state/client.ts +66 -0
- package/src/sdk/_generated/state/contract.ts +67 -0
- package/src/sdk/_generated/state/mod.ts +6 -0
- package/src/sdk/_generated/state/owned_api.ts +75 -0
- package/src/sdk/_generated/state/schemas.ts +29 -0
- package/src/sdk/_generated/state/types.ts +55 -0
- package/src/sdk/auth.ts +1 -1
- package/src/sdk/core.ts +1 -1
- package/src/sdk/health.ts +1 -1
- package/src/sdk/jobs.ts +1 -1
- package/src/sdk/state.ts +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.core@v1.json
|
|
2
|
+
import type { ContractDependencyUse, SdkContractModule, TrellisContractV1, UseSpec } from "@qlever-llc/trellis";
|
|
3
|
+
import { API } from "./api.js";
|
|
4
|
+
|
|
5
|
+
const CONTRACT_MODULE_METADATA = Symbol.for("@qlever-llc/trellis/contracts/contract-module");
|
|
6
|
+
|
|
7
|
+
export const CONTRACT_ID = "trellis.core@v1" as const;
|
|
8
|
+
export const CONTRACT_DIGEST = "L4HW6uUIxDhK1Kpa_PUxpumoMberMgiCgJTNN5Qvje0" as const;
|
|
9
|
+
export const CONTRACT = {"capabilities":{"trellis.core::catalog.read":{"description":"List the installed Trellis contract catalog.","displayName":"Read contract catalog"},"trellis.core::contract.read":{"description":"Read installed contract manifests and metadata.","displayName":"Read installed contracts"}},"description":"Trellis runtime RPCs available to all connected participants.","displayName":"Trellis Core","docs":{"markdown":"Exposes the Trellis catalog, contract details, runtime bindings, and surface availability checks used by platform participants.","summary":"Runtime catalog and binding APIs."},"format":"trellis.contract.v1","id":"trellis.core@v1","kind":"service","rpc":{"Trellis.Bindings.Get":{"capabilities":{"call":["service"]},"docs":{"markdown":"Returns runtime resource bindings for the caller's active service contract.","summary":"Read service resource bindings."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"TrellisBindingsGetRequest"},"internal":true,"output":{"schema":"TrellisBindingsGetResponse"},"subject":"rpc.v1.Trellis.Bindings.Get","version":"v1"},"Trellis.Catalog":{"capabilities":{"call":["trellis.core::catalog.read"]},"docs":{"markdown":"Returns the active contract catalog entries available in the deployment.","summary":"List visible contracts."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"TrellisCatalogRequest"},"output":{"schema":"TrellisCatalogResponse"},"subject":"rpc.v1.Trellis.Catalog","version":"v1"},"Trellis.Contract.Get":{"capabilities":{"call":["trellis.core::contract.read"]},"docs":{"markdown":"Returns the normalized contract manifest for a known contract digest.","summary":"Read one contract manifest."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"TrellisContractGetRequest"},"output":{"schema":"TrellisContractGetResponse"},"subject":"rpc.v1.Trellis.Contract.Get","version":"v1"},"Trellis.Surface.Status":{"capabilities":{"call":["trellis.core::catalog.read"]},"docs":{"markdown":"Reports capability and deployment authority status for a contract-owned surface.","summary":"Inspect surface availability."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"TrellisSurfaceStatusRequest"},"output":{"schema":"TrellisSurfaceStatusResponse"},"subject":"rpc.v1.Trellis.Surface.Status","version":"v1"}},"schemas":{"TrellisBindingsGetRequest":{"properties":{"contractId":{"minLength":1,"type":"string"},"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"}},"type":"object"},"TrellisBindingsGetResponse":{"properties":{"binding":{"properties":{"contractId":{"minLength":1,"type":"string"},"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"},"resources":{"properties":{"eventConsumers":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"filterSubjects":{"items":{"minLength":1,"type":"string"},"type":"array"},"maxDeliver":{"minimum":1,"type":"integer"},"ordering":{"const":"strict","type":"string"},"replay":{"anyOf":[{"const":"new","type":"string"},{"const":"all","type":"string"}]},"stream":{"minLength":1,"type":"string"}},"required":["stream","consumerName","filterSubjects","replay","ordering","concurrency","ackWaitMs","maxDeliver","backoffMs"],"type":"object"}},"type":"object"},"jobs":{"properties":{"namespace":{"minLength":1,"type":"string"},"queues":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"defaultDeadlineMs":{"minimum":1,"type":"integer"},"dlq":{"type":"boolean"},"logs":{"type":"boolean"},"maxDeliver":{"minimum":1,"type":"integer"},"payload":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"progress":{"type":"boolean"},"publishPrefix":{"minLength":1,"type":"string"},"queueType":{"minLength":1,"type":"string"},"result":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"workSubject":{"minLength":1,"type":"string"}},"required":["queueType","publishPrefix","workSubject","consumerName","payload","maxDeliver","backoffMs","ackWaitMs","progress","logs","dlq","concurrency"],"type":"object"}},"type":"object"},"workStream":{"minLength":1,"type":"string"}},"required":["namespace","queues"],"type":"object"},"kv":{"patternProperties":{"^.*$":{"properties":{"bucket":{"minLength":1,"type":"string"},"history":{"minimum":1,"type":"integer"},"maxValueBytes":{"minimum":1,"type":"integer"},"ttlMs":{"minimum":0,"type":"integer"}},"required":["bucket","history","ttlMs"],"type":"object"}},"type":"object"},"store":{"patternProperties":{"^.*$":{"properties":{"maxObjectBytes":{"minimum":1,"type":"integer"},"maxTotalBytes":{"minimum":1,"type":"integer"},"name":{"minLength":1,"type":"string"},"ttlMs":{"minimum":0,"type":"integer"}},"required":["name","ttlMs"],"type":"object"}},"type":"object"}},"type":"object"}},"required":["contractId","digest","resources"],"type":"object"},"eventConsumers":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"filterSubjects":{"items":{"minLength":1,"type":"string"},"type":"array"},"maxDeliver":{"minimum":1,"type":"integer"},"ordering":{"const":"strict","type":"string"},"replay":{"anyOf":[{"const":"new","type":"string"},{"const":"all","type":"string"}]},"stream":{"minLength":1,"type":"string"}},"required":["stream","consumerName","filterSubjects","replay","ordering","concurrency","ackWaitMs","maxDeliver","backoffMs"],"type":"object"}},"type":"object"}},"type":"object"},"TrellisCatalogRequest":{"properties":{},"type":"object"},"TrellisCatalogResponse":{"properties":{"catalog":{"properties":{"contracts":{"items":{"properties":{"description":{"minLength":1,"type":"string"},"digest":{"type":"string"},"displayName":{"minLength":1,"type":"string"},"id":{"type":"string"}},"required":["id","digest","displayName","description"],"type":"object"},"type":"array"},"format":{"const":"trellis.catalog.v1","type":"string"},"issues":{"items":{"properties":{"actions":{"items":{"properties":{"action":{"anyOf":[{"const":"keep-current","type":"string"},{"const":"force-replace","type":"string"}]},"deploymentIds":{"items":{"type":"string"},"type":"array"},"description":{"minLength":1,"type":"string"},"digests":{"items":{"type":"string"},"type":"array"},"label":{"minLength":1,"type":"string"},"risk":{"anyOf":[{"const":"recommended","type":"string"},{"const":"dangerous","type":"string"}]}},"required":["action","label","description","risk","deploymentIds","digests"],"type":"object"},"type":"array"},"conflictingDeploymentIds":{"items":{"type":"string"},"type":"array"},"conflictingDigest":{"type":"string"},"conflictingDigests":{"items":{"type":"string"},"type":"array"},"contractId":{"type":"string"},"deploymentIds":{"items":{"type":"string"},"type":"array"},"digest":{"type":"string"},"effectiveDeploymentIds":{"items":{"type":"string"},"type":"array"},"effectiveDigests":{"items":{"type":"string"},"type":"array"},"issueId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"missing-active-contract","type":"string"},{"const":"invalid-active-contract","type":"string"},{"const":"incompatible-active-contract","type":"string"},{"const":"invalid-active-contract-uses","type":"string"}]},"message":{"minLength":1,"type":"string"}},"required":["issueId","kind","message","deploymentIds","actions"],"type":"object"},"type":"array"}},"required":["format","contracts"],"type":"object"}},"required":["catalog"],"type":"object"},"TrellisContractGetRequest":{"properties":{"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"}},"required":["digest"],"type":"object"},"TrellisContractGetResponse":{"properties":{"contract":{"properties":{"description":{"minLength":1,"type":"string"},"displayName":{"minLength":1,"type":"string"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"errors":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"events":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"exports":{"properties":{"schemas":{"items":{"minLength":1,"type":"string"},"type":"array"}},"type":"object"},"format":{"const":"trellis.contract.v1","type":"string"},"id":{"minLength":1,"type":"string"},"jobs":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"defaultDeadlineMs":{"minimum":1,"type":"integer"},"dlq":{"type":"boolean"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"logs":{"type":"boolean"},"maxDeliver":{"minimum":1,"type":"integer"},"payload":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"progress":{"type":"boolean"},"result":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"}},"required":["payload"],"type":"object"}},"type":"object"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"app","type":"string"},{"const":"device","type":"string"},{"const":"agent","type":"string"}]},"operations":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"resources":{"additionalProperties":false,"properties":{"kv":{"patternProperties":{"^.*$":{"properties":{"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"history":{"default":1,"minimum":1,"type":"integer"},"maxValueBytes":{"minimum":1,"type":"integer"},"purpose":{"minLength":1,"type":"string"},"required":{"default":true,"type":"boolean"},"schema":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"ttlMs":{"default":0,"minimum":0,"type":"integer"}},"required":["purpose","schema"],"type":"object"}},"type":"object"},"store":{"patternProperties":{"^.*$":{"properties":{"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"maxObjectBytes":{"minimum":1,"type":"integer"},"maxTotalBytes":{"minimum":1,"type":"integer"},"purpose":{"minLength":1,"type":"string"},"required":{"default":true,"type":"boolean"},"ttlMs":{"default":0,"minimum":0,"type":"integer"}},"required":["purpose"],"type":"object"}},"type":"object"}},"type":"object"},"rpc":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"schemas":{"patternProperties":{"^.*$":{"anyOf":[{"type":"object"},{"type":"boolean"}]}},"type":"object"},"state":{"patternProperties":{"^.*$":{"properties":{"acceptedVersions":{"patternProperties":{"^.*$":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"}},"type":"object"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"kind":{"anyOf":[{"const":"value","type":"string"},{"const":"map","type":"string"}]},"schema":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"stateVersion":{"minLength":1,"type":"string"}},"required":["kind","schema"],"type":"object"}},"type":"object"},"uses":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"}},"required":["format","id","displayName","description","kind"],"type":"object"}},"required":["contract"],"type":"object"},"TrellisSurfaceStatusRequest":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"surface":{"minLength":1,"type":"string"}},"required":["contractId","kind","surface"],"type":"object"},"TrellisSurfaceStatusResponse":{"properties":{"status":{"anyOf":[{"properties":{"liveImplementer":{"type":"boolean"},"runtime":{"anyOf":[{"const":"live","type":"string"},{"const":"no_live_implementer","type":"string"},{"const":"disabled","type":"string"}]},"state":{"const":"available","type":"string"}},"required":["state","liveImplementer","runtime"],"type":"object"},{"properties":{"reason":{"anyOf":[{"const":"authority_unavailable","type":"string"}]},"state":{"const":"unavailable","type":"string"}},"required":["state","reason"],"type":"object"},{"properties":{"missingCapabilities":{"items":{"type":"string"},"type":"array"},"state":{"const":"unauthorized","type":"string"}},"required":["state","missingCapabilities"],"type":"object"},{"properties":{"contractId":{"minLength":1,"type":"string"},"state":{"const":"unknown_contract","type":"string"}},"required":["state","contractId"],"type":"object"},{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"minLength":1,"type":"string"},"state":{"const":"unknown_surface","type":"string"},"surface":{"minLength":1,"type":"string"}},"required":["state","contractId","kind","surface"],"type":"object"}]}},"required":["status"],"type":"object"}},"uses":{"required":{"health":{"contract":"trellis.health@v1","events":{"publish":["Health.Heartbeat"]}}}}} as TrellisContractV1;
|
|
10
|
+
|
|
11
|
+
function assertSelectedKeysExist(
|
|
12
|
+
kind: "rpc" | "operations" | "events" | "feeds",
|
|
13
|
+
keys: readonly string[] | undefined,
|
|
14
|
+
api: Record<string, unknown>,
|
|
15
|
+
) {
|
|
16
|
+
if (!keys) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const key of keys) {
|
|
21
|
+
if (!Object.hasOwn(api, key)) {
|
|
22
|
+
throw new Error(`Contract '${CONTRACT_ID}' does not expose ${kind} key '${key}'`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function assertValidUseSpec(spec: UseSpec<typeof API.owned>) {
|
|
28
|
+
assertSelectedKeysExist("rpc", spec.rpc?.call, API.owned.rpc);
|
|
29
|
+
assertSelectedKeysExist("operations", spec.operations?.call, API.owned.operations);
|
|
30
|
+
assertSelectedKeysExist("events", spec.events?.publish, API.owned.events);
|
|
31
|
+
assertSelectedKeysExist("events", spec.events?.subscribe, API.owned.events);
|
|
32
|
+
assertSelectedKeysExist("feeds", spec.feeds?.subscribe, API.owned.feeds);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const sdk: SdkContractModule<typeof CONTRACT_ID, typeof API.owned> = {
|
|
36
|
+
CONTRACT_ID,
|
|
37
|
+
CONTRACT_DIGEST,
|
|
38
|
+
CONTRACT,
|
|
39
|
+
API,
|
|
40
|
+
use: (<const TSpec extends UseSpec<typeof API.owned>>(spec: TSpec) => {
|
|
41
|
+
assertValidUseSpec(spec);
|
|
42
|
+
|
|
43
|
+
const dependencyUse = {
|
|
44
|
+
contract: CONTRACT_ID,
|
|
45
|
+
...(spec.rpc?.call ? { rpc: { call: [...spec.rpc.call] } } : {}),
|
|
46
|
+
...(spec.operations?.call ? { operations: { call: [...spec.operations.call] } } : {}),
|
|
47
|
+
...((spec.events?.publish || spec.events?.subscribe)
|
|
48
|
+
? {
|
|
49
|
+
events: {
|
|
50
|
+
...(spec.events.publish ? { publish: [...spec.events.publish] } : {}),
|
|
51
|
+
...(spec.events.subscribe ? { subscribe: [...spec.events.subscribe] } : {}),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
: {}),
|
|
55
|
+
...(spec.feeds?.subscribe ? { feeds: { subscribe: [...spec.feeds.subscribe] } } : {}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
Object.defineProperty(dependencyUse, CONTRACT_MODULE_METADATA, {
|
|
59
|
+
value: sdk,
|
|
60
|
+
enumerable: false,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return dependencyUse as ContractDependencyUse<typeof CONTRACT_ID, typeof API.owned, TSpec>;
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const use = sdk.use;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { API, OWNED_API } from "./api.js";
|
|
2
|
+
export type { Api, ApiViews, OwnedApi } from "./api.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
|
+
export * from "./schemas.js";
|
|
5
|
+
export type { Client, HandlerClient, TrellisCoreClient, TrellisCoreState } from "./client.js";
|
|
6
|
+
export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.core@v1.json
|
|
2
|
+
import type { TrellisAPI } from "@qlever-llc/trellis/contracts";
|
|
3
|
+
import { schema } from "@qlever-llc/trellis/contracts";
|
|
4
|
+
import type * as Types from "./types.js";
|
|
5
|
+
import { TrellisBindingsGetRequestSchema, TrellisBindingsGetResponseSchema, TrellisCatalogRequestSchema, TrellisCatalogResponseSchema, TrellisContractGetRequestSchema, TrellisContractGetResponseSchema, TrellisSurfaceStatusRequestSchema, TrellisSurfaceStatusResponseSchema } from "./schemas.js";
|
|
6
|
+
|
|
7
|
+
export const OWNED_API = {
|
|
8
|
+
rpc: {
|
|
9
|
+
"Trellis.Bindings.Get": {
|
|
10
|
+
subject: "rpc.v1.Trellis.Bindings.Get",
|
|
11
|
+
input: schema<Types.TrellisBindingsGetInput>(TrellisBindingsGetRequestSchema),
|
|
12
|
+
output: schema<Types.TrellisBindingsGetOutput>(TrellisBindingsGetResponseSchema),
|
|
13
|
+
callerCapabilities: ["service"],
|
|
14
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
15
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
16
|
+
},
|
|
17
|
+
"Trellis.Catalog": {
|
|
18
|
+
subject: "rpc.v1.Trellis.Catalog",
|
|
19
|
+
input: schema<Types.TrellisCatalogInput>(TrellisCatalogRequestSchema),
|
|
20
|
+
output: schema<Types.TrellisCatalogOutput>(TrellisCatalogResponseSchema),
|
|
21
|
+
callerCapabilities: ["trellis.core::catalog.read"],
|
|
22
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
23
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
24
|
+
},
|
|
25
|
+
"Trellis.Contract.Get": {
|
|
26
|
+
subject: "rpc.v1.Trellis.Contract.Get",
|
|
27
|
+
input: schema<Types.TrellisContractGetInput>(TrellisContractGetRequestSchema),
|
|
28
|
+
output: schema<Types.TrellisContractGetOutput>(TrellisContractGetResponseSchema),
|
|
29
|
+
callerCapabilities: ["trellis.core::contract.read"],
|
|
30
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
31
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
32
|
+
},
|
|
33
|
+
"Trellis.Surface.Status": {
|
|
34
|
+
subject: "rpc.v1.Trellis.Surface.Status",
|
|
35
|
+
input: schema<Types.TrellisSurfaceStatusInput>(TrellisSurfaceStatusRequestSchema),
|
|
36
|
+
output: schema<Types.TrellisSurfaceStatusOutput>(TrellisSurfaceStatusResponseSchema),
|
|
37
|
+
callerCapabilities: ["trellis.core::catalog.read"],
|
|
38
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
39
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
operations: {
|
|
43
|
+
},
|
|
44
|
+
events: {
|
|
45
|
+
},
|
|
46
|
+
feeds: {
|
|
47
|
+
},
|
|
48
|
+
subjects: {
|
|
49
|
+
},
|
|
50
|
+
} satisfies TrellisAPI;
|
|
51
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.core@v1.json
|
|
2
|
+
export const TrellisBindingsGetRequestSchema = {"properties":{"contractId":{"minLength":1,"type":"string"},"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"}},"type":"object"} as const;
|
|
3
|
+
|
|
4
|
+
export const TrellisBindingsGetResponseSchema = {"properties":{"binding":{"properties":{"contractId":{"minLength":1,"type":"string"},"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"},"resources":{"properties":{"eventConsumers":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"filterSubjects":{"items":{"minLength":1,"type":"string"},"type":"array"},"maxDeliver":{"minimum":1,"type":"integer"},"ordering":{"const":"strict","type":"string"},"replay":{"anyOf":[{"const":"new","type":"string"},{"const":"all","type":"string"}]},"stream":{"minLength":1,"type":"string"}},"required":["stream","consumerName","filterSubjects","replay","ordering","concurrency","ackWaitMs","maxDeliver","backoffMs"],"type":"object"}},"type":"object"},"jobs":{"properties":{"namespace":{"minLength":1,"type":"string"},"queues":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"defaultDeadlineMs":{"minimum":1,"type":"integer"},"dlq":{"type":"boolean"},"logs":{"type":"boolean"},"maxDeliver":{"minimum":1,"type":"integer"},"payload":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"progress":{"type":"boolean"},"publishPrefix":{"minLength":1,"type":"string"},"queueType":{"minLength":1,"type":"string"},"result":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"workSubject":{"minLength":1,"type":"string"}},"required":["queueType","publishPrefix","workSubject","consumerName","payload","maxDeliver","backoffMs","ackWaitMs","progress","logs","dlq","concurrency"],"type":"object"}},"type":"object"},"workStream":{"minLength":1,"type":"string"}},"required":["namespace","queues"],"type":"object"},"kv":{"patternProperties":{"^.*$":{"properties":{"bucket":{"minLength":1,"type":"string"},"history":{"minimum":1,"type":"integer"},"maxValueBytes":{"minimum":1,"type":"integer"},"ttlMs":{"minimum":0,"type":"integer"}},"required":["bucket","history","ttlMs"],"type":"object"}},"type":"object"},"store":{"patternProperties":{"^.*$":{"properties":{"maxObjectBytes":{"minimum":1,"type":"integer"},"maxTotalBytes":{"minimum":1,"type":"integer"},"name":{"minLength":1,"type":"string"},"ttlMs":{"minimum":0,"type":"integer"}},"required":["name","ttlMs"],"type":"object"}},"type":"object"}},"type":"object"}},"required":["contractId","digest","resources"],"type":"object"},"eventConsumers":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"consumerName":{"minLength":1,"type":"string"},"filterSubjects":{"items":{"minLength":1,"type":"string"},"type":"array"},"maxDeliver":{"minimum":1,"type":"integer"},"ordering":{"const":"strict","type":"string"},"replay":{"anyOf":[{"const":"new","type":"string"},{"const":"all","type":"string"}]},"stream":{"minLength":1,"type":"string"}},"required":["stream","consumerName","filterSubjects","replay","ordering","concurrency","ackWaitMs","maxDeliver","backoffMs"],"type":"object"}},"type":"object"}},"type":"object"} as const;
|
|
5
|
+
|
|
6
|
+
export const TrellisCatalogRequestSchema = {"properties":{},"type":"object"} as const;
|
|
7
|
+
|
|
8
|
+
export const TrellisCatalogResponseSchema = {"properties":{"catalog":{"properties":{"contracts":{"items":{"properties":{"description":{"minLength":1,"type":"string"},"digest":{"type":"string"},"displayName":{"minLength":1,"type":"string"},"id":{"type":"string"}},"required":["id","digest","displayName","description"],"type":"object"},"type":"array"},"format":{"const":"trellis.catalog.v1","type":"string"},"issues":{"items":{"properties":{"actions":{"items":{"properties":{"action":{"anyOf":[{"const":"keep-current","type":"string"},{"const":"force-replace","type":"string"}]},"deploymentIds":{"items":{"type":"string"},"type":"array"},"description":{"minLength":1,"type":"string"},"digests":{"items":{"type":"string"},"type":"array"},"label":{"minLength":1,"type":"string"},"risk":{"anyOf":[{"const":"recommended","type":"string"},{"const":"dangerous","type":"string"}]}},"required":["action","label","description","risk","deploymentIds","digests"],"type":"object"},"type":"array"},"conflictingDeploymentIds":{"items":{"type":"string"},"type":"array"},"conflictingDigest":{"type":"string"},"conflictingDigests":{"items":{"type":"string"},"type":"array"},"contractId":{"type":"string"},"deploymentIds":{"items":{"type":"string"},"type":"array"},"digest":{"type":"string"},"effectiveDeploymentIds":{"items":{"type":"string"},"type":"array"},"effectiveDigests":{"items":{"type":"string"},"type":"array"},"issueId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"missing-active-contract","type":"string"},{"const":"invalid-active-contract","type":"string"},{"const":"incompatible-active-contract","type":"string"},{"const":"invalid-active-contract-uses","type":"string"}]},"message":{"minLength":1,"type":"string"}},"required":["issueId","kind","message","deploymentIds","actions"],"type":"object"},"type":"array"}},"required":["format","contracts"],"type":"object"}},"required":["catalog"],"type":"object"} as const;
|
|
9
|
+
|
|
10
|
+
export const TrellisContractGetRequestSchema = {"properties":{"digest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"}},"required":["digest"],"type":"object"} as const;
|
|
11
|
+
|
|
12
|
+
export const TrellisContractGetResponseSchema = {"properties":{"contract":{"properties":{"description":{"minLength":1,"type":"string"},"displayName":{"minLength":1,"type":"string"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"errors":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"events":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"exports":{"properties":{"schemas":{"items":{"minLength":1,"type":"string"},"type":"array"}},"type":"object"},"format":{"const":"trellis.contract.v1","type":"string"},"id":{"minLength":1,"type":"string"},"jobs":{"patternProperties":{"^.*$":{"properties":{"ackWaitMs":{"minimum":1,"type":"integer"},"backoffMs":{"items":{"minimum":0,"type":"integer"},"type":"array"},"concurrency":{"minimum":1,"type":"integer"},"defaultDeadlineMs":{"minimum":1,"type":"integer"},"dlq":{"type":"boolean"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"logs":{"type":"boolean"},"maxDeliver":{"minimum":1,"type":"integer"},"payload":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"progress":{"type":"boolean"},"result":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"}},"required":["payload"],"type":"object"}},"type":"object"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"app","type":"string"},{"const":"device","type":"string"},{"const":"agent","type":"string"}]},"operations":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"resources":{"additionalProperties":false,"properties":{"kv":{"patternProperties":{"^.*$":{"properties":{"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"history":{"default":1,"minimum":1,"type":"integer"},"maxValueBytes":{"minimum":1,"type":"integer"},"purpose":{"minLength":1,"type":"string"},"required":{"default":true,"type":"boolean"},"schema":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"ttlMs":{"default":0,"minimum":0,"type":"integer"}},"required":["purpose","schema"],"type":"object"}},"type":"object"},"store":{"patternProperties":{"^.*$":{"properties":{"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"maxObjectBytes":{"minimum":1,"type":"integer"},"maxTotalBytes":{"minimum":1,"type":"integer"},"purpose":{"minLength":1,"type":"string"},"required":{"default":true,"type":"boolean"},"ttlMs":{"default":0,"minimum":0,"type":"integer"}},"required":["purpose"],"type":"object"}},"type":"object"}},"type":"object"},"rpc":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"},"schemas":{"patternProperties":{"^.*$":{"anyOf":[{"type":"object"},{"type":"boolean"}]}},"type":"object"},"state":{"patternProperties":{"^.*$":{"properties":{"acceptedVersions":{"patternProperties":{"^.*$":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"}},"type":"object"},"docs":{"properties":{"markdown":{"type":"string"},"summary":{"type":"string"}},"required":["markdown"],"type":"object"},"kind":{"anyOf":[{"const":"value","type":"string"},{"const":"map","type":"string"}]},"schema":{"properties":{"schema":{"minLength":1,"type":"string"}},"required":["schema"],"type":"object"},"stateVersion":{"minLength":1,"type":"string"}},"required":["kind","schema"],"type":"object"}},"type":"object"},"uses":{"patternProperties":{"^.*$":{"type":"object"}},"type":"object"}},"required":["format","id","displayName","description","kind"],"type":"object"}},"required":["contract"],"type":"object"} as const;
|
|
13
|
+
|
|
14
|
+
export const TrellisSurfaceStatusRequestSchema = {"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"surface":{"minLength":1,"type":"string"}},"required":["contractId","kind","surface"],"type":"object"} as const;
|
|
15
|
+
|
|
16
|
+
export const TrellisSurfaceStatusResponseSchema = {"properties":{"status":{"anyOf":[{"properties":{"liveImplementer":{"type":"boolean"},"runtime":{"anyOf":[{"const":"live","type":"string"},{"const":"no_live_implementer","type":"string"},{"const":"disabled","type":"string"}]},"state":{"const":"available","type":"string"}},"required":["state","liveImplementer","runtime"],"type":"object"},{"properties":{"reason":{"anyOf":[{"const":"authority_unavailable","type":"string"}]},"state":{"const":"unavailable","type":"string"}},"required":["state","reason"],"type":"object"},{"properties":{"missingCapabilities":{"items":{"type":"string"},"type":"array"},"state":{"const":"unauthorized","type":"string"}},"required":["state","missingCapabilities"],"type":"object"},{"properties":{"contractId":{"minLength":1,"type":"string"},"state":{"const":"unknown_contract","type":"string"}},"required":["state","contractId"],"type":"object"},{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"minLength":1,"type":"string"},"state":{"const":"unknown_surface","type":"string"},"surface":{"minLength":1,"type":"string"}},"required":["state","contractId","kind","surface"],"type":"object"}]}},"required":["status"],"type":"object"} as const;
|
|
17
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.core@v1.json
|
|
2
|
+
import type { RpcHandlerFn } from "@qlever-llc/trellis";
|
|
3
|
+
import type { API } from "./api.js";
|
|
4
|
+
|
|
5
|
+
export const CONTRACT_ID = "trellis.core@v1" as const;
|
|
6
|
+
export const CONTRACT_DIGEST = "L4HW6uUIxDhK1Kpa_PUxpumoMberMgiCgJTNN5Qvje0" as const;
|
|
7
|
+
|
|
8
|
+
export type TrellisBindingsGetInput = { contractId?: string; digest?: string; };
|
|
9
|
+
export type TrellisBindingsGetOutput = { binding?: { contractId: string; digest: string; resources: { eventConsumers?: { [k: string]: { ackWaitMs: number; backoffMs: Array<number>; concurrency: number; consumerName: string; filterSubjects: Array<string>; maxDeliver: number; ordering: "strict"; replay: ("new" | "all"); stream: string; }; }; jobs?: { namespace: string; queues: { [k: string]: { ackWaitMs: number; backoffMs: Array<number>; concurrency: number; consumerName: string; defaultDeadlineMs?: number; dlq: boolean; logs: boolean; maxDeliver: number; payload: { schema: string; }; progress: boolean; publishPrefix: string; queueType: string; result?: { schema: string; }; workSubject: string; }; }; workStream?: string; }; kv?: { [k: string]: { bucket: string; history: number; maxValueBytes?: number; ttlMs: number; }; }; store?: { [k: string]: { maxObjectBytes?: number; maxTotalBytes?: number; name: string; ttlMs: number; }; }; }; }; eventConsumers?: { [k: string]: { ackWaitMs: number; backoffMs: Array<number>; concurrency: number; consumerName: string; filterSubjects: Array<string>; maxDeliver: number; ordering: "strict"; replay: ("new" | "all"); stream: string; }; }; };
|
|
10
|
+
|
|
11
|
+
export type TrellisCatalogInput = { };
|
|
12
|
+
export type TrellisCatalogOutput = { catalog: { contracts: Array<{ description: string; digest: string; displayName: string; id: string; }>; format: "trellis.catalog.v1"; issues?: Array<{ actions: Array<{ action: ("keep-current" | "force-replace"); deploymentIds: Array<string>; description: string; digests: Array<string>; label: string; risk: ("recommended" | "dangerous"); }>; conflictingDeploymentIds?: Array<string>; conflictingDigest?: string; conflictingDigests?: Array<string>; contractId?: string; deploymentIds: Array<string>; digest?: string; effectiveDeploymentIds?: Array<string>; effectiveDigests?: Array<string>; issueId: string; kind: ("missing-active-contract" | "invalid-active-contract" | "incompatible-active-contract" | "invalid-active-contract-uses"); message: string; }>; }; };
|
|
13
|
+
|
|
14
|
+
export type TrellisContractGetInput = { digest: string; };
|
|
15
|
+
export type TrellisContractGetOutput = { contract: { description: string; displayName: string; docs?: { markdown: string; summary?: string; }; errors?: { [k: string]: { }; }; events?: { [k: string]: { }; }; exports?: { schemas?: Array<string>; }; format: "trellis.contract.v1"; id: string; jobs?: { [k: string]: { ackWaitMs?: number; backoffMs?: Array<number>; concurrency?: number; defaultDeadlineMs?: number; dlq?: boolean; docs?: { markdown: string; summary?: string; }; logs?: boolean; maxDeliver?: number; payload: { schema: string; }; progress?: boolean; result?: { schema: string; }; }; }; kind: ("service" | "app" | "device" | "agent"); operations?: { [k: string]: { }; }; resources?: { kv?: { [k: string]: { docs?: { markdown: string; summary?: string; }; history?: number; maxValueBytes?: number; purpose: string; required?: boolean; schema: { schema: string; }; ttlMs?: number; }; }; store?: { [k: string]: { docs?: { markdown: string; summary?: string; }; maxObjectBytes?: number; maxTotalBytes?: number; purpose: string; required?: boolean; ttlMs?: number; }; }; }; rpc?: { [k: string]: { }; }; schemas?: { [k: string]: ({ } | boolean); }; state?: { [k: string]: { acceptedVersions?: { [k: string]: { schema: string; }; }; docs?: { markdown: string; summary?: string; }; kind: ("value" | "map"); schema: { schema: string; }; stateVersion?: string; }; }; uses?: { [k: string]: { }; }; }; };
|
|
16
|
+
|
|
17
|
+
export type TrellisSurfaceStatusInput = { action?: ("call" | "publish" | "subscribe" | "observe"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); surface: string; };
|
|
18
|
+
export type TrellisSurfaceStatusOutput = { status: ({ liveImplementer: boolean; runtime: ("live" | "no_live_implementer" | "disabled"); state: "available"; } | { reason: ("authority_unavailable"); state: "unavailable"; } | { missingCapabilities: Array<string>; state: "unauthorized"; } | { contractId: string; state: "unknown_contract"; } | { contractId: string; kind: string; state: "unknown_surface"; surface: string; }); };
|
|
19
|
+
|
|
20
|
+
export interface RpcMap {
|
|
21
|
+
"Trellis.Bindings.Get": { input: TrellisBindingsGetInput; output: TrellisBindingsGetOutput; };
|
|
22
|
+
"Trellis.Catalog": { input: TrellisCatalogInput; output: TrellisCatalogOutput; };
|
|
23
|
+
"Trellis.Contract.Get": { input: TrellisContractGetInput; output: TrellisContractGetOutput; };
|
|
24
|
+
"Trellis.Surface.Status": { input: TrellisSurfaceStatusInput; output: TrellisSurfaceStatusOutput; };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type TrellisBindingsGetHandler = RpcHandlerFn<typeof API.owned, "Trellis.Bindings.Get">;
|
|
28
|
+
export type TrellisCatalogHandler = RpcHandlerFn<typeof API.owned, "Trellis.Catalog">;
|
|
29
|
+
export type TrellisContractGetHandler = RpcHandlerFn<typeof API.owned, "Trellis.Contract.Get">;
|
|
30
|
+
export type TrellisSurfaceStatusHandler = RpcHandlerFn<typeof API.owned, "Trellis.Surface.Status">;
|
|
31
|
+
|
|
32
|
+
export interface EventMap {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface FeedMap {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SubjectMap {
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
import { OWNED_API } from "./owned_api.js";
|
|
3
|
+
|
|
4
|
+
export { OWNED_API };
|
|
5
|
+
|
|
6
|
+
export type UsedApi = {
|
|
7
|
+
rpc: {
|
|
8
|
+
};
|
|
9
|
+
operations: {
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
};
|
|
13
|
+
feeds: {
|
|
14
|
+
};
|
|
15
|
+
subjects: {
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const USED_API: UsedApi = {
|
|
20
|
+
rpc: {
|
|
21
|
+
},
|
|
22
|
+
operations: {
|
|
23
|
+
},
|
|
24
|
+
events: {
|
|
25
|
+
},
|
|
26
|
+
feeds: {
|
|
27
|
+
},
|
|
28
|
+
subjects: {
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type OwnedApi = typeof OWNED_API;
|
|
33
|
+
export type Api = {
|
|
34
|
+
rpc: OwnedApi["rpc"] & UsedApi["rpc"];
|
|
35
|
+
operations: OwnedApi["operations"] & UsedApi["operations"];
|
|
36
|
+
events: OwnedApi["events"] & UsedApi["events"];
|
|
37
|
+
feeds: OwnedApi["feeds"] & UsedApi["feeds"];
|
|
38
|
+
subjects: OwnedApi["subjects"] & UsedApi["subjects"];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const API = {
|
|
42
|
+
owned: OWNED_API,
|
|
43
|
+
used: USED_API,
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
export type ApiViews = typeof API;
|
|
47
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
import type { AcceptedOperation, AsyncResult, BaseError, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "@qlever-llc/trellis";
|
|
3
|
+
import type { API, Api } from "./api.js";
|
|
4
|
+
import type * as Types from "./types.js";
|
|
5
|
+
|
|
6
|
+
type EventCallback<TMessage> = {
|
|
7
|
+
bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
|
|
8
|
+
}["bivarianceHack"];
|
|
9
|
+
|
|
10
|
+
type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
|
|
11
|
+
|
|
12
|
+
export type TrellisHealthState = {};
|
|
13
|
+
|
|
14
|
+
export interface TrellisHealthClient {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly timeout: number;
|
|
17
|
+
readonly stream: string;
|
|
18
|
+
readonly api: Api;
|
|
19
|
+
readonly state: TrellisHealthState;
|
|
20
|
+
readonly connection: TrellisConnection;
|
|
21
|
+
transfer(grant: SendTransferGrant): SendTransferHandle;
|
|
22
|
+
transfer(grant: ReceiveTransferGrant): ReceiveTransferHandle;
|
|
23
|
+
readonly rpc: {};
|
|
24
|
+
readonly event: {
|
|
25
|
+
readonly health: {
|
|
26
|
+
heartbeat: { publish(event: Omit<Types.HealthHeartbeatEvent, "header">): AsyncResult<void, ValidationError | UnexpectedError>; prepare(event: Omit<Types.HealthHeartbeatEvent, "header">): Result<PreparedTrellisEvent<Omit<Types.HealthHeartbeatEvent, "header">>, ValidationError | UnexpectedError>; listen(handler: EventCallback<Types.HealthHeartbeatEvent>, subjectData?: Record<string, unknown>, opts?: EventOpts): AsyncResult<void, ValidationError | UnexpectedError>; };
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly feed: {};
|
|
30
|
+
readonly operation: {};
|
|
31
|
+
wait(): AsyncResult<void, BaseError>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Service extends Client {
|
|
35
|
+
readonly handle: ServiceHandle;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ServiceHandle {
|
|
39
|
+
readonly rpc: {};
|
|
40
|
+
readonly feed: {};
|
|
41
|
+
readonly operation: {};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type HandlerClient = HandlerTrellis<Api>;
|
|
45
|
+
export type Client = TrellisHealthClient;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
import type { ContractDependencyUse, SdkContractModule, TrellisContractV1, UseSpec } from "@qlever-llc/trellis";
|
|
3
|
+
import { API } from "./api.js";
|
|
4
|
+
|
|
5
|
+
const CONTRACT_MODULE_METADATA = Symbol.for("@qlever-llc/trellis/contracts/contract-module");
|
|
6
|
+
|
|
7
|
+
export const CONTRACT_ID = "trellis.health@v1" as const;
|
|
8
|
+
export const CONTRACT_DIGEST = "RHDzeH2V6Nltzk6WklCLbTIK48hF0hNuO9Qk6-BosT4" as const;
|
|
9
|
+
export const CONTRACT = {"description":"Expose shared Trellis heartbeat events for service observability.","displayName":"Trellis Health","docs":{"markdown":"Defines the heartbeat event services publish so operators can observe service liveness.","summary":"Service heartbeat events."},"events":{"Health.Heartbeat":{"docs":{"markdown":"Emitted by services to report runtime identity, uptime, and health metadata.","summary":"Publish service liveness."},"event":{"schema":"HealthHeartbeat"},"subject":"events.v1.Health.Heartbeat","version":"v1"}},"format":"trellis.contract.v1","id":"trellis.health@v1","kind":"service","schemas":{"HealthHeartbeat":{"properties":{"checks":{"items":{"properties":{"error":{"type":"string"},"info":{"patternProperties":{"^.*$":{}},"type":"object"},"latencyMs":{"type":"number"},"name":{"type":"string"},"status":{"anyOf":[{"const":"ok","type":"string"},{"const":"failed","type":"string"}]},"summary":{"type":"string"}},"required":["name","status","latencyMs"],"type":"object"},"type":"array"},"header":{"properties":{"id":{"type":"string"},"time":{"format":"date-time","type":"string"}},"required":["id","time"],"type":"object"},"service":{"properties":{"contractDigest":{"type":"string"},"contractId":{"type":"string"},"info":{"patternProperties":{"^.*$":{}},"type":"object"},"instanceId":{"type":"string"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"}]},"name":{"type":"string"},"publishIntervalMs":{"minimum":1,"type":"integer"},"runtime":{"anyOf":[{"const":"deno","type":"string"},{"const":"node","type":"string"},{"const":"rust","type":"string"},{"const":"unknown","type":"string"}]},"runtimeVersion":{"type":"string"},"startedAt":{"format":"date-time","type":"string"},"version":{"type":"string"}},"required":["name","kind","instanceId","contractId","contractDigest","startedAt","publishIntervalMs","runtime"],"type":"object"},"status":{"anyOf":[{"const":"healthy","type":"string"},{"const":"unhealthy","type":"string"},{"const":"degraded","type":"string"}]},"summary":{"type":"string"}},"required":["header","service","status","checks"],"type":"object"}}} as TrellisContractV1;
|
|
10
|
+
|
|
11
|
+
function assertSelectedKeysExist(
|
|
12
|
+
kind: "rpc" | "operations" | "events" | "feeds",
|
|
13
|
+
keys: readonly string[] | undefined,
|
|
14
|
+
api: Record<string, unknown>,
|
|
15
|
+
) {
|
|
16
|
+
if (!keys) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const key of keys) {
|
|
21
|
+
if (!Object.hasOwn(api, key)) {
|
|
22
|
+
throw new Error(`Contract '${CONTRACT_ID}' does not expose ${kind} key '${key}'`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function assertValidUseSpec(spec: UseSpec<typeof API.owned>) {
|
|
28
|
+
assertSelectedKeysExist("rpc", spec.rpc?.call, API.owned.rpc);
|
|
29
|
+
assertSelectedKeysExist("operations", spec.operations?.call, API.owned.operations);
|
|
30
|
+
assertSelectedKeysExist("events", spec.events?.publish, API.owned.events);
|
|
31
|
+
assertSelectedKeysExist("events", spec.events?.subscribe, API.owned.events);
|
|
32
|
+
assertSelectedKeysExist("feeds", spec.feeds?.subscribe, API.owned.feeds);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const sdk: SdkContractModule<typeof CONTRACT_ID, typeof API.owned> = {
|
|
36
|
+
CONTRACT_ID,
|
|
37
|
+
CONTRACT_DIGEST,
|
|
38
|
+
CONTRACT,
|
|
39
|
+
API,
|
|
40
|
+
use: (<const TSpec extends UseSpec<typeof API.owned>>(spec: TSpec) => {
|
|
41
|
+
assertValidUseSpec(spec);
|
|
42
|
+
|
|
43
|
+
const dependencyUse = {
|
|
44
|
+
contract: CONTRACT_ID,
|
|
45
|
+
...(spec.rpc?.call ? { rpc: { call: [...spec.rpc.call] } } : {}),
|
|
46
|
+
...(spec.operations?.call ? { operations: { call: [...spec.operations.call] } } : {}),
|
|
47
|
+
...((spec.events?.publish || spec.events?.subscribe)
|
|
48
|
+
? {
|
|
49
|
+
events: {
|
|
50
|
+
...(spec.events.publish ? { publish: [...spec.events.publish] } : {}),
|
|
51
|
+
...(spec.events.subscribe ? { subscribe: [...spec.events.subscribe] } : {}),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
: {}),
|
|
55
|
+
...(spec.feeds?.subscribe ? { feeds: { subscribe: [...spec.feeds.subscribe] } } : {}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
Object.defineProperty(dependencyUse, CONTRACT_MODULE_METADATA, {
|
|
59
|
+
value: sdk,
|
|
60
|
+
enumerable: false,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return dependencyUse as ContractDependencyUse<typeof CONTRACT_ID, typeof API.owned, TSpec>;
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const use = sdk.use;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { API, OWNED_API } from "./api.js";
|
|
2
|
+
export type { Api, ApiViews, OwnedApi } from "./api.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
|
+
export * from "./schemas.js";
|
|
5
|
+
export type { Client, HandlerClient, TrellisHealthClient, TrellisHealthState } from "./client.js";
|
|
6
|
+
export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
import type { TrellisAPI } from "@qlever-llc/trellis/contracts";
|
|
3
|
+
import { schema } from "@qlever-llc/trellis/contracts";
|
|
4
|
+
import type * as Types from "./types.js";
|
|
5
|
+
import { HealthHeartbeatSchema } from "./schemas.js";
|
|
6
|
+
|
|
7
|
+
export const OWNED_API = {
|
|
8
|
+
rpc: {
|
|
9
|
+
},
|
|
10
|
+
operations: {
|
|
11
|
+
},
|
|
12
|
+
events: {
|
|
13
|
+
"Health.Heartbeat": {
|
|
14
|
+
subject: "events.v1.Health.Heartbeat",
|
|
15
|
+
event: schema<Types.HealthHeartbeatEvent>(HealthHeartbeatSchema),
|
|
16
|
+
publishCapabilities: [],
|
|
17
|
+
subscribeCapabilities: [],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
feeds: {
|
|
21
|
+
},
|
|
22
|
+
subjects: {
|
|
23
|
+
},
|
|
24
|
+
} satisfies TrellisAPI;
|
|
25
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
export const HealthHeartbeatSchema = {"properties":{"checks":{"items":{"properties":{"error":{"type":"string"},"info":{"patternProperties":{"^.*$":{}},"type":"object"},"latencyMs":{"type":"number"},"name":{"type":"string"},"status":{"anyOf":[{"const":"ok","type":"string"},{"const":"failed","type":"string"}]},"summary":{"type":"string"}},"required":["name","status","latencyMs"],"type":"object"},"type":"array"},"header":{"properties":{"id":{"type":"string"},"time":{"format":"date-time","type":"string"}},"required":["id","time"],"type":"object"},"service":{"properties":{"contractDigest":{"type":"string"},"contractId":{"type":"string"},"info":{"patternProperties":{"^.*$":{}},"type":"object"},"instanceId":{"type":"string"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"}]},"name":{"type":"string"},"publishIntervalMs":{"minimum":1,"type":"integer"},"runtime":{"anyOf":[{"const":"deno","type":"string"},{"const":"node","type":"string"},{"const":"rust","type":"string"},{"const":"unknown","type":"string"}]},"runtimeVersion":{"type":"string"},"startedAt":{"format":"date-time","type":"string"},"version":{"type":"string"}},"required":["name","kind","instanceId","contractId","contractDigest","startedAt","publishIntervalMs","runtime"],"type":"object"},"status":{"anyOf":[{"const":"healthy","type":"string"},{"const":"unhealthy","type":"string"},{"const":"degraded","type":"string"}]},"summary":{"type":"string"}},"required":["header","service","status","checks"],"type":"object"} as const;
|
|
3
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.health@v1.json
|
|
2
|
+
export const CONTRACT_ID = "trellis.health@v1" as const;
|
|
3
|
+
export const CONTRACT_DIGEST = "RHDzeH2V6Nltzk6WklCLbTIK48hF0hNuO9Qk6-BosT4" as const;
|
|
4
|
+
|
|
5
|
+
export type HealthHeartbeatEvent = { checks: Array<{ error?: string; info?: { [k: string]: unknown; }; latencyMs: number; name: string; status: ("ok" | "failed"); summary?: string; }>; header: { id: string; time: string; }; service: { contractDigest: string; contractId: string; info?: { [k: string]: unknown; }; instanceId: string; kind: ("service" | "device"); name: string; publishIntervalMs: number; runtime: ("deno" | "node" | "rust" | "unknown"); runtimeVersion?: string; startedAt: string; version?: string; }; status: ("healthy" | "unhealthy" | "degraded"); summary?: string; };
|
|
6
|
+
|
|
7
|
+
export interface RpcMap {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface EventMap {
|
|
11
|
+
"Health.Heartbeat": { event: HealthHeartbeatEvent; };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FeedMap {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SubjectMap {
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@v1.json
|
|
2
|
+
import { OWNED_API } from "./owned_api.js";
|
|
3
|
+
import { OWNED_API as AuthApi } from "../../auth.js";
|
|
4
|
+
import { OWNED_API as CoreApi } from "../../core.js";
|
|
5
|
+
import { OWNED_API as HealthApi } from "../../health.js";
|
|
6
|
+
|
|
7
|
+
export { OWNED_API };
|
|
8
|
+
|
|
9
|
+
export type UsedApi = {
|
|
10
|
+
rpc: {
|
|
11
|
+
readonly "Auth.Requests.Validate": typeof AuthApi.rpc["Auth.Requests.Validate"];
|
|
12
|
+
readonly "Trellis.Bindings.Get": typeof CoreApi.rpc["Trellis.Bindings.Get"];
|
|
13
|
+
readonly "Trellis.Catalog": typeof CoreApi.rpc["Trellis.Catalog"];
|
|
14
|
+
};
|
|
15
|
+
operations: {
|
|
16
|
+
};
|
|
17
|
+
events: {
|
|
18
|
+
readonly "Health.Heartbeat": typeof HealthApi.events["Health.Heartbeat"];
|
|
19
|
+
};
|
|
20
|
+
feeds: {
|
|
21
|
+
};
|
|
22
|
+
subjects: {
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const USED_API: UsedApi = {
|
|
27
|
+
rpc: {
|
|
28
|
+
get "Auth.Requests.Validate"() { return AuthApi.rpc["Auth.Requests.Validate"]; },
|
|
29
|
+
get "Trellis.Bindings.Get"() { return CoreApi.rpc["Trellis.Bindings.Get"]; },
|
|
30
|
+
get "Trellis.Catalog"() { return CoreApi.rpc["Trellis.Catalog"]; },
|
|
31
|
+
},
|
|
32
|
+
operations: {
|
|
33
|
+
},
|
|
34
|
+
events: {
|
|
35
|
+
get "Health.Heartbeat"() { return HealthApi.events["Health.Heartbeat"]; },
|
|
36
|
+
},
|
|
37
|
+
feeds: {
|
|
38
|
+
},
|
|
39
|
+
subjects: {
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type OwnedApi = typeof OWNED_API;
|
|
44
|
+
export type Api = {
|
|
45
|
+
rpc: OwnedApi["rpc"] & UsedApi["rpc"];
|
|
46
|
+
operations: OwnedApi["operations"] & UsedApi["operations"];
|
|
47
|
+
events: OwnedApi["events"] & UsedApi["events"];
|
|
48
|
+
feeds: OwnedApi["feeds"] & UsedApi["feeds"];
|
|
49
|
+
subjects: OwnedApi["subjects"] & UsedApi["subjects"];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const API = {
|
|
53
|
+
owned: OWNED_API,
|
|
54
|
+
used: USED_API,
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
export type ApiViews = typeof API;
|
|
58
|
+
|