Skip to content

Commit

Permalink
update to latest effect (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jun 21, 2024
1 parent 5c57366 commit 013283f
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 253 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
"devDependencies": {
"@effect/language-service": "^0.1.0",
"@octokit/types": "^13.5.0",
"@types/node": "^20.14.2",
"tsx": "^4.15.5",
"typescript": "5.5.0-dev.20240514"
"@types/node": "^20.14.7",
"tsx": "^4.15.6",
"typescript": "5.5.2"
},
"dependencies": {
"@effect/experimental": "^0.16.26",
"@effect/opentelemetry": "^0.34.19",
"@effect/platform": "^0.57.1",
"@effect/platform-node": "^0.51.10",
"@effect/schema": "^0.67.23",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.0",
"@opentelemetry/sdk-metrics": "^1.25.0",
"@opentelemetry/sdk-trace-base": "^1.25.0",
"@opentelemetry/sdk-trace-node": "^1.25.0",
"dfx": "^0.97.7",
"@effect/experimental": "^0.17.0",
"@effect/opentelemetry": "^0.34.23",
"@effect/platform": "^0.58.1",
"@effect/platform-node": "^0.53.0",
"@effect/schema": "^0.68.4",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/sdk-metrics": "^1.25.1",
"@opentelemetry/sdk-trace-base": "^1.25.1",
"@opentelemetry/sdk-trace-node": "^1.25.1",
"dfx": "^0.98.0",
"dotenv": "^16.4.5",
"effect": "^3.3.2",
"effect": "^3.4.0",
"gpt-tokenizer": "^2.1.2",
"html-entities": "^2.5.2",
"octokit": "^4.0.2",
"openai": "^4.51.0",
"openai": "^4.52.0",
"prettier": "^3.3.2"
}
}
432 changes: 216 additions & 216 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/AutoThreads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ const make = Effect.gen(function* () {
}),
),
Effect.withSpan("AutoThreads.handleMessages"),
Effect.catchTags({
ParseError: error =>
Effect.logDebug(TreeFormatter.formatIssueSync(error.error)),
}),
Effect.catchAllCause(Effect.logError),
),
)
Expand Down
17 changes: 8 additions & 9 deletions src/DocsLookup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpClient, HttpClientRequest } from "@effect/platform"
import { Schema } from "@effect/schema"
import { DiscordLive } from "bot/Discord"
import { Http } from "bot/_common"
import { Discord, Ix } from "dfx"
import { InteractionsRegistry } from "dfx/gateway"
import { Data, Duration, Effect, Layer, Schedule, identity, pipe } from "effect"
Expand All @@ -12,17 +12,16 @@ const docUrls = ["https://effect-ts.github.io/effect"]
const make = Effect.gen(function* () {
const registry = yield* InteractionsRegistry

const docsClient = pipe(
Http.client.fetchOk,
Http.client.retry(retryPolicy),
Http.client.mapEffectScoped(_ => _.json),
Http.client.map(_ => Object.values(_ as object)),
Http.client.mapEffect(DocEntry.decodeArray),
Http.client.map(entries => entries.filter(_ => _.isSignature)),
const docsClient = HttpClient.fetchOk.pipe(
HttpClient.retry(retryPolicy),
HttpClient.mapEffectScoped(_ => _.json),
HttpClient.map(_ => Object.values(_ as object)),
HttpClient.mapEffect(DocEntry.decodeArray),
HttpClient.map(entries => entries.filter(_ => _.isSignature)),
)

const loadDocs = (baseUrl: string) =>
docsClient(Http.request.get(`${baseUrl}/assets/js/search-data.json`))
docsClient(HttpClientRequest.get(`${baseUrl}/assets/js/search-data.json`))

const allDocs = yield* Effect.forEach(docUrls, loadDocs, {
concurrency: "unbounded",
Expand Down
4 changes: 0 additions & 4 deletions src/NoEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ const make = Effect.gen(function* () {
}),
),
Effect.withSpan("NoEmbed.handleMessage"),
Effect.catchTags({
ParseError: error =>
Effect.logDebug(TreeFormatter.formatIssueSync(error.error)),
}),
Effect.catchAllCause(Effect.logError),
)

Expand Down
4 changes: 2 additions & 2 deletions src/Summarizer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HttpBody } from "@effect/platform"
import { ChannelsCache } from "bot/ChannelsCache"
import { DiscordLive } from "bot/Discord"
import { MemberCache } from "bot/MemberCache"
import { Messages } from "bot/Messages"
import { Http } from "bot/_common"
import { Discord, DiscordREST, Ix } from "dfx"
import { InteractionsRegistry } from "dfx/gateway"
import {
Expand Down Expand Up @@ -157,7 +157,7 @@ ${message.content}${imagesContent}`
application.id,
context.token,
{ content: "Here is your summary!" },
{ body: Http.body.formData(formData) },
{ body: HttpBody.formData(formData) },
)
}),
Effect.catchAllCause(cause =>
Expand Down
2 changes: 0 additions & 2 deletions src/_common.ts

This file was deleted.

0 comments on commit 013283f

Please sign in to comment.