@8base/utils
Advanced tools
Comparing version 0.2.11 to 0.2.12
@@ -208,2 +208,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
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; }; | ||
var _ramda = __webpack_require__(/*! ramda */ "ramda"); | ||
@@ -256,6 +258,5 @@ | ||
return { | ||
...result, | ||
return _extends({}, result, { | ||
[fieldName]: (0, _formatFieldDataForMutation.formatFieldDataForMutation)(type, fieldSchema, data[fieldName], schema) | ||
}; | ||
}); | ||
}, {}, R.keys(data)); | ||
@@ -265,2 +266,3 @@ | ||
}; | ||
exports.formatDataForMutation = formatDataForMutation; | ||
@@ -267,0 +269,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("ramda")):"function"==typeof define&&define.amd?define("utils",["ramda"],r):"object"==typeof exports?exports.utils=r(require("ramda")):e.utils=r(e.ramda)}("undefined"!=typeof self?self:this,function(e){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=8)}([function(r,t){r.exports=e},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.FIELD_TYPE={DATE:"DATE",FILE:"FILE",ID:"ID",NUMBER:"NUMBER",RELATION:"RELATION",SWITCH:"SWITCH",TEXT:"TEXT",CUSTOM:"CUSTOM"},r.SWITCH_FORMATS={ON_OFF:"ON_OFF",YES_NO:"YES_NO",TRUE_FALSE:"TRUE_FALSE",ACTIVE_INACTIVE:"ACTIVE_INACTIVE",HIGH_LOW:"HIGH_LOW",CUSTOM:"CUSTOM"},r.TEXT_FORMATS={UNFORMATTED:"UNFORMATTED",NAME:"NAME",ADDRESS:"ADDRESS",SSN:"SSN",EIN:"EIN",PHONE:"PHONE",EMAIL:"EMAIL"},r.NUMBER_FORMATS={NUMBER:"NUMBER",CURRENCY:"CURRENCY",PERCENTAGE:"PERCENTAGE",FRACTION:"FRACTION",SCIENTIFIC:"SCIENTIFIC"},r.FILE_FORMATS={FILE:"FILE",IMAGE:"IMAGE"},r.DATE_FORMATS={DATE:"DATE",DATETIME:"DATE/TIME"},r.MUTATION_TYPE={CREATE:"CREATE",UPDATE:"UPDATE"}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(13);Object.defineProperty(r,"hasIdTokenExpiredError",{enumerable:!0,get:function(){return n.hasIdTokenExpiredError}});var o=t(14);Object.defineProperty(r,"hasRefreshTokenExpiredError",{enumerable:!0,get:function(){return o.hasRefreshTokenExpiredError}});var i=t(4);Object.defineProperty(r,"isFileField",{enumerable:!0,get:function(){return i.isFileField}});var a=t(15);Object.defineProperty(r,"isFileInstance",{enumerable:!0,get:function(){return a.isFileInstance}});var u=t(16);Object.defineProperty(r,"isFileReference",{enumerable:!0,get:function(){return u.isFileReference}});var l=t(17);Object.defineProperty(r,"isListField",{enumerable:!0,get:function(){return l.isListField}});var f=t(18);Object.defineProperty(r,"isMetaField",{enumerable:!0,get:function(){return f.isMetaField}});var c=t(5);Object.defineProperty(r,"isRelationField",{enumerable:!0,get:function(){return c.isRelationField}});var s=t(19);Object.defineProperty(r,"isRelationInstance",{enumerable:!0,get:function(){return s.isRelationInstance}});var d=t(20);Object.defineProperty(r,"isRelationReference",{enumerable:!0,get:function(){return d.isRelationReference}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(10);Object.defineProperty(r,"getFieldSchemaByName",{enumerable:!0,get:function(){return n.getFieldSchemaByName}});var o=t(11);Object.defineProperty(r,"getTableSchemaByName",{enumerable:!0,get:function(){return o.getTableSchemaByName}});var i=t(12);Object.defineProperty(r,"getTableSchemaById",{enumerable:!0,get:function(){return i.getTableSchemaById}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileField=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(1);const i=n.propEq("fieldType",o.FIELD_TYPE.FILE);r.isFileField=i},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationField=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(1);const i=n.propEq("fieldType",o.FIELD_TYPE.RELATION);r.isRelationField=i},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatDataForMutation=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(1),i=t(3),a=t(2),u=t(21);r.formatDataForMutation=((e,r,t,l)=>{if(n.not(e in o.MUTATION_TYPE))throw new Error(`Invalid mutation type: ${e}`);const f=(0,i.getTableSchemaByName)(r,l);if(!f)throw new Error(`Table schema with ${r} name not found in schema.`);return n.reduce((r,n)=>{if("_description"===n||"__typename"===n)return r;const o=(0,i.getFieldSchemaByName)(n,f);if(!o)throw new Error(`Field schema with ${n} name not found in table schema with ${f.name} name.`);return(0,a.isMetaField)(o)?r:{...r,[n]:(0,u.formatFieldDataForMutation)(e,o,t[n],l)}},{},n.keys(t))})},function(e,r){e.exports={InternalErrorCode:"InternalError",InvalidTokenErrorCode:"InvalidTokenError",NotAuthorizedErrorCode:"NotAuthorizedError",MissingHeaderErrorCode:"MissingHeaderError",TokenExpiredErrorCode:"TokenExpiredError",InvitationExpiredErrorCode:"InvitationExpiredError",UserNotConfirmedErrorCode:"UserNotConfirmedError",ValidationErrorCode:"ValidationError",EntityExistsErrorCode:"EntityExistsError",EntityNotFoundErrorCode:"EntityNotFoundError",InvalidArgumentErrorCode:"InvalidArgumentError",MutationErrorCode:"MutationError",ForcibleErrorCode:"ForcibleError"}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(1);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}})});var o=t(9);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})});var i=t(3);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})});var a=t(2);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(6);Object.defineProperty(r,"formatDataForMutation",{enumerable:!0,get:function(){return n.formatDataForMutation}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getFieldSchemaByName=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getFieldSchemaByName=((e,r)=>n.find(n.propEq("name",e),r.fields))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getTableSchemaByName=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getTableSchemaByName=((e,r)=>n.find(n.propEq("name",e),r))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getTableSchemaById=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getTableSchemaById=((e,r)=>n.find(n.propEq("id",e),r))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasIdTokenExpiredError=void 0;var n=i(t(0)),o=i(t(7));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}r.hasIdTokenExpiredError=n.any(n.allPass([n.propEq("code",o.TokenExpiredErrorCode),n.propEq("message","Token expired")]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasRefreshTokenExpiredError=void 0;var n=i(t(0)),o=i(t(7));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}r.hasRefreshTokenExpiredError=n.any(n.allPass([n.propEq("code",o.TokenExpiredErrorCode),n.propEq("message","Refresh Token has expired")]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileInstance=void 0;var n=t(4);r.isFileInstance=((e,r)=>(0,n.isFileField)(e)&&(r instanceof File||Array.isArray(r)&&r[0]instanceof File))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileReference=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(4);r.isFileReference=((e,r)=>(0,o.isFileField)(e)&&!n.isNil(r)&&("string"==typeof r||0===r.length||"string"==typeof r[0]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isListField=void 0;const n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)).propEq("isList",!0);r.isListField=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isMetaField=void 0;const n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)).propEq("isMeta",!0);r.isMetaField=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationInstance=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(5);r.isRelationInstance=((e,r)=>(0,o.isRelationField)(e)&&!n.isNil(r)&&"object"==typeof r)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationReference=void 0;var n=t(5);r.isRelationReference=((e,r)=>(0,n.isRelationField)(e)&&("string"==typeof r||Array.isArray(r)&&(0===r.length||"string"==typeof r[0])))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatFieldDataForMutation=void 0;var n=t(2),o=t(22),i=t(23),a=t(24);r.formatFieldDataForMutation=((e,r,t,u)=>{let l=t;return(0,n.isRelationReference)(r,t)||(0,n.isFileReference)(r,t)?l=(0,o.formatRelationReferenceForMutation)(e,t):(0,n.isRelationInstance)(r,t)?l=(0,i.formatRelationInstanceForMutation)(e,r,t,u):(0,n.isFileInstance)(r,t)&&(l=(0,a.formatFileInstanceForMutation)(e,t)),l})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatRelationReferenceForMutation=void 0;var n=t(1);r.formatRelationReferenceForMutation=((e,r)=>{let t=r;return t=Array.isArray(t)?t.map(e=>({id:e})):{id:t},e===n.MUTATION_TYPE.CREATE?t={connect:t}:e===n.MUTATION_TYPE.UPDATE&&(t={reconnect:t}),t})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatRelationInstanceForMutation=void 0;var n=t(3),o=t(2),i=t(6);r.formatRelationInstanceForMutation=((e,r,t,a)=>{const u=(0,n.getTableSchemaById)(r.relation.refTable.id,a);if(!u)throw new Error(`Relation table schema with ${r.relation.refTable.id} id not found in schema.`);let l=t;return l={create:l=(0,o.isListField)(r)?l.map(r=>(0,i.formatDataForMutation)(e,u.name,r,a)):(0,i.formatDataForMutation)(e,u.name,l,a)}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.formatFileInstanceForMutation=((e,r)=>({create:{$file:r}}))}])}); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("ramda")):"function"==typeof define&&define.amd?define("utils",["ramda"],r):"object"==typeof exports?exports.utils=r(require("ramda")):e.utils=r(e.ramda)}("undefined"!=typeof self?self:this,function(e){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=8)}([function(r,t){r.exports=e},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.FIELD_TYPE={DATE:"DATE",FILE:"FILE",ID:"ID",NUMBER:"NUMBER",RELATION:"RELATION",SWITCH:"SWITCH",TEXT:"TEXT",CUSTOM:"CUSTOM"},r.SWITCH_FORMATS={ON_OFF:"ON_OFF",YES_NO:"YES_NO",TRUE_FALSE:"TRUE_FALSE",ACTIVE_INACTIVE:"ACTIVE_INACTIVE",HIGH_LOW:"HIGH_LOW",CUSTOM:"CUSTOM"},r.TEXT_FORMATS={UNFORMATTED:"UNFORMATTED",NAME:"NAME",ADDRESS:"ADDRESS",SSN:"SSN",EIN:"EIN",PHONE:"PHONE",EMAIL:"EMAIL"},r.NUMBER_FORMATS={NUMBER:"NUMBER",CURRENCY:"CURRENCY",PERCENTAGE:"PERCENTAGE",FRACTION:"FRACTION",SCIENTIFIC:"SCIENTIFIC"},r.FILE_FORMATS={FILE:"FILE",IMAGE:"IMAGE"},r.DATE_FORMATS={DATE:"DATE",DATETIME:"DATE/TIME"},r.MUTATION_TYPE={CREATE:"CREATE",UPDATE:"UPDATE"}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(13);Object.defineProperty(r,"hasIdTokenExpiredError",{enumerable:!0,get:function(){return n.hasIdTokenExpiredError}});var o=t(14);Object.defineProperty(r,"hasRefreshTokenExpiredError",{enumerable:!0,get:function(){return o.hasRefreshTokenExpiredError}});var i=t(4);Object.defineProperty(r,"isFileField",{enumerable:!0,get:function(){return i.isFileField}});var a=t(15);Object.defineProperty(r,"isFileInstance",{enumerable:!0,get:function(){return a.isFileInstance}});var u=t(16);Object.defineProperty(r,"isFileReference",{enumerable:!0,get:function(){return u.isFileReference}});var l=t(17);Object.defineProperty(r,"isListField",{enumerable:!0,get:function(){return l.isListField}});var f=t(18);Object.defineProperty(r,"isMetaField",{enumerable:!0,get:function(){return f.isMetaField}});var c=t(5);Object.defineProperty(r,"isRelationField",{enumerable:!0,get:function(){return c.isRelationField}});var s=t(19);Object.defineProperty(r,"isRelationInstance",{enumerable:!0,get:function(){return s.isRelationInstance}});var d=t(20);Object.defineProperty(r,"isRelationReference",{enumerable:!0,get:function(){return d.isRelationReference}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(10);Object.defineProperty(r,"getFieldSchemaByName",{enumerable:!0,get:function(){return n.getFieldSchemaByName}});var o=t(11);Object.defineProperty(r,"getTableSchemaByName",{enumerable:!0,get:function(){return o.getTableSchemaByName}});var i=t(12);Object.defineProperty(r,"getTableSchemaById",{enumerable:!0,get:function(){return i.getTableSchemaById}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileField=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(1);const i=n.propEq("fieldType",o.FIELD_TYPE.FILE);r.isFileField=i},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationField=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(1);const i=n.propEq("fieldType",o.FIELD_TYPE.RELATION);r.isRelationField=i},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatDataForMutation=void 0;var n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),i=t(1),a=t(3),u=t(2),l=t(21);r.formatDataForMutation=((e,r,t,f)=>{if(o.not(e in i.MUTATION_TYPE))throw new Error(`Invalid mutation type: ${e}`);const c=(0,a.getTableSchemaByName)(r,f);if(!c)throw new Error(`Table schema with ${r} name not found in schema.`);return o.reduce((r,o)=>{if("_description"===o||"__typename"===o)return r;const i=(0,a.getFieldSchemaByName)(o,c);if(!i)throw new Error(`Field schema with ${o} name not found in table schema with ${c.name} name.`);return(0,u.isMetaField)(i)?r:n({},r,{[o]:(0,l.formatFieldDataForMutation)(e,i,t[o],f)})},{},o.keys(t))})},function(e,r){e.exports={InternalErrorCode:"InternalError",InvalidTokenErrorCode:"InvalidTokenError",NotAuthorizedErrorCode:"NotAuthorizedError",MissingHeaderErrorCode:"MissingHeaderError",TokenExpiredErrorCode:"TokenExpiredError",InvitationExpiredErrorCode:"InvitationExpiredError",UserNotConfirmedErrorCode:"UserNotConfirmedError",ValidationErrorCode:"ValidationError",EntityExistsErrorCode:"EntityExistsError",EntityNotFoundErrorCode:"EntityNotFoundError",InvalidArgumentErrorCode:"InvalidArgumentError",MutationErrorCode:"MutationError",ForcibleErrorCode:"ForcibleError"}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(1);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}})});var o=t(9);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})});var i=t(3);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})});var a=t(2);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(6);Object.defineProperty(r,"formatDataForMutation",{enumerable:!0,get:function(){return n.formatDataForMutation}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getFieldSchemaByName=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getFieldSchemaByName=((e,r)=>n.find(n.propEq("name",e),r.fields))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getTableSchemaByName=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getTableSchemaByName=((e,r)=>n.find(n.propEq("name",e),r))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getTableSchemaById=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));r.getTableSchemaById=((e,r)=>n.find(n.propEq("id",e),r))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasIdTokenExpiredError=void 0;var n=i(t(0)),o=i(t(7));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}r.hasIdTokenExpiredError=n.any(n.allPass([n.propEq("code",o.TokenExpiredErrorCode),n.propEq("message","Token expired")]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasRefreshTokenExpiredError=void 0;var n=i(t(0)),o=i(t(7));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}r.hasRefreshTokenExpiredError=n.any(n.allPass([n.propEq("code",o.TokenExpiredErrorCode),n.propEq("message","Refresh Token has expired")]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileInstance=void 0;var n=t(4);r.isFileInstance=((e,r)=>(0,n.isFileField)(e)&&(r instanceof File||Array.isArray(r)&&r[0]instanceof File))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFileReference=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(4);r.isFileReference=((e,r)=>(0,o.isFileField)(e)&&!n.isNil(r)&&("string"==typeof r||0===r.length||"string"==typeof r[0]))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isListField=void 0;const n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)).propEq("isList",!0);r.isListField=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isMetaField=void 0;const n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)).propEq("isMeta",!0);r.isMetaField=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationInstance=void 0;var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),o=t(5);r.isRelationInstance=((e,r)=>(0,o.isRelationField)(e)&&!n.isNil(r)&&"object"==typeof r)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isRelationReference=void 0;var n=t(5);r.isRelationReference=((e,r)=>(0,n.isRelationField)(e)&&("string"==typeof r||Array.isArray(r)&&(0===r.length||"string"==typeof r[0])))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatFieldDataForMutation=void 0;var n=t(2),o=t(22),i=t(23),a=t(24);r.formatFieldDataForMutation=((e,r,t,u)=>{let l=t;return(0,n.isRelationReference)(r,t)||(0,n.isFileReference)(r,t)?l=(0,o.formatRelationReferenceForMutation)(e,t):(0,n.isRelationInstance)(r,t)?l=(0,i.formatRelationInstanceForMutation)(e,r,t,u):(0,n.isFileInstance)(r,t)&&(l=(0,a.formatFileInstanceForMutation)(e,t)),l})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatRelationReferenceForMutation=void 0;var n=t(1);r.formatRelationReferenceForMutation=((e,r)=>{let t=r;return t=Array.isArray(t)?t.map(e=>({id:e})):{id:t},e===n.MUTATION_TYPE.CREATE?t={connect:t}:e===n.MUTATION_TYPE.UPDATE&&(t={reconnect:t}),t})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatRelationInstanceForMutation=void 0;var n=t(3),o=t(2),i=t(6);r.formatRelationInstanceForMutation=((e,r,t,a)=>{const u=(0,n.getTableSchemaById)(r.relation.refTable.id,a);if(!u)throw new Error(`Relation table schema with ${r.relation.refTable.id} id not found in schema.`);let l=t;return l={create:l=(0,o.isListField)(r)?l.map(r=>(0,i.formatDataForMutation)(e,u.name,r,a)):(0,i.formatDataForMutation)(e,u.name,l,a)}})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.formatFileInstanceForMutation=((e,r)=>({create:{$file:r}}))}])}); | ||
//# sourceMappingURL=utils.min.js.map |
{ | ||
"name": "@8base/utils", | ||
"version": "0.2.11", | ||
"version": "0.2.12", | ||
"main": "lib/utils.js", | ||
@@ -26,4 +26,4 @@ "scripts": { | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-syntax-object-rest-spread": "^6.13.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
@@ -30,0 +30,0 @@ "babel-preset-flow": "^6.23.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
415014
1166
0