This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as T from "@effect/core/io/Effect" | |
import type * as EX from "@effect/core/io/Exit" | |
import * as FID from "@effect/core/io/FiberId" | |
import * as HUB from "@effect/core/io/Hub" | |
import type * as RU from "@effect/core/io/Runtime" | |
import * as S from "@effect/core/stream/Stream" | |
import * as C from "@effect-ts/core/Case" | |
import { pipe } from "@tsplus/stdlib/data/Function" | |
import * as O from "@tsplus/stdlib/data/Maybe" | |
import * as ENV from "@tsplus/stdlib/service/Env" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as T from "@effect/core/io/Effect" | |
import type * as EX from "@effect/core/io/Exit" | |
import * as FID from "@effect/core/io/FiberId" | |
import * as HUB from "@effect/core/io/Hub" | |
import * as S from "@effect/core/stream/Stream" | |
import * as C from "@effect-ts/core/Case" | |
import { pipe } from "@tsplus/stdlib/data/Function" | |
import * as O from "@tsplus/stdlib/data/Maybe" | |
import * as ENV from "@tsplus/stdlib/service/Env" | |
import { Tag } from "@tsplus/stdlib/service/Tag" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pipe } from "@effect-ts/core" | |
import * as T from "@effect-ts/core/Effect" | |
import * as P from "@effect-ts/core/Effect/Promise" | |
import { tuple } from "@effect-ts/core/Function" | |
import * as O from "@effect-ts/core/Option" | |
export class ConcurrencyLock { | |
executing: P.Promise<never, void>[] = [] | |
constructor(readonly maxConcurrency: number) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataLoader<K, R, E, A> { | |
hitMap: HM.HashMap<K, number> = HM.make(); | |
promiseMap: HM.HashMap<K, P.Promise<E, A>> = HM.make(); | |
constructor(readonly resolve: (key: K) => T.Effect<R, E, A>) {} | |
acquire(key: K): readonly [isFirst: boolean, promise: P.Promise<E, A>] { | |
return pipe( | |
HM.get_(this.promiseMap, key), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @tsplus type Codec | |
*/ | |
export interface Codec<A> { | |
decode: (value: unknown) => E.Either<string, A>; | |
encode: (value: A) => unknown; | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Just a fake NodeJS db api exposed by mysql, mssql, etc...*/ | |
interface FakeTrans {} | |
interface FakeConnection { | |
query(sql: string, trans?: FakeTrans): Promise<ResultSet>; | |
beginTransaction(): Promise<FakeTrans>; | |
commitTransaction(trans: FakeTrans): Promise<void>; | |
rollbackTransaction(trans: FakeTrans): Promise<void>; | |
close(): Promise<void>; | |
} | |
declare function fakeConnect(): Promise<FakeConnection>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Just a fake NodeJS db api exposed by mysql, mssql, etc...*/ | |
interface FakeTrans {} | |
interface FakeConnection { | |
query(sql: string, trans?: FakeTrans): Promise<ResultSet>; | |
beginTransaction(): Promise<FakeTrans>; | |
commitTransaction(trans: FakeTrans): Promise<void>; | |
rollbackTransaction(trans: FakeTrans): Promise<void>; | |
} | |
declare function fakeConnect(): Promise<FakeConnection>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as E from "@effect-ts/core/Either"; | |
import * as O from "@effect-ts/core/Option"; | |
import * as D from "@effect-ts/core/Collections/Immutable/Dictionary"; | |
import * as CA from "@effect-ts/core/Case"; | |
import * as C from "@effect-ts/core/Collections/Immutable/Chunk"; | |
import * as Q from "@effect-ts/query/Query"; | |
import * as T from "@effect-ts/core/Effect"; | |
import * as CRM from "@effect-ts/query/CompletedRequestMap"; | |
import * as RQ from "@effect-ts/query/Request"; | |
import * as DS from "@effect-ts/query/DataSource"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Ref } from "@effect-ts/system/Ref"; | |
import { Option } from "@effect-ts/core/Classic/Option"; | |
import { Either } from "@effect-ts/core/Classic/Either"; | |
import { Request } from "src/Request"; | |
/** | |
* A `BlockedRequest[A]` keeps track of a request of type `A` along with a | |
* `Ref` containing the result of the request, existentially hiding the result | |
* type. This is used internally by the library to support data sources that | |
* return different result types for different requests while guaranteeing that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> [email protected] prebuild C:\Bus\pwa-ts\packages\frontend-fp-ts | |
> npm run clean | |
> [email protected] clean C:\Bus\pwa-ts\packages\frontend-fp-ts | |
> rimraf ./dist | |
> [email protected] build C:\Bus\pwa-ts\packages\frontend-fp-ts |