@justmpm/firebase-audit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,657 @@
1
+ import * as z from 'zod';
2
+ import z__default from 'zod';
3
+
4
+ /**
5
+ * firebase-audit — schemas centrais (Zod v4).
6
+ *
7
+ * ProjectModel = evidências + relações, não só entidades.
8
+ * Finding = veredito simples com fingerprint estável para CI.
9
+ * AuditYaml = contrato de intenção (agente sugere, humano aprova).
10
+ */
11
+
12
+ declare const SeveritySchema: z.ZodEnum<{
13
+ ERROR: "ERROR";
14
+ WARNING: "WARNING";
15
+ INFO: "INFO";
16
+ }>;
17
+ declare const ConfidenceSchema: z.ZodEnum<{
18
+ CONFIRMED: "CONFIRMED";
19
+ PROBABLE: "PROBABLE";
20
+ NOT_OBSERVED: "NOT_OBSERVED";
21
+ UNKNOWN: "UNKNOWN";
22
+ }>;
23
+ declare const OperationSchema: z.ZodEnum<{
24
+ read: "read";
25
+ get: "get";
26
+ list: "list";
27
+ create: "create";
28
+ update: "update";
29
+ delete: "delete";
30
+ write: "write";
31
+ }>;
32
+ declare const AccessOriginSchema: z.ZodEnum<{
33
+ UNKNOWN: "UNKNOWN";
34
+ CLIENT: "CLIENT";
35
+ SERVER: "SERVER";
36
+ }>;
37
+ declare const PositionSchema: z.ZodObject<{
38
+ line: z.ZodNumber;
39
+ column: z.ZodNumber;
40
+ }, z.core.$strict>;
41
+ declare const LocationSchema: z.ZodObject<{
42
+ file: z.ZodString;
43
+ start: z.ZodObject<{
44
+ line: z.ZodNumber;
45
+ column: z.ZodNumber;
46
+ }, z.core.$strict>;
47
+ end: z.ZodOptional<z.ZodObject<{
48
+ line: z.ZodNumber;
49
+ column: z.ZodNumber;
50
+ }, z.core.$strict>>;
51
+ }, z.core.$strict>;
52
+ declare const EvidenceSchema: z.ZodObject<{
53
+ id: z.ZodString;
54
+ kind: z.ZodString;
55
+ location: z.ZodOptional<z.ZodObject<{
56
+ file: z.ZodString;
57
+ start: z.ZodObject<{
58
+ line: z.ZodNumber;
59
+ column: z.ZodNumber;
60
+ }, z.core.$strict>;
61
+ end: z.ZodOptional<z.ZodObject<{
62
+ line: z.ZodNumber;
63
+ column: z.ZodNumber;
64
+ }, z.core.$strict>>;
65
+ }, z.core.$strict>>;
66
+ summary: z.ZodString;
67
+ confidence: z.ZodEnum<{
68
+ CONFIRMED: "CONFIRMED";
69
+ PROBABLE: "PROBABLE";
70
+ NOT_OBSERVED: "NOT_OBSERVED";
71
+ UNKNOWN: "UNKNOWN";
72
+ }>;
73
+ value: z.ZodOptional<z.ZodUnknown>;
74
+ fingerprint: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$strict>;
76
+ declare const DynamicValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
77
+ kind: z.ZodLiteral<"literal">;
78
+ value: z.ZodUnknown;
79
+ }, z.core.$strict>, z.ZodObject<{
80
+ kind: z.ZodLiteral<"symbolic">;
81
+ expression: z.ZodString;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ kind: z.ZodLiteral<"unknown">;
84
+ reason: z.ZodString;
85
+ }, z.core.$strict>], "kind">;
86
+ declare const QueryFilterSchema: z.ZodObject<{
87
+ fieldPath: z.ZodString;
88
+ operator: z.ZodEnum<{
89
+ "==": "==";
90
+ "!=": "!=";
91
+ "<": "<";
92
+ "<=": "<=";
93
+ ">": ">";
94
+ ">=": ">=";
95
+ in: "in";
96
+ "not-in": "not-in";
97
+ "array-contains": "array-contains";
98
+ "array-contains-any": "array-contains-any";
99
+ }>;
100
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ kind: z.ZodLiteral<"literal">;
102
+ value: z.ZodUnknown;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ kind: z.ZodLiteral<"symbolic">;
105
+ expression: z.ZodString;
106
+ }, z.core.$strict>, z.ZodObject<{
107
+ kind: z.ZodLiteral<"unknown">;
108
+ reason: z.ZodString;
109
+ }, z.core.$strict>], "kind">;
110
+ }, z.core.$strict>;
111
+ declare const QueryOrderSchema: z.ZodObject<{
112
+ fieldPath: z.ZodString;
113
+ direction: z.ZodEnum<{
114
+ ASCENDING: "ASCENDING";
115
+ DESCENDING: "DESCENDING";
116
+ }>;
117
+ }, z.core.$strict>;
118
+ declare const QueryShapeSchema: z.ZodObject<{
119
+ scope: z.ZodEnum<{
120
+ COLLECTION: "COLLECTION";
121
+ COLLECTION_GROUP: "COLLECTION_GROUP";
122
+ }>;
123
+ collectionId: z.ZodString;
124
+ pathTemplate: z.ZodString;
125
+ filters: z.ZodArray<z.ZodObject<{
126
+ fieldPath: z.ZodString;
127
+ operator: z.ZodEnum<{
128
+ "==": "==";
129
+ "!=": "!=";
130
+ "<": "<";
131
+ "<=": "<=";
132
+ ">": ">";
133
+ ">=": ">=";
134
+ in: "in";
135
+ "not-in": "not-in";
136
+ "array-contains": "array-contains";
137
+ "array-contains-any": "array-contains-any";
138
+ }>;
139
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
140
+ kind: z.ZodLiteral<"literal">;
141
+ value: z.ZodUnknown;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ kind: z.ZodLiteral<"symbolic">;
144
+ expression: z.ZodString;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ kind: z.ZodLiteral<"unknown">;
147
+ reason: z.ZodString;
148
+ }, z.core.$strict>], "kind">;
149
+ }, z.core.$strict>>;
150
+ orderBy: z.ZodArray<z.ZodObject<{
151
+ fieldPath: z.ZodString;
152
+ direction: z.ZodEnum<{
153
+ ASCENDING: "ASCENDING";
154
+ DESCENDING: "DESCENDING";
155
+ }>;
156
+ }, z.core.$strict>>;
157
+ limit: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
158
+ kind: z.ZodLiteral<"literal">;
159
+ value: z.ZodUnknown;
160
+ }, z.core.$strict>, z.ZodObject<{
161
+ kind: z.ZodLiteral<"symbolic">;
162
+ expression: z.ZodString;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"unknown">;
165
+ reason: z.ZodString;
166
+ }, z.core.$strict>], "kind">>;
167
+ dynamic: z.ZodBoolean;
168
+ confidence: z.ZodEnum<{
169
+ CONFIRMED: "CONFIRMED";
170
+ PROBABLE: "PROBABLE";
171
+ NOT_OBSERVED: "NOT_OBSERVED";
172
+ UNKNOWN: "UNKNOWN";
173
+ }>;
174
+ location: z.ZodObject<{
175
+ file: z.ZodString;
176
+ start: z.ZodObject<{
177
+ line: z.ZodNumber;
178
+ column: z.ZodNumber;
179
+ }, z.core.$strict>;
180
+ end: z.ZodOptional<z.ZodObject<{
181
+ line: z.ZodNumber;
182
+ column: z.ZodNumber;
183
+ }, z.core.$strict>>;
184
+ }, z.core.$strict>;
185
+ }, z.core.$strict>;
186
+ declare const PermissionSchema: z.ZodObject<{
187
+ name: z.ZodString;
188
+ resource: z.ZodString;
189
+ operation: z.ZodEnum<{
190
+ read: "read";
191
+ get: "get";
192
+ list: "list";
193
+ create: "create";
194
+ update: "update";
195
+ delete: "delete";
196
+ write: "write";
197
+ }>;
198
+ }, z.core.$strict>;
199
+ declare const RoleSchema: z.ZodObject<{
200
+ name: z.ZodString;
201
+ permissions: z.ZodArray<z.ZodString>;
202
+ }, z.core.$strict>;
203
+ declare const RuleSchema: z.ZodObject<{
204
+ id: z.ZodString;
205
+ path: z.ZodString;
206
+ operations: z.ZodArray<z.ZodEnum<{
207
+ read: "read";
208
+ get: "get";
209
+ list: "list";
210
+ create: "create";
211
+ update: "update";
212
+ delete: "delete";
213
+ write: "write";
214
+ }>>;
215
+ conditionPresent: z.ZodBoolean;
216
+ authReferences: z.ZodArray<z.ZodString>;
217
+ claimReferences: z.ZodArray<z.ZodString>;
218
+ resourceReferences: z.ZodArray<z.ZodString>;
219
+ requestResourceReferences: z.ZodArray<z.ZodString>;
220
+ confidence: z.ZodEnum<{
221
+ CONFIRMED: "CONFIRMED";
222
+ PROBABLE: "PROBABLE";
223
+ NOT_OBSERVED: "NOT_OBSERVED";
224
+ UNKNOWN: "UNKNOWN";
225
+ }>;
226
+ location: z.ZodObject<{
227
+ file: z.ZodString;
228
+ start: z.ZodObject<{
229
+ line: z.ZodNumber;
230
+ column: z.ZodNumber;
231
+ }, z.core.$strict>;
232
+ end: z.ZodOptional<z.ZodObject<{
233
+ line: z.ZodNumber;
234
+ column: z.ZodNumber;
235
+ }, z.core.$strict>>;
236
+ }, z.core.$strict>;
237
+ }, z.core.$strict>;
238
+ declare const IndexFieldSchema: z.ZodObject<{
239
+ fieldPath: z.ZodString;
240
+ mode: z.ZodEnum<{
241
+ ASCENDING: "ASCENDING";
242
+ DESCENDING: "DESCENDING";
243
+ ARRAY_CONTAINS: "ARRAY_CONTAINS";
244
+ VECTOR: "VECTOR";
245
+ }>;
246
+ }, z.core.$strict>;
247
+ declare const FirestoreIndexSchema: z.ZodObject<{
248
+ collectionGroup: z.ZodString;
249
+ queryScope: z.ZodEnum<{
250
+ COLLECTION: "COLLECTION";
251
+ COLLECTION_GROUP: "COLLECTION_GROUP";
252
+ }>;
253
+ fields: z.ZodArray<z.ZodObject<{
254
+ fieldPath: z.ZodString;
255
+ mode: z.ZodEnum<{
256
+ ASCENDING: "ASCENDING";
257
+ DESCENDING: "DESCENDING";
258
+ ARRAY_CONTAINS: "ARRAY_CONTAINS";
259
+ VECTOR: "VECTOR";
260
+ }>;
261
+ }, z.core.$strict>>;
262
+ location: z.ZodOptional<z.ZodObject<{
263
+ file: z.ZodString;
264
+ start: z.ZodObject<{
265
+ line: z.ZodNumber;
266
+ column: z.ZodNumber;
267
+ }, z.core.$strict>;
268
+ end: z.ZodOptional<z.ZodObject<{
269
+ line: z.ZodNumber;
270
+ column: z.ZodNumber;
271
+ }, z.core.$strict>>;
272
+ }, z.core.$strict>>;
273
+ }, z.core.$strict>;
274
+ declare const GraphEdgeSchema: z.ZodObject<{
275
+ from: z.ZodString;
276
+ to: z.ZodString;
277
+ kind: z.ZodEnum<{
278
+ CALLS: "CALLS";
279
+ USES_PERMISSION: "USES_PERMISSION";
280
+ TARGETS_RESOURCE: "TARGETS_RESOURCE";
281
+ GUARDED_BY_RULE: "GUARDED_BY_RULE";
282
+ REQUIRES_INDEX: "REQUIRES_INDEX";
283
+ REFERENCES_ROLE: "REFERENCES_ROLE";
284
+ REFERENCES_CLAIM: "REFERENCES_CLAIM";
285
+ }>;
286
+ confidence: z.ZodEnum<{
287
+ CONFIRMED: "CONFIRMED";
288
+ PROBABLE: "PROBABLE";
289
+ NOT_OBSERVED: "NOT_OBSERVED";
290
+ UNKNOWN: "UNKNOWN";
291
+ }>;
292
+ evidenceIds: z.ZodArray<z.ZodString>;
293
+ }, z.core.$strict>;
294
+ declare const ProjectModelSchema: z.ZodObject<{
295
+ schemaVersion: z.ZodLiteral<1>;
296
+ rootDir: z.ZodString;
297
+ firebase: z.ZodObject<{
298
+ configFile: z.ZodOptional<z.ZodString>;
299
+ projectId: z.ZodNullable<z.ZodString>;
300
+ databaseId: z.ZodNullable<z.ZodString>;
301
+ firestore: z.ZodObject<{
302
+ rulesFile: z.ZodOptional<z.ZodString>;
303
+ indexesFile: z.ZodOptional<z.ZodString>;
304
+ }, z.core.$strict>;
305
+ }, z.core.$strict>;
306
+ authorization: z.ZodObject<{
307
+ adapter: z.ZodNullable<z.ZodString>;
308
+ roles: z.ZodArray<z.ZodObject<{
309
+ name: z.ZodString;
310
+ permissions: z.ZodArray<z.ZodString>;
311
+ }, z.core.$strict>>;
312
+ permissions: z.ZodArray<z.ZodObject<{
313
+ name: z.ZodString;
314
+ resource: z.ZodString;
315
+ operation: z.ZodEnum<{
316
+ read: "read";
317
+ get: "get";
318
+ list: "list";
319
+ create: "create";
320
+ update: "update";
321
+ delete: "delete";
322
+ write: "write";
323
+ }>;
324
+ }, z.core.$strict>>;
325
+ }, z.core.$strict>;
326
+ queries: z.ZodArray<z.ZodObject<{
327
+ scope: z.ZodEnum<{
328
+ COLLECTION: "COLLECTION";
329
+ COLLECTION_GROUP: "COLLECTION_GROUP";
330
+ }>;
331
+ collectionId: z.ZodString;
332
+ pathTemplate: z.ZodString;
333
+ filters: z.ZodArray<z.ZodObject<{
334
+ fieldPath: z.ZodString;
335
+ operator: z.ZodEnum<{
336
+ "==": "==";
337
+ "!=": "!=";
338
+ "<": "<";
339
+ "<=": "<=";
340
+ ">": ">";
341
+ ">=": ">=";
342
+ in: "in";
343
+ "not-in": "not-in";
344
+ "array-contains": "array-contains";
345
+ "array-contains-any": "array-contains-any";
346
+ }>;
347
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
348
+ kind: z.ZodLiteral<"literal">;
349
+ value: z.ZodUnknown;
350
+ }, z.core.$strict>, z.ZodObject<{
351
+ kind: z.ZodLiteral<"symbolic">;
352
+ expression: z.ZodString;
353
+ }, z.core.$strict>, z.ZodObject<{
354
+ kind: z.ZodLiteral<"unknown">;
355
+ reason: z.ZodString;
356
+ }, z.core.$strict>], "kind">;
357
+ }, z.core.$strict>>;
358
+ orderBy: z.ZodArray<z.ZodObject<{
359
+ fieldPath: z.ZodString;
360
+ direction: z.ZodEnum<{
361
+ ASCENDING: "ASCENDING";
362
+ DESCENDING: "DESCENDING";
363
+ }>;
364
+ }, z.core.$strict>>;
365
+ limit: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
366
+ kind: z.ZodLiteral<"literal">;
367
+ value: z.ZodUnknown;
368
+ }, z.core.$strict>, z.ZodObject<{
369
+ kind: z.ZodLiteral<"symbolic">;
370
+ expression: z.ZodString;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ kind: z.ZodLiteral<"unknown">;
373
+ reason: z.ZodString;
374
+ }, z.core.$strict>], "kind">>;
375
+ dynamic: z.ZodBoolean;
376
+ confidence: z.ZodEnum<{
377
+ CONFIRMED: "CONFIRMED";
378
+ PROBABLE: "PROBABLE";
379
+ NOT_OBSERVED: "NOT_OBSERVED";
380
+ UNKNOWN: "UNKNOWN";
381
+ }>;
382
+ location: z.ZodObject<{
383
+ file: z.ZodString;
384
+ start: z.ZodObject<{
385
+ line: z.ZodNumber;
386
+ column: z.ZodNumber;
387
+ }, z.core.$strict>;
388
+ end: z.ZodOptional<z.ZodObject<{
389
+ line: z.ZodNumber;
390
+ column: z.ZodNumber;
391
+ }, z.core.$strict>>;
392
+ }, z.core.$strict>;
393
+ }, z.core.$strict>>;
394
+ rules: z.ZodArray<z.ZodObject<{
395
+ id: z.ZodString;
396
+ path: z.ZodString;
397
+ operations: z.ZodArray<z.ZodEnum<{
398
+ read: "read";
399
+ get: "get";
400
+ list: "list";
401
+ create: "create";
402
+ update: "update";
403
+ delete: "delete";
404
+ write: "write";
405
+ }>>;
406
+ conditionPresent: z.ZodBoolean;
407
+ authReferences: z.ZodArray<z.ZodString>;
408
+ claimReferences: z.ZodArray<z.ZodString>;
409
+ resourceReferences: z.ZodArray<z.ZodString>;
410
+ requestResourceReferences: z.ZodArray<z.ZodString>;
411
+ confidence: z.ZodEnum<{
412
+ CONFIRMED: "CONFIRMED";
413
+ PROBABLE: "PROBABLE";
414
+ NOT_OBSERVED: "NOT_OBSERVED";
415
+ UNKNOWN: "UNKNOWN";
416
+ }>;
417
+ location: z.ZodObject<{
418
+ file: z.ZodString;
419
+ start: z.ZodObject<{
420
+ line: z.ZodNumber;
421
+ column: z.ZodNumber;
422
+ }, z.core.$strict>;
423
+ end: z.ZodOptional<z.ZodObject<{
424
+ line: z.ZodNumber;
425
+ column: z.ZodNumber;
426
+ }, z.core.$strict>>;
427
+ }, z.core.$strict>;
428
+ }, z.core.$strict>>;
429
+ indexes: z.ZodArray<z.ZodObject<{
430
+ collectionGroup: z.ZodString;
431
+ queryScope: z.ZodEnum<{
432
+ COLLECTION: "COLLECTION";
433
+ COLLECTION_GROUP: "COLLECTION_GROUP";
434
+ }>;
435
+ fields: z.ZodArray<z.ZodObject<{
436
+ fieldPath: z.ZodString;
437
+ mode: z.ZodEnum<{
438
+ ASCENDING: "ASCENDING";
439
+ DESCENDING: "DESCENDING";
440
+ ARRAY_CONTAINS: "ARRAY_CONTAINS";
441
+ VECTOR: "VECTOR";
442
+ }>;
443
+ }, z.core.$strict>>;
444
+ location: z.ZodOptional<z.ZodObject<{
445
+ file: z.ZodString;
446
+ start: z.ZodObject<{
447
+ line: z.ZodNumber;
448
+ column: z.ZodNumber;
449
+ }, z.core.$strict>;
450
+ end: z.ZodOptional<z.ZodObject<{
451
+ line: z.ZodNumber;
452
+ column: z.ZodNumber;
453
+ }, z.core.$strict>>;
454
+ }, z.core.$strict>>;
455
+ }, z.core.$strict>>;
456
+ evidence: z.ZodArray<z.ZodObject<{
457
+ id: z.ZodString;
458
+ kind: z.ZodString;
459
+ location: z.ZodOptional<z.ZodObject<{
460
+ file: z.ZodString;
461
+ start: z.ZodObject<{
462
+ line: z.ZodNumber;
463
+ column: z.ZodNumber;
464
+ }, z.core.$strict>;
465
+ end: z.ZodOptional<z.ZodObject<{
466
+ line: z.ZodNumber;
467
+ column: z.ZodNumber;
468
+ }, z.core.$strict>>;
469
+ }, z.core.$strict>>;
470
+ summary: z.ZodString;
471
+ confidence: z.ZodEnum<{
472
+ CONFIRMED: "CONFIRMED";
473
+ PROBABLE: "PROBABLE";
474
+ NOT_OBSERVED: "NOT_OBSERVED";
475
+ UNKNOWN: "UNKNOWN";
476
+ }>;
477
+ value: z.ZodOptional<z.ZodUnknown>;
478
+ fingerprint: z.ZodOptional<z.ZodString>;
479
+ }, z.core.$strict>>;
480
+ graph: z.ZodArray<z.ZodObject<{
481
+ from: z.ZodString;
482
+ to: z.ZodString;
483
+ kind: z.ZodEnum<{
484
+ CALLS: "CALLS";
485
+ USES_PERMISSION: "USES_PERMISSION";
486
+ TARGETS_RESOURCE: "TARGETS_RESOURCE";
487
+ GUARDED_BY_RULE: "GUARDED_BY_RULE";
488
+ REQUIRES_INDEX: "REQUIRES_INDEX";
489
+ REFERENCES_ROLE: "REFERENCES_ROLE";
490
+ REFERENCES_CLAIM: "REFERENCES_CLAIM";
491
+ }>;
492
+ confidence: z.ZodEnum<{
493
+ CONFIRMED: "CONFIRMED";
494
+ PROBABLE: "PROBABLE";
495
+ NOT_OBSERVED: "NOT_OBSERVED";
496
+ UNKNOWN: "UNKNOWN";
497
+ }>;
498
+ evidenceIds: z.ZodArray<z.ZodString>;
499
+ }, z.core.$strict>>;
500
+ }, z.core.$strict>;
501
+ declare const FindingSchema: z.ZodObject<{
502
+ rule: z.ZodString;
503
+ severity: z.ZodEnum<{
504
+ ERROR: "ERROR";
505
+ WARNING: "WARNING";
506
+ INFO: "INFO";
507
+ }>;
508
+ confidence: z.ZodEnum<{
509
+ CONFIRMED: "CONFIRMED";
510
+ PROBABLE: "PROBABLE";
511
+ NOT_OBSERVED: "NOT_OBSERVED";
512
+ UNKNOWN: "UNKNOWN";
513
+ }>;
514
+ file: z.ZodOptional<z.ZodString>;
515
+ line: z.ZodOptional<z.ZodNumber>;
516
+ message: z.ZodString;
517
+ evidence: z.ZodArray<z.ZodObject<{
518
+ id: z.ZodString;
519
+ kind: z.ZodString;
520
+ location: z.ZodOptional<z.ZodObject<{
521
+ file: z.ZodString;
522
+ start: z.ZodObject<{
523
+ line: z.ZodNumber;
524
+ column: z.ZodNumber;
525
+ }, z.core.$strict>;
526
+ end: z.ZodOptional<z.ZodObject<{
527
+ line: z.ZodNumber;
528
+ column: z.ZodNumber;
529
+ }, z.core.$strict>>;
530
+ }, z.core.$strict>>;
531
+ summary: z.ZodString;
532
+ confidence: z.ZodEnum<{
533
+ CONFIRMED: "CONFIRMED";
534
+ PROBABLE: "PROBABLE";
535
+ NOT_OBSERVED: "NOT_OBSERVED";
536
+ UNKNOWN: "UNKNOWN";
537
+ }>;
538
+ value: z.ZodOptional<z.ZodUnknown>;
539
+ fingerprint: z.ZodOptional<z.ZodString>;
540
+ }, z.core.$strict>>;
541
+ fix: z.ZodOptional<z.ZodString>;
542
+ resource: z.ZodOptional<z.ZodString>;
543
+ operation: z.ZodOptional<z.ZodEnum<{
544
+ read: "read";
545
+ get: "get";
546
+ list: "list";
547
+ create: "create";
548
+ update: "update";
549
+ delete: "delete";
550
+ write: "write";
551
+ }>>;
552
+ fingerprint: z.ZodString;
553
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
554
+ }, z.core.$strict>;
555
+ declare const AuditYamlSchema: z.ZodObject<{
556
+ authorization: z.ZodObject<{
557
+ adapter: z.ZodOptional<z.ZodObject<{
558
+ function: z.ZodString;
559
+ }, z.core.$strict>>;
560
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
561
+ permissions: z.ZodArray<z.ZodString>;
562
+ }, z.core.$strict>>;
563
+ permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
564
+ resource: z.ZodString;
565
+ operation: z.ZodEnum<{
566
+ read: "read";
567
+ get: "get";
568
+ list: "list";
569
+ create: "create";
570
+ update: "update";
571
+ delete: "delete";
572
+ write: "write";
573
+ }>;
574
+ }, z.core.$strict>>;
575
+ claims: z.ZodOptional<z.ZodObject<{
576
+ enabled: z.ZodBoolean;
577
+ roleKey: z.ZodString;
578
+ samples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
579
+ }, z.core.$strict>>;
580
+ }, z.core.$strict>;
581
+ }, z.core.$strict>;
582
+ type ProjectModel = z.infer<typeof ProjectModelSchema>;
583
+ type Finding = z.infer<typeof FindingSchema>;
584
+ type AuditYaml = z.infer<typeof AuditYamlSchema>;
585
+ type Evidence = z.infer<typeof EvidenceSchema>;
586
+ type QueryShape = z.infer<typeof QueryShapeSchema>;
587
+
588
+ /**
589
+ * Discovery — acha arquivos Firebase + classifica CLIENT/SERVER.
590
+ * Usa ai-tool como biblioteca (grafo + find), nunca via spawn/MCP.
591
+ */
592
+
593
+ interface DiscoveryResult {
594
+ rootDir: string;
595
+ firebaseJson: string | null;
596
+ firestoreRulesFile: string | null;
597
+ firestoreIndexesFile: string | null;
598
+ auditYamlFile: string | null;
599
+ projectId: string | null;
600
+ databaseId: string | null;
601
+ clientFiles: string[];
602
+ serverFiles: string[];
603
+ }
604
+ declare function discover(rootDir: string): DiscoveryResult;
605
+ /** Heurística simples CLIENT vs SERVER por caminho + import admin. */
606
+ declare function classifyOrigin(file: string, content: string): "CLIENT" | "SERVER" | "UNKNOWN";
607
+ declare function emptyModel(rootDir: string, d: DiscoveryResult): ProjectModel;
608
+
609
+ /**
610
+ * Rules extractor — estrutura + referências + locations (sem avaliar).
611
+ * Parser leve e intencionalmente incompleto: avaliação real é do Emulator (V3).
612
+ */
613
+
614
+ type Rule = z__default.infer<typeof RuleSchema>;
615
+ declare function extractRules(rulesFile: string, relFile: string): Rule[];
616
+ /** Detecta allow ... if true preservando linha para FBA001/FBA002. */
617
+ declare function findPublicAllows(rulesFile: string): {
618
+ line: number;
619
+ target: string;
620
+ }[];
621
+
622
+ /**
623
+ * Checks estáticos V1 (FBA001–FBA010, subconjunto intencional).
624
+ * Cada check retorna Findings com fingerprint estável para CI.
625
+ */
626
+
627
+ declare function runChecks(model: ProjectModel, rootDir: string, opts?: {
628
+ adapterFn?: string;
629
+ }): Promise<Finding[]>;
630
+
631
+ /**
632
+ * scan — orquestra Discovery → Rules → Checks (V1 static-first).
633
+ */
634
+
635
+ interface ScanOptions {
636
+ adapterFn?: string;
637
+ strict?: boolean;
638
+ }
639
+ interface ScanResult {
640
+ model: ProjectModel;
641
+ findings: Finding[];
642
+ summary: {
643
+ errors: number;
644
+ warnings: number;
645
+ infos: number;
646
+ passed: number;
647
+ };
648
+ }
649
+ declare function scan(rootDir: string, opts?: ScanOptions): Promise<ScanResult>;
650
+
651
+ /**
652
+ * firebase-audit — entry point como biblioteca.
653
+ */
654
+
655
+ declare const VERSION: string;
656
+
657
+ export { AccessOriginSchema, type AuditYaml, AuditYamlSchema, ConfidenceSchema, type DiscoveryResult, DynamicValueSchema, type Evidence, EvidenceSchema, type Finding, FindingSchema, FirestoreIndexSchema, GraphEdgeSchema, IndexFieldSchema, LocationSchema, OperationSchema, PermissionSchema, PositionSchema, type ProjectModel, ProjectModelSchema, QueryFilterSchema, QueryOrderSchema, type QueryShape, QueryShapeSchema, RoleSchema, RuleSchema, SeveritySchema, VERSION, classifyOrigin, discover, emptyModel, extractRules, findPublicAllows, runChecks, scan };