Remove lib/hooks.dart
This commit is contained in:
parent
074b640980
commit
b60a89e364
2 changed files with 169 additions and 453 deletions
|
@ -2,16 +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/libraries/Dart_Packages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterDir="false" />
|
|
||||||
<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$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/hooks.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/hooks.dart" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/core/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_context.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/lib/src/core/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_context.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/core/typed_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/typed_service.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/lib/src/core/typed_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/typed_service.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/http/angel_http.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/angel_http.dart" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/test/hooked_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/hooked_test.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/test/hooked_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/hooked_test.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/test/serialize_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/serialize_test.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/test/services_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/services_test.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/test/services_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/services_test.dart" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.tmp/" />
|
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||||
|
@ -35,19 +31,10 @@
|
||||||
</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="encoders_buffer_test.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="208">
|
|
||||||
<caret line="20" column="20" selection-start-line="20" selection-start-column="20" selection-end-line="20" selection-end-column="20" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
|
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-5320">
|
<state relative-caret-position="-5114">
|
||||||
<caret line="13" column="40" selection-start-line="13" selection-start-column="40" selection-end-line="13" selection-end-column="40" />
|
<caret line="13" column="40" selection-start-line="13" selection-start-column="40" selection-end-line="13" selection-end-column="40" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -56,8 +43,11 @@
|
||||||
<file leaf-file-name="hooked_test.dart" pinned="false" current-in-tab="false">
|
<file leaf-file-name="hooked_test.dart" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="48">
|
<state relative-caret-position="187">
|
||||||
<caret line="3" column="40" selection-start-line="3" selection-start-column="40" selection-end-line="3" selection-end-column="40" />
|
<caret line="118" column="28" selection-start-line="118" selection-start-column="28" selection-end-line="118" selection-end-column="28" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#22#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -65,8 +55,8 @@
|
||||||
<file leaf-file-name="services_test.dart" pinned="false" current-in-tab="false">
|
<file leaf-file-name="services_test.dart" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test/services_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/services_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="1376">
|
<state relative-caret-position="187">
|
||||||
<caret line="86" column="27" selection-start-line="86" selection-start-column="27" selection-end-line="86" selection-end-column="27" />
|
<caret line="67" column="29" selection-start-line="67" selection-start-column="29" selection-end-line="67" selection-end-column="29" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#46#0" expanded="true" />
|
<element signature="e#0#46#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -74,11 +64,26 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="typed_service.dart" pinned="false" current-in-tab="false">
|
<file leaf-file-name="typed_service.dart" pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="16">
|
<state relative-caret-position="-485">
|
||||||
<caret line="1" column="22" selection-start-line="1" selection-start-column="22" selection-end-line="1" selection-end-column="22" />
|
<caret line="13" column="3" lean-forward="true" selection-start-line="13" selection-start-column="3" selection-end-line="13" selection-end-column="3" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="228">
|
||||||
|
<caret line="309" column="35" selection-start-line="309" selection-start-column="35" selection-end-line="309" selection-end-column="35" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#38#58#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -95,11 +100,26 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="hooks.dart" pinned="false" current-in-tab="true">
|
<file leaf-file-name="hooks.dart" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
|
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="64">
|
<state relative-caret-position="-350">
|
||||||
<caret line="4" column="20" selection-start-line="4" selection-start-column="20" selection-end-line="4" selection-end-column="20" />
|
<caret line="120" column="15" selection-start-line="120" selection-start-column="15" selection-end-line="120" selection-end-column="15" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#55#75#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-3930">
|
||||||
|
<caret line="171" column="23" selection-start-line="171" selection-start-column="23" selection-end-line="171" selection-end-column="23" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#48#68#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -113,27 +133,6 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="144">
|
|
||||||
<caret line="9" column="46" selection-start-line="9" selection-start-column="46" selection-end-line="9" selection-end-column="46" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="angel_base.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/angel_base.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="145">
|
|
||||||
<caret line="23" column="11" selection-start-line="23" selection-start-column="11" selection-end-line="23" selection-end-column="11" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#42#62#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="FileTemplateManagerImpl">
|
<component name="FileTemplateManagerImpl">
|
||||||
|
@ -146,8 +145,6 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>parameters</find>
|
|
||||||
<find>cannot re</find>
|
|
||||||
<find>cookie</find>
|
<find>cookie</find>
|
||||||
<find>cast</find>
|
<find>cast</find>
|
||||||
<find>cast(<[^>]+>)\(\)</find>
|
<find>cast(<[^>]+>)\(\)</find>
|
||||||
|
@ -176,6 +173,8 @@
|
||||||
<find>change</find>
|
<find>change</find>
|
||||||
<find>render</find>
|
<find>render</find>
|
||||||
<find>god.serialize</find>
|
<find>god.serialize</find>
|
||||||
|
<find>dart:mirrors</find>
|
||||||
|
<find>god.deserialize</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
<replaceStrings>
|
<replaceStrings>
|
||||||
<replace>req.path</replace>
|
<replace>req.path</replace>
|
||||||
|
@ -206,8 +205,8 @@
|
||||||
<replace>[Iterable]</replace>
|
<replace>[Iterable]</replace>
|
||||||
<replace>_foldStringDynamic(result)</replace>
|
<replace>_foldStringDynamic(result)</replace>
|
||||||
<replace>Angel(MirrorsReflector())</replace>
|
<replace>Angel(MirrorsReflector())</replace>
|
||||||
<replace>json.decode</replace>
|
|
||||||
<replace>json.encode</replace>
|
<replace>json.encode</replace>
|
||||||
|
<replace>json.decode</replace>
|
||||||
</replaceStrings>
|
</replaceStrings>
|
||||||
<dirStrings>
|
<dirStrings>
|
||||||
<dir>C:\Users\thosa\Source\Angel\framework\lib</dir>
|
<dir>C:\Users\thosa\Source\Angel\framework\lib</dir>
|
||||||
|
@ -255,14 +254,12 @@
|
||||||
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/main.dart" />
|
<option value="$PROJECT_DIR$/example/main.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/view.dart" />
|
<option value="$PROJECT_DIR$/example/view.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
|
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/repeat_request_test.dart" />
|
<option value="$PROJECT_DIR$/test/repeat_request_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
|
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/routing_test.dart" />
|
<option value="$PROJECT_DIR$/test/routing_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
|
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/view_generator_test.dart" />
|
<option value="$PROJECT_DIR$/test/view_generator_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/extension_test.dart" />
|
<option value="$PROJECT_DIR$/test/extension_test.dart" />
|
||||||
|
@ -275,13 +272,15 @@
|
||||||
<option value="$PROJECT_DIR$/example/templating.dart" />
|
<option value="$PROJECT_DIR$/example/templating.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" />
|
||||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/typed_service.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
|
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/services_test.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/hooks.dart" />
|
<option value="$PROJECT_DIR$/lib/hooks.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/test/services_test.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/typed_service.dart" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -700,14 +699,7 @@
|
||||||
<workItem from="1533353660185" duration="262000" />
|
<workItem from="1533353660185" duration="262000" />
|
||||||
<workItem from="1534009494986" duration="594000" />
|
<workItem from="1534009494986" duration="594000" />
|
||||||
<workItem from="1534546784803" duration="353000" />
|
<workItem from="1534546784803" duration="353000" />
|
||||||
<workItem from="1534547885788" duration="2287000" />
|
<workItem from="1534547885788" duration="3528000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00064" summary="Deprecated `ResponseContext.io`, added HTTP equivalent">
|
|
||||||
<created>1517980874143</created>
|
|
||||||
<option name="number" value="00064" />
|
|
||||||
<option name="presentableId" value="LOCAL-00064" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1517980874143</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00065" summary="Removed `HttpHeaders` in `ResponseContext`">
|
<task id="LOCAL-00065" summary="Removed `HttpHeaders` in `ResponseContext`">
|
||||||
<created>1517980935063</created>
|
<created>1517980935063</created>
|
||||||
|
@ -1045,7 +1037,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1534693360366</updated>
|
<updated>1534693360366</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="113" />
|
<task id="LOCAL-00113" summary="Strip out json god">
|
||||||
|
<created>1534693773968</created>
|
||||||
|
<option name="number" value="00113" />
|
||||||
|
<option name="presentableId" value="LOCAL-00113" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1534693773968</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="114" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestHistory">
|
<component name="TestHistory">
|
||||||
|
@ -1081,7 +1080,7 @@
|
||||||
</history-entry>
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="164586000" />
|
<option name="totallyTimeSpent" value="165827000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
<todo-panel id="selected-file">
|
<todo-panel id="selected-file">
|
||||||
|
@ -1144,7 +1143,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="Fix async bugs" />
|
|
||||||
<MESSAGE value="Fix hooking bug" />
|
<MESSAGE value="Fix hooking bug" />
|
||||||
<MESSAGE value="+5" />
|
<MESSAGE value="+5" />
|
||||||
<MESSAGE value="+6" />
|
<MESSAGE value="+6" />
|
||||||
|
@ -1169,7 +1167,8 @@
|
||||||
<MESSAGE value="Begin 2.0.0-alpha" />
|
<MESSAGE value="Begin 2.0.0-alpha" />
|
||||||
<MESSAGE value="Change signature of ResponseContext.jsonp" />
|
<MESSAGE value="Change signature of ResponseContext.jsonp" />
|
||||||
<MESSAGE value="Changed view engine to use `Map<String, dynamic>`" />
|
<MESSAGE value="Changed view engine to use `Map<String, dynamic>`" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Changed view engine to use `Map<String, dynamic>`" />
|
<MESSAGE value="Strip out json god" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Strip out json god" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -1177,13 +1176,6 @@
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/http_request_context.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="58">
|
|
||||||
<caret line="121" lean-forward="true" selection-start-line="121" selection-end-line="121" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="366">
|
<state relative-caret-position="366">
|
||||||
|
@ -1269,13 +1261,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/http.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="80">
|
|
||||||
<caret line="14" column="56" selection-start-line="14" selection-start-column="56" selection-end-line="14" selection-end-column="56" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</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="288">
|
<state relative-caret-position="288">
|
||||||
|
@ -1320,16 +1305,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="149">
|
|
||||||
<caret line="517" column="31" selection-start-line="517" selection-start-column="31" selection-end-line="517" selection-end-column="31" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#38#58#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="81">
|
<state relative-caret-position="81">
|
||||||
|
@ -1375,13 +1350,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="144">
|
|
||||||
<caret line="13" column="20" selection-start-line="13" selection-start-column="20" selection-end-line="13" selection-end-column="20" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/streaming_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/streaming_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="112">
|
<state relative-caret-position="112">
|
||||||
|
@ -1481,6 +1449,23 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="53">
|
||||||
|
<caret line="5" column="12" lean-forward="true" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/exception_test.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="176">
|
||||||
|
<caret line="61" lean-forward="true" selection-start-line="61" selection-end-line="61" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#54#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="336">
|
<state relative-caret-position="336">
|
||||||
|
@ -1488,68 +1473,16 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="144">
|
|
||||||
<caret line="9" column="46" selection-start-line="9" selection-start-column="46" selection-end-line="9" selection-end-column="46" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="293">
|
|
||||||
<caret line="20" column="14" lean-forward="true" selection-start-line="20" selection-start-column="14" selection-end-line="20" selection-end-column="14" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="208">
|
|
||||||
<caret line="20" column="20" selection-start-line="20" selection-start-column="20" selection-end-line="20" selection-end-column="20" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="48">
|
|
||||||
<caret line="3" column="40" selection-start-line="3" selection-start-column="40" selection-end-line="3" selection-end-column="40" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="-5320">
|
|
||||||
<caret line="13" column="40" selection-start-line="13" selection-start-column="40" selection-end-line="13" selection-end-column="40" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/services_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="1376">
|
|
||||||
<caret line="86" column="27" selection-start-line="86" selection-start-column="27" selection-end-line="86" selection-end-column="27" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#46#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="128">
|
<first_editor relative-caret-position="144">
|
||||||
<caret line="8" column="48" selection-start-line="8" selection-start-column="48" selection-end-line="8" selection-end-column="48" />
|
<caret line="9" column="63" selection-start-line="9" selection-start-column="63" selection-end-line="9" selection-end-column="63" />
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="16">
|
|
||||||
<caret line="1" column="22" selection-start-line="1" selection-start-column="22" selection-end-line="1" selection-end-column="22" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/templating.dart">
|
<entry file="file://$PROJECT_DIR$/example/templating.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="240">
|
<state relative-caret-position="240">
|
||||||
|
@ -1560,10 +1493,91 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/http/http.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="192">
|
||||||
|
<caret line="21" column="34" lean-forward="true" selection-start-line="21" selection-start-column="34" selection-end-line="21" selection-end-column="34" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="160">
|
||||||
|
<caret line="17" column="12" lean-forward="true" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-3930">
|
||||||
|
<caret line="171" column="23" selection-start-line="171" selection-start-column="23" selection-end-line="171" selection-end-column="23" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#48#68#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/services_test.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="187">
|
||||||
|
<caret line="67" column="29" selection-start-line="67" selection-start-column="29" selection-end-line="67" selection-end-column="29" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#46#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-5114">
|
||||||
|
<caret line="13" column="40" selection-start-line="13" selection-start-column="40" selection-end-line="13" selection-end-column="40" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="187">
|
||||||
|
<caret line="118" column="28" selection-start-line="118" selection-start-column="28" selection-end-line="118" selection-end-column="28" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#22#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="257">
|
||||||
|
<caret line="39" lean-forward="true" selection-start-line="39" selection-end-line="39" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="228">
|
||||||
|
<caret line="309" column="35" selection-start-line="309" selection-start-column="35" selection-end-line="309" selection-end-column="35" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#38#58#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
|
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="64">
|
<state relative-caret-position="-350">
|
||||||
<caret line="4" column="20" selection-start-line="4" selection-start-column="20" selection-end-line="4" selection-end-column="20" />
|
<caret line="120" column="15" selection-start-line="120" selection-start-column="15" selection-end-line="120" selection-end-column="15" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#55#75#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="-485">
|
||||||
|
<caret line="13" column="3" lean-forward="true" selection-start-line="13" selection-start-column="3" selection-end-line="13" selection-end-column="3" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
298
lib/hooks.dart
298
lib/hooks.dart
|
@ -1,298 +0,0 @@
|
||||||
/// Easy helper hooks.
|
|
||||||
library angel_framework.hooks;
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:mirrors';
|
|
||||||
import 'angel_framework.dart';
|
|
||||||
|
|
||||||
/// Sequentially runs a set of [listeners].
|
|
||||||
HookedServiceEventListener chainListeners(
|
|
||||||
Iterable<HookedServiceEventListener> listeners) {
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
for (HookedServiceEventListener listener in listeners) listener(e);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Runs a [callback] on every service, and listens for future services to run it again.
|
|
||||||
AngelConfigurer hookAllServices(callback(Service service)) {
|
|
||||||
return (Angel app) {
|
|
||||||
List<Service> touched = [];
|
|
||||||
|
|
||||||
for (var service in app.services.values) {
|
|
||||||
if (!touched.contains(service)) {
|
|
||||||
callback(service);
|
|
||||||
touched.add(service);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app.onService.listen((service) {
|
|
||||||
if (!touched.contains(service)) return callback(service);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Transforms `e.data` or `e.result` into JSON-friendly data, i.e. a Map. Runs on Iterables as well.
|
|
||||||
///
|
|
||||||
/// The [condition] is optional, and is passed to [transform].
|
|
||||||
HookedServiceEventListener toJson([condition]) =>
|
|
||||||
transform(json.encode, condition);
|
|
||||||
|
|
||||||
/// Mutates `e.data` or `e.result` using the given [transformer].
|
|
||||||
///
|
|
||||||
/// You can optionally provide a [condition], which can be:
|
|
||||||
/// * A [Providers] instance, or String, to run only on certain clients
|
|
||||||
/// * The type [Providers], in which case the transformer will run on every client, but *not* on server-side events.
|
|
||||||
/// * A function: if the function returns `true` (sync or async, doesn't matter),
|
|
||||||
/// then the transformer will run. If not, the event will be skipped.
|
|
||||||
/// * An [Iterable] of the above three.
|
|
||||||
///
|
|
||||||
/// A provided function must take a [HookedServiceEvent] as its only parameter.
|
|
||||||
HookedServiceEventListener transform(transformer(obj), [condition]) {
|
|
||||||
Iterable cond = condition is Iterable ? condition : [condition];
|
|
||||||
if (condition == null) cond = [];
|
|
||||||
|
|
||||||
_condition(HookedServiceEvent e, condition) {
|
|
||||||
if (condition is Function)
|
|
||||||
return condition(e);
|
|
||||||
else if (condition == Providers)
|
|
||||||
return true;
|
|
||||||
else {
|
|
||||||
if (e.params?.containsKey('provider') == true) {
|
|
||||||
var provider = e.params['provider'] as Providers;
|
|
||||||
if (condition is Providers)
|
|
||||||
return condition == provider;
|
|
||||||
else
|
|
||||||
return condition.toString() == provider.via;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
normalize(HookedServiceEvent e, obj) {
|
|
||||||
bool transform = true;
|
|
||||||
|
|
||||||
for (var c in cond) {
|
|
||||||
var r = _condition(e, c);
|
|
||||||
|
|
||||||
if (r != true) {
|
|
||||||
transform = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transform != true) {
|
|
||||||
if (obj == null)
|
|
||||||
return null;
|
|
||||||
else if (obj is Iterable)
|
|
||||||
return obj.toList();
|
|
||||||
else
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj == null)
|
|
||||||
return null;
|
|
||||||
else if (obj is Iterable) {
|
|
||||||
var r = [];
|
|
||||||
|
|
||||||
for (var o in obj) {
|
|
||||||
r.add(normalize(e, o));
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
} else
|
|
||||||
return transformer(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
if (e.isBefore) {
|
|
||||||
e.data = normalize(e, e.data);
|
|
||||||
} else if (e.isAfter) e.result = normalize(e, e.result);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Transforms `e.data` or `e.result` into an instance of the given [type],
|
|
||||||
/// if it is not already.
|
|
||||||
HookedServiceEventListener toType(Type type) {
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
normalize(obj) {
|
|
||||||
if (obj != null && obj.runtimeType != type)
|
|
||||||
return god.deserializeDatum(obj, outputType: type);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.isBefore) {
|
|
||||||
e.data = normalize(e.data);
|
|
||||||
} else
|
|
||||||
e.result = normalize(e.result);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Removes one or more [key]s from `e.data` or `e.result`.
|
|
||||||
/// Works on single objects and iterables.
|
|
||||||
///
|
|
||||||
/// Only applies to the client-side.
|
|
||||||
HookedServiceEventListener remove(key, [remover(key, obj)]) {
|
|
||||||
return (HookedServiceEvent e) async {
|
|
||||||
_remover(key, obj) async {
|
|
||||||
if (remover != null)
|
|
||||||
return remover(key, obj);
|
|
||||||
else if (obj is List)
|
|
||||||
return obj..remove(key);
|
|
||||||
else if (obj is Iterable)
|
|
||||||
return obj.where((k) => key != true);
|
|
||||||
else if (obj is Map)
|
|
||||||
return obj..remove(key);
|
|
||||||
else {
|
|
||||||
try {
|
|
||||||
reflect(obj).setField(new Symbol(key.toString()), null);
|
|
||||||
return obj;
|
|
||||||
} catch (e) {
|
|
||||||
throw new ArgumentError("Cannot remove key '$key' from $obj.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var keys = key is Iterable ? key : [key];
|
|
||||||
|
|
||||||
_removeAll(obj) async {
|
|
||||||
var r = obj;
|
|
||||||
|
|
||||||
for (var key in keys) {
|
|
||||||
r = await _remover(key, r);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
normalize(obj) async {
|
|
||||||
if (obj != null) {
|
|
||||||
if (obj is Iterable) {
|
|
||||||
return await Future.wait(obj.map(_removeAll));
|
|
||||||
} else
|
|
||||||
return _removeAll(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.params?.containsKey('provider') == true) {
|
|
||||||
if (e.isBefore) {
|
|
||||||
e.data = normalize(e.data);
|
|
||||||
} else if (e.isAfter) {
|
|
||||||
e.result = normalize(e.result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Disables a service method for client access from a provider.
|
|
||||||
///
|
|
||||||
/// [provider] can be either a String, [Providers], an Iterable of String, or a
|
|
||||||
/// function that takes a [HookedServiceEvent] and returns a bool.
|
|
||||||
/// Futures are allowed.
|
|
||||||
///
|
|
||||||
/// If [provider] is `null`, then it will be disabled to all clients.
|
|
||||||
HookedServiceEventListener disable([provider]) {
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
if (e.params.containsKey('provider')) {
|
|
||||||
if (provider == null)
|
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
|
||||||
else if (provider is Function) {
|
|
||||||
var r = provider(e);
|
|
||||||
if (r != true) throw new AngelHttpException.methodNotAllowed();
|
|
||||||
} else {
|
|
||||||
_provide(p) => p is Providers ? p : new Providers(p.toString());
|
|
||||||
|
|
||||||
var providers = provider is Iterable
|
|
||||||
? provider.map(_provide)
|
|
||||||
: [_provide(provider)];
|
|
||||||
|
|
||||||
if (providers.any((Providers p) => p == e.params['provider'])) {
|
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serializes the current time to `e.data` or `e.result`.
|
|
||||||
/// You can provide an [assign] function to set the property on your object, and skip reflection.
|
|
||||||
/// If [serialize] is `true` (default), then the set date will be a `String`. If not, a raw `DateTime` will be used.
|
|
||||||
///
|
|
||||||
/// Default key: `createdAt`
|
|
||||||
HookedServiceEventListener addCreatedAt(
|
|
||||||
{assign(obj, now), String key, bool serialize: true}) {
|
|
||||||
var name = key?.isNotEmpty == true ? key : 'createdAt';
|
|
||||||
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
_assign(obj, now) {
|
|
||||||
if (assign != null)
|
|
||||||
return assign(obj, now);
|
|
||||||
else if (obj is Map)
|
|
||||||
obj[name] = now;
|
|
||||||
else {
|
|
||||||
try {
|
|
||||||
reflect(obj).setField(new Symbol(name), now);
|
|
||||||
} catch (e) {
|
|
||||||
throw new ArgumentError("Cannot set key '$name' on $obj.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var d = new DateTime.now().toUtc();
|
|
||||||
var now = serialize == false ? d : d.toIso8601String();
|
|
||||||
|
|
||||||
normalize(obj) {
|
|
||||||
if (obj != null) {
|
|
||||||
if (obj is Iterable) {
|
|
||||||
obj.forEach(normalize);
|
|
||||||
} else {
|
|
||||||
_assign(obj, now);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
normalize(e.isBefore ? e.data : e.result);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serializes the current time to `e.data` or `e.result`.
|
|
||||||
/// You can provide an [assign] function to set the property on your object, and skip reflection.
|
|
||||||
/// If [serialize] is `true` (default), then the set date will be a `String`. If not, a raw `DateTime` will be used.
|
|
||||||
///
|
|
||||||
/// Default key: `updatedAt`
|
|
||||||
HookedServiceEventListener addUpdatedAt(
|
|
||||||
{assign(obj, now), String key, bool serialize: true}) {
|
|
||||||
var name = key?.isNotEmpty == true ? key : 'updatedAt';
|
|
||||||
|
|
||||||
return (HookedServiceEvent e) {
|
|
||||||
_assign(obj, now) {
|
|
||||||
if (assign != null)
|
|
||||||
return assign(obj, now);
|
|
||||||
else if (obj is Map)
|
|
||||||
obj[name] = now;
|
|
||||||
else {
|
|
||||||
try {
|
|
||||||
reflect(obj).setField(new Symbol(name), now);
|
|
||||||
} catch (e) {
|
|
||||||
throw new ArgumentError("Cannot SET key '$name' ON $obj.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var d = new DateTime.now().toUtc();
|
|
||||||
var now = serialize == false ? d : d.toIso8601String();
|
|
||||||
|
|
||||||
normalize(obj) {
|
|
||||||
if (obj != null) {
|
|
||||||
if (obj is Iterable) {
|
|
||||||
obj.forEach(normalize);
|
|
||||||
} else {
|
|
||||||
_assign(obj, now);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
normalize(e.isBefore ? e.data : e.result);
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in a new issue