@lifesi/genesis 0.1.1 → 0.1.3
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 +7669 -1635
- package/dist/client.js +54 -5
- package/dist/dials.d.ts +171 -1
- package/dist/dials.js +40 -0
- package/dist/fleets.d.ts +109 -1
- package/dist/fleets.js +89 -1
- package/dist/flocks.d.ts +73 -0
- package/dist/flocks.js +22 -0
- package/dist/generated/operations.d.ts +7669 -1635
- package/dist/generated/operations.js +9193 -1691
- package/dist/generated/schema.d.ts +16979 -5698
- package/dist/genesis.d.ts +795 -13
- package/dist/genesis.js +21 -0
- package/dist/genesis.openapi.json +23483 -7599
- package/dist/henry.d.ts +7 -0
- package/dist/henry.js +23 -0
- 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-functions.d.ts +1 -1
- package/dist/hives-functions.js +3 -1
- package/dist/hives-marketplace.d.ts +128 -0
- package/dist/hives-marketplace.js +187 -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/hives-volumes.d.ts +64 -0
- package/dist/hives-volumes.js +117 -0
- package/dist/index.d.ts +8 -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,187 @@
|
|
|
1
|
+
import { hivesResourceCall, hivesResourceId, resourceError } from './hives-resources-transport.js';
|
|
2
|
+
function invalid() { throw resourceError(0); }
|
|
3
|
+
function record(value) { if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
4
|
+
invalid(); return value; }
|
|
5
|
+
function keys(value, allowed) { if (Object.keys(value).some(key => !allowed.includes(key)))
|
|
6
|
+
invalid(); }
|
|
7
|
+
function text(value, max) { if (typeof value !== 'string' || new TextEncoder().encode(value).length > max)
|
|
8
|
+
invalid(); return value; }
|
|
9
|
+
function uuid(value) { const result = text(value, 36); if (!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(result))
|
|
10
|
+
invalid(); return result.toLowerCase(); }
|
|
11
|
+
function slug(value) { const result = text(value, 64); if (!/^[a-z][a-z0-9-]*[a-z0-9]$/.test(result))
|
|
12
|
+
invalid(); return result; }
|
|
13
|
+
function semver(value, maxCore = 18446744073709551615n) {
|
|
14
|
+
const result = text(value, 64);
|
|
15
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(result);
|
|
16
|
+
if (!match || match.slice(1, 4).some(part => BigInt(part) > maxCore)
|
|
17
|
+
|| match[4]?.split('.').some(part => /^\d+$/.test(part) && part.length > 1 && part.startsWith('0')))
|
|
18
|
+
invalid();
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function count(value, min = 0, max = Number.MAX_SAFE_INTEGER) { if (!Number.isSafeInteger(value) || value < min || value > max)
|
|
22
|
+
invalid(); return value; }
|
|
23
|
+
function bool(value) { if (typeof value !== 'boolean')
|
|
24
|
+
invalid(); return value; }
|
|
25
|
+
function strings(value, limit, max) { if (!Array.isArray(value) || value.length > limit)
|
|
26
|
+
invalid(); return value.map(item => text(item, max)); }
|
|
27
|
+
function date(value) { const result = text(value, 64); if (!Number.isFinite(Date.parse(result)))
|
|
28
|
+
invalid(); return result; }
|
|
29
|
+
function nullable(value, parse) { return value === null ? null : parse(value); }
|
|
30
|
+
function deployment(value) { const id = text(value, 64); if (!/^dpl_[A-Za-z0-9_-]+$/.test(id))
|
|
31
|
+
invalid(); return id; }
|
|
32
|
+
function packageRow(value) {
|
|
33
|
+
const r = record(value);
|
|
34
|
+
if (!['public', 'private', 'unlisted'].includes(String(r.visibility)) || r.visibility === 'private' && r.owned !== true)
|
|
35
|
+
invalid();
|
|
36
|
+
return { id: uuid(r.id), slug: slug(r.slug), name: text(r.name, 128), description: text(r.description, 500), author_name: text(r.author_name, 1000),
|
|
37
|
+
visibility: r.visibility, categories: strings(r.categories, 5, 64), keywords: strings(r.keywords, 20, 64), license: text(r.license, 64),
|
|
38
|
+
installs: count(r.installs), stars: count(r.stars), verified: bool(r.verified), featured: bool(r.featured), free: bool(r.free),
|
|
39
|
+
latest_version: semver(r.latest_version), version_count: count(r.version_count, 1), owned: bool(r.owned), created_at: date(r.created_at), updated_at: date(r.updated_at) };
|
|
40
|
+
}
|
|
41
|
+
function versionRow(value, expectedPackage) {
|
|
42
|
+
const r = record(value);
|
|
43
|
+
const packageId = uuid(r.package_id);
|
|
44
|
+
const hash = text(r.module_hash, 64);
|
|
45
|
+
if (expectedPackage && packageId !== expectedPackage || !/^[a-f0-9]{64}$/.test(hash))
|
|
46
|
+
invalid();
|
|
47
|
+
return { id: uuid(r.id), package_id: packageId, version: semver(r.version), module_hash: hash, size_bytes: count(r.size_bytes, 1, 10 * 1024 * 1024),
|
|
48
|
+
readme: text(r.readme, 50_000), changelog: text(r.changelog, 2000), required_env: strings(r.required_env, 50, 128), downloads: count(r.downloads), deprecated: bool(r.deprecated), published_at: date(r.published_at) };
|
|
49
|
+
}
|
|
50
|
+
function installationRow(value, project, expectedId) {
|
|
51
|
+
const r = record(value);
|
|
52
|
+
if (r.project_id !== project || expectedId && uuid(r.id) !== uuid(expectedId) || !['active', 'updating', 'failed', 'uninstalled'].includes(String(r.status))
|
|
53
|
+
|| !(r.operation === null || ['install', 'update', 'cleanup', 'uninstall'].includes(String(r.operation))))
|
|
54
|
+
invalid();
|
|
55
|
+
const result = { id: uuid(r.id), package_id: uuid(r.package_id), slug: slug(r.slug), name: text(r.name, 128), project_id: project,
|
|
56
|
+
version: nullable(r.version, semver), deployment_id: nullable(r.deployment_id, deployment), deployment_status: nullable(r.deployment_status, v => text(v, 32)),
|
|
57
|
+
pending_version: nullable(r.pending_version, semver), pending_deployment_id: nullable(r.pending_deployment_id, deployment), pending_deployment_status: nullable(r.pending_deployment_status, v => text(v, 32)),
|
|
58
|
+
operation: r.operation, status: r.status,
|
|
59
|
+
latest_version: nullable(r.latest_version, semver), installed_at: date(r.installed_at) };
|
|
60
|
+
if (result.status === 'uninstalled' && (result.operation || result.deployment_id || result.pending_deployment_id))
|
|
61
|
+
invalid();
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
function page(value, pageNumber, pageSize, parse) {
|
|
65
|
+
const r = record(value);
|
|
66
|
+
const p = record(r.pagination);
|
|
67
|
+
const total = count(p.total);
|
|
68
|
+
const pages = Math.ceil(total / pageSize);
|
|
69
|
+
if (p.page !== pageNumber || p.page_size !== pageSize || p.total_pages !== pages || p.has_next !== (pageNumber < pages) || p.has_prev !== (pageNumber > 1)
|
|
70
|
+
|| !Array.isArray(r.data) || r.data.length > pageSize)
|
|
71
|
+
invalid();
|
|
72
|
+
const data = r.data.map(parse);
|
|
73
|
+
if (new Set(data.map(row => row.id)).size !== data.length)
|
|
74
|
+
invalid();
|
|
75
|
+
return { data, pagination: { page: pageNumber, page_size: pageSize, total, total_pages: pages, has_next: pageNumber < pages, has_prev: pageNumber > 1 } };
|
|
76
|
+
}
|
|
77
|
+
function details(value, expectedSlug, exactVersion) {
|
|
78
|
+
const r = record(value);
|
|
79
|
+
const pkg = packageRow(r);
|
|
80
|
+
if (pkg.slug !== expectedSlug || !Array.isArray(r.versions) || r.versions.length > 5 || r.versions.length === 0)
|
|
81
|
+
invalid();
|
|
82
|
+
const versions = r.versions.map(row => versionRow(row, pkg.id));
|
|
83
|
+
if (new Set(versions.map(row => row.id)).size !== versions.length || exactVersion && versions.some(row => row.version !== exactVersion))
|
|
84
|
+
invalid();
|
|
85
|
+
return { ...pkg, versions };
|
|
86
|
+
}
|
|
87
|
+
function pagination(query, max) {
|
|
88
|
+
keys(record(query), ['page', 'page_size']);
|
|
89
|
+
return { page: count(query.page ?? 1, 1, 100_000), page_size: count(query.page_size ?? max, 1, max) };
|
|
90
|
+
}
|
|
91
|
+
function installInput(input) {
|
|
92
|
+
const r = record(input);
|
|
93
|
+
keys(r, ['version', 'env_overrides']);
|
|
94
|
+
const env = record(r.env_overrides ?? {});
|
|
95
|
+
if (Object.keys(env).length > 50)
|
|
96
|
+
invalid();
|
|
97
|
+
const entries = Object.entries(env).map(([key, value]) => [text(key, 128), text(value, 4096)]);
|
|
98
|
+
return { ...(r.version == null ? {} : { version: semver(r.version) }), env_overrides: Object.fromEntries(entries) };
|
|
99
|
+
}
|
|
100
|
+
function publishInput(input) {
|
|
101
|
+
const r = record(input);
|
|
102
|
+
keys(r, ['slug', 'name', 'module_hash', 'version', 'description', 'visibility', 'categories', 'keywords', 'readme', 'changelog', 'required_env', 'license']);
|
|
103
|
+
const name = text(r.name, 128);
|
|
104
|
+
const hash = text(r.module_hash, 64);
|
|
105
|
+
const visibility = r.visibility ?? 'public';
|
|
106
|
+
if (!name.trim() || !/^[a-f0-9]{64}$/.test(hash) || !['public', 'private', 'unlisted'].includes(String(visibility)))
|
|
107
|
+
invalid();
|
|
108
|
+
const required = strings(r.required_env ?? [], 50, 128);
|
|
109
|
+
if (new Set(required).size !== required.length || required.some(key => !/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)))
|
|
110
|
+
invalid();
|
|
111
|
+
return { slug: slug(r.slug), name, module_hash: hash, version: semver(r.version, 2147483647n), description: text(r.description ?? '', 500),
|
|
112
|
+
visibility: visibility, categories: strings(r.categories ?? [], 5, 64), keywords: strings(r.keywords ?? [], 20, 64),
|
|
113
|
+
readme: text(r.readme ?? '', 50_000), changelog: text(r.changelog ?? '', 2000), required_env: required, license: text(r.license ?? '', 64) };
|
|
114
|
+
}
|
|
115
|
+
/** Native Marketplace reuses verified project ownership and persisted deployment lifecycle.
|
|
116
|
+
* Writes are sent once. Read/reconcile saved state after an uncertain acknowledgement. */
|
|
117
|
+
export function hivesMarketplace(client) {
|
|
118
|
+
const projectInput = (project) => ({ project_id: hivesResourceId(project) });
|
|
119
|
+
const call = (operation, input, options) => hivesResourceCall(client, `hives_marketplace_${operation}`, input, options);
|
|
120
|
+
const mutate = async (operation, project, packageSlug, input, options) => {
|
|
121
|
+
const body = installInput(input);
|
|
122
|
+
const result = installationRow(await call(operation, { ...projectInput(project), slug: slug(packageSlug), body }, options), project);
|
|
123
|
+
if (result.slug !== packageSlug || result.status === 'uninstalled' || body.version && result.version !== body.version && result.pending_version !== body.version)
|
|
124
|
+
invalid();
|
|
125
|
+
return result;
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
async list(project, query = {}, options) {
|
|
129
|
+
keys(record(query), ['q', 'category', 'free_only', 'verified_only', 'sort', 'order', 'page', 'page_size']);
|
|
130
|
+
const p = { page: count(query.page ?? 1, 1, 100_000), page_size: count(query.page_size ?? 20, 1, 100) };
|
|
131
|
+
const sort = query.sort ?? 'installs';
|
|
132
|
+
const order = query.order ?? 'desc';
|
|
133
|
+
if (!['name', 'installs', 'stars', 'created', 'updated'].includes(sort) || !['asc', 'desc'].includes(order))
|
|
134
|
+
invalid();
|
|
135
|
+
const input = { ...projectInput(project), ...p, sort, order, free_only: bool(query.free_only ?? false), verified_only: bool(query.verified_only ?? false),
|
|
136
|
+
...(query.q == null ? {} : { q: text(query.q, 200) }), ...(query.category == null ? {} : { category: text(query.category, 64) }) };
|
|
137
|
+
return page(await call('list_packages', input, options), p.page, p.page_size, packageRow);
|
|
138
|
+
},
|
|
139
|
+
async get(project, packageSlug, query = {}, options) {
|
|
140
|
+
keys(record(query), ['version']);
|
|
141
|
+
const version = query.version == null ? undefined : semver(query.version);
|
|
142
|
+
return details(await call('get_package', { ...projectInput(project), slug: slug(packageSlug), ...(version === undefined ? {} : { version }) }, options), packageSlug, version);
|
|
143
|
+
},
|
|
144
|
+
async versions(project, packageSlug, query = {}, options) {
|
|
145
|
+
const p = pagination(query, 5);
|
|
146
|
+
const result = page(await call('list_versions', { ...projectInput(project), slug: slug(packageSlug), ...p }, options), p.page, p.page_size, row => versionRow(row));
|
|
147
|
+
if (new Set(result.data.map(row => row.package_id)).size > 1)
|
|
148
|
+
invalid();
|
|
149
|
+
return result;
|
|
150
|
+
},
|
|
151
|
+
async featured(project, options) { return page(await call('featured', projectInput(project), options), 1, 20, packageRow); },
|
|
152
|
+
async categories(project, options) {
|
|
153
|
+
const result = await call('categories', projectInput(project), options);
|
|
154
|
+
if (!Array.isArray(result) || result.length > 100)
|
|
155
|
+
invalid();
|
|
156
|
+
const data = result.map(value => {
|
|
157
|
+
const r = record(value);
|
|
158
|
+
return { id: uuid(r.id), slug: slug(r.slug), name: text(r.name, 128),
|
|
159
|
+
description: nullable(r.description, v => text(v, 1000)), icon_url: nullable(r.icon_url, v => text(v, 2048)), package_count: count(r.package_count), sort_order: count(r.sort_order, -2147483648, 2147483647) };
|
|
160
|
+
});
|
|
161
|
+
if (new Set(data.map(row => row.id)).size !== data.length)
|
|
162
|
+
invalid();
|
|
163
|
+
return data;
|
|
164
|
+
},
|
|
165
|
+
async publish(project, input, options) {
|
|
166
|
+
const body = publishInput(input);
|
|
167
|
+
const result = details(await call('publish', { ...projectInput(project), body }, options), body.slug);
|
|
168
|
+
if (!result.owned || !result.versions.some(v => v.version === body.version && v.module_hash === body.module_hash))
|
|
169
|
+
invalid();
|
|
170
|
+
return result;
|
|
171
|
+
},
|
|
172
|
+
async install(project, packageSlug, input = {}, options) { return mutate('install', project, packageSlug, input, options); },
|
|
173
|
+
async update(project, packageSlug, input = {}, options) { return mutate('update', project, packageSlug, input, options); },
|
|
174
|
+
async installed(project, query = {}, options) {
|
|
175
|
+
const p = pagination(query, 20);
|
|
176
|
+
return page(await call('installed', { ...projectInput(project), ...p }, options), p.page, p.page_size, row => installationRow(row, project));
|
|
177
|
+
},
|
|
178
|
+
async getInstallation(project, id, options) { return installationRow(await call('get_installation', { ...projectInput(project), installation_id: uuid(id) }, options), project, id); },
|
|
179
|
+
async reconcile(project, id, options) { return installationRow(await call('reconcile', { ...projectInput(project), installation_id: uuid(id) }, options), project, id); },
|
|
180
|
+
async uninstall(project, id, options) {
|
|
181
|
+
const result = installationRow(await call('uninstall', { ...projectInput(project), installation_id: uuid(id) }, options), project, id);
|
|
182
|
+
if (result.status !== 'uninstalled' || result.operation || result.deployment_id || result.pending_deployment_id)
|
|
183
|
+
invalid();
|
|
184
|
+
return result;
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
package/dist/hives-node.js
CHANGED
|
@@ -12,6 +12,8 @@ export async function closeHivesNodeTransport() {
|
|
|
12
12
|
await current?.destroy();
|
|
13
13
|
}
|
|
14
14
|
export function hivesOperationBudget(id) {
|
|
15
|
+
if (['hives_list_buckets', 'hives_create_bucket', 'hives_get_bucket', 'hives_delete_bucket', 'hives_list_objects', 'hives_upload_object', 'hives_upload_object_by_key', 'hives_delete_object', 'hives_delete_object_by_key', 'hives_download_object_by_key', 'hives_get_cors_config', 'hives_set_cors_config', 'hives_generate_presigned_url', 'hives_reconcile'].includes(id))
|
|
16
|
+
return 100_000;
|
|
15
17
|
if (id === 'hives_cancel_deployment' || id === 'hives_delete_deployment')
|
|
16
18
|
return 330_000;
|
|
17
19
|
if (['hives_create_deployment', 'hives_upload_deployment', 'hives_invoke_deployment', 'hives_invoke_function', 'hives_invoke_function_async'].includes(id))
|
|
@@ -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
|
+
}
|