@hashgraphonline/standards-sdk 0.1.177 → 0.1.178
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/browser/hcs-11/client.d.ts +30 -30
- package/dist/browser/hcs-21/types.d.ts +23 -23
- package/dist/browser/inscribe/inscriber.d.ts.map +1 -1
- package/dist/browser/services/registry-broker/client/base-client.d.ts +13 -1
- package/dist/browser/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/browser/services/registry-broker/client/credits.d.ts +6 -1
- package/dist/browser/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/browser/services/registry-broker/client/guard.d.ts +10 -0
- package/dist/browser/services/registry-broker/client/guard.d.ts.map +1 -0
- package/dist/browser/services/registry-broker/client/skills.d.ts.map +1 -1
- package/dist/browser/services/registry-broker/schemas.d.ts +723 -45
- package/dist/browser/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/browser/services/registry-broker/types.d.ts +31 -1
- package/dist/browser/services/registry-broker/types.d.ts.map +1 -1
- package/dist/browser/standards-sdk.browser.js +163 -6
- package/dist/browser/standards-sdk.browser.js.map +1 -1
- package/dist/browser/utils/dynamic-import.d.ts.map +1 -1
- package/dist/browser-root/hcs-11/client.d.ts +30 -30
- package/dist/browser-root/hcs-21/types.d.ts +23 -23
- package/dist/browser-root/inscribe/inscriber.d.ts.map +1 -1
- package/dist/browser-root/services/registry-broker/client/base-client.d.ts +13 -1
- package/dist/browser-root/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/browser-root/services/registry-broker/client/credits.d.ts +6 -1
- package/dist/browser-root/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/browser-root/services/registry-broker/client/guard.d.ts +10 -0
- package/dist/browser-root/services/registry-broker/client/guard.d.ts.map +1 -0
- package/dist/browser-root/services/registry-broker/client/skills.d.ts.map +1 -1
- package/dist/browser-root/services/registry-broker/schemas.d.ts +723 -45
- package/dist/browser-root/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/browser-root/services/registry-broker/types.d.ts +31 -1
- package/dist/browser-root/services/registry-broker/types.d.ts.map +1 -1
- package/dist/browser-root/standards-sdk.root-browser.js +373 -131
- package/dist/browser-root/standards-sdk.root-browser.js.map +1 -1
- package/dist/browser-root/utils/dynamic-import.d.ts.map +1 -1
- package/dist/cjs/hcs-11/client.d.ts +30 -30
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts +13 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/credits.d.ts +6 -1
- package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/guard.d.ts +10 -0
- package/dist/cjs/services/registry-broker/client/guard.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/skills.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +686 -8
- package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/types.d.ts +31 -1
- package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
- package/dist/es/hcs-11/client.d.ts +30 -30
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts +13 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/credits.d.ts +6 -1
- package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/guard.d.ts +10 -0
- package/dist/es/services/registry-broker/client/guard.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/skills.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +686 -8
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/services/registry-broker/types.d.ts +31 -1
- package/dist/es/services/registry-broker/types.d.ts.map +1 -1
- 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 +8 -5
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +37 -6
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +1 -1
- package/dist/es/standards-sdk.es148.js +1 -1
- package/dist/es/standards-sdk.es161.js +165 -2
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +54 -15
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +97 -158
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +71 -312
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +187 -333
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +13 -449
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +65 -323
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +162 -66
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +304 -740
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +345 -55
- package/dist/es/standards-sdk.es170.js.map +1 -1
- package/dist/es/standards-sdk.es171.js +435 -86
- package/dist/es/standards-sdk.es171.js.map +1 -1
- package/dist/es/standards-sdk.es172.js +321 -71
- package/dist/es/standards-sdk.es172.js.map +1 -1
- package/dist/es/standards-sdk.es173.js +58 -182
- package/dist/es/standards-sdk.es173.js.map +1 -1
- package/dist/es/standards-sdk.es174.js +667 -68
- package/dist/es/standards-sdk.es174.js.map +1 -1
- package/dist/es/standards-sdk.es176.js +1 -1
- package/dist/es/standards-sdk.es178.js +1 -1
- package/dist/es/standards-sdk.es179.js +1 -1
- package/dist/es/standards-sdk.es181.js +61 -3
- package/dist/es/standards-sdk.es181.js.map +1 -1
- package/dist/es/standards-sdk.es182.js +80 -168
- package/dist/es/standards-sdk.es182.js.map +1 -1
- package/dist/es/standards-sdk.es183.js +156 -206
- package/dist/es/standards-sdk.es183.js.map +1 -1
- package/dist/es/standards-sdk.es184.js +219 -223
- package/dist/es/standards-sdk.es184.js.map +1 -1
- package/dist/es/standards-sdk.es185.js +242 -0
- package/dist/es/standards-sdk.es185.js.map +1 -0
- 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/dist/es/utils/dynamic-import.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,761 +1,325 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
query.set("featured", params.featured ? "true" : "false");
|
|
43
|
-
}
|
|
44
|
-
if (typeof params.verified === "boolean") {
|
|
45
|
-
query.set("verified", params.verified ? "true" : "false");
|
|
46
|
-
}
|
|
47
|
-
if (params.view) {
|
|
48
|
-
query.set("view", params.view);
|
|
49
|
-
}
|
|
50
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
51
|
-
const raw = await client.requestJson(`/skills${suffix}`, {
|
|
52
|
-
method: "GET"
|
|
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 { 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" };
|
|
86
42
|
}
|
|
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);
|
|
99
|
-
}
|
|
100
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
101
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
102
|
-
}
|
|
103
|
-
if (params.cursor) {
|
|
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
|
-
);
|
|
115
|
-
}
|
|
116
|
-
async function listSkillVersions(client, params) {
|
|
117
|
-
const normalizedName = params.name.trim();
|
|
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
|
-
);
|
|
132
|
-
}
|
|
133
|
-
async function listMySkills(client, params = {}) {
|
|
134
|
-
const query = new URLSearchParams();
|
|
135
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
136
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
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
43
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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 quoteSkillPublishPreview(client, payload) {
|
|
182
|
-
const raw = await client.requestJson("/skills/quote-preview", {
|
|
183
|
-
method: "POST",
|
|
184
|
-
body: payload,
|
|
185
|
-
headers: { "content-type": "application/json" }
|
|
186
|
-
});
|
|
187
|
-
return client.parseWithSchema(
|
|
188
|
-
raw,
|
|
189
|
-
skillQuotePreviewResponseSchema,
|
|
190
|
-
"skill quote preview response"
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
async function publishSkill(client, payload) {
|
|
194
|
-
const raw = await client.requestJson("/skills/publish", {
|
|
195
|
-
method: "POST",
|
|
196
|
-
body: payload,
|
|
197
|
-
headers: { "content-type": "application/json" }
|
|
198
|
-
});
|
|
199
|
-
return client.parseWithSchema(
|
|
200
|
-
raw,
|
|
201
|
-
skillRegistryPublishResponseSchema,
|
|
202
|
-
"skill registry publish response"
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
async function getSkillPublishJob(client, jobId, params = {}) {
|
|
206
|
-
const normalized = jobId.trim();
|
|
207
|
-
if (!normalized) {
|
|
208
|
-
throw new Error("jobId is required");
|
|
209
|
-
}
|
|
210
|
-
const query = new URLSearchParams();
|
|
211
|
-
if (params.accountId) {
|
|
212
|
-
query.set("accountId", params.accountId);
|
|
213
|
-
}
|
|
214
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
215
|
-
const raw = await client.requestJson(
|
|
216
|
-
`/skills/jobs/${encodeURIComponent(normalized)}${suffix}`,
|
|
217
|
-
{ method: "GET" }
|
|
218
|
-
);
|
|
219
|
-
return client.parseWithSchema(
|
|
220
|
-
raw,
|
|
221
|
-
skillRegistryJobStatusResponseSchema,
|
|
222
|
-
"skill registry job status response"
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
async function getSkillOwnership(client, params) {
|
|
226
|
-
const normalizedName = params.name.trim();
|
|
227
|
-
if (!normalizedName) {
|
|
228
|
-
throw new Error("name is required");
|
|
229
|
-
}
|
|
230
|
-
const query = new URLSearchParams();
|
|
231
|
-
query.set("name", normalizedName);
|
|
232
|
-
if (params.accountId) {
|
|
233
|
-
query.set("accountId", params.accountId);
|
|
234
|
-
}
|
|
235
|
-
const raw = await client.requestJson(
|
|
236
|
-
`/skills/ownership?${query.toString()}`,
|
|
237
|
-
{
|
|
238
|
-
method: "GET"
|
|
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
|
+
}
|
|
239
58
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const normalizedName = params.name.trim();
|
|
249
|
-
if (!normalizedName) {
|
|
250
|
-
throw new Error("name is required");
|
|
251
|
-
}
|
|
252
|
-
const query = new URLSearchParams();
|
|
253
|
-
query.set("name", normalizedName);
|
|
254
|
-
const raw = await client.requestJson(
|
|
255
|
-
`/skills/recommended?${query.toString()}`,
|
|
256
|
-
{ method: "GET" }
|
|
257
|
-
);
|
|
258
|
-
return client.parseWithSchema(
|
|
259
|
-
raw,
|
|
260
|
-
skillRecommendedVersionResponseSchema,
|
|
261
|
-
"skill recommended version response"
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
async function setRecommendedSkillVersion(client, payload) {
|
|
265
|
-
const normalizedName = payload.name.trim();
|
|
266
|
-
const normalizedVersion = payload.version.trim();
|
|
267
|
-
if (!normalizedName) {
|
|
268
|
-
throw new Error("name is required");
|
|
269
|
-
}
|
|
270
|
-
if (!normalizedVersion) {
|
|
271
|
-
throw new Error("version is required");
|
|
272
|
-
}
|
|
273
|
-
const raw = await client.requestJson("/skills/recommended", {
|
|
274
|
-
method: "POST",
|
|
275
|
-
body: {
|
|
276
|
-
name: normalizedName,
|
|
277
|
-
version: normalizedVersion
|
|
278
|
-
},
|
|
279
|
-
headers: { "content-type": "application/json" }
|
|
280
|
-
});
|
|
281
|
-
return client.parseWithSchema(
|
|
282
|
-
raw,
|
|
283
|
-
skillRecommendedVersionResponseSchema,
|
|
284
|
-
"skill recommended version response"
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
async function getSkillDeprecations(client, params) {
|
|
288
|
-
const normalizedName = params.name.trim();
|
|
289
|
-
if (!normalizedName) {
|
|
290
|
-
throw new Error("name is required");
|
|
291
|
-
}
|
|
292
|
-
const query = new URLSearchParams();
|
|
293
|
-
query.set("name", normalizedName);
|
|
294
|
-
const raw = await client.requestJson(
|
|
295
|
-
`/skills/deprecations?${query.toString()}`,
|
|
296
|
-
{ method: "GET" }
|
|
297
|
-
);
|
|
298
|
-
return client.parseWithSchema(
|
|
299
|
-
raw,
|
|
300
|
-
skillDeprecationsResponseSchema,
|
|
301
|
-
"skill deprecations response"
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
async function setSkillDeprecation(client, payload) {
|
|
305
|
-
const normalizedName = payload.name.trim();
|
|
306
|
-
if (!normalizedName) {
|
|
307
|
-
throw new Error("name is required");
|
|
308
|
-
}
|
|
309
|
-
const version = payload.version?.trim();
|
|
310
|
-
const reason = payload.reason.trim();
|
|
311
|
-
if (!reason) {
|
|
312
|
-
throw new Error("reason is required");
|
|
313
|
-
}
|
|
314
|
-
const replacementRef = payload.replacementRef?.trim();
|
|
315
|
-
const raw = await client.requestJson("/skills/deprecate", {
|
|
316
|
-
method: "POST",
|
|
317
|
-
body: {
|
|
318
|
-
name: normalizedName,
|
|
319
|
-
version,
|
|
320
|
-
reason,
|
|
321
|
-
replacementRef
|
|
322
|
-
},
|
|
323
|
-
headers: { "content-type": "application/json" }
|
|
324
|
-
});
|
|
325
|
-
return client.parseWithSchema(
|
|
326
|
-
raw,
|
|
327
|
-
skillDeprecationRecordSchema,
|
|
328
|
-
"skill deprecation response"
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
async function getSkillBadge(client, params) {
|
|
332
|
-
const normalizedName = params.name.trim();
|
|
333
|
-
if (!normalizedName) {
|
|
334
|
-
throw new Error("name is required");
|
|
335
|
-
}
|
|
336
|
-
const query = new URLSearchParams();
|
|
337
|
-
query.set("name", normalizedName);
|
|
338
|
-
if (params.metric) {
|
|
339
|
-
query.set("metric", params.metric);
|
|
340
|
-
}
|
|
341
|
-
if (params.label?.trim()) {
|
|
342
|
-
query.set("label", params.label.trim());
|
|
343
|
-
}
|
|
344
|
-
if (params.style) {
|
|
345
|
-
query.set("style", params.style);
|
|
346
|
-
}
|
|
347
|
-
const raw = await client.requestJson(
|
|
348
|
-
`/skills/badge?${query.toString()}`,
|
|
349
|
-
{ method: "GET" }
|
|
350
|
-
);
|
|
351
|
-
return client.parseWithSchema(
|
|
352
|
-
raw,
|
|
353
|
-
skillBadgeResponseSchema,
|
|
354
|
-
"skill badge response"
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
async function getSkillStatus(client, params) {
|
|
358
|
-
const normalizedName = params.name.trim();
|
|
359
|
-
if (!normalizedName) {
|
|
360
|
-
throw new Error("name is required");
|
|
361
|
-
}
|
|
362
|
-
const query = new URLSearchParams();
|
|
363
|
-
query.set("name", normalizedName);
|
|
364
|
-
if (params.version?.trim()) {
|
|
365
|
-
query.set("version", params.version.trim());
|
|
366
|
-
}
|
|
367
|
-
const raw = await client.requestJson(
|
|
368
|
-
`/skills/status?${query.toString()}`,
|
|
369
|
-
{ method: "GET" }
|
|
370
|
-
);
|
|
371
|
-
return client.parseWithSchema(
|
|
372
|
-
raw,
|
|
373
|
-
skillStatusResponseSchema,
|
|
374
|
-
"skill status response"
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
async function getSkillStatusByRepo(client, params) {
|
|
378
|
-
const repo = params.repo.trim();
|
|
379
|
-
const skillDir = params.skillDir.trim();
|
|
380
|
-
if (!repo) {
|
|
381
|
-
throw new Error("repo is required");
|
|
382
|
-
}
|
|
383
|
-
if (!skillDir) {
|
|
384
|
-
throw new Error("skillDir is required");
|
|
385
|
-
}
|
|
386
|
-
const query = new URLSearchParams();
|
|
387
|
-
query.set("repo", repo);
|
|
388
|
-
query.set("skillDir", skillDir);
|
|
389
|
-
if (params.ref?.trim()) {
|
|
390
|
-
query.set("ref", params.ref.trim());
|
|
391
|
-
}
|
|
392
|
-
const raw = await client.requestJson(
|
|
393
|
-
`/skills/status/by-repo?${query.toString()}`,
|
|
394
|
-
{ method: "GET" }
|
|
395
|
-
);
|
|
396
|
-
return client.parseWithSchema(
|
|
397
|
-
raw,
|
|
398
|
-
skillStatusResponseSchema,
|
|
399
|
-
"skill status response"
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
async function getSkillConversionSignalsByRepo(client, params) {
|
|
403
|
-
const repo = params.repo.trim();
|
|
404
|
-
const skillDir = params.skillDir.trim();
|
|
405
|
-
if (!repo) {
|
|
406
|
-
throw new Error("repo is required");
|
|
407
|
-
}
|
|
408
|
-
if (!skillDir) {
|
|
409
|
-
throw new Error("skillDir is required");
|
|
410
|
-
}
|
|
411
|
-
const query = new URLSearchParams();
|
|
412
|
-
query.set("repo", repo);
|
|
413
|
-
query.set("skillDir", skillDir);
|
|
414
|
-
if (params.ref?.trim()) {
|
|
415
|
-
query.set("ref", params.ref.trim());
|
|
416
|
-
}
|
|
417
|
-
const raw = await client.requestJson(
|
|
418
|
-
`/skills/conversion-signals/by-repo?${query.toString()}`,
|
|
419
|
-
{ method: "GET" }
|
|
420
|
-
);
|
|
421
|
-
return client.parseWithSchema(
|
|
422
|
-
raw,
|
|
423
|
-
skillConversionSignalsResponseSchema,
|
|
424
|
-
"skill conversion signals response"
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
async function uploadSkillPreviewFromGithubOidc(client, payload) {
|
|
428
|
-
const token = payload.token.trim();
|
|
429
|
-
if (!token) {
|
|
430
|
-
throw new Error("token is required");
|
|
431
|
-
}
|
|
432
|
-
const raw = await client.requestJson(
|
|
433
|
-
"/skills/preview/github-oidc",
|
|
434
|
-
{
|
|
435
|
-
method: "POST",
|
|
436
|
-
body: payload.report,
|
|
437
|
-
headers: {
|
|
438
|
-
"content-type": "application/json",
|
|
439
|
-
authorization: `Bearer ${token}`
|
|
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
|
+
};
|
|
440
67
|
}
|
|
441
68
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (!normalizedName) {
|
|
452
|
-
throw new Error("name is required");
|
|
453
|
-
}
|
|
454
|
-
const query = new URLSearchParams();
|
|
455
|
-
query.set("name", normalizedName);
|
|
456
|
-
if (params.version?.trim()) {
|
|
457
|
-
query.set("version", params.version.trim());
|
|
458
|
-
}
|
|
459
|
-
const raw = await client.requestJson(
|
|
460
|
-
`/skills/preview?${query.toString()}`,
|
|
461
|
-
{ method: "GET" }
|
|
462
|
-
);
|
|
463
|
-
return client.parseWithSchema(
|
|
464
|
-
raw,
|
|
465
|
-
skillPreviewLookupResponseSchema,
|
|
466
|
-
"skill preview response"
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
async function getSkillPreviewByRepo(client, params) {
|
|
470
|
-
const repo = params.repo.trim();
|
|
471
|
-
const skillDir = params.skillDir.trim();
|
|
472
|
-
if (!repo) {
|
|
473
|
-
throw new Error("repo is required");
|
|
474
|
-
}
|
|
475
|
-
if (!skillDir) {
|
|
476
|
-
throw new Error("skillDir is required");
|
|
477
|
-
}
|
|
478
|
-
const query = new URLSearchParams();
|
|
479
|
-
query.set("repo", repo);
|
|
480
|
-
query.set("skillDir", skillDir);
|
|
481
|
-
if (params.ref?.trim()) {
|
|
482
|
-
query.set("ref", params.ref.trim());
|
|
483
|
-
}
|
|
484
|
-
const raw = await client.requestJson(
|
|
485
|
-
`/skills/preview/by-repo?${query.toString()}`,
|
|
486
|
-
{ method: "GET" }
|
|
487
|
-
);
|
|
488
|
-
return client.parseWithSchema(
|
|
489
|
-
raw,
|
|
490
|
-
skillPreviewLookupResponseSchema,
|
|
491
|
-
"skill preview by repo response"
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
async function getSkillPreviewById(client, previewId) {
|
|
495
|
-
const normalizedPreviewId = previewId.trim();
|
|
496
|
-
if (!normalizedPreviewId) {
|
|
497
|
-
throw new Error("previewId is required");
|
|
498
|
-
}
|
|
499
|
-
const raw = await client.requestJson(
|
|
500
|
-
`/skills/preview/${encodeURIComponent(normalizedPreviewId)}`,
|
|
501
|
-
{ method: "GET" }
|
|
502
|
-
);
|
|
503
|
-
return client.parseWithSchema(
|
|
504
|
-
raw,
|
|
505
|
-
skillPreviewLookupResponseSchema,
|
|
506
|
-
"skill preview by id response"
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
async function getSkillInstall(client, skillRef) {
|
|
510
|
-
const normalizedSkillRef = skillRef.trim();
|
|
511
|
-
if (!normalizedSkillRef) {
|
|
512
|
-
throw new Error("skillRef is required");
|
|
513
|
-
}
|
|
514
|
-
const raw = await client.requestJson(
|
|
515
|
-
`/skills/${encodeURIComponent(normalizedSkillRef)}/install`,
|
|
516
|
-
{ method: "GET" }
|
|
517
|
-
);
|
|
518
|
-
return client.parseWithSchema(
|
|
519
|
-
raw,
|
|
520
|
-
skillInstallResponseSchema,
|
|
521
|
-
"skill install response"
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
async function recordSkillInstallCopy(client, skillRef, payload = {}) {
|
|
525
|
-
const normalizedSkillRef = skillRef.trim();
|
|
526
|
-
if (!normalizedSkillRef) {
|
|
527
|
-
throw new Error("skillRef is required");
|
|
528
|
-
}
|
|
529
|
-
const raw = await client.requestJson(
|
|
530
|
-
`/skills/${encodeURIComponent(normalizedSkillRef)}/telemetry/install-copy`,
|
|
531
|
-
{
|
|
532
|
-
method: "POST",
|
|
533
|
-
body: payload,
|
|
534
|
-
headers: { "content-type": "application/json" }
|
|
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
|
+
}
|
|
535
78
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const raw = await client.requestJson("/skills/tags", {
|
|
545
|
-
method: "GET"
|
|
546
|
-
});
|
|
547
|
-
return client.parseWithSchema(
|
|
548
|
-
raw,
|
|
549
|
-
skillRegistryTagsResponseSchema,
|
|
550
|
-
"skill tags response"
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
async function listSkillCategories(client) {
|
|
554
|
-
const raw = await client.requestJson("/skills/categories", {
|
|
555
|
-
method: "GET"
|
|
556
|
-
});
|
|
557
|
-
return client.parseWithSchema(
|
|
558
|
-
raw,
|
|
559
|
-
skillRegistryCategoriesResponseSchema,
|
|
560
|
-
"skill categories response"
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
async function resolveSkillMarkdown(client, skillRef) {
|
|
564
|
-
const normalizedSkillRef = skillRef.trim();
|
|
565
|
-
if (!normalizedSkillRef) {
|
|
566
|
-
throw new Error("skillRef is required");
|
|
567
|
-
}
|
|
568
|
-
const response = await client.request(
|
|
569
|
-
`/skills/${encodeURIComponent(normalizedSkillRef)}/SKILL.md`,
|
|
570
|
-
{
|
|
571
|
-
method: "GET",
|
|
572
|
-
headers: {
|
|
573
|
-
accept: "text/markdown, text/plain;q=0.9, */*;q=0.8"
|
|
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
|
+
};
|
|
574
87
|
}
|
|
575
88
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
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 {};
|
|
588
187
|
}
|
|
589
|
-
);
|
|
590
|
-
return client.parseWithSchema(
|
|
591
|
-
raw,
|
|
592
|
-
skillResolverManifestResponseSchema,
|
|
593
|
-
"skill resolver manifest response"
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
async function getSkillVoteStatus(client, params) {
|
|
597
|
-
const normalizedName = params.name.trim();
|
|
598
|
-
if (!normalizedName) {
|
|
599
|
-
throw new Error("name is required");
|
|
600
|
-
}
|
|
601
|
-
const query = new URLSearchParams();
|
|
602
|
-
query.set("name", normalizedName);
|
|
603
|
-
const raw = await client.requestJson(
|
|
604
|
-
`/skills/vote?${query.toString()}`,
|
|
605
|
-
{ method: "GET" }
|
|
606
|
-
);
|
|
607
|
-
return client.parseWithSchema(
|
|
608
|
-
raw,
|
|
609
|
-
skillRegistryVoteStatusResponseSchema,
|
|
610
|
-
"skill registry vote status response"
|
|
611
|
-
);
|
|
612
|
-
}
|
|
613
|
-
async function setSkillVote(client, payload) {
|
|
614
|
-
const normalizedName = payload.name.trim();
|
|
615
|
-
if (!normalizedName) {
|
|
616
|
-
throw new Error("name is required");
|
|
617
188
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
name: normalizedName,
|
|
640
|
-
version: payload.version,
|
|
641
|
-
tier: payload.tier
|
|
642
|
-
},
|
|
643
|
-
headers: { "content-type": "application/json" }
|
|
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()];
|
|
644
210
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
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
|
+
}
|
|
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");
|
|
244
|
+
}
|
|
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
|
+
}
|
|
268
|
+
if (body.memo) {
|
|
269
|
+
data.memo = body.memo;
|
|
270
|
+
}
|
|
271
|
+
return data;
|
|
656
272
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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;
|
|
661
283
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
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}`;
|
|
294
|
+
}
|
|
295
|
+
if (body.keys) {
|
|
296
|
+
data.keys = parseKey({ keyList: body.keys });
|
|
297
|
+
}
|
|
298
|
+
if (body.contents) {
|
|
299
|
+
data.contents = Buffer.from(body.contents).toString("base64");
|
|
300
|
+
}
|
|
301
|
+
if (body.memo?.value !== void 0) {
|
|
302
|
+
data.memo = body.memo.value;
|
|
303
|
+
}
|
|
304
|
+
return data;
|
|
676
305
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
body
|
|
682
|
-
name: normalizedName,
|
|
683
|
-
version: payload.version,
|
|
684
|
-
domain: payload.domain
|
|
685
|
-
},
|
|
686
|
-
headers: { "content-type": "application/json" }
|
|
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}`;
|
|
687
311
|
}
|
|
688
|
-
|
|
689
|
-
return client.parseWithSchema(
|
|
690
|
-
raw,
|
|
691
|
-
skillVerificationDomainProofChallengeResponseSchema,
|
|
692
|
-
"skill domain proof challenge response"
|
|
693
|
-
);
|
|
694
|
-
}
|
|
695
|
-
async function verifySkillDomainProof(client, payload) {
|
|
696
|
-
const normalizedName = payload.name.trim();
|
|
697
|
-
const challengeToken = payload.challengeToken.trim();
|
|
698
|
-
if (!normalizedName) {
|
|
699
|
-
throw new Error("name is required");
|
|
312
|
+
return data;
|
|
700
313
|
}
|
|
701
|
-
|
|
702
|
-
|
|
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);
|
|
703
320
|
}
|
|
704
|
-
const raw = await client.requestJson(
|
|
705
|
-
"/skills/verification/domain/verify",
|
|
706
|
-
{
|
|
707
|
-
method: "POST",
|
|
708
|
-
body: {
|
|
709
|
-
name: normalizedName,
|
|
710
|
-
version: payload.version,
|
|
711
|
-
domain: payload.domain,
|
|
712
|
-
challengeToken
|
|
713
|
-
},
|
|
714
|
-
headers: { "content-type": "application/json" }
|
|
715
|
-
}
|
|
716
|
-
);
|
|
717
|
-
return client.parseWithSchema(
|
|
718
|
-
raw,
|
|
719
|
-
skillVerificationDomainProofVerifyResponseSchema,
|
|
720
|
-
"skill domain proof verify response"
|
|
721
|
-
);
|
|
722
321
|
}
|
|
723
322
|
export {
|
|
724
|
-
|
|
725
|
-
getMySkillsList,
|
|
726
|
-
getRecommendedSkillVersion,
|
|
727
|
-
getSkillBadge,
|
|
728
|
-
getSkillConversionSignalsByRepo,
|
|
729
|
-
getSkillDeprecations,
|
|
730
|
-
getSkillInstall,
|
|
731
|
-
getSkillOwnership,
|
|
732
|
-
getSkillPreview,
|
|
733
|
-
getSkillPreviewById,
|
|
734
|
-
getSkillPreviewByRepo,
|
|
735
|
-
getSkillPublishJob,
|
|
736
|
-
getSkillSecurityBreakdown,
|
|
737
|
-
getSkillStatus,
|
|
738
|
-
getSkillStatusByRepo,
|
|
739
|
-
getSkillVerificationStatus,
|
|
740
|
-
getSkillVoteStatus,
|
|
741
|
-
getSkillsCatalog,
|
|
742
|
-
listMySkills,
|
|
743
|
-
listSkillCategories,
|
|
744
|
-
listSkillTags,
|
|
745
|
-
listSkillVersions,
|
|
746
|
-
listSkills,
|
|
747
|
-
publishSkill,
|
|
748
|
-
quoteSkillPublish,
|
|
749
|
-
quoteSkillPublishPreview,
|
|
750
|
-
recordSkillInstallCopy,
|
|
751
|
-
requestSkillVerification,
|
|
752
|
-
resolveSkillManifest,
|
|
753
|
-
resolveSkillMarkdown,
|
|
754
|
-
setRecommendedSkillVersion,
|
|
755
|
-
setSkillDeprecation,
|
|
756
|
-
setSkillVote,
|
|
757
|
-
skillsConfig,
|
|
758
|
-
uploadSkillPreviewFromGithubOidc,
|
|
759
|
-
verifySkillDomainProof
|
|
323
|
+
FileParser
|
|
760
324
|
};
|
|
761
325
|
//# sourceMappingURL=standards-sdk.es169.js.map
|