@pyric/ui 0.1.0-alpha.11 → 0.1.0-alpha.13
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.
- package/package.json +5 -4
- package/src/agents/ContextWindowUsage.tsx +514 -0
- package/src/agents/EmptyState.tsx +27 -0
- package/src/agents/Fold.tsx +64 -0
- package/src/agents/Modal.tsx +65 -0
- package/src/agents/PulsingDot.tsx +28 -0
- package/src/agents/inbrowser-agent-usage.d.ts +141 -0
- package/src/agents/index.ts +28 -0
- package/src/auth/authApi.ts +72 -0
- package/src/auth/claims.ts +63 -0
- package/src/auth/components/AuthProviderToggles.tsx +147 -0
- package/src/auth/components/AuthSignInHelper.tsx +197 -0
- package/src/auth/components/AuthUserForm.tsx +328 -0
- package/src/auth/components/AuthUserList.tsx +219 -0
- package/src/auth/components/ClaimsField.tsx +50 -0
- package/src/auth/components/confirmActions.tsx +114 -0
- package/src/auth/controller.ts +173 -0
- package/src/auth/hooks/index.ts +36 -0
- package/src/auth/hooks/useAuthFlowHelper.ts +55 -0
- package/src/auth/hooks/useAuthProviderConfig.ts +139 -0
- package/src/auth/hooks/useAuthUserEditor.ts +76 -0
- package/src/auth/hooks/useAuthUsers.ts +154 -0
- package/src/auth/index.ts +42 -0
- package/src/auth/providers.ts +28 -0
- package/src/auth/reducers/userEditor.ts +186 -0
- package/src/events/components/ActivityActionItems.tsx +136 -0
- package/src/events/components/ActivityGrid.tsx +197 -0
- package/src/events/components/ActivityGridRow.tsx +65 -0
- package/src/events/components/ProposedChangeDiff.tsx +175 -0
- package/src/events/components/format.ts +21 -0
- package/src/events/components/index.ts +17 -0
- package/src/events/digest.ts +630 -0
- package/src/events/hooks/index.ts +9 -0
- package/src/events/hooks/useActivityDigest.ts +42 -0
- package/src/events/hooks/useActivityStream.ts +86 -0
- package/src/events/index.ts +39 -0
- package/src/events/types.ts +152 -0
- package/src/firestore/components/CollectionList.tsx +78 -0
- package/src/firestore/components/DeleteWithConfirm.tsx +88 -0
- package/src/firestore/components/DocumentEditor.tsx +350 -0
- package/src/firestore/components/DocumentList.tsx +217 -0
- package/src/firestore/components/DocumentPreview.tsx +265 -0
- package/src/firestore/components/FieldRenderer.tsx +25 -0
- package/src/firestore/components/QueryBuilder.tsx +181 -0
- package/src/firestore/components/ReferencePicker.tsx +212 -0
- package/src/firestore/components/TreeEntry.tsx +58 -0
- package/src/firestore/components/context.ts +25 -0
- package/src/firestore/fieldEditors/array.tsx +30 -0
- package/src/firestore/fieldEditors/boolean.tsx +39 -0
- package/src/firestore/fieldEditors/bytes.tsx +53 -0
- package/src/firestore/fieldEditors/geopoint.tsx +71 -0
- package/src/firestore/fieldEditors/map.tsx +33 -0
- package/src/firestore/fieldEditors/null.tsx +27 -0
- package/src/firestore/fieldEditors/number.tsx +43 -0
- package/src/firestore/fieldEditors/reference.tsx +87 -0
- package/src/firestore/fieldEditors/registry.ts +45 -0
- package/src/firestore/fieldEditors/string.tsx +33 -0
- package/src/firestore/fieldEditors/timestamp.tsx +75 -0
- package/src/firestore/fieldEditors/types.ts +68 -0
- package/src/firestore/fieldEditors/vector.tsx +142 -0
- package/src/firestore/firestoreApi.ts +86 -0
- package/src/firestore/hooks/coerceError.ts +34 -0
- package/src/firestore/hooks/index.ts +46 -0
- package/src/firestore/hooks/useCollectionList.ts +102 -0
- package/src/firestore/hooks/useDocumentEditor.ts +161 -0
- package/src/firestore/hooks/useDocumentList.ts +242 -0
- package/src/firestore/hooks/useDocumentSubcollections.ts +86 -0
- package/src/firestore/hooks/useFirestoreCollection.ts +51 -0
- package/src/firestore/hooks/useFirestoreDoc.ts +55 -0
- package/src/firestore/hooks/useQueryBuilder.ts +188 -0
- package/src/firestore/hooks/useRecursiveDelete.ts +77 -0
- package/src/firestore/hooks/useReferencePicker.ts +228 -0
- package/src/firestore/import/parseImport.ts +137 -0
- package/src/firestore/index.ts +87 -0
- package/src/firestore/reducers/defaults.ts +38 -0
- package/src/firestore/reducers/documentEditor.ts +239 -0
- package/src/firestore/reducers/tree.ts +140 -0
- package/src/firestore/reducers/types.ts +92 -0
- package/src/firestore/reducers/validation.ts +129 -0
- package/src/firestore/types.ts +231 -0
- package/src/firestore/validation/ids.ts +45 -0
- package/src/firestore/valueEquality.ts +43 -0
- package/src/index.ts +10 -0
- package/src/primitives/Badge.tsx +40 -0
- package/src/primitives/ConfirmDialog.tsx +137 -0
- package/src/primitives/CopyButton.tsx +62 -0
- package/src/primitives/JsonView.tsx +151 -0
- package/src/primitives/SegmentedControl.tsx +72 -0
- package/src/primitives/Toast.tsx +161 -0
- package/src/primitives/VirtualList.tsx +104 -0
- package/src/primitives/hooks/useContainerSize.ts +53 -0
- package/src/primitives/hooks/useUpdateHighlights.ts +109 -0
- package/src/primitives/index.ts +39 -0
- package/src/primitives/useConfirm.tsx +113 -0
- package/src/rtdb/components/RtdbPathBar.tsx +135 -0
- package/src/rtdb/components/RtdbTree.tsx +409 -0
- package/src/rtdb/editor.ts +79 -0
- package/src/rtdb/hooks/useRtdbTree.ts +137 -0
- package/src/rtdb/index.ts +66 -0
- package/src/rtdb/pathInput.ts +47 -0
- package/src/rtdb/reducers/tree.ts +191 -0
- package/src/rtdb/rtdbApi.ts +23 -0
- package/src/rtdb/values.ts +188 -0
- package/src/rules/components/DenialInspector.tsx +227 -0
- package/src/rules/components/format.ts +171 -0
- package/src/rules/components/index.ts +12 -0
- package/src/rules/components/scope.ts +75 -0
- package/src/rules/hooks/index.ts +5 -0
- package/src/rules/hooks/useDenialTrace.ts +100 -0
- package/src/rules/index.ts +24 -0
- package/src/rules/types.ts +91 -0
- package/src/storage/collisionRename.ts +114 -0
- package/src/storage/components/DeleteSelectionWithConfirm.tsx +193 -0
- package/src/storage/components/ObjectBrowser.tsx +219 -0
- package/src/storage/components/ObjectInspector.tsx +169 -0
- package/src/storage/components/PathBreadcrumb.tsx +84 -0
- package/src/storage/components/UploadDropzone.tsx +182 -0
- package/src/storage/folderPlaceholder.ts +40 -0
- package/src/storage/hooks/index.ts +59 -0
- package/src/storage/hooks/useMetadataEditor.ts +329 -0
- package/src/storage/hooks/useObjectUpload.ts +262 -0
- package/src/storage/hooks/usePathState.ts +94 -0
- package/src/storage/hooks/useStorageDelete.ts +195 -0
- package/src/storage/hooks/useStorageList.ts +261 -0
- package/src/storage/hooks/useStorageObject.ts +162 -0
- package/src/storage/hooks/useStorageRulesGate.ts +270 -0
- package/src/storage/hooks/useStorageSelection.ts +90 -0
- package/src/storage/index.ts +59 -0
- package/src/storage/pendingPrefixes.ts +125 -0
- package/src/storage/previews.tsx +120 -0
- package/src/storage/storageApi.ts +54 -0
- package/src/traffic/components/RuleHeatmap.tsx +97 -0
- package/src/traffic/components/TrafficDetail.tsx +160 -0
- package/src/traffic/components/TrafficGroupRow.tsx +91 -0
- package/src/traffic/components/TrafficLineChart.tsx +139 -0
- package/src/traffic/components/TrafficLog.tsx +175 -0
- package/src/traffic/components/TrafficMetricCards.tsx +77 -0
- package/src/traffic/components/TrafficRow.tsx +69 -0
- package/src/traffic/components/TrafficStats.tsx +73 -0
- package/src/traffic/components/TrafficTimeline.tsx +289 -0
- package/src/traffic/components/format.ts +22 -0
- package/src/traffic/components/index.ts +22 -0
- package/src/traffic/hooks/index.ts +60 -0
- package/src/traffic/hooks/useRuleHeatmap.ts +92 -0
- package/src/traffic/hooks/useTrafficBuckets.ts +146 -0
- package/src/traffic/hooks/useTrafficFilter.ts +74 -0
- package/src/traffic/hooks/useTrafficGroups.ts +126 -0
- package/src/traffic/hooks/useTrafficMetrics.ts +250 -0
- package/src/traffic/hooks/useTrafficMonitor.ts +111 -0
- package/src/traffic/hooks/useTrafficStats.ts +77 -0
- package/src/traffic/index.ts +13 -0
- package/src/traffic/types.ts +85 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The traffic domain types. `TrafficEvent` is structurally identical
|
|
3
|
+
* to `pyric/sandbox`'s `RequestEvent` (locked in
|
|
4
|
+
* the design rationale) — but the library defines its
|
|
5
|
+
* own copy so it never imports `pyric/sandbox`. `sandbox.onRequest`
|
|
6
|
+
* is assignable as a `TrafficSource` with zero adapter code; a prod
|
|
7
|
+
* log feed can satisfy the same shape.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type TrafficMethod =
|
|
11
|
+
| 'get'
|
|
12
|
+
| 'list'
|
|
13
|
+
| 'create'
|
|
14
|
+
| 'update'
|
|
15
|
+
| 'set'
|
|
16
|
+
| 'delete'
|
|
17
|
+
| 'remove'
|
|
18
|
+
| 'push'
|
|
19
|
+
| 'listen'
|
|
20
|
+
| 'transaction'
|
|
21
|
+
| (string & {});
|
|
22
|
+
|
|
23
|
+
export type TrafficResult = 'allow' | 'deny' | 'unsupported' | 'error' | 'not-applicable';
|
|
24
|
+
|
|
25
|
+
export type TrafficOrigin = 'user' | 'listener' | 'transaction' | 'batch' | 'admin' | 'system';
|
|
26
|
+
|
|
27
|
+
export interface TrafficAuthState {
|
|
28
|
+
uid: string;
|
|
29
|
+
token?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TrafficResourceState {
|
|
33
|
+
data: unknown;
|
|
34
|
+
exists: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface TrafficMatchedRule {
|
|
38
|
+
ruleIndex: number;
|
|
39
|
+
operations: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TrafficEvent {
|
|
43
|
+
/** Unique per emission. */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Source event kind. Firestore request events omit this in older adapters. */
|
|
46
|
+
kind?: 'request' | 'operation';
|
|
47
|
+
/** Service that emitted the event. Omitted means Firestore. */
|
|
48
|
+
service?: 'firestore' | 'auth' | 'storage' | 'rtdb' | (string & {});
|
|
49
|
+
/** `Date.now()` at op start. */
|
|
50
|
+
at: number;
|
|
51
|
+
/** Simulator eval duration in ms. De-featured in the UI (local
|
|
52
|
+
* simulator) — present for the detail panel only. */
|
|
53
|
+
evalMs?: number;
|
|
54
|
+
/** Canonical service-operation duration. */
|
|
55
|
+
durationMs?: number;
|
|
56
|
+
method: TrafficMethod;
|
|
57
|
+
path: string;
|
|
58
|
+
auth: TrafficAuthState | null;
|
|
59
|
+
result: TrafficResult;
|
|
60
|
+
/** Simulator debug messages — `Rule #N (op) → ALLOW` format. */
|
|
61
|
+
reasons: string[];
|
|
62
|
+
/** Proposed write payload — absent on reads + delete. */
|
|
63
|
+
request?: { data?: unknown; resourceData?: unknown; query?: unknown };
|
|
64
|
+
/** Existing doc state before the write (or the read target). */
|
|
65
|
+
resourceBefore?: TrafficResourceState;
|
|
66
|
+
/** Projected doc state after the write — absent on reads. */
|
|
67
|
+
resourceAfter?: TrafficResourceState;
|
|
68
|
+
/** Parsed from the matched `Rule #N` debug line — absent if none. */
|
|
69
|
+
matchedRule?: TrafficMatchedRule;
|
|
70
|
+
origin: TrafficOrigin;
|
|
71
|
+
/** Shared across ops in one batch or transaction. */
|
|
72
|
+
groupId?: string;
|
|
73
|
+
groupKind?: 'batch' | 'transaction' | (string & {});
|
|
74
|
+
/** For listener re-evals — the originating user op. */
|
|
75
|
+
triggeredBy?: { method: string; path?: string };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A subscription function: register a callback, get back an
|
|
80
|
+
* unsubscribe. `pyric/sandbox`'s `Sandbox.onRequest` matches this
|
|
81
|
+
* signature exactly.
|
|
82
|
+
*/
|
|
83
|
+
export type TrafficSource = (
|
|
84
|
+
cb: (event: TrafficEvent) => void,
|
|
85
|
+
) => () => void;
|