@jupiterone/dynamodb-dao
Advanced tools
Comparing version 1.1.0 to 1.2.0
import { DocumentClient } from 'aws-sdk/clients/dynamodb'; | ||
declare type AttributeNames = Record<string, string>; | ||
declare type AttributeValues = Record<string, any>; | ||
export interface ScanInput { | ||
interface BaseScanInput { | ||
index?: string; | ||
@@ -12,2 +12,6 @@ limit?: number; | ||
} | ||
export interface ScanInput extends BaseScanInput { | ||
segment?: number; | ||
totalSegments?: number; | ||
} | ||
export interface CountOutput { | ||
@@ -18,3 +22,3 @@ count?: number; | ||
} | ||
export interface QueryInput extends ScanInput { | ||
export interface QueryInput extends BaseScanInput { | ||
scanIndexForward?: boolean; | ||
@@ -78,3 +82,3 @@ keyConditionExpression: string; | ||
skip: number; | ||
lastKey: string; | ||
lastKey: string | undefined; | ||
}; | ||
@@ -81,0 +85,0 @@ /** |
10
index.js
@@ -321,3 +321,9 @@ "use strict"; | ||
async scan(input = {}) { | ||
const { index, startAt, attributeNames, attributeValues, filterExpression, limit = exports.DEFAULT_QUERY_LIMIT, } = input; | ||
const { index, startAt, attributeNames, attributeValues, filterExpression, segment, totalSegments, limit = exports.DEFAULT_QUERY_LIMIT, } = input; | ||
if (segment !== undefined && totalSegments === undefined) { | ||
throw new Error('If segment is defined, totalSegments must also be defined.'); | ||
} | ||
if (segment === undefined && totalSegments !== undefined) { | ||
throw new Error('If totalSegments is defined, segment must also be defined.'); | ||
} | ||
let startKey; | ||
@@ -336,2 +342,4 @@ if (startAt) { | ||
ExpressionAttributeValues: attributeValues, | ||
Segment: segment, | ||
TotalSegments: totalSegments, | ||
}) | ||
@@ -338,0 +346,0 @@ .promise(); |
{ | ||
"name": "@jupiterone/dynamodb-dao", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "DynamoDB Data Access Object (DAO) helper library", | ||
@@ -5,0 +5,0 @@ "main": "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
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
26111
552