praekeltfoundation / vumi-jssandbox-toolkit Goto Github PK
View Code? Open in Web Editor NEWVumi JavaScript Sandbox toolkit.
License: BSD 3-Clause "New" or "Revised" License
Vumi JavaScript Sandbox toolkit.
License: BSD 3-Clause "New" or "Revised" License
Currently InteractionMachine.err
handles errors all by itself. We should allow user applications a chance to do the high-level processing of the error themselves (falling back to the current behaviour if the application error handler throws an exception or indicates that it'd like default error processing to continue).
Some transports sometimes need special hints on how to handle messages.
A simple example is Rich Media Messages in WeChat.
But other things are:
Enter your ID number and press #
for example.praekeltfoundation/vumi#735 adds this to the real resource, we should support it in the toolkit too.
Sandbox version: vumigo_v01
See https://gist.github.com/imsickofmaps/9111647 for example of error log
Currently the test framework immediately returns results for http calls, that's not how things will happen in production.
Having a configurable delay in the fixtures would help, a default of 100ms would probably be OK?
It would help indicate where too many http calls are being made for production (even though they're snappy in the tests).
The check would be on a configurable maximum message length (set in the config
for the JS app) and would log a warning if the content is too long.
The test harness already checks this but a check in production would help pick up odd errors (e.g. where the aggregator ends the USSD session because the reply is too long) more quickly. Sometimes production replies are longer than test replies (e.g. because dynamic content is included in the replies).
User
s emit events like user:new
, user:load
and State
s emit events like state:enter
. This means attaching listeners looks something like this:
user.on('user:new', function() {
...
})
This feels a little redundant, since we already know that the object emitting the event is a user. Event names like session:new
make sense, I think, since they happen on the interaction machine.
This is so that tests can run with the proposed 'contacts.search' API in praekeltfoundation/vumi-go#809.
The only helper missing (other than GroupStore
). Would be great to have this out when we do a final release for v02.
This will be helpful for things like setting language data.
Currently we try to access .forEach
on undefined and throw a rather obscure error.
We need a way of toggling auto-following so that we don't have to manually follow people in order to send DMs to them or get DMs from them.
Currently getting this to work involves reading a lot of source code, figuring out what the tool chain looks like and how the python PO utilities & scripts work.
We currently have utils that look something like:
function url_encode(url, params) {
...
}
function url_decode(url) {
...
}
Url encoding params (without a url) is needed often enough that it probably makes sense to split these out into their own utilities.
This should be in the form of mini-applications that exercise a feature. Each should appear in the documentation and be tested. We need:
Once those are done, we can add examples as needed.
Especially ones that return JSON.
Currently all response
values are assumed to be strings that represent regex patterns. We should instead allow responses to be either regexes or strings and do a pattern match for regexes and an exact match for strings.
E.g.
// regular expression match
tester.check_state({
response: /^foo.*$/
})
// exact string match
tester.check_state({
response: "foo"
})
Currently, we do this:
return new ChoiceState(name, {
question: "Coffee or tea?",
choices: [
new Choice('coffee', "Coffee"),
new Choice('tea', 'Tea')
],
next: function(choice) {
return {
coffee: 'states:coffee',
tea: 'states:tea',
}[choice.value];
}
});
It would be nice if we could do this too:
return new ChoiceState(name, {
question: "Coffee or tea?",
choices: [{
value: 'coffee',
label "Coffee"
}, {
value: 'tea',
label "Tea"
})]
next: function(choice) {
return {
coffee: 'states:coffee',
tea: 'states:tea',
}[choice.value];
}
});
A lot of JS apps that use sms sending as part of a USSD session do so using the outbound.send_to_tag
method, it would be nice if there was a helper method available for that which uses/exposes the new endpoint based routing.
Translation is currently a pretty obscure matter.
These are generically useful and are already being copied around a lot.
The BookletState
and PaginatedChoiceState
provide similar navigation options but for historical reasons there constructor arguments are completely different. We should standardize on one set of navigation arguments before doing an official release of version 2.
At the moment, we publish nacks, but don't log anything.
The HTTPClientResource
allows for those options but there the HTTP API doesn't expose them.
This was started in #7 but still needs quite a lot of work.
Once #217 lands we will have support for helper_metadata on replies, but not for setting it on non-reply outbound sends (it would be cool to be able to support triggering a voice call from a USSD menu the way we support triggering an SMS).
The default metric store name is the app name, and the store name needs to be lowercase.
It'd be convenient to have the new BookletState on the NPM registry.
I happen to guessed what it's expecting from the go-di project.
{
name: 'name of state',
creator_opts: {
foo: 'bar'
}
}
At the moment, it is difficult to tell why a fixture doesn't match a real request, especially for cases where the bodies are non-trivial. It would be great if we could make use of mocha's showDiff
error flag to show these diffs in a way that it is easy to figure out the reason for mismatches.
We somehow don't have this yet.
Complains "has no method set_user_lang". Current work around is: https://github.com/praekelt/go-di/blob/develop/src/app.js#L256-L270
Currently on_enter handlers are called twice for states that aren't end states. Once when the state is first transitioned to for displaying and a second time when the state is loaded in order to process user input.
At the moment, the documentation suggests we support the delivery class being given explicitly, but we actually dont.
Currently one can't trigger metrics helper metrics on delegator states because those don't have events fired. This is a thorny problem and I'm not entirely sure what the solution is.
It would be ideal if this would also work if a special timeout state is interjected like in go-refugeerights state_timed_out
.
But it does in production as JSON.parse("") throws errors.
This would be really useful for applications that are running the same codebase on two conversations (like SMS and USSD). Sometimes the responses you give to the user or logging you want to do is defined by the transport.
Including:
This should use Go's send_to_tag
method on the outbound resource.
We need an example of how to write ones own replacement for InteractionMachine
(useful for applications that aren't at all like state machines).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.