@awsless/sns
Advanced tools
| import { SNSClient } from '@aws-sdk/client-sns'; | ||
| import { Mock } from 'vitest'; | ||
| type Attributes = { | ||
| [key: string]: string; | ||
| }; | ||
| interface PublishOptions<Payload = unknown> { | ||
| client?: SNSClient; | ||
| topic: string; | ||
| subject?: string; | ||
| payload?: Payload; | ||
| attributes?: Attributes; | ||
| region?: string; | ||
| accountId?: string; | ||
| } | ||
| declare const publish: ({ client, topic, subject, payload, attributes, region, accountId, }: PublishOptions) => Promise<void>; | ||
| type Topics = { | ||
| [key: string]: (payload: any) => any; | ||
| }; | ||
| declare const mockSNS: <T extends Topics>(topics: T) => { [P in keyof T]: Mock<any, (...args: any[]) => any>; }; | ||
| declare const snsClient: { | ||
| (): SNSClient; | ||
| set(client: SNSClient): void; | ||
| }; | ||
| export { PublishOptions, mockSNS, publish, snsClient }; |
+2
-21
@@ -25,4 +25,3 @@ "use strict"; | ||
| publish: () => publish, | ||
| snsClient: () => snsClient, | ||
| snsStruct: () => snsStruct | ||
| snsClient: () => snsClient | ||
| }); | ||
@@ -107,19 +106,2 @@ module.exports = __toCommonJS(src_exports); | ||
| }; | ||
| // src/struct.ts | ||
| var import_superstruct = require("superstruct"); | ||
| var import_validate = require("@awsless/validate"); | ||
| var snsStruct = (message) => { | ||
| return (0, import_validate.coerce)( | ||
| (0, import_validate.array)(message), | ||
| (0, import_validate.type)({ | ||
| Records: (0, import_validate.array)((0, import_validate.type)({ | ||
| Sns: (0, import_validate.type)({ Message: (0, import_validate.string)() }) | ||
| })) | ||
| }), | ||
| (value) => { | ||
| return value.Records.map((item) => JSON.parse(item.Sns.Message)); | ||
| } | ||
| ); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
@@ -129,4 +111,3 @@ 0 && (module.exports = { | ||
| publish, | ||
| snsClient, | ||
| snsStruct | ||
| snsClient | ||
| }); |
+2
-21
@@ -25,4 +25,3 @@ "use strict"; | ||
| publish: () => publish, | ||
| snsClient: () => snsClient, | ||
| snsStruct: () => snsStruct | ||
| snsClient: () => snsClient | ||
| }); | ||
@@ -107,19 +106,2 @@ module.exports = __toCommonJS(src_exports); | ||
| }; | ||
| // src/struct.ts | ||
| var import_superstruct = require("superstruct"); | ||
| var import_validate = require("@awsless/validate"); | ||
| var snsStruct = (message) => { | ||
| return (0, import_validate.coerce)( | ||
| (0, import_validate.array)(message), | ||
| (0, import_validate.type)({ | ||
| Records: (0, import_validate.array)((0, import_validate.type)({ | ||
| Sns: (0, import_validate.type)({ Message: (0, import_validate.string)() }) | ||
| })) | ||
| }), | ||
| (value) => { | ||
| return value.Records.map((item) => JSON.parse(item.Sns.Message)); | ||
| } | ||
| ); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
@@ -129,4 +111,3 @@ 0 && (module.exports = { | ||
| publish, | ||
| snsClient, | ||
| snsStruct | ||
| snsClient | ||
| }); |
+1
-4
| import { SNSClient } from '@aws-sdk/client-sns'; | ||
| import { Mock } from 'vitest'; | ||
| import { Struct } from '@awsless/validate'; | ||
@@ -30,4 +29,2 @@ type Attributes = { | ||
| declare const snsStruct: <A, B>(message: Struct<A, B>) => Struct<A[], Struct<A, B>>; | ||
| export { PublishOptions, mockSNS, publish, snsClient, snsStruct }; | ||
| export { PublishOptions, mockSNS, publish, snsClient }; |
+1
-19
@@ -77,24 +77,6 @@ // src/commands.ts | ||
| }; | ||
| // src/struct.ts | ||
| import "superstruct"; | ||
| import { array, type, string, coerce } from "@awsless/validate"; | ||
| var snsStruct = (message) => { | ||
| return coerce( | ||
| array(message), | ||
| type({ | ||
| Records: array(type({ | ||
| Sns: type({ Message: string() }) | ||
| })) | ||
| }), | ||
| (value) => { | ||
| return value.Records.map((item) => JSON.parse(item.Sns.Message)); | ||
| } | ||
| ); | ||
| }; | ||
| export { | ||
| mockSNS, | ||
| publish, | ||
| snsClient, | ||
| snsStruct | ||
| snsClient | ||
| }; |
+1
-8
| { | ||
| "name": "@awsless/sns", | ||
| "version": "0.0.6", | ||
| "version": "0.0.7", | ||
| "license": "MIT", | ||
@@ -29,11 +29,4 @@ "type": "module", | ||
| "aws-sdk-client-mock": "^2.1.1", | ||
| "superstruct": "^1.0.3", | ||
| "@awsless/utils": "^0.0.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@awsless/validate": "^0.0.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "@awsless/validate": "^0.0.4" | ||
| }, | ||
| "scripts": { | ||
@@ -40,0 +33,0 @@ "test": "pnpm code test", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
3
-40%0
-100%6
20%11005
-8.73%312
-14.99%- Removed
- Removed
- Removed
- Removed
- Removed