meadow-endpoints 2.0.17 → 2.0.18
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/package.json
CHANGED
|
@@ -418,6 +418,17 @@ var MeadowEndpoints = function()
|
|
|
418
418
|
return fCallback();
|
|
419
419
|
};
|
|
420
420
|
|
|
421
|
+
var _InvokeSetupCallback;
|
|
422
|
+
var getInvokeSetupCallback = function()
|
|
423
|
+
{
|
|
424
|
+
return _InvokeSetupCallback;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
var setInvokeSetupCallback = function(fCallback)
|
|
428
|
+
{
|
|
429
|
+
_InvokeSetupCallback = fCallback;
|
|
430
|
+
};
|
|
431
|
+
|
|
421
432
|
/**
|
|
422
433
|
* Invoke a meadow endpoint programmatically
|
|
423
434
|
*
|
|
@@ -470,6 +481,10 @@ var MeadowEndpoints = function()
|
|
|
470
481
|
//internal invoke mark as authenticated (because this is not called via webservice)
|
|
471
482
|
pRequest.EndpointAuthenticated = true;
|
|
472
483
|
|
|
484
|
+
if (_InvokeSetupCallback && typeof(_InvokeSetupCallback) == 'function')
|
|
485
|
+
{
|
|
486
|
+
_InvokeSetupCallback(pRequest, pResponse, typeof(pOptions) === 'object' && pOptions);
|
|
487
|
+
}
|
|
473
488
|
return fStageComplete();
|
|
474
489
|
},
|
|
475
490
|
function(fStageComplete)
|
|
@@ -514,6 +529,8 @@ var MeadowEndpoints = function()
|
|
|
514
529
|
// Expose the DAL
|
|
515
530
|
DAL: _Meadow,
|
|
516
531
|
|
|
532
|
+
getInvokeSetupCallback: getInvokeSetupCallback,
|
|
533
|
+
setInvokeSetupCallback: setInvokeSetupCallback,
|
|
517
534
|
invokeEndpoint: invokeEndpoint,
|
|
518
535
|
|
|
519
536
|
// Factory
|
|
@@ -1538,6 +1538,35 @@ suite
|
|
|
1538
1538
|
{
|
|
1539
1539
|
var tmpCreatedRecordGUID;
|
|
1540
1540
|
|
|
1541
|
+
test
|
|
1542
|
+
(
|
|
1543
|
+
'invoke: setup method is called',
|
|
1544
|
+
function(fDone)
|
|
1545
|
+
{
|
|
1546
|
+
_MockSessionValidUser.UserRoleIndex = 2;
|
|
1547
|
+
let setupCallCount = 0;
|
|
1548
|
+
let passedRequest, passedResponse, passedOriginalRequest;
|
|
1549
|
+
_MeadowEndpoints.setInvokeSetupCallback((req, res, origReq) =>
|
|
1550
|
+
{
|
|
1551
|
+
++setupCallCount;
|
|
1552
|
+
passedRequest = req;
|
|
1553
|
+
passedResponse = res;
|
|
1554
|
+
passedOriginalRequest = origReq;
|
|
1555
|
+
});
|
|
1556
|
+
const originalRequest = {UserSession: _MockSessionValidUser};
|
|
1557
|
+
_MeadowEndpoints.invokeEndpoint('Read', {IDRecord: 2}, originalRequest,
|
|
1558
|
+
function(pError, pResponse)
|
|
1559
|
+
{
|
|
1560
|
+
Expect(setupCallCount).to.equal(1);
|
|
1561
|
+
Expect(passedOriginalRequest).to.equal(originalRequest);
|
|
1562
|
+
Expect(passedRequest).to.be.an('object');
|
|
1563
|
+
Expect(passedResponse).to.be.an('object');
|
|
1564
|
+
|
|
1565
|
+
fDone();
|
|
1566
|
+
}
|
|
1567
|
+
);
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1541
1570
|
test
|
|
1542
1571
|
(
|
|
1543
1572
|
'invoke create: create a record',
|