@fileverse/api 0.0.17 → 0.0.19

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/dist/cli/index.js CHANGED
@@ -369,6 +369,7 @@ var init_file_utils = __esm({
369
369
  // src/sdk/file-manager.ts
370
370
  import { fromUint8Array as fromUint8Array2, toUint8Array as toUint8Array4 } from "js-base64";
371
371
  import { generateAESKey, exportAESKey } from "@fileverse/crypto/webcrypto";
372
+ import { markdownToYjs } from "@fileverse/content-processor";
372
373
  var init_file_manager = __esm({
373
374
  "src/sdk/file-manager.ts"() {
374
375
  "use strict";
@@ -1191,30 +1192,17 @@ import { Command } from "commander";
1191
1192
  // src/cli/fetch-api-key.ts
1192
1193
  init_esm_shims();
1193
1194
  init_constants();
1194
- import axios from "axios";
1195
1195
  import { toUint8Array } from "js-base64";
1196
1196
  import { sha256 } from "viem";
1197
1197
  var fetchApiKeyData = async (apiKey) => {
1198
1198
  try {
1199
1199
  const keyHash = sha256(toUint8Array(apiKey));
1200
1200
  const fullUrl = BASE_CONFIG.API_URL + `api-access/${keyHash}`;
1201
- const response = await axios.get(fullUrl);
1202
- const { encryptedKeyMaterial, encryptedAppMaterial, id } = response.data;
1201
+ const response = await fetch(fullUrl);
1202
+ const { encryptedKeyMaterial, encryptedAppMaterial, id } = await response.json();
1203
1203
  return { encryptedKeyMaterial, encryptedAppMaterial, id };
1204
1204
  } catch (error) {
1205
- if (axios.isAxiosError(error)) {
1206
- if (error.response?.status === 401) {
1207
- throw new Error("Invalid API key");
1208
- }
1209
- if (error.response?.status === 404) {
1210
- throw new Error("API key not found");
1211
- }
1212
- if (error.code === "ECONNREFUSED") {
1213
- throw new Error(`Cannot connect to server at ${BASE_CONFIG.API_URL}`);
1214
- }
1215
- throw new Error(`Server error: ${error.response?.data?.message || error.message}`);
1216
- }
1217
- throw error;
1205
+ throw new Error(`Server error: ${error.message}`);
1218
1206
  }
1219
1207
  };
1220
1208