comprodls-sdk 2.43.0 → 2.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,113 +0,0 @@
1
- /*************************************************************************
2
- *
3
- * COMPRO CONFIDENTIAL
4
- * __________________
5
- *
6
- * [2015] - [2020] Compro Technologies Private Limited
7
- * All Rights Reserved.
8
- *
9
- * NOTICE: All information contained herein is, and remains
10
- * the property of Compro Technologies Private Limited. The
11
- * intellectual and technical concepts contained herein are
12
- * proprietary to Compro Technologies Private Limited and may
13
- * be covered by U.S. and Foreign Patents, patents in process,
14
- * and are protected by trade secret or copyright law.
15
- *
16
- * Dissemination of this information or reproduction of this material
17
- * is strictly forbidden unless prior written permission is obtained
18
- * from Compro Technologies Pvt. Ltd..
19
- ***************************************************************************/
20
- /***********************************************************
21
- * comproDLS SDK sisevents Adaptor
22
- * Functions for calling sisevents.
23
- ************************************************************/
24
- /*********************************
25
- * Setting Up Module Entry Point
26
- **********************************/
27
-
28
- var request = require('superagent');
29
- var q = require('q');
30
- var _und = require('underscore');
31
-
32
- var helpers = require('../../helpers');
33
- var DLSError = helpers.errors.DLSError;
34
-
35
- module.exports = sisevents;
36
-
37
- /*********************************
38
- * Public Function definitions
39
- **********************************/
40
- function sisevents() {
41
- return {
42
- "postSISEvent": postSISEvent.bind(this)
43
- };
44
- }
45
-
46
- //options = {
47
- // "actor": {
48
- // "uuid": "string", // userid of user posting statements
49
- // },
50
- // "target": {
51
- // "uuid": "string", // userid of user posting statement
52
- // },
53
- // "product": {
54
- // "uuid": "string", // productid
55
- // "code": "string", // (optional)
56
- // },
57
- // "entities": [{
58
- // "verb": "string", // ['plan-responsibility-signoff', 'plan-status', 'plan-comment', 'item-responsibility', 'item-signoff', 'item-comment', 'item-assets', 'item-status'] currently only one verb is supported
59
- // "task": "string", // task-code of resource
60
- // "model": "string", // (optional) model hierarchy of resource if available
61
- // [verb] : {
62
- // "value": "string"
63
- // }
64
- // }]
65
- //};
66
-
67
- function postSISEvent(options) {
68
- var self = this;
69
-
70
- //Initializing promise
71
- var dfd = q.defer();
72
- //Validations
73
- var err = {}, url;
74
-
75
- if(_und.isArray(options.entities)) {
76
- err = helpers.validations.isAuthenticated(self.orgId, self.token);
77
- if (err) {
78
- dfd.reject(err);
79
- } else {
80
-
81
- url = self.config.DEFAULT_HOSTS['SISEVENTS'] +
82
- self.config.SISEVENTS_API_URLS.postMultiSISEvent;
83
- url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
84
-
85
- //Passed all validations, Construct API url
86
-
87
- var params = options;
88
-
89
- //Setup request with URL and Params
90
- var requestAPI = request.post(url).send(params);
91
-
92
- //Setup token in Authorization header
93
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
94
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
95
-
96
- //Call Product Timespent Api
97
- requestAPI.end(function(err, response) {
98
- if (err) {
99
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
100
- dfd.reject(err);
101
- } else {
102
- dfd.resolve(response.body);
103
- }
104
- });
105
- }
106
- } else {
107
- err.message = err.description = 'Mandatory parameter entities not present in options';
108
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
109
- dfd.reject(err);
110
- }
111
-
112
- return dfd.promise;
113
- }