@8ms/helpers 2.3.2 → 2.3.4
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/generate-exports.js +39 -48
- package/.yarn/install-state.gz +0 -0
- package/api/ApiResponseClass.js +12 -12
- package/api/api.d.ts +2 -2
- package/api/api.js +2 -2
- package/api/functions.js +7 -7
- package/brightData/serpApi/server/brightDataSerpApi.d.ts +2 -2
- package/brightData/serpApi/server/brightDataSerpApi.js +1 -1
- package/brightData/serpApi/server/getAsyncRequestId.js +2 -2
- package/brightData/webScraperIde/server/getRealtime.js +5 -5
- package/crud/crud.d.ts +2 -2
- package/crud/crud.js +1 -1
- package/date/calculation.d.ts +3 -0
- package/date/calculation.js +3 -0
- package/date/date.d.ts +2 -2
- package/date/date.js +1 -1
- package/date/financialYear.d.ts +1 -1
- package/date/financialYear.js +1 -1
- package/environment/environment.d.ts +4 -4
- package/environment/environment.js +9 -9
- package/file/getFileKey.js +2 -2
- package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.d.ts +2 -2
- package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.js +2 -2
- package/googleAds/server/GoogleAdsNamespace.js +1 -2
- package/googlePageSpeed/server/GooglePageSpeedNamespace.d.ts +1 -1
- package/googlePageSpeed/server/GooglePageSpeedNamespace.js +3 -3
- package/googlePageSpeed/server/googlePageSpeed.d.ts +4 -4
- package/googlePageSpeed/server/googlePageSpeed.js +2 -2
- package/inngest/inngest.d.ts +2 -2
- package/inngest/inngest.js +1 -1
- package/littleWarden/server/littleWarden.d.ts +2 -2
- package/littleWarden/server/littleWarden.js +4 -4
- package/lumar/api/server/buildRequest.d.ts +3 -3
- package/lumar/api/server/buildRequest.js +15 -15
- package/lumar/api/server/lumarApi.d.ts +27 -27
- package/lumar/api/server/lumarApi.js +3 -6
- package/lumar/graphql/server/columns.d.ts +28 -27
- package/lumar/graphql/server/columns.js +1 -1
- package/lumar/graphql/server/getData.js +1 -2
- package/lumar/graphql/server/lumarGraphql.d.ts +21 -23
- package/lumar/graphql/server/lumarGraphql.js +2 -6
- package/lumar/graphql/server/queries/getReportDifferences.d.ts +1 -1
- package/lumar/graphql/server/queries/getReportDifferences.js +2 -2
- package/lumar/graphql/server/reportTemplates.d.ts +67 -66
- package/lumar/graphql/server/reportTemplates.js +1 -1
- package/nextAuth/nextAuth.d.ts +3 -3
- package/nextJs/nextJs.js +2 -8
- package/package.json +1 -1
- package/sorting/sorting.d.ts +4 -4
- package/sorting/sorting.js +4 -4
- package/util/isUndefined.js +2 -2
|
@@ -1,20 +1,15 @@
|
|
|
1
|
+
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import {fileURLToPath} from 'url';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const packageJsonPath = path.join(projectRoot, 'package.json');
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const projectRoot = path.join(__dirname, '..');
|
|
8
|
+
const srcRoot = path.join(projectRoot, 'src');
|
|
9
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
11
|
+
const excludeDirs = new Set(['node_modules', 'scripts', 'jest', 'src', '.git', '.github', '.idea']);
|
|
13
12
|
|
|
14
|
-
// Directories to exclude from scanning
|
|
15
|
-
const excludeDirs = ['node_modules', 'scripts', 'jest', 'src', '.git', '.github', '.idea'];
|
|
16
|
-
|
|
17
|
-
// Build exports object
|
|
18
13
|
const exports = {
|
|
19
14
|
'.': {
|
|
20
15
|
types: './index.d.ts',
|
|
@@ -24,55 +19,51 @@ const exports = {
|
|
|
24
19
|
}
|
|
25
20
|
};
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
function findIndexDirs(baseDir, relativePath = '')
|
|
29
|
-
{
|
|
30
|
-
const entries = fs.readdirSync(baseDir, {withFileTypes: true});
|
|
22
|
+
const importExportRegex = /((?:import|export)\s+(?:type\s+)?(?:[\s\S]*?from\s+)?['"])(\.{1,2}\/[^'"]+?)(['"])/g;
|
|
31
23
|
|
|
32
|
-
|
|
24
|
+
function scan(baseDir, relativePath = '')
|
|
25
|
+
{
|
|
26
|
+
for(const entry of fs.readdirSync(baseDir, {withFileTypes: true}))
|
|
33
27
|
{
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const fullPath = path.join(baseDir, entry.name);
|
|
28
|
+
const fullPath = path.join(baseDir, entry.name);
|
|
40
29
|
const newRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
|
41
|
-
const indexJsPath = path.join(fullPath, 'index.js');
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
if(fs.existsSync(indexJsPath))
|
|
31
|
+
if(entry.isDirectory())
|
|
45
32
|
{
|
|
46
|
-
|
|
47
|
-
types: `./${newRelativePath}/index.d.ts`,
|
|
48
|
-
import: `./${newRelativePath}/index.js`,
|
|
49
|
-
require: `./${newRelativePath}/index.js`,
|
|
50
|
-
default: `./${newRelativePath}/index.js`
|
|
51
|
-
};
|
|
33
|
+
if(excludeDirs.has(entry.name) || entry.name.startsWith('.')) continue;
|
|
52
34
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
if(fs.existsSync(path.join(fullPath, 'index.js')))
|
|
36
|
+
{
|
|
37
|
+
const jsPath = `./${newRelativePath}/index.js`;
|
|
38
|
+
const config = {types: `./${newRelativePath}/index.d.ts`, import: jsPath, require: jsPath, default: jsPath};
|
|
56
39
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
}
|
|
40
|
+
exports[`./${newRelativePath}`] = config;
|
|
41
|
+
exports[`./${newRelativePath}/index.js`] = config;
|
|
42
|
+
exports[`./${newRelativePath}/index.d.ts`] = {types: config.types, default: config.types};
|
|
43
|
+
}
|
|
63
44
|
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
scan(fullPath, newRelativePath);
|
|
46
|
+
}
|
|
47
|
+
else if(entry.isFile() && !entry.name.endsWith('.d.ts') && (entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')))
|
|
48
|
+
{
|
|
49
|
+
const original = fs.readFileSync(fullPath, 'utf8');
|
|
50
|
+
const updated = original.replace(importExportRegex, (match, prefix, specifier, suffix) =>
|
|
51
|
+
path.extname(specifier) ? match : `${prefix}${specifier}.js${suffix}`
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if(updated !== original)
|
|
55
|
+
{
|
|
56
|
+
fs.writeFileSync(fullPath, updated, 'utf8');
|
|
57
|
+
console.log(`Fixed extensions in: ${path.relative(projectRoot, fullPath)}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
scan(projectRoot);
|
|
64
|
+
scan(srcRoot);
|
|
71
65
|
|
|
72
|
-
// Update package.json with new exports
|
|
73
66
|
packageJson.exports = exports;
|
|
74
|
-
|
|
75
|
-
// Write back to package.json
|
|
76
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, '\t') + '\n', 'utf8');
|
|
67
|
+
fs.writeFileSync(path.join(projectRoot, 'package.json'), JSON.stringify(packageJson, null, '\t') + '\n', 'utf8');
|
|
77
68
|
|
|
78
69
|
console.log(`Generated exports for ${Object.keys(exports).length} entries`);
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/api/ApiResponseClass.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defaultTo } from "../util";
|
|
2
|
-
import {
|
|
2
|
+
import { apiState } from "./api";
|
|
3
3
|
/**
|
|
4
4
|
* Class version of the API to enable quicker instances.
|
|
5
5
|
*/
|
|
6
6
|
export class ApiResponseClass {
|
|
7
|
-
state =
|
|
7
|
+
state = apiState.IDLE;
|
|
8
8
|
body = null;
|
|
9
9
|
error = null;
|
|
10
10
|
constructor({ body, error, state } = {}) {
|
|
11
11
|
this.body = body || null;
|
|
12
12
|
this.error = error || null;
|
|
13
|
-
this.state = state ||
|
|
13
|
+
this.state = state || apiState.IDLE;
|
|
14
14
|
return this;
|
|
15
15
|
}
|
|
16
16
|
fromJson = (input) => {
|
|
@@ -39,34 +39,34 @@ export class ApiResponseClass {
|
|
|
39
39
|
return this.state;
|
|
40
40
|
};
|
|
41
41
|
isError = () => {
|
|
42
|
-
return this.state ===
|
|
42
|
+
return this.state === apiState.ERROR;
|
|
43
43
|
};
|
|
44
44
|
isIdle = () => {
|
|
45
|
-
return this.state ===
|
|
45
|
+
return this.state === apiState.IDLE;
|
|
46
46
|
};
|
|
47
47
|
isPending = () => {
|
|
48
|
-
return this.state ===
|
|
48
|
+
return this.state === apiState.PENDING;
|
|
49
49
|
};
|
|
50
50
|
isSuccess = () => {
|
|
51
|
-
return this.state ===
|
|
51
|
+
return this.state === apiState.SUCCESS;
|
|
52
52
|
};
|
|
53
53
|
setToIdle = () => {
|
|
54
|
-
this.state =
|
|
54
|
+
this.state = apiState.IDLE;
|
|
55
55
|
return this;
|
|
56
56
|
};
|
|
57
57
|
setToPending = () => {
|
|
58
|
-
this.state =
|
|
58
|
+
this.state = apiState.PENDING;
|
|
59
59
|
return this;
|
|
60
60
|
};
|
|
61
61
|
setToError = (error, body) => {
|
|
62
62
|
this.body = body || null;
|
|
63
63
|
this.error = error;
|
|
64
|
-
this.state =
|
|
64
|
+
this.state = apiState.ERROR;
|
|
65
65
|
return this;
|
|
66
66
|
};
|
|
67
67
|
setToSuccess = (body) => {
|
|
68
68
|
this.body = body;
|
|
69
|
-
this.state =
|
|
69
|
+
this.state = apiState.SUCCESS;
|
|
70
70
|
return this;
|
|
71
71
|
};
|
|
72
72
|
setBody = (body) => {
|
|
@@ -87,7 +87,7 @@ export class ApiResponseClass {
|
|
|
87
87
|
return new ApiResponseClass({ body: validatedBody, state: this.state });
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
return new ApiResponseClass({ error, state:
|
|
90
|
+
return new ApiResponseClass({ error, state: apiState.ERROR });
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
}
|
package/api/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ApiResponseClass } from "./ApiResponseClass";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const apiState: {
|
|
3
3
|
readonly CANCELLED: "CANCELLED";
|
|
4
4
|
readonly ERROR: "ERROR";
|
|
5
5
|
readonly IDLE: "IDLE";
|
|
@@ -7,7 +7,7 @@ export declare const ApiState: {
|
|
|
7
7
|
readonly SUCCESS: "SUCCESS";
|
|
8
8
|
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
9
9
|
};
|
|
10
|
-
export type ApiState = typeof
|
|
10
|
+
export type ApiState = typeof apiState[keyof typeof apiState];
|
|
11
11
|
export type ApiResponse<T = any, E = any> = {
|
|
12
12
|
body: T | null;
|
|
13
13
|
error: E | null;
|
package/api/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ApiResponseClass } from "./ApiResponseClass";
|
|
2
|
-
export const
|
|
2
|
+
export const apiState = {
|
|
3
3
|
CANCELLED: "CANCELLED",
|
|
4
4
|
ERROR: "ERROR",
|
|
5
5
|
IDLE: "IDLE",
|
|
@@ -10,6 +10,6 @@ export const ApiState = {
|
|
|
10
10
|
export const defaultResponse = {
|
|
11
11
|
body: null,
|
|
12
12
|
error: null,
|
|
13
|
-
state:
|
|
13
|
+
state: apiState.IDLE,
|
|
14
14
|
};
|
|
15
15
|
export const unexpectedError = "An unexpected error occurred, please try again.";
|
package/api/functions.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { apiState } from "./api";
|
|
2
2
|
export const isCancelled = (apiResponse) => {
|
|
3
|
-
return
|
|
3
|
+
return apiState.CANCELLED === apiResponse.state;
|
|
4
4
|
};
|
|
5
5
|
export const isError = (apiResponse) => {
|
|
6
|
-
return
|
|
6
|
+
return apiState.ERROR === apiResponse.state;
|
|
7
7
|
};
|
|
8
8
|
export const isIdle = (apiResponse) => {
|
|
9
|
-
return
|
|
9
|
+
return apiState.IDLE === apiResponse.state;
|
|
10
10
|
};
|
|
11
11
|
export const isPending = (apiResponse) => {
|
|
12
|
-
return
|
|
12
|
+
return apiState.PENDING === apiResponse.state;
|
|
13
13
|
};
|
|
14
14
|
export const isSuccess = (apiResponse) => {
|
|
15
|
-
return
|
|
15
|
+
return apiState.SUCCESS === apiResponse.state;
|
|
16
16
|
};
|
|
17
17
|
export const isValidationError = (apiResponse) => {
|
|
18
|
-
return
|
|
18
|
+
return apiState.VALIDATION_ERROR === apiResponse.state;
|
|
19
19
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const brightDataSerpApiType: {
|
|
2
2
|
readonly GOOGLE_FLIGHTS: "GOOGLE_FLIGHTS";
|
|
3
3
|
readonly GOOGLE_HOTELS: "GOOGLE_HOTELS";
|
|
4
4
|
readonly GOOGLE_LENS: "GOOGLE_LENS";
|
|
@@ -7,4 +7,4 @@ export declare const BrightDataSerpApiType: {
|
|
|
7
7
|
readonly GOOGLE_SEARCH: "GOOGLE_SEARCH";
|
|
8
8
|
readonly GOOGLE_TRENDS: "GOOGLE_TRENDS";
|
|
9
9
|
};
|
|
10
|
-
export type BrightDataSerpApiType = typeof
|
|
10
|
+
export type BrightDataSerpApiType = typeof brightDataSerpApiType[keyof typeof brightDataSerpApiType];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { post } from "../../../axios";
|
|
2
2
|
import { getCustomerId, getZone } from "../../server";
|
|
3
|
-
import {
|
|
3
|
+
import { brightDataSerpApiType } from "../server";
|
|
4
4
|
/**
|
|
5
5
|
* Make an async request to the SERP API using the Bright Data proxy.
|
|
6
6
|
* Returns a request ID used with getAsyncResults
|
|
@@ -14,7 +14,7 @@ export const getAsyncRequestId = async (auth, data = {}, type) => {
|
|
|
14
14
|
const customerId = getCustomerId(auth);
|
|
15
15
|
const zone = getZone(auth);
|
|
16
16
|
switch (type) {
|
|
17
|
-
case
|
|
17
|
+
case brightDataSerpApiType.GOOGLE_TRENDS:
|
|
18
18
|
url = `https://api.brightdata.com/serp/trends?customer=${customerId}&zone=${zone}`;
|
|
19
19
|
break;
|
|
20
20
|
default:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { get, post } from "../../../axios";
|
|
2
|
-
import {
|
|
2
|
+
import { apiState } from "../../../api";
|
|
3
3
|
import { sleep } from "../../../util";
|
|
4
4
|
/**
|
|
5
5
|
* Depends on the Scraper setup!
|
|
@@ -17,8 +17,8 @@ export const getRealtime = async (auth, scraperId, data = {}) => {
|
|
|
17
17
|
if (requestResponse.isSuccess()) {
|
|
18
18
|
const responseId = requestResponse.getBodyDefaultTo(["response_id"], "");
|
|
19
19
|
if ("" !== responseId) {
|
|
20
|
-
let state =
|
|
21
|
-
while (
|
|
20
|
+
let state = apiState.PENDING;
|
|
21
|
+
while (apiState.PENDING === state) {
|
|
22
22
|
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
23
23
|
// Use fetch with the agent option to make an HTTP request through the proxy
|
|
24
24
|
// Replace <target_url> with the URL you want to request
|
|
@@ -30,10 +30,10 @@ export const getRealtime = async (auth, scraperId, data = {}) => {
|
|
|
30
30
|
if (resultResponse.isSuccess()) {
|
|
31
31
|
if (undefined !== resultResponse.body.pending &&
|
|
32
32
|
true === resultResponse.body.pending) {
|
|
33
|
-
state =
|
|
33
|
+
state = apiState.PENDING;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
state =
|
|
36
|
+
state = apiState.SUCCESS;
|
|
37
37
|
response = resultResponse.getBody();
|
|
38
38
|
}
|
|
39
39
|
}
|
package/crud/crud.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const crudState: {
|
|
2
2
|
readonly CREATE: "CREATE";
|
|
3
3
|
readonly READ: "READ";
|
|
4
4
|
readonly UPDATE: "UPDATE";
|
|
5
5
|
readonly DELETE: "DELETE";
|
|
6
6
|
};
|
|
7
|
-
export type CrudState = typeof
|
|
7
|
+
export type CrudState = typeof crudState[keyof typeof crudState];
|
package/crud/crud.js
CHANGED
package/date/calculation.d.ts
CHANGED
package/date/calculation.js
CHANGED
package/date/date.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const defaultDateTime: "1901-01-01 00:00:00";
|
|
|
19
19
|
/**
|
|
20
20
|
* Used by Google Ads API.
|
|
21
21
|
*/
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const month: {
|
|
23
23
|
readonly JANUARY: "JANUARY";
|
|
24
24
|
readonly FEBRUARY: "FEBRUARY";
|
|
25
25
|
readonly MARCH: "MARCH";
|
|
@@ -33,4 +33,4 @@ export declare const Month: {
|
|
|
33
33
|
readonly NOVEMBER: "NOVEMBER";
|
|
34
34
|
readonly DECEMBER: "DECEMBER";
|
|
35
35
|
};
|
|
36
|
-
export type Month = typeof
|
|
36
|
+
export type Month = typeof month[keyof typeof month];
|
package/date/date.js
CHANGED
package/date/financialYear.d.ts
CHANGED
package/date/financialYear.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLuxonDate, getToday, getYesterday } from "./calculation";
|
|
2
2
|
import { Interval } from "luxon";
|
|
3
3
|
/**
|
|
4
|
-
* Get the
|
|
4
|
+
* Get the financial year based on an optional year.
|
|
5
5
|
*/
|
|
6
6
|
export const getFinancialYear = (year) => {
|
|
7
7
|
// Either use the current year or a specified year
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const environment: {
|
|
2
2
|
readonly DEVELOPMENT: "development";
|
|
3
3
|
readonly STAGING: "staging";
|
|
4
4
|
readonly PRODUCTION: "production";
|
|
5
5
|
};
|
|
6
|
-
export type Environment = typeof
|
|
7
|
-
export declare const
|
|
6
|
+
export type Environment = typeof environment[keyof typeof environment];
|
|
7
|
+
export declare const platform: {
|
|
8
8
|
readonly AWS: "AWS";
|
|
9
9
|
readonly VERCEL: "VERCEL";
|
|
10
10
|
};
|
|
11
|
-
export type Platform = typeof
|
|
11
|
+
export type Platform = typeof platform[keyof typeof platform];
|
|
12
12
|
/**
|
|
13
13
|
* Determine the environment we're using.
|
|
14
14
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const environment = {
|
|
2
2
|
DEVELOPMENT: "development",
|
|
3
3
|
STAGING: "staging",
|
|
4
4
|
PRODUCTION: "production",
|
|
5
5
|
};
|
|
6
|
-
export const
|
|
6
|
+
export const platform = {
|
|
7
7
|
AWS: "AWS",
|
|
8
8
|
VERCEL: "VERCEL",
|
|
9
9
|
};
|
|
@@ -34,22 +34,22 @@ export const getEnvironment = () => {
|
|
|
34
34
|
.trim();
|
|
35
35
|
switch (platformEnvironmentClean) {
|
|
36
36
|
case "production":
|
|
37
|
-
response =
|
|
37
|
+
response = environment.PRODUCTION;
|
|
38
38
|
break;
|
|
39
39
|
case "demo":
|
|
40
40
|
case "preview":
|
|
41
41
|
case "staging":
|
|
42
|
-
response =
|
|
42
|
+
response = environment.STAGING;
|
|
43
43
|
break;
|
|
44
44
|
default:
|
|
45
|
-
response =
|
|
45
|
+
response = environment.DEVELOPMENT;
|
|
46
46
|
}
|
|
47
47
|
return response;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* Check to see if we are working on AWS Lambda.
|
|
51
51
|
*/
|
|
52
|
-
export const isAws = () =>
|
|
52
|
+
export const isAws = () => platform.AWS === process.env["EMS_PLATFORM"];
|
|
53
53
|
export const isVercel = () => undefined !== process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
|
|
54
54
|
/**
|
|
55
55
|
* Some code should only run on the server side to protect the data.
|
|
@@ -58,9 +58,9 @@ export const isServer = typeof window === "undefined";
|
|
|
58
58
|
/**
|
|
59
59
|
* Check the environment currently running.
|
|
60
60
|
*/
|
|
61
|
-
export const isDevelopment = () =>
|
|
62
|
-
export const isStaging = () =>
|
|
63
|
-
export const isProduction = () =>
|
|
61
|
+
export const isDevelopment = () => environment.DEVELOPMENT === getEnvironment();
|
|
62
|
+
export const isStaging = () => environment.STAGING === getEnvironment();
|
|
63
|
+
export const isProduction = () => environment.PRODUCTION === getEnvironment();
|
|
64
64
|
/**
|
|
65
65
|
* Check to see if we are developing locally or on the hosted platform.
|
|
66
66
|
*/
|
package/file/getFileKey.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DateTime } from "luxon";
|
|
2
|
-
import {
|
|
2
|
+
import { getYmdString } from "../date";
|
|
3
3
|
/**
|
|
4
4
|
* Create a file key from the inputs so it can handle objects/number/etc.
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@ export const getFileKey = (inputs) => {
|
|
|
13
13
|
response += inputs[i];
|
|
14
14
|
}
|
|
15
15
|
else if (inputs[i] instanceof Date || inputs[i] instanceof DateTime) {
|
|
16
|
-
response +=
|
|
16
|
+
response += getYmdString(inputs[i]);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
response += JSON.stringify(inputs[i]);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const network: {
|
|
3
3
|
readonly GOOGLE_SEARCH_ONLY: 2;
|
|
4
4
|
readonly GOOGLE_SEARCH_AND_PARTNERS: 3;
|
|
5
5
|
};
|
|
6
|
-
export type Network = typeof
|
|
6
|
+
export type Network = typeof network[keyof typeof network];
|
|
7
7
|
export declare const requestSchema: z.ZodObject<{
|
|
8
8
|
countries: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
9
9
|
customerId: z.ZodOptional<z.ZodString>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export const
|
|
2
|
+
export const network = {
|
|
3
3
|
GOOGLE_SEARCH_ONLY: 2,
|
|
4
4
|
GOOGLE_SEARCH_AND_PARTNERS: 3,
|
|
5
5
|
};
|
|
@@ -31,7 +31,7 @@ export const defaultRequest = {
|
|
|
31
31
|
customerId: "",
|
|
32
32
|
historicalMetricsOptions: null,
|
|
33
33
|
includeAdultKeywords: false,
|
|
34
|
-
keywordPlanNetwork:
|
|
34
|
+
keywordPlanNetwork: network.GOOGLE_SEARCH_ONLY,
|
|
35
35
|
queries: [],
|
|
36
36
|
language: null,
|
|
37
37
|
};
|
|
@@ -21,11 +21,10 @@ export class GoogleAdsNamespace extends BaseNamespace {
|
|
|
21
21
|
};
|
|
22
22
|
getCustomer = async (customerId) => {
|
|
23
23
|
await this.ensureInit();
|
|
24
|
-
|
|
24
|
+
return this.client.Customer({
|
|
25
25
|
customer_id: customerId,
|
|
26
26
|
login_customer_id: this.mccAccountId,
|
|
27
27
|
refresh_token: this.refreshToken,
|
|
28
28
|
});
|
|
29
|
-
return customer;
|
|
30
29
|
};
|
|
31
30
|
}
|
|
@@ -7,5 +7,5 @@ export declare class GooglePageSpeedNamespace extends BaseNamespace {
|
|
|
7
7
|
client: boolean;
|
|
8
8
|
config: GooglePageSpeedConfig;
|
|
9
9
|
ensureInit: () => Promise<void>;
|
|
10
|
-
getReport: (url: string,
|
|
10
|
+
getReport: (url: string, inputCategory?: Category, inputStrategy?: Strategy) => Promise<any>;
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../_class";
|
|
2
|
-
import {
|
|
2
|
+
import { category, strategy } from "./";
|
|
3
3
|
import { get } from "../../axios";
|
|
4
4
|
/**
|
|
5
5
|
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
@@ -16,8 +16,8 @@ export class GooglePageSpeedNamespace extends BaseNamespace {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
getReport = async (url,
|
|
20
|
-
const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${
|
|
19
|
+
getReport = async (url, inputCategory = category.PERFORMANCE, inputStrategy = strategy.MOBILE) => {
|
|
20
|
+
const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${inputStrategy}&category=${inputCategory}&key=${this.config.apiKey}`;
|
|
21
21
|
const apiResponse = await get(requestUrl);
|
|
22
22
|
if (apiResponse.isSuccess()) {
|
|
23
23
|
return apiResponse.getBody();
|
|
@@ -3,17 +3,17 @@ export type GooglePageSpeedConfig = {
|
|
|
3
3
|
apiKey: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const googlePageSpeedClient: (key?: string, config?: GooglePageSpeedConfig, vaultId?: string, itemId?: string) => Promise<GooglePageSpeedNamespace>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const category: {
|
|
7
7
|
readonly CATEGORY_UNSPECIFIED: "CATEGORY_UNSPECIFIED";
|
|
8
8
|
readonly ACCESSIBILITY: "ACCESSIBILITY";
|
|
9
9
|
readonly BEST_PRACTICES: "BEST_PRACTICES";
|
|
10
10
|
readonly PERFORMANCE: "PERFORMANCE";
|
|
11
11
|
readonly SEO: "SEO";
|
|
12
12
|
};
|
|
13
|
-
export type Category = typeof
|
|
14
|
-
export declare const
|
|
13
|
+
export type Category = typeof category[keyof typeof category];
|
|
14
|
+
export declare const strategy: {
|
|
15
15
|
readonly STRATEGY_UNSPECIFIED: "STRATEGY_UNSPECIFIED";
|
|
16
16
|
readonly DESKTOP: "DESKTOP";
|
|
17
17
|
readonly MOBILE: "MOBILE";
|
|
18
18
|
};
|
|
19
|
-
export type Strategy = typeof
|
|
19
|
+
export type Strategy = typeof strategy[keyof typeof strategy];
|
|
@@ -24,14 +24,14 @@ export const googlePageSpeedClient = async (key = "default", config, vaultId, it
|
|
|
24
24
|
googlePageSpeedNamespaces.set(key, namespace);
|
|
25
25
|
return namespace;
|
|
26
26
|
};
|
|
27
|
-
export const
|
|
27
|
+
export const category = {
|
|
28
28
|
CATEGORY_UNSPECIFIED: "CATEGORY_UNSPECIFIED",
|
|
29
29
|
ACCESSIBILITY: "ACCESSIBILITY",
|
|
30
30
|
BEST_PRACTICES: "BEST_PRACTICES",
|
|
31
31
|
PERFORMANCE: "PERFORMANCE",
|
|
32
32
|
SEO: "SEO",
|
|
33
33
|
};
|
|
34
|
-
export const
|
|
34
|
+
export const strategy = {
|
|
35
35
|
STRATEGY_UNSPECIFIED: "STRATEGY_UNSPECIFIED",
|
|
36
36
|
DESKTOP: "DESKTOP",
|
|
37
37
|
MOBILE: "MOBILE",
|
package/inngest/inngest.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const inngestState: {
|
|
2
2
|
RUNNING: string;
|
|
3
3
|
COMPLETED: string;
|
|
4
4
|
FAILED: string;
|
|
5
5
|
CANCELLED: string;
|
|
6
6
|
};
|
|
7
|
-
export type InngestState = typeof
|
|
7
|
+
export type InngestState = typeof inngestState[keyof typeof inngestState];
|
package/inngest/inngest.js
CHANGED
|
@@ -3,12 +3,12 @@ export type LittleWardenConfig = {
|
|
|
3
3
|
apiKey: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const littleWardenClient: (key?: string, config?: LittleWardenConfig, vaultId?: string, itemId?: string) => Promise<LittleWardenNamespace>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const littleWardenState: {
|
|
7
7
|
readonly ALL_GOOD: "all_good";
|
|
8
8
|
readonly DANGER: "danger";
|
|
9
9
|
readonly WARNING: "warning";
|
|
10
10
|
};
|
|
11
|
-
export type LittleWardenState = typeof
|
|
11
|
+
export type LittleWardenState = typeof littleWardenState[keyof typeof littleWardenState];
|
|
12
12
|
/**
|
|
13
13
|
* Check if the field is All Good.
|
|
14
14
|
*/
|