@forwardimpact/librpc 0.1.106 → 0.1.107
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/package.json +3 -1
- package/src/generated/definitions/bridge.js +260 -0
- package/src/generated/definitions/embedding.js +29 -0
- package/src/generated/definitions/exports.js +43 -0
- package/src/generated/definitions/ghserver.js +29 -0
- package/src/generated/definitions/ghuser.js +113 -0
- package/src/generated/definitions/graph.js +71 -0
- package/src/generated/definitions/map.js +92 -0
- package/src/generated/definitions/pathway.js +155 -0
- package/src/generated/definitions/tenancy.js +155 -0
- package/src/generated/definitions/trace.js +50 -0
- package/src/generated/definitions/vector.js +29 -0
- package/src/generated/services/bridge/client.js +264 -0
- package/src/generated/services/bridge/service.js +244 -0
- package/src/generated/services/embedding/client.js +44 -0
- package/src/generated/services/embedding/service.js +46 -0
- package/src/generated/services/exports.js +103 -0
- package/src/generated/services/ghserver/client.js +44 -0
- package/src/generated/services/ghserver/service.js +46 -0
- package/src/generated/services/ghuser/client.js +124 -0
- package/src/generated/services/ghuser/service.js +118 -0
- package/src/generated/services/graph/client.js +84 -0
- package/src/generated/services/graph/service.js +82 -0
- package/src/generated/services/map/client.js +104 -0
- package/src/generated/services/map/service.js +100 -0
- package/src/generated/services/pathway/client.js +164 -0
- package/src/generated/services/pathway/service.js +154 -0
- package/src/generated/services/tenancy/client.js +164 -0
- package/src/generated/services/tenancy/service.js +154 -0
- package/src/generated/services/trace/client.js +64 -0
- package/src/generated/services/trace/service.js +64 -0
- package/src/generated/services/vector/client.js +44 -0
- package/src/generated/services/vector/service.js +46 -0
- package/src/generated/types/metadata.js +994 -0
- package/src/generated/types/types.js +20852 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { pathway, tool } from "@forwardimpact/libtype";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for Pathway service implementation
|
|
7
|
+
*/
|
|
8
|
+
export class PathwayBase {
|
|
9
|
+
config;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Pathway service instance
|
|
13
|
+
* @param {object} config - Service configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(config) {
|
|
16
|
+
if (!config) throw new Error("config is required");
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Must be implemented by subclass
|
|
22
|
+
* @param { pathway.ListJobsRequest } req - Request parameters
|
|
23
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
24
|
+
*/
|
|
25
|
+
async ListJobs(req) {
|
|
26
|
+
throw new Error("ListJobs not implemented");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Must be implemented by subclass
|
|
31
|
+
* @param { pathway.DescribeJobRequest } req - Request parameters
|
|
32
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
33
|
+
*/
|
|
34
|
+
async DescribeJob(req) {
|
|
35
|
+
throw new Error("DescribeJob not implemented");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Must be implemented by subclass
|
|
40
|
+
* @param { pathway.ListAgentProfilesRequest } req - Request parameters
|
|
41
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
42
|
+
*/
|
|
43
|
+
async ListAgentProfiles(req) {
|
|
44
|
+
throw new Error("ListAgentProfiles not implemented");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Must be implemented by subclass
|
|
49
|
+
* @param { pathway.DescribeAgentProfileRequest } req - Request parameters
|
|
50
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
51
|
+
*/
|
|
52
|
+
async DescribeAgentProfile(req) {
|
|
53
|
+
throw new Error("DescribeAgentProfile not implemented");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Must be implemented by subclass
|
|
58
|
+
* @param { pathway.DescribeProgressionRequest } req - Request parameters
|
|
59
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
60
|
+
*/
|
|
61
|
+
async DescribeProgression(req) {
|
|
62
|
+
throw new Error("DescribeProgression not implemented");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Must be implemented by subclass
|
|
67
|
+
* @param { pathway.ListJobSoftwareRequest } req - Request parameters
|
|
68
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
69
|
+
*/
|
|
70
|
+
async ListJobSoftware(req) {
|
|
71
|
+
throw new Error("ListJobSoftware not implemented");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Must be implemented by subclass
|
|
76
|
+
* @param { pathway.GetMarkersForProfileRequest } req - Request parameters
|
|
77
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
78
|
+
*/
|
|
79
|
+
async GetMarkersForProfile(req) {
|
|
80
|
+
throw new Error("GetMarkersForProfile not implemented");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates gRPC handlers for this service instance
|
|
85
|
+
* @returns { object } Map of method names to handler functions
|
|
86
|
+
*/
|
|
87
|
+
getHandlers() {
|
|
88
|
+
return {
|
|
89
|
+
ListJobs: async (call) => {
|
|
90
|
+
// Validate and convert request
|
|
91
|
+
const error = pathway.ListJobsRequest.verify(call.request);
|
|
92
|
+
if (error) throw new Error(`ListJobs: ${error}`);
|
|
93
|
+
const req = pathway.ListJobsRequest.fromObject(call.request);
|
|
94
|
+
|
|
95
|
+
// Call implementation
|
|
96
|
+
return await this.ListJobs(req);
|
|
97
|
+
},
|
|
98
|
+
DescribeJob: async (call) => {
|
|
99
|
+
// Validate and convert request
|
|
100
|
+
const error = pathway.DescribeJobRequest.verify(call.request);
|
|
101
|
+
if (error) throw new Error(`DescribeJob: ${error}`);
|
|
102
|
+
const req = pathway.DescribeJobRequest.fromObject(call.request);
|
|
103
|
+
|
|
104
|
+
// Call implementation
|
|
105
|
+
return await this.DescribeJob(req);
|
|
106
|
+
},
|
|
107
|
+
ListAgentProfiles: async (call) => {
|
|
108
|
+
// Validate and convert request
|
|
109
|
+
const error = pathway.ListAgentProfilesRequest.verify(call.request);
|
|
110
|
+
if (error) throw new Error(`ListAgentProfiles: ${error}`);
|
|
111
|
+
const req = pathway.ListAgentProfilesRequest.fromObject(call.request);
|
|
112
|
+
|
|
113
|
+
// Call implementation
|
|
114
|
+
return await this.ListAgentProfiles(req);
|
|
115
|
+
},
|
|
116
|
+
DescribeAgentProfile: async (call) => {
|
|
117
|
+
// Validate and convert request
|
|
118
|
+
const error = pathway.DescribeAgentProfileRequest.verify(call.request);
|
|
119
|
+
if (error) throw new Error(`DescribeAgentProfile: ${error}`);
|
|
120
|
+
const req = pathway.DescribeAgentProfileRequest.fromObject(call.request);
|
|
121
|
+
|
|
122
|
+
// Call implementation
|
|
123
|
+
return await this.DescribeAgentProfile(req);
|
|
124
|
+
},
|
|
125
|
+
DescribeProgression: async (call) => {
|
|
126
|
+
// Validate and convert request
|
|
127
|
+
const error = pathway.DescribeProgressionRequest.verify(call.request);
|
|
128
|
+
if (error) throw new Error(`DescribeProgression: ${error}`);
|
|
129
|
+
const req = pathway.DescribeProgressionRequest.fromObject(call.request);
|
|
130
|
+
|
|
131
|
+
// Call implementation
|
|
132
|
+
return await this.DescribeProgression(req);
|
|
133
|
+
},
|
|
134
|
+
ListJobSoftware: async (call) => {
|
|
135
|
+
// Validate and convert request
|
|
136
|
+
const error = pathway.ListJobSoftwareRequest.verify(call.request);
|
|
137
|
+
if (error) throw new Error(`ListJobSoftware: ${error}`);
|
|
138
|
+
const req = pathway.ListJobSoftwareRequest.fromObject(call.request);
|
|
139
|
+
|
|
140
|
+
// Call implementation
|
|
141
|
+
return await this.ListJobSoftware(req);
|
|
142
|
+
},
|
|
143
|
+
GetMarkersForProfile: async (call) => {
|
|
144
|
+
// Validate and convert request
|
|
145
|
+
const error = pathway.GetMarkersForProfileRequest.verify(call.request);
|
|
146
|
+
if (error) throw new Error(`GetMarkersForProfile: ${error}`);
|
|
147
|
+
const req = pathway.GetMarkersForProfileRequest.fromObject(call.request);
|
|
148
|
+
|
|
149
|
+
// Call implementation
|
|
150
|
+
return await this.GetMarkersForProfile(req);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { Client } from "@forwardimpact/librpc/client.js";
|
|
4
|
+
import { createAuth, createGrpc } from "@forwardimpact/librpc/base.js";
|
|
5
|
+
import { createObserver } from "@forwardimpact/libtelemetry";
|
|
6
|
+
import { tenancy } from "@forwardimpact/libtype";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Typed client for the Tenancy gRPC service.
|
|
10
|
+
* Extends the `Client` class for shared gRPC client functionality.
|
|
11
|
+
*/
|
|
12
|
+
export class TenancyClient extends Client {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Tenancy client instance
|
|
15
|
+
* @param {object} config - Service configuration
|
|
16
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime} runtime - Injected runtime bag (required; the default auth factory reads SERVICE_SECRET from it)
|
|
17
|
+
* @param {import("@forwardimpact/libtelemetry").Logger} [logger] - Optional logger instance
|
|
18
|
+
* @param {import("@forwardimpact/libtelemetry").Tracer} [tracer] - Optional tracer for distributed tracing
|
|
19
|
+
* @param {Function} [authFn] - Optional authentication function
|
|
20
|
+
*/
|
|
21
|
+
constructor(config, runtime, logger = null, tracer = null, authFn = createAuth) {
|
|
22
|
+
super(config, runtime, logger, tracer, createObserver, createGrpc, authFn);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Call the `ResolveByChannelKey` RPC with request/response type conversion.
|
|
27
|
+
* @param { tenancy.ChannelTenantKey } req - Typed request message.
|
|
28
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
29
|
+
*/
|
|
30
|
+
async ResolveByChannelKey(req) {
|
|
31
|
+
// Type validation
|
|
32
|
+
if (!(req instanceof tenancy.ChannelTenantKey)) {
|
|
33
|
+
throw new TypeError(
|
|
34
|
+
`ResolveByChannelKey: Expected parameter to be instanceof tenancy.ChannelTenantKey`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Convert to plain object
|
|
39
|
+
const request = tenancy.ChannelTenantKey.toObject(req);
|
|
40
|
+
|
|
41
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
42
|
+
return this.callUnary("ResolveByChannelKey", request, (res) => tenancy.Tenant.fromObject(res));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Call the `ResolveByRepo` RPC with request/response type conversion.
|
|
47
|
+
* @param { tenancy.RepoKey } req - Typed request message.
|
|
48
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
49
|
+
*/
|
|
50
|
+
async ResolveByRepo(req) {
|
|
51
|
+
// Type validation
|
|
52
|
+
if (!(req instanceof tenancy.RepoKey)) {
|
|
53
|
+
throw new TypeError(
|
|
54
|
+
`ResolveByRepo: Expected parameter to be instanceof tenancy.RepoKey`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Convert to plain object
|
|
59
|
+
const request = tenancy.RepoKey.toObject(req);
|
|
60
|
+
|
|
61
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
62
|
+
return this.callUnary("ResolveByRepo", request, (res) => tenancy.Tenant.fromObject(res));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Call the `ResolveByTenantId` RPC with request/response type conversion.
|
|
67
|
+
* @param { tenancy.TenantIdKey } req - Typed request message.
|
|
68
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
69
|
+
*/
|
|
70
|
+
async ResolveByTenantId(req) {
|
|
71
|
+
// Type validation
|
|
72
|
+
if (!(req instanceof tenancy.TenantIdKey)) {
|
|
73
|
+
throw new TypeError(
|
|
74
|
+
`ResolveByTenantId: Expected parameter to be instanceof tenancy.TenantIdKey`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Convert to plain object
|
|
79
|
+
const request = tenancy.TenantIdKey.toObject(req);
|
|
80
|
+
|
|
81
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
82
|
+
return this.callUnary("ResolveByTenantId", request, (res) => tenancy.Tenant.fromObject(res));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Call the `UpsertByChannelKey` RPC with request/response type conversion.
|
|
87
|
+
* @param { tenancy.UpsertChannelKeyRequest } req - Typed request message.
|
|
88
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
89
|
+
*/
|
|
90
|
+
async UpsertByChannelKey(req) {
|
|
91
|
+
// Type validation
|
|
92
|
+
if (!(req instanceof tenancy.UpsertChannelKeyRequest)) {
|
|
93
|
+
throw new TypeError(
|
|
94
|
+
`UpsertByChannelKey: Expected parameter to be instanceof tenancy.UpsertChannelKeyRequest`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Convert to plain object
|
|
99
|
+
const request = tenancy.UpsertChannelKeyRequest.toObject(req);
|
|
100
|
+
|
|
101
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
102
|
+
return this.callUnary("UpsertByChannelKey", request, (res) => tenancy.Tenant.fromObject(res));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Call the `UpsertByPair` RPC with request/response type conversion.
|
|
107
|
+
* @param { tenancy.UpsertPairRequest } req - Typed request message.
|
|
108
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
109
|
+
*/
|
|
110
|
+
async UpsertByPair(req) {
|
|
111
|
+
// Type validation
|
|
112
|
+
if (!(req instanceof tenancy.UpsertPairRequest)) {
|
|
113
|
+
throw new TypeError(
|
|
114
|
+
`UpsertByPair: Expected parameter to be instanceof tenancy.UpsertPairRequest`,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Convert to plain object
|
|
119
|
+
const request = tenancy.UpsertPairRequest.toObject(req);
|
|
120
|
+
|
|
121
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
122
|
+
return this.callUnary("UpsertByPair", request, (res) => tenancy.Tenant.fromObject(res));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Call the `SetState` RPC with request/response type conversion.
|
|
127
|
+
* @param { tenancy.SetStateRequest } req - Typed request message.
|
|
128
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
129
|
+
*/
|
|
130
|
+
async SetState(req) {
|
|
131
|
+
// Type validation
|
|
132
|
+
if (!(req instanceof tenancy.SetStateRequest)) {
|
|
133
|
+
throw new TypeError(
|
|
134
|
+
`SetState: Expected parameter to be instanceof tenancy.SetStateRequest`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Convert to plain object
|
|
139
|
+
const request = tenancy.SetStateRequest.toObject(req);
|
|
140
|
+
|
|
141
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
142
|
+
return this.callUnary("SetState", request, (res) => tenancy.Tenant.fromObject(res));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Call the `SetRepo` RPC with request/response type conversion.
|
|
147
|
+
* @param { tenancy.SetRepoRequest } req - Typed request message.
|
|
148
|
+
* @returns { Promise<tenancy.Tenant> } Typed response message.
|
|
149
|
+
*/
|
|
150
|
+
async SetRepo(req) {
|
|
151
|
+
// Type validation
|
|
152
|
+
if (!(req instanceof tenancy.SetRepoRequest)) {
|
|
153
|
+
throw new TypeError(
|
|
154
|
+
`SetRepo: Expected parameter to be instanceof tenancy.SetRepoRequest`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Convert to plain object
|
|
159
|
+
const request = tenancy.SetRepoRequest.toObject(req);
|
|
160
|
+
|
|
161
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
162
|
+
return this.callUnary("SetRepo", request, (res) => tenancy.Tenant.fromObject(res));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { tenancy } from "@forwardimpact/libtype";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for Tenancy service implementation
|
|
7
|
+
*/
|
|
8
|
+
export class TenancyBase {
|
|
9
|
+
config;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Tenancy service instance
|
|
13
|
+
* @param {object} config - Service configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(config) {
|
|
16
|
+
if (!config) throw new Error("config is required");
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Must be implemented by subclass
|
|
22
|
+
* @param { tenancy.ChannelTenantKey } req - Request parameters
|
|
23
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
24
|
+
*/
|
|
25
|
+
async ResolveByChannelKey(req) {
|
|
26
|
+
throw new Error("ResolveByChannelKey not implemented");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Must be implemented by subclass
|
|
31
|
+
* @param { tenancy.RepoKey } req - Request parameters
|
|
32
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
33
|
+
*/
|
|
34
|
+
async ResolveByRepo(req) {
|
|
35
|
+
throw new Error("ResolveByRepo not implemented");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Must be implemented by subclass
|
|
40
|
+
* @param { tenancy.TenantIdKey } req - Request parameters
|
|
41
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
42
|
+
*/
|
|
43
|
+
async ResolveByTenantId(req) {
|
|
44
|
+
throw new Error("ResolveByTenantId not implemented");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Must be implemented by subclass
|
|
49
|
+
* @param { tenancy.UpsertChannelKeyRequest } req - Request parameters
|
|
50
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
51
|
+
*/
|
|
52
|
+
async UpsertByChannelKey(req) {
|
|
53
|
+
throw new Error("UpsertByChannelKey not implemented");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Must be implemented by subclass
|
|
58
|
+
* @param { tenancy.UpsertPairRequest } req - Request parameters
|
|
59
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
60
|
+
*/
|
|
61
|
+
async UpsertByPair(req) {
|
|
62
|
+
throw new Error("UpsertByPair not implemented");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Must be implemented by subclass
|
|
67
|
+
* @param { tenancy.SetStateRequest } req - Request parameters
|
|
68
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
69
|
+
*/
|
|
70
|
+
async SetState(req) {
|
|
71
|
+
throw new Error("SetState not implemented");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Must be implemented by subclass
|
|
76
|
+
* @param { tenancy.SetRepoRequest } req - Request parameters
|
|
77
|
+
* @returns { Promise<tenancy.Tenant> } Response object
|
|
78
|
+
*/
|
|
79
|
+
async SetRepo(req) {
|
|
80
|
+
throw new Error("SetRepo not implemented");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates gRPC handlers for this service instance
|
|
85
|
+
* @returns { object } Map of method names to handler functions
|
|
86
|
+
*/
|
|
87
|
+
getHandlers() {
|
|
88
|
+
return {
|
|
89
|
+
ResolveByChannelKey: async (call) => {
|
|
90
|
+
// Validate and convert request
|
|
91
|
+
const error = tenancy.ChannelTenantKey.verify(call.request);
|
|
92
|
+
if (error) throw new Error(`ResolveByChannelKey: ${error}`);
|
|
93
|
+
const req = tenancy.ChannelTenantKey.fromObject(call.request);
|
|
94
|
+
|
|
95
|
+
// Call implementation
|
|
96
|
+
return await this.ResolveByChannelKey(req);
|
|
97
|
+
},
|
|
98
|
+
ResolveByRepo: async (call) => {
|
|
99
|
+
// Validate and convert request
|
|
100
|
+
const error = tenancy.RepoKey.verify(call.request);
|
|
101
|
+
if (error) throw new Error(`ResolveByRepo: ${error}`);
|
|
102
|
+
const req = tenancy.RepoKey.fromObject(call.request);
|
|
103
|
+
|
|
104
|
+
// Call implementation
|
|
105
|
+
return await this.ResolveByRepo(req);
|
|
106
|
+
},
|
|
107
|
+
ResolveByTenantId: async (call) => {
|
|
108
|
+
// Validate and convert request
|
|
109
|
+
const error = tenancy.TenantIdKey.verify(call.request);
|
|
110
|
+
if (error) throw new Error(`ResolveByTenantId: ${error}`);
|
|
111
|
+
const req = tenancy.TenantIdKey.fromObject(call.request);
|
|
112
|
+
|
|
113
|
+
// Call implementation
|
|
114
|
+
return await this.ResolveByTenantId(req);
|
|
115
|
+
},
|
|
116
|
+
UpsertByChannelKey: async (call) => {
|
|
117
|
+
// Validate and convert request
|
|
118
|
+
const error = tenancy.UpsertChannelKeyRequest.verify(call.request);
|
|
119
|
+
if (error) throw new Error(`UpsertByChannelKey: ${error}`);
|
|
120
|
+
const req = tenancy.UpsertChannelKeyRequest.fromObject(call.request);
|
|
121
|
+
|
|
122
|
+
// Call implementation
|
|
123
|
+
return await this.UpsertByChannelKey(req);
|
|
124
|
+
},
|
|
125
|
+
UpsertByPair: async (call) => {
|
|
126
|
+
// Validate and convert request
|
|
127
|
+
const error = tenancy.UpsertPairRequest.verify(call.request);
|
|
128
|
+
if (error) throw new Error(`UpsertByPair: ${error}`);
|
|
129
|
+
const req = tenancy.UpsertPairRequest.fromObject(call.request);
|
|
130
|
+
|
|
131
|
+
// Call implementation
|
|
132
|
+
return await this.UpsertByPair(req);
|
|
133
|
+
},
|
|
134
|
+
SetState: async (call) => {
|
|
135
|
+
// Validate and convert request
|
|
136
|
+
const error = tenancy.SetStateRequest.verify(call.request);
|
|
137
|
+
if (error) throw new Error(`SetState: ${error}`);
|
|
138
|
+
const req = tenancy.SetStateRequest.fromObject(call.request);
|
|
139
|
+
|
|
140
|
+
// Call implementation
|
|
141
|
+
return await this.SetState(req);
|
|
142
|
+
},
|
|
143
|
+
SetRepo: async (call) => {
|
|
144
|
+
// Validate and convert request
|
|
145
|
+
const error = tenancy.SetRepoRequest.verify(call.request);
|
|
146
|
+
if (error) throw new Error(`SetRepo: ${error}`);
|
|
147
|
+
const req = tenancy.SetRepoRequest.fromObject(call.request);
|
|
148
|
+
|
|
149
|
+
// Call implementation
|
|
150
|
+
return await this.SetRepo(req);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { Client } from "@forwardimpact/librpc/client.js";
|
|
4
|
+
import { createAuth, createGrpc } from "@forwardimpact/librpc/base.js";
|
|
5
|
+
import { createObserver } from "@forwardimpact/libtelemetry";
|
|
6
|
+
import { trace } from "@forwardimpact/libtype";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Typed client for the Trace gRPC service.
|
|
10
|
+
* Extends the `Client` class for shared gRPC client functionality.
|
|
11
|
+
*/
|
|
12
|
+
export class TraceClient extends Client {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Trace client instance
|
|
15
|
+
* @param {object} config - Service configuration
|
|
16
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime} runtime - Injected runtime bag (required; the default auth factory reads SERVICE_SECRET from it)
|
|
17
|
+
* @param {import("@forwardimpact/libtelemetry").Logger} [logger] - Optional logger instance
|
|
18
|
+
* @param {import("@forwardimpact/libtelemetry").Tracer} [tracer] - Optional tracer for distributed tracing
|
|
19
|
+
* @param {Function} [authFn] - Optional authentication function
|
|
20
|
+
*/
|
|
21
|
+
constructor(config, runtime, logger = null, tracer = null, authFn = createAuth) {
|
|
22
|
+
super(config, runtime, logger, tracer, createObserver, createGrpc, authFn);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Call the `RecordSpan` RPC with request/response type conversion.
|
|
27
|
+
* @param { trace.Span } req - Typed request message.
|
|
28
|
+
* @returns { Promise<trace.RecordResponse> } Typed response message.
|
|
29
|
+
*/
|
|
30
|
+
async RecordSpan(req) {
|
|
31
|
+
// Type validation
|
|
32
|
+
if (!(req instanceof trace.Span)) {
|
|
33
|
+
throw new TypeError(
|
|
34
|
+
`RecordSpan: Expected parameter to be instanceof trace.Span`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Convert to plain object
|
|
39
|
+
const request = trace.Span.toObject(req);
|
|
40
|
+
|
|
41
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
42
|
+
return this.callUnary("RecordSpan", request, (res) => trace.RecordResponse.fromObject(res));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Call the `QuerySpans` RPC with request/response type conversion.
|
|
47
|
+
* @param { trace.QueryRequest } req - Typed request message.
|
|
48
|
+
* @returns { Promise<trace.QueryResponse> } Typed response message.
|
|
49
|
+
*/
|
|
50
|
+
async QuerySpans(req) {
|
|
51
|
+
// Type validation
|
|
52
|
+
if (!(req instanceof trace.QueryRequest)) {
|
|
53
|
+
throw new TypeError(
|
|
54
|
+
`QuerySpans: Expected parameter to be instanceof trace.QueryRequest`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Convert to plain object
|
|
59
|
+
const request = trace.QueryRequest.toObject(req);
|
|
60
|
+
|
|
61
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
62
|
+
return this.callUnary("QuerySpans", request, (res) => trace.QueryResponse.fromObject(res));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { trace } from "@forwardimpact/libtype";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for Trace service implementation
|
|
7
|
+
*/
|
|
8
|
+
export class TraceBase {
|
|
9
|
+
config;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Trace service instance
|
|
13
|
+
* @param {object} config - Service configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(config) {
|
|
16
|
+
if (!config) throw new Error("config is required");
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Must be implemented by subclass
|
|
22
|
+
* @param { trace.Span } req - Request parameters
|
|
23
|
+
* @returns { Promise<trace.RecordResponse> } Response object
|
|
24
|
+
*/
|
|
25
|
+
async RecordSpan(req) {
|
|
26
|
+
throw new Error("RecordSpan not implemented");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Must be implemented by subclass
|
|
31
|
+
* @param { trace.QueryRequest } req - Request parameters
|
|
32
|
+
* @returns { Promise<trace.QueryResponse> } Response object
|
|
33
|
+
*/
|
|
34
|
+
async QuerySpans(req) {
|
|
35
|
+
throw new Error("QuerySpans not implemented");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates gRPC handlers for this service instance
|
|
40
|
+
* @returns { object } Map of method names to handler functions
|
|
41
|
+
*/
|
|
42
|
+
getHandlers() {
|
|
43
|
+
return {
|
|
44
|
+
RecordSpan: async (call) => {
|
|
45
|
+
// Validate and convert request
|
|
46
|
+
const error = trace.Span.verify(call.request);
|
|
47
|
+
if (error) throw new Error(`RecordSpan: ${error}`);
|
|
48
|
+
const req = trace.Span.fromObject(call.request);
|
|
49
|
+
|
|
50
|
+
// Call implementation
|
|
51
|
+
return await this.RecordSpan(req);
|
|
52
|
+
},
|
|
53
|
+
QuerySpans: async (call) => {
|
|
54
|
+
// Validate and convert request
|
|
55
|
+
const error = trace.QueryRequest.verify(call.request);
|
|
56
|
+
if (error) throw new Error(`QuerySpans: ${error}`);
|
|
57
|
+
const req = trace.QueryRequest.fromObject(call.request);
|
|
58
|
+
|
|
59
|
+
// Call implementation
|
|
60
|
+
return await this.QuerySpans(req);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { Client } from "@forwardimpact/librpc/client.js";
|
|
4
|
+
import { createAuth, createGrpc } from "@forwardimpact/librpc/base.js";
|
|
5
|
+
import { createObserver } from "@forwardimpact/libtelemetry";
|
|
6
|
+
import { vector, tool } from "@forwardimpact/libtype";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Typed client for the Vector gRPC service.
|
|
10
|
+
* Extends the `Client` class for shared gRPC client functionality.
|
|
11
|
+
*/
|
|
12
|
+
export class VectorClient extends Client {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Vector client instance
|
|
15
|
+
* @param {object} config - Service configuration
|
|
16
|
+
* @param {import("@forwardimpact/libutil/runtime").Runtime} runtime - Injected runtime bag (required; the default auth factory reads SERVICE_SECRET from it)
|
|
17
|
+
* @param {import("@forwardimpact/libtelemetry").Logger} [logger] - Optional logger instance
|
|
18
|
+
* @param {import("@forwardimpact/libtelemetry").Tracer} [tracer] - Optional tracer for distributed tracing
|
|
19
|
+
* @param {Function} [authFn] - Optional authentication function
|
|
20
|
+
*/
|
|
21
|
+
constructor(config, runtime, logger = null, tracer = null, authFn = createAuth) {
|
|
22
|
+
super(config, runtime, logger, tracer, createObserver, createGrpc, authFn);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Call the `SearchContent` RPC with request/response type conversion.
|
|
27
|
+
* @param { vector.TextQuery } req - Typed request message.
|
|
28
|
+
* @returns { Promise<tool.ToolCallResult> } Typed response message.
|
|
29
|
+
*/
|
|
30
|
+
async SearchContent(req) {
|
|
31
|
+
// Type validation
|
|
32
|
+
if (!(req instanceof vector.TextQuery)) {
|
|
33
|
+
throw new TypeError(
|
|
34
|
+
`SearchContent: Expected parameter to be instanceof vector.TextQuery`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Convert to plain object
|
|
39
|
+
const request = vector.TextQuery.toObject(req);
|
|
40
|
+
|
|
41
|
+
// Make gRPC call (tracing handled by base Client class)
|
|
42
|
+
return this.callUnary("SearchContent", request, (res) => tool.ToolCallResult.fromObject(res));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* eslint no-unused-vars: "off" */
|
|
2
|
+
|
|
3
|
+
import { vector, tool } from "@forwardimpact/libtype";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for Vector service implementation
|
|
7
|
+
*/
|
|
8
|
+
export class VectorBase {
|
|
9
|
+
config;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Vector service instance
|
|
13
|
+
* @param {object} config - Service configuration
|
|
14
|
+
*/
|
|
15
|
+
constructor(config) {
|
|
16
|
+
if (!config) throw new Error("config is required");
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Must be implemented by subclass
|
|
22
|
+
* @param { vector.TextQuery } req - Request parameters
|
|
23
|
+
* @returns { Promise<tool.ToolCallResult> } Response object
|
|
24
|
+
*/
|
|
25
|
+
async SearchContent(req) {
|
|
26
|
+
throw new Error("SearchContent not implemented");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates gRPC handlers for this service instance
|
|
31
|
+
* @returns { object } Map of method names to handler functions
|
|
32
|
+
*/
|
|
33
|
+
getHandlers() {
|
|
34
|
+
return {
|
|
35
|
+
SearchContent: async (call) => {
|
|
36
|
+
// Validate and convert request
|
|
37
|
+
const error = vector.TextQuery.verify(call.request);
|
|
38
|
+
if (error) throw new Error(`SearchContent: ${error}`);
|
|
39
|
+
const req = vector.TextQuery.fromObject(call.request);
|
|
40
|
+
|
|
41
|
+
// Call implementation
|
|
42
|
+
return await this.SearchContent(req);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|