@furystack/sequelize-store 6.0.27 → 6.0.28
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/README.md +20 -9
- package/esm/sequelize-store.d.ts +2 -2
- package/esm/sequelize-store.js +1 -1
- package/package.json +4 -4
- package/src/sequelize-store.ts +2 -2
package/README.md
CHANGED
|
@@ -5,17 +5,28 @@ Sequelize physical store implementation for FuryStack.
|
|
|
5
5
|
## Initialization
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import '@furystack/
|
|
8
|
+
import { Injector } from '@furystack/inject'
|
|
9
|
+
import { StoreManager, type PhysicalStore } from '@furystack/core'
|
|
10
|
+
import { useSequelize } from '@furystack/sequelize-store'
|
|
11
|
+
import { Model, type Options } from 'sequelize'
|
|
9
12
|
|
|
10
|
-
export class TestEntry extends Model
|
|
11
|
-
public
|
|
12
|
-
public
|
|
13
|
+
export class TestEntry extends Model {
|
|
14
|
+
declare public _id: string
|
|
15
|
+
declare public value: string
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
myInjector
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const myInjector = new Injector()
|
|
19
|
+
useSequelize({
|
|
20
|
+
injector: myInjector,
|
|
21
|
+
model: TestEntry,
|
|
22
|
+
sequelizeModel: TestEntry, // Your Sequelize Model class
|
|
23
|
+
primaryKey: '_id',
|
|
24
|
+
options: {
|
|
25
|
+
// Sequelize connection options
|
|
26
|
+
dialect: 'sqlite',
|
|
27
|
+
storage: ':memory:',
|
|
28
|
+
} as Options,
|
|
29
|
+
})
|
|
19
30
|
|
|
20
|
-
const myStore:
|
|
31
|
+
const myStore: PhysicalStore<TestEntry, '_id'> = myInjector.getInstance(StoreManager).getStoreFor(TestEntry, '_id')
|
|
21
32
|
```
|
package/esm/sequelize-store.d.ts
CHANGED
|
@@ -20,12 +20,12 @@ export interface SequelizeStoreSettings<T extends object, M extends Model<T>, TP
|
|
|
20
20
|
*/
|
|
21
21
|
getSequelizeClient: () => Sequelize;
|
|
22
22
|
/**
|
|
23
|
-
* Optional
|
|
23
|
+
* Optional callback that will initialize the Model for the Sequelize instance
|
|
24
24
|
*/
|
|
25
25
|
initModel?: (sequelize: Sequelize) => Promise<void>;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Sequelize Store implementation for FuryStack
|
|
29
29
|
*/
|
|
30
30
|
export declare class SequelizeStore<T extends object, M extends Model<T>, TPrimaryKey extends keyof T, TWriteableData = WithOptionalId<T, TPrimaryKey>> extends EventHub<{
|
|
31
31
|
onEntityAdded: {
|
package/esm/sequelize-store.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furystack/sequelize-store",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.28",
|
|
4
4
|
"description": "Sequelize-based Store implementation for FuryStack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/furystack/furystack",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@furystack/core": "^15.0.
|
|
39
|
-
"@furystack/inject": "^12.0.
|
|
40
|
-
"@furystack/utils": "^8.1.
|
|
38
|
+
"@furystack/core": "^15.0.28",
|
|
39
|
+
"@furystack/inject": "^12.0.22",
|
|
40
|
+
"@furystack/utils": "^8.1.4",
|
|
41
41
|
"semaphore-async-await": "^1.5.1",
|
|
42
42
|
"sequelize": "^6.37.7"
|
|
43
43
|
},
|
package/src/sequelize-store.ts
CHANGED
|
@@ -30,13 +30,13 @@ export interface SequelizeStoreSettings<T extends object, M extends Model<T>, TP
|
|
|
30
30
|
*/
|
|
31
31
|
getSequelizeClient: () => Sequelize
|
|
32
32
|
/**
|
|
33
|
-
* Optional
|
|
33
|
+
* Optional callback that will initialize the Model for the Sequelize instance
|
|
34
34
|
*/
|
|
35
35
|
initModel?: (sequelize: Sequelize) => Promise<void>
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Sequelize Store implementation for FuryStack
|
|
40
40
|
*/
|
|
41
41
|
export class SequelizeStore<
|
|
42
42
|
T extends object,
|