create-disposabl-app 0.9.1 → 0.10.1
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/disposabl.js +1 -1
- package/dist/index.js +2 -2
- package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.api-keys.tsx +1 -1
- package/dist/templates/default/bun.lock +77 -1397
- package/dist/templates/default/package.json +1 -2
- package/dist/templates/default/packages/backend/README.md +3 -1
- package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +6 -0
- package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +0 -2
- package/dist/templates/default/packages/backend/convex/auth.config.ts +2 -10
- package/dist/templates/default/packages/backend/convex/convex.config.ts +3 -14
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/README.md +42 -0
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/internal.ts +153 -0
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/provision.ts +102 -0
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/validator.ts +35 -0
- package/dist/templates/default/packages/backend/convex/schema.ts +18 -0
- package/dist/templates/default/packages/backend/package.json +0 -1
- package/dist/templates/default/packages/cli/README.md +9 -24
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +71 -13
- package/dist/templates/default/packages/disposabl-kit/package.json +4 -14
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +19 -12
- package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +12 -0
- package/dist/templates/default/packages/disposabl-kit/server/mcp/enterprise.ts +267 -0
- package/dist/templates/default/packages/disposabl-kit/server/mcp/identity.ts +33 -0
- package/dist/templates/default/vendor/README.md +30 -0
- package/dist/templates/default/vendor/convex-auth-6c0ebf3f.tgz +0 -0
- package/package.json +1 -1
- package/dist/templates/default/apps/web/src/components/connections/expo-connection.tsx +0 -97
- package/dist/templates/default/apps/web/src/components/connections/provider-logo.tsx +0 -44
- package/dist/templates/default/apps/web/src/components/connections/use-connection-setup.ts +0 -169
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/accordion.tsx +0 -77
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert-dialog.tsx +0 -185
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert.tsx +0 -75
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/aspect-ratio.tsx +0 -22
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/attachment.tsx +0 -207
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/avatar.tsx +0 -106
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/badge.tsx +0 -51
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/breadcrumb.tsx +0 -121
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/bubble.tsx +0 -127
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/button-group.tsx +0 -87
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/calendar.tsx +0 -241
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/carousel.tsx +0 -239
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/chart.tsx +0 -368
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/checkbox.tsx +0 -27
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/code-block.tsx +0 -243
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/collapsible.tsx +0 -19
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/combobox.tsx +0 -300
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/command.tsx +0 -194
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/context-menu.tsx +0 -271
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/dialog.tsx +0 -156
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/direction.tsx +0 -4
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/drawer.tsx +0 -224
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/dropdown-menu.tsx +0 -269
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/empty.tsx +0 -103
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/hover-card.tsx +0 -50
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-group.tsx +0 -158
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-otp.tsx +0 -83
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/item.tsx +0 -201
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/kbd.tsx +0 -26
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/marker.tsx +0 -70
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/menubar.tsx +0 -284
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/message-scroller.tsx +0 -128
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/message.tsx +0 -91
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/native-select.tsx +0 -64
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/navigation-menu.tsx +0 -170
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/pagination.tsx +0 -133
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/popover.tsx +0 -87
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/progress.tsx +0 -82
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/questionnaire.tsx +0 -330
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/radio-group.tsx +0 -35
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/resizable.tsx +0 -49
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/scroll-area.tsx +0 -51
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/select.tsx +0 -201
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/sheet.tsx +0 -132
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/sidebar.tsx +0 -723
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/skeleton.tsx +0 -13
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/slider.tsx +0 -51
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/switch.tsx +0 -31
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/table.tsx +0 -113
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/tabs.tsx +0 -81
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/textarea.tsx +0 -17
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toast.tsx +0 -229
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle-group.tsx +0 -87
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle.tsx +0 -42
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/tooltip.tsx +0 -65
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/trace.tsx +0 -161
- package/dist/templates/default/packages/disposabl-kit/client/hooks/use-mobile.ts +0 -21
- package/dist/templates/default/patches/@convex-dev%2Fauth@2.0.0-beta.0.patch +0 -310
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
4
|
-
import { cn } from "@disposabl/disposabl-kit/client/lib/utils";
|
|
5
|
-
|
|
6
|
-
function TooltipProvider({
|
|
7
|
-
delay = 0,
|
|
8
|
-
...props
|
|
9
|
-
}: TooltipPrimitive.Provider.Props) {
|
|
10
|
-
return (
|
|
11
|
-
<TooltipPrimitive.Provider
|
|
12
|
-
data-slot="tooltip-provider"
|
|
13
|
-
delay={delay}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
20
|
-
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
|
|
24
|
-
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function TooltipContent({
|
|
28
|
-
className,
|
|
29
|
-
side = "top",
|
|
30
|
-
sideOffset = 4,
|
|
31
|
-
align = "center",
|
|
32
|
-
alignOffset = 0,
|
|
33
|
-
children,
|
|
34
|
-
...props
|
|
35
|
-
}: TooltipPrimitive.Popup.Props &
|
|
36
|
-
Pick<
|
|
37
|
-
TooltipPrimitive.Positioner.Props,
|
|
38
|
-
"align" | "alignOffset" | "side" | "sideOffset"
|
|
39
|
-
>) {
|
|
40
|
-
return (
|
|
41
|
-
<TooltipPrimitive.Portal>
|
|
42
|
-
<TooltipPrimitive.Positioner
|
|
43
|
-
align={align}
|
|
44
|
-
alignOffset={alignOffset}
|
|
45
|
-
side={side}
|
|
46
|
-
sideOffset={sideOffset}
|
|
47
|
-
className="isolate z-50"
|
|
48
|
-
>
|
|
49
|
-
<TooltipPrimitive.Popup
|
|
50
|
-
data-slot="tooltip-content"
|
|
51
|
-
className={cn(
|
|
52
|
-
"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
53
|
-
className,
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
|
|
59
|
-
</TooltipPrimitive.Popup>
|
|
60
|
-
</TooltipPrimitive.Positioner>
|
|
61
|
-
</TooltipPrimitive.Portal>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "@disposabl/disposabl-kit/client/lib/utils";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Collapsible,
|
|
6
|
-
CollapsibleContent,
|
|
7
|
-
CollapsibleTrigger,
|
|
8
|
-
} from "@disposabl/disposabl-kit/client/components/ui/collapsible";
|
|
9
|
-
import { ChevronRightIcon } from "lucide-react";
|
|
10
|
-
|
|
11
|
-
function Trace({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
data-slot="trace"
|
|
15
|
-
className={cn(
|
|
16
|
-
"flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50",
|
|
17
|
-
className,
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function TraceLine({
|
|
25
|
-
className,
|
|
26
|
-
status,
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<"span"> & {
|
|
29
|
-
status?: "running" | "error" | "pending";
|
|
30
|
-
}) {
|
|
31
|
-
return (
|
|
32
|
-
<span
|
|
33
|
-
data-slot="trace-line"
|
|
34
|
-
data-status={status}
|
|
35
|
-
className={cn(
|
|
36
|
-
"flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer",
|
|
37
|
-
className,
|
|
38
|
-
)}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function TraceIcon({ className, ...props }: React.ComponentProps<"span">) {
|
|
45
|
-
return (
|
|
46
|
-
<span
|
|
47
|
-
data-slot="trace-icon"
|
|
48
|
-
aria-hidden="true"
|
|
49
|
-
className={cn(
|
|
50
|
-
"flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1",
|
|
51
|
-
className,
|
|
52
|
-
)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function TraceTitle({ className, ...props }: React.ComponentProps<"span">) {
|
|
59
|
-
return (
|
|
60
|
-
<span
|
|
61
|
-
data-slot="trace-title"
|
|
62
|
-
className={cn("min-w-0 truncate motion-reduce:shimmer-none", className)}
|
|
63
|
-
{...props}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function TraceDescription({
|
|
69
|
-
className,
|
|
70
|
-
...props
|
|
71
|
-
}: React.ComponentProps<"span">) {
|
|
72
|
-
return (
|
|
73
|
-
<span
|
|
74
|
-
data-slot="trace-description"
|
|
75
|
-
className={cn(
|
|
76
|
-
"shrink-0 text-muted-foreground/70 tabular-nums",
|
|
77
|
-
className,
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function TraceCollapsible({
|
|
85
|
-
className,
|
|
86
|
-
...props
|
|
87
|
-
}: Omit<React.ComponentProps<typeof Collapsible>, "open"> &
|
|
88
|
-
(
|
|
89
|
-
| { open?: undefined }
|
|
90
|
-
| {
|
|
91
|
-
open: boolean;
|
|
92
|
-
onOpenChange: NonNullable<
|
|
93
|
-
React.ComponentProps<typeof Collapsible>["onOpenChange"]
|
|
94
|
-
>;
|
|
95
|
-
}
|
|
96
|
-
)) {
|
|
97
|
-
return (
|
|
98
|
-
<Collapsible
|
|
99
|
-
data-slot="trace-collapsible"
|
|
100
|
-
className={cn("flex w-full min-w-0 flex-col", className)}
|
|
101
|
-
{...props}
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function TraceCollapsibleTrigger({
|
|
107
|
-
className,
|
|
108
|
-
children,
|
|
109
|
-
...props
|
|
110
|
-
}: React.ComponentProps<typeof CollapsibleTrigger>) {
|
|
111
|
-
return (
|
|
112
|
-
<CollapsibleTrigger
|
|
113
|
-
data-slot="trace-collapsible-trigger"
|
|
114
|
-
className={cn(
|
|
115
|
-
"group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive",
|
|
116
|
-
className,
|
|
117
|
-
)}
|
|
118
|
-
{...props}
|
|
119
|
-
>
|
|
120
|
-
{children}
|
|
121
|
-
<TraceIcon className="transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90">
|
|
122
|
-
<ChevronRightIcon />
|
|
123
|
-
</TraceIcon>
|
|
124
|
-
</CollapsibleTrigger>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function TraceCollapsibleContent({
|
|
129
|
-
className,
|
|
130
|
-
children,
|
|
131
|
-
...props
|
|
132
|
-
}: React.ComponentProps<typeof CollapsibleContent>) {
|
|
133
|
-
return (
|
|
134
|
-
<CollapsibleContent
|
|
135
|
-
data-slot="trace-collapsible-content"
|
|
136
|
-
className="h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0"
|
|
137
|
-
{...props}
|
|
138
|
-
>
|
|
139
|
-
<div
|
|
140
|
-
data-slot="trace-collapsible-content-inner"
|
|
141
|
-
className={cn(
|
|
142
|
-
"mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground",
|
|
143
|
-
className,
|
|
144
|
-
)}
|
|
145
|
-
>
|
|
146
|
-
{children}
|
|
147
|
-
</div>
|
|
148
|
-
</CollapsibleContent>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export {
|
|
153
|
-
Trace,
|
|
154
|
-
TraceLine,
|
|
155
|
-
TraceIcon,
|
|
156
|
-
TraceTitle,
|
|
157
|
-
TraceDescription,
|
|
158
|
-
TraceCollapsible,
|
|
159
|
-
TraceCollapsibleTrigger,
|
|
160
|
-
TraceCollapsibleContent,
|
|
161
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
const MOBILE_BREAKPOINT = 768;
|
|
4
|
-
|
|
5
|
-
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
|
|
7
|
-
undefined,
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
React.useEffect(() => {
|
|
11
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
12
|
-
const onChange = () => {
|
|
13
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
14
|
-
};
|
|
15
|
-
mql.addEventListener("change", onChange);
|
|
16
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
17
|
-
return () => mql.removeEventListener("change", onChange);
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
return !!isMobile;
|
|
21
|
-
}
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
diff --git a/dist/cli/program.d.ts b/dist/cli/program.d.ts
|
|
2
|
-
index bd6fd586968841cfda5aff80bb943f27d1a9e75d..793c51c8fdb474be84d2518c2a7382790be2f16c 100644
|
|
3
|
-
--- a/dist/cli/program.d.ts
|
|
4
|
-
+++ b/dist/cli/program.d.ts
|
|
5
|
-
@@ -56,7 +56,7 @@ export declare function installCommand(packageManager: string): "pnpm add @conve
|
|
6
|
-
*/
|
|
7
|
-
export declare function detectPackageManager(dir: string, env?: NodeJS.ProcessEnv): PackageManager;
|
|
8
|
-
/** The real implementations, injected into `runInit` (overridden in tests). */
|
|
9
|
-
-export declare function defaultDeps(): InitDeps;
|
|
10
|
-
+export declare function defaultDeps(deploymentArgs?: string[]): InitDeps;
|
|
11
|
-
/**
|
|
12
|
-
* Run the full initialization against the injected `deps`. Fatal problems are
|
|
13
|
-
* reported via `command.error`, which prints to stderr and exits (or throws a
|
|
14
|
-
@@ -64,6 +64,7 @@ export declare function defaultDeps(): InitDeps;
|
|
15
|
-
*/
|
|
16
|
-
declare function runInit(deps: InitDeps, options: {
|
|
17
|
-
force?: boolean;
|
|
18
|
-
+ keysOnly?: boolean;
|
|
19
|
-
}, command: Command): Promise<void>;
|
|
20
|
-
/** Build the commander program, wired to the given dependencies. */
|
|
21
|
-
export declare function createProgram(deps?: InitDeps): Command;
|
|
22
|
-
diff --git a/dist/cli/program.js b/dist/cli/program.js
|
|
23
|
-
index 81d8f6d54dfcbae2662504b4b57ae3ee5b224ebf..d5795d97273aa4b00d11ef62a17f3e4532dc8d84 100644
|
|
24
|
-
--- a/dist/cli/program.js
|
|
25
|
-
+++ b/dist/cli/program.js
|
|
26
|
-
@@ -18,7 +18,7 @@
|
|
27
|
-
// TODO(nicolas) This is a rough draft. Ideally, we simplify the setup process
|
|
28
|
-
// (e.g. by skipping the need for a key pair generation + simplyfying the API)
|
|
29
|
-
// so that users don’t need to rely on this.
|
|
30
|
-
-import { Command } from "commander";
|
|
31
|
-
+import { Command, Option } from "commander";
|
|
32
|
-
import { generateKeyPair, exportPKCS8, exportJWK } from "jose";
|
|
33
|
-
import { randomUUID } from "node:crypto";
|
|
34
|
-
import { spawnSync } from "node:child_process";
|
|
35
|
-
@@ -138,8 +138,8 @@ async function generateAuthKeys() {
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/** Read an env var off the current directory's Convex deployment. */
|
|
39
|
-
-function getConvexEnv(key) {
|
|
40
|
-
- const result = spawnSync("npx", ["convex", "env", "get", key], {
|
|
41
|
-
+function getConvexEnv(key, deploymentArgs) {
|
|
42
|
-
+ const result = spawnSync("bunx", ["--no-install", "convex", "env", "get", key, ...deploymentArgs], {
|
|
43
|
-
cwd: process.cwd(),
|
|
44
|
-
encoding: "utf8",
|
|
45
|
-
});
|
|
46
|
-
@@ -153,21 +153,19 @@ function getConvexEnv(key) {
|
|
47
|
-
*
|
|
48
|
-
* The output of the Convex CLI is captured, not printed: it echoes the value it
|
|
49
|
-
* sets, and one of the values here is the private signing key. If the command
|
|
50
|
-
- * fails, its stderr goes into the error message.
|
|
51
|
-
+ * fails, only a sanitized error is returned.
|
|
52
|
-
*/
|
|
53
|
-
-function setConvexEnv(key, value) {
|
|
54
|
-
- const result = spawnSync("npx", ["convex", "env", "set", key, value], {
|
|
55
|
-
+function setConvexEnv(key, value, deploymentArgs) {
|
|
56
|
-
+ const result = spawnSync("bunx", ["--no-install", "convex", "env", "set", key, value, ...deploymentArgs], {
|
|
57
|
-
cwd: process.cwd(),
|
|
58
|
-
encoding: "utf8",
|
|
59
|
-
});
|
|
60
|
-
if (result.status !== 0) {
|
|
61
|
-
- const reason = (result.stderr ?? "").trim();
|
|
62
|
-
- throw new Error(`Could not set ${key} on the Convex deployment.` +
|
|
63
|
-
- (reason.length > 0 ? `\n\n${indent(reason)}` : ""));
|
|
64
|
-
+ throw new Error(`Could not set ${key} on the selected Convex deployment.`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/** The real implementations, injected into `runInit` (overridden in tests). */
|
|
68
|
-
-export function defaultDeps() {
|
|
69
|
-
+export function defaultDeps(deploymentArgs = []) {
|
|
70
|
-
return {
|
|
71
|
-
cwd: () => process.cwd(),
|
|
72
|
-
fs: {
|
|
73
|
-
@@ -180,8 +178,8 @@ export function defaultDeps() {
|
|
74
|
-
warn: (message) => console.warn(message),
|
|
75
|
-
spinner: startSpinner,
|
|
76
|
-
generateKeys: generateAuthKeys,
|
|
77
|
-
- getEnv: getConvexEnv,
|
|
78
|
-
- setEnv: setConvexEnv,
|
|
79
|
-
+ getEnv: (key) => getConvexEnv(key, deploymentArgs),
|
|
80
|
-
+ setEnv: (key, value) => setConvexEnv(key, value, deploymentArgs),
|
|
81
|
-
detectPackageManager,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
@@ -216,10 +214,15 @@ function indent(text) {
|
|
85
|
-
*/
|
|
86
|
-
async function ensureAuthKeys(deps, force) {
|
|
87
|
-
const reading = deps.spinner("Reading the deployment environment…");
|
|
88
|
-
- const isSet = deps.getEnv("AUTH_PRIVATE_KEY") && deps.getEnv("AUTH_JWKS");
|
|
89
|
-
+ const privateKey = deps.getEnv("AUTH_PRIVATE_KEY");
|
|
90
|
-
+ const jwks = deps.getEnv("AUTH_JWKS");
|
|
91
|
-
+ const isSet = privateKey && jwks;
|
|
92
|
-
reading.stop();
|
|
93
|
-
if (!force && isSet)
|
|
94
|
-
return "kept";
|
|
95
|
-
+ if (!force && Boolean(privateKey) !== Boolean(jwks)) {
|
|
96
|
-
+ throw new Error("Partial Auth key configuration; restore the matching missing key. Existing keys were preserved.");
|
|
97
|
-
+ }
|
|
98
|
-
const generating = deps.spinner("Generating an RS256 key pair…");
|
|
99
|
-
const { authPrivateKey, authJwks } = await deps.generateKeys();
|
|
100
|
-
generating.stop();
|
|
101
|
-
@@ -323,23 +326,43 @@ async function runInit(deps, options, command) {
|
|
102
|
-
deps.log(`${chalk.bold("Convex Auth")} ${chalk.dim(`setup in ${dir}`)}`);
|
|
103
|
-
const keyOutcome = await ensureAuthKeys(deps, options.force ?? false);
|
|
104
|
-
reportKeys(deps, keyOutcome);
|
|
105
|
-
- reportFiles(deps, writeAuthFiles(deps, dir));
|
|
106
|
-
- reportNextSteps(deps);
|
|
107
|
-
+ if (!options.keysOnly) {
|
|
108
|
-
+ reportFiles(deps, writeAuthFiles(deps, dir));
|
|
109
|
-
+ reportNextSteps(deps);
|
|
110
|
-
+ }
|
|
111
|
-
}
|
|
112
|
-
/** Build the commander program, wired to the given dependencies. */
|
|
113
|
-
-export function createProgram(deps = defaultDeps()) {
|
|
114
|
-
+export function createProgram(deps) {
|
|
115
|
-
const program = new Command();
|
|
116
|
-
program
|
|
117
|
-
.name("@convex-dev/auth")
|
|
118
|
-
.description("Set up Convex Auth in this project: put the signing keys on the " +
|
|
119
|
-
"Convex deployment, and scaffold the convex/ files.")
|
|
120
|
-
.option("--force", "Regenerate the auth signing keys even if already set")
|
|
121
|
-
+ .option("--keys-only", "Set up signing keys without scaffolding files")
|
|
122
|
-
+ .option("--prod", "Set up signing keys on production")
|
|
123
|
-
+ .addOption(new Option("--preview-name <name>", "Set up signing keys on a named preview").conflicts("prod"))
|
|
124
|
-
// Mark every failure with the same symbol, both ours (`command.error`) and
|
|
125
|
-
// the ones commander itself writes, which start with "error: ".
|
|
126
|
-
.configureOutput({
|
|
127
|
-
outputError: (text, write) => write(`${symbols.failed} ${text.replace(/^error: /, "")}`),
|
|
128
|
-
})
|
|
129
|
-
- .action((options, command) => runInit(deps, options, command));
|
|
130
|
-
+ .action((options, command) => {
|
|
131
|
-
+ if (options.previewName !== undefined && (!options.previewName.trim() || options.previewName.startsWith("-"))) {
|
|
132
|
-
+ command.error("--preview-name must identify a preview deployment");
|
|
133
|
-
+ }
|
|
134
|
-
+ const key = process.env.CONVEX_DEPLOY_KEY;
|
|
135
|
-
+ if (key && options.previewName && !key.startsWith("preview:")) {
|
|
136
|
-
+ command.error("Preview setup requires a preview project deploy key.");
|
|
137
|
-
+ }
|
|
138
|
-
+ if (key && options.prod && !key.startsWith("prod:")) {
|
|
139
|
-
+ command.error("Production setup requires a production deploy key.");
|
|
140
|
-
+ }
|
|
141
|
-
+ const deploymentArgs = options.previewName
|
|
142
|
-
+ ? ["--preview-name", options.previewName]
|
|
143
|
-
+ : options.prod ? ["--prod"] : [];
|
|
144
|
-
+ return runInit(deps ?? defaultDeps(deploymentArgs), options, command);
|
|
145
|
-
+ });
|
|
146
|
-
return program;
|
|
147
|
-
}
|
|
148
|
-
export { runInit };
|
|
149
|
-
diff --git a/dist/internal-types/cli/program.d.ts b/dist/internal-types/cli/program.d.ts
|
|
150
|
-
index bd6fd586968841cfda5aff80bb943f27d1a9e75d..793c51c8fdb474be84d2518c2a7382790be2f16c 100644
|
|
151
|
-
--- a/dist/internal-types/cli/program.d.ts
|
|
152
|
-
+++ b/dist/internal-types/cli/program.d.ts
|
|
153
|
-
@@ -56,7 +56,7 @@ export declare function installCommand(packageManager: string): "pnpm add @conve
|
|
154
|
-
*/
|
|
155
|
-
export declare function detectPackageManager(dir: string, env?: NodeJS.ProcessEnv): PackageManager;
|
|
156
|
-
/** The real implementations, injected into `runInit` (overridden in tests). */
|
|
157
|
-
-export declare function defaultDeps(): InitDeps;
|
|
158
|
-
+export declare function defaultDeps(deploymentArgs?: string[]): InitDeps;
|
|
159
|
-
/**
|
|
160
|
-
* Run the full initialization against the injected `deps`. Fatal problems are
|
|
161
|
-
* reported via `command.error`, which prints to stderr and exits (or throws a
|
|
162
|
-
@@ -64,6 +64,7 @@ export declare function defaultDeps(): InitDeps;
|
|
163
|
-
*/
|
|
164
|
-
declare function runInit(deps: InitDeps, options: {
|
|
165
|
-
force?: boolean;
|
|
166
|
-
+ keysOnly?: boolean;
|
|
167
|
-
}, command: Command): Promise<void>;
|
|
168
|
-
/** Build the commander program, wired to the given dependencies. */
|
|
169
|
-
export declare function createProgram(deps?: InitDeps): Command;
|
|
170
|
-
diff --git a/src/cli/program.ts b/src/cli/program.ts
|
|
171
|
-
index a437ec4aa701ff90839badf12279350342b83d31..5aae1fd9b0a35757e290ea79c55519b002999bf6 100644
|
|
172
|
-
--- a/src/cli/program.ts
|
|
173
|
-
+++ b/src/cli/program.ts
|
|
174
|
-
@@ -20,7 +20,7 @@
|
|
175
|
-
// (e.g. by skipping the need for a key pair generation + simplyfying the API)
|
|
176
|
-
// so that users don’t need to rely on this.
|
|
177
|
-
|
|
178
|
-
-import { Command } from "commander";
|
|
179
|
-
+import { Command, Option } from "commander";
|
|
180
|
-
import { generateKeyPair, exportPKCS8, exportJWK } from "jose";
|
|
181
|
-
import { randomUUID } from "node:crypto";
|
|
182
|
-
import { spawnSync } from "node:child_process";
|
|
183
|
-
@@ -191,8 +191,8 @@ async function generateAuthKeys() {
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/** Read an env var off the current directory's Convex deployment. */
|
|
187
|
-
-function getConvexEnv(key: string) {
|
|
188
|
-
- const result = spawnSync("npx", ["convex", "env", "get", key], {
|
|
189
|
-
+function getConvexEnv(key: string, deploymentArgs: string[]) {
|
|
190
|
-
+ const result = spawnSync("bunx", ["--no-install", "convex", "env", "get", key, ...deploymentArgs], {
|
|
191
|
-
cwd: process.cwd(),
|
|
192
|
-
encoding: "utf8",
|
|
193
|
-
});
|
|
194
|
-
@@ -206,24 +206,20 @@ function getConvexEnv(key: string) {
|
|
195
|
-
*
|
|
196
|
-
* The output of the Convex CLI is captured, not printed: it echoes the value it
|
|
197
|
-
* sets, and one of the values here is the private signing key. If the command
|
|
198
|
-
- * fails, its stderr goes into the error message.
|
|
199
|
-
+ * fails, only a sanitized error is returned.
|
|
200
|
-
*/
|
|
201
|
-
-function setConvexEnv(key: string, value: string) {
|
|
202
|
-
- const result = spawnSync("npx", ["convex", "env", "set", key, value], {
|
|
203
|
-
+function setConvexEnv(key: string, value: string, deploymentArgs: string[]) {
|
|
204
|
-
+ const result = spawnSync("bunx", ["--no-install", "convex", "env", "set", key, value, ...deploymentArgs], {
|
|
205
|
-
cwd: process.cwd(),
|
|
206
|
-
encoding: "utf8",
|
|
207
|
-
});
|
|
208
|
-
if (result.status !== 0) {
|
|
209
|
-
- const reason = (result.stderr ?? "").trim();
|
|
210
|
-
- throw new Error(
|
|
211
|
-
- `Could not set ${key} on the Convex deployment.` +
|
|
212
|
-
- (reason.length > 0 ? `\n\n${indent(reason)}` : ""),
|
|
213
|
-
- );
|
|
214
|
-
+ throw new Error(`Could not set ${key} on the selected Convex deployment.`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** The real implementations, injected into `runInit` (overridden in tests). */
|
|
219
|
-
-export function defaultDeps(): InitDeps {
|
|
220
|
-
+export function defaultDeps(deploymentArgs: string[] = []): InitDeps {
|
|
221
|
-
return {
|
|
222
|
-
cwd: () => process.cwd(),
|
|
223
|
-
fs: {
|
|
224
|
-
@@ -236,8 +232,8 @@ export function defaultDeps(): InitDeps {
|
|
225
|
-
warn: (message) => console.warn(message),
|
|
226
|
-
spinner: startSpinner,
|
|
227
|
-
generateKeys: generateAuthKeys,
|
|
228
|
-
- getEnv: getConvexEnv,
|
|
229
|
-
- setEnv: setConvexEnv,
|
|
230
|
-
+ getEnv: (key) => getConvexEnv(key, deploymentArgs),
|
|
231
|
-
+ setEnv: (key, value) => setConvexEnv(key, value, deploymentArgs),
|
|
232
|
-
detectPackageManager,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
@@ -286,9 +282,14 @@ async function ensureAuthKeys(
|
|
236
|
-
force: boolean,
|
|
237
|
-
): Promise<KeyOutcome> {
|
|
238
|
-
const reading = deps.spinner("Reading the deployment environment…");
|
|
239
|
-
- const isSet = deps.getEnv("AUTH_PRIVATE_KEY") && deps.getEnv("AUTH_JWKS");
|
|
240
|
-
+ const privateKey = deps.getEnv("AUTH_PRIVATE_KEY");
|
|
241
|
-
+ const jwks = deps.getEnv("AUTH_JWKS");
|
|
242
|
-
+ const isSet = privateKey && jwks;
|
|
243
|
-
reading.stop();
|
|
244
|
-
if (!force && isSet) return "kept";
|
|
245
|
-
+ if (!force && Boolean(privateKey) !== Boolean(jwks)) {
|
|
246
|
-
+ throw new Error("Partial Auth key configuration; restore the matching missing key. Existing keys were preserved.");
|
|
247
|
-
+ }
|
|
248
|
-
|
|
249
|
-
const generating = deps.spinner("Generating an RS256 key pair…");
|
|
250
|
-
const { authPrivateKey, authJwks } = await deps.generateKeys();
|
|
251
|
-
@@ -391,7 +392,7 @@ function reportNextSteps(deps: InitDeps) {
|
|
252
|
-
*/
|
|
253
|
-
async function runInit(
|
|
254
|
-
deps: InitDeps,
|
|
255
|
-
- options: { force?: boolean },
|
|
256
|
-
+ options: { force?: boolean; keysOnly?: boolean },
|
|
257
|
-
command: Command,
|
|
258
|
-
) {
|
|
259
|
-
const dir = deps.cwd();
|
|
260
|
-
@@ -431,12 +432,14 @@ async function runInit(
|
|
261
|
-
const keyOutcome = await ensureAuthKeys(deps, options.force ?? false);
|
|
262
|
-
reportKeys(deps, keyOutcome);
|
|
263
|
-
|
|
264
|
-
- reportFiles(deps, writeAuthFiles(deps, dir));
|
|
265
|
-
- reportNextSteps(deps);
|
|
266
|
-
+ if (!options.keysOnly) {
|
|
267
|
-
+ reportFiles(deps, writeAuthFiles(deps, dir));
|
|
268
|
-
+ reportNextSteps(deps);
|
|
269
|
-
+ }
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** Build the commander program, wired to the given dependencies. */
|
|
273
|
-
-export function createProgram(deps: InitDeps = defaultDeps()) {
|
|
274
|
-
+export function createProgram(deps?: InitDeps) {
|
|
275
|
-
const program = new Command();
|
|
276
|
-
program
|
|
277
|
-
.name("@convex-dev/auth")
|
|
278
|
-
@@ -445,13 +448,31 @@ export function createProgram(deps: InitDeps = defaultDeps()) {
|
|
279
|
-
"Convex deployment, and scaffold the convex/ files.",
|
|
280
|
-
)
|
|
281
|
-
.option("--force", "Regenerate the auth signing keys even if already set")
|
|
282
|
-
+ .option("--keys-only", "Set up signing keys without scaffolding files")
|
|
283
|
-
+ .option("--prod", "Set up signing keys on production")
|
|
284
|
-
+ .addOption(new Option("--preview-name <name>", "Set up signing keys on a named preview").conflicts("prod"))
|
|
285
|
-
// Mark every failure with the same symbol, both ours (`command.error`) and
|
|
286
|
-
// the ones commander itself writes, which start with "error: ".
|
|
287
|
-
.configureOutput({
|
|
288
|
-
outputError: (text, write) =>
|
|
289
|
-
write(`${symbols.failed} ${text.replace(/^error: /, "")}`),
|
|
290
|
-
})
|
|
291
|
-
- .action((options, command) => runInit(deps, options, command));
|
|
292
|
-
+ .action((options, command) => {
|
|
293
|
-
+ if (options.previewName !== undefined && (!options.previewName.trim() || options.previewName.startsWith("-"))) {
|
|
294
|
-
+ command.error("--preview-name must identify a preview deployment");
|
|
295
|
-
+ }
|
|
296
|
-
+ const key = process.env.CONVEX_DEPLOY_KEY;
|
|
297
|
-
+ if (key && options.previewName && !key.startsWith("preview:")) {
|
|
298
|
-
+ command.error("Preview setup requires a preview project deploy key.");
|
|
299
|
-
+ }
|
|
300
|
-
+ if (key && options.prod && !key.startsWith("prod:")) {
|
|
301
|
-
+ command.error("Production setup requires a production deploy key.");
|
|
302
|
-
+ }
|
|
303
|
-
+ const deploymentArgs = options.previewName
|
|
304
|
-
+ ? ["--preview-name", options.previewName]
|
|
305
|
-
+ : options.prod ? ["--prod"] : [];
|
|
306
|
-
+ return runInit(deps ?? defaultDeps(deploymentArgs), options, command);
|
|
307
|
-
+ });
|
|
308
|
-
return program;
|
|
309
|
-
}
|
|
310
|
-
|