Skip to content

Commit f28bab6

Browse files
committed
reorg into packages dir
1 parent d6c109b commit f28bab6

File tree

11 files changed

+40
-30
lines changed

11 files changed

+40
-30
lines changed

README_Refactor.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
Refactor Summary
1+
Refactor 12.23.24
22
- Added SQLiteCloudClient class and createClient function
33
- Extracted PubSub from Database to SQLiteCloudClient
4-
- Added fetch and fetchWithAuth
5-
- Added Weblite endpoint methods for upload, download, delete, and listDatabases
4+
- Added fetch, customFetch support and fetchWithAuth
5+
- Added Weblite methods for upload, download, delete, and listDatabases
66
- Refactored PubSub to be more intuitive and easier to use
77
- Added FileClient class and methods for file upload and download
8+
- Added SQLiteCloudVectorClient class and methods for upsert and query
89

9-
TODO: Polish code, add error handling, Write tests
10+
Refactor 12.24.14
11+
Scope of work:
12+
- refactor new code to improve code smells and readability
13+
- Recap progress.
14+
- write tests for each new class
15+
- Idenitfy protential issues
16+
- Plan refactor with psuedo code
17+
- Implement refactor
18+
- Test refactor
19+
20+
TODO:
21+
- add error handling and logging
22+
- add tests
23+
- add comments
24+
- add documentation

demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pubSub.notifyChannel('messages', 'my message')
4848
* In the refactor, Database still exists and works as before.
4949
*/
5050

51-
import { createClient } from './src/refactor/SQLiteCloudClient'
51+
import { createClient } from './src/SQLiteCloudClient'
5252

5353
const client = createClient('connection-string/chinook.db')
5454

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "1.0.357",
3+
"version": "1.0.358",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import { Database } from '../drivers/database'
2-
import { Fetch, fetchWithAuth } from './fetch'
3-
import { SQLiteCloudPubSubClient } from './SQLiteCloudPubSubClient'
4-
import { SQLiteCloudWebliteClient } from './SQLiteCloudWebliteClient'
5-
import { SQLiteCloudFileClient } from './SQLiteCloudFileClient'
6-
import { SQLiteCloudCommand } from '../drivers/types'
7-
import { getDefaultDatabase } from './utils'
1+
import { Database } from './drivers/database'
2+
import { Fetch, fetchWithAuth } from './packages/utils/fetch'
3+
import { SQLiteCloudPubSubClient } from './packages/pubsub/SQLiteCloudPubSubClient'
4+
import { SQLiteCloudWebliteClient } from './packages/weblite/SQLiteCloudWebliteClient'
5+
import { SQLiteCloudFileClient } from './packages/storage/SQLiteCloudFileClient'
6+
import { SQLiteCloudCommand } from './drivers/types'
7+
import { getDefaultDatabase } from './packages/utils'
88

99
interface SQLiteCloudClientConfig {
1010
connectionString: string
1111
fetch?: Fetch
1212
}
1313

14-
15-
1614
export class SQLiteCloudClient {
1715
private connectionString: string
1816
private fetch: Fetch

src/refactor/SQLiteCloudPubSubClient.ts renamed to src/packages/pubsub/SQLiteCloudPubSubClient.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { SQLiteCloudConnection } from '../drivers/connection'
2-
import SQLiteCloudTlsConnection from '../drivers/connection-tls'
3-
import { Database } from '../drivers/database'
4-
import { SQLiteCloudConfig } from '../drivers/types'
5-
import { formatCommand, getDbFromConfig } from './utils'
1+
import { SQLiteCloudConnection } from '../../drivers/connection'
2+
import SQLiteCloudTlsConnection from '../../drivers/connection-tls'
3+
import { Database } from '../../drivers/database'
4+
import { getDbFromConfig } from '../utils'
65

76
export type PubSubCallback<T = any> = (error: Error | null, results?: T) => void
87

src/refactor/SQLiteCloudFileClient.ts renamed to src/packages/storage/SQLiteCloudFileClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SQLiteCloudError } from "../drivers/types"
2-
import { getAPIUrl } from "./utils"
3-
import { Fetch, fetchWithAuth } from "./fetch"
1+
import { SQLiteCloudError } from "../../drivers/types"
2+
import { getAPIUrl } from "../utils"
3+
import { Fetch, fetchWithAuth } from "../utils/fetch"
44

55
interface SQLiteCloudFile {
66
createBucket(bucket: string, path: string): Promise<Response>

src/packages/test/SQLiteCloudClient.test.ts

Whitespace-only changes.

src/refactor/SQLiteCloudVectorClient.ts renamed to src/packages/vector/SQLiteCloudVectorClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Database } from "../drivers/database";
1+
import { Database } from "../../drivers/database";
22

33
interface Column {
44
name: string;

0 commit comments

Comments
 (0)