@lifesi/genesis 0.1.0 → 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 +7179 -1234
- package/dist/client.js +139 -5
- package/dist/dials.d.ts +254 -6
- package/dist/dials.js +82 -1
- 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 +7178 -1233
- package/dist/generated/operations.js +8991 -1579
- package/dist/generated/schema.d.ts +15611 -5129
- package/dist/genesis.d.ts +990 -29
- package/dist/genesis.js +46 -4
- package/dist/genesis.openapi.json +22450 -6816
- 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 +15 -0
- package/dist/hives-functions.js +94 -0
- package/dist/hives-node.d.ts +9 -0
- package/dist/hives-node.js +152 -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-response.d.ts +2 -0
- package/dist/hives-response.js +32 -0
- package/dist/hives-runtimes.d.ts +34 -0
- package/dist/hives-runtimes.js +32 -0
- package/dist/hives-upload.d.ts +9 -0
- package/dist/hives-upload.js +23 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +7 -1
- 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/dist/types.d.ts +11 -1
- package/package.json +14 -2
package/dist/fleets.js
CHANGED
|
@@ -3,6 +3,13 @@ const byteLength = (value) => new TextEncoder().encode(value).byteLength;
|
|
|
3
3
|
const invalid = (operationId, message) => new GenesisError({
|
|
4
4
|
status: 0, type: 'invalid_request', operationId, message,
|
|
5
5
|
});
|
|
6
|
+
function instanceOptions(operation, options) {
|
|
7
|
+
const key = options.idempotencyKey;
|
|
8
|
+
if (key !== undefined && (typeof key !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(key))) {
|
|
9
|
+
throw invalid(operation, 'Idempotency-Key must be one canonical UUID4.');
|
|
10
|
+
}
|
|
11
|
+
return { signal: options.signal, ...(key === undefined ? {} : { headers: { 'idempotency-key': key } }) };
|
|
12
|
+
}
|
|
6
13
|
function validateTask(body) {
|
|
7
14
|
if (typeof body?.input !== 'string' || !body.input || byteLength(body.input) > 65536 || body.input.includes('\0')) {
|
|
8
15
|
throw invalid('fleets_submitTask', 'Task input must contain 1–65536 UTF-8 bytes without NUL.');
|
|
@@ -19,9 +26,36 @@ function validateKey(apiKey) {
|
|
|
19
26
|
throw invalid('fleets_setConnection', 'Foundry key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
const instanceId = (value, operation) => {
|
|
30
|
+
if (typeof value !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) {
|
|
31
|
+
throw invalid(operation, 'Invalid Fleets instance ID.');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
23
35
|
export function fleetsModule(client) {
|
|
24
36
|
return {
|
|
37
|
+
instances: {
|
|
38
|
+
list: async (query = {}) => {
|
|
39
|
+
if (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 50)) {
|
|
40
|
+
throw invalid('fleets_listInstances', 'Limit must be 1–50.');
|
|
41
|
+
}
|
|
42
|
+
if (query.after !== undefined)
|
|
43
|
+
instanceId(query.after, 'fleets_listInstances');
|
|
44
|
+
return client.request('fleets_listInstances', query);
|
|
45
|
+
},
|
|
46
|
+
get: async (instance_id) => {
|
|
47
|
+
instanceId(instance_id, 'fleets_getInstance');
|
|
48
|
+
return client.request('fleets_getInstance', { instance_id });
|
|
49
|
+
},
|
|
50
|
+
stop: async (instance_id, options = {}) => {
|
|
51
|
+
instanceId(instance_id, 'fleets_stopInstance');
|
|
52
|
+
return client.request('fleets_stopInstance', { instance_id }, instanceOptions('fleets_stopInstance', options));
|
|
53
|
+
},
|
|
54
|
+
start: async (instance_id, options = {}) => {
|
|
55
|
+
instanceId(instance_id, 'fleets_startInstance');
|
|
56
|
+
return client.request('fleets_startInstance', { instance_id }, instanceOptions('fleets_startInstance', options));
|
|
57
|
+
},
|
|
58
|
+
},
|
|
25
59
|
connection: {
|
|
26
60
|
get: () => client.request('fleets_getConnection', {}),
|
|
27
61
|
set: async (api_key) => {
|
package/dist/flocks.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { OperationInput } from './types.js';
|
|
3
|
+
/** Org scope comes from the LifeID credential verified by the gateway. */
|
|
4
|
+
export declare function flocksModule(client: GenesisClient): {
|
|
5
|
+
readiness: {
|
|
6
|
+
get: () => Promise<{
|
|
7
|
+
node_enrollment_available: boolean;
|
|
8
|
+
reason_code?: "node_credential_issuer_unavailable";
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
nodes: {
|
|
12
|
+
list: () => Promise<{
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
nickname: string;
|
|
16
|
+
platform: string;
|
|
17
|
+
cpu_count: number;
|
|
18
|
+
state: "enrolled" | "revoked";
|
|
19
|
+
last_seen_at: number;
|
|
20
|
+
enrolled_at: number;
|
|
21
|
+
}[]>;
|
|
22
|
+
rename: (id: string, nickname: string) => Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
nickname: string;
|
|
26
|
+
platform: string;
|
|
27
|
+
cpu_count: number;
|
|
28
|
+
state: "enrolled" | "revoked";
|
|
29
|
+
last_seen_at: number;
|
|
30
|
+
enrolled_at: number;
|
|
31
|
+
}>;
|
|
32
|
+
revoke: (id: string) => Promise<{
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
nickname: string;
|
|
36
|
+
platform: string;
|
|
37
|
+
cpu_count: number;
|
|
38
|
+
state: "enrolled" | "revoked";
|
|
39
|
+
last_seen_at: number;
|
|
40
|
+
enrolled_at: number;
|
|
41
|
+
}>;
|
|
42
|
+
heartbeat: (id: string, nodeBinding: string) => Promise<{
|
|
43
|
+
accepted: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
enroll: (body: OperationInput<"flocks_enrollNode">["body"]) => Promise<{
|
|
46
|
+
node: import("./index.js").components["schemas"]["Flocks.Node"];
|
|
47
|
+
node_binding: string;
|
|
48
|
+
heartbeat_interval_seconds: number;
|
|
49
|
+
}>;
|
|
50
|
+
activate: (id: string, body: OperationInput<"flocks_activateNode">["body"]) => Promise<{
|
|
51
|
+
node: import("./index.js").components["schemas"]["Flocks.Node"];
|
|
52
|
+
activated: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
rotateCredential: (id: string, body: OperationInput<"flocks_rotateNodeCredential">["body"]) => Promise<{
|
|
55
|
+
accepted: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
joinTokens: {
|
|
59
|
+
exchange: (body: OperationInput<"flocks_exchangeJoinToken">["body"]) => Promise<{
|
|
60
|
+
node_id: string;
|
|
61
|
+
organization_id: string;
|
|
62
|
+
credential_id: string;
|
|
63
|
+
credential_value: string;
|
|
64
|
+
scopes: "flocks:node"[];
|
|
65
|
+
expires_at: string;
|
|
66
|
+
node_nonce_hash?: string;
|
|
67
|
+
}>;
|
|
68
|
+
create: (ttlSeconds?: number) => Promise<{
|
|
69
|
+
token: string;
|
|
70
|
+
expires_at: number;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
};
|
package/dist/flocks.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Org scope comes from the LifeID credential verified by the gateway. */
|
|
2
|
+
export function flocksModule(client) {
|
|
3
|
+
const nodePath = (id) => ({ id });
|
|
4
|
+
return {
|
|
5
|
+
readiness: {
|
|
6
|
+
get: () => client.request('flocks_getEnrollmentReadiness'),
|
|
7
|
+
},
|
|
8
|
+
nodes: {
|
|
9
|
+
list: () => client.request('flocks_listNodes'),
|
|
10
|
+
rename: (id, nickname) => client.request('flocks_renameNode', { ...nodePath(id), body: { nickname } }),
|
|
11
|
+
revoke: (id) => client.request('flocks_revokeNode', nodePath(id)),
|
|
12
|
+
heartbeat: (id, nodeBinding) => client.request('flocks_heartbeatNode', { ...nodePath(id), body: { node_binding: nodeBinding } }),
|
|
13
|
+
enroll: (body) => client.request('flocks_enrollNode', { body }),
|
|
14
|
+
activate: (id, body) => client.request('flocks_activateNode', { id, body }),
|
|
15
|
+
rotateCredential: (id, body) => client.request('flocks_rotateNodeCredential', { id, body }),
|
|
16
|
+
},
|
|
17
|
+
joinTokens: {
|
|
18
|
+
exchange: (body) => client.request('flocks_exchangeJoinToken', { body }),
|
|
19
|
+
create: (ttlSeconds = 600) => client.request('flocks_createJoinToken', { body: { ttl_seconds: ttlSeconds } }),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|