Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
allow humanProper from language-common
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Feb 19, 2018
1 parent 55b012d commit 47b0b18
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 70 deletions.
8 changes: 7 additions & 1 deletion lib/Adaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.alterState = exports.arrayToString = exports.toArray = exports.beta = exports.index = exports.lastReferenceValue = exports.referencePath = exports.dataValue = exports.dataPath = exports.merge = exports.combine = exports.map = exports.sourceValue = exports.source = exports.field = exports.fields = exports.join = exports.each = exports.relationship = exports.lookup = exports.reference = exports.update = exports.upsertIf = exports.upsert = exports.createIf = exports.create = exports.describe = undefined;
exports.humanProper = exports.alterState = exports.arrayToString = exports.toArray = exports.beta = exports.index = exports.lastReferenceValue = exports.referencePath = exports.dataValue = exports.dataPath = exports.merge = exports.combine = exports.map = exports.sourceValue = exports.source = exports.field = exports.fields = exports.join = exports.each = exports.relationship = exports.lookup = exports.reference = exports.update = exports.upsertIf = exports.upsert = exports.createIf = exports.create = exports.describe = undefined;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** @module Adaptor */

Expand Down Expand Up @@ -146,6 +146,12 @@ Object.defineProperty(exports, 'alterState', {
return _languageCommon.alterState;
}
});
Object.defineProperty(exports, 'humanProper', {
enumerable: true,
get: function get() {
return _languageCommon.humanProper;
}
});

var _jsforce = require('jsforce');

Expand Down
74 changes: 9 additions & 65 deletions lib/FakeAdaptor.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/** @module FakeAdaptor */
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.alterState = exports.arrayToString = exports.toArray = exports.beta = exports.index = exports.lastReferenceValue = exports.referencePath = exports.dataValue = exports.dataPath = exports.merge = exports.combine = exports.map = exports.sourceValue = exports.source = exports.field = exports.fields = exports.join = exports.each = exports.relationship = exports.lookup = exports.upsert = exports.update = exports.steps = exports.reference = exports.execute = exports.create = undefined;
exports.humanProper = exports.alterState = exports.arrayToString = exports.toArray = exports.beta = exports.index = exports.lastReferenceValue = exports.referencePath = exports.dataValue = exports.dataPath = exports.merge = exports.combine = exports.map = exports.sourceValue = exports.source = exports.field = exports.fields = exports.join = exports.each = exports.relationship = exports.lookup = exports.upsert = exports.update = exports.steps = exports.reference = exports.execute = exports.create = undefined;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

Expand Down Expand Up @@ -133,22 +132,19 @@ Object.defineProperty(exports, 'alterState', {
return _languageCommon.alterState;
}
});
Object.defineProperty(exports, 'humanProper', {
enumerable: true,
get: function get() {
return _languageCommon.humanProper;
}
});

var _lodashFp = require('lodash-fp');

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

/** @module FakeAdaptor */

/**
* Flattens an array of operations.
* @example
* steps(
* createIf(params),
* update(params)
* )
* @function
* @returns {Array}
*/
function steps() {
for (var _len = arguments.length, operations = Array(_len), _key = 0; _key < _len; _key++) {
operations[_key] = arguments[_key];
Expand All @@ -157,40 +153,13 @@ function steps() {
return (0, _lodashFp.flatten)(operations);
}

/**
* Expands references.
* @example
* expandReferences(
* state,
* {
* attr1: "foo",
* attr2: "bar"
* }
* )
* @function
* @param {Object} attrs - Field attributes for the new object.
* @param {State} state - Runtime state.
* @returns {State}
*/
// TODO: use the one from language-common
function expandReferences(attrs, state) {
// TODO: use the one from language-common
return (0, _lodashFp.mapValues)(function (value) {
return typeof value == 'function' ? value(state) : value;
})(attrs);
}

/**
* Create a new object.
* @example
* create('obj_name', {
* attr1: "foo",
* attr2: "bar"
* })
* @function
* @param {String} sObject - API name of the sObject.
* @param {Object} fields - Field attributes for the new object.
* @returns {Operation}
*/
function create(sObject, fields) {

return function (state) {
Expand All @@ -208,18 +177,6 @@ function create(sObject, fields) {
};
}

/**
* Update an object.
* @example
* update('obj_name', {
* attr1: "foo",
* attr2: "bar"
* })
* @function
* @param {String} sObject - API name of the sObject.
* @param {Object} fields - Field attributes for the new object.
* @returns {Operation}
*/
function update(sObject, fields) {

return function (state) {
Expand All @@ -237,19 +194,6 @@ function update(sObject, fields) {
};
}

/**
* Upsert an object.
* @example
* upsert('obj_name', 'ext_id', {
* attr1: "foo",
* attr2: "bar"
* })
* @function
* @param {String} sObject - API name of the sObject.
* @param {String} externalId - ID.
* @param {Object} fields - Field attributes for the new object.
* @returns {Operation}
*/
function upsert(sObject, externalId, fields) {

return function (state) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "language-salesforce",
"version": "0.5.1",
"version": "0.6.0",
"description": "Salesforce Language Pack for OpenFn",
"main": "lib/index.js",
"scripts": {
Expand All @@ -20,7 +20,7 @@
"dependencies": {
"JSONPath": "^0.10.0",
"jsforce": "1.5.1",
"language-common": "github:openfn/language-common#v0.0.5",
"language-common": "github:openfn/language-common#v0.3.0",
"lodash-fp": "^0.10.2",
"mustache": "^2.2.0",
"yargs": "^3.30.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Adaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,5 @@ export { lookup, relationship } from './sourceHelpers';
export {
each, join, fields, field, source, sourceValue, map, combine,
merge, dataPath, dataValue, referencePath, lastReferenceValue,
index, beta, toArray, arrayToString, alterState
index, beta, toArray, arrayToString, alterState, humanProper
} from 'language-common';
2 changes: 1 addition & 1 deletion src/FakeAdaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ export { lookup, relationship } from './sourceHelpers';
export {
each, join, fields, field, source, sourceValue, map, combine,
merge, dataPath, dataValue, referencePath, lastReferenceValue,
index, beta, toArray, arrayToString, alterState
index, beta, toArray, arrayToString, alterState, humanProper
} from 'language-common';

0 comments on commit 47b0b18

Please sign in to comment.