@sanity/sdk 2.9.0 → 2.11.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/_chunks-dts/utils.d.ts +295 -69
- package/dist/_chunks-es/_internal.js +3 -14
- package/dist/_chunks-es/_internal.js.map +1 -1
- package/dist/_chunks-es/createGroqSearchFilter.js +129 -59
- package/dist/_chunks-es/createGroqSearchFilter.js.map +1 -1
- package/dist/_chunks-es/version.js +1 -1
- package/dist/_exports/_internal.d.ts +16 -2
- package/dist/_exports/_internal.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +275 -149
- package/dist/index.js.map +1 -1
- package/package.json +11 -15
- package/src/_exports/_internal.ts +1 -0
- package/src/_exports/index.ts +33 -2
- package/src/agent/agentActions.ts +21 -25
- package/src/client/clientStore.test.ts +24 -60
- package/src/client/clientStore.ts +49 -56
- package/src/comlink/controller/actions/getOrCreateChannel.ts +2 -2
- package/src/comlink/node/actions/getOrCreateNode.test.ts +5 -2
- package/src/comlink/node/actions/getOrCreateNode.ts +2 -2
- package/src/comlink/node/actions/releaseNode.test.ts +3 -3
- package/src/config/sanityConfig.ts +72 -13
- package/src/document/applyDocumentActions.test.ts +7 -7
- package/src/document/applyDocumentActions.ts +5 -5
- package/src/document/documentStore.test.ts +68 -62
- package/src/document/documentStore.ts +33 -38
- package/src/document/processActions.ts +2 -2
- package/src/document/reducers.ts +4 -4
- package/src/document/sharedListener.ts +5 -7
- package/src/organization/organization.test-d.ts +102 -0
- package/src/organization/organization.test.ts +138 -0
- package/src/organization/organization.ts +166 -0
- package/src/organizations/organizations.test-d.ts +77 -0
- package/src/organizations/organizations.test.ts +150 -0
- package/src/organizations/organizations.ts +132 -0
- package/src/presence/bifurTransport.test.ts +46 -6
- package/src/presence/bifurTransport.ts +13 -1
- package/src/presence/presenceStore.test.ts +101 -5
- package/src/presence/presenceStore.ts +96 -24
- package/src/preview/getPreviewState.ts +1 -1
- package/src/preview/previewProjectionUtils.test.ts +4 -4
- package/src/preview/previewProjectionUtils.ts +6 -7
- package/src/preview/resolvePreview.ts +5 -1
- package/src/project/project.test-d.ts +93 -0
- package/src/project/project.test.ts +108 -10
- package/src/project/project.ts +152 -26
- package/src/projection/getProjectionState.ts +4 -4
- package/src/projection/projectionStore.test.ts +2 -2
- package/src/projection/resolveProjection.ts +2 -2
- package/src/projection/subscribeToStateAndFetchBatches.test.ts +1 -1
- package/src/projection/subscribeToStateAndFetchBatches.ts +11 -15
- package/src/projects/projects.test-d.ts +38 -0
- package/src/projects/projects.test.ts +104 -38
- package/src/projects/projects.ts +74 -14
- package/src/query/queryStore.test.ts +12 -12
- package/src/query/queryStore.ts +10 -11
- package/src/query/reducers.ts +3 -3
- package/src/releases/getPerspectiveState.ts +5 -5
- package/src/releases/releasesStore.test.ts +6 -6
- package/src/releases/releasesStore.ts +9 -9
- package/src/store/createActionBinder.test.ts +31 -31
- package/src/store/createActionBinder.ts +43 -38
- package/src/store/createSanityInstance.ts +5 -6
- package/src/telemetry/devMode.test.ts +8 -0
- package/src/telemetry/devMode.ts +10 -9
- package/src/telemetry/initTelemetry.test.ts +0 -17
- package/src/telemetry/initTelemetry.ts +2 -12
- package/src/users/reducers.ts +3 -4
- package/src/utils/createFetcherStore.ts +6 -4
- package/src/utils/isImportError.test.ts +72 -0
- package/src/utils/isImportError.ts +34 -0
- package/src/utils/object.test.ts +95 -0
- package/src/utils/object.ts +142 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _sanity_client4 from "@sanity/client";
|
|
2
2
|
import { ClientConfig, ClientError, ClientPerspective, ListenEvent, MultipleMutationResult, ResponseQueryOptions, SanityClient, SanityDocument, SanityProject, StackablePerspective } from "@sanity/client";
|
|
3
3
|
import { CurrentUser, CurrentUser as CurrentUser$1, Mutation, PatchOperations, Role, SanityDocument as SanityDocument$1, SanityDocument as SanityDocument$3, SanityDocumentLike } from "@sanity/types";
|
|
4
4
|
import { Observable, Subject } from "rxjs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as _sanity_comlink3 from "@sanity/comlink";
|
|
6
6
|
import { ChannelInput, ChannelInstance, Controller, Message, Node, NodeInput, Status } from "@sanity/comlink";
|
|
7
7
|
import { PatchMutation } from "@sanity/mutate/_unstable_store";
|
|
8
8
|
import { SanityDocument as SanityDocument$2, SanityProjectionResult, SanityQueryResult } from "groq";
|
|
@@ -145,9 +145,14 @@ interface DatasetHandle<TDataset extends string = string, TProjectId extends str
|
|
|
145
145
|
dataset?: TDataset;
|
|
146
146
|
/**
|
|
147
147
|
* @beta
|
|
148
|
-
* Explicit
|
|
148
|
+
* Explicit resource object to use for this operation.
|
|
149
149
|
*/
|
|
150
|
-
|
|
150
|
+
resource?: DocumentResource;
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Use `resource` instead.
|
|
153
|
+
* @beta
|
|
154
|
+
*/
|
|
155
|
+
source?: DocumentResource;
|
|
151
156
|
}
|
|
152
157
|
/**
|
|
153
158
|
* Identifies a specific document type within a Sanity dataset and project.
|
|
@@ -181,7 +186,6 @@ interface DocumentHandle<TDocumentType extends string = string, TDataset extends
|
|
|
181
186
|
interface SanityConfig extends DatasetHandle, PerspectiveHandle {
|
|
182
187
|
/**
|
|
183
188
|
* Authentication configuration for the instance
|
|
184
|
-
* @remarks Merged with parent configurations when using createChild
|
|
185
189
|
*/
|
|
186
190
|
auth?: AuthConfig;
|
|
187
191
|
/**
|
|
@@ -204,45 +208,85 @@ interface SanityConfig extends DatasetHandle, PerspectiveHandle {
|
|
|
204
208
|
};
|
|
205
209
|
/**
|
|
206
210
|
* @beta
|
|
207
|
-
* A list of named
|
|
211
|
+
* A list of named resources to use for this instance.
|
|
208
212
|
*/
|
|
209
|
-
|
|
213
|
+
resources?: Record<string, DocumentResource>;
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated Use `resources` instead.
|
|
216
|
+
* @beta
|
|
217
|
+
*/
|
|
218
|
+
sources?: Record<string, DocumentResource>;
|
|
210
219
|
}
|
|
211
220
|
/**
|
|
212
|
-
* A document
|
|
221
|
+
* A document resource can be used for querying.
|
|
213
222
|
* This will soon be the default way to identify where you are querying from.
|
|
214
223
|
*
|
|
215
224
|
* @beta
|
|
216
225
|
*/
|
|
217
|
-
type
|
|
226
|
+
type DocumentResource = DatasetResource | MediaLibraryResource | CanvasResource$1;
|
|
218
227
|
/**
|
|
219
228
|
* @beta
|
|
220
229
|
*/
|
|
221
|
-
type
|
|
230
|
+
type DatasetResource = {
|
|
222
231
|
projectId: string;
|
|
223
232
|
dataset: string;
|
|
224
233
|
};
|
|
225
234
|
/**
|
|
226
235
|
* @beta
|
|
227
236
|
*/
|
|
228
|
-
type
|
|
237
|
+
type MediaLibraryResource = {
|
|
229
238
|
mediaLibraryId: string;
|
|
230
239
|
};
|
|
231
240
|
/**
|
|
232
241
|
* @beta
|
|
233
242
|
*/
|
|
234
|
-
type
|
|
243
|
+
type CanvasResource$1 = {
|
|
235
244
|
canvasId: string;
|
|
236
245
|
};
|
|
237
246
|
/**
|
|
238
247
|
* @beta
|
|
239
248
|
*/
|
|
249
|
+
declare function isDatasetResource(resource: DocumentResource): resource is DatasetResource;
|
|
250
|
+
/**
|
|
251
|
+
* @beta
|
|
252
|
+
*/
|
|
253
|
+
declare function isMediaLibraryResource(resource: DocumentResource): resource is MediaLibraryResource;
|
|
254
|
+
/**
|
|
255
|
+
* @beta
|
|
256
|
+
*/
|
|
257
|
+
declare function isCanvasResource(resource: DocumentResource): resource is CanvasResource$1;
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated Use `DocumentResource` instead.
|
|
260
|
+
* @beta
|
|
261
|
+
*/
|
|
262
|
+
type DocumentSource = DocumentResource;
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated Use `DatasetResource` instead.
|
|
265
|
+
* @beta
|
|
266
|
+
*/
|
|
267
|
+
type DatasetSource = DatasetResource;
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated Use `MediaLibraryResource` instead.
|
|
270
|
+
* @beta
|
|
271
|
+
*/
|
|
272
|
+
type MediaLibrarySource = MediaLibraryResource;
|
|
273
|
+
/**
|
|
274
|
+
* @deprecated Use `CanvasResource` instead.
|
|
275
|
+
* @beta
|
|
276
|
+
*/
|
|
277
|
+
type CanvasSource = CanvasResource$1;
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated Use `isDatasetResource` instead.
|
|
280
|
+
* @beta
|
|
281
|
+
*/
|
|
240
282
|
declare function isDatasetSource(source: DocumentSource): source is DatasetSource;
|
|
241
283
|
/**
|
|
284
|
+
* @deprecated Use `isMediaLibraryResource` instead.
|
|
242
285
|
* @beta
|
|
243
286
|
*/
|
|
244
287
|
declare function isMediaLibrarySource(source: DocumentSource): source is MediaLibrarySource;
|
|
245
288
|
/**
|
|
289
|
+
* @deprecated Use `isCanvasResource` instead.
|
|
246
290
|
* @beta
|
|
247
291
|
*/
|
|
248
292
|
declare function isCanvasSource(source: DocumentSource): source is CanvasSource;
|
|
@@ -256,7 +300,6 @@ declare function isCanvasSource(source: DocumentSource): source is CanvasSource;
|
|
|
256
300
|
declare function isStudioConfig(config: SanityConfig): boolean;
|
|
257
301
|
/**
|
|
258
302
|
* Represents a Sanity.io resource instance with its own configuration and lifecycle
|
|
259
|
-
* @remarks Instances form a hierarchy through parent/child relationships
|
|
260
303
|
*
|
|
261
304
|
* @public
|
|
262
305
|
*/
|
|
@@ -268,7 +311,6 @@ interface SanityInstance {
|
|
|
268
311
|
readonly instanceId: string;
|
|
269
312
|
/**
|
|
270
313
|
* Resolved configuration for this instance
|
|
271
|
-
* @remarks Merges values from parent instances where appropriate
|
|
272
314
|
*/
|
|
273
315
|
readonly config: SanityConfig;
|
|
274
316
|
/**
|
|
@@ -290,12 +332,13 @@ interface SanityInstance {
|
|
|
290
332
|
/**
|
|
291
333
|
* Gets the parent instance in the hierarchy
|
|
292
334
|
* @returns Parent instance or undefined if this is the root
|
|
335
|
+
* @deprecated The parent/child instance hierarchy is deprecated. Use a single SanityInstance instead.
|
|
293
336
|
*/
|
|
294
337
|
getParent(): SanityInstance | undefined;
|
|
295
338
|
/**
|
|
296
339
|
* Creates a child instance with merged configuration
|
|
297
340
|
* @param config - Configuration to merge with parent values
|
|
298
|
-
* @
|
|
341
|
+
* @deprecated The parent/child instance hierarchy is deprecated. Use a single SanityInstance instead.
|
|
299
342
|
*/
|
|
300
343
|
createChild(config: SanityConfig): SanityInstance;
|
|
301
344
|
/**
|
|
@@ -303,6 +346,7 @@ interface SanityInstance {
|
|
|
303
346
|
* matches the given target config using a shallow comparison.
|
|
304
347
|
* @param targetConfig - A partial configuration object containing key-value pairs to match.
|
|
305
348
|
* @returns The first matching instance or undefined if no match is found.
|
|
349
|
+
* @deprecated The parent/child instance hierarchy is deprecated. Use a single SanityInstance instead.
|
|
306
350
|
*/
|
|
307
351
|
match(targetConfig: Partial<SanityConfig>): SanityInstance | undefined;
|
|
308
352
|
}
|
|
@@ -396,7 +440,7 @@ type AgentPatchResult = Awaited<ReturnType<SanityClient['agent']['action']['patc
|
|
|
396
440
|
* @returns An Observable emitting the result of the agent generate action.
|
|
397
441
|
* @alpha
|
|
398
442
|
*/
|
|
399
|
-
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions): AgentGenerateResult;
|
|
443
|
+
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions, resource?: DocumentResource): AgentGenerateResult;
|
|
400
444
|
/**
|
|
401
445
|
* Transforms a document using the agent.
|
|
402
446
|
* @param instance - The Sanity instance.
|
|
@@ -404,7 +448,7 @@ declare function agentGenerate(instance: SanityInstance, options: AgentGenerateO
|
|
|
404
448
|
* @returns An Observable emitting the result of the agent transform action.
|
|
405
449
|
* @alpha
|
|
406
450
|
*/
|
|
407
|
-
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions): AgentTransformResult;
|
|
451
|
+
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions, resource?: DocumentResource): AgentTransformResult;
|
|
408
452
|
/**
|
|
409
453
|
* Translates a document using the agent.
|
|
410
454
|
* @param instance - The Sanity instance.
|
|
@@ -412,7 +456,7 @@ declare function agentTransform(instance: SanityInstance, options: AgentTransfor
|
|
|
412
456
|
* @returns An Observable emitting the result of the agent translate action.
|
|
413
457
|
* @alpha
|
|
414
458
|
*/
|
|
415
|
-
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions): AgentTranslateResult;
|
|
459
|
+
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions, resource?: DocumentResource): AgentTranslateResult;
|
|
416
460
|
/**
|
|
417
461
|
* Prompts the agent using the same instruction template format as the other actions, but returns text or json instead of acting on a document.
|
|
418
462
|
* @param instance - The Sanity instance.
|
|
@@ -420,7 +464,7 @@ declare function agentTranslate(instance: SanityInstance, options: AgentTranslat
|
|
|
420
464
|
* @returns An Observable emitting the result of the agent prompt action.
|
|
421
465
|
* @alpha
|
|
422
466
|
*/
|
|
423
|
-
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions): Observable<AgentPromptResult>;
|
|
467
|
+
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions, resource?: DocumentResource): Observable<AgentPromptResult>;
|
|
424
468
|
/**
|
|
425
469
|
* Patches a document using the agent.
|
|
426
470
|
* @param instance - The Sanity instance.
|
|
@@ -428,7 +472,7 @@ declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptio
|
|
|
428
472
|
* @returns An Observable emitting the result of the agent patch action.
|
|
429
473
|
* @alpha
|
|
430
474
|
*/
|
|
431
|
-
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions): Observable<AgentPatchResult>;
|
|
475
|
+
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions, resource?: DocumentResource): Observable<AgentPatchResult>;
|
|
432
476
|
/**
|
|
433
477
|
* Represents the various states the authentication type can be in.
|
|
434
478
|
*
|
|
@@ -502,19 +546,16 @@ interface ClientOptions extends Pick<ClientConfig, AllowedClientConfigKey> {
|
|
|
502
546
|
* and the global client ('global'). When set to `'global'`, the global client
|
|
503
547
|
* is used.
|
|
504
548
|
*/
|
|
505
|
-
|
|
549
|
+
scope?: 'default' | 'global';
|
|
506
550
|
/**
|
|
507
551
|
* A required string indicating the API version for the client.
|
|
508
552
|
*/
|
|
509
|
-
|
|
553
|
+
apiVersion: string;
|
|
510
554
|
/**
|
|
511
555
|
* @internal
|
|
556
|
+
* The SDK resource to use for the client -- this will get transformed into a ClientConfig resource.
|
|
512
557
|
*/
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* @internal
|
|
516
|
-
*/
|
|
517
|
-
'source'?: DocumentSource;
|
|
558
|
+
resource?: DocumentResource;
|
|
518
559
|
}
|
|
519
560
|
/**
|
|
520
561
|
* Retrieves a Sanity client instance configured with the provided options.
|
|
@@ -595,7 +636,7 @@ declare const destroyController: BoundStoreAction<ComlinkControllerState, [], vo
|
|
|
595
636
|
* an application and the controller.
|
|
596
637
|
* @public
|
|
597
638
|
*/
|
|
598
|
-
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<
|
|
639
|
+
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<_sanity_comlink3.Message, _sanity_comlink3.Message>>;
|
|
599
640
|
/**
|
|
600
641
|
* Initializes or fetches a controller to handle communication
|
|
601
642
|
* between an application and iframes.
|
|
@@ -636,7 +677,7 @@ declare const releaseNode: BoundStoreAction<ComlinkNodeState, [name: string], vo
|
|
|
636
677
|
* be created within a frame / window to communicate with the controller.
|
|
637
678
|
* @public
|
|
638
679
|
*/
|
|
639
|
-
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<
|
|
680
|
+
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<_sanity_comlink3.Message, _sanity_comlink3.Message>>;
|
|
640
681
|
/**
|
|
641
682
|
* @public
|
|
642
683
|
*/
|
|
@@ -957,9 +998,9 @@ interface Logger {
|
|
|
957
998
|
*/
|
|
958
999
|
declare function configureLogging(config: LoggerConfig): void;
|
|
959
1000
|
/** @public */
|
|
960
|
-
declare const getDatasetsState: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined],
|
|
1001
|
+
declare const getDatasetsState: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined], _sanity_client4.DatasetsResponse>, [options?: ProjectHandle<string> | undefined], StateSource<_sanity_client4.DatasetsResponse | undefined>>;
|
|
961
1002
|
/** @public */
|
|
962
|
-
declare const resolveDatasets: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined],
|
|
1003
|
+
declare const resolveDatasets: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined], _sanity_client4.DatasetsResponse>, [options?: ProjectHandle<string> | undefined], Promise<_sanity_client4.DatasetsResponse>>;
|
|
963
1004
|
/**
|
|
964
1005
|
* Represents an action to create a new document.
|
|
965
1006
|
* Specifies the document type and optionally a document ID (which will be treated as the published ID).
|
|
@@ -1273,7 +1314,7 @@ declare function resolveDocument<TData extends SanityDocument$2>(instance: Sanit
|
|
|
1273
1314
|
/** @beta */
|
|
1274
1315
|
declare const getDocumentSyncStatus: BoundStoreAction<DocumentStoreState, [doc: DocumentHandle<string, string, string>], StateSource<boolean | undefined>>;
|
|
1275
1316
|
type PermissionsStateOptions = {
|
|
1276
|
-
|
|
1317
|
+
resource?: DocumentResource;
|
|
1277
1318
|
actions: DocumentAction[];
|
|
1278
1319
|
};
|
|
1279
1320
|
/** @beta */
|
|
@@ -1282,7 +1323,7 @@ declare const getPermissionsState: BoundStoreAction<DocumentStoreState, [Permiss
|
|
|
1282
1323
|
declare const resolvePermissions: BoundStoreAction<DocumentStoreState, [options: PermissionsStateOptions], Promise<DocumentPermissionsResult>>;
|
|
1283
1324
|
/** @beta */
|
|
1284
1325
|
declare const subscribeDocumentEvents: BoundStoreAction<DocumentStoreState, [options: {
|
|
1285
|
-
|
|
1326
|
+
resource?: DocumentResource;
|
|
1286
1327
|
eventHandler: (e: DocumentEvent) => void;
|
|
1287
1328
|
}], () => void>;
|
|
1288
1329
|
type ActionMap = {
|
|
@@ -1531,9 +1572,9 @@ interface ApplyDocumentActionsOptions {
|
|
|
1531
1572
|
*/
|
|
1532
1573
|
actions: DocumentAction[];
|
|
1533
1574
|
/**
|
|
1534
|
-
* The
|
|
1575
|
+
* The resource to which the documents being acted on belong.
|
|
1535
1576
|
*/
|
|
1536
|
-
|
|
1577
|
+
resource?: DocumentResource;
|
|
1537
1578
|
/**
|
|
1538
1579
|
* Optionally provide an ID to be used as this transaction ID
|
|
1539
1580
|
*/
|
|
@@ -1577,6 +1618,111 @@ declare const getFavoritesState: BoundStoreAction<FetcherStoreState<[FavoriteDoc
|
|
|
1577
1618
|
* @public
|
|
1578
1619
|
*/
|
|
1579
1620
|
declare const resolveFavoritesState: BoundStoreAction<FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], Promise<FavoriteStatusResponse>>;
|
|
1621
|
+
/** @public */
|
|
1622
|
+
interface OrganizationMember {
|
|
1623
|
+
sanityUserId: string;
|
|
1624
|
+
isCurrentUser: boolean;
|
|
1625
|
+
user: {
|
|
1626
|
+
id: string;
|
|
1627
|
+
displayName: string;
|
|
1628
|
+
familyName: string;
|
|
1629
|
+
givenName: string;
|
|
1630
|
+
middleName: string | null;
|
|
1631
|
+
imageUrl: string | null;
|
|
1632
|
+
email: string;
|
|
1633
|
+
loginProvider: string;
|
|
1634
|
+
};
|
|
1635
|
+
roles: Array<{
|
|
1636
|
+
name: string;
|
|
1637
|
+
title: string;
|
|
1638
|
+
description?: string;
|
|
1639
|
+
}>;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* The base fields returned from `/organizations/<id>` for every organization.
|
|
1643
|
+
* @public
|
|
1644
|
+
*/
|
|
1645
|
+
interface OrganizationBase {
|
|
1646
|
+
id: string;
|
|
1647
|
+
name: string;
|
|
1648
|
+
slug: string | null;
|
|
1649
|
+
createdAt: string;
|
|
1650
|
+
createdByUserId: string;
|
|
1651
|
+
updatedAt: string;
|
|
1652
|
+
deletedAt: string | null;
|
|
1653
|
+
dashboardStatus: 'enabled' | 'disabled';
|
|
1654
|
+
aiFeaturesStatus: 'enabled' | 'disabled';
|
|
1655
|
+
mediaLibraryStatus: 'enabled' | 'disabled';
|
|
1656
|
+
requestAccessStatus: 'allowed' | 'disabled';
|
|
1657
|
+
telemetryConsentStatus: 'allowed' | 'msa_denied' | 'customer_denied';
|
|
1658
|
+
oauthAppsStatus: 'allowed' | 'blocked';
|
|
1659
|
+
defaultRoleName: string;
|
|
1660
|
+
domains: string[] | null;
|
|
1661
|
+
}
|
|
1662
|
+
/** @public */
|
|
1663
|
+
interface OrganizationOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> {
|
|
1664
|
+
includeMembers?: IncludeMembers;
|
|
1665
|
+
includeFeatures?: IncludeFeatures;
|
|
1666
|
+
organizationId: string;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* An `Organization` with `members` and/or `features` conditionally included
|
|
1670
|
+
* based on the query options used to fetch it.
|
|
1671
|
+
* @public
|
|
1672
|
+
*/
|
|
1673
|
+
type Organization<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = OrganizationBase & (boolean extends IncludeMembers ? {
|
|
1674
|
+
members?: OrganizationMember[];
|
|
1675
|
+
} : IncludeMembers extends true ? {
|
|
1676
|
+
members: OrganizationMember[];
|
|
1677
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1678
|
+
features?: string[];
|
|
1679
|
+
} : IncludeFeatures extends true ? {
|
|
1680
|
+
features: string[];
|
|
1681
|
+
} : unknown);
|
|
1682
|
+
/**
|
|
1683
|
+
* Public signature for the organization state source. The conditional generics
|
|
1684
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1685
|
+
* and assign the (already-correct) runtime function to it.
|
|
1686
|
+
*/
|
|
1687
|
+
type GetOrganizationState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => StateSource<Organization<IncludeMembers, IncludeFeatures> | undefined>;
|
|
1688
|
+
type ResolveOrganization = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => Promise<Organization<IncludeMembers, IncludeFeatures>>;
|
|
1689
|
+
/** @public */
|
|
1690
|
+
declare const getOrganizationState: GetOrganizationState;
|
|
1691
|
+
/** @public */
|
|
1692
|
+
declare const resolveOrganization: ResolveOrganization;
|
|
1693
|
+
/**
|
|
1694
|
+
* The list shape returned from `/organizations`, with `members` and/or
|
|
1695
|
+
* `features` conditionally included based on the query options used.
|
|
1696
|
+
* @public
|
|
1697
|
+
*/
|
|
1698
|
+
type Organizations<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = (Pick<OrganizationBase, 'id' | 'name' | 'slug' | 'createdAt' | 'updatedAt' | 'defaultRoleName' | 'dashboardStatus' | 'aiFeaturesStatus'> & (boolean extends IncludeMembers ? {
|
|
1699
|
+
members?: OrganizationMember[];
|
|
1700
|
+
} : IncludeMembers extends true ? {
|
|
1701
|
+
members: OrganizationMember[];
|
|
1702
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1703
|
+
features?: string[];
|
|
1704
|
+
} : IncludeFeatures extends true ? {
|
|
1705
|
+
features: string[];
|
|
1706
|
+
} : unknown))[];
|
|
1707
|
+
/** @public */
|
|
1708
|
+
interface OrganizationsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> extends Omit<OrganizationOptions<IncludeMembers, IncludeFeatures>, 'organizationId'> {
|
|
1709
|
+
/**
|
|
1710
|
+
* When `true`, includes organisations the user has access to via
|
|
1711
|
+
* project-level grants, not just direct organisation memberships.
|
|
1712
|
+
*/
|
|
1713
|
+
includeImplicitMemberships?: boolean;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Public signature for the organization state source. The conditional generics
|
|
1717
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1718
|
+
* and assign the (already-correct) runtime function to it.
|
|
1719
|
+
*/
|
|
1720
|
+
type GetOrganizationsState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => StateSource<Organizations<IncludeMembers, IncludeFeatures> | undefined>;
|
|
1721
|
+
type ResolveOrganizations = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => Promise<Organizations<IncludeMembers, IncludeFeatures>>;
|
|
1722
|
+
/** @public */
|
|
1723
|
+
declare const getOrganizationsState: GetOrganizationsState;
|
|
1724
|
+
/** @public */
|
|
1725
|
+
declare const resolveOrganizations: ResolveOrganizations;
|
|
1580
1726
|
/**
|
|
1581
1727
|
* @public
|
|
1582
1728
|
*/
|
|
@@ -1704,20 +1850,10 @@ interface DisconnectEvent {
|
|
|
1704
1850
|
sessionId: string;
|
|
1705
1851
|
timestamp: string;
|
|
1706
1852
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
}>;
|
|
1712
|
-
users: Record<string, SanityUser | undefined>;
|
|
1713
|
-
};
|
|
1714
|
-
/** @public */
|
|
1715
|
-
|
|
1716
|
-
/** @public */
|
|
1717
|
-
declare const getPresence: BoundStoreAction<PresenceStoreState, [((object & {
|
|
1718
|
-
projectId?: string;
|
|
1719
|
-
dataset?: string;
|
|
1720
|
-
}) | undefined)?, ...unknown[]], StateSource<UserPresence[]>>;
|
|
1853
|
+
/** @beta */
|
|
1854
|
+
declare function getPresence(instance: SanityInstance, params?: {
|
|
1855
|
+
resource?: DocumentResource;
|
|
1856
|
+
}): StateSource<UserPresence[]>;
|
|
1721
1857
|
/**
|
|
1722
1858
|
* @public
|
|
1723
1859
|
* The result of a projection query
|
|
@@ -1843,10 +1979,10 @@ declare const PREVIEW_PROJECTION: string;
|
|
|
1843
1979
|
*
|
|
1844
1980
|
* @param projectionResult - The raw projection result from GROQ
|
|
1845
1981
|
* @param instance - The Sanity instance to use for client configuration
|
|
1846
|
-
* @param
|
|
1982
|
+
* @param resource - Data resource for the preview
|
|
1847
1983
|
* @internal
|
|
1848
1984
|
*/
|
|
1849
|
-
declare function transformProjectionToPreview(instance: SanityInstance, projectionResult: PreviewQueryResult,
|
|
1985
|
+
declare function transformProjectionToPreview(instance: SanityInstance, projectionResult: PreviewQueryResult, resource?: DocumentResource): PreviewValue;
|
|
1850
1986
|
/**
|
|
1851
1987
|
* @beta
|
|
1852
1988
|
* @deprecated This type is deprecated and will be removed in a future release.
|
|
@@ -1858,9 +1994,75 @@ type ResolvePreviewOptions = DocumentHandle;
|
|
|
1858
1994
|
*/
|
|
1859
1995
|
declare function resolvePreview(instance: SanityInstance, options: ResolvePreviewOptions): Promise<ValuePending<PreviewValue>>;
|
|
1860
1996
|
/** @public */
|
|
1861
|
-
|
|
1997
|
+
interface ProjectMemberRole {
|
|
1998
|
+
name: string;
|
|
1999
|
+
title: string;
|
|
2000
|
+
description: string;
|
|
2001
|
+
}
|
|
2002
|
+
/** @public */
|
|
2003
|
+
interface ProjectMember {
|
|
2004
|
+
id: string;
|
|
2005
|
+
createdAt: string;
|
|
2006
|
+
updatedAt: string;
|
|
2007
|
+
isCurrentUser: boolean;
|
|
2008
|
+
isRobot: boolean;
|
|
2009
|
+
roles: ProjectMemberRole[];
|
|
2010
|
+
}
|
|
1862
2011
|
/** @public */
|
|
1863
|
-
|
|
2012
|
+
interface ProjectMetadata {
|
|
2013
|
+
color?: string;
|
|
2014
|
+
externalStudioHost?: string;
|
|
2015
|
+
initialTemplate?: string;
|
|
2016
|
+
cliInitializedAt?: string;
|
|
2017
|
+
integration: 'manage' | 'cli';
|
|
2018
|
+
}
|
|
2019
|
+
/**
|
|
2020
|
+
* The base fields returned from `/projects` for every project.
|
|
2021
|
+
* @public
|
|
2022
|
+
*/
|
|
2023
|
+
interface ProjectBase {
|
|
2024
|
+
id: string;
|
|
2025
|
+
displayName: string;
|
|
2026
|
+
studioHost: string | null;
|
|
2027
|
+
organizationId: string;
|
|
2028
|
+
metadata: ProjectMetadata;
|
|
2029
|
+
isBlocked: boolean;
|
|
2030
|
+
isDisabled: boolean;
|
|
2031
|
+
isDisabledByUser: boolean;
|
|
2032
|
+
activityFeedEnabled: boolean;
|
|
2033
|
+
createdAt: string;
|
|
2034
|
+
updatedAt: string;
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* A `Project` with `members` and/or `features` conditionally included
|
|
2038
|
+
* based on the query options used to fetch it.
|
|
2039
|
+
* @public
|
|
2040
|
+
*/
|
|
2041
|
+
type Project<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> = ProjectBase & (boolean extends IncludeMembers ? {
|
|
2042
|
+
members?: ProjectMember[];
|
|
2043
|
+
} : IncludeMembers extends true ? {
|
|
2044
|
+
members: ProjectMember[];
|
|
2045
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
2046
|
+
features?: string[];
|
|
2047
|
+
} : IncludeFeatures extends true ? {
|
|
2048
|
+
features: string[];
|
|
2049
|
+
} : unknown);
|
|
2050
|
+
/** @public */
|
|
2051
|
+
interface ProjectOptions<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> extends ProjectHandle {
|
|
2052
|
+
includeMembers?: IncludeMembers;
|
|
2053
|
+
includeFeatures?: IncludeFeatures;
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Public signature for the project state source. The conditional generics
|
|
2057
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
2058
|
+
* and assign the (already-correct) runtime function to it.
|
|
2059
|
+
*/
|
|
2060
|
+
type GetProjectState = <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => StateSource<Project<IncludeMembers, IncludeFeatures> | undefined>;
|
|
2061
|
+
type ResolveProject = <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>>;
|
|
2062
|
+
/** @public */
|
|
2063
|
+
declare const getProjectState: GetProjectState;
|
|
2064
|
+
/** @public */
|
|
2065
|
+
declare const resolveProject: ResolveProject;
|
|
1864
2066
|
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1865
2067
|
projection: TProjection;
|
|
1866
2068
|
}
|
|
@@ -1881,21 +2083,23 @@ declare function resolveProjection<TProjection extends string = string, TDocumen
|
|
|
1881
2083
|
/** @beta */
|
|
1882
2084
|
declare function resolveProjection<TData extends object>(instance: SanityInstance, options: ProjectionOptions): Promise<ProjectionValuePending<TData>>;
|
|
1883
2085
|
/** @public */
|
|
1884
|
-
|
|
1885
|
-
organizationId?: string;
|
|
1886
|
-
includeMembers?: boolean;
|
|
1887
|
-
} | undefined], Omit<_sanity_client12.SanityProject, "members">[]>, [options?: {
|
|
2086
|
+
interface ProjectsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true> {
|
|
1888
2087
|
organizationId?: string;
|
|
1889
|
-
includeMembers?:
|
|
1890
|
-
|
|
2088
|
+
includeMembers?: IncludeMembers;
|
|
2089
|
+
includeFeatures?: IncludeFeatures;
|
|
2090
|
+
onlyExplicitMembership?: boolean;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Public signature for the projects state source. The conditional generics
|
|
2094
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
2095
|
+
* and assign the (already-correct) runtime function to it.
|
|
2096
|
+
*/
|
|
2097
|
+
type GetProjectsState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => StateSource<Project<IncludeMembers, IncludeFeatures>[] | undefined>;
|
|
2098
|
+
type ResolveProjects = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>[]>;
|
|
1891
2099
|
/** @public */
|
|
1892
|
-
declare const
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
} | undefined], Omit<_sanity_client12.SanityProject, "members">[]>, [options?: {
|
|
1896
|
-
organizationId?: string;
|
|
1897
|
-
includeMembers?: boolean;
|
|
1898
|
-
} | undefined], Promise<Omit<_sanity_client12.SanityProject, "members">[]>>;
|
|
2100
|
+
declare const getProjectsState: GetProjectsState;
|
|
2101
|
+
/** @public */
|
|
2102
|
+
declare const resolveProjects: ResolveProjects;
|
|
1899
2103
|
/**
|
|
1900
2104
|
* @beta
|
|
1901
2105
|
*/
|
|
@@ -1975,12 +2179,12 @@ interface ReleasesStoreState {
|
|
|
1975
2179
|
* @internal
|
|
1976
2180
|
*/
|
|
1977
2181
|
declare const getActiveReleasesState: (instance: SanityInstance, options?: {
|
|
1978
|
-
|
|
2182
|
+
resource?: DocumentResource;
|
|
1979
2183
|
}) => StateSource<ReleaseDocument[] | undefined>;
|
|
1980
2184
|
declare const _getPerspectiveStateSelector: StoreAction<ReleasesStoreState, [_?: (PerspectiveHandle & {
|
|
1981
2185
|
projectId?: string;
|
|
1982
2186
|
dataset?: string;
|
|
1983
|
-
|
|
2187
|
+
resource?: DocumentResource;
|
|
1984
2188
|
}) | undefined], StateSource<string[] | "previewDrafts" | "published" | "drafts" | "raw" | undefined>, unknown>;
|
|
1985
2189
|
type OmitFirst<T extends unknown[]> = T extends [unknown, ...infer R] ? R : never;
|
|
1986
2190
|
type SelectorParams = OmitFirst<Parameters<typeof _getPerspectiveStateSelector>>;
|
|
@@ -2260,6 +2464,28 @@ declare function defineIntent(intent: Intent): Intent;
|
|
|
2260
2464
|
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
2261
2465
|
*/
|
|
2262
2466
|
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
2467
|
+
/**
|
|
2468
|
+
* Returns true when the given error looks like a dynamic-import or
|
|
2469
|
+
* code-split chunk-loading failure.
|
|
2470
|
+
*
|
|
2471
|
+
* These errors typically surface when a user has a tab open against a
|
|
2472
|
+
* previously-deployed version of an app and the JavaScript or CSS chunk
|
|
2473
|
+
* filenames have since changed: a fresh deployment removes the hashed assets
|
|
2474
|
+
* the open tab still references. Detecting them lets the SDK trigger an
|
|
2475
|
+
* automatic reload so the user gets the new build without manual intervention.
|
|
2476
|
+
*
|
|
2477
|
+
* Recognized shapes (webpack ChunkLoadError, Vite "Failed to fetch
|
|
2478
|
+
* dynamically imported module", Firefox "error loading dynamically imported
|
|
2479
|
+
* module", Safari "Importing a module script failed", and Vite "Unable to
|
|
2480
|
+
* preload CSS").
|
|
2481
|
+
*
|
|
2482
|
+
* @param error - The value to inspect. Anything that is not an Error
|
|
2483
|
+
* instance returns false.
|
|
2484
|
+
* @returns True if the error matches a known import/chunk-load failure.
|
|
2485
|
+
*
|
|
2486
|
+
* @public
|
|
2487
|
+
*/
|
|
2488
|
+
declare function isImportError(error: unknown): boolean;
|
|
2263
2489
|
/**
|
|
2264
2490
|
* This version is provided by pkg-utils at build time
|
|
2265
2491
|
* @internal
|
|
@@ -2393,4 +2619,4 @@ declare function getClientErrorApiType(error: ClientError): string | undefined;
|
|
|
2393
2619
|
declare function getClientErrorApiDescription(error: ClientError): string | undefined;
|
|
2394
2620
|
/** @internal True if the error represents a projectUserNotFoundError. */
|
|
2395
2621
|
declare function isProjectUserNotFoundClientError(error: ClientError): boolean;
|
|
2396
|
-
export {
|
|
2622
|
+
export { ProjectsOptions as $, NodeState as $n, ReleasePerspective as $r, getFavoritesState as $t, isImportError as A, DocumentAction as An, AgentTranslateOptions as Ar, TransportEvent as At, loadMoreUsers as B, getDatasetsState as Bn, CanvasResource$1 as Br, UsersGroupState as Bt, getIndexForKey as C, PermissionDeniedReason as Cn, AgentGenerateResult as Cr, ProjectionValuePending as Ct, slicePath as D, CreateDocumentAction as Dn, AgentPromptResult as Dr, PresenceLocation as Dt, jsonMatch as E, StateSource as En, AgentPromptOptions as Er, DisconnectEvent as Et, createGroqSearchFilter as F, deleteDocument as Fn, agentTransform as Fr, ResolveUserOptions as Ft, getPerspectiveState as G, LogLevel as Gn, DocumentHandle as Gr, resolveOrganizations as Gt, resolveUsers as H, configureLogging as Hn, DatasetHandle as Hr, Organizations as Ht, FetcherStore as I, discardDocument as In, agentTranslate as Ir, ResolveUsersOptions as It, QueryOptions as J, LoggerConfig as Jn, DocumentTypeHandle as Jr, OrganizationMember as Jt, ReleaseDocument as K, LogNamespace as Kn, DocumentResource as Kr, Organization as Kt, FetcherStoreState as L, editDocument as Ln, SanityInstance as Lr, SanityUser as Lt, Intent as M, PublishDocumentAction as Mn, agentGenerate as Mr, GetUserOptions as Mt, IntentFilter as N, UnpublishDocumentAction as Nn, agentPatch as Nr, GetUsersOptions as Nt, stringifyPath as O, DeleteDocumentAction as On, AgentTransformOptions as Or, RollCallEvent as Ot, defineIntent as P, createDocument as Pn, agentPrompt as Pr, Membership as Pt, resolveQuery as Q, createProjectHandle as Qn, ProjectHandle as Qr, FavoriteStatusResponse as Qt, getUserState as R, publishDocument as Rn, createSanityInstance as Rr, SanityUserResponse as Rt, SanityProject$1 as S, DocumentPermissionsResult as Sn, AgentGenerateOptions as Sr, ValuePending as St, joinPaths as T, Selector as Tn, AgentPatchResult as Tr, getPresence as Tt, getUsersKey as U, InstanceContext as Un, DatasetResource as Ur, OrganizationsOptions as Ut, resolveUser as V, resolveDatasets as Vn, CanvasSource as Vr, UsersStoreState as Vt, parseUsersKey as W, LogContext as Wn, DatasetSource as Wr, getOrganizationsState as Wt, getQueryState as X, createDocumentHandle as Xn, MediaLibrarySource as Xr, getOrganizationState as Xt, getQueryKey as Y, createDatasetHandle as Yn, MediaLibraryResource as Yr, OrganizationOptions as Yt, parseQueryKey as Z, createDocumentTypeHandle as Zn, PerspectiveHandle as Zr, resolveOrganization as Zt, getTokenState as _, getDocumentSyncStatus as _n, logout as _r, getPreviewState as _t, isProjectUserNotFoundClientError as a, isDatasetResource as ai, DocumentCreatedEvent as an, destroyController as ar, ProjectBase as at, Role as b, resolvePermissions as bn, OrgVerificationResult as br, PreviewStoreState as bt, ErrorAuthState as c, isMediaLibrarySource as ci, DocumentEditedEvent as cn, releaseChannel as cr, ProjectMetadata as ct, LoggingInAuthState as d, DocumentTransactionSubmissionResult as dn, RequestNewTokenMessage as dr, resolveProject as dt, SanityConfig as ei, resolveFavoritesState as en, getNodeState as er, getProjectsState as et, getAuthState as f, DocumentUnpublishedEvent as fn, WindowMessage as fr, ResolvePreviewOptions as ft, getLoginUrlState as g, getDocumentState as gn, getClientState as gr, GetPreviewStateOptions as gt, getIsInDashboardState as h, DocumentOptions as hn, getClient as hr, PREVIEW_PROJECTION as ht, getClientErrorApiType as i, isCanvasSource as ii, ActionErrorEvent as in, ComlinkControllerState as ir, Project as it, getCorsErrorProjectId as j, EditDocumentAction as jn, AgentTranslateResult as jr, UserPresence as jt, CORE_SDK_VERSION as k, DiscardDocumentAction as kn, AgentTransformResult as kr, StateEvent as kt, LoggedInAuthState as l, AuthConfig as li, DocumentEvent as ln, FrameMessage as lr, ProjectOptions as lt, getDashboardOrganizationId as m, TransactionRevertedEvent as mn, ClientStoreState as mr, transformProjectionToPreview as mt, getClientErrorApiBody as n, TokenSource as ni, ApplyDocumentActionsOptions as nn, getOrCreateNode as nr, resolveProjection as nt, AuthState as o, isDatasetSource as oi, DocumentDeletedEvent as on, getOrCreateChannel as or, ProjectMember as ot, getCurrentUserState as p, TransactionAcceptedEvent as pn, ClientOptions as pr, resolvePreview as pt, getActiveReleasesState as q, Logger as qn, DocumentSource as qr, OrganizationBase as qt, getClientErrorApiDescription as r, isCanvasResource as ri, applyDocumentActions as rn, releaseNode as rr, getProjectionState as rt, AuthStoreState as s, isMediaLibraryResource as si, DocumentDiscardedEvent as sn, getOrCreateController as sr, ProjectMemberRole as st, ApiErrorBody as t, StudioConfig as ti, ActionsResult as tn, ComlinkNodeState as tr, resolveProjects as tt, LoggedOutAuthState as u, AuthProvider as ui, DocumentPublishedEvent as un, NewTokenResponseMessage as ur, getProjectState as ut, setAuthToken as v, getPermissionsState as vn, handleAuthCallback as vr, PreviewMedia as vt, getPathDepth as w, JsonMatch as wn, AgentPatchOptions as wr, ValidProjection as wt, SanityDocument$3 as x, subscribeDocumentEvents as xn, AuthStateType as xr, PreviewValue as xt, CurrentUser$1 as y, resolveDocument as yn, observeOrganizationVerificationState as yr, PreviewQueryResult as yt, getUsersState as z, unpublishDocument as zn, isStudioConfig as zr, UserProfile as zt };
|
|
@@ -5,7 +5,7 @@ function isLocalUrl(win) {
|
|
|
5
5
|
return url ? url.startsWith("http://localhost") || url.startsWith("https://localhost") || url.startsWith("http://127.0.0.1") || url.startsWith("https://127.0.0.1") : !1;
|
|
6
6
|
}
|
|
7
7
|
function isDevMode() {
|
|
8
|
-
return typeof
|
|
8
|
+
return typeof window < "u" ? isLocalUrl(window) : typeof process < "u" && process.env?.NODE_ENV === "development";
|
|
9
9
|
}
|
|
10
10
|
const SDKDevSessionStarted = defineEvent({
|
|
11
11
|
name: "SDK Dev Session Started",
|
|
@@ -99,23 +99,12 @@ function trackHookMounted(instance, hookName) {
|
|
|
99
99
|
logger.trace("hook mounted (logged)", { hookName, internal: !0 }), manager.logHookFirstUsed(hookName);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
const root =
|
|
102
|
+
const root = instance;
|
|
103
103
|
let hooks = pendingHooks.get(root);
|
|
104
104
|
hooks || (hooks = /* @__PURE__ */ new Set(), pendingHooks.set(root, hooks)), hooks.has(hookName) || logger.trace("hook mounted (buffered)", { hookName, internal: !0 }), hooks.add(hookName);
|
|
105
105
|
}
|
|
106
106
|
function findManager(instance) {
|
|
107
|
-
|
|
108
|
-
for (; current; ) {
|
|
109
|
-
const manager = telemetryManagers.get(current);
|
|
110
|
-
if (manager) return manager;
|
|
111
|
-
current = typeof current.getParent == "function" ? current.getParent() : void 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function getRootInstance(instance) {
|
|
115
|
-
let current = instance;
|
|
116
|
-
for (; typeof current.getParent == "function" && current.getParent(); )
|
|
117
|
-
current = current.getParent();
|
|
118
|
-
return current;
|
|
107
|
+
return telemetryManagers.get(instance);
|
|
119
108
|
}
|
|
120
109
|
export {
|
|
121
110
|
SDKDevError,
|