@@ -60,7 +60,7 @@ export function getCacheTag(
60
60
| {
61
61
tag : 'computed-document' ;
62
62
space : string ;
63
- integration : string ;
63
+ sourceType : string ;
64
64
}
65
65
/**
66
66
* All data related to the URL of a content
@@ -84,6 +84,14 @@ export function getCacheTag(
84
84
organization : string ;
85
85
openAPISpec : string ;
86
86
}
87
+ /**
88
+ * All data related to a translation
89
+ */
90
+ | {
91
+ tag : 'translation' ;
92
+ organization : string ;
93
+ translationSettings : string ;
94
+ }
87
95
) : string {
88
96
switch ( spec . tag ) {
89
97
case 'user' :
@@ -99,13 +107,15 @@ export function getCacheTag(
99
107
case 'document' :
100
108
return `space:${ spec . space } :document:${ spec . document } ` ;
101
109
case 'computed-document' :
102
- return `space:${ spec . space } :computed-document:${ spec . integration } ` ;
110
+ return `space:${ spec . space } :computed-document:${ spec . sourceType } ` ;
103
111
case 'site' :
104
112
return `site:${ spec . site } ` ;
105
113
case 'integration' :
106
114
return `integration:${ spec . integration } ` ;
107
115
case 'openapi' :
108
116
return `organization:${ spec . organization } :openapi:${ spec . openAPISpec } ` ;
117
+ case 'translation' :
118
+ return `organization:${ spec . organization } :translation:${ spec . translationSettings } ` ;
109
119
default :
110
120
assertNever ( spec ) ;
111
121
}
@@ -157,6 +167,15 @@ export function getComputedContentSourceCacheTags(
157
167
} )
158
168
) ;
159
169
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 ;
160
179
default :
161
180
// Do not throw for unknown dependency types
162
181
// as it might mean we are lacking behind the API version
@@ -169,18 +188,22 @@ export function getComputedContentSourceCacheTags(
169
188
getCacheTag ( {
170
189
tag : 'computed-document' ,
171
190
space : inContext . spaceId ,
172
- integration : source . integration ,
191
+ sourceType : source . type ,
173
192
} )
174
193
) ;
175
194
}
176
195
177
196
// 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
+ }
184
207
185
208
return tags ;
186
209
}
0 commit comments