@8ms/helpers 2.4.10 → 2.4.11

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 (55) hide show
  1. package/dist/_class/BaseClass.cjs +31 -21
  2. package/dist/_class/BaseClass.mjs +31 -21
  3. package/dist/_class/BaseNamespace.cjs +10 -9
  4. package/dist/_class/BaseNamespace.mjs +10 -9
  5. package/dist/api/ApiResponseClass.cjs +96 -96
  6. package/dist/api/ApiResponseClass.mjs +96 -96
  7. package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.cjs +70 -60
  8. package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.mjs +70 -60
  9. package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.cjs +30 -28
  10. package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.mjs +30 -28
  11. package/dist/aws/ec2/server/AwsEc2Namespace.cjs +29 -32
  12. package/dist/aws/ec2/server/AwsEc2Namespace.mjs +29 -32
  13. package/dist/aws/ecs/server/AwsEcsNamespace.cjs +92 -78
  14. package/dist/aws/ecs/server/AwsEcsNamespace.mjs +92 -78
  15. package/dist/aws/glue/server/AwsGlueNamespace.cjs +17 -17
  16. package/dist/aws/glue/server/AwsGlueNamespace.mjs +17 -17
  17. package/dist/aws/lambda/server/AwsLambdaNamespace.cjs +33 -31
  18. package/dist/aws/lambda/server/AwsLambdaNamespace.mjs +33 -31
  19. package/dist/aws/s3/server/AwsS3Namespace.cjs +280 -265
  20. package/dist/aws/s3/server/AwsS3Namespace.mjs +280 -265
  21. package/dist/aws/ses/server/AwsSesNamespace.cjs +27 -30
  22. package/dist/aws/ses/server/AwsSesNamespace.mjs +27 -30
  23. package/dist/aws/ses/server/SimpleEmail.cjs +202 -199
  24. package/dist/aws/ses/server/SimpleEmail.mjs +202 -199
  25. package/dist/aws/sqs/server/AwsSqsNamespace.cjs +35 -38
  26. package/dist/aws/sqs/server/AwsSqsNamespace.mjs +35 -38
  27. package/dist/aws/ssm/server/AwsSsmNamespace.cjs +24 -23
  28. package/dist/aws/ssm/server/AwsSsmNamespace.mjs +24 -23
  29. package/dist/date/index.cjs +1 -1
  30. package/dist/date/index.mjs +1 -1
  31. package/dist/drizzle/server/DrizzleNamespace.cjs +39 -42
  32. package/dist/drizzle/server/DrizzleNamespace.mjs +39 -42
  33. package/dist/googleAds/server/GoogleAdsNamespace.cjs +21 -24
  34. package/dist/googleAds/server/GoogleAdsNamespace.mjs +21 -24
  35. package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.cjs +86 -70
  36. package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.mjs +86 -70
  37. package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.cjs +22 -25
  38. package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.mjs +22 -25
  39. package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.cjs +44 -38
  40. package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.mjs +44 -38
  41. package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.cjs +12 -15
  42. package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.mjs +12 -15
  43. package/dist/littleWarden/server/LittleWardenNamespace.cjs +12 -15
  44. package/dist/littleWarden/server/LittleWardenNamespace.mjs +12 -15
  45. package/dist/onePassword/server/OnePasswordNamespace.cjs +30 -33
  46. package/dist/onePassword/server/OnePasswordNamespace.mjs +30 -33
  47. package/dist/openAi/server/OpenAiNamespace.cjs +20 -20
  48. package/dist/openAi/server/OpenAiNamespace.mjs +20 -20
  49. package/dist/prisma/server/PrismaNamespace.cjs +35 -38
  50. package/dist/prisma/server/PrismaNamespace.mjs +35 -38
  51. package/dist/snapchat/server/SnapchatNamespace.cjs +12 -12
  52. package/dist/snapchat/server/SnapchatNamespace.mjs +12 -12
  53. package/dist/upTimeRobot/server/UpTimeRobotNamespace.cjs +19 -19
  54. package/dist/upTimeRobot/server/UpTimeRobotNamespace.mjs +19 -19
  55. package/package.json +1 -1
@@ -2,39 +2,36 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require__class_BaseNamespace = require("../../_class/BaseNamespace.cjs");
3
3
  //#region src/onePassword/server/OnePasswordNamespace.ts
4
4
  var OnePasswordNamespace = class extends require__class_BaseNamespace.BaseNamespace {
5
- constructor(..._args) {
6
- super(..._args);
7
- this.ensureInit = async () => {
8
- if (!this.client) try {
9
- const { createClient } = await import("@1password/sdk");
10
- this.client = await createClient({
11
- auth: this.config.serviceAccountToken,
12
- integrationName: this.config.integrationName || "8MS Helper TS",
13
- integrationVersion: this.config.integrationVersion || "v1.0.0"
14
- });
15
- } catch (e) {
16
- throw new Error("1Password SDK not installed");
17
- }
18
- };
19
- this.listVaults = async () => {
20
- await this.ensureInit();
21
- return this.client.vaults.list();
22
- };
23
- this.getItem = async (vaultId, itemId) => {
24
- await this.ensureInit();
25
- return this.client.items.get(vaultId, itemId);
26
- };
27
- this.getJsonNote = async (vaultId, itemId) => {
28
- let response = null;
29
- const item = await this.getItem(vaultId, itemId);
30
- if (item && "undefined" !== typeof item.notes) response = JSON.parse(item.notes);
31
- return response;
32
- };
33
- this.listItems = async (vaultId) => {
34
- await this.ensureInit();
35
- return this.client.items.list(vaultId);
36
- };
37
- }
5
+ ensureInit = async () => {
6
+ if (!this.client) try {
7
+ const { createClient } = await import("@1password/sdk");
8
+ this.client = await createClient({
9
+ auth: this.config.serviceAccountToken,
10
+ integrationName: this.config.integrationName || "8MS Helper TS",
11
+ integrationVersion: this.config.integrationVersion || "v1.0.0"
12
+ });
13
+ } catch (e) {
14
+ throw new Error("1Password SDK not installed");
15
+ }
16
+ };
17
+ listVaults = async () => {
18
+ await this.ensureInit();
19
+ return this.client.vaults.list();
20
+ };
21
+ getItem = async (vaultId, itemId) => {
22
+ await this.ensureInit();
23
+ return this.client.items.get(vaultId, itemId);
24
+ };
25
+ getJsonNote = async (vaultId, itemId) => {
26
+ let response = null;
27
+ const item = await this.getItem(vaultId, itemId);
28
+ if (item && "undefined" !== typeof item.notes) response = JSON.parse(item.notes);
29
+ return response;
30
+ };
31
+ listItems = async (vaultId) => {
32
+ await this.ensureInit();
33
+ return this.client.items.list(vaultId);
34
+ };
38
35
  };
39
36
  //#endregion
40
37
  exports.OnePasswordNamespace = OnePasswordNamespace;
@@ -1,39 +1,36 @@
1
1
  import { BaseNamespace } from "../../_class/BaseNamespace.mjs";
2
2
  //#region src/onePassword/server/OnePasswordNamespace.ts
3
3
  var OnePasswordNamespace = class extends BaseNamespace {
4
- constructor(..._args) {
5
- super(..._args);
6
- this.ensureInit = async () => {
7
- if (!this.client) try {
8
- const { createClient } = await import("@1password/sdk");
9
- this.client = await createClient({
10
- auth: this.config.serviceAccountToken,
11
- integrationName: this.config.integrationName || "8MS Helper TS",
12
- integrationVersion: this.config.integrationVersion || "v1.0.0"
13
- });
14
- } catch (e) {
15
- throw new Error("1Password SDK not installed");
16
- }
17
- };
18
- this.listVaults = async () => {
19
- await this.ensureInit();
20
- return this.client.vaults.list();
21
- };
22
- this.getItem = async (vaultId, itemId) => {
23
- await this.ensureInit();
24
- return this.client.items.get(vaultId, itemId);
25
- };
26
- this.getJsonNote = async (vaultId, itemId) => {
27
- let response = null;
28
- const item = await this.getItem(vaultId, itemId);
29
- if (item && "undefined" !== typeof item.notes) response = JSON.parse(item.notes);
30
- return response;
31
- };
32
- this.listItems = async (vaultId) => {
33
- await this.ensureInit();
34
- return this.client.items.list(vaultId);
35
- };
36
- }
4
+ ensureInit = async () => {
5
+ if (!this.client) try {
6
+ const { createClient } = await import("@1password/sdk");
7
+ this.client = await createClient({
8
+ auth: this.config.serviceAccountToken,
9
+ integrationName: this.config.integrationName || "8MS Helper TS",
10
+ integrationVersion: this.config.integrationVersion || "v1.0.0"
11
+ });
12
+ } catch (e) {
13
+ throw new Error("1Password SDK not installed");
14
+ }
15
+ };
16
+ listVaults = async () => {
17
+ await this.ensureInit();
18
+ return this.client.vaults.list();
19
+ };
20
+ getItem = async (vaultId, itemId) => {
21
+ await this.ensureInit();
22
+ return this.client.items.get(vaultId, itemId);
23
+ };
24
+ getJsonNote = async (vaultId, itemId) => {
25
+ let response = null;
26
+ const item = await this.getItem(vaultId, itemId);
27
+ if (item && "undefined" !== typeof item.notes) response = JSON.parse(item.notes);
28
+ return response;
29
+ };
30
+ listItems = async (vaultId) => {
31
+ await this.ensureInit();
32
+ return this.client.items.list(vaultId);
33
+ };
37
34
  };
38
35
  //#endregion
39
36
  export { OnePasswordNamespace };
@@ -3,26 +3,26 @@ const require__class_BaseNamespace = require("../../_class/BaseNamespace.cjs");
3
3
  const require_api_post = require("../../api/post.cjs");
4
4
  //#region src/openAi/server/OpenAiNamespace.ts
5
5
  var OpenAiNamespace = class extends require__class_BaseNamespace.BaseNamespace {
6
- constructor(..._args) {
7
- super(..._args);
8
- this.ensureInit = async () => {
9
- if (!this.client) this.client = true;
10
- };
11
- this.completion = async (prompt, temperature = 1, maxTokens = null, model = "gpt-3.5-turbo") => {
12
- let response = null;
13
- const apiResponse = await require_api_post.post(`https://api.openai.com/v1/chat/completions`, {
14
- max_tokens: maxTokens,
15
- model,
16
- messages: [{
17
- role: "user",
18
- content: prompt
19
- }],
20
- temperature: 1
21
- }, { headers: { Authorization: `Bearer ${this.config.apiKey}` } });
22
- if (apiResponse.isSuccess()) response = apiResponse.getBody();
23
- return response;
24
- };
25
- }
6
+ /**
7
+ * Renew the access token as it expires every 3 hours.
8
+ */
9
+ ensureInit = async () => {
10
+ if (!this.client) this.client = true;
11
+ };
12
+ completion = async (prompt, temperature = 1, maxTokens = null, model = "gpt-3.5-turbo") => {
13
+ let response = null;
14
+ const apiResponse = await require_api_post.post(`https://api.openai.com/v1/chat/completions`, {
15
+ max_tokens: maxTokens,
16
+ model,
17
+ messages: [{
18
+ role: "user",
19
+ content: prompt
20
+ }],
21
+ temperature: 1
22
+ }, { headers: { Authorization: `Bearer ${this.config.apiKey}` } });
23
+ if (apiResponse.isSuccess()) response = apiResponse.getBody();
24
+ return response;
25
+ };
26
26
  };
27
27
  //#endregion
28
28
  exports.OpenAiNamespace = OpenAiNamespace;
@@ -2,26 +2,26 @@ import { BaseNamespace } from "../../_class/BaseNamespace.mjs";
2
2
  import { post } from "../../api/post.mjs";
3
3
  //#region src/openAi/server/OpenAiNamespace.ts
4
4
  var OpenAiNamespace = class extends BaseNamespace {
5
- constructor(..._args) {
6
- super(..._args);
7
- this.ensureInit = async () => {
8
- if (!this.client) this.client = true;
9
- };
10
- this.completion = async (prompt, temperature = 1, maxTokens = null, model = "gpt-3.5-turbo") => {
11
- let response = null;
12
- const apiResponse = await post(`https://api.openai.com/v1/chat/completions`, {
13
- max_tokens: maxTokens,
14
- model,
15
- messages: [{
16
- role: "user",
17
- content: prompt
18
- }],
19
- temperature: 1
20
- }, { headers: { Authorization: `Bearer ${this.config.apiKey}` } });
21
- if (apiResponse.isSuccess()) response = apiResponse.getBody();
22
- return response;
23
- };
24
- }
5
+ /**
6
+ * Renew the access token as it expires every 3 hours.
7
+ */
8
+ ensureInit = async () => {
9
+ if (!this.client) this.client = true;
10
+ };
11
+ completion = async (prompt, temperature = 1, maxTokens = null, model = "gpt-3.5-turbo") => {
12
+ let response = null;
13
+ const apiResponse = await post(`https://api.openai.com/v1/chat/completions`, {
14
+ max_tokens: maxTokens,
15
+ model,
16
+ messages: [{
17
+ role: "user",
18
+ content: prompt
19
+ }],
20
+ temperature: 1
21
+ }, { headers: { Authorization: `Bearer ${this.config.apiKey}` } });
22
+ if (apiResponse.isSuccess()) response = apiResponse.getBody();
23
+ return response;
24
+ };
25
25
  };
26
26
  //#endregion
27
27
  export { OpenAiNamespace };
@@ -3,45 +3,42 @@ const require_util_getError = require("../../util/getError.cjs");
3
3
  const require__class_BaseNamespace = require("../../_class/BaseNamespace.cjs");
4
4
  //#region src/prisma/server/PrismaNamespace.ts
5
5
  var PrismaNamespace = class extends require__class_BaseNamespace.BaseNamespace {
6
- constructor(..._args) {
7
- super(..._args);
8
- this.ensureInit = async () => {
9
- if (!this.client) {
10
- let adapter = null;
11
- if (this.config.isPlanetScale) try {
12
- const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
13
- adapter = new PrismaPlanetScale({ url: this.config.url });
14
- } catch (e) {
15
- throw new Error(`PlanetScale adapter not installed - ${require_util_getError.getError(e)}`);
16
- }
17
- if (this.config.isMysql) try {
18
- const { PrismaMariaDb } = await import("@prisma/adapter-mariadb");
19
- adapter = new PrismaMariaDb(this.config.url);
20
- } catch (e) {
21
- throw new Error(`MariaDB adapter not installed - ${require_util_getError.getError(e)}`);
22
- }
23
- if (this.config.isPostgres) try {
24
- const { PrismaPg } = await import("@prisma/adapter-pg");
25
- adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
26
- } catch (e) {
27
- throw new Error(`Postgres adapter not installed - ${require_util_getError.getError(e)}`);
28
- }
29
- try {
30
- const { PrismaClient } = await import("@prisma/client");
31
- if (this.config.isDebug) this.client = new PrismaClient({
32
- adapter,
33
- log: [{
34
- emit: "event",
35
- level: "query"
36
- }]
37
- });
38
- else this.client = new PrismaClient({ adapter });
39
- } catch (e) {
40
- throw new Error(`Prisma Client not installed - ${require_util_getError.getError(e)}`);
41
- }
6
+ ensureInit = async () => {
7
+ if (!this.client) {
8
+ let adapter = null;
9
+ if (this.config.isPlanetScale) try {
10
+ const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
11
+ adapter = new PrismaPlanetScale({ url: this.config.url });
12
+ } catch (e) {
13
+ throw new Error(`PlanetScale adapter not installed - ${require_util_getError.getError(e)}`);
42
14
  }
43
- };
44
- }
15
+ if (this.config.isMysql) try {
16
+ const { PrismaMariaDb } = await import("@prisma/adapter-mariadb");
17
+ adapter = new PrismaMariaDb(this.config.url);
18
+ } catch (e) {
19
+ throw new Error(`MariaDB adapter not installed - ${require_util_getError.getError(e)}`);
20
+ }
21
+ if (this.config.isPostgres) try {
22
+ const { PrismaPg } = await import("@prisma/adapter-pg");
23
+ adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
24
+ } catch (e) {
25
+ throw new Error(`Postgres adapter not installed - ${require_util_getError.getError(e)}`);
26
+ }
27
+ try {
28
+ const { PrismaClient } = await import("@prisma/client");
29
+ if (this.config.isDebug) this.client = new PrismaClient({
30
+ adapter,
31
+ log: [{
32
+ emit: "event",
33
+ level: "query"
34
+ }]
35
+ });
36
+ else this.client = new PrismaClient({ adapter });
37
+ } catch (e) {
38
+ throw new Error(`Prisma Client not installed - ${require_util_getError.getError(e)}`);
39
+ }
40
+ }
41
+ };
45
42
  };
46
43
  //#endregion
47
44
  exports.PrismaNamespace = PrismaNamespace;
@@ -2,45 +2,42 @@ import { getError } from "../../util/getError.mjs";
2
2
  import { BaseNamespace } from "../../_class/BaseNamespace.mjs";
3
3
  //#region src/prisma/server/PrismaNamespace.ts
4
4
  var PrismaNamespace = class extends BaseNamespace {
5
- constructor(..._args) {
6
- super(..._args);
7
- this.ensureInit = async () => {
8
- if (!this.client) {
9
- let adapter = null;
10
- if (this.config.isPlanetScale) try {
11
- const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
12
- adapter = new PrismaPlanetScale({ url: this.config.url });
13
- } catch (e) {
14
- throw new Error(`PlanetScale adapter not installed - ${getError(e)}`);
15
- }
16
- if (this.config.isMysql) try {
17
- const { PrismaMariaDb } = await import("@prisma/adapter-mariadb");
18
- adapter = new PrismaMariaDb(this.config.url);
19
- } catch (e) {
20
- throw new Error(`MariaDB adapter not installed - ${getError(e)}`);
21
- }
22
- if (this.config.isPostgres) try {
23
- const { PrismaPg } = await import("@prisma/adapter-pg");
24
- adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
25
- } catch (e) {
26
- throw new Error(`Postgres adapter not installed - ${getError(e)}`);
27
- }
28
- try {
29
- const { PrismaClient } = await import("@prisma/client");
30
- if (this.config.isDebug) this.client = new PrismaClient({
31
- adapter,
32
- log: [{
33
- emit: "event",
34
- level: "query"
35
- }]
36
- });
37
- else this.client = new PrismaClient({ adapter });
38
- } catch (e) {
39
- throw new Error(`Prisma Client not installed - ${getError(e)}`);
40
- }
5
+ ensureInit = async () => {
6
+ if (!this.client) {
7
+ let adapter = null;
8
+ if (this.config.isPlanetScale) try {
9
+ const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
10
+ adapter = new PrismaPlanetScale({ url: this.config.url });
11
+ } catch (e) {
12
+ throw new Error(`PlanetScale adapter not installed - ${getError(e)}`);
41
13
  }
42
- };
43
- }
14
+ if (this.config.isMysql) try {
15
+ const { PrismaMariaDb } = await import("@prisma/adapter-mariadb");
16
+ adapter = new PrismaMariaDb(this.config.url);
17
+ } catch (e) {
18
+ throw new Error(`MariaDB adapter not installed - ${getError(e)}`);
19
+ }
20
+ if (this.config.isPostgres) try {
21
+ const { PrismaPg } = await import("@prisma/adapter-pg");
22
+ adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
23
+ } catch (e) {
24
+ throw new Error(`Postgres adapter not installed - ${getError(e)}`);
25
+ }
26
+ try {
27
+ const { PrismaClient } = await import("@prisma/client");
28
+ if (this.config.isDebug) this.client = new PrismaClient({
29
+ adapter,
30
+ log: [{
31
+ emit: "event",
32
+ level: "query"
33
+ }]
34
+ });
35
+ else this.client = new PrismaClient({ adapter });
36
+ } catch (e) {
37
+ throw new Error(`Prisma Client not installed - ${getError(e)}`);
38
+ }
39
+ }
40
+ };
44
41
  };
45
42
  //#endregion
46
43
  export { PrismaNamespace };
@@ -5,18 +5,18 @@ const require_api_post = require("../../api/post.cjs");
5
5
  let luxon = require("luxon");
6
6
  //#region src/snapchat/server/SnapchatNamespace.ts
7
7
  var SnapchatNamespace = class extends require__class_BaseNamespace.BaseNamespace {
8
- constructor(..._args) {
9
- super(..._args);
10
- this.ensureInit = async () => {
11
- if (!this.client) {
12
- const apiResponse = await require_api_post.post(`https://accounts.snapchat.com/login/oauth2/access_token?client_id=${this.config.clientId}&client_secret=${this.config.clientSecret}&grant_type=refresh_token&refresh_token=${this.config.refreshToken}`);
13
- if (apiResponse.isSuccess()) this.client = {
14
- expires: luxon.DateTime.now().toUnixInteger() + 10800 * 1e3,
15
- refreshToken: apiResponse.getBodyDefaultTo(["data", "access_token"], null)
16
- };
17
- }
18
- };
19
- }
8
+ /**
9
+ * Renew the access token as it expires every 3 hours.
10
+ */
11
+ ensureInit = async () => {
12
+ if (!this.client) {
13
+ const apiResponse = await require_api_post.post(`https://accounts.snapchat.com/login/oauth2/access_token?client_id=${this.config.clientId}&client_secret=${this.config.clientSecret}&grant_type=refresh_token&refresh_token=${this.config.refreshToken}`);
14
+ if (apiResponse.isSuccess()) this.client = {
15
+ expires: luxon.DateTime.now().toUnixInteger() + 10800 * 1e3,
16
+ refreshToken: apiResponse.getBodyDefaultTo(["data", "access_token"], null)
17
+ };
18
+ }
19
+ };
20
20
  };
21
21
  //#endregion
22
22
  exports.SnapchatNamespace = SnapchatNamespace;
@@ -3,18 +3,18 @@ import { post } from "../../api/post.mjs";
3
3
  import { DateTime } from "luxon";
4
4
  //#region src/snapchat/server/SnapchatNamespace.ts
5
5
  var SnapchatNamespace = class extends BaseNamespace {
6
- constructor(..._args) {
7
- super(..._args);
8
- this.ensureInit = async () => {
9
- if (!this.client) {
10
- const apiResponse = await post(`https://accounts.snapchat.com/login/oauth2/access_token?client_id=${this.config.clientId}&client_secret=${this.config.clientSecret}&grant_type=refresh_token&refresh_token=${this.config.refreshToken}`);
11
- if (apiResponse.isSuccess()) this.client = {
12
- expires: DateTime.now().toUnixInteger() + 10800 * 1e3,
13
- refreshToken: apiResponse.getBodyDefaultTo(["data", "access_token"], null)
14
- };
15
- }
16
- };
17
- }
6
+ /**
7
+ * Renew the access token as it expires every 3 hours.
8
+ */
9
+ ensureInit = async () => {
10
+ if (!this.client) {
11
+ const apiResponse = await post(`https://accounts.snapchat.com/login/oauth2/access_token?client_id=${this.config.clientId}&client_secret=${this.config.clientSecret}&grant_type=refresh_token&refresh_token=${this.config.refreshToken}`);
12
+ if (apiResponse.isSuccess()) this.client = {
13
+ expires: DateTime.now().toUnixInteger() + 10800 * 1e3,
14
+ refreshToken: apiResponse.getBodyDefaultTo(["data", "access_token"], null)
15
+ };
16
+ }
17
+ };
18
18
  };
19
19
  //#endregion
20
20
  export { SnapchatNamespace };
@@ -7,25 +7,25 @@ const require_api_post = require("../../api/post.cjs");
7
7
  * https://uptimerobot.com/api/
8
8
  */
9
9
  var UpTimeRobotNamespace = class extends require__class_BaseNamespace.BaseNamespace {
10
- constructor(..._args) {
11
- super(..._args);
12
- this.ensureInit = async () => {
13
- if (!this.client) this.client = true;
14
- };
15
- this.getReport = async (props) => {
16
- let response = null;
17
- let finalParams = {};
18
- if (void 0 !== props) {
19
- finalParams = { ...props };
20
- if (void 0 !== props.monitors && Array.isArray(props.monitors)) finalParams["monitors"] = props.monitors.join("-");
21
- if (void 0 !== props.statuses && Array.isArray(props.statuses)) finalParams["statuses"] = props.statuses.join("-");
22
- if (void 0 !== props.types && Array.isArray(props.types)) finalParams["types"] = props.types.join("-");
23
- }
24
- const apiResponse = await require_api_post.post(`https://api.uptimerobot.com/v2/getMonitors?api_key=${this.config.apiKey}`, finalParams);
25
- if (apiResponse.isSuccess()) response = apiResponse.getBody();
26
- return response;
27
- };
28
- }
10
+ /**
11
+ * Renew the access token as it expires every 3 hours.
12
+ */
13
+ ensureInit = async () => {
14
+ if (!this.client) this.client = true;
15
+ };
16
+ getReport = async (props) => {
17
+ let response = null;
18
+ let finalParams = {};
19
+ if (void 0 !== props) {
20
+ finalParams = { ...props };
21
+ if (void 0 !== props.monitors && Array.isArray(props.monitors)) finalParams["monitors"] = props.monitors.join("-");
22
+ if (void 0 !== props.statuses && Array.isArray(props.statuses)) finalParams["statuses"] = props.statuses.join("-");
23
+ if (void 0 !== props.types && Array.isArray(props.types)) finalParams["types"] = props.types.join("-");
24
+ }
25
+ const apiResponse = await require_api_post.post(`https://api.uptimerobot.com/v2/getMonitors?api_key=${this.config.apiKey}`, finalParams);
26
+ if (apiResponse.isSuccess()) response = apiResponse.getBody();
27
+ return response;
28
+ };
29
29
  };
30
30
  //#endregion
31
31
  exports.UpTimeRobotNamespace = UpTimeRobotNamespace;
@@ -6,25 +6,25 @@ import { post } from "../../api/post.mjs";
6
6
  * https://uptimerobot.com/api/
7
7
  */
8
8
  var UpTimeRobotNamespace = class extends BaseNamespace {
9
- constructor(..._args) {
10
- super(..._args);
11
- this.ensureInit = async () => {
12
- if (!this.client) this.client = true;
13
- };
14
- this.getReport = async (props) => {
15
- let response = null;
16
- let finalParams = {};
17
- if (void 0 !== props) {
18
- finalParams = { ...props };
19
- if (void 0 !== props.monitors && Array.isArray(props.monitors)) finalParams["monitors"] = props.monitors.join("-");
20
- if (void 0 !== props.statuses && Array.isArray(props.statuses)) finalParams["statuses"] = props.statuses.join("-");
21
- if (void 0 !== props.types && Array.isArray(props.types)) finalParams["types"] = props.types.join("-");
22
- }
23
- const apiResponse = await post(`https://api.uptimerobot.com/v2/getMonitors?api_key=${this.config.apiKey}`, finalParams);
24
- if (apiResponse.isSuccess()) response = apiResponse.getBody();
25
- return response;
26
- };
27
- }
9
+ /**
10
+ * Renew the access token as it expires every 3 hours.
11
+ */
12
+ ensureInit = async () => {
13
+ if (!this.client) this.client = true;
14
+ };
15
+ getReport = async (props) => {
16
+ let response = null;
17
+ let finalParams = {};
18
+ if (void 0 !== props) {
19
+ finalParams = { ...props };
20
+ if (void 0 !== props.monitors && Array.isArray(props.monitors)) finalParams["monitors"] = props.monitors.join("-");
21
+ if (void 0 !== props.statuses && Array.isArray(props.statuses)) finalParams["statuses"] = props.statuses.join("-");
22
+ if (void 0 !== props.types && Array.isArray(props.types)) finalParams["types"] = props.types.join("-");
23
+ }
24
+ const apiResponse = await post(`https://api.uptimerobot.com/v2/getMonitors?api_key=${this.config.apiKey}`, finalParams);
25
+ if (apiResponse.isSuccess()) response = apiResponse.getBody();
26
+ return response;
27
+ };
28
28
  };
29
29
  //#endregion
30
30
  export { UpTimeRobotNamespace };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.4.10",
4
+ "version": "2.4.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"