Merge pull request #50 from codex-storage/releases/v0.0.5

Releases/v0.0.5
This commit is contained in:
Arnaud 2024-10-14 18:56:08 +02:00 committed by GitHub
commit 2a68573eb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 54 deletions

View File

@ -15,7 +15,7 @@ import * as Sentry from "@sentry/react";
import { CodexSdk } from "./sdk/codex";
import { ErrorPlaceholder } from "./components/ErrorPlaceholder/ErrorPlaceholder.tsx";
if (import.meta.env.PROD) {
if (import.meta.env.PROD && !import.meta.env.CI) {
Sentry.init({
release: "codex-storage-marketplace-ui@" + import.meta.env.PACKAGE_VERSION,
dsn: "https://22d77c59a27b8d5efc07132188b505b9@o4507855852011520.ingest.de.sentry.io/4507866758512720",

View File

@ -3,7 +3,6 @@ import {
CodexData,
CodexDataResponse,
CodexMarketplace,
CodexReservation,
SafeValue,
UploadResponse,
} from "@codex-storage/sdk-js";
@ -143,39 +142,39 @@ class CodexMarketplaceMock extends CodexMarketplace {
// },
// });
// }
override reservations(): Promise<SafeValue<CodexReservation[]>> {
return Promise.resolve({
error: false,
data: [
{
id: "0x123456789",
availabilityId: "0x12345678910",
requestId: "0x1234567891011",
/**
* Size in bytes
*/
size: 500_000_000 + "",
/**
* Slot Index as hexadecimal string
*/
slotIndex: "2",
},
{
id: "0x987654321",
availabilityId: "0x9876543210",
requestId: "0x98765432100",
/**
* Size in bytes
*/
size: 500_000_000 + "",
/**
* Slot Index as hexadecimal string
*/
slotIndex: "1",
},
],
});
}
// override reservations(): Promise<SafeValue<CodexReservation[]>> {
// return Promise.resolve({
// error: false,
// data: [
// {
// id: "0x123456789",
// availabilityId: "0x12345678910",
// requestId: "0x1234567891011",
// /**
// * Size in bytes
// */
// size: 500_000_000 + "",
// /**
// * Slot Index as hexadecimal string
// */
// slotIndex: "2",
// },
// {
// id: "0x987654321",
// availabilityId: "0x9876543210",
// requestId: "0x98765432100",
// /**
// * Size in bytes
// */
// size: 500_000_000 + "",
// /**
// * Slot Index as hexadecimal string
// */
// slotIndex: "1",
// },
// ],
// });
// }
}
export const CodexSdk = {

View File

@ -1,32 +1,18 @@
import * as Sentry from "@sentry/browser";
import { isCodexOnline } from "../components/NodeIndicator/NodeIndicator";
import { CodexError } from "@codex-storage/sdk-js";
// It would be preferable to completely ignore the error
// when the node is not connected. However, during the
// initial load, we lack this information until the
// SPR response is completed. In the meantime, other
// requests may be initiated, so if the node is not
// connected, we should set the level to 'log'.
const getLogLevel = () => {
switch (isCodexOnline) {
case true:
return "error";
case null:
return "info";
case false:
return "log";
}
};
export const Errors = {
report(safe: { error: true, data: CodexError }) {
if (safe.data.code === 502) {
// Ignore Gateway error
return
}
Sentry.captureException(safe.data, {
extra: {
code: safe.data.code,
errors: safe.data.errors,
sourceStack: safe.data.sourceStack,
level: getLogLevel(),
},
});
}

1
src/vite-env.d.ts vendored
View File

@ -2,6 +2,7 @@
interface ImportMetaEnv {
VITE_CODEX_API_URL: string;
VITE_GEO_IP_URL: string;
}
interface ImportMeta {