kuzzle 2.40.1 → 2.41.0

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.
@@ -36,6 +36,7 @@ class CollectionController extends NativeController {
36
36
  "deleteSpecifications",
37
37
  "exists",
38
38
  "getMapping",
39
+ "getSettings",
39
40
  "getSpecifications",
40
41
  "list",
41
42
  "refresh",
@@ -97,6 +98,23 @@ class CollectionController extends NativeController {
97
98
  return this._filterMappingResponse(mapping);
98
99
  }
99
100
 
101
+ /**
102
+ * Get the collection settings
103
+ *
104
+ * @param {Request} request
105
+ * @returns {Promise.<Object>}
106
+ */
107
+ async getSettings(request) {
108
+ const { index, collection } = request.getIndexAndCollection();
109
+
110
+ return this.ask(
111
+ "core:storage:public:collection:settings:get",
112
+ index,
113
+ collection,
114
+ {},
115
+ );
116
+ }
117
+
100
118
  /**
101
119
  * Get the collection validation specifications
102
120
  *
@@ -140,6 +140,12 @@ const routes = [
140
140
  controller: "collection",
141
141
  action: "getMapping",
142
142
  },
143
+ {
144
+ verb: "get",
145
+ path: "/:index/:collection/_settings",
146
+ controller: "collection",
147
+ action: "getSettings",
148
+ },
143
149
  {
144
150
  verb: "get",
145
151
  path: "/:index/:collection/_search",
@@ -5,7 +5,7 @@ export declare class Backend {
5
5
  private _kuzzle;
6
6
  private _name;
7
7
  private _sdk;
8
- protected started: boolean;
8
+ private _started;
9
9
  protected _pipes: {};
10
10
  protected _hooks: {};
11
11
  protected _controllers: {};
@@ -174,6 +174,8 @@ export declare class Backend {
174
174
  */
175
175
  get nodeId(): string;
176
176
  private get _instanceProxy();
177
+ get started(): boolean;
178
+ protected set started(started: boolean);
177
179
  /**
178
180
  * Try to read the current commit hash.
179
181
  */
@@ -79,7 +79,6 @@ class Backend {
79
79
  * @param name - Your application name
80
80
  */
81
81
  constructor(name) {
82
- this.started = false;
83
82
  this._pipes = {};
84
83
  this._hooks = {};
85
84
  this._controllers = {};
@@ -266,6 +265,12 @@ class Backend {
266
265
  pipes: this._pipes,
267
266
  };
268
267
  }
268
+ get started() {
269
+ return this._started;
270
+ }
271
+ set started(started) {
272
+ this._started = started;
273
+ }
269
274
  /**
270
275
  * Try to read the current commit hash.
271
276
  */
@@ -25,6 +25,7 @@ const { Request } = require("../../api/request");
25
25
  const kerror = require("../../kerror");
26
26
  const HttpRouter = require("./httpRouter");
27
27
  const { removeStacktrace } = require("../../util/stackTrace");
28
+ const kuzzleStateEnum = require("../../kuzzle/kuzzleStateEnum");
28
29
 
29
30
  /**
30
31
  * @class Router
@@ -148,6 +149,27 @@ class Router {
148
149
  cb(request);
149
150
  });
150
151
 
152
+ this.http.get("_ready", (request, cb) => {
153
+ let status = 200;
154
+
155
+ if (
156
+ global.kuzzle.state !== kuzzleStateEnum.RUNNING ||
157
+ global.kuzzle.funnel.overloaded
158
+ ) {
159
+ status = 503;
160
+ }
161
+
162
+ request.response.configure({
163
+ status: status,
164
+ });
165
+
166
+ /**
167
+ * By avoiding using the funnel, we avoid the request to be logged
168
+ * This is useful for ochestrators healthchecks
169
+ */
170
+ cb(request);
171
+ });
172
+
151
173
  for (const route of routes) {
152
174
  const verb = route.verb.toLowerCase();
153
175
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.40.1",
4
+ "version": "2.41.0",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "bin": "bin/start-kuzzle-server",
7
7
  "scripts": {