Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .eslintc-ts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0
}
}
14 changes: 14 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# JS generated files from TS
src/**/*.d.ts
src/**/*.js.map

src/Kuzzle.js
src/controllers/Auth.js
src/controllers/Document.js
src/controllers/Base.js
src/core/security/User.js
src/core/security/Profile.js
src/core/security/Role.js
src/utils/interfaces.js
src/core/searchResult/SearchResultBase.js
src/core/searchResult/Document.js
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,19 @@ doc/7/getting-started/.vuejs/cypress/screenshots
doc/7/getting-started/.vuejs/cypress/videos

# Debug snippets
test-*.js
test-*.js

# Typescript related files
*.d.ts
*.js.map
index.js
src/Kuzzle.js
src/controllers/Auth.js
src/controllers/Document.js
src/controllers/Base.js
src/core/security/User.js
src/core/security/Profile.js
src/core/security/Role.js
src/utils/interfaces.js
src/core/searchResult/SearchResultBase.js
src/core/searchResult/Document.js
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"recursive": true,
"slow": 2000,
"timeout": 10000,
"require": ["should-sinon"]
"require": ["should-sinon", "ts-node/register"]
}
2 changes: 1 addition & 1 deletion doc/7/controllers/auth/check-token/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ An `object` representing the token validity status
| ------------- | ------------------ | --------------------------------- |
| `valid` | <pre>boolean</pre> | Tell if the token is valid or not |
| `state` | <pre>string</pre> | Explain why the token is invalid |
|  `expires_at` | <pre>number</pre> | Token expiration timestamp |
|  `expiresAt` | <pre>number</pre> | Token expiration timestamp |

## Usage

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/auth/create-api-key/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The API key content has the following properties:
| Name | Type | Description |
| --------- | ----------------- | ---------------- |
| `userId` | <pre>string</pre> | User kuid |
| `expiresAt` | <pre>number</pre> | Aexpiration date in UNIX micro-timestamp format (`-1` if the token never expires) |
| `expiresAt` | <pre>number</pre> | Expiration date in UNIX micro-timestamp format (`-1` if the token never expires) |
| `ttl` | <pre>number</pre> | Original TTL |
| `description` | <pre>string</pre> | API key description |
| `token` | <pre>string</pre> | Authentication token associated with this API key |
Expand Down
4 changes: 3 additions & 1 deletion doc/7/controllers/auth/get-my-rights/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Additional query options

## Resolves

An `object[]` containing:
An array containing user rights objects.

Each user right object has the following properties:

| Property | Type | Description |
| ------------- | ----------------- | ------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/document/validate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Validate a document

# validate

Validates data against existing validation rules.
Validates a document against existing validation rules.

Note that if no validation specifications are set for the `<index>`/`<collection>`, the document will always be valid.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ hooks:
}' kuzzle:7512/profiles/profile${i}/_create
done
template: default
expected: '^\[ ''profile1'', ''profile2'', ''profile3'', ''profile4'', ''profile5'' \]$'
expected: '^\[ ''profile\d'', ''profile\d'', ''profile\d'', ''profile\d', ''profile\d'' \]$'
1 change: 1 addition & 0 deletions doc/7/core-classes/profile/properties/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ order: 10
|--- |--- |--- |
| `_id` | <pre>string</pre> | Profile ID |
| `policies` | <pre>object[]</pre> | Array of policies for this profile |
| `rateLimit` | <pre>number</pre> | Maximum number of requests per second and per node with this profile |

### policies

Expand Down
34 changes: 0 additions & 34 deletions index.js

This file was deleted.

41 changes: 41 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// defined by webpack plugin
declare var BUILT: any;

if (typeof window !== 'undefined' && typeof BUILT === 'undefined') {
throw new Error('It looks like you are using the Nodejs version of Kuzzle SDK ' +
'in a browser. ' +
'It is strongly recommended to use the browser-specific build instead. ' +
'Learn more at https://github.com/kuzzleio/sdk-javascript/tree/master#browser');
}

import { Kuzzle } from './src/Kuzzle';
import { Http, WebSocket } from './src/protocols';
import * as BaseController from './src/controllers/Base';
import * as KuzzleAbstractProtocol from './src/protocols/abstract/Base';
import * as KuzzleEventEmitter from './src/core/KuzzleEventEmitter';

import * as SearchResultBase from './src/core/searchResult/SearchResultBase';
import * as DocumentSearchResult from './src/core/searchResult/Document';
import * as ProfileSearchResult from './src/core/searchResult/Profile';
import * as RoleSearchResult from './src/core/searchResult/Role';
import * as SpecificationSearchResult from './src/core/searchResult/Specifications';
import * as UserSearchResult from './src/core/searchResult/User';

const exported = {
Kuzzle,
Http,
WebSocket,
BaseController,
KuzzleAbstractProtocol,
KuzzleEventEmitter,
SearchResultBase,
DocumentSearchResult,
ProfileSearchResult,
RoleSearchResult,
SpecificationSearchResult,
UserSearchResult
}

export default exported;

module.exports = exported;
Loading