@sanity/sdk 3.1.0 → 3.2.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.
- package/dist/_exports/_internal.d.ts +52 -21
- package/dist/_exports/_internal.d.ts.map +1 -1
- package/dist/_exports/_internal.js +10 -9
- package/dist/_exports/_internal.js.map +1 -1
- package/dist/_exports/agent.d.ts +7 -7
- package/dist/_exports/agent.d.ts.map +1 -1
- package/dist/_exports/agent.js +1 -1
- package/dist/_exports/comlink.d.ts +9 -9
- package/dist/_exports/comlink.d.ts.map +1 -1
- package/dist/_exports/comlink.js +3 -2
- package/dist/_exports/comlink.js.map +1 -1
- package/dist/_exports/dashboard.d.ts +2 -0
- package/dist/_exports/dashboard.js +2 -0
- package/dist/{authStore-C-OEkGaM.d.ts → authStore-BO2vch3I.d.ts} +516 -63
- package/dist/authStore-BO2vch3I.d.ts.map +1 -0
- package/dist/{clientStore-gUALQ0qW.js → clientStore-BI4D8HhJ.js} +124 -7
- package/dist/clientStore-BI4D8HhJ.js.map +1 -0
- package/dist/{createSanityInstance-DCePpBYW.d.ts → createSanityInstance-BQIqyGLX.d.ts} +16 -1
- package/dist/createSanityInstance-BQIqyGLX.d.ts.map +1 -0
- package/dist/{object-BwynGPRZ.js → createStateSourceAction-DdAhEfnZ.js} +2 -82
- package/dist/createStateSourceAction-DdAhEfnZ.js.map +1 -0
- package/dist/defineProperty-Bho9Ngsi.js +31 -0
- package/dist/{getNodeState-E0hjqFOo.js → getNodeState-B4nG0sjm.js} +3 -2
- package/dist/{getNodeState-E0hjqFOo.js.map → getNodeState-B4nG0sjm.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +335 -51
- package/dist/index.js.map +1 -1
- package/dist/object-CxXlSVg7.js +83 -0
- package/dist/object-CxXlSVg7.js.map +1 -0
- package/dist/topicStore-Ct7IFNtY.js +565 -0
- package/dist/topicStore-Ct7IFNtY.js.map +1 -0
- package/dist/topicStore-D0WqhQGF.d.ts +435 -0
- package/dist/topicStore-D0WqhQGF.d.ts.map +1 -0
- package/dist/{version-C90rNWaX.js → version-BcRmCiYi.js} +6 -6
- package/dist/{version-C90rNWaX.js.map → version-BcRmCiYi.js.map} +1 -1
- package/package.json +19 -18
- package/src/_exports/_internal.ts +12 -0
- package/src/_exports/dashboard.ts +36 -0
- package/src/_exports/index.ts +17 -1
- package/src/applications/applications.test-d.ts +28 -4
- package/src/applications/applications.ts +39 -14
- package/src/auth/authMode.test.ts +24 -0
- package/src/auth/authMode.ts +8 -3
- package/src/auth/authStore.ts +12 -0
- package/src/auth/authStrategy.ts +2 -0
- package/src/auth/logout.test.ts +45 -0
- package/src/auth/logout.ts +1 -0
- package/src/auth/oauth/oauthActions.test.ts +457 -0
- package/src/auth/oauth/oauthActions.ts +389 -0
- package/src/auth/oauth/oauthAuth.test.ts +206 -0
- package/src/auth/oauth/oauthAuth.ts +168 -0
- package/src/auth/oauth/pkce.test.ts +44 -0
- package/src/auth/oauth/pkce.ts +60 -0
- package/src/auth/oauth/types.ts +12 -0
- package/src/config/authConfig.ts +18 -0
- package/src/dashboard/messageBus/__fixtures__/test-topics.ts +18 -0
- package/src/dashboard/messageBus/bus.test.ts +1033 -0
- package/src/dashboard/messageBus/bus.ts +1246 -0
- package/src/dashboard/messageBus/store.test.ts +142 -0
- package/src/dashboard/messageBus/store.ts +74 -0
- package/src/dashboard/messageBus/topicStore.test.ts +172 -0
- package/src/dashboard/messageBus/topicStore.ts +184 -0
- package/src/dashboard/messageBus/topics.test.ts +71 -0
- package/src/dashboard/messageBus/topics.ts +260 -0
- package/src/document/actions.ts +3 -3
- package/src/document/applyDocumentActions.ts +3 -3
- package/src/document/documentStore.ts +12 -12
- package/src/document/processMutations.ts +58 -22
- package/src/installations/installations.test-d.ts +3 -3
- package/src/installations/installations.ts +2 -19
- package/src/projection/getProjectionState.ts +2 -2
- package/src/projection/resolveProjection.ts +2 -2
- package/src/query/queryStore.ts +3 -3
- package/src/typegen/defineProjection.test.ts +17 -0
- package/src/typegen/defineProjection.ts +19 -0
- package/src/typegen/groqCompat.ts +122 -0
- package/src/typegen/resolve.ts +37 -0
- package/src/utils/createGroqSearchFilter.test.ts +8 -0
- package/src/utils/createGroqSearchFilter.ts +6 -3
- package/dist/authStore-C-OEkGaM.d.ts.map +0 -1
- package/dist/clientStore-gUALQ0qW.js.map +0 -1
- package/dist/createSanityInstance-DCePpBYW.d.ts.map +0 -1
- package/dist/object-BwynGPRZ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStateSourceAction-DdAhEfnZ.js","names":[],"sources":["../src/config/sanityConfig.ts","../src/releases/utils/isReleasePerspective.ts","../src/utils/getEnv.ts","../src/store/createStoreState.ts","../src/store/defineStore.ts","../src/store/createStoreInstance.ts","../src/store/createActionBinder.ts","../src/store/createStateSourceAction.ts"],"sourcesContent":["import {type ClientPerspective, type StackablePerspective} from '@sanity/client'\n\nimport {type AuthConfig} from './authConfig'\n\n/**\n * A minimal Observable-compatible interface for subscribing to token changes.\n * Any object with a `subscribe` method that follows this contract will work,\n * including RxJS Observables. This avoids coupling the SDK to a specific\n * reactive library.\n *\n * @public\n */\nexport interface TokenSource {\n /** Subscribe to token emissions. Emits `null` when logged out. */\n subscribe(observer: {next: (token: string | null) => void}): {unsubscribe(): void}\n}\n\n/**\n * Studio-specific configuration for the SDK.\n * When present, the SDK operates in studio mode and derives auth from the\n * provided token source instead of discovering tokens independently.\n *\n * @public\n */\nexport interface StudioConfig {\n /**\n * Whether the Studio has already determined the user is authenticated.\n * When `true` and the token source emits `null`, the SDK infers\n * cookie-based auth is in use rather than transitioning to logged-out.\n */\n authenticated?: boolean\n /** Reactive auth token source from the Studio's auth store. */\n auth?: {\n /**\n * A reactive token source. The SDK subscribes and stays in sync — the\n * Studio is the single authority for auth and handles token refresh.\n *\n * Optional because older Studios may not expose it. When absent, the\n * SDK falls back to localStorage/cookie discovery.\n */\n token?: TokenSource\n }\n}\n\n/**\n * Represents the minimal configuration required to identify a Sanity project.\n * @public\n */\nexport interface ProjectHandle<TProjectId extends string = string> {\n projectId?: TProjectId\n}\n\n/**\n * @public\n */\nexport type ReleasePerspective = {\n releaseName: string\n excludedPerspectives?: StackablePerspective[]\n}\n\n/**\n * @public\n */\nexport interface PerspectiveHandle {\n perspective?: ClientPerspective | ReleasePerspective\n}\n\n/**\n * @public\n */\nexport interface DatasetHandle<TDataset extends string = string, TProjectId extends string = string>\n extends ProjectHandle<TProjectId>, PerspectiveHandle {\n dataset?: TDataset\n /**\n * @beta\n * Explicit resource to use. On an individual operation this overrides any default;\n * on a `SanityConfig` it becomes the instance's default resource. Unlike\n * `projectId`/`dataset`, this can also be a media library or canvas resource.\n */\n resource?: DocumentResource\n}\n\n/**\n * Identifies a specific document type within a Sanity dataset and project.\n * Includes `projectId`, `dataset`, and `documentType`.\n * Optionally includes a `documentId` and `liveEdit` flag.\n * @public\n */\nexport interface DocumentTypeHandle<\n TDocumentType extends string = string,\n TDataset extends string = string,\n TProjectId extends string = string,\n> extends DatasetHandle<TDataset, TProjectId> {\n documentId?: string\n documentType: TDocumentType\n /**\n * Indicates whether this document uses liveEdit mode.\n * When `true`, the document does not use the draft/published model and edits are applied directly to the document.\n * @see https://www.sanity.io/docs/content-lake/drafts#ca0663a8f002\n */\n liveEdit?: boolean\n}\n\n/**\n * Uniquely identifies a specific document within a Sanity dataset and project.\n * Includes `projectId`, `dataset`, `documentType`, and the required `documentId`.\n * Commonly used by document-related hooks and components to reference a document without fetching its full content initially.\n * @public\n */\nexport interface DocumentHandle<\n TDocumentType extends string = string,\n TDataset extends string = string,\n TProjectId extends string = string,\n> extends DocumentTypeHandle<TDocumentType, TDataset, TProjectId> {\n documentId: string\n}\n\n/**\n * Identifies a release within a Sanity dataset and project. `releaseId` is the\n * `name` parameter on the release document (e.g. `{name: 'r41035a4'}`).\n * The underlying release document ID is `_.releases.<releaseId>`.\n * It's also the `id` parameter sent to the Actions API.\n * (This type doesn't need to have ProjectId / Dataset generics since it's always the same shape)\n * @beta\n */\nexport interface ReleaseHandle extends DatasetHandle {\n releaseId: string\n}\n\n/**\n * Represents the complete configuration for a Sanity SDK instance\n * @public\n */\nexport interface SanityConfig extends DatasetHandle, PerspectiveHandle {\n /**\n * Authentication configuration for the instance\n */\n auth?: AuthConfig\n /**\n * Studio configuration provided by a Sanity Studio workspace.\n * When present, the SDK operates in studio mode and derives auth from the\n * workspace's reactive token source — no manual configuration needed.\n *\n * @remarks Typically set automatically by `SanityApp` when it detects an\n * `SDKStudioContext` provider. Can also be set explicitly for programmatic use.\n */\n studio?: StudioConfig\n}\n\n/**\n * A document resource can be used for querying.\n * This will soon be the default way to identify where you are querying from.\n *\n * @beta\n */\nexport type DocumentResource = DatasetResource | MediaLibraryResource | CanvasResource\n\n/**\n * @beta\n */\nexport type DatasetResource = {projectId: string; dataset: string}\n\n/**\n * @beta\n */\nexport type MediaLibraryResource = {mediaLibraryId: string}\n\n/**\n * @beta\n */\nexport type CanvasResource = {canvasId: string}\n\n/**\n * @beta\n */\nexport function isDatasetResource(resource: DocumentResource): resource is DatasetResource {\n return 'projectId' in resource && 'dataset' in resource\n}\n\n/**\n * @beta\n */\nexport function isMediaLibraryResource(\n resource: DocumentResource,\n): resource is MediaLibraryResource {\n return 'mediaLibraryId' in resource\n}\n\n/**\n * @beta\n */\nexport function isCanvasResource(resource: DocumentResource): resource is CanvasResource {\n return 'canvasId' in resource\n}\n","import {type PerspectiveHandle, type ReleasePerspective} from '../../config/sanityConfig'\n\nexport const isReleasePerspective = (\n perspective: PerspectiveHandle['perspective'],\n): perspective is ReleasePerspective => {\n return typeof perspective === 'object' && perspective !== null && 'releaseName' in perspective\n}\n","// Local type declaration for Remix\ntype WindowWithEnv = Window &\n typeof globalThis & {\n ENV?: Record<string, unknown>\n }\n\ntype KnownEnvVar = 'DEV' | 'PKG_VERSION'\n\nexport function getEnv(key: KnownEnvVar): unknown {\n if (typeof import.meta !== 'undefined' && import.meta.env) {\n // Vite environment variables\n return (import.meta.env as unknown as Record<string, unknown>)[key]\n } else if (typeof process !== 'undefined' && process.env) {\n // Node.js or server-side environment variables\n return process.env[key]\n } else if (typeof window !== 'undefined' && (window as WindowWithEnv).ENV) {\n // Remix-style client-side environment variables\n return (window as WindowWithEnv).ENV?.[key]\n }\n return undefined\n}\n","import {Observable} from 'rxjs'\nimport {devtools, type DevtoolsOptions} from 'zustand/middleware'\nimport {createStore} from 'zustand/vanilla'\n\n/**\n * Represents a reactive store state container with multiple access patterns\n */\nexport interface StoreState<TState> {\n /**\n * Gets the current state value\n *\n * @remarks\n * This is a direct synchronous accessor that doesn't trigger subscriptions\n */\n get: () => TState\n\n /**\n * Updates the store state\n * @param name - Action name for devtools tracking\n * @param updatedState - New state value or updater function\n *\n * @remarks\n * When providing a partial object, previous top-level keys not included in\n * the update will be preserved.\n */\n set: (name: string, updatedState: Partial<TState> | ((s: TState) => Partial<TState>)) => void\n\n /**\n * Observable stream of state changes\n * @remarks\n * - Emits immediately with current state on subscription\n * - Shares underlying subscription between observers\n * - Only emits when state reference changes\n * - Completes when store is disposed\n */\n observable: Observable<TState>\n}\n\n/**\n * Creates a reactive store state container with multiple access patterns\n * @param initialState - Initial state value for the store\n * @param devToolsOptions - Configuration for Zustand devtools integration\n * @returns StoreState instance with get/set/observable interface\n *\n * @example\n * ```typescript\n * // Create a simple counter store\n * const counterStore = createStoreState({ count: 0 });\n *\n * // Update state\n * counterStore.set('increment', { count: 1 });\n *\n * // Observe changes\n * counterStore.observable.subscribe(console.log);\n * ```\n *\n * @remarks\n * Uses Zustand for state management under the hood with RxJS for observable interface.\n * Designed to work with both imperative and reactive programming patterns.\n */\nexport function createStoreState<TState>(\n initialState: TState,\n devToolsOptions?: DevtoolsOptions,\n): StoreState<TState> {\n // Create underlying Zustand store with devtools integration\n const store = createStore<TState>()(devtools(() => initialState, devToolsOptions))\n\n return {\n get: store.getState,\n set: (actionKey, updatedState) => {\n const currentState = store.getState()\n const nextState =\n typeof updatedState === 'function' ? updatedState(currentState) : updatedState\n\n // Optimization: Skip update if state reference remains the same\n if (currentState !== nextState) {\n store.setState(nextState, false, actionKey)\n }\n },\n observable: new Observable((observer) => {\n // Emit current state immediately on subscription\n const emit = () => observer.next(store.getState())\n emit()\n\n // Subscribe to Zustand store changes\n const unsubscribe = store.subscribe(emit)\n\n // Cleanup when observable unsubscribed\n return () => unsubscribe()\n }),\n }\n}\n","import {type SanityInstance} from './createSanityInstance'\nimport {type StoreState} from './createStoreState'\n\n/**\n * Context object provided to store initialization functions\n */\nexport interface StoreContext<TState, TKey = unknown> {\n /**\n * Sanity instance associated with this store\n *\n * @remarks\n * Provides access to the Sanity configuration and instance lifecycle methods\n */\n instance: SanityInstance\n\n /**\n * Reactive store state management utilities\n *\n * @remarks\n * Contains methods for getting/setting state and observing changes\n */\n state: StoreState<TState>\n\n /**\n * The key used to instantiate the store.\n */\n key: TKey\n}\n\n/**\n * Defines the structure and behavior of a store\n *\n * @remarks\n * Stores are isolated state containers that can be associated with Sanity instances.\n * Each store definition creates a separate state instance per composite key.\n */\nexport interface StoreDefinition<TState, TKey = unknown> {\n /**\n * Unique name for the store\n *\n * @remarks\n * Used for debugging, devtools integration, and store identification\n */\n name: string\n\n /**\n * Creates the initial state for the store\n * @param instance - Sanity instance the store is being created for\n * @returns Initial state value\n *\n * @remarks\n * Called when a new store instance is created. Can use Sanity instance\n * configuration to determine initial state.\n */\n getInitialState: (instance: SanityInstance, key: TKey) => TState\n\n /**\n * Optional initialization function\n * @param context - Store context with state and instance access\n * @returns Optional cleanup function for store disposal\n *\n * @remarks\n * Use this for:\n * - Setting up event listeners\n * - Initial data fetching\n * - Connecting external services\n *\n * Return a cleanup function to:\n * - Remove event listeners\n * - Cancel pending operations\n * - Dispose external connections\n */\n initialize?: (context: StoreContext<TState, TKey>) => (() => void) | undefined\n}\n\n/**\n * Typescript helper function for creating store definitions\n *\n * @param storeDefinition - Configuration object defining the store\n * @returns The finalized store definition\n */\nexport function defineStore<TState, TKey = unknown>(\n storeDefinition: StoreDefinition<TState, TKey>,\n): StoreDefinition<TState, TKey> {\n return storeDefinition\n}\n","import {getEnv} from '../utils/getEnv'\nimport {type SanityInstance} from './createSanityInstance'\nimport {createStoreState, type StoreState} from './createStoreState'\nimport {type StoreDefinition} from './defineStore'\n\n/**\n * Represents a running instance of a store with its own state and lifecycle\n *\n * @remarks\n * Each StoreInstance is tied to a specific SanityInstance, manages its own state,\n * and can be independently disposed when no longer needed.\n */\nexport interface StoreInstance<TState> {\n /**\n * Access to the reactive state container for this store instance\n */\n state: StoreState<TState>\n\n /**\n * Checks if this store instance has been disposed\n * @returns Boolean indicating disposed state\n */\n isDisposed: () => void\n\n /**\n * Cleans up this store instance and runs any initialization cleanup functions\n * @remarks Triggers the cleanup function returned from the initialize method\n */\n dispose: () => void\n}\n\n/**\n * Creates a new instance of a store from a store definition\n *\n * @param instance - The Sanity instance this store will be associated with\n * @param storeDefinition - The store definition containing initial state and initialization logic\n * @returns A store instance with state management and lifecycle methods\n *\n * @remarks\n * The store instance maintains its own state that is scoped to the given Sanity instance.\n * If the store definition includes an initialize function, it will be called during\n * instance creation, and its cleanup function will be called during disposal.\n *\n * @example\n * ```ts\n * const counterStore = defineStore({\n * name: 'Counter',\n * getInitialState: () => ({ count: 0 }),\n * initialize: ({state}) => {\n * console.log('Counter store initialized')\n * return () => console.log('Counter store disposed')\n * }\n * })\n *\n * const instance = createStoreInstance(sanityInstance, counterStore)\n * // Later when done with the store:\n * instance.dispose()\n * ```\n */\nexport function createStoreInstance<TState, TKey extends {name: string}>(\n instance: SanityInstance,\n key: TKey,\n {name, getInitialState, initialize}: StoreDefinition<TState, TKey>,\n): StoreInstance<TState> {\n const state = createStoreState(getInitialState(instance, key), {\n enabled: !!getEnv('DEV'),\n name: `${name}-${key.name}`,\n })\n const dispose = initialize?.({state, instance, key})\n const disposed = {current: false}\n\n return {\n state,\n dispose: () => {\n if (disposed.current) return\n disposed.current = true\n dispose?.()\n },\n isDisposed: () => disposed.current,\n }\n}\n","import {type ClientPerspective} from '@sanity/client'\n\nimport {\n type DatasetHandle,\n type DocumentResource,\n isCanvasResource,\n isDatasetResource,\n isMediaLibraryResource,\n type ReleasePerspective,\n} from '../config/sanityConfig'\nimport {isReleasePerspective} from '../releases/utils/isReleasePerspective'\nimport {type SanityInstance} from './createSanityInstance'\nimport {createStoreInstance, type StoreInstance} from './createStoreInstance'\nimport {type StoreState} from './createStoreState'\nimport {type StoreContext, type StoreDefinition} from './defineStore'\n\nexport interface BoundResourceKey {\n name: string\n resource: DocumentResource\n}\nexport interface BoundPerspectiveKey extends BoundResourceKey {\n perspective: ClientPerspective | ReleasePerspective\n}\n/**\n * Defines a store action that operates on a specific state type\n */\nexport type StoreAction<TState, TParams extends unknown[], TReturn, TKey = unknown> = (\n context: StoreContext<TState, TKey>,\n ...params: TParams\n) => TReturn\n\n/**\n * Represents a store action that has been bound to a specific store instance\n */\nexport type BoundStoreAction<_TState, TParams extends unknown[], TReturn> = (\n instance: SanityInstance,\n ...params: TParams\n) => TReturn\n\n/**\n * Creates an action binder function that uses the provided key function\n * to determine how store instances are shared between Sanity instances\n *\n * @param keyFn - Function that generates a key from a Sanity config\n * @returns A function that binds store actions to Sanity instances\n *\n * @remarks\n * Action binders determine how store instances are shared across multiple\n * Sanity instances. The key function determines which instances share state.\n *\n * @example\n * ```ts\n * // Create a custom binder that uses a tenant ID for isolation\n * const bindActionByTenant = createActionBinder(config => config.tenantId || 'default')\n *\n * // Use the custom binder with a store definition\n * const getTenantUsers = bindActionByTenant(\n * userStore,\n * ({state}) => state.get().users\n * )\n * ```\n */\nexport function createActionBinder<\n TKey extends {name: string},\n TKeyParams extends unknown[] = unknown[],\n>(keyFn: (instance: SanityInstance, ...params: TKeyParams) => TKey) {\n const instanceRegistry = new Map<string, Set<string>>()\n const storeRegistry = new Map<string, StoreInstance<unknown>>()\n\n /**\n * Binds a store action to a store definition\n *\n * @param storeDefinition - The store definition\n * @param action - The action to bind\n * @returns A function that executes the action with a Sanity instance\n */\n return function bindAction<TState, TParams extends TKeyParams, TReturn>(\n storeDefinition: StoreDefinition<TState, TKey>,\n action: StoreAction<TState, TParams, TReturn, TKey>,\n ): BoundStoreAction<TState, TParams, TReturn> {\n return function boundAction(instance: SanityInstance, ...params: TParams) {\n const key = keyFn(instance, ...params)\n const compositeKey = storeDefinition.name + (key.name ? `:${key.name}` : '')\n\n // Get or create instance set for this composite key\n let instances = instanceRegistry.get(compositeKey)\n if (!instances) {\n instances = new Set<string>()\n instanceRegistry.set(compositeKey, instances)\n }\n\n // Register instance for disposal tracking\n if (!instances.has(instance.instanceId)) {\n instances.add(instance.instanceId)\n instance.onDispose(() => {\n instances.delete(instance.instanceId)\n\n // Clean up when last instance is disposed\n if (instances.size === 0) {\n storeRegistry.get(compositeKey)?.dispose()\n storeRegistry.delete(compositeKey)\n instanceRegistry.delete(compositeKey)\n }\n })\n }\n\n // Get or create store instance\n let storeInstance = storeRegistry.get(compositeKey)\n if (!storeInstance) {\n storeInstance = createStoreInstance(instance, key, storeDefinition)\n storeRegistry.set(compositeKey, storeInstance)\n }\n\n // Execute action with store context\n return action({instance, state: storeInstance.state as StoreState<TState>, key}, ...params)\n }\n }\n}\n\nconst createResourceKey = (\n instance: SanityInstance,\n resource?: DocumentResource,\n): BoundResourceKey => {\n let name: string | undefined\n let resourceForKey: DocumentResource | undefined\n // A per-call resource wins; otherwise use the instance's default resource.\n const effectiveResource = resource ?? instance.config.resource\n if (effectiveResource) {\n resourceForKey = effectiveResource\n if (isDatasetResource(effectiveResource)) {\n name = `${effectiveResource.projectId}.${effectiveResource.dataset}`\n } else if (isMediaLibraryResource(effectiveResource)) {\n name = `media-library:${effectiveResource.mediaLibraryId}`\n } else if (isCanvasResource(effectiveResource)) {\n name = `canvas:${effectiveResource.canvasId}`\n } else {\n throw new Error(`Received invalid resource: ${JSON.stringify(effectiveResource)}`)\n }\n return {name, resource: resourceForKey}\n }\n\n // `projectId`/`dataset` on the config are shorthand for a dataset resource.\n const {projectId, dataset} = instance.config\n if (!projectId || !dataset) {\n throw new Error('This API requires a project ID and dataset configured.')\n }\n return {name: `${projectId}.${dataset}`, resource: {projectId, dataset}}\n}\n\n/**\n * Binds an action to a store that's scoped to a specific document resource.\n **/\nexport const bindActionByResource = createActionBinder<\n BoundResourceKey,\n // `resource` is optional because it falls back to the instance config in\n // `createResourceKey` — see the note there on why that fallback still exists.\n [{resource?: DocumentResource}, ...unknown[]]\n>((instance, {resource}) => {\n return createResourceKey(instance, resource)\n})\n\n/**\n * Binds an action to a store that's scoped to a specific document resource and perspective.\n *\n * @remarks\n * This creates actions that operate on state isolated to a specific document resource and perspective.\n * Different document resources and perspectives will have separate states.\n *\n * This is mostly useful for stores that do batch fetching operations, since the query store\n * can isolate single queries by perspective.\n *\n * @throws Error if resource or perspective is missing from the Sanity instance config\n *\n * @example\n * ```ts\n * // Define a store\n * const documentStore = defineStore<DocumentState>({\n * name: 'Document',\n * getInitialState: () => ({ documents: {} }),\n * // ...\n * })\n *\n * // Create resource-and-perspective-specific actions\n * export const fetchDocuments = bindActionByResourceAndPerspective(\n * documentStore,\n * ({instance, state}, documentId) => {\n * // This state is isolated to the specific document resource and perspective\n * // ...fetch logic...\n * }\n * )\n *\n * // Usage\n * fetchDocument(sanityInstance, 'doc123')\n * ```\n */\nexport const bindActionByResourceAndPerspective = createActionBinder<\n BoundPerspectiveKey,\n [DatasetHandle, ...unknown[]]\n>((instance, options): BoundPerspectiveKey => {\n const {resource, perspective} = options\n // Same trade-off as the resource fallback in `createResourceKey`: configured once on the\n // instance rather than passed to every call. Kept for the same reason.\n const utilizedPerspective = perspective ?? instance.config.perspective ?? 'drafts'\n let perspectiveKey: string\n if (isReleasePerspective(utilizedPerspective)) {\n perspectiveKey = utilizedPerspective.releaseName\n } else if (typeof utilizedPerspective === 'string') {\n perspectiveKey = utilizedPerspective\n } else {\n // \"StackablePerspective\", shouldn't be a common case, but just in case\n perspectiveKey = JSON.stringify(utilizedPerspective)\n }\n const sourceKey = createResourceKey(instance, resource)\n\n return {\n name: `${sourceKey.name}:${perspectiveKey}`,\n resource: sourceKey.resource,\n perspective: utilizedPerspective,\n }\n})\n\n/**\n * Binds an action to a global store that's shared across all Sanity instances\n *\n * @remarks\n * This creates actions that operate on state shared globally across all Sanity instances.\n * Use this for features like authentication where the state should be the same\n * regardless of which project or dataset is being used.\n *\n * @example\n * ```ts\n * // Define a store\n * const authStore = defineStore<AuthState>({\n * name: 'Auth',\n * getInitialState: () => ({\n * user: null,\n * isAuthenticated: false\n * }),\n * // ...\n * })\n *\n * // Create global actions\n * export const getCurrentUser = bindActionGlobally(\n * authStore,\n * ({state}) => state.get().user\n * )\n *\n * export const login = bindActionGlobally(\n * authStore,\n * ({state, instance}, credentials) => {\n * // Login logic that affects global state\n * // ...\n * }\n * )\n *\n * // Usage with any instance\n * getCurrentUser(sanityInstance)\n * ```\n */\nexport const bindActionGlobally = createActionBinder((..._rest) => ({name: 'global'}))\n","import {defer, distinctUntilChanged, finalize, map, Observable, shareReplay, skip} from 'rxjs'\n\nimport {type StoreAction} from './createActionBinder'\nimport {type SanityInstance} from './createSanityInstance'\nimport {type StoreContext} from './defineStore'\n\n/**\n * Represents a reactive state source that provides synchronized access to store data\n *\n * @remarks\n * Designed to work with React's useSyncExternalStore hook. Provides three ways to access data:\n * 1. `getCurrent()` for synchronous current value access\n * 2. `subscribe()` for imperative change notifications\n * 3. `observable` for reactive stream access\n *\n * @public\n */\nexport interface StateSource<T> {\n /**\n * Subscribes to state changes with optional callback\n * @param onStoreChanged - Called whenever relevant state changes occur\n * @returns Unsubscribe function to clean up the subscription\n */\n subscribe: (onStoreChanged?: () => void) => () => void\n\n /**\n * Gets the current derived state value\n *\n * @remarks\n * Safe to call without subscription. Will always return the latest value\n * based on the current store state and selector parameters.\n */\n getCurrent: () => T\n\n /**\n * Observable stream of state values\n *\n * @remarks\n * Shares a single underlying subscription between all observers. Emits:\n * - Immediately with current value on subscription\n * - On every relevant state change\n * - Errors if selector throws\n */\n observable: Observable<T>\n}\n\n/**\n * Context passed to selectors when deriving state\n *\n * @remarks\n * Provides access to both the current state value and the Sanity instance,\n * allowing selectors to use configuration values when computing derived state.\n * The context is memoized for each state object and instance combination\n * to optimize performance and prevent unnecessary recalculations.\n *\n * @example\n * ```ts\n * // Using both state and instance in a selector (psuedo example)\n * const getUserByProjectId = createStateSourceAction(\n * ({ state, instance }: SelectorContext<UsersState>, options?: ProjectHandle) => {\n * const allUsers = state.users\n * const projectId = options?.projectId ?? instance.config.projectId\n * return allUsers.filter(user => user.projectId === projectId)\n * }\n * )\n * ```\n */\nexport interface SelectorContext<TState> {\n /**\n * The current state object from the store\n */\n state: TState\n\n /**\n * The Sanity instance associated with this state\n */\n instance: SanityInstance\n}\n\n/**\n * Function type for selecting derived state from store state and parameters\n * @public\n */\nexport type Selector<TState, TParams extends unknown[], TReturn> = (\n context: SelectorContext<TState>,\n ...params: TParams\n) => TReturn\n\n/**\n * Configuration options for creating a state source action\n */\ninterface StateSourceOptions<TState, TParams extends unknown[], TReturn, TKey> {\n /**\n * Selector function that derives the desired value from store state\n *\n * @remarks\n * Will be called on every store change. Should be pure function.\n * Thrown errors will propagate to observable subscribers.\n */\n selector: Selector<TState, TParams, TReturn>\n\n /**\n * Optional setup/cleanup handler for subscriptions\n *\n * @param context - Store context containing state and instance\n * @param params - Action parameters provided during invocation\n * @returns Optional cleanup function called when subscription ends\n */\n onSubscribe?: (context: StoreContext<TState, TKey>, ...params: TParams) => void | (() => void)\n\n /**\n * Equality function to prevent unnecessary updates\n */\n isEqual?: (prev: TReturn, curr: TReturn) => boolean\n}\n\n/**\n * Creates a state source action that generates StateSource instances\n *\n * @remarks\n * The returned action can be bound to a store using createActionBinder.\n * When invoked, returns a StateSource that stays synchronized with the store.\n *\n * Key performance features:\n * - Memoizes selector contexts to prevent redundant object creation\n * - Only runs selectors when the underlying state changes\n *\n * For complex data transformations, consider using memoized selectors\n * (like those from Reselect) to prevent expensive recalculations.\n *\n * @example\n * ```ts\n * // Create a simple counter source\n * const getCount = createStateSourceAction(({state}: SelectorContext<CounterState>) => state.count)\n * ```\n *\n * @example\n * ```ts\n * // Create a parameterized source with setup/cleanup\n * const getItem = createStateSourceAction({\n * selector: ({state}, index: number) => state.items[index],\n * onSubscribe: (context, index) => {\n * trackItemSubscription(index)\n * return () => untrackItem(index)\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * // Binding a state source to a specific store\n * const documentStore = defineStore<DocumentState>({\n * name: 'Documents',\n * getInitialState: () => ({ documents: {} }),\n * // ...\n * })\n *\n * const getDocument = bindActionByResource(\n * documentStore,\n * createStateSourceAction(({state}, documentId: string) => state.documents[documentId])\n * )\n *\n * // Usage\n * const documentSource = getDocument(sanityInstance, 'doc123')\n * const doc = documentSource.getCurrent()\n * const subscription = documentSource.observable.subscribe(updatedDoc => {\n * console.log('Document changed:', updatedDoc)\n * })\n * ```\n */\nexport function createStateSourceAction<TState, TParams extends unknown[], TReturn, TKey = unknown>(\n options: Selector<TState, TParams, TReturn> | StateSourceOptions<TState, TParams, TReturn, TKey>,\n): StoreAction<TState, TParams, StateSource<TReturn>, TKey> {\n const selector = typeof options === 'function' ? options : options.selector\n const subscribeHandler = options && 'onSubscribe' in options ? options.onSubscribe : undefined\n const isEqual = options && 'isEqual' in options ? (options.isEqual ?? Object.is) : Object.is\n const selectorContextCache = new WeakMap<\n object,\n WeakMap<SanityInstance, SelectorContext<TState>>\n >()\n\n /**\n * The state source action implementation\n * @param context - Store context providing access to state and instance\n * @param params - Parameters provided when invoking the bound action\n */\n function stateSourceAction(context: StoreContext<TState, TKey>, ...params: TParams) {\n const {state, instance} = context\n\n const getCurrent = (currentState: TState) => {\n if (typeof currentState !== 'object' || currentState === null) {\n throw new Error(\n `Expected store state to be an object but got \"${typeof currentState}\" instead`,\n )\n }\n\n let instanceCache = selectorContextCache.get(currentState)\n if (!instanceCache) {\n instanceCache = new WeakMap<SanityInstance, SelectorContext<TState>>()\n selectorContextCache.set(currentState, instanceCache)\n }\n let selectorContext = instanceCache.get(instance)\n if (!selectorContext) {\n selectorContext = {state: currentState, instance}\n instanceCache.set(instance, selectorContext)\n }\n return selector(selectorContext, ...params)\n }\n\n // `state.observable` will emit the current value immediately and\n // hence we inherit the same behavior here.\n let values = state.observable.pipe(map(getCurrent), distinctUntilChanged(isEqual))\n\n if (subscribeHandler) {\n values = withSubscribeHook(values, () => subscribeHandler(context, ...params))\n }\n\n // Share but replay the latest value so every subscriber gets an\n // initial synchronous emission, matching `state.observable`. That keeps\n // `skip(1)` in `subscribe()` aligned with \"skip current snapshot\" rather than\n // silently eating the first real update after multicasting.\n const sharedValues = values.pipe(shareReplay({bufferSize: 1, refCount: true}))\n\n const subscribe = (onStoreChanged?: () => void) => {\n const subscription = sharedValues.pipe(skip(1)).subscribe({\n next: () => onStoreChanged?.(),\n // Propagate selector errors to both subscription types\n error: () => onStoreChanged?.(),\n })\n\n return () => {\n subscription.unsubscribe()\n }\n }\n\n return {\n getCurrent: () => getCurrent(state.get()),\n subscribe,\n observable: sharedValues,\n }\n }\n\n return stateSourceAction\n}\n\n/**\n * Creates a new Observable which wraps an existing Observable which will invoke\n * the function when a new subscriber appears.\n */\nfunction withSubscribeHook<T>(obs: Observable<T>, fn: () => void | (() => void)): Observable<T> {\n return defer(() => {\n const cleanup = fn()\n return cleanup ? obs.pipe(finalize(() => cleanup())) : obs\n })\n}\n"],"mappings":";;;;;;;AA+KA,SAAgB,kBAAkB,UAAyD;CACzF,OAAO,eAAe,YAAY,aAAa;AACjD;;;;AAKA,SAAgB,uBACd,UACkC;CAClC,OAAO,oBAAoB;AAC7B;;;;AAKA,SAAgB,iBAAiB,UAAwD;CACvF,OAAO,cAAc;AACvB;AC/LA,MAAa,wBACX,gBAEO,OAAO,eAAgB,cAAY,eAAwB,iBAAiB;ACGrF,SAAgB,OAAO,KAA2B;CAChD,IAA0C,YAAY,KAEpD,OAAQ,YAAY,IAA2C;CAC1D,IAAI,OAAO,UAAY,OAAe,QAAQ,KAEnD,OAA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,GAAG,MAAM;EAC5C,GAII,SAAS,MAAM,WAAW,KAAK,IAAI,UAAU,GAAG,qBAAqB,OAAO,CAAC;EAEjF,AAAI,qBACF,SAAS,kBAAkB,cAAc,iBAAiB,SAAS,GAAG,MAAM,CAAC;EAO/E,IAAM,eAAe,OAAO,KAAK,YAAY;GAAC,YAAY;GAAG,UAAU;EAAI,CAAC,CAAC,GAEvE,aAAa,mBAAgC;GACjD,IAAM,eAAe,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU;IACxD,YAAY,iBAAiB;IAE7B,aAAa,iBAAiB;GAChC,CAAC;GAED,aAAa;IACX,aAAa,YAAY;GAC3B;EACF;EAEA,OAAO;GACL,kBAAkB,WAAW,MAAM,IAAI,CAAC;GACxC;GACA,YAAY;EACd;CACF;CAEA,OAAO;AACT;;;;;AAMA,SAAS,kBAAqB,KAAoB,IAA8C;CAC9F,OAAO,YAAY;EACjB,IAAM,UAAU,GAAG;EACnB,OAAO,UAAU,IAAI,KAAK,eAAe,QAAQ,CAAC,CAAC,IAAI;CACzD,CAAC;AACH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function _typeof(o) {
|
|
2
|
+
"@babel/helpers - typeof";
|
|
3
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
4
|
+
return typeof o;
|
|
5
|
+
} : function(o) {
|
|
6
|
+
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7
|
+
}, _typeof(o);
|
|
8
|
+
}
|
|
9
|
+
function toPrimitive(t, r) {
|
|
10
|
+
if (_typeof(t) != "object" || !t) return t;
|
|
11
|
+
var e = t[Symbol.toPrimitive];
|
|
12
|
+
if (e !== void 0) {
|
|
13
|
+
var i = e.call(t, r || "default");
|
|
14
|
+
if (_typeof(i) != "object") return i;
|
|
15
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
16
|
+
}
|
|
17
|
+
return (r === "string" ? String : Number)(t);
|
|
18
|
+
}
|
|
19
|
+
function toPropertyKey(t) {
|
|
20
|
+
var i = toPrimitive(t, "string");
|
|
21
|
+
return _typeof(i) == "symbol" ? i : i + "";
|
|
22
|
+
}
|
|
23
|
+
function _defineProperty(e, r, t) {
|
|
24
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
25
|
+
value: t,
|
|
26
|
+
enumerable: !0,
|
|
27
|
+
configurable: !0,
|
|
28
|
+
writable: !0
|
|
29
|
+
}) : e[r] = t, e;
|
|
30
|
+
}
|
|
31
|
+
export { _defineProperty as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as bindActionGlobally, o as defineStore, t as createStateSourceAction } from "./createStateSourceAction-DdAhEfnZ.js";
|
|
2
|
+
import { t as isDeepEqual } from "./object-CxXlSVg7.js";
|
|
2
3
|
import { n as setCleanupTimeout } from "./setCleanupTimeout-BiM6q1KF.js";
|
|
3
4
|
import { createSelector } from "reselect";
|
|
4
5
|
import { createNode } from "@sanity/comlink";
|
|
@@ -63,4 +64,4 @@ const getOrCreateNode$1 = ({ state }, options) => {
|
|
|
63
64
|
}));
|
|
64
65
|
export { getOrCreateNode as n, releaseNode as r, getNodeState as t };
|
|
65
66
|
|
|
66
|
-
//# sourceMappingURL=getNodeState-
|
|
67
|
+
//# sourceMappingURL=getNodeState-B4nG0sjm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodeState-
|
|
1
|
+
{"version":3,"file":"getNodeState-B4nG0sjm.js","names":["getOrCreateNode","releaseNode","unboundReleaseNode","unboundGetOrCreateNode"],"sources":["../src/comlink/node/actions/getOrCreateNode.ts","../src/comlink/node/actions/releaseNode.ts","../src/comlink/node/comlinkNodeStore.ts","../src/comlink/node/getNodeState.ts"],"sourcesContent":["import {createNode, type Node, type NodeInput} from '@sanity/comlink'\n\nimport {type StoreContext} from '../../../store/defineStore'\nimport {isDeepEqual} from '../../../utils/object'\nimport {type FrameMessage, type WindowMessage} from '../../types'\nimport {type ComlinkNodeState} from '../comlinkNodeStore'\n\nexport const getOrCreateNode = (\n {state}: StoreContext<ComlinkNodeState>,\n options: NodeInput,\n): Node<WindowMessage, FrameMessage> => {\n const nodes = state.get().nodes\n const existing = nodes.get(options.name)\n\n // limit nodes to one per name\n if (existing) {\n if (!isDeepEqual(existing.options, options)) {\n throw new Error(`Node \"${options.name}\" already exists with different options`)\n }\n\n existing.node.start()\n return existing.node\n }\n\n const node: Node<WindowMessage, FrameMessage> = createNode(options)\n node.start()\n\n // Subscribe to status changes\n const statusUnsub = node.onStatus((status) => {\n const currentNodes = state.get().nodes\n const currentEntry = currentNodes.get(options.name)\n if (!currentEntry) return\n const updatedEntry = {\n ...currentEntry,\n status,\n }\n state.set('updateNodeStatus', {\n nodes: new Map(currentNodes).set(options.name, updatedEntry),\n })\n })\n\n // Set up initial entry with status, error, and statusUnsub\n const entry = {\n node,\n options,\n status: 'idle' as const,\n statusUnsub,\n }\n\n nodes.set(options.name, entry)\n\n state.set('createNode', {nodes})\n\n return node\n}\n","import {type StoreContext} from '../../../store/defineStore'\nimport {type ComlinkNodeState} from '../comlinkNodeStore'\n\nexport const releaseNode = ({state}: StoreContext<ComlinkNodeState>, name: string): void => {\n const nodes = state.get().nodes\n const existing = nodes.get(name)\n\n if (existing) {\n if (existing.statusUnsub) {\n existing.statusUnsub()\n }\n existing.node.stop()\n nodes.delete(name)\n state.set('removeNode', {nodes})\n return\n }\n}\n","import {type Node, type NodeInput, type Status} from '@sanity/comlink'\n\nimport {bindActionGlobally} from '../../store/createActionBinder'\nimport {defineStore} from '../../store/defineStore'\nimport {type FrameMessage, type WindowMessage} from '../types'\nimport {getOrCreateNode as unboundGetOrCreateNode} from './actions/getOrCreateNode'\nimport {releaseNode as unboundReleaseNode} from './actions/releaseNode'\n\n/**\n * Individual node with its relevant options\n * @public\n */\nexport interface NodeEntry {\n node: Node<WindowMessage, FrameMessage>\n // we store options to ensure that channels remain as unique / consistent as possible\n options: NodeInput\n // status of the node connection\n status: Status\n statusUnsub?: () => void\n}\n\n/**\n * Internal state tracking comlink connections\n * @public\n */\nexport interface ComlinkNodeState {\n nodes: Map<string, NodeEntry>\n // Map of node name to set of active subscriber symbols\n subscriptions: Map<string, Set<symbol>>\n}\n\nexport const comlinkNodeStore = defineStore<ComlinkNodeState>({\n name: 'nodeStore',\n getInitialState: () => ({\n nodes: new Map(),\n subscriptions: new Map(),\n }),\n\n initialize({state}) {\n return () => {\n state.get().nodes.forEach(({node}) => {\n node.stop()\n })\n }\n },\n})\n\n/**\n * Signals to the store that the consumer has stopped using the node\n * @public\n */\nexport const releaseNode = bindActionGlobally(comlinkNodeStore, unboundReleaseNode)\n\n/**\n * Retrieve or create a node to be used for communication between\n * an application and the controller -- specifically, a node should\n * be created within a frame / window to communicate with the controller.\n * @public\n */\nexport const getOrCreateNode = bindActionGlobally(comlinkNodeStore, unboundGetOrCreateNode)\n","import {type Node, type NodeInput, type Status} from '@sanity/comlink'\nimport {createSelector} from 'reselect'\n\nimport {bindActionGlobally} from '../../store/createActionBinder'\nimport {createStateSourceAction, type SelectorContext} from '../../store/createStateSourceAction'\nimport {setCleanupTimeout} from '../../utils/setCleanupTimeout'\nimport {type FrameMessage, type WindowMessage} from '../types'\nimport {\n type ComlinkNodeState,\n comlinkNodeStore,\n getOrCreateNode,\n releaseNode,\n} from './comlinkNodeStore'\n\nconst NODE_RELEASE_TIME = 5000\n\n// Public shape for node state\n/**\n * @public\n */\nexport interface NodeState {\n node: Node<WindowMessage, FrameMessage>\n status: Status | undefined\n}\nconst selectNode = (context: SelectorContext<ComlinkNodeState>, nodeInput: NodeInput) =>\n context.state.nodes.get(nodeInput.name)\n\n/**\n * Provides a subscribable state source for a node by name\n * @param instance - The Sanity instance to get the node state for\n * @param nodeInput - The configuration for the node to get the state for\n\n * @returns A subscribable state source for the node\n * @public\n */\nexport const getNodeState = bindActionGlobally(\n comlinkNodeStore,\n createStateSourceAction<ComlinkNodeState, [NodeInput], NodeState | undefined>({\n selector: createSelector([selectNode], (nodeEntry) => {\n return nodeEntry?.status === 'connected'\n ? {\n node: nodeEntry.node,\n status: nodeEntry.status,\n }\n : undefined\n }),\n onSubscribe: ({state, instance}, nodeInput) => {\n const nodeName = nodeInput.name\n const subscriberId = Symbol('comlink-node-subscriber')\n getOrCreateNode(instance, nodeInput)\n\n // Add subscriber to the set for this node\n let subs = state.get().subscriptions.get(nodeName)\n if (!subs) {\n subs = new Set()\n state.get().subscriptions.set(nodeName, subs)\n }\n subs.add(subscriberId)\n\n return () => {\n setCleanupTimeout(() => {\n const activeSubs = state.get().subscriptions.get(nodeName)\n if (activeSubs) {\n activeSubs.delete(subscriberId)\n if (activeSubs.size === 0) {\n state.get().subscriptions.delete(nodeName)\n releaseNode(instance, nodeName)\n }\n }\n }, NODE_RELEASE_TIME)\n }\n },\n }),\n)\n"],"mappings":";;;;;AAOA,MAAaA,qBACX,EAAC,SACD,YACsC;CACtC,IAAM,QAAQ,MAAM,IAAI,CAAC,CAAC,OACpB,WAAW,MAAM,IAAI,QAAQ,IAAI;CAGvC,IAAI,UAAU;EACZ,IAAI,CAAC,YAAY,SAAS,SAAS,OAAO,GACxC,MAAU,MAAM,SAAS,QAAQ,KAAK,wCAAwC;EAIhF,OADA,SAAS,KAAK,MAAM,GACb,SAAS;CAClB;CAEA,IAAM,OAA0C,WAAW,OAAO;CAClE,KAAK,MAAM;CAiBX,IAAM,QAAQ;EACZ;EACA;EACA,QAAQ;EACR,aAlBkB,KAAK,UAAU,WAAW;GAC5C,IAAM,eAAe,MAAM,IAAI,CAAC,CAAC,OAC3B,eAAe,aAAa,IAAI,QAAQ,IAAI;GAClD,IAAI,CAAC,cAAc;GACnB,IAAM,eAAe;IACnB,GAAG;IACH;GACF;GACA,MAAM,IAAI,oBAAoB,EAC5B,OAAO,IAAI,IAAI,YAAY,CAAC,CAAC,IAAI,QAAQ,MAAM,YAAY,EAC7D,CAAC;EAC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AAwB;IACtB,IAAM,aAAa,MAAM,IAAI,CAAC,CAAC,cAAc,IAAI,QAAQ;IACzD,AAAI,eACF,WAAW,OAAO,YAAY,GAC1B,WAAW,SAAS,MACtB,MAAM,IAAI,CAAC,CAAC,cAAc,OAAO,QAAQ,GACzC,YAAY,UAAU,QAAQ;GAGpC,GAAG,GAAiB;EACtB;CACF;AACF,CAAC,CACH"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as isCanvasResource, a as DatasetResource, b as AuthConfig, c as DocumentTypeHandle, d as ProjectHandle, f as ReleaseHandle, g as TokenSource, h as StudioConfig, i as DatasetHandle, l as MediaLibraryResource, m as SanityConfig, n as createSanityInstance, o as DocumentHandle, p as ReleasePerspective, r as CanvasResource, s as DocumentResource, t as SanityInstance, u as PerspectiveHandle, v as isDatasetResource, x as AuthProvider, y as isMediaLibraryResource } from "./createSanityInstance-
|
|
2
|
-
import { $ as
|
|
3
|
-
export { type AccessResourceType, type Action, type ActionErrorEvent, type ActionsResult, type Application, type ApplicationAccess, type ApplicationBase, type ApplicationDeployment, type ApplicationInclude, type ApplicationInterface, type ApplicationStudioConfig, type ApplicationVisibility, type ApplicationWorkspace, type ApplicationsOptions, type ApplicationsResponse, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type ClientOptions, type ClientStoreState as ClientState, type Comment, type CommentLocalState, type CommentMessage, type CommentReaction, type CommentStatus, type CommentTextSelection, type CommentTextSelectionItem, type CommentThread, type CommentsOptions, type CreateCommentOptions, type CreateDocumentAction, type CreateReleaseAction, type CurrentUser, type DatasetHandle, type DatasetResource, type DeleteApplicationInput, type DeleteDocumentAction, type DeleteReleaseAction, type DeletedResult, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPresence, type DocumentPresenceOptions, type DocumentPublishedEvent, type DocumentRemotePatchesEvent, type DocumentResource, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditDocumentOptions, type EditReleaseAction, type ErrorAuthState, type FavoriteDocumentContext, type FavoriteStatusResponse, type GetUserOptions, type GetUsersOptions, type Installation, type InstallationAccess, type InstallationActiveConfig, type InstallationBase, type InstallationInclude, type
|
|
1
|
+
import { _ as isCanvasResource, a as DatasetResource, b as AuthConfig, c as DocumentTypeHandle, d as ProjectHandle, f as ReleaseHandle, g as TokenSource, h as StudioConfig, i as DatasetHandle, l as MediaLibraryResource, m as SanityConfig, n as createSanityInstance, o as DocumentHandle, p as ReleasePerspective, r as CanvasResource, s as DocumentResource, t as SanityInstance, u as PerspectiveHandle, v as isDatasetResource, x as AuthProvider, y as isMediaLibraryResource } from "./createSanityInstance-BQIqyGLX.js";
|
|
2
|
+
import { $ as project, $n as publishDocument, $r as refreshOAuthTokens, $t as ApplyDocumentActionsOptions, A as loadMoreUsers, An as CreateReleaseAction, Ar as RemoveCommentOptions, At as OrganizationsOptions, B as getQueryState, Bn as ReleaseAction, Br as CommentLocalState, Bt as InstallationBase, C as slicePath, Ci as application, Cn as ProcessMutationsOptions, Cr as getCommentThreadsState, Ct as ResolveUsersOptions, D as getCorsErrorProjectId, Di as AccessResourceType, Dn as Action, Dr as resolveCommentThreads, Dt as UsersGroupState, E as isImportError, Ei as updateApplication, En as JsonMatch, Et as UserProfile, F as ReleaseState, Fn as EditDocumentAction, Fr as removeComment, Ft as OrganizationOptions, G as resolveProjection, Gn as archiveRelease, Gr as CommentTextSelectionItem, Gt as installations, H as resolveQuery, Hn as UnarchiveReleaseAction, Hr as CommentReaction, Ht as InstallationsOptions, I as getActiveReleasesState, In as EditDocumentOptions, Ir as replyToComment, It as organization, J as ProjectBase, Jn as deleteDocument, Jr as ClientStoreState, Jt as SetFavoriteInput, K as getProjectionState, Kn as createDocument, Kr as CommentThread, Kt as FavoriteDocumentContext, L as getAllReleasesState, Ln as EditReleaseAction, Lr as setCommentStatus, Lt as Installation, M as resolveUsers, Mn as DeleteReleaseAction, Mr as SetCommentStatusOptions, Mt as Organization, N as defineProjection, Nn as DiscardDocumentAction, Nr as UpdateCommentOptions, Nt as OrganizationBase, O as getUserState, Oi as checkPermissions, On as ArchiveReleaseAction, Or as resolveComments, Ot as UsersStoreState, P as getPerspectiveState, Pn as DocumentAction, Pr as createComment, Pt as OrganizationMember, Q as ProjectOptions, Qn as editRelease, Qr as handleOAuthCallback, Qt as ActionsResult, R as QueryOptions, Ri as Selector, Rn as PublishDocumentAction, Rr as updateComment, Rt as InstallationAccess, S as jsonMatch, Si as UpdateApplicationInput, Sn as DocumentSet, Sr as ResolveCommentsOptions, St as ResolveUserOptions, T as CORE_SDK_VERSION, Ti as deleteApplication, Tn as processMutations, Tr as getCommentsState, Tt as SanityUserResponse, U as ProjectsOptions, Un as UnpublishDocumentAction, Ur as CommentStatus, Ut as InstallationsResponse, Vn as ScheduleReleaseAction, Vr as CommentMessage, Vt as InstallationInclude, W as projects, Wn as UnscheduleReleaseAction, Wr as CommentTextSelection, Wt as installation, X as ProjectMemberRole, Xn as discardDocument, Xr as getClientState, Xt as setFavorite, Y as ProjectMember, Yn as deleteRelease, Yr as getClient, Yt as favorites, Z as ProjectMetadata, Zn as editDocument, Zr as getOAuthTokensState, Zt as getReleaseDocumentId, _ as SanityDocument, _i as ApplicationWorkspace, _n as resolveDocument, _r as createDatasetHandle, _t as TransportEvent, a as LoggedOutAuthState, ai as observeOrganizationVerificationState, an as DocumentEditedEvent, ar as ResolveDocument, at as getPresence, b as getPathDepth, bi as DeleteApplicationInput, bn as DocumentPermissionsResult, br as createProjectHandle, bt as GetUsersOptions, c as getCurrentUserState, ci as Application, cn as DocumentRemotePatchesEvent, cr as datasets, ct as DocumentPresence, d as getLoginUrlState, di as ApplicationDeployment, dn as TransactionAcceptedEvent, dr as LogContext, dt as PresencePerspectiveOptions, ei as revokeOAuthTokens, en as applyDocumentActions, er as publishRelease, et as PreviewMedia, f as getTokenState, fi as ApplicationInclude, fn as TransactionRevertedEvent, fr as LogLevel, ft as PresenceSelection, g as Role, gi as ApplicationVisibility, gn as getPermissionsState, gt as StateEvent, h as ReleaseDocument, hi as ApplicationStudioConfig, hn as getDocumentSyncStatus, hr as LoggerConfig, ht as RollCallEvent, i as LoggedInAuthState, ii as handleAuthCallback, in as DocumentDiscardedEvent, ir as unscheduleRelease, it as getDocumentPresence, j as resolveUser, jn as DeleteDocumentAction, jr as ReplyToCommentOptions, jt as organizations, k as getUsersState, kn as CreateDocumentAction, kr as CreateCommentOptions, kt as Organizations, l as getDashboardOrganizationId, li as ApplicationAccess, ln as DocumentTransactionSubmissionResult, lr as configureLogging, lt as DocumentPresenceOptions, m as CurrentUser, mi as ApplicationInterfacePlacementMetadata, mn as getDocumentState, mr as Logger, mt as ReportPresenceOptions, n as AuthStoreState, ni as OAuthTokens, nn as DocumentCreatedEvent, nr as unarchiveRelease, nt as PreviewValue, o as LoggingInAuthState, oi as OrgVerificationResult, on as DocumentEvent, or as ResolveProjectionResult, ot as reportPresence, p as setAuthToken, pi as ApplicationInterface, pn as DocumentOptions, pr as LogNamespace, pt as PresenceSelectionPoint, q as Project, qn as createRelease, qr as ClientOptions, qt as FavoriteStatusResponse, r as ErrorAuthState, ri as logout, rn as DocumentDeletedEvent, rr as unpublishDocument, rt as ProjectionValuePending, s as getAuthState, si as AuthStateType, sn as DocumentPublishedEvent, sr as ResolveQueryResult, st as DisconnectEvent, t as AuthState, ti as startOAuthAuthorization, tn as ActionErrorEvent, tr as scheduleRelease, tt as PreviewQueryResult, u as getIsInDashboardState, ui as ApplicationBase, un as DocumentUnpublishedEvent, ur as InstanceContext, ut as PresenceLocation, v as SanityProject, vi as ApplicationsOptions, vn as resolvePermissions, vr as createDocumentHandle, vt as UserPresence, w as stringifyPath, wi as applications, wn as patchOperations, wt as SanityUser, x as joinPaths, xi as DeletedResult, xn as PermissionDeniedReason, xr as CommentsOptions, xt as Membership, y as getIndexForKey, yi as ApplicationsResponse, yn as subscribeDocumentEvents, yr as createDocumentTypeHandle, yt as GetUserOptions, zi as StateSource, zn as PublishReleaseAction, zr as Comment, zt as InstallationActiveConfig } from "./authStore-BO2vch3I.js";
|
|
3
|
+
export { type AccessResourceType, type Action, type ActionErrorEvent, type ActionsResult, type Application, type ApplicationAccess, type ApplicationBase, type ApplicationDeployment, type ApplicationInclude, type ApplicationInterface, type ApplicationInterfacePlacementMetadata, type ApplicationStudioConfig, type ApplicationVisibility, type ApplicationWorkspace, type ApplicationsOptions, type ApplicationsResponse, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type ClientOptions, type ClientStoreState as ClientState, type Comment, type CommentLocalState, type CommentMessage, type CommentReaction, type CommentStatus, type CommentTextSelection, type CommentTextSelectionItem, type CommentThread, type CommentsOptions, type CreateCommentOptions, type CreateDocumentAction, type CreateReleaseAction, type CurrentUser, type DatasetHandle, type DatasetResource, type DeleteApplicationInput, type DeleteDocumentAction, type DeleteReleaseAction, type DeletedResult, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPresence, type DocumentPresenceOptions, type DocumentPublishedEvent, type DocumentRemotePatchesEvent, type DocumentResource, type DocumentSet, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditDocumentOptions, type EditReleaseAction, type ErrorAuthState, type FavoriteDocumentContext, type FavoriteStatusResponse, type GetUserOptions, type GetUsersOptions, type Installation, type InstallationAccess, type InstallationActiveConfig, type InstallationBase, type InstallationInclude, type InstallationsOptions, type InstallationsResponse, type InstanceContext, type JsonMatch, type LogContext, type LogLevel, type LogNamespace, type LoggedInAuthState, type LoggedOutAuthState, type Logger, type LoggerConfig, type LoggingInAuthState, type MediaLibraryResource, type Membership, type OAuthTokens, type OrgVerificationResult, type Organization, type OrganizationBase, type OrganizationMember, type OrganizationOptions, type Organizations, type OrganizationsOptions, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PresencePerspectiveOptions, type PresenceSelection, type PresenceSelectionPoint, type PreviewMedia, type PreviewQueryResult, type PreviewValue, type ProcessMutationsOptions, type Project, type ProjectBase, type ProjectHandle, type ProjectMember, type ProjectMemberRole, type ProjectMetadata, type ProjectOptions, type ProjectionValuePending, type ProjectsOptions, type PublishDocumentAction, type PublishReleaseAction, type QueryOptions, type ReleaseAction, type ReleaseDocument, type ReleaseHandle, type ReleasePerspective, type ReleaseState, type RemoveCommentOptions, type ReplyToCommentOptions, type ReportPresenceOptions, type ResolveCommentsOptions, type ResolveDocument, type ResolveProjectionResult, type ResolveQueryResult, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type ScheduleReleaseAction, type Selector, type SetCommentStatusOptions, type SetFavoriteInput, type StateEvent, type StateSource, type StudioConfig, type TokenSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnarchiveReleaseAction, type UnpublishDocumentAction, type UnscheduleReleaseAction, type UpdateApplicationInput, type UpdateCommentOptions, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, application, applications, applyDocumentActions, archiveRelease, checkPermissions, configureLogging, createComment, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createProjectHandle, createRelease, createSanityInstance, datasets, defineProjection, deleteApplication, deleteDocument, deleteRelease, discardDocument, editDocument, editRelease, favorites, getActiveReleasesState, getAllReleasesState, getAuthState, getClient, getClientState, getCommentThreadsState, getCommentsState, getCorsErrorProjectId, getCurrentUserState, getDashboardOrganizationId, getDocumentPresence, getDocumentState, getDocumentSyncStatus, getIndexForKey, getIsInDashboardState, getLoginUrlState, getOAuthTokensState, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getProjectionState, getQueryState, getReleaseDocumentId, getTokenState, getUserState, getUsersState, handleAuthCallback, handleOAuthCallback, installation, installations, isCanvasResource, isDatasetResource, isImportError, isMediaLibraryResource, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, patchOperations, processMutations, project, projects, publishDocument, publishRelease, refreshOAuthTokens, removeComment, replyToComment, reportPresence, resolveCommentThreads, resolveComments, resolveDocument, resolvePermissions, resolveProjection, resolveQuery, resolveUser, resolveUsers, revokeOAuthTokens, scheduleRelease, setAuthToken, setCommentStatus, setFavorite, slicePath, startOAuthAuthorization, stringifyPath, subscribeDocumentEvents, unarchiveRelease, unpublishDocument, unscheduleRelease, updateApplication, updateComment };
|