@@ -25,25 +25,35 @@ import {
2525  HttpsFunction , 
2626  Runnable , 
2727}  from  'firebase-functions/v1' ; 
28- 
2928import  { 
3029  CloudFunction  as  CloudFunctionV2 , 
3130  CloudEvent , 
3231}  from  'firebase-functions/v2' ; 
33- 
3432import  { 
3533  CallableFunction , 
3634  HttpsFunction  as  HttpsFunctionV2 , 
3735}  from  'firebase-functions/v2/https' ; 
3836
39- import  {  wrapV1 ,  WrappedFunction ,  WrappedScheduledFunction  }  from  './v1' ; 
40- 
41- import  {  wrapV2 ,  WrappedV2Function ,  WrappedV2CallableFunction  }  from  './v2' ; 
37+ import  {  wrapV1  }  from  './v1' ; 
38+ import  {  wrapV2  }  from  './v2' ; 
39+ import  {  WrappedFunction ,  WrappedScheduledFunction  }  from  './types/v1Types' ; 
40+ import  {  WrappedV2Function ,  WrappedV2CallableFunction  }  from  './types/v2Types' ; 
41+ import  {  HttpsFunctionOrCloudFunctionV1  }  from  './types/v1Types' ; 
4242
43- type  HttpsFunctionOrCloudFunctionV1 < T ,  U >  =  U  extends  HttpsFunction  & 
44-   Runnable < T > 
45-   ? HttpsFunction  &  Runnable < T > 
46-   : CloudFunctionV1 < T > ; 
43+ /** 
44+  * The key differences between V1 and V2 CloudFunctions are: 
45+  * <ul> 
46+  *    <li> V1 CloudFunction is sometimes a binary function 
47+  *    <li> V2 CloudFunction is always a unary function 
48+  *    <li> V1 CloudFunction.run is always a binary function 
49+  *    <li> V2 CloudFunction.run is always a unary function 
50+  * @return  True iff the CloudFunction is a V2 function. 
51+  */ 
52+ function  isV2CloudFunction < T  extends  CloudEvent < unknown > > ( 
53+   cloudFunction : any 
54+ ) : cloudFunction  is CloudFunctionV2 < T >  { 
55+   return  cloudFunction . length  ===  1  &&  cloudFunction ?. run ?. length  ===  1 ; 
56+ } 
4757
4858// Re-exporting V1 (to reduce breakage) 
4959export  { 
@@ -52,13 +62,10 @@ export {
5262  WrappedFunction , 
5363  WrappedScheduledFunction , 
5464  CallableContextOptions , 
55-   makeChange , 
56-   mockConfig , 
57- }  from  './v1' ; 
58- 
65+ }  from  './types/v1Types' ; 
66+ export  {  makeChange ,  mockConfig  }  from  './v1' ; 
5967// V2 Exports 
60- export  {  WrappedV2Function  }  from  './v2' ; 
61- 
68+ export  {  WrappedV2Function  }  from  './types/v2Types' ; 
6269export  function  wrap < T > ( 
6370  cloudFunction : HttpsFunction  &  Runnable < T > 
6471) : WrappedFunction < T ,  HttpsFunction  &  Runnable < T > > ; 
@@ -85,18 +92,3 @@ export function wrap<T, V extends CloudEvent<unknown>>(
8592    cloudFunction  as  HttpsFunctionOrCloudFunctionV1 < T ,  typeof  cloudFunction > 
8693  ) ; 
8794} 
88- 
89- /** 
90-  * The key differences between V1 and V2 CloudFunctions are: 
91-  * <ul> 
92-  *    <li> V1 CloudFunction is sometimes a binary function 
93-  *    <li> V2 CloudFunction is always a unary function 
94-  *    <li> V1 CloudFunction.run is always a binary function 
95-  *    <li> V2 CloudFunction.run is always a unary function 
96-  * @return  True iff the CloudFunction is a V2 function. 
97-  */ 
98- function  isV2CloudFunction < T  extends  CloudEvent < unknown > > ( 
99-   cloudFunction : any 
100- ) : cloudFunction  is CloudFunctionV2 < T >  { 
101-   return  cloudFunction . length  ===  1  &&  cloudFunction ?. run ?. length  ===  1 ; 
102- } 
0 commit comments