@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.
Files changed (345) hide show
  1. package/.github/workflows/deploy_npmjs.yml +7 -0
  2. package/.yarn/install-state.gz +0 -0
  3. package/_class/BaseClass.d.ts +18 -0
  4. package/_class/BaseClass.js +53 -0
  5. package/_class/BaseNamespace.d.ts +9 -0
  6. package/_class/BaseNamespace.js +27 -0
  7. package/_class/index.d.ts +2 -0
  8. package/_class/index.js +7 -0
  9. package/adverity/getJobs.d.ts +15 -0
  10. package/adverity/getJobs.js +30 -0
  11. package/adverity/index.d.ts +112 -0
  12. package/adverity/index.js +61 -0
  13. package/api/ApiResponseClass.d.ts +35 -0
  14. package/api/ApiResponseClass.js +97 -0
  15. package/api/index.d.ts +22 -0
  16. package/api/index.js +44 -0
  17. package/array/index.d.ts +8 -0
  18. package/array/index.js +17 -0
  19. package/atInternet/index.d.ts +16 -0
  20. package/atInternet/index.js +18 -0
  21. package/aws/athenaExpress/AwsAthenaNamespace.d.ts +8 -0
  22. package/aws/athenaExpress/AwsAthenaNamespace.js +82 -0
  23. package/aws/athenaExpress/index.d.ts +10 -0
  24. package/aws/athenaExpress/index.js +40 -0
  25. package/aws/ec2/AwsEc2Namespace.d.ts +10 -0
  26. package/aws/ec2/AwsEc2Namespace.js +78 -0
  27. package/aws/ec2/index.d.ts +3 -0
  28. package/aws/ec2/index.js +16 -0
  29. package/aws/ecs/AwsEcsNamespace.d.ts +53 -0
  30. package/aws/ecs/AwsEcsNamespace.js +159 -0
  31. package/aws/ecs/index.d.ts +3 -0
  32. package/aws/ecs/index.js +16 -0
  33. package/aws/glue/AwsGlueNamespace.d.ts +12 -0
  34. package/aws/glue/AwsGlueNamespace.js +70 -0
  35. package/aws/glue/index.d.ts +3 -0
  36. package/aws/glue/index.js +16 -0
  37. package/aws/index.d.ts +9 -0
  38. package/aws/index.js +34 -0
  39. package/aws/isResponse200.d.ts +4 -0
  40. package/aws/isResponse200.js +16 -0
  41. package/aws/lambda/AwsLambdaNamespace.d.ts +21 -0
  42. package/aws/lambda/AwsLambdaNamespace.js +110 -0
  43. package/aws/lambda/index.d.ts +4 -0
  44. package/aws/lambda/index.js +21 -0
  45. package/aws/s3/AwsS3Namespace.d.ts +60 -0
  46. package/aws/s3/AwsS3Namespace.js +401 -0
  47. package/aws/s3/index.d.ts +25 -0
  48. package/aws/s3/index.js +36 -0
  49. package/aws/s3/payload.d.ts +42 -0
  50. package/aws/s3/payload.js +46 -0
  51. package/aws/ses/AwsSesNamespace.d.ts +18 -0
  52. package/aws/ses/AwsSesNamespace.js +69 -0
  53. package/aws/ses/SimpleEmail.d.ts +56 -0
  54. package/aws/ses/SimpleEmail.js +106 -0
  55. package/aws/ses/index.d.ts +4 -0
  56. package/aws/ses/index.js +18 -0
  57. package/aws/sqs/AwsSqsNamespace.d.ts +34 -0
  58. package/aws/sqs/AwsSqsNamespace.js +96 -0
  59. package/aws/sqs/index.d.ts +3 -0
  60. package/aws/sqs/index.js +16 -0
  61. package/aws/ssm/AwsSsmNamespace.d.ts +11 -0
  62. package/aws/ssm/AwsSsmNamespace.js +89 -0
  63. package/aws/ssm/index.d.ts +3 -0
  64. package/aws/ssm/index.js +16 -0
  65. package/axios/deleteRequest.d.ts +6 -0
  66. package/axios/deleteRequest.js +33 -0
  67. package/axios/get.d.ts +5 -0
  68. package/axios/get.js +31 -0
  69. package/axios/index.d.ts +3 -0
  70. package/axios/index.js +9 -0
  71. package/axios/post.d.ts +5 -0
  72. package/axios/post.js +32 -0
  73. package/boolean/getBoolean.d.ts +4 -0
  74. package/boolean/getBoolean.js +23 -0
  75. package/boolean/index.d.ts +1 -0
  76. package/boolean/index.js +5 -0
  77. package/brightData/index.d.ts +15 -0
  78. package/brightData/index.js +20 -0
  79. package/brightData/serpApi/buildGoogleSerpUrl.d.ts +32 -0
  80. package/brightData/serpApi/buildGoogleSerpUrl.js +116 -0
  81. package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +22 -0
  82. package/brightData/serpApi/buildGoogleTrendsUrl.js +61 -0
  83. package/brightData/serpApi/getAsyncRequestId.d.ts +8 -0
  84. package/brightData/serpApi/getAsyncRequestId.js +36 -0
  85. package/brightData/serpApi/getAsyncResults.d.ts +7 -0
  86. package/brightData/serpApi/getAsyncResults.js +35 -0
  87. package/brightData/serpApi/getRealtime.d.ts +5 -0
  88. package/brightData/serpApi/getRealtime.js +30 -0
  89. package/brightData/serpApi/index.d.ts +14 -0
  90. package/brightData/serpApi/index.js +23 -0
  91. package/brightData/webScraperIde/getBatch.d.ts +7 -0
  92. package/brightData/webScraperIde/getBatch.js +28 -0
  93. package/brightData/webScraperIde/getRealtime.d.ts +7 -0
  94. package/brightData/webScraperIde/getRealtime.js +49 -0
  95. package/brightData/webScraperIde/index.d.ts +2 -0
  96. package/brightData/webScraperIde/index.js +7 -0
  97. package/cache/index.d.ts +2 -0
  98. package/cache/index.js +48 -0
  99. package/cache/test/cache.test.d.ts +1 -0
  100. package/cache/test/cache.test.js +10 -0
  101. package/crud/index.d.ts +6 -0
  102. package/crud/index.js +10 -0
  103. package/crypto/getDecrypt.d.ts +5 -0
  104. package/crypto/getDecrypt.js +47 -0
  105. package/crypto/getEncrypt.d.ts +5 -0
  106. package/crypto/getEncrypt.js +47 -0
  107. package/crypto/getRandom.d.ts +4 -0
  108. package/crypto/getRandom.js +12 -0
  109. package/crypto/getSha256.d.ts +5 -0
  110. package/crypto/getSha256.js +48 -0
  111. package/crypto/index.d.ts +4 -0
  112. package/crypto/index.js +11 -0
  113. package/date/calculation.d.ts +75 -0
  114. package/date/calculation.js +207 -0
  115. package/date/financialYear.d.ts +19 -0
  116. package/date/financialYear.js +85 -0
  117. package/date/format.d.ts +68 -0
  118. package/date/format.js +150 -0
  119. package/date/index.d.ts +35 -0
  120. package/date/index.js +57 -0
  121. package/environment/index.d.ts +32 -0
  122. package/environment/index.js +92 -0
  123. package/eskimi/getAgeGroup.d.ts +4 -0
  124. package/eskimi/getAgeGroup.js +15 -0
  125. package/eskimi/getData.d.ts +4 -0
  126. package/eskimi/getData.js +17 -0
  127. package/eskimi/getDevice.d.ts +4 -0
  128. package/eskimi/getDevice.js +15 -0
  129. package/eskimi/getGender.d.ts +4 -0
  130. package/eskimi/getGender.js +15 -0
  131. package/eskimi/index.d.ts +49 -0
  132. package/eskimi/index.js +96 -0
  133. package/file/createDirectory.d.ts +5 -0
  134. package/file/createDirectory.js +50 -0
  135. package/file/index.d.ts +1 -0
  136. package/file/index.js +5 -0
  137. package/geo/countries.d.ts +12 -0
  138. package/geo/countries.js +222 -0
  139. package/geo/index.d.ts +2 -0
  140. package/geo/index.js +7 -0
  141. package/geo/languages.d.ts +9 -0
  142. package/geo/languages.js +58 -0
  143. package/google/bigQuery/GoogleBigQueryNamespace.d.ts +51 -0
  144. package/google/bigQuery/GoogleBigQueryNamespace.js +165 -0
  145. package/google/bigQuery/index.d.ts +5 -0
  146. package/google/bigQuery/index.js +37 -0
  147. package/google/bigQuery/loadData.d.ts +19 -0
  148. package/google/bigQuery/loadData.js +18 -0
  149. package/google/index.d.ts +27 -0
  150. package/google/index.js +24 -0
  151. package/google/sheets/GoogleSheetsNamespace.d.ts +16 -0
  152. package/google/sheets/GoogleSheetsNamespace.js +81 -0
  153. package/google/sheets/getAssociatedData.d.ts +10 -0
  154. package/google/sheets/getAssociatedData.js +43 -0
  155. package/google/sheets/index.d.ts +8 -0
  156. package/google/sheets/index.js +37 -0
  157. package/google/storage/GoogleCloudStorageNamespace.d.ts +20 -0
  158. package/google/storage/GoogleCloudStorageNamespace.js +108 -0
  159. package/google/storage/index.d.ts +3 -0
  160. package/google/storage/index.js +30 -0
  161. package/googleAds/GoogleAdsNamespace.d.ts +11 -0
  162. package/googleAds/GoogleAdsNamespace.js +73 -0
  163. package/googleAds/index.d.ts +11 -0
  164. package/googleAds/index.js +30 -0
  165. package/googleAds/keywordPlanner/index.d.ts +40 -0
  166. package/googleAds/keywordPlanner/index.js +59 -0
  167. package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +11 -0
  168. package/googlePageSpeed/GooglePageSpeedNamespace.js +35 -0
  169. package/googlePageSpeed/index.d.ts +17 -0
  170. package/googlePageSpeed/index.js +44 -0
  171. package/googleSearchIncidents/index.d.ts +69 -0
  172. package/googleSearchIncidents/index.js +46 -0
  173. package/greenDomain/index.d.ts +21 -0
  174. package/greenDomain/index.js +41 -0
  175. package/inngest/index.d.ts +6 -0
  176. package/inngest/index.js +10 -0
  177. package/json/getJsonNewline.d.ts +1 -0
  178. package/json/getJsonNewline.js +13 -0
  179. package/json/index.d.ts +2 -0
  180. package/json/index.js +7 -0
  181. package/json/isJson.d.ts +1 -0
  182. package/json/isJson.js +26 -0
  183. package/littleWarden/LittleWardenNamespace.d.ts +11 -0
  184. package/littleWarden/LittleWardenNamespace.js +38 -0
  185. package/littleWarden/getUrlStatus.d.ts +4 -0
  186. package/littleWarden/getUrlStatus.js +16 -0
  187. package/littleWarden/index.d.ts +29 -0
  188. package/littleWarden/index.js +74 -0
  189. package/lumar/api/buildRequest.d.ts +13 -0
  190. package/lumar/api/buildRequest.js +80 -0
  191. package/lumar/api/getData.d.ts +5 -0
  192. package/lumar/api/getData.js +13 -0
  193. package/lumar/api/index.d.ts +36 -0
  194. package/lumar/api/index.js +33 -0
  195. package/lumar/api/initClient.d.ts +6 -0
  196. package/lumar/api/initClient.js +26 -0
  197. package/lumar/graphql/columns.d.ts +28 -0
  198. package/lumar/graphql/columns.js +31 -0
  199. package/lumar/graphql/getData.d.ts +1 -0
  200. package/lumar/graphql/getData.js +20 -0
  201. package/lumar/graphql/index.d.ts +29 -0
  202. package/lumar/graphql/index.js +39 -0
  203. package/lumar/graphql/initClient.d.ts +5 -0
  204. package/lumar/graphql/initClient.js +25 -0
  205. package/lumar/graphql/queries/crawl.d.ts +5 -0
  206. package/lumar/graphql/queries/crawl.js +2 -0
  207. package/lumar/graphql/queries/getCrawls.d.ts +18 -0
  208. package/lumar/graphql/queries/getCrawls.js +33 -0
  209. package/lumar/graphql/queries/getReportDifferences.d.ts +24 -0
  210. package/lumar/graphql/queries/getReportDifferences.js +37 -0
  211. package/lumar/graphql/queries/getRows.d.ts +38 -0
  212. package/lumar/graphql/queries/getRows.js +57 -0
  213. package/lumar/graphql/queries/getTotals.d.ts +25 -0
  214. package/lumar/graphql/queries/getTotals.js +40 -0
  215. package/lumar/graphql/queries/row.d.ts +157 -0
  216. package/lumar/graphql/queries/row.js +2 -0
  217. package/lumar/graphql/reportTemplates.d.ts +67 -0
  218. package/lumar/graphql/reportTemplates.js +70 -0
  219. package/myTarget/request.d.ts +5 -0
  220. package/myTarget/request.js +17 -0
  221. package/nextAuth/index.d.ts +6 -0
  222. package/nextAuth/index.js +11 -0
  223. package/nextAuth/isSessionReady.d.ts +1 -0
  224. package/nextAuth/isSessionReady.js +13 -0
  225. package/nextJs/getIp.d.ts +6 -0
  226. package/nextJs/getIp.js +14 -0
  227. package/nextJs/getUserAgent.d.ts +6 -0
  228. package/nextJs/getUserAgent.js +8 -0
  229. package/nextJs/index.d.ts +2 -0
  230. package/nextJs/index.js +7 -0
  231. package/number/format.d.ts +12 -0
  232. package/number/format.js +20 -0
  233. package/number/formatCurrency.d.ts +5 -0
  234. package/number/formatCurrency.js +21 -0
  235. package/number/getDecimal.d.ts +4 -0
  236. package/number/getDecimal.js +12 -0
  237. package/number/getNumber.d.ts +4 -0
  238. package/number/getNumber.js +48 -0
  239. package/number/getPercentIncrease.d.ts +4 -0
  240. package/number/getPercentIncrease.js +16 -0
  241. package/number/getSafeDivide.d.ts +11 -0
  242. package/number/getSafeDivide.js +20 -0
  243. package/number/index.d.ts +6 -0
  244. package/number/index.js +15 -0
  245. package/object/index.d.ts +1 -0
  246. package/object/index.js +5 -0
  247. package/object/replaceKeys.d.ts +5 -0
  248. package/object/replaceKeys.js +25 -0
  249. package/onePassword/OnePasswordNamespace.d.ts +13 -0
  250. package/onePassword/OnePasswordNamespace.js +81 -0
  251. package/onePassword/index.d.ts +7 -0
  252. package/onePassword/index.js +25 -0
  253. package/openAi/OpenAiNamespace.d.ts +11 -0
  254. package/openAi/OpenAiNamespace.js +44 -0
  255. package/openAi/index.d.ts +5 -0
  256. package/openAi/index.js +30 -0
  257. package/package.json +2 -2
  258. package/prisma/PrismaNamespace.d.ts +8 -0
  259. package/prisma/PrismaNamespace.js +79 -0
  260. package/prisma/getDecimal.d.ts +4 -0
  261. package/prisma/getDecimal.js +23 -0
  262. package/prisma/index.d.ts +8 -0
  263. package/prisma/index.js +29 -0
  264. package/snapchat/SnapchatNamespace.d.ts +15 -0
  265. package/snapchat/SnapchatNamespace.js +30 -0
  266. package/snapchat/index.d.ts +7 -0
  267. package/snapchat/index.js +30 -0
  268. package/sorting/byNumberAscending.d.ts +4 -0
  269. package/sorting/byNumberAscending.js +19 -0
  270. package/sorting/byNumberDescending.d.ts +4 -0
  271. package/sorting/byNumberDescending.js +22 -0
  272. package/sorting/byStringAscending.d.ts +4 -0
  273. package/sorting/byStringAscending.js +16 -0
  274. package/sorting/byStringDescending.d.ts +4 -0
  275. package/sorting/byStringDescending.js +16 -0
  276. package/sorting/index.d.ts +4 -0
  277. package/sorting/index.js +11 -0
  278. package/stream/index.d.ts +1 -0
  279. package/stream/index.js +5 -0
  280. package/stream/sort.d.ts +13 -0
  281. package/stream/sort.js +51 -0
  282. package/string/getCapitalised.d.ts +5 -0
  283. package/string/getCapitalised.js +18 -0
  284. package/string/getClean.d.ts +18 -0
  285. package/string/getClean.js +51 -0
  286. package/string/getFolder.d.ts +4 -0
  287. package/string/getFolder.js +15 -0
  288. package/string/getProperCase.d.ts +11 -0
  289. package/string/getProperCase.js +25 -0
  290. package/string/getString.d.ts +4 -0
  291. package/string/getString.js +34 -0
  292. package/string/getStringFromStream.d.ts +5 -0
  293. package/string/getStringFromStream.js +17 -0
  294. package/string/getUnescaped.d.ts +6 -0
  295. package/string/getUnescaped.js +26 -0
  296. package/string/getWithoutAccents.d.ts +5 -0
  297. package/string/getWithoutAccents.js +13 -0
  298. package/string/getWithoutHtmlTags.d.ts +5 -0
  299. package/string/getWithoutHtmlTags.js +12 -0
  300. package/string/getWithoutPunctuation.d.ts +5 -0
  301. package/string/getWithoutPunctuation.js +13 -0
  302. package/string/getWithoutUnderscores.d.ts +4 -0
  303. package/string/getWithoutUnderscores.js +11 -0
  304. package/string/getWithoutWhitespaces.d.ts +5 -0
  305. package/string/getWithoutWhitespaces.js +13 -0
  306. package/string/index.d.ts +12 -0
  307. package/string/index.js +27 -0
  308. package/swr/index.d.ts +42 -0
  309. package/swr/index.js +59 -0
  310. package/upTimeRobot/UpTimeRobotNamespace.d.ts +31 -0
  311. package/upTimeRobot/UpTimeRobotNamespace.js +52 -0
  312. package/upTimeRobot/index.d.ts +38 -0
  313. package/upTimeRobot/index.js +63 -0
  314. package/url/index.d.ts +19 -0
  315. package/url/index.js +70 -0
  316. package/url/writeUrlContents.d.ts +6 -0
  317. package/url/writeUrlContents.js +75 -0
  318. package/util/defaultTo.d.ts +4 -0
  319. package/util/defaultTo.js +44 -0
  320. package/util/getBrotliCompressed.d.ts +5 -0
  321. package/util/getBrotliCompressed.js +23 -0
  322. package/util/getBrotliDecompressed.d.ts +5 -0
  323. package/util/getBrotliDecompressed.js +24 -0
  324. package/util/getClean.d.ts +11 -0
  325. package/util/getClean.js +23 -0
  326. package/util/getGzipCompressed.d.ts +5 -0
  327. package/util/getGzipCompressed.js +23 -0
  328. package/util/getGzipDecompressed.d.ts +5 -0
  329. package/util/getGzipDecompressed.js +24 -0
  330. package/util/getWithoutHash.d.ts +4 -0
  331. package/util/getWithoutHash.js +18 -0
  332. package/util/getWithoutParameter.d.ts +4 -0
  333. package/util/getWithoutParameter.js +18 -0
  334. package/util/index.d.ts +11 -0
  335. package/util/index.js +25 -0
  336. package/util/isUndefined.d.ts +4 -0
  337. package/util/isUndefined.js +13 -0
  338. package/util/promiseChunks.d.ts +5 -0
  339. package/util/promiseChunks.js +19 -0
  340. package/util/sleep.d.ts +1 -0
  341. package/util/sleep.js +7 -0
  342. package/webWorker/index.d.ts +5 -0
  343. package/webWorker/index.js +9 -0
  344. package/xml/getXml.d.ts +1 -0
  345. 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";
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { AwsSqsNamespace } from "./AwsSqsNamespace";
2
+ import { AwsConfig } from "../index";
3
+ export declare const awsSqsClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsSqsNamespace>;
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { AwsSsmNamespace } from "./AwsSsmNamespace";
2
+ import { AwsConfig } from "../index";
3
+ export declare const awsSsmClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsSsmNamespace>;
@@ -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;
@@ -0,0 +1,6 @@
1
+ import { ApiResponseClass } from "../api";
2
+ /**
3
+ * Make a DELETE request.
4
+ * Can't use the function name delete as it's reserved
5
+ */
6
+ export declare const deleteRequest: (url: string, config?: {}) => Promise<ApiResponseClass>;