Skip to content

Conversation

@kschiew
Copy link

@kschiew kschiew commented Aug 31, 2023

This PR exposes the Rules API for TypeScript SDK users to calculate dynamic derived data.

Features:

  • New function rules() which sends a POST request to sgID Rules Engine server to retrieved the dynamic derived data.

Improvements:

  • Add commas behind every JSDoc comments for consistency.

Before & After Screenshots

BEFORE:
image
AFTER:
image

Tests

Tested locally on an sgid-test-app draft PR via npm pack.

Deploy Notes

New dependencies:

New dev dependencies:

Copy link
Contributor

@PrawiraGenestonlia PrawiraGenestonlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left comments!

Copy link
Contributor

@PrawiraGenestonlia PrawiraGenestonlia left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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',
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants