Call Async Module from custom FormController - 2sxc

I need to call a custom DLL which has async calls to an API. I'm customising Mobius Forms App.
I've got stuck on the requirement that you can only call use the await operator from an async method.
If I make the ProcessForm method Async, I get the following exception:
AbsoluteURL:
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:4064be2b-8f04-4901-8b38-17eb9de37837
AssemblyVersion:
PortalId:-1
UserId:-1
TabId:-1
RawUrl:
Referrer:
UserAgent:
ExceptionHash:yaIM8BQCHlxRCrt3EOwJqHPijZ4=
Message:Thread was being aborted.
StackTrace:
at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.Start()
InnerMessage:
InnerStackTrace:
Source:mscorlib

I believe this may simply not be implemented yet. Here some background
When a URL comes in which looks like a 2sxc API, the 2sxc engine will see if it finds an XXXController.cs and compile it. It then returns that to the .net / DNN API management which will then invoke the code, map parameters etc.
I could imagine that for async to work, it would need to support another interface or something. My guess is it's not a big deal, but I would need some example to start with, so I could help implement it.
Could you:
Create an issue on https://github.com/2sic/2sxc/issues
Add some more information on these async calls
Ideally with some example (not in 2sxc, but C# and .net 4.8) which does this?
Ideally it would actually be a DNN example, so I don't have to worry if DNN might actually block this or cause issues.
thx!

Related

How get device location using action builder

i'm writing to you to ask a little support about an action that we are currently developing using Action Builder and webhook library #assistant/conversation for Nodejs.
In particular, we would invoke our webhook's logic using the device location.
We have understand that we must ask the user permission to access on device location using something like this:
https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/PermissionValueSpec
but in all Github examples provided by Google nothing is specified.
Furthermore, we tried to integrate the PermissionValueSpec in a slot using the notification actions.type.Notifications, but the returned value of that slot is
PermissionLocation --> ALREADY_GRANTED without any other information about the device coordinates.
We've read a lot of documentation and also looked for some example to support our develop but nothing was found.
How we can get the current device location?
Thank you in advance!

Recommended way to get payment methods/configurations in Intershop 7.10

Intershop 7.10, I am trying to understand what is a recommended way to retrieve payment methods/configurations for a domain.
I have examined ViewPaymentMethodList_52-ListAll pipeline in sld_ch_consumer_plugin cartridge and I see that it is using a deprecated pipelet GetPaymentConfigurationsByDomain, and when I examine that pipelet I see that it is using PaymentServiceMgr which is also deprecated.
What would be non-deprecated way to do that.
EDIT:
I am trying to access whether the payment method is enabled or disabled for a given application:
Haven't tested it, but the information you're trying to get should become available when calling:
PaymentConfiguration config = paymentServiceBO.
getExtension(PersistenObjectBOExtension.class).getPersistentObject();
// retrieve the list of activated application ids
config.createApplicationIDsIterator();

Firebase - Firestore - create a function to verify if a user exists in Auth

I want to verify if a user exists in the Authentication list of users in firebase. I know I can use:
admin.auth().getUserByEmail(email)
admin.auth().getUser(uid)
I am building a react native app, so I can't install firebase-admin since it would require I ship credentials in the app, which is too dangerous, since someone can do reverse engineering and find them.
I have found I can write functions, so I have created a separate project to create and deploy functions, this will work as a backend.
Now I want to create a function there that uses firebase-admin and to be able to use the 2 methods listed above.
I found I can create:
exports.addMessage = functions.https.onCall((data, context) => {
// ...
});
and call it like:
var addMessage = firebase.functions().httpsCallable('addMessage');
addMessage({text: messageText}).then(function(result) {
// Read result of the Cloud Function.
});
Not sure if using https.onCall is the best for this case or is there a better way.
Thanks in advance.
As far as the documentation indicates - accessible here - and the fact that the https.onCall() uses a safe method to be called (HTTPS) I believe that this is the best option for your case, since installing firebase-admin doesn't fit your case.
The official documentation Protocol specification for https.onCall also says:
If you are able to use the Android, iOS, or web SDKs, you're recommended to do that instead of directly implementing this protocol. The SDKs provide features to save coding time and effort, as detailed in Call Functions from Your App
So, this is indicated, in case you don't want/can use the SDK, which I believe it's what you are saying. Considering that, I believe that the https.onCall() it's the option for your situation.
Let me know if the information helped you!

How to connect Adobe Captivate XApi course with YetAnalytics or LRS (Learning record system)?

I am trying to connect my Adobe Captivate XApi course to the LRS (YetAnalytics). I have very less information as to what should i add in this code of tc-onfig.js in the course files:
// Pre-configured LRSes that should receive data, added to what is included
// in the URL and/or passed to the constructor function.
//
// An array of objects where each object may have the following properties:
//
// endpoint: (including trailing slash '/')
// auth:
// allowFail: (boolean, default true)
// version: (string, defaults to high version supported by TinCanJS)
//
TC_RECORD_STORES = [
{
endpoint : "",
auth : "",
allowFail: ,
version: "",
}
];
Generally you should avoid using that functionality. That code is leveraged by an underlying library in Captivate (Rustici Driver) for packages with a tincan.xml file. That package will be launched with an LRS endpoint and authentication credential which is where it will send the statements that it generates. Generally it is a much better idea to send all statements to that configured LRS and then figure out a way to get those statements either forwarded from or pulled from that LRS into your additional LRS(s).
This is for two main reasons. First by using this functionality you have to hard code a credential into the package which makes it insecure and indistinguishable during requests, this is generally just bad. Second, there is little to no error handling around calls that leverage this functionality, so if you set allowFail to false exceptions will go uncaptured and the content will likely behave in strange ways (or break completely), if you set allowFail to true then you will have no recourse when a call fails and you potentially will not know that you've lost data.
(Unfortunately, I know this because I implemented the functionality originally a very long time ago before fully understanding all of the ramifications.)
But just so I've answered your actual question, if you wish to not heed my advice, then the values that should go there will be passed through to the constructor for a TinCan.LRS object which is documented here: http://rusticisoftware.github.io/TinCanJS/doc/api/latest/classes/TinCan.LRS.html
The auth being the most tricky, it should be a value that is a full Authorization header value as needed to connect to the LRS, very often a Basic Auth header.

MarkLogic I don't know how to get all the result

Hello I am trying to read a module with this code:
(: Entry point - must be a read-only query. :)
xdmp:invoke(
'/path/mydocument.xqy',
(xs:QName('var1'), 'test',
xs:QName('var2'), "response"))
I am new in MarkLogic, I am using groovy and the api to connect to it, but also I saw I can invoke the module with this and indeed I did but it returns me
your query returned an empty sequence
I want to know if I can query xs:QName('var1'), 'test', changing test with a wildcard or how can I get all the information from the file called /path/mydocument.xqy?
I tried to use this:
xdmp:document-get("/path/mydocument.xqy)
but it says the file is not found. Although, if I use invoke I can query it, but I don't know what are the values I have to pass. I was wondering if there is something like sql using %% or something to give me all the data.
To answer the first question: "I am trying to read a module "
IF the module is in the database, then you must query the Modules database in which the module resides.
If the module is in the filesystem then you cannot directly access its source as a document but you can by executing xdmp:filesystem-file()
Simplification:
With the Default configuration of the server and REST client, user placed modules are in the "Modules" database and user placed documents are in the "Documents" database. This means, if you do a GET (read a "Document") with no additional parameters, it will return documents from the "Documents" database. Assuming you are using the default configuration for client and server, this would result in the behavior you are seeing. E.g. your Module code is in the Modules database, doing a GET for it by name will search the Documents database and correctly not find it.
You don't mention, and I don't know, the groovy library being used, but the REST API itself and all implementations of general purpose ML REST client libraries I am familiar with have options for overriding the default database with another. If the groovy library supports that, then specify the "Modules" database for your query and it should return the module document. Note: content-type will be application/text not text/xml.
You can simplify things for testing by bypassing the libraries and simply use a browser and try a URL like this http://yourserver.com:8000/v1/documents?uri=/your/module.xqy&database=Modules
Ref: https://docs.marklogic.com/REST/GET/v1/documents
Making the appropriate changes to the path and server for your use.
If you are still confused, then you should start with the basic MarkLogic tutorials and work through them one by one. You will most likely succeed faster by doing this then jumping straight into coding you don't understand yet.
DETAIL:
Note: The default behaviour is to EXECUTE documents when doing a GET call, using the Modules database. Thus doing a GET of http://yourserver:8000/your/module.xqy will EXECUTE it not return its source.
You will notice the REST API has a uri query parameter. This is EXECUTING the REST API code on /v1/documents which in turn will read the document specified by the uri and database parameters and return it.
I guess I can use:
xdmp:invoke(/pview/get-pview-browse-profiles.xqy,
cts:and-query((
cts:element-value-query(
xs:QName("letter"),"*", "wildcarded"),
cts:element-value-query(
xs:QName("collection"),"*", "wildcarded"))))
although it doesn't return anything

Resources