@brokr/sdk 1.0.0 → 2.0.0
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/account.js +34 -0
- package/dist/account.mjs +7 -0
- package/dist/auth.js +628 -114
- package/dist/auth.mjs +611 -111
- package/dist/chat.js +34 -0
- package/dist/chat.mjs +7 -0
- package/dist/events.js +64 -0
- package/dist/events.mjs +37 -0
- package/dist/feature.js +6304 -0
- package/dist/feature.mjs +6278 -0
- package/dist/files.js +428 -0
- package/dist/files.mjs +408 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4069 -454
- package/dist/index.mjs +4040 -448
- package/dist/logs.js +148 -0
- package/dist/logs.mjs +124 -0
- package/dist/management.js +14 -13
- package/dist/management.mjs +14 -13
- package/dist/next.js +2725 -0
- package/dist/next.mjs +2710 -0
- package/dist/notifications.js +140 -0
- package/dist/notifications.mjs +110 -0
- package/dist/payments.js +32 -0
- package/dist/payments.mjs +7 -0
- package/dist/react-notifications.js +286 -0
- package/dist/react-notifications.mjs +254 -0
- package/dist/react-styles.js +2718 -0
- package/dist/react-styles.mjs +2682 -0
- package/dist/react-theme.js +4194 -0
- package/dist/react-theme.mjs +4170 -0
- package/dist/react.js +8512 -209
- package/dist/react.mjs +8488 -179
- package/dist/runtime.js +2113 -385
- package/dist/runtime.mjs +2085 -397
- package/dist/src/account/config.d.ts +42 -0
- package/dist/src/account/config.d.ts.map +1 -0
- package/dist/src/account/index.d.ts +3 -0
- package/dist/src/account/index.d.ts.map +1 -0
- package/dist/src/ai/client.d.ts +58 -0
- package/dist/src/ai/client.d.ts.map +1 -0
- package/dist/src/ai/conversation-title.d.ts +13 -0
- package/dist/src/ai/conversation-title.d.ts.map +1 -0
- package/dist/src/ai/types.d.ts +81 -0
- package/dist/src/ai/types.d.ts.map +1 -0
- package/dist/src/auth.d.ts +133 -20
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/chat/config.d.ts +61 -0
- package/dist/src/chat/config.d.ts.map +1 -0
- package/dist/src/chat/index.d.ts +3 -0
- package/dist/src/chat/index.d.ts.map +1 -0
- package/dist/src/chat/sse-parser.d.ts +44 -0
- package/dist/src/chat/sse-parser.d.ts.map +1 -0
- package/dist/src/dev-console.d.ts +18 -0
- package/dist/src/dev-console.d.ts.map +1 -0
- package/dist/src/email/client.d.ts +33 -0
- package/dist/src/email/client.d.ts.map +1 -0
- package/dist/src/email/templates.d.ts +15 -0
- package/dist/src/email/templates.d.ts.map +1 -0
- package/dist/src/email/types.d.ts +35 -0
- package/dist/src/email/types.d.ts.map +1 -0
- package/dist/src/env-detect.d.ts +25 -0
- package/dist/src/env-detect.d.ts.map +1 -0
- package/dist/src/errors.d.ts +53 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/events/client.d.ts +25 -0
- package/dist/src/events/client.d.ts.map +1 -0
- package/dist/src/events/index.d.ts +9 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/events/types.d.ts +10 -0
- package/dist/src/events/types.d.ts.map +1 -0
- package/dist/src/feature/canonical.d.ts +33 -0
- package/dist/src/feature/canonical.d.ts.map +1 -0
- package/dist/src/feature/create-feature.d.ts +33 -0
- package/dist/src/feature/create-feature.d.ts.map +1 -0
- package/dist/src/feature/db.d.ts +16 -0
- package/dist/src/feature/db.d.ts.map +1 -0
- package/dist/src/feature/handlers.d.ts +28 -0
- package/dist/src/feature/handlers.d.ts.map +1 -0
- package/dist/src/feature/index.d.ts +21 -0
- package/dist/src/feature/index.d.ts.map +1 -0
- package/dist/src/feature/manifest.d.ts +173 -0
- package/dist/src/feature/manifest.d.ts.map +1 -0
- package/dist/src/feature/mapping.d.ts +18 -0
- package/dist/src/feature/mapping.d.ts.map +1 -0
- package/dist/src/feature/runtime.d.ts +45 -0
- package/dist/src/feature/runtime.d.ts.map +1 -0
- package/dist/src/feature/types.d.ts +65 -0
- package/dist/src/feature/types.d.ts.map +1 -0
- package/dist/src/files/client.d.ts +28 -0
- package/dist/src/files/client.d.ts.map +1 -0
- package/dist/src/files/types.d.ts +28 -0
- package/dist/src/files/types.d.ts.map +1 -0
- package/dist/src/fix-registry.d.ts +8 -0
- package/dist/src/fix-registry.d.ts.map +1 -0
- package/dist/src/gateway.d.ts +32 -0
- package/dist/src/gateway.d.ts.map +1 -0
- package/dist/src/logs/capture.d.ts +56 -0
- package/dist/src/logs/capture.d.ts.map +1 -0
- package/dist/src/logs/index.d.ts +2 -0
- package/dist/src/logs/index.d.ts.map +1 -0
- package/dist/src/management.d.ts +1 -1
- package/dist/src/management.d.ts.map +1 -1
- package/dist/src/models.d.ts +32 -0
- package/dist/src/models.d.ts.map +1 -0
- package/dist/src/next/auth.d.ts +54 -0
- package/dist/src/next/auth.d.ts.map +1 -0
- package/dist/src/next/chat.d.ts +31 -0
- package/dist/src/next/chat.d.ts.map +1 -0
- package/dist/src/next/index.d.ts +14 -0
- package/dist/src/next/index.d.ts.map +1 -0
- package/dist/src/next/notifications.d.ts +67 -0
- package/dist/src/next/notifications.d.ts.map +1 -0
- package/dist/src/notifications/built-ins.d.ts +9 -0
- package/dist/src/notifications/built-ins.d.ts.map +1 -0
- package/dist/src/notifications/client.d.ts +38 -0
- package/dist/src/notifications/client.d.ts.map +1 -0
- package/dist/src/notifications/config.d.ts +71 -0
- package/dist/src/notifications/config.d.ts.map +1 -0
- package/dist/src/notifications/index.d.ts +6 -0
- package/dist/src/notifications/index.d.ts.map +1 -0
- package/dist/src/notifications/registry.d.ts +67 -0
- package/dist/src/notifications/registry.d.ts.map +1 -0
- package/dist/src/notifications/types.d.ts +48 -0
- package/dist/src/notifications/types.d.ts.map +1 -0
- package/dist/src/payments/client.d.ts +64 -0
- package/dist/src/payments/client.d.ts.map +1 -0
- package/dist/src/payments/config.d.ts +46 -0
- package/dist/src/payments/config.d.ts.map +1 -0
- package/dist/src/payments/entitlements.d.ts +48 -0
- package/dist/src/payments/entitlements.d.ts.map +1 -0
- package/dist/src/payments/types.d.ts +135 -0
- package/dist/src/payments/types.d.ts.map +1 -0
- package/dist/src/react/BrokrErrorBoundary.d.ts +23 -0
- package/dist/src/react/BrokrErrorBoundary.d.ts.map +1 -0
- package/dist/src/react/account/AccountPanel.d.ts +12 -0
- package/dist/src/react/account/AccountPanel.d.ts.map +1 -0
- package/dist/src/react/account/Avatar.d.ts +11 -0
- package/dist/src/react/account/Avatar.d.ts.map +1 -0
- package/dist/src/react/account/ProfilePhotoButton.d.ts +7 -0
- package/dist/src/react/account/ProfilePhotoButton.d.ts.map +1 -0
- package/dist/src/react/account/UserButton.d.ts +7 -0
- package/dist/src/react/account/UserButton.d.ts.map +1 -0
- package/dist/src/react/auth-pages/AuthPageShell.d.ts +9 -0
- package/dist/src/react/auth-pages/AuthPageShell.d.ts.map +1 -0
- package/dist/src/react/auth-pages/SignInPage.d.ts +9 -0
- package/dist/src/react/auth-pages/SignInPage.d.ts.map +1 -0
- package/dist/src/react/auth-pages/SignUpPage.d.ts +8 -0
- package/dist/src/react/auth-pages/SignUpPage.d.ts.map +1 -0
- package/dist/src/react/auth.d.ts +1 -49
- package/dist/src/react/auth.d.ts.map +1 -1
- package/dist/src/react/chat/AIChat.d.ts +4 -0
- package/dist/src/react/chat/AIChat.d.ts.map +1 -0
- package/dist/src/react/chat/ChatContext.d.ts +76 -0
- package/dist/src/react/chat/ChatContext.d.ts.map +1 -0
- package/dist/src/react/chat/ChatInput.d.ts +3 -0
- package/dist/src/react/chat/ChatInput.d.ts.map +1 -0
- package/dist/src/react/chat/MarkdownRenderer.d.ts +5 -0
- package/dist/src/react/chat/MarkdownRenderer.d.ts.map +1 -0
- package/dist/src/react/chat/MessageBubble.d.ts +14 -0
- package/dist/src/react/chat/MessageBubble.d.ts.map +1 -0
- package/dist/src/react/chat/MessagePane.d.ts +10 -0
- package/dist/src/react/chat/MessagePane.d.ts.map +1 -0
- package/dist/src/react/chat/ModelSelector.d.ts +13 -0
- package/dist/src/react/chat/ModelSelector.d.ts.map +1 -0
- package/dist/src/react/chat/ThreadSidebar.d.ts +3 -0
- package/dist/src/react/chat/ThreadSidebar.d.ts.map +1 -0
- package/dist/src/react/chat/index.d.ts +5 -0
- package/dist/src/react/chat/index.d.ts.map +1 -0
- package/dist/src/react/chat/token-limit.d.ts +14 -0
- package/dist/src/react/chat/token-limit.d.ts.map +1 -0
- package/dist/src/react/chat/types.d.ts +65 -0
- package/dist/src/react/chat/types.d.ts.map +1 -0
- package/dist/src/react/chat/useChat.d.ts +57 -0
- package/dist/src/react/chat/useChat.d.ts.map +1 -0
- package/dist/src/react/composites/FabAI.d.ts +15 -0
- package/dist/src/react/composites/FabAI.d.ts.map +1 -0
- package/dist/src/react/composites/FeedbackWidget.d.ts +10 -0
- package/dist/src/react/composites/FeedbackWidget.d.ts.map +1 -0
- package/dist/src/react/composites/SmartUpload.d.ts +12 -0
- package/dist/src/react/composites/SmartUpload.d.ts.map +1 -0
- package/dist/src/react/config.d.ts +23 -0
- package/dist/src/react/config.d.ts.map +1 -0
- package/dist/src/react/context.d.ts +4 -0
- package/dist/src/react/context.d.ts.map +1 -0
- package/dist/src/react/css/account.d.ts +2 -0
- package/dist/src/react/css/account.d.ts.map +1 -0
- package/dist/src/react/css/animations.d.ts +2 -0
- package/dist/src/react/css/animations.d.ts.map +1 -0
- package/dist/src/react/css/auth.d.ts +2 -0
- package/dist/src/react/css/auth.d.ts.map +1 -0
- package/dist/src/react/css/chat-extras.d.ts +2 -0
- package/dist/src/react/css/chat-extras.d.ts.map +1 -0
- package/dist/src/react/css/chat.d.ts +2 -0
- package/dist/src/react/css/chat.d.ts.map +1 -0
- package/dist/src/react/css/composites.d.ts +2 -0
- package/dist/src/react/css/composites.d.ts.map +1 -0
- package/dist/src/react/css/gates.d.ts +2 -0
- package/dist/src/react/css/gates.d.ts.map +1 -0
- package/dist/src/react/css/index.d.ts +3 -0
- package/dist/src/react/css/index.d.ts.map +1 -0
- package/dist/src/react/css/markdown.d.ts +2 -0
- package/dist/src/react/css/markdown.d.ts.map +1 -0
- package/dist/src/react/css/notifications.d.ts +2 -0
- package/dist/src/react/css/notifications.d.ts.map +1 -0
- package/dist/src/react/css/primitives.d.ts +2 -0
- package/dist/src/react/css/primitives.d.ts.map +1 -0
- package/dist/src/react/css/reset.d.ts +2 -0
- package/dist/src/react/css/reset.d.ts.map +1 -0
- package/dist/src/react/css/responsive.d.ts +2 -0
- package/dist/src/react/css/responsive.d.ts.map +1 -0
- package/dist/src/react/css/skeleton.d.ts +2 -0
- package/dist/src/react/css/skeleton.d.ts.map +1 -0
- package/dist/src/react/css/tokens.d.ts +2 -0
- package/dist/src/react/css/tokens.d.ts.map +1 -0
- package/dist/src/react/gates/AuthWall.d.ts +7 -0
- package/dist/src/react/gates/AuthWall.d.ts.map +1 -0
- package/dist/src/react/gates/BillingBoundary.d.ts +4 -0
- package/dist/src/react/gates/BillingBoundary.d.ts.map +1 -0
- package/dist/src/react/gates/Gate.d.ts +9 -0
- package/dist/src/react/gates/Gate.d.ts.map +1 -0
- package/dist/src/react/gates/RequirePlan.d.ts +4 -0
- package/dist/src/react/gates/RequirePlan.d.ts.map +1 -0
- package/dist/src/react/gates/RequireUser.d.ts +4 -0
- package/dist/src/react/gates/RequireUser.d.ts.map +1 -0
- package/dist/src/react/gates/UsageGate.d.ts +4 -0
- package/dist/src/react/gates/UsageGate.d.ts.map +1 -0
- package/dist/src/react/helpers.d.ts +7 -0
- package/dist/src/react/helpers.d.ts.map +1 -0
- package/dist/src/react/hooks/use-theme.d.ts +15 -0
- package/dist/src/react/hooks/use-theme.d.ts.map +1 -0
- package/dist/src/react/hooks/use-user.d.ts +12 -0
- package/dist/src/react/hooks/use-user.d.ts.map +1 -0
- package/dist/src/react/icons.d.ts +26 -0
- package/dist/src/react/icons.d.ts.map +1 -0
- package/dist/src/react/index.d.ts +48 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/notifications/NotificationBell.d.ts +7 -0
- package/dist/src/react/notifications/NotificationBell.d.ts.map +1 -0
- package/dist/src/react/notifications/NotificationList.d.ts +7 -0
- package/dist/src/react/notifications/NotificationList.d.ts.map +1 -0
- package/dist/src/react/notifications/Toast.d.ts +13 -0
- package/dist/src/react/notifications/Toast.d.ts.map +1 -0
- package/dist/src/react/notifications/index.d.ts +8 -0
- package/dist/src/react/notifications/index.d.ts.map +1 -0
- package/dist/src/react/notifications/provider.d.ts +14 -0
- package/dist/src/react/notifications/provider.d.ts.map +1 -0
- package/dist/src/react/notifications/use-notifications.d.ts +24 -0
- package/dist/src/react/notifications/use-notifications.d.ts.map +1 -0
- package/dist/src/react/payments/AutoReloadToggle.d.ts +6 -0
- package/dist/src/react/payments/AutoReloadToggle.d.ts.map +1 -0
- package/dist/src/react/payments/Balance.d.ts +8 -0
- package/dist/src/react/payments/Balance.d.ts.map +1 -0
- package/dist/src/react/payments/CancelSubscription.d.ts +6 -0
- package/dist/src/react/payments/CancelSubscription.d.ts.map +1 -0
- package/dist/src/react/payments/CheckoutButton.d.ts +7 -0
- package/dist/src/react/payments/CheckoutButton.d.ts.map +1 -0
- package/dist/src/react/payments/CustomerPortalButton.d.ts +6 -0
- package/dist/src/react/payments/CustomerPortalButton.d.ts.map +1 -0
- package/dist/src/react/payments/FeatureMeter.d.ts +6 -0
- package/dist/src/react/payments/FeatureMeter.d.ts.map +1 -0
- package/dist/src/react/payments/Plans.d.ts +8 -0
- package/dist/src/react/payments/Plans.d.ts.map +1 -0
- package/dist/src/react/payments/TopUpButton.d.ts +8 -0
- package/dist/src/react/payments/TopUpButton.d.ts.map +1 -0
- package/dist/src/react/payments/UpdateBilling.d.ts +3 -0
- package/dist/src/react/payments/UpdateBilling.d.ts.map +1 -0
- package/dist/src/react/payments/UpgradePrompt.d.ts +8 -0
- package/dist/src/react/payments/UpgradePrompt.d.ts.map +1 -0
- package/dist/src/react/primitives/Skeleton.d.ts +15 -0
- package/dist/src/react/primitives/Skeleton.d.ts.map +1 -0
- package/dist/src/react/provider.d.ts +21 -0
- package/dist/src/react/provider.d.ts.map +1 -0
- package/dist/src/react/request.d.ts +2 -0
- package/dist/src/react/request.d.ts.map +1 -0
- package/dist/src/react/styles-entry.d.ts +4 -0
- package/dist/src/react/styles-entry.d.ts.map +1 -0
- package/dist/src/react/styles.d.ts +2 -0
- package/dist/src/react/styles.d.ts.map +1 -0
- package/dist/src/react/theme-entry.d.ts +3 -0
- package/dist/src/react/theme-entry.d.ts.map +1 -0
- package/dist/src/react/theme.d.ts +6 -0
- package/dist/src/react/theme.d.ts.map +1 -0
- package/dist/src/react/types.d.ts +191 -0
- package/dist/src/react/types.d.ts.map +1 -0
- package/dist/src/react/use-brokr-theme.d.ts +6 -0
- package/dist/src/react/use-brokr-theme.d.ts.map +1 -0
- package/dist/src/runtime.d.ts +69 -180
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/storage/client.d.ts +113 -0
- package/dist/src/storage/client.d.ts.map +1 -0
- package/dist/src/storage/types.d.ts +60 -0
- package/dist/src/storage/types.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +70 -9
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creator SDK — Shared Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions used across the feature system:
|
|
5
|
+
* CanonicalUser, EmitResult, FeatureEvent, FeatureRuntime interface.
|
|
6
|
+
*/
|
|
7
|
+
/** Resolved user from the vibe coder's database. Optional fields return null. */
|
|
8
|
+
export interface CanonicalUser {
|
|
9
|
+
id: string;
|
|
10
|
+
email: string | null;
|
|
11
|
+
name: string | null;
|
|
12
|
+
avatar: string | null;
|
|
13
|
+
}
|
|
14
|
+
/** Mapping configuration for resolving canonical users from the vibe coder's DB. */
|
|
15
|
+
export interface UserMapping {
|
|
16
|
+
table: string;
|
|
17
|
+
id: string;
|
|
18
|
+
email: string;
|
|
19
|
+
name: string;
|
|
20
|
+
avatar: string;
|
|
21
|
+
}
|
|
22
|
+
export interface EmitResult {
|
|
23
|
+
/** UUID — forces idempotency discipline from day 1. */
|
|
24
|
+
deliveryId: string;
|
|
25
|
+
/** 'sync' in v1 (local dispatch), 'queued' in v2 (CF Queue). */
|
|
26
|
+
mode: 'sync' | 'queued';
|
|
27
|
+
}
|
|
28
|
+
export interface FeatureEvent<T = unknown> {
|
|
29
|
+
/** Fully qualified event name: '{slug}.{event}' */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Event payload from the emitter. */
|
|
32
|
+
payload: T;
|
|
33
|
+
/** UUID for idempotent processing. */
|
|
34
|
+
deliveryId: string;
|
|
35
|
+
/** ISO timestamp. */
|
|
36
|
+
emittedAt: string;
|
|
37
|
+
}
|
|
38
|
+
export interface NotifyParams {
|
|
39
|
+
title: string;
|
|
40
|
+
message: string;
|
|
41
|
+
variant?: 'default' | 'success' | 'error' | 'warning';
|
|
42
|
+
href?: string;
|
|
43
|
+
data?: Record<string, unknown>;
|
|
44
|
+
dedup?: string;
|
|
45
|
+
}
|
|
46
|
+
/** A single feature HTTP handler function. */
|
|
47
|
+
export type HandlerFn = (request: Request) => Promise<Response | Record<string, unknown>>;
|
|
48
|
+
/** Result of brokr.handlers() — exportable as Next.js route handlers. */
|
|
49
|
+
export interface FeatureHandlers {
|
|
50
|
+
GET: (req: Request) => Promise<Response>;
|
|
51
|
+
POST: (req: Request) => Promise<Response>;
|
|
52
|
+
}
|
|
53
|
+
/** Tagged template function for SQL queries. */
|
|
54
|
+
export type TaggedTemplateFn = <T = Record<string, unknown>>(strings: TemplateStringsArray, ...values: unknown[]) => Promise<T[]>;
|
|
55
|
+
/** Scoped database client for a feature. */
|
|
56
|
+
export interface FeatureDb {
|
|
57
|
+
/** Tagged template SQL — queries execute against the feature's schema. */
|
|
58
|
+
sql: TaggedTemplateFn;
|
|
59
|
+
/** Raw query with positional params — executes against the feature's schema. */
|
|
60
|
+
query: <T = Record<string, unknown>>(sql: string, params?: unknown[]) => Promise<T[]>;
|
|
61
|
+
}
|
|
62
|
+
export interface FeatureContext {
|
|
63
|
+
readonly user: CanonicalUser | null;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/feature/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,OAAO,EAAE,CAAC,CAAC;IACX,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE1F,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3C;AAMD,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,OAAO,EAAE,KACjB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AAElB,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACxB,0EAA0E;IAC1E,GAAG,EAAE,gBAAgB,CAAC;IACtB,gFAAgF;IAChF,KAAK,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACvF;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Files Client
|
|
3
|
+
*
|
|
4
|
+
* Upload + AI processing: describe files, extract text from PDFs/images.
|
|
5
|
+
* Depends on Storage (for upload) and AI (for processing) namespaces.
|
|
6
|
+
*/
|
|
7
|
+
import type { BrokrStorageClient } from '../storage/client';
|
|
8
|
+
import type { ProcessParams, ProcessResult, FileDescription, ExtractedText } from './types';
|
|
9
|
+
export declare class BrokrFilesClient {
|
|
10
|
+
private readonly _token;
|
|
11
|
+
private readonly _gatewayUrl;
|
|
12
|
+
private readonly _storage;
|
|
13
|
+
constructor(_token: string | undefined, _gatewayUrl: string, _storage: BrokrStorageClient);
|
|
14
|
+
/**
|
|
15
|
+
* Upload a file and trigger server-side AI processing.
|
|
16
|
+
* Returns the storage key plus any extracted description/text.
|
|
17
|
+
*/
|
|
18
|
+
process(params: ProcessParams): Promise<ProcessResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Get an AI-generated description of an already-uploaded file.
|
|
21
|
+
*/
|
|
22
|
+
describe(key: string): Promise<FileDescription>;
|
|
23
|
+
/**
|
|
24
|
+
* Extract text from a PDF or image (OCR).
|
|
25
|
+
*/
|
|
26
|
+
getText(key: string): Promise<ExtractedText>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/files/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,kBAAkB;IAG/C;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB5D;;OAEG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQrD;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAOnD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Files types
|
|
3
|
+
*/
|
|
4
|
+
export interface ProcessParams {
|
|
5
|
+
/** File data to upload and process. */
|
|
6
|
+
file: Blob | Uint8Array | string;
|
|
7
|
+
/** Filename hint for content-type detection. */
|
|
8
|
+
fileName?: string;
|
|
9
|
+
/** Processing purpose hint. */
|
|
10
|
+
purpose?: 'description' | 'text-extraction' | 'general';
|
|
11
|
+
}
|
|
12
|
+
export interface ProcessResult {
|
|
13
|
+
/** The storage key of the uploaded file. */
|
|
14
|
+
key: string;
|
|
15
|
+
/** AI-generated description (if applicable). */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Extracted text content (if applicable). */
|
|
18
|
+
text?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface FileDescription {
|
|
21
|
+
/** AI-generated description of the file. */
|
|
22
|
+
description: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ExtractedText {
|
|
25
|
+
/** Extracted text content from the file. */
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/files/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,IAAI,EAAE,IAAI,GAAG,UAAU,GAAG,MAAM,CAAC;IACjC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,aAAa,GAAG,iBAAiB,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix Registry — maps error codes to multi-line terminal fix blocks.
|
|
3
|
+
*
|
|
4
|
+
* Used by BrokrError.fix getter and BrokrDevConsole to show actionable fixes.
|
|
5
|
+
* Each entry is a multi-line string with `→` prefixed commands/steps.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FIX_REGISTRY: Record<string, string>;
|
|
8
|
+
//# sourceMappingURL=fix-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-registry.d.ts","sourceRoot":"","sources":["../../src/fix-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyI/C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Gateway fetch utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared HTTP helper for calling the Brokr gateway with consistent
|
|
5
|
+
* error handling, auth, and response parsing.
|
|
6
|
+
*
|
|
7
|
+
* Security: network errors strip raw messages (may contain internal IPs).
|
|
8
|
+
* All responses extract structured errorCode/hint/requestId from server.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GATEWAY_URL = "https://api.brokr.sh";
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the BROKR_TOKEN from the environment.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveToken(): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Assert that a BROKR_TOKEN is present. Throws BrokrAuthError with a
|
|
17
|
+
* helpful hint if missing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function requireToken(token: string | undefined, capability: string): asserts token is string;
|
|
20
|
+
/**
|
|
21
|
+
* Make an authenticated POST request to the Brokr gateway.
|
|
22
|
+
* Handles all standard error responses (401, 429, network errors).
|
|
23
|
+
* Includes 30s timeout and structured error extraction.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gatewayFetch<T>(gatewayUrl: string, token: string, path: string, body: unknown, capability: string): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Make an authenticated request that returns the raw Response (for streaming).
|
|
28
|
+
* Throws on auth/rate-limit/network errors but does NOT consume the body.
|
|
29
|
+
* Includes 30s timeout.
|
|
30
|
+
*/
|
|
31
|
+
export declare function gatewayStream(gatewayUrl: string, token: string, path: string, body: unknown, capability: string): Promise<Response>;
|
|
32
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAIlD;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAsBnG;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CA8EZ;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,QAAQ,CAAC,CA+CnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Log Capture
|
|
3
|
+
*
|
|
4
|
+
* Lightweight batching module for capturing console.error/console.warn
|
|
5
|
+
* and sending them to the Brokr API for localhost + production log visibility.
|
|
6
|
+
*
|
|
7
|
+
* Used by template instrumentation.ts files. Zero dependencies beyond fetch.
|
|
8
|
+
*
|
|
9
|
+
* Batches entries and flushes every 5s or when 20 entries accumulate.
|
|
10
|
+
* Uses the directIngest endpoint which accepts BROKR_TOKEN auth.
|
|
11
|
+
*/
|
|
12
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
13
|
+
interface CaptureConfig {
|
|
14
|
+
/** BROKR_TOKEN for auth */
|
|
15
|
+
token: string;
|
|
16
|
+
/** Stack ID to send logs for */
|
|
17
|
+
stackId: string;
|
|
18
|
+
/** Gateway URL for log delivery */
|
|
19
|
+
apiUrl: string;
|
|
20
|
+
/** Max entries before auto-flush (default: 20) */
|
|
21
|
+
batchSize?: number;
|
|
22
|
+
/** Flush interval in ms (default: 5000) */
|
|
23
|
+
flushIntervalMs?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the log capture system. Call once at app startup.
|
|
27
|
+
* No-ops if token or stackId is missing (graceful degradation).
|
|
28
|
+
*/
|
|
29
|
+
export declare function initCapture(opts?: Partial<CaptureConfig> & {
|
|
30
|
+
gatewayUrl?: string;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Capture a log entry. Automatically batches and flushes.
|
|
34
|
+
*/
|
|
35
|
+
export declare function capture(level: LogLevel, message: string, source?: string, stackTrace?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Capture from Next.js onRequestError instrumentation hook.
|
|
38
|
+
*/
|
|
39
|
+
export declare function captureRequestError(err: {
|
|
40
|
+
digest?: string;
|
|
41
|
+
message: string;
|
|
42
|
+
stack?: string;
|
|
43
|
+
}, request: {
|
|
44
|
+
path?: string;
|
|
45
|
+
method?: string;
|
|
46
|
+
}): void;
|
|
47
|
+
/**
|
|
48
|
+
* Capture a request (any level). Use for logging every API hit, page load, etc.
|
|
49
|
+
*/
|
|
50
|
+
export declare function captureRequest(method: string, path: string, statusCode: number, durationMs?: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Flush the buffer to the Brokr API. Fire-and-forget.
|
|
53
|
+
*/
|
|
54
|
+
export declare function flush(): void;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/logs/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAUpD,UAAU,aAAa;IACrB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAUD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,OAAO,CAAC,aAAa,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,IAAI,CAkE7F;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAcpG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACzD,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CAGN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAmB5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/src/management.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"management.d.ts","sourceRoot":"","sources":["../../src/management.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"management.d.ts","sourceRoot":"","sources":["../../src/management.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AA+BlB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,EAAE,WAAW;IAI/B,iDAAiD;IAC3C,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAI7D,4CAA4C;IACtC,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAI5C,kCAAkC;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIlD,sBAAsB;IAChB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvF,sBAAsB;IAChB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAI5D,iCAAiC;IAC3B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhF,gCAAgC;IAC1B,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhG,+BAA+B;IAC/B,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAG1C;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED,eAAO,MAAM,MAAM,0BAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Model aliases
|
|
3
|
+
*
|
|
4
|
+
* Convenience aliases for common model tiers.
|
|
5
|
+
* These are resolved by the gateway to actual provider model IDs.
|
|
6
|
+
*/
|
|
7
|
+
/** Convenience model aliases for common use cases. */
|
|
8
|
+
export declare const models: {
|
|
9
|
+
/** Cheapest and fastest model (Deepseek Chat). */
|
|
10
|
+
readonly FAST: "deepseek-chat";
|
|
11
|
+
/** Most capable model. */
|
|
12
|
+
readonly SMART: "claude-sonnet-4-6";
|
|
13
|
+
/** Default balanced model (Deepseek Chat). */
|
|
14
|
+
readonly BALANCED: "deepseek-chat";
|
|
15
|
+
};
|
|
16
|
+
export interface BrokrProviderEntry {
|
|
17
|
+
id: string;
|
|
18
|
+
/** Display label (e.g. "ChatGPT", "Claude"). */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Default gateway model string for this provider. */
|
|
21
|
+
model: string;
|
|
22
|
+
/** Hex color for the indicator dot in the UI. */
|
|
23
|
+
color: string;
|
|
24
|
+
/** Whether this provider is available on the free tier (no balance required). */
|
|
25
|
+
free: boolean;
|
|
26
|
+
/** Logo URL for assistant message avatars. */
|
|
27
|
+
logo: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const providers: BrokrProviderEntry[];
|
|
30
|
+
/** Resolve a model string to its provider entry. */
|
|
31
|
+
export declare function resolveProviderByModel(model: string): BrokrProviderEntry | undefined;
|
|
32
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sDAAsD;AACtD,eAAO,MAAM,MAAM;IACjB,kDAAkD;;IAElD,0BAA0B;;IAE1B,8CAA8C;;CAEtC,CAAC;AAMX,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,IAAI,EAAE,OAAO,CAAC;IACd,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,SAAS,EAAE,kBAAkB,EAMzC,CAAC;AAEF,oDAAoD;AACpD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAGpF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr Auth — Next.js-specific helpers
|
|
3
|
+
*
|
|
4
|
+
* These call Next.js APIs (cookies, headers, redirect) internally,
|
|
5
|
+
* so they can ONLY be used in Next.js App Router server contexts
|
|
6
|
+
* (Route Handlers, Server Components, Server Actions).
|
|
7
|
+
*
|
|
8
|
+
* Import from '@brokr/sdk/next', NOT '@brokr/sdk/auth'.
|
|
9
|
+
*/
|
|
10
|
+
import type { AuthUser } from '../auth';
|
|
11
|
+
/**
|
|
12
|
+
* Protect an API Route Handler. Returns the authenticated user or throws 401.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // app/api/my-endpoint/route.ts
|
|
17
|
+
* import { protectApi } from '@brokr/sdk/next';
|
|
18
|
+
*
|
|
19
|
+
* export async function POST(request: Request) {
|
|
20
|
+
* const user = await protectApi();
|
|
21
|
+
* // user is guaranteed to exist
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function protectApi(): Promise<AuthUser>;
|
|
26
|
+
/**
|
|
27
|
+
* Protect a Server Component page. Returns the user or redirects to sign-in.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // app/dashboard/page.tsx
|
|
32
|
+
* import { protectPage } from '@brokr/sdk/next';
|
|
33
|
+
*
|
|
34
|
+
* export default async function DashboardPage() {
|
|
35
|
+
* const user = await protectPage();
|
|
36
|
+
* return <h1>Hello, {user.name}</h1>;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function protectPage(redirectTo?: string): Promise<AuthUser>;
|
|
41
|
+
/**
|
|
42
|
+
* Higher-order function: resolves user from Next.js context, passes to handler.
|
|
43
|
+
* Throws 401 if not authenticated.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* export const POST = withUser(async (user, request) => {
|
|
48
|
+
* // user is guaranteed to exist
|
|
49
|
+
* return Response.json({ id: user.id });
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function withUser<T>(fn: (request: Request, user: AuthUser) => Promise<T>): (request: Request) => Promise<T>;
|
|
54
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/next/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,SAAS,CAAC;AAqFrD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,CAMpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,UAAU,SAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAS5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GACnD,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAKlC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr — Next.js Route Handler Factory
|
|
3
|
+
*
|
|
4
|
+
* Creates GET/POST/DELETE handlers for the AIChat component.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* // app/api/brokr/[...rest]/route.ts
|
|
8
|
+
* import { createBrokrHandlers } from '@brokr/sdk/next'
|
|
9
|
+
* export const { GET, POST, DELETE } = createBrokrHandlers({ persist: true })
|
|
10
|
+
*
|
|
11
|
+
* Routes dispatched:
|
|
12
|
+
* GET /api/brokr/threads → list threads
|
|
13
|
+
* GET /api/brokr/threads/:id/messages → get thread messages
|
|
14
|
+
* POST /api/brokr/chat → send message (+ persist if enabled)
|
|
15
|
+
* DELETE /api/brokr/threads/:id → delete thread
|
|
16
|
+
*/
|
|
17
|
+
export interface BrokrHandlersOptions {
|
|
18
|
+
/** Enable DB-backed thread persistence via DATABASE_URL. Default: false. */
|
|
19
|
+
persist?: boolean;
|
|
20
|
+
/** Global system prompt injected into every chat request. */
|
|
21
|
+
systemPrompt?: string;
|
|
22
|
+
/** Notification config — enables AI completion notifications with type registry. */
|
|
23
|
+
notifications?: import('../notifications/config').NotificationsConfig;
|
|
24
|
+
}
|
|
25
|
+
export declare function createBrokrHandlers(options?: BrokrHandlersOptions): {
|
|
26
|
+
GET: (req: Request) => Promise<Response>;
|
|
27
|
+
POST: (req: Request) => Promise<Response>;
|
|
28
|
+
PATCH: (req: Request) => Promise<Response>;
|
|
29
|
+
DELETE: (req: Request) => Promise<Response>;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/next/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmDH,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,yBAAyB,EAAE,mBAAmB,CAAC;CACvE;AA0oBD,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG;IACnE,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7C,CAmDA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Next.js entry point
|
|
3
|
+
*
|
|
4
|
+
* Import from '@brokr/sdk/next', NOT individual sub-files.
|
|
5
|
+
*
|
|
6
|
+
* import { protectApi, protectPage, withUser } from '@brokr/sdk/next'
|
|
7
|
+
* import { createBrokrHandlers } from '@brokr/sdk/next'
|
|
8
|
+
*/
|
|
9
|
+
export { protectApi, protectPage, withUser } from './auth';
|
|
10
|
+
export { createBrokrHandlers } from './chat';
|
|
11
|
+
export type { BrokrHandlersOptions } from './chat';
|
|
12
|
+
export { ensureNotificationTable, persistNotification, listPersistedNotifications, markNotificationRead, } from './notifications';
|
|
13
|
+
export type { NotificationDbOptions } from './notifications';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr — Notification Persistence (Consumer DB)
|
|
3
|
+
*
|
|
4
|
+
* Creates and manages a notifications table in the consumer's Neon Postgres
|
|
5
|
+
* database. Gives consumers full ownership of their notification data.
|
|
6
|
+
*
|
|
7
|
+
* The Cloudflare DO handles real-time relay + short-term buffer.
|
|
8
|
+
* This module handles long-term persistence in the consumer's own DB.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Ensure the brokr_notifications table exists. Idempotent.
|
|
12
|
+
*
|
|
13
|
+
* Custom table names are supported via config but require the table to
|
|
14
|
+
* already exist with the same schema. The default table is auto-created.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensureNotificationTable(tableName?: string): Promise<void>;
|
|
17
|
+
export interface NotificationDbOptions {
|
|
18
|
+
/** Custom table name. Default: 'brokr_notifications'. */
|
|
19
|
+
tableName?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Persist a notification to the consumer's database.
|
|
23
|
+
* Called from handleChat's background task after AI completion.
|
|
24
|
+
*/
|
|
25
|
+
export declare function persistNotification(params: {
|
|
26
|
+
id: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
type?: string;
|
|
29
|
+
title: string;
|
|
30
|
+
message: string;
|
|
31
|
+
variant: string;
|
|
32
|
+
href?: string;
|
|
33
|
+
/** Visual identity — provider logo, user avatar, icon URL, etc. */
|
|
34
|
+
imageUrl?: string;
|
|
35
|
+
/** Alt text for the image (accessibility). */
|
|
36
|
+
imageAlt?: string;
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
expiresAt?: Date;
|
|
39
|
+
}, opts?: NotificationDbOptions): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* List notifications for a user.
|
|
42
|
+
*/
|
|
43
|
+
export declare function listPersistedNotifications(userId: string, params?: {
|
|
44
|
+
limit?: number;
|
|
45
|
+
unreadOnly?: boolean;
|
|
46
|
+
type?: string;
|
|
47
|
+
}, opts?: NotificationDbOptions): Promise<Array<{
|
|
48
|
+
id: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
type: string;
|
|
51
|
+
title: string;
|
|
52
|
+
message: string;
|
|
53
|
+
variant: string;
|
|
54
|
+
href: string | null;
|
|
55
|
+
imageUrl: string | null;
|
|
56
|
+
imageAlt: string | null;
|
|
57
|
+
read: boolean;
|
|
58
|
+
readAt: string | null;
|
|
59
|
+
data: Record<string, unknown> | null;
|
|
60
|
+
expiresAt: string | null;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
}>>;
|
|
63
|
+
/**
|
|
64
|
+
* Mark a notification as read in the consumer's DB.
|
|
65
|
+
*/
|
|
66
|
+
export declare function markNotificationRead(notificationId: string, userId: string, opts?: NotificationDbOptions): Promise<void>;
|
|
67
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/next/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgDH;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,SAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDtF;AAMD,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE;IACN,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,EACD,IAAI,CAAC,EAAE,qBAAqB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAChE,IAAI,CAAC,EAAE,qBAAqB,GAC3B,OAAO,CAAC,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC,CAqCF;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,qBAAqB,GAC3B,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr Notifications — Built-in Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* These ship with the SDK and work out of the box. Consumers never need
|
|
5
|
+
* to configure these unless they want to override behavior.
|
|
6
|
+
*/
|
|
7
|
+
import type { NotificationTypeRegistry } from './registry';
|
|
8
|
+
export declare const BROKR_BUILT_IN_TYPES: NotificationTypeRegistry;
|
|
9
|
+
//# sourceMappingURL=built-ins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-ins.d.ts","sourceRoot":"","sources":["../../../src/notifications/built-ins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,eAAO,MAAM,oBAAoB,EAAE,wBAqDlC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr Notifications — Runtime Client
|
|
3
|
+
*
|
|
4
|
+
* Server-side client for sending notifications and querying history.
|
|
5
|
+
* Lazy-initialized on BrokrRuntime as `brokr.notifications`.
|
|
6
|
+
*/
|
|
7
|
+
import type { Notification } from './types';
|
|
8
|
+
export interface SendParams {
|
|
9
|
+
userId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
message: string;
|
|
12
|
+
variant?: 'default' | 'success' | 'error' | 'warning';
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
dedup?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ListParams {
|
|
17
|
+
userId: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
unreadOnly?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class BrokrNotificationsClient {
|
|
22
|
+
private readonly token;
|
|
23
|
+
private readonly gatewayUrl;
|
|
24
|
+
constructor(token: string | undefined, gatewayUrl: string);
|
|
25
|
+
/**
|
|
26
|
+
* Send a notification to a user. Delivered via WebSocket in real-time
|
|
27
|
+
* and persisted in the notification history.
|
|
28
|
+
*/
|
|
29
|
+
send(params: SendParams): Promise<{
|
|
30
|
+
id: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch notification history for a user. Reads from the DO's SQLite
|
|
34
|
+
* storage via a gateway REST endpoint.
|
|
35
|
+
*/
|
|
36
|
+
list(params: ListParams): Promise<Notification[]>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/notifications/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,UAAU,EAAE,MAAM;IAGrC;;;OAGG;IACG,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAgBvD;;;OAGG;IACG,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAexD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr Notifications — Configuration
|
|
3
|
+
*
|
|
4
|
+
* Type-checked factory for notification settings.
|
|
5
|
+
* Used by BrokrProvider to configure toast appearance, history retention,
|
|
6
|
+
* and the notification type registry.
|
|
7
|
+
*/
|
|
8
|
+
import type { NotificationTypeRegistry } from './registry';
|
|
9
|
+
export interface NotificationsConfig {
|
|
10
|
+
/** Toast appearance settings. */
|
|
11
|
+
toast?: {
|
|
12
|
+
/** Screen position for toast stack. Default: 'top-right'. */
|
|
13
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
14
|
+
/** Auto-dismiss duration in ms. Default: 4000. Set 0 for persistent. */
|
|
15
|
+
duration?: number;
|
|
16
|
+
/** Max visible toasts at once. Default: 3. */
|
|
17
|
+
maxVisible?: number;
|
|
18
|
+
};
|
|
19
|
+
/** How long the DO keeps notification history. Default: '30d'. */
|
|
20
|
+
persistence?: '7d' | '30d' | '90d';
|
|
21
|
+
/** Custom table name for DB persistence. Default: 'brokr_notifications'. */
|
|
22
|
+
tableName?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Notification type registry. Define custom types here — each with its own
|
|
25
|
+
* image resolver, href pattern, and default variant. Built-in types
|
|
26
|
+
* (ai_response, system, billing) are always available and merge underneath.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* types: {
|
|
31
|
+
* dm: {
|
|
32
|
+
* label: 'Direct Message',
|
|
33
|
+
* defaultVariant: 'default',
|
|
34
|
+
* imageResolver: (data) => ({
|
|
35
|
+
* url: data.senderAvatar as string,
|
|
36
|
+
* alt: data.senderName as string,
|
|
37
|
+
* }),
|
|
38
|
+
* hrefResolver: (data) => `/messages/${encodeURIComponent(data.conversationId as string)}`,
|
|
39
|
+
* },
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
types?: NotificationTypeRegistry;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Define notification settings for your app.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // brokr/notifications.ts
|
|
51
|
+
* import { defineNotifications } from '@brokr/sdk/notifications';
|
|
52
|
+
* export default defineNotifications({
|
|
53
|
+
* toast: { position: 'top-right' },
|
|
54
|
+
* types: {
|
|
55
|
+
* dm: {
|
|
56
|
+
* imageResolver: (data) => ({ url: data.avatar as string, alt: 'User' }),
|
|
57
|
+
* hrefResolver: (data) => `/messages/${encodeURIComponent(data.threadId as string)}`,
|
|
58
|
+
* },
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function defineNotifications(config: NotificationsConfig): NotificationsConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve the merged registry: built-ins + consumer overrides.
|
|
66
|
+
* Built-in entries are the base; consumer entries merge over them.
|
|
67
|
+
* Consumer can override individual fields of a built-in type without
|
|
68
|
+
* losing the rest (e.g. override just `hrefResolver` for `ai_response`).
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveRegistry(config?: NotificationsConfig): NotificationTypeRegistry;
|
|
71
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/notifications/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,KAAK,CAAC,EAAE;QACN,6DAA6D;QAC7D,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,GAAG,YAAY,GAAG,eAAe,CAAC;QACtG,wEAAwE;QACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,8CAA8C;QAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,kEAAkE;IAClE,WAAW,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;IACnC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,EAAE,wBAAwB,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAEpF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,wBAAwB,CAOtF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineNotifications, resolveRegistry } from './config';
|
|
2
|
+
export type { NotificationsConfig } from './config';
|
|
3
|
+
export type { NotificationTypeEntry, NotificationTypeRegistry, NotificationImage } from './registry';
|
|
4
|
+
export { resolveNotificationType } from './registry';
|
|
5
|
+
export { BROKR_BUILT_IN_TYPES } from './built-ins';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|