@linabase/js 0.4.2 → 0.4.4

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
@@ -696,6 +696,8 @@ var AuthClient = class {
696
696
  listeners = [];
697
697
  /** Promise that resolves when session restore from storage is complete. */
698
698
  _restorePromise = Promise.resolve();
699
+ /** API key for auth requests that shouldn't use the (possibly expired) access token. */
700
+ _apiKey = "";
699
701
  currentSession = null;
700
702
  /**
701
703
  * Callback that the parent LinabaseClient can set to update the Authorization
@@ -839,6 +841,8 @@ var AuthClient = class {
839
841
  try {
840
842
  const res = await this.request("/auth/v1/token?grant_type=refresh_token", {
841
843
  method: "POST",
844
+ // Force API key auth instead of (possibly expired) access token
845
+ headers: { "Authorization": `Bearer ${this._apiKey}` },
842
846
  body: JSON.stringify({ refresh_token: this.currentSession.refresh_token })
843
847
  });
844
848
  const data = await res.json();
@@ -1154,6 +1158,7 @@ function createClient(config) {
1154
1158
  });
1155
1159
  }
1156
1160
  const authClient = new AuthClient(request);
1161
+ authClient._apiKey = apiKey;
1157
1162
  const persistSession = config.auth?.persistSession !== false && !!config.auth?.storage;
1158
1163
  const sessionStorage = config.auth?.storage;
1159
1164
  const sessionKey = config.auth?.storageKey || "@linabase/session";
package/dist/index.d.cts CHANGED
@@ -268,6 +268,8 @@ declare class AuthClient {
268
268
  private listeners;
269
269
  /** Promise that resolves when session restore from storage is complete. */
270
270
  _restorePromise: Promise<void>;
271
+ /** API key for auth requests that shouldn't use the (possibly expired) access token. */
272
+ _apiKey: string;
271
273
  private currentSession;
272
274
  /**
273
275
  * Callback that the parent LinabaseClient can set to update the Authorization
package/dist/index.d.ts CHANGED
@@ -268,6 +268,8 @@ declare class AuthClient {
268
268
  private listeners;
269
269
  /** Promise that resolves when session restore from storage is complete. */
270
270
  _restorePromise: Promise<void>;
271
+ /** API key for auth requests that shouldn't use the (possibly expired) access token. */
272
+ _apiKey: string;
271
273
  private currentSession;
272
274
  /**
273
275
  * Callback that the parent LinabaseClient can set to update the Authorization
package/dist/index.js CHANGED
@@ -664,6 +664,8 @@ var AuthClient = class {
664
664
  listeners = [];
665
665
  /** Promise that resolves when session restore from storage is complete. */
666
666
  _restorePromise = Promise.resolve();
667
+ /** API key for auth requests that shouldn't use the (possibly expired) access token. */
668
+ _apiKey = "";
667
669
  currentSession = null;
668
670
  /**
669
671
  * Callback that the parent LinabaseClient can set to update the Authorization
@@ -807,6 +809,8 @@ var AuthClient = class {
807
809
  try {
808
810
  const res = await this.request("/auth/v1/token?grant_type=refresh_token", {
809
811
  method: "POST",
812
+ // Force API key auth instead of (possibly expired) access token
813
+ headers: { "Authorization": `Bearer ${this._apiKey}` },
810
814
  body: JSON.stringify({ refresh_token: this.currentSession.refresh_token })
811
815
  });
812
816
  const data = await res.json();
@@ -1122,6 +1126,7 @@ function createClient(config) {
1122
1126
  });
1123
1127
  }
1124
1128
  const authClient = new AuthClient(request);
1129
+ authClient._apiKey = apiKey;
1125
1130
  const persistSession = config.auth?.persistSession !== false && !!config.auth?.storage;
1126
1131
  const sessionStorage = config.auth?.storage;
1127
1132
  const sessionKey = config.auth?.storageKey || "@linabase/session";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linabase/js",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "JavaScript/TypeScript client SDK for Linabase (database, storage, auth)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,9 +9,9 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
+ "types": "./dist/index.d.ts",
12
13
  "import": "./dist/index.js",
13
- "require": "./dist/index.cjs",
14
- "types": "./dist/index.d.ts"
14
+ "require": "./dist/index.cjs"
15
15
  }
16
16
  },
17
17
  "files": [