@dismissible/nestjs-storage 1.0.2 → 1.0.3-alpha.0b30e6d.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/README.md +37 -8
- package/package.json +8 -7
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/memory-storage.adapter.d.ts +3 -6
- package/src/memory-storage.adapter.js +7 -6
- package/src/memory-storage.adapter.js.map +1 -1
- package/src/memory-storage.module.d.ts +4 -0
- package/src/memory-storage.module.js +21 -0
- package/src/memory-storage.module.js.map +1 -0
- package/src/storage.interface.d.ts +12 -1
- package/src/storage.module.js +2 -7
- package/src/storage.module.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://dismissible.io" target="_blank"><img src="../../docs/images/dismissible_logo.png" width="120" alt="Dismissible" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">Never Show The Same Thing Twice!</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/@dismissible/nestjs-storage" target="_blank"><img src="https://img.shields.io/npm/v/@dismissible/nestjs-storage.svg" alt="NPM Version" /></a>
|
|
8
|
+
<a href="https://github.com/dismissibleio/dismissible-api/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/npm/l/@dismissible/nestjs-storage.svg" alt="Package License" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@dismissible/nestjs-storage" target="_blank"><img src="https://img.shields.io/npm/dm/@dismissible/nestjs-storage.svg" alt="NPM Downloads" /></a>
|
|
10
|
+
<a href="https://github.com/dismissibleio/dismissible-api" target="_blank"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/dismissibleio/dismissible-api/release.yml"></a>
|
|
11
|
+
<a href="https://paypal.me/joshstuartx" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
Dismissible manages the state of your UI elements across sessions, so your users see what matters, once! No more onboarding messages reappearing on every tab, no more notifications haunting users across devices. Dismissible syncs dismissal state everywhere, so every message is intentional, never repetitive.
|
|
15
|
+
|
|
1
16
|
# @dismissible/nestjs-storage
|
|
2
17
|
|
|
3
|
-
Storage interface and
|
|
18
|
+
Storage interface and memory adapter for the Dismissible system.
|
|
4
19
|
|
|
5
20
|
> **Part of the Dismissible API** - This library is part of the [Dismissible API](https://dismissible.io) ecosystem. Visit [dismissible.io](https://dismissible.io) for more information and documentation.
|
|
6
21
|
|
|
@@ -22,13 +37,13 @@ npm install @dismissible/nestjs-storage
|
|
|
22
37
|
|
|
23
38
|
### Using In-Memory Storage
|
|
24
39
|
|
|
25
|
-
The
|
|
40
|
+
The memory storage adapter is useful for development, testing, or when you don't need persistence:
|
|
26
41
|
|
|
27
42
|
```typescript
|
|
28
43
|
import { Module } from '@nestjs/common';
|
|
29
44
|
import { StorageModule, MemoryStorageAdapter } from '@dismissible/nestjs-storage';
|
|
30
45
|
import { LoggerModule } from '@dismissible/nestjs-logger';
|
|
31
|
-
import { DismissibleItemModule } from '@dismissible/nestjs-
|
|
46
|
+
import { DismissibleItemModule } from '@dismissible/nestjs-item';
|
|
32
47
|
|
|
33
48
|
@Module({
|
|
34
49
|
imports: [
|
|
@@ -47,9 +62,9 @@ export class AppModule {}
|
|
|
47
62
|
You can implement your own storage adapter by implementing the `IDismissibleStorage` interface:
|
|
48
63
|
|
|
49
64
|
```typescript
|
|
50
|
-
import { Injectable } from '@nestjs/common';
|
|
65
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
51
66
|
import { IDismissibleStorage, DISMISSIBLE_STORAGE_ADAPTER } from '@dismissible/nestjs-storage';
|
|
52
|
-
import { DismissibleItemDto } from '@dismissible/nestjs-
|
|
67
|
+
import { DismissibleItemDto } from '@dismissible/nestjs-item';
|
|
53
68
|
import { DISMISSIBLE_LOGGER, IDismissibleLogger } from '@dismissible/nestjs-logger';
|
|
54
69
|
|
|
55
70
|
@Injectable()
|
|
@@ -73,6 +88,18 @@ export class MyCustomStorageAdapter implements IDismissibleStorage {
|
|
|
73
88
|
this.logger.debug('Updating item', { itemId: item.id });
|
|
74
89
|
// ...
|
|
75
90
|
}
|
|
91
|
+
|
|
92
|
+
async delete(userId: string, itemId: string): Promise<void> {
|
|
93
|
+
// Your implementation
|
|
94
|
+
this.logger.debug('Deleting item', { userId, itemId });
|
|
95
|
+
// ...
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async deleteAll(): Promise<void> {
|
|
99
|
+
// Your implementation
|
|
100
|
+
this.logger.debug('Deleting all items');
|
|
101
|
+
// ...
|
|
102
|
+
}
|
|
76
103
|
}
|
|
77
104
|
|
|
78
105
|
// Register your adapter
|
|
@@ -98,12 +125,14 @@ interface IDismissibleStorage {
|
|
|
98
125
|
get(userId: string, itemId: string): Promise<DismissibleItemDto | null>;
|
|
99
126
|
create(item: DismissibleItemDto): Promise<DismissibleItemDto>;
|
|
100
127
|
update(item: DismissibleItemDto): Promise<DismissibleItemDto>;
|
|
128
|
+
delete(userId: string, itemId: string): Promise<void>;
|
|
129
|
+
deleteAll(): Promise<void>;
|
|
101
130
|
}
|
|
102
131
|
```
|
|
103
132
|
|
|
104
133
|
### MemoryStorageAdapter
|
|
105
134
|
|
|
106
|
-
An in
|
|
135
|
+
An in memory implementation of `IDismissibleStorage`. Data is stored in a `Map` and will be lost when the application restarts.
|
|
107
136
|
|
|
108
137
|
**Note:** This adapter is suitable for development and testing only. For production use, consider using `@dismissible/nestjs-postgres-storage` or implementing your own persistent storage adapter.
|
|
109
138
|
|
|
@@ -138,9 +167,9 @@ export class MyService {
|
|
|
138
167
|
|
|
139
168
|
## Related Packages
|
|
140
169
|
|
|
141
|
-
- `@dismissible/nestjs-
|
|
170
|
+
- `@dismissible/nestjs-core` - Main dismissible service (uses storage adapters)
|
|
142
171
|
- `@dismissible/nestjs-postgres-storage` - PostgreSQL storage adapter implementation
|
|
143
|
-
- `@dismissible/nestjs-
|
|
172
|
+
- `@dismissible/nestjs-item` - Data models used by storage adapters
|
|
144
173
|
- `@dismissible/nestjs-logger` - Logging used by storage adapters
|
|
145
174
|
|
|
146
175
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dismissible/nestjs-storage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-alpha.0b30e6d.0",
|
|
4
4
|
"description": "In-memory storage adapter for Dismissible",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"src",
|
|
16
|
-
"README.md"
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@dismissible/nestjs-
|
|
20
|
-
"@dismissible/nestjs-logger": "
|
|
21
|
-
"lru-cache": "
|
|
20
|
+
"@dismissible/nestjs-item": "1.0.3-alpha.0b30e6d.0",
|
|
21
|
+
"@dismissible/nestjs-logger": "1.0.3-alpha.0b30e6d.0",
|
|
22
|
+
"lru-cache": "10.4.3"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
|
-
"@nestjs/common": "
|
|
25
|
+
"@nestjs/common": "10.0.0 || ^11.0.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependenciesMeta": {
|
|
27
28
|
"@nestjs/common": {
|
|
@@ -45,4 +46,4 @@
|
|
|
45
46
|
"access": "public"
|
|
46
47
|
},
|
|
47
48
|
"type": "commonjs"
|
|
48
|
-
}
|
|
49
|
+
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./memory-storage.adapter"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./storage.interface"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./storage.module"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./memory-storage.module"), exports);
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/storage/src/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC;AACzC,8DAAoC;AACpC,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/storage/src/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC;AACzC,8DAAoC;AACpC,2DAAiC;AACjC,kEAAwC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDismissibleLogger } from '@dismissible/nestjs-logger';
|
|
2
2
|
import { IDismissibleStorage } from './storage.interface';
|
|
3
|
-
import { DismissibleItemDto } from '@dismissible/nestjs-
|
|
3
|
+
import { DismissibleItemDto } from '@dismissible/nestjs-item';
|
|
4
4
|
/**
|
|
5
5
|
* In-memory storage provider for dismissible items with LRU eviction.
|
|
6
6
|
* Suitable for development and testing; not for production use.
|
|
@@ -20,11 +20,8 @@ export declare class MemoryStorageAdapter implements IDismissibleStorage {
|
|
|
20
20
|
get(userId: string, itemId: string): Promise<DismissibleItemDto | null>;
|
|
21
21
|
create(item: DismissibleItemDto): Promise<DismissibleItemDto>;
|
|
22
22
|
update(item: DismissibleItemDto): Promise<DismissibleItemDto>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Useful for testing.
|
|
26
|
-
*/
|
|
27
|
-
clear(): void;
|
|
23
|
+
delete(userId: string, itemId: string): Promise<void>;
|
|
24
|
+
deleteAll(): Promise<void>;
|
|
28
25
|
/**
|
|
29
26
|
* Get the number of stored items.
|
|
30
27
|
* Useful for testing/debugging.
|
|
@@ -50,12 +50,13 @@ let MemoryStorageAdapter = class MemoryStorageAdapter {
|
|
|
50
50
|
this.storage.set(key, item);
|
|
51
51
|
return item;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
async delete(userId, itemId) {
|
|
54
|
+
const key = this.createKey(userId, itemId);
|
|
55
|
+
this.logger.debug(`Storage delete`, { userId, itemId, key });
|
|
56
|
+
this.storage.delete(key);
|
|
57
|
+
}
|
|
58
|
+
async deleteAll() {
|
|
59
|
+
this.logger.debug(`Storage deleteAll`, { previousSize: this.storage.size });
|
|
59
60
|
this.storage.clear();
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-storage.adapter.js","sourceRoot":"","sources":["../../../../libs/storage/src/memory-storage.adapter.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,yCAAqC;AACrC,8DAAoF;AAIpF;;;;;;;GAOG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B,YAAyD,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;QACjF,IAAI,CAAC,OAAO,GAAG,IAAI,oBAAQ,CAA6B;YACtD,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,UAAU;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,MAAc,EAAE,MAAc;QAC9C,OAAO,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,MAAc;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC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GG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF,CAAA;AAhEY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,kCAAkB,CAAC,CAAA;;GAH5B,oBAAoB,CAgEhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemoryStorageModule = void 0;
|
|
4
|
+
const storage_interface_1 = require("./storage.interface");
|
|
5
|
+
const memory_storage_adapter_1 = require("./memory-storage.adapter");
|
|
6
|
+
class MemoryStorageModule {
|
|
7
|
+
static forRoot() {
|
|
8
|
+
return {
|
|
9
|
+
module: MemoryStorageModule,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: storage_interface_1.DISMISSIBLE_STORAGE_ADAPTER,
|
|
13
|
+
useClass: memory_storage_adapter_1.MemoryStorageAdapter,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
exports: [storage_interface_1.DISMISSIBLE_STORAGE_ADAPTER],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.MemoryStorageModule = MemoryStorageModule;
|
|
21
|
+
//# sourceMappingURL=memory-storage.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-storage.module.js","sourceRoot":"","sources":["../../../../libs/storage/src/memory-storage.module.ts"],"names":[],"mappings":";;;AACA,2DAAkE;AAClE,qEAAgE;AAEhE,MAAa,mBAAmB;IAC9B,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,MAAM,EAAE,mBAAmB;YAC3B,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,+CAA2B;oBACpC,QAAQ,EAAE,6CAAoB;iBAC/B;aACF;YACD,OAAO,EAAE,CAAC,+CAA2B,CAAC;SACvC,CAAC;IACJ,CAAC;CACF;AAbD,kDAaC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DismissibleItemDto } from '@dismissible/nestjs-
|
|
1
|
+
import { DismissibleItemDto } from '@dismissible/nestjs-item';
|
|
2
2
|
/**
|
|
3
3
|
* Injection token for the storage provider.
|
|
4
4
|
*/
|
|
@@ -27,4 +27,15 @@ export interface IDismissibleStorage {
|
|
|
27
27
|
* @returns The updated item
|
|
28
28
|
*/
|
|
29
29
|
update(item: DismissibleItemDto): Promise<DismissibleItemDto>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete an item by user ID and item ID.
|
|
32
|
+
* @param userId The user identifier
|
|
33
|
+
* @param itemId The item identifier
|
|
34
|
+
*/
|
|
35
|
+
delete(userId: string, itemId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete all items.
|
|
38
|
+
* Useful for cleanup operations.
|
|
39
|
+
*/
|
|
40
|
+
deleteAll(): Promise<void>;
|
|
30
41
|
}
|
package/src/storage.module.js
CHANGED
|
@@ -4,18 +4,13 @@ exports.StorageModule = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const storage_interface_1 = require("./storage.interface");
|
|
7
|
-
const
|
|
7
|
+
const memory_storage_module_1 = require("./memory-storage.module");
|
|
8
8
|
let StorageModule = class StorageModule {
|
|
9
9
|
};
|
|
10
10
|
exports.StorageModule = StorageModule;
|
|
11
11
|
exports.StorageModule = StorageModule = tslib_1.__decorate([
|
|
12
12
|
(0, common_1.Module)({
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
provide: storage_interface_1.DISMISSIBLE_STORAGE_ADAPTER,
|
|
16
|
-
useClass: memory_storage_adapter_1.MemoryStorageAdapter,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
13
|
+
imports: [memory_storage_module_1.MemoryStorageModule.forRoot()],
|
|
19
14
|
exports: [storage_interface_1.DISMISSIBLE_STORAGE_ADAPTER],
|
|
20
15
|
})
|
|
21
16
|
], StorageModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.module.js","sourceRoot":"","sources":["../../../../libs/storage/src/storage.module.ts"],"names":[],"mappings":";;;;AAAA,2CAA6D;AAC7D,2DAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"storage.module.js","sourceRoot":"","sources":["../../../../libs/storage/src/storage.module.ts"],"names":[],"mappings":";;;;AAAA,2CAA6D;AAC7D,2DAAkE;AAClE,mEAA8D;AAUvD,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAJzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,2CAAmB,CAAC,OAAO,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC,+CAA2B,CAAC;KACvC,CAAC;GACW,aAAa,CAAG"}
|