This commit is contained in:
Tobe O 2018-06-03 21:35:44 -04:00
parent 550a334c66
commit 1207881c71
6 changed files with 24 additions and 19 deletions

1
.gitignore vendored
View file

@ -27,3 +27,4 @@ doc/api/
pubspec.lock pubspec.lock
rethinkdb_data/ rethinkdb_data/
.idea

3
CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
# 1.1.0
* Moved to `package:rethinkdb_driver`
* Fixed references to old hooked event names.

View file

@ -1,8 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; //import 'dart:io';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'package:json_god/json_god.dart' as god; import 'package:json_god/json_god.dart' as god;
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart'; import 'package:rethinkdb_driver/rethinkdb_driver.dart';
// Extends a RethinkDB query. // Extends a RethinkDB query.
typedef RqlQuery QueryCallback(RqlQuery query); typedef RqlQuery QueryCallback(RqlQuery query);
@ -130,21 +130,21 @@ class RethinkService extends Service {
hookedService.fireEvent( hookedService.fireEvent(
hookedService.afterCreated, hookedService.afterCreated,
new HookedServiceEvent( new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.CREATED, true, null, null, this, HookedServiceEvent.created,
result: newVal)); result: newVal));
} else if (type == 'change') { } else if (type == 'change') {
// Update // Update
hookedService.fireEvent( hookedService.fireEvent(
hookedService.afterCreated, hookedService.afterCreated,
new HookedServiceEvent( new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.UPDATED, true, null, null, this, HookedServiceEvent.updated,
result: newVal, id: oldVal['id'], data: newVal)); result: newVal, id: oldVal['id'], data: newVal));
} else if (type == 'remove') { } else if (type == 'remove') {
// Remove // Remove
hookedService.fireEvent( hookedService.fireEvent(
hookedService.afterCreated, hookedService.afterCreated,
new HookedServiceEvent( new HookedServiceEvent(
true, null, null, this, HookedServiceEventREMOVED, true, null, null, this, HookedServiceEvent.removed,
result: oldVal, id: oldVal['id'])); result: oldVal, id: oldVal['id']));
} }
}); });
@ -187,7 +187,7 @@ class RethinkService extends Service {
try { try {
await read(d['id'], params); await read(d['id'], params);
} on AngelHttpException catch (e) { } on AngelHttpException catch (e) {
if (e.statusCode == HttpStatus.NOT_FOUND) if (e.statusCode == 404)
return await create(data, params); return await create(data, params);
else else
rethrow; rethrow;
@ -207,7 +207,7 @@ class RethinkService extends Service {
try { try {
await read(d['id'], params); await read(d['id'], params);
} on AngelHttpException catch (e) { } on AngelHttpException catch (e) {
if (e.statusCode == HttpStatus.NOT_FOUND) if (e.statusCode == 404)
return await create(data, params); return await create(data, params);
else else
rethrow; rethrow;

View file

@ -1,13 +1,16 @@
name: angel_rethink name: angel_rethink
version: 1.0.7 version: 1.1.0
description: RethinkDB-enabled services for the Angel framework. description: RethinkDB-enabled services for the Angel framework.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
environment: environment:
sdk: ">=1.19.0" sdk: ">=1.19.0 <3.0.0"
homepage: https://github.com/angel-dart/rethink homepage: https://github.com/angel-dart/rethink
dependencies: dependencies:
angel_framework: ^1.0.0-dev angel_framework: ^1.1.0
rethinkdb_driver2: ^2.3.1 json_god: ^2.0.0-beta
rethinkdb_driver: ^2.3.1
dev_dependencies: dev_dependencies:
angel_test: ^1.0.0-dev angel_client: ^1.1.0
angel_test: ^1.1.0
logging: ^0.11.3
test: ^0.12.0 test: ^0.12.0

View file

@ -1,5 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart'; import 'package:rethinkdb_driver/rethinkdb_driver.dart';
main() async { main() async {
var r = new Rethinkdb(); var r = new Rethinkdb();

View file

@ -2,7 +2,8 @@ import 'package:angel_client/angel_client.dart' as c;
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'package:angel_rethink/angel_rethink.dart'; import 'package:angel_rethink/angel_rethink.dart';
import 'package:angel_test/angel_test.dart'; import 'package:angel_test/angel_test.dart';
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart'; import 'package:logging/logging.dart';
import 'package:rethinkdb_driver/rethinkdb_driver.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'common.dart'; import 'common.dart';
@ -23,10 +24,7 @@ main() {
print('Whoops: $e'); print('Whoops: $e');
}; };
app.fatalErrorStream.listen((e) { app.logger = new Logger.detached('angel')..onRecord.listen(print);
print('Whoops: ${e.error}');
print(e.stack);
});
client = await connectTo(app); client = await connectTo(app);
todoService = client.service('todos'); todoService = client.service('todos');