@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.
Files changed (352) hide show
  1. package/api/response.js +1 -12
  2. package/api/states.js +1 -10
  3. package/api/unexpectedError.js +1 -4
  4. package/array/contains.js +2 -6
  5. package/array/getArray.js +2 -10
  6. package/atInternet/request.js +1 -2
  7. package/aws/athenaExpress/initClient.js +3 -27
  8. package/aws/athenaExpress/query.js +2 -9
  9. package/aws/getConfig.js +2 -26
  10. package/aws/glue/initClient.js +2 -17
  11. package/aws/glue/invoke.js +2 -22
  12. package/aws/isResponse200.js +2 -21
  13. package/aws/lambda/getHandlerPath.js +1 -7
  14. package/aws/lambda/initClient.js +2 -17
  15. package/aws/lambda/invoke.js +2 -39
  16. package/aws/s3/copyFile.js +2 -13
  17. package/aws/s3/deleteFile.js +2 -12
  18. package/aws/s3/deleteFiles.js +2 -16
  19. package/aws/s3/deleteFolder.js +2 -35
  20. package/aws/s3/getGlueJson.js +2 -15
  21. package/aws/s3/getPresignedPost.js +3 -16
  22. package/aws/s3/getSignedUrl.js +2 -15
  23. package/aws/s3/initClient.js +2 -17
  24. package/aws/s3/isFileExists.js +2 -26
  25. package/aws/s3/listFiles.js +2 -32
  26. package/aws/s3/listFolders.js +4 -31
  27. package/aws/s3/moveFile.js +2 -20
  28. package/aws/s3/readBuffer.js +2 -51
  29. package/aws/s3/readFile.js +2 -69
  30. package/aws/s3/writeFile.js +2 -15
  31. package/aws/s3/writePresignedPost.js +2 -30
  32. package/aws/s3cache/cache.js +1 -2
  33. package/aws/s3cache/getCache.js +2 -35
  34. package/aws/s3cache/getKey.js +2 -16
  35. package/aws/s3cache/saveCache.js +2 -12
  36. package/aws/s3cache/updateCache.js +2 -23
  37. package/aws/ses/SimpleEmail.js +2 -115
  38. package/aws/ses/initClient.js +2 -17
  39. package/aws/ssm/getParameter.js +2 -39
  40. package/aws/ssm/initClient.js +2 -17
  41. package/axios/get.js +1 -44
  42. package/axios/post.js +2 -46
  43. package/boolean/getBoolean.js +2 -15
  44. package/class/BaseClass.js +9 -50
  45. package/crud/actions.js +1 -10
  46. package/crypto/getDecrypt.js +2 -11
  47. package/crypto/getEncrypt.js +2 -11
  48. package/crypto/getRandom.js +2 -10
  49. package/crypto/getSha256.js +2 -15
  50. package/date/date.js +1 -2
  51. package/date/duration.js +1 -2
  52. package/date/durationComparisons.js +1 -7
  53. package/date/durations.js +1 -10
  54. package/date/financialYear.js +1 -2
  55. package/date/financialYearWeek.js +1 -2
  56. package/date/format.js +2 -18
  57. package/date/getDate.js +9 -96
  58. package/date/getDatesBetween.js +3 -25
  59. package/date/getDurationHours.js +2 -25
  60. package/date/getDurationMinutes.js +2 -24
  61. package/date/getFinancialYear.js +8 -48
  62. package/date/getFinancialYearToDate.js +2 -18
  63. package/date/getFinancialYearToYesterday.js +2 -18
  64. package/date/getFinancialYearWeeks.js +2 -29
  65. package/date/getLastWeek.js +2 -28
  66. package/date/getMax.js +2 -15
  67. package/date/getMidnight.js +2 -12
  68. package/date/getMin.js +2 -15
  69. package/date/getMonday.js +5 -32
  70. package/date/getNumber.js +2 -14
  71. package/date/getPredefinedTimeframe.js +2 -23
  72. package/date/getSunday.js +5 -32
  73. package/date/getThisWeek.js +2 -28
  74. package/date/getTimeZoned.js +5 -36
  75. package/date/getToday.js +2 -39
  76. package/date/getTwoWeeksAgo.js +2 -28
  77. package/date/getWeeksAgo.js +2 -16
  78. package/date/getYesterday.js +2 -40
  79. package/date/isDateValid.js +2 -22
  80. package/date/isLastWeek.js +2 -13
  81. package/date/isThisWeek.js +2 -13
  82. package/date/parseExcelDate.js +2 -17
  83. package/date/predefinedTimeframes.js +1 -9
  84. package/date/timeframe.js +1 -2
  85. package/date/timeframes.js +1 -7
  86. package/deepCrawl/buildRequest.js +4 -83
  87. package/deepCrawl/filter.js +1 -2
  88. package/deepCrawl/getData.js +1 -29
  89. package/deepCrawl/initClient.js +2 -31
  90. package/deepCrawl/operands.js +1 -13
  91. package/deepCrawl/orders.js +1 -7
  92. package/deepCrawl/reports.js +1 -13
  93. package/environment/environments.js +1 -8
  94. package/environment/getEnvironment.js +2 -42
  95. package/environment/isAws.js +2 -10
  96. package/environment/isDevelopment.js +1 -9
  97. package/environment/isLocalhost.js +2 -21
  98. package/environment/isProduction.js +1 -9
  99. package/environment/isStaging.js +1 -9
  100. package/environment/isVercel.js +2 -6
  101. package/environment/platforms.js +1 -7
  102. package/eskimi/ageGroups.js +1 -41
  103. package/eskimi/campaign.js +1 -2
  104. package/eskimi/devices.js +1 -13
  105. package/eskimi/endpoints.js +2 -17
  106. package/eskimi/genders.js +1 -13
  107. package/eskimi/getAccessToken.js +2 -22
  108. package/eskimi/getAgeGroup.js +2 -16
  109. package/eskimi/getCampaignIds.js +2 -11
  110. package/eskimi/getDevice.js +2 -16
  111. package/eskimi/getGender.js +2 -16
  112. package/eskimi/request.js +2 -23
  113. package/globals.d.js +1 -0
  114. package/google/bigQuery/initClient.js +2 -20
  115. package/google/bigQuery/query.js +2 -9
  116. package/google/getConfig.js +3 -21
  117. package/google/sheets/getAssociatedData.js +8 -52
  118. package/google/sheets/getBatchData.js +1 -19
  119. package/google/sheets/initClient.js +2 -22
  120. package/google/sheets/isCellNa.js +2 -6
  121. package/google/storage/initClient.js +2 -20
  122. package/google/storage/writeFile.js +2 -30
  123. package/googleAds/getCustomer.js +2 -14
  124. package/googleAds/initClient.js +2 -24
  125. package/initClients.js +5 -106
  126. package/json/isJson.js +2 -18
  127. package/littleWarden/getUrlStatus.js +2 -20
  128. package/littleWarden/isAllGood.js +2 -17
  129. package/littleWarden/isDanger.js +2 -17
  130. package/littleWarden/isWarning.js +2 -17
  131. package/littleWarden/states.js +1 -8
  132. package/myTarget/getAccessToken.js +2 -22
  133. package/myTarget/request.js +2 -23
  134. package/nextAuth/isSessionReady.js +1 -12
  135. package/nextAuth/states.js +2 -8
  136. package/nextJs/getIp.js +2 -12
  137. package/nextJs/getUserAgent.js +2 -6
  138. package/number/getDivide.js +2 -17
  139. package/number/getNumber.js +7 -50
  140. package/number/getPercent.js +2 -17
  141. package/number/getPercentIncrease.js +2 -17
  142. package/number/getRounded.js +2 -21
  143. package/package.json +47 -44
  144. package/prisma/initClient.js +3 -33
  145. package/snapchat/getAccessToken.js +2 -36
  146. package/sorting/byNumberAscending.js +2 -16
  147. package/sorting/byNumberDescending.js +2 -16
  148. package/sorting/byStringAscending.js +2 -20
  149. package/sorting/byStringDescending.js +2 -20
  150. package/string/formatCapitalise.js +2 -14
  151. package/string/getCleanFolder.js +2 -11
  152. package/string/getString.js +2 -35
  153. package/string/getStringFromStream.js +2 -14
  154. package/string/toProperCase.js +2 -17
  155. package/swr/isAllData.js +2 -18
  156. package/swr/isAnyError.js +2 -18
  157. package/swr/isAnyLoading.js +2 -20
  158. package/swr/isData.js +2 -6
  159. package/swr/isError.js +2 -6
  160. package/swr/isLoading.js +2 -11
  161. package/upTimeRobot/getMonitors.js +2 -31
  162. package/upTimeRobot/logTypes.js +1 -9
  163. package/upTimeRobot/monitorStatuses.js +1 -10
  164. package/upTimeRobot/monitorSubTypes.js +1 -12
  165. package/upTimeRobot/monitorTypes.js +1 -10
  166. package/upTimeRobot/requestStatuses.js +1 -7
  167. package/url/buildParameters.js +2 -21
  168. package/url/buildRelative.js +2 -12
  169. package/url/buildUrl.js +2 -28
  170. package/url/isAbsolute.js +2 -14
  171. package/url/isRelative.js +2 -7
  172. package/url/url.js +1 -2
  173. package/util/defaultTo.js +2 -34
  174. package/util/isUndefined.js +2 -18
  175. package/util/sleep.js +1 -6
  176. package/webWorker/states.js +1 -8
  177. package/xml/getXml.js +1 -14
  178. package/api/response.d.ts +0 -8
  179. package/api/states.d.ts +0 -9
  180. package/api/unexpectedError.d.ts +0 -2
  181. package/array/contains.d.ts +0 -8
  182. package/array/getArray.d.ts +0 -7
  183. package/atInternet/request.d.ts +0 -30
  184. package/aws/athenaExpress/initClient.d.ts +0 -12
  185. package/aws/athenaExpress/query.d.ts +0 -8
  186. package/aws/getConfig.d.ts +0 -13
  187. package/aws/glue/initClient.d.ts +0 -10
  188. package/aws/glue/invoke.d.ts +0 -9
  189. package/aws/isResponse200.d.ts +0 -7
  190. package/aws/lambda/getHandlerPath.d.ts +0 -5
  191. package/aws/lambda/initClient.d.ts +0 -10
  192. package/aws/lambda/invoke.d.ts +0 -12
  193. package/aws/s3/copyFile.d.ts +0 -13
  194. package/aws/s3/deleteFile.d.ts +0 -9
  195. package/aws/s3/deleteFiles.d.ts +0 -9
  196. package/aws/s3/deleteFolder.d.ts +0 -9
  197. package/aws/s3/getGlueJson.d.ts +0 -5
  198. package/aws/s3/getPresignedPost.d.ts +0 -20
  199. package/aws/s3/getSignedUrl.d.ts +0 -12
  200. package/aws/s3/initClient.d.ts +0 -10
  201. package/aws/s3/isFileExists.d.ts +0 -9
  202. package/aws/s3/listFiles.d.ts +0 -9
  203. package/aws/s3/listFolders.d.ts +0 -9
  204. package/aws/s3/moveFile.d.ts +0 -10
  205. package/aws/s3/readBuffer.d.ts +0 -13
  206. package/aws/s3/readFile.d.ts +0 -30
  207. package/aws/s3/writeFile.d.ts +0 -10
  208. package/aws/s3/writePresignedPost.d.ts +0 -14
  209. package/aws/s3cache/cache.d.ts +0 -7
  210. package/aws/s3cache/getCache.d.ts +0 -12
  211. package/aws/s3cache/getKey.d.ts +0 -10
  212. package/aws/s3cache/saveCache.d.ts +0 -10
  213. package/aws/s3cache/updateCache.d.ts +0 -10
  214. package/aws/ses/SimpleEmail.d.ts +0 -51
  215. package/aws/ses/initClient.d.ts +0 -10
  216. package/aws/ssm/getParameter.d.ts +0 -10
  217. package/aws/ssm/initClient.d.ts +0 -10
  218. package/axios/get.d.ts +0 -8
  219. package/axios/post.d.ts +0 -12
  220. package/boolean/getBoolean.d.ts +0 -7
  221. package/class/BaseClass.d.ts +0 -31
  222. package/crud/actions.d.ts +0 -8
  223. package/crypto/getDecrypt.d.ts +0 -10
  224. package/crypto/getEncrypt.d.ts +0 -10
  225. package/crypto/getRandom.d.ts +0 -8
  226. package/crypto/getSha256.d.ts +0 -8
  227. package/date/date.d.ts +0 -4
  228. package/date/duration.d.ts +0 -5
  229. package/date/durationComparisons.d.ts +0 -5
  230. package/date/durations.d.ts +0 -8
  231. package/date/financialYear.d.ts +0 -4
  232. package/date/financialYearWeek.d.ts +0 -6
  233. package/date/format.d.ts +0 -13
  234. package/date/getDate.d.ts +0 -12
  235. package/date/getDatesBetween.d.ts +0 -10
  236. package/date/getDurationHours.d.ts +0 -8
  237. package/date/getDurationMinutes.d.ts +0 -8
  238. package/date/getFinancialYear.d.ts +0 -9
  239. package/date/getFinancialYearToDate.d.ts +0 -7
  240. package/date/getFinancialYearToYesterday.d.ts +0 -7
  241. package/date/getFinancialYearWeeks.d.ts +0 -9
  242. package/date/getLastWeek.d.ts +0 -10
  243. package/date/getMax.d.ts +0 -12
  244. package/date/getMidnight.d.ts +0 -10
  245. package/date/getMin.d.ts +0 -12
  246. package/date/getMonday.d.ts +0 -14
  247. package/date/getNumber.d.ts +0 -11
  248. package/date/getPredefinedTimeframe.d.ts +0 -9
  249. package/date/getSunday.d.ts +0 -14
  250. package/date/getThisWeek.d.ts +0 -10
  251. package/date/getTimeZoned.d.ts +0 -13
  252. package/date/getToday.d.ts +0 -9
  253. package/date/getTwoWeeksAgo.d.ts +0 -10
  254. package/date/getWeeksAgo.d.ts +0 -12
  255. package/date/getYesterday.d.ts +0 -9
  256. package/date/isDateValid.d.ts +0 -7
  257. package/date/isLastWeek.d.ts +0 -6
  258. package/date/isThisWeek.d.ts +0 -6
  259. package/date/parseExcelDate.d.ts +0 -8
  260. package/date/predefinedTimeframes.d.ts +0 -7
  261. package/date/timeframe.d.ts +0 -8
  262. package/date/timeframes.d.ts +0 -4
  263. package/deepCrawl/buildRequest.d.ts +0 -15
  264. package/deepCrawl/filter.d.ts +0 -5
  265. package/deepCrawl/getData.d.ts +0 -5
  266. package/deepCrawl/initClient.d.ts +0 -13
  267. package/deepCrawl/operands.d.ts +0 -11
  268. package/deepCrawl/orders.d.ts +0 -9
  269. package/deepCrawl/reports.d.ts +0 -11
  270. package/environment/environments.d.ts +0 -7
  271. package/environment/getEnvironment.d.ts +0 -6
  272. package/environment/isAws.d.ts +0 -5
  273. package/environment/isDevelopment.d.ts +0 -2
  274. package/environment/isLocalhost.d.ts +0 -5
  275. package/environment/isProduction.d.ts +0 -2
  276. package/environment/isStaging.d.ts +0 -2
  277. package/environment/isVercel.d.ts +0 -5
  278. package/environment/platforms.d.ts +0 -6
  279. package/eskimi/ageGroups.d.ts +0 -5
  280. package/eskimi/campaign.d.ts +0 -19
  281. package/eskimi/devices.d.ts +0 -5
  282. package/eskimi/endpoints.d.ts +0 -16
  283. package/eskimi/genders.d.ts +0 -5
  284. package/eskimi/getAccessToken.d.ts +0 -9
  285. package/eskimi/getAgeGroup.d.ts +0 -7
  286. package/eskimi/getCampaignIds.d.ts +0 -7
  287. package/eskimi/getDevice.d.ts +0 -7
  288. package/eskimi/getGender.d.ts +0 -7
  289. package/eskimi/request.d.ts +0 -8
  290. package/google/bigQuery/initClient.d.ts +0 -11
  291. package/google/bigQuery/query.d.ts +0 -9
  292. package/google/getConfig.d.ts +0 -20
  293. package/google/sheets/getAssociatedData.d.ts +0 -16
  294. package/google/sheets/getBatchData.d.ts +0 -18
  295. package/google/sheets/initClient.d.ts +0 -11
  296. package/google/sheets/isCellNa.d.ts +0 -7
  297. package/google/storage/initClient.d.ts +0 -12
  298. package/google/storage/writeFile.d.ts +0 -12
  299. package/googleAds/getCustomer.d.ts +0 -7
  300. package/googleAds/initClient.d.ts +0 -16
  301. package/initClients.d.ts +0 -40
  302. package/json/isJson.d.ts +0 -8
  303. package/littleWarden/getUrlStatus.d.ts +0 -9
  304. package/littleWarden/isAllGood.d.ts +0 -7
  305. package/littleWarden/isDanger.d.ts +0 -7
  306. package/littleWarden/isWarning.d.ts +0 -7
  307. package/littleWarden/states.d.ts +0 -7
  308. package/myTarget/getAccessToken.d.ts +0 -9
  309. package/myTarget/request.d.ts +0 -8
  310. package/nextAuth/isSessionReady.d.ts +0 -4
  311. package/nextAuth/states.d.ts +0 -7
  312. package/nextJs/getIp.d.ts +0 -7
  313. package/nextJs/getUserAgent.d.ts +0 -7
  314. package/number/getDivide.d.ts +0 -9
  315. package/number/getNumber.d.ts +0 -8
  316. package/number/getPercent.d.ts +0 -9
  317. package/number/getPercentIncrease.d.ts +0 -9
  318. package/number/getRounded.d.ts +0 -9
  319. package/prisma/initClient.d.ts +0 -4
  320. package/snapchat/getAccessToken.d.ts +0 -9
  321. package/sorting/byNumberAscending.d.ts +0 -8
  322. package/sorting/byNumberDescending.d.ts +0 -8
  323. package/sorting/byStringAscending.d.ts +0 -8
  324. package/sorting/byStringDescending.d.ts +0 -8
  325. package/string/formatCapitalise.d.ts +0 -9
  326. package/string/getCleanFolder.d.ts +0 -7
  327. package/string/getString.d.ts +0 -7
  328. package/string/getStringFromStream.d.ts +0 -8
  329. package/string/toProperCase.d.ts +0 -7
  330. package/swr/isAllData.d.ts +0 -7
  331. package/swr/isAnyError.d.ts +0 -7
  332. package/swr/isAnyLoading.d.ts +0 -7
  333. package/swr/isData.d.ts +0 -7
  334. package/swr/isError.d.ts +0 -7
  335. package/swr/isLoading.d.ts +0 -7
  336. package/upTimeRobot/getMonitors.d.ts +0 -1
  337. package/upTimeRobot/logTypes.d.ts +0 -7
  338. package/upTimeRobot/monitorStatuses.d.ts +0 -8
  339. package/upTimeRobot/monitorSubTypes.d.ts +0 -10
  340. package/upTimeRobot/monitorTypes.d.ts +0 -8
  341. package/upTimeRobot/requestStatuses.d.ts +0 -5
  342. package/url/buildParameters.d.ts +0 -8
  343. package/url/buildRelative.d.ts +0 -8
  344. package/url/buildUrl.d.ts +0 -10
  345. package/url/isAbsolute.d.ts +0 -7
  346. package/url/isRelative.d.ts +0 -7
  347. package/url/url.d.ts +0 -6
  348. package/util/defaultTo.d.ts +0 -10
  349. package/util/isUndefined.d.ts +0 -9
  350. package/util/sleep.d.ts +0 -4
  351. package/webWorker/states.d.ts +0 -7
  352. package/xml/getXml.d.ts +0 -4
@@ -1,53 +1,9 @@
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 getBatchData_1 = __importDefault(require("./getBatchData"));
7
- /**
1
+ "use strict";var _getBatchData=_interopRequireDefault(require("./getBatchData"));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 a batch get to Google Sheets to retrieve the data correctly formatted, with default values provided.
9
- */
10
- const getAssociatedData = async ({ dateTimeRender, ranges, spreadsheetId, valueRender }) => {
11
- // Make the API request
12
- const apiResponse = await (0, getBatchData_1.default)({
13
- spreadsheetId,
14
- ranges,
15
- dateTimeRender,
16
- valueRender,
17
- });
18
- let template = [];
19
- let response = [];
20
- // Missing ranges or too many ranges
21
- if (4 !== apiResponse.valueRanges.length) {
22
- throw new Error("Associated data response length must be 4.");
23
- }
24
- // Get the first data range
25
- const initialRangeLength = apiResponse.valueRanges[0].values[0].length;
26
- // Loop through the headings
27
- for (let i = 0; i < initialRangeLength; i++) {
28
- template.push({
29
- format: apiResponse.valueRanges[0].values[0][i],
30
- default: apiResponse.valueRanges[1].values[0][i],
31
- heading: apiResponse.valueRanges[2].values[0][i],
32
- index: i,
33
- });
34
- }
35
- // console.log('template', template);
36
- // Loop through each row of data
37
- if (undefined !== apiResponse.valueRanges[3].values) {
38
- for (let rowIndex = 0; rowIndex < apiResponse.valueRanges[3].values.length; rowIndex++) {
39
- let row = {};
40
- // Loop through each column within the row
41
- for (let columnIndex = 0; columnIndex < apiResponse.valueRanges[3].values[rowIndex].length; columnIndex++) {
42
- const refValue = apiResponse.valueRanges[3].values[rowIndex][columnIndex];
43
- const value = ('' === refValue ? template[columnIndex]['default'] : refValue);
44
- // Add this to our row
45
- row[template[columnIndex]['heading']] = value;
46
- }
47
- // Add the row to our response
48
- response.push(row);
49
- }
50
- }
51
- return response;
52
- };
53
- exports.default = getAssociatedData;
3
+ */var getAssociatedData=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,j,k,l,m,n,o,p,q;return _regeneratorRuntime().wrap(function i(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.dateTimeRender,d=a.ranges,e=a.spreadsheetId,f=a.valueRender,b.next=3,(0,_getBatchData["default"])({spreadsheetId:e,ranges:d,dateTimeRender:c,valueRender:f});case 3:if(g=b.sent,h=[],j=[],4===g.valueRanges.length){b.next=8;break}throw new Error("Associated data response length must be 4.");case 8:// Loop through the headings
4
+ for(k=g.valueRanges[0].values[0].length,l=0;l<k;l++)h.push({format:g.valueRanges[0].values[0][l],default:g.valueRanges[1].values[0][l],heading:g.valueRanges[2].values[0][l],index:l});// console.log('template', template);
5
+ // Loop through each row of data
6
+ if(void 0!==g.valueRanges[3].values)for(m=0;m<g.valueRanges[3].values.length;m++){// Loop through each column within the row
7
+ for(n={},o=0;o<g.valueRanges[3].values[m].length;o++)// Add this to our row
8
+ p=g.valueRanges[3].values[m][o],q=""===p?h[o]["default"]:p,n[h[o].heading]=q;// Add the row to our response
9
+ j.push(n)}return b.abrupt("return",j);case 12:case"end":return b.stop();}},b)}));return function getAssociatedData(b){return a.apply(this,arguments)}}(),_default=getAssociatedData;exports["default"]=_default;
@@ -1,19 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getBatchData = async ({ spreadsheetId, ranges, dateTimeRender = 'FORMATTED_STRING', valueRender = 'UNFORMATTED_VALUE', }) => {
4
- const googleApisSheets = require('@googleapis/sheets');
5
- const request = {
6
- auth: global.googleSheetsClient,
7
- dateTimeRenderOption: dateTimeRender,
8
- ranges: ranges,
9
- spreadsheetId: spreadsheetId,
10
- valueRenderOption: valueRender,
11
- };
12
- // Make the API request
13
- const apiResponse = (await googleApisSheets.sheets('v4')
14
- .spreadsheets
15
- .values
16
- .batchGet(request));
17
- return apiResponse.data;
18
- };
19
- exports.default = getBatchData;
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;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)})}}var getBatchData=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k;return _regeneratorRuntime().wrap(function l(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.spreadsheetId,d=a.ranges,e=a.dateTimeRender,f=void 0===e?"FORMATTED_STRING":e,g=a.valueRender,h=void 0===g?"UNFORMATTED_VALUE":g,i=require("@googleapis/sheets"),j={auth:global.googleSheetsClient,dateTimeRenderOption:f,ranges:d,spreadsheetId:c,valueRenderOption:h},b.next=5,i.sheets("v4").spreadsheets.values.batchGet(j);case 5:return k=b.sent,b.abrupt("return",k.data);case 7:case"end":return b.stop();}},b)}));return function getBatchData(b){return a.apply(this,arguments)}}(),_default=getBatchData;exports["default"]=_default;
@@ -1,25 +1,5 @@
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 getConfig_1 = __importDefault(require("../getConfig"));
7
- global.googleSheetsClient = null;
8
- /**
1
+ "use strict";var _getConfig=_interopRequireDefault(require("../getConfig"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}global.googleSheetsClient=null;/**
9
2
  * Initialise the Google Sheets instance using the separate service method.
10
3
  * https://github.com/googleapis/google-api-nodejs-client
11
4
  * Library: @googleapis/sheets
12
- */
13
- const initClient = ({ parameter }) => {
14
- if (!global.googleSheetsClient) {
15
- const googleApisSheets = require('@googleapis/sheets');
16
- const formattedConfig = (0, getConfig_1.default)({ parameter });
17
- global.googleSheetsClient = new googleApisSheets.auth.GoogleAuth({
18
- credentials: formattedConfig,
19
- scopes: [
20
- 'https://www.googleapis.com/auth/spreadsheets',
21
- ],
22
- });
23
- }
24
- };
25
- exports.default = initClient;
5
+ */var initClient=function(a){var b=a.parameter;if(!global.googleSheetsClient){var c=require("@googleapis/sheets"),d=(0,_getConfig["default"])({parameter:b});global.googleSheetsClient=new c.auth.GoogleAuth({credentials:d,scopes:["https://www.googleapis.com/auth/spreadsheets"]})}},_default=initClient;exports["default"]=_default;
@@ -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
  * Noticed sometimes Google Sheets can struggle with import XML resulting to N/A values.
5
- */
6
- const isCellNa = ({ input }) => '#N/A' === input;
7
- exports.default = isCellNa;
3
+ */var isCellNa=function(a){var b=a.input;return"#N/A"===b},_default=isCellNa;exports["default"]=_default;
@@ -1,23 +1,5 @@
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 getConfig_1 = __importDefault(require("../getConfig"));
7
- global.googleStorageClient = {};
8
- /**
1
+ "use strict";var _getConfig=_interopRequireDefault(require("../getConfig"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}global.googleStorageClient={};/**
9
2
  * Initialise the Google Sheets instance using the separate service method.
10
3
  * https://github.com/googleapis/google-api-nodejs-client
11
4
  * Library: @googleapis/sheets
12
- */
13
- const initClient = ({ parameter, projectId }) => {
14
- if (!global.googleStorageClient[projectId]) {
15
- const { Storage } = require('@google-cloud/storage');
16
- const formattedConfig = (0, getConfig_1.default)({ parameter });
17
- global.googleStorageClient[projectId] = new Storage({
18
- credentials: formattedConfig,
19
- projectId: projectId,
20
- });
21
- }
22
- };
23
- exports.default = initClient;
5
+ */var initClient=function(a){var b=a.parameter,c=a.projectId;if(!global.googleStorageClient[c]){var d=require("@google-cloud/storage"),e=d.Storage,f=(0,_getConfig["default"])({parameter:b});global.googleStorageClient[c]=new e({credentials:f,projectId:c})}},_default=initClient;exports["default"]=_default;
@@ -1,31 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeFile = void 0;
4
- /**
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.writeFile=exports["default"]=void 0;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)})}}/**
5
2
  * Write a file to Google Cloud Storage.
6
- */
7
- const writeFile = async ({ bucket, data, key, projectId }) => {
8
- const stream = require('stream');
9
- const dataStream = new stream.PassThrough();
10
- const googleFile = global.googleStorageClient[projectId].bucket(bucket)
11
- .file(key);
12
- dataStream.push(data);
13
- dataStream.push(null);
14
- return await new Promise((resolve, reject) => {
15
- dataStream.pipe(googleFile.createWriteStream({
16
- contentType: 'auto',
17
- resumable: false,
18
- validation: false,
19
- metadata: {},
20
- }))
21
- .on('error', (error) => {
22
- reject(error);
23
- })
24
- .on('finish', () => {
25
- // console.log(`File uploaded successfully.`);
26
- resolve(true);
27
- });
28
- });
29
- };
30
- exports.writeFile = writeFile;
31
- exports.default = exports.writeFile;
3
+ */var writeFile=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i;return _regeneratorRuntime().wrap(function j(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.bucket,d=a.data,e=a.key,f=a.projectId,g=require("stream"),h=new g.PassThrough,i=global.googleStorageClient[f].bucket(c).file(e),h.push(d),h.push(null),b.next=8,new Promise(function(a,b){h.pipe(i.createWriteStream({contentType:"auto",resumable:!1,validation:!1,metadata:{}})).on("error",function(a){b(a)}).on("finish",function(){a(!0)})});case 8:return b.abrupt("return",b.sent);case 9:case"end":return b.stop();}},b)}));return function writeFile(b){return a.apply(this,arguments)}}();exports.writeFile=writeFile;var _default=writeFile;exports["default"]=_default;
@@ -1,15 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
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;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)})}}/**
4
2
  * Return the Google Ads Client with the specified customer set.
5
- */
6
- const getCustomer = async ({ customerId }) => {
7
- // Login as a customer
8
- const customer = global.googleAdsClient.instance.Customer({
9
- customer_id: customerId,
10
- login_customer_id: global.googleAdsClient.mccAccountId,
11
- refresh_token: global.googleAdsClient.refreshToken,
12
- });
13
- return customer;
14
- };
15
- exports.default = getCustomer;
3
+ */var getCustomer=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.customerId,d=global.googleAdsClient.instance.Customer({customer_id:c,login_customer_id:global.googleAdsClient.mccAccountId,refresh_token:global.googleAdsClient.refreshToken}),b.abrupt("return",d);case 3:case"end":return b.stop();}},b)}));return function getCustomer(b){return a.apply(this,arguments)}}(),_default=getCustomer;exports["default"]=_default;
@@ -1,26 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- global.googleAdsClient = {
4
- instance: null,
5
- mccAccountId: '',
6
- refreshToken: '',
7
- };
8
- /**
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;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.googleAdsClient={instance:null,mccAccountId:"",refreshToken:""};/**
9
2
  * Shorthand function to get the Google Ads Client.
10
3
  * Library: google-ads-api
11
- */
12
- const initClient = async ({ parameter }) => {
13
- if (!global.googleAdsClient.instance) {
14
- const { GoogleAdsApi } = require('google-ads-api');
15
- // Create a new client instance
16
- global.googleAdsClient.instance =
17
- new GoogleAdsApi({
18
- client_id: parameter.clientId,
19
- client_secret: parameter.clientSecret,
20
- developer_token: parameter.developerToken,
21
- });
22
- global.googleAdsClient.mccAccountId = parameter.mccAccountId;
23
- global.googleAdsClient.refreshToken = parameter.refreshToken;
24
- }
25
- };
26
- exports.default = initClient;
4
+ */var initClient=/*#__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:c=a.parameter,global.googleAdsClient.instance||(d=require("google-ads-api"),e=d.GoogleAdsApi,global.googleAdsClient.instance=new e({client_id:c.clientId,client_secret:c.clientSecret,developer_token:c.developerToken}),global.googleAdsClient.mccAccountId=c.mccAccountId,global.googleAdsClient.refreshToken=c.refreshToken);case 2:case"end":return b.stop();}},b)}));return function initClient(b){return a.apply(this,arguments)}}(),_default=initClient;exports["default"]=_default;
package/initClients.js CHANGED
@@ -1,107 +1,6 @@
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 getArray_1 = __importDefault(require("./array/getArray"));
7
- const initClient_1 = __importDefault(require("./aws/athenaExpress/initClient"));
8
- const initClient_2 = __importDefault(require("./aws/glue/initClient"));
9
- const initClient_3 = __importDefault(require("./aws/s3/initClient"));
10
- const initClient_4 = __importDefault(require("./aws/ses/initClient"));
11
- const getParameter_1 = __importDefault(require("./aws/ssm/getParameter"));
12
- const initClient_5 = __importDefault(require("./aws/ssm/initClient"));
13
- const initClient_6 = __importDefault(require("./deepCrawl/initClient"));
14
- const initClient_7 = __importDefault(require("./google/bigQuery/initClient"));
15
- const initClient_8 = __importDefault(require("./google/sheets/initClient"));
16
- const initClient_9 = __importDefault(require("./google/storage/initClient"));
17
- const initClient_10 = __importDefault(require("./googleAds/initClient"));
18
- const initClient_11 = __importDefault(require("./prisma/initClient"));
19
- /**
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 _getArray=_interopRequireDefault(require("./array/getArray")),_initClient=_interopRequireDefault(require("./aws/athenaExpress/initClient")),_initClient2=_interopRequireDefault(require("./aws/glue/initClient")),_initClient3=_interopRequireDefault(require("./aws/s3/initClient")),_initClient4=_interopRequireDefault(require("./aws/ses/initClient")),_getParameter=_interopRequireDefault(require("./aws/ssm/getParameter")),_initClient5=_interopRequireDefault(require("./aws/ssm/initClient")),_initClient6=_interopRequireDefault(require("./deepCrawl/initClient")),_initClient7=_interopRequireDefault(require("./google/bigQuery/initClient")),_initClient8=_interopRequireDefault(require("./google/sheets/initClient")),_initClient9=_interopRequireDefault(require("./google/storage/initClient")),_initClient10=_interopRequireDefault(require("./googleAds/initClient")),_initClient11=_interopRequireDefault(require("./prisma/initClient"));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)})}}/**
20
2
  * Function to simplify initialising the clients.
21
- */
22
- const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, awsSsm, deepCrawl, googleAds, googleConfig, googleBigQuery, googleSheets, googleStorage, prisma, }) => {
23
- if (athenaExpress) {
24
- (0, initClient_1.default)({
25
- config: awsConfig,
26
- database: athenaExpress.database,
27
- s3Bucket: athenaExpress.s3Bucket,
28
- s3Key: athenaExpress.s3Key,
29
- });
30
- }
31
- if (awsGlue) {
32
- (0, initClient_2.default)({
33
- config: awsConfig,
34
- });
35
- }
36
- if (awsS3) {
37
- (0, initClient_3.default)({
38
- config: awsConfig,
39
- });
40
- }
41
- if (awsSes) {
42
- (0, initClient_4.default)({
43
- config: awsConfig,
44
- });
45
- }
46
- if (awsSsm || deepCrawl || googleAds || googleConfig) {
47
- (0, initClient_5.default)({
48
- config: awsConfig,
49
- });
50
- }
51
- // Deepcrawl authentication using SSM Parameter
52
- if (deepCrawl) {
53
- const deepcrawlParameter = await (0, getParameter_1.default)({
54
- name: deepCrawl.parameterName,
55
- });
56
- await (0, initClient_6.default)({ auth: deepcrawlParameter });
57
- }
58
- // Google authentication using SSM
59
- if (googleConfig) {
60
- // Google Parameter
61
- const googleParameter = await (0, getParameter_1.default)({
62
- name: googleConfig.parameterName,
63
- });
64
- // BigQuery
65
- if (googleBigQuery && googleBigQuery.projectIds) {
66
- const googleBigQueryProjectIds = (0, getArray_1.default)({ input: googleBigQuery.projectIds });
67
- for (let i = 0; i < googleBigQueryProjectIds.length; i++) {
68
- (0, initClient_7.default)({
69
- parameter: googleParameter,
70
- projectId: googleBigQueryProjectIds[i],
71
- });
72
- }
73
- }
74
- // Google Sheets
75
- if (googleSheets) {
76
- (0, initClient_8.default)({
77
- parameter: googleParameter,
78
- });
79
- }
80
- // Google Storage
81
- if (googleStorage && googleStorage.projectIds) {
82
- const googleStorageProjectIds = (0, getArray_1.default)({ input: googleStorage.projectIds });
83
- for (let i = 0; i < googleStorageProjectIds.length; i++) {
84
- (0, initClient_9.default)({
85
- parameter: googleParameter,
86
- projectId: googleStorageProjectIds[i],
87
- });
88
- }
89
- }
90
- }
91
- // Google Ads authentication using SSM Parameter
92
- if (googleAds) {
93
- const googleAdsParameter = await (0, getParameter_1.default)({
94
- name: googleAds.parameterName,
95
- });
96
- await (0, initClient_10.default)({
97
- parameter: googleAdsParameter,
98
- });
99
- }
100
- // Initialise Prisma
101
- if (prisma) {
102
- (0, initClient_11.default)({
103
- debug: prisma ? false : prisma.debug || false,
104
- });
105
- }
106
- };
107
- exports.default = initClients;
3
+ */var initClients=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w;return _regeneratorRuntime().wrap(function i(b){for(;1;)switch(b.prev=b.next){case 0:if(c=a.athenaExpress,d=a.awsConfig,e=a.awsGlue,f=a.awsS3,g=a.awsSes,h=a.awsSsm,j=a.deepCrawl,k=a.googleAds,l=a.googleConfig,m=a.googleBigQuery,n=a.googleSheets,o=a.googleStorage,p=a.prisma,c&&(0,_initClient["default"])({config:d,database:c.database,s3Bucket:c.s3Bucket,s3Key:c.s3Key}),e&&(0,_initClient2["default"])({config:d}),f&&(0,_initClient3["default"])({config:d}),g&&(0,_initClient4["default"])({config:d}),(h||j||k||l)&&(0,_initClient5["default"])({config:d}),!j){b.next=12;break}return b.next=9,(0,_getParameter["default"])({name:j.parameterName});case 9:return q=b.sent,b.next=12,(0,_initClient6["default"])({auth:q});case 12:if(!l){b.next=19;break}return b.next=15,(0,_getParameter["default"])({name:l.parameterName});case 15:// BigQuery
4
+ if(r=b.sent,m&&m.projectIds)for(s=(0,_getArray["default"])({input:m.projectIds}),t=0;t<s.length;t++)(0,_initClient7["default"])({parameter:r,projectId:s[t]});// Google Sheets
5
+ // Google Storage
6
+ if(n&&(0,_initClient8["default"])({parameter:r}),o&&o.projectIds)for(u=(0,_getArray["default"])({input:o.projectIds}),v=0;v<u.length;v++)(0,_initClient9["default"])({parameter:r,projectId:u[v]});case 19:if(!k){b.next=25;break}return b.next=22,(0,_getParameter["default"])({name:k.parameterName});case 22:return w=b.sent,b.next=25,(0,_initClient10["default"])({parameter:w});case 25:p&&(0,_initClient11["default"])({debug:!p&&(p.debug||!1)});case 26:case"end":return b.stop();}},b)}));return function initClients(b){return a.apply(this,arguments)}}(),_default=initClients;exports["default"]=_default;
package/json/isJson.js CHANGED
@@ -1,20 +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;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)}/**
4
2
  * Is the provided input JSON?
5
3
  * https://stackoverflow.com/a/33369954
6
- */
7
- const isJson = ({ input }) => {
8
- input = 'string' === typeof input ? input : JSON.stringify(input);
9
- try {
10
- input = JSON.parse(input);
11
- }
12
- catch (e) {
13
- return false;
14
- }
15
- if ('object' === typeof input && null !== input) {
16
- return true;
17
- }
18
- return false;
19
- };
20
- exports.default = isJson;
4
+ */var isJson=function(a){var b=a.input;b="string"==typeof b?b:JSON.stringify(b);try{b=JSON.parse(b)}catch(a){return!1}return!("object"!==_typeof(b)||null===b)},_default=isJson;exports["default"]=_default;
@@ -1,21 +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 get_1 = __importDefault(require("../axios/get"));
7
- /**
1
+ "use strict";var _get=_interopRequireDefault(require("../axios/get"));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
  * Get the URL Status for a given URL ID from Little Warden.
9
- */
10
- const getUrlStatus = async ({ apiKey, urlId }) => {
11
- const response = await (0, get_1.default)({
12
- config: {
13
- headers: {
14
- 'Authorization': `Token token="${apiKey}"`,
15
- },
16
- },
17
- url: `https://littlewarden.com/api/sites/${urlId}`,
18
- });
19
- return response.data.site || {};
20
- };
21
- exports.default = getUrlStatus;
3
+ */var getUrlStatus=/*#__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.apiKey,d=a.urlId,b.next=3,(0,_get["default"])({config:{headers:{Authorization:"Token token=\"".concat(c,"\"")}},url:"https://littlewarden.com/api/sites/".concat(d)});case 3:return e=b.sent,b.abrupt("return",e.data.site||{});case 5:case"end":return b.stop();}},b)}));return function getUrlStatus(b){return a.apply(this,arguments)}}(),_default=getUrlStatus;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 states_1 = __importDefault(require("./states"));
7
- /**
1
+ "use strict";var _states=_interopRequireDefault(require("./states"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
8
2
  * Check if the field is All Good.
9
- */
10
- const isAllGood = ({ field }) => {
11
- let response = false;
12
- // Check that the status field exists
13
- if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.ALL_GOOD === field['status'];
15
- }
16
- return response;
17
- };
18
- exports.default = isAllGood;
3
+ */var isAllGood=function(a){var b=a.field,c=!1;return void 0!==b&&void 0!==b.status&&(c=_states["default"].ALL_GOOD===b.status),c},_default=isAllGood;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 states_1 = __importDefault(require("./states"));
7
- /**
1
+ "use strict";var _states=_interopRequireDefault(require("./states"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
8
2
  * Check if the field is Danger.
9
- */
10
- const isDanger = ({ field }) => {
11
- let response = false;
12
- // Check that the status field exists
13
- if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.DANGER === field['status'];
15
- }
16
- return response;
17
- };
18
- exports.default = isDanger;
3
+ */var isDanger=function(a){var b=a.field,c=!1;return void 0!==b&&void 0!==b.status&&(c=_states["default"].DANGER===b.status),c},_default=isDanger;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 states_1 = __importDefault(require("./states"));
7
- /**
1
+ "use strict";var _states=_interopRequireDefault(require("./states"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/**
8
2
  * Check if the field is Warning.
9
- */
10
- const isWarning = ({ field }) => {
11
- let response = false;
12
- // Check that the status field exists
13
- if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.WARNING === field['status'];
15
- }
16
- return response;
17
- };
18
- exports.default = isWarning;
3
+ */var isWarning=function(a){var b=a.field,c=!1;return void 0!==b&&void 0!==b.status&&(c=_states["default"].WARNING===b.status),c},_default=isWarning;exports["default"]=_default;
@@ -1,8 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const states = {
4
- ALL_GOOD: 'all_good',
5
- DANGER: 'danger',
6
- WARNING: 'warning',
7
- };
8
- exports.default = states;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var states={ALL_GOOD:"all_good",DANGER:"danger",WARNING:"warning"},_default=states;exports["default"]=_default;