Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xapp/dynamo-service

Package Overview
Dependencies
Maintainers
6
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xapp/dynamo-service - npm Package Compare versions

Comparing version 0.0.64 to 0.0.65

xapp-dynamo-service-0.0.64.tgz

8

dist/service/TableService.d.ts
import { ConditionExpression, DynamoService, QueryParams, QueryResult, ScanParams, ScanResult, UpdateBody, UpdateReturnType } from "./DynamoService";
import { KeySchema, TableSchema } from "./KeySchema";
export { DynamoService, ConditionExpression, KeySchema, QueryParams, QueryResult, ScanParams, ScanResult, TableSchema, UpdateBody, UpdateReturnType };
export declare const AWS_COLUMN_REGEX: RegExp;
export interface TableServiceProps {
trimUnknown?: boolean;
trimConstants?: boolean;
ignoreColumnsInGet?: RegExp;
}

@@ -46,2 +48,8 @@ export interface PutAllReturn<T> {

delete(key: Partial<T> | Partial<T>[]): Promise<void>;
private cleanseObjectOfIgnoredGetItems(obj);
private cleanseObjectOfIgnoredGetItems<P>(obj);
private cleanseIgnoredItemsOfDynamoObject(results);
private cleanseIgnoredItemsOfDynamoObject<P>(results);
private cleanseIgnoredItemsOfDynamoObject(results);
private cleanseIgnoredItemsOfDynamoObject<P>(results);
private convertObjectToPutObject(obj);

@@ -48,0 +56,0 @@ private convertObjFromDynamo(dynamoObj);

29

dist/service/TableService.js

@@ -9,2 +9,3 @@ "use strict";

const slugify = require("slugify");
exports.AWS_COLUMN_REGEX = /^aws:/;
function getConverter(schema) {

@@ -125,9 +126,15 @@ if (schema.type === "Date") {

get(key, projection) {
return this.db.get(this.tableName, key, projection).then(item => this.convertObjFromDynamo(item));
return this.db.get(this.tableName, key, projection)
.then(item => this.convertObjFromDynamo(item))
.then(item => this.cleanseObjectOfIgnoredGetItems(item));
}
query(params, projection) {
return this.db.query(this.tableName, params, projection).then(items => this.convertObjectsFromDynamo(items));
return this.db.query(this.tableName, params, projection)
.then(items => this.convertObjectsFromDynamo(items))
.then(items => this.cleanseIgnoredItemsOfDynamoObject(items));
}
scan(params, projection) {
return this.db.scan(this.tableName, params, projection).then(items => this.convertObjectsFromDynamo(items));
return this.db.scan(this.tableName, params, projection)
.then(items => this.convertObjectsFromDynamo(items))
.then(items => this.cleanseIgnoredItemsOfDynamoObject(items));
}

@@ -137,2 +144,18 @@ delete(key) {

}
cleanseObjectOfIgnoredGetItems(obj) {
const keys = Object.keys(obj);
const ignoredInGetKeys = (this.props.ignoreColumnsInGet) ? [this.props.ignoreColumnsInGet] : [];
for (let ignored of ignoredInGetKeys) {
for (let key of keys) {
if (ignored.test(key)) {
delete obj[key];
}
}
}
return obj;
}
cleanseIgnoredItemsOfDynamoObject(results) {
results.Items = results.Items.map(item => this.cleanseObjectOfIgnoredGetItems(item));
return results;
}
convertObjectToPutObject(obj) {

@@ -139,0 +162,0 @@ let putObj = slugifyKeys(this.slugKeys, obj);

2

dist/utils/Backoff.d.ts

@@ -5,3 +5,3 @@ export declare const DEFAULT_RETRY_ATTEMPTS = 5;

export declare function backoffObj<T>(obj: T): void;
export declare function backOffFunc<Return>(func: (...args: any[]) => Return | Promise<Return>): (...args: any[]) => Promise<Return>;
export declare function backOffFunc<Return>(func: (...args: any[]) => Return | Promise<Return>, props?: ExecuteProps): (...args: any[]) => Promise<Return>;
export interface ExecuteProps {

@@ -8,0 +8,0 @@ shouldRetry?(e: any): boolean;

@@ -24,5 +24,5 @@ "use strict";

exports.backoffObj = backoffObj;
function backOffFunc(func) {
function backOffFunc(func, props) {
return (...args) => {
return backOff(undefined, func, ...args);
return backOff(props, func, ...args);
};

@@ -29,0 +29,0 @@ }

{
"name": "@xapp/dynamo-service",
"version": "0.0.64",
"version": "0.0.65",
"description": "A dynamo help class which will help maintain data integrity.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc