Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/model

Package Overview
Dependencies
Maintainers
1
Versions
371
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/model - npm Package Compare versions

Comparing version 4.0.7 to 4.1.0

14

package.json
{
"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));

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc