@8ms/helpers 3.0.23 → 3.0.24
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/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/aws/glue/server/AwsGlue.cjs +2 -1
- package/dist/aws/glue/server/AwsGlue.mjs +2 -1
- package/dist/aws/lambda/server/AwsLambda.cjs +10 -8
- package/dist/aws/lambda/server/AwsLambda.mjs +10 -8
- package/dist/aws/s3/server/AwsS3.cjs +3 -2
- package/dist/aws/s3/server/AwsS3.mjs +3 -2
- package/dist/aws/ssm/server/AwsSsm.cjs +5 -4
- package/dist/aws/ssm/server/AwsSsm.mjs +5 -4
- package/dist/brightData/serpApi/server/buildGoogleSerpUrl.cjs +0 -2
- package/dist/brightData/serpApi/server/buildGoogleSerpUrl.mjs +0 -2
- package/dist/brightData/serpApi/server/buildGoogleTrendsUrl.cjs +0 -1
- package/dist/brightData/serpApi/server/buildGoogleTrendsUrl.mjs +0 -1
- package/dist/brightData/serpApi/server/getAsyncResults.cjs +7 -4
- package/dist/brightData/serpApi/server/getAsyncResults.mjs +7 -4
- package/dist/brightData/webScraperIde/server/getRealtime.cjs +10 -6
- package/dist/brightData/webScraperIde/server/getRealtime.mjs +10 -6
- package/dist/date/calculation.cjs +27 -24
- package/dist/date/calculation.mjs +27 -24
- package/dist/emsApi/awsTs/get.cjs +2 -1
- package/dist/emsApi/awsTs/get.mjs +2 -1
- package/dist/emsApi/awsTs/post.cjs +2 -1
- package/dist/emsApi/awsTs/post.mjs +2 -1
- package/dist/emsApi/vercel/get.cjs +2 -1
- package/dist/emsApi/vercel/get.mjs +2 -1
- package/dist/emsApi/vercel/post.cjs +2 -1
- package/dist/emsApi/vercel/post.mjs +2 -1
- package/dist/googleCloud/sheets/server/GoogleCloudSheets.d.cts +1 -1
- package/dist/googleCloud/sheets/server/GoogleCloudSheets.d.mts +1 -1
- package/dist/googlePageSpeed/server/GooglePageSpeed.cjs +2 -1
- package/dist/googlePageSpeed/server/GooglePageSpeed.mjs +2 -1
- package/dist/greenDomain/server/greenDomain.cjs +2 -1
- package/dist/greenDomain/server/greenDomain.mjs +2 -1
- package/dist/littleWarden/server/LittleWarden.cjs +2 -1
- package/dist/littleWarden/server/LittleWarden.mjs +2 -1
- package/dist/lumar/api/server/buildRequest.cjs +0 -1
- package/dist/lumar/api/server/buildRequest.mjs +0 -1
- package/dist/snapchat/server/Snapchat.cjs +3 -2
- package/dist/snapchat/server/Snapchat.mjs +3 -2
- package/dist/util/defaultTo.cjs +6 -3
- package/dist/util/defaultTo.mjs +6 -3
- package/dist/xlsx/cell.cjs +102 -0
- package/dist/xlsx/cell.d.cts +38 -0
- package/dist/xlsx/cell.d.mts +38 -0
- package/dist/xlsx/cell.mjs +97 -0
- package/dist/xlsx/column.cjs +37 -0
- package/dist/xlsx/column.d.cts +23 -0
- package/dist/xlsx/column.d.mts +23 -0
- package/dist/xlsx/column.mjs +35 -0
- package/dist/xlsx/createXlsx.cjs +138 -0
- package/dist/xlsx/createXlsx.d.cts +18 -0
- package/dist/xlsx/createXlsx.d.mts +18 -0
- package/dist/xlsx/createXlsx.mjs +136 -0
- package/dist/xlsx/index.cjs +18 -0
- package/dist/xlsx/index.d.cts +6 -0
- package/dist/xlsx/index.d.mts +6 -0
- package/dist/xlsx/index.mjs +6 -0
- package/dist/xlsx/modifyXlsx.cjs +125 -0
- package/dist/xlsx/modifyXlsx.d.cts +24 -0
- package/dist/xlsx/modifyXlsx.d.mts +24 -0
- package/dist/xlsx/modifyXlsx.mjs +124 -0
- package/dist/xlsx/sheet.cjs +36 -0
- package/dist/xlsx/sheet.d.cts +29 -0
- package/dist/xlsx/sheet.d.mts +29 -0
- package/dist/xlsx/sheet.mjs +34 -0
- package/package.json +97 -51
|
@@ -15,7 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
@@ -23,7 +23,8 @@ var AwsGlue = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
23
23
|
invoke = async (crawler) => {
|
|
24
24
|
const { StartCrawlerCommand } = await import("@aws-sdk/client-glue");
|
|
25
25
|
const command = new StartCrawlerCommand({ Name: crawler });
|
|
26
|
-
|
|
26
|
+
const apiResponse = await this.client.send(command);
|
|
27
|
+
return require_aws_server_isResponse200.isResponse200(apiResponse);
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
30
|
//#endregion
|
|
@@ -22,7 +22,8 @@ var AwsGlue = class extends BaseNamespace {
|
|
|
22
22
|
invoke = async (crawler) => {
|
|
23
23
|
const { StartCrawlerCommand } = await import("@aws-sdk/client-glue");
|
|
24
24
|
const command = new StartCrawlerCommand({ Name: crawler });
|
|
25
|
-
|
|
25
|
+
const apiResponse = await this.client.send(command);
|
|
26
|
+
return isResponse200(apiResponse);
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
//#endregion
|
|
@@ -34,14 +34,16 @@ var AwsLambda = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
34
34
|
if (void 0 !== props.payload) params["Payload"] = new Uint8Array(Buffer.from(JSON.stringify(props.payload)));
|
|
35
35
|
const command = new InvokeCommand(params);
|
|
36
36
|
const apiResponse = await this.client.send(command);
|
|
37
|
-
if (require_aws_server_isResponse200.isResponse200(apiResponse))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (require_aws_server_isResponse200.isResponse200(apiResponse)) {
|
|
38
|
+
if (props.awaitResponse && void 0 !== apiResponse.Payload) {
|
|
39
|
+
response = new TextDecoder("ascii").decode(apiResponse.Payload);
|
|
40
|
+
if (true === props.isJson) {
|
|
41
|
+
response = JSON.parse(response);
|
|
42
|
+
if ("string" === typeof response) response = JSON.parse(response);
|
|
43
|
+
if (void 0 !== response && void 0 !== response?.error && void 0 !== response?.state) response = new require_api_ApiResponseClass.ApiResponseClass().fromJson(response);
|
|
44
|
+
}
|
|
45
|
+
} else response = true;
|
|
46
|
+
}
|
|
45
47
|
return response;
|
|
46
48
|
};
|
|
47
49
|
};
|
|
@@ -33,14 +33,16 @@ var AwsLambda = class extends BaseNamespace {
|
|
|
33
33
|
if (void 0 !== props.payload) params["Payload"] = new Uint8Array(Buffer.from(JSON.stringify(props.payload)));
|
|
34
34
|
const command = new InvokeCommand(params);
|
|
35
35
|
const apiResponse = await this.client.send(command);
|
|
36
|
-
if (isResponse200(apiResponse))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
if (isResponse200(apiResponse)) {
|
|
37
|
+
if (props.awaitResponse && void 0 !== apiResponse.Payload) {
|
|
38
|
+
response = new TextDecoder("ascii").decode(apiResponse.Payload);
|
|
39
|
+
if (true === props.isJson) {
|
|
40
|
+
response = JSON.parse(response);
|
|
41
|
+
if ("string" === typeof response) response = JSON.parse(response);
|
|
42
|
+
if (void 0 !== response && void 0 !== response?.error && void 0 !== response?.state) response = new ApiResponseClass().fromJson(response);
|
|
43
|
+
}
|
|
44
|
+
} else response = true;
|
|
45
|
+
}
|
|
44
46
|
return response;
|
|
45
47
|
};
|
|
46
48
|
};
|
|
@@ -180,10 +180,11 @@ var AwsS3 = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
180
180
|
let response = false;
|
|
181
181
|
try {
|
|
182
182
|
const { HeadObjectCommand } = await import("@aws-sdk/client-s3");
|
|
183
|
-
|
|
183
|
+
const apiResponse = await this.client.send(new HeadObjectCommand({
|
|
184
184
|
Bucket: bucket,
|
|
185
185
|
Key: key
|
|
186
|
-
}))
|
|
186
|
+
}));
|
|
187
|
+
response = require_aws_server_isResponse200.isResponse200(apiResponse);
|
|
187
188
|
} catch (exception) {
|
|
188
189
|
response = false;
|
|
189
190
|
}
|
|
@@ -177,10 +177,11 @@ var AwsS3 = class extends BaseNamespace {
|
|
|
177
177
|
let response = false;
|
|
178
178
|
try {
|
|
179
179
|
const { HeadObjectCommand } = await import("@aws-sdk/client-s3");
|
|
180
|
-
|
|
180
|
+
const apiResponse = await this.client.send(new HeadObjectCommand({
|
|
181
181
|
Bucket: bucket,
|
|
182
182
|
Key: key
|
|
183
|
-
}))
|
|
183
|
+
}));
|
|
184
|
+
response = isResponse200(apiResponse);
|
|
184
185
|
} catch (exception) {
|
|
185
186
|
response = false;
|
|
186
187
|
}
|
|
@@ -24,10 +24,11 @@ var AwsSsm = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
24
24
|
Name: name,
|
|
25
25
|
WithDecryption: "undefined" === typeof withDecryption ? true : withDecryption
|
|
26
26
|
}));
|
|
27
|
-
if (apiResponse?.Parameter?.Value)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (apiResponse?.Parameter?.Value) {
|
|
28
|
+
if ("undefined" === typeof apiResponse?.Parameter?.Value) this.parameters.set(name, null);
|
|
29
|
+
else if ("undefined" === typeof isJson || true === isJson) this.parameters.set(name, JSON.parse(apiResponse.Parameter.Value) || null);
|
|
30
|
+
else this.parameters.set(name, apiResponse.Parameter.Value);
|
|
31
|
+
} else this.parameters.set(name, null);
|
|
31
32
|
}
|
|
32
33
|
return this.parameters.get(name);
|
|
33
34
|
};
|
|
@@ -23,10 +23,11 @@ var AwsSsm = class extends BaseNamespace {
|
|
|
23
23
|
Name: name,
|
|
24
24
|
WithDecryption: "undefined" === typeof withDecryption ? true : withDecryption
|
|
25
25
|
}));
|
|
26
|
-
if (apiResponse?.Parameter?.Value)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (apiResponse?.Parameter?.Value) {
|
|
27
|
+
if ("undefined" === typeof apiResponse?.Parameter?.Value) this.parameters.set(name, null);
|
|
28
|
+
else if ("undefined" === typeof isJson || true === isJson) this.parameters.set(name, JSON.parse(apiResponse.Parameter.Value) || null);
|
|
29
|
+
else this.parameters.set(name, apiResponse.Parameter.Value);
|
|
30
|
+
} else this.parameters.set(name, null);
|
|
30
31
|
}
|
|
31
32
|
return this.parameters.get(name);
|
|
32
33
|
};
|
|
@@ -35,7 +35,6 @@ const buildGoogleSerpUrl = (props) => {
|
|
|
35
35
|
case "iphone":
|
|
36
36
|
params.query["brd_mobile"] = "ios";
|
|
37
37
|
url.searchParams.append("brd_mobile", "ios");
|
|
38
|
-
break;
|
|
39
38
|
}
|
|
40
39
|
if (props?.geoLocation) {
|
|
41
40
|
params.query["uule"] = props.geoLocation;
|
|
@@ -75,7 +74,6 @@ const buildGoogleSerpUrl = (props) => {
|
|
|
75
74
|
case "video":
|
|
76
75
|
params.query["tbm"] = "vid";
|
|
77
76
|
url.searchParams.append("tbm", "vid");
|
|
78
|
-
break;
|
|
79
77
|
}
|
|
80
78
|
if (props?.pagination) {
|
|
81
79
|
if (props.pagination?.offset) {
|
|
@@ -34,7 +34,6 @@ const buildGoogleSerpUrl = (props) => {
|
|
|
34
34
|
case "iphone":
|
|
35
35
|
params.query["brd_mobile"] = "ios";
|
|
36
36
|
url.searchParams.append("brd_mobile", "ios");
|
|
37
|
-
break;
|
|
38
37
|
}
|
|
39
38
|
if (props?.geoLocation) {
|
|
40
39
|
params.query["uule"] = props.geoLocation;
|
|
@@ -74,7 +73,6 @@ const buildGoogleSerpUrl = (props) => {
|
|
|
74
73
|
case "video":
|
|
75
74
|
params.query["tbm"] = "vid";
|
|
76
75
|
url.searchParams.append("tbm", "vid");
|
|
77
|
-
break;
|
|
78
76
|
}
|
|
79
77
|
if (props?.pagination) {
|
|
80
78
|
if (props.pagination?.offset) {
|
|
@@ -11,10 +11,13 @@ const require_brightData_server_brightData = require("../../server/brightData.cj
|
|
|
11
11
|
const getAsyncResults = async (auth, requestId) => {
|
|
12
12
|
let response = new require_api_ApiResponseClass.ApiResponseClass();
|
|
13
13
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const customerId = require_brightData_server_brightData.getCustomerId(auth);
|
|
15
|
+
const zone = require_brightData_server_brightData.getZone(auth);
|
|
16
|
+
const requestResponse = await require_api_get.get(`https://api.brightdata.com/serp/get_result?customer=${customerId}&zone=${zone}&response_id=${requestId}`, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
17
|
+
if (requestResponse.isSuccess()) {
|
|
18
|
+
if ("Request is pending" === requestResponse.getBody()) response.setToPending();
|
|
19
|
+
else response.setToSuccess(requestResponse.getBody());
|
|
20
|
+
} else response.setToError(null, "Error in request");
|
|
18
21
|
return response;
|
|
19
22
|
};
|
|
20
23
|
//#endregion
|
|
@@ -10,10 +10,13 @@ import { getCustomerId, getZone } from "../../server/brightData.mjs";
|
|
|
10
10
|
const getAsyncResults = async (auth, requestId) => {
|
|
11
11
|
let response = new ApiResponseClass();
|
|
12
12
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const customerId = getCustomerId(auth);
|
|
14
|
+
const zone = getZone(auth);
|
|
15
|
+
const requestResponse = await get(`https://api.brightdata.com/serp/get_result?customer=${customerId}&zone=${zone}&response_id=${requestId}`, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
16
|
+
if (requestResponse.isSuccess()) {
|
|
17
|
+
if ("Request is pending" === requestResponse.getBody()) response.setToPending();
|
|
18
|
+
else response.setToSuccess(requestResponse.getBody());
|
|
19
|
+
} else response.setToError(null, "Error in request");
|
|
17
20
|
return response;
|
|
18
21
|
};
|
|
19
22
|
//#endregion
|
|
@@ -11,17 +11,21 @@ const require_api_post = require("../../../api/post.cjs");
|
|
|
11
11
|
*/
|
|
12
12
|
const getRealtime = async (auth, scraperId, data = {}) => {
|
|
13
13
|
let response = {};
|
|
14
|
-
const
|
|
14
|
+
const requestUrl = `https://api.brightdata.com/dca/trigger_immediate?collector=${scraperId}`;
|
|
15
|
+
const requestResponse = await require_api_post.post(requestUrl, data, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
15
16
|
if (requestResponse.isSuccess()) {
|
|
16
17
|
const responseId = requestResponse.getBodyDefaultTo(["response_id"], "");
|
|
17
18
|
if ("" !== responseId) {
|
|
18
19
|
let state = require_api_api.apiState.PENDING;
|
|
19
20
|
while (require_api_api.apiState.PENDING === state) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
state = require_api_api.apiState.
|
|
24
|
-
|
|
21
|
+
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
22
|
+
const resultResponse = await require_api_get.get(resultUrl, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
23
|
+
if (resultResponse.isSuccess()) {
|
|
24
|
+
if (void 0 !== resultResponse.body.pending && true === resultResponse.body.pending) state = require_api_api.apiState.PENDING;
|
|
25
|
+
else {
|
|
26
|
+
state = require_api_api.apiState.SUCCESS;
|
|
27
|
+
response = resultResponse.getBody();
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
await require_util_sleep.sleep(1);
|
|
27
31
|
}
|
|
@@ -10,17 +10,21 @@ import { post } from "../../../api/post.mjs";
|
|
|
10
10
|
*/
|
|
11
11
|
const getRealtime = async (auth, scraperId, data = {}) => {
|
|
12
12
|
let response = {};
|
|
13
|
-
const
|
|
13
|
+
const requestUrl = `https://api.brightdata.com/dca/trigger_immediate?collector=${scraperId}`;
|
|
14
|
+
const requestResponse = await post(requestUrl, data, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
14
15
|
if (requestResponse.isSuccess()) {
|
|
15
16
|
const responseId = requestResponse.getBodyDefaultTo(["response_id"], "");
|
|
16
17
|
if ("" !== responseId) {
|
|
17
18
|
let state = apiState.PENDING;
|
|
18
19
|
while (apiState.PENDING === state) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
state = apiState.
|
|
23
|
-
|
|
20
|
+
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
21
|
+
const resultResponse = await get(resultUrl, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
|
|
22
|
+
if (resultResponse.isSuccess()) {
|
|
23
|
+
if (void 0 !== resultResponse.body.pending && true === resultResponse.body.pending) state = apiState.PENDING;
|
|
24
|
+
else {
|
|
25
|
+
state = apiState.SUCCESS;
|
|
26
|
+
response = resultResponse.getBody();
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
await sleep(1);
|
|
26
30
|
}
|
|
@@ -14,30 +14,33 @@ const getUnix = (input) => {
|
|
|
14
14
|
*/
|
|
15
15
|
const getLuxonDate = (input, setMidnight) => {
|
|
16
16
|
let instance = luxon.DateTime.now().toUTC();
|
|
17
|
-
if (input)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
instance = luxon.DateTime.fromFormat(inputString, "yyyy
|
|
40
|
-
|
|
17
|
+
if (input) {
|
|
18
|
+
if (input instanceof Date) instance = luxon.DateTime.fromJSDate(input, { zone: "utc" });
|
|
19
|
+
else if (input instanceof luxon.DateTime) instance = input.toUTC();
|
|
20
|
+
else if ("number" === typeof input) {
|
|
21
|
+
if (input >= 19000101 && input <= 99991231) {
|
|
22
|
+
const dateStr = input.toString();
|
|
23
|
+
const year = parseInt(dateStr.substring(0, 4));
|
|
24
|
+
const month = parseInt(dateStr.substring(4, 6));
|
|
25
|
+
const day = parseInt(dateStr.substring(6, 8));
|
|
26
|
+
instance = luxon.DateTime.fromObject({
|
|
27
|
+
year,
|
|
28
|
+
month,
|
|
29
|
+
day
|
|
30
|
+
}, { zone: "utc" });
|
|
31
|
+
} else if (input < 1e10) instance = luxon.DateTime.fromSeconds(input, { zone: "utc" });
|
|
32
|
+
else instance = luxon.DateTime.fromMillis(input, { zone: "utc" });
|
|
33
|
+
} else {
|
|
34
|
+
const inputString = input.toString().toLowerCase();
|
|
35
|
+
instance = luxon.DateTime.fromISO(inputString, { zone: "utc" });
|
|
36
|
+
if (!instance.isValid) {
|
|
37
|
+
const len = inputString.length;
|
|
38
|
+
if (23 === len) instance = luxon.DateTime.fromFormat(inputString, "yyyy-MM-dd HH:mm:ss.SSS", { zone: "utc" });
|
|
39
|
+
else if (19 === len) instance = luxon.DateTime.fromFormat(inputString, "yyyy-MM-dd HH:mm:ss", { zone: "utc" });
|
|
40
|
+
else {
|
|
41
|
+
instance = luxon.DateTime.fromFormat(inputString, "yyyy MMMM dd", { zone: "utc" });
|
|
42
|
+
if (!instance.isValid) instance = luxon.DateTime.fromFormat(inputString, "yyyy-MMMM-dd", { zone: "utc" });
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -13,30 +13,33 @@ const getUnix = (input) => {
|
|
|
13
13
|
*/
|
|
14
14
|
const getLuxonDate = (input, setMidnight) => {
|
|
15
15
|
let instance = DateTime.now().toUTC();
|
|
16
|
-
if (input)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
instance = DateTime.fromFormat(inputString, "yyyy
|
|
39
|
-
|
|
16
|
+
if (input) {
|
|
17
|
+
if (input instanceof Date) instance = DateTime.fromJSDate(input, { zone: "utc" });
|
|
18
|
+
else if (input instanceof DateTime) instance = input.toUTC();
|
|
19
|
+
else if ("number" === typeof input) {
|
|
20
|
+
if (input >= 19000101 && input <= 99991231) {
|
|
21
|
+
const dateStr = input.toString();
|
|
22
|
+
const year = parseInt(dateStr.substring(0, 4));
|
|
23
|
+
const month = parseInt(dateStr.substring(4, 6));
|
|
24
|
+
const day = parseInt(dateStr.substring(6, 8));
|
|
25
|
+
instance = DateTime.fromObject({
|
|
26
|
+
year,
|
|
27
|
+
month,
|
|
28
|
+
day
|
|
29
|
+
}, { zone: "utc" });
|
|
30
|
+
} else if (input < 1e10) instance = DateTime.fromSeconds(input, { zone: "utc" });
|
|
31
|
+
else instance = DateTime.fromMillis(input, { zone: "utc" });
|
|
32
|
+
} else {
|
|
33
|
+
const inputString = input.toString().toLowerCase();
|
|
34
|
+
instance = DateTime.fromISO(inputString, { zone: "utc" });
|
|
35
|
+
if (!instance.isValid) {
|
|
36
|
+
const len = inputString.length;
|
|
37
|
+
if (23 === len) instance = DateTime.fromFormat(inputString, "yyyy-MM-dd HH:mm:ss.SSS", { zone: "utc" });
|
|
38
|
+
else if (19 === len) instance = DateTime.fromFormat(inputString, "yyyy-MM-dd HH:mm:ss", { zone: "utc" });
|
|
39
|
+
else {
|
|
40
|
+
instance = DateTime.fromFormat(inputString, "yyyy MMMM dd", { zone: "utc" });
|
|
41
|
+
if (!instance.isValid) instance = DateTime.fromFormat(inputString, "yyyy-MMMM-dd", { zone: "utc" });
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -3,7 +3,8 @@ const require_api_get = require("../../api/get.cjs");
|
|
|
3
3
|
const require_emsApi_awsTs_endpoint = require("./endpoint.cjs");
|
|
4
4
|
//#region src/emsApi/awsTs/get.ts
|
|
5
5
|
const getAwsTs = async (path, config = {}) => {
|
|
6
|
-
|
|
6
|
+
const endpoint = require_emsApi_awsTs_endpoint.getAwsTsEndpoint();
|
|
7
|
+
return require_api_get.get(`${endpoint}${path}`, {
|
|
7
8
|
...config,
|
|
8
9
|
headers: {
|
|
9
10
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -2,7 +2,8 @@ import { get } from "../../api/get.mjs";
|
|
|
2
2
|
import { getAwsTsEndpoint } from "./endpoint.mjs";
|
|
3
3
|
//#region src/emsApi/awsTs/get.ts
|
|
4
4
|
const getAwsTs = async (path, config = {}) => {
|
|
5
|
-
|
|
5
|
+
const endpoint = getAwsTsEndpoint();
|
|
6
|
+
return get(`${endpoint}${path}`, {
|
|
6
7
|
...config,
|
|
7
8
|
headers: {
|
|
8
9
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -3,7 +3,8 @@ const require_api_post = require("../../api/post.cjs");
|
|
|
3
3
|
const require_emsApi_awsTs_endpoint = require("./endpoint.cjs");
|
|
4
4
|
//#region src/emsApi/awsTs/post.ts
|
|
5
5
|
const postAwsTs = async (path, data = {}, config = {}) => {
|
|
6
|
-
|
|
6
|
+
const endpoint = require_emsApi_awsTs_endpoint.getAwsTsEndpoint();
|
|
7
|
+
return require_api_post.post(`${endpoint}${path}`, data, {
|
|
7
8
|
...config,
|
|
8
9
|
headers: {
|
|
9
10
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -2,7 +2,8 @@ import { post } from "../../api/post.mjs";
|
|
|
2
2
|
import { getAwsTsEndpoint } from "./endpoint.mjs";
|
|
3
3
|
//#region src/emsApi/awsTs/post.ts
|
|
4
4
|
const postAwsTs = async (path, data = {}, config = {}) => {
|
|
5
|
-
|
|
5
|
+
const endpoint = getAwsTsEndpoint();
|
|
6
|
+
return post(`${endpoint}${path}`, data, {
|
|
6
7
|
...config,
|
|
7
8
|
headers: {
|
|
8
9
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -3,7 +3,8 @@ const require_api_get = require("../../api/get.cjs");
|
|
|
3
3
|
const require_emsApi_vercel_endpoint = require("./endpoint.cjs");
|
|
4
4
|
//#region src/emsApi/vercel/get.ts
|
|
5
5
|
const getVercel = async (path, config = {}) => {
|
|
6
|
-
|
|
6
|
+
const endpoint = require_emsApi_vercel_endpoint.getVercelEndpoint();
|
|
7
|
+
return require_api_get.get(`${endpoint}${path}`, {
|
|
7
8
|
...config,
|
|
8
9
|
headers: {
|
|
9
10
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -2,7 +2,8 @@ import { get } from "../../api/get.mjs";
|
|
|
2
2
|
import { getVercelEndpoint } from "./endpoint.mjs";
|
|
3
3
|
//#region src/emsApi/vercel/get.ts
|
|
4
4
|
const getVercel = async (path, config = {}) => {
|
|
5
|
-
|
|
5
|
+
const endpoint = getVercelEndpoint();
|
|
6
|
+
return get(`${endpoint}${path}`, {
|
|
6
7
|
...config,
|
|
7
8
|
headers: {
|
|
8
9
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -3,7 +3,8 @@ const require_api_post = require("../../api/post.cjs");
|
|
|
3
3
|
const require_emsApi_vercel_endpoint = require("./endpoint.cjs");
|
|
4
4
|
//#region src/emsApi/vercel/post.ts
|
|
5
5
|
const postVercel = async (path, data = {}, config = {}) => {
|
|
6
|
-
|
|
6
|
+
const endpoint = require_emsApi_vercel_endpoint.getVercelEndpoint();
|
|
7
|
+
return require_api_post.post(`${endpoint}${path}`, data, {
|
|
7
8
|
...config,
|
|
8
9
|
headers: {
|
|
9
10
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -2,7 +2,8 @@ import { post } from "../../api/post.mjs";
|
|
|
2
2
|
import { getVercelEndpoint } from "./endpoint.mjs";
|
|
3
3
|
//#region src/emsApi/vercel/post.ts
|
|
4
4
|
const postVercel = async (path, data = {}, config = {}) => {
|
|
5
|
-
|
|
5
|
+
const endpoint = getVercelEndpoint();
|
|
6
|
+
return post(`${endpoint}${path}`, data, {
|
|
6
7
|
...config,
|
|
7
8
|
headers: {
|
|
8
9
|
"x-api-key": process.env?.SERVER_EMS_API_KEY ?? process.env?.NEXT_PUBLIC_CLIENT_EMS_API_KEY ?? "",
|
|
@@ -14,7 +14,7 @@ declare class GoogleCloudSheets extends BaseNamespace {
|
|
|
14
14
|
* Either a Google Cloud JSON Config or V10 Auth helper.
|
|
15
15
|
*/
|
|
16
16
|
init: (isOidc: boolean, config: any, projectId: string, region?: string) => Promise<this>;
|
|
17
|
-
getBatchData: (props: GetBatchDataProps) => Promise<
|
|
17
|
+
getBatchData: (props: GetBatchDataProps) => Promise<any>;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
export { GoogleCloudSheets };
|
|
@@ -14,7 +14,7 @@ declare class GoogleCloudSheets extends BaseNamespace {
|
|
|
14
14
|
* Either a Google Cloud JSON Config or V10 Auth helper.
|
|
15
15
|
*/
|
|
16
16
|
init: (isOidc: boolean, config: any, projectId: string, region?: string) => Promise<this>;
|
|
17
|
-
getBatchData: (props: GetBatchDataProps) => Promise<
|
|
17
|
+
getBatchData: (props: GetBatchDataProps) => Promise<any>;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
export { GoogleCloudSheets };
|
|
@@ -18,7 +18,8 @@ var GooglePageSpeed = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
18
18
|
return this;
|
|
19
19
|
};
|
|
20
20
|
getReport = async (url, inputCategory = require_googlePageSpeed_server_category.category.PERFORMANCE, inputStrategy = require_googlePageSpeed_server_strategy.strategy.MOBILE) => {
|
|
21
|
-
const
|
|
21
|
+
const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${inputStrategy}&category=${inputCategory}&key=${this.config.apiKey}`;
|
|
22
|
+
const apiResponse = await require_api_get.get(requestUrl);
|
|
22
23
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
23
24
|
return null;
|
|
24
25
|
};
|
|
@@ -17,7 +17,8 @@ var GooglePageSpeed = class extends BaseNamespace {
|
|
|
17
17
|
return this;
|
|
18
18
|
};
|
|
19
19
|
getReport = async (url, inputCategory = category.PERFORMANCE, inputStrategy = strategy.MOBILE) => {
|
|
20
|
-
const
|
|
20
|
+
const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${inputStrategy}&category=${inputCategory}&key=${this.config.apiKey}`;
|
|
21
|
+
const apiResponse = await get(requestUrl);
|
|
21
22
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
22
23
|
return null;
|
|
23
24
|
};
|
|
@@ -6,7 +6,8 @@ let zod_v4 = require("zod/v4");
|
|
|
6
6
|
* https://developers.thegreenwebfoundation.org/api/greencheck/v3/check-single-domain/
|
|
7
7
|
*/
|
|
8
8
|
const getSingleReport = async (domain) => {
|
|
9
|
-
const
|
|
9
|
+
const url = `https://api.thegreenwebfoundation.org/greencheck/${domain}`;
|
|
10
|
+
const apiResponse = await require_api_get.get(url);
|
|
10
11
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
11
12
|
return null;
|
|
12
13
|
};
|
|
@@ -5,7 +5,8 @@ import { z } from "zod/v4";
|
|
|
5
5
|
* https://developers.thegreenwebfoundation.org/api/greencheck/v3/check-single-domain/
|
|
6
6
|
*/
|
|
7
7
|
const getSingleReport = async (domain) => {
|
|
8
|
-
const
|
|
8
|
+
const url = `https://api.thegreenwebfoundation.org/greencheck/${domain}`;
|
|
9
|
+
const apiResponse = await get(url);
|
|
9
10
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
10
11
|
return null;
|
|
11
12
|
};
|
|
@@ -16,7 +16,8 @@ var LittleWarden = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
16
16
|
return this;
|
|
17
17
|
};
|
|
18
18
|
getReport = async (urlId) => {
|
|
19
|
-
const
|
|
19
|
+
const url = `https://littlewarden.com/api/sites/${urlId}`;
|
|
20
|
+
const apiResponse = await require_api_get.get(url, { headers: { "Authorization": `Token token="${this.config.apiKey}"` } });
|
|
20
21
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
21
22
|
return null;
|
|
22
23
|
};
|
|
@@ -15,7 +15,8 @@ var LittleWarden = class extends BaseNamespace {
|
|
|
15
15
|
return this;
|
|
16
16
|
};
|
|
17
17
|
getReport = async (urlId) => {
|
|
18
|
-
const
|
|
18
|
+
const url = `https://littlewarden.com/api/sites/${urlId}`;
|
|
19
|
+
const apiResponse = await get(url, { headers: { "Authorization": `Token token="${this.config.apiKey}"` } });
|
|
19
20
|
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
20
21
|
return null;
|
|
21
22
|
};
|
|
@@ -33,7 +33,6 @@ const buildRequest = (props) => {
|
|
|
33
33
|
url += `/projects/${props.projectId}/crawls/${props.crawlId}/reports/${props.subReport}`;
|
|
34
34
|
if (require_lumar_api_server_lumarApi.report.REPORT_ROWS === props.report) url += `/report_rows`;
|
|
35
35
|
else if (require_lumar_api_server_lumarApi.report.REPORT_STATISTICS === props.report) url += `/statistics`;
|
|
36
|
-
break;
|
|
37
36
|
}
|
|
38
37
|
url += -1 === url.indexOf("?") ? "?" : "&";
|
|
39
38
|
url += `per_page=${props.limit}`;
|