@pyric/ui 0.1.0-alpha.10
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/LICENSE +216 -0
- package/README.md +79 -0
- package/dist/agents/ContextWindowUsage.d.ts +67 -0
- package/dist/agents/ContextWindowUsage.d.ts.map +1 -0
- package/dist/agents/ContextWindowUsage.js +115 -0
- package/dist/agents/ContextWindowUsage.js.map +1 -0
- package/dist/agents/EmptyState.d.ts +18 -0
- package/dist/agents/EmptyState.d.ts.map +1 -0
- package/dist/agents/EmptyState.js +11 -0
- package/dist/agents/EmptyState.js.map +1 -0
- package/dist/agents/Fold.d.ts +37 -0
- package/dist/agents/Fold.d.ts.map +1 -0
- package/dist/agents/Fold.js +18 -0
- package/dist/agents/Fold.js.map +1 -0
- package/dist/agents/Modal.d.ts +25 -0
- package/dist/agents/Modal.d.ts.map +1 -0
- package/dist/agents/Modal.js +28 -0
- package/dist/agents/Modal.js.map +1 -0
- package/dist/agents/PulsingDot.d.ts +21 -0
- package/dist/agents/PulsingDot.d.ts.map +1 -0
- package/dist/agents/PulsingDot.js +18 -0
- package/dist/agents/PulsingDot.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +15 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/auth/authApi.d.ts +32 -0
- package/dist/auth/authApi.d.ts.map +1 -0
- package/dist/auth/authApi.js +27 -0
- package/dist/auth/authApi.js.map +1 -0
- package/dist/auth/claims.d.ts +27 -0
- package/dist/auth/claims.d.ts.map +1 -0
- package/dist/auth/claims.js +58 -0
- package/dist/auth/claims.js.map +1 -0
- package/dist/auth/components/AuthProviderToggles.d.ts +31 -0
- package/dist/auth/components/AuthProviderToggles.d.ts.map +1 -0
- package/dist/auth/components/AuthProviderToggles.js +48 -0
- package/dist/auth/components/AuthProviderToggles.js.map +1 -0
- package/dist/auth/components/AuthSignInHelper.d.ts +57 -0
- package/dist/auth/components/AuthSignInHelper.d.ts.map +1 -0
- package/dist/auth/components/AuthSignInHelper.js +69 -0
- package/dist/auth/components/AuthSignInHelper.js.map +1 -0
- package/dist/auth/components/AuthUserForm.d.ts +84 -0
- package/dist/auth/components/AuthUserForm.d.ts.map +1 -0
- package/dist/auth/components/AuthUserForm.js +89 -0
- package/dist/auth/components/AuthUserForm.js.map +1 -0
- package/dist/auth/components/AuthUserList.d.ts +62 -0
- package/dist/auth/components/AuthUserList.d.ts.map +1 -0
- package/dist/auth/components/AuthUserList.js +46 -0
- package/dist/auth/components/AuthUserList.js.map +1 -0
- package/dist/auth/components/ClaimsField.d.ts +22 -0
- package/dist/auth/components/ClaimsField.d.ts.map +1 -0
- package/dist/auth/components/ClaimsField.js +11 -0
- package/dist/auth/components/ClaimsField.js.map +1 -0
- package/dist/auth/components/confirmActions.d.ts +40 -0
- package/dist/auth/components/confirmActions.d.ts.map +1 -0
- package/dist/auth/components/confirmActions.js +49 -0
- package/dist/auth/components/confirmActions.js.map +1 -0
- package/dist/auth/controller.d.ts +73 -0
- package/dist/auth/controller.d.ts.map +1 -0
- package/dist/auth/controller.js +139 -0
- package/dist/auth/controller.js.map +1 -0
- package/dist/auth/hooks/index.d.ts +7 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +7 -0
- package/dist/auth/hooks/index.js.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.js +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.js.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts +37 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.js +98 -0
- package/dist/auth/hooks/useAuthProviderConfig.js.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts +30 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.js +27 -0
- package/dist/auth/hooks/useAuthUserEditor.js.map +1 -0
- package/dist/auth/hooks/useAuthUsers.d.ts +38 -0
- package/dist/auth/hooks/useAuthUsers.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUsers.js +111 -0
- package/dist/auth/hooks/useAuthUsers.js.map +1 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/providers.d.ts +11 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +28 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/reducers/userEditor.d.ts +55 -0
- package/dist/auth/reducers/userEditor.d.ts.map +1 -0
- package/dist/auth/reducers/userEditor.js +136 -0
- package/dist/auth/reducers/userEditor.js.map +1 -0
- package/dist/events/components/ActivityActionItems.d.ts +45 -0
- package/dist/events/components/ActivityActionItems.d.ts.map +1 -0
- package/dist/events/components/ActivityActionItems.js +68 -0
- package/dist/events/components/ActivityActionItems.js.map +1 -0
- package/dist/events/components/ActivityGrid.d.ts +65 -0
- package/dist/events/components/ActivityGrid.d.ts.map +1 -0
- package/dist/events/components/ActivityGrid.js +61 -0
- package/dist/events/components/ActivityGrid.js.map +1 -0
- package/dist/events/components/ActivityGridRow.d.ts +31 -0
- package/dist/events/components/ActivityGridRow.d.ts.map +1 -0
- package/dist/events/components/ActivityGridRow.js +23 -0
- package/dist/events/components/ActivityGridRow.js.map +1 -0
- package/dist/events/components/ProposedChangeDiff.d.ts +46 -0
- package/dist/events/components/ProposedChangeDiff.d.ts.map +1 -0
- package/dist/events/components/ProposedChangeDiff.js +60 -0
- package/dist/events/components/ProposedChangeDiff.js.map +1 -0
- package/dist/events/components/format.d.ts +11 -0
- package/dist/events/components/format.d.ts.map +1 -0
- package/dist/events/components/format.js +26 -0
- package/dist/events/components/format.js.map +1 -0
- package/dist/events/components/index.d.ts +6 -0
- package/dist/events/components/index.d.ts.map +1 -0
- package/dist/events/components/index.js +6 -0
- package/dist/events/components/index.js.map +1 -0
- package/dist/events/digest.d.ts +167 -0
- package/dist/events/digest.d.ts.map +1 -0
- package/dist/events/digest.js +426 -0
- package/dist/events/digest.js.map +1 -0
- package/dist/events/hooks/index.d.ts +3 -0
- package/dist/events/hooks/index.d.ts.map +1 -0
- package/dist/events/hooks/index.js +3 -0
- package/dist/events/hooks/index.js.map +1 -0
- package/dist/events/hooks/useActivityDigest.d.ts +27 -0
- package/dist/events/hooks/useActivityDigest.d.ts.map +1 -0
- package/dist/events/hooks/useActivityDigest.js +18 -0
- package/dist/events/hooks/useActivityDigest.js.map +1 -0
- package/dist/events/hooks/useActivityStream.d.ts +44 -0
- package/dist/events/hooks/useActivityStream.d.ts.map +1 -0
- package/dist/events/hooks/useActivityStream.js +38 -0
- package/dist/events/hooks/useActivityStream.js.map +1 -0
- package/dist/events/index.d.ts +15 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +14 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +160 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +21 -0
- package/dist/events/types.js.map +1 -0
- package/dist/firestore/components/CollectionList.d.ts +22 -0
- package/dist/firestore/components/CollectionList.d.ts.map +1 -0
- package/dist/firestore/components/CollectionList.js +21 -0
- package/dist/firestore/components/CollectionList.js.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts +38 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.js +33 -0
- package/dist/firestore/components/DeleteWithConfirm.js.map +1 -0
- package/dist/firestore/components/DocumentEditor.d.ts +47 -0
- package/dist/firestore/components/DocumentEditor.d.ts.map +1 -0
- package/dist/firestore/components/DocumentEditor.js +176 -0
- package/dist/firestore/components/DocumentEditor.js.map +1 -0
- package/dist/firestore/components/DocumentList.d.ts +63 -0
- package/dist/firestore/components/DocumentList.d.ts.map +1 -0
- package/dist/firestore/components/DocumentList.js +53 -0
- package/dist/firestore/components/DocumentList.js.map +1 -0
- package/dist/firestore/components/DocumentPreview.d.ts +68 -0
- package/dist/firestore/components/DocumentPreview.d.ts.map +1 -0
- package/dist/firestore/components/DocumentPreview.js +76 -0
- package/dist/firestore/components/DocumentPreview.js.map +1 -0
- package/dist/firestore/components/FieldRenderer.d.ts +17 -0
- package/dist/firestore/components/FieldRenderer.d.ts.map +1 -0
- package/dist/firestore/components/FieldRenderer.js +16 -0
- package/dist/firestore/components/FieldRenderer.js.map +1 -0
- package/dist/firestore/components/QueryBuilder.d.ts +25 -0
- package/dist/firestore/components/QueryBuilder.d.ts.map +1 -0
- package/dist/firestore/components/QueryBuilder.js +78 -0
- package/dist/firestore/components/QueryBuilder.js.map +1 -0
- package/dist/firestore/components/ReferencePicker.d.ts +33 -0
- package/dist/firestore/components/ReferencePicker.d.ts.map +1 -0
- package/dist/firestore/components/ReferencePicker.js +42 -0
- package/dist/firestore/components/ReferencePicker.js.map +1 -0
- package/dist/firestore/components/TreeEntry.d.ts +15 -0
- package/dist/firestore/components/TreeEntry.d.ts.map +1 -0
- package/dist/firestore/components/TreeEntry.js +23 -0
- package/dist/firestore/components/TreeEntry.js.map +1 -0
- package/dist/firestore/components/context.d.ts +18 -0
- package/dist/firestore/components/context.d.ts.map +1 -0
- package/dist/firestore/components/context.js +7 -0
- package/dist/firestore/components/context.js.map +1 -0
- package/dist/firestore/fieldEditors/array.d.ts +3 -0
- package/dist/firestore/fieldEditors/array.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/array.js +16 -0
- package/dist/firestore/fieldEditors/array.js.map +1 -0
- package/dist/firestore/fieldEditors/boolean.d.ts +3 -0
- package/dist/firestore/fieldEditors/boolean.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/boolean.js +13 -0
- package/dist/firestore/fieldEditors/boolean.js.map +1 -0
- package/dist/firestore/fieldEditors/bytes.d.ts +4 -0
- package/dist/firestore/fieldEditors/bytes.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/bytes.js +31 -0
- package/dist/firestore/fieldEditors/bytes.js.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts +4 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.js +32 -0
- package/dist/firestore/fieldEditors/geopoint.js.map +1 -0
- package/dist/firestore/fieldEditors/map.d.ts +3 -0
- package/dist/firestore/fieldEditors/map.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/map.js +19 -0
- package/dist/firestore/fieldEditors/map.js.map +1 -0
- package/dist/firestore/fieldEditors/null.d.ts +3 -0
- package/dist/firestore/fieldEditors/null.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/null.js +17 -0
- package/dist/firestore/fieldEditors/null.js.map +1 -0
- package/dist/firestore/fieldEditors/number.d.ts +3 -0
- package/dist/firestore/fieldEditors/number.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/number.js +24 -0
- package/dist/firestore/fieldEditors/number.js.map +1 -0
- package/dist/firestore/fieldEditors/reference.d.ts +4 -0
- package/dist/firestore/fieldEditors/reference.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/reference.js +49 -0
- package/dist/firestore/fieldEditors/reference.js.map +1 -0
- package/dist/firestore/fieldEditors/registry.d.ts +16 -0
- package/dist/firestore/fieldEditors/registry.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/registry.js +42 -0
- package/dist/firestore/fieldEditors/registry.js.map +1 -0
- package/dist/firestore/fieldEditors/string.d.ts +3 -0
- package/dist/firestore/fieldEditors/string.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/string.js +13 -0
- package/dist/firestore/fieldEditors/string.js.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts +4 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.js +52 -0
- package/dist/firestore/fieldEditors/timestamp.js.map +1 -0
- package/dist/firestore/fieldEditors/types.d.ts +64 -0
- package/dist/firestore/fieldEditors/types.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/types.js +2 -0
- package/dist/firestore/fieldEditors/types.js.map +1 -0
- package/dist/firestore/fieldEditors/vector.d.ts +29 -0
- package/dist/firestore/fieldEditors/vector.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/vector.js +93 -0
- package/dist/firestore/fieldEditors/vector.js.map +1 -0
- package/dist/firestore/firestoreApi.d.ts +35 -0
- package/dist/firestore/firestoreApi.d.ts.map +1 -0
- package/dist/firestore/firestoreApi.js +29 -0
- package/dist/firestore/firestoreApi.js.map +1 -0
- package/dist/firestore/hooks/coerceError.d.ts +17 -0
- package/dist/firestore/hooks/coerceError.d.ts.map +1 -0
- package/dist/firestore/hooks/coerceError.js +41 -0
- package/dist/firestore/hooks/coerceError.js.map +1 -0
- package/dist/firestore/hooks/index.d.ts +10 -0
- package/dist/firestore/hooks/index.d.ts.map +1 -0
- package/dist/firestore/hooks/index.js +10 -0
- package/dist/firestore/hooks/index.js.map +1 -0
- package/dist/firestore/hooks/useCollectionList.d.ts +37 -0
- package/dist/firestore/hooks/useCollectionList.d.ts.map +1 -0
- package/dist/firestore/hooks/useCollectionList.js +51 -0
- package/dist/firestore/hooks/useCollectionList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts +61 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.js +71 -0
- package/dist/firestore/hooks/useDocumentEditor.js.map +1 -0
- package/dist/firestore/hooks/useDocumentList.d.ts +50 -0
- package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentList.js +162 -0
- package/dist/firestore/hooks/useDocumentList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts +29 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js +48 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts +14 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.js +36 -0
- package/dist/firestore/hooks/useFirestoreCollection.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts +17 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.js +35 -0
- package/dist/firestore/hooks/useFirestoreDoc.js.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts +51 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.js +110 -0
- package/dist/firestore/hooks/useQueryBuilder.js.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts +40 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.js +44 -0
- package/dist/firestore/hooks/useRecursiveDelete.js.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts +70 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.js +140 -0
- package/dist/firestore/hooks/useReferencePicker.js.map +1 -0
- package/dist/firestore/import/parseImport.d.ts +55 -0
- package/dist/firestore/import/parseImport.d.ts.map +1 -0
- package/dist/firestore/import/parseImport.js +101 -0
- package/dist/firestore/import/parseImport.js.map +1 -0
- package/dist/firestore/index.d.ts +21 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +29 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/reducers/defaults.d.ts +10 -0
- package/dist/firestore/reducers/defaults.d.ts.map +1 -0
- package/dist/firestore/reducers/defaults.js +37 -0
- package/dist/firestore/reducers/defaults.js.map +1 -0
- package/dist/firestore/reducers/documentEditor.d.ts +23 -0
- package/dist/firestore/reducers/documentEditor.d.ts.map +1 -0
- package/dist/firestore/reducers/documentEditor.js +201 -0
- package/dist/firestore/reducers/documentEditor.js.map +1 -0
- package/dist/firestore/reducers/tree.d.ts +28 -0
- package/dist/firestore/reducers/tree.d.ts.map +1 -0
- package/dist/firestore/reducers/tree.js +129 -0
- package/dist/firestore/reducers/tree.js.map +1 -0
- package/dist/firestore/reducers/types.d.ts +115 -0
- package/dist/firestore/reducers/types.d.ts.map +1 -0
- package/dist/firestore/reducers/types.js +2 -0
- package/dist/firestore/reducers/types.js.map +1 -0
- package/dist/firestore/reducers/validation.d.ts +25 -0
- package/dist/firestore/reducers/validation.d.ts.map +1 -0
- package/dist/firestore/reducers/validation.js +121 -0
- package/dist/firestore/reducers/validation.js.map +1 -0
- package/dist/firestore/types.d.ts +77 -0
- package/dist/firestore/types.d.ts.map +1 -0
- package/dist/firestore/types.js +196 -0
- package/dist/firestore/types.js.map +1 -0
- package/dist/firestore/validation/ids.d.ts +23 -0
- package/dist/firestore/validation/ids.d.ts.map +1 -0
- package/dist/firestore/validation/ids.js +46 -0
- package/dist/firestore/validation/ids.js.map +1 -0
- package/dist/firestore/valueEquality.d.ts +4 -0
- package/dist/firestore/valueEquality.d.ts.map +1 -0
- package/dist/firestore/valueEquality.js +44 -0
- package/dist/firestore/valueEquality.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/Badge.d.ts +28 -0
- package/dist/primitives/Badge.d.ts.map +1 -0
- package/dist/primitives/Badge.js +11 -0
- package/dist/primitives/Badge.js.map +1 -0
- package/dist/primitives/ConfirmDialog.d.ts +42 -0
- package/dist/primitives/ConfirmDialog.d.ts.map +1 -0
- package/dist/primitives/ConfirmDialog.js +61 -0
- package/dist/primitives/ConfirmDialog.js.map +1 -0
- package/dist/primitives/CopyButton.d.ts +28 -0
- package/dist/primitives/CopyButton.d.ts.map +1 -0
- package/dist/primitives/CopyButton.js +27 -0
- package/dist/primitives/CopyButton.js.map +1 -0
- package/dist/primitives/JsonView.d.ts +29 -0
- package/dist/primitives/JsonView.d.ts.map +1 -0
- package/dist/primitives/JsonView.js +56 -0
- package/dist/primitives/JsonView.js.map +1 -0
- package/dist/primitives/SegmentedControl.d.ts +37 -0
- package/dist/primitives/SegmentedControl.d.ts.map +1 -0
- package/dist/primitives/SegmentedControl.js +18 -0
- package/dist/primitives/SegmentedControl.js.map +1 -0
- package/dist/primitives/Toast.d.ts +48 -0
- package/dist/primitives/Toast.d.ts.map +1 -0
- package/dist/primitives/Toast.js +60 -0
- package/dist/primitives/Toast.js.map +1 -0
- package/dist/primitives/VirtualList.d.ts +37 -0
- package/dist/primitives/VirtualList.d.ts.map +1 -0
- package/dist/primitives/VirtualList.js +47 -0
- package/dist/primitives/VirtualList.js.map +1 -0
- package/dist/primitives/hooks/useContainerSize.d.ts +29 -0
- package/dist/primitives/hooks/useContainerSize.d.ts.map +1 -0
- package/dist/primitives/hooks/useContainerSize.js +45 -0
- package/dist/primitives/hooks/useContainerSize.js.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts +18 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.js +84 -0
- package/dist/primitives/hooks/useUpdateHighlights.js.map +1 -0
- package/dist/primitives/index.d.ts +11 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +11 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/useConfirm.d.ts +34 -0
- package/dist/primitives/useConfirm.d.ts.map +1 -0
- package/dist/primitives/useConfirm.js +63 -0
- package/dist/primitives/useConfirm.js.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts +31 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.js +47 -0
- package/dist/rtdb/components/RtdbPathBar.js.map +1 -0
- package/dist/rtdb/components/RtdbTree.d.ts +38 -0
- package/dist/rtdb/components/RtdbTree.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbTree.js +104 -0
- package/dist/rtdb/components/RtdbTree.js.map +1 -0
- package/dist/rtdb/editor.d.ts +25 -0
- package/dist/rtdb/editor.d.ts.map +1 -0
- package/dist/rtdb/editor.js +79 -0
- package/dist/rtdb/editor.js.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts +33 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.js +67 -0
- package/dist/rtdb/hooks/useRtdbTree.js.map +1 -0
- package/dist/rtdb/index.d.ts +17 -0
- package/dist/rtdb/index.d.ts.map +1 -0
- package/dist/rtdb/index.js +21 -0
- package/dist/rtdb/index.js.map +1 -0
- package/dist/rtdb/pathInput.d.ts +28 -0
- package/dist/rtdb/pathInput.d.ts.map +1 -0
- package/dist/rtdb/pathInput.js +40 -0
- package/dist/rtdb/pathInput.js.map +1 -0
- package/dist/rtdb/reducers/tree.d.ts +86 -0
- package/dist/rtdb/reducers/tree.d.ts.map +1 -0
- package/dist/rtdb/reducers/tree.js +131 -0
- package/dist/rtdb/reducers/tree.js.map +1 -0
- package/dist/rtdb/rtdbApi.d.ts +20 -0
- package/dist/rtdb/rtdbApi.d.ts.map +1 -0
- package/dist/rtdb/rtdbApi.js +2 -0
- package/dist/rtdb/rtdbApi.js.map +1 -0
- package/dist/rtdb/values.d.ts +50 -0
- package/dist/rtdb/values.d.ts.map +1 -0
- package/dist/rtdb/values.js +186 -0
- package/dist/rtdb/values.js.map +1 -0
- package/dist/rules/components/DenialInspector.d.ts +18 -0
- package/dist/rules/components/DenialInspector.d.ts.map +1 -0
- package/dist/rules/components/DenialInspector.js +58 -0
- package/dist/rules/components/DenialInspector.js.map +1 -0
- package/dist/rules/components/format.d.ts +56 -0
- package/dist/rules/components/format.d.ts.map +1 -0
- package/dist/rules/components/format.js +137 -0
- package/dist/rules/components/format.js.map +1 -0
- package/dist/rules/components/index.d.ts +4 -0
- package/dist/rules/components/index.d.ts.map +1 -0
- package/dist/rules/components/index.js +4 -0
- package/dist/rules/components/index.js.map +1 -0
- package/dist/rules/components/scope.d.ts +10 -0
- package/dist/rules/components/scope.d.ts.map +1 -0
- package/dist/rules/components/scope.js +72 -0
- package/dist/rules/components/scope.js.map +1 -0
- package/dist/rules/hooks/index.d.ts +2 -0
- package/dist/rules/hooks/index.d.ts.map +1 -0
- package/dist/rules/hooks/index.js +2 -0
- package/dist/rules/hooks/index.js.map +1 -0
- package/dist/rules/hooks/useDenialTrace.d.ts +51 -0
- package/dist/rules/hooks/useDenialTrace.d.ts.map +1 -0
- package/dist/rules/hooks/useDenialTrace.js +58 -0
- package/dist/rules/hooks/useDenialTrace.js.map +1 -0
- package/dist/rules/index.d.ts +14 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +13 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/types.d.ts +75 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/storage/collisionRename.d.ts +73 -0
- package/dist/storage/collisionRename.d.ts.map +1 -0
- package/dist/storage/collisionRename.js +113 -0
- package/dist/storage/collisionRename.js.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts +66 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js +82 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js.map +1 -0
- package/dist/storage/components/ObjectBrowser.d.ts +78 -0
- package/dist/storage/components/ObjectBrowser.d.ts.map +1 -0
- package/dist/storage/components/ObjectBrowser.js +60 -0
- package/dist/storage/components/ObjectBrowser.js.map +1 -0
- package/dist/storage/components/ObjectInspector.d.ts +43 -0
- package/dist/storage/components/ObjectInspector.d.ts.map +1 -0
- package/dist/storage/components/ObjectInspector.js +92 -0
- package/dist/storage/components/ObjectInspector.js.map +1 -0
- package/dist/storage/components/PathBreadcrumb.d.ts +30 -0
- package/dist/storage/components/PathBreadcrumb.d.ts.map +1 -0
- package/dist/storage/components/PathBreadcrumb.js +26 -0
- package/dist/storage/components/PathBreadcrumb.js.map +1 -0
- package/dist/storage/components/UploadDropzone.d.ts +50 -0
- package/dist/storage/components/UploadDropzone.d.ts.map +1 -0
- package/dist/storage/components/UploadDropzone.js +109 -0
- package/dist/storage/components/UploadDropzone.js.map +1 -0
- package/dist/storage/folderPlaceholder.d.ts +20 -0
- package/dist/storage/folderPlaceholder.d.ts.map +1 -0
- package/dist/storage/folderPlaceholder.js +34 -0
- package/dist/storage/folderPlaceholder.js.map +1 -0
- package/dist/storage/hooks/index.d.ts +9 -0
- package/dist/storage/hooks/index.d.ts.map +1 -0
- package/dist/storage/hooks/index.js +9 -0
- package/dist/storage/hooks/index.js.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts +114 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.js +193 -0
- package/dist/storage/hooks/useMetadataEditor.js.map +1 -0
- package/dist/storage/hooks/useObjectUpload.d.ts +105 -0
- package/dist/storage/hooks/useObjectUpload.d.ts.map +1 -0
- package/dist/storage/hooks/useObjectUpload.js +134 -0
- package/dist/storage/hooks/useObjectUpload.js.map +1 -0
- package/dist/storage/hooks/usePathState.d.ts +43 -0
- package/dist/storage/hooks/usePathState.d.ts.map +1 -0
- package/dist/storage/hooks/usePathState.js +42 -0
- package/dist/storage/hooks/usePathState.js.map +1 -0
- package/dist/storage/hooks/useStorageDelete.d.ts +74 -0
- package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageDelete.js +120 -0
- package/dist/storage/hooks/useStorageDelete.js.map +1 -0
- package/dist/storage/hooks/useStorageList.d.ts +72 -0
- package/dist/storage/hooks/useStorageList.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageList.js +164 -0
- package/dist/storage/hooks/useStorageList.js.map +1 -0
- package/dist/storage/hooks/useStorageObject.d.ts +33 -0
- package/dist/storage/hooks/useStorageObject.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageObject.js +114 -0
- package/dist/storage/hooks/useStorageObject.js.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts +116 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.js +150 -0
- package/dist/storage/hooks/useStorageRulesGate.js.map +1 -0
- package/dist/storage/hooks/useStorageSelection.d.ts +32 -0
- package/dist/storage/hooks/useStorageSelection.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageSelection.js +55 -0
- package/dist/storage/hooks/useStorageSelection.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/pendingPrefixes.d.ts +77 -0
- package/dist/storage/pendingPrefixes.d.ts.map +1 -0
- package/dist/storage/pendingPrefixes.js +104 -0
- package/dist/storage/pendingPrefixes.js.map +1 -0
- package/dist/storage/previews.d.ts +51 -0
- package/dist/storage/previews.d.ts.map +1 -0
- package/dist/storage/previews.js +73 -0
- package/dist/storage/previews.js.map +1 -0
- package/dist/storage/storageApi.d.ts +30 -0
- package/dist/storage/storageApi.d.ts.map +1 -0
- package/dist/storage/storageApi.js +20 -0
- package/dist/storage/storageApi.js.map +1 -0
- package/dist/traffic/components/RuleHeatmap.d.ts +34 -0
- package/dist/traffic/components/RuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/components/RuleHeatmap.js +40 -0
- package/dist/traffic/components/RuleHeatmap.js.map +1 -0
- package/dist/traffic/components/TrafficDetail.d.ts +33 -0
- package/dist/traffic/components/TrafficDetail.d.ts.map +1 -0
- package/dist/traffic/components/TrafficDetail.js +28 -0
- package/dist/traffic/components/TrafficDetail.js.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts +28 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.js +25 -0
- package/dist/traffic/components/TrafficGroupRow.js.map +1 -0
- package/dist/traffic/components/TrafficLineChart.d.ts +37 -0
- package/dist/traffic/components/TrafficLineChart.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLineChart.js +49 -0
- package/dist/traffic/components/TrafficLineChart.js.map +1 -0
- package/dist/traffic/components/TrafficLog.d.ts +52 -0
- package/dist/traffic/components/TrafficLog.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLog.js +34 -0
- package/dist/traffic/components/TrafficLog.js.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts +26 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.js +24 -0
- package/dist/traffic/components/TrafficMetricCards.js.map +1 -0
- package/dist/traffic/components/TrafficRow.d.ts +40 -0
- package/dist/traffic/components/TrafficRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficRow.js +27 -0
- package/dist/traffic/components/TrafficRow.js.map +1 -0
- package/dist/traffic/components/TrafficStats.d.ts +18 -0
- package/dist/traffic/components/TrafficStats.d.ts.map +1 -0
- package/dist/traffic/components/TrafficStats.js +19 -0
- package/dist/traffic/components/TrafficStats.js.map +1 -0
- package/dist/traffic/components/TrafficTimeline.d.ts +88 -0
- package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -0
- package/dist/traffic/components/TrafficTimeline.js +86 -0
- package/dist/traffic/components/TrafficTimeline.js.map +1 -0
- package/dist/traffic/components/format.d.ts +13 -0
- package/dist/traffic/components/format.d.ts.map +1 -0
- package/dist/traffic/components/format.js +24 -0
- package/dist/traffic/components/format.js.map +1 -0
- package/dist/traffic/components/index.d.ts +11 -0
- package/dist/traffic/components/index.d.ts.map +1 -0
- package/dist/traffic/components/index.js +11 -0
- package/dist/traffic/components/index.js.map +1 -0
- package/dist/traffic/hooks/index.d.ts +8 -0
- package/dist/traffic/hooks/index.d.ts.map +1 -0
- package/dist/traffic/hooks/index.js +8 -0
- package/dist/traffic/hooks/index.js.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts +33 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.js +54 -0
- package/dist/traffic/hooks/useRuleHeatmap.js.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts +71 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.js +74 -0
- package/dist/traffic/hooks/useTrafficBuckets.js.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts +40 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.js +33 -0
- package/dist/traffic/hooks/useTrafficFilter.js.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts +47 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.js +73 -0
- package/dist/traffic/hooks/useTrafficGroups.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts +66 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.js +156 -0
- package/dist/traffic/hooks/useTrafficMetrics.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts +56 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.js +58 -0
- package/dist/traffic/hooks/useTrafficMonitor.js.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts +32 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.js +45 -0
- package/dist/traffic/hooks/useTrafficStats.js.map +1 -0
- package/dist/traffic/index.d.ts +4 -0
- package/dist/traffic/index.d.ts.map +1 -0
- package/dist/traffic/index.js +3 -0
- package/dist/traffic/index.js.map +1 -0
- package/dist/traffic/types.d.ts +72 -0
- package/dist/traffic/types.d.ts.map +1 -0
- package/dist/traffic/types.js +10 -0
- package/dist/traffic/types.js.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure activity-digest reducer — folds a `SandboxEvent[]` (the
|
|
3
|
+
* unified stream) into the banded digest the activity grid renders.
|
|
4
|
+
*
|
|
5
|
+
* Kept free of React so it's trivially testable and reusable by a
|
|
6
|
+
* non-React consumer (a CLI session summary, say). `useActivityDigest`
|
|
7
|
+
* is a thin `useMemo` wrapper over `computeActivityDigest`.
|
|
8
|
+
*
|
|
9
|
+
* The categorization is the product (see
|
|
10
|
+
* the design rationale): the can't-miss bands are
|
|
11
|
+
* **denied** (surfaced first, loudly), **added**, **updated**,
|
|
12
|
+
* **removed**, **signed-in / signed-out**, and the catch-alls. Every
|
|
13
|
+
* row + band carries provenance (actor / lens / on-behalf-of) so
|
|
14
|
+
* attribution rides every aggregate, and the band order LEADS with the
|
|
15
|
+
* highest-consequence category present.
|
|
16
|
+
*/
|
|
17
|
+
// ── Band ordering: lead-with-consequence ──────────────────────────────
|
|
18
|
+
// Lower rank renders first. Denials lead; operational errors next; then
|
|
19
|
+
// the write bands; auth; reads; catch-all. (design-ideation.md:
|
|
20
|
+
// "the answer LEADS with the highest-consequence category present".)
|
|
21
|
+
const BAND_RANK = {
|
|
22
|
+
denied: 0,
|
|
23
|
+
errored: 1,
|
|
24
|
+
added: 2,
|
|
25
|
+
updated: 3,
|
|
26
|
+
removed: 4,
|
|
27
|
+
'signed-in': 5,
|
|
28
|
+
'signed-out': 6,
|
|
29
|
+
read: 7,
|
|
30
|
+
other: 8,
|
|
31
|
+
};
|
|
32
|
+
const BAND_LABEL = {
|
|
33
|
+
denied: 'Denied',
|
|
34
|
+
errored: 'Errored',
|
|
35
|
+
added: 'Added',
|
|
36
|
+
updated: 'Updated',
|
|
37
|
+
removed: 'Removed',
|
|
38
|
+
'signed-in': 'Signed in',
|
|
39
|
+
'signed-out': 'Signed out',
|
|
40
|
+
read: 'Read',
|
|
41
|
+
other: 'Other',
|
|
42
|
+
};
|
|
43
|
+
/** The kinds the digest models. Everything else is skipped. */
|
|
44
|
+
function isModelled(e) {
|
|
45
|
+
return (e.kind === 'request' ||
|
|
46
|
+
e.kind === 'write' ||
|
|
47
|
+
e.kind === 'service_mutation');
|
|
48
|
+
}
|
|
49
|
+
function lastSegment(path) {
|
|
50
|
+
const trimmed = path.replace(/\/+$/, '');
|
|
51
|
+
const i = trimmed.lastIndexOf('/');
|
|
52
|
+
return i === -1 ? trimmed : trimmed.slice(i + 1);
|
|
53
|
+
}
|
|
54
|
+
function defaultActor(actor) {
|
|
55
|
+
return actor ?? { kind: 'app' };
|
|
56
|
+
}
|
|
57
|
+
function defaultLens(lens) {
|
|
58
|
+
return lens ?? { mode: 'app-session' };
|
|
59
|
+
}
|
|
60
|
+
function lensLabel(lens) {
|
|
61
|
+
switch (lens.mode) {
|
|
62
|
+
case 'admin':
|
|
63
|
+
return 'admin';
|
|
64
|
+
case 'as':
|
|
65
|
+
return lens.uid;
|
|
66
|
+
case 'app-session':
|
|
67
|
+
return 'app';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function actorLabel(actor) {
|
|
71
|
+
switch (actor.kind) {
|
|
72
|
+
case 'app':
|
|
73
|
+
return 'the app';
|
|
74
|
+
case 'studio':
|
|
75
|
+
return 'studio';
|
|
76
|
+
case 'app-builder':
|
|
77
|
+
return 'the app builder';
|
|
78
|
+
case 'agent':
|
|
79
|
+
return `agent ${actor.name}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** A stable identity key for an actor (for attribution counting). */
|
|
83
|
+
function actorKey(actor) {
|
|
84
|
+
return actor.kind === 'agent' ? `agent:${actor.name}` : actor.kind;
|
|
85
|
+
}
|
|
86
|
+
/** The deciding rule on a denial, parsed from the simulator reasons.
|
|
87
|
+
* Best-effort — falls back to a generic phrase. */
|
|
88
|
+
function denialRulePhrase(reasons) {
|
|
89
|
+
// Reasons look like `Rule #0 (update) → DENY`. We surface the op the
|
|
90
|
+
// rule governs when present; the design copy says "owner rule" but
|
|
91
|
+
// that's app-semantic naming the library can't know, so we stay
|
|
92
|
+
// mechanical: name the failing op.
|
|
93
|
+
for (const r of reasons) {
|
|
94
|
+
const m = /Rule #\d+\s*\(([^)]+)\)/i.exec(r);
|
|
95
|
+
if (m)
|
|
96
|
+
return `${m[1]} rule`;
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
function relativeWhen(at, now) {
|
|
101
|
+
const deltaMs = Math.max(0, now - at);
|
|
102
|
+
const s = Math.floor(deltaMs / 1000);
|
|
103
|
+
if (s < 1)
|
|
104
|
+
return 'now';
|
|
105
|
+
if (s < 60)
|
|
106
|
+
return `${s}s`;
|
|
107
|
+
const m = Math.floor(s / 60);
|
|
108
|
+
if (m < 60)
|
|
109
|
+
return `${m}m`;
|
|
110
|
+
const h = Math.floor(m / 60);
|
|
111
|
+
return `${h}h`;
|
|
112
|
+
}
|
|
113
|
+
// ── Per-kind projection: event → { band, row fields } ─────────────────
|
|
114
|
+
function projectRequest(e) {
|
|
115
|
+
if (e.result === 'deny') {
|
|
116
|
+
const rule = denialRulePhrase(e.reasons);
|
|
117
|
+
const change = rule ? `${e.method}, ${rule}` : `${e.method} denied`;
|
|
118
|
+
return { band: 'denied', change, subjectUid: e.auth?.uid ?? null };
|
|
119
|
+
}
|
|
120
|
+
if (e.result === 'unsupported') {
|
|
121
|
+
return {
|
|
122
|
+
band: 'errored',
|
|
123
|
+
change: `${e.method} unsupported`,
|
|
124
|
+
subjectUid: e.auth?.uid ?? null,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// Allowed request. Reads land in `read`; allowed writes that DIDN'T
|
|
128
|
+
// also emit a `write` event still get a band so nothing is dropped.
|
|
129
|
+
const subjectUid = e.auth?.uid ?? null;
|
|
130
|
+
if (e.method === 'get' || e.method === 'list') {
|
|
131
|
+
return { band: 'read', change: e.method, subjectUid };
|
|
132
|
+
}
|
|
133
|
+
if (e.method === 'delete') {
|
|
134
|
+
return { band: 'removed', change: 'deleted', subjectUid };
|
|
135
|
+
}
|
|
136
|
+
if (e.method === 'create') {
|
|
137
|
+
return { band: 'added', change: 'created', subjectUid };
|
|
138
|
+
}
|
|
139
|
+
return { band: 'updated', change: e.method, subjectUid };
|
|
140
|
+
}
|
|
141
|
+
/** A compact change summary for a write, diffing prior→next when cheap. */
|
|
142
|
+
function writeChange(e) {
|
|
143
|
+
if (e.method === 'delete')
|
|
144
|
+
return 'deleted';
|
|
145
|
+
if (e.method === 'create') {
|
|
146
|
+
// Surface a representative field value if present (mock shows the
|
|
147
|
+
// note title in quotes). Pick the first string-ish scalar.
|
|
148
|
+
const data = e.nextState ?? e.data ?? null;
|
|
149
|
+
const preview = data ? firstScalarPreview(data) : undefined;
|
|
150
|
+
return preview !== undefined ? preview : 'created';
|
|
151
|
+
}
|
|
152
|
+
// update / set — try to show a single changed field as `key → value`.
|
|
153
|
+
const single = singleFieldDiff(e.priorState, e.nextState);
|
|
154
|
+
if (single)
|
|
155
|
+
return single;
|
|
156
|
+
return e.method === 'set' ? 'replaced' : 'updated';
|
|
157
|
+
}
|
|
158
|
+
function firstScalarPreview(data) {
|
|
159
|
+
for (const v of Object.values(data)) {
|
|
160
|
+
if (typeof v === 'string')
|
|
161
|
+
return `"${v}"`;
|
|
162
|
+
}
|
|
163
|
+
for (const v of Object.values(data)) {
|
|
164
|
+
if (typeof v === 'number' || typeof v === 'boolean')
|
|
165
|
+
return String(v);
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
function singleFieldDiff(prior, next) {
|
|
170
|
+
if (!next)
|
|
171
|
+
return undefined;
|
|
172
|
+
const before = prior ?? {};
|
|
173
|
+
const changed = [];
|
|
174
|
+
for (const k of Object.keys(next)) {
|
|
175
|
+
if (!shallowEqual(before[k], next[k]))
|
|
176
|
+
changed.push(k);
|
|
177
|
+
}
|
|
178
|
+
if (changed.length !== 1) {
|
|
179
|
+
return changed.length > 1 ? `${changed.length} fields changed` : undefined;
|
|
180
|
+
}
|
|
181
|
+
const key = changed[0];
|
|
182
|
+
const v = next[key];
|
|
183
|
+
if (typeof v === 'string' ||
|
|
184
|
+
typeof v === 'number' ||
|
|
185
|
+
typeof v === 'boolean') {
|
|
186
|
+
const shown = typeof v === 'string' ? v : String(v);
|
|
187
|
+
return `${key} → ${shown}`;
|
|
188
|
+
}
|
|
189
|
+
return `${key} changed`;
|
|
190
|
+
}
|
|
191
|
+
function shallowEqual(a, b) {
|
|
192
|
+
if (a === b)
|
|
193
|
+
return true;
|
|
194
|
+
if (typeof a !== typeof b)
|
|
195
|
+
return false;
|
|
196
|
+
if (typeof a === 'object' && a && b) {
|
|
197
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
function projectWrite(e) {
|
|
202
|
+
const subjectUid = e.auth?.uid ?? null;
|
|
203
|
+
if (e.method === 'delete')
|
|
204
|
+
return { band: 'removed', change: 'deleted', subjectUid };
|
|
205
|
+
if (e.method === 'create')
|
|
206
|
+
return { band: 'added', change: writeChange(e), subjectUid };
|
|
207
|
+
return { band: 'updated', change: writeChange(e), subjectUid };
|
|
208
|
+
}
|
|
209
|
+
function projectServiceMutation(e) {
|
|
210
|
+
const op = e.op;
|
|
211
|
+
// auth ops carry the affected uid in `path` (or `*` for a clear-all).
|
|
212
|
+
if (e.service === 'auth') {
|
|
213
|
+
const affected = e.path && e.path !== '*' ? e.path : null;
|
|
214
|
+
const subjectUid = affected ?? e.auth?.uid ?? null;
|
|
215
|
+
switch (op) {
|
|
216
|
+
case 'sign_in':
|
|
217
|
+
return { band: 'signed-in', change: 'signed in', subjectUid };
|
|
218
|
+
case 'sign_out':
|
|
219
|
+
return { band: 'signed-out', change: 'signed out', subjectUid };
|
|
220
|
+
case 'user_create':
|
|
221
|
+
return { band: 'added', change: 'user created', subjectUid };
|
|
222
|
+
case 'user_update':
|
|
223
|
+
return { band: 'updated', change: 'user updated', subjectUid };
|
|
224
|
+
case 'user_delete':
|
|
225
|
+
return { band: 'removed', change: 'user deleted', subjectUid };
|
|
226
|
+
case 'users_clear':
|
|
227
|
+
return { band: 'removed', change: 'all users cleared', subjectUid };
|
|
228
|
+
default:
|
|
229
|
+
return { band: 'other', change: op, subjectUid };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const subjectUid = e.auth?.uid ?? null;
|
|
233
|
+
if (e.service === 'storage') {
|
|
234
|
+
switch (op) {
|
|
235
|
+
case 'object_put':
|
|
236
|
+
// create vs overwrite: `before` present ⇒ overwrite.
|
|
237
|
+
return e.before !== undefined
|
|
238
|
+
? { band: 'updated', change: 'object replaced', subjectUid }
|
|
239
|
+
: { band: 'added', change: 'object uploaded', subjectUid };
|
|
240
|
+
case 'object_delete':
|
|
241
|
+
return { band: 'removed', change: 'object deleted', subjectUid };
|
|
242
|
+
case 'metadata_update':
|
|
243
|
+
return { band: 'updated', change: 'metadata updated', subjectUid };
|
|
244
|
+
default:
|
|
245
|
+
return { band: 'other', change: op, subjectUid };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// rtdb
|
|
249
|
+
switch (op) {
|
|
250
|
+
case 'set':
|
|
251
|
+
return e.before !== undefined && e.before !== null
|
|
252
|
+
? { band: 'updated', change: 'set', subjectUid }
|
|
253
|
+
: { band: 'added', change: 'set', subjectUid };
|
|
254
|
+
case 'update':
|
|
255
|
+
return { band: 'updated', change: 'update', subjectUid };
|
|
256
|
+
case 'remove':
|
|
257
|
+
return { band: 'removed', change: 'removed', subjectUid };
|
|
258
|
+
case 'transaction':
|
|
259
|
+
return { band: 'updated', change: 'transaction', subjectUid };
|
|
260
|
+
default:
|
|
261
|
+
return { band: 'other', change: op, subjectUid };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function project(e) {
|
|
265
|
+
switch (e.kind) {
|
|
266
|
+
case 'request':
|
|
267
|
+
return projectRequest(e);
|
|
268
|
+
case 'write':
|
|
269
|
+
return projectWrite(e);
|
|
270
|
+
case 'service_mutation':
|
|
271
|
+
return projectServiceMutation(e);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function targetOf(e) {
|
|
275
|
+
switch (e.kind) {
|
|
276
|
+
case 'request':
|
|
277
|
+
case 'write':
|
|
278
|
+
return e.path;
|
|
279
|
+
case 'service_mutation':
|
|
280
|
+
// auth: the affected uid; storage/rtdb: the path.
|
|
281
|
+
if (e.service === 'auth')
|
|
282
|
+
return e.path && e.path !== '*' ? e.path : '*';
|
|
283
|
+
return e.path ?? '';
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function serviceOf(e) {
|
|
287
|
+
if (e.kind === 'service_mutation')
|
|
288
|
+
return e.service;
|
|
289
|
+
return e.service ?? 'firestore';
|
|
290
|
+
}
|
|
291
|
+
/** Build a row from a modelled event. */
|
|
292
|
+
function toRow(e, now) {
|
|
293
|
+
const { band, change, subjectUid } = project(e);
|
|
294
|
+
const actor = defaultActor(e.actor);
|
|
295
|
+
const authLens = defaultLens(e.authLens);
|
|
296
|
+
const row = {
|
|
297
|
+
id: e.id,
|
|
298
|
+
at: e.at,
|
|
299
|
+
band,
|
|
300
|
+
denied: band === 'denied',
|
|
301
|
+
service: serviceOf(e),
|
|
302
|
+
target: targetOf(e),
|
|
303
|
+
change,
|
|
304
|
+
for: subjectUid ?? '',
|
|
305
|
+
lens: lensLabel(authLens),
|
|
306
|
+
when: relativeWhen(e.at, now),
|
|
307
|
+
actor,
|
|
308
|
+
authLens,
|
|
309
|
+
subjectUid,
|
|
310
|
+
event: e,
|
|
311
|
+
};
|
|
312
|
+
if (e.planId !== undefined)
|
|
313
|
+
row.planId = e.planId;
|
|
314
|
+
return row;
|
|
315
|
+
}
|
|
316
|
+
/** The pivot key for a row under a given group-by axis. */
|
|
317
|
+
function groupKeyFor(row, by) {
|
|
318
|
+
switch (by) {
|
|
319
|
+
case 'actor':
|
|
320
|
+
return actorKey(row.actor);
|
|
321
|
+
case 'lens':
|
|
322
|
+
return row.authLens.mode === 'as'
|
|
323
|
+
? `as:${row.authLens.uid}`
|
|
324
|
+
: row.authLens.mode;
|
|
325
|
+
case 'subject':
|
|
326
|
+
return row.subjectUid ?? '(anonymous)';
|
|
327
|
+
case 'service':
|
|
328
|
+
return row.service;
|
|
329
|
+
case 'none':
|
|
330
|
+
return '';
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Compute the band attribution phrase: when one actor OR one subject
|
|
335
|
+
* dominates the band, say so ("all by alice", "by the app"). Mixed ⇒
|
|
336
|
+
* undefined (header shows just the count).
|
|
337
|
+
*/
|
|
338
|
+
function attributionFor(rows) {
|
|
339
|
+
if (rows.length === 0)
|
|
340
|
+
return undefined;
|
|
341
|
+
// Subject dominance first ("all by alice") — it's the most pointed.
|
|
342
|
+
const subjects = new Set();
|
|
343
|
+
for (const r of rows)
|
|
344
|
+
if (r.subjectUid)
|
|
345
|
+
subjects.add(r.subjectUid);
|
|
346
|
+
const anonCount = rows.filter((r) => !r.subjectUid).length;
|
|
347
|
+
if (subjects.size === 1 && anonCount === 0) {
|
|
348
|
+
const [only] = subjects;
|
|
349
|
+
return rows.length > 1 ? `all by ${only}` : `by ${only}`;
|
|
350
|
+
}
|
|
351
|
+
// Actor dominance ("by the app", "by agent atlas").
|
|
352
|
+
const actors = new Set();
|
|
353
|
+
for (const r of rows)
|
|
354
|
+
actors.add(actorKey(r.actor));
|
|
355
|
+
if (actors.size === 1) {
|
|
356
|
+
return `by ${actorLabel(rows[0].actor)}`;
|
|
357
|
+
}
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Fold a unified event stream into the banded activity digest. PURE —
|
|
362
|
+
* no React, no clock reads except the injected `now` (defaults to
|
|
363
|
+
* `Date.now()`, but pass a fixed value in tests for determinism).
|
|
364
|
+
*
|
|
365
|
+
* Events the digest doesn't model (listener lifecycle, snapshot
|
|
366
|
+
* delivery, session boundaries, unknown kinds) are skipped — a full
|
|
367
|
+
* `SandboxEvent[]` from `sandbox.history()` flows in unfiltered.
|
|
368
|
+
*/
|
|
369
|
+
export function computeActivityDigest(events, opts = {}) {
|
|
370
|
+
const { order = 'recency', groupBy = 'none', rowsPerBand, now = Date.now(), } = opts;
|
|
371
|
+
const byBand = new Map();
|
|
372
|
+
let deniedCount = 0;
|
|
373
|
+
for (const e of events) {
|
|
374
|
+
if (!isModelled(e))
|
|
375
|
+
continue;
|
|
376
|
+
const row = toRow(e, now);
|
|
377
|
+
if (row.denied)
|
|
378
|
+
deniedCount++;
|
|
379
|
+
const list = byBand.get(row.band);
|
|
380
|
+
if (list)
|
|
381
|
+
list.push(row);
|
|
382
|
+
else
|
|
383
|
+
byBand.set(row.band, [row]);
|
|
384
|
+
}
|
|
385
|
+
const sortRows = (rows) => rows.sort((a, b) => order === 'recency' ? b.at - a.at : a.at - b.at);
|
|
386
|
+
const bands = [];
|
|
387
|
+
let total = 0;
|
|
388
|
+
for (const [key, allRows] of byBand) {
|
|
389
|
+
sortRows(allRows);
|
|
390
|
+
const count = allRows.length;
|
|
391
|
+
total += count;
|
|
392
|
+
const rows = rowsPerBand !== undefined ? allRows.slice(0, rowsPerBand) : allRows;
|
|
393
|
+
if (groupBy !== 'none') {
|
|
394
|
+
for (const r of rows)
|
|
395
|
+
r.groupKey = groupKeyFor(r, groupBy);
|
|
396
|
+
}
|
|
397
|
+
const band = {
|
|
398
|
+
key,
|
|
399
|
+
label: BAND_LABEL[key],
|
|
400
|
+
count,
|
|
401
|
+
rows,
|
|
402
|
+
};
|
|
403
|
+
const attr = attributionFor(allRows);
|
|
404
|
+
if (attr)
|
|
405
|
+
band.attribution = attr;
|
|
406
|
+
if (groupBy !== 'none') {
|
|
407
|
+
const groups = new Map();
|
|
408
|
+
for (const r of rows) {
|
|
409
|
+
const gk = groupKeyFor(r, groupBy);
|
|
410
|
+
const g = groups.get(gk);
|
|
411
|
+
if (g)
|
|
412
|
+
g.push(r);
|
|
413
|
+
else
|
|
414
|
+
groups.set(gk, [r]);
|
|
415
|
+
}
|
|
416
|
+
band.subgroups = [...groups.entries()]
|
|
417
|
+
.map(([k, rs]) => ({ key: k, count: rs.length, rows: rs }))
|
|
418
|
+
.sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
|
|
419
|
+
}
|
|
420
|
+
bands.push(band);
|
|
421
|
+
}
|
|
422
|
+
bands.sort((a, b) => BAND_RANK[a.key] - BAND_RANK[b.key]);
|
|
423
|
+
const denials = sortRows((byBand.get('denied') ?? []).slice());
|
|
424
|
+
return { bands, total, deniedCount, denials };
|
|
425
|
+
}
|
|
426
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.js","sourceRoot":"","sources":["../../src/events/digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0JH,yEAAyE;AACzE,wEAAwE;AACxE,gEAAgE;AAChE,qEAAqE;AACrE,MAAM,SAAS,GAAoC;IACjD,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,MAAM,UAAU,GAAoC;IAClD,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO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AE,CAAC,CAAC;IAE/D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,GAGlB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AnyActivityEvent } from '../types.js';
|
|
2
|
+
import { type ActivityDigest, type ActivityDigestOptions } from '../digest.js';
|
|
3
|
+
export interface UseActivityDigestOptions extends ActivityDigestOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Clock injection for the relative `when` column. Defaults to
|
|
6
|
+
* `Date.now()` read once per recompute. Pass a fixed value (or a
|
|
7
|
+
* frozen "session now") for deterministic rendering / tests.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: changing `now` between renders re-folds the digest, so don't
|
|
10
|
+
* pass a fresh `Date.now()` inline unless you want a recompute every
|
|
11
|
+
* render — pin it (e.g. a ticking value updated on an interval).
|
|
12
|
+
*/
|
|
13
|
+
now?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* React wrapper over {@link computeActivityDigest} — memoizes the pure
|
|
17
|
+
* fold over the unified `SandboxEvent` stream into the banded activity
|
|
18
|
+
* digest. Feed it `sandbox.history()` (a snapshot) or the live buffer
|
|
19
|
+
* from {@link useActivityStream}; the reducer is identical either way.
|
|
20
|
+
*
|
|
21
|
+
* The fold re-runs when `events` identity, any grouping option, or
|
|
22
|
+
* `now` changes. Keep `events` referentially stable across renders that
|
|
23
|
+
* shouldn't recompute (the stream hook already returns a stable array
|
|
24
|
+
* per emission).
|
|
25
|
+
*/
|
|
26
|
+
export declare function useActivityDigest(events: readonly AnyActivityEvent[], options?: UseActivityDigestOptions): ActivityDigest;
|
|
27
|
+
//# sourceMappingURL=useActivityDigest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityDigest.d.ts","sourceRoot":"","sources":["../../../src/events/hooks/useActivityDigest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,OAAO,GAAE,wBAA6B,GACrC,cAAc,CAMhB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { computeActivityDigest, } from '../digest.js';
|
|
3
|
+
/**
|
|
4
|
+
* React wrapper over {@link computeActivityDigest} — memoizes the pure
|
|
5
|
+
* fold over the unified `SandboxEvent` stream into the banded activity
|
|
6
|
+
* digest. Feed it `sandbox.history()` (a snapshot) or the live buffer
|
|
7
|
+
* from {@link useActivityStream}; the reducer is identical either way.
|
|
8
|
+
*
|
|
9
|
+
* The fold re-runs when `events` identity, any grouping option, or
|
|
10
|
+
* `now` changes. Keep `events` referentially stable across renders that
|
|
11
|
+
* shouldn't recompute (the stream hook already returns a stable array
|
|
12
|
+
* per emission).
|
|
13
|
+
*/
|
|
14
|
+
export function useActivityDigest(events, options = {}) {
|
|
15
|
+
const { order, groupBy, rowsPerBand, now } = options;
|
|
16
|
+
return useMemo(() => computeActivityDigest(events, { order, groupBy, rowsPerBand, now }), [events, order, groupBy, rowsPerBand, now]);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useActivityDigest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityDigest.js","sourceRoot":"","sources":["../../../src/events/hooks/useActivityDigest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAC;AAetB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAmC,EACnC,UAAoC,EAAE;IAEtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACrD,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,EACzE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ActivitySource, AnyActivityEvent } from '../types.js';
|
|
2
|
+
export interface UseActivityStreamOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The subscription — `sandbox.onEvent` satisfies this directly. Pass
|
|
5
|
+
* a stable reference; the hook re-subscribes on identity change.
|
|
6
|
+
*/
|
|
7
|
+
source: ActivitySource;
|
|
8
|
+
/**
|
|
9
|
+
* Seed the buffer with a snapshot before the live subscription
|
|
10
|
+
* attaches — typically `sandbox.history()`, so a late-attaching
|
|
11
|
+
* consumer sees the whole session, not just events from `subscribe`
|
|
12
|
+
* onward. Read once on mount.
|
|
13
|
+
*/
|
|
14
|
+
initial?: readonly AnyActivityEvent[];
|
|
15
|
+
/**
|
|
16
|
+
* Ring-buffer cap. Once exceeded, the oldest events drop. Default
|
|
17
|
+
* 5000 (mirrors the traffic monitor's cap — a load-test session can
|
|
18
|
+
* emit 100k+ events).
|
|
19
|
+
*/
|
|
20
|
+
bufferSize?: number;
|
|
21
|
+
/** Start paused — incoming events drop (not queued) while paused. */
|
|
22
|
+
paused?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface UseActivityStreamResult {
|
|
25
|
+
/** The buffered events, oldest-first. Stable per emission — safe to
|
|
26
|
+
* hand straight to {@link useActivityDigest}. */
|
|
27
|
+
events: AnyActivityEvent[];
|
|
28
|
+
isPaused: boolean;
|
|
29
|
+
pause: () => void;
|
|
30
|
+
resume: () => void;
|
|
31
|
+
/** Empty the buffer (does NOT re-seed from `initial`). */
|
|
32
|
+
clear: () => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Buffers the unified sandbox event stream into a capped ring buffer
|
|
36
|
+
* with optional history seeding + pause/resume/clear. Decoupled from
|
|
37
|
+
* `pyric` — `source` is just a `(cb) => unsubscribe`.
|
|
38
|
+
*
|
|
39
|
+
* Sibling to the traffic monitor's `useTrafficMonitor`; the difference
|
|
40
|
+
* is the wider event type (`AnyActivityEvent`, the full union) and the
|
|
41
|
+
* `initial` seed so `history()` + live compose into one buffer.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useActivityStream({ source, initial, bufferSize, paused, }: UseActivityStreamOptions): UseActivityStreamResult;
|
|
44
|
+
//# sourceMappingURL=useActivityStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityStream.d.ts","sourceRoot":"","sources":["../../../src/events/hooks/useActivityStream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,MAAM,EAAE,cAAc,CAAC;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC;sDACkD;IAClD,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,OAAO,EACP,UAAiB,EACjB,MAAc,GACf,EAAE,wBAAwB,GAAG,uBAAuB,CAkCpD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Buffers the unified sandbox event stream into a capped ring buffer
|
|
4
|
+
* with optional history seeding + pause/resume/clear. Decoupled from
|
|
5
|
+
* `pyric` — `source` is just a `(cb) => unsubscribe`.
|
|
6
|
+
*
|
|
7
|
+
* Sibling to the traffic monitor's `useTrafficMonitor`; the difference
|
|
8
|
+
* is the wider event type (`AnyActivityEvent`, the full union) and the
|
|
9
|
+
* `initial` seed so `history()` + live compose into one buffer.
|
|
10
|
+
*/
|
|
11
|
+
export function useActivityStream({ source, initial, bufferSize = 5000, paused = false, }) {
|
|
12
|
+
const [events, setEvents] = useState(() => initial ? initial.slice(-bufferSize) : []);
|
|
13
|
+
const [isPaused, setIsPaused] = useState(paused);
|
|
14
|
+
const pausedRef = useRef(isPaused);
|
|
15
|
+
pausedRef.current = isPaused;
|
|
16
|
+
const bufferSizeRef = useRef(bufferSize);
|
|
17
|
+
bufferSizeRef.current = bufferSize;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const unsubscribe = source((event) => {
|
|
20
|
+
if (pausedRef.current)
|
|
21
|
+
return;
|
|
22
|
+
setEvents((prev) => {
|
|
23
|
+
const next = prev.length >= bufferSizeRef.current ? prev.slice(1) : prev.slice();
|
|
24
|
+
next.push(event);
|
|
25
|
+
return next;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return unsubscribe;
|
|
29
|
+
}, [source]);
|
|
30
|
+
return useMemo(() => ({
|
|
31
|
+
events,
|
|
32
|
+
isPaused,
|
|
33
|
+
pause: () => setIsPaused(true),
|
|
34
|
+
resume: () => setIsPaused(false),
|
|
35
|
+
clear: () => setEvents([]),
|
|
36
|
+
}), [events, isPaused]);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useActivityStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityStream.js","sourceRoot":"","sources":["../../../src/events/hooks/useActivityStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqC7D;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,MAAM,EACN,OAAO,EACP,UAAU,GAAG,IAAI,EACjB,MAAM,GAAG,KAAK,GACW;IACzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAqB,GAAG,EAAE,CAC5D,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1C,CAAC;IACF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC7B,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACzC,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACnC,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjB,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACtE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACjB,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;IACrB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,QAAQ;QACR,KAAK,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;QAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;KAC3B,CAAC,EACF,CAAC,MAAM,EAAE,QAAQ,CAAC,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@pyric/ui/events` — headless activity view over the unified
|
|
3
|
+
* `SandboxEvent` stream (Pyric Studio's keystone). Aggregates the whole
|
|
4
|
+
* stream (Firestore request/write + the cross-service `service_mutation`
|
|
5
|
+
* envelope for auth/storage/rtdb) into category bands with per-row
|
|
6
|
+
* provenance — the activity grid. Sibling to `@pyric/ui/traffic` (which
|
|
7
|
+
* is per-request, not aggregated-by-category).
|
|
8
|
+
*
|
|
9
|
+
* Ships zero styling — Pyric Studio applies the `data-pyric-*` contract.
|
|
10
|
+
*/
|
|
11
|
+
export * from './hooks/index.js';
|
|
12
|
+
export * from './components/index.js';
|
|
13
|
+
export { computeActivityDigest, type ActivityDigest, type ActivityDigestOptions, type ActivityGroupBy, type ActivityBand, type ActivityBandWithGroups, type ActivitySubgroup, type ActivityBandKey, type ActivityRow, } from './digest.js';
|
|
14
|
+
export type { ActivityEvent, AnyActivityEvent, ActivitySource, ActivityRequestEvent, ActivityWriteEvent, ActivityServiceMutationEvent, ActivityProvenance, ActivityService, ActivityActor, ActivityLens, ActivityResult, ActivityAuthState, } from './types.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@pyric/ui/events` — headless activity view over the unified
|
|
3
|
+
* `SandboxEvent` stream (Pyric Studio's keystone). Aggregates the whole
|
|
4
|
+
* stream (Firestore request/write + the cross-service `service_mutation`
|
|
5
|
+
* envelope for auth/storage/rtdb) into category bands with per-row
|
|
6
|
+
* provenance — the activity grid. Sibling to `@pyric/ui/traffic` (which
|
|
7
|
+
* is per-request, not aggregated-by-category).
|
|
8
|
+
*
|
|
9
|
+
* Ships zero styling — Pyric Studio applies the `data-pyric-*` contract.
|
|
10
|
+
*/
|
|
11
|
+
export * from './hooks/index.js';
|
|
12
|
+
export * from './components/index.js';
|
|
13
|
+
export { computeActivityDigest, } from './digest.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,qBAAqB,GAStB,MAAM,aAAa,CAAC"}
|