@8ms/helpers 2.3.6 → 2.3.7
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/.yarn/install-state.gz +0 -0
- package/dist/aws/s3/server/index.mjs +2 -2
- package/dist/axios/index.mjs +4 -4
- package/dist/nextJs/client/index.d.mts +10 -0
- package/dist/nextJs/client/index.mjs +12 -0
- package/dist/url/server/index.mjs +2 -2
- package/package.json +2 -1
- package/tsdown.config.ts +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -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
|
import cloneDeep from "lodash/cloneDeep";
|
|
9
9
|
|
|
10
10
|
//#region src/aws/s3/server/AwsS3Namespace.ts
|
|
@@ -294,7 +294,7 @@ var AwsS3Namespace = class extends BaseNamespace {
|
|
|
294
294
|
*/
|
|
295
295
|
urlContents = async (bucket, key, url) => {
|
|
296
296
|
await this.ensureInit();
|
|
297
|
-
return
|
|
297
|
+
return get(url, {
|
|
298
298
|
responseType: "arraybuffer",
|
|
299
299
|
responseEncoding: "binary"
|
|
300
300
|
}).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);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IntersectionOptions } from "react-intersection-observer";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/nextJs/client/LazyLoad.d.ts
|
|
5
|
+
type LazyLoadProps = IntersectionOptions & {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
declare const LazyLoad: (props: LazyLoadProps) => React.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LazyLoad };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useInView } from "react-intersection-observer";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/nextJs/client/LazyLoad.tsx
|
|
5
|
+
const LazyLoad = (props) => {
|
|
6
|
+
const { children, ...propsRest } = props;
|
|
7
|
+
const { ref, inView } = useInView(propsRest);
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { ref }, inView && children);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { LazyLoad };
|
|
@@ -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"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -242,6 +242,7 @@
|
|
|
242
242
|
"./myTarget/server": "./dist/myTarget/server/index.mjs",
|
|
243
243
|
"./nextAuth": "./dist/nextAuth/index.mjs",
|
|
244
244
|
"./nextJs": "./dist/nextJs/index.mjs",
|
|
245
|
+
"./nextJs/client": "./dist/nextJs/client/index.mjs",
|
|
245
246
|
"./number": "./dist/number/index.mjs",
|
|
246
247
|
"./object": "./dist/object/index.mjs",
|
|
247
248
|
"./onePassword/server": "./dist/onePassword/server/index.mjs",
|