bun-query-builder 0.1.9 → 0.1.11

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.
@@ -0,0 +1,338 @@
1
+ /**
2
+ * Create a new DynamoDB driver instance
3
+ */
4
+ export declare function createDynamoDBDriver(config: DynamoDBConfig): DynamoDBDriver;
5
+ /**
6
+ * DynamoDB Driver for bun-query-builder
7
+ *
8
+ * This driver supports DynamoDB's unique data model including:
9
+ * - Single table design patterns
10
+ * - Partition key (PK) and sort key (SK) based access
11
+ * - Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI)
12
+ * - DynamoDB-specific operations (Query, Scan, GetItem, PutItem, etc.)
13
+ */
14
+ /**
15
+ * DynamoDB key schema definition
16
+ */
17
+ export declare interface DynamoDBKeySchema {
18
+ partitionKey: string
19
+ sortKey?: string
20
+ }
21
+ /**
22
+ * DynamoDB attribute definition for table/index creation
23
+ */
24
+ export declare interface DynamoDBAttributeDefinition {
25
+ name: string
26
+ type: 'S' | 'N' | 'B'
27
+ }
28
+ /**
29
+ * Global Secondary Index definition
30
+ */
31
+ export declare interface DynamoDBGlobalSecondaryIndex {
32
+ indexName: string
33
+ keySchema: DynamoDBKeySchema
34
+ projection: {
35
+ type: 'ALL' | 'KEYS_ONLY' | 'INCLUDE'
36
+ nonKeyAttributes?: string[]
37
+ }
38
+ provisionedThroughput?: {
39
+ readCapacityUnits: number
40
+ writeCapacityUnits: number
41
+ }
42
+ }
43
+ /**
44
+ * Local Secondary Index definition
45
+ */
46
+ export declare interface DynamoDBLocalSecondaryIndex {
47
+ indexName: string
48
+ sortKey: string
49
+ projection: {
50
+ type: 'ALL' | 'KEYS_ONLY' | 'INCLUDE'
51
+ nonKeyAttributes?: string[]
52
+ }
53
+ }
54
+ /**
55
+ * DynamoDB table definition for single table design
56
+ */
57
+ export declare interface DynamoDBTableDefinition {
58
+ tableName: string
59
+ keySchema: DynamoDBKeySchema
60
+ attributeDefinitions: DynamoDBAttributeDefinition[]
61
+ globalSecondaryIndexes?: DynamoDBGlobalSecondaryIndex[]
62
+ localSecondaryIndexes?: DynamoDBLocalSecondaryIndex[]
63
+ billingMode?: 'PROVISIONED' | 'PAY_PER_REQUEST'
64
+ provisionedThroughput?: {
65
+ readCapacityUnits: number
66
+ writeCapacityUnits: number
67
+ }
68
+ ttlAttribute?: string
69
+ streamSpecification?: {
70
+ enabled: boolean
71
+ viewType?: 'KEYS_ONLY' | 'NEW_IMAGE' | 'OLD_IMAGE' | 'NEW_AND_OLD_IMAGES'
72
+ }
73
+ }
74
+ /**
75
+ * Single table design entity mapping
76
+ * Maps model entities to PK/SK patterns
77
+ */
78
+ export declare interface SingleTableEntityMapping {
79
+ entityType: string
80
+ pkPattern: string
81
+ skPattern: string
82
+ gsiMappings?: {
83
+ indexName: string
84
+ pkPattern: string
85
+ skPattern?: string
86
+ }[]
87
+ attributes?: Record<string, DynamoDBAttributeType>
88
+ }
89
+ /**
90
+ * DynamoDB filter condition for Query/Scan operations
91
+ */
92
+ export declare interface DynamoDBCondition {
93
+ attribute: string
94
+ operator: DynamoDBComparisonOperator | 'contains' | 'attribute_exists' | 'attribute_not_exists' | 'attribute_type' | 'IN'
95
+ value?: any
96
+ values?: any[]
97
+ }
98
+ /**
99
+ * DynamoDB Query parameters
100
+ */
101
+ export declare interface DynamoDBQueryParams {
102
+ tableName: string
103
+ indexName?: string
104
+ keyConditions: DynamoDBCondition[]
105
+ filterConditions?: DynamoDBCondition[]
106
+ projectionAttributes?: string[]
107
+ limit?: number
108
+ scanIndexForward?: boolean
109
+ exclusiveStartKey?: Record<string, any>
110
+ consistentRead?: boolean
111
+ }
112
+ /**
113
+ * DynamoDB Scan parameters
114
+ */
115
+ export declare interface DynamoDBScanParams {
116
+ tableName: string
117
+ indexName?: string
118
+ filterConditions?: DynamoDBCondition[]
119
+ projectionAttributes?: string[]
120
+ limit?: number
121
+ exclusiveStartKey?: Record<string, any>
122
+ segment?: number
123
+ totalSegments?: number
124
+ consistentRead?: boolean
125
+ }
126
+ /**
127
+ * DynamoDB GetItem parameters
128
+ */
129
+ export declare interface DynamoDBGetItemParams {
130
+ tableName: string
131
+ key: Record<string, any>
132
+ projectionAttributes?: string[]
133
+ consistentRead?: boolean
134
+ }
135
+ /**
136
+ * DynamoDB PutItem parameters
137
+ */
138
+ export declare interface DynamoDBPutItemParams {
139
+ tableName: string
140
+ item: Record<string, any>
141
+ conditionExpression?: string
142
+ returnValues?: 'NONE' | 'ALL_OLD'
143
+ }
144
+ /**
145
+ * DynamoDB UpdateItem parameters
146
+ */
147
+ export declare interface DynamoDBUpdateItemParams {
148
+ tableName: string
149
+ key: Record<string, any>
150
+ updateExpressions: {
151
+ set?: Record<string, any>
152
+ remove?: string[]
153
+ add?: Record<string, any>
154
+ delete?: Record<string, any>
155
+ }
156
+ conditionExpression?: string
157
+ returnValues?: 'NONE' | 'ALL_OLD' | 'UPDATED_OLD' | 'ALL_NEW' | 'UPDATED_NEW'
158
+ }
159
+ /**
160
+ * DynamoDB DeleteItem parameters
161
+ */
162
+ export declare interface DynamoDBDeleteItemParams {
163
+ tableName: string
164
+ key: Record<string, any>
165
+ conditionExpression?: string
166
+ returnValues?: 'NONE' | 'ALL_OLD'
167
+ }
168
+ /**
169
+ * DynamoDB BatchGetItem parameters
170
+ */
171
+ export declare interface DynamoDBBatchGetItemParams {
172
+ requestItems: {
173
+ [tableName: string]: {
174
+ keys: Record<string, any>[]
175
+ projectionAttributes?: string[]
176
+ consistentRead?: boolean
177
+ }
178
+ }
179
+ }
180
+ /**
181
+ * DynamoDB BatchWriteItem parameters
182
+ */
183
+ export declare interface DynamoDBBatchWriteItemParams {
184
+ requestItems: {
185
+ [tableName: string]: (
186
+ | { putRequest: { item: Record<string, any> } }
187
+ | { deleteRequest: { key: Record<string, any> } }
188
+ )[]
189
+ }
190
+ }
191
+ /**
192
+ * DynamoDB TransactWriteItems parameters
193
+ */
194
+ export declare interface DynamoDBTransactWriteParams {
195
+ transactItems: (
196
+ | { put: DynamoDBPutItemParams }
197
+ | { update: DynamoDBUpdateItemParams }
198
+ | { delete: DynamoDBDeleteItemParams }
199
+ | { conditionCheck: { tableName: string, key: Record<string, any>, conditionExpression: string } }
200
+ )[]
201
+ clientRequestToken?: string
202
+ }
203
+ /**
204
+ * DynamoDB Driver Interface
205
+ *
206
+ * Unlike SQL drivers, DynamoDB operations are API-based rather than SQL-based.
207
+ * This interface provides methods to build DynamoDB API request parameters.
208
+ */
209
+ export declare interface DynamoDBDriver {
210
+ createTable: (definition: DynamoDBTableDefinition) => DynamoDBTableDefinition
211
+ deleteTable: (tableName: string) => { tableName: string }
212
+ registerEntity: (mapping: SingleTableEntityMapping) => void
213
+ getEntityMapping: (entityType: string) => SingleTableEntityMapping | undefined
214
+ buildPrimaryKey: (entityType: string, values: Record<string, any>) => { pk: string, sk: string }
215
+ parseEntityFromItem: (item: Record<string, any>) => { entityType: string, data: Record<string, any> } | null
216
+ buildQueryParams: (params: Partial<DynamoDBQueryParams>) => DynamoDBQueryParams
217
+ buildScanParams: (params: Partial<DynamoDBScanParams>) => DynamoDBScanParams
218
+ buildGetItemParams: (params: Partial<DynamoDBGetItemParams>) => DynamoDBGetItemParams
219
+ buildPutItemParams: (params: Partial<DynamoDBPutItemParams>) => DynamoDBPutItemParams
220
+ buildUpdateItemParams: (params: Partial<DynamoDBUpdateItemParams>) => DynamoDBUpdateItemParams
221
+ buildDeleteItemParams: (params: Partial<DynamoDBDeleteItemParams>) => DynamoDBDeleteItemParams
222
+ buildBatchGetItemParams: (params: Partial<DynamoDBBatchGetItemParams>) => DynamoDBBatchGetItemParams
223
+ buildBatchWriteItemParams: (params: Partial<DynamoDBBatchWriteItemParams>) => DynamoDBBatchWriteItemParams
224
+ buildTransactWriteParams: (params: Partial<DynamoDBTransactWriteParams>) => DynamoDBTransactWriteParams
225
+ buildKeyConditionExpression: (conditions: DynamoDBCondition[]) => {
226
+ expression: string
227
+ expressionAttributeNames: Record<string, string>
228
+ expressionAttributeValues: Record<string, any>
229
+ }
230
+ buildFilterExpression: (conditions: DynamoDBCondition[]) => {
231
+ expression: string
232
+ expressionAttributeNames: Record<string, string>
233
+ expressionAttributeValues: Record<string, any>
234
+ }
235
+ buildUpdateExpression: (updates: DynamoDBUpdateItemParams['updateExpressions']) => {
236
+ expression: string
237
+ expressionAttributeNames: Record<string, string>
238
+ expressionAttributeValues: Record<string, any>
239
+ }
240
+ buildProjectionExpression: (attributes: string[]) => {
241
+ expression: string
242
+ expressionAttributeNames: Record<string, string>
243
+ }
244
+ marshall: (item: Record<string, any>) => Record<string, any>
245
+ unmarshall: (item: Record<string, any>) => Record<string, any>
246
+ }
247
+ /**
248
+ * Single table design configuration
249
+ */
250
+ export declare interface SingleTableConfig {
251
+ enabled: boolean
252
+ pkAttribute?: string
253
+ skAttribute?: string
254
+ entityTypeAttribute?: string
255
+ keyDelimiter?: string
256
+ }
257
+ /**
258
+ * DynamoDB configuration options
259
+ */
260
+ export declare interface DynamoDBConfig {
261
+ region: string
262
+ endpoint?: string
263
+ credentials?: {
264
+ accessKeyId: string
265
+ secretAccessKey: string
266
+ sessionToken?: string
267
+ }
268
+ tableName?: string
269
+ entityMappings?: SingleTableEntityMapping[]
270
+ defaultBillingMode?: 'PROVISIONED' | 'PAY_PER_REQUEST'
271
+ singleTable?: SingleTableConfig
272
+ }
273
+ /**
274
+ * DynamoDB attribute type mapping
275
+ */
276
+ export type DynamoDBAttributeType = 'S' | 'N' | 'B' | 'SS' | 'NS' | 'BS' | 'M' | 'L' | 'BOOL' | 'NULL'
277
+ /**
278
+ * DynamoDB query condition operators
279
+ */
280
+ export type DynamoDBComparisonOperator = | '='
281
+ | '<'
282
+ | '<='
283
+ | '>'
284
+ | '>='
285
+ | 'BETWEEN'
286
+ | 'begins_with'
287
+ /**
288
+ * DynamoDB Driver Implementation
289
+ */
290
+ export declare class DynamoDBDriverImpl implements DynamoDBDriver {
291
+ private config: DynamoDBConfig;
292
+ private entityMappings: Map<string, SingleTableEntityMapping>;
293
+ constructor(config: DynamoDBConfig);
294
+ createTable(definition: DynamoDBTableDefinition): DynamoDBTableDefinition;
295
+ deleteTable(tableName: string): { tableName: string };
296
+ registerEntity(mapping: SingleTableEntityMapping): void;
297
+ getEntityMapping(entityType: string): SingleTableEntityMapping | undefined;
298
+ buildPrimaryKey(entityType: string, values: Record<string, any>): { pk: string, sk: string };
299
+ parseEntityFromItem(item: Record<string, any>): { entityType: string, data: Record<string, any> } | null;
300
+ buildQueryParams(params: Partial<DynamoDBQueryParams>): DynamoDBQueryParams;
301
+ buildScanParams(params: Partial<DynamoDBScanParams>): DynamoDBScanParams;
302
+ buildGetItemParams(params: Partial<DynamoDBGetItemParams>): DynamoDBGetItemParams;
303
+ buildPutItemParams(params: Partial<DynamoDBPutItemParams>): DynamoDBPutItemParams;
304
+ buildUpdateItemParams(params: Partial<DynamoDBUpdateItemParams>): DynamoDBUpdateItemParams;
305
+ buildDeleteItemParams(params: Partial<DynamoDBDeleteItemParams>): DynamoDBDeleteItemParams;
306
+ buildBatchGetItemParams(params: Partial<DynamoDBBatchGetItemParams>): DynamoDBBatchGetItemParams;
307
+ buildBatchWriteItemParams(params: Partial<DynamoDBBatchWriteItemParams>): DynamoDBBatchWriteItemParams;
308
+ buildTransactWriteParams(params: Partial<DynamoDBTransactWriteParams>): DynamoDBTransactWriteParams;
309
+ buildKeyConditionExpression(conditions: DynamoDBCondition[]): {
310
+ expression: string
311
+ expressionAttributeNames: Record<string, string>
312
+ expressionAttributeValues: Record<string, any>
313
+ };
314
+ buildFilterExpression(conditions: DynamoDBCondition[]): {
315
+ expression: string
316
+ expressionAttributeNames: Record<string, string>
317
+ expressionAttributeValues: Record<string, any>
318
+ };
319
+ buildUpdateExpression(updates: DynamoDBUpdateItemParams['updateExpressions']): {
320
+ expression: string
321
+ expressionAttributeNames: Record<string, string>
322
+ expressionAttributeValues: Record<string, any>
323
+ };
324
+ buildProjectionExpression(attributes: string[]): {
325
+ expression: string
326
+ expressionAttributeNames: Record<string, string>
327
+ };
328
+ marshall(item: Record<string, any>): Record<string, any>;
329
+ unmarshall(item: Record<string, any>): Record<string, any>;
330
+ private interpolatePattern(pattern: string, values: Record<string, any>): string;
331
+ private buildExpression(conditions: DynamoDBCondition[], joiner: 'AND' | 'OR'): {
332
+ expression: string
333
+ expressionAttributeNames: Record<string, string>
334
+ expressionAttributeValues: Record<string, any>
335
+ };
336
+ private marshallValue(value: any): any;
337
+ private unmarshallValue(value: any): any;
338
+ }
@@ -4,7 +4,33 @@ import { SQLiteDriver } from './sqlite';
4
4
  import type { DialectDriver } from './postgres';
5
5
  import type { SupportedDialect } from '../types';
6
6
  export type { DialectDriver } from './postgres';
7
+ export type {
8
+ DynamoDBAttributeDefinition,
9
+ DynamoDBAttributeType,
10
+ DynamoDBBatchGetItemParams,
11
+ DynamoDBBatchWriteItemParams,
12
+ DynamoDBComparisonOperator,
13
+ DynamoDBCondition,
14
+ DynamoDBConfig,
15
+ DynamoDBDeleteItemParams,
16
+ DynamoDBDriver,
17
+ DynamoDBGetItemParams,
18
+ DynamoDBGlobalSecondaryIndex,
19
+ DynamoDBKeySchema,
20
+ DynamoDBLocalSecondaryIndex,
21
+ DynamoDBPutItemParams,
22
+ DynamoDBQueryParams,
23
+ DynamoDBScanParams,
24
+ DynamoDBTableDefinition,
25
+ DynamoDBTransactWriteParams,
26
+ DynamoDBUpdateItemParams,
27
+ SingleTableEntityMapping,
28
+ } from './dynamodb';
7
29
  export declare function getDialectDriver(dialect: SupportedDialect): DialectDriver;
8
30
  export { MySQLDriver } from './mysql';
9
31
  export { PostgresDriver } from './postgres';
10
- export { SQLiteDriver } from './sqlite';
32
+ export { SQLiteDriver } from './sqlite';
33
+ export {
34
+ createDynamoDBDriver,
35
+ DynamoDBDriverImpl,
36
+ } from './dynamodb';
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Create a native DynamoDB client
3
+ */
4
+ export declare function createClient(config: DynamoDBClientConfig): DynamoDBClient;
5
+ /**
6
+ * Native DynamoDB HTTP Client
7
+ *
8
+ * Zero-dependency DynamoDB client using native fetch and AWS Signature V4.
9
+ * Implements all core DynamoDB operations without requiring @aws-sdk.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const client = new DynamoDBClient({
14
+ * region: 'us-east-1',
15
+ * credentials: {
16
+ * accessKeyId: 'AKIA...',
17
+ * secretAccessKey: '...',
18
+ * },
19
+ * })
20
+ *
21
+ * const result = await client.query({
22
+ * TableName: 'MyTable',
23
+ * KeyConditionExpression: 'pk = :pk',
24
+ * ExpressionAttributeValues: { ':pk': { S: 'USER#123' } },
25
+ * })
26
+ * ```
27
+ */
28
+ // ============================================================================
29
+ // Types
30
+ // ============================================================================
31
+ export declare interface DynamoDBCredentials {
32
+ accessKeyId: string
33
+ secretAccessKey: string
34
+ sessionToken?: string
35
+ }
36
+ export declare interface DynamoDBClientConfig {
37
+ region: string
38
+ endpoint?: string
39
+ credentials?: DynamoDBCredentials
40
+ }
41
+ export declare interface DynamoDBQueryInput {
42
+ TableName: string
43
+ IndexName?: string
44
+ KeyConditionExpression?: string
45
+ FilterExpression?: string
46
+ ProjectionExpression?: string
47
+ ExpressionAttributeNames?: Record<string, string>
48
+ ExpressionAttributeValues?: Record<string, any>
49
+ Limit?: number
50
+ ScanIndexForward?: boolean
51
+ ConsistentRead?: boolean
52
+ ExclusiveStartKey?: Record<string, any>
53
+ Select?: 'ALL_ATTRIBUTES' | 'ALL_PROJECTED_ATTRIBUTES' | 'SPECIFIC_ATTRIBUTES' | 'COUNT'
54
+ }
55
+ export declare interface DynamoDBScanInput {
56
+ TableName: string
57
+ IndexName?: string
58
+ FilterExpression?: string
59
+ ProjectionExpression?: string
60
+ ExpressionAttributeNames?: Record<string, string>
61
+ ExpressionAttributeValues?: Record<string, any>
62
+ Limit?: number
63
+ ConsistentRead?: boolean
64
+ ExclusiveStartKey?: Record<string, any>
65
+ Segment?: number
66
+ TotalSegments?: number
67
+ Select?: 'ALL_ATTRIBUTES' | 'ALL_PROJECTED_ATTRIBUTES' | 'SPECIFIC_ATTRIBUTES' | 'COUNT'
68
+ }
69
+ export declare interface DynamoDBGetItemInput {
70
+ TableName: string
71
+ Key: Record<string, any>
72
+ ProjectionExpression?: string
73
+ ExpressionAttributeNames?: Record<string, string>
74
+ ConsistentRead?: boolean
75
+ }
76
+ export declare interface DynamoDBPutItemInput {
77
+ TableName: string
78
+ Item: Record<string, any>
79
+ ConditionExpression?: string
80
+ ExpressionAttributeNames?: Record<string, string>
81
+ ExpressionAttributeValues?: Record<string, any>
82
+ ReturnValues?: 'NONE' | 'ALL_OLD'
83
+ }
84
+ export declare interface DynamoDBUpdateItemInput {
85
+ TableName: string
86
+ Key: Record<string, any>
87
+ UpdateExpression?: string
88
+ ConditionExpression?: string
89
+ ExpressionAttributeNames?: Record<string, string>
90
+ ExpressionAttributeValues?: Record<string, any>
91
+ ReturnValues?: 'NONE' | 'ALL_OLD' | 'UPDATED_OLD' | 'ALL_NEW' | 'UPDATED_NEW'
92
+ }
93
+ export declare interface DynamoDBDeleteItemInput {
94
+ TableName: string
95
+ Key: Record<string, any>
96
+ ConditionExpression?: string
97
+ ExpressionAttributeNames?: Record<string, string>
98
+ ExpressionAttributeValues?: Record<string, any>
99
+ ReturnValues?: 'NONE' | 'ALL_OLD'
100
+ }
101
+ export declare interface DynamoDBBatchGetItemInput {
102
+ RequestItems: {
103
+ [tableName: string]: {
104
+ Keys: Record<string, any>[]
105
+ ProjectionExpression?: string
106
+ ExpressionAttributeNames?: Record<string, string>
107
+ ConsistentRead?: boolean
108
+ }
109
+ }
110
+ }
111
+ export declare interface DynamoDBBatchWriteItemInput {
112
+ RequestItems: {
113
+ [tableName: string]: (
114
+ | { PutRequest: { Item: Record<string, any> } }
115
+ | { DeleteRequest: { Key: Record<string, any> } }
116
+ )[]
117
+ }
118
+ }
119
+ export declare interface DynamoDBTransactWriteItemsInput {
120
+ TransactItems: (
121
+ | { Put: { TableName: string, Item: Record<string, any>, ConditionExpression?: string, ExpressionAttributeNames?: Record<string, string>, ExpressionAttributeValues?: Record<string, any> } }
122
+ | { Update: { TableName: string, Key: Record<string, any>, UpdateExpression: string, ConditionExpression?: string, ExpressionAttributeNames?: Record<string, string>, ExpressionAttributeValues?: Record<string, any> } }
123
+ | { Delete: { TableName: string, Key: Record<string, any>, ConditionExpression?: string, ExpressionAttributeNames?: Record<string, string>, ExpressionAttributeValues?: Record<string, any> } }
124
+ | { ConditionCheck: { TableName: string, Key: Record<string, any>, ConditionExpression: string, ExpressionAttributeNames?: Record<string, string>, ExpressionAttributeValues?: Record<string, any> } }
125
+ )[]
126
+ ClientRequestToken?: string
127
+ }
128
+ export declare interface DynamoDBQueryOutput {
129
+ Items?: Record<string, any>[]
130
+ Count?: number
131
+ ScannedCount?: number
132
+ LastEvaluatedKey?: Record<string, any>
133
+ ConsumedCapacity?: any
134
+ }
135
+ export declare interface DynamoDBGetItemOutput {
136
+ Item?: Record<string, any>
137
+ ConsumedCapacity?: any
138
+ }
139
+ export declare interface DynamoDBPutItemOutput {
140
+ Attributes?: Record<string, any>
141
+ ConsumedCapacity?: any
142
+ }
143
+ export declare interface DynamoDBUpdateItemOutput {
144
+ Attributes?: Record<string, any>
145
+ ConsumedCapacity?: any
146
+ }
147
+ export declare interface DynamoDBDeleteItemOutput {
148
+ Attributes?: Record<string, any>
149
+ ConsumedCapacity?: any
150
+ }
151
+ /**
152
+ * Native DynamoDB HTTP Client
153
+ *
154
+ * Uses AWS Signature V4 and native fetch for zero-dependency DynamoDB access.
155
+ */
156
+ export declare class DynamoDBClient {
157
+ private config: DynamoDBClientConfig;
158
+ private endpoint: string;
159
+ private credentials: DynamoDBCredentials;
160
+ constructor(config: DynamoDBClientConfig);
161
+ private execute(operation: string, input: any): Promise<any>;
162
+ query(input: DynamoDBQueryInput): Promise<DynamoDBQueryOutput>;
163
+ scan(input: DynamoDBScanInput): Promise<DynamoDBQueryOutput>;
164
+ getItem(input: DynamoDBGetItemInput): Promise<DynamoDBGetItemOutput>;
165
+ putItem(input: DynamoDBPutItemInput): Promise<DynamoDBPutItemOutput>;
166
+ updateItem(input: DynamoDBUpdateItemInput): Promise<DynamoDBUpdateItemOutput>;
167
+ deleteItem(input: DynamoDBDeleteItemInput): Promise<DynamoDBDeleteItemOutput>;
168
+ batchGetItem(input: DynamoDBBatchGetItemInput): Promise<{ Responses?: Record<string, Record<string, any>[]>, UnprocessedKeys?: any }>;
169
+ batchWriteItem(input: DynamoDBBatchWriteItemInput): Promise<{ UnprocessedItems?: any }>;
170
+ transactWriteItems(input: DynamoDBTransactWriteItemsInput): Promise<{}>;
171
+ describeTable(tableName: string): Promise<any>;
172
+ createTable(input: any): Promise<any>;
173
+ deleteTable(tableName: string): Promise<any>;
174
+ listTables(input?: { ExclusiveStartTableName?: string, Limit?: number }): Promise<{ TableNames: string[], LastEvaluatedTableName?: string }>;
175
+ updateTable(input: any): Promise<any>;
176
+ updateTimeToLive(input: any): Promise<any>;
177
+ describeTimeToLive(tableName: string): Promise<any>;
178
+ }
@@ -0,0 +1,156 @@
1
+ import type { DynamoDBConfig, DynamoDBDriver, SingleTableEntityMapping, } from '../drivers/dynamodb';
2
+ export type {
3
+ DynamoDBConfig,
4
+ DynamoDBDriver,
5
+ SingleTableEntityMapping,
6
+ } from '../drivers/dynamodb';
7
+ export type { DynamoDBClientConfig, DynamoDBCredentials } from './client';
8
+ export type { ModelConfig, ModelQueryBuilder } from './model';
9
+ export type { MigrationDriverConfig, MigrationResult } from './migration-driver';
10
+ export type {
11
+ DynamoDBMigrationPlan,
12
+ DynamoDBMigrationOperation,
13
+ DynamoDBMigrationOperationType,
14
+ DynamoDBMigrationState,
15
+ DynamoDBModelSchema,
16
+ DynamoDBGSIDefinition,
17
+ DynamoDBLSIDefinition,
18
+ } from './migrations';
19
+ /**
20
+ * Create a new DynamoDB client instance
21
+ */
22
+ export declare function createDynamo(): DynamoClient;
23
+ /**
24
+ * DynamoDB client singleton
25
+ */
26
+ export declare const dynamo: DynamoClient;
27
+ /**
28
+ * DynamoDB connection configuration
29
+ */
30
+ export declare interface DynamoConnectionConfig {
31
+ region: string
32
+ table: string
33
+ endpoint?: string
34
+ credentials?: {
35
+ accessKeyId: string
36
+ secretAccessKey: string
37
+ sessionToken?: string
38
+ }
39
+ pkAttribute?: string
40
+ skAttribute?: string
41
+ entityTypeAttribute?: string
42
+ keyDelimiter?: string
43
+ }
44
+ /**
45
+ * Sort key builder for fluent API
46
+ */
47
+ export declare interface SortKeyBuilder {
48
+ equals(value: string): EntityQueryBuilder
49
+ beginsWith(prefix: string): EntityQueryBuilder
50
+ between(start: string, end: string): EntityQueryBuilder
51
+ lt(value: string): EntityQueryBuilder
52
+ lte(value: string): EntityQueryBuilder
53
+ gt(value: string): EntityQueryBuilder
54
+ gte(value: string): EntityQueryBuilder
55
+ }
56
+ /**
57
+ * Batch write operation
58
+ */
59
+ export declare interface BatchWriteOperation {
60
+ put?: { entity: string, item: Record<string, any> }
61
+ delete?: { entity: string, pk: string, sk: string }
62
+ }
63
+ /**
64
+ * Transact write operation
65
+ */
66
+ export declare interface TransactWriteOperation {
67
+ put?: { entity: string, item: Record<string, any>, condition?: string }
68
+ update?: { entity: string, pk: string, sk?: string, set?: Record<string, any>, add?: Record<string, number>, remove?: string[] }
69
+ delete?: { entity: string, pk: string, sk: string, condition?: string }
70
+ conditionCheck?: { entity: string, pk: string, sk: string, condition: string }
71
+ }
72
+ /**
73
+ * DynamoDB query result
74
+ */
75
+ export declare interface DynamoDBQueryResult<T = any> {
76
+ items: T[]
77
+ count: number
78
+ scannedCount?: number
79
+ lastKey?: Record<string, any>
80
+ }
81
+ /**
82
+ * Entity-centric query builder for DynamoDB
83
+ */
84
+ export declare class EntityQueryBuilder<T = any> {
85
+ private driver: DynamoDBDriver;
86
+ private client: any;
87
+ private tableName: string;
88
+ private pkAttribute: string;
89
+ private skAttribute: string;
90
+ private entityTypeAttr: string;
91
+ private delimiter: string;
92
+ private _entityType?: string;
93
+ private _pkValue?: string;
94
+ private _skCondition?: { type: 'eq' | 'begins_with' | 'between' | 'lt' | 'lte' | 'gt' | 'gte', value: string, value2?: string };
95
+ private _indexName?: string;
96
+ private _projectionAttrs: string[];
97
+ private _filterConditions: Array<{ attribute: string, operator: string, value?: any, values?: any[] }>;
98
+ private _limitValue?: number;
99
+ private _scanForward: boolean;
100
+ private _consistentRead: boolean;
101
+ private _startKey?: Record<string, any>;
102
+ constructor(driver: DynamoDBDriver, client: any, tableName: string, config: { pkAttribute: string, skAttribute: string, entityTypeAttribute: string, keyDelimiter: string });
103
+ entity(entityType: string): this;
104
+ pk(value: string): this;
105
+ index(indexName: string): this;
106
+ project(attributes: string[]): this;
107
+ filter(attribute: string, operator: string, value?: any): this;
108
+ where(attribute: string, value: any): this;
109
+ whereIn(attribute: string, values: any[]): this;
110
+ limit(count: number): this;
111
+ asc(): this;
112
+ desc(): this;
113
+ consistent(): this;
114
+ startFrom(key: Record<string, any>): this;
115
+ toRequest(): Record<string, any>;
116
+ get(): Promise<T[]>;
117
+ first(): Promise<T | undefined>;
118
+ getAll(): Promise<T[]>;
119
+ count(): Promise<number>;
120
+ }
121
+ /**
122
+ * DynamoDB client with entity-centric API
123
+ */
124
+ declare class DynamoClient {
125
+ private driver?: DynamoDBDriver;
126
+ private client?: any;
127
+ private tableName: string;
128
+ private pkAttribute: string;
129
+ private skAttribute: string;
130
+ private entityTypeAttr: string;
131
+ private delimiter: string;
132
+ private entityMappings: Map<string, SingleTableEntityMapping>;
133
+ connection(config: DynamoConnectionConfig): this;
134
+ setClient(client: any): this;
135
+ registerEntity(mapping: SingleTableEntityMapping): this;
136
+ entity<T = any>(entityType: string): EntityQueryBuilder<T>;
137
+ batchWrite(operations: BatchWriteOperation[]): Promise<void>;
138
+ transactWrite(operations: TransactWriteOperation[]): Promise<void>;
139
+ getDriver(): DynamoDBDriver | undefined;
140
+ }
141
+ export { Model, configureModels } from './model';
142
+ export { DynamoDBClient, createClient } from './client';
143
+ export {
144
+ DynamoDBMigrationDriver,
145
+ createMigrationDriver,
146
+ migrateModels,
147
+ } from './migration-driver';
148
+ export {
149
+ buildMigrationPlan as buildDynamoDBMigrationPlan,
150
+ extractTableDefinition,
151
+ extractModelSchema,
152
+ convertSchemaToDefinition,
153
+ hashTableDefinition,
154
+ isDefinitionEqual,
155
+ } from './migrations';
156
+ export { DynamoDBMigrationTracker, MIGRATIONS_TABLE } from './migration-tracker';