@lafken/dynamo 0.12.6 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/service/cache/in-memory-cache.d.ts +6 -0
- package/lib/service/cache/in-memory-cache.js +29 -0
- package/lib/service/query-builder/batch-get/batch-get.d.ts +15 -0
- package/lib/service/query-builder/batch-get/batch-get.js +62 -0
- package/lib/service/query-builder/batch-get/batch-get.types.d.ts +13 -0
- package/lib/service/query-builder/batch-get/batch-get.types.js +2 -0
- package/lib/service/query-builder/find-all/find-all.d.ts +3 -3
- package/lib/service/query-builder/find-all/find-all.js +7 -1
- package/lib/service/query-builder/find-all/find-all.types.d.ts +7 -0
- package/lib/service/query-builder/find-all/find-all.types.js +2 -0
- package/lib/service/query-builder/find-one/find-one.d.ts +3 -3
- package/lib/service/query-builder/find-one/find-one.js +10 -2
- package/lib/service/query-builder/find-one/find-one.types.d.ts +7 -0
- package/lib/service/query-builder/find-one/find-one.types.js +2 -0
- package/lib/service/query-builder/get-item/get-item.d.ts +13 -0
- package/lib/service/query-builder/get-item/get-item.js +45 -0
- package/lib/service/query-builder/get-item/get-item.types.d.ts +15 -0
- package/lib/service/query-builder/get-item/get-item.types.js +2 -0
- package/lib/service/repository/repository.js +25 -2
- package/lib/service/repository/repository.types.d.ts +8 -2
- package/package.json +4 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryCache = void 0;
|
|
4
|
+
class InMemoryCache {
|
|
5
|
+
store = new Map();
|
|
6
|
+
get(key) {
|
|
7
|
+
const entry = this.store.get(key);
|
|
8
|
+
if (!entry)
|
|
9
|
+
return undefined;
|
|
10
|
+
if (Date.now() > entry.expiry) {
|
|
11
|
+
this.store.delete(key);
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return entry.value;
|
|
15
|
+
}
|
|
16
|
+
set(key, value, ttlSeconds) {
|
|
17
|
+
this.store.set(key, { value, expiry: Date.now() + ttlSeconds * 1000 });
|
|
18
|
+
}
|
|
19
|
+
async getOrSet(key, fetcher, ttlSeconds) {
|
|
20
|
+
const cached = this.get(key);
|
|
21
|
+
if (cached !== undefined)
|
|
22
|
+
return cached;
|
|
23
|
+
const value = await fetcher();
|
|
24
|
+
if (value !== undefined)
|
|
25
|
+
this.set(key, value, ttlSeconds);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.InMemoryCache = InMemoryCache;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type BatchGetItemCommandInput } from '@aws-sdk/client-dynamodb';
|
|
2
|
+
import type { ClassResource } from '@lafken/common';
|
|
3
|
+
import { QueryBuilderBase } from '../base/base';
|
|
4
|
+
import type { BatchGetBuilderProps } from './batch-get.types';
|
|
5
|
+
export declare class BatchGetBuilder<E extends ClassResource> extends QueryBuilderBase<E> {
|
|
6
|
+
private queryOptions;
|
|
7
|
+
private commands;
|
|
8
|
+
constructor(queryOptions: BatchGetBuilderProps<E>);
|
|
9
|
+
getCommand(): BatchGetItemCommandInput[];
|
|
10
|
+
then<T>(resolve: (value: InstanceType<E>[]) => T, reject: (reason: any) => T): Promise<T>;
|
|
11
|
+
private exec;
|
|
12
|
+
private execAndRetry;
|
|
13
|
+
protected prepare(): void;
|
|
14
|
+
private chunkKeys;
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BatchGetBuilder = void 0;
|
|
4
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
5
|
+
const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
|
|
6
|
+
const base_1 = require("../base/base");
|
|
7
|
+
class BatchGetBuilder extends base_1.QueryBuilderBase {
|
|
8
|
+
queryOptions;
|
|
9
|
+
commands = [];
|
|
10
|
+
constructor(queryOptions) {
|
|
11
|
+
super(queryOptions);
|
|
12
|
+
this.queryOptions = queryOptions;
|
|
13
|
+
this.prepare();
|
|
14
|
+
}
|
|
15
|
+
getCommand() {
|
|
16
|
+
return this.commands;
|
|
17
|
+
}
|
|
18
|
+
then(resolve, reject) {
|
|
19
|
+
return this.exec().then(resolve, reject);
|
|
20
|
+
}
|
|
21
|
+
async exec() {
|
|
22
|
+
const results = await Promise.all(this.commands.map((command) => this.execAndRetry(command)));
|
|
23
|
+
return results.flat();
|
|
24
|
+
}
|
|
25
|
+
async execAndRetry(inputCommand, items = [], attempt = 0) {
|
|
26
|
+
const command = new client_dynamodb_1.BatchGetItemCommand(inputCommand);
|
|
27
|
+
const { Responses = {}, UnprocessedKeys = {} } = await this.queryOptions.client.send(command);
|
|
28
|
+
const batchItems = (Responses[this.queryOptions.modelProps.name] ?? []).map((item) => (0, util_dynamodb_1.unmarshall)(item));
|
|
29
|
+
const allItems = items.concat(batchItems);
|
|
30
|
+
if (Object.keys(UnprocessedKeys).length > 0) {
|
|
31
|
+
if (attempt === (this.queryOptions.options?.maxAttempt ?? 5)) {
|
|
32
|
+
throw new Error('Failed to process all keys after maximum retries');
|
|
33
|
+
}
|
|
34
|
+
return this.execAndRetry({ RequestItems: UnprocessedKeys }, allItems, attempt + 1);
|
|
35
|
+
}
|
|
36
|
+
return allItems;
|
|
37
|
+
}
|
|
38
|
+
prepare() {
|
|
39
|
+
const { consistentRead, projection } = this.queryOptions.options ?? {};
|
|
40
|
+
const projectionExpression = projection && projection !== 'ALL' ? projection.join(', ') : undefined;
|
|
41
|
+
const chunkedKeys = this.chunkKeys(this.queryOptions.keys, 100);
|
|
42
|
+
for (const keys of chunkedKeys) {
|
|
43
|
+
this.commands.push({
|
|
44
|
+
RequestItems: {
|
|
45
|
+
[this.queryOptions.modelProps.name]: {
|
|
46
|
+
Keys: keys.map((key) => (0, util_dynamodb_1.marshall)(key, { removeUndefinedValues: true })),
|
|
47
|
+
ConsistentRead: consistentRead,
|
|
48
|
+
ProjectionExpression: projectionExpression,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
chunkKeys(keys, size) {
|
|
55
|
+
const result = [];
|
|
56
|
+
for (let i = 0; i < keys.length; i += size) {
|
|
57
|
+
result.push(keys.slice(i, i + size));
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.BatchGetBuilder = BatchGetBuilder;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClassResource } from '@lafken/common';
|
|
2
|
+
import type { TablePartition } from '../../../main/table';
|
|
3
|
+
import type { QueryBuilderProps } from '../base/base.types';
|
|
4
|
+
import type { Item, Projection } from '../query-builder.types';
|
|
5
|
+
export interface BatchGetOptions<E extends ClassResource> {
|
|
6
|
+
consistentRead?: boolean;
|
|
7
|
+
projection?: Projection<E>;
|
|
8
|
+
maxAttempt?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface BatchGetBuilderProps<E extends ClassResource> extends QueryBuilderProps<E> {
|
|
11
|
+
keys: TablePartition<Item<E>>[];
|
|
12
|
+
options?: BatchGetOptions<E>;
|
|
13
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ClassResource } from '@lafken/common';
|
|
2
2
|
import { FindBuilder } from '../find/find';
|
|
3
|
-
import type { FindBuilderProps } from '../find/find.types';
|
|
4
3
|
import type { QueryResponse } from '../query-builder.types';
|
|
4
|
+
import type { FindAllBuilderProps } from './find-all.types';
|
|
5
5
|
export declare class FindAllBuilder<E extends ClassResource> extends FindBuilder<E> {
|
|
6
|
-
protected queryOptions:
|
|
7
|
-
constructor(queryOptions:
|
|
6
|
+
protected queryOptions: FindAllBuilderProps<E>;
|
|
7
|
+
constructor(queryOptions: FindAllBuilderProps<E>);
|
|
8
8
|
then<T>(resolve: (value: QueryResponse<E>) => T, reject: (reason: any) => T): Promise<T>;
|
|
9
9
|
private exec;
|
|
10
10
|
}
|
|
@@ -13,7 +13,13 @@ class FindAllBuilder extends find_1.FindBuilder {
|
|
|
13
13
|
return this.exec().then(resolve, reject);
|
|
14
14
|
}
|
|
15
15
|
async exec() {
|
|
16
|
-
|
|
16
|
+
const { cache, cacheTtl, modelProps, inputProps } = this.queryOptions;
|
|
17
|
+
const fetch = () => this.runQuery(this.command);
|
|
18
|
+
if (cache && cacheTtl) {
|
|
19
|
+
const key = JSON.stringify({ table: modelProps.name, inputProps });
|
|
20
|
+
return cache.getOrSet(key, fetch, cacheTtl);
|
|
21
|
+
}
|
|
22
|
+
return fetch();
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
exports.FindAllBuilder = FindAllBuilder;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClassResource } from '@lafken/common';
|
|
2
|
+
import type { InMemoryCache } from '../../cache/in-memory-cache';
|
|
3
|
+
import type { FindBuilderProps } from '../find/find.types';
|
|
4
|
+
export interface FindAllBuilderProps<E extends ClassResource> extends FindBuilderProps<E> {
|
|
5
|
+
cache?: InMemoryCache;
|
|
6
|
+
cacheTtl?: number;
|
|
7
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ClassResource } from '@lafken/common';
|
|
2
2
|
import { FindBuilder } from '../find/find';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FindOneBuilderProps } from './find-one.types';
|
|
4
4
|
export declare class FindOneBuilder<E extends ClassResource> extends FindBuilder<E> {
|
|
5
|
-
protected queryOptions:
|
|
6
|
-
constructor(queryOptions:
|
|
5
|
+
protected queryOptions: FindOneBuilderProps<E>;
|
|
6
|
+
constructor(queryOptions: FindOneBuilderProps<E>);
|
|
7
7
|
then<T>(resolve: (value: InstanceType<E> | undefined) => T, reject: (reason: any) => T): Promise<T>;
|
|
8
8
|
private exec;
|
|
9
9
|
}
|
|
@@ -13,8 +13,16 @@ class FindOneBuilder extends find_1.FindBuilder {
|
|
|
13
13
|
return this.exec().then(resolve, reject);
|
|
14
14
|
}
|
|
15
15
|
async exec() {
|
|
16
|
-
const {
|
|
17
|
-
|
|
16
|
+
const { cache, cacheTtl, modelProps, inputProps } = this.queryOptions;
|
|
17
|
+
const fetch = async () => {
|
|
18
|
+
const { data } = await this.runQuery(this.command);
|
|
19
|
+
return data?.[0];
|
|
20
|
+
};
|
|
21
|
+
if (cache && cacheTtl) {
|
|
22
|
+
const key = JSON.stringify({ table: modelProps.name, inputProps });
|
|
23
|
+
return cache.getOrSet(key, fetch, cacheTtl);
|
|
24
|
+
}
|
|
25
|
+
return fetch();
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
exports.FindOneBuilder = FindOneBuilder;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClassResource } from '@lafken/common';
|
|
2
|
+
import type { InMemoryCache } from '../../cache/in-memory-cache';
|
|
3
|
+
import type { FindBuilderProps } from '../find/find.types';
|
|
4
|
+
export interface FindOneBuilderProps<E extends ClassResource> extends FindBuilderProps<E> {
|
|
5
|
+
cache?: InMemoryCache;
|
|
6
|
+
cacheTtl?: number;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type GetItemCommandInput } from '@aws-sdk/client-dynamodb';
|
|
2
|
+
import type { ClassResource } from '@lafken/common';
|
|
3
|
+
import { QueryBuilderBase } from '../base/base';
|
|
4
|
+
import type { GetItemBuilderProps } from './get-item.types';
|
|
5
|
+
export declare class GetItemBuilder<E extends ClassResource> extends QueryBuilderBase<E> {
|
|
6
|
+
private queryOptions;
|
|
7
|
+
protected command: GetItemCommandInput;
|
|
8
|
+
constructor(queryOptions: GetItemBuilderProps<E>);
|
|
9
|
+
getCommand(): GetItemCommandInput;
|
|
10
|
+
then<T>(resolve: (value: InstanceType<E> | undefined) => T, reject: (reason: any) => T): Promise<T>;
|
|
11
|
+
private exec;
|
|
12
|
+
protected prepare(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetItemBuilder = void 0;
|
|
4
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
5
|
+
const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
|
|
6
|
+
const base_1 = require("../base/base");
|
|
7
|
+
class GetItemBuilder extends base_1.QueryBuilderBase {
|
|
8
|
+
queryOptions;
|
|
9
|
+
command;
|
|
10
|
+
constructor(queryOptions) {
|
|
11
|
+
super(queryOptions);
|
|
12
|
+
this.queryOptions = queryOptions;
|
|
13
|
+
this.prepare();
|
|
14
|
+
}
|
|
15
|
+
getCommand() {
|
|
16
|
+
return this.command;
|
|
17
|
+
}
|
|
18
|
+
then(resolve, reject) {
|
|
19
|
+
return this.exec().then(resolve, reject);
|
|
20
|
+
}
|
|
21
|
+
async exec() {
|
|
22
|
+
const { cache, options, modelProps } = this.queryOptions;
|
|
23
|
+
const fetch = async () => {
|
|
24
|
+
const { Item } = await this.queryOptions.client.send(new client_dynamodb_1.GetItemCommand(this.command));
|
|
25
|
+
return Item ? (0, util_dynamodb_1.unmarshall)(Item) : undefined;
|
|
26
|
+
};
|
|
27
|
+
if (cache && options?.cacheTtl) {
|
|
28
|
+
const key = JSON.stringify({ table: modelProps.name, key: this.queryOptions.key });
|
|
29
|
+
return cache.getOrSet(key, fetch, options.cacheTtl);
|
|
30
|
+
}
|
|
31
|
+
return fetch();
|
|
32
|
+
}
|
|
33
|
+
prepare() {
|
|
34
|
+
const { consistentRead, projection } = this.queryOptions.options ?? {};
|
|
35
|
+
this.command = {
|
|
36
|
+
TableName: this.queryOptions.modelProps.name,
|
|
37
|
+
Key: (0, util_dynamodb_1.marshall)(this.queryOptions.key, {
|
|
38
|
+
removeUndefinedValues: true,
|
|
39
|
+
}),
|
|
40
|
+
ConsistentRead: consistentRead,
|
|
41
|
+
ProjectionExpression: projection && projection !== 'ALL' ? projection.join(', ') : undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.GetItemBuilder = GetItemBuilder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClassResource } from '@lafken/common';
|
|
2
|
+
import type { TablePartition } from '../../../main/table';
|
|
3
|
+
import type { InMemoryCache } from '../../cache/in-memory-cache';
|
|
4
|
+
import type { QueryBuilderProps } from '../base/base.types';
|
|
5
|
+
import type { Item, Projection } from '../query-builder.types';
|
|
6
|
+
export interface GetItemOptions<E extends ClassResource> {
|
|
7
|
+
consistentRead?: boolean;
|
|
8
|
+
projection?: Projection<E>;
|
|
9
|
+
cacheTtl?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GetItemBuilderProps<E extends ClassResource> extends QueryBuilderProps<E> {
|
|
12
|
+
key: TablePartition<Item<E>>;
|
|
13
|
+
cache?: InMemoryCache;
|
|
14
|
+
options?: GetItemOptions<E>;
|
|
15
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createRepository = void 0;
|
|
4
|
+
const in_memory_cache_1 = require("../cache/in-memory-cache");
|
|
4
5
|
const client_1 = require("../client/client");
|
|
6
|
+
const batch_get_1 = require("../query-builder/batch-get/batch-get");
|
|
5
7
|
const bulk_create_1 = require("../query-builder/bulk-create/bulk-create");
|
|
6
8
|
const bulk_delete_1 = require("../query-builder/bulk-delete/bulk-delete");
|
|
7
9
|
const create_1 = require("../query-builder/create/create");
|
|
@@ -9,6 +11,7 @@ const delete_1 = require("../query-builder/delete/delete");
|
|
|
9
11
|
const dynamo_index_1 = require("../query-builder/dynamo-index/dynamo-index");
|
|
10
12
|
const find_all_1 = require("../query-builder/find-all/find-all");
|
|
11
13
|
const find_one_1 = require("../query-builder/find-one/find-one");
|
|
14
|
+
const get_item_1 = require("../query-builder/get-item/get-item");
|
|
12
15
|
const scan_1 = require("../query-builder/scan/scan");
|
|
13
16
|
const update_1 = require("../query-builder/update/update");
|
|
14
17
|
const upsert_1 = require("../query-builder/upsert/upsert");
|
|
@@ -23,21 +26,26 @@ const createRepository = (model) => {
|
|
|
23
26
|
sortKey,
|
|
24
27
|
};
|
|
25
28
|
const indexes = new dynamo_index_1.DynamoIndexes(modelProps.indexes, partitionKey, sortKey);
|
|
29
|
+
const cache = new in_memory_cache_1.InMemoryCache();
|
|
26
30
|
return {
|
|
27
|
-
findOne(inputProps) {
|
|
31
|
+
findOne(inputProps, cacheTtl) {
|
|
28
32
|
return new find_one_1.FindOneBuilder({
|
|
29
33
|
...queryBuilderProps,
|
|
30
34
|
indexes,
|
|
35
|
+
cache,
|
|
36
|
+
cacheTtl,
|
|
31
37
|
inputProps: {
|
|
32
38
|
...inputProps,
|
|
33
39
|
limit: 1,
|
|
34
40
|
},
|
|
35
41
|
});
|
|
36
42
|
},
|
|
37
|
-
findAll(inputProps) {
|
|
43
|
+
findAll(inputProps, cacheTtl) {
|
|
38
44
|
return new find_all_1.FindAllBuilder({
|
|
39
45
|
...queryBuilderProps,
|
|
40
46
|
indexes,
|
|
47
|
+
cache,
|
|
48
|
+
cacheTtl,
|
|
41
49
|
inputProps,
|
|
42
50
|
});
|
|
43
51
|
},
|
|
@@ -66,12 +74,27 @@ const createRepository = (model) => {
|
|
|
66
74
|
inputProps: inputProps,
|
|
67
75
|
});
|
|
68
76
|
},
|
|
77
|
+
getItem(key, options) {
|
|
78
|
+
return new get_item_1.GetItemBuilder({
|
|
79
|
+
...queryBuilderProps,
|
|
80
|
+
key,
|
|
81
|
+
cache,
|
|
82
|
+
options,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
69
85
|
delete(key) {
|
|
70
86
|
return new delete_1.DeleteBuilder({
|
|
71
87
|
...queryBuilderProps,
|
|
72
88
|
key,
|
|
73
89
|
});
|
|
74
90
|
},
|
|
91
|
+
batchGet(keys, options) {
|
|
92
|
+
return new batch_get_1.BatchGetBuilder({
|
|
93
|
+
...queryBuilderProps,
|
|
94
|
+
keys,
|
|
95
|
+
options,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
75
98
|
bulkCreate(items) {
|
|
76
99
|
return new bulk_create_1.BulkCreateBuilder({
|
|
77
100
|
...queryBuilderProps,
|
|
@@ -2,25 +2,31 @@ import type { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
|
2
2
|
import type { ClassResource } from '@lafken/common';
|
|
3
3
|
import type { TablePartition } from '../../main';
|
|
4
4
|
import type { FindProps, Item, QueryOneProps, QueryProps, ReturnValueOption, UpdateProps, UpsertProps } from '../query-builder';
|
|
5
|
+
import type { BatchGetBuilder } from '../query-builder/batch-get/batch-get';
|
|
6
|
+
import type { BatchGetOptions } from '../query-builder/batch-get/batch-get.types';
|
|
5
7
|
import type { BulkCreateBuilder } from '../query-builder/bulk-create/bulk-create';
|
|
6
8
|
import type { BulkDeleteBuilder } from '../query-builder/bulk-delete/bulk-delete';
|
|
7
9
|
import type { CreateBuilder } from '../query-builder/create/create';
|
|
8
10
|
import type { DeleteBuilder } from '../query-builder/delete/delete';
|
|
9
11
|
import type { FindAllBuilder } from '../query-builder/find-all/find-all';
|
|
10
12
|
import type { FindOneBuilder } from '../query-builder/find-one/find-one';
|
|
13
|
+
import type { GetItemBuilder } from '../query-builder/get-item/get-item';
|
|
14
|
+
import type { GetItemOptions } from '../query-builder/get-item/get-item.types';
|
|
11
15
|
import type { ScanBuilder } from '../query-builder/scan/scan';
|
|
12
16
|
import type { UpdateBuilder } from '../query-builder/update/update';
|
|
13
17
|
import type { UpsertBuilder } from '../query-builder/upsert/upsert';
|
|
14
18
|
export type RepositoryReturn<E extends ClassResource> = {
|
|
15
|
-
findOne(inputProps: QueryOneProps<E
|
|
16
|
-
findAll(inputProps: QueryProps<E
|
|
19
|
+
findOne(inputProps: QueryOneProps<E>, cacheTtl?: number): FindOneBuilder<E>;
|
|
20
|
+
findAll(inputProps: QueryProps<E>, cacheTtl?: number): FindAllBuilder<E>;
|
|
17
21
|
scan(inputProps?: FindProps<E>): ScanBuilder<E>;
|
|
18
22
|
upsert(item: Item<E>, inputProps?: UpsertProps<E>): UpsertBuilder<E>;
|
|
19
23
|
create(item: Item<E>): CreateBuilder<E>;
|
|
20
24
|
update<R extends ReturnValueOption | undefined = undefined>(inputProps: Omit<UpdateProps<E>, 'returnValue'> & {
|
|
21
25
|
returnValue?: R;
|
|
22
26
|
}): UpdateBuilder<E, R>;
|
|
27
|
+
getItem(key: TablePartition<Item<E>>, options?: GetItemOptions<E>): GetItemBuilder<E>;
|
|
23
28
|
delete(key: TablePartition<Item<E>>): DeleteBuilder<E>;
|
|
29
|
+
batchGet(keys: TablePartition<Item<E>>[], options?: BatchGetOptions<E>): BatchGetBuilder<E>;
|
|
24
30
|
bulkCreate(items: Item<E>[]): BulkCreateBuilder<E>;
|
|
25
31
|
bulkDelete(keys: TablePartition<Item<E>>[]): BulkDeleteBuilder<E>;
|
|
26
32
|
sendRawCommand<T = unknown>(command: Parameters<DynamoDBClient['send']>[0]): Promise<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lafken/dynamo",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Define DynamoDB tables using TypeScript decorators - type-safe, declarative infrastructure with Lafken",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@aws-sdk/util-dynamodb": "^3.996.2",
|
|
61
61
|
"aws-xray-sdk": "^3.12.0",
|
|
62
62
|
"reflect-metadata": "^0.2.2",
|
|
63
|
-
"@lafken/resolver": "0.12.
|
|
63
|
+
"@lafken/resolver": "0.12.8"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@cdktn/provider-aws": "^24.0.0",
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"typescript": "6.0.3",
|
|
75
75
|
"unplugin-swc": "^1.5.9",
|
|
76
76
|
"vitest": "^4.1.5",
|
|
77
|
-
"@lafken/common": "0.12.
|
|
77
|
+
"@lafken/common": "0.12.8"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@cdktn/provider-aws": ">=23.0.0",
|
|
81
81
|
"cdktn": ">=0.22.0",
|
|
82
82
|
"constructs": "^10.4.5",
|
|
83
|
-
"@lafken/common": "0.12.
|
|
83
|
+
"@lafken/common": "0.12.8"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=20.19"
|