@temporalio/core-bridge 1.8.6 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +670 -594
- package/Cargo.toml +2 -1
- package/lib/errors.js +6 -6
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +17 -44
- package/lib/index.js.map +1 -1
- package/package.json +5 -6
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.github/workflows/heavy.yml +4 -0
- package/sdk-core/.github/workflows/per-pr.yml +96 -0
- package/sdk-core/ARCHITECTURE.md +1 -1
- package/sdk-core/Cargo.toml +10 -0
- package/sdk-core/LICENSE.txt +0 -2
- package/sdk-core/README.md +37 -21
- package/sdk-core/client/Cargo.toml +7 -4
- package/sdk-core/client/src/lib.rs +274 -142
- package/sdk-core/client/src/metrics.rs +68 -57
- package/sdk-core/client/src/raw.rs +191 -45
- package/sdk-core/client/src/retry.rs +20 -0
- package/sdk-core/client/src/worker_registry/mod.rs +264 -0
- package/sdk-core/client/src/workflow_handle/mod.rs +2 -1
- package/sdk-core/core/Cargo.toml +17 -19
- package/sdk-core/core/src/core_tests/activity_tasks.rs +4 -2
- package/sdk-core/core/src/core_tests/child_workflows.rs +7 -7
- package/sdk-core/core/src/core_tests/mod.rs +1 -0
- package/sdk-core/core/src/core_tests/queries.rs +42 -1
- package/sdk-core/core/src/core_tests/replay_flag.rs +29 -39
- package/sdk-core/core/src/core_tests/updates.rs +73 -0
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +52 -1
- package/sdk-core/core/src/ephemeral_server/mod.rs +34 -11
- package/sdk-core/core/src/internal_flags.rs +7 -1
- package/sdk-core/core/src/lib.rs +19 -36
- package/sdk-core/core/src/protosext/mod.rs +12 -4
- package/sdk-core/core/src/protosext/protocol_messages.rs +102 -0
- package/sdk-core/core/src/replay/mod.rs +99 -48
- package/sdk-core/core/src/telemetry/log_export.rs +161 -28
- package/sdk-core/core/src/telemetry/metrics.rs +869 -248
- package/sdk-core/core/src/telemetry/mod.rs +153 -257
- package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -31
- package/sdk-core/core/src/test_help/mod.rs +64 -5
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +12 -2
- package/sdk-core/core/src/worker/activities.rs +276 -10
- package/sdk-core/core/src/worker/client/mocks.rs +18 -0
- package/sdk-core/core/src/worker/client.rs +16 -3
- package/sdk-core/core/src/worker/mod.rs +45 -28
- package/sdk-core/core/src/worker/slot_provider.rs +175 -0
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +27 -34
- package/sdk-core/core/src/worker/workflow/history_update.rs +5 -2
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +71 -95
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +34 -22
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +50 -34
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +106 -92
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +22 -21
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +386 -499
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -2
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +33 -26
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +198 -215
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +67 -63
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +88 -119
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +3 -1
- package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +411 -0
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +27 -26
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +319 -94
- package/sdk-core/core/src/worker/workflow/managed_run.rs +179 -132
- package/sdk-core/core/src/worker/workflow/mod.rs +129 -58
- package/sdk-core/core/src/worker/workflow/run_cache.rs +16 -26
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +2 -2
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +48 -43
- package/sdk-core/core-api/Cargo.toml +8 -7
- package/sdk-core/core-api/src/lib.rs +4 -12
- package/sdk-core/core-api/src/telemetry/metrics.rs +334 -0
- package/sdk-core/core-api/src/telemetry.rs +53 -42
- package/sdk-core/core-api/src/worker.rs +7 -0
- package/sdk-core/{.buildkite/docker → docker}/docker-compose.yaml +1 -1
- package/sdk-core/etc/dynamic-config.yaml +11 -1
- package/sdk-core/fsm/LICENSE.txt +0 -2
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -2
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +1 -3
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +2 -2
- package/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -2
- package/sdk-core/sdk/Cargo.toml +2 -2
- package/sdk-core/sdk/src/lib.rs +85 -7
- package/sdk-core/sdk/src/workflow_context/options.rs +4 -0
- package/sdk-core/sdk/src/workflow_context.rs +43 -15
- package/sdk-core/sdk/src/workflow_future.rs +334 -204
- package/sdk-core/sdk-core-protos/Cargo.toml +3 -3
- package/sdk-core/sdk-core-protos/build.rs +14 -14
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +99 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +56 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.gen.yaml +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +11 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +18 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/annotations.proto +31 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/http.proto +379 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/any.proto +162 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/descriptor.proto +1212 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/duration.proto +115 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/empty.proto +51 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/timestamp.proto +144 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/wrappers.proto +123 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/batch/v1/message.proto +12 -9
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/command/v1/message.proto +11 -13
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/common/v1/message.proto +33 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/reset.proto +4 -4
- package/sdk-core/{protos/api_upstream/build/tools.go → sdk-core-protos/protos/api_upstream/temporal/api/export/v1/message.proto} +22 -6
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/filter/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/history/v1/message.proto +21 -23
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/namespace/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/request_response.proto +2 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/service.proto +4 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/replication/v1/message.proto +1 -3
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/schedule/v1/message.proto +36 -20
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +13 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +66 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/update/v1/message.proto +1 -1
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/version/v1/message.proto +2 -3
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflow/v1/message.proto +24 -22
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/request_response.proto +84 -32
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/service.proto +205 -47
- package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +57 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +27 -0
- package/sdk-core/sdk-core-protos/src/history_builder.rs +67 -2
- package/sdk-core/sdk-core-protos/src/history_info.rs +1 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +76 -3
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +6 -1
- package/sdk-core/test-utils/src/canned_histories.rs +3 -57
- package/sdk-core/test-utils/src/interceptors.rs +46 -0
- package/sdk-core/test-utils/src/lib.rs +106 -38
- package/sdk-core/tests/integ_tests/metrics_tests.rs +110 -15
- package/sdk-core/tests/integ_tests/queries_tests.rs +174 -3
- package/sdk-core/tests/integ_tests/update_tests.rs +908 -0
- package/sdk-core/tests/integ_tests/visibility_tests.rs +4 -4
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +44 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -4
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +61 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +27 -2
- package/sdk-core/tests/integ_tests/workflow_tests.rs +142 -3
- package/sdk-core/tests/main.rs +2 -1
- package/sdk-core/tests/runner.rs +15 -2
- package/src/conversions.rs +107 -96
- package/src/helpers.rs +74 -0
- package/src/runtime.rs +29 -15
- package/src/worker.rs +14 -61
- package/ts/index.ts +23 -54
- package/sdk-core/.buildkite/docker/Dockerfile +0 -9
- package/sdk-core/.buildkite/docker/build.sh +0 -5
- package/sdk-core/.buildkite/docker/docker-compose-ci.yaml +0 -27
- package/sdk-core/.buildkite/pipeline.yml +0 -57
- package/sdk-core/.github/workflows/semgrep.yml +0 -25
- package/sdk-core/client/LICENSE.txt +0 -23
- package/sdk-core/core/LICENSE.txt +0 -23
- package/sdk-core/core/src/worker/workflow/bridge.rs +0 -35
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +0 -215
- package/sdk-core/core-api/LICENSE.txt +0 -23
- package/sdk-core/protos/api_upstream/.buildkite/Dockerfile +0 -2
- package/sdk-core/protos/api_upstream/Makefile +0 -80
- package/sdk-core/protos/api_upstream/api-linter.yaml +0 -40
- package/sdk-core/protos/api_upstream/buf.yaml +0 -9
- package/sdk-core/protos/api_upstream/build/go.mod +0 -7
- package/sdk-core/protos/api_upstream/build/go.sum +0 -5
- package/sdk-core/protos/api_upstream/go.mod +0 -6
- package/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +0 -141
- package/sdk-core/sdk/LICENSE.txt +0 -23
- package/sdk-core/sdk-core-protos/LICENSE.txt +0 -23
- /package/sdk-core/{.buildkite/docker → docker}/docker-compose-telem.yaml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/docker-compose.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/pipeline.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/LICENSE +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/README.md +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/google/rpc/status.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{protos/api_upstream → sdk-core-protos/protos/testsrv_upstream}/dependencies/gogoproto/gogo.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
|
@@ -3,7 +3,7 @@ name = "temporal-sdk-core-protos"
|
|
|
3
3
|
version = "0.1.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Spencer Judge <spencer@temporal.io>"]
|
|
6
|
-
license-file =
|
|
6
|
+
license-file = { workspace = true }
|
|
7
7
|
description = "Protobuf definitions for Temporal SDKs Core/Lang interface"
|
|
8
8
|
homepage = "https://temporal.io/"
|
|
9
9
|
repository = "https://github.com/temporalio/sdk-core"
|
|
@@ -25,9 +25,9 @@ rand = { version = "0.8", optional = true }
|
|
|
25
25
|
serde = { version = "1.0", features = ["derive"] }
|
|
26
26
|
serde_json = "1.0"
|
|
27
27
|
thiserror = "1.0"
|
|
28
|
-
tonic =
|
|
28
|
+
tonic = { workspace = true }
|
|
29
29
|
uuid = { version = "1.1", features = ["v4"], optional = true }
|
|
30
30
|
|
|
31
31
|
[build-dependencies]
|
|
32
|
-
tonic-build =
|
|
32
|
+
tonic-build = { workspace = true }
|
|
33
33
|
prost-wkt-build = "0.4"
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
use std::{env, path::PathBuf};
|
|
2
2
|
|
|
3
|
+
static ALWAYS_SERDE: &str = "#[cfg_attr(not(feature = \"serde_serialize\"), \
|
|
4
|
+
derive(::serde::Serialize, ::serde::Deserialize))]";
|
|
5
|
+
|
|
3
6
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
4
|
-
println!("cargo:rerun-if-changed
|
|
7
|
+
println!("cargo:rerun-if-changed=./protos");
|
|
5
8
|
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
6
9
|
let descriptor_file = out.join("descriptors.bin");
|
|
7
10
|
tonic_build::configure()
|
|
@@ -76,10 +79,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
76
79
|
)
|
|
77
80
|
.type_attribute("coresdk.Task.variant", "#[derive(::derive_more::From)]")
|
|
78
81
|
// All external data is useful to be able to JSON serialize, so it can render in web UI
|
|
79
|
-
.type_attribute(
|
|
80
|
-
".coresdk.external_data",
|
|
81
|
-
"#[cfg_attr(not(feature = \"serde_serialize\"), derive(::serde::Serialize, ::serde::Deserialize))]",
|
|
82
|
-
)
|
|
82
|
+
.type_attribute(".coresdk.external_data", ALWAYS_SERDE)
|
|
83
83
|
.type_attribute(
|
|
84
84
|
".",
|
|
85
85
|
"#[cfg_attr(feature = \"serde_serialize\", derive(::serde::Serialize, ::serde::Deserialize))]",
|
|
@@ -115,17 +115,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
115
115
|
.file_descriptor_set_path(#[allow(clippy::needless_borrow)] &descriptor_file)
|
|
116
116
|
.compile(
|
|
117
117
|
&[
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
118
|
+
"./protos/local/temporal/sdk/core/core_interface.proto",
|
|
119
|
+
"./protos/api_upstream/temporal/api/workflowservice/v1/service.proto",
|
|
120
|
+
"./protos/api_upstream/temporal/api/operatorservice/v1/service.proto",
|
|
121
|
+
"./protos/testsrv_upstream/temporal/api/testservice/v1/service.proto",
|
|
122
|
+
"./protos/grpc/health/v1/health.proto",
|
|
123
123
|
],
|
|
124
124
|
&[
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
125
|
+
"./protos/api_upstream",
|
|
126
|
+
"./protos/local",
|
|
127
|
+
"./protos/testsrv_upstream",
|
|
128
|
+
"./protos/grpc",
|
|
129
129
|
],
|
|
130
130
|
)?;
|
|
131
131
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
$(VERBOSE).SILENT:
|
|
2
|
+
############################# Main targets #############################
|
|
3
|
+
ci-build: install proto
|
|
4
|
+
|
|
5
|
+
# Install dependencies.
|
|
6
|
+
install: grpc-install api-linter-install buf-install
|
|
7
|
+
|
|
8
|
+
# Run all linters and compile proto files.
|
|
9
|
+
proto: grpc
|
|
10
|
+
########################################################################
|
|
11
|
+
|
|
12
|
+
##### Variables ######
|
|
13
|
+
ifndef GOPATH
|
|
14
|
+
GOPATH := $(shell go env GOPATH)
|
|
15
|
+
endif
|
|
16
|
+
|
|
17
|
+
GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
|
|
18
|
+
PATH := $(GOBIN):$(PATH)
|
|
19
|
+
STAMPDIR := .stamp
|
|
20
|
+
|
|
21
|
+
COLOR := "\e[1;36m%s\e[0m\n"
|
|
22
|
+
|
|
23
|
+
# Only prints output if the exit code is non-zero
|
|
24
|
+
define silent_exec
|
|
25
|
+
@output=$$($(1) 2>&1); \
|
|
26
|
+
status=$$?; \
|
|
27
|
+
if [ $$status -ne 0 ]; then \
|
|
28
|
+
echo "$$output"; \
|
|
29
|
+
fi; \
|
|
30
|
+
exit $$status
|
|
31
|
+
endef
|
|
32
|
+
|
|
33
|
+
PROTO_ROOT := .
|
|
34
|
+
PROTO_FILES = $(shell find temporal -name "*.proto")
|
|
35
|
+
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
|
|
36
|
+
PROTO_OUT := .gen
|
|
37
|
+
PROTO_IMPORTS = \
|
|
38
|
+
-I=$(PROTO_ROOT)
|
|
39
|
+
PROTO_PATHS = paths=source_relative:$(PROTO_OUT)
|
|
40
|
+
|
|
41
|
+
$(PROTO_OUT):
|
|
42
|
+
mkdir $(PROTO_OUT)
|
|
43
|
+
|
|
44
|
+
##### Compile proto files for go #####
|
|
45
|
+
grpc: buf-lint api-linter buf-breaking clean go-grpc fix-path
|
|
46
|
+
|
|
47
|
+
go-grpc: clean $(PROTO_OUT)
|
|
48
|
+
printf $(COLOR) "Compile for go-gRPC..."
|
|
49
|
+
$(foreach PROTO_DIR,$(PROTO_DIRS),\
|
|
50
|
+
protoc --fatal_warnings $(PROTO_IMPORTS) \
|
|
51
|
+
--go_out=$(PROTO_PATHS) \
|
|
52
|
+
--grpc-gateway_out=allow_patch_feature=false,$(PROTO_PATHS)\
|
|
53
|
+
--doc_out=html,index.html,source_relative:$(PROTO_OUT) \
|
|
54
|
+
$(PROTO_DIR)*.proto;)
|
|
55
|
+
|
|
56
|
+
fix-path:
|
|
57
|
+
mv -f $(PROTO_OUT)/temporal/api/* $(PROTO_OUT) && rm -rf $(PROTO_OUT)/temporal
|
|
58
|
+
|
|
59
|
+
##### Plugins & tools #####
|
|
60
|
+
grpc-install:
|
|
61
|
+
@printf $(COLOR) "Install/update protoc and plugins..."
|
|
62
|
+
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
|
63
|
+
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
|
64
|
+
@go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
|
|
65
|
+
@go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
|
|
66
|
+
|
|
67
|
+
api-linter-install:
|
|
68
|
+
printf $(COLOR) "Install/update api-linter..."
|
|
69
|
+
go install github.com/googleapis/api-linter/cmd/api-linter@v1.32.3
|
|
70
|
+
|
|
71
|
+
buf-install:
|
|
72
|
+
printf $(COLOR) "Install/update buf..."
|
|
73
|
+
go install github.com/bufbuild/buf/cmd/buf@v1.27.0
|
|
74
|
+
|
|
75
|
+
##### Linters #####
|
|
76
|
+
api-linter:
|
|
77
|
+
printf $(COLOR) "Run api-linter..."
|
|
78
|
+
$(call silent_exec, api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml $(PROTO_FILES))
|
|
79
|
+
|
|
80
|
+
$(STAMPDIR):
|
|
81
|
+
mkdir $@
|
|
82
|
+
|
|
83
|
+
$(STAMPDIR)/buf-mod-prune: $(STAMPDIR) buf.yaml
|
|
84
|
+
printf $(COLOR) "Pruning buf module"
|
|
85
|
+
buf mod prune
|
|
86
|
+
touch $@
|
|
87
|
+
|
|
88
|
+
buf-lint: $(STAMPDIR)/buf-mod-prune
|
|
89
|
+
printf $(COLOR) "Run buf linter..."
|
|
90
|
+
(cd $(PROTO_ROOT) && buf lint)
|
|
91
|
+
|
|
92
|
+
buf-breaking:
|
|
93
|
+
@printf $(COLOR) "Run buf breaking changes check against master branch..."
|
|
94
|
+
@(cd $(PROTO_ROOT) && buf breaking --against '.git#branch=master')
|
|
95
|
+
|
|
96
|
+
##### Clean #####
|
|
97
|
+
clean:
|
|
98
|
+
printf $(COLOR) "Delete generated go files..."
|
|
99
|
+
rm -rf $(PROTO_OUT) $(BUF_DEPS)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
- included_paths:
|
|
2
|
+
- "**/*.proto"
|
|
3
|
+
disabled_rules:
|
|
4
|
+
- "core::0192::has-comments"
|
|
5
|
+
|
|
6
|
+
- included_paths:
|
|
7
|
+
- "**/message.proto"
|
|
8
|
+
disabled_rules:
|
|
9
|
+
- "core::0122::name-suffix"
|
|
10
|
+
- "core::0123::resource-annotation"
|
|
11
|
+
|
|
12
|
+
- included_paths:
|
|
13
|
+
- "**/workflowservice/v1/request_response.proto"
|
|
14
|
+
- "**/operatorservice/v1/request_response.proto"
|
|
15
|
+
disabled_rules:
|
|
16
|
+
- "core::0122::name-suffix"
|
|
17
|
+
- "core::0131::request-name-required"
|
|
18
|
+
- "core::0131::request-unknown-fields"
|
|
19
|
+
- "core::0132::request-parent-required"
|
|
20
|
+
- "core::0132::request-unknown-fields"
|
|
21
|
+
- "core::0132::response-unknown-fields"
|
|
22
|
+
- "core::0134::request-unknown-fields"
|
|
23
|
+
- "core::0158::request-page-size-field"
|
|
24
|
+
- "core::0158::request-page-token-field"
|
|
25
|
+
- "core::0158::response-next-page-token-field"
|
|
26
|
+
- "core::0158::response-plural-first-field"
|
|
27
|
+
- "core::0158::response-repeated-first-field"
|
|
28
|
+
|
|
29
|
+
- included_paths:
|
|
30
|
+
- "**/workflowservice/v1/service.proto"
|
|
31
|
+
- "**/operatorservice/v1/service.proto"
|
|
32
|
+
disabled_rules:
|
|
33
|
+
# We extract specific fields in URL since the gRPC API predates the HTTP API
|
|
34
|
+
- "core::0127::resource-name-extraction"
|
|
35
|
+
|
|
36
|
+
# We do not require specific "Get", "Create", "Update", or "Delete" RPC
|
|
37
|
+
# rules just because we happen to use a known RPC name prefix
|
|
38
|
+
- "core::0131"
|
|
39
|
+
- "core::0133"
|
|
40
|
+
- "core::0134"
|
|
41
|
+
- "core::0135"
|
|
42
|
+
|
|
43
|
+
# We don't require HTTP calls to be suffixed with the same name as the gRPC
|
|
44
|
+
# name
|
|
45
|
+
- "core::0136::http-uri-suffix"
|
|
46
|
+
|
|
47
|
+
- included_paths:
|
|
48
|
+
- "**/operatorservice/v1/service.proto"
|
|
49
|
+
disabled_rules:
|
|
50
|
+
# Do not require HTTP annotations on OperatorService calls at this time
|
|
51
|
+
- "core::0127::http-annotation"
|
|
52
|
+
|
|
53
|
+
- included_paths:
|
|
54
|
+
- "google/**/*.proto"
|
|
55
|
+
disabled_rules:
|
|
56
|
+
- "all"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: v1
|
|
2
|
+
plugins:
|
|
3
|
+
- plugin: buf.build/protocolbuffers/go:v1.31.0
|
|
4
|
+
out: ./
|
|
5
|
+
opt:
|
|
6
|
+
- paths=source_relative
|
|
7
|
+
- plugin: buf.build/grpc/go:v1.3.0
|
|
8
|
+
out: ./
|
|
9
|
+
opt:
|
|
10
|
+
- paths=source_relative
|
|
11
|
+
- plugin: buf.build/grpc-ecosystem/gateway:v2.18.0
|
|
12
|
+
out: ./
|
|
13
|
+
opt:
|
|
14
|
+
- paths=source_relative
|
|
15
|
+
- allow_patch_feature=false
|
|
16
|
+
- name: go-helpers
|
|
17
|
+
out: ./
|
|
18
|
+
path: ["go", "run", "./protoc-gen-go-helpers"]
|
|
19
|
+
opt:
|
|
20
|
+
- paths=source_relative
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Generated by buf. DO NOT EDIT.
|
|
2
|
+
version: v1
|
|
3
|
+
deps:
|
|
4
|
+
- remote: buf.build
|
|
5
|
+
owner: googleapis
|
|
6
|
+
repository: googleapis
|
|
7
|
+
commit: 28151c0d0a1641bf938a7672c500e01d
|
|
8
|
+
- remote: buf.build
|
|
9
|
+
owner: grpc-ecosystem
|
|
10
|
+
repository: grpc-gateway
|
|
11
|
+
commit: 048ae6ff94ca4476b3225904b1078fad
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: v1
|
|
2
|
+
deps:
|
|
3
|
+
- buf.build/grpc-ecosystem/grpc-gateway
|
|
4
|
+
build:
|
|
5
|
+
excludes:
|
|
6
|
+
# Buf won't accept a local dependency on the google protos but we need them
|
|
7
|
+
# to run api-linter, so just tell buf it ignore it
|
|
8
|
+
- google
|
|
9
|
+
breaking:
|
|
10
|
+
use:
|
|
11
|
+
- WIRE_JSON
|
|
12
|
+
ignore:
|
|
13
|
+
- google
|
|
14
|
+
lint:
|
|
15
|
+
use:
|
|
16
|
+
- DEFAULT
|
|
17
|
+
ignore:
|
|
18
|
+
- google
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2015 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.api;
|
|
18
|
+
|
|
19
|
+
import "google/api/http.proto";
|
|
20
|
+
import "google/protobuf/descriptor.proto";
|
|
21
|
+
|
|
22
|
+
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_outer_classname = "AnnotationsProto";
|
|
25
|
+
option java_package = "com.google.api";
|
|
26
|
+
option objc_class_prefix = "GAPI";
|
|
27
|
+
|
|
28
|
+
extend google.protobuf.MethodOptions {
|
|
29
|
+
// See `HttpRule`.
|
|
30
|
+
HttpRule http = 72295728;
|
|
31
|
+
}
|