Hello, When we use a schema with a non-symmetrical transformation like this one
const Schema = S.Struct({
createdAt: S.DateFromString
})| import { SQSClient } from '@aws-sdk/client-sqs' | |
| import { Config, Context, Effect, Layer } from 'effect' | |
| const makeSqsClient = Effect.gen(function* () { | |
| const awsAccessKeyId = yield* Config.string('AWS_ACCESS_KEY_ID').pipe( | |
| Config.withDescription('AWS Access Key ID'), | |
| ) | |
| const awsSecretAccessKey = yield* Config.string('AWS_SECRET_ACCESS_KEY').pipe( | |
| Config.withDescription('AWS Secret'), | |
| ) |
| const useMediaRecorder = () => { | |
| const [mediaRecorder, setMediaRecorder] = useState< | |
| Option.Option<Either.Either<MediaRecorder, UnknownException>> | |
| >(Option.none()); | |
| const [queue] = useState(() => Effect.runSync(Queue.unbounded<BlobEvent>())); | |
| const cbRef = useRef(Option.none()); | |
| useEffect(() => { |
| type StateMachine = Data.TaggedEnum<{ | |
| Recording: { | |
| stream: Stream.Stream<BlobEvent>, | |
| mediaRecorder: MediaRecorder | |
| }; | |
| Stoped: {}; | |
| }>; | |
| export function TranscribeWhisper({ className }: { className?: string }) { | |
| const { Stoped, Recording, $match, $is } = Data.taggedEnum<StateMachine>(); |
| port { Chunk, Console, Context, Effect, Layer, Stream } from "effect"; | |
| import amqp from "amqplib"; | |
| import { NodeRuntime } from "@effect/platform-node"; | |
| const make = Effect.gen(function* () { | |
| const connection = yield* Effect.tryPromise(() => | |
| amqp.connect( | |
| "amqps://***", | |
| ), | |
| ); |
| return yield* pipe( | |
| // out | |
| Stream.fromQueue(queue), | |
| Stream.ensuring(Effect.zip(Queue.shutdown(queue), Console.log("Ending")), // Here I would be able to remove the "current" client from the current map of client | |
| Stream.pipeThroughChannel(Socket.toChannel(socket)), | |
| // in | |
| Stream.decodeText(), | |
| Stream.runForEach((message) => | |
| Effect.gen(function* () { |
| import { NodeRuntime } from "@effect/platform-node"; | |
| import { Schema } from "@effect/schema"; | |
| import { startConsumer } from "consumer"; | |
| import { Console, Effect, LogLevel, Logger, pipe } from "effect"; | |
| const consumer = startConsumer({ | |
| queueName: "QueueName", | |
| processFunc: (message) => { | |
| return Console.log("Treated !!", message); | |
| }, |
| import { | |
| DeleteMessageCommand, | |
| ReceiveMessageCommand, | |
| } from "@aws-sdk/client-sqs"; | |
| import { Schema } from "@effect/schema"; | |
| import { SqsLive, SqsService, getSqslient } from "@repo/shared/src/Sqs"; | |
| import { Array, Effect, Option, Schedule, pipe } from "effect"; | |
| import { logDebug, logError, logWarning } from "effect/Effect"; | |
| function takeFromSqs({ queueUrl }: { queueUrl: string }) { |
| import { NodeRuntime } from "@effect/platform-node"; | |
| import { Schema } from "@effect/schema"; | |
| import { SqsLive, SqsService } from "@repo/shared/src/Sqs"; | |
| import { Chunk, Console, Effect, Option, Stream, pipe } from "effect"; | |
| import { logError, logInfo } from "effect/Effect"; | |
| import { Consumer } from "sqs-consumer"; | |
| function makeStream<T, U>({ | |
| queueName, |
| { | |
| "InsertCharPre", | |
| { | |
| pattern = { "*.cs" }, | |
| --- @param opts AutoCmdCallbackOpts | |
| --- @return nil | |
| callback = function(opts) | |
| -- Only run if f-string escape character is typed | |
| if vim.v.char ~= "{" then return end |