@ontrails/cloudflare 1.0.0-beta.41 → 1.0.0-beta.43
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/CHANGELOG.md +12 -0
- package/README.md +2 -2
- package/package.json +6 -6
- package/src/facts.ts +1 -1
- package/src/queues/index.ts +2 -2
- package/src/r2/index.ts +1 -1
- package/src/workers/index.ts +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ontrails/cloudflare
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.43
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`88a6a62`](https://github.com/outfitter-dev/trails/commit/88a6a62a9e9e230ca6d368fa78dc3ece6c816204): Complete the v1 classification-first cutover from projection/project vocabulary
|
|
8
|
+
to derive/derived for contract-owned fact production and render/rendered for
|
|
9
|
+
surface presentation. Public type, helper, rule, relation, and report names move
|
|
10
|
+
without compatibility aliases; ordinary repository/project nouns remain
|
|
11
|
+
explicit preserves or structured review inventory.
|
|
12
|
+
|
|
13
|
+
## 1.0.0-beta.42
|
|
14
|
+
|
|
3
15
|
## 1.0.0-beta.41
|
|
4
16
|
|
|
5
17
|
## 1.0.0-beta.40
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Adapter composition doctrine applies throughout: subpaths take primitive-authore
|
|
|
14
14
|
|
|
15
15
|
## `/workers` — the Worker materializer
|
|
16
16
|
|
|
17
|
-
`createWorkersHandler(graph, options)` produces the Worker export for Cloudflare runtime entrypoints. Its `fetch(request, env, ctx)` member delegates to the shared HTTP fetch kernel from `@ontrails/http` — the same kernel behind the Bun and Hono surfaces, so routes, validation, error
|
|
17
|
+
`createWorkersHandler(graph, options)` produces the Worker export for Cloudflare runtime entrypoints. Its `fetch(request, env, ctx)` member delegates to the shared HTTP fetch kernel from `@ontrails/http` — the same kernel behind the Bun and Hono surfaces, so routes, validation, error rendering, and webhook handling behave identically. Its `queue(batch, env, ctx)` member dispatches first-class core `queue()` activation sources through the `/queues` materializer.
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
// src/worker.ts
|
|
@@ -182,7 +182,7 @@ binding = "ASSETS"
|
|
|
182
182
|
bucket_name = "my-assets"
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
The resource surface follows the R2 Worker binding structurally. A real R2 bucket binding passes through unchanged, including Cloudflare's conditional operation behavior where `get()` can return metadata without a body and `put()` can return `null` when a precondition fails. `r2ObjectToBlobRef(object)` is the small bridge from a fetched R2 object body to core's `BlobRef` binary-output contract; the HTTP and MCP surfaces already know how to
|
|
185
|
+
The resource surface follows the R2 Worker binding structurally. A real R2 bucket binding passes through unchanged, including Cloudflare's conditional operation behavior where `get()` can return metadata without a body and `put()` can return `null` when a precondition fails. `r2ObjectToBlobRef(object)` is the small bridge from a fetched R2 object body to core's `BlobRef` binary-output contract; the HTTP and MCP surfaces already know how to render `blobRefSchema`.
|
|
186
186
|
|
|
187
187
|
Capability boundaries are explicit:
|
|
188
188
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/cloudflare",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.43",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*.ts",
|
|
6
6
|
"!src/**/__tests__/**",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ontrails/core": "^1.0.0-beta.
|
|
30
|
+
"@ontrails/core": "^1.0.0-beta.43"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@ontrails/adapter-kit": "^1.0.0-beta.
|
|
34
|
-
"@ontrails/testing": "^1.0.0-beta.
|
|
33
|
+
"@ontrails/adapter-kit": "^1.0.0-beta.43",
|
|
34
|
+
"@ontrails/testing": "^1.0.0-beta.43",
|
|
35
35
|
"miniflare": "^4.20250617.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@ontrails/http": "^1.0.0-beta.
|
|
39
|
-
"@ontrails/store": "^1.0.0-beta.
|
|
38
|
+
"@ontrails/http": "^1.0.0-beta.43",
|
|
39
|
+
"@ontrails/store": "^1.0.0-beta.43",
|
|
40
40
|
"zod": "^4.3.5"
|
|
41
41
|
},
|
|
42
42
|
"trails": {
|
package/src/facts.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cloudflare lock facts.
|
|
3
3
|
*
|
|
4
|
-
* The adapter's `trails.lock` overlay overlay: `derive`
|
|
4
|
+
* The adapter's `trails.lock` overlay overlay: `derive` derives the
|
|
5
5
|
* topo's env-bound resources (resources with a registered
|
|
6
6
|
* {@link EnvBindingSpec | env binding}, such as every `cloudflareKv`
|
|
7
7
|
* definition) into `overlays.cloudflare`, listing the wrangler binding name
|
package/src/queues/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getTraceSink,
|
|
19
19
|
isTrailsError,
|
|
20
20
|
matchesTrailPattern,
|
|
21
|
-
|
|
21
|
+
deriveActivationSourceFacts,
|
|
22
22
|
resource,
|
|
23
23
|
run,
|
|
24
24
|
traceContextFromRecord,
|
|
@@ -402,7 +402,7 @@ const collectQueueConsumers = (
|
|
|
402
402
|
|
|
403
403
|
const queueInputContractSignature = (source: QueueSource): string =>
|
|
404
404
|
JSON.stringify(
|
|
405
|
-
|
|
405
|
+
deriveActivationSourceFacts(source)['parseOutputSchema'] ?? null
|
|
406
406
|
);
|
|
407
407
|
|
|
408
408
|
const assertQueueSourceCompatibility = (
|
package/src/r2/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `cloudflareR2` authors an ordinary resource definition for an R2 bucket
|
|
5
5
|
* binding. Trails can store and fetch object bytes through the standard
|
|
6
6
|
* resource accessor, then return `BlobRef` values when HTTP/MCP surfaces should
|
|
7
|
-
*
|
|
7
|
+
* render the fetched object as binary output.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
package/src/workers/index.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
renderErrorDiagnostics,
|
|
17
|
+
renderPublicSurfaceError,
|
|
18
18
|
} from '@ontrails/core';
|
|
19
19
|
import type {
|
|
20
20
|
BaseSurfaceOptions,
|
|
@@ -104,7 +104,7 @@ export interface CloudflareWorker {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Map a materialization failure (route derivation, env bridge resolution) to
|
|
107
|
-
* a
|
|
107
|
+
* a rendered HTTP error response. Route execution errors never reach this
|
|
108
108
|
* path — the fetch kernel maps those itself.
|
|
109
109
|
*/
|
|
110
110
|
const mapCaughtError = (error: unknown): Response => {
|
|
@@ -113,18 +113,18 @@ const mapCaughtError = (error: unknown): Response => {
|
|
|
113
113
|
// diagnostics to the Worker log while the response stays redacted.
|
|
114
114
|
console.error(
|
|
115
115
|
'[ontrails:cloudflare/workers] Failed to materialize request handler',
|
|
116
|
-
|
|
116
|
+
renderErrorDiagnostics(err)
|
|
117
117
|
);
|
|
118
|
-
const
|
|
118
|
+
const rendering = renderPublicSurfaceError('http', err);
|
|
119
119
|
return Response.json(
|
|
120
120
|
{
|
|
121
121
|
error: {
|
|
122
|
-
category:
|
|
123
|
-
code:
|
|
124
|
-
message:
|
|
122
|
+
category: rendering.category,
|
|
123
|
+
code: rendering.name,
|
|
124
|
+
message: rendering.message,
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
|
-
{ status:
|
|
127
|
+
{ status: rendering.code }
|
|
128
128
|
);
|
|
129
129
|
};
|
|
130
130
|
|
|
@@ -135,7 +135,7 @@ const mapCaughtQueueError = (
|
|
|
135
135
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
136
136
|
console.error(
|
|
137
137
|
'[ontrails:cloudflare/workers] Failed to materialize queue handler',
|
|
138
|
-
|
|
138
|
+
renderErrorDiagnostics(err)
|
|
139
139
|
);
|
|
140
140
|
batch.retryAll();
|
|
141
141
|
};
|