type HostModule = { __type: 'host'; create(host: H): T; }; type HostModuleAPI> = T extends HostModule ? U : never; type Host = { channel: { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; }; environment?: Environment; /** * Optional name of the environment, use for logging */ name?: string; /** * Optional bast url to use for API requests, for example `www.wixapis.com` */ apiBaseUrl?: string; /** * Possible data to be provided by every host, for cross cutting concerns * like internationalization, billing, etc. */ essentials?: { /** * The language of the currently viewed session */ language?: string; /** * The locale of the currently viewed session */ locale?: string; /** * Any headers that should be passed through to the API requests */ passThroughHeaders?: Record; }; }; type RESTFunctionDescriptor any = (...args: any[]) => any> = (httpClient: HttpClient) => T; interface HttpClient { request(req: RequestOptionsFactory): Promise>; fetchWithAuth: typeof fetch; wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise; getActiveToken?: () => string | undefined; } type RequestOptionsFactory = (context: any) => RequestOptions; type HttpResponse = { data: T; status: number; statusText: string; headers: any; request?: any; }; type RequestOptions<_TResponse = any, Data = any> = { method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; url: string; data?: Data; params?: URLSearchParams; } & APIMetadata; type APIMetadata = { methodFqn?: string; entityFqdn?: string; packageName?: string; }; type BuildRESTFunction = T extends RESTFunctionDescriptor ? U : never; type EventDefinition = { __type: 'event-definition'; type: Type; isDomainEvent?: boolean; transformations?: (envelope: unknown) => Payload; __payload: Payload; }; declare function EventDefinition(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): () => EventDefinition; type EventHandler = (payload: T['__payload']) => void | Promise; type BuildEventDefinition> = (handler: EventHandler) => void; type ServicePluginMethodInput = { request: any; metadata: any; }; type ServicePluginContract = Record unknown | Promise>; type ServicePluginMethodMetadata = { name: string; primaryHttpMappingPath: string; transformations: { fromREST: (...args: unknown[]) => ServicePluginMethodInput; toREST: (...args: unknown[]) => unknown; }; }; type ServicePluginDefinition = { __type: 'service-plugin-definition'; componentType: string; methods: ServicePluginMethodMetadata[]; __contract: Contract; }; declare function ServicePluginDefinition(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition; type BuildServicePluginDefinition> = (implementation: T['__contract']) => void; declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; type RequestContext = { isSSR: boolean; host: string; protocol?: string; }; type ResponseTransformer = (data: any, headers?: any) => any; /** * Ambassador request options types are copied mostly from AxiosRequestConfig. * They are copied and not imported to reduce the amount of dependencies (to reduce install time). * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 */ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; type AmbassadorRequestOptions = { _?: T; url?: string; method?: Method; params?: any; data?: any; transformResponse?: ResponseTransformer | ResponseTransformer[]; }; type AmbassadorFactory = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions) & { __isAmbassador: boolean; }; type AmbassadorFunctionDescriptor = AmbassadorFactory; type BuildAmbassadorFunction = T extends AmbassadorFunctionDescriptor ? (req: Request) => Promise : never; declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. interface SymbolConstructor { readonly observable: symbol; } } declare const emptyObjectSymbol: unique symbol; /** Represents a strictly empty plain object, the `{}` value. When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). @example ``` import type {EmptyObject} from 'type-fest'; // The following illustrates the problem with `{}`. const foo1: {} = {}; // Pass const foo2: {} = []; // Pass const foo3: {} = 42; // Pass const foo4: {} = {a: 1}; // Pass // With `EmptyObject` only the first case is valid. const bar1: EmptyObject = {}; // Pass const bar2: EmptyObject = 42; // Fail const bar3: EmptyObject = []; // Fail const bar4: EmptyObject = {a: 1}; // Fail ``` Unfortunately, `Record`, `Record` and `Record` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. @category Object */ type EmptyObject = {[emptyObjectSymbol]?: never}; /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ type IsEqual = (() => G extends A ? 1 : 2) extends (() => G extends B ? 1 : 2) ? true : false; /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ type Filter = IsEqual extends true ? never : (KeyType extends ExcludeType ? never : KeyType); type ExceptOptions = { /** Disallow assigning non-specified properties. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. @default false */ requireExactProps?: boolean; }; /** Create a type from an object type without certain keys. We recommend setting the `requireExactProps` option to `true`. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). @example ``` import type {Except} from 'type-fest'; type Foo = { a: number; b: string; }; type FooWithoutA = Except; //=> {b: string} const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; //=> errors: 'a' does not exist in type '{ b: string; }' type FooWithoutB = Except; //=> {a: number} & Partial> const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; //=> errors at 'b': Type 'string' is not assignable to type 'undefined'. ``` @category Object */ type Except = { [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial> : {}); /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts type AreStringsEqual = And< IsNever> extends true ? true : false, IsNever> extends true ? true : false >; type EndIfEqual = AreStringsEqual extends true ? never : void; function endIfEqual(input: I, output: O): EndIfEqual { if (input === output) { process.exit(0); } } endIfEqual('abc', 'abc'); //=> never endIfEqual('abc', '123'); //=> void ``` @category Type Guard @category Utilities */ type IsNever = [T] extends [never] ? true : false; /** An if-else-like type that resolves depending on whether the given type is `never`. @see {@link IsNever} @example ``` import type {IfNever} from 'type-fest'; type ShouldBeTrue = IfNever; //=> true type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfNever = ( IsNever extends true ? TypeIfNever : TypeIfNotNever ); /** Extract the keys from a type where the value type of the key extends the given `Condition`. Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. @example ``` import type {ConditionalKeys} from 'type-fest'; interface Example { a: string; b: string | number; c?: string; d: {}; } type StringKeysOnly = ConditionalKeys; //=> 'a' ``` To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. @example ``` import type {ConditionalKeys} from 'type-fest'; type StringKeysAndUndefined = ConditionalKeys; //=> 'a' | 'c' ``` @category Object */ type ConditionalKeys = { // Map through all the keys of the given base type. [Key in keyof Base]-?: // Pick only keys with types extending the given `Condition` type. Base[Key] extends Condition // Retain this key // If the value for the key extends never, only include it if `Condition` also extends never ? IfNever, Key> // Discard this key since the condition fails. : never; // Convert the produced object into a union type of the keys which passed the conditional test. }[keyof Base]; /** Exclude keys from a shape that matches the given `Condition`. This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. @example ``` import type {Primitive, ConditionalExcept} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type ExceptPrimitivesFromAwesome = ConditionalExcept; //=> {run: () => void} ``` @example ``` import type {ConditionalExcept} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type NonStringKeysOnly = ConditionalExcept; //=> {b: string | number; c: () => void; d: {}} ``` @category Object */ type ConditionalExcept = Except< Base, ConditionalKeys >; /** * Descriptors are objects that describe the API of a module, and the module * can either be a REST module or a host module. * This type is recursive, so it can describe nested modules. */ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule | EventDefinition | ServicePluginDefinition | { [key: string]: Descriptors | PublicMetadata | any; }; /** * This type takes in a descriptors object of a certain Host (including an `unknown` host) * and returns an object with the same structure, but with all descriptors replaced with their API. * Any non-descriptor properties are removed from the returned object, including descriptors that * do not match the given host (as they will not work with the given host). */ type BuildDescriptors | undefined, Depth extends number = 5> = { done: T; recurse: T extends { __type: typeof SERVICE_PLUGIN_ERROR_TYPE; } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction : T extends RESTFunctionDescriptor ? BuildRESTFunction : T extends EventDefinition ? BuildEventDefinition : T extends ServicePluginDefinition ? BuildServicePluginDefinition : T extends HostModule ? HostModuleAPI : ConditionalExcept<{ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors : never; }, EmptyObject>; }[Depth extends -1 ? 'done' : 'recurse']; type PublicMetadata = { PACKAGE_NAME?: string; }; declare global { interface ContextualClient { } } /** * A type used to create concerete types from SDK descriptors in * case a contextual client is available. */ type MaybeContext = globalThis.ContextualClient extends { host: Host; } ? BuildDescriptors : T; /** API is not yet fully migrated to FQDN entity */ interface SiteDocument { /** the document payload */ document?: Record | null; } interface UpdateInternalDocumentsEvent extends UpdateInternalDocumentsEventOperationOneOf { /** insert/update documents */ update?: InternalDocumentUpdateOperation; /** delete by document ids */ deleteByIds?: DeleteByIdsOperation; /** delete documents matching filter */ deleteByFilter?: DeleteByFilterOperation; /** update internal documents matching filter */ updateByFilter?: InternalDocumentUpdateByFilterOperation; /** update only existing documents */ updateExisting?: InternalUpdateExistingOperation; /** insert/update documents with versioning */ versionedUpdate?: VersionedDocumentUpdateOperation; /** delete by document ids with versioning */ versionedDeleteByIds?: VersionedDeleteByIdsOperation; /** type of the documents */ documentType?: string; /** language of the documents (mandatory) */ language?: string | null; /** * one or more search documents * @deprecated */ addDocuments?: InternalDocument[]; /** * one or more ids of indexed documents to be removed. Removal will happen before addition (if both provided) * @deprecated */ removeDocumentIds?: string[]; /** id to pass to processing notification */ correlationId?: string | null; /** when event was created / issued */ issuedAt?: Date | null; } /** @oneof */ interface UpdateInternalDocumentsEventOperationOneOf { /** insert/update documents */ update?: InternalDocumentUpdateOperation; /** delete by document ids */ deleteByIds?: DeleteByIdsOperation; /** delete documents matching filter */ deleteByFilter?: DeleteByFilterOperation; /** update internal documents matching filter */ updateByFilter?: InternalDocumentUpdateByFilterOperation; /** update only existing documents */ updateExisting?: InternalUpdateExistingOperation; /** insert/update documents with versioning */ versionedUpdate?: VersionedDocumentUpdateOperation; /** delete by document ids with versioning */ versionedDeleteByIds?: VersionedDeleteByIdsOperation; } interface InternalDocument { /** document with mandatory fields (id) and with fields specific to the type of the document */ document?: Record | null; } interface InternalDocumentUpdateOperation { /** documents to index or update */ documents?: InternalDocument[]; } interface DeleteByIdsOperation { /** ids of the documents to delete */ documentIds?: string[]; } interface DeleteByFilterOperation { /** documents matching this filter wil be deleted. only filterable documents defined in document_type can be used for filtering */ filter?: Record | null; } interface InternalDocumentUpdateByFilterOperation { /** documents matching this filter will be updated */ filter?: Record | null; /** partial document to apply */ document?: InternalDocument; } interface InternalUpdateExistingOperation { /** documents to update */ documents?: InternalDocument[]; } interface VersionedDocumentUpdateOperation { /** documents to create or overwrite */ documents?: InternalDocument[]; /** versioning mode to use instead of default */ versioningMode?: VersioningMode; } declare enum VersioningMode { /** use default versioning mode agreed with search team */ DEFAULT = "DEFAULT", /** execute only if version is greater than existing */ GREATER_THAN = "GREATER_THAN", /** execute only if version is greater or equal to existing */ GREATER_OR_EQUAL = "GREATER_OR_EQUAL" } interface VersionedDeleteByIdsOperation { /** ids with version of the documents to delete */ documentIds?: VersionedDocumentId[]; } interface VersionedDocumentId { /** document id */ documentId?: string; /** document version */ version?: string; /** versioning mode to use instead of default */ versioningMode?: VersioningMode; } interface UpdateDocumentsEvent extends UpdateDocumentsEventOperationOneOf { /** insert/update documents */ update?: DocumentUpdateOperation; /** delete by document ids */ deleteByIds?: V1DeleteByIdsOperation; /** delete documents matching filter */ deleteByFilter?: V1DeleteByFilterOperation; /** update documents matching filter */ updateByFilter?: UpdateByFilterOperation; /** update only existing documents */ updateExisting?: UpdateExistingOperation; /** application which owns documents */ appDefId?: string | null; /** type of the documents */ documentType?: string | null; /** language of the documents */ language?: string | null; /** site documents belong to */ msId?: string | null; } /** @oneof */ interface UpdateDocumentsEventOperationOneOf { /** insert/update documents */ update?: DocumentUpdateOperation; /** delete by document ids */ deleteByIds?: V1DeleteByIdsOperation; /** delete documents matching filter */ deleteByFilter?: V1DeleteByFilterOperation; /** update documents matching filter */ updateByFilter?: UpdateByFilterOperation; /** update only existing documents */ updateExisting?: UpdateExistingOperation; } interface DocumentUpdateOperation { /** documents to index or update */ documents?: IndexDocument[]; } interface IndexDocument { /** data bag with non-searchable fields (url, image) */ payload?: DocumentPayload; /** what type of users should documents be visible to */ exposure?: Enum; /** document with mandatory fields (id, title, description) and with fields specific to the type of the document */ document?: Record | null; /** what member groups is the document exposed to. Used only with GROUP_PROTECTED exposure */ permittedMemberGroups?: string[]; /** if true SEO is disabled for this document */ seoHidden?: boolean | null; /** if true the page is a lightbox popup */ isPopup?: boolean | null; } interface DocumentPayload { /** url of the page representing the document */ url?: string | null; /** image which represents the document */ documentImage?: DocumentImage; } interface DocumentImage { /** the name of the image */ name?: string; /** the width of the image */ width?: number; /** the height of the image */ height?: number; } declare enum Enum { /** Default value. Means that permission not set */ UNKNOWN = "UNKNOWN", /** Protected exposure. Exposed to members and owners */ PROTECTED = "PROTECTED", /** Private exposure. Exposed to owners */ PRIVATE = "PRIVATE", /** Public exposure. Visible to everyone */ PUBLIC = "PUBLIC", /** Used for partial updates, to state that exposure is not changing */ UNCHANGED = "UNCHANGED", /** Protected to members of permitted groups and owners */ GROUP_PROTECTED = "GROUP_PROTECTED" } interface V1DeleteByIdsOperation { /** ids of the documents to delete */ documentIds?: string[]; } interface V1DeleteByFilterOperation { /** documents matching this filter wil be deleted. only filterable documents defined in document_type can be used for filtering */ filter?: Record | null; } interface UpdateByFilterOperation { /** documents matching this filter will be updated */ filter?: Record | null; /** partial document to apply */ document?: IndexDocument; } interface UpdateExistingOperation { /** documents to update */ documents?: IndexDocument[]; } interface Empty { } interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface SearchRequest { /** Text to search for. All searchable fields will be searched. */ query?: string | null; /** Document type of documents to search for. All document types are searched if not provided. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Paging parameters. */ paging?: SearchPaging; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** The facets to retrieve. */ facets?: FacetClauses; /** Enable fuzzy search (eg. query 'kalvin clein' will match document with 'calvin klein' in title). */ fuzzy?: boolean | null; /** Highlight texts matching the query. Highlighted text will be wrapped with tag. Defaults to true if not provided. */ highlight?: boolean | null; /** Searchable fields to search in. If not provided, search is executed on all searchable fields in schema */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface OrderingClauses { ordering?: OrderingClause[]; } interface OrderingClause { fieldName?: string | null; direction?: Direction; } declare enum Direction { UninitializedDirection = "UninitializedDirection", ASC = "ASC", DESC = "DESC" } interface SearchPaging { /** * Number of items to skip in the result set. * @deprecated */ skip?: number; /** Number of items to fetch (effectively page size). */ limit?: number; /** Number of items to skip in the result set. */ offset?: number; } interface FacetClauses { /** Each entry represents a single facet with parameters. */ clauses?: FacetClause[]; } interface FacetClause extends FacetClauseClauseOneOf { term?: TermFacet; aggregation?: AggregationFacet; hierarchical?: HierarchicalFacet; } /** @oneof */ interface FacetClauseClauseOneOf { term?: TermFacet; aggregation?: AggregationFacet; hierarchical?: HierarchicalFacet; } declare enum Aggregation { MIN = "MIN", MAX = "MAX", SUM = "SUM" } interface HierarchicalFacet extends HierarchicalFacetClauseOneOf { term?: TermFacet; aggregation?: AggregationFacet; nestedAggregation?: HierarchicalFacet; } /** @oneof */ interface HierarchicalFacetClauseOneOf { term?: TermFacet; aggregation?: AggregationFacet; } interface TermFacet { /** The name of the faceted attribute. */ name?: string; /** Limit the number of facet values returned. Default is 10. */ limit?: number | null; } interface AggregationFacet { /** The name of the faceted attribute. */ name?: string; /** Aggregation type. */ aggregation?: Aggregation; } interface SearchProperty { name?: string; value?: any; } interface SearchResponse { /** Documents matching filter and query. */ documents?: Record[] | null; nextPage?: NextPageResponse; /** * Facets provide "counts in categories" view. For example searching for "Nike" would return * (Shoes, 5), (Socks, 2) indicating numbers for matching by each faceted field. */ facets?: FacetsResponse[]; } interface NextPageResponse { /** Total number of items across all pages */ total?: number; /** The number of items to skip */ skip?: number; /** The number of items to retrieve in one page */ limit?: number; } interface FacetsResponse extends FacetsResponseResponseOneOf { terms?: TermAggregationResponse; minAggregation?: MinAggregationResponse; maxAggregation?: MaxAggregationResponse; minMaxAggregation?: MinMaxAggregationResponse; hierarchicalAggregation?: HierarchicalAggregationResponse; sumAggregation?: SumAggregationResponse; } /** @oneof */ interface FacetsResponseResponseOneOf { terms?: TermAggregationResponse; minAggregation?: MinAggregationResponse; maxAggregation?: MaxAggregationResponse; minMaxAggregation?: MinMaxAggregationResponse; hierarchicalAggregation?: HierarchicalAggregationResponse; sumAggregation?: SumAggregationResponse; } interface FacetCountResponse { /** Facet field value (for example "Shoes", "Socks") */ facetValue?: string; /** Document count within the group */ count?: number; } interface Value { value?: string; facets?: FacetsResponse; count?: number; } interface TermAggregationResponse { /** Facet field (for example productCategory) */ facet?: string; /** Facet values and document counts */ facets?: FacetCountResponse[]; } interface MinAggregationResponse { /** Facet field (for example productPrice) */ facet?: string; /** The minimum value across all documents */ minValue?: number | null; } interface MaxAggregationResponse { /** Facet field (for example productPrice) */ facet?: string; /** The maximum value across all documents */ maxValue?: number | null; } interface MinMaxAggregationResponse { /** Facet field (for example productPrice) */ facet?: string; /** The minimum value across all documents */ minValue?: number | null; /** The maximum value across all documents */ maxValue?: number | null; } interface HierarchicalAggregationResponse { facet?: string; values?: Value[]; } interface SumAggregationResponse { /** Facet field (for example productPrice) */ facet?: string; /** The sum value across all documents */ value?: number | null; } interface FederatedSearchRequest { /** Query phrase to use. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Limit of documents to return per document type. */ limit?: number | null; /** Enable fuzzy search (for example query 'kalvin clein' will match document with 'calvin klein' in title). */ fuzzy?: boolean | null; /** Highlight texts matching the query. Highlighted text will be wrapped with tag. Defaults to true if not provided. */ highlight?: boolean | null; /** Searchable fields to search in. If not provided, search is executed on all searchable fields in schemas */ searchFields?: string[]; /** Document types to search in. If not provided, search is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface FederatedSearchResponse { /** Search results from multiple indexes. */ results?: FederatedSearchDocuments[]; } interface FederatedSearchDocuments { /** Document type of documents */ documentType?: string | null; /** Documents of document type */ documents?: Record[] | null; /** Total count of matching documents for document type */ total?: number; } interface SuggestRequest { /** Text to search for. Fields configured in suggester configuration will be searched. */ query?: string | null; /** Document type of documents to search for. All document types are searched if not provided. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Number of suggested document to return. */ limit?: number; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** Searchable fields to search in. If not provided, search is executed on all suggestable fields in schema */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface SuggestResponse { /** Suggested documents. */ documents?: Record[] | null; } interface FederatedSuggestRequest { /** Text to search for. Fields configured in suggester configuration will be searched. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Number of suggested document to return per document type. */ limit?: number; /** Searchable fields to search in. If not provided, search is executed on all suggestable fields in schemas */ searchFields?: string[]; /** Document types to search in. If not provided, search is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface FederatedSuggestResponse { /** Suggest results from multiple indexes. */ results?: FederatedSuggestDocuments[]; } interface FederatedSuggestDocuments { /** Document type of documents */ documentType?: string | null; /** Documents of document type */ documents?: Record[] | null; } interface RelatedRequest { /** ID of the document to fetch related documents for. */ documentId?: string | null; /** Document type of the document. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}). */ filter?: Record | null; /** Searchable fields to compare documents by. If not provided, all searchable fields in schema are used */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** Number of related documents to return */ limit?: number; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`. */ properties?: SearchProperty[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface RelatedResponse { /** Documents matching filter and query. */ documents?: Record[] | null; } interface AutocompleteRequest { /** Query phrase to fetch completions for. */ query?: string | null; /** Document type to use to search for phrases. */ documentType?: string | null; /** Limit of phrases to fetch. */ limit?: number; /** Language to search in. */ language?: string | null; /** Filter in platfromized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** Searchable fields to use for query completion. If not provided, all searchable fields in schema are used */ searchFields?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface AutocompleteResponse { /** Suggested phrases. */ values?: AutocompleteResponseValue[]; } interface AutocompleteResponseValue { /** Suggested phrase. */ query?: string; } interface FederatedAutocompleteRequest { /** Query phrase to fetch completions for. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Number of queries to return per document type. */ limit?: number; /** Searchable fields to search in. If not provided, search is executed on all autocompletable fields in schemas */ searchFields?: string[]; /** Document types to autocomplete in. If not provided, autocomplete is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface FederatedAutocompleteResponse { /** Suggested phrases from multiple indexes */ results?: FederatedAutocompleteResults[]; } interface FederatedAutocompleteResults { /** Document type of queries */ documentType?: string | null; /** Suggested phrases */ values?: AutocompleteResponseValue[]; } interface TrendingRequest { documentTypes?: string[]; language?: string | null; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface TrendingResponse { results?: TrendingItems[]; } interface TrendingItems { documentType?: string; documents?: Record[] | null; } interface NextPageResponseNonNullableFields { total: number; skip: number; limit: number; } interface FacetCountResponseNonNullableFields { facetValue: string; count: number; } interface TermAggregationResponseNonNullableFields { facet: string; facets: FacetCountResponseNonNullableFields[]; } interface MinAggregationResponseNonNullableFields { facet: string; } interface MaxAggregationResponseNonNullableFields { facet: string; } interface MinMaxAggregationResponseNonNullableFields { facet: string; } interface ValueNonNullableFields { value: string; facets?: FacetsResponseNonNullableFields; count: number; } interface HierarchicalAggregationResponseNonNullableFields { facet: string; values: ValueNonNullableFields[]; } interface SumAggregationResponseNonNullableFields { facet: string; } interface FacetsResponseNonNullableFields { terms?: TermAggregationResponseNonNullableFields; minAggregation?: MinAggregationResponseNonNullableFields; maxAggregation?: MaxAggregationResponseNonNullableFields; minMaxAggregation?: MinMaxAggregationResponseNonNullableFields; hierarchicalAggregation?: HierarchicalAggregationResponseNonNullableFields; sumAggregation?: SumAggregationResponseNonNullableFields; } interface SearchResponseNonNullableFields { nextPage?: NextPageResponseNonNullableFields; facets: FacetsResponseNonNullableFields[]; } interface FederatedSearchDocumentsNonNullableFields { total: number; } interface FederatedSearchResponseNonNullableFields { results: FederatedSearchDocumentsNonNullableFields[]; } interface AutocompleteResponseValueNonNullableFields { query: string; } interface AutocompleteResponseNonNullableFields { values: AutocompleteResponseValueNonNullableFields[]; } interface FederatedAutocompleteResultsNonNullableFields { values: AutocompleteResponseValueNonNullableFields[]; } interface FederatedAutocompleteResponseNonNullableFields { results: FederatedAutocompleteResultsNonNullableFields[]; } interface TrendingItemsNonNullableFields { documentType: string; } interface TrendingResponseNonNullableFields { results: TrendingItemsNonNullableFields[]; } interface SearchOptions { /** Text to search for. All searchable fields will be searched. */ query?: string | null; /** Document type of documents to search for. All document types are searched if not provided. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Paging parameters. */ paging?: SearchPaging; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** The facets to retrieve. */ facets?: FacetClauses; /** Enable fuzzy search (eg. query 'kalvin clein' will match document with 'calvin klein' in title). */ fuzzy?: boolean | null; /** Highlight texts matching the query. Highlighted text will be wrapped with tag. Defaults to true if not provided. */ highlight?: boolean | null; /** Searchable fields to search in. If not provided, search is executed on all searchable fields in schema */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface FederatedSearchOptions { /** Query phrase to use. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Limit of documents to return per document type. */ limit?: number | null; /** Enable fuzzy search (for example query 'kalvin clein' will match document with 'calvin klein' in title). */ fuzzy?: boolean | null; /** Highlight texts matching the query. Highlighted text will be wrapped with tag. Defaults to true if not provided. */ highlight?: boolean | null; /** Searchable fields to search in. If not provided, search is executed on all searchable fields in schemas */ searchFields?: string[]; /** Document types to search in. If not provided, search is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface SuggestOptions { /** Text to search for. Fields configured in suggester configuration will be searched. */ query?: string | null; /** Document type of documents to search for. All document types are searched if not provided. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Number of suggested document to return. */ limit?: number; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** Searchable fields to search in. If not provided, search is executed on all suggestable fields in schema */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface FederatedSuggestOptions { /** Text to search for. Fields configured in suggester configuration will be searched. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Number of suggested document to return per document type. */ limit?: number; /** Searchable fields to search in. If not provided, search is executed on all suggestable fields in schemas */ searchFields?: string[]; /** Document types to search in. If not provided, search is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } interface RelatedOptions { /** ID of the document to fetch related documents for. */ documentId?: string | null; /** Document type of the document. */ documentType?: string | null; /** Fields to order by. */ ordering?: OrderingClauses; /** Language to search in. */ language?: string | null; /** Filter in platformized query language (for example {'field': {'$eq': 'value'}}). */ filter?: Record | null; /** Searchable fields to compare documents by. If not provided, all searchable fields in schema are used */ searchFields?: string[]; /** A list of fields to include in the result set. If not provided, all fields of schema will be included. */ fields?: string[]; /** Number of related documents to return */ limit?: number; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`. */ properties?: SearchProperty[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface AutocompleteOptions { /** Query phrase to fetch completions for. */ query?: string | null; /** Document type to use to search for phrases. */ documentType?: string | null; /** Limit of phrases to fetch. */ limit?: number; /** Language to search in. */ language?: string | null; /** Filter in platfromized query language (for example {'field': {'$eq': 'value'}}) */ filter?: Record | null; /** Searchable fields to use for query completion. If not provided, all searchable fields in schema are used */ searchFields?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface FederatedAutocompleteOptions { /** Query phrase to fetch completions for. */ query?: string | null; /** Language to search in. */ language?: string | null; /** Number of queries to return per document type. */ limit?: number; /** Searchable fields to search in. If not provided, search is executed on all autocompletable fields in schemas */ searchFields?: string[]; /** Document types to autocomplete in. If not provided, autocomplete is executed on all document types enabled for the site */ documentTypes?: string[]; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; } interface TrendingOptions { documentTypes?: string[]; language?: string | null; /** Include seo hidden documents. Defaults to false if not provided. */ includeSeoHidden?: boolean | null; /** The properties/overrides/experiments to enable for this request. Currently supported: `scoring_profile`, `result-format`. */ properties?: SearchProperty[]; } declare function search$1(httpClient: HttpClient): SearchSignature; interface SearchSignature { /** * Executes a regular search query. * If you are unsure, this is likely the search method you want to used. */ (options?: SearchOptions | undefined): Promise; } declare function federatedSearch$1(httpClient: HttpClient): FederatedSearchSignature; interface FederatedSearchSignature { /** * Searches in multiple document types at once. */ (options?: FederatedSearchOptions | undefined): Promise; } declare function suggest$1(httpClient: HttpClient): SuggestSignature; interface SuggestSignature { /** * Executes search query to fetch suggested items. Unlike search query suggest will match * partial phrases (for example "blu" will match documents containing "blue", "blues" and "blunt"). * Phrase needs to be at least 3 symbols long. Suggestions can also perform optimisations in search * results and generally do not guarantee the same level of quality as regular Search endpoint. */ (options?: SuggestOptions | undefined): Promise; } declare function federatedSuggest$1(httpClient: HttpClient): FederatedSuggestSignature; interface FederatedSuggestSignature { /** * Searches for suggestions in multiple document types at once. */ (options?: FederatedSuggestOptions | undefined): Promise; } declare function related$1(httpClient: HttpClient): RelatedSignature; interface RelatedSignature { /** * Fetches documents similar to one single document. * This is typically used to implement "related to" scenarios (for example to fetch related store products when * consumer is already viewing one). */ (options?: RelatedOptions | undefined): Promise; } declare function autocomplete$1(httpClient: HttpClient): AutocompleteSignature; interface AutocompleteSignature { /** * Provides phrase completion. For example "blu" could return "blue", "blues" and "blunt" as candidate phrases. This operation is resource heavy at index time and is reserved for special use cases. */ (options?: AutocompleteOptions | undefined): Promise; } declare function federatedAutocomplete$1(httpClient: HttpClient): FederatedAutocompleteSignature; interface FederatedAutocompleteSignature { /** * Provides phrase completion from multiple document types at once */ (options?: FederatedAutocompleteOptions | undefined): Promise; } declare function trending$1(httpClient: HttpClient): TrendingSignature; interface TrendingSignature { /** * Returns trending documents for given document types */ (options?: TrendingOptions | undefined): Promise; } declare const search: MaybeContext & typeof search$1>; declare const federatedSearch: MaybeContext & typeof federatedSearch$1>; declare const suggest: MaybeContext & typeof suggest$1>; declare const federatedSuggest: MaybeContext & typeof federatedSuggest$1>; declare const related: MaybeContext & typeof related$1>; declare const autocomplete: MaybeContext & typeof autocomplete$1>; declare const federatedAutocomplete: MaybeContext & typeof federatedAutocomplete$1>; declare const trending: MaybeContext & typeof trending$1>; export { Aggregation, type AggregationFacet, type AutocompleteOptions, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResponseNonNullableFields, type AutocompleteResponseValue, type DeleteByFilterOperation, type DeleteByIdsOperation, Direction, type DocumentImage, type DocumentPayload, type DocumentUpdateOperation, type Empty, Enum, type FacetClause, type FacetClauseClauseOneOf, type FacetClauses, type FacetCountResponse, type FacetsResponse, type FacetsResponseResponseOneOf, type FederatedAutocompleteOptions, type FederatedAutocompleteRequest, type FederatedAutocompleteResponse, type FederatedAutocompleteResponseNonNullableFields, type FederatedAutocompleteResults, type FederatedSearchDocuments, type FederatedSearchOptions, type FederatedSearchRequest, type FederatedSearchResponse, type FederatedSearchResponseNonNullableFields, type FederatedSuggestDocuments, type FederatedSuggestOptions, type FederatedSuggestRequest, type FederatedSuggestResponse, type HierarchicalAggregationResponse, type HierarchicalFacet, type HierarchicalFacetClauseOneOf, type IdentificationData, type IdentificationDataIdOneOf, type IndexDocument, type InternalDocument, type InternalDocumentUpdateByFilterOperation, type InternalDocumentUpdateOperation, type InternalUpdateExistingOperation, type MaxAggregationResponse, type MessageEnvelope, type MinAggregationResponse, type MinMaxAggregationResponse, type NextPageResponse, type OrderingClause, type OrderingClauses, type RelatedOptions, type RelatedRequest, type RelatedResponse, type SearchOptions, type SearchPaging, type SearchProperty, type SearchRequest, type SearchResponse, type SearchResponseNonNullableFields, type SiteDocument, type SuggestOptions, type SuggestRequest, type SuggestResponse, type SumAggregationResponse, type TermAggregationResponse, type TermFacet, type TrendingItems, type TrendingOptions, type TrendingRequest, type TrendingResponse, type TrendingResponseNonNullableFields, type UpdateByFilterOperation, type UpdateDocumentsEvent, type UpdateDocumentsEventOperationOneOf, type UpdateExistingOperation, type UpdateInternalDocumentsEvent, type UpdateInternalDocumentsEventOperationOneOf, type V1DeleteByFilterOperation, type V1DeleteByIdsOperation, type Value, type VersionedDeleteByIdsOperation, type VersionedDocumentId, type VersionedDocumentUpdateOperation, VersioningMode, WebhookIdentityType, autocomplete, federatedAutocomplete, federatedSearch, federatedSuggest, related, search, suggest, trending };