Added generic to Routable.use
This commit is contained in:
parent
20c6aedaa3
commit
7e2afed853
9 changed files with 198 additions and 187 deletions
|
@ -2,7 +2,12 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
|
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/core/map_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/map_service.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/core/request_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/request_context.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.tmp/" />
|
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||||
<ignored path="$PROJECT_DIR$/temp/" />
|
<ignored path="$PROJECT_DIR$/temp/" />
|
||||||
|
@ -25,27 +30,57 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
|
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/README.md">
|
<entry file="file://$PROJECT_DIR$/README.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
<first_editor relative-caret-position="187">
|
<first_editor relative-caret-position="124">
|
||||||
<caret line="20" column="49" selection-start-line="20" selection-start-column="49" selection-end-line="20" selection-end-column="49" />
|
<caret line="20" column="49" selection-start-line="20" selection-start-column="49" selection-end-line="20" selection-end-column="49" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#54#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false">
|
<file leaf-file-name="hooked_service.dart" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="181">
|
||||||
|
<caret line="60" column="20" lean-forward="true" selection-start-line="60" selection-start-column="20" selection-end-line="60" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="service.dart" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="85">
|
||||||
|
<caret line="79" column="33" selection-start-line="79" selection-start-column="33" selection-end-line="79" selection-end-column="33" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#39#59#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="request_context.dart" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="149">
|
||||||
|
<caret line="29" column="28" selection-start-line="29" selection-start-column="28" selection-end-line="29" selection-end-column="28" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#47#67#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
<first_editor relative-caret-position="96">
|
<first_editor relative-caret-position="32">
|
||||||
<caret line="6" column="69" selection-start-line="6" selection-start-column="69" selection-end-line="6" selection-end-column="69" />
|
<caret line="2" column="95" selection-start-line="2" selection-start-column="95" selection-end-line="2" selection-end-column="95" />
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
|
@ -64,7 +99,6 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>sto</find>
|
|
||||||
<find>sopw</find>
|
<find>sopw</find>
|
||||||
<find>stopw</find>
|
<find>stopw</find>
|
||||||
<find>release</find>
|
<find>release</find>
|
||||||
|
@ -94,6 +128,7 @@
|
||||||
<find>Middleware</find>
|
<find>Middleware</find>
|
||||||
<find>/meta</find>
|
<find>/meta</find>
|
||||||
<find>complet</find>
|
<find>complet</find>
|
||||||
|
<find>parseI</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
<replaceStrings>
|
<replaceStrings>
|
||||||
<replace>FutureOr</replace>
|
<replace>FutureOr</replace>
|
||||||
|
@ -150,9 +185,7 @@
|
||||||
<option name="CHANGED_PATHS">
|
<option name="CHANGED_PATHS">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/test/hm.dart" />
|
<option value="$PROJECT_DIR$/test/hm.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/find_one_test.dart" />
|
<option value="$PROJECT_DIR$/test/find_one_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/map_service.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/extension_test.dart" />
|
<option value="$PROJECT_DIR$/test/extension_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/accepts_test.dart" />
|
<option value="$PROJECT_DIR$/test/accepts_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/templating.dart" />
|
<option value="$PROJECT_DIR$/example/templating.dart" />
|
||||||
|
@ -174,18 +207,15 @@
|
||||||
<option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" />
|
<option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/json.dart" />
|
<option value="$PROJECT_DIR$/example/json.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
|
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.3/lib/src/mirrors/reflector.dart" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.3/lib/src/mirrors/reflector.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
|
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/main.dart" />
|
<option value="$PROJECT_DIR$/example/main.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/view_generator_test.dart" />
|
<option value="$PROJECT_DIR$/test/view_generator_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/common.dart" />
|
<option value="$PROJECT_DIR$/test/common.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
|
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
|
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
|
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
|
||||||
|
@ -199,6 +229,11 @@
|
||||||
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/README.md" />
|
<option value="$PROJECT_DIR$/README.md" />
|
||||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/map_service.dart" />
|
||||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
|
@ -232,7 +267,6 @@
|
||||||
<foldersAlwaysOnTop value="true" />
|
<foldersAlwaysOnTop value="true" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
<pane id="PackagesPane" />
|
|
||||||
<pane id="Scope">
|
<pane id="Scope">
|
||||||
<subPane subId="Project Files">
|
<subPane subId="Project Files">
|
||||||
<expand>
|
<expand>
|
||||||
|
@ -256,6 +290,13 @@
|
||||||
<item name="lib" type="cbb8eebc:String" user="lib" />
|
<item name="lib" type="cbb8eebc:String" user="lib" />
|
||||||
<item name="src" type="cbb8eebc:String" user="src" />
|
<item name="src" type="cbb8eebc:String" user="src" />
|
||||||
</path>
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||||
|
<item name="framework" type="cbb8eebc:String" user="framework" />
|
||||||
|
<item name="lib" type="cbb8eebc:String" user="lib" />
|
||||||
|
<item name="src" type="cbb8eebc:String" user="src" />
|
||||||
|
<item name="core" type="cbb8eebc:String" user="core" />
|
||||||
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
<item name="framework" type="cbb8eebc:String" user="framework" />
|
||||||
|
@ -272,6 +313,7 @@
|
||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
|
<pane id="PackagesPane" />
|
||||||
<pane id="ProjectPane" />
|
<pane id="ProjectPane" />
|
||||||
<pane id="AndroidView" />
|
<pane id="AndroidView" />
|
||||||
</panes>
|
</panes>
|
||||||
|
@ -465,6 +507,7 @@
|
||||||
<envs />
|
<envs />
|
||||||
</configuration>
|
</configuration>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Dart Command Line App.All Tests (PRODUCTION)" />
|
||||||
<item itemvalue="Dart Command Line App.performance::hello (DEV)" />
|
<item itemvalue="Dart Command Line App.performance::hello (DEV)" />
|
||||||
<item itemvalue="Dart Command Line App.performance::hello (PRODUCTION)" />
|
<item itemvalue="Dart Command Line App.performance::hello (PRODUCTION)" />
|
||||||
<item itemvalue="Dart Command Line App.All Tests (for coverage)" />
|
<item itemvalue="Dart Command Line App.All Tests (for coverage)" />
|
||||||
|
@ -619,13 +662,7 @@
|
||||||
<workItem from="1534793956753" duration="15012000" />
|
<workItem from="1534793956753" duration="15012000" />
|
||||||
<workItem from="1534863259966" duration="198000" />
|
<workItem from="1534863259966" duration="198000" />
|
||||||
<workItem from="1534873119036" duration="4624000" />
|
<workItem from="1534873119036" duration="4624000" />
|
||||||
</task>
|
<workItem from="1536696642254" duration="760000" />
|
||||||
<task id="LOCAL-00114" summary="Remove traces of json_god">
|
|
||||||
<created>1534732268467</created>
|
|
||||||
<option name="number" value="00114" />
|
|
||||||
<option name="presentableId" value="LOCAL-00114" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1534732268467</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00115" summary="Remove lib/hooks.dart">
|
<task id="LOCAL-00115" summary="Remove lib/hooks.dart">
|
||||||
<created>1534732365272</created>
|
<created>1534732365272</created>
|
||||||
|
@ -963,7 +1000,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1534877529522</updated>
|
<updated>1534877529522</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="163" />
|
<task id="LOCAL-00163" summary="Add <Id, Data>">
|
||||||
|
<created>1536696871863</created>
|
||||||
|
<option name="number" value="00163" />
|
||||||
|
<option name="presentableId" value="LOCAL-00163" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1536696871864</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="164" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestHistory">
|
<component name="TestHistory">
|
||||||
|
@ -999,7 +1043,7 @@
|
||||||
</history-entry>
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="192041000" />
|
<option name="totallyTimeSpent" value="192801000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
<todo-panel id="selected-file">
|
<todo-panel id="selected-file">
|
||||||
|
@ -1030,15 +1074,13 @@
|
||||||
<window_info id="UI Designer" order="2" />
|
<window_info id="UI Designer" order="2" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.39857143" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.39857143" />
|
||||||
<window_info anchor="bottom" id="TODO" order="6" weight="0.32714286" />
|
<window_info anchor="bottom" id="TODO" order="6" weight="0.32714286" />
|
||||||
<window_info anchor="bottom" id="Messages" order="7" weight="0.33478895" />
|
|
||||||
<window_info anchor="right" id="Palette	" order="3" />
|
<window_info anchor="right" id="Palette	" order="3" />
|
||||||
<window_info id="Image Layers" order="2" />
|
<window_info id="Image Layers" order="2" />
|
||||||
<window_info anchor="right" id="Capture Analysis" order="3" />
|
<window_info anchor="right" id="Capture Analysis" order="3" />
|
||||||
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
|
|
||||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" />
|
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" />
|
||||||
|
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
|
||||||
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
|
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
|
||||||
<window_info content_ui="combo" id="Project" order="0" weight="0.28615385" />
|
<window_info content_ui="combo" id="Project" order="0" weight="0.28615385" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
|
|
||||||
<window_info anchor="right" id="SciView" order="4" />
|
<window_info anchor="right" id="SciView" order="4" />
|
||||||
<window_info anchor="right" id="Theme Preview" order="3" />
|
<window_info anchor="right" id="Theme Preview" order="3" />
|
||||||
<window_info id="Favorites" order="3" side_tool="true" />
|
<window_info id="Favorites" order="3" side_tool="true" />
|
||||||
|
@ -1049,7 +1091,9 @@
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||||
<window_info id="DB Browser" order="2" weight="0.32998413" />
|
<window_info id="DB Browser" order="2" weight="0.32998413" />
|
||||||
|
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
|
||||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||||
|
<window_info anchor="bottom" id="Messages" order="7" weight="0.33478895" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="right" id="Data View" order="4" />
|
<window_info anchor="right" id="Data View" order="4" />
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1062,7 +1106,6 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
<MESSAGE value="Update query parsing" />
|
|
||||||
<MESSAGE value="Update CHANGELOG" />
|
<MESSAGE value="Update CHANGELOG" />
|
||||||
<MESSAGE value="Remove req.injections" />
|
<MESSAGE value="Remove req.injections" />
|
||||||
<MESSAGE value="Remove Angel.inject" />
|
<MESSAGE value="Remove Angel.inject" />
|
||||||
|
@ -1087,7 +1130,8 @@
|
||||||
<MESSAGE value="dart:mirrors is completely gone from Angel" />
|
<MESSAGE value="dart:mirrors is completely gone from Angel" />
|
||||||
<MESSAGE value="All tests pass" />
|
<MESSAGE value="All tests pass" />
|
||||||
<MESSAGE value="CHANGELOG + bump to 2.0.0-alpha.1" />
|
<MESSAGE value="CHANGELOG + bump to 2.0.0-alpha.1" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="CHANGELOG + bump to 2.0.0-alpha.1" />
|
<MESSAGE value="Add <Id, Data>" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Add <Id, Data>" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -1095,20 +1139,6 @@
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/example/handle_error.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="144">
|
|
||||||
<caret line="13" column="21" lean-forward="true" selection-start-line="13" selection-start-column="21" selection-end-line="13" selection-end-column="21" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/view.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="48">
|
|
||||||
<caret line="3" column="14" lean-forward="true" selection-start-line="3" selection-start-column="14" selection-end-line="3" selection-end-column="14" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/performance/hello/angel.md">
|
<entry file="file://$PROJECT_DIR$/performance/hello/angel.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
|
@ -1215,23 +1245,10 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="1152">
|
|
||||||
<caret line="72" column="30" selection-start-line="72" selection-start-column="30" selection-end-line="72" selection-end-column="30" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#47#67#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/accepts_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/accepts_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="150">
|
<state relative-caret-position="150">
|
||||||
<caret line="41" column="67" lean-forward="true" selection-start-line="41" selection-start-column="67" selection-end-line="41" selection-end-column="67" />
|
<caret line="41" column="67" lean-forward="true" selection-start-line="41" selection-start-column="67" selection-end-line="41" selection-end-column="67" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1239,28 +1256,18 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="256">
|
<state relative-caret-position="256">
|
||||||
<caret line="16" column="33" lean-forward="true" selection-start-line="16" selection-start-column="33" selection-end-line="16" selection-end-column="33" />
|
<caret line="16" column="33" lean-forward="true" selection-start-line="16" selection-start-column="33" selection-end-line="16" selection-end-column="33" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test/exception_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/exception_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-602">
|
<state relative-caret-position="-602" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#54#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="192">
|
<state relative-caret-position="192">
|
||||||
<caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
|
<caret line="12" lean-forward="true" selection-start-line="12" selection-end-line="12" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#54#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1268,20 +1275,11 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="239">
|
<state relative-caret-position="239">
|
||||||
<caret line="15" column="62" lean-forward="true" selection-start-line="15" selection-start-column="62" selection-end-line="15" selection-end-column="62" />
|
<caret line="15" column="62" lean-forward="true" selection-start-line="15" selection-start-column="62" selection-end-line="15" selection-end-column="62" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#17#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test/view_generator_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/view_generator_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
<state>
|
|
||||||
<folding>
|
|
||||||
<element signature="e#1#55#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/_http/http.dart">
|
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/_http/http.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
@ -1321,16 +1319,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="114">
|
|
||||||
<caret line="35" column="53" selection-start-line="35" selection-start-column="53" selection-end-line="35" selection-end-column="53" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#39#59#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="134">
|
<state relative-caret-position="134">
|
||||||
|
@ -1380,20 +1368,10 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="30">
|
|
||||||
<caret line="89" column="23" selection-start-line="89" selection-start-column="23" selection-end-line="89" selection-end-column="23" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="186">
|
<state relative-caret-position="186">
|
||||||
<caret line="309" column="12" selection-start-line="309" selection-start-column="12" selection-end-line="309" selection-end-column="12" />
|
<caret line="309" column="12" selection-start-line="309" selection-start-column="12" selection-end-line="309" selection-end-column="12" />
|
||||||
<folding>
|
|
||||||
<element signature="e#48#68#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1415,9 +1393,6 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="129">
|
<state relative-caret-position="129">
|
||||||
<caret line="249" column="26" selection-start-line="249" selection-start-column="26" selection-end-line="249" selection-end-column="26" />
|
<caret line="249" column="26" selection-start-line="249" selection-start-column="26" selection-end-line="249" selection-end-column="26" />
|
||||||
<folding>
|
|
||||||
<element signature="e#38#58#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1439,9 +1414,6 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="368">
|
<state relative-caret-position="368">
|
||||||
<caret line="23" column="19" lean-forward="true" selection-start-line="23" selection-start-column="19" selection-end-line="23" selection-end-column="19" />
|
<caret line="23" column="19" lean-forward="true" selection-start-line="23" selection-start-column="19" selection-end-line="23" selection-end-column="19" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#46#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1449,9 +1421,6 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="126">
|
<state relative-caret-position="126">
|
||||||
<caret line="328" column="36" lean-forward="true" selection-start-line="328" selection-start-column="36" selection-end-line="328" selection-end-column="36" />
|
<caret line="328" column="36" lean-forward="true" selection-start-line="328" selection-start-column="36" selection-end-line="328" selection-end-column="36" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1466,9 +1435,6 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="172">
|
<state relative-caret-position="172">
|
||||||
<caret line="35" column="13" selection-start-line="35" selection-start-column="13" selection-end-line="35" selection-end-column="13" />
|
<caret line="35" column="13" selection-start-line="35" selection-start-column="13" selection-end-line="35" selection-end-column="13" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1476,30 +1442,68 @@
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="129">
|
<state relative-caret-position="129">
|
||||||
<caret line="154" column="49" selection-start-line="154" selection-start-column="49" selection-end-line="154" selection-end-column="49" />
|
<caret line="154" column="49" selection-start-line="154" selection-start-column="49" selection-end-line="154" selection-end-column="49" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/README.md">
|
||||||
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
|
<state split_layout="SPLIT">
|
||||||
|
<first_editor relative-caret-position="124">
|
||||||
|
<caret line="20" column="49" selection-start-line="20" selection-start-column="49" selection-end-line="20" selection-end-column="49" />
|
||||||
|
</first_editor>
|
||||||
|
<second_editor />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="112">
|
||||||
|
<caret line="9" column="63" lean-forward="true" selection-start-line="9" selection-start-column="63" selection-end-line="9" selection-end-column="63" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="149">
|
||||||
|
<caret line="29" column="28" selection-start-line="29" selection-start-column="28" selection-end-line="29" selection-end-column="28" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#47#67#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="181">
|
||||||
|
<caret line="60" column="20" lean-forward="true" selection-start-line="60" selection-start-column="20" selection-end-line="60" selection-end-column="20" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/map_service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="64">
|
||||||
|
<caret line="4" column="22" lean-forward="true" selection-start-line="4" selection-start-column="22" selection-end-line="4" selection-end-column="22" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="85">
|
||||||
|
<caret line="79" column="33" selection-start-line="79" selection-start-column="33" selection-end-line="79" selection-end-column="33" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#39#59#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
<first_editor relative-caret-position="96">
|
<first_editor relative-caret-position="32">
|
||||||
<caret line="6" column="69" selection-start-line="6" selection-start-column="69" selection-end-line="6" selection-end-column="69" />
|
<caret line="2" column="95" selection-start-line="2" selection-start-column="95" selection-end-line="2" selection-end-column="95" />
|
||||||
</first_editor>
|
|
||||||
<second_editor />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/README.md">
|
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
||||||
<state split_layout="SPLIT">
|
|
||||||
<first_editor relative-caret-position="187">
|
|
||||||
<caret line="20" column="49" selection-start-line="20" selection-start-column="49" selection-end-line="20" selection-end-column="49" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#54#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# 2.0.0-alpha.3
|
||||||
|
* Added `<Id, Data>` type parameters to `Service`.
|
||||||
|
* `HookedService` now follows suit, and takes a third parameter, pointing to the inner service.
|
||||||
|
|
||||||
# 2.0.0-alpha.2
|
# 2.0.0-alpha.2
|
||||||
* Added `ResponseContext.detach`.
|
* Added `ResponseContext.detach`.
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'service.dart';
|
import 'service.dart';
|
||||||
|
|
||||||
/// An easy helper class to create one-off services without having to create an entire class.
|
/// An easy helper class to create one-off services without having to create an entire class.
|
||||||
///
|
///
|
||||||
/// Well-suited for testing.
|
/// Well-suited for testing.
|
||||||
class AnonymousService extends Service {
|
class AnonymousService<Id, Data> extends Service<Id, Data> {
|
||||||
FutureOr Function([Map]) _index;
|
FutureOr Function([Map<String, dynamic>]) _index;
|
||||||
FutureOr Function(Object, [Map]) _read, _create, _remove;
|
FutureOr Function(Id, [Map<String, dynamic>]) _read, _remove;
|
||||||
FutureOr Function(Object, Object, [Map]) _modify, _update;
|
FutureOr Function(Data, [Map<String, dynamic>]) _create;
|
||||||
|
Function(Id, Data, [Map<String, dynamic>]) _modify, _update;
|
||||||
|
|
||||||
AnonymousService(
|
AnonymousService(
|
||||||
{FutureOr index([Map params]),
|
{FutureOr index([Map params]),
|
||||||
FutureOr read(id, [Map params]),
|
FutureOr read(Id id, [Map params]),
|
||||||
FutureOr create(data, [Map params]),
|
FutureOr create(Data data, [Map params]),
|
||||||
FutureOr modify(id, data, [Map params]),
|
FutureOr modify(Id id, Data data, [Map params]),
|
||||||
FutureOr update(id, data, [Map params]),
|
FutureOr update(Id id, Data data, [Map params]),
|
||||||
FutureOr remove(id, [Map params])})
|
FutureOr remove(Id id, [Map params])})
|
||||||
: super() {
|
: super() {
|
||||||
_index = index;
|
_index = index;
|
||||||
_read = read;
|
_read = read;
|
||||||
|
@ -26,28 +28,30 @@ class AnonymousService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
index([Map params]) => new Future.sync(
|
index([Map<String, dynamic> params]) => new Future.sync(
|
||||||
() => _index != null ? _index(params) : super.index(params));
|
() => _index != null ? _index(params) : super.index(params));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
read(id, [Map params]) => new Future.sync(
|
read(Id id, [Map<String, dynamic> params]) => new Future.sync(
|
||||||
() => _read != null ? _read(id, params) : super.read(id, params));
|
() => _read != null ? _read(id, params) : super.read(id, params));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
create(data, [Map params]) => new Future.sync(() =>
|
create(Data data, [Map<String, dynamic> params]) => new Future.sync(() =>
|
||||||
_create != null ? _create(data, params) : super.create(data, params));
|
_create != null ? _create(data, params) : super.create(data, params));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
modify(id, data, [Map params]) => new Future.sync(() => _modify != null
|
modify(Id id, Data data, [Map<String, dynamic> params]) =>
|
||||||
|
new Future.sync(() => _modify != null
|
||||||
? _modify(id, data, params)
|
? _modify(id, data, params)
|
||||||
: super.modify(id, data, params));
|
: super.modify(id, data, params));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
update(id, data, [Map params]) => new Future.sync(() => _update != null
|
update(Id id, Data data, [Map<String, dynamic> params]) =>
|
||||||
|
new Future.sync(() => _update != null
|
||||||
? _update(id, data, params)
|
? _update(id, data, params)
|
||||||
: super.update(id, data, params));
|
: super.update(id, data, params));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
remove(id, [Map params]) => new Future.sync(
|
remove(Id id, [Map<String, dynamic> params]) => new Future.sync(
|
||||||
() => _remove != null ? _remove(id, params) : super.remove(id, params));
|
() => _remove != null ? _remove(id, params) : super.remove(id, params));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,12 @@ import 'server.dart';
|
||||||
import 'service.dart';
|
import 'service.dart';
|
||||||
|
|
||||||
/// Wraps another service in a service that broadcasts events on actions.
|
/// Wraps another service in a service that broadcasts events on actions.
|
||||||
class HookedService extends Service {
|
class HookedService<Id, Data, T extends Service<Id, Data>>
|
||||||
|
extends Service<Id, Data> {
|
||||||
final List<StreamController<HookedServiceEvent>> _ctrl = [];
|
final List<StreamController<HookedServiceEvent>> _ctrl = [];
|
||||||
|
|
||||||
/// Tbe service that is proxied by this hooked one.
|
/// Tbe service that is proxied by this hooked one.
|
||||||
final Service inner;
|
final T inner;
|
||||||
|
|
||||||
final HookedServiceEventDispatcher beforeIndexed =
|
final HookedServiceEventDispatcher beforeIndexed =
|
||||||
new HookedServiceEventDispatcher();
|
new HookedServiceEventDispatcher();
|
||||||
|
@ -41,7 +42,7 @@ class HookedService extends Service {
|
||||||
final HookedServiceEventDispatcher afterRemoved =
|
final HookedServiceEventDispatcher afterRemoved =
|
||||||
new HookedServiceEventDispatcher();
|
new HookedServiceEventDispatcher();
|
||||||
|
|
||||||
HookedService(Service this.inner) {
|
HookedService(this.inner) {
|
||||||
// Clone app instance
|
// Clone app instance
|
||||||
if (inner.app != null) this.app = inner.app;
|
if (inner.app != null) this.app = inner.app;
|
||||||
}
|
}
|
||||||
|
@ -56,13 +57,14 @@ class HookedService extends Service {
|
||||||
return params['__responsectx'] as ResponseContext;
|
return params['__responsectx'] as ResponseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map _stripReq(Map params) {
|
Map<String, dynamic> _stripReq(Map<String, dynamic> params) {
|
||||||
if (params == null)
|
if (params == null)
|
||||||
return params;
|
return params;
|
||||||
else
|
else
|
||||||
return params.keys
|
return params.keys
|
||||||
.where((key) => key != '__requestctx' && key != '__responsectx')
|
.where((key) => key != '__requestctx' && key != '__responsectx')
|
||||||
.fold({}, (map, key) => map..[key] = params[key]);
|
.fold<Map<String, dynamic>>(
|
||||||
|
{}, (map, key) => map..[key] = params[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Closes any open [StreamController]s on this instance. **Internal use only**.
|
/// Closes any open [StreamController]s on this instance. **Internal use only**.
|
||||||
|
@ -257,7 +259,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future index([Map _params]) {
|
Future index([Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeIndexed
|
return beforeIndexed
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
@ -283,7 +285,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future read(id, [Map _params]) {
|
Future read(id, [Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeRead
|
return beforeRead
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
@ -309,7 +311,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future create(data, [Map _params]) {
|
Future create(data, [Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeCreated
|
return beforeCreated
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
@ -335,7 +337,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future modify(id, data, [Map _params]) {
|
Future modify(id, data, [Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeModified
|
return beforeModified
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
@ -361,7 +363,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future update(id, data, [Map _params]) {
|
Future update(id, data, [Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeUpdated
|
return beforeUpdated
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
@ -387,7 +389,7 @@ class HookedService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future remove(id, [Map _params]) {
|
Future remove(id, [Map<String, dynamic> _params]) {
|
||||||
var params = _stripReq(_params);
|
var params = _stripReq(_params);
|
||||||
return beforeRemoved
|
return beforeRemoved
|
||||||
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
._emit(new HookedServiceEvent(false, _getRequest(_params),
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:angel_http_exception/angel_http_exception.dart';
|
||||||
import 'service.dart';
|
import 'service.dart';
|
||||||
|
|
||||||
/// A basic service that manages an in-memory list of maps.
|
/// A basic service that manages an in-memory list of maps.
|
||||||
class MapService extends Service {
|
class MapService extends Service<String, Map<String, dynamic>> {
|
||||||
/// If set to `true`, clients can remove all items by passing a `null` `id` to `remove`.
|
/// If set to `true`, clients can remove all items by passing a `null` `id` to `remove`.
|
||||||
///
|
///
|
||||||
/// `false` by default.
|
/// `false` by default.
|
||||||
|
@ -35,8 +35,8 @@ class MapService extends Service {
|
||||||
String get updatedAtKey =>
|
String get updatedAtKey =>
|
||||||
autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at';
|
autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at';
|
||||||
|
|
||||||
bool Function(Map) _matchesId(id) {
|
bool Function(Map<String, dynamic>) _matchesId(id) {
|
||||||
return (Map item) {
|
return (Map<String, dynamic> item) {
|
||||||
if (item['id'] == null)
|
if (item['id'] == null)
|
||||||
return false;
|
return false;
|
||||||
else if (autoIdAndDateFields != false)
|
else if (autoIdAndDateFields != false)
|
||||||
|
@ -47,7 +47,7 @@ class MapService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List> index([Map params]) {
|
Future<List> index([Map<String, dynamic> params]) {
|
||||||
if (allowQuery == false || params == null || params['query'] is! Map)
|
if (allowQuery == false || params == null || params['query'] is! Map)
|
||||||
return new Future.value(items);
|
return new Future.value(items);
|
||||||
else {
|
else {
|
||||||
|
@ -66,20 +66,20 @@ class MapService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map> read(id, [Map params]) {
|
Future<Map> read(String id, [Map<String, dynamic> params]) {
|
||||||
return new Future.value(items.firstWhere(_matchesId(id),
|
return new Future.value(items.firstWhere(_matchesId(id),
|
||||||
orElse: () => throw new AngelHttpException.notFound(
|
orElse: () => throw new AngelHttpException.notFound(
|
||||||
message: 'No record found for ID $id')));
|
message: 'No record found for ID $id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map> create(data, [Map params]) {
|
Future<Map> create(Map<String, dynamic> data, [Map<String, dynamic> params]) {
|
||||||
if (data is! Map)
|
if (data is! Map)
|
||||||
throw new AngelHttpException.badRequest(
|
throw new AngelHttpException.badRequest(
|
||||||
message:
|
message:
|
||||||
'MapService does not support `create` with ${data.runtimeType}.');
|
'MapService does not support `create` with ${data.runtimeType}.');
|
||||||
var now = new DateTime.now().toIso8601String();
|
var now = new DateTime.now().toIso8601String();
|
||||||
var result = data as Map;
|
var result = new Map<String, dynamic>.from(data);
|
||||||
|
|
||||||
if (autoIdAndDateFields == true) {
|
if (autoIdAndDateFields == true) {
|
||||||
result
|
result
|
||||||
|
@ -87,19 +87,13 @@ class MapService extends Service {
|
||||||
..[autoSnakeCaseNames == false ? 'createdAt' : 'created_at'] = now
|
..[autoSnakeCaseNames == false ? 'createdAt' : 'created_at'] = now
|
||||||
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] = now;
|
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] = now;
|
||||||
}
|
}
|
||||||
items.add(_foldStringDynamic(result));
|
items.add(result);
|
||||||
return new Future.value(result);
|
return new Future.value(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> _foldStringDynamic(Map map) {
|
|
||||||
return map == null
|
|
||||||
? null
|
|
||||||
: map.keys.fold<Map<String, dynamic>>(
|
|
||||||
<String, dynamic>{}, (out, k) => out..[k.toString()] = map[k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map> modify(id, data, [Map params]) {
|
Future<Map> modify(String id, Map<String, dynamic> data,
|
||||||
|
[Map<String, dynamic> params]) {
|
||||||
if (data is! Map)
|
if (data is! Map)
|
||||||
throw new AngelHttpException.badRequest(
|
throw new AngelHttpException.badRequest(
|
||||||
message:
|
message:
|
||||||
|
@ -107,7 +101,7 @@ class MapService extends Service {
|
||||||
if (!items.any(_matchesId(id))) return create(data, params);
|
if (!items.any(_matchesId(id))) return create(data, params);
|
||||||
|
|
||||||
return read(id).then((item) {
|
return read(id).then((item) {
|
||||||
var result = item..addAll(data as Map);
|
var result = new Map<String, dynamic>.from(item)..addAll(data);
|
||||||
|
|
||||||
if (autoIdAndDateFields == true)
|
if (autoIdAndDateFields == true)
|
||||||
result
|
result
|
||||||
|
@ -118,7 +112,8 @@ class MapService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map> update(id, data, [Map params]) {
|
Future<Map> update(String id, Map<String, dynamic> data,
|
||||||
|
[Map<String, dynamic> params]) {
|
||||||
if (data is! Map)
|
if (data is! Map)
|
||||||
throw new AngelHttpException.badRequest(
|
throw new AngelHttpException.badRequest(
|
||||||
message:
|
message:
|
||||||
|
@ -130,7 +125,7 @@ class MapService extends Service {
|
||||||
throw new AngelHttpException.notFound(
|
throw new AngelHttpException.notFound(
|
||||||
message: 'No record found for ID $id');
|
message: 'No record found for ID $id');
|
||||||
|
|
||||||
var result = data as Map;
|
var result = new Map<String, dynamic>.from(data);
|
||||||
if (autoIdAndDateFields == true) {
|
if (autoIdAndDateFields == true) {
|
||||||
result
|
result
|
||||||
..['id'] = id?.toString()
|
..['id'] = id?.toString()
|
||||||
|
@ -139,13 +134,13 @@ class MapService extends Service {
|
||||||
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] =
|
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] =
|
||||||
new DateTime.now().toIso8601String();
|
new DateTime.now().toIso8601String();
|
||||||
}
|
}
|
||||||
items.add(_foldStringDynamic(result));
|
items.add(result);
|
||||||
return new Future.value(result);
|
return new Future.value(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map> remove(id, [Map params]) {
|
Future<Map> remove(String id, [Map<String, dynamic> params]) {
|
||||||
if (id == null ||
|
if (id == null ||
|
||||||
id == 'null' &&
|
id == 'null' &&
|
||||||
(allowRemoveAll == true ||
|
(allowRemoveAll == true ||
|
||||||
|
|
|
@ -27,7 +27,7 @@ abstract class RequestContext<RawRequest> {
|
||||||
RawRequest get rawRequest;
|
RawRequest get rawRequest;
|
||||||
|
|
||||||
/// Additional params to be passed to services.
|
/// Additional params to be passed to services.
|
||||||
final Map serviceParams = {};
|
final Map<String, dynamic> serviceParams = {};
|
||||||
|
|
||||||
/// The [Angel] instance that is responding to this request.
|
/// The [Angel] instance that is responding to this request.
|
||||||
Angel app;
|
Angel app;
|
||||||
|
|
|
@ -101,8 +101,9 @@ class Routable extends Router<RequestHandler> {
|
||||||
///
|
///
|
||||||
/// Returns a [HookedService] that can be used to hook into
|
/// Returns a [HookedService] that can be used to hook into
|
||||||
/// events dispatched by this service.
|
/// events dispatched by this service.
|
||||||
HookedService use(String path, Service service) {
|
HookedService<Id, Data, T> use<Id, Data, T extends Service<Id, Data>>(
|
||||||
var hooked = new HookedService(service);
|
String path, T service) {
|
||||||
|
var hooked = new HookedService<Id, Data, T>(service);
|
||||||
_services[path
|
_services[path
|
||||||
.toString()
|
.toString()
|
||||||
.trim()
|
.trim()
|
||||||
|
|
|
@ -339,7 +339,8 @@ class Angel extends Routable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
HookedService use(String path, Service service) {
|
HookedService<Id, Data, T> use<Id, Data, T extends Service<Id, Data>>(
|
||||||
|
String path, T service) {
|
||||||
service.app = this;
|
service.app = this;
|
||||||
return super.use(path, service)..app = this;
|
return super.use(path, service)..app = this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Service<Id, Data> extends Routable {
|
||||||
///
|
///
|
||||||
/// A custom [errorMessage] may be provided.
|
/// A custom [errorMessage] may be provided.
|
||||||
Future findOne(
|
Future findOne(
|
||||||
[Map params,
|
[Map<String, dynamic> params,
|
||||||
String errorMessage = 'No record was found matching the given query.']) {
|
String errorMessage = 'No record was found matching the given query.']) {
|
||||||
return index(params).then((result) {
|
return index(params).then((result) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
@ -97,32 +97,32 @@ class Service<Id, Data> extends Routable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves all resources.
|
/// Retrieves all resources.
|
||||||
Future index([Map params]) {
|
Future index([Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the desired resource.
|
/// Retrieves the desired resource.
|
||||||
Future read(Id id, [Map params]) {
|
Future read(Id id, [Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a resource.
|
/// Creates a resource.
|
||||||
Future create(Data data, [Map params]) {
|
Future create(Data data, [Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Modifies a resource.
|
/// Modifies a resource.
|
||||||
Future modify(Id id, Data data, [Map params]) {
|
Future modify(Id id, Data data, [Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites a resource.
|
/// Overwrites a resource.
|
||||||
Future update(Id id, Data data, [Map params]) {
|
Future update(Id id, Data data, [Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes the given resource.
|
/// Removes the given resource.
|
||||||
Future remove(Id id, [Map params]) {
|
Future remove(Id id, [Map<String, dynamic> params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue