@proteinjs/db-file 1.4.15 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/generated/index.d.ts.map +1 -1
  3. package/dist/generated/index.js +3 -1
  4. package/dist/generated/index.js.map +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/src/DbFileStorageDriver.d.ts +2 -1
  10. package/dist/src/DbFileStorageDriver.d.ts.map +1 -1
  11. package/dist/src/DbFileStorageDriver.js +23 -7
  12. package/dist/src/DbFileStorageDriver.js.map +1 -1
  13. package/dist/src/FileStorage.d.ts +24 -6
  14. package/dist/src/FileStorage.d.ts.map +1 -1
  15. package/dist/src/FileStorage.js +57 -22
  16. package/dist/src/FileStorage.js.map +1 -1
  17. package/dist/src/FileStorageDriver.d.ts +26 -1
  18. package/dist/src/FileStorageDriver.d.ts.map +1 -1
  19. package/dist/src/FileStorageTableWatcher.d.ts +18 -0
  20. package/dist/src/FileStorageTableWatcher.d.ts.map +1 -0
  21. package/dist/src/FileStorageTableWatcher.js +96 -0
  22. package/dist/src/FileStorageTableWatcher.js.map +1 -0
  23. package/dist/src/routes/getFile.d.ts +11 -0
  24. package/dist/src/routes/getFile.d.ts.map +1 -1
  25. package/dist/src/routes/getFile.js +31 -15
  26. package/dist/src/routes/getFile.js.map +1 -1
  27. package/dist/src/tables/FileTable.d.ts +12 -4
  28. package/dist/src/tables/FileTable.d.ts.map +1 -1
  29. package/dist/src/tables/FileTable.js +5 -7
  30. package/dist/src/tables/FileTable.js.map +1 -1
  31. package/dist/test/FileMediaMetadata.test.d.ts +2 -0
  32. package/dist/test/FileMediaMetadata.test.d.ts.map +1 -0
  33. package/dist/test/FileMediaMetadata.test.js +154 -0
  34. package/dist/test/FileMediaMetadata.test.js.map +1 -0
  35. package/dist/test/FileStorageDeleteFile.test.d.ts +2 -0
  36. package/dist/test/FileStorageDeleteFile.test.d.ts.map +1 -0
  37. package/dist/test/FileStorageDeleteFile.test.js +259 -0
  38. package/dist/test/FileStorageDeleteFile.test.js.map +1 -0
  39. package/dist/test/FileTestEnvironment.d.ts +33 -0
  40. package/dist/test/FileTestEnvironment.d.ts.map +1 -0
  41. package/dist/test/FileTestEnvironment.js +229 -0
  42. package/dist/test/FileTestEnvironment.js.map +1 -0
  43. package/dist/test/GetFileRoute.test.d.ts +2 -0
  44. package/dist/test/GetFileRoute.test.d.ts.map +1 -0
  45. package/dist/test/GetFileRoute.test.js +432 -0
  46. package/dist/test/GetFileRoute.test.js.map +1 -0
  47. package/generated/index.ts +3 -1
  48. package/index.ts +1 -0
  49. package/jest.config.js +4 -0
  50. package/package.json +5 -3
  51. package/src/DbFileStorageDriver.ts +18 -8
  52. package/src/FileStorage.ts +48 -23
  53. package/src/FileStorageDriver.ts +24 -1
  54. package/src/FileStorageTableWatcher.ts +43 -0
  55. package/src/routes/getFile.ts +26 -8
  56. package/src/tables/FileTable.ts +14 -7
  57. package/test/FileMediaMetadata.test.ts +74 -0
  58. package/test/FileStorageDeleteFile.test.ts +128 -0
  59. package/test/FileTestEnvironment.ts +118 -0
  60. package/test/GetFileRoute.test.ts +258 -0
  61. package/test/emulatorLock.globalSetup.js +11 -0
  62. package/test/emulatorLock.globalTeardown.js +8 -0
  63. package/test/emulatorLock.js +124 -0
  64. package/test/setup.js +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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.5.0](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.4.15...@proteinjs/db-file@1.5.0) (2026-08-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * file bytes die with file rows — deleteFile is a required FileStorageDriver capability ([6d64305](https://github.com/proteinjs/db/commit/6d64305ec43cfaaa8aeb11490c548e803db8a14d))
12
+ * signed-URL file serving — GET /file/:id 302-redirects to the blob store, true bytes at rest, media metadata columns ([fa61db9](https://github.com/proteinjs/db/commit/fa61db9d11793a39ead08254d87c5168702b2035))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [1.4.15](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.4.14...@proteinjs/db-file@1.4.15) (2026-08-17)
7
19
 
8
20
  **Note:** Version bump only for package @proteinjs/db-file
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,QAAQ,CAAC;AA6BhB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,QAAQ,CAAC;AA+BhB,cAAc,UAAU,CAAC"}
@@ -23,14 +23,16 @@ require("@proteinjs/service");
23
23
  require("@proteinjs/user");
24
24
  require("moment");
25
25
  /** Generate Source Graph */
26
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"DefaultFileStorageDriverFactory\",\"filePath\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/src/FileStorage.ts\",\"qualifiedName\":\"@proteinjs/db-file/FileStorage\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"defaultDriver\",\"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\":\"driver\",\"type\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"logger\",\"type\":{\"packageName\":\"@proteinjs/logger\",\"name\":\"Logger\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/logger/Logger\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"serviceMetadata\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getDefaultDriver\",\"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\":false,\"visibility\":\"private\",\"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\":\"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\":\"/home/runner/work/db/db/packages/file/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/getFile\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"getFile\",\"filePath\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\"}],\"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\":\"/home/runner/work/db/db/packages/file/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\":\"cascadeDeleteReferences\",\"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/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\"}]}";
26
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file/DefaultFileStorageDriverFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"DefaultFileStorageDriverFactory\",\"filePath\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\":\"/home/runner/work/db/db/packages/file/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\"}],\"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\":\"/home/runner/work/db/db/packages/file/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\"}],\"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/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\"}]}";
27
27
  /** Generate Source Links */
28
28
  var FileStorage_1 = require("../src/FileStorage");
29
+ var FileStorageTableWatcher_1 = require("../src/FileStorageTableWatcher");
29
30
  var getFile_1 = require("../src/routes/getFile");
30
31
  var FileDataTable_1 = require("../src/tables/FileDataTable");
31
32
  var FileTable_1 = require("../src/tables/FileTable");
32
33
  var sourceLinks = {
33
34
  '@proteinjs/db-file/FileStorage': FileStorage_1.FileStorage,
35
+ '@proteinjs/db-file/FileStorageTableWatcher': FileStorageTableWatcher_1.FileStorageTableWatcher,
34
36
  '@proteinjs/db-file/getFile': getFile_1.getFile,
35
37
  '@proteinjs/db-file/FileDataTable': FileDataTable_1.FileDataTable,
36
38
  '@proteinjs/db-file/FileTable': FileTable_1.FileTable,
@@ -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,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,i4iBAAi4iB,CAAC;AAGt5iB,4BAA4B;AAE5B,kDAAiD;AACjD,iDAAgD;AAChD,6DAA4D;AAC5D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,gCAAgC,EAAE,yBAAW;IAC7C,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,iCAA+B;AAC/B,8BAA4B;AAC5B,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,4hpBAA4hpB,CAAC;AAGjjpB,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
@@ -6,4 +6,5 @@ export * from './src/services/FileStorageService';
6
6
  export * from './src/routes/getFileRoute';
7
7
  export * from './src/FileStorageDriver';
8
8
  export * from './src/DbFileStorageDriver';
9
+ export * from './src/FileStorageTableWatcher';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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"}
package/dist/index.js CHANGED
@@ -22,4 +22,5 @@ __exportStar(require("./src/services/FileStorageService"), exports);
22
22
  __exportStar(require("./src/routes/getFileRoute"), exports);
23
23
  __exportStar(require("./src/FileStorageDriver"), exports);
24
24
  __exportStar(require("./src/DbFileStorageDriver"), exports);
25
+ __exportStar(require("./src/FileStorageTableWatcher"), exports);
25
26
  //# sourceMappingURL=index.js.map
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"}
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"}
@@ -7,8 +7,9 @@ export declare class DbFileStorageDriver implements FileStorageDriver {
7
7
  */
8
8
  constructor(chunkSize?: number);
9
9
  createFile(file: File, fileData: string): Promise<void>;
10
- private splitIntoChunks;
11
10
  getFileData(fileId: string): Promise<string>;
12
11
  updateFileData(fileId: string, data: string): Promise<void>;
12
+ deleteFile(fileId: string): Promise<void>;
13
+ private splitIntoChunks;
13
14
  }
14
15
  //# sourceMappingURL=DbFileStorageDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DbFileStorageDriver.d.ts","sourceRoot":"","sources":["../../src/DbFileStorageDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,mBAAoB,YAAW,iBAAiB;IAC3D,OAAO,CAAC,SAAS,CAAW;IAE5B;;OAEG;gBACS,SAAS,CAAC,EAAE,MAAM;IAMxB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7D,OAAO,CAAC,eAAe;IAQjB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAe5C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBlE"}
1
+ {"version":3,"file":"DbFileStorageDriver.d.ts","sourceRoot":"","sources":["../../src/DbFileStorageDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,mBAAoB,YAAW,iBAAiB;IAC3D,OAAO,CAAC,SAAS,CAAW;IAE5B;;OAEG;gBACS,SAAS,CAAC,EAAE,MAAM;IAMxB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAavD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAe5C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/C,OAAO,CAAC,eAAe;CAOxB"}
@@ -79,13 +79,6 @@ var DbFileStorageDriver = /** @class */ (function () {
79
79
  });
80
80
  });
81
81
  };
82
- DbFileStorageDriver.prototype.splitIntoChunks = function (data) {
83
- var chunks = [];
84
- for (var i = 0; i < data.length; i += this.chunkSize) {
85
- chunks.push(data.substring(i, i + this.chunkSize));
86
- }
87
- return chunks;
88
- };
89
82
  DbFileStorageDriver.prototype.getFileData = function (fileId) {
90
83
  return __awaiter(this, void 0, void 0, function () {
91
84
  var db, qb, fileDataRecords;
@@ -137,6 +130,29 @@ var DbFileStorageDriver = /** @class */ (function () {
137
130
  });
138
131
  });
139
132
  };
133
+ DbFileStorageDriver.prototype.deleteFile = function (fileId) {
134
+ return __awaiter(this, void 0, void 0, function () {
135
+ var db, deleteQuery;
136
+ return __generator(this, function (_a) {
137
+ switch (_a.label) {
138
+ case 0:
139
+ db = (0, user_1.getScopedDbAsSystem)();
140
+ deleteQuery = new db_1.QueryBuilderFactory().getQueryBuilder(tables_1.tables.FileData, { file: fileId });
141
+ return [4 /*yield*/, db.delete(tables_1.tables.FileData, deleteQuery)];
142
+ case 1:
143
+ _a.sent();
144
+ return [2 /*return*/];
145
+ }
146
+ });
147
+ });
148
+ };
149
+ DbFileStorageDriver.prototype.splitIntoChunks = function (data) {
150
+ var chunks = [];
151
+ for (var i = 0; i < data.length; i += this.chunkSize) {
152
+ chunks.push(data.substring(i, i + this.chunkSize));
153
+ }
154
+ return chunks;
155
+ };
140
156
  return DbFileStorageDriver;
141
157
  }());
142
158
  exports.DbFileStorageDriver = DbFileStorageDriver;
@@ -1 +1 @@
1
- {"version":3,"file":"DbFileStorageDriver.js","sourceRoot":"","sources":["../../src/DbFileStorageDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAmE;AACnE,oCAA+D;AAE/D,0CAAyC;AAGzC;IAGE;;OAEG;IACH,6BAAY,SAAkB;QALtB,cAAS,GAAG,OAAO,CAAC,CAAC,sDAAsD;QAMjF,IAAI,SAAS,IAAI,SAAS,EAAE;YAC1B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;SAC5B;IACH,CAAC;IAEK,wCAAU,GAAhB,UAAiB,IAAU,EAAE,QAAgB;;;;;;wBACrC,EAAE,GAAG,IAAA,kBAAW,GAAE,CAAC;wBACnB,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;wBACrC,KAAK,GAAG,CAAC;;;6BAAE,CAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAA;wBACjC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;wBAC5B,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,QAAQ,EAAE;gCAC/B,IAAI,EAAE,IAAI,cAAS,CAAC,eAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;gCAClD,KAAK,EAAE,KAAK;gCACZ,IAAI,EAAE,KAAK;6BACZ,CAAC,EAAA;;wBAJF,SAIE,CAAC;;;wBANsC,KAAK,EAAE,CAAA;;;;;;KAQnD;IAEO,6CAAe,GAAvB,UAAwB,IAAY;QAClC,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,K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BAC5B,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,QAAQ,EAAE;gCAC/B,IAAI,EAAE,IAAI,cAAS,CAAC,eAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gCACjD,KAAK,EAAE,KAAK;gCACZ,IAAI,EAAE,KAAK;6BACZ,CAAC,EAAA;;wBAJF,SAIE,CAAC;;;wBANsC,KAAK,EAAE,CAAA;;;;;;KAQnD;IAEK,wCAAU,GAAhB,UAAiB,MAAc;;;;;;wBAKvB,EAAE,GAAG,IAAA,0BAAmB,GAAE,CAAC;wBAC3B,WAAW,GAAG,IAAI,wBAAmB,EAAE,CAAC,eAAe,CAAC,eAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;wBACjG,qBAAM,EAAE,CAAC,MAAM,CAAC,eAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAA;;wBAA7C,SAA6C,CAAC;;;;;KAC/C;IAEO,6CAAe,GAAvB,UAAwB,IAAY;QAClC,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE;YACpD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;SACpD;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,0BAAC;AAAD,CAAC,AA5ED,IA4EC;AA5EY,kDAAmB"}
@@ -20,16 +20,19 @@ export interface DefaultFileStorageDriverFactory extends Loadable {
20
20
  * File data is stored by the `FileStorageDriver`.
21
21
  */
22
22
  export declare class FileStorage implements FileStorageService {
23
- private static defaultDriver;
24
- private driver;
25
- private logger;
23
+ private static driver;
26
24
  serviceMetadata: {
27
25
  auth: {
28
26
  allUsers: boolean;
29
27
  };
30
28
  };
31
- constructor(driver?: FileStorageDriver);
32
- private getDefaultDriver;
29
+ /**
30
+ * The `FileStorageDriver` for this process — provided by the `DefaultFileStorageDriverFactory`
31
+ * implementation, defaulting to the `DbFileStorageDriver`. One resolution for every byte
32
+ * operation (`FileStorage` and `FileStorageTableWatcher`), so bytes always live and die in the
33
+ * same store.
34
+ */
35
+ static getDriver(): FileStorageDriver;
33
36
  /**
34
37
  * Creates a new file record and its associated data chunks.
35
38
  * @param fileMetaData - The file metadata (name, type, size).
@@ -49,6 +52,19 @@ export declare class FileStorage implements FileStorageService {
49
52
  * @returns The file data as a single string.
50
53
  */
51
54
  getFileData(fileId: string): Promise<string>;
55
+ /**
56
+ * Mint a short-lived, read-only URL for the file's bytes (server-only; not part of the
57
+ * 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.
59
+ * @param fileId - The `id` of the file.
60
+ * @param options.ttlMs - How long the URL stays valid; the driver applies its default when omitted.
61
+ * @returns The signed URL, or `undefined` when the driver has no external URL space
62
+ * (`DbFileStorageDriver`) — the caller then serves bytes through the proxy route.
63
+ * @throws When the file row does not exist or is not readable by the caller.
64
+ */
65
+ getSignedUrl(fileId: string, options?: {
66
+ ttlMs?: number;
67
+ }): Promise<string | undefined>;
52
68
  /**
53
69
  * Updates the data chunks associated with a given file.
54
70
  * @param fileId - The `id` of the file.
@@ -62,7 +78,9 @@ export declare class FileStorage implements FileStorageService {
62
78
  updateFile(file: Omit<File, keyof ScopedRecord>): Promise<void>;
63
79
  /**
64
80
  * Deletes a file and its data.
65
- * The file data is deleted by a cascade delete rule defined on the `FileTable`
81
+ * The file data is deleted by the `FileStorageTableWatcher` when the row delete runs the
82
+ * watcher fires for every file-row delete path (this one, reference cascades, system sweeps),
83
+ * so the bytes die with the row no matter where the delete originates.
66
84
  * @param fileId - The `id` of the file to delete.
67
85
  */
68
86
  deleteFile(fileId: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"F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AIG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;;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"}
@@ -57,27 +57,33 @@ exports.getFileStorage = getFileStorage;
57
57
  * File data is stored by the `FileStorageDriver`.
58
58
  */
59
59
  var FileStorage = /** @class */ (function () {
60
- function FileStorage(driver) {
61
- this.logger = new logger_1.Logger({ name: this.constructor.name });
60
+ function FileStorage() {
62
61
  this.serviceMetadata = {
63
62
  auth: {
64
63
  allUsers: true,
65
64
  },
66
65
  };
67
- this.driver = driver ? driver : this.getDefaultDriver();
68
66
  }
69
- FileStorage.prototype.getDefaultDriver = function () {
70
- if (!FileStorage.defaultDriver) {
67
+ /**
68
+ * The `FileStorageDriver` for this process — provided by the `DefaultFileStorageDriverFactory`
69
+ * implementation, defaulting to the `DbFileStorageDriver`. One resolution for every byte
70
+ * operation (`FileStorage` and `FileStorageTableWatcher`), so bytes always live and die in the
71
+ * same store.
72
+ */
73
+ FileStorage.getDriver = function () {
74
+ if (!FileStorage.driver) {
71
75
  var defaultDriverFactory = reflection_1.SourceRepository.get().object('@proteinjs/db-file/DefaultFileStorageDriverFactory');
72
76
  if (defaultDriverFactory) {
73
- FileStorage.defaultDriver = defaultDriverFactory.getDriver();
77
+ FileStorage.driver = defaultDriverFactory.getDriver();
74
78
  }
75
79
  else {
76
- this.logger.info({ message: "Defaulting to DbFileStorageDriver since no FileStorageDriver was provided" });
77
- FileStorage.defaultDriver = new DbFileStorageDriver_1.DbFileStorageDriver();
80
+ new logger_1.Logger({ name: 'FileStorage' }).info({
81
+ message: "Defaulting to DbFileStorageDriver since no FileStorageDriver was provided",
82
+ });
83
+ FileStorage.driver = new DbFileStorageDriver_1.DbFileStorageDriver();
78
84
  }
79
85
  }
80
- return FileStorage.defaultDriver;
86
+ return FileStorage.driver;
81
87
  };
82
88
  /**
83
89
  * Creates a new file record and its associated data chunks.
@@ -95,7 +101,7 @@ var FileStorage = /** @class */ (function () {
95
101
  return [4 /*yield*/, db.insert(tables_1.tables.File, fileMetaData)];
96
102
  case 1:
97
103
  file = _a.sent();
98
- return [4 /*yield*/, this.driver.createFile(file, fileData)];
104
+ return [4 /*yield*/, FileStorage.getDriver().createFile(file, fileData)];
99
105
  case 2:
100
106
  _a.sent();
101
107
  return [2 /*return*/, file];
@@ -132,12 +138,43 @@ var FileStorage = /** @class */ (function () {
132
138
  return __awaiter(this, void 0, void 0, function () {
133
139
  return __generator(this, function (_a) {
134
140
  switch (_a.label) {
135
- case 0: return [4 /*yield*/, this.driver.getFileData(fileId)];
141
+ case 0: return [4 /*yield*/, FileStorage.getDriver().getFileData(fileId)];
136
142
  case 1: return [2 /*return*/, _a.sent()];
137
143
  }
138
144
  });
139
145
  });
140
146
  };
147
+ /**
148
+ * Mint a short-lived, read-only URL for the file's bytes (server-only; not part of the
149
+ * 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.
151
+ * @param fileId - The `id` of the file.
152
+ * @param options.ttlMs - How long the URL stays valid; the driver applies its default when omitted.
153
+ * @returns The signed URL, or `undefined` when the driver has no external URL space
154
+ * (`DbFileStorageDriver`) — the caller then serves bytes through the proxy route.
155
+ * @throws When the file row does not exist or is not readable by the caller.
156
+ */
157
+ FileStorage.prototype.getSignedUrl = function (fileId, options) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var file, driver;
160
+ return __generator(this, function (_a) {
161
+ switch (_a.label) {
162
+ case 0: return [4 /*yield*/, this.getFile(fileId)];
163
+ case 1:
164
+ file = _a.sent();
165
+ if (!file) {
166
+ throw new Error("File not found: ".concat(fileId));
167
+ }
168
+ driver = FileStorage.getDriver();
169
+ if (!driver.getSignedUrl) {
170
+ return [2 /*return*/, undefined];
171
+ }
172
+ return [4 /*yield*/, driver.getSignedUrl(fileId, options)];
173
+ case 2: return [2 /*return*/, _a.sent()];
174
+ }
175
+ });
176
+ });
177
+ };
141
178
  /**
142
179
  * Updates the data chunks associated with a given file.
143
180
  * @param fileId - The `id` of the file.
@@ -147,7 +184,7 @@ var FileStorage = /** @class */ (function () {
147
184
  return __awaiter(this, void 0, void 0, function () {
148
185
  return __generator(this, function (_a) {
149
186
  switch (_a.label) {
150
- case 0: return [4 /*yield*/, this.driver.updateFileData(fileId, data)];
187
+ case 0: return [4 /*yield*/, FileStorage.getDriver().updateFileData(fileId, data)];
151
188
  case 1:
152
189
  _a.sent();
153
190
  return [2 /*return*/];
@@ -161,7 +198,7 @@ var FileStorage = /** @class */ (function () {
161
198
  */
162
199
  FileStorage.prototype.updateFile = function (file) {
163
200
  return __awaiter(this, void 0, void 0, function () {
164
- var db;
201
+ var db, driver;
165
202
  return __generator(this, function (_a) {
166
203
  switch (_a.label) {
167
204
  case 0:
@@ -169,8 +206,9 @@ var FileStorage = /** @class */ (function () {
169
206
  return [4 /*yield*/, db.update(tables_1.tables.File, file)];
170
207
  case 1:
171
208
  _a.sent();
172
- if (!this.driver.updateFile) return [3 /*break*/, 3];
173
- return [4 /*yield*/, this.driver.updateFile(file)];
209
+ driver = FileStorage.getDriver();
210
+ if (!driver.updateFile) return [3 /*break*/, 3];
211
+ return [4 /*yield*/, driver.updateFile(file)];
174
212
  case 2:
175
213
  _a.sent();
176
214
  _a.label = 3;
@@ -181,7 +219,9 @@ var FileStorage = /** @class */ (function () {
181
219
  };
182
220
  /**
183
221
  * Deletes a file and its data.
184
- * The file data is deleted by a cascade delete rule defined on the `FileTable`
222
+ * The file data is deleted by the `FileStorageTableWatcher` when the row delete runs the
223
+ * watcher fires for every file-row delete path (this one, reference cascades, system sweeps),
224
+ * so the bytes die with the row no matter where the delete originates.
185
225
  * @param fileId - The `id` of the file to delete.
186
226
  */
187
227
  FileStorage.prototype.deleteFile = function (fileId) {
@@ -191,13 +231,8 @@ var FileStorage = /** @class */ (function () {
191
231
  switch (_a.label) {
192
232
  case 0:
193
233
  db = (0, user_1.getScopedDb)();
194
- if (!this.driver.deleteFile) return [3 /*break*/, 2];
195
- return [4 /*yield*/, this.driver.deleteFile(fileId)];
234
+ return [4 /*yield*/, db.delete(tables_1.tables.File, { id: fileId })];
196
235
  case 1:
197
- _a.sent();
198
- _a.label = 2;
199
- case 2: return [4 /*yield*/, db.delete(tables_1.tables.File, { id: fileId })];
200
- case 3:
201
236
  _a.sent();
202
237
  return [2 /*return*/];
203
238
  }
@@ -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;IAWE,qBAAY,MAA0B;QAR9B,WAAM,GAAW,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9D,oBAAe,GAAG;YACvB,IAAI,EAAE;gBACJ,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;QAGA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1D,CAAC;IAEO,sCAAgB,GAAxB;QACE,IAAI,CAAC,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C,SAAS,EAAE,CAAC;6BACnC,MAAM,CAAC,UAAU,EAAjB,wBAAiB;wBACnB,qBAAM,MAAM,CAAC,UAAU,CAAC,IAAY,CAAC,EAAA;;wBAArC,SAAqC,CAAC;;;;;;KAEzC;IAED;;;;;;OAMG;IACG,gCAAU,GAAhB,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,AA5HD,IA4HC;AA5HY,kCAAW"}
@@ -1,9 +1,34 @@
1
1
  import { File } from './tables/FileTable';
2
+ /**
3
+ * Byte store behind `FileStorage`.
4
+ *
5
+ * Encoding contract: every `fileData`/`data` string crossing this interface is BASE64 of the
6
+ * file's true bytes — for text and binary files alike. Drivers own their at-rest representation,
7
+ * with one hard requirement: a driver that serves blobs directly to clients (`getSignedUrl`)
8
+ * MUST store the true bytes at rest, because clients read its objects without any decode step.
9
+ */
2
10
  export interface FileStorageDriver {
3
11
  createFile(file: File, fileData: string): Promise<void>;
4
12
  getFileData(fileId: string): Promise<string>;
5
13
  updateFileData(fileId: string, data: string): Promise<void>;
6
14
  updateFile?(file: File): Promise<void>;
7
- deleteFile?(fileId: string): Promise<void>;
15
+ /**
16
+ * Mint a short-lived, read-only URL for the file's bytes, when the driver's store has an
17
+ * external URL space (e.g. GCS signed URLs). Serving rides this: `GET /file/:id` 302-redirects
18
+ * to the minted URL, so clients get native Range/seek and caching and bytes stop transiting
19
+ * the app server. Absent on drivers with no external URL space (`DbFileStorageDriver`) — their
20
+ * bytes serve through the proxy route.
21
+ */
22
+ getSignedUrl?(fileId: string, options?: {
23
+ ttlMs?: number;
24
+ }): Promise<string>;
25
+ /**
26
+ * Delete the stored bytes for `fileId`.
27
+ *
28
+ * Contract: idempotent on the goal state — bytes already gone is success, since file-row
29
+ * deletes are retryable (a re-run after a half-completed prior attempt must not wedge on the
30
+ * missing bytes). Every other failure throws loudly; the file row survives to drive a retry.
31
+ */
32
+ deleteFile(fileId: string): Promise<void>;
8
33
  }
9
34
  //# sourceMappingURL=FileStorageDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileStorageDriver.d.ts","sourceRoot":"","sources":["../../src/FileStorageDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C"}
1
+ {"version":3,"file":"FileStorageDriver.d.ts","sourceRoot":"","sources":["../../src/FileStorageDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC;;;;;;OAMG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,18 @@
1
+ import { QueryBuilder, Table, TableWatcher } from '@proteinjs/db';
2
+ import { File } from './tables/FileTable';
3
+ /**
4
+ * Deletes stored file bytes whenever file rows are deleted. Lives at the Db layer so every
5
+ * delete path reaches the byte store — `FileStorage.deleteFile`, reference cascades (e.g.
6
+ * `file.preview`), and system sweeps that delete file rows directly.
7
+ *
8
+ * Bytes go first (`beforeDelete`): if the byte delete fails, the row survives to drive a retry;
9
+ * the reverse order would strand bytes with no row left to retry from. A retried delete is safe
10
+ * because `FileStorageDriver.deleteFile` is idempotent on the goal state.
11
+ */
12
+ export declare class FileStorageTableWatcher implements TableWatcher<File> {
13
+ private logger;
14
+ name(): string;
15
+ table(): Table<File>;
16
+ beforeDelete<T extends File>(recordsToDelete: T[], initialQb: QueryBuilder<T>, deleteQb: QueryBuilder<T>): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=FileStorageTableWatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileStorageTableWatcher.d.ts","sourceRoot":"","sources":["../../src/FileStorageTableWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,IAAI,EAAa,MAAM,oBAAoB,CAAC;AAGrD;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,YAAY,CAAC,IAAI,CAAC;IAChE,OAAO,CAAC,MAAM,CAA+C;IAE7D,IAAI,IAAI,MAAM;IAId,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC;IAId,YAAY,CAAC,CAAC,SAAS,IAAI,EAC/B,eAAe,EAAE,CAAC,EAAE,EACpB,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAC1B,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC;CAajB"}