swiftbase-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.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3616,6 +3616,7 @@ __export(index_exports, {
|
|
|
3616
3616
|
logout: () => logout,
|
|
3617
3617
|
refreshTokens: () => refreshTokens,
|
|
3618
3618
|
resetPassword: () => resetPassword,
|
|
3619
|
+
search: () => search,
|
|
3619
3620
|
setAccessToken: () => setAccessToken,
|
|
3620
3621
|
setRefreshToken: () => setRefreshToken,
|
|
3621
3622
|
unassignRole: () => unassignRole,
|
|
@@ -3731,6 +3732,7 @@ var initializeSdk = (projectId, options) => {
|
|
|
3731
3732
|
authority: app.baseUrl,
|
|
3732
3733
|
client_id: app.projectId,
|
|
3733
3734
|
redirect_uri: window.location.origin,
|
|
3735
|
+
post_logout_redirect_uri: window.location.origin,
|
|
3734
3736
|
response_type: "code",
|
|
3735
3737
|
scope: "openid profile email",
|
|
3736
3738
|
userStore: new import_oidc_client_ts.WebStorageStateStore({ store: window.sessionStorage }),
|
|
@@ -4139,7 +4141,10 @@ var _DatabaseSocketManager = class _DatabaseSocketManager {
|
|
|
4139
4141
|
return _DatabaseSocketManager.instance;
|
|
4140
4142
|
}
|
|
4141
4143
|
isWebSocketAvailable() {
|
|
4142
|
-
|
|
4144
|
+
if (typeof window === "undefined") {
|
|
4145
|
+
return false;
|
|
4146
|
+
}
|
|
4147
|
+
return this.socket !== null && this.socket.readyState === 1;
|
|
4143
4148
|
}
|
|
4144
4149
|
getWebSocketUrl(baseUrl, token) {
|
|
4145
4150
|
let wsUrl = baseUrl.replace(/^http/, "ws");
|
|
@@ -4407,6 +4412,10 @@ var QueryBuilder = class {
|
|
|
4407
4412
|
} catch (err) {
|
|
4408
4413
|
console.warn("[QueryBuilder] WebSocket execution failed, falling back to REST:", err);
|
|
4409
4414
|
}
|
|
4415
|
+
} else if (typeof window !== "undefined") {
|
|
4416
|
+
socketManager.ensureConnected().catch((err) => {
|
|
4417
|
+
console.warn("[QueryBuilder] Background WebSocket connection failed:", err);
|
|
4418
|
+
});
|
|
4410
4419
|
}
|
|
4411
4420
|
return yield makeRequest("post" /* POST */, "/api/db/query", void 0, this.payload);
|
|
4412
4421
|
});
|
|
@@ -4421,6 +4430,22 @@ function db(dbName) {
|
|
|
4421
4430
|
};
|
|
4422
4431
|
}
|
|
4423
4432
|
|
|
4433
|
+
// src/database/search.ts
|
|
4434
|
+
function search(indexId, query) {
|
|
4435
|
+
return __async(this, null, function* () {
|
|
4436
|
+
if (!indexId || !query) {
|
|
4437
|
+
throw new Error("indexId and query are required to perform a search");
|
|
4438
|
+
}
|
|
4439
|
+
const result = yield makeRequest(
|
|
4440
|
+
"post" /* POST */,
|
|
4441
|
+
"/api/search/query",
|
|
4442
|
+
void 0,
|
|
4443
|
+
{ indexId, query }
|
|
4444
|
+
);
|
|
4445
|
+
return result || [];
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4424
4449
|
// src/storage/sigv4.ts
|
|
4425
4450
|
function stringToUint8Array(str) {
|
|
4426
4451
|
return new TextEncoder().encode(str);
|
|
@@ -4767,6 +4792,7 @@ var Storage = class {
|
|
|
4767
4792
|
logout,
|
|
4768
4793
|
refreshTokens,
|
|
4769
4794
|
resetPassword,
|
|
4795
|
+
search,
|
|
4770
4796
|
setAccessToken,
|
|
4771
4797
|
setRefreshToken,
|
|
4772
4798
|
unassignRole,
|