Socket
Socket
Sign inDemoInstall

@aws/dynamodb-data-mapper

Package Overview
Dependencies
Maintainers
13
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws/dynamodb-data-mapper - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

0

build/asyncIteratorSymbolPolyfill.js

@@ -0,0 +0,0 @@ "use strict";

21

build/constants.d.ts

@@ -1,11 +0,10 @@

export declare const VERSION = "0.2.1";
export declare const ReadConsistencies: {
eventual: boolean;
strong: boolean;
};
export declare type ReadConsistency = keyof typeof ReadConsistencies;
export declare const OnMissingStrategies: {
remove: boolean;
skip: boolean;
};
export declare type OnMissingStrategy = keyof typeof OnMissingStrategies;
export declare const VERSION = "0.3.0";
export declare const MAX_WRITE_BATCH_SIZE = 25;
export declare const MAX_READ_BATCH_SIZE = 100;
export declare type OnMissingStrategy = 'remove' | 'skip';
export declare type ReadConsistency = 'eventual' | 'strong';
export interface StringToAnyObjectMap {
[key: string]: any;
}
export declare type SyncOrAsyncIterable<T> = Iterable<T> | AsyncIterable<T>;
export declare type WriteType = 'put' | 'delete';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = '0.2.1';
exports.ReadConsistencies = {
eventual: true,
strong: true,
};
exports.OnMissingStrategies = {
remove: true,
skip: true,
};
exports.VERSION = '0.3.0';
exports.MAX_WRITE_BATCH_SIZE = 25;
exports.MAX_READ_BATCH_SIZE = 100;
//# sourceMappingURL=constants.js.map

@@ -1,2 +0,3 @@

import { BaseScanOptions, DataMapperConfiguration, DeleteOptions, DeleteParameters, GetOptions, GetParameters, ParallelScanParameters, ParallelScanWorkerOptions, ParallelScanWorkerParameters, PutOptions, PutParameters, QueryOptions, QueryParameters, ScanOptions, ScanParameters, StringToAnyObjectMap, UpdateOptions, UpdateParameters } from './namedParameters';
import { StringToAnyObjectMap, SyncOrAsyncIterable, WriteType } from "./constants";
import { BaseScanOptions, BatchGetOptions, DataMapperConfiguration, DeleteOptions, DeleteParameters, GetOptions, GetParameters, ParallelScanParameters, ParallelScanWorkerOptions, ParallelScanWorkerParameters, PutOptions, PutParameters, QueryOptions, QueryParameters, ScanOptions, ScanParameters, UpdateOptions, UpdateParameters } from './namedParameters';
import { ZeroArgumentsConstructor } from "@aws/dynamodb-data-marshaller";

@@ -19,5 +20,63 @@ import { ConditionExpression, ConditionExpressionPredicate } from "@aws/dynamodb-expressions";

/**
* Deletes items from DynamoDB in batches of 25 or fewer via one or more
* BatchWriteItem operations. The items may be from any number of tables;
* tables and schemas for each item are determined using the
* {DynamoDbSchema} property and the {DynamoDbTable} property on defined on
* each item supplied.
*
* This method will automatically retry any delete requests returned by
* DynamoDB as unprocessed. Exponential backoff on unprocessed items is
* employed on a per-table basis.
*
* @param items A synchronous or asynchronous iterable of items to delete.
*/
batchDelete<T extends StringToAnyObjectMap>(items: SyncOrAsyncIterable<T>): AsyncIterableIterator<T>;
/**
* Retrieves items from DynamoDB in batches of 100 or fewer via one or more
* BatchGetItem operations. The items may be from any number of tables;
* tables and schemas for each item are determined using the
* {DynamoDbSchema} property and the {DynamoDbTable} property on defined on
* each item supplied.
*
* This method will automatically retry any get requests returned by
* DynamoDB as unprocessed. Exponential backoff on unprocessed items is
* employed on a per-table basis.
*
* @param items A synchronous or asynchronous iterable of items to get.
*/
batchGet<T extends StringToAnyObjectMap>(items: SyncOrAsyncIterable<T>, {readConsistency, perTableOptions}?: BatchGetOptions): AsyncIterableIterator<T>;
/**
* Puts items into DynamoDB in batches of 25 or fewer via one or more
* BatchWriteItem operations. The items may be from any number of tables;
* tables and schemas for each item are determined using the
* {DynamoDbSchema} property and the {DynamoDbTable} property on defined on
* each item supplied.
*
* This method will automatically retry any put requests returned by
* DynamoDB as unprocessed. Exponential backoff on unprocessed items is
* employed on a per-table basis.
*
* @param items A synchronous or asynchronous iterable of items to put.
*/
batchPut<T extends StringToAnyObjectMap>(items: SyncOrAsyncIterable<T>): AsyncIterableIterator<T>;
/**
* Puts or deletes items from DynamoDB in batches of 25 or fewer via one or
* more BatchWriteItem operations. The items may belong to any number of
* tables; tables and schemas for each item are determined using the
* {DynamoDbSchema} property and the {DynamoDbTable} property on defined on
* each item supplied.
*
* This method will automatically retry any write requests returned by
* DynamoDB as unprocessed. Exponential backoff on unprocessed items is
* employed on a per-table basis.
*
* @param items A synchronous or asynchronous iterable of tuples of the
* string 'put'|'delete' and the item on which to perform the specified
* write action.
*/
batchWrite<T extends StringToAnyObjectMap>(items: SyncOrAsyncIterable<[WriteType, T]>): AsyncIterableIterator<[WriteType, T]>;
/**
* Perform a DeleteItem operation using the schema accessible via the
* {DynamoDbSchema} method and the table name accessible via the
* {DynamoDbTable} method on the item supplied.
* {DynamoDbSchema} property and the table name accessible via the
* {DynamoDbTable} property on the item supplied.
*

@@ -135,2 +194,5 @@ * @param item The item to delete

private doSequentialScan<T>(req, schema, ctor);
private getTableName(item);
private mapGetBatch<T>(items, state, options, convertedOptions);
private mapWriteBatch<T>(items, state);
}

@@ -0,0 +0,0 @@ import { DocumentType, ZeroArgumentsConstructor } from '@aws/dynamodb-data-marshaller';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export * from './constants';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { GetItemInput } from "aws-sdk/clients/dynamodb";

@@ -0,0 +0,0 @@ "use strict";

import DynamoDB = require("aws-sdk/clients/dynamodb");
import { OnMissingStrategy, ReadConsistency } from "./constants";
import { ZeroArgumentsConstructor } from "@aws/dynamodb-data-marshaller";
import { OnMissingStrategy, ReadConsistency, StringToAnyObjectMap } from "./constants";
import { Schema, ZeroArgumentsConstructor } from "@aws/dynamodb-data-marshaller";
import { ConditionExpression, ConditionExpressionPredicate, ProjectionExpression } from "@aws/dynamodb-expressions";
export interface StringToAnyObjectMap {
[key: string]: any;
}
export interface DataMapperConfiguration {

@@ -29,2 +26,25 @@ /**

}
export interface BatchGetOptions extends ReadConsistencyConfiguration {
/**
* Options to apply to specific tables when performing a batch get operation
* that reads from multiple tables.
*/
perTableOptions?: {
[tableName: string]: BatchGetTableOptions;
};
}
export interface BatchGetTableOptions extends GetOptions {
/**
* The schema to use when mapping the supplied `projection` option to the
* attribute names used in DynamoDB.
*
* This parameter is only necessary if a batch contains items from multiple
* classes that map to the *same* table using *different* property names to
* represent the same DynamoDB attributes.
*
* If not supplied, the schema associated with the first item associated
* with a given table will be used in its place.
*/
projectionSchema?: Schema;
}
export interface DeleteOptions {

@@ -53,8 +73,4 @@ /**

}
export interface GetOptions {
export interface GetOptions extends ReadConsistencyConfiguration {
/**
* The read consistency to use when loading the requested item.
*/
readConsistency?: ReadConsistency;
/**
* The item attributes to get.

@@ -89,3 +105,3 @@ */

}
export interface QueryOptions {
export interface QueryOptions extends ReadConsistencyConfiguration {
/**

@@ -120,6 +136,2 @@ * A condition expression that DynamoDB applies after the Query operation,

/**
* The read consistency to use when loading the query results.
*/
readConsistency?: ReadConsistency;
/**
* Specifies the order for index traversal: If true, the traversal is

@@ -157,4 +169,10 @@ * performed in ascending order; if false, the traversal is performed in

}
export interface BaseScanOptions {
export interface ReadConsistencyConfiguration {
/**
* The read consistency to require when reading from DynamoDB.
*/
readConsistency?: ReadConsistency;
}
export interface BaseScanOptions extends ReadConsistencyConfiguration {
/**
* A string that contains conditions that DynamoDB applies after the Query

@@ -187,6 +205,2 @@ * operation, but before the data is returned to you. Items that do not

projection?: ProjectionExpression;
/**
* The read consistency to use when loading the query results.
*/
readConsistency?: ReadConsistency;
}

@@ -233,3 +247,3 @@ export interface CtorBearer<T extends StringToAnyObjectMap = StringToAnyObjectMap> {

}
export declare type ParallelScanWorkerParameters<T extends StringToAnyObjectMap = StringToAnyObjectMap> = ParallelScanWorkerOptions & CtorBearer;
export declare type ParallelScanWorkerParameters<T extends StringToAnyObjectMap = StringToAnyObjectMap> = ParallelScanWorkerOptions & CtorBearer<T>;
export declare type ParallelScanParameters<T extends StringToAnyObjectMap = StringToAnyObjectMap> = BaseScanOptions & CtorBearer<T> & {

@@ -236,0 +250,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=namedParameters.js.map

@@ -0,1 +1,2 @@

import { Schema } from '@aws/dynamodb-data-marshaller';
/**

@@ -31,2 +32,3 @@ * Table metadata is reported by items submitted to the data mapper via methods

export declare const DynamoDbSchema: symbol;
export declare function getSchema(item: any): Schema;
/**

@@ -52,2 +54,3 @@ * Used to designate that an object represents a row of the named DynamoDB

export declare const DynamoDbTable: symbol;
export declare function getTableName(item: any, tableNamePrefix?: string): string;
/**

@@ -54,0 +57,0 @@ * Used to designate which fields on an object have been changed. The method

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -16,3 +17,2 @@ * Table metadata is reported by items submitted to the data mapper via methods

*/
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -34,2 +34,13 @@ * Used to designate the mapping of an object from its JavaScript form to its

exports.DynamoDbSchema = Symbol('DynamoDbSchema');
function getSchema(item) {
if (item) {
var schema = item[exports.DynamoDbSchema];
if (schema && typeof schema === 'object') {
return schema;
}
}
throw new Error('The provided item did not adhere to the DynamoDbDocument protocol.' +
' No object property was found at the `DynamoDbSchema` symbol');
}
exports.getSchema = getSchema;
/**

@@ -55,2 +66,14 @@ * Used to designate that an object represents a row of the named DynamoDB

exports.DynamoDbTable = Symbol('DynamoDbTableName');
function getTableName(item, tableNamePrefix) {
if (tableNamePrefix === void 0) { tableNamePrefix = ''; }
if (item) {
var tableName = item[exports.DynamoDbTable];
if (typeof tableName === 'string') {
return tableNamePrefix + tableName;
}
}
throw new Error('The provided item did not adhere to the DynamoDbTable protocol. No' +
' string property was found at the `DynamoDbTable` symbol');
}
exports.getTableName = getTableName;
/**

@@ -57,0 +80,0 @@ * Used to designate which fields on an object have been changed. The method

@@ -7,2 +7,18 @@ # Changelog

## [Unreleased]
### Added
- Add `batchGet`, which allows a synchronous or asynchronous iterable of items
(like those supplied to `get`) to be automatically grouped into
`BatchGetItem` operations.
- Add `batchDelete`, which allows a synchronous or asynchronous iterable of
items (like those supplied to `delete`) to be automatically grouped into
`BatchWriteItem` operations.
- Add `batchPut`, which allows a synchronous or asynchronous iterable of
items (like those supplied to `put`) to be automatically grouped into
`BatchWriteItem` operations.
- Add `batchWrite`, which allows a synchronous or asynchronous iterable of
tuples of tags (`'put'` or `'delete'`) and items (like those supplied to the
`put` or `delete` methods, respectively) to be automatically grouped into
`BatchWriteItem` operations.
## [0.2.1]

@@ -9,0 +25,0 @@ ### Added

@@ -0,0 +0,0 @@ module.exports = {

{
"name": "@aws/dynamodb-data-mapper",
"version": "0.2.1",
"version": "0.3.0",
"description": "A schema-based data mapper for Amazon DynamoDB",

@@ -29,5 +29,6 @@ "main": "./build/index.js",

"dependencies": {
"@aws/dynamodb-data-marshaller": "^0.2.1",
"@aws/dynamodb-expressions": "^0.2.1",
"tslib": "^1.8"
"@aws/dynamodb-batch-iterator": "^0.3.0",
"@aws/dynamodb-data-marshaller": "^0.3.0",
"@aws/dynamodb-expressions": "^0.3.0",
"tslib": "^1.8.1"
},

@@ -34,0 +35,0 @@ "peerDependencies": {

@@ -0,0 +0,0 @@ # Amazon DynamoDB DataMapper

@@ -16,2 +16,3 @@ {

"module": "commonjs",
"noUnusedLocals": true,
"strict": true,

@@ -18,0 +19,0 @@ "declaration": true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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