From 48e294f5c20932a942c32190758ddf129ac06d48 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 19 Oct 2018 13:00:35 -0400 Subject: [PATCH] 2.0.0 bump --- CHANGELOG.md | 5 +++++ lib/angel_file_service.dart | 23 ++++++++++++++--------- pubspec.yaml | 11 +++++------ test/all_test.dart | 1 - 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d81bd143..627d3bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.0.0 +* Dart/Angel 2 update. +* Remove `package:dart2_constant` +* Update `package:file` to `^5.0.0`. + # 1.1.2 * Added tests, because tests. diff --git a/lib/angel_file_service.dart b/lib/angel_file_service.dart index 11a7957f..028f202b 100644 --- a/lib/angel_file_service.dart +++ b/lib/angel_file_service.dart @@ -1,11 +1,11 @@ import 'dart:async'; +import 'dart:convert'; import 'package:angel_framework/angel_framework.dart'; -import 'package:dart2_constant/convert.dart'; import 'package:file/file.dart'; import 'package:pool/pool.dart'; /// Persists in-memory changes to a file on disk. -class JsonFileService extends Service { +class JsonFileService extends Service> { FileStat _lastStat; final Pool _mutex = new Pool(1); MapService _store; @@ -58,15 +58,17 @@ class JsonFileService extends Service { } @override - Future index([Map params]) async => + Future>> index( + [Map params]) async => _load().then((_) => _store.index(params)); @override - Future read(id, [Map params]) => + Future> read(id, [Map params]) => _load().then((_) => _store.read(id, params)); @override - Future create(data, [Map params]) async { + Future> create(data, + [Map params]) async { await _load(); var created = await _store.create(data, params); await _save(); @@ -74,7 +76,7 @@ class JsonFileService extends Service { } @override - Future remove(id, [Map params]) async { + Future> remove(id, [Map params]) async { await _load(); var r = await _store.remove(id, params); await _save(); @@ -82,7 +84,8 @@ class JsonFileService extends Service { } @override - Future update(id, data, [Map params]) async { + Future> update(id, data, + [Map params]) async { await _load(); var r = await _store.update(id, data, params); await _save(); @@ -90,7 +93,8 @@ class JsonFileService extends Service { } @override - Future modify(id, data, [Map params]) async { + Future> modify(id, data, + [Map params]) async { await _load(); var r = await _store.update(id, data, params); await _save(); @@ -117,7 +121,8 @@ Map _jsonify(Map map) { dynamic _revive(x) { if (x is Map) { - return x.keys.fold({}, (out, k) => out..[k] = _revive(x[k])); + return x.keys.fold>( + {}, (out, k) => out..[k.toString()] = _revive(x[k])); } else if (x is Iterable) return x.map(_revive).toList(); else if (x is String) { diff --git a/pubspec.yaml b/pubspec.yaml index 611b646c..472d62c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,14 +1,13 @@ name: angel_file_service -version: 1.1.2 +version: 2.0.0 description: Angel service that persists data to a file on disk. author: Tobe O homepage: https://github.com/angel-dart/file_service environment: - sdk: ">=1.8.0 <3.0.0" + sdk: ">=2.0.0-dev <3.0.0" dependencies: - angel_framework: ^1.1.0-alpha - dart2_constant: ^1.0.0 - file: ^2.0.0 + angel_framework: ^2.0.0-alpha + file: ^5.0.0 pool: ^1.0.0 dev_dependencies: - test: \ No newline at end of file + test: ^1.0.0 \ No newline at end of file diff --git a/test/all_test.dart b/test/all_test.dart index c266fdfd..2936201a 100644 --- a/test/all_test.dart +++ b/test/all_test.dart @@ -1,5 +1,4 @@ import 'package:angel_file_service/angel_file_service.dart'; -import 'package:angel_framework/angel_framework.dart'; import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:test/test.dart';