@types/dynamodb
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -1,1 +0,1 @@ | ||
export type Callback = (err: any, result: any) => void; | ||
export type Callback<T> = (err: any, result: T) => void; |
@@ -5,9 +5,10 @@ import { Readable } from 'stream'; | ||
export interface PromisedReadable extends Readable { | ||
promise(): Promise<any>; | ||
export interface PromisedReadable<T> extends Readable { | ||
// DevNote: Promise function in dynamodb wraps results in an array | ||
promise(): Promise<T[]>; | ||
} | ||
export interface ExecuteFilter { | ||
(callback: Callback): void; | ||
(): PromisedReadable; | ||
export interface ExecuteFilter<T> { | ||
(callback: Callback<T>): void; | ||
(): PromisedReadable<T>; | ||
} |
@@ -1,2 +0,2 @@ | ||
// Type definitions for dynamodb 1.2 | ||
// Type definitions for dynamodb 1.3 | ||
// Project: https://github.com/baseprime/dynamodb#readme | ||
@@ -22,4 +22,4 @@ // Definitions by: katsanva <https://github.com/katsanva> | ||
(options?: CreateTablesOptions): Promise<any>; | ||
(options: CreateTablesOptions, callback: Callback): void; | ||
(callback: Callback): void; | ||
(options: CreateTablesOptions, callback: Callback<any>): void; | ||
(callback: Callback<any>): void; | ||
} | ||
@@ -35,3 +35,3 @@ | ||
export interface DefineConfig { | ||
export interface DefineConfig<T> { | ||
hashKey: string; | ||
@@ -54,4 +54,6 @@ rangeKey?: string; | ||
export function Set(data: ReadonlyArray<any>, type: string): DynamoDbSet; | ||
export function define(name: string, config: DefineConfig): typeof Model; | ||
export function model(name: string, model?: Model): typeof Model; | ||
export function define(name: string, config: DefineConfig<any>): Model<any>; | ||
export function define<T>(name: string, config: DefineConfig<T>): Model<T>; | ||
export function model(name: string, model?: Model<any>): Model<any>; | ||
export function model<T>(name: string, model?: Model<T>): Model<T>; | ||
export const createTables: CreateTables; | ||
@@ -58,0 +60,0 @@ export const types: { |
@@ -1,4 +0,3 @@ | ||
import { AnySchema } from 'joi'; | ||
import * as bunyan from 'bunyan'; | ||
import { GetItemInput, DynamoDB } from './DynamoDB'; | ||
import { DynamoDB } from './DynamoDB'; | ||
@@ -10,75 +9,77 @@ import { Callback } from './Callback'; | ||
export class Item extends EventEmitter { | ||
constructor(attrs: object, table: any); | ||
export class Item<T> extends EventEmitter { | ||
constructor(attrs: T, table: any); | ||
get(name: string): any; | ||
set(params: any): this; | ||
save(callback: Callback): void; | ||
save(): Promise<any>; | ||
update(options: any, callback: Callback): void; | ||
update(options: any): Promise<any>; | ||
destroy(options: any, callback: Callback): void; | ||
destroy(options: any): Promise<any>; | ||
toJSON(): object; | ||
save(callback: Callback<T>): void; | ||
save(): Promise<T>; | ||
update(options: any, callback: Callback<Item<T>>): void; | ||
update(options: any): Promise<Item<T>>; | ||
destroy(options: any, callback: Callback<Item<T>>): void; | ||
destroy(options: any): Promise<Item<T>>; | ||
toJSON(): T; | ||
} | ||
export class Model extends Item { | ||
constructor(attrs: any); | ||
export class Model<T> extends Item<T> implements Model<T> { | ||
constructor(attrs: T); | ||
} | ||
export namespace Model { | ||
const get: GetOperation; | ||
const create: CreateOperation; | ||
const update: UpdateOperation; | ||
const destroy: DestroyOperation; | ||
function query(hashKey: string): Query; | ||
function scan(): Scan; | ||
function parallelScan(totalSegments: number): ParallelScan; | ||
const getItems: GetItemsOperation; | ||
function batchGetItems( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
callback?: Callback, | ||
): Promise<any> | void; | ||
function createTable( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
callback?: Callback, | ||
): Promise<any> | void; | ||
function updateTable( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
callback?: Callback, | ||
): Promise<any> | void; | ||
function describeTable( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
callback?: Callback, | ||
): Promise<any> | void; | ||
function deleteTable(callback: Callback): void; | ||
function deleteTable(): Promise<any>; | ||
function tableName( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
callback: Callback, | ||
): void; | ||
function tableName( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: any, | ||
): Promise<any>; | ||
const itemFactory: typeof Model; | ||
const log: bunyan; | ||
const after: any; | ||
const before: any; | ||
function config(config: { dynamodb?: DynamoDB; tableName?: string }): any; | ||
export interface Model<T> { | ||
// tslint:disable-next-line:no-misused-new | ||
new (attrs: T): Model<T>; | ||
attrs: T; | ||
table: any; | ||
get(hashKey: string, rangeKey: string, options: object, callback: Callback<Model<T>>): void; | ||
get(data: object | string, options: object | string, callback: Callback<Model<T>>): void; | ||
get(data: object | string, callback: Callback<Model<T>>): void; | ||
get(hashKey: string, rangeKey: string, options: object): Promise<Model<T>>; | ||
get(hashKey: string, options?: object | string): Promise<Model<T>>; | ||
update(item: any, options: Model.OperationOptions, callback: Callback<Model<T>>): void; | ||
update(item: any, callback: Callback<Model<T>>): void; | ||
update(item: any, options?: Model.OperationOptions): Promise<Model<T>>; | ||
create(doc: T, params: Model.OperationOptions, callback: Callback<Model<T>>): void; | ||
create(doc: T, callback: Callback<Model<T>>): void; | ||
create(doc: T, params?: Model.OperationOptions): Promise<Model<T>>; | ||
create(doc: ReadonlyArray<T>, params: Model.OperationOptions, callback: Callback<Array<Model<T>>>): void; | ||
create(doc: ReadonlyArray<T>, callback: Callback<Array<Model<T>>>): void; | ||
create(doc: ReadonlyArray<T>, params?: Model.OperationOptions): Promise<Array<Model<T>>>; | ||
destroy(hashKey: string, rangeKey: string, options: Model.OperationOptions, callback: Callback<any>): void; | ||
destroy(hashKey: string, rangeKey: string, callback: Callback<any>): void; | ||
destroy(data: { [key: string]: any } | string, options: Model.OperationOptions, callback: Callback<any>): void; | ||
destroy(data: { [key: string]: any } | string, callback: Callback<any>): void; | ||
destroy(hashKey: string, rangeKey: string, options: Model.OperationOptions): Promise<any>; | ||
destroy(hashKey: string, options?: Model.OperationOptions | string): Promise<any>; | ||
getItems(keys: ReadonlyArray<any>, options: any, callback: Callback<Array<Model<T>>>): void; | ||
getItems(keys: ReadonlyArray<any>, callback: Callback<Array<Model<T>>>): void; | ||
getItems(keys: ReadonlyArray<any>, options?: any): Promise<Array<Model<T>>>; | ||
query(hashKey: string): Query<T>; | ||
scan(): Scan<T>; | ||
parallelScan(totalSegments: number): ParallelScan<T>; | ||
batchGetItems(hashKey: string, rangeKey: string, options: any, callback?: Callback<any>): Promise<any> | void; | ||
createTable(hashKey: string, rangeKey: string, options: any, callback?: Callback<any>): Promise<any> | void; | ||
updateTable(hashKey: string, rangeKey: string, options: any, callback?: Callback<any>): Promise<any> | void; | ||
describeTable(hashKey: string, rangeKey: string, options: any, callback?: Callback<any>): Promise<any> | void; | ||
deleteTable(callback: Callback<any>): void; | ||
deleteTable(): Promise<any>; | ||
tableName(hashKey: string, rangeKey: string, options: any, callback: Callback<any>): void; | ||
tableName(hashKey: string, rangeKey: string, options: any): Promise<any>; | ||
itemFactory: Model<T>; | ||
log: bunyan; | ||
after: any; | ||
before: any; | ||
config(config: { dynamodb?: DynamoDB; tableName?: string }): any; | ||
} | ||
interface OperationResult { | ||
get(name: string): any; | ||
} | ||
export interface Page<T> { | ||
Items: Array<Model<T>>; | ||
Count: number; | ||
ScannedCount?: number; | ||
LastEvaluatedKey?: any; | ||
ConsumedCapacity?: { | ||
CapacityUnits: number; | ||
TableName: string; | ||
}; | ||
} | ||
export namespace Model { | ||
interface OperationOptions { | ||
@@ -93,57 +94,2 @@ UpdateExpression?: any; | ||
} | ||
interface UpdateOperation { | ||
(item: any, options: OperationOptions, callback: Callback): void; | ||
(item: any, callback: Callback): void; | ||
(item: any, options?: OperationOptions): Promise<any>; | ||
} | ||
interface GetOperation { | ||
( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: object, | ||
callback: Callback, | ||
): void; | ||
( | ||
data: object | string, | ||
options: object | string, | ||
callback: Callback, | ||
): void; | ||
(data: object | string, callback: Callback): void; | ||
(hashKey: string, rangeKey: string, options: object): Promise<any>; | ||
(hashKey: string, options?: object | string): Promise<any>; | ||
} | ||
interface CreateOperation { | ||
(doc: any, params: OperationOptions, callback: Callback): void; | ||
(doc: any, callback: Callback): void; | ||
(doc: any, params?: OperationOptions): Promise<any>; | ||
} | ||
interface DestroyOperation { | ||
( | ||
hashKey: string, | ||
rangeKey: string, | ||
options: OperationOptions, | ||
callback: Callback, | ||
): void; | ||
(hashKey: string, rangeKey: string, callback: Callback): void; | ||
( | ||
data: { [key: string]: any } | string, | ||
options: OperationOptions, | ||
callback: Callback, | ||
): void; | ||
(data: { [key: string]: any } | string, callback: Callback): void; | ||
(hashKey: string, rangeKey: string, options: OperationOptions): Promise< | ||
any | ||
>; | ||
(hashKey: string, options?: OperationOptions | string): Promise<any>; | ||
} | ||
interface GetItemsOperation { | ||
(keys: ReadonlyArray<any>, options: any, callback: Callback): void; | ||
(keys: ReadonlyArray<any>, callback: Callback): void; | ||
(keys: ReadonlyArray<any>, options?: any): Promise<any>; | ||
} | ||
} |
{ | ||
"name": "@types/dynamodb", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "TypeScript definitions for dynamodb", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dynamodb", | ||
"license": "MIT", | ||
@@ -25,4 +26,4 @@ "contributors": [ | ||
}, | ||
"typesPublisherContentHash": "188a5c247571733a41bd1fcf81edfd4cf1cac4eff92085274d80ad9bf3bb971c", | ||
"typeScriptVersion": "3.5" | ||
"typesPublisherContentHash": "473fbbd57a75330604d3c441fd37c758cd3ca7f1366be81669df1bd1e31c9d49", | ||
"typeScriptVersion": "3.6" | ||
} |
import { ExecuteFilter } from './ExecuteFilter'; | ||
import { Page } from './Model'; | ||
export interface Query { | ||
export interface Query<T> { | ||
(hashKey: string, table: any, serializer: any): void; | ||
limit(num: number): Query; | ||
filterExpression(expression: any): Query; | ||
expressionAttributeValues(data: any): Query; | ||
expressionAttributeNames(data: any): Query; | ||
projectionExpression(data: any): Query; | ||
usingIndex(name: string): Query; | ||
consistentRead(read: boolean): Query; | ||
limit(num: number): Query<T>; | ||
filterExpression(expression: any): Query<T>; | ||
expressionAttributeValues(data: any): Query<T>; | ||
expressionAttributeNames(data: any): Query<T>; | ||
projectionExpression(data: any): Query<T>; | ||
usingIndex(name: string): Query<T>; | ||
consistentRead(read: boolean): Query<T>; | ||
addKeyCondition(condition: { | ||
attributeNames: any; | ||
attributeValues: any; | ||
}): Query; | ||
}): Query<T>; | ||
addFilterCondition(condition: { | ||
attributeNames: any; | ||
attributeValues: any; | ||
}): Query; | ||
startKey(hashKey: string, rangeKey: string): Query; | ||
attributes(attrs: ReadonlyArray<string> | string): Query; | ||
ascending(): Query; | ||
descending(): Query; | ||
select(value: string): Query; | ||
returnConsumedCapacity(value?: string): Query; | ||
loadAll(): Query; | ||
where(keyName: string): Query; | ||
contains(name: string): Query; | ||
notContains(name: string): Query; | ||
filter(keyName: string): Query; | ||
exec: ExecuteFilter; | ||
}): Query<T>; | ||
startKey(hashKey: string, rangeKey: string): Query<T>; | ||
attributes(attrs: ReadonlyArray<string> | string): Query<T>; | ||
ascending(): Query<T>; | ||
descending(): Query<T>; | ||
select(value: string): Query<T>; | ||
returnConsumedCapacity(value?: string): Query<T>; | ||
loadAll(): Query<T>; | ||
where(keyName: string): Query<T>; | ||
contains(name: string): Query<T>; | ||
notContains(name: string): Query<T>; | ||
filter(keyName: string): Query<T>; | ||
exec: ExecuteFilter<Page<T>>; | ||
buildKey(): string; | ||
buildRequest(): any; | ||
equals: (...args: any[]) => Query; | ||
eq: (...args: any[]) => Query; | ||
lte: (...args: any[]) => Query; | ||
lt: (...args: any[]) => Query; | ||
gte: (...args: any[]) => Query; | ||
gt: (...args: any[]) => Query; | ||
beginsWith: (...args: any[]) => Query; | ||
between: (...args: any[]) => Query; | ||
equals: (...args: any[]) => Query<T>; | ||
eq: (...args: any[]) => Query<T>; | ||
lte: (...args: any[]) => Query<T>; | ||
lt: (...args: any[]) => Query<T>; | ||
gte: (...args: any[]) => Query<T>; | ||
gt: (...args: any[]) => Query<T>; | ||
beginsWith: (...args: any[]) => Query<T>; | ||
between: (...args: any[]) => Query<T>; | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Fri, 12 Mar 2021 08:07:13 GMT | ||
* Last updated: Tue, 01 Jun 2021 20:31:59 GMT | ||
* Dependencies: [@types/joi](https://npmjs.com/package/@types/joi), [@types/bunyan](https://npmjs.com/package/@types/bunyan) | ||
@@ -14,0 +14,0 @@ * Global values: none |
import { ExecuteFilter } from './ExecuteFilter'; | ||
import { Page } from './Model'; | ||
export interface Scan { | ||
limit(num: number): Scan; | ||
export interface Scan<T> { | ||
limit(num: number): Scan<T>; | ||
addFilterCondition(condition: { | ||
attributeNames: any; | ||
attributeValues: any; | ||
}): Scan; | ||
startKey(hashKey: string, rangeKey?: string): Scan; | ||
attributes(attrs: ReadonlyArray<string> | string): Scan; | ||
select(value: string): Scan; | ||
returnConsumedCapacity(value?: string): Scan; | ||
segments(segment: any, totalSegments: any): Scan; | ||
where(keyName: string): Scan; | ||
filterExpression(expression: any): Scan; | ||
expressionAttributeValues(data: any): Scan; | ||
expressionAttributeNames(data: any): Scan; | ||
projectionExpression(data: any): Scan; | ||
loadAll(): Scan; | ||
notNull(): Scan; | ||
null(): Scan; | ||
contains(name: string): Scan; | ||
beginsWith(name: string): Scan; | ||
between(start: string, end: string): Scan; | ||
notContains(name: string): Scan; | ||
equals: (...args: any[]) => Scan; | ||
in: (...args: any[]) => Scan; | ||
ne: (...args: any[]) => Scan; | ||
eq: (...args: any[]) => Scan; | ||
lte: (...args: any[]) => Scan; | ||
lt: (...args: any[]) => Scan; | ||
gte: (...args: any[]) => Scan; | ||
gt: (...args: any[]) => Scan; | ||
exec: ExecuteFilter; | ||
}): Scan<T>; | ||
startKey(hashKey: string, rangeKey?: string): Scan<T>; | ||
attributes(attrs: ReadonlyArray<string> | string): Scan<T>; | ||
select(value: string): Scan<T>; | ||
returnConsumedCapacity(value?: string): Scan<T>; | ||
segments(segment: any, totalSegments: any): Scan<T>; | ||
where(keyName: string): Scan<T>; | ||
filterExpression(expression: any): Scan<T>; | ||
expressionAttributeValues(data: any): Scan<T>; | ||
expressionAttributeNames(data: any): Scan<T>; | ||
projectionExpression(data: any): Scan<T>; | ||
loadAll(): Scan<T>; | ||
notNull(): Scan<T>; | ||
null(): Scan<T>; | ||
contains(name: string): Scan<T>; | ||
beginsWith(name: string): Scan<T>; | ||
between(start: string, end: string): Scan<T>; | ||
notContains(name: string): Scan<T>; | ||
equals: (...args: any[]) => Scan<T>; | ||
in: (...args: any[]) => Scan<T>; | ||
ne: (...args: any[]) => Scan<T>; | ||
eq: (...args: any[]) => Scan<T>; | ||
lte: (...args: any[]) => Scan<T>; | ||
lt: (...args: any[]) => Scan<T>; | ||
gte: (...args: any[]) => Scan<T>; | ||
gt: (...args: any[]) => Scan<T>; | ||
exec: ExecuteFilter<Page<T>>; | ||
buildRequest(): any; | ||
} | ||
export type ParallelScan = Scan; | ||
export type ParallelScan<T> = Scan<T>; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13556
0
283
1