@8ms/helpers 2.0.0 → 2.0.1
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.
- package/.github/workflows/deploy_npmjs.yml +7 -0
- package/.yarn/install-state.gz +0 -0
- package/_class/BaseClass.d.ts +18 -0
- package/_class/BaseClass.js +53 -0
- package/_class/BaseNamespace.d.ts +9 -0
- package/_class/BaseNamespace.js +27 -0
- package/_class/index.d.ts +2 -0
- package/_class/index.js +7 -0
- package/adverity/getJobs.d.ts +15 -0
- package/adverity/getJobs.js +30 -0
- package/adverity/index.d.ts +112 -0
- package/adverity/index.js +61 -0
- package/api/ApiResponseClass.d.ts +35 -0
- package/api/ApiResponseClass.js +97 -0
- package/api/index.d.ts +22 -0
- package/api/index.js +44 -0
- package/array/index.d.ts +8 -0
- package/array/index.js +17 -0
- package/atInternet/index.d.ts +16 -0
- package/atInternet/index.js +18 -0
- package/aws/athenaExpress/AwsAthenaNamespace.d.ts +8 -0
- package/aws/athenaExpress/AwsAthenaNamespace.js +82 -0
- package/aws/athenaExpress/index.d.ts +10 -0
- package/aws/athenaExpress/index.js +40 -0
- package/aws/ec2/AwsEc2Namespace.d.ts +10 -0
- package/aws/ec2/AwsEc2Namespace.js +78 -0
- package/aws/ec2/index.d.ts +3 -0
- package/aws/ec2/index.js +16 -0
- package/aws/ecs/AwsEcsNamespace.d.ts +53 -0
- package/aws/ecs/AwsEcsNamespace.js +159 -0
- package/aws/ecs/index.d.ts +3 -0
- package/aws/ecs/index.js +16 -0
- package/aws/glue/AwsGlueNamespace.d.ts +12 -0
- package/aws/glue/AwsGlueNamespace.js +70 -0
- package/aws/glue/index.d.ts +3 -0
- package/aws/glue/index.js +16 -0
- package/aws/index.d.ts +9 -0
- package/aws/index.js +34 -0
- package/aws/isResponse200.d.ts +4 -0
- package/aws/isResponse200.js +16 -0
- package/aws/lambda/AwsLambdaNamespace.d.ts +21 -0
- package/aws/lambda/AwsLambdaNamespace.js +110 -0
- package/aws/lambda/index.d.ts +4 -0
- package/aws/lambda/index.js +21 -0
- package/aws/s3/AwsS3Namespace.d.ts +60 -0
- package/aws/s3/AwsS3Namespace.js +401 -0
- package/aws/s3/index.d.ts +25 -0
- package/aws/s3/index.js +36 -0
- package/aws/s3/payload.d.ts +42 -0
- package/aws/s3/payload.js +46 -0
- package/aws/ses/AwsSesNamespace.d.ts +18 -0
- package/aws/ses/AwsSesNamespace.js +69 -0
- package/aws/ses/SimpleEmail.d.ts +56 -0
- package/aws/ses/SimpleEmail.js +106 -0
- package/aws/ses/index.d.ts +4 -0
- package/aws/ses/index.js +18 -0
- package/aws/sqs/AwsSqsNamespace.d.ts +34 -0
- package/aws/sqs/AwsSqsNamespace.js +96 -0
- package/aws/sqs/index.d.ts +3 -0
- package/aws/sqs/index.js +16 -0
- package/aws/ssm/AwsSsmNamespace.d.ts +11 -0
- package/aws/ssm/AwsSsmNamespace.js +89 -0
- package/aws/ssm/index.d.ts +3 -0
- package/aws/ssm/index.js +16 -0
- package/axios/deleteRequest.d.ts +6 -0
- package/axios/deleteRequest.js +33 -0
- package/axios/get.d.ts +5 -0
- package/axios/get.js +31 -0
- package/axios/index.d.ts +3 -0
- package/axios/index.js +9 -0
- package/axios/post.d.ts +5 -0
- package/axios/post.js +32 -0
- package/boolean/getBoolean.d.ts +4 -0
- package/boolean/getBoolean.js +23 -0
- package/boolean/index.d.ts +1 -0
- package/boolean/index.js +5 -0
- package/brightData/index.d.ts +15 -0
- package/brightData/index.js +20 -0
- package/brightData/serpApi/buildGoogleSerpUrl.d.ts +32 -0
- package/brightData/serpApi/buildGoogleSerpUrl.js +116 -0
- package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +22 -0
- package/brightData/serpApi/buildGoogleTrendsUrl.js +61 -0
- package/brightData/serpApi/getAsyncRequestId.d.ts +8 -0
- package/brightData/serpApi/getAsyncRequestId.js +36 -0
- package/brightData/serpApi/getAsyncResults.d.ts +7 -0
- package/brightData/serpApi/getAsyncResults.js +35 -0
- package/brightData/serpApi/getRealtime.d.ts +5 -0
- package/brightData/serpApi/getRealtime.js +30 -0
- package/brightData/serpApi/index.d.ts +14 -0
- package/brightData/serpApi/index.js +23 -0
- package/brightData/webScraperIde/getBatch.d.ts +7 -0
- package/brightData/webScraperIde/getBatch.js +28 -0
- package/brightData/webScraperIde/getRealtime.d.ts +7 -0
- package/brightData/webScraperIde/getRealtime.js +49 -0
- package/brightData/webScraperIde/index.d.ts +2 -0
- package/brightData/webScraperIde/index.js +7 -0
- package/cache/index.d.ts +2 -0
- package/cache/index.js +48 -0
- package/cache/test/cache.test.d.ts +1 -0
- package/cache/test/cache.test.js +10 -0
- package/crud/index.d.ts +6 -0
- package/crud/index.js +10 -0
- package/crypto/getDecrypt.d.ts +5 -0
- package/crypto/getDecrypt.js +47 -0
- package/crypto/getEncrypt.d.ts +5 -0
- package/crypto/getEncrypt.js +47 -0
- package/crypto/getRandom.d.ts +4 -0
- package/crypto/getRandom.js +12 -0
- package/crypto/getSha256.d.ts +5 -0
- package/crypto/getSha256.js +48 -0
- package/crypto/index.d.ts +4 -0
- package/crypto/index.js +11 -0
- package/date/calculation.d.ts +75 -0
- package/date/calculation.js +207 -0
- package/date/financialYear.d.ts +19 -0
- package/date/financialYear.js +85 -0
- package/date/format.d.ts +68 -0
- package/date/format.js +150 -0
- package/date/index.d.ts +35 -0
- package/date/index.js +57 -0
- package/environment/index.d.ts +32 -0
- package/environment/index.js +92 -0
- package/eskimi/getAgeGroup.d.ts +4 -0
- package/eskimi/getAgeGroup.js +15 -0
- package/eskimi/getData.d.ts +4 -0
- package/eskimi/getData.js +17 -0
- package/eskimi/getDevice.d.ts +4 -0
- package/eskimi/getDevice.js +15 -0
- package/eskimi/getGender.d.ts +4 -0
- package/eskimi/getGender.js +15 -0
- package/eskimi/index.d.ts +49 -0
- package/eskimi/index.js +96 -0
- package/file/createDirectory.d.ts +5 -0
- package/file/createDirectory.js +50 -0
- package/file/index.d.ts +1 -0
- package/file/index.js +5 -0
- package/geo/countries.d.ts +12 -0
- package/geo/countries.js +222 -0
- package/geo/index.d.ts +2 -0
- package/geo/index.js +7 -0
- package/geo/languages.d.ts +9 -0
- package/geo/languages.js +58 -0
- package/google/bigQuery/GoogleBigQueryNamespace.d.ts +51 -0
- package/google/bigQuery/GoogleBigQueryNamespace.js +165 -0
- package/google/bigQuery/index.d.ts +5 -0
- package/google/bigQuery/index.js +37 -0
- package/google/bigQuery/loadData.d.ts +19 -0
- package/google/bigQuery/loadData.js +18 -0
- package/google/index.d.ts +27 -0
- package/google/index.js +24 -0
- package/google/sheets/GoogleSheetsNamespace.d.ts +16 -0
- package/google/sheets/GoogleSheetsNamespace.js +81 -0
- package/google/sheets/getAssociatedData.d.ts +10 -0
- package/google/sheets/getAssociatedData.js +43 -0
- package/google/sheets/index.d.ts +8 -0
- package/google/sheets/index.js +37 -0
- package/google/storage/GoogleCloudStorageNamespace.d.ts +20 -0
- package/google/storage/GoogleCloudStorageNamespace.js +108 -0
- package/google/storage/index.d.ts +3 -0
- package/google/storage/index.js +30 -0
- package/googleAds/GoogleAdsNamespace.d.ts +11 -0
- package/googleAds/GoogleAdsNamespace.js +73 -0
- package/googleAds/index.d.ts +11 -0
- package/googleAds/index.js +30 -0
- package/googleAds/keywordPlanner/index.d.ts +40 -0
- package/googleAds/keywordPlanner/index.js +59 -0
- package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +11 -0
- package/googlePageSpeed/GooglePageSpeedNamespace.js +35 -0
- package/googlePageSpeed/index.d.ts +17 -0
- package/googlePageSpeed/index.js +44 -0
- package/googleSearchIncidents/index.d.ts +69 -0
- package/googleSearchIncidents/index.js +46 -0
- package/greenDomain/index.d.ts +21 -0
- package/greenDomain/index.js +41 -0
- package/inngest/index.d.ts +6 -0
- package/inngest/index.js +10 -0
- package/json/getJsonNewline.d.ts +1 -0
- package/json/getJsonNewline.js +13 -0
- package/json/index.d.ts +2 -0
- package/json/index.js +7 -0
- package/json/isJson.d.ts +1 -0
- package/json/isJson.js +26 -0
- package/littleWarden/LittleWardenNamespace.d.ts +11 -0
- package/littleWarden/LittleWardenNamespace.js +38 -0
- package/littleWarden/getUrlStatus.d.ts +4 -0
- package/littleWarden/getUrlStatus.js +16 -0
- package/littleWarden/index.d.ts +29 -0
- package/littleWarden/index.js +74 -0
- package/lumar/api/buildRequest.d.ts +13 -0
- package/lumar/api/buildRequest.js +80 -0
- package/lumar/api/getData.d.ts +5 -0
- package/lumar/api/getData.js +13 -0
- package/lumar/api/index.d.ts +36 -0
- package/lumar/api/index.js +33 -0
- package/lumar/api/initClient.d.ts +6 -0
- package/lumar/api/initClient.js +26 -0
- package/lumar/graphql/columns.d.ts +28 -0
- package/lumar/graphql/columns.js +31 -0
- package/lumar/graphql/getData.d.ts +1 -0
- package/lumar/graphql/getData.js +20 -0
- package/lumar/graphql/index.d.ts +29 -0
- package/lumar/graphql/index.js +39 -0
- package/lumar/graphql/initClient.d.ts +5 -0
- package/lumar/graphql/initClient.js +25 -0
- package/lumar/graphql/queries/crawl.d.ts +5 -0
- package/lumar/graphql/queries/crawl.js +2 -0
- package/lumar/graphql/queries/getCrawls.d.ts +18 -0
- package/lumar/graphql/queries/getCrawls.js +33 -0
- package/lumar/graphql/queries/getReportDifferences.d.ts +24 -0
- package/lumar/graphql/queries/getReportDifferences.js +37 -0
- package/lumar/graphql/queries/getRows.d.ts +38 -0
- package/lumar/graphql/queries/getRows.js +57 -0
- package/lumar/graphql/queries/getTotals.d.ts +25 -0
- package/lumar/graphql/queries/getTotals.js +40 -0
- package/lumar/graphql/queries/row.d.ts +157 -0
- package/lumar/graphql/queries/row.js +2 -0
- package/lumar/graphql/reportTemplates.d.ts +67 -0
- package/lumar/graphql/reportTemplates.js +70 -0
- package/myTarget/request.d.ts +5 -0
- package/myTarget/request.js +17 -0
- package/nextAuth/index.d.ts +6 -0
- package/nextAuth/index.js +11 -0
- package/nextAuth/isSessionReady.d.ts +1 -0
- package/nextAuth/isSessionReady.js +13 -0
- package/nextJs/getIp.d.ts +6 -0
- package/nextJs/getIp.js +14 -0
- package/nextJs/getUserAgent.d.ts +6 -0
- package/nextJs/getUserAgent.js +8 -0
- package/nextJs/index.d.ts +2 -0
- package/nextJs/index.js +7 -0
- package/number/format.d.ts +12 -0
- package/number/format.js +20 -0
- package/number/formatCurrency.d.ts +5 -0
- package/number/formatCurrency.js +21 -0
- package/number/getDecimal.d.ts +4 -0
- package/number/getDecimal.js +12 -0
- package/number/getNumber.d.ts +4 -0
- package/number/getNumber.js +48 -0
- package/number/getPercentIncrease.d.ts +4 -0
- package/number/getPercentIncrease.js +16 -0
- package/number/getSafeDivide.d.ts +11 -0
- package/number/getSafeDivide.js +20 -0
- package/number/index.d.ts +6 -0
- package/number/index.js +15 -0
- package/object/index.d.ts +1 -0
- package/object/index.js +5 -0
- package/object/replaceKeys.d.ts +5 -0
- package/object/replaceKeys.js +25 -0
- package/onePassword/OnePasswordNamespace.d.ts +13 -0
- package/onePassword/OnePasswordNamespace.js +81 -0
- package/onePassword/index.d.ts +7 -0
- package/onePassword/index.js +25 -0
- package/openAi/OpenAiNamespace.d.ts +11 -0
- package/openAi/OpenAiNamespace.js +44 -0
- package/openAi/index.d.ts +5 -0
- package/openAi/index.js +30 -0
- package/package.json +2 -2
- package/prisma/PrismaNamespace.d.ts +8 -0
- package/prisma/PrismaNamespace.js +79 -0
- package/prisma/getDecimal.d.ts +4 -0
- package/prisma/getDecimal.js +23 -0
- package/prisma/index.d.ts +8 -0
- package/prisma/index.js +29 -0
- package/snapchat/SnapchatNamespace.d.ts +15 -0
- package/snapchat/SnapchatNamespace.js +30 -0
- package/snapchat/index.d.ts +7 -0
- package/snapchat/index.js +30 -0
- package/sorting/byNumberAscending.d.ts +4 -0
- package/sorting/byNumberAscending.js +19 -0
- package/sorting/byNumberDescending.d.ts +4 -0
- package/sorting/byNumberDescending.js +22 -0
- package/sorting/byStringAscending.d.ts +4 -0
- package/sorting/byStringAscending.js +16 -0
- package/sorting/byStringDescending.d.ts +4 -0
- package/sorting/byStringDescending.js +16 -0
- package/sorting/index.d.ts +4 -0
- package/sorting/index.js +11 -0
- package/stream/index.d.ts +1 -0
- package/stream/index.js +5 -0
- package/stream/sort.d.ts +13 -0
- package/stream/sort.js +51 -0
- package/string/getCapitalised.d.ts +5 -0
- package/string/getCapitalised.js +18 -0
- package/string/getClean.d.ts +18 -0
- package/string/getClean.js +51 -0
- package/string/getFolder.d.ts +4 -0
- package/string/getFolder.js +15 -0
- package/string/getProperCase.d.ts +11 -0
- package/string/getProperCase.js +25 -0
- package/string/getString.d.ts +4 -0
- package/string/getString.js +34 -0
- package/string/getStringFromStream.d.ts +5 -0
- package/string/getStringFromStream.js +17 -0
- package/string/getUnescaped.d.ts +6 -0
- package/string/getUnescaped.js +26 -0
- package/string/getWithoutAccents.d.ts +5 -0
- package/string/getWithoutAccents.js +13 -0
- package/string/getWithoutHtmlTags.d.ts +5 -0
- package/string/getWithoutHtmlTags.js +12 -0
- package/string/getWithoutPunctuation.d.ts +5 -0
- package/string/getWithoutPunctuation.js +13 -0
- package/string/getWithoutUnderscores.d.ts +4 -0
- package/string/getWithoutUnderscores.js +11 -0
- package/string/getWithoutWhitespaces.d.ts +5 -0
- package/string/getWithoutWhitespaces.js +13 -0
- package/string/index.d.ts +12 -0
- package/string/index.js +27 -0
- package/swr/index.d.ts +42 -0
- package/swr/index.js +59 -0
- package/upTimeRobot/UpTimeRobotNamespace.d.ts +31 -0
- package/upTimeRobot/UpTimeRobotNamespace.js +52 -0
- package/upTimeRobot/index.d.ts +38 -0
- package/upTimeRobot/index.js +63 -0
- package/url/index.d.ts +19 -0
- package/url/index.js +70 -0
- package/url/writeUrlContents.d.ts +6 -0
- package/url/writeUrlContents.js +75 -0
- package/util/defaultTo.d.ts +4 -0
- package/util/defaultTo.js +44 -0
- package/util/getBrotliCompressed.d.ts +5 -0
- package/util/getBrotliCompressed.js +23 -0
- package/util/getBrotliDecompressed.d.ts +5 -0
- package/util/getBrotliDecompressed.js +24 -0
- package/util/getClean.d.ts +11 -0
- package/util/getClean.js +23 -0
- package/util/getGzipCompressed.d.ts +5 -0
- package/util/getGzipCompressed.js +23 -0
- package/util/getGzipDecompressed.d.ts +5 -0
- package/util/getGzipDecompressed.js +24 -0
- package/util/getWithoutHash.d.ts +4 -0
- package/util/getWithoutHash.js +18 -0
- package/util/getWithoutParameter.d.ts +4 -0
- package/util/getWithoutParameter.js +18 -0
- package/util/index.d.ts +11 -0
- package/util/index.js +25 -0
- package/util/isUndefined.d.ts +4 -0
- package/util/isUndefined.js +13 -0
- package/util/promiseChunks.d.ts +5 -0
- package/util/promiseChunks.js +19 -0
- package/util/sleep.d.ts +1 -0
- package/util/sleep.js +7 -0
- package/webWorker/index.d.ts +5 -0
- package/webWorker/index.js +9 -0
- package/xml/getXml.d.ts +1 -0
- package/xml/getXml.js +18 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html
|
|
4
|
+
*/
|
|
5
|
+
export declare const payloadSchema: z.ZodObject<{
|
|
6
|
+
Records: z.ZodArray<z.ZodObject<{
|
|
7
|
+
eventVersion: z.ZodString;
|
|
8
|
+
eventSource: z.ZodString;
|
|
9
|
+
awsRegion: z.ZodString;
|
|
10
|
+
eventTime: z.ZodString;
|
|
11
|
+
eventName: z.ZodString;
|
|
12
|
+
userIdentity: z.ZodObject<{
|
|
13
|
+
principalId: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
requestParameters: z.ZodObject<{
|
|
16
|
+
sourceIPAddress: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
responseElements: z.ZodObject<{
|
|
19
|
+
"x-amz-request-id": z.ZodString;
|
|
20
|
+
"x-amz-id-2": z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
s3: z.ZodObject<{
|
|
23
|
+
s3SchemaVersion: z.ZodString;
|
|
24
|
+
configurationId: z.ZodString;
|
|
25
|
+
bucket: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
ownerIdentity: z.ZodObject<{
|
|
28
|
+
principalId: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
arn: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
object: z.ZodObject<{
|
|
33
|
+
key: z.ZodString;
|
|
34
|
+
size: z.ZodString;
|
|
35
|
+
eTag: z.ZodString;
|
|
36
|
+
versionId: z.ZodOptional<z.ZodString>;
|
|
37
|
+
sequencer: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type PayloadSchemaType = z.infer<typeof payloadSchema>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.payloadSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
/**
|
|
6
|
+
* https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html
|
|
7
|
+
*/
|
|
8
|
+
exports.payloadSchema = v4_1.z.object({
|
|
9
|
+
Records: v4_1.z.object({
|
|
10
|
+
eventVersion: v4_1.z.string(),
|
|
11
|
+
eventSource: v4_1.z.string(),
|
|
12
|
+
awsRegion: v4_1.z.string(),
|
|
13
|
+
eventTime: v4_1.z.string(),
|
|
14
|
+
eventName: v4_1.z.string(),
|
|
15
|
+
userIdentity: v4_1.z.object({
|
|
16
|
+
principalId: v4_1.z.string(),
|
|
17
|
+
}),
|
|
18
|
+
requestParameters: v4_1.z.object({
|
|
19
|
+
sourceIPAddress: v4_1.z.string(),
|
|
20
|
+
}),
|
|
21
|
+
responseElements: v4_1.z.object({
|
|
22
|
+
"x-amz-request-id": v4_1.z.string(),
|
|
23
|
+
"x-amz-id-2": v4_1.z.string(),
|
|
24
|
+
}),
|
|
25
|
+
s3: v4_1.z.object({
|
|
26
|
+
s3SchemaVersion: v4_1.z.string(),
|
|
27
|
+
configurationId: v4_1.z.string(),
|
|
28
|
+
bucket: v4_1.z.object({
|
|
29
|
+
name: v4_1.z.string(),
|
|
30
|
+
ownerIdentity: v4_1.z.object({
|
|
31
|
+
principalId: v4_1.z.string(),
|
|
32
|
+
}),
|
|
33
|
+
arn: v4_1.z.string(),
|
|
34
|
+
}),
|
|
35
|
+
object: v4_1.z.object({
|
|
36
|
+
key: v4_1.z.string(),
|
|
37
|
+
size: v4_1.z.string(),
|
|
38
|
+
eTag: v4_1.z.string(),
|
|
39
|
+
versionId: v4_1.z.string()
|
|
40
|
+
.optional(),
|
|
41
|
+
sequencer: v4_1.z.string(),
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
})
|
|
45
|
+
.array(),
|
|
46
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseNamespace } from "../../_class";
|
|
2
|
+
import { AwsConfig } from "../index";
|
|
3
|
+
import type { SESClient } from "@aws-sdk/client-ses";
|
|
4
|
+
type SendProps = {
|
|
5
|
+
bcc?: string[];
|
|
6
|
+
cc?: string[];
|
|
7
|
+
from?: string;
|
|
8
|
+
html?: string;
|
|
9
|
+
subject?: string;
|
|
10
|
+
to?: string | string[];
|
|
11
|
+
};
|
|
12
|
+
export declare class AwsSesNamespace extends BaseNamespace {
|
|
13
|
+
client: SESClient | null;
|
|
14
|
+
config: AwsConfig;
|
|
15
|
+
ensureInit: () => Promise<void>;
|
|
16
|
+
send: (props: SendProps) => Promise<any>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AwsSesNamespace = void 0;
|
|
37
|
+
const _class_1 = require("../../_class");
|
|
38
|
+
class AwsSesNamespace extends _class_1.BaseNamespace {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.client = null;
|
|
42
|
+
this.ensureInit = async () => {
|
|
43
|
+
if (!this.client) {
|
|
44
|
+
try {
|
|
45
|
+
const { SESClient } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-ses")));
|
|
46
|
+
this.client = new SESClient(this.config);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new Error("AWS SES Client not installed");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.send = async (props) => {
|
|
54
|
+
await this.ensureInit();
|
|
55
|
+
const { SendEmailCommand } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-ses")));
|
|
56
|
+
let response;
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
const command = new SendEmailCommand(props);
|
|
59
|
+
try {
|
|
60
|
+
response = await this.client.send(command);
|
|
61
|
+
}
|
|
62
|
+
catch (exception) {
|
|
63
|
+
response = exception;
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.AwsSesNamespace = AwsSesNamespace;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseClass } from "../../_class";
|
|
2
|
+
type ConstructorProps = {
|
|
3
|
+
bcc?: string[];
|
|
4
|
+
cc?: string[];
|
|
5
|
+
from?: string;
|
|
6
|
+
html?: string;
|
|
7
|
+
subject?: string;
|
|
8
|
+
to?: string | string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Class to build and send an AWS SES email.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SimpleEmail extends BaseClass {
|
|
14
|
+
from?: string;
|
|
15
|
+
to: string[];
|
|
16
|
+
cc: string[];
|
|
17
|
+
bcc: string[];
|
|
18
|
+
html?: string;
|
|
19
|
+
subject?: string;
|
|
20
|
+
constructor({ bcc, cc, from, html, subject, to }: ConstructorProps);
|
|
21
|
+
setFrom: (from: string) => this;
|
|
22
|
+
setHtml: (html: string) => this;
|
|
23
|
+
setSubject: (subject: string) => this;
|
|
24
|
+
pushBcc: (recipient: string | string[]) => this;
|
|
25
|
+
pushCc: (recipient: string | string[]) => this;
|
|
26
|
+
pushTo: (recipient: string | string[]) => this;
|
|
27
|
+
setBcc: (recipient: string | string[]) => this;
|
|
28
|
+
setCc: (recipient: string | string[]) => this;
|
|
29
|
+
setTo: (recipient: string | string[]) => this;
|
|
30
|
+
getEmailParams: () => {
|
|
31
|
+
Destination: {
|
|
32
|
+
BccAddresses: string[];
|
|
33
|
+
CcAddresses: string[];
|
|
34
|
+
ToAddresses: string[];
|
|
35
|
+
};
|
|
36
|
+
Message: {
|
|
37
|
+
Body: {
|
|
38
|
+
Html: {
|
|
39
|
+
Charset: string;
|
|
40
|
+
Data: string;
|
|
41
|
+
};
|
|
42
|
+
Text: {
|
|
43
|
+
Charset: string;
|
|
44
|
+
Data: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
Subject: {
|
|
48
|
+
Charset: string;
|
|
49
|
+
Data: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
Source: string;
|
|
53
|
+
};
|
|
54
|
+
private _filterRecipients;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SimpleEmail = void 0;
|
|
7
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
8
|
+
const _class_1 = require("../../_class");
|
|
9
|
+
/**
|
|
10
|
+
* Class to build and send an AWS SES email.
|
|
11
|
+
*/
|
|
12
|
+
class SimpleEmail extends _class_1.BaseClass {
|
|
13
|
+
constructor({ bcc, cc, from, html, subject, to }) {
|
|
14
|
+
super();
|
|
15
|
+
this.to = [];
|
|
16
|
+
this.cc = [];
|
|
17
|
+
this.bcc = [];
|
|
18
|
+
this.setFrom = (from) => {
|
|
19
|
+
return this._setValue("from", from);
|
|
20
|
+
};
|
|
21
|
+
this.setHtml = (html) => {
|
|
22
|
+
return this._setValue("html", html);
|
|
23
|
+
};
|
|
24
|
+
this.setSubject = (subject) => {
|
|
25
|
+
return this._setValue("subject", subject);
|
|
26
|
+
};
|
|
27
|
+
this.pushBcc = (recipient) => {
|
|
28
|
+
return this._push("bcc", recipient);
|
|
29
|
+
};
|
|
30
|
+
this.pushCc = (recipient) => {
|
|
31
|
+
return this._push("cc", recipient);
|
|
32
|
+
};
|
|
33
|
+
this.pushTo = (recipient) => {
|
|
34
|
+
return this._push("to", recipient);
|
|
35
|
+
};
|
|
36
|
+
this.setBcc = (recipient) => {
|
|
37
|
+
return this._setArray("bcc", recipient);
|
|
38
|
+
};
|
|
39
|
+
this.setCc = (recipient) => {
|
|
40
|
+
return this._setArray("cc", recipient);
|
|
41
|
+
};
|
|
42
|
+
this.setTo = (recipient) => {
|
|
43
|
+
return this._setArray("to", recipient);
|
|
44
|
+
};
|
|
45
|
+
this.getEmailParams = () => {
|
|
46
|
+
// https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/ses-examples-sending-email.html
|
|
47
|
+
const params = {
|
|
48
|
+
Destination: {
|
|
49
|
+
BccAddresses: this._filterRecipients("bcc"),
|
|
50
|
+
CcAddresses: this._filterRecipients("cc"),
|
|
51
|
+
ToAddresses: this._filterRecipients("to"),
|
|
52
|
+
},
|
|
53
|
+
Message: {
|
|
54
|
+
Body: {
|
|
55
|
+
Html: {
|
|
56
|
+
Charset: "UTF-8",
|
|
57
|
+
Data: this.html,
|
|
58
|
+
},
|
|
59
|
+
Text: {
|
|
60
|
+
Charset: "UTF-8",
|
|
61
|
+
Data: this.html,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
Subject: {
|
|
65
|
+
Charset: "UTF-8",
|
|
66
|
+
Data: this.subject,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
Source: this.from,
|
|
70
|
+
};
|
|
71
|
+
return params;
|
|
72
|
+
};
|
|
73
|
+
this._filterRecipients = (field) => {
|
|
74
|
+
// Remove all undefined and null values
|
|
75
|
+
let response = this[field].filter(recipient => recipient && null !== recipient);
|
|
76
|
+
// Clean all the values
|
|
77
|
+
response = response.map(recipient => recipient.toLowerCase()
|
|
78
|
+
.trim());
|
|
79
|
+
// Remove all empty values
|
|
80
|
+
response = response.filter(recipient => "" !== recipient);
|
|
81
|
+
// Return only unique values
|
|
82
|
+
response = (0, uniq_1.default)(response);
|
|
83
|
+
return response;
|
|
84
|
+
};
|
|
85
|
+
if (bcc) {
|
|
86
|
+
this.setBcc(bcc);
|
|
87
|
+
}
|
|
88
|
+
if (cc) {
|
|
89
|
+
this.setCc(cc);
|
|
90
|
+
}
|
|
91
|
+
if (from) {
|
|
92
|
+
this.setFrom(from);
|
|
93
|
+
}
|
|
94
|
+
if (html) {
|
|
95
|
+
this.setHtml(html);
|
|
96
|
+
}
|
|
97
|
+
if (subject) {
|
|
98
|
+
this.setSubject(subject);
|
|
99
|
+
}
|
|
100
|
+
if (to) {
|
|
101
|
+
this.setTo(to);
|
|
102
|
+
}
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.SimpleEmail = SimpleEmail;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AwsSesNamespace } from "./AwsSesNamespace";
|
|
2
|
+
import { AwsConfig } from "../index";
|
|
3
|
+
export declare const awsSesClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsSesNamespace>;
|
|
4
|
+
export { SimpleEmail } from "./SimpleEmail";
|
package/aws/ses/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimpleEmail = exports.awsSesClient = void 0;
|
|
4
|
+
const AwsSesNamespace_1 = require("./AwsSesNamespace");
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const awsSesNamespaces = new Map();
|
|
7
|
+
const awsSesClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (awsSesNamespaces.has(key)) {
|
|
9
|
+
return awsSesNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
const instanceConfig = await (0, index_1.getConfig)(key, config, vaultId, itemId);
|
|
12
|
+
const namespace = new AwsSesNamespace_1.AwsSesNamespace(key, instanceConfig);
|
|
13
|
+
awsSesNamespaces.set(key, namespace);
|
|
14
|
+
return namespace;
|
|
15
|
+
};
|
|
16
|
+
exports.awsSesClient = awsSesClient;
|
|
17
|
+
var SimpleEmail_1 = require("./SimpleEmail");
|
|
18
|
+
Object.defineProperty(exports, "SimpleEmail", { enumerable: true, get: function () { return SimpleEmail_1.SimpleEmail; } });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseNamespace } from "../../_class";
|
|
2
|
+
import { AwsConfig } from "../index";
|
|
3
|
+
import type { SQSClient } from "@aws-sdk/client-sqs";
|
|
4
|
+
type SqsEventRecord = {
|
|
5
|
+
messageId: string;
|
|
6
|
+
receiptHandle: string;
|
|
7
|
+
body: any;
|
|
8
|
+
attributes: object;
|
|
9
|
+
messageAttributes: object;
|
|
10
|
+
md5OfMessageAttributes: string;
|
|
11
|
+
md5OfBody: string;
|
|
12
|
+
eventSource: string;
|
|
13
|
+
eventSourceARN: string;
|
|
14
|
+
awsRegion: string;
|
|
15
|
+
};
|
|
16
|
+
type SqsEvent = {
|
|
17
|
+
Records: SqsEventRecord[];
|
|
18
|
+
};
|
|
19
|
+
type AddToQueue = {
|
|
20
|
+
data: any;
|
|
21
|
+
dedupeId: string;
|
|
22
|
+
groupId?: string;
|
|
23
|
+
queueId?: string;
|
|
24
|
+
queueUrl: string;
|
|
25
|
+
};
|
|
26
|
+
export declare class AwsSqsNamespace extends BaseNamespace {
|
|
27
|
+
client: SQSClient | null;
|
|
28
|
+
config: AwsConfig;
|
|
29
|
+
ensureInit: () => Promise<void>;
|
|
30
|
+
addToQueue: (props: AddToQueue) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
|
|
31
|
+
deleteFromQueue: (queueUrl: string, recipientHandle: string) => Promise<import("@aws-sdk/client-sqs").DeleteMessageCommandOutput>;
|
|
32
|
+
isEventSqs: (event: SqsEvent) => Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AwsSqsNamespace = void 0;
|
|
37
|
+
const _class_1 = require("../../_class");
|
|
38
|
+
class AwsSqsNamespace extends _class_1.BaseNamespace {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.client = null;
|
|
42
|
+
this.ensureInit = async () => {
|
|
43
|
+
if (!this.client) {
|
|
44
|
+
try {
|
|
45
|
+
const { SQSClient } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-sqs")));
|
|
46
|
+
this.client = new SQSClient(this.config);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new Error("AWS SQS Client not installed");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.addToQueue = async (props) => {
|
|
54
|
+
await this.ensureInit();
|
|
55
|
+
const { SendMessageCommand } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-sqs")));
|
|
56
|
+
let params = {
|
|
57
|
+
MessageBody: JSON.stringify({
|
|
58
|
+
queueId: props.queueId,
|
|
59
|
+
data: props.data,
|
|
60
|
+
}),
|
|
61
|
+
QueueUrl: props.queueUrl,
|
|
62
|
+
};
|
|
63
|
+
// Required for FIFO
|
|
64
|
+
if (undefined !== props?.dedupeId) {
|
|
65
|
+
params["MessageDeduplicationId"] = props.dedupeId;
|
|
66
|
+
}
|
|
67
|
+
// Required for FIFO
|
|
68
|
+
if (undefined !== props?.groupId) {
|
|
69
|
+
params["MessageGroupId"] = props.dedupeId;
|
|
70
|
+
}
|
|
71
|
+
const sendData = await this.client.send(new SendMessageCommand(params));
|
|
72
|
+
return sendData;
|
|
73
|
+
};
|
|
74
|
+
this.deleteFromQueue = async (queueUrl, recipientHandle) => {
|
|
75
|
+
await this.ensureInit();
|
|
76
|
+
const { DeleteMessageCommand } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-sqs")));
|
|
77
|
+
const params = {
|
|
78
|
+
QueueUrl: queueUrl,
|
|
79
|
+
ReceiptHandle: recipientHandle,
|
|
80
|
+
};
|
|
81
|
+
const sendData = await this.client.send(new DeleteMessageCommand(params));
|
|
82
|
+
return sendData;
|
|
83
|
+
};
|
|
84
|
+
this.isEventSqs = async (event) => {
|
|
85
|
+
await this.ensureInit();
|
|
86
|
+
let response = false;
|
|
87
|
+
if (undefined !== event["Records"]) {
|
|
88
|
+
for (let i = 0; i < event['Records'].length; i++) {
|
|
89
|
+
// todo: Complete
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return response;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.AwsSqsNamespace = AwsSqsNamespace;
|
package/aws/sqs/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awsSqsClient = void 0;
|
|
4
|
+
const AwsSqsNamespace_1 = require("./AwsSqsNamespace");
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const awsSqsNamespaces = new Map();
|
|
7
|
+
const awsSqsClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (awsSqsNamespaces.has(key)) {
|
|
9
|
+
return awsSqsNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
const instanceConfig = await (0, index_1.getConfig)(key, config, vaultId, itemId);
|
|
12
|
+
const namespace = new AwsSqsNamespace_1.AwsSqsNamespace(key, instanceConfig);
|
|
13
|
+
awsSqsNamespaces.set(key, namespace);
|
|
14
|
+
return namespace;
|
|
15
|
+
};
|
|
16
|
+
exports.awsSqsClient = awsSqsClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseNamespace } from "../../_class";
|
|
2
|
+
import { AwsConfig } from "../index";
|
|
3
|
+
import type { SSMClient } from "@aws-sdk/client-ssm";
|
|
4
|
+
export declare class AwsSsmNamespace extends BaseNamespace {
|
|
5
|
+
client: SSMClient | null;
|
|
6
|
+
config: AwsConfig;
|
|
7
|
+
parameters: Map<string, any>;
|
|
8
|
+
constructor(key: string, config: any);
|
|
9
|
+
ensureInit: () => Promise<void>;
|
|
10
|
+
getParameter: (name: string, withDecryption?: boolean, isJson?: boolean) => Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AwsSsmNamespace = void 0;
|
|
37
|
+
const _class_1 = require("../../_class");
|
|
38
|
+
class AwsSsmNamespace extends _class_1.BaseNamespace {
|
|
39
|
+
constructor(key, config) {
|
|
40
|
+
super(key, config);
|
|
41
|
+
this.client = null;
|
|
42
|
+
this.ensureInit = async () => {
|
|
43
|
+
if (!this.client) {
|
|
44
|
+
try {
|
|
45
|
+
const { SSMClient } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-ssm")));
|
|
46
|
+
this.client = new SSMClient(this.config);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new Error("AWS SSM Client not installed");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.getParameter = async (name, withDecryption = false, isJson = true) => {
|
|
54
|
+
await this.ensureInit();
|
|
55
|
+
if (!this.parameters.has(name)) {
|
|
56
|
+
const { GetParameterCommand } = await Promise.resolve().then(() => __importStar(require("@aws-sdk/client-ssm")));
|
|
57
|
+
const apiResponse = await this.client.send(new GetParameterCommand({
|
|
58
|
+
Name: name,
|
|
59
|
+
WithDecryption: undefined === withDecryption ? true : withDecryption,
|
|
60
|
+
}));
|
|
61
|
+
if (apiResponse.Parameter.Value) {
|
|
62
|
+
// Value is undefined
|
|
63
|
+
if (undefined === apiResponse.Parameter.Value) {
|
|
64
|
+
this.parameters.set(name, null);
|
|
65
|
+
}
|
|
66
|
+
// Value is defined
|
|
67
|
+
else {
|
|
68
|
+
// isJson is default - decode
|
|
69
|
+
if (undefined === isJson || true === isJson) {
|
|
70
|
+
this.parameters.set(name, JSON.parse(apiResponse.Parameter.Value) || null);
|
|
71
|
+
}
|
|
72
|
+
// Not JSON don't decode
|
|
73
|
+
else {
|
|
74
|
+
this.parameters.set(name, apiResponse.Parameter.Value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Value not found (null so it can be sent from server to front end)
|
|
79
|
+
else {
|
|
80
|
+
this.parameters.set(name, null);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Return the loaded result
|
|
84
|
+
return this.parameters.get(name);
|
|
85
|
+
};
|
|
86
|
+
this.parameters = new Map();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.AwsSsmNamespace = AwsSsmNamespace;
|
package/aws/ssm/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awsSsmClient = void 0;
|
|
4
|
+
const AwsSsmNamespace_1 = require("./AwsSsmNamespace");
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const awsSsmNamespaces = new Map();
|
|
7
|
+
const awsSsmClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (awsSsmNamespaces.has(key)) {
|
|
9
|
+
return awsSsmNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
const instanceConfig = await (0, index_1.getConfig)(key, config, vaultId, itemId);
|
|
12
|
+
const namespace = new AwsSsmNamespace_1.AwsSsmNamespace(key, instanceConfig);
|
|
13
|
+
awsSsmNamespaces.set(key, namespace);
|
|
14
|
+
return namespace;
|
|
15
|
+
};
|
|
16
|
+
exports.awsSsmClient = awsSsmClient;
|