@8ms/helpers 2.0.33 → 2.0.34

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.
Binary file
@@ -1,4 +1,4 @@
1
- import { ApiState, ApiResponse } from "./";
1
+ import { ApiState, ApiResponse } from "./types";
2
2
  import { z } from "zod/v4";
3
3
  type ConstructorProps = {
4
4
  body?: any;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiResponseClass = void 0;
4
4
  const util_1 = require("../util");
5
- const _1 = require("./");
5
+ const types_1 = require("./types");
6
6
  /**
7
7
  * Class version of the API to enable quicker instances.
8
8
  */
9
9
  class ApiResponseClass {
10
10
  constructor({ body, error, state } = {}) {
11
- this.state = _1.ApiState.IDLE;
11
+ this.state = types_1.ApiState.IDLE;
12
12
  this.body = null;
13
13
  this.error = null;
14
14
  this.fromJson = (input) => {
@@ -37,34 +37,34 @@ class ApiResponseClass {
37
37
  return this.state;
38
38
  };
39
39
  this.isError = () => {
40
- return this.state === _1.ApiState.ERROR;
40
+ return this.state === types_1.ApiState.ERROR;
41
41
  };
42
42
  this.isIdle = () => {
43
- return this.state === _1.ApiState.IDLE;
43
+ return this.state === types_1.ApiState.IDLE;
44
44
  };
45
45
  this.isPending = () => {
46
- return this.state === _1.ApiState.PENDING;
46
+ return this.state === types_1.ApiState.PENDING;
47
47
  };
48
48
  this.isSuccess = () => {
49
- return this.state === _1.ApiState.SUCCESS;
49
+ return this.state === types_1.ApiState.SUCCESS;
50
50
  };
51
51
  this.setToIdle = () => {
52
- this.state = _1.ApiState.IDLE;
52
+ this.state = types_1.ApiState.IDLE;
53
53
  return this;
54
54
  };
55
55
  this.setToPending = () => {
56
- this.state = _1.ApiState.PENDING;
56
+ this.state = types_1.ApiState.PENDING;
57
57
  return this;
58
58
  };
59
59
  this.setToError = (error, body) => {
60
60
  this.body = body || null;
61
61
  this.error = error;
62
- this.state = _1.ApiState.ERROR;
62
+ this.state = types_1.ApiState.ERROR;
63
63
  return this;
64
64
  };
65
65
  this.setToSuccess = (body) => {
66
66
  this.body = body;
67
- this.state = _1.ApiState.SUCCESS;
67
+ this.state = types_1.ApiState.SUCCESS;
68
68
  return this;
69
69
  };
70
70
  this.setBody = (body) => {
@@ -85,12 +85,12 @@ class ApiResponseClass {
85
85
  return new ApiResponseClass({ body: validatedBody, state: this.state });
86
86
  }
87
87
  catch (error) {
88
- return new ApiResponseClass({ error, state: _1.ApiState.ERROR });
88
+ return new ApiResponseClass({ error, state: types_1.ApiState.ERROR });
89
89
  }
90
90
  };
91
91
  this.body = body || null;
92
92
  this.error = error || null;
93
- this.state = state || _1.ApiState.IDLE;
93
+ this.state = state || types_1.ApiState.IDLE;
94
94
  return this;
95
95
  }
96
96
  }
@@ -0,0 +1,7 @@
1
+ import { ApiResponse } from "./types";
2
+ export declare const isCancelled: (apiResponse: ApiResponse) => boolean;
3
+ export declare const isError: (apiResponse: ApiResponse) => boolean;
4
+ export declare const isIdle: (apiResponse: ApiResponse) => boolean;
5
+ export declare const isPending: (apiResponse: ApiResponse) => boolean;
6
+ export declare const isSuccess: (apiResponse: ApiResponse) => boolean;
7
+ export declare const isValidationError: (apiResponse: ApiResponse) => boolean;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidationError = exports.isSuccess = exports.isPending = exports.isIdle = exports.isError = exports.isCancelled = void 0;
4
+ const types_1 = require("./types");
5
+ const isCancelled = (apiResponse) => {
6
+ return types_1.ApiState.CANCELLED === apiResponse.state;
7
+ };
8
+ exports.isCancelled = isCancelled;
9
+ const isError = (apiResponse) => {
10
+ return types_1.ApiState.ERROR === apiResponse.state;
11
+ };
12
+ exports.isError = isError;
13
+ const isIdle = (apiResponse) => {
14
+ return types_1.ApiState.IDLE === apiResponse.state;
15
+ };
16
+ exports.isIdle = isIdle;
17
+ const isPending = (apiResponse) => {
18
+ return types_1.ApiState.PENDING === apiResponse.state;
19
+ };
20
+ exports.isPending = isPending;
21
+ const isSuccess = (apiResponse) => {
22
+ return types_1.ApiState.SUCCESS === apiResponse.state;
23
+ };
24
+ exports.isSuccess = isSuccess;
25
+ const isValidationError = (apiResponse) => {
26
+ return types_1.ApiState.VALIDATION_ERROR === apiResponse.state;
27
+ };
28
+ exports.isValidationError = isValidationError;
package/api/index.d.ts CHANGED
@@ -1,22 +1,3 @@
1
- export { ApiResponseClass } from "./ApiResponseClass";
2
- export declare enum ApiState {
3
- CANCELLED = "CANCELLED",
4
- ERROR = "ERROR",
5
- IDLE = "IDLE",
6
- PENDING = "PENDING",
7
- SUCCESS = "SUCCESS",
8
- VALIDATION_ERROR = "VALIDATION_ERROR"
9
- }
10
- export type ApiResponse<T = any, E = any> = {
11
- body: T | null;
12
- error: E | null;
13
- state: ApiState;
14
- };
15
- export declare const defaultResponse: ApiResponse;
16
- export declare const unexpectedError: string;
17
- export declare const isCancelled: (apiResponse: ApiResponse) => boolean;
18
- export declare const isError: (apiResponse: ApiResponse) => boolean;
19
- export declare const isIdle: (apiResponse: ApiResponse) => boolean;
20
- export declare const isPending: (apiResponse: ApiResponse) => boolean;
21
- export declare const isSuccess: (apiResponse: ApiResponse) => boolean;
22
- export declare const isValidationError: (apiResponse: ApiResponse) => boolean;
1
+ export * from "./ApiResponseClass";
2
+ export * from "./functions";
3
+ export * from "./types";
package/api/index.js CHANGED
@@ -1,44 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidationError = exports.isSuccess = exports.isPending = exports.isIdle = exports.isError = exports.isCancelled = exports.unexpectedError = exports.defaultResponse = exports.ApiState = exports.ApiResponseClass = void 0;
4
- var ApiResponseClass_1 = require("./ApiResponseClass");
5
- Object.defineProperty(exports, "ApiResponseClass", { enumerable: true, get: function () { return ApiResponseClass_1.ApiResponseClass; } });
6
- var ApiState;
7
- (function (ApiState) {
8
- ApiState["CANCELLED"] = "CANCELLED";
9
- ApiState["ERROR"] = "ERROR";
10
- ApiState["IDLE"] = "IDLE";
11
- ApiState["PENDING"] = "PENDING";
12
- ApiState["SUCCESS"] = "SUCCESS";
13
- ApiState["VALIDATION_ERROR"] = "VALIDATION_ERROR";
14
- })(ApiState || (exports.ApiState = ApiState = {}));
15
- exports.defaultResponse = {
16
- body: null,
17
- error: null,
18
- state: ApiState.IDLE,
19
- };
20
- exports.unexpectedError = "An unexpected error occurred, please try again.";
21
- const isCancelled = (apiResponse) => {
22
- return ApiState.CANCELLED === apiResponse.state;
23
- };
24
- exports.isCancelled = isCancelled;
25
- const isError = (apiResponse) => {
26
- return ApiState.ERROR === apiResponse.state;
27
- };
28
- exports.isError = isError;
29
- const isIdle = (apiResponse) => {
30
- return ApiState.IDLE === apiResponse.state;
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
15
  };
32
- exports.isIdle = isIdle;
33
- const isPending = (apiResponse) => {
34
- return ApiState.PENDING === apiResponse.state;
35
- };
36
- exports.isPending = isPending;
37
- const isSuccess = (apiResponse) => {
38
- return ApiState.SUCCESS === apiResponse.state;
39
- };
40
- exports.isSuccess = isSuccess;
41
- const isValidationError = (apiResponse) => {
42
- return ApiState.VALIDATION_ERROR === apiResponse.state;
43
- };
44
- exports.isValidationError = isValidationError;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ApiResponseClass"), exports);
18
+ __exportStar(require("./functions"), exports);
19
+ __exportStar(require("./types"), exports);
package/api/types.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ export { ApiResponseClass } from "./ApiResponseClass";
2
+ export declare const ApiState: {
3
+ readonly CANCELLED: "CANCELLED";
4
+ readonly ERROR: "ERROR";
5
+ readonly IDLE: "IDLE";
6
+ readonly PENDING: "PENDING";
7
+ readonly SUCCESS: "SUCCESS";
8
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
9
+ };
10
+ export type ApiState = typeof ApiState[keyof typeof ApiState];
11
+ export type ApiResponse<T = any, E = any> = {
12
+ body: T | null;
13
+ error: E | null;
14
+ state: ApiState;
15
+ };
16
+ export declare const defaultResponse: ApiResponse;
17
+ export declare const unexpectedError: string;
package/api/types.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unexpectedError = exports.defaultResponse = exports.ApiState = exports.ApiResponseClass = void 0;
4
+ var ApiResponseClass_1 = require("./ApiResponseClass");
5
+ Object.defineProperty(exports, "ApiResponseClass", { enumerable: true, get: function () { return ApiResponseClass_1.ApiResponseClass; } });
6
+ exports.ApiState = {
7
+ CANCELLED: "CANCELLED",
8
+ ERROR: "ERROR",
9
+ IDLE: "IDLE",
10
+ PENDING: "PENDING",
11
+ SUCCESS: "SUCCESS",
12
+ VALIDATION_ERROR: "VALIDATION_ERROR",
13
+ };
14
+ exports.defaultResponse = {
15
+ body: null,
16
+ error: null,
17
+ state: exports.ApiState.IDLE,
18
+ };
19
+ exports.unexpectedError = "An unexpected error occurred, please try again.";
@@ -1,12 +1,13 @@
1
- export declare enum BrightDataSerpApiType {
2
- GOOGLE_FLIGHTS = "GOOGLE_FLIGHTS",
3
- GOOGLE_HOTELS = "GOOGLE_HOTELS",
4
- GOOGLE_LENS = "GOOGLE_LENS",
5
- GOOGLE_MAPS = "GOOGLE_MAPS",
6
- GOOGLE_REVIEWS = "GOOGLE_REVIEWS",
7
- GOOGLE_SEARCH = "GOOGLE_SEARCH",
8
- GOOGLE_TRENDS = "GOOGLE_TRENDS"
9
- }
1
+ export declare const BrightDataSerpApiType: {
2
+ readonly GOOGLE_FLIGHTS: "GOOGLE_FLIGHTS";
3
+ readonly GOOGLE_HOTELS: "GOOGLE_HOTELS";
4
+ readonly GOOGLE_LENS: "GOOGLE_LENS";
5
+ readonly GOOGLE_MAPS: "GOOGLE_MAPS";
6
+ readonly GOOGLE_REVIEWS: "GOOGLE_REVIEWS";
7
+ readonly GOOGLE_SEARCH: "GOOGLE_SEARCH";
8
+ readonly GOOGLE_TRENDS: "GOOGLE_TRENDS";
9
+ };
10
+ export type BrightDataSerpApiType = typeof BrightDataSerpApiType[keyof typeof BrightDataSerpApiType];
10
11
  export { buildGoogleSerpUrl } from "./buildGoogleSerpUrl";
11
12
  export { buildGoogleTrendsUrl } from "./buildGoogleTrendsUrl";
12
13
  export { getAsyncRequestId } from "./getAsyncRequestId";
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRealtime = exports.getAsyncResults = exports.getAsyncRequestId = exports.buildGoogleTrendsUrl = exports.buildGoogleSerpUrl = exports.BrightDataSerpApiType = void 0;
4
- var BrightDataSerpApiType;
5
- (function (BrightDataSerpApiType) {
6
- BrightDataSerpApiType["GOOGLE_FLIGHTS"] = "GOOGLE_FLIGHTS";
7
- BrightDataSerpApiType["GOOGLE_HOTELS"] = "GOOGLE_HOTELS";
8
- BrightDataSerpApiType["GOOGLE_LENS"] = "GOOGLE_LENS";
9
- BrightDataSerpApiType["GOOGLE_MAPS"] = "GOOGLE_MAPS";
10
- BrightDataSerpApiType["GOOGLE_REVIEWS"] = "GOOGLE_REVIEWS";
11
- BrightDataSerpApiType["GOOGLE_SEARCH"] = "GOOGLE_SEARCH";
12
- BrightDataSerpApiType["GOOGLE_TRENDS"] = "GOOGLE_TRENDS";
13
- })(BrightDataSerpApiType || (exports.BrightDataSerpApiType = BrightDataSerpApiType = {}));
4
+ exports.BrightDataSerpApiType = {
5
+ GOOGLE_FLIGHTS: "GOOGLE_FLIGHTS",
6
+ GOOGLE_HOTELS: "GOOGLE_HOTELS",
7
+ GOOGLE_LENS: "GOOGLE_LENS",
8
+ GOOGLE_MAPS: "GOOGLE_MAPS",
9
+ GOOGLE_REVIEWS: "GOOGLE_REVIEWS",
10
+ GOOGLE_SEARCH: "GOOGLE_SEARCH",
11
+ GOOGLE_TRENDS: "GOOGLE_TRENDS",
12
+ };
14
13
  var buildGoogleSerpUrl_1 = require("./buildGoogleSerpUrl");
15
14
  Object.defineProperty(exports, "buildGoogleSerpUrl", { enumerable: true, get: function () { return buildGoogleSerpUrl_1.buildGoogleSerpUrl; } });
16
15
  var buildGoogleTrendsUrl_1 = require("./buildGoogleTrendsUrl");
package/crud/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export declare enum CrudState {
2
- CREATE = "CREATE",
3
- READ = "READ",
4
- UPDATE = "UPDATE",
5
- DELETE = "DELETE"
6
- }
1
+ export declare const CrudState: {
2
+ readonly CREATE: "CREATE";
3
+ readonly READ: "READ";
4
+ readonly UPDATE: "UPDATE";
5
+ readonly DELETE: "DELETE";
6
+ };
7
+ export type CrudState = typeof CrudState[keyof typeof CrudState];
package/crud/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CrudState = void 0;
4
- var CrudState;
5
- (function (CrudState) {
6
- CrudState["CREATE"] = "CREATE";
7
- CrudState["READ"] = "READ";
8
- CrudState["UPDATE"] = "UPDATE";
9
- CrudState["DELETE"] = "DELETE";
10
- })(CrudState || (exports.CrudState = CrudState = {}));
4
+ exports.CrudState = {
5
+ CREATE: "CREATE",
6
+ READ: "READ",
7
+ UPDATE: "UPDATE",
8
+ DELETE: "DELETE",
9
+ };
package/date/type.d.ts CHANGED
@@ -19,17 +19,18 @@ export declare const defaultDateTime: "1901-01-01 00:00:00";
19
19
  /**
20
20
  * Used by Google Ads API.
21
21
  */
22
- export declare enum Month {
23
- JANUARY = "JANUARY",
24
- FEBRUARY = "FEBRUARY",
25
- MARCH = "MARCH",
26
- APRIL = "APRIL",
27
- MAY = "MAY",
28
- JUNE = "JUNE",
29
- JULY = "JULY",
30
- AUGUST = "AUGUST",
31
- SEPTEMBER = "SEPTEMBER",
32
- OCTOBER = "OCTOBER",
33
- NOVEMBER = "NOVEMBER",
34
- DECEMBER = "DECEMBER"
35
- }
22
+ export declare const Month: {
23
+ readonly JANUARY: "JANUARY";
24
+ readonly FEBRUARY: "FEBRUARY";
25
+ readonly MARCH: "MARCH";
26
+ readonly APRIL: "APRIL";
27
+ readonly MAY: "MAY";
28
+ readonly JUNE: "JUNE";
29
+ readonly JULY: "JULY";
30
+ readonly AUGUST: "AUGUST";
31
+ readonly SEPTEMBER: "SEPTEMBER";
32
+ readonly OCTOBER: "OCTOBER";
33
+ readonly NOVEMBER: "NOVEMBER";
34
+ readonly DECEMBER: "DECEMBER";
35
+ };
36
+ export type Month = typeof Month[keyof typeof Month];
package/date/type.js CHANGED
@@ -7,18 +7,17 @@ exports.defaultDateTime = "1901-01-01 00:00:00";
7
7
  /**
8
8
  * Used by Google Ads API.
9
9
  */
10
- var Month;
11
- (function (Month) {
12
- Month["JANUARY"] = "JANUARY";
13
- Month["FEBRUARY"] = "FEBRUARY";
14
- Month["MARCH"] = "MARCH";
15
- Month["APRIL"] = "APRIL";
16
- Month["MAY"] = "MAY";
17
- Month["JUNE"] = "JUNE";
18
- Month["JULY"] = "JULY";
19
- Month["AUGUST"] = "AUGUST";
20
- Month["SEPTEMBER"] = "SEPTEMBER";
21
- Month["OCTOBER"] = "OCTOBER";
22
- Month["NOVEMBER"] = "NOVEMBER";
23
- Month["DECEMBER"] = "DECEMBER";
24
- })(Month || (exports.Month = Month = {}));
10
+ exports.Month = {
11
+ JANUARY: "JANUARY",
12
+ FEBRUARY: "FEBRUARY",
13
+ MARCH: "MARCH",
14
+ APRIL: "APRIL",
15
+ MAY: "MAY",
16
+ JUNE: "JUNE",
17
+ JULY: "JULY",
18
+ AUGUST: "AUGUST",
19
+ SEPTEMBER: "SEPTEMBER",
20
+ OCTOBER: "OCTOBER",
21
+ NOVEMBER: "NOVEMBER",
22
+ DECEMBER: "DECEMBER",
23
+ };
@@ -1,12 +1,14 @@
1
- export declare enum Environment {
2
- DEVELOPMENT = "development",
3
- STAGING = "staging",
4
- PRODUCTION = "production"
5
- }
6
- export declare enum Platform {
7
- AWS = "AWS",
8
- VERCEL = "VERCEL"
9
- }
1
+ export declare const Environment: {
2
+ readonly DEVELOPMENT: "development";
3
+ readonly STAGING: "staging";
4
+ readonly PRODUCTION: "production";
5
+ };
6
+ export type Environment = typeof Environment[keyof typeof Environment];
7
+ export declare const Platform: {
8
+ readonly AWS: "AWS";
9
+ readonly VERCEL: "VERCEL";
10
+ };
11
+ export type Platform = typeof Platform[keyof typeof Platform];
10
12
  /**
11
13
  * Determine the environment we're using.
12
14
  */
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isLocalhost = exports.isProduction = exports.isStaging = exports.isDevelopment = exports.isServer = exports.isVercel = exports.isAws = exports.getEnvironment = exports.Platform = exports.Environment = void 0;
4
- var Environment;
5
- (function (Environment) {
6
- Environment["DEVELOPMENT"] = "development";
7
- Environment["STAGING"] = "staging";
8
- Environment["PRODUCTION"] = "production";
9
- })(Environment || (exports.Environment = Environment = {}));
10
- var Platform;
11
- (function (Platform) {
12
- Platform["AWS"] = "AWS";
13
- Platform["VERCEL"] = "VERCEL";
14
- })(Platform || (exports.Platform = Platform = {}));
4
+ exports.Environment = {
5
+ DEVELOPMENT: "development",
6
+ STAGING: "staging",
7
+ PRODUCTION: "production",
8
+ };
9
+ exports.Platform = {
10
+ AWS: "AWS",
11
+ VERCEL: "VERCEL",
12
+ };
15
13
  /**
16
14
  * Determine the environment we're using.
17
15
  */
@@ -38,16 +36,16 @@ const getEnvironment = () => {
38
36
  .toLowerCase()
39
37
  .trim();
40
38
  switch (platformEnvironmentClean) {
41
- case 'production':
42
- response = Environment.PRODUCTION;
39
+ case "production":
40
+ response = exports.Environment.PRODUCTION;
43
41
  break;
44
- case 'demo':
45
- case 'preview':
46
- case 'staging':
47
- response = Environment.STAGING;
42
+ case "demo":
43
+ case "preview":
44
+ case "staging":
45
+ response = exports.Environment.STAGING;
48
46
  break;
49
47
  default:
50
- response = Environment.DEVELOPMENT;
48
+ response = exports.Environment.DEVELOPMENT;
51
49
  }
52
50
  return response;
53
51
  };
@@ -55,22 +53,22 @@ exports.getEnvironment = getEnvironment;
55
53
  /**
56
54
  * Check to see if we are working on AWS Lambda.
57
55
  */
58
- const isAws = () => Platform.AWS === process.env["EMS_PLATFORM"];
56
+ const isAws = () => exports.Platform.AWS === process.env["EMS_PLATFORM"];
59
57
  exports.isAws = isAws;
60
58
  const isVercel = () => undefined !== process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
61
59
  exports.isVercel = isVercel;
62
60
  /**
63
61
  * Some code should only run on the server side to protect the data.
64
62
  */
65
- exports.isServer = typeof window === 'undefined';
63
+ exports.isServer = typeof window === "undefined";
66
64
  /**
67
65
  * Check the environment currently running.
68
66
  */
69
- const isDevelopment = () => Environment.DEVELOPMENT === (0, exports.getEnvironment)();
67
+ const isDevelopment = () => exports.Environment.DEVELOPMENT === (0, exports.getEnvironment)();
70
68
  exports.isDevelopment = isDevelopment;
71
- const isStaging = () => Environment.STAGING === (0, exports.getEnvironment)();
69
+ const isStaging = () => exports.Environment.STAGING === (0, exports.getEnvironment)();
72
70
  exports.isStaging = isStaging;
73
- const isProduction = () => Environment.PRODUCTION === (0, exports.getEnvironment)();
71
+ const isProduction = () => exports.Environment.PRODUCTION === (0, exports.getEnvironment)();
74
72
  exports.isProduction = isProduction;
75
73
  /**
76
74
  * Check to see if we are developing locally or on the hosted platform.
@@ -1,8 +1,9 @@
1
1
  import { z } from "zod/v4";
2
- export declare enum Network {
3
- GOOGLE_SEARCH_ONLY = 2,
4
- GOOGLE_SEARCH_AND_PARTNERS = 3
5
- }
2
+ export declare const Network: {
3
+ readonly GOOGLE_SEARCH_ONLY: 2;
4
+ readonly GOOGLE_SEARCH_AND_PARTNERS: 3;
5
+ };
6
+ export type Network = typeof Network[keyof typeof Network];
6
7
  export declare const requestSchema: z.ZodObject<{
7
8
  countries: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
8
9
  customerId: z.ZodOptional<z.ZodString>;
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.responseSchema = exports.defaultRequest = exports.requestSchema = exports.Network = void 0;
4
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 = {}));
5
+ exports.Network = {
6
+ GOOGLE_SEARCH_ONLY: 2,
7
+ GOOGLE_SEARCH_AND_PARTNERS: 3,
8
+ };
10
9
  exports.requestSchema = v4_1.z.object({
11
10
  countries: v4_1.z.array(v4_1.z.number())
12
11
  .optional(),
@@ -35,7 +34,7 @@ exports.defaultRequest = {
35
34
  customerId: "",
36
35
  historicalMetricsOptions: null,
37
36
  includeAdultKeywords: false,
38
- keywordPlanNetwork: Network.GOOGLE_SEARCH_ONLY,
37
+ keywordPlanNetwork: exports.Network.GOOGLE_SEARCH_ONLY,
39
38
  queries: [],
40
39
  language: null,
41
40
  };
@@ -3,15 +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 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
- }
6
+ export declare const Category: {
7
+ readonly CATEGORY_UNSPECIFIED: "CATEGORY_UNSPECIFIED";
8
+ readonly ACCESSIBILITY: "ACCESSIBILITY";
9
+ readonly BEST_PRACTICES: "BEST_PRACTICES";
10
+ readonly PERFORMANCE: "PERFORMANCE";
11
+ readonly SEO: "SEO";
12
+ };
13
+ export type Category = typeof Category[keyof typeof Category];
14
+ export declare const Strategy: {
15
+ readonly STRATEGY_UNSPECIFIED: "STRATEGY_UNSPECIFIED";
16
+ readonly DESKTOP: "DESKTOP";
17
+ readonly MOBILE: "MOBILE";
18
+ };
19
+ export type Strategy = typeof Strategy[keyof typeof Strategy];
@@ -28,17 +28,15 @@ const googlePageSpeedClient = async (key = "default", config, vaultId, itemId) =
28
28
  return namespace;
29
29
  };
30
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 = {}));
31
+ exports.Category = {
32
+ CATEGORY_UNSPECIFIED: "CATEGORY_UNSPECIFIED",
33
+ ACCESSIBILITY: "ACCESSIBILITY",
34
+ BEST_PRACTICES: "BEST_PRACTICES",
35
+ PERFORMANCE: "PERFORMANCE",
36
+ SEO: "SEO",
37
+ };
38
+ exports.Strategy = {
39
+ STRATEGY_UNSPECIFIED: "STRATEGY_UNSPECIFIED",
40
+ DESKTOP: "DESKTOP",
41
+ MOBILE: "MOBILE",
42
+ };
@@ -1,6 +1,7 @@
1
- export declare enum InngestState {
2
- RUNNING = "Running",
3
- COMPLETED = "Completed",
4
- FAILED = "Failed",
5
- CANCELLED = "Cancelled"
6
- }
1
+ export declare const InngestState: {
2
+ RUNNING: string;
3
+ COMPLETED: string;
4
+ FAILED: string;
5
+ CANCELLED: string;
6
+ };
7
+ export type InngestState = typeof InngestState[keyof typeof InngestState];
package/inngest/server.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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 = {}));
4
+ exports.InngestState = {
5
+ RUNNING: "Running",
6
+ COMPLETED: "Completed",
7
+ FAILED: "Failed",
8
+ CANCELLED: "Cancelled",
9
+ };
@@ -3,11 +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 enum LittleWardenState {
7
- ALL_GOOD = "all_good",
8
- DANGER = "danger",
9
- WARNING = "warning"
10
- }
6
+ export declare const LittleWardenState: {
7
+ readonly ALL_GOOD: "all_good";
8
+ readonly DANGER: "danger";
9
+ readonly WARNING: "warning";
10
+ };
11
+ export type LittleWardenState = typeof LittleWardenState[keyof typeof LittleWardenState];
11
12
  /**
12
13
  * Check if the field is All Good.
13
14
  */
@@ -28,12 +28,11 @@ const littleWardenClient = async (key = "default", config, vaultId, itemId) => {
28
28
  return namespace;
29
29
  };
30
30
  exports.littleWardenClient = littleWardenClient;
31
- var LittleWardenState;
32
- (function (LittleWardenState) {
33
- LittleWardenState["ALL_GOOD"] = "all_good";
34
- LittleWardenState["DANGER"] = "danger";
35
- LittleWardenState["WARNING"] = "warning";
36
- })(LittleWardenState || (exports.LittleWardenState = LittleWardenState = {}));
31
+ exports.LittleWardenState = {
32
+ ALL_GOOD: "all_good",
33
+ DANGER: "danger",
34
+ WARNING: "warning",
35
+ };
37
36
  /**
38
37
  * Check if the field is All Good.
39
38
  */
@@ -41,7 +40,7 @@ const isAllGood = ({ field }) => {
41
40
  let response = false;
42
41
  // Check that the status field exists
43
42
  if (undefined !== field && undefined !== field["status"]) {
44
- response = LittleWardenState.ALL_GOOD === field["status"];
43
+ response = exports.LittleWardenState.ALL_GOOD === field["status"];
45
44
  }
46
45
  return response;
47
46
  };
@@ -53,7 +52,7 @@ const isWarning = ({ field }) => {
53
52
  let response = false;
54
53
  // Check that the status field exists
55
54
  if (undefined !== field && undefined !== field["status"]) {
56
- response = LittleWardenState.WARNING === field["status"];
55
+ response = exports.LittleWardenState.WARNING === field["status"];
57
56
  }
58
57
  return response;
59
58
  };
@@ -65,7 +64,7 @@ const isDanger = ({ field }) => {
65
64
  let response = false;
66
65
  // Check that the status field exists
67
66
  if (undefined !== field && undefined !== field["status"]) {
68
- response = LittleWardenState.DANGER === field["status"];
67
+ response = exports.LittleWardenState.DANGER === field["status"];
69
68
  }
70
69
  return response;
71
70
  };
@@ -1,6 +1,7 @@
1
1
  export { isSessionReady } from "./isSessionReady";
2
- export declare enum NextAuthState {
3
- AUTHENTICATED = "authenticated",
4
- PENDING = "loading",// Defined by NextAuth
5
- UNAUTHENTICATED = "unauthenticated"
6
- }
2
+ export declare const NextAuthState: {
3
+ AUTHENTICATED: string;
4
+ PENDING: string;
5
+ UNAUTHENTICATED: string;
6
+ };
7
+ export type NextAuthState = typeof NextAuthState[keyof typeof NextAuthState];
package/nextAuth/index.js CHANGED
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NextAuthState = exports.isSessionReady = void 0;
4
4
  var isSessionReady_1 = require("./isSessionReady");
5
5
  Object.defineProperty(exports, "isSessionReady", { enumerable: true, get: function () { return isSessionReady_1.isSessionReady; } });
6
- var NextAuthState;
7
- (function (NextAuthState) {
8
- NextAuthState["AUTHENTICATED"] = "authenticated";
9
- NextAuthState["PENDING"] = "loading";
10
- NextAuthState["UNAUTHENTICATED"] = "unauthenticated";
11
- })(NextAuthState || (exports.NextAuthState = NextAuthState = {}));
6
+ exports.NextAuthState = {
7
+ AUTHENTICATED: "authenticated",
8
+ PENDING: "loading", // Defined by NextAuth
9
+ UNAUTHENTICATED: "unauthenticated",
10
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.0.33",
4
+ "version": "2.0.34",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -1,5 +1,6 @@
1
- export declare enum WebWorkerSta {
2
- ERROR = "ERROR",
3
- SUCCESS = "SUCCESS",
4
- PROGRESS = "PROGRESS"
5
- }
1
+ export declare const WebWorkerState: {
2
+ ERROR: string;
3
+ SUCCESS: string;
4
+ PROGRESS: string;
5
+ };
6
+ export type WebWorkerState = typeof WebWorkerState[keyof typeof WebWorkerState];
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebWorkerSta = void 0;
4
- var WebWorkerSta;
5
- (function (WebWorkerSta) {
6
- WebWorkerSta["ERROR"] = "ERROR";
7
- WebWorkerSta["SUCCESS"] = "SUCCESS";
8
- WebWorkerSta["PROGRESS"] = "PROGRESS";
9
- })(WebWorkerSta || (exports.WebWorkerSta = WebWorkerSta = {}));
3
+ exports.WebWorkerState = void 0;
4
+ exports.WebWorkerState = {
5
+ ERROR: "ERROR",
6
+ SUCCESS: "SUCCESS",
7
+ PROGRESS: "PROGRESS",
8
+ };