@streamsy/core 0.9.0 → 0.10.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.
@@ -1,4 +1,4 @@
1
- import { S as InvalidCreateRequest } from "./streamsy-BWX6z980.js";
1
+ import { S as InvalidCreateRequest } from "./streamsy-HKC10a_V.js";
2
2
  import { Array, DateTime, Effect, Option, Result } from "effect";
3
3
  // src/policy/message-framer.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { H as HttpOptions, U as app, V as streamPath, a as securityHeaders, c as read, d as routes, i as layerShutdownSignal, l as Access, n as ShutdownSignal, o as ReadOptions, r as ShutdownSignalService, s as checkReadOptions, u as RoutesOptions } from "../index-CtXiBkjV.js";
1
+ import { H as HttpOptions, U as app, V as streamPath, a as securityHeaders, c as read, d as routes, i as layerShutdownSignal, l as Access, n as ShutdownSignal, o as ReadOptions, r as ShutdownSignalService, s as checkReadOptions, u as RoutesOptions } from "../index-B_o4-vX4.js";
2
2
  export { type Access, type HttpOptions, type ReadOptions, type RoutesOptions, ShutdownSignal, type ShutdownSignalService, app, checkReadOptions, layerShutdownSignal, read, routes, securityHeaders, streamPath };
@@ -1,3 +1,3 @@
1
- import { a as ShutdownSignal, c as streamPath, l as securityHeaders, n as checkReadOptions, o as layerShutdownSignal, r as read, t as app } from "../program-DPq8FYrT.js";
2
- import { n as routes } from "../http-CwDadGy6.js";
1
+ import { a as ShutdownSignal, c as streamPath, l as securityHeaders, n as checkReadOptions, o as layerShutdownSignal, r as read, t as app } from "../program-B6L8HGca.js";
2
+ import { n as routes } from "../http-wFQusDU7.js";
3
3
  export { ShutdownSignal, app, checkReadOptions, layerShutdownSignal, read, routes, securityHeaders, streamPath };
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
- import { F as StreamsReader, I as StreamsWriter, i as checkStreams } from "./streamsy-BWX6z980.js";
3
- import { a as ShutdownSignal, c as streamPath, i as requestUrl, l as securityHeaders, n as checkReadOptions, o as layerShutdownSignal, r as read, s as discardRequestBody, t as app } from "./program-DPq8FYrT.js";
2
+ import { F as StreamsReader, I as StreamsWriter, i as checkStreams } from "./streamsy-HKC10a_V.js";
3
+ import { a as ShutdownSignal, c as streamPath, i as requestUrl, l as securityHeaders, n as checkReadOptions, o as layerShutdownSignal, r as read, s as discardRequestBody, t as app } from "./program-B6L8HGca.js";
4
4
  import { Array, Effect, Option } from "effect";
5
5
  import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
6
6
  // src/http/routes.ts
@@ -181,6 +181,10 @@ type PathSchema<P> = Schema.Codec<P, Readonly<Record<string, string | undefined>
181
181
  type WithPathSchema<P> = {
182
182
  readonly paramSchema: PathSchema<P>;
183
183
  };
184
+ /** The codec record a State route was declared with, one codec per template parameter. */
185
+ type WithParamCodecs<Codecs extends ParamCodecs> = {
186
+ readonly paramCodecs: Codecs;
187
+ };
184
188
  /** A route whose address refs retain their declared State collections. */
185
189
  type StateRoute<P, C extends Collections, Template extends string = string> = Omit<StreamRoute<P, CollectionsEvent<C>, CollectionsDecodingServices<C>, CollectionsEncodingServices<C>, Template>, "address"> & {
186
190
  readonly collections: C;
@@ -203,7 +207,7 @@ declare function json$1<const Template extends string, Codecs extends ParamCodec
203
207
  declare function state$1<const Template extends string, Codecs extends ParamCodecs, const C extends Collections>(template: Template, options: {
204
208
  readonly params: Codecs & ExactTemplateParams<Template, Codecs>;
205
209
  readonly collections: C & ValidCollections<C>;
206
- }): StateRoute<Params<Codecs>, C, Template> & WithPathSchema<Params<Codecs>>;
210
+ }): StateRoute<Params<Codecs>, C, Template> & WithPathSchema<Params<Codecs>> & WithParamCodecs<Codecs>;
207
211
  declare function bytes$1<const Template extends string, Codecs extends ParamCodecs>(template: Template, options: {
208
212
  readonly params: Codecs & ExactTemplateParams<Template, Codecs>;
209
213
  readonly contentType?: string;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { $ as StaleEpoch, A as ReadNextResult, B as HeadError, Ct as EncodeFault, D as CreateResult, Dt as isRetryableFault, E as AppendResult, Et as TransportFault, F as AppendErrorFor, G as InvalidReadRequest, H as InvalidCreateRequest, I as CreateConflict, J as ProducerGap, K as NotSupported, L as CreateConflictReason, M as AppendBaseError, N as AppendConflict, O as HeadResult, Ot as isStreamsFault, P as AppendError, Q as RemoveError, R as CreateError, St as DecodeFault, Tt as StreamsFault, U as InvalidEpochSeq, V as InvalidAppendRequest, W as InvalidForkRequest, X as ReadError, Y as ProtocolError, Z as ReadNextError, _ as OperationResult, _t as StoredMessage, at as AppendCallOptions, b as ProducerPrecondition, bt as StreamLifecycle, ct as ReadNextOptions, d as StorageShape, dt as ChangeSnapshot, et as StreamBusy, f as Mutation, ft as MessageWindow, g as Operation, gt as RecordPatch, h as Mutations, ht as ProducerState, it as isProtocolError, j as ReadResult, k as ReadMessage, lt as ReadOptions, m as MutationRejected, mt as ProducerId, nt as StreamGone, ot as AppendOptions, p as MutationApplied, pt as Offset, q as OffsetMismatch, rt as StreamNotFound, st as ProducerOptions, tt as StreamClosed, u as Storage, ut as CreateOptions, v as OperationResults, vt as StreamConfig, wt as StorageFault, x as StorageCapabilities, xt as StreamRecord, y as Operations, yt as StreamId, z as ForkSourceNotFound } from "./projection-marks-Ca0Q-L9H.js";
2
- import { A as durable_state_d_exports, B as address_d_exports, C as FollowFailure, E as RemoveFailure, F as CommitBoundary, I as CommitBoundaryApi, L as ZERO_OFFSET, O as streamsy_d_exports, R as compare, S as Folded, T as ReadFailure, _ as Collected, b as Decided, g as Batch, h as AppendFailure, j as streams_d_exports, k as producer_d_exports, t as index_d_exports, v as CreateFailure, w as HeadFailure, x as Decision, y as DecideSpec } from "./index-CtXiBkjV.js";
2
+ import { A as durable_state_d_exports, B as address_d_exports, C as FollowFailure, E as RemoveFailure, F as CommitBoundary, I as CommitBoundaryApi, L as ZERO_OFFSET, O as streamsy_d_exports, R as compare, S as Folded, T as ReadFailure, _ as Collected, b as Decided, g as Batch, h as AppendFailure, j as streams_d_exports, k as producer_d_exports, t as index_d_exports, v as CreateFailure, w as HeadFailure, x as Decision, y as DecideSpec } from "./index-B_o4-vX4.js";
3
3
  export { AppendBaseError, type AppendCallOptions, AppendConflict, AppendError, AppendErrorFor, type AppendFailure, type AppendOptions, AppendResult, type Batch, ChangeSnapshot, type Collected, CommitBoundary, type CommitBoundaryApi, CreateConflict, CreateConflictReason, CreateError, type CreateFailure, type CreateOptions, CreateResult, type DecideSpec, type Decided, type Decision, DecodeFault, durable_state_d_exports as DurableState, EncodeFault, type Folded, type FollowFailure, ForkSourceNotFound, HeadError, type HeadFailure, type HeadResult, index_d_exports as Http, InvalidAppendRequest, InvalidCreateRequest, InvalidEpochSeq, InvalidForkRequest, InvalidReadRequest, streams_d_exports as MemoryStorage, MessageWindow, Mutation, MutationApplied, MutationRejected, Mutations, NotSupported, Offset, OffsetMismatch, Operation, OperationResult, OperationResults, Operations, producer_d_exports as Producer, ProducerGap, ProducerId, type ProducerOptions, ProducerPrecondition, ProducerState, ProtocolError, ReadError, type ReadFailure, type ReadMessage, ReadNextError, type ReadNextOptions, type ReadNextResult, type ReadOptions, type ReadResult, RecordPatch, RemoveError, type RemoveFailure, StaleEpoch, Storage, StorageCapabilities, StorageFault, type StorageShape, StoredMessage, address_d_exports as StreamAddress, StreamBusy, StreamClosed, StreamConfig, StreamGone, StreamId, StreamLifecycle, StreamNotFound, StreamRecord, StreamsFault, streamsy_d_exports as Streamsy, TransportFault, ZERO_OFFSET, compare, isProtocolError, isRetryableFault, isStreamsFault };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
- import { $ as ProducerState, A as StreamBusy, C as InvalidEpochSeq, D as OffsetMismatch, E as NotSupported, G as StreamsFault, H as DecodeFault, J as isStreamsFault, K as TransportFault, L as Storage, M as StreamGone, N as StreamNotFound, O as ProducerGap, P as isProtocolError, Q as ProducerId, R as ZERO_OFFSET, S as InvalidCreateRequest, T as InvalidReadRequest, U as EncodeFault, W as StorageFault, X as MessageWindow, Y as ChangeSnapshot, Z as Offset, _ as CreateResult, a as custom, at as StreamRecord, b as ForkSourceNotFound, c as state, d as address_exports, et as RecordPatch, f as isControl, g as AppendResult, h as stateControl, it as StreamLifecycle, j as StreamClosed, k as StaleEpoch, m as stateChange, n as bind, nt as StreamConfig, o as group, p as isUpsert, q as isRetryableFault, r as bytes, rt as StreamId, s as json, t as Wildcard, tt as StoredMessage, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict, z as compare } from "./streamsy-BWX6z980.js";
3
- import { n as CommitBoundary, t as layer$1 } from "./layer-VOzdazlb.js";
4
- import { a as MutationRejected, c as OperationResult, d as ProducerPrecondition, i as MutationApplied, l as OperationResults, o as Mutations, r as Mutation, s as Operation, t as layer$2, u as Operations } from "./layer-B1JEYOZb.js";
5
- import { t as http_exports } from "./http-CwDadGy6.js";
2
+ import { $ as ProducerState, A as StreamBusy, C as InvalidEpochSeq, D as OffsetMismatch, E as NotSupported, G as StreamsFault, H as DecodeFault, J as isStreamsFault, K as TransportFault, L as Storage, M as StreamGone, N as StreamNotFound, O as ProducerGap, P as isProtocolError, Q as ProducerId, R as ZERO_OFFSET, S as InvalidCreateRequest, T as InvalidReadRequest, U as EncodeFault, W as StorageFault, X as MessageWindow, Y as ChangeSnapshot, Z as Offset, _ as CreateResult, a as custom, at as StreamRecord, b as ForkSourceNotFound, c as state, d as address_exports, et as RecordPatch, f as isControl, g as AppendResult, h as stateControl, it as StreamLifecycle, j as StreamClosed, k as StaleEpoch, m as stateChange, n as bind, nt as StreamConfig, o as group, p as isUpsert, q as isRetryableFault, r as bytes, rt as StreamId, s as json, t as Wildcard, tt as StoredMessage, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict, z as compare } from "./streamsy-HKC10a_V.js";
3
+ import { n as CommitBoundary, t as layer$1 } from "./layer-CwD1bD5X.js";
4
+ import { a as MutationRejected, c as OperationResult, d as ProducerPrecondition, i as MutationApplied, l as OperationResults, o as Mutations, r as Mutation, s as Operation, t as layer$2, u as Operations } from "./layer-DZOWeK0B.js";
5
+ import { t as http_exports } from "./http-wFQusDU7.js";
6
6
  import { Array, Data, Effect, Layer, Option, Predicate, Record, Schema, Stream } from "effect";
7
7
  // src/storage/capabilities.ts
8
8
  const StorageCapabilities = Schema.Struct({
@@ -1,5 +1,5 @@
1
- import { L as Storage, R as ZERO_OFFSET } from "./streamsy-BWX6z980.js";
2
- import { a as MutationRejected, l as OperationResults, o as Mutations, u as Operations } from "./layer-B1JEYOZb.js";
1
+ import { L as Storage, R as ZERO_OFFSET } from "./streamsy-HKC10a_V.js";
2
+ import { a as MutationRejected, l as OperationResults, o as Mutations, u as Operations } from "./layer-DZOWeK0B.js";
3
3
  import { a as attachOwner, l as ownerOf } from "./route-internal-DNL0oGTN.js";
4
4
  import { i as OwnerRecords, n as CommitHooks, r as commitHookRegistry, t as ProjectionMarks } from "./projection-marks-RqurLPLA.js";
5
5
  import { Array, Context, Effect, Layer, Option, Order, Predicate, PubSub, Queue, Schedule, Semaphore, Stream } from "effect";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
- import { $ as ProducerState, A as StreamBusy, B as isValid, C as InvalidEpochSeq, D as OffsetMismatch, E as NotSupported, F as StreamsReader, I as StreamsWriter, L as Storage, M as StreamGone, N as StreamNotFound, O as ProducerGap, Q as ProducerId, R as ZERO_OFFSET, T as InvalidReadRequest, V as next, Z as Offset, _ as CreateResult, at as StreamRecord, b as ForkSourceNotFound, et as RecordPatch, g as AppendResult, j as StreamClosed, k as StaleEpoch, n as bind, rt as StreamId, tt as StoredMessage, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict, z as compare } from "./streamsy-BWX6z980.js";
2
+ import { $ as ProducerState, A as StreamBusy, B as isValid, C as InvalidEpochSeq, D as OffsetMismatch, E as NotSupported, F as StreamsReader, I as StreamsWriter, L as Storage, M as StreamGone, N as StreamNotFound, O as ProducerGap, Q as ProducerId, R as ZERO_OFFSET, T as InvalidReadRequest, V as next, Z as Offset, _ as CreateResult, at as StreamRecord, b as ForkSourceNotFound, et as RecordPatch, g as AppendResult, j as StreamClosed, k as StaleEpoch, n as bind, rt as StreamId, tt as StoredMessage, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict, z as compare } from "./streamsy-HKC10a_V.js";
3
3
  import { o as attachStorage } from "./route-internal-DNL0oGTN.js";
4
- import { n as validateCreateOptions, r as frameMessages, t as frameCreateMessages } from "./create-validation-Dwx1OQAN.js";
4
+ import { n as validateCreateOptions, r as frameMessages, t as frameCreateMessages } from "./create-validation-DzLxKiux.js";
5
5
  import { t as generateCursor } from "./cursor-generator-DySXZ93b.js";
6
6
  import { Array, Clock, Context, Data, Effect, Layer, Match, Option, Predicate, Random, Result, Schema, Stream } from "effect";
7
7
  // src/storage/mutation.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
- import { B as isValid, F as StreamsReader, I as StreamsWriter, P as isProtocolError, _ as CreateResult, g as AppendResult, rt as StreamId } from "./streamsy-BWX6z980.js";
2
+ import { B as isValid, F as StreamsReader, I as StreamsWriter, P as isProtocolError, _ as CreateResult, g as AppendResult, rt as StreamId } from "./streamsy-HKC10a_V.js";
3
3
  import { t as generateCursor } from "./cursor-generator-DySXZ93b.js";
4
4
  import { Array, Clock, Context, DateTime, Deferred, Effect, Layer, Match, Option, Random, Record, Ref, Schedule, Stream } from "effect";
5
5
  import { HttpServerRequest, HttpServerResponse } from "effect/http";
@@ -1,5 +1,5 @@
1
1
  import { C as StreamsReader, S as Reader, T as Writer, w as StreamsWriter } from "../projection-marks-Ca0Q-L9H.js";
2
- import { D as streams_d_exports, P as layer_d_exports, u as RoutesOptions, z as route_d_exports } from "../index-CtXiBkjV.js";
2
+ import { D as streams_d_exports, P as layer_d_exports, u as RoutesOptions, z as route_d_exports } from "../index-B_o4-vX4.js";
3
3
  import { HttpRouter } from "effect/http";
4
4
  /** Raw protocol route for adapters and wire conformance tests. */
5
5
  export declare const routes: (options?: Omit<RoutesOptions, "access">) => import("effect/Layer").Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Requires", StreamsReader> | HttpRouter.Request<"Requires", StreamsWriter>>;
@@ -1,6 +1,6 @@
1
- import { F as StreamsReader, I as StreamsWriter, l as streams_exports, u as route_exports } from "../streamsy-BWX6z980.js";
2
- import { n as layer_exports } from "../layer-B1JEYOZb.js";
3
- import { t as app } from "../program-DPq8FYrT.js";
1
+ import { F as StreamsReader, I as StreamsWriter, l as streams_exports, u as route_exports } from "../streamsy-HKC10a_V.js";
2
+ import { n as layer_exports } from "../layer-DZOWeK0B.js";
3
+ import { t as app } from "../program-B6L8HGca.js";
4
4
  import { HttpRouter } from "effect/http";
5
5
  // src/protocol/routes.ts
6
6
  /** Raw protocol route for adapters and wire conformance tests. */
@@ -1,5 +1,5 @@
1
1
  import { C as StreamsReader, Et as TransportFault, w as StreamsWriter } from "../projection-marks-Ca0Q-L9H.js";
2
- import { f as Any, m as Identifiers, p as Group } from "../index-CtXiBkjV.js";
2
+ import { f as Any, m as Identifiers, p as Group } from "../index-B_o4-vX4.js";
3
3
  import { Layer } from "effect";
4
4
  import { HttpClient, HttpClientRequest } from "effect/http";
5
5
  interface Options {
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D8jQpDG7.js";
2
- import { A as StreamBusy, D as OffsetMismatch, E as NotSupported, F as StreamsReader, I as StreamsWriter, K as TransportFault, M as StreamGone, N as StreamNotFound, O as ProducerGap, S as InvalidCreateRequest, T as InvalidReadRequest, _ as CreateResult, b as ForkSourceNotFound, g as AppendResult, j as StreamClosed, k as StaleEpoch, n as bind, rt as StreamId, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict } from "../streamsy-BWX6z980.js";
3
- import { n as validateCreateOptions } from "../create-validation-Dwx1OQAN.js";
2
+ import { A as StreamBusy, D as OffsetMismatch, E as NotSupported, F as StreamsReader, I as StreamsWriter, K as TransportFault, M as StreamGone, N as StreamNotFound, O as ProducerGap, S as InvalidCreateRequest, T as InvalidReadRequest, _ as CreateResult, b as ForkSourceNotFound, g as AppendResult, j as StreamClosed, k as StaleEpoch, n as bind, rt as StreamId, v as AppendConflict, w as InvalidForkRequest, x as InvalidAppendRequest, y as CreateConflict } from "../streamsy-HKC10a_V.js";
3
+ import { n as validateCreateOptions } from "../create-validation-DzLxKiux.js";
4
4
  import { Array, Context, DateTime, Effect, Fiber, Layer, Option, Schema, Scope, Stream } from "effect";
5
5
  import { HttpClient, HttpClientRequest } from "effect/http";
6
6
  // src/remote/request.ts
@@ -439,6 +439,7 @@ function state$1(template, options) {
439
439
  return new Route({
440
440
  template,
441
441
  paramSchema: pathSchema(codecs),
442
+ paramCodecs: codecs,
442
443
  match: (id) => Option.isSome(matchTemplate(segments, codecs, id)),
443
444
  parse: (id) => matchTemplate(segments, codecs, id),
444
445
  collections: options.collections,
@@ -1,5 +1,5 @@
1
1
  import { C as StreamsReader, dt as ChangeSnapshot, u as Storage, w as StreamsWriter, x as StorageCapabilities, yt as StreamId } from "../projection-marks-Ca0Q-L9H.js";
2
- import { M as MemoryOptions, N as ProtocolOptions } from "../index-CtXiBkjV.js";
2
+ import { M as MemoryOptions, N as ProtocolOptions } from "../index-B_o4-vX4.js";
3
3
  import { Context, Effect, Layer } from "effect";
4
4
  interface StorageContractOptions {
5
5
  readonly name: string;
@@ -1,6 +1,6 @@
1
- import { L as Storage, Q as ProducerId, R as ZERO_OFFSET, V as next, W as StorageFault, rt as StreamId } from "../streamsy-BWX6z980.js";
2
- import { n as CommitBoundary, t as layer } from "../layer-VOzdazlb.js";
3
- import { a as MutationRejected, t as layer$1 } from "../layer-B1JEYOZb.js";
1
+ import { L as Storage, Q as ProducerId, R as ZERO_OFFSET, V as next, W as StorageFault, rt as StreamId } from "../streamsy-HKC10a_V.js";
2
+ import { n as CommitBoundary, t as layer } from "../layer-CwD1bD5X.js";
3
+ import { a as MutationRejected, t as layer$1 } from "../layer-DZOWeK0B.js";
4
4
  import { i as OwnerRecords, n as CommitHooks, t as ProjectionMarks } from "../projection-marks-RqurLPLA.js";
5
5
  import { Array, Cause, Context, Deferred, Effect, Exit, Fiber, Layer, Match, Option, Order, Predicate, PubSub, Queue, Record, Ref, Scope, Stream } from "effect";
6
6
  import { SqlError } from "effect/sql";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamsy/core",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Effect-first Durable Streams protocol, storage contract, memory layer and toolkit.",
5
5
  "license": "MIT",
6
6
  "repository": {