UNPKG

n8n-nodes-wax

Version:

n8n Community Node Package for the WAX Blockchain

77 lines 2.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.schemaProperties = void 0; exports.executeSchemaOperations = executeSchemaOperations; const atomic_1 = require("./atomic"); const util_1 = require("./util"); exports.schemaProperties = [ { displayName: 'Operation', name: 'operation', type: 'hidden', noDataExpression: true, displayOptions: { show: { resource: ['schema'], }, }, options: [ { name: 'Get Schema Format', value: 'getSchemaFormat', description: 'Retrieve the field definitions of a schema', action: 'Retrieve the field definitions of a schema', }, ], default: 'getSchemaFormat', }, { displayName: 'Collection Name', name: 'collectionName', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['schema'], operation: ['getSchemaFormat'], }, }, description: 'AtomicAssets collection that owns the schema', }, { displayName: 'Schema Name', name: 'schemaName', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['schema'], operation: ['getSchemaFormat'], }, }, }, ]; async function executeSchemaOperations(items, i) { const operation = this.getNodeParameter('operation', i); const rawEndpoint = this.getNodeParameter('endpoint', i); const endpoint = (0, util_1.validateEndpoint)(this, rawEndpoint); if (operation === 'getSchemaFormat') { const collectionName = (0, util_1.requireAccountName)(this, this.getNodeParameter('collectionName', i), 'Collection Name'); const schemaName = (0, util_1.requireAccountName)(this, this.getNodeParameter('schemaName', i), 'Schema Name'); const rpc = (0, atomic_1.createAtomicRpc)(this, endpoint); const format = await (0, atomic_1.fetchSchemaFormat)(this, rpc, collectionName, schemaName); return { returnData: { json: { collection_name: collectionName, schema_name: schemaName, format, }, }, }; } return {}; } //# sourceMappingURL=schema.js.map