@sanity/sdk 3.3.0-rc.1 → 3.4.0-rc.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.
Files changed (32) hide show
  1. package/dist/_exports/_internal.d.ts +12 -4
  2. package/dist/_exports/_internal.d.ts.map +1 -1
  3. package/dist/_exports/_internal.js +21 -3
  4. package/dist/_exports/_internal.js.map +1 -1
  5. package/dist/_exports/comlink.d.ts +1 -1
  6. package/dist/_exports/dashboard.d.ts +1 -1
  7. package/dist/_exports/dashboard.js +1 -1
  8. package/dist/{authStore-7dZCfKUq.d.ts → applications-903KQTrD.d.ts} +346 -344
  9. package/dist/applications-903KQTrD.d.ts.map +1 -0
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/{topicStore-Ct7IFNtY.js → topicStore-BJ54_X6H.js} +3 -1
  14. package/dist/topicStore-BJ54_X6H.js.map +1 -0
  15. package/dist/{topicStore-CAnJsiqI.d.ts → topicStore-VQILEI1R.d.ts} +54 -25
  16. package/dist/topicStore-VQILEI1R.d.ts.map +1 -0
  17. package/dist/{version-CYs30C7v.js → version-CYqZgJX1.js} +2 -2
  18. package/dist/{version-CYs30C7v.js.map → version-CYqZgJX1.js.map} +1 -1
  19. package/package.json +7 -7
  20. package/src/_exports/_internal.ts +2 -0
  21. package/src/applications/applicationOrigin.test.ts +51 -0
  22. package/src/applications/applicationOrigin.ts +26 -0
  23. package/src/dashboard/messageBus/bus.test.ts +39 -0
  24. package/src/dashboard/messageBus/bus.ts +32 -22
  25. package/src/dashboard/messageBus/topics.test.ts +36 -2
  26. package/src/dashboard/messageBus/topics.ts +51 -16
  27. package/src/installations/installations.test-d.ts +11 -0
  28. package/src/installations/installations.test.ts +6 -4
  29. package/src/installations/installations.ts +13 -2
  30. package/dist/authStore-7dZCfKUq.d.ts.map +0 -1
  31. package/dist/topicStore-CAnJsiqI.d.ts.map +0 -1
  32. package/dist/topicStore-Ct7IFNtY.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"authStore-7dZCfKUq.d.ts","names":[],"sources":["../src/store/createStoreState.ts","../src/store/defineStore.ts","../src/store/createActionBinder.ts","../src/store/createStateSourceAction.ts","../src/store/fetcherStore.ts","../src/access/checkPermissions.ts","../src/utils/includeShape.ts","../src/applications/applications.ts","../src/auth/authStateType.ts","../src/project/organizationVerification.ts","../src/auth/getOrganizationVerificationState.ts","../src/auth/handleAuthCallback.ts","../src/auth/logout.ts","../src/auth/oauth/types.ts","../src/auth/oauth/oauthActions.ts","../src/client/clientStore.ts","../src/comments/types.ts","../src/comments/commentActions.ts","../src/comments/commentsStore.ts","../src/config/handles.ts","../src/utils/logger.ts","../src/config/loggingConfig.ts","../src/datasets/datasets.ts","../src/typegen/groqCompat.ts","../src/typegen/resolve.ts","../src/document/actions.ts","../src/document/patchOperations.ts","../src/document/processMutations.ts","../src/document/permissions.ts","../src/document/sharedListener.ts","../src/document/documentStore.ts","../src/document/reducers.ts","../src/document/events.ts","../src/document/applyDocumentActions.ts","../src/document/processActions/releaseUtil.ts","../src/favorites/favorites.ts","../src/installations/installations.ts","../src/organization/organization.ts","../src/organizations/organizations.ts","../src/users/types.ts","../src/presence/types.ts","../src/presence/presenceStore.ts","../src/projection/types.ts","../src/preview/types.ts","../src/project/project.ts","../src/projection/getProjectionState.ts","../src/projection/resolveProjection.ts","../src/projects/projects.ts","../src/query/queryStore.ts","../src/releases/releasesStore.ts","../src/releases/getPerspectiveState.ts","../src/typegen/defineProjection.ts","../src/users/usersStore.ts","../src/utils/getCorsErrorProjectId.ts","../src/utils/isImportError.ts","../src/version.ts","../src/_exports/index.ts","../src/auth/authStore.ts"],"mappings":";;;;;;;;;;;;;UAOiB,WAAW;;;;;;;EAO1B,WAAW;;;;;;;;;;EAWX,MAAM,cAAc,cAAc,QAAQ,YAAY,GAAG,WAAW,QAAQ;;;;;;;;;EAU5E,YAAY,WAAW;;;;;UC7BR,aA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,iBAAA,kBAAA,UAAA,8BAAA;;;;;;;;cA+Bb,cAAY,iBAAA,kBAAA,iBAAA,WAAA;;;;cAaZ,aAAW,iBAAA,kBAAA,qBAAA,QAAA;;;;;;;iBC7aR,sBAAsB,OAAO;;;;;;;;;;;;;;;;;;;;;;iBCa7B,cAAc;;;;;cCdjB;;;;KCFD,kBAAgB;;;;;;KCuBhB,YAAY,oBAAoB,qBAAqB,qBAAqB;;;;;KAM1E;EACV,MAAM,cAAc;EACpB;EACA,aAAa;EACb;;;;;;KAOU;EAAsB,MAAM,cAAc;EAAY;;;;;;KAMtD;EAAsB,MAAM,cAAc;EAAY;;;;;;KAMtD;EAAkB,MAAM,cAAc;EAAO;;;;;;;UAOxC;EACf;EACA;EACA;;;;;;KAOU;;;;UAOK;EACf,WAAW;EACX,YAAY;EACZ;IACE;IACA,gBAAgB,QAAQ,iBAAiB;IACzC,iBAAiB;IACjB;IACA,aAAa;IACb;IACA;IACA;IACA;IACA,YAAY;IACZ,OAAO;;EAET,mBAAmB;EACnB,cAAc;;;;;cAkJH,qBAAmB,iBAAA,oBAAA,YAAA;;;;cAUnB,eAAa,iBAAA,oBAAA;;;;cAkBb,kBAAgB,iBAAA,oBAAA;;;;cAQhB,cAAY,iBAAA,oBAAA,YAAA;;;;cAQZ,4BAA0B,iBAAA,oBAAA;;;;;cAS1B,uBAAqB,iBAAA,oBAAA;;;;;;cAcrB,cAAY,iBAAA,iBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"topicStore-CAnJsiqI.d.ts","names":[],"sources":["../src/dashboard/messageBus/topics.ts","../src/dashboard/messageBus/bus.ts","../src/dashboard/messageBus/topicStore.ts"],"mappings":";;;;;;;UASiB;WACN;WACA;WACA;;;;;;;;;KAUC;;;;;UAMK,0BAA0B;WAChC,QAAQ;WACR,SAAS;;;;;;KAOR,cAAc;EAAM;EAAe,OAAO;;;;;;KAM1C,cAAc,GAAG;EAC3B;EACA,SAAS;EACT,QAAQ;;;;;;KAOE,YA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Cb,cAAY,iBAAA,uBAAA,OAAA,aAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"topicStore-Ct7IFNtY.js","names":["bindActionByInstance"],"sources":["../src/dashboard/messageBus/topics.ts","../src/dashboard/messageBus/bus.ts","../src/dashboard/messageBus/store.ts","../src/dashboard/messageBus/topicStore.ts"],"sourcesContent":["import {type CurrentUser} from '@sanity/types'\n\nimport {type Application, type ApplicationInclude} from '../../applications/applications'\nimport {type OrganizationBase} from '../../organization/organization'\n\n/**\n * Identifies a module federation expose and the manifest that serves it.\n * @public\n */\nexport interface RemoteModuleRef {\n readonly entry: string\n readonly moduleId: string\n readonly version: string\n}\n\n/**\n * Application types that can receive configuration modules.\n *\n * The dashboard supplies this value over the message bus, so any string is accepted; known\n * types are listed for autocomplete. `& {}` keeps the literal from collapsing into `string`.\n * @public\n */\nexport type ApplicationConfigAppType = 'media-library' | (string & {})\n\n/**\n * Identifies a configuration module for an application or application type.\n * @public\n */\nexport interface ApplicationConfig extends RemoteModuleRef {\n readonly appId?: Application['id']\n readonly appType: ApplicationConfigAppType\n}\n\n/**\n * Declares a topic that stores and replays its current value.\n * @public\n */\nexport type StateTopicDef<T> = {kind: 'state'; value: T}\n\n/**\n * Declares a topic that delivers events and an optional reply.\n * @public\n */\nexport type EventTopicDef<P, R = never> = {\n kind: 'event'\n payload: P\n reply?: R\n}\n\n/**\n * Represents a successful topic value or a failed topic operation.\n * @public\n */\nexport type TopicResult<T> = {ok: true; value: T} | {ok: false}\n\n/**\n * Identifies a dashboard application and a route within it.\n * @public\n */\nexport type NavigationTarget = {\n /** The application ID, or `null` for dashboard-level routes. */\n appId: Application['id'] | null\n /** The route path, including its query string and fragment. */\n path: string\n}\n\n/**\n * Describes the current dashboard location and an active navigation.\n * @public\n */\nexport type NavigationLocation = NavigationTarget & {\n /** The active navigation, or `null` when navigation is idle. */\n transition: {\n /** Whether the navigation pushes or replaces browser history. */\n navigationType: 'push' | 'replace'\n /** The requested destination. */\n to: NavigationTarget\n } | null\n}\n\n/**\n * Declares the topics provided by the dashboard.\n * @public\n */\nexport interface DashboardTopics {\n /** The available application configuration modules. */\n 'applications.config': StateTopicDef<ApplicationConfig[] | null>\n /** The foreground application ID, or `null` on dashboard-level routes. */\n 'applications.foreground': StateTopicDef<Application['id'] | null>\n /** The dashboard applications available to the current user. */\n 'applications.list': StateTopicDef<TopicResult<Application<ApplicationInclude>[]> | null>\n /**\n * The session token for the reading connection, or `null` while signed out. The host\n * writes it to each connection separately, so one application never sees another's token.\n */\n 'auth.token': StateTopicDef<string | null>\n /** Requests a dashboard session token. */\n 'auth.token.refresh': EventTopicDef<void, string>\n /** The current dashboard location and active navigation. */\n 'navigation.location': StateTopicDef<NavigationLocation | null>\n /**\n * Requests navigation and replies when the location commits.\n *\n * `ok: false` reasons:\n * - `not-navigable`: the URL cannot be handled by a dashboard application\n * - `interrupted`: another navigation superseded the request\n * - `failed`: the router rejected or did not commit the request\n */\n 'navigation.location.update': EventTopicDef<\n {\n url: string\n history?: 'push' | 'replace'\n },\n {ok: true} | {ok: false; reason: 'not-navigable' | 'interrupted' | 'failed'}\n >\n /** The current organization, or `null` without an active organization. */\n 'organizations.current': StateTopicDef<Pick<OrganizationBase, 'id' | 'name' | 'slug'> | null>\n /** The open panel, its application, display mode, and optional width in pixels. */\n 'panels.mode': StateTopicDef<TopicResult<\n | {appId: string; name: string; mode: 'aside'; size?: number}\n | {appId: string; name: string; mode: 'full'}\n | null\n > | null>\n /** Opens, updates, resizes, or closes an application's panel. */\n 'panels.mode.set': EventTopicDef<\n {name: string; mode: 'aside' | 'full'} | {name: string; size: number} | null\n >\n /** The resolved dashboard color scheme. */\n 'preferences.color-scheme': StateTopicDef<'light' | 'dark'>\n /** Whether the dashboard dock is pinned open. */\n 'preferences.dock-locked': StateTopicDef<boolean>\n /** The signed-in user, or `null` while signed out. */\n 'users.current': StateTopicDef<Pick<CurrentUser, 'id' | 'name' | 'email' | 'profileImage'> | null>\n}\n\n/**\n * Declares every topic available through the message bus.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Declaration merging extends the SDK manifest.\nexport interface Topics extends DashboardTopics {}\n\n/**\n * Every declared topic name.\n * @public\n */\nexport type TopicName = keyof Topics\n\ntype StateTopicsOf<T> = {\n [K in keyof T]: T[K] extends {kind: 'state'} ? K : never\n}[keyof T]\n\n/**\n * Names of all declared state topics.\n * @public\n */\nexport type StateTopic = StateTopicsOf<Topics>\n\ntype TopicOwnership = {readonly type: 'same_app'} | {readonly type: 'any_app'}\n\n// State is only ever written by the host, one connection at a time, so it carries no ownership.\ntype TopicManifestEntry<T> = T extends {kind: 'state'; value: infer V}\n ? {readonly kind: 'state'; readonly seed: V | undefined}\n : {readonly kind: 'event'; readonly ownership: TopicOwnership}\n\n// The value a connection's copy of the topic starts with; `undefined` means unpublished.\nconst stateTopic = <const V>(seed: V) => ({kind: 'state', seed}) as const\n\n// `same_app` restricts responding to the application that installed the bus.\nconst dashboardEvent = {kind: 'event', ownership: {type: 'same_app'}} as const\n\n/**\n * Defines the runtime kind, ownership, and initial value of dashboard topics.\n * @internal\n */\nexport const DASHBOARD_TOPIC_MANIFEST: {\n readonly [K in keyof DashboardTopics]: TopicManifestEntry<DashboardTopics[K]>\n} = {\n 'applications.config': stateTopic(undefined),\n 'applications.foreground': stateTopic(undefined),\n 'applications.list': stateTopic(undefined),\n 'auth.token': stateTopic(undefined),\n 'auth.token.refresh': dashboardEvent,\n 'navigation.location': stateTopic(undefined),\n 'navigation.location.update': dashboardEvent,\n 'organizations.current': stateTopic(undefined),\n 'panels.mode': stateTopic({ok: true, value: null}),\n 'panels.mode.set': dashboardEvent,\n 'preferences.color-scheme': stateTopic(undefined),\n 'preferences.dock-locked': stateTopic(undefined),\n 'users.current': stateTopic(undefined),\n}\n\n/**\n * Defines the runtime manifest accepted from any message bus version.\n * @internal\n */\nexport type TopicManifest = Readonly<\n Record<\n string,\n | {readonly kind: 'state'; readonly seed: unknown}\n | {readonly kind: 'event'; readonly ownership: TopicOwnership}\n >\n>\n\n/**\n * Names of all declared event topics.\n * @public\n */\nexport type EventTopic = {\n [K in TopicName]: Topics[K] extends {kind: 'event'} ? K : never\n}[TopicName]\n\n/**\n * The value type of a state topic.\n * @public\n */\nexport type ValueOf<K extends StateTopic> = Topics[K] extends StateTopicDef<infer T> ? T : never\n\n/**\n * The payload type of an event topic.\n * @public\n */\nexport type PayloadOf<K extends EventTopic> =\n Topics[K] extends EventTopicDef<infer P, infer _R> ? P : never\n\n/**\n * The reply type of an event topic (`never` if it declares none).\n * @public\n */\nexport type ReplyOf<K extends EventTopic> =\n Topics[K] extends EventTopicDef<infer _P, infer R> ? R : never\n\n/**\n * Converts a topic value between 2 adjacent versions.\n * @internal\n */\nexport interface TopicMigration {\n /** The older version. */\n readonly from: number\n /** The newer version. */\n readonly to: number\n /** Converts an older state value or event payload to the newer version. */\n up(older: unknown): unknown\n /** Converts a newer state value or event payload to the older version. */\n down(newer: unknown): unknown\n /** Converts event replies between these versions. */\n readonly reply?: {\n /** Converts an older reply to the newer version. */\n up(older: unknown): unknown\n /** Converts a newer reply to the older version. */\n down(newer: unknown): unknown\n }\n}\n\n/**\n * Defines the bundled migration chain for each topic.\n * @internal\n */\nexport const topicMigrations: Partial<Record<TopicName, readonly TopicMigration[]>> = {}\n","/* eslint-disable no-console -- The bus can initialize before the SDK logger exists. */\nimport {\n BehaviorSubject,\n concat,\n defer,\n filter,\n firstValueFrom,\n from,\n map,\n type Observable,\n ReplaySubject,\n Subject,\n type Subscription,\n takeUntil,\n} from 'rxjs'\n\nimport {type Application} from '../../applications/applications'\nimport {\n DASHBOARD_TOPIC_MANIFEST,\n type EventTopic,\n type PayloadOf,\n type ReplyOf,\n type StateTopic,\n type TopicManifest,\n type TopicMigration,\n topicMigrations,\n type TopicName,\n type ValueOf,\n} from './topics'\n\n/**\n * A message bus protocol error code.\n * @public\n */\nexport type MessageBusErrorCode =\n | 'NO_RESPONDER'\n | 'TIMEOUT'\n | 'ABORTED'\n | 'HANDLER_THREW'\n | 'PROTOCOL_MISMATCH'\n | 'OWNERSHIP_MISMATCH'\n | 'MISSING_APP_ID'\n\n/**\n * An error raised by the message bus protocol.\n * @public\n */\nexport class MessageBusError extends Error {\n /** The machine-readable protocol error code. */\n readonly code: MessageBusErrorCode\n\n /** Creates a message bus protocol error. */\n constructor(code: MessageBusErrorCode, message?: string, options?: {cause?: unknown}) {\n super(message ?? code, options)\n this.name = 'MessageBusError'\n this.code = code\n }\n}\n\n/**\n * Metadata that travels with each message bus event.\n * @public\n */\nexport interface MessageBusMeta {\n /** The application that produced the message. */\n appId: Application['id']\n /**\n * The federation module id of the connection that sent the message (e.g.\n * `favorites/views/list/panel`). Absent from older copies and when the host\n * supplied none, so readers normalise with `message.meta.moduleId ?? message.meta.appId`.\n */\n moduleId?: string\n /** The Unix timestamp in milliseconds when the message was produced. */\n timestamp: number\n}\n\n/**\n * A message delivered to an event topic responder.\n * @public\n */\nexport interface MessageBusMessage<T, R = never> {\n /** The topic that carries the message. */\n type: TopicName\n /** The event payload. */\n payload: T\n /** The message provenance. */\n meta: MessageBusMeta\n /** Replies to an awaiting sender. */\n reply(value: R): void\n /** Aborts when the sender stops waiting for a reply. */\n readonly signal: AbortSignal\n}\n\n/**\n * An observable state topic with access to its current and first values.\n * @public\n */\nexport interface MessageBusStateSource<T> extends Observable<T> {\n /** Returns the current value, or `undefined` before the first value is published. */\n getCurrent(): T | undefined\n /** Resolves with the first published value. */\n readonly firstValue: Promise<T>\n}\n\n/**\n * Options for aborting a message bus operation.\n * @public\n */\nexport interface MessageBusAbortOptions {\n /** Aborts the operation when signaled. */\n signal?: AbortSignal\n}\n\n/**\n * Options for reading a state topic.\n * @public\n */\nexport interface MessageBusQueryOptions extends MessageBusAbortOptions {\n /** Wait timeout in milliseconds. Defaults to 5 seconds; `null` disables it. */\n timeout?: number | null\n}\n\n/**\n * Options for emitting an event topic.\n * @public\n */\nexport interface MessageBusEmitOptions extends MessageBusAbortOptions {\n /** Reply timeout in milliseconds. Defaults to 5 seconds; `null` disables it. */\n timeout?: number | null\n}\n\n/**\n * A lazily awaited event reply.\n * @public\n */\nexport interface MessageBusEmitResult<R> extends PromiseLike<R> {\n /** Handles a rejected event reply. */\n catch<T = never>(onRejected?: (reason: unknown) => T | PromiseLike<T>): Promise<R | T>\n /** Runs after the event reply settles. */\n finally(onFinally?: () => void): Promise<R>\n}\n\n/**\n * Sends events and reads typed state and event topics.\n *\n * @remarks\n * State topics are written by the host to each connection separately through\n * {@link MessageBusClient.emit}; a connection only ever reads its own values.\n * @public\n */\nexport interface MessageBus {\n /** Emits an event topic and provides its reply when awaited. */\n emit<K extends EventTopic>(\n type: K,\n ...rest: PayloadOf<K> extends void\n ? [payload?: void, options?: MessageBusEmitOptions]\n : [payload: PayloadOf<K>, options?: MessageBusEmitOptions]\n ): MessageBusEmitResult<ReplyOf<K>>\n /** Reads the current or next value of a state topic. */\n query<K extends StateTopic>(type: K, options?: MessageBusQueryOptions): Promise<ValueOf<K>>\n /** Runs a responder for each event until its signal aborts. */\n subscribe<K extends EventTopic>(\n type: K,\n handler: (message: MessageBusMessage<PayloadOf<K>, ReplyOf<K>>) => void,\n options?: MessageBusAbortOptions,\n ): void\n /** Runs a handler for each state value until its signal aborts. */\n subscribe<K extends StateTopic>(\n type: K,\n handler: (value: ValueOf<K>) => void,\n options?: MessageBusAbortOptions,\n ): void\n /** Returns a state topic as a `MessageBusStateSource`. */\n subscribe<K extends StateTopic>(type: K): MessageBusStateSource<ValueOf<K>>\n /** Returns an event topic as an observable of its payloads. */\n subscribe<K extends EventTopic>(type: K): Observable<PayloadOf<K>>\n}\n\n/**\n * A message bus connection that can be torn down independently of its siblings.\n * @public\n */\nexport interface MessageBusConnection extends MessageBus {\n /**\n * Tears down this connection: pending requests reject `ABORTED`, subscriptions\n * complete, and later `emit`, `query`, and `subscribe` calls fail with `ABORTED`.\n * Siblings and the shared bus are untouched.\n */\n disconnect(): void\n}\n\n/**\n * The host's handle to one connection: who it is, when it closes, and where to write its state.\n * @public\n */\nexport interface MessageBusClient {\n /** The application the connection belongs to. */\n readonly appId: Application['id']\n /** The federation module id of the connection. Equals `appId` when the host supplied none. */\n readonly moduleId: string\n /** Aborts when the connection disconnects. Drop per-client state here. */\n readonly closed: AbortSignal\n /** Writes a state value to this connection only. Ignored once the connection has closed. */\n emit<K extends StateTopic>(type: K, value: ValueOf<K>): void\n}\n\n/**\n * The host's connection to the bus.\n *\n * @remarks\n * State reaches an application only through {@link MessageBusClient.emit}. There is no\n * broadcast: sending the same value to everyone is a loop over `connections`, and giving a\n * new connection the current values is done when it appears there, as an SSE server writes\n * a snapshot to each new client.\n * @public\n */\nexport interface MessageBusHost extends MessageBusConnection {\n /**\n * Every open connection other than this one first, then each new one as it joins. The same\n * {@link MessageBusClient} object is handed out for a connection across subscriptions, so it\n * can be kept in a `Set`. A connection stays listed until it calls `disconnect()`; the SDK\n * does that when the owning `SanityInstance` is disposed.\n */\n readonly connections: Observable<MessageBusClient>\n}\n\nconst MESSAGE_BUS_KEY = Symbol.for('sanity.os.bus')\nconst MESSAGE_BUS_PROTOCOL_KEY = Symbol.for('sanity.os.protocol')\nconst MESSAGE_BUS_REGISTRY_KEY = Symbol.for('sanity.os.registry')\nconst MESSAGE_BUS_PENDING_REPLY_KEY = Symbol.for('sanity.os.request')\n\nconst MESSAGE_BUS_PROTOCOL = 1\n\nconst DEFAULT_TIMEOUT_MS = 5000\n\n// Distinguishes an unpublished topic from a published `undefined` value.\nconst NO_VALUE = Symbol.for('sanity.os.no-value')\n\ntype ReplyOutcome =\n | {readonly ok: true; readonly value: unknown}\n | {readonly ok: false; readonly error: unknown}\n\n// Defers Promise creation until the reply is awaited to preserve fire-and-forget emission.\ninterface PendingReply {\n readonly responderAbort: AbortController\n readonly responderSignal: AbortSignal\n settled: boolean\n outcomeBeforeAwait?: ReplyOutcome\n settlePromise?: (outcome: ReplyOutcome) => void\n replyPromise?: Promise<unknown>\n}\n\n// One connection: its identity, its own copy of every state topic, and its lifetime.\ninterface ConnectionRecord {\n readonly appId: string\n readonly moduleId: string\n readonly stateSubjects: Map<string, BehaviorSubject<unknown>>\n readonly abort: AbortController\n}\n\ninterface MessageBusRegistry {\n readonly appId: string\n readonly topics: Map<string, TopicManifest[string]>\n readonly connections: Set<ConnectionRecord>\n readonly connected$: Subject<ConnectionRecord>\n readonly eventSubjects: Map<string, Subject<MessageBusMessage<unknown, unknown>>>\n readonly responderCounts: Map<string, number>\n readonly migrations: ReadonlyMap<string, readonly TopicMigration[]>\n resetAbort: AbortController\n generation: number\n}\n\ntype InternalMessageBus = MessageBus & {\n [MESSAGE_BUS_REGISTRY_KEY]: MessageBusRegistry\n [MESSAGE_BUS_PROTOCOL_KEY]: number\n}\n\n// A connection's box for a state topic, created on first use from the topic's manifest seed.\nfunction resolveStateSubject(\n registry: MessageBusRegistry,\n connection: ConnectionRecord,\n type: string,\n): BehaviorSubject<unknown> {\n // Callers gate on the connection's lifetime; this keeps a slipped call from recreating a\n // box on a closed connection that nothing would ever complete.\n if (connection.abort.signal.aborted) throw new MessageBusError('ABORTED')\n let subject = connection.stateSubjects.get(type)\n if (!subject) {\n const topic = registry.topics.get(type)\n if (!topic) {\n console.warn(`[sanity-sdk:message-bus] state topic \"${type}\" is not declared`)\n }\n const seed = topic?.kind === 'state' ? topic.seed : undefined\n subject = new BehaviorSubject<unknown>(seed === undefined ? NO_VALUE : seed)\n connection.stateSubjects.set(type, subject)\n }\n return subject\n}\n\nfunction toStateSource(\n values: Observable<unknown>,\n getCurrent: () => unknown,\n): MessageBusStateSource<unknown> {\n const source = values as MessageBusStateSource<unknown>\n source.getCurrent = getCurrent\n // Unread sources must not create promises that reject when reset completes them.\n let firstValue: Promise<unknown> | undefined\n Object.defineProperty(source, 'firstValue', {\n get: () => (firstValue ??= firstValueFrom(values)),\n })\n return source\n}\n\nfunction assertCompatibleTopicManifest(\n registry: MessageBusRegistry,\n manifest: TopicManifest,\n): void {\n for (const [type, entry] of Object.entries(manifest)) {\n const existing = registry.topics.get(type)\n if (existing && existing.kind !== entry.kind) {\n throw new MessageBusError(\n 'PROTOCOL_MISMATCH',\n `topic \"${type}\" is declared \"${entry.kind}\" but the installed bus knows it as \"${existing.kind}\"`,\n )\n }\n if (\n existing?.kind === 'event' &&\n entry.kind === 'event' &&\n existing.ownership.type !== entry.ownership.type\n ) {\n throw new MessageBusError('OWNERSHIP_MISMATCH', `topic \"${type}\" has conflicting ownership`)\n }\n }\n}\n\nfunction mergeTopicManifest(registry: MessageBusRegistry, manifest: TopicManifest): void {\n assertCompatibleTopicManifest(registry, manifest)\n for (const [type, entry] of Object.entries(manifest)) registry.topics.set(type, entry)\n}\n\nfunction resolveEventSubject(\n registry: MessageBusRegistry,\n type: string,\n): Subject<MessageBusMessage<unknown, unknown>> {\n let subject = registry.eventSubjects.get(type)\n if (!subject) {\n subject = new Subject<MessageBusMessage<unknown, unknown>>()\n registry.eventSubjects.set(type, subject)\n }\n return subject\n}\n\nfunction settleReply(reply: PendingReply, outcome: ReplyOutcome): void {\n if (reply.settled) return\n reply.settled = true\n if (reply.settlePromise) reply.settlePromise(outcome)\n else reply.outcomeBeforeAwait = outcome\n}\n\nfunction createEventMessage(\n appId: string,\n moduleId: string,\n type: string,\n payload: unknown,\n pendingReply: PendingReply,\n): MessageBusMessage<unknown, unknown> {\n const message: MessageBusMessage<unknown, unknown> & {\n [MESSAGE_BUS_PENDING_REPLY_KEY]?: PendingReply\n } = {\n type: type as TopicName,\n payload,\n meta: {appId, moduleId, timestamp: Date.now()},\n reply: (value) => {\n if (pendingReply.settled) {\n console.warn(\n `[sanity-sdk:message-bus] reply ignored for \"${type}\": no waiting caller or already replied`,\n )\n return\n }\n settleReply(pendingReply, {ok: true, value})\n },\n get signal() {\n return pendingReply.responderSignal\n },\n }\n\n message[MESSAGE_BUS_PENDING_REPLY_KEY] = pendingReply\n return message\n}\n\nfunction createReplyPromise(\n pendingReply: PendingReply,\n options: MessageBusEmitOptions & {hadResponderAtEmission: boolean},\n): Promise<unknown> {\n return new Promise<unknown>((resolve, reject) => {\n const settlePromise = (outcome: ReplyOutcome) =>\n outcome.ok ? resolve(outcome.value) : reject(outcome.error)\n\n if (pendingReply.outcomeBeforeAwait) {\n pendingReply.responderAbort.abort()\n settlePromise(pendingReply.outcomeBeforeAwait)\n return\n }\n if (!options.hadResponderAtEmission) {\n reject(new MessageBusError('NO_RESPONDER'))\n return\n }\n\n const timeoutMs = options.timeout === undefined ? DEFAULT_TIMEOUT_MS : options.timeout\n let timer: ReturnType<typeof setTimeout> | undefined\n const onAbort = () =>\n settleReply(pendingReply, {ok: false, error: new MessageBusError('ABORTED')})\n\n pendingReply.settlePromise = (outcome) => {\n if (timer !== undefined) clearTimeout(timer)\n options.signal?.removeEventListener('abort', onAbort)\n pendingReply.responderAbort.abort()\n settlePromise(outcome)\n }\n\n if (timeoutMs !== null) {\n timer = setTimeout(\n () => settleReply(pendingReply, {ok: false, error: new MessageBusError('TIMEOUT')}),\n timeoutMs,\n )\n }\n if (options.signal) {\n if (options.signal.aborted) onAbort()\n else options.signal.addEventListener('abort', onAbort, {once: true})\n }\n })\n}\n\nfunction createLazyReply<R>(awaitReply: () => Promise<R>): MessageBusEmitResult<R> {\n return {\n // oxlint-disable-next-line unicorn/no-thenable -- awaiting arms reply failure handling; fire-and-forget does not.\n then: (onFulfilled, onRejected) => awaitReply().then(onFulfilled, onRejected),\n catch: (onRejected) => awaitReply().then(undefined, onRejected),\n finally: (onFinally) => awaitReply().finally(onFinally),\n }\n}\n\nfunction emitEvent(\n registry: MessageBusRegistry,\n type: string,\n payload: unknown,\n options: MessageBusEmitOptions | undefined,\n appId: string,\n moduleId: string,\n): MessageBusEmitResult<unknown> {\n const hadResponderAtEmission = (registry.responderCounts.get(type) ?? 0) > 0\n const responderAbort = new AbortController()\n const pendingReply: PendingReply = {\n responderAbort,\n responderSignal: scopeSignal(options?.signal, responderAbort.signal),\n settled: false,\n }\n\n resolveEventSubject(registry, type).next(\n createEventMessage(appId, moduleId, type, payload, pendingReply),\n )\n\n const awaitReply = () =>\n (pendingReply.replyPromise ??= createReplyPromise(pendingReply, {\n ...options,\n hadResponderAtEmission,\n }))\n return createLazyReply(awaitReply)\n}\n\nconst isStateTopic = (registry: MessageBusRegistry, type: string): boolean =>\n registry.topics.get(type)?.kind === 'state'\n\nconst canRespond = (\n registry: MessageBusRegistry,\n ownership: {readonly type: 'same_app' | 'any_app'},\n appId: string,\n): boolean => ownership.type === 'any_app' || appId === registry.appId\n\nfunction emit(\n registry: MessageBusRegistry,\n type: string,\n payload: unknown,\n options: MessageBusEmitOptions | undefined,\n appId: string,\n moduleId: string,\n connectionSignal: AbortSignal,\n): MessageBusEmitResult<unknown> {\n if (isStateTopic(registry, type)) {\n throw new MessageBusError(\n 'OWNERSHIP_MISMATCH',\n `Cannot emit state topic \"${type}\" from app \"${appId}\". The host writes state to each connection through its client handle. Read it with query() or subscribe().`,\n )\n }\n return emitEvent(\n registry,\n type,\n payload,\n {\n ...options,\n signal: scopeSignal(options?.signal, registry.resetAbort.signal, connectionSignal),\n },\n appId,\n moduleId,\n )\n}\n\nfunction emitState(\n registry: MessageBusRegistry,\n connection: ConnectionRecord,\n type: string,\n value: unknown,\n): void {\n const subject = resolveStateSubject(registry, connection, type)\n if (!Object.is(subject.getValue(), value)) subject.next(value)\n}\n\nfunction query(\n source: MessageBusStateSource<unknown>,\n type: string,\n options: MessageBusQueryOptions | undefined,\n connectionSignal: AbortSignal,\n resetSignal: AbortSignal,\n): Promise<unknown> {\n const current = source.getCurrent()\n if (current !== undefined) return Promise.resolve(current)\n\n const signal = scopeSignal(options?.signal, resetSignal, connectionSignal)\n if (signal.aborted) return Promise.reject(new MessageBusError('ABORTED'))\n const timeoutMs = options?.timeout === undefined ? DEFAULT_TIMEOUT_MS : options.timeout\n return new Promise((resolve, reject) => {\n const timer =\n timeoutMs === null\n ? undefined\n : setTimeout(\n () => reject(new MessageBusError('TIMEOUT', `query(\"${type}\") timed out`)),\n timeoutMs,\n )\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n }\n const onAbort = () => {\n clear()\n reject(new MessageBusError('ABORTED'))\n }\n signal?.addEventListener('abort', onAbort, {once: true})\n void source.firstValue.then(\n (value) => {\n clear()\n signal?.removeEventListener('abort', onAbort)\n resolve(value)\n },\n (error) => {\n clear()\n signal?.removeEventListener('abort', onAbort)\n reject(error)\n },\n )\n })\n}\n\nfunction unsubscribeOnAbort(subscription: Subscription, signal: AbortSignal | undefined): void {\n if (!signal) return\n if (signal.aborted) {\n subscription.unsubscribe()\n return\n }\n signal.addEventListener('abort', () => subscription.unsubscribe(), {\n once: true,\n })\n}\n\nfunction scopeSignal(signal: AbortSignal | undefined, ...lifecycles: AbortSignal[]): AbortSignal {\n return signal ? AbortSignal.any([signal, ...lifecycles]) : AbortSignal.any(lifecycles)\n}\n\nfunction invokeResponder(\n handler: (message: MessageBusMessage<unknown, unknown>) => unknown,\n message: MessageBusMessage<unknown, unknown> & {\n [MESSAGE_BUS_PENDING_REPLY_KEY]?: PendingReply\n },\n): void {\n const pendingReply = message[MESSAGE_BUS_PENDING_REPLY_KEY]\n const fail = (error: unknown) => {\n if (pendingReply) {\n settleReply(pendingReply, {\n ok: false,\n error: new MessageBusError('HANDLER_THREW', undefined, {\n cause: error,\n }),\n })\n }\n }\n try {\n const result = handler(message)\n if (result instanceof Promise) result.catch(fail)\n } catch (error) {\n fail(error)\n }\n}\n\nfunction respond(\n registry: MessageBusRegistry,\n type: string,\n handler: (message: MessageBusMessage<unknown, unknown>) => unknown,\n options: MessageBusAbortOptions | undefined,\n appId: string,\n connectionSignal: AbortSignal,\n): void {\n const topic = registry.topics.get(type)\n if (topic?.kind === 'event' && !canRespond(registry, topic.ownership, appId)) {\n throw new MessageBusError(\n 'OWNERSHIP_MISMATCH',\n `Cannot register a handler for event topic \"${type}\" from app \"${appId}\". Only the app that owns this topic can respond to it. Other apps can send it with emit().`,\n )\n }\n\n registry.responderCounts.set(type, (registry.responderCounts.get(type) ?? 0) + 1)\n const subscription = resolveEventSubject(registry, type).subscribe((message) =>\n invokeResponder(handler, message),\n )\n subscription.add(() => {\n const count = registry.responderCounts.get(type) ?? 0\n if (count > 0) registry.responderCounts.set(type, count - 1)\n })\n unsubscribeOnAbort(\n subscription,\n scopeSignal(options?.signal, registry.resetAbort.signal, connectionSignal),\n )\n}\n\nconst bundledMigrations = () => new Map(Object.entries(topicMigrations))\n\n/**\n * Creates an isolated message bus without installing it globally and returns the host's\n * connection to it.\n * @internal\n */\nexport function createIsolatedMessageBus(\n appId: string,\n config: {\n migrations?: ReadonlyMap<string, readonly TopicMigration[]>\n } = {},\n): MessageBusHost {\n if (!appId) throwMissingAppId()\n\n const registry: MessageBusRegistry = {\n appId,\n topics: new Map(),\n connections: new Set(),\n connected$: new Subject(),\n eventSubjects: new Map(),\n responderCounts: new Map(),\n migrations: config.migrations ?? bundledMigrations(),\n resetAbort: new AbortController(),\n generation: 0,\n }\n\n mergeTopicManifest(registry, DASHBOARD_TOPIC_MANIFEST)\n\n return createConnection(registry, {appId, migrations: config.migrations}) as MessageBusHost\n}\n\ntype TopicVersionAdapter = {\n toInstalled: (type: string, value: unknown) => unknown\n toApplication: (type: string, value: unknown) => unknown\n}\n\ntype TopicCompatibility = {\n toInstalledEmission: TopicVersionAdapter['toInstalled']\n toApplicationStateValue: TopicVersionAdapter['toApplication']\n toApplicationEventPayload: TopicVersionAdapter['toApplication']\n toInstalledEventReply: TopicVersionAdapter['toInstalled']\n toApplicationEventReply: TopicVersionAdapter['toApplication']\n}\n\ntype TopicMigrationTransform = Pick<TopicMigration, 'up' | 'down'>\n\nconst identityMigration: TopicMigrationTransform = {\n up: (value) => value,\n down: (value) => value,\n}\n\nfunction effectiveTopicVersions(\n migrations: ReadonlyMap<string, readonly TopicMigration[]>,\n): Map<string, number> {\n const versions = new Map<string, number>()\n for (const [topic, steps] of migrations) {\n let version = 1\n for (const step of steps) if (step.to > version) version = step.to\n versions.set(topic, version)\n }\n return versions\n}\n\nfunction migrationTransformAt(\n steps: readonly TopicMigration[] | undefined,\n version: number,\n select: (step: TopicMigration) => TopicMigrationTransform | undefined,\n): TopicMigrationTransform {\n const step = steps?.find((candidate) => candidate.from === version)\n return (step ? select(step) : undefined) ?? identityMigration\n}\n\nfunction migrateVersionedValue(\n steps: readonly TopicMigration[] | undefined,\n value: unknown,\n from: number,\n to: number,\n select: (step: TopicMigration) => TopicMigrationTransform | undefined,\n): unknown {\n if (from === to) return value\n\n let current = value\n if (from < to) {\n for (let version = from; version < to; version++) {\n current = migrationTransformAt(steps, version, select).up(current)\n }\n } else {\n for (let version = from; version > to; version--) {\n current = migrationTransformAt(steps, version - 1, select).down(current)\n }\n }\n return current\n}\n\nfunction createTopicCompatibility(\n installedMigrations: ReadonlyMap<string, readonly TopicMigration[]>,\n applicationMigrations: ReadonlyMap<string, readonly TopicMigration[]>,\n): TopicCompatibility {\n const installedVersions = effectiveTopicVersions(installedMigrations)\n const applicationVersions = effectiveTopicVersions(applicationMigrations)\n const applicationVersion = (type: string) => applicationVersions.get(type) ?? 1\n const installedVersion = (type: string) => installedVersions.get(type) ?? 1\n const migrationChainFor = (type: string) =>\n (applicationVersion(type) > installedVersion(type)\n ? applicationMigrations\n : installedMigrations\n ).get(type)\n const createVersionAdapter = (\n select: (step: TopicMigration) => TopicMigrationTransform | undefined,\n ): TopicVersionAdapter => ({\n toInstalled: (type, value) =>\n migrateVersionedValue(\n migrationChainFor(type),\n value,\n applicationVersion(type),\n installedVersion(type),\n select,\n ),\n toApplication: (type, value) =>\n migrateVersionedValue(\n migrationChainFor(type),\n value,\n installedVersion(type),\n applicationVersion(type),\n select,\n ),\n })\n\n const stateValueAndEventPayload = createVersionAdapter((step) => step)\n const eventReply = createVersionAdapter((step) => step.reply)\n return {\n toInstalledEmission: stateValueAndEventPayload.toInstalled,\n toApplicationStateValue: stateValueAndEventPayload.toApplication,\n toApplicationEventPayload: stateValueAndEventPayload.toApplication,\n toInstalledEventReply: eventReply.toInstalled,\n toApplicationEventReply: eventReply.toApplication,\n }\n}\n\n// Cache projections by input reference to keep state snapshots stable.\nfunction projectCurrent(input: () => unknown, project: (value: unknown) => unknown): () => unknown {\n let lastInput: unknown\n let lastOutput: unknown\n let cached = false\n return () => {\n const current = input()\n if (current === undefined) return undefined\n if (!cached || current !== lastInput) {\n lastInput = current\n lastOutput = project(current)\n cached = true\n }\n return lastOutput\n }\n}\n\n// The connection's view of one of its state boxes, in the connection's topic version.\nfunction createStateSource(\n subject: BehaviorSubject<unknown>,\n project: (value: unknown) => unknown,\n completeOn: Observable<unknown>,\n): MessageBusStateSource<unknown> {\n const getCurrent = () => {\n const current = subject.getValue()\n return current === NO_VALUE ? undefined : current\n }\n return toStateSource(\n subject.pipe(\n filter((value) => value !== NO_VALUE),\n map(project),\n takeUntil(completeOn),\n ),\n projectCurrent(getCurrent, project),\n )\n}\n\nfunction migrateEventMessage(\n message: MessageBusMessage<unknown, unknown>,\n payload: (value: unknown) => unknown,\n reply: (value: unknown) => unknown,\n): MessageBusMessage<unknown, unknown> {\n return {\n type: message.type,\n payload: payload(message.payload),\n meta: message.meta,\n reply: (value) => message.reply(reply(value)),\n get signal() {\n return message.signal\n },\n }\n}\n\nfunction migrateEventReply(\n result: MessageBusEmitResult<unknown>,\n project: (value: unknown) => unknown,\n): MessageBusEmitResult<unknown> {\n let projected: Promise<unknown> | undefined\n return createLazyReply(() => (projected ??= Promise.resolve(result).then(project)))\n}\n\nfunction createRejectedConnection(connectionError: () => unknown): MessageBusConnection {\n const throwConnectionError = (): never => {\n throw connectionError()\n }\n return {\n emit: throwConnectionError,\n // `query` is typed as a Promise, so it must reject rather than throw synchronously.\n query: () => Promise.reject(connectionError()),\n subscribe: throwConnectionError,\n disconnect: () => {},\n } as unknown as MessageBusConnection\n}\n\n/**\n * Options for connecting an application to an isolated message bus.\n * @internal\n */\nexport interface ConnectApplicationToMessageBusOptions {\n /** The application ID stamped on emitted messages. */\n appId: string\n /** The federation module id stamped on emitted messages. Defaults to `appId`. */\n moduleId?: string\n /** The topic migrations supported by the application. */\n migrations?: ReadonlyMap<string, readonly TopicMigration[]>\n}\n\n/**\n * Connects an application to an isolated message bus.\n * @internal\n */\nexport function connectApplicationToMessageBus(\n installedMessageBus: MessageBus,\n config: ConnectApplicationToMessageBusOptions,\n): MessageBusConnection {\n if (!config.appId) throwMissingAppId()\n\n const {appId} = config\n const installedProtocol = (installedMessageBus as Partial<InternalMessageBus>)[\n MESSAGE_BUS_PROTOCOL_KEY\n ]\n if (installedProtocol !== MESSAGE_BUS_PROTOCOL) {\n console.error(\n `[sanity-sdk:message-bus] protocol mismatch for \"${appId}\": installed ${String(installedProtocol)}, this copy speaks ${MESSAGE_BUS_PROTOCOL}`,\n )\n return createRejectedConnection(\n () =>\n new MessageBusError(\n 'PROTOCOL_MISMATCH',\n `installed message bus speaks protocol ${String(installedProtocol)}, this copy speaks ${MESSAGE_BUS_PROTOCOL}`,\n ),\n )\n }\n\n const registry = (installedMessageBus as Partial<InternalMessageBus>)[MESSAGE_BUS_REGISTRY_KEY]\n if (!registry) {\n console.error(`[sanity-sdk:message-bus] incompatible message bus for \"${appId}\"`)\n return createRejectedConnection(\n () =>\n new MessageBusError(\n 'PROTOCOL_MISMATCH',\n 'installed message bus does not expose a compatible registry',\n ),\n )\n }\n\n try {\n mergeTopicManifest(registry, DASHBOARD_TOPIC_MANIFEST)\n } catch (error) {\n console.error(`[sanity-sdk:message-bus] topic manifest conflict for \"${appId}\"`, {error})\n return createRejectedConnection(() => error)\n }\n\n return createConnection(registry, config)\n}\n\n// Hands the host the same client object for a connection across `connections` subscriptions.\nfunction createClient(\n registry: MessageBusRegistry,\n record: ConnectionRecord,\n compatibility: TopicCompatibility,\n): MessageBusClient {\n return {\n appId: record.appId,\n moduleId: record.moduleId,\n closed: record.abort.signal,\n emit: (type: string, value: unknown) => {\n if (record.abort.signal.aborted) {\n console.warn(\n `[sanity-sdk:message-bus] \"${type}\" not written: connection \"${record.moduleId}\" has closed`,\n )\n return\n }\n emitState(registry, record, type, compatibility.toInstalledEmission(type, value))\n },\n } as MessageBusClient\n}\n\n// Open connections other than the host's own first, then each new one; one client object per\n// connection so the host can keep them in a Set. Completes when the host connection disconnects.\nfunction createConnectionsSource(\n registry: MessageBusRegistry,\n self: ConnectionRecord,\n compatibility: TopicCompatibility,\n completeOn: Observable<unknown>,\n): Observable<MessageBusClient> {\n const clients = new WeakMap<ConnectionRecord, MessageBusClient>()\n const clientFor = (record: ConnectionRecord) => {\n let client = clients.get(record)\n if (!client) {\n client = createClient(registry, record, compatibility)\n clients.set(record, client)\n }\n return client\n }\n return defer(() => concat(from([...registry.connections]), registry.connected$)).pipe(\n filter((record) => record !== self),\n map(clientFor),\n takeUntil(completeOn),\n )\n}\n\nfunction createConnection(\n registry: MessageBusRegistry,\n config: ConnectApplicationToMessageBusOptions,\n): MessageBusConnection {\n const {appId} = config\n const moduleId = config.moduleId ?? appId\n // Each connection owns its lifetime; disconnect() aborts it without touching siblings.\n const connectionAbort = new AbortController()\n const connectionSignal = connectionAbort.signal\n // ReplaySubject, not fromEvent: `abort` fires once, so a cold listener attached by a\n // stream subscribed after disconnect() would never see it and never complete. Replaying\n // the notification lets those late subscribers complete immediately.\n const connectionAborted$ = new ReplaySubject<void>(1)\n connectionSignal.addEventListener('abort', () => connectionAborted$.next(), {once: true})\n\n const record: ConnectionRecord = {\n appId,\n moduleId,\n stateSubjects: new Map(),\n abort: connectionAbort,\n }\n\n const compatibility = createTopicCompatibility(\n registry.migrations,\n config.migrations ?? bundledMigrations(),\n )\n const isState = (type: string) => isStateTopic(registry, type)\n\n // Reuse topic streams because React external-store snapshots require stable references.\n const applicationStreams = new Map<string, MessageBusStateSource<unknown> | Observable<unknown>>()\n let streamGeneration = registry.generation\n const cachedStream = <T extends MessageBusStateSource<unknown> | Observable<unknown>>(\n type: string,\n create: () => T,\n ): T => {\n if (streamGeneration !== registry.generation) {\n applicationStreams.clear()\n streamGeneration = registry.generation\n }\n let stream = applicationStreams.get(type)\n if (!stream) {\n stream = create()\n applicationStreams.set(type, stream)\n }\n return stream as T\n }\n const stateSource = (type: string) =>\n cachedStream(type, () =>\n createStateSource(\n resolveStateSubject(registry, record, type),\n (value) => compatibility.toApplicationStateValue(type, value),\n connectionAborted$,\n ),\n )\n const eventStream = (type: string) =>\n cachedStream(type, () =>\n resolveEventSubject(registry, type).pipe(\n map((message) => compatibility.toApplicationEventPayload(type, message.payload)),\n takeUntil(connectionAborted$),\n ),\n )\n\n // A disconnected connection must not reach siblings, so its operations fail before touching\n // the shared registry rather than only tearing down pending requests and subscriptions.\n const throwIfDisconnected = () => {\n if (connectionSignal.aborted) throw new MessageBusError('ABORTED')\n }\n\n const connection = {\n emit: (type: string, payload: unknown, options?: MessageBusEmitOptions) => {\n throwIfDisconnected()\n return migrateEventReply(\n emit(\n registry,\n type,\n compatibility.toInstalledEmission(type, payload),\n options,\n appId,\n moduleId,\n connectionSignal,\n ),\n (value) => compatibility.toApplicationEventReply(type, value),\n )\n },\n query: (type: string, options?: MessageBusQueryOptions) => {\n if (connectionSignal.aborted) return Promise.reject(new MessageBusError('ABORTED'))\n return query(stateSource(type), type, options, connectionSignal, registry.resetAbort.signal)\n },\n subscribe: (\n type: string,\n handler?: (arg: never) => void,\n options?: MessageBusAbortOptions,\n ): MessageBusStateSource<unknown> | Observable<unknown> | undefined => {\n throwIfDisconnected()\n if (isState(type)) {\n const source = stateSource(type)\n if (!handler) return source\n unsubscribeOnAbort(\n source.subscribe(handler as (value: unknown) => void),\n scopeSignal(options?.signal, registry.resetAbort.signal, connectionSignal),\n )\n return undefined\n }\n if (!handler) return eventStream(type)\n respond(\n registry,\n type,\n (message) =>\n (handler as (message: MessageBusMessage<unknown, unknown>) => void)(\n migrateEventMessage(\n message,\n (value) => compatibility.toApplicationEventPayload(type, value),\n (value) => compatibility.toInstalledEventReply(type, value),\n ),\n ),\n options,\n appId,\n connectionSignal,\n )\n return undefined\n },\n disconnect: () => {\n if (connectionSignal.aborted) return\n connectionAbort.abort()\n for (const subject of record.stateSubjects.values()) subject.complete()\n record.stateSubjects.clear()\n registry.connections.delete(record)\n },\n }\n\n if (appId === registry.appId) {\n Object.assign(connection, {\n connections: createConnectionsSource(registry, record, compatibility, connectionAborted$),\n })\n }\n\n const instance = connection as unknown as InternalMessageBus\n instance[MESSAGE_BUS_REGISTRY_KEY] = registry\n instance[MESSAGE_BUS_PROTOCOL_KEY] = MESSAGE_BUS_PROTOCOL\n\n // Announce last: a host subscriber may write to the new client synchronously.\n registry.connections.add(record)\n registry.connected$.next(record)\n return instance as unknown as MessageBusConnection\n}\n\nfunction reset(registry: MessageBusRegistry): void {\n registry.resetAbort.abort()\n for (const connection of registry.connections) {\n for (const subject of connection.stateSubjects.values()) subject.complete()\n connection.stateSubjects.clear()\n }\n for (const subject of registry.eventSubjects.values()) subject.complete()\n\n registry.topics.clear()\n registry.eventSubjects.clear()\n registry.responderCounts.clear()\n registry.resetAbort = new AbortController()\n registry.generation += 1\n mergeTopicManifest(registry, DASHBOARD_TOPIC_MANIFEST)\n}\n\ndeclare const __SANITY_APP_ID__: string | undefined\n\nfunction throwMissingAppId(): never {\n throw new MessageBusError(\n 'MISSING_APP_ID',\n 'Cannot initialize the message bus without an app ID. Build the application with the Sanity CLI or pass an app ID when connecting.',\n )\n}\n\nconst resolveAppId = (appId?: string): string | undefined =>\n appId ?? (typeof __SANITY_APP_ID__ === 'string' ? __SANITY_APP_ID__ : undefined)\n\nfunction getInstalledMessageBus(): MessageBus | undefined {\n const bus = (globalThis as {[MESSAGE_BUS_KEY]?: unknown})[MESSAGE_BUS_KEY]\n return typeof bus === 'object' && bus !== null && MESSAGE_BUS_REGISTRY_KEY in bus\n ? (bus as unknown as MessageBus)\n : undefined\n}\n\n/**\n * Returns whether a message bus registry is installed.\n * @internal\n */\nexport function isMessageBusInstalled(): boolean {\n return getInstalledMessageBus() !== undefined\n}\n\n/**\n * Options for connecting to an installed message bus.\n * @public\n */\nexport interface ConnectMessageBusOptions {\n /** The application ID. Defaults to the ID embedded by the Sanity CLI. */\n appId?: string\n /** The federation module id stamped on emitted messages. Defaults to `appId`. */\n moduleId?: string\n}\n\n/**\n * Connects to the installed message bus, or returns `undefined` when no compatible connection exists.\n * @public\n */\nexport function connectMessageBus(\n options: ConnectMessageBusOptions = {},\n): MessageBusConnection | undefined {\n const installedMessageBus = getInstalledMessageBus()\n if (!installedMessageBus) return undefined\n\n const appId = resolveAppId(options.appId)\n if (!appId) {\n console.warn(\n '[sanity-sdk:message-bus] cannot connect without an app ID; build with the Sanity CLI or pass appId',\n )\n return undefined\n }\n\n const connection = connectApplicationToMessageBus(installedMessageBus, {\n appId,\n moduleId: options.moduleId,\n })\n return MESSAGE_BUS_REGISTRY_KEY in connection ? connection : undefined\n}\n\n/**\n * Resets the installed message bus for test isolation.\n * @internal\n */\nexport function resetMessageBus(): void {\n const installedMessageBus = getInstalledMessageBus()\n if (!installedMessageBus) return\n reset((installedMessageBus as InternalMessageBus)[MESSAGE_BUS_REGISTRY_KEY])\n}\n\n/**\n * Options for installing the shared message bus. The host is the whole app, so it carries\n * no `moduleId`.\n * @internal\n */\nexport interface InstallMessageBusOptions {\n /** The application ID. Defaults to the ID embedded by the Sanity CLI. */\n appId?: string\n}\n\n/**\n * Installs the shared message bus and returns the host's connection, or connects to its\n * existing installation. Only the host calls this; another app's ID is rejected because the\n * connection it would get has no `connections`.\n * @internal\n */\nexport function installMessageBus(options: InstallMessageBusOptions = {}): MessageBusHost {\n const appId = resolveAppId(options.appId) ?? throwMissingAppId()\n const installedMessageBus = getInstalledMessageBus()\n if (installedMessageBus) {\n const installedAppId = (installedMessageBus as InternalMessageBus)[MESSAGE_BUS_REGISTRY_KEY]\n .appId\n if (installedAppId !== appId) {\n throw new MessageBusError(\n 'OWNERSHIP_MISMATCH',\n `Cannot install the message bus as \"${appId}\": it is already installed by \"${installedAppId}\". Applications connect with connectMessageBus().`,\n )\n }\n return connectApplicationToMessageBus(installedMessageBus, {appId}) as MessageBusHost\n }\n\n const globals = globalThis as {[MESSAGE_BUS_KEY]?: MessageBus}\n if (globals[MESSAGE_BUS_KEY]) {\n // A foreign value already occupies the bus symbol (e.g. an older Workbench bus); overwriting it disconnects that bus.\n console.error(\n '[sanity-sdk:message-bus] overwriting an incompatible message bus already installed',\n )\n }\n const host = createIsolatedMessageBus(appId)\n globals[MESSAGE_BUS_KEY] = host\n return host\n}\n\n/**\n * Declares state topics that are not in the bundled manifest, with the seed a new\n * connection's box starts from.\n * @internal\n */\nexport function registerStateTopics(\n target: MessageBus,\n topics: Partial<{[K in StateTopic]: ValueOf<K> | undefined}>,\n): void {\n const registry = (target as InternalMessageBus)[MESSAGE_BUS_REGISTRY_KEY]\n const manifest: TopicManifest = Object.fromEntries(\n Object.entries(topics).map(([name, seed]) => [name, {kind: 'state', seed}]),\n )\n mergeTopicManifest(registry, manifest)\n}\n","import {createActionBinder} from '../../store/createActionBinder'\nimport {type SanityInstance} from '../../store/createSanityInstance'\nimport {defineStore} from '../../store/defineStore'\nimport {connectMessageBus, isMessageBusInstalled, type MessageBusConnection} from './bus'\n\ninterface DashboardMessageBusState {\n connection?: MessageBusConnection\n}\n\nconst bindActionByInstance = createActionBinder<{name: string}, [moduleId?: string]>(\n (instance) => ({name: instance.instanceId}),\n)\n\nconst dashboardMessageBusStore = defineStore<DashboardMessageBusState>({\n name: 'dashboardMessageBus',\n getInitialState: () => ({}),\n // Runs when the instance is disposed, tearing down this window's connection.\n initialize:\n ({state}) =>\n () =>\n state.get().connection?.disconnect(),\n})\n\n/**\n * Returns the message bus connection for this instance, connecting on first call.\n *\n * @remarks\n * One connection is made per {@link SanityInstance}, carrying that window's\n * module identity. The first caller wins; later callers get the cached\n * connection. When no host bus is installed it returns `undefined` without\n * caching, so a later call retries once a host installs the bus.\n * @internal\n */\nexport const getDashboardMessageBus = bindActionByInstance(\n dashboardMessageBusStore,\n ({state}, moduleId?: string): MessageBusConnection | undefined => {\n const current = state.get().connection\n if (current) return current\n if (!isMessageBusInstalled()) return undefined\n const connection = connectMessageBus({moduleId})\n if (!connection) return undefined\n state.set('connect', {connection})\n return connection\n },\n)\n\n/**\n * Returns the instance's message bus connection, or throws when no dashboard host has\n * installed a bus. `action` names what the caller was about to do, e.g. `read topic \"x\"`.\n * @internal\n */\nexport function requireDashboardMessageBus(\n instance: SanityInstance,\n action: string,\n): MessageBusConnection {\n const messageBus = getDashboardMessageBus(instance)\n if (!messageBus) {\n throw new Error(`Cannot ${action} without an installed dashboard message bus`)\n }\n return messageBus\n}\n\n/**\n * Returns whether a dashboard host has installed a message bus.\n *\n * @remarks\n * Answers \"does a host own this session\", not \"has this instance connected yet\". Callers\n * such as the login redirect run before {@link getDashboardMessageBus} has been called for\n * the instance, so this must not depend on the connection state.\n * @internal\n */\nexport function isDashboardEnvironment(): boolean {\n return isMessageBusInstalled()\n}\n","import {createActionBinder} from '../../store/createActionBinder'\nimport {type SanityInstance} from '../../store/createSanityInstance'\nimport {createStateSourceAction} from '../../store/createStateSourceAction'\nimport {defineStore} from '../../store/defineStore'\nimport {setCleanupTimeout} from '../../utils/setCleanupTimeout'\nimport {type MessageBus, type MessageBusStateSource} from './bus'\nimport {requireDashboardMessageBus} from './store'\nimport {type StateTopic, type ValueOf} from './topics'\n\n/**\n * An error raised when a dashboard state topic reports failure.\n * @public\n */\nexport class TopicError extends Error {\n /** The topic that failed. */\n readonly topic: StateTopic\n\n /** Creates an error for a failed topic. */\n constructor(topic: StateTopic) {\n super(`Topic \"${topic}\" failed`)\n this.name = 'TopicError'\n this.topic = topic\n }\n}\n\n/**\n * The value of a state topic, with `TopicResult` wrappers unwrapped to their success value.\n * @public\n */\nexport type TopicData<K extends StateTopic> =\n ValueOf<K> extends infer Value\n ? Value extends {ok: true; value: infer Success}\n ? Success\n : Value extends {ok: false}\n ? never\n : Value\n : never\n\n// Mirrors the `TopicResult` shape declared in the topic manifest; no plain-value topic has an `ok` field.\nfunction isTopicResult(value: unknown): value is {ok: boolean; value?: unknown} {\n return (\n typeof value === 'object' && value !== null && 'ok' in value && typeof value.ok === 'boolean'\n )\n}\n\nfunction unwrapTopicResult(topic: StateTopic, value: unknown): unknown {\n if (!isTopicResult(value)) return value\n if (!value.ok) throw new TopicError(topic)\n return value.value\n}\n\ninterface TopicEntry {\n /** Why the first-value query failed. Dropped with the entry when its last subscriber leaves. */\n error?: unknown\n /** The in-flight first-value query, shared by every suspended render of the topic. */\n pending?: Promise<void>\n subscribers: number\n}\n\ninterface DashboardTopicsState {\n topics: {[topic: string]: TopicEntry}\n}\n\n// Matches the query store: a suspended component re-renders after its promise settles before\n// the temporary subscriber is released, so it still sees the recorded failure.\nconst TOPIC_STATE_CLEAR_DELAY = 1000\n\nconst bindActionByInstance = createActionBinder<{name: string}, [topic: StateTopic]>(\n (instance) => ({name: instance.instanceId}),\n)\n\n// The bus is the source of truth for topic values (it already keeps one replaying source per\n// topic). This store only tracks what the bus cannot: read failures and who is still reading.\nconst dashboardTopicsStore = defineStore<DashboardTopicsState>({\n name: 'dashboardTopics',\n getInitialState: () => ({topics: {}}),\n})\n\nconst getMessageBus = (instance: SanityInstance, topic: StateTopic): MessageBus =>\n requireDashboardMessageBus(instance, `read topic \"${topic}\"`)\n\nfunction getSource(instance: SanityInstance, topic: StateTopic): MessageBusStateSource<unknown> {\n return getMessageBus(instance, topic).subscribe(topic)\n}\n\n// An entry lives as long as it has subscribers. Dropping it with the last one is what gives a\n// later mount a fresh deadline instead of a stale failure.\nconst updateEntry =\n (topic: string, update: (entry: TopicEntry) => TopicEntry) =>\n (state: DashboardTopicsState): DashboardTopicsState => {\n const {[topic]: entry = {subscribers: 0}, ...rest} = state.topics\n const next = update(entry)\n return {topics: next.subscribers > 0 ? {...rest, [topic]: next} : rest}\n }\n\nconst addSubscriber = (topic: string) =>\n updateEntry(topic, (entry) => ({...entry, subscribers: entry.subscribers + 1}))\n\nconst removeSubscriber = (topic: string) =>\n updateEntry(topic, (entry) => ({...entry, subscribers: entry.subscribers - 1}))\n\n/**\n * A state source for a dashboard state topic, with `TopicResult` wrappers unwrapped.\n *\n * @remarks\n * Returns `undefined` until the topic publishes; use {@link resolveTopic} to wait for that\n * first value. While the topic is still unpublished, reading throws the failure that\n * {@link resolveTopic} recorded. A published value takes precedence over a recorded failure,\n * and a {@link TopicError} is thrown when the topic itself reports failure. A thrown failure\n * ends the subscription, so a reader recovers by subscribing again.\n * @internal\n */\nexport const getTopicState = bindActionByInstance(\n dashboardTopicsStore,\n createStateSourceAction({\n selector: ({state, instance}, topic: StateTopic) => {\n const current = getSource(instance, topic).getCurrent()\n // A recorded failure only describes the wait for a first value; a published value wins.\n const entry = state.topics[topic]\n if (current === undefined && entry?.error) throw entry.error\n return unwrapTopicResult(topic, current)\n },\n onSubscribe: ({state, instance}, topic: StateTopic) => {\n state.set('addSubscriber', addSubscriber(topic))\n // Each publish writes a fresh state object so the selector re-runs against the bus.\n const subscription = getSource(instance, topic).subscribe(() =>\n state.set(\n 'publish',\n updateEntry(topic, (entry) => ({...entry})),\n ),\n )\n return () => {\n subscription.unsubscribe()\n setCleanupTimeout(\n () => state.set('removeSubscriber', removeSubscriber(topic)),\n TOPIC_STATE_CLEAR_DELAY,\n )\n }\n },\n }),\n)\n\n/**\n * Resolves once a dashboard state topic has published, or records the failure for\n * {@link getTopicState} to throw. Repeated calls for a pending topic share one query.\n *\n * @remarks\n * Holds a temporary subscriber while the query is in flight so a failure recorded after the\n * reading component has gone is dropped with it, rather than thrown at the next mount.\n * @internal\n */\nexport const resolveTopic = bindActionByInstance(\n dashboardTopicsStore,\n ({state, instance}, topic: StateTopic): Promise<void> => {\n const existing = state.get().topics[topic]?.pending\n if (existing) return existing\n\n const release = () =>\n setCleanupTimeout(\n () => state.set('removeSubscriber', removeSubscriber(topic)),\n TOPIC_STATE_CLEAR_DELAY,\n )\n const pending = getMessageBus(instance, topic)\n .query(topic)\n .then(\n () =>\n state.set(\n 'resolved',\n updateEntry(topic, ({pending: _pending, ...entry}) => entry),\n ),\n (error: unknown) =>\n state.set(\n 'failed',\n updateEntry(topic, ({pending: _pending, ...entry}) => ({...entry, error})),\n ),\n )\n pending.then(release, release)\n state.set(\n 'query',\n updateEntry(topic, (entry) => ({...entry, pending, subscribers: entry.subscribers + 1})),\n )\n return pending\n },\n)\n"],"mappings":";;;;;AAsKA,MAAM,cAAuB,UAAa;CAAC,MAAM;CAAS;AAAI,IAGxD,iBAAiB;CAAC,MAAM;CAAS,WAAW,EAAC,MAAM,WAAU;AAAC,GAMvD,2BAET;CACF,uBAAuB,WAAW,KAAA,CAAS;CAC3C,2BAA2B,WAAW,KAAA,CAAS;CAC/C,qBAAqB,WAAW,KAAA,CAAS;CACzC,cAAc,WAAW,KAAA,CAAS;CAClC,sBAAsB;CACtB,uBAAuB,WAAW,KAAA,CAAS;CAC3C,8BAA8B;CAC9B,yBAAyB,WAAW,KAAA,CAAS;CAC7C,eAAe,WAAW;EAAC,IAAI;EAAM,OAAO;CAAI,CAAC;CACjD,mBAAmB;CACnB,4BAA4B,WAAW,KAAA,CAAS;CAChD,2BAA2B,WAAW,KAAA,CAAS;CAC/C,iBAAiB,WAAW,KAAA,CAAS;AACvC,GAoEa,kBAAyE,CAAC;;;;;ACpNvF,IAAa,kBAAb,cAAqC,MAAM;;CAKzC,YAAY,MAA2B,SAAkB,SAA6B;EAGpF,AAFA,MAAM,WAAW,MAAM,OAAO,GAJvB,gBAAA,MAAA,QAAA,KAAA,CAAA,GAKP,KAAK,OAAO,mBACZ,KAAK,OAAO;CACd;AACF;AAyKA,MAAM,kBAAkB,OAAO,IAAI,eAAe,GAC5C,2BAA2B,OAAO,IAAI,oBAAoB,GAC1D,2BAA2B,OAAO,IAAI,oBAAoB,GAC1D,gCAAgC,OAAO,IAAI,mBAAmB,GAI9D,qBAAqB,KAGrB,WAAW,OAAO,IAAI,oBAAoB;AA0ChD,SAAS,oBACP,UACA,YACA,MAC0B;CAG1B,IAAI,WAAW,MAAM,OAAO,SAAS,MAAM,IAAI,gBAAgB,SAAS;CACxE,IAAI,UAAU,WAAW,cAAc,IAAI,IAAI;C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