@webda/gcp 2.0.0-beta.0
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/LICENSE +166 -0
- package/README.md +13 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/index.spec.d.ts +4 -0
- package/lib/index.spec.js +25 -0
- package/lib/index.spec.js.map +1 -0
- package/lib/services/firestore.d.ts +124 -0
- package/lib/services/firestore.js +426 -0
- package/lib/services/firestore.js.map +1 -0
- package/lib/services/firestore.spec.d.ts +1 -0
- package/lib/services/firestore.spec.js +226 -0
- package/lib/services/firestore.spec.js.map +1 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.js +18 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/pubsub.d.ts +35 -0
- package/lib/services/pubsub.js +93 -0
- package/lib/services/pubsub.js.map +1 -0
- package/lib/services/pubsub.spec.d.ts +1 -0
- package/lib/services/pubsub.spec.js +73 -0
- package/lib/services/pubsub.spec.js.map +1 -0
- package/lib/services/queue.d.ts +81 -0
- package/lib/services/queue.js +159 -0
- package/lib/services/queue.js.map +1 -0
- package/lib/services/queue.spec.d.ts +1 -0
- package/lib/services/queue.spec.js +120 -0
- package/lib/services/queue.spec.js.map +1 -0
- package/lib/services/storage.d.ts +131 -0
- package/lib/services/storage.js +244 -0
- package/lib/services/storage.js.map +1 -0
- package/lib/services/storage.spec.d.ts +1 -0
- package/lib/services/storage.spec.js +213 -0
- package/lib/services/storage.spec.js.map +1 -0
- package/package.json +63 -0
- package/webda.module.json +12 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Bucket } from "@google-cloud/storage";
|
|
3
|
+
import { CloudBinary, BinaryMap, BinaryParameters, CoreModel, BinaryFile, DeepPartial, Context } from "@webda/core";
|
|
4
|
+
import { Readable } from "stream";
|
|
5
|
+
export declare type StorageObject = {
|
|
6
|
+
key: string;
|
|
7
|
+
/**
|
|
8
|
+
* bucket is an option,
|
|
9
|
+
* if not provided: it will get the DEFAULT_BUCKET set from environment variable
|
|
10
|
+
*/
|
|
11
|
+
bucket?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type DownloadParams = StorageObject & {
|
|
14
|
+
localPath: string;
|
|
15
|
+
};
|
|
16
|
+
export declare type PutObjectParams = StorageObject & {
|
|
17
|
+
localPath?: string;
|
|
18
|
+
content?: string | Buffer;
|
|
19
|
+
};
|
|
20
|
+
export declare type GetSignedUrlParams = StorageObject & {
|
|
21
|
+
expires?: number;
|
|
22
|
+
action: "read" | "write" | "delete";
|
|
23
|
+
};
|
|
24
|
+
export declare type StorageObjectMeta = {
|
|
25
|
+
size: number;
|
|
26
|
+
contentType: string;
|
|
27
|
+
};
|
|
28
|
+
export declare class StorageParameters extends BinaryParameters {
|
|
29
|
+
prefix?: string;
|
|
30
|
+
bucket: string;
|
|
31
|
+
constructor(params: any, service: Storage);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Storage handles the storage of binary on a Google Cloud Storage bucket
|
|
35
|
+
*
|
|
36
|
+
* See Binary the general interface
|
|
37
|
+
* @WebdaModda GoogleCloudStorage
|
|
38
|
+
*/
|
|
39
|
+
export default class Storage<T extends StorageParameters = StorageParameters> extends CloudBinary<T> {
|
|
40
|
+
private _storage?;
|
|
41
|
+
private get storage();
|
|
42
|
+
/**
|
|
43
|
+
* Load the parameters
|
|
44
|
+
*
|
|
45
|
+
* @param params
|
|
46
|
+
*/
|
|
47
|
+
loadParameters(params: DeepPartial<T>): StorageParameters;
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
*/
|
|
51
|
+
_get(info: BinaryMap): Promise<Readable>;
|
|
52
|
+
/**
|
|
53
|
+
* @override
|
|
54
|
+
*/
|
|
55
|
+
getSignedUrlFromMap(map: BinaryMap, expires: number, _context: Context): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Get object content in Buffer
|
|
58
|
+
* @param {StorageObject} params
|
|
59
|
+
*/
|
|
60
|
+
getContent({ bucket, key }: StorageObject): Promise<Readable>;
|
|
61
|
+
/**
|
|
62
|
+
* Upload a local file to GCS bucket destination
|
|
63
|
+
*
|
|
64
|
+
* @param key to add to
|
|
65
|
+
* @param body content of the object
|
|
66
|
+
* @param metadatas to put along the object
|
|
67
|
+
* @param bucket to use
|
|
68
|
+
*/
|
|
69
|
+
putObject(key: string, body: Readable | Buffer | string, metadata?: {}, bucket?: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Return the Google Bucket directly
|
|
72
|
+
*
|
|
73
|
+
* @param bucket name of the bucket default to the one predefined
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
getStorageBucket(bucket?: string): Bucket;
|
|
77
|
+
/**
|
|
78
|
+
* @inheritdoc
|
|
79
|
+
*/
|
|
80
|
+
_cleanUsage(hash: string, uuid: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* @inheritdoc
|
|
83
|
+
*/
|
|
84
|
+
getUsageCount(hash: string): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
*/
|
|
88
|
+
store(object: CoreModel, property: string, file: BinaryFile): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Delete a file inside an existing bucket
|
|
91
|
+
* @param {DeleteObjectParams} params
|
|
92
|
+
*/
|
|
93
|
+
deleteObject({ bucket, key }: StorageObject): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Move a file from one bucket to an other
|
|
96
|
+
* @param {StorageObject} source
|
|
97
|
+
* @param {StorageObject} destination
|
|
98
|
+
*/
|
|
99
|
+
moveObject(source: StorageObject, destination: StorageObject): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieve one signed URL to download the file in parameter
|
|
102
|
+
* @param {GetSignedUrlParams} params
|
|
103
|
+
* @returns {string} URL in order to download the file
|
|
104
|
+
*/
|
|
105
|
+
getSignedUrl({ bucket, key, action, expires }: GetSignedUrlParams): Promise<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Retrieve mandatory headers if needed by the cloud provider (ie. Azure)
|
|
108
|
+
* Returns empty object if no headers are mandatory
|
|
109
|
+
* @returns {[key:string]: string} mandatory headers
|
|
110
|
+
*/
|
|
111
|
+
getSignedUrlHeaders(): {
|
|
112
|
+
[key: string]: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Retrieve public URL of this object
|
|
116
|
+
* @param {StorageModel} store
|
|
117
|
+
* @returns {string} Public URL in order to download the file
|
|
118
|
+
*/
|
|
119
|
+
getPublicUrl({ bucket, key }: StorageObject): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Fetch an object's metadata
|
|
122
|
+
* @param {StorageModel} store
|
|
123
|
+
* @returns {any} Metadata
|
|
124
|
+
*/
|
|
125
|
+
getMeta({ bucket, key }: StorageObject): Promise<StorageObjectMeta>;
|
|
126
|
+
/**
|
|
127
|
+
* @inheritdoc
|
|
128
|
+
*/
|
|
129
|
+
putMarker(hash: string, uuid: string, storeName: string): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
export { Storage };
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Storage = exports.StorageParameters = void 0;
|
|
13
|
+
const storage_1 = require("@google-cloud/storage");
|
|
14
|
+
const core_1 = require("@webda/core");
|
|
15
|
+
const stream_1 = require("stream");
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
const mime = require("mime-types");
|
|
18
|
+
class StorageParameters extends core_1.BinaryParameters {
|
|
19
|
+
constructor(params, service) {
|
|
20
|
+
super(params, service);
|
|
21
|
+
this.prefix = "";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.StorageParameters = StorageParameters;
|
|
25
|
+
/**
|
|
26
|
+
* Storage handles the storage of binary on a Google Cloud Storage bucket
|
|
27
|
+
*
|
|
28
|
+
* See Binary the general interface
|
|
29
|
+
* @WebdaModda GoogleCloudStorage
|
|
30
|
+
*/
|
|
31
|
+
class Storage extends core_1.CloudBinary {
|
|
32
|
+
get storage() {
|
|
33
|
+
if (!this._storage) {
|
|
34
|
+
this._storage = new storage_1.Storage();
|
|
35
|
+
}
|
|
36
|
+
return this._storage;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Load the parameters
|
|
40
|
+
*
|
|
41
|
+
* @param params
|
|
42
|
+
*/
|
|
43
|
+
loadParameters(params) {
|
|
44
|
+
return new StorageParameters(params, this);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @override
|
|
48
|
+
*/
|
|
49
|
+
_get(info) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const key = this._getKey(info.hash);
|
|
52
|
+
return this.getContent({ key });
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @override
|
|
57
|
+
*/
|
|
58
|
+
getSignedUrlFromMap(map, expires, _context) {
|
|
59
|
+
return this.getSignedUrl({ key: this._getKey(map.hash), expires, action: "read" });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get object content in Buffer
|
|
63
|
+
* @param {StorageObject} params
|
|
64
|
+
*/
|
|
65
|
+
getContent({ bucket, key }) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return this.getStorageBucket(bucket).file(key).createReadStream();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Upload a local file to GCS bucket destination
|
|
72
|
+
*
|
|
73
|
+
* @param key to add to
|
|
74
|
+
* @param body content of the object
|
|
75
|
+
* @param metadatas to put along the object
|
|
76
|
+
* @param bucket to use
|
|
77
|
+
*/
|
|
78
|
+
putObject(key, body, metadata = {}, bucket = this.parameters.bucket
|
|
79
|
+
//{ bucket, localPath, content, key }: PutObjectParams
|
|
80
|
+
) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const file = this.getStorageBucket(bucket).file(key);
|
|
83
|
+
let contentType = "application/octet-stream";
|
|
84
|
+
let stream;
|
|
85
|
+
if (body instanceof stream_1.Readable) {
|
|
86
|
+
stream = body;
|
|
87
|
+
}
|
|
88
|
+
else if (body instanceof Buffer) {
|
|
89
|
+
const bufferStream = new stream_1.Stream.PassThrough();
|
|
90
|
+
bufferStream.end(body);
|
|
91
|
+
stream = bufferStream;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
contentType = mime.lookup(body, "application/octet-stream");
|
|
95
|
+
stream = (0, fs_1.createReadStream)(body);
|
|
96
|
+
}
|
|
97
|
+
// NODE16-REFACTOR: const { pipeline } = require('stream/promises');
|
|
98
|
+
yield new Promise((resolve, reject) => {
|
|
99
|
+
stream
|
|
100
|
+
.pipe(file.createWriteStream({
|
|
101
|
+
contentType,
|
|
102
|
+
}))
|
|
103
|
+
.on("error", reject)
|
|
104
|
+
.on("finish", resolve);
|
|
105
|
+
});
|
|
106
|
+
// Save metadata now
|
|
107
|
+
if (metadata) {
|
|
108
|
+
yield file.setMetadata({ metadata: metadata });
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Return the Google Bucket directly
|
|
114
|
+
*
|
|
115
|
+
* @param bucket name of the bucket default to the one predefined
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
getStorageBucket(bucket = this.parameters.bucket) {
|
|
119
|
+
return this.storage.bucket(bucket);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @inheritdoc
|
|
123
|
+
*/
|
|
124
|
+
_cleanUsage(hash, uuid) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
yield this.getStorageBucket().file(this._getKey(hash, uuid)).delete();
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @inheritdoc
|
|
131
|
+
*/
|
|
132
|
+
getUsageCount(hash) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const [files] = yield this.getStorageBucket().getFiles({
|
|
135
|
+
prefix: this._getKey(hash, ""),
|
|
136
|
+
});
|
|
137
|
+
return files.filter(n => !n.name.endsWith("/data")).length;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @inheritdoc
|
|
142
|
+
*/
|
|
143
|
+
store(object, property, file) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
this.checkMap(object.getStore().getName(), property);
|
|
146
|
+
yield file.getHashes();
|
|
147
|
+
const [exists] = yield this.getStorageBucket().file(this._getKey(file.hash)).exists();
|
|
148
|
+
// If data already exist no need to upload
|
|
149
|
+
if (!exists) {
|
|
150
|
+
yield this.putObject(this._getKey(file.hash), yield file.get(), Object.assign(Object.assign({}, file.metadata), { challenge: file.challenge }));
|
|
151
|
+
}
|
|
152
|
+
yield this.putMarker(file.hash, object.getUuid(), object.getStore().getName());
|
|
153
|
+
yield this.uploadSuccess(object, property, file);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Delete a file inside an existing bucket
|
|
158
|
+
* @param {DeleteObjectParams} params
|
|
159
|
+
*/
|
|
160
|
+
deleteObject({ bucket, key }) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
yield this.getStorageBucket(bucket).file(key).delete();
|
|
163
|
+
this._webda.log("DEBUG", `gs://${bucket}/${key} deleted`);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Move a file from one bucket to an other
|
|
168
|
+
* @param {StorageObject} source
|
|
169
|
+
* @param {StorageObject} destination
|
|
170
|
+
*/
|
|
171
|
+
moveObject(source, destination) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const newFile = this.getStorageBucket(destination.bucket).file(destination.key);
|
|
174
|
+
this._webda.log("DEBUG", `moveObject gs://${source.bucket}/${source.key} => gs://${destination.bucket}/${destination.key}`);
|
|
175
|
+
yield this.getStorageBucket(source.bucket).file(source.key).move(newFile);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Retrieve one signed URL to download the file in parameter
|
|
180
|
+
* @param {GetSignedUrlParams} params
|
|
181
|
+
* @returns {string} URL in order to download the file
|
|
182
|
+
*/
|
|
183
|
+
getSignedUrl({ bucket, key, action, expires = 3600 }) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const options = {
|
|
186
|
+
version: "v4",
|
|
187
|
+
action,
|
|
188
|
+
expires: Date.now() + expires * 1000,
|
|
189
|
+
};
|
|
190
|
+
const [url] = yield this.getStorageBucket(bucket).file(key).getSignedUrl(options);
|
|
191
|
+
this._webda.log("TRACE", `The signed url for ${bucket}/${key} is ${url}.`);
|
|
192
|
+
return url;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Retrieve mandatory headers if needed by the cloud provider (ie. Azure)
|
|
197
|
+
* Returns empty object if no headers are mandatory
|
|
198
|
+
* @returns {[key:string]: string} mandatory headers
|
|
199
|
+
*/
|
|
200
|
+
getSignedUrlHeaders() {
|
|
201
|
+
return {};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Retrieve public URL of this object
|
|
205
|
+
* @param {StorageModel} store
|
|
206
|
+
* @returns {string} Public URL in order to download the file
|
|
207
|
+
*/
|
|
208
|
+
getPublicUrl({ bucket, key }) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
return this.getStorageBucket(bucket).file(key).publicUrl();
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Fetch an object's metadata
|
|
215
|
+
* @param {StorageModel} store
|
|
216
|
+
* @returns {any} Metadata
|
|
217
|
+
*/
|
|
218
|
+
getMeta({ bucket, key }) {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
const [metadata] = yield this.getStorageBucket(bucket).file(key).getMetadata();
|
|
221
|
+
return {
|
|
222
|
+
size: parseInt(metadata.size),
|
|
223
|
+
contentType: metadata.contentType,
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @inheritdoc
|
|
229
|
+
*/
|
|
230
|
+
putMarker(hash, uuid, storeName) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
yield this.getStorageBucket()
|
|
233
|
+
.file(this._getKey(hash, uuid))
|
|
234
|
+
.save("", {
|
|
235
|
+
metadata: {
|
|
236
|
+
webdaStore: storeName,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
exports.default = Storage;
|
|
243
|
+
exports.Storage = Storage;
|
|
244
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/services/storage.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;AACb,mDAAmF;AACnF,sCAAoH;AACpH,mCAA0C;AA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+1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const binary_spec_1 = require("@webda/core/lib/services/binary.spec");
|
|
19
|
+
const assert = require("assert");
|
|
20
|
+
const mocha_1 = require("@testdeck/mocha");
|
|
21
|
+
const sinon = require("sinon");
|
|
22
|
+
const storage_1 = require("@google-cloud/storage");
|
|
23
|
+
const path = require("path");
|
|
24
|
+
class MockFile {
|
|
25
|
+
constructor(path) { }
|
|
26
|
+
delete() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
28
|
+
}
|
|
29
|
+
getFiles() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
31
|
+
}
|
|
32
|
+
exists() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
34
|
+
}
|
|
35
|
+
save() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
37
|
+
}
|
|
38
|
+
setMetadata() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
40
|
+
}
|
|
41
|
+
createWriteStream() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
43
|
+
}
|
|
44
|
+
getSignedUrl() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
46
|
+
}
|
|
47
|
+
publicUrl() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
49
|
+
}
|
|
50
|
+
getMetadata() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
52
|
+
}
|
|
53
|
+
createReadStream() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
55
|
+
}
|
|
56
|
+
move() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class MockBucket {
|
|
61
|
+
file(path) {
|
|
62
|
+
return new MockFile(path);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const BUCKET = "webda-dev";
|
|
66
|
+
let StorageTest = class StorageTest extends binary_spec_1.BinaryTest {
|
|
67
|
+
before() {
|
|
68
|
+
const _super = Object.create(null, {
|
|
69
|
+
before: { get: () => super.before }
|
|
70
|
+
});
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
this.buildWebda();
|
|
73
|
+
yield this.install();
|
|
74
|
+
yield _super.before.call(this);
|
|
75
|
+
this.prefix = this.getBinary().getWebda().getUuid();
|
|
76
|
+
this.getBinary().getParameters().prefix = this.prefix;
|
|
77
|
+
// Prepare for Mocked Version
|
|
78
|
+
if (!process.env.NO_MOCK && false) {
|
|
79
|
+
sinon.stub(this.getBinary(), "getStorageBucket").callsFake(() => {
|
|
80
|
+
return new MockBucket();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
after() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
yield this.cleanData();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
install() {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
var storage = new storage_1.Storage();
|
|
93
|
+
try {
|
|
94
|
+
let [metadata] = yield storage.bucket(BUCKET).getMetadata();
|
|
95
|
+
if (!metadata) {
|
|
96
|
+
yield storage.createBucket(BUCKET, { location: "US-WEST2", storageClass: "COLDLINE" });
|
|
97
|
+
yield storage.bucket(BUCKET).getMetadata();
|
|
98
|
+
}
|
|
99
|
+
//this.webda.log("INFO", `Google cloud storage bucket '${BUCKET}' exists`);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
this.webda.log("ERROR", `Google cloud storage error (${e.message})`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
cleanData() {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
var storage = new storage_1.Storage();
|
|
109
|
+
const [files] = yield storage.bucket(BUCKET).getFiles({
|
|
110
|
+
prefix: this.prefix,
|
|
111
|
+
});
|
|
112
|
+
for (let file of files) {
|
|
113
|
+
yield file.delete();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Override getNotFound as exception is raised after
|
|
118
|
+
// @test
|
|
119
|
+
// async getNotFound() {}
|
|
120
|
+
putObject() {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const body = `RAW Body: ${new Date()}`;
|
|
123
|
+
const name = `${this.prefix}/plop/test`;
|
|
124
|
+
yield this.getBinary().putObject(name, Buffer.from(body), { meta1: "meta1" }, BUCKET);
|
|
125
|
+
let getFile = this.getBinary().getStorageBucket().file(name);
|
|
126
|
+
assert.deepStrictEqual((yield getFile.getMetadata())[0].metadata, { meta1: "meta1" });
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Override getNotFound as exception is raised after
|
|
130
|
+
getNotFound() {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
132
|
+
}
|
|
133
|
+
httpGetError() {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
// GET is not through classic binary
|
|
136
|
+
// Skip it
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
redirectUrl() {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
let { user1, ctx } = yield this.setupDefault();
|
|
142
|
+
// Making sure we are redirected on GET
|
|
143
|
+
let executor = this.getExecutor(ctx, "test.webda.io", "GET", `/binary/users/${user1.getUuid()}/images/0`, {});
|
|
144
|
+
yield executor.execute(ctx);
|
|
145
|
+
assert.ok(ctx.getResponseHeaders().Location !== undefined);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
redirectUrlInfo() {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
let { user1, ctx } = yield this.setupDefault();
|
|
151
|
+
// Making sure we are redirected on GET
|
|
152
|
+
let executor = this.getExecutor(ctx, "test.webda.io", "GET", `/binary/users/${user1.getUuid()}/images/0/url`, {});
|
|
153
|
+
yield executor.execute(ctx);
|
|
154
|
+
assert.ok(ctx.getResponseHeaders().Location === undefined);
|
|
155
|
+
assert.notStrictEqual(JSON.parse(ctx.getResponseBody()).Location, undefined);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
cascadeDelete() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
let stubDelete = sinon.stub(this.getBinary(), "_cleanUsage").callsFake(() => {
|
|
161
|
+
throw new Error();
|
|
162
|
+
});
|
|
163
|
+
try {
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
yield this.getBinary().cascadeDelete({ hash: "pp" }, "pp");
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
stubDelete.restore();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
defaultGCS() {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
let { user1, ctx } = yield this.setupDefault();
|
|
175
|
+
// COV for double
|
|
176
|
+
const binary = this.getBinary();
|
|
177
|
+
const from = `${this.prefix}/rawAccess`;
|
|
178
|
+
const to = `${this.prefix}/movedAccess`;
|
|
179
|
+
yield binary.putObject(from, path.join(__dirname, "..", "..", "test", "Dockerfile.txt"));
|
|
180
|
+
yield binary.moveObject({ key: from }, { key: to });
|
|
181
|
+
assert.deepStrictEqual(binary.getSignedUrlHeaders(), {});
|
|
182
|
+
const meta = yield binary.getMeta({ bucket: "webda-dev", key: to });
|
|
183
|
+
assert.deepStrictEqual(meta, { size: 311, contentType: "text/plain" });
|
|
184
|
+
assert.ok(/https:\/\/storage\.googleapis\.com\/webda-dev\/webda-dev/.exec(yield binary.getPublicUrl({ key: "webda-dev" })));
|
|
185
|
+
yield binary.deleteObject({ key: to });
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
__decorate([
|
|
190
|
+
mocha_1.test
|
|
191
|
+
], StorageTest.prototype, "putObject", null);
|
|
192
|
+
__decorate([
|
|
193
|
+
mocha_1.test
|
|
194
|
+
], StorageTest.prototype, "getNotFound", null);
|
|
195
|
+
__decorate([
|
|
196
|
+
mocha_1.test
|
|
197
|
+
], StorageTest.prototype, "httpGetError", null);
|
|
198
|
+
__decorate([
|
|
199
|
+
mocha_1.test
|
|
200
|
+
], StorageTest.prototype, "redirectUrl", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
mocha_1.test
|
|
203
|
+
], StorageTest.prototype, "redirectUrlInfo", null);
|
|
204
|
+
__decorate([
|
|
205
|
+
mocha_1.test
|
|
206
|
+
], StorageTest.prototype, "cascadeDelete", null);
|
|
207
|
+
__decorate([
|
|
208
|
+
mocha_1.test
|
|
209
|
+
], StorageTest.prototype, "defaultGCS", null);
|
|
210
|
+
StorageTest = __decorate([
|
|
211
|
+
mocha_1.suite
|
|
212
|
+
], StorageTest);
|
|
213
|
+
//# sourceMappingURL=storage.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.spec.js","sourceRoot":"","sources":["../../src/services/storage.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sEAAkE;AAClE,iCAAiC;AACjC,2CAA8C;AAE9C,+BAA+B;AAC/B,mDAAuD;AACvD,6BAA6B;AAE7B,MAAM,QAAQ;IACZ,YAAY,IAAI,IAAG,CAAC;IACd,MAAM;8DAAI,CAAC;KAAA;IACX,QAAQ;8DAAI,CAAC;KAAA;IACb,MAAM;8DAAI,CAAC;KAAA;IACX,IAAI;8DAAI,CAAC;KAAA;IACT,WAAW;8DAAI,CAAC;KAAA;IAChB,iBAAiB;8DAAI,CAAC;KAAA;IACtB,YAAY;8DAAI,CAAC;KAAA;IACjB,SAAS;8DAAI,CAAC;KAAA;IACd,WAAW;8DAAI,CAAC;KAAA;IAChB,gBAAgB;8DAAI,CAAC;KAAA;IACrB,IAAI;8DAAI,CAAC;KAAA;CAChB;AAED,MAAM,UAAU;IACd,IAAI,CAAC,IAAY;QACf,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AACD,MAAM,MAAM,GAAG,WAAW,CAAC;AAE3B,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,wBAAmB;IAErC,MAAM;;;;;YACV,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,OAAM,MAAM,WAAE,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,E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|
+
"description": "Webda GCP Services implementation",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "webda build",
|
|
8
|
+
"pretest": "npm run build",
|
|
9
|
+
"lint": "prettier --check src/**/*",
|
|
10
|
+
"lint:fix": "prettier --write src/**/*",
|
|
11
|
+
"test": "nyc mocha --recursive --exit --timeout=100000 -r ../../node_modules/ts-node/register src/**/*.spec.ts"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/loopingz/webda.io.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"webda",
|
|
19
|
+
"modda"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"lib",
|
|
23
|
+
"webda.module.json",
|
|
24
|
+
"package.json"
|
|
25
|
+
],
|
|
26
|
+
"author": "abalam666",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/loopingz/webda.io/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/loopingz/webda.io#readme",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@google-cloud/firestore": "^5.0.2",
|
|
34
|
+
"@google-cloud/pubsub": "^2.19.0",
|
|
35
|
+
"@google-cloud/storage": "^5.16.0",
|
|
36
|
+
"@webda/core": "^2.0.0-beta.0"
|
|
37
|
+
},
|
|
38
|
+
"nyc": {
|
|
39
|
+
"extends": "@istanbuljs/nyc-config-typescript",
|
|
40
|
+
"report-dir": "./reports",
|
|
41
|
+
"reporter": [
|
|
42
|
+
"html",
|
|
43
|
+
"lcov",
|
|
44
|
+
"json",
|
|
45
|
+
"text"
|
|
46
|
+
],
|
|
47
|
+
"exclude": [
|
|
48
|
+
"**/*.spec.ts",
|
|
49
|
+
"test/**/*"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@testdeck/mocha": "^0.2.0",
|
|
57
|
+
"@types/node": "14.0.0",
|
|
58
|
+
"@webda/async": "^2.0.0-beta.0",
|
|
59
|
+
"@webda/shell": "^2.0.0-beta.0",
|
|
60
|
+
"sinon": "^13.0.1"
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "5a559bca55832e9a6526794117e2f78188eba3d0"
|
|
63
|
+
}
|