diff --git a/src/Common/SearchAttributes/SearchAttributeKey.php b/src/Common/SearchAttributes/SearchAttributeKey.php index c857b7b7..2e1ef048 100644 --- a/src/Common/SearchAttributes/SearchAttributeKey.php +++ b/src/Common/SearchAttributes/SearchAttributeKey.php @@ -10,7 +10,7 @@ use Temporal\Common\SearchAttributes\SearchAttributeKey\IntValue; use Temporal\Common\SearchAttributes\SearchAttributeKey\KeywordListValue; use Temporal\Common\SearchAttributes\SearchAttributeKey\KeywordValue; -use Temporal\Common\SearchAttributes\SearchAttributeKey\StringValue; +use Temporal\Common\SearchAttributes\SearchAttributeKey\TextValue; use Temporal\Common\SearchAttributes\SearchAttributeUpdate\ValueSet; /** @@ -61,9 +61,9 @@ public static function forKeyword(string $name): KeywordValue /** * @param non-empty-string $name */ - public static function forString(string $name): StringValue + public static function forText(string $name): TextValue { - return new StringValue($name); + return new TextValue($name); } /** @@ -92,7 +92,7 @@ public static function for(ValueType $tryFrom, string $name): self ValueType::Int => self::forInteger($name), ValueType::Float => self::forFloat($name), ValueType::Keyword => self::forKeyword($name), - ValueType::String => self::forString($name), + ValueType::Text => self::forText($name), ValueType::Datetime => self::forDatetime($name), ValueType::KeywordList => self::forKeywordList($name), }; diff --git a/src/Common/SearchAttributes/SearchAttributeKey/StringValue.php b/src/Common/SearchAttributes/SearchAttributeKey/TextValue.php similarity index 85% rename from src/Common/SearchAttributes/SearchAttributeKey/StringValue.php rename to src/Common/SearchAttributes/SearchAttributeKey/TextValue.php index 76f829c2..98c934b7 100644 --- a/src/Common/SearchAttributes/SearchAttributeKey/StringValue.php +++ b/src/Common/SearchAttributes/SearchAttributeKey/TextValue.php @@ -11,7 +11,7 @@ /** * @psalm-immutable */ -final class StringValue extends SearchAttributeKey +final class TextValue extends SearchAttributeKey { public function valueSet(string|\Stringable $value): SearchAttributeUpdate { @@ -20,6 +20,6 @@ public function valueSet(string|\Stringable $value): SearchAttributeUpdate public function getType(): ValueType { - return ValueType::String; + return ValueType::Text; } } diff --git a/src/Common/SearchAttributes/ValueType.php b/src/Common/SearchAttributes/ValueType.php index e43daa9c..e04d8265 100644 --- a/src/Common/SearchAttributes/ValueType.php +++ b/src/Common/SearchAttributes/ValueType.php @@ -14,6 +14,6 @@ enum ValueType: string case Int = 'int64'; case Keyword = 'keyword'; case KeywordList = 'keyword_list'; - case String = 'string'; + case Text = 'string'; case Datetime = 'datetime'; } diff --git a/src/Common/TypedSearchAttributes.php b/src/Common/TypedSearchAttributes.php index 319fc59e..a3ee9715 100644 --- a/src/Common/TypedSearchAttributes.php +++ b/src/Common/TypedSearchAttributes.php @@ -112,7 +112,7 @@ public function withUntypedValue(string $name, mixed $value): self \is_float($value) => $this->withValue(SearchAttributeKey::forFloat($name), $value), \is_array($value) => $this->withValue(SearchAttributeKey::forKeywordList($name), $value), $value instanceof \Stringable, - \is_string($value) => $this->withValue(SearchAttributeKey::forString($name), $value), + \is_string($value) => $this->withValue(SearchAttributeKey::forText($name), $value), $value instanceof \DateTimeInterface => $this->withValue(SearchAttributeKey::forDatetime($name), $value), default => throw new \InvalidArgumentException('Unsupported value type.'), }; diff --git a/testing/src/Environment.php b/testing/src/Environment.php index 3c74441b..d9e2125a 100644 --- a/testing/src/Environment.php +++ b/testing/src/Environment.php @@ -83,7 +83,7 @@ public function startTemporalServer( ValueType::Int => 'int', ValueType::Keyword => 'keyword', ValueType::KeywordList => 'keywordList', - ValueType::String => 'text', + ValueType::Text => 'text', ValueType::Datetime => 'datetime', }; } diff --git a/tests/Acceptance/App/Runtime/TemporalStarter.php b/tests/Acceptance/App/Runtime/TemporalStarter.php index 44df7840..b96d520e 100644 --- a/tests/Acceptance/App/Runtime/TemporalStarter.php +++ b/tests/Acceptance/App/Runtime/TemporalStarter.php @@ -25,12 +25,12 @@ public function start(): void } $this->environment->startTemporalServer(searchAttributes: [ - 'foo' => ValueType::String->value, + 'foo' => ValueType::Text->value, 'bar' => ValueType::Int->value, 'testBool' => ValueType::Bool, 'testInt' => ValueType::Int, 'testFloat' => ValueType::Float, - 'testString' => ValueType::String, + 'testText' => ValueType::Text, 'testKeyword' => ValueType::Keyword, 'testKeywordList' => ValueType::KeywordList, 'testDatetime' => ValueType::Datetime, diff --git a/tests/Acceptance/Extra/Workflow/SearchAttributesTest.php b/tests/Acceptance/Extra/Workflow/SearchAttributesTest.php index 1b2fd7b5..2b25f0c7 100644 --- a/tests/Acceptance/Extra/Workflow/SearchAttributesTest.php +++ b/tests/Acceptance/Extra/Workflow/SearchAttributesTest.php @@ -31,7 +31,7 @@ public function testStartWithSearchAttributes( 'testFloat' => 1.1, 'testInt' => -2, 'testBool' => false, - 'testString' => 'foo', + 'testText' => 'foo', 'testKeyword' => 'bar', 'testKeywordList' => ['baz'], 'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'), @@ -50,7 +50,7 @@ public function testStartWithSearchAttributes( 'testBool' => false, 'testInt' => -2, 'testFloat' => 1.1, - 'testString' => 'foo', + 'testText' => 'foo', 'testKeyword' => 'bar', 'testKeywordList' => ['baz'], 'testDatetime' => (new \DateTimeImmutable('2019-01-01T00:00:00Z')) @@ -71,7 +71,7 @@ public function testUpsertSearchAttributes( 'testFloat' => 1.1, 'testInt' => -2, 'testBool' => false, - 'testString' => 'foo', + 'testText' => 'foo', 'testKeyword' => 'bar', 'testKeywordList' => ['baz'], 'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'), @@ -82,7 +82,7 @@ public function testUpsertSearchAttributes( 'testBool' => true, 'testInt' => 42, 'testFloat' => 1.0, - 'testString' => 'foo bar baz', + 'testText' => 'foo bar baz', 'testKeyword' => 'foo-bar-baz', 'testKeywordList' => ['foo', 'bar', 'baz'], 'testDatetime' => '2021-01-01T00:00:00+00:00', @@ -134,7 +134,7 @@ public function testUpsertSearchAttributesUnset( 'testFloat' => 1.1, 'testInt' => -2, 'testBool' => false, - 'testString' => 'foo', + 'testText' => 'foo', 'testKeyword' => 'bar', 'testKeywordList' => ['baz'], 'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'), @@ -144,7 +144,7 @@ public function testUpsertSearchAttributesUnset( $toSend = [ 'testInt' => 42, 'testBool' => null, - 'testString' => 'bar', + 'testText' => 'bar', 'testKeyword' => null, 'testKeywordList' => ['red'], 'testDatetime' => null, diff --git a/tests/Acceptance/Extra/Workflow/TypedSearchAttributesTest.php b/tests/Acceptance/Extra/Workflow/TypedSearchAttributesTest.php index 2892bc44..16baf928 100644 --- a/tests/Acceptance/Extra/Workflow/TypedSearchAttributesTest.php +++ b/tests/Acceptance/Extra/Workflow/TypedSearchAttributesTest.php @@ -34,7 +34,7 @@ public function testStartWithTypedSearchAttributes( ->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1) ->withValue(SearchAttributeKey::forInteger('testInt'), -2) ->withValue(SearchAttributeKey::forBool('testBool'), false) - ->withValue(SearchAttributeKey::forString('testString'), 'foo') + ->withValue(SearchAttributeKey::forText('testText'), 'foo') ->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar') ->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz']) ->withValue( @@ -56,7 +56,7 @@ public function testStartWithTypedSearchAttributes( 'testBool' => false, 'testInt' => -2, 'testFloat' => 1.1, - 'testString' => 'foo', + 'testText' => 'foo', 'testKeyword' => 'bar', 'testKeywordList' => ['baz'], 'testDatetime' => (new \DateTimeImmutable('2019-01-01T00:00:00Z')) @@ -78,7 +78,7 @@ public function testUpsertTypedSearchAttributes( ->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1) ->withValue(SearchAttributeKey::forInteger('testInt'), -2) ->withValue(SearchAttributeKey::forBool('testBool'), false) - ->withValue(SearchAttributeKey::forString('testString'), 'foo') + ->withValue(SearchAttributeKey::forText('testText'), 'foo') ->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar') ->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz']) ->withValue( @@ -92,7 +92,7 @@ public function testUpsertTypedSearchAttributes( 'testBool' => true, 'testInt' => 42, 'testFloat' => 1.0, - 'testString' => 'foo bar baz', + 'testText' => 'foo bar baz', 'testKeyword' => 'foo-bar-baz', 'testKeywordList' => ['foo', 'bar', 'baz'], 'testDatetime' => '2021-01-01T00:00:00+00:00', @@ -145,7 +145,7 @@ public function testUpsertTypedSearchAttributesUnset( ->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1) ->withValue(SearchAttributeKey::forInteger('testInt'), -2) ->withValue(SearchAttributeKey::forBool('testBool'), false) - ->withValue(SearchAttributeKey::forString('testString'), 'foo') + ->withValue(SearchAttributeKey::forText('testText'), 'foo') ->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar') ->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz']) ->withValue( @@ -158,7 +158,7 @@ public function testUpsertTypedSearchAttributesUnset( $toSend = [ 'testInt' => 42, 'testBool' => null, - 'testString' => 'bar', + 'testText' => 'bar', 'testKeyword' => null, 'testKeywordList' => ['red'], 'testDatetime' => null, diff --git a/tests/Unit/Common/TypedSearchAttributesTestCase.php b/tests/Unit/Common/TypedSearchAttributesTestCase.php index 5389c5ef..1cc1c17e 100644 --- a/tests/Unit/Common/TypedSearchAttributesTestCase.php +++ b/tests/Unit/Common/TypedSearchAttributesTestCase.php @@ -187,7 +187,7 @@ public function testFromJsonArray(): void self::assertSame(42, $collection->get(SearchAttributeKey::forInteger('name3'))); self::assertSame('bar', $collection->get(SearchAttributeKey::forKeyword('name4'))); self::assertSame(3.14, $collection->get(SearchAttributeKey::forFloat('name5'))); - self::assertSame('foo', $collection->get(SearchAttributeKey::forString('name6'))); + self::assertSame('foo', $collection->get(SearchAttributeKey::forText('name6'))); self::assertInstanceOf(\DateTimeImmutable::class, $collection->get(SearchAttributeKey::forDatetime('name7'))); self::assertSame( '2021-01-01T00:00:00+00:00', @@ -212,7 +212,7 @@ public function testFromUntypedCollection(): void self::assertTrue($collection->get(SearchAttributeKey::forBool('name1'))); self::assertFalse($collection->get(SearchAttributeKey::forBool('name2'))); self::assertSame(42, $collection->get(SearchAttributeKey::forInteger('name3'))); - self::assertSame('bar', $collection->get(SearchAttributeKey::forString('name4'))); + self::assertSame('bar', $collection->get(SearchAttributeKey::forText('name4'))); self::assertSame(3.14, $collection->get(SearchAttributeKey::forFloat('name5'))); self::assertInstanceOf(\DateTimeImmutable::class, $collection->get(SearchAttributeKey::forDatetime('name7'))); self::assertSame('2021-01-01T00:00:00+00:00', $collection->get(SearchAttributeKey::forDatetime('name7'))->format(DATE_RFC3339)); @@ -225,7 +225,7 @@ public function testValues() ->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1) ->withValue(SearchAttributeKey::forInteger('testInt'), -2) ->withValue(SearchAttributeKey::forBool('testBool'), false) - ->withValue(SearchAttributeKey::forString('testString'), 'foo') + ->withValue(SearchAttributeKey::forText('testText'), 'foo') ->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar') ->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz']) ->withValue(