@permaweb/libs 0.0.34 → 0.0.36
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/index.cjs +6 -6
- package/dist/index.cjs.map +3 -3
- package/dist/index.esm.js +6 -6
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +6 -6
- package/dist/index.js.map +3 -3
- package/dist/types/helpers/config.d.ts +1 -1
- package/dist/types/helpers/types.d.ts +3 -0
- package/dist/types/index.d.ts +11 -1
- package/dist/types/services/profiles.d.ts +0 -4
- package/dist/types/services/zones.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/process/browser.js", "../src/index.ts", "../src/common/index.ts", "../src/common/ao.ts", "../src/helpers/config.ts", "../src/helpers/endpoints.ts", "../src/helpers/utils.ts", "../src/common/gql.ts", "../src/common/arweave.ts", "../src/helpers/index.ts", "../src/helpers/types.ts", "../src/services/index.ts", "../src/services/assets.ts", "../src/services/collections.ts", "../src/services/comments.ts", "../src/services/profiles.ts", "../src/services/zones.ts"],
|
|
4
|
-
"sourcesContent": ["// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n", "import { Buffer } from 'buffer';\n\nimport * as Common from './common/index.ts';\nimport * as Helpers from './helpers/index.ts';\nimport * as Services from './services/index.ts';\n\n/* Used for build - Do not remove ! */\nif (!globalThis.Buffer) globalThis.Buffer = Buffer;\n\nfunction init(deps: Helpers.DependencyType) {\n\treturn {\n\t\t/* Zones */\n\t\tcreateZone: Services.createZoneWith(deps),\n\t\tupdateZone: Services.updateZoneWith(deps),\n\t\taddToZone: Services.addToZoneWith(deps),\n\t\tgetZone: Services.getZoneWith(deps),\n\t\t/* Profiles */\n\t\tcreateProfile: Services.createProfileWith(deps),\n\t\tupdateProfile: Services.updateProfileWith(deps),\n\t\tgetProfileById: Services.getProfileByIdWith(deps),\n\t\tgetProfileByWalletAddress: Services.getProfileByWalletAddressWith(deps),\n\t\t/* Assets */\n\t\tcreateAtomicAsset: Services.createAtomicAssetWith(deps),\n\t\tgetAtomicAsset: Services.getAtomicAssetWith(deps),\n\t\tgetAtomicAssets: Services.getAtomicAssets,\n\t\t/* Comments */\n\t\tcreateComment: Services.createCommentWith(deps),\n\t\tgetComment: Services.getCommentWith(deps),\n\t\tgetComments: Services.getCommentsWith(deps),\n\t\t/* Collections */\n\t\tcreateCollection: Services.createCollectionWith(deps),\n\t\tupdateCollectionAssets: Services.updateCollectionAssetsWith(deps),\n\t\tgetCollection: Services.getCollectionWith(deps),\n\t\tgetCollections: Services.getCollectionsWith(deps),\n\t\t/* Common */\n\t\tresolveTransaction: Common.resolveTransactionWith(deps),\n\t\tgetGQLData: Common.getGQLData,\n\t\tgetAggregatedGQLData: Common.getAggregatedGQLData,\n\t\tcreateProcess: Common.aoCreateProcessWith(deps),\n\t\treadProcess: Common.aoDryRunWith(deps),\n\t\tsendMessage: Common.aoSendWith(deps),\n\t\twaitForProcess: Common.waitForProcess,\n\t\t/* Utils */\n\t\tmapFromProcessCase: Helpers.mapFromProcessCase,\n\t\tmapToProcessCase: Helpers.mapToProcessCase,\n\t};\n}\n\nexport default { init };\n\nexport * from './helpers/types.ts';\n", "export * from './ao.ts';\nexport * from './arweave.ts';\nexport * from './gql.ts';\n", "import { AO, GATEWAYS, HB } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport {\n\tDependencyType,\n\tMessageDryRunType,\n\tMessageResultType,\n\tMessageSendType,\n\tProcessCreateType,\n\tProcessSpawnType,\n\tTagType,\n} from '../helpers/types.ts';\nimport { getTagValue, globalLog } from '../helpers/utils.ts';\n\nimport { getGQLData } from './gql.ts';\n\nconst GATEWAY = GATEWAYS.goldsky;\n\nconst GATEWAY_RETRY_COUNT = 100;\n\nexport async function aoSpawn(deps: DependencyType, args: ProcessSpawnType): Promise<string> {\n\tconst tags = [{ name: 'Authority', value: AO.mu }];\n\tif (args.tags && args.tags.length > 0) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\ttry {\n\t\tconst processId = await deps.ao.spawn({\n\t\t\tmodule: args.module,\n\t\t\tscheduler: args.scheduler,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: args.data,\n\t\t});\n\n\t\tglobalLog(`Process ID: ${processId}`);\n\n\t\treturn processId;\n\t} catch (e: any) {\n\t\tconsole.log(e)\n\t\tthrow new Error(e.message ?? 'Error spawning process');\n\t}\n}\n\nexport function aoSendWith(deps: DependencyType) {\n\treturn async (args: MessageSendType) => {\n\t\treturn await aoSend(deps, args);\n\t}\n}\n\nexport async function aoSend(deps: DependencyType, args: MessageSendType): Promise<string> {\n\ttry {\n\t\tconst tags: TagType[] = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\n\t\tconst data = args.useRawData ? args.data : JSON.stringify(args.data);\n\n\t\tconst txId = await deps.ao.message({\n\t\t\tprocess: args.processId,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: data,\n\t\t});\n\n\t\treturn txId;\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\nexport async function readProcess(deps: DependencyType, args: { processId: string, path: string, node?: string, fallbackAction?: string }) {\n\tconst node = args.node ?? HB.node;\n\tconst mode = 'now';\n\ttry {\n\t\tconsole.log('Getting state from HyperBEAM...');\n\t\tconst response = await fetch(`${node}/${args.processId}~process@1.0/${mode}/${args.path}`);\n\t\treturn await response.json();\n\t}\n\tcatch (e: any) {\n\t\tif (args.fallbackAction) {\n\t\t\tconsole.error(e.message ?? 'Error reading process from HyperBEAM');\n\n\t\t\tconsole.log('State not found, dryrunning...');\n\t\t\tconst response = await aoDryRun(deps, {\n\t\t\t\tprocessId: args.processId,\n\t\t\t\taction: args.fallbackAction,\n\t\t\t});\n\n\t\t\treturn response;\n\t\t}\n\t\telse {\n\t\t\tthrow new Error(e.message ?? 'Error reading process from HyperBEAM');\n\t\t}\n\t}\n}\n\nexport function aoDryRunWith(deps: DependencyType) {\n\treturn async (args: MessageSendType) => {\n\t\treturn await aoDryRun(deps, args);\n\t}\n}\n\nexport async function aoDryRun(deps: DependencyType, args: MessageDryRunType): Promise<any> {\n\ttry {\n\t\tconst tags = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\t\tlet dataPayload;\n\t\tif (typeof args.data === 'object') {\n\t\t\tdataPayload = JSON.stringify(args.data || {});\n\t\t} else if (typeof args.data === 'string') {\n\t\t\ttry {\n\t\t\t\tJSON.parse(args.data);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e);\n\t\t\t\tthrow new Error('Invalid JSON data');\n\t\t\t}\n\t\t\tdataPayload = args.data;\n\t\t}\n\n\t\tconst response = await deps.ao.dryrun({\n\t\t\tprocess: args.processId,\n\t\t\ttags: tags,\n\t\t\tdata: dataPayload,\n\t\t});\n\n\t\tif (response.Messages && response.Messages.length) {\n\t\t\tif (response.Messages[0].Data) {\n\t\t\t\treturn JSON.parse(response.Messages[0].Data);\n\t\t\t} else {\n\t\t\t\tif (response.Messages[0].Tags) {\n\t\t\t\t\treturn response.Messages[0].Tags.reduce((acc: any, item: any) => {\n\t\t\t\t\t\tacc[item.name] = item.value;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error dryrunning process');\n\t}\n}\n\nexport async function aoMessageResult(deps: DependencyType, args: MessageResultType): Promise<any> {\n\ttry {\n\t\tconst { Messages } = await deps.ao.result({ message: args.messageId, process: args.processId });\n\n\t\tif (Messages && Messages.length) {\n\t\t\tconst response: { [key: string]: any } = {};\n\n\t\t\tMessages.forEach((message: any) => {\n\t\t\t\tconst action = getTagValue(message.Tags, 'Action') || args.action;\n\n\t\t\t\tlet responseData = null;\n\t\t\t\tconst messageData = message.Data;\n\n\t\t\t\tif (messageData) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresponseData = JSON.parse(messageData);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tresponseData = messageData;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst responseStatus = getTagValue(message.Tags, 'Status');\n\t\t\t\tconst responseMessage = getTagValue(message.Tags, 'Message');\n\n\t\t\t\tresponse[action] = {\n\t\t\t\t\tid: args.messageId,\n\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\tdata: responseData,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn response;\n\t\t} else return null;\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function aoMessageResults(\n\tdeps: DependencyType,\n\targs: {\n\t\tprocessId: string;\n\t\taction: string;\n\t\ttags: TagType[] | null;\n\t\tdata: any;\n\t\tresponses?: string[];\n\t\thandler?: string;\n\t},\n): Promise<any> {\n\ttry {\n\t\tconst tags = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\n\t\tawait deps.ao.message({\n\t\t\tprocess: args.processId,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: JSON.stringify(args.data),\n\t\t});\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\n\t\tconst messageResults = await deps.ao.results({\n\t\t\tprocess: args.processId,\n\t\t\tsort: 'DESC',\n\t\t\tlimit: 100,\n\t\t});\n\n\t\tif (messageResults && messageResults.edges && messageResults.edges.length) {\n\t\t\tconst response: any = {};\n\n\t\t\tfor (const result of messageResults.edges) {\n\t\t\t\tif (result.node && result.node.Messages && result.node.Messages.length) {\n\t\t\t\t\tconst resultSet: any[] = [args.action];\n\t\t\t\t\tif (args.responses) resultSet.push(...args.responses);\n\n\t\t\t\t\tfor (const message of result.node.Messages) {\n\t\t\t\t\t\tconst action = getTagValue(message.Tags, 'Action');\n\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\tlet responseData = null;\n\t\t\t\t\t\t\tconst messageData = message.Data;\n\n\t\t\t\t\t\t\tif (messageData) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tresponseData = JSON.parse(messageData);\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tresponseData = messageData;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst responseStatus = getTagValue(message.Tags, 'Status');\n\t\t\t\t\t\t\tconst responseMessage = getTagValue(message.Tags, 'Message');\n\n\t\t\t\t\t\t\tif (action === 'Action-Response') {\n\t\t\t\t\t\t\t\tconst responseHandler = getTagValue(message.Tags, 'Handler');\n\t\t\t\t\t\t\t\tif (args.handler && args.handler === responseHandler) {\n\t\t\t\t\t\t\t\t\tresponse[action] = {\n\t\t\t\t\t\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\t\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\t\t\t\t\t\tdata: responseData,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (resultSet.indexOf(action) !== -1) {\n\t\t\t\t\t\t\t\t\tresponse[action] = {\n\t\t\t\t\t\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\t\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\t\t\t\t\t\tdata: responseData,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (Object.keys(response).length === resultSet.length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn response;\n\t\t}\n\n\t\treturn null;\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function handleProcessEval(\n\tdeps: DependencyType,\n\targs: {\n\t\tprocessId: string;\n\t\tevalTxId: string | null;\n\t\tevalSrc: string | null;\n\t\tevalTags?: TagType[];\n\t},\n): Promise<string | null> {\n\tlet src: string | null = null;\n\n\tif (args.evalSrc) src = args.evalSrc;\n\telse if (args.evalTxId) src = await fetchProcessSrc(args.evalTxId);\n\n\tif (src) {\n\t\ttry {\n\t\t\tconst evalMessage = await aoSend(deps, {\n\t\t\t\tprocessId: args.processId,\n\t\t\t\taction: 'Eval',\n\t\t\t\tdata: src,\n\t\t\t\ttags: args.evalTags || null,\n\t\t\t\tuseRawData: true,\n\t\t\t});\n\n\t\t\tglobalLog(`Eval: ${evalMessage}`);\n\n\t\t\tconst evalResult = await aoMessageResult(deps, {\n\t\t\t\tprocessId: args.processId,\n\t\t\t\tmessageId: evalMessage,\n\t\t\t\taction: 'Eval',\n\t\t\t});\n\n\t\t\treturn evalResult;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error sending process eval');\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function aoCreateProcessWith(deps: DependencyType) {\n\treturn async (args: ProcessCreateType, statusCB?: (status: any) => void) => {\n\t\ttry {\n\t\t\tconst spawnArgs: any = {\n\t\t\t\tmodule: args.module || AO.module,\n\t\t\t\tscheduler: args.scheduler || AO.scheduler,\n\t\t\t};\n\n\t\t\tif (args.data) spawnArgs.data = args.data;\n\t\t\tif (args.tags) spawnArgs.tags = args.tags;\n\n\t\t\tstatusCB && statusCB(`Spawning process...`);\n\t\t\tconst processId = await aoSpawn(deps, spawnArgs);\n\t\t\t\n\t\t\tif (args.evalTxId || args.evalSrc) {\n\t\t\t\tstatusCB && statusCB(`Process retrieved!`);\n\t\t\t\tstatusCB && statusCB('Sending eval...');\n\n\t\t\t\ttry {\n\t\t\t\t\tconst evalResult = await handleProcessEval(deps, {\n\t\t\t\t\t\tprocessId: processId,\n\t\t\t\t\t\tevalTxId: args.evalTxId || null,\n\t\t\t\t\t\tevalSrc: args.evalSrc || null,\n\t\t\t\t\t\tevalTags: args.evalTags,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (evalResult && statusCB) statusCB('Eval complete');\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn processId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t}\n\t};\n}\n\nexport async function aoCreateProcess(\n\tdeps: DependencyType,\n\targs: ProcessCreateType,\n\tstatusCB?: (status: any) => void,\n): Promise<string> {\n\ttry {\n\t\tconst spawnArgs: any = {\n\t\t\tmodule: args.module || AO.module,\n\t\t\tscheduler: args.scheduler || AO.scheduler,\n\t\t};\n\n\t\tif (args.data) spawnArgs.data = args.data;\n\t\tif (args.tags) spawnArgs.tags = args.tags;\n\n\t\tstatusCB && statusCB(`Spawning process...`);\n\t\tconst processId = await aoSpawn(deps, spawnArgs);\n\n\t\tif (args.evalTxId || args.evalSrc) {\n\t\t\tstatusCB && statusCB(`Process retrieved!`);\n\t\t\tstatusCB && statusCB('Sending eval...');\n\n\t\t\ttry {\n\t\t\t\tconst evalResult = await handleProcessEval(deps, {\n\t\t\t\t\tprocessId: processId,\n\t\t\t\t\tevalTxId: args.evalTxId || null,\n\t\t\t\t\tevalSrc: args.evalSrc || null,\n\t\t\t\t\tevalTags: args.evalTags,\n\t\t\t\t});\n\n\t\t\t\tif (evalResult && statusCB) statusCB('Eval complete');\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t\t}\n\t\t}\n\n\t\treturn processId;\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error creating process');\n\t}\n}\n\nexport async function fetchProcessSrc(txId: string): Promise<string> {\n\ttry {\n\t\tconst srcFetch = await fetch(getTxEndpoint(txId));\n\t\treturn await srcFetch.text();\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\nexport async function waitForProcess(args: { processId: string, noRetryLimit?: boolean }) {\n\tlet retries = 0;\n\tconst retryLimit = args.noRetryLimit ? Infinity : GATEWAY_RETRY_COUNT;\n \n\twhile (retries < retryLimit) {\n\t await new Promise((resolve) => setTimeout(resolve, 2000));\n \n\t const gqlResponse = await getGQLData({\n\t\tgateway: GATEWAY,\n\t\tids: [args.processId],\n\t });\n \n\t if (gqlResponse?.data?.length) {\n\t\tconst foundProcess = gqlResponse.data[0].node.id;\n\t\tglobalLog(`Process found: ${foundProcess} (Try ${retries + 1})`);\n\t\treturn foundProcess;\n\t } else {\n\t\tglobalLog(`Process not found: ${args.processId} (Try ${retries + 1})`);\n\t\tretries++;\n\t }\n\t}\n \n\tif (retryLimit !== Infinity) {\n\t throw new Error(`Process not found, please try again`);\n\t}\n }", "export const AO = {\n\tmodule: 'URgYpPQzvxxfYQtjrIQ116bl3YBfcImo3JEnNo8Hlrk',\n\tscheduler: '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA',\n\tmu: 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY',\n\tsrc: {\n\t\tasset: 'kJo3YG9tKpMhBJhB8GlvmsghmpbY1o7q2VRAh1LsgpI',\n\t\tcollection: 'aHN0YxA7Th1OQdtgv0slWv9LMrvYukvNgWdkotJsML0',\n\t\tcollectionActivity: 'k8K8WIJb5kXOVvZRFXF5GIZW-7b2NtaTOd6G-E5MF0k',\n\t\tprofile: 'WBhJpPafkykqZZgTr7TAsz48RKG4vbOEAH4rZ3JxIQ8',\n\t\tzone: 'f-Xac27OGcSSQuw8__BSwAauc4vANST92fZX2j0UJn0',\n\t},\n\tcollectionRegistry: 'zwKi27GuKS3GOlwL3EhNGH02SJDDAO5Uy43ZJwomhZ4',\n\tprofileRegistry: 'SNy4m-DrqxWl01YqGM4sxI8qCni-58re8uuJLvZPypY'\n};\n\nexport const HB = {\n\tnode: 'https://router-1.forward.computer'\n};\n\nexport const CONTENT_TYPES: { [key: string]: { type: string; serialize: (data: any) => any } } = {\n\t'application/json': {\n\t\ttype: 'application/json',\n\t\tserialize: (data: any) => JSON.stringify(data),\n\t},\n};\n\nexport const GATEWAYS = {\n\tarweave: 'arweave.net',\n\tgoldsky: 'arweave-search.goldsky.com',\n};\n\nexport const LICENSES = {\n\tudl: {\n\t\tlabel: 'Universal Data License',\n\t\taddress: 'dE0rmDfl9_OWjkDznNEXHaSO_JohJkRolvMzaCroUdw',\n\t},\n};\n\nexport const TAGS = {\n\tkeys: {\n\t\taccess: 'Access-Fee',\n\t\tans110: {\n\t\t\ttitle: 'Title',\n\t\t\tdescription: 'Description',\n\t\t\ttopic: 'Topic:*',\n\t\t\ttype: 'Type',\n\t\t\timplements: 'Implements',\n\t\t\tlicense: 'License',\n\t\t},\n\t\tassetType: 'Asset-Type',\n\t\tbanner: 'Banner',\n\t\tbootloader: 'Bootloader',\n\t\tbootloaderInit: 'On-Boot',\n\t\tcollectionId: 'Collection-Id',\n\t\tcollectionName: 'Collection-Name',\n\t\tcommericalUse: 'Commercial-Use',\n\t\tcontentType: 'Content-Type',\n\t\tcreator: 'Creator',\n\t\tcurrency: 'Currency',\n\t\tdataModelTraining: 'Data-Model-Training',\n\t\tdataProtocol: 'Data-Protocol',\n\t\tdateCreated: 'Date-Created',\n\t\tderivations: 'Derivations',\n\t\tdescription: 'Description',\n\t\tdisplayName: 'Display-Name',\n\t\thandle: 'Handle',\n\t\timplements: 'Implements',\n\t\tinitialOwner: 'Initial-Owner',\n\t\tlicense: 'License',\n\t\tname: 'Name',\n\t\tpaymentAddress: 'Payment-Address',\n\t\tpaymentMode: 'Payment-Mode',\n\t\tprofileCreator: 'Profile-Creator',\n\t\tprofileIndex: 'Profile-Index',\n\t\tprotocolName: 'Protocol-Name',\n\t\trenderWith: 'Render-With',\n\t\tthumbnail: 'Thumbnail',\n\t\ttitle: 'Title',\n\t\ttopic: 'Topic',\n\t\ttype: 'Type',\n\t\tzoneType: 'Zone-Type',\n\t},\n\tvalues: {\n\t\tdocument: 'Document',\n\t\tuser: 'User',\n\t\tzone: 'Permaweb-Zone'\n\t},\n};\n\nexport const UPLOAD = {\n\tnode1: 'https://up.arweave.net',\n\tnode2: 'https://turbo.ardrive.io',\n\tbatchSize: 1,\n\tchunkSize: 7500000,\n\tdispatchUploadSize: 100 * 1024,\n};\n", "import { checkValidAddress } from './utils.ts';\n\nconst arweaveEndpoint = 'https://arweave.net';\n\nexport function getARBalanceEndpoint(walletAddress: string) {\n\treturn `${arweaveEndpoint}/wallet/${walletAddress}/balance`;\n}\n\nexport function getTxEndpoint(txId: string) {\n\treturn `${arweaveEndpoint}/${txId}`;\n}\n\nexport function getRendererEndpoint(renderWith: string, tx: string) {\n\tif (checkValidAddress(renderWith)) {\n\t\treturn `${arweaveEndpoint}/${renderWith}/?tx=${tx}`;\n\t} else {\n\t\treturn `https://${renderWith}.arweave.net/?tx=${tx}`;\n\t}\n}\n", "import { TAGS } from './config.ts';\n\ndeclare const InstallTrigger: any;\n\nexport function checkValidAddress(address: string | null) {\n\tif (!address) return false;\n\treturn /^[a-z0-9_-]{43}$/i.test(address);\n}\n\nexport function formatAddress(address: string | null, wrap: boolean) {\n\tif (!address) return '';\n\tif (!checkValidAddress(address)) return address;\n\tconst formattedAddress = address.substring(0, 5) + '...' + address.substring(36, address.length);\n\treturn wrap ? `(${formattedAddress})` : formattedAddress;\n}\n\nexport function getTagValue(list: { [key: string]: any }[], name: string): string | null {\n\tfor (let i = 0; i < list.length; i++) {\n\t\tif (list[i]) {\n\t\t\tif (list[i]!.name === name) {\n\t\t\t\treturn list[i]!.value as string;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function formatCount(count: string): string {\n\tif (count === '0' || !Number(count)) return '0';\n\n\tif (count.includes('.')) {\n\t\tlet parts = count.split('.');\n\t\tparts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n\n\t\t// Find the position of the last non-zero digit within the first 6 decimal places\n\t\tlet index = 0;\n\t\tfor (let i = 0; i < Math.min(parts[1].length, 6); i++) {\n\t\t\tif (parts[1][i] !== '0') {\n\t\t\t\tindex = i + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (index === 0) {\n\t\t\t// If all decimals are zeros, keep two decimal places\n\t\t\tparts[1] = '00';\n\t\t} else {\n\t\t\t// Otherwise, truncate to the last non-zero digit\n\t\t\tparts[1] = parts[1].substring(0, index);\n\n\t\t\t// If the decimal part is longer than 4 digits, truncate to 4 digits\n\t\t\tif (parts[1].length > 4 && parts[1].substring(0, 4) !== '0000') {\n\t\t\t\tparts[1] = parts[1].substring(0, 4);\n\t\t\t}\n\t\t}\n\n\t\treturn parts.join('.');\n\t} else {\n\t\treturn count.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n\t}\n}\n\nexport function formatPercentage(percentage: any) {\n\tif (isNaN(percentage)) return '0%';\n\n\tlet multiplied = percentage * 100;\n\tlet decimalPart = multiplied.toString().split('.')[1];\n\n\tif (!decimalPart) {\n\t\treturn `${multiplied.toFixed(0)}%`;\n\t}\n\n\tif (decimalPart.length > 6 && decimalPart.substring(0, 6) === '000000') {\n\t\treturn `${multiplied.toFixed(0)}%`;\n\t}\n\n\tlet nonZeroIndex = decimalPart.length;\n\tfor (let i = 0; i < decimalPart.length; i++) {\n\t\tif (decimalPart[i] !== '0') {\n\t\t\tnonZeroIndex = i + 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn `${multiplied.toFixed(nonZeroIndex)}%`;\n}\n\nexport function formatDate(dateArg: string | number | null, dateType: 'iso' | 'epoch', fullTime?: boolean) {\n\tif (!dateArg) {\n\t\treturn null;\n\t}\n\n\tlet date: Date | null = null;\n\n\tswitch (dateType) {\n\t\tcase 'iso':\n\t\t\tdate = new Date(dateArg);\n\t\t\tbreak;\n\t\tcase 'epoch':\n\t\t\tdate = new Date(Number(dateArg));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tdate = new Date(dateArg);\n\t\t\tbreak;\n\t}\n\n\treturn fullTime\n\t\t? `${date.toLocaleString('default', { month: 'long' })} ${date.getDate()}, ${date.getUTCFullYear()} at ${\n\t\t\t\tdate.getHours() % 12 || 12\n\t\t\t}:${date.getMinutes().toString().padStart(2, '0')} ${date.getHours() >= 12 ? 'PM' : 'AM'}`\n\t\t: `${date.toLocaleString('default', { month: 'long' })} ${date.getDate()}, ${date.getUTCFullYear()}`;\n}\n\nexport function getRelativeDate(timestamp: number) {\n\tif (!timestamp) return '-';\n\tconst currentDate = new Date();\n\tconst inputDate = new Date(timestamp);\n\n\tconst timeDifference: number = currentDate.getTime() - inputDate.getTime();\n\tconst secondsDifference = Math.floor(timeDifference / 1000);\n\tconst minutesDifference = Math.floor(secondsDifference / 60);\n\tconst hoursDifference = Math.floor(minutesDifference / 60);\n\tconst daysDifference = Math.floor(hoursDifference / 24);\n\tconst monthsDifference = Math.floor(daysDifference / 30.44); // Average days in a month\n\tconst yearsDifference = Math.floor(monthsDifference / 12);\n\n\tif (yearsDifference > 0) {\n\t\treturn `${yearsDifference} year${yearsDifference > 1 ? 's' : ''} ago`;\n\t} else if (monthsDifference > 0) {\n\t\treturn `${monthsDifference} month${monthsDifference > 1 ? 's' : ''} ago`;\n\t} else if (daysDifference > 0) {\n\t\treturn `${daysDifference} day${daysDifference > 1 ? 's' : ''} ago`;\n\t} else if (hoursDifference > 0) {\n\t\treturn `${hoursDifference} hour${hoursDifference > 1 ? 's' : ''} ago`;\n\t} else if (minutesDifference > 0) {\n\t\treturn `${minutesDifference} minute${minutesDifference > 1 ? 's' : ''} ago`;\n\t} else {\n\t\treturn `${secondsDifference} second${secondsDifference !== 1 ? 's' : ''} ago`;\n\t}\n}\n\nexport function formatRequiredField(field: string) {\n\treturn `${field} *`;\n}\n\nexport function splitTagValue(tag: any) {\n\tlet parts = tag.split('-');\n\n\tlet lastPart = parts[parts.length - 1];\n\tif (!isNaN(lastPart)) {\n\t\tparts = parts.slice(0, -1).join(' ') + ': ' + lastPart;\n\t} else {\n\t\tparts = parts.join(' ');\n\t}\n\n\treturn parts;\n}\n\nexport function getTagDisplay(value: string) {\n\tlet result = value.replace(/([A-Z])/g, ' $1').trim();\n\tresult = result.charAt(0).toUpperCase() + result.slice(1);\n\treturn result;\n}\n\nexport function getDataURLContentType(dataURL: string) {\n\tconst result = dataURL.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+);base64,/);\n\treturn result ? result[1] : null;\n}\n\nexport function getBase64Data(dataURL: string) {\n\treturn dataURL.split(',')[1];\n}\n\nexport function getByteSize(input: string | Buffer): number {\n\tlet sizeInBytes: number;\n\tif (Buffer.isBuffer(input)) {\n\t\tsizeInBytes = input.length;\n\t} else if (typeof input === 'string') {\n\t\tsizeInBytes = Buffer.byteLength(input, 'utf-8');\n\t} else {\n\t\tthrow new Error('Input must be a string or a Buffer');\n\t}\n\n\treturn sizeInBytes;\n}\n\nexport function getTotalTokenBalance(tokenBalances: { profileBalance: number; walletBalance: number } | null) {\n\tif (!tokenBalances) return null;\n\tconst total = (tokenBalances.profileBalance || 0) + (tokenBalances.walletBalance || 0);\n\treturn total;\n}\n\nexport function isFirefox(): boolean {\n\treturn typeof InstallTrigger !== 'undefined';\n}\n\nexport function reverseDenomination(number: number) {\n\tlet count = 0;\n\n\twhile (number > 0 && number % 10 === 0) {\n\t\tcount++;\n\t\tnumber /= 10;\n\t}\n\n\treturn count;\n}\n\nexport function cleanProcessField(value: string) {\n\tlet updatedValue: string;\n\tupdatedValue = value.replace(/\\[|\\]/g, '');\n\treturn `[[${updatedValue}]]`;\n}\n\nexport function cleanTagValue(value: string) {\n\tlet updatedValue: string;\n\tupdatedValue = value.replace(/\\[|\\]/g, '');\n\treturn updatedValue;\n}\n\n/**\n * Extracts all values from a key-value store that match a given prefix\n * @param store The key-value store object to search\n * @param prefix The prefix to filter keys by (e.g., 'portal')\n * @returns Array of values whose keys match the prefix\n */\nexport function getStoreNamespace<T = any>(prefix: string, store: Record<string, T>): T[] {\n\tif (!store) return [];\n\n\tconst searchPrefix = `${prefix}:`;\n\treturn Object.keys(store)\n\t\t.filter((key) => key.startsWith(searchPrefix))\n\t\t.map((key) => store[key]) as any;\n}\n\nexport function buildStoreNamespace(prefix: string, value: string) {\n\treturn `${prefix}:${value.toLowerCase().replace(/\\s+/g, '-')}`;\n}\n\nexport const globalLog = (...args: any[]) => {\n\tconsole.log('[@permaweb/libs]', ...args);\n};\n\nfunction toProcessCase(str: string): string {\n\treturn str.replace(/^[a-z]/, (match) => match.toUpperCase());\n}\n\n/* Maps an object from camel case to pascal case */\nexport function mapToProcessCase(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(mapToProcessCase);\n\t} else if (obj && typeof obj === 'object') {\n\t\treturn Object.entries(obj).reduce((acc: any, [key, value]) => {\n\t\t\tconst toKey = toProcessCase(key);\n\t\t\tacc[toKey] = checkValidAddress(value as any) ? value : mapToProcessCase(value);\n\t\t\treturn acc;\n\t\t}, {});\n\t}\n\treturn obj;\n}\n\nfunction fromProcessCase(str: string) {\n\treturn str.charAt(0).toLowerCase() + str.slice(1);\n}\n\n/* Maps an object from pascal case to camel case */\nexport function mapFromProcessCase(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(mapFromProcessCase);\n\t} else if (obj && typeof obj === 'object') {\n\t\treturn Object.entries(obj).reduce((acc: any, [key, value]) => {\n\t\t\tconst fromKey = fromProcessCase(key);\n\t\t\tacc[fromKey] = checkValidAddress(value as any) ? value : mapFromProcessCase(value);\n\t\t\treturn acc;\n\t\t}, {});\n\t}\n\treturn obj;\n}\n\nexport function getBootTag(key: string, value: string) {\n\tconst capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);\n\treturn { name: `${TAGS.keys.bootloader}-${capitalizedKey}`, value };\n}", "import { GATEWAYS } from '../helpers/config.ts';\nimport {\n\tBatchAGQLResponseType,\n\tBatchGQLArgsType,\n\tDefaultGQLResponseType,\n\tGQLArgsType,\n\tGQLNodeResponseType,\n\tQueryBodyGQLArgsType,\n} from '../helpers/types.ts';\n\nconst CURSORS = {\n\tp1: 'P1',\n\tend: 'END',\n};\n\nconst PAGINATORS = {\n\tdefault: 100,\n};\n\nexport async function getGQLData(args: GQLArgsType): Promise<DefaultGQLResponseType> {\n\tconst paginator = args.paginator ? args.paginator : PAGINATORS.default;\n\tlet data: GQLNodeResponseType[] = [];\n\tlet count: number = 0;\n\tlet nextCursor: string | null = null;\n\n\tif (args.ids && !args.ids.length) {\n\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t}\n\n\ttry {\n\t\tlet queryBody: string = getQueryBody(args);\n\t\tconst response = await getResponse({ gateway: args.gateway ?? GATEWAYS.goldsky, query: getQuery(queryBody) });\n\n\t\tif (response?.data?.transactions?.edges?.length) {\n\t\t\tdata = [...response.data.transactions.edges];\n\t\t\tcount = response.data.transactions.count ?? 0;\n\n\t\t\tconst lastResults: boolean = data.length < paginator || !response.data.transactions.pageInfo.hasNextPage;\n\n\t\t\tif (lastResults) nextCursor = CURSORS.end;\n\t\t\telse nextCursor = data[data.length - 1].cursor;\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\tcount: count,\n\t\t\t\tnextCursor: nextCursor,\n\t\t\t\tpreviousCursor: null,\n\t\t\t};\n\t\t} else {\n\t\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t\t}\n\t} catch (e: any) {\n\t\tconsole.error(e);\n\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t}\n}\n\nexport async function getAggregatedGQLData(args: GQLArgsType, callback?: (message: string) => void) { // , processElementCallback: (element: GQLNodeResponseType) => void\n\tlet index = 1;\n\tlet fetchResult = await getGQLData(args);\n\n\tif (fetchResult && fetchResult.data.length) {\n\t\tlet aggregatedData = fetchResult.data;\n\t\tcallback && callback(`Count: ${fetchResult.count}`);\n\t\tcallback && callback(`Pages to fetch: ${Math.ceil(fetchResult.count / (args.paginator ?? PAGINATORS.default))}`);\n\t\tcallback && callback(`Page ${index} fetched`);\n\n\t\twhile (fetchResult.nextCursor && fetchResult.nextCursor !== CURSORS.end) {\n\t\t\tindex += 1;\n\t\t\tcallback && callback(`Fetching page ${index}...`);\n\n\t\t\tfetchResult = await getGQLData({\n\t\t\t\t...args,\n\t\t\t\tcursor: fetchResult.nextCursor,\n\t\t\t});\n\n\t\t\tif (fetchResult && fetchResult.data.length) {\n\t\t\t\taggregatedData = aggregatedData.concat(fetchResult.data);\n\t\t\t}\n\t\t}\n\n\t\tcallback && callback(`All pages fetched!`);\n\t\treturn aggregatedData;\n\t}\n\telse {\n\t\tcallback && callback('No data found');\n\t}\n\n\treturn null;\n}\n\nexport async function getBatchGQLData(args: BatchGQLArgsType): Promise<BatchAGQLResponseType> {\n\tlet responseObject: BatchAGQLResponseType = {};\n\tlet queryBody: string = '';\n\n\tfor (const [queryKey, baseArgs] of Object.entries(args.entries)) {\n\t\tresponseObject[queryKey] = { data: [], count: 0, nextCursor: null, previousCursor: null };\n\t\tqueryBody += getQueryBody({ ...baseArgs, gateway: args.gateway ?? GATEWAYS.goldsky, queryKey: queryKey });\n\t}\n\n\ttry {\n\t\tconst response = await getResponse({ gateway: args.gateway ?? GATEWAYS.goldsky, query: getQuery(queryBody) });\n\n\t\tif (response && response.data) {\n\t\t\tfor (const queryKey of Object.keys(response.data)) {\n\t\t\t\tconst paginator = args.entries[queryKey].paginator ? args.entries[queryKey].paginator : PAGINATORS.default;\n\n\t\t\t\tlet data: GQLNodeResponseType[] = [];\n\t\t\t\tlet count: number = 0;\n\t\t\t\tlet nextCursor: string | null = null;\n\n\t\t\t\tif (response.data[queryKey].edges.length) {\n\t\t\t\t\tdata = [...response.data[queryKey].edges];\n\t\t\t\t\tcount = response.data[queryKey].count ?? 0;\n\n\t\t\t\t\tconst lastResults: boolean = data.length < paginator || !response.data[queryKey].pageInfo.hasNextPage;\n\n\t\t\t\t\tif (lastResults) nextCursor = CURSORS.end;\n\t\t\t\t\telse nextCursor = data[data.length - 1].cursor;\n\n\t\t\t\t\tresponseObject[queryKey] = {\n\t\t\t\t\t\tdata: [...response.data[queryKey].edges],\n\t\t\t\t\t\tcount: count,\n\t\t\t\t\t\tnextCursor: nextCursor,\n\t\t\t\t\t\tpreviousCursor: null,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn responseObject;\n\t} catch (e: any) {\n\t\tconsole.error(e);\n\t\treturn responseObject;\n\t}\n}\n\nfunction getQuery(body: string): string {\n\tconst query = { query: `query { ${body} }` };\n\treturn JSON.stringify(query);\n}\n\nfunction getQueryBody(args: QueryBodyGQLArgsType): string {\n\tconst paginator = args.paginator ? args.paginator : PAGINATORS.default;\n\tconst ids = args.ids ? JSON.stringify(args.ids) : null;\n\tlet blockFilter: { min?: number; max?: number } | null = null;\n\tif (args.minBlock !== undefined && args.minBlock !== null) {\n\t\tblockFilter = {};\n\t\tblockFilter.min = args.minBlock;\n\t}\n\tconst blockFilterStr = blockFilter ? JSON.stringify(blockFilter).replace(/\"([^\"]+)\":/g, '$1:') : null;\n\tconst tags = args.tags\n\t\t? JSON.stringify(args.tags)\n\t\t\t\t.replace(/\"(name)\":/g, '$1:')\n\t\t\t\t.replace(/\"(values)\":/g, '$1:')\n\t\t\t\t.replace(/\"match\"/g, 'match')\n\t\t\t\t.replace(/\"FUZZY_OR\"/g, 'FUZZY_OR')\n\t\t: null;\n\tconst owners = args.owners ? JSON.stringify(args.owners) : null;\n\tconst recipients = args.recipients ? JSON.stringify(args.recipients) : null;\n\tconst cursor = args.cursor && args.cursor !== CURSORS.end ? `\"${args.cursor}\"` : null;\n\n\tlet fetchCount: string = `first: ${paginator}`;\n\tlet txCount: string = '';\n\tlet nodeFields: string = `data { size type } owner { address } block { height timestamp }`;\n\tlet order: string = '';\n\tlet recipientsfield: string = ''\n\n\tconst gateway = args.gateway ?? GATEWAYS.goldsky;\n\tswitch (gateway) {\n\t\tcase GATEWAYS.arweave:\n\t\t\tbreak;\n\t\tcase GATEWAYS.goldsky:\n\t\t\tif (!cursor) txCount = `count`;\n\t\t\tif (recipients) recipientsfield = `recipients: ${recipients}`;\n\t\t\tnodeFields += ` recipient`\n\t\t\tbreak;\n\t}\n\n\tlet body = `\n\t\ttransactions(\n\t\t\t\tids: ${ids},\n\t\t\t\ttags: ${tags},\n\t\t\t\t${fetchCount}\n\t\t\t\towners: ${owners},\n\t\t\t\t${recipientsfield},\n\t\t\t\tblock: ${blockFilterStr},\n\t\t\t\tafter: ${cursor},\n\t\t\t\t${order}\n\t\t\t){\n\t\t\t${txCount}\n\t\t\t\tpageInfo {\n\t\t\t\t\thasNextPage\n\t\t\t\t}\n\t\t\t\tedges {\n\t\t\t\t\tcursor\n\t\t\t\t\tnode {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttags {\n\t\t\t\t\t\t\tname \n\t\t\t\t\t\t\tvalue \n\t\t\t\t\t\t}\n\t\t\t\t\t\t${nodeFields}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}`;\n\n\tif (args.queryKey) body = `${args.queryKey}: ${body}`;\n\n\treturn body;\n}\n\nasync function getResponse(args: { gateway: string; query: string }): Promise<any> {\n\ttry {\n\t\tconst response = await fetch(`https://${args.gateway}/graphql`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: args.query,\n\t\t});\n\t\treturn await response.json();\n\t} catch (e: any) {\n\t\tthrow e;\n\t}\n}\n", "\nimport { ReadableStream } from 'web-streams-polyfill';\n/* Used for build - Do not remove ! */\nimport Arweave from 'arweave';\n\n// import { ArweaveWebARx } from '@permaweb/arx/web/tokens/arweave';\n// import { ArconnectSigner, TurboFactory } from '@ardrive/turbo-sdk/web';\nimport { TAGS, UPLOAD } from '../helpers/config.ts';\nimport { DependencyType, TagType } from '../helpers/types.ts';\nimport { checkValidAddress, getBase64Data, getByteSize, getDataURLContentType, globalLog } from '../helpers/utils.ts';\n\n// TurboFactory.setLogLevel('debug')\n\nexport function resolveTransactionWith(deps: DependencyType) {\n\treturn async (data: any) => {\n\t\tif (checkValidAddress(data)) return data;\n\t\tif (!deps.arweave) throw new Error(`Must initialize with Arweave in order to create transactions`);\n\t\ttry {\n\t\t\treturn await createTransaction(deps, { data: data });\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error resolving transaction');\n\t\t}\n\t};\n}\n\nexport async function resolveTransaction(deps: DependencyType, data: any) {\n\tif (checkValidAddress(data)) return data;\n\tif (!deps.arweave) throw new Error(`Must initialize with Arweave in order to create transactions`);\n\ttry {\n\t\treturn await createTransaction(deps, { data: data });\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error resolving transaction');\n\t}\n}\n\nexport async function createTransaction(\n\tdeps: DependencyType,\n\targs: {\n\t\tdata: File | string;\n\t\ttags?: TagType[];\n\t},\n): Promise<string> {\n\tlet content: any = null;\n\tlet contentType: string | null = null;\n\tlet contentSize: number | null = null;\n\n\tif (typeof args.data === 'string') {\n\t\tcontent = Buffer.from(getBase64Data(args.data), 'base64');\n\t\tcontentType = getDataURLContentType(args.data);\n\t\tcontentSize = getByteSize(content);\n\t}\n\n\tif (args.data instanceof File) {\n\t\tcontent = new Uint8Array(await args.data.arrayBuffer());\n\t\tcontentType = args.data.type;\n\t\tcontentSize = args.data.size;\n\t}\n\n\tif (content && contentType && contentSize) {\n\t\tif (contentSize < Number(UPLOAD.dispatchUploadSize)) {\n\t\t\ttry {\n\t\t\t\tconst tx = await deps.arweave.createTransaction({ data: content }, 'use_wallet');\n\t\t\t\ttx.addTag(TAGS.keys.contentType, contentType);\n\t\t\t\tif (args.tags && args.tags.length > 0) args.tags.forEach((tag: TagType) => tx.addTag(tag.name, tag.value));\n\n\t\t\t\tconst response = await global.window.arweaveWallet.dispatch(tx);\n\t\t\t\treturn response.id;\n\t\t\t}\n\t\t\tcatch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error dispatching transaction');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('Paid uploads are not yet supported');\n\t\t\t\n\t\t\t// const arx = new ArweaveWebARx({ url: UPLOAD.node1, wallet: { provider: window.arweaveWallet } });\n\n\t\t\t// await arx.ready();\n\n\t\t\t// console.log(arx)\n\n\t\t\t// let uploader = arx.uploader.chunkedUploader;\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// uploader.setBatchSize(UPLOAD.batchSize);\n\t\t\t// uploader.setChunkSize(UPLOAD.chunkSize);\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// uploader.on('chunkUpload', (chunkInfo) => {\n\t\t\t// \t// setUploadPercentage(Math.floor((chunkInfo.totalUploaded / uploadReducer.data.content.size) * 100));\n\t\t\t// \tconsole.log('---')\n\t\t\t// });\n\n\t\t\t// uploader.on('chunkError', (e) => {\n\t\t\t// \tconsole.error(e);\n\t\t\t// });\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// const buffer = await fileToBuffer(uploadReducer.data.content);\n\t\t\t// const txResponse = await uploader.uploadData(content, { tags: [{ name: TAGS.keys.contentType, value: contentType }] });\n\n\t\t\t// console.log(txResponse)\n\n\t\t\t// try {\n\t\t\t// \tconst signer = new ArconnectSigner(window.arweaveWallet);\n\t\t\t// \tconst turbo = TurboFactory.authenticated({ signer });\n\n\t\t\t// \tconst response = await turbo.uploadFile({\n\t\t\t// \t\tfileStreamFactory: () =>\n\t\t\t// \t\t\tnew ReadableStream({\n\t\t\t// \t\t\t\tstart(controller) {\n\t\t\t// \t\t\t\t\tcontroller.enqueue(content);\n\t\t\t// \t\t\t\t\tcontroller.close();\n\t\t\t// \t\t\t\t},\n\t\t\t// \t\t\t}),\n\t\t\t// \t\tfileSizeFactory: () => contentSize,\n\t\t\t// \t\tdataItemOpts: {\n\t\t\t// \t\t\ttags: [{ name: TAGS.keys.contentType, value: contentType }]\n\t\t\t// \t\t},\n\t\t\t// \t});\n\t\t\t// \treturn response.id;\n\t\t\t// }\n\t\t\t// catch (e: any) {\n\t\t\t// \tthrow new Error(e.message ?? 'Error bundling transaction');\n\t\t\t// }\n\t\t}\n\t} else {\n\t\tthrow new Error('Error preparing transaction data');\n\t}\n}\n", "export * from './config.ts';\nexport * from './endpoints.ts';\nexport * from './types.ts';\nexport * from './utils.ts';\n", "export type DependencyType = {\n\tao: any;\n\tsigner?: any;\n\tarweave?: any;\n};\n\nexport type ProcessSpawnType = {\n\tmodule: string;\n\tscheduler: string;\n\tdata: any;\n\ttags: TagType[];\n\twallet: any;\n};\n\nexport type ProcessCreateType = {\n\tmodule?: string;\n\tscheduler?: string;\n\tdata?: any;\n\ttags?: TagType[];\n\tevalTags?: TagType[];\n\tevalTxId?: string;\n\tevalSrc?: string;\n};\n\nexport type MessageSendType = {\n\tprocessId: string;\n\taction: string;\n\ttags?: TagType[] | null;\n\tdata?: any;\n\tuseRawData?: boolean;\n};\n\nexport type MessageResultType = {\n\tmessageId: string;\n\tprocessId: string;\n\taction: string;\n};\n\nexport type MessageDryRunType = {\n\tprocessId: string;\n\taction: string;\n\ttags?: TagType[] | null;\n\tdata?: string | object;\n};\n\nexport type ZoneType = { store: any; assets: ZoneAssetType[] };\n\nexport type ZoneAssetType = { id: string; balance: string; dateCreated: number; lastUpdate: number };\n\nexport type ProfileArgsType = {\n\tusername: string;\n\tdisplayName: string;\n\tdescription: string;\n\tthumbnail?: any;\n\tbanner?: any;\n};\n\nexport type ProfileType = {\n\tid: string;\n\twalletAddress: string;\n\tusername: string;\n\tdisplayName: string;\n\tdescription: string;\n\tthumbnail?: any;\n\tbanner?: any;\n\tassets: { id: string; quantity: string }[];\n} & any;\n\nexport type AssetCreateArgsType = {\n\tname: string;\n\tdescription: string;\n\ttopics: string[];\n\tcreator: string;\n\tdata: any;\n\tcontentType: string;\n\tassetType: string;\n\tsupply?: number;\n\tdenomination?: number;\n\ttransferable?: boolean;\n\tmetadata?: object;\t\n\ttags?: TagType[];\n\tsrc?: string;\n};\n\nexport type AssetHeaderType = {\n\tid: string;\n\towner: string | null\n};\n\nexport type AssetDetailType = {\n\tid: string;\n\tname: string;\n\tticker: string;\n\tdenomination: string;\n\ttotalSupply: string;\n\ttransferable: string;\n\tcreator: string;\n\tbalances: object;\n\tmetadata: any;\n\tdateCreated: string;\n\tlastUpdate: string;\n}\n\nexport type CommentHeaderType = {\n\tid: string; \n\tcontent: string;\n\tparentId: string; \n\trootId: string\n};\n\nexport type CommentDetailType = {\n\tcontent: string;\n\tparentId: string;\n\trootId: string;\n}\n\nexport type CommentCreateArgType = { content: string; creator: string; parentId: string; rootId?: string, tags?: TagType[] };\n\nexport type CollectionManifestType = {\n\ttype: string;\n\titems: string[];\n};\n\nexport type CollectionType = {\n\tid: string;\n\ttitle: string;\n\tdescription: string | null;\n\tcreator: string;\n\tdateCreated: string;\n\tbanner: string | null;\n\tthumbnail: string | null;\n};\n\nexport type CollectionDetailType = CollectionType & {\n\tassetIds: string[];\n};\n\nexport type UDLicenseType = {\n\taccess: UDLicenseValueType | null;\n\tderivations: UDLicenseValueType | null;\n\tcommercialUse: UDLicenseValueType | null;\n\tdataModelTraining: UDLicenseValueType | null;\n\tpaymentMode: string | null;\n\tpaymentAddress: string | null;\n\tcurrency: string | null;\n};\n\nexport type UDLicenseValueType = {\n\tvalue: string | null;\n\ticon?: string;\n\tendText?: string;\n};\n\nexport type BaseGQLArgsType = {\n\tids?: string[] | null;\n\ttags?: TagFilterType[] | null;\n\towners?: string[] | null;\n\trecipients?: string[] | null;\n\tcursor?: string | null;\n\tpaginator?: number;\n\tminBlock?: number;\n\tmaxBlock?: number;\n};\n\nexport type GQLArgsType = { gateway: string } & BaseGQLArgsType;\n\nexport type QueryBodyGQLArgsType = BaseGQLArgsType & { gateway?: string; queryKey?: string };\n\nexport type BatchGQLArgsType = {\n\tgateway: string;\n\tentries: { [queryKey: string]: BaseGQLArgsType };\n};\n\nexport type GQLNodeResponseType = {\n\tcursor: string | null;\n\tnode: {\n\t\tid: string;\n\t\ttags: TagType[];\n\t\trecipient?: string;\n\t\tdata: {\n\t\t\tsize: string;\n\t\t\ttype: string;\n\t\t};\n\t\towner: {\n\t\t\taddress: string;\n\t\t};\n\t\tblock: {\n\t\t\theight: number;\n\t\t\ttimestamp: number;\n\t\t};\n\t};\n};\n\nexport type GQLResponseType = {\n\tcount: number;\n\tnextCursor: string | null;\n\tpreviousCursor: string | null;\n};\n\nexport type DefaultGQLResponseType = {\n\tdata: GQLNodeResponseType[];\n} & GQLResponseType;\n\nexport type BatchAGQLResponseType = { [queryKey: string]: DefaultGQLResponseType };\n\nexport type TagType = { name: string; value: string };\n\nexport type TagFilterType = { name: string; values: string[]; match?: string };\n", "export * from './assets.ts';\nexport * from './collections.ts';\nexport * from './comments.ts';\nexport * from './profiles.ts';\nexport * from './zones.ts';\n", "import { aoCreateProcess, aoDryRun, readProcess } from '../common/ao.ts';\nimport { getGQLData } from '../common/gql.ts';\nimport { AO, CONTENT_TYPES, GATEWAYS, TAGS } from '../helpers/config.ts';\nimport {\n\tAssetCreateArgsType,\n\tAssetDetailType,\n\tAssetHeaderType,\n\tDependencyType,\n\tGQLNodeResponseType,\n\tTagType\n} from '../helpers/types.ts';\nimport { getBootTag, mapFromProcessCase, mapToProcessCase } from '../helpers/utils.ts';\n\nexport function createAtomicAssetWith(deps: DependencyType) {\n\treturn async (args: AssetCreateArgsType, callback?: (status: any) => void) => {\n\t\tconst validationError = getValidationErrorMessage(args);\n\t\tif (validationError) throw new Error(validationError);\n\n\t\tconst data = CONTENT_TYPES[args.contentType]?.serialize(args.data) ?? args.data;\n\t\tconst tags = buildAssetCreateTags(args);\n\n\t\ttry {\n\t\t\tconst assetId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ tags: tags, data: data },\n\t\t\t\tcallback ? (status: any) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\treturn assetId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating asset');\n\t\t}\n\t};\n}\n\nexport async function getAtomicAsset(\n\tdeps: DependencyType,\n\tid: string,\n\targs?: { useGateway?: boolean }\n): Promise<AssetDetailType | null> {\n\ttry {\n\t\tconst processInfo = mapFromProcessCase(await readProcess(deps, {\n\t\t\tprocessId: id,\n\t\t\tpath: 'asset',\n\t\t\tfallbackAction: 'Info',\n\t\t}));\n\n\t\tif (args?.useGateway) {\n\t\t\tconst gqlResponse = await getGQLData({\n\t\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\t\tids: [id],\n\t\t\t\ttags: null,\n\t\t\t\towners: null,\n\t\t\t\tcursor: null,\n\t\t\t});\n\n\t\t\tconst gatewayAsset = gqlResponse?.data?.[0]\n\t\t\t\t? buildAsset(gqlResponse.data[0])\n\t\t\t\t: {};\n\t\t\t\n\t\t\treturn {\n\t\t\t\t...gatewayAsset,\n\t\t\t\t...processInfo,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tid: id,\n\t\t\t...processInfo\n\t\t}\n\t} catch (e: any) {\n\t\tthrow new Error(e.message || 'Error fetching atomic asset');\n\t}\n}\n\nexport function getAtomicAssetWith(deps: DependencyType) {\n\treturn async (id: string, args?: { useGateway?: boolean }): Promise<AssetDetailType | null> => {\n\t\treturn await getAtomicAsset(deps, id, args);\n\t};\n}\n\nexport async function getAtomicAssets(ids: string[]): Promise<AssetHeaderType[] | null> {\n\ttry {\n\t\tconst gqlResponse = await getGQLData({\n\t\t\tgateway: GATEWAYS.arweave,\n\t\t\tids: ids ?? null,\n\t\t\ttags: null,\n\t\t\towners: null,\n\t\t\tcursor: null,\n\t\t});\n\n\t\tif (gqlResponse && gqlResponse.data.length) {\n\t\t\treturn gqlResponse.data.map((element: GQLNodeResponseType) => buildAsset(element));\n\t\t}\n\n\t\treturn null;\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\nexport function buildAsset(element: GQLNodeResponseType): any {\n\tconst asset: any = { id: element.node.id, owner: element.node.owner.address };\n\n\tfor (const tag of element.node.tags) {\n\t\tconst originalKey = tag.name;\n\n\t\tconst keyWithoutPrefix = originalKey.startsWith(`${TAGS.keys.bootloader}-`)\n\t\t\t? originalKey.slice(`${TAGS.keys.bootloader}-`.length)\n\t\t\t: originalKey;\n\n\t\tconst formattedKey = keyWithoutPrefix\n\t\t\t.split('-')\n\t\t\t.map((part, index) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? part.toLowerCase()\n\t\t\t\t\t: part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()\n\t\t\t)\n\t\t\t.join('');\n\n\t\tlet decodedValue;\n\t\ttry {\n\t\t\tdecodedValue = JSON.parse(tag.value);\n\t\t} catch {\n\t\t\tdecodedValue = tag.value.toString();\n\t\t}\n\n\t\tasset[formattedKey] = decodedValue;\n\t}\n\n\treturn asset;\n}\n\nfunction buildAssetCreateTags(args: AssetCreateArgsType): { name: string; value: string }[] {\n\tconst tags = [\n\t\t{ name: TAGS.keys.bootloaderInit, value: args.src ?? AO.src.asset },\n\t\t{ name: TAGS.keys.creator, value: args.creator },\n\t\t{ name: TAGS.keys.assetType, value: args.assetType },\n\t\t{ name: TAGS.keys.contentType, value: args.contentType },\n\t\t{ name: TAGS.keys.implements, value: 'ANS-110' },\n\t\t{ name: TAGS.keys.dateCreated, value: new Date().getTime().toString() },\n\t\tgetBootTag('Name', args.name),\n\t\tgetBootTag('Description', args.description),\n\t\tgetBootTag('Topics', JSON.stringify(args.topics)),\n\t\tgetBootTag('Ticker', 'ATOMIC'),\n\t\tgetBootTag('Denomination', args.denomination?.toString() ?? '1'),\n\t\tgetBootTag('TotalSupply', args.supply?.toString() ?? '1'),\n\t\tgetBootTag('Transferable', args.transferable?.toString() ?? 'true'),\n\t\tgetBootTag('Creator', args.creator),\n\t];\n\n\tif (args.metadata) {\n\t\tfor (const entry in args.metadata) {\n\t\t\ttags.push(getBootTag(mapToProcessCase(entry), (args.metadata as any)[entry].toString()));\n\t\t}\n\t}\n\n\tif (args.tags) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\treturn tags;\n}\n\nfunction getValidationErrorMessage(args: AssetCreateArgsType): string | null {\n\tif (typeof args !== 'object' || args === null) return 'The provided arguments are invalid or empty.';\n\n\tconst requiredFields = ['name', 'description', 'topics', 'creator', 'data', 'contentType', 'assetType'];\n\tfor (const field of requiredFields) {\n\t\tif (!(field in args)) return `Missing field '${field}'`;\n\t}\n\n\tif (typeof args.name !== 'string' || args.name.trim() === '') return 'Name is required';\n\tif (typeof args.description !== 'string') return 'The description must be a valid string';\n\tif (!Array.isArray(args.topics) || args.topics.length === 0) return 'Topics are required';\n\tif (typeof args.creator !== 'string' || args.creator.trim() === '') return 'Creator is required';\n\tif (args.data === undefined || args.data === null) return 'Data field is required';\n\tif (typeof args.contentType !== 'string' || args.contentType.trim() === '')\n\t\treturn 'Content type must be a non-empty string';\n\tif (typeof args.assetType !== 'string' || args.assetType.trim() === '') return 'Type must be a non-empty string';\n\n\tif ('supply' in args && (typeof args.supply !== 'number' || args.supply <= 0))\n\t\treturn 'Supply must be a positive number';\n\tif ('denomination' in args && (typeof args.denomination !== 'number' || args.denomination <= 0))\n\t\treturn 'Denomination must be a positive number';\n\tif ('transferable' in args && typeof args.transferable !== 'boolean') return 'Transferable must be a boolean value';\n\tif ('metadata' in args && typeof args.metadata !== 'object') return 'Metadata must be an object';\n\tif ('tags' in args && (!Array.isArray(args.tags) || args.tags.some((tag) => typeof tag !== 'object')))\n\t\treturn 'Tags must be an array of objects';\n\tif ('src' in args && typeof args.src !== 'string') return 'Source must be a valid string';\n\n\treturn null;\n}\n", "import { aoCreateProcess, aoDryRun, aoSend } from '../common/ao.ts';\nimport { resolveTransaction } from '../common/arweave.ts';\nimport { AO, TAGS } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport { CollectionDetailType, CollectionType, DependencyType, TagType } from '../helpers/types.ts';\nimport { cleanProcessField, cleanTagValue, globalLog } from '../helpers/utils.ts';\n\nconst DEFAULT_COLLECTION_BANNER = 'eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo';\nconst DEFAULT_COLLECTION_THUMBNAIL = 'lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk';\n\nexport function createCollectionWith(deps: DependencyType) {\n\treturn async (args: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tcreator: string;\n\t\tthumbnail: any;\n\t\tbanner: any;\n\t\tskipRegistry?: boolean;\n\t\tskipActivity?: boolean;\n\t}, callback?: (status: any) => void) => {\n\t\tif (!deps.signer) throw new Error(`No signer provided`);\n\n\t\tconst dateTime = new Date().getTime().toString();\n\t\tconst tags: TagType[] = [\n\t\t\t{ name: TAGS.keys.contentType, value: 'application/json' },\n\t\t\t{ name: TAGS.keys.creator, value: args.creator },\n\t\t\t{\n\t\t\t\tname: TAGS.keys.ans110.title,\n\t\t\t\tvalue: cleanTagValue(args.title),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: TAGS.keys.ans110.description,\n\t\t\t\tvalue: cleanTagValue(args.description),\n\t\t\t},\n\t\t\t{ name: TAGS.keys.dateCreated, value: dateTime },\n\t\t\t{\n\t\t\t\tname: TAGS.keys.name,\n\t\t\t\tvalue: cleanTagValue(args.title),\n\t\t\t},\n\t\t\t{ name: 'Action', value: 'Add-Collection' },\n\t\t];\n\n\t\tlet thumbnailTx = null;\n\t\tlet bannerTx = null;\n\n\t\ttry {\n\t\t\tthumbnailTx = args.banner ? await resolveTransaction(deps, args.thumbnail) : DEFAULT_COLLECTION_THUMBNAIL;\n\t\t\tbannerTx = args.banner ? await resolveTransaction(deps, args.banner) : DEFAULT_COLLECTION_BANNER;\n\n\t\t\tif (args.thumbnail)\n\t\t\t\ttags.push({\n\t\t\t\t\tname: TAGS.keys.thumbnail,\n\t\t\t\t\tvalue: thumbnailTx,\n\t\t\t\t});\n\n\t\t\tif (args.banner)\n\t\t\t\ttags.push({\n\t\t\t\t\tname: TAGS.keys.banner,\n\t\t\t\t\tvalue: bannerTx,\n\t\t\t\t});\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tconsole.error(e);\n\t\t}\n\n\t\tconst processSrcFetch = await fetch(getTxEndpoint(AO.src.collection));\n\t\tif (!processSrcFetch.ok) throw new Error(`Unable to fetch process src`);\n\n\t\tlet processSrc = await processSrcFetch.text();\n\n\t\tprocessSrc = processSrc.replace(/'<NAME>'/g, cleanProcessField(args.title));\n\t\tprocessSrc = processSrc.replace(/'<DESCRIPTION>'/g, cleanProcessField(args.description));\n\t\tprocessSrc = processSrc.replace(/<CREATOR>/g, args.creator);\n\t\tprocessSrc = processSrc.replace(/<THUMBNAIL>/g, thumbnailTx ? thumbnailTx : DEFAULT_COLLECTION_THUMBNAIL);\n\t\tprocessSrc = processSrc.replace(/<BANNER>/g, bannerTx ? bannerTx : DEFAULT_COLLECTION_THUMBNAIL);\n\t\tprocessSrc = processSrc.replace(/<DATECREATED>/g, dateTime);\n\t\tprocessSrc = processSrc.replace(/<LASTUPDATE>/g, dateTime);\n\n\t\ttry {\n\t\t\tconst collectionId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ tags: tags },\n\t\t\t\tcallback ? (status) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\tglobalLog('Sending eval message to collection...');\n\t\t\tif (callback) callback('Sending eval message to collection...');\n\t\t\tawait deps.ao.message({\n\t\t\t\tprocess: collectionId,\n\t\t\t\tsigner: deps.signer,\n\t\t\t\ttags: [{ name: 'Action', value: 'Eval' }],\n\t\t\t\tdata: processSrc,\n\t\t\t});\n\n\t\t\tif (!args.skipRegistry) {\n\t\t\t\tglobalLog('Sending collection to registry...');\n\t\t\t\tif (callback) callback('Sending collection to registry...');\n\n\t\t\t\tconst registryTags = [\n\t\t\t\t\t{ name: 'Action', value: 'Add-Collection' },\n\t\t\t\t\t{ name: 'CollectionId', value: collectionId },\n\t\t\t\t\t{ name: 'Name', value: cleanTagValue(args.title) },\n\t\t\t\t\t{ name: 'Creator', value: args.creator },\n\t\t\t\t\t{ name: 'DateCreated', value: dateTime },\n\t\t\t\t];\n\t\n\t\t\t\tif (bannerTx) registryTags.push({ name: 'Banner', value: bannerTx });\n\t\t\t\tif (thumbnailTx) registryTags.push({ name: 'Thumbnail', value: thumbnailTx });\n\n\t\t\t\tawait deps.ao.message({\n\t\t\t\t\tprocess: AO.collectionRegistry,\n\t\t\t\t\tsigner: deps.signer,\n\t\t\t\t\ttags: registryTags,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!args.skipActivity) {\n\t\t\t\tglobalLog('Creating collection activity process...');\n\t\t\t\tif (callback) callback('Creating collection activity process...');\n\t\t\t\t\n\t\t\t\tconst activityTags = [\n\t\t\t\t\t{ name: 'CollectionId', value: collectionId },\n\t\t\t\t\t{ name: 'DateCreated', value: dateTime },\n\t\t\t\t\t{ name: 'On-Boot', value: AO.src.collectionActivity },\n\t\t\t\t];\n\t\t\t\t\n\t\t\t\tconst collectionActivityId = await aoCreateProcess(\n\t\t\t\t\tdeps,\n\t\t\t\t\t{ tags: activityTags },\n\t\t\t\t\tcallback ? (status) => callback(status) : undefined,\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\tglobalLog('Adding activity to collection process...');\n\t\t\t\tif (callback) callback('Adding activity to collection process...');\n\t\t\t\tawait deps.ao.message({\n\t\t\t\t\tprocess: collectionId,\n\t\t\t\t\tsigner: deps.signer,\n\t\t\t\t\ttags: [{ name: 'Action', value: 'Eval' }],\n\t\t\t\t\tdata: `ActivityProcess = '${collectionActivityId}'`,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn collectionId;\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating collection')\n\t\t}\n\t};\n}\n\nexport function updateCollectionAssetsWith(deps: DependencyType) {\n\treturn async (args: { collectionId: string; assetIds: string[]; creator: string; updateType: 'Add' | 'Remove' }): Promise<string> => {\n\t\treturn await aoSend(deps, {\n\t\t\tprocessId: args.creator,\n\t\t\taction: 'Run-Action',\n\t\t\ttags: [\n\t\t\t\t{ name: 'ForwardTo', value: args.collectionId },\n\t\t\t\t{ name: 'ForwardAction', value: 'Update-Assets' }\n\t\t\t],\n\t\t\tdata: {\n\t\t\t\tTarget: args.collectionId,\n\t\t\t\tAction: 'Update-Assets',\n\t\t\t\tInput: JSON.stringify({\n\t\t\t\t\tAssetIds: args.assetIds,\n\t\t\t\t\tUpdateType: args.updateType,\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t};\n}\n\nexport function getCollectionWith(deps: DependencyType) {\n\treturn async (collectionId: string): Promise<CollectionDetailType | null> => {\n\t\tconst response = await aoDryRun(deps, {\n\t\t\tprocessId: collectionId,\n\t\t\taction: 'Info',\n\t\t});\n\n\t\tconst collection = {\n\t\t\tid: collectionId,\n\t\t\ttitle: response.Name,\n\t\t\tdescription: response.Description,\n\t\t\tcreator: response.Creator,\n\t\t\tdateCreated: response.DateCreated,\n\t\t\tthumbnail: response.Thumbnail ?? DEFAULT_COLLECTION_THUMBNAIL,\n\t\t\tbanner: response.Banner ?? DEFAULT_COLLECTION_THUMBNAIL,\n\t\t};\n\n\t\treturn {\n\t\t\t...collection,\n\t\t\tassetIds: response.Assets,\n\t\t};\n\t};\n}\n\nexport function getCollectionsWith(deps: DependencyType) {\n\treturn async (args: { creator?: string }): Promise<CollectionType[] | null> => {\n\t\tconst action = args.creator ? 'Get-Collections-By-User' : 'Get-Collections';\n\n\t\tconst response = await aoDryRun(deps, {\n\t\t\tprocessId: AO.collectionRegistry,\n\t\t\taction: action,\n\t\t\ttags: args.creator ? [{ name: 'Creator', value: args.creator }] : null,\n\t\t});\n\n\t\tif (response && response.Collections && response.Collections.length) {\n\t\t\tconst collections = response.Collections.map((collection: any) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: collection.Id,\n\t\t\t\t\ttitle: collection.Name.replace(/\\[|\\]/g, ''),\n\t\t\t\t\tdescription: collection.Description,\n\t\t\t\t\tcreator: collection.Creator,\n\t\t\t\t\tdateCreated: collection.DateCreated,\n\t\t\t\t\tbanner: collection.Banner,\n\t\t\t\t\tthumbnail: collection.Thumbnail,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn collections;\n\t\t}\n\n\t\treturn null;\n\t};\n}\n", "import { getGQLData } from '../common/gql.ts';\nimport { GATEWAYS } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport {\n\tAssetCreateArgsType,\n\tCommentCreateArgType,\n\tCommentDetailType,\n\tDependencyType,\n\tGQLNodeResponseType,\n\tTagFilterType,\n} from '../helpers/types.ts';\n\nimport { buildAsset, createAtomicAssetWith, getAtomicAsset } from './assets.ts';\n\nexport function createCommentWith(deps: DependencyType) {\n\tconst createAtomicAsset = createAtomicAssetWith(deps);\n\treturn async (args: CommentCreateArgType, callback?: (status: any) => void) => {\n\t\tconst tags = args.tags ? args.tags : [];\n\n\t\ttags.push({ name: 'Data-Source', value: args.parentId });\n\t\ttags.push({ name: 'Root-Source', value: args.rootId ?? args.parentId });\n\n\t\tconst assetArgs: AssetCreateArgsType = {\n\t\t\tname: `Comment on ${args.parentId}`,\n\t\t\tdescription: `Comment on ${args.parentId}`,\n\t\t\ttopics: ['comment'],\n\t\t\tcreator: args.creator,\n\t\t\tdata: args.content,\n\t\t\tcontentType: 'text/plain',\n\t\t\tassetType: 'comment',\n\t\t\ttags,\n\t\t};\n\n\t\treturn createAtomicAsset(assetArgs, callback);\n\t};\n}\n\nexport function getCommentWith(deps: DependencyType) {\n\treturn async (id: string): Promise<CommentDetailType | null> => {\n\t\ttry {\n\t\t\tconst asset: any = await getAtomicAsset(deps, id, { useGateway: true });\n\n\t\t\tconst dataSource = asset?.dataSource\n\t\t\tconst rootSource = asset?.rootSource\n\n\t\t\tif (!dataSource || !rootSource) throw new Error(`dataSource and rootSource must be present on a comment`);\n\n\t\t\treturn {\n\t\t\t\tcontent: await getCommentData(id),\n\t\t\t\tparentId: dataSource,\n\t\t\t\trootId: rootSource,\n\t\t\t};\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error getting comment');\n\t\t}\n\t};\n}\n\nexport function getCommentsWith(_deps: DependencyType) {\n\treturn async (args: { parentId?: string; rootId?: string }) => {\n\t\tif (!args.parentId && !args.rootId) {\n\t\t\tthrow new Error(`Must provide either parentId or rootId`);\n\t\t}\n\n\t\tconst tags: TagFilterType[] = [];\n\n\t\tif (args.parentId)\n\t\t\ttags.push({\n\t\t\t\tname: 'Data-Source',\n\t\t\t\tvalues: [args.parentId ?? ''],\n\t\t\t});\n\n\t\tif (args.rootId)\n\t\t\ttags.push({\n\t\t\t\tname: 'Root-Source',\n\t\t\t\tvalues: [args.rootId ?? ''],\n\t\t\t});\n\n\t\tconst gqlResponse = await getGQLData({\n\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\tids: null,\n\t\t\ttags,\n\t\t\towners: null,\n\t\t\tcursor: null,\n\t\t});\n\n\t\tlet assets: any[] = [];\n\n\t\tif (gqlResponse && gqlResponse.data.length) {\n\t\t\tassets = gqlResponse.data.map((element: GQLNodeResponseType) => buildAsset(element));\n\t\t}\n\n\t\tconst comments = [];\n\t\tfor (const asset of assets) {\n\t\t\tconst dataSource = asset?.dataSource;\n\t\t\tconst rootSource = asset?.rootSource;\n\n\t\t\tif (!dataSource || !rootSource) throw new Error(`dataSource and rootSource must be present on a comment`);\n\n\t\t\tcomments.push({\n\t\t\t\tid: asset.id,\n\t\t\t\tcontent: await getCommentData(asset.id),\n\t\t\t\tparentId: dataSource,\n\t\t\t\trootId: rootSource,\n\t\t\t})\n\t\t}\n\n\t\treturn comments;\n\t};\n}\n\nasync function getCommentData(id: string) {\n\ttry {\n\t\treturn await (await fetch(getTxEndpoint(id))).text();\n\t}\n\tcatch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error getting comment data')\n\t}\n}\n", "import { AO, GATEWAYS, TAGS } from 'helpers/config.ts';\n\nimport { aoCreateProcess, aoDryRun, aoSend } from '../common/ao.ts';\nimport { resolveTransaction } from '../common/arweave.ts';\nimport { getGQLData } from '../common/gql.ts';\nimport { DependencyType, GQLNodeResponseType, ProfileArgsType, ProfileType } from '../helpers/types.ts';\nimport { getBootTag, globalLog, mapFromProcessCase } from '../helpers/utils.ts';\n\nimport { createZoneWith, getZoneWith, updateZoneWith } from './zones.ts';\n\nexport function createProfileWith_LEGACY(deps: DependencyType) {\n\treturn async (args: ProfileArgsType, callback?: (status: any) => void): Promise<string | null> => {\n\t\ttry {\n\t\t\tif (!deps.signer) throw new Error(`No signer provided`);\n\n\t\t\tconst dateTime = new Date().getTime().toString();\n\t\t\tconst tags: { name: string; value: string }[] = [\n\t\t\t\t{ name: 'Date-Created', value: dateTime },\n\t\t\t\t{ name: 'Action', value: 'Create-Profile' },\n\t\t\t];\n\n\t\t\tlet thumbnailTx = null;\n\t\t\tlet bannerTx = null;\n\n\t\t\ttry {\n\t\t\t\tif (args.thumbnail) thumbnailTx = await resolveTransaction(deps, args.thumbnail);\n\t\t\t\tif (args.banner) bannerTx = await resolveTransaction(deps, args.banner);\n\t\t\t}\n\t\t\tcatch (e: any) {\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\n\t\t\tconst profileId = await aoCreateProcess(deps, {\n\t\t\t\ttags: tags,\n\t\t\t\tevalTxId: AO.src.profile\n\t\t\t}, (status: any) => globalLog(status));\n\n\t\t\tconst updateData: any = {\n\t\t\t\tUserName: args.username,\n\t\t\t\tDisplayName: args.displayName,\n\t\t\t\tDescription: args.description\n\t\t\t}\n\n\t\t\tif (thumbnailTx) updateData.ProfileImage = thumbnailTx;\n\t\t\tif (bannerTx) updateData.CoverImage = bannerTx;\n\n\t\t\tglobalLog('Updating profile...');\n\t\t\tif (callback) callback('Updating profile...');\n\t\t\tconst profileUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: profileId,\n\t\t\t\taction: 'Update-Profile',\n\t\t\t\tdata: updateData\n\t\t\t});\n\t\t\tglobalLog(`Profile update: ${profileUpdateId}`);\n\n\t\t\treturn profileId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating profile');\n\t\t}\n\t};\n}\n\nexport function updateProfileWith_LEGACY(deps: DependencyType) {\n\treturn async (args: ProfileArgsType, profileId: string, callback?: (status: any) => void): Promise<string | null> => {\n\t\tif (profileId) {\n\t\t\tlet updateData: any = {\n\t\t\t\tUserName: args.username,\n\t\t\t\tDisplayName: args.displayName,\n\t\t\t\tDescription: args.description,\n\t\t\t};\n\n\t\t\tif (args.thumbnail) {\n\t\t\t\ttry {\n\t\t\t\t\tupdateData.Thumbnail = await resolveTransaction(deps, args.thumbnail);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve thumbnail: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (args.banner) {\n\t\t\t\ttry {\n\t\t\t\t\tupdateData.Banner = await resolveTransaction(deps, args.banner);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve banner: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tglobalLog('Updating profile...');\n\t\t\t\tif (callback) callback('Updating profile...');\n\t\t\t\tconst profileUpdateId = await aoSend(deps, {\n\t\t\t\t\tprocessId: profileId,\n\t\t\t\t\taction: 'Update-Profile',\n\t\t\t\t\tdata: updateData\n\t\t\t\t});\n\t\t\t\tglobalLog(`Profile update: ${profileUpdateId}`);\n\t\t\t\treturn profileUpdateId;\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error updating profile');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('No profile provided');\n\t\t}\n\t};\n}\n\nexport function getProfileByIdWith_LEGACY(deps: DependencyType) {\n\treturn async (profileId: string): Promise<ProfileType | null> => {\n\t\ttry {\n\t\t\tconst processInfo = await aoDryRun(deps, {\n\t\t\t\tprocessId: profileId,\n\t\t\t\taction: 'Info',\n\t\t\t});\n\t\t\tconst { Profile = {}, ...rest } = processInfo;\n\t\t\tconst flattenedProcessInfo = { ...rest, ...Profile };\n\t\t\treturn { id: profileId, ...mapFromProcessCase(flattenedProcessInfo) };\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n\nexport function getProfileByWalletAddressWith_LEGACY(deps: DependencyType) {\n\tconst getProfileById = getProfileByIdWith_LEGACY(deps);\n\n\treturn async (walletAddress: string): Promise<(ProfileType & any) | null> => {\n\t\ttry {\n\t\t\tconst profileLookup = await aoDryRun(deps, {\n\t\t\t\tprocessId: AO.profileRegistry,\n\t\t\t\taction: 'Get-Profiles-By-Delegate',\n\t\t\t\tdata: { Address: walletAddress }\n\t\t\t});\n\n\t\t\tlet activeProfileId: string;\n\t\t\tif (profileLookup && profileLookup.length > 0 && profileLookup[0].ProfileId) {\n\t\t\t\tactiveProfileId = profileLookup[0].ProfileId;\n\t\t\t\treturn await getProfileById(activeProfileId);\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n\nexport function createProfileWith(deps: DependencyType) {\n\tconst createZone = createZoneWith(deps);\n\n\treturn async (args: ProfileArgsType, callback?: (status: any) => void): Promise<string | null> => {\n\t\tlet profileId: string | null = null;\n\n\t\tconst tags: { name: string; value: string }[] = [\n\t\t\t{ name: TAGS.keys.dataProtocol, value: TAGS.values.zone },\n\t\t\t{ name: TAGS.keys.zoneType, value: TAGS.values.user },\n\t\t];\n\n\t\tconst addImageTag = async (imageKey: 'Thumbnail' | 'Banner') => {\n\t\t\tconst key: any = imageKey.toLowerCase();\n\t\t\tif ((args as any)[key]) {\n\t\t\t\ttry {\n\t\t\t\t\tconst resolvedImage = await resolveTransaction(deps, (args as any)[key]);\n\t\t\t\t\ttags.push(getBootTag(imageKey, resolvedImage));\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve ${imageKey}: ${e.message}`);\n\t\t\t\t\telse console.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (args.username) tags.push(getBootTag('Username', args.username));\n\t\tif (args.displayName) tags.push(getBootTag('DisplayName', args.displayName));\n\t\tif (args.description) tags.push(getBootTag('Description', args.description));\n\n\t\tawait Promise.all([addImageTag('Thumbnail'), addImageTag('Banner')]);\n\n\t\ttry {\n\t\t\tprofileId = await createZone({ tags: tags }, callback);\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating profile');\n\t\t}\n\n\t\treturn profileId;\n\t};\n}\n\nexport function updateProfileWith(deps: DependencyType) {\n\tconst updateZone = updateZoneWith(deps);\n\n\treturn async (args: ProfileArgsType, profileId: string, callback?: (status: any) => void): Promise<string | null> => {\n\t\tif (profileId) {\n\t\t\tlet data: any = {\n\t\t\t\tUsername: args.username,\n\t\t\t\tDisplayName: args.displayName,\n\t\t\t\tDescription: args.description,\n\t\t\t};\n\n\t\t\tif (args.thumbnail) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.Thumbnail = await resolveTransaction(deps, args.thumbnail);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve thumbnail: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (args.banner) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.Banner = await resolveTransaction(deps, args.banner);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve banner: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\treturn await updateZone(data, profileId);\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error creating profile');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('No profile provided');\n\t\t}\n\t};\n}\n\nexport function getProfileByIdWith(deps: DependencyType) {\n\tconst getZone = getZoneWith(deps);\n\n\treturn async (profileId: string): Promise<ProfileType | null> => {\n\t\ttry {\n\t\t\tconst zone = await getZone(profileId);\n\t\t\treturn { id: profileId, ...zone.store, assets: zone.assets };\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n\nexport function getProfileByWalletAddressWith(deps: DependencyType) {\n\tconst getProfileById = getProfileByIdWith(deps);\n\n\treturn async (walletAddress: string): Promise<(ProfileType & any) | null> => {\n\t\ttry {\n\t\t\tconst gqlResponse = await getGQLData({\n\t\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\t\ttags: [\n\t\t\t\t\t{ name: TAGS.keys.dataProtocol, values: [TAGS.values.zone] },\n\t\t\t\t\t{ name: TAGS.keys.zoneType, values: [TAGS.values.user] },\n\t\t\t\t],\n\t\t\t\towners: [walletAddress],\n\t\t\t});\n\n\t\t\tif (gqlResponse?.data?.length > 0) {\n\t\t\t\tgqlResponse.data.sort((a: GQLNodeResponseType, b: GQLNodeResponseType) => {\n\t\t\t\t\tconst timestampA = a.node.block?.timestamp ?? 0;\n\t\t\t\t\tconst timestampB = b.node.block?.timestamp ?? 0;\n\t\t\t\t\treturn timestampB - timestampA;\n\t\t\t\t});\n\n\t\t\t\treturn await getProfileById(gqlResponse.data[0].node.id);\n\t\t\t}\n\n\t\t\treturn { id: null };\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n", "import { aoCreateProcess, aoDryRun, aoSend, readProcess } from '../common/ao.ts';\nimport { AO, TAGS } from '../helpers/config.ts';\nimport { DependencyType, TagType } from '../helpers/types.ts';\nimport { mapFromProcessCase } from '../helpers/utils.ts';\n\nexport function createZoneWith(deps: DependencyType) {\n\treturn async (args: { data?: any; tags?: TagType[] }, callback?: (status: any) => void): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst tags = [{ name: TAGS.keys.bootloaderInit, value: AO.src.zone }];\n\t\t\tif (args.tags && args.tags.length) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\t\t\tconst zoneId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ data: args.data, tags: tags },\n\t\t\t\tcallback ? (status: any) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\treturn zoneId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating zone');\n\t\t}\n\t};\n}\n\nexport function updateZoneWith(deps: DependencyType) {\n\treturn async (args: object, zoneId: string): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst mappedData = Object.entries(args).map(([key, value]) => ({ key, value }));\n\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Zone-Update',\n\t\t\t\tdata: mappedData,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n\nexport function addToZoneWith(deps: DependencyType) {\n\treturn async (args: { path: string; data: object }, zoneId: string): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Zone-Append',\n\t\t\t\ttags: [{ name: 'Path', value: args.path }],\n\t\t\t\tdata: args.data,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n\nexport function getZoneWith(deps: DependencyType) {\n\treturn async (zoneId: string): Promise<any | null> => {\n\t\ttry {\n\t\t\tconst processInfo = await readProcess(deps, { processId: zoneId, path: 'zone', fallbackAction: 'Info' });\n\n\t\t\treturn mapFromProcessCase(processInfo);\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error getting zone');\n\t\t}\n\t};\n}\n"],
|
|
5
|
-
"mappings": "yhBAAA,IAAAA,EAAAC,GAAA,CAAAC,GAAAC,KAAA,CACA,IAAIC,EAAUD,GAAO,QAAU,CAAC,EAO5BE,EACAC,EAEJ,SAASC,GAAmB,CACxB,M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,WAAmBoB,EACnB,qBAA6BC,GAC7B,cAAsBC,GAAoBtB,CAAI,EAC9C,YAAoBuB,GAAavB,CAAI,EACrC,YAAoBwB,GAAWxB,CAAI,EACnC,eAAuByB,GAEvB,mBAA4BC,EAC5B,iBAA0BC,CAC3B,CACD,CAEA,IAAOC,GAAQ,CAAE,KAAA7B,EAAK",
|
|
6
|
-
"names": ["require_browser", "__commonJSMin", "exports", "module", "process", "cachedSetTimeout", "cachedClearTimeout", "defaultSetTimout", "defaultClearTimeout", "runTimeout", "fun", "runClearTimeout", "marker", "queue", "draining", "currentQueue", "queueIndex", "cleanUpNextTick", "drainQueue", "timeout", "len", "args", "i", "Item", "array", "noop", "name", "dir", "import_browser", "
|
|
4
|
+
"sourcesContent": ["// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n", "import * as Common from './common/index.ts';\nimport * as Helpers from './helpers/index.ts';\nimport * as Services from './services/index.ts';\n\nexport * as Types from './helpers/types.ts';\n\nfunction init(deps: Helpers.DependencyType) {\n\treturn {\n\t\t/* Zones */\n\t\tcreateZone: Services.createZoneWith(deps),\n\t\tupdateZone: Services.updateZoneWith(deps),\n\t\taddToZone: Services.addToZoneWith(deps),\n\t\tgetZone: Services.getZoneWith(deps),\n\t\tsetZoneRoles: Services.setZoneRolesWith(deps),\n\t\tjoinZone: Services.joinZoneWith(deps),\n\t\t\n\t\t/* Profiles */\n\t\tcreateProfile: Services.createProfileWith(deps),\n\t\tupdateProfile: Services.updateProfileWith(deps),\n\t\tgetProfileById: Services.getProfileByIdWith(deps),\n\t\tgetProfileByWalletAddress: Services.getProfileByWalletAddressWith(deps),\n\t\t\n\t\t/* Assets */\n\t\tcreateAtomicAsset: Services.createAtomicAssetWith(deps),\n\t\tgetAtomicAsset: Services.getAtomicAssetWith(deps),\n\t\tgetAtomicAssets: Services.getAtomicAssets,\n\t\t\n\t\t/* Comments */\n\t\tcreateComment: Services.createCommentWith(deps),\n\t\tgetComment: Services.getCommentWith(deps),\n\t\tgetComments: Services.getCommentsWith(deps),\n\t\t\n\t\t/* Collections */\n\t\tcreateCollection: Services.createCollectionWith(deps),\n\t\tupdateCollectionAssets: Services.updateCollectionAssetsWith(deps),\n\t\tgetCollection: Services.getCollectionWith(deps),\n\t\tgetCollections: Services.getCollectionsWith(deps),\n\t\t\n\t\t/* Common */\n\t\tresolveTransaction: Common.resolveTransactionWith(deps),\n\t\tgetGQLData: Common.getGQLData,\n\t\tgetAggregatedGQLData: Common.getAggregatedGQLData,\n\t\tcreateProcess: Common.aoCreateProcessWith(deps),\n\t\treadProcess: Common.aoDryRunWith(deps),\n\t\tsendMessage: Common.aoSendWith(deps),\n\t\twaitForProcess: Common.waitForProcess,\n\t\t\n\t\t/* Utils */\n\t\tmapFromProcessCase: Helpers.mapFromProcessCase,\n\t\tmapToProcessCase: Helpers.mapToProcessCase,\n\t};\n}\n\nexport default { init };\n", "export * from './ao.ts';\nexport * from './arweave.ts';\nexport * from './gql.ts';\n", "import { AO, GATEWAYS, HB } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport {\n\tDependencyType,\n\tMessageDryRunType,\n\tMessageResultType,\n\tMessageSendType,\n\tProcessCreateType,\n\tProcessSpawnType,\n\tTagType,\n} from '../helpers/types.ts';\nimport { getTagValue, globalLog } from '../helpers/utils.ts';\n\nimport { getGQLData } from './gql.ts';\n\nconst GATEWAY = GATEWAYS.goldsky;\n\nconst GATEWAY_RETRY_COUNT = 100;\n\nexport async function aoSpawn(deps: DependencyType, args: ProcessSpawnType): Promise<string> {\n\tconst tags = [{ name: 'Authority', value: AO.mu }];\n\tif (args.tags && args.tags.length > 0) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\ttry {\n\t\tconst processId = await deps.ao.spawn({\n\t\t\tmodule: args.module,\n\t\t\tscheduler: args.scheduler,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: args.data,\n\t\t});\n\n\t\tglobalLog(`Process ID: ${processId}`);\n\n\t\treturn processId;\n\t} catch (e: any) {\n\t\tconsole.log(e)\n\t\tthrow new Error(e.message ?? 'Error spawning process');\n\t}\n}\n\nexport function aoSendWith(deps: DependencyType) {\n\treturn async (args: MessageSendType) => {\n\t\treturn await aoSend(deps, args);\n\t}\n}\n\nexport async function aoSend(deps: DependencyType, args: MessageSendType): Promise<string> {\n\ttry {\n\t\tconst tags: TagType[] = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\n\t\tconst data = args.useRawData ? args.data : JSON.stringify(args.data);\n\n\t\tconst txId = await deps.ao.message({\n\t\t\tprocess: args.processId,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: data,\n\t\t});\n\n\t\treturn txId;\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\n// TODO\nexport async function readProcess(deps: DependencyType, args: { processId: string, path: string, node?: string, fallbackAction?: string }) {\n\ttry {\n\t\tconsole.log('State not found, dryrunning...');\n\t\tconst response = await aoDryRun(deps, {\n\t\t\tprocessId: args.processId,\n\t\t\taction: args.fallbackAction!,\n\t\t});\n\n\t\treturn response;\n\t}\n\tcatch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error reading process from HyperBEAM');\n\t}\n\t// const node = args.node ?? HB.node;\n\t// const mode = 'now';\n\t// try {\n\t// \tconsole.log('Getting state from HyperBEAM...');\n\t// \tconst response = await fetch(`${node}/${args.processId}~process@1.0/${mode}/${args.path}`);\n\t// \treturn await response.json();\n\t// }\n\t// catch (e: any) {\n\t// \tif (args.fallbackAction) {\n\t// \t\tconsole.error(e.message ?? 'Error reading process from HyperBEAM');\n\n\t// \t\tconsole.log('State not found, dryrunning...');\n\t// \t\tconst response = await aoDryRun(deps, {\n\t// \t\t\tprocessId: args.processId,\n\t// \t\t\taction: args.fallbackAction,\n\t// \t\t});\n\n\t// \t\treturn response;\n\t// \t}\n\t// \telse {\n\t// \t\tthrow new Error(e.message ?? 'Error reading process from HyperBEAM');\n\t// \t}\n\t// }\n}\n\nexport function aoDryRunWith(deps: DependencyType) {\n\treturn async (args: MessageSendType) => {\n\t\treturn await aoDryRun(deps, args);\n\t}\n}\n\nexport async function aoDryRun(deps: DependencyType, args: MessageDryRunType): Promise<any> {\n\ttry {\n\t\tconst tags = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\t\tlet dataPayload;\n\t\tif (typeof args.data === 'object') {\n\t\t\tdataPayload = JSON.stringify(args.data || {});\n\t\t} else if (typeof args.data === 'string') {\n\t\t\ttry {\n\t\t\t\tJSON.parse(args.data);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e);\n\t\t\t\tthrow new Error('Invalid JSON data');\n\t\t\t}\n\t\t\tdataPayload = args.data;\n\t\t}\n\n\t\tconst response = await deps.ao.dryrun({\n\t\t\tprocess: args.processId,\n\t\t\ttags: tags,\n\t\t\tdata: dataPayload,\n\t\t});\n\n\t\tif (response.Messages && response.Messages.length) {\n\t\t\tif (response.Messages[0].Data) {\n\t\t\t\treturn JSON.parse(response.Messages[0].Data);\n\t\t\t} else {\n\t\t\t\tif (response.Messages[0].Tags) {\n\t\t\t\t\treturn response.Messages[0].Tags.reduce((acc: any, item: any) => {\n\t\t\t\t\t\tacc[item.name] = item.value;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error dryrunning process');\n\t}\n}\n\nexport async function aoMessageResult(deps: DependencyType, args: MessageResultType): Promise<any> {\n\ttry {\n\t\tconst { Messages } = await deps.ao.result({ message: args.messageId, process: args.processId });\n\n\t\tif (Messages && Messages.length) {\n\t\t\tconst response: { [key: string]: any } = {};\n\n\t\t\tMessages.forEach((message: any) => {\n\t\t\t\tconst action = getTagValue(message.Tags, 'Action') || args.action;\n\n\t\t\t\tlet responseData = null;\n\t\t\t\tconst messageData = message.Data;\n\n\t\t\t\tif (messageData) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresponseData = JSON.parse(messageData);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tresponseData = messageData;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst responseStatus = getTagValue(message.Tags, 'Status');\n\t\t\t\tconst responseMessage = getTagValue(message.Tags, 'Message');\n\n\t\t\t\tresponse[action] = {\n\t\t\t\t\tid: args.messageId,\n\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\tdata: responseData,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn response;\n\t\t} else return null;\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function aoMessageResults(\n\tdeps: DependencyType,\n\targs: {\n\t\tprocessId: string;\n\t\taction: string;\n\t\ttags: TagType[] | null;\n\t\tdata: any;\n\t\tresponses?: string[];\n\t\thandler?: string;\n\t},\n): Promise<any> {\n\ttry {\n\t\tconst tags = [{ name: 'Action', value: args.action }];\n\t\tif (args.tags) tags.push(...args.tags);\n\n\t\tawait deps.ao.message({\n\t\t\tprocess: args.processId,\n\t\t\tsigner: deps.signer,\n\t\t\ttags: tags,\n\t\t\tdata: JSON.stringify(args.data),\n\t\t});\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\n\t\tconst messageResults = await deps.ao.results({\n\t\t\tprocess: args.processId,\n\t\t\tsort: 'DESC',\n\t\t\tlimit: 100,\n\t\t});\n\n\t\tif (messageResults && messageResults.edges && messageResults.edges.length) {\n\t\t\tconst response: any = {};\n\n\t\t\tfor (const result of messageResults.edges) {\n\t\t\t\tif (result.node && result.node.Messages && result.node.Messages.length) {\n\t\t\t\t\tconst resultSet: any[] = [args.action];\n\t\t\t\t\tif (args.responses) resultSet.push(...args.responses);\n\n\t\t\t\t\tfor (const message of result.node.Messages) {\n\t\t\t\t\t\tconst action = getTagValue(message.Tags, 'Action');\n\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\tlet responseData = null;\n\t\t\t\t\t\t\tconst messageData = message.Data;\n\n\t\t\t\t\t\t\tif (messageData) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tresponseData = JSON.parse(messageData);\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tresponseData = messageData;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst responseStatus = getTagValue(message.Tags, 'Status');\n\t\t\t\t\t\t\tconst responseMessage = getTagValue(message.Tags, 'Message');\n\n\t\t\t\t\t\t\tif (action === 'Action-Response') {\n\t\t\t\t\t\t\t\tconst responseHandler = getTagValue(message.Tags, 'Handler');\n\t\t\t\t\t\t\t\tif (args.handler && args.handler === responseHandler) {\n\t\t\t\t\t\t\t\t\tresponse[action] = {\n\t\t\t\t\t\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\t\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\t\t\t\t\t\tdata: responseData,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (resultSet.indexOf(action) !== -1) {\n\t\t\t\t\t\t\t\t\tresponse[action] = {\n\t\t\t\t\t\t\t\t\t\tstatus: responseStatus,\n\t\t\t\t\t\t\t\t\t\tmessage: responseMessage,\n\t\t\t\t\t\t\t\t\t\tdata: responseData,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (Object.keys(response).length === resultSet.length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn response;\n\t\t}\n\n\t\treturn null;\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function handleProcessEval(\n\tdeps: DependencyType,\n\targs: {\n\t\tprocessId: string;\n\t\tevalTxId: string | null;\n\t\tevalSrc: string | null;\n\t\tevalTags?: TagType[];\n\t},\n): Promise<string | null> {\n\tlet src: string | null = null;\n\n\tif (args.evalSrc) src = args.evalSrc;\n\telse if (args.evalTxId) src = await fetchProcessSrc(args.evalTxId);\n\n\tif (src) {\n\t\ttry {\n\t\t\tconst evalMessage = await aoSend(deps, {\n\t\t\t\tprocessId: args.processId,\n\t\t\t\taction: 'Eval',\n\t\t\t\tdata: src,\n\t\t\t\ttags: args.evalTags || null,\n\t\t\t\tuseRawData: true,\n\t\t\t});\n\n\t\t\tglobalLog(`Eval: ${evalMessage}`);\n\n\t\t\tconst evalResult = await aoMessageResult(deps, {\n\t\t\t\tprocessId: args.processId,\n\t\t\t\tmessageId: evalMessage,\n\t\t\t\taction: 'Eval',\n\t\t\t});\n\n\t\t\treturn evalResult;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error sending process eval');\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function aoCreateProcessWith(deps: DependencyType) {\n\treturn async (args: ProcessCreateType, statusCB?: (status: any) => void) => {\n\t\ttry {\n\t\t\tconst spawnArgs: any = {\n\t\t\t\tmodule: args.module || AO.module,\n\t\t\t\tscheduler: args.scheduler || AO.scheduler,\n\t\t\t};\n\n\t\t\tif (args.data) spawnArgs.data = args.data;\n\t\t\tif (args.tags) spawnArgs.tags = args.tags;\n\n\t\t\tstatusCB && statusCB(`Spawning process...`);\n\t\t\tconst processId = await aoSpawn(deps, spawnArgs);\n\n\t\t\tif (args.evalTxId || args.evalSrc) {\n\t\t\t\tstatusCB && statusCB(`Process retrieved!`);\n\t\t\t\tstatusCB && statusCB('Sending eval...');\n\n\t\t\t\ttry {\n\t\t\t\t\tconst evalResult = await handleProcessEval(deps, {\n\t\t\t\t\t\tprocessId: processId,\n\t\t\t\t\t\tevalTxId: args.evalTxId || null,\n\t\t\t\t\t\tevalSrc: args.evalSrc || null,\n\t\t\t\t\t\tevalTags: args.evalTags,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (evalResult && statusCB) statusCB('Eval complete');\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn processId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t}\n\t};\n}\n\nexport async function aoCreateProcess(\n\tdeps: DependencyType,\n\targs: ProcessCreateType,\n\tstatusCB?: (status: any) => void,\n): Promise<string> {\n\ttry {\n\t\tconst spawnArgs: any = {\n\t\t\tmodule: args.module || AO.module,\n\t\t\tscheduler: args.scheduler || AO.scheduler,\n\t\t};\n\n\t\tif (args.data) spawnArgs.data = args.data;\n\t\tif (args.tags) spawnArgs.tags = args.tags;\n\n\t\tstatusCB && statusCB(`Spawning process...`);\n\t\tconst processId = await aoSpawn(deps, spawnArgs);\n\n\t\tif (args.evalTxId || args.evalSrc) {\n\t\t\tstatusCB && statusCB(`Process retrieved!`);\n\t\t\tstatusCB && statusCB('Sending eval...');\n\n\t\t\ttry {\n\t\t\t\tconst evalResult = await handleProcessEval(deps, {\n\t\t\t\t\tprocessId: processId,\n\t\t\t\t\tevalTxId: args.evalTxId || null,\n\t\t\t\t\tevalSrc: args.evalSrc || null,\n\t\t\t\t\tevalTags: args.evalTags,\n\t\t\t\t});\n\n\t\t\t\tif (evalResult && statusCB) statusCB('Eval complete');\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error creating process');\n\t\t\t}\n\t\t}\n\n\t\treturn processId;\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error creating process');\n\t}\n}\n\nexport async function fetchProcessSrc(txId: string): Promise<string> {\n\ttry {\n\t\tconst srcFetch = await fetch(getTxEndpoint(txId));\n\t\treturn await srcFetch.text();\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\nexport async function waitForProcess(args: { processId: string, noRetryLimit?: boolean }) {\n\tlet retries = 0;\n\tconst retryLimit = args.noRetryLimit ? Infinity : GATEWAY_RETRY_COUNT;\n\n\twhile (retries < retryLimit) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 2000));\n\n\t\tconst gqlResponse = await getGQLData({\n\t\t\tgateway: GATEWAY,\n\t\t\tids: [args.processId],\n\t\t});\n\n\t\tif (gqlResponse?.data?.length) {\n\t\t\tconst foundProcess = gqlResponse.data[0].node.id;\n\t\t\tglobalLog(`Process found: ${foundProcess} (Try ${retries + 1})`);\n\t\t\treturn foundProcess;\n\t\t} else {\n\t\t\tglobalLog(`Process not found: ${args.processId} (Try ${retries + 1})`);\n\t\t\tretries++;\n\t\t}\n\t}\n\n\tif (retryLimit !== Infinity) {\n\t\tthrow new Error(`Process not found, please try again`);\n\t}\n}", "export const AO = {\n\tmodule: 'URgYpPQzvxxfYQtjrIQ116bl3YBfcImo3JEnNo8Hlrk',\n\tscheduler: '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA',\n\tmu: 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY',\n\tsrc: {\n\t\tasset: 'jm8OfYb4PL8-AHvx3k0csQUWDpR24bh6l8uNCoWueHA',\n\t\tcollection: 'flkCYx4lJtOtsVFyUZLN-AKpkObNoTMYu4GfUTzNoGE',\n\t\tcollectionActivity: 'k8K8WIJb5kXOVvZRFXF5GIZW-7b2NtaTOd6G-E5MF0k',\n\t\tprofile: 'WBhJpPafkykqZZgTr7TAsz48RKG4vbOEAH4rZ3JxIQ8',\n\t\tzone: 'EQxcaL4yo_tLz7emxBPewWs98tmxJ3z8G56CfcpH3aA'\n\t},\n\tcollectionRegistry: 'zwKi27GuKS3GOlwL3EhNGH02SJDDAO5Uy43ZJwomhZ4',\n\tprofileRegistry: 'SNy4m-DrqxWl01YqGM4sxI8qCni-58re8uuJLvZPypY'\n};\n\nexport const HB = {\n\tnode: 'https://router-1.forward.computer'\n};\n\nexport const CONTENT_TYPES: { [key: string]: { type: string; serialize: (data: any) => any } } = {\n\t'application/json': {\n\t\ttype: 'application/json',\n\t\tserialize: (data: any) => JSON.stringify(data),\n\t},\n};\n\nexport const GATEWAYS = {\n\tarweave: 'arweave.net',\n\tgoldsky: 'arweave-search.goldsky.com',\n};\n\nexport const LICENSES = {\n\tudl: {\n\t\tlabel: 'Universal Data License',\n\t\taddress: 'dE0rmDfl9_OWjkDznNEXHaSO_JohJkRolvMzaCroUdw',\n\t},\n};\n\nexport const TAGS = {\n\tkeys: {\n\t\taccess: 'Access-Fee',\n\t\tans110: {\n\t\t\ttitle: 'Title',\n\t\t\tdescription: 'Description',\n\t\t\ttopic: 'Topic:*',\n\t\t\ttype: 'Type',\n\t\t\timplements: 'Implements',\n\t\t\tlicense: 'License',\n\t\t},\n\t\tassetType: 'Asset-Type',\n\t\tbanner: 'Banner',\n\t\tbootloader: 'Bootloader',\n\t\tcollectionId: 'Collection-Id',\n\t\tcollectionName: 'Collection-Name',\n\t\tcommericalUse: 'Commercial-Use',\n\t\tcontentType: 'Content-Type',\n\t\tcreator: 'Creator',\n\t\tcurrency: 'Currency',\n\t\tdataModelTraining: 'Data-Model-Training',\n\t\tdataProtocol: 'Data-Protocol',\n\t\tdateCreated: 'Date-Created',\n\t\tderivations: 'Derivations',\n\t\tdescription: 'Description',\n\t\tdisplayName: 'Display-Name',\n\t\thandle: 'Handle',\n\t\timplements: 'Implements',\n\t\tinitialOwner: 'Initial-Owner',\n\t\tlicense: 'License',\n\t\tname: 'Name',\n\t\tonBoot: 'On-Boot',\n\t\tpaymentAddress: 'Payment-Address',\n\t\tpaymentMode: 'Payment-Mode',\n\t\tprofileCreator: 'Profile-Creator',\n\t\tprofileIndex: 'Profile-Index',\n\t\tprotocolName: 'Protocol-Name',\n\t\trenderWith: 'Render-With',\n\t\tthumbnail: 'Thumbnail',\n\t\ttitle: 'Title',\n\t\ttopic: 'Topic',\n\t\ttype: 'Type',\n\t\tzoneType: 'Zone-Type',\n\t},\n\tvalues: {\n\t\tdocument: 'Document',\n\t\tuser: 'User',\n\t\tzone: 'Permaweb-Zone'\n\t},\n};\n\nexport const UPLOAD = {\n\tnode1: 'https://up.arweave.net',\n\tnode2: 'https://turbo.ardrive.io',\n\tbatchSize: 1,\n\tchunkSize: 7500000,\n\tdispatchUploadSize: 100 * 1024,\n};\n", "import { checkValidAddress } from './utils.ts';\n\nconst arweaveEndpoint = 'https://arweave.net';\n\nexport function getARBalanceEndpoint(walletAddress: string) {\n\treturn `${arweaveEndpoint}/wallet/${walletAddress}/balance`;\n}\n\nexport function getTxEndpoint(txId: string) {\n\treturn `${arweaveEndpoint}/${txId}`;\n}\n\nexport function getRendererEndpoint(renderWith: string, tx: string) {\n\tif (checkValidAddress(renderWith)) {\n\t\treturn `${arweaveEndpoint}/${renderWith}/?tx=${tx}`;\n\t} else {\n\t\treturn `https://${renderWith}.arweave.net/?tx=${tx}`;\n\t}\n}\n", "import { TAGS } from './config.ts';\n\ndeclare const InstallTrigger: any;\n\nexport function checkValidAddress(address: string | null) {\n\tif (!address) return false;\n\treturn /^[a-z0-9_-]{43}$/i.test(address);\n}\n\nexport function formatAddress(address: string | null, wrap: boolean) {\n\tif (!address) return '';\n\tif (!checkValidAddress(address)) return address;\n\tconst formattedAddress = address.substring(0, 5) + '...' + address.substring(36, address.length);\n\treturn wrap ? `(${formattedAddress})` : formattedAddress;\n}\n\nexport function getTagValue(list: { [key: string]: any }[], name: string): string | null {\n\tfor (let i = 0; i < list.length; i++) {\n\t\tif (list[i]) {\n\t\t\tif (list[i]!.name === name) {\n\t\t\t\treturn list[i]!.value as string;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function formatCount(count: string): string {\n\tif (count === '0' || !Number(count)) return '0';\n\n\tif (count.includes('.')) {\n\t\tlet parts = count.split('.');\n\t\tparts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n\n\t\t// Find the position of the last non-zero digit within the first 6 decimal places\n\t\tlet index = 0;\n\t\tfor (let i = 0; i < Math.min(parts[1].length, 6); i++) {\n\t\t\tif (parts[1][i] !== '0') {\n\t\t\t\tindex = i + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (index === 0) {\n\t\t\t// If all decimals are zeros, keep two decimal places\n\t\t\tparts[1] = '00';\n\t\t} else {\n\t\t\t// Otherwise, truncate to the last non-zero digit\n\t\t\tparts[1] = parts[1].substring(0, index);\n\n\t\t\t// If the decimal part is longer than 4 digits, truncate to 4 digits\n\t\t\tif (parts[1].length > 4 && parts[1].substring(0, 4) !== '0000') {\n\t\t\t\tparts[1] = parts[1].substring(0, 4);\n\t\t\t}\n\t\t}\n\n\t\treturn parts.join('.');\n\t} else {\n\t\treturn count.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n\t}\n}\n\nexport function formatPercentage(percentage: any) {\n\tif (isNaN(percentage)) return '0%';\n\n\tlet multiplied = percentage * 100;\n\tlet decimalPart = multiplied.toString().split('.')[1];\n\n\tif (!decimalPart) {\n\t\treturn `${multiplied.toFixed(0)}%`;\n\t}\n\n\tif (decimalPart.length > 6 && decimalPart.substring(0, 6) === '000000') {\n\t\treturn `${multiplied.toFixed(0)}%`;\n\t}\n\n\tlet nonZeroIndex = decimalPart.length;\n\tfor (let i = 0; i < decimalPart.length; i++) {\n\t\tif (decimalPart[i] !== '0') {\n\t\t\tnonZeroIndex = i + 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn `${multiplied.toFixed(nonZeroIndex)}%`;\n}\n\nexport function formatDate(dateArg: string | number | null, dateType: 'iso' | 'epoch', fullTime?: boolean) {\n\tif (!dateArg) {\n\t\treturn null;\n\t}\n\n\tlet date: Date | null = null;\n\n\tswitch (dateType) {\n\t\tcase 'iso':\n\t\t\tdate = new Date(dateArg);\n\t\t\tbreak;\n\t\tcase 'epoch':\n\t\t\tdate = new Date(Number(dateArg));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tdate = new Date(dateArg);\n\t\t\tbreak;\n\t}\n\n\treturn fullTime\n\t\t? `${date.toLocaleString('default', { month: 'long' })} ${date.getDate()}, ${date.getUTCFullYear()} at ${\n\t\t\t\tdate.getHours() % 12 || 12\n\t\t\t}:${date.getMinutes().toString().padStart(2, '0')} ${date.getHours() >= 12 ? 'PM' : 'AM'}`\n\t\t: `${date.toLocaleString('default', { month: 'long' })} ${date.getDate()}, ${date.getUTCFullYear()}`;\n}\n\nexport function getRelativeDate(timestamp: number) {\n\tif (!timestamp) return '-';\n\tconst currentDate = new Date();\n\tconst inputDate = new Date(timestamp);\n\n\tconst timeDifference: number = currentDate.getTime() - inputDate.getTime();\n\tconst secondsDifference = Math.floor(timeDifference / 1000);\n\tconst minutesDifference = Math.floor(secondsDifference / 60);\n\tconst hoursDifference = Math.floor(minutesDifference / 60);\n\tconst daysDifference = Math.floor(hoursDifference / 24);\n\tconst monthsDifference = Math.floor(daysDifference / 30.44); // Average days in a month\n\tconst yearsDifference = Math.floor(monthsDifference / 12);\n\n\tif (yearsDifference > 0) {\n\t\treturn `${yearsDifference} year${yearsDifference > 1 ? 's' : ''} ago`;\n\t} else if (monthsDifference > 0) {\n\t\treturn `${monthsDifference} month${monthsDifference > 1 ? 's' : ''} ago`;\n\t} else if (daysDifference > 0) {\n\t\treturn `${daysDifference} day${daysDifference > 1 ? 's' : ''} ago`;\n\t} else if (hoursDifference > 0) {\n\t\treturn `${hoursDifference} hour${hoursDifference > 1 ? 's' : ''} ago`;\n\t} else if (minutesDifference > 0) {\n\t\treturn `${minutesDifference} minute${minutesDifference > 1 ? 's' : ''} ago`;\n\t} else {\n\t\treturn `${secondsDifference} second${secondsDifference !== 1 ? 's' : ''} ago`;\n\t}\n}\n\nexport function formatRequiredField(field: string) {\n\treturn `${field} *`;\n}\n\nexport function splitTagValue(tag: any) {\n\tlet parts = tag.split('-');\n\n\tlet lastPart = parts[parts.length - 1];\n\tif (!isNaN(lastPart)) {\n\t\tparts = parts.slice(0, -1).join(' ') + ': ' + lastPart;\n\t} else {\n\t\tparts = parts.join(' ');\n\t}\n\n\treturn parts;\n}\n\nexport function getTagDisplay(value: string) {\n\tlet result = value.replace(/([A-Z])/g, ' $1').trim();\n\tresult = result.charAt(0).toUpperCase() + result.slice(1);\n\treturn result;\n}\n\nexport function getDataURLContentType(dataURL: string) {\n\tconst result = dataURL.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+);base64,/);\n\treturn result ? result[1] : null;\n}\n\nexport function getBase64Data(dataURL: string) {\n\treturn dataURL.split(',')[1];\n}\n\nexport function getByteSize(input: string | Buffer): number {\n\tlet sizeInBytes: number;\n\tif (Buffer.isBuffer(input)) {\n\t\tsizeInBytes = input.length;\n\t} else if (typeof input === 'string') {\n\t\tsizeInBytes = Buffer.byteLength(input, 'utf-8');\n\t} else {\n\t\tthrow new Error('Input must be a string or a Buffer');\n\t}\n\n\treturn sizeInBytes;\n}\n\nexport function getTotalTokenBalance(tokenBalances: { profileBalance: number; walletBalance: number } | null) {\n\tif (!tokenBalances) return null;\n\tconst total = (tokenBalances.profileBalance || 0) + (tokenBalances.walletBalance || 0);\n\treturn total;\n}\n\nexport function isFirefox(): boolean {\n\treturn typeof InstallTrigger !== 'undefined';\n}\n\nexport function reverseDenomination(number: number) {\n\tlet count = 0;\n\n\twhile (number > 0 && number % 10 === 0) {\n\t\tcount++;\n\t\tnumber /= 10;\n\t}\n\n\treturn count;\n}\n\nexport function cleanProcessField(value: string) {\n\tlet updatedValue: string;\n\tupdatedValue = value.replace(/\\[|\\]/g, '');\n\treturn `[[${updatedValue}]]`;\n}\n\nexport function cleanTagValue(value: string) {\n\tlet updatedValue: string;\n\tupdatedValue = value.replace(/\\[|\\]/g, '');\n\treturn updatedValue;\n}\n\n/**\n * Extracts all values from a key-value store that match a given prefix\n * @param store The key-value store object to search\n * @param prefix The prefix to filter keys by (e.g., 'portal')\n * @returns Array of values whose keys match the prefix\n */\nexport function getStoreNamespace<T = any>(prefix: string, store: Record<string, T>): T[] {\n\tif (!store) return [];\n\n\tconst searchPrefix = `${prefix}:`;\n\treturn Object.keys(store)\n\t\t.filter((key) => key.startsWith(searchPrefix))\n\t\t.map((key) => store[key]) as any;\n}\n\nexport function buildStoreNamespace(prefix: string, value: string) {\n\treturn `${prefix}:${value.toLowerCase().replace(/\\s+/g, '-')}`;\n}\n\nexport const globalLog = (...args: any[]) => {\n\tconsole.log('[@permaweb/libs]', ...args);\n};\n\nfunction toProcessCase(str: string): string {\n\treturn str.replace(/^[a-z]/, (match) => match.toUpperCase());\n}\n\n/* Maps an object from camel case to pascal case */\nexport function mapToProcessCase(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(mapToProcessCase);\n\t} else if (obj && typeof obj === 'object') {\n\t\treturn Object.entries(obj).reduce((acc: any, [key, value]) => {\n\t\t\tconst toKey = toProcessCase(key);\n\t\t\tacc[toKey] = checkValidAddress(value as any) ? value : mapToProcessCase(value);\n\t\t\treturn acc;\n\t\t}, {});\n\t}\n\treturn obj;\n}\n\nfunction fromProcessCase(str: string) {\n\treturn str.charAt(0).toLowerCase() + str.slice(1);\n}\n\n/* Maps an object from pascal case to camel case */\nexport function mapFromProcessCase(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(mapFromProcessCase);\n\t} else if (obj && typeof obj === 'object') {\n\t\treturn Object.entries(obj).reduce((acc: any, [key, value]) => {\n\t\t\tconst fromKey = checkValidAddress(key as any) || key.includes('-') ? key : fromProcessCase(key);\n\t\t\tacc[fromKey] = checkValidAddress(value as any) ? value : mapFromProcessCase(value);\n\t\t\treturn acc;\n\t\t}, {});\n\t}\n\treturn obj;\n}\n\nexport function getBootTag(key: string, value: string) {\n\tconst capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);\n\treturn { name: `${TAGS.keys.bootloader}-${capitalizedKey}`, value };\n}\n", "import { GATEWAYS } from '../helpers/config.ts';\nimport {\n\tBatchAGQLResponseType,\n\tBatchGQLArgsType,\n\tDefaultGQLResponseType,\n\tGQLArgsType,\n\tGQLNodeResponseType,\n\tQueryBodyGQLArgsType,\n} from '../helpers/types.ts';\n\nconst CURSORS = {\n\tp1: 'P1',\n\tend: 'END',\n};\n\nconst PAGINATORS = {\n\tdefault: 100,\n};\n\nexport async function getGQLData(args: GQLArgsType): Promise<DefaultGQLResponseType> {\n\tconst paginator = args.paginator ? args.paginator : PAGINATORS.default;\n\tlet data: GQLNodeResponseType[] = [];\n\tlet count: number = 0;\n\tlet nextCursor: string | null = null;\n\n\tif (args.ids && !args.ids.length) {\n\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t}\n\n\ttry {\n\t\tlet queryBody: string = getQueryBody(args);\n\t\tconst response = await getResponse({ gateway: args.gateway ?? GATEWAYS.goldsky, query: getQuery(queryBody) });\n\n\t\tif (response?.data?.transactions?.edges?.length) {\n\t\t\tdata = [...response.data.transactions.edges];\n\t\t\tcount = response.data.transactions.count ?? 0;\n\n\t\t\tconst lastResults: boolean = data.length < paginator || !response.data.transactions.pageInfo.hasNextPage;\n\n\t\t\tif (lastResults) nextCursor = CURSORS.end;\n\t\t\telse nextCursor = data[data.length - 1].cursor;\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\tcount: count,\n\t\t\t\tnextCursor: nextCursor,\n\t\t\t\tpreviousCursor: null,\n\t\t\t};\n\t\t} else {\n\t\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t\t}\n\t} catch (e: any) {\n\t\tconsole.error(e);\n\t\treturn { data: data, count: count, nextCursor: nextCursor, previousCursor: null };\n\t}\n}\n\nexport async function getAggregatedGQLData(args: GQLArgsType, callback?: (message: string) => void) {\n\tlet index = 1;\n\tlet fetchResult = await getGQLData(args);\n\n\tif (fetchResult && fetchResult.data.length) {\n\t\tlet aggregatedData = fetchResult.data;\n\t\tcallback && callback(`Count: ${fetchResult.count}`);\n\t\tcallback && callback(`Pages to fetch: ${Math.ceil(fetchResult.count / (args.paginator ?? PAGINATORS.default))}`);\n\t\tcallback && callback(`Page ${index} fetched`);\n\n\t\twhile (fetchResult.nextCursor && fetchResult.nextCursor !== CURSORS.end) {\n\t\t\tindex += 1;\n\t\t\tcallback && callback(`Fetching page ${index}...`);\n\n\t\t\tfetchResult = await getGQLData({\n\t\t\t\t...args,\n\t\t\t\tcursor: fetchResult.nextCursor,\n\t\t\t});\n\n\t\t\tif (fetchResult && fetchResult.data.length) {\n\t\t\t\taggregatedData = aggregatedData.concat(fetchResult.data);\n\t\t\t}\n\t\t}\n\n\t\tcallback && callback(`All pages fetched!`);\n\t\treturn aggregatedData;\n\t}\n\telse {\n\t\tcallback && callback('No data found');\n\t}\n\n\treturn null;\n}\n\nexport async function getBatchGQLData(args: BatchGQLArgsType): Promise<BatchAGQLResponseType> {\n\tlet responseObject: BatchAGQLResponseType = {};\n\tlet queryBody: string = '';\n\n\tfor (const [queryKey, baseArgs] of Object.entries(args.entries)) {\n\t\tresponseObject[queryKey] = { data: [], count: 0, nextCursor: null, previousCursor: null };\n\t\tqueryBody += getQueryBody({ ...baseArgs, gateway: args.gateway ?? GATEWAYS.goldsky, queryKey: queryKey });\n\t}\n\n\ttry {\n\t\tconst response = await getResponse({ gateway: args.gateway ?? GATEWAYS.goldsky, query: getQuery(queryBody) });\n\n\t\tif (response && response.data) {\n\t\t\tfor (const queryKey of Object.keys(response.data)) {\n\t\t\t\tconst paginator = args.entries[queryKey].paginator ? args.entries[queryKey].paginator : PAGINATORS.default;\n\n\t\t\t\tlet data: GQLNodeResponseType[] = [];\n\t\t\t\tlet count: number = 0;\n\t\t\t\tlet nextCursor: string | null = null;\n\n\t\t\t\tif (response.data[queryKey].edges.length) {\n\t\t\t\t\tdata = [...response.data[queryKey].edges];\n\t\t\t\t\tcount = response.data[queryKey].count ?? 0;\n\n\t\t\t\t\tconst lastResults: boolean = data.length < paginator || !response.data[queryKey].pageInfo.hasNextPage;\n\n\t\t\t\t\tif (lastResults) nextCursor = CURSORS.end;\n\t\t\t\t\telse nextCursor = data[data.length - 1].cursor;\n\n\t\t\t\t\tresponseObject[queryKey] = {\n\t\t\t\t\t\tdata: [...response.data[queryKey].edges],\n\t\t\t\t\t\tcount: count,\n\t\t\t\t\t\tnextCursor: nextCursor,\n\t\t\t\t\t\tpreviousCursor: null,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn responseObject;\n\t} catch (e: any) {\n\t\tconsole.error(e);\n\t\treturn responseObject;\n\t}\n}\n\nfunction getQuery(body: string): string {\n\tconst query = { query: `query { ${body} }` };\n\treturn JSON.stringify(query);\n}\n\nfunction getQueryBody(args: QueryBodyGQLArgsType): string {\n\tconst paginator = args.paginator ? args.paginator : PAGINATORS.default;\n\tconst ids = args.ids ? JSON.stringify(args.ids) : null;\n\tlet blockFilter: { min?: number; max?: number } | null = null;\n\tif (args.minBlock !== undefined && args.minBlock !== null) {\n\t\tblockFilter = {};\n\t\tblockFilter.min = args.minBlock;\n\t}\n\tconst blockFilterStr = blockFilter ? JSON.stringify(blockFilter).replace(/\"([^\"]+)\":/g, '$1:') : null;\n\tconst tags = args.tags\n\t\t? JSON.stringify(args.tags)\n\t\t\t\t.replace(/\"(name)\":/g, '$1:')\n\t\t\t\t.replace(/\"(values)\":/g, '$1:')\n\t\t\t\t.replace(/\"match\"/g, 'match')\n\t\t\t\t.replace(/\"FUZZY_OR\"/g, 'FUZZY_OR')\n\t\t: null;\n\tconst owners = args.owners ? JSON.stringify(args.owners) : null;\n\tconst recipients = args.recipients ? JSON.stringify(args.recipients) : null;\n\tconst cursor = args.cursor && args.cursor !== CURSORS.end ? `\"${args.cursor}\"` : null;\n\t\n\tlet sort: string = '';\n\tif (args.sort) {\n\t\tsort += 'sort: '\n\t\tswitch (args.sort) {\n\t\t\tcase 'ascending':\n\t\t\t\tsort += 'HEIGHT_ASC';\n\t\t\t\tbreak;\n\t\t\tcase 'descending':\n\t\t\t\tsort += 'HEIGHT_DESC';\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tlet fetchCount: string = `first: ${paginator}`;\n\tlet txCount: string = '';\n\tlet nodeFields: string = `data { size type } owner { address } block { height timestamp }`;\n\tlet recipientsfield: string = '';\n\n\tconst gateway = args.gateway ?? GATEWAYS.goldsky;\n\tswitch (gateway) {\n\t\tcase GATEWAYS.arweave:\n\t\t\tbreak;\n\t\tcase GATEWAYS.goldsky:\n\t\t\tif (!cursor) txCount = `count`;\n\t\t\tif (recipients) recipientsfield = `recipients: ${recipients}`;\n\t\t\tnodeFields += ` recipient`\n\t\t\tbreak;\n\t}\n\n\tlet body = `\n\t\ttransactions(\n\t\t\t\tids: ${ids},\n\t\t\t\ttags: ${tags},\n\t\t\t\t${fetchCount}\n\t\t\t\towners: ${owners},\n\t\t\t\t${recipientsfield},\n\t\t\t\tblock: ${blockFilterStr},\n\t\t\t\tafter: ${cursor},\n\t\t\t\t${sort}\n\t\t\t){\n\t\t\t${txCount}\n\t\t\t\tpageInfo {\n\t\t\t\t\thasNextPage\n\t\t\t\t}\n\t\t\t\tedges {\n\t\t\t\t\tcursor\n\t\t\t\t\tnode {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttags {\n\t\t\t\t\t\t\tname \n\t\t\t\t\t\t\tvalue \n\t\t\t\t\t\t}\n\t\t\t\t\t\t${nodeFields}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}`;\n\n\tif (args.queryKey) body = `${args.queryKey}: ${body}`;\n\n\treturn body;\n}\n\nasync function getResponse(args: { gateway: string; query: string }): Promise<any> {\n\ttry {\n\t\tconst response = await fetch(`https://${args.gateway}/graphql`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: args.query,\n\t\t});\n\t\treturn await response.json();\n\t} catch (e: any) {\n\t\tthrow e;\n\t}\n}\n", "\nimport { ReadableStream } from 'web-streams-polyfill';\n/* Used for build - Do not remove ! */\nimport Arweave from 'arweave';\n\n// import { ArweaveWebARx } from '@permaweb/arx/web/tokens/arweave';\n// import { ArconnectSigner, TurboFactory } from '@ardrive/turbo-sdk/web';\nimport { TAGS, UPLOAD } from '../helpers/config.ts';\nimport { DependencyType, TagType } from '../helpers/types.ts';\nimport { checkValidAddress, getBase64Data, getByteSize, getDataURLContentType, globalLog } from '../helpers/utils.ts';\n\n// TurboFactory.setLogLevel('debug')\n\nexport function resolveTransactionWith(deps: DependencyType) {\n\treturn async (data: any) => {\n\t\tif (checkValidAddress(data)) return data;\n\t\tif (!deps.arweave) throw new Error(`Must initialize with Arweave in order to create transactions`);\n\t\ttry {\n\t\t\treturn await createTransaction(deps, { data: data });\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error resolving transaction');\n\t\t}\n\t};\n}\n\nexport async function resolveTransaction(deps: DependencyType, data: any) {\n\tif (checkValidAddress(data)) return data;\n\tif (!deps.arweave) throw new Error(`Must initialize with Arweave in order to create transactions`);\n\ttry {\n\t\treturn await createTransaction(deps, { data: data });\n\t} catch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error resolving transaction');\n\t}\n}\n\nexport async function createTransaction(\n\tdeps: DependencyType,\n\targs: {\n\t\tdata: File | string;\n\t\ttags?: TagType[];\n\t},\n): Promise<string> {\n\tlet content: any = null;\n\tlet contentType: string | null = null;\n\tlet contentSize: number | null = null;\n\n\tif (typeof args.data === 'string') {\n\t\tcontent = Buffer.from(getBase64Data(args.data), 'base64');\n\t\tcontentType = getDataURLContentType(args.data);\n\t\tcontentSize = getByteSize(content);\n\t}\n\n\tif (args.data instanceof File) {\n\t\tcontent = new Uint8Array(await args.data.arrayBuffer());\n\t\tcontentType = args.data.type;\n\t\tcontentSize = args.data.size;\n\t}\n\n\tif (content && contentType && contentSize) {\n\t\tif (contentSize < Number(UPLOAD.dispatchUploadSize)) {\n\t\t\ttry {\n\t\t\t\tconst tx = await deps.arweave.createTransaction({ data: content }, 'use_wallet');\n\t\t\t\ttx.addTag(TAGS.keys.contentType, contentType);\n\t\t\t\tif (args.tags && args.tags.length > 0) args.tags.forEach((tag: TagType) => tx.addTag(tag.name, tag.value));\n\n\t\t\t\tconst response = await global.window.arweaveWallet.dispatch(tx);\n\t\t\t\treturn response.id;\n\t\t\t}\n\t\t\tcatch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error dispatching transaction');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('Paid uploads are not yet supported');\n\t\t\t\n\t\t\t// const arx = new ArweaveWebARx({ url: UPLOAD.node1, wallet: { provider: window.arweaveWallet } });\n\n\t\t\t// await arx.ready();\n\n\t\t\t// console.log(arx)\n\n\t\t\t// let uploader = arx.uploader.chunkedUploader;\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// uploader.setBatchSize(UPLOAD.batchSize);\n\t\t\t// uploader.setChunkSize(UPLOAD.chunkSize);\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// uploader.on('chunkUpload', (chunkInfo) => {\n\t\t\t// \t// setUploadPercentage(Math.floor((chunkInfo.totalUploaded / uploadReducer.data.content.size) * 100));\n\t\t\t// \tconsole.log('---')\n\t\t\t// });\n\n\t\t\t// uploader.on('chunkError', (e) => {\n\t\t\t// \tconsole.error(e);\n\t\t\t// });\n\n\t\t\t// console.log(uploader)\n\n\t\t\t// const buffer = await fileToBuffer(uploadReducer.data.content);\n\t\t\t// const txResponse = await uploader.uploadData(content, { tags: [{ name: TAGS.keys.contentType, value: contentType }] });\n\n\t\t\t// console.log(txResponse)\n\n\t\t\t// try {\n\t\t\t// \tconst signer = new ArconnectSigner(window.arweaveWallet);\n\t\t\t// \tconst turbo = TurboFactory.authenticated({ signer });\n\n\t\t\t// \tconst response = await turbo.uploadFile({\n\t\t\t// \t\tfileStreamFactory: () =>\n\t\t\t// \t\t\tnew ReadableStream({\n\t\t\t// \t\t\t\tstart(controller) {\n\t\t\t// \t\t\t\t\tcontroller.enqueue(content);\n\t\t\t// \t\t\t\t\tcontroller.close();\n\t\t\t// \t\t\t\t},\n\t\t\t// \t\t\t}),\n\t\t\t// \t\tfileSizeFactory: () => contentSize,\n\t\t\t// \t\tdataItemOpts: {\n\t\t\t// \t\t\ttags: [{ name: TAGS.keys.contentType, value: contentType }]\n\t\t\t// \t\t},\n\t\t\t// \t});\n\t\t\t// \treturn response.id;\n\t\t\t// }\n\t\t\t// catch (e: any) {\n\t\t\t// \tthrow new Error(e.message ?? 'Error bundling transaction');\n\t\t\t// }\n\t\t}\n\t} else {\n\t\tthrow new Error('Error preparing transaction data');\n\t}\n}\n", "export * from './config.ts';\nexport * from './endpoints.ts';\nexport * from './types.ts';\nexport * from './utils.ts';\n", "export type DependencyType = {\n\tao: any;\n\tsigner?: any;\n\tarweave?: any;\n};\n\nexport type ProcessSpawnType = {\n\tmodule: string;\n\tscheduler: string;\n\tdata: any;\n\ttags: TagType[];\n\twallet: any;\n};\n\nexport type ProcessCreateType = {\n\tmodule?: string;\n\tscheduler?: string;\n\tdata?: any;\n\ttags?: TagType[];\n\tevalTags?: TagType[];\n\tevalTxId?: string;\n\tevalSrc?: string;\n};\n\nexport type MessageSendType = {\n\tprocessId: string;\n\taction: string;\n\ttags?: TagType[] | null;\n\tdata?: any;\n\tuseRawData?: boolean;\n};\n\nexport type MessageResultType = {\n\tmessageId: string;\n\tprocessId: string;\n\taction: string;\n};\n\nexport type MessageDryRunType = {\n\tprocessId: string;\n\taction: string;\n\ttags?: TagType[] | null;\n\tdata?: string | object;\n};\n\nexport type ZoneType = { store: any; assets: ZoneAssetType[] };\n\nexport type ZoneAssetType = { id: string; balance: string; dateCreated: number; lastUpdate: number };\n\nexport type ProfileArgsType = {\n\tusername: string;\n\tdisplayName: string;\n\tdescription: string;\n\tthumbnail?: any;\n\tbanner?: any;\n};\n\nexport type ProfileType = {\n\tid: string;\n\twalletAddress: string;\n\tusername: string;\n\tdisplayName: string;\n\tdescription: string;\n\tthumbnail?: any;\n\tbanner?: any;\n\tassets: { id: string; quantity: string }[];\n} & any;\n\nexport type AssetCreateArgsType = {\n\tname: string;\n\tdescription: string;\n\ttopics: string[];\n\tcreator: string;\n\tdata: any;\n\tcontentType: string;\n\tassetType: string;\n\tsupply?: number;\n\tdenomination?: number;\n\ttransferable?: boolean;\n\tmetadata?: object;\t\n\ttags?: TagType[];\n\tsrc?: string;\n\tusers?: string[];\n};\n\nexport type AssetHeaderType = {\n\tid: string;\n\towner: string | null\n};\n\nexport type AssetDetailType = {\n\tid: string;\n\tname: string;\n\tticker: string;\n\tdenomination: string;\n\ttotalSupply: string;\n\ttransferable: string;\n\tcreator: string;\n\tbalances: object;\n\tmetadata: any;\n\tdateCreated: string;\n\tlastUpdate: string;\n}\n\nexport type CommentHeaderType = {\n\tid: string; \n\tcontent: string;\n\tparentId: string; \n\trootId: string\n};\n\nexport type CommentDetailType = {\n\tcontent: string;\n\tparentId: string;\n\trootId: string;\n}\n\nexport type CommentCreateArgType = { content: string; creator: string; parentId: string; rootId?: string, tags?: TagType[] };\n\nexport type CollectionManifestType = {\n\ttype: string;\n\titems: string[];\n};\n\nexport type CollectionType = {\n\tid: string;\n\ttitle: string;\n\tdescription: string | null;\n\tcreator: string;\n\tdateCreated: string;\n\tbanner: string | null;\n\tthumbnail: string | null;\n};\n\nexport type CollectionDetailType = CollectionType & {\n\tassetIds: string[];\n};\n\nexport type UDLicenseType = {\n\taccess: UDLicenseValueType | null;\n\tderivations: UDLicenseValueType | null;\n\tcommercialUse: UDLicenseValueType | null;\n\tdataModelTraining: UDLicenseValueType | null;\n\tpaymentMode: string | null;\n\tpaymentAddress: string | null;\n\tcurrency: string | null;\n};\n\nexport type UDLicenseValueType = {\n\tvalue: string | null;\n\ticon?: string;\n\tendText?: string;\n};\n\nexport type BaseGQLArgsType = {\n\tids?: string[] | null;\n\ttags?: TagFilterType[] | null;\n\towners?: string[] | null;\n\trecipients?: string[] | null;\n\tcursor?: string | null;\n\tpaginator?: number;\n\tminBlock?: number;\n\tmaxBlock?: number;\n\tsort?: GQLSortType;\n};\n\nexport type GQLArgsType = { gateway: string } & BaseGQLArgsType;\n\nexport type QueryBodyGQLArgsType = BaseGQLArgsType & { gateway?: string; queryKey?: string };\n\nexport type BatchGQLArgsType = {\n\tgateway: string;\n\tentries: { [queryKey: string]: BaseGQLArgsType };\n};\n\nexport type GQLNodeResponseType = {\n\tcursor: string | null;\n\tnode: {\n\t\tid: string;\n\t\ttags: TagType[];\n\t\trecipient?: string;\n\t\tdata: {\n\t\t\tsize: string;\n\t\t\ttype: string;\n\t\t};\n\t\towner: {\n\t\t\taddress: string;\n\t\t};\n\t\tblock: {\n\t\t\theight: number;\n\t\t\ttimestamp: number;\n\t\t};\n\t};\n};\n\nexport type GQLResponseType = {\n\tcount: number;\n\tnextCursor: string | null;\n\tpreviousCursor: string | null;\n};\n\nexport type DefaultGQLResponseType = {\n\tdata: GQLNodeResponseType[];\n} & GQLResponseType;\n\nexport type BatchAGQLResponseType = { [queryKey: string]: DefaultGQLResponseType };\n\nexport type TagType = { name: string; value: string };\n\nexport type TagFilterType = { name: string; values: string[]; match?: string };\n\nexport type GQLSortType = 'ascending' | 'descending';\n", "export * from './assets.ts';\nexport * from './collections.ts';\nexport * from './comments.ts';\nexport * from './profiles.ts';\nexport * from './zones.ts';\n", "import { aoCreateProcess, aoDryRun, readProcess } from '../common/ao.ts';\nimport { getGQLData } from '../common/gql.ts';\nimport { AO, CONTENT_TYPES, GATEWAYS, TAGS } from '../helpers/config.ts';\nimport {\n\tAssetCreateArgsType,\n\tAssetDetailType,\n\tAssetHeaderType,\n\tDependencyType,\n\tGQLNodeResponseType,\n\tTagType\n} from '../helpers/types.ts';\nimport { getBootTag, mapFromProcessCase, mapToProcessCase } from '../helpers/utils.ts';\n\nexport function createAtomicAssetWith(deps: DependencyType) {\n\treturn async (args: AssetCreateArgsType, callback?: (status: any) => void) => {\n\t\tconst validationError = getValidationErrorMessage(args);\n\t\tif (validationError) throw new Error(validationError);\n\n\t\tconst data = CONTENT_TYPES[args.contentType]?.serialize(args.data) ?? args.data;\n\t\tconst tags = buildAssetCreateTags(args);\n\n\t\ttry {\n\t\t\tconst assetId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ tags: tags, data: data },\n\t\t\t\tcallback ? (status: any) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\treturn assetId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating asset');\n\t\t}\n\t};\n}\n\nexport async function getAtomicAsset(\n\tdeps: DependencyType,\n\tid: string,\n\targs?: { useGateway?: boolean }\n): Promise<AssetDetailType | null> {\n\ttry {\n\t\tconst processInfo = mapFromProcessCase(await readProcess(deps, {\n\t\t\tprocessId: id,\n\t\t\tpath: 'asset',\n\t\t\tfallbackAction: 'Info',\n\t\t}));\n\n\t\tif (args?.useGateway) {\n\t\t\tconst gqlResponse = await getGQLData({\n\t\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\t\tids: [id],\n\t\t\t\ttags: null,\n\t\t\t\towners: null,\n\t\t\t\tcursor: null,\n\t\t\t});\n\n\t\t\tconst gatewayAsset = gqlResponse?.data?.[0]\n\t\t\t\t? buildAsset(gqlResponse.data[0])\n\t\t\t\t: {};\n\t\t\t\n\t\t\treturn {\n\t\t\t\t...gatewayAsset,\n\t\t\t\t...processInfo,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tid: id,\n\t\t\t...processInfo\n\t\t}\n\t} catch (e: any) {\n\t\tthrow new Error(e.message || 'Error fetching atomic asset');\n\t}\n}\n\nexport function getAtomicAssetWith(deps: DependencyType) {\n\treturn async (id: string, args?: { useGateway?: boolean }): Promise<AssetDetailType | null> => {\n\t\treturn await getAtomicAsset(deps, id, args);\n\t};\n}\n\nexport async function getAtomicAssets(ids: string[]): Promise<AssetHeaderType[] | null> {\n\ttry {\n\t\tconst gqlResponse = await getGQLData({\n\t\t\tgateway: GATEWAYS.arweave,\n\t\t\tids: ids ?? null,\n\t\t\ttags: null,\n\t\t\towners: null,\n\t\t\tcursor: null,\n\t\t});\n\n\t\tif (gqlResponse && gqlResponse.data.length) {\n\t\t\treturn gqlResponse.data.map((element: GQLNodeResponseType) => buildAsset(element));\n\t\t}\n\n\t\treturn null;\n\t} catch (e: any) {\n\t\tthrow new Error(e);\n\t}\n}\n\nexport function buildAsset(element: GQLNodeResponseType): any {\n\tconst asset: any = { id: element.node.id, owner: element.node.owner.address };\n\n\tfor (const tag of element.node.tags) {\n\t\tconst originalKey = tag.name;\n\n\t\tconst keyWithoutPrefix = originalKey.startsWith(`${TAGS.keys.bootloader}-`)\n\t\t\t? originalKey.slice(`${TAGS.keys.bootloader}-`.length)\n\t\t\t: originalKey;\n\n\t\tconst formattedKey = keyWithoutPrefix\n\t\t\t.split('-')\n\t\t\t.map((part, index) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? part.toLowerCase()\n\t\t\t\t\t: part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()\n\t\t\t)\n\t\t\t.join('');\n\n\t\tlet decodedValue;\n\t\ttry {\n\t\t\tdecodedValue = JSON.parse(tag.value);\n\t\t} catch {\n\t\t\tdecodedValue = tag.value.toString();\n\t\t}\n\n\t\tasset[formattedKey] = decodedValue;\n\t}\n\n\treturn asset;\n}\n\nfunction buildAssetCreateTags(args: AssetCreateArgsType): { name: string; value: string }[] {\n\tconst tags = [\n\t\t{ name: TAGS.keys.onBoot, value: args.src ?? AO.src.asset },\n\t\t{ name: TAGS.keys.creator, value: args.creator },\n\t\t{ name: TAGS.keys.assetType, value: args.assetType },\n\t\t{ name: TAGS.keys.contentType, value: args.contentType },\n\t\t{ name: TAGS.keys.implements, value: 'ANS-110' },\n\t\t{ name: TAGS.keys.dateCreated, value: new Date().getTime().toString() },\n\t\tgetBootTag('Name', args.name),\n\t\tgetBootTag('Description', args.description),\n\t\tgetBootTag('Topics', JSON.stringify(args.topics)),\n\t\tgetBootTag('Ticker', 'ATOMIC'),\n\t\tgetBootTag('Denomination', args.denomination?.toString() ?? '1'),\n\t\tgetBootTag('TotalSupply', args.supply?.toString() ?? '1'),\n\t\tgetBootTag('Transferable', args.transferable?.toString() ?? 'true'),\n\t\tgetBootTag('Creator', args.creator),\n\t];\n\n\tif (args.metadata) {\n\t\tfor (const entry in args.metadata) {\n\t\t\ttags.push(getBootTag(mapToProcessCase(entry), (args.metadata as any)[entry].toString()));\n\t\t}\n\t}\n\t\n\tif (args.users) {\n\t\tfor (const user of args.users) {\n\t\t\ttags.push({ name: 'Auth-User', value: user });\n\t\t}\n\t}\n\n\tif (args.tags) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\treturn tags;\n}\n\nfunction getValidationErrorMessage(args: AssetCreateArgsType): string | null {\n\tif (typeof args !== 'object' || args === null) return 'The provided arguments are invalid or empty.';\n\n\tconst requiredFields = ['name', 'description', 'topics', 'creator', 'data', 'contentType', 'assetType'];\n\tfor (const field of requiredFields) {\n\t\tif (!(field in args)) return `Missing field '${field}'`;\n\t}\n\n\tif (typeof args.name !== 'string' || args.name.trim() === '') return 'Name is required';\n\tif (typeof args.description !== 'string') return 'The description must be a valid string';\n\tif (!Array.isArray(args.topics) || args.topics.length === 0) return 'Topics are required';\n\tif (typeof args.creator !== 'string' || args.creator.trim() === '') return 'Creator is required';\n\tif (args.data === undefined || args.data === null) return 'Data field is required';\n\tif (typeof args.contentType !== 'string' || args.contentType.trim() === '')\n\t\treturn 'Content type must be a non-empty string';\n\tif (typeof args.assetType !== 'string' || args.assetType.trim() === '') return 'Type must be a non-empty string';\n\n\tif ('supply' in args && (typeof args.supply !== 'number' || args.supply <= 0))\n\t\treturn 'Supply must be a positive number';\n\tif ('denomination' in args && (typeof args.denomination !== 'number' || args.denomination <= 0))\n\t\treturn 'Denomination must be a positive number';\n\tif ('transferable' in args && typeof args.transferable !== 'boolean') return 'Transferable must be a boolean value';\n\tif ('metadata' in args && typeof args.metadata !== 'object') return 'Metadata must be an object';\n\tif ('tags' in args && (!Array.isArray(args.tags) || args.tags.some((tag) => typeof tag !== 'object')))\n\t\treturn 'Tags must be an array of objects';\n\tif ('src' in args && typeof args.src !== 'string') return 'Source must be a valid string';\n\n\treturn null;\n}\n", "import { aoCreateProcess, aoDryRun, aoSend } from '../common/ao.ts';\nimport { resolveTransaction } from '../common/arweave.ts';\nimport { AO, TAGS } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport { CollectionDetailType, CollectionType, DependencyType, TagType } from '../helpers/types.ts';\nimport { cleanProcessField, cleanTagValue, globalLog } from '../helpers/utils.ts';\n\nconst DEFAULT_COLLECTION_BANNER = 'eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo';\nconst DEFAULT_COLLECTION_THUMBNAIL = 'lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk';\n\nexport function createCollectionWith(deps: DependencyType) {\n\treturn async (args: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tcreator: string;\n\t\tthumbnail: any;\n\t\tbanner: any;\n\t\tskipRegistry?: boolean;\n\t\tskipActivity?: boolean;\n\t}, callback?: (status: any) => void) => {\n\t\tif (!deps.signer) throw new Error(`No signer provided`);\n\n\t\tconst dateTime = new Date().getTime().toString();\n\t\tconst tags: TagType[] = [\n\t\t\t{ name: TAGS.keys.contentType, value: 'application/json' },\n\t\t\t{ name: TAGS.keys.creator, value: args.creator },\n\t\t\t{\n\t\t\t\tname: TAGS.keys.ans110.title,\n\t\t\t\tvalue: cleanTagValue(args.title),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: TAGS.keys.ans110.description,\n\t\t\t\tvalue: cleanTagValue(args.description),\n\t\t\t},\n\t\t\t{ name: TAGS.keys.dateCreated, value: dateTime },\n\t\t\t{\n\t\t\t\tname: TAGS.keys.name,\n\t\t\t\tvalue: cleanTagValue(args.title),\n\t\t\t},\n\t\t\t{ name: 'Action', value: 'Add-Collection' },\n\t\t];\n\n\t\tlet thumbnailTx = null;\n\t\tlet bannerTx = null;\n\n\t\ttry {\n\t\t\tthumbnailTx = args.banner ? await resolveTransaction(deps, args.thumbnail) : DEFAULT_COLLECTION_THUMBNAIL;\n\t\t\tbannerTx = args.banner ? await resolveTransaction(deps, args.banner) : DEFAULT_COLLECTION_BANNER;\n\n\t\t\tif (args.thumbnail)\n\t\t\t\ttags.push({\n\t\t\t\t\tname: TAGS.keys.thumbnail,\n\t\t\t\t\tvalue: thumbnailTx,\n\t\t\t\t});\n\n\t\t\tif (args.banner)\n\t\t\t\ttags.push({\n\t\t\t\t\tname: TAGS.keys.banner,\n\t\t\t\t\tvalue: bannerTx,\n\t\t\t\t});\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tconsole.error(e);\n\t\t}\n\n\t\tconst processSrcFetch = await fetch(getTxEndpoint(AO.src.collection));\n\t\tif (!processSrcFetch.ok) throw new Error(`Unable to fetch process src`);\n\n\t\tlet processSrc = await processSrcFetch.text();\n\n\t\tprocessSrc = processSrc.replace(/'<NAME>'/g, cleanProcessField(args.title));\n\t\tprocessSrc = processSrc.replace(/'<DESCRIPTION>'/g, cleanProcessField(args.description));\n\t\tprocessSrc = processSrc.replace(/<CREATOR>/g, args.creator);\n\t\tprocessSrc = processSrc.replace(/<THUMBNAIL>/g, thumbnailTx ? thumbnailTx : DEFAULT_COLLECTION_THUMBNAIL);\n\t\tprocessSrc = processSrc.replace(/<BANNER>/g, bannerTx ? bannerTx : DEFAULT_COLLECTION_THUMBNAIL);\n\t\tprocessSrc = processSrc.replace(/<DATECREATED>/g, dateTime);\n\t\tprocessSrc = processSrc.replace(/<LASTUPDATE>/g, dateTime);\n\n\t\ttry {\n\t\t\tconst collectionId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ tags: tags },\n\t\t\t\tcallback ? (status) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\tglobalLog('Sending eval message to collection...');\n\t\t\tif (callback) callback('Sending eval message to collection...');\n\t\t\tawait deps.ao.message({\n\t\t\t\tprocess: collectionId,\n\t\t\t\tsigner: deps.signer,\n\t\t\t\ttags: [{ name: 'Action', value: 'Eval' }],\n\t\t\t\tdata: processSrc,\n\t\t\t});\n\n\t\t\tif (!args.skipRegistry) {\n\t\t\t\tglobalLog('Sending collection to registry...');\n\t\t\t\tif (callback) callback('Sending collection to registry...');\n\n\t\t\t\tconst registryTags = [\n\t\t\t\t\t{ name: 'Action', value: 'Add-Collection' },\n\t\t\t\t\t{ name: 'CollectionId', value: collectionId },\n\t\t\t\t\t{ name: 'Name', value: cleanTagValue(args.title) },\n\t\t\t\t\t{ name: 'Creator', value: args.creator },\n\t\t\t\t\t{ name: 'DateCreated', value: dateTime },\n\t\t\t\t];\n\t\n\t\t\t\tif (bannerTx) registryTags.push({ name: 'Banner', value: bannerTx });\n\t\t\t\tif (thumbnailTx) registryTags.push({ name: 'Thumbnail', value: thumbnailTx });\n\n\t\t\t\tawait deps.ao.message({\n\t\t\t\t\tprocess: AO.collectionRegistry,\n\t\t\t\t\tsigner: deps.signer,\n\t\t\t\t\ttags: registryTags,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!args.skipActivity) {\n\t\t\t\tglobalLog('Creating collection activity process...');\n\t\t\t\tif (callback) callback('Creating collection activity process...');\n\t\t\t\t\n\t\t\t\tconst activityTags = [\n\t\t\t\t\t{ name: 'CollectionId', value: collectionId },\n\t\t\t\t\t{ name: 'DateCreated', value: dateTime },\n\t\t\t\t\t{ name: 'UCM-Process', value: 'Collection-Activity' },\n\t\t\t\t\t{ name: 'On-Boot', value: AO.src.collectionActivity },\n\t\t\t\t];\n\t\t\t\t\n\t\t\t\tconst collectionActivityId = await aoCreateProcess(\n\t\t\t\t\tdeps,\n\t\t\t\t\t{ tags: activityTags },\n\t\t\t\t\tcallback ? (status) => callback(status) : undefined,\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\tglobalLog('Adding activity to collection process...');\n\t\t\t\tif (callback) callback('Adding activity to collection process...');\n\t\t\t\tawait deps.ao.message({\n\t\t\t\t\tprocess: collectionId,\n\t\t\t\t\tsigner: deps.signer,\n\t\t\t\t\ttags: [{ name: 'Action', value: 'Eval' }],\n\t\t\t\t\tdata: `ActivityProcess = '${collectionActivityId}'`,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn collectionId;\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating collection')\n\t\t}\n\t};\n}\n\nexport function updateCollectionAssetsWith(deps: DependencyType) {\n\treturn async (args: { collectionId: string; assetIds: string[]; creator: string; updateType: 'Add' | 'Remove' }): Promise<string> => {\n\t\treturn await aoSend(deps, {\n\t\t\tprocessId: args.creator,\n\t\t\taction: 'Run-Action',\n\t\t\ttags: [\n\t\t\t\t{ name: 'ForwardTo', value: args.collectionId },\n\t\t\t\t{ name: 'ForwardAction', value: 'Update-Assets' }\n\t\t\t],\n\t\t\tdata: {\n\t\t\t\tTarget: args.collectionId,\n\t\t\t\tAction: 'Update-Assets',\n\t\t\t\tInput: JSON.stringify({\n\t\t\t\t\tAssetIds: args.assetIds,\n\t\t\t\t\tUpdateType: args.updateType,\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t};\n}\n\nexport function getCollectionWith(deps: DependencyType) {\n\treturn async (collectionId: string): Promise<CollectionDetailType | null> => {\n\t\tconst response = await aoDryRun(deps, {\n\t\t\tprocessId: collectionId,\n\t\t\taction: 'Info',\n\t\t});\n\n\t\tconst collection = {\n\t\t\tid: collectionId,\n\t\t\ttitle: response.Name,\n\t\t\tdescription: response.Description,\n\t\t\tcreator: response.Creator,\n\t\t\tdateCreated: response.DateCreated,\n\t\t\tthumbnail: response.Thumbnail ?? DEFAULT_COLLECTION_THUMBNAIL,\n\t\t\tbanner: response.Banner ?? DEFAULT_COLLECTION_THUMBNAIL,\n\t\t};\n\n\t\treturn {\n\t\t\t...collection,\n\t\t\tassetIds: response.Assets,\n\t\t};\n\t};\n}\n\nexport function getCollectionsWith(deps: DependencyType) {\n\treturn async (args: { creator?: string }): Promise<CollectionType[] | null> => {\n\t\tconst action = args.creator ? 'Get-Collections-By-User' : 'Get-Collections';\n\n\t\tconst response = await aoDryRun(deps, {\n\t\t\tprocessId: AO.collectionRegistry,\n\t\t\taction: action,\n\t\t\ttags: args.creator ? [{ name: 'Creator', value: args.creator }] : null,\n\t\t});\n\n\t\tif (response && response.Collections && response.Collections.length) {\n\t\t\tconst collections = response.Collections.map((collection: any) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: collection.Id,\n\t\t\t\t\ttitle: collection.Name.replace(/\\[|\\]/g, ''),\n\t\t\t\t\tdescription: collection.Description,\n\t\t\t\t\tcreator: collection.Creator,\n\t\t\t\t\tdateCreated: collection.DateCreated,\n\t\t\t\t\tbanner: collection.Banner,\n\t\t\t\t\tthumbnail: collection.Thumbnail,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn collections;\n\t\t}\n\n\t\treturn null;\n\t};\n}\n", "import { getGQLData } from '../common/gql.ts';\nimport { GATEWAYS } from '../helpers/config.ts';\nimport { getTxEndpoint } from '../helpers/endpoints.ts';\nimport {\n\tAssetCreateArgsType,\n\tCommentCreateArgType,\n\tCommentDetailType,\n\tDependencyType,\n\tGQLNodeResponseType,\n\tTagFilterType,\n} from '../helpers/types.ts';\n\nimport { buildAsset, createAtomicAssetWith, getAtomicAsset } from './assets.ts';\n\nexport function createCommentWith(deps: DependencyType) {\n\tconst createAtomicAsset = createAtomicAssetWith(deps);\n\treturn async (args: CommentCreateArgType, callback?: (status: any) => void) => {\n\t\tconst tags = args.tags ? args.tags : [];\n\n\t\ttags.push({ name: 'Data-Source', value: args.parentId });\n\t\ttags.push({ name: 'Root-Source', value: args.rootId ?? args.parentId });\n\n\t\tconst assetArgs: AssetCreateArgsType = {\n\t\t\tname: `Comment on ${args.parentId}`,\n\t\t\tdescription: `Comment on ${args.parentId}`,\n\t\t\ttopics: ['comment'],\n\t\t\tcreator: args.creator,\n\t\t\tdata: args.content,\n\t\t\tcontentType: 'text/plain',\n\t\t\tassetType: 'comment',\n\t\t\ttags,\n\t\t};\n\n\t\treturn createAtomicAsset(assetArgs, callback);\n\t};\n}\n\nexport function getCommentWith(deps: DependencyType) {\n\treturn async (id: string): Promise<CommentDetailType | null> => {\n\t\ttry {\n\t\t\tconst asset: any = await getAtomicAsset(deps, id, { useGateway: true });\n\n\t\t\tconst dataSource = asset?.dataSource\n\t\t\tconst rootSource = asset?.rootSource\n\n\t\t\tif (!dataSource || !rootSource) throw new Error(`dataSource and rootSource must be present on a comment`);\n\n\t\t\treturn {\n\t\t\t\tcontent: await getCommentData(id),\n\t\t\t\tparentId: dataSource,\n\t\t\t\trootId: rootSource,\n\t\t\t};\n\t\t}\n\t\tcatch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error getting comment');\n\t\t}\n\t};\n}\n\nexport function getCommentsWith(_deps: DependencyType) {\n\treturn async (args: { parentId?: string; rootId?: string }) => {\n\t\tif (!args.parentId && !args.rootId) {\n\t\t\tthrow new Error(`Must provide either parentId or rootId`);\n\t\t}\n\n\t\tconst tags: TagFilterType[] = [];\n\n\t\tif (args.parentId)\n\t\t\ttags.push({\n\t\t\t\tname: 'Data-Source',\n\t\t\t\tvalues: [args.parentId ?? ''],\n\t\t\t});\n\n\t\tif (args.rootId)\n\t\t\ttags.push({\n\t\t\t\tname: 'Root-Source',\n\t\t\t\tvalues: [args.rootId ?? ''],\n\t\t\t});\n\n\t\tconst gqlResponse = await getGQLData({\n\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\tids: null,\n\t\t\ttags,\n\t\t\towners: null,\n\t\t\tcursor: null,\n\t\t});\n\n\t\tlet assets: any[] = [];\n\n\t\tif (gqlResponse && gqlResponse.data.length) {\n\t\t\tassets = gqlResponse.data.map((element: GQLNodeResponseType) => buildAsset(element));\n\t\t}\n\n\t\tconst comments = [];\n\t\tfor (const asset of assets) {\n\t\t\tconst dataSource = asset?.dataSource;\n\t\t\tconst rootSource = asset?.rootSource;\n\n\t\t\tif (!dataSource || !rootSource) throw new Error(`dataSource and rootSource must be present on a comment`);\n\n\t\t\tcomments.push({\n\t\t\t\tid: asset.id,\n\t\t\t\tcontent: await getCommentData(asset.id),\n\t\t\t\tparentId: dataSource,\n\t\t\t\trootId: rootSource,\n\t\t\t})\n\t\t}\n\n\t\treturn comments;\n\t};\n}\n\nasync function getCommentData(id: string) {\n\ttry {\n\t\treturn await (await fetch(getTxEndpoint(id))).text();\n\t}\n\tcatch (e: any) {\n\t\tthrow new Error(e.message ?? 'Error getting comment data')\n\t}\n}\n", "import { GATEWAYS, TAGS } from 'helpers/config.ts';\n\nimport { resolveTransaction } from '../common/arweave.ts';\nimport { getGQLData } from '../common/gql.ts';\nimport { DependencyType, GQLNodeResponseType, ProfileArgsType, ProfileType } from '../helpers/types.ts';\nimport { getBootTag } from '../helpers/utils.ts';\n\nimport { createZoneWith, getZoneWith, updateZoneWith } from './zones.ts';\n\nexport function createProfileWith(deps: DependencyType) {\n\tconst createZone = createZoneWith(deps);\n\n\treturn async (args: ProfileArgsType, callback?: (status: any) => void): Promise<string | null> => {\n\t\tlet profileId: string | null = null;\n\n\t\tconst tags: { name: string; value: string }[] = [\n\t\t\t{ name: TAGS.keys.dataProtocol, value: TAGS.values.zone },\n\t\t\t{ name: TAGS.keys.zoneType, value: TAGS.values.user },\n\t\t];\n\n\t\tconst addImageTag = async (imageKey: 'Thumbnail' | 'Banner') => {\n\t\t\tconst key: any = imageKey.toLowerCase();\n\t\t\tif ((args as any)[key]) {\n\t\t\t\ttry {\n\t\t\t\t\tconst resolvedImage = await resolveTransaction(deps, (args as any)[key]);\n\t\t\t\t\ttags.push(getBootTag(imageKey, resolvedImage));\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve ${imageKey}: ${e.message}`);\n\t\t\t\t\telse console.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (args.username) tags.push(getBootTag('Username', args.username));\n\t\tif (args.displayName) tags.push(getBootTag('DisplayName', args.displayName));\n\t\tif (args.description) tags.push(getBootTag('Description', args.description));\n\n\t\tawait Promise.all([addImageTag('Thumbnail'), addImageTag('Banner')]);\n\n\t\ttry {\n\t\t\tprofileId = await createZone({ tags: tags }, callback);\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating profile');\n\t\t}\n\n\t\treturn profileId;\n\t};\n}\n\nexport function updateProfileWith(deps: DependencyType) {\n\tconst updateZone = updateZoneWith(deps);\n\n\treturn async (args: ProfileArgsType, profileId: string, callback?: (status: any) => void): Promise<string | null> => {\n\t\tif (profileId) {\n\t\t\tlet data: any = {\n\t\t\t\tUsername: args.username,\n\t\t\t\tDisplayName: args.displayName,\n\t\t\t\tDescription: args.description,\n\t\t\t};\n\n\t\t\tif (args.thumbnail) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.Thumbnail = await resolveTransaction(deps, args.thumbnail);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve thumbnail: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (args.banner) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.Banner = await resolveTransaction(deps, args.banner);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tif (callback) callback(`Failed to resolve banner: ${e.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\treturn await updateZone(data, profileId);\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(e.message ?? 'Error creating profile');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error('No profile provided');\n\t\t}\n\t};\n}\n\nexport function getProfileByIdWith(deps: DependencyType) {\n\tconst getZone = getZoneWith(deps);\n\n\treturn async (profileId: string): Promise<ProfileType | null> => {\n\t\ttry {\n\t\t\tconst zone = await getZone(profileId);\n\t\t\tif (!zone) {\n\t\t\t\tthrow new Error('Error fetching profile - Not found');\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: profileId,\n\t\t\t\towner: zone.owner,\n\t\t\t\tassets: zone.assets,\n\t\t\t\troles: zone.roles,\n\t\t\t\tinvites: zone.invites,\n\t\t\t\tversion: zone.version,\n\t\t\t\t...zone.store,\n\t\t\t};\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n\nexport function getProfileByWalletAddressWith(deps: DependencyType) {\n\tconst getProfileById = getProfileByIdWith(deps);\n\n\treturn async (walletAddress: string): Promise<(ProfileType & any) | null> => {\n\t\ttry {\n\t\t\tconst gqlResponse = await getGQLData({\n\t\t\t\tgateway: GATEWAYS.goldsky,\n\t\t\t\ttags: [\n\t\t\t\t\t{ name: TAGS.keys.dataProtocol, values: [TAGS.values.zone] },\n\t\t\t\t\t{ name: TAGS.keys.zoneType, values: [TAGS.values.user] },\n\t\t\t\t],\n\t\t\t\towners: [walletAddress],\n\t\t\t});\n\n\t\t\tif (gqlResponse?.data?.length > 0) {\n\t\t\t\tgqlResponse.data.sort((a: GQLNodeResponseType, b: GQLNodeResponseType) => {\n\t\t\t\t\tconst timestampA = a.node.block?.timestamp ?? 0;\n\t\t\t\t\tconst timestampB = b.node.block?.timestamp ?? 0;\n\t\t\t\t\treturn timestampB - timestampA;\n\t\t\t\t});\n\n\t\t\t\treturn await getProfileById(gqlResponse.data[0].node.id);\n\t\t\t}\n\n\t\t\treturn { id: null };\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error fetching profile');\n\t\t}\n\t};\n}\n", "import { aoCreateProcess, aoDryRun, aoSend, readProcess } from '../common/ao.ts';\nimport { AO, TAGS } from '../helpers/config.ts';\nimport { DependencyType, TagType } from '../helpers/types.ts';\nimport { checkValidAddress, mapFromProcessCase } from '../helpers/utils.ts';\n\nexport function createZoneWith(deps: DependencyType) {\n\treturn async (args: { data?: any; tags?: TagType[] }, callback?: (status: any) => void): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst tags = [{ name: TAGS.keys.onBoot, value: AO.src.zone }];\n\t\t\tif (args.tags && args.tags.length) args.tags.forEach((tag: TagType) => tags.push(tag));\n\n\t\t\tconst zoneId = await aoCreateProcess(\n\t\t\t\tdeps,\n\t\t\t\t{ data: args.data, tags: tags },\n\t\t\t\tcallback ? (status: any) => callback(status) : undefined,\n\t\t\t);\n\n\t\t\treturn zoneId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error creating zone');\n\t\t}\n\t};\n}\n\nexport function updateZoneWith(deps: DependencyType) {\n\treturn async (args: object, zoneId: string): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst mappedData = Object.entries(args).map(([key, value]) => ({ key, value }));\n\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Zone-Update',\n\t\t\t\tdata: mappedData,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n\nexport function addToZoneWith(deps: DependencyType) {\n\treturn async (args: { path: string; data: object }, zoneId: string): Promise<string | null> => {\n\t\ttry {\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Zone-Append',\n\t\t\t\ttags: [{ name: 'Path', value: args.path }],\n\t\t\t\tdata: args.data,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n\nexport function getZoneWith(deps: DependencyType) {\n\treturn async (zoneId: string): Promise<any | null> => {\n\t\ttry {\n\t\t\tconst processInfo = await readProcess(deps, { processId: zoneId, path: 'zone', fallbackAction: 'Info' });\n\n\t\t\treturn mapFromProcessCase(processInfo);\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e.message ?? 'Error getting zone');\n\t\t}\n\t};\n}\n\nexport function setZoneRolesWith(deps: DependencyType) {\n\treturn async (args: { granteeId: string, roles: string[], type: 'wallet' | 'process', sendInvite: boolean }[], zoneId: string): Promise<string | null> => {\n\t\tconst zoneValid = checkValidAddress(zoneId);\n\t\tif (!zoneValid) throw new Error('Invalid zone address');\n\n\t\tconst data = [];\n\t\tfor (const entry of args) {\n\t\t\tconst granteeValid = checkValidAddress(entry.granteeId);\n\n\t\t\tif (!granteeValid) throw new Error('Invalid granteeId address');\n\t\t\tif (entry.type !== 'wallet' && entry.type !== 'process') throw new Error('Invalid role type');\n\n\t\t\tdata.push({\n\t\t\t\tId: entry.granteeId,\n\t\t\t\tRoles: entry.roles,\n\t\t\t\tType: entry.type,\n\t\t\t\tSendInvite: entry.sendInvite\n\t\t\t})\n\t\t}\n\n\t\ttry {\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Role-Set',\n\t\t\t\ttags: [],\n\t\t\t\tdata: data,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n\nexport function joinZoneWith(deps: DependencyType) {\n\treturn async (args: { zoneToJoinId: string, path?: string }, zoneId: string): Promise<string | null> => {\n\t\tconst zoneValid = checkValidAddress(zoneId) && checkValidAddress(args.zoneToJoinId);\n\n\t\tif (!zoneValid) throw new Error('Invalid zone address');\n\n\t\tconst tags = [{ name: 'ZoneId', value: args.zoneToJoinId }];\n\t\tif (args.path) tags.push({ name: 'Path', value: args.path });\n\n\t\ttry {\n\t\t\tconst zoneUpdateId = await aoSend(deps, {\n\t\t\t\tprocessId: zoneId,\n\t\t\t\taction: 'Zone-Join',\n\t\t\t\ttags: tags,\n\t\t\t});\n\n\t\t\treturn zoneUpdateId;\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(e);\n\t\t}\n\t};\n}\n"],
|
|
5
|
+
"mappings": "yhBAAA,IAAAA,EAAAC,GAAA,CAAAC,GAAAC,KAAA,CACA,IAAIC,EAAUD,GAAO,QAAU,CAAC,EAO5BE,EACAC,EAEJ,SAASC,GAAmB,CACxB,MAAM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,EAGhD,mBAA2BqB,GAAuBrB,CAAI,EACtD,WAAmBsB,EACnB,qBAA6BC,GAC7B,cAAsBC,GAAoBxB,CAAI,EAC9C,YAAoByB,GAAazB,CAAI,EACrC,YAAoB0B,GAAW1B,CAAI,EACnC,eAAuB2B,GAGvB,mBAA4BC,EAC5B,iBAA0BC,CAC3B,CACD,CAEA,IAAOC,GAAQ,CAAE,KAAA/B,EAAK",
|
|
6
|
+
"names": ["require_browser", "__commonJSMin", "exports", "module", "process", "cachedSetTimeout", "cachedClearTimeout", "defaultSetTimout", "defaultClearTimeout", "runTimeout", "fun", "runClearTimeout", "marker", "queue", "draining", "currentQueue", "queueIndex", "cleanUpNextTick", "drainQueue", "timeout", "len", "args", "i", "Item", "array", "noop", "name", "dir", "import_browser", "import_browser", "import_browser", "import_browser", "AO", "CONTENT_TYPES", "data", "GATEWAYS", "TAGS", "UPLOAD", "import_browser", "import_browser", "checkValidAddress", "address", "getTagValue", "list", "name", "i", "getDataURLContentType", "dataURL", "result", "getBase64Data", "getByteSize", "input", "sizeInBytes", "cleanProcessField", "value", "updatedValue", "cleanTagValue", "globalLog", "args", "toProcessCase", "str", "match", "mapToProcessCase", "obj", "acc", "key", "value", "toKey", "checkValidAddress", "fromProcessCase", "mapFromProcessCase", "fromKey", "getBootTag", "capitalizedKey", "TAGS", "arweaveEndpoint", "getTxEndpoint", "txId", "arweaveEndpoint", "import_browser", "CURSORS", "PAGINATORS", "getGQLData", "args", "paginator", "data", "count", "nextCursor", "queryBody", "getQueryBody", "response", "getResponse", "GATEWAYS", "getQuery", "e", "getAggregatedGQLData", "callback", "index", "fetchResult", "aggregatedData", "getQuery", "body", "query", "getQueryBody", "args", "paginator", "PAGINATORS", "ids", "blockFilter", "blockFilterStr", "tags", "owners", "recipients", "cursor", "CURSORS", "sort", "fetchCount", "txCount", "nodeFields", "recipientsfield", "GATEWAYS", "getResponse", "e", "GATEWAY", "GATEWAYS", "GATEWAY_RETRY_COUNT", "aoSpawn", "deps", "args", "tags", "AO", "tag", "processId", "globalLog", "e", "aoSendWith", "aoSend", "data", "readProcess", "aoDryRun", "aoDryRunWith", "dataPayload", "response", "acc", "item", "aoMessageResult", "Messages", "message", "action", "getTagValue", "responseData", "messageData", "responseStatus", "responseMessage", "handleProcessEval", "deps", "args", "src", "fetchProcessSrc", "evalMessage", "aoSend", "globalLog", "aoMessageResult", "e", "aoCreateProcessWith", "statusCB", "spawnArgs", "AO", "processId", "aoSpawn", "aoCreateProcess", "txId", "getTxEndpoint", "waitForProcess", "retries", "retryLimit", "GATEWAY_RETRY_COUNT", "resolve", "gqlResponse", "getGQLData", "GATEWAY", "foundProcess", "import_browser", "resolveTransactionWith", "deps", "data", "checkValidAddress", "createTransaction", "e", "resolveTransaction", "args", "content", "contentType", "contentSize", "getBase64Data", "getDataURLContentType", "getByteSize", "UPLOAD", "tx", "TAGS", "tag", "import_browser", "types_exports", "import_browser", "import_browser", "import_browser", "createAtomicAssetWith", "deps", "args", "callback", "validationError", "getValidationErrorMessage", "data", "CONTENT_TYPES", "tags", "buildAssetCreateTags", "aoCreateProcess", "status", "e", "getAtomicAsset", "id", "processInfo", "mapFromProcessCase", "readProcess", "gqlResponse", "getGQLData", "GATEWAYS", "buildAsset", "getAtomicAssetWith", "getAtomicAssets", "ids", "element", "asset", "tag", "originalKey", "formattedKey", "TAGS", "part", "index", "decodedValue", "AO", "getBootTag", "entry", "mapToProcessCase", "user", "requiredFields", "field", "import_browser", "DEFAULT_COLLECTION_BANNER", "DEFAULT_COLLECTION_THUMBNAIL", "createCollectionWith", "deps", "args", "callback", "dateTime", "tags", "TAGS", "cleanTagValue", "thumbnailTx", "bannerTx", "resolveTransaction", "e", "processSrcFetch", "getTxEndpoint", "AO", "processSrc", "cleanProcessField", "collectionId", "aoCreateProcess", "status", "globalLog", "registryTags", "activityTags", "collectionActivityId", "updateCollectionAssetsWith", "aoSend", "getCollectionWith", "response", "aoDryRun", "getCollectionsWith", "action", "collection", "import_browser", "createCommentWith", "deps", "createAtomicAsset", "createAtomicAssetWith", "args", "callback", "tags", "assetArgs", "getCommentWith", "id", "asset", "getAtomicAsset", "dataSource", "rootSource", "getCommentData", "e", "getCommentsWith", "_deps", "gqlResponse", "getGQLData", "GATEWAYS", "assets", "element", "buildAsset", "comments", "getTxEndpoint", "import_browser", "import_browser", "createZoneWith", "deps", "args", "callback", "tags", "TAGS", "AO", "tag", "aoCreateProcess", "status", "e", "updateZoneWith", "zoneId", "mappedData", "key", "value", "aoSend", "addToZoneWith", "getZoneWith", "processInfo", "readProcess", "mapFromProcessCase", "setZoneRolesWith", "checkValidAddress", "data", "entry", "joinZoneWith", "createProfileWith", "deps", "createZone", "createZoneWith", "args", "callback", "profileId", "tags", "TAGS", "addImageTag", "imageKey", "key", "resolvedImage", "resolveTransaction", "getBootTag", "e", "updateProfileWith", "updateZone", "updateZoneWith", "data", "getProfileByIdWith", "getZone", "getZoneWith", "zone", "getProfileByWalletAddressWith", "getProfileById", "walletAddress", "gqlResponse", "getGQLData", "GATEWAYS", "a", "b", "timestampA", "init", "deps", "createZoneWith", "updateZoneWith", "addToZoneWith", "getZoneWith", "setZoneRolesWith", "joinZoneWith", "createProfileWith", "updateProfileWith", "getProfileByIdWith", "getProfileByWalletAddressWith", "createAtomicAssetWith", "getAtomicAssetWith", "getAtomicAssets", "createCommentWith", "getCommentWith", "getCommentsWith", "createCollectionWith", "updateCollectionAssetsWith", "getCollectionWith", "getCollectionsWith", "resolveTransactionWith", "getGQLData", "getAggregatedGQLData", "aoCreateProcessWith", "aoDryRunWith", "aoSendWith", "waitForProcess", "mapFromProcessCase", "mapToProcessCase", "index_default"]
|
|
7
7
|
}
|
|
@@ -45,7 +45,6 @@ export declare const TAGS: {
|
|
|
45
45
|
assetType: string;
|
|
46
46
|
banner: string;
|
|
47
47
|
bootloader: string;
|
|
48
|
-
bootloaderInit: string;
|
|
49
48
|
collectionId: string;
|
|
50
49
|
collectionName: string;
|
|
51
50
|
commericalUse: string;
|
|
@@ -63,6 +62,7 @@ export declare const TAGS: {
|
|
|
63
62
|
initialOwner: string;
|
|
64
63
|
license: string;
|
|
65
64
|
name: string;
|
|
65
|
+
onBoot: string;
|
|
66
66
|
paymentAddress: string;
|
|
67
67
|
paymentMode: string;
|
|
68
68
|
profileCreator: string;
|