@yopdev/dev-server 3.0.3-beta.2 → 3.0.3-beta.3
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/src/dynamodb.js +3 -2
- package/package.json +1 -1
- package/src/dynamodb.ts +12 -8
package/dist/src/dynamodb.js
CHANGED
|
@@ -37,9 +37,10 @@ class DynamoDb {
|
|
|
37
37
|
.send(factory) //
|
|
38
38
|
.tap((table) => LOGGER.debug('created %s', (0, assert_1.assertNotUndefined)(table.TableDescription).TableName))
|
|
39
39
|
.catch((reason) => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (reason.name !== 'ResourceInUseException') {
|
|
41
|
+
LOGGER.error('failed to create table');
|
|
42
42
|
return Promise.reject(reason);
|
|
43
|
+
}
|
|
43
44
|
return { TableDescription: { TableName: factory.input.TableName } };
|
|
44
45
|
});
|
|
45
46
|
this.client = new client_dynamodb_1.DynamoDBClient(config);
|
package/package.json
CHANGED
package/src/dynamodb.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {CreateTableCommand, DynamoDBClient, UpdateTimeToLiveCommand} from "@aws-sdk/client-dynamodb";
|
|
2
|
+
import {AwsConfig, DevServerConfig} from "./config";
|
|
3
|
+
import {Logger, LoggerFactory} from "@yopdev/logging";
|
|
4
|
+
import {Lifecycle, Service, Callback} from "./services";
|
|
5
|
+
import {assertNotUndefined} from "./assert";
|
|
6
6
|
|
|
7
7
|
export const newDynamoDbTable = (
|
|
8
8
|
name: string,
|
|
@@ -15,6 +15,7 @@ export const newDynamoDbTable = (
|
|
|
15
15
|
|
|
16
16
|
class DynamoDbTableCreator implements Lifecycle<string> {
|
|
17
17
|
private LOGGER: Logger;
|
|
18
|
+
|
|
18
19
|
constructor(
|
|
19
20
|
readonly name: string,
|
|
20
21
|
private readonly command: CreateTableCommand,
|
|
@@ -44,6 +45,7 @@ class DynamoDbTableCreator implements Lifecycle<string> {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
const LOGGER = LoggerFactory.create('DYNAMODB');
|
|
48
|
+
|
|
47
49
|
export class DynamoDb {
|
|
48
50
|
readonly client: DynamoDBClient
|
|
49
51
|
|
|
@@ -55,8 +57,10 @@ export class DynamoDb {
|
|
|
55
57
|
.send(factory) //
|
|
56
58
|
.tap((table) => LOGGER.debug('created %s', assertNotUndefined(table.TableDescription).TableName))
|
|
57
59
|
.catch((reason) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
if (reason.name !== 'ResourceInUseException') {
|
|
61
|
+
LOGGER.error('failed to create table')
|
|
62
|
+
return Promise.reject(reason);
|
|
63
|
+
}
|
|
64
|
+
return {TableDescription: {TableName: factory.input.TableName}}
|
|
61
65
|
})
|
|
62
66
|
}
|