@jwn-js/common 2.0.3 → 2.0.4

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/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { HttpResponse, HttpRequest } from 'uWebSockets.js';
6
6
  export { ApiError, ApiErrorMessage } from './ApiError';
7
7
  export { Server, Handler as ServerHandler, Options as ServerOptions, Routes as ServerRoutes, WebSocket as ServerWebsocket, codeToStatus } from './Server';
8
8
  export { Jwt } from './Jwt';
9
+ import { Memcached as Memcached$1 } from './Memcached';
9
10
  export { Memcached } from './Memcached';
10
11
  import { Client } from 'memjs';
11
12
  import { Query } from 'buildmsql';
@@ -80,6 +81,18 @@ declare class Memcached {
80
81
  constructor(memjs: Client, specialHeaders?: {
81
82
  'x-cache': string;
82
83
  }, maxKeyLength?: number, debug?: number);
84
+ /**
85
+ * Set value to memcache
86
+ * @param key string key
87
+ * @param value value
88
+ * @param expires expiers in second
89
+ */
90
+ setValue(key: string, value: string | Buffer, expires: number | undefined | null): Promise<void>;
91
+ /**
92
+ * Get value from memory
93
+ * @param key string key
94
+ */
95
+ getValue(key: string): Promise<null | Buffer>;
83
96
  /**
84
97
  * Set page to cache
85
98
  * @param url https://yur.site.net
@@ -91,7 +104,7 @@ declare class Memcached {
91
104
  /**
92
105
  * Get Page and headers
93
106
  * @param url https://your.site.net
94
- * @retuns {data, headers}
107
+ * @returns {data, headers}
95
108
  */
96
109
  getPage(url: string): Promise<null | {
97
110
  data: Buffer;
@@ -228,7 +241,11 @@ interface OptionsWeb {
228
241
  readonly config: Config$1;
229
242
  readonly db: Record<string, Query>;
230
243
  readonly schema?: Schema;
231
- readonly stack?: Record<string, any>;
244
+ readonly stack?: {
245
+ memcached?: Memcached;
246
+ redis?: any;
247
+ [key: string]: any;
248
+ };
232
249
  readonly [key: string]: any;
233
250
  }
234
251
  interface Response$1 {
@@ -266,7 +283,11 @@ interface ActionsParmas$1 {
266
283
  interface ContextWeb$1 extends ActionsParmas$1 {
267
284
  readonly config: Config$1;
268
285
  readonly db: Record<string, Query>;
269
- readonly stack: Record<string, any>;
286
+ readonly stack: {
287
+ memcached?: Memcached;
288
+ redis?: any;
289
+ [key: string]: any;
290
+ };
270
291
  [key: string]: any;
271
292
  }
272
293
  /**
@@ -414,7 +435,11 @@ interface ActionsParmas {
414
435
  interface ContextWeb extends ActionsParmas {
415
436
  readonly config: Config;
416
437
  readonly db: Record<string, Query>;
417
- readonly stack: Record<string, any>;
438
+ readonly stack: {
439
+ memcached?: Memcached;
440
+ redis?: any;
441
+ [key: string]: any;
442
+ };
418
443
  [key: string]: any;
419
444
  }
420
445
  interface ContextWebController extends ContextWeb {
@@ -590,7 +615,11 @@ declare class Controller {
590
615
  getSubaction(): ContextWebController["subaction"];
591
616
  getHome(): Query;
592
617
  getPool(key?: string): Query;
593
- getStack(): Record<string, any>;
618
+ getStack(): {
619
+ [key: string]: any;
620
+ memcached?: Memcached$1 | undefined;
621
+ redis?: any;
622
+ };
594
623
  setResponseHeader(key: string, value: string): void;
595
624
  }
596
625
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jwn-js/common",
3
3
  "private": false,
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "description": "@jwn-js/common package",
6
6
  "main": "./index.js",
7
7
  "types": "./index.d.ts",