@@ -102,6 +102,7 @@ export type ConfigBindingFieldName =
102102 | "workflows"
103103 | "pipelines"
104104 | "secrets_store_secrets"
105+ | "artifacts"
105106 | "ratelimits"
106107 | "assets"
107108 | "unsafe_hello_world"
@@ -143,6 +144,7 @@ export const friendlyBindingNames: Record<ConfigBindingFieldName, string> = {
143144 workflows : "Workflow" ,
144145 pipelines : "Pipeline" ,
145146 secrets_store_secrets : "Secrets Store Secret" ,
147+ artifacts : "Artifacts" ,
146148 ratelimits : "Rate Limit" ,
147149 assets : "Assets" ,
148150 unsafe_hello_world : "Hello World" ,
@@ -187,6 +189,7 @@ const bindingTypeFriendlyNames: Record<Binding["type"], string> = {
187189 mtls_certificate : "mTLS Certificate" ,
188190 pipeline : "Pipeline" ,
189191 secrets_store_secret : "Secrets Store Secret" ,
192+ artifacts : "Artifacts" ,
190193 logfwdr : "logfwdr" ,
191194 unsafe_hello_world : "Hello World" ,
192195 flagship : "Flagship" ,
@@ -1878,6 +1881,16 @@ function normalizeAndValidateEnvironment(
18781881 validateBindingArray ( envName , validateSecretsStoreSecretBinding ) ,
18791882 [ ]
18801883 ) ,
1884+ artifacts : notInheritable (
1885+ diagnostics ,
1886+ topLevelEnv ,
1887+ rawConfig ,
1888+ rawEnv ,
1889+ envName ,
1890+ "artifacts" ,
1891+ validateBindingArray ( envName , validateArtifactsBinding ) ,
1892+ [ ]
1893+ ) ,
18811894 unsafe_hello_world : notInheritable (
18821895 diagnostics ,
18831896 topLevelEnv ,
@@ -2997,6 +3010,7 @@ const validateUnsafeBinding: ValidatorFn = (diagnostics, field, value) => {
29973010 "vpc_network" ,
29983011 "stream" ,
29993012 "media" ,
3013+ "artifacts" ,
30003014 ] ;
30013015
30023016 if ( safeBindings . includes ( value . type ) ) {
@@ -4779,6 +4793,45 @@ const validateSecretsStoreSecretBinding: ValidatorFn = (
47794793 return isValid ;
47804794} ;
47814795
4796+ const validateArtifactsBinding : ValidatorFn = ( diagnostics , field , value ) => {
4797+ if ( typeof value !== "object" || value === null ) {
4798+ diagnostics . errors . push (
4799+ `"artifacts" bindings should be objects, but got ${ JSON . stringify ( value ) } `
4800+ ) ;
4801+ return false ;
4802+ }
4803+ let isValid = true ;
4804+ if ( ! isRequiredProperty ( value , "binding" , "string" ) ) {
4805+ diagnostics . errors . push (
4806+ `"${ field } " bindings must have a string "binding" field but got ${ JSON . stringify (
4807+ value
4808+ ) } .`
4809+ ) ;
4810+ isValid = false ;
4811+ }
4812+
4813+ if ( ! isRequiredProperty ( value , "namespace" , "string" ) ) {
4814+ diagnostics . errors . push (
4815+ `"${ field } " bindings must have a string "namespace" field but got ${ JSON . stringify (
4816+ value
4817+ ) } .`
4818+ ) ;
4819+ isValid = false ;
4820+ }
4821+
4822+ validateAdditionalProperties ( diagnostics , field , Object . keys ( value ) , [
4823+ "binding" ,
4824+ "namespace" ,
4825+ "remote" ,
4826+ ] ) ;
4827+
4828+ if ( ! isRemoteValid ( value , field , diagnostics ) ) {
4829+ isValid = false ;
4830+ }
4831+
4832+ return isValid ;
4833+ } ;
4834+
47824835const validateHelloWorldBinding : ValidatorFn = ( diagnostics , field , value ) => {
47834836 if ( typeof value !== "object" || value === null ) {
47844837 diagnostics . errors . push (
@@ -5035,6 +5088,7 @@ const validatePreviewsConfig =
50355088 "media" ,
50365089 "pipelines" ,
50375090 "secrets_store_secrets" ,
5091+ "artifacts" ,
50385092 "unsafe_hello_world" ,
50395093 "worker_loaders" ,
50405094 "ratelimits" ,
@@ -5260,6 +5314,14 @@ const validatePreviewsConfig =
52605314 undefined
52615315 ) && isValid ;
52625316
5317+ isValid =
5318+ validateBindingArray ( envName , validateArtifactsBinding ) (
5319+ diagnostics ,
5320+ `${ field } .artifacts` ,
5321+ previews . artifacts ,
5322+ undefined
5323+ ) && isValid ;
5324+
52635325 isValid =
52645326 validateBindingArray ( envName , validateHelloWorldBinding ) (
52655327 diagnostics ,
0 commit comments