@8ms/helpers 2.3.42 → 2.3.43
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
|
|
7
|
+
import axios 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 axios(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 axios from "axios";
|
|
3
3
|
|
|
4
4
|
//#region src/axios/deleteRequest.ts
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import get$1 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 axios.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 axios.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 axios.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);
|
|
@@ -2,6 +2,16 @@ import { t as BaseNamespace } from "../../index-DwB8X1lz.mjs";
|
|
|
2
2
|
import * as _1password_sdk0 from "@1password/sdk";
|
|
3
3
|
import { Client } from "@1password/sdk";
|
|
4
4
|
|
|
5
|
+
//#region src/onePassword/server/getIdsFromUrl.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Return the vault ID and item ID from an internal secret URL.
|
|
8
|
+
* Eg. https://start.1password.com/open/i?a=AAA&v=VVV&i=III&h=HHH would return vaultId = VVV and itemId = III.
|
|
9
|
+
*/
|
|
10
|
+
declare const getIdsFromUrl: (url: string) => {
|
|
11
|
+
vaultId: string;
|
|
12
|
+
itemId: string;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
5
15
|
//#region src/onePassword/server/OnePasswordNamespace.d.ts
|
|
6
16
|
declare class OnePasswordNamespace extends BaseNamespace {
|
|
7
17
|
client: Client;
|
|
@@ -21,4 +31,4 @@ type OnePasswordConfig = {
|
|
|
21
31
|
};
|
|
22
32
|
declare const onePasswordClient: (key?: string, config?: OnePasswordConfig) => Promise<OnePasswordNamespace>;
|
|
23
33
|
//#endregion
|
|
24
|
-
export { OnePasswordConfig, type OnePasswordNamespace, onePasswordClient };
|
|
34
|
+
export { OnePasswordConfig, type OnePasswordNamespace, getIdsFromUrl, onePasswordClient };
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
2
|
|
|
3
|
+
//#region src/onePassword/server/getIdsFromUrl.ts
|
|
4
|
+
/**
|
|
5
|
+
* Return the vault ID and item ID from an internal secret URL.
|
|
6
|
+
* Eg. https://start.1password.com/open/i?a=AAA&v=VVV&i=III&h=HHH would return vaultId = VVV and itemId = III.
|
|
7
|
+
*/
|
|
8
|
+
const getIdsFromUrl = (url) => {
|
|
9
|
+
const parsedUrl = new URL(url);
|
|
10
|
+
return {
|
|
11
|
+
vaultId: parsedUrl.searchParams.get("v"),
|
|
12
|
+
itemId: parsedUrl.searchParams.get("i")
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
3
17
|
//#region src/onePassword/server/OnePasswordNamespace.ts
|
|
4
18
|
var OnePasswordNamespace = class extends BaseNamespace {
|
|
5
19
|
ensureInit = async () => {
|
|
@@ -47,4 +61,4 @@ const onePasswordClient = async (key = "default", config) => {
|
|
|
47
61
|
};
|
|
48
62
|
|
|
49
63
|
//#endregion
|
|
50
|
-
export { OnePasswordNamespace, onePasswordClient };
|
|
64
|
+
export { OnePasswordNamespace, getIdsFromUrl, onePasswordClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDirectory } from "../../file/server/index.mjs";
|
|
2
|
-
import
|
|
2
|
+
import axios 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 axios({
|
|
15
15
|
method: "get",
|
|
16
16
|
url,
|
|
17
17
|
responseType: "stream"
|