@hachej/boring-core 0.1.64 → 0.1.66
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/CoreFront-DB1OfNJU.d.ts +65 -0
- package/dist/{PostgresMeteringStore-qjKGmVFr.d.ts → PostgresModelBudgetStore-CFbEEdQL.d.ts} +44 -2
- package/dist/app/front/index.d.ts +9 -8
- package/dist/app/front/index.js +4 -1
- package/dist/app/server/index.d.ts +3 -3
- package/dist/app/server/index.js +4 -2
- package/dist/{authHook-CcUgmE_N.d.ts → authHook-BUSGTx_o.d.ts} +2 -2
- package/dist/{chunk-NC46VGXS.js → chunk-3B7LU76T.js} +673 -502
- package/dist/{chunk-BU6GSLJL.js → chunk-CIRY3ZLU.js} +78 -11
- package/dist/{chunk-6ZY63QYN.js → chunk-EFM5IWTK.js} +342 -17
- package/dist/{connection-B5wXGP69.d.ts → connection-D9s7Td0I.d.ts} +8 -2
- package/dist/front/index.d.ts +29 -27
- package/dist/front/index.js +7 -1
- package/dist/front/top-bar-slot.d.ts +2 -2
- package/dist/server/db/index.d.ts +18 -6
- package/dist/server/db/index.js +5 -1
- package/dist/server/index.d.ts +8 -7
- package/dist/server/index.js +9 -3
- package/dist/shared/index.d.ts +2 -2
- package/dist/{types-Bb7I-83I.d.ts → types-DVgeIw1d.d.ts} +1 -0
- package/drizzle/0015_model_budget_reservations.sql +22 -0
- package/drizzle/0016_workspace_managed_by.sql +1 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +30 -30
- package/dist/CoreFront-N0QJSYaM.d.ts +0 -23
package/dist/front/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
4
|
-
import { R as RuntimeConfig, g as CapabilitiesResponse, d as WorkspaceMember, U as User, c as Workspace, M as MemberRole, S as SessionState } from '../types-
|
|
3
|
+
import { R as RuntimeConfig, g as CapabilitiesResponse, d as WorkspaceMember, U as User, c as Workspace, M as MemberRole, S as SessionState } from '../types-DVgeIw1d.js';
|
|
4
|
+
export { b as CompanyAdminLabels, c as CompanyAdminProvider, d as CompanyAdminProviderProps, e as CompanyAdminStatus, f as CoreFront, C as CoreFrontAuthPagesOverride, a as CoreFrontCompanyAdminOptions, g as CoreFrontProps, L as LoadCompanyAdminStatus, R as RenderCompanyAdminContent, u as useCompanyAdminStatus } from '../CoreFront-DB1OfNJU.js';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import * as better_auth_react from 'better-auth/react';
|
|
7
7
|
import { createAuthClient } from 'better-auth/react';
|
|
8
8
|
import * as better_auth from 'better-auth';
|
|
9
|
-
export { a as CoreFront, C as CoreFrontAuthPagesOverride, b as CoreFrontProps } from '../CoreFront-N0QJSYaM.js';
|
|
10
9
|
import { NavigateFunction } from 'react-router-dom';
|
|
11
10
|
export { TopBarSlotProvider, useTopBarSlot } from './top-bar-slot.js';
|
|
12
11
|
|
|
@@ -23,7 +22,7 @@ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppError
|
|
|
23
22
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
24
23
|
private handleReload;
|
|
25
24
|
private handleRetry;
|
|
26
|
-
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> |
|
|
25
|
+
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
interface ConfigProviderProps {
|
|
@@ -31,7 +30,7 @@ interface ConfigProviderProps {
|
|
|
31
30
|
/** @internal Override retry backoff delays (ms). Default: [500, 1000, 2000]. */
|
|
32
31
|
retryBackoff?: number[];
|
|
33
32
|
}
|
|
34
|
-
declare function ConfigProvider({ children, retryBackoff, }: ConfigProviderProps):
|
|
33
|
+
declare function ConfigProvider({ children, retryBackoff, }: ConfigProviderProps): react.JSX.Element | null;
|
|
35
34
|
declare function useConfig(): RuntimeConfig;
|
|
36
35
|
declare function useConfigLoaded(): boolean;
|
|
37
36
|
|
|
@@ -47,7 +46,7 @@ interface ThemeProviderProps {
|
|
|
47
46
|
children: ReactNode;
|
|
48
47
|
defaultTheme?: ThemePreference;
|
|
49
48
|
}
|
|
50
|
-
declare function ThemeProvider({ children, defaultTheme }: ThemeProviderProps):
|
|
49
|
+
declare function ThemeProvider({ children, defaultTheme }: ThemeProviderProps): react.JSX.Element;
|
|
51
50
|
declare function useTheme(): ThemeApi;
|
|
52
51
|
|
|
53
52
|
interface Binding {
|
|
@@ -68,7 +67,7 @@ declare function useCapabilities(): CapabilitiesResponse;
|
|
|
68
67
|
type EnrichedMember = WorkspaceMember & {
|
|
69
68
|
user: Pick<User, 'id' | 'email' | 'name' | 'image'>;
|
|
70
69
|
};
|
|
71
|
-
declare function useWorkspaceMembers(workspaceId: string): _tanstack_react_query.UseQueryResult<EnrichedMember[]
|
|
70
|
+
declare function useWorkspaceMembers(workspaceId: string): _tanstack_react_query.UseQueryResult<NoInfer<EnrichedMember[]>, Error>;
|
|
72
71
|
|
|
73
72
|
type WorkspaceRouteStatus = {
|
|
74
73
|
status: 'idle';
|
|
@@ -102,7 +101,7 @@ interface WorkspaceAuthProviderProps {
|
|
|
102
101
|
workspaceRoute?: string;
|
|
103
102
|
workspaceIdParam?: string;
|
|
104
103
|
}
|
|
105
|
-
declare function WorkspaceAuthProvider({ children, workspaceRoute, workspaceIdParam, }: WorkspaceAuthProviderProps):
|
|
104
|
+
declare function WorkspaceAuthProvider({ children, workspaceRoute, workspaceIdParam, }: WorkspaceAuthProviderProps): react.JSX.Element;
|
|
106
105
|
declare function useCurrentWorkspace(): Workspace | null;
|
|
107
106
|
declare function useWorkspaceRole(): MemberRole | null;
|
|
108
107
|
declare function useWorkspaceRouteStatus(): WorkspaceRouteStatus;
|
|
@@ -115,7 +114,7 @@ interface AuthProviderProps {
|
|
|
115
114
|
};
|
|
116
115
|
navigate?: (path: string) => void;
|
|
117
116
|
}
|
|
118
|
-
declare function AuthProvider({ children, baseURL, queryClient, navigate, }: AuthProviderProps):
|
|
117
|
+
declare function AuthProvider({ children, baseURL, queryClient, navigate, }: AuthProviderProps): react.JSX.Element;
|
|
119
118
|
declare function useSession(): SessionState;
|
|
120
119
|
declare function useSignIn(): {
|
|
121
120
|
magicLink: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
@@ -367,7 +366,7 @@ interface UserIdentity {
|
|
|
367
366
|
interface UserIdentityProviderProps {
|
|
368
367
|
children: ReactNode;
|
|
369
368
|
}
|
|
370
|
-
declare function UserIdentityProvider({ children }: UserIdentityProviderProps):
|
|
369
|
+
declare function UserIdentityProvider({ children }: UserIdentityProviderProps): react.JSX.Element;
|
|
371
370
|
declare function useUser(): UserIdentity | null;
|
|
372
371
|
|
|
373
372
|
type InferAuthClient = ReturnType<typeof createAuthClient<{
|
|
@@ -384,17 +383,17 @@ interface GoogleAuthButtonProps {
|
|
|
384
383
|
errorCallbackURL?: string;
|
|
385
384
|
onError?: (message?: string) => void;
|
|
386
385
|
}
|
|
387
|
-
declare function GoogleAuthButton({ callbackURL, errorCallbackURL, onError, }: GoogleAuthButtonProps):
|
|
386
|
+
declare function GoogleAuthButton({ callbackURL, errorCallbackURL, onError, }: GoogleAuthButtonProps): react.JSX.Element;
|
|
388
387
|
|
|
389
|
-
declare function SignInPage():
|
|
388
|
+
declare function SignInPage(): react.JSX.Element;
|
|
390
389
|
|
|
391
|
-
declare function SignUpPage():
|
|
390
|
+
declare function SignUpPage(): react.JSX.Element;
|
|
392
391
|
|
|
393
|
-
declare function ForgotPasswordPage():
|
|
392
|
+
declare function ForgotPasswordPage(): react.JSX.Element;
|
|
394
393
|
|
|
395
|
-
declare function ResetPasswordPage():
|
|
394
|
+
declare function ResetPasswordPage(): react.JSX.Element;
|
|
396
395
|
|
|
397
|
-
declare function VerifyEmailPage():
|
|
396
|
+
declare function VerifyEmailPage(): react.JSX.Element;
|
|
398
397
|
|
|
399
398
|
/** A host-provided settings section inserted after the profile panel, with its own
|
|
400
399
|
* nav entry. Lets a host add feature sections (e.g. billing) WITHOUT this page —
|
|
@@ -412,9 +411,9 @@ interface UserSettingsPageProps {
|
|
|
412
411
|
* profile panel. Omitted entirely when not provided. */
|
|
413
412
|
extraSections?: UserSettingsSection[];
|
|
414
413
|
}
|
|
415
|
-
declare function UserSettingsPage({ topBar, extraSections }?: UserSettingsPageProps):
|
|
414
|
+
declare function UserSettingsPage({ topBar, extraSections }?: UserSettingsPageProps): react.JSX.Element;
|
|
416
415
|
|
|
417
|
-
declare function InviteAcceptPage():
|
|
416
|
+
declare function InviteAcceptPage(): react.JSX.Element | null;
|
|
418
417
|
|
|
419
418
|
declare function setApiBase(base: string): void;
|
|
420
419
|
declare function getApiBase(): string;
|
|
@@ -442,6 +441,7 @@ type RouteMap = {
|
|
|
442
441
|
workspaceMembers: '/w/:id/members';
|
|
443
442
|
workspaceInvites: '/w/:id/invites';
|
|
444
443
|
workspaceSettings: '/w/:id/settings';
|
|
444
|
+
companyAdmin: '/w/:id/admin';
|
|
445
445
|
inviteAccept: '/invites/:token';
|
|
446
446
|
};
|
|
447
447
|
declare const routes: RouteMap;
|
|
@@ -463,7 +463,7 @@ interface AuthGateProps {
|
|
|
463
463
|
now?: () => number;
|
|
464
464
|
requireEmailVerification?: boolean;
|
|
465
465
|
}
|
|
466
|
-
declare function AuthGate({ children, publicPaths, graceMs, location, navigate, now, requireEmailVerification, }: AuthGateProps):
|
|
466
|
+
declare function AuthGate({ children, publicPaths, graceMs, location, navigate, now, requireEmailVerification, }: AuthGateProps): react.JSX.Element | null;
|
|
467
467
|
|
|
468
468
|
interface CoreCommand {
|
|
469
469
|
id: string;
|
|
@@ -476,14 +476,16 @@ interface CoreCommand {
|
|
|
476
476
|
}
|
|
477
477
|
declare function useCoreCommands(): CoreCommand[];
|
|
478
478
|
|
|
479
|
-
declare function InvitesPage():
|
|
479
|
+
declare function InvitesPage(): react.JSX.Element;
|
|
480
480
|
|
|
481
|
-
declare function MembersPage():
|
|
481
|
+
declare function MembersPage(): react.JSX.Element;
|
|
482
482
|
|
|
483
483
|
interface WorkspaceSettingsPageProps {
|
|
484
484
|
topBar?: ReactNode;
|
|
485
485
|
}
|
|
486
|
-
declare function WorkspaceSettingsPage({ topBar }?: WorkspaceSettingsPageProps):
|
|
486
|
+
declare function WorkspaceSettingsPage({ topBar }?: WorkspaceSettingsPageProps): react.JSX.Element;
|
|
487
|
+
|
|
488
|
+
declare function CompanyAdminPage(): react.JSX.Element | null;
|
|
487
489
|
|
|
488
490
|
interface WorkspaceCommand {
|
|
489
491
|
id: string;
|
|
@@ -503,7 +505,7 @@ interface UserMenuProps {
|
|
|
503
505
|
* avatar + name + chevron, for the app-left footer account row. */
|
|
504
506
|
variant?: 'compact' | 'bar';
|
|
505
507
|
}
|
|
506
|
-
declare function UserMenu({ contentSide, contentAlign, variant }?: UserMenuProps):
|
|
508
|
+
declare function UserMenu({ contentSide, contentAlign, variant }?: UserMenuProps): react.JSX.Element;
|
|
507
509
|
|
|
508
510
|
interface WorkspaceSwitcherProps {
|
|
509
511
|
appTitle?: string;
|
|
@@ -515,7 +517,7 @@ interface WorkspaceSwitcherProps {
|
|
|
515
517
|
*/
|
|
516
518
|
displayMode?: 'full' | 'workspace';
|
|
517
519
|
}
|
|
518
|
-
declare function WorkspaceSwitcher({ appTitle, workspacePathPrefix, displayMode, }: WorkspaceSwitcherProps):
|
|
520
|
+
declare function WorkspaceSwitcher({ appTitle, workspacePathPrefix, displayMode, }: WorkspaceSwitcherProps): react.JSX.Element;
|
|
519
521
|
|
|
520
522
|
interface CreateWorkspaceDialogProps {
|
|
521
523
|
open: boolean;
|
|
@@ -534,13 +536,13 @@ interface CreateWorkspaceDialogProps {
|
|
|
534
536
|
* `open`/`onOpenChange`; primes the workspaces cache and calls `onCreated`
|
|
535
537
|
* (e.g. to navigate to the new workspace).
|
|
536
538
|
*/
|
|
537
|
-
declare function CreateWorkspaceDialog({ open, onOpenChange, onCreated, title, description, entityNoun, }: CreateWorkspaceDialogProps):
|
|
539
|
+
declare function CreateWorkspaceDialog({ open, onOpenChange, onCreated, title, description, entityNoun, }: CreateWorkspaceDialogProps): react.JSX.Element;
|
|
538
540
|
|
|
539
|
-
declare function ThemeToggle():
|
|
541
|
+
declare function ThemeToggle(): react.JSX.Element;
|
|
540
542
|
|
|
541
543
|
declare function sanitizeMarkdown(input: string): string;
|
|
542
544
|
declare function sanitizeToolOutput(input: string): string;
|
|
543
545
|
|
|
544
546
|
declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, ms: number): T;
|
|
545
547
|
|
|
546
|
-
export { AppErrorBoundary, type AuthClient, AuthGate, type AuthGateProps, AuthProvider, type AuthProviderProps, type Binding, type Breakpoint, ConfigProvider, type ConfigProviderProps, type CoreCommand, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type EnrichedMember, ForgotPasswordPage, GoogleAuthButton, type GoogleAuthButtonProps, InviteAcceptPage, InvitesPage, MembersPage, ResetPasswordPage, type RouteMap, SignInPage, SignUpPage, type ThemeApi, ThemeProvider, type ThemeProviderProps, ThemeToggle, type UserIdentity, UserIdentityProvider, type UserIdentityProviderProps, UserMenu, UserSettingsPage, VerifyEmailPage, WorkspaceAuthProvider, type WorkspaceAuthProviderProps, type WorkspaceCommand, type WorkspaceRouteStatus, WorkspaceSettingsPage, WorkspaceSwitcher, apiFetch, apiFetchJson, buildApiUrl, buildWsUrl, debounce, getApiBase, getAuthClient, getHttpErrorDetail, getWorkspaceCommands, getWsBase, openWebSocket, routeHref, routes, sanitizeMarkdown, sanitizeToolOutput, setApiBase, useBlobUrl, useCapabilities, useChangePassword, useConfig, useConfigLoaded, useCoreCommands, useCurrentWorkspace, useKeyboardShortcuts, useReducedMotion, useSendVerificationEmail, useSession, useSignIn, useSignOut, useSignUp, useTheme, useUser, useVerifyEmail, useViewportBreakpoint, useWorkspaceMembers, useWorkspaceRole, useWorkspaceRouteStatus };
|
|
548
|
+
export { AppErrorBoundary, type AuthClient, AuthGate, type AuthGateProps, AuthProvider, type AuthProviderProps, type Binding, type Breakpoint, CompanyAdminPage, ConfigProvider, type ConfigProviderProps, type CoreCommand, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type EnrichedMember, ForgotPasswordPage, GoogleAuthButton, type GoogleAuthButtonProps, InviteAcceptPage, InvitesPage, MembersPage, ResetPasswordPage, type RouteMap, SignInPage, SignUpPage, type ThemeApi, ThemeProvider, type ThemeProviderProps, ThemeToggle, type UserIdentity, UserIdentityProvider, type UserIdentityProviderProps, UserMenu, UserSettingsPage, VerifyEmailPage, WorkspaceAuthProvider, type WorkspaceAuthProviderProps, type WorkspaceCommand, type WorkspaceRouteStatus, WorkspaceSettingsPage, WorkspaceSwitcher, apiFetch, apiFetchJson, buildApiUrl, buildWsUrl, debounce, getApiBase, getAuthClient, getHttpErrorDetail, getWorkspaceCommands, getWsBase, openWebSocket, routeHref, routes, sanitizeMarkdown, sanitizeToolOutput, setApiBase, useBlobUrl, useCapabilities, useChangePassword, useConfig, useConfigLoaded, useCoreCommands, useCurrentWorkspace, useKeyboardShortcuts, useReducedMotion, useSendVerificationEmail, useSession, useSignIn, useSignOut, useSignUp, useTheme, useUser, useVerifyEmail, useViewportBreakpoint, useWorkspaceMembers, useWorkspaceRole, useWorkspaceRouteStatus };
|
package/dist/front/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
AppErrorBoundary,
|
|
3
3
|
AuthGate,
|
|
4
4
|
AuthProvider,
|
|
5
|
+
CompanyAdminPage,
|
|
6
|
+
CompanyAdminProvider,
|
|
5
7
|
ConfigProvider,
|
|
6
8
|
CoreFront,
|
|
7
9
|
CreateWorkspaceDialog,
|
|
@@ -41,6 +43,7 @@ import {
|
|
|
41
43
|
useBlobUrl,
|
|
42
44
|
useCapabilities,
|
|
43
45
|
useChangePassword,
|
|
46
|
+
useCompanyAdminStatus,
|
|
44
47
|
useConfig,
|
|
45
48
|
useConfigLoaded,
|
|
46
49
|
useCoreCommands,
|
|
@@ -59,7 +62,7 @@ import {
|
|
|
59
62
|
useWorkspaceMembers,
|
|
60
63
|
useWorkspaceRole,
|
|
61
64
|
useWorkspaceRouteStatus
|
|
62
|
-
} from "../chunk-
|
|
65
|
+
} from "../chunk-3B7LU76T.js";
|
|
63
66
|
import {
|
|
64
67
|
TopBarSlotProvider,
|
|
65
68
|
useTopBarSlot
|
|
@@ -71,6 +74,8 @@ export {
|
|
|
71
74
|
AppErrorBoundary,
|
|
72
75
|
AuthGate,
|
|
73
76
|
AuthProvider,
|
|
77
|
+
CompanyAdminPage,
|
|
78
|
+
CompanyAdminProvider,
|
|
74
79
|
ConfigProvider,
|
|
75
80
|
CoreFront,
|
|
76
81
|
CreateWorkspaceDialog,
|
|
@@ -111,6 +116,7 @@ export {
|
|
|
111
116
|
useBlobUrl,
|
|
112
117
|
useCapabilities,
|
|
113
118
|
useChangePassword,
|
|
119
|
+
useCompanyAdminStatus,
|
|
114
120
|
useConfig,
|
|
115
121
|
useConfigLoaded,
|
|
116
122
|
useCoreCommands,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
declare function TopBarSlotProvider({ children, slot, }: {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
slot: ReactNode;
|
|
7
|
-
}):
|
|
7
|
+
}): react.JSX.Element;
|
|
8
8
|
declare function useTopBarSlot(): ReactNode | null;
|
|
9
9
|
|
|
10
10
|
export { TopBarSlotProvider, useTopBarSlot };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { U as UserStore, W as WorkspaceStore } from '../../connection-
|
|
2
|
-
export { D as Database, d as createDatabase } from '../../connection-
|
|
3
|
-
export { F as FinishReservationInput, G as GrantOnceInput, I as InsufficientCreditError, M as MeteringBalance, P as PostgresMeteringStore, R as RecordUsageInput,
|
|
4
|
-
import { U as User, c as Workspace, E as ERROR_CODES, M as MemberRole, d as WorkspaceMember, e as WorkspaceInvite, f as WorkspaceRuntime, W as WorkspaceRuntimeResourceSelector, a as WorkspaceRuntimeResource, b as WorkspaceRuntimeResourceInput } from '../../types-
|
|
1
|
+
import { U as UserStore, W as WorkspaceStore } from '../../connection-D9s7Td0I.js';
|
|
2
|
+
export { D as Database, d as createDatabase } from '../../connection-D9s7Td0I.js';
|
|
3
|
+
export { F as FinishReservationInput, G as GrantOnceInput, I as InsufficientCreditError, M as MeteringBalance, a as ModelBudgetExceededError, P as PostgresMeteringStore, b as PostgresModelBudgetStore, R as RecordUsageInput, c as RecordUsageResult, d as ReservationFinalStatus, e as ReserveInput, f as ReserveResult, g as RunMigrationsOptions, r as runMigrations } from '../../PostgresModelBudgetStore-CFbEEdQL.js';
|
|
4
|
+
import { U as User, c as Workspace, E as ERROR_CODES, M as MemberRole, d as WorkspaceMember, e as WorkspaceInvite, f as WorkspaceRuntime, W as WorkspaceRuntimeResourceSelector, a as WorkspaceRuntimeResource, b as WorkspaceRuntimeResourceInput } from '../../types-DVgeIw1d.js';
|
|
5
5
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
6
6
|
import 'postgres';
|
|
7
7
|
|
|
@@ -41,9 +41,13 @@ declare class LocalWorkspaceStore implements WorkspaceStore {
|
|
|
41
41
|
constructor(userStore: LocalUserStore);
|
|
42
42
|
create(userId: string, name: string, appId: string, opts?: {
|
|
43
43
|
isDefault?: boolean;
|
|
44
|
+
id?: string;
|
|
45
|
+
managedBy?: string;
|
|
44
46
|
}): Promise<Workspace>;
|
|
45
47
|
list(userId: string, appId: string): Promise<Workspace[]>;
|
|
46
48
|
get(id: string): Promise<Workspace | null>;
|
|
49
|
+
getIncludingDeleted(id: string): Promise<Workspace | null>;
|
|
50
|
+
restore(id: string): Promise<Workspace | null>;
|
|
47
51
|
update(id: string, updates: Partial<Pick<Workspace, 'name'>>): Promise<Workspace | null>;
|
|
48
52
|
delete(id: string): Promise<{
|
|
49
53
|
removed: boolean;
|
|
@@ -60,7 +64,9 @@ declare class LocalWorkspaceStore implements WorkspaceStore {
|
|
|
60
64
|
member?: WorkspaceMember;
|
|
61
65
|
code?: typeof ERROR_CODES.LAST_OWNER | typeof ERROR_CODES.NOT_MEMBER;
|
|
62
66
|
}>;
|
|
63
|
-
removeMember(workspaceId: string, userId: string
|
|
67
|
+
removeMember(workspaceId: string, userId: string, opts?: {
|
|
68
|
+
allowLastOwner?: boolean;
|
|
69
|
+
}): Promise<{
|
|
64
70
|
removed: boolean;
|
|
65
71
|
code?: typeof ERROR_CODES.LAST_OWNER | typeof ERROR_CODES.NOT_MEMBER;
|
|
66
72
|
}>;
|
|
@@ -115,9 +121,13 @@ declare class PostgresWorkspaceStore implements WorkspaceStore {
|
|
|
115
121
|
private getWorkspaceAppId;
|
|
116
122
|
create(userId: string, name: string, appId: string, opts?: {
|
|
117
123
|
isDefault?: boolean;
|
|
124
|
+
id?: string;
|
|
125
|
+
managedBy?: string;
|
|
118
126
|
}): Promise<Workspace>;
|
|
119
127
|
list(userId: string, appId: string): Promise<Workspace[]>;
|
|
120
128
|
get(id: string): Promise<Workspace | null>;
|
|
129
|
+
getIncludingDeleted(id: string): Promise<Workspace | null>;
|
|
130
|
+
restore(id: string): Promise<Workspace | null>;
|
|
121
131
|
update(id: string, updates: Partial<Pick<Workspace, 'name'>>): Promise<Workspace | null>;
|
|
122
132
|
delete(id: string): Promise<{
|
|
123
133
|
removed: boolean;
|
|
@@ -134,7 +144,9 @@ declare class PostgresWorkspaceStore implements WorkspaceStore {
|
|
|
134
144
|
member?: WorkspaceMember;
|
|
135
145
|
code?: typeof ERROR_CODES.LAST_OWNER | typeof ERROR_CODES.NOT_MEMBER;
|
|
136
146
|
}>;
|
|
137
|
-
removeMember(workspaceId: string, userId: string
|
|
147
|
+
removeMember(workspaceId: string, userId: string, opts?: {
|
|
148
|
+
allowLastOwner?: boolean;
|
|
149
|
+
}): Promise<{
|
|
138
150
|
removed: boolean;
|
|
139
151
|
code?: typeof ERROR_CODES.LAST_OWNER | typeof ERROR_CODES.NOT_MEMBER;
|
|
140
152
|
}>;
|
package/dist/server/db/index.js
CHANGED
|
@@ -2,19 +2,23 @@ import {
|
|
|
2
2
|
InsufficientCreditError,
|
|
3
3
|
LocalUserStore,
|
|
4
4
|
LocalWorkspaceStore,
|
|
5
|
+
ModelBudgetExceededError,
|
|
5
6
|
PostgresMeteringStore,
|
|
7
|
+
PostgresModelBudgetStore,
|
|
6
8
|
PostgresUserStore,
|
|
7
9
|
PostgresWorkspaceStore,
|
|
8
10
|
createDatabase,
|
|
9
11
|
runMigrations
|
|
10
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-EFM5IWTK.js";
|
|
11
13
|
import "../../chunk-QZGYKLXB.js";
|
|
12
14
|
import "../../chunk-MLKGABMK.js";
|
|
13
15
|
export {
|
|
14
16
|
InsufficientCreditError,
|
|
15
17
|
LocalUserStore,
|
|
16
18
|
LocalWorkspaceStore,
|
|
19
|
+
ModelBudgetExceededError,
|
|
17
20
|
PostgresMeteringStore,
|
|
21
|
+
PostgresModelBudgetStore,
|
|
18
22
|
PostgresUserStore,
|
|
19
23
|
PostgresWorkspaceStore,
|
|
20
24
|
createDatabase,
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { L as LoadConfigOptions } from '../authHook-
|
|
2
|
-
export { A as AuthHookOptions, B as BetterAuthInstance, C as CreateAuthOptions, a as authHook, b as buildRuntimeConfigPayload, c as createAuth, l as loadConfig, v as validateConfig, d as validatePasswordStrength } from '../authHook-
|
|
1
|
+
import { L as LoadConfigOptions } from '../authHook-BUSGTx_o.js';
|
|
2
|
+
export { A as AuthHookOptions, B as BetterAuthInstance, C as CreateAuthOptions, a as authHook, b as buildRuntimeConfigPayload, c as createAuth, l as loadConfig, v as validateConfig, d as validatePasswordStrength } from '../authHook-BUSGTx_o.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { C as CoreConfig, M as MemberRole, W as WorkspaceRuntimeResourceSelector, a as WorkspaceRuntimeResource, b as WorkspaceRuntimeResourceInput } from '../types-
|
|
4
|
+
import { C as CoreConfig, M as MemberRole, W as WorkspaceRuntimeResourceSelector, a as WorkspaceRuntimeResource, b as WorkspaceRuntimeResourceInput } from '../types-DVgeIw1d.js';
|
|
5
5
|
import * as fastify from 'fastify';
|
|
6
6
|
import { FastifyInstance, FastifyPluginAsync, preHandlerHookHandler, FastifyRequest, FastifyReply } from 'fastify';
|
|
7
7
|
import * as http from 'http';
|
|
8
8
|
import { IncomingMessage } from 'node:http';
|
|
9
|
-
import { C as CreateCoreAppOptions, D as Database, U as UserStore, W as WorkspaceStore, a as WorkspaceProvisioner } from '../connection-
|
|
10
|
-
export { A as AuthProvider, b as CapabilitiesContributor, P as ProvisionContext, c as ProvisionResult, d as createDatabase } from '../connection-
|
|
9
|
+
import { C as CreateCoreAppOptions, D as Database, U as UserStore, W as WorkspaceStore, a as WorkspaceProvisioner } from '../connection-D9s7Td0I.js';
|
|
10
|
+
export { A as AuthProvider, b as CapabilitiesContributor, P as ProvisionContext, c as ProvisionResult, d as createDatabase } from '../connection-D9s7Td0I.js';
|
|
11
11
|
import postgres from 'postgres';
|
|
12
|
-
import { P as PostgresMeteringStore, C as CreditLedgerEntry } from '../
|
|
13
|
-
export { F as FinishReservationInput, G as GrantOnceInput, I as InsufficientCreditError, M as MeteringBalance, R as RecordUsageInput,
|
|
12
|
+
import { P as PostgresMeteringStore, C as CreditLedgerEntry } from '../PostgresModelBudgetStore-CFbEEdQL.js';
|
|
13
|
+
export { F as FinishReservationInput, G as GrantOnceInput, I as InsufficientCreditError, M as MeteringBalance, a as ModelBudgetExceededError, b as PostgresModelBudgetStore, R as RecordUsageInput, c as RecordUsageResult, d as ReservationFinalStatus, e as ReserveInput, f as ReserveResult, r as runMigrations } from '../PostgresModelBudgetStore-CFbEEdQL.js';
|
|
14
14
|
import { T as TelemetrySink } from '../telemetry-DR18MeI0.js';
|
|
15
15
|
import { AgentMeteringSink } from '@hachej/boring-agent/server';
|
|
16
16
|
import 'better-auth';
|
|
@@ -575,6 +575,7 @@ interface CreditUsageRecord {
|
|
|
575
575
|
runId?: string;
|
|
576
576
|
messageId?: string;
|
|
577
577
|
reservationId?: string;
|
|
578
|
+
metadata?: Record<string, unknown>;
|
|
578
579
|
provider?: string;
|
|
579
580
|
model?: string;
|
|
580
581
|
usage: {
|
package/dist/server/index.js
CHANGED
|
@@ -25,13 +25,15 @@ import {
|
|
|
25
25
|
validateConfig,
|
|
26
26
|
validatePasswordStrength,
|
|
27
27
|
withUserSettingsWriteLock
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-CIRY3ZLU.js";
|
|
29
29
|
import {
|
|
30
30
|
InsufficientCreditError,
|
|
31
|
+
ModelBudgetExceededError,
|
|
31
32
|
PostgresMeteringStore,
|
|
33
|
+
PostgresModelBudgetStore,
|
|
32
34
|
createDatabase,
|
|
33
35
|
runMigrations
|
|
34
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-EFM5IWTK.js";
|
|
35
37
|
import {
|
|
36
38
|
noopTelemetry,
|
|
37
39
|
safeCapture
|
|
@@ -423,7 +425,7 @@ var CreditsService = class {
|
|
|
423
425
|
stopReason: input.stopReason,
|
|
424
426
|
// reservationId tags the row to THIS run attempt so the fallback top-up can
|
|
425
427
|
// scope to the current reservation (runId is reused on client-nonce replay).
|
|
426
|
-
metadata: { currency: "credits", ...input.reservationId ? { reservationId: input.reservationId } : {} }
|
|
428
|
+
metadata: { currency: "credits", ...input.metadata ?? {}, ...input.reservationId ? { reservationId: input.reservationId } : {} }
|
|
427
429
|
});
|
|
428
430
|
return { billedMicros: cost.billedCreditMicros };
|
|
429
431
|
}
|
|
@@ -484,6 +486,7 @@ function authRequiredError() {
|
|
|
484
486
|
}
|
|
485
487
|
function createCreditsMeteringSink(getService) {
|
|
486
488
|
return {
|
|
489
|
+
isEnabled: () => getService().config.enabled,
|
|
487
490
|
async reserveRun(input) {
|
|
488
491
|
const service = getService();
|
|
489
492
|
if (!service.config.enabled) return {};
|
|
@@ -506,6 +509,7 @@ function createCreditsMeteringSink(getService) {
|
|
|
506
509
|
runId: input.runId,
|
|
507
510
|
messageId: input.messageId,
|
|
508
511
|
reservationId: input.reservationId,
|
|
512
|
+
metadata: input.metadata,
|
|
509
513
|
provider: input.model?.provider,
|
|
510
514
|
model: input.model?.id,
|
|
511
515
|
usage: input.usage,
|
|
@@ -1593,7 +1597,9 @@ export {
|
|
|
1593
1597
|
DEFAULT_MODEL_RATES,
|
|
1594
1598
|
InsufficientCreditError,
|
|
1595
1599
|
MailDeliveryError,
|
|
1600
|
+
ModelBudgetExceededError,
|
|
1596
1601
|
PostgresMeteringStore,
|
|
1602
|
+
PostgresModelBudgetStore,
|
|
1597
1603
|
SIGNUP_GRANT_REASON,
|
|
1598
1604
|
WorkspaceRuntimeSandboxHandleStore,
|
|
1599
1605
|
authHook,
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as User, C as CoreConfig, R as RuntimeConfig } from '../types-
|
|
2
|
-
export { g as CapabilitiesResponse, h as ConfigFetchError, i as ConfigValidationError, j as CoreCapabilities, E as ERROR_CODES, k as ErrorCode, H as HttpError, J as JsonValue, M as MemberRole, l as RateLimitEndpointOverride, m as SessionPayload, S as SessionState, c as Workspace, e as WorkspaceInvite, d as WorkspaceMember, f as WorkspaceRuntime } from '../types-
|
|
1
|
+
import { U as User, C as CoreConfig, R as RuntimeConfig } from '../types-DVgeIw1d.js';
|
|
2
|
+
export { g as CapabilitiesResponse, h as ConfigFetchError, i as ConfigValidationError, j as CoreCapabilities, E as ERROR_CODES, k as ErrorCode, H as HttpError, J as JsonValue, M as MemberRole, l as RateLimitEndpointOverride, m as SessionPayload, S as SessionState, c as Workspace, e as WorkspaceInvite, d as WorkspaceMember, f as WorkspaceRuntime } from '../types-DVgeIw1d.js';
|
|
3
3
|
export { a as TelemetryEvent, T as TelemetrySink, n as noopTelemetry, s as safeCapture } from '../telemetry-DR18MeI0.js';
|
|
4
4
|
|
|
5
5
|
declare function isCoreEmailVerificationEnabled(config: Pick<CoreConfig, 'auth'>): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "boring_model_budget_reservations" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"user_id" text NOT NULL,
|
|
4
|
+
"workspace_id" text,
|
|
5
|
+
"session_id" text,
|
|
6
|
+
"run_id" text NOT NULL,
|
|
7
|
+
"provider" text NOT NULL,
|
|
8
|
+
"model" text NOT NULL,
|
|
9
|
+
"period" text NOT NULL,
|
|
10
|
+
"amount_micros" bigint NOT NULL,
|
|
11
|
+
"status" text DEFAULT 'active' NOT NULL,
|
|
12
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
13
|
+
"expires_at" timestamp NOT NULL,
|
|
14
|
+
CONSTRAINT "boring_model_budget_reservations_amount_check" CHECK ("boring_model_budget_reservations"."amount_micros" > 0),
|
|
15
|
+
CONSTRAINT "boring_model_budget_reservations_status_check" CHECK ("boring_model_budget_reservations"."status" IN ('active', 'settled', 'released', 'expired'))
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "boring_model_budget_reservations_active_user_run_idx" ON "boring_model_budget_reservations" USING btree ("user_id","run_id") WHERE "boring_model_budget_reservations"."status" = 'active';
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
CREATE INDEX IF NOT EXISTS "boring_model_budget_reservations_budget_idx" ON "boring_model_budget_reservations" USING btree ("user_id","provider","model","period","status");
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE INDEX IF NOT EXISTS "boring_model_budget_reservations_stale_idx" ON "boring_model_budget_reservations" USING btree ("status","expires_at");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "workspaces" ADD COLUMN IF NOT EXISTS "managed_by" text;
|
|
@@ -106,6 +106,20 @@
|
|
|
106
106
|
"when": 1781568000000,
|
|
107
107
|
"tag": "0014_reservation_charge_on_expire",
|
|
108
108
|
"breakpoints": true
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"idx": 15,
|
|
112
|
+
"version": "7",
|
|
113
|
+
"when": 1781654400000,
|
|
114
|
+
"tag": "0015_model_budget_reservations",
|
|
115
|
+
"breakpoints": true
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"idx": 16,
|
|
119
|
+
"version": "7",
|
|
120
|
+
"when": 1783123200000,
|
|
121
|
+
"tag": "0016_workspace_managed_by",
|
|
122
|
+
"breakpoints": true
|
|
109
123
|
}
|
|
110
124
|
]
|
|
111
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.66",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Foundation package for boring-ui-v2 apps: DB, auth, config, HTTP app factory, and frontend app shell.",
|
|
@@ -55,50 +55,50 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@fastify/cors": "^11.0.0",
|
|
57
57
|
"@fastify/helmet": "^13.0.1",
|
|
58
|
-
"@fastify/rate-limit": "^
|
|
59
|
-
"@hookform/resolvers": "^5.
|
|
58
|
+
"@fastify/rate-limit": "^11.0.0",
|
|
59
|
+
"@hookform/resolvers": "^5.4.0",
|
|
60
60
|
"@react-email/components": "^1.0.12",
|
|
61
|
-
"@react-email/render": "^2.0.
|
|
62
|
-
"@tanstack/react-query": "^5.
|
|
63
|
-
"@zxcvbn-ts/core": "^
|
|
64
|
-
"@zxcvbn-ts/language-common": "^
|
|
65
|
-
"@zxcvbn-ts/language-en": "^
|
|
66
|
-
"better-auth": "^1.6.
|
|
61
|
+
"@react-email/render": "^2.0.9",
|
|
62
|
+
"@tanstack/react-query": "^5.101.1",
|
|
63
|
+
"@zxcvbn-ts/core": "^4.1.2",
|
|
64
|
+
"@zxcvbn-ts/language-common": "^4.1.2",
|
|
65
|
+
"@zxcvbn-ts/language-en": "^4.1.1",
|
|
66
|
+
"better-auth": "^1.6.22",
|
|
67
67
|
"close-with-grace": "^2.2.0",
|
|
68
68
|
"drizzle-orm": "^0.45.2",
|
|
69
|
-
"fastify": "^5.
|
|
70
|
-
"fastify-plugin": "^
|
|
71
|
-
"isomorphic-dompurify": "^3.
|
|
72
|
-
"lucide-react": "^1.
|
|
73
|
-
"nodemailer": "^
|
|
69
|
+
"fastify": "^5.9.0",
|
|
70
|
+
"fastify-plugin": "^6.0.0",
|
|
71
|
+
"isomorphic-dompurify": "^3.18.0",
|
|
72
|
+
"lucide-react": "^1.21.0",
|
|
73
|
+
"nodemailer": "^9.0.1",
|
|
74
74
|
"pino": "^10.3.1",
|
|
75
75
|
"postgres": "^3.4.9",
|
|
76
|
-
"posthog-node": "^5.
|
|
77
|
-
"react-helmet-async": "^
|
|
78
|
-
"react-hook-form": "^7.
|
|
79
|
-
"react-router-dom": "^7.
|
|
80
|
-
"smol-toml": "^1.
|
|
76
|
+
"posthog-node": "^5.38.5",
|
|
77
|
+
"react-helmet-async": "^3.0.0",
|
|
78
|
+
"react-hook-form": "^7.80.0",
|
|
79
|
+
"react-router-dom": "^7.18.0",
|
|
80
|
+
"smol-toml": "^1.7.0",
|
|
81
81
|
"zod": "^3.25.76",
|
|
82
|
-
"@hachej/boring-
|
|
83
|
-
"@hachej/boring-workspace": "0.1.
|
|
84
|
-
"@hachej/boring-
|
|
82
|
+
"@hachej/boring-agent": "0.1.66",
|
|
83
|
+
"@hachej/boring-workspace": "0.1.66",
|
|
84
|
+
"@hachej/boring-ui-kit": "0.1.66"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@testing-library/jest-dom": "^6.9.1",
|
|
88
88
|
"@testing-library/react": "^16.3.2",
|
|
89
89
|
"@testing-library/user-event": "^14.6.1",
|
|
90
|
-
"@types/node": "^22.
|
|
90
|
+
"@types/node": "^22.20.0",
|
|
91
91
|
"@types/nodemailer": "^8.0.0",
|
|
92
|
-
"@types/react": "^19.
|
|
92
|
+
"@types/react": "^19.2.17",
|
|
93
93
|
"@types/react-dom": "^19.1.3",
|
|
94
94
|
"drizzle-kit": "^0.31.10",
|
|
95
|
-
"jsdom": "^29.
|
|
96
|
-
"react": "^19.
|
|
97
|
-
"react-dom": "^19.
|
|
95
|
+
"jsdom": "^29.1.1",
|
|
96
|
+
"react": "^19.2.7",
|
|
97
|
+
"react-dom": "^19.2.7",
|
|
98
98
|
"tsup": "^8.4.0",
|
|
99
|
-
"tsx": "^4.
|
|
100
|
-
"typescript": "^
|
|
101
|
-
"vitest": "^
|
|
99
|
+
"tsx": "^4.22.4",
|
|
100
|
+
"typescript": "^6.0.3",
|
|
101
|
+
"vitest": "^4.1.9"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
104
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface CoreFrontAuthPagesOverride {
|
|
5
|
-
signIn?: React.FC;
|
|
6
|
-
signUp?: React.FC;
|
|
7
|
-
forgotPassword?: React.FC;
|
|
8
|
-
resetPassword?: React.FC;
|
|
9
|
-
verifyEmail?: React.FC;
|
|
10
|
-
authError?: React.FC;
|
|
11
|
-
userSettings?: React.FC;
|
|
12
|
-
}
|
|
13
|
-
interface CoreFrontProps {
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
authPages?: CoreFrontAuthPagesOverride;
|
|
16
|
-
cspNonce?: string;
|
|
17
|
-
workspaceRoute?: string;
|
|
18
|
-
workspaceIdParam?: string;
|
|
19
|
-
publicPaths?: string[];
|
|
20
|
-
}
|
|
21
|
-
declare function CoreFront({ children, authPages, cspNonce, workspaceRoute, workspaceIdParam, publicPaths }: CoreFrontProps): react_jsx_runtime.JSX.Element;
|
|
22
|
-
|
|
23
|
-
export { type CoreFrontAuthPagesOverride as C, CoreFront as a, type CoreFrontProps as b };
|