@8ms/helpers 2.0.0 → 2.0.2
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/.github/workflows/deploy_npmjs.yml +7 -0
- package/.yarn/install-state.gz +0 -0
- package/_class/BaseClass.d.ts +18 -0
- package/_class/BaseClass.js +53 -0
- package/_class/BaseNamespace.d.ts +9 -0
- package/_class/BaseNamespace.js +27 -0
- package/_class/index.d.ts +2 -0
- package/_class/index.js +7 -0
- package/adverity/getJobs.d.ts +15 -0
- package/adverity/getJobs.js +30 -0
- package/adverity/index.d.ts +112 -0
- package/adverity/index.js +61 -0
- package/api/ApiResponseClass.d.ts +35 -0
- package/api/ApiResponseClass.js +97 -0
- package/api/index.d.ts +22 -0
- package/api/index.js +44 -0
- package/array/index.d.ts +8 -0
- package/array/index.js +17 -0
- package/atInternet/index.d.ts +16 -0
- package/atInternet/index.js +18 -0
- package/aws/athenaExpress/AwsAthenaNamespace.d.ts +8 -0
- package/aws/athenaExpress/AwsAthenaNamespace.js +82 -0
- package/aws/athenaExpress/index.d.ts +10 -0
- package/aws/athenaExpress/index.js +40 -0
- package/aws/ec2/AwsEc2Namespace.d.ts +10 -0
- package/aws/ec2/AwsEc2Namespace.js +78 -0
- package/aws/ec2/index.d.ts +3 -0
- package/aws/ec2/index.js +16 -0
- package/aws/ecs/AwsEcsNamespace.d.ts +53 -0
- package/aws/ecs/AwsEcsNamespace.js +159 -0
- package/aws/ecs/index.d.ts +3 -0
- package/aws/ecs/index.js +16 -0
- package/aws/glue/AwsGlueNamespace.d.ts +12 -0
- package/aws/glue/AwsGlueNamespace.js +70 -0
- package/aws/glue/index.d.ts +3 -0
- package/aws/glue/index.js +16 -0
- package/aws/index.d.ts +9 -0
- package/aws/index.js +34 -0
- package/aws/isResponse200.d.ts +4 -0
- package/aws/isResponse200.js +16 -0
- package/aws/lambda/AwsLambdaNamespace.d.ts +21 -0
- package/aws/lambda/AwsLambdaNamespace.js +110 -0
- package/aws/lambda/index.d.ts +4 -0
- package/aws/lambda/index.js +21 -0
- package/aws/s3/AwsS3Namespace.d.ts +60 -0
- package/aws/s3/AwsS3Namespace.js +401 -0
- package/aws/s3/index.d.ts +25 -0
- package/aws/s3/index.js +36 -0
- package/aws/s3/payload.d.ts +42 -0
- package/aws/s3/payload.js +46 -0
- package/aws/ses/AwsSesNamespace.d.ts +18 -0
- package/aws/ses/AwsSesNamespace.js +69 -0
- package/aws/ses/SimpleEmail.d.ts +56 -0
- package/aws/ses/SimpleEmail.js +106 -0
- package/aws/ses/index.d.ts +4 -0
- package/aws/ses/index.js +18 -0
- package/aws/sqs/AwsSqsNamespace.d.ts +34 -0
- package/aws/sqs/AwsSqsNamespace.js +96 -0
- package/aws/sqs/index.d.ts +3 -0
- package/aws/sqs/index.js +16 -0
- package/aws/ssm/AwsSsmNamespace.d.ts +11 -0
- package/aws/ssm/AwsSsmNamespace.js +89 -0
- package/aws/ssm/index.d.ts +3 -0
- package/aws/ssm/index.js +16 -0
- package/axios/deleteRequest.d.ts +6 -0
- package/axios/deleteRequest.js +33 -0
- package/axios/get.d.ts +5 -0
- package/axios/get.js +31 -0
- package/axios/index.d.ts +3 -0
- package/axios/index.js +9 -0
- package/axios/post.d.ts +5 -0
- package/axios/post.js +32 -0
- package/boolean/getBoolean.d.ts +4 -0
- package/boolean/getBoolean.js +23 -0
- package/boolean/index.d.ts +1 -0
- package/boolean/index.js +5 -0
- package/brightData/index.d.ts +15 -0
- package/brightData/index.js +20 -0
- package/brightData/serpApi/buildGoogleSerpUrl.d.ts +32 -0
- package/brightData/serpApi/buildGoogleSerpUrl.js +116 -0
- package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +22 -0
- package/brightData/serpApi/buildGoogleTrendsUrl.js +61 -0
- package/brightData/serpApi/getAsyncRequestId.d.ts +8 -0
- package/brightData/serpApi/getAsyncRequestId.js +36 -0
- package/brightData/serpApi/getAsyncResults.d.ts +7 -0
- package/brightData/serpApi/getAsyncResults.js +35 -0
- package/brightData/serpApi/getRealtime.d.ts +5 -0
- package/brightData/serpApi/getRealtime.js +30 -0
- package/brightData/serpApi/index.d.ts +14 -0
- package/brightData/serpApi/index.js +23 -0
- package/brightData/webScraperIde/getBatch.d.ts +7 -0
- package/brightData/webScraperIde/getBatch.js +28 -0
- package/brightData/webScraperIde/getRealtime.d.ts +7 -0
- package/brightData/webScraperIde/getRealtime.js +49 -0
- package/brightData/webScraperIde/index.d.ts +2 -0
- package/brightData/webScraperIde/index.js +7 -0
- package/cache/index.d.ts +2 -0
- package/cache/index.js +48 -0
- package/cache/test/cache.test.d.ts +1 -0
- package/cache/test/cache.test.js +10 -0
- package/crud/index.d.ts +6 -0
- package/crud/index.js +10 -0
- package/crypto/getDecrypt.d.ts +5 -0
- package/crypto/getDecrypt.js +47 -0
- package/crypto/getEncrypt.d.ts +5 -0
- package/crypto/getEncrypt.js +47 -0
- package/crypto/getRandom.d.ts +4 -0
- package/crypto/getRandom.js +12 -0
- package/crypto/getSha256.d.ts +5 -0
- package/crypto/getSha256.js +48 -0
- package/crypto/index.d.ts +4 -0
- package/crypto/index.js +11 -0
- package/date/calculation.d.ts +75 -0
- package/date/calculation.js +207 -0
- package/date/financialYear.d.ts +19 -0
- package/date/financialYear.js +85 -0
- package/date/format.d.ts +68 -0
- package/date/format.js +150 -0
- package/date/index.d.ts +35 -0
- package/date/index.js +57 -0
- package/environment/index.d.ts +32 -0
- package/environment/index.js +92 -0
- package/eskimi/getAgeGroup.d.ts +4 -0
- package/eskimi/getAgeGroup.js +15 -0
- package/eskimi/getData.d.ts +4 -0
- package/eskimi/getData.js +17 -0
- package/eskimi/getDevice.d.ts +4 -0
- package/eskimi/getDevice.js +15 -0
- package/eskimi/getGender.d.ts +4 -0
- package/eskimi/getGender.js +15 -0
- package/eskimi/index.d.ts +49 -0
- package/eskimi/index.js +96 -0
- package/file/createDirectory.d.ts +5 -0
- package/file/createDirectory.js +50 -0
- package/file/index.d.ts +1 -0
- package/file/index.js +5 -0
- package/geo/countries.d.ts +12 -0
- package/geo/countries.js +222 -0
- package/geo/index.d.ts +2 -0
- package/geo/index.js +7 -0
- package/geo/languages.d.ts +9 -0
- package/geo/languages.js +58 -0
- package/google/bigQuery/GoogleBigQueryNamespace.d.ts +51 -0
- package/google/bigQuery/GoogleBigQueryNamespace.js +165 -0
- package/google/bigQuery/index.d.ts +5 -0
- package/google/bigQuery/index.js +37 -0
- package/google/bigQuery/loadData.d.ts +19 -0
- package/google/bigQuery/loadData.js +18 -0
- package/google/index.d.ts +27 -0
- package/google/index.js +24 -0
- package/google/sheets/GoogleSheetsNamespace.d.ts +16 -0
- package/google/sheets/GoogleSheetsNamespace.js +81 -0
- package/google/sheets/getAssociatedData.d.ts +10 -0
- package/google/sheets/getAssociatedData.js +43 -0
- package/google/sheets/index.d.ts +8 -0
- package/google/sheets/index.js +37 -0
- package/google/storage/GoogleCloudStorageNamespace.d.ts +20 -0
- package/google/storage/GoogleCloudStorageNamespace.js +108 -0
- package/google/storage/index.d.ts +3 -0
- package/google/storage/index.js +30 -0
- package/googleAds/GoogleAdsNamespace.d.ts +11 -0
- package/googleAds/GoogleAdsNamespace.js +73 -0
- package/googleAds/index.d.ts +11 -0
- package/googleAds/index.js +30 -0
- package/googleAds/keywordPlanner/index.d.ts +40 -0
- package/googleAds/keywordPlanner/index.js +59 -0
- package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +11 -0
- package/googlePageSpeed/GooglePageSpeedNamespace.js +35 -0
- package/googlePageSpeed/index.d.ts +17 -0
- package/googlePageSpeed/index.js +44 -0
- package/googleSearchIncidents/index.d.ts +69 -0
- package/googleSearchIncidents/index.js +46 -0
- package/greenDomain/index.d.ts +21 -0
- package/greenDomain/index.js +41 -0
- package/inngest/index.d.ts +6 -0
- package/inngest/index.js +10 -0
- package/json/getJsonNewline.d.ts +1 -0
- package/json/getJsonNewline.js +13 -0
- package/json/index.d.ts +2 -0
- package/json/index.js +7 -0
- package/json/isJson.d.ts +1 -0
- package/json/isJson.js +26 -0
- package/littleWarden/LittleWardenNamespace.d.ts +11 -0
- package/littleWarden/LittleWardenNamespace.js +38 -0
- package/littleWarden/getUrlStatus.d.ts +4 -0
- package/littleWarden/getUrlStatus.js +16 -0
- package/littleWarden/index.d.ts +29 -0
- package/littleWarden/index.js +74 -0
- package/lumar/api/buildRequest.d.ts +13 -0
- package/lumar/api/buildRequest.js +80 -0
- package/lumar/api/getData.d.ts +5 -0
- package/lumar/api/getData.js +13 -0
- package/lumar/api/index.d.ts +36 -0
- package/lumar/api/index.js +33 -0
- package/lumar/api/initClient.d.ts +6 -0
- package/lumar/api/initClient.js +26 -0
- package/lumar/graphql/columns.d.ts +28 -0
- package/lumar/graphql/columns.js +31 -0
- package/lumar/graphql/getData.d.ts +1 -0
- package/lumar/graphql/getData.js +20 -0
- package/lumar/graphql/index.d.ts +29 -0
- package/lumar/graphql/index.js +39 -0
- package/lumar/graphql/initClient.d.ts +5 -0
- package/lumar/graphql/initClient.js +25 -0
- package/lumar/graphql/queries/crawl.d.ts +5 -0
- package/lumar/graphql/queries/crawl.js +2 -0
- package/lumar/graphql/queries/getCrawls.d.ts +18 -0
- package/lumar/graphql/queries/getCrawls.js +33 -0
- package/lumar/graphql/queries/getReportDifferences.d.ts +24 -0
- package/lumar/graphql/queries/getReportDifferences.js +37 -0
- package/lumar/graphql/queries/getRows.d.ts +38 -0
- package/lumar/graphql/queries/getRows.js +57 -0
- package/lumar/graphql/queries/getTotals.d.ts +25 -0
- package/lumar/graphql/queries/getTotals.js +40 -0
- package/lumar/graphql/queries/row.d.ts +157 -0
- package/lumar/graphql/queries/row.js +2 -0
- package/lumar/graphql/reportTemplates.d.ts +67 -0
- package/lumar/graphql/reportTemplates.js +70 -0
- package/myTarget/request.d.ts +5 -0
- package/myTarget/request.js +17 -0
- package/nextAuth/index.d.ts +6 -0
- package/nextAuth/index.js +11 -0
- package/nextAuth/isSessionReady.d.ts +1 -0
- package/nextAuth/isSessionReady.js +13 -0
- package/nextJs/getIp.d.ts +6 -0
- package/nextJs/getIp.js +14 -0
- package/nextJs/getUserAgent.d.ts +6 -0
- package/nextJs/getUserAgent.js +8 -0
- package/nextJs/index.d.ts +2 -0
- package/nextJs/index.js +7 -0
- package/number/format.d.ts +12 -0
- package/number/format.js +20 -0
- package/number/formatCurrency.d.ts +5 -0
- package/number/formatCurrency.js +21 -0
- package/number/getDecimal.d.ts +4 -0
- package/number/getDecimal.js +12 -0
- package/number/getNumber.d.ts +4 -0
- package/number/getNumber.js +48 -0
- package/number/getPercentIncrease.d.ts +4 -0
- package/number/getPercentIncrease.js +16 -0
- package/number/getSafeDivide.d.ts +11 -0
- package/number/getSafeDivide.js +20 -0
- package/number/index.d.ts +6 -0
- package/number/index.js +15 -0
- package/object/index.d.ts +1 -0
- package/object/index.js +5 -0
- package/object/replaceKeys.d.ts +5 -0
- package/object/replaceKeys.js +25 -0
- package/onePassword/OnePasswordNamespace.d.ts +13 -0
- package/onePassword/OnePasswordNamespace.js +81 -0
- package/onePassword/index.d.ts +7 -0
- package/onePassword/index.js +25 -0
- package/openAi/OpenAiNamespace.d.ts +11 -0
- package/openAi/OpenAiNamespace.js +44 -0
- package/openAi/index.d.ts +5 -0
- package/openAi/index.js +30 -0
- package/package.json +2 -2
- package/prisma/PrismaNamespace.d.ts +8 -0
- package/prisma/PrismaNamespace.js +79 -0
- package/prisma/getDecimal.d.ts +4 -0
- package/prisma/getDecimal.js +23 -0
- package/prisma/index.d.ts +8 -0
- package/prisma/index.js +29 -0
- package/snapchat/SnapchatNamespace.d.ts +15 -0
- package/snapchat/SnapchatNamespace.js +30 -0
- package/snapchat/index.d.ts +7 -0
- package/snapchat/index.js +30 -0
- package/sorting/byNumberAscending.d.ts +4 -0
- package/sorting/byNumberAscending.js +19 -0
- package/sorting/byNumberDescending.d.ts +4 -0
- package/sorting/byNumberDescending.js +22 -0
- package/sorting/byStringAscending.d.ts +4 -0
- package/sorting/byStringAscending.js +16 -0
- package/sorting/byStringDescending.d.ts +4 -0
- package/sorting/byStringDescending.js +16 -0
- package/sorting/index.d.ts +4 -0
- package/sorting/index.js +11 -0
- package/stream/index.d.ts +1 -0
- package/stream/index.js +5 -0
- package/stream/sort.d.ts +13 -0
- package/stream/sort.js +51 -0
- package/string/getCapitalised.d.ts +5 -0
- package/string/getCapitalised.js +18 -0
- package/string/getClean.d.ts +18 -0
- package/string/getClean.js +51 -0
- package/string/getFolder.d.ts +4 -0
- package/string/getFolder.js +15 -0
- package/string/getProperCase.d.ts +11 -0
- package/string/getProperCase.js +25 -0
- package/string/getString.d.ts +4 -0
- package/string/getString.js +34 -0
- package/string/getStringFromStream.d.ts +5 -0
- package/string/getStringFromStream.js +17 -0
- package/string/getUnescaped.d.ts +6 -0
- package/string/getUnescaped.js +26 -0
- package/string/getWithoutAccents.d.ts +5 -0
- package/string/getWithoutAccents.js +13 -0
- package/string/getWithoutHtmlTags.d.ts +5 -0
- package/string/getWithoutHtmlTags.js +12 -0
- package/string/getWithoutPunctuation.d.ts +5 -0
- package/string/getWithoutPunctuation.js +13 -0
- package/string/getWithoutUnderscores.d.ts +4 -0
- package/string/getWithoutUnderscores.js +11 -0
- package/string/getWithoutWhitespaces.d.ts +5 -0
- package/string/getWithoutWhitespaces.js +13 -0
- package/string/index.d.ts +12 -0
- package/string/index.js +27 -0
- package/swr/index.d.ts +42 -0
- package/swr/index.js +59 -0
- package/upTimeRobot/UpTimeRobotNamespace.d.ts +31 -0
- package/upTimeRobot/UpTimeRobotNamespace.js +52 -0
- package/upTimeRobot/index.d.ts +38 -0
- package/upTimeRobot/index.js +63 -0
- package/url/index.d.ts +30 -0
- package/url/index.js +72 -0
- package/url/writeUrlContents.d.ts +6 -0
- package/url/writeUrlContents.js +75 -0
- package/util/defaultTo.d.ts +4 -0
- package/util/defaultTo.js +44 -0
- package/util/getBrotliCompressed.d.ts +5 -0
- package/util/getBrotliCompressed.js +23 -0
- package/util/getBrotliDecompressed.d.ts +5 -0
- package/util/getBrotliDecompressed.js +24 -0
- package/util/getClean.d.ts +11 -0
- package/util/getClean.js +23 -0
- package/util/getGzipCompressed.d.ts +5 -0
- package/util/getGzipCompressed.js +23 -0
- package/util/getGzipDecompressed.d.ts +5 -0
- package/util/getGzipDecompressed.js +24 -0
- package/util/getWithoutHash.d.ts +4 -0
- package/util/getWithoutHash.js +18 -0
- package/util/getWithoutParameter.d.ts +4 -0
- package/util/getWithoutParameter.js +18 -0
- package/util/index.d.ts +11 -0
- package/util/index.js +25 -0
- package/util/isUndefined.d.ts +4 -0
- package/util/isUndefined.js +13 -0
- package/util/promiseChunks.d.ts +5 -0
- package/util/promiseChunks.js +19 -0
- package/util/sleep.d.ts +1 -0
- package/util/sleep.js +7 -0
- package/webWorker/index.d.ts +5 -0
- package/webWorker/index.js +9 -0
- package/xml/getXml.d.ts +1 -0
- package/xml/getXml.js +18 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type GetRows = {
|
|
2
|
+
after?: string;
|
|
3
|
+
before?: string;
|
|
4
|
+
crawlId: number;
|
|
5
|
+
first: number;
|
|
6
|
+
filter: object;
|
|
7
|
+
last: number;
|
|
8
|
+
orderBy?: object;
|
|
9
|
+
reportTemplateCode: string;
|
|
10
|
+
reportTypeCode: string;
|
|
11
|
+
};
|
|
12
|
+
declare const getRows: ({ after, before, crawlId, filter, first, last, orderBy, reportTemplateCode, reportTypeCode }: GetRows) => {
|
|
13
|
+
id: string;
|
|
14
|
+
after: string;
|
|
15
|
+
before: string;
|
|
16
|
+
crawlId: number;
|
|
17
|
+
filter: object;
|
|
18
|
+
first: number;
|
|
19
|
+
last: number;
|
|
20
|
+
orderBy: object;
|
|
21
|
+
query: string;
|
|
22
|
+
reportTemplateCode: string;
|
|
23
|
+
reportTypeCode: string;
|
|
24
|
+
variables: {
|
|
25
|
+
after: string;
|
|
26
|
+
before: string;
|
|
27
|
+
filter: object;
|
|
28
|
+
first: number;
|
|
29
|
+
input: {
|
|
30
|
+
crawlId: number;
|
|
31
|
+
reportTemplateCode: string;
|
|
32
|
+
reportTypeCode: string;
|
|
33
|
+
};
|
|
34
|
+
last: number;
|
|
35
|
+
orderBy: object;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default getRows;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getRows = ({ after, before, crawlId, filter, first, last, orderBy, reportTemplateCode, reportTypeCode }) => ({
|
|
4
|
+
id: `get-rows-${crawlId}-${reportTemplateCode}-${reportTypeCode}`.toLowerCase(),
|
|
5
|
+
after,
|
|
6
|
+
before,
|
|
7
|
+
crawlId,
|
|
8
|
+
filter,
|
|
9
|
+
first,
|
|
10
|
+
last,
|
|
11
|
+
orderBy,
|
|
12
|
+
query: `
|
|
13
|
+
query GetRows($input: GetReportInputType!, $orderBy: [JSONObject!], $filter: JSONObject, $first: Int, $after: String, $last: Int, $before: String) {
|
|
14
|
+
getReport(input: $input) {
|
|
15
|
+
totalRows
|
|
16
|
+
rawID
|
|
17
|
+
reportTemplateCode
|
|
18
|
+
reportTypeCode
|
|
19
|
+
id
|
|
20
|
+
rowsWithAllMetrics(
|
|
21
|
+
filter: $filter
|
|
22
|
+
orderBy: $orderBy
|
|
23
|
+
last: $last
|
|
24
|
+
first: $first
|
|
25
|
+
before: $before
|
|
26
|
+
after: $after
|
|
27
|
+
) {
|
|
28
|
+
__typename
|
|
29
|
+
totalCount
|
|
30
|
+
nodes
|
|
31
|
+
pageInfo {
|
|
32
|
+
hasNextPage
|
|
33
|
+
endCursor
|
|
34
|
+
startCursor
|
|
35
|
+
hasPreviousPage
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`,
|
|
41
|
+
reportTemplateCode,
|
|
42
|
+
reportTypeCode,
|
|
43
|
+
variables: {
|
|
44
|
+
after,
|
|
45
|
+
before,
|
|
46
|
+
filter,
|
|
47
|
+
first,
|
|
48
|
+
input: {
|
|
49
|
+
crawlId,
|
|
50
|
+
reportTemplateCode,
|
|
51
|
+
reportTypeCode,
|
|
52
|
+
},
|
|
53
|
+
last,
|
|
54
|
+
orderBy: orderBy || null,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
exports.default = getRows;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type GetTotals = {
|
|
2
|
+
crawlId: number;
|
|
3
|
+
filter: object;
|
|
4
|
+
filterKey?: string;
|
|
5
|
+
reportTemplateCode: string;
|
|
6
|
+
reportTypeCode: string;
|
|
7
|
+
};
|
|
8
|
+
declare const getTotals: ({ crawlId, filter, filterKey, reportTemplateCode, reportTypeCode }: GetTotals) => {
|
|
9
|
+
id: string;
|
|
10
|
+
crawlId: number;
|
|
11
|
+
filter: object;
|
|
12
|
+
filterKey: string;
|
|
13
|
+
query: string;
|
|
14
|
+
reportTemplateCode: string;
|
|
15
|
+
reportTypeCode: string;
|
|
16
|
+
variables: {
|
|
17
|
+
filter: object;
|
|
18
|
+
input: {
|
|
19
|
+
crawlId: number;
|
|
20
|
+
reportTemplateCode: string;
|
|
21
|
+
reportTypeCode: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default getTotals;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getTotals = ({ crawlId, filter, filterKey, reportTemplateCode, reportTypeCode }) => ({
|
|
4
|
+
id: `get-totals-${crawlId}-${reportTemplateCode}-${reportTypeCode}`.toLowerCase(),
|
|
5
|
+
crawlId,
|
|
6
|
+
filter,
|
|
7
|
+
filterKey,
|
|
8
|
+
query: `
|
|
9
|
+
query GetTotals($input: GetReportInputType!, $filter: JSONObject) {
|
|
10
|
+
getReport(input: $input) {
|
|
11
|
+
rawID
|
|
12
|
+
reportTemplateCode
|
|
13
|
+
reportTypeCode
|
|
14
|
+
totalRows
|
|
15
|
+
id
|
|
16
|
+
diffReportTotals(includeSelf: true, filter: $filter) {
|
|
17
|
+
totalRows
|
|
18
|
+
reportTypeCode
|
|
19
|
+
__typename
|
|
20
|
+
}
|
|
21
|
+
rows(
|
|
22
|
+
filter: $filter
|
|
23
|
+
) {
|
|
24
|
+
totalCount
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
reportTemplateCode,
|
|
30
|
+
reportTypeCode,
|
|
31
|
+
variables: {
|
|
32
|
+
filter,
|
|
33
|
+
input: {
|
|
34
|
+
crawlId,
|
|
35
|
+
reportTemplateCode,
|
|
36
|
+
reportTypeCode,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
exports.default = getTotals;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
type RedirectChain = {
|
|
2
|
+
"isMetaRedirect": boolean;
|
|
3
|
+
"redirectsTo": null | string;
|
|
4
|
+
"result": string;
|
|
5
|
+
"statusCode": string;
|
|
6
|
+
"url": string;
|
|
7
|
+
};
|
|
8
|
+
export type Row = {
|
|
9
|
+
"canonicalLinksInCount": number;
|
|
10
|
+
"canonicalUrlIsConsistent": boolean;
|
|
11
|
+
"canonicalizedPage": boolean;
|
|
12
|
+
"contentHtmlRatio": string;
|
|
13
|
+
"contentSize": number;
|
|
14
|
+
"crawlDatetime": string;
|
|
15
|
+
"css": boolean;
|
|
16
|
+
"customExtractionMatch": boolean;
|
|
17
|
+
"customExtraction1": any[];
|
|
18
|
+
"customExtraction2": any[];
|
|
19
|
+
"deeprank": number;
|
|
20
|
+
"description": string;
|
|
21
|
+
"descriptionLengthPx": number;
|
|
22
|
+
"descriptionLength": number;
|
|
23
|
+
"disallowedPage": boolean;
|
|
24
|
+
"duplicateBodyCount": number;
|
|
25
|
+
"duplicateBodyNonIndexable": boolean;
|
|
26
|
+
"duplicateBody": boolean;
|
|
27
|
+
"duplicateDescriptionCount": number;
|
|
28
|
+
"duplicateDescriptionNonIndexable": boolean;
|
|
29
|
+
"duplicateDescriptionPrimaryUrl": string;
|
|
30
|
+
"duplicateDescription": boolean;
|
|
31
|
+
"duplicatePageCount": number;
|
|
32
|
+
"duplicatePageNonIndexable": boolean;
|
|
33
|
+
"duplicatePage": boolean;
|
|
34
|
+
"duplicateTitleCount": number;
|
|
35
|
+
"duplicateTitleNonIndexable": boolean;
|
|
36
|
+
"duplicateTitlePrimaryUrl": string;
|
|
37
|
+
"duplicateTitle": boolean;
|
|
38
|
+
"encodingHeader": string;
|
|
39
|
+
"externalLinksCount": number;
|
|
40
|
+
"fetchTime": string;
|
|
41
|
+
"folderCount": number;
|
|
42
|
+
"followedExternalLinksOutCount": number;
|
|
43
|
+
"followedLinksInCount": number;
|
|
44
|
+
"foundAtUrl": string;
|
|
45
|
+
"foundInBacklinks": boolean;
|
|
46
|
+
"foundInGoogleAnalytics": boolean;
|
|
47
|
+
"foundInGoogleSearchConsole": boolean;
|
|
48
|
+
"foundInList": boolean;
|
|
49
|
+
"foundInLogSummary": boolean;
|
|
50
|
+
"foundInSitemap": boolean;
|
|
51
|
+
"foundInWebCrawl": boolean;
|
|
52
|
+
"h1Count": number;
|
|
53
|
+
"h1Length": number;
|
|
54
|
+
"headerContentType": string;
|
|
55
|
+
"headerNoarchive": boolean;
|
|
56
|
+
"headerNofollow": boolean;
|
|
57
|
+
"headerNoindex": boolean;
|
|
58
|
+
"headerNoodp": boolean;
|
|
59
|
+
"headerNosnippet": boolean;
|
|
60
|
+
"headerNoydir": boolean;
|
|
61
|
+
"hreflangLinksInCount": number;
|
|
62
|
+
"hreflangLinksOutCount": number;
|
|
63
|
+
"hreflangOnHeader": boolean;
|
|
64
|
+
"hreflangOnPage": boolean;
|
|
65
|
+
"hreflangOnSitemap": boolean;
|
|
66
|
+
"hreflangUrlCount": number;
|
|
67
|
+
"hsts": string;
|
|
68
|
+
"htmlSize": number;
|
|
69
|
+
"httpStatusCode": number;
|
|
70
|
+
"https": boolean;
|
|
71
|
+
"indexable": boolean;
|
|
72
|
+
"internalLinksCount": number;
|
|
73
|
+
"internal": boolean;
|
|
74
|
+
"isImage": boolean;
|
|
75
|
+
"isRedirectLoop": boolean;
|
|
76
|
+
"isRedirect": boolean;
|
|
77
|
+
"isSelfCanonical": boolean;
|
|
78
|
+
"js": boolean;
|
|
79
|
+
"level": number;
|
|
80
|
+
"linksInCount": number;
|
|
81
|
+
"linksOutCount": number;
|
|
82
|
+
"metaDisabledSitelinks": boolean;
|
|
83
|
+
"metaNoarchive": boolean;
|
|
84
|
+
"metaNofollow": boolean;
|
|
85
|
+
"metaNoindex": boolean;
|
|
86
|
+
"metaNoodp": boolean;
|
|
87
|
+
"metaNosnippet": boolean;
|
|
88
|
+
"metaNoydir": boolean;
|
|
89
|
+
"metaRedirect": boolean;
|
|
90
|
+
"mobileDesktopContentMismatch": boolean;
|
|
91
|
+
"mobileRelAlternateUrlIsConsistent": boolean;
|
|
92
|
+
"mobileRelAlternate": boolean;
|
|
93
|
+
"mobileRelAmphtml": boolean;
|
|
94
|
+
"newsarticleAuthorSchemaValue": string;
|
|
95
|
+
"noarchive": boolean;
|
|
96
|
+
"nofollowedPage": boolean;
|
|
97
|
+
"noindex": boolean;
|
|
98
|
+
"noodp": boolean;
|
|
99
|
+
"nosnippet": boolean;
|
|
100
|
+
"noydir": boolean;
|
|
101
|
+
"page1": boolean;
|
|
102
|
+
"pageTitle": string;
|
|
103
|
+
"pageTitleLengthPx": number;
|
|
104
|
+
"pageTitleLength": number;
|
|
105
|
+
"paginatedPage": boolean;
|
|
106
|
+
"productAvailabilitySchemaValue": string;
|
|
107
|
+
"productBrandSchemaValue": string;
|
|
108
|
+
"productSkuSchemaValue": string;
|
|
109
|
+
"primaryPage": boolean;
|
|
110
|
+
"primaryUrlFrom": string;
|
|
111
|
+
"primaryUrlFromStatusCode": string;
|
|
112
|
+
"paramCount": number;
|
|
113
|
+
"path0": string;
|
|
114
|
+
"path1": string;
|
|
115
|
+
"path2": string;
|
|
116
|
+
"path3": string;
|
|
117
|
+
"pathCount": number;
|
|
118
|
+
"performanceCls"?: number;
|
|
119
|
+
"performanceDcl"?: number;
|
|
120
|
+
"performanceFcp"?: number;
|
|
121
|
+
"performanceLcp"?: number;
|
|
122
|
+
"performanceTtfb"?: number;
|
|
123
|
+
"performanceTti"?: number;
|
|
124
|
+
"previousPath": string;
|
|
125
|
+
"previousPathDigest": string;
|
|
126
|
+
"rawHeader": {
|
|
127
|
+
[key: string]: string;
|
|
128
|
+
};
|
|
129
|
+
"redirectChain": RedirectChain[];
|
|
130
|
+
"redirectCount": number;
|
|
131
|
+
"redirectedToStatusCode": number;
|
|
132
|
+
"redirectedToUrlDigest": string;
|
|
133
|
+
"redirectedToUrl": string;
|
|
134
|
+
"redirectsInCount": number;
|
|
135
|
+
"relLinksInCount": number;
|
|
136
|
+
"relNextUrlIsConsistent": boolean;
|
|
137
|
+
"relPrevUrlIsConsistent": boolean;
|
|
138
|
+
"responsive": boolean;
|
|
139
|
+
"robotsNoindex": boolean;
|
|
140
|
+
"secureFormInputField": boolean;
|
|
141
|
+
"separateDesktop": boolean;
|
|
142
|
+
"separateMobile": boolean;
|
|
143
|
+
"sitemapsInCount": number;
|
|
144
|
+
"sourceUrl": string;
|
|
145
|
+
"urlAliasDigest": string;
|
|
146
|
+
"urlAlias": string;
|
|
147
|
+
"urlDigest": string;
|
|
148
|
+
"urlLength": number;
|
|
149
|
+
"url": string;
|
|
150
|
+
"urlCount": number;
|
|
151
|
+
"urlTo": string;
|
|
152
|
+
"urlToStatusCode": number;
|
|
153
|
+
"validTwitterCard": boolean;
|
|
154
|
+
"varyUserAgent": boolean;
|
|
155
|
+
"wordCount": number;
|
|
156
|
+
};
|
|
157
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const reportTemplates: {
|
|
2
|
+
"200_PAGES": string;
|
|
3
|
+
"301_REDIRECTS": string;
|
|
4
|
+
"4XX_ERRORS": string;
|
|
5
|
+
"5XX_ERRORS": string;
|
|
6
|
+
ALL_PAGES: string;
|
|
7
|
+
BROKEN_EXTERNAL_LINKS: string;
|
|
8
|
+
BROKEN_INTERNAL_LINKS: string;
|
|
9
|
+
BROKEN_SITEMAP_PAGES: string;
|
|
10
|
+
CANONICAL_CONFLICTING: string;
|
|
11
|
+
CANONICAL_NON_200: string;
|
|
12
|
+
CANONICAL_NON_INDEXABLE: string;
|
|
13
|
+
CANONICAL_ORPHANED: string;
|
|
14
|
+
CUSTOM_EXTRACTION_1: string;
|
|
15
|
+
CUSTOM_EXTRACTION_2: string;
|
|
16
|
+
DUPLICATE_CONTENT: string;
|
|
17
|
+
DUPLICATE_DESCRIPTIONS: string;
|
|
18
|
+
DUPLICATE_TITLES: string;
|
|
19
|
+
EMPTY_PAGES: string;
|
|
20
|
+
INDEXABLE_PAGES: string;
|
|
21
|
+
LINKED_DOMAINS: string;
|
|
22
|
+
MAX_DESCRIPTIONS: string;
|
|
23
|
+
MAX_MOBILE_DESCRIPTIONS: string;
|
|
24
|
+
MAX_TITLES: string;
|
|
25
|
+
MISSING_DESCRIPTIONS: string;
|
|
26
|
+
MISSING_TITLES: string;
|
|
27
|
+
NON_301_REDIRECTS: string;
|
|
28
|
+
NON_INDEXABLE_PAGES: string;
|
|
29
|
+
NON_INDEXABLE_SITEMAP_PAGES: string;
|
|
30
|
+
ORPHANED_CANONICAL: string;
|
|
31
|
+
ORPHANED_ANALYTICS_PAGES: string;
|
|
32
|
+
ORPHANED_SEARCH_CONSOLE_PAGES: string;
|
|
33
|
+
ORPHANED_SITEMAP_PAGES: string;
|
|
34
|
+
PAGES_WITH_HIGH_EXTERNAL_LINKS: string;
|
|
35
|
+
PERFORMANCE_MAX_FETCH_TIME: string;
|
|
36
|
+
PERFORMANCE_POOR_CLS: string;
|
|
37
|
+
PERFORMANCE_SLOW_DCL: string;
|
|
38
|
+
PERFORMANCE_SLOW_FCP: string;
|
|
39
|
+
PERFORMANCE_SLOW_LCP: string;
|
|
40
|
+
PERFORMANCE_SLOW_TTFB: string;
|
|
41
|
+
PERFORMANCE_SLOW_TTI: string;
|
|
42
|
+
PRIMARY_PAGES: string;
|
|
43
|
+
REDIRECTS_BROKEN: string;
|
|
44
|
+
REDIRECTS_CHAIN: string;
|
|
45
|
+
REDIRECTS_LOOP: string;
|
|
46
|
+
SCHEMA_BREADCRUMB: string;
|
|
47
|
+
SCHEMA_EVENT: string;
|
|
48
|
+
SCHEMA_FAQ: string;
|
|
49
|
+
SCHEMA_HOW_TO: string;
|
|
50
|
+
SCHEMA_NEWS_ARTICLE: string;
|
|
51
|
+
SCHEMA_PRODUCT: string;
|
|
52
|
+
SCHEMA_QA: string;
|
|
53
|
+
SCHEMA_RECIPE: string;
|
|
54
|
+
SCHEMA_REVIEW: string;
|
|
55
|
+
SCHEMA_VIDEO: string;
|
|
56
|
+
SHORT_DESCRIPTIONS: string;
|
|
57
|
+
SHORT_TITLES: string;
|
|
58
|
+
SITEMAP_PAGES: string;
|
|
59
|
+
SITEMAPS_NON_INDEXABLE_PAGES: string;
|
|
60
|
+
SITEMAPS_ORPHANED_PAGES: string;
|
|
61
|
+
SITEMAPS_MISSING_PAGES: string;
|
|
62
|
+
THIN_PAGES: string;
|
|
63
|
+
TRUE_UNIQUE_PAGES: string;
|
|
64
|
+
UNIQUE_EXTERNAL_LINKS: string;
|
|
65
|
+
UNIQUE_INTERNAL_LINKS: string;
|
|
66
|
+
XML_SITEMAPS: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reportTemplates = void 0;
|
|
4
|
+
exports.reportTemplates = {
|
|
5
|
+
"200_PAGES": "200_pages",
|
|
6
|
+
"301_REDIRECTS": "301_redirects",
|
|
7
|
+
"4XX_ERRORS": "4xx_errors",
|
|
8
|
+
"5XX_ERRORS": "5xx_errors",
|
|
9
|
+
ALL_PAGES: 'all_pages',
|
|
10
|
+
BROKEN_EXTERNAL_LINKS: 'broken_links_external',
|
|
11
|
+
BROKEN_INTERNAL_LINKS: 'all_broken_links',
|
|
12
|
+
BROKEN_SITEMAP_PAGES: 'broken_sitemap_links',
|
|
13
|
+
CANONICAL_CONFLICTING: 'conflicting_canonical_tags',
|
|
14
|
+
CANONICAL_NON_200: 'canonical_to_non_200',
|
|
15
|
+
CANONICAL_NON_INDEXABLE: 'non_indexable_canonical_links_in',
|
|
16
|
+
CANONICAL_ORPHANED: 'unlinked_canonical_pages',
|
|
17
|
+
CUSTOM_EXTRACTION_1: 'custom_extraction_1',
|
|
18
|
+
CUSTOM_EXTRACTION_2: 'custom_extraction_2',
|
|
19
|
+
DUPLICATE_CONTENT: 'duplicate_body_content',
|
|
20
|
+
DUPLICATE_DESCRIPTIONS: 'pages_with_duplicate_descriptions',
|
|
21
|
+
DUPLICATE_TITLES: 'pages_with_duplicate_titles',
|
|
22
|
+
EMPTY_PAGES: 'empty_pages',
|
|
23
|
+
INDEXABLE_PAGES: 'indexable_pages',
|
|
24
|
+
LINKED_DOMAINS: 'linked_domains',
|
|
25
|
+
MAX_DESCRIPTIONS: 'max_description_length',
|
|
26
|
+
MAX_MOBILE_DESCRIPTIONS: 'max_mobile_description_length',
|
|
27
|
+
MAX_TITLES: 'max_title_length',
|
|
28
|
+
MISSING_DESCRIPTIONS: 'missing_descriptions',
|
|
29
|
+
MISSING_TITLES: 'missing_titles',
|
|
30
|
+
NON_301_REDIRECTS: 'non_301_redirects',
|
|
31
|
+
NON_INDEXABLE_PAGES: 'non_indexable_pages',
|
|
32
|
+
NON_INDEXABLE_SITEMAP_PAGES: 'sitemaps_non_indexable_links',
|
|
33
|
+
ORPHANED_CANONICAL: 'unlinked_canonical_pages',
|
|
34
|
+
ORPHANED_ANALYTICS_PAGES: 'orphaned_organic_landing_pages',
|
|
35
|
+
ORPHANED_SEARCH_CONSOLE_PAGES: 'orphaned_google_search_console_pages',
|
|
36
|
+
ORPHANED_SITEMAP_PAGES: 'orphaned_sitemaps_pages',
|
|
37
|
+
PAGES_WITH_HIGH_EXTERNAL_LINKS: 'max_external_links',
|
|
38
|
+
PERFORMANCE_MAX_FETCH_TIME: 'max_load_time',
|
|
39
|
+
PERFORMANCE_POOR_CLS: 'poor_cls',
|
|
40
|
+
PERFORMANCE_SLOW_DCL: 'slow_dcl',
|
|
41
|
+
PERFORMANCE_SLOW_FCP: 'slow_fcp',
|
|
42
|
+
PERFORMANCE_SLOW_LCP: 'slow_lcp',
|
|
43
|
+
PERFORMANCE_SLOW_TTFB: 'slow_server_response',
|
|
44
|
+
PERFORMANCE_SLOW_TTI: 'slow_tti',
|
|
45
|
+
PRIMARY_PAGES: 'unique_pages',
|
|
46
|
+
REDIRECTS_BROKEN: 'all_broken_redirects',
|
|
47
|
+
REDIRECTS_CHAIN: 'redirect_chains',
|
|
48
|
+
REDIRECTS_LOOP: 'redirection_loop',
|
|
49
|
+
SCHEMA_BREADCRUMB: 'pages_with_breadcrumb_schema',
|
|
50
|
+
SCHEMA_EVENT: 'pages_with_event_schema',
|
|
51
|
+
SCHEMA_FAQ: 'pages_with_faqpage_schema',
|
|
52
|
+
SCHEMA_HOW_TO: 'pages_with_howto_schema',
|
|
53
|
+
SCHEMA_NEWS_ARTICLE: 'pages_with_news_article_schema',
|
|
54
|
+
SCHEMA_PRODUCT: 'pages_with_product_schema',
|
|
55
|
+
SCHEMA_QA: 'pages_with_qapage_schema',
|
|
56
|
+
SCHEMA_RECIPE: 'pages_with_recipe_schema',
|
|
57
|
+
SCHEMA_REVIEW: 'pages_with_review_schema',
|
|
58
|
+
SCHEMA_VIDEO: 'pages_with_videoobject_schema',
|
|
59
|
+
SHORT_DESCRIPTIONS: 'short_descriptions',
|
|
60
|
+
SHORT_TITLES: 'short_titles',
|
|
61
|
+
SITEMAP_PAGES: 'all_sitemaps_links',
|
|
62
|
+
SITEMAPS_NON_INDEXABLE_PAGES: 'sitemaps_non_indexable_links',
|
|
63
|
+
SITEMAPS_ORPHANED_PAGES: 'orphaned_sitemaps_pages',
|
|
64
|
+
SITEMAPS_MISSING_PAGES: 'not_in_sitemaps_primary_indexable',
|
|
65
|
+
THIN_PAGES: 'thin_pages',
|
|
66
|
+
TRUE_UNIQUE_PAGES: 'true_uniques',
|
|
67
|
+
UNIQUE_EXTERNAL_LINKS: 'unique_external_links',
|
|
68
|
+
UNIQUE_INTERNAL_LINKS: 'unique_internal_links',
|
|
69
|
+
XML_SITEMAPS: 'xml_sitemaps',
|
|
70
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = void 0;
|
|
4
|
+
const axios_1 = require("../axios");
|
|
5
|
+
/**
|
|
6
|
+
* Make the request to MyTarget API using the access token.
|
|
7
|
+
*/
|
|
8
|
+
const request = async (data, url) => {
|
|
9
|
+
const response = await (0, axios_1.post)(url, data, {
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${global.myTargetAccessToken}`,
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
};
|
|
17
|
+
exports.request = request;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextAuthState = exports.isSessionReady = void 0;
|
|
4
|
+
var isSessionReady_1 = require("./isSessionReady");
|
|
5
|
+
Object.defineProperty(exports, "isSessionReady", { enumerable: true, get: function () { return isSessionReady_1.isSessionReady; } });
|
|
6
|
+
var NextAuthState;
|
|
7
|
+
(function (NextAuthState) {
|
|
8
|
+
NextAuthState["AUTHENTICATED"] = "authenticated";
|
|
9
|
+
NextAuthState["PENDING"] = "loading";
|
|
10
|
+
NextAuthState["UNAUTHENTICATED"] = "unauthenticated";
|
|
11
|
+
})(NextAuthState || (exports.NextAuthState = NextAuthState = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isSessionReady: (session: any) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSessionReady = void 0;
|
|
4
|
+
const isSessionReady = (session) => {
|
|
5
|
+
let response = false;
|
|
6
|
+
if (undefined !== session && null !== session) {
|
|
7
|
+
if (undefined !== session.user && null !== session.user) {
|
|
8
|
+
response = true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return response;
|
|
12
|
+
};
|
|
13
|
+
exports.isSessionReady = isSessionReady;
|
package/nextJs/getIp.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIp = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Get the user's remote IP Address
|
|
6
|
+
*/
|
|
7
|
+
const getIp = ({ req }) => {
|
|
8
|
+
let response = 'unset';
|
|
9
|
+
if (undefined !== req.headers['x-real-ip']) {
|
|
10
|
+
response = String(req.headers['x-real-ip']);
|
|
11
|
+
}
|
|
12
|
+
return response;
|
|
13
|
+
};
|
|
14
|
+
exports.getIp = getIp;
|
package/nextJs/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserAgent = exports.getIp = void 0;
|
|
4
|
+
var getIp_1 = require("./getIp");
|
|
5
|
+
Object.defineProperty(exports, "getIp", { enumerable: true, get: function () { return getIp_1.getIp; } });
|
|
6
|
+
var getUserAgent_1 = require("./getUserAgent");
|
|
7
|
+
Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return getUserAgent_1.getUserAgent; } });
|
package/number/format.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.format = void 0;
|
|
4
|
+
const getNumber_1 = require("./getNumber");
|
|
5
|
+
/**
|
|
6
|
+
* Take a given number and format it.
|
|
7
|
+
*/
|
|
8
|
+
const format = (props) => {
|
|
9
|
+
const minDp = props?.minDp ?? 0;
|
|
10
|
+
const maxDp = props?.maxDp ?? 2;
|
|
11
|
+
const compact = props?.compact || false;
|
|
12
|
+
const inputValue = (0, getNumber_1.getNumber)(props.input);
|
|
13
|
+
return Intl.NumberFormat(props?.locale || "en-GB", {
|
|
14
|
+
minimumFractionDigits: minDp,
|
|
15
|
+
maximumFractionDigits: maxDp,
|
|
16
|
+
notation: compact ? "compact" : "standard",
|
|
17
|
+
})
|
|
18
|
+
.format(inputValue);
|
|
19
|
+
};
|
|
20
|
+
exports.format = format;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use the International number formatting to return the currency value.
|
|
3
|
+
* https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
|
|
4
|
+
*/
|
|
5
|
+
export declare const formatCurrency: (input: any, locale?: string, currency?: string) => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatCurrency = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Use the International number formatting to return the currency value.
|
|
6
|
+
* https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
|
|
7
|
+
*/
|
|
8
|
+
const formatCurrency = (input, locale = "en-GB", currency = "GBP") => {
|
|
9
|
+
const value = Number(input);
|
|
10
|
+
const currencyClean = currency.toUpperCase()
|
|
11
|
+
.trim();
|
|
12
|
+
let formatted = new Intl.NumberFormat(locale, {
|
|
13
|
+
style: "currency",
|
|
14
|
+
currency: currencyClean,
|
|
15
|
+
}).format(value);
|
|
16
|
+
if ("USD" === currencyClean) {
|
|
17
|
+
formatted = formatted.replace("US$", "$");
|
|
18
|
+
}
|
|
19
|
+
return formatted;
|
|
20
|
+
};
|
|
21
|
+
exports.formatCurrency = formatCurrency;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDecimal = void 0;
|
|
4
|
+
const getNumber_1 = require("./getNumber");
|
|
5
|
+
/**
|
|
6
|
+
* Return a decimal number after rounding.
|
|
7
|
+
*/
|
|
8
|
+
const getDecimal = (input, dp = 2) => {
|
|
9
|
+
const number = (0, getNumber_1.getNumber)(input);
|
|
10
|
+
return Number(number.toFixed(dp));
|
|
11
|
+
};
|
|
12
|
+
exports.getDecimal = getDecimal;
|