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
8 changes: 7 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ if (typeof window !== 'undefined' && typeof BUILT === 'undefined') {

export * from './src/Kuzzle';
export * from './src/protocols';
export * from './src/controllers/Base';
export * from './src/protocols/abstract/Base';
export * from './src/core/KuzzleEventEmitter';

Expand All @@ -22,3 +21,10 @@ export * from './src/core/searchResult/Specifications';
export * from './src/core/searchResult/User';

export * from './src/utils/interfaces';

export * from './src/controllers/Auth';
export * from './src/controllers/Base';
export * from './src/controllers/Collection';
export * from './src/controllers/Document';
export * from './src/controllers/Index';
export * from './src/controllers/Realtime';
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"test:lint:ts:fix": "eslint ./src --ext .ts --config .eslintrc-ts.json --fix",
"build": "npm run build-ts && node build.js",
"build-ts": "tsc --build tsconfig.json",
"clean": "npm run build | grep TSFILE | cut -d' ' -f 2 | xargs rm",
"doc": "docker-compose -f doc/docker-compose.yml up",
"doc-testing": "bash .ci/test-docs.sh",
"doc-prepare": "kuzdoc framework:install",
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/Realtime.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseController } from './Base';
import Room from '../core/Room';
import { JSONObject } from '../utils/interfaces';
import { Notification, JSONObject } from '../utils/interfaces';

/**
* Enum for `scope` option of realtime.subscribe method
Expand Down Expand Up @@ -253,5 +253,3 @@ export class RealtimeController extends BaseController {
this._subscriptionsOff = new Map();
}
}

module.exports = { RealtimeController };
62 changes: 35 additions & 27 deletions src/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,50 +161,58 @@ export interface ApiKey {
}
}

/**
* Kuzzle metadata
* @see https://docs.kuzzle.io/core/2/guides/essentials/document-metadata/
*/
export interface KuzzleMetadata {
_kuzzle_info: {
/**
* Kuid of the user who created the document
*/
author: string,
/**
* Creation date in micro-timestamp
*/
createdAt: number,
/**
* Kuid of the user who last updated the document
*/
updater: string | null,
/**
* Update date in micro-timestamp
*/
updatedAt: number | null
}
}

/**
* Represents the `_source` property of the document
*/
export interface DocumentContent extends KuzzleMetadata {
[key: string]: JSONObject | any,
}

/**
* Kuzzle document
*
* @property _id
* @property _version
* @property _source
*/
export interface Document {
export class Document {
/**
* Document unique ID
*/
_id?: string;
_id: string;
/**
* Document Version (generated by Elasticsearch)
*/
_version?: number;
/**
* Document Content
*/
_source?: {
[key: string]: JSONObject | any,
/**
* Kuzzle metadata
* @see https://docs.kuzzle.io/core/2/guides/essentials/document-metadata/
*/
_kuzzle_info?: {
/**
* Kuid of the user who created the document
*/
author: string,
/**
* Creation date in micro-timestamp
*/
createdAt: number,
/**
* Kuid of the user who last updated the document
*/
updater: string | null,
/**
* Update date in micro-timestamp
*/
updatedAt: number | null
}
};
_source: DocumentContent;
}

/**
Expand Down