From 7ab8a368e676726a548839bb782cfc4e4645d77c Mon Sep 17 00:00:00 2001 From: Dillon Nys <24740863+dnys1@users.noreply.github.com> Date: Sun, 29 Sep 2024 18:30:35 -0700 Subject: [PATCH] chore(sdk): Reduce library namespace sizes (#183) In the SDK packages, reduce the amount of work the analyzer has to do by judiciously importing and exporting the required files in libraries. Regenerates SDK examples based on these changes. --- .../celest/client/lib/example_client.dart | 9 +- .../celest/client/lib/src/functions.dart | 57 +++ .../celest/client/lib/src/serializers.dart | 340 +++++++++++++++++ .../celest_auth/example/analysis_options.yaml | 4 + .../lib/celest_auth_example_client.dart} | 25 +- .../example/celest/client/lib/src/auth.dart | 22 ++ .../celest/client/lib/src/functions.dart | 115 ++++++ .../celest/client/lib/src/serializers.dart | 347 ++++++++++++++++++ .../example/celest/client/pubspec.yaml | 17 + packages/celest_auth/example/celest/functions | 1 + packages/celest_auth/example/celest/generated | 1 + .../celest/lib/fix_data/v1_migration.yaml | 13 + .../example/celest/lib/src/client/auth.dart | 22 -- .../celest/lib/src/client/functions.dart | 63 ---- .../celest/lib/src/client/serializers.dart | 41 --- .../{ => lib/src}/functions/greeting.dart | 0 .../celest/{ => lib/src}/generated/README.md | 0 .../{ => lib/src}/generated/resources.dart | 0 .../celest_auth/example/celest/pubspec.yaml | 3 +- packages/celest_auth/example/lib/main.dart | 2 +- packages/celest_auth/example/pubspec.yaml | 4 +- packages/celest_auth/lib/src/auth_impl.dart | 1 + .../lib/src/model/initial_uri.flutter.dart | 1 + packages/celest_auth/pubspec.yaml | 1 + packages/celest_core/lib/_internal.dart | 2 - .../lib/src/auth/authenticator.dart | 1 + .../lib/src/http/celest_http_client.dart | 1 + 27 files changed, 944 insertions(+), 149 deletions(-) rename packages/celest_auth/example/celest/{lib/client.dart => client/lib/celest_auth_example_client.dart} (72%) create mode 100644 packages/celest_auth/example/celest/client/lib/src/auth.dart create mode 100644 packages/celest_auth/example/celest/client/lib/src/functions.dart create mode 100644 packages/celest_auth/example/celest/client/lib/src/serializers.dart create mode 100644 packages/celest_auth/example/celest/client/pubspec.yaml create mode 120000 packages/celest_auth/example/celest/functions create mode 120000 packages/celest_auth/example/celest/generated create mode 100644 packages/celest_auth/example/celest/lib/fix_data/v1_migration.yaml delete mode 100644 packages/celest_auth/example/celest/lib/src/client/auth.dart delete mode 100644 packages/celest_auth/example/celest/lib/src/client/functions.dart delete mode 100644 packages/celest_auth/example/celest/lib/src/client/serializers.dart rename packages/celest_auth/example/celest/{ => lib/src}/functions/greeting.dart (100%) rename packages/celest_auth/example/celest/{ => lib/src}/generated/README.md (100%) rename packages/celest_auth/example/celest/{ => lib/src}/generated/resources.dart (100%) diff --git a/packages/celest/example/celest/client/lib/example_client.dart b/packages/celest/example/celest/client/lib/example_client.dart index 6d632ced..aecee4b1 100644 --- a/packages/celest/example/celest/client/lib/example_client.dart +++ b/packages/celest/example/celest/client/lib/example_client.dart @@ -9,6 +9,7 @@ import 'dart:io' as _$io; import 'package:celest_core/_internal.dart' as _$celest; import 'package:celest_core/src/util/globals.dart' as _$celest; import 'package:http/http.dart' as _$http; +import 'package:native_storage/native_storage.dart' as _$native_storage; import 'src/functions.dart'; import 'src/serializers.dart'; @@ -24,8 +25,8 @@ enum CelestEnvironment { Uri get baseUri => switch (this) { local => _$celest.kIsWeb || !_$io.Platform.isAndroid - ? Uri.parse('http://localhost:52792') - : Uri.parse('http://10.0.2.2:52792'), + ? Uri.parse('http://localhost:52794') + : Uri.parse('http://10.0.2.2:52794'), }; } @@ -34,8 +35,8 @@ class Celest with _$celest.CelestBase { late CelestEnvironment _currentEnvironment; - late final _$celest.NativeStorage nativeStorage = - _$celest.NativeStorage(scope: 'celest'); + late final _$native_storage.NativeStorage nativeStorage = + _$native_storage.NativeStorage(scope: 'celest'); @override late _$http.Client httpClient = diff --git a/packages/celest/example/celest/client/lib/src/functions.dart b/packages/celest/example/celest/client/lib/src/functions.dart index e194a14b..9bdae8ec 100644 --- a/packages/celest/example/celest/client/lib/src/functions.dart +++ b/packages/celest/example/celest/client/lib/src/functions.dart @@ -10,6 +10,9 @@ import 'package:celest/celest.dart' as _$celest; import 'package:celest_backend/exceptions/bad_name_exception.dart'; import 'package:celest_backend/models/person.dart'; import 'package:celest_core/celest_core.dart' as _$celest; +import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest; +import 'package:celest_core/src/exception/serialization_exception.dart' + as _$celest; import '../example_client.dart'; @@ -27,6 +30,60 @@ class CelestFunctionsGreeting { final $message = ($error['message'] as String?); final $details = ($error['details'] as _$celest.JsonMap?); switch ($code) { + case r'celest.core.v1.CloudException': + throw _$celest.Serializers.instance + .deserialize<_$celest.CloudException>($details); + case r'celest.core.v1.CancelledException': + throw _$celest.Serializers.instance + .deserialize<_$celest.CancelledException>($details); + case r'celest.core.v1.UnknownError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnknownError>($details); + case r'celest.core.v1.BadRequestException': + throw _$celest.Serializers.instance + .deserialize<_$celest.BadRequestException>($details); + case r'celest.core.v1.UnauthorizedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnauthorizedException>($details); + case r'celest.core.v1.NotFoundException': + throw _$celest.Serializers.instance + .deserialize<_$celest.NotFoundException>($details); + case r'celest.core.v1.AlreadyExistsException': + throw _$celest.Serializers.instance + .deserialize<_$celest.AlreadyExistsException>($details); + case r'celest.core.v1.PermissionDeniedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.PermissionDeniedException>($details); + case r'celest.core.v1.ResourceExhaustedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.ResourceExhaustedException>($details); + case r'celest.core.v1.FailedPreconditionException': + throw _$celest.Serializers.instance + .deserialize<_$celest.FailedPreconditionException>($details); + case r'celest.core.v1.AbortedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.AbortedException>($details); + case r'celest.core.v1.OutOfRangeException': + throw _$celest.Serializers.instance + .deserialize<_$celest.OutOfRangeException>($details); + case r'celest.core.v1.UnimplementedError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnimplementedError>($details); + case r'celest.core.v1.InternalServerError': + throw _$celest.Serializers.instance + .deserialize<_$celest.InternalServerError>($details); + case r'celest.core.v1.UnavailableError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnavailableError>($details); + case r'celest.core.v1.DataLossError': + throw _$celest.Serializers.instance + .deserialize<_$celest.DataLossError>($details); + case r'celest.core.v1.DeadlineExceededError': + throw _$celest.Serializers.instance + .deserialize<_$celest.DeadlineExceededError>($details); + case r'celest.core.v1.SerializationException': + throw _$celest.Serializers.instance + .deserialize<_$celest.SerializationException>($details); case r'example.v1.BadNameException': throw _$celest.Serializers.instance .deserialize($details); diff --git a/packages/celest/example/celest/client/lib/src/serializers.dart b/packages/celest/example/celest/client/lib/src/serializers.dart index 199f24ed..d10e1248 100644 --- a/packages/celest/example/celest/client/lib/src/serializers.dart +++ b/packages/celest/example/celest/client/lib/src/serializers.dart @@ -4,6 +4,10 @@ import 'package:celest_backend/exceptions/bad_name_exception.dart'; import 'package:celest_backend/models/person.dart'; import 'package:celest_core/celest_core.dart' as _$celest; +import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest; +import 'package:celest_core/src/exception/serialization_exception.dart' + as _$celest; +import 'package:celest_core/src/serialization/json_value.dart' as _$celest; void initSerializers() { _$celest.Serializers.instance @@ -20,4 +24,340 @@ void initSerializers() { return Person(name: ($serialized[r'name'] as String)); }, )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.AbortedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.AbortedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.AlreadyExistsException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.AlreadyExistsException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.BadRequestException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.BadRequestException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.CancelledException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.CancelledException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.CloudException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.CloudException.fromJson($serialized); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.DataLossError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.DataLossError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.DeadlineExceededError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.DeadlineExceededError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.FailedPreconditionException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.FailedPreconditionException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.InternalServerError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.InternalServerError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.NotFoundException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.NotFoundException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.OutOfRangeException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.OutOfRangeException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.PermissionDeniedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.PermissionDeniedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.ResourceExhaustedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.ResourceExhaustedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnauthorizedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnauthorizedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnavailableError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnavailableError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnimplementedError, Map?>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnimplementedError(($serialized?[r'message'] as String?)); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.UnknownError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnknownError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.SerializationException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'offset': $value.offset, + r'source': $value.source, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.SerializationException( + ($serialized[r'message'] as String)); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.JsonValue, Object>( + serialize: ($value) => $value.value, + deserialize: ($serialized) { + return _$celest.JsonValue($serialized); + }, + ), + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ); } diff --git a/packages/celest_auth/example/analysis_options.yaml b/packages/celest_auth/example/analysis_options.yaml index f9b30346..08041e3a 100644 --- a/packages/celest_auth/example/analysis_options.yaml +++ b/packages/celest_auth/example/analysis_options.yaml @@ -1 +1,5 @@ include: package:flutter_lints/flutter.yaml + +analyzer: + plugins: + - celest diff --git a/packages/celest_auth/example/celest/lib/client.dart b/packages/celest_auth/example/celest/client/lib/celest_auth_example_client.dart similarity index 72% rename from packages/celest_auth/example/celest/lib/client.dart rename to packages/celest_auth/example/celest/client/lib/celest_auth_example_client.dart index b0552841..af4dbfa0 100644 --- a/packages/celest_auth/example/celest/lib/client.dart +++ b/packages/celest_auth/example/celest/client/lib/celest_auth_example_client.dart @@ -7,13 +7,14 @@ library; // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _$async; import 'dart:io' as _$io; -import 'package:celest_core/_internal.dart'; -import 'package:celest_core/src/util/globals.dart'; +import 'package:celest_core/_internal.dart' as _$celest; +import 'package:celest_core/src/util/globals.dart' as _$celest; import 'package:http/http.dart' as _$http; +import 'package:native_storage/native_storage.dart' as _$native_storage; -import 'src/client/auth.dart'; -import 'src/client/functions.dart'; -import 'src/client/serializers.dart'; +import 'src/auth.dart'; +import 'src/functions.dart'; +import 'src/serializers.dart'; export 'package:celest_auth/celest_auth.dart'; @@ -23,23 +24,23 @@ enum CelestEnvironment { local; Uri get baseUri => switch (this) { - local => kIsWeb || !_$io.Platform.isAndroid - ? Uri.parse('http://localhost:7777') - : Uri.parse('http://10.0.2.2:7777'), + local => _$celest.kIsWeb || !_$io.Platform.isAndroid + ? Uri.parse('http://localhost:7780') + : Uri.parse('http://10.0.2.2:7780'), }; } -class Celest with CelestBase { +class Celest with _$celest.CelestBase { var _initialized = false; late CelestEnvironment _currentEnvironment; - @override - late final NativeStorage nativeStorage = NativeStorage(scope: 'celest'); + late final _$native_storage.NativeStorage nativeStorage = + _$native_storage.NativeStorage(scope: 'celest'); @override late _$http.Client httpClient = - CelestHttpClient(secureStorage: nativeStorage.secure); + _$celest.CelestHttpClient(secureStorage: nativeStorage.secure); late Uri _baseUri; diff --git a/packages/celest_auth/example/celest/client/lib/src/auth.dart b/packages/celest_auth/example/celest/client/lib/src/auth.dart new file mode 100644 index 00000000..3685eeac --- /dev/null +++ b/packages/celest_auth/example/celest/client/lib/src/auth.dart @@ -0,0 +1,22 @@ +// Generated by Celest. This file should not be modified manually, but +// it can be checked into version control. +// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import + +library; // ignore_for_file: no_leading_underscores_for_library_prefixes + +import 'package:celest_auth/celest_auth.dart' as _$celest; +import 'package:celest_auth/src/auth_impl.dart' as _$celest; +import 'package:celest_core/_internal.dart' as _$celest; +import 'package:native_storage/native_storage.dart' as _$native_storage; + +extension type CelestAuth._(_$celest.AuthImpl _hub) implements _$celest.Auth { + CelestAuth( + _$celest.CelestBase celest, { + required _$native_storage.NativeStorage storage, + }) : _hub = _$celest.AuthImpl( + celest, + storage: storage, + ); + + _$celest.Email get email => _$celest.Email(_hub); +} diff --git a/packages/celest_auth/example/celest/client/lib/src/functions.dart b/packages/celest_auth/example/celest/client/lib/src/functions.dart new file mode 100644 index 00000000..da325ecb --- /dev/null +++ b/packages/celest_auth/example/celest/client/lib/src/functions.dart @@ -0,0 +1,115 @@ +// Generated by Celest. This file should not be modified manually, but +// it can be checked into version control. +// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import + +library; // ignore_for_file: no_leading_underscores_for_library_prefixes + +import 'dart:convert' as _$convert; + +import 'package:celest/celest.dart' as _$celest; +import 'package:celest_core/celest_core.dart' as _$celest; +import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest; +import 'package:celest_core/src/exception/serialization_exception.dart' + as _$celest; + +import '../celest_auth_example_client.dart'; + +class CelestFunctions { + final greeting = CelestFunctionsGreeting(); +} + +class CelestFunctionsGreeting { + Never _throwError({ + required int $statusCode, + required Map $body, + }) { + final $error = ($body['error'] as Map); + final $code = ($error['code'] as String); + final $message = ($error['message'] as String?); + final $details = ($error['details'] as _$celest.JsonMap?); + switch ($code) { + case r'celest.core.v1.CloudException': + throw _$celest.Serializers.instance + .deserialize<_$celest.CloudException>($details); + case r'celest.core.v1.CancelledException': + throw _$celest.Serializers.instance + .deserialize<_$celest.CancelledException>($details); + case r'celest.core.v1.UnknownError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnknownError>($details); + case r'celest.core.v1.BadRequestException': + throw _$celest.Serializers.instance + .deserialize<_$celest.BadRequestException>($details); + case r'celest.core.v1.UnauthorizedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnauthorizedException>($details); + case r'celest.core.v1.NotFoundException': + throw _$celest.Serializers.instance + .deserialize<_$celest.NotFoundException>($details); + case r'celest.core.v1.AlreadyExistsException': + throw _$celest.Serializers.instance + .deserialize<_$celest.AlreadyExistsException>($details); + case r'celest.core.v1.PermissionDeniedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.PermissionDeniedException>($details); + case r'celest.core.v1.ResourceExhaustedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.ResourceExhaustedException>($details); + case r'celest.core.v1.FailedPreconditionException': + throw _$celest.Serializers.instance + .deserialize<_$celest.FailedPreconditionException>($details); + case r'celest.core.v1.AbortedException': + throw _$celest.Serializers.instance + .deserialize<_$celest.AbortedException>($details); + case r'celest.core.v1.OutOfRangeException': + throw _$celest.Serializers.instance + .deserialize<_$celest.OutOfRangeException>($details); + case r'celest.core.v1.UnimplementedError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnimplementedError>($details); + case r'celest.core.v1.InternalServerError': + throw _$celest.Serializers.instance + .deserialize<_$celest.InternalServerError>($details); + case r'celest.core.v1.UnavailableError': + throw _$celest.Serializers.instance + .deserialize<_$celest.UnavailableError>($details); + case r'celest.core.v1.DataLossError': + throw _$celest.Serializers.instance + .deserialize<_$celest.DataLossError>($details); + case r'celest.core.v1.DeadlineExceededError': + throw _$celest.Serializers.instance + .deserialize<_$celest.DeadlineExceededError>($details); + case r'celest.core.v1.SerializationException': + throw _$celest.Serializers.instance + .deserialize<_$celest.SerializationException>($details); + default: + throw _$celest.CloudException.http( + statusCode: $statusCode, + code: $code, + message: $message, + details: $details, + ); + } + } + + /// Says hello to the authenticated [user]. + @_$celest.CloudFunction( + api: 'greeting', + function: 'sayHello', + ) + Future sayHello() async { + final $response = await celest.httpClient.post( + celest.baseUri.resolve('/greeting/say-hello'), + headers: {'Content-Type': 'application/json; charset=utf-8'}, + ); + final $body = + (_$convert.jsonDecode($response.body) as Map); + if ($response.statusCode != 200) { + _throwError( + $statusCode: $response.statusCode, + $body: $body, + ); + } + return ($body['response'] as String); + } +} diff --git a/packages/celest_auth/example/celest/client/lib/src/serializers.dart b/packages/celest_auth/example/celest/client/lib/src/serializers.dart new file mode 100644 index 00000000..f7b52d22 --- /dev/null +++ b/packages/celest_auth/example/celest/client/lib/src/serializers.dart @@ -0,0 +1,347 @@ +// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:celest_core/celest_core.dart' as _$celest; +import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest; +import 'package:celest_core/src/exception/serialization_exception.dart' + as _$celest; +import 'package:celest_core/src/serialization/json_value.dart' as _$celest; + +void initSerializers() { + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.AbortedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.AbortedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.AlreadyExistsException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.AlreadyExistsException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.BadRequestException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.BadRequestException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.CancelledException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.CancelledException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.CloudException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.CloudException.fromJson($serialized); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.DataLossError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.DataLossError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.DeadlineExceededError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.DeadlineExceededError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.FailedPreconditionException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.FailedPreconditionException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.InternalServerError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.InternalServerError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.NotFoundException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.NotFoundException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.OutOfRangeException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.OutOfRangeException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.PermissionDeniedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.PermissionDeniedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.ResourceExhaustedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.ResourceExhaustedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnauthorizedException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnauthorizedException( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnavailableError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnavailableError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.UnimplementedError, Map?>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnimplementedError(($serialized?[r'message'] as String?)); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.UnknownError, Map>( + serialize: ($value) => { + r'message': $value.message, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.UnknownError( + ($serialized[r'message'] as String?), + details: _$celest.Serializers.instance.deserialize<_$celest.JsonValue?>( + $serialized[r'details'], + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + ); + }, + )); + _$celest.Serializers.instance.put(_$celest.Serializer.define< + _$celest.SerializationException, Map>( + serialize: ($value) => { + r'message': $value.message, + r'offset': $value.offset, + r'source': $value.source, + r'details': _$celest.Serializers.instance.serialize<_$celest.JsonValue?>( + $value.details, + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ), + }, + deserialize: ($serialized) { + return _$celest.SerializationException( + ($serialized[r'message'] as String)); + }, + )); + _$celest.Serializers.instance.put( + _$celest.Serializer.define<_$celest.JsonValue, Object>( + serialize: ($value) => $value.value, + deserialize: ($serialized) { + return _$celest.JsonValue($serialized); + }, + ), + const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'), + ); +} diff --git a/packages/celest_auth/example/celest/client/pubspec.yaml b/packages/celest_auth/example/celest/client/pubspec.yaml new file mode 100644 index 00000000..d5120d24 --- /dev/null +++ b/packages/celest_auth/example/celest/client/pubspec.yaml @@ -0,0 +1,17 @@ +name: celest_auth_example_client +description: The Celest client for celest_auth_example. +publish_to: none + +environment: + sdk: ^3.4.0 + +dependencies: + celest: ^0.5.0-0 + celest_backend: + path: ../ + celest_core: ^0.5.0-0 + http: ">=0.13.0 <2.0.0" + native_storage: ^0.2.2 + +dev_dependencies: + test: diff --git a/packages/celest_auth/example/celest/functions b/packages/celest_auth/example/celest/functions new file mode 120000 index 00000000..477c423e --- /dev/null +++ b/packages/celest_auth/example/celest/functions @@ -0,0 +1 @@ +/Users/dillonnys/celest/cloud/celest/packages/celest_auth/example/celest/lib/src/functions \ No newline at end of file diff --git a/packages/celest_auth/example/celest/generated b/packages/celest_auth/example/celest/generated new file mode 120000 index 00000000..f49daae1 --- /dev/null +++ b/packages/celest_auth/example/celest/generated @@ -0,0 +1 @@ +/Users/dillonnys/celest/cloud/celest/packages/celest_auth/example/celest/lib/src/generated \ No newline at end of file diff --git a/packages/celest_auth/example/celest/lib/fix_data/v1_migration.yaml b/packages/celest_auth/example/celest/lib/fix_data/v1_migration.yaml new file mode 100644 index 00000000..a9c181dc --- /dev/null +++ b/packages/celest_auth/example/celest/lib/fix_data/v1_migration.yaml @@ -0,0 +1,13 @@ +# Generated by Celest. Do not modify. +version: 1 +transforms: + - title: "Updates the import of the Celest client" + date: 2024-09-29 + element: + uris: ["client.dart"] + variable: celest + changes: + - kind: replacedBy + newElement: + uris: ["package:celest_auth_example_client/celest_auth_example_client.dart"] + variable: celest diff --git a/packages/celest_auth/example/celest/lib/src/client/auth.dart b/packages/celest_auth/example/celest/lib/src/client/auth.dart deleted file mode 100644 index 7170e7ae..00000000 --- a/packages/celest_auth/example/celest/lib/src/client/auth.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by Celest. This file should not be modified manually, but -// it can be checked into version control. -// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import - -library; // ignore_for_file: no_leading_underscores_for_library_prefixes - -import 'package:celest_auth/celest_auth.dart' as _$celest_auth; -import 'package:celest_auth/src/auth_impl.dart' as _$auth_impl; -import 'package:celest_core/_internal.dart'; - -extension type CelestAuth._(_$auth_impl.AuthImpl _hub) - implements _$celest_auth.Auth { - CelestAuth( - CelestBase celest, { - required NativeStorage storage, - }) : _hub = _$auth_impl.AuthImpl( - celest, - storage: storage, - ); - - _$auth_impl.Email get email => _$auth_impl.Email(_hub); -} diff --git a/packages/celest_auth/example/celest/lib/src/client/functions.dart b/packages/celest_auth/example/celest/lib/src/client/functions.dart deleted file mode 100644 index f1560448..00000000 --- a/packages/celest_auth/example/celest/lib/src/client/functions.dart +++ /dev/null @@ -1,63 +0,0 @@ -// Generated by Celest. This file should not be modified manually, but -// it can be checked into version control. -// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import - -library; // ignore_for_file: no_leading_underscores_for_library_prefixes - -import 'dart:convert' as _$convert; - -import 'package:celest/celest.dart'; -import 'package:celest_core/src/exception/cloud_exception.dart'; -import 'package:celest_core/src/exception/serialization_exception.dart'; - -import '../../client.dart'; - -class CelestFunctions { - final greeting = CelestFunctionsGreeting(); -} - -class CelestFunctionsGreeting { - Never _throwError({ - required int $statusCode, - required Map $body, - }) { - final $error = ($body['error'] as Map); - final $code = ($error['code'] as String); - final $details = ($error['details'] as Map?); - switch ($code) { - case r'BadRequestException': - throw Serializers.instance.deserialize($details); - case r'UnauthorizedException': - throw Serializers.instance.deserialize($details); - case r'InternalServerError': - throw Serializers.instance.deserialize($details); - case r'SerializationException': - throw Serializers.instance - .deserialize($details); - case _: - switch ($statusCode) { - case 400: - throw BadRequestException($code); - case _: - throw InternalServerError($code); - } - } - } - - /// Says hello to the authenticated [user]. - Future sayHello() async { - final $response = await celest.httpClient.post( - celest.baseUri.resolve('/greeting/say-hello'), - headers: const {'Content-Type': 'application/json; charset=utf-8'}, - ); - final $body = - (_$convert.jsonDecode($response.body) as Map); - if ($response.statusCode != 200) { - _throwError( - $statusCode: $response.statusCode, - $body: $body, - ); - } - return ($body['response'] as String); - } -} diff --git a/packages/celest_auth/example/celest/lib/src/client/serializers.dart b/packages/celest_auth/example/celest/lib/src/client/serializers.dart deleted file mode 100644 index 7a68dcbf..00000000 --- a/packages/celest_auth/example/celest/lib/src/client/serializers.dart +++ /dev/null @@ -1,41 +0,0 @@ -// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import - -import 'package:celest/celest.dart'; -import 'package:celest_core/src/exception/cloud_exception.dart'; -import 'package:celest_core/src/exception/serialization_exception.dart'; - -void initSerializers() { - Serializers.instance - .put(Serializer.define>( - serialize: ($value) => {r'message': $value.message}, - deserialize: ($serialized) { - return BadRequestException(($serialized[r'message'] as String)); - }, - )); - Serializers.instance - .put(Serializer.define>( - serialize: ($value) => {r'message': $value.message}, - deserialize: ($serialized) { - return InternalServerError(($serialized[r'message'] as String)); - }, - )); - Serializers.instance - .put(Serializer.define?>( - serialize: ($value) => {r'message': $value.message}, - deserialize: ($serialized) { - return UnauthorizedException( - (($serialized?[r'message'] as String?)) ?? 'Unauthorized'); - }, - )); - Serializers.instance - .put(Serializer.define>( - serialize: ($value) => { - r'message': $value.message, - r'offset': $value.offset, - r'source': $value.source, - }, - deserialize: ($serialized) { - return SerializationException(($serialized[r'message'] as String)); - }, - )); -} diff --git a/packages/celest_auth/example/celest/functions/greeting.dart b/packages/celest_auth/example/celest/lib/src/functions/greeting.dart similarity index 100% rename from packages/celest_auth/example/celest/functions/greeting.dart rename to packages/celest_auth/example/celest/lib/src/functions/greeting.dart diff --git a/packages/celest_auth/example/celest/generated/README.md b/packages/celest_auth/example/celest/lib/src/generated/README.md similarity index 100% rename from packages/celest_auth/example/celest/generated/README.md rename to packages/celest_auth/example/celest/lib/src/generated/README.md diff --git a/packages/celest_auth/example/celest/generated/resources.dart b/packages/celest_auth/example/celest/lib/src/generated/resources.dart similarity index 100% rename from packages/celest_auth/example/celest/generated/resources.dart rename to packages/celest_auth/example/celest/lib/src/generated/resources.dart diff --git a/packages/celest_auth/example/celest/pubspec.yaml b/packages/celest_auth/example/celest/pubspec.yaml index 8ded696f..ad55ebc0 100644 --- a/packages/celest_auth/example/celest/pubspec.yaml +++ b/packages/celest_auth/example/celest/pubspec.yaml @@ -3,13 +3,12 @@ description: The Celest backend for celest_auth_example. publish_to: none environment: - sdk: ^3.3.0 + sdk: ^3.4.0 dependencies: celest: ^0.5.0-0 http: ">=0.13.0 <2.0.0" - celest_core: any celest_auth: any dependency_overrides: celest: diff --git a/packages/celest_auth/example/lib/main.dart b/packages/celest_auth/example/lib/main.dart index de8393c7..23c6c9ee 100644 --- a/packages/celest_auth/example/lib/main.dart +++ b/packages/celest_auth/example/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:celest_backend/client.dart'; +import 'package:celest_auth_example_client/celest_auth_example_client.dart'; import 'package:flutter/material.dart'; void main() { diff --git a/packages/celest_auth/example/pubspec.yaml b/packages/celest_auth/example/pubspec.yaml index c821eff6..c16c2a42 100644 --- a/packages/celest_auth/example/pubspec.yaml +++ b/packages/celest_auth/example/pubspec.yaml @@ -7,8 +7,8 @@ environment: sdk: ">=3.3.0 <4.0.0" dependencies: - celest_backend: - path: celest/ + celest_auth_example_client: + path: celest/client/ flutter: sdk: flutter flutter_state_notifier: ^1.0.0 diff --git a/packages/celest_auth/lib/src/auth_impl.dart b/packages/celest_auth/lib/src/auth_impl.dart index 2183506c..449ca8b6 100644 --- a/packages/celest_auth/lib/src/auth_impl.dart +++ b/packages/celest_auth/lib/src/auth_impl.dart @@ -11,6 +11,7 @@ import 'package:celest_cloud/celest_cloud.dart' as celest_cloud; import 'package:celest_core/_internal.dart'; import 'package:celest_core/celest_core.dart'; import 'package:native_authentication/native_authentication.dart'; +import 'package:native_storage/native_storage.dart'; import 'package:stream_transform/stream_transform.dart'; export 'flows/email_flow.dart'; diff --git a/packages/celest_auth/lib/src/model/initial_uri.flutter.dart b/packages/celest_auth/lib/src/model/initial_uri.flutter.dart index 0c5cff3b..8b178820 100644 --- a/packages/celest_auth/lib/src/model/initial_uri.flutter.dart +++ b/packages/celest_auth/lib/src/model/initial_uri.flutter.dart @@ -1,3 +1,4 @@ +// ignore: uri_does_not_exist import 'dart:ui' as ui; final Uri? initialUri = diff --git a/packages/celest_auth/pubspec.yaml b/packages/celest_auth/pubspec.yaml index 0013bfa7..9b8731ba 100644 --- a/packages/celest_auth/pubspec.yaml +++ b/packages/celest_auth/pubspec.yaml @@ -22,6 +22,7 @@ dependencies: logging: ^1.2.0 meta: ^1.9.0 native_authentication: ^0.1.0+2 + native_storage: ^0.2.2 os_detect: ^2.0.1 path: ^1.9.0 shelf: ^1.4.1 diff --git a/packages/celest_core/lib/_internal.dart b/packages/celest_core/lib/_internal.dart index 07fcd444..08f99fd8 100644 --- a/packages/celest_core/lib/_internal.dart +++ b/packages/celest_core/lib/_internal.dart @@ -1,5 +1,3 @@ -export 'package:native_storage/native_storage.dart'; - export 'src/auth/authenticator.dart'; export 'src/base/celest_base.dart'; export 'src/events/sse/sse_client.dart'; diff --git a/packages/celest_core/lib/src/auth/authenticator.dart b/packages/celest_core/lib/src/auth/authenticator.dart index 7a79bf4c..43b03528 100644 --- a/packages/celest_core/lib/src/auth/authenticator.dart +++ b/packages/celest_core/lib/src/auth/authenticator.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:celest_core/_internal.dart'; +import 'package:native_storage/native_storage.dart'; typedef OnRevoke = FutureOr Function(); diff --git a/packages/celest_core/lib/src/http/celest_http_client.dart b/packages/celest_core/lib/src/http/celest_http_client.dart index 71ca0317..c86d88c1 100644 --- a/packages/celest_core/lib/src/http/celest_http_client.dart +++ b/packages/celest_core/lib/src/http/celest_http_client.dart @@ -3,6 +3,7 @@ import 'package:celest_core/src/http/http_client.vm.dart' if (dart.library.js_interop) 'package:celest_core/src/http/http_client.web.dart'; import 'package:http/http.dart' as http; import 'package:logging/logging.dart'; +import 'package:native_storage/native_storage.dart'; final class CelestHttpClient extends http.BaseClient { CelestHttpClient({