@hashgraphonline/standards-sdk 0.1.170 → 0.1.171
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 +2 -2
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es128.js +5 -5
- package/dist/es/standards-sdk.es138.js +1 -1
- package/dist/es/standards-sdk.es139.js +1 -1
- package/dist/es/standards-sdk.es140.js +5 -5
- package/dist/es/standards-sdk.es142.js +1 -1
- package/dist/es/standards-sdk.es148.js +1 -1
- package/dist/es/standards-sdk.es149.js +1 -1
- package/dist/es/standards-sdk.es161.js +542 -48
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +59 -70
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +48 -73
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +64 -180
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +79 -15
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +187 -537
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +13 -168
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +139 -289
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +274 -298
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +262 -369
- package/dist/es/standards-sdk.es170.js.map +1 -1
- package/dist/es/standards-sdk.es171.js +316 -194
- package/dist/es/standards-sdk.es171.js.map +1 -1
- package/dist/es/standards-sdk.es172.js +319 -64
- package/dist/es/standards-sdk.es172.js.map +1 -1
- package/dist/es/standards-sdk.es173.js +66 -63
- package/dist/es/standards-sdk.es173.js.map +1 -1
- package/dist/es/standards-sdk.es174.js +1 -1
- package/dist/es/standards-sdk.es178.js +1 -1
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es63.js +2 -2
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +1 -1
- package/dist/es/standards-sdk.es69.js +1 -1
- package/dist/es/standards-sdk.es71.js +1 -1
- package/dist/es/standards-sdk.es72.js +1 -1
- package/package.json +1 -1
|
@@ -1,553 +1,203 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return client.parseWithSchema(
|
|
55
|
-
raw,
|
|
56
|
-
skillRegistryListResponseSchema,
|
|
57
|
-
"skill registry list response"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
async function getSkillSecurityBreakdown(client, params) {
|
|
61
|
-
const normalizedJobId = params.jobId.trim();
|
|
62
|
-
if (!normalizedJobId) {
|
|
63
|
-
throw new Error("jobId is required");
|
|
64
|
-
}
|
|
65
|
-
const raw = await client.requestJson(
|
|
66
|
-
`/skills/${encodeURIComponent(normalizedJobId)}/security-breakdown`,
|
|
67
|
-
{ method: "GET" }
|
|
68
|
-
);
|
|
69
|
-
return client.parseWithSchema(
|
|
70
|
-
raw,
|
|
71
|
-
skillSecurityBreakdownResponseSchema,
|
|
72
|
-
"skill security breakdown response"
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
async function getSkillsCatalog(client, params = {}) {
|
|
76
|
-
const query = new URLSearchParams();
|
|
77
|
-
if (params.q) {
|
|
78
|
-
query.set("q", params.q);
|
|
79
|
-
}
|
|
80
|
-
if (params.category) {
|
|
81
|
-
query.set("category", params.category);
|
|
82
|
-
}
|
|
83
|
-
params.tags?.forEach((tag) => {
|
|
84
|
-
if (tag.trim()) {
|
|
85
|
-
query.append("tag", tag.trim());
|
|
1
|
+
import { parseSemicolonFields } from "./standards-sdk.es165.js";
|
|
2
|
+
const ANS_HCS27_REGISTRY = "ans";
|
|
3
|
+
function isObjectRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null;
|
|
5
|
+
}
|
|
6
|
+
function asString(value) {
|
|
7
|
+
if (typeof value !== "string") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const trimmed = value.trim();
|
|
11
|
+
if (!trimmed) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return trimmed;
|
|
15
|
+
}
|
|
16
|
+
function isSemver(value) {
|
|
17
|
+
return /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(
|
|
18
|
+
value
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function normalizeAnsVersion(value) {
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (!trimmed) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const withoutPrefix = trimmed.startsWith("v") || trimmed.startsWith("V") ? trimmed.slice(1) : trimmed;
|
|
27
|
+
if (!isSemver(withoutPrefix)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return withoutPrefix;
|
|
31
|
+
}
|
|
32
|
+
function parseAnsDnsTxtRecord(rawRecord) {
|
|
33
|
+
const fields = parseSemicolonFields(rawRecord);
|
|
34
|
+
const version = fields["v"];
|
|
35
|
+
const urlValue = fields["url"];
|
|
36
|
+
if (!version || !urlValue || version.toLowerCase() !== "ans1") {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
let parsedUrl;
|
|
40
|
+
try {
|
|
41
|
+
parsedUrl = new URL(urlValue);
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (parsedUrl.protocol.toLowerCase() !== "https:") {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const rawAnsVersion = fields["version"];
|
|
49
|
+
let normalizedAnsVersion;
|
|
50
|
+
if (rawAnsVersion !== void 0) {
|
|
51
|
+
const parsedVersion = normalizeAnsVersion(rawAnsVersion);
|
|
52
|
+
if (!parsedVersion) {
|
|
53
|
+
return null;
|
|
86
54
|
}
|
|
87
|
-
|
|
88
|
-
if (typeof params.featured === "boolean") {
|
|
89
|
-
query.set("featured", params.featured ? "true" : "false");
|
|
90
|
-
}
|
|
91
|
-
if (typeof params.verified === "boolean") {
|
|
92
|
-
query.set("verified", params.verified ? "true" : "false");
|
|
93
|
-
}
|
|
94
|
-
if (params.channel) {
|
|
95
|
-
query.set("channel", params.channel);
|
|
96
|
-
}
|
|
97
|
-
if (params.sortBy) {
|
|
98
|
-
query.set("sortBy", params.sortBy);
|
|
55
|
+
normalizedAnsVersion = parsedVersion;
|
|
99
56
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
query.set("cursor", params.cursor);
|
|
105
|
-
}
|
|
106
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
107
|
-
const raw = await client.requestJson(`/skills/catalog${suffix}`, {
|
|
108
|
-
method: "GET"
|
|
109
|
-
});
|
|
110
|
-
return client.parseWithSchema(
|
|
111
|
-
raw,
|
|
112
|
-
skillCatalogResponseSchema,
|
|
113
|
-
"skill catalog response"
|
|
114
|
-
);
|
|
57
|
+
return {
|
|
58
|
+
version: normalizedAnsVersion,
|
|
59
|
+
url: parsedUrl.toString()
|
|
60
|
+
};
|
|
115
61
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (!normalizedName) {
|
|
119
|
-
throw new Error("name is required");
|
|
120
|
-
}
|
|
121
|
-
const query = new URLSearchParams();
|
|
122
|
-
query.set("name", normalizedName);
|
|
123
|
-
const raw = await client.requestJson(
|
|
124
|
-
`/skills/versions?${query.toString()}`,
|
|
125
|
-
{ method: "GET" }
|
|
126
|
-
);
|
|
127
|
-
return client.parseWithSchema(
|
|
128
|
-
raw,
|
|
129
|
-
skillRegistryVersionsResponseSchema,
|
|
130
|
-
"skill registry versions response"
|
|
131
|
-
);
|
|
62
|
+
function isValidAnsProfileVersion(value) {
|
|
63
|
+
return !!value && normalizeAnsVersion(value) !== null;
|
|
132
64
|
}
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
139
|
-
const raw = await client.requestJson(`/skills/mine${suffix}`, {
|
|
140
|
-
method: "GET"
|
|
141
|
-
});
|
|
142
|
-
return client.parseWithSchema(
|
|
143
|
-
raw,
|
|
144
|
-
skillRegistryMineResponseSchema,
|
|
145
|
-
"skill registry mine response"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
async function getMySkillsList(client, params = {}) {
|
|
149
|
-
const query = new URLSearchParams();
|
|
150
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
151
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
152
|
-
}
|
|
153
|
-
if (params.cursor) {
|
|
154
|
-
query.set("cursor", params.cursor);
|
|
65
|
+
function hasProtocolPathSegment(pathname, protocol) {
|
|
66
|
+
const normalizedProtocol = protocol.trim().toLowerCase();
|
|
67
|
+
if (!normalizedProtocol) {
|
|
68
|
+
return false;
|
|
155
69
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const raw = await client.requestJson(`/skills/my-list${suffix}`, {
|
|
161
|
-
method: "GET"
|
|
162
|
-
});
|
|
163
|
-
return client.parseWithSchema(
|
|
164
|
-
raw,
|
|
165
|
-
skillRegistryMyListResponseSchema,
|
|
166
|
-
"skill registry my list response"
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
async function quoteSkillPublish(client, payload) {
|
|
170
|
-
const raw = await client.requestJson("/skills/quote", {
|
|
171
|
-
method: "POST",
|
|
172
|
-
body: payload,
|
|
173
|
-
headers: { "content-type": "application/json" }
|
|
174
|
-
});
|
|
175
|
-
return client.parseWithSchema(
|
|
176
|
-
raw,
|
|
177
|
-
skillRegistryQuoteResponseSchema,
|
|
178
|
-
"skill registry quote response"
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
async function publishSkill(client, payload) {
|
|
182
|
-
const raw = await client.requestJson("/skills/publish", {
|
|
183
|
-
method: "POST",
|
|
184
|
-
body: payload,
|
|
185
|
-
headers: { "content-type": "application/json" }
|
|
186
|
-
});
|
|
187
|
-
return client.parseWithSchema(
|
|
188
|
-
raw,
|
|
189
|
-
skillRegistryPublishResponseSchema,
|
|
190
|
-
"skill registry publish response"
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
async function getSkillPublishJob(client, jobId, params = {}) {
|
|
194
|
-
const normalized = jobId.trim();
|
|
195
|
-
if (!normalized) {
|
|
196
|
-
throw new Error("jobId is required");
|
|
197
|
-
}
|
|
198
|
-
const query = new URLSearchParams();
|
|
199
|
-
if (params.accountId) {
|
|
200
|
-
query.set("accountId", params.accountId);
|
|
201
|
-
}
|
|
202
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
203
|
-
const raw = await client.requestJson(
|
|
204
|
-
`/skills/jobs/${encodeURIComponent(normalized)}${suffix}`,
|
|
205
|
-
{ method: "GET" }
|
|
206
|
-
);
|
|
207
|
-
return client.parseWithSchema(
|
|
208
|
-
raw,
|
|
209
|
-
skillRegistryJobStatusResponseSchema,
|
|
210
|
-
"skill registry job status response"
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
async function getSkillOwnership(client, params) {
|
|
214
|
-
const normalizedName = params.name.trim();
|
|
215
|
-
if (!normalizedName) {
|
|
216
|
-
throw new Error("name is required");
|
|
217
|
-
}
|
|
218
|
-
const query = new URLSearchParams();
|
|
219
|
-
query.set("name", normalizedName);
|
|
220
|
-
if (params.accountId) {
|
|
221
|
-
query.set("accountId", params.accountId);
|
|
222
|
-
}
|
|
223
|
-
const raw = await client.requestJson(
|
|
224
|
-
`/skills/ownership?${query.toString()}`,
|
|
225
|
-
{
|
|
226
|
-
method: "GET"
|
|
70
|
+
const pathSegments = pathname.split("/").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
|
|
71
|
+
for (const segment of pathSegments) {
|
|
72
|
+
if (segment.toLowerCase() === normalizedProtocol) {
|
|
73
|
+
return true;
|
|
227
74
|
}
|
|
228
|
-
);
|
|
229
|
-
return client.parseWithSchema(
|
|
230
|
-
raw,
|
|
231
|
-
skillRegistryOwnershipResponseSchema,
|
|
232
|
-
"skill registry ownership response"
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
async function getRecommendedSkillVersion(client, params) {
|
|
236
|
-
const normalizedName = params.name.trim();
|
|
237
|
-
if (!normalizedName) {
|
|
238
|
-
throw new Error("name is required");
|
|
239
75
|
}
|
|
240
|
-
|
|
241
|
-
query.set("name", normalizedName);
|
|
242
|
-
const raw = await client.requestJson(
|
|
243
|
-
`/skills/recommended?${query.toString()}`,
|
|
244
|
-
{ method: "GET" }
|
|
245
|
-
);
|
|
246
|
-
return client.parseWithSchema(
|
|
247
|
-
raw,
|
|
248
|
-
skillRecommendedVersionResponseSchema,
|
|
249
|
-
"skill recommended version response"
|
|
250
|
-
);
|
|
76
|
+
return false;
|
|
251
77
|
}
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
if (!normalizedVersion) {
|
|
259
|
-
throw new Error("version is required");
|
|
260
|
-
}
|
|
261
|
-
const raw = await client.requestJson("/skills/recommended", {
|
|
262
|
-
method: "POST",
|
|
263
|
-
body: {
|
|
264
|
-
name: normalizedName,
|
|
265
|
-
version: normalizedVersion
|
|
266
|
-
},
|
|
267
|
-
headers: { "content-type": "application/json" }
|
|
268
|
-
});
|
|
269
|
-
return client.parseWithSchema(
|
|
270
|
-
raw,
|
|
271
|
-
skillRecommendedVersionResponseSchema,
|
|
272
|
-
"skill recommended version response"
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
async function getSkillDeprecations(client, params) {
|
|
276
|
-
const normalizedName = params.name.trim();
|
|
277
|
-
if (!normalizedName) {
|
|
278
|
-
throw new Error("name is required");
|
|
279
|
-
}
|
|
280
|
-
const query = new URLSearchParams();
|
|
281
|
-
query.set("name", normalizedName);
|
|
282
|
-
const raw = await client.requestJson(
|
|
283
|
-
`/skills/deprecations?${query.toString()}`,
|
|
284
|
-
{ method: "GET" }
|
|
285
|
-
);
|
|
286
|
-
return client.parseWithSchema(
|
|
287
|
-
raw,
|
|
288
|
-
skillDeprecationsResponseSchema,
|
|
289
|
-
"skill deprecations response"
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
async function setSkillDeprecation(client, payload) {
|
|
293
|
-
const normalizedName = payload.name.trim();
|
|
294
|
-
if (!normalizedName) {
|
|
295
|
-
throw new Error("name is required");
|
|
296
|
-
}
|
|
297
|
-
const version = payload.version?.trim();
|
|
298
|
-
const reason = payload.reason.trim();
|
|
299
|
-
if (!reason) {
|
|
300
|
-
throw new Error("reason is required");
|
|
301
|
-
}
|
|
302
|
-
const replacementRef = payload.replacementRef?.trim();
|
|
303
|
-
const raw = await client.requestJson("/skills/deprecate", {
|
|
304
|
-
method: "POST",
|
|
305
|
-
body: {
|
|
306
|
-
name: normalizedName,
|
|
307
|
-
version,
|
|
308
|
-
reason,
|
|
309
|
-
replacementRef
|
|
310
|
-
},
|
|
311
|
-
headers: { "content-type": "application/json" }
|
|
312
|
-
});
|
|
313
|
-
return client.parseWithSchema(
|
|
314
|
-
raw,
|
|
315
|
-
skillDeprecationRecordSchema,
|
|
316
|
-
"skill deprecation response"
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
async function getSkillBadge(client, params) {
|
|
320
|
-
const normalizedName = params.name.trim();
|
|
321
|
-
if (!normalizedName) {
|
|
322
|
-
throw new Error("name is required");
|
|
323
|
-
}
|
|
324
|
-
const query = new URLSearchParams();
|
|
325
|
-
query.set("name", normalizedName);
|
|
326
|
-
if (params.metric) {
|
|
327
|
-
query.set("metric", params.metric);
|
|
328
|
-
}
|
|
329
|
-
if (params.label?.trim()) {
|
|
330
|
-
query.set("label", params.label.trim());
|
|
331
|
-
}
|
|
332
|
-
if (params.style) {
|
|
333
|
-
query.set("style", params.style);
|
|
334
|
-
}
|
|
335
|
-
const raw = await client.requestJson(
|
|
336
|
-
`/skills/badge?${query.toString()}`,
|
|
337
|
-
{ method: "GET" }
|
|
338
|
-
);
|
|
339
|
-
return client.parseWithSchema(
|
|
340
|
-
raw,
|
|
341
|
-
skillBadgeResponseSchema,
|
|
342
|
-
"skill badge response"
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
async function listSkillTags(client) {
|
|
346
|
-
const raw = await client.requestJson("/skills/tags", {
|
|
347
|
-
method: "GET"
|
|
348
|
-
});
|
|
349
|
-
return client.parseWithSchema(
|
|
350
|
-
raw,
|
|
351
|
-
skillRegistryTagsResponseSchema,
|
|
352
|
-
"skill tags response"
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
async function listSkillCategories(client) {
|
|
356
|
-
const raw = await client.requestJson("/skills/categories", {
|
|
357
|
-
method: "GET"
|
|
358
|
-
});
|
|
359
|
-
return client.parseWithSchema(
|
|
360
|
-
raw,
|
|
361
|
-
skillRegistryCategoriesResponseSchema,
|
|
362
|
-
"skill categories response"
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
async function resolveSkillMarkdown(client, skillRef) {
|
|
366
|
-
const normalizedSkillRef = skillRef.trim();
|
|
367
|
-
if (!normalizedSkillRef) {
|
|
368
|
-
throw new Error("skillRef is required");
|
|
369
|
-
}
|
|
370
|
-
const response = await client.request(
|
|
371
|
-
`/skills/${encodeURIComponent(normalizedSkillRef)}/SKILL.md`,
|
|
372
|
-
{
|
|
373
|
-
method: "GET",
|
|
374
|
-
headers: {
|
|
375
|
-
accept: "text/markdown, text/plain;q=0.9, */*;q=0.8"
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
return response.text();
|
|
380
|
-
}
|
|
381
|
-
async function resolveSkillManifest(client, skillRef) {
|
|
382
|
-
const normalizedSkillRef = skillRef.trim();
|
|
383
|
-
if (!normalizedSkillRef) {
|
|
384
|
-
throw new Error("skillRef is required");
|
|
385
|
-
}
|
|
386
|
-
const raw = await client.requestJson(
|
|
387
|
-
`/skills/${encodeURIComponent(normalizedSkillRef)}/manifest`,
|
|
388
|
-
{
|
|
389
|
-
method: "GET"
|
|
78
|
+
function extractEndpointCandidates(endpoints, supportedSchemes) {
|
|
79
|
+
const candidates = [];
|
|
80
|
+
for (const [key, value] of Object.entries(endpoints)) {
|
|
81
|
+
if (!isObjectRecord(value)) {
|
|
82
|
+
continue;
|
|
390
83
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
skillResolverManifestResponseSchema,
|
|
395
|
-
"skill resolver manifest response"
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
async function getSkillVoteStatus(client, params) {
|
|
399
|
-
const normalizedName = params.name.trim();
|
|
400
|
-
if (!normalizedName) {
|
|
401
|
-
throw new Error("name is required");
|
|
402
|
-
}
|
|
403
|
-
const query = new URLSearchParams();
|
|
404
|
-
query.set("name", normalizedName);
|
|
405
|
-
const raw = await client.requestJson(
|
|
406
|
-
`/skills/vote?${query.toString()}`,
|
|
407
|
-
{ method: "GET" }
|
|
408
|
-
);
|
|
409
|
-
return client.parseWithSchema(
|
|
410
|
-
raw,
|
|
411
|
-
skillRegistryVoteStatusResponseSchema,
|
|
412
|
-
"skill registry vote status response"
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
async function setSkillVote(client, payload) {
|
|
416
|
-
const normalizedName = payload.name.trim();
|
|
417
|
-
if (!normalizedName) {
|
|
418
|
-
throw new Error("name is required");
|
|
419
|
-
}
|
|
420
|
-
const raw = await client.requestJson("/skills/vote", {
|
|
421
|
-
method: "POST",
|
|
422
|
-
body: { name: normalizedName, upvoted: payload.upvoted },
|
|
423
|
-
headers: { "content-type": "application/json" }
|
|
424
|
-
});
|
|
425
|
-
return client.parseWithSchema(
|
|
426
|
-
raw,
|
|
427
|
-
skillRegistryVoteStatusResponseSchema,
|
|
428
|
-
"skill registry vote status response"
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
async function requestSkillVerification(client, payload) {
|
|
432
|
-
const normalizedName = payload.name.trim();
|
|
433
|
-
if (!normalizedName) {
|
|
434
|
-
throw new Error("name is required");
|
|
435
|
-
}
|
|
436
|
-
const raw = await client.requestJson(
|
|
437
|
-
"/skills/verification/request",
|
|
438
|
-
{
|
|
439
|
-
method: "POST",
|
|
440
|
-
body: {
|
|
441
|
-
name: normalizedName,
|
|
442
|
-
version: payload.version,
|
|
443
|
-
tier: payload.tier
|
|
444
|
-
},
|
|
445
|
-
headers: { "content-type": "application/json" }
|
|
84
|
+
const endpoint = asString(value["url"]);
|
|
85
|
+
if (!endpoint) {
|
|
86
|
+
continue;
|
|
446
87
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
async function getSkillVerificationStatus(client, params) {
|
|
455
|
-
const normalizedName = params.name.trim();
|
|
456
|
-
if (!normalizedName) {
|
|
457
|
-
throw new Error("name is required");
|
|
458
|
-
}
|
|
459
|
-
const query = new URLSearchParams();
|
|
460
|
-
query.set("name", normalizedName);
|
|
461
|
-
if (params.version) {
|
|
462
|
-
query.set("version", params.version);
|
|
463
|
-
}
|
|
464
|
-
const raw = await client.requestJson(
|
|
465
|
-
`/skills/verification/status?${query.toString()}`,
|
|
466
|
-
{ method: "GET" }
|
|
467
|
-
);
|
|
468
|
-
return client.parseWithSchema(
|
|
469
|
-
raw,
|
|
470
|
-
skillVerificationStatusResponseSchema,
|
|
471
|
-
"skill verification status response"
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
async function createSkillDomainProofChallenge(client, payload) {
|
|
475
|
-
const normalizedName = payload.name.trim();
|
|
476
|
-
if (!normalizedName) {
|
|
477
|
-
throw new Error("name is required");
|
|
478
|
-
}
|
|
479
|
-
const raw = await client.requestJson(
|
|
480
|
-
"/skills/verification/domain/challenge",
|
|
481
|
-
{
|
|
482
|
-
method: "POST",
|
|
483
|
-
body: {
|
|
484
|
-
name: normalizedName,
|
|
485
|
-
version: payload.version,
|
|
486
|
-
domain: payload.domain
|
|
487
|
-
},
|
|
488
|
-
headers: { "content-type": "application/json" }
|
|
88
|
+
let parsedUrl;
|
|
89
|
+
try {
|
|
90
|
+
parsedUrl = new URL(endpoint);
|
|
91
|
+
} catch {
|
|
92
|
+
continue;
|
|
489
93
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
skillVerificationDomainProofChallengeResponseSchema,
|
|
494
|
-
"skill domain proof challenge response"
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
async function verifySkillDomainProof(client, payload) {
|
|
498
|
-
const normalizedName = payload.name.trim();
|
|
499
|
-
const challengeToken = payload.challengeToken.trim();
|
|
500
|
-
if (!normalizedName) {
|
|
501
|
-
throw new Error("name is required");
|
|
502
|
-
}
|
|
503
|
-
if (!challengeToken) {
|
|
504
|
-
throw new Error("challengeToken is required");
|
|
505
|
-
}
|
|
506
|
-
const raw = await client.requestJson(
|
|
507
|
-
"/skills/verification/domain/verify",
|
|
508
|
-
{
|
|
509
|
-
method: "POST",
|
|
510
|
-
body: {
|
|
511
|
-
name: normalizedName,
|
|
512
|
-
version: payload.version,
|
|
513
|
-
domain: payload.domain,
|
|
514
|
-
challengeToken
|
|
515
|
-
},
|
|
516
|
-
headers: { "content-type": "application/json" }
|
|
94
|
+
const scheme = parsedUrl.protocol.replace(/:$/, "").toLowerCase();
|
|
95
|
+
if (!supportedSchemes.has(scheme)) {
|
|
96
|
+
continue;
|
|
517
97
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
98
|
+
candidates.push({
|
|
99
|
+
key,
|
|
100
|
+
endpointUrl: parsedUrl.toString(),
|
|
101
|
+
parsedUrl
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return candidates;
|
|
105
|
+
}
|
|
106
|
+
function validateAnsHcs27Hints(input) {
|
|
107
|
+
if (!isObjectRecord(input)) {
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
const checkpointTopicId = asString(input["checkpoint_topic_id"]);
|
|
111
|
+
const registry = asString(input["registry"]);
|
|
112
|
+
const logId = asString(input["log_id"]);
|
|
113
|
+
if (!checkpointTopicId || !registry || !logId || registry !== ANS_HCS27_REGISTRY) {
|
|
114
|
+
return void 0;
|
|
115
|
+
}
|
|
116
|
+
const checkpointUri = asString(input["checkpoint_uri"]) ?? void 0;
|
|
117
|
+
const viewerUri = asString(input["viewer_uri"]) ?? void 0;
|
|
118
|
+
return {
|
|
119
|
+
checkpointTopicId,
|
|
120
|
+
registry,
|
|
121
|
+
logId,
|
|
122
|
+
checkpointUri,
|
|
123
|
+
viewerUri
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function validateHcs28Hints(input) {
|
|
127
|
+
if (!isObjectRecord(input)) {
|
|
128
|
+
return void 0;
|
|
129
|
+
}
|
|
130
|
+
const directoryTopicId = asString(input["directory_topic_id"]);
|
|
131
|
+
const tId = asString(input["t_id"]);
|
|
132
|
+
const agentId = asString(input["agent_id"]);
|
|
133
|
+
if (!directoryTopicId || !tId || !agentId) {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
const proofProfile = asString(input["proof_profile"]) ?? void 0;
|
|
137
|
+
return {
|
|
138
|
+
directoryTopicId,
|
|
139
|
+
tId,
|
|
140
|
+
agentId,
|
|
141
|
+
proofProfile
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function parseTransparencyHints(input) {
|
|
145
|
+
if (!isObjectRecord(input)) {
|
|
146
|
+
return void 0;
|
|
147
|
+
}
|
|
148
|
+
const hcs27 = validateAnsHcs27Hints(input["hcs27"]);
|
|
149
|
+
const hcs28 = validateHcs28Hints(input["hcs28"]);
|
|
150
|
+
if (!hcs27 && !hcs28) {
|
|
151
|
+
return void 0;
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
hcs27,
|
|
155
|
+
hcs28
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function parseAnsAgentCard(input) {
|
|
159
|
+
if (!isObjectRecord(input)) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
const ansName = asString(input["ansName"]);
|
|
163
|
+
const endpoints = input["endpoints"];
|
|
164
|
+
if (!ansName || !isObjectRecord(endpoints)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
ansName,
|
|
169
|
+
endpoints,
|
|
170
|
+
transparencyHints: parseTransparencyHints(input["transparency"])
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function selectPreferredEndpoint(candidates, protocol) {
|
|
174
|
+
if (candidates.length === 0) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const sortedCandidates = [...candidates].sort(
|
|
178
|
+
(a, b) => a.key.localeCompare(b.key)
|
|
179
|
+
);
|
|
180
|
+
const protocolMatches = sortedCandidates.filter(
|
|
181
|
+
(candidate) => hasProtocolPathSegment(candidate.parsedUrl.pathname, protocol)
|
|
182
|
+
);
|
|
183
|
+
if (protocolMatches.length > 0) {
|
|
184
|
+
return protocolMatches[0];
|
|
185
|
+
}
|
|
186
|
+
return sortedCandidates[0];
|
|
187
|
+
}
|
|
188
|
+
function toErrorMessage(error) {
|
|
189
|
+
if (error instanceof Error && error.message) {
|
|
190
|
+
return error.message;
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
524
193
|
}
|
|
525
194
|
export {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
getSkillSecurityBreakdown,
|
|
534
|
-
getSkillVerificationStatus,
|
|
535
|
-
getSkillVoteStatus,
|
|
536
|
-
getSkillsCatalog,
|
|
537
|
-
listMySkills,
|
|
538
|
-
listSkillCategories,
|
|
539
|
-
listSkillTags,
|
|
540
|
-
listSkillVersions,
|
|
541
|
-
listSkills,
|
|
542
|
-
publishSkill,
|
|
543
|
-
quoteSkillPublish,
|
|
544
|
-
requestSkillVerification,
|
|
545
|
-
resolveSkillManifest,
|
|
546
|
-
resolveSkillMarkdown,
|
|
547
|
-
setRecommendedSkillVersion,
|
|
548
|
-
setSkillDeprecation,
|
|
549
|
-
setSkillVote,
|
|
550
|
-
skillsConfig,
|
|
551
|
-
verifySkillDomainProof
|
|
195
|
+
extractEndpointCandidates,
|
|
196
|
+
isValidAnsProfileVersion,
|
|
197
|
+
normalizeAnsVersion,
|
|
198
|
+
parseAnsAgentCard,
|
|
199
|
+
parseAnsDnsTxtRecord,
|
|
200
|
+
selectPreferredEndpoint,
|
|
201
|
+
toErrorMessage
|
|
552
202
|
};
|
|
553
203
|
//# sourceMappingURL=standards-sdk.es166.js.map
|