@furystack/repository 10.1.10 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +74 -36
- package/esm/data-set.spec.d.ts +2 -0
- package/esm/data-set.spec.d.ts.map +1 -0
- package/esm/data-set.spec.js +348 -0
- package/esm/data-set.spec.js.map +1 -0
- package/esm/define-data-set.d.ts +89 -0
- package/esm/define-data-set.d.ts.map +1 -0
- package/esm/define-data-set.js +75 -0
- package/esm/define-data-set.js.map +1 -0
- package/esm/define-data-set.spec.d.ts +2 -0
- package/esm/define-data-set.spec.d.ts.map +1 -0
- package/esm/define-data-set.spec.js +134 -0
- package/esm/define-data-set.spec.js.map +1 -0
- package/esm/helpers.d.ts +21 -22
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +17 -21
- package/esm/helpers.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/src/data-set.spec.ts +396 -0
- package/src/define-data-set.spec.ts +145 -0
- package/src/define-data-set.ts +140 -0
- package/src/helpers.ts +23 -26
- package/src/index.ts +2 -2
- package/esm/dataset.spec.d.ts +0 -2
- package/esm/dataset.spec.d.ts.map +0 -1
- package/esm/dataset.spec.js +0 -552
- package/esm/dataset.spec.js.map +0 -1
- package/esm/repository.d.ts +0 -15
- package/esm/repository.d.ts.map +0 -1
- package/esm/repository.js +0 -50
- package/esm/repository.js.map +0 -1
- package/esm/repository.spec.d.ts +0 -2
- package/esm/repository.spec.d.ts.map +0 -1
- package/esm/repository.spec.js +0 -18
- package/esm/repository.spec.js.map +0 -1
- package/src/dataset.spec.ts +0 -641
- package/src/repository.spec.ts +0 -19
- package/src/repository.ts +0 -50
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Constructable, StoreToken, WithOptionalId } from '@furystack/core';
|
|
2
|
+
import type { Token } from '@furystack/inject';
|
|
3
|
+
import type { DataSetSettings } from './data-set-setting.js';
|
|
4
|
+
import { DataSet } from './data-set.js';
|
|
5
|
+
/**
|
|
6
|
+
* A DI token that resolves to a {@link DataSet} and carries its model and
|
|
7
|
+
* primary key metadata (mirrored from the backing {@link StoreToken}).
|
|
8
|
+
*
|
|
9
|
+
* Consumers can `injector.get(token)` to obtain the dataset, or read the
|
|
10
|
+
* `model` / `primaryKey` fields to drive reflection-style tooling such as
|
|
11
|
+
* entity sync and OpenAPI generation.
|
|
12
|
+
*/
|
|
13
|
+
export type DataSetToken<T, TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>> = Token<DataSet<T, TPrimaryKey, TWritableData>, 'singleton'> & {
|
|
14
|
+
readonly model: Constructable<T>;
|
|
15
|
+
readonly primaryKey: TPrimaryKey;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Settings accepted by {@link defineDataSet}. A subset of
|
|
19
|
+
* {@link DataSetSettings}: the physical store is supplied by the store token
|
|
20
|
+
* and must not be passed here.
|
|
21
|
+
*/
|
|
22
|
+
export type DefineDataSetSettings<T, TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>> = Omit<DataSetSettings<T, TPrimaryKey, TWritableData>, 'physicalStore'>;
|
|
23
|
+
/**
|
|
24
|
+
* Options accepted by {@link defineDataSet}.
|
|
25
|
+
*
|
|
26
|
+
* `settings` is wrapped in `NoInfer` so the `store` token alone fixes the
|
|
27
|
+
* generic parameters. Without it, an inline callback inside `settings`
|
|
28
|
+
* (e.g. a `modifyOnAdd` arrow) triggers bidirectional inference where
|
|
29
|
+
* TypeScript widens `TPrimaryKey` back to `keyof T` to satisfy the
|
|
30
|
+
* callback's contextual typing.
|
|
31
|
+
*/
|
|
32
|
+
export type DefineDataSetOptions<T, TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>> = {
|
|
33
|
+
/**
|
|
34
|
+
* Human-readable identifier used for debug/readability. Token identity is
|
|
35
|
+
* established by the returned {@link DataSetToken} object reference.
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* The store this data set is backed by. Its `model` and `primaryKey` are
|
|
40
|
+
* propagated onto the returned token.
|
|
41
|
+
*/
|
|
42
|
+
store: StoreToken<T, TPrimaryKey>;
|
|
43
|
+
/**
|
|
44
|
+
* Authorizers, modification hooks and filter post-processors. Optional —
|
|
45
|
+
* a data set without settings performs no authorization and forwards
|
|
46
|
+
* operations straight to the physical store.
|
|
47
|
+
*/
|
|
48
|
+
settings?: NoInfer<DefineDataSetSettings<T, TPrimaryKey, TWritableData>>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Defines a {@link DataSet} as a first-class DI token backed by a
|
|
52
|
+
* {@link StoreToken}.
|
|
53
|
+
*
|
|
54
|
+
* The returned token resolves to a singleton `DataSet`. On the first
|
|
55
|
+
* resolution the factory:
|
|
56
|
+
*
|
|
57
|
+
* 1. Resolves the backing physical store through the injector.
|
|
58
|
+
* 2. Constructs a {@link DataSet} with the supplied {@link DefineDataSetSettings}
|
|
59
|
+
* and that store.
|
|
60
|
+
* 3. Registers a disposal callback that clears the DataSet's event
|
|
61
|
+
* subscriptions when the owning injector is disposed.
|
|
62
|
+
*
|
|
63
|
+
* The token also carries the `model` and `primaryKey` of the backing store so
|
|
64
|
+
* that downstream tooling (entity sync, OpenAPI generators, test harnesses)
|
|
65
|
+
* can discover the dataset's shape without additional wiring.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const UserStore = defineStore({
|
|
70
|
+
* name: 'my-app/UserStore',
|
|
71
|
+
* model: User,
|
|
72
|
+
* primaryKey: 'username',
|
|
73
|
+
* factory: () => new InMemoryStore({ model: User, primaryKey: 'username' }),
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* export const UserDataSet = defineDataSet({
|
|
77
|
+
* name: 'my-app/UserDataSet',
|
|
78
|
+
* store: UserStore,
|
|
79
|
+
* settings: {
|
|
80
|
+
* authorizeAdd: async ({ injector, entity }) => ({ isAllowed: true }),
|
|
81
|
+
* },
|
|
82
|
+
* })
|
|
83
|
+
*
|
|
84
|
+
* const ds = injector.get(UserDataSet)
|
|
85
|
+
* await ds.add(injector, { username: 'alice', roles: [] })
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare const defineDataSet: <T, const TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>>(options: DefineDataSetOptions<T, TPrimaryKey, TWritableData>) => DataSetToken<T, TPrimaryKey, TWritableData>;
|
|
89
|
+
//# sourceMappingURL=define-data-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-set.d.ts","sourceRoot":"","sources":["../src/define-data-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/F,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAkBvC;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,KAAK,CAC9G,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,EACtC,WAAW,CACZ,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAA;CACjC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,EACD,WAAW,SAAS,MAAM,CAAC,EAC3B,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,IAC5C,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,eAAe,CAAC,CAAA;AAEzE;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI;IACjH;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAA;IACjC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAA;CACzE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,KAAK,CAAC,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,EAChH,SAAS,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,KAC3D,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAsB5C,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineService } from '@furystack/inject';
|
|
2
|
+
import { DataSet } from './data-set.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a {@link StoreToken} to a {@link PhysicalStore} whose
|
|
5
|
+
* `TWritableData` generic matches the owning data set. `StoreToken` defaults
|
|
6
|
+
* `TWritableData` to `WithOptionalId`, while a {@link DataSet} may narrow it
|
|
7
|
+
* (e.g. to strip system-owned fields). The write surface of `PhysicalStore`
|
|
8
|
+
* is contravariant in `TWritableData` — a store that accepts
|
|
9
|
+
* `WithOptionalId<T, TPK>` also accepts any narrower shape — but TypeScript
|
|
10
|
+
* cannot express that with the default generic, so the cast is localized
|
|
11
|
+
* here with this explanation rather than scattered at call sites.
|
|
12
|
+
*/
|
|
13
|
+
const resolvePhysicalStore = (ctx, store) => ctx.inject(store);
|
|
14
|
+
/**
|
|
15
|
+
* Defines a {@link DataSet} as a first-class DI token backed by a
|
|
16
|
+
* {@link StoreToken}.
|
|
17
|
+
*
|
|
18
|
+
* The returned token resolves to a singleton `DataSet`. On the first
|
|
19
|
+
* resolution the factory:
|
|
20
|
+
*
|
|
21
|
+
* 1. Resolves the backing physical store through the injector.
|
|
22
|
+
* 2. Constructs a {@link DataSet} with the supplied {@link DefineDataSetSettings}
|
|
23
|
+
* and that store.
|
|
24
|
+
* 3. Registers a disposal callback that clears the DataSet's event
|
|
25
|
+
* subscriptions when the owning injector is disposed.
|
|
26
|
+
*
|
|
27
|
+
* The token also carries the `model` and `primaryKey` of the backing store so
|
|
28
|
+
* that downstream tooling (entity sync, OpenAPI generators, test harnesses)
|
|
29
|
+
* can discover the dataset's shape without additional wiring.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const UserStore = defineStore({
|
|
34
|
+
* name: 'my-app/UserStore',
|
|
35
|
+
* model: User,
|
|
36
|
+
* primaryKey: 'username',
|
|
37
|
+
* factory: () => new InMemoryStore({ model: User, primaryKey: 'username' }),
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* export const UserDataSet = defineDataSet({
|
|
41
|
+
* name: 'my-app/UserDataSet',
|
|
42
|
+
* store: UserStore,
|
|
43
|
+
* settings: {
|
|
44
|
+
* authorizeAdd: async ({ injector, entity }) => ({ isAllowed: true }),
|
|
45
|
+
* },
|
|
46
|
+
* })
|
|
47
|
+
*
|
|
48
|
+
* const ds = injector.get(UserDataSet)
|
|
49
|
+
* await ds.add(injector, { username: 'alice', roles: [] })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export const defineDataSet = (options) => {
|
|
53
|
+
const token = defineService({
|
|
54
|
+
name: options.name,
|
|
55
|
+
lifetime: 'singleton',
|
|
56
|
+
factory: (ctx) => {
|
|
57
|
+
const physicalStore = resolvePhysicalStore(ctx, options.store);
|
|
58
|
+
const dataSet = new DataSet({
|
|
59
|
+
...options.settings,
|
|
60
|
+
physicalStore,
|
|
61
|
+
});
|
|
62
|
+
// Disposal is delegated to the injector via `onDispose`; the dataset
|
|
63
|
+
// outlives this factory invocation and is torn down on scope teardown.
|
|
64
|
+
// eslint-disable-next-line furystack/prefer-using-wrapper
|
|
65
|
+
ctx.onDispose(() => dataSet[Symbol.dispose]());
|
|
66
|
+
return dataSet;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const result = Object.assign(token, {
|
|
70
|
+
model: options.store.model,
|
|
71
|
+
primaryKey: options.store.primaryKey,
|
|
72
|
+
});
|
|
73
|
+
return result;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=define-data-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-set.js","sourceRoot":"","sources":["../src/define-data-set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;GASG;AACH,MAAM,oBAAoB,GAAG,CAC3B,GAAgC,EAChC,KAAiC,EACa,EAAE,CAChD,GAAG,CAAC,MAAM,CAAC,KAAK,CAA4D,CAAA;AAyD9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAA4D,EACf,EAAE;IAC/C,MAAM,KAAK,GAAG,aAAa,CAAC;QAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,WAAW;QACrB,OAAO,EAAE,CAAC,GAAgC,EAAE,EAAE;YAC5C,MAAM,aAAa,GAAG,oBAAoB,CAAgC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;YAC7F,MAAM,OAAO,GAAG,IAAI,OAAO,CAAgC;gBACzD,GAAG,OAAO,CAAC,QAAQ;gBACnB,aAAa;aACoC,CAAC,CAAA;YACpD,qEAAqE;YACrE,uEAAuE;YACvE,0DAA0D;YAC1D,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAC9C,OAAO,OAAO,CAAA;QAChB,CAAC;KACF,CAAC,CAAA;IACF,MAAM,MAAM,GAAgD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC/E,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;QAC1B,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU;KACrC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-set.spec.d.ts","sourceRoot":"","sources":["../src/define-data-set.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineStore, InMemoryStore } from '@furystack/core';
|
|
2
|
+
import { createInjector } from '@furystack/inject';
|
|
3
|
+
import { usingAsync } from '@furystack/utils';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { DataSet } from './data-set.js';
|
|
6
|
+
import { defineDataSet } from './define-data-set.js';
|
|
7
|
+
class Test {
|
|
8
|
+
}
|
|
9
|
+
// Store tokens are declared at module scope so TypeScript keeps the literal
|
|
10
|
+
// primary-key narrowing. Wrapping `defineStore` in an arrow function would
|
|
11
|
+
// widen the inferred `TPrimaryKey` back to `keyof Test` in the return type.
|
|
12
|
+
const BasicStore = defineStore({
|
|
13
|
+
name: 'test/BasicStore',
|
|
14
|
+
model: Test,
|
|
15
|
+
primaryKey: 'id',
|
|
16
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
17
|
+
});
|
|
18
|
+
const SingletonStore = defineStore({
|
|
19
|
+
name: 'test/SingletonStore',
|
|
20
|
+
model: Test,
|
|
21
|
+
primaryKey: 'id',
|
|
22
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
23
|
+
});
|
|
24
|
+
const MetaStore = defineStore({
|
|
25
|
+
name: 'test/MetaStore',
|
|
26
|
+
model: Test,
|
|
27
|
+
primaryKey: 'id',
|
|
28
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
29
|
+
});
|
|
30
|
+
const HooksStore = defineStore({
|
|
31
|
+
name: 'test/HooksStore',
|
|
32
|
+
model: Test,
|
|
33
|
+
primaryKey: 'id',
|
|
34
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
35
|
+
});
|
|
36
|
+
const EventsStore = defineStore({
|
|
37
|
+
name: 'test/EventsStore',
|
|
38
|
+
model: Test,
|
|
39
|
+
primaryKey: 'id',
|
|
40
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
41
|
+
});
|
|
42
|
+
const DisposeStore = defineStore({
|
|
43
|
+
name: 'test/DisposeStore',
|
|
44
|
+
model: Test,
|
|
45
|
+
primaryKey: 'id',
|
|
46
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
47
|
+
});
|
|
48
|
+
const RebindStore = defineStore({
|
|
49
|
+
name: 'test/RebindStore',
|
|
50
|
+
model: Test,
|
|
51
|
+
primaryKey: 'id',
|
|
52
|
+
factory: () => new InMemoryStore({ model: Test, primaryKey: 'id' }),
|
|
53
|
+
});
|
|
54
|
+
const modifyOnAddSpy = vi.fn();
|
|
55
|
+
const BasicDataSet = defineDataSet({ name: 'test/BasicDataSet', store: BasicStore });
|
|
56
|
+
const SingletonDataSet = defineDataSet({ name: 'test/SingletonDataSet', store: SingletonStore });
|
|
57
|
+
const MetaDataSet = defineDataSet({ name: 'test/MetaDataSet', store: MetaStore });
|
|
58
|
+
// The `settings` callback participates in bidirectional inference against the
|
|
59
|
+
// surrounding generics. Even with `NoInfer` on the settings position, inline
|
|
60
|
+
// callbacks currently widen `TPrimaryKey` to `keyof T` because TypeScript has
|
|
61
|
+
// to contextually type the callback before it can commit to the store-driven
|
|
62
|
+
// inference. The runtime value of `token.primaryKey` is still correct; only
|
|
63
|
+
// the entity parameter is typed as the wider `WithOptionalId<Test, keyof Test>`.
|
|
64
|
+
// The non-null assertion on `entity.value` reflects that widening.
|
|
65
|
+
const HooksDataSet = defineDataSet({
|
|
66
|
+
name: 'test/HooksDataSet',
|
|
67
|
+
store: HooksStore,
|
|
68
|
+
settings: {
|
|
69
|
+
modifyOnAdd: async ({ entity }) => {
|
|
70
|
+
modifyOnAddSpy();
|
|
71
|
+
return { ...entity, value: entity.value.toUpperCase() };
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const EventsDataSet = defineDataSet({ name: 'test/EventsDataSet', store: EventsStore });
|
|
76
|
+
const DisposeDataSet = defineDataSet({ name: 'test/DisposeDataSet', store: DisposeStore });
|
|
77
|
+
const RebindDataSet = defineDataSet({ name: 'test/RebindDataSet', store: RebindStore });
|
|
78
|
+
describe('defineDataSet', () => {
|
|
79
|
+
it('resolves to a DataSet backed by the supplied store', async () => {
|
|
80
|
+
await usingAsync(createInjector(), async (i) => {
|
|
81
|
+
const ds = i.get(BasicDataSet);
|
|
82
|
+
expect(ds).toBeInstanceOf(DataSet);
|
|
83
|
+
expect(ds.settings.physicalStore).toBe(i.get(BasicStore));
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
it('caches the DataSet as a singleton across resolutions', async () => {
|
|
87
|
+
await usingAsync(createInjector(), async (i) => {
|
|
88
|
+
expect(i.get(SingletonDataSet)).toBe(i.get(SingletonDataSet));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
it('mirrors the model and primary key from the backing store token', () => {
|
|
92
|
+
expect(MetaDataSet.model).toBe(Test);
|
|
93
|
+
expect(MetaDataSet.primaryKey).toBe('id');
|
|
94
|
+
});
|
|
95
|
+
it('applies the configured authorizers and hooks', async () => {
|
|
96
|
+
modifyOnAddSpy.mockClear();
|
|
97
|
+
await usingAsync(createInjector(), async (i) => {
|
|
98
|
+
const ds = i.get(HooksDataSet);
|
|
99
|
+
await ds.add(i, { id: 1, value: 'asd' });
|
|
100
|
+
const stored = await ds.get(i, 1);
|
|
101
|
+
expect(modifyOnAddSpy).toHaveBeenCalledTimes(1);
|
|
102
|
+
expect(stored?.value).toBe('ASD');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
it('emits change events through the DataSet EventHub', async () => {
|
|
106
|
+
await usingAsync(createInjector(), async (i) => {
|
|
107
|
+
const added = vi.fn();
|
|
108
|
+
const ds = i.get(EventsDataSet);
|
|
109
|
+
ds.addListener('onEntityAdded', added);
|
|
110
|
+
await ds.add(i, { id: 1, value: 'x' });
|
|
111
|
+
expect(added).toHaveBeenCalledWith(expect.objectContaining({ entity: { id: 1, value: 'x' } }));
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
it('clears DataSet listeners when the injector is disposed', async () => {
|
|
115
|
+
const i = createInjector();
|
|
116
|
+
const ds = i.get(DisposeDataSet);
|
|
117
|
+
const listener = vi.fn();
|
|
118
|
+
ds.addListener('onEntityAdded', listener);
|
|
119
|
+
await i[Symbol.asyncDispose]();
|
|
120
|
+
// After disposal the DataSet's event subscriptions are cleared;
|
|
121
|
+
// emitting directly would be a no-op.
|
|
122
|
+
ds.emit('onEntityAdded', { injector: i, entity: { id: 1, value: 'x' } });
|
|
123
|
+
expect(listener).not.toHaveBeenCalled();
|
|
124
|
+
});
|
|
125
|
+
it('allows rebinding the backing store for tests', async () => {
|
|
126
|
+
await usingAsync(createInjector(), async (i) => {
|
|
127
|
+
const replacement = new InMemoryStore({ model: Test, primaryKey: 'id' });
|
|
128
|
+
i.bind(RebindStore, () => replacement);
|
|
129
|
+
const ds = i.get(RebindDataSet);
|
|
130
|
+
expect(ds.settings.physicalStore).toBe(replacement);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=define-data-set.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-set.spec.js","sourceRoot":"","sources":["../src/define-data-set.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,IAAI;CAGT;AAED,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,MAAM,UAAU,GAAG,WAAW,CAAC;IAC7B,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;CACpE,CAAC,CAAA;AACF,MAAM,cAAc,GAAG,WAAW,CAAC;IACjC,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;CACpE,CAAC,CAAA;AACF,MAAM,SAAS,GAAG,WAAW,CA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QACtC,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAA;QACxE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACzC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,UAAU,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YAC7C,MAAM,WAAW,GAAG,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;YACxE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAA;YACtC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;YAC/B,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/esm/helpers.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { WithOptionalId } from '@furystack/core';
|
|
2
|
+
import type { Injector } from '@furystack/inject';
|
|
3
|
+
import type { DataSet } from './data-set.js';
|
|
4
|
+
import type { DataSetToken } from './define-data-set.js';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @returns The Repository instance
|
|
7
|
-
*/
|
|
8
|
-
export declare const getRepository: (injector: Injector) => Repository;
|
|
9
|
-
/**
|
|
10
|
-
* Gets a DataSet for a specific model from the repository.
|
|
6
|
+
* Resolves the {@link DataSet} identified by the supplied {@link DataSetToken}
|
|
7
|
+
* on the given injector.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* Writing through the returned DataSet ensures authorization, modification
|
|
10
|
+
* hooks and change events (required for features such as entity sync) are
|
|
11
|
+
* triggered. Prefer this over direct physical-store access in application
|
|
12
|
+
* code.
|
|
15
13
|
*
|
|
16
|
-
* For server-side or background operations that don't originate from an HTTP
|
|
17
|
-
* use
|
|
14
|
+
* For server-side or background operations that don't originate from an HTTP
|
|
15
|
+
* request, use
|
|
16
|
+
* {@link import('@furystack/core').useSystemIdentityContext | useSystemIdentityContext}
|
|
17
|
+
* to create a scoped child injector with elevated privileges before calling
|
|
18
|
+
* this helper.
|
|
18
19
|
*
|
|
19
|
-
* @param injector
|
|
20
|
-
* @param
|
|
21
|
-
* @
|
|
22
|
-
* @returns A Repository DataSet for a specific model
|
|
20
|
+
* @param injector - Any injector in the scope chain.
|
|
21
|
+
* @param token - The data-set token created by `defineDataSet`.
|
|
22
|
+
* @returns The cached {@link DataSet} instance.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
@@ -27,15 +27,14 @@ export declare const getRepository: (injector: Injector) => Repository;
|
|
|
27
27
|
* import { getDataSetFor } from '@furystack/repository'
|
|
28
28
|
* import { usingAsync } from '@furystack/utils'
|
|
29
29
|
*
|
|
30
|
-
* // In a background job or service
|
|
31
30
|
* await usingAsync(
|
|
32
31
|
* useSystemIdentityContext({ injector, username: 'background-job' }),
|
|
33
32
|
* async (systemInjector) => {
|
|
34
|
-
* const dataSet = getDataSetFor(systemInjector,
|
|
35
|
-
* await dataSet.add(systemInjector,
|
|
33
|
+
* const dataSet = getDataSetFor(systemInjector, UserDataSet)
|
|
34
|
+
* await dataSet.add(systemInjector, { username: 'alice', roles: [] })
|
|
36
35
|
* },
|
|
37
36
|
* )
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
|
-
export declare const getDataSetFor: <T, TPrimaryKey extends keyof T
|
|
39
|
+
export declare const getDataSetFor: <T, TPrimaryKey extends keyof T, TWritableData = WithOptionalId<T, TPrimaryKey>>(injector: Injector, token: DataSetToken<T, TPrimaryKey, TWritableData>) => DataSet<T, TPrimaryKey, TWritableData>;
|
|
41
40
|
//# sourceMappingURL=helpers.d.ts.map
|
package/esm/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,WAAW,SAAS,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,EAC1G,UAAU,QAAQ,EAClB,OAAO,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,KACjD,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAwB,CAAA"}
|
package/esm/helpers.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { Repository } from './repository.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @returns The Repository instance
|
|
6
|
-
*/
|
|
7
|
-
export const getRepository = (injector) => injector.getInstance(Repository);
|
|
8
|
-
/**
|
|
9
|
-
* Gets a DataSet for a specific model from the repository.
|
|
2
|
+
* Resolves the {@link DataSet} identified by the supplied {@link DataSetToken}
|
|
3
|
+
* on the given injector.
|
|
10
4
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
5
|
+
* Writing through the returned DataSet ensures authorization, modification
|
|
6
|
+
* hooks and change events (required for features such as entity sync) are
|
|
7
|
+
* triggered. Prefer this over direct physical-store access in application
|
|
8
|
+
* code.
|
|
14
9
|
*
|
|
15
|
-
* For server-side or background operations that don't originate from an HTTP
|
|
16
|
-
* use
|
|
10
|
+
* For server-side or background operations that don't originate from an HTTP
|
|
11
|
+
* request, use
|
|
12
|
+
* {@link import('@furystack/core').useSystemIdentityContext | useSystemIdentityContext}
|
|
13
|
+
* to create a scoped child injector with elevated privileges before calling
|
|
14
|
+
* this helper.
|
|
17
15
|
*
|
|
18
|
-
* @param injector
|
|
19
|
-
* @param
|
|
20
|
-
* @
|
|
21
|
-
* @returns A Repository DataSet for a specific model
|
|
16
|
+
* @param injector - Any injector in the scope chain.
|
|
17
|
+
* @param token - The data-set token created by `defineDataSet`.
|
|
18
|
+
* @returns The cached {@link DataSet} instance.
|
|
22
19
|
*
|
|
23
20
|
* @example
|
|
24
21
|
* ```ts
|
|
@@ -26,15 +23,14 @@ export const getRepository = (injector) => injector.getInstance(Repository);
|
|
|
26
23
|
* import { getDataSetFor } from '@furystack/repository'
|
|
27
24
|
* import { usingAsync } from '@furystack/utils'
|
|
28
25
|
*
|
|
29
|
-
* // In a background job or service
|
|
30
26
|
* await usingAsync(
|
|
31
27
|
* useSystemIdentityContext({ injector, username: 'background-job' }),
|
|
32
28
|
* async (systemInjector) => {
|
|
33
|
-
* const dataSet = getDataSetFor(systemInjector,
|
|
34
|
-
* await dataSet.add(systemInjector,
|
|
29
|
+
* const dataSet = getDataSetFor(systemInjector, UserDataSet)
|
|
30
|
+
* await dataSet.add(systemInjector, { username: 'alice', roles: [] })
|
|
35
31
|
* },
|
|
36
32
|
* )
|
|
37
33
|
* ```
|
|
38
34
|
*/
|
|
39
|
-
export const getDataSetFor = (injector,
|
|
35
|
+
export const getDataSetFor = (injector, token) => injector.get(token);
|
|
40
36
|
//# sourceMappingURL=helpers.js.map
|
package/esm/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,QAAkB,EAClB,KAAkD,EACV,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA"}
|
package/esm/index.d.ts
CHANGED
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
package/esm/index.js
CHANGED
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/repository",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Repository implementation for FuryStack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/furystack/furystack",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@furystack/core": "^
|
|
42
|
-
"@furystack/inject": "^
|
|
43
|
-
"@furystack/utils": "^
|
|
41
|
+
"@furystack/core": "^17.0.0",
|
|
42
|
+
"@furystack/inject": "^13.0.0",
|
|
43
|
+
"@furystack/utils": "^9.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"typescript": "^6.0.
|
|
47
|
-
"vitest": "^4.1.
|
|
46
|
+
"typescript": "^6.0.3",
|
|
47
|
+
"vitest": "^4.1.4"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=22.0.0"
|