@8ms/helpers 2.1.4 → 2.2.10

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 (186) hide show
  1. package/.github/workflows/deploy_npmjs.yml +19 -14
  2. package/_class/BaseClass.js +43 -52
  3. package/_class/BaseNamespace.js +17 -20
  4. package/_class/index.js +2 -7
  5. package/adverity/getJobs.js +7 -11
  6. package/adverity/index.js +51 -54
  7. package/adverity/server.js +1 -5
  8. package/api/ApiResponseClass.js +84 -88
  9. package/api/functions.js +13 -22
  10. package/api/index.js +3 -19
  11. package/api/types.js +5 -9
  12. package/array/index.js +3 -11
  13. package/atInternet/index.js +10 -13
  14. package/aws/ec2/AwsEc2Namespace.js +34 -74
  15. package/aws/ec2/server.js +5 -9
  16. package/aws/ecs/AwsEcsNamespace.js +110 -150
  17. package/aws/ecs/server.js +5 -9
  18. package/aws/glue/AwsGlueNamespace.js +26 -66
  19. package/aws/glue/server.js +5 -9
  20. package/aws/isResponse200.js +3 -7
  21. package/aws/lambda/AwsLambdaNamespace.js +62 -102
  22. package/aws/lambda/server.js +6 -11
  23. package/aws/s3/AwsS3Namespace.js +347 -390
  24. package/aws/s3/payload.js +29 -32
  25. package/aws/s3/server.js +9 -14
  26. package/aws/server.js +5 -10
  27. package/aws/ses/AwsSesNamespace.js +36 -76
  28. package/aws/ses/SimpleEmail.js +267 -304
  29. package/aws/ses/server.js +6 -11
  30. package/aws/sqs/AwsSqsNamespace.js +49 -89
  31. package/aws/sqs/server.js +5 -9
  32. package/aws/ssm/AwsSsmNamespace.js +43 -79
  33. package/aws/ssm/server.js +5 -9
  34. package/axios/deleteRequest.js +8 -15
  35. package/axios/get.js +8 -15
  36. package/axios/index.js +3 -9
  37. package/axios/post.js +8 -15
  38. package/boolean/index.js +3 -10
  39. package/brightData/serpApi/buildGoogleSerpUrl.js +1 -5
  40. package/brightData/serpApi/buildGoogleTrendsUrl.js +1 -5
  41. package/brightData/serpApi/getAsyncRequestId.js +8 -12
  42. package/brightData/serpApi/getAsyncResults.js +8 -12
  43. package/brightData/serpApi/getRealtime.js +3 -7
  44. package/brightData/serpApi/server.js +6 -14
  45. package/brightData/server.js +2 -7
  46. package/brightData/webScraperIde/getBatch.js +3 -7
  47. package/brightData/webScraperIde/getRealtime.js +11 -15
  48. package/brightData/webScraperIde/server.js +2 -7
  49. package/cache/server.js +2 -7
  50. package/cache/test/cache.test.js +4 -6
  51. package/crud/index.js +1 -4
  52. package/crypto/getDecrypt.js +2 -39
  53. package/crypto/getEncrypt.js +2 -39
  54. package/crypto/getRandom.js +1 -5
  55. package/crypto/getSha256.js +4 -41
  56. package/crypto/index.js +4 -11
  57. package/date/calculation.js +70 -99
  58. package/date/financialYear.js +16 -23
  59. package/date/format.js +40 -61
  60. package/date/index.js +4 -20
  61. package/date/type.js +4 -7
  62. package/environment/index.js +15 -25
  63. package/eskimi/getAgeGroup.js +3 -7
  64. package/eskimi/getData.js +3 -7
  65. package/eskimi/getDevice.js +3 -7
  66. package/eskimi/getGender.js +3 -7
  67. package/eskimi/server.js +23 -26
  68. package/file/index.js +8 -46
  69. package/geo/countries.js +1 -4
  70. package/geo/index.js +2 -7
  71. package/geo/languages.js +1 -4
  72. package/google/bigQuery/GoogleBigQueryNamespace.js +108 -148
  73. package/google/bigQuery/loadData.js +1 -5
  74. package/google/bigQuery/server.js +8 -14
  75. package/google/server.js +1 -5
  76. package/google/sheets/GoogleSheetsNamespace.js +34 -74
  77. package/google/sheets/getAssociatedData.js +1 -5
  78. package/google/sheets/server.js +8 -14
  79. package/google/storage/GoogleCloudStorageNamespace.js +62 -102
  80. package/google/storage/server.js +6 -10
  81. package/googleAds/GoogleAdsNamespace.js +28 -68
  82. package/googleAds/keywordPlanner/server.js +32 -35
  83. package/googleAds/server.js +6 -10
  84. package/googlePageSpeed/GooglePageSpeedNamespace.js +21 -28
  85. package/googlePageSpeed/server.js +8 -12
  86. package/googleSearchIncidents/server.js +28 -32
  87. package/greenDomain/server.js +17 -21
  88. package/inngest/server.js +1 -4
  89. package/json/getJsonNewline.js +3 -7
  90. package/json/index.js +2 -7
  91. package/json/isJson.js +1 -5
  92. package/littleWarden/LittleWardenNamespace.js +24 -31
  93. package/littleWarden/getUrlStatus.js +3 -7
  94. package/littleWarden/server.js +14 -22
  95. package/lumar/api/buildRequest.js +14 -18
  96. package/lumar/api/getData.js +3 -7
  97. package/lumar/api/initClient.js +3 -7
  98. package/lumar/api/server.js +6 -12
  99. package/lumar/graphql/columns.js +1 -4
  100. package/lumar/graphql/getData.js +3 -7
  101. package/lumar/graphql/initClient.js +3 -7
  102. package/lumar/graphql/queries/crawl.js +1 -2
  103. package/lumar/graphql/queries/getCrawls.js +1 -3
  104. package/lumar/graphql/queries/getReportDifferences.js +3 -5
  105. package/lumar/graphql/queries/getRows.js +1 -3
  106. package/lumar/graphql/queries/getTotals.js +1 -3
  107. package/lumar/graphql/queries/row.js +1 -2
  108. package/lumar/graphql/reportTemplates.js +1 -4
  109. package/lumar/graphql/server.js +7 -15
  110. package/myTarget/server.js +3 -7
  111. package/nextAuth/index.js +2 -6
  112. package/nextAuth/isSessionReady.js +1 -5
  113. package/nextJs/client/LazyLoad.js +5 -12
  114. package/nextJs/client.js +1 -5
  115. package/nextJs/index.js +2 -7
  116. package/number/format.js +3 -7
  117. package/number/formatCurrency.js +1 -5
  118. package/number/getDecimal.js +3 -7
  119. package/number/getNumber.js +3 -7
  120. package/number/getPercentIncrease.js +4 -8
  121. package/number/getSafeDivide.js +6 -10
  122. package/number/index.js +6 -15
  123. package/object/index.js +1 -5
  124. package/object/replaceKeys.js +3 -7
  125. package/onePassword/OnePasswordNamespace.js +36 -76
  126. package/onePassword/server.js +3 -7
  127. package/openAi/OpenAiNamespace.js +32 -39
  128. package/openAi/server.js +6 -10
  129. package/package.json +136 -120
  130. package/prisma/PrismaNamespace.d.ts +3 -3
  131. package/prisma/PrismaNamespace.js +55 -81
  132. package/prisma/getDecimal.js +5 -12
  133. package/prisma/server.d.ts +13 -0
  134. package/prisma/server.js +6 -9
  135. package/snapchat/SnapchatNamespace.js +20 -27
  136. package/snapchat/server.js +6 -10
  137. package/sorting/byNumberAscending.js +1 -5
  138. package/sorting/byNumberDescending.js +1 -5
  139. package/sorting/byStringAscending.js +1 -5
  140. package/sorting/byStringDescending.js +1 -5
  141. package/sorting/index.js +4 -11
  142. package/stream/server.js +1 -5
  143. package/stream/sort.js +1 -5
  144. package/string/getCapitalised.js +3 -7
  145. package/string/getClean.js +17 -21
  146. package/string/getFolder.js +3 -10
  147. package/string/getProperCase.js +4 -8
  148. package/string/getString.js +8 -15
  149. package/string/getStringFromStream.js +1 -5
  150. package/string/getUnescaped.js +3 -10
  151. package/string/getWithoutAccents.js +1 -5
  152. package/string/getWithoutHtmlTags.js +1 -5
  153. package/string/getWithoutPunctuation.js +1 -5
  154. package/string/getWithoutUnderscores.js +1 -5
  155. package/string/getWithoutWhitespaces.js +1 -5
  156. package/string/index.js +12 -27
  157. package/string/reservedWords.js +5 -9
  158. package/swr/index.js +9 -18
  159. package/upTimeRobot/UpTimeRobotNamespace.js +32 -42
  160. package/upTimeRobot/server.js +11 -15
  161. package/url/index.js +12 -23
  162. package/url/server.js +1 -5
  163. package/url/writeUrlContents.js +6 -46
  164. package/util/defaultTo.js +5 -12
  165. package/util/getBrotliCompressed.js +3 -10
  166. package/util/getBrotliDecompressed.js +3 -10
  167. package/util/getClean.js +5 -9
  168. package/util/getError.js +1 -5
  169. package/util/getGzipCompressed.js +3 -10
  170. package/util/getGzipDecompressed.js +3 -10
  171. package/util/getWithoutHash.js +1 -5
  172. package/util/getWithoutParameter.js +1 -5
  173. package/util/index.js +7 -17
  174. package/util/isUndefined.js +3 -7
  175. package/util/promiseChunks.js +6 -10
  176. package/util/server.js +4 -11
  177. package/util/sleep.js +1 -5
  178. package/webWorker/index.js +1 -4
  179. package/xml/getXml.js +3 -7
  180. package/.yarn/install-state.gz +0 -0
  181. package/.yarn/releases/yarn-4.9.4.cjs +0 -942
  182. package/.yarnrc.yml +0 -3
  183. package/aws/athenaExpress/AwsAthenaNamespace.d.ts +0 -8
  184. package/aws/athenaExpress/AwsAthenaNamespace.js +0 -82
  185. package/aws/athenaExpress/server.d.ts +0 -10
  186. package/aws/athenaExpress/server.js +0 -40
package/util/getClean.js CHANGED
@@ -1,23 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getClean = void 0;
4
- const getWithoutParameter_1 = require("./getWithoutParameter");
5
- const getWithoutHash_1 = require("./getWithoutHash");
1
+ import { getWithoutParameter } from "./getWithoutParameter";
2
+ import { getWithoutHash } from "./getWithoutHash";
6
3
  /**
7
4
  * Return a clean URL with a few options.
8
5
  */
9
- const getClean = (props) => {
6
+ export const getClean = (props) => {
10
7
  let response = props.input.toString()
11
8
  .trim();
12
9
  if (props.parameter) {
13
- response = (0, getWithoutParameter_1.getWithoutParameter)(response);
10
+ response = getWithoutParameter(response);
14
11
  }
15
12
  if (props.hash) {
16
- response = (0, getWithoutHash_1.getWithoutHash)(response);
13
+ response = getWithoutHash(response);
17
14
  }
18
15
  if (props.lowercase) {
19
16
  response = response.toLowerCase();
20
17
  }
21
18
  return response;
22
19
  };
23
- exports.getClean = getClean;
package/util/getError.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getError = void 0;
4
- const getError = (error) => {
1
+ export const getError = (error) => {
5
2
  let response = "";
6
3
  if (typeof error === "string") {
7
4
  response = error.toUpperCase();
@@ -11,4 +8,3 @@ const getError = (error) => {
11
8
  }
12
9
  return response;
13
10
  };
14
- exports.getError = getError;
@@ -1,16 +1,10 @@
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
- exports.getGzipCompressed = void 0;
7
- const zlib_1 = __importDefault(require("zlib"));
1
+ import zlib from "zlib";
8
2
  /**
9
3
  * Compress a given input using Gzip.
10
4
  */
11
- const getGzipCompressed = async (input, options = {}) => {
5
+ export const getGzipCompressed = async (input, options = {}) => {
12
6
  return new Promise(async (resolve, reject) => {
13
- zlib_1.default.gzip(input || "", options || {}, (err, data) => {
7
+ zlib.gzip(input || "", options || {}, (err, data) => {
14
8
  if (err) {
15
9
  reject(`Error compressing - ${err.message}`);
16
10
  }
@@ -20,4 +14,3 @@ const getGzipCompressed = async (input, options = {}) => {
20
14
  });
21
15
  });
22
16
  };
23
- exports.getGzipCompressed = getGzipCompressed;
@@ -1,17 +1,11 @@
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
- exports.getGzipDecompressed = void 0;
7
- const zlib_1 = __importDefault(require("zlib"));
1
+ import zlib from "zlib";
8
2
  /**
9
3
  * Decompress a given Gzip input into a string.
10
4
  */
11
- const getGzipDecompressed = async (input, options = {}) => {
5
+ export const getGzipDecompressed = async (input, options = {}) => {
12
6
  return new Promise(async (resolve, reject) => {
13
7
  const compressedData = Buffer.from(input || "", "base64");
14
- zlib_1.default.gunzip(compressedData, options || {}, (err, data) => {
8
+ zlib.gunzip(compressedData, options || {}, (err, data) => {
15
9
  if (err) {
16
10
  reject(`Error decompressing - ${err.message}`);
17
11
  }
@@ -21,4 +15,3 @@ const getGzipDecompressed = async (input, options = {}) => {
21
15
  });
22
16
  });
23
17
  };
24
- exports.getGzipDecompressed = getGzipDecompressed;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWithoutHash = void 0;
4
1
  /**
5
2
  * Get a URL without the parameter query.
6
3
  */
7
- const getWithoutHash = (input) => {
4
+ export const getWithoutHash = (input) => {
8
5
  let response = input;
9
6
  // Contains parameter query
10
7
  if (-1 !== response.indexOf("#")) {
@@ -15,4 +12,3 @@ const getWithoutHash = (input) => {
15
12
  }
16
13
  return response;
17
14
  };
18
- exports.getWithoutHash = getWithoutHash;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWithoutParameter = void 0;
4
1
  /**
5
2
  * Get a URL without the parameter query.
6
3
  */
7
- const getWithoutParameter = (input) => {
4
+ export const getWithoutParameter = (input) => {
8
5
  let response = input;
9
6
  // Contains parameter query
10
7
  if (-1 !== response.indexOf("?")) {
@@ -15,4 +12,3 @@ const getWithoutParameter = (input) => {
15
12
  }
16
13
  return response;
17
14
  };
18
- exports.getWithoutParameter = getWithoutParameter;
package/util/index.js CHANGED
@@ -1,17 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = exports.promiseChunks = exports.isUndefined = exports.getWithoutParameter = exports.getWithoutHash = exports.getClean = exports.defaultTo = void 0;
4
- var defaultTo_1 = require("./defaultTo");
5
- Object.defineProperty(exports, "defaultTo", { enumerable: true, get: function () { return defaultTo_1.defaultTo; } });
6
- var getClean_1 = require("./getClean");
7
- Object.defineProperty(exports, "getClean", { enumerable: true, get: function () { return getClean_1.getClean; } });
8
- var getWithoutHash_1 = require("./getWithoutHash");
9
- Object.defineProperty(exports, "getWithoutHash", { enumerable: true, get: function () { return getWithoutHash_1.getWithoutHash; } });
10
- var getWithoutParameter_1 = require("./getWithoutParameter");
11
- Object.defineProperty(exports, "getWithoutParameter", { enumerable: true, get: function () { return getWithoutParameter_1.getWithoutParameter; } });
12
- var isUndefined_1 = require("./isUndefined");
13
- Object.defineProperty(exports, "isUndefined", { enumerable: true, get: function () { return isUndefined_1.isUndefined; } });
14
- var promiseChunks_1 = require("./promiseChunks");
15
- Object.defineProperty(exports, "promiseChunks", { enumerable: true, get: function () { return promiseChunks_1.promiseChunks; } });
16
- var sleep_1 = require("./sleep");
17
- Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_1.sleep; } });
1
+ export { defaultTo } from "./defaultTo";
2
+ export { getClean } from "./getClean";
3
+ export { getWithoutHash } from "./getWithoutHash";
4
+ export { getWithoutParameter } from "./getWithoutParameter";
5
+ export { isUndefined } from "./isUndefined";
6
+ export { promiseChunks } from "./promiseChunks";
7
+ export { sleep } from "./sleep";
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUndefined = void 0;
4
- const defaultTo_1 = require("./defaultTo");
1
+ import { defaultTo } from './defaultTo';
5
2
  const undefinedValue = '__!!UNDEFINED!!__';
6
3
  /**
7
4
  * Check to see if a value is undefined.
8
5
  */
9
- const isUndefined = (instance, keys) => {
10
- const value = (0, defaultTo_1.defaultTo)(instance, keys, undefinedValue);
6
+ export const isUndefined = (instance, keys) => {
7
+ const value = defaultTo(instance, keys, undefinedValue);
11
8
  return undefinedValue === value;
12
9
  };
13
- exports.isUndefined = isUndefined;
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promiseChunks = void 0;
4
- const lodash_1 = require("lodash");
5
- const sleep_1 = require("./sleep");
1
+ import { chunk, flatten } from "lodash";
2
+ import { sleep } from "./sleep";
6
3
  /**
7
4
  * Chunk a queue of promises into controlled chunks to prevent overloading.
8
5
  * https://stackoverflow.com/a/53964407
9
6
  */
10
- const promiseChunks = async (promises, size, sleepSeconds = 0) => {
11
- const batches = (0, lodash_1.chunk)(promises, size);
7
+ export const promiseChunks = async (promises, size, sleepSeconds = 0) => {
8
+ const batches = chunk(promises, size);
12
9
  let results = [];
13
10
  while (batches.length) {
14
11
  const batch = batches.shift();
15
12
  const result = await Promise.all(batch);
16
13
  results.push(result);
17
- await (0, sleep_1.sleep)(sleepSeconds);
14
+ await sleep(sleepSeconds);
18
15
  }
19
- return (0, lodash_1.flatten)(results);
16
+ return flatten(results);
20
17
  };
21
- exports.promiseChunks = promiseChunks;
package/util/server.js CHANGED
@@ -1,11 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGzipDecompressed = exports.getGzipCompressed = exports.getBrotliDecompressed = exports.getBrotliCompressed = void 0;
4
- var getBrotliCompressed_1 = require("./getBrotliCompressed");
5
- Object.defineProperty(exports, "getBrotliCompressed", { enumerable: true, get: function () { return getBrotliCompressed_1.getBrotliCompressed; } });
6
- var getBrotliDecompressed_1 = require("./getBrotliDecompressed");
7
- Object.defineProperty(exports, "getBrotliDecompressed", { enumerable: true, get: function () { return getBrotliDecompressed_1.getBrotliDecompressed; } });
8
- var getGzipCompressed_1 = require("./getGzipCompressed");
9
- Object.defineProperty(exports, "getGzipCompressed", { enumerable: true, get: function () { return getGzipCompressed_1.getGzipCompressed; } });
10
- var getGzipDecompressed_1 = require("./getGzipDecompressed");
11
- Object.defineProperty(exports, "getGzipDecompressed", { enumerable: true, get: function () { return getGzipDecompressed_1.getGzipDecompressed; } });
1
+ export { getBrotliCompressed } from "./getBrotliCompressed";
2
+ export { getBrotliDecompressed } from "./getBrotliDecompressed";
3
+ export { getGzipCompressed } from "./getGzipCompressed";
4
+ export { getGzipDecompressed } from "./getGzipDecompressed";
package/util/sleep.js CHANGED
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = void 0;
4
- const sleep = (seconds) => {
1
+ export const sleep = (seconds) => {
5
2
  return new Promise(resolve => setTimeout(resolve, seconds * 1000));
6
3
  };
7
- exports.sleep = sleep;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebWorkerState = void 0;
4
- exports.WebWorkerState = {
1
+ export const WebWorkerState = {
5
2
  IDLE: "IDLE",
6
3
  CANCELLED: "CANCELLED",
7
4
  PENDING: "PENDING",
package/xml/getXml.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getXml = void 0;
4
- const axios_1 = require("../axios");
5
- const getXml = async (url) => {
1
+ import { get } from '../axios';
2
+ export const getXml = async (url) => {
6
3
  let response = '';
7
- const apiResponse = await (0, axios_1.get)(url);
4
+ const apiResponse = await get(url);
8
5
  if (apiResponse.isSuccess()) {
9
6
  response = apiResponse.getBody()
10
7
  .toString();
@@ -15,4 +12,3 @@ const getXml = async (url) => {
15
12
  }
16
13
  return response;
17
14
  };
18
- exports.getXml = getXml;
Binary file