@hashgraphonline/standards-sdk 0.0.91 → 0.0.93
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/es/hcs-10/browser.d.ts.map +1 -1
- package/dist/es/hcs-10/registrations.d.ts.map +1 -1
- package/dist/es/hcs-10/types.d.ts +20 -54
- package/dist/es/hcs-10/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es100.js +16 -13
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +4 -31
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +39 -15
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +40 -4
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +37 -4
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +77 -15
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +7135 -4
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +3 -39
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +2 -40
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +2 -37
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +31 -75
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +33 -3
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +9 -2
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +34 -2
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +416 -31
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +2 -33
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +120 -9
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +4 -34
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +3 -3
- package/dist/es/standards-sdk.es18.js +2 -2
- package/dist/es/standards-sdk.es19.js +3 -3
- package/dist/es/standards-sdk.es22.js +966 -1692
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +1767 -3
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +36 -4167
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +46 -1039
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +7190 -36
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +3 -48
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es28.js +2 -7190
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +4167 -2
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +2 -419
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +364 -2
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +5 -119
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +179 -2
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +74 -188
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +99 -423
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +47 -20
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +9 -138
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +92 -13
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es40.js +3 -28
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +2 -29
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +107 -15
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +71 -41
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +5 -17
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +4 -60
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +191 -1259
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +52 -142
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +69 -91
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +3 -3
- package/dist/es/standards-sdk.es5.js +3 -3
- package/dist/es/standards-sdk.es50.js +21 -30
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +147 -5
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +76 -144
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +190 -18
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +394 -749
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +21 -170
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +125 -129
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +17 -3
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +21 -13
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +27 -25
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +19 -24
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +42 -36
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +17 -100
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +61 -2
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +1288 -15
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +26 -403
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +6 -2282
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +143 -148
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +793 -3
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +125 -346
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +3 -3
- package/dist/es/standards-sdk.es70.js +173 -5
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +3 -179
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +153 -70
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +29 -111
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +56 -45
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +49 -9
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +9 -96
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +64 -3
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +6 -2
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +11 -109
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +3 -3
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +6 -73
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +45 -6
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +2 -5
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +122 -207
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +163 -49
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +101 -69
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +2 -7136
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +15 -31
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +403 -57
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +17 -46
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +4 -2
- package/dist/es/standards-sdk.es9.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +25 -8
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +24 -63
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +38 -6
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +13 -15
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +13 -7
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +30 -43
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +15 -2
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +4 -136
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +4 -172
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +2281 -12
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/browser.d.ts.map +1 -1
- package/dist/umd/hcs-10/registrations.d.ts.map +1 -1
- package/dist/umd/hcs-10/types.d.ts +20 -54
- package/dist/umd/hcs-10/types.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +1 -1
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es89.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es89.js","sources":["../../node_modules/ethers/lib.esm/abi/coders/anonymous.js"],"sourcesContent":["import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map"],"names":[],"mappings":";;;;AAMO,MAAM,uBAAuB,MAAM;AAAA,EAEtC,YAAY,OAAO;AACf,UAAM,MAAM,MAAM,MAAM,MAAM,KAAK,MAAM,OAAO;AAFpD;AAGI,SAAK,QAAQ;AAAA,EACrB;AAAA,EACI,eAAe;AACX,WAAO,KAAK,MAAM,aAAc;AAAA,EACxC;AAAA,EACI,OAAO,QAAQ,OAAO;AAClB,WAAO,KAAK,MAAM,OAAO,QAAQ,KAAK;AAAA,EAC9C;AAAA,EACI,OAAO,QAAQ;AACX,WAAO,KAAK,MAAM,OAAO,MAAM;AAAA,EACvC;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HCS11Client } from "./standards-sdk.es13.js";
|
|
2
|
-
import { sleep } from "./standards-sdk.
|
|
2
|
+
import { sleep } from "./standards-sdk.es28.js";
|
|
3
3
|
class Registration {
|
|
4
4
|
/**
|
|
5
5
|
* Checks the status of a registration request.
|
|
@@ -216,7 +216,9 @@ class Registration {
|
|
|
216
216
|
async findRegistrations(options = {}, baseUrl = "https://moonscape.tech") {
|
|
217
217
|
try {
|
|
218
218
|
const queryParams = new URLSearchParams();
|
|
219
|
-
options.tags?.forEach(
|
|
219
|
+
options.tags?.forEach(
|
|
220
|
+
(tag) => queryParams.append("tags", tag.toString())
|
|
221
|
+
);
|
|
220
222
|
if (options.accountId) {
|
|
221
223
|
queryParams.append("accountId", options.accountId);
|
|
222
224
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es9.js","sources":["../../src/hcs-10/registrations.ts"],"sourcesContent":["import { Logger } from '../utils/logger';\nimport { HCS11Client } from '../hcs-11/client';\nimport { sleep } from '../utils/sleep';\nimport {\n RegistrationSearchResult,\n RegistrationResult,\n RegistrationsApiResponse,\n RegistrationSearchOptions,\n} from './types';\n\nexport interface RegistrationStatusResponse {\n status: 'pending' | 'success' | 'failed';\n error?: string;\n}\n\nexport abstract class Registration {\n /**\n * Checks the status of a registration request.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration status response.\n */\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string,\n logger?: Logger\n ): Promise<RegistrationStatusResponse> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n const error = `Failed to confirm registration: ${response.statusText}`;\n if (logger) {\n logger.error(error);\n }\n throw new Error(error);\n }\n\n return (await response.json()) as RegistrationStatusResponse;\n } catch (error: any) {\n if (logger) {\n logger.error(`Error checking registration status: ${error.message}`);\n }\n throw error;\n }\n }\n\n /**\n * Waits for a registration to be confirmed.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param maxAttempts - The maximum number of attempts to check the registration status.\n * @param delayMs - The delay in milliseconds between attempts.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to true if the registration is confirmed, false otherwise.\n */\n async waitForRegistrationConfirmation(\n transactionId: string,\n network: string,\n baseUrl: string,\n maxAttempts: number = 60,\n delayMs: number = 2000,\n logger?: Logger\n ): Promise<boolean> {\n let attempts = 0;\n while (attempts < maxAttempts) {\n if (logger) {\n logger.info(\n `Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`\n );\n }\n\n const status = await this.checkRegistrationStatus(\n transactionId,\n network,\n baseUrl,\n logger\n );\n\n if (status.status === 'success') {\n if (logger) {\n logger.info('Registration confirmed successfully');\n }\n return true;\n }\n\n if (status.status === 'failed') {\n if (logger) {\n logger.error('Registration confirmation failed');\n }\n throw new Error('Registration confirmation failed');\n }\n\n if (logger) {\n logger.info(\n `Registration still pending. Waiting ${delayMs}ms before next attempt`\n );\n }\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n attempts++;\n }\n\n if (logger) {\n logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);\n }\n return false;\n }\n\n /**\n * Executes a registration request for an agent.\n *\n * @param accountId - The account ID of the agent to register.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration result.\n */\n async executeRegistration(\n accountId: string,\n network: string = 'mainnet',\n baseUrl: string = 'https://moonscape.tech',\n logger?: Logger\n ): Promise<RegistrationResult> {\n try {\n if (logger) {\n logger.info('Registering agent with guarded registry');\n }\n\n try {\n const hcs11Client = new HCS11Client({\n network: network as 'mainnet' | 'testnet',\n auth: { operatorId: '0.0.0' },\n });\n logger?.info(\n `Fetching profile by account ID ${accountId} on ${network}`\n );\n await sleep(5000);\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n network\n );\n logger?.info('Profile fetched', profileResult);\n\n if (profileResult?.error) {\n logger?.error('Error fetching profile', profileResult.error);\n return {\n error: profileResult.error,\n success: false,\n };\n }\n if (!profileResult?.success || !profileResult?.profile) {\n if (logger) {\n logger.error('Profile not found for agent registration');\n }\n return {\n error: 'Profile not found for the provided account ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.inboundTopicId) {\n if (logger) {\n logger.error('Missing inbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required inbound topic ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.outboundTopicId) {\n if (logger) {\n logger.error('Missing outbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required outbound topic ID',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`\n );\n }\n } catch (profileError: any) {\n if (logger) {\n logger.error(`Error validating profile: ${profileError.message}`);\n }\n return {\n error: `Error validating profile: ${profileError.message}`,\n success: false,\n };\n }\n\n const response = await fetch(`${baseUrl}/api/request-register`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n 'X-Network': network,\n },\n body: JSON.stringify({\n accountId,\n }),\n });\n\n const data = (await response.json()) as RegistrationsApiResponse;\n\n if (!response.ok) {\n if (data.details?.length > 0) {\n return {\n validationErrors: data.details,\n error: data.error || 'Validation failed',\n success: false,\n };\n }\n return {\n error: data.error || 'Failed to register agent',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Created new registration request. Transaction ID: ${data.transaction_id}`\n );\n }\n\n return {\n transactionId: data.transaction_id,\n transaction: data.transaction,\n success: true,\n };\n } catch (error: any) {\n return {\n error: `Error during registration request: ${error.message}`,\n success: false,\n };\n }\n }\n\n /**\n * Finds registrations based on the provided options.\n *\n * @param options - The options for searching registrations.\n * @param baseUrl - The base URL of the guarded registry.\n * @returns A promise that resolves to the registration search result.\n */\n async findRegistrations(\n options: RegistrationSearchOptions = {},\n baseUrl: string = 'https://moonscape.tech'\n ): Promise<RegistrationSearchResult> {\n try {\n const queryParams = new URLSearchParams();\n options.tags?.forEach((tag) => queryParams.append('tags', tag));\n if (options.accountId) {\n queryParams.append('accountId', options.accountId);\n }\n if (options.network) {\n queryParams.append('network', options.network);\n }\n\n const response = await fetch(\n `${baseUrl}/api/registrations?${queryParams}`,\n {\n headers: {\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n },\n }\n );\n\n if (!response.ok) {\n const error = await response.text();\n return {\n registrations: [],\n error: error || 'Failed to fetch registrations',\n success: false,\n };\n }\n\n const data = (await response.json()) as RegistrationsApiResponse;\n if (data.error) {\n return {\n registrations: [],\n error: data.error,\n success: false,\n };\n }\n\n return {\n registrations: data.registrations || [],\n success: true,\n };\n } catch (e) {\n const error = e as Error;\n return {\n registrations: [],\n error: `Error fetching registrations: ${error.message}`,\n success: false,\n };\n }\n }\n}\n"],"names":[],"mappings":";;AAeO,MAAe,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjC,MAAgB,wBACd,eACA,SACA,SACA,QACqC;AACjC,QAAA;AACF,YAAM,WAAW,MAAM,MAAM,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Content":["import { Logger } from '../utils/logger';\nimport { HCS11Client } from '../hcs-11/client';\nimport { sleep } from '../utils/sleep';\nimport {\n RegistrationSearchResult,\n RegistrationResult,\n RegistrationsApiResponse,\n RegistrationSearchOptions,\n} from './types';\n\nexport interface RegistrationStatusResponse {\n status: 'pending' | 'success' | 'failed';\n error?: string;\n}\n\nexport abstract class Registration {\n /**\n * Checks the status of a registration request.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration status response.\n */\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string,\n logger?: Logger\n ): Promise<RegistrationStatusResponse> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n const error = `Failed to confirm registration: ${response.statusText}`;\n if (logger) {\n logger.error(error);\n }\n throw new Error(error);\n }\n\n return (await response.json()) as RegistrationStatusResponse;\n } catch (error: any) {\n if (logger) {\n logger.error(`Error checking registration status: ${error.message}`);\n }\n throw error;\n }\n }\n\n /**\n * Waits for a registration to be confirmed.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param maxAttempts - The maximum number of attempts to check the registration status.\n * @param delayMs - The delay in milliseconds between attempts.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to true if the registration is confirmed, false otherwise.\n */\n async waitForRegistrationConfirmation(\n transactionId: string,\n network: string,\n baseUrl: string,\n maxAttempts: number = 60,\n delayMs: number = 2000,\n logger?: Logger\n ): Promise<boolean> {\n let attempts = 0;\n while (attempts < maxAttempts) {\n if (logger) {\n logger.info(\n `Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`\n );\n }\n\n const status = await this.checkRegistrationStatus(\n transactionId,\n network,\n baseUrl,\n logger\n );\n\n if (status.status === 'success') {\n if (logger) {\n logger.info('Registration confirmed successfully');\n }\n return true;\n }\n\n if (status.status === 'failed') {\n if (logger) {\n logger.error('Registration confirmation failed');\n }\n throw new Error('Registration confirmation failed');\n }\n\n if (logger) {\n logger.info(\n `Registration still pending. Waiting ${delayMs}ms before next attempt`\n );\n }\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n attempts++;\n }\n\n if (logger) {\n logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);\n }\n return false;\n }\n\n /**\n * Executes a registration request for an agent.\n *\n * @param accountId - The account ID of the agent to register.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration result.\n */\n async executeRegistration(\n accountId: string,\n network: string = 'mainnet',\n baseUrl: string = 'https://moonscape.tech',\n logger?: Logger\n ): Promise<RegistrationResult> {\n try {\n if (logger) {\n logger.info('Registering agent with guarded registry');\n }\n\n try {\n const hcs11Client = new HCS11Client({\n network: network as 'mainnet' | 'testnet',\n auth: { operatorId: '0.0.0' },\n });\n logger?.info(\n `Fetching profile by account ID ${accountId} on ${network}`\n );\n await sleep(5000);\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n network\n );\n logger?.info('Profile fetched', profileResult);\n\n if (profileResult?.error) {\n logger?.error('Error fetching profile', profileResult.error);\n return {\n error: profileResult.error,\n success: false,\n };\n }\n if (!profileResult?.success || !profileResult?.profile) {\n if (logger) {\n logger.error('Profile not found for agent registration');\n }\n return {\n error: 'Profile not found for the provided account ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.inboundTopicId) {\n if (logger) {\n logger.error('Missing inbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required inbound topic ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.outboundTopicId) {\n if (logger) {\n logger.error('Missing outbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required outbound topic ID',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`\n );\n }\n } catch (profileError: any) {\n if (logger) {\n logger.error(`Error validating profile: ${profileError.message}`);\n }\n return {\n error: `Error validating profile: ${profileError.message}`,\n success: false,\n };\n }\n\n const response = await fetch(`${baseUrl}/api/request-register`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n 'X-Network': network,\n },\n body: JSON.stringify({\n accountId,\n }),\n });\n\n const data = (await response.json()) as RegistrationsApiResponse;\n\n if (!response.ok) {\n if (data.details?.length > 0) {\n return {\n validationErrors: data.details,\n error: data.error || 'Validation failed',\n success: false,\n };\n }\n return {\n error: data.error || 'Failed to register agent',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Created new registration request. Transaction ID: ${data.transaction_id}`\n );\n }\n\n return {\n transactionId: data.transaction_id,\n transaction: data.transaction,\n success: true,\n };\n } catch (error: any) {\n return {\n error: `Error during registration request: ${error.message}`,\n success: false,\n };\n }\n }\n\n /**\n * Finds registrations based on the provided options.\n *\n * @param options - The options for searching registrations.\n * @param baseUrl - The base URL of the guarded registry.\n * @returns A promise that resolves to the registration search result.\n */\n async findRegistrations(\n options: RegistrationSearchOptions = {},\n baseUrl: string = 'https://moonscape.tech'\n ): Promise<RegistrationSearchResult> {\n try {\n const queryParams = new URLSearchParams();\n options.tags?.forEach((tag) =>\n queryParams.append('tags', tag.toString())\n );\n if (options.accountId) {\n queryParams.append('accountId', options.accountId);\n }\n if (options.network) {\n queryParams.append('network', options.network);\n }\n\n const response = await fetch(\n `${baseUrl}/api/registrations?${queryParams}`,\n {\n headers: {\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n },\n }\n );\n\n if (!response.ok) {\n const error = await response.text();\n return {\n registrations: [],\n error: error || 'Failed to fetch registrations',\n success: false,\n };\n }\n\n const data = (await response.json()) as RegistrationsApiResponse;\n if (data.error) {\n return {\n registrations: [],\n error: data.error,\n success: false,\n };\n }\n\n return {\n registrations: data.registrations || [],\n success: true,\n };\n } catch (e) {\n const error = e as Error;\n return {\n registrations: [],\n error: `Error fetching registrations: ${error.message}`,\n success: false,\n };\n }\n }\n}\n"],"names":[],"mappings":";;AAeO,MAAe,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjC,MAAgB,wBACd,eACA,SACA,SACA,QACqC;AACjC,QAAA;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,OAAO,wBAAwB;AAAA,QAC7D,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,aAAa;AAAA,QACf;AAAA,QACA,MAAM,KAAK,UAAU,EAAE,gBAAgB,cAAe,CAAA;AAAA,MAAA,CACvD;AAEG,UAAA,CAAC,SAAS,IAAI;AACV,cAAA,QAAQ,mCAAmC,SAAS,UAAU;AACpE,YAAI,QAAQ;AACV,iBAAO,MAAM,KAAK;AAAA,QAAA;AAEd,cAAA,IAAI,MAAM,KAAK;AAAA,MAAA;AAGf,aAAA,MAAM,SAAS,KAAK;AAAA,aACrB,OAAY;AACnB,UAAI,QAAQ;AACV,eAAO,MAAM,uCAAuC,MAAM,OAAO,EAAE;AAAA,MAAA;AAE/D,YAAA;AAAA,IAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcF,MAAM,gCACJ,eACA,SACA,SACA,cAAsB,IACtB,UAAkB,KAClB,QACkB;AAClB,QAAI,WAAW;AACf,WAAO,WAAW,aAAa;AAC7B,UAAI,QAAQ;AACH,eAAA;AAAA,UACL,yCAAyC,WAAW,CAAC,IAAI,WAAW;AAAA,QACtE;AAAA,MAAA;AAGI,YAA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Q,MAAM,SAAS,KAAK;AAClC,UAAI,KAAK,OAAO;AACP,eAAA;AAAA,UACL,eAAe,CAAC;AAAA,UAChB,OAAO,KAAK;AAAA,UACZ,SAAS;AAAA,QACX;AAAA,MAAA;AAGK,aAAA;AAAA,QACL,eAAe,KAAK,iBAAiB,CAAC;AAAA,QACtC,SAAS;AAAA,MACX;AAAA,aACO,GAAG;AACV,YAAM,QAAQ;AACP,aAAA;AAAA,QACL,eAAe,CAAC;AAAA,QAChB,OAAO,iCAAiC,MAAM,OAAO;AAAA,QACrD,SAAS;AAAA,MACX;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function number(n) {
|
|
2
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
3
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
4
|
+
}
|
|
5
|
+
function bytes(b, ...lengths) {
|
|
6
|
+
if (!(b instanceof Uint8Array))
|
|
7
|
+
throw new Error("Expected Uint8Array");
|
|
8
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
9
|
+
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
10
|
+
}
|
|
11
|
+
function exists(instance, checkFinished = true) {
|
|
12
|
+
if (instance.destroyed)
|
|
13
|
+
throw new Error("Hash instance has been destroyed");
|
|
14
|
+
if (checkFinished && instance.finished)
|
|
15
|
+
throw new Error("Hash#digest() has already been called");
|
|
16
|
+
}
|
|
17
|
+
function output(out, instance) {
|
|
18
|
+
bytes(out);
|
|
19
|
+
const min = instance.outputLen;
|
|
20
|
+
if (out.length < min) {
|
|
21
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
7
22
|
}
|
|
8
|
-
return requestedURL;
|
|
9
23
|
}
|
|
10
24
|
export {
|
|
11
|
-
|
|
25
|
+
bytes,
|
|
26
|
+
exists,
|
|
27
|
+
number,
|
|
28
|
+
output
|
|
12
29
|
};
|
|
13
30
|
//# sourceMappingURL=standards-sdk.es90.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es90.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es90.js","sources":["../../node_modules/@noble/hashes/esm/_assert.js"],"sourcesContent":["function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map"],"names":[],"mappings":"AAAA,SAAS,OAAO,GAAG;AACf,MAAI,CAAC,OAAO,cAAc,CAAC,KAAK,IAAI;AAChC,UAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AACtD;AAKA,SAAS,MAAM,MAAM,SAAS;AAC1B,MAAI,EAAE,aAAa;AACf,UAAM,IAAI,MAAM,qBAAqB;AACzC,MAAI,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,EAAE,MAAM;AAChD,UAAM,IAAI,MAAM,iCAAiC,OAAO,mBAAmB,EAAE,MAAM,EAAE;AAC7F;AAOA,SAAS,OAAO,UAAU,gBAAgB,MAAM;AAC5C,MAAI,SAAS;AACT,UAAM,IAAI,MAAM,kCAAkC;AACtD,MAAI,iBAAiB,SAAS;AAC1B,UAAM,IAAI,MAAM,uCAAuC;AAC/D;AACA,SAAS,OAAO,KAAK,UAAU;AAC3B,QAAM,GAAG;AACT,QAAM,MAAM,SAAS;AACrB,MAAI,IAAI,SAAS,KAAK;AAClB,UAAM,IAAI,MAAM,yDAAyD,GAAG,EAAE;AAAA,EACtF;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,68 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (value, opt, opts) => {
|
|
15
|
-
if (validator2 === false) {
|
|
16
|
-
throw new AxiosError(
|
|
17
|
-
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
18
|
-
AxiosError.ERR_DEPRECATED
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
if (version && !deprecatedWarnings[opt]) {
|
|
22
|
-
deprecatedWarnings[opt] = true;
|
|
23
|
-
console.warn(
|
|
24
|
-
formatMessage(
|
|
25
|
-
opt,
|
|
26
|
-
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
validators.spelling = function spelling(correctSpelling) {
|
|
34
|
-
return (value, opt) => {
|
|
35
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
36
|
-
return true;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
40
|
-
if (typeof options !== "object") {
|
|
41
|
-
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
42
|
-
}
|
|
43
|
-
const keys = Object.keys(options);
|
|
44
|
-
let i = keys.length;
|
|
45
|
-
while (i-- > 0) {
|
|
46
|
-
const opt = keys[i];
|
|
47
|
-
const validator2 = schema[opt];
|
|
48
|
-
if (validator2) {
|
|
49
|
-
const value = options[opt];
|
|
50
|
-
const result = value === void 0 || validator2(value, opt, options);
|
|
51
|
-
if (result !== true) {
|
|
52
|
-
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
53
|
-
}
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (allowUnknown !== true) {
|
|
57
|
-
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
58
|
-
}
|
|
1
|
+
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
2
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
3
|
+
function fromBig(n, le = false) {
|
|
4
|
+
if (le)
|
|
5
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
6
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
7
|
+
}
|
|
8
|
+
function split(lst, le = false) {
|
|
9
|
+
let Ah = new Uint32Array(lst.length);
|
|
10
|
+
let Al = new Uint32Array(lst.length);
|
|
11
|
+
for (let i = 0; i < lst.length; i++) {
|
|
12
|
+
const { h, l } = fromBig(lst[i], le);
|
|
13
|
+
[Ah[i], Al[i]] = [h, l];
|
|
59
14
|
}
|
|
15
|
+
return [Ah, Al];
|
|
60
16
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
17
|
+
const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
18
|
+
const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
19
|
+
const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
20
|
+
const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
65
21
|
export {
|
|
66
|
-
|
|
22
|
+
fromBig,
|
|
23
|
+
rotlBH,
|
|
24
|
+
rotlBL,
|
|
25
|
+
rotlSH,
|
|
26
|
+
rotlSL,
|
|
27
|
+
split
|
|
67
28
|
};
|
|
68
29
|
//# sourceMappingURL=standards-sdk.es91.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es91.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es91.js","sources":["../../node_modules/@noble/hashes/esm/_u64.js"],"sourcesContent":["const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map"],"names":[],"mappings":"AAAA,MAAM,aAA6B,uBAAO,KAAK,KAAK,CAAC;AACrD,MAAM,OAAuB,uBAAO,EAAE;AAEtC,SAAS,QAAQ,GAAG,KAAK,OAAO;AAC5B,MAAI;AACA,WAAO,EAAE,GAAG,OAAO,IAAI,UAAU,GAAG,GAAG,OAAQ,KAAK,OAAQ,UAAU,EAAG;AAC7E,SAAO,EAAE,GAAG,OAAQ,KAAK,OAAQ,UAAU,IAAI,GAAG,GAAG,OAAO,IAAI,UAAU,IAAI,EAAG;AACrF;AACA,SAAS,MAAM,KAAK,KAAK,OAAO;AAC5B,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACjC,UAAM,EAAE,GAAG,EAAG,IAAG,QAAQ,IAAI,CAAC,GAAG,EAAE;AACnC,KAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAAA,EAC9B;AACI,SAAO,CAAC,IAAI,EAAE;AAClB;AAeK,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAC/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAE/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;AACtD,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
const u8a = (a) => a instanceof Uint8Array;
|
|
3
|
+
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
4
|
+
const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
5
|
+
if (!isLE)
|
|
6
|
+
throw new Error("Non little-endian hardware is not supported");
|
|
7
|
+
function utf8ToBytes(str) {
|
|
8
|
+
if (typeof str !== "string")
|
|
9
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
10
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
11
|
+
}
|
|
12
|
+
function toBytes(data) {
|
|
13
|
+
if (typeof data === "string")
|
|
14
|
+
data = utf8ToBytes(data);
|
|
15
|
+
if (!u8a(data))
|
|
16
|
+
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
class Hash {
|
|
20
|
+
// Safe version that clones internal state
|
|
21
|
+
clone() {
|
|
22
|
+
return this._cloneInto();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function wrapConstructor(hashCons) {
|
|
26
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
27
|
+
const tmp = hashCons();
|
|
28
|
+
hashC.outputLen = tmp.outputLen;
|
|
29
|
+
hashC.blockLen = tmp.blockLen;
|
|
30
|
+
hashC.create = () => hashCons();
|
|
31
|
+
return hashC;
|
|
32
|
+
}
|
|
6
33
|
export {
|
|
7
|
-
|
|
34
|
+
Hash,
|
|
35
|
+
isLE,
|
|
36
|
+
toBytes,
|
|
37
|
+
u32,
|
|
38
|
+
utf8ToBytes,
|
|
39
|
+
wrapConstructor
|
|
8
40
|
};
|
|
9
41
|
//# sourceMappingURL=standards-sdk.es92.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es92.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es92.js","sources":["../../node_modules/@noble/hashes/esm/utils.js"],"sourcesContent":["/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map"],"names":[],"mappings":"AAAA;AAQA,MAAM,MAAM,CAAC,MAAM,aAAa;AAGpB,MAAC,MAAM,CAAC,QAAQ,IAAI,YAAY,IAAI,QAAQ,IAAI,YAAY,KAAK,MAAM,IAAI,aAAa,CAAC,CAAC;AAO1F,MAAC,OAAO,IAAI,WAAW,IAAI,YAAY,CAAC,SAAU,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM;AAChF,IAAI,CAAC;AACD,QAAM,IAAI,MAAM,6CAA6C;AAuD1D,SAAS,YAAY,KAAK;AAC7B,MAAI,OAAO,QAAQ;AACf,UAAM,IAAI,MAAM,oCAAoC,OAAO,GAAG,EAAE;AACpE,SAAO,IAAI,WAAW,IAAI,YAAa,EAAC,OAAO,GAAG,CAAC;AACvD;AAMO,SAAS,QAAQ,MAAM;AAC1B,MAAI,OAAO,SAAS;AAChB,WAAO,YAAY,IAAI;AAC3B,MAAI,CAAC,IAAI,IAAI;AACT,UAAM,IAAI,MAAM,4BAA4B,OAAO,IAAI,EAAE;AAC7D,SAAO;AACX;AAgBO,MAAM,KAAK;AAAA;AAAA,EAEd,QAAQ;AACJ,WAAO,KAAK,WAAY;AAAA,EAChC;AACA;AAQO,SAAS,gBAAgB,UAAU;AACtC,QAAM,QAAQ,CAAC,QAAQ,SAAU,EAAC,OAAO,QAAQ,GAAG,CAAC,EAAE,OAAQ;AAC/D,QAAM,MAAM,SAAU;AACtB,QAAM,YAAY,IAAI;AACtB,QAAM,WAAW,IAAI;AACrB,QAAM,SAAS,MAAM,SAAU;AAC/B,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, options));
|
|
14
|
-
}
|
|
1
|
+
import URLSearchParams from "./standards-sdk.es107.js";
|
|
2
|
+
import FormData from "./standards-sdk.es108.js";
|
|
3
|
+
import Blob from "./standards-sdk.es109.js";
|
|
4
|
+
const platform = {
|
|
5
|
+
isBrowser: true,
|
|
6
|
+
classes: {
|
|
7
|
+
URLSearchParams,
|
|
8
|
+
FormData,
|
|
9
|
+
Blob
|
|
10
|
+
},
|
|
11
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12
|
+
};
|
|
15
13
|
export {
|
|
16
|
-
|
|
14
|
+
platform as default
|
|
17
15
|
};
|
|
18
16
|
//# sourceMappingURL=standards-sdk.es93.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es93.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es93.js","sources":["../../node_modules/axios/lib/platform/browser/index.js"],"sourcesContent":["import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n"],"names":[],"mappings":";;;AAIA,MAAe,WAAA;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACD,WAAW,CAAC,QAAQ,SAAS,QAAQ,QAAQ,OAAO,MAAM;AAC5D;","x_google_ignoreList":[0]}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
3
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
4
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
5
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
6
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
7
|
+
})();
|
|
8
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
hasBrowserEnv,
|
|
11
|
+
hasStandardBrowserEnv,
|
|
12
|
+
hasStandardBrowserWebWorkerEnv,
|
|
13
|
+
_navigator as navigator,
|
|
14
|
+
origin
|
|
9
15
|
};
|
|
10
16
|
//# sourceMappingURL=standards-sdk.es94.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es94.js","sources":["../../node_modules/axios/lib/platform/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es94.js","sources":["../../node_modules/axios/lib/platform/common/utils.js"],"sourcesContent":["const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\nconst _navigator = typeof navigator === 'object' && navigator || undefined;\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = hasBrowserEnv &&\n (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n _navigator as navigator,\n origin\n}\n"],"names":[],"mappings":"AAAK,MAAC,gBAAgB,OAAO,WAAW,eAAe,OAAO,aAAa;AAEtE,MAAC,aAAa,OAAO,cAAc,YAAY,aAAa;AAmB5D,MAAC,wBAAwB,kBAC3B,CAAC,cAAc,CAAC,eAAe,gBAAgB,IAAI,EAAE,QAAQ,WAAW,OAAO,IAAI;AAWjF,MAAC,kCAAkC,MAAM;AAC5C,SACE,OAAO,sBAAsB;AAAA,EAE7B,gBAAgB,qBAChB,OAAO,KAAK,kBAAkB;AAElC,GAAC;AAEI,MAAC,SAAS,iBAAiB,OAAO,SAAS,QAAQ;","x_google_ignoreList":[0]}
|
|
@@ -1,48 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"location",
|
|
15
|
-
"max-forwards",
|
|
16
|
-
"proxy-authorization",
|
|
17
|
-
"referer",
|
|
18
|
-
"retry-after",
|
|
19
|
-
"user-agent"
|
|
20
|
-
]);
|
|
21
|
-
const parseHeaders = (rawHeaders) => {
|
|
22
|
-
const parsed = {};
|
|
23
|
-
let key;
|
|
24
|
-
let val;
|
|
25
|
-
let i;
|
|
26
|
-
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
27
|
-
i = line.indexOf(":");
|
|
28
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
29
|
-
val = line.substring(i + 1).trim();
|
|
30
|
-
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (key === "set-cookie") {
|
|
34
|
-
if (parsed[key]) {
|
|
35
|
-
parsed[key].push(val);
|
|
36
|
-
} else {
|
|
37
|
-
parsed[key] = [val];
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
41
|
-
}
|
|
1
|
+
import toFormData from "./standards-sdk.es42.js";
|
|
2
|
+
function encode(str) {
|
|
3
|
+
const charMap = {
|
|
4
|
+
"!": "%21",
|
|
5
|
+
"'": "%27",
|
|
6
|
+
"(": "%28",
|
|
7
|
+
")": "%29",
|
|
8
|
+
"~": "%7E",
|
|
9
|
+
"%20": "+",
|
|
10
|
+
"%00": "\0"
|
|
11
|
+
};
|
|
12
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
13
|
+
return charMap[match];
|
|
42
14
|
});
|
|
43
|
-
|
|
15
|
+
}
|
|
16
|
+
function AxiosURLSearchParams(params, options) {
|
|
17
|
+
this._pairs = [];
|
|
18
|
+
params && toFormData(params, this, options);
|
|
19
|
+
}
|
|
20
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
21
|
+
prototype.append = function append(name, value) {
|
|
22
|
+
this._pairs.push([name, value]);
|
|
23
|
+
};
|
|
24
|
+
prototype.toString = function toString(encoder) {
|
|
25
|
+
const _encode = encoder ? function(value) {
|
|
26
|
+
return encoder.call(this, value, encode);
|
|
27
|
+
} : encode;
|
|
28
|
+
return this._pairs.map(function each(pair) {
|
|
29
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
30
|
+
}, "").join("&");
|
|
44
31
|
};
|
|
45
32
|
export {
|
|
46
|
-
|
|
33
|
+
AxiosURLSearchParams as default
|
|
47
34
|
};
|
|
48
35
|
//# sourceMappingURL=standards-sdk.es95.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es95.js","sources":["../../node_modules/axios/lib/helpers/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es95.js","sources":["../../node_modules/axios/lib/helpers/AxiosURLSearchParams.js"],"sourcesContent":["'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object<string, any>} params - The parameters to be converted to a FormData object.\n * @param {Object<string, any>} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n"],"names":[],"mappings":";AAYA,SAAS,OAAO,KAAK;AACnB,QAAM,UAAU;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,EACR;AACD,SAAO,mBAAmB,GAAG,EAAE,QAAQ,oBAAoB,SAAS,SAAS,OAAO;AAClF,WAAO,QAAQ,KAAK;AAAA,EACxB,CAAG;AACH;AAUA,SAAS,qBAAqB,QAAQ,SAAS;AAC7C,OAAK,SAAS,CAAE;AAEhB,YAAU,WAAW,QAAQ,MAAM,OAAO;AAC5C;AAEA,MAAM,YAAY,qBAAqB;AAEvC,UAAU,SAAS,SAAS,OAAO,MAAM,OAAO;AAC9C,OAAK,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAChC;AAEA,UAAU,WAAW,SAAS,SAAS,SAAS;AAC9C,QAAM,UAAU,UAAU,SAAS,OAAO;AACxC,WAAO,QAAQ,KAAK,MAAM,OAAO,MAAM;AAAA,EAC3C,IAAM;AAEJ,SAAO,KAAK,OAAO,IAAI,SAAS,KAAK,MAAM;AACzC,WAAO,QAAQ,KAAK,CAAC,CAAC,IAAI,MAAM,QAAQ,KAAK,CAAC,CAAC;AAAA,EACnD,GAAK,EAAE,EAAE,KAAK,GAAG;AACjB;","x_google_ignoreList":[0]}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import utils from "./standards-sdk.es32.js";
|
|
2
|
+
import defaults from "./standards-sdk.es36.js";
|
|
3
|
+
import AxiosHeaders from "./standards-sdk.es46.js";
|
|
4
|
+
function transformData(fns, response) {
|
|
5
|
+
const config = this || defaults;
|
|
6
|
+
const context = response || config;
|
|
7
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
8
|
+
let data = context.data;
|
|
9
|
+
utils.forEach(fns, function transform(fn) {
|
|
10
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
11
|
+
});
|
|
12
|
+
headers.normalize();
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
2
15
|
export {
|
|
3
|
-
|
|
16
|
+
transformData as default
|
|
4
17
|
};
|
|
5
18
|
//# sourceMappingURL=standards-sdk.es96.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es96.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es96.js","sources":["../../node_modules/axios/lib/core/transformData.js"],"sourcesContent":["'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n"],"names":[],"mappings":";;;AAce,SAAS,cAAc,KAAK,UAAU;AACnD,QAAM,SAAS,QAAQ;AACvB,QAAM,UAAU,YAAY;AAC5B,QAAM,UAAU,aAAa,KAAK,QAAQ,OAAO;AACjD,MAAI,OAAO,QAAQ;AAEnB,QAAM,QAAQ,KAAK,SAAS,UAAU,IAAI;AACxC,WAAO,GAAG,KAAK,QAAQ,MAAM,QAAQ,UAAS,GAAI,WAAW,SAAS,SAAS,MAAS;AAAA,EAC5F,CAAG;AAED,UAAQ,UAAW;AAEnB,SAAO;AACT;","x_google_ignoreList":[0]}
|