@lifesi/genesis 0.1.1 → 0.1.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/dist/beacons.d.ts +46 -0
- package/dist/beacons.js +20 -0
- package/dist/client.d.ts +6563 -1625
- package/dist/client.js +53 -4
- package/dist/dials.d.ts +171 -1
- package/dist/dials.js +40 -0
- package/dist/fleets.d.ts +53 -1
- package/dist/fleets.js +35 -1
- package/dist/flocks.d.ts +73 -0
- package/dist/flocks.js +22 -0
- package/dist/generated/operations.d.ts +6563 -1625
- package/dist/generated/operations.js +7845 -1643
- package/dist/generated/schema.d.ts +14787 -5723
- package/dist/genesis.d.ts +689 -13
- package/dist/genesis.js +17 -0
- package/dist/genesis.openapi.json +20300 -7386
- package/dist/hives-cells.d.ts +127 -0
- package/dist/hives-cells.js +151 -0
- package/dist/hives-environment.d.ts +28 -0
- package/dist/hives-environment.js +58 -0
- package/dist/hives-node.js +2 -0
- package/dist/hives-operations.d.ts +304 -0
- package/dist/hives-operations.js +39 -0
- package/dist/hives-queues.d.ts +121 -0
- package/dist/hives-queues.js +106 -0
- package/dist/hives-resources-transport.d.ts +18 -0
- package/dist/hives-resources-transport.js +165 -0
- package/dist/hives-runtimes.d.ts +34 -0
- package/dist/hives-runtimes.js +32 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +3 -0
- package/dist/runner-grant.d.ts +10 -0
- package/dist/runner-grant.js +133 -0
- package/dist/runner.d.ts +16 -0
- package/dist/runner.js +4 -0
- package/package.json +6 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { OperationInput as In } from './types.js';
|
|
3
|
+
/** The original Hives scheduler, settings and measured activity use the same gateway and identity. */
|
|
4
|
+
export declare function hivesOperations(client: GenesisClient): {
|
|
5
|
+
cells: {
|
|
6
|
+
list(project: string, query?: {
|
|
7
|
+
page?: number;
|
|
8
|
+
per_page?: number;
|
|
9
|
+
}, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucketList>;
|
|
10
|
+
get(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucket>;
|
|
11
|
+
create(project: string, body: import("./hives-cells.js").HivesCreateBucket, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesBucket>;
|
|
12
|
+
remove(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
13
|
+
id: string;
|
|
14
|
+
success: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
reconcile(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
18
|
+
bucket: import("./hives-cells.js").HivesBucket;
|
|
19
|
+
outcome: string;
|
|
20
|
+
}>;
|
|
21
|
+
cors: {
|
|
22
|
+
get: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-cells.js").HivesCorsRule[]>;
|
|
23
|
+
set: (project: string, id: string, rules: import("./hives-cells.js").HivesCorsRule[], options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-cells.js").HivesCorsRule[]>;
|
|
24
|
+
};
|
|
25
|
+
objects: {
|
|
26
|
+
list(project: string, id: string, query?: {
|
|
27
|
+
prefix?: string;
|
|
28
|
+
delimiter?: string;
|
|
29
|
+
continuation_token?: string;
|
|
30
|
+
max_keys?: number;
|
|
31
|
+
}, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesObjectList>;
|
|
32
|
+
put(project: string, id: string, key: string, bytes: Blob | ArrayBuffer | ArrayBufferView, options?: import("./hives-resources-transport.js").HivesResourceOptions & {
|
|
33
|
+
content_type?: string;
|
|
34
|
+
}): Promise<import("./hives-cells.js").HivesObjectAcknowledgement>;
|
|
35
|
+
remove: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<void>;
|
|
36
|
+
download: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<Response>;
|
|
37
|
+
putFlat(project: string, id: string, key: string, bytes: Blob | ArrayBuffer | ArrayBufferView, options?: import("./hives-resources-transport.js").HivesResourceOptions & {
|
|
38
|
+
content_type?: string;
|
|
39
|
+
}): Promise<import("./hives-cells.js").HivesObjectAcknowledgement>;
|
|
40
|
+
removeFlat: (project: string, id: string, key: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
presign(project: string, id: string, body: import("./hives-cells.js").HivesPresign, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-cells.js").HivesPresignedUrl>;
|
|
43
|
+
};
|
|
44
|
+
queues: {
|
|
45
|
+
list(project: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
46
|
+
data: import("./hives-queues.js").HivesQueue[];
|
|
47
|
+
engine_available: true;
|
|
48
|
+
}>;
|
|
49
|
+
get(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
50
|
+
create(project: string, body: import("./hives-queues.js").HivesQueueCreate, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
51
|
+
configure(project: string, id: string, body: import("./hives-queues.js").HivesQueueConfig, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
52
|
+
remove(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
53
|
+
deleted: true;
|
|
54
|
+
}>;
|
|
55
|
+
stats(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
56
|
+
consumers: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<never>;
|
|
57
|
+
pause(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
58
|
+
resume(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<import("./hives-queues.js").HivesQueue>;
|
|
59
|
+
purge(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
60
|
+
purged: number;
|
|
61
|
+
}>;
|
|
62
|
+
send(project: string, id: string, body: import("./hives-queues.js").HivesQueueSend, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
63
|
+
message_id: string;
|
|
64
|
+
}>;
|
|
65
|
+
receive(project: string, id: string, body?: {
|
|
66
|
+
maxMessages?: number;
|
|
67
|
+
waitSeconds?: number;
|
|
68
|
+
}, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
69
|
+
messages: import("./hives-queues.js").HivesQueueDelivery[];
|
|
70
|
+
}>;
|
|
71
|
+
ack: (project: string, id: string, message: string, receipt: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
|
|
72
|
+
acknowledged: boolean;
|
|
73
|
+
released: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
nack: (project: string, id: string, message: string, receipt: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
|
|
76
|
+
acknowledged: boolean;
|
|
77
|
+
released: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
deadLetters: (project: string, id: string, query?: {
|
|
80
|
+
limit?: number;
|
|
81
|
+
offset?: number;
|
|
82
|
+
}, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
|
|
83
|
+
messages: import("./hives-queues.js").HivesDeadLetter[];
|
|
84
|
+
}>;
|
|
85
|
+
deadLetterStats: (project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-queues.js").HivesDeadLetterStats>;
|
|
86
|
+
replay(project: string, id: string, message: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
87
|
+
message_id: string;
|
|
88
|
+
replayed: 1;
|
|
89
|
+
}>;
|
|
90
|
+
deleteDeadLetter(project: string, id: string, message: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
91
|
+
deleted: true;
|
|
92
|
+
}>;
|
|
93
|
+
purgeDeadLetters(project: string, id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions): Promise<{
|
|
94
|
+
purged: number;
|
|
95
|
+
}>;
|
|
96
|
+
};
|
|
97
|
+
runtimes: {
|
|
98
|
+
list: (options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
|
|
99
|
+
runtimes: import("./hives-runtimes.js").HivesRuntime[];
|
|
100
|
+
}>;
|
|
101
|
+
project: (project_id: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<{
|
|
102
|
+
runtimes: import("./hives-runtimes.js").HivesRuntime[];
|
|
103
|
+
}>;
|
|
104
|
+
get: (name: string, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-runtimes.js").HivesRuntime>;
|
|
105
|
+
select: (input: {
|
|
106
|
+
wasi: string;
|
|
107
|
+
runner: string;
|
|
108
|
+
artifact: string;
|
|
109
|
+
}, options?: import("./hives-resources-transport.js").HivesResourceOptions) => Promise<import("./hives-runtimes.js").HivesRuntimeSelection>;
|
|
110
|
+
};
|
|
111
|
+
settings: {
|
|
112
|
+
get: (project_id: string) => Promise<{
|
|
113
|
+
autoDeployEnabled: boolean;
|
|
114
|
+
buildCommand?: string | null;
|
|
115
|
+
defaultRegion: string;
|
|
116
|
+
installCommand?: string | null;
|
|
117
|
+
outputDirectory?: string | null;
|
|
118
|
+
previewDeploymentsEnabled: boolean;
|
|
119
|
+
} & {
|
|
120
|
+
capabilities: import("./index.js").components["schemas"]["Hives.ProjectSettingsCapabilities"];
|
|
121
|
+
effective: import("./index.js").components["schemas"]["Hives.EffectiveProjectSettings"];
|
|
122
|
+
}>;
|
|
123
|
+
update: (project_id: string, body: In<"hives_update_project_settings">["body"]) => Promise<{
|
|
124
|
+
autoDeployEnabled: boolean;
|
|
125
|
+
buildCommand?: string | null;
|
|
126
|
+
defaultRegion: string;
|
|
127
|
+
installCommand?: string | null;
|
|
128
|
+
outputDirectory?: string | null;
|
|
129
|
+
previewDeploymentsEnabled: boolean;
|
|
130
|
+
} & {
|
|
131
|
+
capabilities: import("./index.js").components["schemas"]["Hives.ProjectSettingsCapabilities"];
|
|
132
|
+
effective: import("./index.js").components["schemas"]["Hives.EffectiveProjectSettings"];
|
|
133
|
+
}>;
|
|
134
|
+
};
|
|
135
|
+
crons: {
|
|
136
|
+
list: (project_id: string, q?: Omit<In<"hives_list_crons">, "project_id">) => Promise<Record<string, never>>;
|
|
137
|
+
get: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
|
|
138
|
+
create: (project_id: string, body: In<"hives_create_cron">["body"]) => Promise<Record<string, never>>;
|
|
139
|
+
update: (project_id: string, cron_id: string, body: In<"hives_update_cron">["body"]) => Promise<Record<string, never>>;
|
|
140
|
+
delete: (project_id: string, cron_id: string) => Promise<{
|
|
141
|
+
id: string;
|
|
142
|
+
message: string;
|
|
143
|
+
success: boolean;
|
|
144
|
+
}>;
|
|
145
|
+
pause: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
|
|
146
|
+
resume: (project_id: string, cron_id: string) => Promise<Record<string, never>>;
|
|
147
|
+
/** Admission returns a persisted run ID; read history to learn its actual outcome. No retry. */
|
|
148
|
+
trigger: (project_id: string, cron_id: string) => Promise<unknown>;
|
|
149
|
+
runs: (project_id: string, cron_id: string, q?: Omit<In<"hives_get_cron_runs">, "project_id" | "cron_id">) => Promise<{
|
|
150
|
+
data: {
|
|
151
|
+
duration_ms?: number | null;
|
|
152
|
+
ended_at?: string | null;
|
|
153
|
+
error?: string | null;
|
|
154
|
+
id: string;
|
|
155
|
+
logs_url?: string | null;
|
|
156
|
+
started_at: string;
|
|
157
|
+
status: string;
|
|
158
|
+
}[];
|
|
159
|
+
pagination: import("./index.js").components["schemas"]["Hives.PaginationMeta"];
|
|
160
|
+
}>;
|
|
161
|
+
};
|
|
162
|
+
metrics: {
|
|
163
|
+
project: (project_id: string, q?: Omit<In<"hives_get_project_metrics">, "project_id">) => Promise<{
|
|
164
|
+
active_deployments: number;
|
|
165
|
+
avg_api_http_duration_ms?: number | null;
|
|
166
|
+
avg_response_time_ms?: number | null;
|
|
167
|
+
cron_executions?: number | null;
|
|
168
|
+
data_transfer_bytes: number;
|
|
169
|
+
error_count: number;
|
|
170
|
+
error_rate?: number | null;
|
|
171
|
+
function_invocations: number;
|
|
172
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
173
|
+
observed_request_payload_bytes: number;
|
|
174
|
+
observed_response_payload_bytes: number;
|
|
175
|
+
p95_response_time_ms?: number | null;
|
|
176
|
+
p99_response_time_ms?: number | null;
|
|
177
|
+
project_id: string;
|
|
178
|
+
storage_bytes?: number | null;
|
|
179
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
180
|
+
total_requests: number;
|
|
181
|
+
unique_visitors?: number | null;
|
|
182
|
+
}>;
|
|
183
|
+
dashboard: (project_id: string, q?: Omit<In<"hives_get_dashboard_metrics">, "project_id">) => Promise<{
|
|
184
|
+
activeDeployments: number;
|
|
185
|
+
avgApiHttpDurationMs?: number | null;
|
|
186
|
+
avgLatencyMs?: number | null;
|
|
187
|
+
deploymentsChange?: number | null;
|
|
188
|
+
errorRate?: number | null;
|
|
189
|
+
errorRateChange?: number | null;
|
|
190
|
+
errorTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
191
|
+
latencyChange?: number | null;
|
|
192
|
+
latencyTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
193
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
194
|
+
observedRequestPayloadBytes: number;
|
|
195
|
+
observedResponsePayloadBytes: number;
|
|
196
|
+
requestsChange?: number | null;
|
|
197
|
+
requestsTimeSeries: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
198
|
+
totalRequests: number;
|
|
199
|
+
}>;
|
|
200
|
+
requests: (project_id: string, q?: Omit<In<"hives_get_request_metrics">, "project_id">) => Promise<{
|
|
201
|
+
aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
|
|
202
|
+
data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
203
|
+
name: string;
|
|
204
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
205
|
+
resolution_seconds: number;
|
|
206
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
207
|
+
}>;
|
|
208
|
+
latency: (project_id: string, q?: Omit<In<"hives_get_latency_metrics">, "project_id">) => Promise<{
|
|
209
|
+
aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
|
|
210
|
+
data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
211
|
+
name: string;
|
|
212
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
213
|
+
resolution_seconds: number;
|
|
214
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
215
|
+
}>;
|
|
216
|
+
errors: (project_id: string, q?: Omit<In<"hives_get_error_metrics">, "project_id">) => Promise<{
|
|
217
|
+
aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
|
|
218
|
+
data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
219
|
+
name: string;
|
|
220
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
221
|
+
resolution_seconds: number;
|
|
222
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
223
|
+
}>;
|
|
224
|
+
function: (project_id: string, function_id: string, q?: Omit<In<"hives_get_function_metrics">, "project_id" | "function_id">) => Promise<{
|
|
225
|
+
avg_api_http_duration_ms?: number | null;
|
|
226
|
+
avg_duration_ms?: number | null;
|
|
227
|
+
billed_gb_seconds?: number | null;
|
|
228
|
+
cold_starts?: number | null;
|
|
229
|
+
configured_memory_limit_mb: number;
|
|
230
|
+
failed_invocations: number;
|
|
231
|
+
function_id: string;
|
|
232
|
+
function_name: string;
|
|
233
|
+
memory_mb?: number | null;
|
|
234
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
235
|
+
observed_request_payload_bytes: number;
|
|
236
|
+
observed_response_payload_bytes: number;
|
|
237
|
+
p50_duration_ms?: number | null;
|
|
238
|
+
p95_duration_ms?: number | null;
|
|
239
|
+
p99_duration_ms?: number | null;
|
|
240
|
+
success_rate?: number | null;
|
|
241
|
+
successful_invocations: number;
|
|
242
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
243
|
+
timeouts?: number | null;
|
|
244
|
+
total_invocations: number;
|
|
245
|
+
}>;
|
|
246
|
+
invocations: (project_id: string, function_id: string, q?: Omit<In<"hives_get_function_invocations_series">, "project_id" | "function_id">) => Promise<{
|
|
247
|
+
aggregation: import("./index.js").components["schemas"]["Hives.MetricAggregation"];
|
|
248
|
+
data: import("./index.js").components["schemas"]["Hives.MetricDataPoint"][];
|
|
249
|
+
name: string;
|
|
250
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
251
|
+
resolution_seconds: number;
|
|
252
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
253
|
+
}>;
|
|
254
|
+
deployment: (project_id: string, deployment_id: string, q?: Omit<In<"hives_get_deployment_metrics">, "project_id" | "deployment_id">) => Promise<{
|
|
255
|
+
active_instances?: number | null;
|
|
256
|
+
avg_api_http_duration_ms?: number | null;
|
|
257
|
+
avg_cpu_percent?: number | null;
|
|
258
|
+
avg_memory_mb?: number | null;
|
|
259
|
+
avg_response_time_ms?: number | null;
|
|
260
|
+
deployment_id: string;
|
|
261
|
+
error_count: number;
|
|
262
|
+
error_rate?: number | null;
|
|
263
|
+
max_instances?: number | null;
|
|
264
|
+
min_instances?: number | null;
|
|
265
|
+
network_in_bytes?: number | null;
|
|
266
|
+
network_out_bytes?: number | null;
|
|
267
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
268
|
+
observed_request_payload_bytes: number;
|
|
269
|
+
observed_response_payload_bytes: number;
|
|
270
|
+
p95_response_time_ms?: number | null;
|
|
271
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
272
|
+
total_requests: number;
|
|
273
|
+
}>;
|
|
274
|
+
resources: (project_id: string, q?: Omit<In<"hives_get_resource_usage">, "project_id">) => Promise<{
|
|
275
|
+
active_deployments: number;
|
|
276
|
+
avg_api_http_duration_ms?: number | null;
|
|
277
|
+
bandwidth_gb?: number | null;
|
|
278
|
+
build_minutes?: number | null;
|
|
279
|
+
compute_gb_seconds?: number | null;
|
|
280
|
+
custom_domains: number;
|
|
281
|
+
function_invocations: number;
|
|
282
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
283
|
+
observed_request_payload_bytes: number;
|
|
284
|
+
observed_response_payload_bytes: number;
|
|
285
|
+
scheduled_jobs: number;
|
|
286
|
+
ssl_certificates: number;
|
|
287
|
+
storage_gb?: number | null;
|
|
288
|
+
time_range: import("./index.js").components["schemas"]["Hives.TimeRange"];
|
|
289
|
+
}>;
|
|
290
|
+
realtime: (project_id: string) => Promise<{
|
|
291
|
+
active_connections?: number | null;
|
|
292
|
+
avg_api_http_duration_ms?: number | null;
|
|
293
|
+
avg_response_time_ms?: number | null;
|
|
294
|
+
cpu_percent?: number | null;
|
|
295
|
+
error_rate?: number | null;
|
|
296
|
+
memory_percent?: number | null;
|
|
297
|
+
observation: import("./index.js").components["schemas"]["Hives.ObservationScope"];
|
|
298
|
+
observed_request_payload_bytes: number;
|
|
299
|
+
observed_response_payload_bytes: number;
|
|
300
|
+
requests_per_second: number;
|
|
301
|
+
updated_at: string;
|
|
302
|
+
}>;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hivesCells } from './hives-cells.js';
|
|
2
|
+
import { hivesQueues } from './hives-queues.js';
|
|
3
|
+
import { hivesRuntimes } from './hives-runtimes.js';
|
|
4
|
+
/** The original Hives scheduler, settings and measured activity use the same gateway and identity. */
|
|
5
|
+
export function hivesOperations(client) {
|
|
6
|
+
return {
|
|
7
|
+
cells: hivesCells(client),
|
|
8
|
+
queues: hivesQueues(client),
|
|
9
|
+
runtimes: hivesRuntimes(client),
|
|
10
|
+
settings: {
|
|
11
|
+
get: (project_id) => client.request('hives_get_project_settings', { project_id }),
|
|
12
|
+
update: (project_id, body) => client.request('hives_update_project_settings', { project_id, body }),
|
|
13
|
+
},
|
|
14
|
+
crons: {
|
|
15
|
+
list: (project_id, q = {}) => client.request('hives_list_crons', { ...q, project_id }),
|
|
16
|
+
get: (project_id, cron_id) => client.request('hives_get_cron', { project_id, cron_id }),
|
|
17
|
+
create: (project_id, body) => client.request('hives_create_cron', { project_id, body }),
|
|
18
|
+
update: (project_id, cron_id, body) => client.request('hives_update_cron', { project_id, cron_id, body }),
|
|
19
|
+
delete: (project_id, cron_id) => client.request('hives_delete_cron', { project_id, cron_id }),
|
|
20
|
+
pause: (project_id, cron_id) => client.request('hives_pause_cron', { project_id, cron_id }),
|
|
21
|
+
resume: (project_id, cron_id) => client.request('hives_resume_cron', { project_id, cron_id }),
|
|
22
|
+
/** Admission returns a persisted run ID; read history to learn its actual outcome. No retry. */
|
|
23
|
+
trigger: (project_id, cron_id) => client.request('hives_trigger_cron', { project_id, cron_id }),
|
|
24
|
+
runs: (project_id, cron_id, q = {}) => client.request('hives_get_cron_runs', { ...q, project_id, cron_id }),
|
|
25
|
+
},
|
|
26
|
+
metrics: {
|
|
27
|
+
project: (project_id, q = {}) => client.request('hives_get_project_metrics', { ...q, project_id }),
|
|
28
|
+
dashboard: (project_id, q = {}) => client.request('hives_get_dashboard_metrics', { ...q, project_id }),
|
|
29
|
+
requests: (project_id, q = {}) => client.request('hives_get_request_metrics', { ...q, project_id }),
|
|
30
|
+
latency: (project_id, q = {}) => client.request('hives_get_latency_metrics', { ...q, project_id }),
|
|
31
|
+
errors: (project_id, q = {}) => client.request('hives_get_error_metrics', { ...q, project_id }),
|
|
32
|
+
function: (project_id, function_id, q = {}) => client.request('hives_get_function_metrics', { ...q, project_id, function_id }),
|
|
33
|
+
invocations: (project_id, function_id, q = {}) => client.request('hives_get_function_invocations_series', { ...q, project_id, function_id }),
|
|
34
|
+
deployment: (project_id, deployment_id, q = {}) => client.request('hives_get_deployment_metrics', { ...q, project_id, deployment_id }),
|
|
35
|
+
resources: (project_id, q = {}) => client.request('hives_get_resource_usage', { ...q, project_id }),
|
|
36
|
+
realtime: (project_id) => client.request('hives_get_realtime_metrics', { project_id }),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import { type HivesResourceOptions } from './hives-resources-transport.js';
|
|
3
|
+
export interface HivesQueueConfig {
|
|
4
|
+
retentionPeriod: number;
|
|
5
|
+
visibilityTimeout: number;
|
|
6
|
+
maxReceiveCount: number;
|
|
7
|
+
deadLetterQueueId?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface HivesQueue extends HivesQueueConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: 'standard' | 'dead_letter' | 'fifo';
|
|
14
|
+
status: 'active' | 'paused';
|
|
15
|
+
deliveryAvailable: boolean;
|
|
16
|
+
maxMessageSize: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
messageCount: number;
|
|
20
|
+
messagesProcessing: number;
|
|
21
|
+
delayedMessages: number;
|
|
22
|
+
retainedMessages: number;
|
|
23
|
+
retainedPayloadBytes: number;
|
|
24
|
+
consumerCount: null;
|
|
25
|
+
throughputPerSecond: null;
|
|
26
|
+
avgProcessingTimeMs: null;
|
|
27
|
+
}
|
|
28
|
+
export interface HivesQueueCreate {
|
|
29
|
+
name: string;
|
|
30
|
+
type?: 'standard' | 'dead_letter';
|
|
31
|
+
retentionPeriod?: number;
|
|
32
|
+
visibilityTimeout?: number;
|
|
33
|
+
maxReceiveCount?: number;
|
|
34
|
+
deadLetterQueueId?: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface HivesQueueSend {
|
|
37
|
+
body?: unknown;
|
|
38
|
+
body_base64?: string;
|
|
39
|
+
attributes?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
export interface HivesQueueDelivery {
|
|
42
|
+
id: string;
|
|
43
|
+
body_base64: string;
|
|
44
|
+
attributes: Record<string, string>;
|
|
45
|
+
receive_count: number;
|
|
46
|
+
receipt_handle: string;
|
|
47
|
+
lease_expires_at: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
}
|
|
50
|
+
export interface HivesDeadLetter {
|
|
51
|
+
id: string;
|
|
52
|
+
queue_id: string;
|
|
53
|
+
original_queue_id: string | null;
|
|
54
|
+
original_message_id: string | null;
|
|
55
|
+
body_base64: string;
|
|
56
|
+
attributes: Record<string, string>;
|
|
57
|
+
receive_count: number;
|
|
58
|
+
reason: string | null;
|
|
59
|
+
moved_at: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface HivesDeadLetterStats {
|
|
62
|
+
total_messages: number;
|
|
63
|
+
oldest_message_at: string | null;
|
|
64
|
+
newest_message_at: string | null;
|
|
65
|
+
average_receive_count: number | null;
|
|
66
|
+
retained_payload_bytes: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function hivesQueueBody(encoded: string): Uint8Array;
|
|
69
|
+
export declare function hivesQueues(client: GenesisClient): {
|
|
70
|
+
list(project: string, options?: HivesResourceOptions): Promise<{
|
|
71
|
+
data: HivesQueue[];
|
|
72
|
+
engine_available: true;
|
|
73
|
+
}>;
|
|
74
|
+
get(project: string, id: string, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
75
|
+
create(project: string, body: HivesQueueCreate, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
76
|
+
configure(project: string, id: string, body: HivesQueueConfig, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
77
|
+
remove(project: string, id: string, options?: HivesResourceOptions): Promise<{
|
|
78
|
+
deleted: true;
|
|
79
|
+
}>;
|
|
80
|
+
stats(project: string, id: string, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
81
|
+
consumers: (project: string, id: string, options?: HivesResourceOptions) => Promise<never>;
|
|
82
|
+
pause(project: string, id: string, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
83
|
+
resume(project: string, id: string, options?: HivesResourceOptions): Promise<HivesQueue>;
|
|
84
|
+
purge(project: string, id: string, options?: HivesResourceOptions): Promise<{
|
|
85
|
+
purged: number;
|
|
86
|
+
}>;
|
|
87
|
+
send(project: string, id: string, body: HivesQueueSend, options?: HivesResourceOptions): Promise<{
|
|
88
|
+
message_id: string;
|
|
89
|
+
}>;
|
|
90
|
+
receive(project: string, id: string, body?: {
|
|
91
|
+
maxMessages?: number;
|
|
92
|
+
waitSeconds?: number;
|
|
93
|
+
}, options?: HivesResourceOptions): Promise<{
|
|
94
|
+
messages: HivesQueueDelivery[];
|
|
95
|
+
}>;
|
|
96
|
+
ack: (project: string, id: string, message: string, receipt: string, options?: HivesResourceOptions) => Promise<{
|
|
97
|
+
acknowledged: boolean;
|
|
98
|
+
released: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
nack: (project: string, id: string, message: string, receipt: string, options?: HivesResourceOptions) => Promise<{
|
|
101
|
+
acknowledged: boolean;
|
|
102
|
+
released: boolean;
|
|
103
|
+
}>;
|
|
104
|
+
deadLetters: (project: string, id: string, query?: {
|
|
105
|
+
limit?: number;
|
|
106
|
+
offset?: number;
|
|
107
|
+
}, options?: HivesResourceOptions) => Promise<{
|
|
108
|
+
messages: HivesDeadLetter[];
|
|
109
|
+
}>;
|
|
110
|
+
deadLetterStats: (project: string, id: string, options?: HivesResourceOptions) => Promise<HivesDeadLetterStats>;
|
|
111
|
+
replay(project: string, id: string, message: string, options?: HivesResourceOptions): Promise<{
|
|
112
|
+
message_id: string;
|
|
113
|
+
replayed: 1;
|
|
114
|
+
}>;
|
|
115
|
+
deleteDeadLetter(project: string, id: string, message: string, options?: HivesResourceOptions): Promise<{
|
|
116
|
+
deleted: true;
|
|
117
|
+
}>;
|
|
118
|
+
purgeDeadLetters(project: string, id: string, options?: HivesResourceOptions): Promise<{
|
|
119
|
+
purged: number;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { HIVES_QUEUE_BYTES, hivesResourceCall, hivesResourceId, resourceError } from './hives-resources-transport.js';
|
|
2
|
+
export function hivesQueueBody(encoded) {
|
|
3
|
+
if (typeof encoded !== 'string' || encoded.length > Math.ceil(HIVES_QUEUE_BYTES / 3) * 4 || encoded.length % 4 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded))
|
|
4
|
+
throw resourceError(0);
|
|
5
|
+
try {
|
|
6
|
+
const bytes = atob(encoded);
|
|
7
|
+
if (btoa(bytes) !== encoded || bytes.length > HIVES_QUEUE_BYTES)
|
|
8
|
+
throw resourceError(0);
|
|
9
|
+
return Uint8Array.from(bytes, c => c.charCodeAt(0));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
throw resourceError(0);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function config(body, required = false) {
|
|
16
|
+
const ranges = [{ key: 'retentionPeriod', min: 3600, max: 336 * 3600, divisor: 3600 }, { key: 'visibilityTimeout', min: 1, max: 43200 }, { key: 'maxReceiveCount', min: 1, max: 1000 }];
|
|
17
|
+
for (const r of ranges) {
|
|
18
|
+
const value = body[r.key];
|
|
19
|
+
if (value === undefined && !required)
|
|
20
|
+
continue;
|
|
21
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < r.min || value > r.max || r.divisor && value % r.divisor)
|
|
22
|
+
throw resourceError(0);
|
|
23
|
+
}
|
|
24
|
+
if (body.deadLetterQueueId != null)
|
|
25
|
+
hivesResourceId(body.deadLetterQueueId);
|
|
26
|
+
}
|
|
27
|
+
function queue(value, project, id) {
|
|
28
|
+
if (!value || value.projectId !== project || typeof value.id !== 'string' || id !== undefined && value.id !== id || !['standard', 'dead_letter', 'fifo'].includes(value.type) || !['active', 'paused'].includes(value.status) || typeof value.deliveryAvailable !== 'boolean' || value.type === 'fifo' && value.deliveryAvailable !== false)
|
|
29
|
+
throw resourceError(0);
|
|
30
|
+
const counts = [value.messageCount, value.messagesProcessing, value.delayedMessages, value.retainedMessages, value.retainedPayloadBytes];
|
|
31
|
+
if (counts.some(v => !Number.isSafeInteger(v) || v < 0) || value.consumerCount !== null || value.throughputPerSecond !== null || value.avgProcessingTimeMs !== null)
|
|
32
|
+
throw resourceError(0);
|
|
33
|
+
return Object.fromEntries(['id', 'projectId', 'name', 'type', 'status', 'deliveryAvailable', 'retentionPeriod', 'visibilityTimeout', 'maxReceiveCount', 'deadLetterQueueId', 'maxMessageSize', 'createdAt', 'updatedAt', 'messageCount', 'messagesProcessing', 'delayedMessages', 'retainedMessages', 'retainedPayloadBytes', 'consumerCount', 'throughputPerSecond', 'avgProcessingTimeMs'].map(k => [k, value[k]]));
|
|
34
|
+
}
|
|
35
|
+
function send(body) {
|
|
36
|
+
if (!body || typeof body !== 'object' || Object.keys(body).some(k => !['body', 'body_base64', 'attributes'].includes(k)) || (body.body != null) === (body.body_base64 != null))
|
|
37
|
+
throw resourceError(0);
|
|
38
|
+
if (body.body_base64 != null)
|
|
39
|
+
hivesQueueBody(body.body_base64);
|
|
40
|
+
else {
|
|
41
|
+
let value;
|
|
42
|
+
try {
|
|
43
|
+
value = typeof body.body === 'string' ? body.body : JSON.stringify(body.body);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
throw resourceError(0);
|
|
47
|
+
}
|
|
48
|
+
if (value === undefined || new TextEncoder().encode(value).length > HIVES_QUEUE_BYTES)
|
|
49
|
+
throw resourceError(0);
|
|
50
|
+
}
|
|
51
|
+
if (body.attributes !== undefined) {
|
|
52
|
+
if (!body.attributes || typeof body.attributes !== 'object' || Array.isArray(body.attributes) || Object.keys(body.attributes).length > 64 || Object.entries(body.attributes).some(([k, v]) => !k || new TextEncoder().encode(k).length > 128 || k.startsWith('buzz.') || typeof v !== 'string') || new TextEncoder().encode(JSON.stringify(body.attributes)).length > 8192)
|
|
53
|
+
throw resourceError(0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function hivesQueues(client) {
|
|
57
|
+
const ids = (project_id, queue_id) => ({ project_id: hivesResourceId(project_id), ...(queue_id === undefined ? {} : { queue_id: hivesResourceId(queue_id) }) });
|
|
58
|
+
const call = (operation, input, options, limit = 2 * 1024 * 1024) => hivesResourceCall(client, operation, input, options, 'json', limit, 20_000);
|
|
59
|
+
const ack = async (project, id, message, receipt, release, options) => {
|
|
60
|
+
if (typeof receipt !== 'string' || !/^rh_[a-f0-9]{32}$/.test(receipt))
|
|
61
|
+
throw resourceError(0);
|
|
62
|
+
const result = await call(release ? 'hives_nack_native_queue' : 'hives_ack_native_queue', { ...ids(project, id), message_id: hivesResourceId(message), body: { receiptHandle: receipt } }, options);
|
|
63
|
+
if (!result || result.acknowledged !== !release || result.released !== release)
|
|
64
|
+
throw resourceError(0);
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
async list(project, options) { const result = await call('hives_list_native_queue', ids(project), options); if (!result || !Array.isArray(result.data) || result.engine_available !== true)
|
|
69
|
+
throw resourceError(0); return { ...result, data: result.data.map(row => queue(row, project)) }; },
|
|
70
|
+
async get(project, id, options) { return queue(await call('hives_inspect_native_queue', ids(project, id), options), project, id); },
|
|
71
|
+
async create(project, body, options) { if (!body || !/^[A-Za-z0-9_-]{1,128}$/.test(body.name) || body.type !== undefined && !['standard', 'dead_letter'].includes(body.type) || Object.keys(body).some(k => !['name', 'type', 'retentionPeriod', 'visibilityTimeout', 'maxReceiveCount', 'deadLetterQueueId'].includes(k)))
|
|
72
|
+
throw resourceError(0); config(body); return queue(await call('hives_create_native_queue', { ...ids(project), body }, options), project); },
|
|
73
|
+
async configure(project, id, body, options) { if (!body || Object.keys(body).some(k => !['retentionPeriod', 'visibilityTimeout', 'maxReceiveCount', 'deadLetterQueueId'].includes(k)))
|
|
74
|
+
throw resourceError(0); config(body, true); return queue(await call('hives_configure_native_queue', { ...ids(project, id), body }, options), project, id); },
|
|
75
|
+
async remove(project, id, options) { const result = await call('hives_delete_native_queue', ids(project, id), options); if (result?.deleted !== true)
|
|
76
|
+
throw resourceError(0); return result; },
|
|
77
|
+
async stats(project, id, options) { return queue(await call('hives_stats_native_queue', ids(project, id), options), project, id); },
|
|
78
|
+
consumers: (project, id, options) => call('hives_consumers_native_queue', ids(project, id), options),
|
|
79
|
+
async pause(project, id, options) { return queue(await call('hives_pause_native_queue', ids(project, id), options), project, id); },
|
|
80
|
+
async resume(project, id, options) { return queue(await call('hives_resume_native_queue', ids(project, id), options), project, id); },
|
|
81
|
+
async purge(project, id, options) { const result = await call('hives_purge_native_queue', ids(project, id), options); if (!Number.isSafeInteger(result?.purged) || result.purged < 0)
|
|
82
|
+
throw resourceError(0); return result; },
|
|
83
|
+
async send(project, id, body, options) { send(body); const result = await call('hives_send_native_queue', { ...ids(project, id), body }, options); hivesResourceId(result?.message_id); return result; },
|
|
84
|
+
async receive(project, id, body = {}, options) { if (Object.keys(body).some(k => !['maxMessages', 'waitSeconds'].includes(k)) || body.maxMessages !== undefined && (!Number.isInteger(body.maxMessages) || body.maxMessages < 1 || body.maxMessages > 10) || body.waitSeconds !== undefined && (!Number.isInteger(body.waitSeconds) || body.waitSeconds < 0 || body.waitSeconds > 10))
|
|
85
|
+
throw resourceError(0); const result = await call('hives_receive_native_queue', { ...ids(project, id), body }, options, 4 * 1024 * 1024); if (!result || !Array.isArray(result.messages) || result.messages.length > (body.maxMessages ?? 1))
|
|
86
|
+
throw resourceError(0); for (const row of result.messages) {
|
|
87
|
+
hivesResourceId(row.id);
|
|
88
|
+
hivesQueueBody(row.body_base64);
|
|
89
|
+
if (!/^rh_[a-f0-9]{32}$/.test(row.receipt_handle))
|
|
90
|
+
throw resourceError(0);
|
|
91
|
+
} return result; },
|
|
92
|
+
ack: (project, id, message, receipt, options) => ack(project, id, message, receipt, false, options),
|
|
93
|
+
nack: (project, id, message, receipt, options) => ack(project, id, message, receipt, true, options),
|
|
94
|
+
deadLetters: async (project, id, query = {}, options) => { if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 10) || query.offset !== undefined && (!Number.isInteger(query.offset) || query.offset < 0 || query.offset > 8192))
|
|
95
|
+
throw resourceError(0); const result = await call('hives_dead_letters_native_queue', { ...query, ...ids(project, id) }, options, 4 * 1024 * 1024); if (!result || !Array.isArray(result.messages) || result.messages.length > (query.limit ?? 10))
|
|
96
|
+
throw resourceError(0); for (const row of result.messages)
|
|
97
|
+
hivesQueueBody(row.body_base64); return result; },
|
|
98
|
+
deadLetterStats: (project, id, options) => call('hives_dlq_stats_native_queue', ids(project, id), options),
|
|
99
|
+
async replay(project, id, message, options) { const result = await call('hives_replay_native_queue', { ...ids(project, id), body: { message_id: hivesResourceId(message) } }, options); if (result?.replayed !== 1)
|
|
100
|
+
throw resourceError(0); hivesResourceId(result.message_id); return result; },
|
|
101
|
+
async deleteDeadLetter(project, id, message, options) { const result = await call('hives_delete_dlq_native_queue', { ...ids(project, id), message_id: hivesResourceId(message) }, options); if (result?.deleted !== true)
|
|
102
|
+
throw resourceError(0); return result; },
|
|
103
|
+
async purgeDeadLetters(project, id, options) { const result = await call('hives_purge_dlq_native_queue', ids(project, id), options); if (!Number.isSafeInteger(result?.purged) || result.purged < 0)
|
|
104
|
+
throw resourceError(0); return result; },
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import { GenesisError } from './errors.js';
|
|
3
|
+
export declare const HIVES_OBJECT_BYTES: number;
|
|
4
|
+
export declare const HIVES_QUEUE_BYTES: number;
|
|
5
|
+
export declare const HIVES_RESOURCE_JSON_BYTES: number;
|
|
6
|
+
export interface HivesResourceOptions {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export declare function hivesResourceId(value: string): string;
|
|
10
|
+
export declare function resourceError(status: number, id?: string): GenesisError;
|
|
11
|
+
export declare const isHivesResourceOperation: (id: string) => boolean;
|
|
12
|
+
export declare const isHivesObjectUpload: (id: string) => id is "hives_upload_object_by_key" | "hives_upload_object";
|
|
13
|
+
/** Shared-client hook proposal: snapshot only the two real raw Cells upload operations. */
|
|
14
|
+
export declare function hivesObjectBody(value: unknown): Promise<ArrayBuffer>;
|
|
15
|
+
export declare function hivesContentType(value?: string): string;
|
|
16
|
+
export declare function hivesResourceBytes(response: Response, limit: number, signal?: AbortSignal): Promise<Uint8Array>;
|
|
17
|
+
/** Whole operation budget includes credential/fetch and incremental body read. No retries or redirects. */
|
|
18
|
+
export declare function hivesResourceCall<T>(client: GenesisClient, id: string, input: Record<string, unknown>, options?: HivesResourceOptions, mode?: 'json' | 'empty' | 'binary', limit?: number, budget?: number): Promise<T>;
|