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

Adds support for typescript #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KellyBennett
Copy link

@KellyBennett KellyBennett commented Dec 9, 2020

Hello!

Thanks for the documentation explaining how to debug our PlayFab ExecuteFunction calls locally. It's been super helpful!

We've decided to use TypeScript for our functions, but still want to be able to debug locally. To this end, I've added support for debugging with TypeScript.

I based my TypeScript code off the csharp file provided by this repo. However, I decided it was best to proceed slightly differently with the TypeScript implementation.

Because I wanted to be sure that the code I'm providing is tested, I thought it might make sense to create a project specifically for the ExecuteFunction implementation. In this way it's possible to include a test suite, and to provide versioning to end users.

The intention is that this code can be injected via an npm repository . I suppose I'd remove my npm package and y'all could manage publishing to your own npm package so that I'm not the only person with publishing credentials 😅

After installing the npm package, one just needs to create a function.json file and a small js wrap around the imported function (this is all explained in the included readme)

I also added the function.json file and everything else needed to run this locally as a stand-alone project— I'm not sure this is beneficial 🤷

Thanks for considering my PR!

mockedAxios.mockRestore();
});

it('Returns a 200 when Entity is present in the request body', async () => {
Copy link
Author

Choose a reason for hiding this comment

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

I assume if no Entity is provided in the request body, we still want the call to succeed? Just calling this out here because I'm not 100% what circumstances lead to this happening, or what the expected behavior is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, if no entity is provided in the body, the entity in the entity token is used. Passing an entity in the body allows a title to execute a function as a player, for example. But if the title just wanted to execute a function as itself, it can just pass its entity token as normal and not specify an entity in the request body. Most functions are called by players, but we have some cases where customers are calling using a title entity token (see #9)

@MGudgin
Copy link
Contributor

MGudgin commented Dec 9, 2020

Thanks for submitting this PR. I will try to get to it soon, but it might not be until January as I'm taking time off starting early next week.

Base automatically changed from master to main March 5, 2021 08:35
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.

3 participants