@@ -9,24 +9,8 @@ const pbts = require('protobufjs-cli/pbts');
9
9
const outputDir = resolve ( __dirname , '../protos' ) ;
10
10
const jsOutputFile = resolve ( outputDir , 'json-module.js' ) ;
11
11
const tempFile = resolve ( outputDir , 'temp.js' ) ;
12
- const protoBaseDir = resolve ( __dirname , '../../core-bridge/sdk-core/sdk-core-protos/protos' ) ;
13
12
14
- const coreProtoPath = resolve ( protoBaseDir , 'local/temporal/sdk/core/core_interface.proto' ) ;
15
- const workflowServiceProtoPath = resolve ( protoBaseDir , 'api_upstream/temporal/api/workflowservice/v1/service.proto' ) ;
16
- const operatorServiceProtoPath = resolve ( protoBaseDir , 'api_upstream/temporal/api/operatorservice/v1/service.proto' ) ;
17
- const cloudServiceProtoPath = resolve (
18
- protoBaseDir ,
19
- 'api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto'
20
- ) ;
21
- const errorDetailsProtoPath = resolve ( protoBaseDir , 'api_upstream/temporal/api/errordetails/v1/message.proto' ) ;
22
- const workflowMetadataProtoPath = resolve ( protoBaseDir , 'api_upstream/temporal/api/sdk/v1/workflow_metadata.proto' ) ;
23
- const testServiceRRProtoPath = resolve (
24
- protoBaseDir ,
25
- 'testsrv_upstream/temporal/api/testservice/v1/request_response.proto'
26
- ) ;
27
- const testServiceProtoPath = resolve ( protoBaseDir , 'testsrv_upstream/temporal/api/testservice/v1/service.proto' ) ;
28
- const healthServiceProtoPath = resolve ( protoBaseDir , 'grpc/health/v1/health.proto' ) ;
29
- const googleRpcStatusProtoPath = resolve ( protoBaseDir , 'google/rpc/status.proto' ) ;
13
+ const protoBaseDir = resolve ( __dirname , '../../core-bridge/sdk-core/sdk-core-protos/protos' ) ;
30
14
31
15
function mtime ( path ) {
32
16
try {
@@ -40,28 +24,15 @@ function mtime(path) {
40
24
}
41
25
42
26
async function compileProtos ( dtsOutputFile , ...args ) {
43
- // Use --root to avoid conflicting with user's root
44
- // and to avoid this error: https://github.com/protobufjs/protobuf.js/issues/1114
45
27
const pbjsArgs = [
46
- ...args ,
47
- '--wrap' ,
48
- 'commonjs' ,
28
+ ...[ '--wrap' , 'commonjs' ] ,
49
29
'--force-long' ,
50
30
'--no-verify' ,
51
31
'--alt-comment' ,
52
- '--root' ,
53
- '__temporal' ,
54
- resolve ( require . resolve ( 'protobufjs' ) , '../google/protobuf/descriptor.proto' ) ,
55
- coreProtoPath ,
56
- workflowServiceProtoPath ,
57
- operatorServiceProtoPath ,
58
- cloudServiceProtoPath ,
59
- errorDetailsProtoPath ,
60
- workflowMetadataProtoPath ,
61
- testServiceRRProtoPath ,
62
- testServiceProtoPath ,
63
- healthServiceProtoPath ,
64
- googleRpcStatusProtoPath ,
32
+ // Use --root to avoid conflicting with user's root
33
+ // and to avoid this error: https://github.com/protobufjs/protobuf.js/issues/1114
34
+ ...[ '--root' , '__temporal' ] ,
35
+ ...args ,
65
36
] ;
66
37
67
38
console . log ( `Creating protobuf JS definitions` ) ;
@@ -101,14 +72,32 @@ async function main() {
101
72
return ;
102
73
}
103
74
104
- await compileProtos (
105
- resolve ( outputDir , 'root.d.ts' ) ,
106
- '--path' ,
75
+ const rootDirs = [
107
76
resolve ( protoBaseDir , 'api_upstream' ) ,
108
- '--path' ,
77
+ resolve ( protoBaseDir , 'testsrv_upstream' ) ,
109
78
resolve ( protoBaseDir , 'local' ) ,
110
- '--path' ,
111
- resolve ( protoBaseDir , 'api_cloud_upstream' )
79
+ resolve ( protoBaseDir , 'api_cloud_upstream' ) ,
80
+ protoBaseDir , // 'grpc' and 'google' are directly under protoBaseDir
81
+ ] ;
82
+
83
+ const entrypoints = [
84
+ 'temporal/sdk/core/core_interface.proto' ,
85
+ 'temporal/api/workflowservice/v1/service.proto' ,
86
+ 'temporal/api/operatorservice/v1/service.proto' ,
87
+ 'temporal/api/cloud/cloudservice/v1/service.proto' ,
88
+ 'temporal/api/errordetails/v1/message.proto' ,
89
+ 'temporal/api/sdk/v1/workflow_metadata.proto' ,
90
+ 'temporal/api/testservice/v1/request_response.proto' ,
91
+ 'temporal/api/testservice/v1/service.proto' ,
92
+ 'grpc/health/v1/health.proto' ,
93
+ 'google/rpc/status.proto' ,
94
+ ] ;
95
+
96
+ await compileProtos (
97
+ resolve ( outputDir , 'root.d.ts' ) ,
98
+ // Make sure to include all
99
+ ...rootDirs . flatMap ( ( dir ) => [ '--path' , dir ] ) ,
100
+ ...entrypoints
112
101
) ;
113
102
114
103
console . log ( 'Done' ) ;
0 commit comments