social components inlay.at
atproto components sdui
86
fork

Configure Feed

Select the types of activity you want to include in your feed.

return validated props

+20 -5
+6 -1
packages/@inlay/render/src/index.ts
··· 280 280 } 281 281 282 282 if (validate) { 283 - await validateProps(type, resolvedProps, component, resolver); 283 + resolvedProps = await validateProps( 284 + type, 285 + resolvedProps, 286 + component, 287 + resolver 288 + ); 284 289 } 285 290 286 291 if (component.body.$type === "at.inlay.component#bodyTemplate") {
+14 -4
packages/@inlay/render/src/validate.ts
··· 18 18 props: Record<string, unknown>, 19 19 component: ComponentRecord, 20 20 resolver: Resolver 21 - ): Promise<void> { 21 + ): Promise<Record<string, unknown>> { 22 + let result: Record<string, unknown> = props; 23 + 22 24 const lex = await resolver.resolveLexicon(type); 23 25 if (lex) { 24 26 let lexicons = lexiconCache.get(type); ··· 26 28 lexicons = await buildLexicons(lex as Record<string, unknown>, resolver); 27 29 lexiconCache.set(type, lexicons); 28 30 } 29 - lexicons.assertValidXrpcInput(type, props); 31 + result = lexicons.assertValidXrpcInput(type, props) as Record< 32 + string, 33 + unknown 34 + >; 30 35 } else if (component.view) { 31 36 // Synthesize validation from view entries (viewPrimitive + viewRecord) 32 37 const { prop: viewProp, accepts } = component.view; ··· 86 91 }, 87 92 } as unknown as LexiconDoc; 88 93 const lexicons = new Lexicons([syntheticLex]); 89 - lexicons.assertValidXrpcInput(type, props); 94 + result = lexicons.assertValidXrpcInput(type, props) as Record< 95 + string, 96 + unknown 97 + >; 90 98 } 91 99 } 92 100 } ··· 109 117 set.add(vr.collection); 110 118 } 111 119 for (const [prop, allowed] of allowedCollections) { 112 - const value = props[prop]; 120 + const value = result[prop]; 113 121 if (typeof value !== "string" || !value.startsWith("at://")) { 114 122 continue; 115 123 } ··· 125 133 } 126 134 } 127 135 } 136 + 137 + return result; 128 138 } 129 139 130 140 // --- Internals ---