@ampt/data
Advanced tools
Comparing version 1.0.20 to 1.0.21
{ | ||
"name": "@ampt/data", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
@@ -32,2 +32,17 @@ export type getOptions = { | ||
export type setOptionsMeta = { | ||
ttl?: number | string | null | ||
overwrite?: boolean | ||
label1?: string | [string] | null | ||
label2?: string | [string] | null | ||
label3?: string | [string] | null | ||
label4?: string | [string] | null | ||
label5?: string | [string] | null | ||
default?: any | ||
created?: number | ||
removeNulls?: boolean | ||
exists?: boolean // true = don't overwrite if the item exists, false = don't write if the item doesn't exist | ||
meta: true | ||
} | ||
export interface scanOptions { | ||
@@ -114,3 +129,5 @@ meta?: boolean | ||
export type SetResponse<T> = KeyValue<T> | T | ||
export type SetResponse<T> = T | ||
export type SetResponseMeta<T> = KeyValueMeta<T> | ||
export type SetBatchResponse<T> = { items: KeyValue<T>[]; unprocessed?: KeyValue<T>[] } | ||
@@ -120,4 +137,13 @@ | ||
export enum Labels { | ||
Label1 = 'label1', | ||
Label2 = 'label2', | ||
Label3 = 'label3', | ||
Label4 = 'label4', | ||
Label5 = 'label5' | ||
} | ||
export type labels = 'label1' | 'label2' | 'label3' | 'label4' | 'label5' | ||
type LabelQuery = Labels | labels | ||
export type indexPk = `pk${string}` | ||
@@ -147,12 +173,12 @@ export type indexSk = `sk${string}` | ||
export declare interface Data { | ||
get<T>(keys: Query | string[], options?: getOptions): Promise<GetBatchResponse<T>> | ||
get<T>(keys: Query | string[], options: getOptionsMeta): Promise<GetBatchResponseMeta<T>> | ||
get<T>(keys: Query | string[], options: false): Promise<GetBatchResponse<T>> | ||
get<T>(keys: Query | string[], options: true): Promise<GetBatchResponseMeta<T>> | ||
get<T>(keys: string, options?: getOptions): Promise<GetResponse<T>> | ||
get<T>(keys: Query | string[], options: getOptionsMeta): Promise<GetBatchResponseMeta<T>> | ||
get<T>(keys: Query | string[], options?: getOptions): Promise<GetBatchResponse<T>> | ||
get<T>(keys: string, options: false): Promise<GetResponse<T>> | ||
get<T>(keys: string, options: true): Promise<GetResponseMeta<T>> | ||
get<T>(keys: string, options: getOptionsMeta): Promise<GetResponseMeta<T>> | ||
get<T>(keys: string, options: true): Promise<GetResponseMeta<T>> | ||
get<T>(keys: string, options?: getOptions): Promise<GetResponse<T>> | ||
getByLabel<T>( | ||
label: labels, | ||
label: LabelQuery, | ||
keys: Query | string[] | string, | ||
@@ -162,11 +188,14 @@ options?: getOptions | boolean | ||
getByLabel<T>( | ||
label: labels, | ||
label: LabelQuery, | ||
keys: Query | string[] | string, | ||
options: getOptionsMeta | ||
): Promise<GetBatchResponseMeta<T>> | ||
getByLabel<T>(label: labels, keys: Query | string[] | string, options: true): Promise<GetBatchResponseMeta<T>> | ||
getByLabel<T>(label: labels, keys: Query | string[] | string, options: false): Promise<GetBatchResponse<T>> | ||
getByLabel<T>(label: LabelQuery, keys: Query | string[] | string, options: true): Promise<GetBatchResponseMeta<T>> | ||
getByLabel<T>(label: LabelQuery, keys: Query | string[] | string, options: false): Promise<GetBatchResponse<T>> | ||
scan<T>(options: scanOptions | boolean): Promise<ScanResponse<T>> | ||
set<T>(keys: BatchSetItem<T>[], opts?: setBatchOptions | boolean): Promise<SetBatchResponse<T>> | ||
set<T>(keys: string, value: T | Partial<T>, opts?: setOptions | boolean): Promise<SetResponse<T>> | ||
set<T>(keys: string, value: T | Partial<T>, options: false): Promise<SetResponse<T>> | ||
set<T>(keys: string, value: T | Partial<T>, options: true): Promise<SetResponseMeta<T>> | ||
set<T>(keys: string, value: T | Partial<T>, options: setOptionsMeta): Promise<SetResponseMeta<T>> | ||
set<T>(keys: string, value: T | Partial<T>, options?: setOptions): Promise<SetResponse<T>> | ||
seed(data: any[] | string, options?: { overwrite?: boolean } | boolean): Promise<{ items: number }> | ||
@@ -173,0 +202,0 @@ remove(keys: string | string[]): Promise<boolean> |
1037351
27686