@flumens/models 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(require("axios"));exports.fetchElasticOccurrences=function(t){return e.__awaiter(this,arguments,void 0,(function(t){var n,a,i,o,s,c,u,d,_,l,v=t.parentId,p=t.url,f=t.accessToken;return e.__generator(this,(function(t){switch(t.label){case 0:return n={terms:{"event.parent_event_id":Array.isArray(v)?v:[v]}},a={terms:{"event.event_id":Array.isArray(v)?v:[v]}},i=JSON.stringify({size:5e3,query:{bool:{must:[{bool:{should:[n,a]}}]}},_source:["id","event.event_id","event.parent_event_id","metadata.created_on","metadata.updated_on","identification","occurrence.occurrence_remarks","occurrence.attributes","occurrence.media","taxon.species","taxon.taxon_name","taxon.taxa_taxon_list_id"]}),o={Authorization:"Bearer ".concat(f)},s={method:"post",url:"".concat(p,"/index.php/services/rest/es-occurrences/_search"),headers:e.__assign({"Content-Type":"application/json"},o),data:i},[4,r.default.request(s)];case 1:return c=t.sent(),u=function(e){return e._source},[2,(null===(l=null===(_=null===(d=c.data)||void 0===d?void 0:d.hits)||void 0===_?void 0:_.hits)||void 0===l?void 0:l.map(u))||[]]}}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(require("axios"));exports.fetchElasticSample=function(t){return e.__awaiter(this,arguments,void 0,(function(t){var r,n,i,o,s,u,c,d,l,v,_=t.id,p=t.cid,m=t.url,h=t.accessToken;return e.__generator(this,(function(t){switch(t.label){case 0:return r=JSON.stringify({size:1e3,query:{bool:{must:[{match:{id:_}}]}}}),_||(r=JSON.stringify({size:1e3,query:{bool:{must:[{match:{"event.source_system_key":p}}]}}})),n={Authorization:"Bearer ".concat(h)},i={method:"post",url:"".concat(m,"/index.php/services/rest/es-samples/_search"),headers:e.__assign({"Content-Type":"application/json"},n),data:r},[4,a.default.request(i)];case 1:if(o=t.sent(),s=function(e){return e._source},u=(null===(v=null===(l=null===(d=o.data)||void 0===d?void 0:d.hits)||void 0===l?void 0:l.hits)||void 0===v?void 0:v.map(s))||[],!(c=u[0]))throw new Error("Remote sample with id ".concat(_||p," was not found"));return[2,c]}}))}))},exports.fetchElasticSubSamples=function(t){return e.__awaiter(this,arguments,void 0,(function(t){var r,n,i,o,s,u,c,d,l=t.parentId,v=t.url,_=t.accessToken;return e.__generator(this,(function(t){switch(t.label){case 0:return r=JSON.stringify({size:2e3,query:{bool:{must:[{terms:{"event.parent_event_id":Array.isArray(l)?l:[l]}}]}},_source:["id","event.event_id","event.parent_event_id","event.source_system_key","event.attributes","event.media","event.event_remarks","event.date_start","metadata.created_on","metadata.updated_on","metadata.survey.id","metadata.group.id","metadata.trial","location.geom","location.output_sref_system","location.output_sref","location.point","location.code","location.name","location.verbatim_locality"]}),n={Authorization:"Bearer ".concat(_)},i={method:"post",url:"".concat(v,"/index.php/services/rest/es-samples/_search"),headers:e.__assign({"Content-Type":"application/json"},n),data:r},[4,a.default.request(i)];case 1:return o=t.sent(),s=function(e){return e._source},[2,(null===(d=null===(c=null===(u=o.data)||void 0===u?void 0:u.hits)||void 0===c?void 0:c.hits)||void 0===d?void 0:d.map(s))||[]]}}))}))};
|