From 06a525adc6b108337c70fba34916a68f20613deb Mon Sep 17 00:00:00 2001 From: Patrick Leary Date: Thu, 30 May 2024 16:08:43 -0400 Subject: [PATCH 1/3] inatnls wrapper endpoint; iconic taxa endpoint --- build/inaturalistjs.js | 2108 +++++++------------------------ lib/endpoints/computervision.js | 13 + lib/endpoints/taxa.js | 5 + 3 files changed, 469 insertions(+), 1657 deletions(-) diff --git a/build/inaturalistjs.js b/build/inaturalistjs.js index 0fc99dd..f9970fd 100644 --- a/build/inaturalistjs.js +++ b/build/inaturalistjs.js @@ -4,8 +4,8 @@ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /* eslint global-require: 0 */ -var iNaturalistAPI = __webpack_require__(1); +var iNaturalistAPI = __webpack_require__(1); module.exports = { setConfig: iNaturalistAPI.setConfig, annotations: __webpack_require__(11), @@ -13,9 +13,9 @@ module.exports = { authorized_applications: __webpack_require__(15), comments: __webpack_require__(17), computervision: __webpack_require__(19), - controlled_terms: __webpack_require__(24), - flags: __webpack_require__(26), - identifications: __webpack_require__(28), + controlled_terms: __webpack_require__(27), + flags: __webpack_require__(29), + identifications: __webpack_require__(31), messages: __webpack_require__(32), observation_field_values: __webpack_require__(34), observation_photos: __webpack_require__(36), @@ -38,21 +38,21 @@ module.exports = { users: __webpack_require__(62), Annotation: __webpack_require__(12), Comment: __webpack_require__(18), - ControlledTerm: __webpack_require__(25), - Flag: __webpack_require__(27), - Identification: __webpack_require__(29), - Observation: __webpack_require__(30), + ControlledTerm: __webpack_require__(28), + Flag: __webpack_require__(30), + Identification: __webpack_require__(26), + Observation: __webpack_require__(20), ObservationFieldValue: __webpack_require__(35), - Photo: __webpack_require__(21), + Photo: __webpack_require__(22), Place: __webpack_require__(42), Post: __webpack_require__(44), Project: __webpack_require__(39), ProjectUser: __webpack_require__(49), ProviderAuthorization: __webpack_require__(51), Site: __webpack_require__(56), - Sound: __webpack_require__(31), - Taxon: __webpack_require__(20), - User: __webpack_require__(22), + Sound: __webpack_require__(25), + Taxon: __webpack_require__(21), + User: __webpack_require__(23), FileUpload: __webpack_require__(63) }; @@ -61,26 +61,19 @@ module.exports = { /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - // cross-fetch wraps https://github.com/github/fetch, which doesn't seem to work // quite right in React Native (see https://github.com/github/fetch/issues/601 // and https://github.com/lquixada/cross-fetch/issues/2). Conditional requires // like this seem to work, though they do result in unnecessarily large files // for React native -var localFetch; +var localFetch; if (typeof fetch !== "undefined") { localFetch = fetch; } else { @@ -88,7 +81,6 @@ if (typeof fetch !== "undefined") { } var LocalFormData; - if (typeof FormData !== "undefined") { LocalFormData = FormData; } else { @@ -96,56 +88,41 @@ if (typeof FormData !== "undefined") { } var querystring = __webpack_require__(4); - var rison = __webpack_require__(7); - var util = __webpack_require__(8); - var INaturalistAPIResponse = __webpack_require__(9); - var iNaturalistAPI = /*#__PURE__*/function () { function iNaturalistAPI() { _classCallCheck(this, iNaturalistAPI); } - _createClass(iNaturalistAPI, null, [{ key: "fetch", value: function fetch(route, ids, p) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var fetchIDs = ids; var params = p ? _objectSpread({}, p) : {}; - if (!Array.isArray(fetchIDs)) { fetchIDs = [fetchIDs]; } - var apiToken = iNaturalistAPI.apiToken(options); - var headers = _objectSpread({}, iNaturalistAPI.defaultHeaders); - if (apiToken) headers.Authorization = apiToken; headers["Content-Type"] = "application/json"; - if (options.user_agent) { headers["user-agent"] = options.user_agent; } - if (iNaturalistAPI.defaultUserAgent && !headers["user-agent"]) { headers["user-agent"] = iNaturalistAPI.defaultUserAgent; } - var fieldsObject; - if (params && params.fields && _typeof(params.fields) === "object") { fieldsObject = params.fields; params.fields = rison.encode(params.fields); } - var query = _typeof(params) === "object" && Object.keys(params).length > 0 ? "?".concat(querystring.stringify(params)) : ""; var baseURL = "".concat(iNaturalistAPI.apiURL, "/").concat(route, "/").concat(fetchIDs.join(",")); var urlWithQueryParams = "".concat(baseURL).concat(query); var fetch; - if (urlWithQueryParams.length > 2000 && fieldsObject) { headers.Accept = "application/json"; headers["X-HTTP-Method-Override"] = "GET"; @@ -163,26 +140,22 @@ var iNaturalistAPI = /*#__PURE__*/function () { signal: options.signal }); } - return fetch.then(iNaturalistAPI.thenText).then(iNaturalistAPI.thenJson).then(iNaturalistAPI.thenWrap); - } // Note, this generally assumes that all GET requests go to the Node API. If + } + + // Note, this generally assumes that all GET requests go to the Node API. If // you want to GET something from the Rails API, call this with // useWriteApi: true - }, { key: "get", value: function get(route, params, opts) { var options = _objectSpread({}, opts || {}); - var interpolated = iNaturalistAPI.interpolateRouteParams(route, params); - if (interpolated.err) { return interpolated.err; } - var thisRoute = interpolated.route; var apiToken = options.useAuth ? iNaturalistAPI.apiToken(options) : null; - var headers = _objectSpread(_objectSpread(_objectSpread({}, iNaturalistAPI.defaultHeaders), options.headers), {}, { Accept: "application/json", // DO NOT OMIT! Without this, fetch in React Native on Android will not @@ -190,33 +163,26 @@ var iNaturalistAPI = /*#__PURE__*/function () { "Content-Type": "application/json", "X-Via": "inaturalistjs" }); - if (apiToken) { headers.Authorization = apiToken; } - if (options.user_agent) { headers["user-agent"] = options.user_agent; } - if (iNaturalistAPI.defaultUserAgent && !headers["user-agent"]) { headers["user-agent"] = iNaturalistAPI.defaultUserAgent; } - var host = options.useWriteApi ? iNaturalistAPI.writeApiURL : iNaturalistAPI.apiURL; var baseURL = "".concat(host, "/").concat(thisRoute); var remainingParams = interpolated.remainingParams; var fieldsObject; - if (remainingParams && remainingParams.fields && _typeof(remainingParams.fields) === "object") { fieldsObject = remainingParams.fields; remainingParams.fields = rison.encode(remainingParams.fields); } - var query = remainingParams && Object.keys(remainingParams).length > 0 ? "?".concat(querystring.stringify(remainingParams)) : ""; var urlWithQueryParams = "".concat(baseURL).concat(query); var fetch; - if (urlWithQueryParams.length > 2000 && fieldsObject) { headers.Accept = "application/json"; headers["X-HTTP-Method-Override"] = "GET"; @@ -235,71 +201,57 @@ var iNaturalistAPI = /*#__PURE__*/function () { signal: options.signal }); } - return fetch.then(iNaturalistAPI.thenText).then(iNaturalistAPI.thenJson).then(iNaturalistAPI.thenWrap); } }, { key: "post", value: function post(route, p, opts) { var options = _objectSpread({}, opts || {}); - - var params = _objectSpread({}, p || {}); // interpolate path params, e.g. /:id => /1 - - + var params = _objectSpread({}, p || {}); + // interpolate path params, e.g. /:id => /1 var interpolated = iNaturalistAPI.interpolateRouteParams(route, params); - if (interpolated.err) { return interpolated.err; } - - var thisRoute = interpolated.route; // set up request headers - + var thisRoute = interpolated.route; + // set up request headers var headers = _objectSpread(_objectSpread(_objectSpread({}, iNaturalistAPI.defaultHeaders), options.headers), {}, { Accept: "application/json", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, DELETE, HEAD", "X-Via": "inaturalistjs" }); - if (options.user_agent) { headers["user-agent"] = options.user_agent; } - if (iNaturalistAPI.defaultUserAgent && !headers["user-agent"]) { headers["user-agent"] = iNaturalistAPI.defaultUserAgent; } - if (options.remote_ip) { headers["x-forwarded-for"] = options.remote_ip; - } // set up authentication - - + } + // set up authentication var csrf = iNaturalistAPI.csrf(); var apiToken = iNaturalistAPI.apiToken(options); - if (apiToken) { headers.Authorization = apiToken; } else if (csrf) { params[csrf.param] = csrf.token; - } // get the right host to send requests - - - var host = iNaturalistAPI.methodHostPrefix(options); // make the request - + } + // get the right host to send requests + var host = iNaturalistAPI.methodHostPrefix(options); + // make the request var body; - if (options.upload) { - body = new LocalFormData(); // Before params get "flattened" extract the fields and encode them as a + body = new LocalFormData(); + // Before params get "flattened" extract the fields and encode them as a // single JSON string, which the server can handle - var fields = interpolated.remainingParams.fields; - if (fields) { delete interpolated.remainingParams.fields; body.append("fields", JSON.stringify(fields)); - } // multipart requests reference all nested parameter names as strings + } + // multipart requests reference all nested parameter names as strings // so flatten arrays into "arr[0]" and objects into "obj[prop]" - - params = iNaturalistAPI.flattenMultipartParams(interpolated.remainingParams); Object.keys(params).forEach(function (k) { // FormData params can include options like file upload sizes @@ -313,62 +265,55 @@ var iNaturalistAPI = /*#__PURE__*/function () { headers["Content-Type"] = "application/json"; body = JSON.stringify(interpolated.remainingParams); } - var fetchOpts = { method: options.method || "post", credentials: options.same_origin ? "same-origin" : undefined, headers: headers, signal: options.signal }; - if (options.method !== "head") { fetchOpts.body = body; } - - var query = ""; // Rails, at least, can read params from DELETE request URLs, but + var query = ""; + // Rails, at least, can read params from DELETE request URLs, but // cannot read post data. So append any params to the URL - if (options.method === "delete" && Object.keys(interpolated.remainingParams).length > 0) { query = "?".concat(querystring.stringify(interpolated.remainingParams)); } - var url = "".concat(host, "/").concat(thisRoute).concat(query); return localFetch(url, fetchOpts).then(iNaturalistAPI.thenText).then(iNaturalistAPI.thenJson); - } // a variant of post using the http PUT method + } + // a variant of post using the http PUT method }, { key: "head", value: function head(route, params) { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var options = _objectSpread(_objectSpread({}, opts), {}, { method: "head" }); - return iNaturalistAPI.post(route, params, options); - } // a variant of post using the http PUT method + } + // a variant of post using the http PUT method }, { key: "put", value: function put(route, params) { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var options = _objectSpread(_objectSpread({}, opts), {}, { method: "put" }); - return iNaturalistAPI.post(route, params, options); - } // a variant of post using the http DELETE method + } + // a variant of post using the http DELETE method }, { key: "delete", value: function _delete(route, params) { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var options = _objectSpread(_objectSpread({}, opts), {}, { method: "delete" }); - return iNaturalistAPI.post(route, params, options); } }, { @@ -377,12 +322,10 @@ var iNaturalistAPI = /*#__PURE__*/function () { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // uploads can be POST or PUT var method = opts.method || "post"; - var options = _objectSpread(_objectSpread({}, opts || {}), {}, { method: method, upload: true }); - return iNaturalistAPI.post(route, params, options); } }, { @@ -391,11 +334,9 @@ var iNaturalistAPI = /*#__PURE__*/function () { if (opts.same_origin) { return ""; } - if (opts.apiURL) { return opts.apiURL; } - return "".concat(iNaturalistAPI.writeApiURL); } }, { @@ -413,11 +354,9 @@ var iNaturalistAPI = /*#__PURE__*/function () { value: function apiToken() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var token = util.browserMetaTagContent("inaturalist-api-token"); - if (token) { return token; } - return opts.api_token; } }, { @@ -428,9 +367,8 @@ var iNaturalistAPI = /*#__PURE__*/function () { var error = new Error(response.statusText); error.response = response; throw error; - } // not using response.json( ) as there may be no JSON - - + } + // not using response.json( ) as there may be no JSON return response.text().then(function (text) { return response.status >= 200 && response.status < 300 ? text : null; }); @@ -441,7 +379,6 @@ var iNaturalistAPI = /*#__PURE__*/function () { if (text) { return JSON.parse(text); } - return text; } }, { @@ -450,23 +387,21 @@ var iNaturalistAPI = /*#__PURE__*/function () { if (Array.isArray(response)) { return response; } - return new INaturalistAPIResponse(response); - } // flatten nested objects like arrays into "arr[0]" and objects into "obj[prop]" + } + // flatten nested objects like arrays into "arr[0]" and objects into "obj[prop]" }, { key: "flattenMultipartParams", value: function flattenMultipartParams(params, keyPrefix) { if (params === null) { return params; } - if (_typeof(params) === "object") { if (!params.constructor || params.constructor.name === "Object") { if (params.type === "custom") { return _defineProperty({}, keyPrefix, params); } - var flattenedParams = {}; Object.keys(params).forEach(function (k) { var newPrefix = keyPrefix ? "".concat(keyPrefix, "[").concat(k, "]") : k; @@ -474,7 +409,6 @@ var iNaturalistAPI = /*#__PURE__*/function () { }); return flattenedParams; } - if (params.constructor.name === "Array") { var _flattenedParams = {}; params.forEach(function (value, index) { @@ -484,7 +418,6 @@ var iNaturalistAPI = /*#__PURE__*/function () { return _flattenedParams; } } - return _defineProperty({}, keyPrefix, params); } }, { @@ -509,15 +442,12 @@ var iNaturalistAPI = /*#__PURE__*/function () { envWriteHostSSL: config.writeApiHostSSL || (util.browserMetaTagContent("config:inaturalist_write_host_ssl") || util.nodeENV("WRITE_HOST_SSL")) === "true" }; var updatedVariables = {}; - if (oldVariables.envHostConfig) { updatedVariables.apiURL = (oldVariables.envApiHostSSL ? "https://" : "http://") + oldVariables.envHostConfig; } - if (oldVariables.envWriteHostConfig) { updatedVariables.writeApiURL = (oldVariables.envWriteHostSSL ? "https://" : "http://") + oldVariables.envWriteHostConfig; } - return updatedVariables; } }, { @@ -525,20 +455,15 @@ var iNaturalistAPI = /*#__PURE__*/function () { value: function interpolateRouteParams(route, params) { var err; var interpolatedRoute = route; - var remainingParams = _objectSpread({}, params); - var interpolatedParams = {}; var matches = route.match(/(:[a-z]+)(?=\/|$)/g); - if (matches) { matches.forEach(function (sym) { if (err) { return; } - var v = sym.substring(1); - if (remainingParams[v]) { interpolatedRoute = interpolatedRoute.replace(sym, encodeURI(remainingParams[v])); interpolatedParams[sym] = encodeURI(remainingParams[v]); @@ -555,7 +480,6 @@ var iNaturalistAPI = /*#__PURE__*/function () { } }); } - return { route: interpolatedRoute, interpolatedParams: interpolatedParams, @@ -571,10 +495,8 @@ var iNaturalistAPI = /*#__PURE__*/function () { }); } }]); - return iNaturalistAPI; }(); - iNaturalistAPI.setConfig(); module.exports = iNaturalistAPI; @@ -583,17 +505,14 @@ module.exports = iNaturalistAPI; /***/ (function(module, exports) { var global = typeof self !== 'undefined' ? self : this; - var __self__ = function () { function F() { this.fetch = false; this.DOMException = global.DOMException; } - F.prototype = global; return new F(); }(); - (function (self) { var irrelevant = function (exports) { var support = { @@ -610,40 +529,32 @@ var __self__ = function () { formData: 'FormData' in self, arrayBuffer: 'ArrayBuffer' in self }; - function isDataView(obj) { return obj && DataView.prototype.isPrototypeOf(obj); } - if (support.arrayBuffer) { var viewClasses = ['[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]']; - var isArrayBufferView = ArrayBuffer.isView || function (obj) { return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; }; } - function normalizeName(name) { if (typeof name !== 'string') { name = String(name); } - if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { throw new TypeError('Invalid character in header field name'); } - return name.toLowerCase(); } - function normalizeValue(value) { if (typeof value !== 'string') { value = String(value); } - return value; - } // Build a destructive iterator for the value list - + } + // Build a destructive iterator for the value list function iteratorFor(items) { var iterator = { next: function next() { @@ -654,19 +565,15 @@ var __self__ = function () { }; } }; - if (support.iterable) { iterator[Symbol.iterator] = function () { return iterator; }; } - return iterator; } - function Headers(headers) { this.map = {}; - if (headers instanceof Headers) { headers.forEach(function (value, name) { this.append(name, value); @@ -681,31 +588,25 @@ var __self__ = function () { }, this); } } - Headers.prototype.append = function (name, value) { name = normalizeName(name); value = normalizeValue(value); var oldValue = this.map[name]; this.map[name] = oldValue ? oldValue + ', ' + value : value; }; - Headers.prototype['delete'] = function (name) { delete this.map[normalizeName(name)]; }; - Headers.prototype.get = function (name) { name = normalizeName(name); return this.has(name) ? this.map[name] : null; }; - Headers.prototype.has = function (name) { return this.map.hasOwnProperty(normalizeName(name)); }; - Headers.prototype.set = function (name, value) { this.map[normalizeName(name)] = normalizeValue(value); }; - Headers.prototype.forEach = function (callback, thisArg) { for (var name in this.map) { if (this.map.hasOwnProperty(name)) { @@ -713,7 +614,6 @@ var __self__ = function () { } } }; - Headers.prototype.keys = function () { var items = []; this.forEach(function (value, name) { @@ -721,7 +621,6 @@ var __self__ = function () { }); return iteratorFor(items); }; - Headers.prototype.values = function () { var items = []; this.forEach(function (value) { @@ -729,7 +628,6 @@ var __self__ = function () { }); return iteratorFor(items); }; - Headers.prototype.entries = function () { var items = []; this.forEach(function (value, name) { @@ -737,56 +635,45 @@ var __self__ = function () { }); return iteratorFor(items); }; - if (support.iterable) { Headers.prototype[Symbol.iterator] = Headers.prototype.entries; } - function consumed(body) { if (body.bodyUsed) { return Promise.reject(new TypeError('Already read')); } - body.bodyUsed = true; } - function fileReaderReady(reader) { return new Promise(function (resolve, reject) { reader.onload = function () { resolve(reader.result); }; - reader.onerror = function () { reject(reader.error); }; }); } - function readBlobAsArrayBuffer(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); reader.readAsArrayBuffer(blob); return promise; } - function readBlobAsText(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); reader.readAsText(blob); return promise; } - function readArrayBufferAsText(buf) { var view = new Uint8Array(buf); var chars = new Array(view.length); - for (var i = 0; i < view.length; i++) { chars[i] = String.fromCharCode(view[i]); } - return chars.join(''); } - function bufferClone(buf) { if (buf.slice) { return buf.slice(0); @@ -796,13 +683,10 @@ var __self__ = function () { return view.buffer; } } - function Body() { this.bodyUsed = false; - this._initBody = function (body) { this._bodyInit = body; - if (!body) { this._bodyText = ''; } else if (typeof body === 'string') { @@ -814,15 +698,14 @@ var __self__ = function () { } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this._bodyText = body.toString(); } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. - + this._bodyArrayBuffer = bufferClone(body.buffer); + // IE 10-11 can't handle a DataView body. this._bodyInit = new Blob([this._bodyArrayBuffer]); } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { this._bodyArrayBuffer = bufferClone(body); } else { this._bodyText = body = Object.prototype.toString.call(body); } - if (!this.headers.get('content-type')) { if (typeof body === 'string') { this.headers.set('content-type', 'text/plain;charset=UTF-8'); @@ -833,15 +716,12 @@ var __self__ = function () { } } }; - if (support.blob) { this.blob = function () { var rejected = consumed(this); - if (rejected) { return rejected; } - if (this._bodyBlob) { return Promise.resolve(this._bodyBlob); } else if (this._bodyArrayBuffer) { @@ -852,7 +732,6 @@ var __self__ = function () { return Promise.resolve(new Blob([this._bodyText])); } }; - this.arrayBuffer = function () { if (this._bodyArrayBuffer) { return consumed(this) || Promise.resolve(this._bodyArrayBuffer); @@ -861,14 +740,11 @@ var __self__ = function () { } }; } - this.text = function () { var rejected = consumed(this); - if (rejected) { return rejected; } - if (this._bodyBlob) { return readBlobAsText(this._bodyBlob); } else if (this._bodyArrayBuffer) { @@ -879,48 +755,38 @@ var __self__ = function () { return Promise.resolve(this._bodyText); } }; - if (support.formData) { this.formData = function () { return this.text().then(decode); }; } - this.json = function () { return this.text().then(JSON.parse); }; - return this; - } // HTTP methods whose capitalization should be normalized - + } + // HTTP methods whose capitalization should be normalized var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; - function normalizeMethod(method) { var upcased = method.toUpperCase(); return methods.indexOf(upcased) > -1 ? upcased : method; } - function Request(input, options) { options = options || {}; var body = options.body; - if (input instanceof Request) { if (input.bodyUsed) { throw new TypeError('Already read'); } - this.url = input.url; this.credentials = input.credentials; - if (!options.headers) { this.headers = new Headers(input.headers); } - this.method = input.method; this.mode = input.mode; this.signal = input.signal; - if (!body && input._bodyInit != null) { body = input._bodyInit; input.bodyUsed = true; @@ -928,31 +794,24 @@ var __self__ = function () { } else { this.url = String(input); } - this.credentials = options.credentials || this.credentials || 'same-origin'; - if (options.headers || !this.headers) { this.headers = new Headers(options.headers); } - this.method = normalizeMethod(options.method || this.method || 'GET'); this.mode = options.mode || this.mode || null; this.signal = options.signal || this.signal; this.referrer = null; - if ((this.method === 'GET' || this.method === 'HEAD') && body) { throw new TypeError('Body not allowed for GET or HEAD requests'); } - this._initBody(body); } - Request.prototype.clone = function () { return new Request(this, { body: this._bodyInit }); }; - function decode(body) { var form = new FormData(); body.trim().split('&').forEach(function (bytes) { @@ -965,16 +824,14 @@ var __self__ = function () { }); return form; } - function parseHeaders(rawHeaders) { - var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + var headers = new Headers(); + // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space // https://tools.ietf.org/html/rfc7230#section-3.2 - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); preProcessedHeaders.split(/\r?\n/).forEach(function (line) { var parts = line.split(':'); var key = parts.shift().trim(); - if (key) { var value = parts.join(':').trim(); headers.append(key, value); @@ -982,26 +839,20 @@ var __self__ = function () { }); return headers; } - Body.call(Request.prototype); - function Response(bodyInit, options) { if (!options) { options = {}; } - this.type = 'default'; this.status = options.status === undefined ? 200 : options.status; this.ok = this.status >= 200 && this.status < 300; this.statusText = 'statusText' in options ? options.statusText : 'OK'; this.headers = new Headers(options.headers); this.url = options.url || ''; - this._initBody(bodyInit); } - Body.call(Response.prototype); - Response.prototype.clone = function () { return new Response(this._bodyInit, { status: this.status, @@ -1010,7 +861,6 @@ var __self__ = function () { url: this.url }); }; - Response.error = function () { var response = new Response(null, { status: 0, @@ -1019,14 +869,11 @@ var __self__ = function () { response.type = 'error'; return response; }; - var redirectStatuses = [301, 302, 303, 307, 308]; - Response.redirect = function (url, status) { if (redirectStatuses.indexOf(status) === -1) { throw new RangeError('Invalid status code'); } - return new Response(null, { status: status, headers: { @@ -1034,9 +881,7 @@ var __self__ = function () { } }); }; - exports.DOMException = self.DOMException; - try { new exports.DOMException(); } catch (err) { @@ -1046,25 +891,19 @@ var __self__ = function () { var error = Error(message); this.stack = error.stack; }; - exports.DOMException.prototype = Object.create(Error.prototype); exports.DOMException.prototype.constructor = exports.DOMException; } - function fetch(input, init) { return new Promise(function (resolve, reject) { var request = new Request(input, init); - if (request.signal && request.signal.aborted) { return reject(new exports.DOMException('Aborted', 'AbortError')); } - var xhr = new XMLHttpRequest(); - function abortXhr() { xhr.abort(); } - xhr.onload = function () { var options = { status: xhr.status, @@ -1075,38 +914,29 @@ var __self__ = function () { var body = 'response' in xhr ? xhr.response : xhr.responseText; resolve(new Response(body, options)); }; - xhr.onerror = function () { reject(new TypeError('Network request failed')); }; - xhr.ontimeout = function () { reject(new TypeError('Network request failed')); }; - xhr.onabort = function () { reject(new exports.DOMException('Aborted', 'AbortError')); }; - xhr.open(request.method, request.url, true); - if (request.credentials === 'include') { xhr.withCredentials = true; } else if (request.credentials === 'omit') { xhr.withCredentials = false; } - if ('responseType' in xhr && support.blob) { xhr.responseType = 'blob'; } - request.headers.forEach(function (value, name) { xhr.setRequestHeader(name, value); }); - if (request.signal) { request.signal.addEventListener('abort', abortXhr); - xhr.onreadystatechange = function () { // DONE (success or failure) if (xhr.readyState === 4) { @@ -1114,20 +944,16 @@ var __self__ = function () { } }; } - xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); }); } - fetch.polyfill = true; - if (!self.fetch) { self.fetch = fetch; self.Headers = Headers; self.Request = Request; self.Response = Response; } - exports.Headers = Headers; exports.Request = Request; exports.Response = Response; @@ -1138,20 +964,15 @@ var __self__ = function () { return exports; }({}); })(__self__); - -__self__.fetch.ponyfill = true; // Remove "polyfill" property added by whatwg-fetch - -delete __self__.fetch.polyfill; // Choose between native implementation (global) or custom implementation (__self__) +__self__.fetch.ponyfill = true; +// Remove "polyfill" property added by whatwg-fetch +delete __self__.fetch.polyfill; +// Choose between native implementation (global) or custom implementation (__self__) // var ctx = global.fetch ? global : __self__; - var ctx = __self__; // this line disable service worker support temporarily - exports = ctx.fetch; // To enable: import fetch from 'cross-fetch' - exports["default"] = ctx.fetch; // For TypeScript consumers without esModuleInterop. - exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch' - exports.Headers = ctx.Headers; exports.Request = ctx.Request; exports.Response = ctx.Response; @@ -1162,7 +983,6 @@ module.exports = exports; /***/ (function(module) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - /* eslint-env browser */ module.exports = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData; @@ -1201,45 +1021,40 @@ exports.encode = exports.stringify = __webpack_require__(6); // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. - // If obj.hasOwnProperty has been overridden, then calling + + + +// If obj.hasOwnProperty has been overridden, then calling // obj.hasOwnProperty(prop) will break. // See: https://github.com/joyent/node/issues/1707 - function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } - module.exports = function (qs, sep, eq, options) { sep = sep || '&'; eq = eq || '='; var obj = {}; - if (typeof qs !== 'string' || qs.length === 0) { return obj; } - var regexp = /\+/g; qs = qs.split(sep); var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { maxKeys = options.maxKeys; } - - var len = qs.length; // maxKeys <= 0 means that we should not limit keys count - + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count if (maxKeys > 0 && len > maxKeys) { len = maxKeys; } - for (var i = 0; i < len; ++i) { var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, - vstr, - k, - v; - + idx = x.indexOf(eq), + kstr, + vstr, + k, + v; if (idx >= 0) { kstr = x.substr(0, idx); vstr = x.substr(idx + 1); @@ -1247,10 +1062,8 @@ module.exports = function (qs, sep, eq, options) { kstr = x; vstr = ''; } - k = decodeURIComponent(kstr); v = decodeURIComponent(vstr); - if (!hasOwnProperty(obj, k)) { obj[k] = v; } else if (isArray(obj[k])) { @@ -1259,10 +1072,8 @@ module.exports = function (qs, sep, eq, options) { obj[k] = [obj[k], v]; } } - return obj; }; - var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; @@ -1294,36 +1105,29 @@ var isArray = Array.isArray || function (xs) { // USE OR OTHER DEALINGS IN THE SOFTWARE. -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } var stringifyPrimitive = function stringifyPrimitive(v) { switch (_typeof(v)) { case 'string': return v; - case 'boolean': return v ? 'true' : 'false'; - case 'number': return isFinite(v) ? v : ''; - default: return ''; } }; - module.exports = function (obj, sep, eq, name) { sep = sep || '&'; eq = eq || '='; - if (obj === null) { obj = undefined; } - if (_typeof(obj) === 'object') { return map(objectKeys(obj), function (k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { return map(obj[k], function (v) { return ks + encodeURIComponent(stringifyPrimitive(v)); @@ -1333,33 +1137,25 @@ module.exports = function (obj, sep, eq, name) { } }).join(sep); } - if (!name) return ''; return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); }; - var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; - function map(xs, f) { if (xs.map) return xs.map(f); var res = []; - for (var i = 0; i < xs.length; i++) { res.push(f(xs[i], i)); } - return res; } - var objectKeys = Object.keys || function (obj) { var res = []; - for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } - return res; }; @@ -1368,7 +1164,6 @@ var objectKeys = Object.keys || function (obj) { /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - // Uses CommonJS, AMD or browser globals to create a module. // Based on: https://github.com/umdjs/umd/blob/master/templates/returnExports.js (function (root, factory) { @@ -1383,7 +1178,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} })(typeof self !== 'undefined' ? self : this, function () { - var rison = {}; ////////////////////////////////////////////////// + var rison = {}; + + ////////////////////////////////////////////////// // // the stringifier is based on // http://json.org/json.js as of 2006-04-28 from json.org @@ -1399,7 +1196,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * we also allow ,:@$/ * */ - rison.uri_ok = { // ok in url paths and in form query args '~': true, @@ -1417,6 +1213,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ "'": true, '/': true }; + /* * we divide the uri-safe glyphs into three sets * - used by rison ' ! : ( ) , @@ -1433,7 +1230,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (function () { var l = []; - for (var hi = 0; hi < 16; hi++) { for (var lo = 0; lo < 16; lo++) { if (hi + lo === 0) continue; @@ -1446,28 +1242,28 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * and classes are illegal in ids. * */ - - - rison.not_idchar = l.join(''); //idcrx = new RegExp('[' + rison.not_idchar + ']'); + rison.not_idchar = l.join(''); + //idcrx = new RegExp('[' + rison.not_idchar + ']'); //console.log('NOT', (idcrx.test(' ')) ); - })(); //rison.not_idchar = " \t\r\n\"<>[]{}'!=:(),*@$;&"; - + })(); + //rison.not_idchar = " \t\r\n\"<>[]{}'!=:(),*@$;&"; rison.not_idchar = " '!:(),*@$"; + /** * characters that are illegal as the start of an id * this is so ids can't look like numbers. */ - rison.not_idstart = '-0123456789'; - (function () { var idrx = '[^' + rison.not_idstart + rison.not_idchar + '][^' + rison.not_idchar + ']*'; - rison.id_ok = new RegExp('^' + idrx + '$'); // regexp to find the end of an id when parsing - // g flag on the regexp is necessary for iterative regexp.exec() + rison.id_ok = new RegExp('^' + idrx + '$'); + // regexp to find the end of an id when parsing + // g flag on the regexp is necessary for iterative regexp.exec() rison.next_id = new RegExp(idrx, 'g'); })(); + /** * this is like encodeURIComponent() but quotes fewer characters. * @@ -1477,134 +1273,119 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * rison.quote also passes ,:@$/ * and quotes " " as "+" instead of "%20" */ - - rison.quote = function (x) { if (/^[-A-Za-z0-9~!*()_.',:@$/]*$/.test(x)) return x; return encodeURIComponent(x).replace(/%2C/g, ',').replace(/%3A/g, ':').replace(/%40/g, '@').replace(/%24/g, '$').replace(/%2F/g, '/').replace(/%20/g, '+'); }; + /** * this is like decodeURIComponent() but also replaces "+" with " " */ - - rison.unquote = function (s) { // eslint-disable-next-line return decodeURIComponent(s.replace(/\+/g, '%20')); - }; // + }; + + // // based on json.js 2006-04-28 from json.org // license: http://www.json.org/license.html // // hacked by nix for use in uris. // - (function () { var sq = { - // url-ok but quoted in strings - "'": true, - '!': true - }, - enc = function enc(v) { - if (v && typeof v.toJSON === 'function') v = v.toJSON(); - - var fn = s[_typeof(v)]; - - if (fn) return fn(v); - }, - s = { - array: function array(x) { - var a = ['!('], + // url-ok but quoted in strings + "'": true, + '!': true + }, + enc = function enc(v) { + if (v && typeof v.toJSON === 'function') v = v.toJSON(); + var fn = s[_typeof(v)]; + if (fn) return fn(v); + }, + s = { + array: function array(x) { + var a = ['!('], b, i, l = x.length, v; - - for (i = 0; i < l; i += 1) { - v = enc(x[i]); - - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; + for (i = 0; i < l; i += 1) { + v = enc(x[i]); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + a[a.length] = v; + b = true; } - - a[a.length] = v; - b = true; } - } - - a[a.length] = ')'; - return a.join(''); - }, - 'boolean': function boolean(x) { - if (x) return '!t'; - return '!f'; - }, - 'null': function _null() { - return '!n'; - }, - number: function number(x) { - if (!isFinite(x)) return '!n'; // strip '+' out of exponent, '-' is ok though - - return String(x).replace(/\+/, ''); - }, - object: function object(x) { - if (x) { - if (x instanceof Array) { - return s.array(x); - } // WILL: will this work on non-Firefox browsers? - - - if (_typeof(x.__prototype__) === 'object' && typeof x.__prototype__.encode_rison !== 'undefined') return x.encode_rison(); - var a = ['('], + a[a.length] = ')'; + return a.join(''); + }, + 'boolean': function boolean(x) { + if (x) return '!t'; + return '!f'; + }, + 'null': function _null() { + return '!n'; + }, + number: function number(x) { + if (!isFinite(x)) return '!n'; + // strip '+' out of exponent, '-' is ok though + return String(x).replace(/\+/, ''); + }, + object: function object(x) { + if (x) { + if (x instanceof Array) { + return s.array(x); + } + // WILL: will this work on non-Firefox browsers? + if (_typeof(x.__prototype__) === 'object' && typeof x.__prototype__.encode_rison !== 'undefined') return x.encode_rison(); + var a = ['('], b, i, v, k, ki, ks = []; - - for (i in x) { - ks[ks.length] = i; - } - - ks.sort(); - - for (ki = 0; ki < ks.length; ki++) { - i = ks[ki]; - v = enc(x[i]); - - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; + for (i in x) { + ks[ks.length] = i; + } + ks.sort(); + for (ki = 0; ki < ks.length; ki++) { + i = ks[ki]; + v = enc(x[i]); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + k = !isFinite(i) || isNaN(parseInt(i)) ? s.string(i) : s.number(i); + a.push(k, ':', v); + b = true; } - - k = !isFinite(i) || isNaN(parseInt(i)) ? s.string(i) : s.number(i); - a.push(k, ':', v); - b = true; } + a[a.length] = ')'; + return a.join(''); } - - a[a.length] = ')'; - return a.join(''); + return '!n'; + }, + string: function string(x) { + if (x === '') return "''"; + if (rison.id_ok.test(x)) return x; + x = x.replace(/(['!])/g, function (a, b) { + if (sq[b]) return '!' + b; + return b; + }); + return "'" + x + "'"; + }, + undefined: function undefined() { + // ignore undefined just like JSON + return; } + }; - return '!n'; - }, - string: function string(x) { - if (x === '') return "''"; - if (rison.id_ok.test(x)) return x; - x = x.replace(/(['!])/g, function (a, b) { - if (sq[b]) return '!' + b; - return b; - }); - return "'" + x + "'"; - }, - undefined: function undefined() { - // ignore undefined just like JSON - return; - } - }; /** * rison-encode a javascript structure * @@ -1612,57 +1393,49 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * http://json.org/json.js as of 2006-04-28 from json.org * */ - - rison.encode = function (v) { return enc(v); }; + /** * rison-encode a javascript object without surrounding parens * */ - - rison.encode_object = function (v) { if (_typeof(v) != 'object' || v === null || v instanceof Array) throw new Error('rison.encode_object expects an object argument'); - var r = s[_typeof(v)](v); - return r.substring(1, r.length - 1); }; + /** * rison-encode a javascript array without surrounding parens * */ - - rison.encode_array = function (v) { if (!(v instanceof Array)) throw new Error('rison.encode_array expects an array argument'); - var r = s[_typeof(v)](v); - return r.substring(2, r.length - 1); }; + /** * rison-encode and uri-encode a javascript structure * */ - - rison.encode_uri = function (v) { return rison.quote(s[_typeof(v)](v)); }; + /** * uri-decode (reversing encode_uri's space -> '+' mapping) then rison-decode a string * Reverses encode_uri * */ - - rison.decode_uri = function (s) { return rison.decode(rison.unquote(s)); }; - })(); // + })(); + + // // based on openlaszlo-json and hacked by nix for use in uris. // // Author: Oliver Steele @@ -1679,38 +1452,34 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * based on Oliver Steele's OpenLaszlo-JSON * http://osteele.com/sources/openlaszlo/json */ - - rison.decode = function (r) { var errcb = function errcb(e) { throw Error('rison decoder error: ' + e); - }; // validate input is a string - - + }; + // validate input is a string if (typeof r !== 'string') return errcb("decode input must be a string"); var p = new rison.parser(errcb); return p.parse(r); }; + /** * parse an o-rison string into a javascript structure. * * this simply adds parentheses around the string before parsing. */ - - rison.decode_object = function (r) { return rison.decode('(' + r + ')'); }; + /** * parse an a-rison string into a javascript structure. * * this simply adds array markup around the string before parsing. */ - - rison.decode_array = function (r) { return rison.decode('!(' + r + ')'); }; + /** * construct a new parser object for reuse. * @@ -1719,28 +1488,25 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ * use rison.decode instead. * @see rison.decode */ - - rison.parser = function (errcb) { this.errorHandler = errcb; }; + /** * a string containing acceptable whitespace characters. * by default the rison decoder tolerates no whitespace. * to accept whitespace set rison.parser.WHITESPACE = " \t\n\r\f"; */ + rison.parser.WHITESPACE = ''; - - rison.parser.WHITESPACE = ''; // expose this as-is? - + // expose this as-is? rison.parser.prototype.setOptions = function (options) { if (options['errorHandler']) this.errorHandler = options.errorHandler; }; + /** * parse a rison string into a javascript structure. */ - - rison.parser.prototype.parse = function (str) { this.string = str; this.index = 0; @@ -1750,25 +1516,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (this.message && this.errorHandler) this.errorHandler(this.message, this.index); return value; }; - rison.parser.prototype.error = function (message) { if (typeof console !== 'undefined') console.log('rison parser error: ', message); // eslint-disable-line no-console - this.message = message; return undefined; }; - rison.parser.prototype.readValue = function () { var c = this.next(); var fn = c && this.table[c]; - if (fn) return fn.apply(this); // fell through table, parse as an id + if (fn) return fn.apply(this); + + // fell through table, parse as an id var s = this.string; - var i = this.index - 1; // Regexp.lastIndex may not work right in IE before 5.5? - // g flag on the regexp is also necessary + var i = this.index - 1; + // Regexp.lastIndex may not work right in IE before 5.5? + // g flag on the regexp is also necessary rison.next_id.lastIndex = i; - var m = rison.next_id.exec(s); // console.log('matched id', i, r.lastIndex); + var m = rison.next_id.exec(s); + + // console.log('matched id', i, r.lastIndex); if (m.length > 0) { var id = m[0]; @@ -1779,28 +1547,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (c) return this.error("invalid character: '" + c + "'"); return this.error('empty expression'); }; - rison.parser.parse_array = function (parser) { var ar = []; var c; - while ((c = parser.next()) !== ')') { if (!c) return parser.error("unmatched '!('"); - if (ar.length) { if (c !== ',') parser.error("missing ','"); } else if (c === ',') { return parser.error("extra ','"); } else --parser.index; - var n = parser.readValue(); if (typeof n == 'undefined') return undefined; ar.push(n); } - return ar; }; - rison.parser.bangs = { t: true, f: false, @@ -1813,27 +1575,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var c = s.charAt(this.index++); if (!c) return this.error('"!" at end of input'); var x = rison.parser.bangs[c]; - if (typeof x == 'function') { return x.call(null, this); } else if (typeof x == 'undefined') { return this.error('unknown literal: "!' + c + '"'); } - return x; }, '(': function _() { var o = {}; var c; var count = 0; - while ((c = this.next()) !== ')') { if (count) { if (c !== ',') this.error("missing ','"); } else if (c === ',') { return this.error("extra ','"); } else --this.index; - var k = this.readValue(); if (typeof k === 'undefined') return undefined; if (this.next() !== ':') return this.error("missing ':'"); @@ -1842,7 +1600,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ o[k] = v; count++; } - return o; }, "'": function _() { @@ -1851,25 +1608,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var start = i; var segments = []; var c; - while ((c = s.charAt(i++)) !== "'") { //if (i == s.length) return this.error('unmatched "\'"'); if (!c) return this.error('unmatched "\'"'); - if (c === '!') { if (start < i - 1) segments.push(s.slice(start, i - 1)); c = s.charAt(i++); - if ("!'".indexOf(c) >= 0) { segments.push(c); } else { return this.error('invalid string escape: "!' + c + '"'); } - start = i; } } - if (start < i - 1) segments.push(s.slice(start, i - 1)); this.index = i; return segments.length === 1 ? segments[0] : segments.join(''); @@ -1887,50 +1639,45 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ 'int+e': 'exp', 'frac+e': 'exp' }; - do { var c = s.charAt(i++); if (!c) break; if ('0' <= c && c <= '9') continue; - if (permittedSigns.indexOf(c) >= 0) { permittedSigns = ''; continue; } - state = transitions[state + '+' + c.toLowerCase()]; if (state === 'exp') permittedSigns = '-'; } while (state); - this.index = --i; s = s.slice(start, i); if (s === '-') return this.error('invalid number'); return Number(s); } - }; // copy table['-'] to each of table[i] | i <- '0'..'9': - + }; + // copy table['-'] to each of table[i] | i <- '0'..'9': (function (table) { for (var i = 0; i <= 9; i++) { table[String(i)] = table['-']; } - })(rison.parser.prototype.table); // return the next non-whitespace character, or undefined - + })(rison.parser.prototype.table); + // return the next non-whitespace character, or undefined rison.parser.prototype.next = function () { var c; var s = this.string; var i = this.index; - do { if (i === s.length) return undefined; c = s.charAt(i++); } while (rison.parser.WHITESPACE.indexOf(c) >= 0); - this.index = i; return c; }; + return rison; - return rison; // End of UMD module wrapper + // End of UMD module wrapper }); /***/ }), @@ -1938,16 +1685,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ (function(module) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var util = /*#__PURE__*/function () { function util() { _classCallCheck(this, util); } - _createClass(util, null, [{ key: "isBrowser", value: function isBrowser() { @@ -1965,7 +1708,6 @@ var util = /*#__PURE__*/function () { var element = document.querySelector("meta[name=\"".concat(metaTagName, "\"]")); return element && element.getAttribute("content"); } - return null; } }, { @@ -1974,10 +1716,8 @@ var util = /*#__PURE__*/function () { return util.isNode() ? process.env[envVariableName] : null; } }]); - return util; }(); - module.exports = util; /***/ }), @@ -1985,43 +1725,26 @@ module.exports = util; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var iNaturalistAPIResponse = /*#__PURE__*/function (_Model) { _inherits(iNaturalistAPIResponse, _Model); - var _super = _createSuper(iNaturalistAPIResponse); - function iNaturalistAPIResponse() { _classCallCheck(this, iNaturalistAPIResponse); - return _super.apply(this, arguments); } - return _createClass(iNaturalistAPIResponse); }(Model); - module.exports = iNaturalistAPIResponse; /***/ }), @@ -2029,18 +1752,13 @@ module.exports = iNaturalistAPIResponse; /***/ (function(module) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var Model = /*#__PURE__*/function () { function Model(attrs) { _classCallCheck(this, Model); - Object.assign(this, attrs); } - _createClass(Model, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response, Type) { @@ -2063,14 +1781,11 @@ var Model = /*#__PURE__*/function () { return new Type(r); }); } - return response; } }]); - return Model; }(); - module.exports = Model; /***/ }), @@ -2078,20 +1793,14 @@ module.exports = Model; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Annotation = __webpack_require__(12); - var annotations = /*#__PURE__*/function () { function annotations() { _classCallCheck(this, annotations); } - _createClass(annotations, null, [{ key: "create", value: function create(params, options) { @@ -2106,29 +1815,23 @@ var annotations = /*#__PURE__*/function () { key: "vote", value: function vote(params, options) { var endpoint = "votes/vote/annotation/:id"; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { endpoint = "annotations/:id/vote"; } - return iNaturalistAPI.post(endpoint, params, options).then(Annotation.typifyInstanceResponse); } }, { key: "unvote", value: function unvote(params, options) { var endpoint = "votes/unvote/annotation/:id"; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { endpoint = "annotations/:id/vote"; } - return iNaturalistAPI["delete"](endpoint, params, options); } }]); - return annotations; }(); - module.exports = annotations; /***/ }), @@ -2136,54 +1839,34 @@ module.exports = annotations; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Annotation = /*#__PURE__*/function (_Model) { _inherits(Annotation, _Model); - var _super = _createSuper(Annotation); - function Annotation() { _classCallCheck(this, Annotation); - return _super.apply(this, arguments); } - _createClass(Annotation, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(Annotation), "typifyInstanceResponse", this).call(this, response, Annotation); } }]); - return Annotation; }(Model); - module.exports = Annotation; /***/ }), @@ -2191,26 +1874,17 @@ module.exports = Annotation; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Announcement = __webpack_require__(14); - var announcements = /*#__PURE__*/function () { function announcements() { _classCallCheck(this, announcements); } - _createClass(announcements, null, [{ key: "search", value: function search(params, options) { @@ -2224,10 +1898,8 @@ var announcements = /*#__PURE__*/function () { return iNaturalistAPI.put("announcements/:id/dismiss", params, options); } }]); - return announcements; }(); - module.exports = announcements; /***/ }), @@ -2235,54 +1907,34 @@ module.exports = announcements; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Announcement = /*#__PURE__*/function (_Model) { _inherits(Announcement, _Model); - var _super = _createSuper(Announcement); - function Announcement() { _classCallCheck(this, Announcement); - return _super.apply(this, arguments); } - _createClass(Announcement, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(Announcement), "typifyInstanceResponse", this).call(this, response, Announcement); } }]); - return Announcement; }(Model); - module.exports = Announcement; /***/ }), @@ -2290,26 +1942,17 @@ module.exports = Announcement; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var AuthorizedApplication = __webpack_require__(16); - var authorizedApplications = /*#__PURE__*/function () { function authorizedApplications() { _classCallCheck(this, authorizedApplications); } - _createClass(authorizedApplications, null, [{ key: "search", value: function search(params) { @@ -2322,18 +1965,14 @@ var authorizedApplications = /*#__PURE__*/function () { key: "delete", value: function _delete(params, options) { var endpoint = "oauth/authorized_applications/:id"; - if (iNaturalistAPI.writeApiURL && iNaturalistAPI.writeApiURL.match(/\/v\d/)) { endpoint = "authorized_applications/:id"; } - return iNaturalistAPI["delete"](endpoint, params, options); } }]); - return authorizedApplications; }(); - module.exports = authorizedApplications; /***/ }), @@ -2341,54 +1980,34 @@ module.exports = authorizedApplications; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var AuthorizedApplication = /*#__PURE__*/function (_Model) { _inherits(AuthorizedApplication, _Model); - var _super = _createSuper(AuthorizedApplication); - function AuthorizedApplication() { _classCallCheck(this, AuthorizedApplication); - return _super.apply(this, arguments); } - _createClass(AuthorizedApplication, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { return _get(_getPrototypeOf(AuthorizedApplication), "typifyResultsResponse", this).call(this, response, AuthorizedApplication); } }]); - return AuthorizedApplication; }(Model); - module.exports = AuthorizedApplication; /***/ }), @@ -2396,20 +2015,14 @@ module.exports = AuthorizedApplication; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Comment = __webpack_require__(18); - var comments = /*#__PURE__*/function () { function comments() { _classCallCheck(this, comments); } - _createClass(comments, null, [{ key: "create", value: function create(params, options) { @@ -2426,10 +2039,8 @@ var comments = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("comments/:id", params, options); } }]); - return comments; }(); - module.exports = comments; /***/ }), @@ -2437,54 +2048,34 @@ module.exports = comments; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Comment = /*#__PURE__*/function (_Model) { _inherits(Comment, _Model); - var _super = _createSuper(Comment); - function Comment() { _classCallCheck(this, Comment); - return _super.apply(this, arguments); } - _createClass(Comment, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(Comment), "typifyInstanceResponse", this).call(this, response, Comment); } }]); - return Comment; }(Model); - module.exports = Comment; /***/ }), @@ -2492,48 +2083,35 @@ module.exports = Comment; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var Taxon = __webpack_require__(20); - +var Observation = __webpack_require__(20); +var Taxon = __webpack_require__(21); var computervision = /*#__PURE__*/function () { function computervision() { _classCallCheck(this, computervision); } - _createClass(computervision, null, [{ key: "score_image", value: function score_image(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase var options = _objectSpread({}, opts); - options.useAuth = true; options.apiURL = iNaturalistAPI.apiURL; // force the host to be the Node API - return iNaturalistAPI.upload("computervision/score_image", params, options).then(function (response) { response.results = response.results.map(function (r) { return _objectSpread(_objectSpread({}, r), {}, { taxon: new Taxon(r.taxon) }); }); - if (response.common_ancestor) { response.common_ancestor.taxon = new Taxon(response.common_ancestor.taxon); } - return response; }); } @@ -2541,10 +2119,8 @@ var computervision = /*#__PURE__*/function () { key: "score_observation", value: function score_observation(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.get("computervision/score_observation/:id", params, options).then(function (response) { response.results = response.results.map(function (r) { @@ -2552,19 +2128,31 @@ var computervision = /*#__PURE__*/function () { taxon: new Taxon(r.taxon) }); }); - if (response.common_ancestor) { response.common_ancestor.taxon = new Taxon(response.common_ancestor.taxon); } - + return response; + }); + } + }, { + key: "language_search", + value: function language_search(params) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + // eslint-disable-line camelcase + var options = _objectSpread({}, opts); + options.useAuth = true; + return iNaturalistAPI.get("computervision/language_search", params, options).then(function (response) { + response.results = response.results.map(function (r) { + return _objectSpread(_objectSpread({}, r), {}, { + observation: new Observation(r.observation) + }); + }); return response; }); } }]); - return computervision; }(); - module.exports = computervision; /***/ }), @@ -2572,55 +2160,152 @@ module.exports = computervision; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +/* eslint prefer-destructuring: 0 */ var Model = __webpack_require__(10); +var Taxon = __webpack_require__(21); +var Photo = __webpack_require__(22); +var Sound = __webpack_require__(25); +var Identification = __webpack_require__(26); +var Comment = __webpack_require__(18); +var Observation = /*#__PURE__*/function (_Model) { + _inherits(Observation, _Model); + var _super = _createSuper(Observation); + function Observation(attrs) { + var _this; + _classCallCheck(this, Observation); + _this = _super.call(this, attrs); + if (_this.private_geojson && _this.private_geojson.coordinates) { + _this.latitude = _this.private_geojson.coordinates[1]; + _this.longitude = _this.private_geojson.coordinates[0]; + } else if (_this.geojson && _this.geojson.coordinates) { + _this.latitude = _this.geojson.coordinates[1]; + _this.longitude = _this.geojson.coordinates[0]; + } + if (_this.taxon) { + _this.taxon = new Taxon(_this.taxon); + } + if (_this.community_taxon) { + _this.communityTaxon = new Taxon(_this.community_taxon); + } + if (_this.photos && _this.photos.length > 0) { + _this.photos = _this.photos.map(function (p) { + return new Photo(p); + }); + } + if (_this.sounds && _this.sounds.length > 0) { + _this.sounds = _this.sounds.map(function (s) { + return new Sound(s); + }); + } + if (_this.comments && _this.comments.length > 0) { + _this.comments = _this.comments.map(function (c) { + return new Comment(c); + }); + } + if (_this.identifications && _this.identifications.length > 0) { + _this.identifications = _this.identifications.map(function (i) { + return new Identification(i); + }); + } + return _this; + } + _createClass(Observation, [{ + key: "photo", + value: function photo() { + var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "square"; + this.cachedPhotos = this.cachedPhotos || {}; + if (this.cachedPhotos[size]) { + return this.cachedPhotos[size]; + } + if (this.photos && this.photos.length > 0) { + this.cachedPhotos[size] = this.photos[0].photoUrl(size); + } + return this.cachedPhotos[size]; + } + }, { + key: "hasPhotos", + value: function hasPhotos() { + if (!this.photos || this.photos.length === 0) { + return false; + } + var hasPhotos = false; + this.photos.forEach(function (p) { + hasPhotos = hasPhotos || !!p.url; + }); + return hasPhotos; + } + }, { + key: "hasSounds", + value: function hasSounds() { + return this.sounds && this.sounds.length > 0; + } + }, { + key: "hasMedia", + value: function hasMedia() { + if (this.hasPhotos() || this.hasSounds()) { + return true; + } + return false; + } + }], [{ + key: "typifyResultsResponse", + value: function typifyResultsResponse(response) { + return _get(_getPrototypeOf(Observation), "typifyResultsResponse", this).call(this, response, Observation); + } + }, { + key: "typifyInstanceResponse", + value: function typifyInstanceResponse(response) { + return _get(_getPrototypeOf(Observation), "typifyInstanceResponse", this).call(this, response, Observation); + } + }]); + return Observation; +}(Model); +module.exports = Observation; -var Photo = __webpack_require__(21); - -var User = __webpack_require__(22); - -var ConservationStatus = __webpack_require__(23); +/***/ }), +/* 21 */ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +var Model = __webpack_require__(10); +var Photo = __webpack_require__(22); +var User = __webpack_require__(23); +var ConservationStatus = __webpack_require__(24); var Taxon = /*#__PURE__*/function (_Model) { _inherits(Taxon, _Model); - var _super = _createSuper(Taxon); - function Taxon(attrs) { var _this; - _classCallCheck(this, Taxon); - _this = _super.call(this, attrs); - if (_this.default_photo && _this.default_photo !== undefined) { _this.defaultPhoto = new Photo(_this.default_photo); } - if (_this.taxon_photos && _this.taxon_photos !== undefined) { _this.taxonPhotos = _this.taxon_photos.map(function (tp) { return { @@ -2629,29 +2314,24 @@ var Taxon = /*#__PURE__*/function (_Model) { }; }); } - if (_this.conservation_status && _this.conservation_status !== undefined) { _this.conservationStatus = new ConservationStatus(_this.conservation_status); } - if (_this.conservation_statuses && _this.conservation_statuses !== undefined) { _this.conservationStatuses = _this.conservation_statuses.map(function (cs) { return new ConservationStatus(cs); }); } - if (_this.ancestors && _this.ancestors !== undefined) { _this.ancestorTaxa = _this.ancestors.map(function (a) { return new Taxon(a); }); } - if (_this.children && _this.children !== undefined) { _this.childTaxa = _this.children.map(function (a) { return new Taxon(a); }); } - if (_this.taxon_curators && _this.taxon_curators !== undefined) { _this.taxonCurators = _this.taxon_curators.map(function (tc) { return { @@ -2659,17 +2339,14 @@ var Taxon = /*#__PURE__*/function (_Model) { }; }); } - return _this; } - _createClass(Taxon, [{ key: "iconicTaxonName", value: function iconicTaxonName() { if (this.iconic_taxon_name && this.iconic_taxon_name.length > 0) { return this.iconic_taxon_name; } - return "Unknown"; } }, { @@ -2678,7 +2355,6 @@ var Taxon = /*#__PURE__*/function (_Model) { if (this.default_photo) { return ""); } - return ""); } }], [{ @@ -2687,69 +2363,46 @@ var Taxon = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(Taxon), "typifyResultsResponse", this).call(this, response, Taxon); } }]); - return Taxon; }(Model); - module.exports = Taxon; /***/ }), -/* 21 */ +/* 22 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Photo = /*#__PURE__*/function (_Model) { _inherits(Photo, _Model); - var _super = _createSuper(Photo); - function Photo() { _classCallCheck(this, Photo); - return _super.apply(this, arguments); } - _createClass(Photo, [{ key: "photoUrl", value: function photoUrl() { var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "square"; this.cachedPhotos = this.cachedPhotos || {}; - if (this.cachedPhotos[size]) { return this.cachedPhotos[size]; } - if (this["".concat(size, "_url")]) { return this["".concat(size, "_url")]; } - if (this.preview) { this.cachedPhotos[size] = this.preview; } else if (this.url) { @@ -2759,7 +2412,6 @@ var Photo = /*#__PURE__*/function (_Model) { } else { return null; } - return this.cachedPhotos[size]; } }, { @@ -2782,25 +2434,20 @@ var Photo = /*#__PURE__*/function (_Model) { large: 1024, original: 2048 }; - if (!longEdges[size] || size === "original" || !this.original_dimensions) { return this.original_dimensions; } - var w = this.original_dimensions.width; var h = this.original_dimensions.height; - if (Math.max(w, h) < longEdges[size]) { return null; } - if (w < h) { return { width: Math.round(longEdges[size] / this.original_dimensions.height * this.original_dimensions.width), height: longEdges[size] }; } - return { width: longEdges[size], height: Math.round(longEdges[size] / this.original_dimensions.width * this.original_dimensions.height) @@ -2812,55 +2459,35 @@ var Photo = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(Photo), "typifyInstanceResponse", this).call(this, response, Photo); } }]); - return Photo; }(Model); - module.exports = Photo; /***/ }), -/* 22 */ +/* 23 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var User = /*#__PURE__*/function (_Model) { _inherits(User, _Model); - var _super = _createSuper(User); - function User() { _classCallCheck(this, User); - return _super.apply(this, arguments); } - _createClass(User, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { @@ -2872,82 +2499,55 @@ var User = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(User), "typifyInstanceResponse", this).call(this, response, User); } }]); - return User; }(Model); - module.exports = User; /***/ }), -/* 23 */ +/* 24 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ConservationStatus = /*#__PURE__*/function (_Model) { _inherits(ConservationStatus, _Model); - var _super = _createSuper(ConservationStatus); - function ConservationStatus() { _classCallCheck(this, ConservationStatus); - return _super.apply(this, arguments); } - _createClass(ConservationStatus, [{ key: "iucnStatus", value: function iucnStatus() { switch (this.iucn) { case 0: return "not evaluated"; - case 5: return "data deficient"; - case 10: return "least concern"; - case 20: return "near threatened"; - case 30: return "vulnerable"; - case 40: return "endangered"; - case 50: return "critically endangered"; - case 60: return "extinct in the wild"; - case 70: return "extinct"; - default: return null; } @@ -2973,45 +2573,35 @@ var ConservationStatus = /*#__PURE__*/function (_Model) { switch (this.authority) { case "IUCN Red List": return this.iucnStatus(); - case "NatureServe": return this.natureServeStatus(); - case "Norma Oficial 059": return this.normaStatus(); - default: if (!this.status) { return this.status; } - switch (this.status.toLowerCase()) { case "se": case "fe": case "le": case "e": return "endangered"; - case "st": case "ft": case "lt": case "t": return "threatened"; - case "sc": return "special concern"; - case "c": return "candidate"; - default: if (this.description && this.description.length < 50) { return "".concat(this.description, " (").concat(this.status, ")"); } - return this.status; } - } } }, { @@ -3020,29 +2610,21 @@ var ConservationStatus = /*#__PURE__*/function (_Model) { var status = this.status || ""; var matches = status.match(/T(.)/); var nsStatus = matches ? matches[1] : status[1]; - switch (nsStatus) { case "X": return "extinct"; - case "H": return "possibly extinct"; - case "1": return "critically imperiled"; - case "2": return "imperiled"; - case "3": return "vulnerable"; - case "4": return "apparently secure"; - case "5": return "secure"; - default: return this.status; } @@ -3053,54 +2635,114 @@ var ConservationStatus = /*#__PURE__*/function (_Model) { switch (this.status) { case "P": return "en peligro de extinción"; - case "A": return "amenazada"; - case "Pr": return "sujeta a protección especial"; - case "Ex": return "probablemente extinta en el medio silvestre"; - default: return this.status; } } }]); - return ConservationStatus; }(Model); - module.exports = ConservationStatus; /***/ }), -/* 24 */ +/* 25 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +var Model = __webpack_require__(10); +var Sound = /*#__PURE__*/function (_Model) { + _inherits(Sound, _Model); + var _super = _createSuper(Sound); + function Sound() { + _classCallCheck(this, Sound); + return _super.apply(this, arguments); + } + _createClass(Sound, null, [{ + key: "typifyInstanceResponse", + value: function typifyInstanceResponse(response) { + return _get(_getPrototypeOf(Sound), "typifyInstanceResponse", this).call(this, response, Sound); + } + }]); + return Sound; +}(Model); +module.exports = Sound; -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +/***/ }), +/* 26 */ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +var Model = __webpack_require__(10); +var Taxon = __webpack_require__(21); +var Identification = /*#__PURE__*/function (_Model) { + _inherits(Identification, _Model); + var _super = _createSuper(Identification); + function Identification(attrs) { + var _this; + _classCallCheck(this, Identification); + _this = _super.call(this, attrs); + if (_this.taxon && _this.taxon !== undefined) { + _this.taxon = new Taxon(_this.taxon); + } + return _this; + } + _createClass(Identification, null, [{ + key: "typifyInstanceResponse", + value: function typifyInstanceResponse(response) { + return _get(_getPrototypeOf(Identification), "typifyInstanceResponse", this).call(this, response, Identification); + } + }]); + return Identification; +}(Model); +module.exports = Identification; -var iNaturalistAPI = __webpack_require__(1); - -var ControlledTerm = __webpack_require__(25); +/***/ }), +/* 27 */ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +var iNaturalistAPI = __webpack_require__(1); +var ControlledTerm = __webpack_require__(28); var typifyResponse = function typifyResponse(response) { var typifiedResponse = ControlledTerm.typifyResultsResponse(response); - if (!typifiedResponse.results) { return typifiedResponse; } - for (var i = 0; i < typifiedResponse.results.length; i += 1) { if (typifiedResponse.results[i] && typifiedResponse.results[i].values) { typifiedResponse.results[i].values = typifiedResponse.results[i].values.map(function (v) { @@ -3108,31 +2750,25 @@ var typifyResponse = function typifyResponse(response) { }); } } - return typifiedResponse; }; - var controlledTerms = /*#__PURE__*/function () { function controlledTerms() { _classCallCheck(this, controlledTerms); } - _createClass(controlledTerms, null, [{ key: "for_taxon", - value: // eslint-disable-line camelcase + value: + // eslint-disable-line camelcase function for_taxon(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { var taxonIds = params.taxon_id.toString().split(",").join(","); - var newParams = _objectSpread({}, params); - delete newParams.taxon_id; return iNaturalistAPI.get("controlled_terms/for_taxon/".concat(taxonIds), newParams, opts).then(typifyResponse); } - return iNaturalistAPI.get("controlled_terms/for_taxon", params, opts).then(typifyResponse); } }, { @@ -3142,65 +2778,42 @@ var controlledTerms = /*#__PURE__*/function () { return iNaturalistAPI.get("controlled_terms", params, opts).then(typifyResponse); } }]); - return controlledTerms; }(); - module.exports = controlledTerms; // eslint-disable-line camelcase /***/ }), -/* 25 */ +/* 28 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ControlledTerm = /*#__PURE__*/function (_Model) { _inherits(ControlledTerm, _Model); - var _super = _createSuper(ControlledTerm); - function ControlledTerm(attrs) { var _this; - _classCallCheck(this, ControlledTerm); - _this = _super.call(this, attrs); - if (_this.values) { _this.values = _this.values.map(function (v) { return new ControlledTerm(v); }); } - return _this; } - _createClass(ControlledTerm, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { @@ -3212,31 +2825,23 @@ var ControlledTerm = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(ControlledTerm), "typifyInstanceResponse", this).call(this, response, ControlledTerm); } }]); - return ControlledTerm; }(Model); - module.exports = ControlledTerm; /***/ }), -/* 26 */ +/* 29 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var Flag = __webpack_require__(27); - +var Flag = __webpack_require__(30); var flags = /*#__PURE__*/function () { function flags() { _classCallCheck(this, flags); } - _createClass(flags, null, [{ key: "create", value: function create(params, options) { @@ -3253,98 +2858,64 @@ var flags = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("flags/:id", params, options); } }]); - return flags; }(); - module.exports = flags; /***/ }), -/* 27 */ +/* 30 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Flag = /*#__PURE__*/function (_Model) { _inherits(Flag, _Model); - var _super = _createSuper(Flag); - function Flag() { _classCallCheck(this, Flag); - return _super.apply(this, arguments); } - _createClass(Flag, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(Flag), "typifyInstanceResponse", this).call(this, response, Flag); } }]); - return Flag; }(Model); - module.exports = Flag; /***/ }), -/* 28 */ +/* 31 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var Identification = __webpack_require__(29); - -var Taxon = __webpack_require__(20); - -var User = __webpack_require__(22); - -var Observation = __webpack_require__(30); - +var Identification = __webpack_require__(26); +var Taxon = __webpack_require__(21); +var User = __webpack_require__(23); +var Observation = __webpack_require__(20); var identifications = /*#__PURE__*/function () { function identifications() { _classCallCheck(this, identifications); } - _createClass(identifications, null, [{ key: "create", value: function create(params, options) { @@ -3364,10 +2935,8 @@ var identifications = /*#__PURE__*/function () { key: "similar_species", value: function similar_species(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.get("identifications/similar_species", params, options).then(function (response) { if (response.results) { @@ -3377,7 +2946,6 @@ var identifications = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -3385,30 +2953,23 @@ var identifications = /*#__PURE__*/function () { key: "recent_taxa", value: function recent_taxa(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.get("identifications/recent_taxa", params, options).then(function (response) { if (response.results) { response.results = response.results.map(function (res) { var _r$identification, _r$identification$obs; - var r = _objectSpread({}, res); - r.taxon = new Taxon(r.taxon); r.identification = new Identification(r.identification); - if ((_r$identification = r.identification) !== null && _r$identification !== void 0 && (_r$identification$obs = _r$identification.observation) !== null && _r$identification$obs !== void 0 && _r$identification$obs.identifications) { delete r.identification.observation.identifications; } - r.identification.observation = new Observation(r.identification.observation); return r; }); } - return response; }); } @@ -3416,30 +2977,23 @@ var identifications = /*#__PURE__*/function () { key: "recent_taxa_revisited", value: function recent_taxa_revisited(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // eslint-disable-line camelcase var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.get("identifications/recent_taxa_revisited", params, options).then(function (response) { if (response.results) { response.results = response.results.map(function (res) { var _r$identification2, _r$identification2$ob; - var r = _objectSpread({}, res); - r.taxon = new Taxon(r.taxon); r.identification = new Identification(r.identification); - if ((_r$identification2 = r.identification) !== null && _r$identification2 !== void 0 && (_r$identification2$ob = _r$identification2.observation) !== null && _r$identification2$ob !== void 0 && _r$identification2$ob.identifications) { delete r.identification.observation.identifications; } - r.identification.observation = new Observation(r.identification.observation); return r; }); } - return response; }); } @@ -3450,330 +3004,40 @@ var identifications = /*#__PURE__*/function () { if (response.results) { response.results = response.results.map(function (r) { return _objectSpread(_objectSpread({}, r), {}, { - user: new User(r.user) - }); - }); - } - - return response; - }); - } - }, { - key: "categories", - value: function categories(params) { - var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return iNaturalistAPI.get("identifications/categories", params, opts); - } - }]); - - return identifications; -}(); - -module.exports = identifications; - -/***/ }), -/* 29 */ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var Model = __webpack_require__(10); - -var Taxon = __webpack_require__(20); - -var Identification = /*#__PURE__*/function (_Model) { - _inherits(Identification, _Model); - - var _super = _createSuper(Identification); - - function Identification(attrs) { - var _this; - - _classCallCheck(this, Identification); - - _this = _super.call(this, attrs); - - if (_this.taxon && _this.taxon !== undefined) { - _this.taxon = new Taxon(_this.taxon); - } - - return _this; - } - - _createClass(Identification, null, [{ - key: "typifyInstanceResponse", - value: function typifyInstanceResponse(response) { - return _get(_getPrototypeOf(Identification), "typifyInstanceResponse", this).call(this, response, Identification); - } - }]); - - return Identification; -}(Model); - -module.exports = Identification; - -/***/ }), -/* 30 */ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -/* eslint prefer-destructuring: 0 */ -var Model = __webpack_require__(10); - -var Taxon = __webpack_require__(20); - -var Photo = __webpack_require__(21); - -var Sound = __webpack_require__(31); - -var Identification = __webpack_require__(29); - -var Comment = __webpack_require__(18); - -var Observation = /*#__PURE__*/function (_Model) { - _inherits(Observation, _Model); - - var _super = _createSuper(Observation); - - function Observation(attrs) { - var _this; - - _classCallCheck(this, Observation); - - _this = _super.call(this, attrs); - - if (_this.private_geojson && _this.private_geojson.coordinates) { - _this.latitude = _this.private_geojson.coordinates[1]; - _this.longitude = _this.private_geojson.coordinates[0]; - } else if (_this.geojson && _this.geojson.coordinates) { - _this.latitude = _this.geojson.coordinates[1]; - _this.longitude = _this.geojson.coordinates[0]; - } - - if (_this.taxon) { - _this.taxon = new Taxon(_this.taxon); - } - - if (_this.community_taxon) { - _this.communityTaxon = new Taxon(_this.community_taxon); - } - - if (_this.photos && _this.photos.length > 0) { - _this.photos = _this.photos.map(function (p) { - return new Photo(p); - }); - } - - if (_this.sounds && _this.sounds.length > 0) { - _this.sounds = _this.sounds.map(function (s) { - return new Sound(s); - }); - } - - if (_this.comments && _this.comments.length > 0) { - _this.comments = _this.comments.map(function (c) { - return new Comment(c); - }); - } - - if (_this.identifications && _this.identifications.length > 0) { - _this.identifications = _this.identifications.map(function (i) { - return new Identification(i); - }); - } - - return _this; - } - - _createClass(Observation, [{ - key: "photo", - value: function photo() { - var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "square"; - this.cachedPhotos = this.cachedPhotos || {}; - - if (this.cachedPhotos[size]) { - return this.cachedPhotos[size]; - } - - if (this.photos && this.photos.length > 0) { - this.cachedPhotos[size] = this.photos[0].photoUrl(size); - } - - return this.cachedPhotos[size]; - } - }, { - key: "hasPhotos", - value: function hasPhotos() { - if (!this.photos || this.photos.length === 0) { - return false; - } - - var hasPhotos = false; - this.photos.forEach(function (p) { - hasPhotos = hasPhotos || !!p.url; - }); - return hasPhotos; - } - }, { - key: "hasSounds", - value: function hasSounds() { - return this.sounds && this.sounds.length > 0; - } - }, { - key: "hasMedia", - value: function hasMedia() { - if (this.hasPhotos() || this.hasSounds()) { - return true; - } - - return false; - } - }], [{ - key: "typifyResultsResponse", - value: function typifyResultsResponse(response) { - return _get(_getPrototypeOf(Observation), "typifyResultsResponse", this).call(this, response, Observation); - } - }, { - key: "typifyInstanceResponse", - value: function typifyInstanceResponse(response) { - return _get(_getPrototypeOf(Observation), "typifyInstanceResponse", this).call(this, response, Observation); - } - }]); - - return Observation; -}(Model); - -module.exports = Observation; - -/***/ }), -/* 31 */ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var Model = __webpack_require__(10); - -var Sound = /*#__PURE__*/function (_Model) { - _inherits(Sound, _Model); - - var _super = _createSuper(Sound); - - function Sound() { - _classCallCheck(this, Sound); - - return _super.apply(this, arguments); - } - - _createClass(Sound, null, [{ - key: "typifyInstanceResponse", - value: function typifyInstanceResponse(response) { - return _get(_getPrototypeOf(Sound), "typifyInstanceResponse", this).call(this, response, Sound); + user: new User(r.user) + }); + }); + } + return response; + }); + } + }, { + key: "categories", + value: function categories(params) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return iNaturalistAPI.get("identifications/categories", params, opts); } }]); - - return Sound; -}(Model); - -module.exports = Sound; + return identifications; +}(); +module.exports = identifications; /***/ }), /* 32 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Message = __webpack_require__(33); - var messages = /*#__PURE__*/function () { function messages() { _classCallCheck(this, messages); } - _createClass(messages, null, [{ key: "create", value: function create(params, options) { @@ -3783,24 +3047,20 @@ var messages = /*#__PURE__*/function () { key: "search", value: function search(params) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var opts = _objectSpread(_objectSpread({}, options), {}, { useWriteApi: true, useAuth: true }); - return iNaturalistAPI.get("messages", params, opts).then(Message.typifyResultsResponse); } }, { key: "fetch", value: function fetch(params) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var opts = _objectSpread(_objectSpread({}, options), {}, { useWriteApi: true, useAuth: true }); - return iNaturalistAPI.get("messages/:id", params, opts).then(Message.typifyResultsResponse); } }, { @@ -3812,19 +3072,15 @@ var messages = /*#__PURE__*/function () { key: "unread", value: function unread(params) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var opts = _objectSpread(_objectSpread({}, options), {}, { useWriteApi: true, useAuth: true }); - return iNaturalistAPI.get("messages/count", params, opts); } }]); - return messages; }(); - module.exports = messages; /***/ }), @@ -3832,44 +3088,26 @@ module.exports = messages; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Message = /*#__PURE__*/function (_Model) { _inherits(Message, _Model); - var _super = _createSuper(Message); - function Message() { _classCallCheck(this, Message); - return _super.apply(this, arguments); } - _createClass(Message, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { @@ -3881,10 +3119,8 @@ var Message = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(Message), "typifyResultsResponse", this).call(this, response, Message); } }]); - return Message; }(Model); - module.exports = Message; /***/ }), @@ -3892,20 +3128,14 @@ module.exports = Message; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var ObservationFieldValue = __webpack_require__(35); - var observationFieldValues = /*#__PURE__*/function () { function observationFieldValues() { _classCallCheck(this, observationFieldValues); } - _createClass(observationFieldValues, null, [{ key: "create", value: function create(params, options) { @@ -3922,10 +3152,8 @@ var observationFieldValues = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("observation_field_values/:id", params, options); } }]); - return observationFieldValues; }(); - module.exports = observationFieldValues; /***/ }), @@ -3933,54 +3161,34 @@ module.exports = observationFieldValues; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ObservationFieldValue = /*#__PURE__*/function (_Model) { _inherits(ObservationFieldValue, _Model); - var _super = _createSuper(ObservationFieldValue); - function ObservationFieldValue() { _classCallCheck(this, ObservationFieldValue); - return _super.apply(this, arguments); } - _createClass(ObservationFieldValue, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(ObservationFieldValue), "typifyInstanceResponse", this).call(this, response, ObservationFieldValue); } }]); - return ObservationFieldValue; }(Model); - module.exports = ObservationFieldValue; /***/ }), @@ -3988,24 +3196,16 @@ module.exports = ObservationFieldValue; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var observationPhotos = /*#__PURE__*/function () { function observationPhotos() { _classCallCheck(this, observationPhotos); } - _createClass(observationPhotos, null, [{ key: "create", value: function create(params, options) { @@ -4016,20 +3216,16 @@ var observationPhotos = /*#__PURE__*/function () { // make the server require the file param. return iNaturalistAPI.post("observation_photos", params, options); } - return iNaturalistAPI.upload("observation_photos", params, options); } }, { key: "update", value: function update(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { return iNaturalistAPI.put("observation_photos/:id", params, options); } - options.method = "PUT"; return iNaturalistAPI.upload("observation_photos/:id", params, options); } @@ -4039,10 +3235,8 @@ var observationPhotos = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("observation_photos/:id", params, options); } }]); - return observationPhotos; }(); - module.exports = observationPhotos; /***/ }), @@ -4050,24 +3244,16 @@ module.exports = observationPhotos; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var observationSounds = /*#__PURE__*/function () { function observationSounds() { _classCallCheck(this, observationSounds); } - _createClass(observationSounds, null, [{ key: "create", value: function create(params, options) { @@ -4078,20 +3264,16 @@ var observationSounds = /*#__PURE__*/function () { // make the server require the file param. return iNaturalistAPI.post("observation_sounds", params, options); } - return iNaturalistAPI.upload("observation_sounds", params, options); } }, { key: "update", value: function update(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { return iNaturalistAPI.put("observation_sounds/:id", params, options); } - options.method = "PUT"; return iNaturalistAPI.upload("observation_sounds/:id", params, options); } @@ -4101,10 +3283,8 @@ var observationSounds = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("observation_sounds/:id", params, options); } }]); - return observationSounds; }(); - module.exports = observationSounds; /***/ }), @@ -4112,34 +3292,21 @@ module.exports = observationSounds; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var ControlledTerm = __webpack_require__(25); - -var Observation = __webpack_require__(30); - +var ControlledTerm = __webpack_require__(28); +var Observation = __webpack_require__(20); var Project = __webpack_require__(39); - -var Taxon = __webpack_require__(20); - -var User = __webpack_require__(22); - +var Taxon = __webpack_require__(21); +var User = __webpack_require__(23); var observations = /*#__PURE__*/function () { function observations() { _classCallCheck(this, observations); } - _createClass(observations, null, [{ key: "create", value: function create(params, options) { @@ -4161,7 +3328,6 @@ var observations = /*#__PURE__*/function () { if (!iNaturalistAPI.apiURL || !iNaturalistAPI.apiURL.match(/\/v2/)) { return observations.vote(params, options); } - return iNaturalistAPI.post("observations/:id/fave", params, options); } }, { @@ -4170,7 +3336,6 @@ var observations = /*#__PURE__*/function () { if (!iNaturalistAPI.apiURL || !iNaturalistAPI.apiURL.match(/\/v2/)) { return observations.unvote(params, options); } - return iNaturalistAPI["delete"]("observations/:id/fave", params, options); } }, { @@ -4179,7 +3344,6 @@ var observations = /*#__PURE__*/function () { if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { throw new Error("API v2 does not support observations.vote. Use fave or setQualityMetric instead."); } - return iNaturalistAPI.post("votes/vote/observation/:id", params, options).then(Observation.typifyInstanceResponse); } }, { @@ -4188,7 +3352,6 @@ var observations = /*#__PURE__*/function () { if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { throw new Error("API v2 does not support observations.unvote. Use unfave or deleteQualityMetric instead."); } - return iNaturalistAPI["delete"]("votes/unvote/observation/:id", params, options); } }, { @@ -4197,14 +3360,12 @@ var observations = /*#__PURE__*/function () { if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { return iNaturalistAPI.put("observations/:id/subscription", params, options); } - return iNaturalistAPI.post("subscriptions/Observation/:id/subscribe", params, options); } }, { key: "review", value: function review(params, options) { var p = _objectSpread({}, params); - p.reviewed = "true"; return iNaturalistAPI.post("observations/:id/review", p, options); } @@ -4212,7 +3373,6 @@ var observations = /*#__PURE__*/function () { key: "unreview", value: function unreview(params, options) { var p = _objectSpread({}, params); - return iNaturalistAPI["delete"]("observations/:id/review", p, options); } }, { @@ -4256,7 +3416,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4272,7 +3431,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4290,7 +3448,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4308,7 +3465,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4326,7 +3482,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4338,13 +3493,11 @@ var observations = /*#__PURE__*/function () { if (response.results) { response.results = response.results.map(function (res) { var r = _objectSpread({}, res); - r.controlled_attribute = new ControlledTerm(r.controlled_attribute); r.controlled_value = new ControlledTerm(r.controlled_value); return r; }); } - return response; }); } @@ -4360,7 +3513,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4416,9 +3568,7 @@ var observations = /*#__PURE__*/function () { key: "similarSpecies", value: function similarSpecies(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts || {}); - options.useAuth = true; return iNaturalistAPI.get("observations/similar_species", params, options).then(function (response) { if (response.results) { @@ -4428,7 +3578,6 @@ var observations = /*#__PURE__*/function () { }); }); } - return response; }); } @@ -4446,10 +3595,8 @@ var observations = /*#__PURE__*/function () { return iNaturalistAPI.get("observations/deleted", params, iNaturalistAPI.optionsUseAuth(options)); } }]); - return observations; }(); - module.exports = observations; /***/ }), @@ -4457,44 +3604,26 @@ module.exports = observations; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Project = /*#__PURE__*/function (_Model) { _inherits(Project, _Model); - var _super = _createSuper(Project); - function Project() { _classCallCheck(this, Project); - return _super.apply(this, arguments); } - _createClass(Project, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { @@ -4506,10 +3635,8 @@ var Project = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(Project), "typifyInstanceResponse", this).call(this, response, Project); } }]); - return Project; }(Model); - module.exports = Project; /***/ }), @@ -4517,20 +3644,14 @@ module.exports = Project; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var Photo = __webpack_require__(21); - +var Photo = __webpack_require__(22); var photos = /*#__PURE__*/function () { function photos() { _classCallCheck(this, photos); } - _createClass(photos, null, [{ key: "create", value: function create(params, options) { @@ -4542,10 +3663,8 @@ var photos = /*#__PURE__*/function () { return iNaturalistAPI.put("photos/:id", params, options).then(Photo.typifyInstanceResponse); } }]); - return photos; }(); - module.exports = photos; /***/ }), @@ -4553,20 +3672,14 @@ module.exports = photos; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Place = __webpack_require__(42); - var places = /*#__PURE__*/function () { function places() { _classCallCheck(this, places); } - _createClass(places, null, [{ key: "fetch", value: function fetch(ids, params) { @@ -4577,22 +3690,18 @@ var places = /*#__PURE__*/function () { key: "autocomplete", value: function autocomplete(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { throw new Error("API v2 does not support places.autocomplete. Use places.search instead."); } - return iNaturalistAPI.get("places/autocomplete", params, opts).then(Place.typifyResultsResponse); } }, { key: "search", value: function search(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v1/)) { throw new Error("API v1 does not support places.search. Use places.autocomplete instead."); } - return iNaturalistAPI.get("places", params, opts).then(Place.typifyResultsResponse); } }, { @@ -4602,10 +3711,8 @@ var places = /*#__PURE__*/function () { return iNaturalistAPI.get("places/containing", params, opts).then(Place.typifyResultsResponse); } }]); - return places; }(); - module.exports = places; /***/ }), @@ -4613,54 +3720,34 @@ module.exports = places; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Place = /*#__PURE__*/function (_Model) { _inherits(Place, _Model); - var _super = _createSuper(Place); - function Place() { _classCallCheck(this, Place); - return _super.apply(this, arguments); } - _createClass(Place, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { return _get(_getPrototypeOf(Place), "typifyResultsResponse", this).call(this, response, Place); } }]); - return Place; }(Model); - module.exports = Place; /***/ }), @@ -4668,26 +3755,17 @@ module.exports = Place; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Post = __webpack_require__(44); - var posts = /*#__PURE__*/function () { function posts() { _classCallCheck(this, posts); } - _createClass(posts, null, [{ key: "search", value: function search(params, options) { @@ -4717,10 +3795,8 @@ var posts = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("posts/:id", params, options); } }]); - return posts; }(); - module.exports = posts; /***/ }), @@ -4728,44 +3804,26 @@ module.exports = posts; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Post = /*#__PURE__*/function (_Model) { _inherits(Post, _Model); - var _super = _createSuper(Post); - function Post() { _classCallCheck(this, Post); - return _super.apply(this, arguments); } - _createClass(Post, null, [{ key: "typifyArrayResponse", value: function typifyArrayResponse(response) { @@ -4777,10 +3835,8 @@ var Post = /*#__PURE__*/function (_Model) { return _get(_getPrototypeOf(Post), "typifyInstanceResponse", this).call(this, response, Post); } }]); - return Post; }(Model); - module.exports = Post; /***/ }), @@ -4788,26 +3844,17 @@ module.exports = Post; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Project = __webpack_require__(39); - var projects = /*#__PURE__*/function () { function projects() { _classCallCheck(this, projects); } - _createClass(projects, null, [{ key: "fetch", value: function fetch(ids, params) { @@ -4844,22 +3891,18 @@ var projects = /*#__PURE__*/function () { key: "join", value: function join(params, options) { var endpoint = "projects/:id/join"; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { endpoint = "projects/:id/membership"; } - return iNaturalistAPI.post(endpoint, params, options); } }, { key: "leave", value: function leave(params, options) { var endpoint = "projects/:id/leave"; - if (iNaturalistAPI.apiURL && iNaturalistAPI.apiURL.match(/\/v2/)) { endpoint = "projects/:id/membership"; } - return iNaturalistAPI["delete"](endpoint, params, options); } }, { @@ -4913,10 +3956,8 @@ var projects = /*#__PURE__*/function () { return iNaturalistAPI.put("projects/:id/unfeature", params, options); } }]); - return projects; }(); - module.exports = projects; /***/ }), @@ -4924,20 +3965,14 @@ module.exports = projects; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var ProjectObservation = __webpack_require__(47); - var projectObservations = /*#__PURE__*/function () { function projectObservations() { _classCallCheck(this, projectObservations); } - _createClass(projectObservations, null, [{ key: "create", value: function create(params, options) { @@ -4954,10 +3989,8 @@ var projectObservations = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("project_observations/:id", params, options); } }]); - return projectObservations; }(); - module.exports = projectObservations; /***/ }), @@ -4965,54 +3998,34 @@ module.exports = projectObservations; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ProjectObservation = /*#__PURE__*/function (_Model) { _inherits(ProjectObservation, _Model); - var _super = _createSuper(ProjectObservation); - function ProjectObservation() { _classCallCheck(this, ProjectObservation); - return _super.apply(this, arguments); } - _createClass(ProjectObservation, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(ProjectObservation), "typifyInstanceResponse", this).call(this, response, ProjectObservation); } }]); - return ProjectObservation; }(Model); - module.exports = ProjectObservation; /***/ }), @@ -5020,30 +4033,22 @@ module.exports = ProjectObservation; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var ProjectUser = __webpack_require__(49); - var projectUsers = /*#__PURE__*/function () { function projectUsers() { _classCallCheck(this, projectUsers); } - _createClass(projectUsers, null, [{ key: "update", value: function update(params, options) { return iNaturalistAPI.put("project_users/:id", params, options).then(ProjectUser.typifyInstanceResponse); } }]); - return projectUsers; }(); - module.exports = projectUsers; /***/ }), @@ -5051,54 +4056,34 @@ module.exports = projectUsers; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ProjectUser = /*#__PURE__*/function (_Model) { _inherits(ProjectUser, _Model); - var _super = _createSuper(ProjectUser); - function ProjectUser() { _classCallCheck(this, ProjectUser); - return _super.apply(this, arguments); } - _createClass(ProjectUser, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(ProjectUser), "typifyInstanceResponse", this).call(this, response, ProjectUser); } }]); - return ProjectUser; }(Model); - module.exports = ProjectUser; /***/ }), @@ -5106,26 +4091,17 @@ module.exports = ProjectUser; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var ProviderAuthorization = __webpack_require__(51); - var ProviderAuthorizations = /*#__PURE__*/function () { function ProviderAuthorizations() { _classCallCheck(this, ProviderAuthorizations); } - _createClass(ProviderAuthorizations, null, [{ key: "search", value: function search(params) { @@ -5138,18 +4114,14 @@ var ProviderAuthorizations = /*#__PURE__*/function () { key: "delete", value: function _delete(params, options) { var endpoint = "provider_authorizations/:id"; - if (iNaturalistAPI.writeApiURL && iNaturalistAPI.writeApiURL.match(/\/v\d/)) { endpoint = "provider_authorizations/:id"; } - return iNaturalistAPI["delete"](endpoint, params, options); } }]); - return ProviderAuthorizations; }(); - module.exports = ProviderAuthorizations; /***/ }), @@ -5157,54 +4129,34 @@ module.exports = ProviderAuthorizations; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var ProviderAuthorization = /*#__PURE__*/function (_Model) { _inherits(ProviderAuthorization, _Model); - var _super = _createSuper(ProviderAuthorization); - function ProviderAuthorization() { _classCallCheck(this, ProviderAuthorization); - return _super.apply(this, arguments); } - _createClass(ProviderAuthorization, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { return _get(_getPrototypeOf(ProviderAuthorization), "typifyResultsResponse", this).call(this, response, ProviderAuthorization); } }]); - return ProviderAuthorization; }(Model); - module.exports = ProviderAuthorization; /***/ }), @@ -5212,26 +4164,17 @@ module.exports = ProviderAuthorization; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Relationship = __webpack_require__(53); - var relationships = /*#__PURE__*/function () { function relationships() { _classCallCheck(this, relationships); } - _createClass(relationships, null, [{ key: "create", value: function create(params, options) { @@ -5241,16 +4184,13 @@ var relationships = /*#__PURE__*/function () { key: "search", value: function search(params, options) { var useWriteApi = false; - if (iNaturalistAPI.writeApiURL && iNaturalistAPI.writeApiURL.match(/\/v\d/)) { useWriteApi = true; } - var opts = _objectSpread(_objectSpread({}, options), {}, { useWriteApi: useWriteApi, useAuth: true }); - return iNaturalistAPI.get("relationships", params, opts).then(Relationship.typifyResultsResponse); } }, { @@ -5264,10 +4204,8 @@ var relationships = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("relationships/:id", params, options); } }]); - return relationships; }(); - module.exports = relationships; /***/ }), @@ -5275,51 +4213,31 @@ module.exports = relationships; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - -var User = __webpack_require__(22); - +var User = __webpack_require__(23); var Relationship = /*#__PURE__*/function (_Model) { _inherits(Relationship, _Model); - var _super = _createSuper(Relationship); - function Relationship() { _classCallCheck(this, Relationship); - return _super.apply(this, arguments); } - _createClass(Relationship, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { var r = _get(_getPrototypeOf(Relationship), "typifyInstanceResponse", this).call(this, response, Relationship); - r.friendUser = User.typifyInstanceResponse(r.friend_user, User); delete r.friend_user; return r; @@ -5332,14 +4250,11 @@ var Relationship = /*#__PURE__*/function (_Model) { return Relationship.typifyInstanceResponse(r); }); } - return response; } }]); - return Relationship; }(Model); - module.exports = Relationship; /***/ }), @@ -5347,26 +4262,17 @@ module.exports = Relationship; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Place = __webpack_require__(42); - var Project = __webpack_require__(39); - -var Taxon = __webpack_require__(20); - -var User = __webpack_require__(22); - +var Taxon = __webpack_require__(21); +var User = __webpack_require__(23); var search = /*#__PURE__*/function () { function search() { _classCallCheck(this, search); } - _createClass(search, null, [{ key: "index", value: function index() { @@ -5376,7 +4282,6 @@ var search = /*#__PURE__*/function () { if (response.results) { response.results.forEach(function (result, index) { var instanceAttribute; - if (result.type === "Place") { instanceAttribute = "record" in result ? "record" : "place"; response.results[index][instanceAttribute] = new Place(result[instanceAttribute]); @@ -5392,15 +4297,12 @@ var search = /*#__PURE__*/function () { } }); } - return response; }); } }]); - return search; }(); - module.exports = search.index; /***/ }), @@ -5408,20 +4310,14 @@ module.exports = search.index; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Site = __webpack_require__(56); - var sites = /*#__PURE__*/function () { function sites() { _classCallCheck(this, sites); } - _createClass(sites, null, [{ key: "search", value: function search(params) { @@ -5432,18 +4328,14 @@ var sites = /*#__PURE__*/function () { key: "fetch", value: function fetch(ids, params) { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (!ids || ids.length === 0) { return iNaturalistAPI.get("sites", params, opts).then(Site.typifyResultsResponse); } - return iNaturalistAPI.fetch("sites", ids, params, opts).then(Site.typifyResultsResponse); } }]); - return sites; }(); - module.exports = sites; /***/ }), @@ -5451,54 +4343,34 @@ module.exports = sites; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var Site = /*#__PURE__*/function (_Model) { _inherits(Site, _Model); - var _super = _createSuper(Site); - function Site() { _classCallCheck(this, Site); - return _super.apply(this, arguments); } - _createClass(Site, null, [{ key: "typifyResultsResponse", value: function typifyResultsResponse(response) { return _get(_getPrototypeOf(Site), "typifyResultsResponse", this).call(this, response, Site); } }]); - return Site; }(Model); - module.exports = Site; /***/ }), @@ -5506,28 +4378,21 @@ module.exports = Site; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var sounds = /*#__PURE__*/function () { function sounds() { _classCallCheck(this, sounds); } - _createClass(sounds, null, [{ key: "create", value: function create(params, options) { return iNaturalistAPI.upload("sounds", params, options); } }]); - return sounds; }(); - module.exports = sounds; /***/ }), @@ -5535,26 +4400,17 @@ module.exports = sounds; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - -var Taxon = __webpack_require__(20); - +var Taxon = __webpack_require__(21); var taxa = /*#__PURE__*/function () { function taxa() { _classCallCheck(this, taxa); } - _createClass(taxa, null, [{ key: "fetch", value: function fetch(ids, params) { @@ -5579,6 +4435,14 @@ var taxa = /*#__PURE__*/function () { useAuth: true })).then(Taxon.typifyResultsResponse); } + }, { + key: "iconic", + value: function iconic(params) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return iNaturalistAPI.get("taxa/iconic", params, _objectSpread(_objectSpread({}, opts), {}, { + useAuth: true + })).then(Taxon.typifyResultsResponse); + } }, { key: "suggest", value: function suggest(params) { @@ -5614,10 +4478,8 @@ var taxa = /*#__PURE__*/function () { }); } }]); - return taxa; }(); - module.exports = taxa; /***/ }), @@ -5625,20 +4487,14 @@ module.exports = taxa; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var TaxonNamePriority = __webpack_require__(60); - var taxonNamePriorities = /*#__PURE__*/function () { function taxonNamePriorities() { _classCallCheck(this, taxonNamePriorities); } - _createClass(taxonNamePriorities, null, [{ key: "create", value: function create(params, options) { @@ -5655,10 +4511,8 @@ var taxonNamePriorities = /*#__PURE__*/function () { return iNaturalistAPI["delete"]("taxon_name_priorities/:id", params, options); } }]); - return taxonNamePriorities; }(); - module.exports = taxonNamePriorities; /***/ }), @@ -5666,54 +4520,34 @@ module.exports = taxonNamePriorities; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } - function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var Model = __webpack_require__(10); - var TaxonNamePriority = /*#__PURE__*/function (_Model) { _inherits(TaxonNamePriority, _Model); - var _super = _createSuper(TaxonNamePriority); - function TaxonNamePriority() { _classCallCheck(this, TaxonNamePriority); - return _super.apply(this, arguments); } - _createClass(TaxonNamePriority, null, [{ key: "typifyInstanceResponse", value: function typifyInstanceResponse(response) { return _get(_getPrototypeOf(TaxonNamePriority), "typifyInstanceResponse", this).call(this, response, TaxonNamePriority); } }]); - return TaxonNamePriority; }(Model); - module.exports = TaxonNamePriority; /***/ }), @@ -5721,18 +4555,13 @@ module.exports = TaxonNamePriority; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var translations = /*#__PURE__*/function () { function translations() { _classCallCheck(this, translations); } - _createClass(translations, null, [{ key: "locales", value: function locales() { @@ -5741,10 +4570,8 @@ var translations = /*#__PURE__*/function () { return iNaturalistAPI.get("translations/locales", params, options); } }]); - return translations; }(); - module.exports = translations; /***/ }), @@ -5752,28 +4579,18 @@ module.exports = translations; /***/ (function(module, __unused_webpack_exports, __webpack_require__) { function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - var iNaturalistAPI = __webpack_require__(1); - var Project = __webpack_require__(39); - -var User = __webpack_require__(22); - +var User = __webpack_require__(23); var users = /*#__PURE__*/function () { function users() { _classCallCheck(this, users); } - _createClass(users, null, [{ key: "fetch", value: function fetch(ids) { @@ -5798,16 +4615,12 @@ var users = /*#__PURE__*/function () { key: "me", value: function me() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var options = _objectSpread({}, opts); - var params = {}; - if (options.fields) { params.fields = options.fields; delete options.fields; } - options.useAuth = true; return iNaturalistAPI.get("users/me", params, options).then(User.typifyResultsResponse); } @@ -5815,9 +4628,7 @@ var users = /*#__PURE__*/function () { key: "mute", value: function mute(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.post("users/:id/mute", params, options); } @@ -5825,9 +4636,7 @@ var users = /*#__PURE__*/function () { key: "unmute", value: function unmute(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI["delete"]("users/:id/mute", params, options); } @@ -5835,9 +4644,7 @@ var users = /*#__PURE__*/function () { key: "block", value: function block(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.post("users/:id/block", params, options); } @@ -5845,9 +4652,7 @@ var users = /*#__PURE__*/function () { key: "unblock", value: function unblock(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI["delete"]("users/:id/block", params, options); } @@ -5855,9 +4660,7 @@ var users = /*#__PURE__*/function () { key: "projects", value: function projects(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.get("users/:id/projects", params, options).then(Project.typifyResultsResponse); } @@ -5865,9 +4668,7 @@ var users = /*#__PURE__*/function () { key: "resendConfirmation", value: function resendConfirmation(params) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = _objectSpread({}, opts); - options.useAuth = true; return iNaturalistAPI.post("users/resend_confirmation", params, options); } @@ -5888,10 +4689,8 @@ var users = /*#__PURE__*/function () { })); } }]); - return users; }(); - module.exports = users; /***/ }), @@ -5899,17 +4698,12 @@ module.exports = users; /***/ (function(module) { function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var FileUpload = /*#__PURE__*/_createClass(function FileUpload(attrs) { _classCallCheck(this, FileUpload); - Object.assign(this, attrs); }); - module.exports = FileUpload; /***/ }) diff --git a/lib/endpoints/computervision.js b/lib/endpoints/computervision.js index 6abab09..74dcddb 100644 --- a/lib/endpoints/computervision.js +++ b/lib/endpoints/computervision.js @@ -1,4 +1,5 @@ const iNaturalistAPI = require( "../inaturalist_api" ); +const Observation = require( "../models/observation" ); const Taxon = require( "../models/taxon" ); const computervision = class computervision { @@ -32,6 +33,18 @@ const computervision = class computervision { return response; } ); } + + static language_search( params, opts = { } ) { // eslint-disable-line camelcase + const options = { ...opts }; + options.useAuth = true; + return iNaturalistAPI.get( "computervision/language_search", params, options ) + .then( response => { + response.results = response.results.map( r => ( + { ...r, observation: new Observation( r.observation ) } + ) ); + return response; + } ); + } }; module.exports = computervision; diff --git a/lib/endpoints/taxa.js b/lib/endpoints/taxa.js index b85b731..f191f21 100644 --- a/lib/endpoints/taxa.js +++ b/lib/endpoints/taxa.js @@ -17,6 +17,11 @@ const taxa = class taxa { .then( Taxon.typifyResultsResponse ); } + static iconic( params, opts = { } ) { + return iNaturalistAPI.get( "taxa/iconic", params, { ...opts, useAuth: true } ) + .then( Taxon.typifyResultsResponse ); + } + static suggest( params, opts = { } ) { return iNaturalistAPI.get( "taxa/suggest", params, { ...opts, useAuth: true } ).then( response => { response.results = response.results.map( r => ( From d9590dea2b8f24930dde6711d009beefd37d5886 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:01:26 +0000 Subject: [PATCH 2/3] Bump braces from 3.0.2 to 3.0.3 Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 156 +++++++++++++++++++++++----------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08d6493..d33de67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2548,6 +2548,18 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -3724,6 +3736,18 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", @@ -4298,6 +4322,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-number-object": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", @@ -4994,18 +5027,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/mocha/node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/mocha/node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -5074,18 +5095,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mocha/node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/mocha/node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -5149,15 +5158,6 @@ "node": ">=8" } }, - "node_modules/mocha/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/mocha/node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -5257,18 +5257,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/mocha/node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/mocha/node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -6858,6 +6846,18 @@ "node": ">=4" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -9397,6 +9397,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -10288,6 +10297,15 @@ "flat-cache": "^3.0.4" } }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", @@ -10685,6 +10703,12 @@ "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-number-object": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", @@ -11201,15 +11225,6 @@ "balanced-match": "^1.0.0" } }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -11258,15 +11273,6 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, "find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -11308,12 +11314,6 @@ "binary-extensions": "^2.0.0" } }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -11380,15 +11380,6 @@ "has-flag": "^4.0.0" } }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -12588,6 +12579,15 @@ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", From e4e410f35f36c83a0fa1506c87b714b8b7ac0912 Mon Sep 17 00:00:00 2001 From: Patrick Leary Date: Tue, 25 Jun 2024 11:05:54 -0400 Subject: [PATCH 3/3] universal search endpoint passes on authentication headers --- build/inaturalistjs.js | 7 ++++++- lib/endpoints/search.js | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build/inaturalistjs.js b/build/inaturalistjs.js index f9970fd..47fda8d 100644 --- a/build/inaturalistjs.js +++ b/build/inaturalistjs.js @@ -4261,6 +4261,9 @@ module.exports = Relationship; /* 54 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } @@ -4278,7 +4281,9 @@ var search = /*#__PURE__*/function () { value: function index() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return iNaturalistAPI.get("search", params, options).then(function (response) { + return iNaturalistAPI.get("search", params, _objectSpread(_objectSpread({}, options), {}, { + useAuth: true + })).then(function (response) { if (response.results) { response.results.forEach(function (result, index) { var instanceAttribute; diff --git a/lib/endpoints/search.js b/lib/endpoints/search.js index 2a84213..afb7794 100644 --- a/lib/endpoints/search.js +++ b/lib/endpoints/search.js @@ -6,7 +6,7 @@ const User = require( "../models/user" ); const search = class search { static index( params = { }, options = { } ) { - return iNaturalistAPI.get( "search", params, options ).then( response => { + return iNaturalistAPI.get( "search", params, { ...options, useAuth: true } ).then( response => { if ( response.results ) { response.results.forEach( ( result, index ) => { let instanceAttribute; diff --git a/package.json b/package.json index faf05c5..2ef4366 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "inaturalistjs", - "version": "2.11.0", + "version": "2.12.0", "description": "inaturalistjs", "author": "iNaturalist", "license": "MIT",