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.d.cts
CHANGED
|
@@ -244,6 +244,8 @@ declare class QueryBuilder implements PromiseLike<any> {
|
|
|
244
244
|
}
|
|
245
245
|
declare function db(dbName: string): (tableName: string) => QueryBuilder;
|
|
246
246
|
|
|
247
|
+
declare function search(indexId: string, query: string): Promise<any[]>;
|
|
248
|
+
|
|
247
249
|
interface StorageOptions {
|
|
248
250
|
bucket: string;
|
|
249
251
|
endpoint?: string;
|
|
@@ -293,4 +295,4 @@ declare class Storage {
|
|
|
293
295
|
deleteObject(key: string): Promise<void>;
|
|
294
296
|
}
|
|
295
297
|
|
|
296
|
-
export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
|
|
298
|
+
export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -244,6 +244,8 @@ declare class QueryBuilder implements PromiseLike<any> {
|
|
|
244
244
|
}
|
|
245
245
|
declare function db(dbName: string): (tableName: string) => QueryBuilder;
|
|
246
246
|
|
|
247
|
+
declare function search(indexId: string, query: string): Promise<any[]>;
|
|
248
|
+
|
|
247
249
|
interface StorageOptions {
|
|
248
250
|
bucket: string;
|
|
249
251
|
endpoint?: string;
|
|
@@ -293,4 +295,4 @@ declare class Storage {
|
|
|
293
295
|
deleteObject(key: string): Promise<void>;
|
|
294
296
|
}
|
|
295
297
|
|
|
296
|
-
export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
|
|
298
|
+
export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
|
package/dist/index.js
CHANGED
|
@@ -3698,6 +3698,7 @@ var initializeSdk = (projectId, options) => {
|
|
|
3698
3698
|
authority: app.baseUrl,
|
|
3699
3699
|
client_id: app.projectId,
|
|
3700
3700
|
redirect_uri: window.location.origin,
|
|
3701
|
+
post_logout_redirect_uri: window.location.origin,
|
|
3701
3702
|
response_type: "code",
|
|
3702
3703
|
scope: "openid profile email",
|
|
3703
3704
|
userStore: new WebStorageStateStore({ store: window.sessionStorage }),
|
|
@@ -4106,7 +4107,10 @@ var _DatabaseSocketManager = class _DatabaseSocketManager {
|
|
|
4106
4107
|
return _DatabaseSocketManager.instance;
|
|
4107
4108
|
}
|
|
4108
4109
|
isWebSocketAvailable() {
|
|
4109
|
-
|
|
4110
|
+
if (typeof window === "undefined") {
|
|
4111
|
+
return false;
|
|
4112
|
+
}
|
|
4113
|
+
return this.socket !== null && this.socket.readyState === 1;
|
|
4110
4114
|
}
|
|
4111
4115
|
getWebSocketUrl(baseUrl, token) {
|
|
4112
4116
|
let wsUrl = baseUrl.replace(/^http/, "ws");
|
|
@@ -4374,6 +4378,10 @@ var QueryBuilder = class {
|
|
|
4374
4378
|
} catch (err) {
|
|
4375
4379
|
console.warn("[QueryBuilder] WebSocket execution failed, falling back to REST:", err);
|
|
4376
4380
|
}
|
|
4381
|
+
} else if (typeof window !== "undefined") {
|
|
4382
|
+
socketManager.ensureConnected().catch((err) => {
|
|
4383
|
+
console.warn("[QueryBuilder] Background WebSocket connection failed:", err);
|
|
4384
|
+
});
|
|
4377
4385
|
}
|
|
4378
4386
|
return yield makeRequest("post" /* POST */, "/api/db/query", void 0, this.payload);
|
|
4379
4387
|
});
|
|
@@ -4388,6 +4396,22 @@ function db(dbName) {
|
|
|
4388
4396
|
};
|
|
4389
4397
|
}
|
|
4390
4398
|
|
|
4399
|
+
// src/database/search.ts
|
|
4400
|
+
function search(indexId, query) {
|
|
4401
|
+
return __async(this, null, function* () {
|
|
4402
|
+
if (!indexId || !query) {
|
|
4403
|
+
throw new Error("indexId and query are required to perform a search");
|
|
4404
|
+
}
|
|
4405
|
+
const result = yield makeRequest(
|
|
4406
|
+
"post" /* POST */,
|
|
4407
|
+
"/api/search/query",
|
|
4408
|
+
void 0,
|
|
4409
|
+
{ indexId, query }
|
|
4410
|
+
);
|
|
4411
|
+
return result || [];
|
|
4412
|
+
});
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4391
4415
|
// src/storage/sigv4.ts
|
|
4392
4416
|
function stringToUint8Array(str) {
|
|
4393
4417
|
return new TextEncoder().encode(str);
|
|
@@ -4733,6 +4757,7 @@ export {
|
|
|
4733
4757
|
logout,
|
|
4734
4758
|
refreshTokens,
|
|
4735
4759
|
resetPassword,
|
|
4760
|
+
search,
|
|
4736
4761
|
setAccessToken,
|
|
4737
4762
|
setRefreshToken,
|
|
4738
4763
|
unassignRole,
|