@jwn-js/common 1.3.6 → 1.3.7

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/docs/modules.html CHANGED
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>@jwn-js/common - v1.3.6</title>
7
- <meta name="description" content="Documentation for @jwn-js/common - v1.3.6">
6
+ <title>@jwn-js/common - v1.3.7</title>
7
+ <meta name="description" content="Documentation for @jwn-js/common - v1.3.7">
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1">
9
9
  <link rel="stylesheet" href="assets/css/main.css">
10
10
  <script async src="assets/js/search.js" id="search-script"></script>
@@ -23,7 +23,7 @@
23
23
  <li class="state loading">Preparing search index...</li>
24
24
  <li class="state failure">The search index is not available</li>
25
25
  </ul>
26
- <a href="index.html" class="title">@jwn-js/common - v1.3.6</a>
26
+ <a href="index.html" class="title">@jwn-js/common - v1.3.7</a>
27
27
  </div>
28
28
  <div class="table-cell" id="tsd-widgets">
29
29
  <div id="tsd-filter">
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  <div class="tsd-page-title">
52
52
  <div class="container">
53
- <h1>@jwn-js/common - v1.3.6</h1>
53
+ <h1>@jwn-js/common - v1.3.7</h1>
54
54
  </div>
55
55
  </div>
56
56
  </header>
@@ -122,6 +122,7 @@
122
122
  <li class="tsd-kind-function"><a href="modules.html#method" class="tsd-kind-icon">method</a></li>
123
123
  <li class="tsd-kind-function tsd-has-type-parameter"><a href="modules.html#mixin" class="tsd-kind-icon">mixin</a></li>
124
124
  <li class="tsd-kind-function tsd-has-type-parameter"><a href="modules.html#mount" class="tsd-kind-icon">mount</a></li>
125
+ <li class="tsd-kind-function"><a href="modules.html#pool" class="tsd-kind-icon">pool</a></li>
125
126
  <li class="tsd-kind-function"><a href="modules.html#protocol" class="tsd-kind-icon">protocol</a></li>
126
127
  <li class="tsd-kind-function"><a href="modules.html#request" class="tsd-kind-icon">request</a></li>
127
128
  <li class="tsd-kind-function"><a href="modules.html#stream" class="tsd-kind-icon">stream</a></li>
@@ -716,7 +717,7 @@
716
717
  <li class="tsd-description">
717
718
  <aside class="tsd-sources">
718
719
  <ul>
719
- <li>Defined in src/Web/decorators.ts:266</li>
720
+ <li>Defined in src/Web/decorators.ts:276</li>
720
721
  </ul>
721
722
  </aside>
722
723
  <div class="tsd-comment tsd-typography">
@@ -729,7 +730,7 @@
729
730
  <h4 class="tsd-parameters-title">Parameters</h4>
730
731
  <ul class="tsd-parameters">
731
732
  <li>
732
- <h5>name: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &#x27;home&#x27;</span></h5>
733
+ <h5>name: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;home&quot;</span></h5>
733
734
  </li>
734
735
  </ul>
735
736
  <h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, propertyKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, parameterIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></h4>
@@ -1106,7 +1107,7 @@
1106
1107
  <li class="tsd-description">
1107
1108
  <aside class="tsd-sources">
1108
1109
  <ul>
1109
- <li>Defined in src/Web/decorators.ts:310</li>
1110
+ <li>Defined in src/Web/decorators.ts:320</li>
1110
1111
  </ul>
1111
1112
  </aside>
1112
1113
  <div class="tsd-comment tsd-typography">
@@ -1157,7 +1158,7 @@
1157
1158
  <li class="tsd-description">
1158
1159
  <aside class="tsd-sources">
1159
1160
  <ul>
1160
- <li>Defined in src/Web/decorators.ts:408</li>
1161
+ <li>Defined in src/Web/decorators.ts:418</li>
1161
1162
  </ul>
1162
1163
  </aside>
1163
1164
  <div class="tsd-comment tsd-typography">
@@ -1205,7 +1206,7 @@
1205
1206
  <li class="tsd-description">
1206
1207
  <aside class="tsd-sources">
1207
1208
  <ul>
1208
- <li>Defined in src/Web/decorators.ts:277</li>
1209
+ <li>Defined in src/Web/decorators.ts:287</li>
1209
1210
  </ul>
1210
1211
  </aside>
1211
1212
  <div class="tsd-comment tsd-typography">
@@ -1260,7 +1261,7 @@
1260
1261
  <li class="tsd-description">
1261
1262
  <aside class="tsd-sources">
1262
1263
  <ul>
1263
- <li>Defined in src/Web/decorators.ts:299</li>
1264
+ <li>Defined in src/Web/decorators.ts:309</li>
1264
1265
  </ul>
1265
1266
  </aside>
1266
1267
  <div class="tsd-comment tsd-typography">
@@ -1467,6 +1468,60 @@
1467
1468
  </li>
1468
1469
  </ul>
1469
1470
  </section>
1471
+ <section class="tsd-panel tsd-member tsd-kind-function">
1472
+ <a name="pool" class="tsd-anchor"></a>
1473
+ <h3>pool</h3>
1474
+ <ul class="tsd-signatures tsd-kind-function">
1475
+ <li class="tsd-signature tsd-kind-icon">pool<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, propertyKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, parameterIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></li>
1476
+ </ul>
1477
+ <ul class="tsd-descriptions">
1478
+ <li class="tsd-description">
1479
+ <aside class="tsd-sources">
1480
+ <ul>
1481
+ <li>Defined in src/Web/decorators.ts:266</li>
1482
+ </ul>
1483
+ </aside>
1484
+ <div class="tsd-comment tsd-typography">
1485
+ <dl class="tsd-comment-tags">
1486
+ <dt>pool()</dt>
1487
+ <dd><p>decorator</p>
1488
+ </dd>
1489
+ </dl>
1490
+ </div>
1491
+ <h4 class="tsd-parameters-title">Parameters</h4>
1492
+ <ul class="tsd-parameters">
1493
+ <li>
1494
+ <h5>name: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;home&quot;</span></h5>
1495
+ </li>
1496
+ </ul>
1497
+ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, propertyKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, parameterIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></h4>
1498
+ <ul class="tsd-parameters">
1499
+ <li class="tsd-parameter-signature">
1500
+ <ul class="tsd-signatures tsd-kind-type-literal">
1501
+ <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, propertyKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, parameterIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
1502
+ </ul>
1503
+ <ul class="tsd-descriptions">
1504
+ <li class="tsd-description">
1505
+ <h4 class="tsd-parameters-title">Parameters</h4>
1506
+ <ul class="tsd-parameters">
1507
+ <li>
1508
+ <h5>target: <span class="tsd-signature-type">any</span></h5>
1509
+ </li>
1510
+ <li>
1511
+ <h5>propertyKey: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5>
1512
+ </li>
1513
+ <li>
1514
+ <h5>parameterIndex: <span class="tsd-signature-type">number</span></h5>
1515
+ </li>
1516
+ </ul>
1517
+ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
1518
+ </li>
1519
+ </ul>
1520
+ </li>
1521
+ </ul>
1522
+ </li>
1523
+ </ul>
1524
+ </section>
1470
1525
  <section class="tsd-panel tsd-member tsd-kind-function">
1471
1526
  <a name="protocol" class="tsd-anchor"></a>
1472
1527
  <h3>protocol</h3>
@@ -1717,7 +1772,7 @@
1717
1772
  <li class="tsd-description">
1718
1773
  <aside class="tsd-sources">
1719
1774
  <ul>
1720
- <li>Defined in src/Web/decorators.ts:288</li>
1775
+ <li>Defined in src/Web/decorators.ts:298</li>
1721
1776
  </ul>
1722
1777
  </aside>
1723
1778
  <div class="tsd-comment tsd-typography">
@@ -1888,6 +1943,9 @@
1888
1943
  <li class=" tsd-kind-function tsd-has-type-parameter">
1889
1944
  <a href="modules.html#mount" class="tsd-kind-icon">mount</a>
1890
1945
  </li>
1946
+ <li class=" tsd-kind-function">
1947
+ <a href="modules.html#pool" class="tsd-kind-icon">pool</a>
1948
+ </li>
1891
1949
  <li class=" tsd-kind-function">
1892
1950
  <a href="modules.html#protocol" class="tsd-kind-icon">protocol</a>
1893
1951
  </li>
package/index.d.ts CHANGED
@@ -371,6 +371,9 @@ declare class Model$1 {
371
371
  isLog: boolean;
372
372
  isActive: boolean;
373
373
  };
374
+ getDb(): Record<string, any>;
375
+ getHome(): any;
376
+ getPool(key?: string): any;
374
377
  }
375
378
 
376
379
  interface ResponseOptions {
@@ -505,6 +508,7 @@ declare class Controller {
505
508
  isActive: boolean;
506
509
  };
507
510
  getHome(): Query;
511
+ getPool(key?: string): Query;
508
512
  }
509
513
 
510
514
  interface Context extends ContextWeb {
@@ -556,6 +560,9 @@ declare class Model {
556
560
  isLog: boolean;
557
561
  isActive: boolean;
558
562
  };
563
+ getDb(): Record<string, any>;
564
+ getHome(): any;
565
+ getPool(key?: string): any;
559
566
  }
560
567
 
561
568
  /**
@@ -640,6 +647,10 @@ declare function stream(): (target: any, propertyKey: string | symbol, parameter
640
647
  * @home() decorator
641
648
  */
642
649
  declare function home(): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
650
+ /**
651
+ * @pool() decorator
652
+ */
653
+ declare function pool(name?: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
643
654
  /**
644
655
  * @connection() decorator
645
656
  */
@@ -684,4 +695,4 @@ declare const helpers: {
684
695
  getExt: (path: string) => string;
685
696
  };
686
697
 
687
- export { ContextWeb, Controller, Memcached, Model, OptionsSsr, OptionsWeb, Route$1 as Route, Ssr, Web, action, body, config, connection, context, controller, cookies, db, headers, helpers, home, hostname, http, init, json, logerror, method, mixin, mountWithContext as mount, protocol, request, stream, subaction, url, xml };
698
+ export { ContextWeb, Controller, Memcached, Model, OptionsSsr, OptionsWeb, Route$1 as Route, Ssr, Web, action, body, config, connection, context, controller, cookies, db, headers, helpers, home, hostname, http, init, json, logerror, method, mixin, mountWithContext as mount, pool, protocol, request, stream, subaction, url, xml };
package/index.js CHANGED
@@ -953,6 +953,9 @@ class Controller {
953
953
  getHome() {
954
954
  return this.getDb().home;
955
955
  }
956
+ getPool(key = "home") {
957
+ return this.getDb()[key];
958
+ }
956
959
  }
957
960
 
958
961
  class Model {
@@ -1002,6 +1005,15 @@ class Model {
1002
1005
  getSubaction() {
1003
1006
  return this.$context.subaction;
1004
1007
  }
1008
+ getDb() {
1009
+ return this.$context.db;
1010
+ }
1011
+ getHome() {
1012
+ return this.$context.db.home;
1013
+ }
1014
+ getPool(key = "home") {
1015
+ return this.getDb()[key];
1016
+ }
1005
1017
  }
1006
1018
 
1007
1019
  const argumentsSubactionsKey = Symbol("arguments");
@@ -1120,6 +1132,11 @@ function home() {
1120
1132
  defineMetadataArgument(argumentsSubactionsKey, target, propertyKey, parameterIndex, "home");
1121
1133
  };
1122
1134
  }
1135
+ function pool(name = "home") {
1136
+ return function(target, propertyKey, parameterIndex) {
1137
+ defineMetadataArgument(argumentsSubactionsKey, target, propertyKey, parameterIndex, "pool", name);
1138
+ };
1139
+ }
1123
1140
  function connection(name = "home") {
1124
1141
  return function(target, propertyKey, parameterIndex) {
1125
1142
  defineMetadataArgument(argumentsConnectionsKey, target, propertyKey, parameterIndex, "connection", name);
@@ -1156,7 +1173,7 @@ function http() {
1156
1173
  continue;
1157
1174
  }
1158
1175
  const getterName = `get${upperCaseFirstLetter(existingArguments[key].type)}`;
1159
- args[+key] = this[getterName]();
1176
+ args[+key] = this[getterName](existingConnections[key].params);
1160
1177
  }
1161
1178
  for (const key in existingConnections) {
1162
1179
  if (!existingConnections.hasOwnProperty(key)) {
@@ -1248,6 +1265,7 @@ exports.logerror = logerror;
1248
1265
  exports.method = method;
1249
1266
  exports.mixin = mixin;
1250
1267
  exports.mount = mountWithContext;
1268
+ exports.pool = pool;
1251
1269
  exports.protocol = protocol;
1252
1270
  exports.request = request;
1253
1271
  exports.stream = stream;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jwn-js/common",
3
3
  "private": false,
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "description": "@jwn-js/common package",
6
6
  "main": "./index.js",
7
7
  "types": "./index.d.ts",