@linabase/js 0.4.1 → 0.4.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.cjs CHANGED
@@ -1180,10 +1180,12 @@ function createClient(config) {
1180
1180
  }
1181
1181
  function buildClient(reqFn, branchSlug) {
1182
1182
  const rc = new RpcClient(reqFn);
1183
- const ac = new AuthClient(reqFn);
1184
- ac.onSessionChange = (session) => {
1185
- accessToken = session?.access_token || null;
1186
- };
1183
+ const ac = branchSlug ? new AuthClient(reqFn) : authClient;
1184
+ if (branchSlug) {
1185
+ ac.onSessionChange = (session) => {
1186
+ accessToken = session?.access_token || null;
1187
+ };
1188
+ }
1187
1189
  return {
1188
1190
  from: (table) => new DatabaseClient(reqFn, table),
1189
1191
  schema: (schemaName) => ({
@@ -1195,7 +1197,7 @@ function createClient(config) {
1195
1197
  }),
1196
1198
  rpc: (fn, args) => rc.call(fn, args),
1197
1199
  storage: new StorageClient(reqFn, baseUrl),
1198
- auth: branchSlug ? authClient : ac,
1200
+ auth: ac,
1199
1201
  functions: new FunctionsClient(reqFn),
1200
1202
  /** Realtime channel (stub; not yet supported). Returns a chainable no-op. */
1201
1203
  channel: (_name) => {
package/dist/index.js CHANGED
@@ -1148,10 +1148,12 @@ function createClient(config) {
1148
1148
  }
1149
1149
  function buildClient(reqFn, branchSlug) {
1150
1150
  const rc = new RpcClient(reqFn);
1151
- const ac = new AuthClient(reqFn);
1152
- ac.onSessionChange = (session) => {
1153
- accessToken = session?.access_token || null;
1154
- };
1151
+ const ac = branchSlug ? new AuthClient(reqFn) : authClient;
1152
+ if (branchSlug) {
1153
+ ac.onSessionChange = (session) => {
1154
+ accessToken = session?.access_token || null;
1155
+ };
1156
+ }
1155
1157
  return {
1156
1158
  from: (table) => new DatabaseClient(reqFn, table),
1157
1159
  schema: (schemaName) => ({
@@ -1163,7 +1165,7 @@ function createClient(config) {
1163
1165
  }),
1164
1166
  rpc: (fn, args) => rc.call(fn, args),
1165
1167
  storage: new StorageClient(reqFn, baseUrl),
1166
- auth: branchSlug ? authClient : ac,
1168
+ auth: ac,
1167
1169
  functions: new FunctionsClient(reqFn),
1168
1170
  /** Realtime channel (stub; not yet supported). Returns a chainable no-op. */
1169
1171
  channel: (_name) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linabase/js",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "JavaScript/TypeScript client SDK for Linabase (database, storage, auth)",
5
5
  "license": "MIT",
6
6
  "type": "module",