🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@furystack/repository

Package Overview
Dependencies
Maintainers
0
Versions
214
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

to
10.0.0

7

esm/data-set.d.ts

@@ -0,6 +1,5 @@

import type { CreateResult, FilterType, FindOptions, PartialResult, WithOptionalId } from '@furystack/core';
import type { Injector } from '@furystack/inject';
import type { FindOptions, PartialResult, FilterType, WithOptionalId, CreateResult } from '@furystack/core';
import { EventHub } from '@furystack/utils';
import type { DataSetSettings } from './data-set-setting.js';
import type { Disposable } from '@furystack/utils';
import { EventHub } from '@furystack/utils';
/**

@@ -25,3 +24,3 @@ * An authorized Repository Store instance

readonly settings: DataSetSettings<T, TPrimaryKey, TWritableData>;
dispose(): void;
[Symbol.dispose](): void;
/**

@@ -28,0 +27,0 @@ * Primary key of the contained entity

@@ -8,4 +8,4 @@ import { AuthorizationError } from '@furystack/core';

settings;
dispose() {
super.dispose();
[Symbol.dispose]() {
super[Symbol.dispose]();
}

@@ -12,0 +12,0 @@ /**

@@ -0,7 +1,7 @@

import { InMemoryStore, addStore } from '@furystack/core';
import { Injector } from '@furystack/inject';
import { using, usingAsync } from '@furystack/utils';
import { InMemoryStore, addStore } from '@furystack/core';
import { usingAsync } from '@furystack/utils';
import { describe, expect, it, vi } from 'vitest';
import { getDataSetFor, getRepository } from './helpers.js';
import { Repository } from './repository.js';
import { getDataSetFor, getRepository } from './helpers.js';
import { describe, it, expect, vi } from 'vitest';
class TestClass {

@@ -13,4 +13,4 @@ id = 1;

describe('Construction', () => {
it('can be retrieved from an extension method with class', () => {
using(new Injector(), (i) => {
it('can be retrieved from an extension method with class', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({

@@ -25,4 +25,4 @@ model: TestClass,

});
it('can be retrieved from an extension method with string', () => {
using(new Injector(), (i) => {
it('can be retrieved from an extension method with string', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({

@@ -37,14 +37,14 @@ model: TestClass,

});
it('Should throw if dataset is not registered through extension', () => {
using(new Injector(), (i) => {
it('Should throw if dataset is not registered through extension', async () => {
await usingAsync(new Injector(), async (i) => {
expect(() => getDataSetFor(i, TestClass, 'id')).toThrowError('');
});
});
it('Should throw if dataset is not registered through service', () => {
using(new Injector(), (i) => {
it('Should throw if dataset is not registered through service', async () => {
await usingAsync(new Injector(), async (i) => {
expect(() => i.getInstance(Repository).getDataSetFor(TestClass, 'id')).toThrowError('');
});
});
it('Should throw error on mismatched primary key', () => {
using(new Injector(), (i) => {
it('Should throw error on mismatched primary key', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({ model: TestClass, primaryKey: 'id' }));

@@ -51,0 +51,0 @@ getRepository(i).createDataSet(TestClass, 'id', {});

import type { WithOptionalId } from '@furystack/core';
import type { Constructable } from '@furystack/inject';
import type { Disposable } from '@furystack/utils';
import type { DataSetSettings } from './data-set-setting.js';

@@ -10,3 +9,3 @@ import { DataSet } from './data-set.js';

export declare class Repository implements Disposable {
dispose(): void;
[Symbol.dispose](): void;
private dataSets;

@@ -13,0 +12,0 @@ getDataSetFor<T, TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>>(model: Constructable<T>, primaryKey: TPrimaryKey): DataSet<T, TPrimaryKey, TWritableData>;

@@ -17,4 +17,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

let Repository = class Repository {
dispose() {
this.dataSets.forEach((ds) => ds.dispose());
[Symbol.dispose]() {
this.dataSets.forEach((ds) => ds[Symbol.dispose]());
this.dataSets.clear();

@@ -21,0 +21,0 @@ }

@@ -0,11 +1,11 @@

import { InMemoryStore, addStore } from '@furystack/core';
import { TestClass } from '@furystack/core/create-physical-store-tests';
import { Injector } from '@furystack/inject';
import { using } from '@furystack/utils';
import { usingAsync } from '@furystack/utils';
import { describe, expect, it } from 'vitest';
import { DataSet } from './data-set.js';
import { getDataSetFor, getRepository } from './helpers.js';
import { addStore, InMemoryStore } from '@furystack/core';
import { DataSet } from './data-set.js';
import { describe, it, expect } from 'vitest';
import { TestClass } from '@furystack/core/create-physical-store-tests';
describe('Repository', () => {
it('Should retrieve a dataSet', () => {
using(new Injector(), (i) => {
it('Should retrieve a dataSet', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({ model: TestClass, primaryKey: 'id' }));

@@ -12,0 +12,0 @@ getRepository(i).createDataSet(TestClass, 'id', {});

{
"name": "@furystack/repository",
"version": "9.0.5",
"version": "10.0.0",
"description": "Repository implementation for FuryStack",

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

"dependencies": {
"@furystack/core": "^14.0.5",
"@furystack/inject": "^11.0.3",
"@furystack/utils": "^7.0.2"
"@furystack/core": "^15.0.0",
"@furystack/inject": "^12.0.0",
"@furystack/utils": "^8.0.0"
},
"devDependencies": {
"typescript": "^5.4.5",
"vitest": "^1.6.0"
"typescript": "^5.5.3",
"vitest": "^2.0.0"
},
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
}

@@ -0,7 +1,6 @@

import type { CreateResult, FilterType, FindOptions, PartialResult, WithOptionalId } from '@furystack/core'
import { AuthorizationError } from '@furystack/core'
import type { Injector } from '@furystack/inject'
import type { FindOptions, PartialResult, FilterType, WithOptionalId, CreateResult } from '@furystack/core'
import { AuthorizationError } from '@furystack/core'
import { EventHub } from '@furystack/utils'
import type { DataSetSettings } from './data-set-setting.js'
import type { Disposable } from '@furystack/utils'
import { EventHub } from '@furystack/utils'

@@ -19,4 +18,4 @@ /**

{
public dispose() {
super.dispose()
public [Symbol.dispose]() {
super[Symbol.dispose]()
}

@@ -23,0 +22,0 @@

@@ -1,9 +0,9 @@

import { Injector } from '@furystack/inject'
import { using, usingAsync } from '@furystack/utils'
import type { WithOptionalId } from '@furystack/core'
import { InMemoryStore, addStore } from '@furystack/core'
import { Repository } from './repository.js'
import { Injector } from '@furystack/inject'
import { usingAsync } from '@furystack/utils'
import { describe, expect, it, vi } from 'vitest'
import type { AuthorizationResult, DataSetSettings } from './data-set-setting.js'
import { getDataSetFor, getRepository } from './helpers.js'
import { describe, it, expect, vi } from 'vitest'
import { Repository } from './repository.js'

@@ -17,4 +17,4 @@ class TestClass {

describe('Construction', () => {
it('can be retrieved from an extension method with class', () => {
using(new Injector(), (i) => {
it('can be retrieved from an extension method with class', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(

@@ -33,4 +33,4 @@ i,

it('can be retrieved from an extension method with string', () => {
using(new Injector(), (i) => {
it('can be retrieved from an extension method with string', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(

@@ -49,4 +49,4 @@ i,

it('Should throw if dataset is not registered through extension', () => {
using(new Injector(), (i) => {
it('Should throw if dataset is not registered through extension', async () => {
await usingAsync(new Injector(), async (i) => {
expect(() => getDataSetFor(i, TestClass, 'id')).toThrowError('')

@@ -56,4 +56,4 @@ })

it('Should throw if dataset is not registered through service', () => {
using(new Injector(), (i) => {
it('Should throw if dataset is not registered through service', async () => {
await usingAsync(new Injector(), async (i) => {
expect(() => i.getInstance(Repository).getDataSetFor(TestClass, 'id')).toThrowError('')

@@ -63,4 +63,4 @@ })

it('Should throw error on mismatched primary key', () => {
using(new Injector(), (i) => {
it('Should throw error on mismatched primary key', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({ model: TestClass, primaryKey: 'id' }))

@@ -67,0 +67,0 @@ getRepository(i).createDataSet(TestClass, 'id', {})

@@ -0,12 +1,12 @@

import { InMemoryStore, addStore } from '@furystack/core'
import { TestClass } from '@furystack/core/create-physical-store-tests'
import { Injector } from '@furystack/inject'
import { using } from '@furystack/utils'
import { usingAsync } from '@furystack/utils'
import { describe, expect, it } from 'vitest'
import { DataSet } from './data-set.js'
import { getDataSetFor, getRepository } from './helpers.js'
import { addStore, InMemoryStore } from '@furystack/core'
import { DataSet } from './data-set.js'
import { describe, it, expect } from 'vitest'
import { TestClass } from '@furystack/core/create-physical-store-tests'
describe('Repository', () => {
it('Should retrieve a dataSet', () => {
using(new Injector(), (i) => {
it('Should retrieve a dataSet', async () => {
await usingAsync(new Injector(), async (i) => {
addStore(i, new InMemoryStore({ model: TestClass, primaryKey: 'id' }))

@@ -13,0 +13,0 @@ getRepository(i).createDataSet(TestClass, 'id', {})

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

import { Injectable, Injected } from '@furystack/inject'
import type { Disposable } from '@furystack/utils'
import type { DataSetSettings } from './data-set-setting.js'

@@ -15,4 +14,4 @@ import { DataSet } from './data-set.js'

export class Repository implements Disposable {
public dispose() {
this.dataSets.forEach((ds) => ds.dispose())
public [Symbol.dispose]() {
this.dataSets.forEach((ds) => ds[Symbol.dispose]())
this.dataSets.clear()

@@ -19,0 +18,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet