@sanity/sdk 2.2.0 → 2.3.1
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/index.d.ts +23 -339
- package/dist/index.js +182 -1800
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/_exports/index.ts +1 -0
- package/src/auth/authStore.test.ts +12 -20
- package/src/auth/authStore.ts +46 -15
- package/src/auth/studioModeAuth.test.ts +4 -4
- package/src/auth/studioModeAuth.ts +4 -5
- package/src/auth/subscribeToStateAndFetchCurrentUser.ts +20 -9
- package/src/auth/utils.test.ts +34 -0
- package/src/auth/utils.ts +10 -2
- package/src/document/permissions.test.ts +2 -3
- package/src/document/permissions.ts +3 -3
- package/src/document/processActions.test.ts +1 -1
- package/src/document/processActions.ts +3 -3
- package/src/projection/getProjectionState.ts +5 -5
- package/src/projection/projectionQuery.test.ts +5 -6
- package/src/projection/projectionQuery.ts +4 -7
- package/src/projection/resolveProjection.test.ts +2 -2
- package/src/projection/resolveProjection.ts +2 -2
- package/src/projection/types.ts +9 -6
- package/src/projection/util.ts +2 -4
- package/src/query/queryStore.ts +14 -2
- package/src/utils/getCorsErrorProjectId.test.ts +46 -0
- package/src/utils/getCorsErrorProjectId.ts +15 -0
- package/src/document/_synchronous-groq-js.mjs +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ 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$3, SanityProjectionResult, SanityQueryResult } from "groq";
|
|
9
|
+
import { ExprNode } from "groq-js";
|
|
9
10
|
import { CanvasResource, MediaResource, StudioResource } from "@sanity/message-protocol";
|
|
10
11
|
import { getIndexForKey, getPathDepth, joinPaths, jsonMatch, slicePath, stringifyPath } from "@sanity/json-match";
|
|
11
12
|
/**
|
|
@@ -287,6 +288,10 @@ interface DashboardContext {
|
|
|
287
288
|
env?: string;
|
|
288
289
|
orgId?: string;
|
|
289
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* The method of authentication used.
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
290
295
|
type AuthMethodOptions = 'localstorage' | 'cookie' | undefined;
|
|
291
296
|
/**
|
|
292
297
|
* @public
|
|
@@ -742,337 +747,6 @@ interface ApplyDocumentActionsOptions {
|
|
|
742
747
|
declare function applyDocumentActions<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, action: DocumentAction<TDocumentType, TDataset, TProjectId> | DocumentAction<TDocumentType, TDataset, TProjectId>[], options?: ApplyDocumentActionsOptions): Promise<ActionsResult<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
743
748
|
/** @beta */
|
|
744
749
|
declare function applyDocumentActions(instance: SanityInstance, action: DocumentAction | DocumentAction[], options?: ApplyDocumentActionsOptions): Promise<ActionsResult>;
|
|
745
|
-
declare interface AccessAttributeNode extends BaseNode {
|
|
746
|
-
type: 'AccessAttribute';
|
|
747
|
-
base?: ExprNode;
|
|
748
|
-
name: string;
|
|
749
|
-
}
|
|
750
|
-
declare interface AccessElementNode extends BaseNode {
|
|
751
|
-
type: 'AccessElement';
|
|
752
|
-
base: ExprNode;
|
|
753
|
-
index: number;
|
|
754
|
-
}
|
|
755
|
-
declare interface AndNode extends BaseNode {
|
|
756
|
-
type: 'And';
|
|
757
|
-
left: ExprNode;
|
|
758
|
-
right: ExprNode;
|
|
759
|
-
}
|
|
760
|
-
declare type AnyStaticValue = StringValue | NumberValue | NullValue | BooleanValue | DateTimeValue | ObjectValue | ArrayValue | PathValue;
|
|
761
|
-
declare interface ArrayCoerceNode extends BaseNode {
|
|
762
|
-
type: 'ArrayCoerce';
|
|
763
|
-
base: ExprNode;
|
|
764
|
-
}
|
|
765
|
-
declare interface ArrayElementNode extends BaseNode {
|
|
766
|
-
type: 'ArrayElement';
|
|
767
|
-
value: ExprNode;
|
|
768
|
-
isSplat: boolean;
|
|
769
|
-
}
|
|
770
|
-
declare interface ArrayNode extends BaseNode {
|
|
771
|
-
type: 'Array';
|
|
772
|
-
elements: ArrayElementNode[];
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
/** Describes a type node for array values. */
|
|
776
|
-
|
|
777
|
-
declare type ArrayValue = StaticValue<unknown[], 'array'>;
|
|
778
|
-
declare interface AscNode extends BaseNode {
|
|
779
|
-
type: 'Asc';
|
|
780
|
-
base: ExprNode;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
/** The base interface for SyntaxNode. */
|
|
784
|
-
declare interface BaseNode {
|
|
785
|
-
type: string;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/** Describes a type node for boolean values, optionally including a value. If a value is provided it will always be the given boolean value. */
|
|
789
|
-
|
|
790
|
-
declare type BooleanValue = StaticValue<boolean, 'boolean'>;
|
|
791
|
-
declare interface Context {
|
|
792
|
-
timestamp: Date;
|
|
793
|
-
identity: string;
|
|
794
|
-
before: Value | null;
|
|
795
|
-
after: Value | null;
|
|
796
|
-
sanity?: {
|
|
797
|
-
projectId: string;
|
|
798
|
-
dataset: string;
|
|
799
|
-
};
|
|
800
|
-
dereference?: DereferenceFunction;
|
|
801
|
-
}
|
|
802
|
-
declare interface ContextNode extends BaseNode {
|
|
803
|
-
type: 'Context';
|
|
804
|
-
key: string;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* createReferenceTypeNode creates a ObjectTypeNode representing a reference type
|
|
809
|
-
* it adds required attributes for a reference type.
|
|
810
|
-
* @param name - The name of the reference type
|
|
811
|
-
* @param inArray - Whether the reference is in an array
|
|
812
|
-
* @returns A ObjectTypeNode representing a reference type
|
|
813
|
-
* @internal
|
|
814
|
-
*/
|
|
815
|
-
|
|
816
|
-
declare class DateTime {
|
|
817
|
-
date: Date;
|
|
818
|
-
constructor(date: Date);
|
|
819
|
-
static parseToValue(str: string): Value;
|
|
820
|
-
equals(other: DateTime): boolean;
|
|
821
|
-
add(secs: number): DateTime;
|
|
822
|
-
difference(other: DateTime): number;
|
|
823
|
-
compareTo(other: DateTime): number;
|
|
824
|
-
toString(): string;
|
|
825
|
-
toJSON(): string;
|
|
826
|
-
}
|
|
827
|
-
declare type DateTimeValue = StaticValue<DateTime, 'datetime'>;
|
|
828
|
-
declare type DereferenceFunction = (obj: {
|
|
829
|
-
_ref: string;
|
|
830
|
-
}) => PromiseLike<Document_2 | null | undefined>;
|
|
831
|
-
declare interface DerefNode extends BaseNode {
|
|
832
|
-
type: 'Deref';
|
|
833
|
-
base: ExprNode;
|
|
834
|
-
}
|
|
835
|
-
declare interface DescNode extends BaseNode {
|
|
836
|
-
type: 'Desc';
|
|
837
|
-
base: ExprNode;
|
|
838
|
-
}
|
|
839
|
-
declare type Document_2 = {
|
|
840
|
-
_id?: string;
|
|
841
|
-
_type?: string;
|
|
842
|
-
[T: string]: unknown;
|
|
843
|
-
};
|
|
844
|
-
declare interface EverythingNode extends BaseNode {
|
|
845
|
-
type: 'Everything';
|
|
846
|
-
}
|
|
847
|
-
declare type Executor<N = ExprNode> = (node: N, scope: Scope) => Value | PromiseLike<Value>;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* A node which can be evaluated into a value.
|
|
851
|
-
* @public
|
|
852
|
-
*/
|
|
853
|
-
declare type ExprNode = AccessAttributeNode | AccessElementNode | AndNode | ArrayNode | ArrayCoerceNode | AscNode | ContextNode | DerefNode | DescNode | EverythingNode | FilterNode | FlatMapNode | FuncCallNode | GroupNode | InRangeNode | MapNode | NegNode | NotNode | ObjectNode | OpCallNode | OrNode | ParameterNode | ParentNode_2 | PipeFuncCallNode | PosNode | ProjectionNode | SelectNode | SelectorNode | SliceNode | ThisNode | TupleNode | ValueNode;
|
|
854
|
-
declare interface FilterNode extends BaseNode {
|
|
855
|
-
type: 'Filter';
|
|
856
|
-
base: ExprNode;
|
|
857
|
-
expr: ExprNode;
|
|
858
|
-
}
|
|
859
|
-
declare interface FlatMapNode extends BaseNode {
|
|
860
|
-
type: 'FlatMap';
|
|
861
|
-
base: ExprNode;
|
|
862
|
-
expr: ExprNode;
|
|
863
|
-
}
|
|
864
|
-
declare interface FuncCallNode extends BaseNode {
|
|
865
|
-
type: 'FuncCall';
|
|
866
|
-
func: GroqFunction;
|
|
867
|
-
namespace: string;
|
|
868
|
-
name: string;
|
|
869
|
-
args: ExprNode[];
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/** @public */
|
|
873
|
-
declare type GroqFunction = (args: GroqFunctionArg[], scope: Scope, execute: Executor) => PromiseLike<Value>;
|
|
874
|
-
|
|
875
|
-
/** @public */
|
|
876
|
-
declare type GroqFunctionArg = ExprNode;
|
|
877
|
-
declare type GroqPipeFunction = (base: Value, args: ExprNode[], scope: Scope, execute: Executor) => PromiseLike<Value>;
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* A type of a value in GROQ.
|
|
881
|
-
*/
|
|
882
|
-
declare type GroqType = 'null' | 'boolean' | 'number' | 'string' | 'array' | 'object' | 'path' | 'datetime';
|
|
883
|
-
declare interface GroupNode extends BaseNode {
|
|
884
|
-
type: 'Group';
|
|
885
|
-
base: ExprNode;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
/** Describes a type node for inline values, including a name that references another type. */
|
|
889
|
-
|
|
890
|
-
declare interface InRangeNode extends BaseNode {
|
|
891
|
-
type: 'InRange';
|
|
892
|
-
base: ExprNode;
|
|
893
|
-
left: ExprNode;
|
|
894
|
-
right: ExprNode;
|
|
895
|
-
isInclusive: boolean;
|
|
896
|
-
}
|
|
897
|
-
declare interface MapNode extends BaseNode {
|
|
898
|
-
type: 'Map';
|
|
899
|
-
base: ExprNode;
|
|
900
|
-
expr: ExprNode;
|
|
901
|
-
}
|
|
902
|
-
declare interface NegNode extends BaseNode {
|
|
903
|
-
type: 'Neg';
|
|
904
|
-
base: ExprNode;
|
|
905
|
-
}
|
|
906
|
-
declare interface NotNode extends BaseNode {
|
|
907
|
-
type: 'Not';
|
|
908
|
-
base: ExprNode;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
/** Describes a type node for null values, always being the null value. */
|
|
912
|
-
|
|
913
|
-
declare type NullValue = StaticValue<null, 'null'>;
|
|
914
|
-
|
|
915
|
-
/** Describes a type node for number values, optionally including a value. If a value is provided it will always be the given numeric value.*/
|
|
916
|
-
|
|
917
|
-
declare type NumberValue = StaticValue<number, 'number'>;
|
|
918
|
-
|
|
919
|
-
/** Describes a type node for object attributes, including a type and an optional flag for being optional. */
|
|
920
|
-
|
|
921
|
-
declare type ObjectAttributeNode = ObjectAttributeValueNode | ObjectConditionalSplatNode | ObjectSplatNode;
|
|
922
|
-
declare interface ObjectAttributeValueNode extends BaseNode {
|
|
923
|
-
type: 'ObjectAttributeValue';
|
|
924
|
-
name: string;
|
|
925
|
-
value: ExprNode;
|
|
926
|
-
}
|
|
927
|
-
declare interface ObjectConditionalSplatNode extends BaseNode {
|
|
928
|
-
type: 'ObjectConditionalSplat';
|
|
929
|
-
condition: ExprNode;
|
|
930
|
-
value: ExprNode;
|
|
931
|
-
}
|
|
932
|
-
declare interface ObjectNode extends BaseNode {
|
|
933
|
-
type: 'Object';
|
|
934
|
-
attributes: ObjectAttributeNode[];
|
|
935
|
-
}
|
|
936
|
-
declare interface ObjectSplatNode extends BaseNode {
|
|
937
|
-
type: 'ObjectSplat';
|
|
938
|
-
value: ExprNode;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Describes a type node for object values, including a collection of attributes and an optional rest value.
|
|
943
|
-
* The rest value can be another ObjectTypeNode, an UnknownTypeNode, or an InlineTypeNode.
|
|
944
|
-
* If the rest value is an ObjectTypeNode, it means that the object can have additional attributes.
|
|
945
|
-
* If the rest value is an UnknownTypeNode, the entire object is unknown.
|
|
946
|
-
* If the rest value is an InlineTypeNode, it means that the object has additional attributes from the referenced type.
|
|
947
|
-
*/
|
|
948
|
-
|
|
949
|
-
declare type ObjectValue = StaticValue<Record<string, unknown>, 'object'>;
|
|
950
|
-
declare type OpCall = '==' | '!=' | '>' | '>=' | '<' | '<=' | '+' | '-' | '*' | '/' | '%' | '**' | 'in' | 'match';
|
|
951
|
-
declare interface OpCallNode extends BaseNode {
|
|
952
|
-
type: 'OpCall';
|
|
953
|
-
op: OpCall;
|
|
954
|
-
left: ExprNode;
|
|
955
|
-
right: ExprNode;
|
|
956
|
-
}
|
|
957
|
-
declare interface OrNode extends BaseNode {
|
|
958
|
-
type: 'Or';
|
|
959
|
-
left: ExprNode;
|
|
960
|
-
right: ExprNode;
|
|
961
|
-
}
|
|
962
|
-
declare interface ParameterNode extends BaseNode {
|
|
963
|
-
type: 'Parameter';
|
|
964
|
-
name: string;
|
|
965
|
-
}
|
|
966
|
-
declare interface ParentNode_2 extends BaseNode {
|
|
967
|
-
type: 'Parent';
|
|
968
|
-
n: number;
|
|
969
|
-
}
|
|
970
|
-
declare class Path {
|
|
971
|
-
private pattern;
|
|
972
|
-
private patternRe;
|
|
973
|
-
constructor(pattern: string);
|
|
974
|
-
matches(str: string): boolean;
|
|
975
|
-
toJSON(): string;
|
|
976
|
-
}
|
|
977
|
-
declare type PathValue = StaticValue<Path, 'path'>;
|
|
978
|
-
declare interface PipeFuncCallNode extends BaseNode {
|
|
979
|
-
type: 'PipeFuncCall';
|
|
980
|
-
func: GroqPipeFunction;
|
|
981
|
-
base: ExprNode;
|
|
982
|
-
name: string;
|
|
983
|
-
args: ExprNode[];
|
|
984
|
-
}
|
|
985
|
-
declare interface PosNode extends BaseNode {
|
|
986
|
-
type: 'Pos';
|
|
987
|
-
base: ExprNode;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/** Union of any primitive type nodes. */
|
|
991
|
-
|
|
992
|
-
declare interface ProjectionNode extends BaseNode {
|
|
993
|
-
type: 'Projection';
|
|
994
|
-
base: ExprNode;
|
|
995
|
-
expr: ExprNode;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
/** A schema consisting of a list of Document or TypeDeclaration items, allowing for complex type definitions. */
|
|
999
|
-
|
|
1000
|
-
declare class Scope {
|
|
1001
|
-
params: Record<string, unknown>;
|
|
1002
|
-
source: Value;
|
|
1003
|
-
value: Value;
|
|
1004
|
-
parent: Scope | null;
|
|
1005
|
-
context: Context;
|
|
1006
|
-
isHidden: boolean;
|
|
1007
|
-
constructor(params: Record<string, unknown>, source: Value, value: Value, context: Context, parent: Scope | null);
|
|
1008
|
-
createNested(value: Value): Scope;
|
|
1009
|
-
createHidden(value: Value): Scope;
|
|
1010
|
-
}
|
|
1011
|
-
declare interface SelectAlternativeNode extends BaseNode {
|
|
1012
|
-
type: 'SelectAlternative';
|
|
1013
|
-
condition: ExprNode;
|
|
1014
|
-
value: ExprNode;
|
|
1015
|
-
}
|
|
1016
|
-
declare interface SelectNode extends BaseNode {
|
|
1017
|
-
type: 'Select';
|
|
1018
|
-
alternatives: SelectAlternativeNode[];
|
|
1019
|
-
fallback?: ExprNode;
|
|
1020
|
-
}
|
|
1021
|
-
declare interface SelectorNode extends BaseNode {
|
|
1022
|
-
type: 'Selector';
|
|
1023
|
-
}
|
|
1024
|
-
declare interface SliceNode extends BaseNode {
|
|
1025
|
-
type: 'Slice';
|
|
1026
|
-
base: ExprNode;
|
|
1027
|
-
left: number;
|
|
1028
|
-
right: number;
|
|
1029
|
-
isInclusive: boolean;
|
|
1030
|
-
}
|
|
1031
|
-
declare class StaticValue<P, T extends GroqType> {
|
|
1032
|
-
data: P;
|
|
1033
|
-
type: T;
|
|
1034
|
-
constructor(data: P, type: T);
|
|
1035
|
-
isArray(): boolean;
|
|
1036
|
-
get(): Promise<any>;
|
|
1037
|
-
[Symbol.asyncIterator](): Generator<Value, void, unknown>;
|
|
1038
|
-
}
|
|
1039
|
-
declare class StreamValue {
|
|
1040
|
-
type: 'stream';
|
|
1041
|
-
private generator;
|
|
1042
|
-
private ticker;
|
|
1043
|
-
private isDone;
|
|
1044
|
-
private data;
|
|
1045
|
-
constructor(generator: () => AsyncGenerator<Value, void, unknown>);
|
|
1046
|
-
isArray(): boolean;
|
|
1047
|
-
get(): Promise<any>;
|
|
1048
|
-
[Symbol.asyncIterator](): AsyncGenerator<Value, void, unknown>;
|
|
1049
|
-
_nextTick(): Promise<void>;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
/** Describes a type node for string values, optionally including a value. If a value is provided it will always be the given string value. */
|
|
1053
|
-
|
|
1054
|
-
declare type StringValue = StaticValue<string, 'string'>;
|
|
1055
|
-
|
|
1056
|
-
/** Any sort of node which appears as syntax */
|
|
1057
|
-
|
|
1058
|
-
declare interface ThisNode extends BaseNode {
|
|
1059
|
-
type: 'This';
|
|
1060
|
-
}
|
|
1061
|
-
declare interface TupleNode extends BaseNode {
|
|
1062
|
-
type: 'Tuple';
|
|
1063
|
-
members: Array<ExprNode>;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/** Defines a type declaration with a specific name and a value that describes the structure of the type using a TypeNode. */
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* The result of an expression.
|
|
1070
|
-
*/
|
|
1071
|
-
declare type Value = AnyStaticValue | StreamValue;
|
|
1072
|
-
declare interface ValueNode<P = any> {
|
|
1073
|
-
type: 'Value';
|
|
1074
|
-
value: P;
|
|
1075
|
-
}
|
|
1076
750
|
/**
|
|
1077
751
|
* Represents a reactive state source that provides synchronized access to store data
|
|
1078
752
|
*
|
|
@@ -1761,10 +1435,6 @@ declare const resolvePreview: BoundStoreAction<PreviewStoreState, [docHandle: Re
|
|
|
1761
1435
|
declare const getProjectState: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined], _sanity_client12.SanityProject>, [options?: ProjectHandle<string> | undefined], StateSource<_sanity_client12.SanityProject | undefined>>;
|
|
1762
1436
|
/** @public */
|
|
1763
1437
|
declare const resolveProject: BoundStoreAction<FetcherStoreState<[options?: ProjectHandle<string> | undefined], _sanity_client12.SanityProject>, [options?: ProjectHandle<string> | undefined], Promise<_sanity_client12.SanityProject>>;
|
|
1764
|
-
/**
|
|
1765
|
-
* @public
|
|
1766
|
-
*/
|
|
1767
|
-
type ValidProjection = `{${string}}`;
|
|
1768
1438
|
/**
|
|
1769
1439
|
* @public
|
|
1770
1440
|
* The result of a projection query
|
|
@@ -1773,13 +1443,20 @@ interface ProjectionValuePending<TValue extends object> {
|
|
|
1773
1443
|
data: TValue | null;
|
|
1774
1444
|
isPending: boolean;
|
|
1775
1445
|
}
|
|
1776
|
-
|
|
1446
|
+
/**
|
|
1447
|
+
* @public
|
|
1448
|
+
* @deprecated
|
|
1449
|
+
* Template literals are a bit too limited, so this type is deprecated.
|
|
1450
|
+
* Use `string` instead. Projection strings are validated at runtime.
|
|
1451
|
+
*/
|
|
1452
|
+
type ValidProjection = string;
|
|
1453
|
+
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1777
1454
|
projection: TProjection;
|
|
1778
1455
|
}
|
|
1779
1456
|
/**
|
|
1780
1457
|
* @beta
|
|
1781
1458
|
*/
|
|
1782
|
-
declare function getProjectionState<TProjection extends
|
|
1459
|
+
declare function getProjectionState<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): StateSource<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>> | undefined>;
|
|
1783
1460
|
/**
|
|
1784
1461
|
* @beta
|
|
1785
1462
|
*/
|
|
@@ -1792,7 +1469,7 @@ declare function getProjectionState(instance: SanityInstance, options: Projectio
|
|
|
1792
1469
|
* @beta
|
|
1793
1470
|
*/
|
|
1794
1471
|
/** @beta */
|
|
1795
|
-
declare function resolveProjection<TProjection extends
|
|
1472
|
+
declare function resolveProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): Promise<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
1796
1473
|
/** @beta */
|
|
1797
1474
|
declare function resolveProjection<TData extends object>(instance: SanityInstance, options: ProjectionOptions): Promise<ProjectionValuePending<TData>>;
|
|
1798
1475
|
/** @public */
|
|
@@ -2177,6 +1854,13 @@ interface Intent {
|
|
|
2177
1854
|
* @public
|
|
2178
1855
|
*/
|
|
2179
1856
|
declare function defineIntent(intent: Intent): Intent;
|
|
1857
|
+
/**
|
|
1858
|
+
* @public
|
|
1859
|
+
* Extracts the project ID from a CorsOriginError message.
|
|
1860
|
+
* @param error - The error to extract the project ID from.
|
|
1861
|
+
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
1862
|
+
*/
|
|
1863
|
+
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
2180
1864
|
/**
|
|
2181
1865
|
* This version is provided by pkg-utils at build time
|
|
2182
1866
|
* @internal
|
|
@@ -2186,4 +1870,4 @@ declare const CORE_SDK_VERSION: {};
|
|
|
2186
1870
|
* @public
|
|
2187
1871
|
*/
|
|
2188
1872
|
type SanityProject = SanityProject$1;
|
|
2189
|
-
export { type ActionErrorEvent, type ActionsResult, type ApplyDocumentActionsOptions, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type ClientOptions, type ClientStoreState as ClientState, type ComlinkControllerState, type ComlinkNodeState, type CreateDocumentAction, type CurrentUser, type DatasetHandle, type DeleteDocumentAction, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPublishedEvent, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type ErrorAuthState, type FavoriteStatusResponse, type FetcherStore, type FetcherStoreState, type FrameMessage, type GetPreviewStateOptions, type GetUserOptions, type GetUsersOptions, type Intent, type IntentFilter, type JsonMatch, type LoggedInAuthState, type LoggedOutAuthState, type LoggingInAuthState, type Membership, type NewTokenResponseMessage, type NodeState, type OrgVerificationResult, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PreviewStoreState, type PreviewValue, type ProjectHandle, type ProjectionValuePending, type PublishDocumentAction, type QueryOptions, type ReleaseDocument, type ReleasePerspective, type RequestNewTokenMessage, type ResolvePreviewOptions, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type Selector, type StateEvent, type StateSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnpublishDocumentAction, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, type ValidProjection, type ValuePending, type WindowMessage, applyDocumentActions, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createGroqSearchFilter, createProjectHandle, createSanityInstance, defineIntent, deleteDocument, destroyController, discardDocument, editDocument, getActiveReleasesState, getAuthState, getClient, getClientState, getCurrentUserState, getDashboardOrganizationId, getDatasetsState, getDocumentState, getDocumentSyncStatus, getFavoritesState, getIndexForKey, getIsInDashboardState, getLoginUrlState, getNodeState, getOrCreateChannel, getOrCreateController, getOrCreateNode, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getPreviewState, getProjectState, getProjectionState, getProjectsState, getQueryKey, getQueryState, getTokenState, getUserState, getUsersKey, getUsersState, handleAuthCallback, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, parseQueryKey, parseUsersKey, publishDocument, releaseChannel, releaseNode, resolveDatasets, resolveDocument, resolveFavoritesState, resolvePermissions, resolvePreview, resolveProject, resolveProjection, resolveProjects, resolveQuery, resolveUser, resolveUsers, setAuthToken, slicePath, stringifyPath, subscribeDocumentEvents, unpublishDocument };
|
|
1873
|
+
export { type ActionErrorEvent, type ActionsResult, type ApplyDocumentActionsOptions, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type ClientOptions, type ClientStoreState as ClientState, type ComlinkControllerState, type ComlinkNodeState, type CreateDocumentAction, type CurrentUser, type DatasetHandle, type DeleteDocumentAction, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPublishedEvent, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type ErrorAuthState, type FavoriteStatusResponse, type FetcherStore, type FetcherStoreState, type FrameMessage, type GetPreviewStateOptions, type GetUserOptions, type GetUsersOptions, type Intent, type IntentFilter, type JsonMatch, type LoggedInAuthState, type LoggedOutAuthState, type LoggingInAuthState, type Membership, type NewTokenResponseMessage, type NodeState, type OrgVerificationResult, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PreviewStoreState, type PreviewValue, type ProjectHandle, type ProjectionValuePending, type PublishDocumentAction, type QueryOptions, type ReleaseDocument, type ReleasePerspective, type RequestNewTokenMessage, type ResolvePreviewOptions, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type Selector, type StateEvent, type StateSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnpublishDocumentAction, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, type ValidProjection, type ValuePending, type WindowMessage, applyDocumentActions, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createGroqSearchFilter, createProjectHandle, createSanityInstance, defineIntent, deleteDocument, destroyController, discardDocument, editDocument, getActiveReleasesState, getAuthState, getClient, getClientState, getCorsErrorProjectId, getCurrentUserState, getDashboardOrganizationId, getDatasetsState, getDocumentState, getDocumentSyncStatus, getFavoritesState, getIndexForKey, getIsInDashboardState, getLoginUrlState, getNodeState, getOrCreateChannel, getOrCreateController, getOrCreateNode, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getPreviewState, getProjectState, getProjectionState, getProjectsState, getQueryKey, getQueryState, getTokenState, getUserState, getUsersKey, getUsersState, handleAuthCallback, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, parseQueryKey, parseUsersKey, publishDocument, releaseChannel, releaseNode, resolveDatasets, resolveDocument, resolveFavoritesState, resolvePermissions, resolvePreview, resolveProject, resolveProjection, resolveProjects, resolveQuery, resolveUser, resolveUsers, setAuthToken, slicePath, stringifyPath, subscribeDocumentEvents, unpublishDocument };
|