Skip to content

Commit 533807d

Browse files
committed
cleanup SDK
1 parent 0528747 commit 533807d

File tree

14 files changed

+160
-628
lines changed

14 files changed

+160
-628
lines changed

bun.lock

Lines changed: 108 additions & 557 deletions
Large diffs are not rendered by default.

packages/sdk/package.json

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,48 @@
1010
"build": "unbuild",
1111
"test": "bun test"
1212
},
13-
"dependencies": {
14-
"@ai-sdk/provider": "^2.0.0",
15-
"ai": "^5.0.51",
16-
"jotai": ">=2.0.0",
17-
"tokenlens": "^2.0.0-alpha.3"
18-
},
1913
"devDependencies": {
14+
"@ai-sdk/provider": "^2.0.0",
2015
"@types/node": "^20.0.0",
2116
"@vitejs/plugin-react": "^5.0.0",
17+
"ai": "^5.0.51",
18+
"jotai": ">=2.0.0",
19+
"react": ">=19.0.0",
20+
"@types/react": ">=19.0.0",
21+
"tokenlens": "^2.0.0-alpha.3",
2222
"typescript": "catalog:",
23-
"unbuild": "^3.6.1"
23+
"unbuild": "^3.6.1",
24+
"vue": ">=3",
25+
"msw": "^2.11.5"
2426
},
2527
"peerDependencies": {
28+
"@ai-sdk/provider": "^2.0.0",
29+
"ai": "^5.0.51",
30+
"jotai": ">=2.0.0",
2631
"react": ">=18",
32+
"tokenlens": "^2.0.0-alpha.3",
33+
"msw": "^2.11.5",
2734
"vue": ">=3"
2835
},
2936
"peerDependenciesMeta": {
37+
"@ai-sdk/provider": {
38+
"optional": true
39+
},
40+
"ai": {
41+
"optional": true
42+
},
43+
"jotai": {
44+
"optional": true
45+
},
3046
"react": {
3147
"optional": true
3248
},
49+
"tokenlens": {
50+
"optional": true
51+
},
52+
"msw": {
53+
"optional": true
54+
},
3355
"vue": {
3456
"optional": true
3557
}

packages/sdk/src/ai/vercel/middleware.test.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/sdk/src/ai/vercel/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
} from '@ai-sdk/provider';
55
import { wrapLanguageModel } from 'ai';
66
import { computeCostUSD } from 'tokenlens';
7-
import type { Databuddy } from '../../node';
7+
import type { Databuddy } from '@/node';
88

99
export type TrackProperties = {
1010
inputTokens?: number;

packages/sdk/src/core/flags/flags-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { logger } from '../../logger';
1+
import { logger } from '@/logger';
22
import type {
33
FlagResult,
44
FlagState,

packages/sdk/src/core/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
export { detectClientId } from '../utils';
1+
export { detectClientId } from '@/utils';
22
export * from './flags';
33
export * from './script';
44
export * from './tracker';
55
export * from './types';
66

7-
import { Databuddy as DatabuddyReact } from '../react/Databuddy';
7+
import { Databuddy as DatabuddyReact } from '@/react/Databuddy';
88

99
/**
1010
* @deprecated Use Databuddy from `@databuddy/sdk/react` instead

packages/sdk/src/react/Databuddy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createScript, isScriptInjected } from '../core/script';
2-
import type { DatabuddyConfig } from '../core/types';
3-
import { detectClientId } from '../utils';
1+
import { createScript, isScriptInjected } from '@/core/script';
2+
import type { DatabuddyConfig } from '@/core/types';
3+
import { detectClientId } from '@/utils';
44

55
/**
66
* <Databuddy /> component for Next.js/React apps

packages/sdk/src/react/flags/flags-provider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { atom, createStore, Provider, useAtom } from 'jotai';
22
import type { ReactNode } from 'react';
33
import { createElement, useEffect, useRef } from 'react';
4-
import type { FlagResult, FlagState, FlagsConfig } from '../../core/flags';
5-
import { BrowserFlagStorage, CoreFlagsManager } from '../../core/flags';
6-
import { logger } from '../../logger';
4+
import type { FlagResult, FlagState, FlagsConfig } from '@/core/flags';
5+
import { BrowserFlagStorage, CoreFlagsManager } from '@/core/flags';
6+
import { logger } from '@/logger';
77

88
const flagsStore = createStore();
99

packages/sdk/src/react/flags/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ export type {
44
FlagState,
55
FlagsConfig,
66
FlagsContext,
7-
} from '../../core/flags';
7+
} from '@/core/flags';

packages/sdk/src/vue/Databuddy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
2-
import { createScript, type DatabuddyConfig, isScriptInjected } from '../core';
3-
import type { IsOptional } from '../utils';
2+
import { createScript, type DatabuddyConfig, isScriptInjected } from '@/core';
3+
import type { IsOptional } from '@/utils';
44

55
export const Databuddy = defineComponent({
66
props: {} as {
@@ -15,7 +15,7 @@ export const Databuddy = defineComponent({
1515
required: IsOptional<DatabuddyConfig[key]> extends true ? false : true;
1616
};
1717
},
18-
setup(props) {
18+
setup(props: DatabuddyConfig) {
1919
const scriptRef = ref<HTMLScriptElement | null>(null);
2020

2121
const injectScript = () => {

0 commit comments

Comments
 (0)