Socket
Socket
Sign inDemoInstall

@aws/dynamodb-batch-iterator

Package Overview
Dependencies
Maintainers
12
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws/dynamodb-batch-iterator - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

0

build/asyncIteratorSymbolPolyfill.js

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

2

build/BatchGet.d.ts

@@ -28,5 +28,5 @@ import { BatchGetOptions } from './BatchGetOptions';

*/
constructor(client: DynamoDB, items: SyncOrAsyncIterable<[string, AttributeMap]>, {ConsistentRead, PerTableOptions}?: BatchGetOptions);
constructor(client: DynamoDB, items: SyncOrAsyncIterable<[string, AttributeMap]>, { ConsistentRead, PerTableOptions, }?: BatchGetOptions);
protected doBatchRequest(): Promise<void>;
protected getInitialTableState(tableName: string): TableState<AttributeMap>;
}

@@ -35,3 +35,3 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var operationInput, batchSize, _a, tableName, item, _b, projection, consistentRead, attributeNames, _c, _d, Responses, _e, UnprocessedKeys, unprocessedTables, _f, _g, table, _h, _j, table, tableData, _k, _l, item, e_1, _m, e_2, _o, e_3, _p;
var e_1, _a, e_2, _b, e_3, _c, operationInput, batchSize, _d, tableName, item, _e, projection, consistentRead, attributeNames, _f, _g, Responses, _h, UnprocessedKeys, unprocessedTables, _j, _k, table, _l, _m, table, tableData, _o, _p, item;
return tslib_1.__generator(this, function (_q) {

@@ -43,5 +43,5 @@ switch (_q.label) {

while (this.toSend.length > 0) {
_a = tslib_1.__read(this.toSend.shift(), 2), tableName = _a[0], item = _a[1];
_d = tslib_1.__read(this.toSend.shift(), 2), tableName = _d[0], item = _d[1];
if (operationInput.RequestItems[tableName] === undefined) {
_b = this.state[tableName], projection = _b.projection, consistentRead = _b.consistentRead, attributeNames = _b.attributeNames;
_e = this.state[tableName], projection = _e.projection, consistentRead = _e.consistentRead, attributeNames = _e.attributeNames;
operationInput.RequestItems[tableName] = {

@@ -61,7 +61,7 @@ Keys: [],

case 1:
_c = _q.sent(), _d = _c.Responses, Responses = _d === void 0 ? {} : _d, _e = _c.UnprocessedKeys, UnprocessedKeys = _e === void 0 ? {} : _e;
_f = _q.sent(), _g = _f.Responses, Responses = _g === void 0 ? {} : _g, _h = _f.UnprocessedKeys, UnprocessedKeys = _h === void 0 ? {} : _h;
unprocessedTables = new Set();
try {
for (_f = tslib_1.__values(Object.keys(UnprocessedKeys)), _g = _f.next(); !_g.done; _g = _f.next()) {
table = _g.value;
for (_j = tslib_1.__values(Object.keys(UnprocessedKeys)), _k = _j.next(); !_k.done; _k = _j.next()) {
table = _k.value;
unprocessedTables.add(table);

@@ -74,3 +74,3 @@ this.handleThrottled(table, UnprocessedKeys[table].Keys);

try {
if (_g && !_g.done && (_m = _f.return)) _m.call(_f);
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
}

@@ -81,9 +81,9 @@ finally { if (e_1) throw e_1.error; }

try {
for (_h = tslib_1.__values(Object.keys(Responses)), _j = _h.next(); !_j.done; _j = _h.next()) {
table = _j.value;
for (_l = tslib_1.__values(Object.keys(Responses)), _m = _l.next(); !_m.done; _m = _l.next()) {
table = _m.value;
tableData = this.state[table];
tableData.backoffFactor = Math.max(0, tableData.backoffFactor - 1);
try {
for (_k = tslib_1.__values(Responses[table]), _l = _k.next(); !_l.done; _l = _k.next()) {
item = _l.value;
for (_o = tslib_1.__values(Responses[table]), _p = _o.next(); !_p.done; _p = _o.next()) {
item = _p.value;
this.pending.push([table, item]);

@@ -95,3 +95,3 @@ }

try {
if (_l && !_l.done && (_p = _k.return)) _p.call(_k);
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
}

@@ -105,3 +105,3 @@ finally { if (e_3) throw e_3.error; }

try {
if (_j && !_j.done && (_o = _h.return)) _o.call(_h);
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
}

@@ -108,0 +108,0 @@ finally { if (e_2) throw e_2.error; }

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

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

@@ -8,3 +8,3 @@ import { BatchState, SyncOrAsyncIterable, TableState, TableStateElement } from './types';

*/
protected readonly abstract batchSize: number;
protected abstract readonly batchSize: number;
/**

@@ -70,6 +70,6 @@ * Items that have been retrieved and are ready to be returned.

protected movePendingToThrottled(unprocessedTables: Set<string>): void;
private addToSendQueue([tableName, attributes]);
private enqueueThrottled(table);
private getNext();
private refillPending();
private addToSendQueue;
private enqueueThrottled;
private getNext;
private refillPending;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
require('./asyncIteratorSymbolPolyfill');
if (Symbol && !Symbol.asyncIterator) {
Symbol.asyncIterator = Symbol.for("__@@asyncIterator__");
}
var BatchOperation = /** @class */ (function () {

@@ -121,9 +123,9 @@ /**

BatchOperation.prototype.enqueueThrottled = function (table) {
var _a = table.tableThrottling, backoffWaiter = _a.backoffWaiter, unprocessed = _a.unprocessed;
var _a;
var _b = table.tableThrottling, backoffWaiter = _b.backoffWaiter, unprocessed = _b.unprocessed;
if (unprocessed.length > 0) {
(_b = this.toSend).push.apply(_b, tslib_1.__spread(unprocessed.map(function (attr) { return [table.name, attr]; })));
(_a = this.toSend).push.apply(_a, tslib_1.__spread(unprocessed.map(function (attr) { return [table.name, attr]; })));
}
this.throttled.delete(backoffWaiter);
delete table.tableThrottling;
var _b;
};

@@ -130,0 +132,0 @@ BatchOperation.prototype.getNext = function () {

@@ -0,0 +0,0 @@ import { BatchOperation } from './BatchOperation';

@@ -29,3 +29,3 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var inFlight, operationInput, batchSize, _a, tableName, marshalled, _b, UnprocessedItems, unprocessedTables, _c, _d, table, unprocessed, _e, _f, item, identifier, i, _g, tableName, attributes, processedTables, inFlight_1, inFlight_1_1, _h, tableName, marshalled, processedTables_1, processedTables_1_1, tableName, e_1, _j, e_2, _k, e_3, _l, e_4, _m;
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, inFlight, operationInput, batchSize, _e, tableName, marshalled, _f, UnprocessedItems, unprocessedTables, _g, _h, table, unprocessed, _j, _k, item, identifier, i, _l, tableName, attributes, processedTables, inFlight_1, inFlight_1_1, _m, tableName, marshalled, processedTables_1, processedTables_1_1, tableName;
return tslib_1.__generator(this, function (_o) {

@@ -38,3 +38,3 @@ switch (_o.label) {

while (this.toSend.length > 0) {
_a = tslib_1.__read(this.toSend.shift(), 2), tableName = _a[0], marshalled = _a[1];
_e = tslib_1.__read(this.toSend.shift(), 2), tableName = _e[0], marshalled = _e[1];
inFlight.push([tableName, marshalled]);

@@ -51,12 +51,12 @@ if (operationInput.RequestItems[tableName] === undefined) {

case 1:
_b = (_o.sent()).UnprocessedItems, UnprocessedItems = _b === void 0 ? {} : _b;
_f = (_o.sent()).UnprocessedItems, UnprocessedItems = _f === void 0 ? {} : _f;
unprocessedTables = new Set();
try {
for (_c = tslib_1.__values(Object.keys(UnprocessedItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
table = _d.value;
for (_g = tslib_1.__values(Object.keys(UnprocessedItems)), _h = _g.next(); !_h.done; _h = _g.next()) {
table = _h.value;
unprocessedTables.add(table);
unprocessed = [];
try {
for (_e = tslib_1.__values(UnprocessedItems[table]), _f = _e.next(); !_f.done; _f = _e.next()) {
item = _f.value;
for (_j = tslib_1.__values(UnprocessedItems[table]), _k = _j.next(); !_k.done; _k = _j.next()) {
item = _k.value;
if (item.DeleteRequest || item.PutRequest) {

@@ -66,3 +66,3 @@ unprocessed.push(item);

for (i = inFlight.length - 1; i >= 0; i--) {
_g = tslib_1.__read(inFlight[i], 2), tableName = _g[0], attributes = _g[1];
_l = tslib_1.__read(inFlight[i], 2), tableName = _l[0], attributes = _l[1];
if (tableName === table &&

@@ -79,3 +79,3 @@ itemIdentifier_1.itemIdentifier(tableName, attributes) === identifier) {

try {
if (_f && !_f.done && (_k = _e.return)) _k.call(_e);
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
}

@@ -90,3 +90,3 @@ finally { if (e_2) throw e_2.error; }

try {
if (_d && !_d.done && (_j = _c.return)) _j.call(_c);
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
}

@@ -99,3 +99,3 @@ finally { if (e_1) throw e_1.error; }

for (inFlight_1 = tslib_1.__values(inFlight), inFlight_1_1 = inFlight_1.next(); !inFlight_1_1.done; inFlight_1_1 = inFlight_1.next()) {
_h = tslib_1.__read(inFlight_1_1.value, 2), tableName = _h[0], marshalled = _h[1];
_m = tslib_1.__read(inFlight_1_1.value, 2), tableName = _m[0], marshalled = _m[1];
processedTables.add(tableName);

@@ -108,3 +108,3 @@ this.pending.push([tableName, marshalled]);

try {
if (inFlight_1_1 && !inFlight_1_1.done && (_l = inFlight_1.return)) _l.call(inFlight_1);
if (inFlight_1_1 && !inFlight_1_1.done && (_c = inFlight_1.return)) _c.call(inFlight_1);
}

@@ -123,3 +123,3 @@ finally { if (e_3) throw e_3.error; }

try {
if (processedTables_1_1 && !processedTables_1_1.done && (_m = processedTables_1.return)) _m.call(processedTables_1);
if (processedTables_1_1 && !processedTables_1_1.done && (_d = processedTables_1.return)) _d.call(processedTables_1);
}

@@ -126,0 +126,0 @@ finally { if (e_4) throw e_4.error; }

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

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

@@ -5,2 +5,2 @@ import { WriteRequest } from './types';

*/
export declare function itemIdentifier(tableName: string, {DeleteRequest, PutRequest}: WriteRequest): string;
export declare function itemIdentifier(tableName: string, { DeleteRequest, PutRequest }: WriteRequest): string;

@@ -20,6 +20,7 @@ "use strict";

function serializeKeyTypeAttributes(attributes) {
var e_1, _a;
var keyTypeProperties = [];
try {
for (var _a = tslib_1.__values(Object.keys(attributes).sort()), _b = _a.next(); !_b.done; _b = _a.next()) {
var property = _b.value;
for (var _b = tslib_1.__values(Object.keys(attributes).sort()), _c = _b.next(); !_c.done; _c = _b.next()) {
var property = _c.value;
var attribute = attributes[property];

@@ -40,3 +41,3 @@ if (attribute.B) {

try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -46,3 +47,2 @@ finally { if (e_1) throw e_1.error; }

return keyTypeProperties.join('&');
var e_1, _c;
}

@@ -49,0 +49,0 @@ function toByteArray(value) {

@@ -0,0 +0,0 @@ import { AttributeMap, ConsistentRead, DeleteRequest, ExpressionAttributeNameMap, ProjectionExpression, PutRequest, WriteRequest as DynamoDbWriteRequest } from "aws-sdk/clients/dynamodb";

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

@@ -0,0 +0,0 @@ # Changelog

{
"name": "@aws/dynamodb-batch-iterator",
"version": "0.5.0",
"version": "0.6.0",
"description": "Abstraction for DynamoDB batch reads and writes for that handles batch splitting and partial retries with exponential backoff",

@@ -31,6 +31,6 @@ "keywords": [

"devDependencies": {
"@types/jest": "^22",
"@types/jest": "^23",
"@types/node": "^8.0.4",
"aws-sdk": "^2.7.0",
"jest": "^22",
"jest": "^23",
"typedoc": "^0.11.0",

@@ -37,0 +37,0 @@ "typescript": "^2.7"

@@ -0,0 +0,0 @@ # Amazon DynamoDB Batch Iteration

@@ -0,0 +0,0 @@ {

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

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