@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,11 @@
|
|
|
1
|
+
import { BaseNamespace } from "../_class";
|
|
2
|
+
import type { GoogleAdsApi } from "google-ads-api";
|
|
3
|
+
import { Config } from "./index";
|
|
4
|
+
export declare class GoogleAdsNamespace extends BaseNamespace {
|
|
5
|
+
client: GoogleAdsApi | null;
|
|
6
|
+
config: Config | null;
|
|
7
|
+
mccAccountId: string;
|
|
8
|
+
refreshToken: string;
|
|
9
|
+
ensureInit: () => Promise<void>;
|
|
10
|
+
getCustomer: (customerId: string) => Promise<import("google-ads-api").Customer>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GoogleAdsNamespace = void 0;
|
|
37
|
+
const _class_1 = require("../_class");
|
|
38
|
+
class GoogleAdsNamespace extends _class_1.BaseNamespace {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.client = null;
|
|
42
|
+
this.config = null;
|
|
43
|
+
this.mccAccountId = "";
|
|
44
|
+
this.refreshToken = "";
|
|
45
|
+
this.ensureInit = async () => {
|
|
46
|
+
if (!this.client) {
|
|
47
|
+
try {
|
|
48
|
+
const { GoogleAdsApi } = await Promise.resolve().then(() => __importStar(require("google-ads-api")));
|
|
49
|
+
this.client = new GoogleAdsApi({
|
|
50
|
+
client_id: this.config.client.clientId,
|
|
51
|
+
client_secret: this.config.client.clientSecret,
|
|
52
|
+
developer_token: this.config.client.developerToken,
|
|
53
|
+
});
|
|
54
|
+
this.mccAccountId = this.config.mccAccountId;
|
|
55
|
+
this.refreshToken = this.config.refreshToken;
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new Error("Google Sheets Client not installed");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.getCustomer = async (customerId) => {
|
|
63
|
+
await this.ensureInit();
|
|
64
|
+
const customer = this.client.Customer({
|
|
65
|
+
customer_id: customerId,
|
|
66
|
+
login_customer_id: global.googleAdsClient.mccAccountId,
|
|
67
|
+
refresh_token: global.googleAdsClient.refreshToken,
|
|
68
|
+
});
|
|
69
|
+
return customer;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.GoogleAdsNamespace = GoogleAdsNamespace;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GoogleAdsNamespace } from "./GoogleAdsNamespace";
|
|
2
|
+
export type Config = {
|
|
3
|
+
client: {
|
|
4
|
+
clientId: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
developerToken: string;
|
|
7
|
+
};
|
|
8
|
+
mccAccountId: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const googleAdsClient: (key?: string, config?: Config, vaultId?: string, itemId?: string) => Promise<GoogleAdsNamespace>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleAdsClient = void 0;
|
|
4
|
+
const GoogleAdsNamespace_1 = require("./GoogleAdsNamespace");
|
|
5
|
+
const onePassword_1 = require("../onePassword");
|
|
6
|
+
const googleAdsNamespaces = new Map();
|
|
7
|
+
const googleAdsClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (googleAdsNamespaces.has(key)) {
|
|
9
|
+
return googleAdsNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
let instanceConfig;
|
|
12
|
+
if (config) {
|
|
13
|
+
instanceConfig = config;
|
|
14
|
+
}
|
|
15
|
+
else if (vaultId && itemId) {
|
|
16
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
17
|
+
.getJsonNote(vaultId, itemId);
|
|
18
|
+
}
|
|
19
|
+
else if ("default" === key && process.env.GOOGLE_ADS_VAULT_ID && process.env.GOOGLE_ADS_ITEM_ID) {
|
|
20
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
21
|
+
.getJsonNote(process.env.GOOGLE_ADS_VAULT_ID, process.env.GOOGLE_ADS_ITEM_ID);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new Error(`Config required for namespace '${key}'`);
|
|
25
|
+
}
|
|
26
|
+
const namespace = new GoogleAdsNamespace_1.GoogleAdsNamespace(key, instanceConfig);
|
|
27
|
+
googleAdsNamespaces.set(key, namespace);
|
|
28
|
+
return namespace;
|
|
29
|
+
};
|
|
30
|
+
exports.googleAdsClient = googleAdsClient;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
export declare enum Network {
|
|
3
|
+
GOOGLE_SEARCH_ONLY = 2,
|
|
4
|
+
GOOGLE_SEARCH_AND_PARTNERS = 3
|
|
5
|
+
}
|
|
6
|
+
export declare const requestSchema: z.ZodObject<{
|
|
7
|
+
countries: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
8
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
historicalMetricsOptions: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
startMonth: z.ZodString;
|
|
11
|
+
startYear: z.ZodNumber;
|
|
12
|
+
endMonth: z.ZodString;
|
|
13
|
+
endYear: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
includeAdultKeywords: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
keywordPlanNetwork: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
queries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
language: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
url: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type RequestSchemaType = z.infer<typeof requestSchema>;
|
|
22
|
+
export declare const defaultRequest: RequestSchemaType;
|
|
23
|
+
export declare const responseSchema: z.ZodObject<{
|
|
24
|
+
payload: z.ZodObject<{}, z.core.$strip>;
|
|
25
|
+
keyword: z.ZodString;
|
|
26
|
+
avgCpc: z.ZodNumber;
|
|
27
|
+
avgSearchVolume: z.ZodNumber;
|
|
28
|
+
competition: z.ZodNumber;
|
|
29
|
+
competitionIndex: z.ZodNumber;
|
|
30
|
+
months: z.ZodArray<z.ZodObject<{
|
|
31
|
+
date: z.ZodString;
|
|
32
|
+
month: z.ZodNumber;
|
|
33
|
+
searchVolume: z.ZodNumber;
|
|
34
|
+
year: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
topOfPageBidHigh: z.ZodNumber;
|
|
37
|
+
topOfPageBidLow: z.ZodNumber;
|
|
38
|
+
totalSearchVolume: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type ResponseSchemaType = z.infer<typeof responseSchema>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.responseSchema = exports.defaultRequest = exports.requestSchema = exports.Network = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
var Network;
|
|
6
|
+
(function (Network) {
|
|
7
|
+
Network[Network["GOOGLE_SEARCH_ONLY"] = 2] = "GOOGLE_SEARCH_ONLY";
|
|
8
|
+
Network[Network["GOOGLE_SEARCH_AND_PARTNERS"] = 3] = "GOOGLE_SEARCH_AND_PARTNERS";
|
|
9
|
+
})(Network || (exports.Network = Network = {}));
|
|
10
|
+
exports.requestSchema = v4_1.z.object({
|
|
11
|
+
countries: v4_1.z.array(v4_1.z.number())
|
|
12
|
+
.optional(),
|
|
13
|
+
customerId: v4_1.z.string()
|
|
14
|
+
.optional(),
|
|
15
|
+
historicalMetricsOptions: v4_1.z.object({
|
|
16
|
+
startMonth: v4_1.z.string(),
|
|
17
|
+
startYear: v4_1.z.number(),
|
|
18
|
+
endMonth: v4_1.z.string(),
|
|
19
|
+
endYear: v4_1.z.number(),
|
|
20
|
+
})
|
|
21
|
+
.optional(),
|
|
22
|
+
includeAdultKeywords: v4_1.z.boolean()
|
|
23
|
+
.optional(),
|
|
24
|
+
keywordPlanNetwork: v4_1.z.number()
|
|
25
|
+
.optional(),
|
|
26
|
+
queries: v4_1.z.array(v4_1.z.string())
|
|
27
|
+
.optional(),
|
|
28
|
+
language: v4_1.z.number()
|
|
29
|
+
.optional(),
|
|
30
|
+
url: v4_1.z.string()
|
|
31
|
+
.optional(),
|
|
32
|
+
});
|
|
33
|
+
exports.defaultRequest = {
|
|
34
|
+
countries: [],
|
|
35
|
+
customerId: "",
|
|
36
|
+
historicalMetricsOptions: null,
|
|
37
|
+
includeAdultKeywords: false,
|
|
38
|
+
keywordPlanNetwork: Network.GOOGLE_SEARCH_ONLY,
|
|
39
|
+
queries: [],
|
|
40
|
+
language: null,
|
|
41
|
+
};
|
|
42
|
+
exports.responseSchema = v4_1.z.object({
|
|
43
|
+
payload: v4_1.z.object(),
|
|
44
|
+
keyword: v4_1.z.string(),
|
|
45
|
+
avgCpc: v4_1.z.number(),
|
|
46
|
+
avgSearchVolume: v4_1.z.number(),
|
|
47
|
+
competition: v4_1.z.number(),
|
|
48
|
+
competitionIndex: v4_1.z.number(),
|
|
49
|
+
months: v4_1.z.object({
|
|
50
|
+
date: v4_1.z.string(),
|
|
51
|
+
month: v4_1.z.number(),
|
|
52
|
+
searchVolume: v4_1.z.number(),
|
|
53
|
+
year: v4_1.z.number(),
|
|
54
|
+
})
|
|
55
|
+
.array(),
|
|
56
|
+
topOfPageBidHigh: v4_1.z.number(),
|
|
57
|
+
topOfPageBidLow: v4_1.z.number(),
|
|
58
|
+
totalSearchVolume: v4_1.z.number(),
|
|
59
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseNamespace } from "../_class";
|
|
2
|
+
import { Category, GooglePageSpeedConfig, Strategy } from "./index";
|
|
3
|
+
/**
|
|
4
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
5
|
+
*/
|
|
6
|
+
export declare class GooglePageSpeedNamespace extends BaseNamespace {
|
|
7
|
+
client: boolean | null;
|
|
8
|
+
config: GooglePageSpeedConfig;
|
|
9
|
+
ensureInit: () => Promise<void>;
|
|
10
|
+
getReport: (url: string, category?: Category, strategy?: Strategy) => Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GooglePageSpeedNamespace = void 0;
|
|
4
|
+
const _class_1 = require("../_class");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const axios_1 = require("../axios");
|
|
7
|
+
/**
|
|
8
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
9
|
+
*/
|
|
10
|
+
class GooglePageSpeedNamespace extends _class_1.BaseNamespace {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.client = null;
|
|
14
|
+
this.ensureInit = async () => {
|
|
15
|
+
if (!this.client) {
|
|
16
|
+
try {
|
|
17
|
+
// There is not API client but potentially multiple keys to manage instances
|
|
18
|
+
this.client = true;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
throw new Error("Google PageSpeed Client not installed");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.getReport = async (url, category = index_1.Category.PERFORMANCE, strategy = index_1.Strategy.MOBILE) => {
|
|
26
|
+
const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${strategy}&category=${category}&key=${this.config.apiKey}`;
|
|
27
|
+
const apiResponse = await (0, axios_1.get)(requestUrl);
|
|
28
|
+
if (apiResponse.isSuccess()) {
|
|
29
|
+
return apiResponse.getBody();
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.GooglePageSpeedNamespace = GooglePageSpeedNamespace;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GooglePageSpeedNamespace } from "./GooglePageSpeedNamespace";
|
|
2
|
+
export type GooglePageSpeedConfig = {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const googlePageSpeedClient: (key?: string, config?: GooglePageSpeedConfig, vaultId?: string, itemId?: string) => Promise<GooglePageSpeedNamespace>;
|
|
6
|
+
export declare enum Category {
|
|
7
|
+
CATEGORY_UNSPECIFIED = "CATEGORY_UNSPECIFIED",
|
|
8
|
+
ACCESSIBILITY = "ACCESSIBILITY",
|
|
9
|
+
BEST_PRACTICES = "BEST_PRACTICES",
|
|
10
|
+
PERFORMANCE = "PERFORMANCE",
|
|
11
|
+
SEO = "SEO"
|
|
12
|
+
}
|
|
13
|
+
export declare enum Strategy {
|
|
14
|
+
STRATEGY_UNSPECIFIED = "STRATEGY_UNSPECIFIED",
|
|
15
|
+
DESKTOP = "DESKTOP",
|
|
16
|
+
MOBILE = "MOBILE"
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Strategy = exports.Category = exports.googlePageSpeedClient = void 0;
|
|
4
|
+
const GooglePageSpeedNamespace_1 = require("./GooglePageSpeedNamespace");
|
|
5
|
+
const onePassword_1 = require("../onePassword");
|
|
6
|
+
const googlePageSpeedNamespaces = new Map();
|
|
7
|
+
const googlePageSpeedClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (googlePageSpeedNamespaces.has(key)) {
|
|
9
|
+
return googlePageSpeedNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
let instanceConfig;
|
|
12
|
+
if (config) {
|
|
13
|
+
instanceConfig = config;
|
|
14
|
+
}
|
|
15
|
+
else if (vaultId && itemId) {
|
|
16
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
17
|
+
.getJsonNote(vaultId, itemId);
|
|
18
|
+
}
|
|
19
|
+
else if ("default" === key && process.env.GOOGLE_PAGE_SPEED_VAULT_ID && process.env.GOOGLE_PAGE_SPEED_ITEM_ID) {
|
|
20
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
21
|
+
.getJsonNote(process.env.GOOGLE_PAGE_SPEED_VAULT_ID, process.env.GOOGLE_PAGE_SPEED_ITEM_ID);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new Error(`Config required for namespace '${key}'`);
|
|
25
|
+
}
|
|
26
|
+
const namespace = new GooglePageSpeedNamespace_1.GooglePageSpeedNamespace(key, instanceConfig);
|
|
27
|
+
googlePageSpeedNamespaces.set(key, namespace);
|
|
28
|
+
return namespace;
|
|
29
|
+
};
|
|
30
|
+
exports.googlePageSpeedClient = googlePageSpeedClient;
|
|
31
|
+
var Category;
|
|
32
|
+
(function (Category) {
|
|
33
|
+
Category["CATEGORY_UNSPECIFIED"] = "CATEGORY_UNSPECIFIED";
|
|
34
|
+
Category["ACCESSIBILITY"] = "ACCESSIBILITY";
|
|
35
|
+
Category["BEST_PRACTICES"] = "BEST_PRACTICES";
|
|
36
|
+
Category["PERFORMANCE"] = "PERFORMANCE";
|
|
37
|
+
Category["SEO"] = "SEO";
|
|
38
|
+
})(Category || (exports.Category = Category = {}));
|
|
39
|
+
var Strategy;
|
|
40
|
+
(function (Strategy) {
|
|
41
|
+
Strategy["STRATEGY_UNSPECIFIED"] = "STRATEGY_UNSPECIFIED";
|
|
42
|
+
Strategy["DESKTOP"] = "DESKTOP";
|
|
43
|
+
Strategy["MOBILE"] = "MOBILE";
|
|
44
|
+
})(Strategy || (exports.Strategy = Strategy = {}));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* https://status.search.google.com/summary
|
|
4
|
+
*/
|
|
5
|
+
export declare const getReport: () => Promise<any>;
|
|
6
|
+
export declare const updateSchema: z.ZodObject<{
|
|
7
|
+
created: z.ZodString;
|
|
8
|
+
modified: z.ZodString;
|
|
9
|
+
when: z.ZodString;
|
|
10
|
+
text: z.ZodString;
|
|
11
|
+
status: z.ZodEnum<{
|
|
12
|
+
AVAILABLE: "AVAILABLE";
|
|
13
|
+
SERVICE_DISRUPTION: "SERVICE_DISRUPTION";
|
|
14
|
+
SERVICE_INFORMATION: "SERVICE_INFORMATION";
|
|
15
|
+
}>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type UpdateSchemaType = z.infer<typeof updateSchema>;
|
|
18
|
+
export declare const incidentSchema: z.ZodArray<z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
number: z.ZodString;
|
|
21
|
+
begin: z.ZodString;
|
|
22
|
+
created: z.ZodString;
|
|
23
|
+
end: z.ZodOptional<z.ZodString>;
|
|
24
|
+
modified: z.ZodString;
|
|
25
|
+
external_desc: z.ZodString;
|
|
26
|
+
updates: z.ZodArray<z.ZodObject<{
|
|
27
|
+
created: z.ZodString;
|
|
28
|
+
modified: z.ZodString;
|
|
29
|
+
when: z.ZodString;
|
|
30
|
+
text: z.ZodString;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
AVAILABLE: "AVAILABLE";
|
|
33
|
+
SERVICE_DISRUPTION: "SERVICE_DISRUPTION";
|
|
34
|
+
SERVICE_INFORMATION: "SERVICE_INFORMATION";
|
|
35
|
+
}>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
most_recent_update: z.ZodObject<{
|
|
38
|
+
created: z.ZodString;
|
|
39
|
+
modified: z.ZodString;
|
|
40
|
+
when: z.ZodString;
|
|
41
|
+
text: z.ZodString;
|
|
42
|
+
status: z.ZodEnum<{
|
|
43
|
+
AVAILABLE: "AVAILABLE";
|
|
44
|
+
SERVICE_DISRUPTION: "SERVICE_DISRUPTION";
|
|
45
|
+
SERVICE_INFORMATION: "SERVICE_INFORMATION";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
status_impact: z.ZodEnum<{
|
|
49
|
+
SERVICE_DISRUPTION: "SERVICE_DISRUPTION";
|
|
50
|
+
SERVICE_INFORMATION: "SERVICE_INFORMATION";
|
|
51
|
+
}>;
|
|
52
|
+
severity: z.ZodEnum<{
|
|
53
|
+
high: "high";
|
|
54
|
+
low: "low";
|
|
55
|
+
medium: "medium";
|
|
56
|
+
}>;
|
|
57
|
+
service_key: z.ZodString;
|
|
58
|
+
service_name: z.ZodEnum<{
|
|
59
|
+
Indexing: "Indexing";
|
|
60
|
+
Ranking: "Ranking";
|
|
61
|
+
Serving: "Serving";
|
|
62
|
+
}>;
|
|
63
|
+
affected_products: z.ZodArray<z.ZodObject<{
|
|
64
|
+
title: z.ZodString;
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
uri: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
export type IncidentSchemaType = z.infer<typeof incidentSchema>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.incidentSchema = exports.updateSchema = exports.getReport = void 0;
|
|
4
|
+
const axios_1 = require("../axios");
|
|
5
|
+
const v4_1 = require("zod/v4");
|
|
6
|
+
/**
|
|
7
|
+
* https://status.search.google.com/summary
|
|
8
|
+
*/
|
|
9
|
+
const getReport = async () => {
|
|
10
|
+
const url = "https://status.search.google.com/incidents.json";
|
|
11
|
+
const apiResponse = await (0, axios_1.get)(url);
|
|
12
|
+
if (apiResponse.isSuccess()) {
|
|
13
|
+
return apiResponse.getBody();
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
exports.getReport = getReport;
|
|
18
|
+
exports.updateSchema = v4_1.z.object({
|
|
19
|
+
created: v4_1.z.string(),
|
|
20
|
+
modified: v4_1.z.string(),
|
|
21
|
+
when: v4_1.z.string(),
|
|
22
|
+
text: v4_1.z.string(),
|
|
23
|
+
status: v4_1.z.enum(["AVAILABLE", "SERVICE_DISRUPTION", "SERVICE_INFORMATION"]),
|
|
24
|
+
});
|
|
25
|
+
exports.incidentSchema = v4_1.z.object({
|
|
26
|
+
id: v4_1.z.string(),
|
|
27
|
+
number: v4_1.z.string(),
|
|
28
|
+
begin: v4_1.z.string(),
|
|
29
|
+
created: v4_1.z.string(),
|
|
30
|
+
end: v4_1.z.string().optional(),
|
|
31
|
+
modified: v4_1.z.string(),
|
|
32
|
+
external_desc: v4_1.z.string(),
|
|
33
|
+
updates: exports.updateSchema.array(),
|
|
34
|
+
most_recent_update: exports.updateSchema,
|
|
35
|
+
status_impact: v4_1.z.enum(["SERVICE_DISRUPTION", "SERVICE_INFORMATION"]),
|
|
36
|
+
severity: v4_1.z.enum(["low", "medium", "high"]),
|
|
37
|
+
service_key: v4_1.z.string(),
|
|
38
|
+
service_name: v4_1.z.enum(["Indexing", "Ranking", "Serving"]),
|
|
39
|
+
affected_products: v4_1.z.object({
|
|
40
|
+
title: v4_1.z.string(),
|
|
41
|
+
id: v4_1.z.string(),
|
|
42
|
+
})
|
|
43
|
+
.array(),
|
|
44
|
+
uri: v4_1.z.string(),
|
|
45
|
+
})
|
|
46
|
+
.array();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* https://developers.thegreenwebfoundation.org/api/greencheck/v3/check-single-domain/
|
|
4
|
+
*/
|
|
5
|
+
export declare const getSingleReport: (domain: string) => Promise<any>;
|
|
6
|
+
export declare const greenDomainSchema: z.ZodObject<{
|
|
7
|
+
green: z.ZodBoolean;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
data: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
hosted_by: z.ZodOptional<z.ZodString>;
|
|
11
|
+
hosted_by_website: z.ZodOptional<z.ZodString>;
|
|
12
|
+
partner: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
hosted_by_id: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
modified: z.ZodOptional<z.ZodString>;
|
|
15
|
+
supporting_documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodNumber;
|
|
17
|
+
title: z.ZodString;
|
|
18
|
+
link: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type GreenDomainSchemaType = z.infer<typeof greenDomainSchema>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.greenDomainSchema = exports.getSingleReport = void 0;
|
|
4
|
+
const axios_1 = require("../axios");
|
|
5
|
+
const v4_1 = require("zod/v4");
|
|
6
|
+
/**
|
|
7
|
+
* https://developers.thegreenwebfoundation.org/api/greencheck/v3/check-single-domain/
|
|
8
|
+
*/
|
|
9
|
+
const getSingleReport = async (domain) => {
|
|
10
|
+
const url = `https://api.thegreenwebfoundation.org/greencheck/${domain}`;
|
|
11
|
+
const apiResponse = await (0, axios_1.get)(url);
|
|
12
|
+
if (apiResponse.isSuccess()) {
|
|
13
|
+
return apiResponse.getBody();
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
exports.getSingleReport = getSingleReport;
|
|
18
|
+
exports.greenDomainSchema = v4_1.z.object({
|
|
19
|
+
green: v4_1.z.boolean(),
|
|
20
|
+
url: v4_1.z.string(),
|
|
21
|
+
data: v4_1.z.boolean()
|
|
22
|
+
.optional(),
|
|
23
|
+
hosted_by: v4_1.z.string()
|
|
24
|
+
.optional(),
|
|
25
|
+
hosted_by_website: v4_1.z.string()
|
|
26
|
+
.optional(),
|
|
27
|
+
partner: v4_1.z.string()
|
|
28
|
+
.nullable()
|
|
29
|
+
.optional(),
|
|
30
|
+
hosted_by_id: v4_1.z.number()
|
|
31
|
+
.optional(),
|
|
32
|
+
modified: v4_1.z.string()
|
|
33
|
+
.optional(),
|
|
34
|
+
supporting_documents: v4_1.z.object({
|
|
35
|
+
id: v4_1.z.number(),
|
|
36
|
+
title: v4_1.z.string(),
|
|
37
|
+
link: v4_1.z.string(),
|
|
38
|
+
})
|
|
39
|
+
.array()
|
|
40
|
+
.optional(),
|
|
41
|
+
});
|
package/inngest/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InngestState = void 0;
|
|
4
|
+
var InngestState;
|
|
5
|
+
(function (InngestState) {
|
|
6
|
+
InngestState["RUNNING"] = "Running";
|
|
7
|
+
InngestState["COMPLETED"] = "Completed";
|
|
8
|
+
InngestState["FAILED"] = "Failed";
|
|
9
|
+
InngestState["CANCELLED"] = "Cancelled";
|
|
10
|
+
})(InngestState || (exports.InngestState = InngestState = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getJsonNewline: (data: any) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getJsonNewline = void 0;
|
|
4
|
+
const array_1 = require("../array");
|
|
5
|
+
const getJsonNewline = (data) => {
|
|
6
|
+
// Must be an array
|
|
7
|
+
const inputArray = (0, array_1.getArray)(data);
|
|
8
|
+
// For each array row convert the row
|
|
9
|
+
const stringRows = inputArray.map(row => JSON.stringify(row));
|
|
10
|
+
// Combine each row with a line separator
|
|
11
|
+
return stringRows.join("\n");
|
|
12
|
+
};
|
|
13
|
+
exports.getJsonNewline = getJsonNewline;
|
package/json/index.d.ts
ADDED
package/json/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isJson = exports.getJsonNewline = void 0;
|
|
4
|
+
var getJsonNewline_1 = require("./getJsonNewline");
|
|
5
|
+
Object.defineProperty(exports, "getJsonNewline", { enumerable: true, get: function () { return getJsonNewline_1.getJsonNewline; } });
|
|
6
|
+
var isJson_1 = require("./isJson");
|
|
7
|
+
Object.defineProperty(exports, "isJson", { enumerable: true, get: function () { return isJson_1.isJson; } });
|
package/json/isJson.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isJson: (input: any) => boolean;
|
package/json/isJson.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isJson = void 0;
|
|
4
|
+
const isJson = (input) => {
|
|
5
|
+
// If input is already an object/array/primitive that's not a string,
|
|
6
|
+
// it's considered valid JSON if it can be stringified and re-parsed
|
|
7
|
+
if (typeof input !== "string") {
|
|
8
|
+
try {
|
|
9
|
+
const stringified = JSON.stringify(input);
|
|
10
|
+
JSON.parse(stringified);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// For string inputs, try to parse them as JSON
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(input);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.isJson = isJson;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseNamespace } from "../_class";
|
|
2
|
+
import { LittleWardenConfig } from "./index";
|
|
3
|
+
/**
|
|
4
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
5
|
+
*/
|
|
6
|
+
export declare class LittleWardenNamespace extends BaseNamespace {
|
|
7
|
+
client: boolean | null;
|
|
8
|
+
config: LittleWardenConfig;
|
|
9
|
+
ensureInit: () => Promise<void>;
|
|
10
|
+
getReport: (urlId: string) => Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LittleWardenNamespace = void 0;
|
|
4
|
+
const _class_1 = require("../_class");
|
|
5
|
+
const axios_1 = require("../axios");
|
|
6
|
+
/**
|
|
7
|
+
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
8
|
+
*/
|
|
9
|
+
class LittleWardenNamespace extends _class_1.BaseNamespace {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.client = null;
|
|
13
|
+
this.ensureInit = async () => {
|
|
14
|
+
if (!this.client) {
|
|
15
|
+
try {
|
|
16
|
+
// There is not API client but potentially multiple keys to manage instances
|
|
17
|
+
this.client = true;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
throw new Error("Google PageSpeed Client not installed");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.getReport = async (urlId) => {
|
|
25
|
+
const url = `https://littlewarden.com/api/sites/${urlId}`;
|
|
26
|
+
const apiResponse = await (0, axios_1.get)(url, {
|
|
27
|
+
headers: {
|
|
28
|
+
"Authorization": `Token token="${this.config.apiKey}"`,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (apiResponse.isSuccess()) {
|
|
32
|
+
return apiResponse.getBody();
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.LittleWardenNamespace = LittleWardenNamespace;
|