@travetto/model-mongo 3.1.5 → 3.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-mongo",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "description": "Mongo backing for the travetto model module.",
5
5
  "keywords": [
6
6
  "mongo",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@travetto/config": "^3.1.2",
29
- "@travetto/model": "^3.1.7",
30
- "@travetto/model-query": "^3.1.5",
29
+ "@travetto/model": "^3.1.8",
30
+ "@travetto/model-query": "^3.1.7",
31
31
  "mongodb": "^5.0.1"
32
32
  },
33
33
  "peerDependencies": {
@@ -160,6 +160,15 @@ export class MongoUtil {
160
160
  for (const [sk, sv] of Object.entries(v)) {
161
161
  v[sk] = ModelQueryUtil.resolveComparator(sv);
162
162
  }
163
+ } else if (firstKey === '$empty') {
164
+ const isEmpty = v.$empty;
165
+ if (isEmpty) {
166
+ v.$size = 0;
167
+ } else {
168
+ v.$exists = true;
169
+ v.$not = { $size: 0 };
170
+ }
171
+ delete v.$empty;
163
172
  } else if (firstKey === '$regex') {
164
173
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
165
174
  v.$regex = DataUtil.toRegex(v.$regex as string | RegExp);
package/src/service.ts CHANGED
@@ -311,9 +311,7 @@ export class MongoModelService implements
311
311
  async getStreamPartial(location: string, start: number, end?: number): Promise<PartialStream> {
312
312
  const meta = await this.describeStream(location);
313
313
 
314
- end ??= meta.size - 1;
315
-
316
- ModelStreamUtil.checkRange(start, end, meta.size);
314
+ [start, end] = ModelStreamUtil.enforceRange(start, end, meta.size);
317
315
 
318
316
  const res = await this.#bucket.openDownloadStreamByName(location, { start, end: end + 1 });
319
317
  if (!res) {