@@ -60,7 +60,7 @@ export function getCacheTag(
6060 | {
6161 tag : 'computed-document' ;
6262 space : string ;
63- integration : string ;
63+ sourceType : string ;
6464 }
6565 /**
6666 * All data related to the URL of a content
@@ -84,6 +84,14 @@ export function getCacheTag(
8484 organization : string ;
8585 openAPISpec : string ;
8686 }
87+ /**
88+ * All data related to a translation
89+ */
90+ | {
91+ tag : 'translation' ;
92+ organization : string ;
93+ translationSettings : string ;
94+ }
8795) : string {
8896 switch ( spec . tag ) {
8997 case 'user' :
@@ -99,13 +107,15 @@ export function getCacheTag(
99107 case 'document' :
100108 return `space:${ spec . space } :document:${ spec . document } ` ;
101109 case 'computed-document' :
102- return `space:${ spec . space } :computed-document:${ spec . integration } ` ;
110+ return `space:${ spec . space } :computed-document:${ spec . sourceType } ` ;
103111 case 'site' :
104112 return `site:${ spec . site } ` ;
105113 case 'integration' :
106114 return `integration:${ spec . integration } ` ;
107115 case 'openapi' :
108116 return `organization:${ spec . organization } :openapi:${ spec . openAPISpec } ` ;
117+ case 'translation' :
118+ return `organization:${ spec . organization } :translation:${ spec . translationSettings } ` ;
109119 default :
110120 assertNever ( spec ) ;
111121 }
@@ -157,6 +167,15 @@ export function getComputedContentSourceCacheTags(
157167 } )
158168 ) ;
159169 break ;
170+ case 'translation-language' :
171+ tags . push (
172+ getCacheTag ( {
173+ tag : 'translation' ,
174+ organization : inContext . organizationId ,
175+ translationSettings : dependency . ref . translationSettings ,
176+ } )
177+ ) ;
178+ break ;
160179 default :
161180 // Do not throw for unknown dependency types
162181 // as it might mean we are lacking behind the API version
@@ -169,18 +188,22 @@ export function getComputedContentSourceCacheTags(
169188 getCacheTag ( {
170189 tag : 'computed-document' ,
171190 space : inContext . spaceId ,
172- integration : source . integration ,
191+ sourceType : source . type ,
173192 } )
174193 ) ;
175194 }
176195
177196 // We invalidate the computed content when a new version of the integration is deployed.
178- tags . push (
179- getCacheTag ( {
180- tag : 'integration' ,
181- integration : source . integration ,
182- } )
183- ) ;
197+
198+ if ( source . type . startsWith ( 'integration:' ) ) {
199+ const integration = source . type . split ( ':' ) [ 1 ] ;
200+ tags . push (
201+ getCacheTag ( {
202+ tag : 'integration' ,
203+ integration,
204+ } )
205+ ) ;
206+ }
184207
185208 return tags ;
186209}
0 commit comments