comprodls-sdk 2.89.0 → 2.90.0-qa
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.
- package/README.md +1 -137
- package/dist/comprodls-sdk.js +5937 -8432
- package/dist/comprodls-sdk.min.js +15 -1
- package/lib/comprodls.js +39 -57
- package/lib/config/index.js +171 -199
- package/lib/helpers/index.js +3 -2
- package/lib/helpers/lib/api/converter.js +1 -2
- package/lib/helpers/lib/api/index.js +19 -94
- package/lib/helpers/lib/errors.js +73 -80
- package/lib/helpers/lib/requestLayer.js +154 -0
- package/lib/helpers/lib/validator.js +65 -52
- package/lib/open_access/index.js +48 -53
- package/lib/services/analytics/index.js +286 -1014
- package/lib/services/attempts/index.js +38 -88
- package/lib/services/auth/index.js +238 -896
- package/lib/services/authextn/index.js +50 -150
- package/lib/services/datasyncmanager/index.js +10 -45
- package/lib/services/drive/index.js +20 -83
- package/lib/services/integrations/index.js +51 -126
- package/lib/services/invitations/index.js +20 -61
- package/lib/services/product/index.js +74 -85
- package/lib/services/pub/index.js +159 -234
- package/lib/services/pushX/index.js +29 -33
- package/lib/services/pushX/pubnubClientWrapper.js +398 -398
- package/lib/services/rules/index.js +14 -67
- package/lib/services/spaces/index.js +106 -294
- package/lib/services/spacesextn/index.js +4 -24
- package/lib/services/superuser/index.js +21 -36
- package/lib/services/taxonomy/index.js +27 -57
- package/lib/services/workflows/index.js +37 -98
- package/lib/services/xapi/index.js +6 -125
- package/lib/token/index.js +73 -67
- package/lib/token/validations.js +45 -48
- package/package.json +1 -2
- package/lib/helpers/lib/api/validations.js +0 -73
- package/lib/helpers/lib/utils.js +0 -24
- package/lib/services/activity/activity.js +0 -209
- package/lib/services/activity/attempt.js +0 -431
- package/lib/services/activity/index.js +0 -28
- package/lib/services/auth/classProduct.js +0 -37
- package/lib/services/collab/index.js +0 -468
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* is strictly forbidden unless prior written permission is obtained
|
|
18
18
|
* from Compro Technologies Pvt. Ltd..
|
|
19
19
|
***************************************************************************/
|
|
20
|
+
|
|
20
21
|
/***********************************************************
|
|
21
22
|
* comproDLS SDK Pub Adaptor
|
|
22
23
|
* Functions for calling Pub.
|
|
@@ -24,28 +25,31 @@
|
|
|
24
25
|
|
|
25
26
|
var request = require('superagent');
|
|
26
27
|
var q = require('q');
|
|
28
|
+
var Agent = require('agentkeepalive');
|
|
27
29
|
|
|
28
30
|
var helpers = require('../../helpers');
|
|
29
31
|
var DLSError = helpers.errors.DLSError;
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var keepaliveAgent = new Agent({
|
|
34
|
+
timeout: 60000,
|
|
35
|
+
freeSocketTimeout: 30000
|
|
36
|
+
});
|
|
37
|
+
|
|
34
38
|
module.exports = pub;
|
|
35
39
|
|
|
36
40
|
function pub() {
|
|
37
41
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
promoteProduct: promoteProduct.bind(this),
|
|
43
|
+
registerProduct: registerProduct.bind(this),
|
|
44
|
+
ingestProduct: ingestProduct.bind(this),
|
|
45
|
+
createBundle: createBundle.bind(this),
|
|
46
|
+
updateBundle: updateBundle.bind(this),
|
|
47
|
+
getAllBundles: getAllBundles.bind(this),
|
|
48
|
+
getSingleBundle: getSingleBundle.bind(this),
|
|
49
|
+
createProductFamily: createProductFamily.bind(this),
|
|
50
|
+
updateProductFamily: updateProductFamily.bind(this),
|
|
51
|
+
getSingleProductFamily: getSingleProductFamily.bind(this),
|
|
52
|
+
getAllProductFamilies: getAllProductFamilies.bind(this)
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -54,200 +58,156 @@ function pub() {
|
|
|
54
58
|
**********************************/
|
|
55
59
|
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
"stage": "1" //["1", "2"]
|
|
60
|
-
},
|
|
61
|
-
"target": {
|
|
62
|
-
"org": <target_org> //optional, mandatory for sourceStage-1 + targetStage-2
|
|
63
|
-
"stage": "2" //["2", "final"]
|
|
64
|
-
},
|
|
65
|
-
"externalrefid": <externalID>,
|
|
66
|
-
"productcode": "string"
|
|
67
|
-
}
|
|
61
|
+
* Wiki Link for SDK params
|
|
62
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#promoteproductparams
|
|
68
63
|
*/
|
|
69
64
|
function promoteProduct(options) {
|
|
70
65
|
var self = this;
|
|
71
|
-
|
|
72
66
|
//Initializing promise
|
|
73
67
|
var dfd = q.defer();
|
|
74
68
|
|
|
75
|
-
//Construct API url
|
|
76
|
-
var url = self.config.DEFAULT_HOSTS['PUB'] + self.config.PUB_API_URLS.promoteAPI;
|
|
77
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
78
|
-
"orgId": self.orgId, "productcode": options.productcode
|
|
79
|
-
});
|
|
80
69
|
//Contruct parameters
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
70
|
+
if (options && options.productcode) {
|
|
71
|
+
//Construct API url
|
|
72
|
+
var url = self.config.DEFAULT_HOSTS['PUB'] + self.config.PUB_API_URLS.promoteAPI;
|
|
73
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
74
|
+
'orgId': self.orgId, 'productcode': options.productcode
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var params = { source: {}, target: {} };
|
|
78
|
+
if (options.ext_user_id) { params.ext_user_id = options.ext_user_id; }
|
|
79
|
+
if (options.source && options.source.stage) { params.source.stage = options.source.stage; }
|
|
89
80
|
if (options.target) {
|
|
90
|
-
if(options.target.org) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
if(options.target.stage) {
|
|
94
|
-
params.target.stage = options.target.stage;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if(options.externalrefid) {
|
|
98
|
-
params.externalrefid = options.externalrefid;
|
|
81
|
+
if(options.target.org) { params.target.org = options.target.org; }
|
|
82
|
+
if(options.target.stage) { params.target.stage = options.target.stage; }
|
|
99
83
|
}
|
|
100
|
-
|
|
84
|
+
if(options.externalrefid) { params.externalrefid = options.externalrefid; }
|
|
101
85
|
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
//Setup request with URL and Post data
|
|
87
|
+
var requestAPI = request.post(url).send(params);
|
|
88
|
+
|
|
89
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
90
|
+
requestAPI
|
|
91
|
+
.agent(keepaliveAgent)
|
|
92
|
+
.end(function (err, response) {
|
|
93
|
+
if (err) {
|
|
94
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
95
|
+
dfd.reject(err);
|
|
96
|
+
} else {
|
|
97
|
+
dfd.resolve(response);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
var err = {};
|
|
102
|
+
err.message = err.description = 'Mandatory field \'options\' are not provided '+
|
|
103
|
+
'in the request options.';
|
|
104
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
105
|
+
dfd.reject(err);
|
|
106
|
+
}
|
|
104
107
|
|
|
105
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
106
|
-
requestAPI.end(function (err, response) {
|
|
107
|
-
if (err) {
|
|
108
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
109
|
-
dfd.reject(err);
|
|
110
|
-
} else {
|
|
111
|
-
dfd.resolve(response);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
108
|
return dfd.promise;
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// title: 'Product title', //mandatory
|
|
122
|
-
// producttype: 'Product type', //mandatory e.g., etextbook, imgbook, courseware.
|
|
123
|
-
// bundle-codes: ['bundle-code of the bundle'] //optional: Product register request, related to a Bundle, currently only one buldle-code in Array
|
|
124
|
-
// externalrefid: <externalID>
|
|
125
|
-
//
|
|
126
|
-
// /* Note: Register via github is no more supported from v2.5. */
|
|
127
|
-
// github: {
|
|
128
|
-
// repository: 'Github repository',
|
|
129
|
-
// token: 'Github Auth token'
|
|
130
|
-
// }
|
|
131
|
-
//}
|
|
111
|
+
/**
|
|
112
|
+
* Wiki Link for SDK params
|
|
113
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#registerproductparams
|
|
114
|
+
*/
|
|
132
115
|
function registerProduct(options) {
|
|
133
116
|
var self = this;
|
|
134
|
-
|
|
135
|
-
//Initializing promise
|
|
136
117
|
var dfd = q.defer();
|
|
137
118
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//Contruct parameters
|
|
143
|
-
var params = {};
|
|
144
|
-
if(options) {
|
|
145
|
-
if(options.targetorg) {
|
|
146
|
-
params.targetorgid = options.targetorg;
|
|
147
|
-
}
|
|
148
|
-
if(options.repositorytype) {
|
|
149
|
-
params.repositorytype = options.repositorytype;
|
|
150
|
-
}
|
|
151
|
-
if(options.producttitle) {
|
|
152
|
-
params.producttitle = options.producttitle;
|
|
153
|
-
}
|
|
154
|
-
if(options.producttype) {
|
|
155
|
-
params.producttype = options.producttype;
|
|
156
|
-
}
|
|
157
|
-
if(options.productcode) {
|
|
158
|
-
params.productcode = options.productcode;
|
|
159
|
-
}
|
|
160
|
-
if(options.github) {
|
|
161
|
-
params.github = options.github;
|
|
162
|
-
}
|
|
163
|
-
if(options.s3) {
|
|
164
|
-
params.s3 = options.s3;
|
|
165
|
-
}
|
|
166
|
-
if(options.externalrefid) {
|
|
167
|
-
params.externalrefid = options.externalrefid;
|
|
168
|
-
}
|
|
169
|
-
if(options['bundle-codes']) {
|
|
170
|
-
params['bundle-codes'] = options['bundle-codes'];
|
|
171
|
-
}
|
|
172
|
-
}
|
|
119
|
+
if (options) {
|
|
120
|
+
//Construct API url
|
|
121
|
+
var url = self.config.DEFAULT_HOSTS['PUB'] + self.config.PUB_API_URLS.registerProductAPI;
|
|
122
|
+
url = helpers.api.constructAPIUrl(url, { 'orgId' : self.orgId });
|
|
173
123
|
|
|
174
|
-
|
|
175
|
-
|
|
124
|
+
var params = {};
|
|
125
|
+
if (options.targetorg) { params.targetorgid = options.targetorg; }
|
|
126
|
+
if (options.repositorytype) { params.repositorytype = options.repositorytype; }
|
|
127
|
+
if (options.producttitle) { params.producttitle = options.producttitle; }
|
|
128
|
+
if (options.producttype) { params.producttype = options.producttype; }
|
|
129
|
+
if (options.productcode) { params.productcode = options.productcode; }
|
|
130
|
+
if (options.s3) { params.s3 = options.s3; }
|
|
131
|
+
if (options.externalrefid) { params.externalrefid = options.externalrefid; }
|
|
132
|
+
if (options['bundle-codes']) { params['bundle-codes'] = options['bundle-codes']; }
|
|
133
|
+
|
|
134
|
+
// Setup request with URL and Post data
|
|
135
|
+
var requestAPI = request.post(url).send(params);
|
|
136
|
+
|
|
137
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
138
|
+
requestAPI
|
|
139
|
+
.agent(keepaliveAgent)
|
|
140
|
+
.end(function(err, response) {
|
|
141
|
+
if (err) {
|
|
142
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
143
|
+
dfd.reject(err);
|
|
144
|
+
} else {
|
|
145
|
+
dfd.resolve(response);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
var err = {};
|
|
150
|
+
err.message = err.description = 'Mandatory field \'options\' are not provided '+
|
|
151
|
+
'in the request options.';
|
|
152
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
153
|
+
dfd.reject(err);
|
|
154
|
+
}
|
|
176
155
|
|
|
177
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
178
|
-
requestAPI.end(function(err, response) {
|
|
179
|
-
if (err) {
|
|
180
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
181
|
-
dfd.reject(err);
|
|
182
|
-
} else {
|
|
183
|
-
dfd.resolve(response);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
156
|
return dfd.promise;
|
|
187
157
|
}
|
|
188
158
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// "bundle-codes": ['bundle-code of the bundle'] //optional: Product register request, related to a Bundle
|
|
194
|
-
//}
|
|
159
|
+
/**
|
|
160
|
+
* Wiki Link for SDK params
|
|
161
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#ingestproductparams
|
|
162
|
+
*/
|
|
195
163
|
function ingestProduct(options) {
|
|
196
164
|
var self = this;
|
|
197
|
-
|
|
198
165
|
//Initializing promise
|
|
199
166
|
var dfd = q.defer();
|
|
200
167
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
168
|
+
if (options && options.productcode) {
|
|
169
|
+
//Construct API url
|
|
170
|
+
var url = self.config.DEFAULT_HOSTS['PUB'] + self.config.PUB_API_URLS.ingestByCodeAPI;
|
|
171
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
172
|
+
'orgId' : self.orgId, 'productcode' : options.productcode
|
|
173
|
+
});
|
|
205
174
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
//Contruct parameters
|
|
213
|
-
var params = {};
|
|
214
|
-
if(options) {
|
|
215
|
-
if(options.branchref) {
|
|
216
|
-
params.branchref = options.branchref;
|
|
217
|
-
}
|
|
218
|
-
if(options.externalrefid) {
|
|
219
|
-
params.externalrefid = options.externalrefid;
|
|
220
|
-
}
|
|
221
|
-
if(options['bundle-codes']) {
|
|
222
|
-
params['bundle-codes'] = options['bundle-codes'];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
175
|
+
//Contruct parameters
|
|
176
|
+
var params = {};
|
|
177
|
+
if (options.ext_user_id) { params.ext_user_id = options.ext_user_id; }
|
|
178
|
+
if (options.branchref) { params.branchref = options.branchref; }
|
|
179
|
+
if (options.externalrefid) { params.externalrefid = options.externalrefid; }
|
|
180
|
+
if (options['bundle-codes']) { params['bundle-codes'] = options['bundle-codes']; }
|
|
225
181
|
|
|
226
|
-
|
|
227
|
-
|
|
182
|
+
//Setup request with URL and Post data
|
|
183
|
+
var requestAPI = request.post(url).send(params);
|
|
184
|
+
|
|
185
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
186
|
+
requestAPI
|
|
187
|
+
.agent(keepaliveAgent)
|
|
188
|
+
.end(function(err, response) {
|
|
189
|
+
if (err) {
|
|
190
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
191
|
+
dfd.reject(err);
|
|
192
|
+
} else {
|
|
193
|
+
dfd.resolve(response);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
var err = {};
|
|
198
|
+
err.message = err.description = 'Mandatory field \'productcode\' is not provided '+
|
|
199
|
+
'in the request options.';
|
|
200
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
201
|
+
dfd.reject(err);
|
|
202
|
+
}
|
|
228
203
|
|
|
229
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
230
|
-
requestAPI.end(function(err, response) {
|
|
231
|
-
if (err) {
|
|
232
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
233
|
-
dfd.reject(err);
|
|
234
|
-
} else {
|
|
235
|
-
dfd.resolve(response);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
204
|
return dfd.promise;
|
|
239
205
|
}
|
|
240
206
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// title: "", //bundle title
|
|
246
|
-
// products: [] //products array of objects containing following keys:
|
|
247
|
-
//mandatory fields: ext-product, dls-product, meta, activation, analytics, classes,
|
|
248
|
-
//optional fields: groups, segment, results-display, assignability, learning-path, activity
|
|
249
|
-
// }
|
|
250
|
-
// }
|
|
207
|
+
/**
|
|
208
|
+
* Wiki Link for SDK params
|
|
209
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#createbundleparams
|
|
210
|
+
*/
|
|
251
211
|
function createBundle(options) {
|
|
252
212
|
var self = this;
|
|
253
213
|
//Initializing promise
|
|
@@ -287,16 +247,10 @@ function createBundle(options) {
|
|
|
287
247
|
return dfd.promise;
|
|
288
248
|
}
|
|
289
249
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
// title: "", //bundle title (optional)
|
|
295
|
-
// products: [] //products array of objects containing following keys:
|
|
296
|
-
//mandatory fields: ext-product, dls-product, meta, activation, analytics, classes,
|
|
297
|
-
//optional fields: groups, segment, results-display, assignability, learning-path, activity
|
|
298
|
-
// }
|
|
299
|
-
// }
|
|
250
|
+
/**
|
|
251
|
+
* Wiki Link for SDK params
|
|
252
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#updatebundleparams
|
|
253
|
+
*/
|
|
300
254
|
function updateBundle(options) {
|
|
301
255
|
var self = this;
|
|
302
256
|
|
|
@@ -335,10 +289,10 @@ function updateBundle(options) {
|
|
|
335
289
|
return dfd.promise;
|
|
336
290
|
}
|
|
337
291
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Wiki Link for SDK params
|
|
294
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#getallbundlesparams
|
|
295
|
+
*/
|
|
342
296
|
function getAllBundles(options) {
|
|
343
297
|
var self = this;
|
|
344
298
|
//Initializing promise
|
|
@@ -374,10 +328,10 @@ function getAllBundles(options) {
|
|
|
374
328
|
return dfd.promise;
|
|
375
329
|
}
|
|
376
330
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
331
|
+
/**
|
|
332
|
+
* Wiki Link for SDK params
|
|
333
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#getsinglebundleparams
|
|
334
|
+
*/
|
|
381
335
|
function getSingleBundle(options) {
|
|
382
336
|
var self = this;
|
|
383
337
|
var dfd = q.defer();
|
|
@@ -417,23 +371,10 @@ function getSingleBundle(options) {
|
|
|
417
371
|
return dfd.promise;
|
|
418
372
|
}
|
|
419
373
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
// "ext_user_id": "string", // Optional
|
|
425
|
-
// "assets": { // Optional
|
|
426
|
-
// "branchref": "string", // Optional
|
|
427
|
-
// "bucket": "string" // Optional
|
|
428
|
-
// "source": { // Optional
|
|
429
|
-
// "branchref": "string", // Mandatory
|
|
430
|
-
// "bucket": "string" // Mandatory
|
|
431
|
-
// }
|
|
432
|
-
// },
|
|
433
|
-
// "externalrefid": "string", // Optional
|
|
434
|
-
// "data": {... } // Optional
|
|
435
|
-
// }
|
|
436
|
-
// }
|
|
374
|
+
/**
|
|
375
|
+
* Wiki Link for SDK params
|
|
376
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#createproductfamilyparams
|
|
377
|
+
*/
|
|
437
378
|
function createProductFamily(options) {
|
|
438
379
|
var self = this;
|
|
439
380
|
//Initializing promise
|
|
@@ -470,23 +411,10 @@ function createProductFamily(options) {
|
|
|
470
411
|
return dfd.promise;
|
|
471
412
|
}
|
|
472
413
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
// "ext_user_id": "string", // Optional
|
|
478
|
-
// "assets": { // Optional
|
|
479
|
-
// "branchref": "string", // Optional
|
|
480
|
-
// "bucket": "string" // Optional
|
|
481
|
-
// "source": { // Optional
|
|
482
|
-
// "branchref": "string", // Mandatory
|
|
483
|
-
// "bucket": "string" // Mandatory
|
|
484
|
-
// }
|
|
485
|
-
// },
|
|
486
|
-
// "externalrefid": "string", // Optional
|
|
487
|
-
// "data": {... } // Optional
|
|
488
|
-
// }
|
|
489
|
-
// }
|
|
414
|
+
/**
|
|
415
|
+
* Wiki Link for SDK params
|
|
416
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#updateproductfamilyparams
|
|
417
|
+
*/
|
|
490
418
|
function updateProductFamily(options) {
|
|
491
419
|
var self = this;
|
|
492
420
|
|
|
@@ -495,7 +423,7 @@ function updateProductFamily(options) {
|
|
|
495
423
|
var err;
|
|
496
424
|
|
|
497
425
|
//Validations
|
|
498
|
-
|
|
426
|
+
if (options && options.stage && options['family-code']) {
|
|
499
427
|
//Passed all validations, Construct API url
|
|
500
428
|
var url = self.config.DEFAULT_HOSTS['PUB'] + self.config.PUB_API_URLS.updateProductFamily;
|
|
501
429
|
url = helpers.api.constructAPIUrl(url, {
|
|
@@ -526,10 +454,8 @@ function updateProductFamily(options) {
|
|
|
526
454
|
}
|
|
527
455
|
|
|
528
456
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
* "stage" : "", //stage number
|
|
532
|
-
* }
|
|
457
|
+
* Wiki Link for SDK params
|
|
458
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#getsingleproductfamilyparams
|
|
533
459
|
*/
|
|
534
460
|
function getSingleProductFamily(options) {
|
|
535
461
|
var self = this;
|
|
@@ -572,9 +498,8 @@ function getSingleProductFamily(options) {
|
|
|
572
498
|
}
|
|
573
499
|
|
|
574
500
|
/**
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
* }
|
|
501
|
+
* Wiki Link for SDK params
|
|
502
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/07_PUB-Adapter#getallproductfamiliesparams
|
|
578
503
|
*/
|
|
579
504
|
function getAllProductFamilies(options) {
|
|
580
505
|
var self = this;
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* Functions for calling PUSHX.
|
|
24
24
|
************************************************************/
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
var q = require('q');
|
|
28
27
|
var request = require('superagent');
|
|
29
28
|
var Agent = require('agentkeepalive');
|
|
@@ -32,9 +31,6 @@ var helpers = require('../../helpers');
|
|
|
32
31
|
var pubnubClientWrapper = require('./pubnubClientWrapper');
|
|
33
32
|
var DLSError = helpers.errors.DLSError;
|
|
34
33
|
|
|
35
|
-
/*********************************
|
|
36
|
-
* Setting Up Module Entry Point
|
|
37
|
-
**********************************/
|
|
38
34
|
module.exports = pushX;
|
|
39
35
|
|
|
40
36
|
var keepaliveAgent = new Agent({
|
|
@@ -42,19 +38,16 @@ var keepaliveAgent = new Agent({
|
|
|
42
38
|
freeSocketTimeout: 30000
|
|
43
39
|
});
|
|
44
40
|
|
|
45
|
-
/*********************************
|
|
46
|
-
* Public Function definitions
|
|
47
|
-
**********************************/
|
|
48
41
|
function pushX() {
|
|
49
42
|
var _pubnubClientWrapper = pubnubClientWrapper();
|
|
50
43
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
connect: _connect.bind(this, _pubnubClientWrapper),
|
|
45
|
+
cleanup: _cleanup.bind(this, _pubnubClientWrapper),
|
|
46
|
+
grantByUserOrgId: grantByUserOrgId.bind(this),
|
|
47
|
+
grantByAccountId: grantByAccountId.bind(this),
|
|
48
|
+
grantByAccountIdOnExtUserId: grantByAccountIdOnExtUserId.bind(this),
|
|
49
|
+
grantV2: grantV2.bind(this),
|
|
50
|
+
getPushedEvents: getPushedEvents.bind(this)
|
|
58
51
|
};
|
|
59
52
|
}
|
|
60
53
|
|
|
@@ -88,9 +81,16 @@ function _connect(pubnubCW, options) {
|
|
|
88
81
|
});
|
|
89
82
|
}
|
|
90
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Wiki Link for SDK params
|
|
86
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#cleanup
|
|
87
|
+
*/
|
|
91
88
|
function _cleanup(pubnubCW) { pubnubCW.cleanup(); }
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Wiki Link for SDK params
|
|
92
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#get-user--org-level-grants
|
|
93
|
+
*/
|
|
94
94
|
function grantByUserOrgId(options) {
|
|
95
95
|
var dfd = q.defer(); // Initializing promise
|
|
96
96
|
var allowedChannels = ['jobs', 'systemevents'];
|
|
@@ -112,12 +112,12 @@ function grantByUserOrgId(options) {
|
|
|
112
112
|
return dfd.promise;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Wiki Link for SDK params
|
|
117
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#get-account-level-grants
|
|
118
|
+
*/
|
|
119
119
|
function grantByAccountId(options) {
|
|
120
|
-
|
|
120
|
+
var err ={};
|
|
121
121
|
var dfd = q.defer(); // Initializing promise
|
|
122
122
|
|
|
123
123
|
if(options.accountId && options.refId) {
|
|
@@ -142,12 +142,12 @@ function grantByAccountId(options) {
|
|
|
142
142
|
return dfd.promise;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Wiki Link for SDK params
|
|
147
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#get-account-level-grants-on-extuserid
|
|
148
|
+
*/
|
|
149
149
|
function grantByAccountIdOnExtUserId(options) {
|
|
150
|
-
|
|
150
|
+
var err ={};
|
|
151
151
|
var dfd = q.defer(); // Initializing promise
|
|
152
152
|
|
|
153
153
|
if(options.accountId && options.extUserId) {
|
|
@@ -174,8 +174,8 @@ function grantByAccountIdOnExtUserId(options) {
|
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* This function provides grant token on given channels
|
|
177
|
-
*
|
|
178
|
-
*
|
|
177
|
+
* Wiki Link for SDK params
|
|
178
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#get-grant-token-for-the-access-manager-v3
|
|
179
179
|
*/
|
|
180
180
|
function grantV2(options) {
|
|
181
181
|
var self = this, err = {};
|
|
@@ -208,12 +208,8 @@ function grantV2(options) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* *channelName: "string",
|
|
214
|
-
* *starttime: number,
|
|
215
|
-
* *endtime: number
|
|
216
|
-
* } options
|
|
211
|
+
* Wiki Link for SDK params
|
|
212
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/19_PUSHX-Adapter#getpushedeventsparams
|
|
217
213
|
*/
|
|
218
214
|
function getPushedEvents(options) {
|
|
219
215
|
var self = this;
|