@8ms/helpers 1.1.71 → 1.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/response.js +1 -12
- package/api/states.js +1 -10
- package/api/unexpectedError.js +1 -4
- package/array/contains.js +2 -6
- package/array/getArray.js +2 -10
- package/atInternet/request.js +1 -2
- package/aws/athenaExpress/initClient.js +3 -27
- package/aws/athenaExpress/query.js +2 -9
- package/aws/getConfig.js +2 -26
- package/aws/glue/initClient.js +2 -17
- package/aws/glue/invoke.js +2 -22
- package/aws/isResponse200.js +2 -21
- package/aws/lambda/getHandlerPath.js +1 -7
- package/aws/lambda/initClient.js +2 -17
- package/aws/lambda/invoke.js +2 -39
- package/aws/s3/copyFile.js +2 -13
- package/aws/s3/deleteFile.js +2 -12
- package/aws/s3/deleteFiles.js +2 -16
- package/aws/s3/deleteFolder.js +2 -35
- package/aws/s3/getGlueJson.js +2 -15
- package/aws/s3/getPresignedPost.js +3 -16
- package/aws/s3/getSignedUrl.js +2 -15
- package/aws/s3/initClient.js +2 -17
- package/aws/s3/isFileExists.js +2 -26
- package/aws/s3/listFiles.js +2 -32
- package/aws/s3/listFolders.js +4 -31
- package/aws/s3/moveFile.js +2 -20
- package/aws/s3/readBuffer.js +2 -51
- package/aws/s3/readFile.js +2 -69
- package/aws/s3/writeFile.js +2 -15
- package/aws/s3/writePresignedPost.js +2 -30
- package/aws/s3cache/cache.js +1 -2
- package/aws/s3cache/getCache.js +2 -35
- package/aws/s3cache/getKey.js +2 -16
- package/aws/s3cache/saveCache.js +2 -12
- package/aws/s3cache/updateCache.js +2 -23
- package/aws/ses/SimpleEmail.js +2 -115
- package/aws/ses/initClient.js +2 -17
- package/aws/ssm/getParameter.js +2 -39
- package/aws/ssm/initClient.js +2 -17
- package/axios/get.js +1 -44
- package/axios/post.js +2 -46
- package/boolean/getBoolean.js +2 -15
- package/class/BaseClass.js +9 -50
- package/crud/actions.js +1 -10
- package/crypto/getDecrypt.js +2 -11
- package/crypto/getEncrypt.js +2 -11
- package/crypto/getRandom.js +2 -10
- package/crypto/getSha256.js +2 -15
- package/date/date.js +1 -2
- package/date/duration.js +1 -2
- package/date/durationComparisons.js +1 -7
- package/date/durations.js +1 -10
- package/date/financialYear.js +1 -2
- package/date/financialYearWeek.js +1 -2
- package/date/format.js +2 -18
- package/date/getDate.js +9 -96
- package/date/getDatesBetween.js +3 -25
- package/date/getDurationHours.js +2 -25
- package/date/getDurationMinutes.js +2 -24
- package/date/getFinancialYear.js +8 -48
- package/date/getFinancialYearToDate.js +2 -18
- package/date/getFinancialYearToYesterday.js +2 -18
- package/date/getFinancialYearWeeks.js +2 -29
- package/date/getLastWeek.js +2 -28
- package/date/getMax.js +2 -15
- package/date/getMidnight.js +2 -12
- package/date/getMin.js +2 -15
- package/date/getMonday.js +5 -32
- package/date/getNumber.js +2 -14
- package/date/getPredefinedTimeframe.js +2 -23
- package/date/getSunday.js +5 -32
- package/date/getThisWeek.js +2 -28
- package/date/getTimeZoned.js +5 -36
- package/date/getToday.js +2 -39
- package/date/getTwoWeeksAgo.js +2 -28
- package/date/getWeeksAgo.js +2 -16
- package/date/getYesterday.js +2 -40
- package/date/isDateValid.js +2 -22
- package/date/isLastWeek.js +2 -13
- package/date/isThisWeek.js +2 -13
- package/date/parseExcelDate.js +2 -17
- package/date/predefinedTimeframes.js +1 -9
- package/date/timeframe.js +1 -2
- package/date/timeframes.js +1 -7
- package/deepCrawl/buildRequest.js +4 -83
- package/deepCrawl/filter.js +1 -2
- package/deepCrawl/getData.js +1 -29
- package/deepCrawl/initClient.js +2 -31
- package/deepCrawl/operands.js +1 -13
- package/deepCrawl/orders.js +1 -7
- package/deepCrawl/reports.js +1 -13
- package/environment/environments.js +1 -8
- package/environment/getEnvironment.js +2 -42
- package/environment/isAws.js +2 -10
- package/environment/isDevelopment.js +1 -9
- package/environment/isLocalhost.js +2 -21
- package/environment/isProduction.js +1 -9
- package/environment/isStaging.js +1 -9
- package/environment/isVercel.js +2 -6
- package/environment/platforms.js +1 -7
- package/eskimi/ageGroups.js +1 -41
- package/eskimi/campaign.js +1 -2
- package/eskimi/devices.js +1 -13
- package/eskimi/endpoints.js +2 -17
- package/eskimi/genders.js +1 -13
- package/eskimi/getAccessToken.js +2 -22
- package/eskimi/getAgeGroup.js +2 -16
- package/eskimi/getCampaignIds.js +2 -11
- package/eskimi/getDevice.js +2 -16
- package/eskimi/getGender.js +2 -16
- package/eskimi/request.js +2 -23
- package/globals.d.js +1 -0
- package/google/bigQuery/initClient.js +2 -20
- package/google/bigQuery/query.js +2 -9
- package/google/getConfig.js +3 -21
- package/google/sheets/getAssociatedData.js +8 -52
- package/google/sheets/getBatchData.js +1 -19
- package/google/sheets/initClient.js +2 -22
- package/google/sheets/isCellNa.js +2 -6
- package/google/storage/initClient.js +2 -20
- package/google/storage/writeFile.js +2 -30
- package/googleAds/getCustomer.js +2 -14
- package/googleAds/initClient.js +2 -24
- package/initClients.js +5 -106
- package/json/isJson.js +2 -18
- package/littleWarden/getUrlStatus.js +2 -20
- package/littleWarden/isAllGood.js +2 -17
- package/littleWarden/isDanger.js +2 -17
- package/littleWarden/isWarning.js +2 -17
- package/littleWarden/states.js +1 -8
- package/myTarget/getAccessToken.js +2 -22
- package/myTarget/request.js +2 -23
- package/nextAuth/isSessionReady.js +1 -12
- package/nextAuth/states.js +2 -8
- package/nextJs/getIp.js +2 -12
- package/nextJs/getUserAgent.js +2 -6
- package/number/getDivide.js +2 -17
- package/number/getNumber.js +7 -50
- package/number/getPercent.js +2 -17
- package/number/getPercentIncrease.js +2 -17
- package/number/getRounded.js +2 -21
- package/package.json +47 -44
- package/prisma/initClient.js +3 -33
- package/snapchat/getAccessToken.js +2 -36
- package/sorting/byNumberAscending.js +2 -16
- package/sorting/byNumberDescending.js +2 -16
- package/sorting/byStringAscending.js +2 -20
- package/sorting/byStringDescending.js +2 -20
- package/string/formatCapitalise.js +2 -14
- package/string/getCleanFolder.js +2 -11
- package/string/getString.js +2 -35
- package/string/getStringFromStream.js +2 -14
- package/string/toProperCase.js +2 -17
- package/swr/isAllData.js +2 -18
- package/swr/isAnyError.js +2 -18
- package/swr/isAnyLoading.js +2 -20
- package/swr/isData.js +2 -6
- package/swr/isError.js +2 -6
- package/swr/isLoading.js +2 -11
- package/upTimeRobot/getMonitors.js +2 -31
- package/upTimeRobot/logTypes.js +1 -9
- package/upTimeRobot/monitorStatuses.js +1 -10
- package/upTimeRobot/monitorSubTypes.js +1 -12
- package/upTimeRobot/monitorTypes.js +1 -10
- package/upTimeRobot/requestStatuses.js +1 -7
- package/url/buildParameters.js +2 -21
- package/url/buildRelative.js +2 -12
- package/url/buildUrl.js +2 -28
- package/url/isAbsolute.js +2 -14
- package/url/isRelative.js +2 -7
- package/url/url.js +1 -2
- package/util/defaultTo.js +2 -34
- package/util/isUndefined.js +2 -18
- package/util/sleep.js +1 -6
- package/webWorker/states.js +1 -8
- package/xml/getXml.js +1 -14
- package/api/response.d.ts +0 -8
- package/api/states.d.ts +0 -9
- package/api/unexpectedError.d.ts +0 -2
- package/array/contains.d.ts +0 -8
- package/array/getArray.d.ts +0 -7
- package/atInternet/request.d.ts +0 -30
- package/aws/athenaExpress/initClient.d.ts +0 -12
- package/aws/athenaExpress/query.d.ts +0 -8
- package/aws/getConfig.d.ts +0 -13
- package/aws/glue/initClient.d.ts +0 -10
- package/aws/glue/invoke.d.ts +0 -9
- package/aws/isResponse200.d.ts +0 -7
- package/aws/lambda/getHandlerPath.d.ts +0 -5
- package/aws/lambda/initClient.d.ts +0 -10
- package/aws/lambda/invoke.d.ts +0 -12
- package/aws/s3/copyFile.d.ts +0 -13
- package/aws/s3/deleteFile.d.ts +0 -9
- package/aws/s3/deleteFiles.d.ts +0 -9
- package/aws/s3/deleteFolder.d.ts +0 -9
- package/aws/s3/getGlueJson.d.ts +0 -5
- package/aws/s3/getPresignedPost.d.ts +0 -20
- package/aws/s3/getSignedUrl.d.ts +0 -12
- package/aws/s3/initClient.d.ts +0 -10
- package/aws/s3/isFileExists.d.ts +0 -9
- package/aws/s3/listFiles.d.ts +0 -9
- package/aws/s3/listFolders.d.ts +0 -9
- package/aws/s3/moveFile.d.ts +0 -10
- package/aws/s3/readBuffer.d.ts +0 -13
- package/aws/s3/readFile.d.ts +0 -30
- package/aws/s3/writeFile.d.ts +0 -10
- package/aws/s3/writePresignedPost.d.ts +0 -14
- package/aws/s3cache/cache.d.ts +0 -7
- package/aws/s3cache/getCache.d.ts +0 -12
- package/aws/s3cache/getKey.d.ts +0 -10
- package/aws/s3cache/saveCache.d.ts +0 -10
- package/aws/s3cache/updateCache.d.ts +0 -10
- package/aws/ses/SimpleEmail.d.ts +0 -51
- package/aws/ses/initClient.d.ts +0 -10
- package/aws/ssm/getParameter.d.ts +0 -10
- package/aws/ssm/initClient.d.ts +0 -10
- package/axios/get.d.ts +0 -8
- package/axios/post.d.ts +0 -12
- package/boolean/getBoolean.d.ts +0 -7
- package/class/BaseClass.d.ts +0 -31
- package/crud/actions.d.ts +0 -8
- package/crypto/getDecrypt.d.ts +0 -10
- package/crypto/getEncrypt.d.ts +0 -10
- package/crypto/getRandom.d.ts +0 -8
- package/crypto/getSha256.d.ts +0 -8
- package/date/date.d.ts +0 -4
- package/date/duration.d.ts +0 -5
- package/date/durationComparisons.d.ts +0 -5
- package/date/durations.d.ts +0 -8
- package/date/financialYear.d.ts +0 -4
- package/date/financialYearWeek.d.ts +0 -6
- package/date/format.d.ts +0 -13
- package/date/getDate.d.ts +0 -12
- package/date/getDatesBetween.d.ts +0 -10
- package/date/getDurationHours.d.ts +0 -8
- package/date/getDurationMinutes.d.ts +0 -8
- package/date/getFinancialYear.d.ts +0 -9
- package/date/getFinancialYearToDate.d.ts +0 -7
- package/date/getFinancialYearToYesterday.d.ts +0 -7
- package/date/getFinancialYearWeeks.d.ts +0 -9
- package/date/getLastWeek.d.ts +0 -10
- package/date/getMax.d.ts +0 -12
- package/date/getMidnight.d.ts +0 -10
- package/date/getMin.d.ts +0 -12
- package/date/getMonday.d.ts +0 -14
- package/date/getNumber.d.ts +0 -11
- package/date/getPredefinedTimeframe.d.ts +0 -9
- package/date/getSunday.d.ts +0 -14
- package/date/getThisWeek.d.ts +0 -10
- package/date/getTimeZoned.d.ts +0 -13
- package/date/getToday.d.ts +0 -9
- package/date/getTwoWeeksAgo.d.ts +0 -10
- package/date/getWeeksAgo.d.ts +0 -12
- package/date/getYesterday.d.ts +0 -9
- package/date/isDateValid.d.ts +0 -7
- package/date/isLastWeek.d.ts +0 -6
- package/date/isThisWeek.d.ts +0 -6
- package/date/parseExcelDate.d.ts +0 -8
- package/date/predefinedTimeframes.d.ts +0 -7
- package/date/timeframe.d.ts +0 -8
- package/date/timeframes.d.ts +0 -4
- package/deepCrawl/buildRequest.d.ts +0 -15
- package/deepCrawl/filter.d.ts +0 -5
- package/deepCrawl/getData.d.ts +0 -5
- package/deepCrawl/initClient.d.ts +0 -13
- package/deepCrawl/operands.d.ts +0 -11
- package/deepCrawl/orders.d.ts +0 -9
- package/deepCrawl/reports.d.ts +0 -11
- package/environment/environments.d.ts +0 -7
- package/environment/getEnvironment.d.ts +0 -6
- package/environment/isAws.d.ts +0 -5
- package/environment/isDevelopment.d.ts +0 -2
- package/environment/isLocalhost.d.ts +0 -5
- package/environment/isProduction.d.ts +0 -2
- package/environment/isStaging.d.ts +0 -2
- package/environment/isVercel.d.ts +0 -5
- package/environment/platforms.d.ts +0 -6
- package/eskimi/ageGroups.d.ts +0 -5
- package/eskimi/campaign.d.ts +0 -19
- package/eskimi/devices.d.ts +0 -5
- package/eskimi/endpoints.d.ts +0 -16
- package/eskimi/genders.d.ts +0 -5
- package/eskimi/getAccessToken.d.ts +0 -9
- package/eskimi/getAgeGroup.d.ts +0 -7
- package/eskimi/getCampaignIds.d.ts +0 -7
- package/eskimi/getDevice.d.ts +0 -7
- package/eskimi/getGender.d.ts +0 -7
- package/eskimi/request.d.ts +0 -8
- package/google/bigQuery/initClient.d.ts +0 -11
- package/google/bigQuery/query.d.ts +0 -9
- package/google/getConfig.d.ts +0 -20
- package/google/sheets/getAssociatedData.d.ts +0 -16
- package/google/sheets/getBatchData.d.ts +0 -18
- package/google/sheets/initClient.d.ts +0 -11
- package/google/sheets/isCellNa.d.ts +0 -7
- package/google/storage/initClient.d.ts +0 -12
- package/google/storage/writeFile.d.ts +0 -12
- package/googleAds/getCustomer.d.ts +0 -7
- package/googleAds/initClient.d.ts +0 -16
- package/initClients.d.ts +0 -40
- package/json/isJson.d.ts +0 -8
- package/littleWarden/getUrlStatus.d.ts +0 -9
- package/littleWarden/isAllGood.d.ts +0 -7
- package/littleWarden/isDanger.d.ts +0 -7
- package/littleWarden/isWarning.d.ts +0 -7
- package/littleWarden/states.d.ts +0 -7
- package/myTarget/getAccessToken.d.ts +0 -9
- package/myTarget/request.d.ts +0 -8
- package/nextAuth/isSessionReady.d.ts +0 -4
- package/nextAuth/states.d.ts +0 -7
- package/nextJs/getIp.d.ts +0 -7
- package/nextJs/getUserAgent.d.ts +0 -7
- package/number/getDivide.d.ts +0 -9
- package/number/getNumber.d.ts +0 -8
- package/number/getPercent.d.ts +0 -9
- package/number/getPercentIncrease.d.ts +0 -9
- package/number/getRounded.d.ts +0 -9
- package/prisma/initClient.d.ts +0 -4
- package/snapchat/getAccessToken.d.ts +0 -9
- package/sorting/byNumberAscending.d.ts +0 -8
- package/sorting/byNumberDescending.d.ts +0 -8
- package/sorting/byStringAscending.d.ts +0 -8
- package/sorting/byStringDescending.d.ts +0 -8
- package/string/formatCapitalise.d.ts +0 -9
- package/string/getCleanFolder.d.ts +0 -7
- package/string/getString.d.ts +0 -7
- package/string/getStringFromStream.d.ts +0 -8
- package/string/toProperCase.d.ts +0 -7
- package/swr/isAllData.d.ts +0 -7
- package/swr/isAnyError.d.ts +0 -7
- package/swr/isAnyLoading.d.ts +0 -7
- package/swr/isData.d.ts +0 -7
- package/swr/isError.d.ts +0 -7
- package/swr/isLoading.d.ts +0 -7
- package/upTimeRobot/getMonitors.d.ts +0 -1
- package/upTimeRobot/logTypes.d.ts +0 -7
- package/upTimeRobot/monitorStatuses.d.ts +0 -8
- package/upTimeRobot/monitorSubTypes.d.ts +0 -10
- package/upTimeRobot/monitorTypes.d.ts +0 -8
- package/upTimeRobot/requestStatuses.d.ts +0 -5
- package/url/buildParameters.d.ts +0 -8
- package/url/buildRelative.d.ts +0 -8
- package/url/buildUrl.d.ts +0 -10
- package/url/isAbsolute.d.ts +0 -7
- package/url/isRelative.d.ts +0 -7
- package/url/url.d.ts +0 -6
- package/util/defaultTo.d.ts +0 -10
- package/util/isUndefined.d.ts +0 -9
- package/util/sleep.d.ts +0 -4
- package/webWorker/states.d.ts +0 -7
- package/xml/getXml.d.ts +0 -4
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getParameter_1 = __importDefault(require("../aws/ssm/getParameter"));
|
|
7
|
-
global.myTargetAccessToken = null;
|
|
8
|
-
/**
|
|
1
|
+
"use strict";var _getParameter=_interopRequireDefault(require("../aws/ssm/getParameter"));function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,e,f){var g=b&&b.prototype instanceof d?b:d,h=Object.create(g.prototype),j=new l(f||[]);return h._invoke=function(a,b,d){var e="suspendedStart";return function(f,g){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return n()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var j=i(h,d);if(j){if(j===v)continue;return j}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===v)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}(a,e,j),h}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&q.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;this._invoke=function(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}}function i(a,b){var d=a.iterator[b.method];if(void 0===d){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,i(a,b),"throw"===b.method))return v;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,v;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,v):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,v)}function j(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function k(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function l(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(j,this),this.reset(!0)}function m(a){if(a){var b=a[s];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(q.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:n}}function n(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return o};var o={},p=Object.prototype,q=p.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",t=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}o.wrap=b;var v={},w={};a(w,s,function(){return this});var x=Object.getPrototypeOf,y=x&&x(x(m([])));y&&y!==p&&q.call(y,s)&&(w=y);var z=f.prototype=d.prototype=Object.create(w);return e.prototype=f,a(z,"constructor",f),a(f,"constructor",e),e.displayName=a(f,u,"GeneratorFunction"),o.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},o.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,u,"GeneratorFunction")),b.prototype=Object.create(z),b},o.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,t,function(){return this}),o.AsyncIterator=h,o.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return o.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(z),a(z,u,"Generator"),a(z,s,function(){return this}),a(z,"toString",function(){return"[object Generator]"}),o.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},o.values=m,l.prototype={constructor:l,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!a)for(var b in this)"t"===b.charAt(0)&&q.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=q.call(e,"catchLoc"),h=q.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&q.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,v):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),v},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),k(b),v},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;k(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:m(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),v}},o}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}global.myTargetAccessToken=null;/**
|
|
9
2
|
* Retrieve the access token from SSM Parameter Store.
|
|
10
|
-
*/
|
|
11
|
-
const getAccessToken = async ({ force, parameterName }) => {
|
|
12
|
-
if (!global.myTargetAccessToken || force) {
|
|
13
|
-
// Get the credentials from SSM
|
|
14
|
-
const parameter = await (0, getParameter_1.default)({
|
|
15
|
-
name: parameterName,
|
|
16
|
-
withDecryption: true,
|
|
17
|
-
isJson: true,
|
|
18
|
-
});
|
|
19
|
-
global.myTargetAccessToken = parameter.accessToken;
|
|
20
|
-
}
|
|
21
|
-
return global.myTargetAccessToken;
|
|
22
|
-
};
|
|
23
|
-
exports.default = getAccessToken;
|
|
3
|
+
*/var getAccessToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e;return _regeneratorRuntime().wrap(function f(b){for(;1;)switch(b.prev=b.next){case 0:if(c=a.force,d=a.parameterName,global.myTargetAccessToken&&!c){b.next=6;break}return b.next=4,(0,_getParameter["default"])({name:d,withDecryption:!0,isJson:!0});case 4:e=b.sent,global.myTargetAccessToken=e.accessToken;case 6:return b.abrupt("return",global.myTargetAccessToken);case 7:case"end":return b.stop();}},b)}));return function getAccessToken(b){return a.apply(this,arguments)}}(),_default=getAccessToken;exports["default"]=_default;
|
package/myTarget/request.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const post_1 = __importDefault(require("../axios/post"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _post=_interopRequireDefault(require("../axios/post"));function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,e,f){var g=b&&b.prototype instanceof d?b:d,h=Object.create(g.prototype),j=new l(f||[]);return h._invoke=function(a,b,d){var e="suspendedStart";return function(f,g){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return n()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var j=i(h,d);if(j){if(j===v)continue;return j}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===v)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}(a,e,j),h}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&q.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;this._invoke=function(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}}function i(a,b){var d=a.iterator[b.method];if(void 0===d){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,i(a,b),"throw"===b.method))return v;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,v;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,v):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,v)}function j(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function k(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function l(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(j,this),this.reset(!0)}function m(a){if(a){var b=a[s];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(q.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:n}}function n(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return o};var o={},p=Object.prototype,q=p.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",t=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}o.wrap=b;var v={},w={};a(w,s,function(){return this});var x=Object.getPrototypeOf,y=x&&x(x(m([])));y&&y!==p&&q.call(y,s)&&(w=y);var z=f.prototype=d.prototype=Object.create(w);return e.prototype=f,a(z,"constructor",f),a(f,"constructor",e),e.displayName=a(f,u,"GeneratorFunction"),o.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},o.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,u,"GeneratorFunction")),b.prototype=Object.create(z),b},o.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,t,function(){return this}),o.AsyncIterator=h,o.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return o.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(z),a(z,u,"Generator"),a(z,s,function(){return this}),a(z,"toString",function(){return"[object Generator]"}),o.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},o.values=m,l.prototype={constructor:l,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!a)for(var b in this)"t"===b.charAt(0)&&q.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=q.call(e,"catchLoc"),h=q.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&q.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,v):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),v},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),k(b),v},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;k(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:m(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),v}},o}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/**
|
|
8
2
|
* Make the request to MyTarget API using the access token.
|
|
9
|
-
*/
|
|
10
|
-
const request = async ({ data, url }) => {
|
|
11
|
-
const response = await (0, post_1.default)({
|
|
12
|
-
config: {
|
|
13
|
-
headers: {
|
|
14
|
-
Authorization: `Bearer ${global.myTargetAccessToken}`,
|
|
15
|
-
"Content-Type": "application/json",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
data: data,
|
|
19
|
-
onSuccess: response => response.data,
|
|
20
|
-
url: url,
|
|
21
|
-
});
|
|
22
|
-
return response;
|
|
23
|
-
};
|
|
24
|
-
exports.default = request;
|
|
3
|
+
*/var request=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e;return _regeneratorRuntime().wrap(function f(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.data,d=a.url,b.next=3,(0,_post["default"])({config:{headers:{Authorization:"Bearer ".concat(global.myTargetAccessToken),"Content-Type":"application/json"}},data:c,onSuccess:function b(a){return a.data},url:d});case 3:return e=b.sent,b.abrupt("return",e);case 5:case"end":return b.stop();}},b)}));return function request(b){return a.apply(this,arguments)}}(),_default=request;exports["default"]=_default;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const isSessionReady = ({ session }) => {
|
|
4
|
-
let response = false;
|
|
5
|
-
if (undefined !== session && null !== session) {
|
|
6
|
-
if (undefined !== session.user && null !== session.user) {
|
|
7
|
-
response = true;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return response;
|
|
11
|
-
};
|
|
12
|
-
exports.default = isSessionReady;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var isSessionReady=function(a){var b=a.session,c=!1;return void 0!==b&&null!==b&&void 0!==b.user&&null!==b.user&&(c=!0),c},_default=isSessionReady;exports["default"]=_default;
|
package/nextAuth/states.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const states = {
|
|
4
|
-
AUTHENTICATED: 'authenticated',
|
|
5
|
-
PENDING: 'loading',
|
|
6
|
-
UNAUTHENTICATED: 'unauthenticated',
|
|
7
|
-
};
|
|
8
|
-
exports.default = states;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var states={AUTHENTICATED:"authenticated",PENDING:"loading",// Defined by NextAuth
|
|
2
|
+
UNAUTHENTICATED:"unauthenticated"},_default=states;exports["default"]=_default;
|
package/nextJs/getIp.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Get the user's remote IP Address
|
|
5
|
-
*/
|
|
6
|
-
const getIp = ({ req }) => {
|
|
7
|
-
let response = 'unset';
|
|
8
|
-
if (undefined !== req.headers['x-real-ip']) {
|
|
9
|
-
response = String(req.headers['x-real-ip']);
|
|
10
|
-
}
|
|
11
|
-
return response;
|
|
12
|
-
};
|
|
13
|
-
exports.default = getIp;
|
|
3
|
+
*/var getIp=function(a){var b=a.req,c="unset";return void 0!==b.headers["x-real-ip"]&&(c=b.headers["x-real-ip"]+""),c},_default=getIp;exports["default"]=_default;
|
package/nextJs/getUserAgent.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Get the user's User Agent
|
|
5
|
-
*/
|
|
6
|
-
const getUserAgent = ({ req }) => req.headers['user-agent'] || 'unset';
|
|
7
|
-
exports.default = getUserAgent;
|
|
3
|
+
*/var getUserAgent=function(a){var b=a.req;return b.headers["user-agent"]||"unset"},_default=getUserAgent;exports["default"]=_default;
|
package/number/getDivide.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _getNumber=_interopRequireDefault(require("./getNumber"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Shorthand function to divide number, but fallback if the divisor is 0.
|
|
9
|
-
*/
|
|
10
|
-
const getDivide = ({ defaultValue = 0, divisor, numerator }) => {
|
|
11
|
-
const numeratorInt = (0, getNumber_1.default)({ input: numerator });
|
|
12
|
-
const divisorInt = (0, getNumber_1.default)({ input: divisor });
|
|
13
|
-
if (0 === divisorInt) {
|
|
14
|
-
return defaultValue;
|
|
15
|
-
}
|
|
16
|
-
return numeratorInt / divisorInt;
|
|
17
|
-
};
|
|
18
|
-
exports.default = getDivide;
|
|
3
|
+
*/var getDivide=function(a){var b=a.defaultValue,c=void 0===b?0:b,d=a.divisor,e=a.numerator,f=(0,_getNumber["default"])({input:e}),g=(0,_getNumber["default"])({input:d});return 0===g?c:f/g},_default=getDivide;exports["default"]=_default;
|
package/number/getNumber.js
CHANGED
|
@@ -1,51 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const isJson_1 = __importDefault(require("../json/isJson"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _isJson=_interopRequireDefault(require("../json/isJson"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Take an input and return a number.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Only parse this if it's a string
|
|
16
|
-
if ('string' === typeof input) {
|
|
17
|
-
response = JSON.parse(input);
|
|
18
|
-
}
|
|
19
|
-
// Already decoded
|
|
20
|
-
else {
|
|
21
|
-
response = input;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
// Already a number
|
|
25
|
-
if ('number' === typeof response) {
|
|
26
|
-
response = response;
|
|
27
|
-
}
|
|
28
|
-
// String input
|
|
29
|
-
else if ('string' === typeof response) {
|
|
30
|
-
// Attempt to convert to number
|
|
31
|
-
response = Number(response);
|
|
32
|
-
// Not a number, try extracting the number value
|
|
33
|
-
if (isNaN(response)) {
|
|
34
|
-
const match = RegExp(/^\D*([0-9\.]*)\D*$/, 'g')
|
|
35
|
-
.exec(input);
|
|
36
|
-
if (match.length) {
|
|
37
|
-
response = Number(match[1]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// Attempt to convert to a number
|
|
42
|
-
else {
|
|
43
|
-
response = Number(response);
|
|
44
|
-
}
|
|
45
|
-
// Trouble converting the number, use default value
|
|
46
|
-
if (isNaN(response)) {
|
|
47
|
-
response = actualDefaultValue;
|
|
48
|
-
}
|
|
49
|
-
return response;
|
|
50
|
-
};
|
|
51
|
-
exports.default = getNumber;
|
|
3
|
+
*/var getNumber=function(a){var b=a.defaultValue,c=void 0===b?0:b,d=a.input,e=void 0===d?"":d,f=e;// Already a number
|
|
4
|
+
if((0,_isJson["default"])({input:e})&&("string"==typeof e?f=JSON.parse(e):f=e),"number"==typeof f)f=f;// String input
|
|
5
|
+
else if("string"!=typeof f)f=+f;else// Not a number, try extracting the number value
|
|
6
|
+
if(f=+f,isNaN(f)){var g=RegExp(/^\D*([0-9\.]*)\D*$/,"g").exec(e);g.length&&(f=+g[1])}// Attempt to convert to a number
|
|
7
|
+
// Trouble converting the number, use default value
|
|
8
|
+
return isNaN(f)&&(f=c||0),f},_default=getNumber;exports["default"]=_default;
|
package/number/getPercent.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _getNumber=_interopRequireDefault(require("./getNumber"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Get the percentage of two numbers.
|
|
9
|
-
*/
|
|
10
|
-
const getPercent = ({ defaultValue = 0, divisor, value }) => {
|
|
11
|
-
const cleanValue = (0, getNumber_1.default)({ input: value });
|
|
12
|
-
const cleanDivisor = (0, getNumber_1.default)({ input: divisor });
|
|
13
|
-
if (0 === cleanDivisor) {
|
|
14
|
-
return defaultValue;
|
|
15
|
-
}
|
|
16
|
-
return cleanValue / cleanDivisor;
|
|
17
|
-
};
|
|
18
|
-
exports.default = getPercent;
|
|
3
|
+
*/var getPercent=function(a){var b=a.defaultValue,c=void 0===b?0:b,d=a.divisor,e=a.value,f=(0,_getNumber["default"])({input:e}),g=(0,_getNumber["default"])({input:d});return 0===g?c:f/g},_default=getPercent;exports["default"]=_default;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _getNumber=_interopRequireDefault(require("./getNumber"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Formula to work out the percentage increase/decrease.
|
|
9
|
-
*/
|
|
10
|
-
const getPercentageIncrease = ({ comparison, current, defaultValue }) => {
|
|
11
|
-
const currentValue = (0, getNumber_1.default)({ input: current });
|
|
12
|
-
const comparisonValue = (0, getNumber_1.default)({ input: comparison });
|
|
13
|
-
if (0 === currentValue) {
|
|
14
|
-
return defaultValue;
|
|
15
|
-
}
|
|
16
|
-
return (currentValue - comparisonValue) / currentValue * 100;
|
|
17
|
-
};
|
|
18
|
-
exports.default = getPercentageIncrease;
|
|
3
|
+
*/var getPercentageIncrease=function(a){var b=a.comparison,c=a.current,d=a.defaultValue,e=(0,_getNumber["default"])({input:c}),f=(0,_getNumber["default"])({input:b});return 0===e?d:100*((e-f)/e)},_default=getPercentageIncrease;exports["default"]=_default;
|
package/number/getRounded.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _getNumber=_interopRequireDefault(require("./getNumber"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Round a number using the Numbro library.
|
|
9
|
-
*/
|
|
10
|
-
const getRounded = ({ decimalPlaces, input }) => {
|
|
11
|
-
const numbro = require('numbro');
|
|
12
|
-
const inputNumber = (0, getNumber_1.default)({ defaultValue: 0, input });
|
|
13
|
-
const stringNumber = numbro(inputNumber)
|
|
14
|
-
.format({
|
|
15
|
-
average: false,
|
|
16
|
-
mantissa: decimalPlaces,
|
|
17
|
-
thousandSeparated: false,
|
|
18
|
-
trimMantissa: true,
|
|
19
|
-
});
|
|
20
|
-
return Number(stringNumber);
|
|
21
|
-
};
|
|
22
|
-
exports.default = getRounded;
|
|
3
|
+
*/var getRounded=function(a){var b=a.decimalPlaces,c=a.input,d=require("numbro"),e=(0,_getNumber["default"])({defaultValue:0,input:c}),f=d(e).format({average:!1,mantissa:b,thousandSeparated:!1,trimMantissa:!0});return+f},_default=getRounded;exports["default"]=_default;
|
package/package.json
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
"name": "@8ms/helpers",
|
|
3
|
+
"license": "UNLICENSED",
|
|
4
|
+
"version": "1.1.73",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "babel src --out-dir . --presets @babel/preset-env,@babel/preset-typescript,minify --extensions .ts",
|
|
13
|
+
"jest": "jest --watch"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"axios": "0.27.2",
|
|
17
|
+
"crypto-js": "4.1.1",
|
|
18
|
+
"date-fns": "2.29.2",
|
|
19
|
+
"date-fns-tz": "1.3.7",
|
|
20
|
+
"lodash": "4.17.21"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@aws-sdk/client-s3": "3.163.0",
|
|
24
|
+
"@aws-sdk/client-ses": "3.163.0",
|
|
25
|
+
"@aws-sdk/client-ssm": "3.163.0",
|
|
26
|
+
"@aws-sdk/s3-request-presigner": "3.163.0",
|
|
27
|
+
"@babel/cli": "7.18.10",
|
|
28
|
+
"@babel/core": "7.18.10",
|
|
29
|
+
"@babel/preset-env": "7.18.10",
|
|
30
|
+
"@babel/preset-flow": "7.18.6",
|
|
31
|
+
"@babel/preset-typescript": "7.18.6",
|
|
32
|
+
"@google-cloud/bigquery": "6.0.2",
|
|
33
|
+
"@google-cloud/storage": "6.4.2",
|
|
34
|
+
"@prisma/client": "4.3.1",
|
|
35
|
+
"@types/jest": "29.0.0",
|
|
36
|
+
"@types/lodash": "4.14.184",
|
|
37
|
+
"@types/node": "18.7.14",
|
|
38
|
+
"babel-jest": "29.0.2",
|
|
39
|
+
"babel-minify": "0.5.2",
|
|
40
|
+
"jest": "29.0.2",
|
|
41
|
+
"node-fetch": "3.2.10",
|
|
42
|
+
"numbro": "2.3.6",
|
|
43
|
+
"prisma-query-log": "3.2.0",
|
|
44
|
+
"timezone-mock": "1.3.4",
|
|
45
|
+
"ts-node": "10.9.1",
|
|
46
|
+
"tslib": "2.4.0",
|
|
47
|
+
"typescript": "4.8.2"
|
|
48
|
+
}
|
|
46
49
|
}
|
package/prisma/initClient.js
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Prevent too many connections
|
|
5
|
-
* https://github.com/prisma/prisma/issues/1983#issuecomment-620621213
|
|
6
|
-
* https://next-auth.js.org/schemas/adapters
|
|
7
|
-
* Library: @prisma/client, prisma-query-log
|
|
8
|
-
*/
|
|
9
|
-
global.prisma = null;
|
|
10
|
-
const initClient = ({ debug } = { debug: false }) => {
|
|
11
|
-
if (!global.prisma) {
|
|
12
|
-
const { PrismaClient } = require('@prisma/client');
|
|
13
|
-
// Show the full query if debugging
|
|
14
|
-
if (debug) {
|
|
15
|
-
global.prisma = new PrismaClient({
|
|
16
|
-
log: [
|
|
17
|
-
{
|
|
18
|
-
emit: "event",
|
|
19
|
-
level: "query",
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
});
|
|
23
|
-
const { createPrismaQueryEventHandler } = require('prisma-query-log');
|
|
24
|
-
const log = createPrismaQueryEventHandler();
|
|
25
|
-
global.prisma.$on('query', log);
|
|
26
|
-
}
|
|
27
|
-
// Standard prisma
|
|
28
|
-
else {
|
|
29
|
-
global.prisma = new PrismaClient();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
exports.default = initClient;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,global.prisma=null;var initClient=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{debug:!1},b=a.debug;if(!global.prisma){var c=require("@prisma/client"),d=c.PrismaClient;// Show the full query if debugging
|
|
2
|
+
if(b){global.prisma=new d({log:[{emit:"event",level:"query"}]});var e=require("prisma-query-log"),f=e.createPrismaQueryEventHandler,g=f();global.prisma.$on("query",g)}// Standard prisma
|
|
3
|
+
else global.prisma=new d}},_default=initClient;exports["default"]=_default;
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getParameter_1 = __importDefault(require("../aws/ssm/getParameter"));
|
|
7
|
-
const post_1 = __importDefault(require("../axios/post"));
|
|
8
|
-
global.snapchatAccessToken = null;
|
|
9
|
-
/**
|
|
1
|
+
"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _getParameter=_interopRequireDefault(require("../aws/ssm/getParameter")),_post=_interopRequireDefault(require("../axios/post"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,e,f){var g=b&&b.prototype instanceof d?b:d,h=Object.create(g.prototype),j=new l(f||[]);return h._invoke=function(a,b,d){var e="suspendedStart";return function(f,g){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return n()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var j=i(h,d);if(j){if(j===v)continue;return j}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===v)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}(a,e,j),h}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&q.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;this._invoke=function(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}}function i(a,b){var d=a.iterator[b.method];if(void 0===d){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,i(a,b),"throw"===b.method))return v;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,v;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,v):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,v)}function j(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function k(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function l(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(j,this),this.reset(!0)}function m(a){if(a){var b=a[s];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(q.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:n}}function n(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return o};var o={},p=Object.prototype,q=p.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",t=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}o.wrap=b;var v={},w={};a(w,s,function(){return this});var x=Object.getPrototypeOf,y=x&&x(x(m([])));y&&y!==p&&q.call(y,s)&&(w=y);var z=f.prototype=d.prototype=Object.create(w);return e.prototype=f,a(z,"constructor",f),a(f,"constructor",e),e.displayName=a(f,u,"GeneratorFunction"),o.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},o.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,u,"GeneratorFunction")),b.prototype=Object.create(z),b},o.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,t,function(){return this}),o.AsyncIterator=h,o.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return o.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(z),a(z,u,"Generator"),a(z,s,function(){return this}),a(z,"toString",function(){return"[object Generator]"}),o.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},o.values=m,l.prototype={constructor:l,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!a)for(var b in this)"t"===b.charAt(0)&&q.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=q.call(e,"catchLoc"),h=q.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&q.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,v):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),v},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),k(b),v},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;k(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:m(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),v}},o}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}global.snapchatAccessToken=null;/**
|
|
10
2
|
* Renew the access token as it expires every 3 hours.
|
|
11
|
-
*/
|
|
12
|
-
const getAccessToken = async ({ force, parameterName }) => {
|
|
13
|
-
if (!global.snapchatAccessToken || force) {
|
|
14
|
-
// Get the credentials from SSM
|
|
15
|
-
const parameter = await (0, getParameter_1.default)({
|
|
16
|
-
name: parameterName,
|
|
17
|
-
withDecryption: true,
|
|
18
|
-
isJson: true,
|
|
19
|
-
});
|
|
20
|
-
// Build the token request for Snapchat
|
|
21
|
-
let url = `https://accounts.snapchat.com/login/oauth2/access_token`;
|
|
22
|
-
url += `?client_id=${parameter.clientId}`;
|
|
23
|
-
url += `&client_secret=${parameter.clientSecret}`;
|
|
24
|
-
url += `&grant_type=refresh_token`;
|
|
25
|
-
url += `&refresh_token=${parameter.refreshToken}`;
|
|
26
|
-
await (0, post_1.default)({
|
|
27
|
-
onSuccess: apiResponse => {
|
|
28
|
-
if (undefined !== apiResponse['data']['access_token']) {
|
|
29
|
-
global.snapchatAccessToken = apiResponse['data']['access_token'];
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
url: url,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return global.snapchatAccessToken;
|
|
36
|
-
};
|
|
37
|
-
exports.default = getAccessToken;
|
|
3
|
+
*/var getAccessToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f;return _regeneratorRuntime().wrap(function g(b){for(;1;)switch(b.prev=b.next){case 0:if(c=a.force,d=a.parameterName,global.snapchatAccessToken&&!c){b.next=12;break}return b.next=4,(0,_getParameter["default"])({name:d,withDecryption:!0,isJson:!0});case 4:return e=b.sent,f="https://accounts.snapchat.com/login/oauth2/access_token",f+="?client_id=".concat(e.clientId),f+="&client_secret=".concat(e.clientSecret),f+="&grant_type=refresh_token",f+="&refresh_token=".concat(e.refreshToken),b.next=12,(0,_post["default"])({onSuccess:function b(a){void 0!==a.data.access_token&&(global.snapchatAccessToken=a.data.access_token)},url:f});case 12:return b.abrupt("return",global.snapchatAccessToken);case 13:case"end":return b.stop();}},b)}));return function getAccessToken(b){return a.apply(this,arguments)}}(),_default=getAccessToken;exports["default"]=_default;
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Take two values, ensure they are numbers and return the sorting value.
|
|
5
|
-
*/
|
|
6
|
-
const byNumberAscending = ({ valueA, valueB }) => {
|
|
7
|
-
let valueAClean = Number(valueA);
|
|
8
|
-
let valueBClean = Number(valueB);
|
|
9
|
-
if (valueAClean > valueBClean) {
|
|
10
|
-
return 1;
|
|
11
|
-
}
|
|
12
|
-
if (valueBClean > valueAClean) {
|
|
13
|
-
return -1;
|
|
14
|
-
}
|
|
15
|
-
return 0;
|
|
16
|
-
};
|
|
17
|
-
exports.default = byNumberAscending;
|
|
3
|
+
*/var byNumberAscending=function(a){var b=a.valueA,c=a.valueB,d=+b,e=+c;return d>e?1:e>d?-1:0},_default=byNumberAscending;exports["default"]=_default;
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Take two values, ensure they are numbers and return the sorting value.
|
|
5
|
-
*/
|
|
6
|
-
const byNumberDescending = ({ valueA, valueB }) => {
|
|
7
|
-
let valueAClean = Number(valueA);
|
|
8
|
-
let valueBClean = Number(valueB);
|
|
9
|
-
if (valueAClean > valueBClean) {
|
|
10
|
-
return -1;
|
|
11
|
-
}
|
|
12
|
-
if (valueBClean > valueAClean) {
|
|
13
|
-
return 1;
|
|
14
|
-
}
|
|
15
|
-
return 0;
|
|
16
|
-
};
|
|
17
|
-
exports.default = byNumberDescending;
|
|
3
|
+
*/var byNumberDescending=function(a){var b=a.valueA,c=a.valueB,d=+b,e=+c;return d>e?-1:e>d?1:0},_default=byNumberDescending;exports["default"]=_default;
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Take two values, clean the strings and return the sorting value.
|
|
5
|
-
*/
|
|
6
|
-
const byStringAscending = ({ valueA, valueB }) => {
|
|
7
|
-
let valueAClean = valueA
|
|
8
|
-
.trim()
|
|
9
|
-
.toLowerCase();
|
|
10
|
-
let valueBClean = valueB
|
|
11
|
-
.trim()
|
|
12
|
-
.toLowerCase();
|
|
13
|
-
if (valueAClean > valueBClean) {
|
|
14
|
-
return 1;
|
|
15
|
-
}
|
|
16
|
-
if (valueBClean > valueAClean) {
|
|
17
|
-
return -1;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
};
|
|
21
|
-
exports.default = byStringAscending;
|
|
3
|
+
*/var byStringAscending=function(a){var b=a.valueA,c=a.valueB,d=b.trim().toLowerCase(),e=c.trim().toLowerCase();return d>e?1:e>d?-1:0},_default=byStringAscending;exports["default"]=_default;
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Take two values, clean the strings and return the sorting value.
|
|
5
|
-
*/
|
|
6
|
-
const byStringDescending = ({ valueA, valueB }) => {
|
|
7
|
-
let valueAClean = valueA
|
|
8
|
-
.trim()
|
|
9
|
-
.toLowerCase();
|
|
10
|
-
let valueBClean = valueB
|
|
11
|
-
.trim()
|
|
12
|
-
.toLowerCase();
|
|
13
|
-
if (valueAClean > valueBClean) {
|
|
14
|
-
return -1;
|
|
15
|
-
}
|
|
16
|
-
if (valueBClean > valueAClean) {
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
};
|
|
21
|
-
exports.default = byStringDescending;
|
|
3
|
+
*/var byStringDescending=function(a){var b=a.valueA,c=a.valueB,d=b.trim().toLowerCase(),e=c.trim().toLowerCase();return d>e?-1:e>d?1:0},_default=byStringDescending;exports["default"]=_default;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;/**
|
|
4
2
|
* Convert a string into Capitalised Text.
|
|
5
3
|
* https://stackoverflow.com/a/196991/2664955
|
|
6
|
-
*/
|
|
7
|
-
const formatCapitalise = ({ input, split } = { input: '', split: '_' }) => {
|
|
8
|
-
return input
|
|
9
|
-
.replace(`/${split}/g`, ' ')
|
|
10
|
-
.replace(/\w\S*/g, function (txt) {
|
|
11
|
-
return txt.charAt(0)
|
|
12
|
-
.toUpperCase() + txt.substr(1)
|
|
13
|
-
.toLowerCase();
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
exports.default = formatCapitalise;
|
|
4
|
+
*/var formatCapitalise=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{input:"",split:"_"},b=a.input,c=a.split;return b.replace("/".concat(c,"/g")," ").replace(/\w\S*/g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()})},_default=formatCapitalise;exports["default"]=_default;
|
package/string/getCleanFolder.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const trim_1 = __importDefault(require("lodash/trim"));
|
|
7
|
-
/**
|
|
1
|
+
"use strict";var _trim=_interopRequireDefault(require("lodash/trim"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
|
|
8
2
|
* Take an input that may have a / before or after the input and return just the folder.
|
|
9
|
-
*/
|
|
10
|
-
const getCleanFolder = ({ input }) => (0, trim_1.default)(input, '/')
|
|
11
|
-
.trim();
|
|
12
|
-
exports.default = getCleanFolder;
|
|
3
|
+
*/var getCleanFolder=function(a){var b=a.input;return(0,_trim["default"])(b,"/").trim()},_default=getCleanFolder;exports["default"]=_default;
|