├── README.md ├── CLAUDE.md ├── GEMINI.md ├── .envrc ├── scratchpad ├── index.ts ├── tsconfig.json └── package.json ├── .prettierignore ├── packages ├── platform-browser │ ├── README.md │ ├── src │ │ ├── index.ts.tpl │ │ ├── index.ts │ │ └── BrowserHttpClient.ts │ ├── test │ │ ├── fixtures │ │ │ ├── rpc-e2e.ts │ │ │ ├── rpc-schemas.ts │ │ │ └── rpc-worker.ts │ │ └── RpcWorker.test.ts │ ├── vitest.setup.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── vitest.config.ts │ ├── tsconfig.src.json │ ├── docgen.json │ ├── tsconfig.test.json │ └── LICENSE ├── platform-node-shared │ ├── test │ │ └── fixtures │ │ │ ├── config │ │ │ ├── integer │ │ │ ├── SHOUTING │ │ │ ├── secret │ │ │ └── nested │ │ │ │ └── config │ │ │ ├── text.txt │ │ │ ├── bash │ │ │ ├── non-zero-exit.sh │ │ │ ├── repeat.sh │ │ │ ├── no-permissions.sh │ │ │ └── duplex.sh │ │ │ └── helloworld.tar.gz │ ├── vitest.config.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── tsconfig.src.json │ ├── README.md │ ├── tsconfig.test.json │ └── LICENSE ├── sql │ ├── d1 │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── pg │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── vitest.config.ts │ │ ├── README.md │ │ ├── tsconfig.json │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── libsql │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ └── LibsqlMigrator.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ ├── test │ │ │ └── util.ts │ │ └── LICENSE │ ├── mysql2 │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── clickhouse │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ └── ClickhouseMigrator.ts │ │ ├── test │ │ │ └── Client.test.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── sqlite-bun │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── test │ │ │ └── Client.test.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── sqlite-do │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ └── SqliteMigrator.ts │ │ ├── test │ │ │ └── Client.test.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── sqlite-node │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── sqlite-react-native │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ └── SqliteMigrator.ts │ │ ├── test │ │ │ └── Client.test.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ ├── mssql │ │ ├── src │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ ├── MssqlMigrator.ts │ │ │ └── Parameter.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE │ └── sqlite-wasm │ │ ├── test │ │ └── Client.test.ts │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── src │ │ ├── internal │ │ │ └── opfsWorker.ts │ │ ├── index.ts │ │ ├── sqlite-wasm.d.ts │ │ └── SqliteMigrator.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.src.json │ │ ├── docgen.json │ │ ├── tsconfig.test.json │ │ └── LICENSE ├── effect │ ├── src │ │ ├── data │ │ │ └── index.ts.tpl │ │ ├── stm │ │ │ └── index.ts.tpl │ │ ├── encoding │ │ │ ├── index.ts.tpl │ │ │ ├── index.ts │ │ │ └── EncodingError.ts │ │ ├── platform │ │ │ └── index.ts.tpl │ │ ├── schema │ │ │ ├── index.ts.tpl │ │ │ └── Util.ts │ │ ├── stream │ │ │ ├── index.ts.tpl │ │ │ └── Take.ts │ │ ├── testing │ │ │ ├── index.ts.tpl │ │ │ └── index.ts │ │ ├── types │ │ │ └── index.ts.tpl │ │ ├── collections │ │ │ └── index.ts.tpl │ │ ├── interfaces │ │ │ └── index.ts.tpl │ │ ├── unstable │ │ │ ├── ai │ │ │ │ └── index.ts.tpl │ │ │ ├── cli │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── internal │ │ │ │ │ ├── completions.ts │ │ │ │ │ └── completions │ │ │ │ │ │ └── types.ts │ │ │ │ └── index.ts │ │ │ ├── http │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── Multipasta.ts │ │ │ │ ├── FindMyWay.ts │ │ │ │ └── Multipasta │ │ │ │ │ ├── Node.ts │ │ │ │ │ ├── Web.ts │ │ │ │ │ ├── Search.ts │ │ │ │ │ └── HeadersParser.ts │ │ │ ├── rpc │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── RpcClientError.ts │ │ │ │ └── index.ts │ │ │ ├── sql │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── SqlError.ts │ │ │ │ └── index.ts │ │ │ ├── cluster │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── internal │ │ │ │ │ ├── interruptors.ts │ │ │ │ │ └── hash.ts │ │ │ │ ├── EntityId.ts │ │ │ │ ├── EntityType.ts │ │ │ │ ├── MachineId.ts │ │ │ │ ├── Singleton.ts │ │ │ │ ├── DeliverAt.ts │ │ │ │ ├── ClusterMetrics.ts │ │ │ │ ├── SingletonAddress.ts │ │ │ │ └── TestRunner.ts │ │ │ ├── encoding │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── httpapi │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── jsonschema │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── reactivity │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── schema │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── socket │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ ├── workers │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── index.ts │ │ │ │ └── WorkerError.ts │ │ │ ├── workflow │ │ │ │ ├── index.ts.tpl │ │ │ │ ├── internal │ │ │ │ │ └── crypto.ts │ │ │ │ └── index.ts │ │ │ ├── observability │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ │ └── persistence │ │ │ │ ├── index.ts.tpl │ │ │ │ └── index.ts │ │ ├── internal │ │ │ ├── version.ts │ │ │ ├── metric.ts │ │ │ ├── redacted.ts │ │ │ ├── array.ts │ │ │ ├── errors.ts │ │ │ ├── record.ts │ │ │ ├── equal.ts │ │ │ └── tracer.ts │ │ ├── Differ.ts │ │ ├── index.ts.tpl │ │ └── Symbol.ts │ ├── vitest.config.ts │ ├── tsconfig.json │ ├── test │ │ ├── schema │ │ │ └── Issue.test.ts │ │ ├── Fiber.test.ts │ │ ├── data │ │ │ ├── Reducer.test.ts │ │ │ └── Ordering.test.ts │ │ ├── primitives │ │ │ ├── String.test.ts │ │ │ └── BigInt.test.ts │ │ ├── Exit.test.ts │ │ ├── unstable │ │ │ └── http │ │ │ │ ├── UrlParams.test.ts │ │ │ │ ├── Multipart.test.ts │ │ │ │ └── Headers.test.ts │ │ ├── Scope.test.ts │ │ ├── cluster │ │ │ └── Entity.test.ts │ │ └── rpc │ │ │ └── Rpc.test.ts │ ├── tsconfig.build.json │ ├── tsconfig.src.json │ ├── dtslint │ │ ├── Schedule.tst.ts │ │ └── schema │ │ │ └── Annotations.tst.ts │ ├── tsconfig.test.json │ ├── docgen.json │ └── LICENSE ├── platform-bun │ ├── src │ │ ├── index.ts.tpl │ │ ├── BunSink.ts │ │ ├── BunSocketServer.ts │ │ ├── BunHttpClient.ts │ │ ├── BunHttpServerRequest.ts │ │ ├── BunFileSystem.ts │ │ ├── BunPath.ts │ │ ├── BunTerminal.ts │ │ ├── BunServices.ts │ │ └── BunMultipart.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── README.md │ ├── tsconfig.src.json │ ├── docgen.json │ └── LICENSE ├── platform-node │ ├── src │ │ ├── index.ts.tpl │ │ ├── NodeSink.ts │ │ ├── NodeStream.ts │ │ ├── NodeSocketServer.ts │ │ ├── Mime.ts │ │ ├── Undici.ts │ │ ├── NodeFileSystem.ts │ │ ├── NodePath.ts │ │ ├── NodeHttpServerRequest.ts │ │ ├── NodeTerminal.ts │ │ └── NodeServices.ts │ ├── test │ │ ├── fixtures │ │ │ ├── pg-utils.ts │ │ │ ├── text.txt │ │ │ └── mysql2-utils.ts │ │ └── cluster │ │ │ └── MessageStorageTest.ts │ ├── vitest.config.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── README.md │ ├── tsconfig.src.json │ ├── docgen.json │ └── LICENSE ├── tools │ └── openapi-generator │ │ ├── docgen.json │ │ ├── vitest.config.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ ├── src │ │ └── bin.ts │ │ ├── tsconfig.src.json │ │ ├── tsconfig.test.json │ │ └── LICENSE └── vitest │ ├── vitest.config.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── tsconfig.src.json │ ├── docgen.json │ ├── tsconfig.test.json │ └── LICENSE ├── .prettierrc.json ├── scripts ├── codemods │ ├── vitest.config.ts │ └── ts-fence.ts ├── version.template.txt ├── version.mjs ├── tsconfig.json ├── package-scalar.mjs ├── clean.mjs ├── codemod.mjs ├── circular.mjs ├── package-swagger.mjs ├── package.json └── codemod-ts-fence.mjs ├── bundle ├── basic.ts ├── logger.ts ├── optic.ts ├── stream.ts ├── brand.ts ├── differ.ts ├── schema-string.ts ├── schedule.ts ├── schema-formatter.ts ├── cache.ts ├── schema-arbitrary.ts ├── schema-equivalence.ts ├── schema-json-schema.ts ├── schema-record-literals-key.ts ├── schema-string-check.ts ├── schema-template-literal.ts ├── metric.ts ├── tsconfig.json ├── schema.ts ├── config.ts ├── schema-toSerializerStringTree.ts ├── http-client.ts ├── queue.ts ├── schema-string-async.ts ├── stm.ts ├── pubsub.ts └── batching.ts ├── .changeset ├── five-cases-wear.md ├── hot-bats-sparkle.md ├── fix-graph-neighbors-undirected.md └── config.json ├── pnpm-workspace.yaml ├── tstyche.config.json ├── .gitignore ├── examples └── simple-cli │ ├── tsconfig.json │ └── package.json ├── .claude └── commands │ └── port.md ├── CHANGES.md ├── vitest.setup.ts ├── flake.nix ├── flake.lock ├── vitest.config.ts ├── deno.json ├── .github ├── workflows │ └── snapshot.yml └── actions │ └── setup │ └── action.yaml ├── tsconfig.json ├── rollup.config.js ├── vitest.shared.ts └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CLAUDE.md: -------------------------------------------------------------------------------- 1 | AGENTS.md -------------------------------------------------------------------------------- /GEMINI.md: -------------------------------------------------------------------------------- 1 | AGENTS.md -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /scratchpad/index.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.ts 2 | **/*.js 3 | -------------------------------------------------------------------------------- /packages/platform-browser/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/platform-browser` 2 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/config/integer: -------------------------------------------------------------------------------- 1 | 123 2 | -------------------------------------------------------------------------------- /packages/sql/d1/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/sql/pg/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/data/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/stm/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/config/SHOUTING: -------------------------------------------------------------------------------- 1 | value 2 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/config/secret: -------------------------------------------------------------------------------- 1 | keepitsafe 2 | -------------------------------------------------------------------------------- /packages/sql/libsql/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/sql/mysql2/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/encoding/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/platform/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/schema/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/stream/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/testing/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/types/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-browser/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-bun/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/config/nested/config: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /packages/platform-node/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-node/test/fixtures/pg-utils.ts: -------------------------------------------------------------------------------- 1 | ../../../sql/pg/test/utils.ts -------------------------------------------------------------------------------- /packages/platform-node/test/fixtures/text.txt: -------------------------------------------------------------------------------- 1 | lorem ipsum dolar sit amet 2 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/collections/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/interfaces/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/ai/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cli/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/rpc/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/sql/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/text.txt: -------------------------------------------------------------------------------- 1 | lorem ipsum dolar sit amet 2 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/encoding/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/httpapi/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/jsonschema/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/reactivity/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/schema/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/socket/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workers/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workflow/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-node/test/fixtures/mysql2-utils.ts: -------------------------------------------------------------------------------- 1 | ../../../sql/mysql2/test/utils.ts -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/observability/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/persistence/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | -------------------------------------------------------------------------------- /packages/platform-browser/test/fixtures/rpc-e2e.ts: -------------------------------------------------------------------------------- 1 | ../../../platform-node/test/fixtures/rpc-e2e.ts -------------------------------------------------------------------------------- /packages/effect/src/unstable/cli/internal/completions.ts: -------------------------------------------------------------------------------- 1 | export * from "./completions/index.ts" 2 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "printWidth": 120, 4 | "trailingComma": "none" 5 | } 6 | -------------------------------------------------------------------------------- /packages/platform-browser/test/fixtures/rpc-schemas.ts: -------------------------------------------------------------------------------- 1 | ../../../platform-node/test/fixtures/rpc-schemas.ts -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/bash/non-zero-exit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exit 1 4 | -------------------------------------------------------------------------------- /packages/platform-node/test/cluster/MessageStorageTest.ts: -------------------------------------------------------------------------------- 1 | ../../../effect/test/cluster/MessageStorage.test.ts -------------------------------------------------------------------------------- /scripts/codemods/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | test: { 3 | globals: true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/effect/src/internal/version.ts: -------------------------------------------------------------------------------- 1 | export const version: version = "dev" 2 | export type version = "dev" 3 | -------------------------------------------------------------------------------- /scripts/version.template.txt: -------------------------------------------------------------------------------- 1 | export const version: version = "VERSION" 2 | export type version = "VERSION" 3 | -------------------------------------------------------------------------------- /bundle/basic.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | 3 | Effect.succeed(123).pipe(Effect.runFork) 4 | -------------------------------------------------------------------------------- /.changeset/five-cases-wear.md: -------------------------------------------------------------------------------- 1 | --- 2 | "effect": patch 3 | --- 4 | 5 | preserve precision of histogram metric boundaries 6 | -------------------------------------------------------------------------------- /bundle/logger.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | 3 | Effect.log("hello").pipe( 4 | Effect.runFork 5 | ) 6 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/internal/interruptors.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export const internalInterruptors = new Set() 3 | -------------------------------------------------------------------------------- /.changeset/hot-bats-sparkle.md: -------------------------------------------------------------------------------- 1 | --- 2 | "effect": minor 3 | --- 4 | 5 | improve Effect.filter\* types to exludes candidates in fallback functions 6 | -------------------------------------------------------------------------------- /packages/sql/d1/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as D1Client from "./D1Client.ts" 9 | -------------------------------------------------------------------------------- /packages/effect/src/internal/metric.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export const FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey" 3 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/@effect/docgen/schema.json", 3 | "exclude": ["**/*.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - scratchpad 3 | - scripts 4 | - packages/* 5 | - packages/sql/* 6 | - packages/tools/* 7 | - examples/* 8 | -------------------------------------------------------------------------------- /packages/platform-browser/vitest.setup.ts: -------------------------------------------------------------------------------- 1 | import { defineWebWorkers } from "@vitest/web-worker/pure" 2 | 3 | defineWebWorkers({ 4 | clone: "none" 5 | }) 6 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/bash/repeat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for i in {1..60}; do 4 | echo "iteration: $i" 5 | sleep 1 6 | done 7 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/jsonschema/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Rewriter from "./Rewriter.ts" 9 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunSink.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * from "@effect/platform-node-shared/NodeSink" 9 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/bash/no-permissions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "this should not run because it doesn't have execute permissions" 4 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeSink.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * from "@effect/platform-node-shared/NodeSink" 9 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/reactivity/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Reactivity from "./Reactivity.ts" 9 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/helloworld.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unknown/effect-smol/main/packages/platform-node-shared/test/fixtures/helloworld.tar.gz -------------------------------------------------------------------------------- /packages/platform-node/src/NodeStream.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * from "@effect/platform-node-shared/NodeStream" 9 | -------------------------------------------------------------------------------- /bundle/optic.ts: -------------------------------------------------------------------------------- 1 | import * as Optic from "#dist/effect/Optic" 2 | 3 | type S = { readonly a: number } 4 | const optic = Optic.id().key("a") 5 | 6 | optic.getResult({ a: 1 }) 7 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunSocketServer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * from "@effect/platform-node-shared/NodeSocketServer" 9 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/test/Client.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | 3 | describe("ClickhouseClient", () => { 4 | it("should work", () => { 5 | }) 6 | }) 7 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/Multipasta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "multipasta" 10 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeSocketServer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * from "@effect/platform-node-shared/NodeSocketServer" 9 | -------------------------------------------------------------------------------- /packages/sql/mssql/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | export { 6 | /** 7 | * @since 1.0.0 8 | */ 9 | TYPES as MssqlTypes 10 | } from "tedious" 11 | -------------------------------------------------------------------------------- /tstyche.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://tstyche.org/schemas/config.json", 3 | "testFileMatch": [ 4 | "packages/*/dtslint/**/*.tst.*" 5 | ], 6 | "tsconfig": "ignore" 7 | } 8 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/FindMyWay.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "find-my-way-ts" 10 | -------------------------------------------------------------------------------- /packages/effect/src/internal/redacted.ts: -------------------------------------------------------------------------------- 1 | import type * as Redacted from "../data/Redacted.ts" 2 | 3 | /** @internal */ 4 | export const redactedRegistry = new WeakMap, any>() 5 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/Multipasta/Node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "multipasta/node" 10 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/Multipasta/Web.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "multipasta/web" 10 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/Multipasta/Search.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "multipasta/Search" 10 | -------------------------------------------------------------------------------- /bundle/stream.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Stream from "#dist/effect/stream/Stream" 3 | 4 | Stream.range(1, 100_000).pipe( 5 | Stream.runDrain, 6 | Effect.runSync 7 | ) 8 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunHttpClient.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | * @category re-exports 8 | */ 9 | export * from "effect/unstable/http/FetchHttpClient" 10 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/http/Multipasta/HeadersParser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | * @category re-exports 8 | */ 9 | export * from "multipasta/HeadersParser" 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/test/Client.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | 4 | describe("Client", () => { 5 | it.effect("should work", () => Effect.void) 6 | }) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/test/Client.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | 4 | describe("Client", () => { 5 | it.effect("should work", () => Effect.void) 6 | }) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/test/Client.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | 4 | describe("Client", () => { 5 | it.effect("should work", () => Effect.void) 6 | }) 7 | -------------------------------------------------------------------------------- /packages/platform-bun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/platform-browser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/test/Client.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | 4 | describe("Client", () => { 5 | it.effect("should work", () => Effect.void) 6 | }) 7 | -------------------------------------------------------------------------------- /packages/platform-node-shared/test/fixtures/bash/duplex.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function echoerr() { 4 | echo "$@" 1>&2 5 | } 6 | 7 | echo "stdout1" 8 | echoerr "stderr1" 9 | 10 | echo "stdout2" 11 | echoerr "stderr2" 12 | -------------------------------------------------------------------------------- /bundle/brand.ts: -------------------------------------------------------------------------------- 1 | import * as Brand from "#dist/effect/data/Brand" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | type Positive = number & Brand.Brand<"Positive"> 5 | const Positive = Brand.check(Schema.isPositive()) 6 | -------------------------------------------------------------------------------- /packages/effect/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/d1/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/pg/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/vitest/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /bundle/differ.ts: -------------------------------------------------------------------------------- 1 | import * as Schema from "#dist/effect/schema/Schema" 2 | 3 | const schema = Schema.Struct({ 4 | id: Schema.Number, 5 | name: Schema.String, 6 | price: Schema.Number 7 | }) 8 | 9 | Schema.makeDifferJsonPatch(schema) 10 | -------------------------------------------------------------------------------- /bundle/schema-string.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.String 5 | 6 | Schema.decodeUnknownEffect(schema)("a").pipe( 7 | Effect.runFork 8 | ) 9 | -------------------------------------------------------------------------------- /packages/effect/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/platform-node/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/libsql/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/mssql/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/mysql2/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/vitest/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/platform-node-shared/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/d1/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/pg/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-pg` 2 | 3 | An `@effect/sql` implementation using the `postgres.js` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-pg). 8 | -------------------------------------------------------------------------------- /packages/sql/pg/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as PgClient from "./PgClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as PgMigrator from "./PgMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/pg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/platform-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/libsql/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/mssql/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/mysql2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/platform-node-shared/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/mssql/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-mssql` 2 | 3 | An `@effect/sql` implementation using the mssql `tedious` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-mssql). 8 | -------------------------------------------------------------------------------- /packages/sql/mysql2/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-mysql2` 2 | 3 | An `@effect/sql` implementation using the `mysql2` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-mysql2). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = {} 5 | 6 | export default mergeConfig(shared, config) 7 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/schema/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Model from "./Model.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as VariantSchema from "./VariantSchema.ts" 14 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/socket/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Socket from "./Socket.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as SocketServer from "./SocketServer.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/libsql/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-libsql` 2 | 3 | An `@effect/sql` implementation using the `@libsql/client` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-libsql). 8 | -------------------------------------------------------------------------------- /packages/sql/mysql2/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as MysqlClient from "./MysqlClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as MysqlMigrator from "./MysqlMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [{ "path": "tsconfig.src.json" }, { "path": "tsconfig.test.json" }] 6 | } 7 | -------------------------------------------------------------------------------- /bundle/schedule.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schedule from "#dist/effect/Schedule" 3 | 4 | Effect.succeed(123).pipe( 5 | Effect.repeat({ 6 | schedule: Schedule.spaced("100 millis") 7 | }), 8 | Effect.runFork 9 | ) 10 | -------------------------------------------------------------------------------- /packages/effect/src/internal/array.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 2.0.0 3 | */ 4 | 5 | import type { NonEmptyArray } from "../collections/Array.ts" 6 | 7 | /** @internal */ 8 | export const isArrayNonEmpty = (self: ReadonlyArray): self is NonEmptyArray => self.length > 0 9 | -------------------------------------------------------------------------------- /packages/sql/libsql/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as LibsqlClient from "./LibsqlClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as LibsqlMigrator from "./LibsqlMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-sqlite-bun` 2 | 3 | An `@effect/sql` implementation using the `bun:sqlite` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-sqlite-bun). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as SqliteClient from "./SqliteClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as SqliteMigrator from "./SqliteMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as SqliteClient from "./SqliteClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as SqliteMigrator from "./SqliteMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as SqliteClient from "./SqliteClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as SqliteMigrator from "./SqliteMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/d1/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-d1` 2 | 3 | An `@effect/sql` implementation for [Cloudflare D1](https://developers.cloudflare.com/d1/). 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-d1). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-sqlite-node` 2 | 3 | An `@effect/sql` implementation using the `better-sqlite3` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-sqlite-node). 8 | -------------------------------------------------------------------------------- /bundle/schema-formatter.ts: -------------------------------------------------------------------------------- 1 | import * as Schema from "#dist/effect/schema/Schema" 2 | 3 | const schema = Schema.Struct({ 4 | a: Schema.String, 5 | b: Schema.optional(Schema.FiniteFromString), 6 | c: Schema.Array(Schema.String) 7 | }) 8 | 9 | Schema.makeFormatter(schema) 10 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-clickhouse` 2 | 3 | An `@effect/sql` implementation for [ClickHouse](https://clickhouse.com/). 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-clickhouse). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-sqlite-do` 2 | 3 | An `@effect/sql` implementation for Cloudflare Durable Objects sqlite storage. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-sqlite-do). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as SqliteClient from "./SqliteClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as SqliteMigrator from "./SqliteMigrator.ts" 14 | -------------------------------------------------------------------------------- /bundle/cache.ts: -------------------------------------------------------------------------------- 1 | import * as Cache from "#dist/effect/Cache" 2 | import * as Effect from "#dist/effect/Effect" 3 | 4 | Cache.make({ 5 | capacity: 1024, 6 | lookup: (key: string) => Effect.succeed(key) 7 | }).pipe( 8 | Effect.flatMap(Cache.get("1")), 9 | Effect.runFork 10 | ) 11 | -------------------------------------------------------------------------------- /bundle/schema-arbitrary.ts: -------------------------------------------------------------------------------- 1 | import * as Schema from "#dist/effect/schema/Schema" 2 | 3 | const schema = Schema.Struct({ 4 | a: Schema.String, 5 | b: Schema.optional(Schema.FiniteFromString), 6 | c: Schema.Array(Schema.String) 7 | }) 8 | 9 | Schema.makeArbitraryLazy(schema) 10 | -------------------------------------------------------------------------------- /bundle/schema-equivalence.ts: -------------------------------------------------------------------------------- 1 | import * as Schema from "#dist/effect/schema/Schema" 2 | 3 | const schema = Schema.Struct({ 4 | a: Schema.String, 5 | b: Schema.optional(Schema.FiniteFromString), 6 | c: Schema.Array(Schema.String) 7 | }) 8 | 9 | Schema.makeEquivalence(schema) 10 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as ClickhouseClient from "./ClickhouseClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as ClickhouseMigrator from "./ClickhouseMigrator.ts" 14 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-sqlite-wasm` 2 | 3 | An `@effect/sql` implementation using the `@sqlite.org/sqlite-wasm` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-sqlite-wasm). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/src/internal/opfsWorker.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export type OpfsWorkerMessage = 3 | | [id: number, sql: string, params: ReadonlyArray] 4 | | ["import", id: number, data: Uint8Array] 5 | | ["export", id: number] 6 | | ["update_hook"] 7 | | ["close"] 8 | -------------------------------------------------------------------------------- /bundle/schema-json-schema.ts: -------------------------------------------------------------------------------- 1 | import * as Schema from "#dist/effect/schema/Schema" 2 | 3 | const schema = Schema.Struct({ 4 | a: Schema.String, 5 | b: Schema.optional(Schema.FiniteFromString), 6 | c: Schema.Array(Schema.String) 7 | }) 8 | 9 | Schema.makeJsonSchemaDraft07(schema) 10 | -------------------------------------------------------------------------------- /packages/platform-node/src/Mime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import Mime from "mime" 5 | 6 | /** 7 | * @since 1.0.0 8 | * @category re-exports 9 | */ 10 | export * from "mime" 11 | 12 | /** 13 | * @since 1.0.0 14 | * @category re-exports 15 | */ 16 | export default Mime 17 | -------------------------------------------------------------------------------- /bundle/schema-record-literals-key.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.Record(Schema.Literals(["a", "b"]), Schema.String) 5 | 6 | Schema.decodeUnknownEffect(schema)({}).pipe( 7 | Effect.runFork 8 | ) 9 | -------------------------------------------------------------------------------- /bundle/schema-string-check.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.String.check(Schema.isNonEmpty()) 5 | 6 | Schema.decodeUnknownEffect(schema)({ a: "a", b: 1, c: ["c"] }).pipe( 7 | Effect.runFork 8 | ) 9 | -------------------------------------------------------------------------------- /packages/platform-node/src/Undici.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import Undici from "undici" 5 | 6 | /** 7 | * @since 1.0.0 8 | * @category undici 9 | */ 10 | export * from "undici" 11 | 12 | /** 13 | * @since 1.0.0 14 | * @category undici 15 | */ 16 | export default Undici 17 | -------------------------------------------------------------------------------- /packages/sql/d1/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/pg/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/vitest/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/platform-bun/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/platform-node/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/libsql/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/mssql/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/mysql2/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/platform-browser/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/platform-node-shared/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/sql-sqlite-react-native` 2 | 3 | An `@effect/sql` implementation using the `react-native-quick-sqlite` library. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-sqlite-react-native). 8 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "stripInternal": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "tsup" 2 | 3 | export default defineConfig({ 4 | entry: ["src/bin.ts"], 5 | clean: true, 6 | publicDir: true, 7 | format: "esm", 8 | banner: { 9 | js: "#!/usr/bin/env node" 10 | }, 11 | treeshake: "smallest" 12 | }) 13 | -------------------------------------------------------------------------------- /packages/effect/test/schema/Issue.test.ts: -------------------------------------------------------------------------------- 1 | import { Issue } from "effect/schema" 2 | import { describe, it } from "vitest" 3 | import { assertTrue } from "../utils/assert.ts" 4 | 5 | describe("Issue", () => { 6 | it("isIssue", () => { 7 | assertTrue(Issue.isIssue(new Issue.MissingKey(undefined))) 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | export * as OpfsWorker from "./OpfsWorker.ts" 5 | 6 | /** 7 | * @since 1.0.0 8 | */ 9 | export * as SqliteClient from "./SqliteClient.ts" 10 | 11 | /** 12 | * @since 1.0.0 13 | */ 14 | export * as SqliteMigrator from "./SqliteMigrator.ts" 15 | -------------------------------------------------------------------------------- /bundle/schema-template-literal.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.TemplateLiteral(["a", Schema.String]) 5 | 6 | Schema.decodeUnknownEffect(schema)("abc").pipe( 7 | Effect.tap(console.log), 8 | Effect.runFork 9 | ) 10 | -------------------------------------------------------------------------------- /packages/effect/src/internal/errors.ts: -------------------------------------------------------------------------------- 1 | import { formatPath } from "../data/Formatter.ts" 2 | 3 | /** @internal */ 4 | export function errorWithPath(message: string, path: ReadonlyArray) { 5 | if (path.length > 0) { 6 | message += `\n at ${formatPath(path)}` 7 | } 8 | return new Error(message) 9 | } 10 | -------------------------------------------------------------------------------- /packages/effect/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.src.json", 4 | "compilerOptions": { 5 | "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", 6 | "outDir": "dist", 7 | "types": ["node"], 8 | "stripInternal": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/effect/test/Fiber.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, describe, it } from "@effect/vitest" 2 | import { Effect, Fiber } from "effect" 3 | 4 | describe("Effect", () => { 5 | it("Fiber is a fiber", async () => { 6 | const result = Effect.runFork(Effect.succeed(1)) 7 | assert.isTrue(Fiber.isFiber(result)) 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/encoding/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Msgpack from "./Msgpack.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as Ndjson from "./Ndjson.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as Sse from "./Sse.ts" 19 | -------------------------------------------------------------------------------- /scripts/version.mjs: -------------------------------------------------------------------------------- 1 | import * as Fs from "node:fs" 2 | import Package from "../packages/effect/package.json" with { type: "json" } 3 | 4 | const tpl = Fs.readFileSync("./scripts/version.template.txt").toString("utf8") 5 | 6 | Fs.writeFileSync( 7 | "packages/effect/src/internal/version.ts", 8 | tpl.replace(/VERSION/g, Package.version) 9 | ) 10 | -------------------------------------------------------------------------------- /packages/effect/src/Differ.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @category Model 7 | * @since 4.0.0 8 | */ 9 | export interface Differ { 10 | readonly empty: Patch 11 | diff(oldValue: T, newValue: T): Patch 12 | combine(first: Patch, second: Patch): Patch 13 | patch(oldValue: T, patch: Patch): T 14 | } 15 | -------------------------------------------------------------------------------- /packages/platform-browser/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { mergeConfig, type ViteUserConfig } from "vitest/config" 2 | import shared from "../../vitest.shared.ts" 3 | 4 | const config: ViteUserConfig = { 5 | test: { 6 | environment: "happy-dom", 7 | setupFiles: "./vitest.setup.ts" 8 | } 9 | } 10 | 11 | export default mergeConfig(shared, config) 12 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/src/bin.ts: -------------------------------------------------------------------------------- 1 | import * as NodeRuntime from "@effect/platform-node/NodeRuntime" 2 | import * as NodeServices from "@effect/platform-node/NodeServices" 3 | import * as Effect from "effect/Effect" 4 | import { run } from "./main.ts" 5 | 6 | run.pipe( 7 | Effect.provide(NodeServices.layer), 8 | NodeRuntime.runMain 9 | ) 10 | -------------------------------------------------------------------------------- /bundle/metric.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Metric from "#dist/effect/Metric" 3 | 4 | const program = Effect.gen(function*() { 5 | yield* Effect.succeed(1).pipe( 6 | Effect.forkChild({ startImmediately: true }) 7 | ) 8 | }) 9 | 10 | program.pipe( 11 | Metric.enableRuntimeMetrics, 12 | Effect.runFork 13 | ) 14 | -------------------------------------------------------------------------------- /packages/effect/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "compilerOptions": { 6 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 7 | "outDir": ".tsbuildinfo/src", 8 | "types": ["node"], 9 | "rootDir": "src" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.changeset/fix-graph-neighbors-undirected.md: -------------------------------------------------------------------------------- 1 | --- 2 | "effect": patch 3 | --- 4 | 5 | Fix Graph.neighbors() returning self-loops in undirected graphs. 6 | 7 | Graph.neighbors() now correctly returns the other endpoint for undirected graphs instead of always returning edge.target, which caused nodes to appear as their own neighbors when queried from the target side of an edge. 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Direnv 2 | .direnv/ 3 | 4 | # Generated by TypeScript 5 | dist/ 6 | build/ 7 | .tsbuildinfo/ 8 | tsconfig.tsbuildinfo 9 | 10 | # Generated by Pnpm 11 | node_modules/ 12 | 13 | coverage/ 14 | docs/ 15 | 16 | .DS_Store 17 | tmp 18 | stats.html 19 | jsdoc-analysis-results.json 20 | jsdoc-stats.md 21 | 22 | # scratchpad files 23 | scratchpad/**/*.ts 24 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunHttpServerRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type { HttpServerRequest } from "effect/unstable/http/HttpServerRequest" 5 | 6 | /** 7 | * @since 1.0.0 8 | * @category Accessors 9 | */ 10 | export const toBunServerRequest = (self: HttpServerRequest): Bun.BunRequest => 11 | (self as any).source 12 | -------------------------------------------------------------------------------- /bundle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../tsconfig.base.jsonc", 4 | "compilerOptions": { 5 | "noEmit": true, 6 | "declaration": false, 7 | "declarationMap": false, 8 | "composite": false, 9 | "incremental": false, 10 | "moduleResolution": "bundler", 11 | "module": "preserve" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bundle/schema.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.Struct({ 5 | a: Schema.String, 6 | b: Schema.optional(Schema.FiniteFromString), 7 | c: Schema.Array(Schema.String) 8 | }) 9 | 10 | Schema.decodeUnknownEffect(schema)({ a: "a", b: 1, c: ["c"] }).pipe( 11 | Effect.runFork 12 | ) 13 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/internal/hash.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export const hashOptimize = (n: number): number => (n & 0xbfffffff) | ((n >>> 1) & 0x40000000) 3 | 4 | /** @internal */ 5 | export const hashString = (str: string) => { 6 | let h = 5381, i = str.length 7 | while (i) { 8 | h = (h * 33) ^ str.charCodeAt(--i) 9 | } 10 | return hashOptimize(h) 11 | } 12 | -------------------------------------------------------------------------------- /bundle/config.ts: -------------------------------------------------------------------------------- 1 | import * as Config from "#dist/effect/Config" 2 | import * as Effect from "#dist/effect/Effect" 3 | import * as Schema from "#dist/effect/schema/Schema" 4 | 5 | const schema = Schema.Struct({ 6 | API_KEY: Schema.String, 7 | PORT: Schema.Int, 8 | LOCALHOST: Schema.URL 9 | }) 10 | 11 | const config = Config.schema(schema) 12 | 13 | Effect.runFork(config.asEffect()) 14 | -------------------------------------------------------------------------------- /packages/platform-browser/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as BrowserHttpClient from "./BrowserHttpClient.ts" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * as BrowserWorker from "./BrowserWorker.ts" 14 | 15 | /** 16 | * @since 1.0.0 17 | */ 18 | export * as BrowserWorkerRunner from "./BrowserWorkerRunner.ts" 19 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeFileSystem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem" 5 | import type * as Layer from "effect/Layer" 6 | import type { FileSystem } from "effect/platform/FileSystem" 7 | 8 | /** 9 | * @since 1.0.0 10 | * @category layer 11 | */ 12 | export const layer: Layer.Layer = NodeFileSystem.layer 13 | -------------------------------------------------------------------------------- /examples/simple-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src", 6 | "module": "ESNext", 7 | "target": "ES2022", 8 | "moduleResolution": "bundler", 9 | "allowSyntheticDefaultImports": true, 10 | "esModuleInterop": true 11 | }, 12 | "include": ["src/**/*"], 13 | "exclude": ["node_modules", "dist"] 14 | } -------------------------------------------------------------------------------- /packages/platform-bun/src/BunFileSystem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem" 5 | import type * as Layer from "effect/Layer" 6 | import type { FileSystem } from "effect/platform/FileSystem" 7 | 8 | /** 9 | * @since 1.0.0 10 | * @category layer 11 | */ 12 | export const layer: Layer.Layer = NodeFileSystem.layer 13 | -------------------------------------------------------------------------------- /packages/vitest/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/d1/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/platform-browser/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/mssql/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/platform-node-shared/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["bun"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /bundle/schema-toSerializerStringTree.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Schema from "#dist/effect/schema/Schema" 3 | 4 | const schema = Schema.toSerializerStringTree(Schema.Struct({ 5 | a: Schema.String, 6 | b: Schema.optional(Schema.FiniteFromString), 7 | c: Schema.Array(Schema.String) 8 | })) 9 | 10 | Schema.decodeUnknownEffect(schema)({ a: "a", b: "1", c: ["c"] }).pipe( 11 | Effect.runFork 12 | ) 13 | -------------------------------------------------------------------------------- /packages/platform-bun/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/platform-bun` 2 | 3 | Provides Bun-specific implementations for the abstractions defined in [`@effect/platform`](https://github.com/Effect-TS/effect/tree/main/packages/platform), allowing you to write platform-independent code that runs smoothly in Bun environments. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/platform-bun). 8 | -------------------------------------------------------------------------------- /packages/platform-node/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/platform-node` 2 | 3 | Provides Node.js-specific implementations for the abstractions defined in [`@effect/platform`](https://github.com/Effect-TS/effect/tree/main/packages/platform), allowing you to write platform-independent code that integrates smoothly with Node.js. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/platform-node). 8 | -------------------------------------------------------------------------------- /packages/platform-node-shared/README.md: -------------------------------------------------------------------------------- 1 | # `@effect/platform-node` 2 | 3 | Provides Node.js-specific implementations for the abstractions defined in [`@effect/platform`](https://github.com/Effect-TS/effect/tree/main/packages/platform), allowing you to write platform-independent code that integrates smoothly with Node.js. 4 | 5 | ## Documentation 6 | 7 | - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/platform-node). 8 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workers/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as Transferable from "./Transferable.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as Worker from "./Worker.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as WorkerError from "./WorkerError.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as WorkerRunner from "./WorkerRunner.ts" 24 | -------------------------------------------------------------------------------- /packages/effect/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 2.0.0 3 | */ 4 | 5 | export { 6 | /** 7 | * @since 2.0.0 8 | */ 9 | absurd, 10 | /** 11 | * @since 2.0.0 12 | */ 13 | coerceUnsafe, 14 | /** 15 | * @since 2.0.0 16 | */ 17 | flow, 18 | /** 19 | * @since 2.0.0 20 | */ 21 | hole, 22 | /** 23 | * @since 2.0.0 24 | */ 25 | identity, 26 | /** 27 | * @since 2.0.0 28 | */ 29 | pipe 30 | } from "./Function.ts" 31 | -------------------------------------------------------------------------------- /packages/effect/src/internal/record.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** @internal */ 6 | export function set(self: Record, key: K, value: A): Record { 7 | if (key === "__proto__") { 8 | Object.defineProperty(self, key, { 9 | value, 10 | writable: true, 11 | enumerable: true, 12 | configurable: true 13 | }) 14 | } else { 15 | self[key] = value 16 | } 17 | return self 18 | } 19 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/persistence/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 1.0.0 7 | */ 8 | export * as KeyValueStore from "./KeyValueStore.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as Persistable from "./Persistable.ts" 14 | 15 | /** 16 | * @since 1.0.0 17 | */ 18 | export * as PersistedCache from "./PersistedCache.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as Persistence from "./Persistence.ts" 24 | -------------------------------------------------------------------------------- /.claude/commands/port.md: -------------------------------------------------------------------------------- 1 | Make a plan to port the `$1` api from the previous version of Effect (found in `effect-old/`) 2 | to the new version of Effect (in this repo). 3 | 4 | Before creating the plan, read the full module that contains the `$1` api in 5 | `effect-old/` and in the new Effect repo to understand the context and how it 6 | fits with the rest of the library. 7 | 8 | Write the plan in the `.specs` directory (read the `README.md` file in that 9 | directory first). 10 | -------------------------------------------------------------------------------- /packages/platform-bun/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../effect/tsconfig.src.json" }, { "path": "../platform-node-shared/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["bun"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"], 11 | "allowSyntheticDefaultImports": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.6.4/schema.json", 3 | "changelog": ["@changesets/changelog-github", { "repo": "Effect-TS/effect" }], 4 | "commit": false, 5 | "linked": [], 6 | "access": "restricted", 7 | "baseBranch": "main", 8 | "updateInternalDependencies": "patch", 9 | "ignore": ["scratchpad"], 10 | "snapshot": { 11 | "useCalculatedVersion": false, 12 | "prereleaseTemplate": "{tag}-{commit}" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/effect/dtslint/Schedule.tst.ts: -------------------------------------------------------------------------------- 1 | import { hole } from "effect" 2 | import * as Schedule from "effect/Schedule" 3 | import { describe, expect, it } from "tstyche" 4 | 5 | describe("Schedule", () => { 6 | it("isSchedule", () => { 7 | const input = hole<{ a: number } | Schedule.Schedule>() 8 | if (Schedule.isSchedule(input)) { 9 | expect(input).type.toBe>() 10 | } 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /packages/platform-node/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../effect/tsconfig.src.json" }, { "path": "../platform-node-shared/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }, { "path": "../../platform-node/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/libsql/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }, { "path": "../../platform-node/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/mysql2/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }, { "path": "../../platform-node/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [{ "path": "../../effect/tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/src", 9 | "rootDir": "src", 10 | "types": ["node"], 11 | "moduleResolution": "nodenext" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/effect/test/data/Reducer.test.ts: -------------------------------------------------------------------------------- 1 | import { String } from "effect" 2 | import { Reducer } from "effect/data" 3 | import { describe, it } from "vitest" 4 | import { strictEqual } from "../utils/assert.ts" 5 | 6 | describe("Combiner", () => { 7 | it("flip", () => { 8 | const R = Reducer.flip(String.ReducerConcat) 9 | strictEqual(R.combine("a", "b"), "ba") 10 | strictEqual(R.initialValue, "") 11 | strictEqual(R.combineAll(["a", "b", "c"]), "cba") 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../tsconfig.base.jsonc", 4 | "include": ["**/*.ts"], 5 | "compilerOptions": { 6 | "noEmit": true, 7 | "declaration": false, 8 | "declarationMap": false, 9 | "composite": false, 10 | "incremental": false, 11 | "plugins": [ 12 | { 13 | "name": "@effect/language-service", 14 | "namespaceImportPackages": [] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /scratchpad/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../tsconfig.base.jsonc", 4 | "include": ["**/*.ts"], 5 | "compilerOptions": { 6 | "noEmit": true, 7 | "declaration": false, 8 | "declarationMap": false, 9 | "composite": false, 10 | "incremental": false, 11 | "plugins": [ 12 | { 13 | "name": "@effect/language-service", 14 | "namespaceImportPackages": [] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /scripts/package-scalar.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import * as Fs from "fs/promises" 3 | 4 | const jsBundle = await fetch( 5 | "https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.min.js" 6 | ).then((res) => res.text()) 7 | 8 | const source = `/* eslint-disable */ 9 | 10 | /** @internal */ 11 | export const javascript = ${JSON.stringify(`${jsBundle}`)} 12 | ` 13 | 14 | await Fs.writeFile("packages/platform/src/internal/httpApiScalar.ts", source) 15 | -------------------------------------------------------------------------------- /bundle/http-client.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as FetchHttpClient from "#dist/effect/unstable/http/FetchHttpClient" 3 | import * as HttpClient from "#dist/effect/unstable/http/HttpClient" 4 | 5 | Effect.gen(function*() { 6 | const client = yield* HttpClient.HttpClient 7 | const res = yield* client.get("https://jsonplaceholder.typicode.com/posts/1") 8 | yield* res.json 9 | }).pipe( 10 | Effect.provide(FetchHttpClient.layer), 11 | Effect.runPromise 12 | ) 13 | -------------------------------------------------------------------------------- /packages/sql/pg/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [ 6 | { "path": "../../effect/tsconfig.src.json" }, 7 | { "path": "../../platform-node-shared/tsconfig.src.json" } 8 | ], 9 | "compilerOptions": { 10 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 11 | "outDir": ".tsbuildinfo/src", 12 | "rootDir": "src", 13 | "types": ["node"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/effect/test/primitives/String.test.ts: -------------------------------------------------------------------------------- 1 | import * as String from "effect/String" 2 | import { describe, it } from "vitest" 3 | import { strictEqual } from "../utils/assert.ts" 4 | 5 | describe("String", () => { 6 | it("ReducerConcat", () => { 7 | strictEqual(String.ReducerConcat.combine("a", "b"), "ab") 8 | strictEqual(String.ReducerConcat.combine("a", String.ReducerConcat.initialValue), "a") 9 | strictEqual(String.ReducerConcat.combine(String.ReducerConcat.initialValue, "a"), "a") 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /packages/platform-browser/test/fixtures/rpc-worker.ts: -------------------------------------------------------------------------------- 1 | import * as BrowserWorkerRunner from "@effect/platform-browser/BrowserWorkerRunner" 2 | import * as Effect from "effect/Effect" 3 | import * as Layer from "effect/Layer" 4 | import * as RpcServer from "effect/unstable/rpc/RpcServer" 5 | import { RpcLive } from "./rpc-schemas.ts" 6 | 7 | const MainLive = RpcLive.pipe( 8 | Layer.provide(RpcServer.layerProtocolWorkerRunner), 9 | Layer.provide(BrowserWorkerRunner.layer) 10 | ) 11 | 12 | Effect.runFork(Layer.launch(MainLive)) 13 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/observability/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Otlp from "./Otlp.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as OtlpLogger from "./OtlpLogger.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as OtlpMetrics from "./OtlpMetrics.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as OtlpResource from "./OtlpResource.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | */ 28 | export * as OtlpTracer from "./OtlpTracer.ts" 29 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/EntityId.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Schema from "../../schema/Schema.ts" 5 | 6 | /** 7 | * @since 4.0.0 8 | * @category constructors 9 | */ 10 | export const EntityId = Schema.String.pipe(Schema.brand<"~effect/cluster/EntityId">()) 11 | 12 | /** 13 | * @since 4.0.0 14 | * @category models 15 | */ 16 | export type EntityId = typeof EntityId.Type 17 | 18 | /** 19 | * @since 4.0.0 20 | * @category constructors 21 | */ 22 | export const make = (id: string): EntityId => id as EntityId 23 | -------------------------------------------------------------------------------- /packages/sql/mssql/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | export { 6 | /** 7 | * @since 1.0.0 8 | */ 9 | TYPES as MssqlTypes 10 | } from "tedious" 11 | 12 | /** 13 | * @since 1.0.0 14 | */ 15 | export * as MssqlClient from "./MssqlClient.ts" 16 | 17 | /** 18 | * @since 1.0.0 19 | */ 20 | export * as MssqlMigrator from "./MssqlMigrator.ts" 21 | 22 | /** 23 | * @since 1.0.0 24 | */ 25 | export * as Parameter from "./Parameter.ts" 26 | 27 | /** 28 | * @since 1.0.0 29 | */ 30 | export * as Procedure from "./Procedure.ts" 31 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workflow/internal/crypto.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "../../../Effect.ts" 2 | 3 | /** @internal */ 4 | export const makeHashDigest = (original: string) => 5 | Effect.map( 6 | Effect.promise(() => crypto.subtle.digest("SHA-256", new TextEncoder().encode(original))), 7 | (buffer) => { 8 | const data = new Uint8Array(buffer) 9 | let hexString = "" 10 | for (let i = 0; i < 16; i++) { 11 | hexString += data[i].toString(16).padStart(2, "0") 12 | } 13 | return hexString 14 | } 15 | ) 16 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/tsconfig.src.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["src"], 5 | "references": [ 6 | { "path": "../../effect/tsconfig.src.json" }, 7 | { "path": "../../platform-node/tsconfig.src.json" } 8 | ], 9 | "compilerOptions": { 10 | "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", 11 | "outDir": ".tsbuildinfo/src", 12 | "types": ["node"], 13 | "rootDir": "src", 14 | "erasableSyntaxOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/effect/src/encoding/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * This module provides encoding & decoding functionality for: 7 | * 8 | * - base64 (RFC4648) 9 | * - base64 (URL) 10 | * - hex 11 | * 12 | * @since 2.0.0 13 | */ 14 | export * as Base64 from "./Base64.ts" 15 | 16 | /** 17 | * @since 2.0.0 18 | */ 19 | export * as Base64Url from "./Base64Url.ts" 20 | 21 | /** 22 | * @since 4.0.0 23 | */ 24 | export * as EncodingError from "./EncodingError.ts" 25 | 26 | /** 27 | * @since 2.0.0 28 | */ 29 | export * as Hex from "./Hex.ts" 30 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/EntityType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Schema from "../../schema/Schema.ts" 5 | 6 | /** 7 | * @since 4.0.0 8 | * @category constructors 9 | */ 10 | export const EntityType = Schema.String.pipe(Schema.brand<"~effect/cluster/EntityType">()) 11 | 12 | /** 13 | * @since 4.0.0 14 | * @category models 15 | */ 16 | export type EntityType = typeof EntityType.Type 17 | 18 | /** 19 | * @since 4.0.0 20 | * @category constructors 21 | */ 22 | export const make = (value: string): EntityType => value as EntityType 23 | -------------------------------------------------------------------------------- /packages/platform-bun/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-bun/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/effect/src/Symbol.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 2.0.0 3 | */ 4 | 5 | import * as predicate from "./data/Predicate.ts" 6 | 7 | /** 8 | * Tests if a value is a `symbol`. 9 | * 10 | * @example 11 | * ```ts 12 | * import * as Predicate from "effect/data/Predicate" 13 | * import * as assert from "node:assert" 14 | * 15 | * assert.deepStrictEqual(Predicate.isSymbol(Symbol.for("a")), true) 16 | * assert.deepStrictEqual(Predicate.isSymbol("a"), false) 17 | * ``` 18 | * 19 | * @category guards 20 | * @since 2.0.0 21 | */ 22 | export const isSymbol: (u: unknown) => u is symbol = predicate.isSymbol 23 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/rpc/RpcClientError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Schema from "../../schema/Schema.ts" 5 | 6 | const TypeId = "~effect/rpc/RpcClientError" 7 | 8 | /** 9 | * @since 4.0.0 10 | * @category Errors 11 | */ 12 | export class RpcClientError extends Schema.ErrorClass(TypeId)({ 13 | _tag: Schema.tag("RpcClientError"), 14 | reason: Schema.Literals(["Protocol", "Unknown"]), 15 | message: Schema.String, 16 | cause: Schema.optional(Schema.Defect) 17 | }) { 18 | /** 19 | * @since 4.0.0 20 | */ 21 | readonly [TypeId] = TypeId 22 | } 23 | -------------------------------------------------------------------------------- /packages/platform-browser/src/BrowserHttpClient.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | 5 | // ----------------------------------------------------------------------------- 6 | // Fetch 7 | // ----------------------------------------------------------------------------- 8 | 9 | export { 10 | /** 11 | * @since 1.0.0 12 | * @category Fetch 13 | */ 14 | Fetch, 15 | /** 16 | * @since 1.0.0 17 | * @category Fetch 18 | */ 19 | layer as layerFetch, 20 | /** 21 | * @since 1.0.0 22 | * @category Fetch 23 | */ 24 | RequestInit 25 | } from "effect/unstable/http/FetchHttpClient" 26 | -------------------------------------------------------------------------------- /scripts/clean.mjs: -------------------------------------------------------------------------------- 1 | import * as Glob from "glob" 2 | import * as Fs from "node:fs" 3 | 4 | const dirs = [".", ...Glob.sync("packages/*/", ...Glob.sync("packages/ai/*/"))] 5 | dirs.forEach((pkg) => { 6 | const files = [".tsbuildinfo", "docs", "build", "dist", "coverage"] 7 | 8 | files.forEach((file) => { 9 | if (pkg === "." && file === "docs") { 10 | return 11 | } 12 | 13 | Fs.rmSync(`${pkg}/${file}`, { recursive: true, force: true }, () => {}) 14 | }) 15 | }) 16 | 17 | Glob.sync("docs/*/").forEach((dir) => { 18 | Fs.rmSync(dir, { recursive: true, force: true }, () => {}) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/platform-browser/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-browser/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /scripts/codemod.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import * as Glob from "glob" 3 | import Jscodeshift from "jscodeshift/src/Runner.js" 4 | import * as Path from "node:path" 5 | 6 | // Look up files in all workspace packages including those nested in 7 | // sub-packages (e.g. `packages/ai/openapi`). 8 | const pattern = "packages/{*,*/*}/src/**/*.ts" 9 | 10 | const paths = Glob.globSync(pattern, { 11 | ignore: ["**/internal/**"] 12 | }).map((path) => Path.resolve(path)) 13 | 14 | const transformer = Path.resolve("scripts/codemods/jsdoc.ts") 15 | 16 | Jscodeshift.run(transformer, paths, { 17 | babel: true, 18 | parser: "ts" 19 | }) 20 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | # Unchanged Modules 2 | 3 | - `Array` 4 | - `BigDecimal` 5 | - `BigInt` 6 | - `Boolean` 7 | - `Brand` 8 | - `Chunk` 9 | - `Iterable` 10 | - `Number` 11 | - `Order` 12 | - `Ordering` 13 | - `Predicate` 14 | - `Record` 15 | - `Redacted` 16 | - `RegExp` 17 | - `String` 18 | - `Struct` 19 | - `Symbol` 20 | - `Tuple` 21 | 22 | # Changes 23 | 24 | ## Context 25 | 26 | ## Cron 27 | 28 | ## Data 29 | 30 | ## DateTime 31 | 32 | ## Function 33 | 34 | ## Queue 35 | 36 | ## Result 37 | 38 | With respect to `Either`: 39 | 40 | - `zipWith` removed 41 | - `ap` removed 42 | - `getOrThrow` throws `E` instead of a standard error 43 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunPath.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodePath from "@effect/platform-node-shared/NodePath" 5 | import type * as Layer from "effect/Layer" 6 | import type { Path } from "effect/platform/Path" 7 | 8 | /** 9 | * @since 1.0.0 10 | * @category layer 11 | */ 12 | export const layer: Layer.Layer = NodePath.layer 13 | 14 | /** 15 | * @since 1.0.0 16 | * @category layer 17 | */ 18 | export const layerPosix: Layer.Layer = NodePath.layerPosix 19 | 20 | /** 21 | * @since 1.0.0 22 | * @category layer 23 | */ 24 | export const layerWin32: Layer.Layer = NodePath.layerWin32 25 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodePath.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodePath from "@effect/platform-node-shared/NodePath" 5 | import type * as Layer from "effect/Layer" 6 | import type { Path } from "effect/platform/Path" 7 | 8 | /** 9 | * @since 1.0.0 10 | * @category layer 11 | */ 12 | export const layer: Layer.Layer = NodePath.layer 13 | 14 | /** 15 | * @since 1.0.0 16 | * @category layer 17 | */ 18 | export const layerPosix: Layer.Layer = NodePath.layerPosix 19 | 20 | /** 21 | * @since 1.0.0 22 | * @category layer 23 | */ 24 | export const layerWin32: Layer.Layer = NodePath.layerWin32 25 | -------------------------------------------------------------------------------- /vitest.setup.ts: -------------------------------------------------------------------------------- 1 | import { addEqualityTesters } from "@effect/vitest" 2 | 3 | addEqualityTesters() 4 | 5 | // Ignore warnings from usage of experimental features to declutter test output. 6 | const ignore = ["ExperimentalWarning"] 7 | const emitWarning = process.emitWarning 8 | process.emitWarning = (warning, ...args) => { 9 | const [head] = args 10 | if (head != null) { 11 | if (typeof head === "string" && ignore.includes(head)) { 12 | return 13 | } 14 | 15 | if (typeof head === "object" && ignore.includes(head.type)) { 16 | return 17 | } 18 | } 19 | 20 | return emitWarning(warning, ...args) 21 | } 22 | -------------------------------------------------------------------------------- /packages/effect/test/Exit.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, describe, it } from "@effect/vitest" 2 | import { Exit } from "effect" 3 | 4 | describe("Exit", () => { 5 | it("toString", () => { 6 | assert.strictEqual(Exit.succeed(1).toString(), "Success(1)") 7 | assert.strictEqual(Exit.fail("error").toString(), `Failure(Cause([Fail("error")]))`) 8 | assert.strictEqual(Exit.die("error").toString(), `Failure(Cause([Die("error")]))`) 9 | assert.strictEqual(Exit.interrupt(1).toString(), `Failure(Cause([Interrupt(1)]))`) 10 | assert.strictEqual(Exit.interrupt(undefined).toString(), `Failure(Cause([Interrupt(undefined)]))`) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeHttpServerRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type { HttpServerRequest } from "effect/unstable/http/HttpServerRequest" 5 | import type * as Http from "node:http" 6 | 7 | /** 8 | * @since 1.0.0 9 | * @category Accessors 10 | */ 11 | export const toIncomingMessage = (self: HttpServerRequest): Http.IncomingMessage => self.source as any 12 | 13 | /** 14 | * @since 1.0.0 15 | * @category Accessors 16 | */ 17 | export const toServerResponse = (self: HttpServerRequest): Http.ServerResponse => { 18 | const res = (self as any).response 19 | return typeof res === "function" ? res() : res 20 | } 21 | -------------------------------------------------------------------------------- /packages/effect/test/data/Ordering.test.ts: -------------------------------------------------------------------------------- 1 | import { Ordering } from "effect/data" 2 | import { deepStrictEqual } from "node:assert" 3 | import { describe, it } from "vitest" 4 | 5 | describe("Ordering", () => { 6 | it("Reducer", () => { 7 | const R = Ordering.Reducer 8 | 9 | deepStrictEqual(R.combine(-1, 1), -1) 10 | deepStrictEqual(R.combine(1, -1), 1) 11 | deepStrictEqual(R.combine(1, 1), 1) 12 | deepStrictEqual(R.combine(0, 0), 0) 13 | deepStrictEqual(R.combine(0, 1), 1) 14 | deepStrictEqual(R.combine(1, 0), 1) 15 | deepStrictEqual(R.combine(0, -1), -1) 16 | deepStrictEqual(R.combine(-1, 0), -1) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /bundle/queue.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as Queue from "#dist/effect/Queue" 3 | 4 | const program = Effect.gen(function*() { 5 | const queue = yield* Queue.make() 6 | 7 | yield* Effect.gen(function*() { 8 | yield* Queue.takeN(queue, 3) 9 | }).pipe(Effect.forever, Effect.fork) 10 | 11 | yield* Queue.offerAll(queue, [1, 2]) 12 | yield* Queue.offerAll(queue, [3, 4]).pipe(Effect.delay("100 millis"), Effect.fork) 13 | yield* Queue.offerAll(queue, [5, 6, 7, 8]).pipe(Effect.delay("200 millis"), Effect.fork) 14 | 15 | yield* Effect.sleep("500 millis") 16 | }) 17 | 18 | Effect.runFork(Effect.scoped(program)) 19 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 4 | }; 5 | outputs = {nixpkgs, ...}: let 6 | forAllSystems = function: 7 | nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed ( 8 | system: function nixpkgs.legacyPackages.${system} 9 | ); 10 | in { 11 | formatter = forAllSystems (pkgs: pkgs.alejandra); 12 | devShells = forAllSystems (pkgs: { 13 | default = pkgs.mkShell { 14 | packages = with pkgs; [ 15 | bun 16 | deno 17 | corepack 18 | nodejs_24 19 | python3 20 | ]; 21 | }; 22 | }); 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/MachineId.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Schema from "../../schema/Schema.ts" 5 | 6 | /** 7 | * @since 4.0.0 8 | * @category constructors 9 | */ 10 | export const MachineId = Schema.Int.pipe( 11 | Schema.brand<"~effect/cluster/MachineId">(), 12 | Schema.annotate({ 13 | formatter: () => (machineId: string) => `MachineId(${machineId})` 14 | }) 15 | ) 16 | 17 | /** 18 | * @since 4.0.0 19 | * @category models 20 | */ 21 | export type MachineId = typeof MachineId.Type 22 | 23 | /** 24 | * @since 4.0.0 25 | * @category Constructors 26 | */ 27 | export const make = (id: number): MachineId => id as MachineId 28 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunTerminal.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal" 5 | import type { Effect } from "effect/Effect" 6 | import type { Layer } from "effect/Layer" 7 | import type { Terminal, UserInput } from "effect/platform/Terminal" 8 | import type { Scope } from "effect/Scope" 9 | 10 | /** 11 | * @since 1.0.0 12 | * @category constructors 13 | */ 14 | export const make: (shouldQuit?: (input: UserInput) => boolean) => Effect = NodeTerminal.make 15 | 16 | /** 17 | * @since 1.0.0 18 | * @category layers 19 | */ 20 | export const layer: Layer = NodeTerminal.layer 21 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeTerminal.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal" 5 | import type { Effect } from "effect/Effect" 6 | import type { Layer } from "effect/Layer" 7 | import type { Terminal, UserInput } from "effect/platform/Terminal" 8 | import type { Scope } from "effect/Scope" 9 | 10 | /** 11 | * @since 1.0.0 12 | * @category constructors 13 | */ 14 | export const make: (shouldQuit?: (input: UserInput) => boolean) => Effect = NodeTerminal.make 15 | 16 | /** 17 | * @since 1.0.0 18 | * @category layers 19 | */ 20 | export const layer: Layer = NodeTerminal.layer 21 | -------------------------------------------------------------------------------- /scripts/circular.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import * as glob from "glob" 3 | import madge from "madge" 4 | 5 | madge( 6 | glob.globSync(["packages/*/src/**/*.ts", "packages/ai/*/src/**/*.ts"], { 7 | ignore: [ 8 | "packages/sql-sqlite-bun/**", 9 | "packages/experimental/src/EventLogServer/Cloudflare.ts" 10 | ] 11 | }), 12 | { 13 | detectiveOptions: { 14 | ts: { 15 | skipTypeImports: true 16 | } 17 | } 18 | } 19 | ).then((res) => { 20 | const circular = res.circular() 21 | if (circular.length) { 22 | console.error("Circular dependencies found") 23 | console.error(circular) 24 | process.exit(1) 25 | } 26 | }) 27 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1764794580, 6 | "narHash": "sha256-UMVihg0OQ980YqmOAPz+zkuCEb9hpE5Xj2v+ZGNjQ+M=", 7 | "owner": "nixos", 8 | "repo": "nixpkgs", 9 | "rev": "ebc94f855ef25347c314258c10393a92794e7ab9", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "nixos", 14 | "ref": "nixpkgs-unstable", 15 | "repo": "nixpkgs", 16 | "type": "github" 17 | } 18 | }, 19 | "root": { 20 | "inputs": { 21 | "nixpkgs": "nixpkgs" 22 | } 23 | } 24 | }, 25 | "root": "root", 26 | "version": 7 27 | } 28 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/src/sqlite-wasm.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | declare module "@effect/wa-sqlite/src/examples/IDBBatchAtomicVFS.js" { 5 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class 6 | export class IDBBatchAtomicVFS { 7 | static async create(name: string, module: any, options?: any): Promise 8 | } 9 | } 10 | 11 | /** 12 | * @since 1.0.0 13 | */ 14 | declare module "@effect/wa-sqlite/src/examples/AccessHandlePoolVFS.js" { 15 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class 16 | export class AccessHandlePoolVFS { 17 | static async create(name: string, module: any, options?: any): Promise 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/vitest/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/vitest/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bundle/schema-string-async.ts: -------------------------------------------------------------------------------- 1 | import * as Duration from "#dist/effect/Duration" 2 | import * as Effect from "#dist/effect/Effect" 3 | import * as Schema from "#dist/effect/schema/Schema" 4 | import * as Transformation from "#dist/effect/schema/Transformation" 5 | 6 | const schema = Schema.String.pipe(Schema.decodeTo( 7 | Schema.String, 8 | Transformation.transformOrFail({ 9 | decode: (s) => 10 | Effect.gen(function*() { 11 | yield* Effect.clockWith((clock) => clock.sleep(Duration.millis(300))) 12 | return s 13 | }), 14 | encode: (_) => Effect.succeed(_) 15 | }) 16 | )) 17 | 18 | Schema.decodeUnknownEffect(schema)({ a: "a", b: 1, c: ["c"] }).pipe( 19 | Effect.runFork 20 | ) 21 | -------------------------------------------------------------------------------- /packages/effect/test/unstable/http/UrlParams.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Schema } from "effect/schema" 3 | import { UrlParams } from "effect/unstable/http" 4 | import { assertSuccess } from "../../utils/assert.ts" 5 | 6 | describe("UrlParams", () => { 7 | describe("UrlParamsSchema", () => { 8 | it("serializer annotation", () => { 9 | const iso = Schema.makeIso(UrlParams.UrlParamsSchema) 10 | const params = UrlParams.make([["a", "1"], ["b", "2"]]) 11 | assertSuccess(iso.getResult(params), [["a", "1"], ["b", "2"]]) 12 | assertSuccess(iso.replaceResult([["a", "1"], ["b", "3"]], params), UrlParams.make([["a", "1"], ["b", "3"]])) 13 | }) 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /bundle/stm.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as TxRef from "#dist/effect/stm/TxRef" 3 | 4 | const program = Effect.gen(function*() { 5 | const ref = yield* TxRef.make(0) 6 | 7 | yield* Effect.forkChild(Effect.forever( 8 | TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis")) 9 | )) 10 | 11 | yield* Effect.transaction(Effect.gen(function*() { 12 | const value = yield* TxRef.get(ref) 13 | if (value < 10) { 14 | yield* Effect.log(`retry due to value: ${value}`) 15 | return yield* Effect.retryTransaction 16 | } 17 | yield* Effect.log(`transaction done with value: ${value}`) 18 | })) 19 | }) 20 | 21 | Effect.runPromise(program).catch(console.error) 22 | -------------------------------------------------------------------------------- /packages/sql/d1/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/d1/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/mssql/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/d1/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/pg/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/pg/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/Singleton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Effect from "../../Effect.ts" 5 | import * as Layer from "../../Layer.ts" 6 | import type { Scope } from "../../Scope.ts" 7 | import { Sharding } from "./Sharding.ts" 8 | 9 | /** 10 | * @since 4.0.0 11 | * @category constructors 12 | */ 13 | export const make = ( 14 | name: string, 15 | run: Effect.Effect, 16 | options?: { 17 | readonly shardGroup?: string | undefined 18 | } 19 | ): Layer.Layer> => 20 | Layer.effectDiscard(Effect.gen(function*() { 21 | const sharding = yield* Sharding 22 | yield* sharding.registerSingleton(name, run, options) 23 | })) 24 | -------------------------------------------------------------------------------- /packages/sql/libsql/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/libsql/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/mysql2/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/mysql2/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/do/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/do/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/platform-node/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-node/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/clickhouse/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/sqlite-bun/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/sqlite-node/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/effect/src/stream/Take.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 2.0.0 3 | */ 4 | import type { NonEmptyReadonlyArray } from "../collections/Array.ts" 5 | import * as Effect from "../Effect.ts" 6 | import * as Exit from "../Exit.ts" 7 | import * as Pull from "./Pull.ts" 8 | 9 | /** 10 | * @since 2.0.0 11 | * @categor Models 12 | */ 13 | export type Take = NonEmptyReadonlyArray | Exit.Exit 14 | 15 | /** 16 | * @since 4.0.0 17 | * @categor Conversions 18 | */ 19 | export const toPull = (take: Take): Pull.Pull, E, Done> => 20 | Exit.isExit(take) 21 | ? Exit.isSuccess(take) ? Pull.halt(take.value) : (take as Exit.Exit) 22 | : Effect.succeed(take) 23 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitest/config" 2 | 3 | const isDeno = process.versions.deno !== undefined 4 | const isBun = process.versions.bun !== undefined 5 | 6 | export default defineConfig({ 7 | test: { 8 | projects: [ 9 | "packages/*/vitest.config.ts", 10 | "packages/sql/*/vitest.config.ts", 11 | ...(isDeno ? 12 | [ 13 | "!packages/platform-bun", 14 | "!packages/platform-node", 15 | "!packages/platform-node-shared", 16 | "!packages/sql/d1", 17 | "!packages/sql/sqlite-node" 18 | ] : 19 | []), 20 | ...(isBun ? 21 | [ 22 | "!packages/platform-node" 23 | ] : 24 | []) 25 | ] 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /packages/vitest/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["test"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "baseUrl": ".", 12 | "paths": { 13 | "@effect/vitest": ["src/index.ts"], 14 | "@effect/vitest/*": ["src/*/index.ts", "src/*.ts"] 15 | }, 16 | "types": ["node"], 17 | "plugins": [ 18 | { 19 | "name": "@effect/language-service", 20 | "namespaceImportPackages": [] 21 | } 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/sqlite-react-native/src/", 4 | "exclude": ["src/internal/**/*.ts"], 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/effect/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["test", "dtslint", "benchmark"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "noEmit": true, 10 | "erasableSyntaxOnly": false, 11 | "baseUrl": ".", 12 | "paths": { 13 | "effect": ["src/index.ts"], 14 | "effect/*": ["src/*/index.ts", "src/*.ts"] 15 | }, 16 | "types": ["node"], 17 | "plugins": [ 18 | { 19 | "name": "@effect/language-service", 20 | "namespaceImportPackages": [] 21 | } 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workflow/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Activity from "./Activity.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as DurableClock from "./DurableClock.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as DurableDeferred from "./DurableDeferred.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as Workflow from "./Workflow.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | */ 28 | export * as WorkflowEngine from "./WorkflowEngine.ts" 29 | 30 | /** 31 | * @since 4.0.0 32 | */ 33 | export * as WorkflowProxy from "./WorkflowProxy.ts" 34 | 35 | /** 36 | * @since 4.0.0 37 | */ 38 | export * as WorkflowProxyServer from "./WorkflowProxyServer.ts" 39 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunServices.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as Layer from "effect/Layer" 5 | import type { FileSystem } from "effect/platform/FileSystem" 6 | import type { Path } from "effect/platform/Path" 7 | import type { Terminal } from "effect/platform/Terminal" 8 | import * as BunFileSystem from "./BunFileSystem.ts" 9 | import * as BunPath from "./BunPath.ts" 10 | import * as BunTerminal from "./BunTerminal.ts" 11 | 12 | /** 13 | * @since 1.0.0 14 | * @category models 15 | */ 16 | export type BunServices = FileSystem | Path | Terminal 17 | 18 | /** 19 | * @since 1.0.0 20 | * @category layer 21 | */ 22 | export const layer: Layer.Layer = Layer.mergeAll( 23 | BunFileSystem.layer, 24 | BunPath.layer, 25 | BunTerminal.layer 26 | ) 27 | -------------------------------------------------------------------------------- /scripts/package-swagger.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import * as Fs from "fs/promises" 3 | 4 | const jsBundle = await fetch( 5 | "https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js" 6 | ).then((res) => res.text()) 7 | const jsPreset = await fetch( 8 | "https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js" 9 | ).then((res) => res.text()) 10 | const css = await fetch( 11 | "https://unpkg.com/swagger-ui-dist/swagger-ui.css" 12 | ).then((res) => res.text()) 13 | 14 | const source = `/* eslint-disable */ 15 | 16 | /** @internal */ 17 | export const javascript = ${JSON.stringify(`${jsBundle}\n${jsPreset}`)} 18 | 19 | /** @internal */ 20 | export const css = ${JSON.stringify(css)} 21 | ` 22 | 23 | await Fs.writeFile("packages/platform/src/internal/httpApiSwagger.ts", source) 24 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scripts", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "dependencies": { 7 | "effect": "workspace:*", 8 | "@effect/platform-bun": "workspace:*", 9 | "@effect/platform-node": "workspace:*", 10 | "@effect/sql-clickhouse": "workspace:*", 11 | "@effect/sql-d1": "workspace:*", 12 | "@effect/sql-libsql": "workspace:*", 13 | "@effect/sql-mysql2": "workspace:*", 14 | "@effect/sql-mssql": "workspace:*", 15 | "@effect/sql-pg": "workspace:*", 16 | "@effect/sql-sqlite-bun": "workspace:*", 17 | "@effect/sql-sqlite-do": "workspace:*", 18 | "@effect/sql-sqlite-node": "workspace:*", 19 | "@effect/sql-sqlite-react-native": "workspace:*", 20 | "@effect/sql-sqlite-wasm": "workspace:*" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/platform-node/src/NodeServices.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import * as Layer from "effect/Layer" 5 | import type { FileSystem } from "effect/platform/FileSystem" 6 | import type { Path } from "effect/platform/Path" 7 | import type { Terminal } from "effect/platform/Terminal" 8 | import * as NodeFileSystem from "./NodeFileSystem.ts" 9 | import * as NodePath from "./NodePath.ts" 10 | import * as NodeTerminal from "./NodeTerminal.ts" 11 | 12 | /** 13 | * @since 1.0.0 14 | * @category models 15 | */ 16 | export type NodeServices = FileSystem | Path | Terminal 17 | 18 | /** 19 | * @since 1.0.0 20 | * @category layer 21 | */ 22 | export const layer: Layer.Layer = Layer.mergeAll( 23 | NodeFileSystem.layer, 24 | NodePath.layer, 25 | NodeTerminal.layer 26 | ) 27 | -------------------------------------------------------------------------------- /scratchpad/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scratchpad", 3 | "private": true, 4 | "type": "module", 5 | "version": "0.0.0", 6 | "dependencies": { 7 | "effect": "workspace:*", 8 | "@effect/platform-bun": "workspace:*", 9 | "@effect/platform-node": "workspace:*", 10 | "@effect/sql-clickhouse": "workspace:*", 11 | "@effect/sql-d1": "workspace:*", 12 | "@effect/sql-libsql": "workspace:*", 13 | "@effect/sql-mysql2": "workspace:*", 14 | "@effect/sql-mssql": "workspace:*", 15 | "@effect/sql-pg": "workspace:*", 16 | "@effect/sql-sqlite-bun": "workspace:*", 17 | "@effect/sql-sqlite-do": "workspace:*", 18 | "@effect/sql-sqlite-node": "workspace:*", 19 | "@effect/sql-sqlite-react-native": "workspace:*", 20 | "@effect/sql-sqlite-wasm": "workspace:*" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/sql/d1/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-d1": ["src/index.ts"], 16 | "@effect/sql-d1/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/pg/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-pg": ["src/index.ts"], 16 | "@effect/sql-pg/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "noEmit": true, 10 | "erasableSyntaxOnly": false, 11 | "baseUrl": ".", 12 | "paths": { 13 | "@effect/openapi-generator": ["src/index.ts"], 14 | "@effect/openapi-generator/*": ["src/*/index.ts", "src/*.ts"] 15 | }, 16 | "types": ["node"], 17 | "plugins": [ 18 | { 19 | "name": "@effect/language-service", 20 | "namespaceImportPackages": [] 21 | } 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/simple-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-cli-example", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "Simple CLI example demonstrating Effect CLI features", 6 | "type": "module", 7 | "main": "dist/cli.js", 8 | "bin": { 9 | "myapp": "./dist/cli.js" 10 | }, 11 | "scripts": { 12 | "build": "tsc", 13 | "start": "node dist/cli.js", 14 | "dev": "tsx src/cli.ts", 15 | "cli": "tsx src/cli.ts", 16 | "generate-visuals": "tsx scripts/generate-visuals.ts", 17 | "generate-gallery": "tsx scripts/generate-gallery.ts" 18 | }, 19 | "dependencies": { 20 | "effect": "workspace:*", 21 | "@effect/platform-node": "workspace:*" 22 | }, 23 | "devDependencies": { 24 | "tsx": "^4.7.0", 25 | "typescript": "^5.3.3", 26 | "ansi-to-svg": "^1.4.3" 27 | } 28 | } -------------------------------------------------------------------------------- /packages/platform-node-shared/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["test"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "baseUrl": ".", 13 | "paths": { 14 | "@effect/platform-node-shared": ["src/index.ts"], 15 | "@effect/platform-node-shared/*": ["src/*/index.ts", "src/*.ts"] 16 | }, 17 | "types": ["node"], 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/mssql/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-mssql": ["src/index.ts"], 16 | "@effect/sql-mssql/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-do": ["src/index.ts"], 16 | "@effect/sql-do/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/effect/test/unstable/http/Multipart.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Schema } from "effect/schema" 3 | import { Multipart } from "effect/unstable/http" 4 | import { deepStrictEqual } from "node:assert" 5 | 6 | describe("Multipart", () => { 7 | describe("FileSchema", () => { 8 | it("jsonSchema", () => { 9 | const document = Schema.makeJsonSchema(Multipart.FileSchema, { target: "draft-07" }) 10 | deepStrictEqual(document, { 11 | uri: "http://json-schema.org/draft-07/schema", 12 | schema: { 13 | "$ref": "#/definitions/PersistedFile" 14 | }, 15 | definitions: { 16 | "PersistedFile": { 17 | "type": "string", 18 | "format": "binary" 19 | } 20 | } 21 | }) 22 | }) 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /packages/sql/libsql/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-libsql": ["src/index.ts"], 16 | "@effect/sql-libsql/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/mysql2/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-mysql2": ["src/index.ts"], 16 | "@effect/sql-mysql2/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bundle/pubsub.ts: -------------------------------------------------------------------------------- 1 | import * as Effect from "#dist/effect/Effect" 2 | import * as PubSub from "#dist/effect/PubSub" 3 | 4 | const program = Effect.gen(function*() { 5 | const pubsub = yield* PubSub.unbounded() 6 | 7 | yield* Effect.gen(function*() { 8 | const subscription = yield* PubSub.subscribe(pubsub) 9 | while (true) { 10 | const element = yield* PubSub.take(subscription) 11 | console.log(element) 12 | } 13 | }).pipe(Effect.fork({ startImmediately: true })) 14 | 15 | yield* PubSub.publishAll(pubsub, [1, 2]) 16 | yield* PubSub.publishAll(pubsub, [3, 4]).pipe(Effect.delay("100 millis"), Effect.fork) 17 | yield* PubSub.publishAll(pubsub, [5, 6, 7, 8]).pipe(Effect.delay("200 millis"), Effect.fork) 18 | 19 | yield* Effect.sleep("500 millis") 20 | }) 21 | 22 | Effect.runFork(Effect.scoped(program)) 23 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-clickhouse": ["src/index.ts"], 16 | "@effect/sql-clickhouse/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-sqlite-bun": ["src/index.ts"], 16 | "@effect/sql-sqlite-bun/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bundle/batching.ts: -------------------------------------------------------------------------------- 1 | import * as Array from "#dist/effect/collections/Array" 2 | import * as Effect from "#dist/effect/Effect" 3 | import * as Exit from "#dist/effect/Exit" 4 | import * as Request from "#dist/effect/Request" 5 | import * as Resolver from "#dist/effect/RequestResolver" 6 | 7 | class GetNameById extends Request.TaggedClass("GetNameById")<{ 8 | readonly id: number 9 | }, string> {} 10 | 11 | const UserResolver = Resolver.make((entries) => 12 | Effect.sync(() => { 13 | for (const entry of entries) { 14 | entry.completeUnsafe(Exit.succeed(`User ${entry.request.id}`)) 15 | } 16 | }) 17 | ) 18 | 19 | const effect = Effect.forEach( 20 | Array.range(1, 100_000), 21 | (id) => Effect.request(new GetNameById({ id }), UserResolver), 22 | { concurrency: "unbounded" } 23 | ) 24 | 25 | Effect.runFork(effect) 26 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-sqlite-node": ["src/index.ts"], 16 | "@effect/sql-sqlite-node/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-sqlite-wasm": ["src/index.ts"], 16 | "@effect/sql-sqlite-wasm/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/DeliverAt.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import { hasProperty } from "../../data/Predicate.ts" 5 | import type { DateTime } from "../../DateTime.ts" 6 | 7 | /** 8 | * @since 4.0.0 9 | * @category symbols 10 | */ 11 | export const symbol = "~effect/cluster/DeliverAt" 12 | 13 | /** 14 | * @since 4.0.0 15 | * @category models 16 | */ 17 | export interface DeliverAt { 18 | [symbol](): DateTime 19 | } 20 | 21 | /** 22 | * @since 4.0.0 23 | * @category guards 24 | */ 25 | export const isDeliverAt = (self: unknown): self is DeliverAt => hasProperty(self, symbol) 26 | 27 | /** 28 | * @since 4.0.0 29 | * @category accessors 30 | */ 31 | export const toMillis = (self: unknown): number | null => { 32 | if (isDeliverAt(self)) { 33 | return self[symbol]().epochMillis 34 | } 35 | return null 36 | } 37 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/sql-react-native": ["src/index.ts"], 16 | "@effect/sql-react-native/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "plugins": [ 19 | { 20 | "name": "@effect/language-service", 21 | "namespaceImportPackages": [] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/denoland/deno/refs/heads/main/cli/schemas/config-file.v1.json", 3 | "nodeModulesDir": "manual", 4 | "unstable": ["bare-node-builtins", "node-globals"], 5 | "workspace": ["./packages/*"], 6 | "exclude": [ 7 | "**/*.mjs", 8 | "**/*.cjs", 9 | "**/*.js", 10 | "**/*.d.ts", 11 | "**/vitest.*.ts", 12 | "**/.tsbuildinfo/", 13 | "**/node_modules/", 14 | "**/dist/", 15 | "bundle/", 16 | "examples/", 17 | "scripts/", 18 | "scratchpad/", 19 | "packages/*/dtslint/", 20 | "packages/*/benchmark/", 21 | "packages/effect/test/cluster/", 22 | "packages/platform-browser/", 23 | "packages/platform-bun/", 24 | "packages/platform-node/", 25 | "packages/platform-node-shared/", 26 | "packages/tools/", 27 | "packages/sql" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /packages/platform-browser/test/RpcWorker.test.ts: -------------------------------------------------------------------------------- 1 | import * as BrowserWorker from "@effect/platform-browser/BrowserWorker" 2 | import { describe } from "@effect/vitest" 3 | import * as Layer from "effect/Layer" 4 | import * as RpcClient from "effect/unstable/rpc/RpcClient" 5 | import * as RpcServer from "effect/unstable/rpc/RpcServer" 6 | import { e2eSuite, UsersClient } from "./fixtures/rpc-e2e.ts" 7 | 8 | describe("RpcWorker", () => { 9 | const WorkerClient = UsersClient.layer.pipe( 10 | Layer.provide(RpcClient.layerProtocolWorker({ size: 1 })), 11 | Layer.provide(BrowserWorker.layer(() => new Worker(new URL("./fixtures/rpc-worker.ts", import.meta.url)))), 12 | Layer.merge( 13 | Layer.succeed(RpcServer.Protocol)({ 14 | supportsAck: true 15 | } as any) 16 | ) 17 | ) 18 | e2eSuite("e2e worker", WorkerClient, false) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/sql/SqlError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Data from "../../data/Data.ts" 5 | 6 | const TypeId = "~effect/sql/SqlError" 7 | 8 | /** 9 | * @since 4.0.0 10 | */ 11 | export class SqlError extends Data.TaggedError("SqlError")<{ 12 | cause: unknown 13 | message?: string 14 | }> { 15 | /** 16 | * @since 4.0.0 17 | */ 18 | readonly [TypeId] = TypeId 19 | } 20 | 21 | /** 22 | * @since 4.0.0 23 | */ 24 | export class ResultLengthMismatch extends Data.TaggedError("ResultLengthMismatch")<{ 25 | readonly expected: number 26 | readonly actual: number 27 | }> { 28 | /** 29 | * @since 4.0.0 30 | */ 31 | readonly [TypeId] = TypeId 32 | 33 | /** 34 | * @since 4.0.0 35 | */ 36 | override get message() { 37 | return `Expected ${this.expected} results but got ${this.actual}` 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cli/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Argument from "./Argument.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as CliError from "./CliError.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as Command from "./Command.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as Flag from "./Flag.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | */ 28 | export * as HelpDoc from "./HelpDoc.ts" 29 | 30 | /** 31 | * @since 4.0.0 32 | */ 33 | export * as HelpFormatter from "./HelpFormatter.ts" 34 | 35 | /** 36 | * @since 4.0.0 37 | */ 38 | export * as Param from "./Param.ts" 39 | 40 | /** 41 | * @since 4.0.0 42 | */ 43 | export * as Primitive from "./Primitive.ts" 44 | 45 | /** 46 | * @since 4.0.0 47 | */ 48 | export * as Prompt from "./Prompt.ts" 49 | -------------------------------------------------------------------------------- /scripts/codemod-ts-fence.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import * as Glob from "glob" 3 | import * as Jscodeshift from "jscodeshift/src/Runner.js" 4 | import * as Fs from "node:fs" 5 | import * as Path from "node:path" 6 | 7 | const packageJsonPath = Path.resolve("package.json") 8 | const packageJson = JSON.parse(Fs.readFileSync(packageJsonPath, "utf-8")) 9 | const workspaces = Glob.globSync(packageJson["workspaces"]) 10 | const packages = workspaces.map((workspace) => workspace.replace("packages/", "")) 11 | const pattern = `packages/{${packages.join(",")}}/src/**/*.ts` 12 | 13 | const paths = Glob.globSync(pattern, { 14 | ignore: ["**/internal/**"] 15 | }).map((path) => Path.resolve(path)) 16 | 17 | const transformer = Path.resolve("scripts/codemods/ts-fence.ts") 18 | 19 | Jscodeshift.run(transformer, paths, { 20 | babel: true, 21 | parser: "ts" 22 | // dry: true 23 | }) 24 | -------------------------------------------------------------------------------- /packages/platform-browser/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.base.jsonc", 4 | "include": ["test/**/*.ts", "test/**/*.json"], 5 | "references": [{ "path": "tsconfig.src.json" }], 6 | "compilerOptions": { 7 | "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", 8 | "outDir": ".tsbuildinfo/test", 9 | "rootDir": "test", 10 | "noEmit": true, 11 | "erasableSyntaxOnly": false, 12 | "resolveJsonModule": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "@effect/platform-browser": ["src/index.ts"], 16 | "@effect/platform-browser/*": ["src/*/index.ts", "src/*.ts"] 17 | }, 18 | "types": ["node"], 19 | "plugins": [ 20 | { 21 | "name": "@effect/language-service", 22 | "namespaceImportPackages": [] 23 | } 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/ClusterMetrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Metric from "../../Metric.ts" 5 | 6 | /** 7 | * @since 4.0.0 8 | * @category metrics 9 | */ 10 | export const entities = Metric.gauge("effect_cluster_entities", { bigint: true }) 11 | 12 | /** 13 | * @since 4.0.0 14 | * @category metrics 15 | */ 16 | export const singletons = Metric.gauge("effect_cluster_singletons", { bigint: true }) 17 | 18 | /** 19 | * @since 4.0.0 20 | * @category metrics 21 | */ 22 | export const runners = Metric.gauge("effect_cluster_runners", { bigint: true }) 23 | 24 | /** 25 | * @since 4.0.0 26 | * @category metrics 27 | */ 28 | export const runnersHealthy = Metric.gauge("effect_cluster_runners_healthy", { bigint: true }) 29 | 30 | /** 31 | * @since 4.0.0 32 | * @category metrics 33 | */ 34 | export const shards = Metric.gauge("effect_cluster_shards", { bigint: true }) 35 | -------------------------------------------------------------------------------- /.github/workflows/snapshot.yml: -------------------------------------------------------------------------------- 1 | name: Snapshot 2 | on: 3 | push: 4 | branches: [main] 5 | pull_request: 6 | branches: [main] 7 | workflow_dispatch: 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | permissions: {} 14 | 15 | jobs: 16 | snapshot: 17 | name: Snapshot 18 | if: github.repository_owner == 'Effect-Ts' 19 | runs-on: ubuntu-latest 20 | timeout-minutes: 10 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Install dependencies 24 | uses: ./.github/actions/setup 25 | with: 26 | node: true 27 | - name: Run codemods 28 | run: pnpm codemod 29 | - name: Build package 30 | run: pnpm build 31 | - name: Create snapshot 32 | id: snapshot 33 | run: pnpx pkg-pr-new@0.0.28 publish --pnpm --comment=off ./packages/* ./packages/sql/* 34 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/sql/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Migrator from "./Migrator.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as SqlClient from "./SqlClient.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as SqlConnection from "./SqlConnection.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as SqlError from "./SqlError.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | * @category models 28 | */ 29 | export * as SqlModel from "./SqlModel.ts" 30 | 31 | /** 32 | * @since 4.0.0 33 | */ 34 | export * as SqlResolver from "./SqlResolver.ts" 35 | 36 | /** 37 | * @since 4.0.0 38 | */ 39 | export * as SqlSchema from "./SqlSchema.ts" 40 | 41 | /** 42 | * @since 4.0.0 43 | */ 44 | export * as SqlStream from "./SqlStream.ts" 45 | 46 | /** 47 | * @since 4.0.0 48 | */ 49 | export * as Statement from "./Statement.ts" 50 | -------------------------------------------------------------------------------- /packages/effect/src/internal/equal.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export const getAllObjectKeys = (obj: object): Set => { 3 | const keys = new Set(Reflect.ownKeys(obj)) 4 | if (obj.constructor === Object) return keys 5 | 6 | if (obj instanceof Error) { 7 | keys.delete("stack") 8 | } 9 | 10 | const proto = Object.getPrototypeOf(obj) 11 | let current = proto 12 | 13 | while (current !== null && current !== Object.prototype) { 14 | const ownKeys = Reflect.ownKeys(current) 15 | for (let i = 0; i < ownKeys.length; i++) { 16 | keys.add(ownKeys[i]) 17 | } 18 | current = Object.getPrototypeOf(current) 19 | } 20 | if (keys.has("constructor") && typeof obj.constructor === "function" && proto === obj.constructor.prototype) { 21 | keys.delete("constructor") 22 | } 23 | 24 | return keys 25 | } 26 | 27 | /** @internal */ 28 | export const byReferenceInstances = new WeakSet() 29 | -------------------------------------------------------------------------------- /packages/effect/docgen.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/@effect/docgen/schema.json", 3 | "exclude": ["src/internal/**/*.ts", "src/unstable/**/internal/**/*.ts", "src/schema/StandardSchema.ts"], 4 | "srcLink": "https://github.com/Effect-TS/effect-smol/tree/main/packages/effect/src/", 5 | "examplesCompilerOptions": { 6 | "noEmit": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "moduleResolution": "Bundler", 10 | "module": "ES2022", 11 | "target": "ES2022", 12 | "lib": ["ESNext", "DOM", "DOM.Iterable"], 13 | "rewriteRelativeImportExtensions": true, 14 | "allowImportingTsExtensions": true, 15 | "paths": { 16 | "effect": ["../../../effect/src/index.js"], 17 | "effect/*": ["../../../effect/src/*.js"], 18 | "@effect/platform-node": ["../../../platform-node/src/index.js"], 19 | "@effect/platform-node/*": ["../../../platform-node/src/*.js"] 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/effect/src/encoding/EncodingError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Data from "../data/Data.ts" 5 | import { hasProperty } from "../data/Predicate.ts" 6 | 7 | const EncodingErrorTypeId = "~effect/encoding/EncodingError" as const 8 | 9 | /** 10 | * @category symbols 11 | * @since 2.0.0 12 | */ 13 | export type EncodingErrorTypeId = typeof EncodingErrorTypeId 14 | 15 | /** 16 | * @category constructors 17 | * @since 4.0.0 18 | */ 19 | export class EncodingError extends Data.TaggedError("EncodingError")<{ 20 | reason: "Decode" | "Encode" 21 | module: string 22 | input: unknown 23 | message: string 24 | }> { 25 | /** 26 | * @since 4.0.0 27 | */ 28 | readonly [EncodingErrorTypeId]: EncodingErrorTypeId = EncodingErrorTypeId 29 | } 30 | 31 | /** 32 | * @category guards 33 | * @since 2.0.0 34 | */ 35 | export const isEncodingError = (u: unknown): u is EncodingError => hasProperty(u, EncodingErrorTypeId) 36 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/workers/WorkerError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import { hasProperty } from "../../data/Predicate.ts" 5 | import * as Schema from "../../schema/Schema.ts" 6 | 7 | const TypeId = "~effect/workers/WorkerError" as const 8 | 9 | /** 10 | * @since 4.0.0 11 | * @category Symbols 12 | */ 13 | export type TypeId = typeof TypeId 14 | 15 | /** 16 | * @since 4.0.0 17 | * @category Guards 18 | */ 19 | export const isWorkerError = (u: unknown): u is WorkerError => hasProperty(u, TypeId) 20 | 21 | /** 22 | * @since 4.0.0 23 | * @category Models 24 | */ 25 | export class WorkerError extends Schema.ErrorClass(TypeId)({ 26 | _tag: Schema.tag("WorkerError"), 27 | reason: Schema.Literals(["Receive", "Spawn", "Send", "Unknown"]), 28 | message: Schema.String, 29 | cause: Schema.optional(Schema.Defect) 30 | }) { 31 | /** 32 | * @since 4.0.0 33 | */ 34 | readonly [TypeId]: TypeId = TypeId 35 | } 36 | -------------------------------------------------------------------------------- /packages/effect/test/Scope.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "@effect/vitest" 2 | import { Duration, Effect, Exit, Scope } from "effect" 3 | import { TestClock } from "effect/testing" 4 | 5 | describe("Scope", () => { 6 | describe("parallel finalization", () => { 7 | it.effect("executes finalizers in parallel", () => 8 | Effect.gen(function*() { 9 | const scope = Scope.makeUnsafe("parallel") 10 | yield* Scope.addFinalizer(scope, Effect.sleep(Duration.seconds(1))) 11 | yield* Scope.addFinalizer(scope, Effect.sleep(Duration.seconds(1))) 12 | yield* Scope.addFinalizer(scope, Effect.sleep(Duration.seconds(1))) 13 | const fiber = yield* Effect.forkChild(Scope.close(scope, Exit.void), { startImmediately: true }) 14 | expect(fiber.pollUnsafe()).toBeUndefined() 15 | yield* TestClock.adjust(Duration.seconds(1)) 16 | expect(fiber.pollUnsafe()).toBeDefined() 17 | })) 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/effect/test/unstable/http/Headers.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, it } from "@effect/vitest" 2 | import { Schema } from "effect/schema" 3 | import { Headers } from "effect/unstable/http" 4 | import { assertSuccess } from "../../utils/assert.ts" 5 | 6 | describe("Headers", () => { 7 | describe("HeadersSchema", () => { 8 | it("serializer annotation", () => { 9 | const _Accept = Schema.makeIso(Headers.HeadersSchema).at("Accept") 10 | const headers = Headers.fromRecordUnsafe({ 11 | "Accept": "application/json, text/plain, */*", 12 | "Cache-Control": "no-cache" 13 | }) 14 | assertSuccess(_Accept.getResult(headers), "application/json, text/plain, */*") 15 | assertSuccess( 16 | _Accept.replaceResult("application/json", headers), 17 | Headers.fromRecordUnsafe({ 18 | "accept": "application/json", 19 | "cache-control": "no-cache" 20 | }) 21 | ) 22 | }) 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/tsconfig", 3 | "extends": "./tsconfig.base.jsonc", 4 | "include": [], 5 | "references": [ 6 | { "path": "packages/effect" }, 7 | { "path": "packages/platform-browser" }, 8 | { "path": "packages/platform-bun" }, 9 | { "path": "packages/platform-node" }, 10 | { "path": "packages/platform-node-shared" }, 11 | { "path": "packages/sql/clickhouse" }, 12 | { "path": "packages/sql/d1" }, 13 | { "path": "packages/sql/libsql" }, 14 | { "path": "packages/sql/mysql2" }, 15 | { "path": "packages/sql/mssql" }, 16 | { "path": "packages/sql/pg" }, 17 | { "path": "packages/sql/sqlite-bun" }, 18 | { "path": "packages/sql/sqlite-do" }, 19 | { "path": "packages/sql/sqlite-node" }, 20 | { "path": "packages/sql/sqlite-react-native" }, 21 | { "path": "packages/sql/sqlite-wasm" }, 22 | { "path": "packages/tools/openapi-generator" }, 23 | { "path": "packages/vitest" } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /packages/effect/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * This module provides a re-export of the fast-check library for property-based testing. 7 | * Fast-check is a property-based testing framework that generates random test cases 8 | * to validate that properties hold true for a wide range of inputs. 9 | * 10 | * Property-based testing is a testing methodology where you specify properties that 11 | * should hold true for your functions, and the framework generates many random test 12 | * cases to try to find counterexamples. 13 | * 14 | * @since 3.10.0 15 | */ 16 | export * as FastCheck from "./FastCheck.ts" 17 | 18 | /** 19 | * @since 2.0.0 20 | */ 21 | export * as TestClock from "./TestClock.ts" 22 | 23 | /** 24 | * @since 4.0.0 25 | */ 26 | export * as TestConsole from "./TestConsole.ts" 27 | 28 | /** 29 | * Testing utilities for Schema validation and assertions. 30 | * 31 | * @since 4.0.0 32 | */ 33 | export * as TestSchema from "./TestSchema.ts" 34 | -------------------------------------------------------------------------------- /packages/effect/test/cluster/Entity.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | import { Entity, ShardingConfig } from "effect/unstable/cluster" 4 | import { TestEntity, TestEntityLayer, User } from "./TestEntity.ts" 5 | 6 | describe.concurrent("Entity", () => { 7 | describe("makeTestClient", () => { 8 | it.effect("round trip", () => 9 | Effect.gen(function*() { 10 | const makeClient = yield* Entity.makeTestClient(TestEntity, TestEntityLayer) 11 | const client = yield* makeClient("123") 12 | const user = yield* client.GetUser({ id: 1 }) 13 | assert.deepEqual(user, new User({ id: 1, name: "User 1" })) 14 | }).pipe(Effect.provide(TestShardingConfig))) 15 | }) 16 | }) 17 | 18 | const TestShardingConfig = ShardingConfig.layer({ 19 | shardsPerGroup: 300, 20 | entityMailboxCapacity: 10, 21 | entityTerminationTimeout: 0, 22 | entityMessagePollInterval: 5000, 23 | sendRetryInterval: 100 24 | }) 25 | -------------------------------------------------------------------------------- /packages/effect/test/primitives/BigInt.test.ts: -------------------------------------------------------------------------------- 1 | import * as BigInt from "effect/BigInt" 2 | import { describe, it } from "vitest" 3 | import { strictEqual } from "../utils/assert.ts" 4 | 5 | describe("BigInt", () => { 6 | it("ReducerSum", () => { 7 | strictEqual(BigInt.ReducerSum.combine(1n, 2n), 3n) 8 | strictEqual(BigInt.ReducerSum.combine(BigInt.ReducerSum.initialValue, 2n), 2n) 9 | strictEqual(BigInt.ReducerSum.combine(2n, BigInt.ReducerSum.initialValue), 2n) 10 | }) 11 | 12 | it("ReducerMultiply", () => { 13 | strictEqual(BigInt.ReducerMultiply.combine(2n, 3n), 6n) 14 | strictEqual(BigInt.ReducerMultiply.combine(BigInt.ReducerMultiply.initialValue, 2n), 2n) 15 | strictEqual(BigInt.ReducerMultiply.combine(2n, BigInt.ReducerMultiply.initialValue), 2n) 16 | }) 17 | 18 | it("CombinerMax", () => { 19 | strictEqual(BigInt.CombinerMax.combine(1n, 2n), 2n) 20 | }) 21 | 22 | it("CombinerMin", () => { 23 | strictEqual(BigInt.CombinerMin.combine(1n, 2n), 1n) 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /packages/sql/mssql/src/MssqlMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | options: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | SqlError | Migrator.MigrationError, 24 | Client.SqlClient | R 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category layers 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer => Layer.effectDiscard(run(options)) 34 | -------------------------------------------------------------------------------- /packages/effect/test/rpc/Rpc.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, describe, it } from "@effect/vitest" 2 | import { Effect } from "effect" 3 | import { Schema } from "effect/schema" 4 | import { Headers } from "effect/unstable/http" 5 | import { Rpc, RpcGroup } from "effect/unstable/rpc" 6 | import { RequestId } from "effect/unstable/rpc/RpcMessage" 7 | 8 | const TestGroup = RpcGroup.make( 9 | Rpc.make("one"), 10 | Rpc.make("two", { 11 | success: Schema.String 12 | }) 13 | ) 14 | 15 | describe("Rpc", () => { 16 | it.effect("can implement a single handler", () => 17 | Effect.gen(function*() { 18 | const TwoHandler = TestGroup.toLayerHandler("two", () => Effect.succeed("two")) 19 | const handler = yield* TestGroup.accessHandler("two").pipe( 20 | Effect.provide(TwoHandler) 21 | ) 22 | const result = yield* handler(void 0, { 23 | clientId: 1, 24 | requestId: RequestId(1n), 25 | headers: Headers.empty 26 | }) 27 | assert.strictEqual(result, "two") 28 | })) 29 | }) 30 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/src/SqliteMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | options: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | SqlError | Migrator.MigrationError, 24 | Client.SqlClient | R 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category constructor 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer => Layer.effectDiscard(run(options)) 34 | -------------------------------------------------------------------------------- /packages/sql/libsql/src/LibsqlMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | options: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | Migrator.MigrationError | SqlError, 24 | Client.SqlClient | R2 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category constructor 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer => Layer.effectDiscard(run(options)) 34 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/src/SqliteMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | options: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | SqlError | Migrator.MigrationError, 24 | Client.SqlClient | R 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category constructor 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer => Layer.effectDiscard(run(options)) 34 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/SingletonAddress.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Equal from "../../interfaces/Equal.ts" 5 | import * as Hash from "../../interfaces/Hash.ts" 6 | import * as Schema from "../../schema/Schema.ts" 7 | import { ShardId } from "./ShardId.ts" 8 | 9 | const TypeId = "~effect/cluster/SingletonAddress" 10 | 11 | /** 12 | * Represents the unique address of an singleton within the cluster. 13 | * 14 | * @since 4.0.0 15 | * @category Address 16 | */ 17 | export class SingletonAddress extends Schema.Class(TypeId)({ 18 | shardId: ShardId, 19 | name: Schema.String 20 | }) { 21 | /** 22 | * @since 4.0.0 23 | */ 24 | readonly [TypeId] = TypeId; 25 | /** 26 | * @since 4.0.0 27 | */ 28 | [Hash.symbol]() { 29 | return Hash.string(`${this.name}:${this.shardId.toString()}`) 30 | } 31 | /** 32 | * @since 4.0.0 33 | */ 34 | [Equal.symbol](that: SingletonAddress): boolean { 35 | return this.name === that.name && Equal.equals(this.shardId, that.shardId) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/httpapi/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as HttpApi from "./HttpApi.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as HttpApiBuilder from "./HttpApiBuilder.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as HttpApiClient from "./HttpApiClient.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as HttpApiEndpoint from "./HttpApiEndpoint.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | */ 28 | export * as HttpApiError from "./HttpApiError.ts" 29 | 30 | /** 31 | * @since 4.0.0 32 | */ 33 | export * as HttpApiGroup from "./HttpApiGroup.ts" 34 | 35 | /** 36 | * @since 4.0.0 37 | */ 38 | export * as HttpApiMiddleware from "./HttpApiMiddleware.ts" 39 | 40 | /** 41 | * @since 4.0.0 42 | */ 43 | export * as HttpApiSchema from "./HttpApiSchema.ts" 44 | 45 | /** 46 | * @since 4.0.0 47 | */ 48 | export * as HttpApiSecurity from "./HttpApiSecurity.ts" 49 | 50 | /** 51 | * @since 4.0.0 52 | */ 53 | export * as OpenApi from "./OpenApi.ts" 54 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/src/SqliteMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | { loader, schemaDirectory, table }: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | Migrator.MigrationError | SqlError, 24 | Client.SqlClient | R2 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category constructor 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer => Layer.effectDiscard(run(options)) 34 | -------------------------------------------------------------------------------- /packages/effect/src/schema/Util.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import { identity } from "../Function.ts" 5 | import type * as Annotations from "./Annotations.ts" 6 | import * as Schema from "./Schema.ts" 7 | import * as Transformation from "./Transformation.ts" 8 | 9 | /** 10 | * @since 4.0.0 11 | * @experimental 12 | */ 13 | export function getNativeClassSchema any, S extends Schema.Struct>( 14 | constructor: C, 15 | options: { 16 | readonly encoding: S 17 | readonly annotations?: Annotations.Declaration> 18 | } 19 | ): Schema.decodeTo, S["Iso"]>, S> { 20 | const transformation = Transformation.transform, S["Type"]>({ 21 | decode: (props) => new constructor(props), 22 | encode: identity 23 | }) 24 | return Schema.instanceOf(constructor, { 25 | serializer: () => Schema.link>()(options.encoding, transformation), 26 | ...options.annotations 27 | }).pipe(Schema.encodeTo(options.encoding, transformation)) 28 | } 29 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cluster/TestRunner.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | import * as Layer from "../../Layer.ts" 5 | import * as MessageStorage from "./MessageStorage.ts" 6 | import * as RunnerHealth from "./RunnerHealth.ts" 7 | import * as Runners from "./Runners.ts" 8 | import * as RunnerStorage from "./RunnerStorage.ts" 9 | import * as Sharding from "./Sharding.ts" 10 | import * as ShardingConfig from "./ShardingConfig.ts" 11 | 12 | /** 13 | * An in-memory cluster that can be used for testing purposes. 14 | * 15 | * MessageStorage is backed by an in-memory driver, and RunnerStorage is backed 16 | * by an in-memory driver. 17 | * 18 | * @since 4.0.0 19 | * @category Layers 20 | */ 21 | export const layer: Layer.Layer< 22 | Sharding.Sharding | Runners.Runners | MessageStorage.MessageStorage | MessageStorage.MemoryDriver 23 | > = Sharding.layer.pipe( 24 | Layer.provideMerge(Runners.layerNoop), 25 | Layer.provideMerge(MessageStorage.layerMemory), 26 | Layer.provide([RunnerStorage.layerMemory, RunnerHealth.layerNoop]), 27 | Layer.provide(ShardingConfig.layer()) 28 | ) 29 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/src/ClickhouseMigrator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import * as Layer from "effect/Layer" 6 | import * as Migrator from "effect/unstable/sql/Migrator" 7 | import type * as Client from "effect/unstable/sql/SqlClient" 8 | import type { SqlError } from "effect/unstable/sql/SqlError" 9 | 10 | /** 11 | * @since 1.0.0 12 | */ 13 | export * from "effect/unstable/sql/Migrator" 14 | 15 | /** 16 | * @category constructor 17 | * @since 1.0.0 18 | */ 19 | export const run: ( 20 | { loader, schemaDirectory, table }: Migrator.MigratorOptions 21 | ) => Effect.Effect< 22 | ReadonlyArray, 23 | Migrator.MigrationError | SqlError, 24 | Client.SqlClient | R2 25 | > = Migrator.make({}) 26 | 27 | /** 28 | * @category layers 29 | * @since 1.0.0 30 | */ 31 | export const layer = ( 32 | options: Migrator.MigratorOptions 33 | ): Layer.Layer< 34 | never, 35 | Migrator.MigrationError | SqlError, 36 | Client.SqlClient | R 37 | > => Layer.effectDiscard(run(options)) 38 | -------------------------------------------------------------------------------- /packages/sql/mssql/src/Parameter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import { identity } from "effect/Function" 5 | import type { DataType } from "tedious/lib/data-type.ts" 6 | import type { ParameterOptions } from "tedious/lib/request.ts" 7 | 8 | /** 9 | * @category type id 10 | * @since 1.0.0 11 | */ 12 | export const TypeId: TypeId = "~@effect/sql-mssql/Parameter" 13 | 14 | /** 15 | * @category type id 16 | * @since 1.0.0 17 | */ 18 | export type TypeId = "~@effect/sql-mssql/Parameter" 19 | 20 | /** 21 | * @category model 22 | * @since 1.0.0 23 | */ 24 | export interface Parameter { 25 | readonly [TypeId]: (_: never) => A 26 | readonly _tag: "Parameter" 27 | readonly name: string 28 | readonly type: DataType 29 | readonly options: ParameterOptions 30 | } 31 | 32 | /** 33 | * @category constructor 34 | * @since 1.0.0 35 | */ 36 | export const make = ( 37 | name: string, 38 | type: DataType, 39 | options: ParameterOptions = {} 40 | ): Parameter => ({ 41 | [TypeId]: identity, 42 | _tag: "Parameter", 43 | name, 44 | type, 45 | options 46 | }) 47 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import { nodeResolve } from "@rollup/plugin-node-resolve" 3 | import replace from "@rollup/plugin-replace" 4 | import terser from "@rollup/plugin-terser" 5 | import esbuild from "rollup-plugin-esbuild" 6 | import { visualizer } from "rollup-plugin-visualizer" 7 | 8 | export default { 9 | output: { 10 | format: "esm" 11 | }, 12 | onwarn: (warning, next) => { 13 | if (warning.code === "THIS_IS_UNDEFINED") return 14 | next(warning) 15 | }, 16 | plugins: [ 17 | nodeResolve(), 18 | replace({ 19 | "process.env.NODE_ENV": JSON.stringify("production"), 20 | preventAssignment: true 21 | }), 22 | esbuild({ 23 | target: "node20", // Since as of May 2025 the active LTS is Node 20 24 | format: "esm" 25 | }), 26 | terser({ 27 | format: { comments: false }, 28 | compress: true, 29 | mangle: process.env.VISUALIZE !== "true" 30 | }), 31 | ...(process.env.VISUALIZE === "true" ? 32 | [visualizer({ 33 | open: true, 34 | gzipSize: true 35 | })] : 36 | []) 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /packages/effect/dtslint/schema/Annotations.tst.ts: -------------------------------------------------------------------------------- 1 | import type { Option } from "effect/data" 2 | import { Annotations, Schema } from "effect/schema" 3 | import { describe, expect, it } from "tstyche" 4 | 5 | describe("Annotations", () => { 6 | describe("resolveInto", () => { 7 | it("String", () => { 8 | const schema = Schema.String 9 | const annotations = Annotations.resolveInto(schema) 10 | expect(annotations).type.toBe | undefined>() 11 | expect(annotations?.examples).type.toBe | undefined>() 12 | }) 13 | 14 | it("URL", () => { 15 | const schema = Schema.URL 16 | const annotations = Annotations.resolveInto(schema) 17 | expect(annotations).type.toBe | undefined>() 18 | }) 19 | 20 | it("Option(string)", () => { 21 | const schema = Schema.Option(Schema.String) 22 | const annotations = Annotations.resolveInto(schema) 23 | expect(annotations).type.toBe, readonly [Schema.String]> | undefined>() 24 | }) 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /packages/sql/libsql/test/util.ts: -------------------------------------------------------------------------------- 1 | import { LibsqlClient } from "@effect/sql-libsql" 2 | import { Effect, Layer, ServiceMap } from "effect" 3 | import { GenericContainer, type StartedTestContainer } from "testcontainers" 4 | 5 | export class LibsqlContainer extends ServiceMap.Service< 6 | LibsqlContainer, 7 | StartedTestContainer 8 | >()("test/LibsqlContainer") { 9 | static layer = Layer.effect(this)( 10 | Effect.acquireRelease( 11 | Effect.promise(() => 12 | new GenericContainer("ghcr.io/tursodatabase/libsql-server:main") 13 | .withExposedPorts(8080) 14 | .withEnvironment({ SQLD_NODE: "primary" }) 15 | .withCommand(["sqld", "--no-welcome", "--http-listen-addr", "0.0.0.0:8080"]).start() 16 | ), 17 | (container) => Effect.promise(() => container.stop()) 18 | ) 19 | ) 20 | 21 | static layerClient = Layer.unwrap( 22 | Effect.gen(function*() { 23 | const container = yield* LibsqlContainer 24 | return LibsqlClient.layer({ 25 | url: `http://localhost:${container.getMappedPort(8080)}` 26 | }) 27 | }) 28 | ).pipe(Layer.provide(this.layer)) 29 | } 30 | -------------------------------------------------------------------------------- /vitest.shared.ts: -------------------------------------------------------------------------------- 1 | import * as path from "node:path" 2 | import viteTsconfigPaths from "vite-tsconfig-paths" 3 | import type { ViteUserConfig } from "vitest/config" 4 | 5 | const config: ViteUserConfig = { 6 | plugins: [viteTsconfigPaths()], 7 | esbuild: { 8 | target: "es2020" 9 | }, 10 | optimizeDeps: { 11 | exclude: ["bun:sqlite"] 12 | }, 13 | test: { 14 | setupFiles: [path.join(__dirname, "vitest.setup.ts")], 15 | fakeTimers: { 16 | toFake: undefined 17 | }, 18 | sequence: { 19 | concurrent: true 20 | }, 21 | include: ["test/**/*.test.ts"], 22 | coverage: { 23 | provider: "v8", 24 | reporter: ["html"], 25 | reportsDirectory: "coverage", 26 | exclude: [ 27 | "node_modules/", 28 | "dist/", 29 | "benchmark/", 30 | "bundle/", 31 | "dtslint/", 32 | "build/", 33 | "coverage/", 34 | "test/utils/", 35 | "**/*.d.ts", 36 | "**/*.config.*", 37 | "**/vitest.setup.*", 38 | "**/vitest.shared.*" 39 | ], 40 | all: true 41 | } 42 | } 43 | } 44 | 45 | export default config 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/effect/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/d1/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/mssql/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/pg/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/vitest/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/rpc/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 4.0.0 3 | */ 4 | 5 | /** 6 | * @since 4.0.0 7 | */ 8 | export * as Rpc from "./Rpc.ts" 9 | 10 | /** 11 | * @since 4.0.0 12 | */ 13 | export * as RpcClient from "./RpcClient.ts" 14 | 15 | /** 16 | * @since 4.0.0 17 | */ 18 | export * as RpcClientError from "./RpcClientError.ts" 19 | 20 | /** 21 | * @since 4.0.0 22 | */ 23 | export * as RpcGroup from "./RpcGroup.ts" 24 | 25 | /** 26 | * @since 4.0.0 27 | */ 28 | export * as RpcMessage from "./RpcMessage.ts" 29 | 30 | /** 31 | * @since 4.0.0 32 | */ 33 | export * as RpcMiddleware from "./RpcMiddleware.ts" 34 | 35 | /** 36 | * @since 4.0.0 37 | */ 38 | export * as RpcSchema from "./RpcSchema.ts" 39 | 40 | /** 41 | * @since 4.0.0 42 | */ 43 | export * as RpcSerialization from "./RpcSerialization.ts" 44 | 45 | /** 46 | * @since 4.0.0 47 | */ 48 | export * as RpcServer from "./RpcServer.ts" 49 | 50 | /** 51 | * @since 4.0.0 52 | */ 53 | export * as RpcTest from "./RpcTest.ts" 54 | 55 | /** 56 | * @since 4.0.0 57 | */ 58 | export * as RpcWorker from "./RpcWorker.ts" 59 | 60 | /** 61 | * @since 4.0.0 62 | */ 63 | export * as Utils from "./Utils.ts" 64 | -------------------------------------------------------------------------------- /packages/platform-bun/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/clickhouse/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/libsql/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/mysql2/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/sqlite-bun/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/sqlite-do/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform-browser/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform-node/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/sqlite-node/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/sqlite-wasm/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform-node-shared/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sql/sqlite-react-native/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present The Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/effect/src/unstable/cli/internal/completions/types.ts: -------------------------------------------------------------------------------- 1 | import type { Command } from "../../Command.ts" 2 | 3 | /** @internal */ 4 | export type Shell = "bash" | "zsh" | "fish" 5 | 6 | /** @internal */ 7 | export interface SingleFlagMeta { 8 | readonly name: string 9 | readonly aliases: ReadonlyArray 10 | readonly primitiveTag: string 11 | readonly typeName?: string 12 | readonly description?: string 13 | } 14 | 15 | /** @internal */ 16 | export interface CommandRow< 17 | Name extends string = string, 18 | I = any, 19 | E = any, 20 | R = any 21 | > { 22 | readonly trail: Array 23 | readonly cmd: Command 24 | } 25 | 26 | /** @internal */ 27 | export const isDirType = (s: SingleFlagMeta): boolean => s.typeName === "directory" 28 | 29 | /** @internal */ 30 | export const isFileType = (s: SingleFlagMeta): boolean => s.typeName === "file" 31 | 32 | /** @internal */ 33 | export const isEitherPath = (s: SingleFlagMeta): boolean => 34 | s.typeName === "path" || s.typeName === "either" || s.primitiveTag === "Path" 35 | 36 | /** @internal */ 37 | export const optionRequiresValue = (s: SingleFlagMeta): boolean => s.primitiveTag !== "Boolean" 38 | -------------------------------------------------------------------------------- /packages/tools/openapi-generator/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Effectful Technologies Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yaml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | description: Perform standard setup and install dependencies using pnpm. 3 | inputs: 4 | node-version: 5 | description: The version of Node.js to install 6 | required: false 7 | deno-version: 8 | description: The version of Deno to install 9 | required: false 10 | bun-version: 11 | description: The version of Bun to install 12 | required: false 13 | 14 | runs: 15 | using: composite 16 | steps: 17 | - name: Install pnpm 18 | uses: pnpm/action-setup@v3 19 | - name: Install node 20 | uses: actions/setup-node@v4 21 | if: ${{ inputs.node-version != '' }} 22 | with: 23 | cache: pnpm 24 | node-version: ${{ inputs.node-version }} 25 | - name: Install deno 26 | uses: denoland/setup-deno@v2 27 | if: ${{ inputs.deno-version != '' }} 28 | with: 29 | deno-version: ${{ inputs.deno-version }} 30 | - name: Install bun 31 | uses: oven-sh/setup-bun@v2 32 | if: ${{ inputs.bun-version != '' }} 33 | with: 34 | bun-version: ${{ inputs.bun-version }} 35 | - name: Install dependencies 36 | shell: bash 37 | run: pnpm install 38 | -------------------------------------------------------------------------------- /packages/platform-bun/src/BunMultipart.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @since 1.0.0 3 | */ 4 | import type * as Effect from "effect/Effect" 5 | import type { FileSystem } from "effect/platform/FileSystem" 6 | import type { Path } from "effect/platform/Path" 7 | import type * as Scope from "effect/Scope" 8 | import * as Stream from "effect/stream/Stream" 9 | import * as Multipart from "effect/unstable/http/Multipart" 10 | import * as BunStream from "./BunStream.ts" 11 | 12 | /** 13 | * @since 1.0.0 14 | * @category Constructors 15 | */ 16 | export const stream = (source: Request): Stream.Stream => 17 | BunStream.fromReadableStream({ 18 | evaluate: () => source.body!, 19 | onError: (cause) => new Multipart.MultipartError({ reason: "InternalError", cause }) 20 | }).pipe( 21 | Stream.pipeThroughChannel(Multipart.makeChannel(Object.fromEntries(source.headers))) 22 | ) 23 | 24 | /** 25 | * @since 1.0.0 26 | * @category Constructors 27 | */ 28 | export const persisted = ( 29 | source: Request 30 | ): Effect.Effect< 31 | Multipart.Persisted, 32 | Multipart.MultipartError, 33 | | FileSystem 34 | | Path 35 | | Scope.Scope 36 | > => Multipart.toPersisted(stream(source)) 37 | -------------------------------------------------------------------------------- /packages/effect/src/internal/tracer.ts: -------------------------------------------------------------------------------- 1 | import type * as Tracer from "../Tracer.ts" 2 | 3 | export interface ErrorWithStackTraceLimit { 4 | stackTraceLimit?: number | undefined 5 | } 6 | 7 | /** @internal */ 8 | export const addSpanStackTrace = ( 9 | options: A | undefined 10 | ): A => { 11 | if (options?.captureStackTrace === false) { 12 | return options 13 | } else if (options?.captureStackTrace !== undefined && typeof options.captureStackTrace !== "boolean") { 14 | return options 15 | } 16 | const limit = (Error as ErrorWithStackTraceLimit).stackTraceLimit 17 | ;(Error as ErrorWithStackTraceLimit).stackTraceLimit = 3 18 | const traceError = new Error() 19 | ;(Error as ErrorWithStackTraceLimit).stackTraceLimit = limit 20 | let cache: false | string = false 21 | return { 22 | ...options, 23 | captureStackTrace: () => { 24 | if (cache !== false) { 25 | return cache 26 | } 27 | if (traceError.stack !== undefined) { 28 | const stack = traceError.stack.split("\n") 29 | if (stack[3] !== undefined) { 30 | cache = stack[3].trim() 31 | return cache 32 | } 33 | } 34 | } 35 | } as A 36 | } 37 | -------------------------------------------------------------------------------- /scripts/codemods/ts-fence.ts: -------------------------------------------------------------------------------- 1 | import type * as cs from "jscodeshift" 2 | 3 | const EXAMPLE = "* @example\n" 4 | const EXAMPLE_WITH_FENCE = "* @example\n * ```ts\n" 5 | 6 | export default function transformer(file: cs.FileInfo, api: cs.API) { 7 | const j = api.jscodeshift 8 | const root = j(file.source) 9 | 10 | root.find(j.Comment as any).forEach((path) => { 11 | if (path.value.type === "CommentBlock") { 12 | const value = (path.value) as any 13 | const comment = value.value 14 | if (comment.includes(EXAMPLE) && !comment.includes(EXAMPLE_WITH_FENCE)) { 15 | value.value = wrapExamplesWithFence(comment) 16 | } 17 | } 18 | }) 19 | 20 | return root.toSource() 21 | } 22 | 23 | function wrapExamplesWithFence(jsdocComment: string) { 24 | const start = jsdocComment.indexOf(EXAMPLE) + EXAMPLE.length 25 | let end = jsdocComment.indexOf(" * @", start) 26 | if (end === -1) { 27 | end = jsdocComment.length - 1 28 | } else { 29 | if (jsdocComment.substring(end - 3, end) === " *\n") { 30 | end -= 3 31 | } 32 | } 33 | return jsdocComment.substring(0, start) + " * ```ts\n" + jsdocComment.substring(start, end) + " * ```\n" + 34 | jsdocComment.substring(end) 35 | } 36 | --------------------------------------------------------------------------------