realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

RJS-2732: Support updating the `App`'s base URL via experimental export #6518

Closed elle-j closed 2 weeks ago

elle-j commented 2 months ago

What, How & Why?

Experimental exports/imports

Base URL

TSConfig / Choosing module resolution

{
  "compilerOptions": {
    "target": "es2022",
    "module": "node16",
    "moduleResolution": "node16",
    // ...
  }
}

Example Usage

import { App } from "realm";
import "realm/experimental/base-url";

async function exampleFunction() {
  const app = new App("my-atlas-app-id");

  // Get the currently used base URL.
  const currentBaseUrl = app.baseUrl;

  // Update the base URL.
  await app.updateBaseUrl("https://my-new-url.com");

  // Reset it to the default one.
  await app.updateBaseUrl(null);
}

This closes #6486

☑️ ToDos

elle-j commented 3 weeks ago

Just reviving the old draft implementation then I'll be modifying the test and adding some more 🙂

elle-j commented 2 weeks ago

@kneth, for the final review there are only minor changes to look at:

Still missing: