@gjermundgaraba/effect-actions 0.29.0 → 0.31.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.
Files changed (81) hide show
  1. package/README.md +2 -2
  2. package/dist/Action.d.mts +6 -6
  3. package/dist/Action.mjs +17 -18
  4. package/dist/ActionCli.d.mts +23 -23
  5. package/dist/ActionCli.mjs +4 -4
  6. package/dist/ActionHttp.d.mts +17 -16
  7. package/dist/ActionHttp.mjs +18 -22
  8. package/dist/ActionMcp.d.mts +8 -8
  9. package/dist/ActionMcp.mjs +13 -16
  10. package/dist/ActionRpc.d.mts +24 -23
  11. package/dist/ActionRpc.mjs +58 -72
  12. package/dist/ActionToolkit.d.mts +1 -1
  13. package/dist/ActionToolkit.mjs +6 -5
  14. package/dist/Authentication.d.mts +2 -2
  15. package/dist/Authentication.mjs +44 -46
  16. package/dist/Event.d.mts +4 -4
  17. package/dist/Event.mjs +3 -3
  18. package/dist/Webhook.d.mts +2 -0
  19. package/dist/Webhook.mjs +1 -0
  20. package/dist/authentication/provider.d.mts +15 -15
  21. package/dist/authentication/refusal.mjs +12 -5
  22. package/dist/cli/commands.d.mts +2 -2
  23. package/dist/cli/commands.mjs +13 -13
  24. package/dist/contract/authorizer.d.mts +1 -1
  25. package/dist/contract/call.d.mts +2 -2
  26. package/dist/contract/call.mjs +1 -1
  27. package/dist/contract/callback.mjs +6 -1
  28. package/dist/contract/caller.d.mts +1 -1
  29. package/dist/contract/declared.d.mts +1 -1
  30. package/dist/contract/declared.mjs +1 -1
  31. package/dist/contract/digest.mjs +3 -2
  32. package/dist/contract/feed.d.mts +1 -1
  33. package/dist/contract/feed.mjs +12 -10
  34. package/dist/contract/hub.d.mts +1 -1
  35. package/dist/contract/idempotency.d.mts +1 -1
  36. package/dist/contract/idempotency.mjs +4 -4
  37. package/dist/contract/implementation.d.mts +27 -27
  38. package/dist/contract/implementation.mjs +8 -18
  39. package/dist/contract/input-check.d.mts +3 -3
  40. package/dist/contract/listed.d.mts +1 -1
  41. package/dist/contract/listed.mjs +1 -1
  42. package/dist/contract/pages.d.mts +1 -1
  43. package/dist/contract/push.d.mts +2 -2
  44. package/dist/contract/push.mjs +5 -7
  45. package/dist/contract/receiving.d.mts +2 -2
  46. package/dist/contract/receiving.mjs +1 -1
  47. package/dist/contract/recent.mjs +3 -2
  48. package/dist/contract/serving.mjs +18 -18
  49. package/dist/contract/stream.d.mts +1 -1
  50. package/dist/contract/stream.mjs +14 -2
  51. package/dist/contract/subscribe.mjs +7 -2
  52. package/dist/contract/transient.mjs +1 -1
  53. package/dist/contract/watch.d.mts +1 -1
  54. package/dist/contract/watch.mjs +5 -8
  55. package/dist/contract/webhooks.d.mts +1 -1
  56. package/dist/contract/webhooks.mjs +17 -6
  57. package/dist/http/client.d.mts +9 -9
  58. package/dist/http/client.mjs +6 -4
  59. package/dist/http/events.d.mts +6 -6
  60. package/dist/http/events.mjs +7 -5
  61. package/dist/http/placed.d.mts +3 -3
  62. package/dist/http/placed.mjs +5 -5
  63. package/dist/http/streamed.d.mts +3 -2
  64. package/dist/http/streamed.mjs +11 -6
  65. package/dist/http/watch.mjs +1 -1
  66. package/dist/mcp/bridge.mjs +13 -22
  67. package/dist/mcp/client.d.mts +10 -10
  68. package/dist/mcp/client.mjs +5 -14
  69. package/dist/mcp/events.mjs +1 -1
  70. package/dist/mcp/progress.mjs +11 -1
  71. package/dist/mcp/reply.d.mts +1 -1
  72. package/dist/mcp/watch.mjs +4 -4
  73. package/dist/rpc/watch.mjs +3 -5
  74. package/dist/webhook/health.mjs +25 -28
  75. package/dist/webhook/receiver.mjs +4 -7
  76. package/dist/webhook/stored.mjs +1 -1
  77. package/dist/webhook/subscriptions.mjs +19 -17
  78. package/docs/Action.md +1 -1
  79. package/docs/setup-failures.md +1 -1
  80. package/docs/setup.md +4 -4
  81. package/package.json +11 -12
@@ -1,10 +1,10 @@
1
- import { Codec } from "../contract/codec.mjs";
1
+ import { Any as Any$1, Errors } from "../Action.mjs";
2
2
  import { Anyone } from "../contract/caller.mjs";
3
+ import { Codec } from "../contract/codec.mjs";
3
4
  import { Refusal } from "../contract/errors.mjs";
5
+ import { Any as Any$2 } from "../Event.mjs";
4
6
  import { EventOf, ServingEvents } from "../contract/feed.mjs";
5
- import { Any as Any$1 } from "../Event.mjs";
6
7
  import { BuildServices, Protected, ServedRequest, Serving } from "../contract/implementation.mjs";
7
- import { Any as Any$2, Errors } from "../Action.mjs";
8
8
  import { Context, Effect } from "effect";
9
9
  import { HttpRouter, HttpServerResponse } from "effect/http";
10
10
  import { HttpApiMiddleware, HttpApiSecurity } from "effect/http-api";
@@ -90,10 +90,10 @@ export interface Descriptor<I, A, S extends Security, Name extends string = stri
90
90
  */
91
91
  export type Any = Descriptor<unknown, unknown, Security, string, Errors>;
92
92
  /** The identity an action's `caller` names, or `never` for none. */
93
- export type Identity<A extends Pick<Any$2, "caller">> = [A] extends [never] ? never : A["caller"] extends Context.Key<infer I, unknown> ? I : never;
94
- type Covered<A extends Pick<Any$2, "caller">> = Exclude<A["caller"], typeof Anyone> extends Context.Key<infer I, unknown> ? I : never;
93
+ export type Identity<A extends Pick<Any$1, "caller">> = [A] extends [never] ? never : A["caller"] extends Context.Key<infer I, unknown> ? I : never;
94
+ type Covered<A extends Pick<Any$1, "caller">> = Exclude<A["caller"], typeof Anyone> extends Context.Key<infer I, unknown> ? I : never;
95
95
  /** The `authentication` a binding of these actions takes: required once one is protected. */
96
- export type Required<A extends Pick<Any$2, "caller">> = [Protected<A>] extends [never] ? {
96
+ export type Required<A extends Pick<Any$1, "caller">> = [Protected<A>] extends [never] ? {
97
97
  readonly authentication?: Any;
98
98
  } : {
99
99
  readonly authentication: Descriptor<Covered<Protected<A>>, unknown, Security, string, Errors>;
@@ -101,7 +101,7 @@ export type Required<A extends Pick<Any$2, "caller">> = [Protected<A>] extends [
101
101
  /** The provider `Authentication.layer` builds for the descriptor `D`. */
102
102
  export type ProviderOf<D> = D extends Descriptor<infer I, unknown, Security, infer Name, Errors> ? Provider<I, Name> : never;
103
103
  /** Actions a binding takes without options: public ones, as a protected one names its descriptor. */
104
- export type PublicOnly<Actions extends ReadonlyArray<Pick<Any$2, "caller">>> = [Exclude<Actions[number], {
104
+ export type PublicOnly<Actions extends ReadonlyArray<Pick<Any$1, "caller">>> = [Exclude<Actions[number], {
105
105
  readonly caller: typeof Anyone;
106
106
  }>] extends [never] ? unknown : {
107
107
  readonly "Protected actions take options naming their authentication": never;
@@ -111,20 +111,20 @@ export type DescriptorOf<O> = [O] extends [{
111
111
  readonly authentication: infer D extends Any;
112
112
  }] ? D : undefined;
113
113
  /** All protected actions on a surface use the descriptor's single identity key. */
114
- export type Matching<A extends Pick<Any$2, "caller">, D> = unknown extends Covered<Protected<A>> ? unknown : [Exclude<Covered<Protected<A>>, D extends Descriptor<infer I, unknown, Security, string, Errors> ? I : never>] extends [never] ? unknown : {
114
+ export type Matching<A extends Pick<Any$1, "caller">, D> = unknown extends Covered<Protected<A>> ? unknown : [Exclude<Covered<Protected<A>>, D extends Descriptor<infer I, unknown, Security, string, Errors> ? I : never>] extends [never] ? unknown : {
115
115
  readonly "Authentication descriptor does not cover every protected action": never;
116
116
  };
117
- type PublicRequest<App, A extends Any$2> = ServedRequest<App, Extract<A, {
117
+ type PublicRequest<App, A extends Any$1> = ServedRequest<App, Extract<A, {
118
118
  readonly caller: typeof Anyone;
119
119
  }>>;
120
- type ProtectedRequestLessIdentity<App, A extends Any$2> = Exclude<ServedRequest<App, Protected<A>>, Identity<Protected<A>>>;
121
- export type RemoteRequest<App, A extends Any$2> = PublicRequest<App, A> | ProtectedRequestLessIdentity<App, A>;
120
+ type ProtectedRequestLessIdentity<App, A extends Any$1> = Exclude<ServedRequest<App, Protected<A>>, Identity<Protected<A>>>;
121
+ export type RemoteRequest<App, A extends Any$1> = PublicRequest<App, A> | ProtectedRequestLessIdentity<App, A>;
122
122
  /**
123
123
  * The identity a remote layer's authentication provides every request, where `App` serves only
124
124
  * protected actions of `A` and event types of `E`: its middleware reading it then owes nothing.
125
125
  * None where one served is public, whose requests authenticate no one.
126
126
  */
127
- export type LayerIdentity<App, A extends Any$2, E extends Any$1> = [Extract<Serving<App, A>, {
127
+ export type LayerIdentity<App, A extends Any$1, E extends Any$2> = [Extract<Serving<App, A>, {
128
128
  readonly caller: typeof Anyone;
129
129
  }> | Extract<ServingEvents<App, E>, {
130
130
  readonly caller: typeof Anyone;
@@ -134,7 +134,7 @@ export type LayerIdentity<App, A extends Any$2, E extends Any$1> = [Extract<Serv
134
134
  * `BuildServices` states it, with the caller a builder yields named as the mistake it is: a server
135
135
  * has its caller per request.
136
136
  */
137
- export type ServerBuildServices<App, A extends Any$2> = App extends unknown ? BuildServices<App, A> extends (infer R) ? R extends Identity<Protected<A>> ? {
137
+ export type ServerBuildServices<App, A extends Any$1> = App extends unknown ? BuildServices<App, A> extends (infer R) ? R extends Identity<Protected<A>> ? {
138
138
  readonly "A builder yields the caller, which a server has per request: yield it in a handler or an authorizer": {
139
139
  readonly caller: R;
140
140
  readonly builderOf: Serving<App, A>["name"];
@@ -144,12 +144,12 @@ export type ServerBuildServices<App, A extends Any$2> = App extends unknown ? Bu
144
144
  * What a call of `A` under the descriptor `D` may fail with from its verifier: the errors `D`
145
145
  * declares, for a protected action; none for a public one, which nothing verifies.
146
146
  */
147
- export type VerifierError<A extends Pick<Any$2, "caller">, D> = A["caller"] extends typeof Anyone ? never : D extends {
147
+ export type VerifierError<A extends Pick<Any$1, "caller">, D> = A["caller"] extends typeof Anyone ? never : D extends {
148
148
  readonly error: infer E extends Errors;
149
149
  } ? E[number] : never;
150
150
  /**
151
151
  * The provider a surface's startup reads under the descriptor `D`, where the implementations
152
152
  * `App` serve a protected action of `A` or a protected event type of `E`.
153
153
  */
154
- export type ServedProvider<App, A extends Any$2, D, E extends Any$1 = EventOf<App>> = [Protected<Serving<App, A>> | Protected<E>] extends [never] ? never : ProviderOf<D>;
154
+ export type ServedProvider<App, A extends Any$1, D, E extends Any$2 = EventOf<App>> = [Protected<Serving<App, A>> | Protected<E>] extends [never] ? never : ProviderOf<D>;
155
155
  export { Runtime$1 as Runtime };
@@ -1,12 +1,14 @@
1
- import { Forbidden, Refusal, Unauthenticated } from "../contract/errors.mjs";
2
- import { declared, httpApiStatusOf } from "../contract/status.mjs";
1
+ import { Anyone } from "../contract/caller.mjs";
3
2
  import { errorSchemas } from "../contract/declared.mjs";
3
+ import { Forbidden, Refusal, Unauthenticated } from "../contract/errors.mjs";
4
+ import { declaredStatus } from "../contract/status.mjs";
5
+ import { promote } from "./provider.mjs";
4
6
  import { Cause, Context, Effect, Exit, Option, Predicate, Ref, Schema } from "effect";
5
7
  import { HttpServerResponse } from "effect/http";
6
8
  // src/authentication/refusal.ts
7
- const responseOf = (schema, error) => HttpServerResponse.jsonUnsafe(Schema.encodeUnknownSync(Schema.toCodecJson(schema))(error), { status: httpApiStatusOf(schema.ast) ?? 422 });
9
+ const responseOf = (schema, error) => HttpServerResponse.jsonUnsafe(Schema.encodeUnknownSync(Schema.toCodecJson(schema))(error), { status: declaredStatus(schema) });
8
10
  const declaredResponse = (errors, error) => {
9
- const schema = errorSchemas(errors).map(declared).find((each) => Schema.is(each)(error));
11
+ const schema = errorSchemas(errors).find((each) => Schema.is(each)(error));
10
12
  return schema === void 0 ? void 0 : responseOf(schema, error);
11
13
  };
12
14
  const rfc6750ErrorDescriptionCharacters = /^[\u0020\u0021\u0023-\u005B\u005D-\u007E]+$/u;
@@ -35,6 +37,11 @@ const answer = (error, metadataUrl) => {
35
37
  var SteppedUpRefusal = class extends Context.Service()("effect-actions/SteppedUp") {};
36
38
  const isStepUp = (error) => isRefusal(error) && (!Predicate.isTagged(error, "Forbidden") || error.scopes !== void 0);
37
39
  const recordStepUp = (call) => Effect.tapError(call, (error) => isStepUp(error) ? Effect.flatMap(Effect.serviceOption(SteppedUpRefusal), (slot) => Option.isSome(slot) ? Ref.set(slot.value, Option.some(error)) : Effect.void) : Effect.void);
40
+ /**
41
+ * `run` as the caller of `called`: unchanged where it is public or nothing authenticates, and
42
+ * otherwise with the identity its request verified, a step-up it fails with recorded.
43
+ */
44
+ const asCaller = (authentication, called, run) => authentication === void 0 || called.caller === Anyone ? run : recordStepUp(promote(authentication, run));
38
45
  const answerStepUp = (route, metadataUrl) => Effect.gen(function* () {
39
46
  const slot = yield* Ref.make(Option.none());
40
47
  const exit = yield* Effect.exit(Effect.provideService(route, SteppedUpRefusal, slot));
@@ -42,4 +49,4 @@ const answerStepUp = (route, metadataUrl) => Effect.gen(function* () {
42
49
  const diedOrInterruptedAfterRefusal = Exit.isFailure(exit) && (Cause.hasDies(exit.cause) || Cause.hasInterrupts(exit.cause));
43
50
  return Option.isSome(refused) && !diedOrInterruptedAfterRefusal ? answer(refused.value, metadataUrl) : yield* exit;
44
51
  });
45
- export { answer, answerStepUp, bearer, challenge, declaredResponse, isRefusal, isStepUp, plain, recordStepUp };
52
+ export { answer, answerStepUp, asCaller, bearer, challenge, declaredResponse, isRefusal, isStepUp, plain, recordStepUp };
@@ -1,9 +1,9 @@
1
+ import { Any } from "../Action.mjs";
1
2
  import "../contract/errors.mjs";
2
3
  import "../Event.mjs";
3
- import "../contract/progress.mjs";
4
4
  import "../contract/implementation.mjs";
5
+ import "../contract/progress.mjs";
5
6
  import { Each } from "../contract/stream.mjs";
6
- import { Any } from "../Action.mjs";
7
7
  import { Effect, Option, Runtime, Stream, Types } from "effect";
8
8
  import { CliError, Command } from "effect/cli";
9
9
  type Field<A extends Any> = A["input"]["Encoded"] extends (infer E) ? true extends Types.IsUnion<E> ? never : E extends readonly unknown[] ? never : E extends object ? string extends keyof E ? never : Extract<keyof E, string> : never : never;
@@ -1,12 +1,12 @@
1
1
  import { literalValues, members, unsuspended } from "../contract/ast.mjs";
2
- import { InvalidInput } from "../contract/errors.mjs";
2
+ import { decodeInput } from "../contract/call.mjs";
3
3
  import { errorSchemas } from "../contract/declared.mjs";
4
- import { assertDistinct } from "../contract/names.mjs";
5
- import { elementOf } from "../contract/stream.mjs";
4
+ import { InvalidInput } from "../contract/errors.mjs";
5
+ import { SubscriptionError } from "../Event.mjs";
6
6
  import { elementsOf } from "../contract/implementation.mjs";
7
- import { decodeInput } from "../contract/call.mjs";
7
+ import { assertDistinct } from "../contract/names.mjs";
8
8
  import { ReceivedOf } from "../contract/occurrence.mjs";
9
- import { SubscriptionError } from "../Event.mjs";
9
+ import { elementOf } from "../contract/stream.mjs";
10
10
  import { withStderrConsole } from "../stdio/console.mjs";
11
11
  import { Console, Effect, Option, Predicate, Record, Runtime, Schema, SchemaAST, Stdio, Stream } from "effect";
12
12
  import { CliError, Command, Flag, Param } from "effect/cli";
@@ -177,7 +177,6 @@ const positionalOrder = (params, positional) => {
177
177
  return ordered;
178
178
  };
179
179
  const wholeInputFlag = (encoded) => Flag.String("input").pipe(Flag.withSchema(jsonOfAcceptedKindOrText(encoded)), Flag.withDescription("Whole action input as JSON; omitted, {}"), Flag.optional);
180
- const printedOutput = (action, value, render) => Effect.map(Effect.orDie(Schema.encodeEffect(Schema.toCodecJson(action.success))(value)), (encoded) => render === void 0 && SchemaAST.isVoid(action.success.ast) ? Option.none() : Option.some(render === void 0 ? JSON.stringify(encoded, null, 2) : render(value)));
181
180
  /**
182
181
  * What a command fails with when its action fails: Effect CLI's `UserError`, typed with the
183
182
  * action's failure as its `cause` and `reason`, and whose `userMessage` is its JSON, or for a
@@ -292,12 +291,13 @@ const progressLinesOf = (progress) => {
292
291
  };
293
292
  const printedOf = (action) => {
294
293
  const element = elementOf(action.success);
295
- if (element === void 0) return (value, render, print) => Effect.flatMap(printedOutput(action, value, render), Option.match({
296
- onNone: () => Effect.void,
297
- onSome: (line) => Effect.sync(() => {
298
- print(line);
299
- })
300
- }));
294
+ if (element === void 0) {
295
+ const encode = Schema.encodeEffect(Schema.toCodecJson(action.success));
296
+ const silent = SchemaAST.isVoid(action.success.ast);
297
+ return (value, render, print) => Effect.flatMap(Effect.orDie(encode(value)), (encoded) => render === void 0 && silent ? Effect.void : Effect.sync(() => {
298
+ print(render === void 0 ? JSON.stringify(encoded, null, 2) : render(value));
299
+ }));
300
+ }
301
301
  const encode = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.toCodecJson(element)));
302
302
  return (value, render, print) => Stream.runForEach(elementsOf(Effect.succeed(value)), (each) => Effect.map(Effect.orDie(encode(each)), (json) => {
303
303
  print(render === void 0 ? json : render(each));
@@ -370,4 +370,4 @@ const watchCommand = (event, watch, errors) => {
370
370
  stdout.log(line);
371
371
  })))), failing, withStderrConsole))).pipe(Command.withDescription(event.description));
372
372
  };
373
- export { UserError, command, failingAsDerived, kebab, watchCommand };
373
+ export { UserError, command, failingAsDerived, watchCommand };
@@ -1,5 +1,5 @@
1
- import { Refusal } from "./errors.mjs";
2
1
  import "./implementation.mjs";
2
+ import { Refusal } from "./errors.mjs";
3
3
  import { Effect } from "effect";
4
4
  /** `T`, read only once it is inferred: an implementation's build channels. */
5
5
  type Deferred$1<T> = [T][T extends unknown ? 0 : never];
@@ -1,8 +1,8 @@
1
+ import { Any } from "../Action.mjs";
1
2
  import "./codec.mjs";
2
3
  import "./errors.mjs";
3
- import { ProgressArgs } from "./progress.mjs";
4
4
  import "./implementation.mjs";
5
- import { Any } from "../Action.mjs";
5
+ import { ProgressArgs } from "./progress.mjs";
6
6
  import { Effect, Schema, Stream } from "effect";
7
7
  /**
8
8
  * A call of `A` answering `R`, taking `{ onProgress }` after its input where `A` declares
@@ -38,4 +38,4 @@ const checkedStream = (action, check, send) => {
38
38
  const method = checked(action, check, (input, onProgress) => Effect.succeed(send(input, onProgress)));
39
39
  return (...args) => Stream.unwrap(method(...args));
40
40
  };
41
- export { checked, checkedStream, decodeInput, inputOf, inputParseOptions, jsonRoundTrip, onProgressOf, sendingJson, sendingValue, watchInput };
41
+ export { checked, checkedStream, decodeInput, inputParseOptions, jsonRoundTrip, sendingJson, sendingValue, watchInput };
@@ -7,6 +7,11 @@ const SigningSecret = Schema.Struct({
7
7
  key: Schema.Uint8Array
8
8
  });
9
9
  const secretPrefix = "whsec_";
10
+ const encodeBase64 = Schema.encodeSync(Schema.Uint8ArrayFromBase64);
11
+ const signingSecretOf = (key) => ({
12
+ text: `${secretPrefix}${encodeBase64(key)}`,
13
+ key
14
+ });
10
15
  const decodeBase64 = Schema.decodeUnknownOption(Schema.Uint8ArrayFromBase64);
11
16
  const keyOf = (text) => text.startsWith(secretPrefix) ? Option.filter(decodeBase64(text.slice(6)), (key) => key.length >= 24 && key.length <= 64) : Option.none();
12
17
  const WebhookSecret = Schema.String.annotate({ description: "whsec_ and the base64 of 24 to 64 random bytes, which signs each delivery." }).pipe(Schema.decodeTo(SigningSecret, SchemaTransformation.transformEffect({
@@ -19,4 +24,4 @@ const WebhookSecret = Schema.String.annotate({ description: "whsec_ and the base
19
24
  }),
20
25
  encode: ({ text }) => Effect.succeed(text)
21
26
  })));
22
- export { CallbackUrl, SigningSecret, WebhookSecret };
27
+ export { CallbackUrl, SigningSecret, WebhookSecret, signingSecretOf };
@@ -1,5 +1,5 @@
1
- import { Codec } from "./codec.mjs";
2
1
  import { Any } from "../Action.mjs";
2
+ import { Codec } from "./codec.mjs";
3
3
  import { Context, Effect } from "effect";
4
4
  /**
5
5
  * The caller of a public action, `caller: Action.Anyone`: anyone, signed in or not, and no
@@ -1,5 +1,5 @@
1
- import "./caller.mjs";
2
1
  import { Errors } from "../Action.mjs";
2
+ import "./caller.mjs";
3
3
  import { Types } from "effect";
4
4
  type ListOf<G> = G extends Errors ? G : readonly [G];
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { Anyone, assertAuthentication } from "./caller.mjs";
2
1
  import { literalValues, members } from "./ast.mjs";
2
+ import { Anyone, assertAuthentication } from "./caller.mjs";
3
3
  import { builtIns } from "./errors.mjs";
4
4
  import { httpApiStatusOf } from "./status.mjs";
5
5
  import { Predicate, Schema, SchemaAST } from "effect";
@@ -1,5 +1,6 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Schema } from "effect";
2
2
  // src/contract/digest.ts
3
3
  const encoder = new TextEncoder();
4
- const sha256Hex = (text) => Effect.promise(async () => Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(text))), (byte) => byte.toString(16).padStart(2, "0")).join(""));
4
+ const encodeHex = Schema.encodeSync(Schema.Uint8ArrayFromHex);
5
+ const sha256Hex = (text) => Effect.promise(async () => encodeHex(new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(text)))));
5
6
  export { sha256Hex };
@@ -1,7 +1,7 @@
1
1
  import { Anyone } from "./caller.mjs";
2
- import { Fed, Page } from "./pages.mjs";
3
2
  import { Any } from "../Event.mjs";
4
3
  import { ErasedAuthorize, ErasedValue, Memoized, Protected } from "./implementation.mjs";
4
+ import { Fed, Page } from "./pages.mjs";
5
5
  import { Context, Duration, Effect, Layer, Stream } from "effect";
6
6
  /**
7
7
  * An implemented event type, behind its authorizer, as a surface serves it: a poll, whose
@@ -1,15 +1,15 @@
1
- import { Anyone } from "./caller.mjs";
2
- import { Unauthenticated } from "./errors.mjs";
3
- import { checkInput } from "./input-check.mjs";
4
- import { assertKnown } from "./names.mjs";
5
- import { builderLayer, memoized, notMadeHere, selectHeld } from "./implementation.mjs";
6
1
  import { jsonRoundTrip } from "./call.mjs";
2
+ import { Anyone } from "./caller.mjs";
7
3
  import { canonicalInput } from "./canonical.mjs";
8
- import { reported } from "./reported.mjs";
4
+ import { Unauthenticated } from "./errors.mjs";
9
5
  import { Events, attachmentsOf, reaches } from "./hub.mjs";
6
+ import { builderLayer, memoized, notMadeHere } from "./implementation.mjs";
7
+ import { checkInput } from "./input-check.mjs";
10
8
  import { makeLeases } from "./lease.mjs";
9
+ import { assertKnown } from "./names.mjs";
11
10
  import { AnyOccurrence, Gap } from "./occurrence.mjs";
12
11
  import { fedOf, pagedFrom } from "./pages.mjs";
12
+ import { reported } from "./reported.mjs";
13
13
  import { Array, DateTime, Duration, Effect, Layer, Option, Predicate, Stream } from "effect";
14
14
  // src/contract/feed.ts
15
15
  const defaultNextPoll = Duration.seconds(5);
@@ -221,9 +221,11 @@ var EventImplementation = class EventImplementation {
221
221
  return app;
222
222
  }
223
223
  };
224
- const unkeyedHook = (surface, feeds, keyed) => keyed ? void 0 : Array.findFirst(feeds, ({ event, release }) => release !== void 0 && event.caller !== Anyone).pipe(Option.map(({ event }) => `${surface} event "${event.name}" is protected and has a subscription hook, so its authentication needs principal to tell poll subscribers apart (give Authentication.make a principal, such as (user) => user.id)`), Option.getOrUndefined);
225
224
  const eventsOf = (served) => Array.ensure(served).filter((app) => Predicate.isTagged(app, "EventImplementation"));
226
- const selectEvents = (apps, listed) => selectHeld(apps, listed, (app) => app.events, (own, app) => EventImplementation.share(own, app));
227
- const feedBuilders = (events) => events.map((app) => EventImplementation.layerOf(app));
225
+ const eventKind = {
226
+ noun: "event",
227
+ holds: (app) => app.events,
228
+ share: (own, app) => EventImplementation.share(own, app)
229
+ };
228
230
  const acquireFeeds = (events) => Effect.map(Effect.forEach(events, (app) => EventImplementation.feedsOf(app)), (feeds) => feeds.flat());
229
- export { EventImplementation, acquireFeeds, defaultNextPoll, eventsOf, feedBuilders, selectEvents, sourcesOf, unkeyedHook };
231
+ export { EventImplementation, acquireFeeds, defaultNextPoll, eventKind, eventsOf, sourcesOf };
@@ -1,5 +1,5 @@
1
- import { LogStorage } from "./log.mjs";
2
1
  import { Any, Emitted } from "../Event.mjs";
2
+ import { LogStorage } from "./log.mjs";
3
3
  import { Context, Effect, Layer, Scope, Stream } from "effect";
4
4
  /** What `notify` and `publish` take: the key whose subscribers they reach. */
5
5
  export interface KeyOptions {
@@ -1,5 +1,5 @@
1
- import "./implementation.mjs";
2
1
  import "../Action.mjs";
2
+ import "./implementation.mjs";
3
3
  import { Context, Effect, Layer, Schema } from "effect";
4
4
  declare const Kept: Schema.Struct<{
5
5
  readonly input: Schema.String;
@@ -1,10 +1,10 @@
1
1
  import { CallerKeyed, principalOf } from "./caller.mjs";
2
- import { InvalidInput } from "./errors.mjs";
3
- import { declaredStatus, isTransientStatus } from "./status.mjs";
4
- import { projectedErrors } from "./declared.mjs";
5
- import { answered } from "./implementation.mjs";
6
2
  import { canonicalInput } from "./canonical.mjs";
3
+ import { projectedErrors } from "./declared.mjs";
7
4
  import { sha256Hex } from "./digest.mjs";
5
+ import { InvalidInput } from "./errors.mjs";
6
+ import { answered } from "./implementation.mjs";
7
+ import { declaredStatus, isTransientStatus } from "./status.mjs";
8
8
  import { Cause, Clock, Context, Deferred, Effect, Exit, Layer, Option, Predicate, Schema } from "effect";
9
9
  // src/contract/idempotency.ts
10
10
  const Kept = Schema.Struct({
@@ -1,12 +1,12 @@
1
+ import { Any } from "../Action.mjs";
1
2
  import { Anyone, Keyed } from "./caller.mjs";
2
3
  import { Refusal } from "./errors.mjs";
4
+ import { Any as Any$1 } from "../Event.mjs";
3
5
  import { AnyEventImplementation, EventOf } from "./feed.mjs";
4
- import { Any } from "../Event.mjs";
5
6
  import { Reporting } from "./progress.mjs";
6
- import { Any as Any$1 } from "../Action.mjs";
7
7
  import { Context, Effect, Layer, Scope, Stream } from "effect";
8
8
  /** Decoded values at the dispatch boundary every surface shares. */
9
- export type ErasedValue = Any$1["input"]["Type"];
9
+ export type ErasedValue = Any["input"]["Type"];
10
10
  export type WrittenHandler<R> = {
11
11
  bivarianceHack(input: ErasedValue, reporting?: Reporting): Effect.Effect<ErasedValue, ErasedValue, R> | Stream.Stream<ErasedValue, ErasedValue, R>;
12
12
  }["bivarianceHack"];
@@ -21,13 +21,13 @@ export type ErasedHandler<R> = (input: ErasedValue, reporting?: Reporting) => Ef
21
21
  * Authorization for protected contracts: it refuses, and fails with nothing else. It runs only for
22
22
  * protected actions, after authentication and before the handler.
23
23
  */
24
- export type Authorize<A extends Any$1, R = never> = (action: A) => Effect.Effect<void, Refusal, R>;
24
+ export type Authorize<A extends Any, R = never> = (action: A) => Effect.Effect<void, Refusal, R>;
25
25
  /** An authorization rule over contracts `C`, erased: it refuses, or lets the call run. */
26
- export type ErasedAuthorize<C = Any$1> = (contract: C) => Effect.Effect<void, unknown, unknown>;
26
+ export type ErasedAuthorize<C = Any> = (contract: C) => Effect.Effect<void, unknown, unknown>;
27
27
  /** Each action of an implementation with its handler, as `dispatch` makes it. */
28
- export type Bound = ReadonlyArray<readonly [Any$1, ErasedHandler<unknown>]>;
28
+ export type Bound = ReadonlyArray<readonly [Any, ErasedHandler<unknown>]>;
29
29
  /** Each action of an implementation with its handler as written, as its builder made them. */
30
- export type Written = ReadonlyArray<readonly [Any$1, WrittenHandler<unknown>]>;
30
+ export type Written = ReadonlyArray<readonly [Any, WrittenHandler<unknown>]>;
31
31
  /** A build shared by every layer an implementation reaches, through the one key it is provided under. */
32
32
  export interface Memoized<S, E, R> {
33
33
  readonly key: Context.Key<S, S>;
@@ -42,7 +42,7 @@ export interface Memoized<S, E, R> {
42
42
  * its handlers' builder, `RA` what its authorizer reads per request, and `EAX` and `RAX` the
43
43
  * failures and services of the authorizer's builder.
44
44
  */
45
- export declare class Implementation<A extends Any$1, RequestServices, EX, RX, RA = never, EAX = never, RAX = never> {
45
+ export declare class Implementation<A extends Any, RequestServices, EX, RX, RA = never, EAX = never, RAX = never> {
46
46
  #private;
47
47
  /** Type-only: each action's handler's request-time requirements. */
48
48
  readonly "~request": RequestServices;
@@ -64,7 +64,7 @@ export declare class Implementation<A extends Any$1, RequestServices, EX, RX, RA
64
64
  /** Builds its authorizer. */
65
65
  authorizer: Memoized<ErasedAuthorize, EAX, RAX>);
66
66
  /** Select contracts while retaining their handlers, authorization and shared builder. */
67
- static share(actions: readonly Any$1[], app: AnyImplementation): AnyImplementation;
67
+ static share(actions: readonly Any[], app: AnyImplementation): AnyImplementation;
68
68
  /**
69
69
  * The key of what runs a call of `app`'s actions: its handlers' memoized layer's, which each
70
70
  * `implement` makes, so it is unique to the implementation. Every selection retains it.
@@ -90,7 +90,7 @@ export declare class Implementation<A extends Any$1, RequestServices, EX, RX, RA
90
90
  * admits every implementation, while a value of this type owes `unknown`, which no surface can be
91
91
  * given.
92
92
  */
93
- export type AnyImplementation<A extends Any$1 = Any$1> = Implementation<A, unknown, unknown, unknown, unknown, unknown, unknown>;
93
+ export type AnyImplementation<A extends Any = Any> = Implementation<A, unknown, unknown, unknown, unknown, unknown, unknown>;
94
94
  /** What a surface serves: one implementation, of actions or of events, or a list of them. */
95
95
  export type Served = AnyImplementation | AnyEventImplementation | ReadonlyArray<AnyImplementation | AnyEventImplementation>;
96
96
  /** What a surface serving no events takes: one action implementation, or a list of them. */
@@ -101,7 +101,7 @@ export type Member<S> = S extends ReadonlyArray<infer App> ? App : S;
101
101
  * Options that may list actions and event types of `C`, the shape every selecting surface's
102
102
  * options share.
103
103
  */
104
- export interface Selection<C extends Any$1 | Any> {
104
+ export interface Selection<C extends Any | Any$1> {
105
105
  readonly actions?: readonly C[] | undefined;
106
106
  }
107
107
  /**
@@ -110,13 +110,13 @@ export interface Selection<C extends Any$1 | Any> {
110
110
  * may be absent, being optional or a union with options lacking it, select every action at run
111
111
  * time, so they narrow nothing.
112
112
  */
113
- export type Selected<O, All extends Any$1> = O extends {
113
+ export type Selected<O, All extends Any> = O extends {
114
114
  readonly actions: ReadonlyArray<infer C>;
115
- } ? Extract<C, Any$1> : All;
115
+ } ? Extract<C, Any> : All;
116
116
  /** The event types options `O` select, of `All`, as `Selected` selects actions. */
117
- export type SelectedEvents<O, All extends Any> = O extends {
117
+ export type SelectedEvents<O, All extends Any$1> = O extends {
118
118
  readonly actions: ReadonlyArray<infer C>;
119
- } ? Extract<C, Any> : All;
119
+ } ? Extract<C, Any$1> : All;
120
120
  /**
121
121
  * The middleware options `O` install, each a member of `L`: its `middleware` when always given,
122
122
  * an array of unknown length when it may be absent, which installs none or all of them, and
@@ -136,7 +136,7 @@ export type SelectedEventsOf<O, Apps extends Served> = SelectedEvents<O, EventOf
136
136
  * list, wherever some member of `O` may list them, as each is present whether the list is
137
137
  * given or not; every one where no member lists any.
138
138
  */
139
- export type Offered<O, All extends Any$1 | Any> = [Listing<O>] extends [never] ? All : Extract<All, Listing<O> extends ReadonlyArray<infer C> ? C : never>;
139
+ export type Offered<O, All extends Any | Any$1> = [Listing<O>] extends [never] ? All : Extract<All, Listing<O> extends ReadonlyArray<infer C> ? C : never>;
140
140
  type Listing<O> = O extends unknown ? NonNullable<O["actions" & keyof O]> : never;
141
141
  /**
142
142
  * No key of any member of `O` beyond those of `Keys`, so a misspelled option is refused
@@ -154,7 +154,7 @@ export type OptionalUnless<O, Given> = {} extends O ? [options?: Given] : [optio
154
154
  export type ActionOf<App> = App extends {
155
155
  readonly actions: ReadonlyArray<infer A>;
156
156
  } ? A : never;
157
- type Matches<A extends Any$1, Listed extends Any$1> = Listed extends Any$1 ? [A] extends [Listed] ? true : [Listed] extends [A] ? true : never : never;
157
+ type Matches<A extends Any, Listed extends Any> = Listed extends Any ? [A] extends [Listed] ? true : [Listed] extends [A] ? true : never : never;
158
158
  /**
159
159
  * The actions of `App` a surface given the actions `Listed` may serve, as `select` selects
160
160
  * them by identity: an action whose type either is assignable to, or is assigned by, one
@@ -162,34 +162,34 @@ type Matches<A extends Any$1, Listed extends Any$1> = Listed extends Any$1 ? [A]
162
162
  * actions, an erased one included, still counts, and another contract of a listed name, which
163
163
  * the surface leaves out beside an action it serves, does not.
164
164
  */
165
- export type Serving<App, Listed extends Any$1> = ActionOf<App> extends (infer A extends Any$1) ? A extends unknown ? [A] extends [Listed] ? A : string extends A["name"] ? A : [Extract<A["name"], Listed["name"]>] extends [never] ? never : [Matches<A, Listed>] extends [never] ? never : A : never : never;
165
+ export type Serving<App, Listed extends Any> = ActionOf<App> extends (infer A extends Any) ? A extends unknown ? [A] extends [Listed] ? A : string extends A["name"] ? A : [Extract<A["name"], Listed["name"]>] extends [never] ? never : [Matches<A, Listed>] extends [never] ? never : A : never : never;
166
166
  /**
167
167
  * What each implementation among `App` owes per request where a surface serving the actions
168
168
  * `Listed` serves it: its authorizer's services, and the handlers' of the actions it serves.
169
169
  */
170
- export type ServedRequest<App, Listed extends Any$1> = App extends unknown ? RequestOf<App, Serving<App, Listed>> : never;
170
+ export type ServedRequest<App, Listed extends Any> = App extends unknown ? RequestOf<App, Serving<App, Listed>> : never;
171
171
  /** The implementations among `App` holding an action of `Listed`: those a surface builds. */
172
- export type Holding<App, Listed extends Any$1> = App extends unknown ? [Serving<App, Listed>] extends [never] ? never : App : never;
172
+ export type Holding<App, Listed extends Any> = App extends unknown ? [Serving<App, Listed>] extends [never] ? never : App : never;
173
173
  /** The protected members of a contract union, of actions or of events. */
174
- export type Protected<A extends Pick<Any$1, "caller">> = A extends unknown ? A["caller"] extends typeof Anyone ? never : A : never;
174
+ export type Protected<A extends Pick<Any, "caller">> = A extends unknown ? A["caller"] extends typeof Anyone ? never : A : never;
175
175
  type ServiceOf<K> = K extends Context.Key<infer I, unknown> ? I : never;
176
- type AuthenticationOf<A extends Any$1> = A["caller"] extends typeof Anyone ? never : ServiceOf<A["caller"]>;
176
+ type AuthenticationOf<A extends Any> = A["caller"] extends typeof Anyone ? never : ServiceOf<A["caller"]>;
177
177
  /**
178
178
  * Per-request requirements of `App`'s authorization and handler for each `A` it
179
179
  * implements: those of every name `A`'s may be, so a union or an erased name owes each it may
180
180
  * stand for.
181
181
  */
182
- export type RequestOf<App, A extends Any$1> = App extends {
182
+ export type RequestOf<App, A extends Any> = App extends {
183
183
  readonly "~request": infer R;
184
184
  readonly "~authorizeRequest": infer RA;
185
- } ? A extends Any$1 ? unknown extends R ? unknown : [A["name"] & keyof R] extends [never] ? never : R[A["name"] & keyof R] | (A["caller"] extends typeof Anyone ? never : RA) | AuthenticationOf<A> : never : never;
186
- type OwnActions<App> = Extract<ActionOf<App>, Any$1>;
185
+ } ? A extends Any ? unknown extends R ? unknown : [A["name"] & keyof R] extends [never] ? never : R[A["name"] & keyof R] | (A["caller"] extends typeof Anyone ? never : RA) | AuthenticationOf<A> : never : never;
186
+ type OwnActions<App> = Extract<ActionOf<App>, Any>;
187
187
  /**
188
188
  * What a surface serving the actions `Listed` of the implementations `App` fails with at startup:
189
189
  * their builders' and built authorizers' failures, an authorizer's only if a selected protected
190
190
  * action needs it.
191
191
  */
192
- export type BuildError<App, Listed extends Any$1 = OwnActions<App>> = App extends {
192
+ export type BuildError<App, Listed extends Any = OwnActions<App>> = App extends {
193
193
  readonly "~buildError": infer EX;
194
194
  readonly "~authorizeBuildError": infer EAX;
195
195
  } ? EX | ([Protected<Serving<App, Listed>>] extends [never] ? never : EAX) : never;
@@ -197,7 +197,7 @@ export type BuildError<App, Listed extends Any$1 = OwnActions<App>> = App extend
197
197
  * What a surface serving the actions `Listed` of the implementations `App` reads at startup: their
198
198
  * builders' and built authorizers' services.
199
199
  */
200
- export type BuildServices<App, Listed extends Any$1 = OwnActions<App>> = App extends {
200
+ export type BuildServices<App, Listed extends Any = OwnActions<App>> = App extends {
201
201
  readonly "~buildServices": infer RX;
202
202
  readonly "~authorizeBuildServices": infer RAX;
203
203
  } ? RX | ([Protected<Serving<App, Listed>>] extends [never] ? never : RAX) : never;
@@ -1,8 +1,7 @@
1
1
  import { Anyone, CallerKeyed } from "./caller.mjs";
2
- import { Unauthenticated } from "./errors.mjs";
3
2
  import { projectedErrors } from "./declared.mjs";
3
+ import { Unauthenticated } from "./errors.mjs";
4
4
  import { checkInput } from "./input-check.mjs";
5
- import { assertOnce, heldOnce } from "./names.mjs";
6
5
  import { reportedTo, streamReportedTo } from "./progress.mjs";
7
6
  import { elementOf } from "./stream.mjs";
8
7
  import { Array, Cause, Context, Effect, Exit, Layer, Option, Predicate, References, Schema, Stream } from "effect";
@@ -136,7 +135,12 @@ const assertHeld = ({ why, fix, holder }, listed, held) => {
136
135
  throw new Error(`Listed in actions, but ${why}: ${markingOthers(missing, names)} (${fix}${sameName ? `; one marked (another contract) is a contract of that name ${holder}` : ""})`);
137
136
  }
138
137
  };
139
- const selectHeld = (apps, listed, holds, share) => {
138
+ const actionKind = {
139
+ noun: "action",
140
+ holds: (app) => app.actions,
141
+ share: (own, app) => Implementation.share(own, app)
142
+ };
143
+ const select = ({ holds, share }, apps, listed) => {
140
144
  if (listed === void 0) return apps;
141
145
  assertHeld(notHeld.byImplementation, listed, apps.flatMap(holds));
142
146
  return apps.flatMap((app) => {
@@ -146,24 +150,10 @@ const selectHeld = (apps, listed, holds, share) => {
146
150
  return own.length === held.length ? [app] : [share(own, app)];
147
151
  });
148
152
  };
149
- const select = (apps, listed) => selectHeld(apps, listed, (app) => app.actions, (own, app) => Implementation.share(own, app));
150
- const servedBy = (what, bound, apps, listed) => {
151
- if (listed !== void 0) assertHeld(notHeld.byBinding, listed, bound);
152
- const held = apps.flatMap((app) => app.actions);
153
- const served = select(apps, listed ?? bound.filter((action) => held.includes(action)));
154
- const actions = served.flatMap((app) => app.actions);
155
- if (actions.length === 0 && listed === void 0 && apps.length > 0) {
156
- const names = new Set(bound.map(({ name }) => name));
157
- throw new Error(`No action of these implementations is in this ${what}: ${markingOthers(held, names) || "none"} (pass an implementation of a bound action, or bind one of these)`);
158
- }
159
- assertOnce("served action", actions, heldOnce);
160
- return served;
161
- };
162
153
  const provideBuilders = (builders) => (layer) => {
163
154
  const [first, ...rest] = builders;
164
155
  return first === void 0 ? layer : Layer.provide(layer, Layer.mergeAll(first, ...rest));
165
156
  };
166
- const provideHandlers = (apps) => provideBuilders(apps.map((app) => Implementation.layerOf(app)));
167
157
  const acquire = (apps, keyed) => Effect.map(Effect.forEach(apps, (app) => Implementation.boundOf(app, keyed)), (bound) => bound.flat());
168
158
  const builtWith = (builders, acquisition) => {
169
159
  const [first, ...rest] = builders;
@@ -176,4 +166,4 @@ const builtWith = (builders, acquisition) => {
176
166
  return yield* Effect.provideContext(acquisition, context);
177
167
  });
178
168
  };
179
- export { Implementation, acquire, answered, answeringWhole, assertHeld, builderLayer, builtWith, elementsOf, markingOthers, memoized, notHeld, notMadeHere, provideBuilders, provideHandlers, select, selectHeld, servedBy, toList, uniqueKey };
169
+ export { Implementation, acquire, actionKind, answered, answeringWhole, assertHeld, builderLayer, builtWith, elementsOf, markingOthers, memoized, notHeld, notMadeHere, provideBuilders, select, toList, uniqueKey };
@@ -1,6 +1,6 @@
1
+ import { Any } from "../Action.mjs";
1
2
  import { Forbidden } from "./errors.mjs";
2
- import { Any } from "../Event.mjs";
3
- import { Any as Any$1 } from "../Action.mjs";
3
+ import { Any as Any$1 } from "../Event.mjs";
4
4
  import { Context, Effect } from "effect";
5
5
  /**
6
6
  * A check every call and every subscription runs on its decoded input, on every surface, once the
@@ -12,4 +12,4 @@ import { Context, Effect } from "effect";
12
12
  *
13
13
  * - Provide it to the layer graph the surfaces are built in, as `Layer.succeed(Action.InputCheck)(check)`: provided per request, it misses a socket's later calls.
14
14
  */
15
- export declare const InputCheck: Context.Reference<(contract: Any$1 | Any, input: Any$1["input"]["Type"]) => Effect.Effect<void, Forbidden>>;
15
+ export declare const InputCheck: Context.Reference<(contract: Any | Any$1, input: Any["input"]["Type"]) => Effect.Effect<void, Forbidden>>;
@@ -1,4 +1,4 @@
1
- import "../Event.mjs";
2
1
  import "../Action.mjs";
2
+ import "../Event.mjs";
3
3
  /** The members of the list `T` that are `U`: `T` itself where every one is, `[]` where none is. */
4
4
  export type Only<T extends readonly unknown[], U> = [Exclude<T[number], U>] extends [never] ? Extract<T, readonly U[]> : [Extract<T[number], U>] extends [never] ? readonly [] : ReadonlyArray<Extract<T[number], U>>;
@@ -1,5 +1,5 @@
1
- import { assertOnce } from "./names.mjs";
2
1
  import { isEvent } from "../Event.mjs";
2
+ import { assertOnce } from "./names.mjs";
3
3
  // src/contract/listed.ts
4
4
  const split = (contracts) => ({
5
5
  actions: contracts.flatMap((contract) => isEvent(contract) ? [] : [contract]),
@@ -1,5 +1,5 @@
1
- import { Checked } from "./occurrence.mjs";
2
1
  import { Any, Occurrence, Received } from "../Event.mjs";
2
+ import { Checked } from "./occurrence.mjs";
3
3
  import { Duration, Effect, Stream } from "effect";
4
4
  /** One poll's answer, as a surface sends it and a client reads it. */
5
5
  export interface Page {
@@ -1,8 +1,8 @@
1
+ import { OccurrenceSchema } from "./occurrence.mjs";
1
2
  import { Codec } from "./codec.mjs";
2
3
  import "./errors.mjs";
3
- import { OccurrenceSchema } from "./occurrence.mjs";
4
- import "./pages.mjs";
5
4
  import { Any } from "../Event.mjs";
5
+ import "./pages.mjs";
6
6
  import { Cause, Effect, Queue, Schema, Stream } from "effect";
7
7
  export declare const PushedOf: <E extends Any>(event: E) => Schema.Union<readonly [OccurrenceSchema<E>, Schema.TaggedStruct<"Gap", {
8
8
  readonly cursor: Schema.NullOr<Schema.String>;