├── LICENSE.md ├── README.md ├── composer.json ├── resources ├── .phpstorm.meta.php ├── client.meta-storm.xml ├── collections.meta-storm.xml └── workflow.meta-storm.xml ├── src ├── Activity.php ├── Activity │ ├── ActivityCancellationType.php │ ├── ActivityContextInterface.php │ ├── ActivityInfo.php │ ├── ActivityInterface.php │ ├── ActivityMethod.php │ ├── ActivityOptions.php │ ├── ActivityOptionsInterface.php │ ├── ActivityType.php │ ├── LocalActivityInterface.php │ └── LocalActivityOptions.php ├── Client │ ├── ActivityCompletionClientInterface.php │ ├── ClientOptions.php │ ├── Common │ │ ├── BackoffThrottler.php │ │ ├── ClientContextInterface.php │ │ ├── ClientContextTrait.php │ │ ├── Paginator.php │ │ ├── RpcRetryOptions.php │ │ └── ServerCapabilities.php │ ├── CountWorkflowExecutions.php │ ├── GRPC │ │ ├── BaseClient.php │ │ ├── Connection │ │ │ ├── Connection.php │ │ │ ├── ConnectionInterface.php │ │ │ └── ConnectionState.php │ │ ├── Context.php │ │ ├── ContextInterface.php │ │ ├── ServiceClient.php │ │ ├── ServiceClientInterface.php │ │ └── StatusCode.php │ ├── Interceptor │ │ └── SystemInfoInterceptor.php │ ├── Schedule │ │ ├── Action │ │ │ ├── ScheduleAction.php │ │ │ └── StartWorkflowAction.php │ │ ├── BackfillPeriod.php │ │ ├── Info │ │ │ ├── ScheduleActionResult.php │ │ │ ├── ScheduleDescription.php │ │ │ ├── ScheduleInfo.php │ │ │ ├── ScheduleListEntry.php │ │ │ └── ScheduleListInfo.php │ │ ├── Policy │ │ │ ├── ScheduleOverlapPolicy.php │ │ │ └── SchedulePolicies.php │ │ ├── Schedule.php │ │ ├── ScheduleHandle.php │ │ ├── ScheduleOptions.php │ │ ├── Spec │ │ │ ├── CalendarSpec.php │ │ │ ├── IntervalSpec.php │ │ │ ├── Range.php │ │ │ ├── ScheduleSpec.php │ │ │ ├── ScheduleState.php │ │ │ └── StructuredCalendarSpec.php │ │ └── Update │ │ │ ├── ScheduleUpdate.php │ │ │ └── ScheduleUpdateInput.php │ ├── ScheduleClient.php │ ├── ScheduleClientInterface.php │ ├── ServerCapabilities.php │ ├── Update │ │ ├── LifecycleStage.php │ │ ├── UpdateHandle.php │ │ ├── UpdateOptions.php │ │ └── WaitPolicy.php │ ├── Workflow │ │ ├── CountWorkflowExecutions.php │ │ ├── UserMetadata.php │ │ ├── WorkflowExecutionDescription.php │ │ └── WorkflowExecutionHistory.php │ ├── WorkflowClient.php │ ├── WorkflowClientInterface.php │ ├── WorkflowOptions.php │ └── WorkflowStubInterface.php ├── Common │ ├── CronSchedule.php │ ├── IdReusePolicy.php │ ├── MethodRetry.php │ ├── Priority.php │ ├── RetryOptions.php │ ├── SdkVersion.php │ ├── SearchAttributes │ │ ├── SearchAttributeKey.php │ │ ├── SearchAttributeKey │ │ │ ├── BoolValue.php │ │ │ ├── DatetimeValue.php │ │ │ ├── FloatValue.php │ │ │ ├── IntValue.php │ │ │ ├── KeywordListValue.php │ │ │ ├── KeywordValue.php │ │ │ └── TextValue.php │ │ ├── SearchAttributeUpdate.php │ │ ├── SearchAttributeUpdate │ │ │ ├── ValueSet.php │ │ │ └── ValueUnset.php │ │ └── ValueType.php │ ├── TaskQueue │ │ └── TaskQueue.php │ ├── TypedSearchAttributes.php │ ├── Uuid.php │ ├── WorkerVersionStamp.php │ └── WorkflowIdConflictPolicy.php ├── DataConverter │ ├── BinaryConverter.php │ ├── Bytes.php │ ├── Converter.php │ ├── DataConverter.php │ ├── DataConverterInterface.php │ ├── EncodedCollection.php │ ├── EncodedValues.php │ ├── EncodingKeys.php │ ├── JsonConverter.php │ ├── NullConverter.php │ ├── PayloadConverterInterface.php │ ├── ProtoConverter.php │ ├── ProtoJsonConverter.php │ ├── Type.php │ └── ValuesInterface.php ├── Exception │ ├── Client │ │ ├── ActivityCanceledException.php │ │ ├── ActivityCompletionException.php │ │ ├── ActivityCompletionFailureException.php │ │ ├── ActivityNotExistsException.php │ │ ├── ActivityWorkerShutdownException.php │ │ ├── CanceledException.php │ │ ├── MultyOperation │ │ │ └── OperationStatus.php │ │ ├── ServiceClientException.php │ │ ├── TimeoutException.php │ │ ├── UnpackDetailsTrait.php │ │ ├── WorkflowException.php │ │ ├── WorkflowExecutionAlreadyStartedException.php │ │ ├── WorkflowFailedException.php │ │ ├── WorkflowNotFoundException.php │ │ ├── WorkflowQueryException.php │ │ ├── WorkflowQueryRejectedException.php │ │ ├── WorkflowServiceException.php │ │ ├── WorkflowUpdateException.php │ │ └── WorkflowUpdateRPCTimeoutOrCanceledException.php │ ├── CompensationException.php │ ├── DataConverterException.php │ ├── DestructMemorizedInstanceException.php │ ├── DoNotCompleteOnResultException.php │ ├── ExceptionInterceptor.php │ ├── ExceptionInterceptorInterface.php │ ├── FailedCancellationException.php │ ├── Failure │ │ ├── ActivityFailure.php │ │ ├── ApplicationFailure.php │ │ ├── CanceledFailure.php │ │ ├── ChildWorkflowFailure.php │ │ ├── FailureConverter.php │ │ ├── ServerFailure.php │ │ ├── TemporalFailure.php │ │ ├── TerminatedFailure.php │ │ └── TimeoutFailure.php │ ├── IllegalStateException.php │ ├── InstantiationException.php │ ├── InvalidArgumentException.php │ ├── MarshallerException.php │ ├── OutOfContextException.php │ ├── ProtocolException.php │ ├── TemporalException.php │ ├── TransportException.php │ └── WorkflowExecutionFailedException.php ├── Interceptor │ ├── ActivityInbound │ │ └── ActivityInput.php │ ├── ActivityInboundInterceptor.php │ ├── GrpcClientInterceptor.php │ ├── Header.php │ ├── HeaderInterface.php │ ├── PipelineProvider.php │ ├── SimplePipelineProvider.php │ ├── Trait │ │ ├── ActivityInboundInterceptorTrait.php │ │ ├── WorkflowClientCallsInterceptorTrait.php │ │ ├── WorkflowInboundCallsInterceptorTrait.php │ │ ├── WorkflowOutboundCallsInterceptorTrait.php │ │ └── WorkflowOutboundRequestInterceptorTrait.php │ ├── WorkflowClient │ │ ├── CancelInput.php │ │ ├── DescribeInput.php │ │ ├── GetResultInput.php │ │ ├── QueryInput.php │ │ ├── SignalInput.php │ │ ├── SignalWithStartInput.php │ │ ├── StartInput.php │ │ ├── StartUpdateOutput.php │ │ ├── TerminateInput.php │ │ ├── UpdateInput.php │ │ ├── UpdateRef.php │ │ ├── UpdateWithStartInput.php │ │ └── UpdateWithStartOutput.php │ ├── WorkflowClientCallsInterceptor.php │ ├── WorkflowInbound │ │ ├── QueryInput.php │ │ ├── SignalInput.php │ │ ├── UpdateInput.php │ │ └── WorkflowInput.php │ ├── WorkflowInboundCallsInterceptor.php │ ├── WorkflowOutboundCalls │ │ ├── AwaitInput.php │ │ ├── AwaitWithTimeoutInput.php │ │ ├── CancelExternalWorkflowInput.php │ │ ├── CompleteInput.php │ │ ├── ContinueAsNewInput.php │ │ ├── ExecuteActivityInput.php │ │ ├── ExecuteChildWorkflowInput.php │ │ ├── ExecuteLocalActivityInput.php │ │ ├── GetVersionInput.php │ │ ├── PanicInput.php │ │ ├── SideEffectInput.php │ │ ├── SignalExternalWorkflowInput.php │ │ ├── TimerInput.php │ │ ├── UpsertMemoInput.php │ │ ├── UpsertSearchAttributesInput.php │ │ └── UpsertTypedSearchAttributesInput.php │ ├── WorkflowOutboundCallsInterceptor.php │ └── WorkflowOutboundRequestInterceptor.php ├── Internal │ ├── Activity │ │ └── ActivityContext.php │ ├── Assert.php │ ├── Client │ │ ├── ActivityCompletionClient.php │ │ ├── ResponseToResultMapper.php │ │ ├── WorkflowProxy.php │ │ ├── WorkflowRun.php │ │ ├── WorkflowStarter.php │ │ └── WorkflowStub.php │ ├── Declaration │ │ ├── ActivityInstance.php │ │ ├── ActivityInstanceInterface.php │ │ ├── Destroyable.php │ │ ├── Dispatcher │ │ │ ├── AutowiredPayloads.php │ │ │ ├── Dispatcher.php │ │ │ └── DispatcherInterface.php │ │ ├── Graph │ │ │ ├── ClassNode.php │ │ │ └── NodeInterface.php │ │ ├── Instance.php │ │ ├── InstanceInterface.php │ │ ├── Instantiator │ │ │ ├── ActivityInstantiator.php │ │ │ ├── Instantiator.php │ │ │ ├── InstantiatorInterface.php │ │ │ └── WorkflowInstantiator.php │ │ ├── MethodHandler.php │ │ ├── Prototype │ │ │ ├── ActivityCollection.php │ │ │ ├── ActivityPrototype.php │ │ │ ├── Prototype.php │ │ │ ├── PrototypeInterface.php │ │ │ ├── QueryDefinition.php │ │ │ ├── SignalDefinition.php │ │ │ ├── UpdateDefinition.php │ │ │ ├── WorkflowCollection.php │ │ │ └── WorkflowPrototype.php │ │ ├── Reader │ │ │ ├── ActivityReader.php │ │ │ ├── Reader.php │ │ │ ├── RecursiveAttributeReducerInterface.php │ │ │ └── WorkflowReader.php │ │ ├── WorkflowInstance.php │ │ ├── WorkflowInstance │ │ │ ├── SignalQueue.php │ │ │ └── SignalQueueItem.php │ │ └── WorkflowInstanceInterface.php │ ├── Events │ │ ├── EventEmitterInterface.php │ │ ├── EventEmitterTrait.php │ │ └── EventListenerInterface.php │ ├── Interceptor │ │ ├── HeaderCarrier.php │ │ ├── Interceptor.php │ │ └── Pipeline.php │ ├── Mapper │ │ ├── ScheduleMapper.php │ │ ├── WorkflowExecutionConfigMapper.php │ │ └── WorkflowExecutionInfoMapper.php │ ├── Marshaller │ │ ├── Mapper │ │ │ ├── AttributeMapper.php │ │ │ ├── AttributeMapperFactory.php │ │ │ ├── MapperFactoryInterface.php │ │ │ └── MapperInterface.php │ │ ├── Marshaller.php │ │ ├── MarshallerInterface.php │ │ ├── MarshallingRule.php │ │ ├── Meta │ │ │ ├── Marshal.php │ │ │ ├── MarshalArray.php │ │ │ ├── MarshalAssocArray.php │ │ │ ├── MarshalDateTime.php │ │ │ ├── MarshalNullable.php │ │ │ ├── MarshalOneOf.php │ │ │ └── Scope.php │ │ ├── ProtoToArrayConverter.php │ │ ├── RuleFactoryInterface.php │ │ ├── Type │ │ │ ├── ActivityCancellationType.php │ │ │ ├── ArrayType.php │ │ │ ├── AssocArrayType.php │ │ │ ├── ChildWorkflowCancellationType.php │ │ │ ├── CronType.php │ │ │ ├── DateIntervalType.php │ │ │ ├── DateTimeType.php │ │ │ ├── DetectableTypeInterface.php │ │ │ ├── DurationJsonType.php │ │ │ ├── EncodedCollectionType.php │ │ │ ├── EnumType.php │ │ │ ├── EnumValueType.php │ │ │ ├── NullableType.php │ │ │ ├── ObjectType.php │ │ │ ├── OneOfType.php │ │ │ ├── RuleFactoryInterface.php │ │ │ ├── Type.php │ │ │ ├── TypeInterface.php │ │ │ └── UuidType.php │ │ ├── TypeFactory.php │ │ └── TypeFactoryInterface.php │ ├── Promise │ │ ├── CancellationQueue.php │ │ └── Reasons.php │ ├── Queue │ │ ├── ArrayQueue.php │ │ └── QueueInterface.php │ ├── Repository │ │ ├── ArrayRepository.php │ │ ├── Identifiable.php │ │ └── RepositoryInterface.php │ ├── ServiceContainer.php │ ├── Support │ │ ├── DateInterval.php │ │ ├── DateTime.php │ │ ├── Diff.php │ │ ├── Facade.php │ │ ├── GarbageCollector.php │ │ ├── Inheritance.php │ │ ├── Options.php │ │ ├── Process.php │ │ ├── Reflection.php │ │ └── StackRenderer.php │ ├── Traits │ │ └── CloneWith.php │ ├── Transport │ │ ├── Client.php │ │ ├── ClientInterface.php │ │ ├── CompletableResult.php │ │ ├── CompletableResultInterface.php │ │ ├── DetachedClient.php │ │ ├── Request │ │ │ ├── Cancel.php │ │ │ ├── CancelExternalWorkflow.php │ │ │ ├── CompleteWorkflow.php │ │ │ ├── ContinueAsNew.php │ │ │ ├── ExecuteActivity.php │ │ │ ├── ExecuteChildWorkflow.php │ │ │ ├── ExecuteLocalActivity.php │ │ │ ├── GetChildWorkflowExecution.php │ │ │ ├── GetVersion.php │ │ │ ├── NewTimer.php │ │ │ ├── Panic.php │ │ │ ├── SideEffect.php │ │ │ ├── SignalExternalWorkflow.php │ │ │ ├── UndefinedResponse.php │ │ │ ├── UpsertMemo.php │ │ │ ├── UpsertSearchAttributes.php │ │ │ └── UpsertTypedSearchAttributes.php │ │ ├── Router.php │ │ ├── Router │ │ │ ├── CancelWorkflow.php │ │ │ ├── DestroyWorkflow.php │ │ │ ├── GetWorkerInfo.php │ │ │ ├── InvokeActivity.php │ │ │ ├── InvokeLocalActivity.php │ │ │ ├── InvokeQuery.php │ │ │ ├── InvokeSignal.php │ │ │ ├── InvokeUpdate.php │ │ │ ├── Route.php │ │ │ ├── RouteInterface.php │ │ │ ├── StackTrace.php │ │ │ ├── StartWorkflow.php │ │ │ └── WorkflowProcessAwareRoute.php │ │ ├── RouterInterface.php │ │ ├── Server.php │ │ └── ServerInterface.php │ └── Workflow │ │ ├── ActivityProxy.php │ │ ├── ActivityStub.php │ │ ├── ChildWorkflowProxy.php │ │ ├── ChildWorkflowStub.php │ │ ├── ContinueAsNewProxy.php │ │ ├── ExternalWorkflowProxy.php │ │ ├── ExternalWorkflowStub.php │ │ ├── Input.php │ │ ├── Logger.php │ │ ├── Process │ │ ├── DeferredGenerator.php │ │ ├── HandlerState.php │ │ ├── Process.php │ │ └── Scope.php │ │ ├── ProcessCollection.php │ │ ├── Proxy.php │ │ ├── ScopeContext.php │ │ └── WorkflowContext.php ├── Promise.php ├── Worker │ ├── ActivityInvocationCache │ │ ├── ActivityInvocationCacheInterface.php │ │ ├── ActivityInvocationFailure.php │ │ ├── ActivityInvocationResult.php │ │ ├── InMemoryActivityInvocationCache.php │ │ └── RoadRunnerActivityInvocationCache.php │ ├── ChildWorkflowCancellationType.php │ ├── DispatcherInterface.php │ ├── Environment │ │ ├── Environment.php │ │ └── EnvironmentInterface.php │ ├── FeatureFlags.php │ ├── Logger │ │ └── StderrLogger.php │ ├── LoopInterface.php │ ├── ServiceCredentials.php │ ├── Transport │ │ ├── Codec │ │ │ ├── CodecInterface.php │ │ │ ├── JsonCodec.php │ │ │ ├── JsonCodec │ │ │ │ ├── Decoder.php │ │ │ │ └── Encoder.php │ │ │ ├── ProtoCodec.php │ │ │ └── ProtoCodec │ │ │ │ ├── Decoder.php │ │ │ │ └── Encoder.php │ │ ├── Command │ │ │ ├── Client │ │ │ │ ├── FailedClientResponse.php │ │ │ │ ├── Request.php │ │ │ │ ├── SuccessClientResponse.php │ │ │ │ └── UpdateResponse.php │ │ │ ├── CommandInterface.php │ │ │ ├── Common │ │ │ │ └── RequestTrait.php │ │ │ ├── FailureResponseInterface.php │ │ │ ├── RequestInterface.php │ │ │ ├── ResponseInterface.php │ │ │ ├── Server │ │ │ │ ├── FailureResponse.php │ │ │ │ ├── ServerRequest.php │ │ │ │ ├── ServerResponse.php │ │ │ │ ├── SuccessResponse.php │ │ │ │ └── TickInfo.php │ │ │ ├── ServerRequestInterface.php │ │ │ ├── ServerResponseInterface.php │ │ │ └── SuccessResponseInterface.php │ │ ├── CommandBatch.php │ │ ├── Goridge.php │ │ ├── HostConnectionInterface.php │ │ ├── RPCConnectionInterface.php │ │ ├── RoadRunner.php │ │ └── RoadRunnerVersionChecker.php │ ├── Worker.php │ ├── WorkerFactoryInterface.php │ ├── WorkerInterface.php │ ├── WorkerOptions.php │ └── WorkflowPanicPolicy.php ├── WorkerFactory.php ├── Workflow.php └── Workflow │ ├── ActivityStubInterface.php │ ├── CancellationScopeInterface.php │ ├── ChildWorkflowCancellationType.php │ ├── ChildWorkflowOptions.php │ ├── ChildWorkflowStubInterface.php │ ├── ContinueAsNewOptions.php │ ├── ExternalWorkflowStubInterface.php │ ├── HandlerUnfinishedPolicy.php │ ├── Mutex.php │ ├── ParentClosePolicy.php │ ├── ProcessInterface.php │ ├── QueryMethod.php │ ├── ResetPointInfo.php │ ├── ReturnType.php │ ├── Saga.php │ ├── ScopedContextInterface.php │ ├── SignalMethod.php │ ├── UpdateContext.php │ ├── UpdateMethod.php │ ├── UpdateValidatorMethod.php │ ├── WorkflowContextInterface.php │ ├── WorkflowExecution.php │ ├── WorkflowExecutionConfig.php │ ├── WorkflowExecutionInfo.php │ ├── WorkflowExecutionStatus.php │ ├── WorkflowInfo.php │ ├── WorkflowInit.php │ ├── WorkflowInterface.php │ ├── WorkflowMethod.php │ ├── WorkflowRunInterface.php │ ├── WorkflowStub.php │ └── WorkflowType.php └── testing ├── Readme.md ├── api └── testservice │ ├── GPBMetadata │ └── Temporal │ │ └── Api │ │ └── Testservice │ │ └── V1 │ │ ├── RequestResponse.php │ │ └── Service.php │ └── Temporal │ └── Api │ └── Testservice │ └── V1 │ ├── GetCurrentTimeResponse.php │ ├── LockTimeSkippingRequest.php │ ├── LockTimeSkippingResponse.php │ ├── SleepRequest.php │ ├── SleepResponse.php │ ├── SleepUntilRequest.php │ ├── TestServiceClient.php │ ├── UnlockTimeSkippingRequest.php │ └── UnlockTimeSkippingResponse.php ├── proto └── temporal │ └── api │ └── testservice │ └── v1 │ ├── request_response.proto │ └── service.proto ├── scripts └── generate-proto.php └── src ├── ActivityMocker.php ├── Downloader.php ├── Environment.php ├── Replay ├── Exception │ ├── InternalServerException.php │ ├── InvalidArgumentException.php │ ├── NonDeterministicWorkflowException.php │ ├── RPCException.php │ └── ReplayerException.php └── WorkflowReplayer.php ├── SystemInfo.php ├── TestService.php ├── WithoutTimeSkipping.php ├── WorkerFactory.php ├── WorkerMock.php └── WorkflowTestCase.php /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /resources/collections.meta-storm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Activity/ActivityMethod.php: -------------------------------------------------------------------------------- 1 | name = $name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Activity/ActivityOptionsInterface.php: -------------------------------------------------------------------------------- 1 | > $metadata 27 | */ 28 | public function withMetadata(array $metadata): static; 29 | } 30 | -------------------------------------------------------------------------------- /src/Client/CountWorkflowExecutions.php: -------------------------------------------------------------------------------- 1 | serviceClient->getServerCapabilities(); 34 | 35 | return $next($method, $arg, $ctx); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Client/Schedule/Action/ScheduleAction.php: -------------------------------------------------------------------------------- 1 | lifecycleStage = LifecycleStage::StageUnspecified; 29 | } 30 | 31 | public static function new(): self 32 | { 33 | return new self(); 34 | } 35 | 36 | /** 37 | * Indicates the update lifecycle stage that the gRPC call should wait for before returning. 38 | */ 39 | public function withLifecycleStage(LifecycleStage $value): self 40 | { 41 | /** @see self::$lifecycleStage */ 42 | return $this->with('lifecycleStage', $value); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Client/Workflow/CountWorkflowExecutions.php: -------------------------------------------------------------------------------- 1 | prepareValueSet($value); 19 | } 20 | 21 | public function getType(): ValueType 22 | { 23 | return ValueType::Bool; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/DatetimeValue.php: -------------------------------------------------------------------------------- 1 | prepareValueSet(match (true) { 22 | \is_string($value) => new \DateTimeImmutable($value), 23 | $value instanceof \DateTimeImmutable => $value, 24 | default => \DateTimeImmutable::createFromInterface($value), 25 | }); 26 | } 27 | 28 | public function getType(): ValueType 29 | { 30 | return ValueType::Datetime; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/FloatValue.php: -------------------------------------------------------------------------------- 1 | prepareValueSet($value); 19 | } 20 | 21 | public function getType(): ValueType 22 | { 23 | return ValueType::Float; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/IntValue.php: -------------------------------------------------------------------------------- 1 | prepareValueSet($value); 19 | } 20 | 21 | public function getType(): ValueType 22 | { 23 | return ValueType::Int; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/KeywordListValue.php: -------------------------------------------------------------------------------- 1 | $value 18 | */ 19 | public function valueSet(array $value): SearchAttributeUpdate 20 | { 21 | $values = []; 22 | foreach ($value as $v) { 23 | $values[] = (string) $v; 24 | } 25 | 26 | return $this->prepareValueSet($values); 27 | } 28 | 29 | public function getType(): ValueType 30 | { 31 | return ValueType::KeywordList; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/KeywordValue.php: -------------------------------------------------------------------------------- 1 | prepareValueSet((string) $value); 19 | } 20 | 21 | public function getType(): ValueType 22 | { 23 | return ValueType::Keyword; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeKey/TextValue.php: -------------------------------------------------------------------------------- 1 | prepareValueSet((string) $value); 19 | } 20 | 21 | public function getType(): ValueType 22 | { 23 | return ValueType::Text; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/SearchAttributes/SearchAttributeUpdate.php: -------------------------------------------------------------------------------- 1 | name = $name; 24 | } 25 | 26 | public static function new(string $name): self 27 | { 28 | return new self($name); 29 | } 30 | 31 | public function withName(string $name): self 32 | { 33 | /** @see self::$name */ 34 | return $this->with('name', $name); 35 | } 36 | 37 | public function __toString(): string 38 | { 39 | return $this->name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Common/WorkerVersionStamp.php: -------------------------------------------------------------------------------- 1 | data = $data; 21 | } 22 | 23 | public function getSize(): int 24 | { 25 | return \strlen($this->data); 26 | } 27 | 28 | public function getData(): string 29 | { 30 | return $this->data; 31 | } 32 | 33 | /** 34 | * @return string 35 | */ 36 | public function __toString() 37 | { 38 | return $this->data; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/DataConverter/Converter.php: -------------------------------------------------------------------------------- 1 | setMetadata([EncodingKeys::METADATA_ENCODING_KEY => $this->getEncodingType()]); 22 | $payload->setData($data); 23 | 24 | return $payload; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataConverter/DataConverterInterface.php: -------------------------------------------------------------------------------- 1 | create(''); 34 | } 35 | 36 | /** 37 | * @return null 38 | */ 39 | public function fromPayload(Payload $payload, Type $type) 40 | { 41 | if (!$type->isUntyped() && !$type->allowsNull()) { 42 | throw new DataConverterException('Unable to convert null to non nullable type'); 43 | } 44 | 45 | return null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/DataConverter/PayloadConverterInterface.php: -------------------------------------------------------------------------------- 1 | &RepeatedField $details 21 | */ 22 | private function __construct( 23 | private readonly \Traversable $details, 24 | private readonly string $message, 25 | ) {} 26 | 27 | public static function fromMessage(OperationStatusMessage $message): self 28 | { 29 | return new self($message->getDetails(), $message->getMessage()); 30 | } 31 | 32 | public function getMessage(): string 33 | { 34 | return $this->message; 35 | } 36 | 37 | /** 38 | * @return \ArrayAccess&RepeatedField 39 | */ 40 | private function getDetails(): \Traversable 41 | { 42 | return $this->details; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Exception/Client/TimeoutException.php: -------------------------------------------------------------------------------- 1 | $class 21 | * @return T|null 22 | * @throws \Exception 23 | */ 24 | public function getFailure(string $class): ?object 25 | { 26 | $details = $this->getDetails(); 27 | if ($details->count() === 0) { 28 | return null; 29 | } 30 | 31 | // ensures that message descriptor was added to the pool 32 | Message::initOnce(); 33 | 34 | /** @var Any $detail */ 35 | foreach ($details as $detail) { 36 | if ($detail->is($class)) { 37 | return $detail->unpack(); 38 | } 39 | } 40 | 41 | return null; 42 | } 43 | 44 | /** 45 | * @return \ArrayAccess&RepeatedField 46 | */ 47 | abstract private function getDetails(): iterable; 48 | } 49 | -------------------------------------------------------------------------------- /src/Exception/Client/WorkflowExecutionAlreadyStartedException.php: -------------------------------------------------------------------------------- 1 | queryRejectCondition = $queryRejectCondition; 30 | $this->workflowExecutionStatus = $workflowExecutionStatus; 31 | } 32 | 33 | public function getQueryRejectCondition(): int 34 | { 35 | return $this->queryRejectCondition; 36 | } 37 | 38 | public function getWorkflowExecutionStatus(): int 39 | { 40 | return $this->workflowExecutionStatus; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Exception/Client/WorkflowServiceException.php: -------------------------------------------------------------------------------- 1 | updateId; 32 | } 33 | 34 | public function getUpdateName(): string 35 | { 36 | return $this->updateName; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Exception/Client/WorkflowUpdateRPCTimeoutOrCanceledException.php: -------------------------------------------------------------------------------- 1 | getPrevious(), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Exception/CompensationException.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | private array $suppressed = []; 20 | 21 | public function addSuppressed(\Throwable $e): void 22 | { 23 | $this->suppressed[] = $e; 24 | } 25 | 26 | /** 27 | * @return \Throwable[] 28 | */ 29 | public function getSuppressed(): array 30 | { 31 | return $this->suppressed; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Exception/DataConverterException.php: -------------------------------------------------------------------------------- 1 | retryableErrors = $retryableErrors; 25 | } 26 | 27 | /** 28 | * @return static 29 | */ 30 | public static function createDefault(): self 31 | { 32 | return new self([\Error::class]); 33 | } 34 | 35 | public function isRetryable(\Throwable $e): bool 36 | { 37 | foreach ($this->retryableErrors as $retryableError) { 38 | if ($e instanceof $retryableError) { 39 | return true; 40 | } 41 | } 42 | 43 | return false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Exception/ExceptionInterceptorInterface.php: -------------------------------------------------------------------------------- 1 | details = $details ?? EncodedValues::empty(); 26 | } 27 | 28 | public function getDetails(): ValuesInterface 29 | { 30 | return $this->details; 31 | } 32 | 33 | public function setDataConverter(DataConverterInterface $converter): void 34 | { 35 | $this->details->setDataConverter($converter); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Exception/Failure/ServerFailure.php: -------------------------------------------------------------------------------- 1 | nonRetryable = $nonRetryable; 26 | } 27 | 28 | public function isNonRetryable(): bool 29 | { 30 | return $this->nonRetryable; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Exception/Failure/TerminatedFailure.php: -------------------------------------------------------------------------------- 1 | failure = $failure; 29 | $this->lastWorkflowTaskCompletedEventId = $lastWorkflowTaskCompletedEventId; 30 | $this->retryState = $retryState; 31 | } 32 | 33 | public function getFailure(): Failure 34 | { 35 | return $this->failure; 36 | } 37 | 38 | public function getWorkflowTaskCompletedEventId(): int 39 | { 40 | return $this->lastWorkflowTaskCompletedEventId; 41 | } 42 | 43 | public function getRetryState(): int 44 | { 45 | return $this->retryState; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Interceptor/ActivityInbound/ActivityInput.php: -------------------------------------------------------------------------------- 1 | arguments, 37 | $header ?? $this->header, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Interceptor/ActivityInboundInterceptor.php: -------------------------------------------------------------------------------- 1 | $this->toPayloadArray()]); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Interceptor/HeaderInterface.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | interface HeaderInterface extends \Countable, IteratorAggregate 25 | { 26 | /** 27 | * Checks if any value present. 28 | */ 29 | public function isEmpty(): bool; 30 | 31 | /** 32 | * @param TKey $name 33 | * @param Type|TypeEnum|mixed $type 34 | * 35 | * @return mixed Returns {@see null} if value not found. 36 | */ 37 | public function getValue(int|string $name, mixed $type = null): mixed; 38 | 39 | /** 40 | * @param TKey $name 41 | * @param TValue $value 42 | * 43 | * @psalm-mutation-free 44 | */ 45 | public function withValue(int|string $name, mixed $value): static; 46 | } 47 | -------------------------------------------------------------------------------- /src/Interceptor/PipelineProvider.php: -------------------------------------------------------------------------------- 1 | $interceptorClass Only interceptors of this type will be returned in pipeline. 29 | * 30 | * @return Pipeline 31 | */ 32 | public function getPipeline(string $interceptorClass): Pipeline; 33 | } 34 | -------------------------------------------------------------------------------- /src/Interceptor/SimplePipelineProvider.php: -------------------------------------------------------------------------------- 1 | $interceptors 23 | */ 24 | public function __construct( 25 | private iterable $interceptors = [], 26 | ) {} 27 | 28 | public function getPipeline(string $interceptorClass): Pipeline 29 | { 30 | return $this->cache[$interceptorClass] ??= Pipeline::prepare( 31 | \array_filter( 32 | $this->interceptors, 33 | static fn(Interceptor $i): bool => $i instanceof $interceptorClass, 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Interceptor/Trait/ActivityInboundInterceptorTrait.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/DescribeInput.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 36 | $namespace ?? $this->namespace, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/GetResultInput.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 39 | $workflowType ?? $this->workflowType, 40 | $timeout ?? $this->timeout, 41 | $this->type, 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/QueryInput.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 40 | $this->workflowType, 41 | $queryType ?? $this->queryType, 42 | $arguments ?? $this->arguments, 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/SignalInput.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 39 | $this->workflowType, 40 | $signalName ?? $this->signalName, 41 | $arguments ?? $this->arguments, 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/StartUpdateOutput.php: -------------------------------------------------------------------------------- 1 | reference; 27 | } 28 | 29 | public function hasResult(): bool 30 | { 31 | return $this->hasResult; 32 | } 33 | 34 | public function getResult(): ?ValuesInterface 35 | { 36 | return $this->result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/TerminateInput.php: -------------------------------------------------------------------------------- 1 | workflowExecution, 36 | $reason ?? $this->reason, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/UpdateRef.php: -------------------------------------------------------------------------------- 1 | workflowStartInput, 34 | $updateInput ?? $this->updateInput, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowClient/UpdateWithStartOutput.php: -------------------------------------------------------------------------------- 1 | queryName, 39 | $arguments ?? $this->arguments, 40 | $info ?? $this->info, 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowInbound/WorkflowInput.php: -------------------------------------------------------------------------------- 1 | info, 41 | $arguments ?? $this->arguments, 42 | $header ?? $this->header, 43 | $this->isReplaying, 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/AwaitInput.php: -------------------------------------------------------------------------------- 1 | $conditions 20 | */ 21 | public function __construct( 22 | public readonly array $conditions, 23 | ) {} 24 | 25 | /** 26 | * @param array $conditions 27 | */ 28 | public function with( 29 | ?array $conditions = null, 30 | ): self { 31 | return new self( 32 | $conditions ?? $this->conditions, 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/AwaitWithTimeoutInput.php: -------------------------------------------------------------------------------- 1 | $conditions 27 | */ 28 | public function __construct( 29 | public readonly \DateInterval $interval, 30 | public readonly array $conditions, 31 | ) {} 32 | 33 | /** 34 | * @param array $conditions 35 | */ 36 | public function with( 37 | ?\DateInterval $interval = null, 38 | ?array $conditions = null, 39 | ): self { 40 | return new self( 41 | $interval ?? $this->interval, 42 | $conditions ?? $this->conditions, 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/CancelExternalWorkflowInput.php: -------------------------------------------------------------------------------- 1 | namespace, 36 | $workflowId ?? $this->workflowId, 37 | $runId ?? $this->runId, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/CompleteInput.php: -------------------------------------------------------------------------------- 1 | result, 34 | $failure ?? $this->failure, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/ContinueAsNewInput.php: -------------------------------------------------------------------------------- 1 | type, 38 | $args ?? $this->args, 39 | $options ?? $this->options, 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/ExecuteChildWorkflowInput.php: -------------------------------------------------------------------------------- 1 | type, 40 | $args ?? $this->args, 41 | $options ?? $this->options, 42 | $returnType ?? $this->returnType, 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/GetVersionInput.php: -------------------------------------------------------------------------------- 1 | changeId, 36 | $minSupported ?? $this->minSupported, 37 | $maxSupported ?? $this->maxSupported, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/PanicInput.php: -------------------------------------------------------------------------------- 1 | failure, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/SideEffectInput.php: -------------------------------------------------------------------------------- 1 | callable, 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/TimerInput.php: -------------------------------------------------------------------------------- 1 | interval, 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/UpsertMemoInput.php: -------------------------------------------------------------------------------- 1 | $memo 21 | * 22 | * @no-named-arguments 23 | * @internal Don't use the constructor. Use {@see self::with()} instead. 24 | */ 25 | public function __construct( 26 | public readonly array $memo, 27 | ) {} 28 | 29 | public function with( 30 | ?array $memo = null, 31 | ): self { 32 | return new self( 33 | $memo ?? $this->memo, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/UpsertSearchAttributesInput.php: -------------------------------------------------------------------------------- 1 | $searchAttributes 21 | * 22 | * @no-named-arguments 23 | * @internal Don't use the constructor. Use {@see self::with()} instead. 24 | */ 25 | public function __construct( 26 | public readonly array $searchAttributes, 27 | ) {} 28 | 29 | public function with( 30 | ?array $searchAttributes = null, 31 | ): self { 32 | return new self( 33 | $searchAttributes ?? $this->searchAttributes, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Interceptor/WorkflowOutboundCalls/UpsertTypedSearchAttributesInput.php: -------------------------------------------------------------------------------- 1 | $updates 23 | * 24 | * @no-named-arguments 25 | * @internal Don't use the constructor. Use {@see self::with()} instead. 26 | */ 27 | public function __construct( 28 | public readonly array $updates, 29 | ) {} 30 | 31 | /** 32 | * @param array|null $updates 33 | */ 34 | public function with( 35 | ?array $updates = null, 36 | ): self { 37 | return new self( 38 | $updates ?? $this->updates, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Internal/Client/WorkflowRun.php: -------------------------------------------------------------------------------- 1 | stub->getExecution(); 33 | } 34 | 35 | public function getResult($type = null, ?int $timeout = null): mixed 36 | { 37 | return $this->stub->getResult($type ?? $this->returnType, $timeout); 38 | } 39 | 40 | public function describe(): WorkflowExecutionDescription 41 | { 42 | return $this->stub->describe(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Internal/Declaration/ActivityInstance.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function getArgumentTypes(): array; 25 | } 26 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Graph/NodeInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface NodeInterface extends \Stringable, \IteratorAggregate, \Countable {} 18 | -------------------------------------------------------------------------------- /src/Internal/Declaration/InstanceInterface.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | final class ActivityInstantiator extends Instantiator 22 | { 23 | public function instantiate(PrototypeInterface $prototype): ActivityInstance 24 | { 25 | \assert($prototype instanceof ActivityPrototype, 'Precondition failed'); 26 | 27 | return new ActivityInstance($prototype, $this->getInstance($prototype)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Instantiator/Instantiator.php: -------------------------------------------------------------------------------- 1 | getClass()->newInstance(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Instantiator/InstantiatorInterface.php: -------------------------------------------------------------------------------- 1 | dispatcher = new AutowiredPayloads($reflection); 22 | } 23 | 24 | /** 25 | * Resolve arguments for the method. 26 | */ 27 | public function resolveArguments(ValuesInterface $values): array 28 | { 29 | return $this->dispatcher->resolveArguments($values); 30 | } 31 | 32 | public function __invoke(ValuesInterface $values): mixed 33 | { 34 | $arguments = $this->resolveArguments($values); 35 | return $this->dispatcher->dispatch($this->instance, $arguments); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Prototype/ActivityCollection.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | final class ActivityCollection extends ArrayRepository 20 | { 21 | private ?\Closure $finalizer = null; 22 | 23 | public function addFinalizer(\Closure $finalizer): void 24 | { 25 | $this->finalizer = $finalizer; 26 | } 27 | 28 | public function getFinalizer(): ?\Closure 29 | { 30 | return $this->finalizer; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Prototype/PrototypeInterface.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | final class WorkflowCollection extends ArrayRepository {} 20 | -------------------------------------------------------------------------------- /src/Internal/Declaration/Reader/RecursiveAttributeReducerInterface.php: -------------------------------------------------------------------------------- 1 | 21 | * @template-implements EventListenerInterface 22 | */ 23 | trait EventEmitterTrait 24 | { 25 | /** 26 | * @var array> 27 | */ 28 | protected array $once = []; 29 | 30 | public function once(string $event, callable $then): self 31 | { 32 | $this->once[$event][] = $then; 33 | 34 | return $this; 35 | } 36 | 37 | public function emit(string $event, array $arguments = []): void 38 | { 39 | while (($this->once[$event] ?? []) !== []) { 40 | $callback = \array_shift($this->once[$event]); 41 | $callback(...$arguments); 42 | } 43 | 44 | unset($this->once[$event]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Internal/Events/EventListenerInterface.php: -------------------------------------------------------------------------------- 1 | reader = $reader; 24 | } 25 | 26 | public function create(\ReflectionClass $class, TypeFactoryInterface $types): MapperInterface 27 | { 28 | return new AttributeMapper($class, $types, $this->reader); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Mapper/MapperFactoryInterface.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | public function getGetters(): iterable; 26 | 27 | /** 28 | * @return iterable 29 | */ 30 | public function getSetters(): iterable; 31 | } 32 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/MarshallerInterface.php: -------------------------------------------------------------------------------- 1 | |null $type 23 | * @param self|class-string|string|null $of 24 | */ 25 | public function __construct( 26 | public ?string $name = null, 27 | public ?string $type = null, 28 | public self|string|null $of = null, 29 | ) {} 30 | 31 | public function hasType(): bool 32 | { 33 | return $this->type !== null && $this->of !== null; 34 | } 35 | 36 | /** 37 | * Generate constructor arguments for the related {@see \Temporal\Internal\Marshaller\Type\Type} object. 38 | */ 39 | public function getConstructorArgs(): array 40 | { 41 | return $this->of === null ? [] : [$this->of]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Meta/MarshalArray.php: -------------------------------------------------------------------------------- 1 | of === null => false, 38 | $this->of instanceof MarshallingRule => $this->of->hasType(), 39 | default => true, 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Meta/MarshalOneOf.php: -------------------------------------------------------------------------------- 1 | $cases 22 | * @param non-empty-string|null $name 23 | * @param class-string|null $of 24 | */ 25 | public function __construct( 26 | private array $cases, 27 | ?string $name = null, 28 | ?string $of = null, 29 | bool $nullable = true, 30 | ) { 31 | parent::__construct($name, OneOfType::class, $of, $nullable); 32 | } 33 | 34 | public function getConstructorArgs(): array 35 | { 36 | return [$this->of, $this->cases, $this->nullable]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/RuleFactoryInterface.php: -------------------------------------------------------------------------------- 1 | 14 | * @internal 15 | */ 16 | final class ActivityCancellationType extends Type 17 | { 18 | public function parse($value, $current): int 19 | { 20 | return $value ? Policy::WAIT_CANCELLATION_COMPLETED : Policy::TRY_CANCEL; 21 | } 22 | 23 | public function serialize($value): bool 24 | { 25 | return match ($value) { 26 | Policy::WAIT_CANCELLATION_COMPLETED => true, 27 | Policy::TRY_CANCEL => false, 28 | default => throw new \InvalidArgumentException("Option #{$value} is currently not supported"), 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Type/ChildWorkflowCancellationType.php: -------------------------------------------------------------------------------- 1 | 15 | * @internal 16 | */ 17 | final class ChildWorkflowCancellationType extends Type 18 | { 19 | public function parse($value, $current): int 20 | { 21 | return $value ? Policy::WAIT_CANCELLATION_COMPLETED : Policy::TRY_CANCEL; 22 | } 23 | 24 | public function serialize($value): bool 25 | { 26 | return match ($value) { 27 | Policy::WAIT_CANCELLATION_COMPLETED => true, 28 | Policy::TRY_CANCEL => false, 29 | default => throw new \InvalidArgumentException("Option #{$value} is currently not supported"), 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Type/CronType.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class CronType extends Type 18 | { 19 | /** 20 | * @var string 21 | */ 22 | private const ERROR_INVALID_TYPE = 23 | 'Passed value must be a type of ' . 24 | 'cron-like string or cron expression, but %s given'; 25 | 26 | public function parse($value, $current) 27 | { 28 | if ($value === '') { 29 | // by default empty cron string = no cron 30 | return null; 31 | } 32 | 33 | if (\is_string($value)) { 34 | return $value; 35 | } 36 | 37 | throw new \InvalidArgumentException(\sprintf(self::ERROR_INVALID_TYPE, \get_debug_type($value))); 38 | } 39 | 40 | public function serialize($value): string 41 | { 42 | if (\is_string($value) || $value instanceof \Stringable) { 43 | return (string) $value; 44 | } 45 | 46 | throw new \InvalidArgumentException(\sprintf(self::ERROR_INVALID_TYPE, \get_debug_type($value))); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Type/DetectableTypeInterface.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | interface RuleFactoryInterface extends TypeInterface 22 | { 23 | /** 24 | * Make a marshalling rule for the given property. 25 | */ 26 | public static function makeRule(\ReflectionProperty $property): ?MarshallingRule; 27 | } 28 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/Type/TypeInterface.php: -------------------------------------------------------------------------------- 1 | $marshaller 23 | */ 24 | public function __construct(MarshallerInterface $marshaller); 25 | 26 | /** 27 | * @param mixed $value 28 | * @param mixed $current 29 | * @return mixed 30 | */ 31 | public function parse($value, $current); 32 | 33 | /** 34 | * @param mixed $value 35 | * @return TMarshalType 36 | */ 37 | public function serialize($value); 38 | } 39 | -------------------------------------------------------------------------------- /src/Internal/Marshaller/TypeFactoryInterface.php: -------------------------------------------------------------------------------- 1 | $type 20 | */ 21 | public function create(string $type, array $args): ?TypeInterface; 22 | 23 | /** 24 | * @return class-string|null 25 | */ 26 | public function detect(?\ReflectionType $type): ?string; 27 | } 28 | -------------------------------------------------------------------------------- /src/Internal/Queue/QueueInterface.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | interface QueueInterface extends \IteratorAggregate, \Countable 20 | { 21 | public function push(CommandInterface $command): void; 22 | 23 | public function pull(int $commandId): ?CommandInterface; 24 | 25 | public function has(int $commandId): bool; 26 | } 27 | -------------------------------------------------------------------------------- /src/Internal/Repository/Identifiable.php: -------------------------------------------------------------------------------- 1 | diff = new Diff($this); 26 | } 27 | 28 | #[Pure] 29 | public static function new(): static 30 | { 31 | return new static(); 32 | } 33 | 34 | public function __debugInfo(): array 35 | { 36 | $properties = \get_object_vars($this); 37 | unset($properties['diff']); 38 | 39 | $properties['#defaults'] = $this->diff->getDefaultProperties(); 40 | $properties['#changed'] = $this->diff->getChangedProperties($this); 41 | 42 | return $properties; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Internal/Support/Process.php: -------------------------------------------------------------------------------- 1 | run(); 28 | 29 | if (!$process->isSuccessful()) { 30 | throw new ProcessFailedException($process); 31 | } 32 | 33 | return \trim($process->getOutput()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Internal/Traits/CloneWith.php: -------------------------------------------------------------------------------- 1 | newInstanceWithoutConstructor(); 18 | $new->{$key} = $value; 19 | /** @psalm-suppress RawObjectIteration */ 20 | foreach ($this as $k => $v) { 21 | if ($k === $key) { 22 | continue; 23 | } 24 | 25 | $new->{$k} = $v; 26 | } 27 | return $new; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/CompletableResultInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * @yield T 20 | */ 21 | interface CompletableResultInterface extends PromiseInterface 22 | { 23 | public function isComplete(): bool; 24 | 25 | /** 26 | * @return mixed 27 | */ 28 | public function getValue(); 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/Cancel.php: -------------------------------------------------------------------------------- 1 | requestIds = $requestId; 31 | parent::__construct(self::NAME, ['ids' => $requestId]); 32 | } 33 | 34 | /** 35 | * @return int[] ID list 36 | */ 37 | public function getRequestIds(): array 38 | { 39 | return $this->requestIds; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/CancelExternalWorkflow.php: -------------------------------------------------------------------------------- 1 | $namespace, 30 | 'workflowID' => $workflowId, 31 | 'runID' => $runId, 32 | ]; 33 | 34 | parent::__construct(self::NAME, $options, null); 35 | } 36 | 37 | public function getNamespace(): string 38 | { 39 | return $this->namespace; 40 | } 41 | 42 | public function getWorkflowId(): string 43 | { 44 | return $this->workflowId; 45 | } 46 | 47 | public function getRunId(): ?string 48 | { 49 | return $this->runId; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/CompleteWorkflow.php: -------------------------------------------------------------------------------- 1 | setFailure($failure); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/GetChildWorkflowExecution.php: -------------------------------------------------------------------------------- 1 | parentClosePolicy = $execution->getOptions()['options']['ParentClosePolicy'] ?? ParentClosePolicy::POLICY_UNSPECIFIED; 27 | parent::__construct(self::NAME, ['id' => $execution->getID()]); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/NewTimer.php: -------------------------------------------------------------------------------- 1 | (int) CarbonInterval::make($interval)->totalMilliseconds]); 27 | } 28 | 29 | public function getInterval(): \DateInterval 30 | { 31 | return $this->interval; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/Panic.php: -------------------------------------------------------------------------------- 1 | setFailure($failure); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/SideEffect.php: -------------------------------------------------------------------------------- 1 | $namespace, 34 | 'workflowID' => $workflowId, 35 | 'runID' => $runId, 36 | 'signal' => $signal, 37 | 'childWorkflowOnly' => $childWorkflowOnly, 38 | ]; 39 | 40 | parent::__construct(self::NAME, $options, $input); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/UndefinedResponse.php: -------------------------------------------------------------------------------- 1 | $message]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/UpsertMemo.php: -------------------------------------------------------------------------------- 1 | $memo 15 | */ 16 | public function __construct( 17 | private readonly array $memo, 18 | ) { 19 | parent::__construct(self::NAME, ['memo' => (object) $memo]); 20 | } 21 | 22 | /** 23 | * @return array 24 | */ 25 | public function getMemo(): array 26 | { 27 | return $this->memo; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/Request/UpsertSearchAttributes.php: -------------------------------------------------------------------------------- 1 | $searchAttributes 15 | */ 16 | public function __construct( 17 | private readonly array $searchAttributes, 18 | ) { 19 | parent::__construct(self::NAME, ['searchAttributes' => (object) $searchAttributes]); 20 | } 21 | 22 | /** 23 | * @return array 24 | */ 25 | public function getSearchAttributes(): array 26 | { 27 | return $this->searchAttributes; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Internal/Transport/Router/InvokeLocalActivity.php: -------------------------------------------------------------------------------- 1 | getShortClassName(); 22 | } 23 | 24 | /** 25 | * @return non-empty-string 26 | */ 27 | private function getShortClassName(): string 28 | { 29 | /** @var non-empty-list $chunks */ 30 | $chunks = \explode('\\', static::class); 31 | 32 | return \array_pop($chunks); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Internal/Transport/Router/RouteInterface.php: -------------------------------------------------------------------------------- 1 | findProcessOrFail($request->getID()); 23 | 24 | $context = $process->getContext(); 25 | 26 | $resolver->resolve(EncodedValues::fromValues([$context->getStackTrace()])); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Internal/Transport/Router/WorkflowProcessAwareRoute.php: -------------------------------------------------------------------------------- 1 | findProcessOrFail($runId)->getWorkflowInstance(); 32 | } 33 | 34 | /** 35 | * @param non-empty-string $runId 36 | */ 37 | protected function findProcessOrFail(string $runId): Process 38 | { 39 | return $this->running->find($runId) ?? throw new \LogicException( 40 | \sprintf(self::ERROR_PROCESS_NOT_FOUND, $runId), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Internal/Transport/RouterInterface.php: -------------------------------------------------------------------------------- 1 | info = $info ?? new WorkflowInfo(); 47 | $this->input = $args ?? EncodedValues::empty(); 48 | $this->header = $header ?? Header::empty(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Internal/Workflow/ProcessCollection.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | class ProcessCollection extends ArrayRepository 21 | { 22 | private const ERROR_PROCESS_NOT_FOUND = 'Process #%s not found.'; 23 | 24 | /** 25 | * @param non-empty-string|null $error Error message if the process was not found. 26 | */ 27 | public function pull(string $runId, ?string $error = null): Process 28 | { 29 | $process = $this->find($runId) ?? throw new \InvalidArgumentException( 30 | $error ?? \sprintf(self::ERROR_PROCESS_NOT_FOUND, $runId), 31 | ); 32 | 33 | $this->remove($runId); 34 | 35 | return $process; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Internal/Workflow/Proxy.php: -------------------------------------------------------------------------------- 1 | $prototypes 24 | * @return T|null 25 | */ 26 | protected function findPrototypeByHandlerName(array $prototypes, string $name): ?Prototype 27 | { 28 | foreach ($prototypes as $prototype) { 29 | $handler = $prototype->getHandler(); 30 | 31 | if ($handler->getName() === $name) { 32 | return $prototype; 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Worker/ActivityInvocationCache/ActivityInvocationCacheInterface.php: -------------------------------------------------------------------------------- 1 | */ 10 | public string $errorClass; 11 | 12 | public string $errorMessage; 13 | 14 | /** 15 | * @param class-string<\Throwable> $exceptionClass 16 | */ 17 | public function __construct( 18 | string $exceptionClass, 19 | string $exceptionMessage, 20 | ) { 21 | $this->errorClass = $exceptionClass; 22 | $this->errorMessage = $exceptionMessage; 23 | } 24 | 25 | public static function fromThrowable(\Throwable $error): self 26 | { 27 | return new self($error::class, $error->getMessage()); 28 | } 29 | 30 | public function toThrowable(): \Throwable 31 | { 32 | return new ($this->errorClass)($this->errorMessage); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Worker/ChildWorkflowCancellationType.php: -------------------------------------------------------------------------------- 1 | tickTime = new \DateTimeImmutable('now', new \DateTimeZone('UTC')); 24 | } 25 | 26 | public function now(): \DateTimeInterface 27 | { 28 | return $this->tickTime; 29 | } 30 | 31 | public function isReplaying(): bool 32 | { 33 | return $this->isReplaying; 34 | } 35 | 36 | public function update(TickInfo $info): void 37 | { 38 | $this->isReplaying = $info->isReplaying; 39 | $this->tickTime = $info->time; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Worker/Environment/EnvironmentInterface.php: -------------------------------------------------------------------------------- 1 | format('Y-m-d H:i:s'), 19 | $level, 20 | $message, 21 | $context === [] ? '' : ' ' . (string) \json_encode($context, \JSON_INVALID_UTF8_IGNORE), 22 | )); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Worker/ServiceCredentials.php: -------------------------------------------------------------------------------- 1 | apiKey = ''; 21 | } 22 | 23 | public static function create(): self 24 | { 25 | return new self(); 26 | } 27 | 28 | /** 29 | * Set the authentication token for API calls. 30 | * 31 | * To update the API key in runtime, call the `UpdateAPIKey` RPC method with the new key: 32 | * 33 | * ``` 34 | * $result = \Temporal\Worker\Transport\Goridge::create()->call( 35 | * 'temporal.UpdateAPIKey', 36 | * $newApiKey, 37 | * ); 38 | * ``` 39 | * 40 | * @link https://docs.temporal.io/cloud/api-keys 41 | * @since SDK 2.12.0 42 | * @since RoadRunner 2024.3.0 43 | */ 44 | public function withApiKey(string $key): static 45 | { 46 | /** @see self::$apiKey */ 47 | return $this->with('apiKey', $key); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Worker/Transport/Codec/CodecInterface.php: -------------------------------------------------------------------------------- 1 | $commands 23 | * @throws ProtocolException 24 | */ 25 | public function encode(iterable $commands): string; 26 | 27 | /** 28 | * @return iterable 29 | * @throws ProtocolException 30 | */ 31 | public function decode(string $batch, array $headers = []): iterable; 32 | } 33 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/Client/FailedClientResponse.php: -------------------------------------------------------------------------------- 1 | id; 26 | } 27 | 28 | public function getFailure(): \Throwable 29 | { 30 | return $this->failure; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/Client/SuccessClientResponse.php: -------------------------------------------------------------------------------- 1 | id; 27 | } 28 | 29 | public function getPayloads(): ValuesInterface 30 | { 31 | return $this->values; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/CommandInterface.php: -------------------------------------------------------------------------------- 1 | name; 16 | } 17 | 18 | public function getOptions(): array 19 | { 20 | return $this->options; 21 | } 22 | 23 | public function getPayloads(): ValuesInterface 24 | { 25 | return $this->payloads; 26 | } 27 | 28 | public function getHeader(): Header 29 | { 30 | return $this->header; 31 | } 32 | 33 | /** 34 | * @psalm-external-mutation-free 35 | */ 36 | public function withHeader(HeaderInterface $header): self 37 | { 38 | $clone = clone $this; 39 | $clone->header = $header; 40 | return $clone; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/FailureResponseInterface.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | interface RequestInterface extends CommandInterface 21 | { 22 | public function getID(): int; 23 | 24 | /** 25 | * @return non-empty-string 26 | */ 27 | public function getName(): string; 28 | 29 | /** 30 | * @return RequestOptions 31 | */ 32 | public function getOptions(): array; 33 | 34 | public function getPayloads(): ValuesInterface; 35 | 36 | /** 37 | * Optional failure. 38 | */ 39 | public function getFailure(): ?\Throwable; 40 | 41 | public function getHeader(): HeaderInterface; 42 | 43 | /** 44 | * @psalm-external-mutation-free 45 | */ 46 | public function withHeader(HeaderInterface $header): self; 47 | } 48 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/ResponseInterface.php: -------------------------------------------------------------------------------- 1 | failure; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/Server/ServerResponse.php: -------------------------------------------------------------------------------- 1 | id; 26 | } 27 | 28 | public function getTickInfo(): TickInfo 29 | { 30 | return $this->info; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/Server/SuccessResponse.php: -------------------------------------------------------------------------------- 1 | values = $values ?? EncodedValues::empty(); 25 | parent::__construct(id: $id, info: $info); 26 | } 27 | 28 | public function getPayloads(): ValuesInterface 29 | { 30 | return $this->values; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/Server/TickInfo.php: -------------------------------------------------------------------------------- 1 | $historyLength 18 | * @param int<0, max> $historySize 19 | */ 20 | public function __construct( 21 | public readonly \DateTimeInterface $time, 22 | public readonly int $historyLength = 0, 23 | public readonly int $historySize = 0, 24 | public readonly bool $continueAsNewSuggested = false, 25 | public readonly bool $isReplaying = false, 26 | ) {} 27 | } 28 | -------------------------------------------------------------------------------- /src/Worker/Transport/Command/ServerRequestInterface.php: -------------------------------------------------------------------------------- 1 | messages = $messages; 25 | $this->context = $context; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Worker/Transport/HostConnectionInterface.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | interface HostConnectionInterface 20 | { 21 | /** 22 | * @throws TransportException 23 | */ 24 | public function waitBatch(): ?CommandBatch; 25 | 26 | /** 27 | * @throws TransportException 28 | */ 29 | public function send(string $frame): void; 30 | 31 | /** 32 | * @throws TransportException 33 | */ 34 | public function error(\Throwable $error): void; 35 | } 36 | -------------------------------------------------------------------------------- /src/Worker/Transport/RPCConnectionInterface.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | interface CancellationScopeInterface extends PromiseInterface 22 | { 23 | /** 24 | * Detached scopes can continue working even if parent scope was cancelled. 25 | */ 26 | public function isDetached(): bool; 27 | 28 | /** 29 | * Returns true if cancel request was sent to scope. 30 | */ 31 | public function isCancelled(): bool; 32 | 33 | /** 34 | * Triggered when cancel request sent to scope. 35 | * 36 | * @return $this 37 | */ 38 | public function onCancel(callable $then): self; 39 | 40 | /** 41 | * The `cancel()` method notifies the creator of the promise that there is no 42 | * further interest in the results of the operation. 43 | * 44 | * Once a promise is settled (either fulfilled or rejected), calling `cancel()` on 45 | * a promise has no effect. 46 | */ 47 | public function cancel(): void; 48 | } 49 | -------------------------------------------------------------------------------- /src/Workflow/ExternalWorkflowStubInterface.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | interface ProcessInterface extends CancellationScopeInterface, Identifiable 21 | { 22 | public function getContext(): WorkflowContextInterface; 23 | } 24 | -------------------------------------------------------------------------------- /src/Workflow/QueryMethod.php: -------------------------------------------------------------------------------- 1 | nullable = $nullable || (new Type($name))->allowsNull(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Workflow/ScopedContextInterface.php: -------------------------------------------------------------------------------- 1 | updateId); 32 | } 33 | 34 | /** 35 | * @return non-empty-string 36 | */ 37 | public function getUpdateId(): string 38 | { 39 | return $this->updateId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Workflow/WorkflowExecutionConfig.php: -------------------------------------------------------------------------------- 1 | name = $name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Workflow/WorkflowStub.php: -------------------------------------------------------------------------------- 1 | __getUntypedStub(); 32 | } 33 | 34 | if ($workflow instanceof WorkflowStubInterface) { 35 | return $workflow; 36 | } 37 | 38 | throw new InvalidArgumentException( 39 | \sprintf('Only workflow stubs can be started, %s given', \get_debug_type($workflow)), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Workflow/WorkflowType.php: -------------------------------------------------------------------------------- 1 | temporal.api.testservice.v1.LockTimeSkippingRequest 13 | */ 14 | class LockTimeSkippingRequest extends \Google\Protobuf\Internal\Message 15 | { 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param array $data { 21 | * Optional. Data for populating the Message object. 22 | * 23 | * } 24 | */ 25 | public function __construct($data = NULL) { 26 | \GPBMetadata\Temporal\Api\Testservice\V1\RequestResponse::initOnce(); 27 | parent::__construct($data); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testing/api/testservice/Temporal/Api/Testservice/V1/LockTimeSkippingResponse.php: -------------------------------------------------------------------------------- 1 | temporal.api.testservice.v1.LockTimeSkippingResponse 13 | */ 14 | class LockTimeSkippingResponse extends \Google\Protobuf\Internal\Message 15 | { 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param array $data { 21 | * Optional. Data for populating the Message object. 22 | * 23 | * } 24 | */ 25 | public function __construct($data = NULL) { 26 | \GPBMetadata\Temporal\Api\Testservice\V1\RequestResponse::initOnce(); 27 | parent::__construct($data); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testing/api/testservice/Temporal/Api/Testservice/V1/SleepResponse.php: -------------------------------------------------------------------------------- 1 | temporal.api.testservice.v1.SleepResponse 13 | */ 14 | class SleepResponse extends \Google\Protobuf\Internal\Message 15 | { 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param array $data { 21 | * Optional. Data for populating the Message object. 22 | * 23 | * } 24 | */ 25 | public function __construct($data = NULL) { 26 | \GPBMetadata\Temporal\Api\Testservice\V1\RequestResponse::initOnce(); 27 | parent::__construct($data); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testing/api/testservice/Temporal/Api/Testservice/V1/UnlockTimeSkippingRequest.php: -------------------------------------------------------------------------------- 1 | temporal.api.testservice.v1.UnlockTimeSkippingRequest 13 | */ 14 | class UnlockTimeSkippingRequest extends \Google\Protobuf\Internal\Message 15 | { 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param array $data { 21 | * Optional. Data for populating the Message object. 22 | * 23 | * } 24 | */ 25 | public function __construct($data = NULL) { 26 | \GPBMetadata\Temporal\Api\Testservice\V1\RequestResponse::initOnce(); 27 | parent::__construct($data); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testing/api/testservice/Temporal/Api/Testservice/V1/UnlockTimeSkippingResponse.php: -------------------------------------------------------------------------------- 1 | temporal.api.testservice.v1.UnlockTimeSkippingResponse 13 | */ 14 | class UnlockTimeSkippingResponse extends \Google\Protobuf\Internal\Message 15 | { 16 | 17 | /** 18 | * Constructor. 19 | * 20 | * @param array $data { 21 | * Optional. Data for populating the Message object. 22 | * 23 | * } 24 | */ 25 | public function __construct($data = NULL) { 26 | \GPBMetadata\Temporal\Api\Testservice\V1\RequestResponse::initOnce(); 27 | parent::__construct($data); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testing/src/ActivityMocker.php: -------------------------------------------------------------------------------- 1 | cache = $cache ?? RoadRunnerActivityInvocationCache::create(); 17 | } 18 | 19 | public function clear(): void 20 | { 21 | $this->cache->clear(); 22 | } 23 | 24 | public function expectCompletion(string $activityMethodName, $value): void 25 | { 26 | $this->cache->saveCompletion($activityMethodName, $value); 27 | } 28 | 29 | public function expectFailure(string $activityMethodName, \Throwable $error): void 30 | { 31 | $this->cache->saveFailure($activityMethodName, $error); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /testing/src/Replay/Exception/InternalServerException.php: -------------------------------------------------------------------------------- 1 | workflowType; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /testing/src/WithoutTimeSkipping.php: -------------------------------------------------------------------------------- 1 | testService = TestService::create( 14 | \getenv('TEMPORAL_ADDRESS') ?: '127.0.0.1:7233', 15 | ); 16 | $this->testService->lockTimeSkipping(); 17 | parent::setUp(); 18 | } 19 | 20 | protected function tearDown(): void 21 | { 22 | $this->testService->unlockTimeSkipping(); 23 | parent::tearDown(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testing/src/WorkflowTestCase.php: -------------------------------------------------------------------------------- 1 | workflowClient = new WorkflowClient(ServiceClient::create($temporalAddress)); 20 | $this->testingService = TestService::create($temporalAddress); 21 | 22 | parent::setUp(); 23 | } 24 | } 25 | --------------------------------------------------------------------------------