@allthings/cloud-toolkit 1.1.0-dev.2 → 1.2.0-dev.0

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.
@@ -1,4 +1,3 @@
1
- import parameterStore, { DEFAULT_CLIENT_CONFIG as DEFAULT_PARAMETER_STORE_CLIENT_CONFIG, IParameterStore } from './parameterStore';
2
- import ses, { DEFAULT_CLIENT_CONFIG as DEFAULT_SES_CLIENT_CONFIG, IEmailAttachment, IEmailOptions, ISES } from './ses';
3
- export { DEFAULT_SES_CLIENT_CONFIG, IEmailAttachment, IEmailOptions, ISES, ses };
4
- export { DEFAULT_PARAMETER_STORE_CLIENT_CONFIG, IParameterStore, parameterStore, };
1
+ export { ILambda, default as lambda, TInvokeLambda } from './lambda';
2
+ export { DEFAULT_CLIENT_CONFIG as DEFAULT_PARAMETER_STORE_CLIENT_CONFIG, IParameterStore, default as parameterStore, TGetSecret, TGetSecrets, } from './parameterStore';
3
+ export { DEFAULT_CLIENT_CONFIG as DEFAULT_SES_CLIENT_CONFIG, IEmailAttachment, IEmailOptions, ISES, default as ses, TSendMail, } from './ses';
@@ -0,0 +1,13 @@
1
+ import { InvocationType, LambdaClient, LambdaClientConfig } from '@aws-sdk/client-lambda';
2
+ import { TAWSLogger } from './types';
3
+ export interface ILambda {
4
+ clientConfig?: LambdaClientConfig;
5
+ functionName: string;
6
+ logger?: TAWSLogger;
7
+ }
8
+ export type TInvokeLambda = (invocationType: InvocationType, payload: object) => Promise<boolean>;
9
+ declare const invokeLambda: (lambdaClient: LambdaClient, config: ILambda, invocationType: InvocationType, payload: object) => Promise<boolean>;
10
+ declare const lambda: (userConfig: ILambda) => {
11
+ invokeLambda: TInvokeLambda;
12
+ };
13
+ export default lambda;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,19 @@
1
1
  import { SSMClient, SSMClientConfig } from '@aws-sdk/client-ssm';
2
+ import { TAWSLogger } from './types';
2
3
  export interface IParameterStore {
3
4
  clientConfig?: SSMClientConfig;
4
5
  endpoint?: string;
5
- logger?: (messageType: 'error' | 'info' | 'log', message: string) => void;
6
+ logger?: TAWSLogger;
6
7
  onlyDefault?: boolean;
7
8
  prefix?: string;
8
9
  }
10
+ export type TGetSecret = (parameter: string, defaultValue?: string) => Promise<string>;
11
+ export type TGetSecrets = (parameters: string[], defaultValue?: string) => Promise<string[]>;
9
12
  export declare const DEFAULT_CLIENT_CONFIG: IParameterStore;
10
13
  declare const getSecrets: (ssm: SSMClient, config: IParameterStore, parameters_: string[], defaultValue: string) => Promise<string[]>;
11
14
  declare const getSecret: (ssm: SSMClient, config: IParameterStore, parameter_: string, defaultValue: string) => Promise<string>;
12
15
  declare const parameterStore: (userConfig: IParameterStore) => {
13
- getSecret: (parameter: string, defaultValue?: string) => Promise<string>;
14
- getSecrets: (parameters: string[], defaultValue?: string) => Promise<string[]>;
16
+ getSecret: TGetSecret;
17
+ getSecrets: TGetSecrets;
15
18
  };
16
19
  export default parameterStore;
@@ -3,6 +3,7 @@
3
3
  /// <reference types="node" />
4
4
  import * as aws from '@aws-sdk/client-ses';
5
5
  import { Transporter } from 'nodemailer';
6
+ import { TAWSLogger } from './types';
6
7
  export interface ISES {
7
8
  clientConfig?: aws.SESClientConfig;
8
9
  customSMTPConfig?: {
@@ -10,7 +11,7 @@ export interface ISES {
10
11
  port: number;
11
12
  secure: boolean;
12
13
  };
13
- logger?: (messageType: 'error' | 'info' | 'log', message: string) => void;
14
+ logger?: TAWSLogger;
14
15
  }
15
16
  export declare const DEFAULT_CLIENT_CONFIG: ISES;
16
17
  export interface IEmailAttachment {
@@ -25,8 +26,9 @@ export interface IEmailOptions {
25
26
  readonly text?: string;
26
27
  readonly to: string | readonly string[];
27
28
  }
29
+ export type TSendMail = (options: IEmailOptions) => Promise<boolean>;
28
30
  declare const sendMail: (config: ISES, transport: Transporter, options: IEmailOptions, from: string) => Promise<boolean>;
29
31
  declare const ses: (fromEmailAddress: string, userConfig: ISES) => {
30
- sendMail: (options: IEmailOptions) => Promise<boolean>;
32
+ sendMail: TSendMail;
31
33
  };
32
34
  export default ses;
@@ -0,0 +1 @@
1
+ export type TAWSLogger = (messageType: 'error' | 'info' | 'log', message: string) => void;
@@ -1 +1 @@
1
- export { DEFAULT_PARAMETER_STORE_CLIENT_CONFIG, DEFAULT_SES_CLIENT_CONFIG, IEmailAttachment, IEmailOptions, IParameterStore, ISES, parameterStore, ses, } from './aws';
1
+ export { DEFAULT_PARAMETER_STORE_CLIENT_CONFIG, DEFAULT_SES_CLIENT_CONFIG, IEmailAttachment, IEmailOptions, ILambda, IParameterStore, ISES, lambda, parameterStore, ses, TGetSecret, TGetSecrets, TInvokeLambda, TSendMail, } from './aws';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allthings/cloud-toolkit",
3
- "version": "1.1.0-dev.2",
3
+ "version": "1.2.0-dev.0",
4
4
  "description": "",
5
5
  "author": "Allthings GmbH",
6
6
  "keywords": [
@@ -50,6 +50,7 @@
50
50
  "serve": "npx serve -l 3333"
51
51
  },
52
52
  "dependencies": {
53
+ "@aws-sdk/client-lambda": "3.688.0",
53
54
  "@aws-sdk/client-ses": "3.687.0",
54
55
  "@aws-sdk/client-ssm": "3.682.0",
55
56
  "bottleneck": "2.19.5",
@@ -140,7 +141,8 @@
140
141
  },
141
142
  "coveragePathIgnorePatterns": [
142
143
  "/node_modules/",
143
- "/test/"
144
+ "/test/",
145
+ "src/aws/index.ts"
144
146
  ]
145
147
  },
146
148
  "release": {