-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add rules API #65
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add test cases?
} | ||
return await response.json() | ||
} catch (err) { | ||
return Promise.reject((err as Error).message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Promise.reject((err as Error).message) | |
throw new Error(err) |
const response = await fetch(this.rulesEngineEndpoint, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using application/x-www-form-urlencoded
instead of json?
This PR exposes the Rules API for TypeScript SDK users to calculate dynamic derived data.
Features:
rules()
which sends a POST request to sgID Rules Engine server to retrieved the dynamic derived data.Improvements:
Before & After Screenshots
BEFORE:
AFTER:
Tests
Tested locally on an
sgid-test-app
draft PR vianpm pack
.Deploy Notes
New dependencies:
"[email protected]"
: To make HTTP requests to sgID Rules Engine server.New dev dependencies:
@types/[email protected]
: For TS typing.