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
8 changes: 4 additions & 4 deletions packages/functions_client/lib/src/functions_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ class FunctionsClient {
///
/// [headers] to send with the request
///
/// [body] of the request when [files] is null and can be of type String
/// or an Object that is encodable to JSON with `jsonEncode`.
/// [body] of the request when [files] is null and can be of type String,
/// [Uint8List], or an Object that is encodable to JSON with `jsonEncode`.
/// If [files] is not null, [body] represents the fields of the
/// [MultipartRequest] and must be of type `Map<String, String>`.
///
/// [files] to send in a `MultipartRequest`. [body] is used for the fields.
///
/// [region] optionally specify the region to invoke the function in. When
/// specified, adds both `x-region` header and `forceFunctionRegion` query
/// parameter.
/// specified and not equal to `'any'`, adds both the `x-region` header and
/// the `forceFunctionRegion` query parameter.
///
/// [abortSignal] cancels the in-flight request when the provided [Future]
/// completes. It must not complete with an error. On abort, a
Expand Down
2 changes: 1 addition & 1 deletion packages/functions_client/lib/src/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FunctionResponse {
/// The data returned by the function. Type depends on the header
/// `Content-Type`:
/// - 'text/plain': [String]
/// - 'octet/stream': [Uint8List]
/// - 'application/octet-stream': [Uint8List]
/// - 'application/json': dynamic ([jsonDecode] is used)
/// - 'text/event-stream': [ByteStream]
final dynamic data;
Expand Down
11 changes: 6 additions & 5 deletions packages/gotrue/lib/src/gotrue_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1756,12 +1756,13 @@ class GoTrueClient {
/// sends a request to the Auth server for each JWT.
///
/// If the project is not using an asymmetric JWT signing key (like ECC or
/// RSA) it always sends a request to the Auth server (similar to [getUser])
/// to verify the JWT.
/// RSA), or the JWT header does not carry a `kid`, it always sends a
/// request to the Auth server (similar to [getUser]) to verify the JWT.
///
/// For JWTs signed with asymmetric algorithms (RS256, ES256, etc.), the JWKS
/// is fetched from the server on the first call and cached for subsequent
/// calls. The cache is refreshed automatically after 10 minutes.
/// For JWTs signed with an RSA-based asymmetric algorithm (e.g. RS256) that
/// carry a `kid`, the JWKS is fetched from the server on the first call and
/// cached for subsequent calls. The cache is refreshed automatically after
/// 10 minutes.
///
/// [jwt] An optional specific JWT you wish to verify, not the one you
/// can obtain from [currentSession].
Expand Down
7 changes: 4 additions & 3 deletions packages/gotrue/lib/src/types/mfa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class AuthMFAEnrollResponse {
}

class TOTPEnrollment {
/// Contains a QR code encoding the authenticator URI.
/// A `data:image/svg+xml;utf-8,` URL containing a QR code that encodes the
/// authenticator URI.
///
/// You can convert it to a URL by prepending `data:image/svg+xml;utf-8,` to
/// the value. Avoid logging this value to the console.
/// Ready to use directly as an image source. Avoid logging this value to
/// the console.
final String qrCode;

/// The TOTP secret (also encoded in the QR code).
Expand Down
8 changes: 5 additions & 3 deletions packages/gotrue/lib/src/types/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class Session {
}

/// The Unix timestamp, in **seconds**, of when the token will expire.
/// Returned when a login is confirmed.
///
/// Derived from the `exp` claim of [accessToken], not read from the login
/// response's JSON body.
///
/// To convert this to a [DateTime], multiply by 1000 since
/// [DateTime.fromMillisecondsSinceEpoch] expects milliseconds:
Expand All @@ -84,10 +86,10 @@ class Session {
}
}

/// Returns `true` if the token is expired or will expire in the next 10
/// Returns `true` if the token is expired or will expire in the next 30
/// seconds.
///
/// The 10 second buffer is to account for latency issues.
/// The 30 second buffer is to account for latency issues.
bool get isExpired {
if (expiresAt == null) return false;
return DateTime.now()
Expand Down
2 changes: 1 addition & 1 deletion packages/postgrest/lib/src/postgrest_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ String? _emptyPreferAsNull(String? prefer) =>
///
/// [T] for the overall return type, so `PostgrestResponse<S>` or [S]
///
/// When using [_converter], [S] is the input and [R] is the output
/// When using [_converter], [R] is the input and [S] is the output
/// Otherwise [S] and [R] are the same
@immutable
class PostgrestBuilder<T, S, R> implements Future<T> {
Expand Down
2 changes: 1 addition & 1 deletion packages/postgrest/lib/src/postgrest_filter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
/// await supabase
/// .from('users')
/// .select()
/// .sl('age_range', '[2,25)');
/// .rangeLt('age_range', '[2,25)');
/// ```
PostgrestFilterBuilder<T> rangeLt(String column, String range) {
return copyWithUrl(appendSearchParams(column, 'sl.$range'));
Expand Down
7 changes: 5 additions & 2 deletions packages/postgrest/lib/src/postgrest_query_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ part of 'postgrest_builder.dart';
/// The query builder class provides a convenient interface to creating request
/// queries.
///
/// Allows the user to stack the filter functions before they call any of
/// Call one of
/// * select() - "get"
/// * insert() - "post"
/// * upsert() - "post"
/// * update() - "patch"
/// * delete() - "delete"
/// Once any of these are called the filters are passed down to the Request.
/// * count() - "head"
/// first. Each of these returns a filter builder that allows the user to
/// stack filter functions before the request is sent.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
/// {@endtemplate}
class PostgrestQueryBuilder<T> extends RawPostgrestBuilder<T, T, T> {
/// {@macro postgrest_query_builder}
Expand Down
7 changes: 6 additions & 1 deletion packages/postgrest/lib/src/postgrest_rpc_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ class PostgrestRpcBuilder
),
);

/// {@macro postgrest_rpc}
/// Performs a database function call.
///
/// [params] is an optional object to pass as arguments to the function call.
///
/// When [get] is set to `true`, [params] must be a [Map], and the function
/// is called with read-only access mode.
PostgrestFilterBuilder<T> rpc<T>([
Object? params,
bool get = false,
Expand Down
3 changes: 2 additions & 1 deletion packages/postgrest/lib/src/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ enum ExplainFormat {
}

// coverage:ignore-[start]
/// Returns count as part of the response when specified.
/// Controls whether the affected row's representation is returned in the
/// response.
@Deprecated('Not used anywhere. Will be removed in the next major version.')
enum ReturningOption {
minimal,
Expand Down
4 changes: 2 additions & 2 deletions packages/realtime_client/lib/realtime_client.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Listens to changes in a PostgreSQL database via websockets using Supabase
/// Realtime.
/// Client library for Supabase Realtime: subscribe to PostgreSQL database
/// changes, broadcast messages, and presence over a websocket connection.
library;

export 'src/constants.dart'
Expand Down
7 changes: 4 additions & 3 deletions packages/realtime_client/lib/src/realtime_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,11 @@ class RealtimeChannel {
/// Unsubscribes from server events, and instructs channel to terminate on
/// server. Triggers onClose() hooks.
///
/// To receive leave acknowledgements, use a `receive` hook to bind to the
/// server ack,
/// Returns a [Future] that resolves to `'ok'`, `'timed out'`, or `'error'`
/// depending on the outcome of the leave request.
/// ```dart
/// channel.unsubscribe().receive("ok", (_){print("left!");} );
/// final status = await channel.unsubscribe();
/// print(status); // 'ok'
/// ```
Future<String> unsubscribe([Duration? timeout]) {
_state = ChannelState.leaving;
Expand Down
6 changes: 4 additions & 2 deletions packages/realtime_client/lib/src/realtime_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class RealtimeClient {
/// Used to keep track of whether the client is connected to the server.
String? pendingHeartbeatRef;

/// Unique reference ID for every heartbeat.
/// Counter used by [makeRef] to generate a unique reference ID for every
/// pushed message, including heartbeats.
int ref = 0;
late RetryTimer reconnectTimer;
void Function(String? kind, String? message, dynamic data)? logger;
Expand Down Expand Up @@ -453,7 +454,8 @@ class RealtimeClient {
stateChangeCallbacks['message']!.add(callback);
}

/// Emits a status whenever a heartbeat is sent, acknowledged, or times out.
/// Emits a status whenever a heartbeat is sent, acknowledged, errors, or
/// times out.
Stream<RealtimeHeartbeatStatus> get onHeartbeat =>
_heartbeatController.stream;

Expand Down
16 changes: 7 additions & 9 deletions packages/realtime_client/lib/src/retry_timer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ const maxShift = 20;
///
/// ```dart
/// int calculateRetryDuration(int tries) {
/// return [1000, 5000, 10000][tries - 1] ?? 10000;
/// const delays = [1000, 5000, 10000];
/// return tries <= delays.length ? delays[tries - 1] : 10000;
/// }
///
/// final reconnectTimer = RetryTimer(
/// () => connect(),
/// calculateRetryDuration,
/// );
/// final reconnectTimer = RetryTimer(connect, calculateRetryDuration);
///
/// reconnectTimer.scheduleTimeout() // fires after 1000
/// reconnectTimer.scheduleTimeout() // fires after 5000
/// reconnectTimer.reset()
/// reconnectTimer.scheduleTimeout() // fires after 1000
/// reconnectTimer.scheduleTimeout(); // fires after 1000
/// reconnectTimer.scheduleTimeout(); // fires after 5000
/// reconnectTimer.reset();
/// reconnectTimer.scheduleTimeout(); // fires after 1000
///
/// ```
class RetryTimer {
Expand Down
13 changes: 6 additions & 7 deletions packages/realtime_client/lib/src/transformers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ class PostgresColumn {
///
/// ```dart
/// convertChangeData(
/// [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}],
/// [{'name': 'first_name', 'type': 'text'}, {'name': 'age', 'type': 'int4'}],
/// {'first_name': 'Paul', 'age':'33'},
/// {},
/// )
/// => { 'first_name': 'Paul', 'age': 33 }
/// ```
Expand Down Expand Up @@ -95,21 +94,21 @@ Map<String, dynamic> convertChangeData(
///
/// `columnName` The column that you want to convert
/// `columns` All of the columns
/// `records` The map of string values
/// `record` The map of string values
/// `skipTypes` An array of types that should not be converted
///
/// ```dart
/// convertColumn(
/// 'age',
/// [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}],
/// ['Paul', '33'],
/// [{'name': 'first_name', 'type': 'text'}, {'name': 'age', 'type': 'int4'}],
/// {'first_name': 'Paul', 'age': '33'},
/// [],
/// )
/// => 33
/// convertColumn(
/// 'age',
/// [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}],
/// ['Paul', '33'],
/// [{'name': 'first_name', 'type': 'text'}, {'name': 'age', 'type': 'int4'}],
/// {'first_name': 'Paul', 'age': '33'},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
/// ['int4'],
/// )
/// => "33"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,9 @@ class IcebergRestCatalog {

/// Loads a table's metadata.
///
/// When [options] carries an `ifNoneMatch` ETag and the server answers 304,
/// this returns `null`.
/// Use [loadTableResult] instead if you need a conditional request via
/// `ifNoneMatch`, or the full load result including server configuration
/// and vended storage credentials.
Future<TableMetadata> loadTable(TableIdentifier id) async {
final result = await loadTableResult(id);
return result!.metadata;
Expand Down
6 changes: 3 additions & 3 deletions packages/storage_client/lib/src/storage_bucket_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ class StorageBucketApi {
///
/// [bucketOptions] is a parameter to optionally make the bucket public.
///
/// It returns the newly created bucket it. To get the bucket reference, use
/// [getBucket]:
/// It returns the ID of the newly created bucket. To get the bucket
/// reference, use [getBucket]:
///
/// ```dart
/// void bucket() async {
/// final newBucketId = await createBucket('images');
/// final bucket = await Bucket(newBucketId);
/// final bucket = await getBucket(newBucketId);
/// print('${bucket.id}');
/// }
/// ```
Expand Down
6 changes: 4 additions & 2 deletions packages/storage_client/lib/src/storage_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ class SupabaseStorageClient extends StorageBucketApi {

/// Sets an HTTP header for subsequent requests.
///
/// Creates a shallow copy of headers to avoid mutating shared state.
/// Returns this for method chaining.
/// Mutates the headers map used by this client in place. Instances of
/// [StorageFileApi] already obtained through [from] hold their own copy of
/// the headers, so only calls to [from] made after this one will include
/// the new header. Returns this for method chaining.
///
/// ```dart
/// storage.setHeader('x-custom-header', 'value').from('bucket').upload(...);
Expand Down
2 changes: 1 addition & 1 deletion packages/storage_client/lib/src/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class FileOptions {
/// Used as Content-Type
/// Gets parsed with [MediaType.parse(mime)]
///
/// Throws a FormatError if the media type is invalid.
/// Throws a FormatException if the media type is invalid.
final String? contentType;

/// The metadata option is an object that allows you to store additional
Expand Down
5 changes: 2 additions & 3 deletions packages/supabase/lib/src/realtime_client_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import 'package:realtime_client/realtime_client.dart';
/// Options to pass to the RealtimeClient.
/// {@endtemplate}
class RealtimeClientOptions {
/// How many events the RealtimeClient can push in a second
///
/// Defaults to 10 events per second
/// No longer has any effect. Client side rate limiting has been removed,
/// so this value is ignored.
@Deprecated(
'Client side rate limit has been removed. This option will be ignored.',
)
Expand Down
15 changes: 9 additions & 6 deletions packages/supabase/lib/src/supabase_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ import 'trace_http_client.dart';
/// Pass the `publishable` (anon) key for client-side usage or the `secret`
/// key for trusted server-side environments.
///
/// You can access none public schema by passing different [schema].
/// You can access a schema other than the default `public` schema by setting
/// the `schema` field of [postgrestOptions].
///
/// Default headers can be overridden by specifying [headers].
///
/// Custom http client can be used by passing [httpClient] parameter.
///
/// [storageRetryAttempts] specifies how many retry attempts there should be to
/// upload a file to Supabase storage when failed due to network interruption.
/// Set the `retryAttempts` field of [storageOptions] to specify how many
/// retry attempts there should be to upload a file to Supabase storage when
/// failed due to network interruption.
///
/// [realtimeClientOptions] specifies different options you can pass to
/// `RealtimeClient`.
Expand All @@ -42,8 +44,9 @@ import 'trace_http_client.dart';
/// Pass an instance of `YAJsonIsolate` to [isolate] to use your own persisted
/// isolate instance. A new instance will be created if [isolate] is omitted.
///
/// Pass an instance of [gotrueAsyncStorage] and set the [authFlowType] to
/// `AuthFlowType.pkce`in order to perform auth actions with pkce flow.
/// Pass an instance of `GotrueAsyncStorage` to the `pkceAsyncStorage` field of
/// [authOptions] and set its `authFlowType` field to `AuthFlowType.pkce` in
/// order to perform auth actions with pkce flow.
/// {@endtemplate}
class SupabaseClient {
final String _supabaseKey;
Expand Down Expand Up @@ -268,7 +271,7 @@ class SupabaseClient {

/// Unsubscribes and removes Realtime channel from Realtime client.
///
/// [channel] - The name of the Realtime channel.
/// [channel] - The Realtime channel to remove.
Future<String> removeChannel(RealtimeChannel channel) {
return realtime.removeChannel(channel);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/supabase_common/lib/src/client_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ String normalizePlatformName(String operatingSystem) =>
/// Builds the value of the `X-Client-Info` header.
///
/// When [platformInfo] is `null` the minimal `'$clientName/$version'` form is
/// returned. Otherwise a `; `-joined list is returned, appending `platform`,
/// `platform-version`, `runtime` and `runtime-version` segments for the
/// non-null fields.
/// returned. Otherwise a `; `-joined list is returned, always including a
/// `runtime=dart` segment and appending `platform`, `platform-version` and
/// `runtime-version` segments for the non-null fields.
String buildClientInfoHeader(
String clientName,
String version, {
Expand Down
2 changes: 0 additions & 2 deletions packages/supabase_flutter/lib/src/local_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ const supabasePersistSessionKey = 'SUPABASE_PERSIST_SESSION_KEY';
///
/// * [SupabaseAuth], the instance used to manage authentication
/// * [EmptyLocalStorage], used to disable session persistence
/// * [HiveLocalStorage], that implements Hive as storage method
/// * [SharedPreferencesLocalStorage], that implements SharedPreferences as
/// storage method
/// * [MigrationLocalStorage], to migrate from Hive to SharedPreferences
abstract class LocalStorage {
const LocalStorage();

Expand Down
Loading
Loading