@8ms/helpers 2.3.26 → 2.3.27
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/_class/index.d.mts +2 -0
- package/dist/_class/index.mjs +61 -0
- package/dist/adverity/index.d.mts +2 -0
- package/dist/adverity/index.mjs +64 -0
- package/dist/adverity/server/index.d.mts +18 -0
- package/dist/adverity/server/index.mjs +25 -0
- package/dist/api/index.d.mts +2 -0
- package/dist/api/index.mjs +3 -0
- package/dist/api-DGKJDAfb.mjs +139 -0
- package/dist/array/index.d.mts +11 -0
- package/dist/array/index.mjs +12 -0
- package/dist/atInternet/index.d.mts +20 -0
- package/dist/atInternet/index.mjs +18 -0
- package/dist/aws/ec2/server/index.d.mts +18 -0
- package/dist/aws/ec2/server/index.mjs +48 -0
- package/dist/aws/ecs/server/index.d.mts +59 -0
- package/dist/aws/ecs/server/index.mjs +113 -0
- package/dist/aws/glue/server/index.d.mts +19 -0
- package/dist/aws/glue/server/index.mjs +36 -0
- package/dist/aws/lambda/server/index.d.mts +28 -0
- package/dist/aws/lambda/server/index.mjs +57 -0
- package/dist/aws/s3/server/index.d.mts +124 -0
- package/dist/aws/s3/server/index.mjs +360 -0
- package/dist/aws/server/index.d.mts +2 -0
- package/dist/aws/server/index.mjs +3 -0
- package/dist/aws/ses/server/index.d.mts +105 -0
- package/dist/aws/ses/server/index.mjs +268 -0
- package/dist/aws/sqs/server/index.d.mts +41 -0
- package/dist/aws/sqs/server/index.mjs +56 -0
- package/dist/aws/ssm/server/index.d.mts +18 -0
- package/dist/aws/ssm/server/index.mjs +47 -0
- package/dist/axios/index.d.mts +22 -0
- package/dist/axios/index.mjs +50 -0
- package/dist/boolean/index.d.mts +7 -0
- package/dist/boolean/index.mjs +13 -0
- package/dist/brightData/serpApi/server/index.d.mts +93 -0
- package/dist/brightData/serpApi/server/index.mjs +229 -0
- package/dist/brightData/server/index.d.mts +2 -0
- package/dist/brightData/server/index.mjs +18 -0
- package/dist/brightData/webScraperIde/server/index.d.mts +19 -0
- package/dist/brightData/webScraperIde/server/index.mjs +50 -0
- package/dist/cache/server/index.d.mts +10 -0
- package/dist/cache/server/index.mjs +31 -0
- package/dist/chunk-DDarj8oW.mjs +7 -0
- package/dist/crud/index.d.mts +10 -0
- package/dist/crud/index.mjs +10 -0
- package/dist/crypto/index.d.mts +25 -0
- package/dist/crypto/index.mjs +57 -0
- package/dist/date/index.d.mts +2 -0
- package/dist/date/index.mjs +471 -0
- package/dist/drizzle/server/index.d.mts +22 -0
- package/dist/drizzle/server/index.mjs +69 -0
- package/dist/environment/index.d.mts +37 -0
- package/dist/environment/index.mjs +60 -0
- package/dist/eskimi/index.d.mts +52 -0
- package/dist/eskimi/index.mjs +90 -0
- package/dist/eskimi/server/index.d.mts +25 -0
- package/dist/eskimi/server/index.mjs +50 -0
- package/dist/file/index.d.mts +7 -0
- package/dist/file/index.mjs +20 -0
- package/dist/file/server/index.d.mts +8 -0
- package/dist/file/server/index.mjs +16 -0
- package/dist/geo/index.d.mts +26 -0
- package/dist/geo/index.mjs +1591 -0
- package/dist/getDecimal-CafxtLhH.mjs +40 -0
- package/dist/googleAds/keywordPlanner/server/index.d.mts +45 -0
- package/dist/googleAds/keywordPlanner/server/index.mjs +51 -0
- package/dist/googleAds/server/index.d.mts +27 -0
- package/dist/googleAds/server/index.mjs +48 -0
- package/dist/googleCloud/bigquery/server/index.d.mts +82 -0
- package/dist/googleCloud/bigquery/server/index.mjs +133 -0
- package/dist/googleCloud/server/index.d.mts +2 -0
- package/dist/googleCloud/server/index.mjs +24 -0
- package/dist/googleCloud/sheets/server/index.d.mts +22 -0
- package/dist/googleCloud/sheets/server/index.mjs +31 -0
- package/dist/googleCloud/storage/server/index.d.mts +31 -0
- package/dist/googleCloud/storage/server/index.mjs +79 -0
- package/dist/googlePageSpeed/server/index.d.mts +34 -0
- package/dist/googlePageSpeed/server/index.mjs +53 -0
- package/dist/googleSearchIncidents/server/index.d.mts +73 -0
- package/dist/googleSearchIncidents/server/index.mjs +55 -0
- package/dist/greenDomain/server/index.d.mts +25 -0
- package/dist/greenDomain/server/index.mjs +31 -0
- package/dist/index-1fBbJGQz.d.mts +246 -0
- package/dist/index-BHuvb_7y.d.mts +116 -0
- package/dist/index-BfyGIdDD.d.mts +18 -0
- package/dist/index-CqTOMR8f.d.mts +17 -0
- package/dist/index-DW9yJLtI.d.mts +67 -0
- package/dist/index-DmCSxHCc.d.mts +32 -0
- package/dist/index-DwB8X1lz.d.mts +32 -0
- package/dist/inngest/index.d.mts +10 -0
- package/dist/inngest/index.mjs +10 -0
- package/dist/json/index.d.mts +7 -0
- package/dist/json/index.mjs +27 -0
- package/dist/littleWarden/server/index.d.mts +56 -0
- package/dist/littleWarden/server/index.mjs +79 -0
- package/dist/lodash/index.d.mts +45 -0
- package/dist/lodash/index.mjs +176 -0
- package/dist/lumar/api/server/index.d.mts +66 -0
- package/dist/lumar/api/server/index.mjs +111 -0
- package/dist/lumar/graphql/server/index.d.mts +308 -0
- package/dist/lumar/graphql/server/index.mjs +172 -0
- package/dist/myTarget/server/index.d.mts +9 -0
- package/dist/myTarget/server/index.mjs +16 -0
- package/dist/nextAuth/index.d.mts +12 -0
- package/dist/nextAuth/index.mjs +15 -0
- package/dist/nextJs/client/index.d.mts +10 -0
- package/dist/nextJs/client/index.mjs +12 -0
- package/dist/nextJs/index.d.mts +19 -0
- package/dist/nextJs/index.mjs +12 -0
- package/dist/number/index.d.mts +54 -0
- package/dist/number/index.mjs +75 -0
- package/dist/object/index.d.mts +8 -0
- package/dist/object/index.mjs +22 -0
- package/dist/onePassword/server/index.d.mts +24 -0
- package/dist/onePassword/server/index.mjs +50 -0
- package/dist/openAi/server/index.d.mts +20 -0
- package/dist/openAi/server/index.mjs +46 -0
- package/dist/prisma/index.d.mts +7 -0
- package/dist/prisma/index.mjs +15 -0
- package/dist/prisma/server/index.d.mts +31 -0
- package/dist/prisma/server/index.mjs +64 -0
- package/dist/server-Bwy4JI8Z.mjs +33 -0
- package/dist/snapchat/server/index.d.mts +25 -0
- package/dist/snapchat/server/index.mjs +39 -0
- package/dist/sorting/index.d.mts +25 -0
- package/dist/sorting/index.mjs +50 -0
- package/dist/stream/server/index.d.mts +15 -0
- package/dist/stream/server/index.mjs +48 -0
- package/dist/string/index.d.mts +107 -0
- package/dist/string/index.mjs +187 -0
- package/dist/swr/client/index.d.mts +46 -0
- package/dist/swr/client/index.mjs +40 -0
- package/dist/upTimeRobot/server/index.d.mts +72 -0
- package/dist/upTimeRobot/server/index.mjs +82 -0
- package/dist/url/index.d.mts +29 -0
- package/dist/url/index.mjs +52 -0
- package/dist/url/server/index.d.mts +9 -0
- package/dist/url/server/index.mjs +35 -0
- package/dist/util/index.d.mts +50 -0
- package/dist/util/index.mjs +107 -0
- package/dist/util/server/index.d.mts +27 -0
- package/dist/util/server/index.mjs +61 -0
- package/dist/webWorker/index.d.mts +11 -0
- package/dist/webWorker/index.mjs +11 -0
- package/dist/xml/server/index.d.mts +4 -0
- package/dist/xml/server/index.mjs +17 -0
- package/package.json +189 -118
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
|
|
3
|
+
//#region src/api/ApiResponseClass.d.ts
|
|
4
|
+
type ConstructorProps = {
|
|
5
|
+
body?: any;
|
|
6
|
+
error?: any;
|
|
7
|
+
state?: ApiState;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Class version of the API to enable quicker instances.
|
|
11
|
+
*/
|
|
12
|
+
declare class ApiResponseClass<T = any, E = any> {
|
|
13
|
+
state: ApiState;
|
|
14
|
+
body: T | null;
|
|
15
|
+
error: E | null;
|
|
16
|
+
constructor({
|
|
17
|
+
body,
|
|
18
|
+
error,
|
|
19
|
+
state
|
|
20
|
+
}?: ConstructorProps);
|
|
21
|
+
fromJson: (input: ApiResponse) => this;
|
|
22
|
+
getBody: () => any;
|
|
23
|
+
getBodyDefaultTo: (keys: any | any[], defaultValue: any) => any;
|
|
24
|
+
getError: () => any;
|
|
25
|
+
getJson: () => ApiResponse<T, E>;
|
|
26
|
+
getApiState: () => ApiState;
|
|
27
|
+
isError: () => boolean;
|
|
28
|
+
isIdle: () => boolean;
|
|
29
|
+
isPending: () => boolean;
|
|
30
|
+
isSuccess: () => boolean;
|
|
31
|
+
setToIdle: () => this;
|
|
32
|
+
setToPending: () => this;
|
|
33
|
+
setToError: (error: any, body?: any) => this;
|
|
34
|
+
setToSuccess: (body: any) => this;
|
|
35
|
+
setBody: (body: any) => this;
|
|
36
|
+
setError: (error: any) => this;
|
|
37
|
+
setApiState: (state: ApiState) => this;
|
|
38
|
+
validateZod: <T_1>(schema: z.ZodSchema<T_1>) => ApiResponseClass<T_1, E>;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/api/api.d.ts
|
|
42
|
+
declare const apiState: {
|
|
43
|
+
readonly CANCELLED: "CANCELLED";
|
|
44
|
+
readonly ERROR: "ERROR";
|
|
45
|
+
readonly IDLE: "IDLE";
|
|
46
|
+
readonly PENDING: "PENDING";
|
|
47
|
+
readonly SUCCESS: "SUCCESS";
|
|
48
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
49
|
+
};
|
|
50
|
+
type ApiState = typeof apiState[keyof typeof apiState];
|
|
51
|
+
type ApiResponse<T = any, E = any> = {
|
|
52
|
+
body: T | null;
|
|
53
|
+
error: E | null;
|
|
54
|
+
state: ApiState;
|
|
55
|
+
};
|
|
56
|
+
declare const defaultResponse: ApiResponse;
|
|
57
|
+
declare const unexpectedError: string;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/api/functions.d.ts
|
|
60
|
+
declare const isCancelled: (apiResponse: ApiResponse) => boolean;
|
|
61
|
+
declare const isError: (apiResponse: ApiResponse) => boolean;
|
|
62
|
+
declare const isIdle: (apiResponse: ApiResponse) => boolean;
|
|
63
|
+
declare const isPending: (apiResponse: ApiResponse) => boolean;
|
|
64
|
+
declare const isSuccess: (apiResponse: ApiResponse) => boolean;
|
|
65
|
+
declare const isValidationError: (apiResponse: ApiResponse) => boolean;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { isSuccess as a, ApiState as c, unexpectedError as d, ApiResponseClass as f, isPending as i, apiState as l, isError as n, isValidationError as o, isIdle as r, ApiResponse as s, isCancelled as t, defaultResponse as u };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/googleCloud/server/googleCloud.d.ts
|
|
2
|
+
type GoogleCloudConfig = {
|
|
3
|
+
type: string;
|
|
4
|
+
project_id: string;
|
|
5
|
+
private_key_id: string;
|
|
6
|
+
private_key: string;
|
|
7
|
+
client_email: string;
|
|
8
|
+
client_id: string;
|
|
9
|
+
auth_uri: string;
|
|
10
|
+
token_uri: string;
|
|
11
|
+
auth_provider_x509_cert_url: string;
|
|
12
|
+
client_x509_cert_url: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Using the response from Parameter Store and format it ready to be used with Google API.
|
|
16
|
+
*/
|
|
17
|
+
declare const getConfig: (parameter: GoogleCloudConfig, projectId?: string) => {
|
|
18
|
+
credentials: {
|
|
19
|
+
type: string;
|
|
20
|
+
project_id: string;
|
|
21
|
+
private_key_id: string;
|
|
22
|
+
private_key: string;
|
|
23
|
+
client_email: string;
|
|
24
|
+
client_id: string;
|
|
25
|
+
auth_uri: string;
|
|
26
|
+
token_uri: string;
|
|
27
|
+
auth_provider_x509_cert_url: string;
|
|
28
|
+
client_x509_cert_url: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { getConfig as n, GoogleCloudConfig as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/_class/BaseClass.d.ts
|
|
2
|
+
declare class BaseClass {
|
|
3
|
+
/**
|
|
4
|
+
* Shortcut to set a value to an array and return the instance.
|
|
5
|
+
*/
|
|
6
|
+
protected _setArray: (fields: any | any[], input: any | any[]) => this;
|
|
7
|
+
/**
|
|
8
|
+
* Shortcut to set a value and return the instance.
|
|
9
|
+
*/
|
|
10
|
+
protected _setValue: (fields: any | any[], input: any) => this;
|
|
11
|
+
/**
|
|
12
|
+
* Shortcut to add a value to an existing array.
|
|
13
|
+
*/
|
|
14
|
+
protected _push: (fields: any | any[], input: any | any[]) => this;
|
|
15
|
+
/**
|
|
16
|
+
* Shortcut to get a value, but default if the fields don't exist.
|
|
17
|
+
*/
|
|
18
|
+
protected _get: (fields: any | any[], defaultValue?: any) => any;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/_class/BaseNamespace.d.ts
|
|
22
|
+
declare class BaseNamespace {
|
|
23
|
+
client: any;
|
|
24
|
+
key: string;
|
|
25
|
+
config: any;
|
|
26
|
+
constructor(key: string, config: any);
|
|
27
|
+
ensureInit: () => Promise<void>;
|
|
28
|
+
reset: () => void;
|
|
29
|
+
getClient: () => Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BaseClass as n, BaseNamespace as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/inngest/inngest.d.ts
|
|
2
|
+
declare const inngestState: {
|
|
3
|
+
RUNNING: string;
|
|
4
|
+
COMPLETED: string;
|
|
5
|
+
FAILED: string;
|
|
6
|
+
CANCELLED: string;
|
|
7
|
+
};
|
|
8
|
+
type InngestState = typeof inngestState[keyof typeof inngestState];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { InngestState, inngestState };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getArray } from "../array/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/json/getJsonNewline.ts
|
|
4
|
+
const getJsonNewline = (data) => {
|
|
5
|
+
return getArray(data).map((row) => JSON.stringify(row)).join("\n");
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/json/isJson.ts
|
|
10
|
+
const isJson = (input) => {
|
|
11
|
+
if (typeof input !== "string") try {
|
|
12
|
+
const stringified = JSON.stringify(input);
|
|
13
|
+
JSON.parse(stringified);
|
|
14
|
+
return true;
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
JSON.parse(input);
|
|
20
|
+
return true;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { getJsonNewline, isJson };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { t as BaseNamespace } from "../../index-DwB8X1lz.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/littleWarden/server/LittleWardenNamespace.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
6
|
+
*/
|
|
7
|
+
declare class LittleWardenNamespace extends BaseNamespace {
|
|
8
|
+
client: boolean;
|
|
9
|
+
config: LittleWardenConfig;
|
|
10
|
+
ensureInit: () => Promise<void>;
|
|
11
|
+
getReport: (urlId: string) => Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/littleWarden/server/getUrlStatus.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Get the URL Status for a given URL ID from Little Warden.
|
|
17
|
+
*/
|
|
18
|
+
declare const getUrlStatus: (apiKey: string, urlId: string) => Promise<any>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/littleWarden/server/littleWarden.d.ts
|
|
21
|
+
type LittleWardenConfig = {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
};
|
|
24
|
+
declare const littleWardenClient: (key?: string, config?: LittleWardenConfig, vaultId?: string, itemId?: string) => Promise<LittleWardenNamespace>;
|
|
25
|
+
declare const littleWardenState: {
|
|
26
|
+
readonly ALL_GOOD: "all_good";
|
|
27
|
+
readonly DANGER: "danger";
|
|
28
|
+
readonly WARNING: "warning";
|
|
29
|
+
};
|
|
30
|
+
type LittleWardenState = typeof littleWardenState[keyof typeof littleWardenState];
|
|
31
|
+
/**
|
|
32
|
+
* Check if the field is All Good.
|
|
33
|
+
*/
|
|
34
|
+
declare const isAllGood: ({
|
|
35
|
+
field
|
|
36
|
+
}: {
|
|
37
|
+
field: any;
|
|
38
|
+
}) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Check if the field is Warning.
|
|
41
|
+
*/
|
|
42
|
+
declare const isWarning: ({
|
|
43
|
+
field
|
|
44
|
+
}: {
|
|
45
|
+
field: any;
|
|
46
|
+
}) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the field is Danger.
|
|
49
|
+
*/
|
|
50
|
+
declare const isDanger: ({
|
|
51
|
+
field
|
|
52
|
+
}: {
|
|
53
|
+
field: any;
|
|
54
|
+
}) => boolean;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { LittleWardenConfig, LittleWardenNamespace, LittleWardenState, getUrlStatus, isAllGood, isDanger, isWarning, littleWardenClient, littleWardenState };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
|
+
import "../../api-DGKJDAfb.mjs";
|
|
3
|
+
import { get } from "../../axios/index.mjs";
|
|
4
|
+
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/littleWarden/server/LittleWardenNamespace.ts
|
|
7
|
+
/**
|
|
8
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
9
|
+
*/
|
|
10
|
+
var LittleWardenNamespace = class extends BaseNamespace {
|
|
11
|
+
ensureInit = async () => {
|
|
12
|
+
if (!this.client) try {
|
|
13
|
+
this.client = true;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw new Error("Google PageSpeed Client not installed");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
getReport = async (urlId) => {
|
|
19
|
+
const apiResponse = await get(`https://littlewarden.com/api/sites/${urlId}`, { headers: { "Authorization": `Token token="${this.config.apiKey}"` } });
|
|
20
|
+
if (apiResponse.isSuccess()) return apiResponse.getBody();
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/littleWarden/server/getUrlStatus.ts
|
|
27
|
+
/**
|
|
28
|
+
* Get the URL Status for a given URL ID from Little Warden.
|
|
29
|
+
*/
|
|
30
|
+
const getUrlStatus = async (apiKey, urlId) => {
|
|
31
|
+
return (await get(`https://littlewarden.com/api/sites/${urlId}`, { headers: { "Authorization": `Token token="${apiKey}"` } })).getBodyDefaultTo(["data", "site"], {});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/littleWarden/server/littleWarden.ts
|
|
36
|
+
const littleWardenNamespaces = /* @__PURE__ */ new Map();
|
|
37
|
+
const littleWardenClient = async (key = "default", config, vaultId, itemId) => {
|
|
38
|
+
if (littleWardenNamespaces.has(key)) return littleWardenNamespaces.get(key);
|
|
39
|
+
let instanceConfig;
|
|
40
|
+
if (config) instanceConfig = config;
|
|
41
|
+
else if (vaultId && itemId) instanceConfig = await (await onePasswordClient()).getJsonNote(vaultId, itemId);
|
|
42
|
+
else if (process.env.LITTLE_WARDEN_VAULT_ID && process.env.LITTLE_WARDEN_ITEM_ID) instanceConfig = await (await onePasswordClient()).getJsonNote(process.env.LITTLE_WARDEN_VAULT_ID, process.env.LITTLE_WARDEN_ITEM_ID);
|
|
43
|
+
else throw new Error(`Config required for namespace '${key}'`);
|
|
44
|
+
const namespace = new LittleWardenNamespace(key, instanceConfig);
|
|
45
|
+
littleWardenNamespaces.set(key, namespace);
|
|
46
|
+
return namespace;
|
|
47
|
+
};
|
|
48
|
+
const littleWardenState = {
|
|
49
|
+
ALL_GOOD: "all_good",
|
|
50
|
+
DANGER: "danger",
|
|
51
|
+
WARNING: "warning"
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Check if the field is All Good.
|
|
55
|
+
*/
|
|
56
|
+
const isAllGood = ({ field }) => {
|
|
57
|
+
let response = false;
|
|
58
|
+
if (void 0 !== field && void 0 !== field["status"]) response = littleWardenState.ALL_GOOD === field["status"];
|
|
59
|
+
return response;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Check if the field is Warning.
|
|
63
|
+
*/
|
|
64
|
+
const isWarning = ({ field }) => {
|
|
65
|
+
let response = false;
|
|
66
|
+
if (void 0 !== field && void 0 !== field["status"]) response = littleWardenState.WARNING === field["status"];
|
|
67
|
+
return response;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Check if the field is Danger.
|
|
71
|
+
*/
|
|
72
|
+
const isDanger = ({ field }) => {
|
|
73
|
+
let response = false;
|
|
74
|
+
if (void 0 !== field && void 0 !== field["status"]) response = littleWardenState.DANGER === field["status"];
|
|
75
|
+
return response;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { LittleWardenNamespace, getUrlStatus, isAllGood, isDanger, isWarning, littleWardenClient, littleWardenState };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/lodash/chunk.d.ts
|
|
2
|
+
declare const chunk: <T>(array: T[], size: number) => T[][];
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/lodash/flatten.d.ts
|
|
5
|
+
declare const flatten: <T>(array: T[][]) => T[];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/lodash/set.d.ts
|
|
8
|
+
declare const set: <T extends object>(obj: T, path: string | string[], value: unknown) => T;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/lodash/trim.d.ts
|
|
11
|
+
declare const trim: (str: string, chars?: string) => string;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/lodash/isDate.d.ts
|
|
14
|
+
declare const isDate: (value: unknown) => value is Date;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/lodash/isEmpty.d.ts
|
|
17
|
+
declare const isEmpty: (value: unknown) => boolean;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/lodash/isEqual.d.ts
|
|
20
|
+
declare const isEqual: (a: unknown, b: unknown) => boolean;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/lodash/isFunction.d.ts
|
|
23
|
+
declare const isFunction: (value: any) => value is Function;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/lodash/isObject.d.ts
|
|
26
|
+
declare const isObject: (value: unknown) => value is object;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/lodash/merge.d.ts
|
|
29
|
+
declare const merge: <T extends object>(target: T, ...sources: any[]) => T;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/lodash/orderBy.d.ts
|
|
32
|
+
type OrderDirection = "asc" | "desc";
|
|
33
|
+
type Iteratee<T> = ((item: T) => unknown) | string;
|
|
34
|
+
declare const orderBy: <T>(collection: T[], iteratees: Iteratee<T> | Iteratee<T>[], orders?: OrderDirection | OrderDirection[]) => T[];
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/lodash/unescape.d.ts
|
|
37
|
+
declare const unescape: (str: string) => string;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/lodash/uniq.d.ts
|
|
40
|
+
declare const uniq: (arr: any[]) => any[];
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/lodash/uniqBy.d.ts
|
|
43
|
+
declare const uniqBy: <T>(collection: T[], iteratee: ((item: T) => unknown) | string) => T[];
|
|
44
|
+
//#endregion
|
|
45
|
+
export { chunk, flatten, isDate, isEmpty, isEqual, isFunction, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
//#region src/lodash/chunk.ts
|
|
2
|
+
const chunk = (array, size) => {
|
|
3
|
+
const result = [];
|
|
4
|
+
for (let i = 0; i < array.length; i += size) result.push(array.slice(i, i + size));
|
|
5
|
+
return result;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/lodash/flatten.ts
|
|
10
|
+
const flatten = (array) => [].concat(...array);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/lodash/set.ts
|
|
14
|
+
const set = (obj, path, value) => {
|
|
15
|
+
if (obj == null) return obj;
|
|
16
|
+
const keys = Array.isArray(path) ? path : path.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
17
|
+
let current = obj;
|
|
18
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
19
|
+
const key = keys[i];
|
|
20
|
+
const nextKey = keys[i + 1];
|
|
21
|
+
const nextIsIndex = /^\d+$/.test(nextKey);
|
|
22
|
+
if (current[key] == null || typeof current[key] !== "object") current[key] = nextIsIndex ? [] : {};
|
|
23
|
+
current = current[key];
|
|
24
|
+
}
|
|
25
|
+
current[keys[keys.length - 1]] = value;
|
|
26
|
+
return obj;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/lodash/trim.ts
|
|
31
|
+
const trim = (str, chars) => {
|
|
32
|
+
if (!chars) return str.trim();
|
|
33
|
+
const escaped = chars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
34
|
+
const pattern = new RegExp(`^[${escaped}]+|[${escaped}]+$`, "g");
|
|
35
|
+
return str.replace(pattern, "");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/lodash/isDate.ts
|
|
40
|
+
const isDate = (value) => {
|
|
41
|
+
return value instanceof Date && !isNaN(value.getTime());
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/lodash/isEmpty.ts
|
|
46
|
+
const isEmpty = (value) => {
|
|
47
|
+
if (value == null) return true;
|
|
48
|
+
if (typeof value === "boolean" || typeof value === "number") return true;
|
|
49
|
+
if (typeof value === "string" || Array.isArray(value)) return value.length === 0;
|
|
50
|
+
if (value instanceof Map || value instanceof Set) return value.size === 0;
|
|
51
|
+
if (typeof value === "object") return Object.keys(value).length === 0;
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/lodash/isEqual.ts
|
|
57
|
+
const isEqual = (a, b) => {
|
|
58
|
+
if (a === b) return true;
|
|
59
|
+
if (a == null || b == null) return a === b;
|
|
60
|
+
if (typeof a !== typeof b) return false;
|
|
61
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
|
62
|
+
if (a instanceof RegExp && b instanceof RegExp) return a.toString() === b.toString();
|
|
63
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
64
|
+
if (a.length !== b.length) return false;
|
|
65
|
+
return a.every((item, i) => isEqual(item, b[i]));
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
68
|
+
if (a instanceof Map && b instanceof Map) {
|
|
69
|
+
if (a.size !== b.size) return false;
|
|
70
|
+
for (const [key, val] of a) if (!b.has(key) || !isEqual(val, b.get(key))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (a instanceof Set && b instanceof Set) {
|
|
74
|
+
if (a.size !== b.size) return false;
|
|
75
|
+
for (const val of a) if (!b.has(val)) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
79
|
+
const keysA = Object.keys(a);
|
|
80
|
+
const keysB = Object.keys(b);
|
|
81
|
+
if (keysA.length !== keysB.length) return false;
|
|
82
|
+
return keysA.every((key) => Object.prototype.hasOwnProperty.call(b, key) && isEqual(a[key], b[key]));
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/lodash/isFunction.ts
|
|
89
|
+
const isFunction = (value) => typeof value === "function";
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/lodash/isObject.ts
|
|
93
|
+
const isObject = (value) => {
|
|
94
|
+
const type = typeof value;
|
|
95
|
+
return value != null && (type === "object" || type === "function");
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/lodash/merge.ts
|
|
100
|
+
const merge = (target, ...sources) => {
|
|
101
|
+
for (const source of sources) {
|
|
102
|
+
if (source == null) continue;
|
|
103
|
+
for (const key of Object.keys(source)) {
|
|
104
|
+
const sourceVal = source[key];
|
|
105
|
+
const targetVal = target[key];
|
|
106
|
+
if (Array.isArray(sourceVal) && Array.isArray(targetVal)) {
|
|
107
|
+
const merged = [...targetVal];
|
|
108
|
+
for (let i = 0; i < sourceVal.length; i++) if (sourceVal[i] != null && typeof sourceVal[i] === "object") merged[i] = merge(targetVal[i] ?? {}, sourceVal[i]);
|
|
109
|
+
else merged[i] = sourceVal[i];
|
|
110
|
+
target[key] = merged;
|
|
111
|
+
} else if (sourceVal != null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && !(sourceVal instanceof Date)) target[key] = merge(targetVal != null && typeof targetVal === "object" ? targetVal : {}, sourceVal);
|
|
112
|
+
else if (sourceVal !== void 0) target[key] = sourceVal;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return target;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/lodash/orderBy.ts
|
|
120
|
+
const orderBy = (collection, iteratees, orders = "asc") => {
|
|
121
|
+
const keys = Array.isArray(iteratees) ? iteratees : [iteratees];
|
|
122
|
+
const dirs = Array.isArray(orders) ? orders : [orders];
|
|
123
|
+
const getValue = (item, key) => {
|
|
124
|
+
if (typeof key === "function") return key(item);
|
|
125
|
+
return key.split(".").reduce((acc, part) => acc?.[part], item);
|
|
126
|
+
};
|
|
127
|
+
return [...collection].sort((a, b) => {
|
|
128
|
+
for (let i = 0; i < keys.length; i++) {
|
|
129
|
+
const dir = dirs[i] === "desc" ? -1 : 1;
|
|
130
|
+
const aVal = getValue(a, keys[i]);
|
|
131
|
+
const bVal = getValue(b, keys[i]);
|
|
132
|
+
if (aVal === bVal) continue;
|
|
133
|
+
if (aVal == null) return 1;
|
|
134
|
+
if (bVal == null) return -1;
|
|
135
|
+
if (typeof aVal === "string" && typeof bVal === "string") return aVal.localeCompare(bVal) * dir;
|
|
136
|
+
return (aVal < bVal ? -1 : 1) * dir;
|
|
137
|
+
}
|
|
138
|
+
return 0;
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/lodash/unescape.ts
|
|
144
|
+
const unescape = (str) => {
|
|
145
|
+
const htmlEntities = {
|
|
146
|
+
"&": "&",
|
|
147
|
+
"<": "<",
|
|
148
|
+
">": ">",
|
|
149
|
+
""": "\"",
|
|
150
|
+
"'": "'"
|
|
151
|
+
};
|
|
152
|
+
return str.replace(/&(?:amp|lt|gt|quot|#39);/g, (match) => htmlEntities[match]);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/lodash/uniq.ts
|
|
157
|
+
const uniq = (arr) => [...new Set(arr)];
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/lodash/uniqBy.ts
|
|
161
|
+
const uniqBy = (collection, iteratee) => {
|
|
162
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163
|
+
const getValue = (item) => {
|
|
164
|
+
if (typeof iteratee === "function") return iteratee(item);
|
|
165
|
+
return iteratee.split(".").reduce((acc, part) => acc?.[part], item);
|
|
166
|
+
};
|
|
167
|
+
return collection.filter((item) => {
|
|
168
|
+
const key = getValue(item);
|
|
169
|
+
if (seen.has(key)) return false;
|
|
170
|
+
seen.add(key);
|
|
171
|
+
return true;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
export { chunk, flatten, isDate, isEmpty, isEqual, isFunction, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { f as ApiResponseClass } from "../../../index-DW9yJLtI.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lumar/api/server/lumarApi.d.ts
|
|
4
|
+
type Filter = {
|
|
5
|
+
field: string;
|
|
6
|
+
operand: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
declare const operand: {
|
|
10
|
+
readonly EQUALS: "eql";
|
|
11
|
+
readonly CONTAINS: "cont";
|
|
12
|
+
readonly LESS_THAN: "lt";
|
|
13
|
+
readonly LESS_THAN_OR_EQUAL: "lte";
|
|
14
|
+
readonly GREATER_THAN: "gt";
|
|
15
|
+
readonly GREATER_THAN_OR_EQUAL: "gte";
|
|
16
|
+
readonly REGEX: "rgx";
|
|
17
|
+
readonly NOT_REGEX: "nrgx";
|
|
18
|
+
};
|
|
19
|
+
type Operand = typeof operand[keyof typeof operand];
|
|
20
|
+
declare const order: {
|
|
21
|
+
readonly ASCENDING: "asc";
|
|
22
|
+
readonly DESCENDING: "desc";
|
|
23
|
+
};
|
|
24
|
+
type Order = typeof order[keyof typeof order];
|
|
25
|
+
type OrderRow = {
|
|
26
|
+
direction: Order;
|
|
27
|
+
field: string;
|
|
28
|
+
};
|
|
29
|
+
declare const report: {
|
|
30
|
+
readonly CRAWL_STATISTICS: "crawl_statistics";
|
|
31
|
+
readonly CUSTOM: "custom";
|
|
32
|
+
readonly LIST_PROJECTS: "list_projects";
|
|
33
|
+
readonly LIST_CRAWLS: "list_crawls";
|
|
34
|
+
readonly LIST_REPORTS: "list_reports";
|
|
35
|
+
readonly REPORT_ROWS: "report_rows";
|
|
36
|
+
readonly REPORT_STATISTICS: "report_statistics";
|
|
37
|
+
readonly REPORT_SUMMARY: "report_summary";
|
|
38
|
+
};
|
|
39
|
+
type Report = typeof report[keyof typeof report];
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/lumar/api/server/buildRequest.d.ts
|
|
42
|
+
type BuildRequestProps = {
|
|
43
|
+
crawlId?: number;
|
|
44
|
+
customPath?: string;
|
|
45
|
+
filters?: Filter[];
|
|
46
|
+
limit?: number;
|
|
47
|
+
orders?: OrderRow[];
|
|
48
|
+
page?: number;
|
|
49
|
+
projectId?: number;
|
|
50
|
+
report?: Report;
|
|
51
|
+
subReport?: string;
|
|
52
|
+
};
|
|
53
|
+
declare const buildRequest: (props: BuildRequestProps) => string;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/lumar/api/server/getData.d.ts
|
|
56
|
+
declare const getData: (url: string, accessToken: string) => Promise<ApiResponseClass<any, any>>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/lumar/api/server/initClient.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* http://api-docs.deepcrawl.com/
|
|
61
|
+
* Renew the Lumar user token.
|
|
62
|
+
* Token lasts for 6 hours.
|
|
63
|
+
*/
|
|
64
|
+
declare const initClient: (apiId: string, apiKey: string) => Promise<any>;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { BuildRequestProps, Filter, Operand, Order, OrderRow, Report, buildRequest, getData, initClient, operand, order, report };
|