pixl-server-storage 3.2.7 → 3.2.9

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
@@ -54,6 +54,7 @@ Here is the table of contents for this current document:
54
54
  + [S3 Key Prefix](#s3-key-prefix)
55
55
  + [S3 Key Template](#s3-key-template)
56
56
  + [S3 Cache](#s3-cache)
57
+ + [S3 Compatible Services](#s3-compatible-services)
57
58
  * [Couchbase](#couchbase)
58
59
  * [Redis](#redis)
59
60
  + [RedisCluster](#rediscluster)
@@ -518,6 +519,60 @@ It is recommended that you set the `maxItems` and `maxBytes` high enough to allo
518
519
 
519
520
  Note that binary records are **not** cached, as they are generally large. Only JSON records are cached, as they are usually much smaller and used in [Lists](https://github.com/jhuckaby/pixl-server-storage/blob/master/docs/Lists.md), [Hashes](https://github.com/jhuckaby/pixl-server-storage/blob/master/docs/Hashes.md), [Transactions](https://github.com/jhuckaby/pixl-server-storage/blob/master/docs/Transactions.md) and the [Indexer](https://github.com/jhuckaby/pixl-server-storage/blob/master/docs/Indexer.md).
520
521
 
522
+ ### S3 Compatible Services
523
+
524
+ To use an S3 compatible service such as [MinIO](https://github.com/minio/minio), you'll need to add a few extra parameters to the `AWS` section:
525
+
526
+ ```js
527
+ {
528
+ "endpoint": "http://minio:9000",
529
+ "endpointPrefix": false,
530
+ "forcePathStyle": true,
531
+ "hostPrefixEnabled": false
532
+ }
533
+ ```
534
+
535
+ Replace `minio:9000` with your MinIO hostname or IP address, and port number (9000 is the default).
536
+
537
+ Here is a complete example with the new parameters added:
538
+
539
+ ```js
540
+ {
541
+ "Storage": {
542
+ "transactions": true,
543
+ "trans_auto_recover": true,
544
+
545
+ "engine": "S3",
546
+ "AWS": {
547
+ "endpoint": "http://minio:9000",
548
+ "endpointPrefix": false,
549
+ "forcePathStyle": true,
550
+ "hostPrefixEnabled": false,
551
+ "region": "us-west-1",
552
+ "credentials": {
553
+ "accessKeyId": "YOUR_MINIO_ACCESS_KEY",
554
+ "secretAccessKey": "YOUR_MINIO_SECRET_KEY"
555
+ }
556
+ },
557
+ "S3": {
558
+ "connectTimeout": 5000,
559
+ "socketTimeout": 5000,
560
+ "maxAttempts": 50,
561
+ "keyPrefix": "",
562
+ "fileExtensions": true,
563
+ "params": {
564
+ "Bucket": "YOUR_MINIO_BUCKET_ID"
565
+ },
566
+ "cache": {
567
+ "enabled": true,
568
+ "maxItems": 1000,
569
+ "maxBytes": 10485760
570
+ }
571
+ }
572
+ }
573
+ }
574
+ ```
575
+
521
576
  ## Couchbase
522
577
 
523
578
  Please note that as of this writing (April 2022), pixl-server-storage only supports Couchbase Client v2, so you need to force install version `2.6.12` (see instructions below). Work is underway to support the v3 API, which has many breaking changes.
@@ -83,6 +83,23 @@ module.exports = Class.create({
83
83
 
84
84
  filterWords_number: function(value) {
85
85
  // filter number queries
86
+
87
+ // support simple date-to-epoch conversion here
88
+ if (value.match(/^(\d{4})\D+(\d{2})\D+(\d{2})$/)) {
89
+ var dargs = Tools.getDateArgs( value + " 00:00:00" );
90
+ value = '' + (dargs.epoch || 0);
91
+ }
92
+ else if (value.match(/^(today)$/)) {
93
+ // normalize "today" to midnight today (server timezone)
94
+ var midnight = Tools.normalizeTime( Tools.timeNow(true), { hour:0, min:0, sec:0 } );
95
+ var dargs = Tools.getDateArgs( midnight );
96
+ value = '' + (dargs.epoch || 0);
97
+ }
98
+ else if (value.match(/^(now)$/)) {
99
+ var dargs = Tools.getDateArgs( Tools.timeNow(true) );
100
+ value = '' + (dargs.epoch || 0);
101
+ }
102
+
86
103
  value = value.replace(/\.\d+$/, '').replace(/[^\d\-]+/g, '').replace(/\-/, 'N');
87
104
  return value;
88
105
  },
package/indexer.js CHANGED
@@ -961,13 +961,13 @@ module.exports = Class.create({
961
961
 
962
962
  filterWords_markdown: function(value) {
963
963
  // filter out markdown syntax and html tags, entities
964
- value = value.replace(/\n\`\`\`(.+?)\`\`\`/g, ''); // fenced code
964
+ value = value.replace(/```[\s\S]*?```/g, ''); // fenced code
965
965
  return this.filterWords_html(value);
966
966
  },
967
967
 
968
968
  filterWords_html: function(value) {
969
969
  // filter out html tags, entities
970
- return he.decode( value.replace(/<.+?>/g, '') );
970
+ return he.decode( value.replace(/<[^>]*>/g, '') );
971
971
  },
972
972
 
973
973
  filterWords_alphanum: function(value) {
@@ -1105,6 +1105,13 @@ module.exports = Class.create({
1105
1105
  // range between two values (inclusive)
1106
1106
  var low = RegExp.$1;
1107
1107
  var high = RegExp.$2;
1108
+
1109
+ var lwords = this.getWordList(low, def, config);
1110
+ if (lwords.length) low = lwords[0];
1111
+
1112
+ var hwords = this.getWordList(high, def, config);
1113
+ if (hwords.length) high = hwords[0];
1114
+
1108
1115
  crit = {
1109
1116
  mode: 'and',
1110
1117
  criteria: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-storage",
3
- "version": "3.2.7",
3
+ "version": "3.2.9",
4
4
  "description": "A key/value/list storage component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-storage",