@hachej/boring-core 0.1.42 → 0.1.44
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/PostgresMeteringStore-CzNv6xil.d.ts +224 -0
- package/dist/app/front/index.d.ts +216 -3
- package/dist/app/front/index.js +834 -43
- package/dist/app/server/index.d.ts +3 -3
- package/dist/app/server/index.js +33 -8
- package/dist/{authHook-DUqyxueY.d.ts → authHook-CzBsMwwM.d.ts} +2 -2
- package/dist/{chunk-C3YMOITB.js → chunk-I56OTSPB.js} +649 -6
- package/dist/{chunk-H5KU6R6Y.js → chunk-LIBHVT7V.js} +5 -1
- package/dist/{chunk-GZVKZD4P.js → chunk-UM5SHYIS.js} +11 -2
- package/dist/{chunk-MLTJKZL4.js → chunk-VYXEXOCO.js} +21 -10
- package/dist/{connection-AL8KSENV.d.ts → connection-C5SiqoNc.d.ts} +1 -1
- package/dist/front/index.d.ts +15 -2
- package/dist/front/index.js +2 -2
- package/dist/server/db/index.d.ts +4 -4
- package/dist/server/db/index.js +6 -2
- package/dist/server/index.d.ts +594 -7
- package/dist/server/index.js +1467 -4
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/{types-CbMOXLBf.d.ts → types-CWtJ4kgd.d.ts} +3 -0
- package/drizzle/0011_usage_metering.sql +57 -0
- package/drizzle/0012_credit_purchases.sql +9 -0
- package/drizzle/0013_credit_purchase_lifecycle.sql +28 -0
- package/drizzle/0014_reservation_charge_on_expire.sql +7 -0
- package/drizzle/meta/_journal.json +28 -0
- package/package.json +4 -4
- package/dist/migrate-B4dwdtGP.d.ts +0 -8
|
@@ -27,7 +27,11 @@ var ERROR_CODES = {
|
|
|
27
27
|
RATE_LIMITED: "rate_limited",
|
|
28
28
|
MAIL_DISABLED: "mail_disabled",
|
|
29
29
|
DB_UNAVAILABLE: "db_unavailable",
|
|
30
|
-
INTERNAL_ERROR: "internal_error"
|
|
30
|
+
INTERNAL_ERROR: "internal_error",
|
|
31
|
+
// Credits + purchases
|
|
32
|
+
PAYMENT_REQUIRED: "payment_required",
|
|
33
|
+
INVALID_PACK: "invalid_pack",
|
|
34
|
+
CHECKOUT_FAILED: "checkout_failed"
|
|
31
35
|
};
|
|
32
36
|
var HttpError = class extends Error {
|
|
33
37
|
status;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
creditGrants,
|
|
3
|
+
creditPurchases,
|
|
2
4
|
idempotencyKeys,
|
|
3
5
|
schema_exports,
|
|
6
|
+
usageLedger,
|
|
7
|
+
usageReservations,
|
|
4
8
|
users,
|
|
5
9
|
verification_tokens,
|
|
6
10
|
workspaceInvites,
|
|
@@ -8,12 +12,12 @@ import {
|
|
|
8
12
|
workspaceRuntimes,
|
|
9
13
|
workspaceSettings,
|
|
10
14
|
workspaces
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I56OTSPB.js";
|
|
12
16
|
import {
|
|
13
17
|
ConfigValidationError,
|
|
14
18
|
ERROR_CODES,
|
|
15
19
|
HttpError
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LIBHVT7V.js";
|
|
17
21
|
|
|
18
22
|
// src/server/config/schema.ts
|
|
19
23
|
import { z } from "zod";
|
|
@@ -700,6 +704,7 @@ async function createCoreApp(config, options) {
|
|
|
700
704
|
styleSrcAttr: ["'unsafe-inline'"],
|
|
701
705
|
imgSrc: ["'self'", "data:", "blob:"],
|
|
702
706
|
connectSrc: ["'self'"],
|
|
707
|
+
frameSrc: ["'self'", "https://calendly.com"],
|
|
703
708
|
fontSrc: ["'self'", "https://fonts.gstatic.com", "data:"],
|
|
704
709
|
objectSrc: ["'none'"],
|
|
705
710
|
frameAncestors: ["'none'"],
|
|
@@ -837,6 +842,10 @@ async function deleteUserCompletely(userId, deps) {
|
|
|
837
842
|
if (userRow?.email) {
|
|
838
843
|
await tx.delete(verification_tokens).where(eq(verification_tokens.identifier, userRow.email));
|
|
839
844
|
}
|
|
845
|
+
await tx.delete(usageReservations).where(eq(usageReservations.userId, userId));
|
|
846
|
+
await tx.delete(usageLedger).where(eq(usageLedger.userId, userId));
|
|
847
|
+
await tx.delete(creditGrants).where(eq(creditGrants.userId, userId));
|
|
848
|
+
await tx.delete(creditPurchases).where(eq(creditPurchases.userId, userId));
|
|
840
849
|
await tx.delete(users).where(eq(users.id, userId));
|
|
841
850
|
});
|
|
842
851
|
return;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ConfigFetchError,
|
|
6
6
|
ERROR_CODES,
|
|
7
7
|
HttpError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LIBHVT7V.js";
|
|
9
9
|
|
|
10
10
|
// src/front/AppErrorBoundary.tsx
|
|
11
11
|
import { Component } from "react";
|
|
@@ -1410,10 +1410,10 @@ function SettingsTopBar() {
|
|
|
1410
1410
|
{
|
|
1411
1411
|
"aria-hidden": "true",
|
|
1412
1412
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-foreground text-[12px] font-semibold text-background",
|
|
1413
|
-
children: "
|
|
1413
|
+
children: "S"
|
|
1414
1414
|
}
|
|
1415
1415
|
),
|
|
1416
|
-
/* @__PURE__ */ jsx13("span", { className: "truncate text-[13px] font-medium tracking-tight text-foreground", children: "
|
|
1416
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate text-[13px] font-medium tracking-tight text-foreground", children: "Sovereign Workspace" }),
|
|
1417
1417
|
/* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: "text-muted-foreground/30", children: "/" }),
|
|
1418
1418
|
/* @__PURE__ */ jsx13("span", { className: "truncate text-[13px] text-muted-foreground", children: "Account settings" })
|
|
1419
1419
|
] })
|
|
@@ -1446,12 +1446,12 @@ function SettingsPageHeader({
|
|
|
1446
1446
|
] })
|
|
1447
1447
|
] });
|
|
1448
1448
|
}
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1449
|
+
var PROFILE_NAV_ITEM = { href: "#profile", label: "Profile", description: "Identity and email" };
|
|
1450
|
+
var ACCOUNT_TAIL_NAV_ITEMS = [
|
|
1451
1451
|
{ href: "#password", label: "Password", description: "Sign-in security" },
|
|
1452
1452
|
{ href: "#danger-zone", label: "Deletion", description: "Permanent actions" }
|
|
1453
1453
|
];
|
|
1454
|
-
function UserSettingsPage({ topBar } = {}) {
|
|
1454
|
+
function UserSettingsPage({ topBar, extraSections = [] } = {}) {
|
|
1455
1455
|
const session = useSession();
|
|
1456
1456
|
const identity = useUser();
|
|
1457
1457
|
const signOut = useSignOut();
|
|
@@ -1535,7 +1535,17 @@ function UserSettingsPage({ topBar } = {}) {
|
|
|
1535
1535
|
return /* @__PURE__ */ jsxs6("main", { className: "boring-settings-shell", children: [
|
|
1536
1536
|
topBarNode,
|
|
1537
1537
|
/* @__PURE__ */ jsx13("div", { className: "boring-settings-scroll", children: /* @__PURE__ */ jsxs6("div", { className: "boring-settings-layout", children: [
|
|
1538
|
-
/* @__PURE__ */ jsx13("aside", { className: "boring-settings-sidebar", children: /* @__PURE__ */ jsx13(
|
|
1538
|
+
/* @__PURE__ */ jsx13("aside", { className: "boring-settings-sidebar", children: /* @__PURE__ */ jsx13(
|
|
1539
|
+
UiSettingsNav,
|
|
1540
|
+
{
|
|
1541
|
+
label: "Account settings",
|
|
1542
|
+
items: [
|
|
1543
|
+
PROFILE_NAV_ITEM,
|
|
1544
|
+
...extraSections.map((s) => ({ href: `#${s.id}`, label: s.navLabel, description: s.navDescription })),
|
|
1545
|
+
...ACCOUNT_TAIL_NAV_ITEMS
|
|
1546
|
+
]
|
|
1547
|
+
}
|
|
1548
|
+
) }),
|
|
1539
1549
|
/* @__PURE__ */ jsxs6("div", { className: "boring-settings-content space-y-4", children: [
|
|
1540
1550
|
/* @__PURE__ */ jsx13(
|
|
1541
1551
|
SettingsPageHeader,
|
|
@@ -1588,6 +1598,7 @@ function UserSettingsPage({ topBar } = {}) {
|
|
|
1588
1598
|
] })
|
|
1589
1599
|
}
|
|
1590
1600
|
),
|
|
1601
|
+
extraSections.map((section) => /* @__PURE__ */ jsx13("div", { children: section.content }, section.id)),
|
|
1591
1602
|
/* @__PURE__ */ jsx13("form", { onSubmit: handleSubmit(onChangePassword), noValidate: true, children: /* @__PURE__ */ jsx13(
|
|
1592
1603
|
UiSettingsPanel,
|
|
1593
1604
|
{
|
|
@@ -2227,7 +2238,7 @@ function OpenInNewTabIcon({ className }) {
|
|
|
2227
2238
|
] });
|
|
2228
2239
|
}
|
|
2229
2240
|
function WorkspaceSwitcher({
|
|
2230
|
-
appTitle = "
|
|
2241
|
+
appTitle = "Sovereign Workspace",
|
|
2231
2242
|
workspacePathPrefix = "/workspace"
|
|
2232
2243
|
}) {
|
|
2233
2244
|
const navigate = useNavigate3();
|
|
@@ -3027,10 +3038,10 @@ function SettingsTopBar2({ workspaceId, workspaceName }) {
|
|
|
3027
3038
|
title: "Back to workspace",
|
|
3028
3039
|
onClick: () => navigate(workspaceHref),
|
|
3029
3040
|
className: "shrink-0 bg-foreground text-[12px] font-semibold text-background hover:bg-foreground/90",
|
|
3030
|
-
children: "
|
|
3041
|
+
children: "S"
|
|
3031
3042
|
}
|
|
3032
3043
|
),
|
|
3033
|
-
/* @__PURE__ */ jsx21("span", { className: "truncate text-[13px] font-medium tracking-tight text-foreground", children: "
|
|
3044
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate text-[13px] font-medium tracking-tight text-foreground", children: "Sovereign Workspace" }),
|
|
3034
3045
|
/* @__PURE__ */ jsx21("span", { "aria-hidden": "true", className: "text-muted-foreground/30", children: "/" }),
|
|
3035
3046
|
/* @__PURE__ */ jsx21("span", { className: "truncate text-[13px] text-muted-foreground", children: workspaceName }),
|
|
3036
3047
|
/* @__PURE__ */ jsx21("span", { "aria-hidden": "true", className: "text-muted-foreground/30", children: "/" }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CoreConfig, W as Workspace, E as ERROR_CODES, M as MemberRole, a as WorkspaceMember, U as User, b as WorkspaceInvite, c as WorkspaceRuntime, d as WorkspaceRuntimeResourceSelector, e as WorkspaceRuntimeResource, f as WorkspaceRuntimeResourceInput, g as CapabilitiesResponse } from './types-
|
|
1
|
+
import { C as CoreConfig, W as Workspace, E as ERROR_CODES, M as MemberRole, a as WorkspaceMember, U as User, b as WorkspaceInvite, c as WorkspaceRuntime, d as WorkspaceRuntimeResourceSelector, e as WorkspaceRuntimeResource, f as WorkspaceRuntimeResourceInput, g as CapabilitiesResponse } from './types-CWtJ4kgd.js';
|
|
2
2
|
import { drizzle } from 'drizzle-orm/postgres-js';
|
|
3
3
|
import postgres from 'postgres';
|
|
4
4
|
|
package/dist/front/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
4
|
-
import { R as RuntimeConfig, g as CapabilitiesResponse, a as WorkspaceMember, U as User, W as Workspace, M as MemberRole, S as SessionState } from '../types-
|
|
4
|
+
import { R as RuntimeConfig, g as CapabilitiesResponse, a as WorkspaceMember, U as User, W as Workspace, M as MemberRole, S as SessionState } from '../types-CWtJ4kgd.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';
|
|
@@ -396,10 +396,23 @@ declare function ResetPasswordPage(): react_jsx_runtime.JSX.Element;
|
|
|
396
396
|
|
|
397
397
|
declare function VerifyEmailPage(): react_jsx_runtime.JSX.Element;
|
|
398
398
|
|
|
399
|
+
/** A host-provided settings section inserted after the profile panel, with its own
|
|
400
|
+
* nav entry. Lets a host add feature sections (e.g. billing) WITHOUT this page —
|
|
401
|
+
* which lives in the feature-agnostic `@hachej/boring-core/front` — knowing what
|
|
402
|
+
* they are. `id` must match the rendered content's anchor id for nav scroll. */
|
|
403
|
+
interface UserSettingsSection {
|
|
404
|
+
id: string;
|
|
405
|
+
navLabel: string;
|
|
406
|
+
navDescription?: string;
|
|
407
|
+
content: ReactNode;
|
|
408
|
+
}
|
|
399
409
|
interface UserSettingsPageProps {
|
|
400
410
|
topBar?: ReactNode;
|
|
411
|
+
/** Extra settings sections (each with its own nav entry) inserted after the
|
|
412
|
+
* profile panel. Omitted entirely when not provided. */
|
|
413
|
+
extraSections?: UserSettingsSection[];
|
|
401
414
|
}
|
|
402
|
-
declare function UserSettingsPage({ topBar }?: UserSettingsPageProps): react_jsx_runtime.JSX.Element;
|
|
415
|
+
declare function UserSettingsPage({ topBar, extraSections }?: UserSettingsPageProps): react_jsx_runtime.JSX.Element;
|
|
403
416
|
|
|
404
417
|
declare function InviteAcceptPage(): react_jsx_runtime.JSX.Element | null;
|
|
405
418
|
|
package/dist/front/index.js
CHANGED
|
@@ -58,12 +58,12 @@ import {
|
|
|
58
58
|
useWorkspaceMembers,
|
|
59
59
|
useWorkspaceRole,
|
|
60
60
|
useWorkspaceRouteStatus
|
|
61
|
-
} from "../chunk-
|
|
61
|
+
} from "../chunk-VYXEXOCO.js";
|
|
62
62
|
import {
|
|
63
63
|
TopBarSlotProvider,
|
|
64
64
|
useTopBarSlot
|
|
65
65
|
} from "../chunk-HYNKZSTF.js";
|
|
66
|
-
import "../chunk-
|
|
66
|
+
import "../chunk-LIBHVT7V.js";
|
|
67
67
|
import "../chunk-MLKGABMK.js";
|
|
68
68
|
export {
|
|
69
69
|
AppErrorBoundary,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { U as UserStore, W as WorkspaceStore } from '../../connection-
|
|
2
|
-
export { D as Database, c as createDatabase } from '../../connection-
|
|
3
|
-
export { R as RunMigrationsOptions, r as runMigrations } from '../../
|
|
4
|
-
import { U as User, W as Workspace, E as ERROR_CODES, M as MemberRole, a as WorkspaceMember, b as WorkspaceInvite, c as WorkspaceRuntime, d as WorkspaceRuntimeResourceSelector, e as WorkspaceRuntimeResource, f as WorkspaceRuntimeResourceInput } from '../../types-
|
|
1
|
+
import { U as UserStore, W as WorkspaceStore } from '../../connection-C5SiqoNc.js';
|
|
2
|
+
export { D as Database, c as createDatabase } from '../../connection-C5SiqoNc.js';
|
|
3
|
+
export { F as FinishReservationInput, G as GrantOnceInput, I as InsufficientCreditError, M as MeteringBalance, P as PostgresMeteringStore, R as RecordUsageInput, a as RecordUsageResult, b as ReservationFinalStatus, c as ReserveInput, d as ReserveResult, e as RunMigrationsOptions, r as runMigrations } from '../../PostgresMeteringStore-CzNv6xil.js';
|
|
4
|
+
import { U as User, W as Workspace, E as ERROR_CODES, M as MemberRole, a as WorkspaceMember, b as WorkspaceInvite, c as WorkspaceRuntime, d as WorkspaceRuntimeResourceSelector, e as WorkspaceRuntimeResource, f as WorkspaceRuntimeResourceInput } from '../../types-CWtJ4kgd.js';
|
|
5
5
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
6
6
|
import 'postgres';
|
|
7
7
|
|
package/dist/server/db/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
+
InsufficientCreditError,
|
|
2
3
|
LocalUserStore,
|
|
3
4
|
LocalWorkspaceStore,
|
|
5
|
+
PostgresMeteringStore,
|
|
4
6
|
PostgresUserStore,
|
|
5
7
|
PostgresWorkspaceStore,
|
|
6
8
|
createDatabase,
|
|
7
9
|
runMigrations
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
+
} from "../../chunk-I56OTSPB.js";
|
|
11
|
+
import "../../chunk-LIBHVT7V.js";
|
|
10
12
|
import "../../chunk-MLKGABMK.js";
|
|
11
13
|
export {
|
|
14
|
+
InsufficientCreditError,
|
|
12
15
|
LocalUserStore,
|
|
13
16
|
LocalWorkspaceStore,
|
|
17
|
+
PostgresMeteringStore,
|
|
14
18
|
PostgresUserStore,
|
|
15
19
|
PostgresWorkspaceStore,
|
|
16
20
|
createDatabase,
|