<commit_before>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.INTERFACE({
  package: 'foam.nanos.crunch',
  name: 'CrunchService',
  documentation: `
    CrunchService provides common logic used by the client and other CRUNCH
    services.
  `,

  javaImports: [
    'foam.dao.ArraySink',
    'foam.nanos.auth.Subject',
    'foam.nanos.crunch.CapabilityJunctionPayload',
    'foam.nanos.crunch.ui.WizardState'
  ],

  topics: [
    'updateJunction'
  ],

  methods: [
    {
      name: 'getPrereqs',
      type: 'java.util.List<String>',
      args: [
        { name: 'capId', type: 'String' }
      ],
      flags: ['java']
    },
    {
      name: 'getGrantPath',
      documentation: `
        getGrantPath provides an array of capability objects representing
        the list of capabilities required to grant the desired capability.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        }
      ]
    },
    {
      name: 'getCapabilityPathFor',
      documentation: `
        Returns the capability path with the requested subject set in the context.
        Requires permission to overwrite context's subject, otherwise returns
        capability path with default context.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        },
        {
          name: 'filterGrantedUCJ',
          type: 'boolean'
        },
        {
          name: 'effectiveUser',
          type: 'foam.nanos.auth.User'
        },
        {
          name: 'user',
          type: 'foam.nanos.auth.User'
        }
      ]
    },
    {
      name: 'getCapabilityPath',
      documentation: `
        getGrantPath provides an array of capability objects representing
        the list of capabilities required to grant the desired capability.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        },
        {
          name: 'filterGrantedUCJ',
          type: 'boolean'
        }
      ]
    },
    {
      name: 'getDependentIds',
      type: 'String[]',
      args: [
        {
          name: 'x',
          type: 'Context'<commit_msg>Make getDependnetIds CrunchService method async.<commit_after>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.INTERFACE({
  package: 'foam.nanos.crunch',
  name: 'CrunchService',
  documentation: `
    CrunchService provides common logic used by the client and other CRUNCH
    services.
  `,

  javaImports: [
    'foam.dao.ArraySink',
    'foam.nanos.auth.Subject',
    'foam.nanos.crunch.CapabilityJunctionPayload',
    'foam.nanos.crunch.ui.WizardState'
  ],

  topics: [
    'updateJunction'
  ],

  methods: [
    {
      name: 'getPrereqs',
      type: 'java.util.List<String>',
      args: [
        { name: 'capId', type: 'String' }
      ],
      flags: ['java']
    },
    {
      name: 'getGrantPath',
      documentation: `
        getGrantPath provides an array of capability objects representing
        the list of capabilities required to grant the desired capability.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        }
      ]
    },
    {
      name: 'getCapabilityPathFor',
      documentation: `
        Returns the capability path with the requested subject set in the context.
        Requires permission to overwrite context's subject, otherwise returns
        capability path with default context.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        },
        {
          name: 'filterGrantedUCJ',
          type: 'boolean'
        },
        {
          name: 'effectiveUser',
          type: 'foam.nanos.auth.User'
        },
        {
          name: 'user',
          type: 'foam.nanos.auth.User'
        }
      ]
    },
    {
      name: 'getCapabilityPath',
      documentation: `
        getGrantPath provides an array of capability objects representing
        the list of capabilities required to grant the desired capability.
      `,
      async: true,
      type: 'List',
      args: [
        {
          name: 'x',
          type: 'Context'
        },
        {
          name: 'sourceId',
          type: 'String'
        },
        {
          name: 'filterGrantedUCJ',
          type: 'boolean'
        }
      ]
    },
    {
      name: 'getDependentIds',
      async: true,
      type: 'String[]',
      args: [
        {
          name: 'x',
          type: 'Context'
{'fraction_non_alphanumeric': 0.1169260700389105, 'fraction_numerical': 0.0023346303501945525, 'mean_word_length': 1.5653692614770458, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '960812', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1517, 'n_words': 369}