@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,114 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useStorageApi } from '../storageApi.js';
|
|
3
|
+
import { normalizeStoragePath } from './usePathState.js';
|
|
4
|
+
const IDLE_BLOB = {
|
|
5
|
+
status: 'idle',
|
|
6
|
+
blob: undefined,
|
|
7
|
+
url: undefined,
|
|
8
|
+
error: undefined,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* One object's metadata + lazily-loaded bytes, the data source for
|
|
12
|
+
* `<ObjectInspector>`. Read-via-get like the rest of the storage
|
|
13
|
+
* half: updates on `refresh`, `path` change, or `loadBlob`.
|
|
14
|
+
*/
|
|
15
|
+
export function useStorageObject(storage, path) {
|
|
16
|
+
// Injected: in-process `pyric/storage` by default, or the SharedWorker client
|
|
17
|
+
// bundle in Studio served mode (via StorageApiProvider).
|
|
18
|
+
const { getBlob, getMetadata, ref: refFn } = useStorageApi();
|
|
19
|
+
const normalized = path == null ? null : normalizeStoragePath(path);
|
|
20
|
+
const active = storage != null && normalized != null && normalized !== '';
|
|
21
|
+
const [meta, setMeta] = useState(() => ({
|
|
22
|
+
status: active ? 'loading' : 'idle',
|
|
23
|
+
metadata: undefined,
|
|
24
|
+
error: undefined,
|
|
25
|
+
}));
|
|
26
|
+
const [blobState, setBlobState] = useState(IDLE_BLOB);
|
|
27
|
+
const [tick, setTick] = useState(0);
|
|
28
|
+
// Generation token: invalidates in-flight blob loads when the
|
|
29
|
+
// path/storage changes or a newer load starts.
|
|
30
|
+
const blobGenRef = useRef(0);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
// Any identity change drops the previous blob (the URL-revoking
|
|
33
|
+
// effect below cleans up the old object URL when state resets).
|
|
34
|
+
blobGenRef.current++;
|
|
35
|
+
setBlobState(IDLE_BLOB);
|
|
36
|
+
if (!active) {
|
|
37
|
+
setMeta({ status: 'idle', metadata: undefined, error: undefined });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let cancelled = false;
|
|
41
|
+
setMeta({ status: 'loading', metadata: undefined, error: undefined });
|
|
42
|
+
getMetadata(refFn(storage, normalized))
|
|
43
|
+
.then((metadata) => {
|
|
44
|
+
if (cancelled)
|
|
45
|
+
return;
|
|
46
|
+
setMeta({ status: 'success', metadata, error: undefined });
|
|
47
|
+
})
|
|
48
|
+
.catch((e) => {
|
|
49
|
+
if (cancelled)
|
|
50
|
+
return;
|
|
51
|
+
setMeta({
|
|
52
|
+
status: 'error',
|
|
53
|
+
metadata: undefined,
|
|
54
|
+
error: e instanceof Error ? e : new Error(String(e)),
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
cancelled = true;
|
|
59
|
+
};
|
|
60
|
+
// `active` is derived from storage/normalized, not a dep itself.
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
+
}, [storage, normalized, tick]);
|
|
63
|
+
// Blob-URL lifecycle: one effect owns revocation. Runs cleanup when
|
|
64
|
+
// the url is replaced, reset (path change), or the hook unmounts :
|
|
65
|
+
// the design plan's "revoke on unmount" requirement.
|
|
66
|
+
const url = blobState.url;
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (url === undefined)
|
|
69
|
+
return;
|
|
70
|
+
return () => {
|
|
71
|
+
URL.revokeObjectURL(url);
|
|
72
|
+
};
|
|
73
|
+
}, [url]);
|
|
74
|
+
const refresh = useCallback(() => setTick((n) => n + 1), []);
|
|
75
|
+
const loadBlob = useCallback(() => {
|
|
76
|
+
if (storage == null || normalized == null || normalized === '')
|
|
77
|
+
return;
|
|
78
|
+
const myGen = ++blobGenRef.current;
|
|
79
|
+
setBlobState({ status: 'loading', blob: undefined, url: undefined, error: undefined });
|
|
80
|
+
getBlob(refFn(storage, normalized))
|
|
81
|
+
.then((blob) => {
|
|
82
|
+
if (myGen !== blobGenRef.current)
|
|
83
|
+
return;
|
|
84
|
+
setBlobState({
|
|
85
|
+
status: 'success',
|
|
86
|
+
blob,
|
|
87
|
+
url: URL.createObjectURL(blob),
|
|
88
|
+
error: undefined,
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
.catch((e) => {
|
|
92
|
+
if (myGen !== blobGenRef.current)
|
|
93
|
+
return;
|
|
94
|
+
setBlobState({
|
|
95
|
+
status: 'error',
|
|
96
|
+
blob: undefined,
|
|
97
|
+
url: undefined,
|
|
98
|
+
error: e instanceof Error ? e : new Error(String(e)),
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}, [storage, normalized]);
|
|
102
|
+
return {
|
|
103
|
+
status: meta.status,
|
|
104
|
+
metadata: meta.metadata,
|
|
105
|
+
error: meta.error,
|
|
106
|
+
refresh,
|
|
107
|
+
blobStatus: blobState.status,
|
|
108
|
+
blob: blobState.blob,
|
|
109
|
+
blobUrl: blobState.url,
|
|
110
|
+
blobError: blobState.error,
|
|
111
|
+
loadBlob,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=useStorageObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageObject.js","sourceRoot":"","sources":["../../../src/storage/hooks/useStorageObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA0CzD,M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1B,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO;QACP,UAAU,EAAE,SAAS,CAAC,MAAM;QAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,OAAO,EAAE,SAAS,CAAC,GAAG;QACtB,SAAS,EAAE,SAAS,CAAC,KAAK;QAC1B,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type FirebaseStorage, type StorageAuth, type StorageRules } from 'pyric/storage';
|
|
2
|
+
export type StorageRulesGateStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
3
|
+
/**
|
|
4
|
+
* Where the active ruleset came from:
|
|
5
|
+
* - `'option'` — the explicit `rules` option (string or pre-parsed).
|
|
6
|
+
* - `'sandbox'` — the ruleset deployed on the sandbox handle
|
|
7
|
+
* (`getStorageSandbox(ctx, { rules })`), read off the handle's
|
|
8
|
+
* `StorageService`.
|
|
9
|
+
* - `'none'` — no rules reachable. Every verdict allows
|
|
10
|
+
* (open-by-default, the same semantics `pyric/storage`'s
|
|
11
|
+
* enforcement layer applies when no rules are configured).
|
|
12
|
+
*/
|
|
13
|
+
export type StorageRulesSource = 'option' | 'sandbox' | 'none';
|
|
14
|
+
/**
|
|
15
|
+
* Per-path verdict. `pyric/storage`'s rules subset has exactly two
|
|
16
|
+
* verbs (`read` | `write` — the granular get/list/create/update/
|
|
17
|
+
* delete forms are a parser follow-up), so `delete` and `upload` are
|
|
18
|
+
* DERIVED aliases of `write`: Firebase Storage's `write` permission
|
|
19
|
+
* governs create, overwrite, AND delete.
|
|
20
|
+
*/
|
|
21
|
+
export interface StorageGateVerdict {
|
|
22
|
+
read: boolean;
|
|
23
|
+
write: boolean;
|
|
24
|
+
/** Derived — always `=== write` under the two-verb subset. */
|
|
25
|
+
delete: boolean;
|
|
26
|
+
/** Derived — always `=== write` under the two-verb subset. */
|
|
27
|
+
upload: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Evaluator reason traces for DENIED verbs (`"no rule matches…"` /
|
|
30
|
+
* `"match /… : condition false"`); empty arrays when allowed.
|
|
31
|
+
* Feed into disabled-state tooltips and `data-*-reason` attributes.
|
|
32
|
+
*/
|
|
33
|
+
reasons: {
|
|
34
|
+
read: string[];
|
|
35
|
+
write: string[];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface UseStorageRulesGateOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Path (or paths) to pre-evaluate into `verdicts`, keyed by the
|
|
41
|
+
* normalized path. Ad-hoc paths (e.g. browser rows) go through
|
|
42
|
+
* `verdictFor` instead — the two are the same evaluation.
|
|
43
|
+
*/
|
|
44
|
+
paths?: string | readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* Explicit rules source — raw rules text (parsed here; a malformed
|
|
47
|
+
* string surfaces as `status: 'error'`) or a pre-parsed
|
|
48
|
+
* `StorageRules` handle. Overrides the sandbox's deployed ruleset
|
|
49
|
+
* when both exist.
|
|
50
|
+
*/
|
|
51
|
+
rules?: string | StorageRules;
|
|
52
|
+
/**
|
|
53
|
+
* Identity override. `null` is anonymous; OMIT the field to use
|
|
54
|
+
* the handle's own identity (the sandbox context's `auth`).
|
|
55
|
+
*/
|
|
56
|
+
identity?: StorageAuth | null;
|
|
57
|
+
/**
|
|
58
|
+
* The about-to-write payload bound to `request.resource` for the
|
|
59
|
+
* WRITE evaluation — pass `{ size, contentType }` when gating a
|
|
60
|
+
* specific upload so size/contentType-conditioned rules evaluate
|
|
61
|
+
* truthfully. When omitted, `request.resource` is unset, which is
|
|
62
|
+
* exactly DELETE semantics (deletes carry no inbound payload) —
|
|
63
|
+
* a rule like `request.resource.size < N` then denies, the
|
|
64
|
+
* conservative answer for uploads.
|
|
65
|
+
*/
|
|
66
|
+
writeResource?: {
|
|
67
|
+
size: number;
|
|
68
|
+
contentType?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface UseStorageRulesGateResult {
|
|
72
|
+
/** `'idle'` only when `storage` is null/undefined. */
|
|
73
|
+
status: StorageRulesGateStatus;
|
|
74
|
+
/** Where the active ruleset came from. */
|
|
75
|
+
source: StorageRulesSource;
|
|
76
|
+
/** Always false: `pyric/storage` handles are sandbox mirrors. */
|
|
77
|
+
advisory: boolean;
|
|
78
|
+
/** The identity the verdicts evaluate under. */
|
|
79
|
+
identity: StorageAuth | null;
|
|
80
|
+
/** Pre-evaluated verdicts for `options.paths`, keyed by normalized path. */
|
|
81
|
+
verdicts: Record<string, StorageGateVerdict>;
|
|
82
|
+
/**
|
|
83
|
+
* Evaluate an arbitrary path under the current ruleset + identity.
|
|
84
|
+
* Pure and synchronous once `status` is `'ready'`; before that
|
|
85
|
+
* (and whenever no rules are reachable) it returns the allow-all
|
|
86
|
+
* verdict — the gate FAILS OPEN, because affordances are advisory
|
|
87
|
+
* and the real enforcement (sandbox throw / server denial) stays
|
|
88
|
+
* authoritative.
|
|
89
|
+
*/
|
|
90
|
+
verdictFor: (path: string) => StorageGateVerdict;
|
|
91
|
+
/** Rules-resolution failure (e.g. a malformed `rules` string). */
|
|
92
|
+
error: Error | undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Pre-flight rules evaluation — the M7 differentiator. Evaluates the
|
|
96
|
+
* current identity against paths BEFORE the click, so components can
|
|
97
|
+
* annotate denied affordances (`data-pyric-denied`, disabled-with-
|
|
98
|
+
* reason) instead of letting the user discover a denial via a thrown
|
|
99
|
+
* `storage/unauthorized`.
|
|
100
|
+
*
|
|
101
|
+
* Rules discovery: a sandbox handle carries its deployed ruleset
|
|
102
|
+
* (`getStorageSandbox(ctx, { rules })` parses it into the handle's
|
|
103
|
+
* `StorageService`) — the hook reads it through the handle's target,
|
|
104
|
+
* so sandbox callers pass nothing. Identity likewise defaults to the
|
|
105
|
+
* handle's `SandboxContext.auth`. An explicit `rules` or `identity`
|
|
106
|
+
* option overrides the handle when evaluating a what-if scenario.
|
|
107
|
+
*
|
|
108
|
+
* Evaluation contract (mirrors `pyric/storage`'s own enforcement):
|
|
109
|
+
* `resource` (the existing object) is bound as `null` — the gate
|
|
110
|
+
* pre-evaluates without fetching per-path metadata, matching how the
|
|
111
|
+
* sandbox enforces `listAll`. Rules conditioned on existing-object
|
|
112
|
+
* state (`resource.*`) evaluate as if the object doesn't exist; the
|
|
113
|
+
* common identity/path/payload-shaped rules evaluate exactly.
|
|
114
|
+
*/
|
|
115
|
+
export declare function useStorageRulesGate(storage: FirebaseStorage | null | undefined, options?: UseStorageRulesGateOptions): UseStorageRulesGateResult;
|
|
116
|
+
//# sourceMappingURL=useStorageRulesGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageRulesGate.d.ts","sourceRoot":"","sources":["../../../src/storage/hooks/useStorageRulesGate.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,WAAW,EAEhB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,8DAA8D;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB,8DAA8D;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC9C;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD;AAED,MAAM,WAAW,yBAAyB;IACxC,sDAAsD;IACtD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,0CAA0C;IAC1C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,kBAAkB,CAAC;IACjD,kEAAkE;IAClE,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B;AAqBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC3C,OAAO,GAAE,0BAA+B,GACvC,yBAAyB,CA2H3B"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { TARGET_SYMBOL, parseStorageRules, evaluateStorageRules, } from 'pyric/storage';
|
|
3
|
+
import { normalizeStoragePath } from './usePathState.js';
|
|
4
|
+
/** Shared allow-all verdict — idle/loading/error and rules-less states. */
|
|
5
|
+
const ALLOW_ALL = Object.freeze({
|
|
6
|
+
read: true,
|
|
7
|
+
write: true,
|
|
8
|
+
delete: true,
|
|
9
|
+
upload: true,
|
|
10
|
+
reasons: Object.freeze({
|
|
11
|
+
read: [],
|
|
12
|
+
write: [],
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Pre-flight rules evaluation — the M7 differentiator. Evaluates the
|
|
17
|
+
* current identity against paths BEFORE the click, so components can
|
|
18
|
+
* annotate denied affordances (`data-pyric-denied`, disabled-with-
|
|
19
|
+
* reason) instead of letting the user discover a denial via a thrown
|
|
20
|
+
* `storage/unauthorized`.
|
|
21
|
+
*
|
|
22
|
+
* Rules discovery: a sandbox handle carries its deployed ruleset
|
|
23
|
+
* (`getStorageSandbox(ctx, { rules })` parses it into the handle's
|
|
24
|
+
* `StorageService`) — the hook reads it through the handle's target,
|
|
25
|
+
* so sandbox callers pass nothing. Identity likewise defaults to the
|
|
26
|
+
* handle's `SandboxContext.auth`. An explicit `rules` or `identity`
|
|
27
|
+
* option overrides the handle when evaluating a what-if scenario.
|
|
28
|
+
*
|
|
29
|
+
* Evaluation contract (mirrors `pyric/storage`'s own enforcement):
|
|
30
|
+
* `resource` (the existing object) is bound as `null` — the gate
|
|
31
|
+
* pre-evaluates without fetching per-path metadata, matching how the
|
|
32
|
+
* sandbox enforces `listAll`. Rules conditioned on existing-object
|
|
33
|
+
* state (`resource.*`) evaluate as if the object doesn't exist; the
|
|
34
|
+
* common identity/path/payload-shaped rules evaluate exactly.
|
|
35
|
+
*/
|
|
36
|
+
export function useStorageRulesGate(storage, options = {}) {
|
|
37
|
+
const { paths, rules: rulesOption, identity: identityOption, writeResource } = options;
|
|
38
|
+
const target = storage == null ? null : storage[TARGET_SYMBOL];
|
|
39
|
+
const [state, setState] = useState(() => ({
|
|
40
|
+
status: storage == null ? 'idle' : 'loading',
|
|
41
|
+
rules: null,
|
|
42
|
+
source: 'none',
|
|
43
|
+
error: undefined,
|
|
44
|
+
}));
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (target == null) {
|
|
47
|
+
setState({ status: 'idle', rules: null, source: 'none', error: undefined });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Explicit option wins for what-if evaluation.
|
|
51
|
+
if (rulesOption != null) {
|
|
52
|
+
try {
|
|
53
|
+
const parsed = typeof rulesOption === 'string' ? parseStorageRules(rulesOption) : rulesOption;
|
|
54
|
+
setState({ status: 'ready', rules: parsed, source: 'option', error: undefined });
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
setState({
|
|
58
|
+
status: 'error',
|
|
59
|
+
rules: null,
|
|
60
|
+
source: 'none',
|
|
61
|
+
error: e instanceof Error ? e : new Error(String(e)),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
let cancelled = false;
|
|
67
|
+
setState({ status: 'loading', rules: null, source: 'none', error: undefined });
|
|
68
|
+
target.servicePromise
|
|
69
|
+
.then((service) => {
|
|
70
|
+
if (cancelled)
|
|
71
|
+
return;
|
|
72
|
+
setState({
|
|
73
|
+
status: 'ready',
|
|
74
|
+
rules: service.rules,
|
|
75
|
+
source: service.rules ? 'sandbox' : 'none',
|
|
76
|
+
error: undefined,
|
|
77
|
+
});
|
|
78
|
+
})
|
|
79
|
+
.catch((e) => {
|
|
80
|
+
if (cancelled)
|
|
81
|
+
return;
|
|
82
|
+
setState({
|
|
83
|
+
status: 'error',
|
|
84
|
+
rules: null,
|
|
85
|
+
source: 'none',
|
|
86
|
+
error: e instanceof Error ? e : new Error(String(e)),
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
return () => {
|
|
90
|
+
cancelled = true;
|
|
91
|
+
};
|
|
92
|
+
}, [target, rulesOption]);
|
|
93
|
+
// `undefined` means "derive from the handle"; an explicit `null`
|
|
94
|
+
// means anonymous.
|
|
95
|
+
const identity = identityOption !== undefined ? identityOption : (target?.context.auth ?? null);
|
|
96
|
+
const { rules, status } = state;
|
|
97
|
+
const writeSize = writeResource?.size;
|
|
98
|
+
const writeContentType = writeResource?.contentType;
|
|
99
|
+
const verdictFor = useCallback((path) => {
|
|
100
|
+
if (rules == null)
|
|
101
|
+
return ALLOW_ALL;
|
|
102
|
+
const objectPath = normalizeStoragePath(path);
|
|
103
|
+
const bucket = target?.bucket ?? 'pyric-default';
|
|
104
|
+
const rulesPath = objectPath === '' ? `b/${bucket}/o` : `b/${bucket}/o/${objectPath}`;
|
|
105
|
+
const evaluate = (method) => evaluateStorageRules(rules, {
|
|
106
|
+
request: {
|
|
107
|
+
auth: identity,
|
|
108
|
+
method,
|
|
109
|
+
path: rulesPath,
|
|
110
|
+
...(method === 'write' && writeSize !== undefined
|
|
111
|
+
? { resource: { size: writeSize, contentType: writeContentType } }
|
|
112
|
+
: {}),
|
|
113
|
+
},
|
|
114
|
+
resource: null,
|
|
115
|
+
});
|
|
116
|
+
const read = evaluate('read');
|
|
117
|
+
const write = evaluate('write');
|
|
118
|
+
return {
|
|
119
|
+
read: read.allowed,
|
|
120
|
+
write: write.allowed,
|
|
121
|
+
delete: write.allowed,
|
|
122
|
+
upload: write.allowed,
|
|
123
|
+
reasons: {
|
|
124
|
+
read: read.allowed ? [] : read.reasons,
|
|
125
|
+
write: write.allowed ? [] : write.reasons,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}, [rules, target?.bucket, identity, writeSize, writeContentType]);
|
|
129
|
+
const pathsKey = typeof paths === 'string' ? paths : (paths ?? []).join('\n');
|
|
130
|
+
const verdicts = useMemo(() => {
|
|
131
|
+
const list = typeof paths === 'string' ? [paths] : (paths ?? []);
|
|
132
|
+
const out = {};
|
|
133
|
+
for (const p of list) {
|
|
134
|
+
out[normalizeStoragePath(p)] = verdictFor(p);
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
// `pathsKey` stands in for the (possibly inline) array identity,
|
|
138
|
+
// so a fresh-but-equal `paths` array doesn't churn the record.
|
|
139
|
+
}, [pathsKey, verdictFor]);
|
|
140
|
+
return {
|
|
141
|
+
status,
|
|
142
|
+
source: state.source,
|
|
143
|
+
advisory: false,
|
|
144
|
+
identity,
|
|
145
|
+
verdicts,
|
|
146
|
+
verdictFor,
|
|
147
|
+
error: state.error,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=useStorageRulesGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageRulesGate.js","sourceRoot":"","sources":["../../../src/storage/hooks/useStorageRulesGate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,oBAAoB,GAKrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA6FzD,2EAA2E;AAC3E,MAAM,SAAS,GAAuB,MAAM,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,EAAc;QACpB,KAAK,EAAE,EAAc;KACtB,CAAkC;CACpC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA2C,EAC3C,UAAsC,EAAE;IAExC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAEvF,MAAM,MAAM,GAAG,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAa,GAAG,EAAE,CAAC,CAAC;QACpD,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,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G,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACjE,MAAM,GAAG,GAAuC,EAAE,CAAC;QACnD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,CAAC;QACX,iEAAiE;QACjE,+DAA+D;IACjE,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,OAAO;QACL,MAAM;QACN,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK;QACf,QAAQ;QACR,QAAQ;QACR,UAAU;QACV,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the selection tracks per row — a structural subset of
|
|
3
|
+
* `StorageListEntry`, so `useStorageList`'s entries pass straight
|
|
4
|
+
* in. The `kind` decides the delete verb later (object →
|
|
5
|
+
* `deleteObject`, folder → recursive).
|
|
6
|
+
*/
|
|
7
|
+
export interface StorageSelectionEntry {
|
|
8
|
+
kind: 'folder' | 'object';
|
|
9
|
+
fullPath: string;
|
|
10
|
+
}
|
|
11
|
+
export interface UseStorageSelectionResult {
|
|
12
|
+
/** Selected entries in selection order. */
|
|
13
|
+
selected: StorageSelectionEntry[];
|
|
14
|
+
size: number;
|
|
15
|
+
isSelected: (fullPath: string) => boolean;
|
|
16
|
+
/** Add/remove — the checkbox verb. */
|
|
17
|
+
toggle: (entry: StorageSelectionEntry) => void;
|
|
18
|
+
select: (entry: StorageSelectionEntry) => void;
|
|
19
|
+
deselect: (fullPath: string) => void;
|
|
20
|
+
/** Replace the selection (e.g. a "select all" over
|
|
21
|
+
* `list.entries`). */
|
|
22
|
+
selectAll: (entries: StorageSelectionEntry[]) => void;
|
|
23
|
+
clear: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Multi-select state over storage rows, keyed by `fullPath`.
|
|
27
|
+
* Deliberately dumb: it doesn't watch the list, so clear it on path
|
|
28
|
+
* change (or after a bulk op via the delete hook's outcome) — the
|
|
29
|
+
* consumer owns that policy.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useStorageSelection(): UseStorageSelectionResult;
|
|
32
|
+
//# sourceMappingURL=useStorageSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageSelection.d.ts","sourceRoot":"","sources":["../../../src/storage/hooks/useStorageSelection.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,2CAA2C;IAC3C,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,sCAAsC;IACtC,MAAM,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/C,MAAM,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/C,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;2BACuB;IACvB,SAAS,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,KAAK,IAAI,CAAC;IACtD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,yBAAyB,CAuD/D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Multi-select state over storage rows, keyed by `fullPath`.
|
|
4
|
+
* Deliberately dumb: it doesn't watch the list, so clear it on path
|
|
5
|
+
* change (or after a bulk op via the delete hook's outcome) — the
|
|
6
|
+
* consumer owns that policy.
|
|
7
|
+
*/
|
|
8
|
+
export function useStorageSelection() {
|
|
9
|
+
const [map, setMap] = useState(() => new Map());
|
|
10
|
+
const isSelected = useCallback((fullPath) => map.has(fullPath), [map]);
|
|
11
|
+
const select = useCallback((entry) => {
|
|
12
|
+
setMap((prev) => {
|
|
13
|
+
if (prev.has(entry.fullPath))
|
|
14
|
+
return prev;
|
|
15
|
+
const next = new Map(prev);
|
|
16
|
+
next.set(entry.fullPath, entry);
|
|
17
|
+
return next;
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
const deselect = useCallback((fullPath) => {
|
|
21
|
+
setMap((prev) => {
|
|
22
|
+
if (!prev.has(fullPath))
|
|
23
|
+
return prev;
|
|
24
|
+
const next = new Map(prev);
|
|
25
|
+
next.delete(fullPath);
|
|
26
|
+
return next;
|
|
27
|
+
});
|
|
28
|
+
}, []);
|
|
29
|
+
const toggle = useCallback((entry) => {
|
|
30
|
+
setMap((prev) => {
|
|
31
|
+
const next = new Map(prev);
|
|
32
|
+
if (next.has(entry.fullPath))
|
|
33
|
+
next.delete(entry.fullPath);
|
|
34
|
+
else
|
|
35
|
+
next.set(entry.fullPath, entry);
|
|
36
|
+
return next;
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
const selectAll = useCallback((entries) => {
|
|
40
|
+
setMap(new Map(entries.map((e) => [e.fullPath, e])));
|
|
41
|
+
}, []);
|
|
42
|
+
const clear = useCallback(() => setMap(new Map()), []);
|
|
43
|
+
const selected = useMemo(() => [...map.values()], [map]);
|
|
44
|
+
return {
|
|
45
|
+
selected,
|
|
46
|
+
size: map.size,
|
|
47
|
+
isSelected,
|
|
48
|
+
toggle,
|
|
49
|
+
select,
|
|
50
|
+
deselect,
|
|
51
|
+
selectAll,
|
|
52
|
+
clear,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=useStorageSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageSelection.js","sourceRoot":"","sources":["../../../src/storage/hooks/useStorageSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA4BvD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAC5B,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAChB,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAC5B,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EACvC,CAAC,GAAG,CAAC,CACN,CAAC;IAEF,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,KAA4B,EAAE,EAAE;QAC1D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACd,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC1C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM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CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzD,OAAO;QACL,QAAQ;QACR,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU;QACV,MAAM;QACN,MAAM;QACN,QAAQ;QACR,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './hooks/index.js';
|
|
2
|
+
export { StorageApiProvider, useStorageApi, type StorageApi } from './storageApi.js';
|
|
3
|
+
export { PathBreadcrumb, type PathBreadcrumbProps, } from './components/PathBreadcrumb.js';
|
|
4
|
+
export { ObjectBrowser, type ObjectBrowserProps, } from './components/ObjectBrowser.js';
|
|
5
|
+
export { UploadDropzone, type UploadDropzoneProps, type DroppedFile, } from './components/UploadDropzone.js';
|
|
6
|
+
export { splitStorageName, parseCopyCounter, resolveCollision, planBatchNames, } from './collisionRename.js';
|
|
7
|
+
export { expandPathChain, initialPendingPrefixes, pendingPrefixReducer, pendingChildFolders, isPendingPrefix, folderInputError, type PendingPrefixState, type PendingPrefixAction, } from './pendingPrefixes.js';
|
|
8
|
+
export { defaultStoragePreviews, imagePreview, textPreview, selectStoragePreview, TEXT_PREVIEW_MAX_BYTES, type StoragePreview, type StoragePreviewContext, } from './previews.js';
|
|
9
|
+
export { ObjectInspector, type ObjectInspectorProps, } from './components/ObjectInspector.js';
|
|
10
|
+
export { DeleteSelectionWithConfirm, type DeleteSelectionWithConfirmProps, } from './components/DeleteSelectionWithConfirm.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAIjC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGrF,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './hooks/index.js';
|
|
2
|
+
// Injectable Storage API bundle (Pyric Studio data-backend swap): defaults to
|
|
3
|
+
// in-process `pyric/storage`; a consumer can provide the SharedWorker client.
|
|
4
|
+
export { StorageApiProvider, useStorageApi } from './storageApi.js';
|
|
5
|
+
// M2: navigation shell
|
|
6
|
+
export { PathBreadcrumb, } from './components/PathBreadcrumb.js';
|
|
7
|
+
export { ObjectBrowser, } from './components/ObjectBrowser.js';
|
|
8
|
+
// M3: upload
|
|
9
|
+
export { UploadDropzone, } from './components/UploadDropzone.js';
|
|
10
|
+
export { splitStorageName, parseCopyCounter, resolveCollision, planBatchNames, } from './collisionRename.js';
|
|
11
|
+
export { expandPathChain, initialPendingPrefixes, pendingPrefixReducer, pendingChildFolders, isPendingPrefix, folderInputError, } from './pendingPrefixes.js';
|
|
12
|
+
// M4: inspection, content-type preview registry + inspector
|
|
13
|
+
export { defaultStoragePreviews, imagePreview, textPreview, selectStoragePreview, TEXT_PREVIEW_MAX_BYTES, } from './previews.js';
|
|
14
|
+
export { ObjectInspector, } from './components/ObjectInspector.js';
|
|
15
|
+
// M6: bulk ops
|
|
16
|
+
export { DeleteSelectionWithConfirm, } from './components/DeleteSelectionWithConfirm.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,8EAA8E;AAC9E,8EAA8E;AAC9E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAmB,MAAM,iBAAiB,CAAC;AAErF,uBAAuB;AACvB,OAAO,EACL,cAAc,GAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,aAAa,GAEd,MAAM,+BAA+B,CAAC;AAEvC,aAAa;AACb,OAAO,EACL,cAAc,GAGf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,GAGjB,MAAM,sBAAsB,CAAC;AAE9B,4DAA4D;AAC5D,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,GAEhB,MAAM,iCAAiC,CAAC;AAEzC,eAAe;AACf,OAAO,EACL,0BAA0B,GAE3B,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending (not-yet-materialized) folder prefixes — pure reducer, no React.
|
|
3
|
+
*
|
|
4
|
+
* MECHANISM DECISION (create-folder). GCS has no real folders: a
|
|
5
|
+
* "folder" exists only as a shared prefix of object names. Two honest
|
|
6
|
+
* ways to let a user create one before it contains anything:
|
|
7
|
+
*
|
|
8
|
+
* a) write a zero-byte `<path>/` placeholder object (the emulator-UI
|
|
9
|
+
* convention — `useObjectUpload.createFolder` does this): the
|
|
10
|
+
* folder survives reloads, but every created folder deposits a
|
|
11
|
+
* phantom object in the sandbox store, and the Studio worker
|
|
12
|
+
* `StorageApi` path has no channel for the trailing-slash ref;
|
|
13
|
+
*
|
|
14
|
+
* b) hold the created prefix as CLIENT-SIDE PENDING STATE and let the
|
|
15
|
+
* first upload into it materialize it for real. The store stays
|
|
16
|
+
* byte-for-byte clean — nothing is written until a file is — at
|
|
17
|
+
* the cost that a created-then-abandoned empty folder disappears
|
|
18
|
+
* on reload.
|
|
19
|
+
*
|
|
20
|
+
* Studio's create-folder flow uses (b): the sandbox store is the
|
|
21
|
+
* user's actual data and must not accrue placeholder objects, and the
|
|
22
|
+
* disappearing-empty-folder tradeoff is acceptable BECAUSE the UI
|
|
23
|
+
* labels pending rows as session-only ("empty" badge + empty-state
|
|
24
|
+
* copy in `StoragePane`). (a) remains available to consumers who want
|
|
25
|
+
* persistent empty folders in sandbox-only setups.
|
|
26
|
+
*
|
|
27
|
+
* State is a sorted list of normalized bucket-rooted prefix paths (no
|
|
28
|
+
* trailing slashes). Creating `stuff/things/cool` expands the whole
|
|
29
|
+
* chain — `stuff`, `stuff/things`, `stuff/things/cool` — so every
|
|
30
|
+
* ancestor level shows the folder while browsing (VS Code-style nested
|
|
31
|
+
* create). A successful upload MATERIALIZES its destination folder:
|
|
32
|
+
* the chain up to that folder leaves pending state (the real listing
|
|
33
|
+
* now surfaces those prefixes); pending descendants of other branches
|
|
34
|
+
* stay.
|
|
35
|
+
*/
|
|
36
|
+
/** Sorted, deduped, normalized pending prefix paths. */
|
|
37
|
+
export type PendingPrefixState = readonly string[];
|
|
38
|
+
export type PendingPrefixAction =
|
|
39
|
+
/** Create a folder at `path` (absolute, bucket-rooted; nested paths
|
|
40
|
+
* allowed) — adds the full ancestor chain. */
|
|
41
|
+
{
|
|
42
|
+
type: 'create';
|
|
43
|
+
path: string;
|
|
44
|
+
}
|
|
45
|
+
/** An object now exists directly under `path`: drop `path` and its
|
|
46
|
+
* ancestors from pending (they are real prefixes now). */
|
|
47
|
+
| {
|
|
48
|
+
type: 'materialize';
|
|
49
|
+
path: string;
|
|
50
|
+
}
|
|
51
|
+
/** Remove a session-only folder and every pending descendant beneath it. */
|
|
52
|
+
| {
|
|
53
|
+
type: 'discard';
|
|
54
|
+
path: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'clear';
|
|
57
|
+
};
|
|
58
|
+
/** `'a/b/c'` → `['a', 'a/b', 'a/b/c']`; `''` → `[]`. */
|
|
59
|
+
export declare function expandPathChain(path: string): string[];
|
|
60
|
+
export declare const initialPendingPrefixes: PendingPrefixState;
|
|
61
|
+
export declare function pendingPrefixReducer(state: PendingPrefixState, action: PendingPrefixAction): PendingPrefixState;
|
|
62
|
+
/** Direct-child folder NAMES pending under `parentPath` (`''` = root),
|
|
63
|
+
* sorted. The chain expansion guarantees every level is present, so a
|
|
64
|
+
* simple parent match is exact. */
|
|
65
|
+
export declare function pendingChildFolders(state: PendingPrefixState, parentPath: string): string[];
|
|
66
|
+
/** Whether `path` itself is a pending (session-only) folder. */
|
|
67
|
+
export declare function isPendingPrefix(state: PendingPrefixState, path: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Validate a create-folder input (relative to the current folder;
|
|
70
|
+
* nested `a/b/c` allowed — VS Code semantics). Returns an error
|
|
71
|
+
* message or `null` when valid. Normalization tolerates stray/repeat
|
|
72
|
+
* slashes; `.`/`..` segments are rejected (GCS object names have no
|
|
73
|
+
* dot-segment semantics — accepting them would create unreachable
|
|
74
|
+
* names).
|
|
75
|
+
*/
|
|
76
|
+
export declare function folderInputError(input: string): string | null;
|
|
77
|
+
//# sourceMappingURL=pendingPrefixes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingPrefixes.d.ts","sourceRoot":"","sources":["../../src/storage/pendingPrefixes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAAG,SAAS,MAAM,EAAE,CAAC;AAEnD,MAAM,MAAM,mBAAmB;AAC7B;+CAC+C;AAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAClC;2DAC2D;GACzD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACvC,4EAA4E;GAC1E;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKtD;AAED,eAAO,MAAM,sBAAsB,EAAE,kBAAuB,CAAC;AAE7D,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,mBAAmB,GAC1B,kBAAkB,CAsBpB;AAED;;oCAEoC;AACpC,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,kBAAkB,EACzB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAMV;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ7D"}
|