@hashgraphonline/standards-sdk 0.1.182 → 0.1.183

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.
Files changed (92) hide show
  1. package/dist/browser/services/registry-broker/client/base-client.d.ts +2 -1
  2. package/dist/browser/services/registry-broker/client/base-client.d.ts.map +1 -1
  3. package/dist/browser/services/registry-broker/client/chat.d.ts +3 -1
  4. package/dist/browser/services/registry-broker/client/chat.d.ts.map +1 -1
  5. package/dist/browser/services/registry-broker/schemas.d.ts +307 -28
  6. package/dist/browser/services/registry-broker/schemas.d.ts.map +1 -1
  7. package/dist/browser/services/registry-broker/types.d.ts +6 -1
  8. package/dist/browser/services/registry-broker/types.d.ts.map +1 -1
  9. package/dist/browser/standards-sdk.browser.js +45 -0
  10. package/dist/browser/standards-sdk.browser.js.map +1 -1
  11. package/dist/browser-root/services/registry-broker/client/base-client.d.ts +2 -1
  12. package/dist/browser-root/services/registry-broker/client/base-client.d.ts.map +1 -1
  13. package/dist/browser-root/services/registry-broker/client/chat.d.ts +3 -1
  14. package/dist/browser-root/services/registry-broker/client/chat.d.ts.map +1 -1
  15. package/dist/browser-root/services/registry-broker/schemas.d.ts +307 -28
  16. package/dist/browser-root/services/registry-broker/schemas.d.ts.map +1 -1
  17. package/dist/browser-root/services/registry-broker/types.d.ts +6 -1
  18. package/dist/browser-root/services/registry-broker/types.d.ts.map +1 -1
  19. package/dist/browser-root/standards-sdk.root-browser.js +70 -0
  20. package/dist/browser-root/standards-sdk.root-browser.js.map +1 -1
  21. package/dist/cjs/services/registry-broker/client/base-client.d.ts +2 -1
  22. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
  23. package/dist/cjs/services/registry-broker/client/chat.d.ts +3 -1
  24. package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -1
  25. package/dist/cjs/services/registry-broker/schemas.d.ts +307 -28
  26. package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
  27. package/dist/cjs/services/registry-broker/types.d.ts +6 -1
  28. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  29. package/dist/cjs/standards-sdk.cjs +1 -1
  30. package/dist/cjs/standards-sdk.cjs.map +1 -1
  31. package/dist/es/services/registry-broker/client/base-client.d.ts +2 -1
  32. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
  33. package/dist/es/services/registry-broker/client/chat.d.ts +3 -1
  34. package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -1
  35. package/dist/es/services/registry-broker/schemas.d.ts +307 -28
  36. package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
  37. package/dist/es/services/registry-broker/types.d.ts +6 -1
  38. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  39. package/dist/es/standards-sdk.es121.js +1 -1
  40. package/dist/es/standards-sdk.es128.js +5 -5
  41. package/dist/es/standards-sdk.es138.js +1 -1
  42. package/dist/es/standards-sdk.es139.js +1 -1
  43. package/dist/es/standards-sdk.es140.js +5 -5
  44. package/dist/es/standards-sdk.es142.js +2 -2
  45. package/dist/es/standards-sdk.es145.js +6 -3
  46. package/dist/es/standards-sdk.es145.js.map +1 -1
  47. package/dist/es/standards-sdk.es148.js.map +1 -1
  48. package/dist/es/standards-sdk.es149.js +1 -1
  49. package/dist/es/standards-sdk.es161.js +46 -0
  50. package/dist/es/standards-sdk.es161.js.map +1 -1
  51. package/dist/es/standards-sdk.es163.js +54 -15
  52. package/dist/es/standards-sdk.es163.js.map +1 -1
  53. package/dist/es/standards-sdk.es164.js +102 -47
  54. package/dist/es/standards-sdk.es164.js.map +1 -1
  55. package/dist/es/standards-sdk.es165.js +64 -94
  56. package/dist/es/standards-sdk.es165.js.map +1 -1
  57. package/dist/es/standards-sdk.es166.js +180 -61
  58. package/dist/es/standards-sdk.es166.js.map +1 -1
  59. package/dist/es/standards-sdk.es167.js +14 -197
  60. package/dist/es/standards-sdk.es167.js.map +1 -1
  61. package/dist/es/standards-sdk.es168.js +66 -165
  62. package/dist/es/standards-sdk.es168.js.map +1 -1
  63. package/dist/es/standards-sdk.es169.js +657 -307
  64. package/dist/es/standards-sdk.es169.js.map +1 -1
  65. package/dist/es/standards-sdk.es170.js +120 -294
  66. package/dist/es/standards-sdk.es170.js.map +1 -1
  67. package/dist/es/standards-sdk.es171.js +191 -322
  68. package/dist/es/standards-sdk.es171.js.map +1 -1
  69. package/dist/es/standards-sdk.es172.js +294 -279
  70. package/dist/es/standards-sdk.es172.js.map +1 -1
  71. package/dist/es/standards-sdk.es173.js +440 -63
  72. package/dist/es/standards-sdk.es173.js.map +1 -1
  73. package/dist/es/standards-sdk.es174.js +317 -658
  74. package/dist/es/standards-sdk.es174.js.map +1 -1
  75. package/dist/es/standards-sdk.es175.js +66 -63
  76. package/dist/es/standards-sdk.es175.js.map +1 -1
  77. package/dist/es/standards-sdk.es177.js +24 -1
  78. package/dist/es/standards-sdk.es177.js.map +1 -1
  79. package/dist/es/standards-sdk.es179.js +1 -1
  80. package/dist/es/standards-sdk.es182.js +1 -1
  81. package/dist/es/standards-sdk.es56.js +1 -1
  82. package/dist/es/standards-sdk.es59.js +1 -1
  83. package/dist/es/standards-sdk.es60.js +1 -1
  84. package/dist/es/standards-sdk.es62.js +1 -1
  85. package/dist/es/standards-sdk.es63.js +2 -2
  86. package/dist/es/standards-sdk.es64.js +1 -1
  87. package/dist/es/standards-sdk.es65.js +1 -1
  88. package/dist/es/standards-sdk.es66.js +1 -1
  89. package/dist/es/standards-sdk.es69.js +1 -1
  90. package/dist/es/standards-sdk.es71.js +1 -1
  91. package/dist/es/standards-sdk.es72.js +1 -1
  92. package/package.json +1 -1
@@ -1,325 +1,675 @@
1
- import { proto } from "@hashgraph/proto";
2
- import { Long } from "@hashgraph/sdk";
3
- import { hasTransactionType, parseKey } from "./standards-sdk.es173.js";
4
- import { Buffer } from "buffer";
5
- class FileParser {
6
- /**
7
- * Parse File Service transaction using unified dual-branch approach
8
- * This handles both regular transactions and signed transaction variants
9
- */
10
- static parseFileTransaction(transaction, originalBytes) {
11
- try {
12
- if (originalBytes || transaction.toBytes) {
13
- try {
14
- const bytesToParse = originalBytes || transaction.toBytes();
15
- const decoded = proto.TransactionList.decode(bytesToParse);
16
- if (decoded.transactionList && decoded.transactionList.length > 0) {
17
- const tx = decoded.transactionList[0];
18
- let txBody = null;
19
- if (tx.bodyBytes && tx.bodyBytes.length > 0) {
20
- txBody = proto.TransactionBody.decode(tx.bodyBytes);
21
- } else if (tx.signedTransactionBytes && tx.signedTransactionBytes.length > 0) {
22
- const signedTx = proto.SignedTransaction.decode(
23
- tx.signedTransactionBytes
24
- );
25
- if (signedTx.bodyBytes) {
26
- txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
27
- }
28
- }
29
- if (txBody) {
30
- const protoResult = this.parseFromProtobufTxBody(txBody);
31
- if (protoResult.type && protoResult.type !== "UNKNOWN") {
32
- return protoResult;
33
- }
34
- }
35
- }
36
- } catch (protoError) {
37
- }
38
- }
39
- return this.parseFromTransactionInternals(transaction);
40
- } catch (error) {
41
- return { type: "UNKNOWN", humanReadableType: "Unknown File Transaction" };
42
- }
1
+ import { skillRegistryConfigResponseSchema, skillRegistryListResponseSchema, skillCatalogResponseSchema, skillRegistryVersionsResponseSchema, skillRegistryMineResponseSchema, skillRegistryMyListResponseSchema, skillRegistryQuoteResponseSchema, skillQuotePreviewResponseSchema, skillRegistryPublishResponseSchema, skillRegistryJobStatusResponseSchema, skillRegistryOwnershipResponseSchema, skillRecommendedVersionResponseSchema, skillDeprecationsResponseSchema, skillDeprecationRecordSchema, skillBadgeResponseSchema, skillStatusResponseSchema, skillSecurityBreakdownResponseSchema, skillConversionSignalsResponseSchema, skillPreviewRecordSchema, skillPreviewLookupResponseSchema, skillInstallResponseSchema, skillInstallCopyTelemetryResponseSchema, skillRegistryTagsResponseSchema, skillRegistryCategoriesResponseSchema, skillResolverManifestResponseSchema, skillRegistryVoteStatusResponseSchema, skillVerificationRequestCreateResponseSchema, skillVerificationStatusResponseSchema, skillVerificationDomainProofChallengeResponseSchema, skillVerificationDomainProofVerifyResponseSchema } from "./standards-sdk.es161.js";
2
+ function requireTrimmedString(value, fieldName) {
3
+ const normalizedValue = value.trim();
4
+ if (!normalizedValue) {
5
+ throw new Error(`${fieldName} is required`);
43
6
  }
44
- /**
45
- * Parse file transaction from protobuf TransactionBody
46
- * Handles all file operations from decoded protobuf data
47
- */
48
- static parseFromProtobufTxBody(txBody) {
49
- if (txBody.fileCreate) {
50
- const fileCreate = this.parseFileCreate(txBody.fileCreate);
51
- if (fileCreate) {
52
- return {
53
- type: "FILECREATE",
54
- humanReadableType: "File Create",
55
- fileCreate
56
- };
57
- }
58
- }
59
- if (txBody.fileAppend) {
60
- const fileAppend = this.parseFileAppend(txBody.fileAppend);
61
- if (fileAppend) {
62
- return {
63
- type: "FILEAPPEND",
64
- humanReadableType: "File Append",
65
- fileAppend
66
- };
67
- }
68
- }
69
- if (txBody.fileUpdate) {
70
- const fileUpdate = this.parseFileUpdate(txBody.fileUpdate);
71
- if (fileUpdate) {
72
- return {
73
- type: "FILEUPDATE",
74
- humanReadableType: "File Update",
75
- fileUpdate
76
- };
77
- }
78
- }
79
- if (txBody.fileDelete) {
80
- const fileDelete = this.parseFileDelete(txBody.fileDelete);
81
- if (fileDelete) {
82
- return {
83
- type: "FILEDELETE",
84
- humanReadableType: "File Delete",
85
- fileDelete
86
- };
87
- }
88
- }
89
- return {};
90
- }
91
- /**
92
- * Extract file data from Transaction internal fields
93
- * This handles cases where data is stored in Transaction object internals
94
- */
95
- static parseFromTransactionInternals(transaction) {
96
- try {
97
- const tx = transaction;
98
- if (hasTransactionType(transaction, "fileCreate")) {
99
- const fileCreate = {};
100
- if (tx._contents) {
101
- const contentInfo = this.analyzeContent(tx._contents);
102
- fileCreate.contents = contentInfo.encoded;
103
- if (contentInfo.contentType) {
104
- fileCreate.contentType = contentInfo.contentType;
105
- }
106
- if (contentInfo.size) {
107
- fileCreate.contentSize = contentInfo.size;
108
- }
109
- }
110
- if (tx._keys && tx._keys.length > 0) {
111
- const keyList = {
112
- keys: tx._keys
113
- };
114
- fileCreate.keys = parseKey({ keyList });
115
- }
116
- if (tx._expirationTime) {
117
- fileCreate.expirationTime = tx._expirationTime.toString();
118
- }
119
- if (tx._memo) {
120
- fileCreate.memo = tx._memo;
121
- }
122
- return {
123
- type: "FILECREATE",
124
- humanReadableType: "File Create",
125
- fileCreate
126
- };
127
- }
128
- if (hasTransactionType(transaction, "fileAppend")) {
129
- const fileAppend = {
130
- fileId: tx._fileId.toString()
131
- };
132
- if (tx._contents) {
133
- const contentInfo = this.analyzeContent(tx._contents);
134
- fileAppend.contents = contentInfo.encoded;
135
- if (contentInfo.size) {
136
- fileAppend.contentSize = contentInfo.size;
137
- }
138
- }
139
- return {
140
- type: "FILEAPPEND",
141
- humanReadableType: "File Append",
142
- fileAppend
143
- };
144
- }
145
- if (hasTransactionType(transaction, "fileUpdate")) {
146
- const fileUpdate = {
147
- fileId: tx._fileId.toString()
148
- };
149
- if (tx._contents) {
150
- const contentInfo = this.analyzeContent(tx._contents);
151
- fileUpdate.contents = contentInfo.encoded;
152
- if (contentInfo.size) {
153
- fileUpdate.contentSize = contentInfo.size;
154
- }
155
- }
156
- if (tx._keys && tx._keys.length > 0) {
157
- const keyList = {
158
- keys: tx._keys
159
- };
160
- fileUpdate.keys = parseKey({ keyList });
161
- }
162
- if (tx._expirationTime) {
163
- fileUpdate.expirationTime = tx._expirationTime.toString();
164
- }
165
- if (tx._memo) {
166
- fileUpdate.memo = tx._memo;
167
- }
168
- return {
169
- type: "FILEUPDATE",
170
- humanReadableType: "File Update",
171
- fileUpdate
172
- };
173
- }
174
- if (hasTransactionType(transaction, "fileDelete")) {
175
- const fileDelete = {
176
- fileId: tx._fileId.toString()
177
- };
178
- return {
179
- type: "FILEDELETE",
180
- humanReadableType: "File Delete",
181
- fileDelete
182
- };
183
- }
184
- return {};
185
- } catch (error) {
186
- return {};
187
- }
7
+ return normalizedValue;
8
+ }
9
+ async function skillsConfig(client) {
10
+ const raw = await client.requestJson("/skills/config", {
11
+ method: "GET"
12
+ });
13
+ return client.parseWithSchema(
14
+ raw,
15
+ skillRegistryConfigResponseSchema,
16
+ "skill registry config response"
17
+ );
18
+ }
19
+ async function listSkills(client, params = {}) {
20
+ const query = new URLSearchParams();
21
+ if (params.name) {
22
+ query.set("name", params.name);
23
+ }
24
+ if (params.version) {
25
+ query.set("version", params.version);
26
+ }
27
+ if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
28
+ query.set("limit", String(Math.trunc(params.limit)));
29
+ }
30
+ if (params.cursor) {
31
+ query.set("cursor", params.cursor);
32
+ }
33
+ if (typeof params.includeFiles === "boolean") {
34
+ query.set("includeFiles", params.includeFiles ? "true" : "false");
35
+ }
36
+ if (params.accountId) {
37
+ query.set("accountId", params.accountId);
38
+ }
39
+ if (params.q) {
40
+ query.set("q", params.q);
41
+ }
42
+ if (params.tag) {
43
+ query.set("tag", params.tag);
188
44
  }
189
- /**
190
- * Enhanced content analysis with type detection and metadata
191
- */
192
- static analyzeContent(contents) {
193
- const size = contents.length;
194
- const contentBuffer = Buffer.from(contents);
195
- let contentType;
196
- if (size >= 4) {
197
- const header = contentBuffer.subarray(0, 4);
198
- const headerHex = header.toString("hex");
199
- const signatures = {
200
- "89504e47": "image/png",
201
- ffd8ffe0: "image/jpeg",
202
- ffd8ffe1: "image/jpeg",
203
- "47494638": "image/gif",
204
- "25504446": "application/pdf",
205
- "504b0304": "application/zip",
206
- "7f454c46": "application/x-executable",
207
- d0cf11e0: "application/msoffice"
208
- };
209
- contentType = signatures[headerHex.toLowerCase()];
45
+ if (params.category) {
46
+ query.set("category", params.category);
47
+ }
48
+ if (typeof params.featured === "boolean") {
49
+ query.set("featured", params.featured ? "true" : "false");
50
+ }
51
+ if (typeof params.verified === "boolean") {
52
+ query.set("verified", params.verified ? "true" : "false");
53
+ }
54
+ if (params.view) {
55
+ query.set("view", params.view);
56
+ }
57
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
58
+ const raw = await client.requestJson(`/skills${suffix}`, {
59
+ method: "GET"
60
+ });
61
+ return client.parseWithSchema(
62
+ raw,
63
+ skillRegistryListResponseSchema,
64
+ "skill registry list response"
65
+ );
66
+ }
67
+ async function getSkillSecurityBreakdown(client, params) {
68
+ const normalizedJobId = requireTrimmedString(params.jobId, "jobId");
69
+ const raw = await client.requestJson(
70
+ `/skills/${encodeURIComponent(normalizedJobId)}/security-breakdown`,
71
+ { method: "GET" }
72
+ );
73
+ return client.parseWithSchema(
74
+ raw,
75
+ skillSecurityBreakdownResponseSchema,
76
+ "skill security breakdown response"
77
+ );
78
+ }
79
+ async function getSkillsCatalog(client, params = {}) {
80
+ const query = new URLSearchParams();
81
+ if (params.q) {
82
+ query.set("q", params.q);
83
+ }
84
+ if (params.category) {
85
+ query.set("category", params.category);
86
+ }
87
+ params.tags?.forEach((tag) => {
88
+ if (tag.trim()) {
89
+ query.append("tag", tag.trim());
210
90
  }
211
- if (!contentType) {
212
- try {
213
- const textContent = contentBuffer.toString("utf8");
214
- const hasControlChars = /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(
215
- textContent
216
- );
217
- const hasReplacementChars = textContent.includes("�");
218
- if (!hasControlChars && !hasReplacementChars) {
219
- if (textContent.trim().startsWith("{") && textContent.trim().endsWith("}")) {
220
- contentType = "application/json";
221
- } else if (textContent.includes("<?xml") || textContent.includes("<html")) {
222
- contentType = "text/xml";
223
- } else if (textContent.includes("<!DOCTYPE html")) {
224
- contentType = "text/html";
225
- } else {
226
- contentType = "text/plain";
227
- }
228
- } else {
229
- contentType = "application/octet-stream";
230
- }
231
- } catch {
232
- contentType = "application/octet-stream";
233
- }
91
+ });
92
+ if (typeof params.featured === "boolean") {
93
+ query.set("featured", params.featured ? "true" : "false");
94
+ }
95
+ if (typeof params.verified === "boolean") {
96
+ query.set("verified", params.verified ? "true" : "false");
97
+ }
98
+ if (params.channel) {
99
+ query.set("channel", params.channel);
100
+ }
101
+ if (params.sortBy) {
102
+ query.set("sortBy", params.sortBy);
103
+ }
104
+ if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
105
+ query.set("limit", String(Math.trunc(params.limit)));
106
+ }
107
+ if (params.cursor) {
108
+ query.set("cursor", params.cursor);
109
+ }
110
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
111
+ const raw = await client.requestJson(`/skills/catalog${suffix}`, {
112
+ method: "GET"
113
+ });
114
+ return client.parseWithSchema(
115
+ raw,
116
+ skillCatalogResponseSchema,
117
+ "skill catalog response"
118
+ );
119
+ }
120
+ async function listSkillVersions(client, params) {
121
+ const normalizedName = requireTrimmedString(params.name, "name");
122
+ const query = new URLSearchParams();
123
+ query.set("name", normalizedName);
124
+ const raw = await client.requestJson(
125
+ `/skills/versions?${query.toString()}`,
126
+ { method: "GET" }
127
+ );
128
+ return client.parseWithSchema(
129
+ raw,
130
+ skillRegistryVersionsResponseSchema,
131
+ "skill registry versions response"
132
+ );
133
+ }
134
+ async function listMySkills(client, params = {}) {
135
+ const query = new URLSearchParams();
136
+ if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
137
+ query.set("limit", String(Math.trunc(params.limit)));
138
+ }
139
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
140
+ const raw = await client.requestJson(`/skills/mine${suffix}`, {
141
+ method: "GET"
142
+ });
143
+ return client.parseWithSchema(
144
+ raw,
145
+ skillRegistryMineResponseSchema,
146
+ "skill registry mine response"
147
+ );
148
+ }
149
+ async function getMySkillsList(client, params = {}) {
150
+ const query = new URLSearchParams();
151
+ if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
152
+ query.set("limit", String(Math.trunc(params.limit)));
153
+ }
154
+ if (params.cursor) {
155
+ query.set("cursor", params.cursor);
156
+ }
157
+ if (params.accountId) {
158
+ query.set("accountId", params.accountId);
159
+ }
160
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
161
+ const raw = await client.requestJson(`/skills/my-list${suffix}`, {
162
+ method: "GET"
163
+ });
164
+ return client.parseWithSchema(
165
+ raw,
166
+ skillRegistryMyListResponseSchema,
167
+ "skill registry my list response"
168
+ );
169
+ }
170
+ async function quoteSkillPublish(client, payload) {
171
+ const raw = await client.requestJson("/skills/quote", {
172
+ method: "POST",
173
+ body: payload,
174
+ headers: { "content-type": "application/json" }
175
+ });
176
+ return client.parseWithSchema(
177
+ raw,
178
+ skillRegistryQuoteResponseSchema,
179
+ "skill registry quote response"
180
+ );
181
+ }
182
+ async function quoteSkillPublishPreview(client, payload) {
183
+ const raw = await client.requestJson("/skills/quote-preview", {
184
+ method: "POST",
185
+ body: payload,
186
+ headers: { "content-type": "application/json" }
187
+ });
188
+ return client.parseWithSchema(
189
+ raw,
190
+ skillQuotePreviewResponseSchema,
191
+ "skill quote preview response"
192
+ );
193
+ }
194
+ async function publishSkill(client, payload) {
195
+ const raw = await client.requestJson("/skills/publish", {
196
+ method: "POST",
197
+ body: payload,
198
+ headers: { "content-type": "application/json" }
199
+ });
200
+ return client.parseWithSchema(
201
+ raw,
202
+ skillRegistryPublishResponseSchema,
203
+ "skill registry publish response"
204
+ );
205
+ }
206
+ async function getSkillPublishJob(client, jobId, params = {}) {
207
+ const normalized = requireTrimmedString(jobId, "jobId");
208
+ const query = new URLSearchParams();
209
+ if (params.accountId) {
210
+ query.set("accountId", params.accountId);
211
+ }
212
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
213
+ const raw = await client.requestJson(
214
+ `/skills/jobs/${encodeURIComponent(normalized)}${suffix}`,
215
+ { method: "GET" }
216
+ );
217
+ return client.parseWithSchema(
218
+ raw,
219
+ skillRegistryJobStatusResponseSchema,
220
+ "skill registry job status response"
221
+ );
222
+ }
223
+ async function getSkillOwnership(client, params) {
224
+ const normalizedName = requireTrimmedString(params.name, "name");
225
+ const query = new URLSearchParams();
226
+ query.set("name", normalizedName);
227
+ if (params.accountId) {
228
+ query.set("accountId", params.accountId);
229
+ }
230
+ const raw = await client.requestJson(
231
+ `/skills/ownership?${query.toString()}`,
232
+ {
233
+ method: "GET"
234
234
  }
235
- let encoded;
236
- if (contentType?.startsWith("text/") || contentType === "application/json") {
237
- try {
238
- encoded = contentBuffer.toString("utf8");
239
- if (encoded.includes("�") || /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(encoded)) {
240
- encoded = contentBuffer.toString("base64");
241
- }
242
- } catch {
243
- encoded = contentBuffer.toString("base64");
235
+ );
236
+ return client.parseWithSchema(
237
+ raw,
238
+ skillRegistryOwnershipResponseSchema,
239
+ "skill registry ownership response"
240
+ );
241
+ }
242
+ async function getRecommendedSkillVersion(client, params) {
243
+ const normalizedName = requireTrimmedString(params.name, "name");
244
+ const query = new URLSearchParams();
245
+ query.set("name", normalizedName);
246
+ const raw = await client.requestJson(
247
+ `/skills/recommended?${query.toString()}`,
248
+ { method: "GET" }
249
+ );
250
+ return client.parseWithSchema(
251
+ raw,
252
+ skillRecommendedVersionResponseSchema,
253
+ "skill recommended version response"
254
+ );
255
+ }
256
+ async function setRecommendedSkillVersion(client, payload) {
257
+ const normalizedName = requireTrimmedString(payload.name, "name");
258
+ const normalizedVersion = requireTrimmedString(payload.version, "version");
259
+ const raw = await client.requestJson("/skills/recommended", {
260
+ method: "POST",
261
+ body: {
262
+ name: normalizedName,
263
+ version: normalizedVersion
264
+ },
265
+ headers: { "content-type": "application/json" }
266
+ });
267
+ return client.parseWithSchema(
268
+ raw,
269
+ skillRecommendedVersionResponseSchema,
270
+ "skill recommended version response"
271
+ );
272
+ }
273
+ async function getSkillDeprecations(client, params) {
274
+ const normalizedName = requireTrimmedString(params.name, "name");
275
+ const query = new URLSearchParams();
276
+ query.set("name", normalizedName);
277
+ const raw = await client.requestJson(
278
+ `/skills/deprecations?${query.toString()}`,
279
+ { method: "GET" }
280
+ );
281
+ return client.parseWithSchema(
282
+ raw,
283
+ skillDeprecationsResponseSchema,
284
+ "skill deprecations response"
285
+ );
286
+ }
287
+ async function setSkillDeprecation(client, payload) {
288
+ const normalizedName = requireTrimmedString(payload.name, "name");
289
+ const version = payload.version?.trim();
290
+ const reason = requireTrimmedString(payload.reason, "reason");
291
+ const replacementRef = payload.replacementRef?.trim();
292
+ const raw = await client.requestJson("/skills/deprecate", {
293
+ method: "POST",
294
+ body: {
295
+ name: normalizedName,
296
+ version,
297
+ reason,
298
+ replacementRef
299
+ },
300
+ headers: { "content-type": "application/json" }
301
+ });
302
+ return client.parseWithSchema(
303
+ raw,
304
+ skillDeprecationRecordSchema,
305
+ "skill deprecation response"
306
+ );
307
+ }
308
+ async function getSkillBadge(client, params) {
309
+ const normalizedName = requireTrimmedString(params.name, "name");
310
+ const query = new URLSearchParams();
311
+ query.set("name", normalizedName);
312
+ if (params.metric) {
313
+ query.set("metric", params.metric);
314
+ }
315
+ if (params.label?.trim()) {
316
+ query.set("label", params.label.trim());
317
+ }
318
+ if (params.style) {
319
+ query.set("style", params.style);
320
+ }
321
+ const raw = await client.requestJson(
322
+ `/skills/badge?${query.toString()}`,
323
+ { method: "GET" }
324
+ );
325
+ return client.parseWithSchema(
326
+ raw,
327
+ skillBadgeResponseSchema,
328
+ "skill badge response"
329
+ );
330
+ }
331
+ async function getSkillStatus(client, params) {
332
+ const normalizedName = requireTrimmedString(params.name, "name");
333
+ const query = new URLSearchParams();
334
+ query.set("name", normalizedName);
335
+ if (params.version?.trim()) {
336
+ query.set("version", params.version.trim());
337
+ }
338
+ const raw = await client.requestJson(
339
+ `/skills/status?${query.toString()}`,
340
+ { method: "GET" }
341
+ );
342
+ return client.parseWithSchema(
343
+ raw,
344
+ skillStatusResponseSchema,
345
+ "skill status response"
346
+ );
347
+ }
348
+ async function getSkillStatusByRepo(client, params) {
349
+ const repo = requireTrimmedString(params.repo, "repo");
350
+ const skillDir = requireTrimmedString(params.skillDir, "skillDir");
351
+ const query = new URLSearchParams();
352
+ query.set("repo", repo);
353
+ query.set("skillDir", skillDir);
354
+ if (params.ref?.trim()) {
355
+ query.set("ref", params.ref.trim());
356
+ }
357
+ const raw = await client.requestJson(
358
+ `/skills/status/by-repo?${query.toString()}`,
359
+ { method: "GET" }
360
+ );
361
+ return client.parseWithSchema(
362
+ raw,
363
+ skillStatusResponseSchema,
364
+ "skill status response"
365
+ );
366
+ }
367
+ async function getSkillConversionSignalsByRepo(client, params) {
368
+ const repo = requireTrimmedString(params.repo, "repo");
369
+ const skillDir = requireTrimmedString(params.skillDir, "skillDir");
370
+ const query = new URLSearchParams();
371
+ query.set("repo", repo);
372
+ query.set("skillDir", skillDir);
373
+ if (params.ref?.trim()) {
374
+ query.set("ref", params.ref.trim());
375
+ }
376
+ const raw = await client.requestJson(
377
+ `/skills/conversion-signals/by-repo?${query.toString()}`,
378
+ { method: "GET" }
379
+ );
380
+ return client.parseWithSchema(
381
+ raw,
382
+ skillConversionSignalsResponseSchema,
383
+ "skill conversion signals response"
384
+ );
385
+ }
386
+ async function uploadSkillPreviewFromGithubOidc(client, payload) {
387
+ const token = requireTrimmedString(payload.token, "token");
388
+ const raw = await client.requestJson(
389
+ "/skills/preview/github-oidc",
390
+ {
391
+ method: "POST",
392
+ body: payload.report,
393
+ headers: {
394
+ "content-type": "application/json",
395
+ authorization: `Bearer ${token}`
244
396
  }
245
- } else {
246
- encoded = contentBuffer.toString("base64");
247
- }
248
- return {
249
- encoded,
250
- contentType,
251
- size
252
- };
253
- }
254
- static parseFileCreate(body) {
255
- if (!body) return void 0;
256
- const data = {};
257
- if (body.expirationTime?.seconds) {
258
- data.expirationTime = `${Long.fromValue(
259
- body.expirationTime.seconds
260
- ).toString()}.${body.expirationTime.nanos}`;
261
- }
262
- if (body.keys) {
263
- data.keys = parseKey({ keyList: body.keys });
264
- }
265
- if (body.contents) {
266
- data.contents = Buffer.from(body.contents).toString("base64");
267
397
  }
268
- if (body.memo) {
269
- data.memo = body.memo;
270
- }
271
- return data;
398
+ );
399
+ return client.parseWithSchema(
400
+ raw,
401
+ skillPreviewRecordSchema,
402
+ "skill preview record response"
403
+ );
404
+ }
405
+ async function getSkillPreview(client, params) {
406
+ const normalizedName = requireTrimmedString(params.name, "name");
407
+ const query = new URLSearchParams();
408
+ query.set("name", normalizedName);
409
+ if (params.version?.trim()) {
410
+ query.set("version", params.version.trim());
272
411
  }
273
- static parseFileAppend(body) {
274
- if (!body) return void 0;
275
- const data = {};
276
- if (body.fileID) {
277
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
278
- }
279
- if (body.contents) {
280
- data.contents = Buffer.from(body.contents).toString("base64");
281
- }
282
- return data;
412
+ const raw = await client.requestJson(
413
+ `/skills/preview?${query.toString()}`,
414
+ { method: "GET" }
415
+ );
416
+ return client.parseWithSchema(
417
+ raw,
418
+ skillPreviewLookupResponseSchema,
419
+ "skill preview response"
420
+ );
421
+ }
422
+ async function getSkillPreviewByRepo(client, params) {
423
+ const repo = requireTrimmedString(params.repo, "repo");
424
+ const skillDir = requireTrimmedString(params.skillDir, "skillDir");
425
+ const query = new URLSearchParams();
426
+ query.set("repo", repo);
427
+ query.set("skillDir", skillDir);
428
+ if (params.ref?.trim()) {
429
+ query.set("ref", params.ref.trim());
283
430
  }
284
- static parseFileUpdate(body) {
285
- if (!body) return void 0;
286
- const data = {};
287
- if (body.fileID) {
288
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
289
- }
290
- if (body.expirationTime?.seconds) {
291
- data.expirationTime = `${Long.fromValue(
292
- body.expirationTime.seconds
293
- ).toString()}.${body.expirationTime.nanos}`;
431
+ const raw = await client.requestJson(
432
+ `/skills/preview/by-repo?${query.toString()}`,
433
+ { method: "GET" }
434
+ );
435
+ return client.parseWithSchema(
436
+ raw,
437
+ skillPreviewLookupResponseSchema,
438
+ "skill preview by repo response"
439
+ );
440
+ }
441
+ async function getSkillPreviewById(client, previewId) {
442
+ const normalizedPreviewId = requireTrimmedString(previewId, "previewId");
443
+ const raw = await client.requestJson(
444
+ `/skills/preview/${encodeURIComponent(normalizedPreviewId)}`,
445
+ { method: "GET" }
446
+ );
447
+ return client.parseWithSchema(
448
+ raw,
449
+ skillPreviewLookupResponseSchema,
450
+ "skill preview by id response"
451
+ );
452
+ }
453
+ async function getSkillInstall(client, skillRef) {
454
+ const normalizedSkillRef = requireTrimmedString(skillRef, "skillRef");
455
+ const raw = await client.requestJson(
456
+ `/skills/${encodeURIComponent(normalizedSkillRef)}/install`,
457
+ { method: "GET" }
458
+ );
459
+ return client.parseWithSchema(
460
+ raw,
461
+ skillInstallResponseSchema,
462
+ "skill install response"
463
+ );
464
+ }
465
+ async function recordSkillInstallCopy(client, skillRef, payload = {}) {
466
+ const normalizedSkillRef = requireTrimmedString(skillRef, "skillRef");
467
+ const raw = await client.requestJson(
468
+ `/skills/${encodeURIComponent(normalizedSkillRef)}/telemetry/install-copy`,
469
+ {
470
+ method: "POST",
471
+ body: payload,
472
+ headers: { "content-type": "application/json" }
294
473
  }
295
- if (body.keys) {
296
- data.keys = parseKey({ keyList: body.keys });
474
+ );
475
+ return client.parseWithSchema(
476
+ raw,
477
+ skillInstallCopyTelemetryResponseSchema,
478
+ "skill install copy telemetry response"
479
+ );
480
+ }
481
+ async function listSkillTags(client) {
482
+ const raw = await client.requestJson("/skills/tags", {
483
+ method: "GET"
484
+ });
485
+ return client.parseWithSchema(
486
+ raw,
487
+ skillRegistryTagsResponseSchema,
488
+ "skill tags response"
489
+ );
490
+ }
491
+ async function listSkillCategories(client) {
492
+ const raw = await client.requestJson("/skills/categories", {
493
+ method: "GET"
494
+ });
495
+ return client.parseWithSchema(
496
+ raw,
497
+ skillRegistryCategoriesResponseSchema,
498
+ "skill categories response"
499
+ );
500
+ }
501
+ async function resolveSkillMarkdown(client, skillRef) {
502
+ const normalizedSkillRef = requireTrimmedString(skillRef, "skillRef");
503
+ const response = await client.request(
504
+ `/skills/${encodeURIComponent(normalizedSkillRef)}/SKILL.md`,
505
+ {
506
+ method: "GET",
507
+ headers: {
508
+ accept: "text/markdown, text/plain;q=0.9, */*;q=0.8"
509
+ }
297
510
  }
298
- if (body.contents) {
299
- data.contents = Buffer.from(body.contents).toString("base64");
511
+ );
512
+ return response.text();
513
+ }
514
+ async function resolveSkillManifest(client, skillRef) {
515
+ const normalizedSkillRef = requireTrimmedString(skillRef, "skillRef");
516
+ const raw = await client.requestJson(
517
+ `/skills/${encodeURIComponent(normalizedSkillRef)}/manifest`,
518
+ {
519
+ method: "GET"
300
520
  }
301
- if (body.memo?.value !== void 0) {
302
- data.memo = body.memo.value;
521
+ );
522
+ return client.parseWithSchema(
523
+ raw,
524
+ skillResolverManifestResponseSchema,
525
+ "skill resolver manifest response"
526
+ );
527
+ }
528
+ async function getSkillVoteStatus(client, params) {
529
+ const normalizedName = requireTrimmedString(params.name, "name");
530
+ const query = new URLSearchParams();
531
+ query.set("name", normalizedName);
532
+ const raw = await client.requestJson(
533
+ `/skills/vote?${query.toString()}`,
534
+ { method: "GET" }
535
+ );
536
+ return client.parseWithSchema(
537
+ raw,
538
+ skillRegistryVoteStatusResponseSchema,
539
+ "skill registry vote status response"
540
+ );
541
+ }
542
+ async function setSkillVote(client, payload) {
543
+ const normalizedName = requireTrimmedString(payload.name, "name");
544
+ const raw = await client.requestJson("/skills/vote", {
545
+ method: "POST",
546
+ body: { name: normalizedName, upvoted: payload.upvoted },
547
+ headers: { "content-type": "application/json" }
548
+ });
549
+ return client.parseWithSchema(
550
+ raw,
551
+ skillRegistryVoteStatusResponseSchema,
552
+ "skill registry vote status response"
553
+ );
554
+ }
555
+ async function requestSkillVerification(client, payload) {
556
+ const normalizedName = requireTrimmedString(payload.name, "name");
557
+ const raw = await client.requestJson(
558
+ "/skills/verification/request",
559
+ {
560
+ method: "POST",
561
+ body: {
562
+ name: normalizedName,
563
+ version: payload.version,
564
+ tier: payload.tier
565
+ },
566
+ headers: { "content-type": "application/json" }
303
567
  }
304
- return data;
568
+ );
569
+ return client.parseWithSchema(
570
+ raw,
571
+ skillVerificationRequestCreateResponseSchema,
572
+ "skill verification request create response"
573
+ );
574
+ }
575
+ async function getSkillVerificationStatus(client, params) {
576
+ const normalizedName = requireTrimmedString(params.name, "name");
577
+ const query = new URLSearchParams();
578
+ query.set("name", normalizedName);
579
+ if (params.version) {
580
+ query.set("version", params.version);
305
581
  }
306
- static parseFileDelete(body) {
307
- if (!body) return void 0;
308
- const data = {};
309
- if (body.fileID) {
310
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
582
+ const raw = await client.requestJson(
583
+ `/skills/verification/status?${query.toString()}`,
584
+ { method: "GET" }
585
+ );
586
+ return client.parseWithSchema(
587
+ raw,
588
+ skillVerificationStatusResponseSchema,
589
+ "skill verification status response"
590
+ );
591
+ }
592
+ async function createSkillDomainProofChallenge(client, payload) {
593
+ const normalizedName = requireTrimmedString(payload.name, "name");
594
+ const raw = await client.requestJson(
595
+ "/skills/verification/domain/challenge",
596
+ {
597
+ method: "POST",
598
+ body: {
599
+ name: normalizedName,
600
+ version: payload.version,
601
+ domain: payload.domain
602
+ },
603
+ headers: { "content-type": "application/json" }
311
604
  }
312
- return data;
313
- }
314
- /**
315
- * Parse File Service transaction from Transaction object
316
- * This is the unified entry point that delegates to the comprehensive parsing logic
317
- */
318
- static parseFromTransactionObject(transaction) {
319
- return this.parseFileTransaction(transaction);
320
- }
605
+ );
606
+ return client.parseWithSchema(
607
+ raw,
608
+ skillVerificationDomainProofChallengeResponseSchema,
609
+ "skill domain proof challenge response"
610
+ );
611
+ }
612
+ async function verifySkillDomainProof(client, payload) {
613
+ const normalizedName = requireTrimmedString(payload.name, "name");
614
+ const challengeToken = requireTrimmedString(
615
+ payload.challengeToken,
616
+ "challengeToken"
617
+ );
618
+ const raw = await client.requestJson(
619
+ "/skills/verification/domain/verify",
620
+ {
621
+ method: "POST",
622
+ body: {
623
+ name: normalizedName,
624
+ version: payload.version,
625
+ domain: payload.domain,
626
+ challengeToken
627
+ },
628
+ headers: { "content-type": "application/json" }
629
+ }
630
+ );
631
+ return client.parseWithSchema(
632
+ raw,
633
+ skillVerificationDomainProofVerifyResponseSchema,
634
+ "skill domain proof verify response"
635
+ );
321
636
  }
322
637
  export {
323
- FileParser
638
+ createSkillDomainProofChallenge,
639
+ getMySkillsList,
640
+ getRecommendedSkillVersion,
641
+ getSkillBadge,
642
+ getSkillConversionSignalsByRepo,
643
+ getSkillDeprecations,
644
+ getSkillInstall,
645
+ getSkillOwnership,
646
+ getSkillPreview,
647
+ getSkillPreviewById,
648
+ getSkillPreviewByRepo,
649
+ getSkillPublishJob,
650
+ getSkillSecurityBreakdown,
651
+ getSkillStatus,
652
+ getSkillStatusByRepo,
653
+ getSkillVerificationStatus,
654
+ getSkillVoteStatus,
655
+ getSkillsCatalog,
656
+ listMySkills,
657
+ listSkillCategories,
658
+ listSkillTags,
659
+ listSkillVersions,
660
+ listSkills,
661
+ publishSkill,
662
+ quoteSkillPublish,
663
+ quoteSkillPublishPreview,
664
+ recordSkillInstallCopy,
665
+ requestSkillVerification,
666
+ resolveSkillManifest,
667
+ resolveSkillMarkdown,
668
+ setRecommendedSkillVersion,
669
+ setSkillDeprecation,
670
+ setSkillVote,
671
+ skillsConfig,
672
+ uploadSkillPreviewFromGithubOidc,
673
+ verifySkillDomainProof
324
674
  };
325
675
  //# sourceMappingURL=standards-sdk.es169.js.map