swiftbase-admin-sdk 1.0.2 → 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.cjs +1 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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",
|
|
@@ -4581,10 +4563,7 @@ function signS3Request(options) {
|
|
|
4581
4563
|
// src/storage/storage.ts
|
|
4582
4564
|
function getDefaultEndpoint() {
|
|
4583
4565
|
const base = app.baseUrl || "https://api.swiftbase.io";
|
|
4584
|
-
|
|
4585
|
-
return "http://localhost:3006";
|
|
4586
|
-
}
|
|
4587
|
-
return base.replace("api.swiftbase", "storage.swiftbase");
|
|
4566
|
+
return base + "/storage";
|
|
4588
4567
|
}
|
|
4589
4568
|
function parseListBuckets(xml) {
|
|
4590
4569
|
const buckets = [];
|