effect 4.0.0-beta.45 → 4.0.0-beta.47

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/src/Types.ts CHANGED
@@ -1001,3 +1001,11 @@ export type OmitReason<E, K extends string> = E extends { readonly reason: infer
1001
1001
  export type ExcludeReason<E, K extends string> = E extends { readonly reason: infer R }
1002
1002
  ? Exclude<R, { readonly _tag: K }>
1003
1003
  : never
1004
+
1005
+ /**
1006
+ * Extracts the required keys from a type.
1007
+ *
1008
+ * @since 4.0.0
1009
+ * @category types
1010
+ */
1011
+ export type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T]
@@ -2106,7 +2106,7 @@ export interface Param<Name extends string, S extends Schema.Top> extends
2106
2106
  S["~encoded.optionality"]
2107
2107
  >
2108
2108
  {
2109
- readonly "~rebuild.out": this
2109
+ readonly "Rebuild": Param<Name, S>
2110
2110
  readonly [ParamSchemaTypeId]: typeof ParamSchemaTypeId
2111
2111
  readonly name: Name
2112
2112
  readonly schema: S
@@ -317,7 +317,7 @@ const constEmptyPrivateKey = Redacted.make(new Uint8Array(32))
317
317
  const makeServerWriteIdentityPublicKey = (storeId: StoreId): string => `effect-eventlog-server-write:${storeId}`
318
318
 
319
319
  const entriesAfter = (journal: Array<RemoteEntry>, startSequence: number): ReadonlyArray<RemoteEntry> =>
320
- journal.filter((entry) => entry.remoteSequence > startSequence)
320
+ journal.filter((entry) => entry.remoteSequence >= startSequence)
321
321
 
322
322
  const toConflicts = (
323
323
  history: ReadonlyArray<Entry>,
@@ -559,7 +559,7 @@ export const makeStorageMemory: Effect.Effect<Storage["Service"], never, Scope.S
559
559
  remoteEntries: entriesAfter(ensureJournal(storeId), startSequence),
560
560
  compactors
561
561
  })
562
- const replayedUpTo = backlog.length > 0 ? backlog[backlog.length - 1].remoteSequence : startSequence
562
+ const replayedUpTo = backlog.length > 0 ? backlog[backlog.length - 1].remoteSequence : startSequence - 1
563
563
 
564
564
  return Stream.fromArray(backlog).pipe(
565
565
  Stream.concat(
@@ -399,7 +399,7 @@ export const makeStorage = (options?: {
399
399
  compactors,
400
400
  remoteEntries: yield* selectEntriesAfter(storeId, startSequence)
401
401
  })
402
- let watermark = backlog.length > 0 ? backlog[backlog.length - 1]!.remoteSequence : startSequence
402
+ let watermark = backlog.length > 0 ? backlog[backlog.length - 1]!.remoteSequence : startSequence - 1
403
403
 
404
404
  return Stream.fromArray(backlog).pipe(
405
405
  Stream.concat(
@@ -87,7 +87,7 @@ export type ResponseEncoding = {
87
87
  * @since 4.0.0
88
88
  */
89
89
  export function status(code: number) {
90
- return <S extends Schema.Top>(self: S): S["~rebuild.out"] => {
90
+ return <S extends Schema.Top>(self: S): S["Rebuild"] => {
91
91
  return self.annotate({ httpApiStatus: code })
92
92
  }
93
93
  }
@@ -190,7 +190,7 @@ export type MultipartTypeId = typeof MultipartTypeId
190
190
  /**
191
191
  * @since 4.0.0
192
192
  */
193
- export interface asMultipart<S extends Schema.Top> extends Schema.brand<S["~rebuild.out"], MultipartTypeId> {}
193
+ export interface asMultipart<S extends Schema.Top> extends Schema.brand<S["Rebuild"], MultipartTypeId> {}
194
194
 
195
195
  /**
196
196
  * Marks a schema as a multipart payload.
@@ -225,9 +225,7 @@ export type MultipartStreamTypeId = typeof MultipartStreamTypeId
225
225
  /**
226
226
  * @since 4.0.0
227
227
  */
228
- export interface asMultipartStream<S extends Schema.Top>
229
- extends Schema.brand<S["~rebuild.out"], MultipartStreamTypeId>
230
- {}
228
+ export interface asMultipartStream<S extends Schema.Top> extends Schema.brand<S["Rebuild"], MultipartStreamTypeId> {}
231
229
 
232
230
  /**
233
231
  * Marks a schema as a multipart stream payload.
@@ -252,7 +250,7 @@ export function asMultipartStream(options?: Multipart_.withLimits.Options) {
252
250
  function asNonMultipartEncoding<S extends Schema.Top>(self: S, options: {
253
251
  readonly _tag: "Json" | "FormUrlEncoded" | "Uint8Array" | "Text"
254
252
  readonly contentType?: string | undefined
255
- }): S["~rebuild.out"] {
253
+ }): S["Rebuild"] {
256
254
  return self.annotate({
257
255
  "~httpApiEncoding": {
258
256
  _tag: options._tag,
@@ -47,7 +47,7 @@ export interface Stream<A extends Schema.Top, E extends Schema.Top> extends
47
47
  Stream<A, E>
48
48
  >
49
49
  {
50
- readonly "~rebuild.out": this
50
+ readonly "Rebuild": Stream<A, E>
51
51
  readonly [StreamSchemaTypeId]: typeof StreamSchemaTypeId
52
52
  readonly success: A
53
53
  readonly error: E
@@ -89,8 +89,8 @@ export const getterAddAll = <A>(
89
89
  */
90
90
  export interface Transferable<S extends Schema.Top> extends
91
91
  Schema.decodeTo<
92
- Schema.toType<S["~rebuild.out"]>,
93
- S["~rebuild.out"]
92
+ Schema.toType<S["Rebuild"]>,
93
+ S["Rebuild"]
94
94
  >
95
95
  {}
96
96