swiftbase-admin-sdk 1.0.1 → 1.0.3

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/index.js CHANGED
@@ -225,9 +225,6 @@ var init_login = __esm({
225
225
  body.append("client_secret", secretKey);
226
226
  body.append("scope", "openid profile email");
227
227
  let base = app.baseUrl || "https://api.swiftbase.io";
228
- if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
229
- base = base.replace("api.swiftbase", "identity.swiftbase");
230
- }
231
228
  const url = `${base}/oauth2/token`;
232
229
  const response = yield fetch(url, {
233
230
  method: "POST",
@@ -3869,15 +3866,6 @@ var makeRequest = (method, path, params, body) => __async(null, null, function*
3869
3866
  headers["Authorization"] = `Bearer ${app.accessToken.value()}`;
3870
3867
  }
3871
3868
  let base = app.baseUrl || "https://api.swiftbase.io";
3872
- if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
3873
- if (path.includes("/db/") || path.includes("/database") || path.includes("/tables") || path.includes("/sql") || path.includes("/queries")) {
3874
- base = base.replace("api.swiftbase", "database.swiftbase");
3875
- } else if (path.includes("/oauth2") || path.includes("/login") || path.includes("/api/roles") || path.includes("/api/services") || path.includes("/api/users") || path.includes("/api/me")) {
3876
- base = base.replace("api.swiftbase", "identity.swiftbase");
3877
- } else {
3878
- base = base.replace("api.swiftbase", "app.swiftbase");
3879
- }
3880
- }
3881
3869
  let url = path.startsWith("http") ? path : `${base}${!path.startsWith("/") ? "/" : ""}${path}`;
3882
3870
  if (params) {
3883
3871
  const query = new URLSearchParams();
@@ -3947,9 +3935,6 @@ var verifyToken = (token) => __async(null, null, function* () {
3947
3935
  "Authorization": `Bearer ${token}`
3948
3936
  };
3949
3937
  let base = app.baseUrl || "https://api.swiftbase.io";
3950
- if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
3951
- base = base.replace("api.swiftbase", "identity.swiftbase");
3952
- }
3953
3938
  const response = yield fetch(`${base}/api/me`, { headers });
3954
3939
  if (!response.ok) {
3955
3940
  throw new Error(`Token verification failed: ${response.status}`);
@@ -3961,9 +3946,6 @@ var verifyToken = (token) => __async(null, null, function* () {
3961
3946
  init_app();
3962
3947
  var verifyServiceToken = (token, scope) => __async(null, null, function* () {
3963
3948
  let base = app.baseUrl || "https://api.swiftbase.io";
3964
- if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
3965
- base = base.replace("api.swiftbase", "identity.swiftbase");
3966
- }
3967
3949
  const url = `${base}/api/verify-service-token`;
3968
3950
  const response = yield fetch(url, {
3969
3951
  method: "POST",
@@ -4384,15 +4366,6 @@ function db(dbName) {
4384
4366
  }
4385
4367
  const databaseId = myDb.id;
4386
4368
  const schemaName = dbName.toLowerCase().replace(/[^a-z0-9_]/g, "_");
4387
- try {
4388
- yield makeRequest("post" /* POST */, "/api/sql", void 0, {
4389
- databaseId,
4390
- sql: `CREATE SCHEMA IF NOT EXISTS "${schemaName}"`
4391
- });
4392
- } catch (err) {
4393
- console.error("[DatabaseInit] Failed to create schema:", err.message);
4394
- throw err;
4395
- }
4396
4369
  let existingTables = [];
4397
4370
  try {
4398
4371
  existingTables = yield makeRequest("get" /* GET */, "/api/tables", { databaseId });
@@ -4590,10 +4563,7 @@ function signS3Request(options) {
4590
4563
  // src/storage/storage.ts
4591
4564
  function getDefaultEndpoint() {
4592
4565
  const base = app.baseUrl || "https://api.swiftbase.io";
4593
- if (base.includes("localhost") || base.includes("127.0.0.1")) {
4594
- return "http://localhost:3006";
4595
- }
4596
- return base.replace("api.swiftbase", "storage.swiftbase");
4566
+ return base + "/storage";
4597
4567
  }
4598
4568
  function parseListBuckets(xml) {
4599
4569
  const buckets = [];