@tscircuit/cli 0.0.132 → 0.0.134
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.
- package/dev-server-api/routes/api/dev_package_examples/create.ts +1 -1
- package/dev-server-api/routes/api/dev_package_examples/get.ts +1 -1
- package/dev-server-api/routes/api/dev_package_examples/update.ts +1 -1
- package/dev-server-api/src/db/zod-level-db.ts +2 -1
- package/dev-server-api/src/middlewares/with-debug-request-logging.ts +13 -0
- package/dev-server-api/src/with-winter-spec.ts +2 -1
- package/dev-server-api/tests/routes/dev_package_examples/update.test.ts +10 -0
- package/dev-server-frontend/package-lock.json +3 -3
- package/dist/cli.js +30 -18
- package/example-project/package-lock.json +3 -3
- package/example-project/src/manual-edits.ts +18 -0
- package/lib/cmd-fns/dev/start-export-request-watcher.ts +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ export default withWinterSpec({
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
const dev_package_example = await ctx.db.put("dev_package_example", {
|
|
31
|
-
|
|
31
|
+
...existingDevPackageExample,
|
|
32
32
|
file_path: req.jsonBody.file_path,
|
|
33
33
|
export_name: req.jsonBody.export_name,
|
|
34
34
|
error: req.jsonBody.error,
|
|
@@ -25,7 +25,8 @@ export class ZodLevelDatabase {
|
|
|
25
25
|
id: string | number
|
|
26
26
|
): Promise<DBSchemaType[K] | null> {
|
|
27
27
|
const key = `${collection}:${id}`
|
|
28
|
-
const data = await this.db.get(key)
|
|
28
|
+
const data = await this.db.get(key).catch((e) => null)
|
|
29
|
+
if (!data) return null
|
|
29
30
|
return DBSchema.shape[collection].parse(JSON.parse(data)) as any
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Middleware } from "winterspec"
|
|
2
|
+
import Debug from "debug"
|
|
3
|
+
|
|
4
|
+
const debug = Debug("tscircuit:cli:api")
|
|
5
|
+
|
|
6
|
+
export const withDebugRequestLogging: Middleware<{}, {}> = async (
|
|
7
|
+
req,
|
|
8
|
+
ctx,
|
|
9
|
+
next
|
|
10
|
+
) => {
|
|
11
|
+
debug(`[REQ] ${req.method?.toUpperCase()} ${req.url}`)
|
|
12
|
+
return next(req, ctx)
|
|
13
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createWithWinterSpec } from "winterspec"
|
|
2
2
|
import { withDb } from "./middlewares/with-db"
|
|
3
3
|
import { withErrorResponse } from "./middlewares/with-error-response"
|
|
4
|
+
import { withDebugRequestLogging } from "./middlewares/with-debug-request-logging"
|
|
4
5
|
|
|
5
6
|
export const withWinterSpec = createWithWinterSpec({
|
|
6
7
|
authMiddleware: {},
|
|
7
|
-
beforeAuthMiddleware: [withErrorResponse, withDb],
|
|
8
|
+
beforeAuthMiddleware: [withDebugRequestLogging, withErrorResponse, withDb],
|
|
8
9
|
})
|
|
@@ -25,4 +25,14 @@ it("POST /api/dev_package_examples/update", async () => {
|
|
|
25
25
|
expect(res.dev_package_example.edit_events_last_applied_at).toEqual(
|
|
26
26
|
"2023-01-01T00:00:00.000Z"
|
|
27
27
|
)
|
|
28
|
+
|
|
29
|
+
const getRes = await axios.post("/api/dev_package_examples/get", {
|
|
30
|
+
dev_package_example_id: 1,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
expect(getRes.status).toBe(200)
|
|
34
|
+
expect(getRes.data.dev_package_example.completed_edit_events).toEqual([])
|
|
35
|
+
expect(getRes.data.dev_package_example.edit_events_last_applied_at).toEqual(
|
|
36
|
+
"2023-01-01T00:00:00.000Z"
|
|
37
|
+
)
|
|
28
38
|
})
|
|
@@ -2673,9 +2673,9 @@
|
|
|
2673
2673
|
}
|
|
2674
2674
|
},
|
|
2675
2675
|
"node_modules/@tscircuit/builder": {
|
|
2676
|
-
"version": "1.5.
|
|
2677
|
-
"resolved": "https://registry.npmjs.org/@tscircuit/builder/-/builder-1.5.
|
|
2678
|
-
"integrity": "sha512-
|
|
2676
|
+
"version": "1.5.143",
|
|
2677
|
+
"resolved": "https://registry.npmjs.org/@tscircuit/builder/-/builder-1.5.143.tgz",
|
|
2678
|
+
"integrity": "sha512-j3UkQ/TOUOH3TlUsM3SUTGA2LEoSEXMrVUGPMIwQNJgEsTaQOe+GWQcMdANfL8juUvYU2fCHrk2upuk8PNiQAg==",
|
|
2679
2679
|
"license": "MIT",
|
|
2680
2680
|
"dependencies": {
|
|
2681
2681
|
"@lume/kiwi": "^0.1.0",
|