@dismissible/nestjs-storage 1.0.1 → 1.0.3-alpha.064e57a.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 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 in-memory adapter for the Dismissible system.
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 in-memory storage adapter is useful for development, testing, or when you don't need persistence:
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-dismissible-item';
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-dismissible-item';
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-memory implementation of `IDismissibleStorage`. Data is stored in a `Map` and will be lost when the application restarts.
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-dismissible` - Main dismissible service (uses storage adapters)
170
+ - `@dismissible/nestjs-core` - Main dismissible service (uses storage adapters)
142
171
  - `@dismissible/nestjs-postgres-storage` - PostgreSQL storage adapter implementation
143
- - `@dismissible/nestjs-dismissible-item` - Data models used by storage adapters
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.1",
3
+ "version": "1.0.3-alpha.064e57a.0",
4
4
  "description": "In-memory storage adapter for Dismissible",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -13,14 +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-logger": "^1.0.1",
20
- "@dismissible/nestjs-dismissible-item": "^1.0.1"
20
+ "@dismissible/nestjs-item": "1.0.3-alpha.064e57a.0",
21
+ "@dismissible/nestjs-logger": "1.0.3-alpha.064e57a.0",
22
+ "lru-cache": "11.2.4"
21
23
  },
22
24
  "peerDependencies": {
23
- "@nestjs/common": "^10.0.0 || ^11.0.0"
25
+ "@nestjs/common": "10.0.0 || ^11.0.0"
24
26
  },
25
27
  "peerDependenciesMeta": {
26
28
  "@nestjs/common": {
@@ -44,4 +46,4 @@
44
46
  "access": "public"
45
47
  },
46
48
  "type": "commonjs"
47
- }
49
+ }
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './memory-storage.adapter';
2
2
  export * from './storage.interface';
3
3
  export * from './storage.module';
4
+ export * from './memory-storage.module';
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,9 +1,13 @@
1
1
  import { IDismissibleLogger } from '@dismissible/nestjs-logger';
2
2
  import { IDismissibleStorage } from './storage.interface';
3
- import { DismissibleItemDto } from '@dismissible/nestjs-dismissible-item';
3
+ import { DismissibleItemDto } from '@dismissible/nestjs-item';
4
4
  /**
5
- * In-memory storage provider for dismissible items.
5
+ * In-memory storage provider for dismissible items with LRU eviction.
6
6
  * Suitable for development and testing; not for production use.
7
+ *
8
+ * Automatically evicts items when:
9
+ * - The cache exceeds the maximum number of items (default: 5000)
10
+ * - Items are older than the maximum age (default: 6 hours)
7
11
  */
8
12
  export declare class MemoryStorageAdapter implements IDismissibleStorage {
9
13
  private readonly logger;
@@ -16,11 +20,8 @@ export declare class MemoryStorageAdapter implements IDismissibleStorage {
16
20
  get(userId: string, itemId: string): Promise<DismissibleItemDto | null>;
17
21
  create(item: DismissibleItemDto): Promise<DismissibleItemDto>;
18
22
  update(item: DismissibleItemDto): Promise<DismissibleItemDto>;
19
- /**
20
- * Clear all stored items.
21
- * Useful for testing.
22
- */
23
- clear(): void;
23
+ delete(userId: string, itemId: string): Promise<void>;
24
+ deleteAll(): Promise<void>;
24
25
  /**
25
26
  * Get the number of stored items.
26
27
  * Useful for testing/debugging.
@@ -3,15 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoryStorageAdapter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@nestjs/common");
6
+ const lru_cache_1 = require("lru-cache");
6
7
  const nestjs_logger_1 = require("@dismissible/nestjs-logger");
7
8
  /**
8
- * In-memory storage provider for dismissible items.
9
+ * In-memory storage provider for dismissible items with LRU eviction.
9
10
  * Suitable for development and testing; not for production use.
11
+ *
12
+ * Automatically evicts items when:
13
+ * - The cache exceeds the maximum number of items (default: 5000)
14
+ * - Items are older than the maximum age (default: 6 hours)
10
15
  */
11
16
  let MemoryStorageAdapter = class MemoryStorageAdapter {
12
17
  constructor(logger) {
13
18
  this.logger = logger;
14
- this.storage = new Map();
19
+ this.storage = new lru_cache_1.LRUCache({
20
+ max: 5000,
21
+ ttl: 6 * 60 * 60 * 1000, // 6 hours
22
+ });
15
23
  }
16
24
  /**
17
25
  * Create a storage key from userId and itemId.
@@ -42,12 +50,13 @@ let MemoryStorageAdapter = class MemoryStorageAdapter {
42
50
  this.storage.set(key, item);
43
51
  return item;
44
52
  }
45
- /**
46
- * Clear all stored items.
47
- * Useful for testing.
48
- */
49
- clear() {
50
- this.logger.debug(`Storage clear`, { previousSize: this.storage.size });
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 });
51
60
  this.storage.clear();
52
61
  }
53
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,8DAAoF;AAIpF;;;GAGG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B,YAAwC,MAA2C;QAA1B,WAAM,GAAN,MAAM,CAAoB;QAFlE,YAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;IAEqB,CAAC;IAEvF;;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,CAAC;QAE1D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF,CAAA;AAzDY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,kCAAkB,CAAC,CAAA;;GAH5B,oBAAoB,CAyDhC"}
1
+ {"version":3,"file":"memory-storage.adapter.js","sourceRoot":"","sources":["../../../../libs/storage/src/memory-storage.adapter.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,yCAAqC;AACrC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oB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,kCAAkB,CAAC,CAAA;;GAH5B,oBAAoB,CAgEhC"}
@@ -0,0 +1,4 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export declare class MemoryStorageModule {
3
+ static forRoot(): DynamicModule;
4
+ }
@@ -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-dismissible-item';
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
  }
@@ -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 memory_storage_adapter_1 = require("./memory-storage.adapter");
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
- providers: [
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,qEAAgE;AAezD,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IATzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,+CAA2B;gBACpC,QAAQ,EAAE,6CAAoB;aAC/B;SACF;QACD,OAAO,EAAE,CAAC,+CAA2B,CAAC;KACvC,CAAC;GACW,aAAa,CAAG"}
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"}