aurabase-js 0.4.0 → 0.6.0

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.
@@ -1 +1 @@
1
- {"session_id":"1c1e8df6-335a-4058-8bd4-4c0a67d996cd","transcript_path":"C:\\Users\\Jay\\.claude\\projects\\D--000-FrontEnd-242-dino-game\\1c1e8df6-335a-4058-8bd4-4c0a67d996cd.jsonl","cwd":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","model":{"id":"GLM-5","display_name":"GLM-5"},"workspace":{"current_dir":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","project_dir":"D:\\000.FrontEnd\\242.dino_game","added_dirs":[]},"version":"2.1.71","output_style":{"name":"default"},"cost":{"total_cost_usd":2.500432,"total_duration_ms":1462926,"total_api_duration_ms":692143,"total_lines_added":329,"total_lines_removed":37},"context_window":{"total_input_tokens":71095,"total_output_tokens":15653,"context_window_size":200000,"current_usage":{"input_tokens":126,"output_tokens":66,"cache_creation_input_tokens":0,"cache_read_input_tokens":77504},"used_percentage":39,"remaining_percentage":61},"exceeds_200k_tokens":false}
1
+ {"session_id":"1c1e8df6-335a-4058-8bd4-4c0a67d996cd","transcript_path":"C:\\Users\\Jay\\.claude\\projects\\D--000-FrontEnd-242-dino-game\\1c1e8df6-335a-4058-8bd4-4c0a67d996cd.jsonl","cwd":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","model":{"id":"GLM-5","display_name":"GLM-5"},"workspace":{"current_dir":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","project_dir":"D:\\000.FrontEnd\\242.dino_game","added_dirs":[]},"version":"2.1.71","output_style":{"name":"default"},"cost":{"total_cost_usd":3.1387229999999997,"total_duration_ms":1800053,"total_api_duration_ms":890803,"total_lines_added":356,"total_lines_removed":168},"context_window":{"total_input_tokens":80855,"total_output_tokens":22864,"context_window_size":200000,"current_usage":{"input_tokens":137,"output_tokens":64,"cache_creation_input_tokens":0,"cache_read_input_tokens":86976},"used_percentage":44,"remaining_percentage":56},"exceeds_200k_tokens":false}
package/dist/cli.js CHANGED
@@ -27,137 +27,37 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var fs = __toESM(require("fs"));
28
28
  var path = __toESM(require("path"));
29
29
  var TEMPLATES = {
30
- "lib/aurabase.ts": `import { createClient } from 'aurabase-js';
30
+ "lib/client.ts": `import { createClient } from 'aurabase-js';
31
31
 
32
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
33
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
34
-
35
- export const aurabase = createClient({
36
- url: AURABASE_URL,
37
- anonKey: AURABASE_ANON_KEY,
32
+ export const client = createClient({
33
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
34
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
38
35
  });
39
36
  `,
40
- "lib/api-client.ts": `import { NextRequest, NextResponse } from 'next/server';
41
-
42
- const AURABASE_URL = process.env.AURABASE_URL || 'https://your-project.cloudfront.net';
43
- const AURABASE_ANON_KEY = process.env.AURABASE_ANON_KEY || '';
44
-
45
- /**
46
- * \uC11C\uBC84 \uC0AC\uC774\uB4DC API \uD504\uB85D\uC2DC \uC720\uD2F8\uB9AC\uD2F0
47
- * - \uB85C\uADF8\uC778\uB428: \uCFE0\uD0A4\uC758 access_token \uC0AC\uC6A9
48
- * - \uB85C\uADF8\uC778 \uC548 \uB428: AURABASE_ANON_KEY \uC0AC\uC6A9
49
- */
50
- export async function proxyApiRequest(
51
- req: NextRequest,
52
- path: string
53
- ): Promise<NextResponse> {
54
- const accessToken = req.cookies.get('access_token')?.value;
55
- const authToken = accessToken || AURABASE_ANON_KEY;
37
+ "lib/server.ts": `import { createClient } from 'aurabase-js';
38
+ import { cookies } from 'next/headers';
56
39
 
57
- let body: string | undefined;
58
- if (req.method !== 'GET' && req.method !== 'HEAD') {
59
- body = await req.text();
60
- }
61
-
62
- const headers: Record<string, string> = {
63
- 'Content-Type': 'application/json',
64
- };
65
- if (authToken) {
66
- headers['Authorization'] = \`Bearer \${authToken}\`;
67
- }
40
+ export async function server() {
41
+ const cookieStore = await cookies();
42
+ const accessToken = cookieStore.get('access_token')?.value;
68
43
 
69
- const fetchOptions: RequestInit = {
70
- method: req.method,
71
- headers,
72
- };
73
- if (body) {
74
- fetchOptions.body = body;
75
- }
76
-
77
- const res = await fetch(\`\${AURABASE_URL}\${path}\`, fetchOptions);
78
- const data = await res.text();
79
- return new NextResponse(data, {
80
- status: res.status,
81
- headers: { 'Content-Type': 'application/json' },
44
+ const client = createClient({
45
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
46
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
82
47
  });
83
- }
84
-
85
- /**
86
- * \uD074\uB77C\uC774\uC5B8\uD2B8\uC6A9 fetch \uB798\uD37C
87
- */
88
- export function createApiClient(baseUrl: string = '') {
89
- return {
90
- async get<T>(path: string): Promise<T> {
91
- const res = await fetch(\`\${baseUrl}\${path}\`, { credentials: 'include' });
92
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
93
- return res.json();
94
- },
95
-
96
- async post<T>(path: string, data?: unknown): Promise<T> {
97
- const options: RequestInit = {
98
- method: 'POST',
99
- headers: { 'Content-Type': 'application/json' },
100
- credentials: 'include',
101
- };
102
- if (data) options.body = JSON.stringify(data);
103
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
104
- if (!res.ok) {
105
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
106
- throw error;
107
- }
108
- return res.json();
109
- },
110
48
 
111
- async put<T>(path: string, data?: unknown): Promise<T> {
112
- const options: RequestInit = {
113
- method: 'PUT',
114
- headers: { 'Content-Type': 'application/json' },
115
- credentials: 'include',
116
- };
117
- if (data) options.body = JSON.stringify(data);
118
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
119
- if (!res.ok) {
120
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
121
- throw error;
122
- }
123
- return res.json();
124
- },
49
+ if (accessToken) {
50
+ client.setAccessToken(accessToken);
51
+ }
125
52
 
126
- async delete<T>(path: string): Promise<T> {
127
- const res = await fetch(\`\${baseUrl}\${path}\`, {
128
- method: 'DELETE',
129
- credentials: 'include',
130
- });
131
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
132
- return res.json();
133
- },
134
- };
53
+ return client;
135
54
  }
136
- `,
137
- "lib/supabase.ts": `import { createClient } from 'aurabase-js';
138
-
139
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
140
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
141
-
142
- export const supabase = createClient({
143
- url: AURABASE_URL,
144
- anonKey: AURABASE_ANON_KEY,
145
- });
146
-
147
- // Alias for backward compatibility
148
- export const aurabase = supabase;
149
55
  `
150
56
  };
151
57
  var ENV_TEMPLATE = `
152
58
  # AuraBase Configuration (.env.local)
153
-
154
- # \uD074\uB77C\uC774\uC5B8\uD2B8\uC6A9 (NEXT_PUBLIC_ \uD544\uC218)
155
59
  NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
156
60
  NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
157
-
158
- # \uC11C\uBC84 \uC0AC\uC774\uB4DC\uC6A9
159
- AURABASE_URL=https://your-project.cloudfront.net
160
- AURABASE_ANON_KEY=your-anon-key-here
161
61
  `;
162
62
  function findProjectRoot() {
163
63
  let dir = process.cwd();
@@ -191,8 +91,8 @@ function createFile(projectRoot, filename) {
191
91
  function init() {
192
92
  const projectRoot = findProjectRoot();
193
93
  console.log("\x1B[1m\n\u{1F680} Initializing AuraBase...\x1B[0m\n");
194
- createFile(projectRoot, "lib/aurabase.ts");
195
- createFile(projectRoot, "lib/api-client.ts");
94
+ createFile(projectRoot, "lib/client.ts");
95
+ createFile(projectRoot, "lib/server.ts");
196
96
  console.log("\x1B[36m%s\x1B[0m", ENV_TEMPLATE);
197
97
  }
198
98
  function showHelp() {
@@ -202,15 +102,13 @@ function showHelp() {
202
102
  \x1B[1mUsage:\x1B[0m
203
103
  npx aurabase-js init
204
104
 
205
- \x1B[1mCommands:\x1B[0m
206
- init Create lib/aurabase.ts and lib/api-client.ts
207
-
208
105
  \x1B[1mOptions:\x1B[0m
209
106
  -h, --help Show this help message
210
107
  -v, --version Show version
211
108
 
212
- \x1B[1mExamples:\x1B[0m
213
- npx aurabase-js init
109
+ \x1B[1mGenerated files:\x1B[0m
110
+ lib/client.ts Browser client
111
+ lib/server.ts Server client (with cookie auth)
214
112
  `);
215
113
  }
216
114
  function showVersion() {
package/dist/cli.mjs CHANGED
@@ -4,137 +4,37 @@
4
4
  import * as fs from "fs";
5
5
  import * as path from "path";
6
6
  var TEMPLATES = {
7
- "lib/aurabase.ts": `import { createClient } from 'aurabase-js';
7
+ "lib/client.ts": `import { createClient } from 'aurabase-js';
8
8
 
9
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
10
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
11
-
12
- export const aurabase = createClient({
13
- url: AURABASE_URL,
14
- anonKey: AURABASE_ANON_KEY,
9
+ export const client = createClient({
10
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
11
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
15
12
  });
16
13
  `,
17
- "lib/api-client.ts": `import { NextRequest, NextResponse } from 'next/server';
18
-
19
- const AURABASE_URL = process.env.AURABASE_URL || 'https://your-project.cloudfront.net';
20
- const AURABASE_ANON_KEY = process.env.AURABASE_ANON_KEY || '';
21
-
22
- /**
23
- * \uC11C\uBC84 \uC0AC\uC774\uB4DC API \uD504\uB85D\uC2DC \uC720\uD2F8\uB9AC\uD2F0
24
- * - \uB85C\uADF8\uC778\uB428: \uCFE0\uD0A4\uC758 access_token \uC0AC\uC6A9
25
- * - \uB85C\uADF8\uC778 \uC548 \uB428: AURABASE_ANON_KEY \uC0AC\uC6A9
26
- */
27
- export async function proxyApiRequest(
28
- req: NextRequest,
29
- path: string
30
- ): Promise<NextResponse> {
31
- const accessToken = req.cookies.get('access_token')?.value;
32
- const authToken = accessToken || AURABASE_ANON_KEY;
14
+ "lib/server.ts": `import { createClient } from 'aurabase-js';
15
+ import { cookies } from 'next/headers';
33
16
 
34
- let body: string | undefined;
35
- if (req.method !== 'GET' && req.method !== 'HEAD') {
36
- body = await req.text();
37
- }
38
-
39
- const headers: Record<string, string> = {
40
- 'Content-Type': 'application/json',
41
- };
42
- if (authToken) {
43
- headers['Authorization'] = \`Bearer \${authToken}\`;
44
- }
17
+ export async function server() {
18
+ const cookieStore = await cookies();
19
+ const accessToken = cookieStore.get('access_token')?.value;
45
20
 
46
- const fetchOptions: RequestInit = {
47
- method: req.method,
48
- headers,
49
- };
50
- if (body) {
51
- fetchOptions.body = body;
52
- }
53
-
54
- const res = await fetch(\`\${AURABASE_URL}\${path}\`, fetchOptions);
55
- const data = await res.text();
56
- return new NextResponse(data, {
57
- status: res.status,
58
- headers: { 'Content-Type': 'application/json' },
21
+ const client = createClient({
22
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
23
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
59
24
  });
60
- }
61
-
62
- /**
63
- * \uD074\uB77C\uC774\uC5B8\uD2B8\uC6A9 fetch \uB798\uD37C
64
- */
65
- export function createApiClient(baseUrl: string = '') {
66
- return {
67
- async get<T>(path: string): Promise<T> {
68
- const res = await fetch(\`\${baseUrl}\${path}\`, { credentials: 'include' });
69
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
70
- return res.json();
71
- },
72
-
73
- async post<T>(path: string, data?: unknown): Promise<T> {
74
- const options: RequestInit = {
75
- method: 'POST',
76
- headers: { 'Content-Type': 'application/json' },
77
- credentials: 'include',
78
- };
79
- if (data) options.body = JSON.stringify(data);
80
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
81
- if (!res.ok) {
82
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
83
- throw error;
84
- }
85
- return res.json();
86
- },
87
25
 
88
- async put<T>(path: string, data?: unknown): Promise<T> {
89
- const options: RequestInit = {
90
- method: 'PUT',
91
- headers: { 'Content-Type': 'application/json' },
92
- credentials: 'include',
93
- };
94
- if (data) options.body = JSON.stringify(data);
95
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
96
- if (!res.ok) {
97
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
98
- throw error;
99
- }
100
- return res.json();
101
- },
26
+ if (accessToken) {
27
+ client.setAccessToken(accessToken);
28
+ }
102
29
 
103
- async delete<T>(path: string): Promise<T> {
104
- const res = await fetch(\`\${baseUrl}\${path}\`, {
105
- method: 'DELETE',
106
- credentials: 'include',
107
- });
108
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
109
- return res.json();
110
- },
111
- };
30
+ return client;
112
31
  }
113
- `,
114
- "lib/supabase.ts": `import { createClient } from 'aurabase-js';
115
-
116
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
117
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
118
-
119
- export const supabase = createClient({
120
- url: AURABASE_URL,
121
- anonKey: AURABASE_ANON_KEY,
122
- });
123
-
124
- // Alias for backward compatibility
125
- export const aurabase = supabase;
126
32
  `
127
33
  };
128
34
  var ENV_TEMPLATE = `
129
35
  # AuraBase Configuration (.env.local)
130
-
131
- # \uD074\uB77C\uC774\uC5B8\uD2B8\uC6A9 (NEXT_PUBLIC_ \uD544\uC218)
132
36
  NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
133
37
  NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
134
-
135
- # \uC11C\uBC84 \uC0AC\uC774\uB4DC\uC6A9
136
- AURABASE_URL=https://your-project.cloudfront.net
137
- AURABASE_ANON_KEY=your-anon-key-here
138
38
  `;
139
39
  function findProjectRoot() {
140
40
  let dir = process.cwd();
@@ -168,8 +68,8 @@ function createFile(projectRoot, filename) {
168
68
  function init() {
169
69
  const projectRoot = findProjectRoot();
170
70
  console.log("\x1B[1m\n\u{1F680} Initializing AuraBase...\x1B[0m\n");
171
- createFile(projectRoot, "lib/aurabase.ts");
172
- createFile(projectRoot, "lib/api-client.ts");
71
+ createFile(projectRoot, "lib/client.ts");
72
+ createFile(projectRoot, "lib/server.ts");
173
73
  console.log("\x1B[36m%s\x1B[0m", ENV_TEMPLATE);
174
74
  }
175
75
  function showHelp() {
@@ -179,15 +79,13 @@ function showHelp() {
179
79
  \x1B[1mUsage:\x1B[0m
180
80
  npx aurabase-js init
181
81
 
182
- \x1B[1mCommands:\x1B[0m
183
- init Create lib/aurabase.ts and lib/api-client.ts
184
-
185
82
  \x1B[1mOptions:\x1B[0m
186
83
  -h, --help Show this help message
187
84
  -v, --version Show version
188
85
 
189
- \x1B[1mExamples:\x1B[0m
190
- npx aurabase-js init
86
+ \x1B[1mGenerated files:\x1B[0m
87
+ lib/client.ts Browser client
88
+ lib/server.ts Server client (with cookie auth)
191
89
  `);
192
90
  }
193
91
  function showVersion() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aurabase-js",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "AuraBase client library - Supabase-style SDK for AuraBase",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/cli.ts CHANGED
@@ -4,138 +4,38 @@ import * as fs from 'fs';
4
4
  import * as path from 'path';
5
5
 
6
6
  const TEMPLATES = {
7
- 'lib/aurabase.ts': `import { createClient } from 'aurabase-js';
7
+ 'lib/client.ts': `import { createClient } from 'aurabase-js';
8
8
 
9
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
10
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
11
-
12
- export const aurabase = createClient({
13
- url: AURABASE_URL,
14
- anonKey: AURABASE_ANON_KEY,
9
+ export const client = createClient({
10
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
11
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
15
12
  });
16
13
  `,
17
- 'lib/api-client.ts': `import { NextRequest, NextResponse } from 'next/server';
18
-
19
- const AURABASE_URL = process.env.AURABASE_URL || 'https://your-project.cloudfront.net';
20
- const AURABASE_ANON_KEY = process.env.AURABASE_ANON_KEY || '';
21
-
22
- /**
23
- * 서버 사이드 API 프록시 유틸리티
24
- * - 로그인됨: 쿠키의 access_token 사용
25
- * - 로그인 안 됨: AURABASE_ANON_KEY 사용
26
- */
27
- export async function proxyApiRequest(
28
- req: NextRequest,
29
- path: string
30
- ): Promise<NextResponse> {
31
- const accessToken = req.cookies.get('access_token')?.value;
32
- const authToken = accessToken || AURABASE_ANON_KEY;
33
-
34
- let body: string | undefined;
35
- if (req.method !== 'GET' && req.method !== 'HEAD') {
36
- body = await req.text();
37
- }
14
+ 'lib/server.ts': `import { createClient } from 'aurabase-js';
15
+ import { cookies } from 'next/headers';
38
16
 
39
- const headers: Record<string, string> = {
40
- 'Content-Type': 'application/json',
41
- };
42
- if (authToken) {
43
- headers['Authorization'] = \`Bearer \${authToken}\`;
44
- }
45
-
46
- const fetchOptions: RequestInit = {
47
- method: req.method,
48
- headers,
49
- };
50
- if (body) {
51
- fetchOptions.body = body;
52
- }
17
+ export async function server() {
18
+ const cookieStore = await cookies();
19
+ const accessToken = cookieStore.get('access_token')?.value;
53
20
 
54
- const res = await fetch(\`\${AURABASE_URL}\${path}\`, fetchOptions);
55
- const data = await res.text();
56
- return new NextResponse(data, {
57
- status: res.status,
58
- headers: { 'Content-Type': 'application/json' },
21
+ const client = createClient({
22
+ url: process.env.NEXT_PUBLIC_AURABASE_URL || '',
23
+ anonKey: process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '',
59
24
  });
60
- }
61
-
62
- /**
63
- * 클라이언트용 fetch 래퍼
64
- */
65
- export function createApiClient(baseUrl: string = '') {
66
- return {
67
- async get<T>(path: string): Promise<T> {
68
- const res = await fetch(\`\${baseUrl}\${path}\`, { credentials: 'include' });
69
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
70
- return res.json();
71
- },
72
-
73
- async post<T>(path: string, data?: unknown): Promise<T> {
74
- const options: RequestInit = {
75
- method: 'POST',
76
- headers: { 'Content-Type': 'application/json' },
77
- credentials: 'include',
78
- };
79
- if (data) options.body = JSON.stringify(data);
80
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
81
- if (!res.ok) {
82
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
83
- throw error;
84
- }
85
- return res.json();
86
- },
87
-
88
- async put<T>(path: string, data?: unknown): Promise<T> {
89
- const options: RequestInit = {
90
- method: 'PUT',
91
- headers: { 'Content-Type': 'application/json' },
92
- credentials: 'include',
93
- };
94
- if (data) options.body = JSON.stringify(data);
95
- const res = await fetch(\`\${baseUrl}\${path}\`, options);
96
- if (!res.ok) {
97
- const error = await res.json().catch(() => ({ error: 'Unknown error' }));
98
- throw error;
99
- }
100
- return res.json();
101
- },
102
-
103
- async delete<T>(path: string): Promise<T> {
104
- const res = await fetch(\`\${baseUrl}\${path}\`, {
105
- method: 'DELETE',
106
- credentials: 'include',
107
- });
108
- if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
109
- return res.json();
110
- },
111
- };
112
- }
113
- `,
114
- 'lib/supabase.ts': `import { createClient } from 'aurabase-js';
115
25
 
116
- const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
117
- const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
118
-
119
- export const supabase = createClient({
120
- url: AURABASE_URL,
121
- anonKey: AURABASE_ANON_KEY,
122
- });
26
+ if (accessToken) {
27
+ client.setAccessToken(accessToken);
28
+ }
123
29
 
124
- // Alias for backward compatibility
125
- export const aurabase = supabase;
30
+ return client;
31
+ }
126
32
  `,
127
33
  };
128
34
 
129
35
  const ENV_TEMPLATE = `
130
36
  # AuraBase Configuration (.env.local)
131
-
132
- # 클라이언트용 (NEXT_PUBLIC_ 필수)
133
37
  NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
134
38
  NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
135
-
136
- # 서버 사이드용
137
- AURABASE_URL=https://your-project.cloudfront.net
138
- AURABASE_ANON_KEY=your-anon-key-here
139
39
  `;
140
40
 
141
41
  function findProjectRoot(): string {
@@ -178,11 +78,9 @@ function init() {
178
78
 
179
79
  console.log('\x1b[1m\n🚀 Initializing AuraBase...\x1b[0m\n');
180
80
 
181
- // Create all files
182
- createFile(projectRoot, 'lib/aurabase.ts');
183
- createFile(projectRoot, 'lib/api-client.ts');
81
+ createFile(projectRoot, 'lib/client.ts');
82
+ createFile(projectRoot, 'lib/server.ts');
184
83
 
185
- // Show env template
186
84
  console.log('\x1b[36m%s\x1b[0m', ENV_TEMPLATE);
187
85
  }
188
86
 
@@ -193,15 +91,13 @@ function showHelp() {
193
91
  \x1b[1mUsage:\x1b[0m
194
92
  npx aurabase-js init
195
93
 
196
- \x1b[1mCommands:\x1b[0m
197
- init Create lib/aurabase.ts and lib/api-client.ts
198
-
199
94
  \x1b[1mOptions:\x1b[0m
200
95
  -h, --help Show this help message
201
96
  -v, --version Show version
202
97
 
203
- \x1b[1mExamples:\x1b[0m
204
- npx aurabase-js init
98
+ \x1b[1mGenerated files:\x1b[0m
99
+ lib/client.ts Browser client
100
+ lib/server.ts Server client (with cookie auth)
205
101
  `);
206
102
  }
207
103