From ff4059f00eab72213793ef13ff2f9f964bbcc843 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Sat, 1 Jun 2024 21:11:07 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/package.json | 24 +++++++++++++++++------- legacy/src/errors.ts | 2 -- legacy/src/fns.ts | 2 +- legacy/src/services/diffbot-client.ts | 12 ------------ legacy/tsup.config.ts | 2 +- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/legacy/package.json b/legacy/package.json index 6ab2c310..204d9259 100644 --- a/legacy/package.json +++ b/legacy/package.json @@ -27,6 +27,11 @@ "types": "./dist/sdks/ai-sdk.d.ts", "import": "./dist/sdks/ai-sdk.js", "default": "./dist/sdks/ai-sdk.js" + }, + "./dexter": { + "types": "./dist/sdks/dexter.d.ts", + "import": "./dist/sdks/dexter.js", + "default": "./dist/sdks/dexter.js" } }, "files": [ @@ -50,16 +55,10 @@ }, "dependencies": { "@nangohq/node": "^0.39.32", - "chalk": "^5.3.0", "delay": "^6.0.0", - "dotenv": "^16.4.5", - "exit-hook": "^4.0.0", "jsonrepair": "^3.6.1", "ky": "^1.2.4", - "p-map": "^7.0.2", - "p-retry": "^6.2.0", "p-throttle": "^6.1.0", - "restore-cursor": "^5.0.0", "tiny-invariant": "^1.3.3", "twitter-api-sdk": "^1.2.1", "type-fest": "^4.18.3", @@ -73,23 +72,34 @@ "@types/node": "^20.12.7", "ai": "^3.1.22", "del-cli": "^5.1.0", + "dotenv": "^16.4.5", "eslint": "^8.57.0", + "exit-hook": "^4.0.0", "husky": "^9.0.11", "lint-staged": "^15.2.5", "np": "^10.0.5", "npm-run-all2": "^6.2.0", "only-allow": "^1.2.1", "prettier": "^3.2.5", + "restore-cursor": "^5.0.0", "ts-node": "^10.9.2", "tsup": "^8.0.2", "tsx": "^4.11.0", "typescript": "^5.4.5", "vitest": "2.0.0-beta.3" }, - "optionalDependencies": { + "peerDependencies": { "@dexaai/dexter": "^2.0.3", "ai": "^3.1.22" }, + "peerDependenciesMeta": { + "@dexaai/dexter": { + "optional": true + }, + "ai": { + "optional": true + } + }, "lint-staged": { "*.{ts,tsx}": [ "eslint --fix", diff --git a/legacy/src/errors.ts b/legacy/src/errors.ts index 555bc094..d3bdd21d 100644 --- a/legacy/src/errors.ts +++ b/legacy/src/errors.ts @@ -1,5 +1,3 @@ -export { AbortError, type FailedAttemptError } from 'p-retry' - export class RetryableError extends Error {} export class ParseError extends RetryableError {} diff --git a/legacy/src/fns.ts b/legacy/src/fns.ts index 2e1f7cef..ea6b4200 100644 --- a/legacy/src/fns.ts +++ b/legacy/src/fns.ts @@ -1,6 +1,6 @@ import './symbol-polyfill.js' -import type * as z from 'zod' +import type { z } from 'zod' import type * as types from './types.js' import { createAIFunction } from './ai-function.js' diff --git a/legacy/src/services/diffbot-client.ts b/legacy/src/services/diffbot-client.ts index 8e4b70ee..9f6780b7 100644 --- a/legacy/src/services/diffbot-client.ts +++ b/legacy/src/services/diffbot-client.ts @@ -1,5 +1,4 @@ import defaultKy, { type KyInstance } from 'ky' -import { AbortError } from 'p-retry' import pThrottle from 'p-throttle' import { assert, getEnv, throttleKy } from '../utils.js' @@ -391,17 +390,6 @@ export class DiffbotClient { } } - // TODO - const { url } = searchParams - if (url) { - const parsedUrl = new URL(url) - if (parsedUrl.hostname.includes('theguardian.com')) { - throw new AbortError( - `Diffbot does not support URLs from domain "${parsedUrl.hostname}"` - ) - } - } - // console.log(`DiffbotClient._extract: ${endpoint}`, searchParams) return this.ky diff --git a/legacy/tsup.config.ts b/legacy/tsup.config.ts index 6489fe1c..396849b5 100644 --- a/legacy/tsup.config.ts +++ b/legacy/tsup.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'tsup' export default defineConfig([ { - entry: ['src/index.ts', 'src/sdks/ai-sdk.ts'], + entry: ['src/index.ts', 'src/sdks/ai-sdk.ts', 'src/sdks/dexter.ts'], outDir: 'dist', target: 'node18', platform: 'node',