Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type=JS for projections #48

Merged
merged 4 commits into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 6 additions & 14 deletions src/Projections/ProjectionsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,14 @@ public function abort(
public function createOneTime(
EndPoint $endPoint,
string $query,
string $type = 'JS',
?UserCredentials $userCredentials = null,
string $httpSchema = EndpointExtensions::HTTP_SCHEMA
): Promise {
return $this->sendPost(
EndpointExtensions::formatStringToHttpUrl(
$endPoint,
$httpSchema,
'/projections/onetime?type=%s',
$type
'/projections/onetime?type=JS'
),
$query,
$userCredentials,
Expand All @@ -122,17 +120,15 @@ public function createTransient(
EndPoint $endPoint,
string $name,
string $query,
string $type = 'JS',
?UserCredentials $userCredentials = null,
string $httpSchema = EndpointExtensions::HTTP_SCHEMA
): Promise {
return $this->sendPost(
EndpointExtensions::formatStringToHttpUrl(
$endPoint,
$httpSchema,
'/projections/transient?name=%s&type=%s',
$name,
$type
'/projections/transient?name=%s&type=JS',
$name
),
$query,
$userCredentials,
Expand All @@ -145,17 +141,15 @@ public function createContinuous(
string $name,
string $query,
bool $trackEmittedStreams = false,
string $type = 'JS',
?UserCredentials $userCredentials = null,
string $httpSchema = EndpointExtensions::HTTP_SCHEMA
): Promise {
return $this->sendPost(
EndpointExtensions::formatStringToHttpUrl(
$endPoint,
$httpSchema,
'/projections/continuous?name=%s&type=%s&emit=1&trackemittedstreams=%d',
'/projections/continuous?name=%s&type=JS&emit=1&trackemittedstreams=%d',
$name,
$type,
(int) $trackEmittedStreams
),
$query,
Expand Down Expand Up @@ -467,17 +461,15 @@ public function updateQuery(
string $name,
string $query,
bool $emitEnabled = false,
string $type = 'JS',
?UserCredentials $userCredentials = null,
string $httpSchema = EndpointExtensions::HTTP_SCHEMA
): Promise {
return $this->sendPut(
EndpointExtensions::formatStringToHttpUrl(
$endPoint,
$httpSchema,
'/projection/%s/query?emit=' . (int) $emitEnabled . '&type=%s',
$name,
$type
'/projection/%s/query?emit=' . (int) $emitEnabled . '&type=JS',
$name
),
$query,
$userCredentials,
Expand Down
8 changes: 0 additions & 8 deletions src/Projections/ProjectionsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public function abortAsync(string $name, ?UserCredentials $userCredentials = nul
*/
public function createOneTimeAsync(
string $query,
string $type = 'JS',
?UserCredentials $userCredentials = null
): Promise {
if ('' === $query) {
Expand All @@ -104,7 +103,6 @@ public function createOneTimeAsync(
return $this->client->createOneTime(
$this->httpEndPoint,
$query,
$type,
$userCredentials,
$this->httpSchema
);
Expand All @@ -116,7 +114,6 @@ public function createOneTimeAsync(
public function createTransientAsync(
string $name,
string $query,
string $type = 'JS',
?UserCredentials $userCredentials = null
): Promise {
if ('' === $name) {
Expand All @@ -131,7 +128,6 @@ public function createTransientAsync(
$this->httpEndPoint,
$name,
$query,
$type,
$userCredentials,
$this->httpSchema
);
Expand All @@ -144,7 +140,6 @@ public function createContinuousAsync(
string $name,
string $query,
bool $trackEmittedStreams = false,
string $type = 'JS',
?UserCredentials $userCredentials = null
): Promise {
if ('' === $name) {
Expand All @@ -160,7 +155,6 @@ public function createContinuousAsync(
$name,
$query,
$trackEmittedStreams,
$type,
$userCredentials,
$this->httpSchema
);
Expand Down Expand Up @@ -376,7 +370,6 @@ public function updateQueryAsync(
string $name,
string $query,
bool $emitEnabled = false,
string $type = 'JS',
?UserCredentials $userCredentials = null
): Promise {
if ('' === $name) {
Expand All @@ -392,7 +385,6 @@ public function updateQueryAsync(
$name,
$query,
$emitEnabled,
$type,
$userCredentials,
$this->httpSchema
);
Expand Down
7 changes: 3 additions & 4 deletions tests/ProjectionSpecification.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,21 @@ protected function postEvent(string $stream, string $eventType, string $data): P
);
}

protected function createOneTimeProjection(string $type): Promise
protected function createOneTimeProjection(): Promise
{
$query = $this->createStandardQuery(Guid::generateAsHex());

return $this->projectionsManager->createOneTimeAsync($query, $type, $this->credentials);
return $this->projectionsManager->createOneTimeAsync($query, $this->credentials);
}

protected function createContinuousProjection(string $projectionName, string $type): Promise
protected function createContinuousProjection(string $projectionName): Promise
{
$query = $this->createStandardQuery(Guid::generateAsHex());

return $this->projectionsManager->createContinuousAsync(
$projectionName,
$query,
false,
$type,
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_a_projection_is_running.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ protected function when(): Generator
$this->projectionName,
$this->query,
false,
'JS',
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_creating_continuous_projection.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function when(): Generator
$this->projectionName,
$this->query,
false,
'JS',
$this->credentials
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function when(): Generator
$this->projectionName,
$this->query,
true,
'JS',
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_creating_one_time_projection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ protected function when(): Generator
{
yield $this->projectionsManager->createOneTimeAsync(
$this->query,
'JS',
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_creating_transient_projection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ protected function when(): Generator
yield $this->projectionsManager->createTransientAsync(
$this->projectionName,
$this->query,
'JS',
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_disabling_projections.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function given(): Generator
$this->projectionName,
$this->query,
false,
'JS',
$this->credentials
);
}
Expand Down
1 change: 0 additions & 1 deletion tests/when_enabling_projections.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function given(): Generator
$this->projectionName,
$this->query,
false,
'JS',
$this->credentials
);

Expand Down
2 changes: 1 addition & 1 deletion tests/when_listing_continuous_projections.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class when_listing_continuous_projections extends TestCase
protected function given(): Generator
{
$this->projectionName = Guid::generateAsHex();
yield $this->createContinuousProjection($this->projectionName, 'JS');
yield $this->createContinuousProjection($this->projectionName);
}

protected function when(): Generator
Expand Down
2 changes: 1 addition & 1 deletion tests/when_listing_one_time_projections.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class when_listing_one_time_projections extends TestCase

protected function given(): Generator
{
yield $this->createOneTimeProjection('JS');
yield $this->createOneTimeProjection();
}

protected function when(): Generator
Expand Down
1 change: 0 additions & 1 deletion tests/when_resetting_projections.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function given(): Generator
$this->projectionName,
$this->query,
false,
'JS',
$this->credentials
);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/when_updating_a_projection_query.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ protected function given(): Generator
$this->projectionName,
$originalQuery,
false,
'JS',
$this->credentials
);
}
Expand All @@ -55,7 +54,6 @@ protected function when(): Generator
$this->projectionName,
$this->newQuery,
false,
'JS',
$this->credentials
);
}
Expand Down