This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove sqlite, refactor to use level (#69)
* init * checkpoint, db dump method, refactor with-db * fix zod level db fns, migrate "create.ts" from dev_package_examples * wip refactoring dev server to level from sqlite * Added a new test for the `dev_package_examples/list.test.ts` file. * Replaced Kysely query with ZodLevelDatabase dump and mapping to required format. * list endpoint support * wip progress on refactor to level * db reset * implement export file refactor * implement download * fix tests * remove log line * small fixes to prevent level open/close issues * remove sqlite * remove sqlite types
- Loading branch information
Showing
40 changed files
with
634 additions
and
387 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { withWinterSpec } from "src/with-winter-spec" | ||
import { z } from "zod" | ||
|
||
export default withWinterSpec({ | ||
methods: ["GET"], | ||
jsonResponse: z.object({ | ||
dev_server_database_dump: z.any(), | ||
}), | ||
auth: "none", | ||
})(async (req, ctx) => { | ||
return new Response( | ||
JSON.stringify( | ||
{ | ||
dev_server_database_dump: await ctx.db.dump(), | ||
}, | ||
null, | ||
" " | ||
), | ||
{ | ||
headers: { | ||
"content-type": "application/json", | ||
}, | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { sql } from "kysely" | ||
import { withWinterSpec } from "src/with-winter-spec" | ||
import { z } from "zod" | ||
import { unlinkSync } from "fs" | ||
import { getDbFilePath } from "src/db/get-db" | ||
|
||
export default (req: Request) => { | ||
unlinkSync(getDbFilePath()) | ||
|
||
export default withWinterSpec({ | ||
methods: ["GET", "POST"], | ||
auth: "none", | ||
})(async (req, ctx) => { | ||
await ctx.db.clear() | ||
return new Response(JSON.stringify({}), { | ||
headers: { | ||
"content-type": "application/json", | ||
}, | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.