comprodls-sdk 2.54.2 → 2.55.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.
- package/dist/comprodls-sdk.js +2365 -17280
- package/dist/comprodls-sdk.min.js +15 -20
- package/lib/comprodls.js +0 -2
- package/lib/config/index.js +2 -1
- package/lib/services/drive/index.js +188 -1
- package/package.json +1 -2
- package/lib/services/lrs/index.js +0 -459
package/lib/comprodls.js
CHANGED
|
@@ -33,7 +33,6 @@ var xapi = require('./services/xapi');
|
|
|
33
33
|
var attempts = require('./services/attempts');
|
|
34
34
|
var pushX = require('./services/pushX');
|
|
35
35
|
var pub = require('./services/pub');
|
|
36
|
-
var lrs = require('./services/lrs');
|
|
37
36
|
var spaces = require('./services/spaces');
|
|
38
37
|
var spacesextn = require('./services/spacesextn');
|
|
39
38
|
var config = require('./config');
|
|
@@ -138,7 +137,6 @@ comproDLS.prototype.Product = product;
|
|
|
138
137
|
comproDLS.prototype.Xapi = xapi;
|
|
139
138
|
comproDLS.prototype.Attempts = attempts;
|
|
140
139
|
comproDLS.prototype.Pub = pub;
|
|
141
|
-
comproDLS.prototype.LRS = lrs;
|
|
142
140
|
comproDLS.prototype.PushX = pushX;
|
|
143
141
|
comproDLS.prototype.Spaces = spaces;
|
|
144
142
|
comproDLS.prototype.SpacesExtn = spacesextn;
|
package/lib/config/index.js
CHANGED
|
@@ -350,7 +350,8 @@ exports.INTEGRATIONS_API_URLS = {
|
|
|
350
350
|
|
|
351
351
|
exports.DRIVE_API_URLS = {
|
|
352
352
|
getAParticularDocument: '/accounts/{accountid}/users/{extuserid}/documents/{documentid}',
|
|
353
|
-
getAllDocumentsInAFolder: '/accounts/{accountid}/users/{extuserid}/documents'
|
|
353
|
+
getAllDocumentsInAFolder: '/accounts/{accountid}/users/{extuserid}/documents',
|
|
354
|
+
documents: '/accounts/{accountid}/users/{userid}/documents/multi'
|
|
354
355
|
};
|
|
355
356
|
|
|
356
357
|
exports.TAXONOMY_API_URLS = {
|
|
@@ -29,19 +29,28 @@
|
|
|
29
29
|
|
|
30
30
|
var q = require('q');
|
|
31
31
|
var request = require('superagent');
|
|
32
|
+
var Agent = require('agentkeepalive');
|
|
32
33
|
|
|
33
34
|
var helpers = require('../../helpers');
|
|
34
35
|
var DLSError = helpers.errors.DLSError;
|
|
35
36
|
|
|
36
37
|
module.exports = documents;
|
|
37
38
|
|
|
39
|
+
var keepaliveAgent = new Agent({
|
|
40
|
+
timeout: 60000,
|
|
41
|
+
freeSocketTimeout: 30000
|
|
42
|
+
});
|
|
43
|
+
|
|
38
44
|
/*********************************
|
|
39
45
|
* Public Function definitions
|
|
40
46
|
**********************************/
|
|
41
47
|
function documents() {
|
|
42
48
|
return {
|
|
43
49
|
getAParticularDocument: getAParticularDocument.bind(this),
|
|
44
|
-
getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this)
|
|
50
|
+
getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this),
|
|
51
|
+
createMultipleDocuments: createMultipleDocuments.bind(this),
|
|
52
|
+
updateMultipleDocuments: updateMultipleDocuments.bind(this),
|
|
53
|
+
deleteMultipleDocuments: deleteMultipleDocuments.bind(this),
|
|
45
54
|
};
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -142,3 +151,181 @@ function getAllDocumentsInAFolder(options) {
|
|
|
142
151
|
}
|
|
143
152
|
return dfd.promise;
|
|
144
153
|
}
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
options = {
|
|
157
|
+
accountid: 'string', // mandatory
|
|
158
|
+
extuserid: 'string', // mandatory
|
|
159
|
+
body: { // mandatory
|
|
160
|
+
orgid: 'string', // mandatory
|
|
161
|
+
classid: 'string',
|
|
162
|
+
productcode: 'string', // mandatory
|
|
163
|
+
dls_user_id: 'string', // mandatory
|
|
164
|
+
entities: [ // mandatory (Min length 1)
|
|
165
|
+
{
|
|
166
|
+
item_code: 'string',
|
|
167
|
+
folderid: 'string', // mandatory
|
|
168
|
+
documentid: 'string', // mandatory
|
|
169
|
+
tag: 'string',
|
|
170
|
+
timestamp: <epoch>, // mandatory
|
|
171
|
+
ttl: <number>, // optional, default - 3 months
|
|
172
|
+
data: {} // mandatory, state JSON
|
|
173
|
+
},
|
|
174
|
+
...
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
*/
|
|
179
|
+
function createMultipleDocuments(options) {
|
|
180
|
+
var self = this;
|
|
181
|
+
var dfd = q.defer();
|
|
182
|
+
|
|
183
|
+
if (options && options.accountid && options.extuserid && options.body) {
|
|
184
|
+
// Passed all validations, Contruct API url
|
|
185
|
+
|
|
186
|
+
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
|
|
187
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
188
|
+
accountid: options.accountid, userid: options.extuserid
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Setup request with URL and Params
|
|
192
|
+
var requestAPI = request.post(url)
|
|
193
|
+
.set('Content-Type', 'application/json')
|
|
194
|
+
.set('Accept', 'application/json')
|
|
195
|
+
.send(options.body);
|
|
196
|
+
|
|
197
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
198
|
+
|
|
199
|
+
requestAPI
|
|
200
|
+
.agent(keepaliveAgent)
|
|
201
|
+
.end(function(error, response) {
|
|
202
|
+
if (error) {
|
|
203
|
+
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
204
|
+
dfd.reject(err);
|
|
205
|
+
}
|
|
206
|
+
else { dfd.resolve(response.body); }
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
var err = {};
|
|
210
|
+
err.message = err.description = 'Mandatory param - accountid, extuserid or body' +
|
|
211
|
+
' not found in request options.';
|
|
212
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
213
|
+
dfd.reject(err);
|
|
214
|
+
}
|
|
215
|
+
return dfd.promise;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/*
|
|
219
|
+
options = {
|
|
220
|
+
accountid: 'string', // mandatory
|
|
221
|
+
extuserid: 'string', // mandatory
|
|
222
|
+
body: { // mandatory
|
|
223
|
+
entities: [ // mandatory (Min length 1)
|
|
224
|
+
{
|
|
225
|
+
folderid: 'string', // mandatory
|
|
226
|
+
documentid: 'string', // mandatory
|
|
227
|
+
timestamp: <epoch>, // mandatory
|
|
228
|
+
ttl: <number>,
|
|
229
|
+
data: {}
|
|
230
|
+
},
|
|
231
|
+
...
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
*/
|
|
236
|
+
function updateMultipleDocuments(options) {
|
|
237
|
+
// Initializing promise
|
|
238
|
+
var deferred = q.defer();
|
|
239
|
+
var self = this;
|
|
240
|
+
var error = {};
|
|
241
|
+
|
|
242
|
+
if (options && options.accountid && options.extuserid && options.body) {
|
|
243
|
+
// Passed all validations, Contruct API url
|
|
244
|
+
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
|
|
245
|
+
|
|
246
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
247
|
+
accountid: options.accountid, userid: options.extuserid
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// Setup request with URL and Params
|
|
251
|
+
var requestAPI = request.put(url)
|
|
252
|
+
.set('Content-Type', 'application/json')
|
|
253
|
+
.set('Accept', 'application/json')
|
|
254
|
+
.send(options.body);
|
|
255
|
+
|
|
256
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
257
|
+
|
|
258
|
+
requestAPI
|
|
259
|
+
.agent(keepaliveAgent)
|
|
260
|
+
.end(function(error, response) {
|
|
261
|
+
if (error) {
|
|
262
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
263
|
+
deferred.reject(error);
|
|
264
|
+
} else {
|
|
265
|
+
deferred.resolve(response.body);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
} else {
|
|
269
|
+
error.message = error.description = 'Mandatory param - accountid, extuserid or body' +
|
|
270
|
+
' not found in the request options.';
|
|
271
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
272
|
+
deferred.reject(error);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return deferred.promise;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
options = {
|
|
280
|
+
accountid: 'string', // mandatory
|
|
281
|
+
extuserid: 'string', // mandatory
|
|
282
|
+
body: { // mandatory
|
|
283
|
+
entities: [ // mandatory (Min length 1)
|
|
284
|
+
{
|
|
285
|
+
folderid: 'string', // mandatory
|
|
286
|
+
documentid: 'string', // mandatory
|
|
287
|
+
},
|
|
288
|
+
...
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
*/
|
|
293
|
+
function deleteMultipleDocuments(options) {
|
|
294
|
+
var self = this;
|
|
295
|
+
var dfd = q.defer();
|
|
296
|
+
|
|
297
|
+
if (options && options.accountid && options.extuserid && options.body) {
|
|
298
|
+
// Passed all validations, Contruct API url
|
|
299
|
+
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
|
|
300
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
301
|
+
accountid: options.accountid, userid: options.extuserid
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// Setup request with URL and Params
|
|
305
|
+
var requestAPI = request.delete(url)
|
|
306
|
+
.set('Content-Type', 'application/json')
|
|
307
|
+
.set('Accept', 'application/json')
|
|
308
|
+
.send(options.body);
|
|
309
|
+
|
|
310
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
311
|
+
|
|
312
|
+
requestAPI
|
|
313
|
+
.agent(keepaliveAgent)
|
|
314
|
+
.end(function (error, response) {
|
|
315
|
+
if (error) {
|
|
316
|
+
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
317
|
+
dfd.reject(err);
|
|
318
|
+
}
|
|
319
|
+
else { dfd.resolve(response.body); }
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
var err = {};
|
|
324
|
+
err.message = err.description = 'Mandatory param - accountid, extuserid or body' +
|
|
325
|
+
' not found in request options.';
|
|
326
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
327
|
+
dfd.reject(err);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return dfd.promise;
|
|
331
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comprodls-sdk",
|
|
3
3
|
"description": "comproDLS SDK for JavaScript",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.55.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Compro Technologies Private Limited",
|
|
7
7
|
"url": "http://www.comprotechnologies.com/"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"q": "~1.4.1",
|
|
19
19
|
"string-template": "^1.0.0",
|
|
20
20
|
"superagent": "2.0.0",
|
|
21
|
-
"tincanjs": "^0.50.0",
|
|
22
21
|
"validate.js": "^0.9.0"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|