@rowengine/common 1.1.12 → 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 +2 -1
- package/build/utils/gc.js +12 -3
- package/package.json +1 -1
package/build/utils/gc.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare const getTileFromProjectInGCS: (projectId: string, coordinates: {
|
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
}) => Promise<import("@google-cloud/storage").File | null>;
|
|
10
|
-
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,7 @@ 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
16
|
exports.uploadFileToGCS = uploadFileToGCS;
|
|
17
17
|
exports.uploadFolderToGCS = uploadFolderToGCS;
|
|
18
18
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
@@ -95,8 +95,17 @@ const getTileFromProjectInGCS = (projectId, coordinates) => __awaiter(void 0, vo
|
|
|
95
95
|
return gcFile;
|
|
96
96
|
});
|
|
97
97
|
exports.getTileFromProjectInGCS = getTileFromProjectInGCS;
|
|
98
|
-
const
|
|
99
|
-
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}`;
|
|
100
109
|
const gcFile = gc_storage_1.default.file(filePath);
|
|
101
110
|
const [fileExists] = yield gcFile.exists();
|
|
102
111
|
if (!fileExists)
|