@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,78 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@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
|
+
import type * as AuthSdk from "../../auth.js";
|
|
6
|
+
import type * as CoreSdk from "../../core.js";
|
|
7
|
+
import type * as HealthSdk from "../../health.js";
|
|
8
|
+
|
|
9
|
+
type EventCallback<TMessage> = {
|
|
10
|
+
bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
|
|
11
|
+
}["bivarianceHack"];
|
|
12
|
+
|
|
13
|
+
type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
|
|
14
|
+
|
|
15
|
+
export type TrellisJobsState = {};
|
|
16
|
+
|
|
17
|
+
export interface TrellisJobsClient {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly timeout: number;
|
|
20
|
+
readonly stream: string;
|
|
21
|
+
readonly api: Api;
|
|
22
|
+
readonly state: TrellisJobsState;
|
|
23
|
+
readonly connection: TrellisConnection;
|
|
24
|
+
transfer(grant: SendTransferGrant): SendTransferHandle;
|
|
25
|
+
transfer(grant: ReceiveTransferGrant): ReceiveTransferHandle;
|
|
26
|
+
readonly rpc: {
|
|
27
|
+
readonly auth: {
|
|
28
|
+
requestsValidate(input: AuthSdk.AuthRequestsValidateInput, opts?: RequestOpts): AsyncResult<AuthSdk.AuthRequestsValidateOutput, BaseError>;
|
|
29
|
+
};
|
|
30
|
+
readonly jobs: {
|
|
31
|
+
cancel(input: Types.JobsCancelInput, opts?: RequestOpts): AsyncResult<Types.JobsCancelOutput, BaseError>;
|
|
32
|
+
dismissDLQ(input: Types.JobsDismissDLQInput, opts?: RequestOpts): AsyncResult<Types.JobsDismissDLQOutput, BaseError>;
|
|
33
|
+
get(input: Types.JobsGetInput, opts?: RequestOpts): AsyncResult<Types.JobsGetOutput, BaseError>;
|
|
34
|
+
health(input: Types.JobsHealthInput, opts?: RequestOpts): AsyncResult<Types.JobsHealthOutput, BaseError>;
|
|
35
|
+
list(input: Types.JobsListInput, opts?: RequestOpts): AsyncResult<Types.JobsListOutput, BaseError>;
|
|
36
|
+
listDLQ(input: Types.JobsListDLQInput, opts?: RequestOpts): AsyncResult<Types.JobsListDLQOutput, BaseError>;
|
|
37
|
+
listServices(input: Types.JobsListServicesInput, opts?: RequestOpts): AsyncResult<Types.JobsListServicesOutput, BaseError>;
|
|
38
|
+
replayDLQ(input: Types.JobsReplayDLQInput, opts?: RequestOpts): AsyncResult<Types.JobsReplayDLQOutput, BaseError>;
|
|
39
|
+
retry(input: Types.JobsRetryInput, opts?: RequestOpts): AsyncResult<Types.JobsRetryOutput, BaseError>;
|
|
40
|
+
};
|
|
41
|
+
readonly trellis: {
|
|
42
|
+
catalog(input: CoreSdk.TrellisCatalogInput, opts?: RequestOpts): AsyncResult<CoreSdk.TrellisCatalogOutput, BaseError>;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly event: {
|
|
46
|
+
readonly health: {
|
|
47
|
+
heartbeat: { publish(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): AsyncResult<void, ValidationError | UnexpectedError>; prepare(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): Result<PreparedTrellisEvent<Omit<HealthSdk.HealthHeartbeatEvent, "header">>, ValidationError | UnexpectedError>; listen(handler: EventCallback<HealthSdk.HealthHeartbeatEvent>, subjectData?: Record<string, unknown>, opts?: EventOpts): AsyncResult<void, ValidationError | UnexpectedError>; };
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly feed: {};
|
|
51
|
+
readonly operation: {};
|
|
52
|
+
wait(): AsyncResult<void, BaseError>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Service extends Client {
|
|
56
|
+
readonly handle: ServiceHandle;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface ServiceHandle {
|
|
60
|
+
readonly rpc: {
|
|
61
|
+
readonly jobs: {
|
|
62
|
+
cancel(handler: RpcHandler<Types.JobsCancelInput, Types.JobsCancelOutput>): Promise<void>;
|
|
63
|
+
dismissDLQ(handler: RpcHandler<Types.JobsDismissDLQInput, Types.JobsDismissDLQOutput>): Promise<void>;
|
|
64
|
+
get(handler: RpcHandler<Types.JobsGetInput, Types.JobsGetOutput>): Promise<void>;
|
|
65
|
+
health(handler: RpcHandler<Types.JobsHealthInput, Types.JobsHealthOutput>): Promise<void>;
|
|
66
|
+
list(handler: RpcHandler<Types.JobsListInput, Types.JobsListOutput>): Promise<void>;
|
|
67
|
+
listDLQ(handler: RpcHandler<Types.JobsListDLQInput, Types.JobsListDLQOutput>): Promise<void>;
|
|
68
|
+
listServices(handler: RpcHandler<Types.JobsListServicesInput, Types.JobsListServicesOutput>): Promise<void>;
|
|
69
|
+
replayDLQ(handler: RpcHandler<Types.JobsReplayDLQInput, Types.JobsReplayDLQOutput>): Promise<void>;
|
|
70
|
+
retry(handler: RpcHandler<Types.JobsRetryInput, Types.JobsRetryOutput>): Promise<void>;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly feed: {};
|
|
74
|
+
readonly operation: {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type HandlerClient = HandlerTrellis<Api>;
|
|
78
|
+
export type Client = TrellisJobsClient;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@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.jobs@v1" as const;
|
|
8
|
+
export const CONTRACT_DIGEST = "jSB8nKGOQqIxdFDdUqO-gOTt3Dijg--SOXJtJ1ChpoY" as const;
|
|
9
|
+
export const CONTRACT = {"capabilities":{"trellis.jobs::admin.mutate":{"consequence":"Can change background job execution state.","description":"Cancel, retry, replay, or dismiss Jobs service work items.","displayName":"Mutate jobs admin data"},"trellis.jobs::admin.read":{"description":"View Jobs service health, services, jobs, and dead-letter queues.","displayName":"Read jobs admin data"}},"description":"Trellis-managed background job administration API.","displayName":"Trellis Jobs","docs":{"markdown":"Provides health, service, job, retry, cancel, and dead-letter queue RPCs for Trellis-managed background work.","summary":"Background job administration APIs."},"errors":{"NotFoundError":{"schema":{"schema":"NotFoundErrorData"},"type":"NotFoundError"}},"format":"trellis.contract.v1","id":"trellis.jobs@v1","kind":"service","rpc":{"Jobs.Cancel":{"capabilities":{"call":["trellis.jobs::admin.mutate"]},"docs":{"markdown":"Requests cancellation for one background job.","summary":"Cancel a job."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"},{"type":"NotFoundError"}],"input":{"schema":"JobsCancelRequest"},"output":{"schema":"JobsCancelResponse"},"subject":"rpc.v1.Jobs.Cancel","version":"v1"},"Jobs.DismissDLQ":{"capabilities":{"call":["trellis.jobs::admin.mutate"]},"docs":{"markdown":"Marks one dead-letter job as dismissed.","summary":"Dismiss a dead-letter job."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"},{"type":"NotFoundError"}],"input":{"schema":"JobsDismissDLQRequest"},"output":{"schema":"JobsDismissDLQResponse"},"subject":"rpc.v1.Jobs.DismissDLQ","version":"v1"},"Jobs.Get":{"capabilities":{"call":["trellis.jobs::admin.read"]},"docs":{"markdown":"Returns one background job by id.","summary":"Read a job."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"},{"type":"NotFoundError"}],"input":{"schema":"JobsGetRequest"},"output":{"schema":"JobsGetResponse"},"subject":"rpc.v1.Jobs.Get","version":"v1"},"Jobs.Health":{"capabilities":{"call":["trellis.jobs::admin.read"]},"docs":{"markdown":"Returns Jobs service health and worker status details.","summary":"Read jobs health."},"errors":[{"type":"UnexpectedError"}],"input":{"schema":"Empty"},"output":{"schema":"JobsHealthResponse"},"subject":"rpc.v1.Jobs.Health","version":"v1"},"Jobs.List":{"capabilities":{"call":["trellis.jobs::admin.read"]},"docs":{"markdown":"Lists jobs matching the requested filters.","summary":"List jobs."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"JobsListRequest"},"output":{"schema":"JobsListResponse"},"subject":"rpc.v1.Jobs.List","version":"v1"},"Jobs.ListDLQ":{"capabilities":{"call":["trellis.jobs::admin.read"]},"docs":{"markdown":"Lists jobs currently in dead-letter queues.","summary":"List dead-letter jobs."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"JobsListDLQRequest"},"output":{"schema":"JobsListDLQResponse"},"subject":"rpc.v1.Jobs.ListDLQ","version":"v1"},"Jobs.ListServices":{"capabilities":{"call":["trellis.jobs::admin.read"]},"docs":{"markdown":"Lists services that own or execute background job queues.","summary":"List job services."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"JobsListServicesRequest"},"output":{"schema":"JobsListServicesResponse"},"subject":"rpc.v1.Jobs.ListServices","version":"v1"},"Jobs.ReplayDLQ":{"capabilities":{"call":["trellis.jobs::admin.mutate"]},"docs":{"markdown":"Moves one dead-letter job back to processing.","summary":"Replay a dead-letter job."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"},{"type":"NotFoundError"}],"input":{"schema":"JobsReplayDLQRequest"},"output":{"schema":"JobsReplayDLQResponse"},"subject":"rpc.v1.Jobs.ReplayDLQ","version":"v1"},"Jobs.Retry":{"capabilities":{"call":["trellis.jobs::admin.mutate"]},"docs":{"markdown":"Moves a failed job back into retry processing.","summary":"Retry a job."},"errors":[{"type":"UnexpectedError"},{"type":"ValidationError"},{"type":"NotFoundError"}],"input":{"schema":"JobsRetryRequest"},"output":{"schema":"JobsRetryResponse"},"subject":"rpc.v1.Jobs.Retry","version":"v1"}},"schemas":{"Empty":{"properties":{},"type":"object"},"Job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"},"JobContext":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"JobLogEntry":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"JobProgress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"JobState":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"JobsCancelRequest":{"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"},"JobsCancelResponse":{"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"},"JobsDismissDLQRequest":{"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"},"JobsDismissDLQResponse":{"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"},"JobsGetRequest":{"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"},"JobsGetResponse":{"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"},"JobsHealthResponse":{"properties":{"checks":{"items":{"patternProperties":{"^.*$":{}},"type":"object"},"type":"array"},"service":{"minLength":1,"type":"string"},"status":{},"timestamp":{"format":"date-time","type":"string"}},"required":["service","status","timestamp","checks"],"type":"object"},"JobsListDLQRequest":{"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"service":{"minLength":1,"type":"string"},"since":{"format":"date-time","type":"string"},"type":{"minLength":1,"type":"string"}},"required":["limit"],"type":"object"},"JobsListDLQResponse":{"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"},"JobsListRequest":{"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"service":{"minLength":1,"type":"string"},"since":{"format":"date-time","type":"string"},"state":{"items":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"type":"array"},"type":{"minLength":1,"type":"string"}},"required":["limit"],"type":"object"},"JobsListResponse":{"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"},"JobsListServicesRequest":{"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["limit"],"type":"object"},"JobsListServicesResponse":{"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"healthy":{"type":"boolean"},"name":{"minLength":1,"type":"string"},"workers":{"items":{"properties":{"concurrency":{"minimum":1,"type":"integer"},"instanceId":{"minLength":1,"type":"string"},"jobType":{"minLength":1,"type":"string"},"service":{"minLength":1,"type":"string"},"timestamp":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["service","jobType","instanceId","timestamp"],"type":"object"},"type":"array"}},"required":["name","healthy","workers"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"},"JobsReplayDLQRequest":{"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"},"JobsReplayDLQResponse":{"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"},"JobsRetryRequest":{"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"},"JobsRetryResponse":{"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"},"NotFoundErrorData":{"properties":{"context":{"patternProperties":{"^.*$":{}},"type":"object"},"id":{"minLength":1,"type":"string"},"jobId":{"minLength":1,"type":"string"},"message":{"type":"string"},"resource":{"minLength":1,"type":"string"},"traceId":{"type":"string"},"type":{"const":"NotFoundError","type":"string"}},"required":["id","type","message","resource"],"type":"object"}},"uses":{"required":{"auth":{"contract":"trellis.auth@v1","rpc":{"call":["Auth.Requests.Validate"]}},"core":{"contract":"trellis.core@v1","rpc":{"call":["Trellis.Bindings.Get","Trellis.Catalog"]}},"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, TrellisJobsClient, TrellisJobsState } from "./client.js";
|
|
6
|
+
export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@v1.json
|
|
2
|
+
import type { TrellisAPI } from "@qlever-llc/trellis/contracts";
|
|
3
|
+
import { schema } from "@qlever-llc/trellis/contracts";
|
|
4
|
+
import * as Types from "./types.js";
|
|
5
|
+
import { EmptySchema, JobsCancelRequestSchema, JobsCancelResponseSchema, JobsDismissDLQRequestSchema, JobsDismissDLQResponseSchema, JobsGetRequestSchema, JobsGetResponseSchema, JobsHealthResponseSchema, JobsListDLQRequestSchema, JobsListDLQResponseSchema, JobsListRequestSchema, JobsListResponseSchema, JobsListServicesRequestSchema, JobsListServicesResponseSchema, JobsReplayDLQRequestSchema, JobsReplayDLQResponseSchema, JobsRetryRequestSchema, JobsRetryResponseSchema, NotFoundErrorDataSchema } from "./schemas.js";
|
|
6
|
+
|
|
7
|
+
export const OWNED_API = {
|
|
8
|
+
rpc: {
|
|
9
|
+
"Jobs.Cancel": {
|
|
10
|
+
subject: "rpc.v1.Jobs.Cancel",
|
|
11
|
+
input: schema<Types.JobsCancelInput>(JobsCancelRequestSchema),
|
|
12
|
+
output: schema<Types.JobsCancelOutput>(JobsCancelResponseSchema),
|
|
13
|
+
callerCapabilities: ["trellis.jobs::admin.mutate"],
|
|
14
|
+
errors: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
15
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
16
|
+
runtimeErrors: [
|
|
17
|
+
{
|
|
18
|
+
type: "NotFoundError",
|
|
19
|
+
schema: schema<Types.NotFoundErrorData>(NotFoundErrorDataSchema),
|
|
20
|
+
fromSerializable: Types.NotFoundError.fromSerializable,
|
|
21
|
+
},
|
|
22
|
+
] as const,
|
|
23
|
+
},
|
|
24
|
+
"Jobs.DismissDLQ": {
|
|
25
|
+
subject: "rpc.v1.Jobs.DismissDLQ",
|
|
26
|
+
input: schema<Types.JobsDismissDLQInput>(JobsDismissDLQRequestSchema),
|
|
27
|
+
output: schema<Types.JobsDismissDLQOutput>(JobsDismissDLQResponseSchema),
|
|
28
|
+
callerCapabilities: ["trellis.jobs::admin.mutate"],
|
|
29
|
+
errors: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
30
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
31
|
+
runtimeErrors: [
|
|
32
|
+
{
|
|
33
|
+
type: "NotFoundError",
|
|
34
|
+
schema: schema<Types.NotFoundErrorData>(NotFoundErrorDataSchema),
|
|
35
|
+
fromSerializable: Types.NotFoundError.fromSerializable,
|
|
36
|
+
},
|
|
37
|
+
] as const,
|
|
38
|
+
},
|
|
39
|
+
"Jobs.Get": {
|
|
40
|
+
subject: "rpc.v1.Jobs.Get",
|
|
41
|
+
input: schema<Types.JobsGetInput>(JobsGetRequestSchema),
|
|
42
|
+
output: schema<Types.JobsGetOutput>(JobsGetResponseSchema),
|
|
43
|
+
callerCapabilities: ["trellis.jobs::admin.read"],
|
|
44
|
+
errors: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
45
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
46
|
+
runtimeErrors: [
|
|
47
|
+
{
|
|
48
|
+
type: "NotFoundError",
|
|
49
|
+
schema: schema<Types.NotFoundErrorData>(NotFoundErrorDataSchema),
|
|
50
|
+
fromSerializable: Types.NotFoundError.fromSerializable,
|
|
51
|
+
},
|
|
52
|
+
] as const,
|
|
53
|
+
},
|
|
54
|
+
"Jobs.Health": {
|
|
55
|
+
subject: "rpc.v1.Jobs.Health",
|
|
56
|
+
input: schema<Types.JobsHealthInput>(EmptySchema),
|
|
57
|
+
output: schema<Types.JobsHealthOutput>(JobsHealthResponseSchema),
|
|
58
|
+
callerCapabilities: ["trellis.jobs::admin.read"],
|
|
59
|
+
errors: ["UnexpectedError"] as const,
|
|
60
|
+
declaredErrorTypes: ["UnexpectedError"] as const,
|
|
61
|
+
},
|
|
62
|
+
"Jobs.List": {
|
|
63
|
+
subject: "rpc.v1.Jobs.List",
|
|
64
|
+
input: schema<Types.JobsListInput>(JobsListRequestSchema),
|
|
65
|
+
output: schema<Types.JobsListOutput>(JobsListResponseSchema),
|
|
66
|
+
callerCapabilities: ["trellis.jobs::admin.read"],
|
|
67
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
68
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
69
|
+
},
|
|
70
|
+
"Jobs.ListDLQ": {
|
|
71
|
+
subject: "rpc.v1.Jobs.ListDLQ",
|
|
72
|
+
input: schema<Types.JobsListDLQInput>(JobsListDLQRequestSchema),
|
|
73
|
+
output: schema<Types.JobsListDLQOutput>(JobsListDLQResponseSchema),
|
|
74
|
+
callerCapabilities: ["trellis.jobs::admin.read"],
|
|
75
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
76
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
77
|
+
},
|
|
78
|
+
"Jobs.ListServices": {
|
|
79
|
+
subject: "rpc.v1.Jobs.ListServices",
|
|
80
|
+
input: schema<Types.JobsListServicesInput>(JobsListServicesRequestSchema),
|
|
81
|
+
output: schema<Types.JobsListServicesOutput>(JobsListServicesResponseSchema),
|
|
82
|
+
callerCapabilities: ["trellis.jobs::admin.read"],
|
|
83
|
+
errors: ["UnexpectedError","ValidationError"] as const,
|
|
84
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError"] as const,
|
|
85
|
+
},
|
|
86
|
+
"Jobs.ReplayDLQ": {
|
|
87
|
+
subject: "rpc.v1.Jobs.ReplayDLQ",
|
|
88
|
+
input: schema<Types.JobsReplayDLQInput>(JobsReplayDLQRequestSchema),
|
|
89
|
+
output: schema<Types.JobsReplayDLQOutput>(JobsReplayDLQResponseSchema),
|
|
90
|
+
callerCapabilities: ["trellis.jobs::admin.mutate"],
|
|
91
|
+
errors: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
92
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
93
|
+
runtimeErrors: [
|
|
94
|
+
{
|
|
95
|
+
type: "NotFoundError",
|
|
96
|
+
schema: schema<Types.NotFoundErrorData>(NotFoundErrorDataSchema),
|
|
97
|
+
fromSerializable: Types.NotFoundError.fromSerializable,
|
|
98
|
+
},
|
|
99
|
+
] as const,
|
|
100
|
+
},
|
|
101
|
+
"Jobs.Retry": {
|
|
102
|
+
subject: "rpc.v1.Jobs.Retry",
|
|
103
|
+
input: schema<Types.JobsRetryInput>(JobsRetryRequestSchema),
|
|
104
|
+
output: schema<Types.JobsRetryOutput>(JobsRetryResponseSchema),
|
|
105
|
+
callerCapabilities: ["trellis.jobs::admin.mutate"],
|
|
106
|
+
errors: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
107
|
+
declaredErrorTypes: ["UnexpectedError","ValidationError","NotFoundError"] as const,
|
|
108
|
+
runtimeErrors: [
|
|
109
|
+
{
|
|
110
|
+
type: "NotFoundError",
|
|
111
|
+
schema: schema<Types.NotFoundErrorData>(NotFoundErrorDataSchema),
|
|
112
|
+
fromSerializable: Types.NotFoundError.fromSerializable,
|
|
113
|
+
},
|
|
114
|
+
] as const,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
operations: {
|
|
118
|
+
},
|
|
119
|
+
events: {
|
|
120
|
+
},
|
|
121
|
+
feeds: {
|
|
122
|
+
},
|
|
123
|
+
subjects: {
|
|
124
|
+
},
|
|
125
|
+
} satisfies TrellisAPI;
|
|
126
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@v1.json
|
|
2
|
+
export const EmptySchema = {"properties":{},"type":"object"} as const;
|
|
3
|
+
|
|
4
|
+
export const JobsCancelRequestSchema = {"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"} as const;
|
|
5
|
+
|
|
6
|
+
export const JobsCancelResponseSchema = {"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"} as const;
|
|
7
|
+
|
|
8
|
+
export const JobsDismissDLQRequestSchema = {"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"} as const;
|
|
9
|
+
|
|
10
|
+
export const JobsDismissDLQResponseSchema = {"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"} as const;
|
|
11
|
+
|
|
12
|
+
export const JobsGetRequestSchema = {"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"} as const;
|
|
13
|
+
|
|
14
|
+
export const JobsGetResponseSchema = {"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"} as const;
|
|
15
|
+
|
|
16
|
+
export const JobsHealthResponseSchema = {"properties":{"checks":{"items":{"patternProperties":{"^.*$":{}},"type":"object"},"type":"array"},"service":{"minLength":1,"type":"string"},"status":{},"timestamp":{"format":"date-time","type":"string"}},"required":["service","status","timestamp","checks"],"type":"object"} as const;
|
|
17
|
+
|
|
18
|
+
export const JobsListDLQRequestSchema = {"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"service":{"minLength":1,"type":"string"},"since":{"format":"date-time","type":"string"},"type":{"minLength":1,"type":"string"}},"required":["limit"],"type":"object"} as const;
|
|
19
|
+
|
|
20
|
+
export const JobsListDLQResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
|
|
21
|
+
|
|
22
|
+
export const JobsListRequestSchema = {"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"service":{"minLength":1,"type":"string"},"since":{"format":"date-time","type":"string"},"state":{"items":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"type":"array"},"type":{"minLength":1,"type":"string"}},"required":["limit"],"type":"object"} as const;
|
|
23
|
+
|
|
24
|
+
export const JobsListResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
|
|
25
|
+
|
|
26
|
+
export const JobsListServicesRequestSchema = {"properties":{"limit":{"minimum":1,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["limit"],"type":"object"} as const;
|
|
27
|
+
|
|
28
|
+
export const JobsListServicesResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"items":{"properties":{"healthy":{"type":"boolean"},"name":{"minLength":1,"type":"string"},"workers":{"items":{"properties":{"concurrency":{"minimum":1,"type":"integer"},"instanceId":{"minLength":1,"type":"string"},"jobType":{"minLength":1,"type":"string"},"service":{"minLength":1,"type":"string"},"timestamp":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["service","jobType","instanceId","timestamp"],"type":"object"},"type":"array"}},"required":["name","healthy","workers"],"type":"object"},"type":"array"},"limit":{"minimum":1,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
|
|
29
|
+
|
|
30
|
+
export const JobsReplayDLQRequestSchema = {"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"} as const;
|
|
31
|
+
|
|
32
|
+
export const JobsReplayDLQResponseSchema = {"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"} as const;
|
|
33
|
+
|
|
34
|
+
export const JobsRetryRequestSchema = {"description":"Jobs admin ids are globally addressable; callers identify jobs by id only.","properties":{"id":{"minLength":1,"type":"string"}},"required":["id"],"type":"object"} as const;
|
|
35
|
+
|
|
36
|
+
export const JobsRetryResponseSchema = {"properties":{"job":{"properties":{"completedAt":{"format":"date-time","type":"string"},"context":{"properties":{"requestId":{"minLength":1,"type":"string"},"traceId":{"pattern":"^[0-9a-f]{32}$","type":"string"},"traceparent":{"pattern":"^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$","type":"string"},"tracestate":{"minLength":1,"type":"string"}},"required":["requestId","traceId","traceparent"],"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deadline":{"format":"date-time","type":"string"},"id":{"minLength":1,"type":"string"},"lastError":{"type":"string"},"logs":{"items":{"properties":{"level":{"anyOf":[{"const":"info","type":"string"},{"const":"warn","type":"string"},{"const":"error","type":"string"}]},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","level","message"],"type":"object"},"type":"array"},"maxTries":{"minimum":1,"type":"integer"},"payload":{},"progress":{"properties":{"current":{"minimum":0,"type":"integer"},"message":{"type":"string"},"step":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"type":"object"},"result":{},"service":{"minLength":1,"type":"string"},"startedAt":{"format":"date-time","type":"string"},"state":{"anyOf":[{"const":"pending","type":"string"},{"const":"active","type":"string"},{"const":"retry","type":"string"},{"const":"completed","type":"string"},{"const":"failed","type":"string"},{"const":"cancelled","type":"string"},{"const":"expired","type":"string"},{"const":"dead","type":"string"},{"const":"dismissed","type":"string"}]},"tries":{"minimum":0,"type":"integer"},"type":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"}},"required":["id","context","service","type","state","payload","createdAt","updatedAt","tries","maxTries"],"type":"object"}},"required":["job"],"type":"object"} as const;
|
|
37
|
+
|
|
38
|
+
export const NotFoundErrorDataSchema = {"properties":{"context":{"patternProperties":{"^.*$":{}},"type":"object"},"id":{"minLength":1,"type":"string"},"jobId":{"minLength":1,"type":"string"},"message":{"type":"string"},"resource":{"minLength":1,"type":"string"},"traceId":{"type":"string"},"type":{"const":"NotFoundError","type":"string"}},"required":["id","type","message","resource"],"type":"object"} as const;
|
|
39
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.jobs@v1.json
|
|
2
|
+
import type { RpcHandlerFn } from "@qlever-llc/trellis";
|
|
3
|
+
import type { API } from "./api.js";
|
|
4
|
+
|
|
5
|
+
import { TrellisError, type SerializableErrorData } from "@qlever-llc/trellis";
|
|
6
|
+
|
|
7
|
+
import { NotFoundErrorDataSchema } from "./schemas.js";
|
|
8
|
+
|
|
9
|
+
export const CONTRACT_ID = "trellis.jobs@v1" as const;
|
|
10
|
+
export const CONTRACT_DIGEST = "jSB8nKGOQqIxdFDdUqO-gOTt3Dijg--SOXJtJ1ChpoY" as const;
|
|
11
|
+
|
|
12
|
+
export type JobsCancelInput = { id: string; };
|
|
13
|
+
export type JobsCancelOutput = { job: { completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }; };
|
|
14
|
+
|
|
15
|
+
export type JobsDismissDLQInput = { id: string; };
|
|
16
|
+
export type JobsDismissDLQOutput = { job: { completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }; };
|
|
17
|
+
|
|
18
|
+
export type JobsGetInput = { id: string; };
|
|
19
|
+
export type JobsGetOutput = { job: { completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }; };
|
|
20
|
+
|
|
21
|
+
export type JobsHealthInput = { };
|
|
22
|
+
export type JobsHealthOutput = { checks: Array<{ [k: string]: unknown; }>; service: string; status: unknown; timestamp: string; };
|
|
23
|
+
|
|
24
|
+
export type JobsListInput = { limit: number; offset?: number; service?: string; since?: string; state?: Array<("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed")>; type?: string; };
|
|
25
|
+
export type JobsListOutput = { count: number; entries: Array<{ completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }>; limit: number; nextOffset?: number; offset: number; };
|
|
26
|
+
|
|
27
|
+
export type JobsListDLQInput = { limit: number; offset?: number; service?: string; since?: string; type?: string; };
|
|
28
|
+
export type JobsListDLQOutput = { count: number; entries: Array<{ completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }>; limit: number; nextOffset?: number; offset: number; };
|
|
29
|
+
|
|
30
|
+
export type JobsListServicesInput = { limit: number; offset?: number; };
|
|
31
|
+
export type JobsListServicesOutput = { count: number; entries: Array<{ healthy: boolean; name: string; workers: Array<{ concurrency?: number; instanceId: string; jobType: string; service: string; timestamp: string; version?: string; }>; }>; limit: number; nextOffset?: number; offset: number; };
|
|
32
|
+
|
|
33
|
+
export type JobsReplayDLQInput = { id: string; };
|
|
34
|
+
export type JobsReplayDLQOutput = { job: { completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }; };
|
|
35
|
+
|
|
36
|
+
export type JobsRetryInput = { id: string; };
|
|
37
|
+
export type JobsRetryOutput = { job: { completedAt?: string; context: { requestId: string; traceId: string; traceparent: string; tracestate?: string; }; createdAt: string; deadline?: string; id: string; lastError?: string; logs?: Array<{ level: ("info" | "warn" | "error"); message: string; timestamp: string; }>; maxTries: number; payload: unknown; progress?: { current?: number; message?: string; step?: string; total?: number; }; result?: unknown; service: string; startedAt?: string; state: ("pending" | "active" | "retry" | "completed" | "failed" | "cancelled" | "expired" | "dead" | "dismissed"); tries: number; type: string; updatedAt: string; }; };
|
|
38
|
+
|
|
39
|
+
export type NotFoundErrorData = { context?: { [k: string]: unknown; }; id: string; jobId?: string; message: string; resource: string; traceId?: string; type: "NotFoundError"; };
|
|
40
|
+
export class NotFoundError extends TrellisError<NotFoundErrorData> {
|
|
41
|
+
static readonly schema = NotFoundErrorDataSchema;
|
|
42
|
+
override readonly name = "NotFoundError" as const;
|
|
43
|
+
readonly data: NotFoundErrorData;
|
|
44
|
+
|
|
45
|
+
constructor(data: NotFoundErrorData) {
|
|
46
|
+
super(data.message, {
|
|
47
|
+
id: data.id,
|
|
48
|
+
...(data.context !== undefined ? { context: data.context } : {}),
|
|
49
|
+
});
|
|
50
|
+
this.data = data;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static fromSerializable(data: NotFoundErrorData): NotFoundError {
|
|
54
|
+
return new NotFoundError(data);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override toSerializable(): NotFoundErrorData {
|
|
58
|
+
return this.data;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface RpcMap {
|
|
63
|
+
"Jobs.Cancel": { input: JobsCancelInput; output: JobsCancelOutput; };
|
|
64
|
+
"Jobs.DismissDLQ": { input: JobsDismissDLQInput; output: JobsDismissDLQOutput; };
|
|
65
|
+
"Jobs.Get": { input: JobsGetInput; output: JobsGetOutput; };
|
|
66
|
+
"Jobs.Health": { input: JobsHealthInput; output: JobsHealthOutput; };
|
|
67
|
+
"Jobs.List": { input: JobsListInput; output: JobsListOutput; };
|
|
68
|
+
"Jobs.ListDLQ": { input: JobsListDLQInput; output: JobsListDLQOutput; };
|
|
69
|
+
"Jobs.ListServices": { input: JobsListServicesInput; output: JobsListServicesOutput; };
|
|
70
|
+
"Jobs.ReplayDLQ": { input: JobsReplayDLQInput; output: JobsReplayDLQOutput; };
|
|
71
|
+
"Jobs.Retry": { input: JobsRetryInput; output: JobsRetryOutput; };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type JobsCancelHandler = RpcHandlerFn<typeof API.owned, "Jobs.Cancel">;
|
|
75
|
+
export type JobsDismissDLQHandler = RpcHandlerFn<typeof API.owned, "Jobs.DismissDLQ">;
|
|
76
|
+
export type JobsGetHandler = RpcHandlerFn<typeof API.owned, "Jobs.Get">;
|
|
77
|
+
export type JobsHealthHandler = RpcHandlerFn<typeof API.owned, "Jobs.Health">;
|
|
78
|
+
export type JobsListHandler = RpcHandlerFn<typeof API.owned, "Jobs.List">;
|
|
79
|
+
export type JobsListDLQHandler = RpcHandlerFn<typeof API.owned, "Jobs.ListDLQ">;
|
|
80
|
+
export type JobsListServicesHandler = RpcHandlerFn<typeof API.owned, "Jobs.ListServices">;
|
|
81
|
+
export type JobsReplayDLQHandler = RpcHandlerFn<typeof API.owned, "Jobs.ReplayDLQ">;
|
|
82
|
+
export type JobsRetryHandler = RpcHandlerFn<typeof API.owned, "Jobs.Retry">;
|
|
83
|
+
|
|
84
|
+
export interface EventMap {
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface FeedMap {
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SubjectMap {
|
|
91
|
+
}
|
|
92
|
+
|