import{__decorate}from"tslib";import RelationshipQuery from"@arcgis/core/tasks/support/RelationshipQuery";import{validation}from"../../Validation.js";import{isArcGisApiVersion3x}from"./ArcGisApiVersion.js";import{inline,isAbortable,schedulePromiseCancellation}from"./tools.js";import{MapProvider}from"./MapProvider.js";import{activate}from"../../Hooks.js";import QueryTask from"@arcgis/core/tasks/QueryTask";let RelationshipQueryTask=class{execute(i,e,o){const r=new RelationshipQuery;r.definitionExpression=validation.string("definitionExpression",i.definitionExpression,void 0),r.geometryPrecision=validation.number("definitionExpression",i.geometryPrecision,void 0),r.maxAllowableOffset=validation.number("maxAllowableOffset",i.maxAllowableOffset,void 0),r.objectIds=validation.array("objectIds",i.objectIds,validation.never),r.outFields=validation.array("outFields",i.outFields,["*"]),r.outSpatialReference=o.getOutSR(validation.exists("outSpatialReference",i.outSpatialReference,void 0)),r.relationshipId=validation.number("relationshipId",i.relationshipId,validation.never),r.returnGeometry=validation.boolean("returnGeometry",i.returnGeometry,!0);o=validation.urlOrLayer(i,isArcGisApiVersion3x),i=validation.string("gdbVersion",i.gdbVersion,void 0);const a=new QueryTask(o,{gdbVersion:i});i=isAbortable(e.cancellationToken)?{signal:e.cancellationToken.signal}:void 0,i=a.executeRelationshipQuery(r,i);return schedulePromiseCancellation(e,i),inline(i,function(i){return{results:i}})}};RelationshipQueryTask.action="gcx:wf:arcgis:query:RelationshipQueryTask",RelationshipQueryTask.suite="gcx:wf:builtin",RelationshipQueryTask=__decorate([activate(MapProvider)],RelationshipQueryTask);export{RelationshipQueryTask};