@tscircuit/fake-snippets 0.0.41 → 0.0.43
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.lock +10 -12
- package/dist/bundle.js +411 -292
- package/dist/index.d.ts +134 -2
- package/dist/index.js +36 -0
- package/fake-snippets-api/lib/db/db-client.ts +44 -2
- package/fake-snippets-api/routes/api/order_quotes/create.ts +26 -0
- package/fake-snippets-api/routes/api/order_quotes/create_all_vendor_quotes.ts +30 -0
- package/fake-snippets-api/routes/api/order_quotes/get.ts +32 -0
- package/package.json +3 -3
- package/src/components/EditorNav.tsx +68 -58
- package/src/components/ViewPackagePage/components/important-files-view.tsx +6 -1
- package/src/components/ViewPackagePage/components/package-header.tsx +39 -5
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +1 -0
- package/src/components/dialogs/edit-package-details-dialog.tsx +37 -39
- package/src/hooks/use-delete-package.ts +1 -0
- package/src/hooks/use-fork-package-mutation.ts +7 -0
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Dialog,
|
|
3
|
-
DialogContent,
|
|
4
|
-
DialogHeader,
|
|
5
|
-
DialogTitle,
|
|
6
|
-
DialogDescription,
|
|
7
|
-
} from "../ui/dialog"
|
|
8
|
-
import { Button } from "../ui/button"
|
|
9
|
-
import { useMutation, useQueryClient } from "react-query"
|
|
10
|
-
import { createUseDialog } from "./create-use-dialog"
|
|
11
|
-
import { useAxios } from "@/hooks/use-axios"
|
|
12
|
-
import { useToast } from "@/hooks/use-toast"
|
|
13
|
-
import { Textarea } from "../ui/textarea"
|
|
14
|
-
import { Input } from "../ui/input"
|
|
15
|
-
import { Label } from "../ui/label"
|
|
16
1
|
import {
|
|
17
2
|
Select,
|
|
18
3
|
SelectContent,
|
|
@@ -20,8 +5,23 @@ import {
|
|
|
20
5
|
SelectTrigger,
|
|
21
6
|
SelectValue,
|
|
22
7
|
} from "@/components/ui/select"
|
|
23
|
-
import {
|
|
8
|
+
import { useAxios } from "@/hooks/use-axios"
|
|
24
9
|
import { usePackageDetailsForm } from "@/hooks/use-package-details-form"
|
|
10
|
+
import { useToast } from "@/hooks/use-toast"
|
|
11
|
+
import { useMutation, useQueryClient } from "react-query"
|
|
12
|
+
import { getLicenseContent } from "../ViewPackagePage/utils/get-license-content"
|
|
13
|
+
import { Button } from "../ui/button"
|
|
14
|
+
import {
|
|
15
|
+
Dialog,
|
|
16
|
+
DialogContent,
|
|
17
|
+
DialogDescription,
|
|
18
|
+
DialogHeader,
|
|
19
|
+
DialogTitle,
|
|
20
|
+
} from "../ui/dialog"
|
|
21
|
+
import { Input } from "../ui/input"
|
|
22
|
+
import { Label } from "../ui/label"
|
|
23
|
+
import { Textarea } from "../ui/textarea"
|
|
24
|
+
import { createUseDialog } from "./create-use-dialog"
|
|
25
25
|
|
|
26
26
|
export const EditPackageDetailsDialog = ({
|
|
27
27
|
open,
|
|
@@ -77,9 +77,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
77
77
|
if (hasLicenseChanged) {
|
|
78
78
|
await axios.post("/package_releases/update", {
|
|
79
79
|
package_id: packageId,
|
|
80
|
-
description: formData.description,
|
|
81
80
|
package_release_id: packageReleaseId,
|
|
82
|
-
website: formData.website,
|
|
83
81
|
license: formData.license ?? "unset",
|
|
84
82
|
})
|
|
85
83
|
}
|
|
@@ -87,7 +85,6 @@ export const EditPackageDetailsDialog = ({
|
|
|
87
85
|
const response = await axios.post("/packages/update", {
|
|
88
86
|
package_id: packageId,
|
|
89
87
|
description: formData.description,
|
|
90
|
-
package_release_id: packageReleaseId,
|
|
91
88
|
website: formData.website,
|
|
92
89
|
})
|
|
93
90
|
|
|
@@ -98,7 +95,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
98
95
|
|
|
99
96
|
const packageFiles = []
|
|
100
97
|
const packageFilesResponse = await axios.post("/package_files/list", {
|
|
101
|
-
package_name_with_version:
|
|
98
|
+
package_name_with_version: packageName,
|
|
102
99
|
})
|
|
103
100
|
|
|
104
101
|
if (packageFilesResponse.status === 200) {
|
|
@@ -114,28 +111,25 @@ export const EditPackageDetailsDialog = ({
|
|
|
114
111
|
packageAuthor,
|
|
115
112
|
)
|
|
116
113
|
if (hasLicenseChanged) {
|
|
117
|
-
let concludedLicenseResult
|
|
118
114
|
if (packageFiles.includes("LICENSE") && !licenseContent) {
|
|
119
|
-
|
|
120
|
-
package_name_with_version:
|
|
115
|
+
await axios.post("/package_files/delete", {
|
|
116
|
+
package_name_with_version: packageName,
|
|
121
117
|
file_path: "LICENSE",
|
|
122
118
|
})
|
|
123
119
|
}
|
|
124
120
|
if (licenseContent) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
content_text: licenseContent,
|
|
131
|
-
},
|
|
132
|
-
)
|
|
121
|
+
await axios.post("/package_files/create_or_update", {
|
|
122
|
+
package_name_with_version: packageName,
|
|
123
|
+
file_path: "LICENSE",
|
|
124
|
+
content_text: licenseContent,
|
|
125
|
+
})
|
|
133
126
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
description: formData.description,
|
|
131
|
+
website: formData.website,
|
|
132
|
+
license: formData.license,
|
|
139
133
|
}
|
|
140
134
|
},
|
|
141
135
|
onMutate: async () => {
|
|
@@ -149,9 +143,14 @@ export const EditPackageDetailsDialog = ({
|
|
|
149
143
|
}))
|
|
150
144
|
return { previousPackage }
|
|
151
145
|
},
|
|
152
|
-
onSuccess: () => {
|
|
153
|
-
onUpdate?.(
|
|
146
|
+
onSuccess: (data) => {
|
|
147
|
+
onUpdate?.(data.description, data.website, data.license)
|
|
154
148
|
onOpenChange(false)
|
|
149
|
+
|
|
150
|
+
qc.invalidateQueries({
|
|
151
|
+
queryKey: ["packageFile", { package_release_id: packageReleaseId }],
|
|
152
|
+
})
|
|
153
|
+
|
|
155
154
|
toast({
|
|
156
155
|
title: "Package details updated",
|
|
157
156
|
description: "Successfully updated package details",
|
|
@@ -168,7 +167,6 @@ export const EditPackageDetailsDialog = ({
|
|
|
168
167
|
},
|
|
169
168
|
onSettled: () => {
|
|
170
169
|
qc.invalidateQueries({ queryKey: ["packages", packageId] })
|
|
171
|
-
qc.invalidateQueries({ queryKey: ["current-package-info"] })
|
|
172
170
|
},
|
|
173
171
|
})
|
|
174
172
|
|
|
@@ -42,6 +42,13 @@ export const useForkPackageMutation = ({
|
|
|
42
42
|
onSuccess?.(result)
|
|
43
43
|
},
|
|
44
44
|
onError: (error: any) => {
|
|
45
|
+
if (error.data.error_code === "cannot_fork_own_package") {
|
|
46
|
+
toast({
|
|
47
|
+
title: "Cannot Fork Package",
|
|
48
|
+
description: "You cannot fork your own package.",
|
|
49
|
+
})
|
|
50
|
+
return
|
|
51
|
+
}
|
|
45
52
|
toast({
|
|
46
53
|
title: "Error",
|
|
47
54
|
description: "Failed to fork package. Please try again.",
|