@fastify/elasticsearch 4.0.2 → 4.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.
@@ -2,12 +2,52 @@ version: 2
2
2
  updates:
3
3
  - package-ecosystem: "github-actions"
4
4
  directory: "/"
5
+ commit-message:
6
+ # Prefix all commit messages with "chore: "
7
+ prefix: "chore"
5
8
  schedule:
6
- interval: "monthly"
9
+ interval: "weekly"
10
+ cooldown:
11
+ default-days: 7
12
+ allow:
13
+ - dependency-name: "*"
14
+ update-types:
15
+ - "version-update:semver-major"
7
16
  open-pull-requests-limit: 10
8
17
 
9
18
  - package-ecosystem: "npm"
10
19
  directory: "/"
20
+ commit-message:
21
+ # Prefix all commit messages with "chore: "
22
+ prefix: "chore"
11
23
  schedule:
12
24
  interval: "weekly"
25
+ cooldown:
26
+ default-days: 7
27
+ versioning-strategy: "increase-if-necessary"
28
+ allow:
29
+ - dependency-name: "*"
30
+ update-types:
31
+ - "version-update:semver-major"
32
+ ignore:
33
+ # TODO: remove ignore until neostandard support ESLint 10
34
+ - dependency-name: "eslint"
35
+ - dependency-name: "neostandard"
36
+ - dependency-name: "@stylistic/*"
13
37
  open-pull-requests-limit: 10
38
+ groups:
39
+ # Production dependencies with breaking changes
40
+ dependencies:
41
+ dependency-type: "production"
42
+ # ESLint related dependencies
43
+ dev-dependencies-eslint:
44
+ patterns:
45
+ - "eslint"
46
+ - "neostandard"
47
+ - "@stylistic/*"
48
+ # TypeScript related dependencies
49
+ dev-dependencies-typescript:
50
+ patterns:
51
+ - "@types/*"
52
+ - "tstyche"
53
+ - "typescript"
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- - master
8
7
  - next
9
8
  - 'v*'
10
9
  paths-ignore:
@@ -15,10 +14,32 @@ on:
15
14
  - 'docs/**'
16
15
  - '*.md'
17
16
 
17
+ # This allows a subsequently queued workflow run to interrupt previous runs
18
+ concurrency:
19
+ group: "${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
20
+ cancel-in-progress: true
21
+
22
+ permissions:
23
+ contents: read
24
+
18
25
  jobs:
19
- test:
20
- uses: fastify/workflows/.github/workflows/plugins-ci-elasticsearch.yml@v5
26
+ test-elasticsearch-8:
27
+ permissions:
28
+ contents: write
29
+ pull-requests: write
30
+ uses: fastify/workflows/.github/workflows/plugins-ci-elasticsearch.yml@ef591e2186785d5ab36b9fe6a79c7ce2f1d94e57 # v7.0.0
21
31
  with:
22
32
  lint: true
23
33
  license-check: true
24
- elasticsearch-version: 8.15.2
34
+ elasticsearch-version: '8.19.19'
35
+
36
+ test-elasticsearch-9:
37
+ permissions:
38
+ contents: write
39
+ pull-requests: write
40
+ uses: fastify/workflows/.github/workflows/plugins-ci-elasticsearch.yml@ef591e2186785d5ab36b9fe6a79c7ce2f1d94e57 # v7.0.0
41
+ with:
42
+ lint: true
43
+ license-check: true
44
+ elasticsearch-version: '9.4.4'
45
+
@@ -0,0 +1,19 @@
1
+ name: Lock Threads
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0 1 * *'
6
+ workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: lock
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ lock-threads:
16
+ permissions:
17
+ issues: write
18
+ pull-requests: write
19
+ uses: fastify/workflows/.github/workflows/lock-threads.yml@ef591e2186785d5ab36b9fe6a79c7ce2f1d94e57 # v7.0.0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2019 Fastify
3
+ Copyright (c) 2018-present The Fastify team <https://github.com/fastify/fastify#team>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @fastify/elasticsearch
2
2
 
3
- [![CI](https://github.com/fastify/fastify-elasticsearch/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-elasticsearch/actions/workflows/ci.yml)
3
+ [![CI](https://github.com/fastify/fastify-elasticsearch/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-elasticsearch/actions/workflows/ci.yml)
4
4
  [![NPM version](https://img.shields.io/npm/v/@fastify/elasticsearch.svg?style=flat)](https://www.npmjs.com/package/@fastify/elasticsearch)
5
5
  [![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
6
6
 
@@ -11,13 +11,13 @@ Under the hood, the official [elasticsearch](https://www.npmjs.com/package/@elas
11
11
  ## Install
12
12
 
13
13
  ```
14
- npm i @fastify/elasticsearch
14
+ npm i @fastify/elasticsearch @elastic/elasticsearch
15
15
  ```
16
16
 
17
17
  ### Compatibility
18
18
  | Plugin version | Fastify version |
19
19
  | ---------------|-----------------|
20
- | `^4.x` | `^5.x` |
20
+ | `>=4.x` | `^5.x` |
21
21
  | `^3.x` | `^4.x` |
22
22
  | `^2.x` | `^3.x` |
23
23
  | `^1.x` | `^2.x` |
@@ -30,7 +30,7 @@ See [Fastify's LTS policy](https://github.com/fastify/fastify/blob/main/docs/Ref
30
30
 
31
31
  ## Usage
32
32
  Add it to your project with `register` and you are done!
33
- The plugin accepts the [same options](https://github.com/elastic/elasticsearch-js#client-options) as the client.
33
+ The plugin accepts the [same options](https://github.com/elastic/elasticsearch-js) as the client.
34
34
 
35
35
  ```js
36
36
  const fastify = require('fastify')()
@@ -92,7 +92,10 @@ fastify.listen({ port: 3000 }, err => {
92
92
  ```
93
93
 
94
94
  ## Versioning
95
- By default the latest and greatest version of the Elasticsearch client is used, see the [compatibility](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/introduction.html#_compatibility) table to understand if the embedded client is correct for you.
95
+
96
+ `@fastify/elasticsearch` supports Elasticsearch client versions 8 and 9.
97
+
98
+ By default the latest and greatest version of the Elasticsearch client is used, see the [compatibility](https://www.elastic.co/docs/reference/elasticsearch/clients/javascript/installation#nodejs-support) table to understand if the embedded client is correct for you.
96
99
  If it is not, you can pass a custom client via the `client` option.
97
100
  ```js
98
101
  const fastify = require('fastify')()
package/es-docker.sh CHANGED
@@ -3,9 +3,15 @@
3
3
  # run this file to get a working ES instance
4
4
  # for running the test locally
5
5
 
6
+ # ES_VERSION can be overridden:
7
+ # ES_VERSION=8.19.19 ./es-docker.sh
8
+ # ES_VERSION=9.4.4 ./es-docker.sh
9
+
10
+ ES_VERSION="${ES_VERSION:-8.19.19}"
11
+
6
12
  exec docker run \
7
13
  --rm \
8
14
  -e "discovery.type=single-node" \
9
15
  -e "xpack.security.enabled=false" \
10
16
  -p 9200:9200 \
11
- docker.elastic.co/elasticsearch/elasticsearch:8.15.2
17
+ "docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/elasticsearch",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Fastify plugin for elastic search",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -10,7 +10,7 @@
10
10
  "lint:fix": "eslint --fix",
11
11
  "test": "npm run test:unit && npm run test:typescript",
12
12
  "test:unit": "c8 --100 node --test",
13
- "test:typescript": "tsd"
13
+ "test:typescript": "tstyche"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  {
37
37
  "name": "Tomas Della Vedova",
38
- "url": "http://delved.org"
38
+ "url": "https://delvedor.dev"
39
39
  },
40
40
  {
41
41
  "name": "Frazer Smith",
@@ -59,17 +59,19 @@
59
59
  }
60
60
  ],
61
61
  "dependencies": {
62
- "@elastic/elasticsearch": "^8.13.1",
63
- "fastify-plugin": "^5.0.0"
62
+ "fastify-plugin": "^6.0.0"
64
63
  },
65
64
  "devDependencies": {
66
- "@fastify/pre-commit": "^2.1.0",
67
- "@types/node": "^22.0.0",
68
- "c8": "^10.1.2",
65
+ "@elastic/elasticsearch": "^9.0.2",
66
+ "@types/node": "^26.0.1",
67
+ "c8": "^12.0.0",
69
68
  "eslint": "^9.17.0",
70
69
  "fastify": "^5.0.0",
71
- "neostandard": "^0.12.0",
72
- "tsd": "^0.31.0"
70
+ "neostandard": "^0.13.0",
71
+ "tstyche": "^7.0.0"
72
+ },
73
+ "peerDependencies": {
74
+ "@elastic/elasticsearch": "^8 || ^9"
73
75
  },
74
76
  "publishConfig": {
75
77
  "access": "public"
@@ -0,0 +1,19 @@
1
+ import fastifyElasticsearch from '.'
2
+ import Fastify from 'fastify'
3
+ import { expect } from 'tstyche'
4
+ import { Client } from '@elastic/elasticsearch'
5
+
6
+ const fastify = Fastify()
7
+ fastify.register(fastifyElasticsearch, { node: 'http://localhost:9200' })
8
+
9
+ expect(fastify.isElasticsearchClient(fastify.elastic)).type.toBe<boolean>()
10
+ expect(
11
+ fastify.isElasticsearchClient(fastify.elastic.asyncSearch)
12
+ ).type.toBe<boolean>()
13
+ expect(
14
+ fastify.isElasticsearchClient(fastify.elastic.aasdf)
15
+ ).type.toBe<boolean>()
16
+
17
+ expect(fastifyElasticsearch.isElasticsearchClient).type.toBeAssignableTo<
18
+ (value: any) => value is Client
19
+ >()
@@ -1,12 +0,0 @@
1
- import fastifyElasticsearch from '..'
2
- import Fastify from 'fastify'
3
- import { expectAssignable, expectType } from 'tsd'
4
- import { Client } from '@elastic/elasticsearch'
5
-
6
- const fastify = Fastify()
7
- fastify.register(fastifyElasticsearch, { node: 'http://localhost:9200' })
8
-
9
- expectType<boolean>(fastify.isElasticsearchClient(fastify.elastic))
10
- expectType<boolean>(fastify.isElasticsearchClient(fastify.elastic.asyncSearch))
11
- expectType<boolean>(fastify.isElasticsearchClient(fastify.elastic.aasdf))
12
- expectAssignable<(value: any) => value is Client>(fastifyElasticsearch.isElasticsearchClient)