natural 8.1.1 → 8.1.2

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.
@@ -6,6 +6,7 @@ name: Node.js Package
6
6
  on:
7
7
  release:
8
8
  types: [created]
9
+ workflow_dispatch:
9
10
 
10
11
  jobs:
11
12
  build:
@@ -27,10 +28,17 @@ jobs:
27
28
  - uses: actions/checkout@v4
28
29
  - uses: actions/setup-node@v4
29
30
  with:
30
- node-version: 20
31
+ node-version: 24
31
32
  registry-url: https://registry.npmjs.org/
33
+ - name: Install npm with stage support
34
+ run: npm install -g npm@^11.15.0
35
+ - name: Verify Node/npm support for stage
36
+ run: |
37
+ node -v
38
+ npm -v
39
+ npm help stage
32
40
  - run: npm ci
33
41
  - run: git config user.name "$GITHUB_ACTOR"
34
- - run: npm publish
42
+ - run: npm stage publish
35
43
  env:
36
44
  NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}
@@ -20,12 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
20
  THE SOFTWARE.
21
21
  */
22
22
 
23
- const PostgresPlugin = require('./Postgres')
24
- const MongoDBPlugin = require('./MongoDB')
25
- const RedisPlugin = require('./Redis')
26
- const MemcachedPlugin = require('./Memcached')
27
- const FilePlugin = require('./File')
28
-
29
23
  // Enum for different types of storage backends that can be used
30
24
  const STORAGE_TYPES = {
31
25
  POSTGRES: 'POSTGRES',
@@ -49,6 +43,8 @@ class StorageBackend {
49
43
  }
50
44
 
51
45
  // Sets the storage type. Valid values are POSTGRES, REDIS, MONGODB, MEMCACHED, FILE
46
+ // Storage plugins are loaded on demand to avoid pulling in database drivers
47
+ // and their dependencies for users who only need NLP features.
52
48
  async setStorageType (storageType) {
53
49
  if (!storageType) {
54
50
  throw new Error('No storage type specified')
@@ -58,22 +54,32 @@ class StorageBackend {
58
54
  }
59
55
  this.storageType = storageType
60
56
  switch (storageType) {
61
- case STORAGE_TYPES.POSTGRES:
57
+ case STORAGE_TYPES.POSTGRES: {
58
+ const PostgresPlugin = require('./Postgres')
62
59
  this.client = new PostgresPlugin()
63
60
  await this.client.configPostgres()
64
61
  break
65
- case STORAGE_TYPES.REDIS:
62
+ }
63
+ case STORAGE_TYPES.REDIS: {
64
+ const RedisPlugin = require('./Redis')
66
65
  this.client = new RedisPlugin()
67
66
  break
68
- case STORAGE_TYPES.MONGODB:
67
+ }
68
+ case STORAGE_TYPES.MONGODB: {
69
+ const MongoDBPlugin = require('./MongoDB')
69
70
  this.client = new MongoDBPlugin()
70
71
  break
71
- case STORAGE_TYPES.MEMCACHED:
72
+ }
73
+ case STORAGE_TYPES.MEMCACHED: {
74
+ const MemcachedPlugin = require('./Memcached')
72
75
  this.client = new MemcachedPlugin()
73
76
  break
74
- case STORAGE_TYPES.FILE:
77
+ }
78
+ case STORAGE_TYPES.FILE: {
79
+ const FilePlugin = require('./File')
75
80
  this.client = new FilePlugin()
76
81
  break
82
+ }
77
83
  default:
78
84
  throw new Error('Invalid storage type')
79
85
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "natural",
3
3
  "description": "General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
4
- "version": "8.1.1",
4
+ "version": "8.1.2",
5
5
  "homepage": "https://github.com/NaturalNode/natural",
6
6
  "repository": {
7
7
  "type": "git",