@hashgraphonline/standards-sdk 0.1.146-chore-jsr-improvements.canary.01d3174.92 → 0.1.146-chore-jsr-improvements.canary.9940b30.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/services/registry-broker/client/adapters.d.ts +4 -19
- package/dist/cjs/services/registry-broker/client/adapters.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/agents.d.ts +4 -15
- package/dist/cjs/services/registry-broker/client/agents.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts +51 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts +4 -22
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/chat.d.ts +4 -32
- package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/credits.d.ts +4 -39
- package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts +4 -34
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/encryption.d.ts +4 -32
- package/dist/cjs/services/registry-broker/client/encryption.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts +4 -9
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client.d.ts +4 -0
- package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +3 -3
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/services/registry-broker/client/adapters.d.ts +4 -19
- package/dist/es/services/registry-broker/client/adapters.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/agents.d.ts +4 -15
- package/dist/es/services/registry-broker/client/agents.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts +51 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/chat-history.d.ts +4 -22
- package/dist/es/services/registry-broker/client/chat-history.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/chat.d.ts +4 -32
- package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/credits.d.ts +4 -39
- package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts +4 -34
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/encryption.d.ts +4 -32
- package/dist/es/services/registry-broker/client/encryption.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts +4 -9
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client.d.ts +4 -0
- package/dist/es/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +9 -16
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +1 -1
- package/dist/es/standards-sdk.es103.js +1 -1
- package/dist/es/standards-sdk.es109.js +2 -9
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +5 -5
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +1 -1
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +5 -5
- package/dist/es/standards-sdk.es124.js +1 -1
- package/dist/es/standards-sdk.es125.js +1 -1
- package/dist/es/standards-sdk.es127.js +624 -155
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +16 -103
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +72 -112
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es130.js +75 -235
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +53 -173
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +156 -119
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +8 -327
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +74 -613
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +61 -13
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +30 -81
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +34 -87
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +28 -60
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +121 -142
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es140.js +42 -7
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +933 -86
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +12267 -43
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +17 -30
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +56 -34
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +84 -28
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +152 -118
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +314 -34
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +342 -13
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +395 -12231
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +331 -959
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +69 -49
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +121 -66
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +2 -9
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +5 -12
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +3 -10
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es27.js +5 -12
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +1 -1
- package/dist/es/standards-sdk.es31.js +1 -1
- package/dist/es/standards-sdk.es35.js +3 -10
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +3 -3
- package/dist/es/standards-sdk.es37.js +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es58.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +3 -10
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +2 -2
- package/dist/es/standards-sdk.es68.js +2 -2
- package/dist/es/standards-sdk.es69.js +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es71.js +1 -1
- package/dist/es/standards-sdk.es76.js +1 -1
- package/dist/es/standards-sdk.es77.js +2 -9
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +1 -1
- package/dist/es/standards-sdk.es81.js +1 -1
- package/dist/es/standards-sdk.es83.js +1 -1
- package/dist/es/standards-sdk.es87.js +3 -3
- package/dist/es/standards-sdk.es91.js +1 -1
- package/dist/es/standards-sdk.es92.js +1 -1
- package/dist/es/standards-sdk.es97.js +1 -1
- package/dist/es/standards-sdk.es99.js +1 -1
- package/package.json +1 -1
- package/dist/es/standards-sdk.es153.js +0 -175
- package/dist/es/standards-sdk.es153.js.map +0 -1
- package/dist/es/standards-sdk.es154.js +0 -325
- package/dist/es/standards-sdk.es154.js.map +0 -1
- package/dist/es/standards-sdk.es155.js +0 -349
- package/dist/es/standards-sdk.es155.js.map +0 -1
- package/dist/es/standards-sdk.es156.js +0 -456
- package/dist/es/standards-sdk.es156.js.map +0 -1
- package/dist/es/standards-sdk.es157.js +0 -334
- package/dist/es/standards-sdk.es157.js.map +0 -1
- package/dist/es/standards-sdk.es158.js +0 -79
- package/dist/es/standards-sdk.es158.js.map +0 -1
- package/dist/es/standards-sdk.es159.js +0 -242
- package/dist/es/standards-sdk.es159.js.map +0 -1
- package/dist/es/standards-sdk.es160.js +0 -247
- package/dist/es/standards-sdk.es160.js.map +0 -1
|
@@ -1,180 +1,649 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
1
|
import { Buffer } from "buffer";
|
|
3
|
-
import { randomBytes } from "crypto";
|
|
2
|
+
import { randomBytes, createHash, createCipheriv, createDecipheriv } from "crypto";
|
|
4
3
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
4
|
+
import { ZodError } from "zod";
|
|
5
|
+
import { agentFeedbackResponseSchema, agentFeedbackIndexResponseSchema, agentFeedbackEntriesIndexResponseSchema, agentFeedbackEligibilityResponseSchema, agentFeedbackSubmissionResponseSchema, searchResponseSchema, statsResponseSchema, registriesResponseSchema, additionalRegistryCatalogResponseSchema, popularResponseSchema, protocolsResponseSchema, detectProtocolResponseSchema, registrySearchByNamespaceSchema, vectorSearchResponseSchema, searchStatusResponseSchema, websocketStatsResponseSchema, metricsSummaryResponseSchema, searchFacetsResponseSchema } from "./standards-sdk.es141.js";
|
|
6
|
+
import { DEFAULT_BASE_URL, normaliseBaseUrl, normaliseHeaderName, isBrowserRuntime, DEFAULT_USER_AGENT, JSON_CONTENT_TYPE, createAbortError, isJsonObject, DEFAULT_HISTORY_TOP_UP_HBAR, buildSearchQuery } from "./standards-sdk.es152.js";
|
|
7
|
+
import { RegistryBrokerError, RegistryBrokerParseError } from "./standards-sdk.es128.js";
|
|
8
|
+
class RegistryBrokerClient {
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
this.encryptionBootstrapPromise = null;
|
|
11
|
+
this.encryption = {
|
|
12
|
+
ensureAgentKey: async (_options) => {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"Encryption not available in JSR version. Use npm: @hashgraphonline/standards-sdk"
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
registerKey: async (_payload) => {
|
|
18
|
+
throw new Error(
|
|
19
|
+
"Encryption not available in JSR version. Use npm: @hashgraphonline/standards-sdk"
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const {
|
|
24
|
+
baseUrl = DEFAULT_BASE_URL,
|
|
25
|
+
fetchImplementation,
|
|
26
|
+
defaultHeaders,
|
|
27
|
+
apiKey,
|
|
28
|
+
ledgerApiKey,
|
|
29
|
+
registrationAutoTopUp,
|
|
30
|
+
historyAutoTopUp,
|
|
31
|
+
encryption
|
|
32
|
+
} = options;
|
|
33
|
+
this.baseUrl = normaliseBaseUrl(baseUrl);
|
|
34
|
+
this.fetchImpl = fetchImplementation ?? fetch;
|
|
35
|
+
this.defaultHeaders = {
|
|
36
|
+
...defaultHeaders ?? {}
|
|
37
|
+
};
|
|
38
|
+
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
39
|
+
const headerName = normaliseHeaderName(key);
|
|
40
|
+
if (headerName !== key) {
|
|
41
|
+
delete this.defaultHeaders[key];
|
|
42
|
+
this.defaultHeaders[headerName] = value;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (apiKey) {
|
|
46
|
+
this.defaultHeaders["x-api-key"] = apiKey;
|
|
47
|
+
}
|
|
48
|
+
if (ledgerApiKey) {
|
|
49
|
+
this.defaultHeaders["x-ledger-api-key"] = ledgerApiKey;
|
|
50
|
+
}
|
|
51
|
+
this.registrationAutoTopUp = registrationAutoTopUp;
|
|
52
|
+
this.historyAutoTopUp = historyAutoTopUp;
|
|
53
|
+
this.encryptionOptions = encryption;
|
|
54
|
+
if (this.encryptionOptions) {
|
|
55
|
+
this.encryptionBootstrapPromise = this.initializeEncryptionBootstrap(
|
|
56
|
+
this.encryptionOptions
|
|
57
|
+
);
|
|
58
|
+
}
|
|
31
59
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
60
|
+
static async initializeAgent(options) {
|
|
61
|
+
const { uaid, ensureEncryptionKey = true, ...clientOptions } = options;
|
|
62
|
+
const client = new RegistryBrokerClient(clientOptions);
|
|
63
|
+
let encryption = null;
|
|
64
|
+
if (ensureEncryptionKey) {
|
|
65
|
+
const ensureOptions = typeof ensureEncryptionKey === "object" ? ensureEncryptionKey : { generateIfMissing: true };
|
|
66
|
+
encryption = await client.encryption.ensureAgentKey({
|
|
67
|
+
uaid,
|
|
68
|
+
...ensureOptions
|
|
69
|
+
});
|
|
36
70
|
}
|
|
71
|
+
return { client, encryption };
|
|
37
72
|
}
|
|
38
|
-
|
|
39
|
-
|
|
73
|
+
setApiKey(apiKey) {
|
|
74
|
+
this.setDefaultHeader("x-api-key", apiKey);
|
|
40
75
|
}
|
|
41
|
-
|
|
42
|
-
|
|
76
|
+
setLedgerApiKey(apiKey) {
|
|
77
|
+
this.setDefaultHeader("x-ledger-api-key", apiKey);
|
|
43
78
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
setDefaultHeader(name, value) {
|
|
80
|
+
if (!name || name.trim().length === 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const headerName = normaliseHeaderName(name);
|
|
84
|
+
if (!value || value.trim().length === 0) {
|
|
85
|
+
delete this.defaultHeaders[headerName];
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.defaultHeaders[headerName] = value.trim();
|
|
89
|
+
}
|
|
90
|
+
getDefaultHeaders() {
|
|
91
|
+
return { ...this.defaultHeaders };
|
|
92
|
+
}
|
|
93
|
+
async encryptionReady() {
|
|
94
|
+
if (!this.encryptionBootstrapPromise) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
await this.encryptionBootstrapPromise;
|
|
98
|
+
}
|
|
99
|
+
buildUrl(path) {
|
|
100
|
+
const normalisedPath = path.startsWith("/") ? path : `/${path}`;
|
|
101
|
+
return `${this.baseUrl}${normalisedPath}`;
|
|
102
|
+
}
|
|
103
|
+
async request(path, config) {
|
|
104
|
+
const headers = new Headers();
|
|
105
|
+
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
106
|
+
headers.set(key, value);
|
|
66
107
|
});
|
|
67
|
-
if (
|
|
68
|
-
|
|
108
|
+
if (config.headers) {
|
|
109
|
+
Object.entries(config.headers).forEach(([key, value]) => {
|
|
110
|
+
headers.set(key, value);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (!headers.has("accept")) {
|
|
114
|
+
headers.set("accept", "application/json");
|
|
115
|
+
}
|
|
116
|
+
if (!headers.has("user-agent") && !isBrowserRuntime()) {
|
|
117
|
+
headers.set("user-agent", DEFAULT_USER_AGENT);
|
|
69
118
|
}
|
|
70
|
-
|
|
119
|
+
const init = {
|
|
120
|
+
method: config.method ?? "GET",
|
|
121
|
+
headers
|
|
122
|
+
};
|
|
123
|
+
if (config.body !== void 0) {
|
|
124
|
+
init.body = JSON.stringify(config.body);
|
|
125
|
+
if (!headers.has("content-type")) {
|
|
126
|
+
headers.set("content-type", "application/json");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const response = await this.fetchImpl(this.buildUrl(path), init);
|
|
130
|
+
if (response.ok) {
|
|
131
|
+
return response;
|
|
132
|
+
}
|
|
133
|
+
const errorBody = await this.extractErrorBody(response);
|
|
134
|
+
throw new RegistryBrokerError("Registry broker request failed", {
|
|
135
|
+
status: response.status,
|
|
136
|
+
statusText: response.statusText,
|
|
137
|
+
body: errorBody
|
|
138
|
+
});
|
|
71
139
|
}
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
140
|
+
async requestJson(path, config) {
|
|
141
|
+
const response = await this.request(path, config);
|
|
142
|
+
const contentType = response.headers?.get("content-type") ?? "";
|
|
143
|
+
if (!JSON_CONTENT_TYPE.test(contentType)) {
|
|
144
|
+
const body = await response.text();
|
|
145
|
+
throw new RegistryBrokerParseError(
|
|
146
|
+
"Expected JSON response from registry broker",
|
|
147
|
+
body
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return await response.json();
|
|
75
151
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
152
|
+
async getAgentFeedback(uaid, options = {}) {
|
|
153
|
+
const normalized = uaid.trim();
|
|
154
|
+
if (!normalized) {
|
|
155
|
+
throw new Error("uaid is required");
|
|
156
|
+
}
|
|
157
|
+
const query = options.includeRevoked === true ? "?includeRevoked=true" : "";
|
|
158
|
+
const raw = await this.requestJson(
|
|
159
|
+
`/agents/${encodeURIComponent(normalized)}/feedback${query}`,
|
|
160
|
+
{ method: "GET" }
|
|
161
|
+
);
|
|
162
|
+
return this.parseWithSchema(
|
|
163
|
+
raw,
|
|
164
|
+
agentFeedbackResponseSchema,
|
|
165
|
+
"agent feedback response"
|
|
83
166
|
);
|
|
84
167
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
168
|
+
async listAgentFeedbackIndex(options = {}) {
|
|
169
|
+
const params = new URLSearchParams();
|
|
170
|
+
if (typeof options.page === "number" && Number.isFinite(options.page)) {
|
|
171
|
+
params.set("page", String(Math.trunc(options.page)));
|
|
172
|
+
}
|
|
173
|
+
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
174
|
+
params.set("limit", String(Math.trunc(options.limit)));
|
|
175
|
+
}
|
|
176
|
+
if (options.registries?.length) {
|
|
177
|
+
params.set("registry", options.registries.join(","));
|
|
178
|
+
}
|
|
179
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
180
|
+
const raw = await this.requestJson(`/agents/feedback${suffix}`, {
|
|
181
|
+
method: "GET"
|
|
182
|
+
});
|
|
183
|
+
return this.parseWithSchema(
|
|
184
|
+
raw,
|
|
185
|
+
agentFeedbackIndexResponseSchema,
|
|
186
|
+
"agent feedback index response"
|
|
89
187
|
);
|
|
90
188
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
registerKey: (payload) => registerEncryptionKey(this, payload),
|
|
113
|
-
generateEphemeralKeyPair: () => this.createEphemeralKeyPair(),
|
|
114
|
-
deriveSharedSecret: (options) => this.deriveSharedSecret(options),
|
|
115
|
-
encryptCipherEnvelope: (options) => this.buildCipherEnvelope(options),
|
|
116
|
-
decryptCipherEnvelope: (options) => this.openCipherEnvelope(options),
|
|
117
|
-
ensureAgentKey: (options) => ensureAgentEncryptionKey(this, options)
|
|
118
|
-
};
|
|
119
|
-
encryptionApis.set(this, api);
|
|
120
|
-
return api;
|
|
189
|
+
async listAgentFeedbackEntriesIndex(options = {}) {
|
|
190
|
+
const params = new URLSearchParams();
|
|
191
|
+
if (typeof options.page === "number" && Number.isFinite(options.page)) {
|
|
192
|
+
params.set("page", String(Math.trunc(options.page)));
|
|
193
|
+
}
|
|
194
|
+
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
195
|
+
params.set("limit", String(Math.trunc(options.limit)));
|
|
196
|
+
}
|
|
197
|
+
if (options.registries?.length) {
|
|
198
|
+
params.set("registry", options.registries.join(","));
|
|
199
|
+
}
|
|
200
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
201
|
+
const raw = await this.requestJson(
|
|
202
|
+
`/agents/feedback/entries${suffix}`,
|
|
203
|
+
{ method: "GET" }
|
|
204
|
+
);
|
|
205
|
+
return this.parseWithSchema(
|
|
206
|
+
raw,
|
|
207
|
+
agentFeedbackEntriesIndexResponseSchema,
|
|
208
|
+
"agent feedback entries index response"
|
|
209
|
+
);
|
|
121
210
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
211
|
+
async checkAgentFeedbackEligibility(uaid, payload) {
|
|
212
|
+
const normalized = uaid.trim();
|
|
213
|
+
if (!normalized) {
|
|
214
|
+
throw new Error("uaid is required");
|
|
215
|
+
}
|
|
216
|
+
const raw = await this.requestJson(
|
|
217
|
+
`/agents/${encodeURIComponent(normalized)}/feedback/eligibility`,
|
|
218
|
+
{
|
|
219
|
+
method: "POST",
|
|
220
|
+
body: payload,
|
|
221
|
+
headers: { "content-type": "application/json" }
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
return this.parseWithSchema(
|
|
225
|
+
raw,
|
|
226
|
+
agentFeedbackEligibilityResponseSchema,
|
|
227
|
+
"agent feedback eligibility response"
|
|
228
|
+
);
|
|
126
229
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
230
|
+
async submitAgentFeedback(uaid, payload) {
|
|
231
|
+
const normalized = uaid.trim();
|
|
232
|
+
if (!normalized) {
|
|
233
|
+
throw new Error("uaid is required");
|
|
234
|
+
}
|
|
235
|
+
const raw = await this.requestJson(
|
|
236
|
+
`/agents/${encodeURIComponent(normalized)}/feedback`,
|
|
237
|
+
{
|
|
238
|
+
method: "POST",
|
|
239
|
+
body: payload,
|
|
240
|
+
headers: { "content-type": "application/json" }
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
return this.parseWithSchema(
|
|
244
|
+
raw,
|
|
245
|
+
agentFeedbackSubmissionResponseSchema,
|
|
246
|
+
"agent feedback submission response"
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
async extractErrorBody(response) {
|
|
250
|
+
const contentType = response.headers?.get("content-type") ?? "";
|
|
251
|
+
if (JSON_CONTENT_TYPE.test(contentType)) {
|
|
252
|
+
try {
|
|
253
|
+
return await response.json();
|
|
254
|
+
} catch (error) {
|
|
255
|
+
return { parseError: String(error) };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
return await response.text();
|
|
260
|
+
} catch (error) {
|
|
261
|
+
return { parseError: String(error) };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
parseWithSchema(value, schema, context) {
|
|
265
|
+
try {
|
|
266
|
+
return schema.parse(value);
|
|
267
|
+
} catch (error) {
|
|
268
|
+
throw new RegistryBrokerParseError(
|
|
269
|
+
`Failed to parse ${context}`,
|
|
270
|
+
error instanceof ZodError || error instanceof Error ? error : String(error),
|
|
271
|
+
value
|
|
146
272
|
);
|
|
147
273
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
274
|
+
}
|
|
275
|
+
async delay(ms, signal) {
|
|
276
|
+
if (ms <= 0) {
|
|
277
|
+
if (signal?.aborted) {
|
|
278
|
+
throw createAbortError();
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
await new Promise((resolve, reject) => {
|
|
283
|
+
const timer = setTimeout(() => {
|
|
284
|
+
if (signal) {
|
|
285
|
+
signal.removeEventListener("abort", onAbort);
|
|
157
286
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
287
|
+
resolve();
|
|
288
|
+
}, ms);
|
|
289
|
+
const onAbort = () => {
|
|
290
|
+
clearTimeout(timer);
|
|
291
|
+
signal?.removeEventListener("abort", onAbort);
|
|
292
|
+
reject(createAbortError());
|
|
293
|
+
};
|
|
294
|
+
if (signal) {
|
|
295
|
+
if (signal.aborted) {
|
|
296
|
+
clearTimeout(timer);
|
|
297
|
+
reject(createAbortError());
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
assertNodeRuntime(feature) {
|
|
305
|
+
if (typeof process === "undefined" || !process.versions?.node) {
|
|
306
|
+
throw new Error(`${feature} is only available in Node.js environments`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
createEphemeralKeyPair() {
|
|
310
|
+
this.assertNodeRuntime("generateEphemeralKeyPair");
|
|
311
|
+
const privateKeyBytes = randomBytes(32);
|
|
312
|
+
const publicKey = secp256k1.getPublicKey(privateKeyBytes, true);
|
|
313
|
+
return {
|
|
314
|
+
privateKey: Buffer.from(privateKeyBytes).toString("hex"),
|
|
315
|
+
publicKey: Buffer.from(publicKey).toString("hex")
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
deriveSharedSecret(options) {
|
|
319
|
+
this.assertNodeRuntime("deriveSharedSecret");
|
|
320
|
+
const privateKey = this.hexToBuffer(options.privateKey);
|
|
321
|
+
const peerPublicKey = this.hexToBuffer(options.peerPublicKey);
|
|
322
|
+
const shared = secp256k1.getSharedSecret(privateKey, peerPublicKey, true);
|
|
323
|
+
return createHash("sha256").update(Buffer.from(shared)).digest();
|
|
324
|
+
}
|
|
325
|
+
buildCipherEnvelope(options) {
|
|
326
|
+
this.assertNodeRuntime("encryptCipherEnvelope");
|
|
327
|
+
const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
|
|
328
|
+
const iv = randomBytes(12);
|
|
329
|
+
const cipher = createCipheriv("aes-256-gcm", sharedSecret, iv);
|
|
330
|
+
const aadSource = options.associatedData ?? options.sessionId;
|
|
331
|
+
const associatedDataEncoded = aadSource ? Buffer.from(aadSource, "utf8").toString("base64") : void 0;
|
|
332
|
+
if (aadSource) {
|
|
333
|
+
cipher.setAAD(Buffer.from(aadSource, "utf8"));
|
|
334
|
+
}
|
|
335
|
+
const ciphertext = Buffer.concat([
|
|
336
|
+
cipher.update(Buffer.from(options.plaintext, "utf8")),
|
|
337
|
+
cipher.final()
|
|
338
|
+
]);
|
|
339
|
+
const tag = cipher.getAuthTag();
|
|
340
|
+
const payload = Buffer.concat([ciphertext, tag]);
|
|
341
|
+
return {
|
|
342
|
+
algorithm: "aes-256-gcm",
|
|
343
|
+
ciphertext: payload.toString("base64"),
|
|
344
|
+
nonce: iv.toString("base64"),
|
|
345
|
+
associatedData: associatedDataEncoded,
|
|
346
|
+
keyLocator: {
|
|
347
|
+
sessionId: options.sessionId,
|
|
348
|
+
revision: options.revision ?? 1
|
|
349
|
+
},
|
|
350
|
+
recipients: options.recipients.map((recipient) => ({
|
|
351
|
+
...recipient,
|
|
352
|
+
encryptedShare: ""
|
|
353
|
+
}))
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
openCipherEnvelope(options) {
|
|
357
|
+
this.assertNodeRuntime("decryptCipherEnvelope");
|
|
358
|
+
const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
|
|
359
|
+
const payload = Buffer.from(options.envelope.ciphertext, "base64");
|
|
360
|
+
const nonce = Buffer.from(options.envelope.nonce, "base64");
|
|
361
|
+
const ciphertext = payload.slice(0, payload.length - 16);
|
|
362
|
+
const tag = payload.slice(payload.length - 16);
|
|
363
|
+
const decipher = createDecipheriv("aes-256-gcm", sharedSecret, nonce);
|
|
364
|
+
if (options.envelope.associatedData) {
|
|
365
|
+
decipher.setAAD(Buffer.from(options.envelope.associatedData, "base64"));
|
|
366
|
+
}
|
|
367
|
+
decipher.setAuthTag(tag);
|
|
368
|
+
const plaintext = Buffer.concat([
|
|
369
|
+
decipher.update(ciphertext),
|
|
370
|
+
decipher.final()
|
|
371
|
+
]);
|
|
372
|
+
return plaintext.toString(options.encoding ?? "utf8");
|
|
373
|
+
}
|
|
374
|
+
normalizeSharedSecret(input) {
|
|
375
|
+
if (Buffer.isBuffer(input)) {
|
|
376
|
+
return Buffer.from(input);
|
|
377
|
+
}
|
|
378
|
+
if (input instanceof Uint8Array) {
|
|
379
|
+
return Buffer.from(input);
|
|
380
|
+
}
|
|
381
|
+
if (typeof input === "string") {
|
|
382
|
+
return this.bufferFromString(input);
|
|
383
|
+
}
|
|
384
|
+
throw new Error("Unsupported shared secret input");
|
|
385
|
+
}
|
|
386
|
+
bufferFromString(value) {
|
|
387
|
+
const trimmed = value.trim();
|
|
388
|
+
if (!trimmed) {
|
|
389
|
+
throw new Error("sharedSecret string cannot be empty");
|
|
390
|
+
}
|
|
391
|
+
const normalized = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
|
|
392
|
+
if (/^[0-9a-fA-F]+$/.test(normalized) && normalized.length % 2 === 0) {
|
|
393
|
+
return Buffer.from(normalized, "hex");
|
|
394
|
+
}
|
|
395
|
+
return Buffer.from(trimmed, "base64");
|
|
396
|
+
}
|
|
397
|
+
hexToBuffer(value) {
|
|
398
|
+
const normalized = value.startsWith("0x") ? value.slice(2) : value;
|
|
399
|
+
if (!/^[0-9a-fA-F]+$/.test(normalized) || normalized.length % 2 !== 0) {
|
|
400
|
+
throw new Error("Expected hex-encoded value");
|
|
401
|
+
}
|
|
402
|
+
return Buffer.from(normalized, "hex");
|
|
403
|
+
}
|
|
404
|
+
extractInsufficientCreditsDetails(error) {
|
|
405
|
+
if (!(error instanceof RegistryBrokerError) || error.status !== 402) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
const body = error.body;
|
|
409
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
const maybeShortfall = body["shortfallCredits"];
|
|
413
|
+
if (typeof maybeShortfall !== "number" || maybeShortfall <= 0) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
return { shortfallCredits: maybeShortfall };
|
|
417
|
+
}
|
|
418
|
+
extractErrorMessage(body) {
|
|
419
|
+
if (typeof body === "string") {
|
|
420
|
+
return body;
|
|
421
|
+
}
|
|
422
|
+
if (isJsonObject(body) && typeof body.error === "string") {
|
|
423
|
+
return body.error;
|
|
424
|
+
}
|
|
425
|
+
if (isJsonObject(body) && typeof body.message === "string") {
|
|
426
|
+
return body.message;
|
|
427
|
+
}
|
|
428
|
+
return void 0;
|
|
429
|
+
}
|
|
430
|
+
shouldAutoTopUpHistory(payload, error) {
|
|
431
|
+
if (!this.historyAutoTopUp || payload.historyTtlSeconds === void 0) {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
if (!(error instanceof RegistryBrokerError)) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
if (error.status !== 402) {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
const message = this.extractErrorMessage(error.body);
|
|
441
|
+
if (!message) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
const normalised = message.toLowerCase();
|
|
445
|
+
return normalised.includes("history") || normalised.includes("chat history");
|
|
446
|
+
}
|
|
447
|
+
async executeHistoryAutoTopUp(reason) {
|
|
448
|
+
if (!this.historyAutoTopUp) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const hbarAmount = this.historyAutoTopUp.hbarAmount && this.historyAutoTopUp.hbarAmount > 0 ? this.historyAutoTopUp.hbarAmount : DEFAULT_HISTORY_TOP_UP_HBAR;
|
|
452
|
+
await this.purchaseCreditsWithHbar({
|
|
453
|
+
accountId: this.historyAutoTopUp.accountId,
|
|
454
|
+
privateKey: this.historyAutoTopUp.privateKey,
|
|
455
|
+
hbarAmount,
|
|
456
|
+
memo: this.historyAutoTopUp.memo ?? "registry-broker-client:chat-history-topup",
|
|
457
|
+
metadata: {
|
|
458
|
+
purpose: "chat-history",
|
|
459
|
+
reason
|
|
167
460
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
initializeEncryptionBootstrap(options) {
|
|
464
|
+
return this.bootstrapEncryptionOptions(options).then(() => void 0);
|
|
465
|
+
}
|
|
466
|
+
bootstrapEncryptionOptions(_options) {
|
|
467
|
+
return Promise.resolve(null);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Purchase credits with HBAR - stub implementation
|
|
471
|
+
* Full credits support available in npm version
|
|
472
|
+
*/
|
|
473
|
+
async purchaseCreditsWithHbar(_options) {
|
|
474
|
+
throw new Error(
|
|
475
|
+
"Credits not available in JSR version. Use npm: @hashgraphonline/standards-sdk"
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
async search(params = {}) {
|
|
479
|
+
const query = buildSearchQuery(params);
|
|
480
|
+
const raw = await this.requestJson(`/search${query}`, {
|
|
481
|
+
method: "GET"
|
|
482
|
+
});
|
|
483
|
+
return this.parseWithSchema(raw, searchResponseSchema, "search response");
|
|
484
|
+
}
|
|
485
|
+
async stats() {
|
|
486
|
+
const raw = await this.requestJson("/stats", { method: "GET" });
|
|
487
|
+
return this.parseWithSchema(raw, statsResponseSchema, "stats response");
|
|
488
|
+
}
|
|
489
|
+
async registries() {
|
|
490
|
+
const raw = await this.requestJson("/registries", {
|
|
491
|
+
method: "GET"
|
|
492
|
+
});
|
|
493
|
+
return this.parseWithSchema(
|
|
494
|
+
raw,
|
|
495
|
+
registriesResponseSchema,
|
|
496
|
+
"registries response"
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
async getAdditionalRegistries() {
|
|
500
|
+
const raw = await this.requestJson(
|
|
501
|
+
"/register/additional-registries",
|
|
502
|
+
{
|
|
503
|
+
method: "GET"
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
return this.parseWithSchema(
|
|
507
|
+
raw,
|
|
508
|
+
additionalRegistryCatalogResponseSchema,
|
|
509
|
+
"additional registry catalog response"
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
async popularSearches() {
|
|
513
|
+
const raw = await this.requestJson("/popular", {
|
|
514
|
+
method: "GET"
|
|
515
|
+
});
|
|
516
|
+
return this.parseWithSchema(
|
|
517
|
+
raw,
|
|
518
|
+
popularResponseSchema,
|
|
519
|
+
"popular searches response"
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
async listProtocols() {
|
|
523
|
+
const raw = await this.requestJson("/protocols", {
|
|
524
|
+
method: "GET"
|
|
525
|
+
});
|
|
526
|
+
return this.parseWithSchema(
|
|
527
|
+
raw,
|
|
528
|
+
protocolsResponseSchema,
|
|
529
|
+
"protocols response"
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
async detectProtocol(message) {
|
|
533
|
+
const raw = await this.requestJson("/detect-protocol", {
|
|
534
|
+
method: "POST",
|
|
535
|
+
body: { message },
|
|
536
|
+
headers: { "content-type": "application/json" }
|
|
537
|
+
});
|
|
538
|
+
return this.parseWithSchema(
|
|
539
|
+
raw,
|
|
540
|
+
detectProtocolResponseSchema,
|
|
541
|
+
"detect protocol response"
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
async registrySearchByNamespace(registry, query) {
|
|
545
|
+
const params = new URLSearchParams();
|
|
546
|
+
if (query) {
|
|
547
|
+
params.set("q", query);
|
|
171
548
|
}
|
|
549
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
550
|
+
const raw = await this.requestJson(
|
|
551
|
+
`/registries/${encodeURIComponent(registry)}/search${suffix}`,
|
|
552
|
+
{
|
|
553
|
+
method: "GET"
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
return this.parseWithSchema(
|
|
557
|
+
raw,
|
|
558
|
+
registrySearchByNamespaceSchema,
|
|
559
|
+
"registry search response"
|
|
560
|
+
);
|
|
172
561
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
562
|
+
async vectorSearch(request) {
|
|
563
|
+
try {
|
|
564
|
+
const raw = await this.requestJson("/search", {
|
|
565
|
+
method: "POST",
|
|
566
|
+
body: request,
|
|
567
|
+
headers: { "content-type": "application/json" }
|
|
568
|
+
});
|
|
569
|
+
return this.parseWithSchema(
|
|
570
|
+
raw,
|
|
571
|
+
vectorSearchResponseSchema,
|
|
572
|
+
"vector search response"
|
|
573
|
+
);
|
|
574
|
+
} catch (error) {
|
|
575
|
+
if (error instanceof RegistryBrokerError && error.status === 501) {
|
|
576
|
+
const fallbackParams = { q: request.query };
|
|
577
|
+
if (request.limit) fallbackParams.limit = request.limit;
|
|
578
|
+
if (request.filter?.registry) fallbackParams.registry = request.filter.registry;
|
|
579
|
+
if (request.filter?.protocols?.length) fallbackParams.protocols = [...request.filter.protocols];
|
|
580
|
+
const fallback = await this.search(fallbackParams);
|
|
581
|
+
return {
|
|
582
|
+
hits: fallback.hits.map((agent) => ({ agent, score: 0, highlights: {} })),
|
|
583
|
+
total: fallback.total,
|
|
584
|
+
took: 0,
|
|
585
|
+
totalAvailable: fallback.total,
|
|
586
|
+
visible: fallback.hits.length,
|
|
587
|
+
limited: fallback.total > fallback.limit,
|
|
588
|
+
credits_used: 0
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
throw error;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
async searchStatus() {
|
|
595
|
+
const raw = await this.requestJson("/search/status", {
|
|
596
|
+
method: "GET"
|
|
597
|
+
});
|
|
598
|
+
return this.parseWithSchema(
|
|
599
|
+
raw,
|
|
600
|
+
searchStatusResponseSchema,
|
|
601
|
+
"search status response"
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
async websocketStats() {
|
|
605
|
+
const raw = await this.requestJson("/websocket/stats", {
|
|
606
|
+
method: "GET"
|
|
607
|
+
});
|
|
608
|
+
return this.parseWithSchema(
|
|
609
|
+
raw,
|
|
610
|
+
websocketStatsResponseSchema,
|
|
611
|
+
"websocket stats response"
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
async metricsSummary() {
|
|
615
|
+
const raw = await this.requestJson("/metrics", {
|
|
616
|
+
method: "GET"
|
|
617
|
+
});
|
|
618
|
+
return this.parseWithSchema(
|
|
619
|
+
raw,
|
|
620
|
+
metricsSummaryResponseSchema,
|
|
621
|
+
"metrics summary response"
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
async facets(adapter) {
|
|
625
|
+
const params = new URLSearchParams();
|
|
626
|
+
if (adapter) {
|
|
627
|
+
params.set("adapter", adapter);
|
|
628
|
+
}
|
|
629
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
630
|
+
const raw = await this.requestJson(`/search/facets${suffix}`, {
|
|
631
|
+
method: "GET"
|
|
632
|
+
});
|
|
633
|
+
return this.parseWithSchema(
|
|
634
|
+
raw,
|
|
635
|
+
searchFacetsResponseSchema,
|
|
636
|
+
"search facets response"
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
const isPendingRegisterAgentResponse = (response) => response.status === "pending";
|
|
641
|
+
const isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
|
|
642
|
+
const isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
|
|
643
|
+
export {
|
|
644
|
+
RegistryBrokerClient,
|
|
645
|
+
isPartialRegisterAgentResponse,
|
|
646
|
+
isPendingRegisterAgentResponse,
|
|
647
|
+
isSuccessRegisterAgentResponse
|
|
179
648
|
};
|
|
180
649
|
//# sourceMappingURL=standards-sdk.es127.js.map
|