@rowengine/common 1.1.9 → 1.1.11
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/constants/index.d.ts +1 -0
- package/build/constants/index.js +17 -0
- package/build/utils/gc.d.ts +6 -0
- package/build/utils/gc.js +20 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.js +0 -1
- package/package.json +9 -1
- /package/build/{utils → constants}/grades.d.ts +0 -0
- /package/build/{utils → constants}/grades.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './grades';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./grades"), exports);
|
package/build/utils/gc.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare function uploadFolderToGCS(folderPath: string, gcsPath: string): Promise<void>;
|
|
2
2
|
export declare const getFilesFromGCSFolder: (gcsFolderPath: string) => Promise<string[]>;
|
|
3
3
|
export declare const downloadProjectFileFromGCS: (projectId: string, fileName: string, destinationPath: string) => Promise<string | null>;
|
|
4
|
+
export declare const getTileFromProjectInGCS: (projectId: string, coordinates: {
|
|
5
|
+
z: number;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}) => Promise<import("@google-cloud/storage").File | null>;
|
|
9
|
+
export declare const getFileFromProjectFieldInGCS: (projectId: string, fieldFolder: 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.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
15
|
+
exports.getFileFromProjectFieldInGCS = exports.getTileFromProjectInGCS = exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
16
16
|
exports.uploadFolderToGCS = uploadFolderToGCS;
|
|
17
17
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
18
18
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -84,3 +84,22 @@ const downloadProjectFileFromGCS = (projectId, fileName, destinationPath) => __a
|
|
|
84
84
|
return destinationPath;
|
|
85
85
|
});
|
|
86
86
|
exports.downloadProjectFileFromGCS = downloadProjectFileFromGCS;
|
|
87
|
+
const getTileFromProjectInGCS = (projectId, coordinates) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
const { z, x, y } = coordinates;
|
|
89
|
+
const tilePath = `projects/${projectId}/tiles/${z}/${x}/${y}.png`;
|
|
90
|
+
const gcFile = gc_storage_1.default.file(tilePath);
|
|
91
|
+
const [fileExists] = yield gcFile.exists();
|
|
92
|
+
if (!fileExists)
|
|
93
|
+
return null;
|
|
94
|
+
return gcFile;
|
|
95
|
+
});
|
|
96
|
+
exports.getTileFromProjectInGCS = getTileFromProjectInGCS;
|
|
97
|
+
const getFileFromProjectFieldInGCS = (projectId, fieldFolder, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
const filePath = `projects/${projectId}/fields/${fieldFolder}/${fileName}`;
|
|
99
|
+
const gcFile = gc_storage_1.default.file(filePath);
|
|
100
|
+
const [fileExists] = yield gcFile.exists();
|
|
101
|
+
if (!fileExists)
|
|
102
|
+
return null;
|
|
103
|
+
return gcFile;
|
|
104
|
+
});
|
|
105
|
+
exports.getFileFromProjectFieldInGCS = getFileFromProjectFieldInGCS;
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.gcStorage = void 0;
|
|
21
|
-
__exportStar(require("./grades"), exports);
|
|
22
21
|
__exportStar(require("./gc"), exports);
|
|
23
22
|
var gc_storage_1 = require("./gc-storage");
|
|
24
23
|
Object.defineProperty(exports, "gcStorage", { enumerable: true, get: function () { return __importDefault(gc_storage_1).default; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowengine/common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -36,6 +36,14 @@
|
|
|
36
36
|
"default": "./build/utils/index.js"
|
|
37
37
|
},
|
|
38
38
|
"./build/utils/index.js"
|
|
39
|
+
],
|
|
40
|
+
"./constants": [
|
|
41
|
+
{
|
|
42
|
+
"import": "./build/constants/index.js",
|
|
43
|
+
"require": "./build/constants/index.js",
|
|
44
|
+
"default": "./build/constants/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./build/constants/index.js"
|
|
39
47
|
]
|
|
40
48
|
},
|
|
41
49
|
"types": "./build/index.d.ts",
|
|
File without changes
|
|
File without changes
|