@8ms/helpers 2.4.19 → 2.4.20
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/api/deleteRequest.cjs +4 -2
- package/dist/api/deleteRequest.mjs +1 -1
- package/dist/api/get.cjs +4 -2
- package/dist/api/get.mjs +1 -1
- package/dist/api/post.cjs +4 -2
- package/dist/api/post.mjs +1 -1
- package/dist/aws/s3/server/AwsS3Namespace.cjs +4 -2
- package/dist/aws/s3/server/AwsS3Namespace.mjs +1 -1
- package/dist/file/server/createDirectory.cjs +6 -3
- package/dist/file/server/createDirectory.mjs +4 -3
- package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.cjs +4 -1
- package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.mjs +2 -1
- package/dist/lumar/api/server/buildRequest.cjs +2 -2
- package/dist/lumar/api/server/buildRequest.mjs +2 -2
- package/dist/lumar/api/server/{initClient.cjs → getAccessToken.cjs} +3 -3
- package/dist/lumar/api/server/getAccessToken.d.cts +9 -0
- package/dist/lumar/api/server/getAccessToken.d.mts +9 -0
- package/dist/lumar/api/server/{initClient.mjs → getAccessToken.mjs} +3 -3
- package/dist/lumar/api/server/index.cjs +2 -2
- package/dist/lumar/api/server/index.d.cts +2 -2
- package/dist/lumar/api/server/index.d.mts +2 -2
- package/dist/lumar/api/server/index.mjs +2 -2
- package/dist/lumar/graphql/server/{initClient.cjs → getAccessToken.cjs} +3 -3
- package/dist/lumar/graphql/server/getAccessToken.d.cts +8 -0
- package/dist/lumar/graphql/server/getAccessToken.d.mts +8 -0
- package/dist/lumar/graphql/server/{initClient.mjs → getAccessToken.mjs} +3 -3
- package/dist/lumar/graphql/server/index.cjs +2 -2
- package/dist/lumar/graphql/server/index.d.cts +2 -2
- package/dist/lumar/graphql/server/index.d.mts +2 -2
- package/dist/lumar/graphql/server/index.mjs +2 -2
- package/dist/url/server/writeUrlContents.cjs +6 -5
- package/dist/url/server/writeUrlContents.mjs +3 -3
- package/package.json +9 -9
- package/dist/lumar/api/server/initClient.d.cts +0 -9
- package/dist/lumar/api/server/initClient.d.mts +0 -9
- package/dist/lumar/graphql/server/initClient.d.cts +0 -8
- package/dist/lumar/graphql/server/initClient.d.mts +0 -8
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_api_ApiResponseClass = require("./ApiResponseClass.cjs");
|
|
4
|
+
let ky = require("ky");
|
|
5
|
+
ky = require_runtime.__toESM(ky);
|
|
3
6
|
//#region src/api/deleteRequest.ts
|
|
4
7
|
/**
|
|
5
8
|
* Make a DELETE request.
|
|
6
9
|
* Can't use the function name delete as it's reserved
|
|
7
10
|
*/
|
|
8
11
|
const deleteRequest = async (url, config = {}) => {
|
|
9
|
-
|
|
10
|
-
return await ky.delete(url, {
|
|
12
|
+
return await ky.default.delete(url, {
|
|
11
13
|
retry: 0,
|
|
12
14
|
timeout: false,
|
|
13
15
|
throwHttpErrors: false,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApiResponseClass } from "./ApiResponseClass.mjs";
|
|
2
|
+
import ky from "ky";
|
|
2
3
|
//#region src/api/deleteRequest.ts
|
|
3
4
|
/**
|
|
4
5
|
* Make a DELETE request.
|
|
5
6
|
* Can't use the function name delete as it's reserved
|
|
6
7
|
*/
|
|
7
8
|
const deleteRequest = async (url, config = {}) => {
|
|
8
|
-
const { default: ky } = await import("ky");
|
|
9
9
|
return await ky.delete(url, {
|
|
10
10
|
retry: 0,
|
|
11
11
|
timeout: false,
|
package/dist/api/get.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_api_ApiResponseClass = require("./ApiResponseClass.cjs");
|
|
4
|
+
let ky = require("ky");
|
|
5
|
+
ky = require_runtime.__toESM(ky);
|
|
3
6
|
//#region src/api/get.ts
|
|
4
7
|
/**
|
|
5
8
|
* Make a GET request.
|
|
6
9
|
*/
|
|
7
10
|
const get = async (url, config = {}) => {
|
|
8
|
-
|
|
9
|
-
return await ky.get(url, {
|
|
11
|
+
return await ky.default.get(url, {
|
|
10
12
|
retry: 0,
|
|
11
13
|
timeout: false,
|
|
12
14
|
throwHttpErrors: false,
|
package/dist/api/get.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ApiResponseClass } from "./ApiResponseClass.mjs";
|
|
2
|
+
import ky from "ky";
|
|
2
3
|
//#region src/api/get.ts
|
|
3
4
|
/**
|
|
4
5
|
* Make a GET request.
|
|
5
6
|
*/
|
|
6
7
|
const get = async (url, config = {}) => {
|
|
7
|
-
const { default: ky } = await import("ky");
|
|
8
8
|
return await ky.get(url, {
|
|
9
9
|
retry: 0,
|
|
10
10
|
timeout: false,
|
package/dist/api/post.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_api_ApiResponseClass = require("./ApiResponseClass.cjs");
|
|
4
|
+
let ky = require("ky");
|
|
5
|
+
ky = require_runtime.__toESM(ky);
|
|
3
6
|
//#region src/api/post.ts
|
|
4
7
|
/**
|
|
5
8
|
* Make a POST request.
|
|
6
9
|
*/
|
|
7
10
|
const post = async (url, data = {}, config = {}) => {
|
|
8
|
-
|
|
9
|
-
return await ky.post(url, {
|
|
11
|
+
return await ky.default.post(url, {
|
|
10
12
|
json: data,
|
|
11
13
|
retry: 0,
|
|
12
14
|
timeout: false,
|
package/dist/api/post.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ApiResponseClass } from "./ApiResponseClass.mjs";
|
|
2
|
+
import ky from "ky";
|
|
2
3
|
//#region src/api/post.ts
|
|
3
4
|
/**
|
|
4
5
|
* Make a POST request.
|
|
5
6
|
*/
|
|
6
7
|
const post = async (url, data = {}, config = {}) => {
|
|
7
|
-
const { default: ky } = await import("ky");
|
|
8
8
|
return await ky.post(url, {
|
|
9
9
|
json: data,
|
|
10
10
|
retry: 0,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require__class_BaseNamespace = require("../../../_class/BaseNamespace.cjs");
|
|
3
4
|
const require_date_calculation = require("../../../date/calculation.cjs");
|
|
4
5
|
const require_date_format = require("../../../date/format.cjs");
|
|
@@ -14,6 +15,8 @@ const require_util_server_getGzipCompressed = require("../../../util/server/getG
|
|
|
14
15
|
const require_util_server_getGzipDecompressed = require("../../../util/server/getGzipDecompressed.cjs");
|
|
15
16
|
const require_aws_s3_server_awsS3 = require("./awsS3.cjs");
|
|
16
17
|
require("./index.cjs");
|
|
18
|
+
let ky = require("ky");
|
|
19
|
+
ky = require_runtime.__toESM(ky);
|
|
17
20
|
//#region src/aws/s3/server/AwsS3Namespace.ts
|
|
18
21
|
var AwsS3Namespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
19
22
|
ensureInit = async () => {
|
|
@@ -298,8 +301,7 @@ var AwsS3Namespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
298
301
|
*/
|
|
299
302
|
urlContents = async (bucket, key, url) => {
|
|
300
303
|
await this.ensureInit();
|
|
301
|
-
const
|
|
302
|
-
const response = await ky.get(url);
|
|
304
|
+
const response = await ky.default.get(url);
|
|
303
305
|
const arrayBuffer = await response.arrayBuffer();
|
|
304
306
|
const data = Buffer.from(arrayBuffer);
|
|
305
307
|
await this.writeFile(bucket, key, data, {
|
|
@@ -13,6 +13,7 @@ import { getGzipCompressed } from "../../../util/server/getGzipCompressed.mjs";
|
|
|
13
13
|
import { getGzipDecompressed } from "../../../util/server/getGzipDecompressed.mjs";
|
|
14
14
|
import { readFileDefault } from "./awsS3.mjs";
|
|
15
15
|
import "./index.mjs";
|
|
16
|
+
import ky from "ky";
|
|
16
17
|
//#region src/aws/s3/server/AwsS3Namespace.ts
|
|
17
18
|
var AwsS3Namespace = class extends BaseNamespace {
|
|
18
19
|
ensureInit = async () => {
|
|
@@ -297,7 +298,6 @@ var AwsS3Namespace = class extends BaseNamespace {
|
|
|
297
298
|
*/
|
|
298
299
|
urlContents = async (bucket, key, url) => {
|
|
299
300
|
await this.ensureInit();
|
|
300
|
-
const { default: ky } = await import("ky");
|
|
301
301
|
const response = await ky.get(url);
|
|
302
302
|
const arrayBuffer = await response.arrayBuffer();
|
|
303
303
|
const data = Buffer.from(arrayBuffer);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let fs_extra = require("fs-extra");
|
|
4
|
+
let path = require("path");
|
|
5
|
+
path = require_runtime.__toESM(path);
|
|
2
6
|
//#region src/file/server/createDirectory.ts
|
|
3
7
|
/**
|
|
4
8
|
* Create a directory recursively.
|
|
@@ -6,9 +10,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
6
10
|
*/
|
|
7
11
|
const createDirectory = (filePath) => {
|
|
8
12
|
return new Promise(async (resolve, reject) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
fs.ensureDirSync(fileDir);
|
|
13
|
+
const fileDir = path.default.parse(filePath).dir;
|
|
14
|
+
(0, fs_extra.ensureDirSync)(fileDir);
|
|
12
15
|
resolve(true);
|
|
13
16
|
});
|
|
14
17
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ensureDirSync } from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
1
3
|
//#region src/file/server/createDirectory.ts
|
|
2
4
|
/**
|
|
3
5
|
* Create a directory recursively.
|
|
@@ -5,9 +7,8 @@
|
|
|
5
7
|
*/
|
|
6
8
|
const createDirectory = (filePath) => {
|
|
7
9
|
return new Promise(async (resolve, reject) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
fs.ensureDirSync(fileDir);
|
|
10
|
+
const fileDir = path.parse(filePath).dir;
|
|
11
|
+
ensureDirSync(fileDir);
|
|
11
12
|
resolve(true);
|
|
12
13
|
});
|
|
13
14
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require__class_BaseNamespace = require("../../../_class/BaseNamespace.cjs");
|
|
3
4
|
const require_googleCloud_server_googleCloud = require("../../server/googleCloud.cjs");
|
|
5
|
+
let stream = require("stream");
|
|
6
|
+
stream = require_runtime.__toESM(stream);
|
|
4
7
|
//#region src/googleCloud/storage/server/GoogleCloudStorageNamespace.ts
|
|
5
8
|
var GoogleCloudStorageNamespace = class extends require__class_BaseNamespace.BaseNamespace {
|
|
6
9
|
ensureInit = async () => {
|
|
@@ -31,7 +34,7 @@ var GoogleCloudStorageNamespace = class extends require__class_BaseNamespace.Bas
|
|
|
31
34
|
*/
|
|
32
35
|
writeFile = async (bucket, key, data, options = {}) => {
|
|
33
36
|
await this.ensureInit();
|
|
34
|
-
const dataStream = new
|
|
37
|
+
const dataStream = new stream.default.PassThrough();
|
|
35
38
|
const googleFile = this.client.bucket(bucket).file(key);
|
|
36
39
|
dataStream.push(data);
|
|
37
40
|
dataStream.push(null);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
import { getConfig } from "../../server/googleCloud.mjs";
|
|
3
|
+
import stream from "stream";
|
|
3
4
|
//#region src/googleCloud/storage/server/GoogleCloudStorageNamespace.ts
|
|
4
5
|
var GoogleCloudStorageNamespace = class extends BaseNamespace {
|
|
5
6
|
ensureInit = async () => {
|
|
@@ -30,7 +31,7 @@ var GoogleCloudStorageNamespace = class extends BaseNamespace {
|
|
|
30
31
|
*/
|
|
31
32
|
writeFile = async (bucket, key, data, options = {}) => {
|
|
32
33
|
await this.ensureInit();
|
|
33
|
-
const dataStream = new
|
|
34
|
+
const dataStream = new stream.PassThrough();
|
|
34
35
|
const googleFile = this.client.bucket(bucket).file(key);
|
|
35
36
|
dataStream.push(data);
|
|
36
37
|
dataStream.push(null);
|
|
@@ -18,8 +18,8 @@ const buildRequest = (props) => {
|
|
|
18
18
|
break;
|
|
19
19
|
case require_lumar_api_server_lumarApi.report.CUSTOM:
|
|
20
20
|
url += props.customPath;
|
|
21
|
-
url = url.replace("[PROJECT]", props
|
|
22
|
-
url = url.replace("[CRAWL]", props
|
|
21
|
+
url = url.replace("[PROJECT]", String(props?.projectId ?? ""));
|
|
22
|
+
url = url.replace("[CRAWL]", String(props?.crawlId ?? ""));
|
|
23
23
|
break;
|
|
24
24
|
case require_lumar_api_server_lumarApi.report.CRAWL_STATISTICS:
|
|
25
25
|
url += `/projects/${props.projectId}/crawls/${props.crawlId}/statistics`;
|
|
@@ -17,8 +17,8 @@ const buildRequest = (props) => {
|
|
|
17
17
|
break;
|
|
18
18
|
case report.CUSTOM:
|
|
19
19
|
url += props.customPath;
|
|
20
|
-
url = url.replace("[PROJECT]", props
|
|
21
|
-
url = url.replace("[CRAWL]", props
|
|
20
|
+
url = url.replace("[PROJECT]", String(props?.projectId ?? ""));
|
|
21
|
+
url = url.replace("[CRAWL]", String(props?.crawlId ?? ""));
|
|
22
22
|
break;
|
|
23
23
|
case report.CRAWL_STATISTICS:
|
|
24
24
|
url += `/projects/${props.projectId}/crawls/${props.crawlId}/statistics`;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_api_post = require("../../../api/post.cjs");
|
|
3
|
-
//#region src/lumar/api/server/
|
|
3
|
+
//#region src/lumar/api/server/getAccessToken.ts
|
|
4
4
|
const lumarApis = /* @__PURE__ */ new Map();
|
|
5
5
|
/**
|
|
6
6
|
* http://api-docs.deepcrawl.com/
|
|
7
7
|
* Renew the Lumar user token.
|
|
8
8
|
* Token lasts for 6 hours.
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const getAccessToken = async (apiId, apiKey) => {
|
|
11
11
|
if (lumarApis.has(apiId)) return lumarApis.get(apiId);
|
|
12
12
|
const token = (await require_api_post.post(`https://api.deepcrawl.com/sessions`, { auth: {
|
|
13
13
|
username: apiId,
|
|
@@ -17,4 +17,4 @@ const initClient = async (apiId, apiKey) => {
|
|
|
17
17
|
return token;
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
|
-
exports.
|
|
20
|
+
exports.getAccessToken = getAccessToken;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/lumar/api/server/getAccessToken.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* http://api-docs.deepcrawl.com/
|
|
4
|
+
* Renew the Lumar user token.
|
|
5
|
+
* Token lasts for 6 hours.
|
|
6
|
+
*/
|
|
7
|
+
declare const getAccessToken: (apiId: string, apiKey: string) => Promise<any>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getAccessToken };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/lumar/api/server/getAccessToken.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* http://api-docs.deepcrawl.com/
|
|
4
|
+
* Renew the Lumar user token.
|
|
5
|
+
* Token lasts for 6 hours.
|
|
6
|
+
*/
|
|
7
|
+
declare const getAccessToken: (apiId: string, apiKey: string) => Promise<any>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getAccessToken };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { post } from "../../../api/post.mjs";
|
|
2
|
-
//#region src/lumar/api/server/
|
|
2
|
+
//#region src/lumar/api/server/getAccessToken.ts
|
|
3
3
|
const lumarApis = /* @__PURE__ */ new Map();
|
|
4
4
|
/**
|
|
5
5
|
* http://api-docs.deepcrawl.com/
|
|
6
6
|
* Renew the Lumar user token.
|
|
7
7
|
* Token lasts for 6 hours.
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const getAccessToken = async (apiId, apiKey) => {
|
|
10
10
|
if (lumarApis.has(apiId)) return lumarApis.get(apiId);
|
|
11
11
|
const token = (await post(`https://api.deepcrawl.com/sessions`, { auth: {
|
|
12
12
|
username: apiId,
|
|
@@ -16,4 +16,4 @@ const initClient = async (apiId, apiKey) => {
|
|
|
16
16
|
return token;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
|
-
export {
|
|
19
|
+
export { getAccessToken };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_lumar_api_server_lumarApi = require("./lumarApi.cjs");
|
|
3
3
|
const require_lumar_api_server_getData = require("./getData.cjs");
|
|
4
|
-
const
|
|
4
|
+
const require_lumar_api_server_getAccessToken = require("./getAccessToken.cjs");
|
|
5
5
|
const require_lumar_api_server_buildRequest = require("./buildRequest.cjs");
|
|
6
6
|
exports.buildRequest = require_lumar_api_server_buildRequest.buildRequest;
|
|
7
|
+
exports.getAccessToken = require_lumar_api_server_getAccessToken.getAccessToken;
|
|
7
8
|
exports.getData = require_lumar_api_server_getData.getData;
|
|
8
|
-
exports.initClient = require_lumar_api_server_initClient.initClient;
|
|
9
9
|
exports.operand = require_lumar_api_server_lumarApi.operand;
|
|
10
10
|
exports.order = require_lumar_api_server_lumarApi.order;
|
|
11
11
|
exports.report = require_lumar_api_server_lumarApi.report;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Filter, Operand, Order, OrderRow, Report, operand, order, report } from "./lumarApi.cjs";
|
|
2
2
|
import { getData } from "./getData.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { getAccessToken } from "./getAccessToken.cjs";
|
|
4
4
|
import { BuildRequestProps, buildRequest } from "./buildRequest.cjs";
|
|
5
|
-
export { BuildRequestProps, Filter, Operand, Order, OrderRow, Report, buildRequest,
|
|
5
|
+
export { BuildRequestProps, Filter, Operand, Order, OrderRow, Report, buildRequest, getAccessToken, getData, operand, order, report };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Filter, Operand, Order, OrderRow, Report, operand, order, report } from "./lumarApi.mjs";
|
|
2
2
|
import { getData } from "./getData.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { getAccessToken } from "./getAccessToken.mjs";
|
|
4
4
|
import { BuildRequestProps, buildRequest } from "./buildRequest.mjs";
|
|
5
|
-
export { BuildRequestProps, Filter, Operand, Order, OrderRow, Report, buildRequest,
|
|
5
|
+
export { BuildRequestProps, Filter, Operand, Order, OrderRow, Report, buildRequest, getAccessToken, getData, operand, order, report };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { operand, order, report } from "./lumarApi.mjs";
|
|
2
2
|
import { getData } from "./getData.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { getAccessToken } from "./getAccessToken.mjs";
|
|
4
4
|
import { buildRequest } from "./buildRequest.mjs";
|
|
5
|
-
export { buildRequest,
|
|
5
|
+
export { buildRequest, getAccessToken, getData, operand, order, report };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_api_post = require("../../../api/post.cjs");
|
|
3
|
-
//#region src/lumar/graphql/server/
|
|
3
|
+
//#region src/lumar/graphql/server/getAccessToken.ts
|
|
4
4
|
const lumarGraphQls = /* @__PURE__ */ new Map();
|
|
5
5
|
/**
|
|
6
6
|
* https://api-docs.lumar.io/graphql/explorer/
|
|
7
7
|
* Renew the Lumar user token.
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const getAccessToken = async (id, secret) => {
|
|
10
10
|
if (lumarGraphQls.has(id)) return lumarGraphQls.get(id);
|
|
11
11
|
const token = (await require_api_post.post(`https://api.lumar.io/graphql`, {
|
|
12
12
|
query: "mutation LoginWithUserKey($secret: String!, $userKeyId: ObjectID!) { createSessionUsingUserKey(input: {userKeyId: $userKeyId, secret: $secret}) { token }}",
|
|
@@ -23,4 +23,4 @@ const initClient = async (id, secret) => {
|
|
|
23
23
|
return token;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
|
-
exports.
|
|
26
|
+
exports.getAccessToken = getAccessToken;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/lumar/graphql/server/getAccessToken.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* https://api-docs.lumar.io/graphql/explorer/
|
|
4
|
+
* Renew the Lumar user token.
|
|
5
|
+
*/
|
|
6
|
+
declare const getAccessToken: (id: string, secret: string) => Promise<any>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getAccessToken };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/lumar/graphql/server/getAccessToken.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* https://api-docs.lumar.io/graphql/explorer/
|
|
4
|
+
* Renew the Lumar user token.
|
|
5
|
+
*/
|
|
6
|
+
declare const getAccessToken: (id: string, secret: string) => Promise<any>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getAccessToken };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { post } from "../../../api/post.mjs";
|
|
2
|
-
//#region src/lumar/graphql/server/
|
|
2
|
+
//#region src/lumar/graphql/server/getAccessToken.ts
|
|
3
3
|
const lumarGraphQls = /* @__PURE__ */ new Map();
|
|
4
4
|
/**
|
|
5
5
|
* https://api-docs.lumar.io/graphql/explorer/
|
|
6
6
|
* Renew the Lumar user token.
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const getAccessToken = async (id, secret) => {
|
|
9
9
|
if (lumarGraphQls.has(id)) return lumarGraphQls.get(id);
|
|
10
10
|
const token = (await post(`https://api.lumar.io/graphql`, {
|
|
11
11
|
query: "mutation LoginWithUserKey($secret: String!, $userKeyId: ObjectID!) { createSessionUsingUserKey(input: {userKeyId: $userKeyId, secret: $secret}) { token }}",
|
|
@@ -22,4 +22,4 @@ const initClient = async (id, secret) => {
|
|
|
22
22
|
return token;
|
|
23
23
|
};
|
|
24
24
|
//#endregion
|
|
25
|
-
export {
|
|
25
|
+
export { getAccessToken };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_lumar_graphql_server_columns = require("./columns.cjs");
|
|
3
|
+
const require_lumar_graphql_server_getAccessToken = require("./getAccessToken.cjs");
|
|
3
4
|
const require_lumar_graphql_server_getData = require("./getData.cjs");
|
|
4
5
|
const require_lumar_graphql_server_lumarGraphql = require("./lumarGraphql.cjs");
|
|
5
|
-
const require_lumar_graphql_server_initClient = require("./initClient.cjs");
|
|
6
6
|
const require_lumar_graphql_server_reportTemplates = require("./reportTemplates.cjs");
|
|
7
7
|
require("./queries/getReportDifferences.cjs");
|
|
8
8
|
exports.column = require_lumar_graphql_server_columns.column;
|
|
9
|
+
exports.getAccessToken = require_lumar_graphql_server_getAccessToken.getAccessToken;
|
|
9
10
|
exports.getData = require_lumar_graphql_server_getData.getData;
|
|
10
11
|
exports.getReportKey = require_lumar_graphql_server_lumarGraphql.getReportKey;
|
|
11
|
-
exports.initClient = require_lumar_graphql_server_initClient.initClient;
|
|
12
12
|
exports.operand = require_lumar_graphql_server_lumarGraphql.operand;
|
|
13
13
|
exports.reportTemplate = require_lumar_graphql_server_reportTemplates.reportTemplate;
|
|
14
14
|
exports.reportType = require_lumar_graphql_server_lumarGraphql.reportType;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Column, column } from "./columns.cjs";
|
|
2
|
+
import { getAccessToken } from "./getAccessToken.cjs";
|
|
2
3
|
import { getData } from "./getData.cjs";
|
|
3
4
|
import { Operand, ReportType, getReportKey, operand, reportType } from "./lumarGraphql.cjs";
|
|
4
|
-
import { initClient } from "./initClient.cjs";
|
|
5
5
|
import { ReportTemplate, reportTemplate } from "./reportTemplates.cjs";
|
|
6
6
|
import { Crawl } from "./queries/crawl.cjs";
|
|
7
7
|
import { Row } from "./queries/row.cjs";
|
|
8
|
-
export { Column, Crawl, Operand, ReportTemplate, ReportType, Row, column, getData, getReportKey,
|
|
8
|
+
export { Column, Crawl, Operand, ReportTemplate, ReportType, Row, column, getAccessToken, getData, getReportKey, operand, reportTemplate, reportType };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Column, column } from "./columns.mjs";
|
|
2
|
+
import { getAccessToken } from "./getAccessToken.mjs";
|
|
2
3
|
import { getData } from "./getData.mjs";
|
|
3
4
|
import { Operand, ReportType, getReportKey, operand, reportType } from "./lumarGraphql.mjs";
|
|
4
|
-
import { initClient } from "./initClient.mjs";
|
|
5
5
|
import { ReportTemplate, reportTemplate } from "./reportTemplates.mjs";
|
|
6
6
|
import { Crawl } from "./queries/crawl.mjs";
|
|
7
7
|
import { Row } from "./queries/row.mjs";
|
|
8
|
-
export { Column, Crawl, Operand, ReportTemplate, ReportType, Row, column, getData, getReportKey,
|
|
8
|
+
export { Column, Crawl, Operand, ReportTemplate, ReportType, Row, column, getAccessToken, getData, getReportKey, operand, reportTemplate, reportType };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { column } from "./columns.mjs";
|
|
2
|
+
import { getAccessToken } from "./getAccessToken.mjs";
|
|
2
3
|
import { getData } from "./getData.mjs";
|
|
3
4
|
import { getReportKey, operand, reportType } from "./lumarGraphql.mjs";
|
|
4
|
-
import { initClient } from "./initClient.mjs";
|
|
5
5
|
import { reportTemplate } from "./reportTemplates.mjs";
|
|
6
6
|
import "./queries/getReportDifferences.mjs";
|
|
7
|
-
export { column, getData, getReportKey,
|
|
7
|
+
export { column, getAccessToken, getData, getReportKey, operand, reportTemplate, reportType };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_file_server_createDirectory = require("../../file/server/createDirectory.cjs");
|
|
4
4
|
require("../../file/server/index.cjs");
|
|
5
|
+
let ky = require("ky");
|
|
6
|
+
ky = require_runtime.__toESM(ky);
|
|
7
|
+
let fs_extra = require("fs-extra");
|
|
5
8
|
let stream = require("stream");
|
|
6
9
|
//#region src/url/server/writeUrlContents.ts
|
|
7
10
|
/**
|
|
@@ -10,11 +13,9 @@ let stream = require("stream");
|
|
|
10
13
|
* Requires fs-extra
|
|
11
14
|
*/
|
|
12
15
|
const writeUrlContents = async (filePath, url) => {
|
|
13
|
-
const { default: ky } = await import("ky");
|
|
14
|
-
const fs = await import("fs-extra");
|
|
15
16
|
await require_file_server_createDirectory.createDirectory(filePath);
|
|
16
|
-
const writer =
|
|
17
|
-
const response = await ky.get(url);
|
|
17
|
+
const writer = (0, fs_extra.createWriteStream)(filePath);
|
|
18
|
+
const response = await ky.default.get(url);
|
|
18
19
|
const stream$1 = stream.Readable.fromWeb(response.body);
|
|
19
20
|
await new Promise((resolve, reject) => {
|
|
20
21
|
stream$1.pipe(writer);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createDirectory } from "../../file/server/createDirectory.mjs";
|
|
2
2
|
import "../../file/server/index.mjs";
|
|
3
|
+
import ky from "ky";
|
|
4
|
+
import { createWriteStream } from "fs-extra";
|
|
3
5
|
import { Readable } from "stream";
|
|
4
6
|
//#region src/url/server/writeUrlContents.ts
|
|
5
7
|
/**
|
|
@@ -8,10 +10,8 @@ import { Readable } from "stream";
|
|
|
8
10
|
* Requires fs-extra
|
|
9
11
|
*/
|
|
10
12
|
const writeUrlContents = async (filePath, url) => {
|
|
11
|
-
const { default: ky } = await import("ky");
|
|
12
|
-
const fs = await import("fs-extra");
|
|
13
13
|
await createDirectory(filePath);
|
|
14
|
-
const writer =
|
|
14
|
+
const writer = createWriteStream(filePath);
|
|
15
15
|
const response = await ky.get(url);
|
|
16
16
|
const stream = Readable.fromWeb(response.body);
|
|
17
17
|
await new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.20",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -842,14 +842,14 @@
|
|
|
842
842
|
"import": "./dist/lumar/api/server/buildRequest.mjs",
|
|
843
843
|
"require": "./dist/lumar/api/server/buildRequest.cjs"
|
|
844
844
|
},
|
|
845
|
+
"./lumar/api/server/getAccessToken": {
|
|
846
|
+
"import": "./dist/lumar/api/server/getAccessToken.mjs",
|
|
847
|
+
"require": "./dist/lumar/api/server/getAccessToken.cjs"
|
|
848
|
+
},
|
|
845
849
|
"./lumar/api/server/getData": {
|
|
846
850
|
"import": "./dist/lumar/api/server/getData.mjs",
|
|
847
851
|
"require": "./dist/lumar/api/server/getData.cjs"
|
|
848
852
|
},
|
|
849
|
-
"./lumar/api/server/initClient": {
|
|
850
|
-
"import": "./dist/lumar/api/server/initClient.mjs",
|
|
851
|
-
"require": "./dist/lumar/api/server/initClient.cjs"
|
|
852
|
-
},
|
|
853
853
|
"./lumar/api/server/lumarApi": {
|
|
854
854
|
"import": "./dist/lumar/api/server/lumarApi.mjs",
|
|
855
855
|
"require": "./dist/lumar/api/server/lumarApi.cjs"
|
|
@@ -862,14 +862,14 @@
|
|
|
862
862
|
"import": "./dist/lumar/graphql/server/columns.mjs",
|
|
863
863
|
"require": "./dist/lumar/graphql/server/columns.cjs"
|
|
864
864
|
},
|
|
865
|
+
"./lumar/graphql/server/getAccessToken": {
|
|
866
|
+
"import": "./dist/lumar/graphql/server/getAccessToken.mjs",
|
|
867
|
+
"require": "./dist/lumar/graphql/server/getAccessToken.cjs"
|
|
868
|
+
},
|
|
865
869
|
"./lumar/graphql/server/getData": {
|
|
866
870
|
"import": "./dist/lumar/graphql/server/getData.mjs",
|
|
867
871
|
"require": "./dist/lumar/graphql/server/getData.cjs"
|
|
868
872
|
},
|
|
869
|
-
"./lumar/graphql/server/initClient": {
|
|
870
|
-
"import": "./dist/lumar/graphql/server/initClient.mjs",
|
|
871
|
-
"require": "./dist/lumar/graphql/server/initClient.cjs"
|
|
872
|
-
},
|
|
873
873
|
"./lumar/graphql/server/lumarGraphql": {
|
|
874
874
|
"import": "./dist/lumar/graphql/server/lumarGraphql.mjs",
|
|
875
875
|
"require": "./dist/lumar/graphql/server/lumarGraphql.cjs"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/lumar/api/server/initClient.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* http://api-docs.deepcrawl.com/
|
|
4
|
-
* Renew the Lumar user token.
|
|
5
|
-
* Token lasts for 6 hours.
|
|
6
|
-
*/
|
|
7
|
-
declare const initClient: (apiId: string, apiKey: string) => Promise<any>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { initClient };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/lumar/api/server/initClient.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* http://api-docs.deepcrawl.com/
|
|
4
|
-
* Renew the Lumar user token.
|
|
5
|
-
* Token lasts for 6 hours.
|
|
6
|
-
*/
|
|
7
|
-
declare const initClient: (apiId: string, apiKey: string) => Promise<any>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { initClient };
|