@tscircuit/cli 0.0.58 → 0.0.59

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/bun.lockb CHANGED
Binary file
@@ -0,0 +1,62 @@
1
+ import { withEdgeSpec } from "src/with-edge-spec"
2
+ import { NotFoundError } from "edgespec/middleware"
3
+ import { z } from "zod"
4
+
5
+ export default withEdgeSpec({
6
+ methods: ["POST"],
7
+ jsonBody: z.object({
8
+ example_file_path: z.string(),
9
+ export_name: z.string().nullable().optional(),
10
+ export_parameters: z.object({
11
+ should_export_gerber_zip: z.boolean().default(false),
12
+ }),
13
+ }),
14
+ jsonResponse: z.object({
15
+ export_request: z.object({
16
+ export_request_id: z.coerce.number(),
17
+ created_at: z.string(),
18
+ file_summary: z.array(
19
+ z.object({
20
+ file_name: z.string(),
21
+ is_complete: z.boolean(),
22
+ })
23
+ ),
24
+ }),
25
+ }),
26
+ auth: "none",
27
+ })(async (req, ctx) => {
28
+ // const tscircuit_soup = req.jsonBody.tscircuit_soup
29
+ // ? JSON.stringify(req.jsonBody.tscircuit_soup)
30
+ // : undefined
31
+ // const dev_package_example = await ctx.db
32
+ // .insertInto("dev_package_example")
33
+ // .values({
34
+ // file_path: req.jsonBody.file_path,
35
+ // export_name: req.jsonBody.export_name,
36
+ // error: req.jsonBody.error,
37
+ // tscircuit_soup,
38
+ // is_loading: req.jsonBody.is_loading ? 1 : 0,
39
+ // last_updated_at: new Date().toISOString(),
40
+ // })
41
+ // .onConflict((oc) =>
42
+ // oc.columns(["file_path"]).doUpdateSet({
43
+ // export_name: req.jsonBody.export_name,
44
+ // error: req.jsonBody.error,
45
+ // tscircuit_soup,
46
+ // is_loading: req.jsonBody.is_loading ? 1 : 0,
47
+ // last_updated_at: new Date().toISOString(),
48
+ // })
49
+ // )
50
+ // .returningAll()
51
+ // .executeTakeFirstOrThrow()
52
+
53
+ const export_request = {
54
+ export_request_id: 1,
55
+ created_at: new Date().toISOString(),
56
+ file_summary: [],
57
+ }
58
+
59
+ return ctx.json({
60
+ export_request,
61
+ })
62
+ })
@@ -13,4 +13,30 @@ export const createSchema = async (db: DbClient) => {
13
13
  .addColumn("is_loading", "boolean", (cb) => cb.defaultTo(0).notNull())
14
14
  .addColumn("last_updated_at", "text")
15
15
  .execute()
16
+
17
+ await db.schema
18
+ .createTable("export_request")
19
+ .addColumn("export_request_id", "integer", (col) =>
20
+ col.primaryKey().autoIncrement()
21
+ )
22
+ .addColumn("example_file_path", "text")
23
+ .addColumn("export_parameters", "jsonb")
24
+ .addColumn("export_name", "text")
25
+ .addColumn("is_complete", "boolean", (col) => col.defaultTo(0).notNull())
26
+ .addColumn("created_at", "text")
27
+ .execute()
28
+
29
+ await db.schema
30
+ .createTable("export_file")
31
+ .addColumn("export_file_id", "integer", (col) =>
32
+ col.primaryKey().autoIncrement()
33
+ )
34
+ .addColumn("file_name", "text")
35
+ .addColumn("file_content", "blob")
36
+ .addColumn("is_complete", "boolean", (col) => col.defaultTo(0).notNull())
37
+ .addColumn("export_request_id", "integer", (col) =>
38
+ col.references("export_request.export_request_id")
39
+ )
40
+ .addColumn("created_at", "text")
41
+ .execute()
16
42
  }
@@ -13,8 +13,27 @@ interface DevPackageExample {
13
13
  last_updated_at: string
14
14
  }
15
15
 
16
+ interface ExportRequest {
17
+ export_request_id: Generated<number>
18
+ example_file_path: string
19
+ export_name: string
20
+ is_complete: 1 | 0
21
+ created_at: string
22
+ }
23
+
24
+ interface ExportFile {
25
+ export_file_id: Generated<number>
26
+ file_name: string
27
+ file_content: Buffer
28
+ is_complete: 1 | 0
29
+ export_request_id: number
30
+ created_at: string
31
+ }
32
+
16
33
  interface KyselyDatabaseSchema {
17
34
  dev_package_example: DevPackageExample
35
+ export_request: ExportRequest
36
+ export_file: ExportFile
18
37
  }
19
38
 
20
39
  export type DbClient = Kysely<KyselyDatabaseSchema>
Binary file