Skip to content
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: Support Cmi5 from the backend #266

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

emmanuel
Copy link
Contributor

@emmanuel emmanuel commented Jul 16, 2024

Building on #264, this adds an AbstractCmi5 superclass and defines its constructor() to accept LaunchParameters, then make Cmi5 extend that class and contain all window.location references in the Cmi5 subclass.

I'm open to feedback or reworking this. I wanted to get the conversation started with a concrete working implementation to discuss.

Also, I structured this to stack after #264, so please look at the one commit that's distinct in this PR.

@CookieCookson
Copy link
Contributor

@emmanuel Thanks for your contribution, this looks really great!

Would there need to be any additional helper methods for backend scenarios? I'm unsure how you're going to consume the BackendCmi5 class and the role it plays in the wider project.

The general approach here is spot on, if we could get it split up so we have the classes in different files we would have a good candidate.

@emmanuel emmanuel force-pushed the feat/support-backend-cmi5 branch 3 times, most recently from e093c33 to 74c1639 Compare August 22, 2024 21:37
@emmanuel emmanuel force-pushed the feat/support-backend-cmi5 branch from 74c1639 to 8320afa Compare August 22, 2024 21:40
@emmanuel
Copy link
Contributor Author

@CookieCookson I think this is ready for another look now that the first PR landed.

To answer your question: I'm working on a project where we have an AU provider that has a backend component: it is consumed via the browser but scoring and some interactions occur on our backend. Because the launch is initiated via query parameters, one of the first steps when an AU is launched is that our frontend calls our backend with the Cmi5 launch parameters, then we send all xAPI statements from the backend. Not long ago I moved our project over to use your XAPI.js lib from our backend.

I would like to adopt (something like) the BackendCmi5 implementation to handle communication with the LRS (submitting xAPI statements, both cmi5 defined and cmi5 allowed). And then separating the functionality in Cmi5.ts from the assumptions about executing in the browser are the intent of this PR!

@emmanuel
Copy link
Contributor Author

emmanuel commented Aug 22, 2024

There's a 405 from codeclimate; I don't know what that means.

Also, coverage may have marginally decreased (because lines may have grown slightly by me moving things around, and I didn't add any test coverage to offset that).

@CookieCookson
Copy link
Contributor

Sounds great, thanks for clearing up the use case!

Please ignore codeclimate, I've found it to be quite counter productive at times and will most likely end up removing it in the near future. I can bypass the results for it in the CI so we won't have to make any code changes for it.

I'm away for the weekend now but I'll pick this up next week for another review 👀

@emmanuel
Copy link
Contributor Author

@CookieCookson — howdy! Just checking in.

Is this tracking towards landing? And is there anything further you'd like to see done on this PR?

@CookieCookson CookieCookson merged commit 0193342 into xapijs:develop Aug 30, 2024
3 of 4 checks passed
@CookieCookson
Copy link
Contributor

CookieCookson commented Aug 30, 2024

@emmanuel Great stuff, it's all merged in now! I'll do some testing with the CMI5 demo project to ensure its all working as expected for client-side.

EDIT: Demo project seems to be working as before!

@CookieCookson
Copy link
Contributor

@emmanuel Looking at the rollup output, do you need some additional exports for the AbstractCmi5 class so it can be directly imported into your backend code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants