@sanity/sdk-react 3.4.0 → 3.5.0-next.20260922182803

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.
@@ -1,4 +1,4 @@
1
- import { Application, ApplicationBase, DocumentHandle } from "@sanity/sdk";
1
+ import { Application, ApplicationBase, DocumentHandle, Installation, InstallationInclude } from "@sanity/sdk";
2
2
  import React, { PropsWithChildren } from "react";
3
3
  import { PathChangeMessage } from "@sanity/message-protocol";
4
4
  import { ApplicationConfig, ApplicationConfig as ApplicationConfig$1, ApplicationConfigAppType, ApplicationConfigAppType as ApplicationConfigAppType$1, ApplicationContext, ApplicationContext as ApplicationContext$1, Capability, CapabilityRecord, ConnectMessageBusOptions, DashboardTopics, EventTopic, EventTopic as EventTopic$1, EventTopicDef, MessageBus, MessageBusAbortOptions, MessageBusClient, MessageBusConnection, MessageBusEmitOptions, MessageBusEmitOptions as MessageBusEmitOptions$1, MessageBusEmitResult, MessageBusEmitResult as MessageBusEmitResult$1, MessageBusError, MessageBusErrorCode, MessageBusHost, MessageBusMessage, MessageBusMeta, MessageBusQueryOptions, MessageBusStateSource, NavigationLocation, NavigationTarget, PayloadOf, PayloadOf as PayloadOf$1, RemoteModuleRef, RemoteModuleRef as RemoteModuleRef$1, ReplyOf, ReplyOf as ReplyOf$1, StateTopic, StateTopic as StateTopic$1, StateTopicDef, TopicData, TopicData as TopicData$1, TopicError, TopicName, TopicResult, Topics, ValueOf, ValueOf as ValueOf$1, capabilities, connectMessageBus } from "@sanity/sdk/dashboard";
@@ -331,47 +331,75 @@ interface AgentResourceContextOptions {
331
331
  * ```
332
332
  */
333
333
  export declare function useAgentResourceContext(options: AgentResourceContextOptions): void;
334
- type DashboardTopicApplication = Extract<NonNullable<ValueOf$1<'applications.list'>>, {
334
+ type DashboardTopicEntry = Extract<NonNullable<ValueOf$1<'applications.list'>>, {
335
335
  ok: true;
336
336
  }>['value'][number];
337
+ type DashboardTopicApplication = Extract<DashboardTopicEntry, {
338
+ type: unknown;
339
+ }>;
337
340
  type DashboardApplicationInterface = NonNullable<NonNullable<DashboardTopicApplication['activeDeployment']>['interfaces']>[number];
338
341
  type ViewInterface = Exclude<DashboardApplicationInterface, {
339
342
  type: 'worker';
340
343
  }>;
341
344
  /**
342
- * A dashboard view exposed by an application.
345
+ * The shared identity fields attached to each {@link DashboardView.application} and
346
+ * {@link DashboardWebWorker.application}, and the input to module loading. Widens
347
+ * {@link ApplicationBase} so `type` also covers installations.
348
+ * @public
349
+ */
350
+ type DashboardApplicationBase = Omit<ApplicationBase, 'type'> & {
351
+ readonly type: ApplicationBase['type'] | 'installation';
352
+ /** Served by a CLI dev server rather than a deployment. */
353
+ readonly isLocal: boolean;
354
+ };
355
+ /**
356
+ * A dashboard view exposed by an application or installation.
343
357
  * @public
344
358
  */
345
359
  type DashboardView = { [Type in ViewInterface['type']]: Omit<Extract<ViewInterface, {
346
360
  type: Type;
347
361
  }>, 'type'> & {
348
- readonly application: ApplicationBase;
362
+ readonly application: DashboardApplicationBase;
349
363
  readonly module: RemoteModuleRef$1;
350
364
  readonly surface: Type extends 'app' ? 'window' : Type;
351
365
  }; }[ViewInterface['type']];
352
366
  /**
353
- * A web worker exposed by an application.
367
+ * A web worker exposed by an application or installation.
354
368
  * @public
355
369
  */
356
370
  type DashboardWebWorker = Extract<DashboardApplicationInterface, {
357
371
  type: 'worker';
358
372
  }> & {
359
- readonly application: ApplicationBase;
373
+ readonly application: DashboardApplicationBase;
360
374
  readonly module: RemoteModuleRef$1;
361
375
  };
362
376
  /**
363
- * The minimal Brett application fields with its loadable views and web workers.
377
+ * An installation shaped into the shared application base, with its raw record kept under
378
+ * `installation` for consumers that need the full record.
379
+ * @public
380
+ */
381
+ type DashboardInstallation = Omit<DashboardApplicationBase, 'type'> & {
382
+ readonly type: 'installation';
383
+ readonly installation: Installation<InstallationInclude>;
384
+ };
385
+ /**
386
+ * A dashboard entry — an application or an installation — in one consistent shape, with its
387
+ * loadable views and web workers. `type` distinguishes the kinds and `isLocal` marks dev-server
388
+ * applications; render a list without branching.
364
389
  * @public
365
390
  */
366
- type DashboardApplication = DashboardTopicApplication & {
391
+ type DashboardApplication = (DashboardTopicApplication | DashboardInstallation) & Pick<DashboardApplicationBase, 'isLocal'> & {
367
392
  readonly views: DashboardView[];
368
393
  readonly webWorkers: DashboardWebWorker[];
369
394
  };
370
395
  /**
371
- * Returns the applications available in the dashboard.
396
+ * Returns the applications and installations available in the dashboard, in one consistent shape.
372
397
  *
373
- * Suspends until the dashboard publishes its application list; a cleared list is empty. Throws a
374
- * `TopicError` to the nearest error boundary when the dashboard fails to load applications.
398
+ * Suspends until the dashboard publishes its list; a cleared list is empty. Throws a `TopicError`
399
+ * to the nearest error boundary when the dashboard fails to load. Every entry exposes the same base
400
+ * fields plus `views` and `webWorkers`; `type` distinguishes applications (`'studio' | 'coreApp'`)
401
+ * from installations (`'installation'`), which also carry the raw record under `installation`.
402
+ * `isLocal` marks applications served by a CLI dev server.
375
403
  *
376
404
  * @example
377
405
  * ```tsx
@@ -830,5 +858,5 @@ export declare const useTopic: <K extends StateTopic$1>(topic: K) => TopicData$1
830
858
  * @public
831
859
  */
832
860
  export declare function useWindowTitle(viewTitle?: string): void;
833
- export { type AgentResourceContextOptions, type ApplicationConfig, type ApplicationConfigAppType, type ApplicationConfigSelector, type ApplicationContext, type CanvasUrl, type Capability, type CapabilityRecord, type ConnectMessageBusOptions, type CoreApplicationUrl, type CreateIntentParameters, type CreateRemoteInstanceOptions, type DashboardApplication, type DashboardNavigation, type DashboardTopics, type DashboardUrl, type DashboardView, type DashboardWebWorker, type EditIntentParameters, type EventTopic, type EventTopicDef, type FederationRemote, type MediaLibraryUrl, type MessageBus, type MessageBusAbortOptions, type MessageBusClient, type MessageBusConnection, type MessageBusEmitOptions, type MessageBusEmitResult, MessageBusError, type MessageBusErrorCode, type MessageBusHost, type MessageBusMessage, type MessageBusMeta, type MessageBusQueryOptions, type MessageBusStateSource, type NavigateToDashboardPath, type NavigateToStudioResult, type NavigationLocation, type NavigationTarget, type PayloadOf, type ReleaseIntentParameters, type RemoteInstance, type RemoteModuleRef, type ReplyOf, type StateTopic, type StateTopicDef, type StudioIntentUrl, type StudioUrl, type StudioWorkspaceUrl, DashboardTokenRefreshProvider as TokenRefreshProvider, type TopicData, type TopicEmitter, TopicError, type TopicName, type TopicResult, type Topics, type Urls, type ValueOf, capabilities, connectMessageBus };
861
+ export { type AgentResourceContextOptions, type ApplicationConfig, type ApplicationConfigAppType, type ApplicationConfigSelector, type ApplicationContext, type CanvasUrl, type Capability, type CapabilityRecord, type ConnectMessageBusOptions, type CoreApplicationUrl, type CreateIntentParameters, type CreateRemoteInstanceOptions, type DashboardApplication, type DashboardApplicationBase, type DashboardInstallation, type DashboardNavigation, type DashboardTopics, type DashboardUrl, type DashboardView, type DashboardWebWorker, type EditIntentParameters, type EventTopic, type EventTopicDef, type FederationRemote, type MediaLibraryUrl, type MessageBus, type MessageBusAbortOptions, type MessageBusClient, type MessageBusConnection, type MessageBusEmitOptions, type MessageBusEmitResult, MessageBusError, type MessageBusErrorCode, type MessageBusHost, type MessageBusMessage, type MessageBusMeta, type MessageBusQueryOptions, type MessageBusStateSource, type NavigateToDashboardPath, type NavigateToStudioResult, type NavigationLocation, type NavigationTarget, type PayloadOf, type ReleaseIntentParameters, type RemoteInstance, type RemoteModuleRef, type ReplyOf, type StateTopic, type StateTopicDef, type StudioIntentUrl, type StudioUrl, type StudioWorkspaceUrl, DashboardTokenRefreshProvider as TokenRefreshProvider, type TopicData, type TopicEmitter, TopicError, type TopicName, type TopicResult, type Topics, type Urls, type ValueOf, capabilities, connectMessageBus };
834
862
  //# sourceMappingURL=dashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","names":[],"sources":["../../src/context/DashboardTokenRefresh.tsx","../../src/dashboard/createRemoteInstance.ts","../../src/dashboard/urlFor.ts","../../src/hooks/dashboard/useAgentResourceContext.ts","../../src/hooks/dashboard/useApplications.ts","../../src/hooks/dashboard/useApplication.ts","../../src/hooks/dashboard/useApplicationBasePath.ts","../../src/hooks/dashboard/useApplicationConfig.ts","../../src/hooks/dashboard/useApplicationConfigs.ts","../../src/hooks/dashboard/useApplicationContext.ts","../../src/hooks/dashboard/useApplicationForegroundId.ts","../../src/hooks/dashboard/useAuthToken.ts","../../src/hooks/dashboard/useCapabilities.ts","../../src/hooks/dashboard/useCurrentUser.ts","../../src/hooks/dashboard/useEmit.ts","../../src/hooks/dashboard/useNavigate.ts","../../src/hooks/dashboard/useNavigateToStudioDocument.ts","../../src/hooks/dashboard/useOrganizationId.tsx","../../src/hooks/dashboard/useRemoteClient.ts","../../src/hooks/dashboard/useTopic.ts","../../src/hooks/dashboard/useWindowTitle.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+Fa,+BAA+B,MAAM,GAAG;KCxFhD,aAAa,GAAG,gBAAgB,KAAK,KAAK,GAAG,KAAK,QAAQ,KAAK,GAAG;;;;KAK3D;EACV;EACA;;;;;KAcU,8BAA8B,aACxC,KAAK;;;;UAOU;EACf,gBAAgB,SAAS;;EAEzB,WAAW,GAAG,aAAa,QAAQ;;EAEnC,cAAc,cAAc,qBAAqB;;;;;;wBAOnC,qBAAqB,SAAS,8BAA8B;;UC/C3D;EACf,IAAI;IAAW;;EACf,MAAM;IAAU;MAAkB;EAClC;;;UAOe;EACf;;EAEA;;EAEA,gDAAgD;;;UAIjC;EACf;EACA;;;UAIe;EACf;;;UAIe,2BAA2B;EAC1C,OAAO,gBAAgB,YAAY,uBAAuB;EAC1D,OAAO,kBAAkB,YAAY,yBAAyB;EAC9D,OAAO,mBAAmB,YAAY,0BAA0B;EAChE,QAAQ,iBAAiB;EACzB,KAAK,iBAAiB;;;UAIP,kBAAkB;EACjC,UAAU,oBAAoB;;;UAIf,wBAAwB;EACvC,YAAY,sBAAsB;EAClC,QAAQ,oBAAoB;EAC5B,KAAK,iBAAiB;;;UAIP,2B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;;;;KCX9B;EACP,OAAO;EAAmB;;EAC1B;EAAe,SAAS;;;;;;;;;;;;;;;;;;;;;;wBAsBb,qBACd,UAAU,4BACT;;;;;;;;;;;;;;;;wBCZa,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCclC,sBAAsB,SAAS;;;;;;;;;;;;;;;;wBClB/B,8BAA8B;;;;;;;;;;;;;;;;wBCF9B;;;;;;;;;;;;;;;;;;;;;wBCOA,mBAAmB;;;;;;;;;;;;;;;;wBCLnB,kBAAkB;;;;;KCHtB,aAAa,UAAU,oBAC9B,MAAM,YAAU,mBACd,gBAAgB,UAAU,4BAC1B,SAAS,YAAU,IAAI,UAAU,6BACnC,uBAAqB,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkDlB,QAAQ,UAAU,cAAY,OAAO,IAAI,aAAa;;;;;;;KC/C1D,sBAAsB;;;;;;;KAQtB,2BAA2B;EAAU;EAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+C/C,YACd,aAAa,SAAS,+BACrB;;;;;UC9Dc;EACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Gc,4BACd,gBAAgB,gBAChB,8BACC;;;;;;;;;;;;;;;;;;;;;;;wBClGa;;;;;;qBCrBH,uBAAuB;;;;;;;;;;;;;;;;;;qBCavB,WAMN,UAAU,cAAY,OAAO,MAAM,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC4CpC,eAAe"}
1
+ {"version":3,"file":"dashboard.d.ts","names":[],"sources":["../../src/context/DashboardTokenRefresh.tsx","../../src/dashboard/createRemoteInstance.ts","../../src/dashboard/urlFor.ts","../../src/hooks/dashboard/useAgentResourceContext.ts","../../src/hooks/dashboard/useApplications.ts","../../src/hooks/dashboard/useApplication.ts","../../src/hooks/dashboard/useApplicationBasePath.ts","../../src/hooks/dashboard/useApplicationConfig.ts","../../src/hooks/dashboard/useApplicationConfigs.ts","../../src/hooks/dashboard/useApplicationContext.ts","../../src/hooks/dashboard/useApplicationForegroundId.ts","../../src/hooks/dashboard/useAuthToken.ts","../../src/hooks/dashboard/useCapabilities.ts","../../src/hooks/dashboard/useCurrentUser.ts","../../src/hooks/dashboard/useEmit.ts","../../src/hooks/dashboard/useNavigate.ts","../../src/hooks/dashboard/useNavigateToStudioDocument.ts","../../src/hooks/dashboard/useOrganizationId.tsx","../../src/hooks/dashboard/useRemoteClient.ts","../../src/hooks/dashboard/useTopic.ts","../../src/hooks/dashboard/useWindowTitle.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+Fa,+BAA+B,MAAM,GAAG;KCxFhD,aAAa,GAAG,gBAAgB,KAAK,KAAK,GAAG,KAAK,QAAQ,KAAK,GAAG;;;;KAK3D;EACV;EACA;;;;;KAcU,8BAA8B,aACxC,KAAK;;;;UAOU;EACf,gBAAgB,SAAS;;EAEzB,WAAW,GAAG,aAAa,QAAQ;;EAEnC,cAAc,cAAc,qBAAqB;;;;;;wBAOnC,qBAAqB,SAAS,8BAA8B;;UC/C3D;EACf,IAAI;IAAW;;EACf,MAAM;IAAU;MAAkB;EAClC;;;UAOe;EACf;;EAEA;;EAEA,gDAAgD;;;UAIjC;EACf;EACA;;;UAIe;EACf;;;UAIe,2BAA2B;EAC1C,OAAO,gBAAgB,YAAY,uBAAuB;EAC1D,OAAO,kBAAkB,YAAY,yBAAyB;EAC9D,OAAO,mBAAmB,YAAY,0BAA0B;EAChE,QAAQ,iBAAiB;EACzB,KAAK,iBAAiB;;;UAIP,kBAAkB;EACjC,UAAU,oBAAoB;;;UAIf,wBAAwB;EACvC,YAAY,sBAAsB;EAClC,QAAQ,oBAAoB;EAC5B,KAAK,iBAAiB;;;UAIP,2BAA2B;EAC1C,QAAQ,iBAAiB;;;UAIV,wBAAwB;EACvC,MAAM,k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;;;wBAgHT,mBAAmB;;;;;;;;;;;;;;;;wBCtKnB,eACd,eAAe,6BACd;;;;;;;;;;;;;;;;;wBCCa,0BAA0B;;;;;KCX9B;EACP,OAAO;EAAmB;;EAC1B;EAAe,SAAS;;;;;;;;;;;;;;;;;;;;;;wBAsBb,qBACd,UAAU,4BACT;;;;;;;;;;;;;;;;wBCZa,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCclC,sBAAsB,SAAS;;;;;;;;;;;;;;;;wBClB/B,8BAA8B;;;;;;;;;;;;;;;;wBCF9B;;;;;;;;;;;;;;;;;;;;;wBCOA,mBAAmB;;;;;;;;;;;;;;;;wBCLnB,kBAAkB;;;;;KCHtB,aAAa,UAAU,oBAC9B,MAAM,YAAU,mBACd,gBAAgB,UAAU,4BAC1B,SAAS,YAAU,IAAI,UAAU,6BACnC,uBAAqB,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkDlB,QAAQ,UAAU,cAAY,OAAO,IAAI,aAAa;;;;;;;KC/C1D,sBAAsB;;;;;;;KAQtB,2BAA2B;EAAU;EAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+C/C,YACd,aAAa,SAAS,+BACrB;;;;;UC9Dc;EACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Gc,4BACd,gBAAgB,gBAChB,8BACC;;;;;;;;;;;;;;;;;;;;;;;wBClGa;;;;;;qBCrBH,uBAAuB;;;;;;;;;;;;;;;;;;qBCavB,WAMN,UAAU,cAAY,OAAO,MAAM,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC4CpC,eAAe"}
@@ -1,4 +1,4 @@
1
- import { a as DashboardTokenRefreshProvider, c as createStateSourceHook, i as useOrganizationId, l as useSanityInstance, n as useTopic, o as useWindowConnection, r as useEmit, t as useStudioWorkspacesByProjectIdDataset } from "../useStudioWorkspacesByProjectIdDataset-Bjwi4cLk.js";
1
+ import { a as DashboardTokenRefreshProvider, c as createStateSourceHook, i as useOrganizationId, l as useSanityInstance, n as useTopic, o as useWindowConnection, r as useEmit, t as useStudioWorkspacesByProjectIdDataset } from "../useStudioWorkspacesByProjectIdDataset-DL6_9jgU.js";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import "@sanity/sdk";
4
4
  import { createLogger, getApplicationOrigin, isDashboardEnvironment, requireDashboardMessageBus } from "@sanity/sdk/_internal";
@@ -499,10 +499,9 @@ function useComlinkAgentResourceContext(options) {
499
499
  updateContext();
500
500
  }, t3 = [updateContext], $[6] = updateContext, $[7] = t2, $[8] = t3), useEffect(t2, t3);
501
501
  }
502
- const loadableInterfaces = ({ activeDeployment, config }) => config?.mfManifest === void 0 ? [] : activeDeployment?.interfaces ?? [], toApplication = (application) => {
503
- let { activeDeployment: _activeDeployment, config: _config, ...applicationBase } = application, interfaces = loadableInterfaces(application), entry = interfaces.length === 0 ? null : getApplicationOrigin(applicationBase);
502
+ const loadableInterfaces = ({ activeDeployment, config }, isLocal) => isLocal || config?.mfManifest !== void 0 ? activeDeployment?.interfaces ?? [] : [], loadModules = (base, interfaces) => {
503
+ let entry = interfaces.length === 0 ? null : getApplicationOrigin(base);
504
504
  if (entry === null) return {
505
- ...application,
506
505
  views: [],
507
506
  webWorkers: []
508
507
  };
@@ -510,13 +509,13 @@ const loadableInterfaces = ({ activeDeployment, config }) => config?.mfManifest
510
509
  for (let extension of interfaces) {
511
510
  let module = {
512
511
  entry,
513
- moduleId: `${applicationBase.id}/${extension.moduleId}`,
512
+ moduleId: `${base.id}/${extension.moduleId}`,
514
513
  version: extension.version
515
514
  };
516
515
  if (extension.type === "worker") {
517
516
  webWorkers.push({
518
517
  ...extension,
519
- application: applicationBase,
518
+ application: base,
520
519
  module
521
520
  });
522
521
  continue;
@@ -524,22 +523,57 @@ const loadableInterfaces = ({ activeDeployment, config }) => config?.mfManifest
524
523
  let { type, ...view } = extension;
525
524
  views.push({
526
525
  ...view,
527
- application: applicationBase,
526
+ application: base,
528
527
  module,
529
528
  surface: type === "app" ? "window" : type
530
529
  });
531
530
  }
532
531
  return {
533
- ...application,
534
532
  views,
535
533
  webWorkers
536
534
  };
535
+ }, toApplication = (application) => {
536
+ let { activeDeployment: _activeDeployment, config: _config, ...applicationBase } = application, isLocal = "local" in application;
537
+ return {
538
+ ...application,
539
+ isLocal,
540
+ ...loadModules({
541
+ ...applicationBase,
542
+ isLocal
543
+ }, loadableInterfaces(application, isLocal))
544
+ };
545
+ }, toInstallation = (installation) => {
546
+ let { application } = installation, base = {
547
+ id: installation.id,
548
+ type: "installation",
549
+ isLocal: !1,
550
+ title: application.title,
551
+ name: application.name,
552
+ reference: application.reference,
553
+ icon: application.icon,
554
+ isSingleton: !0,
555
+ visibility: "default",
556
+ slug: application.slug,
557
+ externalUrl: null,
558
+ organizationId: application.organizationId,
559
+ createdAt: installation.createdAt,
560
+ updatedAt: installation.updatedAt
561
+ };
562
+ return {
563
+ ...base,
564
+ type: "installation",
565
+ installation,
566
+ ...loadModules(base, installation.interfaces ?? [])
567
+ };
537
568
  };
538
569
  /**
539
- * Returns the applications available in the dashboard.
570
+ * Returns the applications and installations available in the dashboard, in one consistent shape.
540
571
  *
541
- * Suspends until the dashboard publishes its application list; a cleared list is empty. Throws a
542
- * `TopicError` to the nearest error boundary when the dashboard fails to load applications.
572
+ * Suspends until the dashboard publishes its list; a cleared list is empty. Throws a `TopicError`
573
+ * to the nearest error boundary when the dashboard fails to load. Every entry exposes the same base
574
+ * fields plus `views` and `webWorkers`; `type` distinguishes applications (`'studio' | 'coreApp'`)
575
+ * from installations (`'installation'`), which also carry the raw record under `installation`.
576
+ * `isLocal` marks applications served by a CLI dev server.
543
577
  *
544
578
  * @example
545
579
  * ```tsx
@@ -553,7 +587,10 @@ const loadableInterfaces = ({ activeDeployment, config }) => config?.mfManifest
553
587
  */
554
588
  function useApplications() {
555
589
  let $ = c(2), applications = useTopic("applications.list"), t0;
556
- return $[0] === applications ? t0 = $[1] : (t0 = applications?.map(toApplication) ?? [], $[0] = applications, $[1] = t0), t0;
590
+ return $[0] === applications ? t0 = $[1] : (t0 = applications?.map(_temp$2) ?? [], $[0] = applications, $[1] = t0), t0;
591
+ }
592
+ function _temp$2(entry) {
593
+ return "type" in entry ? toApplication(entry) : toInstallation(entry);
557
594
  }
558
595
  /**
559
596
  * Returns a dashboard application by id, or `null` when it is unavailable.