Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/postgrest/lib/src/postgrest_filter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,11 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
// keep it simple and accept a string
url = _url.appendSearchParameters(column, 'cs.$value');
} else if (value is List) {
// array
url = _url.appendSearchParameters(
column,
'cs.{${_cleanFilterList(value)}}',
);
} else {
// json
url = _url.appendSearchParameters(column, 'cs.${json.encode(value)}');
}
return copyWithUrl(url);
Expand Down Expand Up @@ -379,13 +377,11 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
// keep it simple and accept a string
url = _url.appendSearchParameters(column, 'cd.$value');
} else if (value is List) {
// array
url = _url.appendSearchParameters(
column,
'cd.{${_cleanFilterList(value)}}',
);
} else {
// json
url = _url.appendSearchParameters(column, 'cd.${json.encode(value)}');
}
return copyWithUrl(url);
Expand Down Expand Up @@ -468,7 +464,6 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
PostgrestFilterBuilder<T> overlaps(String column, Object value) {
final Uri url;
if (value is List) {
// array
url = _url.appendSearchParameters(
column,
'ov.{${_cleanFilterList(value)}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
PostgrestTransformBuilder<T> maxAffected(int value) {
final newHeaders = {..._headers};

// Add handling=strict and max-affected headers
final existingPrefer = _emptyPreferAsNull(newHeaders['Prefer']);
final String preferHeader;
if (existingPrefer != null) {
Expand Down
7 changes: 0 additions & 7 deletions packages/supabase_auth/lib/src/auth_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,6 @@ class AuthClient {
final startedAt = DateTime.now();
var attempt = 0;
return await retry(
// Make a GET request
() async {
attempt++;
authLogger.fine('Attempt $attempt to refresh token');
Expand Down Expand Up @@ -2148,18 +2147,15 @@ class AuthClient {
}

Future<JWK?> _fetchJwk(String kid, JWKSet suppliedJwks) async {
// try fetching from the supplied jwks
final jwk = suppliedJwks.keys.firstWhereOrNull((key) => key.keyId == kid);
if (jwk != null) {
return jwk;
}

final now = DateTime.now();

// try fetching from cache
final cachedJwk = _jwks?.keys.firstWhereOrNull((key) => key.keyId == kid);

// jwks exists and it isn't stale
if (cachedJwk != null &&
_jwksCachedAt != null &&
_jwksCachedAt!.add(AuthConstants.jwksTtl).isAfter(now)) {
Expand All @@ -2183,7 +2179,6 @@ class AuthClient {
_jwks = jwks;
_jwksCachedAt = now;

// find the signing key
return jwks.keys.firstWhereOrNull((key) => key.keyId == kid);
}

Expand Down Expand Up @@ -2223,10 +2218,8 @@ class AuthClient {
token = session.accessToken;
}

// Decode the JWT to get the payload
final decoded = decodeJwt(token);

// Validate expiration unless allowExpired is true
if (!(options?.allowExpired ?? false)) {
validateExpiration(decoded.payload.expiresAt);
}
Expand Down
3 changes: 0 additions & 3 deletions packages/supabase_auth/lib/src/helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ DecodedJwt decodeJwt(String token) {
final rawSignature = parts[2];

try {
// Decode header
final headerJson = Base64Url.decodeToString(rawHeader);
final header = JwtHeader.fromJson(json.decode(headerJson));

// Decode payload
final payloadJson = Base64Url.decodeToString(rawPayload);
final payload = JwtPayload.fromJson(json.decode(payloadJson));

// Decode signature
final signature = Base64Url.decodeToBytes(rawSignature);

return DecodedJwt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class SharedPreferencesAuthAsyncStorage extends AuthAsyncStorage {

/// Reads [key] from `window.localStorage`.
///
/// Code verifiers used to be written through [SharedPreferencesAsync], which
/// on web JSON encodes the value under the very same key. Such a value is
/// decoded and written back as is, so the flow it belongs to can complete.
/// Some values are written through [SharedPreferencesAsync], which on web
/// JSON encodes the value under the very same key. Such a value is decoded
/// and written back as is, so the flow it belongs to can complete.
String? _webItem(String key) {
final value = web.getItem(key);
if (value == null || !value.startsWith('"')) {
Expand Down
1 change: 0 additions & 1 deletion packages/supabase_flutter/lib/src/supabase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ class Supabase {
/// [captured] is the lifecycle state at the time the event was enqueued.
/// If a newer event has arrived since, this one is skipped (stale).
Future<void> _processLifecycle(AppLifecycleState captured) async {
// Skip if a newer lifecycle event has superseded this one.
if (captured != _targetLifecycleState) return;

final realtime = Supabase.instance.client.realtime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class FunctionsClient {
}) async {
final effectiveRegion = region ?? _region;

// Merge query parameters with forceFunctionRegion if region is specified
final effectiveQueryParameters = <String, dynamic>{
...?queryParameters,
if (effectiveRegion != null && effectiveRegion != 'any')
Expand Down
2 changes: 1 addition & 1 deletion packages/supabase_realtime/lib/src/transformers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class _ArrayLiteralParser {
}

/// Fixes timestamp to be ISO-8601. Swaps the space between the date and time
/// for a 'T' See https://github.com/supabase/supabase/issues/18
/// for a 'T'.
///
///```dart
/// @example toTimestampString('2019-09-10 00:00:00')
Expand Down
3 changes: 0 additions & 3 deletions packages/supabase_storage/lib/src/fetch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ class Fetch {
) async {
final headers = options?.headers ?? {};

// Create a factory function that generates a fresh MultipartRequest for
// each attempt
http.MultipartRequest createRequest() {
final request = http.AbortableMultipartRequest(
method.value,
Expand Down Expand Up @@ -198,7 +196,6 @@ class Fetch {
'${Uri.parse(url).redacted} ${headers.redacted}',
);

// Create a fresh request for each retry attempt
return createRequest().sendWith(httpClient);
},
options: retryOptions,
Expand Down
3 changes: 0 additions & 3 deletions packages/supabase_storage/lib/src/storage_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ class SupabaseStorageClient extends StorageBucketApi {
final uri = Uri.parse(url);
final hostname = uri.host;

// If it's a legacy storage URL, transform it
const legacyStoragePrefix = '/storage';
if (_isLegacySupabaseHost(hostname) &&
uri.path.startsWith(legacyStoragePrefix)) {
// Remove /storage from pathname
final newPath = uri.path.substring(legacyStoragePrefix.length);
// Replace .supabase. with .storage.supabase. in hostname, on the same
// label boundary the check above used.
Expand All @@ -110,7 +108,6 @@ class SupabaseStorageClient extends StorageBucketApi {
'.storage.supabase.',
);

// Reconstruct the URI
return uri
.replace(
host: newHostname,
Expand Down