@raybase/core 0.0.2 → 0.3.4
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/LICENSE +21 -0
- package/dist/.admin-build/AdminApp.css +2 -0
- package/dist/.admin-build/AdminApp.js +77 -0
- package/dist/.admin-docs-build/AdminDocsApp.css +2 -0
- package/dist/.admin-docs-build/AdminDocsApp.js +45 -0
- package/dist/actions.d.ts +347 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +661 -0
- package/dist/actions.js.map +1 -0
- package/dist/admin-assets/admin.7738f50720a8ed7b.css +2 -0
- package/dist/admin-assets/admin.8678cb61db34dc81.js +77 -0
- package/dist/admin-boot.d.ts +94 -0
- package/dist/admin-boot.d.ts.map +1 -0
- package/dist/admin-boot.js +139 -0
- package/dist/admin-boot.js.map +1 -0
- package/dist/admin-docs-content.d.ts +95 -0
- package/dist/admin-docs-content.d.ts.map +1 -0
- package/dist/admin-docs-content.js +463 -0
- package/dist/admin-docs-content.js.map +1 -0
- package/dist/admin-docs-ui.d.ts +11 -0
- package/dist/admin-docs-ui.d.ts.map +1 -0
- package/dist/admin-docs-ui.js +23 -0
- package/dist/admin-docs-ui.js.map +1 -0
- package/dist/admin-kit.d.ts +29 -0
- package/dist/admin-kit.js +1557 -0
- package/dist/admin-role.d.ts +8 -0
- package/dist/admin-role.d.ts.map +1 -0
- package/dist/admin-role.js +22 -0
- package/dist/admin-role.js.map +1 -0
- package/dist/admin-ui.d.ts +3 -0
- package/dist/admin-ui.d.ts.map +1 -0
- package/dist/admin-ui.js +16 -0
- package/dist/admin-ui.js.map +1 -0
- package/dist/agent-ai-chat.d.ts +127 -0
- package/dist/agent-ai-chat.d.ts.map +1 -0
- package/dist/agent-ai-chat.js +5975 -0
- package/dist/agent-ai-chat.js.map +1 -0
- package/dist/agent-chapter-archive.d.ts +214 -0
- package/dist/agent-chapter-archive.d.ts.map +1 -0
- package/dist/agent-chapter-archive.js +696 -0
- package/dist/agent-chapter-archive.js.map +1 -0
- package/dist/agent-chapter-search.d.ts +116 -0
- package/dist/agent-chapter-search.d.ts.map +1 -0
- package/dist/agent-chapter-search.js +605 -0
- package/dist/agent-chapter-search.js.map +1 -0
- package/dist/agent-chapter-tools.d.ts +45 -0
- package/dist/agent-chapter-tools.d.ts.map +1 -0
- package/dist/agent-chapter-tools.js +344 -0
- package/dist/agent-chapter-tools.js.map +1 -0
- package/dist/agent-chapters.d.ts +228 -0
- package/dist/agent-chapters.d.ts.map +1 -0
- package/dist/agent-chapters.js +737 -0
- package/dist/agent-chapters.js.map +1 -0
- package/dist/agent-data-parts.d.ts +167 -0
- package/dist/agent-data-parts.d.ts.map +1 -0
- package/dist/agent-data-parts.js +68 -0
- package/dist/agent-data-parts.js.map +1 -0
- package/dist/agent-errors.d.ts +41 -0
- package/dist/agent-errors.d.ts.map +1 -0
- package/dist/agent-errors.js +191 -0
- package/dist/agent-errors.js.map +1 -0
- package/dist/agent-follow-up-store.d.ts +273 -0
- package/dist/agent-follow-up-store.d.ts.map +1 -0
- package/dist/agent-follow-up-store.js +703 -0
- package/dist/agent-follow-up-store.js.map +1 -0
- package/dist/agent-follow-ups.d.ts +314 -0
- package/dist/agent-follow-ups.d.ts.map +1 -0
- package/dist/agent-follow-ups.js +840 -0
- package/dist/agent-follow-ups.js.map +1 -0
- package/dist/agent-memory.d.ts +323 -0
- package/dist/agent-memory.d.ts.map +1 -0
- package/dist/agent-memory.js +1270 -0
- package/dist/agent-memory.js.map +1 -0
- package/dist/agent-message-parts.d.ts +58 -0
- package/dist/agent-message-parts.d.ts.map +1 -0
- package/dist/agent-message-parts.js +163 -0
- package/dist/agent-message-parts.js.map +1 -0
- package/dist/agent-remote-mcp-credentials.d.ts +154 -0
- package/dist/agent-remote-mcp-credentials.d.ts.map +1 -0
- package/dist/agent-remote-mcp-credentials.js +287 -0
- package/dist/agent-remote-mcp-credentials.js.map +1 -0
- package/dist/agent-remote-mcp-crypto.d.ts +32 -0
- package/dist/agent-remote-mcp-crypto.d.ts.map +1 -0
- package/dist/agent-remote-mcp-crypto.js +101 -0
- package/dist/agent-remote-mcp-crypto.js.map +1 -0
- package/dist/agent-remote-mcp-install.d.ts +299 -0
- package/dist/agent-remote-mcp-install.d.ts.map +1 -0
- package/dist/agent-remote-mcp-install.js +785 -0
- package/dist/agent-remote-mcp-install.js.map +1 -0
- package/dist/agent-remote-mcp-oauth.d.ts +73 -0
- package/dist/agent-remote-mcp-oauth.d.ts.map +1 -0
- package/dist/agent-remote-mcp-oauth.js +344 -0
- package/dist/agent-remote-mcp-oauth.js.map +1 -0
- package/dist/agent-remote-mcp-transport.d.ts +46 -0
- package/dist/agent-remote-mcp-transport.d.ts.map +1 -0
- package/dist/agent-remote-mcp-transport.js +225 -0
- package/dist/agent-remote-mcp-transport.js.map +1 -0
- package/dist/agent-remote-mcp.d.ts +147 -0
- package/dist/agent-remote-mcp.d.ts.map +1 -0
- package/dist/agent-remote-mcp.js +681 -0
- package/dist/agent-remote-mcp.js.map +1 -0
- package/dist/agent-room-redaction.d.ts +66 -0
- package/dist/agent-room-redaction.d.ts.map +1 -0
- package/dist/agent-room-redaction.js +264 -0
- package/dist/agent-room-redaction.js.map +1 -0
- package/dist/agent-rooms.d.ts +209 -0
- package/dist/agent-rooms.d.ts.map +1 -0
- package/dist/agent-rooms.js +244 -0
- package/dist/agent-rooms.js.map +1 -0
- package/dist/agent-runtime.d.ts +541 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +4260 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/agent-skill-archive.d.ts +20 -0
- package/dist/agent-skill-archive.d.ts.map +1 -0
- package/dist/agent-skill-archive.js +316 -0
- package/dist/agent-skill-archive.js.map +1 -0
- package/dist/agent-skill-discovery.d.ts +96 -0
- package/dist/agent-skill-discovery.d.ts.map +1 -0
- package/dist/agent-skill-discovery.js +464 -0
- package/dist/agent-skill-discovery.js.map +1 -0
- package/dist/agent-skill-format.d.ts +57 -0
- package/dist/agent-skill-format.d.ts.map +1 -0
- package/dist/agent-skill-format.js +238 -0
- package/dist/agent-skill-format.js.map +1 -0
- package/dist/agent-skill-import.d.ts +64 -0
- package/dist/agent-skill-import.d.ts.map +1 -0
- package/dist/agent-skill-import.js +295 -0
- package/dist/agent-skill-import.js.map +1 -0
- package/dist/agent-skill-publish.d.ts +51 -0
- package/dist/agent-skill-publish.d.ts.map +1 -0
- package/dist/agent-skill-publish.js +136 -0
- package/dist/agent-skill-publish.js.map +1 -0
- package/dist/agent-skill-store.d.ts +252 -0
- package/dist/agent-skill-store.d.ts.map +1 -0
- package/dist/agent-skill-store.js +514 -0
- package/dist/agent-skill-store.js.map +1 -0
- package/dist/agent-skills.d.ts +85 -0
- package/dist/agent-skills.d.ts.map +1 -0
- package/dist/agent-skills.js +291 -0
- package/dist/agent-skills.js.map +1 -0
- package/dist/agent-transcript-pager.d.ts +77 -0
- package/dist/agent-transcript-pager.d.ts.map +1 -0
- package/dist/agent-transcript-pager.js +210 -0
- package/dist/agent-transcript-pager.js.map +1 -0
- package/dist/agent-user-data-parts.d.ts +20 -0
- package/dist/agent-user-data-parts.d.ts.map +1 -0
- package/dist/agent-user-data-parts.js +161 -0
- package/dist/agent-user-data-parts.js.map +1 -0
- package/dist/agent-user-transcript.d.ts +46 -0
- package/dist/agent-user-transcript.d.ts.map +1 -0
- package/dist/agent-user-transcript.js +106 -0
- package/dist/agent-user-transcript.js.map +1 -0
- package/dist/agent-voice-notes.d.ts +15 -0
- package/dist/agent-voice-notes.d.ts.map +1 -0
- package/dist/agent-voice-notes.js +17 -0
- package/dist/agent-voice-notes.js.map +1 -0
- package/dist/agent-wakes.d.ts +213 -0
- package/dist/agent-wakes.d.ts.map +1 -0
- package/dist/agent-wakes.js +534 -0
- package/dist/agent-wakes.js.map +1 -0
- package/dist/agent.d.ts +1780 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +3123 -0
- package/dist/agent.js.map +1 -0
- package/dist/ai.d.ts +583 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +1858 -0
- package/dist/ai.js.map +1 -0
- package/dist/app-manifest.d.ts +255 -0
- package/dist/app-manifest.d.ts.map +1 -0
- package/dist/app-manifest.js +372 -0
- package/dist/app-manifest.js.map +1 -0
- package/dist/app-users.d.ts +30 -0
- package/dist/app-users.d.ts.map +1 -0
- package/dist/app-users.js +91 -0
- package/dist/app-users.js.map +1 -0
- package/dist/audit-archive.d.ts +85 -0
- package/dist/audit-archive.d.ts.map +1 -0
- package/dist/audit-archive.js +178 -0
- package/dist/audit-archive.js.map +1 -0
- package/dist/audit.d.ts +54 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +95 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth-logger.d.ts +28 -0
- package/dist/auth-logger.d.ts.map +1 -0
- package/dist/auth-logger.js +53 -0
- package/dist/auth-logger.js.map +1 -0
- package/dist/auth-password-secret.d.ts +59 -0
- package/dist/auth-password-secret.d.ts.map +1 -0
- package/dist/auth-password-secret.js +409 -0
- package/dist/auth-password-secret.js.map +1 -0
- package/dist/auth-schema.d.ts +120 -0
- package/dist/auth-schema.d.ts.map +1 -0
- package/dist/auth-schema.js +285 -0
- package/dist/auth-schema.js.map +1 -0
- package/dist/auth.d.ts +321 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +1562 -0
- package/dist/auth.js.map +1 -0
- package/dist/backup-archive.d.ts +257 -0
- package/dist/backup-archive.d.ts.map +1 -0
- package/dist/backup-archive.js +2068 -0
- package/dist/backup-archive.js.map +1 -0
- package/dist/backup-crypto.d.ts +313 -0
- package/dist/backup-crypto.d.ts.map +1 -0
- package/dist/backup-crypto.js +693 -0
- package/dist/backup-crypto.js.map +1 -0
- package/dist/backup-format.d.ts +200 -0
- package/dist/backup-format.d.ts.map +1 -0
- package/dist/backup-format.js +1247 -0
- package/dist/backup-format.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/clock.d.ts +35 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +83 -0
- package/dist/clock.js.map +1 -0
- package/dist/data-client.d.ts +187 -0
- package/dist/data-client.d.ts.map +1 -0
- package/dist/data-client.js +590 -0
- package/dist/data-client.js.map +1 -0
- package/dist/data-secrets.d.ts +164 -0
- package/dist/data-secrets.d.ts.map +1 -0
- package/dist/data-secrets.js +383 -0
- package/dist/data-secrets.js.map +1 -0
- package/dist/db.d.ts +453 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +324 -0
- package/dist/db.js.map +1 -0
- package/dist/dev-activity.d.ts +48 -0
- package/dist/dev-activity.d.ts.map +1 -0
- package/dist/dev-activity.js +50 -0
- package/dist/dev-activity.js.map +1 -0
- package/dist/do.d.ts +429 -0
- package/dist/do.d.ts.map +1 -0
- package/dist/do.js +4526 -0
- package/dist/do.js.map +1 -0
- package/dist/email.d.ts +137 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +527 -0
- package/dist/email.js.map +1 -0
- package/dist/generated/admin-assets.d.ts +16 -0
- package/dist/generated/admin-assets.d.ts.map +1 -0
- package/dist/generated/admin-assets.js +16 -0
- package/dist/generated/admin-assets.js.map +1 -0
- package/dist/generated/admin-docs-assets.d.ts +3 -0
- package/dist/generated/admin-docs-assets.d.ts.map +1 -0
- package/dist/generated/admin-docs-assets.js +3 -0
- package/dist/generated/admin-docs-assets.js.map +1 -0
- package/dist/handoff-consumer.d.ts +79 -0
- package/dist/handoff-consumer.d.ts.map +1 -0
- package/dist/handoff-consumer.js +300 -0
- package/dist/handoff-consumer.js.map +1 -0
- package/dist/handoff.d.ts +70 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +228 -0
- package/dist/handoff.js.map +1 -0
- package/dist/host-auth.d.ts +47 -0
- package/dist/host-auth.d.ts.map +1 -0
- package/dist/host-auth.js +59 -0
- package/dist/host-auth.js.map +1 -0
- package/dist/host-user.d.ts +15 -0
- package/dist/host-user.d.ts.map +1 -0
- package/dist/host-user.js +23 -0
- package/dist/host-user.js.map +1 -0
- package/dist/html.d.ts +35 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +634 -0
- package/dist/html.js.map +1 -0
- package/dist/http-error.d.ts +13 -0
- package/dist/http-error.d.ts.map +1 -0
- package/dist/http-error.js +15 -0
- package/dist/http-error.js.map +1 -0
- package/dist/imports.d.ts +219 -0
- package/dist/imports.d.ts.map +1 -0
- package/dist/imports.js +571 -0
- package/dist/imports.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/inference-tape.d.ts +64 -0
- package/dist/inference-tape.d.ts.map +1 -0
- package/dist/inference-tape.js +278 -0
- package/dist/inference-tape.js.map +1 -0
- package/dist/internal.d.ts +15 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +48 -0
- package/dist/internal.js.map +1 -0
- package/dist/jobs.d.ts +796 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +538 -0
- package/dist/jobs.js.map +1 -0
- package/dist/json-schema.d.ts +91 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +884 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/knowledge.d.ts +33 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +348 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/local-dev-chrome.d.ts +29 -0
- package/dist/local-dev-chrome.d.ts.map +1 -0
- package/dist/local-dev-chrome.js +514 -0
- package/dist/local-dev-chrome.js.map +1 -0
- package/dist/local-dev-personas.d.ts +15 -0
- package/dist/local-dev-personas.d.ts.map +1 -0
- package/dist/local-dev-personas.js +46 -0
- package/dist/local-dev-personas.js.map +1 -0
- package/dist/mcp.d.ts +567 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +2480 -0
- package/dist/mcp.js.map +1 -0
- package/dist/modules.d.ts +145 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +164 -0
- package/dist/modules.js.map +1 -0
- package/dist/notification-client.d.ts +94 -0
- package/dist/notification-client.d.ts.map +1 -0
- package/dist/notification-client.js +127 -0
- package/dist/notification-client.js.map +1 -0
- package/dist/notifications.d.ts +447 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +1625 -0
- package/dist/notifications.js.map +1 -0
- package/dist/operator-data-query.d.ts +117 -0
- package/dist/operator-data-query.d.ts.map +1 -0
- package/dist/operator-data-query.js +431 -0
- package/dist/operator-data-query.js.map +1 -0
- package/dist/operator-mcp.d.ts +63 -0
- package/dist/operator-mcp.d.ts.map +1 -0
- package/dist/operator-mcp.js +2828 -0
- package/dist/operator-mcp.js.map +1 -0
- package/dist/outbound-https.d.ts +24 -0
- package/dist/outbound-https.d.ts.map +1 -0
- package/dist/outbound-https.js +172 -0
- package/dist/outbound-https.js.map +1 -0
- package/dist/pitr.d.ts +60 -0
- package/dist/pitr.d.ts.map +1 -0
- package/dist/pitr.js +94 -0
- package/dist/pitr.js.map +1 -0
- package/dist/platform.d.ts +199 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +196 -0
- package/dist/platform.js.map +1 -0
- package/dist/policies.d.ts +115 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +158 -0
- package/dist/policies.js.map +1 -0
- package/dist/principal.d.ts +143 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/principal.js +174 -0
- package/dist/principal.js.map +1 -0
- package/dist/realtime.d.ts +280 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +578 -0
- package/dist/realtime.js.map +1 -0
- package/dist/retrieval.d.ts +263 -0
- package/dist/retrieval.d.ts.map +1 -0
- package/dist/retrieval.js +602 -0
- package/dist/retrieval.js.map +1 -0
- package/dist/runtime-error-client.d.ts +10 -0
- package/dist/runtime-error-client.d.ts.map +1 -0
- package/dist/runtime-error-client.js +70 -0
- package/dist/runtime-error-client.js.map +1 -0
- package/dist/runtime-errors.d.ts +180 -0
- package/dist/runtime-errors.d.ts.map +1 -0
- package/dist/runtime-errors.js +572 -0
- package/dist/runtime-errors.js.map +1 -0
- package/dist/schema.d.ts +434 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +232 -0
- package/dist/schema.js.map +1 -0
- package/dist/search.d.ts +216 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +785 -0
- package/dist/search.js.map +1 -0
- package/dist/settings.d.ts +191 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +478 -0
- package/dist/settings.js.map +1 -0
- package/dist/sql.d.ts +7 -0
- package/dist/sql.d.ts.map +1 -0
- package/dist/sql.js +30 -0
- package/dist/sql.js.map +1 -0
- package/dist/storage-client.d.ts +69 -0
- package/dist/storage-client.d.ts.map +1 -0
- package/dist/storage-client.js +469 -0
- package/dist/storage-client.js.map +1 -0
- package/dist/storage.d.ts +21 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +82 -0
- package/dist/storage.js.map +1 -0
- package/dist/subject-domains.d.ts +15 -0
- package/dist/subject-domains.d.ts.map +1 -0
- package/dist/subject-domains.js +38 -0
- package/dist/subject-domains.js.map +1 -0
- package/dist/support.d.ts +132 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/support.js +483 -0
- package/dist/support.js.map +1 -0
- package/dist/system-tables.d.ts +12 -0
- package/dist/system-tables.d.ts.map +1 -0
- package/dist/system-tables.js +225 -0
- package/dist/system-tables.js.map +1 -0
- package/dist/test.d.ts +57 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +454 -0
- package/dist/test.js.map +1 -0
- package/dist/vite.d.ts +82 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +82 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpush-crypto.d.ts +39 -0
- package/dist/webpush-crypto.d.ts.map +1 -0
- package/dist/webpush-crypto.js +213 -0
- package/dist/webpush-crypto.js.map +1 -0
- package/dist/webpush-private.d.ts +11 -0
- package/dist/webpush-private.d.ts.map +1 -0
- package/dist/webpush-private.js +11 -0
- package/dist/webpush-private.js.map +1 -0
- package/dist/webpush.d.ts +86 -0
- package/dist/webpush.d.ts.map +1 -0
- package/dist/webpush.js +375 -0
- package/dist/webpush.js.map +1 -0
- package/dist/worker.d.ts +185 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +13021 -0
- package/dist/worker.js.map +1 -0
- package/package.json +161 -8
- package/README.md +0 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { RaybaseNotificationFeedItem } from "./notifications.js";
|
|
2
|
+
import type { RealtimeStatus } from "./realtime.js";
|
|
3
|
+
export type NotificationClientOptions = {
|
|
4
|
+
endpoint?: string;
|
|
5
|
+
realtimeEndpoint?: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
WebSocket?: new (url: string) => WebSocket;
|
|
9
|
+
};
|
|
10
|
+
export type NotificationSubscriptionHandlers = {
|
|
11
|
+
onNotification?: (event: {
|
|
12
|
+
event: "created" | "read" | "archived" | "deleted";
|
|
13
|
+
item: RaybaseNotificationFeedItem;
|
|
14
|
+
seq: number;
|
|
15
|
+
}) => void;
|
|
16
|
+
onCount?: (event: {
|
|
17
|
+
unread: number;
|
|
18
|
+
seq: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
onResync?: (event: {
|
|
21
|
+
reason: "gap" | "retention-expired" | "auth-stale";
|
|
22
|
+
latestSeq?: number;
|
|
23
|
+
}) => void;
|
|
24
|
+
onStatus?: (status: RealtimeStatus) => void;
|
|
25
|
+
onError?: (error: Error) => void;
|
|
26
|
+
};
|
|
27
|
+
export type NotificationPushSubscriptionJson = {
|
|
28
|
+
endpoint: string;
|
|
29
|
+
expirationTime?: number | null;
|
|
30
|
+
keys: {
|
|
31
|
+
p256dh: string;
|
|
32
|
+
auth: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type NotificationPushSubscriptionSummary = {
|
|
36
|
+
id: string;
|
|
37
|
+
endpointOrigin: string;
|
|
38
|
+
endpointHashPrefix: string;
|
|
39
|
+
label: string | null;
|
|
40
|
+
status: "active" | "expired" | "revoked";
|
|
41
|
+
failureCount: number;
|
|
42
|
+
lastSeenAt: string;
|
|
43
|
+
lastUsedAt: string | null;
|
|
44
|
+
};
|
|
45
|
+
export declare function createNotificationClient(options?: NotificationClientOptions): {
|
|
46
|
+
list(input?: {
|
|
47
|
+
status?: "unread" | "read" | "archived" | "all";
|
|
48
|
+
limit?: number;
|
|
49
|
+
cursor?: number;
|
|
50
|
+
since?: number;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
items: RaybaseNotificationFeedItem[];
|
|
53
|
+
nextCursor: number | null;
|
|
54
|
+
}>;
|
|
55
|
+
unreadCount(): Promise<{
|
|
56
|
+
unread: number;
|
|
57
|
+
seq: number;
|
|
58
|
+
}>;
|
|
59
|
+
markRead(feedItemId: string): Promise<{
|
|
60
|
+
item: RaybaseNotificationFeedItem;
|
|
61
|
+
}>;
|
|
62
|
+
readAll(): Promise<{
|
|
63
|
+
updated: number;
|
|
64
|
+
unread: number;
|
|
65
|
+
seq: number;
|
|
66
|
+
}>;
|
|
67
|
+
archive(feedItemId: string): Promise<{
|
|
68
|
+
item: RaybaseNotificationFeedItem;
|
|
69
|
+
}>;
|
|
70
|
+
push: {
|
|
71
|
+
publicKey(): Promise<{
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
publicKey: string | null;
|
|
74
|
+
}>;
|
|
75
|
+
list(): Promise<{
|
|
76
|
+
subscriptions: NotificationPushSubscriptionSummary[];
|
|
77
|
+
}>;
|
|
78
|
+
subscribe(subscription: NotificationPushSubscriptionJson, input?: {
|
|
79
|
+
label?: string;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
subscription: NotificationPushSubscriptionSummary;
|
|
82
|
+
evicted: NotificationPushSubscriptionSummary[];
|
|
83
|
+
}>;
|
|
84
|
+
unsubscribe(pushEndpoint: string): Promise<{
|
|
85
|
+
removed: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
};
|
|
88
|
+
subscribe(handlers?: NotificationSubscriptionHandlers, input?: {
|
|
89
|
+
lastSeq?: number;
|
|
90
|
+
}): {
|
|
91
|
+
unsubscribe(): void;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=notification-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-client.d.ts","sourceRoot":"","sources":["../src/notification-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QACvB,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;QACnD,IAAI,EAAE,2BAA2B,CAAC;QAClC,GAAG,EAAE,MAAM,CAAC;KACb,KAAK,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,KA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AAO;uBAAa,MAAM,GAAG,IAAI;;;2BAK3B,mCAAmC,EAAE;;gCAI3C,gCAAgC,UAAS;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE;0BACtD,mCAAmC;qBAAW,mCAAmC,EAAE;;kCAStF,MAAM;qBACR,OAAO;;;yBAUnB,gCAAgC,UAAc;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;;;EA+BzF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
function defaultFetch() {
|
|
2
|
+
if (typeof fetch === "undefined")
|
|
3
|
+
throw new Error("fetch is not available");
|
|
4
|
+
return fetch.bind(globalThis);
|
|
5
|
+
}
|
|
6
|
+
function defaultWebSocket() {
|
|
7
|
+
const ctor = globalThis.WebSocket;
|
|
8
|
+
if (!ctor)
|
|
9
|
+
throw new Error("WebSocket is not available");
|
|
10
|
+
return ctor;
|
|
11
|
+
}
|
|
12
|
+
function absoluteUrl(baseUrl, path) {
|
|
13
|
+
const base = baseUrl ?? (typeof location !== "undefined" ? `${location.protocol}//${location.host}` : "http://localhost");
|
|
14
|
+
return new URL(path, base).toString();
|
|
15
|
+
}
|
|
16
|
+
function websocketUrl(baseUrl, path) {
|
|
17
|
+
const url = new URL(absoluteUrl(baseUrl, path));
|
|
18
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
19
|
+
return url.toString();
|
|
20
|
+
}
|
|
21
|
+
async function parseJson(response) {
|
|
22
|
+
const json = (await response.json().catch(() => ({})));
|
|
23
|
+
if (!response.ok)
|
|
24
|
+
throw new Error(json.error || `Notification request failed with ${response.status}`);
|
|
25
|
+
return json;
|
|
26
|
+
}
|
|
27
|
+
function refId(prefix) {
|
|
28
|
+
return `${prefix}_${Math.random().toString(36).slice(2)}_${Date.now().toString(36)}`;
|
|
29
|
+
}
|
|
30
|
+
export function createNotificationClient(options = {}) {
|
|
31
|
+
const endpoint = options.endpoint ?? "/api/notifications";
|
|
32
|
+
const realtimeEndpoint = options.realtimeEndpoint ?? "/api/realtime";
|
|
33
|
+
const fetchImpl = options.fetch ?? defaultFetch();
|
|
34
|
+
const WebSocketCtor = options.WebSocket ?? defaultWebSocket();
|
|
35
|
+
return {
|
|
36
|
+
async list(input = {}) {
|
|
37
|
+
const url = new URL(absoluteUrl(options.baseUrl, endpoint));
|
|
38
|
+
for (const [key, value] of Object.entries(input)) {
|
|
39
|
+
if (value !== undefined)
|
|
40
|
+
url.searchParams.set(key, String(value));
|
|
41
|
+
}
|
|
42
|
+
return parseJson(await fetchImpl(url.toString(), { credentials: "same-origin" }));
|
|
43
|
+
},
|
|
44
|
+
async unreadCount() {
|
|
45
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/unread-count`), { credentials: "same-origin" }));
|
|
46
|
+
},
|
|
47
|
+
async markRead(feedItemId) {
|
|
48
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/${encodeURIComponent(feedItemId)}/read`), {
|
|
49
|
+
method: "POST",
|
|
50
|
+
credentials: "same-origin"
|
|
51
|
+
}));
|
|
52
|
+
},
|
|
53
|
+
async readAll() {
|
|
54
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/read-all`), {
|
|
55
|
+
method: "POST",
|
|
56
|
+
credentials: "same-origin"
|
|
57
|
+
}));
|
|
58
|
+
},
|
|
59
|
+
async archive(feedItemId) {
|
|
60
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/${encodeURIComponent(feedItemId)}/archive`), {
|
|
61
|
+
method: "POST",
|
|
62
|
+
credentials: "same-origin"
|
|
63
|
+
}));
|
|
64
|
+
},
|
|
65
|
+
push: {
|
|
66
|
+
async publicKey() {
|
|
67
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/push/public-key`), { credentials: "same-origin" }));
|
|
68
|
+
},
|
|
69
|
+
async list() {
|
|
70
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/push/subscriptions`), { credentials: "same-origin" }));
|
|
71
|
+
},
|
|
72
|
+
async subscribe(subscription, input = {}) {
|
|
73
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/push/subscriptions`), {
|
|
74
|
+
method: "PUT",
|
|
75
|
+
credentials: "same-origin",
|
|
76
|
+
headers: { "Content-Type": "application/json" },
|
|
77
|
+
body: JSON.stringify({ ...subscription, label: input.label })
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
async unsubscribe(pushEndpoint) {
|
|
81
|
+
return parseJson(await fetchImpl(absoluteUrl(options.baseUrl, `${endpoint}/push/subscriptions`), {
|
|
82
|
+
method: "DELETE",
|
|
83
|
+
credentials: "same-origin",
|
|
84
|
+
headers: { "Content-Type": "application/json" },
|
|
85
|
+
body: JSON.stringify({ endpoint: pushEndpoint })
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
subscribe(handlers = {}, input = {}) {
|
|
90
|
+
const socket = new WebSocketCtor(websocketUrl(options.baseUrl, realtimeEndpoint));
|
|
91
|
+
socket.addEventListener("open", () => {
|
|
92
|
+
handlers.onStatus?.("connecting");
|
|
93
|
+
socket.send(JSON.stringify({ v: 1, ref: refId("notif"), type: "notifications.subscribe", lastSeq: input.lastSeq }));
|
|
94
|
+
});
|
|
95
|
+
socket.addEventListener("message", (event) => {
|
|
96
|
+
let message;
|
|
97
|
+
try {
|
|
98
|
+
message = JSON.parse(String(event.data));
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (message.type === "status")
|
|
104
|
+
handlers.onStatus?.(message.status);
|
|
105
|
+
if (message.type === "notification")
|
|
106
|
+
handlers.onNotification?.({ event: message.event, item: message.item, seq: message.seq });
|
|
107
|
+
if (message.type === "notifications.count")
|
|
108
|
+
handlers.onCount?.({ unread: message.unread, seq: message.seq });
|
|
109
|
+
if (message.type === "notifications.resync")
|
|
110
|
+
handlers.onResync?.({ reason: message.reason, latestSeq: message.latestSeq });
|
|
111
|
+
if (message.type === "error")
|
|
112
|
+
handlers.onError?.(new Error(message.message));
|
|
113
|
+
});
|
|
114
|
+
socket.addEventListener("close", () => handlers.onStatus?.("closed"));
|
|
115
|
+
socket.addEventListener("error", () => handlers.onStatus?.("error"));
|
|
116
|
+
return {
|
|
117
|
+
unsubscribe() {
|
|
118
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
119
|
+
socket.send(JSON.stringify({ v: 1, ref: refId("notif_unsub"), type: "notifications.unsubscribe" }));
|
|
120
|
+
}
|
|
121
|
+
socket.close();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=notification-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-client.js","sourceRoot":"","sources":["../src/notification-client.ts"],"names":[],"mappings":"AAwCA,SAAS,YAAY;IACnB,IAAI,OAAO,KAAK,KAAK,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5E,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,IAAI,GAAI,UAAwE,CAAC,SAAS,CAAC;IACjG,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,OAA2B,EAAE,IAAY;IAC5D,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAC1H,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CA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seConfig, RaybaseSystemTable } from "./schema.js";
|
|
2
|
+
import type { SqlExecutor } from "./db.js";
|
|
3
|
+
import type { RaybaseJobPrincipal } from "./jobs.js";
|
|
4
|
+
import type { OperatorEvidenceProvider, ProviderHealth } from "./operator-mcp.js";
|
|
5
|
+
import type { RaybaseUser } from "./policies.js";
|
|
6
|
+
export declare const raybaseNotificationDeliveryJobName = "raybase.notifications.deliver";
|
|
7
|
+
export declare const raybaseNotificationServicePrincipal = "raybase-notifications";
|
|
8
|
+
export declare const raybaseNotificationJobPrefix = "raybase.notifications.";
|
|
9
|
+
export declare const raybaseNotificationsTableName = "_notifications";
|
|
10
|
+
export declare const raybaseNotificationRecipientsTableName = "_notification_recipients";
|
|
11
|
+
export declare const raybaseNotificationSubscriptionsTableName = "_notification_subscriptions";
|
|
12
|
+
export declare const raybaseNotificationDeliveriesTableName = "_notification_deliveries";
|
|
13
|
+
export declare const raybaseNotificationAttemptsTableName = "_notification_attempts";
|
|
14
|
+
export declare const raybaseNotificationThrottleWindowsTableName = "_notification_throttle_windows";
|
|
15
|
+
export declare const raybaseInboundEventsTableName = "_inbound_events";
|
|
16
|
+
export declare const defaultNotificationSubscriptionOrganizationId = "default";
|
|
17
|
+
export type RaybaseNotificationSeverity = "info" | "success" | "warning" | "error";
|
|
18
|
+
export type RaybaseNotificationRecipient = {
|
|
19
|
+
kind: "user";
|
|
20
|
+
userId: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "role";
|
|
23
|
+
role: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "operator";
|
|
26
|
+
role?: "owner" | "admin";
|
|
27
|
+
} | {
|
|
28
|
+
kind: "current-user";
|
|
29
|
+
};
|
|
30
|
+
export type RaybaseNotificationTarget = {
|
|
31
|
+
href?: string;
|
|
32
|
+
entity?: {
|
|
33
|
+
type: string;
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type RaybaseNotificationChannelTargets = Record<string, unknown>;
|
|
38
|
+
export type SendNotificationInput = {
|
|
39
|
+
to?: RaybaseNotificationRecipient[];
|
|
40
|
+
title: string;
|
|
41
|
+
body?: string;
|
|
42
|
+
kind?: string;
|
|
43
|
+
severity?: RaybaseNotificationSeverity;
|
|
44
|
+
target?: RaybaseNotificationTarget;
|
|
45
|
+
channels?: string[];
|
|
46
|
+
channelTargets?: RaybaseNotificationChannelTargets;
|
|
47
|
+
dedupeKey?: string;
|
|
48
|
+
throttle?: {
|
|
49
|
+
key: string;
|
|
50
|
+
minInterval: string | number;
|
|
51
|
+
};
|
|
52
|
+
metadata?: unknown;
|
|
53
|
+
expiresAt?: string;
|
|
54
|
+
};
|
|
55
|
+
export type SendNotificationResult = {
|
|
56
|
+
notificationId?: string;
|
|
57
|
+
deduped: boolean;
|
|
58
|
+
recipients: Array<{
|
|
59
|
+
recipientSubjectId: string;
|
|
60
|
+
recipientKind: string;
|
|
61
|
+
feedItemId?: string;
|
|
62
|
+
}>;
|
|
63
|
+
deliveries: Array<{
|
|
64
|
+
deliveryId: string;
|
|
65
|
+
channel: string;
|
|
66
|
+
adapter: string;
|
|
67
|
+
recipientSubjectId?: string;
|
|
68
|
+
recipientEmail?: string;
|
|
69
|
+
}>;
|
|
70
|
+
throttled: Array<{
|
|
71
|
+
recipientSubjectId: string;
|
|
72
|
+
until: string;
|
|
73
|
+
}>;
|
|
74
|
+
skipped: Array<{
|
|
75
|
+
recipientSubjectId: string;
|
|
76
|
+
channel: string;
|
|
77
|
+
reason: "no-subscriptions";
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
export type RaybaseNotificationFeedItem = {
|
|
81
|
+
id: string;
|
|
82
|
+
notificationId: string;
|
|
83
|
+
kind?: string | null;
|
|
84
|
+
severity: RaybaseNotificationSeverity;
|
|
85
|
+
title: string;
|
|
86
|
+
body?: string | null;
|
|
87
|
+
target?: RaybaseNotificationTarget;
|
|
88
|
+
metadata?: unknown;
|
|
89
|
+
feedStatus: "unread" | "read" | "archived";
|
|
90
|
+
readAt?: string | null;
|
|
91
|
+
archivedAt?: string | null;
|
|
92
|
+
recipientSeq: number;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
expiresAt?: string | null;
|
|
95
|
+
};
|
|
96
|
+
export type RaybaseNotificationDeliveryStatus = "pending" | "leased" | "delivered" | "failed" | "permanent_failure" | "cancelled" | "skipped_local";
|
|
97
|
+
export type RaybaseNotificationDelivery = {
|
|
98
|
+
id: string;
|
|
99
|
+
notificationId: string;
|
|
100
|
+
recipientId: string | null;
|
|
101
|
+
recipientSubjectId: string | null;
|
|
102
|
+
recipientEmail: string | null;
|
|
103
|
+
recipientName: string | null;
|
|
104
|
+
channel: string;
|
|
105
|
+
adapter: string;
|
|
106
|
+
status: RaybaseNotificationDeliveryStatus;
|
|
107
|
+
attempt: number;
|
|
108
|
+
maxAttempts: number;
|
|
109
|
+
idempotencyKey: string | null;
|
|
110
|
+
availableAt: string;
|
|
111
|
+
lastAttemptAt: string | null;
|
|
112
|
+
deliveredAt: string | null;
|
|
113
|
+
failedAt: string | null;
|
|
114
|
+
providerMessageId: string | null;
|
|
115
|
+
lastErrorJson: string | null;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
updatedAt: string;
|
|
118
|
+
notification: {
|
|
119
|
+
id: string;
|
|
120
|
+
kind: string | null;
|
|
121
|
+
severity: RaybaseNotificationSeverity;
|
|
122
|
+
title: string;
|
|
123
|
+
body: string | null;
|
|
124
|
+
targetHref: string | null;
|
|
125
|
+
targetEntityType: string | null;
|
|
126
|
+
targetEntityId: string | null;
|
|
127
|
+
metadata: unknown;
|
|
128
|
+
actorKind: string;
|
|
129
|
+
actorId: string | null;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
export type RaybaseNotificationSendResult = {
|
|
134
|
+
status: "delivered" | "skipped";
|
|
135
|
+
providerMessageId?: string;
|
|
136
|
+
requestSummary?: unknown;
|
|
137
|
+
responseSummary?: unknown;
|
|
138
|
+
};
|
|
139
|
+
export type RaybaseNotificationAdapterContext<Env = unknown> = {
|
|
140
|
+
env: Env;
|
|
141
|
+
isLocal: boolean;
|
|
142
|
+
now: string;
|
|
143
|
+
};
|
|
144
|
+
export type RaybaseNotificationDoctorContext<Env = unknown> = RaybaseNotificationAdapterContext<Env>;
|
|
145
|
+
export type RaybaseDoctorFinding = {
|
|
146
|
+
severity: "info" | "warning" | "error";
|
|
147
|
+
message: string;
|
|
148
|
+
details?: Record<string, unknown>;
|
|
149
|
+
};
|
|
150
|
+
export type RaybaseNotificationAdapter<Env = unknown> = {
|
|
151
|
+
name: string;
|
|
152
|
+
channel: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
allowLocalSend?: boolean;
|
|
155
|
+
send: (delivery: RaybaseNotificationDelivery, ctx: RaybaseNotificationAdapterContext<Env>) => Promise<RaybaseNotificationSendResult>;
|
|
156
|
+
classifyError?: (error: unknown) => "retry" | "permanent";
|
|
157
|
+
health?: (ctx: RaybaseNotificationAdapterContext<Env>) => Promise<ProviderHealth>;
|
|
158
|
+
doctor?: (ctx: RaybaseNotificationDoctorContext<Env>) => Promise<RaybaseDoctorFinding[]>;
|
|
159
|
+
};
|
|
160
|
+
export type RaybaseInboundEventInput = {
|
|
161
|
+
idempotencyKey?: string;
|
|
162
|
+
providerEventId?: string;
|
|
163
|
+
payload?: unknown;
|
|
164
|
+
actorKind?: string;
|
|
165
|
+
actorId?: string;
|
|
166
|
+
};
|
|
167
|
+
export type RaybaseInboundEvent = {
|
|
168
|
+
id: string;
|
|
169
|
+
adapter: string;
|
|
170
|
+
path: string;
|
|
171
|
+
status: string;
|
|
172
|
+
verified: boolean;
|
|
173
|
+
idempotencyKey: string | null;
|
|
174
|
+
providerEventId: string | null;
|
|
175
|
+
actorKind: string;
|
|
176
|
+
actorId: string | null;
|
|
177
|
+
payload: unknown;
|
|
178
|
+
receivedAt: string;
|
|
179
|
+
processedAt: string | null;
|
|
180
|
+
};
|
|
181
|
+
export type RaybaseInboundAdapterContext<Env = unknown> = {
|
|
182
|
+
env: Env;
|
|
183
|
+
request: Request;
|
|
184
|
+
};
|
|
185
|
+
export type RaybaseInboundHandlerContext<Env = unknown> = {
|
|
186
|
+
env: Env;
|
|
187
|
+
request: Request;
|
|
188
|
+
event: RaybaseInboundEvent;
|
|
189
|
+
notifications: RaybaseNotificationsRuntime<Env>;
|
|
190
|
+
jobs: {
|
|
191
|
+
enqueue: (jobName: string, input: unknown, options?: {
|
|
192
|
+
idempotencyKey?: string;
|
|
193
|
+
delay?: string | number;
|
|
194
|
+
}) => Promise<unknown>;
|
|
195
|
+
};
|
|
196
|
+
audit: (action: string, targetType: string, targetId?: string, metadata?: unknown) => Promise<void>;
|
|
197
|
+
};
|
|
198
|
+
export type RaybaseInboundAdapter<Env = unknown> = {
|
|
199
|
+
name: string;
|
|
200
|
+
path: string;
|
|
201
|
+
verify: (request: Request, rawBody: Uint8Array, ctx: RaybaseInboundAdapterContext<Env>) => Promise<true>;
|
|
202
|
+
parse: (request: Request, rawBody: Uint8Array, ctx: RaybaseInboundAdapterContext<Env>) => Promise<RaybaseInboundEventInput>;
|
|
203
|
+
handle: (event: RaybaseInboundEvent, ctx: RaybaseInboundHandlerContext<Env>) => Promise<unknown>;
|
|
204
|
+
};
|
|
205
|
+
export type RaybaseNotifications<Env = unknown> = {
|
|
206
|
+
feed?: {
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
};
|
|
209
|
+
channels?: Record<string, RaybaseNotificationAdapter<Env>>;
|
|
210
|
+
inbound?: Record<string, RaybaseInboundAdapter<Env>>;
|
|
211
|
+
};
|
|
212
|
+
export type NotificationListOptions = {
|
|
213
|
+
status?: "unread" | "read" | "archived" | "all";
|
|
214
|
+
limit?: number;
|
|
215
|
+
cursor?: number;
|
|
216
|
+
since?: number;
|
|
217
|
+
};
|
|
218
|
+
export type RaybaseNotificationsRuntime<Env = unknown> = {
|
|
219
|
+
enabled: boolean;
|
|
220
|
+
feedEnabled: boolean;
|
|
221
|
+
send(input: SendNotificationInput): Promise<SendNotificationResult>;
|
|
222
|
+
list(options?: NotificationListOptions): Promise<{
|
|
223
|
+
items: RaybaseNotificationFeedItem[];
|
|
224
|
+
nextCursor: number | null;
|
|
225
|
+
}>;
|
|
226
|
+
unreadCount(): Promise<{
|
|
227
|
+
unread: number;
|
|
228
|
+
seq: number;
|
|
229
|
+
}>;
|
|
230
|
+
markRead(feedItemId: string): Promise<RaybaseNotificationFeedItem>;
|
|
231
|
+
markAllRead(): Promise<{
|
|
232
|
+
updated: number;
|
|
233
|
+
unread: number;
|
|
234
|
+
seq: number;
|
|
235
|
+
}>;
|
|
236
|
+
archive(feedItemId: string): Promise<RaybaseNotificationFeedItem>;
|
|
237
|
+
};
|
|
238
|
+
export type RaybaseNotificationSubscription = {
|
|
239
|
+
id: string;
|
|
240
|
+
organizationId: string;
|
|
241
|
+
userId: string;
|
|
242
|
+
kind: string;
|
|
243
|
+
enabled: boolean;
|
|
244
|
+
channels: string[];
|
|
245
|
+
createdAt: string;
|
|
246
|
+
updatedAt: string;
|
|
247
|
+
};
|
|
248
|
+
export type RaybaseNotificationThrottleWindow = {
|
|
249
|
+
id: string;
|
|
250
|
+
throttleKey: string;
|
|
251
|
+
recipientSubjectId: string;
|
|
252
|
+
maskedRecipientSubjectId: string;
|
|
253
|
+
lastSentAt: string;
|
|
254
|
+
windowExpiresAt: string;
|
|
255
|
+
suppressedCount: number;
|
|
256
|
+
firstSuppressedAt?: string | null;
|
|
257
|
+
lastSuppressed?: unknown;
|
|
258
|
+
updatedAt: string;
|
|
259
|
+
};
|
|
260
|
+
export declare class NotificationError extends Error {
|
|
261
|
+
readonly code: "disabled" | "invalid-input" | "invalid-channel" | "recipient-unavailable" | "payload-too-large" | "auth-required" | "not-found";
|
|
262
|
+
constructor(message: string, code: "disabled" | "invalid-input" | "invalid-channel" | "recipient-unavailable" | "payload-too-large" | "auth-required" | "not-found");
|
|
263
|
+
}
|
|
264
|
+
export type NotificationConfigInput = NonNullable<RaybaseConfig["notifications"]>;
|
|
265
|
+
export type ResolvedNotificationConfig = {
|
|
266
|
+
enabled: boolean;
|
|
267
|
+
maxRecipientsPerSend: number;
|
|
268
|
+
maxBodyBytes: number;
|
|
269
|
+
maxMetadataBytes: number;
|
|
270
|
+
maxChannelTargetsBytes: number;
|
|
271
|
+
maxInboundBodyBytes: number;
|
|
272
|
+
feed: {
|
|
273
|
+
enabled: boolean;
|
|
274
|
+
endpoint: string;
|
|
275
|
+
};
|
|
276
|
+
delivery: {
|
|
277
|
+
maxAttempts: number;
|
|
278
|
+
timeoutMs: number;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
export type NotificationRuntimeOptions<Env> = {
|
|
282
|
+
env: Env;
|
|
283
|
+
config: RaybaseConfig;
|
|
284
|
+
notifications?: RaybaseNotifications<Env>;
|
|
285
|
+
db: SqlExecutor;
|
|
286
|
+
currentUser?: RaybaseUser | null;
|
|
287
|
+
actor?: {
|
|
288
|
+
kind: string;
|
|
289
|
+
id?: string | null;
|
|
290
|
+
};
|
|
291
|
+
source?: {
|
|
292
|
+
type?: string;
|
|
293
|
+
id?: string | null;
|
|
294
|
+
};
|
|
295
|
+
isLocal?: boolean;
|
|
296
|
+
enqueueDelivery?: () => Promise<void>;
|
|
297
|
+
activeWebPushSubjectIds?: (subjectIds: string[]) => Promise<Set<string>>;
|
|
298
|
+
audit?: (action: string, targetType: string, targetId?: string, metadata?: unknown) => Promise<void>;
|
|
299
|
+
notifyFeed?: (message: {
|
|
300
|
+
subjectId: string;
|
|
301
|
+
event: "created" | "read" | "archived" | "deleted";
|
|
302
|
+
item: RaybaseNotificationFeedItem;
|
|
303
|
+
unread: number;
|
|
304
|
+
seq: number;
|
|
305
|
+
}) => Promise<void>;
|
|
306
|
+
};
|
|
307
|
+
export type InboundRuntimeOptions<Env> = NotificationRuntimeOptions<Env> & {
|
|
308
|
+
adapter: RaybaseInboundAdapter<Env>;
|
|
309
|
+
request: Request;
|
|
310
|
+
enqueueJob?: (jobName: string, input: unknown, options?: {
|
|
311
|
+
idempotencyKey?: string;
|
|
312
|
+
delay?: string | number;
|
|
313
|
+
}) => Promise<unknown>;
|
|
314
|
+
audit?: (action: string, targetType: string, targetId?: string, metadata?: unknown) => Promise<void>;
|
|
315
|
+
};
|
|
316
|
+
export declare function defineNotifications<Env = unknown>(notifications: RaybaseNotifications<Env>): RaybaseNotifications<Env>;
|
|
317
|
+
export declare function mergeRaybaseNotifications<Env>(base: RaybaseNotifications<Env> | undefined, contribution: RaybaseNotifications<Env> | undefined, options?: {
|
|
318
|
+
duplicateLabel?: string;
|
|
319
|
+
validate?: boolean;
|
|
320
|
+
}): RaybaseNotifications<Env> | undefined;
|
|
321
|
+
export declare const notificationRecipient: {
|
|
322
|
+
user(userId: string): RaybaseNotificationRecipient;
|
|
323
|
+
role(role: string): RaybaseNotificationRecipient;
|
|
324
|
+
operator(role?: "owner" | "admin"): RaybaseNotificationRecipient;
|
|
325
|
+
currentUser(): RaybaseNotificationRecipient;
|
|
326
|
+
};
|
|
327
|
+
export declare const notificationDefaults: {
|
|
328
|
+
maxRecipientsPerSend: number;
|
|
329
|
+
maxRecipientsHardLimit: number;
|
|
330
|
+
maxBodyBytes: number;
|
|
331
|
+
maxMetadataBytes: number;
|
|
332
|
+
maxChannelTargetsBytes: number;
|
|
333
|
+
maxInboundBodyBytes: number;
|
|
334
|
+
maxAttemptSummaryBytes: number;
|
|
335
|
+
deliveryMaxAttempts: number;
|
|
336
|
+
deliveryTimeoutMs: number;
|
|
337
|
+
throttleKeyMaxLength: number;
|
|
338
|
+
throttleMinIntervalMs: number;
|
|
339
|
+
throttleMaxIntervalMs: number;
|
|
340
|
+
};
|
|
341
|
+
export declare function resolveNotificationConfig(config: RaybaseConfig, notifications?: RaybaseNotifications<any>): ResolvedNotificationConfig;
|
|
342
|
+
export declare function validateNotifications<Env>(notifications: RaybaseNotifications<Env>): void;
|
|
343
|
+
export declare function reservedInboundPath(path: string): boolean;
|
|
344
|
+
export declare const raybaseNotificationSystemTables: RaybaseSystemTable[];
|
|
345
|
+
export declare function createDisabledNotificationsRuntime<Env = unknown>(): RaybaseNotificationsRuntime<Env>;
|
|
346
|
+
export declare function getNotificationSubscription(db: SqlExecutor, input: {
|
|
347
|
+
organizationId?: string | null;
|
|
348
|
+
userId: string;
|
|
349
|
+
kind: string;
|
|
350
|
+
}): Promise<RaybaseNotificationSubscription | null>;
|
|
351
|
+
export declare function setNotificationSubscription(db: SqlExecutor, input: {
|
|
352
|
+
organizationId?: string | null;
|
|
353
|
+
userId: string;
|
|
354
|
+
kind: string;
|
|
355
|
+
enabled: boolean;
|
|
356
|
+
channels?: string[];
|
|
357
|
+
}): Promise<RaybaseNotificationSubscription>;
|
|
358
|
+
export declare function listNotificationSubscribers(db: SqlExecutor, kind: string, input?: {
|
|
359
|
+
organizationId?: string | null;
|
|
360
|
+
}): Promise<Array<{
|
|
361
|
+
userId: string;
|
|
362
|
+
channels: string[];
|
|
363
|
+
}>>;
|
|
364
|
+
export declare function createNotificationsRuntime<Env>(options: NotificationRuntimeOptions<Env>): RaybaseNotificationsRuntime<Env>;
|
|
365
|
+
export declare function claimAndRunNotificationDeliveries<Env>(options: NotificationRuntimeOptions<Env>): Promise<{
|
|
366
|
+
processed: number;
|
|
367
|
+
}>;
|
|
368
|
+
export type NotificationAdminSummary = {
|
|
369
|
+
deliveryCounts: Array<{
|
|
370
|
+
status: string;
|
|
371
|
+
channel: string;
|
|
372
|
+
adapter: string;
|
|
373
|
+
count: number;
|
|
374
|
+
}>;
|
|
375
|
+
inboundCounts: Array<{
|
|
376
|
+
status: string;
|
|
377
|
+
adapter: string;
|
|
378
|
+
count: number;
|
|
379
|
+
}>;
|
|
380
|
+
adapters: Array<{
|
|
381
|
+
channel: string;
|
|
382
|
+
adapter: string;
|
|
383
|
+
description?: string;
|
|
384
|
+
}>;
|
|
385
|
+
};
|
|
386
|
+
export declare function notificationAdminSummary<Env>(db: SqlExecutor, notifications?: RaybaseNotifications<Env>): Promise<NotificationAdminSummary>;
|
|
387
|
+
export declare function notificationThrottleWindowsQuery(db: SqlExecutor, options?: {
|
|
388
|
+
activeOnly?: boolean;
|
|
389
|
+
limit?: number;
|
|
390
|
+
offset?: number;
|
|
391
|
+
}): Promise<{
|
|
392
|
+
throttles: RaybaseNotificationThrottleWindow[];
|
|
393
|
+
}>;
|
|
394
|
+
export declare function resetNotificationThrottleWindow(db: SqlExecutor, id: string): Promise<{
|
|
395
|
+
ok: true;
|
|
396
|
+
throttle?: RaybaseNotificationThrottleWindow;
|
|
397
|
+
}>;
|
|
398
|
+
export declare function compactNotificationThrottleWindows(db: SqlExecutor, now?: string): Promise<{
|
|
399
|
+
deleted: number;
|
|
400
|
+
}>;
|
|
401
|
+
export declare function notificationDeliveriesQuery(db: SqlExecutor, options?: {
|
|
402
|
+
status?: string;
|
|
403
|
+
channel?: string;
|
|
404
|
+
adapter?: string;
|
|
405
|
+
limit?: number;
|
|
406
|
+
offset?: number;
|
|
407
|
+
}): Promise<{
|
|
408
|
+
deliveries: Record<string, unknown>[];
|
|
409
|
+
}>;
|
|
410
|
+
export declare function notificationDeliveryDetail(db: SqlExecutor, deliveryId: string): Promise<Record<string, unknown> | null>;
|
|
411
|
+
export declare function retryNotificationDelivery(db: SqlExecutor, deliveryId: string): Promise<{
|
|
412
|
+
ok: true;
|
|
413
|
+
previousStatus: string;
|
|
414
|
+
}>;
|
|
415
|
+
export declare function notificationInboundEventsQuery(db: SqlExecutor, options?: {
|
|
416
|
+
status?: string;
|
|
417
|
+
adapter?: string;
|
|
418
|
+
limit?: number;
|
|
419
|
+
offset?: number;
|
|
420
|
+
}): Promise<{
|
|
421
|
+
events: Record<string, unknown>[];
|
|
422
|
+
}>;
|
|
423
|
+
export declare function notificationInboundEventDetail(db: SqlExecutor, eventId: string): Promise<Record<string, unknown> | null>;
|
|
424
|
+
export declare function createNotificationsOperatorEvidenceProvider<Env>(dbForContext: (ctx: {
|
|
425
|
+
env: Env;
|
|
426
|
+
}) => SqlExecutor, notifications?: RaybaseNotifications<Env>): OperatorEvidenceProvider<Env>;
|
|
427
|
+
export declare function handleInboundNotification<Env>(options: InboundRuntimeOptions<Env>): Promise<Response>;
|
|
428
|
+
export type WebhookOutboundOptions<Env> = {
|
|
429
|
+
name: string;
|
|
430
|
+
url: (env: Env) => string | undefined | null;
|
|
431
|
+
signingSecret: (env: Env) => string | undefined | null;
|
|
432
|
+
headers?: (delivery: RaybaseNotificationDelivery, ctx: RaybaseNotificationAdapterContext<Env>) => Record<string, string>;
|
|
433
|
+
allowLocalSend?: boolean;
|
|
434
|
+
timeoutMs?: number;
|
|
435
|
+
};
|
|
436
|
+
export declare function webhookOutboundAdapter<Env = unknown>(options: WebhookOutboundOptions<Env>): RaybaseNotificationAdapter<Env>;
|
|
437
|
+
export type WebhookInboundOptions<Env> = {
|
|
438
|
+
name: string;
|
|
439
|
+
path: string;
|
|
440
|
+
signingSecret: (env: Env) => string | undefined | null;
|
|
441
|
+
replayWindowSeconds?: number;
|
|
442
|
+
parse?: (request: Request) => Promise<RaybaseInboundEventInput>;
|
|
443
|
+
handle: (event: RaybaseInboundEvent, ctx: RaybaseInboundHandlerContext<Env>) => Promise<unknown>;
|
|
444
|
+
};
|
|
445
|
+
export declare function webhookInboundAdapter<Env = unknown>(options: WebhookInboundOptions<Env>): RaybaseInboundAdapter<Env>;
|
|
446
|
+
export declare function notificationJobPrincipal(): RaybaseJobPrincipal;
|
|
447
|
+
//# sourceMappingURL=notifications.d.ts.map
|