kuzzle 2.16.7 → 2.16.11

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.
Files changed (54) hide show
  1. package/README.md +11 -0
  2. package/lib/api/controllers/adminController.js +4 -3
  3. package/lib/api/controllers/authController.js +2 -2
  4. package/lib/api/request/kuzzleRequest.d.ts +11 -11
  5. package/lib/api/request/kuzzleRequest.js +34 -48
  6. package/lib/cluster/workers/IDCardRenewer.js +11 -2
  7. package/lib/config/default.config.d.ts +13 -0
  8. package/lib/config/default.config.js +363 -362
  9. package/lib/config/index.js +7 -5
  10. package/lib/core/backend/backendConfig.d.ts +3 -3
  11. package/lib/core/backend/backendConfig.js +2 -2
  12. package/lib/core/network/protocols/httpwsProtocol.js +4 -0
  13. package/lib/core/plugin/pluginContext.d.ts +10 -1
  14. package/lib/core/plugin/pluginContext.js +2 -0
  15. package/lib/core/security/securityLoader.js +1 -1
  16. package/lib/core/security/tokenRepository.js +7 -10
  17. package/lib/core/shared/repository.js +1 -1
  18. package/lib/model/security/profile.js +10 -10
  19. package/lib/model/security/role.js +3 -3
  20. package/lib/service/cache/redis.js +33 -0
  21. package/lib/types/InternalLogger.d.ts +25 -0
  22. package/lib/types/InternalLogger.js +23 -0
  23. package/lib/types/PasswordPolicy.d.ts +77 -0
  24. package/lib/types/PasswordPolicy.js +3 -0
  25. package/lib/types/ProfileDefinition.d.ts +48 -0
  26. package/lib/types/ProfileDefinition.js +3 -0
  27. package/lib/types/RoleDefinition.d.ts +27 -0
  28. package/lib/types/RoleDefinition.js +3 -0
  29. package/lib/types/config/DumpConfiguration.d.ts +42 -0
  30. package/lib/types/config/DumpConfiguration.js +3 -0
  31. package/lib/types/config/HttpConfiguration.d.ts +43 -0
  32. package/lib/types/config/HttpConfiguration.js +9 -0
  33. package/lib/types/config/KuzzleConfiguration.d.ts +123 -0
  34. package/lib/types/config/KuzzleConfiguration.js +3 -0
  35. package/lib/types/config/LimitsConfiguration.d.ts +111 -0
  36. package/lib/types/config/LimitsConfiguration.js +3 -0
  37. package/lib/types/config/PluginsConfiguration.d.ts +177 -0
  38. package/lib/types/config/PluginsConfiguration.js +3 -0
  39. package/lib/types/config/SecurityConfiguration.d.ts +182 -0
  40. package/lib/types/config/SecurityConfiguration.js +3 -0
  41. package/lib/types/config/ServerConfiguration.d.ts +195 -0
  42. package/lib/types/config/ServerConfiguration.js +3 -0
  43. package/lib/types/config/ServicesConfiguration.d.ts +41 -0
  44. package/lib/types/config/ServicesConfiguration.js +3 -0
  45. package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.d.ts +217 -0
  46. package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.js +3 -0
  47. package/lib/types/config/internalCache/InternalCacheRedisConfiguration.d.ts +111 -0
  48. package/lib/types/config/internalCache/InternalCacheRedisConfiguration.js +3 -0
  49. package/lib/types/config/publicCache/PublicCacheRedisConfiguration.d.ts +31 -0
  50. package/lib/types/config/publicCache/PublicCacheRedisConfiguration.js +3 -0
  51. package/lib/types/index.d.ts +17 -0
  52. package/lib/types/index.js +17 -0
  53. package/package-lock.json +367 -377
  54. package/package.json +20 -19
@@ -24,7 +24,7 @@
24
24
  const assert = require('assert');
25
25
 
26
26
  const rc = require('rc');
27
-
27
+ const defaultConfig = require('./default.config');
28
28
  const packageJson = require('../../package.json');
29
29
  const kerror = require('../kerror').wrap('core', 'configuration');
30
30
  const { isPlainObject } = require('../util/safeObject');
@@ -34,11 +34,11 @@ const bytes = require('../util/bytes');
34
34
  * Loads, interprets and checks configuration files
35
35
  * @returns {object}
36
36
  */
37
- function load () {
37
+ function loadConfig () {
38
38
  let config;
39
39
 
40
40
  try {
41
- config = rc('kuzzle', require('../config/default.config'));
41
+ config = rc('kuzzle', defaultConfig.default);
42
42
  }
43
43
  catch (e) {
44
44
  throw kerror.get('cannot_parse', e.message);
@@ -128,10 +128,12 @@ function checkLimitsConfig (cfg) {
128
128
  'requestsBufferSize',
129
129
  'requestsBufferWarningThreshold',
130
130
  'subscriptionConditionsCount',
131
+ 'subscriptionMinterms',
131
132
  'subscriptionRooms',
132
133
  'subscriptionDocumentTTL'
133
134
  ];
134
135
  const canBeZero = [
136
+ 'subscriptionMinterms',
135
137
  'subscriptionRooms',
136
138
  'subscriptionDocumentTTL'
137
139
  ];
@@ -263,10 +265,10 @@ function preprocessProtocolsOptions(config) {
263
265
 
264
266
  function preprocessRedisOptions (redisConfig) {
265
267
  // @deprecated Remove those lines for Kuzzle v3 then
266
- // remove also 'database' from .kuzzlerc.sample and default.config.js
268
+ // remove also 'database' from .kuzzlerc.sample and default.config
267
269
  if (redisConfig.database) {
268
270
  redisConfig.options = { db: redisConfig.database, ...redisConfig.options };
269
271
  }
270
272
  }
271
273
 
272
- module.exports = { load };
274
+ module.exports = { loadConfig };
@@ -1,10 +1,10 @@
1
- import { JSONObject } from '../../../index';
2
1
  import { ApplicationManager, Backend } from './index';
2
+ import { KuzzleConfiguration } from '../../types/config/KuzzleConfiguration';
3
3
  export declare class BackendConfig extends ApplicationManager {
4
4
  /**
5
5
  * Configuration content
6
6
  */
7
- content: JSONObject;
7
+ content: KuzzleConfiguration;
8
8
  constructor(application: Backend);
9
9
  /**
10
10
  * Sets a configuration value
@@ -18,5 +18,5 @@ export declare class BackendConfig extends ApplicationManager {
18
18
  *
19
19
  * @param config - Configuration object to merge
20
20
  */
21
- merge(config: JSONObject): void;
21
+ merge(config: KuzzleConfiguration): void;
22
22
  }
@@ -26,13 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.BackendConfig = void 0;
27
27
  const lodash_1 = __importDefault(require("lodash"));
28
28
  const kerror_1 = __importDefault(require("../../kerror"));
29
- const config_1 = __importDefault(require("../../config"));
30
29
  const index_1 = require("./index");
30
+ const index_js_1 = require("../../config/index.js");
31
31
  const runtimeError = kerror_1.default.wrap('plugin', 'runtime');
32
32
  class BackendConfig extends index_1.ApplicationManager {
33
33
  constructor(application) {
34
34
  super(application);
35
- this.content = config_1.default.load();
35
+ this.content = (0, index_js_1.loadConfig)();
36
36
  }
37
37
  /**
38
38
  * Sets a configuration value
@@ -76,11 +76,13 @@ const HTTP_ALLOWED_CONTENT_TYPES = [
76
76
  'application/x-www-form-urlencoded',
77
77
  'multipart/form-data',
78
78
  ];
79
+ const HTTP_HEADER_CONNECTION = Buffer.from('Connection');
79
80
  const HTTP_HEADER_CONTENT_LENGTH = Buffer.from('Content-Length');
80
81
  const HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = Buffer.from('Access-Control-Allow-Origin');
81
82
  const HTTP_HEADER_VARY = Buffer.from('Vary');
82
83
  const WILDCARD = Buffer.from('*');
83
84
  const ORIGIN = Buffer.from('Origin');
85
+ const CLOSE = Buffer.from('close');
84
86
  const CHARSET_REGEX = /charset=([\w-]+)/i;
85
87
 
86
88
  /**
@@ -594,6 +596,8 @@ class HttpWsProtocol extends Protocol {
594
596
  response.cork(() => {
595
597
  response.writeStatus(Buffer.from(request.response.status.toString()));
596
598
 
599
+ response.writeHeader(HTTP_HEADER_CONNECTION, CLOSE);
600
+
597
601
  for (const header of this.httpConfig.headers) {
598
602
  // If header is missing, add the default one
599
603
  if (request.response.headers[header[2]] === undefined) {
@@ -2,6 +2,7 @@ import { Koncorde } from '../shared/KoncordeWrapper';
2
2
  import { Client } from '@elastic/elasticsearch';
3
3
  import { JSONObject } from 'kuzzle-sdk';
4
4
  import { EmbeddedSDK } from '../shared/sdk/embeddedSdk';
5
+ import { Mutex } from '../../util/mutex';
5
6
  import { RequestContext, RequestInput, KuzzleRequest } from '../../../index';
6
7
  import { BackendCluster } from '../backend';
7
8
  export interface Repository {
@@ -83,6 +84,10 @@ export declare class PluginContext {
83
84
  * @type {BackendCluster}
84
85
  */
85
86
  cluster: BackendCluster;
87
+ /**
88
+ * Current Kuzzle node unique identifier
89
+ */
90
+ nodeId: string;
86
91
  };
87
92
  config: JSONObject;
88
93
  constructors: {
@@ -94,6 +99,10 @@ export declare class PluginContext {
94
99
  * @deprecated import directly: `import { Koncorde } from 'kuzzle'`
95
100
  */
96
101
  Koncorde: Koncorde;
102
+ /**
103
+ * Mutex class
104
+ */
105
+ Mutex: typeof Mutex;
97
106
  /**
98
107
  * Plugin private storage space
99
108
  */
@@ -113,7 +122,7 @@ export declare class PluginContext {
113
122
  /**
114
123
  * Constructor for Elasticsearch SDK Client
115
124
  */
116
- ESClient: new () => Client;
125
+ ESClient: typeof Client;
117
126
  };
118
127
  /**
119
128
  * @deprecated import directly: `import { BadRequestError, ... } from 'kuzzle'`
@@ -97,6 +97,7 @@ class PluginContext {
97
97
  BaseValidationType: require('../validation/baseType'),
98
98
  ESClient: PluginContextESClient,
99
99
  Koncorde: KoncordeWrapper_1.Koncorde,
100
+ Mutex: mutex_1.Mutex,
100
101
  Repository: PluginContextRepository,
101
102
  Request: instantiateRequest,
102
103
  RequestContext: index_1.RequestContext,
@@ -117,6 +118,7 @@ class PluginContext {
117
118
  this.accessors = {
118
119
  cluster: new backend_1.BackendCluster(),
119
120
  execute: (request, callback) => execute(request, callback),
121
+ nodeId: global.kuzzle.id,
120
122
  sdk: new embeddedSdk_1.EmbeddedSDK(),
121
123
  storage: {
122
124
  bootstrap: collections => pluginStore.init(collections),
@@ -50,7 +50,7 @@ class SecurityLoader {
50
50
  force,
51
51
  onExistingUsers = 'fail',
52
52
  onExistingUsersWarning = false,
53
- refresh = false,
53
+ refresh = 'false',
54
54
  user=null,
55
55
  } = {}) {
56
56
  assertIsObject(permissions);
@@ -130,7 +130,7 @@ class TokenRepository extends Repository {
130
130
  global.kuzzle.onAsk(
131
131
  'core:security:token:verify',
132
132
  hash => this.verifyToken(hash));
133
-
133
+
134
134
  }
135
135
 
136
136
  /**
@@ -255,8 +255,8 @@ class TokenRepository extends Repository {
255
255
  * @returns {Promise}
256
256
  */
257
257
  async persistForUser (encodedToken, userId, ttl) {
258
- const redisTTL = ttl !== -1 ? ttl : 0;
259
- const expiresAt = ttl !== -1 ? Date.now() + ttl : -1;
258
+ const redisTTL = ttl === -1 ? 0 : ttl;
259
+ const expiresAt = ttl === -1 ? -1 : Date.now() + ttl;
260
260
  const token = new Token({
261
261
  _id: `${userId}#${encodedToken}`,
262
262
  expiresAt,
@@ -396,7 +396,7 @@ class TokenRepository extends Repository {
396
396
  if (keepApiKeys && cacheToken.type === 'apiKey') {
397
397
  return;
398
398
  }
399
-
399
+
400
400
  await this.expire(cacheToken);
401
401
  }
402
402
  });
@@ -428,13 +428,10 @@ class TokenRepository extends Repository {
428
428
  debug('Loading API keys into Redis');
429
429
 
430
430
  const promises = [];
431
- const createToken = async ({ token, userId, ttl }) => {
432
- return await this.persistForUser(token, userId, ttl);
433
- };
434
431
 
435
- await ApiKey.batchExecute({ match_all: {} }, apiKeys => {
436
- for (const apiKey of apiKeys) {
437
- promises.push(createToken(apiKey));
432
+ await ApiKey.batchExecute({ match_all: {} }, documents => {
433
+ for (const { _source } of documents) {
434
+ promises.push(this.persistForUser(_source.token, _source.userId, _source.ttl));
438
435
  }
439
436
  });
440
437
 
@@ -398,7 +398,7 @@ class Repository {
398
398
  */
399
399
  async _truncate (options, part = null) {
400
400
  if (part === null) {
401
- const objects = await this.search({}, { scroll: '5s', size: 100 });
401
+ const objects = await this.search({}, { refresh: options.refresh, scroll: '5s', size: 100 });
402
402
  const deleted = await this._truncatePart(objects, options);
403
403
 
404
404
  if (objects.hits.length < objects.total) {
@@ -87,28 +87,28 @@ class Profile {
87
87
  this.validateRateLimit();
88
88
 
89
89
  if (!this.policies) {
90
- throw assertionError.get('missing_argument', 'policies');
90
+ throw assertionError.get('missing_argument', `${this._id}.policies`);
91
91
  }
92
92
 
93
93
  if (!Array.isArray(this.policies)) {
94
- throw assertionError.get('invalid_type', 'policies', 'object[]');
94
+ throw assertionError.get('invalid_type', `${this._id}.policies`, 'object[]');
95
95
  }
96
96
 
97
97
  if (this.policies.length === 0) {
98
- throw assertionError.get('empty_argument', 'policies');
98
+ throw assertionError.get('empty_argument', `${this._id}.policies`);
99
99
  }
100
100
 
101
101
  let i = 0;
102
102
  for (const policy of this.policies) {
103
103
  if (!policy.roleId) {
104
- throw assertionError.get('missing_argument', `policies[${i}].roleId`);
104
+ throw assertionError.get('missing_argument', `${this._id}.policies[${i}].roleId`);
105
105
  }
106
106
 
107
107
  for (const member of Object.keys(policy)) {
108
108
  if (member !== 'roleId' && member !== 'restrictedTo') {
109
109
  throw assertionError.get(
110
110
  'unexpected_argument',
111
- `policies[${i}].${member}`,
111
+ `${this._id}.policies[${i}].${member}`,
112
112
  '"roleId", "restrictedTo"');
113
113
  }
114
114
  }
@@ -117,7 +117,7 @@ class Profile {
117
117
  if (!Array.isArray(policy.restrictedTo)) {
118
118
  throw assertionError.get(
119
119
  'invalid_type',
120
- `policies[${i}].restrictedTo`,
120
+ `${this._id}.policies[${i}].restrictedTo`,
121
121
  'object[]');
122
122
  }
123
123
 
@@ -126,14 +126,14 @@ class Profile {
126
126
  if (!isPlainObject(restriction)) {
127
127
  throw assertionError.get(
128
128
  'invalid_type',
129
- `policies[${i}].restrictedTo[${restriction}]`,
129
+ `${this._id}.policies[${i}].restrictedTo[${restriction}]`,
130
130
  'object');
131
131
  }
132
132
 
133
133
  if (restriction.index === null || restriction.index === undefined) {
134
134
  throw assertionError.get(
135
135
  'missing_argument',
136
- `policies[${i}].restrictedTo[${j}].index`);
136
+ `${this._id}.policies[${i}].restrictedTo[${j}].index`);
137
137
  }
138
138
 
139
139
  if (strict) {
@@ -156,7 +156,7 @@ class Profile {
156
156
  if (!Array.isArray(restriction.collections)) {
157
157
  throw assertionError.get(
158
158
  'invalid_type',
159
- `policies[${i}].restrictedTo[${j}].collections`,
159
+ `${this._id}.policies[${i}].restrictedTo[${j}].collections`,
160
160
  'string[]');
161
161
  }
162
162
 
@@ -188,7 +188,7 @@ class Profile {
188
188
  if (member !== 'index' && member !== 'collections') {
189
189
  throw assertionError.get(
190
190
  'unexpected_argument',
191
- `policies[${i}].restrictedTo[${j}].${member}`,
191
+ `${this._id}.policies[${i}].restrictedTo[${j}].${member}`,
192
192
  '"index", "collections"');
193
193
  }
194
194
  }
@@ -96,15 +96,15 @@ class Role {
96
96
  */
97
97
  async validateDefinition () {
98
98
  if (this.controllers === undefined || this.controllers === null) {
99
- throw assertionError.get('missing_argument', 'controllers');
99
+ throw assertionError.get('missing_argument', `${this._id}.controllers`);
100
100
  }
101
101
 
102
102
  if (!isPlainObject(this.controllers)) {
103
- throw assertionError.get('invalid_type', 'controllers', 'object');
103
+ throw assertionError.get('invalid_type', `${this._id}.controllers`, 'object');
104
104
  }
105
105
 
106
106
  if (Object.keys(this.controllers).length === 0) {
107
- throw assertionError.get('empty_argument', 'controllers');
107
+ throw assertionError.get('empty_argument', `${this._id}.controllers`);
108
108
  }
109
109
 
110
110
  Object
@@ -43,6 +43,7 @@ class Redis extends Service {
43
43
  this.client = null;
44
44
  this.commands = {};
45
45
  this.adapterName = name;
46
+ this.pingIntervalID = null;
46
47
  }
47
48
 
48
49
  /**
@@ -80,6 +81,10 @@ class Redis extends Service {
80
81
  });
81
82
 
82
83
  this.setCommands();
84
+ // TODO: Remove this when IORedis does support application level pings to keep connection to Azure Redis alive
85
+ if (config.pingKeepAlive && config.pingKeepAlive > 0) {
86
+ this._setupKeepAlive(config.pingKeepAlive);
87
+ }
83
88
 
84
89
  return new Bluebird((resolve, reject) => {
85
90
  this.client.once('ready', async () => {
@@ -93,6 +98,34 @@ class Redis extends Service {
93
98
  });
94
99
  }
95
100
 
101
+ /**
102
+ * Setup a ping interval to keep the connection alive
103
+ * Every 60 seconds a ping is sent to Redis
104
+ */
105
+ _setupKeepAlive(delay) {
106
+ this.client.on('ready', async () => {
107
+ await this._ping();
108
+ this.pingIntervalID = setInterval(this._ping.bind(this), delay);
109
+ });
110
+
111
+ this.client.on('error', () => {
112
+ clearInterval(this.pingIntervalID);
113
+ this.pingIntervalID = null;
114
+ });
115
+ }
116
+
117
+ /**
118
+ * Ping Redis
119
+ */
120
+ async _ping() {
121
+ try {
122
+ await this.client.ping();
123
+ }
124
+ catch (error) {
125
+ global.kuzzle.log.error(`Failed to PING Redis to keep connection alive:\n${error.message}`);
126
+ }
127
+ }
128
+
96
129
  /**
97
130
  * Initializes the Redis commands list, and add transformers when necessary
98
131
  */
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Internal logger.
3
+ */
4
+ export declare type InternalLogger = {
5
+ /**
6
+ * Logs a debug message
7
+ */
8
+ debug: (message: any) => void;
9
+ /**
10
+ * Logs an error message
11
+ */
12
+ error: (message: any) => void;
13
+ /**
14
+ * Logs an info message
15
+ */
16
+ info: (message: any) => void;
17
+ /**
18
+ * Logs a verbose message
19
+ */
20
+ verbose: (message: any) => void;
21
+ /**
22
+ * Logs a warn message
23
+ */
24
+ warn: (message: any) => void;
25
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /*
3
+ * Kuzzle, a backend software, self-hostable and ready to use
4
+ * to power modern apps
5
+ *
6
+ * Copyright 2015-2020 Kuzzle
7
+ * mailto: support AT kuzzle.io
8
+ * website: http://kuzzle.io
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * https://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ //# sourceMappingURL=InternalLogger.js.map
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Represents a password policy of the local auth strategy plugin.
3
+ *
4
+ * @see https://docs.kuzzle.io/core/2/guides/main-concepts/authentication#password-policies
5
+ *
6
+ * @example
7
+ *
8
+ * {
9
+ * "appliesTo": {
10
+ * "profiles": ["editor"],
11
+ * "roles": ["admin"]
12
+ * },
13
+ * "expiresAfter": "30d",
14
+ * "mustChangePasswordIfSetByAdmin": true,
15
+ * "passwordRegex": "^(?=.*[a-zA-Z])(?=.*[0-9])(?=.{8,})"
16
+ * }
17
+ */
18
+ export declare type PasswordPolicy = {
19
+ /**
20
+ * Applies the policy to matching users.
21
+ *
22
+ * Can be either set to a wildcar (`"*""`) to match all users or to an
23
+ * object containing at least of the following property.
24
+ */
25
+ appliesTo: '*' | {
26
+ /**
27
+ * Array of user kuids the policy applies to.
28
+ */
29
+ users?: string[];
30
+ /**
31
+ * Array of profile ids the policy applies to.
32
+ */
33
+ profiles?: string[];
34
+ /**
35
+ * Array of role ids the policy applies to.
36
+ */
37
+ roles?: string[];
38
+ };
39
+ /**
40
+ * The delay after which a password expires.
41
+ *
42
+ * @see https://www.npmjs.com/package/ms
43
+ *
44
+ * Users with expired passwords are given a resetPasswordToken when logging in
45
+ * and must change their password to be allowed to log in again.
46
+ */
47
+ expiresAfter: string;
48
+ /**
49
+ * If set to true, prevents users to use their username in part of the password.
50
+ *
51
+ * The check is case-insensitive.
52
+ */
53
+ forbidLoginInPassword: boolean;
54
+ /**
55
+ * The number of passwords to store in history and checked against
56
+ * when a new password is set to prevent passwords reuse.
57
+ */
58
+ forbidReusedPasswordCount: number;
59
+ /**
60
+ * If set to true, whenever a password is set for a user by someone else,
61
+ * that user will receive a resetPasswordToken upon their next login and
62
+ * they will have to change their password before being allowed to log in again.
63
+ */
64
+ mustChangePasswordIfSetByAdmin: boolean;
65
+ /**
66
+ * A string representation of a regular expression to test on new passwords.
67
+ *
68
+ * @example
69
+ *
70
+ * // must be at least 6 chars long
71
+ * ".{6,}"
72
+ *
73
+ * // must be at least 8 chars long and include at least one letter and one digit
74
+ * "^(?=.*[a-zA-Z])(?=.*[0-9])(?=.{8,})"
75
+ */
76
+ passwordRegex: string;
77
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PasswordPolicy.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A profile definition.
3
+ *
4
+ * @see https://docs.kuzzle.io/core/2/guides/main-concepts/permissions/#profiles
5
+ *
6
+ * @example
7
+ *
8
+ * {
9
+ * rateLimit: 200,
10
+ * policies: [
11
+ * {
12
+ * roleId: 'anonymous',
13
+ * restrictedTo: [ { index: 'device-manager' } ]
14
+ * }
15
+ * ]
16
+ * }
17
+ */
18
+ export declare type ProfileDefinition = {
19
+ /**
20
+ * The rate limit parameter controls how many API requests a user can send,
21
+ * per second and per node.
22
+ */
23
+ rateLimit: number;
24
+ /**
25
+ * Grant a role rights on API actions for this profile.
26
+ *
27
+ * Each role can be restricted to a list of indexes and collections.
28
+ */
29
+ policies: Array<{
30
+ /**
31
+ * Role ID
32
+ */
33
+ roleId: string;
34
+ /**
35
+ * List of indexes and collections to restrict this role on.
36
+ */
37
+ restrictedTo?: Array<{
38
+ /**
39
+ * Index name.
40
+ */
41
+ index: string;
42
+ /**
43
+ * Collection names.
44
+ */
45
+ collections: string[];
46
+ }>;
47
+ }>;
48
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ProfileDefinition.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A role definition
3
+ *
4
+ * @see https://docs.kuzzle.io/core/2/guides/main-concepts/permissions/#roles
5
+ *
6
+ * @example
7
+ *
8
+ * {
9
+ * controllers: {
10
+ * auth: {
11
+ * actions: {
12
+ * getCurrentUser: true,
13
+ * logout: true
14
+ * }
15
+ * }
16
+ * }
17
+ * }
18
+ */
19
+ export declare type RoleDefinition = {
20
+ controllers: {
21
+ [controllerName: string]: {
22
+ actions: {
23
+ [actionName: string]: boolean;
24
+ };
25
+ };
26
+ };
27
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RoleDefinition.js.map
@@ -0,0 +1,42 @@
1
+ export declare type DumpConfiguration = {
2
+ /**
3
+ * @default false
4
+ */
5
+ enabled: boolean;
6
+ history: {
7
+ /**
8
+ * @default 3
9
+ */
10
+ coredump: number;
11
+ /**
12
+ * @default 5
13
+ */
14
+ reports: number;
15
+ };
16
+ /**
17
+ * @default './dump/'
18
+ */
19
+ path: string;
20
+ /**
21
+ * @default 'gcore'
22
+ */
23
+ gcore: string;
24
+ /**
25
+ * @default 'YYYYMMDD-HHmmss'
26
+ */
27
+ dateFormat: string;
28
+ handledErrors: {
29
+ /**
30
+ * @default true
31
+ */
32
+ enabled: boolean;
33
+ /**
34
+ * @default ['RangeError','TypeError','KuzzleError','InternalError'],
35
+ */
36
+ whitelist: string[];
37
+ /**
38
+ * @default 600000
39
+ */
40
+ minInterval: number;
41
+ };
42
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DumpConfiguration.js.map