diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ff6e9f1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: dart -sudo: required -dart: - - stable - - beta - - dev -before_script: - - cd repo_support - - dart pub get -script: - - dart run tool/run_ci.dart diff --git a/auth_node/pubspec.yaml b/auth_node/pubspec.yaml index 99af928..57b0e3f 100644 --- a/auth_node/pubspec.yaml +++ b/auth_node/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.9.1 publish_to: none environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: collection: '>=1.14.10' diff --git a/firebase_node/pubspec.yaml b/firebase_node/pubspec.yaml index cdfebc6..2d3034a 100644 --- a/firebase_node/pubspec.yaml +++ b/firebase_node/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none #author: alex environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: collection: '>=1.14.10' diff --git a/firestore_node/lib/src/firestore_node.dart b/firestore_node/lib/src/firestore_node.dart index 62e4726..f642160 100644 --- a/firestore_node/lib/src/firestore_node.dart +++ b/firestore_node/lib/src/firestore_node.dart @@ -162,8 +162,14 @@ abstract class QueryMixin implements Query { Query limit(int limit) => _wrapQuery(nativeInstance.limit(limit)); @override - Query orderBy(String key, {bool? descending}) => - _wrapQuery(nativeInstance.orderBy(key, descending: descending == true)); + Query orderBy(String key, {bool? descending}) { + if (key == firestoreNameFieldPath) { + return _wrapQuery( + nativeInstance.orderByKey(descending: descending == true)); + } + return _wrapQuery( + nativeInstance.orderBy(key, descending: descending == true)); + } @override QueryNode startAt({DocumentSnapshot? snapshot, List? values}) => @@ -217,7 +223,7 @@ abstract class QueryMixin implements Query { } @override - Stream onSnapshot() { + Stream onSnapshot({bool includeMetadataChanges = false}) { var transformer = StreamTransformer.fromHandlers(handleData: (node.QuerySnapshot nativeQuerySnapshot, EventSink sink) { @@ -442,7 +448,7 @@ class DocumentReferenceNode implements DocumentReference { String get path => nativeInstance.path; @override - Stream onSnapshot() { + Stream onSnapshot({bool includeMetadataChanges = false}) { var transformer = StreamTransformer.fromHandlers(handleData: (node.DocumentSnapshot nativeDocumentSnapshot, EventSink sink) { @@ -470,7 +476,9 @@ class DocumentReferenceNode implements DocumentReference { } } -class DocumentSnapshotNode implements DocumentSnapshot { +class DocumentSnapshotNode + with DocumentSnapshotMixin + implements DocumentSnapshot { final node.DocumentSnapshot nativeInstance; DocumentSnapshotNode(this.nativeInstance); diff --git a/firestore_node/pubspec.yaml b/firestore_node/pubspec.yaml index 1dd92e9..623141c 100644 --- a/firestore_node/pubspec.yaml +++ b/firestore_node/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.10.0 publish_to: none environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: collection: '>=1.14.10' @@ -59,4 +59,4 @@ dependency_overrides: # tekartik_firebase_firestore_test: # path: ../../firebase_firestore.dart/firestore_test # firebase_admin_interop: - # path: ../../../tekartikdev/firebase-admin-interop + # path: ../../../tekartikdev/firebase-admin-interop \ No newline at end of file diff --git a/firestore_node/tool/travis.dart b/firestore_node/tool/travis.dart deleted file mode 100644 index 2d2cad0..0000000 --- a/firestore_node/tool/travis.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:process_run/shell.dart'; - -Future main() async { - var shell = Shell(); - - await shell.run(''' -dartanalyzer --fatal-warnings --fatal-infos . -dartfmt -n --set-exit-if-changed . -pub run test -p vm -'''); - // await nodeRunTest(); -} diff --git a/functions_node/bin/main.dart b/functions_node/bin/main.dart index 7453764..5c4dd5a 100644 --- a/functions_node/bin/main.dart +++ b/functions_node/bin/main.dart @@ -10,6 +10,9 @@ Future main() async { firebaseFunctionsUniversal['thelloworldv2'] = firebaseFunctionsUniversalV2 .https .onRequestV2(HttpsOptions(region: regionBelgium), helloWorld); + firebaseFunctionsUniversal['thelloworldcorsv2'] = firebaseFunctionsUniversalV2 + .https + .onRequestV2(HttpsOptions(region: regionBelgium, cors: true), helloWorld); await firebaseFunctionsUniversal.serve(); print('serving...'); } diff --git a/functions_node/build.yaml b/functions_node/build.yaml index 9aefeea..341be6b 100644 --- a/functions_node/build.yaml +++ b/functions_node/build.yaml @@ -6,10 +6,12 @@ targets: - test/** - node/** - bin/** + - example/** builders: build_web_compilers|entrypoint: generate_for: - bin/** + - example/** options: compiler: dart2js diff --git a/functions_node/deploy/functions/package.json b/functions_node/deploy/functions/package.json index beabe69..79696dc 100644 --- a/functions_node/deploy/functions/package.json +++ b/functions_node/deploy/functions/package.json @@ -13,7 +13,7 @@ }, "main": "index.js", "dependencies": { - "firebase-functions": "^4.1.1" + "firebase-functions": "^4.2.1" }, "devDependencies": { "firebase-functions-test": "^0.2.0" diff --git a/functions_node/example/client/index.html b/functions_node/example/client/index.html new file mode 100644 index 0000000..c1d849b --- /dev/null +++ b/functions_node/example/client/index.html @@ -0,0 +1,11 @@ + + + + test_menu_starter + + + + + + + diff --git a/functions_node/example/client/main.dart b/functions_node/example/client/main.dart new file mode 100644 index 0000000..0544254 --- /dev/null +++ b/functions_node/example/client/main.dart @@ -0,0 +1,52 @@ +// ignore_for_file: depend_on_referenced_packages + +import 'package:http/http.dart'; +import 'package:tekartik_http/http.dart'; +import 'package:tekartik_test_menu_browser/test_menu_universal.dart'; + +Future main(List arguments) async { + await mainMenu(arguments, () { + item('io http hello v2', () async { + // This test cors on the web + var client = Client(); + var result = await httpClientRead( + client, + httpMethodGet, + Uri.parse('http://localhost:4999/thelloworldv2'), + ); + write('result: $result'); + }); + item('io http hello v2 cors', () async { + // This test cors on the web + var client = Client(); + var result = await httpClientRead( + client, + httpMethodPost, + Uri.parse('http://localhost:4999/thelloworldcorsv2'), + ); + write('result: $result'); + }); + item('local firebase http hello v2', () async { + // This test cors on the web + var client = Client(); + var result = await httpClientRead( + client, + httpMethodGet, + Uri.parse( + 'http://localhost:5000/tekartik-eu-dev/europe-west1/thelloworldv2'), + ); + write('result: $result'); + }); + item('local firebase http hello v2 cors', () async { + // This test cors on the web + var client = Client(); + var result = await httpClientRead( + client, + httpMethodPost, + Uri.parse( + 'http://localhost:5000/tekartik-eu-dev/europe-west1/thelloworldcorsv2'), + ); + write('result: $result'); + }); + }); +} diff --git a/functions_node/example/index.html b/functions_node/example/index.html new file mode 100644 index 0000000..d0f5a2c --- /dev/null +++ b/functions_node/example/index.html @@ -0,0 +1,14 @@ + + + + + Index + + + + + \ No newline at end of file diff --git a/functions_node/lib/src/firebase_functions_https_node.dart b/functions_node/lib/src/firebase_functions_https_node.dart index c924475..f1945d1 100644 --- a/functions_node/lib/src/firebase_functions_https_node.dart +++ b/functions_node/lib/src/firebase_functions_https_node.dart @@ -35,7 +35,9 @@ class HttpsFunctionsNode } return HttpsFunctionNode(functions.implFunctions.https.onRequestV2( - impl.HttpsOptions(region: httpsOptions.region ?? httpsOptions.regions), + impl.HttpsOptions( + region: httpsOptions.region ?? httpsOptions.regions, + cors: httpsOptions.cors), handleRequest)); } diff --git a/functions_node/pubspec.yaml b/functions_node/pubspec.yaml index 8c39b45..dad96f7 100644 --- a/functions_node/pubspec.yaml +++ b/functions_node/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none #author: alex environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: tekartik_firebase_functions: @@ -14,13 +14,13 @@ dependencies: url: https://github.com/tekartik/firebase_functions.dart path: firebase_functions ref: dart2_3 - version: '>=0.4.0' + version: '>=0.4.1' tekartik_firebase_functions_io: git: url: https://github.com/tekartik/firebase_functions.dart path: firebase_functions_io ref: dart2_3 - version: '>=0.4.0' + version: '>=0.4.1' tekartik_firebase_firestore_node: git: url: https://github.com/tekartik/firebase_node.dart @@ -57,6 +57,12 @@ dependencies: ref: dart2_3 version: '>=0.4.0' dev_dependencies: + tekartik_test_menu_browser: + git: + url: https://github.com/tekartik/test_menu.dart + path: test_menu_browser + ref: dart2_3 + version: '>=0.4.7' tekartik_app_node_build: git: url: https://github.com/tekartik/app_node_utils.dart @@ -71,7 +77,6 @@ dev_dependencies: version: '>=0.3.0' test: '>=1.2.0' dev_test: '>=0.13.3+12' - grinder: any tekartik_build_utils: git: url: https://github.com/tekartik/build_utils.dart diff --git a/functions_node/tool/grind.dart b/functions_node/tool/grind.dart deleted file mode 100644 index 91257fc..0000000 --- a/functions_node/tool/grind.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:grinder/grinder.dart'; -import 'package:tekartik_build_utils/common_import.dart'; - -import '../test/firebase_functions_node_test.dart'; - -// ignore_for_file: non_constant_identifier_names -Future main(List args) => grind(args); - -@Task() -Future test() => TestRunner().testAsync(); - -@Depends(test) -void build() { - Pub.build(); -} - -String projectIdDev = 'tekartik-free-dev'; -String projectId = projectIdDev; - -@DefaultTask() -Future firebase_serve() async { - await runCmd(PubCmd([ - 'run', - 'build_runner', - 'build', - '--output', - 'node_functions:$buildFolder' - ])); - copy(File(join(buildFolder, 'index.dart.js')), Directory('functions')); - await runCmd(FirebaseCmd(firebaseArgs(serve: true, onlyFunctions: true))); -} - -@Task() -void clean() => defaultClean(); - -@Task() -Future build_test() async { - //await Pub.build(directories: [binDir.path]); - await runCmd(PubCmd( - pubRunArgs(['build_runner', 'build', '--output', 'test:build/test']))); - //await copy_build(); -} - -@Task() -Future watch() async { - await runCmd(PubCmd( - pubRunArgs(['build_runner', 'watch', '--output', 'test:build/test']))); -} diff --git a/functions_node/tool/travis.dart b/functions_node/tool/travis.dart deleted file mode 100644 index bdfc783..0000000 --- a/functions_node/tool/travis.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:dev_test/package.dart'; - -import 'build_bin.dart'; - -Future main() async { - await packageRunCi('.'); - /* - var shell = Shell(); - - await shell.run(''' - # Analyze code - dartanalyzer --fatal-warnings --fatal-infos lib test tool node_functions - dartfmt -n --set-exit-if-changed lib test tool node_functions - - pub run test -p vm -'''); - */ - await build(); -} diff --git a/pubsub_node/pubspec.yaml b/pubsub_node/pubspec.yaml index 23dbec4..24ab93f 100644 --- a/pubsub_node/pubspec.yaml +++ b/pubsub_node/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.2.0 publish_to: none environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: js: '>=0.6.1+1' diff --git a/repo_support/pubspec.yaml b/repo_support/pubspec.yaml index b91ce13..22fcfad 100644 --- a/repo_support/pubspec.yaml +++ b/repo_support/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.2.0 publish_to: none environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dev_dependencies: path: diff --git a/storage_node/pubspec.yaml b/storage_node/pubspec.yaml index 51dd447..949b789 100644 --- a/storage_node/pubspec.yaml +++ b/storage_node/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none #author: alex environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: path: diff --git a/storage_node/tool/travis.dart b/storage_node/tool/travis.dart deleted file mode 100644 index 26d4e7b..0000000 --- a/storage_node/tool/travis.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:process_run/shell.dart'; - -Future main() async { - var shell = Shell(); - - await shell.run(''' -dartanalyzer --fatal-warnings --fatal-infos . -dartfmt -n --set-exit-if-changed . - -pub run test -p vm,node -'''); -} diff --git a/storage_node/tool/travis.sh b/storage_node/tool/travis.sh deleted file mode 100755 index abaf769..0000000 --- a/storage_node/tool/travis.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# Fast fail the script on failures. -set -xe - -# Check dart2js warning: using dart2js example/demo_idb.dart --show-package-warnings -o /tmp/out.js - -dartanalyzer --fatal-warnings . - -pub run test -p vm,node