Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported the missing SQLite package code #204

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/packages/emmett-sqlite/src/connection/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sqliteConnection';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { afterEach, beforeEach, describe, it } from 'node:test';
import path from 'path';
import { fileURLToPath } from 'url';
import { v4 as uuid } from 'uuid';
import { InMemorySQLiteDatabase, sqliteConnection } from '../sqliteConnection';
import { InMemorySQLiteDatabase, sqliteConnection } from '../connection';
import {
type DiscountApplied,
type PricedProductItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
InMemorySQLiteDatabase,
sqliteConnection,
type SQLiteConnection,
} from '../sqliteConnection';
} from '../connection';
import { createEventStoreSchema } from './schema';
import { appendToStream } from './schema/appendToStream';
import { readStream } from './schema/readStream';
Expand Down
2 changes: 2 additions & 0 deletions src/packages/emmett-sqlite/src/eventStore/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './schema';
export * from './SQLiteEventStore';
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
InMemorySQLiteDatabase,
sqliteConnection,
type SQLiteConnection,
} from '../../sqliteConnection';
} from '../../connection';
import { appendToStream } from './appendToStream';

export type PricedProductItem = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
type Parameters,
type SQLiteConnection,
type SQLiteError,
} from '../../sqliteConnection';
} from '../../connection';
import { defaultTag, messagesTable, streamsTable } from './typing';

export type AppendEventResult =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
InMemorySQLiteDatabase,
sqliteConnection,
type SQLiteConnection,
} from '../../sqliteConnection';
} from '../../connection';
import { createEventStoreSchema } from '../schema';

type TableExists = {
Expand Down
16 changes: 3 additions & 13 deletions src/packages/emmett-sqlite/src/eventStore/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import { type SQLiteConnection } from '../../sqliteConnection';
import { messagesTableSQL, streamsTableSQL } from './tables';

export * from './appendToStream';
export * from './readStream';
export * from './tables';

export const schemaSQL: string[] = [streamsTableSQL, messagesTableSQL];

export const createEventStoreSchema = async (
db: SQLiteConnection,
): Promise<void> => {
for (const sql of schemaSQL) {
await db.command(sql);
}
};
export * from './typing';
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
InMemorySQLiteDatabase,
sqliteConnection,
type SQLiteConnection,
} from '../../sqliteConnection';
} from '../../connection';
import { appendToStream } from './appendToStream';
import { readStream } from './readStream';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type ReadStreamOptions,
type ReadStreamResult,
} from '@event-driven-io/emmett';
import { type SQLiteConnection } from '../../sqliteConnection';
import { type SQLiteConnection } from '../../connection';
import { SQLiteEventStoreDefaultStreamVersion } from '../SQLiteEventStore';
import { defaultTag, messagesTable } from './typing';

Expand Down
11 changes: 11 additions & 0 deletions src/packages/emmett-sqlite/src/eventStore/schema/tables.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { SQLiteConnection } from '../../connection';
import { globalTag, messagesTable, streamsTable } from './typing';

export const sql = (sql: string) => sql;
Expand Down Expand Up @@ -33,3 +34,13 @@ export const messagesTableSQL = sql(
);
`,
);

export const schemaSQL: string[] = [streamsTableSQL, messagesTableSQL];

export const createEventStoreSchema = async (
db: SQLiteConnection,
): Promise<void> => {
for (const sql of schemaSQL) {
await db.command(sql);
}
};
2 changes: 2 additions & 0 deletions src/packages/emmett-sqlite/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './connection';
export * from './eventStore';