@@ -10,6 +10,7 @@ import { getPathInProject } from '../settings.js'
10
10
interface BaseBlobsContext {
11
11
deployID : string
12
12
siteID : string
13
+ primaryRegion ?: string
13
14
token : string
14
15
}
15
16
@@ -27,6 +28,7 @@ export type BlobsContext = BlobsContextWithAPIAccess | BlobsContextWithEdgeAcces
27
28
let hasPrintedLocalBlobsNotice = false
28
29
29
30
export const BLOBS_CONTEXT_VARIABLE = 'NETLIFY_BLOBS_CONTEXT'
31
+ const DEV_REGION = 'dev'
30
32
31
33
const printLocalBlobsNotice = ( ) => {
32
34
if ( hasPrintedLocalBlobsNotice ) {
@@ -76,6 +78,7 @@ export const getBlobsContextWithAPIAccess = async ({ debug, projectRoot, siteID
76
78
const context : BlobsContextWithAPIAccess = {
77
79
apiURL : url ,
78
80
deployID : '0' ,
81
+ primaryRegion : DEV_REGION ,
79
82
siteID,
80
83
token,
81
84
}
@@ -95,11 +98,23 @@ export const getBlobsContextWithEdgeAccess = async ({ debug, projectRoot, siteID
95
98
siteID,
96
99
token,
97
100
uncachedEdgeURL : url ,
101
+ primaryRegion : DEV_REGION ,
98
102
}
99
103
100
104
return context
101
105
}
102
106
107
+ /**
108
+ * Returns the Blobs metadata that should be added to the Lambda event when
109
+ * invoking a serverless function.
110
+ */
111
+ export const getBlobsEventProperty = ( context : BlobsContextWithEdgeAccess ) => ( {
112
+ primary_region : context . primaryRegion ,
113
+ url : context . edgeURL ,
114
+ url_uncached : context . edgeURL ,
115
+ token : context . token ,
116
+ } )
117
+
103
118
/**
104
119
* Returns a Base-64, JSON-encoded representation of the Blobs context. This is
105
120
* the format that the `@netlify/blobs` package expects to find the context in.
0 commit comments