Skip to content

Commit b84efa5

Browse files
chore: wip
1 parent a412d90 commit b84efa5

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

storage/framework/core/testing/src/cache.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { dynamoDb } from '@stacksjs/cache'
2+
3+
import { CreateTableCommand, DynamoDBClient, KeyType, ScalarAttributeType } from '@aws-sdk/client-dynamodb'
4+
5+
const client = new DynamoDBClient({ endpoint: 'http://localhost:8000' })
6+
7+
export async function launch(): Promise<void> {
8+
await dynamoDb.launch()
9+
}
10+
11+
export async function createStacksTable(): Promise<void> {
12+
const params = {
13+
TableName: 'stacks',
14+
KeySchema: [
15+
{ AttributeName: 'key', KeyType: KeyType.HASH }, // Partition key
16+
],
17+
AttributeDefinitions: [
18+
{ AttributeName: 'key', AttributeType: ScalarAttributeType.S }, // S for String
19+
],
20+
ProvisionedThroughput: {
21+
ReadCapacityUnits: 5,
22+
WriteCapacityUnits: 5,
23+
},
24+
}
25+
26+
try {
27+
const data = await client.send(new CreateTableCommand(params))
28+
console.log('Table created successfully:', data)
29+
} catch (err) {
30+
console.error('Error creating table:', err)
31+
}
32+
}

storage/framework/core/testing/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ export * from 'bun:test'
22

33
export * from './database'
44
export * from './feature'
5+
6+
export * from './dynamodb'

0 commit comments

Comments
 (0)