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

@jupiterone/dynamodb-dao

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupiterone/dynamodb-dao - npm Package Compare versions

Comparing version 1.5.2 to 1.6.0

constants.d.ts

102

index.d.ts
import { DocumentClient } from 'aws-sdk/clients/dynamodb';
declare type AttributeNames = Record<string, string>;
declare type AttributeValues = Record<string, any>;
interface BaseScanInput {
index?: string;
limit?: number;
startAt?: string;
filterExpression?: string;
attributeNames?: AttributeNames;
attributeValues?: AttributeValues;
consistentRead?: boolean;
}
export interface ScanInput extends BaseScanInput {
segment?: number;
totalSegments?: number;
}
export interface CountOutput {
count?: number;
scannedCount?: number;
lastKey?: string;
}
export interface QueryInput extends BaseScanInput {
scanIndexForward?: boolean;
keyConditionExpression: string;
attributeValues: AttributeValues;
consistentRead?: boolean;
}
export interface QueryInputWithLimit extends QueryInput {
limit: number;
}
export interface QueryResult<T> {
items: T[];
lastKey?: string;
}
export interface BatchPutOperation<DataModel> {
put: DataModel;
}
export interface BatchDeleteOperation<KeySchema> {
delete: KeySchema;
}
export declare type BatchWriteOperation<DataModel, KeySchema> = BatchPutOperation<DataModel> | BatchDeleteOperation<KeySchema>;
export interface BatchWriteResult<DataModel, KeySchema> {
unprocessedItems?: BatchWriteOperation<DataModel, KeySchema>[];
}
export interface BatchGetResult<DataModel, KeySchema> {
items: DataModel[];
unprocessedKeys?: KeySchema[];
}
export interface BatchPutParams<T, U> {
batch: T[];
logger: any;
}
interface GetItemOptions {
consistentRead?: boolean;
}
interface BaseBatchWriteWithExponentialBackoffParams<T, U> {
logger: any;
delay?: number;
attempts?: number;
maxRetries?: number;
batchWriteLimit?: number;
}
interface BatchWriteWithExponentialBackoffParams<T, U> extends BaseBatchWriteWithExponentialBackoffParams<T, U> {
items: T[];
}
export declare const DEFAULT_QUERY_LIMIT = 50;
export declare const MAX_BATCH_OPERATIONS = 25;
/**
* encode start key into a base64 encoded string
* that can be used for pagination
*/
export declare function encodeExclusiveStartKey<KeySchema>(obj: KeySchema): string;
/**
* Decode the key the start key
*/
export declare function decodeExclusiveStartKey<KeySchema>(token: string): KeySchema;
export declare function isBatchPutOperation<DataModel, KeySchema>(operation: BatchWriteOperation<DataModel, KeySchema>): operation is BatchPutOperation<DataModel>;
import { AttributeNames, AttributeValues, BatchGetResult, BatchWriteOperation, BatchWriteResult, BatchWriteWithExponentialBackoffParams, CountOutput, GetItemOptions, QueryInput, QueryInputWithLimit, QueryResult, ScanInput } from './types';
export * from './constants';
export * from './types';
export interface ConditionalOptions {

@@ -83,6 +10,2 @@ conditionExpression?: string;

}
export interface SaveBehavior {
optimisticLockVersionAttribute?: string;
optimisticLockVersionIncrement?: number;
}
export interface MutateBehavior {

@@ -94,13 +17,2 @@ ignoreOptimisticLocking?: boolean;

export declare type DeleteOptions = ConditionalOptions & MutateBehavior;
export interface BuildOptimisticLockOptionsInput extends ConditionalOptions {
versionAttribute: string;
versionAttributeValue: any;
}
export declare function buildOptimisticLockOptions(options: BuildOptimisticLockOptionsInput): ConditionalOptions;
export interface GenerateUpdateParamsInput extends UpdateOptions {
tableName: string;
key: any;
data: object;
}
export declare function generateUpdateParams(options: GenerateUpdateParamsInput & SaveBehavior): DocumentClient.UpdateItemInput;
export interface DynamoDbDaoInput<T> {

@@ -110,8 +22,4 @@ tableName: string;

optimisticLockingAttribute?: keyof NumberPropertiesInType<T>;
autoInitiateLockingAttribute?: boolean;
}
export declare function encodeQueryUntilLimitCursor(lastKey: string | undefined, skip: number | undefined): string;
export declare function decodeQueryUntilLimitCursor(cursor: string | undefined): {
skip: number;
lastKey: string | undefined;
};
/**

@@ -133,2 +41,3 @@ * This type is used to force functions like `incr` and `decr` to only take

readonly optimisticLockingAttribute?: keyof NumberPropertiesInType<DataModel>;
readonly autoInitiateLockingAttribute?: boolean;
constructor(options: DynamoDbDaoInput<DataModel>);

@@ -171,2 +80,1 @@ /**

}
export {};
{
"name": "@jupiterone/dynamodb-dao",
"version": "1.5.2",
"version": "1.6.0",
"description": "DynamoDB Data Access Object (DAO) helper library",

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

@@ -156,7 +156,14 @@ # dynamodb-dao

```
```typescript
const dao = new DynamoDbDao<DataModel, KeySchema>({
tableName,
documentClient,
optimisticLockingAttribute: 'version',
{
optimisticLockingAttribute: 'version',
// If true, the first put or update will create and initialize
// the 'version' attribute, otherwise it will not create it
// This allows adopters to choose to adopt at the item level
// or at the dao level
autoInitiateLockingAttribute: true, // default: true
}
});

@@ -199,1 +206,24 @@ ```

```
## Releasing
Once you are ready to publish a new version, make sure all of your changes have
been pushed and merged to the remote repository.
Next, create a new branch and run the following command:
```
yarn version --minor (or --major or --patch)
```
This will add a commit with an updated `package.json`, and create a new tag
locally.
Then, push your branch and new tag to the remote.
```
git push && git push --tags
```
Create a pull request with the branch. Once that is merged, your new version
will be published.

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

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