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