@qlever-llc/trellis 0.10.8 → 0.10.10
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/contract_support/mod.d.ts +1 -1
- package/esm/contract_support/mod.d.ts.map +1 -1
- package/esm/contract_support/mod.js +1 -1
- package/esm/contract_support/protocol.d.ts +67 -0
- package/esm/contract_support/protocol.d.ts.map +1 -1
- package/esm/contract_support/protocol.js +90 -0
- 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/contract.js +9590 -7
- package/esm/generated-sdk/auth/mod.d.ts +3 -3
- package/esm/generated-sdk/auth/mod.d.ts.map +1 -1
- package/esm/generated-sdk/auth/mod.js +1 -1
- package/esm/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/owned_api.js +305 -62
- package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/auth/schemas.js +6492 -139
- package/esm/generated-sdk/auth/types.d.ts +254 -254
- 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/contract.js +117 -7
- package/esm/generated-sdk/health/mod.d.ts +2 -2
- package/esm/generated-sdk/health/mod.d.ts.map +1 -1
- package/esm/generated-sdk/health/mod.js +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/schemas.js +79 -1
- package/esm/generated-sdk/health/types.d.ts +4 -4
- 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/api.js +12 -4
- 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/contract.js +1080 -7
- package/esm/generated-sdk/jobs/mod.d.ts +2 -2
- package/esm/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/mod.js +1 -1
- package/esm/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/owned_api.js +26 -6
- package/esm/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/schemas.js +768 -18
- package/esm/generated-sdk/jobs/types.d.ts +14 -14
- 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/api.js +3 -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/contract.js +638 -7
- package/esm/generated-sdk/state/mod.d.ts +2 -2
- package/esm/generated-sdk/state/mod.d.ts.map +1 -1
- package/esm/generated-sdk/state/mod.js +1 -1
- package/esm/generated-sdk/state/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/state/owned_api.js +36 -8
- package/esm/generated-sdk/state/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/state/schemas.js +441 -14
- package/esm/generated-sdk/state/types.d.ts +15 -15
- 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/contract.js +744 -7
- package/esm/generated-sdk/trellis-core/mod.d.ts +2 -2
- package/esm/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/mod.js +1 -1
- package/esm/generated-sdk/trellis-core/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/owned_api.js +1 -1
- package/esm/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/schemas.js +626 -8
- package/esm/generated-sdk/trellis-core/types.d.ts +14 -14
- package/esm/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/server/service.d.ts +40 -9
- package/esm/server/service.d.ts.map +1 -1
- package/esm/server/service.js +28 -4
- package/esm/service/deno.d.ts +1 -1
- package/esm/service/deno.d.ts.map +1 -1
- package/esm/service/mod.d.ts +1 -1
- package/esm/service/mod.d.ts.map +1 -1
- package/esm/service/node.d.ts +1 -1
- package/esm/service/node.d.ts.map +1 -1
- package/package.json +2 -2
- package/script/contract_support/mod.d.ts +1 -1
- package/script/contract_support/mod.d.ts.map +1 -1
- package/script/contract_support/mod.js +8 -1
- package/script/contract_support/protocol.d.ts +67 -0
- package/script/contract_support/protocol.d.ts.map +1 -1
- package/script/contract_support/protocol.js +96 -1
- 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/contract.js +9590 -7
- package/script/generated-sdk/auth/mod.d.ts +3 -3
- package/script/generated-sdk/auth/mod.d.ts.map +1 -1
- package/script/generated-sdk/auth/mod.js +2 -2
- package/script/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/auth/owned_api.js +304 -61
- package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/script/generated-sdk/auth/schemas.js +6492 -139
- package/script/generated-sdk/auth/types.d.ts +254 -254
- 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/contract.js +117 -7
- package/script/generated-sdk/health/mod.d.ts +2 -2
- package/script/generated-sdk/health/mod.d.ts.map +1 -1
- package/script/generated-sdk/health/mod.js +2 -2
- 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/schemas.js +79 -1
- package/script/generated-sdk/health/types.d.ts +4 -4
- 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/api.js +12 -4
- 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/contract.js +1080 -7
- package/script/generated-sdk/jobs/mod.d.ts +2 -2
- package/script/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/script/generated-sdk/jobs/mod.js +2 -2
- package/script/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/owned_api.js +25 -5
- package/script/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/script/generated-sdk/jobs/schemas.js +768 -18
- package/script/generated-sdk/jobs/types.d.ts +14 -14
- 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/api.js +3 -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/contract.js +638 -7
- package/script/generated-sdk/state/mod.d.ts +2 -2
- package/script/generated-sdk/state/mod.d.ts.map +1 -1
- package/script/generated-sdk/state/mod.js +2 -2
- package/script/generated-sdk/state/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/state/owned_api.js +35 -7
- package/script/generated-sdk/state/schemas.d.ts.map +1 -1
- package/script/generated-sdk/state/schemas.js +441 -14
- package/script/generated-sdk/state/types.d.ts +15 -15
- 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/contract.js +744 -7
- package/script/generated-sdk/trellis-core/mod.d.ts +2 -2
- package/script/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/mod.js +2 -2
- 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/schemas.js +626 -8
- package/script/generated-sdk/trellis-core/types.d.ts +14 -14
- package/script/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/script/index.d.ts +2 -2
- package/script/index.d.ts.map +1 -1
- package/script/index.js +9 -2
- package/script/server/service.d.ts +40 -9
- package/script/server/service.d.ts.map +1 -1
- package/script/server/service.js +27 -3
- package/script/service/deno.d.ts +1 -1
- package/script/service/deno.d.ts.map +1 -1
- package/script/service/mod.d.ts +1 -1
- package/script/service/mod.d.ts.map +1 -1
- package/script/service/node.d.ts +1 -1
- package/script/service/node.d.ts.map +1 -1
- package/src/contract_support/mod.ts +12 -0
- package/src/contract_support/protocol.ts +137 -0
- package/src/index.ts +12 -0
- package/src/sdk/_generated/auth/api.ts +10 -21
- package/src/sdk/_generated/auth/client.ts +1178 -160
- package/src/sdk/_generated/auth/contract.ts +9637 -13
- package/src/sdk/_generated/auth/mod.ts +22 -3
- package/src/sdk/_generated/auth/owned_api.ts +897 -264
- package/src/sdk/_generated/auth/schemas.ts +6630 -278
- package/src/sdk/_generated/auth/types.ts +2950 -359
- package/src/sdk/_generated/core/api.ts +10 -21
- package/src/sdk/_generated/core/client.ts +105 -12
- package/src/sdk/_generated/core/contract.ts +774 -13
- package/src/sdk/_generated/core/mod.ts +17 -2
- package/src/sdk/_generated/core/owned_api.ts +40 -24
- package/src/sdk/_generated/core/schemas.ts +626 -9
- package/src/sdk/_generated/core/types.ts +233 -18
- package/src/sdk/_generated/health/api.ts +10 -21
- package/src/sdk/_generated/health/client.ts +104 -8
- package/src/sdk/_generated/health/contract.ts +144 -13
- package/src/sdk/_generated/health/mod.ts +17 -2
- package/src/sdk/_generated/health/owned_api.ts +4 -9
- package/src/sdk/_generated/health/schemas.ts +79 -2
- package/src/sdk/_generated/health/types.ts +31 -4
- package/src/sdk/_generated/jobs/api.ts +20 -18
- package/src/sdk/_generated/jobs/client.ts +199 -28
- package/src/sdk/_generated/jobs/contract.ts +1119 -13
- package/src/sdk/_generated/jobs/mod.ts +17 -2
- package/src/sdk/_generated/jobs/owned_api.ts +64 -27
- package/src/sdk/_generated/jobs/schemas.ts +776 -20
- package/src/sdk/_generated/jobs/types.ts +407 -34
- package/src/sdk/_generated/state/api.ts +11 -18
- package/src/sdk/_generated/state/client.ts +169 -22
- package/src/sdk/_generated/state/contract.ts +670 -13
- package/src/sdk/_generated/state/mod.ts +17 -2
- package/src/sdk/_generated/state/owned_api.ts +65 -25
- package/src/sdk/_generated/state/schemas.ts +441 -15
- package/src/sdk/_generated/state/types.ts +229 -26
- package/src/server/service.ts +133 -7
- package/src/service/deno.ts +4 -0
- package/src/service/mod.ts +4 -0
- package/src/service/node.ts +4 -0
|
@@ -3,42 +3,246 @@ import type { RpcHandlerFn } from "../../../index.js";
|
|
|
3
3
|
import type { API } from "./api.js";
|
|
4
4
|
|
|
5
5
|
export const CONTRACT_ID = "trellis.state@v1" as const;
|
|
6
|
-
export const CONTRACT_DIGEST =
|
|
6
|
+
export const CONTRACT_DIGEST =
|
|
7
|
+
"XfWDYLTBlYFjDqMPBEXrTBccZbFvHp0MnqscehdRKT4" as const;
|
|
7
8
|
|
|
8
|
-
export type StateAdminDeleteInput =
|
|
9
|
-
|
|
9
|
+
export type StateAdminDeleteInput = {
|
|
10
|
+
contractDigest: string;
|
|
11
|
+
contractId: string;
|
|
12
|
+
expectedRevision?: string;
|
|
13
|
+
key?: string;
|
|
14
|
+
scope: "userApp";
|
|
15
|
+
store: string;
|
|
16
|
+
user: { id: string; origin: string; userId?: string };
|
|
17
|
+
} | {
|
|
18
|
+
contractDigest: string;
|
|
19
|
+
contractId: string;
|
|
20
|
+
deviceId: string;
|
|
21
|
+
expectedRevision?: string;
|
|
22
|
+
key?: string;
|
|
23
|
+
scope: "deviceApp";
|
|
24
|
+
store: string;
|
|
25
|
+
};
|
|
26
|
+
export type StateAdminDeleteOutput = { deleted: boolean };
|
|
10
27
|
|
|
11
|
-
export type StateAdminGetInput =
|
|
12
|
-
|
|
28
|
+
export type StateAdminGetInput = {
|
|
29
|
+
contractDigest: string;
|
|
30
|
+
contractId: string;
|
|
31
|
+
key?: string;
|
|
32
|
+
scope: "userApp";
|
|
33
|
+
store: string;
|
|
34
|
+
user: { id: string; origin: string; userId?: string };
|
|
35
|
+
} | {
|
|
36
|
+
contractDigest: string;
|
|
37
|
+
contractId: string;
|
|
38
|
+
deviceId: string;
|
|
39
|
+
key?: string;
|
|
40
|
+
scope: "deviceApp";
|
|
41
|
+
store: string;
|
|
42
|
+
};
|
|
43
|
+
export type StateAdminGetOutput = { found: false } | {
|
|
44
|
+
entry: {
|
|
45
|
+
expiresAt?: string;
|
|
46
|
+
key?: string;
|
|
47
|
+
revision: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
value: unknown;
|
|
50
|
+
};
|
|
51
|
+
found: true;
|
|
52
|
+
} | {
|
|
53
|
+
currentStateVersion: string;
|
|
54
|
+
entry: {
|
|
55
|
+
expiresAt?: string;
|
|
56
|
+
key?: string;
|
|
57
|
+
revision: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
value: unknown;
|
|
60
|
+
};
|
|
61
|
+
migrationRequired: true;
|
|
62
|
+
stateVersion: string;
|
|
63
|
+
writerContractDigest: string;
|
|
64
|
+
};
|
|
13
65
|
|
|
14
|
-
export type StateAdminListInput =
|
|
15
|
-
|
|
66
|
+
export type StateAdminListInput = {
|
|
67
|
+
contractDigest: string;
|
|
68
|
+
contractId: string;
|
|
69
|
+
limit: number;
|
|
70
|
+
offset?: number;
|
|
71
|
+
prefix?: string;
|
|
72
|
+
scope: "userApp";
|
|
73
|
+
store: string;
|
|
74
|
+
user: { id: string; origin: string; userId?: string };
|
|
75
|
+
} | {
|
|
76
|
+
contractDigest: string;
|
|
77
|
+
contractId: string;
|
|
78
|
+
deviceId: string;
|
|
79
|
+
limit: number;
|
|
80
|
+
offset?: number;
|
|
81
|
+
prefix?: string;
|
|
82
|
+
scope: "deviceApp";
|
|
83
|
+
store: string;
|
|
84
|
+
};
|
|
85
|
+
export type StateAdminListOutput = {
|
|
86
|
+
count: number;
|
|
87
|
+
entries: Array<
|
|
88
|
+
({
|
|
89
|
+
expiresAt?: string;
|
|
90
|
+
key?: string;
|
|
91
|
+
revision: string;
|
|
92
|
+
updatedAt: string;
|
|
93
|
+
value: unknown;
|
|
94
|
+
} | {
|
|
95
|
+
currentStateVersion: string;
|
|
96
|
+
entry: {
|
|
97
|
+
expiresAt?: string;
|
|
98
|
+
key?: string;
|
|
99
|
+
revision: string;
|
|
100
|
+
updatedAt: string;
|
|
101
|
+
value: unknown;
|
|
102
|
+
};
|
|
103
|
+
migrationRequired: true;
|
|
104
|
+
stateVersion: string;
|
|
105
|
+
writerContractDigest: string;
|
|
106
|
+
})
|
|
107
|
+
>;
|
|
108
|
+
limit: number;
|
|
109
|
+
nextOffset?: number;
|
|
110
|
+
offset: number;
|
|
111
|
+
};
|
|
16
112
|
|
|
17
|
-
export type StateDeleteInput = {
|
|
18
|
-
|
|
113
|
+
export type StateDeleteInput = {
|
|
114
|
+
expectedRevision?: string;
|
|
115
|
+
key?: string;
|
|
116
|
+
store: string;
|
|
117
|
+
};
|
|
118
|
+
export type StateDeleteOutput = { deleted: boolean };
|
|
19
119
|
|
|
20
|
-
export type StateGetInput = { key?: string; store: string
|
|
21
|
-
export type StateGetOutput =
|
|
120
|
+
export type StateGetInput = { key?: string; store: string };
|
|
121
|
+
export type StateGetOutput = { found: false } | {
|
|
122
|
+
entry: {
|
|
123
|
+
expiresAt?: string;
|
|
124
|
+
key?: string;
|
|
125
|
+
revision: string;
|
|
126
|
+
updatedAt: string;
|
|
127
|
+
value: unknown;
|
|
128
|
+
};
|
|
129
|
+
found: true;
|
|
130
|
+
} | {
|
|
131
|
+
currentStateVersion: string;
|
|
132
|
+
entry: {
|
|
133
|
+
expiresAt?: string;
|
|
134
|
+
key?: string;
|
|
135
|
+
revision: string;
|
|
136
|
+
updatedAt: string;
|
|
137
|
+
value: unknown;
|
|
138
|
+
};
|
|
139
|
+
migrationRequired: true;
|
|
140
|
+
stateVersion: string;
|
|
141
|
+
writerContractDigest: string;
|
|
142
|
+
};
|
|
22
143
|
|
|
23
|
-
export type StateListInput = {
|
|
24
|
-
|
|
144
|
+
export type StateListInput = {
|
|
145
|
+
limit: number;
|
|
146
|
+
offset?: number;
|
|
147
|
+
prefix?: string;
|
|
148
|
+
store: string;
|
|
149
|
+
};
|
|
150
|
+
export type StateListOutput = {
|
|
151
|
+
count: number;
|
|
152
|
+
entries: Array<
|
|
153
|
+
({
|
|
154
|
+
expiresAt?: string;
|
|
155
|
+
key?: string;
|
|
156
|
+
revision: string;
|
|
157
|
+
updatedAt: string;
|
|
158
|
+
value: unknown;
|
|
159
|
+
} | {
|
|
160
|
+
currentStateVersion: string;
|
|
161
|
+
entry: {
|
|
162
|
+
expiresAt?: string;
|
|
163
|
+
key?: string;
|
|
164
|
+
revision: string;
|
|
165
|
+
updatedAt: string;
|
|
166
|
+
value: unknown;
|
|
167
|
+
};
|
|
168
|
+
migrationRequired: true;
|
|
169
|
+
stateVersion: string;
|
|
170
|
+
writerContractDigest: string;
|
|
171
|
+
})
|
|
172
|
+
>;
|
|
173
|
+
limit: number;
|
|
174
|
+
nextOffset?: number;
|
|
175
|
+
offset: number;
|
|
176
|
+
};
|
|
25
177
|
|
|
26
|
-
export type StatePutInput = {
|
|
27
|
-
|
|
178
|
+
export type StatePutInput = {
|
|
179
|
+
expectedRevision?: string | null;
|
|
180
|
+
key?: string;
|
|
181
|
+
store: string;
|
|
182
|
+
ttlMs?: number;
|
|
183
|
+
value: unknown;
|
|
184
|
+
};
|
|
185
|
+
export type StatePutOutput = {
|
|
186
|
+
applied: true;
|
|
187
|
+
entry: {
|
|
188
|
+
expiresAt?: string;
|
|
189
|
+
key?: string;
|
|
190
|
+
revision: string;
|
|
191
|
+
updatedAt: string;
|
|
192
|
+
value: unknown;
|
|
193
|
+
};
|
|
194
|
+
} | {
|
|
195
|
+
applied: false;
|
|
196
|
+
entry?: {
|
|
197
|
+
expiresAt?: string;
|
|
198
|
+
key?: string;
|
|
199
|
+
revision: string;
|
|
200
|
+
updatedAt: string;
|
|
201
|
+
value: unknown;
|
|
202
|
+
} | {
|
|
203
|
+
currentStateVersion: string;
|
|
204
|
+
entry: {
|
|
205
|
+
expiresAt?: string;
|
|
206
|
+
key?: string;
|
|
207
|
+
revision: string;
|
|
208
|
+
updatedAt: string;
|
|
209
|
+
value: unknown;
|
|
210
|
+
};
|
|
211
|
+
migrationRequired: true;
|
|
212
|
+
stateVersion: string;
|
|
213
|
+
writerContractDigest: string;
|
|
214
|
+
};
|
|
215
|
+
found: boolean;
|
|
216
|
+
};
|
|
28
217
|
|
|
29
218
|
export interface RpcMap {
|
|
30
|
-
"State.Admin.Delete": {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"State.Get": { input:
|
|
35
|
-
"State.List": {
|
|
36
|
-
|
|
219
|
+
"State.Admin.Delete": {
|
|
220
|
+
input: StateAdminDeleteInput;
|
|
221
|
+
output: StateAdminDeleteOutput;
|
|
222
|
+
};
|
|
223
|
+
"State.Admin.Get": { input: StateAdminGetInput; output: StateAdminGetOutput };
|
|
224
|
+
"State.Admin.List": {
|
|
225
|
+
input: StateAdminListInput;
|
|
226
|
+
output: StateAdminListOutput;
|
|
227
|
+
};
|
|
228
|
+
"State.Delete": { input: StateDeleteInput; output: StateDeleteOutput };
|
|
229
|
+
"State.Get": { input: StateGetInput; output: StateGetOutput };
|
|
230
|
+
"State.List": { input: StateListInput; output: StateListOutput };
|
|
231
|
+
"State.Put": { input: StatePutInput; output: StatePutOutput };
|
|
37
232
|
}
|
|
38
233
|
|
|
39
|
-
export type StateAdminDeleteHandler = RpcHandlerFn<
|
|
40
|
-
|
|
41
|
-
|
|
234
|
+
export type StateAdminDeleteHandler = RpcHandlerFn<
|
|
235
|
+
typeof API.owned,
|
|
236
|
+
"State.Admin.Delete"
|
|
237
|
+
>;
|
|
238
|
+
export type StateAdminGetHandler = RpcHandlerFn<
|
|
239
|
+
typeof API.owned,
|
|
240
|
+
"State.Admin.Get"
|
|
241
|
+
>;
|
|
242
|
+
export type StateAdminListHandler = RpcHandlerFn<
|
|
243
|
+
typeof API.owned,
|
|
244
|
+
"State.Admin.List"
|
|
245
|
+
>;
|
|
42
246
|
export type StateDeleteHandler = RpcHandlerFn<typeof API.owned, "State.Delete">;
|
|
43
247
|
export type StateGetHandler = RpcHandlerFn<typeof API.owned, "State.Get">;
|
|
44
248
|
export type StateListHandler = RpcHandlerFn<typeof API.owned, "State.List">;
|
|
@@ -52,4 +256,3 @@ export interface FeedMap {
|
|
|
52
256
|
|
|
53
257
|
export interface SubjectMap {
|
|
54
258
|
}
|
|
55
|
-
|
package/src/server/service.ts
CHANGED
|
@@ -49,7 +49,12 @@ import {
|
|
|
49
49
|
} from "@qlever-llc/result";
|
|
50
50
|
import { Type } from "typebox";
|
|
51
51
|
import { Value } from "typebox/value";
|
|
52
|
-
import {
|
|
52
|
+
import {
|
|
53
|
+
type HealthCheckFn,
|
|
54
|
+
ServiceHealth,
|
|
55
|
+
type ServiceHealthCheck,
|
|
56
|
+
type ServiceHealthInfo,
|
|
57
|
+
} from "./health.js";
|
|
53
58
|
import { mountStandardHealthRpc } from "./health_rpc.js";
|
|
54
59
|
import type { EventDesc, RPCDesc } from "../contracts.js";
|
|
55
60
|
import type {
|
|
@@ -951,6 +956,22 @@ type ContractJobName<
|
|
|
951
956
|
>,
|
|
952
957
|
> = keyof ContractJobsOf<TContract> & string;
|
|
953
958
|
|
|
959
|
+
type ContractEventName<
|
|
960
|
+
TContract extends ServiceContract<
|
|
961
|
+
TrellisAPI,
|
|
962
|
+
TrellisAPI | undefined,
|
|
963
|
+
ContractJobsMetadata
|
|
964
|
+
>,
|
|
965
|
+
> = ServiceEventName<ContractTrellisApi<TContract>>;
|
|
966
|
+
|
|
967
|
+
type ContractFeedName<
|
|
968
|
+
TContract extends ServiceContract<
|
|
969
|
+
TrellisAPI,
|
|
970
|
+
TrellisAPI | undefined,
|
|
971
|
+
ContractJobsMetadata
|
|
972
|
+
>,
|
|
973
|
+
> = keyof ContractOwnedApi<TContract>["feeds"] & string;
|
|
974
|
+
|
|
954
975
|
type ContractOperationName<
|
|
955
976
|
TContract extends ServiceContract<
|
|
956
977
|
TrellisAPI,
|
|
@@ -986,6 +1007,7 @@ export type JobArgs<
|
|
|
986
1007
|
ContractKvMetadata
|
|
987
1008
|
>,
|
|
988
1009
|
TJob extends ContractJobName<TContract>,
|
|
1010
|
+
TDeps = undefined,
|
|
989
1011
|
> = {
|
|
990
1012
|
job: PublicActiveJob<
|
|
991
1013
|
ContractJobPayload<TContract, TJob>,
|
|
@@ -996,7 +1018,7 @@ export type JobArgs<
|
|
|
996
1018
|
ContractKvOf<TContract>,
|
|
997
1019
|
ContractJobsOf<TContract>
|
|
998
1020
|
>;
|
|
999
|
-
}
|
|
1021
|
+
} & WithDeps<TDeps>;
|
|
1000
1022
|
|
|
1001
1023
|
/** Result returned by a typed Trellis service job handler. */
|
|
1002
1024
|
export type JobResult<
|
|
@@ -1009,6 +1031,9 @@ export type JobResult<
|
|
|
1009
1031
|
TJob extends ContractJobName<TContract>,
|
|
1010
1032
|
> = Result<ContractJobResult<TContract, TJob>, BaseError>;
|
|
1011
1033
|
|
|
1034
|
+
type WithDeps<TDeps> = [TDeps] extends [undefined] ? {} : { deps: TDeps };
|
|
1035
|
+
|
|
1036
|
+
/** Typed RPC handler function for an extracted Trellis service handler. */
|
|
1012
1037
|
export type RpcHandler<
|
|
1013
1038
|
TContract extends ServiceContract<
|
|
1014
1039
|
TrellisAPI,
|
|
@@ -1017,6 +1042,7 @@ export type RpcHandler<
|
|
|
1017
1042
|
ContractKvMetadata
|
|
1018
1043
|
>,
|
|
1019
1044
|
M extends RpcMethodName<ContractOwnedApi<TContract>>,
|
|
1045
|
+
TDeps = undefined,
|
|
1020
1046
|
> = ({
|
|
1021
1047
|
input,
|
|
1022
1048
|
context,
|
|
@@ -1029,7 +1055,7 @@ export type RpcHandler<
|
|
|
1029
1055
|
ContractKvOf<TContract>,
|
|
1030
1056
|
ContractJobsOf<TContract>
|
|
1031
1057
|
>;
|
|
1032
|
-
}) =>
|
|
1058
|
+
} & WithDeps<TDeps>) =>
|
|
1033
1059
|
| Promise<
|
|
1034
1060
|
Result<
|
|
1035
1061
|
RpcMethodOutput<ContractOwnedApi<TContract>, M>,
|
|
@@ -1041,6 +1067,55 @@ export type RpcHandler<
|
|
|
1041
1067
|
RpcHandlerErrorOf<ContractOwnedApi<TContract>, M>
|
|
1042
1068
|
>;
|
|
1043
1069
|
|
|
1070
|
+
/** Typed event listener function for an extracted Trellis service listener. */
|
|
1071
|
+
export type ServiceEventHandler<
|
|
1072
|
+
TContract extends ServiceContract<
|
|
1073
|
+
TrellisAPI,
|
|
1074
|
+
TrellisAPI | undefined,
|
|
1075
|
+
ContractJobsMetadata,
|
|
1076
|
+
ContractKvMetadata
|
|
1077
|
+
>,
|
|
1078
|
+
E extends ContractEventName<TContract>,
|
|
1079
|
+
TDeps = undefined,
|
|
1080
|
+
> = (
|
|
1081
|
+
args: {
|
|
1082
|
+
event: ServiceEventOf<ContractTrellisApi<TContract>, E>;
|
|
1083
|
+
context: EventListenerContext;
|
|
1084
|
+
client: Trellis<
|
|
1085
|
+
ContractTrellisApi<TContract>,
|
|
1086
|
+
ContractKvOf<TContract>,
|
|
1087
|
+
ContractJobsOf<TContract>
|
|
1088
|
+
>;
|
|
1089
|
+
} & WithDeps<TDeps>,
|
|
1090
|
+
) => MaybeAsync<void, BaseError>;
|
|
1091
|
+
|
|
1092
|
+
/** Typed feed handler function for an extracted Trellis service handler. */
|
|
1093
|
+
export type FeedHandler<
|
|
1094
|
+
TContract extends ServiceContract<
|
|
1095
|
+
TrellisAPI,
|
|
1096
|
+
TrellisAPI | undefined,
|
|
1097
|
+
ContractJobsMetadata,
|
|
1098
|
+
ContractKvMetadata
|
|
1099
|
+
>,
|
|
1100
|
+
F extends ContractFeedName<TContract>,
|
|
1101
|
+
TDeps = undefined,
|
|
1102
|
+
> = (
|
|
1103
|
+
context: {
|
|
1104
|
+
input: FeedInputOf<ContractOwnedApi<TContract>, F>;
|
|
1105
|
+
caller: unknown;
|
|
1106
|
+
signal: AbortSignal;
|
|
1107
|
+
emit(
|
|
1108
|
+
event: FeedEventOf<ContractOwnedApi<TContract>, F>,
|
|
1109
|
+
): AsyncResult<void, ValidationError | UnexpectedError>;
|
|
1110
|
+
client: Trellis<
|
|
1111
|
+
ContractTrellisApi<TContract>,
|
|
1112
|
+
ContractKvOf<TContract>,
|
|
1113
|
+
ContractJobsOf<TContract>
|
|
1114
|
+
>;
|
|
1115
|
+
} & WithDeps<TDeps>,
|
|
1116
|
+
) => unknown | Promise<unknown>;
|
|
1117
|
+
|
|
1118
|
+
/** Typed job handler function for an extracted Trellis service job handler. */
|
|
1044
1119
|
export type JobHandler<
|
|
1045
1120
|
TContract extends ServiceContract<
|
|
1046
1121
|
TrellisAPI,
|
|
@@ -1049,8 +1124,12 @@ export type JobHandler<
|
|
|
1049
1124
|
ContractKvMetadata
|
|
1050
1125
|
>,
|
|
1051
1126
|
TJob extends ContractJobName<TContract>,
|
|
1052
|
-
|
|
1127
|
+
TDeps = undefined,
|
|
1128
|
+
> = (args: JobArgs<TContract, TJob, TDeps>) => Promise<
|
|
1129
|
+
JobResult<TContract, TJob>
|
|
1130
|
+
>;
|
|
1053
1131
|
|
|
1132
|
+
/** Typed operation handler function for an extracted Trellis service handler. */
|
|
1054
1133
|
export type OperationHandler<
|
|
1055
1134
|
TContract extends ServiceContract<
|
|
1056
1135
|
TrellisAPI,
|
|
@@ -1059,6 +1138,7 @@ export type OperationHandler<
|
|
|
1059
1138
|
ContractKvMetadata
|
|
1060
1139
|
>,
|
|
1061
1140
|
O extends ContractOperationName<TContract>,
|
|
1141
|
+
TDeps = undefined,
|
|
1062
1142
|
> = (
|
|
1063
1143
|
args:
|
|
1064
1144
|
& OperationHandlerContext<
|
|
@@ -1073,9 +1153,20 @@ export type OperationHandler<
|
|
|
1073
1153
|
ContractKvOf<TContract>,
|
|
1074
1154
|
ContractJobsOf<TContract>
|
|
1075
1155
|
>;
|
|
1076
|
-
}
|
|
1156
|
+
}
|
|
1157
|
+
& WithDeps<TDeps>,
|
|
1077
1158
|
) => unknown | Promise<unknown>;
|
|
1078
1159
|
|
|
1160
|
+
/** Typed health info function for an extracted bound service health handler. */
|
|
1161
|
+
export type HealthInfoHandler<TDeps = undefined> = (
|
|
1162
|
+
args: WithDeps<TDeps>,
|
|
1163
|
+
) => ServiceHealthInfo | undefined | Promise<ServiceHealthInfo | undefined>;
|
|
1164
|
+
|
|
1165
|
+
/** Typed health check function for an extracted bound service health handler. */
|
|
1166
|
+
export type HealthCheckHandler<TDeps = undefined> = (
|
|
1167
|
+
args: WithDeps<TDeps>,
|
|
1168
|
+
) => ServiceHealthCheck | Promise<ServiceHealthCheck>;
|
|
1169
|
+
|
|
1079
1170
|
export type JobQueue<
|
|
1080
1171
|
TPayload,
|
|
1081
1172
|
TResult,
|
|
@@ -1320,6 +1411,14 @@ type BoundJobsFacadeOf<
|
|
|
1320
1411
|
>;
|
|
1321
1412
|
};
|
|
1322
1413
|
|
|
1414
|
+
type BoundServiceHealth<TDeps> = Omit<ServiceHealth, "add" | "setInfo"> & {
|
|
1415
|
+
setInfo(info: ServiceHealthInfo | HealthInfoHandler<TDeps>): void;
|
|
1416
|
+
add(
|
|
1417
|
+
name: string,
|
|
1418
|
+
check: HealthCheckHandler<TDeps>,
|
|
1419
|
+
): () => void;
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1323
1422
|
/** Service wrapper returned by `TrellisService.with(deps)`. */
|
|
1324
1423
|
export type BoundTrellisService<
|
|
1325
1424
|
TOwnedApi extends TrellisAPI = TrellisAPI,
|
|
@@ -1335,7 +1434,6 @@ export type BoundTrellisService<
|
|
|
1335
1434
|
| "nc"
|
|
1336
1435
|
| "kv"
|
|
1337
1436
|
| "store"
|
|
1338
|
-
| "health"
|
|
1339
1437
|
| "connection"
|
|
1340
1438
|
| "createTransfer"
|
|
1341
1439
|
| "completeOperation"
|
|
@@ -1350,6 +1448,7 @@ export type BoundTrellisService<
|
|
|
1350
1448
|
TJobs,
|
|
1351
1449
|
TDeps
|
|
1352
1450
|
>;
|
|
1451
|
+
readonly health: BoundServiceHealth<TDeps>;
|
|
1353
1452
|
readonly jobs: BoundJobsFacadeOf<TJobs, TTrellisApi, TKv, TDeps>;
|
|
1354
1453
|
readonly handle: BoundTypedServiceHandleFacade<
|
|
1355
1454
|
TOwnedApi,
|
|
@@ -2691,7 +2790,7 @@ export class TrellisService<
|
|
|
2691
2790
|
kv: this.kv,
|
|
2692
2791
|
store: this.store,
|
|
2693
2792
|
jobs: createBoundJobsFacade({ jobs: this.jobs, deps }),
|
|
2694
|
-
health: this
|
|
2793
|
+
health: this.#createBoundHealth(deps),
|
|
2695
2794
|
handle: this.#createBoundHandleFacade(deps),
|
|
2696
2795
|
connection: this.connection,
|
|
2697
2796
|
createTransfer: (args) => this.createTransfer(args),
|
|
@@ -2703,6 +2802,33 @@ export class TrellisService<
|
|
|
2703
2802
|
};
|
|
2704
2803
|
}
|
|
2705
2804
|
|
|
2805
|
+
#createBoundHealth<TDeps>(deps: TDeps): BoundServiceHealth<TDeps> {
|
|
2806
|
+
const health = this.health;
|
|
2807
|
+
return {
|
|
2808
|
+
serviceName: health.serviceName,
|
|
2809
|
+
kind: health.kind,
|
|
2810
|
+
instanceId: health.instanceId,
|
|
2811
|
+
contractId: health.contractId,
|
|
2812
|
+
contractDigest: health.contractDigest,
|
|
2813
|
+
startedAt: health.startedAt,
|
|
2814
|
+
publishIntervalMs: health.publishIntervalMs,
|
|
2815
|
+
setInfo(info) {
|
|
2816
|
+
if (typeof info !== "function") {
|
|
2817
|
+
health.setInfo(info);
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
health.setInfo(() => info({ deps }));
|
|
2822
|
+
},
|
|
2823
|
+
add(name, check) {
|
|
2824
|
+
return health.add(name, () => check({ deps }));
|
|
2825
|
+
},
|
|
2826
|
+
checks: () => health.checks(),
|
|
2827
|
+
response: () => health.response(),
|
|
2828
|
+
heartbeat: () => health.heartbeat(),
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2706
2832
|
#createBoundEventFacade<TDeps>(
|
|
2707
2833
|
deps: TDeps,
|
|
2708
2834
|
): BoundActiveEventFacade<TTrellisApi, TTrellisApi, TKv, TJobs, TDeps> {
|
package/src/service/deno.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
export {
|
|
3
3
|
type BoundTrellisService,
|
|
4
|
+
type FeedHandler,
|
|
5
|
+
type HealthCheckHandler,
|
|
6
|
+
type HealthInfoHandler,
|
|
4
7
|
type JobArgs,
|
|
5
8
|
type JobHandler,
|
|
6
9
|
type JobQueue,
|
|
@@ -10,6 +13,7 @@ export {
|
|
|
10
13
|
type OperationRegistration,
|
|
11
14
|
type RpcHandler,
|
|
12
15
|
type ServiceContract,
|
|
16
|
+
type ServiceEventHandler,
|
|
13
17
|
type Trellis,
|
|
14
18
|
TrellisService,
|
|
15
19
|
type TrellisServiceConnectOpts,
|
package/src/service/mod.ts
CHANGED
|
@@ -37,6 +37,9 @@ export {
|
|
|
37
37
|
} from "../server/health_schemas.js";
|
|
38
38
|
export {
|
|
39
39
|
type BoundTrellisService,
|
|
40
|
+
type FeedHandler,
|
|
41
|
+
type HealthCheckHandler,
|
|
42
|
+
type HealthInfoHandler,
|
|
40
43
|
type JobArgs,
|
|
41
44
|
type JobHandler,
|
|
42
45
|
type JobQueue,
|
|
@@ -46,6 +49,7 @@ export {
|
|
|
46
49
|
type OperationRegistration,
|
|
47
50
|
type RpcHandler,
|
|
48
51
|
type ServiceContract,
|
|
52
|
+
type ServiceEventHandler,
|
|
49
53
|
StoreHandle,
|
|
50
54
|
type Trellis,
|
|
51
55
|
TrellisService,
|
package/src/service/node.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
export {
|
|
3
3
|
type BoundTrellisService,
|
|
4
|
+
type FeedHandler,
|
|
5
|
+
type HealthCheckHandler,
|
|
6
|
+
type HealthInfoHandler,
|
|
4
7
|
type JobArgs,
|
|
5
8
|
type JobHandler,
|
|
6
9
|
type JobQueue,
|
|
@@ -10,6 +13,7 @@ export {
|
|
|
10
13
|
type OperationRegistration,
|
|
11
14
|
type RpcHandler,
|
|
12
15
|
type ServiceContract,
|
|
16
|
+
type ServiceEventHandler,
|
|
13
17
|
type Trellis,
|
|
14
18
|
TrellisService,
|
|
15
19
|
type TrellisServiceConnectOpts,
|