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

Publish types package for core api #567

Open
ejizba opened this issue Apr 5, 2022 · 1 comment
Open

Publish types package for core api #567

ejizba opened this issue Apr 5, 2022 · 1 comment
Labels
feature P1 v4 model 🚀 Related to the new V4 programming model

Comments

@ejizba
Copy link
Contributor

ejizba commented Apr 5, 2022

This work is partially done already, but we are open to changes so I want an issue for potential feedback and to track any remaining work.

The main idea is that we want users to provide information (i.e. hooks and functions) programmatically, meaning we need to define an API in which they can do that. As a part of the hooks feature, we settled on a "built-in" module named @azure/functions-core. See here for some more background. Here is example usage as described in #548:

import { registerHook } from '@azure/functions-core';

registerHook('preInvocation', (context: PreInvocationContext) => {

});

The main alternative we have considered is for the user to return hooks/functions in a startup file as a module export. Example usage described here.

Remaining work

  • Create and publish a @types/azure_functions-core package
  • Improve es modules support. Currently users have to use require instead of import (workaround here)
@itpropro
Copy link

itpropro commented Jun 6, 2022

I really like the more functional approach, as it fits better into the current JS ecosystem. Having as much tasks done by code (referring to #569) as possible should be the goal as well of getting rid of the requirement of having multiple separate files (we already have function.json, host,json, extensions, etc.) and of course not introducing new like the startup one.
The JS/TS world already has a lot of options regarding modularization, I think it should be decided by the developer which way he wants to go with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature P1 v4 model 🚀 Related to the new V4 programming model
Projects
None yet
Development

No branches or pull requests

2 participants