@qlever-llc/trellis 0.10.1 → 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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,50 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@v1.json
|
|
2
|
+
import { OWNED_API } from "./owned_api.js";
|
|
3
|
+
import { OWNED_API as HealthApi } from "../../health.js";
|
|
4
|
+
|
|
5
|
+
export { OWNED_API };
|
|
6
|
+
|
|
7
|
+
export type UsedApi = {
|
|
8
|
+
rpc: {
|
|
9
|
+
};
|
|
10
|
+
operations: {
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
readonly "Health.Heartbeat": typeof HealthApi.events["Health.Heartbeat"];
|
|
14
|
+
};
|
|
15
|
+
feeds: {
|
|
16
|
+
};
|
|
17
|
+
subjects: {
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const USED_API: UsedApi = {
|
|
22
|
+
rpc: {
|
|
23
|
+
},
|
|
24
|
+
operations: {
|
|
25
|
+
},
|
|
26
|
+
events: {
|
|
27
|
+
get "Health.Heartbeat"() { return HealthApi.events["Health.Heartbeat"]; },
|
|
28
|
+
},
|
|
29
|
+
feeds: {
|
|
30
|
+
},
|
|
31
|
+
subjects: {
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type OwnedApi = typeof OWNED_API;
|
|
36
|
+
export type Api = {
|
|
37
|
+
rpc: OwnedApi["rpc"] & UsedApi["rpc"];
|
|
38
|
+
operations: OwnedApi["operations"] & UsedApi["operations"];
|
|
39
|
+
events: OwnedApi["events"] & UsedApi["events"];
|
|
40
|
+
feeds: OwnedApi["feeds"] & UsedApi["feeds"];
|
|
41
|
+
subjects: OwnedApi["subjects"] & UsedApi["subjects"];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const API = {
|
|
45
|
+
owned: OWNED_API,
|
|
46
|
+
used: USED_API,
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
export type ApiViews = typeof API;
|
|
50
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@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 HealthSdk from "../../health.js";
|
|
6
|
+
|
|
7
|
+
type EventCallback<TMessage> = {
|
|
8
|
+
bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
|
|
9
|
+
}["bivarianceHack"];
|
|
10
|
+
|
|
11
|
+
type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
|
|
12
|
+
|
|
13
|
+
export type TrellisStateState = {};
|
|
14
|
+
|
|
15
|
+
export interface TrellisStateClient {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly timeout: number;
|
|
18
|
+
readonly stream: string;
|
|
19
|
+
readonly api: Api;
|
|
20
|
+
readonly state: TrellisStateState;
|
|
21
|
+
readonly connection: TrellisConnection;
|
|
22
|
+
transfer(grant: SendTransferGrant): SendTransferHandle;
|
|
23
|
+
transfer(grant: ReceiveTransferGrant): ReceiveTransferHandle;
|
|
24
|
+
readonly rpc: {
|
|
25
|
+
readonly state: {
|
|
26
|
+
adminDelete(input: Types.StateAdminDeleteInput, opts?: RequestOpts): AsyncResult<Types.StateAdminDeleteOutput, BaseError>;
|
|
27
|
+
adminGet(input: Types.StateAdminGetInput, opts?: RequestOpts): AsyncResult<Types.StateAdminGetOutput, BaseError>;
|
|
28
|
+
adminList(input: Types.StateAdminListInput, opts?: RequestOpts): AsyncResult<Types.StateAdminListOutput, BaseError>;
|
|
29
|
+
delete(input: Types.StateDeleteInput, opts?: RequestOpts): AsyncResult<Types.StateDeleteOutput, BaseError>;
|
|
30
|
+
get(input: Types.StateGetInput, opts?: RequestOpts): AsyncResult<Types.StateGetOutput, BaseError>;
|
|
31
|
+
list(input: Types.StateListInput, opts?: RequestOpts): AsyncResult<Types.StateListOutput, BaseError>;
|
|
32
|
+
put(input: Types.StatePutInput, opts?: RequestOpts): AsyncResult<Types.StatePutOutput, BaseError>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
readonly event: {
|
|
36
|
+
readonly health: {
|
|
37
|
+
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>; };
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly feed: {};
|
|
41
|
+
readonly operation: {};
|
|
42
|
+
wait(): AsyncResult<void, BaseError>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface Service extends Client {
|
|
46
|
+
readonly handle: ServiceHandle;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ServiceHandle {
|
|
50
|
+
readonly rpc: {
|
|
51
|
+
readonly state: {
|
|
52
|
+
adminDelete(handler: RpcHandler<Types.StateAdminDeleteInput, Types.StateAdminDeleteOutput>): Promise<void>;
|
|
53
|
+
adminGet(handler: RpcHandler<Types.StateAdminGetInput, Types.StateAdminGetOutput>): Promise<void>;
|
|
54
|
+
adminList(handler: RpcHandler<Types.StateAdminListInput, Types.StateAdminListOutput>): Promise<void>;
|
|
55
|
+
delete(handler: RpcHandler<Types.StateDeleteInput, Types.StateDeleteOutput>): Promise<void>;
|
|
56
|
+
get(handler: RpcHandler<Types.StateGetInput, Types.StateGetOutput>): Promise<void>;
|
|
57
|
+
list(handler: RpcHandler<Types.StateListInput, Types.StateListOutput>): Promise<void>;
|
|
58
|
+
put(handler: RpcHandler<Types.StatePutInput, Types.StatePutOutput>): Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly feed: {};
|
|
62
|
+
readonly operation: {};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type HandlerClient = HandlerTrellis<Api>;
|
|
66
|
+
export type Client = TrellisStateClient;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@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.state@v1" as const;
|
|
8
|
+
export const CONTRACT_DIGEST = "XfWDYLTBlYFjDqMPBEXrTBccZbFvHp0MnqscehdRKT4" as const;
|
|
9
|
+
export const CONTRACT = {"description":"Trellis-managed app state for authenticated app and device participants.","displayName":"Trellis State","docs":{"markdown":"Provides authenticated read, write, list, delete, and admin inspection APIs for Trellis-managed participant state.","summary":"Participant state storage APIs."},"format":"trellis.contract.v1","id":"trellis.state@v1","kind":"service","rpc":{"State.Admin.Delete":{"capabilities":{"call":["admin"]},"docs":{"markdown":"Deletes one state value across participants for authorized administrators.","summary":"Admin delete a state value."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateAdminDeleteRequest"},"output":{"schema":"StateAdminDeleteResponse"},"subject":"rpc.v1.State.Admin.Delete","version":"v1"},"State.Admin.Get":{"capabilities":{"call":["admin"]},"docs":{"markdown":"Returns one state value across participants for authorized administrators.","summary":"Admin read a state value."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateAdminGetRequest"},"output":{"schema":"StateAdminGetResponse"},"subject":"rpc.v1.State.Admin.Get","version":"v1"},"State.Admin.List":{"capabilities":{"call":["admin"]},"docs":{"markdown":"Lists state values across participants for authorized administrators.","summary":"Admin list state values."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateAdminListRequest"},"output":{"schema":"StateAdminListResponse"},"subject":"rpc.v1.State.Admin.List","version":"v1"},"State.Delete":{"docs":{"markdown":"Deletes one state value from the caller's authorized scope.","summary":"Delete a state value."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateDeleteRequest"},"output":{"schema":"StateDeleteResponse"},"subject":"rpc.v1.State.Delete","version":"v1"},"State.Get":{"docs":{"markdown":"Returns one state value in the caller's authorized scope.","summary":"Read a state value."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateGetRequest"},"output":{"schema":"StateGetResponse"},"subject":"rpc.v1.State.Get","version":"v1"},"State.List":{"docs":{"markdown":"Lists state values visible to the caller for the requested scope and prefix.","summary":"List state values."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StateListRequest"},"output":{"schema":"StateListResponse"},"subject":"rpc.v1.State.List","version":"v1"},"State.Put":{"docs":{"markdown":"Creates or replaces one state value in an authorized scope.","summary":"Write a state value."},"errors":[{"type":"AuthError"},{"type":"UnexpectedError"},{"type":"ValidationError"}],"input":{"schema":"StatePutRequest"},"output":{"schema":"StatePutResponse"},"subject":"rpc.v1.State.Put","version":"v1"}},"schemas":{"JsonValue":{},"StateAdminDeleteRequest":{"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["scope","contractId","contractDigest","store","deviceId"],"type":"object"}]},"StateAdminDeleteResponse":{"properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"type":"object"},"StateAdminGetRequest":{"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["scope","contractId","contractDigest","store","deviceId"],"type":"object"}]},"StateAdminGetResponse":{"anyOf":[{"properties":{"found":{"const":false,"type":"boolean"}},"required":["found"],"type":"object"},{"properties":{"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"found":{"const":true,"type":"boolean"}},"required":["found","entry"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"StateAdminListRequest":{"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["limit","scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["limit","scope","contractId","contractDigest","store","deviceId"],"type":"object"}]},"StateAdminListResponse":{"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"type":"array"},"limit":{"minimum":0,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"},"StateDeleteRequest":{"properties":{"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["store"],"type":"object"},"StateDeleteResponse":{"properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"type":"object"},"StateEntry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"StateGetRequest":{"properties":{"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["store"],"type":"object"},"StateGetResponse":{"anyOf":[{"properties":{"found":{"const":false,"type":"boolean"}},"required":["found"],"type":"object"},{"properties":{"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"found":{"const":true,"type":"boolean"}},"required":["found","entry"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"StateListRequest":{"properties":{"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["limit","store"],"type":"object"},"StateListResponse":{"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"type":"array"},"limit":{"minimum":0,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"},"StateMigrationRequired":{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"},"StatePutRequest":{"properties":{"expectedRevision":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"},"ttlMs":{"minimum":1,"type":"integer"},"value":{}},"required":["store","value"],"type":"object"},"StatePutResponse":{"anyOf":[{"properties":{"applied":{"const":true,"type":"boolean"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"}},"required":["applied","entry"],"type":"object"},{"properties":{"applied":{"const":false,"type":"boolean"},"entry":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"found":{"type":"boolean"}},"required":["applied","found"],"type":"object"}]},"StateScope":{"anyOf":[{"const":"userApp","type":"string"},{"const":"deviceApp","type":"string"}]},"StateUserTarget":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"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, TrellisStateClient, TrellisStateState } from "./client.js";
|
|
6
|
+
export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@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 { StateAdminDeleteRequestSchema, StateAdminDeleteResponseSchema, StateAdminGetRequestSchema, StateAdminGetResponseSchema, StateAdminListRequestSchema, StateAdminListResponseSchema, StateDeleteRequestSchema, StateDeleteResponseSchema, StateGetRequestSchema, StateGetResponseSchema, StateListRequestSchema, StateListResponseSchema, StatePutRequestSchema, StatePutResponseSchema } from "./schemas.js";
|
|
6
|
+
|
|
7
|
+
export const OWNED_API = {
|
|
8
|
+
rpc: {
|
|
9
|
+
"State.Admin.Delete": {
|
|
10
|
+
subject: "rpc.v1.State.Admin.Delete",
|
|
11
|
+
input: schema<Types.StateAdminDeleteInput>(StateAdminDeleteRequestSchema),
|
|
12
|
+
output: schema<Types.StateAdminDeleteOutput>(StateAdminDeleteResponseSchema),
|
|
13
|
+
callerCapabilities: ["admin"],
|
|
14
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
15
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
16
|
+
},
|
|
17
|
+
"State.Admin.Get": {
|
|
18
|
+
subject: "rpc.v1.State.Admin.Get",
|
|
19
|
+
input: schema<Types.StateAdminGetInput>(StateAdminGetRequestSchema),
|
|
20
|
+
output: schema<Types.StateAdminGetOutput>(StateAdminGetResponseSchema),
|
|
21
|
+
callerCapabilities: ["admin"],
|
|
22
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
23
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
24
|
+
},
|
|
25
|
+
"State.Admin.List": {
|
|
26
|
+
subject: "rpc.v1.State.Admin.List",
|
|
27
|
+
input: schema<Types.StateAdminListInput>(StateAdminListRequestSchema),
|
|
28
|
+
output: schema<Types.StateAdminListOutput>(StateAdminListResponseSchema),
|
|
29
|
+
callerCapabilities: ["admin"],
|
|
30
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
31
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
32
|
+
},
|
|
33
|
+
"State.Delete": {
|
|
34
|
+
subject: "rpc.v1.State.Delete",
|
|
35
|
+
input: schema<Types.StateDeleteInput>(StateDeleteRequestSchema),
|
|
36
|
+
output: schema<Types.StateDeleteOutput>(StateDeleteResponseSchema),
|
|
37
|
+
callerCapabilities: [],
|
|
38
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
39
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
40
|
+
},
|
|
41
|
+
"State.Get": {
|
|
42
|
+
subject: "rpc.v1.State.Get",
|
|
43
|
+
input: schema<Types.StateGetInput>(StateGetRequestSchema),
|
|
44
|
+
output: schema<Types.StateGetOutput>(StateGetResponseSchema),
|
|
45
|
+
callerCapabilities: [],
|
|
46
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
47
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
48
|
+
},
|
|
49
|
+
"State.List": {
|
|
50
|
+
subject: "rpc.v1.State.List",
|
|
51
|
+
input: schema<Types.StateListInput>(StateListRequestSchema),
|
|
52
|
+
output: schema<Types.StateListOutput>(StateListResponseSchema),
|
|
53
|
+
callerCapabilities: [],
|
|
54
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
55
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
56
|
+
},
|
|
57
|
+
"State.Put": {
|
|
58
|
+
subject: "rpc.v1.State.Put",
|
|
59
|
+
input: schema<Types.StatePutInput>(StatePutRequestSchema),
|
|
60
|
+
output: schema<Types.StatePutOutput>(StatePutResponseSchema),
|
|
61
|
+
callerCapabilities: [],
|
|
62
|
+
errors: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
63
|
+
declaredErrorTypes: ["AuthError","UnexpectedError","ValidationError"] as const,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
operations: {
|
|
67
|
+
},
|
|
68
|
+
events: {
|
|
69
|
+
},
|
|
70
|
+
feeds: {
|
|
71
|
+
},
|
|
72
|
+
subjects: {
|
|
73
|
+
},
|
|
74
|
+
} satisfies TrellisAPI;
|
|
75
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@v1.json
|
|
2
|
+
export const StateAdminDeleteRequestSchema = {"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["scope","contractId","contractDigest","store","deviceId"],"type":"object"}]} as const;
|
|
3
|
+
|
|
4
|
+
export const StateAdminDeleteResponseSchema = {"properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"type":"object"} as const;
|
|
5
|
+
|
|
6
|
+
export const StateAdminGetRequestSchema = {"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["scope","contractId","contractDigest","store","deviceId"],"type":"object"}]} as const;
|
|
7
|
+
|
|
8
|
+
export const StateAdminGetResponseSchema = {"anyOf":[{"properties":{"found":{"const":false,"type":"boolean"}},"required":["found"],"type":"object"},{"properties":{"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"found":{"const":true,"type":"boolean"}},"required":["found","entry"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]} as const;
|
|
9
|
+
|
|
10
|
+
export const StateAdminListRequestSchema = {"anyOf":[{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"scope":{"const":"userApp","type":"string"},"store":{"minLength":1,"type":"string"},"user":{"properties":{"id":{"minLength":1,"type":"string"},"origin":{"minLength":1,"type":"string"},"userId":{"minLength":1,"type":"string"}},"required":["origin","id"],"type":"object"}},"required":["limit","scope","contractId","contractDigest","store","user"],"type":"object"},{"properties":{"contractDigest":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deviceId":{"minLength":1,"type":"string"},"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"scope":{"const":"deviceApp","type":"string"},"store":{"minLength":1,"type":"string"}},"required":["limit","scope","contractId","contractDigest","store","deviceId"],"type":"object"}]} as const;
|
|
11
|
+
|
|
12
|
+
export const StateAdminListResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"type":"array"},"limit":{"minimum":0,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
|
|
13
|
+
|
|
14
|
+
export const StateDeleteRequestSchema = {"properties":{"expectedRevision":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["store"],"type":"object"} as const;
|
|
15
|
+
|
|
16
|
+
export const StateDeleteResponseSchema = {"properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"type":"object"} as const;
|
|
17
|
+
|
|
18
|
+
export const StateGetRequestSchema = {"properties":{"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["store"],"type":"object"} as const;
|
|
19
|
+
|
|
20
|
+
export const StateGetResponseSchema = {"anyOf":[{"properties":{"found":{"const":false,"type":"boolean"}},"required":["found"],"type":"object"},{"properties":{"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"found":{"const":true,"type":"boolean"}},"required":["found","entry"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]} as const;
|
|
21
|
+
|
|
22
|
+
export const StateListRequestSchema = {"properties":{"limit":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"},"prefix":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"}},"required":["limit","store"],"type":"object"} as const;
|
|
23
|
+
|
|
24
|
+
export const StateListResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"type":"array"},"limit":{"minimum":0,"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 StatePutRequestSchema = {"properties":{"expectedRevision":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"key":{"minLength":1,"type":"string"},"store":{"minLength":1,"type":"string"},"ttlMs":{"minimum":1,"type":"integer"},"value":{}},"required":["store","value"],"type":"object"} as const;
|
|
27
|
+
|
|
28
|
+
export const StatePutResponseSchema = {"anyOf":[{"properties":{"applied":{"const":true,"type":"boolean"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"}},"required":["applied","entry"],"type":"object"},{"properties":{"applied":{"const":false,"type":"boolean"},"entry":{"anyOf":[{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},{"properties":{"currentStateVersion":{"minLength":1,"type":"string"},"entry":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"key":{"minLength":1,"type":"string"},"revision":{"minLength":1,"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"value":{}},"required":["value","revision","updatedAt"],"type":"object"},"migrationRequired":{"const":true,"type":"boolean"},"stateVersion":{"minLength":1,"type":"string"},"writerContractDigest":{"minLength":1,"type":"string"}},"required":["migrationRequired","entry","stateVersion","currentStateVersion","writerContractDigest"],"type":"object"}]},"found":{"type":"boolean"}},"required":["applied","found"],"type":"object"}]} as const;
|
|
29
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Generated from ./generated/contracts/manifests/trellis.state@v1.json
|
|
2
|
+
import type { RpcHandlerFn } from "@qlever-llc/trellis";
|
|
3
|
+
import type { API } from "./api.js";
|
|
4
|
+
|
|
5
|
+
export const CONTRACT_ID = "trellis.state@v1" as const;
|
|
6
|
+
export const CONTRACT_DIGEST = "XfWDYLTBlYFjDqMPBEXrTBccZbFvHp0MnqscehdRKT4" as const;
|
|
7
|
+
|
|
8
|
+
export type StateAdminDeleteInput = ({ contractDigest: string; contractId: string; expectedRevision?: string; key?: string; scope: "userApp"; store: string; user: { id: string; origin: string; userId?: string; }; } | { contractDigest: string; contractId: string; deviceId: string; expectedRevision?: string; key?: string; scope: "deviceApp"; store: string; });
|
|
9
|
+
export type StateAdminDeleteOutput = { deleted: boolean; };
|
|
10
|
+
|
|
11
|
+
export type StateAdminGetInput = ({ contractDigest: string; contractId: string; key?: string; scope: "userApp"; store: string; user: { id: string; origin: string; userId?: string; }; } | { contractDigest: string; contractId: string; deviceId: string; key?: string; scope: "deviceApp"; store: string; });
|
|
12
|
+
export type StateAdminGetOutput = ({ found: false; } | { entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; found: true; } | { currentStateVersion: string; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; migrationRequired: true; stateVersion: string; writerContractDigest: string; });
|
|
13
|
+
|
|
14
|
+
export type StateAdminListInput = ({ contractDigest: string; contractId: string; limit: number; offset?: number; prefix?: string; scope: "userApp"; store: string; user: { id: string; origin: string; userId?: string; }; } | { contractDigest: string; contractId: string; deviceId: string; limit: number; offset?: number; prefix?: string; scope: "deviceApp"; store: string; });
|
|
15
|
+
export type StateAdminListOutput = { count: number; entries: Array<({ expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; } | { currentStateVersion: string; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; migrationRequired: true; stateVersion: string; writerContractDigest: string; })>; limit: number; nextOffset?: number; offset: number; };
|
|
16
|
+
|
|
17
|
+
export type StateDeleteInput = { expectedRevision?: string; key?: string; store: string; };
|
|
18
|
+
export type StateDeleteOutput = { deleted: boolean; };
|
|
19
|
+
|
|
20
|
+
export type StateGetInput = { key?: string; store: string; };
|
|
21
|
+
export type StateGetOutput = ({ found: false; } | { entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; found: true; } | { currentStateVersion: string; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; migrationRequired: true; stateVersion: string; writerContractDigest: string; });
|
|
22
|
+
|
|
23
|
+
export type StateListInput = { limit: number; offset?: number; prefix?: string; store: string; };
|
|
24
|
+
export type StateListOutput = { count: number; entries: Array<({ expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; } | { currentStateVersion: string; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; migrationRequired: true; stateVersion: string; writerContractDigest: string; })>; limit: number; nextOffset?: number; offset: number; };
|
|
25
|
+
|
|
26
|
+
export type StatePutInput = { expectedRevision?: (string | null); key?: string; store: string; ttlMs?: number; value: unknown; };
|
|
27
|
+
export type StatePutOutput = ({ applied: true; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; } | { applied: false; entry?: ({ expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; } | { currentStateVersion: string; entry: { expiresAt?: string; key?: string; revision: string; updatedAt: string; value: unknown; }; migrationRequired: true; stateVersion: string; writerContractDigest: string; }); found: boolean; });
|
|
28
|
+
|
|
29
|
+
export interface RpcMap {
|
|
30
|
+
"State.Admin.Delete": { input: StateAdminDeleteInput; output: StateAdminDeleteOutput; };
|
|
31
|
+
"State.Admin.Get": { input: StateAdminGetInput; output: StateAdminGetOutput; };
|
|
32
|
+
"State.Admin.List": { input: StateAdminListInput; output: StateAdminListOutput; };
|
|
33
|
+
"State.Delete": { input: StateDeleteInput; output: StateDeleteOutput; };
|
|
34
|
+
"State.Get": { input: StateGetInput; output: StateGetOutput; };
|
|
35
|
+
"State.List": { input: StateListInput; output: StateListOutput; };
|
|
36
|
+
"State.Put": { input: StatePutInput; output: StatePutOutput; };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type StateAdminDeleteHandler = RpcHandlerFn<typeof API.owned, "State.Admin.Delete">;
|
|
40
|
+
export type StateAdminGetHandler = RpcHandlerFn<typeof API.owned, "State.Admin.Get">;
|
|
41
|
+
export type StateAdminListHandler = RpcHandlerFn<typeof API.owned, "State.Admin.List">;
|
|
42
|
+
export type StateDeleteHandler = RpcHandlerFn<typeof API.owned, "State.Delete">;
|
|
43
|
+
export type StateGetHandler = RpcHandlerFn<typeof API.owned, "State.Get">;
|
|
44
|
+
export type StateListHandler = RpcHandlerFn<typeof API.owned, "State.List">;
|
|
45
|
+
export type StatePutHandler = RpcHandlerFn<typeof API.owned, "State.Put">;
|
|
46
|
+
|
|
47
|
+
export interface EventMap {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface FeedMap {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface SubjectMap {
|
|
54
|
+
}
|
|
55
|
+
|
package/src/sdk/auth.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./_generated/auth/mod.js";
|
package/src/sdk/core.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./_generated/core/mod.js";
|
package/src/sdk/health.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./_generated/health/mod.js";
|
package/src/sdk/jobs.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./_generated/jobs/mod.js";
|
package/src/sdk/state.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
export * from "
|
|
2
|
+
export * from "./_generated/state/mod.js";
|