@@ -9,24 +9,8 @@ const pbts = require('protobufjs-cli/pbts');
99const outputDir = resolve ( __dirname , '../protos' ) ;
1010const jsOutputFile = resolve ( outputDir , 'json-module.js' ) ;
1111const tempFile = resolve ( outputDir , 'temp.js' ) ;
12- const protoBaseDir = resolve ( __dirname , '../../core-bridge/sdk-core/sdk-core-protos/protos' ) ;
1312
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' ) ;
3014
3115function mtime ( path ) {
3216 try {
@@ -40,28 +24,15 @@ function mtime(path) {
4024}
4125
4226async 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
4527 const pbjsArgs = [
46- ...args ,
47- '--wrap' ,
48- 'commonjs' ,
28+ ...[ '--wrap' , 'commonjs' ] ,
4929 '--force-long' ,
5030 '--no-verify' ,
5131 '--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 ,
6536 ] ;
6637
6738 console . log ( `Creating protobuf JS definitions` ) ;
@@ -101,14 +72,32 @@ async function main() {
10172 return ;
10273 }
10374
104- await compileProtos (
105- resolve ( outputDir , 'root.d.ts' ) ,
106- '--path' ,
75+ const rootDirs = [
10776 resolve ( protoBaseDir , 'api_upstream' ) ,
108- '--path' ,
77+ resolve ( protoBaseDir , 'testsrv_upstream' ) ,
10978 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
112101 ) ;
113102
114103 console . log ( 'Done' ) ;
0 commit comments