Azure / Azure/azure-functions-nodejs-worker

Publish types package for core api

Open
#567 1 comment 0 reactions 0 assignees View on GitHub
area:nodejs-functions feature P1 v4 model 🚀
Dominant language
TypeScript
Stars
110
Forks
51
Avg merge
1d 1h
Merged PRs (30d)
2

Description

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](https://github.com/ejizba/func-nodejs-prototype#split-up-the-worker) for some more background. Here is example usage as described in https://github.com/Azure/azure-functions-nodejs-worker/pull/548:
```typescript
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](https://github.com/Azure/azure-functions-nodejs-worker/issues/537) as a module export. Example usage described [here](https://github.com/Azure/azure-functions-nodejs-worker/issues/522#issuecomment-1034609167).

## 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](https://github.com/Azure/azure-functions-nodejs-worker/pull/548#discussion_r833652131))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.