@xapp/dynamo-service
Advanced tools
Comparing version 0.0.98 to 0.0.99
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"**/*.js.map": true | ||
}, | ||
"search.exclude": { | ||
"**/node_modules": true, | ||
"**/bower_components": true, | ||
"**/outputs": true, | ||
"**/.nyc_output": true, | ||
"**/api.yaml": true | ||
}, | ||
"files.trimTrailingWhitespace": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"tslint.enable": true, | ||
"tslint.autoFixOnSave": true, | ||
"cSpell.words": [ | ||
@@ -3,0 +19,0 @@ "dynoservice" |
import { DynamoDB } from "aws-sdk"; | ||
export declare const MAX_PUT_ALL_ATTEMPTS = 15; | ||
export declare type ConstructorDB = DynamoDB | DynamoDB.DocumentClient; | ||
@@ -51,3 +52,4 @@ export interface QueryResult<T> { | ||
put(TableName: string, obj: DynamoDB.DocumentClient.PutItemInputAttributeMap, condition: ConditionExpression): Promise<DynamoDB.DocumentClient.PutItemOutput>; | ||
put(TableName: string, obj: DynamoDB.DocumentClient.PutItemInputAttributeMap[], props?: PutAllServiceProps): Promise<DynamoDB.DocumentClient.PutItemInputAttributeMap[]>; | ||
put(TableName: string, obj: DynamoDB.DocumentClient.PutItemInputAttributeMap[]): Promise<DynamoDB.DocumentClient.PutItemInputAttributeMap[]>; | ||
put(TableName: string, obj: DynamoDB.DocumentClient.PutItemInputAttributeMap[], props: PutAllServiceProps): Promise<DynamoDB.DocumentClient.PutItemInputAttributeMap[]>; | ||
update<T>(table: string, key: DynamoDB.DocumentClient.Key, update: UpdateBody<T>): Promise<void>; | ||
@@ -54,0 +56,0 @@ update<T>(table: string, key: DynamoDB.DocumentClient.Key, update: UpdateBody<T>, condition: ConditionExpression): Promise<void>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const ValidationError_1 = require("./ValidationError"); | ||
const MAX_PUT_ALL_ATTEMPTS = 15; | ||
exports.MAX_PUT_ALL_ATTEMPTS = 15; | ||
class DynamoService { | ||
@@ -124,3 +124,3 @@ constructor(db) { | ||
const promises = []; | ||
const attempts = props.attempts || MAX_PUT_ALL_ATTEMPTS; | ||
const attempts = props.attempts || exports.MAX_PUT_ALL_ATTEMPTS; | ||
for (let i = 0; i < writeRequests.length; i += 25) { | ||
@@ -127,0 +127,0 @@ const sliced = writeRequests.slice(i, i + 25); |
@@ -89,11 +89,10 @@ "use strict"; | ||
return this.db.put(this.tableName, putObj, primaryExistsQuery.and(condition).query()) | ||
.then((res) => { return putObj; }); | ||
.then((res) => this.convertObjFromDynamo(putObj)); | ||
} | ||
putAll(obj) { | ||
const putObjs = obj.map((o) => this.validateAndConvertObjectToPutObject(o)); | ||
return this.db.put(this.tableName, putObjs).then(unprocessed => { | ||
return { | ||
unprocessed: unprocessed | ||
}; | ||
}); | ||
return this.db.put(this.tableName, putObjs, { attempts: DynamoService_1.MAX_PUT_ALL_ATTEMPTS }) | ||
.then((unprocessed) => ({ | ||
unprocessed: unprocessed.map((u) => this.convertObjFromDynamo(u)) | ||
})); | ||
} | ||
@@ -100,0 +99,0 @@ update(key, obj, conditionExpression, returnType) { |
{ | ||
"name": "@xapp/dynamo-service", | ||
"version": "0.0.98", | ||
"version": "0.0.99", | ||
"description": "A dynamo help class which will help maintain data integrity.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
146838
3918