@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 +4 -16
- package/dist/cli/index.js.map +1 -1
- package/dist/cloudflare.js +46 -66
- package/dist/cloudflare.js.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/index.js +46 -66
- package/dist/index.js.map +1 -1
- package/dist/worker.js +43 -50
- package/dist/worker.js.map +1 -1
- package/package.json +1 -2
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
|
|
1202
|
-
const { encryptedKeyMaterial, encryptedAppMaterial, id } = response.
|
|
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
|
-
|
|
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
|
|