Download the PHP package medz/stream-wrapper-interface without Composer
On this page you can find all versions of the php package medz/stream-wrapper-interface. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download medz/stream-wrapper-interface
More information about medz/stream-wrapper-interface
Files in medz/stream-wrapper-interface
Package stream-wrapper-interface
Short Description Common interface for streamWrapper class.
License MIT
Homepage http://medz.cn
Informations about the package stream-wrapper-interface
cf-gait-workflow
Semantic tracing helpers for Cloudflare Workflows.
cf-gait-workflow keeps Cloudflare Workflows as the source of execution
truth while adding typed lifecycle events around workflow steps, sleeps, and
event waits. Use it when you want workflow history to stay native, but also
need structured telemetry for logs, traces, metrics, or custom observers.
Install
Quick Start
defineGaitWorkflowEntrypoint creates a normal Cloudflare
WorkflowEntrypoint. The only difference is that your run plan receives a
gait helper next to the original workflow event.
Emitter
Gait events are delivered to an exported Worker entrypoint. By default the
workflow looks for an export named GaitEmitter.
The callback is typed as the full gait event union. Every emitted context has a
numeric timestamp field. When events are emitted by gait.step,
gait.sleep, or gait.event, the timestamp is added automatically with
Date.now().
If you want a different export name, pass it to
defineGaitWorkflowEntrypoint:
Gait Helper
The helper currently exposes:
gait.step(name, callback, rollbackOptions?)gait.step(name, config, callback, rollbackOptions?)gait.sleep(name, params)gait.event(name, options)
gait.step
gait.step mirrors Cloudflare step.do. It preserves the original step name,
config, retry behavior, callback context, and rollback options.
Events:
step:start: emitted before your callback runs.step:complete: emitted withoutputafter the callback resolves.step:error: emitted witherrorbefore the original error is rethrown.
Step failures are not wrapped. The original error is rethrown so native Workflow retry behavior is preserved.
gait.sleep
gait.sleep delegates to Cloudflare step.sleep or step.sleepUntil,
depending on the input.
Events:
sleep:start: emitted with the originalparams.sleep:complete: emitted when the sleep resolves.sleep:error: emitted witherrorif the sleep fails.
Sleep failures are wrapped in NonRetryableWithRawError. The wrapper exposes
the original error through .raw.
gait.event
gait.event waits for a Cloudflare Workflow event and emits lifecycle telemetry
around that wait.
The actual wait still uses step.waitForEvent(name, options). Gait also wraps
the wait in a durable step named gait:event/<name> so event:start,
event:complete, and event:error stay inside a Workflow step boundary during
replay or restart.
The emitted step object keeps the logical event name:
The count is scoped by logical event name because the wrapper step name is also
derived from that name. For example, approval, then review, then approval
emits counts 1, 1, and 2.
Event wait failures are wrapped in NonRetryableWithRawError. The wrapper
exposes the original error through .raw.
Event Types
defineGaitEmitter infers the event name and context union for its callback,
so most applications do not need manual annotations.
Current event names:
All contexts include:
step:* events include the native Cloudflare WorkflowStepContext fields.
sleep:start includes params. event:start includes options.
*:complete events include output where an output exists. *:error events
include error.
Manual Integration
If you already have a WorkflowEntrypoint class, use createGaitWorkflow
inside run:
Pass binding when the emitter export is not GaitEmitter:
If the emitter export cannot be found, gait throws a Cloudflare
NonRetryableError.
Cloudflare Setup
Export the emitter and workflow from your Worker:
Then bind the workflow in Wrangler as you would for any Cloudflare Workflow.
See playground/worker.ts and
playground/wrangler.jsonc for a runnable
example.
Development
Run the playground Worker:
License
MIT. See LICENSE.