connectbase-client 0.1.14 → 0.1.15

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.
Files changed (2) hide show
  1. package/dist/cli.js +56 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -295,10 +295,62 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
295
295
  error("API Key\uB294 \uD544\uC218\uC785\uB2C8\uB2E4");
296
296
  process.exit(1);
297
297
  }
298
- const storageId = await prompt(`${colors.blue}?${colors.reset} Storage ID: `);
299
- if (!storageId) {
300
- error("Storage ID\uB294 \uD544\uC218\uC785\uB2C8\uB2E4");
301
- process.exit(1);
298
+ let storageId = "";
299
+ try {
300
+ info("\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC870\uD68C \uC911...");
301
+ const listRes = await makeRequest(
302
+ `${DEFAULT_BASE_URL}/v1/public/storages/webs`,
303
+ "GET",
304
+ { "X-API-Key": apiKey }
305
+ );
306
+ if (listRes.status !== 200) {
307
+ error(`API Key \uC778\uC99D \uC2E4\uD328 (${listRes.status})`);
308
+ process.exit(1);
309
+ }
310
+ const listData = listRes.data;
311
+ const storages = listData.storages || [];
312
+ if (storages.length > 0) {
313
+ log(`
314
+ ${colors.dim}\uAE30\uC874 \uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0:${colors.reset}`);
315
+ storages.forEach((s, i) => {
316
+ log(` ${colors.cyan}${i + 1}${colors.reset}) ${s.name} (${colors.dim}${s.id}${colors.reset})`);
317
+ });
318
+ log(` ${colors.cyan}0${colors.reset}) \uC0C8\uB85C \uC0DD\uC131`);
319
+ const choice = await prompt(`
320
+ ${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
321
+ const num = parseInt(choice, 10);
322
+ if (num > 0 && num <= storages.length) {
323
+ storageId = storages[num - 1].id;
324
+ success(`\uC120\uD0DD\uB428: ${storages[num - 1].name}`);
325
+ }
326
+ }
327
+ if (!storageId) {
328
+ const projectName = path.basename(process.cwd());
329
+ const name = await prompt(`${colors.blue}?${colors.reset} \uC2A4\uD1A0\uB9AC\uC9C0 \uC774\uB984 (${projectName}): `) || projectName;
330
+ info("\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC0DD\uC131 \uC911...");
331
+ const createRes = await makeRequest(
332
+ `${DEFAULT_BASE_URL}/v1/public/storages/webs`,
333
+ "POST",
334
+ { "X-API-Key": apiKey },
335
+ JSON.stringify({ name })
336
+ );
337
+ if (createRes.status !== 200) {
338
+ const data = createRes.data;
339
+ error(`\uC0DD\uC131 \uC2E4\uD328: ${data?.error || data?.message || `HTTP ${createRes.status}`}`);
340
+ process.exit(1);
341
+ }
342
+ const createData = createRes.data;
343
+ storageId = createData.storage_web_id;
344
+ success(`\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC0DD\uC131 \uC644\uB8CC: ${createData.name}`);
345
+ }
346
+ } catch (err) {
347
+ error(`\uB124\uD2B8\uC6CC\uD06C \uC624\uB958: ${err instanceof Error ? err.message : err}`);
348
+ log(`${colors.dim}\uC218\uB3D9\uC73C\uB85C Storage ID\uB97C \uC785\uB825\uD558\uC138\uC694${colors.reset}`);
349
+ storageId = await prompt(`${colors.blue}?${colors.reset} Storage ID: `);
350
+ if (!storageId) {
351
+ error("Storage ID\uB294 \uD544\uC218\uC785\uB2C8\uB2E4");
352
+ process.exit(1);
353
+ }
302
354
  }
303
355
  const defaultDir = detectBuildDir();
304
356
  const deployDir = await prompt(`${colors.blue}?${colors.reset} \uBC30\uD3EC \uB514\uB809\uD1A0\uB9AC (${defaultDir}): `) || defaultDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",