@8ms/helpers 2.3.38 → 2.3.39

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.
@@ -29,10 +29,18 @@ declare class AwsCloudWatchNamespace extends BaseNamespace {
29
29
  * This should typically be the name of the application + environment
30
30
  */
31
31
  createLogGroup: (logGroupName: string) => Promise<_aws_sdk_client_cloudwatch_logs0.CreateLogGroupCommandOutput>;
32
+ /**
33
+ * Checks whether a CloudWatch Log Group exists.
34
+ */
35
+ logGroupExists: (logGroupName: string) => Promise<boolean>;
32
36
  /**
33
37
  * Creates a stream within a CloudWatch Log Group.
34
38
  */
35
39
  createStream: (logGroupName: string, logStreamName: string) => Promise<_aws_sdk_client_cloudwatch_logs0.CreateLogStreamCommandOutput>;
40
+ /**
41
+ * Checks whether a CloudWatch Log Stream exists within a given Log Group.
42
+ */
43
+ logStreamExists: (logGroupName: string, logStreamName: string) => Promise<boolean>;
36
44
  createEvent: (logGroupName: string, logStreamName: string, logEvent: LogEvent) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
37
45
  createEvents: (logGroupName: string, logStreamName: string, logEvents: LogEvent[]) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
38
46
  }
@@ -21,6 +21,19 @@ var AwsCloudWatchNamespace = class extends BaseNamespace {
21
21
  return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
22
22
  };
23
23
  /**
24
+ * Checks whether a CloudWatch Log Group exists.
25
+ */
26
+ logGroupExists = async (logGroupName) => {
27
+ await this.ensureInit();
28
+ const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
29
+ const response = await this.client.send(new DescribeLogGroupsCommand({
30
+ logGroupNamePrefix: logGroupName,
31
+ limit: 1
32
+ }));
33
+ if (!response?.logGroups || 0 === response.logGroups.length) return false;
34
+ return true;
35
+ };
36
+ /**
24
37
  * Creates a stream within a CloudWatch Log Group.
25
38
  */
26
39
  createStream = async (logGroupName, logStreamName) => {
@@ -31,6 +44,20 @@ var AwsCloudWatchNamespace = class extends BaseNamespace {
31
44
  logStreamName
32
45
  }));
33
46
  };
47
+ /**
48
+ * Checks whether a CloudWatch Log Stream exists within a given Log Group.
49
+ */
50
+ logStreamExists = async (logGroupName, logStreamName) => {
51
+ await this.ensureInit();
52
+ const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
53
+ const response = await this.client.send(new DescribeLogStreamsCommand({
54
+ logGroupName,
55
+ logStreamNamePrefix: logStreamName,
56
+ limit: 1
57
+ }));
58
+ if (!response?.logStreams || 0 === response.logStreams.length) return false;
59
+ return true;
60
+ };
34
61
  createEvent = async (logGroupName, logStreamName, logEvent) => {
35
62
  return await this.createEvents(logGroupName, logStreamName, [logEvent]);
36
63
  };
@@ -1,5 +1,5 @@
1
- import { u as ApiResponseClass } from "../../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../../_class/index.mjs";
2
+ import { u as ApiResponseClass } from "../../../api-DGKJDAfb.mjs";
3
3
  import { n as isResponse200, t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
4
4
 
5
5
  //#region src/aws/lambda/server/AwsLambdaNamespace.ts
@@ -1,5 +1,5 @@
1
- import "../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../_class/index.mjs";
2
+ import "../../api-DGKJDAfb.mjs";
3
3
  import { get } from "../../axios/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
@@ -1,5 +1,5 @@
1
- import "../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../_class/index.mjs";
2
+ import "../../api-DGKJDAfb.mjs";
3
3
  import { get } from "../../axios/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
@@ -1,5 +1,5 @@
1
- import "../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../_class/index.mjs";
2
+ import "../../api-DGKJDAfb.mjs";
3
3
  import { post } from "../../axios/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
@@ -1,5 +1,5 @@
1
- import "../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../_class/index.mjs";
2
+ import "../../api-DGKJDAfb.mjs";
3
3
  import { post } from "../../axios/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
  import { DateTime } from "luxon";
@@ -1,5 +1,5 @@
1
- import "../../api-DGKJDAfb.mjs";
2
1
  import { BaseNamespace } from "../../_class/index.mjs";
2
+ import "../../api-DGKJDAfb.mjs";
3
3
  import { post } from "../../axios/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.38",
4
+ "version": "2.3.39",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"