@sanity/sdk 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.
- package/dist/_exports/_internal.d.ts +3 -3
- package/dist/_exports/_internal.d.ts.map +1 -1
- package/dist/_exports/_internal.js +1 -1
- package/dist/_exports/_internal.js.map +1 -1
- package/dist/_exports/comlink.d.ts +1 -1
- package/dist/_exports/dashboard.d.ts +2 -2
- package/dist/{applications-Bb-0Kgkc.d.ts → applications-BKrtfXA2.d.ts} +5 -1
- package/dist/{applications-Bb-0Kgkc.d.ts.map → applications-BKrtfXA2.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/topicStore-CPhGph6z.js.map +1 -1
- package/dist/{topicStore-fPK2CfqH.d.ts → topicStore-e_kQ8ZvS.d.ts} +22 -5
- package/dist/topicStore-e_kQ8ZvS.d.ts.map +1 -0
- package/dist/{version-C7m7OAy9.js → version-BKdIDRP1.js} +2 -2
- package/dist/{version-C7m7OAy9.js.map → version-BKdIDRP1.js.map} +1 -1
- package/package.json +1 -1
- package/src/_exports/dashboard.ts +1 -0
- package/src/applications/applicationOrigin.ts +3 -1
- package/src/dashboard/messageBus/topics.test.ts +9 -2
- package/src/dashboard/messageBus/topics.ts +20 -2
- package/src/installations/installations.ts +4 -0
- package/dist/topicStore-fPK2CfqH.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -9,7 +9,9 @@ type SanityGlobal = typeof globalThis & {__SANITY_STAGING__?: boolean}
|
|
|
9
9
|
*
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export function getApplicationOrigin(
|
|
12
|
+
export function getApplicationOrigin(
|
|
13
|
+
application: Pick<ApplicationBase, 'externalUrl' | 'slug' | 'isSingleton' | 'organizationId'>,
|
|
14
|
+
): string | null {
|
|
13
15
|
if (application.externalUrl !== null) return new URL(application.externalUrl).origin
|
|
14
16
|
if (application.slug === null) return null
|
|
15
17
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {describe, expect, expectTypeOf, it} from 'vitest'
|
|
2
2
|
|
|
3
3
|
import {type Application, type ApplicationInclude} from '../../applications/applications'
|
|
4
|
+
import {type Installation, type InstallationInclude} from '../../installations/installations'
|
|
4
5
|
import {type MessageBus} from './bus'
|
|
5
6
|
import {
|
|
6
7
|
type ApplicationActivity,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
DASHBOARD_TOPIC_MANIFEST,
|
|
13
14
|
type DashboardTopics,
|
|
14
15
|
type EventTopic,
|
|
16
|
+
type LocalApplication,
|
|
15
17
|
type PayloadOf,
|
|
16
18
|
type ReplyOf,
|
|
17
19
|
type StateTopic,
|
|
@@ -25,8 +27,9 @@ type ListedApplication = Extract<
|
|
|
25
27
|
NonNullable<ValueOf<'applications.list'>>,
|
|
26
28
|
{ok: true}
|
|
27
29
|
>['value'][number]
|
|
30
|
+
// The list value mixes applications and installations; interface shape lives on applications.
|
|
28
31
|
type ListedInterface = NonNullable<
|
|
29
|
-
NonNullable<ListedApplication['activeDeployment']>['interfaces']
|
|
32
|
+
NonNullable<Extract<ListedApplication, {type: unknown}>['activeDeployment']>['interfaces']
|
|
30
33
|
>[number]
|
|
31
34
|
|
|
32
35
|
describe('dashboard topic types', () => {
|
|
@@ -59,8 +62,12 @@ describe('dashboard topic types', () => {
|
|
|
59
62
|
expectTypeOf<ValueOf<'applications.capabilities'>>().toEqualTypeOf<CapabilityRecord>()
|
|
60
63
|
expectTypeOf<ValueOf<'applications.config'>>().toEqualTypeOf<ApplicationConfig[] | null>()
|
|
61
64
|
expectTypeOf<ValueOf<'applications.list'>>().toEqualTypeOf<TopicResult<
|
|
62
|
-
Application<ApplicationInclude>[]
|
|
65
|
+
(Application<ApplicationInclude> | LocalApplication | Installation<InstallationInclude>)[]
|
|
63
66
|
> | null>()
|
|
67
|
+
// Every kind joins the list value element, distinguished by shape rather than a tag.
|
|
68
|
+
expectTypeOf<Application<ApplicationInclude>>().toMatchTypeOf<ListedApplication>()
|
|
69
|
+
expectTypeOf<LocalApplication>().toMatchTypeOf<ListedApplication>()
|
|
70
|
+
expectTypeOf<Installation<InstallationInclude>>().toMatchTypeOf<ListedApplication>()
|
|
64
71
|
expectTypeOf<Extract<ListedInterface, {type: 'tile'}>['metadata']>().toEqualTypeOf<{
|
|
65
72
|
order?: number
|
|
66
73
|
size: 'small' | 'large' | 'banner'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {type CurrentUser} from '@sanity/types'
|
|
2
2
|
|
|
3
3
|
import {type Application, type ApplicationInclude} from '../../applications/applications'
|
|
4
|
+
import {type Installation, type InstallationInclude} from '../../installations/installations'
|
|
4
5
|
import {type OrganizationBase} from '../../organization/organization'
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -108,6 +109,15 @@ export interface ApplicationContext {
|
|
|
108
109
|
readonly document: {readonly id: string} | null
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
/**
|
|
113
|
+
* An application served by a CLI dev server. The workbench publishes it in the same shape as a
|
|
114
|
+
* deployed application; `local` marks it and names the dev server it is served from.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export type LocalApplication = Application<ApplicationInclude> & {
|
|
118
|
+
readonly local: {readonly host: string; readonly port: number}
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
/**
|
|
112
122
|
* Declares a topic that stores and replays its current value.
|
|
113
123
|
* @public
|
|
@@ -180,8 +190,16 @@ export interface DashboardTopics {
|
|
|
180
190
|
'applications.context.update': EventTopicDef<ApplicationContext | null>
|
|
181
191
|
/** The foreground application ID, or `null` on dashboard-level routes. */
|
|
182
192
|
'applications.foreground': StateTopicDef<Application['id'] | null>
|
|
183
|
-
/**
|
|
184
|
-
|
|
193
|
+
/**
|
|
194
|
+
* The dashboard applications and installations available to the current user. Each member
|
|
195
|
+
* publishes its own raw serialised record, so the kinds are distinguished by shape: an
|
|
196
|
+
* {@link Application} has a `type` of `'studio' | 'coreApp'`, a {@link LocalApplication} adds
|
|
197
|
+
* `local`, and an {@link Installation} has no `type` and carries `applicationId` with a nested
|
|
198
|
+
* `application` object.
|
|
199
|
+
*/
|
|
200
|
+
'applications.list': StateTopicDef<TopicResult<
|
|
201
|
+
(Application<ApplicationInclude> | LocalApplication | Installation<InstallationInclude>)[]
|
|
202
|
+
> | null>
|
|
185
203
|
'applications.status.update': EventTopicDef<ApplicationStatusUpdate>
|
|
186
204
|
/**
|
|
187
205
|
* The session token for the reading connection, or `null` while signed out. The host
|
|
@@ -67,6 +67,10 @@ export interface InstallationBase {
|
|
|
67
67
|
/** Qualified, globally-unique handle of the installed singleton (e.g. `sanity/<name>`). */
|
|
68
68
|
reference: string
|
|
69
69
|
slug: string | null
|
|
70
|
+
/** Sanitized SVG icon markup, or `null` when the singleton has no icon. */
|
|
71
|
+
icon: string | null
|
|
72
|
+
/** The singleton's publishing organization; the top-level `organizationId` is the installing one. */
|
|
73
|
+
organizationId: string
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topicStore-fPK2CfqH.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;;;;;;;;;cAUP;;;;;KAMD,qBAAqB;;;;;KAMrB,mBAAmB,QAAQ,OAAO;;;;;UAM7B;WACN;WACA;WACA;aACE;aACA;aACA;eACE;eACA;;eAEA;;;;;;;;KASH,sBAAsB;;;;;KAMtB;EAAqB;;;;;;KAMrB;;EAEV;;EAEA,OAAO;;;;;;UAOQ;;WAEN;aACE;aACA;;;WAGF;aAAoB;;;;;;;KAOnB,cAAc;EAAM;EAAe,OAAO;;;;;;KAM1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