@streamsy/core 0.7.0 → 0.9.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 -5
- package/dist/create-validation-Dwx1OQAN.js +53 -0
- package/dist/http/index.d.ts +1 -1
- package/dist/http/index.js +2 -2
- package/dist/{http-B10ao6xE.js → http-CwDadGy6.js} +2 -2
- package/dist/{index-IhF2sua7.d.ts → index-CtXiBkjV.d.ts} +16 -108
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/internal/index.d.ts +1 -1
- package/dist/{layer-8Y1cg6UL.js → layer-B1JEYOZb.js} +13 -31
- package/dist/{layer-C-QriVBc.js → layer-VOzdazlb.js} +2 -2
- package/dist/{program-CYtMjdvD.js → program-DPq8FYrT.js} +2 -1
- package/dist/projection-marks-Ca0Q-L9H.d.ts +1184 -0
- package/dist/protocol/index.d.ts +2 -2
- package/dist/protocol/index.js +3 -3
- package/dist/remote/index.d.ts +2 -2
- package/dist/remote/index.js +10 -5
- package/dist/{streamsy-D9OCCdw0.js → streamsy-BWX6z980.js} +6 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +3 -3
- package/package.json +4 -4
- package/dist/projection-marks-28vAwOzM.d.ts +0 -3019
package/dist/protocol/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as StreamsReader, S as Reader, T as Writer, w as StreamsWriter } from "../projection-marks-
|
|
2
|
-
import { D as streams_d_exports, P as layer_d_exports, u as RoutesOptions, z as route_d_exports } from "../index-
|
|
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";
|
|
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>>;
|
package/dist/protocol/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as
|
|
2
|
-
import { n as layer_exports } from "../layer-
|
|
3
|
-
import { t as app } from "../program-
|
|
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";
|
|
4
4
|
import { HttpRouter } from "effect/http";
|
|
5
5
|
// src/protocol/routes.ts
|
|
6
6
|
/** Raw protocol route for adapters and wire conformance tests. */
|
package/dist/remote/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as StreamsReader,
|
|
2
|
-
import { f as Any, m as Identifiers, p as Group } from "../index-
|
|
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";
|
|
3
3
|
import { Layer } from "effect";
|
|
4
4
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
5
5
|
interface Options {
|
package/dist/remote/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D8jQpDG7.js";
|
|
2
|
-
import { A as
|
|
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";
|
|
3
4
|
import { Array, Context, DateTime, Effect, Fiber, Layer, Option, Schema, Scope, Stream } from "effect";
|
|
4
5
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
5
6
|
// src/remote/request.ts
|
|
@@ -187,6 +188,10 @@ const create = (operation, response, context) => Effect.gen(function* () {
|
|
|
187
188
|
feature
|
|
188
189
|
});
|
|
189
190
|
const message = emptyToUndefined(yield* bodyText(operation, response));
|
|
191
|
+
if (context.source === void 0) return yield* new InvalidCreateRequest({
|
|
192
|
+
id: context.id,
|
|
193
|
+
message: message ?? "Invalid create parameters"
|
|
194
|
+
});
|
|
190
195
|
return yield* new InvalidForkRequest({
|
|
191
196
|
id: context.id,
|
|
192
197
|
message: message ?? "Invalid fork parameters"
|
|
@@ -388,17 +393,17 @@ const layerProtocol = (options) => Layer.effectContext(Effect.gen(function* () {
|
|
|
388
393
|
}))
|
|
389
394
|
};
|
|
390
395
|
return Context.make(StreamsReader, reader).pipe(Context.add(StreamsWriter, {
|
|
391
|
-
create: (id, input) => execute("create", () => request.create(id, input), (operation, response) => create(operation, response, {
|
|
396
|
+
create: (id, input) => validateCreateOptions(id, input).pipe(Effect.andThen(execute("create", () => request.create(id, input), (operation, response) => create(operation, response, {
|
|
392
397
|
id,
|
|
393
398
|
source: input?.forkedFrom === void 0 ? void 0 : StreamId.make(input.forkedFrom)
|
|
394
|
-
})),
|
|
395
|
-
fork: (id, source, input) => execute("create", () => request.create(id, {
|
|
399
|
+
})))),
|
|
400
|
+
fork: (id, source, input) => validateCreateOptions(id, input).pipe(Effect.andThen(execute("create", () => request.create(id, {
|
|
396
401
|
...input,
|
|
397
402
|
forkedFrom: source
|
|
398
403
|
}), (operation, response) => create(operation, response, {
|
|
399
404
|
id,
|
|
400
405
|
source
|
|
401
|
-
})),
|
|
406
|
+
})))),
|
|
402
407
|
append: (id, input) => {
|
|
403
408
|
if (input.expectedOffset !== void 0 && options.capabilities?.expectedOffset !== true) return Effect.fail(new NotSupported({
|
|
404
409
|
id,
|
|
@@ -184,6 +184,10 @@ var InvalidAppendRequest = class extends Schema.TaggedError()("InvalidAppendRequ
|
|
|
184
184
|
id: StreamId,
|
|
185
185
|
message: Schema.String
|
|
186
186
|
}) {};
|
|
187
|
+
var InvalidCreateRequest = class extends Schema.TaggedError()("InvalidCreateRequest", {
|
|
188
|
+
id: StreamId,
|
|
189
|
+
message: Schema.String
|
|
190
|
+
}) {};
|
|
187
191
|
var CreateConflict = class extends Schema.TaggedError()("CreateConflict", {
|
|
188
192
|
id: StreamId,
|
|
189
193
|
reason: Schema.optionalKey(Schema.Literals([
|
|
@@ -231,6 +235,7 @@ const protocolErrorTags = {
|
|
|
231
235
|
ProducerGap: true,
|
|
232
236
|
InvalidEpochSeq: true,
|
|
233
237
|
InvalidAppendRequest: true,
|
|
238
|
+
InvalidCreateRequest: true,
|
|
234
239
|
CreateConflict: true,
|
|
235
240
|
ForkSourceNotFound: true,
|
|
236
241
|
InvalidForkRequest: true,
|
|
@@ -788,4 +793,4 @@ function group(...keys) {
|
|
|
788
793
|
checkStreams(keys);
|
|
789
794
|
return Object.freeze({ streams: Object.freeze(keys) });
|
|
790
795
|
}
|
|
791
|
-
export {
|
|
796
|
+
export { ProducerState as $, StreamBusy as A, isValid as B, InvalidEpochSeq as C, OffsetMismatch as D, NotSupported as E, StreamsReader as F, StreamsFault as G, DecodeFault as H, StreamsWriter as I, isStreamsFault as J, TransportFault as K, Storage as L, StreamGone as M, StreamNotFound as N, ProducerGap as O, isProtocolError as P, ProducerId as Q, ZERO_OFFSET as R, InvalidCreateRequest as S, InvalidReadRequest as T, EncodeFault as U, next as V, StorageFault as W, MessageWindow as X, ChangeSnapshot as Y, Offset as Z, CreateResult as _, custom as a, StreamRecord as at, ForkSourceNotFound as b, state as c, address_exports as d, RecordPatch as et, isControl as f, AppendResult as g, stateControl as h, checkStreams as i, StreamLifecycle as it, StreamClosed as j, StaleEpoch as k, streams_exports as l, stateChange as m, bind as n, StreamConfig as nt, group as o, isUpsert as p, isRetryableFault as q, bytes as r, StreamId as rt, json as s, Wildcard as t, StoredMessage as tt, route_exports as u, AppendConflict as v, InvalidForkRequest as w, InvalidAppendRequest as x, CreateConflict as y, compare as z };
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as StreamsReader,
|
|
2
|
-
import { M as MemoryOptions, N as ProtocolOptions } from "../index-
|
|
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";
|
|
3
3
|
import { Context, Effect, Layer } from "effect";
|
|
4
4
|
interface StorageContractOptions {
|
|
5
5
|
readonly name: string;
|
package/dist/testing/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as CommitBoundary, t as layer } from "../layer-
|
|
3
|
-
import { a as MutationRejected, t as layer$1 } from "../layer-
|
|
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";
|
|
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.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Effect-first Durable Streams protocol, storage contract, memory layer and toolkit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"test:unit": "bun --bun vitest run --dir test"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@effect/vitest": "4.
|
|
59
|
+
"@effect/vitest": "4.1.2",
|
|
60
60
|
"@types/bun": "^1.4.3",
|
|
61
|
-
"effect": "4.
|
|
61
|
+
"effect": "4.1.2",
|
|
62
62
|
"typescript": "^7.0.2",
|
|
63
63
|
"vitest": "5.0.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"effect": "^4.
|
|
66
|
+
"effect": "^4.1.2",
|
|
67
67
|
"vitest": "^5.0.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|