Skip to content

Conversation

@Hybrid-Force
Copy link
Contributor

Add MongoDB ObjectId support as context variables, and hopefully other types of objects with toJSON methods returning strings.

@Hybrid-Force Hybrid-Force force-pushed the object-id-context-variable branch from b4ce929 to e92c138 Compare August 18, 2022 13:24
if (Array.isArray(value)) return `{${value}}`;
if (value instanceof Object) return 'undefined';
if (value instanceof Object) {
const json = value.toJSON?.();
Copy link
Owner

Choose a reason for hiding this comment

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

I'm seeing that the error is coming from this line because of the .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Optional chaining is not supported in Node 13 and below. I will fix it.

Copy link
Owner

@roggervalf roggervalf left a comment

Choose a reason for hiding this comment

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

Thank you @Hybrid-Force, just for curiosity, how are you using this package?

@roggervalf roggervalf merged commit ecb3dbc into roggervalf:master Aug 18, 2022
github-actions bot pushed a commit that referenced this pull request Aug 18, 2022
# [4.17.0](v4.16.0...v4.17.0) (2022-08-18)

### Features

* **apply-context:** support objects with toJSON method as context variables ([#88](#88)) ([ecb3dbc](ecb3dbc))
@github-actions
Copy link

🎉 This PR is included in version 4.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Hybrid-Force Hybrid-Force deleted the object-id-context-variable branch August 19, 2022 14:12
@Hybrid-Force
Copy link
Contributor Author

Thank you @Hybrid-Force, just for curiosity, how are you using this package?

Thanks for this great lib! I am using it for API access control of a multi-tenant app that I am working on.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants