/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.discoverLogExplorer_bundle_jsonpfunction=window.discoverLogExplorer_bundle_jsonpfunction||[]).push([[8],{101:function(t,e,r){"use strict";r.r(e),r.d(e,"DatasetsClient",(function(){return datasets_client_DatasetsClient})),r.d(e,"DatasetsService",(function(){return datasets_service_DatasetsService}));var s=r(27),a=r(23),n=r(11);const o=a.EPM_API_ROUTES.DATA_STREAMS_PATTERN,i=a.EPM_API_ROUTES.INSTALLED_LIST_PATTERN,c=n.keyof({asc:null,desc:null});var d=r(43);const l=n.type({items:n.array(d.a)}),p=n.exact(n.partial({datasetQuery:n.string,type:n.literal("logs"),sortOrder:c,uncategorisedOnly:n.boolean}));var u=r(62);const g=n.array(n.union([n.number,n.string])),y=n.exact(n.intersection([n.type({items:n.array(d.b),total:n.number}),n.partial({searchAfter:g})])),_=n.exact(n.partial({nameQuery:n.string,perPage:n.number,dataStreamType:n.literal("logs"),searchAfter:u.b.pipe(g),sortOrder:c}));class FindIntegrationsError extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),this.name="FindIntegrationsError"}}class FindDatasetsError extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),this.name="FindDatasetsError"}}var h=r(49);const E={dataStreamType:"logs"},m={type:"logs",uncategorisedOnly:!0};class datasets_client_DatasetsClient{constructor(t){this.http=t}async findIntegrations(t={}){const e={...E,...t},r=_.encode(e),a=await this.http.get(i,{query:r}).catch((t=>{throw new FindIntegrationsError(`Failed to fetch integrations": ${t}`)})),n=Object(h.a)(y,(t=>new FindIntegrationsError(`Failed to decode integrations response: ${t}"`)))(a);return{...n,items:n.items.map(s.b.create)}}async findDatasets(t={}){const e={...m,...t},r=p.encode(e),a=await this.http.get(o,{query:r}).catch((t=>{throw new FindDatasetsError(`Failed to fetch data streams": ${t}`)}));return{items:Object(h.a)(l,(t=>new FindDatasetsError(`Failed to decode data streams response: ${t}"`)))(a).items.map((t=>s.a.create(t)))}}}class datasets_service_DatasetsService{constructor(){}setup(){}start({http:t}){return{client:new datasets_client_DatasetsClient(t)}}}}}]);