@8ms/helpers 2.3.28 → 2.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aws/s3/server/index.mjs +2 -2
- package/dist/axios/index.mjs +4 -4
- package/dist/crypto/index.d.mts +3 -3
- package/dist/crypto/index.mjs +3 -3
- package/dist/googleCloud/bigquery/server/index.mjs +1 -1
- package/dist/url/index.d.mts +1 -11
- package/dist/url/index.mjs +1 -13
- package/dist/url/server/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
296
|
+
return get(url, {
|
|
297
297
|
responseType: "arraybuffer",
|
|
298
298
|
responseEncoding: "binary"
|
|
299
299
|
}).then(async (response) => {
|
package/dist/axios/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as ApiResponseClass } from "../api-DGKJDAfb.mjs";
|
|
2
|
-
import
|
|
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
|
|
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
|
|
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
|
|
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);
|
package/dist/crypto/index.d.mts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Decrypt an encoding string using a salt.
|
|
4
4
|
*/
|
|
5
|
-
declare const getDecrypt: (appSalt: string, input: string, salt: string) =>
|
|
5
|
+
declare const getDecrypt: (appSalt: string, input: string, salt: string) => string;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/crypto/getEncrypt.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Encrypt an encoding string using a salt.
|
|
10
10
|
*/
|
|
11
|
-
declare const getEncrypt: (appSalt: string, input: string, salt: string) =>
|
|
11
|
+
declare const getEncrypt: (appSalt: string, input: string, salt: string) => string;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/crypto/getRandom.d.ts
|
|
14
14
|
/**
|
|
@@ -20,6 +20,6 @@ declare const getRandom: (length: number) => string;
|
|
|
20
20
|
/**
|
|
21
21
|
* Encrypt a string using sha256.
|
|
22
22
|
*/
|
|
23
|
-
declare const getSha256: (input: any) =>
|
|
23
|
+
declare const getSha256: (input: any) => string;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { getDecrypt, getEncrypt, getRandom, getSha256 };
|
package/dist/crypto/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { getString } from "../string/index.mjs";
|
|
|
5
5
|
/**
|
|
6
6
|
* Decrypt an encoding string using a salt.
|
|
7
7
|
*/
|
|
8
|
-
const getDecrypt =
|
|
8
|
+
const getDecrypt = (appSalt, input, salt) => {
|
|
9
9
|
const crypto = __require("crypto");
|
|
10
10
|
const ALGORITHM = "aes-256-cbc";
|
|
11
11
|
const customSalt = `${appSalt}-${salt}`;
|
|
@@ -22,7 +22,7 @@ const getDecrypt = async (appSalt, input, salt) => {
|
|
|
22
22
|
/**
|
|
23
23
|
* Encrypt an encoding string using a salt.
|
|
24
24
|
*/
|
|
25
|
-
const getEncrypt =
|
|
25
|
+
const getEncrypt = (appSalt, input, salt) => {
|
|
26
26
|
const crypto = __require("crypto");
|
|
27
27
|
const ALGORITHM = "aes-256-cbc";
|
|
28
28
|
const customSalt = `${appSalt}-${salt}`;
|
|
@@ -47,7 +47,7 @@ const getRandom = (length) => {
|
|
|
47
47
|
/**
|
|
48
48
|
* Encrypt a string using sha256.
|
|
49
49
|
*/
|
|
50
|
-
const getSha256 =
|
|
50
|
+
const getSha256 = (input) => {
|
|
51
51
|
const crypto = __require("crypto");
|
|
52
52
|
const inputString = getString(input);
|
|
53
53
|
return crypto.createHash("sha256").update(inputString).digest("hex");
|
|
@@ -54,7 +54,7 @@ var GoogleCloudBigqueryNamespace = class extends BaseNamespace {
|
|
|
54
54
|
query = async (props) => {
|
|
55
55
|
await this.ensureInit();
|
|
56
56
|
let options = { query: "" };
|
|
57
|
-
if ("string" === props) options.query = props;
|
|
57
|
+
if ("string" === typeof props) options.query = props;
|
|
58
58
|
else if (isObject(props)) {
|
|
59
59
|
options.query = props.query;
|
|
60
60
|
if (props?.location) options["location"] = props.location;
|
package/dist/url/index.d.mts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
//#region src/url/url.d.ts
|
|
2
|
-
type EnvironmentUrl = {
|
|
3
|
-
localhost: string;
|
|
4
|
-
development: string;
|
|
5
|
-
staging: string;
|
|
6
|
-
production: string;
|
|
7
|
-
};
|
|
8
2
|
/**
|
|
9
3
|
* Does the URL begin with HTTP or HTTPS?
|
|
10
4
|
*/
|
|
@@ -21,9 +15,5 @@ declare const buildParameters: (existing?: object, updated?: object) => string;
|
|
|
21
15
|
* Create a new relative URL based on the current path.
|
|
22
16
|
*/
|
|
23
17
|
declare const buildRelative: (router: any, updated?: object) => string;
|
|
24
|
-
/**
|
|
25
|
-
* Get the current base url.
|
|
26
|
-
*/
|
|
27
|
-
declare const buildEnvironmentUrl: (path: string, url: EnvironmentUrl) => string;
|
|
28
18
|
//#endregion
|
|
29
|
-
export {
|
|
19
|
+
export { buildParameters, buildRelative, isAbsolute, isRelative };
|
package/dist/url/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { merge } from "../lodash/index.mjs";
|
|
2
|
-
import { isDevelopment, isLocalhost, isProduction, isStaging } from "../environment/index.mjs";
|
|
3
2
|
|
|
4
3
|
//#region src/url/url.ts
|
|
5
4
|
/**
|
|
@@ -36,17 +35,6 @@ const buildParameters = (existing = {}, updated = {}) => {
|
|
|
36
35
|
const buildRelative = (router, updated = {}) => {
|
|
37
36
|
return `${router.pathname}${buildParameters(router.query, updated || {})}`;
|
|
38
37
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Get the current base url.
|
|
41
|
-
*/
|
|
42
|
-
const buildEnvironmentUrl = (path, url) => {
|
|
43
|
-
let response;
|
|
44
|
-
if (isDevelopment() && isLocalhost()) response = url.localhost;
|
|
45
|
-
else if (isStaging()) response = url.staging;
|
|
46
|
-
else if (isProduction()) response = url.production;
|
|
47
|
-
else response = url.development;
|
|
48
|
-
return response + path || "";
|
|
49
|
-
};
|
|
50
38
|
|
|
51
39
|
//#endregion
|
|
52
|
-
export {
|
|
40
|
+
export { buildParameters, buildRelative, isAbsolute, isRelative };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDirectory } from "../../file/server/index.mjs";
|
|
2
|
-
import
|
|
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
|
|
14
|
+
await get({
|
|
15
15
|
method: "get",
|
|
16
16
|
url,
|
|
17
17
|
responseType: "stream"
|