@re-cinq/floor-client 0.3.0 → 0.4.0
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/client.d.ts +15 -2
- package/dist/client.js +15 -2
- package/dist/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentDefinitionBody, LineBody, MigrationBody, PutResult, ScheduleBody, StationBody, DefinitionRowView, FloorEventView } from "@re-cinq/floor-contracts";
|
|
1
|
+
import type { AgentDefinitionBody, AgentPresence, AgentRecipes, ClusterHolding, LineBody, MigrationBody, PutResult, ScheduleBody, StationBody, DefinitionRowView, FloorEventView } from "@re-cinq/floor-contracts";
|
|
2
2
|
import { type BlobsApi, type ConversationApi } from "./blobs.js";
|
|
3
3
|
import { type DefinitionApi } from "./definitions.js";
|
|
4
4
|
import { type EventsApi } from "./events.js";
|
|
@@ -19,6 +19,18 @@ export interface LinesApi extends DefinitionApi<LineBody> {
|
|
|
19
19
|
/** Answers the run already open on this subject, joined, rather than opening a second one. */
|
|
20
20
|
start(lineId: string, starting: StartRun): Promise<StartedRun>;
|
|
21
21
|
}
|
|
22
|
+
export interface AgentDefinitionsApi extends DefinitionApi<AgentDefinitionBody> {
|
|
23
|
+
/** Every agent definition's presence on the clusters, by id. */
|
|
24
|
+
presence(): Promise<Record<string, AgentPresence>>;
|
|
25
|
+
/** What each cluster read back out of its kube for this agent definition. */
|
|
26
|
+
clusters(id: string): Promise<ClusterHolding<AgentDefinitionBody>[]>;
|
|
27
|
+
/** Null when nothing of that id is there. */
|
|
28
|
+
recipes(id: string): Promise<AgentRecipes<AgentDefinitionBody> | null>;
|
|
29
|
+
}
|
|
30
|
+
export interface ClustersApi {
|
|
31
|
+
/** Registers this cluster, or tells the floor it is still there. */
|
|
32
|
+
register(id: string, tags: string[]): Promise<void>;
|
|
33
|
+
}
|
|
22
34
|
export interface SchedulesApi extends DefinitionApi<ScheduleBody> {
|
|
23
35
|
/** Posts this schedule's event now, without waiting for its cron. */
|
|
24
36
|
trigger(id: string): Promise<FloorEventView | null>;
|
|
@@ -44,7 +56,8 @@ export interface FloorClient {
|
|
|
44
56
|
readonly health: HealthApi;
|
|
45
57
|
readonly lines: LinesApi;
|
|
46
58
|
readonly stations: DefinitionApi<StationBody>;
|
|
47
|
-
readonly agentDefinitions:
|
|
59
|
+
readonly agentDefinitions: AgentDefinitionsApi;
|
|
60
|
+
readonly clusters: ClustersApi;
|
|
48
61
|
readonly schedules: SchedulesApi;
|
|
49
62
|
readonly migrations: MigrationsApi;
|
|
50
63
|
readonly runs: RunsApi;
|
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import { blobsApi, conversationApi } from "./blobs.js";
|
|
|
2
2
|
import { definitionApi } from "./definitions.js";
|
|
3
3
|
import { eventsApi } from "./events.js";
|
|
4
4
|
import { costsApi, runsApi } from "./runs.js";
|
|
5
|
-
import { asked, reach } from "./send.js";
|
|
5
|
+
import { asked, done, reach } from "./send.js";
|
|
6
6
|
import { stationRunsApi } from "./station-runs.js";
|
|
7
7
|
const HTTP_NOT_FOUND = 404;
|
|
8
8
|
export function createFloorClient(access) {
|
|
@@ -11,7 +11,12 @@ export function createFloorClient(access) {
|
|
|
11
11
|
health: healthApi(floor),
|
|
12
12
|
lines: { ...definitionApi(floor, "assembly-lines"), start: (lineId, starting) => startRun(floor, lineId, starting) },
|
|
13
13
|
stations: definitionApi(floor, "stations"),
|
|
14
|
-
agentDefinitions:
|
|
14
|
+
agentDefinitions: agentDefinitionsApi(floor),
|
|
15
|
+
clusters: {
|
|
16
|
+
register: async (id, tags) => {
|
|
17
|
+
await done(floor, { method: "PUT", path: `/clusters/${id}`, body: { tags } });
|
|
18
|
+
},
|
|
19
|
+
},
|
|
15
20
|
schedules: { ...definitionApi(floor, "schedules"), trigger: (id) => asked(floor, { method: "POST", path: `/schedules/${id}/trigger` }, [HTTP_NOT_FOUND]) },
|
|
16
21
|
migrations: migrationsApi(floor),
|
|
17
22
|
runs: runsApi(floor),
|
|
@@ -49,4 +54,12 @@ function healthApi(floor) {
|
|
|
49
54
|
version: async () => (await asked(floor, { method: "GET", path: "/version" })),
|
|
50
55
|
};
|
|
51
56
|
}
|
|
57
|
+
function agentDefinitionsApi(floor) {
|
|
58
|
+
return {
|
|
59
|
+
...definitionApi(floor, "agent-definitions"),
|
|
60
|
+
presence: async () => (await asked(floor, { method: "GET", path: "/agent-definitions/presence" })) ?? {},
|
|
61
|
+
clusters: async (id) => (await asked(floor, { method: "GET", path: `/agent-definitions/${id}/clusters` }))?.items ?? [],
|
|
62
|
+
recipes: (id) => asked(floor, { method: "GET", path: `/agent-definitions/${id}/recipes` }, [HTTP_NOT_FOUND]),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
52
65
|
//# sourceMappingURL=client.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { FloorProblem, isFloorProblem } from "./problem.js";
|
|
|
5
5
|
export { reach, asked, send } from "./send.js";
|
|
6
6
|
export { CLOSE, watchRun } from "./live.js";
|
|
7
7
|
export { watchFloor } from "./floor-live.js";
|
|
8
|
-
export type { FloorAccess, FloorClient, HealthApi, LinesApi, MigrationsApi, SchedulesApi, Version } from "./client.js";
|
|
8
|
+
export type { AgentDefinitionsApi, ClustersApi, FloorAccess, FloorClient, HealthApi, LinesApi, MigrationsApi, SchedulesApi, Version } from "./client.js";
|
|
9
9
|
export type { AppendRecord, GitCredentialOutcome, VisitAccess, VisitClient } from "./visit.js";
|
|
10
10
|
export type { ServiceToken, VisitToken } from "./tokens.js";
|
|
11
11
|
export type { Asking, Reachable } from "./send.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@re-cinq/floor-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The floor over HTTP and its live socket, typed: definitions, runs, visits, blobs, events, schedules and costs, plus a watch that replays a run from a cursor and reconnects without losing a frame.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@re-cinq/floor-contracts": "0.
|
|
48
|
+
"@re-cinq/floor-contracts": "0.4.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.20.1",
|