@temporalio/core-bridge 0.14.0 → 0.16.4

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.
Files changed (75) hide show
  1. package/Cargo.lock +162 -38
  2. package/Cargo.toml +3 -3
  3. package/index.d.ts +14 -1
  4. package/index.node +0 -0
  5. package/package.json +8 -5
  6. package/releases/aarch64-apple-darwin/index.node +0 -0
  7. package/releases/{x86_64-pc-windows-gnu → aarch64-unknown-linux-gnu}/index.node +0 -0
  8. package/releases/x86_64-apple-darwin/index.node +0 -0
  9. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  10. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  11. package/scripts/build.js +77 -34
  12. package/sdk-core/.buildkite/docker/Dockerfile +1 -1
  13. package/sdk-core/Cargo.toml +6 -5
  14. package/sdk-core/fsm/Cargo.toml +1 -1
  15. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +2 -2
  16. package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +8 -9
  17. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +13 -7
  18. package/sdk-core/fsm/rustfsm_trait/Cargo.toml +2 -2
  19. package/sdk-core/fsm/rustfsm_trait/src/lib.rs +1 -1
  20. package/sdk-core/protos/local/workflow_activation.proto +6 -3
  21. package/sdk-core/sdk-core-protos/Cargo.toml +4 -4
  22. package/sdk-core/sdk-core-protos/src/lib.rs +38 -50
  23. package/sdk-core/src/core_tests/activity_tasks.rs +5 -5
  24. package/sdk-core/src/core_tests/child_workflows.rs +55 -29
  25. package/sdk-core/src/core_tests/determinism.rs +19 -9
  26. package/sdk-core/src/core_tests/mod.rs +3 -3
  27. package/sdk-core/src/core_tests/retry.rs +14 -8
  28. package/sdk-core/src/core_tests/workers.rs +1 -1
  29. package/sdk-core/src/core_tests/workflow_tasks.rs +347 -4
  30. package/sdk-core/src/errors.rs +27 -44
  31. package/sdk-core/src/lib.rs +13 -3
  32. package/sdk-core/src/machines/activity_state_machine.rs +44 -5
  33. package/sdk-core/src/machines/child_workflow_state_machine.rs +31 -11
  34. package/sdk-core/src/machines/complete_workflow_state_machine.rs +1 -1
  35. package/sdk-core/src/machines/continue_as_new_workflow_state_machine.rs +1 -1
  36. package/sdk-core/src/machines/mod.rs +18 -23
  37. package/sdk-core/src/machines/patch_state_machine.rs +8 -8
  38. package/sdk-core/src/machines/signal_external_state_machine.rs +22 -1
  39. package/sdk-core/src/machines/timer_state_machine.rs +21 -3
  40. package/sdk-core/src/machines/transition_coverage.rs +3 -3
  41. package/sdk-core/src/machines/workflow_machines.rs +11 -11
  42. package/sdk-core/src/pending_activations.rs +27 -22
  43. package/sdk-core/src/pollers/gateway.rs +15 -7
  44. package/sdk-core/src/pollers/poll_buffer.rs +6 -5
  45. package/sdk-core/src/pollers/retry.rs +153 -120
  46. package/sdk-core/src/prototype_rust_sdk/workflow_context.rs +61 -46
  47. package/sdk-core/src/prototype_rust_sdk/workflow_future.rs +13 -12
  48. package/sdk-core/src/prototype_rust_sdk.rs +17 -23
  49. package/sdk-core/src/telemetry/metrics.rs +2 -4
  50. package/sdk-core/src/telemetry/mod.rs +6 -7
  51. package/sdk-core/src/test_help/canned_histories.rs +17 -93
  52. package/sdk-core/src/test_help/history_builder.rs +61 -2
  53. package/sdk-core/src/test_help/history_info.rs +21 -2
  54. package/sdk-core/src/test_help/mod.rs +26 -34
  55. package/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +246 -138
  56. package/sdk-core/src/worker/activities.rs +46 -45
  57. package/sdk-core/src/worker/config.rs +11 -0
  58. package/sdk-core/src/worker/dispatcher.rs +5 -5
  59. package/sdk-core/src/worker/mod.rs +86 -56
  60. package/sdk-core/src/workflow/driven_workflow.rs +3 -3
  61. package/sdk-core/src/workflow/history_update.rs +1 -1
  62. package/sdk-core/src/workflow/mod.rs +2 -1
  63. package/sdk-core/src/workflow/workflow_tasks/cache_manager.rs +13 -17
  64. package/sdk-core/src/workflow/workflow_tasks/concurrency_manager.rs +10 -18
  65. package/sdk-core/src/workflow/workflow_tasks/mod.rs +72 -57
  66. package/sdk-core/test_utils/Cargo.toml +1 -1
  67. package/sdk-core/test_utils/src/lib.rs +2 -2
  68. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +61 -1
  69. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +2 -2
  70. package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +49 -0
  71. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +2 -2
  72. package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
  73. package/src/conversions.rs +17 -0
  74. package/src/errors.rs +0 -7
  75. package/src/lib.rs +0 -20
package/Cargo.lock CHANGED
@@ -13,6 +13,15 @@ dependencies = [
13
13
  "version_check",
14
14
  ]
15
15
 
16
+ [[package]]
17
+ name = "aho-corasick"
18
+ version = "0.7.18"
19
+ source = "registry+https://github.com/rust-lang/crates.io-index"
20
+ checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
21
+ dependencies = [
22
+ "memchr",
23
+ ]
24
+
16
25
  [[package]]
17
26
  name = "ansi_term"
18
27
  version = "0.12.1"
@@ -30,9 +39,9 @@ checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7"
30
39
 
31
40
  [[package]]
32
41
  name = "arc-swap"
33
- version = "1.4.0"
42
+ version = "1.5.0"
34
43
  source = "registry+https://github.com/rust-lang/crates.io-index"
35
- checksum = "e6df5aef5c5830360ce5218cecb8f018af3438af5686ae945094affc86fdec63"
44
+ checksum = "c5d78ce20460b82d3fa150275ed9d55e21064fc7951177baacf86a145c4a4b1f"
36
45
 
37
46
  [[package]]
38
47
  name = "async-stream"
@@ -115,9 +124,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
115
124
 
116
125
  [[package]]
117
126
  name = "cc"
118
- version = "1.0.71"
127
+ version = "1.0.72"
119
128
  source = "registry+https://github.com/rust-lang/crates.io-index"
120
- checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
129
+ checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
121
130
 
122
131
  [[package]]
123
132
  name = "cfg-if"
@@ -334,6 +343,12 @@ version = "0.2.0"
334
343
  source = "registry+https://github.com/rust-lang/crates.io-index"
335
344
  checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
336
345
 
346
+ [[package]]
347
+ name = "fixedbitset"
348
+ version = "0.4.0"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e"
351
+
337
352
  [[package]]
338
353
  name = "fnv"
339
354
  version = "1.0.7"
@@ -548,9 +563,9 @@ checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"
548
563
 
549
564
  [[package]]
550
565
  name = "hyper"
551
- version = "0.14.14"
566
+ version = "0.14.15"
552
567
  source = "registry+https://github.com/rust-lang/crates.io-index"
553
- checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b"
568
+ checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"
554
569
  dependencies = [
555
570
  "bytes",
556
571
  "futures-channel",
@@ -650,9 +665,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
650
665
 
651
666
  [[package]]
652
667
  name = "libc"
653
- version = "0.2.106"
668
+ version = "0.2.107"
654
669
  source = "registry+https://github.com/rust-lang/crates.io-index"
655
- checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673"
670
+ checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
656
671
 
657
672
  [[package]]
658
673
  name = "libloading"
@@ -871,11 +886,11 @@ dependencies = [
871
886
  "futures",
872
887
  "http",
873
888
  "opentelemetry",
874
- "prost",
889
+ "prost 0.8.0",
875
890
  "thiserror",
876
891
  "tokio",
877
- "tonic",
878
- "tonic-build",
892
+ "tonic 0.5.2",
893
+ "tonic-build 0.5.2",
879
894
  ]
880
895
 
881
896
  [[package]]
@@ -935,7 +950,17 @@ version = "0.5.1"
935
950
  source = "registry+https://github.com/rust-lang/crates.io-index"
936
951
  checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
937
952
  dependencies = [
938
- "fixedbitset",
953
+ "fixedbitset 0.2.0",
954
+ "indexmap",
955
+ ]
956
+
957
+ [[package]]
958
+ name = "petgraph"
959
+ version = "0.6.0"
960
+ source = "registry+https://github.com/rust-lang/crates.io-index"
961
+ checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
962
+ dependencies = [
963
+ "fixedbitset 0.4.0",
939
964
  "indexmap",
940
965
  ]
941
966
 
@@ -1020,7 +1045,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1020
1045
  checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
1021
1046
  dependencies = [
1022
1047
  "bytes",
1023
- "prost-derive",
1048
+ "prost-derive 0.8.0",
1049
+ ]
1050
+
1051
+ [[package]]
1052
+ name = "prost"
1053
+ version = "0.9.0"
1054
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1055
+ checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
1056
+ dependencies = [
1057
+ "bytes",
1058
+ "prost-derive 0.9.0",
1024
1059
  ]
1025
1060
 
1026
1061
  [[package]]
@@ -1034,9 +1069,29 @@ dependencies = [
1034
1069
  "itertools",
1035
1070
  "log",
1036
1071
  "multimap",
1037
- "petgraph",
1038
- "prost",
1039
- "prost-types",
1072
+ "petgraph 0.5.1",
1073
+ "prost 0.8.0",
1074
+ "prost-types 0.8.0",
1075
+ "tempfile",
1076
+ "which",
1077
+ ]
1078
+
1079
+ [[package]]
1080
+ name = "prost-build"
1081
+ version = "0.9.0"
1082
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1083
+ checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
1084
+ dependencies = [
1085
+ "bytes",
1086
+ "heck",
1087
+ "itertools",
1088
+ "lazy_static",
1089
+ "log",
1090
+ "multimap",
1091
+ "petgraph 0.6.0",
1092
+ "prost 0.9.0",
1093
+ "prost-types 0.9.0",
1094
+ "regex",
1040
1095
  "tempfile",
1041
1096
  "which",
1042
1097
  ]
@@ -1054,6 +1109,19 @@ dependencies = [
1054
1109
  "syn",
1055
1110
  ]
1056
1111
 
1112
+ [[package]]
1113
+ name = "prost-derive"
1114
+ version = "0.9.0"
1115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1116
+ checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
1117
+ dependencies = [
1118
+ "anyhow",
1119
+ "itertools",
1120
+ "proc-macro2",
1121
+ "quote",
1122
+ "syn",
1123
+ ]
1124
+
1057
1125
  [[package]]
1058
1126
  name = "prost-types"
1059
1127
  version = "0.8.0"
@@ -1061,7 +1129,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1061
1129
  checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
1062
1130
  dependencies = [
1063
1131
  "bytes",
1064
- "prost",
1132
+ "prost 0.8.0",
1133
+ ]
1134
+
1135
+ [[package]]
1136
+ name = "prost-types"
1137
+ version = "0.9.0"
1138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1139
+ checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
1140
+ dependencies = [
1141
+ "bytes",
1142
+ "prost 0.9.0",
1065
1143
  ]
1066
1144
 
1067
1145
  [[package]]
@@ -1134,6 +1212,8 @@ version = "1.5.4"
1134
1212
  source = "registry+https://github.com/rust-lang/crates.io-index"
1135
1213
  checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
1136
1214
  dependencies = [
1215
+ "aho-corasick",
1216
+ "memchr",
1137
1217
  "regex-syntax",
1138
1218
  ]
1139
1219
 
@@ -1338,9 +1418,9 @@ checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
1338
1418
 
1339
1419
  [[package]]
1340
1420
  name = "serde_json"
1341
- version = "1.0.68"
1421
+ version = "1.0.70"
1342
1422
  source = "registry+https://github.com/rust-lang/crates.io-index"
1343
- checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
1423
+ checksum = "e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3"
1344
1424
  dependencies = [
1345
1425
  "itoa",
1346
1426
  "ryu",
@@ -1460,8 +1540,8 @@ dependencies = [
1460
1540
  "opentelemetry-prometheus",
1461
1541
  "parking_lot",
1462
1542
  "prometheus",
1463
- "prost",
1464
- "prost-types",
1543
+ "prost 0.9.0",
1544
+ "prost-types 0.9.0",
1465
1545
  "rand",
1466
1546
  "ringbuf",
1467
1547
  "rustfsm",
@@ -1470,8 +1550,9 @@ dependencies = [
1470
1550
  "thiserror",
1471
1551
  "tokio",
1472
1552
  "tokio-stream",
1473
- "tonic",
1474
- "tonic-build",
1553
+ "tokio-util",
1554
+ "tonic 0.6.1",
1555
+ "tonic-build 0.6.0",
1475
1556
  "tower",
1476
1557
  "tracing",
1477
1558
  "tracing-futures",
@@ -1486,10 +1567,10 @@ name = "temporal-sdk-core-protos"
1486
1567
  version = "0.1.0"
1487
1568
  dependencies = [
1488
1569
  "derive_more",
1489
- "prost",
1490
- "prost-types",
1491
- "tonic",
1492
- "tonic-build",
1570
+ "prost 0.9.0",
1571
+ "prost-types 0.9.0",
1572
+ "tonic 0.6.1",
1573
+ "tonic-build 0.5.2",
1493
1574
  ]
1494
1575
 
1495
1576
  [[package]]
@@ -1501,8 +1582,8 @@ dependencies = [
1501
1582
  "neon",
1502
1583
  "once_cell",
1503
1584
  "opentelemetry",
1504
- "prost",
1505
- "prost-types",
1585
+ "prost 0.9.0",
1586
+ "prost-types 0.9.0",
1506
1587
  "temporal-sdk-core",
1507
1588
  "temporal-sdk-core-protos",
1508
1589
  "tokio",
@@ -1539,9 +1620,9 @@ dependencies = [
1539
1620
 
1540
1621
  [[package]]
1541
1622
  name = "tinyvec"
1542
- version = "1.5.0"
1623
+ version = "1.5.1"
1543
1624
  source = "registry+https://github.com/rust-lang/crates.io-index"
1544
- checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"
1625
+ checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
1545
1626
  dependencies = [
1546
1627
  "tinyvec_macros",
1547
1628
  ]
@@ -1554,9 +1635,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
1554
1635
 
1555
1636
  [[package]]
1556
1637
  name = "tokio"
1557
- version = "1.13.0"
1638
+ version = "1.14.0"
1558
1639
  source = "registry+https://github.com/rust-lang/crates.io-index"
1559
- checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"
1640
+ checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
1560
1641
  dependencies = [
1561
1642
  "autocfg",
1562
1643
  "bytes",
@@ -1584,9 +1665,9 @@ dependencies = [
1584
1665
 
1585
1666
  [[package]]
1586
1667
  name = "tokio-macros"
1587
- version = "1.5.1"
1668
+ version = "1.6.0"
1588
1669
  source = "registry+https://github.com/rust-lang/crates.io-index"
1589
- checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"
1670
+ checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
1590
1671
  dependencies = [
1591
1672
  "proc-macro2",
1592
1673
  "quote",
@@ -1648,8 +1729,39 @@ dependencies = [
1648
1729
  "hyper-timeout",
1649
1730
  "percent-encoding",
1650
1731
  "pin-project",
1651
- "prost",
1652
- "prost-derive",
1732
+ "prost 0.8.0",
1733
+ "prost-derive 0.8.0",
1734
+ "tokio",
1735
+ "tokio-stream",
1736
+ "tokio-util",
1737
+ "tower",
1738
+ "tower-layer",
1739
+ "tower-service",
1740
+ "tracing",
1741
+ "tracing-futures",
1742
+ ]
1743
+
1744
+ [[package]]
1745
+ name = "tonic"
1746
+ version = "0.6.1"
1747
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1748
+ checksum = "24203b79cf2d68909da91178db3026e77054effba0c5d93deb870d3ca7b35afa"
1749
+ dependencies = [
1750
+ "async-stream",
1751
+ "async-trait",
1752
+ "base64",
1753
+ "bytes",
1754
+ "futures-core",
1755
+ "futures-util",
1756
+ "h2",
1757
+ "http",
1758
+ "http-body",
1759
+ "hyper",
1760
+ "hyper-timeout",
1761
+ "percent-encoding",
1762
+ "pin-project",
1763
+ "prost 0.9.0",
1764
+ "prost-derive 0.9.0",
1653
1765
  "rustls-native-certs",
1654
1766
  "tokio",
1655
1767
  "tokio-rustls",
@@ -1669,7 +1781,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1669
1781
  checksum = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08"
1670
1782
  dependencies = [
1671
1783
  "proc-macro2",
1672
- "prost-build",
1784
+ "prost-build 0.8.0",
1785
+ "quote",
1786
+ "syn",
1787
+ ]
1788
+
1789
+ [[package]]
1790
+ name = "tonic-build"
1791
+ version = "0.6.0"
1792
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1793
+ checksum = "88358bb1dcfeb62dcce85c63006cafb964b7be481d522b7e09589d4d1e718d2a"
1794
+ dependencies = [
1795
+ "proc-macro2",
1796
+ "prost-build 0.9.0",
1673
1797
  "quote",
1674
1798
  "syn",
1675
1799
  ]
package/Cargo.toml CHANGED
@@ -15,9 +15,9 @@ futures = { version = "0.3", features = ["executor"] }
15
15
  log = "0.4"
16
16
  neon = { version = "0.8.0", default-features = false, features = ["napi-4", "event-queue-api"] }
17
17
  opentelemetry = "0.16"
18
- prost = "0.8"
19
- prost-types = "0.8"
20
- tokio = "1.4.0"
18
+ prost = "0.9"
19
+ prost-types = "0.9"
20
+ tokio = "1.13"
21
21
  once_cell = "1.7.2"
22
22
  # TODO: revert back to version *, can't now because of this error: prerelease package needs to be specified explicitly
23
23
  temporal-sdk-core = { version = "0.1.0-alpha.1", path = "./sdk-core" }
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { TLSConfig } from '@temporalio/common';
2
- import { LogLevel } from '@temporalio/worker';
3
2
  import { SpanContext } from '@opentelemetry/api';
4
3
 
5
4
  export { TLSConfig };
@@ -126,6 +125,20 @@ export interface WorkerOptions {
126
125
  * Maximum number of Workflow instances to cache before automatic eviction
127
126
  */
128
127
  maxCachedWorkflows: number;
128
+ /**
129
+ * Longest interval for throttling activity heartbeats
130
+ * @default 60 seconds
131
+ */
132
+ maxHeartbeatThrottleIntervalMs: number;
133
+
134
+ /**
135
+ * Default interval for throttling activity heartbeats in case
136
+ * `ActivityOptions.heartbeat_timeout` is unset.
137
+ * When the timeout *is* set in the `ActivityOptions`, throttling is set to
138
+ * `heartbeat_timeout * 0.8`.
139
+ * @default 30 seconds
140
+ */
141
+ defaultHeartbeatThrottleIntervalMs: number;
129
142
  }
130
143
 
131
144
  /** Log level - must match rust log level names */
package/index.node CHANGED
Binary file
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@temporalio/core-bridge",
3
- "version": "0.14.0",
3
+ "version": "0.16.4",
4
4
  "description": "Temporal.io SDK Core<>Node bridge",
5
5
  "main": "index.node",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
- "build-rust": "TEMPORAL_WORKER_FORCE_BUILD=true node ./scripts/build.js",
8
+ "build-rust": "node ./scripts/build.js --force",
9
9
  "build": "npm run build-rust",
10
10
  "install": "node ./scripts/build.js"
11
11
  },
@@ -18,8 +18,11 @@
18
18
  "author": "Roey Berman <roey@temporal.io>",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@temporalio/common": "^0.14.0",
22
- "cargo-cp-artifact": "^0.1.4"
21
+ "@opentelemetry/api": "^1.0.3",
22
+ "@temporalio/common": "^0.16.4",
23
+ "arg": "^5.0.1",
24
+ "cargo-cp-artifact": "^0.1.4",
25
+ "which": "^2.0.2"
23
26
  },
24
27
  "bugs": {
25
28
  "url": "https://github.com/temporalio/sdk-typescript/issues"
@@ -37,5 +40,5 @@
37
40
  "publishConfig": {
38
41
  "access": "public"
39
42
  },
40
- "gitHead": "fd09cf4d3c996c96bf604d2e318165cfbad18a4a"
43
+ "gitHead": "884a10970cdbc3e8d7991709e0fa3fe79fce71bd"
41
44
  }
package/scripts/build.js CHANGED
@@ -1,27 +1,71 @@
1
1
  const path = require('path');
2
+ const arg = require('arg');
2
3
  const os = require('os');
3
4
  const fs = require('fs');
5
+ const which = require('which');
4
6
  const { spawnSync } = require('child_process');
7
+ const { version } = require('../package.json');
5
8
 
6
9
  process.chdir(path.resolve(__dirname, '..'));
7
10
 
8
- const targets = ['x86_64-apple-darwin', 'aarch64-apple-darwin', 'x86_64-unknown-linux-gnu', 'x86_64-pc-windows-gnu'];
9
-
10
- const requestedTargets =
11
- process.env.TEMPORAL_WORKER_BUILD_TARGETS === 'all'
12
- ? targets
13
- : process.env.TEMPORAL_WORKER_BUILD_TARGETS
14
- ? process.env.TEMPORAL_WORKER_BUILD_TARGETS.split(':')
15
- : [];
16
-
17
- // Only applicable if TEMPORAL_WORKER_BUILD_TARGETS is not specified
18
- const forceBuild = new Set(['y', 't', '1', 'yes', 'true']).has(
19
- (process.env.TEMPORAL_WORKER_FORCE_BUILD || '').toLowerCase()
20
- );
11
+ // List of tested compile targets
12
+ const targets = [
13
+ 'x86_64-apple-darwin',
14
+ 'aarch64-apple-darwin',
15
+ 'x86_64-unknown-linux-gnu',
16
+ 'aarch64-unknown-linux-gnu',
17
+ // TODO: this is not supported on macos
18
+ 'x86_64-pc-windows-msvc',
19
+ 'x86_64-pc-windows-gnu',
20
+ ];
21
21
 
22
22
  const archAlias = { x64: 'x86_64', arm64: 'aarch64' };
23
23
  const platformMapping = { darwin: 'apple-darwin', linux: 'unknown-linux-gnu', win32: 'pc-windows-gnu' };
24
24
 
25
+ const args = arg({
26
+ '--help': Boolean,
27
+ '-h': '--help',
28
+ '--version': Boolean,
29
+ '-v': '--version',
30
+ '--target': [String],
31
+ '--force': Boolean,
32
+ '-f': '--force',
33
+ });
34
+
35
+ const HELP_STRING = `${path.basename(
36
+ process.argv[1]
37
+ )} compiles the Core SDK and temporal-sdk-typescript-bridge Rust libraries
38
+
39
+ Options:
40
+
41
+ -h, --help Show this help message and exit
42
+ -v, --version Show program's version number and exit
43
+ -f, --force Forces a build instead of using a prebuilt binary
44
+ -t, --target Compilation targets, choose any of:
45
+ ${targets.concat('all').join('\n ')}
46
+
47
+ Happy compiling!`;
48
+
49
+ if (args['--help']) {
50
+ console.log(HELP_STRING);
51
+ process.exit();
52
+ }
53
+ if (args['--version']) {
54
+ console.log(version);
55
+ process.exit();
56
+ }
57
+ // });
58
+
59
+ // prepare recompile options
60
+ const targetsArg = args['--target'] || [];
61
+ const requestedTargets = targetsArg.includes('all') ? targets : targetsArg;
62
+ const unsupportedTargets = requestedTargets.filter((t) => !targets.includes(t));
63
+ if (unsupportedTargets.length) {
64
+ console.error(`Unsupported targets ${JSON.stringify(unsupportedTargets)}`);
65
+ process.exit(1);
66
+ }
67
+ const forceBuild = args['--force'];
68
+
25
69
  function compile(target) {
26
70
  console.log('Compiling bridge', { target });
27
71
 
@@ -33,26 +77,25 @@ function compile(target) {
33
77
  throw err;
34
78
  }
35
79
  }
36
- const { status, error } = spawnSync(
37
- 'cargo-cp-artifact',
38
- [
39
- '--artifact',
40
- 'cdylib',
41
- 'temporal_sdk_typescript_bridge',
42
- out,
43
- '--',
44
- 'cargo',
45
- 'build',
46
- '--message-format=json-render-diagnostics',
47
- '--release',
48
- ...(target ? ['--target', target] : []),
49
- ],
50
- { stdio: 'inherit' }
51
- );
52
- if (error !== undefined) {
53
- console.error(`Failed to build${target ? ' for ' + target : ''}`);
54
- throw error;
55
- }
80
+
81
+ const argv = [
82
+ '--artifact',
83
+ 'cdylib',
84
+ 'temporal_sdk_typescript_bridge',
85
+ out,
86
+ '--',
87
+ 'cargo',
88
+ 'build',
89
+ '--message-format=json-render-diagnostics',
90
+ '--release',
91
+ ...(target ? ['--target', target] : []),
92
+ ];
93
+ const cmd = which.sync('cargo-cp-artifact');
94
+
95
+ console.log('Running', cmd, argv);
96
+ const { status } = spawnSync(cmd, argv, {
97
+ stdio: 'inherit',
98
+ });
56
99
  if (status !== 0) {
57
100
  throw new Error(`Failed to build${target ? ' for ' + target : ''}`);
58
101
  }
@@ -104,7 +147,7 @@ if (requestedTargets.length > 0) {
104
147
  }
105
148
  }
106
149
  } else {
107
- console.log('Force build via TEMPORAL_WORKER_FORCE_BUILD env var');
150
+ console.log('Forced the build via --force');
108
151
  compile();
109
152
  }
110
153
  }
@@ -1,4 +1,4 @@
1
- FROM rust:1.54
1
+ FROM rust:1.56
2
2
 
3
3
  RUN rustup component add rustfmt && \
4
4
  rustup component add clippy
@@ -2,7 +2,7 @@
2
2
  name = "temporal-sdk-core"
3
3
  version = "0.1.0-alpha.1"
4
4
  authors = ["Spencer Judge <spencer@temporal.io>", "Vitaly Arbuzov <vitaly@temporal.io>"]
5
- edition = "2018"
5
+ edition = "2021"
6
6
  license-file = "LICENSE.txt"
7
7
  description = "Library for building new Temporal SDKs"
8
8
  homepage = "https://temporal.io/"
@@ -36,15 +36,16 @@ opentelemetry-otlp = { version = "0.9.0", features = ["tokio", "metrics"] }
36
36
  opentelemetry-prometheus = "0.9.0"
37
37
  parking_lot = { version = "0.11", features = ["send_guard"] }
38
38
  prometheus = "0.12"
39
- prost = "0.8"
40
- prost-types = "0.8"
39
+ prost = "0.9"
40
+ prost-types = "0.9"
41
41
  rand = "0.8.3"
42
42
  ringbuf = "0.2"
43
43
  slotmap = "1.0"
44
44
  thiserror = "1.0"
45
45
  tokio = { version = "1.1", features = ["rt", "rt-multi-thread", "parking_lot", "time", "fs"] }
46
+ tokio-util = { version = "0.6.9" }
46
47
  tokio-stream = "0.1"
47
- tonic = { version = "0.5", features = ["tls", "tls-roots"] }
48
+ tonic = { version = "0.6", features = ["tls", "tls-roots"] }
48
49
  tower = "0.4"
49
50
  tracing = { version = "0.1", features = ["log-always"] }
50
51
  tracing-futures = "0.2"
@@ -70,7 +71,7 @@ rstest = "0.10"
70
71
  test_utils = { path = "test_utils" }
71
72
 
72
73
  [build-dependencies]
73
- tonic-build = "0.5"
74
+ tonic-build = "0.6"
74
75
 
75
76
  [workspace]
76
77
  members = [".", "fsm", "test_utils", "sdk-core-protos"]
@@ -2,7 +2,7 @@
2
2
  name = "rustfsm"
3
3
  version = "0.1.0"
4
4
  authors = ["Spencer Judge <spencer@temporal.io>"]
5
- edition = "2018"
5
+ edition = "2021"
6
6
  license-file = "LICENSE.txt"
7
7
  description = "Define state machines that can accept events and produce commands"
8
8
  homepage = "https://temporal.io/"
@@ -2,7 +2,7 @@
2
2
  name = "rustfsm_procmacro"
3
3
  version = "0.1.0"
4
4
  authors = ["Spencer Judge <spencer@temporal.io>"]
5
- edition = "2018"
5
+ edition = "2021"
6
6
  license-file = "LICENSE.txt"
7
7
  description = "Procmacro sub-crate of the `rustfsm` crate"
8
8
 
@@ -24,4 +24,4 @@ rustfsm_trait = { version = "0.1", path = "../rustfsm_trait" }
24
24
  trybuild = { version = "1.0", features = ["diff"] }
25
25
 
26
26
  [package.metadata.workspaces]
27
- independent = true
27
+ independent = true