@factset/sdk-analyticsdatastore
Advanced tools
Comparing version 0.21.1 to 0.21.2
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
var _ApiClient = _interopRequireDefault(require("../ApiClient")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -41,2 +38,3 @@ * Analytics Datastore API | ||
} | ||
/** | ||
@@ -49,16 +47,12 @@ * Get Cargo endpoint, gets an object given an ID. In this case ID retrieved from Swivel Location header, results in json response body of the report. | ||
*/ | ||
getCargoEndpointWithHttpInfo(groupId, objectId) { | ||
let postBody = null; // verify the required parameter 'groupId' is set | ||
let postBody = null; | ||
// verify the required parameter 'groupId' is set | ||
if (groupId === undefined || groupId === null) { | ||
throw new Error("Missing the required parameter 'groupId' when calling getCargoEndpoint"); | ||
} // verify the required parameter 'objectId' is set | ||
} | ||
// verify the required parameter 'objectId' is set | ||
if (objectId === undefined || objectId === null) { | ||
throw new Error("Missing the required parameter 'objectId' when calling getCargoEndpoint"); | ||
} | ||
let pathParams = { | ||
@@ -77,2 +71,3 @@ 'groupId': groupId, | ||
} | ||
/** | ||
@@ -85,4 +80,2 @@ * Get Cargo endpoint, gets an object given an ID. In this case ID retrieved from Swivel Location header, results in json response body of the report. | ||
*/ | ||
getCargoEndpoint(groupId, objectId) { | ||
@@ -93,5 +86,3 @@ return this.getCargoEndpointWithHttpInfo(groupId, objectId).then(function (response_and_data) { | ||
} | ||
} | ||
exports.default = CargoApi; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
var _ApiClient = _interopRequireDefault(require("../ApiClient")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -41,2 +38,3 @@ * Analytics Datastore API | ||
} | ||
/** | ||
@@ -52,31 +50,24 @@ * Get Swivel endpoint, takes report parameter inputs and returns the Cargo location for the specified report via a 302 redirect. | ||
*/ | ||
getSwivelEndpointWithHttpInfo(pubDoc, assetName, reportId, tileId, accountId) { | ||
let postBody = null; // verify the required parameter 'pubDoc' is set | ||
let postBody = null; | ||
// verify the required parameter 'pubDoc' is set | ||
if (pubDoc === undefined || pubDoc === null) { | ||
throw new Error("Missing the required parameter 'pubDoc' when calling getSwivelEndpoint"); | ||
} // verify the required parameter 'assetName' is set | ||
} | ||
// verify the required parameter 'assetName' is set | ||
if (assetName === undefined || assetName === null) { | ||
throw new Error("Missing the required parameter 'assetName' when calling getSwivelEndpoint"); | ||
} // verify the required parameter 'reportId' is set | ||
} | ||
// verify the required parameter 'reportId' is set | ||
if (reportId === undefined || reportId === null) { | ||
throw new Error("Missing the required parameter 'reportId' when calling getSwivelEndpoint"); | ||
} // verify the required parameter 'tileId' is set | ||
} | ||
// verify the required parameter 'tileId' is set | ||
if (tileId === undefined || tileId === null) { | ||
throw new Error("Missing the required parameter 'tileId' when calling getSwivelEndpoint"); | ||
} // verify the required parameter 'accountId' is set | ||
} | ||
// verify the required parameter 'accountId' is set | ||
if (accountId === undefined || accountId === null) { | ||
throw new Error("Missing the required parameter 'accountId' when calling getSwivelEndpoint"); | ||
} | ||
let pathParams = { | ||
@@ -98,2 +89,3 @@ 'pubDoc': pubDoc, | ||
} | ||
/** | ||
@@ -109,4 +101,2 @@ * Get Swivel endpoint, takes report parameter inputs and returns the Cargo location for the specified report via a 302 redirect. | ||
*/ | ||
getSwivelEndpoint(pubDoc, assetName, reportId, tileId, accountId) { | ||
@@ -117,5 +107,3 @@ return this.getSwivelEndpointWithHttpInfo(pubDoc, assetName, reportId, tileId, accountId).then(function (response_and_data) { | ||
} | ||
} | ||
exports.default = SwivelApi; |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _superagent = _interopRequireDefault(require("superagent")); | ||
var _querystring = _interopRequireDefault(require("querystring")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -31,3 +27,2 @@ * Analytics Datastore API | ||
*/ | ||
/** | ||
@@ -53,2 +48,3 @@ * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an | ||
this.basePath = basePath.replace(/\/+$/, ''); | ||
/** | ||
@@ -58,3 +54,2 @@ * The authentication methods to be included for all API calls. | ||
*/ | ||
this.authentications = { | ||
@@ -68,2 +63,3 @@ 'FactSetApiKey': { | ||
}; | ||
/** | ||
@@ -74,4 +70,4 @@ * FactSet OAuth2 Client | ||
*/ | ||
this.factsetOauth2Client = undefined; | ||
this.factsetOauth2Client = undefined; | ||
/** | ||
@@ -82,6 +78,6 @@ * The default HTTP headers to be included for all API calls. | ||
*/ | ||
this.defaultHeaders = { | ||
'User-Agent': 'fds-sdk/javascript/AnalyticsDatastore/0.21.1' | ||
'User-Agent': 'fds-sdk/javascript/AnalyticsDatastore/0.21.2' | ||
}; | ||
/** | ||
@@ -92,4 +88,4 @@ * The default HTTP timeout for all API calls. | ||
*/ | ||
this.timeout = 60000; | ||
this.timeout = 60000; | ||
/** | ||
@@ -101,4 +97,4 @@ * If set to false an additional timestamp parameter is added to all API GET calls to | ||
*/ | ||
this.cache = true; | ||
this.cache = true; | ||
/** | ||
@@ -109,4 +105,4 @@ * If set to true, the client will save the cookies from each server | ||
*/ | ||
this.enableCookies = false; | ||
this.enableCookies = false; | ||
/* | ||
@@ -116,18 +112,17 @@ * Used to save and return cookies in a node.js (non-browser) setting, | ||
*/ | ||
if (typeof window === 'undefined') { | ||
this.agent = new _superagent.default.agent(); | ||
} | ||
/* | ||
* Allow user to override superagent agent | ||
*/ | ||
this.requestAgent = null; | ||
this.requestAgent = null; | ||
/* | ||
* Allow user to add superagent plugins | ||
*/ | ||
this.plugins = null; | ||
} | ||
/** | ||
@@ -138,4 +133,2 @@ * Returns a string representation for an actual parameter. | ||
*/ | ||
paramToString(param) { | ||
@@ -145,13 +138,11 @@ if (param == undefined || param == null) { | ||
} | ||
if (param instanceof Date) { | ||
return param.toJSON(); | ||
} | ||
if (ApiClient.canBeJsonified(param)) { | ||
return JSON.stringify(param); | ||
} | ||
return param.toString(); | ||
} | ||
/** | ||
@@ -162,7 +153,4 @@ * Returns a boolean indicating if the parameter could be JSON.stringified | ||
*/ | ||
static canBeJsonified(str) { | ||
if (typeof str !== 'string' && typeof str !== 'object') return false; | ||
try { | ||
@@ -175,3 +163,2 @@ const type = str.toString(); | ||
} | ||
/** | ||
@@ -189,12 +176,10 @@ * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. | ||
} | ||
var url = this.basePath + path; | ||
var url = this.basePath + path; // use API (operation, path) base path if defined | ||
// use API (operation, path) base path if defined | ||
if (apiBasePath !== null && apiBasePath !== undefined) { | ||
url = apiBasePath + path; | ||
} | ||
url = url.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => { | ||
var value; | ||
if (pathParams.hasOwnProperty(key)) { | ||
@@ -205,3 +190,2 @@ value = this.paramToString(pathParams[key]); | ||
} | ||
return encodeURIComponent(value); | ||
@@ -211,2 +195,3 @@ }); | ||
} | ||
/** | ||
@@ -223,7 +208,6 @@ * Checks whether the given content type represents JSON.<br> | ||
*/ | ||
isJsonMime(contentType) { | ||
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); | ||
} | ||
/** | ||
@@ -234,4 +218,2 @@ * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. | ||
*/ | ||
jsonPreferredMime(contentTypes) { | ||
@@ -243,5 +225,5 @@ for (var i = 0; i < contentTypes.length; i++) { | ||
} | ||
return contentTypes[0]; | ||
} | ||
/** | ||
@@ -252,4 +234,2 @@ * Checks whether the given parameter value represents file-like content. | ||
*/ | ||
isFileParam(param) { | ||
@@ -259,29 +239,27 @@ // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) | ||
let fs; | ||
try { | ||
fs = require('fs'); | ||
} catch (err) {} | ||
if (fs && fs.ReadStream && param instanceof fs.ReadStream) { | ||
return true; | ||
} | ||
} // Buffer in Node.js | ||
} | ||
// Buffer in Node.js | ||
if (typeof Buffer === 'function' && param instanceof Buffer) { | ||
return true; | ||
} // Blob in browser | ||
} | ||
// Blob in browser | ||
if (typeof Blob === 'function' && param instanceof Blob) { | ||
return true; | ||
} // File in browser (it seems File object is also instance of Blob, but keep this for safe) | ||
} | ||
// File in browser (it seems File object is also instance of Blob, but keep this for safe) | ||
if (typeof File === 'function' && param instanceof File) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
@@ -297,11 +275,7 @@ * Normalizes parameter values: | ||
*/ | ||
normalizeParams(params) { | ||
var newParams = {}; | ||
for (var key in params) { | ||
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { | ||
var value = params[key]; | ||
if (this.isFileParam(value) || Array.isArray(value)) { | ||
@@ -314,5 +288,5 @@ newParams[key] = value; | ||
} | ||
return newParams; | ||
} | ||
/** | ||
@@ -325,4 +299,2 @@ * Builds a string representation of an array-type actual parameter, according to the given collection format. | ||
*/ | ||
buildCollectionParam(param, collectionFormat) { | ||
@@ -332,23 +304,16 @@ if (param == null) { | ||
} | ||
switch (collectionFormat) { | ||
case 'csv': | ||
return param.map(this.paramToString, this).join(','); | ||
case 'ssv': | ||
return param.map(this.paramToString, this).join(' '); | ||
case 'tsv': | ||
return param.map(this.paramToString, this).join('\t'); | ||
case 'pipes': | ||
return param.map(this.paramToString, this).join('|'); | ||
case 'multi': | ||
//return the array directly as SuperAgent will handle it as expected | ||
return param.map(this.paramToString, this); | ||
case 'passthrough': | ||
return param; | ||
default: | ||
@@ -358,2 +323,3 @@ throw new Error('Unknown collection format: ' + collectionFormat); | ||
} | ||
/** | ||
@@ -364,8 +330,5 @@ * Applies authentication headers to the request. | ||
*/ | ||
async applyAuthToRequest(request, authNames) { | ||
for (const authName of authNames) { | ||
var auth = this.authentications[authName]; | ||
switch (auth.type) { | ||
@@ -376,5 +339,3 @@ case 'basic': | ||
} | ||
break; | ||
case 'bearer': | ||
@@ -387,9 +348,6 @@ if (auth.accessToken) { | ||
} | ||
break; | ||
case 'apiKey': | ||
if (auth.apiKey) { | ||
var data = {}; | ||
if (auth.apiKeyPrefix) { | ||
@@ -400,3 +358,2 @@ data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; | ||
} | ||
if (auth['in'] === 'header') { | ||
@@ -408,5 +365,3 @@ request.set(data); | ||
} | ||
break; | ||
case 'oauth2': | ||
@@ -423,5 +378,3 @@ if (this.factsetOauth2Client !== undefined) { | ||
} | ||
break; | ||
default: | ||
@@ -432,2 +385,3 @@ throw new Error('Unknown authentication type: ' + auth.type); | ||
} | ||
/** | ||
@@ -442,13 +396,10 @@ * Deserializes an HTTP response body into a value of the specified type. | ||
*/ | ||
deserialize(response, returnType) { | ||
if (response == null || returnType == null || response.status == 204) { | ||
return null; | ||
} // Rely on SuperAgent for parsing response body. | ||
} | ||
// Rely on SuperAgent for parsing response body. | ||
// See http://visionmedia.github.io/superagent/#parsing-response-bodies | ||
var data = response.body; | ||
if (data == null || typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) { | ||
@@ -458,15 +409,12 @@ // SuperAgent does not always produce a body; use the unparsed response as a fallback | ||
} | ||
if (typeof returnType._createResponseWrapper === "function") { | ||
let deserialized = null; | ||
if (returnType[response.status]) { | ||
deserialized = ApiClient.convertToType(data, returnType[response.status]); | ||
} | ||
return returnType._createResponseWrapper(response.status, deserialized); | ||
} | ||
return ApiClient.convertToType(data, returnType); | ||
} | ||
/** | ||
@@ -489,8 +437,5 @@ * Invokes the REST service using the supplied settings and parameters. | ||
*/ | ||
async callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, apiBasePath) { | ||
var url = this.buildUrl(path, pathParams, apiBasePath); | ||
var request = (0, _superagent.default)(httpMethod, url); | ||
if (this.plugins !== null) { | ||
@@ -502,23 +447,24 @@ for (var index in this.plugins) { | ||
} | ||
} // apply authentications | ||
} | ||
// apply authentications | ||
await this.applyAuthToRequest(request, authNames); | ||
await this.applyAuthToRequest(request, authNames); // set query parameters | ||
// set query parameters | ||
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { | ||
queryParams['_'] = new Date().getTime(); | ||
} | ||
request.query(this.normalizeParams(queryParams)); | ||
request.query(this.normalizeParams(queryParams)); // set header parameters | ||
// set header parameters | ||
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); | ||
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); // set requestAgent if it is set by user | ||
// set requestAgent if it is set by user | ||
if (this.requestAgent) { | ||
request.agent(this.requestAgent); | ||
} // set request timeout | ||
} | ||
// set request timeout | ||
request.timeout(this.timeout); | ||
var contentType = this.jsonPreferredMime(contentTypes); | ||
if (contentType) { | ||
@@ -530,3 +476,2 @@ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) | ||
} | ||
if (contentType === 'application/x-www-form-urlencoded') { | ||
@@ -536,7 +481,5 @@ request.send(_querystring.default.stringify(this.normalizeParams(formParams))); | ||
var _formParams = this.normalizeParams(formParams); | ||
for (var key in _formParams) { | ||
if (_formParams.hasOwnProperty(key)) { | ||
let _formParamsValue = _formParams[key]; | ||
if (this.isFileParam(_formParamsValue)) { | ||
@@ -557,12 +500,8 @@ // file field | ||
} | ||
request.send(bodyParam); | ||
} | ||
var accept = this.jsonPreferredMime(accepts); | ||
if (accept) { | ||
request.accept(accept); | ||
} | ||
if (returnType === 'Blob') { | ||
@@ -572,5 +511,5 @@ request.responseType('blob'); | ||
request.responseType('string'); | ||
} // Attach previously saved cookies, if enabled | ||
} | ||
// Attach previously saved cookies, if enabled | ||
if (this.enableCookies) { | ||
@@ -583,3 +522,2 @@ if (typeof window === 'undefined') { | ||
} | ||
return new Promise((resolve, reject) => { | ||
@@ -589,3 +527,2 @@ request.end((error, response) => { | ||
var err = {}; | ||
if (response) { | ||
@@ -597,3 +534,2 @@ err.status = response.status; | ||
} | ||
err.error = error; | ||
@@ -604,7 +540,5 @@ reject(err); | ||
var data = this.deserialize(response, returnType); | ||
if (this.enableCookies && typeof window === 'undefined') { | ||
this.agent._saveCookies(response); | ||
} | ||
resolve({ | ||
@@ -621,2 +555,3 @@ data, | ||
} | ||
/** | ||
@@ -627,4 +562,2 @@ * Parses an ISO-8601 string representation or epoch representation of a date value. | ||
*/ | ||
static parseDate(str) { | ||
@@ -634,5 +567,5 @@ if (isNaN(str)) { | ||
} | ||
return new Date(+str); | ||
} | ||
/** | ||
@@ -647,26 +580,17 @@ * Converts a value to the specified type. | ||
*/ | ||
static convertToType(data, type) { | ||
if (data === null || data === undefined) return data; | ||
switch (type) { | ||
case 'Boolean': | ||
return Boolean(data); | ||
case 'Integer': | ||
return parseInt(data, 10); | ||
case 'Number': | ||
return parseFloat(data); | ||
case 'String': | ||
return String(data); | ||
case 'Date': | ||
return ApiClient.parseDate(String(data)); | ||
case 'Blob': | ||
return data; | ||
default: | ||
@@ -688,3 +612,2 @@ if (type === Object) { | ||
var keyType, valueType; | ||
for (var k in type) { | ||
@@ -697,5 +620,3 @@ if (type.hasOwnProperty(k)) { | ||
} | ||
var result = {}; | ||
for (var k in data) { | ||
@@ -708,3 +629,2 @@ if (data.hasOwnProperty(k)) { | ||
} | ||
return result; | ||
@@ -715,5 +635,5 @@ } else { | ||
} | ||
} | ||
} | ||
/** | ||
@@ -723,4 +643,2 @@ * Gets an array of host settings | ||
*/ | ||
hostSettings() { | ||
@@ -732,17 +650,16 @@ return [{ | ||
} | ||
getBasePathFromSettings(index, variables = {}) { | ||
var servers = this.hostSettings(); // check array index out of bound | ||
var servers = this.hostSettings(); | ||
// check array index out of bound | ||
if (index < 0 || index >= servers.length) { | ||
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length); | ||
} | ||
var server = servers[index]; | ||
var url = server['url']; // go through variable and assign a value | ||
var url = server['url']; | ||
// go through variable and assign a value | ||
for (var variable_name in server['variables']) { | ||
if (variable_name in variables) { | ||
let variable = server['variables'][variable_name]; | ||
if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) { | ||
@@ -758,5 +675,5 @@ url = url.replace("{" + variable_name + "}", variables[variable_name]); | ||
} | ||
return url; | ||
} | ||
/** | ||
@@ -767,4 +684,2 @@ * Constructs a new map or array model from REST data. | ||
*/ | ||
static constructFromObject(data, obj, itemType) { | ||
@@ -781,3 +696,2 @@ if (Array.isArray(data)) { | ||
} | ||
static setValue(obj, value) { | ||
@@ -787,4 +701,4 @@ obj.value = value; | ||
} | ||
} | ||
} | ||
/** | ||
@@ -795,4 +709,2 @@ * Enumeration of collection format separator strategies. | ||
*/ | ||
ApiClient.CollectionFormatEnum = { | ||
@@ -804,3 +716,2 @@ /** | ||
CSV: ',', | ||
/** | ||
@@ -811,3 +722,2 @@ * Space-separated values. Value: <code>ssv</code> | ||
SSV: ' ', | ||
/** | ||
@@ -818,3 +728,2 @@ * Tab-separated values. Value: <code>tsv</code> | ||
TSV: '\t', | ||
/** | ||
@@ -825,3 +734,2 @@ * Pipe(|)-separated values. Value: <code>pipes</code> | ||
PIPES: '|', | ||
/** | ||
@@ -833,2 +741,3 @@ * Native array. Value: <code>multi</code> | ||
}; | ||
/** | ||
@@ -838,5 +747,4 @@ * The default API client implementation. | ||
*/ | ||
ApiClient.instance = new ApiClient(); | ||
var _default = ApiClient; | ||
exports.default = _default; |
@@ -24,9 +24,5 @@ "use strict"; | ||
}); | ||
var _ApiClient = _interopRequireDefault(require("./ApiClient")); | ||
var _CargoApi = _interopRequireDefault(require("./api/CargoApi")); | ||
var _SwivelApi = _interopRequireDefault(require("./api/SwivelApi")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
{ | ||
"name": "@factset/sdk-analyticsdatastore", | ||
"version": "0.21.1", | ||
"version": "0.21.2", | ||
"description": "Analytics Datastore client library for JavaScript", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -1,2 +0,2 @@ | ||
<img alt="FactSet" src="https://www.factset.com/hubfs/Assets/images/factset-logo.svg" height="56" width="290"> | ||
[![FactSet](https://raw.githubusercontent.com/factset/enterprise-sdk/main/docs/images/factset-logo.svg)](https://www.factset.com) | ||
@@ -13,3 +13,3 @@ # Analytics Datastore client library for JavaScript | ||
- API version: 1 | ||
- Package version: 0.21.1 | ||
- Package version: 0.21.2 | ||
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen | ||
@@ -52,2 +52,3 @@ | ||
```javascript | ||
@@ -54,0 +55,0 @@ const { ApiClient, CargoApi } = require('@factset/sdk-analyticsdatastore'); |
841
146
49023