@sanity/sdk 3.10.0 → 3.11.0-next.20261028095623
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 +1 -1
- package/dist/_exports/_internal.js +7 -7
- package/dist/_exports/agent.js +1 -1
- package/dist/_exports/dashboard.d.ts +2 -2
- package/dist/_exports/dashboard.js +2 -2
- package/dist/{authStore-DGTMam3g.js → authStore-DkvF0SCR.js} +14 -10
- package/dist/authStore-DkvF0SCR.js.map +1 -0
- package/dist/{bus-IXAeQQqz.d.ts → bus--16jeiZu.d.ts} +26 -6
- package/dist/bus--16jeiZu.d.ts.map +1 -0
- package/dist/{clientStore-DhND0JEI.js → clientStore-BKGkTEvo.js} +2 -2
- package/dist/{clientStore-DhND0JEI.js.map → clientStore-BKGkTEvo.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/{topicStore-sQ4AFwXg.js → topicStore-ufyo59CC.js} +2 -2
- package/dist/{topicStore-sQ4AFwXg.js.map → topicStore-ufyo59CC.js.map} +1 -1
- package/dist/{version-B9xC1_fI.js → version-PdoU_iHu.js} +4 -4
- package/dist/{version-B9xC1_fI.js.map → version-PdoU_iHu.js.map} +1 -1
- package/package.json +1 -1
- package/src/_exports/dashboard.ts +1 -0
- package/src/dashboard/messageBus/bus.test.ts +54 -0
- package/src/dashboard/messageBus/bus.ts +53 -9
- package/dist/authStore-DGTMam3g.js.map +0 -1
- package/dist/bus-IXAeQQqz.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as SanityConfig, s as DocumentResource, t as SanityInstance } from "../createSanityInstance-DLZuttDd.js";
|
|
2
2
|
import { n as StateSource, r as BoundStoreAction } from "../createStateSourceAction-DDLG_vn2.js";
|
|
3
3
|
import { Bi as getSignInMethodLabel, Bt as FavoriteStatusResponse, Dt as GetUsersOptions, G as getQueryKey, Li as ProjectAccessErrorDetails, Ri as getProjectAccessErrorDetails, Sr as MessageBusTopics, Vt as SetFavoriteInput, _a as MutationDefinition, ba as defineMutation, ct as PreviewValue, fa as CacheTag, fi as parseCommentsOptionsKey, fr as ApplicationStatus, ga as FetcherSnapshot, ha as FetcherDefinition, ma as Fetcher, ni as createLogger, or as getTopicState, pa as CacheWriter, pr as ApplicationStatusUpdate, q as parseQueryKey, r as ApplicationBase, sr as resolveTopic, st as PreviewQueryResult, ui as getCommentsOptionsKey, va as MutationResult, ya as defineFetcher, zt as FavoriteDocumentContext } from "../applications-BBU1uAjK.js";
|
|
4
|
-
import {
|
|
4
|
+
import { b as resetMessageBus, n as InstallMessageBusOptions, o as MessageBusConnection, s as MessageBusEmitOptions, v as installMessageBus, x as workerMessages, y as isMessageBusEnvironment } from "../bus--16jeiZu.js";
|
|
5
5
|
import { ClientError, SanityClient } from "@sanity/client";
|
|
6
6
|
import { Observable } from "rxjs";
|
|
7
7
|
import { CurrentUser } from "@sanity/types";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-vyAXikos.js";
|
|
2
2
|
import { a as createActionBinder, s as defineStore } from "../createStateSourceAction-Bn0po7Z3.js";
|
|
3
|
-
import { $ as randomUuid, D as parseCommentsOptionsKey, Q as randomId, S as toFavoriteDocument, T as getCommentsOptionsKey, X as defineFetcher, Y as getSignInMethodLabel, Z as defineMutation, d as getUsersKey, i as parseQueryKey, n as getQueryKey, p as parseUsersKey, q as getProjectAccessErrorDetails, t as CORE_SDK_VERSION } from "../version-
|
|
4
|
-
import { G as resetMessageBus, H as installMessageBus, I as isStudioConfig, K as workerMessages, U as isMessageBusEnvironment, Z as createLogger, k as getClientErrorApiBody } from "../authStore-
|
|
3
|
+
import { $ as randomUuid, D as parseCommentsOptionsKey, Q as randomId, S as toFavoriteDocument, T as getCommentsOptionsKey, X as defineFetcher, Y as getSignInMethodLabel, Z as defineMutation, d as getUsersKey, i as parseQueryKey, n as getQueryKey, p as parseUsersKey, q as getProjectAccessErrorDetails, t as CORE_SDK_VERSION } from "../version-PdoU_iHu.js";
|
|
4
|
+
import { G as resetMessageBus, H as installMessageBus, I as isStudioConfig, K as workerMessages, U as isMessageBusEnvironment, Z as createLogger, k as getClientErrorApiBody } from "../authStore-DkvF0SCR.js";
|
|
5
5
|
import { i as pickProperties, n as isObject, t as isDeepEqual } from "../object-CxXlSVg7.js";
|
|
6
|
-
import { n as getClient } from "../clientStore-
|
|
7
|
-
import { a as getDashboardMessageBus, i as resolveTopic, o as isDashboardEnvironment, r as getTopicState, s as requireDashboardMessageBus } from "../topicStore-
|
|
6
|
+
import { n as getClient } from "../clientStore-BKGkTEvo.js";
|
|
7
|
+
import { a as getDashboardMessageBus, i as resolveTopic, o as isDashboardEnvironment, r as getTopicState, s as requireDashboardMessageBus } from "../topicStore-ufyo59CC.js";
|
|
8
8
|
import "@sanity/client";
|
|
9
9
|
import { EMPTY, catchError, defer, distinctUntilChanged, map, merge } from "rxjs";
|
|
10
10
|
import { DocumentId, isPublishedIdEqual } from "@sanity/id-utils";
|
|
@@ -421,9 +421,9 @@ function initTelemetry(instance, projectId) {
|
|
|
421
421
|
environment
|
|
422
422
|
}), Promise.all([
|
|
423
423
|
Promise.resolve().then(() => telemetryManager_exports),
|
|
424
|
-
import("../clientStore-
|
|
425
|
-
import("../authStore-
|
|
426
|
-
import("../authStore-
|
|
424
|
+
import("../clientStore-BKGkTEvo.js").then((n) => n.t),
|
|
425
|
+
import("../authStore-DkvF0SCR.js").then((n) => n.n),
|
|
426
|
+
import("../authStore-DkvF0SCR.js").then((n) => n.F)
|
|
427
427
|
]).then(async ([{ createTelemetryManager }, { getClient }, { getTokenState }, { isStudioConfig }]) => {
|
|
428
428
|
if (instance.isDisposed()) {
|
|
429
429
|
initInFlight.delete(instance), logger.debug("telemetry skipped: instance disposed before imports resolved");
|
package/dist/_exports/agent.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Ar as TopicName, Cr as NavigationLocation, Dr as ReplyOf, Er as RemoteModuleRef, Mr as Topics, Nr as ValueOf, Or as StateTopic, Pr as capabilities, Tr as PayloadOf, _r as DocumentActivity, br as FavoriteDocument, cr as ApplicationActivity, dr as ApplicationContext, gr as DashboardTopics, hr as CapabilityRecord, ir as TopicError, jr as TopicResult, kr as StateTopicDef, lr as ApplicationConfig, mr as Capability, rr as TopicData, ur as ApplicationConfigAppType, vr as EventTopic, wr as NavigationTarget, xr as LocalApplication, yr as EventTopicDef } from "../applications-BBU1uAjK.js";
|
|
2
|
-
import { a as MessageBusClient, c as MessageBusEmitResult, d as
|
|
3
|
-
export { type ApplicationActivity, type ApplicationConfig, type ApplicationConfigAppType, type ApplicationContext, type Capability, type CapabilityRecord, type ConnectMessageBusOptions, type DashboardTopics, type DocumentActivity, type EventTopic, type EventTopicDef, type FavoriteDocument, type LocalApplication, 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 NavigationLocation, type NavigationTarget, type PayloadOf, type RemoteModuleRef, type ReplyOf, type StateTopic, type StateTopicDef, type TopicData, TopicError, type TopicName, type TopicResult, type Topics, type ValueOf, capabilities, connectMessageBus };
|
|
2
|
+
import { _ as connectMessageBus, a as MessageBusClient, c as MessageBusEmitResult, d as MessageBusErrorDetails, f as MessageBusHost, g as MessageBusStateSource, h as MessageBusQueryOptions, i as MessageBusAbortOptions, l as MessageBusError, m as MessageBusMeta, o as MessageBusConnection, p as MessageBusMessage, r as MessageBus, s as MessageBusEmitOptions, t as ConnectMessageBusOptions, u as MessageBusErrorCode } from "../bus--16jeiZu.js";
|
|
3
|
+
export { type ApplicationActivity, type ApplicationConfig, type ApplicationConfigAppType, type ApplicationContext, type Capability, type CapabilityRecord, type ConnectMessageBusOptions, type DashboardTopics, type DocumentActivity, type EventTopic, type EventTopicDef, type FavoriteDocument, type LocalApplication, type MessageBus, type MessageBusAbortOptions, type MessageBusClient, type MessageBusConnection, type MessageBusEmitOptions, type MessageBusEmitResult, MessageBusError, type MessageBusErrorCode, type MessageBusErrorDetails, type MessageBusHost, type MessageBusMessage, type MessageBusMeta, type MessageBusQueryOptions, type MessageBusStateSource, type NavigationLocation, type NavigationTarget, type PayloadOf, type RemoteModuleRef, type ReplyOf, type StateTopic, type StateTopicDef, type TopicData, TopicError, type TopicName, type TopicResult, type Topics, type ValueOf, capabilities, connectMessageBus };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as MessageBusError, V as connectMessageBus, q as capabilities } from "../authStore-
|
|
2
|
-
import { t as TopicError } from "../topicStore-
|
|
1
|
+
import { B as MessageBusError, V as connectMessageBus, q as capabilities } from "../authStore-DkvF0SCR.js";
|
|
2
|
+
import { t as TopicError } from "../topicStore-ufyo59CC.js";
|
|
3
3
|
export { MessageBusError, TopicError, capabilities, connectMessageBus };
|
|
@@ -259,9 +259,13 @@ const capabilities = [
|
|
|
259
259
|
var MessageBusError = class extends Error {
|
|
260
260
|
/** The machine-readable protocol error code. */
|
|
261
261
|
code;
|
|
262
|
+
/** What to do about the refusal, when the host sent it. */
|
|
263
|
+
fix;
|
|
264
|
+
/** A page that explains the refusal, when the host sent it. */
|
|
265
|
+
docsUrl;
|
|
262
266
|
/** Creates a message bus protocol error. */
|
|
263
267
|
constructor(code, message, options) {
|
|
264
|
-
super(message ?? code, options), this.name = "MessageBusError", this.code = code;
|
|
268
|
+
super(message ?? code, options), this.name = "MessageBusError", this.code = code, this.fix = options?.fix, this.docsUrl = options?.docsUrl;
|
|
265
269
|
}
|
|
266
270
|
};
|
|
267
271
|
const MESSAGE_BUS_KEY = Symbol.for("sanity.os.bus"), MESSAGE_BUS_PROTOCOL_KEY = Symbol.for("sanity.os.protocol"), MESSAGE_BUS_REGISTRY_KEY = Symbol.for("sanity.os.registry"), MESSAGE_BUS_PENDING_REPLY_KEY = Symbol.for("sanity.os.request"), MESSAGE_BUS_EVENT_MESSAGES_KEY = Symbol.for("sanity.os.event-messages"), DEFAULT_TIMEOUT_MS = 5e3, NO_VALUE = Symbol.for("sanity.os.no-value");
|
|
@@ -315,10 +319,10 @@ function createEventMessage(appId, moduleId, type, payload, pendingReply) {
|
|
|
315
319
|
value
|
|
316
320
|
});
|
|
317
321
|
},
|
|
318
|
-
reject: (reason, code = "REFUSED") => {
|
|
322
|
+
reject: (reason, code = "REFUSED", details) => {
|
|
319
323
|
pendingReply.settled ? console.warn(`[sanity-sdk:message-bus] reject ignored for "${type}": no waiting caller or already replied`) : settleReply(pendingReply, {
|
|
320
324
|
ok: !1,
|
|
321
|
-
error: new MessageBusError(code, reason)
|
|
325
|
+
error: new MessageBusError(code, reason, details)
|
|
322
326
|
});
|
|
323
327
|
},
|
|
324
328
|
get signal() {
|
|
@@ -379,12 +383,12 @@ function emit(registry, type, payload, options, appId, moduleId, connectionSigna
|
|
|
379
383
|
}, appId, moduleId);
|
|
380
384
|
}
|
|
381
385
|
function emitState(registry, connection, type, value) {
|
|
382
|
-
connection.rejections.delete(type);
|
|
386
|
+
connection.rejections.delete(type), connection.rejectionDetails?.delete(type);
|
|
383
387
|
let subject = resolveStateSubject(registry, connection, type);
|
|
384
388
|
Object.is(subject.getValue(), value) || subject.next(value);
|
|
385
389
|
}
|
|
386
390
|
function query(source, type, options, connectionSignal, resetSignal, connection) {
|
|
387
|
-
let rejection = () => new MessageBusError("REFUSED", connection.rejections.get(type));
|
|
391
|
+
let rejection = () => new MessageBusError("REFUSED", connection.rejections.get(type), connection.rejectionDetails?.get(type));
|
|
388
392
|
if (connection.rejections.has(type)) return Promise.reject(rejection());
|
|
389
393
|
let current = source.getCurrent();
|
|
390
394
|
if (current !== void 0) return Promise.resolve(current);
|
|
@@ -519,7 +523,7 @@ function migrateEventMessage(message, payload, reply) {
|
|
|
519
523
|
payload: payload(message.payload),
|
|
520
524
|
meta: message.meta,
|
|
521
525
|
reply: (value) => message.reply(reply(value)),
|
|
522
|
-
reject: (reason, code) => message.reject(reason, code),
|
|
526
|
+
reject: (reason, code, details) => message.reject(reason, code, details),
|
|
523
527
|
get signal() {
|
|
524
528
|
return message.signal;
|
|
525
529
|
}
|
|
@@ -566,8 +570,8 @@ function createClient$1(registry, record, compatibility) {
|
|
|
566
570
|
emit: (type, value) => {
|
|
567
571
|
record.abort.signal.aborted ? console.warn(`[sanity-sdk:message-bus] "${type}" not written: connection "${record.moduleId}" has closed`) : emitState(registry, record, type, compatibility.toInstalledEmission(type, value));
|
|
568
572
|
},
|
|
569
|
-
reject: (type, message) => {
|
|
570
|
-
record.abort.signal.aborted || (record.rejections.set(type, message), record.rejected$.next(type));
|
|
573
|
+
reject: (type, message, details) => {
|
|
574
|
+
record.abort.signal.aborted || (record.rejections.set(type, message), details ? (record.rejectionDetails ??= /* @__PURE__ */ new Map()).set(type, details) : record.rejectionDetails?.delete(type), record.rejected$.next(type));
|
|
571
575
|
}
|
|
572
576
|
};
|
|
573
577
|
}
|
|
@@ -637,7 +641,7 @@ function reset(registry) {
|
|
|
637
641
|
registry.resetAbort.abort();
|
|
638
642
|
for (let connection of registry.connections) {
|
|
639
643
|
for (let subject of connection.stateSubjects.values()) subject.complete();
|
|
640
|
-
connection.stateSubjects.clear(), connection.rejections.clear();
|
|
644
|
+
connection.stateSubjects.clear(), connection.rejections.clear(), connection.rejectionDetails?.clear();
|
|
641
645
|
}
|
|
642
646
|
for (let subject of registry.eventSubjects.values()) subject.complete();
|
|
643
647
|
registry.topics.clear(), registry.eventSubjects.clear(), registry.responderCounts.clear(), registry.resetAbort = new AbortController(), registry.generation += 1, mergeTopicManifest(registry, DASHBOARD_TOPIC_MANIFEST);
|
|
@@ -1799,4 +1803,4 @@ const authStore = defineStore({
|
|
|
1799
1803
|
});
|
|
1800
1804
|
export { getClientErrorApiProjectId as A, MessageBusError as B, SUBMISSION_RETRY_BASE_DELAY as C, getAuthCode as D, createLoggedInAuthState as E, authMode_exports as F, resetMessageBus as G, installMessageBus as H, isStudioConfig as I, getAuthLogger as J, workerMessages as K, DEFAULT_API_VERSION as L, getDefaultLocation as M, getTokenFromLocation as N, getCleanedUrl as O, AuthStateType as P, DEFAULT_BASE as R, INITIAL_OUTGOING_THROTTLE_TIME as S, UNVERIFIED_REVISION_RETENTION_TIME as T, isMessageBusEnvironment as U, connectMessageBus as V, isMessageBusInstalled as W, configureLogging as X, getStagingApiHost as Y, createLogger as Z, retryRead as _, getCurrentUserState as a, API_VERSION as b, getTokenState as c, appendResourceIndicator as d, createOAuthClient as f, toOAuthTokens as g, serializeTokens as h, getAuthState as i, getClientErrorApiType as j, getClientErrorApiBody as k, setAuthToken as l, postTokenRequest as m, authStore_exports as n, getIsInDashboardState as o, getOAuthOptions as p, capabilities as q, getAuthMethodState as r, getLoginUrlState as s, authStore as t, runOAuthTokenRefresh as u, DocumentInaccessibleError as v, SUBMISSION_RETRY_MAX_DELAY as w, DOCUMENT_STATE_CLEAR_DELAY as x, ACL_RETRY_MAX_DELAY as y, REQUEST_TAG_PREFIX as z };
|
|
1801
1805
|
|
|
1802
|
-
//# sourceMappingURL=authStore-
|
|
1806
|
+
//# sourceMappingURL=authStore-DkvF0SCR.js.map
|