<commit_before>remote = require('app/remote').getInstance()


setStackTemplateCredential = (options, callback) ->

  { stackTemplate, credential } = options
  { credentials }    = stackTemplate
  credentials.custom = [credential.identifier]

  stackTemplate.update { credentials }, (err) ->
    callback err, stackTemplate


createAndUpdate = (options, callback) ->

  { provider, title, meta, stackTemplate } = options
  { JCredential } = remote.api

  JCredential.create { provider, title, meta }, (err, credential) ->
    return callback err  if err<commit_msg>UpdateCustomVariable: share custom variables with the group [completes #103184312]<commit_after>kd     = require 'kd'
remote = require('app/remote').getInstance()


setStackTemplateCredential = (options, callback) ->

  { stackTemplate, credential } = options
  { credentials }    = stackTemplate
  credentials.custom = [credential.identifier]

  # After adding custom variable, we are sharing it with the current
  # group, so anyone in this group can reach these custom variables ~ GG
  { slug } = kd.singletons.groupsController.getCurrentGroup()

  credential.shareWith { target: slug }, (err) ->
    console.warn 'Failed to share credential:', err  if err

    stackTemplate.update { credentials }, (err) ->
      callback err, stackTemplate


createAndUpdate = (options, callback) ->

  { provider, title, meta, stackTemplate } = options
  { JCredential } = remote.api

  JCredential.create { provider, title, meta }, (err, credential) ->
    return callback err  if err
{'fraction_non_alphanumeric': 0.1078622482131254, 'fraction_numerical': 0.005847953216374269, 'mean_word_length': 4.099337748344371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7586813', 'n_tokens_mistral': 435, 'n_tokens_neox': 413, 'n_words': 125}