opengate-js 12.0.0 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -760,7 +760,7 @@ This function updates a entity of provision</p>
760
760
  <span class="right-info">
761
761
 
762
762
 
763
- <span data-ice="source"><span><a href="file/src/transformers/Transformers.js.html#lineNumber106">source</a></span></span>
763
+ <span data-ice="source"><span><a href="file/src/transformers/Transformers.js.html#lineNumber101">source</a></span></span>
764
764
  </span>
765
765
  </h3>
766
766
 
@@ -1250,7 +1250,7 @@
1250
1250
  "actualCount": 4,
1251
1251
  "undocumentLines": [
1252
1252
  48,
1253
- 106,
1253
+ 101,
1254
1254
  82,
1255
1255
  59
1256
1256
  ]
package/docs/dump.json CHANGED
@@ -40034,7 +40034,7 @@
40034
40034
  "__docId__": 1529,
40035
40035
  "kind": "file",
40036
40036
  "name": "src/pipelines/Pipelines.js",
40037
- "content": "'use strict';\r\n\r\nimport q from 'q';\r\nimport BaseProvision from '../provision/BaseProvision';\r\n\r\n/**\r\n * This is a base object that contains all you can do about Bundles.\r\n */\r\nexport default class Pipelines extends BaseProvision {\r\n\r\n /** \r\n * @param {InternalOpenGateAPI} Reference to the API object.\r\n */\r\n constructor(ogapi) {\r\n super(ogapi, \"/organizations\", undefined, [\"name\", \"actions\", \"organization\"], 'north/ai');\r\n this._ogapi = ogapi;\r\n }\r\n\r\n _buildURL() {\r\n var url = this._organization + '/pipelines/' + this._identifier;\r\n return url;\r\n }\r\n\r\n /**\r\n * Set the identifier attribute\r\n * @param {string} identifier\r\n * @return {Transformers}\r\n */\r\n withIdentifier(identifier) {\r\n if (typeof identifier !== 'string' || identifier.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'identifier' });\r\n this._identifier = identifier;\r\n return this;\r\n }\r\n \r\n\r\n /**\r\n * Set the name attribute\r\n * @param {string} name - required field\r\n * @return {Pipelines}\r\n */\r\n withName(name) {\r\n if (typeof name !== 'string' || name.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'name' });\r\n this._name = name;\r\n return this;\r\n }\r\n\r\n /**\r\n * Set the organization attribute\r\n * @param {string} organization \r\n * @return {Pipelines}\r\n */\r\n withOrganization(organization) {\r\n if (typeof organization !== 'string' || organization.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'organization' });\r\n this._organization = organization;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the actions for the pipeline\r\n * @param {Array} actions\r\n */\r\n withActions(actions) {\r\n if (!(actions instanceof Array))\r\n throw new Error({ message: \"Parameter actions requires an array\", parameter: 'actions' });\r\n\r\n this._actions = []\r\n\r\n actions.forEach((actionTmp) => {\r\n this.addAction(actionTmp)\r\n })\r\n }\r\n\r\n /**\r\n * Adds an action item\r\n * @param {Object} action to be added\r\n */\r\n addAction(action) {\r\n if (typeof action !== 'object' \r\n || !action.name || typeof action.name !== 'string' || !action.type || typeof action.type !== 'string')\r\n throw new Error({ message: \"Parameter action requires name and type\", parameter: 'actions' });\r\n\r\n if(!this._actions) {\r\n this._actions = []\r\n }\r\n\r\n this._actions.push(action)\r\n }\r\n\r\n prediction(body_data, deviceId, datastream) {\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n const finalData = {\r\n input: {\r\n data: body_data,\r\n date: new Date().toISOString()\r\n }\r\n }\r\n\r\n if (deviceId && datastream) {\r\n finalData.collect = {\r\n deviceId: deviceId,\r\n datastream: datastream\r\n }\r\n }\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n\r\n this._ogapi.Napi.post(this._buildURL() + '/prediction', finalData, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((res) => {\r\n defered.resolve({\r\n statusCode: res.statusCode,\r\n body: res.body\r\n });\r\n })\r\n .catch((error) => {\r\n defered.reject(error);\r\n });\r\n return promise;\r\n \r\n }\r\n\r\n _composeElement() {\r\n this._checkRequiredParameters();\r\n this._resource = this._organization + '/pipelines';\r\n var pipeline = {\r\n name: this._name || undefined,\r\n actions: this._actions || undefined,\r\n };\r\n return pipeline;\r\n }\r\n\r\n _composeUpdateElement() {\r\n let pipeline = super._composeUpdateElement();\r\n delete pipeline.pipeline.name;\r\n return pipeline;\r\n }\r\n}",
40037
+ "content": "'use strict';\r\n\r\nimport q from 'q';\r\nimport BaseProvision from '../provision/BaseProvision';\r\n\r\n/**\r\n * This is a base object that contains all you can do about Bundles.\r\n */\r\nexport default class Pipelines extends BaseProvision {\r\n\r\n /** \r\n * @param {InternalOpenGateAPI} Reference to the API object.\r\n */\r\n constructor(ogapi) {\r\n super(ogapi, \"/organizations\", undefined, [\"name\", \"actions\", \"organization\"], 'north/ai');\r\n this._ogapi = ogapi;\r\n }\r\n\r\n _buildURL() {\r\n var url = this._organization + '/pipelines/' + this._identifier;\r\n return url;\r\n }\r\n\r\n /**\r\n * Set the identifier attribute\r\n * @param {string} identifier\r\n * @return {Transformers}\r\n */\r\n withIdentifier(identifier) {\r\n if (typeof identifier !== 'string' || identifier.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'identifier' });\r\n this._identifier = identifier;\r\n return this;\r\n }\r\n \r\n\r\n /**\r\n * Set the name attribute\r\n * @param {string} name - required field\r\n * @return {Pipelines}\r\n */\r\n withName(name) {\r\n if (typeof name !== 'string' || name.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'name' });\r\n this._name = name;\r\n return this;\r\n }\r\n\r\n /**\r\n * Set the organization attribute\r\n * @param {string} organization \r\n * @return {Pipelines}\r\n */\r\n withOrganization(organization) {\r\n if (typeof organization !== 'string' || organization.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'organization' });\r\n this._organization = organization;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the actions for the pipeline\r\n * @param {Array} actions\r\n */\r\n withActions(actions) {\r\n if (!(actions instanceof Array))\r\n throw new Error({ message: \"Parameter actions requires an array\", parameter: 'actions' });\r\n\r\n this._actions = []\r\n\r\n actions.forEach((actionTmp) => {\r\n this.addAction(actionTmp)\r\n })\r\n }\r\n\r\n /**\r\n * Adds an action item\r\n * @param {Object} action to be added\r\n */\r\n addAction(action) {\r\n if (typeof action !== 'object' \r\n || !action.name || typeof action.name !== 'string' || !action.type || typeof action.type !== 'string')\r\n throw new Error({ message: \"Parameter action requires name and type\", parameter: 'actions' });\r\n\r\n if(!this._actions) {\r\n this._actions = []\r\n }\r\n\r\n this._actions.push(action)\r\n }\r\n\r\n prediction(body_data, deviceId, datastream) {\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n const finalData = {\r\n input: body_data\r\n }\r\n\r\n if (deviceId && datastream) {\r\n finalData.collect = {\r\n deviceId: deviceId,\r\n datastream: datastream\r\n }\r\n }\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n\r\n this._ogapi.Napi.post(this._buildURL() + '/prediction', finalData, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((res) => {\r\n defered.resolve({\r\n statusCode: res.statusCode,\r\n body: res.body\r\n });\r\n })\r\n .catch((error) => {\r\n defered.reject(error);\r\n });\r\n return promise;\r\n \r\n }\r\n\r\n _composeElement() {\r\n this._checkRequiredParameters();\r\n this._resource = this._organization + '/pipelines';\r\n var pipeline = {\r\n name: this._name || undefined,\r\n actions: this._actions || undefined,\r\n };\r\n return pipeline;\r\n }\r\n\r\n _composeUpdateElement() {\r\n let pipeline = super._composeUpdateElement();\r\n delete pipeline.pipeline.name;\r\n return pipeline;\r\n }\r\n}",
40038
40038
  "static": true,
40039
40039
  "longname": "src/pipelines/Pipelines.js",
40040
40040
  "access": null,
@@ -40453,7 +40453,7 @@
40453
40453
  "longname": "src/pipelines/Pipelines.js~Pipelines#_composeElement",
40454
40454
  "access": null,
40455
40455
  "description": null,
40456
- "lineNumber": 130,
40456
+ "lineNumber": 127,
40457
40457
  "undocument": true,
40458
40458
  "unknown": [
40459
40459
  {
@@ -40477,7 +40477,7 @@
40477
40477
  "longname": "src/pipelines/Pipelines.js~Pipelines#_resource",
40478
40478
  "access": null,
40479
40479
  "description": null,
40480
- "lineNumber": 132,
40480
+ "lineNumber": 129,
40481
40481
  "undocument": true,
40482
40482
  "unknown": [
40483
40483
  {
@@ -40502,7 +40502,7 @@
40502
40502
  "longname": "src/pipelines/Pipelines.js~Pipelines#_composeUpdateElement",
40503
40503
  "access": null,
40504
40504
  "description": null,
40505
- "lineNumber": 140,
40505
+ "lineNumber": 137,
40506
40506
  "undocument": true,
40507
40507
  "unknown": [
40508
40508
  {
@@ -66178,7 +66178,7 @@
66178
66178
  "__docId__": 2511,
66179
66179
  "kind": "file",
66180
66180
  "name": "src/transformers/Transformers.js",
66181
- "content": "'use strict';\r\n\r\nimport q from 'q';\r\nimport BaseProvision from '../provision/BaseProvision';\r\n\r\n/**\r\n * This is a base object that contains all you can do about Bundles.\r\n */\r\nexport default class Transformers extends BaseProvision {\r\n\r\n /** \r\n * @param {InternalOpenGateAPI} Reference to the API object.\r\n */\r\n constructor(ogapi) {\r\n super(ogapi, \"/organizations\", undefined, [\"organization\", \"files\"], 'north/ai');\r\n this._ogapi = ogapi;\r\n }\r\n\r\n _buildURL() {\r\n var url = this._organization + '/transformers/' + this._identifier;\r\n return url;\r\n }\r\n\r\n /**\r\n * Set the identifier attribute\r\n * @param {string} identifier\r\n * @return {Transformers}\r\n */\r\n withIdentifier(identifier) {\r\n if (typeof identifier !== 'string' || identifier.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'identifier' });\r\n this._identifier = identifier;\r\n return this;\r\n }\r\n\r\n /**\r\n * Set the organization attribute\r\n * @param {string} organization \r\n * @return {Transformers}\r\n */\r\n withOrganization(organization) {\r\n if (typeof organization !== 'string' || organization.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'organization' });\r\n this._organization = organization;\r\n return this;\r\n }\r\n\r\n addFile(file) {\r\n // if (typeof file !== 'object')\r\n // throw new Error({ message: \"Parameter action requires name and type\", parameter: 'action' });\r\n\r\n if(!this._files) {\r\n this._files = []\r\n }\r\n\r\n this._files.push(file)\r\n }\r\n\r\n withFiles(files) {\r\n if (!(files instanceof Array))\r\n throw new Error({ message: \"Parameter files requires an array\", parameter: 'files' });\r\n\r\n this._files = files\r\n }\r\n\r\n _composeElement() {\r\n this._checkRequiredParameters();\r\n this._resource = this._organization + '/transformers';\r\n\r\n var transformer = {\r\n files: this._files || undefined,\r\n };\r\n return transformer;\r\n }\r\n\r\n _composeUpdateElement() {\r\n let transformer = super._composeUpdateElement();\r\n delete transformer.name;\r\n return transformer;\r\n }\r\n\r\n performTest(body_data) {\r\n var finalBody = {\r\n data: body_data,\r\n date: new Date().toISOString()\r\n }\r\n\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n\r\n this._ogapi.Napi.post(this._buildURL() + '/transform', finalBody, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((res) => {\r\n defered.resolve({\r\n statusCode: res.statusCode,\r\n body: res.body\r\n });\r\n })\r\n .catch((error) => {\r\n defered.reject(error);\r\n });\r\n return promise;\r\n }\r\n\r\n create() {\r\n let _postElement = this._composeElement();\r\n \r\n // let form = new FormData();\r\n // _postElement.files.forEach(function (fileTmp) {\r\n // form.append('files', fileTmp);\r\n // });\r\n \r\n // form.append('files', _postElement.files);\r\n \r\n const defer = q.defer();\r\n \r\n //var petitionUrl = this._buildURL();\r\n //url, formData, events, timeout, headers, parameters\r\n this._ogapi.Napi.post_multipart(this._resource, {files: _postElement.files}, {}, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((response) => {\r\n let statusCode = response.statusCode;\r\n switch (statusCode) {\r\n case 200:{\r\n const resultQuery = response.text != \"\" ? JSON.parse(response.text) : {};\r\n const _statusCode = response.status;\r\n defer.resolve({\r\n data: resultQuery,\r\n statusCode: _statusCode\r\n });\r\n break\r\n }\r\n case 201:{\r\n const _statusCode = response.status;\r\n const location = response.header && response.header.location\r\n defer.resolve({\r\n location: location,\r\n statusCode: _statusCode\r\n });\r\n break\r\n }\r\n case 204:\r\n defer.resolve(response);\r\n break\r\n default:\r\n defer.reject({\r\n errors: response.data.errors,\r\n statusCode: response.statusCode\r\n });\r\n break\r\n }\r\n })\r\n .catch((error) => {\r\n defer.reject(error);\r\n });\r\n return defer.promise;\r\n }\r\n\r\n}",
66181
+ "content": "'use strict';\r\n\r\nimport q from 'q';\r\nimport BaseProvision from '../provision/BaseProvision';\r\n\r\n/**\r\n * This is a base object that contains all you can do about Bundles.\r\n */\r\nexport default class Transformers extends BaseProvision {\r\n\r\n /** \r\n * @param {InternalOpenGateAPI} Reference to the API object.\r\n */\r\n constructor(ogapi) {\r\n super(ogapi, \"/organizations\", undefined, [\"organization\", \"files\"], 'north/ai');\r\n this._ogapi = ogapi;\r\n }\r\n\r\n _buildURL() {\r\n var url = this._organization + '/transformers/' + this._identifier;\r\n return url;\r\n }\r\n\r\n /**\r\n * Set the identifier attribute\r\n * @param {string} identifier\r\n * @return {Transformers}\r\n */\r\n withIdentifier(identifier) {\r\n if (typeof identifier !== 'string' || identifier.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'identifier' });\r\n this._identifier = identifier;\r\n return this;\r\n }\r\n\r\n /**\r\n * Set the organization attribute\r\n * @param {string} organization \r\n * @return {Transformers}\r\n */\r\n withOrganization(organization) {\r\n if (typeof organization !== 'string' || organization.length > 50)\r\n throw new Error({ message: \"OGAPI_STRING_PARAMETER_MAX_LENGTH_50\", parameter: 'organization' });\r\n this._organization = organization;\r\n return this;\r\n }\r\n\r\n addFile(file) {\r\n // if (typeof file !== 'object')\r\n // throw new Error({ message: \"Parameter action requires name and type\", parameter: 'action' });\r\n\r\n if(!this._files) {\r\n this._files = []\r\n }\r\n\r\n this._files.push(file)\r\n }\r\n\r\n withFiles(files) {\r\n if (!(files instanceof Array))\r\n throw new Error({ message: \"Parameter files requires an array\", parameter: 'files' });\r\n\r\n this._files = files\r\n }\r\n\r\n _composeElement() {\r\n this._checkRequiredParameters();\r\n this._resource = this._organization + '/transformers';\r\n\r\n var transformer = {\r\n files: this._files || undefined,\r\n };\r\n return transformer;\r\n }\r\n\r\n _composeUpdateElement() {\r\n let transformer = super._composeUpdateElement();\r\n delete transformer.name;\r\n return transformer;\r\n }\r\n\r\n performTest(body_data) {\r\n var defered = q.defer();\r\n var promise = defered.promise;\r\n\r\n //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()\r\n\r\n this._ogapi.Napi.post(this._buildURL() + '/transform', body_data, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((res) => {\r\n defered.resolve({\r\n statusCode: res.statusCode,\r\n body: res.body\r\n });\r\n })\r\n .catch((error) => {\r\n defered.reject(error);\r\n });\r\n return promise;\r\n }\r\n\r\n create() {\r\n let _postElement = this._composeElement();\r\n \r\n // let form = new FormData();\r\n // _postElement.files.forEach(function (fileTmp) {\r\n // form.append('files', fileTmp);\r\n // });\r\n \r\n // form.append('files', _postElement.files);\r\n \r\n const defer = q.defer();\r\n \r\n //var petitionUrl = this._buildURL();\r\n //url, formData, events, timeout, headers, parameters\r\n this._ogapi.Napi.post_multipart(this._resource, {files: _postElement.files}, {}, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())\r\n .then((response) => {\r\n let statusCode = response.statusCode;\r\n switch (statusCode) {\r\n case 200:{\r\n const resultQuery = response.text != \"\" ? JSON.parse(response.text) : {};\r\n const _statusCode = response.status;\r\n defer.resolve({\r\n data: resultQuery,\r\n statusCode: _statusCode\r\n });\r\n break\r\n }\r\n case 201:{\r\n const _statusCode = response.status;\r\n const location = response.header && response.header.location\r\n defer.resolve({\r\n location: location,\r\n statusCode: _statusCode\r\n });\r\n break\r\n }\r\n case 204:\r\n defer.resolve(response);\r\n break\r\n default:\r\n defer.reject({\r\n errors: response.data.errors,\r\n statusCode: response.statusCode\r\n });\r\n break\r\n }\r\n })\r\n .catch((error) => {\r\n defer.reject(error);\r\n });\r\n return defer.promise;\r\n }\r\n\r\n}",
66182
66182
  "static": true,
66183
66183
  "longname": "src/transformers/Transformers.js",
66184
66184
  "access": null,
@@ -66610,7 +66610,7 @@
66610
66610
  "longname": "src/transformers/Transformers.js~Transformers#create",
66611
66611
  "access": null,
66612
66612
  "description": null,
66613
- "lineNumber": 106,
66613
+ "lineNumber": 101,
66614
66614
  "undocument": true,
66615
66615
  "unknown": [
66616
66616
  {
@@ -374,10 +374,7 @@ export default class Pipelines extends BaseProvision {
374
374
  var promise = defered.promise;
375
375
 
376
376
  const finalData = {
377
- input: {
378
- data: body_data,
379
- date: new Date().toISOString()
380
- }
377
+ input: body_data
381
378
  }
382
379
 
383
380
  if (deviceId &amp;&amp; datastream) {
@@ -360,17 +360,12 @@ export default class Transformers extends BaseProvision {
360
360
  }
361
361
 
362
362
  performTest(body_data) {
363
- var finalBody = {
364
- data: body_data,
365
- date: new Date().toISOString()
366
- }
367
-
368
363
  var defered = q.defer();
369
364
  var promise = defered.promise;
370
365
 
371
366
  //En muchas clases se genera this._resource en la llamada a la funcion this._composeElement()
372
367
 
373
- this._ogapi.Napi.post(this._buildURL() + &apos;/transform&apos;, finalBody, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())
368
+ this._ogapi.Napi.post(this._buildURL() + &apos;/transform&apos;, body_data, this._timeout, this._getExtraHeaders(), this._getUrlParameters(), this._getServiceBaseURL())
374
369
  .then((res) =&gt; {
375
370
  defered.resolve({
376
371
  statusCode: res.statusCode,
package/docs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opengate-js",
3
- "version": "12.0.0",
3
+ "version": "12.0.1",
4
4
  "description": "",
5
5
  "main": "dist/opengate-api-npm.js",
6
6
  "repository": {