@maiaos/sdk 0.1.0-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/agent-permission/agent-permission.d.ts +9 -0
- package/dist/agent-permission/agent-permission.js +5 -0
- package/dist/agent-permission/effect.d.ts +4 -0
- package/dist/agent-permission/effect.js +34 -0
- package/dist/agent-permission/index.d.ts +2 -0
- package/dist/agent-permission/index.js +2 -0
- package/dist/agents/agents.d.ts +11 -0
- package/dist/agents/agents.js +5 -0
- package/dist/agents/effect.d.ts +5 -0
- package/dist/agents/effect.js +59 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/index.js +2 -0
- package/dist/approval/approval.d.ts +10 -0
- package/dist/approval/approval.js +5 -0
- package/dist/approval/effect.d.ts +5 -0
- package/dist/approval/effect.js +43 -0
- package/dist/approval/index.d.ts +2 -0
- package/dist/approval/index.js +2 -0
- package/dist/call/call.d.ts +26 -0
- package/dist/call/call.js +6 -0
- package/dist/call/effect.d.ts +5 -0
- package/dist/call/effect.js +46 -0
- package/dist/call/index.d.ts +2 -0
- package/dist/call/index.js +2 -0
- package/dist/client/effect.d.ts +8 -0
- package/dist/client/effect.js +298 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/local-node-client.d.ts +106 -0
- package/dist/client/local-node-client.js +4 -0
- package/dist/connection/connection.d.ts +28 -0
- package/dist/connection/connection.js +5 -0
- package/dist/connection/effect.d.ts +5 -0
- package/dist/connection/effect.js +211 -0
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/index.js +2 -0
- package/dist/container/container.d.ts +14 -0
- package/dist/container/container.js +5 -0
- package/dist/container/effect.d.ts +4 -0
- package/dist/container/effect.js +90 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +2 -0
- package/dist/discovery/discovery.d.ts +11 -0
- package/dist/discovery/discovery.js +5 -0
- package/dist/discovery/effect.d.ts +5 -0
- package/dist/discovery/effect.js +44 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/discovery/index.js +2 -0
- package/dist/execution/effect.d.ts +4 -0
- package/dist/execution/effect.js +8 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.js +2 -0
- package/dist/execution/relocation.d.ts +10 -0
- package/dist/execution/relocation.js +4 -0
- package/dist/feature-bindings/feature-bindings.d.ts +10 -0
- package/dist/feature-bindings/feature-bindings.js +2 -0
- package/dist/feature-bindings/index.d.ts +2 -0
- package/dist/feature-bindings/index.js +2 -0
- package/dist/hold/effect.d.ts +5 -0
- package/dist/hold/effect.js +61 -0
- package/dist/hold/hold.d.ts +12 -0
- package/dist/hold/hold.js +5 -0
- package/dist/hold/index.d.ts +2 -0
- package/dist/hold/index.js +2 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +24 -0
- package/dist/interaction/effect.d.ts +5 -0
- package/dist/interaction/effect.js +79 -0
- package/dist/interaction/index.d.ts +2 -0
- package/dist/interaction/index.js +2 -0
- package/dist/interaction/interaction.d.ts +12 -0
- package/dist/interaction/interaction.js +5 -0
- package/dist/node/attach.d.ts +11 -0
- package/dist/node/attach.js +33 -0
- package/dist/node/bridge-frame.d.ts +18 -0
- package/dist/node/bridge-frame.js +67 -0
- package/dist/node/bridge.d.ts +55 -0
- package/dist/node/bridge.js +286 -0
- package/dist/node/deadlines.d.ts +5 -0
- package/dist/node/deadlines.js +32 -0
- package/dist/node/discovery.d.ts +192 -0
- package/dist/node/discovery.js +408 -0
- package/dist/node/effect.d.ts +10 -0
- package/dist/node/effect.js +10 -0
- package/dist/node/fetch.d.ts +2 -0
- package/dist/node/fetch.js +2 -0
- package/dist/node/http.d.ts +27 -0
- package/dist/node/http.js +270 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +3 -0
- package/dist/node/local-node.d.ts +26 -0
- package/dist/node/local-node.js +67 -0
- package/dist/node/session.d.ts +15 -0
- package/dist/node/session.js +27 -0
- package/dist/node/ssh.d.ts +29 -0
- package/dist/node/ssh.js +122 -0
- package/dist/node/transport.d.ts +52 -0
- package/dist/node/transport.js +211 -0
- package/dist/node-changes/change.d.ts +16 -0
- package/dist/node-changes/change.js +16 -0
- package/dist/node-changes/effect.d.ts +11 -0
- package/dist/node-changes/effect.js +62 -0
- package/dist/node-changes/index.d.ts +3 -0
- package/dist/node-changes/index.js +3 -0
- package/dist/node-changes/node-changes.d.ts +7 -0
- package/dist/node-changes/node-changes.js +8 -0
- package/dist/port-lease/effect.d.ts +5 -0
- package/dist/port-lease/effect.js +53 -0
- package/dist/port-lease/index.d.ts +2 -0
- package/dist/port-lease/index.js +2 -0
- package/dist/port-lease/port-lease.d.ts +11 -0
- package/dist/port-lease/port-lease.js +5 -0
- package/dist/presentation/client.d.ts +10 -0
- package/dist/presentation/client.js +4 -0
- package/dist/presentation/effect.d.ts +5 -0
- package/dist/presentation/effect.js +30 -0
- package/dist/presentation/index.d.ts +5 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/project-list.d.ts +7 -0
- package/dist/presentation/project-list.js +24 -0
- package/dist/presentation/session-list.d.ts +7 -0
- package/dist/presentation/session-list.js +32 -0
- package/dist/project-guard/effect.d.ts +5 -0
- package/dist/project-guard/effect.js +39 -0
- package/dist/project-guard/index.d.ts +2 -0
- package/dist/project-guard/index.js +2 -0
- package/dist/project-guard/project-guard.d.ts +10 -0
- package/dist/project-guard/project-guard.js +5 -0
- package/dist/project-workspace/effect.d.ts +5 -0
- package/dist/project-workspace/effect.js +124 -0
- package/dist/project-workspace/index.d.ts +2 -0
- package/dist/project-workspace/index.js +2 -0
- package/dist/project-workspace/project-workspace.d.ts +23 -0
- package/dist/project-workspace/project-workspace.js +4 -0
- package/dist/provider-pool/effect.d.ts +4 -0
- package/dist/provider-pool/effect.js +5 -0
- package/dist/provider-pool/index.d.ts +2 -0
- package/dist/provider-pool/index.js +2 -0
- package/dist/provider-pool/provider-pool.d.ts +7 -0
- package/dist/provider-pool/provider-pool.js +4 -0
- package/dist/remote-node/effect.d.ts +4 -0
- package/dist/remote-node/effect.js +83 -0
- package/dist/remote-node/index.d.ts +2 -0
- package/dist/remote-node/index.js +2 -0
- package/dist/remote-node/remote-node.d.ts +14 -0
- package/dist/remote-node/remote-node.js +5 -0
- package/dist/request/classify.d.ts +15 -0
- package/dist/request/classify.js +97 -0
- package/dist/request/client-error.d.ts +11 -0
- package/dist/request/client-error.js +20 -0
- package/dist/request/effect.d.ts +22 -0
- package/dist/request/effect.js +104 -0
- package/dist/request/envelope-schema.d.ts +2 -0
- package/dist/request/envelope-schema.js +2 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +4 -0
- package/dist/request/maia-client.d.ts +21 -0
- package/dist/request/maia-client.js +9 -0
- package/dist/request/options.d.ts +10 -0
- package/dist/request/options.js +2 -0
- package/dist/routine/effect.d.ts +5 -0
- package/dist/routine/effect.js +115 -0
- package/dist/routine/index.d.ts +2 -0
- package/dist/routine/index.js +2 -0
- package/dist/routine/routine.d.ts +17 -0
- package/dist/routine/routine.js +5 -0
- package/dist/run-ledger/effect.d.ts +5 -0
- package/dist/run-ledger/effect.js +72 -0
- package/dist/run-ledger/index.d.ts +2 -0
- package/dist/run-ledger/index.js +2 -0
- package/dist/run-ledger/run-ledger.d.ts +12 -0
- package/dist/run-ledger/run-ledger.js +2 -0
- package/dist/session/effect.d.ts +4 -0
- package/dist/session/effect.js +7 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.js +2 -0
- package/dist/session/mailbox.d.ts +9 -0
- package/dist/session/mailbox.js +4 -0
- package/dist/session-creation/effect.d.ts +25 -0
- package/dist/session-creation/effect.js +269 -0
- package/dist/session-creation/index.d.ts +3 -0
- package/dist/session-creation/index.js +3 -0
- package/dist/session-creation/session-creation.d.ts +18 -0
- package/dist/session-creation/session-creation.js +24 -0
- package/dist/session-creation/tasks.d.ts +69 -0
- package/dist/session-creation/tasks.js +37 -0
- package/dist/session-view/index.d.ts +2 -0
- package/dist/session-view/index.js +2 -0
- package/dist/session-view/view.d.ts +42 -0
- package/dist/session-view/view.js +137 -0
- package/dist/stream/effect.d.ts +29 -0
- package/dist/stream/effect.js +77 -0
- package/dist/stream/index.d.ts +2 -0
- package/dist/stream/index.js +2 -0
- package/dist/stream/stream.d.ts +9 -0
- package/dist/stream/stream.js +2 -0
- package/dist/team-workspace/effect.d.ts +5 -0
- package/dist/team-workspace/effect.js +25 -0
- package/dist/team-workspace/index.d.ts +2 -0
- package/dist/team-workspace/index.js +2 -0
- package/dist/team-workspace/team-workspace.d.ts +9 -0
- package/dist/team-workspace/team-workspace.js +5 -0
- package/dist/voice/effect.d.ts +7 -0
- package/dist/voice/effect.js +71 -0
- package/dist/voice/index.d.ts +4 -0
- package/dist/voice/index.js +3 -0
- package/dist/voice/managed-turn.d.ts +9 -0
- package/dist/voice/managed-turn.js +4 -0
- package/dist/voice/orchestrator-contract.d.ts +5 -0
- package/dist/voice/orchestrator-contract.js +4 -0
- package/dist/voice/orchestrator.d.ts +25 -0
- package/dist/voice/orchestrator.js +169 -0
- package/dist/voice/pi-relay-contract.d.ts +4 -0
- package/dist/voice/pi-relay-contract.js +2 -0
- package/dist/voice/pi-relay.d.ts +12 -0
- package/dist/voice/pi-relay.js +9 -0
- package/dist/voice/wire-schema.d.ts +215 -0
- package/dist/voice/wire-schema.js +16 -0
- package/package.json +84 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { connectionCapacitySetResultSchema, connectionCreateResultSchema, connectionDetectResultSchema, connectionGatewayCreateResultSchema, connectionGrantListResultSchema, connectionGrantSetConfirmResultSchema, connectionGrantSetPreviewResultSchema, connectionListResultSchema, connectionLoginStartResultSchema, connectionModelsListResultSchema, connectionPoolListResultSchema, connectionPoolSetConfirmResultSchema, connectionPoolSetPreviewResultSchema, connectionShowResultSchema, connectionStateSetResultSchema, connectionSystemConfirmResultSchema, connectionSystemPreviewResultSchema, connectionUpkeepConfirmResultSchema, connectionUpkeepPreviewResultSchema, connectionUpkeepRefreshResultSchema, connectionUsageShowResultSchema, } from "@maiaos/protocol";
|
|
2
|
+
import { verifiedMutation, } from "../request/effect.js";
|
|
3
|
+
import { MaiaClientError } from "../request/index.js";
|
|
4
|
+
const requireMatch = (matches) => {
|
|
5
|
+
if (!matches)
|
|
6
|
+
throw new MaiaClientError("invalid_response", "The connection response did not match the request.");
|
|
7
|
+
};
|
|
8
|
+
const parseCreate = (value, input) => {
|
|
9
|
+
const result = connectionCreateResultSchema.parse(value);
|
|
10
|
+
const record = result.connection;
|
|
11
|
+
requireMatch(result.commandId === input.commandId &&
|
|
12
|
+
record.name === input.name &&
|
|
13
|
+
record.executor === input.executor &&
|
|
14
|
+
record.configRoot.kind === input.configRootKind &&
|
|
15
|
+
(input.maxConcurrentSessions === undefined ||
|
|
16
|
+
record.maxConcurrentSessions === input.maxConcurrentSessions));
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
const parseGatewayCreate = (value, input) => {
|
|
20
|
+
const result = connectionGatewayCreateResultSchema.parse(value);
|
|
21
|
+
const record = result.connection;
|
|
22
|
+
requireMatch(result.commandId === input.commandId &&
|
|
23
|
+
record.name === input.name &&
|
|
24
|
+
record.gateway?.baseUrl === input.baseUrl &&
|
|
25
|
+
(input.maxConcurrentSessions === undefined ||
|
|
26
|
+
record.maxConcurrentSessions === input.maxConcurrentSessions));
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const parseModelsList = (value, input) => {
|
|
30
|
+
const result = connectionModelsListResultSchema.parse(value);
|
|
31
|
+
requireMatch(result.connectionId === input.connectionId);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
const parseList = (value, input) => {
|
|
35
|
+
const result = connectionListResultSchema.parse(value);
|
|
36
|
+
requireMatch(result.items.length <= input.limit &&
|
|
37
|
+
(result.nextCursor === undefined ||
|
|
38
|
+
result.nextCursor !== input.afterCursor));
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
const parseShow = (value, input) => {
|
|
42
|
+
const result = connectionShowResultSchema.parse(value);
|
|
43
|
+
requireMatch(result.connection.connectionId === input.connectionId);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
const parseStateSet = (value, input) => {
|
|
47
|
+
const result = connectionStateSetResultSchema.parse(value);
|
|
48
|
+
requireMatch(result.commandId === input.commandId &&
|
|
49
|
+
result.connection.connectionId === input.connectionId &&
|
|
50
|
+
result.expectedRevision === input.expectedRevision &&
|
|
51
|
+
result.connection.state === input.state);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
const parseCapacitySet = (value, input) => {
|
|
55
|
+
const result = connectionCapacitySetResultSchema.parse(value);
|
|
56
|
+
requireMatch(result.commandId === input.commandId &&
|
|
57
|
+
result.connection.connectionId === input.connectionId &&
|
|
58
|
+
result.expectedRevision === input.expectedRevision &&
|
|
59
|
+
result.connection.maxConcurrentSessions === input.maxConcurrentSessions);
|
|
60
|
+
return result;
|
|
61
|
+
};
|
|
62
|
+
const parseUsageShow = (value, input) => {
|
|
63
|
+
const result = connectionUsageShowResultSchema.parse(value);
|
|
64
|
+
requireMatch(result.connection.connectionId === input.connectionId);
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
const revisedMatches = (result, input) => result.commandId === input.commandId &&
|
|
68
|
+
result.connection.connectionId === input.connectionId &&
|
|
69
|
+
result.expectedRevision === input.expectedRevision;
|
|
70
|
+
const parseLoginStart = (value, input) => {
|
|
71
|
+
const result = connectionLoginStartResultSchema.parse(value);
|
|
72
|
+
requireMatch(revisedMatches(result, input) &&
|
|
73
|
+
(input.flow === "browser") === (result.login.authUrl !== undefined));
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
const parseSystemPreview = (value, input) => {
|
|
77
|
+
const result = connectionSystemPreviewResultSchema.parse(value);
|
|
78
|
+
requireMatch(result.commandId === input.commandId);
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
const parseSystemConfirm = (value, input) => {
|
|
82
|
+
const result = connectionSystemConfirmResultSchema.parse(value);
|
|
83
|
+
requireMatch(result.commandId === input.commandId &&
|
|
84
|
+
result.inputDigest === input.inputDigest);
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
const parseUpkeepPreview = (value, input) => {
|
|
88
|
+
const result = connectionUpkeepPreviewResultSchema.parse(value);
|
|
89
|
+
requireMatch(result.commandId === input.commandId &&
|
|
90
|
+
result.executor === input.executor &&
|
|
91
|
+
result.policy === input.policy);
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
const parseUpkeepConfirm = (value, input) => {
|
|
95
|
+
const result = connectionUpkeepConfirmResultSchema.parse(value);
|
|
96
|
+
requireMatch(result.commandId === input.commandId &&
|
|
97
|
+
result.executor === input.executor &&
|
|
98
|
+
result.inputDigest === input.inputDigest &&
|
|
99
|
+
result.policy === input.policy);
|
|
100
|
+
return result;
|
|
101
|
+
};
|
|
102
|
+
const makeUpkeepOperations = (read, mutate) => ({
|
|
103
|
+
confirmConnectionUpkeep: (parameters, options) => mutate({ method: "connection.upkeep.confirm", parameters }, { parse: (value) => parseUpkeepConfirm(value, parameters) }, options),
|
|
104
|
+
previewConnectionUpkeep: (parameters, options) => read({ method: "connection.upkeep.preview", parameters }, { parse: (value) => parseUpkeepPreview(value, parameters) }, options),
|
|
105
|
+
refreshConnectionUpkeep: (parameters, options) => read({ method: "connection.upkeep.refresh", parameters }, { parse: (value) => connectionUpkeepRefreshResultSchema.parse(value) }, options),
|
|
106
|
+
});
|
|
107
|
+
const makeSystemOperations = (read, mutate) => ({
|
|
108
|
+
confirmSystemConnections: (parameters, options) => mutate({ method: "connection.system.confirm", parameters }, { parse: (value) => parseSystemConfirm(value, parameters) }, options),
|
|
109
|
+
detectConnections: (parameters, options) => read({ method: "connection.detect", parameters }, { parse: (value) => connectionDetectResultSchema.parse(value) }, options),
|
|
110
|
+
previewSystemConnections: (parameters, options) => read({ method: "connection.system.preview", parameters }, { parse: (value) => parseSystemPreview(value, parameters) }, options),
|
|
111
|
+
});
|
|
112
|
+
const makeConnectionReads = (request) => ({
|
|
113
|
+
listConnections: (parameters, options) => request({ method: "connection.list", parameters }, { parse: (value) => parseList(value, parameters) }, options),
|
|
114
|
+
showConnection: (parameters, options) => request({ method: "connection.show", parameters }, { parse: (value) => parseShow(value, parameters) }, options),
|
|
115
|
+
showConnectionUsage: (parameters, options) => request({ method: "connection.usage.show", parameters }, { parse: (value) => parseUsageShow(value, parameters) }, options),
|
|
116
|
+
});
|
|
117
|
+
const makeConnectionRecordMutations = (request) => ({
|
|
118
|
+
createConnection: (parameters, options) => request({ method: "connection.create", parameters }, { parse: (value) => parseCreate(value, parameters) }, options),
|
|
119
|
+
setConnectionCapacity: (parameters, options) => request({ method: "connection.capacity.set", parameters }, { parse: (value) => parseCapacitySet(value, parameters) }, options),
|
|
120
|
+
setConnectionState: (parameters, options) => request({ method: "connection.state.set", parameters }, { parse: (value) => parseStateSet(value, parameters) }, options),
|
|
121
|
+
});
|
|
122
|
+
const makeConnectionAccessMutations = (request) => ({
|
|
123
|
+
startConnectionLogin: (parameters, options) => request({ method: "connection.login.start", parameters }, { parse: (value) => parseLoginStart(value, parameters) }, options),
|
|
124
|
+
});
|
|
125
|
+
const makeGatewayOperations = (read, mutate) => ({
|
|
126
|
+
createGatewayConnection: (parameters, options) => mutate({ method: "connection.gateway.create", parameters }, { parse: (value) => parseGatewayCreate(value, parameters) }, options),
|
|
127
|
+
listConnectionModels: (parameters, options) => read({ method: "connection.models.list", parameters }, { parse: (value) => parseModelsList(value, parameters) }, options),
|
|
128
|
+
});
|
|
129
|
+
const sameScope = (left, right) => left.kind === right.kind && left.id === right.id;
|
|
130
|
+
const sameMembers = (left, right) => {
|
|
131
|
+
const sorted = right.toSorted();
|
|
132
|
+
return (left.length === right.length &&
|
|
133
|
+
left.toSorted().every((member, index) => member === sorted[index]));
|
|
134
|
+
};
|
|
135
|
+
const pageMatches = (result, input) => result.items.length <= input.limit &&
|
|
136
|
+
(result.nextCursor === undefined ||
|
|
137
|
+
result.nextCursor !== input.afterCursor) &&
|
|
138
|
+
result.items.every((item) => input.scope === undefined || sameScope(item.scope, input.scope));
|
|
139
|
+
const parseGrantList = (value, input) => {
|
|
140
|
+
const result = connectionGrantListResultSchema.parse(value);
|
|
141
|
+
requireMatch(pageMatches(result, input) &&
|
|
142
|
+
result.items.every((item) => (input.connectionId === undefined ||
|
|
143
|
+
item.connectionId === input.connectionId) &&
|
|
144
|
+
(input.state === undefined || item.state === input.state)));
|
|
145
|
+
return result;
|
|
146
|
+
};
|
|
147
|
+
const parseGrantPreview = (value, input) => {
|
|
148
|
+
const result = connectionGrantSetPreviewResultSchema.parse(value);
|
|
149
|
+
requireMatch(result.commandId === input.commandId &&
|
|
150
|
+
result.connectionId === input.connectionId &&
|
|
151
|
+
result.granted === input.granted &&
|
|
152
|
+
sameScope(result.scope, input.scope));
|
|
153
|
+
return result;
|
|
154
|
+
};
|
|
155
|
+
const parseGrantConfirm = (value, input) => {
|
|
156
|
+
const result = connectionGrantSetConfirmResultSchema.parse(value);
|
|
157
|
+
requireMatch(result.commandId === input.commandId &&
|
|
158
|
+
result.inputDigest === input.inputDigest &&
|
|
159
|
+
result.expectedRevision === input.expectedRevision &&
|
|
160
|
+
result.grant.connectionId === input.connectionId &&
|
|
161
|
+
sameScope(result.grant.scope, input.scope) &&
|
|
162
|
+
(result.grant.state === "active") === input.granted);
|
|
163
|
+
return result;
|
|
164
|
+
};
|
|
165
|
+
const parsePoolList = (value, input) => {
|
|
166
|
+
const result = connectionPoolListResultSchema.parse(value);
|
|
167
|
+
requireMatch(pageMatches(result, input));
|
|
168
|
+
return result;
|
|
169
|
+
};
|
|
170
|
+
const parsePoolPreview = (value, input) => {
|
|
171
|
+
const result = connectionPoolSetPreviewResultSchema.parse(value);
|
|
172
|
+
requireMatch(result.commandId === input.commandId &&
|
|
173
|
+
result.mode === input.mode &&
|
|
174
|
+
sameMembers(result.members, input.members) &&
|
|
175
|
+
sameScope(result.scope, input.scope));
|
|
176
|
+
return result;
|
|
177
|
+
};
|
|
178
|
+
const parsePoolConfirm = (value, input) => {
|
|
179
|
+
const result = connectionPoolSetConfirmResultSchema.parse(value);
|
|
180
|
+
requireMatch(result.commandId === input.commandId &&
|
|
181
|
+
result.inputDigest === input.inputDigest &&
|
|
182
|
+
result.expectedRevision === input.expectedRevision &&
|
|
183
|
+
result.pool.mode === input.mode &&
|
|
184
|
+
sameMembers(result.pool.members, input.members) &&
|
|
185
|
+
sameScope(result.pool.scope, input.scope));
|
|
186
|
+
return result;
|
|
187
|
+
};
|
|
188
|
+
const makeGrantOperations = (read, mutate) => ({
|
|
189
|
+
confirmConnectionGrant: (parameters, options) => mutate({ method: "connection.grant.set.confirm", parameters }, { parse: (value) => parseGrantConfirm(value, parameters) }, options),
|
|
190
|
+
listConnectionGrants: (parameters, options) => read({ method: "connection.grant.list", parameters }, { parse: (value) => parseGrantList(value, parameters) }, options),
|
|
191
|
+
previewConnectionGrant: (parameters, options) => read({ method: "connection.grant.set.preview", parameters }, { parse: (value) => parseGrantPreview(value, parameters) }, options),
|
|
192
|
+
});
|
|
193
|
+
const makePoolOperations = (read, mutate) => ({
|
|
194
|
+
confirmConnectionPool: (parameters, options) => mutate({ method: "connection.pool.set.confirm", parameters }, { parse: (value) => parsePoolConfirm(value, parameters) }, options),
|
|
195
|
+
listConnectionPools: (parameters, options) => read({ method: "connection.pool.list", parameters }, { parse: (value) => parsePoolList(value, parameters) }, options),
|
|
196
|
+
previewConnectionPool: (parameters, options) => read({ method: "connection.pool.set.preview", parameters }, { parse: (value) => parsePoolPreview(value, parameters) }, options),
|
|
197
|
+
});
|
|
198
|
+
export const makeConnectionOperations = (request) => {
|
|
199
|
+
const verified = (payload, output, options) => verifiedMutation(request(payload, output, options), options);
|
|
200
|
+
return {
|
|
201
|
+
...makeGrantOperations(request, verified),
|
|
202
|
+
...makePoolOperations(request, verified),
|
|
203
|
+
...makeConnectionReads(request),
|
|
204
|
+
...makeConnectionRecordMutations(verified),
|
|
205
|
+
...makeConnectionAccessMutations(verified),
|
|
206
|
+
...makeGatewayOperations(request, verified),
|
|
207
|
+
...makeSystemOperations(request, verified),
|
|
208
|
+
...makeUpkeepOperations(request, verified),
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type Connection, type ConnectionCapacitySetParameters, connectionCapacitySetParametersSchema, type ConnectionCapacitySetResult, connectionCapacitySetResultSchema, type ConnectionClient, type ConnectionCreateParameters, connectionCreateParametersSchema, type ConnectionCreateResult, connectionCreateResultSchema, type ConnectionDetectParameters, connectionDetectParametersSchema, type ConnectionDetectResult, connectionDetectResultSchema, type ConnectionExecutor, connectionExecutorSchema, type ConnectionGatewayCreateParameters, connectionGatewayCreateParametersSchema, type ConnectionGatewayCreateResult, connectionGatewayCreateResultSchema, type ConnectionGrant, type ConnectionGrantListParameters, connectionGrantListParametersSchema, type ConnectionGrantListResult, connectionGrantListResultSchema, connectionGrantSchema, type ConnectionGrantSetConfirmParameters, connectionGrantSetConfirmParametersSchema, type ConnectionGrantSetConfirmResult, connectionGrantSetConfirmResultSchema, type ConnectionGrantSetPreviewParameters, connectionGrantSetPreviewParametersSchema, type ConnectionGrantSetPreviewResult, connectionGrantSetPreviewResultSchema, type ConnectionListParameters, connectionListParametersSchema, type ConnectionListResult, connectionListResultSchema, type ConnectionLoginStartParameters, connectionLoginStartParametersSchema, type ConnectionLoginStartResult, connectionLoginStartResultSchema, type ConnectionModelId, connectionModelIdSchema, type ConnectionModelsListParameters, connectionModelsListParametersSchema, type ConnectionModelsListResult, connectionModelsListResultSchema, type ConnectionPool, type ConnectionPoolListParameters, connectionPoolListParametersSchema, type ConnectionPoolListResult, connectionPoolListResultSchema, connectionPoolSchema, type ConnectionPoolSetConfirmParameters, connectionPoolSetConfirmParametersSchema, type ConnectionPoolSetConfirmResult, connectionPoolSetConfirmResultSchema, type ConnectionPoolSetPreviewParameters, connectionPoolSetPreviewParametersSchema, type ConnectionPoolSetPreviewResult, connectionPoolSetPreviewResultSchema, connectionSchema, type ConnectionScope, connectionScopeSchema, type ConnectionShowParameters, connectionShowParametersSchema, type ConnectionShowResult, connectionShowResultSchema, type ConnectionStateSetParameters, connectionStateSetParametersSchema, type ConnectionStateSetResult, connectionStateSetResultSchema, type ConnectionSystemConfirmParameters, connectionSystemConfirmParametersSchema, type ConnectionSystemConfirmResult, connectionSystemConfirmResultSchema, type ConnectionSystemPreviewParameters, connectionSystemPreviewParametersSchema, type ConnectionSystemPreviewResult, connectionSystemPreviewResultSchema, type ConnectionUpkeepConfirmParameters, connectionUpkeepConfirmParametersSchema, type ConnectionUpkeepConfirmResult, connectionUpkeepConfirmResultSchema, type ConnectionUpkeepPreviewParameters, connectionUpkeepPreviewParametersSchema, type ConnectionUpkeepPreviewResult, connectionUpkeepPreviewResultSchema, type ConnectionUpkeepRefreshParameters, connectionUpkeepRefreshParametersSchema, type ConnectionUpkeepRefreshResult, connectionUpkeepRefreshResultSchema, type ConnectionUsage, connectionUsageSchema, type ConnectionUsageShowParameters, connectionUsageShowParametersSchema, type ConnectionUsageShowResult, connectionUsageShowResultSchema, type DetectedExecutor, detectedExecutorSchema, makeConnectionClient, MAX_CONNECTION_MODELS, MAX_CONNECTION_PAGE_SIZE, MAX_CONNECTION_POOL_MEMBERS, MAX_CONNECTION_SESSIONS, MAX_CONNECTION_USAGE_WINDOWS, MAX_GATEWAY_BASE_URL_LENGTH, } from "./connection.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { connectionCapacitySetParametersSchema, connectionCapacitySetResultSchema, connectionCreateParametersSchema, connectionCreateResultSchema, connectionDetectParametersSchema, connectionDetectResultSchema, connectionExecutorSchema, connectionGatewayCreateParametersSchema, connectionGatewayCreateResultSchema, connectionGrantListParametersSchema, connectionGrantListResultSchema, connectionGrantSchema, connectionGrantSetConfirmParametersSchema, connectionGrantSetConfirmResultSchema, connectionGrantSetPreviewParametersSchema, connectionGrantSetPreviewResultSchema, connectionListParametersSchema, connectionListResultSchema, connectionLoginStartParametersSchema, connectionLoginStartResultSchema, connectionModelIdSchema, connectionModelsListParametersSchema, connectionModelsListResultSchema, connectionPoolListParametersSchema, connectionPoolListResultSchema, connectionPoolSchema, connectionPoolSetConfirmParametersSchema, connectionPoolSetConfirmResultSchema, connectionPoolSetPreviewParametersSchema, connectionPoolSetPreviewResultSchema, connectionSchema, connectionScopeSchema, connectionShowParametersSchema, connectionShowResultSchema, connectionStateSetParametersSchema, connectionStateSetResultSchema, connectionSystemConfirmParametersSchema, connectionSystemConfirmResultSchema, connectionSystemPreviewParametersSchema, connectionSystemPreviewResultSchema, connectionUpkeepConfirmParametersSchema, connectionUpkeepConfirmResultSchema, connectionUpkeepPreviewParametersSchema, connectionUpkeepPreviewResultSchema, connectionUpkeepRefreshParametersSchema, connectionUpkeepRefreshResultSchema, connectionUsageSchema, connectionUsageShowParametersSchema, connectionUsageShowResultSchema, detectedExecutorSchema, makeConnectionClient, MAX_CONNECTION_MODELS, MAX_CONNECTION_PAGE_SIZE, MAX_CONNECTION_POOL_MEMBERS, MAX_CONNECTION_SESSIONS, MAX_CONNECTION_USAGE_WINDOWS, MAX_GATEWAY_BASE_URL_LENGTH, } from "./connection.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContainerCreateConfirmParameters, ContainerCreateConfirmResult, ContainerCreatePreviewParameters, ContainerCreatePreviewResult, ContainerIndexListParameters, ContainerIndexListResult, ContainerListParameters, ContainerListResult, ContainerRenameConfirmParameters, ContainerRenameConfirmResult, ContainerRenamePreviewParameters, ContainerRenamePreviewResult, ContainerShowParameters, ContainerShowResult } from "@maiaos/protocol";
|
|
2
|
+
import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
|
|
3
|
+
export type ContainerClient = {
|
|
4
|
+
readonly confirmContainerCreate: (parameters: ContainerCreateConfirmParameters, options: LocalNodeRequestOptions) => Promise<ContainerCreateConfirmResult>;
|
|
5
|
+
readonly confirmContainerRename: (parameters: ContainerRenameConfirmParameters, options: LocalNodeRequestOptions) => Promise<ContainerRenameConfirmResult>;
|
|
6
|
+
readonly listContainerIndex: (parameters: ContainerIndexListParameters, options: LocalNodeRequestOptions) => Promise<ContainerIndexListResult>;
|
|
7
|
+
readonly listContainers: (parameters: ContainerListParameters, options: LocalNodeRequestOptions) => Promise<ContainerListResult>;
|
|
8
|
+
readonly previewContainerCreate: (parameters: ContainerCreatePreviewParameters, options: LocalNodeRequestOptions) => Promise<ContainerCreatePreviewResult>;
|
|
9
|
+
readonly previewContainerRename: (parameters: ContainerRenamePreviewParameters, options: LocalNodeRequestOptions) => Promise<ContainerRenamePreviewResult>;
|
|
10
|
+
readonly showContainer: (parameters: ContainerShowParameters, options: LocalNodeRequestOptions) => Promise<ContainerShowResult>;
|
|
11
|
+
};
|
|
12
|
+
export declare const makeContainerClient: (request: LocalNodeRequester) => ContainerClient;
|
|
13
|
+
export { type Container, type ContainerCreateConfirmParameters, containerCreateConfirmParametersSchema, type ContainerCreateConfirmResult, type ContainerCreatePreviewParameters, containerCreatePreviewParametersSchema, type ContainerCreatePreviewResult, type ContainerIndexEntry, type ContainerIndexListParameters, containerIndexListParametersSchema, type ContainerIndexListResult, type ContainerIndexProject, type ContainerListParameters, containerListParametersSchema, type ContainerListResult, type ContainerProjectSummary, containerProjectSummarySchema, type ContainerRenameConfirmParameters, containerRenameConfirmParametersSchema, type ContainerRenameConfirmResult, type ContainerRenamePreviewParameters, containerRenamePreviewParametersSchema, type ContainerRenamePreviewResult, containerSchema, type ContainerShowParameters, containerShowParametersSchema, type ContainerShowResult, } from "@maiaos/protocol";
|
|
14
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
|
|
2
|
+
import { makeContainerOperations } from "./effect.js";
|
|
3
|
+
export const makeContainerClient = (request) => toPromiseClient(makeContainerOperations(fromPromiseRequester(request)));
|
|
4
|
+
export { containerCreateConfirmParametersSchema, containerCreatePreviewParametersSchema, containerIndexListParametersSchema, containerListParametersSchema, containerProjectSummarySchema, containerRenameConfirmParametersSchema, containerRenamePreviewParametersSchema, containerSchema, containerShowParametersSchema, } from "@maiaos/protocol";
|
|
5
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EffectClient, LocalNodeEffectRequester } from "../request/effect.js";
|
|
2
|
+
import type { ContainerClient } from "./container.js";
|
|
3
|
+
export declare const makeContainerOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<ContainerClient, TError>;
|
|
4
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { containerCreateConfirmResultSchema, containerCreatePreviewResultSchema, containerIndexListResultSchema, containerListResultSchema, containerRenameConfirmResultSchema, containerRenamePreviewResultSchema, containerShowResultSchema, } from "@maiaos/protocol";
|
|
2
|
+
import { MaiaClientError } from "../request/index.js";
|
|
3
|
+
const requireMatch = (matches) => {
|
|
4
|
+
if (!matches)
|
|
5
|
+
throw new MaiaClientError("invalid_response", "The container response did not match the request.");
|
|
6
|
+
};
|
|
7
|
+
const previewMatches = (result, input) => {
|
|
8
|
+
requireMatch(result.commandId === input.commandId && result.name === input.name.trim());
|
|
9
|
+
};
|
|
10
|
+
const confirmationMatches = (result, input) => {
|
|
11
|
+
requireMatch(result.commandId === input.commandId &&
|
|
12
|
+
result.inputDigest === input.inputDigest &&
|
|
13
|
+
result.container.name === input.name.trim());
|
|
14
|
+
};
|
|
15
|
+
const parseCreateConfirmation = (value, parameters) => {
|
|
16
|
+
const result = containerCreateConfirmResultSchema.parse(value);
|
|
17
|
+
confirmationMatches(result, parameters);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
const parseRenameConfirmation = (value, parameters) => {
|
|
21
|
+
const result = containerRenameConfirmResultSchema.parse(value);
|
|
22
|
+
confirmationMatches(result, parameters);
|
|
23
|
+
requireMatch(result.container.id === parameters.containerId &&
|
|
24
|
+
result.expectedRevision === parameters.expectedRevision);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
const parseCreatePreview = (value, parameters) => {
|
|
28
|
+
const result = containerCreatePreviewResultSchema.parse(value);
|
|
29
|
+
previewMatches(result, parameters);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
const parseRenamePreview = (value, parameters) => {
|
|
33
|
+
const result = containerRenamePreviewResultSchema.parse(value);
|
|
34
|
+
previewMatches(result, parameters);
|
|
35
|
+
requireMatch(result.containerId === parameters.containerId &&
|
|
36
|
+
result.expectedRevision === parameters.expectedRevision);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
const parseList = (value, parameters) => {
|
|
40
|
+
const result = containerListResultSchema.parse(value);
|
|
41
|
+
requireMatch(result.items.length <= parameters.limit);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
const parseIndex = (value, parameters) => {
|
|
45
|
+
const result = containerIndexListResultSchema.parse(value);
|
|
46
|
+
requireMatch(result.items.reduce((rows, item) => rows + Math.max(item.projects.length, 1), 0) <= parameters.limit);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
const parseShow = (value, parameters) => {
|
|
50
|
+
const result = containerShowResultSchema.parse(value);
|
|
51
|
+
requireMatch(result.container.id === parameters.containerId &&
|
|
52
|
+
result.projects.length <= parameters.limit);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
const makeContainerConfirmationClient = (request) => ({
|
|
56
|
+
confirmContainerCreate: (parameters, options) => request({ method: "container.create.confirm", parameters }, {
|
|
57
|
+
parse: (value) => parseCreateConfirmation(value, parameters),
|
|
58
|
+
}, options),
|
|
59
|
+
confirmContainerRename: (parameters, options) => request({ method: "container.rename.confirm", parameters }, {
|
|
60
|
+
parse: (value) => parseRenameConfirmation(value, parameters),
|
|
61
|
+
}, options),
|
|
62
|
+
});
|
|
63
|
+
const makeContainerListClient = (request) => ({
|
|
64
|
+
listContainerIndex: (parameters, options) => request({ method: "container.index.list", parameters }, {
|
|
65
|
+
parse: (value) => parseIndex(value, parameters),
|
|
66
|
+
}, options),
|
|
67
|
+
listContainers: (parameters, options) => request({ method: "container.list", parameters }, {
|
|
68
|
+
parse: (value) => parseList(value, parameters),
|
|
69
|
+
}, options),
|
|
70
|
+
});
|
|
71
|
+
const makeContainerPreviewClient = (request) => ({
|
|
72
|
+
previewContainerCreate: (parameters, options) => request({ method: "container.create.preview", parameters }, {
|
|
73
|
+
parse: (value) => parseCreatePreview(value, parameters),
|
|
74
|
+
}, options),
|
|
75
|
+
previewContainerRename: (parameters, options) => request({ method: "container.rename.preview", parameters }, {
|
|
76
|
+
parse: (value) => parseRenamePreview(value, parameters),
|
|
77
|
+
}, options),
|
|
78
|
+
});
|
|
79
|
+
const makeContainerShowClient = (request) => ({
|
|
80
|
+
showContainer: (parameters, options) => request({ method: "container.show", parameters }, {
|
|
81
|
+
parse: (value) => parseShow(value, parameters),
|
|
82
|
+
}, options),
|
|
83
|
+
});
|
|
84
|
+
export const makeContainerOperations = (request) => ({
|
|
85
|
+
...makeContainerConfirmationClient(request),
|
|
86
|
+
...makeContainerPreviewClient(request),
|
|
87
|
+
...makeContainerListClient(request),
|
|
88
|
+
...makeContainerShowClient(request),
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type Container, type ContainerClient, type ContainerCreateConfirmParameters, containerCreateConfirmParametersSchema, type ContainerCreateConfirmResult, type ContainerCreatePreviewParameters, containerCreatePreviewParametersSchema, type ContainerCreatePreviewResult, type ContainerIndexEntry, type ContainerIndexListParameters, containerIndexListParametersSchema, type ContainerIndexListResult, type ContainerIndexProject, type ContainerListParameters, containerListParametersSchema, type ContainerListResult, type ContainerProjectSummary, containerProjectSummarySchema, type ContainerRenameConfirmParameters, containerRenameConfirmParametersSchema, type ContainerRenameConfirmResult, type ContainerRenamePreviewParameters, containerRenamePreviewParametersSchema, type ContainerRenamePreviewResult, containerSchema, type ContainerShowParameters, containerShowParametersSchema, type ContainerShowResult, makeContainerClient, } from "./container.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { containerCreateConfirmParametersSchema, containerCreatePreviewParametersSchema, containerIndexListParametersSchema, containerListParametersSchema, containerProjectSummarySchema, containerRenameConfirmParametersSchema, containerRenamePreviewParametersSchema, containerSchema, containerShowParametersSchema, makeContainerClient, } from "./container.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DiscoverySessionsListParameters, DiscoverySessionsListResult, SessionAdoptConfirmParameters, SessionAdoptConfirmResult, SessionAdoptPreviewParameters, SessionAdoptPreviewResult, SessionHistoryReadParameters, SessionHistoryReadResult } from "@maiaos/protocol";
|
|
2
|
+
import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
|
|
3
|
+
export type DiscoveryClient = {
|
|
4
|
+
readonly confirmSessionAdopt: (parameters: SessionAdoptConfirmParameters, options: LocalNodeRequestOptions) => Promise<SessionAdoptConfirmResult>;
|
|
5
|
+
readonly listDiscoveredSessions: (parameters: DiscoverySessionsListParameters, options: LocalNodeRequestOptions) => Promise<DiscoverySessionsListResult>;
|
|
6
|
+
readonly previewSessionAdopt: (parameters: SessionAdoptPreviewParameters, options: LocalNodeRequestOptions) => Promise<SessionAdoptPreviewResult>;
|
|
7
|
+
readonly readSessionHistory: (parameters: SessionHistoryReadParameters, options: LocalNodeRequestOptions) => Promise<SessionHistoryReadResult>;
|
|
8
|
+
};
|
|
9
|
+
export declare const makeDiscoveryClient: (request: LocalNodeRequester) => DiscoveryClient;
|
|
10
|
+
export { ADOPTION_REFUSED_ERROR_CODE, type DiscoveredSession, type DiscoveryGroup, type DiscoverySessionsListParameters, discoverySessionsListParametersSchema, type DiscoverySessionsListResult, type SessionAdoptConfirmParameters, sessionAdoptConfirmParametersSchema, type SessionAdoptConfirmResult, type SessionAdoptPreviewParameters, sessionAdoptPreviewParametersSchema, type SessionAdoptPreviewResult, type SessionHistoryMessage, type SessionHistoryReadParameters, sessionHistoryReadParametersSchema, type SessionHistoryReadResult, } from "@maiaos/protocol";
|
|
11
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
|
|
2
|
+
import { makeDiscoveryOperations } from "./effect.js";
|
|
3
|
+
export const makeDiscoveryClient = (request) => toPromiseClient(makeDiscoveryOperations(fromPromiseRequester(request)));
|
|
4
|
+
export { ADOPTION_REFUSED_ERROR_CODE, discoverySessionsListParametersSchema, sessionAdoptConfirmParametersSchema, sessionAdoptPreviewParametersSchema, sessionHistoryReadParametersSchema, } from "@maiaos/protocol";
|
|
5
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type EffectClient, type LocalNodeEffectRequester } from "../request/effect.js";
|
|
2
|
+
import { MaiaClientError } from "../request/index.js";
|
|
3
|
+
import type { DiscoveryClient } from "./discovery.js";
|
|
4
|
+
export declare const makeDiscoveryOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<DiscoveryClient, MaiaClientError | TError>;
|
|
5
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { discoverySessionsListResultSchema, sessionAdoptConfirmResultSchema, sessionAdoptPreviewResultSchema, sessionHistoryReadResultSchema, } from "@maiaos/protocol";
|
|
2
|
+
import { verifiedMutation, } from "../request/effect.js";
|
|
3
|
+
import { MaiaClientError, } from "../request/index.js";
|
|
4
|
+
const requireMatch = (matches) => {
|
|
5
|
+
if (!matches)
|
|
6
|
+
throw new MaiaClientError("invalid_response", "The discovery response did not match the request.");
|
|
7
|
+
};
|
|
8
|
+
const parseList = (value, parameters) => {
|
|
9
|
+
const result = discoverySessionsListResultSchema.parse(value);
|
|
10
|
+
requireMatch(result.items.length <= parameters.limit &&
|
|
11
|
+
result.includesContentFields ===
|
|
12
|
+
(parameters.includeContentFields === true) &&
|
|
13
|
+
result.items.every((item) => item.sources.every((source) => parameters.sources.includes(source))));
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
const parseHistory = (value, parameters) => {
|
|
17
|
+
const result = sessionHistoryReadResultSchema.parse(value);
|
|
18
|
+
const target = parameters.target;
|
|
19
|
+
requireMatch(result.messages.length <= parameters.limit &&
|
|
20
|
+
result.offset === (parameters.offset ?? 0) &&
|
|
21
|
+
(target.kind === "session" ||
|
|
22
|
+
(result.executor === target.executor &&
|
|
23
|
+
result.nativeId === target.nativeId)));
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
const parseAdoptPreview = (value, parameters) => {
|
|
27
|
+
const result = sessionAdoptPreviewResultSchema.parse(value);
|
|
28
|
+
requireMatch(result.commandId === parameters.commandId &&
|
|
29
|
+
result.executor === parameters.executor &&
|
|
30
|
+
result.nativeId === parameters.nativeId &&
|
|
31
|
+
result.workspaceId === parameters.workspaceId &&
|
|
32
|
+
result.attestEnded === (parameters.attestEnded === true));
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
const confirmAdoption = (request) => (parameters, options) => verifiedMutation(request({ method: "session.adopt.confirm", parameters }, {
|
|
36
|
+
parse: (value) => sessionAdoptConfirmResultSchema.parse(value),
|
|
37
|
+
}, options), options);
|
|
38
|
+
export const makeDiscoveryOperations = (request) => ({
|
|
39
|
+
confirmSessionAdopt: confirmAdoption(request),
|
|
40
|
+
listDiscoveredSessions: (parameters, options) => request({ method: "discovery.sessions.list", parameters }, { parse: (value) => parseList(value, parameters) }, options),
|
|
41
|
+
previewSessionAdopt: (parameters, options) => request({ method: "session.adopt.preview", parameters }, { parse: (value) => parseAdoptPreview(value, parameters) }, options),
|
|
42
|
+
readSessionHistory: (parameters, options) => request({ method: "session.history.read", parameters }, { parse: (value) => parseHistory(value, parameters) }, options),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ADOPTION_REFUSED_ERROR_CODE, type DiscoveredSession, type DiscoveryClient, type DiscoveryGroup, type DiscoverySessionsListParameters, discoverySessionsListParametersSchema, type DiscoverySessionsListResult, makeDiscoveryClient, type SessionAdoptConfirmParameters, sessionAdoptConfirmParametersSchema, type SessionAdoptConfirmResult, type SessionAdoptPreviewParameters, sessionAdoptPreviewParametersSchema, type SessionAdoptPreviewResult, type SessionHistoryMessage, type SessionHistoryReadParameters, sessionHistoryReadParametersSchema, type SessionHistoryReadResult, } from "./discovery.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EffectClient, LocalNodeEffectRequester } from "../request/effect.js";
|
|
2
|
+
import type { ExecutionRelocationClient } from "./relocation.js";
|
|
3
|
+
export declare const makeExecutionRelocationOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<ExecutionRelocationClient, TError>;
|
|
4
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { executionRelocationApplyResultSchema, executionRelocationPlanResultSchema, executionRelocationReconcileResultSchema, executionRelocationShowResultSchema, } from "@maiaos/protocol/execution-candidate";
|
|
2
|
+
export const makeExecutionRelocationOperations = (request) => ({
|
|
3
|
+
applyExecutionRelocation: (parameters, options) => request({ method: "execution.relocation.apply", parameters }, executionRelocationApplyResultSchema, options),
|
|
4
|
+
planExecutionRelocation: (parameters, options) => request({ method: "execution.relocation.plan", parameters }, executionRelocationPlanResultSchema, options),
|
|
5
|
+
reconcileExecutionRelocation: (parameters, options) => request({ method: "execution.relocation.reconcile", parameters }, executionRelocationReconcileResultSchema, options),
|
|
6
|
+
showExecutionRelocation: (parameters, options) => request({ method: "execution.relocation.show", parameters }, executionRelocationShowResultSchema, options),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExecutionRelocationApplyParameters, ExecutionRelocationApplyResult, ExecutionRelocationPlanParameters, ExecutionRelocationPlanResult, ExecutionRelocationReconcileParameters, ExecutionRelocationReconcileResult, ExecutionRelocationShowParameters, ExecutionRelocationShowResult } from "@maiaos/protocol/execution-candidate";
|
|
2
|
+
import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
|
|
3
|
+
export type ExecutionRelocationClient = {
|
|
4
|
+
readonly applyExecutionRelocation: (parameters: ExecutionRelocationApplyParameters, options: LocalNodeRequestOptions) => Promise<ExecutionRelocationApplyResult>;
|
|
5
|
+
readonly planExecutionRelocation: (parameters: ExecutionRelocationPlanParameters, options: LocalNodeRequestOptions) => Promise<ExecutionRelocationPlanResult>;
|
|
6
|
+
readonly reconcileExecutionRelocation: (parameters: ExecutionRelocationReconcileParameters, options: LocalNodeRequestOptions) => Promise<ExecutionRelocationReconcileResult>;
|
|
7
|
+
readonly showExecutionRelocation: (parameters: ExecutionRelocationShowParameters, options: LocalNodeRequestOptions) => Promise<ExecutionRelocationShowResult>;
|
|
8
|
+
};
|
|
9
|
+
export declare const makeExecutionRelocationClient: (request: LocalNodeRequester) => ExecutionRelocationClient;
|
|
10
|
+
//# sourceMappingURL=relocation.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
|
|
2
|
+
import { makeExecutionRelocationOperations } from "./effect.js";
|
|
3
|
+
export const makeExecutionRelocationClient = (request) => toPromiseClient(makeExecutionRelocationOperations(fromPromiseRequester(request)));
|
|
4
|
+
//# sourceMappingURL=relocation.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MaiaRegisteredFeatureOperation } from "@maiaos/protocol/feature-registry";
|
|
2
|
+
import type { LocalNodeClient } from "../client/index.js";
|
|
3
|
+
import type { VoiceOrchestratorClient } from "../voice/index.js";
|
|
4
|
+
type FeatureSdkClient<TClient> = TClient extends "local-node" ? LocalNodeClient : TClient extends "voice-orchestrator" ? VoiceOrchestratorClient : Record<never, never>;
|
|
5
|
+
type UnboundFeatureOperation = MaiaRegisteredFeatureOperation extends infer TOperation ? TOperation extends MaiaRegisteredFeatureOperation ? TOperation["sdk"]["operation"] extends keyof FeatureSdkClient<TOperation["sdk"]["client"]> ? never : TOperation["method"] : never : never;
|
|
6
|
+
export declare const SDK_FEATURE_BINDINGS_ARE_VALID: [UnboundFeatureOperation] extends [
|
|
7
|
+
never
|
|
8
|
+
] ? true : never;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=feature-bindings.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type EffectClient, type LocalNodeEffectRequester } from "../request/effect.js";
|
|
2
|
+
import { MaiaClientError } from "../request/index.js";
|
|
3
|
+
import type { HoldClient } from "./hold.js";
|
|
4
|
+
export declare const makeHoldOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<HoldClient, MaiaClientError | TError>;
|
|
5
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { holdListResultSchema, holdPlaceConfirmResultSchema, holdPlacePreviewResultSchema, holdReleaseConfirmResultSchema, holdReleasePreviewResultSchema, } from "@maiaos/protocol";
|
|
2
|
+
import { verifiedMutation, } from "../request/effect.js";
|
|
3
|
+
import { MaiaClientError } from "../request/index.js";
|
|
4
|
+
const requireMatch = (matches) => {
|
|
5
|
+
if (!matches)
|
|
6
|
+
throw new MaiaClientError("invalid_response", "The hold response did not match the request.");
|
|
7
|
+
};
|
|
8
|
+
const targetKeys = (targets) => targets
|
|
9
|
+
.map((target) => `${target.kind}:${target.id}`)
|
|
10
|
+
.toSorted()
|
|
11
|
+
.join("\n");
|
|
12
|
+
const placeMatches = (result, input) => result.commandId === input.commandId &&
|
|
13
|
+
result.reason === input.reason.trim() &&
|
|
14
|
+
result.running === input.running &&
|
|
15
|
+
targetKeys(result.targets) === targetKeys(input.targets);
|
|
16
|
+
const parsePlacePreview = (value, parameters) => {
|
|
17
|
+
const result = holdPlacePreviewResultSchema.parse(value);
|
|
18
|
+
requireMatch(placeMatches(result, parameters));
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
const parsePlaceConfirmation = (value, parameters) => {
|
|
22
|
+
const result = holdPlaceConfirmResultSchema.parse(value);
|
|
23
|
+
requireMatch(result.inputDigest === parameters.inputDigest &&
|
|
24
|
+
placeMatches({ ...result.hold, commandId: result.commandId }, parameters));
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
const parseReleasePreview = (value, parameters) => {
|
|
28
|
+
const result = holdReleasePreviewResultSchema.parse(value);
|
|
29
|
+
requireMatch(result.commandId === parameters.commandId &&
|
|
30
|
+
result.holdId === parameters.holdId &&
|
|
31
|
+
result.expectedRevision === parameters.expectedRevision);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
const parseReleaseConfirmation = (value, parameters) => {
|
|
35
|
+
const result = holdReleaseConfirmResultSchema.parse(value);
|
|
36
|
+
requireMatch(result.commandId === parameters.commandId &&
|
|
37
|
+
result.inputDigest === parameters.inputDigest &&
|
|
38
|
+
result.hold.id === parameters.holdId &&
|
|
39
|
+
result.expectedRevision === parameters.expectedRevision);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
const parseList = (value, parameters) => {
|
|
43
|
+
const result = holdListResultSchema.parse(value);
|
|
44
|
+
requireMatch(result.items.length <= parameters.limit &&
|
|
45
|
+
result.items.every((hold) => parameters.state === undefined || hold.state === parameters.state));
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
const makeHoldPlaceClient = (request) => ({
|
|
49
|
+
confirmHoldPlace: (parameters, options) => verifiedMutation(request({ method: "hold.place.confirm", parameters }, { parse: (value) => parsePlaceConfirmation(value, parameters) }, options), options),
|
|
50
|
+
previewHoldPlace: (parameters, options) => request({ method: "hold.place.preview", parameters }, { parse: (value) => parsePlacePreview(value, parameters) }, options),
|
|
51
|
+
});
|
|
52
|
+
const makeHoldReleaseClient = (request) => ({
|
|
53
|
+
confirmHoldRelease: (parameters, options) => verifiedMutation(request({ method: "hold.release.confirm", parameters }, { parse: (value) => parseReleaseConfirmation(value, parameters) }, options), options),
|
|
54
|
+
previewHoldRelease: (parameters, options) => request({ method: "hold.release.preview", parameters }, { parse: (value) => parseReleasePreview(value, parameters) }, options),
|
|
55
|
+
});
|
|
56
|
+
export const makeHoldOperations = (request) => ({
|
|
57
|
+
...makeHoldPlaceClient(request),
|
|
58
|
+
...makeHoldReleaseClient(request),
|
|
59
|
+
listHolds: (parameters, options) => request({ method: "hold.list", parameters }, { parse: (value) => parseList(value, parameters) }, options),
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HoldListParameters, HoldListResult, HoldPlaceConfirmParameters, HoldPlaceConfirmResult, HoldPlacePreviewParameters, HoldPlacePreviewResult, HoldReleaseConfirmParameters, HoldReleaseConfirmResult, HoldReleasePreviewParameters, HoldReleasePreviewResult } from "@maiaos/protocol";
|
|
2
|
+
import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
|
|
3
|
+
export type HoldClient = {
|
|
4
|
+
readonly confirmHoldPlace: (parameters: HoldPlaceConfirmParameters, options: LocalNodeRequestOptions) => Promise<HoldPlaceConfirmResult>;
|
|
5
|
+
readonly confirmHoldRelease: (parameters: HoldReleaseConfirmParameters, options: LocalNodeRequestOptions) => Promise<HoldReleaseConfirmResult>;
|
|
6
|
+
readonly listHolds: (parameters: HoldListParameters, options: LocalNodeRequestOptions) => Promise<HoldListResult>;
|
|
7
|
+
readonly previewHoldPlace: (parameters: HoldPlacePreviewParameters, options: LocalNodeRequestOptions) => Promise<HoldPlacePreviewResult>;
|
|
8
|
+
readonly previewHoldRelease: (parameters: HoldReleasePreviewParameters, options: LocalNodeRequestOptions) => Promise<HoldReleasePreviewResult>;
|
|
9
|
+
};
|
|
10
|
+
export declare const makeHoldClient: (request: LocalNodeRequester) => HoldClient;
|
|
11
|
+
export { type Hold, HOLD_ADMISSION_ERROR_CODE, type HoldListParameters, holdListParametersSchema, type HoldListResult, type HoldPlaceConfirmParameters, holdPlaceConfirmParametersSchema, type HoldPlaceConfirmResult, type HoldPlacePreviewParameters, holdPlacePreviewParametersSchema, type HoldPlacePreviewResult, type HoldReleaseConfirmParameters, holdReleaseConfirmParametersSchema, type HoldReleaseConfirmResult, type HoldReleasePreviewParameters, holdReleasePreviewParametersSchema, type HoldReleasePreviewResult, holdSchema, type HoldSession, type HoldTarget, } from "@maiaos/protocol";
|
|
12
|
+
//# sourceMappingURL=hold.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
|
|
2
|
+
import { makeHoldOperations } from "./effect.js";
|
|
3
|
+
export const makeHoldClient = (request) => toPromiseClient(makeHoldOperations(fromPromiseRequester(request)));
|
|
4
|
+
export { HOLD_ADMISSION_ERROR_CODE, holdListParametersSchema, holdPlaceConfirmParametersSchema, holdPlacePreviewParametersSchema, holdReleaseConfirmParametersSchema, holdReleasePreviewParametersSchema, holdSchema, } from "@maiaos/protocol";
|
|
5
|
+
//# sourceMappingURL=hold.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type Hold, HOLD_ADMISSION_ERROR_CODE, type HoldClient, type HoldListParameters, holdListParametersSchema, type HoldListResult, type HoldPlaceConfirmParameters, holdPlaceConfirmParametersSchema, type HoldPlaceConfirmResult, type HoldPlacePreviewParameters, holdPlacePreviewParametersSchema, type HoldPlacePreviewResult, type HoldReleaseConfirmParameters, holdReleaseConfirmParametersSchema, type HoldReleaseConfirmResult, type HoldReleasePreviewParameters, holdReleasePreviewParametersSchema, type HoldReleasePreviewResult, holdSchema, type HoldSession, type HoldTarget, makeHoldClient, } from "./hold.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { HOLD_ADMISSION_ERROR_CODE, holdListParametersSchema, holdPlaceConfirmParametersSchema, holdPlacePreviewParametersSchema, holdReleaseConfirmParametersSchema, holdReleasePreviewParametersSchema, holdSchema, makeHoldClient, } from "./hold.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|