@riocrypto/common-server 1.0.1233 → 1.0.1235

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.
@@ -51,7 +51,7 @@ class cloudVisionAPIClient {
51
51
  //@ts-ignore
52
52
  const [operation] = yield client.asyncBatchAnnotateFiles(request);
53
53
  const [filesResponse] = yield operation.promise();
54
- const destinationUri = filesResponse.responses[0].outputConfig.gcsDestination;
54
+ const destinationUri = filesResponse.responses[0].outputConfig.gcsDestination.uri;
55
55
  return destinationUri;
56
56
  });
57
57
  }
@@ -3,6 +3,6 @@ export declare class GCloudStorageClient {
3
3
  _bucket: Bucket;
4
4
  constructor(bucket: string);
5
5
  get bucket(): Bucket;
6
- downloadJsonFile(filename: string): Promise<any>;
6
+ downloadJsonFileFromFolder(folderPath: string): Promise<any>;
7
7
  }
8
8
  export declare const buildGCloudStorageClient: () => Promise<GCloudStorageClient>;
@@ -22,12 +22,16 @@ class GCloudStorageClient {
22
22
  get bucket() {
23
23
  return this._bucket;
24
24
  }
25
- downloadJsonFile(filename) {
25
+ downloadJsonFileFromFolder(folderPath) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- const file = this._bucket.file(filename);
27
+ const [files] = yield this._bucket.getFiles({ prefix: folderPath });
28
+ if (files.length === 0) {
29
+ throw new Error("No files found in the specified folder");
30
+ }
31
+ const firstFile = files[0];
28
32
  return new Promise((resolve, reject) => {
29
33
  let data = "";
30
- file
34
+ firstFile
31
35
  .createReadStream()
32
36
  .on("data", (chunk) => {
33
37
  data += chunk.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1233",
3
+ "version": "1.0.1235",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",