diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml
new file mode 100644
index 00000000..a3a822b3
--- /dev/null
+++ b/.github/auto_assign.yml
@@ -0,0 +1,22 @@
+# Set to true to add reviewers to pull requests
+addReviewers: true
+
+# Set to author to set pr creator as assignee
+addAssignees: author
+
+# A list of reviewers to be added to pull requests (GitHub user name)
+reviewers:
+ - webup
+ - benjaminhuo
+
+# A number of reviewers added to the pull request
+# Set 0 to add all the reviewers (default: 0)
+numberOfReviewers: 1
+
+# A list of keywords to be skipped the process that add reviewers if pull requests include it
+skipKeywords:
+ - wip
+
+# A list of users to be skipped by both the add reviewers and add assignees processes
+skipUsers:
+ - dependabot[bot]
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..ff9f20ba
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,18 @@
+version: 2
+updates:
+ - package-ecosystem: docker
+ directory: '/'
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
+ - package-ecosystem: npm
+ directory: '/'
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
+ labels:
+ - 'type: dependencies'
+ - package-ecosystem: 'github-actions'
+ directory: '/'
+ schedule:
+ interval: 'daily'
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 00000000..7cd8fb8b
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,25 @@
+# Number of labels to fetch (optional). Defaults to 100
+numLabels: '40'
+# These labels will not be used even if the issue contains them (optional).
+# Pass a blank array if no labels are to be excluded.
+# excludeLabels: []
+excludeLabels:
+ - pinned
+# custom configuration to override default behaviour
+# control explicitly what gets added and when
+# custom:
+# - location: title
+# keywords:
+# - enable
+# labels:
+# - enhancement
+# - location: title
+# keywords:
+# - fix
+# labels:
+# - bug
+# - location: title
+# keywords:
+# - doc
+# labels:
+# - documentation
diff --git a/.github/mergeable.yml b/.github/mergeable.yml
new file mode 100644
index 00000000..b60a8513
--- /dev/null
+++ b/.github/mergeable.yml
@@ -0,0 +1,36 @@
+version: 2
+mergeable:
+ - when: pull_request.*
+ name: 'Ingore WIP'
+ validate:
+ - do: title
+ must_exclude:
+ regex: ^\[WIP\]
+ - do: label
+ must_exclude:
+ regex: 'wip'
+ - when: pull_request.*
+ name: 'NO empty description'
+ validate:
+ - do: description
+ no_empty:
+ enabled: true
+ message: Description matter and should not be empty. Provide detail with either **what** was changed, **why** it was changed, or **how** it was changed.
+ - when: schedule.repository
+ name: 'Check stale PR and issues'
+ validate:
+ - do: stale
+ days: 20
+ type: pull_request, issues
+ pass:
+ - do: comment
+ payload:
+ body: This is old. Is it still relevant?
+ - when: pull_request.opened
+ name: 'Greet a contributor'
+ validate: []
+ pass:
+ - do: comment
+ payload:
+ body: >
+ Thanks for creating a pull request! A maintainer will review your changes shortly. Please don't be discouraged if it takes a while.
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
new file mode 100644
index 00000000..f814607c
--- /dev/null
+++ b/.github/release-drafter.yml
@@ -0,0 +1,46 @@
+name-template: 'v$RESOLVED_VERSION'
+tag-template: 'v$RESOLVED_VERSION'
+template: |
+ # What's Changed
+
+ $CHANGES
+
+ **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
+
+categories:
+ - title: '💥 Breaking'
+ label: 'type: breaking'
+ - title: '✨ New'
+ label: 'type: feature'
+ - title: '🐛 Bug Fixes'
+ label: 'type: bug'
+ - title: '🏗️ Maintenance'
+ label: 'type: maintenance'
+ - title: '🔒 Security'
+ label: 'type: security'
+ - title: '👷 CI/CD'
+ label: 'type: cicd'
+ - title: '📝 Documentation'
+ label: 'type: docs'
+ - title: 'Other changes'
+ - title: '🏷️ Dependency Updates'
+ label: 'type: dependencies'
+ collapse-after: 5
+
+version-resolver:
+ major:
+ labels:
+ - 'type: breaking'
+ minor:
+ labels:
+ - 'type: feature'
+ patch:
+ labels:
+ - 'type: bug'
+ - 'type: maintenance'
+ - 'type: docs'
+ - 'type: dependencies'
+ - 'type: cicd'
+
+exclude-labels:
+ - 'skip-changelog'
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 20b27141..d941c706 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -8,9 +8,9 @@ jobs:
docs:
runs-on: ubuntu-18.04
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup Node.js
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install dependencies
diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml
new file mode 100644
index 00000000..cf6d8307
--- /dev/null
+++ b/.github/workflows/draft.yml
@@ -0,0 +1,14 @@
+name: Release Drafter
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: release-drafter/release-drafter@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index ab550247..a09f2ce5 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -8,9 +8,9 @@ jobs:
lint:
runs-on: ubuntu-18.04
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup Node.js
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
- name: Install dependencies
run: npm install
- name: Build TypeScript project
diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml
new file mode 100644
index 00000000..acdd08e4
--- /dev/null
+++ b/.github/workflows/reviewdog.yml
@@ -0,0 +1,20 @@
+name: reviewdog
+on: [pull_request]
+jobs:
+ tsc:
+ name: runner / tsc
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: EPMatt/reviewdog-action-tsc@v1
+ with:
+ # Change reviewdog reporter if you need
+ # [github-pr-check,github-check,github-pr-review].
+ # More about reviewdog reporters at
+ # https://github.com/reviewdog/reviewdog#reporters
+ reporter: github-pr-review
+ # Change reporter level if you need
+ # [info,warning,error].
+ # More about reviewdog reporter level at
+ # https://github.com/reviewdog/reviewdog#reporters
+ level: warning
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index e4fbaa74..4ef0738e 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -9,13 +9,13 @@ jobs:
strategy:
matrix:
node-version: [16]
- platform: [ubuntu-latest, macos-latest]
+ platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dapr
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c580e3d7..0914ad38 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,17 @@
[1]: https://www.npmjs.com/package/@openfunction/functions-framework?activeTab=versions
+## 0.5.0 / 2022-05-27
+
+We are having a standalone `openfunction` signature type starting from this release!
+
+Now you can use `function (ctx, data)` as the function signature along with `openfunction` signature type, this allows you to use sync functions in a far more flexible way - whenever there are functions output requirements, sync functions can also send output to Dapr output binding or pubsub components.
+
+Check the demo of HTTP request triggering async function:
+
+- Quickstart:
+- Sample:
+
## 0.4.1 / 2022-04-17
This feature release offically introduces the support of OpenFunction async function runtime, now your Node.js functions can enjoy the power of Dapr runtime starting from bindings and pubsub. Functions Framework will call [Dapr Node.js SDK](https://github.com/dapr/js-sdk) to bridge the communication with various Dapr input/output bindings or pubsub brokers components.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0d5aec42..4c9412c2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,26 +1,16 @@
# How to Contribute
-We'd love to accept your patches and contributions to this project. There are
-just a few small guidelines you need to follow.
+We'd love to accept your patches and contributions to this project. There are a few small guidelines you need to follow.
## Contributor License Agreement
-Contributions to this project must be accompanied by a Contributor License
-Agreement. You (or your employer) retain the copyright to your contribution;
-this simply gives us permission to use and redistribute your contributions as
-part of the project. Head over to to see
-your current agreements on file or to sign a new one.
+Contributions to this project must be accompanied by a Developer Certificate of Origin (DCO). You (or your employer) retain the copyright to your contribution; this gives us permission to use and redistribute your contributions as part of the project. Head over to to see your current agreements on file or to sign a new one.
-You generally only need to submit a CLA once, so if you've already submitted one
-(even if it was for a different project), you probably don't need to do it
-again.
+You only need to submit a DTO once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
## Code reviews
-All submissions, including submissions by project members, require review. We
-use GitHub pull requests for this purpose. Consult
-[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
-information on using pull requests.
+All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
## Testing
@@ -28,34 +18,27 @@ information on using pull requests.
All pull requests should have an associated test to ensure foward compatibility.
+> Make sure you have installed [Dapr](https://dapr.io/) before running unit tests, check out [Install Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) for more details
+
To run an individual test, you can run a command such as the following:
-```
+```sh
npm run test -- -g 'loading function'
```
-### Conformance Tests
-
-To run the conformance tests, first install Go 1.16+, then run the tests:
-
-```
-npm run conformance
-```
-
### Manual Testing
-When developing a feature locally, you can install a local version of the Functions Framework
-using `npm link`. First compile your local clone of the Functions Framework:
+When developing a feature locally, you can install a local version of the Functions Framework using `npm link`. First compile your local clone of the Functions Framework:
> You'll need to install typescript first by: `npm install typescript --save-dev`
-```
+```sh
npx tsc
```
Then link the Functions Framework using `npm link`.
-```
+```sh
npm link
```
@@ -65,7 +48,7 @@ You can then run the Functions Framework locally using `functions-framework`.
This module is published using Release Please. When you merge a release PR, the npm package will be automatically published.
-```shell
+```sh
# Login to npm registry, contact repo admin for https://www.npmjs.com/ user name and password
npm login
# First run a dry run to find out errors
@@ -73,6 +56,7 @@ npm publish ./ --access public --dry-run
# Then publish the package
npm publish --access public
```
+
### Reverting a Publish
If the release process fails, you can revert the publish by running the following (i.e. unpublishing `1.10.0`):
@@ -101,5 +85,4 @@ The docs will be generated in [`docs/generated/`](docs/generated/).
## Community Guidelines
-This project follows [Google's Open Source Community
-Guidelines](https://opensource.google.com/conduct/).
+This project follows [CNCF openness guidelines](https://www.cncf.io/blog/2019/06/11/cncf-openness-guidelines/).
diff --git a/README.md b/README.md
index e6564cad..9dd366fc 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,16 @@
[![Node unit CI][ff_node_unit_img]][ff_node_unit_link] [![Node lint CI][ff_node_lint_img]][ff_node_lint_link]
-> This is OpenFunction's nodejs functions-framework forked from [GCP functions-framework-nodejs](https://github.com/GoogleCloudPlatform/functions-framework-nodejs)
+
+
+---
+
+> This is OpenFunction's Node.js Functions Framework forked from [GCP functions-framework-nodejs](https://github.com/GoogleCloudPlatform/functions-framework-nodejs).
An open source FaaS (Function as a Service) framework based on [Express](https://expressjs.com/)
and [Restana](https://github.com/BackendStack21/restana) for writing portable sync and async Node.js functions.
-The Functions Framework lets you write lightweight functions that run in many
-different environments, including:
+The Functions Framework lets you write lightweight functions that run in many different environments, including:
* [OpenFunction](https://github.com/OpenFunction/OpenFunction)
* [Knative](https://github.com/knative/)-based environments
@@ -101,8 +104,7 @@ npm install @openfunction/functions-framework
npm install @openfunction/functions-framework
```
-1. Add a `start` script to `package.json`, with configuration passed via
-command-line arguments:
+1. Add a `start` script to `package.json`, with configuration passed via command-line arguments:
```js
"scripts": {
@@ -160,15 +162,13 @@ command-line arguments:
## Configure the Functions Framework
-You can configure the Functions Framework using command-line flags or
-environment variables. If you specify both, the environment variable will be
-ignored.
+You can configure the Functions Framework using command-line flags or environment variables. If you specify both, the environment variable will be ignored.
| Command-line flag | Environment variable | Description |
| ------------------ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--port` | `PORT` | The port on which the Functions Framework listens for requests. Default: `8080` |
| `--target` | `FUNCTION_TARGET` | The name of the exported function to be invoked in response to requests. Default: `function` |
-| `--signature-type` | `FUNCTION_SIGNATURE_TYPE` | The signature used when writing your function. Controls unmarshalling rules and determines which arguments are used to invoke your function. Default: `http`; accepted values: `http` or `event` or `cloudevent` |
+| `--signature-type` | `FUNCTION_SIGNATURE_TYPE` | The signature used when writing your function. Controls unmarshalling rules and determines which arguments are used to invoke your function. Default: `http`; accepted values: `http` or `event` or `cloudevent` or `openfunction` |
| `--source` | `FUNCTION_SOURCE` | The path to the directory of your function. Default: `cwd` (the current working directory) |
You can set command-line flags in your `package.json` via the `start` script.
@@ -196,7 +196,52 @@ Dapr bindings allows you to trigger your applications or services with events co
Asynchronous function introduces Dapr pub/sub to provide a platform-agnostic API to send and receive messages. A typical use case is that you can leverage synchronous functions to receive an event in plain JSON or Cloud Events format, and then send the received event to a Dapr output binding or pub/sub component, most likely a message queue (e.g. Kafka, NATS Streaming, GCP PubSub, MQTT). Finally, the asynchronous function could be triggered from the message queue.
-More details would be brought up to you in some quickstart samples, stay tuned.
+Async function use below function signature which is quite difference from that of Express style sync function:
+
+```js
+function (ctx, data) {}
+```
+
+* `ctx`: OpenFunction [context](https://github.com/OpenFunction/functions-framework-nodejs/blob/master/src/openfunction/function_context.ts) object
+ * `ctx.send(payload, output?)`: Send `payload` to all or one specific `output` of Dapr Output [Binding](https://docs.dapr.io/reference/components-reference/supported-bindings/) or Pub [Broker](https://docs.dapr.io/reference/components-reference/supported-pubsub/)
+ * Notice that `ctx.send` CAN be invoked where necessary, when you have certain outgoing data to send
+* `data`: Data recieved from Dapr Input Binding or Sub Broker
+
+For more details about async function and demo, please check out our [Node.js Async Function Quickstart](https://openfunction-talks.netlify.app/2022/202-node-async/).
+
+#### HTTP Trigger Async Function
+
+Sync functions is triggered by HTTP request, so Dapr is not used in sync function input. Whenever there are functions output requirements, sync functions can also send output to Dapr output binding or pubsub components.
+
+Here is another function sample:
+
+* Users send a HTTP request to a [Knative Sync function](https://github.com/OpenFunction/samples/tree/main/functions/knative/with-output-binding).
+* This sync function handles the request and then send its output to Kafka through a Dapr Kafka output binding or pubsub component.
+* An [async function](https://github.com/OpenFunction/samples/tree/main/functions/async/bindings/kafka-input) is then triggered by this output event in Kafka (through a Dapr Kafka input binding or pubsub component)
+
+
+
+Node.js Functions Framework also supports such use case, you can switch Express function signature to typical async style as below example indicates:
+
+```js
+async function tryKnativeAsync(ctx, data) {
+ // Receive and handle data from HTTP request's body
+ console.log('Function should receive request: %o', data);
+
+ // Send output in async way via Dapr
+ await ctx.send(data);
+
+ // Use `ctx.res` object to deal with HTTP response
+ ctx.res.send(data);
+```
+
+Remember that you also need set command-line flags `--signature-type=openfunction`, for example in your `package.json` via the `start` script:
+
+```js
+ "scripts": {
+ "start": "functions-framework --signature-type=openfunction --target=tryKnativeAsync"
+ }
+```
### Google Cloud Functions
@@ -236,12 +281,9 @@ More advanced guides and docs can be found in the [`docs/` folder](docs/).
## Contributing
-Contributions to this library are welcome and encouraged. See
-[CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.
+Contributions to this library are welcome and encouraged. See [CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.
[ff_node_unit_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Unit%20CI/badge.svg
[ff_node_unit_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI"
[ff_node_lint_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg
[ff_node_lint_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI"
-[ff_node_conformance_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Conformance%20CI/badge.svg
-[ff_node_conformance_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Conformance+CI"
diff --git a/docs/README.md b/docs/README.md
index 45815a42..73bc746e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,21 +2,19 @@
This directory contains advanced docs around the Functions Framework.
-- [Testing events and Pub/Sub](events.md)
- [Testing Functions](testing-functions.md)
- [Debugging Functions](debugging.md)
-- [Running and Deploying Docker Containers](docker.md)
-- [Writing a Function in Typescript](typescript.md)
+- [Writing a Function in TypeScript](typescript.md)
- [ES Modules](esm/README.md)
+Also containing sequence diagrams of OpenFunction underlying workflows.
+
+- [OpenFunction in Sync Runtime](uml/OpenFunction%20in%20Sync%20Runtime.png)
+- [OpenFunction in Async Runtime](uml/OpenFunction%20in%20Async%20Runtime.png)
+
## Generated Docs
The `generated/` directory contains generated API references.
- [api.md](generated/api.md)
-- [api.d.ts](generated/api.d.ts)
- [api.json](generated/api.json)
-
-## TODO Docs
-
-- Run Multiple Cloud Functions [#23](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/issues/23)
diff --git a/docs/esm/package-lock.json b/docs/esm/package-lock.json
index 11fbeb43..4f8dda58 100644
--- a/docs/esm/package-lock.json
+++ b/docs/esm/package-lock.json
@@ -895,9 +895,9 @@
}
},
"node_modules/minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"node_modules/ms": {
"version": "2.0.0",
@@ -2093,9 +2093,9 @@
}
},
"minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"ms": {
"version": "2.0.0",
diff --git a/docs/generated/api.json b/docs/generated/api.json
index 3f71fb9c..827731fc 100644
--- a/docs/generated/api.json
+++ b/docs/generated/api.json
@@ -1,8 +1,8 @@
{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
- "toolVersion": "7.19.4",
- "schemaVersion": 1004,
+ "toolVersion": "7.24.0",
+ "schemaVersion": 1005,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
@@ -156,7 +156,8 @@
"@betaDocumentation": true,
"@internalRemarks": true,
"@preapproved": true
- }
+ },
+ "reportUnsupportedHtmlElements": false
}
},
"kind": "Package",
@@ -276,7 +277,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
- }
+ },
+ "isOptional": false
}
]
}
@@ -369,14 +371,16 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
- }
+ },
+ "isOptional": false
},
{
"parameterName": "callback",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
- }
+ },
+ "isOptional": false
}
]
}
@@ -653,7 +657,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
}
],
"name": "IsAsyncRuntime"
@@ -699,7 +704,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
}
],
"name": "IsBindingComponent"
@@ -745,7 +751,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
}
],
"name": "IsKnativeRuntime"
@@ -791,7 +798,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
}
],
"name": "IsPubSubComponent"
@@ -901,14 +909,16 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
},
{
"parameterName": "context",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
- }
+ },
+ "isOptional": false
}
]
}
@@ -984,21 +994,24 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
},
{
"parameterName": "context",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
- }
+ },
+ "isOptional": false
},
{
"parameterName": "callback",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
- }
+ },
+ "isOptional": false
}
]
}
@@ -1022,6 +1035,15 @@
"kind": "Content",
"text": "> = "
},
+ {
+ "kind": "Reference",
+ "text": "OpenFunction",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunction:interface"
+ },
+ {
+ "kind": "Content",
+ "text": " | "
+ },
{
"kind": "Reference",
"text": "HttpFunction",
@@ -1065,12 +1087,7 @@
},
{
"kind": "Content",
- "text": " | "
- },
- {
- "kind": "Reference",
- "text": "OpenFunction",
- "canonicalReference": "@openfunction/functions-framework!OpenFunction:interface"
+ "text": ""
},
{
"kind": "Content",
@@ -1094,7 +1111,7 @@
],
"typeTokenRange": {
"startIndex": 3,
- "endIndex": 14
+ "endIndex": 15
}
},
{
@@ -1188,20 +1205,121 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
},
{
"parameterName": "res",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
- }
+ },
+ "isOptional": false
}
]
}
],
"extendsTokenRanges": []
},
+ {
+ "kind": "Interface",
+ "canonicalReference": "@openfunction/functions-framework!HttpFunctionResponse:interface",
+ "docComment": "/**\n * HTTP response ouput from OpenFunction async function\n *\n * @public\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "export interface HttpFunctionResponse "
+ }
+ ],
+ "releaseTag": "Public",
+ "name": "HttpFunctionResponse",
+ "members": [
+ {
+ "kind": "PropertySignature",
+ "canonicalReference": "@openfunction/functions-framework!HttpFunctionResponse#body:member",
+ "docComment": "/**\n * Body of the response.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "body?: "
+ },
+ {
+ "kind": "Content",
+ "text": "any"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": true,
+ "releaseTag": "Public",
+ "name": "body",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ }
+ },
+ {
+ "kind": "PropertySignature",
+ "canonicalReference": "@openfunction/functions-framework!HttpFunctionResponse#code:member",
+ "docComment": "/**\n * Status code of the response.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "code?: "
+ },
+ {
+ "kind": "Content",
+ "text": "number"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": true,
+ "releaseTag": "Public",
+ "name": "code",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ }
+ },
+ {
+ "kind": "PropertySignature",
+ "canonicalReference": "@openfunction/functions-framework!HttpFunctionResponse#headers:member",
+ "docComment": "/**\n * Headers of the response.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "headers?: "
+ },
+ {
+ "kind": "Reference",
+ "text": "Record",
+ "canonicalReference": "!Record:type"
+ },
+ {
+ "kind": "Content",
+ "text": ""
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": true,
+ "releaseTag": "Public",
+ "name": "headers",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 3
+ }
+ }
+ ],
+ "extendsTokenRanges": []
+ },
{
"kind": "TypeAlias",
"canonicalReference": "@openfunction/functions-framework!LegacyCloudFunctionsContext:type",
@@ -1309,7 +1427,7 @@
{
"kind": "Interface",
"canonicalReference": "@openfunction/functions-framework!OpenFunction:interface",
- "docComment": "/**\n * A OpenFunction async function handler.\n *\n * @public\n */\n",
+ "docComment": "/**\n * An OpenFunction async function handler.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
@@ -1366,20 +1484,52 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
},
{
"parameterName": "data",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
- }
+ },
+ "isOptional": false
}
]
}
],
"extendsTokenRanges": []
},
+ {
+ "kind": "Variable",
+ "canonicalReference": "@openfunction/functions-framework!openfunction:var",
+ "docComment": "/**\n * Register a function that responds to OpenFunction.\n *\n * @param functionName - the name of the function\n *\n * @param handler - the function to invoke when handling OpenFunction\n *\n * @public\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "openfunction: "
+ },
+ {
+ "kind": "Content",
+ "text": "(functionName: string, handler: "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunction",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunction:interface"
+ },
+ {
+ "kind": "Content",
+ "text": ") => void"
+ }
+ ],
+ "releaseTag": "Public",
+ "name": "openfunction",
+ "variableTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 4
+ }
+ },
{
"kind": "Interface",
"canonicalReference": "@openfunction/functions-framework!OpenFunctionBinding:interface",
@@ -1432,7 +1582,8 @@
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
- }
+ },
+ "isOptional": false
}
]
}
@@ -1522,9 +1673,14 @@
"kind": "Content",
"text": "metadata?: "
},
+ {
+ "kind": "Reference",
+ "text": "Record",
+ "canonicalReference": "!Record:type"
+ },
{
"kind": "Content",
- "text": "{\n [key: string]: string;\n }"
+ "text": ""
},
{
"kind": "Content",
@@ -1536,7 +1692,7 @@
"name": "metadata",
"propertyTypeTokenRange": {
"startIndex": 1,
- "endIndex": 2
+ "endIndex": 3
}
},
{
@@ -1724,13 +1880,53 @@
},
{
"kind": "Content",
- "text": "keyof typeof "
+ "text": "`${"
+ },
+ {
+ "kind": "Reference",
+ "text": "RuntimeType",
+ "canonicalReference": "@openfunction/functions-framework!RuntimeType:enum"
+ },
+ {
+ "kind": "Content",
+ "text": "}` | `${"
+ },
+ {
+ "kind": "Reference",
+ "text": "Capitalize",
+ "canonicalReference": "!Capitalize:type"
+ },
+ {
+ "kind": "Content",
+ "text": "<"
+ },
+ {
+ "kind": "Reference",
+ "text": "RuntimeType",
+ "canonicalReference": "@openfunction/functions-framework!RuntimeType:enum"
+ },
+ {
+ "kind": "Content",
+ "text": ">}` | `${"
+ },
+ {
+ "kind": "Reference",
+ "text": "Uppercase",
+ "canonicalReference": "!Uppercase:type"
+ },
+ {
+ "kind": "Content",
+ "text": "<"
},
{
"kind": "Reference",
"text": "RuntimeType",
"canonicalReference": "@openfunction/functions-framework!RuntimeType:enum"
},
+ {
+ "kind": "Content",
+ "text": ">}`"
+ },
{
"kind": "Content",
"text": ";"
@@ -1741,7 +1937,7 @@
"name": "runtime",
"propertyTypeTokenRange": {
"startIndex": 1,
- "endIndex": 3
+ "endIndex": 12
}
},
{
@@ -1773,6 +1969,464 @@
],
"extendsTokenRanges": []
},
+ {
+ "kind": "Class",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class",
+ "docComment": "/**\n * The OpenFunction's serving runtime abstract class.\n *\n * @public\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "export declare abstract class OpenFunctionRuntime "
+ }
+ ],
+ "releaseTag": "Public",
+ "name": "OpenFunctionRuntime",
+ "members": [
+ {
+ "kind": "Constructor",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:constructor(1)",
+ "docComment": "/**\n * Constructor of the OpenFunctionRuntime.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "constructor(context: "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionContext",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext:interface"
+ },
+ {
+ "kind": "Content",
+ "text": ");"
+ }
+ ],
+ "releaseTag": "Public",
+ "overloadIndex": 1,
+ "parameters": [
+ {
+ "parameterName": "context",
+ "parameterTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ },
+ "isOptional": false
+ }
+ ]
+ },
+ {
+ "kind": "Property",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#context:member",
+ "docComment": "/**\n * The context of the OpenFunction.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "protected readonly context: "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionContext",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext:interface"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": false,
+ "releaseTag": "Public",
+ "name": "context",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ },
+ "isStatic": false
+ },
+ {
+ "kind": "Method",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime.Parse:member(1)",
+ "docComment": "/**\n * Static method to parse the context and get runtime.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "static Parse(context: "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionContext",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext:interface"
+ },
+ {
+ "kind": "Content",
+ "text": "): "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionRuntime",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": false,
+ "isStatic": true,
+ "returnTypeTokenRange": {
+ "startIndex": 3,
+ "endIndex": 4
+ },
+ "releaseTag": "Public",
+ "overloadIndex": 1,
+ "parameters": [
+ {
+ "parameterName": "context",
+ "parameterTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ },
+ "isOptional": false
+ }
+ ],
+ "name": "Parse"
+ },
+ {
+ "kind": "Method",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime.ProxyContext:member(1)",
+ "docComment": "/**\n * It creates a proxy for the runtime object, which delegates all property access to the runtime object\n *\n * @param context - The context object to be proxied.\n *\n * @returns The proxy object.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "static ProxyContext(context: "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionContext",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext:interface"
+ },
+ {
+ "kind": "Content",
+ "text": "): "
+ },
+ {
+ "kind": "Reference",
+ "text": "OpenFunctionRuntime",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": false,
+ "isStatic": true,
+ "returnTypeTokenRange": {
+ "startIndex": 3,
+ "endIndex": 4
+ },
+ "releaseTag": "Public",
+ "overloadIndex": 1,
+ "parameters": [
+ {
+ "parameterName": "context",
+ "parameterTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 2
+ },
+ "isOptional": false
+ }
+ ],
+ "name": "ProxyContext"
+ },
+ {
+ "kind": "Property",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#req:member",
+ "docComment": "/**\n * Getter returns the request object from the trigger.\n *\n * @returns The request object.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "get req(): "
+ },
+ {
+ "kind": "Reference",
+ "text": "Request",
+ "canonicalReference": "@types/express!~e.Request:interface"
+ },
+ {
+ "kind": "Content",
+ "text": "> | undefined"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": false,
+ "releaseTag": "Public",
+ "name": "req",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 9
+ },
+ "isStatic": false
+ },
+ {
+ "kind": "Property",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#res:member",
+ "docComment": "/**\n * Getter returns the response object from the trigger.\n *\n * @returns The res property of the trigger object.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "get res(): "
+ },
+ {
+ "kind": "Reference",
+ "text": "Response",
+ "canonicalReference": "@types/express!~e.Response:interface"
+ },
+ {
+ "kind": "Content",
+ "text": "> | undefined"
+ },
+ {
+ "kind": "Content",
+ "text": ";"
+ }
+ ],
+ "isOptional": false,
+ "releaseTag": "Public",
+ "name": "res",
+ "propertyTypeTokenRange": {
+ "startIndex": 1,
+ "endIndex": 5
+ },
+ "isStatic": false
+ },
+ {
+ "kind": "Method",
+ "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#send:member(1)",
+ "docComment": "/**\n * The promise that send data to certain ouput.\n */\n",
+ "excerptTokens": [
+ {
+ "kind": "Content",
+ "text": "abstract send(data: "
+ },
+ {
+ "kind": "Content",
+ "text": "object"
+ },
+ {
+ "kind": "Content",
+ "text": ", output?: "
+ },
+ {
+ "kind": "Content",
+ "text": "string"
+ },
+ {
+ "kind": "Content",
+ "text": "): "
+ },
+ {
+ "kind": "Reference",
+ "text": "Promise",
+ "canonicalReference": "!Promise:interface"
+ },
+ {
+ "kind": "Content",
+ "text": "