@7k-inari/api-client 0.6.0 → 0.7.0-180bdb0
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/gen/ts/proto/inari/agent/v1/agent_pb.ts +201 -286
- package/gen/ts/proto/inari/agent/v1/commands_pb.ts +271 -601
- package/gen/ts/proto/inari/agent/v1/credentials_pb.ts +87 -0
- package/gen/ts/proto/inari/agent/v1/events_pb.ts +298 -482
- package/gen/ts/proto/inari/agent/v1/registration_pb.ts +87 -114
- package/gen/ts/proto/inari/plugin/v1/plugin_pb.ts +340 -463
- package/gen/ts/proto/inari/tunnel/v1/tunnel_pb.ts +231 -0
- package/gen/ts/proto/inari/tunnel/v2/tunnel_pb.ts +252 -0
- package/gen/ts/rest/client.ts +2643 -1878
- package/gen/ts/smoke.ts +60 -30
- package/package.json +7 -7
- package/gen/ts/proto/inari/agent/v1/agent_connect.ts +0 -30
- package/gen/ts/proto/inari/agent/v1/registration_connect.ts +0 -30
- package/gen/ts/proto/inari/plugin/v1/plugin_connect.ts +0 -56
package/gen/ts/smoke.ts
CHANGED
|
@@ -1,45 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
|
|
2
|
+
import {
|
|
3
|
+
ConnectRequestSchema,
|
|
4
|
+
EventSchema,
|
|
5
|
+
EventType,
|
|
6
|
+
} from "./proto/inari/agent/v1/agent_pb";
|
|
2
7
|
import {
|
|
3
8
|
CapabilityAction,
|
|
4
9
|
CapabilityKind,
|
|
5
|
-
|
|
10
|
+
CapabilityUpdateSchema,
|
|
6
11
|
ManagementMode,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
PingSchema,
|
|
13
|
+
ResyncResponseSchema,
|
|
14
|
+
StatusUpdateSchema,
|
|
10
15
|
} from "./proto/inari/agent/v1/events_pb";
|
|
11
16
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
ApplyBundleSchema,
|
|
18
|
+
CommandAckSchema,
|
|
14
19
|
CommandResult,
|
|
15
20
|
CommitPolicy,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
InvokeActionSchema,
|
|
22
|
+
RegisterArgoCDAppSchema,
|
|
23
|
+
RenderRgdInstanceSchema,
|
|
19
24
|
} from "./proto/inari/agent/v1/commands_pb";
|
|
20
25
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
RegisterClusterRequestSchema,
|
|
27
|
+
RegisterClusterResponseSchema,
|
|
28
|
+
RegistrationService,
|
|
23
29
|
} from "./proto/inari/agent/v1/registration_pb";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
30
|
+
import { EventStreamService } from "./proto/inari/agent/v1/agent_pb";
|
|
31
|
+
import {
|
|
32
|
+
TunnelCloseSchema,
|
|
33
|
+
TunnelMessageSchema,
|
|
34
|
+
TunnelOpenSchema,
|
|
35
|
+
TunnelService,
|
|
36
|
+
} from "./proto/inari/tunnel/v1/tunnel_pb";
|
|
37
|
+
import { getHealth, getGetClusterKubeconfigUrl } from "./rest/client";
|
|
27
38
|
|
|
28
|
-
const event =
|
|
39
|
+
const event = create(EventSchema, {
|
|
29
40
|
eventId: "evt-1",
|
|
30
41
|
resourceId: "res-1",
|
|
31
42
|
type: "inari.agent.heartbeat.v1",
|
|
32
43
|
sequence: 7n,
|
|
33
44
|
});
|
|
34
|
-
const bytes =
|
|
35
|
-
const decoded =
|
|
45
|
+
const bytes = toBinary(EventSchema, event);
|
|
46
|
+
const decoded = fromBinary(EventSchema, bytes);
|
|
36
47
|
if (decoded.eventId !== "evt-1") throw new Error("round trip failed");
|
|
37
48
|
if (decoded.sequence !== 7n) throw new Error("sequence round trip failed");
|
|
38
49
|
|
|
39
|
-
const req =
|
|
50
|
+
const req = create(ConnectRequestSchema, { event });
|
|
40
51
|
if (req.event?.type !== event.type) throw new Error("wrapper failed");
|
|
41
52
|
|
|
42
|
-
const cap =
|
|
53
|
+
const cap = create(CapabilityUpdateSchema, {
|
|
43
54
|
fullSync: true,
|
|
44
55
|
stateChecksum: "sha256:abc",
|
|
45
56
|
capabilities: [
|
|
@@ -53,36 +64,55 @@ const cap = new CapabilityUpdate({
|
|
|
53
64
|
});
|
|
54
65
|
if (cap.capabilities[0]?.kind !== CapabilityKind.CRD) throw new Error("capability failed");
|
|
55
66
|
|
|
56
|
-
const status =
|
|
67
|
+
const status = create(StatusUpdateSchema, { message: "ok" });
|
|
57
68
|
if (status.message !== "ok") throw new Error("status failed");
|
|
58
69
|
|
|
59
|
-
const ping =
|
|
70
|
+
const ping = create(PingSchema, { sequence: 1n });
|
|
60
71
|
if (ping.sequence !== 1n) throw new Error("ping failed");
|
|
61
72
|
|
|
62
|
-
const resync =
|
|
73
|
+
const resync = create(ResyncResponseSchema, { appliedThroughSequence: 42n });
|
|
63
74
|
if (resync.appliedThroughSequence !== 42n) throw new Error("resync failed");
|
|
64
75
|
|
|
65
|
-
const bundle =
|
|
76
|
+
const bundle = create(ApplyBundleSchema, {
|
|
66
77
|
commandId: "cmd-1",
|
|
67
78
|
source: { case: "ociRef", value: "oci://registry/bundle:v1" },
|
|
68
79
|
policy: CommitPolicy.PULL_REQUEST,
|
|
69
80
|
});
|
|
70
81
|
if (bundle.source.case !== "ociRef") throw new Error("apply-bundle failed");
|
|
71
82
|
|
|
72
|
-
const app =
|
|
73
|
-
const action =
|
|
74
|
-
const rgd =
|
|
75
|
-
const ack =
|
|
83
|
+
const app = create(RegisterArgoCDAppSchema, { commandId: "cmd-2", name: "web" });
|
|
84
|
+
const action = create(InvokeActionSchema, { commandId: "cmd-3", action: "restart" });
|
|
85
|
+
const rgd = create(RenderRgdInstanceSchema, { commandId: "cmd-4", rgdRef: "oci://registry/rgd:v1" });
|
|
86
|
+
const ack = create(CommandAckSchema, { commandId: "cmd-1", result: CommandResult.APPLIED });
|
|
76
87
|
void [app, action, rgd, ack];
|
|
77
88
|
|
|
78
|
-
const regReq =
|
|
79
|
-
const regResp =
|
|
89
|
+
const regReq = create(RegisterClusterRequestSchema, { registrationToken: "tok-1" });
|
|
90
|
+
const regResp = create(RegisterClusterResponseSchema, { clientId: "cluster-1" });
|
|
80
91
|
if (regReq.registrationToken !== "tok-1" || regResp.clientId !== "cluster-1") {
|
|
81
92
|
throw new Error("registration failed");
|
|
82
93
|
}
|
|
83
94
|
|
|
84
95
|
if (EventType.CAPABILITY_UPDATE !== 1) throw new Error("enum failed");
|
|
85
96
|
|
|
97
|
+
const tunnelOpen = create(TunnelMessageSchema, {
|
|
98
|
+
connectionId: "conn-1",
|
|
99
|
+
payload: { case: "open", value: create(TunnelOpenSchema, { method: "GET", path: "/api/v1/pods" }) },
|
|
100
|
+
});
|
|
101
|
+
const tunnelBytes = toBinary(TunnelMessageSchema, tunnelOpen);
|
|
102
|
+
const tunnelDecoded = fromBinary(TunnelMessageSchema, tunnelBytes);
|
|
103
|
+
if (tunnelDecoded.payload.case !== "open" || tunnelDecoded.payload.value.method !== "GET") {
|
|
104
|
+
throw new Error("tunnel open round trip failed");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const tunnelClose = create(TunnelMessageSchema, {
|
|
108
|
+
connectionId: "conn-1",
|
|
109
|
+
payload: { case: "close", value: create(TunnelCloseSchema, { reason: "done" }) },
|
|
110
|
+
});
|
|
111
|
+
if (tunnelClose.payload.case !== "close") throw new Error("tunnel close payload failed");
|
|
112
|
+
|
|
113
|
+
void TunnelService;
|
|
114
|
+
void getGetClusterKubeconfigUrl;
|
|
115
|
+
|
|
86
116
|
void RegistrationService;
|
|
87
117
|
void EventStreamService;
|
|
88
118
|
void getHealth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7k-inari/api-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-180bdb0",
|
|
4
4
|
"description": "Generated TypeScript client for the Inari control plane contract (inari-api).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"typecheck": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@bufbuild/protobuf": "^
|
|
18
|
-
"@connectrpc/connect": "^
|
|
17
|
+
"@bufbuild/protobuf": "^2.16.0",
|
|
18
|
+
"@connectrpc/connect": "^2.2.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@redocly/cli": "^
|
|
22
|
-
"orval": "^
|
|
23
|
-
"typescript": "^
|
|
21
|
+
"@redocly/cli": "^2.0.0",
|
|
22
|
+
"orval": "^8.0.0",
|
|
23
|
+
"typescript": "^7.0.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "https://github.com/7K-Inari/inari-api"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts"
|
|
2
|
-
// @generated from file inari/agent/v1/agent.proto (package inari.agent.v1, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
|
|
6
|
-
import { ConnectRequest, ConnectResponse } from "./agent_pb.js";
|
|
7
|
-
import { MethodKind } from "@bufbuild/protobuf";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* EventStreamService is the bidirectional gRPC stream between an in-cluster
|
|
11
|
-
* agent and the Agent Gateway (plan §5.2). Delivery is at-least-once;
|
|
12
|
-
* command handlers must be idempotent (command_id is the idempotency key).
|
|
13
|
-
*
|
|
14
|
-
* @generated from service inari.agent.v1.EventStreamService
|
|
15
|
-
*/
|
|
16
|
-
export const EventStreamService = {
|
|
17
|
-
typeName: "inari.agent.v1.EventStreamService",
|
|
18
|
-
methods: {
|
|
19
|
-
/**
|
|
20
|
-
* @generated from rpc inari.agent.v1.EventStreamService.Connect
|
|
21
|
-
*/
|
|
22
|
-
connect: {
|
|
23
|
-
name: "Connect",
|
|
24
|
-
I: ConnectRequest,
|
|
25
|
-
O: ConnectResponse,
|
|
26
|
-
kind: MethodKind.BiDiStreaming,
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts"
|
|
2
|
-
// @generated from file inari/agent/v1/registration.proto (package inari.agent.v1, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
|
|
6
|
-
import { RegisterClusterRequest, RegisterClusterResponse } from "./registration_pb.js";
|
|
7
|
-
import { MethodKind } from "@bufbuild/protobuf";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* RegistrationService is the one-time bootstrap RPC an agent calls before it
|
|
11
|
-
* can open the EventStream (plan §5.3). It is unauthenticated except for the
|
|
12
|
-
* registration token itself.
|
|
13
|
-
*
|
|
14
|
-
* @generated from service inari.agent.v1.RegistrationService
|
|
15
|
-
*/
|
|
16
|
-
export const RegistrationService = {
|
|
17
|
-
typeName: "inari.agent.v1.RegistrationService",
|
|
18
|
-
methods: {
|
|
19
|
-
/**
|
|
20
|
-
* @generated from rpc inari.agent.v1.RegistrationService.RegisterCluster
|
|
21
|
-
*/
|
|
22
|
-
registerCluster: {
|
|
23
|
-
name: "RegisterCluster",
|
|
24
|
-
I: RegisterClusterRequest,
|
|
25
|
-
O: RegisterClusterResponse,
|
|
26
|
-
kind: MethodKind.Unary,
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts"
|
|
2
|
-
// @generated from file inari/plugin/v1/plugin.proto (package inari.plugin.v1, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
|
|
6
|
-
import { GetCapabilitiesRequest, GetCapabilitiesResponse, GetInfoRequest, GetInfoResponse, HealthCheckRequest, HealthCheckResponse, InvokeRequest, InvokeResponse } from "./plugin_pb.js";
|
|
7
|
-
import { MethodKind } from "@bufbuild/protobuf";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* PluginContractService is the versioned gRPC surface every plugin serves
|
|
11
|
-
* (platform plan §5.8). Changes are additive within inari.plugin.v1.
|
|
12
|
-
*
|
|
13
|
-
* @generated from service inari.plugin.v1.PluginContractService
|
|
14
|
-
*/
|
|
15
|
-
export const PluginContractService = {
|
|
16
|
-
typeName: "inari.plugin.v1.PluginContractService",
|
|
17
|
-
methods: {
|
|
18
|
-
/**
|
|
19
|
-
* @generated from rpc inari.plugin.v1.PluginContractService.GetInfo
|
|
20
|
-
*/
|
|
21
|
-
getInfo: {
|
|
22
|
-
name: "GetInfo",
|
|
23
|
-
I: GetInfoRequest,
|
|
24
|
-
O: GetInfoResponse,
|
|
25
|
-
kind: MethodKind.Unary,
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* @generated from rpc inari.plugin.v1.PluginContractService.GetCapabilities
|
|
29
|
-
*/
|
|
30
|
-
getCapabilities: {
|
|
31
|
-
name: "GetCapabilities",
|
|
32
|
-
I: GetCapabilitiesRequest,
|
|
33
|
-
O: GetCapabilitiesResponse,
|
|
34
|
-
kind: MethodKind.Unary,
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* @generated from rpc inari.plugin.v1.PluginContractService.Invoke
|
|
38
|
-
*/
|
|
39
|
-
invoke: {
|
|
40
|
-
name: "Invoke",
|
|
41
|
-
I: InvokeRequest,
|
|
42
|
-
O: InvokeResponse,
|
|
43
|
-
kind: MethodKind.Unary,
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* @generated from rpc inari.plugin.v1.PluginContractService.HealthCheck
|
|
47
|
-
*/
|
|
48
|
-
healthCheck: {
|
|
49
|
-
name: "HealthCheck",
|
|
50
|
-
I: HealthCheckRequest,
|
|
51
|
-
O: HealthCheckResponse,
|
|
52
|
-
kind: MethodKind.Unary,
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
} as const;
|
|
56
|
-
|