Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@supabase/supabase-js

Package Overview
Dependencies
Maintainers
9
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supabase/supabase-js - npm Package Compare versions

Comparing version 2.44.4 to 2.45.0

20

dist/main/lib/helpers.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,3 +29,3 @@ exports.applySettingDefaults = exports.isBrowser = exports.stripTrailingSlash = exports.uuid = void 0;

const { db: DEFAULT_DB_OPTIONS, auth: DEFAULT_AUTH_OPTIONS, realtime: DEFAULT_REALTIME_OPTIONS, global: DEFAULT_GLOBAL_OPTIONS, } = defaults;
return {
const result = {
db: Object.assign(Object.assign({}, DEFAULT_DB_OPTIONS), dbOptions),

@@ -26,5 +35,14 @@ auth: Object.assign(Object.assign({}, DEFAULT_AUTH_OPTIONS), authOptions),

global: Object.assign(Object.assign({}, DEFAULT_GLOBAL_OPTIONS), globalOptions),
accessToken: () => __awaiter(this, void 0, void 0, function* () { return ''; }),
};
if (options.accessToken) {
result.accessToken = options.accessToken;
}
else {
// hack around Required<>
delete result.accessToken;
}
return result;
}
exports.applySettingDefaults = applySettingDefaults;
//# sourceMappingURL=helpers.js.map

@@ -65,2 +65,14 @@ import { AuthClient } from '@supabase/auth-js';

};
/**
* Optional function for using a third-party authentication system with
* Supabase. The function should return an access token or ID token (JWT) by
* obtaining it from the third-party auth client library. Note that this
* function may be called concurrently and many times. Use memoization and
* locking techniques if this is not supported by the client libraries.
*
* When set, the `auth` namespace of the Supabase client cannot be used.
* Create another client if you wish to use Supabase Auth and third-party
* authentications concurrently in the same application.
*/
accessToken?: () => Promise<string>;
};

@@ -67,0 +79,0 @@ export declare type GenericTable = {

2

dist/main/lib/version.d.ts

@@ -1,2 +0,2 @@

export declare const version = "2.44.4";
export declare const version = "2.45.0";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = '2.44.4';
exports.version = '2.45.0';
//# sourceMappingURL=version.js.map

@@ -28,2 +28,3 @@ import { FunctionsClient } from '@supabase/functions-js';

protected changedAccessToken?: string;
protected accessToken?: () => Promise<string>;
protected headers: Record<string, string>;

@@ -30,0 +31,0 @@ /**

@@ -62,3 +62,13 @@ "use strict";

this.headers = (_b = settings.global.headers) !== null && _b !== void 0 ? _b : {};
this.auth = this._initSupabaseAuthClient((_c = settings.auth) !== null && _c !== void 0 ? _c : {}, this.headers, settings.global.fetch);
if (!settings.accessToken) {
this.auth = this._initSupabaseAuthClient((_c = settings.auth) !== null && _c !== void 0 ? _c : {}, this.headers, settings.global.fetch);
}
else {
this.accessToken = settings.accessToken;
this.auth = new Proxy({}, {
get: (_, prop) => {
throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
},
});
}
this.fetch = (0, fetch_1.fetchWithAuth)(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);

@@ -71,3 +81,5 @@ this.realtime = this._initRealtimeClient(Object.assign({ headers: this.headers }, settings.realtime));

});
this._listenForAuthEvents();
if (!settings.accessToken) {
this._listenForAuthEvents();
}
}

@@ -169,2 +181,5 @@ /**

return __awaiter(this, void 0, void 0, function* () {
if (this.accessToken) {
return yield this.accessToken();
}
const { data } = yield this.auth.getSession();

@@ -171,0 +186,0 @@ return (_b = (_a = data.session) === null || _a === void 0 ? void 0 : _a.access_token) !== null && _b !== void 0 ? _b : null;

@@ -0,1 +1,10 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
export function uuid() {

@@ -14,3 +23,3 @@ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {

const { db: DEFAULT_DB_OPTIONS, auth: DEFAULT_AUTH_OPTIONS, realtime: DEFAULT_REALTIME_OPTIONS, global: DEFAULT_GLOBAL_OPTIONS, } = defaults;
return {
const result = {
db: Object.assign(Object.assign({}, DEFAULT_DB_OPTIONS), dbOptions),

@@ -20,4 +29,13 @@ auth: Object.assign(Object.assign({}, DEFAULT_AUTH_OPTIONS), authOptions),

global: Object.assign(Object.assign({}, DEFAULT_GLOBAL_OPTIONS), globalOptions),
accessToken: () => __awaiter(this, void 0, void 0, function* () { return ''; }),
};
if (options.accessToken) {
result.accessToken = options.accessToken;
}
else {
// hack around Required<>
delete result.accessToken;
}
return result;
}
//# sourceMappingURL=helpers.js.map

@@ -65,2 +65,14 @@ import { AuthClient } from '@supabase/auth-js';

};
/**
* Optional function for using a third-party authentication system with
* Supabase. The function should return an access token or ID token (JWT) by
* obtaining it from the third-party auth client library. Note that this
* function may be called concurrently and many times. Use memoization and
* locking techniques if this is not supported by the client libraries.
*
* When set, the `auth` namespace of the Supabase client cannot be used.
* Create another client if you wish to use Supabase Auth and third-party
* authentications concurrently in the same application.
*/
accessToken?: () => Promise<string>;
};

@@ -67,0 +79,0 @@ export declare type GenericTable = {

@@ -1,2 +0,2 @@

export declare const version = "2.44.4";
export declare const version = "2.45.0";
//# sourceMappingURL=version.d.ts.map

@@ -1,2 +0,2 @@

export const version = '2.44.4';
export const version = '2.45.0';
//# sourceMappingURL=version.js.map

@@ -28,2 +28,3 @@ import { FunctionsClient } from '@supabase/functions-js';

protected changedAccessToken?: string;
protected accessToken?: () => Promise<string>;
protected headers: Record<string, string>;

@@ -30,0 +31,0 @@ /**

@@ -60,3 +60,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

this.headers = (_b = settings.global.headers) !== null && _b !== void 0 ? _b : {};
this.auth = this._initSupabaseAuthClient((_c = settings.auth) !== null && _c !== void 0 ? _c : {}, this.headers, settings.global.fetch);
if (!settings.accessToken) {
this.auth = this._initSupabaseAuthClient((_c = settings.auth) !== null && _c !== void 0 ? _c : {}, this.headers, settings.global.fetch);
}
else {
this.accessToken = settings.accessToken;
this.auth = new Proxy({}, {
get: (_, prop) => {
throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
},
});
}
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);

@@ -69,3 +79,5 @@ this.realtime = this._initRealtimeClient(Object.assign({ headers: this.headers }, settings.realtime));

});
this._listenForAuthEvents();
if (!settings.accessToken) {
this._listenForAuthEvents();
}
}

@@ -167,2 +179,5 @@ /**

return __awaiter(this, void 0, void 0, function* () {
if (this.accessToken) {
return yield this.accessToken();
}
const { data } = yield this.auth.getSession();

@@ -169,0 +184,0 @@ return (_b = (_a = data.session) === null || _a === void 0 ? void 0 : _a.access_token) !== null && _b !== void 0 ? _b : null;

{
"name": "@supabase/supabase-js",
"version": "2.44.4",
"version": "2.45.0",
"description": "Isomorphic Javascript client for Supabase",

@@ -5,0 +5,0 @@ "keywords": [

@@ -40,3 +40,3 @@ // helpers.ts

return {
const result: Required<SupabaseClientOptions<SchemaName>> = {
db: {

@@ -58,3 +58,13 @@ ...DEFAULT_DB_OPTIONS,

},
accessToken: async () => '',
}
if (options.accessToken) {
result.accessToken = options.accessToken
} else {
// hack around Required<>
delete (result as any).accessToken
}
return result
}

@@ -69,2 +69,14 @@ import { AuthClient } from '@supabase/auth-js'

}
/**
* Optional function for using a third-party authentication system with
* Supabase. The function should return an access token or ID token (JWT) by
* obtaining it from the third-party auth client library. Note that this
* function may be called concurrently and many times. Use memoization and
* locking techniques if this is not supported by the client libraries.
*
* When set, the `auth` namespace of the Supabase client cannot be used.
* Create another client if you wish to use Supabase Auth and third-party
* authentications concurrently in the same application.
*/
accessToken?: () => Promise<string>
}

@@ -71,0 +83,0 @@

@@ -1,1 +0,1 @@

export const version = '2.44.4'
export const version = '2.45.0'

@@ -54,2 +54,3 @@ import { FunctionsClient } from '@supabase/functions-js'

protected changedAccessToken?: string
protected accessToken?: () => Promise<string>

@@ -99,7 +100,22 @@ protected headers: Record<string, string>

this.auth = this._initSupabaseAuthClient(
settings.auth ?? {},
this.headers,
settings.global.fetch
)
if (!settings.accessToken) {
this.auth = this._initSupabaseAuthClient(
settings.auth ?? {},
this.headers,
settings.global.fetch
)
} else {
this.accessToken = settings.accessToken
this.auth = new Proxy<SupabaseAuthClient>({} as any, {
get: (_, prop) => {
throw new Error(
`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(
prop
)} is not possible`
)
},
})
}
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch)

@@ -114,3 +130,5 @@

this._listenForAuthEvents()
if (!settings.accessToken) {
this._listenForAuthEvents()
}
}

@@ -250,2 +268,6 @@

private async _getAccessToken() {
if (this.accessToken) {
return await this.accessToken()
}
const { data } = await this.auth.getSession()

@@ -252,0 +274,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc