lambda-toolkit 0.0.12-beta → 0.0.14-beta
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/dist/index.js +1918 -1722
- package/package.json +16 -15
package/dist/index.js
CHANGED
|
@@ -1,221 +1,38 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 44:
|
|
5
5
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const { LambdaApi } = __webpack_require__( 2705 );
|
|
8
|
+
const array = __webpack_require__( 8278 );
|
|
9
|
+
const aws = __webpack_require__( 4870 );
|
|
10
|
+
const epoch = __webpack_require__( 3830 );
|
|
11
|
+
const math = __webpack_require__( 943 );
|
|
12
|
+
const object = __webpack_require__( 5762 );
|
|
13
|
+
const redis = __webpack_require__( 4528 );
|
|
14
|
+
const string = __webpack_require__( 268 );
|
|
15
|
+
const utils = __webpack_require__( 6878 );
|
|
10
16
|
|
|
11
17
|
module.exports = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/***/ ((module) => {
|
|
22
|
-
|
|
23
|
-
module.exports = ( ...args ) => [ ...new Set( args.filter( Array.isArray ).flat() ) ];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/***/ }),
|
|
27
|
-
|
|
28
|
-
/***/ 536:
|
|
29
|
-
/***/ ((module) => {
|
|
30
|
-
|
|
31
|
-
module.exports = ( { key, items } ) => [
|
|
32
|
-
...items.filter( Array.isArray ).flat().reduce( ( map, v ) => {
|
|
33
|
-
const k = key( v );
|
|
34
|
-
if ( !map.has( k ) ) {
|
|
35
|
-
map.set( k, v );
|
|
36
|
-
}
|
|
37
|
-
return map;
|
|
38
|
-
}, new Map() ).values()
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/***/ }),
|
|
43
|
-
|
|
44
|
-
/***/ 4821:
|
|
45
|
-
/***/ ((module) => {
|
|
46
|
-
|
|
47
|
-
module.exports = ( items, size ) => items.reduce( ( arrs, item ) =>
|
|
48
|
-
( arrs[0] && arrs[0].length < size ) ?
|
|
49
|
-
[ [ ...arrs[0], item ] ].concat( arrs.slice( 1 ) ) :
|
|
50
|
-
[ [ item ] ].concat( arrs )
|
|
51
|
-
, [] ).reverse();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/***/ }),
|
|
55
|
-
|
|
56
|
-
/***/ 228:
|
|
57
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
58
|
-
|
|
59
|
-
const { AthenaClient } = __webpack_require__( 3744 );
|
|
60
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
61
|
-
const query = __webpack_require__( 140 );
|
|
62
|
-
const createInstance = __webpack_require__( 5438 );
|
|
63
|
-
|
|
64
|
-
const methods = {
|
|
65
|
-
query
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
module.exports = createInstance( clientProvider.bind( null, AthenaClient ), methods );
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/***/ }),
|
|
72
|
-
|
|
73
|
-
/***/ 7337:
|
|
74
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
75
|
-
|
|
76
|
-
const { GetQueryExecutionCommand, GetQueryResultsCommand } = __webpack_require__( 3744 );
|
|
77
|
-
const parseResults = __webpack_require__( 834 );
|
|
78
|
-
const pollingDelay = __webpack_require__( 4127 );
|
|
79
|
-
|
|
80
|
-
const sleep = t => new Promise( r => setTimeout( () => r(), t ) );
|
|
81
|
-
|
|
82
|
-
const getQueryResults = async ( { client, queryExecutionId, maxResults, token } ) => {
|
|
83
|
-
const { NextToken: nextToken, ResultSet } = await client.send( new GetQueryResultsCommand( {
|
|
84
|
-
...{ QueryExecutionId: queryExecutionId },
|
|
85
|
-
...( maxResults ? { MaxResults: maxResults } : {} ),
|
|
86
|
-
...( token ? { NextToken: token } : {} )
|
|
87
|
-
} ) );
|
|
88
|
-
|
|
89
|
-
return { nextToken, items: parseResults( ResultSet ) };
|
|
90
|
-
};
|
|
91
|
-
const getQueryResultsRecursive = async ( { client, queryExecutionId, token } ) => {
|
|
92
|
-
const { nextToken, items } = await getQueryResults( { client, queryExecutionId, token } );
|
|
93
|
-
|
|
94
|
-
if ( nextToken ) {
|
|
95
|
-
return { items: items.concat( ( await getQueryResultsRecursive( { client, queryExecutionId, token: nextToken } ) ).items ) };
|
|
96
|
-
}
|
|
97
|
-
return { items };
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/athena/command/GetQueryResultsCommand/
|
|
102
|
-
* { client, recursive, queryExecutionId, maxResults, paginationToken }
|
|
103
|
-
*/
|
|
104
|
-
const getResults = async ( { client, recursive, queryExecutionId, token, maxResults } ) => {
|
|
105
|
-
const { QueryExecution: { Status: status } } = await client.send( new GetQueryExecutionCommand( { QueryExecutionId: queryExecutionId } ) );
|
|
106
|
-
|
|
107
|
-
if ( status.State === 'FAILED' ) {
|
|
108
|
-
throw new Error( status.AthenaError?.ErrorMessage ?? status.StateChangeReason );
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if ( status.State === 'SUCCEEDED' ) {
|
|
112
|
-
const fn = recursive ? getQueryResultsRecursive : getQueryResults;
|
|
113
|
-
return fn( { client, recursive, queryExecutionId, token, maxResults } );
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// sleep an try again
|
|
117
|
-
await sleep( pollingDelay );
|
|
118
|
-
return getResults( { client, recursive, queryExecutionId, token, maxResults } );
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
module.exports = getResults;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
/***/ }),
|
|
125
|
-
|
|
126
|
-
/***/ 834:
|
|
127
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
128
|
-
|
|
129
|
-
const parseValue = __webpack_require__( 9129 );
|
|
130
|
-
|
|
131
|
-
module.exports = resultSet => {
|
|
132
|
-
const columns = resultSet.ResultSetMetadata.ColumnInfo
|
|
133
|
-
.map( col => ( { name: col.Name, type: col.Type } ) );
|
|
134
|
-
|
|
135
|
-
// first data row contains the table field names
|
|
136
|
-
return resultSet.Rows.slice( 1 ).map( row => {
|
|
137
|
-
const values = row.Data.map( d => d.VarCharValue );
|
|
138
|
-
return columns.reduce( ( obj, p, i ) => Object.assign( obj, { [p.name]: parseValue( values[i], p.type ) } ), {} );
|
|
139
|
-
} );
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/***/ }),
|
|
144
|
-
|
|
145
|
-
/***/ 9129:
|
|
146
|
-
/***/ ((module) => {
|
|
147
|
-
|
|
148
|
-
/* eslint consistent-return: 0 */
|
|
149
|
-
const removeNullValues = ( o, isArray = Array.isArray( o ) ) =>
|
|
150
|
-
Object.entries( o ).reduce( ( newObj, [ k, v ] ) => {
|
|
151
|
-
if ( v === null && !isArray ) { return newObj; }
|
|
152
|
-
return Object.assign( newObj, { [k]: v?.constructor === Object ? removeNullValues( v ) : v } );
|
|
153
|
-
}, isArray ? [] : {} );
|
|
154
|
-
|
|
155
|
-
module.exports = ( v, type ) => {
|
|
156
|
-
if ( [ null, undefined ].includes( v ) ) {
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
if ( v === '' && type !== 'varchar' ) {
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
if ( type === 'boolean' ) {
|
|
163
|
-
return v === 'true';
|
|
164
|
-
}
|
|
165
|
-
if ( [ 'float', 'decimal', 'double' ].includes( type ) ) {
|
|
166
|
-
return parseFloat( v );
|
|
167
|
-
}
|
|
168
|
-
if ( [ 'tinyint', 'smallint', 'int', 'bigint' ].includes( type ) ) {
|
|
169
|
-
return parseInt( v );
|
|
170
|
-
}
|
|
171
|
-
if ( 'timestamp' === type ) {
|
|
172
|
-
return new Date( v ).getTime();
|
|
173
|
-
}
|
|
174
|
-
if ( [ 'row', 'array' ].includes( type ) ) {
|
|
175
|
-
const obj = v.replace( /(?<=(?:{|,\s)[\w-_]+)=/g, '@@DELIMITER@@' ) // replaces delimiter = with @@DELIMITER@@
|
|
176
|
-
.replace( /(?<={|,\s)([\w_-]+)(?=@@DELIMITER@@)/g, '"$1"' ) // wrap object keys
|
|
177
|
-
.replace( /(?<=@@DELIMITER@@)((?:(?!,\s|}|\[|{).)+)/g, '"$1"' ) // wrap object values
|
|
178
|
-
.replace( /(?<=\[|,\s)((?:(?!,\s|{|\]|").)+)/g, '"$1"' ) // wrap array values
|
|
179
|
-
.replace( /"null"/g, 'null' ) // convert "null" to null
|
|
180
|
-
.replace( /@@DELIMITER@@/g, ':' ); // replaces @@DELIMITER@@ for :
|
|
181
|
-
|
|
182
|
-
return removeNullValues( JSON.parse( obj ) );
|
|
183
|
-
}
|
|
184
|
-
if ( 'json' === type ) {
|
|
185
|
-
return JSON.parse( v );
|
|
186
|
-
}
|
|
187
|
-
return v;
|
|
18
|
+
array,
|
|
19
|
+
aws,
|
|
20
|
+
epoch,
|
|
21
|
+
LambdaApi,
|
|
22
|
+
math,
|
|
23
|
+
object,
|
|
24
|
+
redis,
|
|
25
|
+
string,
|
|
26
|
+
utils
|
|
188
27
|
};
|
|
189
28
|
|
|
190
29
|
|
|
191
30
|
/***/ }),
|
|
192
31
|
|
|
193
|
-
/***/
|
|
32
|
+
/***/ 115:
|
|
194
33
|
/***/ ((module) => {
|
|
195
34
|
|
|
196
|
-
module.exports =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/***/ }),
|
|
200
|
-
|
|
201
|
-
/***/ 5723:
|
|
202
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
203
|
-
|
|
204
|
-
const { randomBytes } = __webpack_require__( 6982 );
|
|
205
|
-
const { StartQueryExecutionCommand } = __webpack_require__( 3744 );
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* args : https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/athena/command/StartQueryExecutionCommand/
|
|
209
|
-
* A ClientRequestToken is created automatically
|
|
210
|
-
*/
|
|
211
|
-
module.exports = async ( { client, ...args } ) => {
|
|
212
|
-
const cmd = new StartQueryExecutionCommand( {
|
|
213
|
-
ClientRequestToken: randomBytes( 16 ).toString( 'hex' ),
|
|
214
|
-
...args
|
|
215
|
-
} );
|
|
216
|
-
const { QueryExecutionId: queryId } = await client.send( cmd );
|
|
217
|
-
return queryId;
|
|
218
|
-
};
|
|
35
|
+
module.exports = ( n, d = 2 ) => Math.round( n * ( 10 ** d ) ) / ( 10 ** d );
|
|
219
36
|
|
|
220
37
|
|
|
221
38
|
/***/ }),
|
|
@@ -266,319 +83,425 @@ module.exports = async ( client, nativeArgs, options ) => {
|
|
|
266
83
|
|
|
267
84
|
/***/ }),
|
|
268
85
|
|
|
269
|
-
/***/
|
|
86
|
+
/***/ 228:
|
|
270
87
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
271
88
|
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
const
|
|
89
|
+
const { AthenaClient } = __webpack_require__( 3744 );
|
|
90
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
91
|
+
const query = __webpack_require__( 140 );
|
|
92
|
+
const createInstance = __webpack_require__( 5438 );
|
|
276
93
|
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
configurable: false,
|
|
280
|
-
writable: false
|
|
94
|
+
const methods = {
|
|
95
|
+
query
|
|
281
96
|
};
|
|
282
97
|
|
|
283
|
-
module.exports =
|
|
284
|
-
set: ( key, value ) => {
|
|
285
|
-
const keySym = Symbol.for( hash( key ) );
|
|
286
|
-
|
|
287
|
-
if ( !global[cacheSym] ) {
|
|
288
|
-
Object.defineProperty( global, cacheSym, { ...propOpts, value: {} } );
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
Object.defineProperty( global[cacheSym], keySym, { ...propOpts, value } );
|
|
292
|
-
},
|
|
293
|
-
get: key => {
|
|
294
|
-
return global[cacheSym]?.[Symbol.for( hash( key ) )];
|
|
295
|
-
}
|
|
296
|
-
};
|
|
98
|
+
module.exports = createInstance( clientProvider.bind( null, AthenaClient ), methods );
|
|
297
99
|
|
|
298
100
|
|
|
299
101
|
/***/ }),
|
|
300
102
|
|
|
301
|
-
/***/
|
|
302
|
-
/***/ ((module) => {
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* This is base object each AWS abstraction will provide
|
|
306
|
-
*/
|
|
307
|
-
module.exports = ( providerFn, methods ) => {
|
|
308
|
-
// This creates the "instance",
|
|
309
|
-
// so calling the method as a function returns a copy of its client instantiated with the given args
|
|
310
|
-
// every method called from it will use this instance
|
|
311
|
-
const factory = args => {
|
|
312
|
-
const client = providerFn( args );
|
|
313
|
-
// return self, so it is possible use the native client
|
|
314
|
-
methods.getClient = () => client;
|
|
315
|
-
return Object.entries( methods ).reduce( ( o, [ k, v ] ) => Object.assign( o, { [k]: v.bind( null, client ) } ), { } );
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// This is the singleton part;
|
|
319
|
-
// First add the static method to the factory;
|
|
320
|
-
Object.entries( methods ).forEach( ( [ key, value ] ) => factory[key] = value );
|
|
321
|
-
|
|
322
|
-
// Then add the special method "getClient", so it is possible use the native client
|
|
323
|
-
factory.getClient = client => client;
|
|
324
|
-
|
|
325
|
-
// Finally makes the proxy which will allow each singleton method to use the client provider of the AWS service+
|
|
326
|
-
return new Proxy( factory, {
|
|
327
|
-
get( target, key ) {
|
|
328
|
-
const t = target[key];
|
|
329
|
-
return ( typeof t === 'function' ) ? t.bind( null, providerFn() ) : t;
|
|
330
|
-
}
|
|
331
|
-
} );
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
/***/ }),
|
|
103
|
+
/***/ 268:
|
|
104
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
336
105
|
|
|
337
|
-
|
|
338
|
-
|
|
106
|
+
const camelize = __webpack_require__( 3914 );
|
|
107
|
+
const capitalizeWords = __webpack_require__( 3258 );
|
|
108
|
+
const snakelize = __webpack_require__( 3402 );
|
|
339
109
|
|
|
340
110
|
module.exports = {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
return Buffer.from( JSON.stringify( k ) ).toString( 'base64' );
|
|
345
|
-
},
|
|
346
|
-
decode: k => {
|
|
347
|
-
if ( k === null || k === undefined ) { return k; }
|
|
348
|
-
|
|
349
|
-
const result = Buffer.from( k, 'base64' ).toString( 'utf8' );
|
|
350
|
-
try {
|
|
351
|
-
return JSON.parse( result );
|
|
352
|
-
} catch {
|
|
353
|
-
return result;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
111
|
+
camelize,
|
|
112
|
+
capitalizeWords,
|
|
113
|
+
snakelize
|
|
356
114
|
};
|
|
357
115
|
|
|
358
116
|
|
|
359
117
|
/***/ }),
|
|
360
118
|
|
|
361
|
-
/***/
|
|
119
|
+
/***/ 279:
|
|
362
120
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
363
121
|
|
|
364
|
-
const
|
|
122
|
+
const { HeadObjectCommand } = __webpack_require__( 5725 );
|
|
365
123
|
|
|
366
|
-
module.exports = (
|
|
367
|
-
|
|
368
|
-
return cache.get( cacheKey ) ?? ( () => {
|
|
369
|
-
const client = Reflect.construct( constructor, args );
|
|
370
|
-
// console.log( 'client', client );
|
|
371
|
-
// const client = new constructor( ...args );
|
|
372
|
-
cache.set( cacheKey, client );
|
|
373
|
-
return client;
|
|
374
|
-
} )();
|
|
375
|
-
};
|
|
124
|
+
module.exports = async ( client, bucket, key ) =>
|
|
125
|
+
client.send( new HeadObjectCommand( { Bucket: bucket, Key: key } ) );
|
|
376
126
|
|
|
377
127
|
|
|
378
128
|
/***/ }),
|
|
379
129
|
|
|
380
|
-
/***/
|
|
130
|
+
/***/ 321:
|
|
381
131
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
382
132
|
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
const
|
|
133
|
+
const validators = __webpack_require__( 8994 );
|
|
134
|
+
const ApiResponse = __webpack_require__( 3119 );
|
|
135
|
+
const Event = __webpack_require__( 329 );
|
|
136
|
+
const Handler = __webpack_require__( 3109 );
|
|
137
|
+
const Hook = __webpack_require__( 798 );
|
|
138
|
+
const UserResponse = __webpack_require__( 8282 );
|
|
139
|
+
const Text = __webpack_require__( 9760 );
|
|
387
140
|
|
|
388
|
-
|
|
141
|
+
module.exports = class LambdaApi {
|
|
142
|
+
#apiResponse = null;
|
|
143
|
+
#handlers = [];
|
|
144
|
+
#errorResponses = [];
|
|
145
|
+
#beforeHooks = [];
|
|
146
|
+
#afterHooks = [];
|
|
147
|
+
#transformRequest = [];
|
|
389
148
|
|
|
390
|
-
|
|
391
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Creates a new Lambda Api
|
|
151
|
+
*
|
|
152
|
+
* @param {Object} headers Any headers you want to be included in all responses
|
|
153
|
+
*/
|
|
154
|
+
constructor( { headers = {}, transformRequest = false, transformResponse = false } = {} ) {
|
|
155
|
+
validators.transformRequest( transformRequest );
|
|
156
|
+
validators.transformResponse( transformResponse );
|
|
392
157
|
|
|
393
|
-
|
|
158
|
+
this.#transformRequest = transformRequest;
|
|
159
|
+
this.#apiResponse = new ApiResponse( { headers, transform: transformResponse } );
|
|
160
|
+
}
|
|
394
161
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Register a function that will run before the matching route (only if matches)
|
|
164
|
+
*
|
|
165
|
+
* @param {Object} args
|
|
166
|
+
* @param {function} args.fn A function
|
|
167
|
+
*/
|
|
168
|
+
addBeforeHook( { fn } = {} ) {
|
|
169
|
+
this.#beforeHooks.push( new Hook( { fn } ) );
|
|
170
|
+
}
|
|
401
171
|
|
|
402
|
-
|
|
403
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Register a function that will run after the matching route (only if matches)
|
|
174
|
+
*
|
|
175
|
+
* @param {Object} args
|
|
176
|
+
* @param {function} args.fn A function
|
|
177
|
+
*/
|
|
178
|
+
addAfterHook( { fn } = {} ) {
|
|
179
|
+
this.#afterHooks.push( new Hook( { fn } ) );
|
|
180
|
+
}
|
|
404
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Register a handler for a given request method and optionally a path
|
|
184
|
+
*
|
|
185
|
+
* @param {Object} args
|
|
186
|
+
* @param {string} args.method The method to match this handler
|
|
187
|
+
* @param {function} args.fn The handler function
|
|
188
|
+
* @param {string} [args.route] A route to match this handler
|
|
189
|
+
* @param {string} [args.routeIncludes] A part of the route to match this handler
|
|
190
|
+
* @param {string} [args.routeNotIncludes] A part of the route to not match this handler
|
|
191
|
+
* @param {RegExp} [args.routeMatches] A RegExp to match the route
|
|
192
|
+
* @param {string} [args.path] A path to match this handler
|
|
193
|
+
* @param {string} [args.pathIncludes] A part of the path to match this handler
|
|
194
|
+
* @param {string} [args.pathNotIncludes] A part of the path to not match this handler
|
|
195
|
+
* @param {RegExp} [args.pathMatches] A RegExp to match the path
|
|
196
|
+
*/
|
|
197
|
+
addHandler( { method, fn, ...matchers } = {} ) {
|
|
198
|
+
this.#handlers.push( new Handler( { method, fn, ...matchers } ) );
|
|
199
|
+
}
|
|
405
200
|
|
|
406
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Register an automatic error code response for given error class (constructor name)
|
|
203
|
+
*
|
|
204
|
+
* @param {Object} args
|
|
205
|
+
* @param {string} args.code The HTTP status code to return
|
|
206
|
+
* @param {class} args.errorType The error class
|
|
207
|
+
* @param {string} [args.message=null] Optional message to return for the status code, if not present will default to Error.message
|
|
208
|
+
* @param {message} [args.errorType] And optional message to display
|
|
209
|
+
*/
|
|
210
|
+
addErrorHandler( { errorType, code, message = null } = {} ) {
|
|
211
|
+
validators.statusCode( code );
|
|
212
|
+
validators.errorType( errorType );
|
|
213
|
+
this.#errorResponses.push( { errorType, code, message } );
|
|
214
|
+
}
|
|
407
215
|
|
|
408
|
-
|
|
409
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Init the flow using a given AWS Lambda APIGateway event (v2 syntax)
|
|
218
|
+
*
|
|
219
|
+
* @param {Object} ApiGatewayPayload The raw API Gateway event
|
|
220
|
+
* @returns {Object} The http response with status, body and headers
|
|
221
|
+
*/
|
|
222
|
+
async process( awsEvent ) {
|
|
223
|
+
const event = new Event( { transform: this.#transformRequest } );
|
|
224
|
+
event.parseFromAwsEvent( awsEvent );
|
|
410
225
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
226
|
+
if ( event.method === 'HEAD' ) {
|
|
227
|
+
return this.#apiResponse.setContent( 204 ).toJSON();
|
|
228
|
+
}
|
|
414
229
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#dynamodbdocumentclientresolvedconfig-1
|
|
419
|
-
marshallOptions: {
|
|
420
|
-
// Whether to automatically convert empty strings, blobs, and sets to `null`.
|
|
421
|
-
convertEmptyValues: true, // false, by default.
|
|
422
|
-
// Whether to remove undefined values while marshalling.
|
|
423
|
-
removeUndefinedValues: true, // false, by default.
|
|
424
|
-
// Whether to convert typeof object to map attribute.
|
|
425
|
-
convertClassInstanceToMap: true // false, by default.
|
|
426
|
-
},
|
|
427
|
-
unmarshallOptions: {
|
|
428
|
-
// Whether to return numbers as a string instead of converting them to native JavaScript numbers.
|
|
429
|
-
wrapNumbers: false // false, by default.
|
|
230
|
+
const handler = this.#handlers.find( h => h.match( event ) );
|
|
231
|
+
if ( !handler ) {
|
|
232
|
+
return this.#apiResponse.setContent( 405, Text.ERROR_405 ).toJSON();
|
|
430
233
|
}
|
|
431
|
-
};
|
|
432
234
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
235
|
+
const chain = [
|
|
236
|
+
...this.#beforeHooks.map( b => b.fn ),
|
|
237
|
+
async ev => {
|
|
238
|
+
const result = await handler.fn( ev );
|
|
239
|
+
const response = new UserResponse( result );
|
|
240
|
+
this.#apiResponse.setContent( ...response.values ).toJSON();
|
|
241
|
+
},
|
|
242
|
+
...this.#afterHooks.map( a => a.fn )
|
|
243
|
+
];
|
|
437
244
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
245
|
+
try {
|
|
246
|
+
for ( const fn of chain ) {
|
|
247
|
+
await fn( event );
|
|
248
|
+
}
|
|
249
|
+
return this.#apiResponse.toJSON();
|
|
250
|
+
|
|
251
|
+
} catch ( error ) {
|
|
252
|
+
console.error( 'Lambda API Error', { error, event } );
|
|
253
|
+
|
|
254
|
+
const response = this.#errorResponses.find( e => error instanceof e.errorType );
|
|
255
|
+
if ( response ) {
|
|
256
|
+
return this.#apiResponse.setContent( response.code, response.message ?? error.message ).toJSON();
|
|
257
|
+
}
|
|
258
|
+
return this.#apiResponse.setContent( 500, Text.ERROR_500 ).toJSON();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
441
261
|
};
|
|
442
262
|
|
|
443
263
|
|
|
444
264
|
/***/ }),
|
|
445
265
|
|
|
446
|
-
/***/
|
|
266
|
+
/***/ 329:
|
|
447
267
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
448
268
|
|
|
449
|
-
const {
|
|
269
|
+
const { camelize, snakelize } = __webpack_require__( 5762 );
|
|
450
270
|
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return args[0];
|
|
455
|
-
}
|
|
456
|
-
// sugar mode
|
|
457
|
-
return {
|
|
458
|
-
TableName: args[0],
|
|
459
|
-
Key: args[1]
|
|
460
|
-
};
|
|
271
|
+
const transformFns = {
|
|
272
|
+
camelcase: camelize,
|
|
273
|
+
snakecase: snakelize
|
|
461
274
|
};
|
|
462
275
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
276
|
+
const parseJson = content => {
|
|
277
|
+
try {
|
|
278
|
+
return JSON.parse( content );
|
|
279
|
+
} catch {
|
|
280
|
+
return content;
|
|
281
|
+
}
|
|
466
282
|
};
|
|
467
283
|
|
|
284
|
+
module.exports = class Event {
|
|
285
|
+
#transformFn;
|
|
286
|
+
authorizer;
|
|
287
|
+
body;
|
|
288
|
+
headers;
|
|
289
|
+
method;
|
|
290
|
+
params;
|
|
291
|
+
path;
|
|
292
|
+
queryString;
|
|
293
|
+
route;
|
|
468
294
|
|
|
469
|
-
|
|
295
|
+
context = {};
|
|
470
296
|
|
|
471
|
-
|
|
472
|
-
|
|
297
|
+
constructor( { transform = false } = {} ) {
|
|
298
|
+
this.#transformFn = transformFns[transform] ?? ( v => v );
|
|
299
|
+
}
|
|
473
300
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const putBatch = __webpack_require__( 5847 );
|
|
478
|
-
const query = __webpack_require__( 5265 );
|
|
479
|
-
const remove = __webpack_require__( 6777 );
|
|
480
|
-
const removeBatch = __webpack_require__( 3862 );
|
|
481
|
-
const scan = __webpack_require__( 748 );
|
|
482
|
-
const smartUpdate = __webpack_require__( 2266 );
|
|
483
|
-
const transactWrite = __webpack_require__( 1659 );
|
|
484
|
-
const update = __webpack_require__( 4144 );
|
|
485
|
-
const createInstance = __webpack_require__( 5438 );
|
|
301
|
+
parseFromAwsEvent( awsEvent ) {
|
|
302
|
+
this[`parseFromAwsEventV${awsEvent.version === '2.0' ? 2 : 1}`]( awsEvent );
|
|
303
|
+
}
|
|
486
304
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
305
|
+
parseFromAwsEventV1( awsEvent ) {
|
|
306
|
+
const {
|
|
307
|
+
body,
|
|
308
|
+
path,
|
|
309
|
+
resource,
|
|
310
|
+
httpMethod,
|
|
311
|
+
requestContext,
|
|
312
|
+
pathParameters,
|
|
313
|
+
headers,
|
|
314
|
+
multiValueHeaders,
|
|
315
|
+
queryStringParameters,
|
|
316
|
+
multiValueQueryStringParameters: multiValueQueryString,
|
|
317
|
+
isBase64Encoded
|
|
318
|
+
} = awsEvent;
|
|
499
319
|
|
|
500
|
-
|
|
320
|
+
const unifiedHeaders = {
|
|
321
|
+
...headers,
|
|
322
|
+
...Object.fromEntries( Object.entries( multiValueHeaders ?? {} ).map( ( [ k, v ] ) => [ k, Array.isArray( v ) ? v.join( ',' ) : k ] ) )
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const unifiedQueryString = {
|
|
326
|
+
...queryStringParameters,
|
|
327
|
+
...Object.fromEntries( Object.entries( multiValueQueryString ?? {} ).map( ( [ k, v ] ) => [ k, Array.isArray( v ) ? v.join( ',' ) : k ] ) )
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
this.authorizer = requestContext?.authorizer;
|
|
331
|
+
this.body = body ? this.#transformFn( parseJson( body ) ) : null;
|
|
332
|
+
this.headers = unifiedHeaders ?? {};
|
|
333
|
+
this.method = httpMethod;
|
|
334
|
+
this.params = this.#transformFn( pathParameters ) ?? {};
|
|
335
|
+
this.path = path;
|
|
336
|
+
this.queryString = this.#transformFn( unifiedQueryString ) ?? {};
|
|
337
|
+
this.route = resource;
|
|
338
|
+
this.isBase64Encoded = isBase64Encoded ?? false;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
parseFromAwsEventV2( awsEvent ) {
|
|
342
|
+
const {
|
|
343
|
+
body,
|
|
344
|
+
routeKey,
|
|
345
|
+
requestContext,
|
|
346
|
+
pathParameters,
|
|
347
|
+
headers,
|
|
348
|
+
queryStringParameters,
|
|
349
|
+
isBase64Encoded
|
|
350
|
+
} = awsEvent;
|
|
351
|
+
|
|
352
|
+
const { http: { method, path } } = requestContext;
|
|
353
|
+
|
|
354
|
+
this.authorizer = requestContext?.authorizer;
|
|
355
|
+
this.body = body ? this.#transformFn( parseJson( body ) ) : null;
|
|
356
|
+
this.headers = headers ?? {};
|
|
357
|
+
this.method = method;
|
|
358
|
+
this.params = this.#transformFn( pathParameters ) ?? {};
|
|
359
|
+
this.path = path;
|
|
360
|
+
this.queryString = this.#transformFn( queryStringParameters ) ?? {};
|
|
361
|
+
this.route = routeKey?.split( ' ' )[1].replace( /\/$/, '' );
|
|
362
|
+
this.isBase64Encoded = isBase64Encoded ?? false;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
501
365
|
|
|
502
366
|
|
|
503
367
|
/***/ }),
|
|
504
368
|
|
|
505
|
-
/***/
|
|
369
|
+
/***/ 345:
|
|
506
370
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
507
371
|
|
|
508
|
-
const {
|
|
372
|
+
const { GetObjectCommand } = __webpack_require__( 5725 );
|
|
509
373
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
374
|
+
module.exports = async ( client, bucket, key, nativeArgs ) => {
|
|
375
|
+
const response = await client.send( new GetObjectCommand( {
|
|
376
|
+
...nativeArgs,
|
|
377
|
+
Bucket: bucket,
|
|
378
|
+
Key: key
|
|
379
|
+
} ) );
|
|
380
|
+
const stream = response.Body;
|
|
381
|
+
return Buffer.concat( await stream.toArray() ).toString( 'utf-8' );
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
/***/ }),
|
|
386
|
+
|
|
387
|
+
/***/ 468:
|
|
388
|
+
/***/ ((module) => {
|
|
389
|
+
|
|
390
|
+
const parsePayload = payload => {
|
|
391
|
+
try {
|
|
392
|
+
return JSON.parse( Buffer.from( payload ).toString( 'utf-8' ) );
|
|
393
|
+
} catch {
|
|
394
|
+
return null;
|
|
514
395
|
}
|
|
515
|
-
// sugar mode
|
|
516
|
-
return {
|
|
517
|
-
TableName: args[0],
|
|
518
|
-
Item: args[1],
|
|
519
|
-
ReturnValues: 'NONE',
|
|
520
|
-
ReturnConsumedCapacity: 'NONE'
|
|
521
|
-
};
|
|
522
396
|
};
|
|
523
397
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
398
|
+
module.exports = class LambdaError extends Error {
|
|
399
|
+
constructor( response ) {
|
|
400
|
+
const { StatusCode: statusCode, Payload: rawPayload } = response;
|
|
401
|
+
const payload = parsePayload( rawPayload );
|
|
402
|
+
const lambdaErrorType = payload?.errorType ?? Error.name;
|
|
403
|
+
const lambdaErrorMessage = payload?.errorMessage;
|
|
404
|
+
if ( statusCode === 200 ) {
|
|
405
|
+
super( `Invoked function threw "[${lambdaErrorType}]${lambdaErrorMessage ? ' ' + lambdaErrorMessage : ''}"` );
|
|
406
|
+
} else {
|
|
407
|
+
super( 'Error invoking the function' );
|
|
408
|
+
}
|
|
409
|
+
this.statusCode = statusCode;
|
|
410
|
+
this.lambdaErrorType = lambdaErrorType;
|
|
411
|
+
this.lambdaErrorMessage = lambdaErrorMessage;
|
|
412
|
+
}
|
|
534
413
|
};
|
|
535
414
|
|
|
536
415
|
|
|
537
416
|
/***/ }),
|
|
538
417
|
|
|
539
|
-
/***/
|
|
540
|
-
/***/ ((module
|
|
541
|
-
|
|
542
|
-
const batchWrite = __webpack_require__( 8593 );
|
|
418
|
+
/***/ 536:
|
|
419
|
+
/***/ ((module) => {
|
|
543
420
|
|
|
544
|
-
module.exports =
|
|
421
|
+
module.exports = ( { key, items } ) => [
|
|
422
|
+
...items.filter( Array.isArray ).flat().reduce( ( map, v ) => {
|
|
423
|
+
const k = key( v );
|
|
424
|
+
if ( !map.has( k ) ) {
|
|
425
|
+
map.set( k, v );
|
|
426
|
+
}
|
|
427
|
+
return map;
|
|
428
|
+
}, new Map() ).values()
|
|
429
|
+
];
|
|
545
430
|
|
|
546
431
|
|
|
547
432
|
/***/ }),
|
|
548
433
|
|
|
549
|
-
/***/
|
|
550
|
-
/***/ ((module
|
|
434
|
+
/***/ 637:
|
|
435
|
+
/***/ ((module) => {
|
|
551
436
|
|
|
552
|
-
|
|
437
|
+
module.exports = ( n, d = 2 ) => {
|
|
438
|
+
if ( !isFinite( n ) || typeof n !== 'number' ) { return NaN; }
|
|
553
439
|
|
|
554
|
-
|
|
440
|
+
const m = Math.pow( 10, d );
|
|
441
|
+
const num = +( n * m ).toFixed( 8 ); // Avoid rounding errors
|
|
442
|
+
const i = Math.floor( num );
|
|
443
|
+
const f = num - i;
|
|
444
|
+
const e = 1e-8; // Allow for rounding errors in f
|
|
445
|
+
const r = ( f > 0.5 - e && f < 0.5 + e ) ? // eslint-disable-line no-nested-ternary
|
|
446
|
+
( ( i % 2 === 0 ) ? i : i + 1 ) : Math.round( num );
|
|
447
|
+
return r / m;
|
|
448
|
+
};
|
|
555
449
|
|
|
556
450
|
|
|
557
451
|
/***/ }),
|
|
558
452
|
|
|
559
|
-
/***/
|
|
453
|
+
/***/ 645:
|
|
560
454
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
561
455
|
|
|
562
|
-
const
|
|
456
|
+
const copy = __webpack_require__( 3936 );
|
|
457
|
+
const download = __webpack_require__( 345 );
|
|
458
|
+
const getSignedUrl = __webpack_require__( 3758 );
|
|
459
|
+
const head = __webpack_require__( 279 );
|
|
460
|
+
const upload = __webpack_require__( 9704 );
|
|
461
|
+
const { S3Client } = __webpack_require__( 5725 );
|
|
462
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
463
|
+
const createInstance = __webpack_require__( 5438 );
|
|
563
464
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
return item;
|
|
465
|
+
const methods = {
|
|
466
|
+
copy,
|
|
467
|
+
download,
|
|
468
|
+
getSignedUrl,
|
|
469
|
+
head,
|
|
470
|
+
upload
|
|
571
471
|
};
|
|
572
472
|
|
|
473
|
+
module.exports = createInstance( clientProvider.bind( null, S3Client ), methods );
|
|
474
|
+
|
|
573
475
|
|
|
574
476
|
/***/ }),
|
|
575
477
|
|
|
576
|
-
/***/
|
|
478
|
+
/***/ 739:
|
|
577
479
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
578
480
|
|
|
579
|
-
const
|
|
481
|
+
const { GetQueryResultsCommand } = __webpack_require__( 7493 );
|
|
482
|
+
const pollingDelay = __webpack_require__( 2549 );
|
|
483
|
+
const sleep = t => new Promise( r => setTimeout( () => r(), t ) );
|
|
580
484
|
|
|
581
|
-
|
|
485
|
+
const getResults = async ( { client, command } ) => {
|
|
486
|
+
const { results, status } = await client.send( command );
|
|
487
|
+
|
|
488
|
+
if ( [ 'Cancelled', 'Failed', 'Timeout', 'Unknown' ].includes( status ) ) {
|
|
489
|
+
throw new Error( `Query status is "${status}"` );
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if ( status === 'Complete' ) {
|
|
493
|
+
return results;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// Running, Scheduled
|
|
497
|
+
await sleep( pollingDelay );
|
|
498
|
+
return getResults( { client, command } );
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
module.exports = async ( { client, queryId } ) => {
|
|
502
|
+
const command = new GetQueryResultsCommand( { queryId } );
|
|
503
|
+
return getResults( { client, command } );
|
|
504
|
+
};
|
|
582
505
|
|
|
583
506
|
|
|
584
507
|
/***/ }),
|
|
@@ -593,20 +516,220 @@ module.exports = async ( client, ...args ) => select( client, 'scan', ...args );
|
|
|
593
516
|
|
|
594
517
|
/***/ }),
|
|
595
518
|
|
|
596
|
-
/***/
|
|
519
|
+
/***/ 798:
|
|
597
520
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
598
521
|
|
|
599
|
-
const
|
|
600
|
-
const { ScanCommand, QueryCommand } = __webpack_require__( 3489 );
|
|
522
|
+
const validators = __webpack_require__( 8994 );
|
|
601
523
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
...args,
|
|
605
|
-
...( startKey && { ExclusiveStartKey: startKey } )
|
|
606
|
-
} ) );
|
|
524
|
+
module.exports = class Hook {
|
|
525
|
+
#fn;
|
|
607
526
|
|
|
608
|
-
|
|
609
|
-
|
|
527
|
+
constructor( { fn } ) {
|
|
528
|
+
validators.function( fn );
|
|
529
|
+
this.#fn = fn;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
get fn() { return this.#fn; }
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
/***/ }),
|
|
537
|
+
|
|
538
|
+
/***/ 809:
|
|
539
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
540
|
+
|
|
541
|
+
const { DeleteSuppressedDestinationCommand } = __webpack_require__( 9556 );
|
|
542
|
+
|
|
543
|
+
module.exports = ( client, address ) => client.send( new DeleteSuppressedDestinationCommand( { EmailAddress: address } ) );
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
/***/ }),
|
|
547
|
+
|
|
548
|
+
/***/ 834:
|
|
549
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
550
|
+
|
|
551
|
+
const parseValue = __webpack_require__( 9129 );
|
|
552
|
+
|
|
553
|
+
module.exports = resultSet => {
|
|
554
|
+
const columns = resultSet.ResultSetMetadata.ColumnInfo
|
|
555
|
+
.map( col => ( { name: col.Name, type: col.Type } ) );
|
|
556
|
+
|
|
557
|
+
// first data row contains the table field names
|
|
558
|
+
return resultSet.Rows.slice( 1 ).map( row => {
|
|
559
|
+
const values = row.Data.map( d => d.VarCharValue );
|
|
560
|
+
return columns.reduce( ( obj, p, i ) => Object.assign( obj, { [p.name]: parseValue( values[i], p.type ) } ), {} );
|
|
561
|
+
} );
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
/***/ }),
|
|
566
|
+
|
|
567
|
+
/***/ 943:
|
|
568
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
569
|
+
|
|
570
|
+
const calcMean = __webpack_require__( 4124 );
|
|
571
|
+
const calcMedian = __webpack_require__( 3187 );
|
|
572
|
+
const calcMedianAbsDev = __webpack_require__( 4692 );
|
|
573
|
+
const calcStdDevPopulation = __webpack_require__( 2736 );
|
|
574
|
+
const calcStdDevSample = __webpack_require__( 6089 );
|
|
575
|
+
const calcZScore = __webpack_require__( 4110 );
|
|
576
|
+
const roundGaussian = __webpack_require__( 637 );
|
|
577
|
+
const roundStandard = __webpack_require__( 115 );
|
|
578
|
+
|
|
579
|
+
module.exports = {
|
|
580
|
+
calcMean,
|
|
581
|
+
calcMedian,
|
|
582
|
+
calcMedianAbsDev,
|
|
583
|
+
calcStdDevPopulation,
|
|
584
|
+
calcStdDevSample,
|
|
585
|
+
calcZScore,
|
|
586
|
+
roundGaussian,
|
|
587
|
+
roundStandard
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
/***/ }),
|
|
592
|
+
|
|
593
|
+
/***/ 1417:
|
|
594
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
595
|
+
|
|
596
|
+
const { GetCommand } = __webpack_require__( 3489 );
|
|
597
|
+
|
|
598
|
+
const parseArgs = args => {
|
|
599
|
+
// native args mode
|
|
600
|
+
if ( args[0] instanceof Object ) {
|
|
601
|
+
return args[0];
|
|
602
|
+
}
|
|
603
|
+
// sugar mode
|
|
604
|
+
return {
|
|
605
|
+
TableName: args[0],
|
|
606
|
+
Key: args[1]
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
module.exports = async ( client, ...args ) => {
|
|
611
|
+
const response = await client.send( new GetCommand( parseArgs( args ) ) );
|
|
612
|
+
return response.Item;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
/***/ }),
|
|
617
|
+
|
|
618
|
+
/***/ 1505:
|
|
619
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
620
|
+
|
|
621
|
+
const documentClientProvider = __webpack_require__( 2966 );
|
|
622
|
+
const get = __webpack_require__( 1417 );
|
|
623
|
+
const put = __webpack_require__( 9628 );
|
|
624
|
+
const putBatch = __webpack_require__( 5847 );
|
|
625
|
+
const query = __webpack_require__( 5265 );
|
|
626
|
+
const remove = __webpack_require__( 6777 );
|
|
627
|
+
const removeBatch = __webpack_require__( 3862 );
|
|
628
|
+
const scan = __webpack_require__( 748 );
|
|
629
|
+
const smartUpdate = __webpack_require__( 2266 );
|
|
630
|
+
const transactWrite = __webpack_require__( 1659 );
|
|
631
|
+
const update = __webpack_require__( 4144 );
|
|
632
|
+
const createInstance = __webpack_require__( 5438 );
|
|
633
|
+
|
|
634
|
+
const methods = {
|
|
635
|
+
get,
|
|
636
|
+
put,
|
|
637
|
+
putBatch,
|
|
638
|
+
query,
|
|
639
|
+
remove,
|
|
640
|
+
removeBatch,
|
|
641
|
+
scan,
|
|
642
|
+
smartUpdate,
|
|
643
|
+
transactWrite,
|
|
644
|
+
update
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
module.exports = createInstance( documentClientProvider, methods );
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
/***/ }),
|
|
651
|
+
|
|
652
|
+
/***/ 1659:
|
|
653
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
654
|
+
|
|
655
|
+
const { TransactWriteCommand } = __webpack_require__( 3489 );
|
|
656
|
+
|
|
657
|
+
module.exports = async ( client, items ) => {
|
|
658
|
+
const response = await client.send( new TransactWriteCommand( { TransactItems: items } ) );
|
|
659
|
+
return response;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
/***/ }),
|
|
664
|
+
|
|
665
|
+
/***/ 1671:
|
|
666
|
+
/***/ ((module) => {
|
|
667
|
+
|
|
668
|
+
"use strict";
|
|
669
|
+
module.exports = require("@aws-sdk/client-timestream-query");
|
|
670
|
+
|
|
671
|
+
/***/ }),
|
|
672
|
+
|
|
673
|
+
/***/ 1783:
|
|
674
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
675
|
+
|
|
676
|
+
const { SendEmailCommand } = __webpack_require__( 9556 );
|
|
677
|
+
|
|
678
|
+
module.exports = ( client, { to = [], from, html, subject }, args ) =>
|
|
679
|
+
client.send( new SendEmailCommand( {
|
|
680
|
+
Destination: {
|
|
681
|
+
ToAddresses: to
|
|
682
|
+
},
|
|
683
|
+
Content: {
|
|
684
|
+
Simple: {
|
|
685
|
+
Body: {
|
|
686
|
+
Html: {
|
|
687
|
+
Data: html,
|
|
688
|
+
Charset: 'utf-8'
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
Subject: {
|
|
692
|
+
Data: subject
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
FromEmailAddress: from,
|
|
697
|
+
...args
|
|
698
|
+
} ) );
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
/***/ }),
|
|
702
|
+
|
|
703
|
+
/***/ 1976:
|
|
704
|
+
/***/ ((module) => {
|
|
705
|
+
|
|
706
|
+
"use strict";
|
|
707
|
+
module.exports = require("@aws-sdk/client-sqs");
|
|
708
|
+
|
|
709
|
+
/***/ }),
|
|
710
|
+
|
|
711
|
+
/***/ 2047:
|
|
712
|
+
/***/ ((module) => {
|
|
713
|
+
|
|
714
|
+
module.exports = o => Object.fromEntries( Object.entries( o ).filter( ( [ , v ] ) => !Array.isArray( v ) || v.length > 0 ) );
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
/***/ }),
|
|
718
|
+
|
|
719
|
+
/***/ 2157:
|
|
720
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
721
|
+
|
|
722
|
+
const { encode, decode } = __webpack_require__( 5744 );
|
|
723
|
+
const { ScanCommand, QueryCommand } = __webpack_require__( 3489 );
|
|
724
|
+
|
|
725
|
+
const query = async ( { client, command, args, recursive, startKey, items = [], count = 0 } ) => {
|
|
726
|
+
const response = await client.send( new command( {
|
|
727
|
+
...args,
|
|
728
|
+
...( startKey && { ExclusiveStartKey: startKey } )
|
|
729
|
+
} ) );
|
|
730
|
+
|
|
731
|
+
const isCount = args.Select === 'COUNT';
|
|
732
|
+
const hasLimit = Number.isFinite( args.Limit );
|
|
610
733
|
|
|
611
734
|
const result = {
|
|
612
735
|
items: isCount ? null : items.concat( response.Items ),
|
|
@@ -715,346 +838,394 @@ module.exports = async ( client, tableName, key, keyValues ) => {
|
|
|
715
838
|
|
|
716
839
|
/***/ }),
|
|
717
840
|
|
|
718
|
-
/***/
|
|
841
|
+
/***/ 2445:
|
|
842
|
+
/***/ ((module) => {
|
|
843
|
+
|
|
844
|
+
module.exports = t => new Promise( r => setTimeout( r, t ) );
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
/***/ }),
|
|
848
|
+
|
|
849
|
+
/***/ 2538:
|
|
719
850
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
720
851
|
|
|
721
|
-
const
|
|
852
|
+
const writeRecords = __webpack_require__( 8936 );
|
|
853
|
+
const { TimestreamWriteClient } = __webpack_require__( 8248 );
|
|
854
|
+
const { Agent } = __webpack_require__( 5692 );
|
|
855
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
856
|
+
const createInstance = __webpack_require__( 5438 );
|
|
722
857
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
858
|
+
const methods = { writeRecords };
|
|
859
|
+
const defaultArgs = {
|
|
860
|
+
maxRetries: 10,
|
|
861
|
+
httpOptions: { timeout: 60000, agent: new Agent( { maxSockets: 5000 } ) }
|
|
726
862
|
};
|
|
727
863
|
|
|
864
|
+
module.exports = createInstance( args => clientProvider( TimestreamWriteClient, [ Object.assign( {}, defaultArgs, args ) ] ), methods );
|
|
865
|
+
|
|
728
866
|
|
|
729
867
|
/***/ }),
|
|
730
868
|
|
|
731
|
-
/***/
|
|
869
|
+
/***/ 2549:
|
|
870
|
+
/***/ ((module) => {
|
|
871
|
+
|
|
872
|
+
module.exports = 500;
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
/***/ }),
|
|
876
|
+
|
|
877
|
+
/***/ 2705:
|
|
732
878
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
733
879
|
|
|
734
|
-
const
|
|
880
|
+
const LambdaApi = __webpack_require__( 321 );
|
|
735
881
|
|
|
736
|
-
module.exports =
|
|
737
|
-
const args = Object.assign( { ReturnValues: 'ALL_NEW' }, nativeArgs );
|
|
738
|
-
const response = await client.send( new UpdateCommand( args ) );
|
|
739
|
-
return response.Attributes;
|
|
740
|
-
};
|
|
882
|
+
module.exports = { LambdaApi };
|
|
741
883
|
|
|
742
884
|
|
|
743
885
|
/***/ }),
|
|
744
886
|
|
|
745
|
-
/***/
|
|
887
|
+
/***/ 2710:
|
|
746
888
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
747
889
|
|
|
748
|
-
const
|
|
749
|
-
const dynamo = __webpack_require__( 1505 );
|
|
750
|
-
const lambda = __webpack_require__( 3544 );
|
|
751
|
-
const s3 = __webpack_require__( 645 );
|
|
752
|
-
const ses = __webpack_require__( 5624 );
|
|
753
|
-
const sns = __webpack_require__( 3099 );
|
|
754
|
-
const sqs = __webpack_require__( 3340 );
|
|
755
|
-
const ssm = __webpack_require__( 5888 );
|
|
756
|
-
const timestreamQuery = __webpack_require__( 4225 );
|
|
757
|
-
const timestreamWrite = __webpack_require__( 2538 );
|
|
758
|
-
|
|
759
|
-
module.exports = {
|
|
760
|
-
athena,
|
|
761
|
-
dynamo,
|
|
762
|
-
lambda,
|
|
763
|
-
s3,
|
|
764
|
-
ses,
|
|
765
|
-
sns,
|
|
766
|
-
sqs,
|
|
767
|
-
ssm,
|
|
768
|
-
timestreamQuery,
|
|
769
|
-
timestreamWrite
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
/***/ }),
|
|
774
|
-
|
|
775
|
-
/***/ 3544:
|
|
776
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
777
|
-
|
|
778
|
-
const invoke = __webpack_require__( 5894 );
|
|
779
|
-
const { LambdaClient } = __webpack_require__( 5892 );
|
|
890
|
+
const { CloudWatchLogsClient } = __webpack_require__( 7493 );
|
|
780
891
|
const clientProvider = __webpack_require__( 9039 );
|
|
892
|
+
const query = __webpack_require__( 4338 );
|
|
781
893
|
const createInstance = __webpack_require__( 5438 );
|
|
782
894
|
|
|
783
895
|
const methods = {
|
|
784
|
-
|
|
896
|
+
query
|
|
785
897
|
};
|
|
786
898
|
|
|
787
|
-
module.exports = createInstance( clientProvider.bind( null,
|
|
899
|
+
module.exports = createInstance( clientProvider.bind( null, CloudWatchLogsClient ), methods );
|
|
788
900
|
|
|
789
901
|
|
|
790
902
|
/***/ }),
|
|
791
903
|
|
|
792
|
-
/***/
|
|
904
|
+
/***/ 2736:
|
|
793
905
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
794
906
|
|
|
795
|
-
const
|
|
796
|
-
const AWSLambdaError = __webpack_require__( 468 );
|
|
907
|
+
const calcMean = __webpack_require__( 4124 );
|
|
797
908
|
|
|
798
|
-
module.exports =
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
909
|
+
module.exports = values => {
|
|
910
|
+
const mean = calcMean( values );
|
|
911
|
+
const squareDiffs = values.map( value => Math.pow( value - mean, 2 ) );
|
|
912
|
+
const avgSquareDiff = calcMean( squareDiffs );
|
|
913
|
+
return Math.sqrt( avgSquareDiff );
|
|
914
|
+
};
|
|
804
915
|
|
|
805
|
-
if ( response.FunctionError ) {
|
|
806
|
-
throw new AWSLambdaError( response );
|
|
807
|
-
}
|
|
808
916
|
|
|
809
|
-
|
|
917
|
+
/***/ }),
|
|
810
918
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
};
|
|
919
|
+
/***/ 2836:
|
|
920
|
+
/***/ ((module) => {
|
|
921
|
+
|
|
922
|
+
module.exports = ( ...args ) => [ ...new Set( args.filter( Array.isArray ).flat() ) ];
|
|
817
923
|
|
|
818
924
|
|
|
819
925
|
/***/ }),
|
|
820
926
|
|
|
821
|
-
/***/
|
|
927
|
+
/***/ 2847:
|
|
822
928
|
/***/ ((module) => {
|
|
823
929
|
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
} catch {
|
|
828
|
-
return null;
|
|
829
|
-
}
|
|
930
|
+
const parseInteger = value => {
|
|
931
|
+
const number = parseInt( value, 10 );
|
|
932
|
+
return number <= Number.MAX_SAFE_INTEGER && number >= Number.MIN_SAFE_INTEGER ? number : value;
|
|
830
933
|
};
|
|
831
934
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const payload = parsePayload( rawPayload );
|
|
836
|
-
const lambdaErrorType = payload?.errorType ?? Error.name;
|
|
837
|
-
const lambdaErrorMessage = payload?.errorMessage;
|
|
838
|
-
if ( statusCode === 200 ) {
|
|
839
|
-
super( `Invoked function threw "[${lambdaErrorType}]${lambdaErrorMessage ? ' ' + lambdaErrorMessage : ''}"` );
|
|
840
|
-
} else {
|
|
841
|
-
super( 'Error invoking the function' );
|
|
842
|
-
}
|
|
843
|
-
this.statusCode = statusCode;
|
|
844
|
-
this.lambdaErrorType = lambdaErrorType;
|
|
845
|
-
this.lambdaErrorMessage = lambdaErrorMessage;
|
|
935
|
+
const parseFloatingPoint = value => {
|
|
936
|
+
if ( value.replace( /[^\d]/g, '' ).length > 16 ) {
|
|
937
|
+
return value;
|
|
846
938
|
}
|
|
939
|
+
const number = parseFloat( value, 10 );
|
|
940
|
+
return number <= Number.MAX_SAFE_INTEGER && number >= Number.MIN_SAFE_INTEGER ? number : value;
|
|
847
941
|
};
|
|
848
942
|
|
|
943
|
+
/* eslint-disable consistent-return */
|
|
944
|
+
module.exports = value => {
|
|
945
|
+
if ( [ null, undefined ].includes( value ) ) {
|
|
946
|
+
return undefined;
|
|
947
|
+
}
|
|
849
948
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
854
|
-
|
|
855
|
-
const { CopyObjectCommand } = __webpack_require__( 5725 );
|
|
856
|
-
|
|
857
|
-
module.exports = async ( client, bucket, key, source, nativeArgs ) => {
|
|
858
|
-
const response = await client.send( new CopyObjectCommand( {
|
|
859
|
-
...nativeArgs,
|
|
860
|
-
Bucket: bucket,
|
|
861
|
-
Key: key,
|
|
862
|
-
CopySource: source
|
|
863
|
-
} ) );
|
|
864
|
-
return response;
|
|
865
|
-
};
|
|
949
|
+
if ( /^\d{4}-\d\d-\d\d((T| )\d\d:\d\d:\d\d(.\d{3})?(Z|\+\d\d:?\d\d)?)?$/.test( value ) ) {
|
|
950
|
+
return new Date( value );
|
|
951
|
+
}
|
|
866
952
|
|
|
953
|
+
// integer
|
|
954
|
+
if ( /^-?\d+$/.test( value ) ) {
|
|
955
|
+
return parseInteger( value );
|
|
956
|
+
}
|
|
867
957
|
|
|
868
|
-
|
|
958
|
+
// float
|
|
959
|
+
if ( /^-?(\d+\.|\.\d+|\d+\.\d+)$/.test( value ) ) {
|
|
960
|
+
return parseFloatingPoint( value );
|
|
961
|
+
}
|
|
869
962
|
|
|
870
|
-
|
|
871
|
-
|
|
963
|
+
// boolean
|
|
964
|
+
if ( /^true$/.test( value ) ) {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
872
967
|
|
|
873
|
-
|
|
968
|
+
if ( /^false$/.test( value ) ) {
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
874
971
|
|
|
875
|
-
|
|
876
|
-
const response = await client.send( new GetObjectCommand( {
|
|
877
|
-
...nativeArgs,
|
|
878
|
-
Bucket: bucket,
|
|
879
|
-
Key: key
|
|
880
|
-
} ) );
|
|
881
|
-
const stream = response.Body;
|
|
882
|
-
return Buffer.concat( await stream.toArray() ).toString( 'utf-8' );
|
|
972
|
+
return value;
|
|
883
973
|
};
|
|
884
974
|
|
|
885
975
|
|
|
886
976
|
/***/ }),
|
|
887
977
|
|
|
888
|
-
/***/
|
|
978
|
+
/***/ 2966:
|
|
889
979
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
890
980
|
|
|
891
|
-
const {
|
|
892
|
-
const {
|
|
893
|
-
|
|
894
|
-
module.exports = async ( client, bucket, key, expiration ) => {
|
|
895
|
-
const getObjectCmd = new GetObjectCommand( { Bucket: bucket, Key: key } );
|
|
896
|
-
const url = await getSignedUrl( client, getObjectCmd, { expiresIn: expiration } );
|
|
897
|
-
return url;
|
|
898
|
-
};
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
/***/ }),
|
|
981
|
+
const { DynamoDBClient } = __webpack_require__( 4671 );
|
|
982
|
+
const { DynamoDBDocumentClient } = __webpack_require__( 3489 );
|
|
983
|
+
const cache = __webpack_require__( 4164 );
|
|
902
984
|
|
|
903
|
-
|
|
904
|
-
|
|
985
|
+
module.exports = nativeArgs => {
|
|
986
|
+
const translateConfig = {
|
|
987
|
+
// Yes I copied those from the docs, read more here:
|
|
988
|
+
// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#dynamodbdocumentclientresolvedconfig-1
|
|
989
|
+
marshallOptions: {
|
|
990
|
+
// Whether to automatically convert empty strings, blobs, and sets to `null`.
|
|
991
|
+
convertEmptyValues: true, // false, by default.
|
|
992
|
+
// Whether to remove undefined values while marshalling.
|
|
993
|
+
removeUndefinedValues: true, // false, by default.
|
|
994
|
+
// Whether to convert typeof object to map attribute.
|
|
995
|
+
convertClassInstanceToMap: true // false, by default.
|
|
996
|
+
},
|
|
997
|
+
unmarshallOptions: {
|
|
998
|
+
// Whether to return numbers as a string instead of converting them to native JavaScript numbers.
|
|
999
|
+
wrapNumbers: false // false, by default.
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
905
1002
|
|
|
906
|
-
const
|
|
1003
|
+
const key = `Dynamodb(${JSON.stringify( nativeArgs )}).DocumentClient`;
|
|
1004
|
+
return cache.get( key ) ?? ( () => {
|
|
1005
|
+
const client = new DynamoDBClient( nativeArgs );
|
|
1006
|
+
const docClient = DynamoDBDocumentClient.from( client, translateConfig );
|
|
907
1007
|
|
|
908
|
-
|
|
909
|
-
|
|
1008
|
+
cache.set( key, docClient );
|
|
1009
|
+
return docClient;
|
|
1010
|
+
} )();
|
|
1011
|
+
};
|
|
910
1012
|
|
|
911
1013
|
|
|
912
1014
|
/***/ }),
|
|
913
1015
|
|
|
914
|
-
/***/
|
|
1016
|
+
/***/ 3099:
|
|
915
1017
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
916
1018
|
|
|
917
|
-
const
|
|
918
|
-
const
|
|
919
|
-
const getSignedUrl = __webpack_require__( 3758 );
|
|
920
|
-
const head = __webpack_require__( 279 );
|
|
921
|
-
const upload = __webpack_require__( 9704 );
|
|
922
|
-
const { S3Client } = __webpack_require__( 5725 );
|
|
1019
|
+
const publish = __webpack_require__( 8080 );
|
|
1020
|
+
const { SNSClient } = __webpack_require__( 7651 );
|
|
923
1021
|
const clientProvider = __webpack_require__( 9039 );
|
|
924
1022
|
const createInstance = __webpack_require__( 5438 );
|
|
925
1023
|
|
|
926
1024
|
const methods = {
|
|
927
|
-
|
|
928
|
-
download,
|
|
929
|
-
getSignedUrl,
|
|
930
|
-
head,
|
|
931
|
-
upload
|
|
1025
|
+
publish
|
|
932
1026
|
};
|
|
933
1027
|
|
|
934
|
-
module.exports = createInstance( clientProvider.bind( null,
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
/***/ }),
|
|
938
|
-
|
|
939
|
-
/***/ 9704:
|
|
940
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
941
|
-
|
|
942
|
-
const { PutObjectCommand } = __webpack_require__( 5725 );
|
|
943
|
-
|
|
944
|
-
module.exports = ( client, bucket, key, body, nativeArgs ) =>
|
|
945
|
-
client.send( new PutObjectCommand( {
|
|
946
|
-
...nativeArgs,
|
|
947
|
-
Bucket: bucket,
|
|
948
|
-
Key: key,
|
|
949
|
-
Body: typeof body === 'string' ? body : JSON.stringify( body )
|
|
950
|
-
} ) );
|
|
1028
|
+
module.exports = createInstance( clientProvider.bind( null, SNSClient ), methods );
|
|
951
1029
|
|
|
952
1030
|
|
|
953
1031
|
/***/ }),
|
|
954
1032
|
|
|
955
|
-
/***/
|
|
956
|
-
/***/ ((module
|
|
957
|
-
|
|
958
|
-
const { DeleteSuppressedDestinationCommand } = __webpack_require__( 9556 );
|
|
959
|
-
|
|
960
|
-
module.exports = ( client, address ) => client.send( new DeleteSuppressedDestinationCommand( { EmailAddress: address } ) );
|
|
1033
|
+
/***/ 3106:
|
|
1034
|
+
/***/ ((module) => {
|
|
961
1035
|
|
|
1036
|
+
"use strict";
|
|
1037
|
+
module.exports = require("zlib");
|
|
962
1038
|
|
|
963
1039
|
/***/ }),
|
|
964
1040
|
|
|
965
|
-
/***/
|
|
1041
|
+
/***/ 3109:
|
|
966
1042
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
967
1043
|
|
|
968
|
-
const
|
|
969
|
-
const sendEmail = __webpack_require__( 1783 );
|
|
970
|
-
const { SESv2Client } = __webpack_require__( 9556 );
|
|
971
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
972
|
-
const createInstance = __webpack_require__( 5438 );
|
|
973
|
-
|
|
974
|
-
const methods = {
|
|
975
|
-
deleteSuppressedDestination,
|
|
976
|
-
sendEmail
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
module.exports = createInstance( clientProvider.bind( null, SESv2Client ), methods );
|
|
1044
|
+
const validators = __webpack_require__( 8994 );
|
|
980
1045
|
|
|
1046
|
+
module.exports = class Handler {
|
|
1047
|
+
#method;
|
|
1048
|
+
#fn;
|
|
1049
|
+
#route;
|
|
1050
|
+
#routeIncludes;
|
|
1051
|
+
#routeNotIncludes;
|
|
1052
|
+
#routeMatches;
|
|
1053
|
+
#path;
|
|
1054
|
+
#pathIncludes;
|
|
1055
|
+
#pathNotIncludes;
|
|
1056
|
+
#pathMatches;
|
|
981
1057
|
|
|
982
|
-
|
|
1058
|
+
constructor( { method, fn, ...matchers } ) {
|
|
1059
|
+
validators.httpMethod( method );
|
|
1060
|
+
validators.function( fn );
|
|
1061
|
+
validators.matcherRoute( matchers.route );
|
|
1062
|
+
validators.matcherRouteIncludes( matchers.routeIncludes );
|
|
1063
|
+
validators.matcherRouteNotIncludes( matchers.routeNotIncludes );
|
|
1064
|
+
validators.matcherRouteMatch( matchers.routeMatch );
|
|
1065
|
+
validators.matcherPath( matchers.path );
|
|
1066
|
+
validators.matcherPathIncludes( matchers.pathIncludes );
|
|
1067
|
+
validators.matcherPathNotIncludes( matchers.pathNotIncludes );
|
|
1068
|
+
validators.matcherPathMatch( matchers.pathMatch );
|
|
983
1069
|
|
|
984
|
-
|
|
985
|
-
|
|
1070
|
+
this.#method = method;
|
|
1071
|
+
this.#fn = fn;
|
|
1072
|
+
this.#route = matchers.route;
|
|
1073
|
+
this.#routeIncludes = matchers.routeIncludes;
|
|
1074
|
+
this.#routeNotIncludes = matchers.routeNotIncludes;
|
|
1075
|
+
this.#routeMatches = matchers.routeMatches;
|
|
1076
|
+
this.#path = matchers.path;
|
|
1077
|
+
this.#pathIncludes = matchers.pathIncludes;
|
|
1078
|
+
this.#pathNotIncludes = matchers.pathNotIncludes;
|
|
1079
|
+
this.#pathMatches = matchers.pathMatches;
|
|
1080
|
+
}
|
|
986
1081
|
|
|
987
|
-
|
|
1082
|
+
match( event ) {
|
|
1083
|
+
if ( this.#method !== event.method ) {
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
if ( this.#route ) {
|
|
1087
|
+
return this.#route === event.route;
|
|
1088
|
+
}
|
|
1089
|
+
if ( this.#path ) {
|
|
1090
|
+
return this.#path === event.path;
|
|
1091
|
+
}
|
|
1092
|
+
if ( this.#routeIncludes && !event.route.includes( this.#routeIncludes ) ) {
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
if ( this.#routeNotIncludes && event.route.includes( this.#routeNotIncludes ) ) {
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1098
|
+
if ( this.#routeMatches && !this.#routeMatches.test( event.route ) ) {
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1101
|
+
if ( this.#pathIncludes && !event.path.includes( this.#pathIncludes ) ) {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
if ( this.#pathNotIncludes && event.path.includes( this.#pathNotIncludes ) ) {
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
if ( this.#pathMatches && !this.#pathMatches.test( event.path ) ) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
988
1112
|
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
Destination: {
|
|
992
|
-
ToAddresses: to
|
|
993
|
-
},
|
|
994
|
-
Content: {
|
|
995
|
-
Simple: {
|
|
996
|
-
Body: {
|
|
997
|
-
Html: {
|
|
998
|
-
Data: html,
|
|
999
|
-
Charset: 'utf-8'
|
|
1000
|
-
}
|
|
1001
|
-
},
|
|
1002
|
-
Subject: {
|
|
1003
|
-
Data: subject
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
},
|
|
1007
|
-
FromEmailAddress: from,
|
|
1008
|
-
...args
|
|
1009
|
-
} ) );
|
|
1113
|
+
get fn() { return this.#fn; }
|
|
1114
|
+
};
|
|
1010
1115
|
|
|
1011
1116
|
|
|
1012
1117
|
/***/ }),
|
|
1013
1118
|
|
|
1014
|
-
/***/
|
|
1119
|
+
/***/ 3119:
|
|
1015
1120
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1016
1121
|
|
|
1017
|
-
const
|
|
1018
|
-
const
|
|
1019
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
1020
|
-
const createInstance = __webpack_require__( 5438 );
|
|
1122
|
+
const { snakelize, camelize } = __webpack_require__( 5762 );
|
|
1123
|
+
const charset = 'utf-8';
|
|
1021
1124
|
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1125
|
+
const transformFns = {
|
|
1126
|
+
camelcase: camelize,
|
|
1127
|
+
snakecase: snakelize
|
|
1024
1128
|
};
|
|
1025
1129
|
|
|
1026
|
-
module.exports =
|
|
1130
|
+
module.exports = class ApiResponse {
|
|
1131
|
+
#headers = null;
|
|
1132
|
+
#statusCode = null;
|
|
1133
|
+
#transformFn = false;
|
|
1134
|
+
#isBase64Encoded = false;
|
|
1135
|
+
#body = '';
|
|
1136
|
+
|
|
1137
|
+
constructor( { headers = {}, transform } = {} ) {
|
|
1138
|
+
this.#transformFn = transformFns[transform] ?? ( v => v );
|
|
1139
|
+
this.#headers = Object.assign( {
|
|
1140
|
+
'Cache-Control': 'no-store',
|
|
1141
|
+
'Access-Control-Allow-Origin': '*'
|
|
1142
|
+
}, headers );
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
setContent( statusCode, body, headers = {}, isBase64Encoded = false ) {
|
|
1146
|
+
this.#statusCode = statusCode;
|
|
1147
|
+
this.#isBase64Encoded = isBase64Encoded;
|
|
1148
|
+
if ( body?.length === 0 || [ null, undefined ].includes( body ) ) {
|
|
1149
|
+
this.#body = '';
|
|
1150
|
+
} else if ( typeof body === 'object' ) {
|
|
1151
|
+
this.#body = JSON.stringify( this.#transformFn( body ) );
|
|
1152
|
+
this.#headers['Content-Type'] = `application/json; charset=${charset}`;
|
|
1153
|
+
} else {
|
|
1154
|
+
this.#body = String( body );
|
|
1155
|
+
this.#headers['Content-Type'] = `text/plain; charset=${charset}`;
|
|
1156
|
+
}
|
|
1157
|
+
this.#headers['Content-Length'] = this.#body.length;
|
|
1158
|
+
Object.assign( this.#headers, headers ?? {} );
|
|
1159
|
+
return this;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
toJSON() {
|
|
1163
|
+
return {
|
|
1164
|
+
isBase64Encoded: this.#isBase64Encoded,
|
|
1165
|
+
statusCode: this.#statusCode,
|
|
1166
|
+
body: this.#body,
|
|
1167
|
+
headers: this.#headers
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1027
1171
|
|
|
1028
1172
|
|
|
1029
1173
|
/***/ }),
|
|
1030
1174
|
|
|
1031
|
-
/***/
|
|
1175
|
+
/***/ 3131:
|
|
1032
1176
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1033
1177
|
|
|
1034
|
-
const {
|
|
1178
|
+
const { SendMessageBatchCommand } = __webpack_require__( 1976 );
|
|
1179
|
+
const sanitizeSqs = __webpack_require__( 8175 );
|
|
1035
1180
|
|
|
1036
|
-
module.exports = async ( client,
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1181
|
+
module.exports = async ( client, queue, messages ) => {
|
|
1182
|
+
if ( messages.length > 10 ) {
|
|
1183
|
+
throw new Error( 'SQS.sendMessageBatch only accepts up to then messages.' );
|
|
1184
|
+
}
|
|
1185
|
+
const response = await client.send( new SendMessageBatchCommand( {
|
|
1186
|
+
QueueUrl: queue,
|
|
1187
|
+
Entries: messages.map( ( { body, id = null, nativeArgs }, index ) => ( {
|
|
1188
|
+
Id: id ?? `message_${index}`,
|
|
1189
|
+
MessageBody: sanitizeSqs( typeof body === 'string' ? body : JSON.stringify( body ) ),
|
|
1190
|
+
...nativeArgs
|
|
1191
|
+
} ) )
|
|
1041
1192
|
} ) );
|
|
1042
|
-
|
|
1193
|
+
|
|
1194
|
+
if ( response.Failed?.length > 0 ) {
|
|
1195
|
+
const error = new Error( 'SQS.sendMessageBatch Failed. See error details' );
|
|
1196
|
+
error.details = response.Failed;
|
|
1197
|
+
throw error;
|
|
1198
|
+
}
|
|
1199
|
+
return response;
|
|
1043
1200
|
};
|
|
1044
1201
|
|
|
1045
1202
|
|
|
1046
1203
|
/***/ }),
|
|
1047
1204
|
|
|
1048
|
-
/***/
|
|
1049
|
-
/***/ ((module
|
|
1205
|
+
/***/ 3187:
|
|
1206
|
+
/***/ ((module) => {
|
|
1050
1207
|
|
|
1051
|
-
|
|
1208
|
+
module.exports = values => {
|
|
1209
|
+
//Sort bug: https://www.tutorialrepublic.com/faq/how-to-sort-an-array-of-integers-correctly-in-javascript.php
|
|
1210
|
+
const sorted = values.slice().sort( ( a, b ) => a - b );
|
|
1211
|
+
const evenArray = values.length % 2 === 0;
|
|
1212
|
+
const midIndex = Math.floor( values.length / 2 );
|
|
1213
|
+
return evenArray ? ( sorted[midIndex - 1] + sorted[midIndex] ) / 2 : sorted[midIndex];
|
|
1214
|
+
};
|
|
1052
1215
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1216
|
+
|
|
1217
|
+
/***/ }),
|
|
1218
|
+
|
|
1219
|
+
/***/ 3258:
|
|
1220
|
+
/***/ ((module) => {
|
|
1221
|
+
|
|
1222
|
+
module.exports = input =>
|
|
1223
|
+
// Break the string into sequences to rebuild later
|
|
1224
|
+
!input ? input : input.split( /\s/ )
|
|
1225
|
+
// ALL_CAPS terms are ignored
|
|
1226
|
+
.map( term => [ term, term.charAt( 0 ).toUpperCase() + term.slice( 1 ).toLowerCase() ] )
|
|
1227
|
+
// Rebuild the string replacing the converter terms keeping the original delimiters
|
|
1228
|
+
.reduce( ( result, [ term, repl ] ) => result.replace( term, repl ), input );
|
|
1058
1229
|
|
|
1059
1230
|
|
|
1060
1231
|
/***/ }),
|
|
@@ -1080,779 +1251,628 @@ module.exports = createInstance( clientProvider.bind( null, SQSClient ), methods
|
|
|
1080
1251
|
|
|
1081
1252
|
/***/ }),
|
|
1082
1253
|
|
|
1083
|
-
/***/
|
|
1254
|
+
/***/ 3402:
|
|
1084
1255
|
/***/ ((module) => {
|
|
1085
1256
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1257
|
+
// convert a string to snake_case
|
|
1258
|
+
module.exports = ( input, { keepAllCaps = false } = {} ) =>
|
|
1259
|
+
// Break the string into sequences to rebuild later
|
|
1260
|
+
!input ? input : input.split( /\s/ )
|
|
1261
|
+
// ALL_CAPS terms are ignored
|
|
1262
|
+
.map( term => [ term, keepAllCaps && /^[A-Z_]+$/g.test( term ) ? term : term
|
|
1263
|
+
.replace( /-/g, '_' ) // replaces hyphen
|
|
1264
|
+
.replace( /([a-z\d])([A-Z])/g, '$1_$2' ) // add _ between lower and upper case letters
|
|
1265
|
+
.replace( /([A-Z])([A-Z])(?=[a-z\d])/g, '$1_$2' ).toLowerCase() // add _ between uppercase char and next uppercase char follow by lowercase
|
|
1266
|
+
] )
|
|
1267
|
+
// Rebuild the string replacing the converter terms keeping the original delimiters
|
|
1268
|
+
.reduce( ( result, [ term, repl ] ) => result.replace( term, repl ), input );
|
|
1092
1269
|
|
|
1093
1270
|
|
|
1094
1271
|
/***/ }),
|
|
1095
1272
|
|
|
1096
|
-
/***/
|
|
1097
|
-
/***/ ((module
|
|
1273
|
+
/***/ 3446:
|
|
1274
|
+
/***/ ((module) => {
|
|
1098
1275
|
|
|
1099
|
-
|
|
1100
|
-
const sanitizeSqs = __webpack_require__( 8175 );
|
|
1276
|
+
module.exports = class LambdaApiValidationError extends Error {};
|
|
1101
1277
|
|
|
1102
|
-
module.exports = async ( client, queue, body, args ) => {
|
|
1103
|
-
const response = await client.send( new SendMessageCommand( {
|
|
1104
|
-
...args,
|
|
1105
|
-
MessageBody: sanitizeSqs( typeof body === 'string' ? body : JSON.stringify( body ) ),
|
|
1106
|
-
QueueUrl: queue
|
|
1107
|
-
} ) );
|
|
1108
|
-
return response.MessageId;
|
|
1109
|
-
};
|
|
1110
1278
|
|
|
1279
|
+
/***/ }),
|
|
1280
|
+
|
|
1281
|
+
/***/ 3489:
|
|
1282
|
+
/***/ ((module) => {
|
|
1283
|
+
|
|
1284
|
+
"use strict";
|
|
1285
|
+
module.exports = require("@aws-sdk/lib-dynamodb");
|
|
1111
1286
|
|
|
1112
1287
|
/***/ }),
|
|
1113
1288
|
|
|
1114
|
-
/***/
|
|
1289
|
+
/***/ 3544:
|
|
1115
1290
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1116
1291
|
|
|
1117
|
-
const
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
if ( messages.length > 10 ) {
|
|
1122
|
-
throw new Error( 'SQS.sendMessageBatch only accepts up to then messages.' );
|
|
1123
|
-
}
|
|
1124
|
-
const response = await client.send( new SendMessageBatchCommand( {
|
|
1125
|
-
QueueUrl: queue,
|
|
1126
|
-
Entries: messages.map( ( { body, id = null, nativeArgs }, index ) => ( {
|
|
1127
|
-
Id: id ?? `message_${index}`,
|
|
1128
|
-
MessageBody: sanitizeSqs( typeof body === 'string' ? body : JSON.stringify( body ) ),
|
|
1129
|
-
...nativeArgs
|
|
1130
|
-
} ) )
|
|
1131
|
-
} ) );
|
|
1292
|
+
const invoke = __webpack_require__( 5894 );
|
|
1293
|
+
const { LambdaClient } = __webpack_require__( 5892 );
|
|
1294
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
1295
|
+
const createInstance = __webpack_require__( 5438 );
|
|
1132
1296
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
error.details = response.Failed;
|
|
1136
|
-
throw error;
|
|
1137
|
-
}
|
|
1138
|
-
return response;
|
|
1297
|
+
const methods = {
|
|
1298
|
+
invoke
|
|
1139
1299
|
};
|
|
1140
1300
|
|
|
1301
|
+
module.exports = createInstance( clientProvider.bind( null, LambdaClient ), methods );
|
|
1302
|
+
|
|
1141
1303
|
|
|
1142
1304
|
/***/ }),
|
|
1143
1305
|
|
|
1144
|
-
/***/
|
|
1306
|
+
/***/ 3649:
|
|
1145
1307
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1146
1308
|
|
|
1147
|
-
const
|
|
1148
|
-
const { GetParameterCommand } = __webpack_require__( 4348 );
|
|
1309
|
+
const { StartQueryCommand } = __webpack_require__( 7493 );
|
|
1149
1310
|
|
|
1150
|
-
module.exports = async ( client,
|
|
1151
|
-
const
|
|
1152
|
-
const
|
|
1153
|
-
if ( cacheValue ) { return cacheValue; }
|
|
1311
|
+
module.exports = async ( { client, nativeArgs, range } ) => {
|
|
1312
|
+
const startTime = range?.from ? Math.trunc( range.from / 1000 ) : nativeArgs.startTime;
|
|
1313
|
+
const endTime = range?.to ? Math.trunc( range.to / 1000 ) : nativeArgs.endTime;
|
|
1154
1314
|
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
const value = response?.Parameter?.Value;
|
|
1158
|
-
cacheStorage.set( key, value );
|
|
1159
|
-
return value;
|
|
1160
|
-
} catch ( error ) {
|
|
1161
|
-
if ( error.constructor.name === 'ParameterNotFound' ) {
|
|
1162
|
-
return null;
|
|
1163
|
-
}
|
|
1164
|
-
throw error;
|
|
1165
|
-
}
|
|
1315
|
+
const { queryId } = await client.send( new StartQueryCommand( { ...nativeArgs, startTime, endTime } ) );
|
|
1316
|
+
return queryId;
|
|
1166
1317
|
};
|
|
1167
1318
|
|
|
1168
1319
|
|
|
1169
1320
|
/***/ }),
|
|
1170
1321
|
|
|
1171
|
-
/***/
|
|
1172
|
-
/***/ ((module
|
|
1173
|
-
|
|
1174
|
-
const get = __webpack_require__( 8660 );
|
|
1175
|
-
const { SSMClient } = __webpack_require__( 4348 );
|
|
1176
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
1177
|
-
const createInstance = __webpack_require__( 5438 );
|
|
1178
|
-
|
|
1179
|
-
const methods = { get };
|
|
1180
|
-
|
|
1181
|
-
module.exports = createInstance( clientProvider.bind( null, SSMClient ), methods );
|
|
1322
|
+
/***/ 3744:
|
|
1323
|
+
/***/ ((module) => {
|
|
1182
1324
|
|
|
1325
|
+
"use strict";
|
|
1326
|
+
module.exports = require("@aws-sdk/client-athena");
|
|
1183
1327
|
|
|
1184
1328
|
/***/ }),
|
|
1185
1329
|
|
|
1186
|
-
/***/
|
|
1330
|
+
/***/ 3758:
|
|
1187
1331
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1188
1332
|
|
|
1189
|
-
const
|
|
1190
|
-
const {
|
|
1191
|
-
const { Agent } = __webpack_require__( 5692 );
|
|
1192
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
1193
|
-
const createInstance = __webpack_require__( 5438 );
|
|
1333
|
+
const { getSignedUrl } = __webpack_require__( 4991 );
|
|
1334
|
+
const { GetObjectCommand } = __webpack_require__( 5725 );
|
|
1194
1335
|
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1198
|
-
|
|
1336
|
+
module.exports = async ( client, bucket, key, expiration ) => {
|
|
1337
|
+
const getObjectCmd = new GetObjectCommand( { Bucket: bucket, Key: key } );
|
|
1338
|
+
const url = await getSignedUrl( client, getObjectCmd, { expiresIn: expiration } );
|
|
1339
|
+
return url;
|
|
1199
1340
|
};
|
|
1200
1341
|
|
|
1201
|
-
module.exports = createInstance( args => clientProvider( TimestreamQueryClient, [ Object.assign( {}, defaultArgs, args ) ] ), methods );
|
|
1202
|
-
|
|
1203
1342
|
|
|
1204
1343
|
/***/ }),
|
|
1205
1344
|
|
|
1206
|
-
/***/
|
|
1345
|
+
/***/ 3830:
|
|
1207
1346
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1208
1347
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1216
|
-
return asInt <= Number.MAX_SAFE_INTEGER && asInt >= Number.MIN_SAFE_INTEGER ? asInt : value;
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
const parseScalarValue = ( type, value ) => {
|
|
1220
|
-
switch ( type ) {
|
|
1221
|
-
case ScalarType.BOOLEAN:
|
|
1222
|
-
return value === 'true';
|
|
1223
|
-
case ScalarType.DOUBLE:
|
|
1224
|
-
return parseFloat( value );
|
|
1225
|
-
case ScalarType.TIMESTAMP:
|
|
1226
|
-
return new Date( `${value.replace( ' ', 'T' )}Z` );
|
|
1227
|
-
case ScalarType.INTEGER:
|
|
1228
|
-
return parseInt( value, 10 );
|
|
1229
|
-
case ScalarType.UNKNOWN: // is NULL
|
|
1230
|
-
return null;
|
|
1231
|
-
case ScalarType.BIGINT:
|
|
1232
|
-
return parseBigInt( value );
|
|
1233
|
-
case ScalarType.VARCHAR:
|
|
1234
|
-
case ScalarType.DATE:
|
|
1235
|
-
case ScalarType.TIME:
|
|
1236
|
-
case ScalarType.INTERVAL_DAY_TO_SECOND:
|
|
1237
|
-
case ScalarType.INTERVAL_YEAR_TO_MONTH:
|
|
1238
|
-
default:
|
|
1239
|
-
return value;
|
|
1240
|
-
}
|
|
1241
|
-
};
|
|
1242
|
-
|
|
1243
|
-
const parseValue = ( typeInfo, datum ) => {
|
|
1244
|
-
// value might be null
|
|
1245
|
-
if ( datum['NullValue'] === true ) {
|
|
1246
|
-
return null;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
// or a time series
|
|
1250
|
-
if ( Object.hasOwn( typeInfo, 'TimeSeriesMeasureValueColumnInfo' ) ) {
|
|
1251
|
-
return datum.TimeSeriesValue.map( v => ( {
|
|
1252
|
-
time: new Date( v.Time ),
|
|
1253
|
-
value: parseValue( typeInfo.TimeSeriesMeasureValueColumnInfo.Type, v.Value )
|
|
1254
|
-
} ) );
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
// maybe an array
|
|
1258
|
-
if ( Object.hasOwn( typeInfo, 'ArrayColumnInfo' ) ) {
|
|
1259
|
-
return datum.ArrayValue.map( v => parseValue( typeInfo.ArrayColumnInfo.Type, v ) );
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
// or even a row
|
|
1263
|
-
if ( Object.hasOwn( typeInfo, 'RowColumnInfo' ) ) {
|
|
1264
|
-
const rowColumnInfo = typeInfo.RowColumnInfo;
|
|
1265
|
-
return datum.RowValue.Data.reduce( ( object, value, index ) => {
|
|
1266
|
-
const { Name: name, Type: typeInfo } = rowColumnInfo[index];
|
|
1267
|
-
return Object.assign( object, { [name]: parseValue( typeInfo, value ) } );
|
|
1268
|
-
}, {} );
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
// if none, it is scalar
|
|
1272
|
-
return parseScalarValue( typeInfo.ScalarType, datum['ScalarValue'] );
|
|
1273
|
-
};
|
|
1348
|
+
const days = __webpack_require__( 5263 );
|
|
1349
|
+
const hours = __webpack_require__( 6961 );
|
|
1350
|
+
const minutes = __webpack_require__( 6635 );
|
|
1351
|
+
const months = __webpack_require__( 8119 );
|
|
1352
|
+
const msToS = __webpack_require__( 7416 );
|
|
1353
|
+
const round = __webpack_require__( 3990 );
|
|
1354
|
+
const seconds = __webpack_require__( 7051 );
|
|
1274
1355
|
|
|
1275
|
-
module.exports =
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1356
|
+
module.exports = {
|
|
1357
|
+
days,
|
|
1358
|
+
hours,
|
|
1359
|
+
minutes,
|
|
1360
|
+
months,
|
|
1361
|
+
msToS,
|
|
1362
|
+
round,
|
|
1363
|
+
seconds
|
|
1283
1364
|
};
|
|
1284
1365
|
|
|
1285
1366
|
|
|
1286
1367
|
/***/ }),
|
|
1287
1368
|
|
|
1288
|
-
/***/
|
|
1369
|
+
/***/ 3862:
|
|
1289
1370
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1290
1371
|
|
|
1291
|
-
const
|
|
1292
|
-
const { camelize } = __webpack_require__( 5762 );
|
|
1293
|
-
const parseItems = __webpack_require__( 7261 );
|
|
1294
|
-
|
|
1295
|
-
const query = async ( client, queryString, { prevItems = [], recursive, paginationToken, maxRows, rawResponse } ) => {
|
|
1296
|
-
const response = await client.send( new QueryCommand( { QueryString: queryString, NextToken: paginationToken, MaxRows: maxRows } ) );
|
|
1297
|
-
if ( !recursive && rawResponse ) {
|
|
1298
|
-
return response;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
const nextToken = response.NextToken;
|
|
1302
|
-
if ( nextToken && recursive ) {
|
|
1303
|
-
return query( client, queryString, { prevItems: parseItems( response ), recursive, paginationToken: nextToken, maxRows } );
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
const items = prevItems.concat( parseItems( response ) );
|
|
1307
|
-
return { nextToken, count: items.length, items, queryStatus: camelize( response.QueryStatus ) };
|
|
1308
|
-
};
|
|
1372
|
+
const batchWrite = __webpack_require__( 8593 );
|
|
1309
1373
|
|
|
1310
|
-
module.exports = async ( client,
|
|
1311
|
-
query( client, queryString, { recursive, paginationToken, maxRows, rawResponse } );
|
|
1374
|
+
module.exports = async ( client, ...args ) => batchWrite( client, 'remove', ...args );
|
|
1312
1375
|
|
|
1313
1376
|
|
|
1314
1377
|
/***/ }),
|
|
1315
1378
|
|
|
1316
|
-
/***/
|
|
1317
|
-
/***/ ((module
|
|
1318
|
-
|
|
1319
|
-
const writeRecords = __webpack_require__( 8936 );
|
|
1320
|
-
const { TimestreamWriteClient } = __webpack_require__( 8248 );
|
|
1321
|
-
const { Agent } = __webpack_require__( 5692 );
|
|
1322
|
-
const clientProvider = __webpack_require__( 9039 );
|
|
1323
|
-
const createInstance = __webpack_require__( 5438 );
|
|
1324
|
-
|
|
1325
|
-
const methods = { writeRecords };
|
|
1326
|
-
const defaultArgs = {
|
|
1327
|
-
maxRetries: 10,
|
|
1328
|
-
httpOptions: { timeout: 60000, agent: new Agent( { maxSockets: 5000 } ) }
|
|
1329
|
-
};
|
|
1379
|
+
/***/ 3914:
|
|
1380
|
+
/***/ ((module) => {
|
|
1330
1381
|
|
|
1331
|
-
|
|
1382
|
+
// Convert a string to camelCase
|
|
1383
|
+
module.exports = ( input, { keepAllCaps = false } = {} ) =>
|
|
1384
|
+
// Break the string into sequences to rebuild later
|
|
1385
|
+
!input ? input : input.split( /\s/ )
|
|
1386
|
+
// ALL_CAPS terms are ignored
|
|
1387
|
+
.map( term => [ term, keepAllCaps && /^[A-Z_]+$/g.test( term ) ? term : term
|
|
1388
|
+
// Matches the penultimate letter in a sequence of upper case followed by lower case and convert it to lower case
|
|
1389
|
+
// Effectively creating a word break eg: BDay => bDay
|
|
1390
|
+
.replace( /[A-Z](?=[A-Z][a-z])/g, c => `${c[0].toLowerCase()}` )
|
|
1391
|
+
.replace( /([A-Z])([A-Z]+)/g, c => `${c[0]}${c.slice( 1 ).toLowerCase()}` ) // Sequences of upper case
|
|
1392
|
+
.replace( /([-_]\w)/g, c => c[1].toUpperCase() ) // first letter after hyphen and underline
|
|
1393
|
+
.replace( /^([A-Z])/g, c => c[0].toLowerCase() ) // first letter
|
|
1394
|
+
] )
|
|
1395
|
+
// Rebuild the string replacing the converter terms keeping the original delimiters
|
|
1396
|
+
.reduce( ( result, [ term, repl ] ) => result.replace( term, repl ), input );
|
|
1332
1397
|
|
|
1333
1398
|
|
|
1334
1399
|
/***/ }),
|
|
1335
1400
|
|
|
1336
|
-
/***/
|
|
1401
|
+
/***/ 3936:
|
|
1337
1402
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1338
1403
|
|
|
1339
|
-
const {
|
|
1404
|
+
const { CopyObjectCommand } = __webpack_require__( 5725 );
|
|
1340
1405
|
|
|
1341
|
-
module.exports = async ( client,
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
} catch ( error ) {
|
|
1350
|
-
if ( ignoreRejections && error.name === 'RejectedRecordsException' ) {
|
|
1351
|
-
return { rejectedRecords: error.RejectedRecords };
|
|
1352
|
-
}
|
|
1353
|
-
throw error;
|
|
1354
|
-
}
|
|
1406
|
+
module.exports = async ( client, bucket, key, source, nativeArgs ) => {
|
|
1407
|
+
const response = await client.send( new CopyObjectCommand( {
|
|
1408
|
+
...nativeArgs,
|
|
1409
|
+
Bucket: bucket,
|
|
1410
|
+
Key: key,
|
|
1411
|
+
CopySource: source
|
|
1412
|
+
} ) );
|
|
1413
|
+
return response;
|
|
1355
1414
|
};
|
|
1356
1415
|
|
|
1357
1416
|
|
|
1358
1417
|
/***/ }),
|
|
1359
1418
|
|
|
1360
|
-
/***/
|
|
1419
|
+
/***/ 3990:
|
|
1361
1420
|
/***/ ((module) => {
|
|
1362
1421
|
|
|
1363
|
-
module.exports =
|
|
1422
|
+
module.exports = ( time, interval ) => time - ( time % interval );
|
|
1364
1423
|
|
|
1365
1424
|
|
|
1366
1425
|
/***/ }),
|
|
1367
1426
|
|
|
1368
|
-
/***/
|
|
1427
|
+
/***/ 4110:
|
|
1369
1428
|
/***/ ((module) => {
|
|
1370
1429
|
|
|
1371
|
-
module.exports =
|
|
1430
|
+
module.exports = ( sample, mean, stdDev ) => stdDev === 0 ? NaN : ( sample - mean ) / stdDev;
|
|
1372
1431
|
|
|
1373
1432
|
|
|
1374
1433
|
/***/ }),
|
|
1375
1434
|
|
|
1376
|
-
/***/
|
|
1377
|
-
/***/ ((module
|
|
1378
|
-
|
|
1379
|
-
const days = __webpack_require__( 5263 );
|
|
1380
|
-
const hours = __webpack_require__( 6961 );
|
|
1381
|
-
const minutes = __webpack_require__( 6635 );
|
|
1382
|
-
const months = __webpack_require__( 8119 );
|
|
1383
|
-
const msToS = __webpack_require__( 7416 );
|
|
1384
|
-
const round = __webpack_require__( 3990 );
|
|
1385
|
-
const seconds = __webpack_require__( 7051 );
|
|
1435
|
+
/***/ 4124:
|
|
1436
|
+
/***/ ((module) => {
|
|
1386
1437
|
|
|
1387
|
-
module.exports =
|
|
1388
|
-
days,
|
|
1389
|
-
hours,
|
|
1390
|
-
minutes,
|
|
1391
|
-
months,
|
|
1392
|
-
msToS,
|
|
1393
|
-
round,
|
|
1394
|
-
seconds
|
|
1395
|
-
};
|
|
1438
|
+
module.exports = values => values.reduce( ( sum, value ) => sum + value, 0 ) / values.length;
|
|
1396
1439
|
|
|
1397
1440
|
|
|
1398
1441
|
/***/ }),
|
|
1399
1442
|
|
|
1400
|
-
/***/
|
|
1443
|
+
/***/ 4127:
|
|
1401
1444
|
/***/ ((module) => {
|
|
1402
1445
|
|
|
1403
|
-
module.exports =
|
|
1446
|
+
module.exports = 500;
|
|
1404
1447
|
|
|
1405
1448
|
|
|
1406
1449
|
/***/ }),
|
|
1407
1450
|
|
|
1408
|
-
/***/
|
|
1409
|
-
/***/ ((module) => {
|
|
1451
|
+
/***/ 4144:
|
|
1452
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1410
1453
|
|
|
1411
|
-
|
|
1454
|
+
const { UpdateCommand } = __webpack_require__( 3489 );
|
|
1455
|
+
|
|
1456
|
+
module.exports = async ( client, nativeArgs ) => {
|
|
1457
|
+
const args = Object.assign( { ReturnValues: 'ALL_NEW' }, nativeArgs );
|
|
1458
|
+
const response = await client.send( new UpdateCommand( args ) );
|
|
1459
|
+
return response.Attributes;
|
|
1460
|
+
};
|
|
1412
1461
|
|
|
1413
1462
|
|
|
1414
1463
|
/***/ }),
|
|
1415
1464
|
|
|
1416
|
-
/***/
|
|
1417
|
-
/***/ ((module) => {
|
|
1465
|
+
/***/ 4164:
|
|
1466
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1418
1467
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
/***/ }),
|
|
1423
|
-
|
|
1424
|
-
/***/ 3990:
|
|
1425
|
-
/***/ ((module) => {
|
|
1468
|
+
const cacheSym = Symbol.for( 'cache' );
|
|
1469
|
+
const crypto = __webpack_require__( 6982 );
|
|
1426
1470
|
|
|
1427
|
-
|
|
1471
|
+
const hash = text => crypto.createHash( 'md5' ).update( text ).digest( 'hex' );
|
|
1428
1472
|
|
|
1473
|
+
const propOpts = {
|
|
1474
|
+
enumerable: false,
|
|
1475
|
+
configurable: false,
|
|
1476
|
+
writable: false
|
|
1477
|
+
};
|
|
1429
1478
|
|
|
1430
|
-
|
|
1479
|
+
module.exports = {
|
|
1480
|
+
set: ( key, value ) => {
|
|
1481
|
+
const keySym = Symbol.for( hash( key ) );
|
|
1431
1482
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1483
|
+
if ( !global[cacheSym] ) {
|
|
1484
|
+
Object.defineProperty( global, cacheSym, { ...propOpts, value: {} } );
|
|
1485
|
+
}
|
|
1434
1486
|
|
|
1435
|
-
|
|
1487
|
+
Object.defineProperty( global[cacheSym], keySym, { ...propOpts, value } );
|
|
1488
|
+
},
|
|
1489
|
+
get: key => {
|
|
1490
|
+
return global[cacheSym]?.[Symbol.for( hash( key ) )];
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1436
1493
|
|
|
1437
1494
|
|
|
1438
1495
|
/***/ }),
|
|
1439
1496
|
|
|
1440
|
-
/***/
|
|
1497
|
+
/***/ 4225:
|
|
1441
1498
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1442
1499
|
|
|
1443
|
-
const
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
const
|
|
1447
|
-
const
|
|
1448
|
-
const object = __webpack_require__( 5762 );
|
|
1449
|
-
const redis = __webpack_require__( 4528 );
|
|
1450
|
-
const string = __webpack_require__( 268 );
|
|
1451
|
-
const utils = __webpack_require__( 6878 );
|
|
1500
|
+
const query = __webpack_require__( 6030 );
|
|
1501
|
+
const { TimestreamQueryClient } = __webpack_require__( 1671 );
|
|
1502
|
+
const { Agent } = __webpack_require__( 5692 );
|
|
1503
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
1504
|
+
const createInstance = __webpack_require__( 5438 );
|
|
1452
1505
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
LambdaApi,
|
|
1458
|
-
math,
|
|
1459
|
-
object,
|
|
1460
|
-
redis,
|
|
1461
|
-
string,
|
|
1462
|
-
utils
|
|
1506
|
+
const methods = { query };
|
|
1507
|
+
const defaultArgs = {
|
|
1508
|
+
maxRetries: 10,
|
|
1509
|
+
httpOptions: { timeout: 60000, agent: new Agent( { maxSockets: 5000 } ) }
|
|
1463
1510
|
};
|
|
1464
1511
|
|
|
1512
|
+
module.exports = createInstance( args => clientProvider( TimestreamQueryClient, [ Object.assign( {}, defaultArgs, args ) ] ), methods );
|
|
1513
|
+
|
|
1465
1514
|
|
|
1466
1515
|
/***/ }),
|
|
1467
1516
|
|
|
1468
|
-
/***/
|
|
1517
|
+
/***/ 4243:
|
|
1469
1518
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1470
1519
|
|
|
1471
|
-
const
|
|
1472
|
-
const charset = 'utf-8';
|
|
1520
|
+
const sleep = __webpack_require__( 2445 );
|
|
1473
1521
|
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1522
|
+
const execWithRetry = async ( closure, { limit, delay, retryHook, execCount = 0 } ) => {
|
|
1523
|
+
if ( !( closure instanceof Function ) ) {
|
|
1524
|
+
throw new Error( 'Closure is not a function' );
|
|
1525
|
+
}
|
|
1478
1526
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1527
|
+
try {
|
|
1528
|
+
return await closure();
|
|
1529
|
+
} catch ( error ) {
|
|
1530
|
+
// exhausted
|
|
1531
|
+
if ( execCount === limit ) { throw error; }
|
|
1484
1532
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}, headers );
|
|
1491
|
-
}
|
|
1533
|
+
// async retry hook to check if it should retry or give up and throw
|
|
1534
|
+
if ( retryHook instanceof Function ) {
|
|
1535
|
+
try {
|
|
1536
|
+
const retry = await retryHook( error, execCount );
|
|
1537
|
+
if ( retry === false ) { return false; }
|
|
1492
1538
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
this.#body = JSON.stringify( this.#transformFn( body ) );
|
|
1499
|
-
this.#headers['Content-Type'] = `application/json; charset=${charset}`;
|
|
1500
|
-
} else {
|
|
1501
|
-
this.#body = String( body );
|
|
1502
|
-
this.#headers['Content-Type'] = `text/plain; charset=${charset}`;
|
|
1539
|
+
// Hook errors break the flow
|
|
1540
|
+
} catch ( hookError ) {
|
|
1541
|
+
console.debug( hookError );
|
|
1542
|
+
throw hookError;
|
|
1543
|
+
}
|
|
1503
1544
|
}
|
|
1504
|
-
this.#headers['Content-Length'] = this.#body.length;
|
|
1505
|
-
Object.assign( this.#headers, headers ?? {} );
|
|
1506
|
-
return this;
|
|
1507
|
-
}
|
|
1508
1545
|
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
};
|
|
1546
|
+
// if there is no hook back-off and retry
|
|
1547
|
+
if ( delay > 0 ) {
|
|
1548
|
+
await sleep( delay ** ( 1 + execCount ) );
|
|
1549
|
+
}
|
|
1550
|
+
return execWithRetry( closure, { limit, delay, retryHook, execCount: execCount + 1 } );
|
|
1515
1551
|
}
|
|
1516
1552
|
};
|
|
1517
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
*
|
|
1556
|
+
* @param {Function} closure A self contained function that will be invoked
|
|
1557
|
+
* @param {Object} config
|
|
1558
|
+
* @param {Number} limit The max number of retries
|
|
1559
|
+
* @param {Number} delay The delay between each retry (it will be multiplied by the number of retries, so, it is linear back-off)
|
|
1560
|
+
* @param {Function} retryHook A function to be called every-time a retry is needed.
|
|
1561
|
+
* If this functions returns false, the retry error is raised
|
|
1562
|
+
* If this functions throws error, the thrown error is raised
|
|
1563
|
+
* @returns {Any} The closure result
|
|
1564
|
+
*/
|
|
1565
|
+
module.exports = async ( closure, { limit = 0, delay = 0, retryHook = null } = {} ) =>
|
|
1566
|
+
execWithRetry( closure, { limit, delay, retryHook } );
|
|
1567
|
+
|
|
1518
1568
|
|
|
1519
1569
|
/***/ }),
|
|
1520
1570
|
|
|
1521
|
-
/***/
|
|
1571
|
+
/***/ 4338:
|
|
1522
1572
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1523
1573
|
|
|
1524
|
-
const
|
|
1574
|
+
const startQuery = __webpack_require__( 3649 );
|
|
1575
|
+
const getResults = __webpack_require__( 739 );
|
|
1576
|
+
const parseResults = __webpack_require__( 9552 );
|
|
1525
1577
|
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
}
|
|
1578
|
+
/**
|
|
1579
|
+
* @class Result
|
|
1580
|
+
* @type {Object}
|
|
1581
|
+
* @property {Object[]} items Each query result row, parsed to a camelized js object
|
|
1582
|
+
* @property {Number} count Total number of results
|
|
1583
|
+
*/
|
|
1530
1584
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1585
|
+
/**
|
|
1586
|
+
* Executes an Athena Query
|
|
1587
|
+
* @param {*} client The native client
|
|
1588
|
+
* @param {Object} nativeArgs The native args to start the Cloudwatch Query
|
|
1589
|
+
* @param {Object=} options Extra options for this command
|
|
1590
|
+
* @param {Object=} options.range Since the nativeArgs "startTime" and "endTime" are second based epochs, the "range" argument accepts milliseconds based epochs for convenience, thus overwriting the "nativeArgs"
|
|
1591
|
+
* @param {Number} options.range.from The beginning of the time range to query, overwrites "startTime"
|
|
1592
|
+
* @param {Number} options.range.to The end of the time range to query, overwrites "endTime"
|
|
1593
|
+
* @returns {Result} The query result
|
|
1594
|
+
*/
|
|
1595
|
+
module.exports = async ( client, nativeArgs, { range = {} } = {} ) => {
|
|
1596
|
+
const queryId = await startQuery( { client, nativeArgs, range } );
|
|
1597
|
+
const results = await getResults( { client, queryId } );
|
|
1598
|
+
const items = parseResults( results );
|
|
1599
|
+
return { items, count: items.length };
|
|
1537
1600
|
};
|
|
1538
1601
|
|
|
1539
|
-
module.exports = class Event {
|
|
1540
|
-
#transformFn;
|
|
1541
|
-
authorizer;
|
|
1542
|
-
body;
|
|
1543
|
-
headers;
|
|
1544
|
-
method;
|
|
1545
|
-
params;
|
|
1546
|
-
path;
|
|
1547
|
-
queryString;
|
|
1548
|
-
route;
|
|
1549
1602
|
|
|
1550
|
-
|
|
1603
|
+
/***/ }),
|
|
1551
1604
|
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1605
|
+
/***/ 4348:
|
|
1606
|
+
/***/ ((module) => {
|
|
1555
1607
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
}
|
|
1608
|
+
"use strict";
|
|
1609
|
+
module.exports = require("@aws-sdk/client-ssm");
|
|
1559
1610
|
|
|
1560
|
-
|
|
1561
|
-
const {
|
|
1562
|
-
body,
|
|
1563
|
-
path,
|
|
1564
|
-
resource,
|
|
1565
|
-
httpMethod,
|
|
1566
|
-
requestContext,
|
|
1567
|
-
pathParameters,
|
|
1568
|
-
headers,
|
|
1569
|
-
multiValueHeaders,
|
|
1570
|
-
queryStringParameters,
|
|
1571
|
-
multiValueQueryStringParameters: multiValueQueryString
|
|
1572
|
-
} = awsEvent;
|
|
1611
|
+
/***/ }),
|
|
1573
1612
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
...Object.fromEntries( Object.entries( multiValueHeaders ?? {} ).map( ( [ k, v ] ) => [ k, Array.isArray( v ) ? v.join( ',' ) : k ] ) )
|
|
1577
|
-
};
|
|
1613
|
+
/***/ 4528:
|
|
1614
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1578
1615
|
|
|
1579
|
-
|
|
1580
|
-
...queryStringParameters,
|
|
1581
|
-
...Object.fromEntries( Object.entries( multiValueQueryString ?? {} ).map( ( [ k, v ] ) => [ k, Array.isArray( v ) ? v.join( ',' ) : k ] ) )
|
|
1582
|
-
};
|
|
1616
|
+
const createClient = __webpack_require__( 5422 );
|
|
1583
1617
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
this.method = httpMethod;
|
|
1588
|
-
this.params = this.#transformFn( pathParameters ) ?? {};
|
|
1589
|
-
this.path = path;
|
|
1590
|
-
this.queryString = this.#transformFn( unifiedQueryString ) ?? {};
|
|
1591
|
-
this.route = resource;
|
|
1592
|
-
}
|
|
1618
|
+
module.exports = {
|
|
1619
|
+
createClient
|
|
1620
|
+
};
|
|
1593
1621
|
|
|
1594
|
-
parseFromAwsEventV2( awsEvent ) {
|
|
1595
|
-
const {
|
|
1596
|
-
body,
|
|
1597
|
-
routeKey,
|
|
1598
|
-
requestContext,
|
|
1599
|
-
pathParameters,
|
|
1600
|
-
headers,
|
|
1601
|
-
queryStringParameters
|
|
1602
|
-
} = awsEvent;
|
|
1603
1622
|
|
|
1604
|
-
|
|
1623
|
+
/***/ }),
|
|
1605
1624
|
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
this.headers = headers ?? {};
|
|
1609
|
-
this.method = method;
|
|
1610
|
-
this.params = this.#transformFn( pathParameters ) ?? {};
|
|
1611
|
-
this.path = path;
|
|
1612
|
-
this.queryString = this.#transformFn( queryStringParameters ) ?? {};
|
|
1613
|
-
this.route = routeKey?.split( ' ' )[1].replace( /\/$/, '' );
|
|
1614
|
-
}
|
|
1615
|
-
};
|
|
1625
|
+
/***/ 4671:
|
|
1626
|
+
/***/ ((module) => {
|
|
1616
1627
|
|
|
1628
|
+
"use strict";
|
|
1629
|
+
module.exports = require("@aws-sdk/client-dynamodb");
|
|
1617
1630
|
|
|
1618
1631
|
/***/ }),
|
|
1619
1632
|
|
|
1620
|
-
/***/
|
|
1633
|
+
/***/ 4692:
|
|
1621
1634
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1622
1635
|
|
|
1623
|
-
const
|
|
1636
|
+
const calcMedian = __webpack_require__( 3187 );
|
|
1624
1637
|
|
|
1625
|
-
module.exports =
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
#routeIncludes;
|
|
1630
|
-
#routeNotIncludes;
|
|
1631
|
-
#routeMatches;
|
|
1632
|
-
#path;
|
|
1633
|
-
#pathIncludes;
|
|
1634
|
-
#pathNotIncludes;
|
|
1635
|
-
#pathMatches;
|
|
1638
|
+
module.exports = pop => {
|
|
1639
|
+
const center = calcMedian( pop );
|
|
1640
|
+
return calcMedian( pop.map( v => Math.abs( v - center ) ) );
|
|
1641
|
+
};
|
|
1636
1642
|
|
|
1637
|
-
constructor( { method, fn, ...matchers } ) {
|
|
1638
|
-
validators.httpMethod( method );
|
|
1639
|
-
validators.function( fn );
|
|
1640
|
-
validators.matcherRoute( matchers.route );
|
|
1641
|
-
validators.matcherRouteIncludes( matchers.routeIncludes );
|
|
1642
|
-
validators.matcherRouteNotIncludes( matchers.routeNotIncludes );
|
|
1643
|
-
validators.matcherRouteMatch( matchers.routeMatch );
|
|
1644
|
-
validators.matcherPath( matchers.path );
|
|
1645
|
-
validators.matcherPathIncludes( matchers.pathIncludes );
|
|
1646
|
-
validators.matcherPathNotIncludes( matchers.pathNotIncludes );
|
|
1647
|
-
validators.matcherPathMatch( matchers.pathMatch );
|
|
1648
1643
|
|
|
1649
|
-
|
|
1650
|
-
this.#fn = fn;
|
|
1651
|
-
this.#route = matchers.route;
|
|
1652
|
-
this.#routeIncludes = matchers.routeIncludes;
|
|
1653
|
-
this.#routeNotIncludes = matchers.routeNotIncludes;
|
|
1654
|
-
this.#routeMatches = matchers.routeMatches;
|
|
1655
|
-
this.#path = matchers.path;
|
|
1656
|
-
this.#pathIncludes = matchers.pathIncludes;
|
|
1657
|
-
this.#pathNotIncludes = matchers.pathNotIncludes;
|
|
1658
|
-
this.#pathMatches = matchers.pathMatches;
|
|
1659
|
-
}
|
|
1644
|
+
/***/ }),
|
|
1660
1645
|
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
return false;
|
|
1664
|
-
}
|
|
1665
|
-
if ( this.#route ) {
|
|
1666
|
-
return this.#route === event.route;
|
|
1667
|
-
}
|
|
1668
|
-
if ( this.#path ) {
|
|
1669
|
-
return this.#path === event.path;
|
|
1670
|
-
}
|
|
1671
|
-
if ( this.#routeIncludes && !event.route.includes( this.#routeIncludes ) ) {
|
|
1672
|
-
return false;
|
|
1673
|
-
}
|
|
1674
|
-
if ( this.#routeNotIncludes && event.route.includes( this.#routeNotIncludes ) ) {
|
|
1675
|
-
return false;
|
|
1676
|
-
}
|
|
1677
|
-
if ( this.#routeMatches && !this.#routeMatches.test( event.route ) ) {
|
|
1678
|
-
return false;
|
|
1679
|
-
}
|
|
1680
|
-
if ( this.#pathIncludes && !event.path.includes( this.#pathIncludes ) ) {
|
|
1681
|
-
return false;
|
|
1682
|
-
}
|
|
1683
|
-
if ( this.#pathNotIncludes && event.path.includes( this.#pathNotIncludes ) ) {
|
|
1684
|
-
return false;
|
|
1685
|
-
}
|
|
1686
|
-
if ( this.#pathMatches && !this.#pathMatches.test( event.path ) ) {
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
return true;
|
|
1690
|
-
}
|
|
1646
|
+
/***/ 4821:
|
|
1647
|
+
/***/ ((module) => {
|
|
1691
1648
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1649
|
+
module.exports = ( items, size ) => items.reduce( ( arrs, item ) =>
|
|
1650
|
+
( arrs[0] && arrs[0].length < size ) ?
|
|
1651
|
+
[ [ ...arrs[0], item ] ].concat( arrs.slice( 1 ) ) :
|
|
1652
|
+
[ [ item ] ].concat( arrs )
|
|
1653
|
+
, [] ).reverse();
|
|
1694
1654
|
|
|
1695
1655
|
|
|
1696
1656
|
/***/ }),
|
|
1697
1657
|
|
|
1698
|
-
/***/
|
|
1658
|
+
/***/ 4870:
|
|
1699
1659
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1700
1660
|
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1661
|
+
const athena = __webpack_require__( 228 );
|
|
1662
|
+
const cwLogs = __webpack_require__( 2710 );
|
|
1663
|
+
const dynamo = __webpack_require__( 1505 );
|
|
1664
|
+
const lambda = __webpack_require__( 3544 );
|
|
1665
|
+
const s3 = __webpack_require__( 645 );
|
|
1666
|
+
const ses = __webpack_require__( 5624 );
|
|
1667
|
+
const sns = __webpack_require__( 3099 );
|
|
1668
|
+
const sqs = __webpack_require__( 3340 );
|
|
1669
|
+
const ssm = __webpack_require__( 5888 );
|
|
1670
|
+
const timestreamQuery = __webpack_require__( 4225 );
|
|
1671
|
+
const timestreamWrite = __webpack_require__( 2538 );
|
|
1710
1672
|
|
|
1711
|
-
|
|
1673
|
+
module.exports = {
|
|
1674
|
+
athena,
|
|
1675
|
+
cwLogs,
|
|
1676
|
+
dynamo,
|
|
1677
|
+
lambda,
|
|
1678
|
+
s3,
|
|
1679
|
+
ses,
|
|
1680
|
+
sns,
|
|
1681
|
+
sqs,
|
|
1682
|
+
ssm,
|
|
1683
|
+
timestreamQuery,
|
|
1684
|
+
timestreamWrite
|
|
1712
1685
|
};
|
|
1713
1686
|
|
|
1714
1687
|
|
|
1715
1688
|
/***/ }),
|
|
1716
1689
|
|
|
1717
|
-
/***/
|
|
1718
|
-
/***/ ((module
|
|
1690
|
+
/***/ 4991:
|
|
1691
|
+
/***/ ((module) => {
|
|
1719
1692
|
|
|
1720
|
-
|
|
1693
|
+
"use strict";
|
|
1694
|
+
module.exports = require("@aws-sdk/s3-request-presigner");
|
|
1721
1695
|
|
|
1722
|
-
|
|
1696
|
+
/***/ }),
|
|
1697
|
+
|
|
1698
|
+
/***/ 5263:
|
|
1699
|
+
/***/ ((module) => {
|
|
1700
|
+
|
|
1701
|
+
module.exports = t => t * 24 * 60 * 60 * 1000;
|
|
1723
1702
|
|
|
1724
1703
|
|
|
1725
1704
|
/***/ }),
|
|
1726
1705
|
|
|
1727
|
-
/***/
|
|
1706
|
+
/***/ 5265:
|
|
1728
1707
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1729
1708
|
|
|
1730
|
-
const
|
|
1731
|
-
const ApiResponse = __webpack_require__( 3119 );
|
|
1732
|
-
const Event = __webpack_require__( 329 );
|
|
1733
|
-
const Handler = __webpack_require__( 3109 );
|
|
1734
|
-
const Hook = __webpack_require__( 798 );
|
|
1735
|
-
const UserResponse = __webpack_require__( 8282 );
|
|
1736
|
-
const Text = __webpack_require__( 9760 );
|
|
1709
|
+
const select = __webpack_require__( 2157 );
|
|
1737
1710
|
|
|
1738
|
-
module.exports =
|
|
1739
|
-
#apiResponse = null;
|
|
1740
|
-
#handlers = [];
|
|
1741
|
-
#errorResponses = [];
|
|
1742
|
-
#beforeHooks = [];
|
|
1743
|
-
#afterHooks = [];
|
|
1744
|
-
#transformRequest = [];
|
|
1711
|
+
module.exports = async ( client, ...args ) => select( client, 'query', ...args );
|
|
1745
1712
|
|
|
1746
|
-
/**
|
|
1747
|
-
* Creates a new Lambda Api
|
|
1748
|
-
*
|
|
1749
|
-
* @param {Object} headers Any headers you want to be included in all responses
|
|
1750
|
-
*/
|
|
1751
|
-
constructor( { headers = {}, transformRequest = false, transformResponse = false } = {} ) {
|
|
1752
|
-
validators.transformRequest( transformRequest );
|
|
1753
|
-
validators.transformResponse( transformResponse );
|
|
1754
1713
|
|
|
1755
|
-
|
|
1756
|
-
this.#apiResponse = new ApiResponse( { headers, transform: transformResponse } );
|
|
1757
|
-
}
|
|
1714
|
+
/***/ }),
|
|
1758
1715
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
*
|
|
1762
|
-
* @param {Object} args
|
|
1763
|
-
* @param {function} args.fn A function
|
|
1764
|
-
*/
|
|
1765
|
-
addBeforeHook( { fn } = {} ) {
|
|
1766
|
-
this.#beforeHooks.push( new Hook( { fn } ) );
|
|
1767
|
-
}
|
|
1716
|
+
/***/ 5422:
|
|
1717
|
+
/***/ ((module) => {
|
|
1768
1718
|
|
|
1769
|
-
|
|
1770
|
-
* Register a function that will run after the matching route (only if matches)
|
|
1771
|
-
*
|
|
1772
|
-
* @param {Object} args
|
|
1773
|
-
* @param {function} args.fn A function
|
|
1774
|
-
*/
|
|
1775
|
-
addAfterHook( { fn } = {} ) {
|
|
1776
|
-
this.#afterHooks.push( new Hook( { fn } ) );
|
|
1777
|
-
}
|
|
1719
|
+
global.__redisInstances = {};
|
|
1778
1720
|
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1721
|
+
/**
|
|
1722
|
+
* Create a redis client instance
|
|
1723
|
+
* @param {Object} redis Redis npm dependency
|
|
1724
|
+
* @param {String} address Redis DB address (either RW or RO)
|
|
1725
|
+
* @returns redisClient A new redis client instance connected to the database
|
|
1726
|
+
*/
|
|
1727
|
+
module.exports = async ( { redis, address, protocol = 'rediss', port = 6379 } ) => {
|
|
1728
|
+
if ( global.__redisInstances[address] ) {
|
|
1729
|
+
try {
|
|
1730
|
+
const r = await global.__redisInstances[address].ping();
|
|
1731
|
+
if ( r === 'PONG' ) {
|
|
1732
|
+
return global.__redisInstances[address];
|
|
1733
|
+
} else {
|
|
1734
|
+
delete global.__redisInstances[address];
|
|
1735
|
+
}
|
|
1736
|
+
} catch {
|
|
1737
|
+
delete global.__redisInstances[address];
|
|
1738
|
+
}
|
|
1796
1739
|
}
|
|
1797
1740
|
|
|
1798
|
-
|
|
1799
|
-
* Register an automatic error code response for given error class (constructor name)
|
|
1800
|
-
*
|
|
1801
|
-
* @param {Object} args
|
|
1802
|
-
* @param {string} args.code The HTTP status code to return
|
|
1803
|
-
* @param {class} args.errorType The error class
|
|
1804
|
-
* @param {string} [args.message=null] Optional message to return for the status code, if not present will default to Error.message
|
|
1805
|
-
* @param {message} [args.errorType] And optional message to display
|
|
1806
|
-
*/
|
|
1807
|
-
addErrorHandler( { errorType, code, message = null } = {} ) {
|
|
1808
|
-
validators.statusCode( code );
|
|
1809
|
-
validators.errorType( errorType );
|
|
1810
|
-
this.#errorResponses.push( { errorType, code, message } );
|
|
1811
|
-
}
|
|
1741
|
+
const client = redis.createClient( { url: `${protocol}://${address}:${port}`, socket: { keepAlive: 15000 } } );
|
|
1812
1742
|
|
|
1813
|
-
|
|
1814
|
-
* Init the flow using a given AWS Lambda APIGateway event (v2 syntax)
|
|
1815
|
-
*
|
|
1816
|
-
* @param {Object} ApiGatewayPayload The raw API Gateway event
|
|
1817
|
-
* @returns {Object} The http response with status, body and headers
|
|
1818
|
-
*/
|
|
1819
|
-
async process( awsEvent ) {
|
|
1820
|
-
const event = new Event( { transform: this.#transformRequest } );
|
|
1821
|
-
event.parseFromAwsEvent( awsEvent );
|
|
1743
|
+
await client.connect();
|
|
1822
1744
|
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1745
|
+
global.__redisInstances[address] = client;
|
|
1746
|
+
return client;
|
|
1747
|
+
};
|
|
1826
1748
|
|
|
1827
|
-
const handler = this.#handlers.find( h => h.match( event ) );
|
|
1828
|
-
if ( !handler ) {
|
|
1829
|
-
return this.#apiResponse.setContent( 405, Text.ERROR_405 ).toJSON();
|
|
1830
|
-
}
|
|
1831
1749
|
|
|
1832
|
-
|
|
1833
|
-
...this.#beforeHooks.map( b => b.fn ),
|
|
1834
|
-
async ev => {
|
|
1835
|
-
const result = await handler.fn( ev );
|
|
1836
|
-
const response = new UserResponse( result );
|
|
1837
|
-
this.#apiResponse.setContent( ...response.values ).toJSON();
|
|
1838
|
-
},
|
|
1839
|
-
...this.#afterHooks.map( a => a.fn )
|
|
1840
|
-
];
|
|
1750
|
+
/***/ }),
|
|
1841
1751
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
await fn( event );
|
|
1845
|
-
}
|
|
1846
|
-
return this.#apiResponse.toJSON();
|
|
1752
|
+
/***/ 5438:
|
|
1753
|
+
/***/ ((module) => {
|
|
1847
1754
|
|
|
1848
|
-
|
|
1849
|
-
|
|
1755
|
+
/**
|
|
1756
|
+
* This is base object each AWS abstraction will provide
|
|
1757
|
+
*/
|
|
1758
|
+
module.exports = ( providerFn, methods ) => {
|
|
1759
|
+
// This creates the "instance",
|
|
1760
|
+
// so calling the method as a function returns a copy of its client instantiated with the given args
|
|
1761
|
+
// every method called from it will use this instance
|
|
1762
|
+
const factory = args => {
|
|
1763
|
+
const client = providerFn( args );
|
|
1764
|
+
// return self, so it is possible use the native client
|
|
1765
|
+
methods.getClient = () => client;
|
|
1766
|
+
return Object.entries( methods ).reduce( ( o, [ k, v ] ) => Object.assign( o, { [k]: v.bind( null, client ) } ), { } );
|
|
1767
|
+
};
|
|
1850
1768
|
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1769
|
+
// This is the singleton part;
|
|
1770
|
+
// First add the static method to the factory;
|
|
1771
|
+
Object.entries( methods ).forEach( ( [ key, value ] ) => factory[key] = value );
|
|
1772
|
+
|
|
1773
|
+
// Then add the special method "getClient", so it is possible use the native client
|
|
1774
|
+
factory.getClient = client => client;
|
|
1775
|
+
|
|
1776
|
+
// Finally makes the proxy which will allow each singleton method to use the client provider of the AWS service+
|
|
1777
|
+
return new Proxy( factory, {
|
|
1778
|
+
get( target, key ) {
|
|
1779
|
+
const t = target[key];
|
|
1780
|
+
return ( typeof t === 'function' ) ? t.bind( null, providerFn() ) : t;
|
|
1781
|
+
}
|
|
1782
|
+
} );
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
/***/ }),
|
|
1787
|
+
|
|
1788
|
+
/***/ 5624:
|
|
1789
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1790
|
+
|
|
1791
|
+
const deleteSuppressedDestination = __webpack_require__( 809 );
|
|
1792
|
+
const sendEmail = __webpack_require__( 1783 );
|
|
1793
|
+
const { SESv2Client } = __webpack_require__( 9556 );
|
|
1794
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
1795
|
+
const createInstance = __webpack_require__( 5438 );
|
|
1796
|
+
|
|
1797
|
+
const methods = {
|
|
1798
|
+
deleteSuppressedDestination,
|
|
1799
|
+
sendEmail
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
module.exports = createInstance( clientProvider.bind( null, SESv2Client ), methods );
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
/***/ }),
|
|
1806
|
+
|
|
1807
|
+
/***/ 5637:
|
|
1808
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1809
|
+
|
|
1810
|
+
const { DeleteMessageCommand } = __webpack_require__( 1976 );
|
|
1811
|
+
|
|
1812
|
+
module.exports = async ( client, queue, receiptHandle ) =>
|
|
1813
|
+
client.send( new DeleteMessageCommand( {
|
|
1814
|
+
QueueUrl: queue,
|
|
1815
|
+
ReceiptHandle: receiptHandle
|
|
1816
|
+
} ) );
|
|
1817
|
+
|
|
1818
|
+
|
|
1819
|
+
/***/ }),
|
|
1820
|
+
|
|
1821
|
+
/***/ 5692:
|
|
1822
|
+
/***/ ((module) => {
|
|
1823
|
+
|
|
1824
|
+
"use strict";
|
|
1825
|
+
module.exports = require("https");
|
|
1826
|
+
|
|
1827
|
+
/***/ }),
|
|
1828
|
+
|
|
1829
|
+
/***/ 5723:
|
|
1830
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1831
|
+
|
|
1832
|
+
const { randomBytes } = __webpack_require__( 6982 );
|
|
1833
|
+
const { StartQueryExecutionCommand } = __webpack_require__( 3744 );
|
|
1834
|
+
|
|
1835
|
+
/**
|
|
1836
|
+
* args : https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/athena/command/StartQueryExecutionCommand/
|
|
1837
|
+
* A ClientRequestToken is created automatically
|
|
1838
|
+
*/
|
|
1839
|
+
module.exports = async ( { client, ...args } ) => {
|
|
1840
|
+
const cmd = new StartQueryExecutionCommand( {
|
|
1841
|
+
ClientRequestToken: randomBytes( 16 ).toString( 'hex' ),
|
|
1842
|
+
...args
|
|
1843
|
+
} );
|
|
1844
|
+
const { QueryExecutionId: queryId } = await client.send( cmd );
|
|
1845
|
+
return queryId;
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
|
|
1849
|
+
/***/ }),
|
|
1850
|
+
|
|
1851
|
+
/***/ 5725:
|
|
1852
|
+
/***/ ((module) => {
|
|
1853
|
+
|
|
1854
|
+
"use strict";
|
|
1855
|
+
module.exports = require("@aws-sdk/client-s3");
|
|
1856
|
+
|
|
1857
|
+
/***/ }),
|
|
1858
|
+
|
|
1859
|
+
/***/ 5744:
|
|
1860
|
+
/***/ ((module) => {
|
|
1861
|
+
|
|
1862
|
+
module.exports = {
|
|
1863
|
+
encode: k => {
|
|
1864
|
+
if ( k === null || k === undefined ) { return k; }
|
|
1865
|
+
|
|
1866
|
+
return Buffer.from( JSON.stringify( k ) ).toString( 'base64' );
|
|
1867
|
+
},
|
|
1868
|
+
decode: k => {
|
|
1869
|
+
if ( k === null || k === undefined ) { return k; }
|
|
1870
|
+
|
|
1871
|
+
const result = Buffer.from( k, 'base64' ).toString( 'utf8' );
|
|
1872
|
+
try {
|
|
1873
|
+
return JSON.parse( result );
|
|
1874
|
+
} catch {
|
|
1875
|
+
return result;
|
|
1856
1876
|
}
|
|
1857
1877
|
}
|
|
1858
1878
|
};
|
|
@@ -1860,285 +1880,603 @@ module.exports = class LambdaApi {
|
|
|
1860
1880
|
|
|
1861
1881
|
/***/ }),
|
|
1862
1882
|
|
|
1863
|
-
/***/
|
|
1883
|
+
/***/ 5762:
|
|
1884
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1885
|
+
|
|
1886
|
+
const camelize = __webpack_require__( 8256 );
|
|
1887
|
+
const filterProps = __webpack_require__( 6451 );
|
|
1888
|
+
const removeEmptyArrays = __webpack_require__( 2047 );
|
|
1889
|
+
const snakelize = __webpack_require__( 7572 );
|
|
1890
|
+
|
|
1891
|
+
module.exports = {
|
|
1892
|
+
camelize,
|
|
1893
|
+
filterProps,
|
|
1894
|
+
removeEmptyArrays,
|
|
1895
|
+
snakelize
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
/***/ }),
|
|
1900
|
+
|
|
1901
|
+
/***/ 5847:
|
|
1902
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1903
|
+
|
|
1904
|
+
const batchWrite = __webpack_require__( 8593 );
|
|
1905
|
+
|
|
1906
|
+
module.exports = async ( client, ...args ) => batchWrite( client, 'put', ...args );
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
/***/ }),
|
|
1910
|
+
|
|
1911
|
+
/***/ 5888:
|
|
1912
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1913
|
+
|
|
1914
|
+
const get = __webpack_require__( 8660 );
|
|
1915
|
+
const { SSMClient } = __webpack_require__( 4348 );
|
|
1916
|
+
const clientProvider = __webpack_require__( 9039 );
|
|
1917
|
+
const createInstance = __webpack_require__( 5438 );
|
|
1918
|
+
|
|
1919
|
+
const methods = { get };
|
|
1920
|
+
|
|
1921
|
+
module.exports = createInstance( clientProvider.bind( null, SSMClient ), methods );
|
|
1922
|
+
|
|
1923
|
+
|
|
1924
|
+
/***/ }),
|
|
1925
|
+
|
|
1926
|
+
/***/ 5892:
|
|
1864
1927
|
/***/ ((module) => {
|
|
1865
1928
|
|
|
1866
|
-
|
|
1929
|
+
"use strict";
|
|
1930
|
+
module.exports = require("@aws-sdk/client-lambda");
|
|
1931
|
+
|
|
1932
|
+
/***/ }),
|
|
1933
|
+
|
|
1934
|
+
/***/ 5894:
|
|
1935
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1936
|
+
|
|
1937
|
+
const { InvokeCommand } = __webpack_require__( 5892 );
|
|
1938
|
+
const AWSLambdaError = __webpack_require__( 468 );
|
|
1939
|
+
|
|
1940
|
+
module.exports = async ( client, name, payload = {}, type = 'RequestResponse' ) => {
|
|
1941
|
+
const response = await client.send( new InvokeCommand( {
|
|
1942
|
+
FunctionName: name,
|
|
1943
|
+
InvocationType: type,
|
|
1944
|
+
Payload: Buffer.from( JSON.stringify( payload ) )
|
|
1945
|
+
} ) );
|
|
1946
|
+
|
|
1947
|
+
if ( response.FunctionError ) {
|
|
1948
|
+
throw new AWSLambdaError( response );
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
if ( type !== 'RequestResponse' ) { return true; }
|
|
1952
|
+
|
|
1953
|
+
try {
|
|
1954
|
+
return JSON.parse( Buffer.from( response.Payload ).toString() );
|
|
1955
|
+
} catch {
|
|
1956
|
+
return response.Payload;
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1867
1959
|
|
|
1868
1960
|
|
|
1869
1961
|
/***/ }),
|
|
1870
1962
|
|
|
1871
|
-
/***/
|
|
1963
|
+
/***/ 6030:
|
|
1964
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1965
|
+
|
|
1966
|
+
const { QueryCommand } = __webpack_require__( 1671 );
|
|
1967
|
+
const { camelize } = __webpack_require__( 5762 );
|
|
1968
|
+
const parseItems = __webpack_require__( 7261 );
|
|
1969
|
+
|
|
1970
|
+
const query = async ( client, queryString, { prevItems = [], recursive, paginationToken, maxRows, rawResponse } ) => {
|
|
1971
|
+
const response = await client.send( new QueryCommand( { QueryString: queryString, NextToken: paginationToken, MaxRows: maxRows } ) );
|
|
1972
|
+
if ( !recursive && rawResponse ) {
|
|
1973
|
+
return response;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
const nextToken = response.NextToken;
|
|
1977
|
+
if ( nextToken && recursive ) {
|
|
1978
|
+
return query( client, queryString, { prevItems: parseItems( response ), recursive, paginationToken: nextToken, maxRows } );
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
const items = prevItems.concat( parseItems( response ) );
|
|
1982
|
+
return { nextToken, count: items.length, items, queryStatus: camelize( response.QueryStatus ) };
|
|
1983
|
+
};
|
|
1984
|
+
|
|
1985
|
+
module.exports = async ( client, queryString, { recursive = false, paginationToken = undefined, maxRows = undefined, rawResponse = false } = {} ) =>
|
|
1986
|
+
query( client, queryString, { recursive, paginationToken, maxRows, rawResponse } );
|
|
1987
|
+
|
|
1988
|
+
|
|
1989
|
+
/***/ }),
|
|
1990
|
+
|
|
1991
|
+
/***/ 6089:
|
|
1992
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1993
|
+
|
|
1994
|
+
const calcMean = __webpack_require__( 4124 );
|
|
1995
|
+
|
|
1996
|
+
module.exports = values => {
|
|
1997
|
+
if ( values.length < 2 ) { return NaN; }
|
|
1998
|
+
|
|
1999
|
+
const mean = calcMean( values );
|
|
2000
|
+
const squareDiffs = values.map( value => Math.pow( value - mean, 2 ) );
|
|
2001
|
+
const avgSquareDiff = squareDiffs.reduce( ( sum, v ) => sum + v, 0 ) / ( values.length - 1 );
|
|
2002
|
+
return Math.sqrt( avgSquareDiff );
|
|
2003
|
+
};
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
/***/ }),
|
|
2007
|
+
|
|
2008
|
+
/***/ 6451:
|
|
2009
|
+
/***/ ((module) => {
|
|
2010
|
+
|
|
2011
|
+
module.exports = ( obj, props ) => Object.fromEntries( Object.entries( obj ).filter( ( [ k ] ) => props.includes( k ) ) );
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
/***/ }),
|
|
2015
|
+
|
|
2016
|
+
/***/ 6635:
|
|
1872
2017
|
/***/ ((module) => {
|
|
1873
2018
|
|
|
2019
|
+
module.exports = t => t * 60 * 1000;
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
/***/ }),
|
|
2023
|
+
|
|
2024
|
+
/***/ 6720:
|
|
2025
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2026
|
+
|
|
2027
|
+
const { SendMessageCommand } = __webpack_require__( 1976 );
|
|
2028
|
+
const sanitizeSqs = __webpack_require__( 8175 );
|
|
2029
|
+
|
|
2030
|
+
module.exports = async ( client, queue, body, args ) => {
|
|
2031
|
+
const response = await client.send( new SendMessageCommand( {
|
|
2032
|
+
...args,
|
|
2033
|
+
MessageBody: sanitizeSqs( typeof body === 'string' ? body : JSON.stringify( body ) ),
|
|
2034
|
+
QueueUrl: queue
|
|
2035
|
+
} ) );
|
|
2036
|
+
return response.MessageId;
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
/***/ }),
|
|
2041
|
+
|
|
2042
|
+
/***/ 6777:
|
|
2043
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2044
|
+
|
|
2045
|
+
const { DeleteCommand } = __webpack_require__( 3489 );
|
|
2046
|
+
|
|
2047
|
+
module.exports = async ( client, tableName, key ) => {
|
|
2048
|
+
const { Attributes: item } = await client.send( new DeleteCommand( {
|
|
2049
|
+
ReturnValues: 'ALL_OLD',
|
|
2050
|
+
TableName: tableName,
|
|
2051
|
+
Key: key
|
|
2052
|
+
} ) );
|
|
2053
|
+
return item;
|
|
2054
|
+
};
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
/***/ }),
|
|
2058
|
+
|
|
2059
|
+
/***/ 6878:
|
|
2060
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2061
|
+
|
|
2062
|
+
const retryOnError = __webpack_require__( 4243 );
|
|
2063
|
+
const sleep = __webpack_require__( 2445 );
|
|
2064
|
+
const Timer = __webpack_require__( 9651 );
|
|
2065
|
+
const untarJsonGz = __webpack_require__( 8233 );
|
|
2066
|
+
|
|
1874
2067
|
module.exports = {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
INVALID_METHOD: 'Argument "method" must be one of the default HTTP methods',
|
|
1880
|
-
INVALID_STATUS_CODE: 'Argument "statusCode" must be valid HTTP Status Code',
|
|
1881
|
-
INVALID_TRANSFORM_REQUEST: 'Argument "transformRequest" must be either "camelize", "snakelize", false or null',
|
|
1882
|
-
INVALID_TRANSFORM_RESPONSE: 'Argument "transformResponse" must be either "camelize", "snakelize", false or null',
|
|
1883
|
-
INVALID_MATCHER_ROUTE: 'Argument "route" must be either undefined or an string with length greater than 0',
|
|
1884
|
-
INVALID_MATCHER_ROUTE_INCLUDES: 'Argument "routeIncludes" must be either undefined or an string with length greater than 0',
|
|
1885
|
-
INVALID_MATCHER_ROUTE_NOT_INCLUDES: 'Argument "routeNotIncludes" must be either undefined or an string with length greater than 0',
|
|
1886
|
-
INVALID_MATCHER_ROUTE_MATCH: 'Argument "routeMatch" must be either undefined or type RegExp',
|
|
1887
|
-
INVALID_MATCHER_PATH: 'Argument "path" must be either undefined or an string with length greater than 0',
|
|
1888
|
-
INVALID_MATCHER_PATH_INCLUDES: 'Argument "pathIncludes" must be either undefined or an string with length greater than 0',
|
|
1889
|
-
INVALID_MATCHER_PATH_NOT_INCLUDES: 'Argument "pathNotIncludes" must be either undefined or an string with length greater than 0',
|
|
1890
|
-
INVALID_MATCHER_PATH_MATCH: 'Argument "pathMatch" must be either undefined or type RegExp',
|
|
1891
|
-
INVALID_USER_RESPONSE: 'Function return must be a number, a string, an array (where p=0 is a number) or an object (where .statusCode is a number)'
|
|
2068
|
+
retryOnError,
|
|
2069
|
+
sleep,
|
|
2070
|
+
Timer,
|
|
2071
|
+
untarJsonGz
|
|
1892
2072
|
};
|
|
1893
2073
|
|
|
1894
2074
|
|
|
1895
2075
|
/***/ }),
|
|
1896
2076
|
|
|
1897
|
-
/***/
|
|
2077
|
+
/***/ 6961:
|
|
2078
|
+
/***/ ((module) => {
|
|
2079
|
+
|
|
2080
|
+
module.exports = t => t * 60 * 60 * 1000;
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
/***/ }),
|
|
2084
|
+
|
|
2085
|
+
/***/ 6982:
|
|
2086
|
+
/***/ ((module) => {
|
|
2087
|
+
|
|
2088
|
+
"use strict";
|
|
2089
|
+
module.exports = require("crypto");
|
|
2090
|
+
|
|
2091
|
+
/***/ }),
|
|
2092
|
+
|
|
2093
|
+
/***/ 7051:
|
|
2094
|
+
/***/ ((module) => {
|
|
2095
|
+
|
|
2096
|
+
module.exports = t => t * 1000;
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
/***/ }),
|
|
2100
|
+
|
|
2101
|
+
/***/ 7261:
|
|
1898
2102
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1899
2103
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
const Text = __webpack_require__( 9760 );
|
|
2104
|
+
// https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_Type.html
|
|
2105
|
+
// https://docs.aws.amazon.com/timestream/latest/developerguide/supported-data-types.html
|
|
1903
2106
|
|
|
1904
|
-
|
|
1905
|
-
constructor( args ) {
|
|
1906
|
-
if ( args === undefined ) {
|
|
1907
|
-
this.values = [ 204 ];
|
|
1908
|
-
} else if ( typeof args === 'string' && args.length === 0 ) {
|
|
1909
|
-
this.values = [ 204 ];
|
|
2107
|
+
const { ScalarType } = __webpack_require__( 1671 );
|
|
1910
2108
|
|
|
1911
|
-
|
|
1912
|
-
|
|
2109
|
+
const parseBigInt = value => {
|
|
2110
|
+
const asInt = parseInt( value, 10 );
|
|
2111
|
+
return asInt <= Number.MAX_SAFE_INTEGER && asInt >= Number.MIN_SAFE_INTEGER ? asInt : value;
|
|
2112
|
+
};
|
|
1913
2113
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2114
|
+
const parseScalarValue = ( type, value ) => {
|
|
2115
|
+
switch ( type ) {
|
|
2116
|
+
case ScalarType.BOOLEAN:
|
|
2117
|
+
return value === 'true';
|
|
2118
|
+
case ScalarType.DOUBLE:
|
|
2119
|
+
return parseFloat( value );
|
|
2120
|
+
case ScalarType.TIMESTAMP:
|
|
2121
|
+
return new Date( `${value.replace( ' ', 'T' )}Z` );
|
|
2122
|
+
case ScalarType.INTEGER:
|
|
2123
|
+
return parseInt( value, 10 );
|
|
2124
|
+
case ScalarType.UNKNOWN: // is NULL
|
|
2125
|
+
return null;
|
|
2126
|
+
case ScalarType.BIGINT:
|
|
2127
|
+
return parseBigInt( value );
|
|
2128
|
+
case ScalarType.VARCHAR:
|
|
2129
|
+
case ScalarType.DATE:
|
|
2130
|
+
case ScalarType.TIME:
|
|
2131
|
+
case ScalarType.INTERVAL_DAY_TO_SECOND:
|
|
2132
|
+
case ScalarType.INTERVAL_YEAR_TO_MONTH:
|
|
2133
|
+
default:
|
|
2134
|
+
return value;
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
1917
2137
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
2138
|
+
const parseValue = ( typeInfo, datum ) => {
|
|
2139
|
+
// value might be null
|
|
2140
|
+
if ( datum['NullValue'] === true ) {
|
|
2141
|
+
return null;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
// or a time series
|
|
2145
|
+
if ( Object.hasOwn( typeInfo, 'TimeSeriesMeasureValueColumnInfo' ) ) {
|
|
2146
|
+
return datum.TimeSeriesValue.map( v => ( {
|
|
2147
|
+
time: new Date( v.Time ),
|
|
2148
|
+
value: parseValue( typeInfo.TimeSeriesMeasureValueColumnInfo.Type, v.Value )
|
|
2149
|
+
} ) );
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
// maybe an array
|
|
2153
|
+
if ( Object.hasOwn( typeInfo, 'ArrayColumnInfo' ) ) {
|
|
2154
|
+
return datum.ArrayValue.map( v => parseValue( typeInfo.ArrayColumnInfo.Type, v ) );
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
// or even a row
|
|
2158
|
+
if ( Object.hasOwn( typeInfo, 'RowColumnInfo' ) ) {
|
|
2159
|
+
const rowColumnInfo = typeInfo.RowColumnInfo;
|
|
2160
|
+
return datum.RowValue.Data.reduce( ( object, value, index ) => {
|
|
2161
|
+
const { Name: name, Type: typeInfo } = rowColumnInfo[index];
|
|
2162
|
+
return Object.assign( object, { [name]: parseValue( typeInfo, value ) } );
|
|
2163
|
+
}, {} );
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// if none, it is scalar
|
|
2167
|
+
return parseScalarValue( typeInfo.ScalarType, datum['ScalarValue'] );
|
|
2168
|
+
};
|
|
2169
|
+
|
|
2170
|
+
module.exports = response => {
|
|
2171
|
+
const { ColumnInfo: colInfo, Rows: rows } = response;
|
|
2172
|
+
return rows.map( row =>
|
|
2173
|
+
row.Data.reduce( ( entry, value, index ) => {
|
|
2174
|
+
const { Name: name, Type: typeInfo } = colInfo[index];
|
|
2175
|
+
return Object.assign( entry, { [name]: parseValue( typeInfo, value ) } );
|
|
2176
|
+
}, { } )
|
|
2177
|
+
);
|
|
2178
|
+
};
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
/***/ }),
|
|
2182
|
+
|
|
2183
|
+
/***/ 7337:
|
|
2184
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2185
|
+
|
|
2186
|
+
const { GetQueryExecutionCommand, GetQueryResultsCommand } = __webpack_require__( 3744 );
|
|
2187
|
+
const parseResults = __webpack_require__( 834 );
|
|
2188
|
+
const pollingDelay = __webpack_require__( 4127 );
|
|
2189
|
+
|
|
2190
|
+
const sleep = t => new Promise( r => setTimeout( () => r(), t ) );
|
|
2191
|
+
|
|
2192
|
+
const getQueryResults = async ( { client, queryExecutionId, maxResults, token } ) => {
|
|
2193
|
+
const { NextToken: nextToken, ResultSet } = await client.send( new GetQueryResultsCommand( {
|
|
2194
|
+
...{ QueryExecutionId: queryExecutionId },
|
|
2195
|
+
...( maxResults ? { MaxResults: maxResults } : {} ),
|
|
2196
|
+
...( token ? { NextToken: token } : {} )
|
|
2197
|
+
} ) );
|
|
2198
|
+
|
|
2199
|
+
return { nextToken, items: parseResults( ResultSet ) };
|
|
2200
|
+
};
|
|
2201
|
+
const getQueryResultsRecursive = async ( { client, queryExecutionId, token } ) => {
|
|
2202
|
+
const { nextToken, items } = await getQueryResults( { client, queryExecutionId, token } );
|
|
2203
|
+
|
|
2204
|
+
if ( nextToken ) {
|
|
2205
|
+
return { items: items.concat( ( await getQueryResultsRecursive( { client, queryExecutionId, token: nextToken } ) ).items ) };
|
|
2206
|
+
}
|
|
2207
|
+
return { items };
|
|
2208
|
+
};
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/athena/command/GetQueryResultsCommand/
|
|
2212
|
+
* { client, recursive, queryExecutionId, maxResults, paginationToken }
|
|
2213
|
+
*/
|
|
2214
|
+
const getResults = async ( { client, recursive, queryExecutionId, token, maxResults } ) => {
|
|
2215
|
+
const { QueryExecution: { Status: status } } = await client.send( new GetQueryExecutionCommand( { QueryExecutionId: queryExecutionId } ) );
|
|
1921
2216
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2217
|
+
if ( status.State === 'FAILED' ) {
|
|
2218
|
+
throw new Error( status.AthenaError?.ErrorMessage ?? status.StateChangeReason );
|
|
2219
|
+
}
|
|
1925
2220
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
throw new LambdaApiValidationError( Text.INVALID_USER_RESPONSE );
|
|
1930
|
-
}
|
|
2221
|
+
if ( status.State === 'SUCCEEDED' ) {
|
|
2222
|
+
const fn = recursive ? getQueryResultsRecursive : getQueryResults;
|
|
2223
|
+
return fn( { client, recursive, queryExecutionId, token, maxResults } );
|
|
1931
2224
|
}
|
|
2225
|
+
|
|
2226
|
+
// sleep an try again
|
|
2227
|
+
await sleep( pollingDelay );
|
|
2228
|
+
return getResults( { client, recursive, queryExecutionId, token, maxResults } );
|
|
1932
2229
|
};
|
|
1933
2230
|
|
|
2231
|
+
module.exports = getResults;
|
|
2232
|
+
|
|
1934
2233
|
|
|
1935
2234
|
/***/ }),
|
|
1936
2235
|
|
|
1937
|
-
/***/
|
|
1938
|
-
/***/ ((module
|
|
2236
|
+
/***/ 7416:
|
|
2237
|
+
/***/ ((module) => {
|
|
1939
2238
|
|
|
1940
|
-
|
|
1941
|
-
const LambdaApiValidationError = __webpack_require__( 3446 );
|
|
2239
|
+
module.exports = v => Math.ceil( v / 1000 );
|
|
1942
2240
|
|
|
1943
|
-
const evaluate = ( condition, errorMessage ) => {
|
|
1944
|
-
if ( !condition ) { throw new LambdaApiValidationError( errorMessage ); }
|
|
1945
|
-
};
|
|
1946
2241
|
|
|
1947
|
-
|
|
1948
|
-
try {
|
|
1949
|
-
return !!Reflect.construct( new Proxy( v, {} ), [] );
|
|
1950
|
-
} catch {
|
|
1951
|
-
return false;
|
|
1952
|
-
}
|
|
1953
|
-
};
|
|
2242
|
+
/***/ }),
|
|
1954
2243
|
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
function: v => evaluate( typeof v === 'function', Text.INVALID_FN ),
|
|
1958
|
-
httpMethod: v => evaluate( [ 'DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT' ].includes( v ), Text.INVALID_METHOD ),
|
|
1959
|
-
matcherPath: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH ),
|
|
1960
|
-
matcherPathIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH_INCLUDES ),
|
|
1961
|
-
matcherPathMatch: v => evaluate( v === undefined || v?.constructor?.name === RegExp.name, Text.INVALID_MATCHER_PATH_MATCH ),
|
|
1962
|
-
matcherPathNotIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH_NOT_INCLUDES ),
|
|
1963
|
-
matcherRoute: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE ),
|
|
1964
|
-
matcherRouteIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE_INCLUDES ),
|
|
1965
|
-
matcherRouteMatch: v => evaluate( v === undefined || v?.constructor?.name === RegExp.name, Text.INVALID_MATCHER_ROUTE_MATCH ),
|
|
1966
|
-
matcherRouteNotIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE_NOT_INCLUDES ),
|
|
1967
|
-
statusCode: v => evaluate( typeof v === 'number' && /^[1-5]\d\d$/.test( String( v ) ), Text.INVALID_STATUS_CODE ),
|
|
1968
|
-
transformRequest: v => evaluate( [ 'camelcase', 'snakecase', null, false ].includes( v ), Text.INVALID_TRANSFORM_REQUEST ),
|
|
1969
|
-
transformResponse: v => evaluate( [ 'camelcase', 'snakecase', null, false ].includes( v ), Text.INVALID_TRANSFORM_RESPONSE )
|
|
1970
|
-
};
|
|
2244
|
+
/***/ 7493:
|
|
2245
|
+
/***/ ((module) => {
|
|
1971
2246
|
|
|
2247
|
+
"use strict";
|
|
2248
|
+
module.exports = require("@aws-sdk/client-cloudwatch-logs");
|
|
1972
2249
|
|
|
1973
2250
|
/***/ }),
|
|
1974
2251
|
|
|
1975
|
-
/***/
|
|
1976
|
-
/***/ ((module) => {
|
|
2252
|
+
/***/ 7572:
|
|
2253
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1977
2254
|
|
|
1978
|
-
|
|
2255
|
+
const isSerializable = __webpack_require__( 8864 );
|
|
2256
|
+
const snakelize = __webpack_require__( 3402 );
|
|
2257
|
+
|
|
2258
|
+
const change = ( obj, keepAllCaps ) =>
|
|
2259
|
+
!isSerializable( obj ) ? obj : Object.entries( obj ).reduce( ( transformed, [ key, value ] ) => {
|
|
2260
|
+
delete transformed[key];
|
|
2261
|
+
transformed[snakelize( key, { keepAllCaps } )] = typeof value === 'object' ? change( value, keepAllCaps ) : value;
|
|
2262
|
+
return transformed;
|
|
2263
|
+
}, Array.isArray( obj ) ? [] : {} );
|
|
2264
|
+
|
|
2265
|
+
module.exports = ( obj, { keepAllCaps = false } = {} ) => change( obj, keepAllCaps );
|
|
1979
2266
|
|
|
1980
2267
|
|
|
1981
2268
|
/***/ }),
|
|
1982
2269
|
|
|
1983
|
-
/***/
|
|
2270
|
+
/***/ 7651:
|
|
1984
2271
|
/***/ ((module) => {
|
|
1985
2272
|
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
const sorted = values.slice().sort( ( a, b ) => a - b );
|
|
1989
|
-
const evenArray = values.length % 2 === 0;
|
|
1990
|
-
const midIndex = Math.floor( values.length / 2 );
|
|
1991
|
-
return evenArray ? ( sorted[midIndex - 1] + sorted[midIndex] ) / 2 : sorted[midIndex];
|
|
1992
|
-
};
|
|
1993
|
-
|
|
2273
|
+
"use strict";
|
|
2274
|
+
module.exports = require("@aws-sdk/client-sns");
|
|
1994
2275
|
|
|
1995
2276
|
/***/ }),
|
|
1996
2277
|
|
|
1997
|
-
/***/
|
|
2278
|
+
/***/ 8080:
|
|
1998
2279
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1999
2280
|
|
|
2000
|
-
const
|
|
2281
|
+
const { PublishCommand } = __webpack_require__( 7651 );
|
|
2001
2282
|
|
|
2002
|
-
module.exports =
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2283
|
+
module.exports = async ( client, topic, message, args = {} ) => {
|
|
2284
|
+
const response = await client.send( new PublishCommand( {
|
|
2285
|
+
...args,
|
|
2286
|
+
TopicArn: topic,
|
|
2287
|
+
Message: typeof message === 'string' ? message : JSON.stringify( message )
|
|
2288
|
+
} ) );
|
|
2289
|
+
return response.MessageId;
|
|
2005
2290
|
};
|
|
2006
2291
|
|
|
2007
2292
|
|
|
2008
2293
|
/***/ }),
|
|
2009
2294
|
|
|
2010
|
-
/***/
|
|
2011
|
-
/***/ ((module
|
|
2295
|
+
/***/ 8119:
|
|
2296
|
+
/***/ ((module) => {
|
|
2012
2297
|
|
|
2013
|
-
|
|
2298
|
+
module.exports = t => t * 30 * 24 * 60 * 60 * 1000;
|
|
2014
2299
|
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2300
|
+
|
|
2301
|
+
/***/ }),
|
|
2302
|
+
|
|
2303
|
+
/***/ 8175:
|
|
2304
|
+
/***/ ((module) => {
|
|
2305
|
+
|
|
2306
|
+
/*
|
|
2307
|
+
References:
|
|
2308
|
+
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html
|
|
2309
|
+
- https://stackoverflow.com/questions/58809098/remove-invalid-characters-from-message-sent-to-aws-amazon-sqs
|
|
2310
|
+
*/
|
|
2311
|
+
module.exports = v => v?.replace( /[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/ug, '' ) // eslint-disable-line
|
|
2021
2312
|
|
|
2022
2313
|
|
|
2023
2314
|
/***/ }),
|
|
2024
2315
|
|
|
2025
|
-
/***/
|
|
2316
|
+
/***/ 8233:
|
|
2026
2317
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2027
2318
|
|
|
2028
|
-
const
|
|
2319
|
+
const { unzipSync } = __webpack_require__( 3106 );
|
|
2029
2320
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2321
|
+
const firstIndexOf = ( c, ...vars ) => Math.min( ...vars.map( v => c.indexOf( v ) ).filter( n => n > -1 ) );
|
|
2322
|
+
const lastIndexOf = ( c, ...vars ) => Math.max( ...vars.map( v => c.lastIndexOf( v ) ) );
|
|
2032
2323
|
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2324
|
+
/**
|
|
2325
|
+
* Decompress JSON
|
|
2326
|
+
*
|
|
2327
|
+
* Reads a gzipped tarball (.tar.gz)
|
|
2328
|
+
* 1. Unzip it
|
|
2329
|
+
* 2. Convert all to utf-8
|
|
2330
|
+
* 3. Split files using the \0star separator
|
|
2331
|
+
* 4. Trim files until JSON markup start/end ({})
|
|
2332
|
+
* 5. JSON parse
|
|
2333
|
+
*
|
|
2334
|
+
* Enjoy this 100% native tarball decompression!
|
|
2335
|
+
*/
|
|
2336
|
+
module.exports = raw =>
|
|
2337
|
+
unzipSync( raw )
|
|
2338
|
+
.toString( 'utf-8' )
|
|
2339
|
+
.split( '\0ustar' )
|
|
2340
|
+
.slice( 1 )
|
|
2341
|
+
.map( c =>
|
|
2342
|
+
JSON.parse( c.substring( firstIndexOf( c, '{', '[' ), lastIndexOf( c, '}', ']' ) + 1 ) )
|
|
2343
|
+
);
|
|
2038
2344
|
|
|
2039
2345
|
|
|
2040
2346
|
/***/ }),
|
|
2041
2347
|
|
|
2042
|
-
/***/
|
|
2348
|
+
/***/ 8248:
|
|
2043
2349
|
/***/ ((module) => {
|
|
2044
2350
|
|
|
2045
|
-
|
|
2351
|
+
"use strict";
|
|
2352
|
+
module.exports = require("@aws-sdk/client-timestream-write");
|
|
2353
|
+
|
|
2354
|
+
/***/ }),
|
|
2355
|
+
|
|
2356
|
+
/***/ 8256:
|
|
2357
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2358
|
+
|
|
2359
|
+
const isSerializable = __webpack_require__( 8864 );
|
|
2360
|
+
const camelize = __webpack_require__( 3914 );
|
|
2361
|
+
|
|
2362
|
+
const change = ( obj, keepAllCaps ) =>
|
|
2363
|
+
!isSerializable( obj ) ? obj : Object.entries( obj ).reduce( ( transformed, [ key, value ] ) => {
|
|
2364
|
+
delete transformed[key];
|
|
2365
|
+
transformed[camelize( key, { keepAllCaps } )] = typeof value === 'object' ? change( value, keepAllCaps ) : value;
|
|
2366
|
+
return transformed;
|
|
2367
|
+
}, Array.isArray( obj ) ? [] : {} );
|
|
2368
|
+
|
|
2369
|
+
module.exports = ( obj, { keepAllCaps = false } = {} ) => change( obj, keepAllCaps );
|
|
2046
2370
|
|
|
2047
2371
|
|
|
2048
2372
|
/***/ }),
|
|
2049
2373
|
|
|
2050
|
-
/***/
|
|
2374
|
+
/***/ 8278:
|
|
2051
2375
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2052
2376
|
|
|
2053
|
-
const
|
|
2054
|
-
const
|
|
2055
|
-
const
|
|
2056
|
-
const calcStdDevPopulation = __webpack_require__( 2736 );
|
|
2057
|
-
const calcStdDevSample = __webpack_require__( 6089 );
|
|
2058
|
-
const calcZScore = __webpack_require__( 4110 );
|
|
2059
|
-
const roundGaussian = __webpack_require__( 637 );
|
|
2060
|
-
const roundStandard = __webpack_require__( 115 );
|
|
2377
|
+
const joinUnique = __webpack_require__( 2836 );
|
|
2378
|
+
const joinUniqueCustom = __webpack_require__( 536 );
|
|
2379
|
+
const splitBatches = __webpack_require__( 4821 );
|
|
2061
2380
|
|
|
2062
2381
|
module.exports = {
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
calcStdDevPopulation,
|
|
2067
|
-
calcStdDevSample,
|
|
2068
|
-
calcZScore,
|
|
2069
|
-
roundGaussian,
|
|
2070
|
-
roundStandard
|
|
2382
|
+
joinUnique,
|
|
2383
|
+
joinUniqueCustom,
|
|
2384
|
+
splitBatches
|
|
2071
2385
|
};
|
|
2072
2386
|
|
|
2073
2387
|
|
|
2074
2388
|
/***/ }),
|
|
2075
2389
|
|
|
2076
|
-
/***/
|
|
2077
|
-
/***/ ((module) => {
|
|
2390
|
+
/***/ 8282:
|
|
2391
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2078
2392
|
|
|
2079
|
-
|
|
2080
|
-
|
|
2393
|
+
const validators = __webpack_require__( 8994 );
|
|
2394
|
+
const LambdaApiValidationError = __webpack_require__( 3446 );
|
|
2395
|
+
const Text = __webpack_require__( 9760 );
|
|
2081
2396
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
( ( i % 2 === 0 ) ? i : i + 1 ) : Math.round( num );
|
|
2089
|
-
return r / m;
|
|
2090
|
-
};
|
|
2397
|
+
module.exports = class UserResponse {
|
|
2398
|
+
constructor( args ) {
|
|
2399
|
+
if ( args === undefined ) {
|
|
2400
|
+
this.values = [ 204 ];
|
|
2401
|
+
} else if ( typeof args === 'string' && args.length === 0 ) {
|
|
2402
|
+
this.values = [ 204 ];
|
|
2091
2403
|
|
|
2404
|
+
} else if ( typeof args === 'string' && args.length > 0 ) {
|
|
2405
|
+
this.values = [ 200, args ];
|
|
2092
2406
|
|
|
2093
|
-
|
|
2407
|
+
} else if ( typeof args === 'number' ) {
|
|
2408
|
+
validators.statusCode( args );
|
|
2409
|
+
this.values = [ args ];
|
|
2094
2410
|
|
|
2095
|
-
|
|
2096
|
-
|
|
2411
|
+
} else if ( Array.isArray( args ) ) {
|
|
2412
|
+
validators.statusCode( args[0] );
|
|
2413
|
+
this.values = args;
|
|
2097
2414
|
|
|
2098
|
-
|
|
2415
|
+
} else if ( args.statusCode ) {
|
|
2416
|
+
validators.statusCode( args.statusCode );
|
|
2417
|
+
this.values = [ args.statusCode, args.body, args.headers, args.isBase64Encoded ];
|
|
2418
|
+
|
|
2419
|
+
} else if ( [ undefined, null ].includes( args ) ) {
|
|
2420
|
+
this.values = [ 200 ];
|
|
2421
|
+
} else {
|
|
2422
|
+
throw new LambdaApiValidationError( Text.INVALID_USER_RESPONSE );
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2099
2426
|
|
|
2100
2427
|
|
|
2101
2428
|
/***/ }),
|
|
2102
2429
|
|
|
2103
|
-
/***/
|
|
2430
|
+
/***/ 8593:
|
|
2104
2431
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2105
2432
|
|
|
2106
|
-
const
|
|
2107
|
-
const
|
|
2433
|
+
const { BatchWriteCommand } = __webpack_require__( 3489 );
|
|
2434
|
+
const splitBatches = __webpack_require__( 4821 );
|
|
2108
2435
|
|
|
2109
|
-
const
|
|
2110
|
-
!isSerializable( obj ) ? obj : Object.entries( obj ).reduce( ( transformed, [ key, value ] ) => {
|
|
2111
|
-
delete transformed[key];
|
|
2112
|
-
transformed[camelize( key, { keepAllCaps } )] = typeof value === 'object' ? change( value, keepAllCaps ) : value;
|
|
2113
|
-
return transformed;
|
|
2114
|
-
}, Array.isArray( obj ) ? [] : {} );
|
|
2436
|
+
const batchSize = 25;
|
|
2115
2437
|
|
|
2116
|
-
|
|
2438
|
+
const getMapper = method => method === 'put' ? v => ( { PutRequest: { Item: v } } ) : v => ( { DeleteRequest: { Key: v } } );
|
|
2117
2439
|
|
|
2440
|
+
const process = async ( { client, method, table, batches } ) => {
|
|
2441
|
+
if ( batches.length === 0 ) { return true; }
|
|
2118
2442
|
|
|
2119
|
-
|
|
2443
|
+
const response = await client.send( new BatchWriteCommand( { RequestItems: { [table]: batches[0] } } ) );
|
|
2120
2444
|
|
|
2121
|
-
|
|
2122
|
-
|
|
2445
|
+
const unprocessed = response.UnprocessedItems?.[table];
|
|
2446
|
+
return process( {
|
|
2447
|
+
client, method, table,
|
|
2448
|
+
batches: unprocessed ? splitBatches( batches.slice( 1 ).flat().concat( unprocessed ), batchSize ) : batches.slice( 1 )
|
|
2449
|
+
} );
|
|
2450
|
+
};
|
|
2123
2451
|
|
|
2124
|
-
module.exports = (
|
|
2452
|
+
module.exports = async ( client, method, table, items ) =>
|
|
2453
|
+
process( { client, method, table, batches: splitBatches( items.map( getMapper( method ) ), batchSize ) } );
|
|
2125
2454
|
|
|
2126
2455
|
|
|
2127
2456
|
/***/ }),
|
|
2128
2457
|
|
|
2129
|
-
/***/
|
|
2458
|
+
/***/ 8660:
|
|
2130
2459
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2131
2460
|
|
|
2132
|
-
const
|
|
2133
|
-
const
|
|
2134
|
-
const removeEmptyArrays = __webpack_require__( 2047 );
|
|
2135
|
-
const snakelize = __webpack_require__( 7572 );
|
|
2461
|
+
const cacheStorage = __webpack_require__( 4164 );
|
|
2462
|
+
const { GetParameterCommand } = __webpack_require__( 4348 );
|
|
2136
2463
|
|
|
2137
|
-
module.exports = {
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2464
|
+
module.exports = async ( client, name ) => {
|
|
2465
|
+
const key = `SSM_${name}`;
|
|
2466
|
+
const cacheValue = cacheStorage.get( key );
|
|
2467
|
+
if ( cacheValue ) { return cacheValue; }
|
|
2468
|
+
|
|
2469
|
+
try {
|
|
2470
|
+
const response = await client.send( new GetParameterCommand( { Name: name, WithDecryption: true } ) );
|
|
2471
|
+
const value = response?.Parameter?.Value;
|
|
2472
|
+
cacheStorage.set( key, value );
|
|
2473
|
+
return value;
|
|
2474
|
+
} catch ( error ) {
|
|
2475
|
+
if ( error.constructor.name === 'ParameterNotFound' ) {
|
|
2476
|
+
return null;
|
|
2477
|
+
}
|
|
2478
|
+
throw error;
|
|
2479
|
+
}
|
|
2142
2480
|
};
|
|
2143
2481
|
|
|
2144
2482
|
|
|
@@ -2158,227 +2496,195 @@ module.exports = obj =>
|
|
|
2158
2496
|
|
|
2159
2497
|
/***/ }),
|
|
2160
2498
|
|
|
2161
|
-
/***/
|
|
2162
|
-
/***/ ((module) => {
|
|
2163
|
-
|
|
2164
|
-
module.exports = o => Object.fromEntries( Object.entries( o ).filter( ( [ , v ] ) => !Array.isArray( v ) || v.length > 0 ) );
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
/***/ }),
|
|
2168
|
-
|
|
2169
|
-
/***/ 7572:
|
|
2499
|
+
/***/ 8936:
|
|
2170
2500
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2171
2501
|
|
|
2172
|
-
const
|
|
2173
|
-
const snakelize = __webpack_require__( 3402 );
|
|
2174
|
-
|
|
2175
|
-
const change = ( obj, keepAllCaps ) =>
|
|
2176
|
-
!isSerializable( obj ) ? obj : Object.entries( obj ).reduce( ( transformed, [ key, value ] ) => {
|
|
2177
|
-
delete transformed[key];
|
|
2178
|
-
transformed[snakelize( key, { keepAllCaps } )] = typeof value === 'object' ? change( value, keepAllCaps ) : value;
|
|
2179
|
-
return transformed;
|
|
2180
|
-
}, Array.isArray( obj ) ? [] : {} );
|
|
2181
|
-
|
|
2182
|
-
module.exports = ( obj, { keepAllCaps = false } = {} ) => change( obj, keepAllCaps );
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
/***/ }),
|
|
2186
|
-
|
|
2187
|
-
/***/ 5422:
|
|
2188
|
-
/***/ ((module) => {
|
|
2189
|
-
|
|
2190
|
-
global.__redisInstances = {};
|
|
2502
|
+
const { WriteRecordsCommand } = __webpack_require__( 8248 );
|
|
2191
2503
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
return global.__redisInstances[address];
|
|
2204
|
-
} else {
|
|
2205
|
-
delete global.__redisInstances[address];
|
|
2206
|
-
}
|
|
2207
|
-
} catch {
|
|
2208
|
-
delete global.__redisInstances[address];
|
|
2504
|
+
module.exports = async ( client, { database, table, records, ignoreRejections = false } ) => {
|
|
2505
|
+
try {
|
|
2506
|
+
const response = await client.send( new WriteRecordsCommand( {
|
|
2507
|
+
DatabaseName: database,
|
|
2508
|
+
TableName: table,
|
|
2509
|
+
Records: records
|
|
2510
|
+
} ) );
|
|
2511
|
+
return { recordsIngested: response.RecordsIngested };
|
|
2512
|
+
} catch ( error ) {
|
|
2513
|
+
if ( ignoreRejections && error.name === 'RejectedRecordsException' ) {
|
|
2514
|
+
return { rejectedRecords: error.RejectedRecords };
|
|
2209
2515
|
}
|
|
2516
|
+
throw error;
|
|
2210
2517
|
}
|
|
2211
|
-
|
|
2212
|
-
const client = redis.createClient( { url: `${protocol}://${address}:${port}`, socket: { keepAlive: 15000 } } );
|
|
2213
|
-
|
|
2214
|
-
await client.connect();
|
|
2215
|
-
|
|
2216
|
-
global.__redisInstances[address] = client;
|
|
2217
|
-
return client;
|
|
2218
2518
|
};
|
|
2219
2519
|
|
|
2220
2520
|
|
|
2221
2521
|
/***/ }),
|
|
2222
2522
|
|
|
2223
|
-
/***/
|
|
2523
|
+
/***/ 8994:
|
|
2224
2524
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2225
2525
|
|
|
2226
|
-
const
|
|
2526
|
+
const Text = __webpack_require__( 9760 );
|
|
2527
|
+
const LambdaApiValidationError = __webpack_require__( 3446 );
|
|
2227
2528
|
|
|
2228
|
-
|
|
2229
|
-
|
|
2529
|
+
const evaluate = ( condition, errorMessage ) => {
|
|
2530
|
+
if ( !condition ) { throw new LambdaApiValidationError( errorMessage ); }
|
|
2230
2531
|
};
|
|
2231
2532
|
|
|
2533
|
+
const isConstructor = v => {
|
|
2534
|
+
try {
|
|
2535
|
+
return !!Reflect.construct( new Proxy( v, {} ), [] );
|
|
2536
|
+
} catch {
|
|
2537
|
+
return false;
|
|
2538
|
+
}
|
|
2539
|
+
};
|
|
2232
2540
|
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
.replace( /^([A-Z])/g, c => c[0].toLowerCase() ) // first letter
|
|
2250
|
-
] )
|
|
2251
|
-
// Rebuild the string replacing the converter terms keeping the original delimiters
|
|
2252
|
-
.reduce( ( result, [ term, repl ] ) => result.replace( term, repl ), input );
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
/***/ }),
|
|
2256
|
-
|
|
2257
|
-
/***/ 3258:
|
|
2258
|
-
/***/ ((module) => {
|
|
2259
|
-
|
|
2260
|
-
module.exports = input =>
|
|
2261
|
-
// Break the string into sequences to rebuild later
|
|
2262
|
-
!input ? input : input.split( /\s/ )
|
|
2263
|
-
// ALL_CAPS terms are ignored
|
|
2264
|
-
.map( term => [ term, term.charAt( 0 ).toUpperCase() + term.slice( 1 ).toLowerCase() ] )
|
|
2265
|
-
// Rebuild the string replacing the converter terms keeping the original delimiters
|
|
2266
|
-
.reduce( ( result, [ term, repl ] ) => result.replace( term, repl ), input );
|
|
2541
|
+
module.exports = {
|
|
2542
|
+
errorType: v => evaluate( isConstructor( v ), Text.INVALID_ERROR_TYPE ),
|
|
2543
|
+
function: v => evaluate( typeof v === 'function', Text.INVALID_FN ),
|
|
2544
|
+
httpMethod: v => evaluate( [ 'DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT' ].includes( v ), Text.INVALID_METHOD ),
|
|
2545
|
+
matcherPath: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH ),
|
|
2546
|
+
matcherPathIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH_INCLUDES ),
|
|
2547
|
+
matcherPathMatch: v => evaluate( v === undefined || v?.constructor?.name === RegExp.name, Text.INVALID_MATCHER_PATH_MATCH ),
|
|
2548
|
+
matcherPathNotIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_PATH_NOT_INCLUDES ),
|
|
2549
|
+
matcherRoute: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE ),
|
|
2550
|
+
matcherRouteIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE_INCLUDES ),
|
|
2551
|
+
matcherRouteMatch: v => evaluate( v === undefined || v?.constructor?.name === RegExp.name, Text.INVALID_MATCHER_ROUTE_MATCH ),
|
|
2552
|
+
matcherRouteNotIncludes: v => evaluate( v === undefined || ( typeof v === 'string' && v.length > 0 ), Text.INVALID_MATCHER_ROUTE_NOT_INCLUDES ),
|
|
2553
|
+
statusCode: v => evaluate( typeof v === 'number' && /^[1-5]\d\d$/.test( String( v ) ), Text.INVALID_STATUS_CODE ),
|
|
2554
|
+
transformRequest: v => evaluate( [ 'camelcase', 'snakecase', null, false ].includes( v ), Text.INVALID_TRANSFORM_REQUEST ),
|
|
2555
|
+
transformResponse: v => evaluate( [ 'camelcase', 'snakecase', null, false ].includes( v ), Text.INVALID_TRANSFORM_RESPONSE )
|
|
2556
|
+
};
|
|
2267
2557
|
|
|
2268
2558
|
|
|
2269
2559
|
/***/ }),
|
|
2270
2560
|
|
|
2271
|
-
/***/
|
|
2561
|
+
/***/ 9039:
|
|
2272
2562
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2273
2563
|
|
|
2274
|
-
const
|
|
2275
|
-
const capitalizeWords = __webpack_require__( 3258 );
|
|
2276
|
-
const snakelize = __webpack_require__( 3402 );
|
|
2564
|
+
const cache = __webpack_require__( 4164 );
|
|
2277
2565
|
|
|
2278
|
-
module.exports = {
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2566
|
+
module.exports = ( constructor, args = [] ) => {
|
|
2567
|
+
const cacheKey = `${constructor.name}(${args.map( arg => JSON.stringify( arg ) ).join( ',' )})`;
|
|
2568
|
+
return cache.get( cacheKey ) ?? ( () => {
|
|
2569
|
+
const client = Reflect.construct( constructor, args );
|
|
2570
|
+
cache.set( cacheKey, client );
|
|
2571
|
+
return client;
|
|
2572
|
+
} )();
|
|
2282
2573
|
};
|
|
2283
2574
|
|
|
2284
2575
|
|
|
2285
2576
|
/***/ }),
|
|
2286
2577
|
|
|
2287
|
-
/***/
|
|
2578
|
+
/***/ 9129:
|
|
2288
2579
|
/***/ ((module) => {
|
|
2289
2580
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2581
|
+
/* eslint consistent-return: 0 */
|
|
2582
|
+
const removeNullValues = ( o, isArray = Array.isArray( o ) ) =>
|
|
2583
|
+
Object.entries( o ).reduce( ( newObj, [ k, v ] ) => {
|
|
2584
|
+
if ( v === null && !isArray ) { return newObj; }
|
|
2585
|
+
return Object.assign( newObj, { [k]: v?.constructor === Object ? removeNullValues( v ) : v } );
|
|
2586
|
+
}, isArray ? [] : {} );
|
|
2587
|
+
|
|
2588
|
+
module.exports = ( v, type ) => {
|
|
2589
|
+
if ( [ null, undefined ].includes( v ) ) {
|
|
2590
|
+
return undefined;
|
|
2591
|
+
}
|
|
2592
|
+
if ( v === '' && type !== 'varchar' ) {
|
|
2593
|
+
return undefined;
|
|
2594
|
+
}
|
|
2595
|
+
if ( type === 'boolean' ) {
|
|
2596
|
+
return v === 'true';
|
|
2597
|
+
}
|
|
2598
|
+
if ( [ 'float', 'decimal', 'double' ].includes( type ) ) {
|
|
2599
|
+
return parseFloat( v );
|
|
2600
|
+
}
|
|
2601
|
+
if ( [ 'tinyint', 'smallint', 'int', 'bigint' ].includes( type ) ) {
|
|
2602
|
+
return parseInt( v );
|
|
2603
|
+
}
|
|
2604
|
+
if ( 'timestamp' === type ) {
|
|
2605
|
+
return new Date( v ).getTime();
|
|
2606
|
+
}
|
|
2607
|
+
if ( [ 'row', 'array' ].includes( type ) ) {
|
|
2608
|
+
const obj = v.replace( /(?<=(?:{|,\s)[\w-_]+)=/g, '@@DELIMITER@@' ) // replaces delimiter = with @@DELIMITER@@
|
|
2609
|
+
.replace( /(?<={|,\s)([\w_-]+)(?=@@DELIMITER@@)/g, '"$1"' ) // wrap object keys
|
|
2610
|
+
.replace( /(?<=@@DELIMITER@@)((?:(?!,\s|}|\[|{).)+)/g, '"$1"' ) // wrap object values
|
|
2611
|
+
.replace( /(?<=\[|,\s)((?:(?!,\s|{|\]|").)+)/g, '"$1"' ) // wrap array values
|
|
2612
|
+
.replace( /"null"/g, 'null' ) // convert "null" to null
|
|
2613
|
+
.replace( /@@DELIMITER@@/g, ':' ); // replaces @@DELIMITER@@ for :
|
|
2614
|
+
|
|
2615
|
+
return removeNullValues( JSON.parse( obj ) );
|
|
2616
|
+
}
|
|
2617
|
+
if ( 'json' === type ) {
|
|
2618
|
+
return JSON.parse( v );
|
|
2619
|
+
}
|
|
2620
|
+
return v;
|
|
2621
|
+
};
|
|
2302
2622
|
|
|
2303
2623
|
|
|
2304
2624
|
/***/ }),
|
|
2305
2625
|
|
|
2306
|
-
/***/
|
|
2626
|
+
/***/ 9179:
|
|
2307
2627
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2308
2628
|
|
|
2309
|
-
const
|
|
2310
|
-
const sleep = __webpack_require__( 2445 );
|
|
2311
|
-
const Timer = __webpack_require__( 9651 );
|
|
2312
|
-
const untarJsonGz = __webpack_require__( 8233 );
|
|
2629
|
+
const parseValue = __webpack_require__( 2847 );
|
|
2313
2630
|
|
|
2314
|
-
module.exports =
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
};
|
|
2631
|
+
module.exports = item =>
|
|
2632
|
+
item.reduce( ( row, { field, value } ) =>
|
|
2633
|
+
Object.assign( row, {
|
|
2634
|
+
[field]: parseValue( value )
|
|
2635
|
+
} ), {} );
|
|
2320
2636
|
|
|
2321
2637
|
|
|
2322
2638
|
/***/ }),
|
|
2323
2639
|
|
|
2324
|
-
/***/
|
|
2640
|
+
/***/ 9552:
|
|
2325
2641
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2326
2642
|
|
|
2327
|
-
const
|
|
2643
|
+
const parseItem = __webpack_require__( 9179 );
|
|
2328
2644
|
|
|
2329
|
-
|
|
2330
|
-
if ( !( closure instanceof Function ) ) {
|
|
2331
|
-
throw new Error( 'Closure is not a function' );
|
|
2332
|
-
}
|
|
2645
|
+
module.exports = results => results.map( item => parseItem( item ) );
|
|
2333
2646
|
|
|
2334
|
-
try {
|
|
2335
|
-
return await closure();
|
|
2336
|
-
} catch ( error ) {
|
|
2337
|
-
// exhausted
|
|
2338
|
-
if ( execCount === limit ) { throw error; }
|
|
2339
2647
|
|
|
2340
|
-
|
|
2341
|
-
if ( retryHook instanceof Function ) {
|
|
2342
|
-
try {
|
|
2343
|
-
const retry = await retryHook( error, execCount );
|
|
2344
|
-
if ( retry === false ) { return false; }
|
|
2648
|
+
/***/ }),
|
|
2345
2649
|
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
console.debug( hookError );
|
|
2349
|
-
throw hookError;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2650
|
+
/***/ 9556:
|
|
2651
|
+
/***/ ((module) => {
|
|
2352
2652
|
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2653
|
+
"use strict";
|
|
2654
|
+
module.exports = require("@aws-sdk/client-sesv2");
|
|
2655
|
+
|
|
2656
|
+
/***/ }),
|
|
2657
|
+
|
|
2658
|
+
/***/ 9628:
|
|
2659
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2660
|
+
|
|
2661
|
+
const { PutCommand } = __webpack_require__( 3489 );
|
|
2662
|
+
|
|
2663
|
+
const parseArgs = args => {
|
|
2664
|
+
// native args mode
|
|
2665
|
+
if ( args[0] instanceof Object ) {
|
|
2666
|
+
return args[0];
|
|
2358
2667
|
}
|
|
2668
|
+
// sugar mode
|
|
2669
|
+
return {
|
|
2670
|
+
TableName: args[0],
|
|
2671
|
+
Item: args[1],
|
|
2672
|
+
ReturnValues: 'NONE',
|
|
2673
|
+
ReturnConsumedCapacity: 'NONE'
|
|
2674
|
+
};
|
|
2359
2675
|
};
|
|
2360
2676
|
|
|
2361
2677
|
/**
|
|
2362
2678
|
*
|
|
2363
|
-
* @param {
|
|
2364
|
-
* @param
|
|
2365
|
-
* @
|
|
2366
|
-
* @param {Number} delay The delay between each retry (it will be multiplied by the number of retries, so, it is linear back-off)
|
|
2367
|
-
* @param {Function} retryHook A function to be called every-time a retry is needed.
|
|
2368
|
-
* If this functions returns false, the retry error is raised
|
|
2369
|
-
* If this functions throws error, the thrown error is raised
|
|
2370
|
-
* @returns {Any} The closure result
|
|
2679
|
+
* @param {*} client
|
|
2680
|
+
* @param {...any} args The args. either one object with the native args or two string args, tableName and item.
|
|
2681
|
+
* @returns
|
|
2371
2682
|
*/
|
|
2372
|
-
module.exports = async (
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
/***/ 2445:
|
|
2379
|
-
/***/ ((module) => {
|
|
2380
|
-
|
|
2381
|
-
module.exports = t => new Promise( r => setTimeout( r, t ) );
|
|
2683
|
+
module.exports = async ( client, ...args ) => {
|
|
2684
|
+
const nativeArgs = parseArgs( args );
|
|
2685
|
+
const response = await client.send( new PutCommand( nativeArgs ) );
|
|
2686
|
+
return response.Attributes ?? nativeArgs.Item;
|
|
2687
|
+
};
|
|
2382
2688
|
|
|
2383
2689
|
|
|
2384
2690
|
/***/ }),
|
|
@@ -2431,155 +2737,45 @@ module.exports = class Timer {
|
|
|
2431
2737
|
|
|
2432
2738
|
/***/ }),
|
|
2433
2739
|
|
|
2434
|
-
/***/
|
|
2740
|
+
/***/ 9704:
|
|
2435
2741
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2436
2742
|
|
|
2437
|
-
const {
|
|
2438
|
-
|
|
2439
|
-
const firstIndexOf = ( c, ...vars ) => Math.min( ...vars.map( v => c.indexOf( v ) ).filter( n => n > -1 ) );
|
|
2440
|
-
const lastIndexOf = ( c, ...vars ) => Math.max( ...vars.map( v => c.lastIndexOf( v ) ) );
|
|
2441
|
-
|
|
2442
|
-
/**
|
|
2443
|
-
* Decompress JSON
|
|
2444
|
-
*
|
|
2445
|
-
* Reads a gzipped tarball (.tar.gz)
|
|
2446
|
-
* 1. Unzip it
|
|
2447
|
-
* 2. Convert all to utf-8
|
|
2448
|
-
* 3. Split files using the \0star separator
|
|
2449
|
-
* 4. Trim files until JSON markup start/end ({})
|
|
2450
|
-
* 5. JSON parse
|
|
2451
|
-
*
|
|
2452
|
-
* Enjoy this 100% native tarball decompression!
|
|
2453
|
-
*/
|
|
2454
|
-
module.exports = raw =>
|
|
2455
|
-
unzipSync( raw )
|
|
2456
|
-
.toString( 'utf-8' )
|
|
2457
|
-
.split( '\0ustar' )
|
|
2458
|
-
.slice( 1 )
|
|
2459
|
-
.map( c =>
|
|
2460
|
-
JSON.parse( c.substring( firstIndexOf( c, '{', '[' ), lastIndexOf( c, '}', ']' ) + 1 ) )
|
|
2461
|
-
);
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
/***/ }),
|
|
2465
|
-
|
|
2466
|
-
/***/ 3744:
|
|
2467
|
-
/***/ ((module) => {
|
|
2468
|
-
|
|
2469
|
-
"use strict";
|
|
2470
|
-
module.exports = require("@aws-sdk/client-athena");
|
|
2471
|
-
|
|
2472
|
-
/***/ }),
|
|
2473
|
-
|
|
2474
|
-
/***/ 4671:
|
|
2475
|
-
/***/ ((module) => {
|
|
2476
|
-
|
|
2477
|
-
"use strict";
|
|
2478
|
-
module.exports = require("@aws-sdk/client-dynamodb");
|
|
2479
|
-
|
|
2480
|
-
/***/ }),
|
|
2481
|
-
|
|
2482
|
-
/***/ 5892:
|
|
2483
|
-
/***/ ((module) => {
|
|
2484
|
-
|
|
2485
|
-
"use strict";
|
|
2486
|
-
module.exports = require("@aws-sdk/client-lambda");
|
|
2487
|
-
|
|
2488
|
-
/***/ }),
|
|
2489
|
-
|
|
2490
|
-
/***/ 5725:
|
|
2491
|
-
/***/ ((module) => {
|
|
2492
|
-
|
|
2493
|
-
"use strict";
|
|
2494
|
-
module.exports = require("@aws-sdk/client-s3");
|
|
2495
|
-
|
|
2496
|
-
/***/ }),
|
|
2497
|
-
|
|
2498
|
-
/***/ 9556:
|
|
2499
|
-
/***/ ((module) => {
|
|
2500
|
-
|
|
2501
|
-
"use strict";
|
|
2502
|
-
module.exports = require("@aws-sdk/client-sesv2");
|
|
2503
|
-
|
|
2504
|
-
/***/ }),
|
|
2505
|
-
|
|
2506
|
-
/***/ 7651:
|
|
2507
|
-
/***/ ((module) => {
|
|
2508
|
-
|
|
2509
|
-
"use strict";
|
|
2510
|
-
module.exports = require("@aws-sdk/client-sns");
|
|
2511
|
-
|
|
2512
|
-
/***/ }),
|
|
2513
|
-
|
|
2514
|
-
/***/ 1976:
|
|
2515
|
-
/***/ ((module) => {
|
|
2516
|
-
|
|
2517
|
-
"use strict";
|
|
2518
|
-
module.exports = require("@aws-sdk/client-sqs");
|
|
2519
|
-
|
|
2520
|
-
/***/ }),
|
|
2521
|
-
|
|
2522
|
-
/***/ 4348:
|
|
2523
|
-
/***/ ((module) => {
|
|
2524
|
-
|
|
2525
|
-
"use strict";
|
|
2526
|
-
module.exports = require("@aws-sdk/client-ssm");
|
|
2527
|
-
|
|
2528
|
-
/***/ }),
|
|
2529
|
-
|
|
2530
|
-
/***/ 1671:
|
|
2531
|
-
/***/ ((module) => {
|
|
2532
|
-
|
|
2533
|
-
"use strict";
|
|
2534
|
-
module.exports = require("@aws-sdk/client-timestream-query");
|
|
2535
|
-
|
|
2536
|
-
/***/ }),
|
|
2537
|
-
|
|
2538
|
-
/***/ 8248:
|
|
2539
|
-
/***/ ((module) => {
|
|
2540
|
-
|
|
2541
|
-
"use strict";
|
|
2542
|
-
module.exports = require("@aws-sdk/client-timestream-write");
|
|
2543
|
-
|
|
2544
|
-
/***/ }),
|
|
2545
|
-
|
|
2546
|
-
/***/ 3489:
|
|
2547
|
-
/***/ ((module) => {
|
|
2548
|
-
|
|
2549
|
-
"use strict";
|
|
2550
|
-
module.exports = require("@aws-sdk/lib-dynamodb");
|
|
2551
|
-
|
|
2552
|
-
/***/ }),
|
|
2553
|
-
|
|
2554
|
-
/***/ 4991:
|
|
2555
|
-
/***/ ((module) => {
|
|
2556
|
-
|
|
2557
|
-
"use strict";
|
|
2558
|
-
module.exports = require("@aws-sdk/s3-request-presigner");
|
|
2559
|
-
|
|
2560
|
-
/***/ }),
|
|
2743
|
+
const { PutObjectCommand } = __webpack_require__( 5725 );
|
|
2561
2744
|
|
|
2562
|
-
|
|
2563
|
-
|
|
2745
|
+
module.exports = ( client, bucket, key, body, nativeArgs ) =>
|
|
2746
|
+
client.send( new PutObjectCommand( {
|
|
2747
|
+
...nativeArgs,
|
|
2748
|
+
Bucket: bucket,
|
|
2749
|
+
Key: key,
|
|
2750
|
+
Body: typeof body === 'string' || Buffer.isBuffer( body ) ? body : JSON.stringify( body )
|
|
2751
|
+
} ) );
|
|
2564
2752
|
|
|
2565
|
-
"use strict";
|
|
2566
|
-
module.exports = require("crypto");
|
|
2567
2753
|
|
|
2568
2754
|
/***/ }),
|
|
2569
2755
|
|
|
2570
|
-
/***/
|
|
2756
|
+
/***/ 9760:
|
|
2571
2757
|
/***/ ((module) => {
|
|
2572
2758
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2759
|
+
module.exports = {
|
|
2760
|
+
ERROR_500: 'Internal Server Error',
|
|
2761
|
+
ERROR_405: 'Method Not Allowed',
|
|
2762
|
+
INVALID_ERROR_TYPE: 'Argument "errorType" must be a constructor Function',
|
|
2763
|
+
INVALID_FN: 'Argument "fn" must be of type function',
|
|
2764
|
+
INVALID_METHOD: 'Argument "method" must be one of the default HTTP methods',
|
|
2765
|
+
INVALID_STATUS_CODE: 'Argument "statusCode" must be valid HTTP Status Code',
|
|
2766
|
+
INVALID_TRANSFORM_REQUEST: 'Argument "transformRequest" must be either "camelize", "snakelize", false or null',
|
|
2767
|
+
INVALID_TRANSFORM_RESPONSE: 'Argument "transformResponse" must be either "camelize", "snakelize", false or null',
|
|
2768
|
+
INVALID_MATCHER_ROUTE: 'Argument "route" must be either undefined or an string with length greater than 0',
|
|
2769
|
+
INVALID_MATCHER_ROUTE_INCLUDES: 'Argument "routeIncludes" must be either undefined or an string with length greater than 0',
|
|
2770
|
+
INVALID_MATCHER_ROUTE_NOT_INCLUDES: 'Argument "routeNotIncludes" must be either undefined or an string with length greater than 0',
|
|
2771
|
+
INVALID_MATCHER_ROUTE_MATCH: 'Argument "routeMatch" must be either undefined or type RegExp',
|
|
2772
|
+
INVALID_MATCHER_PATH: 'Argument "path" must be either undefined or an string with length greater than 0',
|
|
2773
|
+
INVALID_MATCHER_PATH_INCLUDES: 'Argument "pathIncludes" must be either undefined or an string with length greater than 0',
|
|
2774
|
+
INVALID_MATCHER_PATH_NOT_INCLUDES: 'Argument "pathNotIncludes" must be either undefined or an string with length greater than 0',
|
|
2775
|
+
INVALID_MATCHER_PATH_MATCH: 'Argument "pathMatch" must be either undefined or type RegExp',
|
|
2776
|
+
INVALID_USER_RESPONSE: 'Function return must be a number, a string, an array (where p=0 is a number) or an object (where .statusCode is a number)'
|
|
2777
|
+
};
|
|
2580
2778
|
|
|
2581
|
-
"use strict";
|
|
2582
|
-
module.exports = require("zlib");
|
|
2583
2779
|
|
|
2584
2780
|
/***/ })
|
|
2585
2781
|
|