/**
 * A knowledge graph service is associated with several resources. One resource is a [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/),
 * which contains [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) and [relationships](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/).
 * Another resource is the [data model](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/) that defines the [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/)
 * and [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) in the graph.
 * A third resource is the [service definition](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/ServiceDefinition/) which outlines the capabilities of the service.
 * A knowledge graph service allows users to query both the [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/)
 * and the [data model](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/). Entities and relationships can be added, updated or deleted from the knowledge graph
 * using [executeApplyEdits()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeApplyEdits). To visualize knowledge graph data on map, see [knowledge graph layer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/).
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > KnowledgeGraphService capabilities in version 4.26 of the SDK for Javascript are only supported against ArcGIS Enterprise version 11.1 and later.
 * > KnowledgeGraphService capabilities in version 4.25 of the SDK for Javascript are supported on ArcGIS Enterprise version 11.0 and earlier.
 *
 * @since 4.25
 * @see [Sample - Search a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-search/)
 * @see [Sample - Query a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-query/)
 * @see [Sample - Edit knowledge graph data](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-applyedits/)
 * @see [Sample - Work with KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-knowledgegraphlayer/)
 * @see [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/) for details on visualizing knowledge graph data.
 * @see [Get started with ArcGIS Knowledge Server](https://enterprise.arcgis.com/en/knowledge/latest/introduction/get-started-with-arcgis-knowledge.htm) for overview of ArcGIS Knowledge for ArcGIS Enterprise
 * @see [Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm) for information on managing knowledge graph services via ArcGIS Enterprise and the REST API
 * @see [Get started with ArcGIS Knowledge (ArcGIS Pro)](https://pro.arcgis.com/en/pro-app/latest/help/data/knowledge/get-started-with-arcgis-knowledge.htm) for information on ArcGIS Knowledge in ArcGIS Pro
 * @example
 * const knowledgeGraphModule = await $arcgis.import("@arcgis/core/rest/knowledgeGraphService.js");
 * let knowledgeGraph;
 * // define url to knowledge graph service
 * const url = "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer";
 * // fetch knowledge graph
 * KnowledgeGraphModule.fetchKnowledgeGraph(url)
 *   .then((kg) => {
 *     // do something with result
 *     knowledgeGraph = kg;
 *     console.log(knowledgeGraph);
 * });
 */
import type CodedValueDomain from "../layers/support/CodedValueDomain.js";
import type RangeDomain from "../layers/support/RangeDomain.js";
import type EntityType from "./knowledgeGraph/EntityType.js";
import type FieldIndex from "./knowledgeGraph/FieldIndex.js";
import type GraphAddFieldIndexResult from "./knowledgeGraph/GraphAddFieldIndexResult.js";
import type GraphAddNamedTypesResult from "./knowledgeGraph/GraphAddNamedTypesResult.js";
import type GraphAddPropertyResult from "./knowledgeGraph/GraphAddPropertyResult.js";
import type GraphApplyEdits from "./knowledgeGraph/GraphApplyEdits.js";
import type GraphApplyEditsResult from "./knowledgeGraph/GraphApplyEditsResult.js";
import type GraphDataModelSingletonOperationResult from "./knowledgeGraph/GraphDataModelSingletonOperationResult.js";
import type GraphDeleteFieldIndexResult from "./knowledgeGraph/GraphDeleteFieldIndexResult.js";
import type GraphDeleteNamedTypeResult from "./knowledgeGraph/GraphDeleteNamedTypeResult.js";
import type GraphDeletePropertyResult from "./knowledgeGraph/GraphDeletePropertyResult.js";
import type GraphObjectType from "./knowledgeGraph/GraphObjectType.js";
import type GraphProperty from "./knowledgeGraph/GraphProperty.js";
import type GraphQuery from "./knowledgeGraph/GraphQuery.js";
import type GraphQueryResult from "./knowledgeGraph/GraphQueryResult.js";
import type GraphQueryEncoded from "./knowledgeGraph/GraphQueryStreaming.js";
import type GraphQueryStreamingResult from "./knowledgeGraph/GraphQueryStreamingResult.js";
import type GraphSearch from "./knowledgeGraph/GraphSearch.js";
import type GraphSearchEncoded from "./knowledgeGraph/GraphSearchStreaming.js";
import type GraphUpdateNamedTypesResult from "./knowledgeGraph/GraphUpdateNamedTypesResult.js";
import type GraphUpdatePropertyResult from "./knowledgeGraph/GraphUpdatePropertyResult.js";
import type GraphUpdateSearchIndexResult from "./knowledgeGraph/GraphUpdateSearchIndexResult.js";
import type KnowledgeGraph from "./knowledgeGraph/KnowledgeGraph.js";
import type RelationshipType from "./knowledgeGraph/RelationshipType.js";
import type CIMFilteredFindPathsResultJSON from "./knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsResultJSON.js";
import type FindPathsToolSettings from "./knowledgeGraph/toolService/findPaths/FindPathsToolSettings.js";
import type JobInfo from "./support/JobInfo.js";
import type { RequestOptions } from "../request/types.js";
import type { SearchProperties } from "./knowledgeGraph/SearchIndex.js";
import type { EsriFieldType, EsriMergePolicyTypes, EsriSplitPolicyTypes } from "./knowledgeGraph/types.js";

/**
 * Add, delete, or update [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) and
 * [relationships](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/) in a [knowledge graph service's](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/)
 * [graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) resource. This operation does not allow adding or deleting properties for entity types or relationship types.
 * However, users can update an entity or relationship to change its property values.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit content and editing must be enabled for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated
 * with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param edits - Specifies the [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/)
 * and [relationships](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/) and their properties to add, update or delete.
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is a [GraphApplyEditsResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphApplyEditsResult/).
 * @see [Sample - Edit knowledge graph data](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-applyedits/)
 * @see [ArcGIS REST APIs - Apply Edits (Graph)](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-graph-applyedits.htm).
 * @see [GraphApplyEdits](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphApplyEdits/)
 * @see [GraphApplyEditsResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphApplyEditsResult/)
 * @example
 * // sample executeApplyEdits() to add a new entity to the `Supplier` entity type
 * const newEntity = new Entity({
 *   typeName: "Supplier",
 *   properties: {
 *     Name: "Supplier 5",
 *     EmployeeCount: 681
 *   }
 * });
 * KnowledgeGraphModule.executeApplyEdits(
 *   graph, {
 *       entityAdds: [newEntity]
 *     })
 *     .then((editResult) => {
 *       console.log("Graph Add Result", editResult);
 *     });
 * });
 * @example
 * // Basic example results of adding one entity to the `Supplier` entity type
 * {
 *   editResults:[{
 *     adds:[
 *     {
 *       id: "{A1W5F4A8S-41F1-49A4-8412-ANIWN9906E88}",
 *       error: false
 *     }],
 *     deletes:[],
 *     typeName: "Supplier",
 *     updates:[]
 *   }],
 *   hasError: false,
 *   error: undefined
 * }
 * @example
 * //update existing records
 * const updateEntity = new Entity({
 *   typeName: "Supplier",
 *   // update the EmployeeCount from 681 to 685
 *   properties: {
 *     Name: "Supplier 5",
 *     EmployeeCount: 685
 *   },
 *   id:"{A1W5F4A8S-41F1-49A4-8412-ANIWN9906E88}" //id of entity already in knowledge graph
 * });
 * const updateRelationship = new Relationship({
 *   typeName: "buys_part",
 *   properties: {
 *     quantity: 5000
 *   },
 *   // origin and destination entities must already exist in the graph
 *   originId: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
 *   destinationId: "{9D2D6AFD-41F1-49A4-8412-1DGR8E5D6S1G4}"
 * });
 * KnowledgeGraphModule.executeApplyEdits(
 *   graph, {
 *       entityUpdates: [updateEntity],
 *       relationshipUpdates: [updateRelationship]
 *     })
 *     .then((editResult) => {
 *       console.log("Graph Update Result", editResult);
 *     });
 * });
 * @example
 * //delete existing records
 * KnowledgeGraphModule.executeApplyEdits(
 *   graph, {
 *       entityDeletes: [{
 *         typeName: "Supplier",
 *         ids: ["{AMGIE541G-41F1-49A4-8412-CACCC9906E88}", "{HNWIGHE15-WH52-2GE6-1A5W-A1F8W4FS3A1S5}"]
 *       },{
 *         typeName: "Part",
 *         ids: ["{FNIW4GF1-ANFW-49A4-ANW7-GNWIGHAF4S51FS}"]
 *       }],
 *       relationshipDeletes: [{
 *         typeName: "Buys_part",
 *         ids: ["{MH4E54G8E-MF4W-1842-2S44-15AF5W8F4S2W8}"]
 *       }],
 *       //delete all relationships connected to the deleted entities.
 *       options:{
 *         cascadeDelete: true
 *       }
 *     })
 *     .then((editResult) => {
 *       console.log("Graph Delete Result", editResult);
 *     });
 * });
 */
export function executeApplyEdits(graph: KnowledgeGraph, edits: GraphApplyEdits, requestOptions?: RequestOptions): Promise<GraphApplyEditsResult>;

/**
 * Create new [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) in your knowledge graph.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph. Retrieved using [fetchKnowledgeGraph()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#fetchKnowledgeGraph).
 * @param namedTypes - The new [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) to add to the graph.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is a [GraphAddNamedTypesResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphAddNamedTypesResult/).
 * @since 4.33
 * @example
 * const knowledgeGraphModule = await $arcgis.import("@arcgis/core/rest/knowledgeGraphService.js");
 *
 * // use fetchKnowledgeGraph() to retrieve the knowledge graph
 * // define the new entity type
 * const newEntityType = {
 *   type: "entity",
 *   name: "Person",
 *   properties: [
 *     {
 *       name: "nameProp",
 *       alias: "Name",
 *       fieldType: "esriFieldTypeString",
 *       role: "esriGraphPropertyRegular",
 *     },
 *   ],
 * };
 *
 * // define a new relationship type
 * const newRelationshipType = {
 *   type: "relationship",
 *   name: "knows",
 *   properties: [
 *     {
 *       name: "dateMet",
 *       fieldType: "esriFieldTypeTimestampOffset",
 *       role: "esriGraphPropertyRegular",
 *     },
 *   ],
 *   endPoints: [
 *     {
 *       originEntityType: "Person",
 *       destinationEntityType: "Person",
 *     },
 *   ],
 * };
 *
 * // add the new types, update the data model and get the updated graph.
 * knowledgeGraphModule.executeAddNamedTypes(graph,
 *   {
 *     newEntityTypes: [newEntityType],
 *     newRelationshipTypes: [newRelationshipType]
 *   }).then((response) => {
 *         graph = response.updatedKnowledgeGraph;
 *   })
 */
export function executeAddNamedTypes(graph: KnowledgeGraph, namedTypes: ExecuteAddNamedTypesNamedTypes, options?: RequestOptions): Promise<GraphAddNamedTypesResult>;

export interface ExecuteAddNamedTypesNamedTypes {
  /** The new [entityTypes](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) to add to the graph. */
  newEntityTypes?: EntityType[];
  /** The new [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) to add to the graph. */
  newRelationshipTypes?: RelationshipType[];
}

/**
 * Delete an [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) from the graph. There must be no records of the type in the graph. To delete entities or relationships of the specified type, see [executeApplyEdits()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeApplyEdits).
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph. Retrieved using [fetchKnowledgeGraph()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#fetchKnowledgeGraph).
 * @param namedType - The name of the [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) to delete.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is a [GraphDeleteNamedTypeResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphDeleteNamedTypeResult/).
 * @since 4.33
 * @example
 * const knowledgeGraphModule = await $arcgis.import("@arcgis/core/rest/knowledgeGraphService.js");
 *
 * // use fetchKnowledgeGraph() to retrieve the knowledge graph
 * // Delete the type, update the data model and get the updated graph.
 * knowledgeGraphModule
 *   .executeDeleteNamedType(graph,"knows")
 *       .then((response) => {
 *          graph = response.updatedKnowledgeGraph;
 *       })
 */
export function executeDeleteNamedType(graph: KnowledgeGraph, namedType: string, options?: RequestOptions): Promise<GraphDeleteNamedTypeResult>;

/** Properties of a named type that can be updated, such as the `alias`. */
export interface UpdateNamedType extends Partial<Pick<GraphObjectType, "alias">> {}

/**
 * Update an [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/).
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - -The name of the entity type or relationship type to update with the property to be updated.
 * @param updatedNamedType - The updated entity type or relationship type.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphUpdateNamedTypesResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphUpdateNamedTypesResult/).
 * @since 4.33
 */
export function executeUpdateNamedType(graph: KnowledgeGraph, namedType: string, updatedNamedType: UpdateNamedType, options?: RequestOptions): Promise<GraphUpdateNamedTypesResult>;

/**
 * Add a [GraphProperty](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) for a particular entity type or relationship type.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity type or relationship type to update with the property to be updated.
 * @param namedTypeProperties - A list of [graph properties](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) to add to the entity type or relationship type.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphAddPropertyResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphAddPropertyResult/).
 * @since 4.33
 */
export function executeAddGraphProperties(graph: KnowledgeGraph, namedType: string, namedTypeProperties: GraphProperty[], options?: RequestOptions): Promise<GraphAddPropertyResult>;

/**
 * Delete a [GraphProperty](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) for a particular entity type or relationship type.
 * A GraphProperty can only be deleted if the entity type or relationship type has no entity or relationship records in it.
 *
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity type or relationship type to update with the property to be updated.
 * @param propertyName - The name of the [GraphProperty](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) to delete.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphDeletePropertyResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphDeletePropertyResult/).
 * @since 4.33
 */
export function executeDeleteGraphProperty(graph: KnowledgeGraph, namedType: string, propertyName: string, options?: RequestOptions): Promise<GraphDeletePropertyResult>;

/** The properties of a [GraphProperty](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) that can be updated with [executeUpdateGraphProperty()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeUpdateGraphProperty) */
export interface UpdateGraphProperties extends Partial<Pick<GraphProperty, "alias" | "editable" | "required" | "defaultVisibility" | "defaultValue" | "domain">> {}

/**
 * Update a [GraphProperty](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) for a particular entity type or relationship type in the graph.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity type or relationship type to update with the property to be updated.
 * @param originalPropertyName - The original name of the property to update.
 * @param updatedProperties - The updated properties for the entity type or relationship type property specified.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphUpdatePropertyResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphUpdatePropertyResult/).
 * @since 4.33
 */
export function executeUpdateGraphProperty(graph: KnowledgeGraph, namedType: string, originalPropertyName: string, updatedProperties: UpdateGraphProperties, options?: RequestOptions): Promise<GraphUpdatePropertyResult>;

/**
 * Adds a [field index](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) for a particular property on an
 * entity type or relationship type in a graph.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity type or relationship type with the property for which to add a field index.
 * @param fieldIndexes - The [field indexes](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) to add.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphAddFieldIndexResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphAddFieldIndexResult/).
 * @since 4.33
 */
export function executeAddGraphFieldIndex(graph: KnowledgeGraph, namedType: string, fieldIndexes: FieldIndex[], options?: RequestOptions): Promise<GraphAddFieldIndexResult>;

/**
 * Deletes the [field index](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) for a particular property on an
 * entity type or relationship type in a graph.
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity type or relationship type to update.
 * @param fieldIndexNames - The names of the [field index](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) to delete.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphDeleteFieldIndexResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphDeleteFieldIndexResult/).
 * @since 4.33
 */
export function executeDeleteGraphFieldIndex(graph: KnowledgeGraph, namedType: string, fieldIndexNames: string[], options?: RequestOptions): Promise<GraphDeleteFieldIndexResult>;

/**
 * Update the [search index](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/SearchIndex/) used by the knowledge graph.
 * Properties added to the search index are used identify
 * matches to the search term provided in [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) and [executeSearchStreaming()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearchStreaming).
 *
 * > [!WARNING]
 * >
 * > **Note**
 * >
 * > The user must have [sufficient privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm#TABLE_1ECAC6C4F7F549AF98045224603F0AD2)
 * > to edit the data model for the knowledge graph service for this operation to be successful.
 *
 * @param graph - The knowledge graph to update.
 * @param namedType - The name of the entity or relationship type to update.
 * @param searchProperties - The properties of the named type with which to update the search index.
 * @param options - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphUpdateSearchIndexResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphUpdateSearchIndexResult/).
 * @since 4.33
 */
export function executeUpdateSearchIndex(graph: KnowledgeGraph, namedType: string, searchProperties: ExecuteUpdateSearchIndexSearchProperties, options?: RequestOptions): Promise<GraphUpdateSearchIndexResult>;

export interface ExecuteUpdateSearchIndexSearchProperties {
  /** The properties of the specified entity type or relationship type to add to the search index. */
  addSearchProperties?: SearchProperties;
  /** The properties of the specified entity type or relationship type to remove from the search index. */
  removeSearchProperties?: SearchProperties;
}

/**
 * Executes a query on [knowledge graph service's](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/)
 * [graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) resource using the Esri implementation of [openCypher](https://opencypher.org/) and returns the results.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param queryArguments - Defines the [query](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQuery/) to perform on the provided knowledge graph service.
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphQueryResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryResult/).
 * @since 4.25
 * @see [Sample - Query a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-query/)
 * @see [GraphQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQuery/)
 * @see [GraphQueryResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryResult/)
 * @see [ArcGIS REST API - Query (Graph)](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-graph-query.htm)
 * @example
 * // typical use case
 * KnowledgeGraphModule.executeQuery(
 *  knowledgeGraph, //graph
 *  { // queryArguments
 *    openCypherQuery: "MATCH (n) RETURN n LIMIT 100", //query
 *   }).then((queryResult) => {
 *     // do something with the result
 * });
 */
export function executeQuery(graph: KnowledgeGraph, queryArguments: GraphQuery, requestOptions?: RequestOptions): Promise<GraphQueryResult>;

/**
 * Execute a streaming query on a [knowledge graph service's](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/)
 * [graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) resource.
 * Streaming query returns a readable stream that must be read to access the returned graph data.
 * Unlike [executeQuery()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeQuery),
 * executeQueryStreaming() returns results in small chunks that can be
 * processed immediately, without waiting for all results to be returned.
 * Streaming query is faster and more efficient than executeQuery().
 * Streaming query also retrieves all matching records even if the total exceeds the `maxRecordCount` defined
 * in the service without additional queries or pagination.
 * Another benefit of streaming query is that the query is encoded which means that it is far smaller than a traditional
 * HTTP GET or JSON POST body. This is especially important when trying to do a query on a very large argument,
 * such as a large set of Ids or intersecting a complex geometry.
 *
 * The [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) and [relationships](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/)
 * in the graph are queried by sending an Esri implementation of [openCypher](https://opencypher.org/) query.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service.
 * See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param queryArguments - Defines the [query](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreaming/) to perform on the provided knowledge graph service.
 * Optionally specify additional query parameters
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an [GraphQueryStreamingResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreamingResult/).
 * @see [Sample - Query a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-query/)
 * @see [GraphQueryStreaming](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreaming/)
 * @see [GraphQueryStreamingResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreamingResult/)
 * @see [ArcGIS REST API - Query (Graph)](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-graph-query.htm)
 * @example
 * // sample streaming query using bind parameters
 * // to search for entities with a the `name` property that matches a specific string
 * // or have their geometry within a bounding box.
 * // get all parts bought by each supplier.
 * // query returns both the supplier and the part it buys.
 * const query = `MATCH (s:Supplier)-[:buys_part]-(p:Part)
 *                WHERE s.name=$name OR esri.graph.ST_Intersects($geom, s.geometry)
 *                RETURN s,p`;
 *
 * KnowledgeGraphModule.executeQueryStreaming(
 *   knowledgeGraph,
 *   {
 *     openCypherQuery: query,
 *     bindParameters: {
 *       name: "Supplier 5",
 *       //bounding box around the area of Washington DC, USA
 *       geom: new Polygon({
 *         rings: [
 *           [
 *             [38,-78],
 *             [39, -78],
 *             [39, -76],
 *             [-38, -76],
 *             [-38, -78],
 *           ],
 *        ],
 *     }),
 *   }
 * }).then((streamingQueryResult)=>{
 *   // streaming query returns a readableStream which must be read to access the returned graph data
 *   readStream(streamingQueryResult)
 * });
 * @example
 * // a function to read the readable stream returned from the above query
 * const readStream = async (streamingQueryResult) => {
 *   let time = Date.now();
 *   let reader = streamingQueryResult.resultRowsStream.getReader();
 *   try {
 *     while (true) {
 *       const { done, value } = await reader.read();
 *       if (done) {
 *         console.log(`Completed database requests: ${(Date.now() - time) / 1000} seconds`);
 *         break;
 *       }
 *       console.log(`Chunk returned in: ${(Date.now() - time) / 1000} seconds`);
 *       // use the results
 *       // list the parts bought by each supplier
 *       let supplierParts = {};
 *       // each element of the result array will contain one supplier and one part it buys
 *       for (var v in value){
 *         let supplier = value[v][0].properties.Name
 *         let part = value [v][1].properties.Name
 *         if(!(supplier in supplierParts)){
 *           supplierParts[supplier] = [];
 *         }
 *         // collect parts by supplier that buys them
 *         supplierParts[supplier].push(part);
 *         console.log(supplierParts);
 *         // result printed to the console: {Supplier 1:[Part1], Supplier 3:[Part2, Part3]}
 *     }
 *   } catch (err) {
 *     if (err.name === "AbortError") {
 *       console.log("Request aborted as expected");
 *     } else {
 *       throw err;
 *     }
 *   }
 * };
 * @example
 * // result stream from above query after it has been read
 * "Streaming chunk returned in: 0.082 seconds"
 * [
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Supplier 1",
 *       "City": "Washington DC",
 *       "EmployeeCount": 31
 *     },
 *     "typeName": "Supplier",
 *     "id": "{57FDF2F3-34C8-48EF-9A3B-76ED9314C4D2}"
 *   },{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Part_ID": 695401,
 *       "Name": "Part1",
 *       "Minimum_quantity": 360
 *     },
 *     "typeName": "Part",
 *     "id": "{IWN51W4-1AW8-A2W6-1AW5F-1AW8F9F4W51AS}",
 *   }],
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Supplier 2",
 *       "City": "Baltimore",
 *       "EmployeeCount": 53
 *     },
 *     "typeName": "Supplier",
 *     "id": "{1A4W8F5W-1WA8-5W6A-A1W8-A1W5F8W3S482A}"
 *   },{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Part_ID": 695401,
 *       "Name": "Part2",
 *       "Minimum_quantity": 2500
 *     },
 *     "typeName": "Part",
 *     "id": "{A1W5F8W4F-A1W8-1894-16A5-A86WF4A8SFWD}",
 *   }],
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Supplier 2",
 *       "City": "Baltimore",
 *       "EmployeeCount": 53
 *     },
 *     "typeName": "Supplier",
 *     "id": "{1A4W8F5W-1WA8-5W6A-A1W8-L5H4G8RT1PK3}"
 *   },{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Part_ID": 695401,
 *       "Name": "Part3",
 *       "Minimum_quantity": 5000
 *     },
 *     "typeName": "Part",
 *     "id": "{PTJ51FT-KY4H-1GY5-G1Y8-G1Y5K49G8Y4GHJ}",
 *   }]
 * ]
 * @example
 * // aborting the query
 * // create instance of native browser abort controller
 * const controller = new AbortController();
 *
 * // create query
 * KnowledgeGraphModule.executeQueryStreaming(
 *     knowledgeGraph,
 *     {
 *       openCypherQuery: "MATCH (n) RETURN n LIMIT 100",
 *     },
 *     {
 *       signal: controller.signal,
 *     }
 *   )
 *   .then((streamingQueryResult) => {
 *     readStream(streamingQueryResult);
 *   })
 *   // indicate that the stream was aborted
 *   .catch((err) => {
 *     if (err.name === "AbortError") {
 *       console.log("Request aborted as expected");
 *     }
 *
 * // abort the query after half a second
 * setTimeout(() => {
 *   console.log("Sending abort signal");
 *   controller.abort();
 * }, 500);
 */
export function executeQueryStreaming(graph: KnowledgeGraph, queryArguments: GraphQueryEncoded, requestOptions?: RequestOptions): Promise<GraphQueryStreamingResult>;

/**
 * Search the knowledge graph using a full-text index that is automatically built on the property values in the graph and returns the result. Search accepts [Lucene search syntax](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html).
 * Use the [DataModel](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/) to see the indexed fields for each [RelationshipType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) and [EntityType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/).
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param searchArguments - Defines the free text [search](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphSearch/) to run against a knowledge graph.
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is a
 * [GraphQueryResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryResult/) that contains all records matching the search. If there are no matches the result will be empty.
 * @since 4.25
 * @see [Sample - Search a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-search/)
 * @see [GraphSearch](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphSearch/)
 * @see [GraphQueryResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryResult/)
 * @see [ArcGIS REST API - Search (Graph)](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-graph-search.htm)
 * @example
 * // typical use case
 * KnowledgeGraphModule.executeSearch(
 *  knowledgeGraph, //graph
 *  { // searchArguments
 *    searchQuery: "Sun", //search term
 *    typeCategoryFilter: "both" //search entities, relationships or both.
 *   }).then((searchResult) => {
 *     // do something with the result
 *    console.log(searchResult)
 * });
 * @example
 * // sample search result
 * {
 *   "declaredClass": "esri.rest.knowledgeGraph.GraphQueryResult",
 *   "resultRows": [
 *     [
 *       {
 *         "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *         "properties": {
 *           "shape": {
 *             "declaredClass": "esri.geometry.Point",
 *             "cache": {},
 *             "hasM": false,
 *             "hasZ": false,
 *             "latitude": 53.589000000000006,
 *             "longitude": -0.9633,
 *             "type": "point",
 *             "extent": null,
 *             "spatialReference": {
 *               "wkid": 4326
 *             },
 *             "x": -0.9633,
 *             "y": 53.589000000000006
 *           },
 *           "Name": "Suncommon",
 *           "Employee_Count": 400
 *         },
 *         "typeName": "Company",
 *         "id": "{WIPJ483T-U8UI-LLK9-YUI8-Y5YK8YGD88E9}",
 *       }
 *     ],
 *     [
 *        {
 *         "declaredClass": "esri.rest.Relationship.Relationship",
 *         "originID": "{44027400-4B48-4FF2-B526-E27FC17EC246}",
 *         "destinationID": "{CB0CF580-3899-491E-8F10-0AD1DA4EE49B}",
 *         "properties": {
 *           "orderDay": "Sunday",
 *           "quantity": 15000
 *         },
 *         "typeName": "buys_part",
 *         "id": "{ABCDEFG-0000-1111-2222-0AD1DA4EE49B}"
 *       }
 *     ]
 *   }
 */
export function executeSearch(graph: KnowledgeGraph, searchArguments: GraphSearch, requestOptions?: RequestOptions): Promise<GraphQueryResult>;

/**
 * Execute a streaming search on a [knowledge graph service's](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/)
 * [graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) resource.
 * Streaming search returns a readable stream that must be read to access the returned data.
 * Unlike [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch), executeSearchStreaming()
 * returns results in small chunks that can be processed immediately, without having to wait for all results to be returned.
 * Streaming search is faster and more efficient than executeSearch(). Streaming search also retrieves all matching
 * records even if the total exceeds the `searchMaxRecordCount` defined in the service without additional queries or pagination.
 * Another benefit of streaming search is that the request is encoded which means that it is far smaller than a traditional
 * HTTP GET or JSON POST body. This is especially important when trying to do a search on a very large argument,
 * such as a large set of Ids.
 *
 * Streaming search accepts [Lucene search syntax](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html).
 * Streaming search uses a full-text index that is automatically built on the property values in the graph.
 * Use the [DataModel](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/) to see the indexed fields for each [RelationshipType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/)
 * and [EntityType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/).
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param searchArguments - Define the free text [search](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphSearchStreaming/) to execute against the knowledge graph.
 * Optionally specify additional search parameters.
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is a
 * [GraphQueryStreamingResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreamingResult/) that contains all records matching the search. If there are no matches the result will be empty.
 * @see [Sample - Search a knowledge graph](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-search/)
 * @see [GraphSearchStreaming](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphSearchStreaming/)
 * @see [GraphQueryStreamingResult](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphQueryStreamingResult/)
 * @example
 * // example search for "solar"with additional parameters
 * KnowledgeGraphModule.executeSearchStreaming(
 *   knowledgeGraph,
 *   {
 *     searchQuery: "solar",
 *     typeCategoryFilter: "both",
 *     returnSearchContext: false,
 *     start: 1,
 *     num: 200, //return 200 records.
 *     namedTypesFilter: ["Company", "Supplier", "Part"],
 *     idsFilter: ["{G4E8G2S8D-2GS5-98S4-3S5D-S1DE7G45DS48}",
 *                      "{FNWI1G5W-1A5W-3A5W-8412-A1W5F4W8F7AS}",
 *                      "{9D2D6AFD-41F1-49A4-8412-CACCC9906E88}"]
 *   }
 * ).then((streamingSearchResult)=>{
 *   // the result of a streaming search is a readableStream which requires decoding.
 *   readStream(streamingSearchResult)
 * })
 * @example
 * // a function to read the readable stream returned from the above query
 * const readStream = async (streamingQueryResult) => {
 *   let time = Date.now();
 *   let reader = streamingQueryResult.resultRowsStream.getReader();
 *   try {
 *     while (true) {
 *       const { done, value } = await reader.read();
 *       if (done) {
 *         console.log(`Completed database requests: ${(Date.now() - time) / 1000} seconds`, value);
 *         break;
 *       }
 *       console.log(`Chunk returned in: ${(Date.now() - time) / 1000} seconds`, value)
 *     }
 *   } catch (err) {
 *     if (err.name === "AbortError") {
 *       console.log("Request aborted as expected");
 *     } else {
 *       throw err;
 *     }
 *   }
 * };
 * @example
 * // sample result of streaming search result chunk read and printed to the console
 *
 * "Streaming chunk returned in: 0.082 seconds"
 * [
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Suncommon",
 *       "Employee_Count": 400,
 *       "energyType": "solar"
 *     },
 *     "typeName": "Company",
 *     "id": "{G4E8G2S8D-2GS5-98S4-3S5D-S1DE7G45DS48}"
 *   }],
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Quality Solar Supply",
 *       "Supplier_code": "158B",
 *       "City": "New Orleans",
 *     },
 *     "typeName": "Supplier",
 *     "id": "{FNWI1G5W-1A5W-3A5W-8412-A1W5F4W8F7AS}"
 *   }],
 *   [{
 *     "declaredClass": "esri.rest.knowledgeGraph.Entity",
 *     "properties": {
 *       "Name": "Solar panel",
 *       "panel_type": "Polycrystalline",
 *       "price_per_unit": 400
 *     },
 *     "typeName": "Part",
 *     "id": "{9D2D6AFD-41F1-49A4-8412-CACCC9906E88}"
 *   }]
 * ]
 */
export function executeSearchStreaming(graph: KnowledgeGraph, searchArguments: GraphSearchEncoded, requestOptions?: RequestOptions): Promise<GraphQueryStreamingResult>;

/**
 * Returns all client data keys existing on the knowledge graph service associated with the given knowledge graph.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request.
 * @returns When resolved, the result is an array of the client data keys existing on the service at the time of the request.
 * @example
 * // typical use case
 * const url = "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer";
 *
 * const knowledgeGraph = await knowledgeGraphService.fetchKnowledgeGraph(url)
 *
 * KnowledgeGraphModule.fetchAllClientDataKeys(knowledgeGraph)
 * .then((clientDataKeys) => {
 *     // do something with result
 * });
 */
export function fetchAllClientDataKeys(graph: KnowledgeGraph, requestOptions?: RequestOptions): Promise<string[]>;

/**
 * Retrieves the specified client data keys from the knowledge graph service associated with the given knowledge graph, if they exist.
 * If a given client data key does not exist on the service, it is not returned in the result map.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @param keysToFetch - An array of client data keys to fetch from the service
 * @param options - Additional options when requesting client keys.
 * @returns When resolved, the result is an array of the client data keys existing on the service at the time of the request.
 * @example
 * // typical use case
 * const url = "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer";
 *
 * const knowledgeGraph = await knowledgeGraphService.fetchKnowledgeGraph(url)
 *
 * KnowledgeGraphModule.fetchClientDataAtKeys(knowledgeGraph, ["Person/LinkChart/LinkChartSubLayer"])
 * .then((clientDataResultMap) => {
 *     // do something with result
 * });
 */
export function fetchClientDataAtKeys(graph: KnowledgeGraph, keysToFetch: string[], options?: FetchClientDataAtKeysOptions): Promise<Map<string, string>>;

export interface FetchClientDataAtKeysOptions {
  /** By default, client data requests are cached by their version. When a previously requested key is requested again and the client data version for that key on the service is unchanged, the existing cached value is returned. When ignoreCache is `true`, the request ignores the cache and fetches and returns the value from the service. */
  ignoreCache?: boolean;
  /** Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) to be used for the data request. */
  requestOptions?: RequestOptions;
}

/**
 * Retrieves the knowledge graph service based on the URL provided.
 *
 * @param url - URL to the [ArcGIS Knowledge Server REST](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm) resource that represents a knowledge graph service.
 * @returns When resolved, the result is a [KnowledgeGraph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/).
 * @example
 * // typical use case
 * const url = "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer";
 *
 * KnowledgeGraphModule.fetchKnowledgeGraph(url)
 * .then((kg) => {
 *     // do something with result
 * });
 */
export function fetchKnowledgeGraph(url: string): Promise<KnowledgeGraph>;

/**
 * Refreshes the [data model](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/) of the [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/).
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service. See also [ArcGIS REST APIs - Hosted Knowledge Graph Service](https://developers.arcgis.com/rest/services-reference/enterprise/kgs-hosted-server.htm).
 * @example
 * // typical use case
 * KnowledgeGraphModule.refreshDataModel(urlToKnowledgeGraph).then((newKG) => {
 *     // do something with result
 * });
 */
export function refreshDataModel(graph: KnowledgeGraph): Promise<void>;

/**
 * Executes an asynchronous request to the ServerFilteredFindPaths GP tool. Allows you to identify paths
 * that connect the specified entities or entity types and satisfy all [specified conditions](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration/).
 * A path is made of a sequence of relationships and the corresponding entities.
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > Find Paths can only be used with a Publisher or Administrator role.
 * > See [Enterprise User types, roles, and privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm).
 *
 * @param toolSettings - The pathfinding configuration such as origin and destination, waypoints and other tool settings. See [FindPathToolSettings](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings/) for the full list of available settings.
 * @param requestOptions - The options specified by the user in the data request. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) for available properties.
 * @returns When resolved, returns a [JobInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/support/JobInfo/).
 * @beta
 */
export function executeFindPathsAsynchronous(toolSettings: FindPathsToolSettings, requestOptions?: RequestOptions): Promise<JobInfo>;

/**
 * Executes a request to the ServerFilteredFindPaths GP tool. Allows you to identify paths
 * that connect the specified entities or entity types and satisfy all [specified conditions](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration/).
 * A path is made of a sequence of relationships and the corresponding entities.
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > Find Paths can only be used with a Publisher or Administrator role.
 * > See [Enterprise User types, roles, and privileges](https://enterprise.arcgis.com/en/portal/latest/administer/windows/roles.htm).
 *
 * @param toolSettings - The pathfinding configuration such as origin and destination, waypoints and other tool settings. See [FindPathToolSettings](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings/) for the full list of available settings.
 * @param requestOptions - Additional options specified in the data request. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) for available properties.
 * @returns Returns paths found based on the configuration and pathfinding statistics.
 * @beta
 * @example
 * knowledgeGraphService.executeFindPaths({
 *     inKnowledgeGraphUrl: "https://sampleserver7.arcgisonline.com/server/rest/services/Hosted/BumbleBees/KnowledgeGraphServer",
 *     config: {
 *    type: "CIMFilteredFindPathsConfiguration",
 *    name: "exampleFFPconfiguration",
 *    originEntities: [
 *        {
 *       type: "CIMFilteredFindPathsEntity",
 *       iD: devPathStart,
 *       entityTypeName: "User"
 *        }
 *    ],
 *    destinationEntities: [
 *        {
 *       type: "CIMFilteredFindPathsEntity",
 *       iD: devPathEnd,
 *       entityTypeName: "Species"
 *        }
 *    ],
 *    pathFilters: [
 *        {
 *       type: "CIMFilteredFindPathsPathFilter",
 *       iD: null,
 *       itemTypeName: "Observation",
 *       itemType: "Entity",
 *       filterType: "Include"
 *        }
 *    ],
 *    defaultTraversalDirectionType: "Any",
 *    entityUsage: "EachPair",
 *    pathMode: "All",
 *    minPathLength: 1,
 *    maxPathLength: 8,
 *    maxCountPaths: 100000
 *    }
 *   });
 */
export function executeFindPaths(toolSettings: FindPathsToolSettings, requestOptions?: RequestOptions): Promise<CIMFilteredFindPathsResultJSON>;

/**
 * Retrieves the filtered find path results from a job started by [executeFindPathsAsynchronous()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeFindPathsAsynchronous).
 *
 * @param jobInfo - The job info returned from [executeFindPathsAsynchronous()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeFindPathsAsynchronous).
 * @param requestOptions - Additional options specified in the data request.
 * @returns Returns all of the records in the paths found based on the configuration and statistics on how the paths were generated.
 */
export function fetchAsynchronousFindPathsResultData(jobInfo: JobInfo, requestOptions?: RequestOptions): Promise<CIMFilteredFindPathsResultJSON>;

/** Options for adding or updating a domain on a knowledge graph service. */
export interface DomainOptions {
  /** The split policy for the domain. */
  splitPolicy: EsriSplitPolicyTypes;
  /** The merge policy for the domain. */
  mergePolicy: EsriMergePolicyTypes;
}

/**
 * Add a domain to the knowledge graph service data model. This adds the domain to the service.
 * To assign the domain to a property on a named type use
 * [executeUpdateGraphProperty()](#executeUpdateGraphProperty).
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) associated with the service.
 * @param domain - The [domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) to add to the graph.
 * @param fieldType - The data type of the domain and the fields to which it can be assigned.
 * @param domainOptions - Specify the merge and split policy of the domain in the case of polygon or multi feature geometries.
 * @param requestOptions - Additional options specified in the data request.
 * @since 5.0
 * @example
 * const kg = await knowledgeGraphService.fetchKnowledgeGraph({
 *     url: "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer"
 * })
 * const domain = new RangeDomain({
 *      name: dayOfMonth,
 *      type: "range",
 *      minValue: 1,
 *      maxValue: 31,
 * });
 * knowledgeGraphService
 *    .executeAddDomain(kg, domain, esriFieldTypeInteger)
 *    .then((response) => {
 *      console.log("Domain Add transaction completed.  Response: ", response);
 *    })
 *    .catch((error) => {
 *      console.error("Error adding domain: ", error);
 * });
 */
export function executeAddDomain(graph: KnowledgeGraph, domain: RangeDomain | CodedValueDomain, fieldType: EsriFieldType, domainOptions?: DomainOptions, requestOptions?: RequestOptions): Promise<GraphDataModelSingletonOperationResult>;

/**
 * Update a domain on a knowledge graph service.
 * For coded value domains, you must supply all valid values for the domain.
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/).
 * @param updatedDomain - The [domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) to update.
 * @param fieldType - The data type of the domain and the fields to which it can be assigned.
 * @param domainOptions - Specify the merge and split policy of the domain in the case of polygon or multi feature geometries.
 * @param requestOptions - Additional options specified in the data request.
 * @since 5.0
 */
export function executeUpdateDomain(graph: KnowledgeGraph, updatedDomain: RangeDomain | CodedValueDomain, fieldType: EsriFieldType, domainOptions?: DomainOptions, requestOptions?: RequestOptions): Promise<GraphDataModelSingletonOperationResult>;

/**
 * Delete a domain from a knowledge graph service. To delete a domain it must not be associated with any named type property in the graph.
 * To remove a domain from a named type property use [executeUpdateGraphProperty()](#executeUpdateGraphProperty).
 *
 * @param graph - The [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/).
 * @param domainName - The name of the [domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) to delete
 * @param requestOptions - Additional options specified in the data request.
 * @since 5.0
 * @example
 * const kg = await knowledgeGraphService.fetchKnowledgeGraph({
 *     url: "https://myHostName.domain.com/server/rest/services/Hosted/myServiceName/KnowledgeGraphServer"
 * })
 *
 * knowledgeGraphService
 *    .executeDeleteDomain(kg, "dayOfMonth")
 *    .then((response) => {
 *      console.log("Domain Delete transaction completed.  Response: ", response);
 *    })
 *    .catch((error) => {
 *      console.error("Error adding domain: ", error);
 * });
 */
export function executeDeleteDomain(graph: KnowledgeGraph, domainName: string, requestOptions?: RequestOptions): Promise<GraphDataModelSingletonOperationResult>;