@rowengine/common 1.1.11 → 1.1.13
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/build/utils/gc.d.ts +3 -1
- package/build/utils/gc.js +13 -3
- package/package.json +1 -1
package/build/utils/gc.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function uploadFileToGCS(absolutePath: string, gcsPath: string, size: number): Promise<void>;
|
|
1
2
|
export declare function uploadFolderToGCS(folderPath: string, gcsPath: string): Promise<void>;
|
|
2
3
|
export declare const getFilesFromGCSFolder: (gcsFolderPath: string) => Promise<string[]>;
|
|
3
4
|
export declare const downloadProjectFileFromGCS: (projectId: string, fileName: string, destinationPath: string) => Promise<string | null>;
|
|
@@ -6,4 +7,5 @@ export declare const getTileFromProjectInGCS: (projectId: string, coordinates: {
|
|
|
6
7
|
x: number;
|
|
7
8
|
y: number;
|
|
8
9
|
}) => Promise<import("@google-cloud/storage").File | null>;
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const getFileFromProjectInGCS: (projectId: string, fileName: string) => Promise<import("@google-cloud/storage").File | null>;
|
|
11
|
+
export declare const getFileFromProjectFieldInGCS: (projectId: string, fieldId: string, fileName: string) => Promise<import("@google-cloud/storage").File | null>;
|
package/build/utils/gc.js
CHANGED
|
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getFileFromProjectFieldInGCS = exports.getTileFromProjectInGCS = exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
15
|
+
exports.getFileFromProjectFieldInGCS = exports.getFileFromProjectInGCS = exports.getTileFromProjectInGCS = exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
16
|
+
exports.uploadFileToGCS = uploadFileToGCS;
|
|
16
17
|
exports.uploadFolderToGCS = uploadFolderToGCS;
|
|
17
18
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
18
19
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -94,8 +95,17 @@ const getTileFromProjectInGCS = (projectId, coordinates) => __awaiter(void 0, vo
|
|
|
94
95
|
return gcFile;
|
|
95
96
|
});
|
|
96
97
|
exports.getTileFromProjectInGCS = getTileFromProjectInGCS;
|
|
97
|
-
const
|
|
98
|
-
const filePath = `projects/${projectId}
|
|
98
|
+
const getFileFromProjectInGCS = (projectId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
const filePath = `projects/${projectId}/${fileName}`;
|
|
100
|
+
const gcFile = gc_storage_1.default.file(filePath);
|
|
101
|
+
const [fileExists] = yield gcFile.exists();
|
|
102
|
+
if (!fileExists)
|
|
103
|
+
return null;
|
|
104
|
+
return gcFile;
|
|
105
|
+
});
|
|
106
|
+
exports.getFileFromProjectInGCS = getFileFromProjectInGCS;
|
|
107
|
+
const getFileFromProjectFieldInGCS = (projectId, fieldId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
const filePath = `projects/${projectId}/fields/${fieldId}/${fileName}`;
|
|
99
109
|
const gcFile = gc_storage_1.default.file(filePath);
|
|
100
110
|
const [fileExists] = yield gcFile.exists();
|
|
101
111
|
if (!fileExists)
|