<commit_before>/*
 * This file is part of quickbooks-js
 * https://github.com/RappidDevelopment/quickbooks-js
 *
 * Based on qbws: https://github.com/johnballantyne/qbws
 *
 * (c) 2015 johnballantyne
 * (c) 2016 Rappid Development LLC
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

var http = require('http');
var soap = require('soap');
var chalk = require('chalk');
var fs = require('fs');
var builder = require('xmlbuilder');
var uuid = require('node-uuid');

var qbws,
    server,
    counter = null,
    connectionErrCounter = null,
    username = 'username',
    password = 'password',
    // Change companyFile to an empty string to use the company file
    //     currently open in Quickbooks
    companyFile = 'C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Sample Company Files\\QuickBooks 2014\\sample_wholesale-distribution business.qbw',
    req = [],
    config = {
        'verbosity': 2
    };

/**
 * @function buildWsdl
 *
 * @desc Fetches the wsdl file; address location is changed if set in config.
 *
 * @summary If needed, set `'wsdlAddress'` within config to build a correct
 *   wsdl file. This is likely unecessary if you're not connecting to your web
 *   service with a client other than the QuickBooks Web Connector. The Web
 *   Connector doesn't seem to care if the address location is incorrect, but
 *   connecting using a client created with the soap package does.
 *
 * @param {String} wsdlFileLocation - Optional. Defaults to `'/qbws.wsdl'`.
 *
 * @returns {String} The wsdl file.
 */
function buildWsdl(wsdlFileLocation) {
    var wsdl,
        address = config.wsdlAddress;

    wsdlFileLocation = wsdlFileLocation || '/qbws.wsdl';
    wsdl = fs.readFileSync(__dirname + wsdlFileLocation, 'utf8');

    if (address) {
        wsdl = wsdl.replace(/<soap:address\ +location=".*"\ +\/>/,<commit_msg>feat: adding `env` variable support<commit_after>/*
 * This file is part of quickbooks-js
 * https://github.com/RappidDevelopment/quickbooks-js
 *
 * Based on qbws: https://github.com/johnballantyne/qbws
 *
 * (c) 2015 johnballantyne
 * (c) 2016 Rappid Development LLC
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

var http = require('http');
var soap = require('soap');
var chalk = require('chalk');
var fs = require('fs');
var builder = require('xmlbuilder');
var uuid = require('node-uuid');

var qbws,
    server,
    counter = null,
    connectionErrCounter = null,
    username = process.env.QB_USERNAME || 'username',
    password = process.env.QB_PASSWORD || 'password',
    // Change companyFile to an empty string to use the company file
    //     currently open in Quickbooks
    companyFile = process.env.QB_COMPANY_FILE || 'C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Sample Company Files\\QuickBooks 2014\\sample_wholesale-distribution business.qbw',
    req = [],
    config = {
        'verbosity': 2
    };

/**
 * @function buildWsdl
 *
 * @desc Fetches the wsdl file; address location is changed if set in config.
 *
 * @summary If needed, set `'wsdlAddress'` within config to build a correct
 *   wsdl file. This is likely unecessary if you're not connecting to your web
 *   service with a client other than the QuickBooks Web Connector. The Web
 *   Connector doesn't seem to care if the address location is incorrect, but
 *   connecting using a client created with the soap package does.
 *
 * @param {String} wsdlFileLocation - Optional. Defaults to `'/qbws.wsdl'`.
 *
 * @returns {String} The wsdl file.
 */
function buildWsdl(wsdlFileLocation) {
    var wsdl,
        address = config.wsdlAddress;

    wsdlFileLocation = wsdlFileLocation || '/qbws.wsdl';
    wsdl = fs.readFileSync(__dirname + wsdlFileLocation, 'utf8');

    if (address) {
        wsdl = wsdl.replace(/<soap:address\ +location=".*"\ +\/>/,
{'fraction_non_alphanumeric': 0.1170670037926675, 'fraction_numerical': 0.007079646017699115, 'mean_word_length': 3.4399551066217735, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5340737', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1169, 'n_words': 399}