@ragable/sdk 0.6.1 → 0.6.2
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.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2094,12 +2094,27 @@ var RagableBrowserAuthClient = class {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
};
|
|
2096
2096
|
var RagableBrowserDatabaseClient = class {
|
|
2097
|
-
constructor(options, ragableAuth = null) {
|
|
2097
|
+
constructor(options, ragableAuth = null, postgrestFrom) {
|
|
2098
2098
|
this.options = options;
|
|
2099
2099
|
this.ragableAuth = ragableAuth;
|
|
2100
|
+
this.postgrestFrom = postgrestFrom;
|
|
2100
2101
|
__publicField(this, "fetchImpl");
|
|
2101
2102
|
this.fetchImpl = bindFetch(options.fetch);
|
|
2102
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* PostgREST fluent API — same as `client.from('table')`.
|
|
2106
|
+
* Use either the root client or `database` for Supabase-style table access; `database.query()` is raw SQL only.
|
|
2107
|
+
*/
|
|
2108
|
+
from(table, databaseInstanceId) {
|
|
2109
|
+
if (!this.postgrestFrom) {
|
|
2110
|
+
throw new RagableError(
|
|
2111
|
+
"database.from() is only available on the client from createBrowserClient().",
|
|
2112
|
+
500,
|
|
2113
|
+
{ code: "SDK_DATABASE_FROM_UNAVAILABLE" }
|
|
2114
|
+
);
|
|
2115
|
+
}
|
|
2116
|
+
return this.postgrestFrom(table, databaseInstanceId);
|
|
2117
|
+
}
|
|
2103
2118
|
toUrl(path) {
|
|
2104
2119
|
return `${normalizeBrowserApiBase(this.options.baseUrl)}${path.startsWith("/") ? path : `/${path}`}`;
|
|
2105
2120
|
}
|
|
@@ -2213,7 +2228,11 @@ var RagableBrowser = class {
|
|
|
2213
2228
|
}
|
|
2214
2229
|
this.agents = new RagableBrowserAgentsClient(options);
|
|
2215
2230
|
this.auth = new RagableBrowserAuthClient(options, this._ragableAuth);
|
|
2216
|
-
this.database = new RagableBrowserDatabaseClient(
|
|
2231
|
+
this.database = new RagableBrowserDatabaseClient(
|
|
2232
|
+
options,
|
|
2233
|
+
this._ragableAuth,
|
|
2234
|
+
(table, databaseInstanceId) => this.from(table, databaseInstanceId)
|
|
2235
|
+
);
|
|
2217
2236
|
}
|
|
2218
2237
|
from(table, databaseInstanceId) {
|
|
2219
2238
|
const id = databaseInstanceId?.trim() || this.options.databaseInstanceId?.trim();
|