From cc3ccd041d4b3e7de69506fea19e520f07ef9554 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 7 Aug 2024 15:20:45 +0500 Subject: [PATCH] core: add function for checking compability with server --- packages/core/src/index.ts | 1 + packages/core/src/utils/constants.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 351e6a417..1fc654351 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -32,3 +32,4 @@ export { type TextSlice } from "./utils/content-block"; export { type DatabaseUpdatedEvent } from "./database"; +export { isServerCompatible } from "./utils/constants"; diff --git a/packages/core/src/utils/constants.ts b/packages/core/src/utils/constants.ts index 1533c1aea..eb9a6352c 100644 --- a/packages/core/src/utils/constants.ts +++ b/packages/core/src/utils/constants.ts @@ -19,6 +19,12 @@ along with this program. If not, see . import { extractHostname } from "./hostname"; +const COMPATIBLE_SERVER_VERSION = 1; + +export function isServerCompatible(version: number) { + return COMPATIBLE_SERVER_VERSION === version; +} + function isProduction() { return ( process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test"