connectbase-client 0.6.15 → 0.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/dist/cli.js +22 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,14 +12,39 @@ pnpm add connectbase-client
|
|
|
12
12
|
yarn add connectbase-client
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## API Key Types
|
|
16
|
+
|
|
17
|
+
Connect Base provides **two types** of API Keys. Use the right key for your use case:
|
|
18
|
+
|
|
19
|
+
| Type | Prefix | Use For | Permissions | Safe to Expose? |
|
|
20
|
+
|------|--------|---------|-------------|-----------------|
|
|
21
|
+
| **Public Key** | `cb_pk_` | SDK / Web apps | Limited (RLS enforced) | ✅ Yes — safe in frontend code |
|
|
22
|
+
| **Secret Key** | `cb_sk_` | MCP / Admin tools | Full access (bypasses RLS) | ❌ **Never expose in frontend or public repos** |
|
|
23
|
+
|
|
24
|
+
**Which key should I use?**
|
|
25
|
+
|
|
26
|
+
| Context | Key Type | Example |
|
|
27
|
+
|---------|----------|---------|
|
|
28
|
+
| Frontend SDK (`new ConnectBase()`) | **Public Key** (`cb_pk_`) | Web/app: DB queries, auth, file uploads |
|
|
29
|
+
| `.env` file (`VITE_CONNECTBASE_API_KEY`) | **Public Key** (`cb_pk_`) | React, Vue, etc. |
|
|
30
|
+
| CLI deploy (`.connectbaserc`) | **Public Key** (`cb_pk_`) | `npx connectbase deploy` |
|
|
31
|
+
| MCP server (AI tools) | **Secret Key** (`cb_sk_`) | Claude, Cursor, Windsurf |
|
|
32
|
+
| Server-side admin tasks | **Secret Key** (`cb_sk_`) | Backend full data access |
|
|
33
|
+
|
|
34
|
+
> ⚠️ **MCP server rejects Public Keys** — you must use a Secret Key (`cb_sk_`).
|
|
35
|
+
>
|
|
36
|
+
> ⚠️ **Never use Secret Keys in frontend code** — RLS is bypassed, exposing all data.
|
|
37
|
+
|
|
38
|
+
Create API Keys in the Console under **Settings > API tab**. Choose Public or Secret type when creating. The full key is shown **only once** at creation time.
|
|
39
|
+
|
|
15
40
|
## Quick Start
|
|
16
41
|
|
|
17
42
|
```typescript
|
|
18
43
|
import ConnectBase from 'connectbase-client'
|
|
19
44
|
|
|
20
|
-
// Initialize the SDK
|
|
45
|
+
// Initialize the SDK — use a Public Key (cb_pk_)
|
|
21
46
|
const cb = new ConnectBase({
|
|
22
|
-
apiKey: '
|
|
47
|
+
apiKey: 'cb_pk_your-public-key'
|
|
23
48
|
})
|
|
24
49
|
|
|
25
50
|
// Create a game room client
|
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ var crypto = __toESM(require("crypto"));
|
|
|
30
30
|
var https = __toESM(require("https"));
|
|
31
31
|
var http = __toESM(require("http"));
|
|
32
32
|
var readline = __toESM(require("readline"));
|
|
33
|
-
var VERSION = "0.6.
|
|
33
|
+
var VERSION = "0.6.17";
|
|
34
34
|
var DEFAULT_BASE_URL = "https://api.connectbase.world";
|
|
35
35
|
var colors = {
|
|
36
36
|
reset: "\x1B[0m",
|
|
@@ -445,10 +445,23 @@ function addDeployScript(deployDir) {
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
async function downloadDocs(apiKey, templates) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
let claudeMdPath = path.join(process.cwd(), "CLAUDE.md");
|
|
449
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
450
|
+
const choice = await prompt(`${colors.yellow}\u26A0${colors.reset} CLAUDE.md\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uC5B4\uB5BB\uAC8C \uD560\uAE4C\uC694?
|
|
451
|
+
${colors.cyan}1${colors.reset}) \uB36E\uC5B4\uC4F0\uAE30
|
|
452
|
+
${colors.cyan}2${colors.reset}) .claude/CLAUDE.md\uC5D0 \uC800\uC7A5
|
|
453
|
+
${colors.cyan}3${colors.reset}) \uCDE8\uC18C
|
|
454
|
+
${colors.blue}?${colors.reset} \uC120\uD0DD (1/2/3): `);
|
|
455
|
+
if (choice === "2") {
|
|
456
|
+
const claudeDir = path.join(process.cwd(), ".claude");
|
|
457
|
+
if (!fs.existsSync(claudeDir)) {
|
|
458
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
459
|
+
}
|
|
460
|
+
claudeMdPath = path.join(claudeDir, "CLAUDE.md");
|
|
461
|
+
} else if (choice !== "1") {
|
|
462
|
+
info("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC\uB97C \uAC74\uB108\uB701\uB2C8\uB2E4");
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
452
465
|
}
|
|
453
466
|
if (!templates) {
|
|
454
467
|
templates = ["rules"];
|
|
@@ -466,7 +479,8 @@ async function downloadDocs(apiKey, templates) {
|
|
|
466
479
|
}
|
|
467
480
|
const content = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
|
|
468
481
|
fs.writeFileSync(claudeMdPath, content);
|
|
469
|
-
|
|
482
|
+
const relativePath = path.relative(process.cwd(), claudeMdPath);
|
|
483
|
+
success(`${relativePath} \uC0DD\uC131 \uC644\uB8CC`);
|
|
470
484
|
log(`${colors.dim}\u203B SDK \uBB38\uC11C\uB294 MCP search_sdk_docs\uB85C \uAC80\uC0C9\uD558\uC138\uC694${colors.reset}`);
|
|
471
485
|
} catch {
|
|
472
486
|
warn("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328, \uAE30\uBCF8 CLAUDE.md\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4");
|
|
@@ -476,7 +490,8 @@ async function downloadDocs(apiKey, templates) {
|
|
|
476
490
|
|
|
477
491
|
\uC790\uC138\uD55C \uAC00\uC774\uB4DC: https://connectbase.world
|
|
478
492
|
`);
|
|
479
|
-
|
|
493
|
+
const relativePath = path.relative(process.cwd(), claudeMdPath);
|
|
494
|
+
success(`${relativePath} \uC0DD\uC131 \uC644\uB8CC (\uAE30\uBCF8)`);
|
|
480
495
|
}
|
|
481
496
|
}
|
|
482
497
|
async function setupClaudeCode(apiKey) {
|