@travetto/model
Advanced tools
Comparing version 4.0.7 to 4.1.0
{ | ||
"name": "@travetto/model", | ||
"version": "4.0.7", | ||
"version": "4.1.0", | ||
"description": "Datastore abstraction for core operations.", | ||
@@ -29,10 +29,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/config": "^4.0.7", | ||
"@travetto/di": "^4.0.7", | ||
"@travetto/registry": "^4.0.7", | ||
"@travetto/schema": "^4.0.7" | ||
"@travetto/config": "^4.1.0", | ||
"@travetto/di": "^4.1.0", | ||
"@travetto/registry": "^4.1.0", | ||
"@travetto/schema": "^4.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@travetto/cli": "^4.0.8", | ||
"@travetto/test": "^4.0.7" | ||
"@travetto/cli": "^4.1.0", | ||
"@travetto/test": "^4.1.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependenciesMeta": { |
@@ -1,2 +0,2 @@ | ||
import { AppError, Class } from '@travetto/base'; | ||
import { Class } from '@travetto/base'; | ||
import { ModelType } from '../../types/model'; | ||
@@ -6,17 +6,2 @@ | ||
export const StreamModel: Class<ModelType> = Cls; | ||
export const STREAMS = '_streams'; | ||
export class ModelStreamUtil { | ||
static enforceRange(start: number, end: number | undefined, size: number): [start: number, end: number] { | ||
end ??= size - 1; | ||
if (Number.isNaN(start) || Number.isNaN(end) || !Number.isFinite(start) || start >= size || start < 0) { | ||
throw new AppError('Invalid position, out of range', 'data'); | ||
} | ||
if (end >= size) { | ||
end = size - 1; | ||
} | ||
return [start, end]; | ||
} | ||
} | ||
export const STREAMS = '_streams'; |
@@ -24,3 +24,3 @@ import fs from 'node:fs/promises'; | ||
import { ExistsError } from '../error/exists'; | ||
import { ModelStreamUtil, StreamModel, STREAMS } from '../internal/service/stream'; | ||
import { StreamModel, STREAMS } from '../internal/service/stream'; | ||
@@ -198,3 +198,3 @@ type Suffix = '.bin' | '.meta' | '.json' | '.expires'; | ||
[start, end] = ModelStreamUtil.enforceRange(start, end, meta.size); | ||
[start, end] = StreamUtil.enforceRange(start, end, meta.size); | ||
@@ -201,0 +201,0 @@ const stream = createReadStream(file, { start, end }); |
@@ -21,3 +21,3 @@ import { Readable } from 'node:stream'; | ||
import { ModelStorageUtil } from '../internal/service/storage'; | ||
import { ModelStreamUtil, StreamModel, STREAMS } from '../internal/service/stream'; | ||
import { StreamModel, STREAMS } from '../internal/service/stream'; | ||
import { IndexConfig } from '../registry/types'; | ||
@@ -257,3 +257,3 @@ | ||
[start, end] = ModelStreamUtil.enforceRange(start, end, buffer.length); | ||
[start, end] = StreamUtil.enforceRange(start, end, buffer.length); | ||
@@ -260,0 +260,0 @@ const stream = await StreamUtil.bufferToStream(buffer.subarray(start, end + 1)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160038
2962
+ Added@types/node@20.17.9(transitive)
- Removed@types/node@20.17.7(transitive)
Updated@travetto/config@^4.1.0
Updated@travetto/di@^4.1.0
Updated@travetto/registry@^4.1.0
Updated@travetto/schema@^4.1.0