frontend-app-api: apply review follow-up cleanup
Tighten a few small follow-up details from review by improving stack traces in permission batching, simplifying synthetic child refs, and making predicate traversal narrowing more direct. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -160,21 +160,17 @@ function extractPredicateKeyNames(
|
||||
if (typeof predicate !== 'object' || predicate === null) {
|
||||
return [];
|
||||
}
|
||||
const obj = predicate as Record<string, unknown>;
|
||||
if (Array.isArray(obj.$all)) {
|
||||
return (obj.$all as FilterPredicate[]).flatMap(p =>
|
||||
extractPredicateKeyNames(p, key),
|
||||
);
|
||||
const typedPredicate = predicate as FilterPredicate & Record<string, unknown>;
|
||||
if ('$all' in typedPredicate && Array.isArray(typedPredicate.$all)) {
|
||||
return typedPredicate.$all.flatMap(p => extractPredicateKeyNames(p, key));
|
||||
}
|
||||
if (Array.isArray(obj.$any)) {
|
||||
return (obj.$any as FilterPredicate[]).flatMap(p =>
|
||||
extractPredicateKeyNames(p, key),
|
||||
);
|
||||
if ('$any' in typedPredicate && Array.isArray(typedPredicate.$any)) {
|
||||
return typedPredicate.$any.flatMap(p => extractPredicateKeyNames(p, key));
|
||||
}
|
||||
if (obj.$not !== undefined) {
|
||||
return extractPredicateKeyNames(obj.$not as FilterPredicate, key);
|
||||
if ('$not' in typedPredicate && typedPredicate.$not !== undefined) {
|
||||
return extractPredicateKeyNames(typedPredicate.$not, key);
|
||||
}
|
||||
const value = obj[key];
|
||||
const value = typedPredicate[key];
|
||||
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
||||
const contains = (value as Record<string, unknown>).$contains;
|
||||
if (typeof contains === 'string') {
|
||||
|
||||
@@ -227,7 +227,7 @@ export function attachThrowingFinalizationChild(tree: AppTree, error: Error) {
|
||||
// bootstrap failures through the normal extension boundary stack.
|
||||
(bootstrapChildNode as AppNode & { instance?: AppNodeInstance }).instance = {
|
||||
getDataRefs() {
|
||||
return [coreExtensionData.reactElement].values();
|
||||
return [coreExtensionData.reactElement];
|
||||
},
|
||||
getData<TValue>(dataRef: ExtensionDataRef<TValue>) {
|
||||
if (dataRef.id === coreExtensionData.reactElement.id) {
|
||||
|
||||
@@ -67,6 +67,6 @@ export class IdentityPermissionApi implements PermissionApi {
|
||||
async authorize(
|
||||
request: AuthorizePermissionRequest,
|
||||
): Promise<AuthorizePermissionResponse> {
|
||||
return this.loader.load(request);
|
||||
return await this.loader.load(request);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user