@8ms/helpers 2.3.33 → 2.3.35

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.
@@ -4,7 +4,7 @@ import { getFolder, getStringFromStream } from "../../../string/index.mjs";
4
4
  import { n as isResponse200, t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
5
5
  import { getBrotliCompressed, getBrotliDecompressed, getGzipCompressed, getGzipDecompressed } from "../../../util/server/index.mjs";
6
6
  import { z } from "zod/v4";
7
- import axios from "axios";
7
+ import get from "axios";
8
8
 
9
9
  //#region src/aws/s3/server/AwsS3Namespace.ts
10
10
  var AwsS3Namespace = class extends BaseNamespace {
@@ -293,7 +293,7 @@ var AwsS3Namespace = class extends BaseNamespace {
293
293
  */
294
294
  urlContents = async (bucket, key, url) => {
295
295
  await this.ensureInit();
296
- return axios(url, {
296
+ return get(url, {
297
297
  responseType: "arraybuffer",
298
298
  responseEncoding: "binary"
299
299
  }).then(async (response) => {
@@ -1,5 +1,5 @@
1
1
  import { u as ApiResponseClass } from "../api-DGKJDAfb.mjs";
2
- import axios from "axios";
2
+ import get$1 from "axios";
3
3
 
4
4
  //#region src/axios/deleteRequest.ts
5
5
  /**
@@ -7,7 +7,7 @@ import axios from "axios";
7
7
  * Can't use the function name delete as it's reserved
8
8
  */
9
9
  const deleteRequest = async (url, config = {}) => {
10
- return await axios.delete(url, config).then(async (response) => {
10
+ return await get$1.delete(url, config).then(async (response) => {
11
11
  if (void 0 !== response.data.body && void 0 !== response.data.error && void 0 !== response.data.state) return new ApiResponseClass(response.data);
12
12
  else if (response.status >= 200 && response.status <= 299) return new ApiResponseClass().setToSuccess(response.data);
13
13
  return new ApiResponseClass().setToError(response.data, response.statusText);
@@ -22,7 +22,7 @@ const deleteRequest = async (url, config = {}) => {
22
22
  * Make a GET request.
23
23
  */
24
24
  const get = async (url, config = {}) => {
25
- return await axios.get(url, config).then(async (response) => {
25
+ return await get$1.get(url, config).then(async (response) => {
26
26
  if (void 0 !== response.data.body && void 0 !== response.data.error && void 0 !== response.data.state) return new ApiResponseClass(response.data);
27
27
  else if (response.status >= 200 && response.status <= 299) return new ApiResponseClass().setToSuccess(response.data);
28
28
  return new ApiResponseClass().setToError(response.data, response.statusText);
@@ -37,7 +37,7 @@ const get = async (url, config = {}) => {
37
37
  * Make a POST request.
38
38
  */
39
39
  const post = async (url, data = {}, config = {}) => {
40
- return await axios.post(url, data, config).then(async (response) => {
40
+ return await get$1.post(url, data, config).then(async (response) => {
41
41
  if (void 0 !== response.data.body && void 0 !== response.data.error && void 0 !== response.data.state) return new ApiResponseClass(response.data);
42
42
  else if (response.status >= 200 && response.status <= 299) return new ApiResponseClass().setToSuccess(response.data);
43
43
  return new ApiResponseClass().setToError(response.data, response.statusText);
@@ -1,25 +1,31 @@
1
- //#region src/crypto/getDecrypt.d.ts
1
+ //#region src/crypto/server/getDecrypt.d.ts
2
2
  /**
3
3
  * Decrypt an encoding string using a salt.
4
4
  */
5
5
  declare const getDecrypt: (appSalt: string, input: string, salt: string) => string;
6
6
  //#endregion
7
- //#region src/crypto/getEncrypt.d.ts
7
+ //#region src/crypto/server/getEncrypt.d.ts
8
8
  /**
9
9
  * Encrypt an encoding string using a salt.
10
10
  */
11
11
  declare const getEncrypt: (appSalt: string, input: string, salt: string) => string;
12
12
  //#endregion
13
- //#region src/crypto/getRandom.d.ts
13
+ //#region src/crypto/server/getMd5.d.ts
14
+ /**
15
+ * Encrypt a string using md5.
16
+ */
17
+ declare const getMd5: (input: any) => string;
18
+ //#endregion
19
+ //#region src/crypto/server/getRandom.d.ts
14
20
  /**
15
21
  * Create a random string and return a number of characters from it.
16
22
  */
17
23
  declare const getRandom: (length: number) => string;
18
24
  //#endregion
19
- //#region src/crypto/getSha256.d.ts
25
+ //#region src/crypto/server/getSha256.d.ts
20
26
  /**
21
27
  * Encrypt a string using sha256.
22
28
  */
23
29
  declare const getSha256: (input: any) => string;
24
30
  //#endregion
25
- export { getDecrypt, getEncrypt, getRandom, getSha256 };
31
+ export { getDecrypt, getEncrypt, getMd5, getRandom, getSha256 };
@@ -1,7 +1,7 @@
1
- import { t as __require } from "../chunk-DDarj8oW.mjs";
2
- import { getString } from "../string/index.mjs";
1
+ import { t as __require } from "../../chunk-DDarj8oW.mjs";
2
+ import { getString } from "../../string/index.mjs";
3
3
 
4
- //#region src/crypto/getDecrypt.ts
4
+ //#region src/crypto/server/getDecrypt.ts
5
5
  /**
6
6
  * Decrypt an encoding string using a salt.
7
7
  */
@@ -18,7 +18,7 @@ const getDecrypt = (appSalt, input, salt) => {
18
18
  };
19
19
 
20
20
  //#endregion
21
- //#region src/crypto/getEncrypt.ts
21
+ //#region src/crypto/server/getEncrypt.ts
22
22
  /**
23
23
  * Encrypt an encoding string using a salt.
24
24
  */
@@ -34,7 +34,18 @@ const getEncrypt = (appSalt, input, salt) => {
34
34
  };
35
35
 
36
36
  //#endregion
37
- //#region src/crypto/getRandom.ts
37
+ //#region src/crypto/server/getMd5.ts
38
+ /**
39
+ * Encrypt a string using md5.
40
+ */
41
+ const getMd5 = (input) => {
42
+ const crypto = __require("crypto");
43
+ const inputString = getString(input);
44
+ return crypto.createHash("md5").update(inputString).digest("hex");
45
+ };
46
+
47
+ //#endregion
48
+ //#region src/crypto/server/getRandom.ts
38
49
  /**
39
50
  * Create a random string and return a number of characters from it.
40
51
  */
@@ -43,7 +54,7 @@ const getRandom = (length) => {
43
54
  };
44
55
 
45
56
  //#endregion
46
- //#region src/crypto/getSha256.ts
57
+ //#region src/crypto/server/getSha256.ts
47
58
  /**
48
59
  * Encrypt a string using sha256.
49
60
  */
@@ -54,4 +65,4 @@ const getSha256 = (input) => {
54
65
  };
55
66
 
56
67
  //#endregion
57
- export { getDecrypt, getEncrypt, getRandom, getSha256 };
68
+ export { getDecrypt, getEncrypt, getMd5, getRandom, getSha256 };
@@ -1,5 +1,5 @@
1
1
  import { createDirectory } from "../../file/server/index.mjs";
2
- import axios from "axios";
2
+ import get from "axios";
3
3
 
4
4
  //#region src/url/server/writeUrlContents.ts
5
5
  /**
@@ -11,7 +11,7 @@ const writeUrlContents = async (filePath, url) => {
11
11
  const fs = await import("fs-extra");
12
12
  await createDirectory(filePath);
13
13
  const writer = fs.createWriteStream(filePath);
14
- await axios({
14
+ await get({
15
15
  method: "get",
16
16
  url,
17
17
  responseType: "stream"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.33",
4
+ "version": "2.3.35",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -214,7 +214,7 @@
214
214
  "./brightData/webScraperIde/server": "./dist/brightData/webScraperIde/server/index.mjs",
215
215
  "./cache/server": "./dist/cache/server/index.mjs",
216
216
  "./crud": "./dist/crud/index.mjs",
217
- "./crypto": "./dist/crypto/index.mjs",
217
+ "./crypto/server": "./dist/crypto/server/index.mjs",
218
218
  "./date": "./dist/date/index.mjs",
219
219
  "./drizzle/server": "./dist/drizzle/server/index.mjs",
220
220
  "./environment": "./dist/environment/index.mjs",