@@ -180,6 +180,8 @@ |
||
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Change stream. |
183 | + * @param integer $offset |
|
184 | + * @param integer $limit |
|
183 | 185 | */ |
184 | 186 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
185 | 187 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $filter = $this->prepareQuery($namespace, $query); |
73 | 73 | $that = $this; |
74 | 74 | |
75 | - return $this->resource_factory->getAllFrom($this->db->{$this->scheduler->getJobQueue()}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace, $that) { |
|
75 | + return $this->resource_factory->getAllFrom($this->db->{$this->scheduler->getJobQueue()}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace, $that) { |
|
76 | 76 | return $that->build($resource, $namespace); |
77 | 77 | }); |
78 | 78 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $filter = $this->prepareQuery($namespace, $query); |
132 | 132 | $that = $this; |
133 | 133 | |
134 | - return $this->resource_factory->watchFrom($this->db->{$this->scheduler->getJobQueue()}, $after, $existing, $filter, function (array $resource) use ($namespace, $that) { |
|
134 | + return $this->resource_factory->watchFrom($this->db->{$this->scheduler->getJobQueue()}, $after, $existing, $filter, function(array $resource) use ($namespace, $that) { |
|
135 | 135 | return $that->build($resource, $namespace); |
136 | 136 | }, $offset, $limit, $sort); |
137 | 137 | } |
@@ -18,7 +18,6 @@ |
||
18 | 18 | use Psr\Http\Server\MiddlewareInterface; |
19 | 19 | use Psr\Http\Server\RequestHandlerInterface; |
20 | 20 | use Tubee\Rest\Exception; |
21 | -use Zend\Diactoros\Response; |
|
22 | 21 | |
23 | 22 | class QueryDecoder implements MiddlewareInterface |
24 | 23 | { |
@@ -18,7 +18,6 @@ |
||
18 | 18 | use Tubee\Resource\AbstractResource; |
19 | 19 | use Tubee\Resource\AttributeResolver; |
20 | 20 | use Tubee\V8\Engine as V8Engine; |
21 | -use Tubee\Workflow\Map; |
|
22 | 21 | use Tubee\Workflow\WorkflowInterface; |
23 | 22 | use V8Js; |
24 | 23 |
@@ -121,7 +121,7 @@ |
||
121 | 121 | 'namespace' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace)], |
122 | 122 | 'collection' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection)], |
123 | 123 | 'endpoint' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection.'/endpoints/'.$endpoint)], |
124 | - ], |
|
124 | + ], |
|
125 | 125 | 'namespace' => $namespace, |
126 | 126 | 'collection' => $collection, |
127 | 127 | 'endpoint' => $endpoint, |
@@ -146,6 +146,8 @@ |
||
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Change stream. |
149 | + * @param integer $offset |
|
150 | + * @param integer $limit |
|
149 | 151 | */ |
150 | 152 | public function watch(EndpointInterface $endpoint, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
151 | 153 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $filter = $this->prepareQuery($endpoint, $query); |
89 | 89 | $that = $this; |
90 | 90 | |
91 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($endpoint, $that) { |
|
91 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($endpoint, $that) { |
|
92 | 92 | return $that->build($resource, $endpoint); |
93 | 93 | }); |
94 | 94 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $filter = $this->prepareQuery($endpoint, $query); |
167 | 167 | $that = $this; |
168 | 168 | |
169 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function (array $resource) use ($endpoint, $that) { |
|
169 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function(array $resource) use ($endpoint, $that) { |
|
170 | 170 | return $that->build($resource, $endpoint); |
171 | 171 | }, $offset, $limit, $sort); |
172 | 172 | } |
@@ -191,6 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | /** |
193 | 193 | * Get all. |
194 | + * @param Closure $build |
|
194 | 195 | */ |
195 | 196 | public function getAllFrom(Collection $collection, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null, ?Closure $build = null): Generator |
196 | 197 | { |
@@ -217,6 +218,7 @@ discard block |
||
217 | 218 | |
218 | 219 | /** |
219 | 220 | * Change stream. |
221 | + * @param Closure $build |
|
220 | 222 | */ |
221 | 223 | public function watchFrom(Collection $collection, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = [], ?Closure $build = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
222 | 224 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $that = $this; |
103 | 103 | |
104 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function (array $resource) use ($that) { |
|
104 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function(array $resource) use ($that) { |
|
105 | 105 | return $that->build($resource); |
106 | 106 | }); |
107 | 107 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $that = $this; |
175 | 175 | |
176 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($that) { |
|
176 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($that) { |
|
177 | 177 | return $that->build($resource); |
178 | 178 | }, $offset, $limit, $sort); |
179 | 179 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $that = $this; |
64 | 64 | |
65 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function ($resource) use ($that) { |
|
65 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function($resource) use ($that) { |
|
66 | 66 | return $that->build($resource); |
67 | 67 | }); |
68 | 68 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $that = $this; |
132 | 132 | |
133 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function ($resource) use ($that) { |
|
133 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function($resource) use ($that) { |
|
134 | 134 | return $that->build($resource); |
135 | 135 | }, $offset, $limit, $sort); |
136 | 136 | } |
@@ -216,6 +216,8 @@ |
||
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Change stream. |
219 | + * @param integer $offset |
|
220 | + * @param integer $limit |
|
219 | 221 | */ |
220 | 222 | public function watch(CollectionInterface $collection, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
221 | 223 | { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $that = $this; |
143 | 143 | |
144 | - return $this->resource_factory->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function (array $resource) use ($collection, $that) { |
|
144 | + return $this->resource_factory->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function(array $resource) use ($collection, $that) { |
|
145 | 145 | return $that->build($resource, $collection); |
146 | 146 | }); |
147 | 147 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $that = $this; |
223 | 223 | |
224 | - return $this->resource_factory->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function (array $resource) use ($collection, $that) { |
|
224 | + return $this->resource_factory->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function(array $resource) use ($collection, $that) { |
|
225 | 225 | return $that->build($resource, $collection); |
226 | 226 | }, $offset, $limit, $sort); |
227 | 227 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $filter = $this->prepareQuery($namespace, $query); |
94 | 94 | $that = $this; |
95 | 95 | |
96 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace, $that) { |
|
96 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace, $that) { |
|
97 | 97 | return $that->build($resource, $namespace); |
98 | 98 | }); |
99 | 99 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $filter = $this->prepareQuery($namespace, $query); |
231 | 231 | $that = $this; |
232 | 232 | |
233 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function (array $resource) use ($namespace, $that) { |
|
233 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function(array $resource) use ($namespace, $that) { |
|
234 | 234 | return $that->build($resource, $namespace); |
235 | 235 | }, $offset, $limit, $sort); |
236 | 236 | } |