@node-in-layers/aws 1.0.9 → 1.1.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/README.md +26 -0
- package/aws/services.js +8 -6
- package/aws/services.js.map +1 -1
- package/config/features.d.ts +114 -64
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +5 -4
- package/types.d.ts +28 -13
- package/types.js +3 -3
- package/types.js.map +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,32 @@ This package has a number of apps that assist with using AWS.
|
|
|
8
8
|
npm install @node-in-layers/aws
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Core
|
|
12
|
+
|
|
13
|
+
The core domain provides the ability to get a configured AWS 3 client based on your configs.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { CoreNamespace } from '@node-in-layers/core/index.js'
|
|
17
|
+
import { AwsNamespace, AwsService } from '@node-in-layers/aws/types.js'
|
|
18
|
+
|
|
19
|
+
// Add the aws core app so context.services[AwsNamespace.root].aws3 is available
|
|
20
|
+
const core = {
|
|
21
|
+
apps: [import('@node-in-layers/aws/index.js')],
|
|
22
|
+
layerOrder: ['services', 'features'],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Optional: limit services or pass AWS client options (Aws3PartialConfig)
|
|
26
|
+
const awsConfig = {
|
|
27
|
+
[AwsNamespace.root]: {
|
|
28
|
+
services: [AwsService.s3, AwsService.ssm, AwsService.secretsManager],
|
|
29
|
+
awsClientProps: { region: 'us-east-1' },
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// In a layer, use the configured client from context
|
|
34
|
+
// const { s3, ssm, secretsManager } = context.services[AwsNamespace.root].aws3
|
|
35
|
+
```
|
|
36
|
+
|
|
11
37
|
## Config
|
|
12
38
|
|
|
13
39
|
The config app provides the ability to have configurations inside a config file that use values from Parameter store and Secrets manager. In order to do this, the config app provides a globals file, that will take your configuration object, see if there are parameter store and secrets manager objects in it. If there are, it will reach out to each of those services to find and the replace them within the config.
|
package/aws/services.js
CHANGED
|
@@ -3,6 +3,7 @@ import merge from 'lodash/merge.js';
|
|
|
3
3
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
4
4
|
import * as ecs from '@aws-sdk/client-ecs';
|
|
5
5
|
import * as s3 from '@aws-sdk/client-s3';
|
|
6
|
+
import * as sqs from '@aws-sdk/client-sqs';
|
|
6
7
|
import * as dynamo from '@aws-sdk/client-dynamodb';
|
|
7
8
|
import * as libDynamo from '@aws-sdk/lib-dynamodb';
|
|
8
9
|
import * as ssm from '@aws-sdk/client-ssm';
|
|
@@ -25,20 +26,21 @@ const _awsServiceToBuilder = {
|
|
|
25
26
|
[AwsService.secretsManager]: awsConfig => ({
|
|
26
27
|
secretsManager: Object.assign({ secretsManagerClient: new secretsManager.SecretsManagerClient(awsConfig) }, secretsManager),
|
|
27
28
|
}),
|
|
29
|
+
[AwsService.sqs]: awsConfig => ({
|
|
30
|
+
sqs: Object.assign({ sqsClient: new sqs.SQSClient(awsConfig) }, sqs),
|
|
31
|
+
}),
|
|
28
32
|
};
|
|
29
33
|
const createAws3Client = memoizeValueSync((config) => {
|
|
30
|
-
var _a, _b;
|
|
34
|
+
var _a, _b, _c;
|
|
31
35
|
const sslAgent = ((_a = config[AwsNamespace.root]) === null || _a === void 0 ? void 0 : _a.httpsAgent) ||
|
|
32
36
|
new https.Agent({
|
|
33
37
|
keepAlive: true,
|
|
34
38
|
maxSockets: 50,
|
|
35
39
|
});
|
|
36
|
-
const awsConfig = {
|
|
37
|
-
httpOptions: {
|
|
40
|
+
const awsConfig = Object.assign({ httpOptions: {
|
|
38
41
|
agent: sslAgent,
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const services = ((_b = config[AwsNamespace.root]) === null || _b === void 0 ? void 0 : _b.services) || Object.values(AwsService);
|
|
42
|
+
} }, (_b = config[AwsNamespace.root]) === null || _b === void 0 ? void 0 : _b.awsClientProps);
|
|
43
|
+
const services = ((_c = config[AwsNamespace.root]) === null || _c === void 0 ? void 0 : _c.services) || Object.values(AwsService);
|
|
42
44
|
const aws3 = services.reduce((acc, service) => {
|
|
43
45
|
const obj = _awsServiceToBuilder[service](awsConfig);
|
|
44
46
|
return merge(acc, obj);
|
package/aws/services.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/aws/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,cAAc,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAGL,YAAY,EACZ,UAAU,GAEX,MAAM,aAAa,CAAA;AAEpB,MAAM,oBAAoB,GAAgD;IACxE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,EAAE,kBACA,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IACjC,EAAE,CACN;KACF,CAAC;IACF,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QAC9B,GAAG,kBACD,SAAS,EAAE,IAAI,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IACpC,GAAG,CACP;KACF,CAAC;IACF,CAAC,UAAU,CAAC,GAAG,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P;KACF,CAAC;CACH,CAAA;AAED,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,MAAkB,EAAQ,EAAE;;IACrE,MAAM,QAAQ,GACZ,CAAA,MAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,0CAAE,UAAU;QACrC,IAAI,KAAK,CAAC,KAAK,CAAC;YACd,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,EAAE;SACf,CAAC,CAAA;IACJ,MAAM,SAAS,mBACb,WAAW,EAAE;YACX,KAAK,EAAE,QAAQ;SAChB,IACE,MAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,0CAAE,cAAc,CAC7C,CAAA;IAED,MAAM,QAAQ,GACZ,CAAA,MAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,0CAAE,QAAQ,KAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAElE,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,GAAG,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAA;QACpD,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACxB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,IAAY,CAAA;AACrB,CAAC,CAAC,CAAA;AAEF,MAAM,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAe,EAAE;IACzC,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACrC,OAAO;QACL,IAAI;KACL,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAA"}
|
package/config/features.d.ts
CHANGED
|
@@ -4,12 +4,36 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
4
4
|
replaceAwsConfigObjects: <TConfig extends Readonly<{
|
|
5
5
|
systemName: string;
|
|
6
6
|
environment: string;
|
|
7
|
-
"@node-in-layers/core": {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
"@node-in-layers/core": Readonly<{
|
|
8
|
+
logging: {
|
|
9
|
+
logLevel: import("@node-in-layers/core/types.js").LogLevelNames;
|
|
10
|
+
logFormat: import("@node-in-layers/core/types.js").LogFormat | readonly import("@node-in-layers/core/types.js").LogFormat[];
|
|
11
|
+
maxLogSizeInCharacters?: number | undefined;
|
|
12
|
+
tcpLoggingOptions?: Readonly<{
|
|
13
|
+
url: string;
|
|
14
|
+
headers?: Record<string, string | object> | undefined;
|
|
15
|
+
}> | undefined;
|
|
16
|
+
customLogger?: Readonly<{
|
|
17
|
+
getLogger: (context: Readonly<{
|
|
18
|
+
config: Readonly<any>;
|
|
19
|
+
rootLogger: Readonly<any>;
|
|
20
|
+
constants: {
|
|
21
|
+
environment: string;
|
|
22
|
+
workingDirectory: string;
|
|
23
|
+
runtimeId: string;
|
|
24
|
+
};
|
|
25
|
+
}>, props?: {
|
|
26
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
27
|
+
data?: Record<string, any> | undefined;
|
|
28
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
29
|
+
}> | undefined;
|
|
30
|
+
getFunctionWrapLogLevel?: ((layerName: string, functionName?: string | undefined) => import("@node-in-layers/core/types.js").LogLevelNames) | undefined;
|
|
31
|
+
ignoreLayerFunctions?: Record<string, boolean | Record<string, boolean | Record<string, boolean>>> | undefined;
|
|
32
|
+
};
|
|
10
33
|
layerOrder: readonly import("@node-in-layers/core/types.js").LayerDescription[];
|
|
11
34
|
apps: readonly Readonly<{
|
|
12
35
|
name: string;
|
|
36
|
+
description?: string | undefined;
|
|
13
37
|
services?: Readonly<{
|
|
14
38
|
create: (context: any) => import("@node-in-layers/core/types.js").MaybePromise<object>;
|
|
15
39
|
}> | undefined;
|
|
@@ -18,38 +42,25 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
18
42
|
}> | undefined;
|
|
19
43
|
globals?: Readonly<{
|
|
20
44
|
create: (context: Readonly<{
|
|
21
|
-
node: Readonly<{
|
|
22
|
-
fs: Readonly<{
|
|
23
|
-
mkdirSync: (path: string, options?: {
|
|
24
|
-
recursive?: boolean | undefined;
|
|
25
|
-
} | undefined) => void;
|
|
26
|
-
readFileSync: (path: string, encoding?: any) => string;
|
|
27
|
-
writeFileSync: (path: string, data: any) => void;
|
|
28
|
-
existsSync: (path: string) => boolean;
|
|
29
|
-
lstatSync: (path: string) => {
|
|
30
|
-
isFile: () => boolean;
|
|
31
|
-
isDirectory: () => boolean;
|
|
32
|
-
isBlockDevice: () => boolean;
|
|
33
|
-
isCharacterDevice: () => boolean;
|
|
34
|
-
isSymbolicLink: () => boolean;
|
|
35
|
-
isFIFO: () => boolean;
|
|
36
|
-
isSocket: () => boolean;
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
39
|
-
}>;
|
|
40
45
|
config: Readonly<any>;
|
|
41
|
-
|
|
42
|
-
getLogger: (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
rootLogger: Readonly<{
|
|
47
|
+
getLogger: (context: Readonly<{
|
|
48
|
+
config: Readonly<any>;
|
|
49
|
+
rootLogger: Readonly<any>;
|
|
50
|
+
constants: {
|
|
51
|
+
environment: string;
|
|
52
|
+
workingDirectory: string;
|
|
53
|
+
runtimeId: string;
|
|
54
|
+
};
|
|
55
|
+
}>, props?: {
|
|
56
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
57
|
+
data?: Record<string, any> | undefined;
|
|
58
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
49
59
|
}>;
|
|
50
60
|
constants: {
|
|
51
61
|
environment: string;
|
|
52
62
|
workingDirectory: string;
|
|
63
|
+
runtimeId: string;
|
|
53
64
|
};
|
|
54
65
|
}>) => Promise<any>;
|
|
55
66
|
}> | undefined;
|
|
@@ -57,6 +68,20 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
57
68
|
create: <T extends Readonly<{
|
|
58
69
|
[s: string]: any;
|
|
59
70
|
}>, TModelExtensions extends object = object, TModelInstanceExtensions extends object = object>(modelProps: Readonly<{
|
|
71
|
+
context: Readonly<{
|
|
72
|
+
config: Readonly<any>;
|
|
73
|
+
rootLogger: Readonly<{
|
|
74
|
+
getLogger: (context: Readonly<any>, props?: {
|
|
75
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
76
|
+
data?: Record<string, any> | undefined;
|
|
77
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
78
|
+
}>;
|
|
79
|
+
constants: {
|
|
80
|
+
environment: string;
|
|
81
|
+
workingDirectory: string;
|
|
82
|
+
runtimeId: string;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
60
85
|
Model: import("functional-models/types.js").ModelFactory<object, object>;
|
|
61
86
|
fetcher: import("functional-models/types.js").ModelInstanceFetcher<object, object>;
|
|
62
87
|
getModel: <T_1 extends Readonly<{
|
|
@@ -69,19 +94,43 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
69
94
|
modelCruds?: boolean | undefined;
|
|
70
95
|
customModelFactory?: {
|
|
71
96
|
[x: string]: {
|
|
72
|
-
[x: string]: string | [string, any[]];
|
|
97
|
+
[x: string]: string | [string, string] | [string, string, any[]];
|
|
73
98
|
};
|
|
74
99
|
} | undefined;
|
|
75
|
-
}
|
|
100
|
+
}>;
|
|
76
101
|
}> = Readonly<{
|
|
77
102
|
systemName: string;
|
|
78
103
|
environment: string;
|
|
79
|
-
"@node-in-layers/core": {
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
"@node-in-layers/core": Readonly<{
|
|
105
|
+
logging: {
|
|
106
|
+
logLevel: import("@node-in-layers/core/types.js").LogLevelNames;
|
|
107
|
+
logFormat: import("@node-in-layers/core/types.js").LogFormat | readonly import("@node-in-layers/core/types.js").LogFormat[];
|
|
108
|
+
maxLogSizeInCharacters?: number | undefined;
|
|
109
|
+
tcpLoggingOptions?: Readonly<{
|
|
110
|
+
url: string;
|
|
111
|
+
headers?: Record<string, string | object> | undefined;
|
|
112
|
+
}> | undefined;
|
|
113
|
+
customLogger?: Readonly<{
|
|
114
|
+
getLogger: (context: Readonly<{
|
|
115
|
+
config: Readonly<any>;
|
|
116
|
+
rootLogger: Readonly<any>;
|
|
117
|
+
constants: {
|
|
118
|
+
environment: string;
|
|
119
|
+
workingDirectory: string;
|
|
120
|
+
runtimeId: string;
|
|
121
|
+
};
|
|
122
|
+
}>, props?: {
|
|
123
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
124
|
+
data?: Record<string, any> | undefined;
|
|
125
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
126
|
+
}> | undefined;
|
|
127
|
+
getFunctionWrapLogLevel?: ((layerName: string, functionName?: string | undefined) => import("@node-in-layers/core/types.js").LogLevelNames) | undefined;
|
|
128
|
+
ignoreLayerFunctions?: Record<string, boolean | Record<string, boolean | Record<string, boolean>>> | undefined;
|
|
129
|
+
};
|
|
82
130
|
layerOrder: readonly import("@node-in-layers/core/types.js").LayerDescription[];
|
|
83
131
|
apps: readonly Readonly<{
|
|
84
132
|
name: string;
|
|
133
|
+
description?: string | undefined;
|
|
85
134
|
services?: Readonly<{
|
|
86
135
|
create: (context: any) => import("@node-in-layers/core/types.js").MaybePromise<object>;
|
|
87
136
|
}> | undefined;
|
|
@@ -90,38 +139,25 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
90
139
|
}> | undefined;
|
|
91
140
|
globals?: Readonly<{
|
|
92
141
|
create: (context: Readonly<{
|
|
93
|
-
node: Readonly<{
|
|
94
|
-
fs: Readonly<{
|
|
95
|
-
mkdirSync: (path: string, options?: {
|
|
96
|
-
recursive?: boolean | undefined;
|
|
97
|
-
} | undefined) => void;
|
|
98
|
-
readFileSync: (path: string, encoding?: any) => string;
|
|
99
|
-
writeFileSync: (path: string, data: any) => void;
|
|
100
|
-
existsSync: (path: string) => boolean;
|
|
101
|
-
lstatSync: (path: string) => {
|
|
102
|
-
isFile: () => boolean;
|
|
103
|
-
isDirectory: () => boolean;
|
|
104
|
-
isBlockDevice: () => boolean;
|
|
105
|
-
isCharacterDevice: () => boolean;
|
|
106
|
-
isSymbolicLink: () => boolean;
|
|
107
|
-
isFIFO: () => boolean;
|
|
108
|
-
isSocket: () => boolean;
|
|
109
|
-
};
|
|
110
|
-
}>;
|
|
111
|
-
}>;
|
|
112
142
|
config: Readonly<any>;
|
|
113
|
-
|
|
114
|
-
getLogger: (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
143
|
+
rootLogger: Readonly<{
|
|
144
|
+
getLogger: (context: Readonly<{
|
|
145
|
+
config: Readonly<any>;
|
|
146
|
+
rootLogger: Readonly<any>;
|
|
147
|
+
constants: {
|
|
148
|
+
environment: string;
|
|
149
|
+
workingDirectory: string;
|
|
150
|
+
runtimeId: string;
|
|
151
|
+
};
|
|
152
|
+
}>, props?: {
|
|
153
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
154
|
+
data?: Record<string, any> | undefined;
|
|
155
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
121
156
|
}>;
|
|
122
157
|
constants: {
|
|
123
158
|
environment: string;
|
|
124
159
|
workingDirectory: string;
|
|
160
|
+
runtimeId: string;
|
|
125
161
|
};
|
|
126
162
|
}>) => Promise<any>;
|
|
127
163
|
}> | undefined;
|
|
@@ -129,6 +165,20 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
129
165
|
create: <T extends Readonly<{
|
|
130
166
|
[s: string]: any;
|
|
131
167
|
}>, TModelExtensions extends object = object, TModelInstanceExtensions extends object = object>(modelProps: Readonly<{
|
|
168
|
+
context: Readonly<{
|
|
169
|
+
config: Readonly<any>;
|
|
170
|
+
rootLogger: Readonly<{
|
|
171
|
+
getLogger: (context: Readonly<any>, props?: {
|
|
172
|
+
ids?: readonly Readonly<Record<string, string>>[] | undefined;
|
|
173
|
+
data?: Record<string, any> | undefined;
|
|
174
|
+
} | undefined) => import("@node-in-layers/core/types.js").HighLevelLogger;
|
|
175
|
+
}>;
|
|
176
|
+
constants: {
|
|
177
|
+
environment: string;
|
|
178
|
+
workingDirectory: string;
|
|
179
|
+
runtimeId: string;
|
|
180
|
+
};
|
|
181
|
+
}>;
|
|
132
182
|
Model: import("functional-models/types.js").ModelFactory<object, object>;
|
|
133
183
|
fetcher: import("functional-models/types.js").ModelInstanceFetcher<object, object>;
|
|
134
184
|
getModel: <T_1 extends Readonly<{
|
|
@@ -141,10 +191,10 @@ declare const create: (context: FeaturesContext<Config, AwsConfigServicesLayer,
|
|
|
141
191
|
modelCruds?: boolean | undefined;
|
|
142
192
|
customModelFactory?: {
|
|
143
193
|
[x: string]: {
|
|
144
|
-
[x: string]: string | [string, any[]];
|
|
194
|
+
[x: string]: string | [string, string] | [string, string, any[]];
|
|
145
195
|
};
|
|
146
196
|
} | undefined;
|
|
147
|
-
}
|
|
197
|
+
}>;
|
|
148
198
|
}>>(rawConfig: TConfig) => Promise<TConfig>;
|
|
149
199
|
};
|
|
150
200
|
export { create };
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-in-layers/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "A Node In Layers Package for handling AWS.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"author": "Mike Cornwell",
|
|
50
50
|
"license": "GPLV3",
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cucumber/cucumber": "
|
|
52
|
+
"@cucumber/cucumber": "^12.6.0",
|
|
53
53
|
"@eslint/compat": "^1.2.0",
|
|
54
54
|
"@eslint/eslintrc": "^3.1.0",
|
|
55
55
|
"@eslint/js": "^9.12.0",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"@typescript-eslint/eslint-plugin": "8.13.0",
|
|
64
64
|
"@typescript-eslint/parser": "8.13.0",
|
|
65
65
|
"argparse": "^2.0.1",
|
|
66
|
+
"c8": "^10.1.3",
|
|
66
67
|
"chai": "^4.2.0",
|
|
67
68
|
"chai-as-promised": "^7.1.1",
|
|
68
69
|
"cz-conventional-changelog": "^3.3.0",
|
|
69
|
-
"c8": "^10.1.3",
|
|
70
70
|
"eslint": "9.14.0",
|
|
71
71
|
"eslint-config-prettier": "^9.1.0",
|
|
72
72
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
@@ -93,9 +93,10 @@
|
|
|
93
93
|
"@aws-sdk/client-ecs": "^3.758.0",
|
|
94
94
|
"@aws-sdk/client-s3": "^3.758.0",
|
|
95
95
|
"@aws-sdk/client-secrets-manager": "^3.758.0",
|
|
96
|
+
"@aws-sdk/client-sqs": "^3.758.0",
|
|
96
97
|
"@aws-sdk/client-ssm": "^3.759.0",
|
|
97
98
|
"@aws-sdk/lib-dynamodb": "^3.758.0",
|
|
98
|
-
"@node-in-layers/core": "^1.
|
|
99
|
+
"@node-in-layers/core": "^1.12.5",
|
|
99
100
|
"lodash": "^4.17.21",
|
|
100
101
|
"modern-async": "^2.0.4"
|
|
101
102
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Config } from '@node-in-layers/core';
|
|
2
|
-
type Aws3 = Readonly<{
|
|
2
|
+
export type Aws3 = Readonly<{
|
|
3
3
|
ecs: Record<string, any> & {
|
|
4
4
|
ecsClient: any;
|
|
5
5
|
};
|
|
6
6
|
s3: Record<string, any> & {
|
|
7
7
|
s3Client: any;
|
|
8
8
|
};
|
|
9
|
+
sqs: Record<string, any> & {
|
|
10
|
+
sqsClient: any;
|
|
11
|
+
};
|
|
9
12
|
dynamo: Record<string, any> & {
|
|
10
13
|
dynamoDbClient: any;
|
|
11
14
|
};
|
|
@@ -18,27 +21,39 @@ type Aws3 = Readonly<{
|
|
|
18
21
|
GetSecretValueCommand: any;
|
|
19
22
|
};
|
|
20
23
|
}>;
|
|
21
|
-
declare enum AwsNamespace {
|
|
24
|
+
export declare enum AwsNamespace {
|
|
22
25
|
root = "@node-in-layers/aws",
|
|
23
26
|
config = "@node-in-layers/aws/config"
|
|
24
27
|
}
|
|
25
|
-
declare enum AwsService {
|
|
28
|
+
export declare enum AwsService {
|
|
26
29
|
s3 = "s3",
|
|
27
30
|
ssm = "ssm",
|
|
28
31
|
secretsManager = "secretsManager",
|
|
29
32
|
dynamoDb = "dynamoDb",
|
|
30
|
-
ecs = "ecs"
|
|
33
|
+
ecs = "ecs",
|
|
34
|
+
sqs = "sqs"
|
|
31
35
|
}
|
|
32
|
-
type AwsServices = Readonly<{
|
|
36
|
+
export type AwsServices = Readonly<{
|
|
33
37
|
aws3: Partial<Aws3>;
|
|
34
38
|
}>;
|
|
35
|
-
type AwsServicesContext = Readonly<{
|
|
39
|
+
export type AwsServicesContext = Readonly<{
|
|
36
40
|
[AwsNamespace.root]: AwsServices;
|
|
37
41
|
}>;
|
|
38
|
-
type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
export type Aws3PartialConfig = Readonly<{
|
|
43
|
+
/**
|
|
44
|
+
* Sets which services to include in the aws3 client.
|
|
45
|
+
* If not set, all services will be included.
|
|
46
|
+
*/
|
|
47
|
+
services?: readonly AwsService[];
|
|
48
|
+
/**
|
|
49
|
+
* Allows setting any additional properties to the aws client directly. Credentials, etc.
|
|
50
|
+
*/
|
|
51
|
+
awsClientProps?: Record<string, any>;
|
|
52
|
+
/**
|
|
53
|
+
* Allows setting the https agent to use for the aws client.
|
|
54
|
+
*/
|
|
55
|
+
httpsAgent?: any;
|
|
56
|
+
}>;
|
|
57
|
+
export type Aws3Config = Config & Readonly<{
|
|
58
|
+
[AwsNamespace.root]: Aws3PartialConfig;
|
|
59
|
+
}>;
|
package/types.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var AwsNamespace;
|
|
1
|
+
export var AwsNamespace;
|
|
2
2
|
(function (AwsNamespace) {
|
|
3
3
|
AwsNamespace["root"] = "@node-in-layers/aws";
|
|
4
4
|
AwsNamespace["config"] = "@node-in-layers/aws/config";
|
|
5
5
|
})(AwsNamespace || (AwsNamespace = {}));
|
|
6
|
-
var AwsService;
|
|
6
|
+
export var AwsService;
|
|
7
7
|
(function (AwsService) {
|
|
8
8
|
AwsService["s3"] = "s3";
|
|
9
9
|
AwsService["ssm"] = "ssm";
|
|
10
10
|
AwsService["secretsManager"] = "secretsManager";
|
|
11
11
|
AwsService["dynamoDb"] = "dynamoDb";
|
|
12
12
|
AwsService["ecs"] = "ecs";
|
|
13
|
+
AwsService["sqs"] = "sqs";
|
|
13
14
|
})(AwsService || (AwsService = {}));
|
|
14
|
-
export { AwsNamespace, AwsService, };
|
|
15
15
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,4CAA4B,CAAA;IAC5B,qDAAqC,CAAA;AACvC,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAED,MAAM,CAAN,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,yBAAW,CAAA;IACX,+CAAiC,CAAA;IACjC,mCAAqB,CAAA;IACrB,yBAAW,CAAA;IACX,yBAAW,CAAA;AACb,CAAC,EAPW,UAAU,KAAV,UAAU,QAOrB"}
|