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

Namespace all types by their API version #16

Closed

Conversation

boourns
Copy link
Contributor

@boourns boourns commented Nov 11, 2021

🔴 FOR DISCUSSION 🔴

I'm exploring an approach for the WAM2 API/SDK to support WAMs built with older versions of the API/SDK.

The general idea is that, when an older WAM is loaded, WamEnv will need to wrap the older WAM with a shim object that implements backwards compatibility, so that the rest of the system can treat the old WAM as if it were built with the current SDK version.

One requirement to do this easily will be to know the typescript definitions for older WAM SDKs. So the idea here is, each API version defines its types inside a Vx.y.z namespace, and then the API exposes the "current" versions.

I'm interested in your thoughts, alternative approaches, whether you agree this is a problem we need to solve, ...

Some things I'm uncertain about:

  • can we move the export const definitions out of types.d.ts and into the versioned namespace.
  • should versions be wrapped in a module, or a namespace?

Next steps, other problems that would need to be solved as well:

  • On load WAMs made with an older SDK version should be wrapped with an interop layer to upgrade them to the newer SDK version
  • Similarly, the WamEnv that is exposed to a WAM built with an older SDK would have to implement the older WamEnv API. This will likely require refactoring the WamEnv interface that a WAM sees, so that we can easily shim this layer to what the older WAM would expect. For example WAMs should not be able to get direct references from one to another, or else we'd need to have shims all OVER the place 😬

@boourns
Copy link
Contributor Author

boourns commented Nov 12, 2021

I think I found a less intrusive way to implement a shim for WAMs built with older SDKs, so closing this

@boourns boourns closed this Nov 12, 2021
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.

1 participant