@hashgraphonline/standards-sdk 0.1.143-feat-adapter-registry.canary.2e9e1c4.55 → 0.1.143-feat-adapter-registry.canary.83edd30.56

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 (40) hide show
  1. package/dist/es/standards-sdk.es111.js +5 -5
  2. package/dist/es/standards-sdk.es121.js +1 -1
  3. package/dist/es/standards-sdk.es122.js +1 -1
  4. package/dist/es/standards-sdk.es123.js +5 -5
  5. package/dist/es/standards-sdk.es125.js +1 -1
  6. package/dist/es/standards-sdk.es126.js +1 -1
  7. package/dist/es/standards-sdk.es128.js +1 -1
  8. package/dist/es/standards-sdk.es131.js +1 -1
  9. package/dist/es/standards-sdk.es138.js +1 -1
  10. package/dist/es/standards-sdk.es148.js +51 -167
  11. package/dist/es/standards-sdk.es148.js.map +1 -1
  12. package/dist/es/standards-sdk.es149.js +69 -309
  13. package/dist/es/standards-sdk.es149.js.map +1 -1
  14. package/dist/es/standards-sdk.es150.js +12233 -292
  15. package/dist/es/standards-sdk.es150.js.map +1 -1
  16. package/dist/es/standards-sdk.es151.js +129 -410
  17. package/dist/es/standards-sdk.es151.js.map +1 -1
  18. package/dist/es/standards-sdk.es152.js +200 -209
  19. package/dist/es/standards-sdk.es152.js.map +1 -1
  20. package/dist/es/standards-sdk.es153.js +334 -64
  21. package/dist/es/standards-sdk.es153.js.map +1 -1
  22. package/dist/es/standards-sdk.es154.js +395 -12229
  23. package/dist/es/standards-sdk.es154.js.map +1 -1
  24. package/dist/es/standards-sdk.es155.js +330 -55
  25. package/dist/es/standards-sdk.es155.js.map +1 -1
  26. package/dist/es/standards-sdk.es156.js +60 -66
  27. package/dist/es/standards-sdk.es156.js.map +1 -1
  28. package/dist/es/standards-sdk.es19.js +1 -1
  29. package/dist/es/standards-sdk.es20.js +1 -1
  30. package/dist/es/standards-sdk.es28.js +1 -1
  31. package/dist/es/standards-sdk.es31.js +1 -1
  32. package/dist/es/standards-sdk.es32.js +1 -1
  33. package/dist/es/standards-sdk.es36.js +1 -1
  34. package/dist/es/standards-sdk.es37.js +1 -1
  35. package/dist/es/standards-sdk.es38.js +1 -1
  36. package/dist/es/standards-sdk.es57.js +1 -1
  37. package/dist/es/standards-sdk.es59.js +1 -1
  38. package/dist/es/standards-sdk.es60.js +1 -1
  39. package/dist/es/standards-sdk.es63.js +1 -1
  40. package/package.json +2 -2
@@ -1,325 +1,85 @@
1
- import { proto } from "@hashgraph/proto";
2
- import { Long } from "@hashgraph/sdk";
3
- import { hasTransactionType, parseKey } from "./standards-sdk.es153.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 { isBrowser } from "./standards-sdk.es119.js";
2
+ let nodeRequire;
3
+ function isModuleNotFound(specifier, error) {
4
+ if (!error || typeof error !== "object") {
5
+ return false;
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
- }
7
+ const code = Reflect.get(error, "code");
8
+ const message = Reflect.get(error, "message");
9
+ const messageText = typeof message === "string" ? message : "";
10
+ if (typeof code === "string" && code.includes("MODULE_NOT_FOUND")) {
11
+ return messageText.includes(specifier);
12
+ }
13
+ if (messageText) {
14
+ const lowered = messageText.toLowerCase();
15
+ if (lowered.includes("cannot find module") || lowered.includes("module not found") || lowered.includes("cannot find package")) {
16
+ return lowered.includes(specifier.toLowerCase());
88
17
  }
89
- return {};
90
18
  }
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) {
19
+ return false;
20
+ }
21
+ async function resolveNodeRequire() {
22
+ if (nodeRequire !== void 0) {
23
+ return nodeRequire;
24
+ }
25
+ if (isBrowser) {
26
+ nodeRequire = null;
27
+ return nodeRequire;
28
+ }
29
+ try {
30
+ const globalObject = typeof global !== "undefined" ? global : globalThis;
31
+ const req = globalObject.process?.mainModule?.require ?? globalObject.require;
32
+ nodeRequire = typeof req === "function" && typeof req.resolve === "function" ? req : null;
33
+ } catch {
34
+ nodeRequire = null;
35
+ }
36
+ return nodeRequire;
37
+ }
38
+ async function dynamicImport(specifier) {
39
+ try {
40
+ return await import(specifier);
41
+ } catch (error) {
42
+ if (isModuleNotFound(specifier, error)) {
43
+ return null;
44
+ }
45
+ throw error;
46
+ }
47
+ }
48
+ async function optionalImport(specifier) {
49
+ if (isBrowser) {
50
+ return dynamicImport(specifier);
51
+ }
52
+ const requireFn = await resolveNodeRequire();
53
+ if (requireFn) {
96
54
  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 {};
55
+ return requireFn(specifier);
185
56
  } catch (error) {
186
- return {};
187
- }
188
- }
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()];
210
- }
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";
57
+ if (!isModuleNotFound(specifier, error)) {
58
+ throw error;
233
59
  }
234
60
  }
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
61
  }
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;
272
- }
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;
62
+ return dynamicImport(specifier);
63
+ }
64
+ function optionalImportSync(specifier) {
65
+ if (isBrowser) {
66
+ return null;
283
67
  }
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}`;
68
+ try {
69
+ const globalObject = typeof global !== "undefined" ? global : globalThis;
70
+ const req = globalObject.process?.mainModule?.require ?? globalObject.require;
71
+ if (typeof req === "function" && typeof req.resolve === "function") {
72
+ return req(specifier);
294
73
  }
295
- if (body.keys) {
296
- data.keys = parseKey({ keyList: body.keys });
74
+ } catch (error) {
75
+ if (!isModuleNotFound(specifier, error)) {
76
+ throw error;
297
77
  }
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;
305
- }
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}`;
311
- }
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
78
  }
79
+ return null;
321
80
  }
322
81
  export {
323
- FileParser
82
+ optionalImport,
83
+ optionalImportSync
324
84
  };
325
85
  //# sourceMappingURL=standards-sdk.es149.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es149.js","sources":["../../src/utils/parsers/file-parser.ts"],"sourcesContent":["import { proto } from '@hashgraph/proto';\nimport { Long, Transaction } from '@hashgraph/sdk';\nimport {\n FileCreateData,\n FileAppendData,\n FileUpdateData,\n FileDeleteData,\n} from '../transaction-parser-types';\nimport {\n parseKey,\n extractTransactionBody,\n hasTransactionType,\n} from './parser-utils';\nimport { Buffer } from 'buffer';\nimport { FileId } from '@hashgraph/sdk';\n\n/**\n * File Service Parser\n *\n * Handles parsing for all file-related transaction types including:\n * - File creation, updates, append, and deletion\n * - Proper dual-branch parsing (regular vs signed transactions)\n * - Comprehensive protobuf extraction\n * - Enhanced content handling with type detection\n */\nexport class FileParser {\n /**\n * Parse File Service transaction using unified dual-branch approach\n * This handles both regular transactions and signed transaction variants\n */\n static parseFileTransaction(\n transaction: Transaction,\n originalBytes?: Uint8Array,\n ): {\n type?: string;\n humanReadableType?: string;\n fileCreate?: FileCreateData;\n fileAppend?: FileAppendData;\n fileUpdate?: FileUpdateData;\n fileDelete?: FileDeleteData;\n [key: string]: unknown;\n } {\n try {\n if (originalBytes || transaction.toBytes) {\n try {\n const bytesToParse = originalBytes || transaction.toBytes();\n const decoded = proto.TransactionList.decode(bytesToParse);\n\n if (decoded.transactionList && decoded.transactionList.length > 0) {\n const tx = decoded.transactionList[0];\n let txBody: proto.ITransactionBody | null = null;\n\n if (tx.bodyBytes && tx.bodyBytes.length > 0) {\n txBody = proto.TransactionBody.decode(tx.bodyBytes);\n } else if (\n tx.signedTransactionBytes &&\n tx.signedTransactionBytes.length > 0\n ) {\n const signedTx = proto.SignedTransaction.decode(\n tx.signedTransactionBytes,\n );\n if (signedTx.bodyBytes) {\n txBody = proto.TransactionBody.decode(signedTx.bodyBytes);\n }\n }\n\n if (txBody) {\n const protoResult = this.parseFromProtobufTxBody(txBody);\n if (protoResult.type && protoResult.type !== 'UNKNOWN') {\n return protoResult;\n }\n }\n }\n } catch (protoError) {}\n }\n\n return this.parseFromTransactionInternals(transaction);\n } catch (error) {\n return { type: 'UNKNOWN', humanReadableType: 'Unknown File Transaction' };\n }\n }\n\n /**\n * Parse file transaction from protobuf TransactionBody\n * Handles all file operations from decoded protobuf data\n */\n private static parseFromProtobufTxBody(txBody: proto.ITransactionBody): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n if (txBody.fileCreate) {\n const fileCreate = this.parseFileCreate(txBody.fileCreate);\n if (fileCreate) {\n return {\n type: 'FILECREATE',\n humanReadableType: 'File Create',\n fileCreate,\n };\n }\n }\n\n if (txBody.fileAppend) {\n const fileAppend = this.parseFileAppend(txBody.fileAppend);\n if (fileAppend) {\n return {\n type: 'FILEAPPEND',\n humanReadableType: 'File Append',\n fileAppend,\n };\n }\n }\n\n if (txBody.fileUpdate) {\n const fileUpdate = this.parseFileUpdate(txBody.fileUpdate);\n if (fileUpdate) {\n return {\n type: 'FILEUPDATE',\n humanReadableType: 'File Update',\n fileUpdate,\n };\n }\n }\n\n if (txBody.fileDelete) {\n const fileDelete = this.parseFileDelete(txBody.fileDelete);\n if (fileDelete) {\n return {\n type: 'FILEDELETE',\n humanReadableType: 'File Delete',\n fileDelete,\n };\n }\n }\n\n return {};\n }\n\n /**\n * Extract file data from Transaction internal fields\n * This handles cases where data is stored in Transaction object internals\n */\n private static parseFromTransactionInternals(transaction: Transaction): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n try {\n const tx = transaction as unknown as {\n _fileId?: { toString(): string };\n _contents?: Uint8Array;\n _keys?: unknown[];\n _expirationTime?: { toString(): string };\n _memo?: string;\n constructor?: { name?: string };\n };\n\n if (hasTransactionType(transaction, 'fileCreate')) {\n const fileCreate: FileCreateData = {};\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileCreate.contents = contentInfo.encoded;\n if (contentInfo.contentType) {\n fileCreate.contentType = contentInfo.contentType;\n }\n if (contentInfo.size) {\n fileCreate.contentSize = contentInfo.size;\n }\n }\n\n if (tx._keys && tx._keys.length > 0) {\n const keyList: proto.IKeyList = {\n keys: tx._keys as unknown as proto.IKey[],\n };\n fileCreate.keys = parseKey({ keyList });\n }\n\n if (tx._expirationTime) {\n fileCreate.expirationTime = tx._expirationTime.toString();\n }\n\n if (tx._memo) {\n fileCreate.memo = tx._memo;\n }\n\n return {\n type: 'FILECREATE',\n humanReadableType: 'File Create',\n fileCreate,\n };\n }\n\n if (hasTransactionType(transaction, 'fileAppend')) {\n const fileAppend: FileAppendData = {\n fileId: tx._fileId.toString(),\n };\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileAppend.contents = contentInfo.encoded;\n if (contentInfo.size) {\n fileAppend.contentSize = contentInfo.size;\n }\n }\n\n return {\n type: 'FILEAPPEND',\n humanReadableType: 'File Append',\n fileAppend,\n };\n }\n\n if (hasTransactionType(transaction, 'fileUpdate')) {\n const fileUpdate: FileUpdateData = {\n fileId: tx._fileId.toString(),\n };\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileUpdate.contents = contentInfo.encoded;\n if (contentInfo.size) {\n fileUpdate.contentSize = contentInfo.size;\n }\n }\n\n if (tx._keys && tx._keys.length > 0) {\n const keyList: proto.IKeyList = {\n keys: tx._keys as unknown as proto.IKey[],\n };\n fileUpdate.keys = parseKey({ keyList });\n }\n\n if (tx._expirationTime) {\n fileUpdate.expirationTime = tx._expirationTime.toString();\n }\n\n if (tx._memo) {\n fileUpdate.memo = tx._memo;\n }\n\n return {\n type: 'FILEUPDATE',\n humanReadableType: 'File Update',\n fileUpdate,\n };\n }\n\n if (hasTransactionType(transaction, 'fileDelete')) {\n const fileDelete: FileDeleteData = {\n fileId: tx._fileId.toString(),\n };\n\n return {\n type: 'FILEDELETE',\n humanReadableType: 'File Delete',\n fileDelete,\n };\n }\n\n return {};\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Enhanced content analysis with type detection and metadata\n */\n private static analyzeContent(contents: Uint8Array): {\n encoded: string;\n contentType?: string;\n size: number;\n } {\n const size = contents.length;\n const contentBuffer = Buffer.from(contents);\n\n let contentType: string | undefined;\n\n if (size >= 4) {\n const header = contentBuffer.subarray(0, 4);\n const headerHex = header.toString('hex');\n\n const signatures: Record<string, string> = {\n '89504e47': 'image/png',\n ffd8ffe0: 'image/jpeg',\n ffd8ffe1: 'image/jpeg',\n '47494638': 'image/gif',\n '25504446': 'application/pdf',\n '504b0304': 'application/zip',\n '7f454c46': 'application/x-executable',\n d0cf11e0: 'application/msoffice',\n };\n\n contentType = signatures[headerHex.toLowerCase()];\n }\n\n if (!contentType) {\n try {\n const textContent = contentBuffer.toString('utf8');\n const hasControlChars = /[\\x00-\\x08\\x0B\\x0E-\\x1F\\x7F]/.test(\n textContent,\n );\n const hasReplacementChars = textContent.includes('\\uFFFD');\n\n if (!hasControlChars && !hasReplacementChars) {\n if (\n textContent.trim().startsWith('{') &&\n textContent.trim().endsWith('}')\n ) {\n contentType = 'application/json';\n } else if (\n textContent.includes('<?xml') ||\n textContent.includes('<html')\n ) {\n contentType = 'text/xml';\n } else if (textContent.includes('<!DOCTYPE html')) {\n contentType = 'text/html';\n } else {\n contentType = 'text/plain';\n }\n } else {\n contentType = 'application/octet-stream';\n }\n } catch {\n contentType = 'application/octet-stream';\n }\n }\n\n let encoded: string;\n if (\n contentType?.startsWith('text/') ||\n contentType === 'application/json'\n ) {\n try {\n encoded = contentBuffer.toString('utf8');\n if (\n encoded.includes('\\uFFFD') ||\n /[\\x00-\\x08\\x0B\\x0E-\\x1F\\x7F]/.test(encoded)\n ) {\n encoded = contentBuffer.toString('base64');\n }\n } catch {\n encoded = contentBuffer.toString('base64');\n }\n } else {\n encoded = contentBuffer.toString('base64');\n }\n\n return {\n encoded,\n contentType,\n size,\n };\n }\n static parseFileCreate(\n body: proto.IFileCreateTransactionBody,\n ): FileCreateData | undefined {\n if (!body) return undefined;\n const data: FileCreateData = {};\n if (body.expirationTime?.seconds) {\n data.expirationTime = `${Long.fromValue(\n body.expirationTime.seconds,\n ).toString()}.${body.expirationTime.nanos}`;\n }\n if (body.keys) {\n data.keys = parseKey({ keyList: body.keys });\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n if (body.memo) {\n data.memo = body.memo;\n }\n return data;\n }\n\n static parseFileAppend(\n body: proto.IFileAppendTransactionBody,\n ): FileAppendData | undefined {\n if (!body) return undefined;\n const data: FileAppendData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n return data;\n }\n\n static parseFileUpdate(\n body: proto.IFileUpdateTransactionBody,\n ): FileUpdateData | undefined {\n if (!body) return undefined;\n const data: FileUpdateData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n if (body.expirationTime?.seconds) {\n data.expirationTime = `${Long.fromValue(\n body.expirationTime.seconds,\n ).toString()}.${body.expirationTime.nanos}`;\n }\n if (body.keys) {\n data.keys = parseKey({ keyList: body.keys });\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n if (body.memo?.value !== undefined) {\n data.memo = body.memo.value;\n }\n return data;\n }\n\n static parseFileDelete(\n body: proto.IFileDeleteTransactionBody,\n ): FileDeleteData | undefined {\n if (!body) return undefined;\n const data: FileDeleteData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n return data;\n }\n\n /**\n * Parse File Service transaction from Transaction object\n * This is the unified entry point that delegates to the comprehensive parsing logic\n */\n static parseFromTransactionObject(transaction: Transaction): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n return this.parseFileTransaction(transaction);\n }\n}\n"],"names":[],"mappings":";;;;AAyBO,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,OAAO,qBACL,aACA,eASA;AACA,QAAI;AACF,UAAI,iBAAiB,YAAY,SAAS;AACxC,YAAI;AACF,gBAAM,eA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O,YAAY,CAC1B,IAAI,KAAK,OAAO,WAAW,CAAC;AAAA,IAC9B;AACA,QAAI,KAAK,gBAAgB,SAAS;AAChC,WAAK,iBAAiB,GAAG,KAAK;AAAA,QAC5B,KAAK,eAAe;AAAA,MAAA,EACpB,SAAA,CAAU,IAAI,KAAK,eAAe,KAAK;AAAA,IAC3C;AACA,QAAI,KAAK,MAAM;AACb,WAAK,OAAO,SAAS,EAAE,SAAS,KAAK,MAAM;AAAA,IAC7C;AACA,QAAI,KAAK,UAAU;AACjB,WAAK,WAAW,OAAO,KAAK,KAAK,QAAQ,EAAE,SAAS,QAAQ;AAAA,IAC9D;AACA,QAAI,KAAK,MAAM,UAAU,QAAW;AAClC,WAAK,OAAO,KAAK,KAAK;AAAA,IACxB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,gBACL,MAC4B;AAC5B,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,OAAuB,CAAA;AAC7B,QAAI,KAAK,QAAQ;AACf,WAAK,SAAS,GAAG,KAAK,OAAO,YAAY,CAAC,IACxC,KAAK,OAAO,YAAY,CAC1B,IAAI,KAAK,OAAO,WAAW,CAAC;AAAA,IAC9B;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,2BAA2B,aAIhC;AACA,WAAO,KAAK,qBAAqB,WAAW;AAAA,EAC9C;AACF;"}
1
+ {"version":3,"file":"standards-sdk.es149.js","sources":["../../src/utils/dynamic-import.ts"],"sourcesContent":["import { isBrowser } from './is-browser';\n\nlet nodeRequire: NodeRequire | null | undefined;\n\nfunction isModuleNotFound(specifier: string, error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false;\n }\n const code = Reflect.get(error, 'code');\n const message = Reflect.get(error, 'message');\n const messageText = typeof message === 'string' ? message : '';\n\n if (typeof code === 'string' && code.includes('MODULE_NOT_FOUND')) {\n return messageText.includes(specifier);\n }\n\n if (messageText) {\n const lowered = messageText.toLowerCase();\n if (\n lowered.includes('cannot find module') ||\n lowered.includes('module not found') ||\n lowered.includes('cannot find package')\n ) {\n return lowered.includes(specifier.toLowerCase());\n }\n }\n\n return false;\n}\n\nasync function resolveNodeRequire(): Promise<NodeRequire | null> {\n if (nodeRequire !== undefined) {\n return nodeRequire;\n }\n\n if (isBrowser) {\n nodeRequire = null;\n return nodeRequire;\n }\n\n try {\n const globalObject =\n typeof global !== 'undefined'\n ? (global as typeof globalThis)\n : globalThis;\n const req =\n globalObject.process?.mainModule?.require ??\n (globalObject as { require?: NodeRequire }).require;\n\n nodeRequire =\n typeof req === 'function' &&\n typeof (req as NodeRequire).resolve === 'function'\n ? (req as NodeRequire)\n : null;\n } catch {\n nodeRequire = null;\n }\n\n return nodeRequire;\n}\n\nasync function dynamicImport<T>(specifier: string): Promise<T | null> {\n try {\n return (await import(specifier)) as T;\n } catch (error) {\n if (isModuleNotFound(specifier, error)) {\n return null;\n }\n throw error as Error;\n }\n}\n\nexport async function optionalImport<T>(specifier: string): Promise<T | null> {\n if (isBrowser) {\n return dynamicImport<T>(specifier);\n }\n\n const requireFn = await resolveNodeRequire();\n if (requireFn) {\n try {\n return requireFn(specifier) as T;\n } catch (error) {\n if (!isModuleNotFound(specifier, error)) {\n throw error as Error;\n }\n }\n }\n\n return dynamicImport<T>(specifier);\n}\n\nexport function optionalImportSync<T>(specifier: string): T | null {\n if (isBrowser) {\n return null;\n }\n\n try {\n const globalObject =\n typeof global !== 'undefined'\n ? (global as typeof globalThis)\n : globalThis;\n const req =\n globalObject.process?.mainModule?.require ??\n (globalObject as { require?: NodeRequire }).require;\n\n if (\n typeof req === 'function' &&\n typeof (req as NodeRequire).resolve === 'function'\n ) {\n return req(specifier) as T;\n }\n } catch (error) {\n if (!isModuleNotFound(specifier, error)) {\n throw error as Error;\n }\n }\n\n return null;\n}\n"],"names":[],"mappings":";AAEA,IAAI;AAEJ,SAAS,iBAAiB,WAAmB,OAAyB;AACpE,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACv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