dynamo-document-builder 0.2.0 → 0.4.0
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/dist/attributes/attribute-map.d.ts +11 -7
- package/dist/attributes/index.d.ts +1 -1
- package/dist/commands/base-command.d.ts +13 -10
- package/dist/commands/batch-get.d.ts +11 -7
- package/dist/commands/batch-write.d.ts +17 -11
- package/dist/commands/condition-check.d.ts +12 -8
- package/dist/commands/conditional-delete.d.ts +14 -10
- package/dist/commands/conditional-put.d.ts +17 -11
- package/dist/commands/conditional-update.d.ts +14 -10
- package/dist/commands/delete.d.ts +12 -8
- package/dist/commands/get.d.ts +11 -7
- package/dist/commands/index.d.ts +18 -18
- package/dist/commands/projected-get.d.ts +13 -9
- package/dist/commands/projected-query.d.ts +14 -10
- package/dist/commands/projected-scan.d.ts +14 -10
- package/dist/commands/put.d.ts +15 -9
- package/dist/commands/query.d.ts +14 -10
- package/dist/commands/scan.d.ts +14 -10
- package/dist/commands/transact-get.d.ts +11 -7
- package/dist/commands/transact-write.d.ts +12 -8
- package/dist/commands/update.d.ts +13 -9
- package/dist/conditions/and.d.ts +5 -2
- package/dist/conditions/begins-with.d.ts +5 -2
- package/dist/conditions/between.d.ts +5 -2
- package/dist/conditions/condition-parser.cjs +7 -0
- package/dist/conditions/condition-parser.cjs.map +1 -1
- package/dist/conditions/condition-parser.d.ts +8 -4
- package/dist/conditions/condition-parser.mjs +8 -1
- package/dist/conditions/condition-parser.mjs.map +1 -1
- package/dist/conditions/condition-symbols.d.ts +13 -11
- package/dist/conditions/condition-types.d.ts +41 -31
- package/dist/conditions/contains.d.ts +6 -3
- package/dist/conditions/equals.d.ts +5 -2
- package/dist/conditions/exists.d.ts +5 -2
- package/dist/conditions/greater-than-or-equal.d.ts +5 -2
- package/dist/conditions/greater-than.d.ts +5 -2
- package/dist/conditions/index.d.ts +19 -19
- package/dist/conditions/is-in.d.ts +5 -2
- package/dist/conditions/less-than-or-equal.d.ts +5 -2
- package/dist/conditions/less-than.d.ts +5 -2
- package/dist/conditions/not-equals.d.ts +5 -2
- package/dist/conditions/not-exists.d.ts +5 -2
- package/dist/conditions/not.d.ts +5 -2
- package/dist/conditions/or.d.ts +5 -2
- package/dist/conditions/size.cjs +10 -2
- package/dist/conditions/size.cjs.map +1 -1
- package/dist/conditions/size.d.ts +5 -2
- package/dist/conditions/size.mjs +10 -2
- package/dist/conditions/size.mjs.map +1 -1
- package/dist/conditions/type-is.d.ts +5 -2
- package/dist/core/core-types.d.ts +17 -14
- package/dist/core/entity.d.ts +12 -8
- package/dist/core/index.d.ts +4 -4
- package/dist/core/key.d.ts +11 -7
- package/dist/core/table.d.ts +8 -4
- package/dist/errors.d.ts +3 -1
- package/dist/index.d.ts +55 -7
- package/dist/internal-constants.d.ts +10 -8
- package/dist/projections/index.d.ts +2 -2
- package/dist/projections/projection-parser.d.ts +8 -4
- package/dist/projections/projection-types.d.ts +3 -1
- package/dist/updates/add-to-set.d.ts +6 -3
- package/dist/updates/add.d.ts +5 -2
- package/dist/updates/append.d.ts +6 -3
- package/dist/updates/index.d.ts +10 -10
- package/dist/updates/prepend.d.ts +6 -3
- package/dist/updates/ref.d.ts +6 -3
- package/dist/updates/remove-from-set.d.ts +6 -3
- package/dist/updates/remove.d.ts +5 -2
- package/dist/updates/subtract.d.ts +5 -2
- package/dist/updates/update-parser.d.ts +8 -4
- package/dist/updates/update-symbols.d.ts +12 -10
- package/dist/updates/update-types.d.ts +16 -13
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { NativeAttributeValue } from '@aws-sdk/lib-dynamodb';
|
|
2
|
+
|
|
3
|
+
type AttributeValues = Record<string, NativeAttributeValue>;
|
|
4
|
+
type AttributeNames = Record<string, string>;
|
|
5
|
+
type DynamoAttributeExpression = {
|
|
5
6
|
ExpressionAttributeValues?: AttributeValues | undefined;
|
|
6
7
|
ExpressionAttributeNames?: AttributeNames | undefined;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type AttributeValuePlaceholder = `:${string}`;
|
|
10
|
+
type AttributeNamePlaceholder = `#${string}`;
|
|
11
|
+
declare class AttributeExpressionMap {
|
|
11
12
|
private attributeNames;
|
|
12
13
|
private reverseLookupNames;
|
|
13
14
|
private names;
|
|
@@ -30,3 +31,6 @@ export declare class AttributeExpressionMap {
|
|
|
30
31
|
getNameCount(): number;
|
|
31
32
|
getValueCount(): number;
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
export { AttributeExpressionMap };
|
|
36
|
+
export type { AttributeNamePlaceholder, AttributeNames, AttributeValuePlaceholder, AttributeValues, DynamoAttributeExpression };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { AttributeExpressionMap, AttributeNamePlaceholder, AttributeNames, AttributeValuePlaceholder, AttributeValues, DynamoAttributeExpression } from './attribute-map.js';
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { TransactWriteOperation } from '../core/core-types.js';
|
|
2
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
3
|
+
import { ReturnConsumedCapacity, ConsumedCapacity } from '@aws-sdk/client-dynamodb';
|
|
4
|
+
import { ResponseMetadata } from '@aws-sdk/types';
|
|
5
|
+
import { ZodObject } from 'zod/v4';
|
|
6
|
+
|
|
7
|
+
type BaseCommand<Output, Schema extends ZodObject> = {
|
|
7
8
|
execute(entity: DynamoEntity<Schema>): Promise<Output>;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type BasePaginatable<Output, Schema extends ZodObject> = {
|
|
10
11
|
executePaginated(entity: DynamoEntity<Schema>): AsyncGenerator<Output, void, unknown>;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
type WriteTransactable<Schema extends ZodObject> = {
|
|
13
14
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
type BaseConfig = {
|
|
16
17
|
skipValidation?: boolean;
|
|
17
18
|
returnConsumedCapacity?: ReturnConsumedCapacity;
|
|
18
19
|
abortController?: AbortController;
|
|
19
20
|
timeoutMs?: number;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
+
type BaseResult = {
|
|
22
23
|
responseMetadata?: ResponseMetadata;
|
|
23
24
|
consumedCapacity?: ConsumedCapacity | undefined;
|
|
24
25
|
};
|
|
26
|
+
|
|
27
|
+
export type { BaseCommand, BaseConfig, BasePaginatable, BaseResult, WriteTransactable };
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { BaseConfig, BaseResult, BaseCommand } from './base-command.js';
|
|
2
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
3
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
4
|
+
import { ZodObject } from 'zod/v4';
|
|
5
|
+
|
|
6
|
+
type BatchGetConfig<Schema extends ZodObject> = BaseConfig & {
|
|
6
7
|
keys: Array<Partial<EntitySchema<Schema>>>;
|
|
7
8
|
consistent?: boolean;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type BatchGetResult<Schema extends ZodObject> = BaseResult & {
|
|
10
11
|
items: Array<EntitySchema<Schema>>;
|
|
11
12
|
unprocessedKeys?: Array<Partial<EntitySchema<Schema>>>;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
+
declare class BatchGet<Schema extends ZodObject> implements BaseCommand<BatchGetResult<Schema>, Schema> {
|
|
14
15
|
#private;
|
|
15
16
|
constructor(config: BatchGetConfig<Schema>);
|
|
16
17
|
execute(entity: DynamoEntity<Schema>): Promise<BatchGetResult<Schema>>;
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
export { BatchGet };
|
|
21
|
+
export type { BatchGetConfig, BatchGetResult };
|
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { DynamoKey } from '../core/key.js';
|
|
2
|
+
import * as zod_v4 from 'zod/v4';
|
|
3
|
+
import { ZodObject } from 'zod/v4';
|
|
4
|
+
import { BaseConfig, BaseResult, BaseCommand } from './base-command.js';
|
|
5
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
6
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
7
|
+
import { ReturnItemCollectionMetrics, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
8
|
+
|
|
9
|
+
type BatchWriteConfig<Schema extends ZodObject> = BaseConfig & {
|
|
7
10
|
items?: Array<EntitySchema<Schema>>;
|
|
8
11
|
deletes?: Array<Partial<EntitySchema<Schema>>>;
|
|
9
12
|
returnItemCollectionMetrics?: ReturnItemCollectionMetrics;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
type BatchWriteResult<Schema extends ZodObject> = BaseResult & {
|
|
12
15
|
unprocessedPuts?: Array<EntitySchema<Schema>>;
|
|
13
16
|
unprocessedDeletes?: Array<Partial<EntitySchema<Schema>>>;
|
|
14
17
|
itemColectionMetrics?: ItemCollectionMetrics;
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
declare class BatchWrite<Schema extends ZodObject> implements BaseCommand<BatchWriteResult<Schema>, Schema> {
|
|
17
20
|
#private;
|
|
18
21
|
constructor(config: BatchWriteConfig<Schema>);
|
|
19
22
|
buildPutRequests(entity: DynamoEntity<Schema>): Promise<{
|
|
20
23
|
PutRequest: {
|
|
21
|
-
Item:
|
|
24
|
+
Item: zod_v4.infer<Schema> & DynamoKey;
|
|
22
25
|
};
|
|
23
26
|
}[] | {
|
|
24
27
|
PutRequest: {
|
|
25
|
-
Item:
|
|
28
|
+
Item: zod_v4.input<Schema> & DynamoKey;
|
|
26
29
|
};
|
|
27
30
|
}[]>;
|
|
28
31
|
buildDeleteRequests(entity: DynamoEntity<Schema>): Promise<{
|
|
29
32
|
DeleteRequest: {
|
|
30
|
-
Key:
|
|
33
|
+
Key: DynamoKey;
|
|
31
34
|
};
|
|
32
35
|
}[]>;
|
|
33
36
|
execute(entity: DynamoEntity<Schema>): Promise<BatchWriteResult<Schema>>;
|
|
34
37
|
}
|
|
38
|
+
|
|
39
|
+
export { BatchWrite };
|
|
40
|
+
export type { BatchWriteConfig, BatchWriteResult };
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { Condition } from '../conditions/condition-types.js';
|
|
2
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
3
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
4
|
+
import { ReturnValuesOnConditionCheckFailure } from '@aws-sdk/client-dynamodb';
|
|
5
|
+
import { WriteTransactable } from './base-command.js';
|
|
6
|
+
import { ZodObject } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
type ConditionCheckConfig<Schema extends ZodObject> = {
|
|
8
9
|
key: Partial<EntitySchema<Schema>>;
|
|
9
10
|
condition: Condition;
|
|
10
11
|
returnValuesOnConditionCheckFailure?: ReturnValuesOnConditionCheckFailure;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
declare class ConditionCheck<Schema extends ZodObject> implements WriteTransactable<Schema> {
|
|
13
14
|
#private;
|
|
14
15
|
constructor(config: ConditionCheckConfig<Schema>);
|
|
15
16
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
export { ConditionCheck };
|
|
20
|
+
export type { ConditionCheckConfig };
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { Condition } from '../conditions/condition-types.js';
|
|
2
|
+
import { DeleteConfig } from './delete.js';
|
|
3
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
4
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
5
|
+
import { ReturnValuesOnConditionCheckFailure, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
6
|
+
import { ZodObject } from 'zod/v4';
|
|
7
|
+
import { BaseResult, BaseCommand, WriteTransactable } from './base-command.js';
|
|
8
|
+
|
|
9
|
+
type ConditionalDeleteConfig<Schema extends ZodObject> = DeleteConfig<Schema> & {
|
|
9
10
|
condition: Condition;
|
|
10
11
|
returnValuesOnConditionCheckFailure?: ReturnValuesOnConditionCheckFailure;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
type ConditionalDeleteResult<Schema extends ZodObject> = BaseResult & {
|
|
13
14
|
deletedItem?: Partial<EntitySchema<Schema>> | undefined;
|
|
14
15
|
itemCollectionMetrics?: ItemCollectionMetrics;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
declare class ConditionalDelete<Schema extends ZodObject> implements BaseCommand<ConditionalDeleteResult<Schema>, Schema>, WriteTransactable<Schema> {
|
|
17
18
|
#private;
|
|
18
19
|
constructor(config: ConditionalDeleteConfig<Schema>);
|
|
19
20
|
execute(entity: DynamoEntity<Schema>): Promise<ConditionalDeleteResult<Schema>>;
|
|
20
21
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
export { ConditionalDelete };
|
|
25
|
+
export type { ConditionalDeleteConfig, ConditionalDeleteResult };
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { DynamoKey } from '../core/key.js';
|
|
2
|
+
import * as zod_v4 from 'zod/v4';
|
|
3
|
+
import { ZodObject } from 'zod/v4';
|
|
4
|
+
import { Condition } from '../conditions/condition-types.js';
|
|
5
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
6
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
7
|
+
import { ReturnValuesOnConditionCheckFailure, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
8
|
+
import { PutConfig } from './put.js';
|
|
9
|
+
import { BaseResult, BaseCommand, WriteTransactable } from './base-command.js';
|
|
10
|
+
|
|
11
|
+
type ConditionalPutConfig<Schema extends ZodObject> = PutConfig<Schema> & {
|
|
9
12
|
condition: Condition;
|
|
10
13
|
returnValuesOnConditionCheckFailure?: ReturnValuesOnConditionCheckFailure;
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
type ConditionalPutResult<Schema extends ZodObject> = BaseResult & {
|
|
13
16
|
returnItem: EntitySchema<Schema> | undefined;
|
|
14
17
|
itemCollectionMetrics: ItemCollectionMetrics | undefined;
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
declare class ConditionalPut<Schema extends ZodObject> implements BaseCommand<ConditionalPutResult<Schema>, Schema>, WriteTransactable<Schema> {
|
|
17
20
|
#private;
|
|
18
21
|
constructor(config: ConditionalPutConfig<Schema>);
|
|
19
|
-
buildItem(entity: DynamoEntity<Schema>): Promise<(
|
|
22
|
+
buildItem(entity: DynamoEntity<Schema>): Promise<(zod_v4.infer<Schema> & DynamoKey) | (zod_v4.input<Schema> & DynamoKey)>;
|
|
20
23
|
execute(entity: DynamoEntity<Schema>): Promise<ConditionalPutResult<Schema>>;
|
|
21
24
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
22
25
|
}
|
|
26
|
+
|
|
27
|
+
export { ConditionalPut };
|
|
28
|
+
export type { ConditionalPutConfig, ConditionalPutResult };
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { Condition } from '../conditions/condition-types.js';
|
|
2
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
3
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
4
|
+
import { ReturnValuesOnConditionCheckFailure, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
5
|
+
import { UpdateConfig } from './update.js';
|
|
6
|
+
import { ZodObject } from 'zod/v4';
|
|
7
|
+
import { BaseResult, BaseCommand, WriteTransactable } from './base-command.js';
|
|
8
|
+
|
|
9
|
+
type ConditionalUpdateConfig<Schema extends ZodObject> = UpdateConfig<Schema> & {
|
|
9
10
|
condition: Condition;
|
|
10
11
|
returnValuesOnConditionCheckFailure?: ReturnValuesOnConditionCheckFailure;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
type ConditionalUpdateResult<Schema extends ZodObject> = BaseResult & {
|
|
13
14
|
updatedItem?: EntitySchema<Schema> | undefined;
|
|
14
15
|
itemCollectionMetrics?: ItemCollectionMetrics;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
declare class ConditionalUpdate<Schema extends ZodObject> implements BaseCommand<ConditionalUpdateResult<Schema>, Schema>, WriteTransactable<Schema> {
|
|
17
18
|
#private;
|
|
18
19
|
constructor(config: ConditionalUpdateConfig<Schema>);
|
|
19
20
|
execute(entity: DynamoEntity<Schema>): Promise<ConditionalUpdateResult<Schema>>;
|
|
20
21
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
export { ConditionalUpdate };
|
|
25
|
+
export type { ConditionalUpdateConfig, ConditionalUpdateResult };
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
2
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
3
|
+
import { ReturnValue, ReturnItemCollectionMetrics, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
4
|
+
import { ZodObject } from 'zod/v4';
|
|
5
|
+
import { BaseConfig, BaseResult, BaseCommand, WriteTransactable } from './base-command.js';
|
|
6
|
+
|
|
7
|
+
type DeleteConfig<Schema extends ZodObject> = BaseConfig & {
|
|
7
8
|
key: Partial<EntitySchema<Schema>>;
|
|
8
9
|
returnValues?: ReturnValue;
|
|
9
10
|
returnItemCollectionMetrics?: ReturnItemCollectionMetrics;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
type DeleteResult<Schema extends ZodObject> = BaseResult & {
|
|
12
13
|
deletedItem?: Partial<EntitySchema<Schema>> | undefined;
|
|
13
14
|
itemCollectionMetrics?: ItemCollectionMetrics;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
declare class Delete<Schema extends ZodObject> implements BaseCommand<DeleteResult<Schema>, Schema>, WriteTransactable<Schema> {
|
|
16
17
|
#private;
|
|
17
18
|
constructor(config: DeleteConfig<Schema>);
|
|
18
19
|
execute(entity: DynamoEntity<Schema>): Promise<DeleteResult<Schema>>;
|
|
19
20
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
export { Delete };
|
|
24
|
+
export type { DeleteConfig, DeleteResult };
|
package/dist/commands/get.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
2
|
+
import { BaseConfig, BaseResult, BaseCommand } from './base-command.js';
|
|
3
|
+
import { ZodObject } from 'zod/v4';
|
|
4
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
5
|
+
|
|
6
|
+
type GetConfig<Schema extends ZodObject> = BaseConfig & {
|
|
6
7
|
key: Partial<EntitySchema<Schema>>;
|
|
7
8
|
consistent?: boolean;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type GetResult<Schema extends ZodObject> = BaseResult & {
|
|
10
11
|
item: EntitySchema<Schema> | undefined;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
declare class Get<Schema extends ZodObject> implements BaseCommand<GetResult<Schema>, Schema> {
|
|
13
14
|
#private;
|
|
14
15
|
constructor(config: GetConfig<Schema>);
|
|
15
16
|
execute(entity: DynamoEntity<Schema>): Promise<GetResult<Schema>>;
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
export { Get };
|
|
20
|
+
export type { GetConfig, GetResult };
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
1
|
+
export { BaseCommand, BaseConfig, BasePaginatable, BaseResult, WriteTransactable } from './base-command.js';
|
|
2
|
+
export { Get, GetConfig, GetResult } from './get.js';
|
|
3
|
+
export { Query, QueryConfig, QueryResult } from './query.js';
|
|
4
|
+
export { Scan, ScanConfig, ScanResult } from './scan.js';
|
|
5
|
+
export { ProjectedGet, ProjectedGetConfig, ProjectedGetResult } from './projected-get.js';
|
|
6
|
+
export { ProjectedQuery, ProjectedQueryConfig, ProjectedQueryResult } from './projected-query.js';
|
|
7
|
+
export { ProjectedScan, ProjectedScanConfig, ProjectedScanResult } from './projected-scan.js';
|
|
8
|
+
export { BatchGet, BatchGetConfig, BatchGetResult } from './batch-get.js';
|
|
9
|
+
export { TransactGet, TransactGetConfig, TransactGetResult } from './transact-get.js';
|
|
10
|
+
export { Put, PutConfig, PutResult } from './put.js';
|
|
11
|
+
export { Update, UpdateConfig, UpdateResult } from './update.js';
|
|
12
|
+
export { Delete, DeleteConfig, DeleteResult } from './delete.js';
|
|
13
|
+
export { ConditionalPut, ConditionalPutConfig, ConditionalPutResult } from './conditional-put.js';
|
|
14
|
+
export { ConditionalUpdate, ConditionalUpdateConfig, ConditionalUpdateResult } from './conditional-update.js';
|
|
15
|
+
export { ConditionalDelete, ConditionalDeleteConfig, ConditionalDeleteResult } from './conditional-delete.js';
|
|
16
|
+
export { BatchWrite, BatchWriteConfig, BatchWriteResult } from './batch-write.js';
|
|
17
|
+
export { TransactWrite, TransactWriteConfig, TransactWriteResult } from './transact-write.js';
|
|
18
|
+
export { ConditionCheck, ConditionCheckConfig } from './condition-check.js';
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
2
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
3
|
+
import { GetConfig } from './get.js';
|
|
4
|
+
import { Projection } from '../projections/projection-types.js';
|
|
5
|
+
import { ZodObject } from 'zod/v4';
|
|
6
|
+
import { BaseResult, BaseCommand } from './base-command.js';
|
|
7
|
+
|
|
8
|
+
type ProjectedGetConfig<Schema extends ZodObject, ProjectionSchema extends ZodObject> = GetConfig<Schema> & {
|
|
8
9
|
projection: Projection;
|
|
9
10
|
projectionSchema: ProjectionSchema;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
type ProjectedGetResult<ProjectionSchema extends ZodObject> = BaseResult & {
|
|
12
13
|
item: EntitySchema<ProjectionSchema> | undefined;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
declare class ProjectedGet<Schema extends ZodObject, ProjectionSchema extends ZodObject> implements BaseCommand<ProjectedGetResult<ProjectionSchema>, Schema> {
|
|
15
16
|
#private;
|
|
16
17
|
constructor(config: ProjectedGetConfig<Schema, ProjectionSchema>);
|
|
17
18
|
execute(entity: DynamoEntity<Schema>): Promise<ProjectedGetResult<ProjectionSchema>>;
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
export { ProjectedGet };
|
|
22
|
+
export type { ProjectedGetConfig, ProjectedGetResult };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
2
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
3
|
+
import { Projection } from '../projections/projection-types.js';
|
|
4
|
+
import { QueryConfig } from './query.js';
|
|
5
|
+
import { ZodObject } from 'zod/v4';
|
|
6
|
+
import { BaseResult, BaseCommand, BasePaginatable } from './base-command.js';
|
|
7
|
+
import { QueryCommandInput, NativeAttributeValue, QueryCommandOutput } from '@aws-sdk/lib-dynamodb';
|
|
8
|
+
|
|
9
|
+
type ProjectedQueryConfig<Schema extends ZodObject, ProjectionSchema extends ZodObject> = QueryConfig<Schema> & {
|
|
9
10
|
projection: Projection;
|
|
10
11
|
projectionSchema: ProjectionSchema;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
type ProjectedQueryResult<Schema extends ZodObject, ProjectionSchema extends ZodObject> = BaseResult & {
|
|
13
14
|
items: EntitySchema<ProjectionSchema>[];
|
|
14
15
|
count: number;
|
|
15
16
|
scannedCount: number;
|
|
16
17
|
lastEvaluatedKey?: Partial<EntitySchema<Schema>> | undefined;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
declare class ProjectedQuery<Schema extends ZodObject, ProjectedSchema extends ZodObject> implements BaseCommand<ProjectedQueryResult<Schema, ProjectedSchema>, Schema>, BasePaginatable<ProjectedQueryResult<Schema, ProjectedSchema>, Schema> {
|
|
19
20
|
#private;
|
|
20
21
|
constructor(config: ProjectedQueryConfig<Schema, ProjectedSchema>);
|
|
21
22
|
buildCommandInput(entity: DynamoEntity<Schema>): QueryCommandInput;
|
|
@@ -24,3 +25,6 @@ export declare class ProjectedQuery<Schema extends ZodObject, ProjectedSchema ex
|
|
|
24
25
|
execute(entity: DynamoEntity<Schema>): Promise<ProjectedQueryResult<Schema, ProjectedSchema>>;
|
|
25
26
|
executePaginated(entity: DynamoEntity<Schema>): AsyncGenerator<ProjectedQueryResult<Schema, ProjectedSchema>, void, unknown>;
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
export { ProjectedQuery };
|
|
30
|
+
export type { ProjectedQueryConfig, ProjectedQueryResult };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
2
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
3
|
+
import { ScanConfig } from './scan.js';
|
|
4
|
+
import { Projection } from '../projections/projection-types.js';
|
|
5
|
+
import { ZodObject } from 'zod/v4';
|
|
6
|
+
import { BaseResult, BaseCommand, BasePaginatable } from './base-command.js';
|
|
7
|
+
import { ScanCommandInput, NativeAttributeValue, ScanCommandOutput } from '@aws-sdk/lib-dynamodb';
|
|
8
|
+
|
|
9
|
+
type ProjectedScanConfig<ProjectionSchema extends ZodObject> = ScanConfig<ProjectionSchema> & {
|
|
9
10
|
projection: Projection;
|
|
10
11
|
projectionSchema: ProjectionSchema;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
type ProjectedScanResult<Schema extends ZodObject, ProjectionSchema extends ZodObject> = BaseResult & {
|
|
13
14
|
items: EntitySchema<ProjectionSchema>[];
|
|
14
15
|
count: number;
|
|
15
16
|
scannedCount: number;
|
|
16
17
|
lastEvaluatedKey?: Partial<EntitySchema<Schema>> | undefined;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
declare class ProjectedScan<Schema extends ZodObject, ProjectedSchema extends ZodObject> implements BaseCommand<ProjectedScanResult<Schema, ProjectedSchema>, Schema>, BasePaginatable<ProjectedScanResult<Schema, ProjectedSchema>, Schema> {
|
|
19
20
|
#private;
|
|
20
21
|
constructor(config: ProjectedScanConfig<ProjectedSchema>);
|
|
21
22
|
buildCommandInput(entity: DynamoEntity<Schema>): ScanCommandInput;
|
|
@@ -24,3 +25,6 @@ export declare class ProjectedScan<Schema extends ZodObject, ProjectedSchema ext
|
|
|
24
25
|
execute(entity: DynamoEntity<Schema>): Promise<ProjectedScanResult<Schema, ProjectedSchema>>;
|
|
25
26
|
executePaginated(entity: DynamoEntity<Schema>): AsyncGenerator<ProjectedScanResult<Schema, ProjectedSchema>, void, unknown>;
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
export { ProjectedScan };
|
|
30
|
+
export type { ProjectedScanConfig, ProjectedScanResult };
|
package/dist/commands/put.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { DynamoKey } from '../core/key.js';
|
|
2
|
+
import * as zod_v4 from 'zod/v4';
|
|
3
|
+
import { ZodObject } from 'zod/v4';
|
|
4
|
+
import { DynamoEntity } from '../core/entity.js';
|
|
5
|
+
import { EntitySchema, TransactWriteOperation } from '../core/core-types.js';
|
|
6
|
+
import { ReturnValue, ReturnItemCollectionMetrics, ItemCollectionMetrics } from '@aws-sdk/client-dynamodb';
|
|
7
|
+
import { BaseConfig, BaseResult, BaseCommand, WriteTransactable } from './base-command.js';
|
|
8
|
+
|
|
9
|
+
type PutConfig<Schema extends ZodObject> = BaseConfig & {
|
|
7
10
|
item: EntitySchema<Schema>;
|
|
8
11
|
returnValues?: ReturnValue;
|
|
9
12
|
returnItemCollectionMetrics?: ReturnItemCollectionMetrics;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
type PutResult<Schema extends ZodObject> = BaseResult & {
|
|
12
15
|
returnItem: Partial<EntitySchema<Schema>> | undefined;
|
|
13
16
|
itemCollectionMetrics?: ItemCollectionMetrics;
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
declare class Put<Schema extends ZodObject> implements BaseCommand<PutResult<Schema>, Schema>, WriteTransactable<Schema> {
|
|
16
19
|
#private;
|
|
17
20
|
constructor(config: PutConfig<Schema>);
|
|
18
|
-
buildItem(entity: DynamoEntity<Schema>): Promise<(
|
|
21
|
+
buildItem(entity: DynamoEntity<Schema>): Promise<(zod_v4.infer<Schema> & DynamoKey) | (zod_v4.input<Schema> & DynamoKey)>;
|
|
19
22
|
execute(entity: DynamoEntity<Schema>): Promise<PutResult<Schema>>;
|
|
20
23
|
prepareWriteTransaction(entity: DynamoEntity<Schema>): Promise<TransactWriteOperation>;
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
export { Put };
|
|
27
|
+
export type { PutConfig, PutResult };
|
package/dist/commands/query.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { Condition } from '../conditions/condition-types.js';
|
|
2
|
+
import { EntityKeyInput, DynamoEntity } from '../core/entity.js';
|
|
3
|
+
import { EntitySchema } from '../core/core-types.js';
|
|
4
|
+
import { Select } from '@aws-sdk/client-dynamodb';
|
|
5
|
+
import { ZodObject } from 'zod/v4';
|
|
6
|
+
import { BaseConfig, BaseResult, BaseCommand, BasePaginatable } from './base-command.js';
|
|
7
|
+
import { QueryCommandInput, NativeAttributeValue, QueryCommandOutput } from '@aws-sdk/lib-dynamodb';
|
|
8
|
+
|
|
9
|
+
type QueryConfig<Schema extends ZodObject> = BaseConfig & EntityKeyInput<EntitySchema<Schema>> & {
|
|
9
10
|
sortKeyCondition?: Condition;
|
|
10
11
|
filter?: Condition;
|
|
11
12
|
limit?: number;
|
|
@@ -16,13 +17,13 @@ export type QueryConfig<Schema extends ZodObject> = BaseConfig & EntityKeyInput<
|
|
|
16
17
|
exclusiveStartKey?: Partial<EntitySchema<Schema>>;
|
|
17
18
|
pageSize?: number;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
type QueryResult<Schema extends ZodObject> = BaseResult & {
|
|
20
21
|
items: EntitySchema<Schema>[];
|
|
21
22
|
count: number;
|
|
22
23
|
scannedCount: number;
|
|
23
24
|
lastEvaluatedKey?: Partial<EntitySchema<Schema>> | undefined;
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
+
declare class Query<Schema extends ZodObject> implements BaseCommand<QueryResult<Schema>, Schema>, BasePaginatable<QueryResult<Schema>, Schema> {
|
|
26
27
|
#private;
|
|
27
28
|
constructor(config: QueryConfig<Schema>);
|
|
28
29
|
buildCommandInput(entity: DynamoEntity<Schema>): QueryCommandInput;
|
|
@@ -31,3 +32,6 @@ export declare class Query<Schema extends ZodObject> implements BaseCommand<Quer
|
|
|
31
32
|
execute(entity: DynamoEntity<Schema>): Promise<QueryResult<Schema>>;
|
|
32
33
|
executePaginated(entity: DynamoEntity<Schema>): AsyncGenerator<QueryResult<Schema>, void, unknown>;
|
|
33
34
|
}
|
|
35
|
+
|
|
36
|
+
export { Query };
|
|
37
|
+
export type { QueryConfig, QueryResult };
|