Socket
Socket
Sign inDemoInstall

@furystack/repository

Package Overview
Dependencies
Maintainers
1
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@furystack/repository - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

1

esm/repository.js

@@ -41,3 +41,2 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

}
storeManager;
};

@@ -44,0 +43,0 @@ __decorate([

10

package.json
{
"name": "@furystack/repository",
"version": "9.0.0",
"version": "9.0.1",
"description": "Repository implementation for FuryStack",

@@ -40,8 +40,8 @@ "type": "module",

"dependencies": {
"@furystack/core": "^14.0.0",
"@furystack/inject": "^10.0.0",
"@furystack/utils": "^6.0.0"
"@furystack/core": "^14.0.1",
"@furystack/inject": "^11.0.0",
"@furystack/utils": "^6.0.1"
},
"devDependencies": {
"typescript": "^5.4.2",
"typescript": "^5.4.3",
"vitest": "^1.4.0"

@@ -48,0 +48,0 @@ },

@@ -13,4 +13,4 @@ # repository

class MyModel {
public id!: number
public value!: string
declare id: number
declare value: string
}

@@ -20,4 +20,4 @@

myInjector
.setupStores(stores => stores.addStore(new InMemoryStore({ model: MyModel, primaryKey: 'id' })))
.setupRepository(repo =>
.setupStores((stores) => stores.addStore(new InMemoryStore({ model: MyModel, primaryKey: 'id' })))
.setupRepository((repo) =>
repo.createDataSet(MyModel, {

@@ -51,8 +51,11 @@ onEntityAdded: ({ injector, entity }) => {

### Events
Events are great for logging / monitoring DataSet changes or distribute changes to clients. They are simple optional callbacks - if they are defined, they will be called on a specific event. These events are `onEntityAdded`, `onEntityUpdated` and `onEntityRemoved`
### Authorizing operations
**Authorizers** are similar callbacks but they have to return a promise with an `AuthorizationResult` object - you can allow or deny CRUD operations or add additional filters to collections with these Authorize callbacks. These `areauthorizeAdd`, `authorizeUpdate`, `authorizeUpdateEntity` (this needs an additional reload of entity but can compare with the original one), `authorizeRemove`, `authroizeRemoveEntity` (also needs reloading), `authorizeGet`,`authorizeGetEntity` (also needs reloading),
### Modifiers and additional filters
There are some callbacks that modifies an entity before persisting (like `modifyOnAdd` or `modifyOnUpdate`). For example, you can fill createdByUser or lastModifiedByUser fields with these.

@@ -62,2 +65,3 @@ There is an additional property called `addFilter`, you can use that to add a pre-filter condition **before** a filter expression will be evaluated in the data store - ensuring e.g. that the user can _retrieve_ only suff from the physical store that she has enough permission.

### Getting the Context
All methods above has an _injector instance_ on the call parameter - you can use that injector to get service instances from the right caller context. It means that you can use e.g.: HttpUserContext to getting the current user.
All methods above has an _injector instance_ on the call parameter - you can use that injector to get service instances from the right caller context. It means that you can use e.g.: HttpUserContext to getting the current user.

@@ -50,3 +50,3 @@ import type { WithOptionalId } from '@furystack/core'

@Injected(StoreManager)
private readonly storeManager!: StoreManager
private declare readonly storeManager: StoreManager
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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