🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

dokv-client

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dokv-client - npm Package Compare versions

Comparing version
2.0.0
to
2.0.1
+11
-4
docs/AI_GUIDE.md

@@ -20,8 +20,12 @@ # AI 使用指南 - dokv-client

```javascript
// 默认实例(推荐)
import kv from 'dokv-client'
// 推荐方式:使用工厂函数(必须指定 projectId)
import createClient from 'dokv-client'
const kv = createClient('my-project-id')
// 自定义配置
import { KVClient } from 'dokv-client'
const customKV = new KVClient({ timeout: 10000 })
const customKV = new KVClient({
projectId: 'my-project-id',
timeout: 10000
})
```

@@ -31,3 +35,6 @@

```javascript
// 设置数据
// 创建客户端(必须指定项目ID)
const kv = createClient('my-project-id')
// 设置数据(实际键名:my-project-id/key)
await kv.set('key', 'value')

@@ -34,0 +41,0 @@ await kv.set('user:123', { name: 'John', age: 30 })

@@ -66,3 +66,2 @@ # API 文档

metadata?: Record<string, any> // 元数据
namespace?: string // 命名空间
}

@@ -84,4 +83,5 @@ ```

// 使用命名空间
await kv.set('user:123', userData, { namespace: 'app1' })
// 使用命名空间(实际键名:my-saas-app/app1/user:123)
const appKV = kv.namespace('app1')
await appKV.set('user:123', userData)
```

@@ -109,3 +109,2 @@

interface GetOptions {
namespace?: string // 命名空间
includeMetadata?: boolean // 是否包含元数据

@@ -127,3 +126,4 @@ }

// 从指定命名空间获取
const config = await kv.get('config', { namespace: 'app1' })
const appKV = kv.namespace('app1')
const config = await appKV.get('config')
```

@@ -149,3 +149,2 @@

updatedAt: string
namespace?: string
responseTime?: number

@@ -180,3 +179,3 @@ }

interface DeleteOptions {
namespace?: string // 命名空间
// 无选项参数
}

@@ -195,3 +194,4 @@ ```

// 从指定命名空间删除
await kv.delete('config', { namespace: 'app1' })
const appKV = kv.namespace('app1')
await appKV.delete('config')
```

@@ -214,3 +214,3 @@

interface ExistsOptions {
namespace?: string // 命名空间
// 无选项参数
}

@@ -240,3 +240,2 @@ ```

interface ListOptions {
namespace?: string // 命名空间
prefix?: string // 键名前缀过滤

@@ -256,3 +255,4 @@ limit?: number // 最大返回数量,默认 1000

// 列出指定命名空间的键
const appKeys = await kv.list({ namespace: 'app1' })
const appKV = kv.namespace('app1')
const appKeys = await appKV.list()

@@ -405,5 +405,6 @@ // 列出指定前缀的键

// 等同于
await kv.set('config', appConfig, { namespace: 'my-app' })
await kv.set('123', userData, { namespace: 'users' })
// 嵌套命名空间
const adminKV = appKV.namespace('admin')
// 实际键名:my-saas-app/my-app/admin/settings
await adminKV.set('settings', adminSettings)
```

@@ -540,3 +541,2 @@

updatedAt: string
namespace?: string
responseTime?: number

@@ -543,0 +543,0 @@ }

@@ -14,5 +14,8 @@ # 快速开始指南

```javascript
import kv from 'dokv-client'
import createClient from 'dokv-client'
// 存储数据
// 创建客户端(必须指定项目ID)
const kv = createClient('my-saas-app')
// 存储数据(实际键名:my-saas-app/hello)
await kv.set('hello', 'world')

@@ -35,3 +38,6 @@

```javascript
// 字符串
// 创建客户端
const kv = createClient('my-saas-app')
// 字符串(实际键名:my-saas-app/name)
await kv.set('name', 'Alice')

@@ -38,0 +44,0 @@

{
"name": "dokv-client",
"version": "2.0.0",
"version": "2.0.1",
"description": "零配置的 KV 存储客户端,开箱即用,支持 TypeScript",

@@ -43,8 +43,8 @@ "main": "dist/index.js",

"type": "git",
"url": "https://github.com/dokv/client.git"
"url": "https://github.com/leeguooooo/kv-tools.git"
},
"bugs": {
"url": "https://github.com/dokv/client/issues"
"url": "https://github.com/leeguooooo/kv-tools/issues"
},
"homepage": "https://github.com/dokv/client#readme",
"homepage": "https://github.com/leeguooooo/kv-tools#readme",
"dependencies": {

@@ -51,0 +51,0 @@ "cross-fetch": "^4.0.0"