@travetto/model-mongo 3.1.4 → 3.1.6
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/package.json +4 -4
- package/src/service.ts +14 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-mongo",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
4
4
|
"description": "Mongo backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mongo",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@travetto/config": "^3.1.2",
|
|
29
|
-
"@travetto/model": "^3.1.
|
|
30
|
-
"@travetto/model-query": "^3.1.
|
|
29
|
+
"@travetto/model": "^3.1.8",
|
|
30
|
+
"@travetto/model-query": "^3.1.6",
|
|
31
31
|
"mongodb": "^5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/command": "^3.1.
|
|
34
|
+
"@travetto/command": "^3.1.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@travetto/command": {
|
package/src/service.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ModelCrudSupport, ModelStorageSupport, ModelStreamSupport,
|
|
8
8
|
ModelExpirySupport, ModelBulkSupport, ModelIndexedSupport,
|
|
9
9
|
StreamMeta, BulkOp, BulkResponse,
|
|
10
|
-
NotFoundError, ExistsError, IndexConfig
|
|
10
|
+
NotFoundError, ExistsError, IndexConfig, PartialStream
|
|
11
11
|
} from '@travetto/model';
|
|
12
12
|
import {
|
|
13
13
|
ModelQuery, ModelQueryCrudSupport, ModelQueryFacetSupport, ModelQuerySupport,
|
|
@@ -26,7 +26,7 @@ import { ModelQuerySuggestUtil } from '@travetto/model-query/src/internal/servic
|
|
|
26
26
|
import { PointImpl } from '@travetto/model-query/src/internal/model/point';
|
|
27
27
|
import { ModelQueryExpiryUtil } from '@travetto/model-query/src/internal/service/expiry';
|
|
28
28
|
import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
|
|
29
|
-
import { StreamModel, STREAMS } from '@travetto/model/src/internal/service/stream';
|
|
29
|
+
import { ModelStreamUtil, StreamModel, STREAMS } from '@travetto/model/src/internal/service/stream';
|
|
30
30
|
import { AllViewⲐ } from '@travetto/schema/src/internal/types';
|
|
31
31
|
import { ModelBulkUtil } from '@travetto/model/src/internal/service/bulk';
|
|
32
32
|
|
|
@@ -308,6 +308,18 @@ export class MongoModelService implements
|
|
|
308
308
|
return res;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
async getStreamPartial(location: string, start: number, end?: number): Promise<PartialStream> {
|
|
312
|
+
const meta = await this.describeStream(location);
|
|
313
|
+
|
|
314
|
+
[start, end] = ModelStreamUtil.enforceRange(start, end, meta.size);
|
|
315
|
+
|
|
316
|
+
const res = await this.#bucket.openDownloadStreamByName(location, { start, end: end + 1 });
|
|
317
|
+
if (!res) {
|
|
318
|
+
throw new NotFoundError(STREAMS, location);
|
|
319
|
+
}
|
|
320
|
+
return { stream: res, range: [start, end] };
|
|
321
|
+
}
|
|
322
|
+
|
|
311
323
|
async describeStream(location: string): Promise<StreamMeta> {
|
|
312
324
|
return (await this.#describeStreamRaw(location)).metadata;
|
|
313
325
|
}
|