diff --git a/Makefile b/Makefile index f6fcf899d..a0b49fe91 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ PROTO_PATHS = paths=source_relative:$(PROTO_OUT) OAPI_OUT := openapi OAPI3_PATH := .components.schemas.Payload -NEX_GEN ?= nex-gen +NEX_GEN ?= nexgen $(PROTO_OUT): mkdir $(PROTO_OUT) @@ -144,20 +144,29 @@ nexus-rpc-yaml-install: ##### Compile system Nexus WIT files ##### system-nexus-wit: system-nexus-wit-install nex-gen-install printf $(COLOR) "Generate system Nexus WIT..." - protoc -I $(PROTO_ROOT) \ + tmp=$$(mktemp -d); trap 'rm -rf "$$tmp"' EXIT; \ + protoc -I $(PROTO_ROOT) --include_imports \ + --descriptor_set_out="$$tmp/system.bin" \ --system-nexus-wit_opt=output=nexus/workflow-service.wit \ --system-nexus-wit_opt=nex_gen=$(NEX_GEN) \ --system-nexus-wit_opt=linked_input=nexus/deps \ --system-nexus-wit_out=. \ - temporal/api/workflowservice/v1/service.proto + temporal/api/workflowservice/v1/service.proto \ + temporal/api/notificationservice/v1/request_response.proto && \ + $(NEX_GEN) add-message \ + --descriptors "$$tmp/system.bin" \ + --file temporal/api/notificationservice/v1/request_response.proto \ + --input nexus/notification-service.wit \ + --input nexus/deps \ + --output nexus/notification-service.wit system-nexus-wit-install: printf $(COLOR) "Build and install protoc-gen-system-nexus-wit..." @cd cmd/protoc-gen-system-nexus-wit && go install . nex-gen-install: - printf $(COLOR) "Install nex-gen if missing..." - command -v $(NEX_GEN) >/dev/null || cargo install nex-gen --version ^0.1 + printf $(COLOR) "Install nexgen if missing..." + command -v $(NEX_GEN) >/dev/null || cargo install nexgen --version ^0.2 --features advanced ##### Clean ##### clean: diff --git a/nexus/notification-service.wit b/nexus/notification-service.wit new file mode 100644 index 000000000..19a89381c --- /dev/null +++ b/nexus/notification-service.wit @@ -0,0 +1,34 @@ +package temporal:nexus@1.0.0; + +world system { + export notification-service; +} + +interface notification-service { + use nexus:temporal-types/model@1.0.0.{ + failure, + placeholder, + }; + + /// @nexus.type-parameter + type source-context-t = placeholder; + + /// @nexus.type-parameter + type output-t = placeholder; + + /// @nexus.proto "temporal.api.notificationservice.v1.OnCompleteRequest.result" + variant on-complete-request-result { + success(output-t), + failure(failure), + } + + /// @nexus.proto "temporal.api.notificationservice.v1.OnCompleteRequest" + record on-complete-request { + %result: on-complete-request-result, + source-context: source-context-t, + } + + /// @nexus.proto "temporal.api.notificationservice.v1.OnCompleteResponse" + record on-complete-response { + } +} \ No newline at end of file