@8ms/helpers 2.3.2 → 2.3.3

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.
Files changed (50) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/api/ApiResponseClass.js +12 -12
  3. package/api/api.d.ts +2 -2
  4. package/api/api.js +2 -2
  5. package/api/functions.js +7 -7
  6. package/brightData/serpApi/server/brightDataSerpApi.d.ts +2 -2
  7. package/brightData/serpApi/server/brightDataSerpApi.js +1 -1
  8. package/brightData/serpApi/server/getAsyncRequestId.js +2 -2
  9. package/brightData/webScraperIde/server/getRealtime.js +5 -5
  10. package/crud/crud.d.ts +2 -2
  11. package/crud/crud.js +1 -1
  12. package/date/calculation.d.ts +3 -0
  13. package/date/calculation.js +3 -0
  14. package/date/date.d.ts +2 -2
  15. package/date/date.js +1 -1
  16. package/date/financialYear.d.ts +1 -1
  17. package/date/financialYear.js +1 -1
  18. package/environment/environment.d.ts +4 -4
  19. package/environment/environment.js +9 -9
  20. package/file/getFileKey.js +2 -2
  21. package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.d.ts +2 -2
  22. package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.js +2 -2
  23. package/googleAds/server/GoogleAdsNamespace.js +1 -2
  24. package/googlePageSpeed/server/GooglePageSpeedNamespace.d.ts +1 -1
  25. package/googlePageSpeed/server/GooglePageSpeedNamespace.js +3 -3
  26. package/googlePageSpeed/server/googlePageSpeed.d.ts +4 -4
  27. package/googlePageSpeed/server/googlePageSpeed.js +2 -2
  28. package/inngest/inngest.d.ts +2 -2
  29. package/inngest/inngest.js +1 -1
  30. package/littleWarden/server/littleWarden.d.ts +2 -2
  31. package/littleWarden/server/littleWarden.js +4 -4
  32. package/lumar/api/server/buildRequest.d.ts +3 -3
  33. package/lumar/api/server/buildRequest.js +15 -15
  34. package/lumar/api/server/lumarApi.d.ts +27 -27
  35. package/lumar/api/server/lumarApi.js +3 -6
  36. package/lumar/graphql/server/columns.d.ts +28 -27
  37. package/lumar/graphql/server/columns.js +1 -1
  38. package/lumar/graphql/server/getData.js +1 -2
  39. package/lumar/graphql/server/lumarGraphql.d.ts +21 -23
  40. package/lumar/graphql/server/lumarGraphql.js +2 -6
  41. package/lumar/graphql/server/queries/getReportDifferences.d.ts +1 -1
  42. package/lumar/graphql/server/queries/getReportDifferences.js +2 -2
  43. package/lumar/graphql/server/reportTemplates.d.ts +67 -66
  44. package/lumar/graphql/server/reportTemplates.js +1 -1
  45. package/nextAuth/nextAuth.d.ts +3 -3
  46. package/nextJs/nextJs.js +2 -8
  47. package/package.json +1 -1
  48. package/sorting/sorting.d.ts +4 -4
  49. package/sorting/sorting.js +4 -4
  50. package/util/isUndefined.js +2 -2
Binary file
@@ -1,16 +1,16 @@
1
1
  import { defaultTo } from "../util";
2
- import { ApiState } from "./api";
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 = ApiState.IDLE;
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 || ApiState.IDLE;
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 === ApiState.ERROR;
42
+ return this.state === apiState.ERROR;
43
43
  };
44
44
  isIdle = () => {
45
- return this.state === ApiState.IDLE;
45
+ return this.state === apiState.IDLE;
46
46
  };
47
47
  isPending = () => {
48
- return this.state === ApiState.PENDING;
48
+ return this.state === apiState.PENDING;
49
49
  };
50
50
  isSuccess = () => {
51
- return this.state === ApiState.SUCCESS;
51
+ return this.state === apiState.SUCCESS;
52
52
  };
53
53
  setToIdle = () => {
54
- this.state = ApiState.IDLE;
54
+ this.state = apiState.IDLE;
55
55
  return this;
56
56
  };
57
57
  setToPending = () => {
58
- this.state = ApiState.PENDING;
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 = ApiState.ERROR;
64
+ this.state = apiState.ERROR;
65
65
  return this;
66
66
  };
67
67
  setToSuccess = (body) => {
68
68
  this.body = body;
69
- this.state = ApiState.SUCCESS;
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: ApiState.ERROR });
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 ApiState: {
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 ApiState[keyof typeof ApiState];
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 ApiState = {
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: ApiState.IDLE,
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 { ApiState } from "./api";
1
+ import { apiState } from "./api";
2
2
  export const isCancelled = (apiResponse) => {
3
- return ApiState.CANCELLED === apiResponse.state;
3
+ return apiState.CANCELLED === apiResponse.state;
4
4
  };
5
5
  export const isError = (apiResponse) => {
6
- return ApiState.ERROR === apiResponse.state;
6
+ return apiState.ERROR === apiResponse.state;
7
7
  };
8
8
  export const isIdle = (apiResponse) => {
9
- return ApiState.IDLE === apiResponse.state;
9
+ return apiState.IDLE === apiResponse.state;
10
10
  };
11
11
  export const isPending = (apiResponse) => {
12
- return ApiState.PENDING === apiResponse.state;
12
+ return apiState.PENDING === apiResponse.state;
13
13
  };
14
14
  export const isSuccess = (apiResponse) => {
15
- return ApiState.SUCCESS === apiResponse.state;
15
+ return apiState.SUCCESS === apiResponse.state;
16
16
  };
17
17
  export const isValidationError = (apiResponse) => {
18
- return ApiState.VALIDATION_ERROR === apiResponse.state;
18
+ return apiState.VALIDATION_ERROR === apiResponse.state;
19
19
  };
@@ -1,4 +1,4 @@
1
- export declare const BrightDataSerpApiType: {
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 BrightDataSerpApiType[keyof typeof BrightDataSerpApiType];
10
+ export type BrightDataSerpApiType = typeof brightDataSerpApiType[keyof typeof brightDataSerpApiType];
@@ -1,4 +1,4 @@
1
- export const BrightDataSerpApiType = {
1
+ export const brightDataSerpApiType = {
2
2
  GOOGLE_FLIGHTS: "GOOGLE_FLIGHTS",
3
3
  GOOGLE_HOTELS: "GOOGLE_HOTELS",
4
4
  GOOGLE_LENS: "GOOGLE_LENS",
@@ -1,6 +1,6 @@
1
1
  import { post } from "../../../axios";
2
2
  import { getCustomerId, getZone } from "../../server";
3
- import { BrightDataSerpApiType } from "../server";
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 BrightDataSerpApiType.GOOGLE_TRENDS:
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 { ApiState } from "../../../api";
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 = ApiState.PENDING;
21
- while (ApiState.PENDING === state) {
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 = ApiState.PENDING;
33
+ state = apiState.PENDING;
34
34
  }
35
35
  else {
36
- state = ApiState.SUCCESS;
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 CrudState: {
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 CrudState[keyof typeof CrudState];
7
+ export type CrudState = typeof crudState[keyof typeof crudState];
package/crud/crud.js CHANGED
@@ -1,4 +1,4 @@
1
- export const CrudState = {
1
+ export const crudState = {
2
2
  CREATE: "CREATE",
3
3
  READ: "READ",
4
4
  UPDATE: "UPDATE",
@@ -1,5 +1,8 @@
1
1
  import { DateTime } from "luxon";
2
2
  import { InputDate, Timeframe } from "./date";
3
+ /**
4
+ * Return unix timestamp in seconds.
5
+ */
3
6
  export declare const getUnix: (input?: InputDate) => number;
4
7
  /**
5
8
  * Assume the input is always UTC.
@@ -1,4 +1,7 @@
1
1
  import { DateTime, Interval } from "luxon";
2
+ /**
3
+ * Return unix timestamp in seconds.
4
+ */
2
5
  export const getUnix = (input) => {
3
6
  return getLuxonDate(input)
4
7
  .toUnixInteger();
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 Month: {
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 Month[keyof typeof Month];
36
+ export type Month = typeof month[keyof typeof month];
package/date/date.js CHANGED
@@ -4,7 +4,7 @@ export const defaultDateTime = "1901-01-01 00:00:00";
4
4
  /**
5
5
  * Used by Google Ads API.
6
6
  */
7
- export const Month = {
7
+ export const month = {
8
8
  JANUARY: "JANUARY",
9
9
  FEBRUARY: "FEBRUARY",
10
10
  MARCH: "MARCH",
@@ -1,7 +1,7 @@
1
1
  import { Timeframe } from "./date";
2
2
  import { Interval } from "luxon";
3
3
  /**
4
- * Get the current financial year.
4
+ * Get the financial year based on an optional year.
5
5
  */
6
6
  export declare const getFinancialYear: (year?: number) => Timeframe;
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { getLuxonDate, getToday, getYesterday } from "./calculation";
2
2
  import { Interval } from "luxon";
3
3
  /**
4
- * Get the current financial year.
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 Environment: {
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 Environment[keyof typeof Environment];
7
- export declare const Platform: {
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 Platform[keyof typeof Platform];
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 Environment = {
1
+ export const environment = {
2
2
  DEVELOPMENT: "development",
3
3
  STAGING: "staging",
4
4
  PRODUCTION: "production",
5
5
  };
6
- export const Platform = {
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 = Environment.PRODUCTION;
37
+ response = environment.PRODUCTION;
38
38
  break;
39
39
  case "demo":
40
40
  case "preview":
41
41
  case "staging":
42
- response = Environment.STAGING;
42
+ response = environment.STAGING;
43
43
  break;
44
44
  default:
45
- response = Environment.DEVELOPMENT;
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 = () => Platform.AWS === process.env["EMS_PLATFORM"];
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 = () => Environment.DEVELOPMENT === getEnvironment();
62
- export const isStaging = () => Environment.STAGING === getEnvironment();
63
- export const isProduction = () => Environment.PRODUCTION === getEnvironment();
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
  */
@@ -1,5 +1,5 @@
1
1
  import { DateTime } from "luxon";
2
- import { format } from "../date";
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 += format(inputs[i], "YYYY-MM-DD");
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 Network: {
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 Network[keyof typeof Network];
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 Network = {
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: Network.GOOGLE_SEARCH_ONLY,
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
- const customer = this.client.Customer({
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, category?: Category, strategy?: Strategy) => Promise<any>;
10
+ getReport: (url: string, inputCategory?: Category, inputStrategy?: Strategy) => Promise<any>;
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseNamespace } from "../../_class";
2
- import { Category, Strategy } from "./";
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, category = Category.PERFORMANCE, strategy = Strategy.MOBILE) => {
20
- const requestUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&strategy=${strategy}&category=${category}&key=${this.config.apiKey}`;
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 Category: {
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 Category[keyof typeof Category];
14
- export declare const Strategy: {
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 Strategy[keyof typeof Strategy];
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 Category = {
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 Strategy = {
34
+ export const strategy = {
35
35
  STRATEGY_UNSPECIFIED: "STRATEGY_UNSPECIFIED",
36
36
  DESKTOP: "DESKTOP",
37
37
  MOBILE: "MOBILE",
@@ -1,7 +1,7 @@
1
- export declare const InngestState: {
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 InngestState[keyof typeof InngestState];
7
+ export type InngestState = typeof inngestState[keyof typeof inngestState];
@@ -1,4 +1,4 @@
1
- export const InngestState = {
1
+ export const inngestState = {
2
2
  RUNNING: "Running",
3
3
  COMPLETED: "Completed",
4
4
  FAILED: "Failed",
@@ -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 LittleWardenState: {
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 LittleWardenState[keyof typeof LittleWardenState];
11
+ export type LittleWardenState = typeof littleWardenState[keyof typeof littleWardenState];
12
12
  /**
13
13
  * Check if the field is All Good.
14
14
  */
@@ -24,7 +24,7 @@ export const littleWardenClient = async (key = "default", config, vaultId, itemI
24
24
  littleWardenNamespaces.set(key, namespace);
25
25
  return namespace;
26
26
  };
27
- export const LittleWardenState = {
27
+ export const littleWardenState = {
28
28
  ALL_GOOD: "all_good",
29
29
  DANGER: "danger",
30
30
  WARNING: "warning",
@@ -36,7 +36,7 @@ export const isAllGood = ({ field }) => {
36
36
  let response = false;
37
37
  // Check that the status field exists
38
38
  if (undefined !== field && undefined !== field["status"]) {
39
- response = LittleWardenState.ALL_GOOD === field["status"];
39
+ response = littleWardenState.ALL_GOOD === field["status"];
40
40
  }
41
41
  return response;
42
42
  };
@@ -47,7 +47,7 @@ export const isWarning = ({ field }) => {
47
47
  let response = false;
48
48
  // Check that the status field exists
49
49
  if (undefined !== field && undefined !== field["status"]) {
50
- response = LittleWardenState.WARNING === field["status"];
50
+ response = littleWardenState.WARNING === field["status"];
51
51
  }
52
52
  return response;
53
53
  };
@@ -58,7 +58,7 @@ export const isDanger = ({ field }) => {
58
58
  let response = false;
59
59
  // Check that the status field exists
60
60
  if (undefined !== field && undefined !== field["status"]) {
61
- response = LittleWardenState.DANGER === field["status"];
61
+ response = littleWardenState.DANGER === field["status"];
62
62
  }
63
63
  return response;
64
64
  };
@@ -1,13 +1,13 @@
1
- import { Filter, Order } from "./";
1
+ import { Filter, OrderRow, Report } from "./";
2
2
  export type BuildRequestProps = {
3
3
  crawlId?: number;
4
4
  customPath?: string;
5
5
  filters?: Filter[];
6
6
  limit?: number;
7
- orders?: Order[];
7
+ orders?: OrderRow[];
8
8
  page?: number;
9
9
  projectId?: number;
10
- report?: string;
10
+ report?: Report;
11
11
  subReport?: string;
12
12
  };
13
13
  export declare const buildRequest: (props: BuildRequestProps) => string;
@@ -1,4 +1,4 @@
1
- import { orders, reports } from "./";
1
+ import { order, report } from "./";
2
2
  export const buildRequest = (props) => {
3
3
  let url = `https://api.deepcrawl.com/accounts/37204`;
4
4
  // Limit must be greater than 0 but also less than 200
@@ -15,35 +15,35 @@ export const buildRequest = (props) => {
15
15
  props.limit = 200;
16
16
  }
17
17
  // If a report other than List Crawls is selected, Crawl ID must be defined
18
- if (undefined !== props.report && reports.LIST_CRAWLS !== props.report && undefined == props.crawlId) {
18
+ if (undefined !== props.report && report.LIST_CRAWLS !== props.report && undefined == props.crawlId) {
19
19
  throw `Crawl ID must be defined.`;
20
20
  }
21
21
  switch (props.report) {
22
- case reports.LIST_CRAWLS:
22
+ case report.LIST_CRAWLS:
23
23
  url += `/projects/${props.projectId}/crawls`;
24
24
  break;
25
- case reports.LIST_PROJECTS:
25
+ case report.LIST_PROJECTS:
26
26
  url += `/projects`;
27
27
  break;
28
- case reports.CUSTOM:
28
+ case report.CUSTOM:
29
29
  url += props.customPath;
30
30
  url = url.replace("[PROJECT]", props.projectId.toString());
31
31
  url = url.replace("[CRAWL]", props.crawlId.toString());
32
32
  break;
33
- case reports.CRAWL_STATISTICS:
33
+ case report.CRAWL_STATISTICS:
34
34
  url += `/projects/${props.projectId}/crawls/${props.crawlId}/statistics`;
35
35
  break;
36
- case reports.LIST_REPORTS:
36
+ case report.LIST_REPORTS:
37
37
  url += `/projects/${props.projectId}/crawls/${props.crawlId}/reports`;
38
38
  break;
39
- case reports.REPORT_ROWS:
40
- case reports.REPORT_STATISTICS:
41
- case reports.REPORT_SUMMARY:
39
+ case report.REPORT_ROWS:
40
+ case report.REPORT_STATISTICS:
41
+ case report.REPORT_SUMMARY:
42
42
  url += `/projects/${props.projectId}/crawls/${props.crawlId}/reports/${props.subReport}`;
43
- if (reports.REPORT_ROWS === props.report) {
43
+ if (report.REPORT_ROWS === props.report) {
44
44
  url += `/report_rows`;
45
45
  }
46
- else if (reports.REPORT_STATISTICS === props.report) {
46
+ else if (report.REPORT_STATISTICS === props.report) {
47
47
  url += `/statistics`;
48
48
  }
49
49
  break;
@@ -66,10 +66,10 @@ export const buildRequest = (props) => {
66
66
  // Order the data
67
67
  if (undefined !== props.orders) {
68
68
  url += -1 === url.indexOf("?") ? "?" : "&";
69
- props.orders.map((order, index) => {
69
+ props.orders.map((orderRow, index) => {
70
70
  url += 0 === index ? "sort=" : ",";
71
- url += orders.DESCENDING === order.direction ? "-" : "";
72
- url += order.field;
71
+ url += order.DESCENDING === orderRow.direction ? "-" : "";
72
+ url += orderRow.field;
73
73
  });
74
74
  }
75
75
  return url;
@@ -3,34 +3,34 @@ export type Filter = {
3
3
  operand: string;
4
4
  value: string;
5
5
  };
6
- export declare const operands: {
7
- EQUALS: string;
8
- CONTAINS: string;
9
- LESS_THAN: string;
10
- LESS_THAN_OR_EQUAL: string;
11
- GREATER_THAN: string;
12
- GREATER_THAN_OR_EQUAL: string;
13
- REGEX: string;
14
- NOT_REGEX: string;
6
+ export declare const operand: {
7
+ readonly EQUALS: "eql";
8
+ readonly CONTAINS: "cont";
9
+ readonly LESS_THAN: "lt";
10
+ readonly LESS_THAN_OR_EQUAL: "lte";
11
+ readonly GREATER_THAN: "gt";
12
+ readonly GREATER_THAN_OR_EQUAL: "gte";
13
+ readonly REGEX: "rgx";
14
+ readonly NOT_REGEX: "nrgx";
15
15
  };
16
- export type Order = {
17
- direction: string;
18
- field: string;
16
+ export type Operand = typeof operand[keyof typeof operand];
17
+ export declare const order: {
18
+ readonly ASCENDING: "asc";
19
+ readonly DESCENDING: "desc";
19
20
  };
20
- export declare const orders: {
21
- ASCENDING: string;
22
- DESCENDING: string;
21
+ export type Order = typeof order[keyof typeof order];
22
+ export type OrderRow = {
23
+ direction: Order;
24
+ field: string;
23
25
  };
24
- export declare const reports: {
25
- CRAWL_STATISTICS: string;
26
- CUSTOM: string;
27
- LIST_PROJECTS: string;
28
- LIST_CRAWLS: string;
29
- LIST_REPORTS: string;
30
- REPORT_ROWS: string;
31
- REPORT_STATISTICS: string;
32
- REPORT_SUMMARY: string;
26
+ export declare const report: {
27
+ readonly CRAWL_STATISTICS: "crawl_statistics";
28
+ readonly CUSTOM: "custom";
29
+ readonly LIST_PROJECTS: "list_projects";
30
+ readonly LIST_CRAWLS: "list_crawls";
31
+ readonly LIST_REPORTS: "list_reports";
32
+ readonly REPORT_ROWS: "report_rows";
33
+ readonly REPORT_STATISTICS: "report_statistics";
34
+ readonly REPORT_SUMMARY: "report_summary";
33
35
  };
34
- export * from "./buildRequest";
35
- export * from "./getData";
36
- export * from "./initClient";
36
+ export type Report = typeof report[keyof typeof report];
@@ -1,4 +1,4 @@
1
- export const operands = {
1
+ export const operand = {
2
2
  EQUALS: 'eql',
3
3
  CONTAINS: 'cont',
4
4
  LESS_THAN: 'lt',
@@ -8,11 +8,11 @@ export const operands = {
8
8
  REGEX: 'rgx',
9
9
  NOT_REGEX: 'nrgx',
10
10
  };
11
- export const orders = {
11
+ export const order = {
12
12
  ASCENDING: 'asc',
13
13
  DESCENDING: 'desc',
14
14
  };
15
- export const reports = {
15
+ export const report = {
16
16
  CRAWL_STATISTICS: 'crawl_statistics',
17
17
  CUSTOM: 'custom',
18
18
  LIST_PROJECTS: 'list_projects',
@@ -22,6 +22,3 @@ export const reports = {
22
22
  REPORT_STATISTICS: 'report_statistics',
23
23
  REPORT_SUMMARY: 'report_summary',
24
24
  };
25
- export * from "./buildRequest";
26
- export * from "./getData";
27
- export * from "./initClient";
@@ -1,28 +1,29 @@
1
- export declare const columns: {
2
- CUSTOM_EXTRACTION_1: string;
3
- CUSTOM_EXTRACTION_2: string;
4
- DEEP_RANK: string;
5
- DESCRIPTION: string;
6
- DUPLICATE_PAGE: string;
7
- DUPLICATE_DESCRIPTION_FROM: string;
8
- DUPLICATE_TITLE_FROM: string;
9
- FOUND_AT_URL: string;
10
- FOUND_IN_CRAWL: string;
11
- FOUND_IN_SEARCH_CONSOLE: string;
12
- FOUND_IN_SITEMAP: string;
13
- LEVEL: string;
14
- PAGE_TITLE: string;
15
- PRIMARY_PAGE: string;
16
- PRIMARY_URL_FROM: string;
17
- PRIMARY_URL_FROM_STATUS_CODE: string;
18
- REDIRECTED_TO_URL: string;
19
- REDIRECTED_TO_STATUS_CODE: string;
20
- REDIRECTION_CHAIN: string;
21
- SOURCE_URL: string;
22
- STATUS_CODE: string;
23
- TARGET_STATUS_CODE: string;
24
- URL: string;
25
- URL_COUNT: string;
26
- URL_TO: string;
27
- URL_TO_STATUS_CODE: string;
1
+ export declare const column: {
2
+ readonly CUSTOM_EXTRACTION_1: "customExtraction1";
3
+ readonly CUSTOM_EXTRACTION_2: "customExtraction2";
4
+ readonly DEEP_RANK: "deepRank";
5
+ readonly DESCRIPTION: "description";
6
+ readonly DUPLICATE_PAGE: "duplicatePage";
7
+ readonly DUPLICATE_DESCRIPTION_FROM: "duplicateDescriptionPrimaryUrl";
8
+ readonly DUPLICATE_TITLE_FROM: "duplicateTitlePrimaryUrl";
9
+ readonly FOUND_AT_URL: "foundAtUrl";
10
+ readonly FOUND_IN_CRAWL: "foundInWebCrawl";
11
+ readonly FOUND_IN_SEARCH_CONSOLE: "foundInGoogleSearchConsole";
12
+ readonly FOUND_IN_SITEMAP: "foundInSitemap";
13
+ readonly LEVEL: "level";
14
+ readonly PAGE_TITLE: "pageTitle";
15
+ readonly PRIMARY_PAGE: "primaryPage";
16
+ readonly PRIMARY_URL_FROM: "primaryUrlFrom";
17
+ readonly PRIMARY_URL_FROM_STATUS_CODE: "primaryUrlFromStatusCode";
18
+ readonly REDIRECTED_TO_URL: "redirectedToUrl";
19
+ readonly REDIRECTED_TO_STATUS_CODE: "redirectedToStatusCode";
20
+ readonly REDIRECTION_CHAIN: "redirectionChain";
21
+ readonly SOURCE_URL: "sourceUrl";
22
+ readonly STATUS_CODE: "httpStatusCode";
23
+ readonly TARGET_STATUS_CODE: "targetStatusCode";
24
+ readonly URL: "url";
25
+ readonly URL_COUNT: "urlCount";
26
+ readonly URL_TO: "urlTo";
27
+ readonly URL_TO_STATUS_CODE: "urlToStatusCode";
28
28
  };
29
+ export type Column = typeof column[keyof typeof column];
@@ -1,4 +1,4 @@
1
- export const columns = {
1
+ export const column = {
2
2
  CUSTOM_EXTRACTION_1: 'customExtraction1',
3
3
  CUSTOM_EXTRACTION_2: 'customExtraction2',
4
4
  DEEP_RANK: 'deepRank',
@@ -4,7 +4,7 @@ export const getData = async (query, variables, accessToken) => {
4
4
  queryClean = queryClean.replace(/\n/g, " ");
5
5
  queryClean = queryClean.replace(/\t/g, " ");
6
6
  queryClean = queryClean.replace(/ /g, " ");
7
- const apiResponse = await post("https://api.lumar.io/graphql", {
7
+ return await post("https://api.lumar.io/graphql", {
8
8
  query: queryClean,
9
9
  variables,
10
10
  }, {
@@ -12,5 +12,4 @@ export const getData = async (query, variables, accessToken) => {
12
12
  "x-auth-token": accessToken,
13
13
  },
14
14
  });
15
- return apiResponse;
16
15
  };
@@ -1,29 +1,27 @@
1
- export declare const operands: {
2
- CONTAINS: string;
3
- DOESNT_CONTAIN: string;
4
- DOESNT_MATCH_REGEX: string;
5
- ENDS_WITH: string;
6
- EQUALS: string;
7
- GREATER_THAN: string;
8
- GREATER_THAN_OR_EQUAL: string;
9
- IS_EMPTY: string;
10
- LESS_THAN: string;
11
- LESS_THAN_OR_EQUAL: string;
12
- MATCHES_REGEX: string;
13
- NOT_EQUALS: string;
14
- STARTS_WITH: string;
1
+ export declare const operand: {
2
+ readonly CONTAINS: "contains";
3
+ readonly DOESNT_CONTAIN: "notContains";
4
+ readonly DOESNT_MATCH_REGEX: "notMatchesRegex";
5
+ readonly ENDS_WITH: "endsWith";
6
+ readonly EQUALS: "eq";
7
+ readonly GREATER_THAN: "gt";
8
+ readonly GREATER_THAN_OR_EQUAL: "ge";
9
+ readonly IS_EMPTY: "isEmpty";
10
+ readonly LESS_THAN: "lt";
11
+ readonly LESS_THAN_OR_EQUAL: "le";
12
+ readonly MATCHES_REGEX: "matchesRegex";
13
+ readonly NOT_EQUALS: "ne";
14
+ readonly STARTS_WITH: "beginsWith";
15
15
  };
16
- export declare const reportTypes: {
17
- ADDED: string;
18
- BASIC: string;
19
- MISSING: string;
20
- REMOVED: string;
16
+ export type Operand = typeof operand[keyof typeof operand];
17
+ export declare const reportType: {
18
+ readonly ADDED: "Added";
19
+ readonly BASIC: "Basic";
20
+ readonly MISSING: "Missing";
21
+ readonly REMOVED: "Removed";
21
22
  };
23
+ export type ReportType = typeof reportType[keyof typeof reportType];
22
24
  /**
23
25
  * Shorthand function to return the report key.
24
26
  */
25
27
  export declare const getReportKey: (templateCode: string, typeCode: string) => string;
26
- export { columns } from "./columns";
27
- export { reportTemplates } from "./reportTemplates";
28
- export { getData } from "./getData";
29
- export { initClient } from "./initClient";
@@ -1,4 +1,4 @@
1
- export const operands = {
1
+ export const operand = {
2
2
  CONTAINS: "contains",
3
3
  DOESNT_CONTAIN: "notContains",
4
4
  DOESNT_MATCH_REGEX: "notMatchesRegex",
@@ -13,7 +13,7 @@ export const operands = {
13
13
  NOT_EQUALS: "ne",
14
14
  STARTS_WITH: "beginsWith",
15
15
  };
16
- export const reportTypes = {
16
+ export const reportType = {
17
17
  ADDED: "Added",
18
18
  BASIC: "Basic",
19
19
  MISSING: "Missing",
@@ -25,7 +25,3 @@ export const reportTypes = {
25
25
  export const getReportKey = (templateCode, typeCode) => {
26
26
  return `${templateCode}-${typeCode}`.toLowerCase();
27
27
  };
28
- export { columns } from "./columns";
29
- export { reportTemplates } from "./reportTemplates";
30
- export { getData } from "./getData";
31
- export { initClient } from "./initClient";
@@ -17,7 +17,7 @@ declare const getReportDifferences: ({ crawlId, filter, reportTemplateCode }: Ge
17
17
  input: {
18
18
  crawlId: number;
19
19
  reportTemplateCode: string;
20
- reportTypeCode: string;
20
+ reportTypeCode: "Basic";
21
21
  };
22
22
  };
23
23
  };
@@ -1,4 +1,4 @@
1
- import { reportTypes } from "../";
1
+ import { reportType } from "../";
2
2
  /**
3
3
  * Used to return the number for: Basic, Added, Missing, Removed for a given report.
4
4
  */
@@ -28,7 +28,7 @@ const getReportDifferences = ({ crawlId, filter, reportTemplateCode }) => ({
28
28
  input: {
29
29
  crawlId,
30
30
  reportTemplateCode,
31
- reportTypeCode: reportTypes.BASIC,
31
+ reportTypeCode: reportType.BASIC,
32
32
  },
33
33
  },
34
34
  });
@@ -1,67 +1,68 @@
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;
1
+ export declare const reportTemplate: {
2
+ readonly "200_PAGES": "200_pages";
3
+ readonly "301_REDIRECTS": "301_redirects";
4
+ readonly "4XX_ERRORS": "4xx_errors";
5
+ readonly "5XX_ERRORS": "5xx_errors";
6
+ readonly ALL_PAGES: "all_pages";
7
+ readonly BROKEN_EXTERNAL_LINKS: "broken_links_external";
8
+ readonly BROKEN_INTERNAL_LINKS: "all_broken_links";
9
+ readonly BROKEN_SITEMAP_PAGES: "broken_sitemap_links";
10
+ readonly CANONICAL_CONFLICTING: "conflicting_canonical_tags";
11
+ readonly CANONICAL_NON_200: "canonical_to_non_200";
12
+ readonly CANONICAL_NON_INDEXABLE: "non_indexable_canonical_links_in";
13
+ readonly CANONICAL_ORPHANED: "unlinked_canonical_pages";
14
+ readonly CUSTOM_EXTRACTION_1: "custom_extraction_1";
15
+ readonly CUSTOM_EXTRACTION_2: "custom_extraction_2";
16
+ readonly DUPLICATE_CONTENT: "duplicate_body_content";
17
+ readonly DUPLICATE_DESCRIPTIONS: "pages_with_duplicate_descriptions";
18
+ readonly DUPLICATE_TITLES: "pages_with_duplicate_titles";
19
+ readonly EMPTY_PAGES: "empty_pages";
20
+ readonly INDEXABLE_PAGES: "indexable_pages";
21
+ readonly LINKED_DOMAINS: "linked_domains";
22
+ readonly MAX_DESCRIPTIONS: "max_description_length";
23
+ readonly MAX_MOBILE_DESCRIPTIONS: "max_mobile_description_length";
24
+ readonly MAX_TITLES: "max_title_length";
25
+ readonly MISSING_DESCRIPTIONS: "missing_descriptions";
26
+ readonly MISSING_TITLES: "missing_titles";
27
+ readonly NON_301_REDIRECTS: "non_301_redirects";
28
+ readonly NON_INDEXABLE_PAGES: "non_indexable_pages";
29
+ readonly NON_INDEXABLE_SITEMAP_PAGES: "sitemaps_non_indexable_links";
30
+ readonly ORPHANED_CANONICAL: "unlinked_canonical_pages";
31
+ readonly ORPHANED_ANALYTICS_PAGES: "orphaned_organic_landing_pages";
32
+ readonly ORPHANED_SEARCH_CONSOLE_PAGES: "orphaned_google_search_console_pages";
33
+ readonly ORPHANED_SITEMAP_PAGES: "orphaned_sitemaps_pages";
34
+ readonly PAGES_WITH_HIGH_EXTERNAL_LINKS: "max_external_links";
35
+ readonly PERFORMANCE_MAX_FETCH_TIME: "max_load_time";
36
+ readonly PERFORMANCE_POOR_CLS: "poor_cls";
37
+ readonly PERFORMANCE_SLOW_DCL: "slow_dcl";
38
+ readonly PERFORMANCE_SLOW_FCP: "slow_fcp";
39
+ readonly PERFORMANCE_SLOW_LCP: "slow_lcp";
40
+ readonly PERFORMANCE_SLOW_TTFB: "slow_server_response";
41
+ readonly PERFORMANCE_SLOW_TTI: "slow_tti";
42
+ readonly PRIMARY_PAGES: "unique_pages";
43
+ readonly REDIRECTS_BROKEN: "all_broken_redirects";
44
+ readonly REDIRECTS_CHAIN: "redirect_chains";
45
+ readonly REDIRECTS_LOOP: "redirection_loop";
46
+ readonly SCHEMA_BREADCRUMB: "pages_with_breadcrumb_schema";
47
+ readonly SCHEMA_EVENT: "pages_with_event_schema";
48
+ readonly SCHEMA_FAQ: "pages_with_faqpage_schema";
49
+ readonly SCHEMA_HOW_TO: "pages_with_howto_schema";
50
+ readonly SCHEMA_NEWS_ARTICLE: "pages_with_news_article_schema";
51
+ readonly SCHEMA_PRODUCT: "pages_with_product_schema";
52
+ readonly SCHEMA_QA: "pages_with_qapage_schema";
53
+ readonly SCHEMA_RECIPE: "pages_with_recipe_schema";
54
+ readonly SCHEMA_REVIEW: "pages_with_review_schema";
55
+ readonly SCHEMA_VIDEO: "pages_with_videoobject_schema";
56
+ readonly SHORT_DESCRIPTIONS: "short_descriptions";
57
+ readonly SHORT_TITLES: "short_titles";
58
+ readonly SITEMAP_PAGES: "all_sitemaps_links";
59
+ readonly SITEMAPS_NON_INDEXABLE_PAGES: "sitemaps_non_indexable_links";
60
+ readonly SITEMAPS_ORPHANED_PAGES: "orphaned_sitemaps_pages";
61
+ readonly SITEMAPS_MISSING_PAGES: "not_in_sitemaps_primary_indexable";
62
+ readonly THIN_PAGES: "thin_pages";
63
+ readonly TRUE_UNIQUE_PAGES: "true_uniques";
64
+ readonly UNIQUE_EXTERNAL_LINKS: "unique_external_links";
65
+ readonly UNIQUE_INTERNAL_LINKS: "unique_internal_links";
66
+ readonly XML_SITEMAPS: "xml_sitemaps";
67
67
  };
68
+ export type ReportTemplate = typeof reportTemplate[keyof typeof reportTemplate];
@@ -1,4 +1,4 @@
1
- export const reportTemplates = {
1
+ export const reportTemplate = {
2
2
  "200_PAGES": "200_pages",
3
3
  "301_REDIRECTS": "301_redirects",
4
4
  "4XX_ERRORS": "4xx_errors",
@@ -1,7 +1,7 @@
1
1
  export { isSessionReady } from "./isSessionReady";
2
2
  export declare const NextAuthState: {
3
- AUTHENTICATED: string;
4
- PENDING: string;
5
- UNAUTHENTICATED: string;
3
+ readonly AUTHENTICATED: "authenticated";
4
+ readonly PENDING: "loading";
5
+ readonly UNAUTHENTICATED: "unauthenticated";
6
6
  };
7
7
  export type NextAuthState = typeof NextAuthState[keyof typeof NextAuthState];
package/nextJs/nextJs.js CHANGED
@@ -1,14 +1,8 @@
1
1
  /**
2
2
  * Get the user's remote IP Address
3
3
  */
4
- export const getIp = ({ req }) => {
5
- let response = 'unset';
6
- if (undefined !== req.headers['x-real-ip']) {
7
- response = String(req.headers['x-real-ip']);
8
- }
9
- return response;
10
- };
4
+ export const getIp = ({ req }) => String(req.headers?.["x-real-ip"] || "unset");
11
5
  /**
12
6
  * Get the user's User Agent
13
7
  */
14
- export const getUserAgent = ({ req }) => req.headers['user-agent'] || 'unset';
8
+ export const getUserAgent = ({ req }) => String(req.headers["user-agent"] || "unset");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.2",
4
+ "version": "2.3.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -1,4 +1,4 @@
1
- export { byNumberAscending } from "./byNumberAscending";
2
- export { byNumberDescending } from "./byNumberDescending";
3
- export { byStringAscending } from "./byStringAscending";
4
- export { byStringDescending } from "./byStringDescending";
1
+ export * from "./byNumberAscending";
2
+ export * from "./byNumberDescending";
3
+ export * from "./byStringAscending";
4
+ export * from "./byStringDescending";
@@ -1,4 +1,4 @@
1
- export { byNumberAscending } from "./byNumberAscending";
2
- export { byNumberDescending } from "./byNumberDescending";
3
- export { byStringAscending } from "./byStringAscending";
4
- export { byStringDescending } from "./byStringDescending";
1
+ export * from "./byNumberAscending";
2
+ export * from "./byNumberDescending";
3
+ export * from "./byStringAscending";
4
+ export * from "./byStringDescending";
@@ -1,5 +1,5 @@
1
- import { defaultTo } from './defaultTo';
2
- const undefinedValue = '__!!UNDEFINED!!__';
1
+ import { defaultTo } from "./defaultTo";
2
+ const undefinedValue = "__!!UNDEFINED!!__";
3
3
  /**
4
4
  * Check to see if a value is undefined.
5
5
  */