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
/** | |
* @since 1.0.0 | |
*/ | |
import { Config, Context, Data, Effect, Layer } from "effect" | |
import * as Api from "playwright" | |
export class PlaywrightError extends Data.TaggedError("PlaywrightError")<{ | |
readonly cause: 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
import type { Chunk, Scope } from "effect" | |
import { Channel, Data, Effect, Mailbox } from "effect" | |
import type { AsyncInputProducer } from "effect/SingleProducerAsyncInput" | |
class WebSocketError extends Data.TaggedError("WebSocketError")<{ | |
cause: unknown | |
}> {} | |
const makeChannelDuplex = <Out, In, Err, R = never>( | |
f: (mailbox: Mailbox.Mailbox<Out, Err>) => Effect.Effect<(item: In) => Effect.Effect<void>, Err, R | Scope.Scope> |
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 { Equal, Hash } from "effect" | |
import * as Context from "effect/Context" | |
import * as Data from "effect/Data" | |
import * as Deferred from "effect/Deferred" | |
import * as Effect from "effect/Effect" | |
import * as Exit from "effect/Exit" | |
import * as MutableHashMap from "effect/MutableHashMap" | |
import * as MutableRef from "effect/MutableRef" | |
import * as Option from "effect/Option" | |
import * as Scope from "effect/Scope" |
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 type { StandardSchemaV1 } from "@standard-schema/spec" | |
import { NonEmptyArray } from "effect/Array" | |
import * as Data from "effect/Data" | |
import * as Effect from "effect/Effect" | |
import * as Predicate from "effect/Predicate" | |
export class StandardSchemaError extends Data.TaggedError( | |
"StandardSchemaError", | |
)<{ readonly issues: NonEmptyArray<StandardSchemaV1.Issue> }> { | |
static fromFailure( |
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 { | |
Data, | |
Effect, | |
Layer, | |
pipe, | |
PubSub, | |
Schedule, | |
Scope, | |
Stream, | |
} from "effect" |
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 Fs from "node:fs/promises" | |
export async function* readLinesReverse(path: string, chunkSize = 1024) { | |
const file = await Fs.open(path, "r") | |
const stat = await file.stat() | |
let pos = stat.size | |
let buffer: Buffer | null = null | |
while (true) { | |
pos = Math.max(0, pos - chunkSize) |
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 { | |
HttpApi, | |
HttpApiBuilder, | |
HttpApiEndpoint, | |
HttpApiGroup, | |
HttpApiMiddleware, | |
HttpApiSwagger, | |
HttpServerRequest | |
} from "@effect/platform" | |
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node" |
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 { Schema } from "@effect/schema" | |
import * as Model from "./Model.js" | |
import { DateTime } from "effect" | |
export const GroupId = Schema.Number.pipe(Schema.brand("GroupId")) | |
export class Group extends Model.Class<Group>("Group")({ | |
id: Model.PrimaryKey(GroupId), | |
name: Schema.NonEmptyTrimmedString, | |
createdAt: Model.CreatedAt, |
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 Http from "@effect/platform/HttpClient" | |
Http.request.post("https://accounts.spotify.com/api/token").pipe( | |
Http.request.basicAuth(clientId, clientSecret) | |
Http.request.urlParamsBody({ | |
grant_type: "refresh_token", | |
refresh_token: refreshToken, | |
client_id: clientId, | |
}), | |
Http.client.fetchOk, |
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 Http from "@effect/platform/HttpClient" | |
import { Schema } from "@effect/schema" | |
import { Array, Config, Context, Data, Effect, Layer, flow } from "effect" | |
import { Inngest as Inngest_ } from "inngest" | |
class InngestRun extends Schema.Class<InngestRun>("InngestRun")({ | |
run_id: Schema.String, | |
status: Schema.Literal("Running", "Completed", "Failed", "Cancelled"), | |
}) { | |
static decodeArray = Http.response.schemaBodyJsonScoped( |
NewerOlder