@proteinjs/db-file 1.7.3 → 1.7.5

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/generated/index.js +1 -1
  3. package/dist/generated/index.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/src/FileReachabilityResolver.d.ts +27 -0
  9. package/dist/src/FileReachabilityResolver.d.ts.map +1 -0
  10. package/dist/src/FileReachabilityResolver.js +9 -0
  11. package/dist/src/FileReachabilityResolver.js.map +1 -0
  12. package/dist/src/FileStorage.d.ts +28 -3
  13. package/dist/src/FileStorage.d.ts.map +1 -1
  14. package/dist/src/FileStorage.js +72 -11
  15. package/dist/src/FileStorage.js.map +1 -1
  16. package/dist/src/routes/getFile.d.ts +4 -1
  17. package/dist/src/routes/getFile.d.ts.map +1 -1
  18. package/dist/src/routes/getFile.js +4 -1
  19. package/dist/src/routes/getFile.js.map +1 -1
  20. package/dist/test/FileByteAccess.test.d.ts +2 -0
  21. package/dist/test/FileByteAccess.test.d.ts.map +1 -0
  22. package/dist/test/FileByteAccess.test.js +252 -0
  23. package/dist/test/FileByteAccess.test.js.map +1 -0
  24. package/dist/test/FileSharedReachability.test.d.ts +2 -0
  25. package/dist/test/FileSharedReachability.test.d.ts.map +1 -0
  26. package/dist/test/FileSharedReachability.test.js +358 -0
  27. package/dist/test/FileSharedReachability.test.js.map +1 -0
  28. package/dist/test/FileTestEnvironment.d.ts.map +1 -1
  29. package/dist/test/FileTestEnvironment.js +4 -0
  30. package/dist/test/FileTestEnvironment.js.map +1 -1
  31. package/generated/index.ts +1 -1
  32. package/index.ts +1 -0
  33. package/package.json +2 -2
  34. package/src/FileReachabilityResolver.ts +29 -0
  35. package/src/FileStorage.ts +53 -4
  36. package/src/routes/getFile.ts +5 -2
  37. package/test/FileByteAccess.test.ts +143 -0
  38. package/test/FileSharedReachability.test.ts +229 -0
  39. package/test/FileTestEnvironment.ts +4 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.7.5](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.7.4...@proteinjs/db-file@1.7.5) (2026-08-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * file byte access gates on the file row — the browser-facing byte ops refuse ids whose row the caller cannot reach ([3ba4a7c](https://github.com/proteinjs/db/commit/3ba4a7cf50d5055998ea3ccc479068fe8262aad0))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.7.4](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.7.3...@proteinjs/db-file@1.7.4) (2026-08-28)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * file access derives from content access — shared-content reachability leg on the file read ([0f9a480](https://github.com/proteinjs/db/commit/0f9a48047971ba4381692420bb69e834ffa1d8e7))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [1.7.3](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.7.2...@proteinjs/db-file@1.7.3) (2026-08-28)
7
29
 
8
30
  **Note:** Version bump only for package @proteinjs/db-file
@@ -21,7 +21,7 @@ require("@proteinjs/server-api");
21
21
  require("@proteinjs/service");
22
22
  require("@proteinjs/user");
23
23
  /** Generate Source Graph */
24
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"DefaultFileStorageDriverFactory\",\"filePath\":\"src/FileStorage.ts\",\"qualifiedName\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"properties\":[],\"methods\":[{\"name\":\"getDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-file/FileStorage\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorage\",\"filePath\":\"src/FileStorage.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorage\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"driver\",\"type\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"serviceMetadata\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileMetaData\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getSignedUrl\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string | undefined>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string | undefined>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"{ ttlMs?: number }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/{ ttlMs?: number }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"deleteFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageService\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageService\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db-file/FileStorageService\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageService\",\"filePath\":\"src/services/FileStorageService.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorageService\",\"properties\":[],\"methods\":[{\"name\":\"createFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileMetaData\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"deleteFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageTableWatcher\",\"filePath\":\"src/FileStorageTableWatcher.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"name\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"table\",\"returnType\":{\"packageName\":\"\",\"name\":\"Table<File>\",\"filePath\":null,\"qualifiedName\":\"/Table<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"beforeDelete\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"recordsToDelete\",\"type\":{\"packageName\":\"\",\"name\":\"T[]\",\"filePath\":null,\"qualifiedName\":\"/T[]\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"initialQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"deleteQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"TableWatcher\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableWatcher\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/File\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/TableWatcher\"},{\"v\":\"@proteinjs/db-file/getFile\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"getFile\",\"filePath\":\"src/routes/getFile.ts\",\"qualifiedName\":\"@proteinjs/db-file/getFile\",\"type\":{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/Route\"},{\"v\":\"@proteinjs/service/Service\"},{\"v\":\"@proteinjs/db-file/FileData\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileData\",\"filePath\":\"src/tables/FileDataTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileData\",\"properties\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<File>\",\"filePath\":null,\"qualifiedName\":\"/Reference<File>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"order\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/ScopedRecord\"},{\"v\":\"@proteinjs/db-file/FileDataTable\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileDataTable\",\"filePath\":\"src/tables/FileDataTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileDataTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<FileData>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<FileData>['auth']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/FileData\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/db-file/File\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":\"src/tables/FileTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/File\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"type\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"size\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"preview\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<File>\",\"filePath\":null,\"qualifiedName\":\"/Reference<File>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"width\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"height\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"durationMs\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"sourceUrl\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"sourcePageUrl\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"retrievedAt\",\"type\":{\"packageName\":\"\",\"name\":\"Date\",\"filePath\":null,\"qualifiedName\":\"/Date\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"contentHash\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db-file/FileTable\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileTable\",\"filePath\":\"src/tables/FileTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<File>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<File>['auth']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"indexes\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/File\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileStorage\",\"w\":\"@proteinjs/db-file/FileStorageService\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"w\":\"@proteinjs/db/TableWatcher\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-file/getFile\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-file/FileStorageService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileData\",\"w\":\"@proteinjs/user/ScopedRecord\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileDataTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/db-file/File\",\"w\":\"@proteinjs/user/ScopedRecord\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"}]}";
24
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file/FileReachabilityResolver\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileReachabilityResolver\",\"filePath\":\"src/FileReachabilityResolver.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileReachabilityResolver\",\"properties\":[],\"methods\":[{\"name\":\"canReadViaReference\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<boolean>\",\"filePath\":null,\"qualifiedName\":\"/Promise<boolean>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"DefaultFileStorageDriverFactory\",\"filePath\":\"src/FileStorage.ts\",\"qualifiedName\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"properties\":[],\"methods\":[{\"name\":\"getDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db-file/FileStorage\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorage\",\"filePath\":\"src/FileStorage.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorage\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"driver\",\"type\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"serviceMetadata\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getDriver\",\"returnType\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"createFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileMetaData\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getSignedUrl\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string | undefined>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string | undefined>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"{ ttlMs?: number }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/{ ttlMs?: number }\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"deleteFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageService\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageService\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db-file/FileStorageService\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageService\",\"filePath\":\"src/services/FileStorageService.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorageService\",\"properties\":[],\"methods\":[{\"name\":\"createFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileMetaData\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<File>\",\"filePath\":null,\"qualifiedName\":\"/Promise<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<string>\",\"filePath\":null,\"qualifiedName\":\"/Promise<string>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFileData\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updateFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Omit<File, keyof ScopedRecord>\",\"filePath\":null,\"qualifiedName\":\"/Omit<File, keyof ScopedRecord>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"deleteFile\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageTableWatcher\",\"filePath\":\"src/FileStorageTableWatcher.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"name\",\"returnType\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"table\",\"returnType\":{\"packageName\":\"\",\"name\":\"Table<File>\",\"filePath\":null,\"qualifiedName\":\"/Table<File>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"beforeDelete\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"recordsToDelete\",\"type\":{\"packageName\":\"\",\"name\":\"T[]\",\"filePath\":null,\"qualifiedName\":\"/T[]\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"initialQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"deleteQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"TableWatcher\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/TableWatcher\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/File\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db/TableWatcher\"},{\"v\":\"@proteinjs/db-file/getFile\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"getFile\",\"filePath\":\"src/routes/getFile.ts\",\"qualifiedName\":\"@proteinjs/db-file/getFile\",\"type\":{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/Route\"},{\"v\":\"@proteinjs/db-file/FileData\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileData\",\"filePath\":\"src/tables/FileDataTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileData\",\"properties\":[{\"name\":\"file\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<File>\",\"filePath\":null,\"qualifiedName\":\"/Reference<File>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"order\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"data\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/ScopedRecord\"},{\"v\":\"@proteinjs/db-file/FileDataTable\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileDataTable\",\"filePath\":\"src/tables/FileDataTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileDataTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<FileData>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<FileData>['auth']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/FileData\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/db-file/File\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":\"src/tables/FileTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/File\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"type\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"size\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"preview\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<File>\",\"filePath\":null,\"qualifiedName\":\"/Reference<File>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"width\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"height\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"durationMs\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"sourceUrl\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"sourcePageUrl\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"retrievedAt\",\"type\":{\"packageName\":\"\",\"name\":\"Date\",\"filePath\":null,\"qualifiedName\":\"/Date\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"contentHash\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db-file/FileTable\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileTable\",\"filePath\":\"src/tables/FileTable.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<File>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<File>['auth']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"indexes\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/db-file/File\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/service/Service\"}],\"edges\":[{\"v\":\"@proteinjs/db-file/FileReachabilityResolver\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileStorage\",\"w\":\"@proteinjs/db-file/FileStorageService\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-file/FileStorageTableWatcher\",\"w\":\"@proteinjs/db/TableWatcher\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-file/getFile\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-file/FileData\",\"w\":\"@proteinjs/user/ScopedRecord\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileDataTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/db-file/File\",\"w\":\"@proteinjs/user/ScopedRecord\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file/FileTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/db-file/FileStorageService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"}]}";
25
25
  /** Generate Source Links */
26
26
  var FileStorage_1 = require("../src/FileStorage");
27
27
  var FileStorageTableWatcher_1 = require("../src/FileStorageTableWatcher");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,6BAA2B;AAC3B,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,80qBAA80qB,CAAC;AAGn2qB,4BAA4B;AAE5B,kDAAiD;AACjD,0EAAyE;AACzE,iDAAgD;AAChD,6DAA4D;AAC5D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,gCAAgC,EAAE,yBAAW;IAC7C,4CAA4C,EAAE,iDAAuB;IACrE,4BAA4B,EAAE,iBAAO;IACrC,kCAAkC,EAAE,6BAAa;IACjD,8BAA8B,EAAE,qBAAS;CACzC,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,6BAA2B;AAC3B,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,q/sBAAq/sB,CAAC;AAG1gtB,4BAA4B;AAE5B,kDAAiD;AACjD,0EAAyE;AACzE,iDAAgD;AAChD,6DAA4D;AAC5D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,gCAAgC,EAAE,yBAAW;IAC7C,4CAA4C,EAAE,iDAAuB;IACrE,4BAA4B,EAAE,iBAAO;IACrC,kCAAkC,EAAE,6BAAa;IACjD,8BAA8B,EAAE,qBAAS;CACzC,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './src/tables/FileTable';
4
4
  export * from './src/tables/FileDataTable';
5
5
  export * from './src/services/FileStorageService';
6
6
  export * from './src/routes/getFileRoute';
7
+ export * from './src/FileReachabilityResolver';
7
8
  export * from './src/FileStorageDriver';
8
9
  export * from './src/DbFileStorageDriver';
9
10
  export * from './src/FileStorageTableWatcher';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,mCAAmC,CAAC;AAElD,cAAc,2BAA2B,CAAC;AAE1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,mCAAmC,CAAC;AAElD,cAAc,2BAA2B,CAAC;AAE1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./src/tables/FileTable"), exports);
20
20
  __exportStar(require("./src/tables/FileDataTable"), exports);
21
21
  __exportStar(require("./src/services/FileStorageService"), exports);
22
22
  __exportStar(require("./src/routes/getFileRoute"), exports);
23
+ __exportStar(require("./src/FileReachabilityResolver"), exports);
23
24
  __exportStar(require("./src/FileStorageDriver"), exports);
24
25
  __exportStar(require("./src/DbFileStorageDriver"), exports);
25
26
  __exportStar(require("./src/FileStorageTableWatcher"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,oDAAkC;AAElC,sDAAoC;AACpC,yDAAuC;AACvC,6DAA2C;AAE3C,oEAAkD;AAElD,4DAA0C;AAE1C,0DAAwC;AACxC,4DAA0C;AAC1C,gEAA8C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,oDAAkC;AAElC,sDAAoC;AACpC,yDAAuC;AACvC,6DAA2C;AAE3C,oEAAkD;AAElD,4DAA0C;AAE1C,iEAA+C;AAC/C,0DAAwC;AACxC,4DAA0C;AAC1C,gEAA8C"}
@@ -0,0 +1,27 @@
1
+ import { Loadable } from '@proteinjs/reflection';
2
+ /**
3
+ * The shared-content file leg (SHARING_EXPANSION §1): the caller may read a file when they may
4
+ * read a row that references it. File rows are ScopedRecord — owner-private — but files get
5
+ * EMBEDDED in shareable content (a shared thought's media nodes), where the content's own access
6
+ * model says a share recipient may read them; a purely scoped row read as the access check
7
+ * refuses every recipient (the shared-thought media defect, SHARING_EXPANSION §0).
8
+ *
9
+ * Content packages register resolvers that answer reachability through their own GRANT-FILTERED
10
+ * reads — the same derivation the content itself is read through — so file access derives from
11
+ * content access, revocation included, and file scope is never widened. Dependency direction is
12
+ * the SharedThoughtResolver pattern: the interface lives here in db-file; implementations live
13
+ * in the content packages above (thought, later chat) and are discovered via SourceRepository.
14
+ *
15
+ * Consulted by `FileStorage.getFile` only after the caller's scoped read MISSES (the owner never
16
+ * pays for it), and it widens READS only: writes and deletes stay owner-scoped.
17
+ */
18
+ export interface FileReachabilityResolver extends Loadable {
19
+ /**
20
+ * True when the CURRENT session user can read a row that references this file. Implementations
21
+ * MUST resolve through their grant-filtered reads (e.g. the shared db) so a revoked grant
22
+ * closes file access the same moment it closes content access.
23
+ */
24
+ canReadViaReference(fileId: string): Promise<boolean>;
25
+ }
26
+ export declare const getFileReachabilityResolvers: () => FileReachabilityResolver[];
27
+ //# sourceMappingURL=FileReachabilityResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileReachabilityResolver.d.ts","sourceRoot":"","sources":["../../src/FileReachabilityResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,wBAAyB,SAAQ,QAAQ;IACxD;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,4BAA4B,kCACgE,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileReachabilityResolvers = void 0;
4
+ var reflection_1 = require("@proteinjs/reflection");
5
+ var getFileReachabilityResolvers = function () {
6
+ return reflection_1.SourceRepository.get().objects('@proteinjs/db-file/FileReachabilityResolver');
7
+ };
8
+ exports.getFileReachabilityResolvers = getFileReachabilityResolvers;
9
+ //# sourceMappingURL=FileReachabilityResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileReachabilityResolver.js","sourceRoot":"","sources":["../../src/FileReachabilityResolver.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AA2B5D,IAAM,4BAA4B,GAAG;IAC1C,OAAA,6BAAgB,CAAC,GAAG,EAAE,CAAC,OAAO,CAA2B,6CAA6C,CAAC;AAAvG,CAAuG,CAAC;AAD7F,QAAA,4BAA4B,gCACiE"}
@@ -41,21 +41,39 @@ export declare class FileStorage implements FileStorageService {
41
41
  */
42
42
  createFile(fileMetaData: Omit<File, keyof ScopedRecord>, fileData: string): Promise<File>;
43
43
  /**
44
- * Retrieves the metadata of a given file.
44
+ * Retrieves the metadata of a given file — THE file-read access decision every serving path
45
+ * derives from (`/file/:id`, signed-URL minting, the browser service).
46
+ *
47
+ * Two legs: the caller's own file resolves by the SCOPED read; when that misses, the
48
+ * shared-content leg asks the registered {@link FileReachabilityResolver}s whether the caller
49
+ * can read a row that REFERENCES the file (a shared thought's media node) — content access
50
+ * confers file access, through the content's own grant-filtered read, never by widening file
51
+ * scope. No resolver vouching means the miss stands. Reads only: writes/deletes stay scoped.
45
52
  * @param fileId - The `id` of the file.
46
- * @returns The file metadata.
53
+ * @returns The file metadata, or `undefined` when the caller can neither own nor reach it.
47
54
  */
48
55
  getFile(fileId: string): Promise<File>;
49
56
  /**
50
57
  * Retrieves the data chunks associated with a given file.
58
+ *
59
+ * Gated on the {@link getFile} row read — the same two-legged access decision every serving
60
+ * path derives from (the caller's SCOPED read, else shared-content reachability), so bytes are
61
+ * exactly as reachable as the row that names them. The gate lives here because this is the
62
+ * browser-facing service boundary (`FileStorageService` is `allUsers`) and the driver byte ops
63
+ * below are deliberately unscoped. Server-side doors that make their OWN documented access
64
+ * decision (the avatar route, issue/ticket attachment doors) read bytes through
65
+ * `FileStorage.getDriver()` instead.
51
66
  * @param fileId - The `id` of the file.
52
67
  * @returns The file data as a single string.
68
+ * @throws When the file row does not exist or is not readable by the caller — the same named
69
+ * miss either way, so existence is not leaked to unauthorized callers.
53
70
  */
54
71
  getFileData(fileId: string): Promise<string>;
55
72
  /**
56
73
  * Mint a short-lived, read-only URL for the file's bytes (server-only; not part of the
57
74
  * browser-facing `FileStorageService`). A signed URL is a bearer capability, so minting
58
- * verifies the caller can read the file row (scoped read) before signing.
75
+ * verifies the caller can read the file row (the two-legged {@link getFile} read own scope
76
+ * or shared-content reachability) before signing.
59
77
  * @param fileId - The `id` of the file.
60
78
  * @param options.ttlMs - How long the URL stays valid; the driver applies its default when omitted.
61
79
  * @returns The signed URL, or `undefined` when the driver has no external URL space
@@ -67,8 +85,15 @@ export declare class FileStorage implements FileStorageService {
67
85
  }): Promise<string | undefined>;
68
86
  /**
69
87
  * Updates the data chunks associated with a given file.
88
+ *
89
+ * Gated on the caller's SCOPED row read — owner scope is the write grant on ScopedRecords
90
+ * (the same authorization a scoped row update enforces). Deliberately STRICTER than
91
+ * {@link getFileData}: the {@link FileReachabilityResolver} leg widens READS only, so a
92
+ * share recipient who can read the bytes still cannot write them.
70
93
  * @param fileId - The `id` of the file.
71
94
  * @param data - The new data string to replace the existing data.
95
+ * @throws When the file row does not exist or is not writable by the caller — the same named
96
+ * miss either way, so existence is not leaked to unauthorized callers.
72
97
  */
73
98
  updateFileData(fileId: string, data: string): Promise<void>;
74
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"FileStorage.d.ts","sourceRoot":"","sources":["../../src/FileStorage.ts"],"names":[],"mappings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CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAc7F;;;;;;;;;;;OAWG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUjE;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrE;;;;;;OAMG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIhD"}
@@ -40,6 +40,7 @@ exports.FileStorage = exports.getFileStorage = void 0;
40
40
  var user_1 = require("@proteinjs/user");
41
41
  var tables_1 = require("./tables/tables");
42
42
  var FileStorageService_1 = require("./services/FileStorageService");
43
+ var FileReachabilityResolver_1 = require("./FileReachabilityResolver");
43
44
  var reflection_1 = require("@proteinjs/reflection");
44
45
  var logger_1 = require("@proteinjs/logger");
45
46
  var DbFileStorageDriver_1 = require("./DbFileStorageDriver");
@@ -110,36 +111,79 @@ var FileStorage = /** @class */ (function () {
110
111
  });
111
112
  };
112
113
  /**
113
- * Retrieves the metadata of a given file.
114
+ * Retrieves the metadata of a given file — THE file-read access decision every serving path
115
+ * derives from (`/file/:id`, signed-URL minting, the browser service).
116
+ *
117
+ * Two legs: the caller's own file resolves by the SCOPED read; when that misses, the
118
+ * shared-content leg asks the registered {@link FileReachabilityResolver}s whether the caller
119
+ * can read a row that REFERENCES the file (a shared thought's media node) — content access
120
+ * confers file access, through the content's own grant-filtered read, never by widening file
121
+ * scope. No resolver vouching means the miss stands. Reads only: writes/deletes stay scoped.
114
122
  * @param fileId - The `id` of the file.
115
- * @returns The file metadata.
123
+ * @returns The file metadata, or `undefined` when the caller can neither own nor reach it.
116
124
  */
117
125
  FileStorage.prototype.getFile = function (fileId) {
118
126
  return __awaiter(this, void 0, void 0, function () {
119
- var db, file;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
127
+ var db, file, _i, _a, resolver;
128
+ return __generator(this, function (_b) {
129
+ switch (_b.label) {
122
130
  case 0:
123
131
  db = (0, user_1.getScopedDb)();
124
132
  return [4 /*yield*/, db.get(tables_1.tables.File, { id: fileId })];
125
133
  case 1:
126
- file = _a.sent();
127
- return [2 /*return*/, file];
134
+ file = _b.sent();
135
+ if (file) {
136
+ return [2 /*return*/, file];
137
+ }
138
+ _i = 0, _a = (0, FileReachabilityResolver_1.getFileReachabilityResolvers)();
139
+ _b.label = 2;
140
+ case 2:
141
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
142
+ resolver = _a[_i];
143
+ return [4 /*yield*/, resolver.canReadViaReference(fileId)];
144
+ case 3:
145
+ if (!_b.sent()) return [3 /*break*/, 5];
146
+ return [4 /*yield*/, (0, user_1.getScopedDbAsSystem)().get(tables_1.tables.File, { id: fileId })];
147
+ case 4:
148
+ // Reachability established through the caller's grant-filtered content read — the row
149
+ // itself lives in the owner's scope, so it is served via system read.
150
+ return [2 /*return*/, _b.sent()];
151
+ case 5:
152
+ _i++;
153
+ return [3 /*break*/, 2];
154
+ case 6: return [2 /*return*/, file];
128
155
  }
129
156
  });
130
157
  });
131
158
  };
132
159
  /**
133
160
  * Retrieves the data chunks associated with a given file.
161
+ *
162
+ * Gated on the {@link getFile} row read — the same two-legged access decision every serving
163
+ * path derives from (the caller's SCOPED read, else shared-content reachability), so bytes are
164
+ * exactly as reachable as the row that names them. The gate lives here because this is the
165
+ * browser-facing service boundary (`FileStorageService` is `allUsers`) and the driver byte ops
166
+ * below are deliberately unscoped. Server-side doors that make their OWN documented access
167
+ * decision (the avatar route, issue/ticket attachment doors) read bytes through
168
+ * `FileStorage.getDriver()` instead.
134
169
  * @param fileId - The `id` of the file.
135
170
  * @returns The file data as a single string.
171
+ * @throws When the file row does not exist or is not readable by the caller — the same named
172
+ * miss either way, so existence is not leaked to unauthorized callers.
136
173
  */
137
174
  FileStorage.prototype.getFileData = function (fileId) {
138
175
  return __awaiter(this, void 0, void 0, function () {
176
+ var file;
139
177
  return __generator(this, function (_a) {
140
178
  switch (_a.label) {
141
- case 0: return [4 /*yield*/, FileStorage.getDriver().getFileData(fileId)];
142
- case 1: return [2 /*return*/, _a.sent()];
179
+ case 0: return [4 /*yield*/, this.getFile(fileId)];
180
+ case 1:
181
+ file = _a.sent();
182
+ if (!file) {
183
+ throw new Error("File not found: ".concat(fileId));
184
+ }
185
+ return [4 /*yield*/, FileStorage.getDriver().getFileData(fileId)];
186
+ case 2: return [2 /*return*/, _a.sent()];
143
187
  }
144
188
  });
145
189
  });
@@ -147,7 +191,8 @@ var FileStorage = /** @class */ (function () {
147
191
  /**
148
192
  * Mint a short-lived, read-only URL for the file's bytes (server-only; not part of the
149
193
  * browser-facing `FileStorageService`). A signed URL is a bearer capability, so minting
150
- * verifies the caller can read the file row (scoped read) before signing.
194
+ * verifies the caller can read the file row (the two-legged {@link getFile} read own scope
195
+ * or shared-content reachability) before signing.
151
196
  * @param fileId - The `id` of the file.
152
197
  * @param options.ttlMs - How long the URL stays valid; the driver applies its default when omitted.
153
198
  * @returns The signed URL, or `undefined` when the driver has no external URL space
@@ -177,15 +222,31 @@ var FileStorage = /** @class */ (function () {
177
222
  };
178
223
  /**
179
224
  * Updates the data chunks associated with a given file.
225
+ *
226
+ * Gated on the caller's SCOPED row read — owner scope is the write grant on ScopedRecords
227
+ * (the same authorization a scoped row update enforces). Deliberately STRICTER than
228
+ * {@link getFileData}: the {@link FileReachabilityResolver} leg widens READS only, so a
229
+ * share recipient who can read the bytes still cannot write them.
180
230
  * @param fileId - The `id` of the file.
181
231
  * @param data - The new data string to replace the existing data.
232
+ * @throws When the file row does not exist or is not writable by the caller — the same named
233
+ * miss either way, so existence is not leaked to unauthorized callers.
182
234
  */
183
235
  FileStorage.prototype.updateFileData = function (fileId, data) {
184
236
  return __awaiter(this, void 0, void 0, function () {
237
+ var db, file;
185
238
  return __generator(this, function (_a) {
186
239
  switch (_a.label) {
187
- case 0: return [4 /*yield*/, FileStorage.getDriver().updateFileData(fileId, data)];
240
+ case 0:
241
+ db = (0, user_1.getScopedDb)();
242
+ return [4 /*yield*/, db.get(tables_1.tables.File, { id: fileId })];
188
243
  case 1:
244
+ file = _a.sent();
245
+ if (!file) {
246
+ throw new Error("File not found: ".concat(fileId));
247
+ }
248
+ return [4 /*yield*/, FileStorage.getDriver().updateFileData(fileId, data)];
249
+ case 2:
189
250
  _a.sent();
190
251
  return [2 /*return*/];
191
252
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileStorage.js","sourceRoot":"","sources":["../../src/FileStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA4D;AAE5D,0CAAyC;AACzC,oEAA0F;AAE1F,oDAAmE;AACnE,4CAA2C;AAC3C,6DAA4D;AAE5D;;;KAGK;AACE,IAAM,cAAc,GAAG;IAC5B,OAAA,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAE,IAAA,0CAAqB,GAAkB;AAA1F,CAA0F,CAAC;AADhF,QAAA,cAAc,kBACkE;AAS7F;;;;GAIG;AACH;IAAA;QAGS,oBAAe,GAAG;YACvB,IAAI,EAAE;gBACJ,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAqHJ,CAAC;IAnHC;;;;;OAKG;IACI,qBAAS,GAAhB;QACE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACvB,IAAM,oBAAoB,GAAG,6BAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CACxD,oDAAoD,CACrD,CAAC;YACF,IAAI,oBAAoB,EAAE;gBACxB,WAAW,CAAC,MAAM,GAAG,oBAAoB,CAAC,SAAS,EAAE,CAAC;aACvD;iBAAM;gBACL,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC;oBACvC,OAAO,EAAE,2EAA2E;iBACrF,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hB,UAAiB,MAAc;;;;;;wBACvB,EAAE,GAAG,IAAA,kBAAW,GAAE,CAAC;wBACzB,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAA;;wBAA5C,SAA4C,CAAC;;;;;KAC9C;IACH,kBAAC;AAAD,CAAC,AA5KD,IA4KC;AA5KY,kCAAW"}
@@ -1,6 +1,9 @@
1
1
  import { Route } from '@proteinjs/server-api';
2
2
  /**
3
- * Serves a file's bytes. Auth first (logged-in + scoped row read), then one of two paths:
3
+ * Serves a file's bytes. Auth first: logged-in, then the `FileStorage.getFile` row read as the
4
+ * access decision — the caller's SCOPED read, else the shared-content reachability leg
5
+ * (`FileReachabilityResolver`: the caller may read a file when they may read a row that
6
+ * references it, e.g. a shared thought's media node). Then one of two serving paths:
4
7
  *
5
8
  * - **302 redirect** to a short-lived signed URL when the driver's store has an external URL
6
9
  * space (GCS). The app URL stays the one stable reference every `<img>`/`<video>`/chip uses;
@@ -1 +1 @@
1
- {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../../../src/routes/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,KAiDrB,CAAC"}
1
+ {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../../../src/routes/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK9C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO,EAAE,KAiDrB,CAAC"}
@@ -41,7 +41,10 @@ var FileStorage_1 = require("../FileStorage");
41
41
  var user_1 = require("@proteinjs/user");
42
42
  var byteRange_1 = require("./byteRange");
43
43
  /**
44
- * Serves a file's bytes. Auth first (logged-in + scoped row read), then one of two paths:
44
+ * Serves a file's bytes. Auth first: logged-in, then the `FileStorage.getFile` row read as the
45
+ * access decision — the caller's SCOPED read, else the shared-content reachability leg
46
+ * (`FileReachabilityResolver`: the caller may read a file when they may read a row that
47
+ * references it, e.g. a shared thought's media node). Then one of two serving paths:
45
48
  *
46
49
  * - **302 redirect** to a short-lived signed URL when the driver's store has an external URL
47
50
  * space (GCS). The app URL stays the one stable reference every `<img>`/`<video>`/chip uses;
@@ -1 +1 @@
1
- {"version":3,"file":"getFile.js","sourceRoot":"","sources":["../../../src/routes/getFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAgD;AAChD,wCAA2C;AAC3C,yCAA+C;AAE/C;;;;;;;;;;;;GAYG;AACU,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAO,OAAO,EAAE,QAAQ;;;;;;oBACjC,IAAI,CAAC,eAAQ,CAAC,UAAU,EAAE,EAAE;wBAC1B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;wBAChD,sBAAO;qBACR;oBAEK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC3B,WAAW,GAAG,IAAA,4BAAc,GAAE,CAAC;;;;oBAGtB,qBAAM,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;oBAAxC,IAAI,GAAG,SAAiC;oBAC9C,IAAI,CAAC,IAAI,EAAE;wBACT,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBAC5C,sBAAO;qBACR;oBAEiB,qBAAM,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,EAAA;;oBAAlD,SAAS,GAAG,SAAsC;oBACxD,IAAI,SAAS,EAAE;wBACb,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAAC;wBAC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