@proteinjs/db-file 1.4.14 → 1.5.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/CHANGELOG.md +20 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +3 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/DbFileStorageDriver.d.ts +2 -1
- package/dist/src/DbFileStorageDriver.d.ts.map +1 -1
- package/dist/src/DbFileStorageDriver.js +23 -7
- package/dist/src/DbFileStorageDriver.js.map +1 -1
- package/dist/src/FileStorage.d.ts +24 -6
- package/dist/src/FileStorage.d.ts.map +1 -1
- package/dist/src/FileStorage.js +57 -22
- package/dist/src/FileStorage.js.map +1 -1
- package/dist/src/FileStorageDriver.d.ts +26 -1
- package/dist/src/FileStorageDriver.d.ts.map +1 -1
- package/dist/src/FileStorageTableWatcher.d.ts +18 -0
- package/dist/src/FileStorageTableWatcher.d.ts.map +1 -0
- package/dist/src/FileStorageTableWatcher.js +96 -0
- package/dist/src/FileStorageTableWatcher.js.map +1 -0
- package/dist/src/routes/getFile.d.ts +11 -0
- package/dist/src/routes/getFile.d.ts.map +1 -1
- package/dist/src/routes/getFile.js +31 -15
- package/dist/src/routes/getFile.js.map +1 -1
- package/dist/src/tables/FileTable.d.ts +12 -4
- package/dist/src/tables/FileTable.d.ts.map +1 -1
- package/dist/src/tables/FileTable.js +5 -7
- package/dist/src/tables/FileTable.js.map +1 -1
- package/dist/test/FileMediaMetadata.test.d.ts +2 -0
- package/dist/test/FileMediaMetadata.test.d.ts.map +1 -0
- package/dist/test/FileMediaMetadata.test.js +154 -0
- package/dist/test/FileMediaMetadata.test.js.map +1 -0
- package/dist/test/FileStorageDeleteFile.test.d.ts +2 -0
- package/dist/test/FileStorageDeleteFile.test.d.ts.map +1 -0
- package/dist/test/FileStorageDeleteFile.test.js +259 -0
- package/dist/test/FileStorageDeleteFile.test.js.map +1 -0
- package/dist/test/FileTestEnvironment.d.ts +33 -0
- package/dist/test/FileTestEnvironment.d.ts.map +1 -0
- package/dist/test/FileTestEnvironment.js +229 -0
- package/dist/test/FileTestEnvironment.js.map +1 -0
- package/dist/test/GetFileRoute.test.d.ts +2 -0
- package/dist/test/GetFileRoute.test.d.ts.map +1 -0
- package/dist/test/GetFileRoute.test.js +432 -0
- package/dist/test/GetFileRoute.test.js.map +1 -0
- package/generated/index.ts +3 -1
- package/index.ts +1 -0
- package/jest.config.js +4 -0
- package/package.json +5 -3
- package/src/DbFileStorageDriver.ts +18 -8
- package/src/FileStorage.ts +48 -23
- package/src/FileStorageDriver.ts +24 -1
- package/src/FileStorageTableWatcher.ts +43 -0
- package/src/routes/getFile.ts +26 -8
- package/src/tables/FileTable.ts +14 -7
- package/test/FileMediaMetadata.test.ts +74 -0
- package/test/FileStorageDeleteFile.test.ts +128 -0
- package/test/FileTestEnvironment.ts +118 -0
- package/test/GetFileRoute.test.ts +258 -0
- package/test/emulatorLock.globalSetup.js +11 -0
- package/test/emulatorLock.globalTeardown.js +8 -0
- package/test/emulatorLock.js +124 -0
- package/test/setup.js +2 -0
|
@@ -0,0 +1,432 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
var http = __importStar(require("http"));
|
|
63
|
+
var reflection_1 = require("@proteinjs/reflection");
|
|
64
|
+
var user_1 = require("@proteinjs/user");
|
|
65
|
+
var FileStorage_1 = require("../src/FileStorage");
|
|
66
|
+
var getFile_1 = require("../src/routes/getFile");
|
|
67
|
+
var FileTestEnvironment_1 = require("./FileTestEnvironment");
|
|
68
|
+
/** Every byte value once — a payload that corrupts under any text/base64 mix-up. */
|
|
69
|
+
var rawBytes = Buffer.from(Array.from({ length: 256 }, function (_, i) { return i; }));
|
|
70
|
+
/**
|
|
71
|
+
* In-memory byte store shaped like the GoogleCloudStorageDriver WITHOUT signed-URL support:
|
|
72
|
+
* the proxy-serving case (DbFileStorageDriver shape). Stores true bytes at rest per the driver
|
|
73
|
+
* contract; the interface strings are base64.
|
|
74
|
+
*/
|
|
75
|
+
var TestProxyFileStorageDriver = /** @class */ (function () {
|
|
76
|
+
function TestProxyFileStorageDriver() {
|
|
77
|
+
this.store = new Map();
|
|
78
|
+
}
|
|
79
|
+
TestProxyFileStorageDriver.prototype.createFile = function (file, fileData) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
this.store.set(file.id, Buffer.from(fileData, 'base64'));
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
TestProxyFileStorageDriver.prototype.getFileData = function (fileId) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var data;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
data = this.store.get(fileId);
|
|
92
|
+
if (data === undefined) {
|
|
93
|
+
throw new Error("No such object: ".concat(fileId));
|
|
94
|
+
}
|
|
95
|
+
return [2 /*return*/, data.toString('base64')];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
TestProxyFileStorageDriver.prototype.updateFileData = function (fileId, data) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
this.store.set(fileId, Buffer.from(data, 'base64'));
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
TestProxyFileStorageDriver.prototype.deleteFile = function (fileId) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
this.store.delete(fileId);
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return TestProxyFileStorageDriver;
|
|
116
|
+
}());
|
|
117
|
+
/**
|
|
118
|
+
* Local GCS shim: the signed-URL serving case. Blobs live as TRUE bytes behind a real local HTTP
|
|
119
|
+
* server (as they do in GCS); `getSignedUrl` mints a URL into that server's URL space, and
|
|
120
|
+
* clients read the bytes directly from it — exactly the redirect flow the route implements.
|
|
121
|
+
*/
|
|
122
|
+
var TestSignedUrlFileStorageDriver = /** @class */ (function () {
|
|
123
|
+
function TestSignedUrlFileStorageDriver() {
|
|
124
|
+
this.store = new Map();
|
|
125
|
+
}
|
|
126
|
+
TestSignedUrlFileStorageDriver.prototype.start = function () {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var _this = this;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
this.server = http.createServer(function (req, res) {
|
|
133
|
+
var _a;
|
|
134
|
+
var fileId = ((_a = req.url) !== null && _a !== void 0 ? _a : '').replace(/^\/blob\//, '').split('?')[0];
|
|
135
|
+
var blob = _this.store.get(fileId);
|
|
136
|
+
if (!blob) {
|
|
137
|
+
res.writeHead(404).end();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
res.writeHead(200, { 'Content-Type': blob.contentType, 'Content-Length': blob.bytes.length });
|
|
141
|
+
res.end(blob.bytes);
|
|
142
|
+
});
|
|
143
|
+
return [4 /*yield*/, new Promise(function (resolve) { return _this.server.listen(0, '127.0.0.1', resolve); })];
|
|
144
|
+
case 1:
|
|
145
|
+
_a.sent();
|
|
146
|
+
this.port = this.server.address().port;
|
|
147
|
+
return [2 /*return*/];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
TestSignedUrlFileStorageDriver.prototype.stop = function () {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
+
var _this = this;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
if (!this.server) return [3 /*break*/, 2];
|
|
159
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) { return _this.server.close(function (err) { return (err ? reject(err) : resolve()); }); })];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
_a.label = 2;
|
|
163
|
+
case 2: return [2 /*return*/];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
TestSignedUrlFileStorageDriver.prototype.createFile = function (file, fileData) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
this.store.set(file.id, { bytes: Buffer.from(fileData, 'base64'), contentType: file.type });
|
|
172
|
+
return [2 /*return*/];
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
TestSignedUrlFileStorageDriver.prototype.getFileData = function (fileId) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
var blob;
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
blob = this.store.get(fileId);
|
|
181
|
+
if (blob === undefined) {
|
|
182
|
+
throw new Error("No such object: ".concat(fileId));
|
|
183
|
+
}
|
|
184
|
+
return [2 /*return*/, blob.bytes.toString('base64')];
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
TestSignedUrlFileStorageDriver.prototype.updateFileData = function (fileId, data) {
|
|
189
|
+
var _a;
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
var existing;
|
|
192
|
+
return __generator(this, function (_b) {
|
|
193
|
+
existing = this.store.get(fileId);
|
|
194
|
+
this.store.set(fileId, {
|
|
195
|
+
bytes: Buffer.from(data, 'base64'),
|
|
196
|
+
contentType: (_a = existing === null || existing === void 0 ? void 0 : existing.contentType) !== null && _a !== void 0 ? _a : 'application/octet-stream',
|
|
197
|
+
});
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
TestSignedUrlFileStorageDriver.prototype.getSignedUrl = function (fileId, options) {
|
|
203
|
+
var _a;
|
|
204
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
205
|
+
var expires;
|
|
206
|
+
return __generator(this, function (_b) {
|
|
207
|
+
expires = Date.now() + ((_a = options === null || options === void 0 ? void 0 : options.ttlMs) !== null && _a !== void 0 ? _a : 15 * 60 * 1000);
|
|
208
|
+
return [2 /*return*/, "http://127.0.0.1:".concat(this.port, "/blob/").concat(fileId, "?sig=test&expires=").concat(expires)];
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
TestSignedUrlFileStorageDriver.prototype.deleteFile = function (fileId) {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
214
|
+
return __generator(this, function (_a) {
|
|
215
|
+
this.store.delete(fileId);
|
|
216
|
+
return [2 /*return*/];
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
return TestSignedUrlFileStorageDriver;
|
|
221
|
+
}());
|
|
222
|
+
/** Minimal express Response recorder — the route only touches these members. */
|
|
223
|
+
var ResponseRecorder = /** @class */ (function () {
|
|
224
|
+
function ResponseRecorder() {
|
|
225
|
+
this.headers = {};
|
|
226
|
+
}
|
|
227
|
+
ResponseRecorder.prototype.status = function (code) {
|
|
228
|
+
this.statusCode = code;
|
|
229
|
+
return this;
|
|
230
|
+
};
|
|
231
|
+
ResponseRecorder.prototype.send = function (body) {
|
|
232
|
+
this.body = body;
|
|
233
|
+
return this;
|
|
234
|
+
};
|
|
235
|
+
ResponseRecorder.prototype.setHeader = function (name, value) {
|
|
236
|
+
this.headers[name.toLowerCase()] = value;
|
|
237
|
+
};
|
|
238
|
+
ResponseRecorder.prototype.redirect = function (status, url) {
|
|
239
|
+
this.statusCode = status;
|
|
240
|
+
this.redirectUrl = url;
|
|
241
|
+
};
|
|
242
|
+
return ResponseRecorder;
|
|
243
|
+
}());
|
|
244
|
+
var invokeRoute = function (fileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
245
|
+
var response;
|
|
246
|
+
return __generator(this, function (_a) {
|
|
247
|
+
switch (_a.label) {
|
|
248
|
+
case 0:
|
|
249
|
+
response = new ResponseRecorder();
|
|
250
|
+
return [4 /*yield*/, getFile_1.getFile.onRequest({ params: { id: fileId } }, response)];
|
|
251
|
+
case 1:
|
|
252
|
+
_a.sent();
|
|
253
|
+
return [2 /*return*/, response];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}); };
|
|
257
|
+
var testEnv = new FileTestEnvironment_1.FileTestEnvironment();
|
|
258
|
+
var user;
|
|
259
|
+
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
260
|
+
var objectCache;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
switch (_a.label) {
|
|
263
|
+
case 0: return [4 /*yield*/, testEnv.beforeAll()];
|
|
264
|
+
case 1:
|
|
265
|
+
_a.sent();
|
|
266
|
+
objectCache = reflection_1.SourceRepository.get().objectCache;
|
|
267
|
+
objectCache['@proteinjs/user-auth/AuthenticatedUserRepo'] = [new user_1.UserRepo()];
|
|
268
|
+
user_1.UserAuth.userRepo = undefined;
|
|
269
|
+
return [4 /*yield*/, testEnv.createUser({ name: 'File owner', email: 'file-owner@test.local' })];
|
|
270
|
+
case 2:
|
|
271
|
+
user = _a.sent();
|
|
272
|
+
testEnv.actAs(user);
|
|
273
|
+
return [2 /*return*/];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}); });
|
|
277
|
+
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
278
|
+
return __generator(this, function (_a) {
|
|
279
|
+
switch (_a.label) {
|
|
280
|
+
case 0:
|
|
281
|
+
user_1.UserAuth.userRepo = undefined;
|
|
282
|
+
return [4 /*yield*/, testEnv.afterAll()];
|
|
283
|
+
case 1:
|
|
284
|
+
_a.sent();
|
|
285
|
+
return [2 /*return*/];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}); });
|
|
289
|
+
describe('GET /file/:id — proxy serving (driver without signed URLs)', function () {
|
|
290
|
+
var driver = new TestProxyFileStorageDriver();
|
|
291
|
+
beforeAll(function () {
|
|
292
|
+
testEnv.setDriver(driver);
|
|
293
|
+
});
|
|
294
|
+
it('serves a non-image binary byte-identical (video/mp4 round-trip)', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
295
|
+
var file, response;
|
|
296
|
+
return __generator(this, function (_a) {
|
|
297
|
+
switch (_a.label) {
|
|
298
|
+
case 0: return [4 /*yield*/, new FileStorage_1.FileStorage().createFile({ name: 'clip.mp4', type: 'video/mp4', size: rawBytes.length }, rawBytes.toString('base64'))];
|
|
299
|
+
case 1:
|
|
300
|
+
file = _a.sent();
|
|
301
|
+
return [4 /*yield*/, invokeRoute(file.id)];
|
|
302
|
+
case 2:
|
|
303
|
+
response = _a.sent();
|
|
304
|
+
expect(response.redirectUrl).toBeUndefined();
|
|
305
|
+
expect(response.headers['content-type']).toEqual('video/mp4');
|
|
306
|
+
expect(Buffer.isBuffer(response.body)).toBe(true);
|
|
307
|
+
expect(Buffer.compare(response.body, rawBytes)).toBe(0);
|
|
308
|
+
return [2 /*return*/];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}); });
|
|
312
|
+
it('still serves images byte-identical (no regression on the decoded-image path)', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
+
var file, response;
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0: return [4 /*yield*/, new FileStorage_1.FileStorage().createFile({ name: 'shot.png', type: 'image/png', size: rawBytes.length }, rawBytes.toString('base64'))];
|
|
317
|
+
case 1:
|
|
318
|
+
file = _a.sent();
|
|
319
|
+
return [4 /*yield*/, invokeRoute(file.id)];
|
|
320
|
+
case 2:
|
|
321
|
+
response = _a.sent();
|
|
322
|
+
expect(Buffer.isBuffer(response.body)).toBe(true);
|
|
323
|
+
expect(Buffer.compare(response.body, rawBytes)).toBe(0);
|
|
324
|
+
return [2 /*return*/];
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}); });
|
|
328
|
+
});
|
|
329
|
+
describe('GET /file/:id — signed-URL serving (302 redirect)', function () {
|
|
330
|
+
var driver = new TestSignedUrlFileStorageDriver();
|
|
331
|
+
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
332
|
+
return __generator(this, function (_a) {
|
|
333
|
+
switch (_a.label) {
|
|
334
|
+
case 0: return [4 /*yield*/, driver.start()];
|
|
335
|
+
case 1:
|
|
336
|
+
_a.sent();
|
|
337
|
+
testEnv.setDriver(driver);
|
|
338
|
+
return [2 /*return*/];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}); });
|
|
342
|
+
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
343
|
+
return __generator(this, function (_a) {
|
|
344
|
+
switch (_a.label) {
|
|
345
|
+
case 0: return [4 /*yield*/, driver.stop()];
|
|
346
|
+
case 1:
|
|
347
|
+
_a.sent();
|
|
348
|
+
return [2 /*return*/];
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}); });
|
|
352
|
+
it('302-redirects to the signed URL; following it yields the true bytes, byte-identical', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
353
|
+
var file, response, blobResponse, served, _a, _b;
|
|
354
|
+
return __generator(this, function (_c) {
|
|
355
|
+
switch (_c.label) {
|
|
356
|
+
case 0: return [4 /*yield*/, new FileStorage_1.FileStorage().createFile({ name: 'clip.mp4', type: 'video/mp4', size: rawBytes.length }, rawBytes.toString('base64'))];
|
|
357
|
+
case 1:
|
|
358
|
+
file = _c.sent();
|
|
359
|
+
return [4 /*yield*/, invokeRoute(file.id)];
|
|
360
|
+
case 2:
|
|
361
|
+
response = _c.sent();
|
|
362
|
+
expect(response.statusCode).toEqual(302);
|
|
363
|
+
expect(response.redirectUrl).toBeDefined();
|
|
364
|
+
return [4 /*yield*/, fetch(response.redirectUrl)];
|
|
365
|
+
case 3:
|
|
366
|
+
blobResponse = _c.sent();
|
|
367
|
+
expect(blobResponse.status).toEqual(200);
|
|
368
|
+
expect(blobResponse.headers.get('content-type')).toEqual('video/mp4');
|
|
369
|
+
_b = (_a = Buffer).from;
|
|
370
|
+
return [4 /*yield*/, blobResponse.arrayBuffer()];
|
|
371
|
+
case 4:
|
|
372
|
+
served = _b.apply(_a, [_c.sent()]);
|
|
373
|
+
expect(Buffer.compare(served, rawBytes)).toBe(0);
|
|
374
|
+
return [2 /*return*/];
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}); });
|
|
378
|
+
it('caches the redirect briefly so repeated loads reuse one signed URL within its TTL', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
+
var file, response;
|
|
380
|
+
return __generator(this, function (_a) {
|
|
381
|
+
switch (_a.label) {
|
|
382
|
+
case 0: return [4 /*yield*/, new FileStorage_1.FileStorage().createFile({ name: 'shot.png', type: 'image/png', size: rawBytes.length }, rawBytes.toString('base64'))];
|
|
383
|
+
case 1:
|
|
384
|
+
file = _a.sent();
|
|
385
|
+
return [4 /*yield*/, invokeRoute(file.id)];
|
|
386
|
+
case 2:
|
|
387
|
+
response = _a.sent();
|
|
388
|
+
expect(response.statusCode).toEqual(302);
|
|
389
|
+
expect(response.headers['cache-control']).toEqual('private, max-age=300');
|
|
390
|
+
return [2 /*return*/];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}); });
|
|
394
|
+
it('404s on a missing file id without minting a signed URL', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
395
|
+
var response;
|
|
396
|
+
return __generator(this, function (_a) {
|
|
397
|
+
switch (_a.label) {
|
|
398
|
+
case 0: return [4 /*yield*/, invokeRoute('00000000-0000-0000-0000-000000000000')];
|
|
399
|
+
case 1:
|
|
400
|
+
response = _a.sent();
|
|
401
|
+
expect(response.statusCode).toEqual(404);
|
|
402
|
+
expect(response.redirectUrl).toBeUndefined();
|
|
403
|
+
return [2 /*return*/];
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}); });
|
|
407
|
+
it('401s when not logged in, without redirecting or leaking a signed URL', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
408
|
+
var file, response;
|
|
409
|
+
return __generator(this, function (_a) {
|
|
410
|
+
switch (_a.label) {
|
|
411
|
+
case 0: return [4 /*yield*/, new FileStorage_1.FileStorage().createFile({ name: 'clip.mp4', type: 'video/mp4', size: rawBytes.length }, rawBytes.toString('base64'))];
|
|
412
|
+
case 1:
|
|
413
|
+
file = _a.sent();
|
|
414
|
+
testEnv.actAs(user_1.guestUser);
|
|
415
|
+
_a.label = 2;
|
|
416
|
+
case 2:
|
|
417
|
+
_a.trys.push([2, , 4, 5]);
|
|
418
|
+
return [4 /*yield*/, invokeRoute(file.id)];
|
|
419
|
+
case 3:
|
|
420
|
+
response = _a.sent();
|
|
421
|
+
expect(response.statusCode).toEqual(401);
|
|
422
|
+
expect(response.redirectUrl).toBeUndefined();
|
|
423
|
+
return [3 /*break*/, 5];
|
|
424
|
+
case 4:
|
|
425
|
+
testEnv.actAs(user);
|
|
426
|
+
return [7 /*endfinally*/];
|
|
427
|
+
case 5: return [2 /*return*/];
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}); });
|
|
431
|
+
});
|
|
432
|
+
//# sourceMappingURL=GetFileRoute.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetFileRoute.test.js","sourceRoot":"","sources":["../../test/GetFileRoute.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAE7B,oDAAyD;AACzD,wCAAsE;AAEtE,kDAAiD;AAEjD,iDAAgD;AAChD,6DAA4D;AAE5D,oFAAoF;AACpF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BAE7C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;;;;SAEvB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/generated/index.ts
CHANGED
|
@@ -11,17 +11,19 @@ import 'moment';
|
|
|
11
11
|
/** Generate Source Graph */
|
|
12
12
|
|
|
13
13
|
const sourceGraph =
|
|
14
|
-
'{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-file/DefaultFileStorageDriverFactory","value":{"packageName":"@proteinjs/db-file","name":"DefaultFileStorageDriverFactory","filePath":"/home/runner/work/db/db/packages/file/src/FileStorage.ts","qualifiedName":"@proteinjs/db-file/DefaultFileStorageDriverFactory","properties":[],"methods":[{"name":"getDriver","returnType":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/reflection","name":"Loadable","filePath":null,"qualifiedName":"@proteinjs/reflection/Loadable","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/reflection/Loadable"},{"v":"@proteinjs/db-file/FileStorage","value":{"packageName":"@proteinjs/db-file","name":"FileStorage","filePath":"/home/runner/work/db/db/packages/file/src/FileStorage.ts","qualifiedName":"@proteinjs/db-file/FileStorage","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"defaultDriver","type":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"private"},{"name":"driver","type":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"logger","type":{"packageName":"@proteinjs/logger","name":"Logger","filePath":null,"qualifiedName":"@proteinjs/logger/Logger","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"serviceMetadata","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"getDefaultDriver","returnType":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]},{"name":"createFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileMetaData","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}},{"name":"fileData","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFileData","returnType":{"packageName":"","name":"Promise<string>","filePath":null,"qualifiedName":"/Promise<string>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFileData","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"file","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}}]},{"name":"deleteFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db-file","name":"FileStorageService","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageService","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db-file/FileStorageService","value":{"packageName":"@proteinjs/db-file","name":"FileStorageService","filePath":"/home/runner/work/db/db/packages/file/src/services/FileStorageService.ts","qualifiedName":"@proteinjs/db-file/FileStorageService","properties":[],"methods":[{"name":"createFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileMetaData","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}},{"name":"fileData","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFileData","returnType":{"packageName":"","name":"Promise<string>","filePath":null,"qualifiedName":"/Promise<string>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFileData","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"file","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}}]},{"name":"deleteFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/db-file/getFile","value":{"packageName":"@proteinjs/db-file","name":"getFile","filePath":"/home/runner/work/db/db/packages/file/src/routes/getFile.ts","qualifiedName":"@proteinjs/db-file/getFile","type":{"packageName":"@proteinjs/server-api","name":"Route","filePath":null,"qualifiedName":"@proteinjs/server-api/Route","typeParameters":[],"directParents":[{"packageName":"@proteinjs/server-api","name":"Route","filePath":null,"qualifiedName":"@proteinjs/server-api/Route","typeParameters":[],"directParents":null}]},"isExported":true,"isConst":true,"sourceType":0}},{"v":"@proteinjs/server-api/Route"},{"v":"@proteinjs/service/Service"},{"v":"@proteinjs/db-file/FileData","value":{"packageName":"@proteinjs/db-file","name":"FileData","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileDataTable.ts","qualifiedName":"@proteinjs/db-file/FileData","properties":[{"name":"file","type":{"packageName":"","name":"Reference<File>","filePath":null,"qualifiedName":"/Reference<File>","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"order","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":null,"qualifiedName":"@proteinjs/user/ScopedRecord","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/user/ScopedRecord"},{"v":"@proteinjs/db-file/FileDataTable","value":{"packageName":"@proteinjs/db-file","name":"FileDataTable","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileDataTable.ts","qualifiedName":"@proteinjs/db-file/FileDataTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<FileData>[\'auth\']","filePath":null,"qualifiedName":"/Table<FileData>[\'auth\']","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/db-file/FileData"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/db/Table"},{"v":"@proteinjs/db-file/File","value":{"packageName":"@proteinjs/db-file","name":"File","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileTable.ts","qualifiedName":"@proteinjs/db-file/File","properties":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"type","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"size","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"preview","type":{"packageName":"","name":"Reference<File>","filePath":null,"qualifiedName":"/Reference<File>","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":null,"qualifiedName":"@proteinjs/user/ScopedRecord","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/db-file/FileTable","value":{"packageName":"@proteinjs/db-file","name":"FileTable","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileTable.ts","qualifiedName":"@proteinjs/db-file/FileTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<File>[\'auth\']","filePath":null,"qualifiedName":"/Table<File>[\'auth\']","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"cascadeDeleteReferences","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/db-file/File"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}}],"edges":[{"v":"@proteinjs/db-file/DefaultFileStorageDriverFactory","w":"@proteinjs/reflection/Loadable","value":"extends interface"},{"v":"@proteinjs/db-file/FileStorage","w":"@proteinjs/db-file/FileStorageService","value":"implements interface"},{"v":"@proteinjs/db-file/getFile","w":"@proteinjs/server-api/Route","value":"has type"},{"v":"@proteinjs/db-file/FileStorageService","w":"@proteinjs/service/Service","value":"extends interface"},{"v":"@proteinjs/db-file/FileData","w":"@proteinjs/user/ScopedRecord","value":"extends interface"},{"v":"@proteinjs/db-file/FileDataTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/db-file/File","w":"@proteinjs/user/ScopedRecord","value":"extends interface"},{"v":"@proteinjs/db-file/FileTable","w":"@proteinjs/db/Table","value":"extends class"}]}';
|
|
14
|
+
'{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-file/DefaultFileStorageDriverFactory","value":{"packageName":"@proteinjs/db-file","name":"DefaultFileStorageDriverFactory","filePath":"/home/runner/work/db/db/packages/file/src/FileStorage.ts","qualifiedName":"@proteinjs/db-file/DefaultFileStorageDriverFactory","properties":[],"methods":[{"name":"getDriver","returnType":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/reflection","name":"Loadable","filePath":null,"qualifiedName":"@proteinjs/reflection/Loadable","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/reflection/Loadable"},{"v":"@proteinjs/db-file/FileStorage","value":{"packageName":"@proteinjs/db-file","name":"FileStorage","filePath":"/home/runner/work/db/db/packages/file/src/FileStorage.ts","qualifiedName":"@proteinjs/db-file/FileStorage","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"driver","type":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"private"},{"name":"serviceMetadata","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"getDriver","returnType":{"packageName":"@proteinjs/db-file","name":"FileStorageDriver","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageDriver","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"public","parameters":[]},{"name":"createFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileMetaData","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}},{"name":"fileData","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFileData","returnType":{"packageName":"","name":"Promise<string>","filePath":null,"qualifiedName":"/Promise<string>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getSignedUrl","returnType":{"packageName":"","name":"Promise<string | undefined>","filePath":null,"qualifiedName":"/Promise<string | undefined>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"options","type":{"packageName":"@proteinjs/db-file","name":"{ ttlMs?: number }","filePath":null,"qualifiedName":"@proteinjs/db-file/{ ttlMs?: number }","typeParameters":null,"directParents":null}}]},{"name":"updateFileData","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"file","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}}]},{"name":"deleteFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db-file","name":"FileStorageService","filePath":null,"qualifiedName":"@proteinjs/db-file/FileStorageService","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db-file/FileStorageService","value":{"packageName":"@proteinjs/db-file","name":"FileStorageService","filePath":"/home/runner/work/db/db/packages/file/src/services/FileStorageService.ts","qualifiedName":"@proteinjs/db-file/FileStorageService","properties":[],"methods":[{"name":"createFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileMetaData","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}},{"name":"fileData","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFile","returnType":{"packageName":"","name":"Promise<File>","filePath":null,"qualifiedName":"/Promise<File>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"getFileData","returnType":{"packageName":"","name":"Promise<string>","filePath":null,"qualifiedName":"/Promise<string>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFileData","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updateFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"file","type":{"packageName":"","name":"Omit<File, keyof ScopedRecord>","filePath":null,"qualifiedName":"/Omit<File, keyof ScopedRecord>","typeParameters":null,"directParents":null}}]},{"name":"deleteFile","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"fileId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/db-file/FileStorageTableWatcher","value":{"packageName":"@proteinjs/db-file","name":"FileStorageTableWatcher","filePath":"/home/runner/work/db/db/packages/file/src/FileStorageTableWatcher.ts","qualifiedName":"@proteinjs/db-file/FileStorageTableWatcher","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"}],"methods":[{"name":"name","returnType":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"table","returnType":{"packageName":"","name":"Table<File>","filePath":null,"qualifiedName":"/Table<File>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"beforeDelete","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"recordsToDelete","type":{"packageName":"","name":"T[]","filePath":null,"qualifiedName":"/T[]","typeParameters":null,"directParents":null}},{"name":"initialQb","type":{"packageName":"","name":"QueryBuilder<T>","filePath":null,"qualifiedName":"/QueryBuilder<T>","typeParameters":null,"directParents":null}},{"name":"deleteQb","type":{"packageName":"","name":"QueryBuilder<T>","filePath":null,"qualifiedName":"/QueryBuilder<T>","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/db","name":"TableWatcher","filePath":null,"qualifiedName":"@proteinjs/db/TableWatcher","properties":[],"methods":[],"typeParameters":["@proteinjs/db-file/File"],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/db/TableWatcher"},{"v":"@proteinjs/db-file/getFile","value":{"packageName":"@proteinjs/db-file","name":"getFile","filePath":"/home/runner/work/db/db/packages/file/src/routes/getFile.ts","qualifiedName":"@proteinjs/db-file/getFile","type":{"packageName":"@proteinjs/server-api","name":"Route","filePath":null,"qualifiedName":"@proteinjs/server-api/Route","typeParameters":[],"directParents":[{"packageName":"@proteinjs/server-api","name":"Route","filePath":null,"qualifiedName":"@proteinjs/server-api/Route","typeParameters":[],"directParents":null}]},"isExported":true,"isConst":true,"sourceType":0}},{"v":"@proteinjs/server-api/Route"},{"v":"@proteinjs/db-file/FileData","value":{"packageName":"@proteinjs/db-file","name":"FileData","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileDataTable.ts","qualifiedName":"@proteinjs/db-file/FileData","properties":[{"name":"file","type":{"packageName":"","name":"Reference<File>","filePath":null,"qualifiedName":"/Reference<File>","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"order","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"data","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":null,"qualifiedName":"@proteinjs/user/ScopedRecord","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/user/ScopedRecord"},{"v":"@proteinjs/db-file/FileDataTable","value":{"packageName":"@proteinjs/db-file","name":"FileDataTable","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileDataTable.ts","qualifiedName":"@proteinjs/db-file/FileDataTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<FileData>[\'auth\']","filePath":null,"qualifiedName":"/Table<FileData>[\'auth\']","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/db-file/FileData"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/db/Table"},{"v":"@proteinjs/db-file/File","value":{"packageName":"@proteinjs/db-file","name":"File","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileTable.ts","qualifiedName":"@proteinjs/db-file/File","properties":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"type","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"size","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"preview","type":{"packageName":"","name":"Reference<File>","filePath":null,"qualifiedName":"/Reference<File>","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"width","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"height","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"durationMs","type":{"packageName":"","name":"number","filePath":null,"qualifiedName":"/number","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":null,"qualifiedName":"@proteinjs/user/ScopedRecord","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/db-file/FileTable","value":{"packageName":"@proteinjs/db-file","name":"FileTable","filePath":"/home/runner/work/db/db/packages/file/src/tables/FileTable.ts","qualifiedName":"@proteinjs/db-file/FileTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<File>[\'auth\']","filePath":null,"qualifiedName":"/Table<File>[\'auth\']","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/db-file/File"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/service/Service"}],"edges":[{"v":"@proteinjs/db-file/DefaultFileStorageDriverFactory","w":"@proteinjs/reflection/Loadable","value":"extends interface"},{"v":"@proteinjs/db-file/FileStorage","w":"@proteinjs/db-file/FileStorageService","value":"implements interface"},{"v":"@proteinjs/db-file/FileStorageTableWatcher","w":"@proteinjs/db/TableWatcher","value":"implements interface"},{"v":"@proteinjs/db-file/getFile","w":"@proteinjs/server-api/Route","value":"has type"},{"v":"@proteinjs/db-file/FileData","w":"@proteinjs/user/ScopedRecord","value":"extends interface"},{"v":"@proteinjs/db-file/FileDataTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/db-file/File","w":"@proteinjs/user/ScopedRecord","value":"extends interface"},{"v":"@proteinjs/db-file/FileTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/db-file/FileStorageService","w":"@proteinjs/service/Service","value":"extends interface"}]}';
|
|
15
15
|
|
|
16
16
|
/** Generate Source Links */
|
|
17
17
|
|
|
18
18
|
import { FileStorage } from '../src/FileStorage';
|
|
19
|
+
import { FileStorageTableWatcher } from '../src/FileStorageTableWatcher';
|
|
19
20
|
import { getFile } from '../src/routes/getFile';
|
|
20
21
|
import { FileDataTable } from '../src/tables/FileDataTable';
|
|
21
22
|
import { FileTable } from '../src/tables/FileTable';
|
|
22
23
|
|
|
23
24
|
const sourceLinks = {
|
|
24
25
|
'@proteinjs/db-file/FileStorage': FileStorage,
|
|
26
|
+
'@proteinjs/db-file/FileStorageTableWatcher': FileStorageTableWatcher,
|
|
25
27
|
'@proteinjs/db-file/getFile': getFile,
|
|
26
28
|
'@proteinjs/db-file/FileDataTable': FileDataTable,
|
|
27
29
|
'@proteinjs/db-file/FileTable': FileTable,
|
package/index.ts
CHANGED
package/jest.config.js
CHANGED
|
@@ -6,4 +6,8 @@ module.exports = {
|
|
|
6
6
|
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
|
|
7
7
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
8
8
|
testEnvironment: 'node',
|
|
9
|
+
testTimeout: 60000,
|
|
10
|
+
setupFiles: ['./test/setup'],
|
|
11
|
+
globalSetup: './test/emulatorLock.globalSetup.js',
|
|
12
|
+
globalTeardown: './test/emulatorLock.globalTeardown.js',
|
|
9
13
|
};
|