How to use the @arcblock/sdk-util/lib/util.fakeMessage function in @arcblock/sdk-util

To help you get started, we’ve selected a few @arcblock/sdk-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArcBlock / forge-js / forge / graphql-client / tools / generate-types.js View on Github external
let type = typesMap[name];
    if (originName && !type) {
      type =
        queries.find(x => x.name === originName) ||
        mutations.find(x => x.name === originName) ||
        subscriptions.find(x => x.name === originName);

      if (type) {
        type.fields = type.args;
      }
    }
    return `
 *
 * Checkout the following snippet for the format of ${name}:
 * \`\`\`json
${JSON.stringify(fakeMessage(type, typesMap, 'fields'), true, '  ')}
 * \`\`\``;
  } catch (err) {
    console.error('cannot print fake message', name);
    return '';
  }
};
github ArcBlock / forge-js / forge / graphql-client / tools / doc-util.js View on Github external
.reduce((obj, x) => {
      if (x.type.ofType) {
        if (x.type.kind === 'LIST') {
          obj[x.name] = [fakeField(x.type.ofType, typesMap)];
        } else if (x.type.ofType.kind === 'SCALAR') {
          obj[x.name] = fakeField(x.type.ofType, typesMap);
        } else if (['INPUT_OBJECT', 'OBJECT'].includes(x.type.ofType.kind)) {
          obj[x.name] = fakeMessage(typesMap[x.type.ofType.name], typesMap);
        } else {
          console.log('ignoreX', x);
        }
      } else if (x.type.kind === 'SCALAR') {
        obj[x.name] = fakeField(x.type, typesMap);
      }

      return obj;
    }, {});

@arcblock/sdk-util

Helpers and utilities shared across ArcBlock Javascript SDK

Apache-2.0
Latest version published 1 year ago

Package Health Score

46 / 100
Full package analysis