@streamsy/serve 0.6.0 → 0.7.0
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/README.md +5 -3
- package/dist/action/runtime.d.ts +1 -1
- package/dist/action/runtime.js +1 -1
- package/dist/alchemy.d.ts +2 -2
- package/dist/alchemy.js +2 -2
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +2 -2
- package/dist/{object-link-BbxO01Z5.d.ts → object-link-B3cvdzGy.d.ts} +1 -1
- package/dist/{object-link-HD-tFY4o.js → object-link-pdzpEY0s.js} +1 -1
- package/dist/{wakeup-Cy6pvhmx.d.ts → wakeup-BJGZnq4x.d.ts} +7 -0
- package/dist/{wakeup-eIs0xIUh.js → wakeup-Cb5DAcpF.js} +6 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -135,7 +135,9 @@ owner creates it first. `Serve.mount` accepts GET and HEAD.
|
|
|
135
135
|
|
|
136
136
|
Object hosts acquire `ProjectionWakeup.attach(projection)` from
|
|
137
137
|
`@streamsy/projection` in their scope through `wakeups: [...]`. Local
|
|
138
|
-
`Storage.committed` events populate its in-memory pending set
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
`Storage.committed` events populate its in-memory pending set, and each commit
|
|
139
|
+
writes a durable pending mark in the same transaction. Alarms drain bounded
|
|
140
|
+
passes. After an eviction, acquisition reads the marks and arms the alarm.
|
|
141
|
+
Retry options take an Effect `Schedule`; finite schedules stop on exhaustion.
|
|
142
|
+
`Wakeups.status` reports each wakeup's deferred bindings.
|
|
141
143
|
See the [projection host reference](https://streamsy.dev/docs/hosting/cloudflare#projections).
|
package/dist/action/runtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionSinkRelation, CheckedActionSink } from "./contract.js";
|
|
2
2
|
import { ActionSinkDeliveryFailure, OutboxUnavailable } from "./errors.js";
|
|
3
3
|
import { OutboxDraft, OutboxStore } from "./outbox.js";
|
|
4
|
-
import { t as Wakeup } from "../wakeup-
|
|
4
|
+
import { t as Wakeup } from "../wakeup-BJGZnq4x.js";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
/** One attempt at one delivery, as the handler sees it. */
|
|
7
7
|
export interface ActionSinkDelivery<Payload> {
|
package/dist/action/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { backoffAfter } from "./contract.js";
|
|
2
2
|
import { ActionSinkDeliveryFailure } from "./errors.js";
|
|
3
3
|
import { OutboxStore } from "./outbox.js";
|
|
4
|
-
import { n as Wakeup } from "../wakeup-
|
|
4
|
+
import { n as Wakeup } from "../wakeup-Cb5DAcpF.js";
|
|
5
5
|
import { Array, Cause, Clock, Effect, Exit, Option, Semaphore } from "effect";
|
|
6
6
|
import { StorageFault } from "@streamsy/core";
|
|
7
7
|
// src/action/runtime.ts
|
package/dist/alchemy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AlarmSlot, i as Wakeups, n as WakeupProgress, o as alarmSlotLayer, r as WakeupSource, t as Wakeup } from "./wakeup-
|
|
2
|
-
import { a as ObjectLinkOptions, c as ObjectStreamsOptions, d as ObjectApp, i as ObjectLink, l as Placement, n as LinkClient, o as ObjectFetch, r as LinkRoutes, s as ObjectStreams, t as LinkAccess, u as rule } from "./object-link-
|
|
1
|
+
import { a as AlarmSlot, i as Wakeups, n as WakeupProgress, o as alarmSlotLayer, r as WakeupSource, t as Wakeup } from "./wakeup-BJGZnq4x.js";
|
|
2
|
+
import { a as ObjectLinkOptions, c as ObjectStreamsOptions, d as ObjectApp, i as ObjectLink, l as Placement, n as LinkClient, o as ObjectFetch, r as LinkRoutes, s as ObjectStreams, t as LinkAccess, u as rule } from "./object-link-B3cvdzGy.js";
|
|
3
3
|
import { Effect, Layer, Scope } from "effect";
|
|
4
4
|
import { HttpServerError, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
5
5
|
import { Storage, StorageFault } from "@streamsy/core";
|
package/dist/alchemy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as alarmSlotLayer, n as Wakeup, r as Wakeups } from "./wakeup-
|
|
2
|
-
import { a as resolvePlacement, c as rule, d as unavailable, f as withLinks, i as isReserved, l as acquireObject, n as ObjectStreams, r as objectTransportError, s as Placement, t as ObjectLink, u as providedApp } from "./object-link-
|
|
1
|
+
import { a as alarmSlotLayer, n as Wakeup, r as Wakeups } from "./wakeup-Cb5DAcpF.js";
|
|
2
|
+
import { a as resolvePlacement, c as rule, d as unavailable, f as withLinks, i as isReserved, l as acquireObject, n as ObjectStreams, r as objectTransportError, s as Placement, t as ObjectLink, u as providedApp } from "./object-link-pdzpEY0s.js";
|
|
3
3
|
import { Effect, Option } from "effect";
|
|
4
4
|
import { HttpRouter, HttpServerRequest, HttpServerRespondable, HttpServerResponse } from "effect/http";
|
|
5
5
|
import { securityHeaders, streamPath } from "@streamsy/core/http";
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Wakeups, n as WakeupProgress, o as alarmSlotLayer, r as WakeupSource, t as Wakeup } from "./wakeup-
|
|
2
|
-
import { a as ObjectLinkOptions, c as ObjectStreamsOptions, d as ObjectApp, i as ObjectLink, l as Placement, n as LinkClient, o as ObjectFetch, r as LinkRoutes, s as ObjectStreams, t as LinkAccess, u as rule } from "./object-link-
|
|
1
|
+
import { i as Wakeups, n as WakeupProgress, o as alarmSlotLayer, r as WakeupSource, t as Wakeup } from "./wakeup-BJGZnq4x.js";
|
|
2
|
+
import { a as ObjectLinkOptions, c as ObjectStreamsOptions, d as ObjectApp, i as ObjectLink, l as Placement, n as LinkClient, o as ObjectFetch, r as LinkRoutes, s as ObjectStreams, t as LinkAccess, u as rule } from "./object-link-B3cvdzGy.js";
|
|
3
3
|
import { Layer } from "effect";
|
|
4
4
|
import { Storage, StorageFault } from "@streamsy/core";
|
|
5
5
|
import { DurableObject } from "cloudflare:workers";
|
package/dist/cloudflare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as alarmSlotLayer, n as Wakeup, r as Wakeups } from "./wakeup-
|
|
2
|
-
import { c as rule, d as unavailable, f as withLinks, l as acquireObject, n as ObjectStreams, o as router, s as Placement, t as ObjectLink, u as providedApp } from "./object-link-
|
|
1
|
+
import { a as alarmSlotLayer, n as Wakeup, r as Wakeups } from "./wakeup-Cb5DAcpF.js";
|
|
2
|
+
import { c as rule, d as unavailable, f as withLinks, l as acquireObject, n as ObjectStreams, o as router, s as Placement, t as ObjectLink, u as providedApp } from "./object-link-pdzpEY0s.js";
|
|
3
3
|
import { Context, Effect, Layer, ManagedRuntime, Option } from "effect";
|
|
4
4
|
import { HttpRouter, HttpServerResponse } from "effect/http";
|
|
5
5
|
import { DurableObject } from "cloudflare:workers";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Wakeups } from "./wakeup-
|
|
1
|
+
import { i as Wakeups } from "./wakeup-BJGZnq4x.js";
|
|
2
2
|
import { Context, Effect, Layer, Option, Scope } from "effect";
|
|
3
3
|
import { HttpClientError, HttpRouter, HttpServerRespondable, HttpServerResponse } from "effect/http";
|
|
4
4
|
import { Storage, StorageFault, Streamsy } from "@streamsy/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as makeWakeups, r as Wakeups, t as RequestTouch } from "./wakeup-
|
|
1
|
+
import { i as makeWakeups, r as Wakeups, t as RequestTouch } from "./wakeup-Cb5DAcpF.js";
|
|
2
2
|
import { Array, Context, Effect, Exit, Layer, Option, Predicate, Scope } from "effect";
|
|
3
3
|
import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
4
4
|
import { Http, StorageFault } from "@streamsy/core";
|
|
@@ -26,6 +26,11 @@ interface Wakeup<R = never> {
|
|
|
26
26
|
readonly run: Effect.Effect<void | WakeupProgress, unknown, R>;
|
|
27
27
|
/** Alarm retries use this schedule's delays without sleeping in an alarm. */
|
|
28
28
|
readonly retry?: Schedule.Schedule<unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Units of work that failed and wait on their own backoff, for `status`.
|
|
31
|
+
* A durable `ProjectionWakeup` counts its deferred bindings here.
|
|
32
|
+
*/
|
|
33
|
+
readonly deferred?: Effect.Effect<number, StorageFault, R>;
|
|
29
34
|
}
|
|
30
35
|
/** The host acquires effectful wakeups in the same scope as its storage layer. */
|
|
31
36
|
type WakeupSource<R = never> = Wakeup<R | Wakeups> | Effect.Effect<Wakeup<R | Wakeups>, never, R | Scope.Scope>;
|
|
@@ -46,6 +51,8 @@ declare const Wakeups_base: Context.ServiceClass<Wakeups, "@streamsy/serve/cloud
|
|
|
46
51
|
readonly failures: number;
|
|
47
52
|
/** The backoff floor. The wakeup does not run before this instant. */
|
|
48
53
|
readonly retryAt: Option.Option<number>;
|
|
54
|
+
/** Units that wait on their own backoff, such as failed projection bindings. */
|
|
55
|
+
readonly deferred: number;
|
|
49
56
|
}>>;
|
|
50
57
|
}>;
|
|
51
58
|
declare class Wakeups extends Wakeups_base {}
|
|
@@ -70,11 +70,15 @@ const makeWakeups = (context, definitions = []) => Effect.gen(function* () {
|
|
|
70
70
|
state.exhausted = false;
|
|
71
71
|
state.step = yield* Schedule.toStep(state.policy);
|
|
72
72
|
});
|
|
73
|
-
const status = Effect.forEach(states, (state) =>
|
|
73
|
+
const status = Effect.forEach(states, (state) => Effect.all({
|
|
74
|
+
next: state.wakeup.next,
|
|
75
|
+
deferred: state.wakeup.deferred ?? Effect.succeed(0)
|
|
76
|
+
}).pipe(Effect.map(({ next, deferred }) => ({
|
|
74
77
|
name: state.wakeup.name,
|
|
75
78
|
next,
|
|
76
79
|
failures: state.failures,
|
|
77
|
-
retryAt: state.floor > 0 ? Option.some(state.floor) : Option.none()
|
|
80
|
+
retryAt: state.floor > 0 ? Option.some(state.floor) : Option.none(),
|
|
81
|
+
deferred
|
|
78
82
|
}))));
|
|
79
83
|
const deadlineOf = (state, now) => state.exhausted ? Effect.succeedNone : state.wakeup.next.pipe(Effect.map(Option.map((next) => Math.max(next, state.floor))), Effect.catchCause((cause) => {
|
|
80
84
|
return Effect.gen(function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamsy/serve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Effect HttpRouter routes, Bun, Node, Deno and Cloudflare hosts, and durable action delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"test:dialects": "bun --bun vitest run test/action/outbox-dialects.test.ts"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@streamsy/core": "^0.
|
|
90
|
+
"@streamsy/core": "^0.7.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@cloudflare/workers-types": "4.20251228.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@effect/sql-pg": "4.0.5",
|
|
99
99
|
"@effect/sql-sqlite-do": "4.0.5",
|
|
100
100
|
"@effect/vitest": "4.0.5",
|
|
101
|
-
"@streamsy/storage": "0.
|
|
101
|
+
"@streamsy/storage": "0.7.0",
|
|
102
102
|
"@types/bun": "^1.4.3",
|
|
103
103
|
"alchemy": "2.0.0-beta.83",
|
|
104
104
|
"effect": "4.0.5",
|