@dxos/functions-runtime-cloudflare 0.8.4-main.3c1ae3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +47 -0
- package/dist/lib/browser/index.mjs +752 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/node-esm/index.mjs +754 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/functions-client.d.ts +32 -0
- package/dist/types/src/functions-client.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +6 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/internal/adapter.d.ts +12 -0
- package/dist/types/src/internal/adapter.d.ts.map +1 -0
- package/dist/types/src/internal/data-service-impl.d.ts +25 -0
- package/dist/types/src/internal/data-service-impl.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +2 -0
- package/dist/types/src/internal/index.d.ts.map +1 -0
- package/dist/types/src/internal/query-service-impl.d.ts +19 -0
- package/dist/types/src/internal/query-service-impl.d.ts.map +1 -0
- package/dist/types/src/internal/queue-service-impl.d.ts +12 -0
- package/dist/types/src/internal/queue-service-impl.d.ts.map +1 -0
- package/dist/types/src/internal/service-container.d.ts +25 -0
- package/dist/types/src/internal/service-container.d.ts.map +1 -0
- package/dist/types/src/logger.d.ts +2 -0
- package/dist/types/src/logger.d.ts.map +1 -0
- package/dist/types/src/queues-api.d.ts +22 -0
- package/dist/types/src/queues-api.d.ts.map +1 -0
- package/dist/types/src/space-proxy.d.ts +25 -0
- package/dist/types/src/space-proxy.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +31 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/wrap-handler-for-cloudflare.d.ts +6 -0
- package/dist/types/src/wrap-handler-for-cloudflare.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +48 -0
- package/src/functions-client.ts +81 -0
- package/src/index.ts +9 -0
- package/src/internal/adapter.ts +48 -0
- package/src/internal/data-service-impl.ts +125 -0
- package/src/internal/index.ts +5 -0
- package/src/internal/query-service-impl.ts +103 -0
- package/src/internal/queue-service-impl.ts +51 -0
- package/src/internal/service-container.ts +54 -0
- package/src/logger.ts +40 -0
- package/src/queues-api.ts +38 -0
- package/src/space-proxy.ts +65 -0
- package/src/types.ts +40 -0
- package/src/wrap-handler-for-cloudflare.ts +132 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @dxos/functions-runtime-cloudflare
|
|
2
|
+
|
|
3
|
+
Functions Runtime for Cloudflare Workers.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a runtime adapter for executing DXOS functions on Cloudflare Workers. It wraps user-defined function code and provides a standardized execution context with access to DXOS services.
|
|
8
|
+
|
|
9
|
+
### Key Responsibilities
|
|
10
|
+
|
|
11
|
+
- **Function Wrapping**: The `wrapHandlerForCloudflare` function wraps user code into a Cloudflare-compatible fetch handler, managing request parsing, error handling, and response formatting.
|
|
12
|
+
- **Service Bridging**: Provides protobuf-based service implementations (`DataService`, `QueryService`, `QueueService`) that bridge the edge environment services to the function context.
|
|
13
|
+
- **Context Creation**: Constructs a `FunctionProtocol.Context` with access to space metadata, document operations, and queue management.
|
|
14
|
+
|
|
15
|
+
### Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
User Function Code
|
|
19
|
+
↓
|
|
20
|
+
wrapHandlerForCloudflare()
|
|
21
|
+
↓
|
|
22
|
+
ServiceContainer (bridges edge bindings → protobuf services)
|
|
23
|
+
↓
|
|
24
|
+
FunctionProtocol.Context { dataService, queryService, queueService }
|
|
25
|
+
↓
|
|
26
|
+
Cloudflare Worker Ready Function Handler
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The edge environment provides low-level service bindings (`EdgeFunctionEnv.DataService`, `EdgeFunctionEnv.QueueService`). This package adapts those bindings into protobuf-defined service interfaces that user functions can consume uniformly.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm i @dxos/functions-runtime-cloudflare
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## DXOS Resources
|
|
38
|
+
|
|
39
|
+
- [Website](https://dxos.org)
|
|
40
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
41
|
+
- Talk to us on [Discord](https://dxos.org/discord)
|
|
42
|
+
|
|
43
|
+
## Contributions
|
|
44
|
+
|
|
45
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
46
|
+
|
|
47
|
+
License: [MIT](./LICENSE) Copyright 2022 © DXOS
|