@tscircuit/fake-snippets 0.0.38 → 0.0.40
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/dist/index.d.ts
CHANGED
|
@@ -702,6 +702,37 @@ declare const createDatabase: ({ seed }?: {
|
|
|
702
702
|
step_function_name: string | null;
|
|
703
703
|
error_message: string | null;
|
|
704
704
|
}[];
|
|
705
|
+
orderQuotes: {
|
|
706
|
+
error: z.objectOutputType<{
|
|
707
|
+
error_code: z.ZodString;
|
|
708
|
+
message: z.ZodString;
|
|
709
|
+
}, z.ZodTypeAny, "passthrough"> | null;
|
|
710
|
+
package_release_id: string | null;
|
|
711
|
+
created_at: string;
|
|
712
|
+
updated_at: string;
|
|
713
|
+
account_id: string | null;
|
|
714
|
+
has_error: boolean;
|
|
715
|
+
completed_at: string | null;
|
|
716
|
+
order_quote_id: string;
|
|
717
|
+
is_completed: boolean;
|
|
718
|
+
is_processing: boolean;
|
|
719
|
+
vendor_name: string;
|
|
720
|
+
quoted_components: {
|
|
721
|
+
manufacturer_part_number: string | null;
|
|
722
|
+
supplier_part_number: string | null;
|
|
723
|
+
quantity: number;
|
|
724
|
+
unit_price: number;
|
|
725
|
+
total_price: number;
|
|
726
|
+
available: boolean;
|
|
727
|
+
}[] | null;
|
|
728
|
+
bare_pcb_cost: number;
|
|
729
|
+
shipping_options: {
|
|
730
|
+
carrier: string;
|
|
731
|
+
service: string;
|
|
732
|
+
cost: number;
|
|
733
|
+
}[];
|
|
734
|
+
total_cost: number;
|
|
735
|
+
}[];
|
|
705
736
|
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId"> & {
|
|
706
737
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
707
738
|
getOrderById: (orderId: string) => Order | undefined;
|
|
@@ -946,6 +977,37 @@ declare const createDatabase: ({ seed }?: {
|
|
|
946
977
|
step_function_name: string | null;
|
|
947
978
|
error_message: string | null;
|
|
948
979
|
}[];
|
|
980
|
+
orderQuotes: {
|
|
981
|
+
error: z.objectOutputType<{
|
|
982
|
+
error_code: z.ZodString;
|
|
983
|
+
message: z.ZodString;
|
|
984
|
+
}, z.ZodTypeAny, "passthrough"> | null;
|
|
985
|
+
package_release_id: string | null;
|
|
986
|
+
created_at: string;
|
|
987
|
+
updated_at: string;
|
|
988
|
+
account_id: string | null;
|
|
989
|
+
has_error: boolean;
|
|
990
|
+
completed_at: string | null;
|
|
991
|
+
order_quote_id: string;
|
|
992
|
+
is_completed: boolean;
|
|
993
|
+
is_processing: boolean;
|
|
994
|
+
vendor_name: string;
|
|
995
|
+
quoted_components: {
|
|
996
|
+
manufacturer_part_number: string | null;
|
|
997
|
+
supplier_part_number: string | null;
|
|
998
|
+
quantity: number;
|
|
999
|
+
unit_price: number;
|
|
1000
|
+
total_price: number;
|
|
1001
|
+
available: boolean;
|
|
1002
|
+
}[] | null;
|
|
1003
|
+
bare_pcb_cost: number;
|
|
1004
|
+
shipping_options: {
|
|
1005
|
+
carrier: string;
|
|
1006
|
+
service: string;
|
|
1007
|
+
cost: number;
|
|
1008
|
+
}[];
|
|
1009
|
+
total_cost: number;
|
|
1010
|
+
}[];
|
|
949
1011
|
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId"> & {
|
|
950
1012
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
951
1013
|
getOrderById: (orderId: string) => Order | undefined;
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,36 @@ var orderFileSchema = z.object({
|
|
|
88
88
|
content_text: z.string().nullable(),
|
|
89
89
|
content_bytes: z.instanceof(Uint8Array).nullable()
|
|
90
90
|
});
|
|
91
|
+
var shippingOptionSchema = z.object({
|
|
92
|
+
carrier: z.string(),
|
|
93
|
+
service: z.string(),
|
|
94
|
+
cost: z.number()
|
|
95
|
+
});
|
|
96
|
+
var quotedComponentSchema = z.object({
|
|
97
|
+
manufacturer_part_number: z.string().nullable(),
|
|
98
|
+
supplier_part_number: z.string().nullable(),
|
|
99
|
+
quantity: z.number().default(0),
|
|
100
|
+
unit_price: z.number().default(0),
|
|
101
|
+
total_price: z.number().default(0),
|
|
102
|
+
available: z.boolean().default(true)
|
|
103
|
+
});
|
|
104
|
+
var orderQuoteSchema = z.object({
|
|
105
|
+
order_quote_id: z.string(),
|
|
106
|
+
account_id: z.string().nullable(),
|
|
107
|
+
package_release_id: z.string().nullable(),
|
|
108
|
+
is_completed: z.boolean().default(false),
|
|
109
|
+
is_processing: z.boolean().default(true),
|
|
110
|
+
vendor_name: z.string(),
|
|
111
|
+
error: errorSchema.nullable(),
|
|
112
|
+
has_error: z.boolean().default(false),
|
|
113
|
+
created_at: z.string(),
|
|
114
|
+
updated_at: z.string(),
|
|
115
|
+
completed_at: z.string().nullable(),
|
|
116
|
+
quoted_components: z.array(quotedComponentSchema).nullable(),
|
|
117
|
+
bare_pcb_cost: z.number().default(0),
|
|
118
|
+
shipping_options: z.array(shippingOptionSchema),
|
|
119
|
+
total_cost: z.number().default(0)
|
|
120
|
+
});
|
|
91
121
|
var accountSnippetSchema = z.object({
|
|
92
122
|
account_id: z.string(),
|
|
93
123
|
snippet_id: z.string(),
|
|
@@ -199,7 +229,8 @@ var databaseSchema = z.object({
|
|
|
199
229
|
accountSnippets: z.array(accountSnippetSchema).default([]),
|
|
200
230
|
accountPackages: z.array(accountPackageSchema).default([]),
|
|
201
231
|
jlcpcbOrderState: z.array(jlcpcbOrderStateSchema).default([]),
|
|
202
|
-
jlcpcbOrderStepRuns: z.array(jlcpcbOrderStepRunSchema).default([])
|
|
232
|
+
jlcpcbOrderStepRuns: z.array(jlcpcbOrderStepRunSchema).default([]),
|
|
233
|
+
orderQuotes: z.array(orderQuoteSchema).default([])
|
|
203
234
|
});
|
|
204
235
|
|
|
205
236
|
// fake-snippets-api/lib/db/autoload-dev-packages.ts
|
|
@@ -100,6 +100,42 @@ export const orderFileSchema = z.object({
|
|
|
100
100
|
})
|
|
101
101
|
export type OrderFile = z.infer<typeof orderFileSchema>
|
|
102
102
|
|
|
103
|
+
const shippingOptionSchema = z.object({
|
|
104
|
+
carrier: z.string(),
|
|
105
|
+
service: z.string(),
|
|
106
|
+
cost: z.number(),
|
|
107
|
+
})
|
|
108
|
+
export type ShippingOption = z.infer<typeof shippingOptionSchema>
|
|
109
|
+
|
|
110
|
+
export const quotedComponentSchema = z.object({
|
|
111
|
+
manufacturer_part_number: z.string().nullable(),
|
|
112
|
+
supplier_part_number: z.string().nullable(),
|
|
113
|
+
quantity: z.number().default(0),
|
|
114
|
+
unit_price: z.number().default(0),
|
|
115
|
+
total_price: z.number().default(0),
|
|
116
|
+
available: z.boolean().default(true),
|
|
117
|
+
})
|
|
118
|
+
export type QuotedComponent = z.infer<typeof quotedComponentSchema>
|
|
119
|
+
|
|
120
|
+
export const orderQuoteSchema = z.object({
|
|
121
|
+
order_quote_id: z.string(),
|
|
122
|
+
account_id: z.string().nullable(),
|
|
123
|
+
package_release_id: z.string().nullable(),
|
|
124
|
+
is_completed: z.boolean().default(false),
|
|
125
|
+
is_processing: z.boolean().default(true),
|
|
126
|
+
vendor_name: z.string(),
|
|
127
|
+
error: errorSchema.nullable(),
|
|
128
|
+
has_error: z.boolean().default(false),
|
|
129
|
+
created_at: z.string(),
|
|
130
|
+
updated_at: z.string(),
|
|
131
|
+
completed_at: z.string().nullable(),
|
|
132
|
+
quoted_components: z.array(quotedComponentSchema).nullable(),
|
|
133
|
+
bare_pcb_cost: z.number().default(0),
|
|
134
|
+
shipping_options: z.array(shippingOptionSchema),
|
|
135
|
+
total_cost: z.number().default(0),
|
|
136
|
+
})
|
|
137
|
+
export type OrderQuote = z.infer<typeof orderQuoteSchema>
|
|
138
|
+
|
|
103
139
|
// TODO: Remove this schema after migration to accountPackages is complete
|
|
104
140
|
export const accountSnippetSchema = z.object({
|
|
105
141
|
account_id: z.string(),
|
|
@@ -227,5 +263,6 @@ export const databaseSchema = z.object({
|
|
|
227
263
|
accountPackages: z.array(accountPackageSchema).default([]),
|
|
228
264
|
jlcpcbOrderState: z.array(jlcpcbOrderStateSchema).default([]),
|
|
229
265
|
jlcpcbOrderStepRuns: z.array(jlcpcbOrderStepRunSchema).default([]),
|
|
266
|
+
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
230
267
|
})
|
|
231
268
|
export type DatabaseSchema = z.infer<typeof databaseSchema>
|
|
@@ -26,9 +26,7 @@ export default withRouteSpec({
|
|
|
26
26
|
|
|
27
27
|
const pkg = ctx.db.packages[packageIndex]
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (pkg.owner_org_id !== ctx.auth.personal_org_id) {
|
|
29
|
+
if (pkg.owner_github_username !== ctx.auth.github_username) {
|
|
32
30
|
return ctx.error(403, {
|
|
33
31
|
error_code: "forbidden",
|
|
34
32
|
message: "You don't have permission to delete this package",
|
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
-
name: Playwright Test
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches: [main]
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
timeout-minutes: 10
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- name: Checkout code
|
|
16
|
-
uses: actions/checkout@v4
|
|
17
|
-
|
|
18
|
-
- name: Setup bun
|
|
19
|
-
uses: oven-sh/setup-bun@v1
|
|
20
|
-
with:
|
|
21
|
-
bun-version: latest
|
|
22
|
-
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
run: bun install
|
|
25
|
-
|
|
26
|
-
- name: Install Playwright browsers
|
|
27
|
-
run: bunx playwright install
|
|
28
|
-
|
|
29
|
-
- name: Run tests
|
|
30
|
-
run: bun run playwright
|
|
31
|
-
|
|
32
|
-
- uses: actions/upload-artifact@v4
|
|
33
|
-
if: ${{ !cancelled() }}
|
|
34
|
-
with:
|
|
35
|
-
name: test-results
|
|
36
|
-
path: test-results/
|
|
37
|
-
retention-days: 30
|