@proteinjs/db-file-storage-driver-gcs 1.4.33 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
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.1](https://github.com/proteinjs/db/compare/@proteinjs/db-file-storage-driver-gcs@1.5.0...@proteinjs/db-file-storage-driver-gcs@1.5.1) (2026-09-25)
7
+
8
+ **Note:** Version bump only for package @proteinjs/db-file-storage-driver-gcs
9
+
10
+
11
+
12
+
13
+
14
+ # [1.5.0](https://github.com/proteinjs/db/compare/@proteinjs/db-file-storage-driver-gcs@1.4.33...@proteinjs/db-file-storage-driver-gcs@1.5.0) (2026-09-25)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **db-file-storage-driver-gcs:** no storage-client error leaves the driver — its errors carried the access token ([ddb487a](https://github.com/proteinjs/db/commit/ddb487a42568a2a6b9221efc2a5a90d034edf9c9))
20
+ * **file-storage-driver-gcs:** a byte overwrite keeps the object's content type and metadata — updateFileData restates the object's own content type, cache, disposition and language headers and its custom metadata (size restated for the new bytes), pinned to the generation it read ([d16bc4a](https://github.com/proteinjs/db/commit/d16bc4a104291005d8ea66979e3ddfef47b58f3f))
21
+
22
+
23
+ ### Features
24
+
25
+ * **db-file-storage-driver-gcs:** an objectPrefix option — several deployments share one bucket, every operation names its object through one owner ([e739875](https://github.com/proteinjs/db/commit/e73987568322dacfc4fdcfd1a84d18b44240329a))
26
+
27
+
28
+
29
+
30
+
6
31
  ## [1.4.33](https://github.com/proteinjs/db/compare/@proteinjs/db-file-storage-driver-gcs@1.4.32...@proteinjs/db-file-storage-driver-gcs@1.4.33) (2026-09-24)
7
32
 
8
33
  **Note:** Version bump only for package @proteinjs/db-file-storage-driver-gcs
package/README.md CHANGED
@@ -34,3 +34,17 @@ export class FileStorageDriverFactory implements DefaultFileStorageDriverFactory
34
34
  }
35
35
  }
36
36
  ```
37
+
38
+ ## Sharing one bucket
39
+
40
+ Set `objectPrefix` to keep the files of several independent deployments apart inside one bucket. Every object the driver writes, reads, signs or deletes is named `<objectPrefix><file id>`, so one deployment's files can be listed or removed as a group by their prefix. The prefix is used verbatim — include the separator yourself.
41
+
42
+ ```typescript
43
+ new GoogleCloudStorageDriver({
44
+ projectId: 'your-project-id',
45
+ bucketName: 'your-bucket-name',
46
+ objectPrefix: 'deployment-a/',
47
+ });
48
+ ```
49
+
50
+ Leave it unset and an object is named by the file id alone. Changing the prefix of a deployment that already holds files does not move them.
@@ -19,7 +19,7 @@ require("@proteinjs/db");
19
19
  require("@proteinjs/db-file");
20
20
  require("@proteinjs/logger");
21
21
  /** Generate Source Graph */
22
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"DefaultGoogleCloudStorageConfigFactory\",\"filePath\":\"src/DefaultGoogleCloudStorageConfigFactory.ts\",\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig\",\"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-storage-driver-gcs/GoogleCloudStorageDriver\",\"value\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageDriver\",\"filePath\":\"src/GoogleCloudStorageDriver.ts\",\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"storage\",\"type\":{\"packageName\":\"@google-cloud/storage\",\"name\":\"Storage\",\"filePath\":null,\"qualifiedName\":\"@google-cloud/storage/Storage\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"bucketName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createFile\",\"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\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/File\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"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\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/File\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getSignedUrl\",\"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\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"{ ttlMs?: number }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/{ ttlMs?: number }\",\"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}}]},{\"name\":\"getDefaultConfig\",\"returnType\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db-file/FileStorageDriver\"}],\"edges\":[{\"v\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver\",\"w\":\"@proteinjs/db-file/FileStorageDriver\",\"value\":\"implements interface\"}]}";
22
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"DefaultGoogleCloudStorageConfigFactory\",\"filePath\":\"src/DefaultGoogleCloudStorageConfigFactory.ts\",\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig\",\"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-storage-driver-gcs/GoogleCloudStorageDriver\",\"value\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageDriver\",\"filePath\":\"src/GoogleCloudStorageDriver.ts\",\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"storage\",\"type\":{\"packageName\":\"@google-cloud/storage\",\"name\":\"Storage\",\"filePath\":null,\"qualifiedName\":\"@google-cloud/storage/Storage\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"bucketName\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"objectPrefix\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"createFile\",\"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\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/File\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileData\",\"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\":\"@proteinjs/db-file\",\"name\":\"File\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/File\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getSignedUrl\",\"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\":\"options\",\"type\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"{ ttlMs?: number }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/{ ttlMs?: number }\",\"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}}]},{\"name\":\"object\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"guarded\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"operation\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"call\",\"type\":{\"packageName\":\"\",\"name\":\"() => Promise<T>\",\"filePath\":null,\"qualifiedName\":\"/() => Promise<T>\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"driverError\",\"returnType\":{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageError\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageError\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"operation\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"fileId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"clientError\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"httpStatus\",\"returnType\":{\"packageName\":\"\",\"name\":\"number | undefined\",\"filePath\":null,\"qualifiedName\":\"/number | undefined\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"clientError\",\"type\":{\"packageName\":\"\",\"name\":\"unknown\",\"filePath\":null,\"qualifiedName\":\"/unknown\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getDefaultConfig\",\"returnType\":{\"packageName\":\"@proteinjs/db-file-storage-driver-gcs\",\"name\":\"GoogleCloudStorageConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/db-file\",\"name\":\"FileStorageDriver\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-file/FileStorageDriver\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/db-file/FileStorageDriver\"}],\"edges\":[{\"v\":\"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver\",\"w\":\"@proteinjs/db-file/FileStorageDriver\",\"value\":\"implements interface\"}]}";
23
23
  /** Generate Source Links */
24
24
  var GoogleCloudStorageDriver_1 = require("../src/GoogleCloudStorageDriver");
25
25
  var sourceLinks = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,8BAA4B;AAC5B,6BAA2B;AAG3B,4BAA4B;AAE5B,IAAM,WAAW,GAAG,4uNAA4uN,CAAC;AAGjwN,4BAA4B;AAE5B,4EAA2E;AAE3E,IAAM,WAAW,GAAG;IACnB,gEAAgE,EAAE,mDAAwB;CAC1F,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,8BAA4B;AAC5B,6BAA2B;AAG3B,4BAA4B;AAE5B,IAAM,WAAW,GAAG,q+SAAq+S,CAAC;AAG1/S,4BAA4B;AAE5B,4EAA2E;AAE3E,IAAM,WAAW,GAAG;IACnB,gEAAgE,EAAE,mDAAwB;CAC1F,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
@@ -4,6 +4,13 @@ export declare const getDefaultGoogleCloudStorageConfigFactory: () => DefaultGoo
4
4
  export type GoogleCloudStorageConfig = {
5
5
  bucketName: string;
6
6
  projectId: string;
7
+ /**
8
+ * Prepended, verbatim, to the name of every object this driver writes, reads, signs or deletes
9
+ * (`<objectPrefix><file id>`). Lets several independent deployments share one bucket while each
10
+ * deployment's files stay listable and removable as a group. Include the separator yourself
11
+ * (`'deployment-a/'`). Unset: an object is named by the file id alone.
12
+ */
13
+ objectPrefix?: string;
7
14
  storageOptions?: StorageOptions;
8
15
  };
9
16
  export interface DefaultGoogleCloudStorageConfigFactory extends Loadable {
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultGoogleCloudStorageConfigFactory.d.ts","sourceRoot":"","sources":["../../src/DefaultGoogleCloudStorageConfigFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAO,MAAM,yCAAyC,8CAGnD,CAAC;AAEJ,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,sCAAuC,SAAQ,QAAQ;IACtE,SAAS,IAAI,wBAAwB,CAAC;CACvC"}
1
+ {"version":3,"file":"DefaultGoogleCloudStorageConfigFactory.d.ts","sourceRoot":"","sources":["../../src/DefaultGoogleCloudStorageConfigFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAO,MAAM,yCAAyC,8CAGnD,CAAC;AAEJ,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,sCAAuC,SAAQ,QAAQ;IACtE,SAAS,IAAI,wBAAwB,CAAC;CACvC"}
@@ -1,8 +1,17 @@
1
1
  import { File, FileStorageDriver } from '@proteinjs/db-file';
2
2
  import { GoogleCloudStorageConfig } from './DefaultGoogleCloudStorageConfigFactory';
3
+ /**
4
+ * ERRORS: every operation runs inside {@link GoogleCloudStorageDriver.guarded}, so what leaves this
5
+ * driver on a failure is a `FileStorageError` — a code, a plain message, the HTTP status — and
6
+ * never the storage client's own error. The client's error holds the request it made (`config`,
7
+ * `response.request`, `response.config`), and that request holds this driver's access token in its
8
+ * `Authorization` header: an application that logged the error it caught would write a live
9
+ * credential. A missing object is the `not-found` code on every read and overwrite.
10
+ */
3
11
  export declare class GoogleCloudStorageDriver implements FileStorageDriver {
4
12
  private storage;
5
13
  private bucketName;
14
+ private objectPrefix;
6
15
  constructor(config?: GoogleCloudStorageConfig);
7
16
  createFile(file: File, fileData: string): Promise<void>;
8
17
  getFileData(fileId: string): Promise<string>;
@@ -12,6 +21,24 @@ export declare class GoogleCloudStorageDriver implements FileStorageDriver {
12
21
  ttlMs?: number;
13
22
  }): Promise<string>;
14
23
  deleteFile(fileId: string): Promise<void>;
24
+ /**
25
+ * THE one place an object's name is decided (`<objectPrefix><file id>`): every operation
26
+ * addresses its object through here, so a configured prefix holds for all of them or none.
27
+ */
28
+ private object;
29
+ /**
30
+ * THE one door a storage-client call leaves through. Whatever the client throws is replaced by
31
+ * this driver's own error; nothing of the client's error object rides on it.
32
+ */
33
+ private guarded;
34
+ /**
35
+ * Reads exactly three plain facts off the client's error — an HTTP status, a connection error
36
+ * code, its message TEXT — and builds the driver's error from them. The client's error itself,
37
+ * its `config`, `request`, `response` and `errors` are never copied, wrapped or kept as a cause.
38
+ */
39
+ private driverError;
40
+ /** The client reports the HTTP status as its error's `code`; an upload's error carries it as `status` or on its `response`. */
41
+ private httpStatus;
15
42
  private getDefaultConfig;
16
43
  }
17
44
  //# sourceMappingURL=GoogleCloudStorageDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleCloudStorageDriver.d.ts","sourceRoot":"","sources":["../../src/GoogleCloudStorageDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EAEzB,MAAM,0CAA0C,CAAC;AAMlD,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,CAAC,EAAE,wBAAwB;IAMvC,UAAU,CAA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,OAAO,CAAC,IAAI,CAAC;IAcrC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3E,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO/C;;;OAGG;IACH,OAAO,CAAC,MAAM;IAId;;;OAGG;YACW,OAAO;IAQrB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAWnB,+HAA+H;IAC/H,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,gBAAgB;CAUzB"}
@@ -49,36 +49,49 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.GoogleCloudStorageDriver = void 0;
51
51
  var storage_1 = require("@google-cloud/storage");
52
+ var db_file_1 = require("@proteinjs/db-file");
52
53
  var DefaultGoogleCloudStorageConfigFactory_1 = require("./DefaultGoogleCloudStorageConfigFactory");
53
54
  /** Signed URLs are short-lived read capabilities minted per serve — long enough to load and seek
54
55
  * a video, short enough that a leaked URL goes stale quickly. */
55
56
  var DEFAULT_SIGNED_URL_TTL_MS = 15 * 60 * 1000;
57
+ /** Failures of the connection itself, as Node names them — the store was never reached. */
58
+ var NETWORK_ERROR_CODES = ['ECONNRESET', 'ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND', 'EAI_AGAIN', 'EPIPE'];
59
+ /**
60
+ * ERRORS: every operation runs inside {@link GoogleCloudStorageDriver.guarded}, so what leaves this
61
+ * driver on a failure is a `FileStorageError` — a code, a plain message, the HTTP status — and
62
+ * never the storage client's own error. The client's error holds the request it made (`config`,
63
+ * `response.request`, `response.config`), and that request holds this driver's access token in its
64
+ * `Authorization` header: an application that logged the error it caught would write a live
65
+ * credential. A missing object is the `not-found` code on every read and overwrite.
66
+ */
56
67
  var GoogleCloudStorageDriver = /** @class */ (function () {
57
68
  function GoogleCloudStorageDriver(config) {
58
- var _a = config ? config : this.getDefaultConfig(), projectId = _a.projectId, bucketName = _a.bucketName, storageOptions = _a.storageOptions;
69
+ var _a = config ? config : this.getDefaultConfig(), projectId = _a.projectId, bucketName = _a.bucketName, objectPrefix = _a.objectPrefix, storageOptions = _a.storageOptions;
59
70
  this.storage = new storage_1.Storage(__assign(__assign({}, storageOptions), { projectId: projectId }));
60
71
  this.bucketName = bucketName;
72
+ this.objectPrefix = objectPrefix !== null && objectPrefix !== void 0 ? objectPrefix : '';
61
73
  }
62
74
  GoogleCloudStorageDriver.prototype.createFile = function (file, fileData) {
63
75
  return __awaiter(this, void 0, void 0, function () {
64
- var bucket, gcsFile;
76
+ var gcsFile;
65
77
  return __generator(this, function (_a) {
66
78
  switch (_a.label) {
67
79
  case 0:
68
- bucket = this.storage.bucket(this.bucketName);
69
- gcsFile = bucket.file(file.id);
80
+ gcsFile = this.object(file.id);
70
81
  // The GCS object stores the file's TRUE bytes (the interface string is base64 transport).
71
82
  // Raw bytes at rest are what make signed-URL serving correct: the browser reads the object
72
83
  // directly, so base64 text at rest would corrupt every binary served that way.
73
- return [4 /*yield*/, gcsFile.save(Buffer.from(fileData, 'base64'), {
74
- metadata: {
75
- contentType: file.type,
84
+ return [4 /*yield*/, this.guarded('createFile', file.id, function () {
85
+ return gcsFile.save(Buffer.from(fileData, 'base64'), {
76
86
  metadata: {
77
- fileId: file.id,
78
- fileName: file.name,
79
- fileSize: file.size.toString(),
87
+ contentType: file.type,
88
+ metadata: {
89
+ fileId: file.id,
90
+ fileName: file.name,
91
+ fileSize: file.size.toString(),
92
+ },
80
93
  },
81
- },
94
+ });
82
95
  })];
83
96
  case 1:
84
97
  // The GCS object stores the file's TRUE bytes (the interface string is base64 transport).
@@ -96,8 +109,8 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
96
109
  return __generator(this, function (_a) {
97
110
  switch (_a.label) {
98
111
  case 0:
99
- file = this.storage.bucket(this.bucketName).file(fileId);
100
- return [4 /*yield*/, file.download()];
112
+ file = this.object(fileId);
113
+ return [4 /*yield*/, this.guarded('getFileData', fileId, function () { return file.download(); })];
101
114
  case 1:
102
115
  fileContent = (_a.sent())[0];
103
116
  return [2 /*return*/, fileContent.toString('base64')];
@@ -107,13 +120,31 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
107
120
  };
108
121
  GoogleCloudStorageDriver.prototype.updateFileData = function (fileId, data) {
109
122
  return __awaiter(this, void 0, void 0, function () {
110
- var file;
123
+ var gcsFile, bytes, existing;
111
124
  return __generator(this, function (_a) {
112
125
  switch (_a.label) {
113
126
  case 0:
114
- file = this.storage.bucket(this.bucketName).file(fileId);
115
- return [4 /*yield*/, file.save(Buffer.from(data, 'base64'))];
127
+ gcsFile = this.object(fileId);
128
+ bytes = Buffer.from(data, 'base64');
129
+ return [4 /*yield*/, this.guarded('updateFileData', fileId, function () { return gcsFile.getMetadata(); })];
116
130
  case 1:
131
+ existing = (_a.sent())[0];
132
+ return [4 /*yield*/, this.guarded('updateFileData', fileId, function () {
133
+ return gcsFile.save(bytes, {
134
+ metadata: {
135
+ contentType: existing.contentType,
136
+ cacheControl: existing.cacheControl,
137
+ contentDisposition: existing.contentDisposition,
138
+ contentLanguage: existing.contentLanguage,
139
+ metadata: __assign(__assign({}, existing.metadata), { fileSize: bytes.length.toString() }),
140
+ },
141
+ // The metadata read and the byte write are two requests. Pinning the write to the
142
+ // generation that was read makes the pair one decision: an overwrite that raced another
143
+ // writer fails loudly instead of restating metadata that is no longer the object's.
144
+ preconditionOpts: { ifGenerationMatch: existing.generation },
145
+ });
146
+ })];
147
+ case 2:
117
148
  _a.sent();
118
149
  return [2 /*return*/];
119
150
  }
@@ -126,14 +157,16 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
126
157
  return __generator(this, function (_a) {
127
158
  switch (_a.label) {
128
159
  case 0:
129
- gcsFile = this.storage.bucket(this.bucketName).file(file.id);
130
- return [4 /*yield*/, gcsFile.setMetadata({
131
- contentType: file.type,
132
- metadata: {
133
- fileId: file.id,
134
- fileName: file.name,
135
- fileSize: file.size.toString(),
136
- },
160
+ gcsFile = this.object(file.id);
161
+ return [4 /*yield*/, this.guarded('updateFile', file.id, function () {
162
+ return gcsFile.setMetadata({
163
+ contentType: file.type,
164
+ metadata: {
165
+ fileId: file.id,
166
+ fileName: file.name,
167
+ fileSize: file.size.toString(),
168
+ },
169
+ });
137
170
  })];
138
171
  case 1:
139
172
  _a.sent();
@@ -143,20 +176,22 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
143
176
  });
144
177
  };
145
178
  GoogleCloudStorageDriver.prototype.getSignedUrl = function (fileId, options) {
146
- var _a;
147
179
  return __awaiter(this, void 0, void 0, function () {
148
180
  var gcsFile, url;
149
- return __generator(this, function (_b) {
150
- switch (_b.label) {
181
+ return __generator(this, function (_a) {
182
+ switch (_a.label) {
151
183
  case 0:
152
- gcsFile = this.storage.bucket(this.bucketName).file(fileId);
153
- return [4 /*yield*/, gcsFile.getSignedUrl({
154
- version: 'v4',
155
- action: 'read',
156
- expires: Date.now() + ((_a = options === null || options === void 0 ? void 0 : options.ttlMs) !== null && _a !== void 0 ? _a : DEFAULT_SIGNED_URL_TTL_MS),
184
+ gcsFile = this.object(fileId);
185
+ return [4 /*yield*/, this.guarded('getSignedUrl', fileId, function () {
186
+ var _a;
187
+ return gcsFile.getSignedUrl({
188
+ version: 'v4',
189
+ action: 'read',
190
+ expires: Date.now() + ((_a = options === null || options === void 0 ? void 0 : options.ttlMs) !== null && _a !== void 0 ? _a : DEFAULT_SIGNED_URL_TTL_MS),
191
+ });
157
192
  })];
158
193
  case 1:
159
- url = (_b.sent())[0];
194
+ url = (_a.sent())[0];
160
195
  return [2 /*return*/, url];
161
196
  }
162
197
  });
@@ -168,10 +203,10 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
168
203
  return __generator(this, function (_a) {
169
204
  switch (_a.label) {
170
205
  case 0:
171
- gcsFile = this.storage.bucket(this.bucketName).file(fileId);
206
+ gcsFile = this.object(fileId);
172
207
  // ignoreNotFound implements the driver contract's idempotency: a retried row delete must not
173
208
  // wedge because a prior attempt already removed the blob. Every other failure throws loudly.
174
- return [4 /*yield*/, gcsFile.delete({ ignoreNotFound: true })];
209
+ return [4 /*yield*/, this.guarded('deleteFile', fileId, function () { return gcsFile.delete({ ignoreNotFound: true }); })];
175
210
  case 1:
176
211
  // ignoreNotFound implements the driver contract's idempotency: a retried row delete must not
177
212
  // wedge because a prior attempt already removed the blob. Every other failure throws loudly.
@@ -181,6 +216,63 @@ var GoogleCloudStorageDriver = /** @class */ (function () {
181
216
  });
182
217
  });
183
218
  };
219
+ /**
220
+ * THE one place an object's name is decided (`<objectPrefix><file id>`): every operation
221
+ * addresses its object through here, so a configured prefix holds for all of them or none.
222
+ */
223
+ GoogleCloudStorageDriver.prototype.object = function (fileId) {
224
+ return this.storage.bucket(this.bucketName).file("".concat(this.objectPrefix).concat(fileId));
225
+ };
226
+ /**
227
+ * THE one door a storage-client call leaves through. Whatever the client throws is replaced by
228
+ * this driver's own error; nothing of the client's error object rides on it.
229
+ */
230
+ GoogleCloudStorageDriver.prototype.guarded = function (operation, fileId, call) {
231
+ return __awaiter(this, void 0, void 0, function () {
232
+ var clientError_1;
233
+ return __generator(this, function (_a) {
234
+ switch (_a.label) {
235
+ case 0:
236
+ _a.trys.push([0, 2, , 3]);
237
+ return [4 /*yield*/, call()];
238
+ case 1: return [2 /*return*/, _a.sent()];
239
+ case 2:
240
+ clientError_1 = _a.sent();
241
+ throw this.driverError(operation, fileId, clientError_1);
242
+ case 3: return [2 /*return*/];
243
+ }
244
+ });
245
+ });
246
+ };
247
+ /**
248
+ * Reads exactly three plain facts off the client's error — an HTTP status, a connection error
249
+ * code, its message TEXT — and builds the driver's error from them. The client's error itself,
250
+ * its `config`, `request`, `response` and `errors` are never copied, wrapped or kept as a cause.
251
+ */
252
+ GoogleCloudStorageDriver.prototype.driverError = function (operation, fileId, clientError) {
253
+ var status = this.httpStatus(clientError);
254
+ var connectionFailed = NETWORK_ERROR_CODES.includes(clientError === null || clientError === void 0 ? void 0 : clientError.code);
255
+ var message = clientError === null || clientError === void 0 ? void 0 : clientError.message;
256
+ return new db_file_1.FileStorageError(connectionFailed ? 'unavailable' : db_file_1.FileStorageError.codeForStatus(status), "".concat(operation, " failed for file ").concat(fileId), { status: status, detail: typeof message === 'string' ? message : undefined });
257
+ };
258
+ /** The client reports the HTTP status as its error's `code`; an upload's error carries it as `status` or on its `response`. */
259
+ GoogleCloudStorageDriver.prototype.httpStatus = function (clientError) {
260
+ var _a, _b;
261
+ var candidate = clientError;
262
+ for (var _i = 0, _c = [
263
+ candidate === null || candidate === void 0 ? void 0 : candidate.code,
264
+ candidate === null || candidate === void 0 ? void 0 : candidate.status,
265
+ (_a = candidate === null || candidate === void 0 ? void 0 : candidate.response) === null || _a === void 0 ? void 0 : _a.status,
266
+ (_b = candidate === null || candidate === void 0 ? void 0 : candidate.response) === null || _b === void 0 ? void 0 : _b.statusCode,
267
+ ]; _i < _c.length; _i++) {
268
+ var value = _c[_i];
269
+ var status_1 = typeof value === 'string' && /^\d{3}$/.test(value) ? Number(value) : value;
270
+ if (typeof status_1 === 'number' && status_1 >= 100 && status_1 <= 599) {
271
+ return status_1;
272
+ }
273
+ }
274
+ return undefined;
275
+ };
184
276
  GoogleCloudStorageDriver.prototype.getDefaultConfig = function () {
185
277
  var defaultConfigFactory = (0, DefaultGoogleCloudStorageConfigFactory_1.getDefaultGoogleCloudStorageConfigFactory)();
186
278
  if (!defaultConfigFactory) {
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleCloudStorageDriver.js","sourceRoot":"","sources":["../../src/GoogleCloudStorageDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgD;AAEhD,mGAGkD;AAElD;kEACkE;AAClE,IAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjD;IAIE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B,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,0CAAE,MAAM;YAC3B,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,0CAAE,UAAU;SAChC,EALmB,cAKnB,EALmB,IAKnB,EAAE;YALE,IAAM,KAAK,SAAA;YAMd,IAAM,QAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAC1F,IAAI,OAAO,QAAM,KAAK,QAAQ,IAAI,QAAM,IAAI,GAAG,IAAI,QAAM,IAAI,GAAG,EAAE;gBAChE,OAAO,QAAM,CAAC;aACf;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,mDAAgB,GAAxB;QACE,IAAM,oBAAoB,GAAG,IAAA,kFAAyC,GAAE,CAAC;QACzE,IAAI,CAAC,oBAAoB,EAAE;YACzB,MAAM,IAAI,KAAK,CACb,wOAAwO,CACzO,CAAC;SACH;QAED,OAAO,oBAAoB,CAAC,SAAS,EAAE,CAAC;IAC1C,CAAC;IACH,+BAAC;AAAD,CAAC,AArKD,IAqKC;AArKY,4DAAwB"}
@@ -7,7 +7,7 @@ import '@proteinjs/logger';
7
7
  /** Generate Source Graph */
8
8
 
9
9
  const sourceGraph =
10
- '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","value":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"DefaultGoogleCloudStorageConfigFactory","filePath":"src/DefaultGoogleCloudStorageConfigFactory.ts","qualifiedName":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","properties":[],"methods":[{"name":"getConfig","returnType":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageConfig","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig","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-storage-driver-gcs/GoogleCloudStorageDriver","value":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageDriver","filePath":"src/GoogleCloudStorageDriver.ts","qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"storage","type":{"packageName":"@google-cloud/storage","name":"Storage","filePath":null,"qualifiedName":"@google-cloud/storage/Storage","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"bucketName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"createFile","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":"@proteinjs/db-file","name":"File","filePath":null,"qualifiedName":"@proteinjs/db-file/File","typeParameters":null,"directParents":null}},{"name":"fileData","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":"@proteinjs/db-file","name":"File","filePath":null,"qualifiedName":"@proteinjs/db-file/File","typeParameters":null,"directParents":null}}]},{"name":"getSignedUrl","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":"options","type":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"{ ttlMs?: number }","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/{ ttlMs?: number }","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}}]},{"name":"getDefaultConfig","returnType":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageConfig","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db-file/FileStorageDriver"}],"edges":[{"v":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","w":"@proteinjs/reflection/Loadable","value":"extends interface"},{"v":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver","w":"@proteinjs/db-file/FileStorageDriver","value":"implements interface"}]}';
10
+ '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","value":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"DefaultGoogleCloudStorageConfigFactory","filePath":"src/DefaultGoogleCloudStorageConfigFactory.ts","qualifiedName":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","properties":[],"methods":[{"name":"getConfig","returnType":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageConfig","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig","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-storage-driver-gcs/GoogleCloudStorageDriver","value":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageDriver","filePath":"src/GoogleCloudStorageDriver.ts","qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"storage","type":{"packageName":"@google-cloud/storage","name":"Storage","filePath":null,"qualifiedName":"@google-cloud/storage/Storage","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"bucketName","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"objectPrefix","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"createFile","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":"@proteinjs/db-file","name":"File","filePath":null,"qualifiedName":"@proteinjs/db-file/File","typeParameters":null,"directParents":null}},{"name":"fileData","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":"@proteinjs/db-file","name":"File","filePath":null,"qualifiedName":"@proteinjs/db-file/File","typeParameters":null,"directParents":null}}]},{"name":"getSignedUrl","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":"options","type":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"{ ttlMs?: number }","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/{ ttlMs?: number }","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}}]},{"name":"object","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"guarded","returnType":{"packageName":"","name":"Promise<T>","filePath":null,"qualifiedName":"/Promise<T>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"operation","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"call","type":{"packageName":"","name":"() => Promise<T>","filePath":null,"qualifiedName":"/() => Promise<T>","typeParameters":null,"directParents":null}}]},{"name":"driverError","returnType":{"packageName":"@proteinjs/db-file","name":"FileStorageError","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageError","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"operation","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"clientError","type":{"packageName":"","name":"unknown","filePath":null,"qualifiedName":"/unknown","typeParameters":null,"directParents":null}}]},{"name":"httpStatus","returnType":{"packageName":"","name":"number | undefined","filePath":null,"qualifiedName":"/number | undefined","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"clientError","type":{"packageName":"","name":"unknown","filePath":null,"qualifiedName":"/unknown","typeParameters":null,"directParents":null}}]},{"name":"getDefaultConfig","returnType":{"packageName":"@proteinjs/db-file-storage-driver-gcs","name":"GoogleCloudStorageConfig","filePath":null,"qualifiedName":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageConfig","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db-file/FileStorageDriver"}],"edges":[{"v":"@proteinjs/db-file-storage-driver-gcs/DefaultGoogleCloudStorageConfigFactory","w":"@proteinjs/reflection/Loadable","value":"extends interface"},{"v":"@proteinjs/db-file-storage-driver-gcs/GoogleCloudStorageDriver","w":"@proteinjs/db-file/FileStorageDriver","value":"implements interface"}]}';
11
11
 
12
12
  /** Generate Source Links */
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/db-file-storage-driver-gcs",
3
- "version": "1.4.33",
3
+ "version": "1.5.1",
4
4
  "description": "File storage in Google Cloud Storage",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@google-cloud/storage": "7.11.2",
26
- "@proteinjs/db": "^1.48.0",
27
- "@proteinjs/db-file": "^1.8.4",
26
+ "@proteinjs/db": "^1.49.0",
27
+ "@proteinjs/db-file": "^1.9.1",
28
28
  "@proteinjs/logger": "^1.0.21",
29
29
  "@proteinjs/reflection": "^1.2.0"
30
30
  },
@@ -37,11 +37,12 @@
37
37
  "eslint": "8.57.0",
38
38
  "eslint-config-prettier": "9.1.0",
39
39
  "eslint-plugin-prettier": "5.1.3",
40
+ "google-auth-library": "^9.6.3",
40
41
  "jest": "29.7.0",
41
42
  "ts-jest": "29.1.1",
42
43
  "typescript": "5.2.2"
43
44
  },
44
45
  "main": "./dist/generated/index.js",
45
46
  "types": "./dist/generated/index.d.ts",
46
- "gitHead": "ec3fd54430dde18afd406ec70eccd857492272a0"
47
+ "gitHead": "68572ee47ead32683917cce365bbd5ef63f12cac"
47
48
  }
@@ -9,6 +9,13 @@ export const getDefaultGoogleCloudStorageConfigFactory = () =>
9
9
  export type GoogleCloudStorageConfig = {
10
10
  bucketName: string;
11
11
  projectId: string;
12
+ /**
13
+ * Prepended, verbatim, to the name of every object this driver writes, reads, signs or deletes
14
+ * (`<objectPrefix><file id>`). Lets several independent deployments share one bucket while each
15
+ * deployment's files stay listable and removable as a group. Include the separator yourself
16
+ * (`'deployment-a/'`). Unset: an object is named by the file id alone.
17
+ */
18
+ objectPrefix?: string;
12
19
  storageOptions?: StorageOptions;
13
20
  };
14
21