@@ -106,16 +106,21 @@ type uploadError struct {
106
106
}
107
107
108
108
type FileBundle struct {
109
- Name string
110
- Sum string
111
- Runtime string
112
- Size * int64 `json:"size,omitempty"`
109
+ Name string
110
+ Sum string
111
+ Runtime string
112
+ Size * int64 `json:"size,omitempty"`
113
+ FunctionMetadata * FunctionMetadata
113
114
114
115
// Path OR Buffer should be populated
115
116
Path string
116
117
Buffer io.ReadSeeker
117
118
}
118
119
120
+ type FunctionMetadata struct {
121
+ InvocationMode string
122
+ }
123
+
119
124
type toolchainSpec struct {
120
125
Runtime string `json:"runtime"`
121
126
}
@@ -517,6 +522,10 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
517
522
params = params .WithXNfRetryCount (& retryCount )
518
523
}
519
524
525
+ if f .FunctionMetadata != nil {
526
+ params = params .WithInvocationMode (& f .FunctionMetadata .InvocationMode )
527
+ }
528
+
520
529
if timeout != 0 {
521
530
params .SetTimeout (timeout )
522
531
}
@@ -705,19 +714,19 @@ func bundle(ctx context.Context, functionDir string, observer DeployObserver) (*
705
714
if err != nil {
706
715
return nil , nil , nil , err
707
716
}
708
- file , err := newFunctionFile (filePath , i , runtime , observer )
717
+ file , err := newFunctionFile (filePath , i , runtime , nil , observer )
709
718
if err != nil {
710
719
return nil , nil , nil , err
711
720
}
712
721
functions .Add (file .Name , file )
713
722
case jsFile (i ):
714
- file , err := newFunctionFile (filePath , i , jsRuntime , observer )
723
+ file , err := newFunctionFile (filePath , i , jsRuntime , nil , observer )
715
724
if err != nil {
716
725
return nil , nil , nil , err
717
726
}
718
727
functions .Add (file .Name , file )
719
728
case goFile (filePath , i , observer ):
720
- file , err := newFunctionFile (filePath , i , goRuntime , observer )
729
+ file , err := newFunctionFile (filePath , i , goRuntime , nil , observer )
721
730
if err != nil {
722
731
return nil , nil , nil , err
723
732
}
@@ -768,7 +777,10 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
768
777
runtime = function .Runtime
769
778
}
770
779
771
- file , err := newFunctionFile (function .Path , fileInfo , runtime , observer )
780
+ meta := FunctionMetadata {
781
+ InvocationMode : function .InvocationMode ,
782
+ }
783
+ file , err := newFunctionFile (function .Path , fileInfo , runtime , & meta , observer )
772
784
773
785
if err != nil {
774
786
return nil , nil , nil , err
@@ -824,7 +836,7 @@ func readZipRuntime(filePath string) (string, error) {
824
836
return jsRuntime , nil
825
837
}
826
838
827
- func newFunctionFile (filePath string , i os.FileInfo , runtime string , observer DeployObserver ) (* FileBundle , error ) {
839
+ func newFunctionFile (filePath string , i os.FileInfo , runtime string , metadata * FunctionMetadata , observer DeployObserver ) (* FileBundle , error ) {
828
840
file := & FileBundle {
829
841
Name : strings .TrimSuffix (i .Name (), filepath .Ext (i .Name ())),
830
842
Runtime : runtime ,
@@ -875,6 +887,8 @@ func newFunctionFile(filePath string, i os.FileInfo, runtime string, observer De
875
887
}
876
888
}
877
889
890
+ file .FunctionMetadata = metadata
891
+
878
892
return file , nil
879
893
}
880
894
0 commit comments