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 0.3.8 to 0.3.9

10

package.json

@@ -10,8 +10,8 @@ {

"dependencies": {
"@travetto/di": "^0.3.5",
"@travetto/schema": "^0.3.6"
"@travetto/di": "^0.3.6",
"@travetto/schema": "^0.3.7"
},
"description": "Datastore abstraction for CRUD operations with advanced query support.",
"devDependencies": {
"@travetto/test": "^0.3.5"
"@travetto/test": "^0.3.6"
},

@@ -36,4 +36,4 @@ "optionalExtensionDependencies": {

},
"version": "0.3.8",
"gitHead": "b4f46ddcd29fe1e3fafbd1da75cd5530815f6d39"
"version": "0.3.9",
"gitHead": "a97a54d48f681c8a3c265803ab1f8d8da1690f39"
}

@@ -19,12 +19,4 @@ import { SchemaRegistry, SchemaChangeEvent } from '@travetto/schema';

}
onSchemaChange(cb: (x: SchemaChangeEvent) => void) {
SchemaRegistry.onSchemaChange((e) => {
if (this.has(e.cls)) {
cb(e);
}
});
}
}
export const ModelRegistry = new $ModelRegistry();
import { Class } from '@travetto/registry';
import { BindUtil, SchemaValidator, DEFAULT_VIEW } from '@travetto/schema';
import { BindUtil, SchemaValidator, DEFAULT_VIEW, SchemaRegistry } from '@travetto/schema';
import { Injectable } from '@travetto/di';

@@ -35,3 +35,7 @@ import { Env, Util } from '@travetto/base';

if (this.source.onSchemaChange) {
ModelRegistry.onSchemaChange(this.source.onSchemaChange.bind(this.source));
SchemaRegistry.onSchemaChange(event => {
if (ModelRegistry.has(event.cls)) {
this.source.onSchemaChange!(event);
}
});
}

@@ -87,7 +91,7 @@ if (this.source.onChange) {

/** Executes a raw query against the model space */
async query<T extends ModelCore, U = T>(cls: Class<T>, query: Query<T>) {
async query<T extends ModelCore, U = T>(cls: Class<T>, query: Query<T>): Promise<U[]> {
this.queryService.verify(cls, query);
const res = await this.source.query<T, U>(cls, query);
return res.map(o => this.postLoad(cls, o as any as T));
return res.map(o => this.postLoad(cls, o as any as T) as any as U);
}

@@ -94,0 +98,0 @@

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