Skip to content

Commit

Permalink
Fix minor ci fixes (#227)
Browse files Browse the repository at this point in the history
* refactor: Tinkering with the codable package

* some ci changes and templates needed update
  • Loading branch information
j4qfrost authored May 21, 2024
1 parent a661f35 commit d2ff885
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
branch: master
- name: Compute the release tag
run: |
echo "release_tag=v`cat packages/cli/pubspec.yaml | sed -nre 's/^version: [^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'`" >> $GITHUB_ENV
echo "release_tag=v`cat pubspec.yaml | sed -nre 's/^version: [^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'`" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions ci/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3.3"

services:
postgres:
image: postgres:14.5
image: postgres:16.2
# command: -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
container_name: conduit_postgres
restart: always
Expand All @@ -14,5 +14,5 @@ services:
ports:
- 0.0.0.0:15432:5432
volumes:
- ./ssl/server.crt:/var/lib/postgresql/server.crt:ro
- ./ssl/server.key:/var/lib/postgresql/server.key:ro
- ./ssl/server.crt:/var/lib/postgresql/server.crt:ro
- ./ssl/server.key:/var/lib/postgresql/server.key:ro
8 changes: 4 additions & 4 deletions packages/cli/templates/db/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ environment:
sdk: ">=3.4.0 <4.0.0"

dependencies:
conduit: ^5.0.1
conduit_core: ^5.0.1
conduit_postgresql: ^5.0.1
conduit: ^5.1.0
conduit_core: ^5.1.0
conduit_postgresql: ^5.1.0

dev_dependencies:
test: ^1.25.2
conduit_test: ^5.0.1
conduit_test: ^5.1.0
9 changes: 5 additions & 4 deletions packages/cli/templates/db_and_auth/lib/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:wildfire/controller/register_controller.dart';
import 'package:wildfire/controller/user_controller.dart';
import 'package:wildfire/model/user.dart';
import 'package:wildfire/utility/html_template.dart';

import 'package:wildfire/wildfire.dart';

/// This type initializes an application.
Expand All @@ -12,7 +13,7 @@ import 'package:wildfire/wildfire.dart';
class WildfireChannel extends ApplicationChannel
implements AuthRedirectControllerDelegate {
final HTMLRenderer htmlRenderer = HTMLRenderer();
late final authServer;
late final AuthServer authServer;
late ManagedContext context;

/// Initialize services in this method.
Expand Down Expand Up @@ -55,19 +56,19 @@ class WildfireChannel extends ApplicationChannel
router
.route("/register")
.link(() => Authorizer.basic(authServer))!
.link(() => RegisterController(context!, authServer));
.link(() => RegisterController(context, authServer));

/* Gets profile for user with bearer token */
router
.route("/me")
.link(() => Authorizer.bearer(authServer))!
.link(() => IdentityController(context!));
.link(() => IdentityController(context));

/* Gets all users or one specific user by id */
router
.route("/users/[:id]")
.link(() => Authorizer.bearer(authServer))!
.link(() => UserController(context!, authServer));
.link(() => UserController(context, authServer));

return router;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/templates/db_and_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ environment:
sdk: ">=3.4.0 <4.0.0"

dependencies:
conduit: ^5.0.1
conduit_core: ^5.0.1
conduit_postgresql: ^5.0.1
conduit: ^5.1.0
conduit_core: ^5.1.0
conduit_postgresql: ^5.1.0

dev_dependencies:
test: ^1.25.2
conduit_test: ^5.0.1
conduit_test: ^5.1.0
6 changes: 3 additions & 3 deletions packages/cli/templates/default/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ environment:
sdk: ">=3.4.0 <4.0.0"

dependencies:
conduit: ^5.0.1
conduit_core: ^5.0.1
conduit: ^5.1.0
conduit_core: ^5.1.0

dev_dependencies:
test: ^1.25.2
conduit_test: ^5.0.1
conduit_test: ^5.1.0
10 changes: 5 additions & 5 deletions packages/codable/lib/cast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,24 @@ class List<E> extends Cast<core.List<E?>> {
}
}

class Keyed<K, V> extends Cast<core.Map<K, V?>> {
class Keyed<K, V> extends Cast<core.Map<K, V>> {
Iterable<K> get keys => _map.keys;
final core.Map<K, Cast<V>> _map;
const Keyed(core.Map<K, Cast<V>> map) : _map = map;
@override
core.Map<K, V?> _cast(dynamic from, core.String context, dynamic key) {
final core.Map<K, V?> result = {};
core.Map<K, V> _cast(dynamic from, core.String context, dynamic key) {
final core.Map<K, V> result = {};
if (from is core.Map) {
for (final K key in from.keys as core.Iterable<K>) {
if (_map.containsKey(key)) {
result[key] = _map[key]!._cast(from[key], "map entry", key);
} else {
result[key] = from[key] as V?;
result[key] = from[key] as V;
}
}
return result;
}
return throw FailedCast(context, key, "not a map");
throw FailedCast(context, key, "not a map");
}
}

Expand Down
9 changes: 3 additions & 6 deletions packages/codable/lib/src/keyed_archive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import 'package:conduit_codable/src/resolver.dart';
/// final json = json.encode(archive);
///
class KeyedArchive extends Object
with MapMixin<String, dynamic>
with MapBase<String, dynamic>
implements Referencable {
/// Use [unarchive] instead.
KeyedArchive(this._map) {
Expand Down Expand Up @@ -391,11 +391,8 @@ class KeyedArchive extends Object
///
/// This invokes [Coding.encode] on each value in [value] and adds the map of objects
/// to this archive for the key [key].
void encodeObjectMap<T extends Coding?>(String key, Map<String, T>? value) {
if (value == null) {
return;
}

void encodeObjectMap<T extends Coding>(String key, Map<String, T?>? value) {
if (value == null) return;
final object = KeyedArchive({});
value.forEach((k, v) {
object[k] = _encodedObject(v);
Expand Down
2 changes: 1 addition & 1 deletion packages/codable/lib/src/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:conduit_codable/src/resolver.dart';
///
/// This object is a [List] that has additional behavior for encoding and decoding [Coding] objects.
class ListArchive extends Object
with ListMixin<dynamic>
with ListBase<dynamic>
implements Referencable {
final List<dynamic> _inner;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: conduit_workspace
version: 5.1.0
version: 5.1.1
home: https://www.theconduit.dev
repository: https://github.com/conduit-dart/conduit
issue_tracker: https://github.com/conduit-dart/conduit/issues
Expand Down

0 comments on commit d2ff885

Please sign in to comment.