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.cjs
CHANGED
|
@@ -221,9 +221,6 @@ var init_login = __esm({
|
|
|
221
221
|
body.append("client_secret", secretKey);
|
|
222
222
|
body.append("scope", "openid profile email");
|
|
223
223
|
let base = app.baseUrl || "https://api.swiftbase.io";
|
|
224
|
-
if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
|
|
225
|
-
base = base.replace("api.swiftbase", "identity.swiftbase");
|
|
226
|
-
}
|
|
227
224
|
const url = `${base}/oauth2/token`;
|
|
228
225
|
const response = yield fetch(url, {
|
|
229
226
|
method: "POST",
|
|
@@ -3901,15 +3898,6 @@ var makeRequest = (method, path, params, body) => __async(null, null, function*
|
|
|
3901
3898
|
headers["Authorization"] = `Bearer ${app.accessToken.value()}`;
|
|
3902
3899
|
}
|
|
3903
3900
|
let base = app.baseUrl || "https://api.swiftbase.io";
|
|
3904
|
-
if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
|
|
3905
|
-
if (path.includes("/db/") || path.includes("/database") || path.includes("/tables") || path.includes("/sql") || path.includes("/queries")) {
|
|
3906
|
-
base = base.replace("api.swiftbase", "database.swiftbase");
|
|
3907
|
-
} else if (path.includes("/oauth2") || path.includes("/login") || path.includes("/api/roles") || path.includes("/api/services") || path.includes("/api/users") || path.includes("/api/me")) {
|
|
3908
|
-
base = base.replace("api.swiftbase", "identity.swiftbase");
|
|
3909
|
-
} else {
|
|
3910
|
-
base = base.replace("api.swiftbase", "app.swiftbase");
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
3901
|
let url = path.startsWith("http") ? path : `${base}${!path.startsWith("/") ? "/" : ""}${path}`;
|
|
3914
3902
|
if (params) {
|
|
3915
3903
|
const query = new URLSearchParams();
|
|
@@ -3979,9 +3967,6 @@ var verifyToken = (token) => __async(null, null, function* () {
|
|
|
3979
3967
|
"Authorization": `Bearer ${token}`
|
|
3980
3968
|
};
|
|
3981
3969
|
let base = app.baseUrl || "https://api.swiftbase.io";
|
|
3982
|
-
if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
|
|
3983
|
-
base = base.replace("api.swiftbase", "identity.swiftbase");
|
|
3984
|
-
}
|
|
3985
3970
|
const response = yield fetch(`${base}/api/me`, { headers });
|
|
3986
3971
|
if (!response.ok) {
|
|
3987
3972
|
throw new Error(`Token verification failed: ${response.status}`);
|
|
@@ -3993,9 +3978,6 @@ var verifyToken = (token) => __async(null, null, function* () {
|
|
|
3993
3978
|
init_app();
|
|
3994
3979
|
var verifyServiceToken = (token, scope) => __async(null, null, function* () {
|
|
3995
3980
|
let base = app.baseUrl || "https://api.swiftbase.io";
|
|
3996
|
-
if (!base.includes("localhost") && !base.includes("127.0.0.1")) {
|
|
3997
|
-
base = base.replace("api.swiftbase", "identity.swiftbase");
|
|
3998
|
-
}
|
|
3999
3981
|
const url = `${base}/api/verify-service-token`;
|
|
4000
3982
|
const response = yield fetch(url, {
|
|
4001
3983
|
method: "POST",
|
|
@@ -4613,10 +4595,7 @@ function signS3Request(options) {
|
|
|
4613
4595
|
// src/storage/storage.ts
|
|
4614
4596
|
function getDefaultEndpoint() {
|
|
4615
4597
|
const base = app.baseUrl || "https://api.swiftbase.io";
|
|
4616
|
-
|
|
4617
|
-
return "http://localhost:3006";
|
|
4618
|
-
}
|
|
4619
|
-
return base.replace("api.swiftbase", "storage.swiftbase");
|
|
4598
|
+
return base + "/storage";
|
|
4620
4599
|
}
|
|
4621
4600
|
function parseListBuckets(xml) {
|
|
4622
4601
|
const buckets = [];
|