Add `pipe queries`, which lists every Firestore query a project can issue: scope, collection, path pattern, filters with operators and value types, composites, orderBy, limit, cursors, realtime, aggregation, in-loop, plus a confidence and the reasons it is not exact. Receivers are matched by static type and cloud_firestore library URI, never by name. Queries are followed through chains, local variables (flow-insensitive with two cuts), fields, getters and one level of helper methods with arguments bound. An --adapter-config (YAML or JSON) maps declarative query APIs such as a server-side gateway onto the same schema. Inventory only: no rules, findings or baseline changes. Every emitted name is validated against a safe character set so no source text reaches the output.
32 lines
920 B
Dart
32 lines
920 B
Dart
/// Nothing in this file touches cloud_firestore. Every call below shares a name
|
|
/// with a Firestore query method and must NOT be extracted.
|
|
|
|
class Query {
|
|
Query where(String field, {Object? isEqualTo}) => this;
|
|
Query limit(int n) => this;
|
|
Future<List<Object>> get() async => const [];
|
|
Stream<List<Object>> snapshots() => const Stream.empty();
|
|
}
|
|
|
|
class CollectionReference extends Query {
|
|
CollectionReference collection(String path) => this;
|
|
}
|
|
|
|
class FakeFirestore {
|
|
CollectionReference collection(String path) => CollectionReference();
|
|
}
|
|
|
|
class Limiter {
|
|
List<int> limit(List<int> values, int n) => values.take(n).toList();
|
|
}
|
|
|
|
Future<void> lookalikes(List<int> values) async {
|
|
values.where((value) => value > 2).take(3).toList();
|
|
Limiter().limit(values, 2);
|
|
await FakeFirestore()
|
|
.collection('lookalike')
|
|
.where('a', isEqualTo: 1)
|
|
.limit(2)
|
|
.get();
|
|
Query().snapshots();
|
|
}
|