kuzzle-sdk
Advanced tools
Comparing version 7.7.6 to 7.8.0
@@ -1,1 +0,1 @@ | ||
/*! Kuzzle Javascript SDK version 7.7.6 */ | ||
/*! Kuzzle Javascript SDK version 7.8.0 */ |
@@ -11,2 +11,4 @@ export * from './src/Kuzzle'; | ||
export * from './src/core/searchResult/User'; | ||
export * from './src/core/Observer'; | ||
export * from './src/core/RealtimeDocument'; | ||
export * from './src/types'; | ||
@@ -13,0 +15,0 @@ export * from './src/controllers/Auth'; |
@@ -29,2 +29,4 @@ "use strict"; | ||
__exportStar(require("./src/core/searchResult/User"), exports); | ||
__exportStar(require("./src/core/Observer"), exports); | ||
__exportStar(require("./src/core/RealtimeDocument"), exports); | ||
__exportStar(require("./src/types"), exports); | ||
@@ -31,0 +33,0 @@ __exportStar(require("./src/controllers/Auth"), exports); |
{ | ||
"name": "kuzzle-sdk", | ||
"version": "7.7.6", | ||
"version": "7.8.0", | ||
"description": "Official Javascript SDK for Kuzzle", | ||
@@ -44,2 +44,3 @@ "author": "The Kuzzle Team <support@kuzzle.io>", | ||
"devDependencies": { | ||
"lodash": "^4.17.21", | ||
"@babel/core": "^7.15.5", | ||
@@ -69,2 +70,3 @@ "@babel/preset-env": "^7.15.6", | ||
"stream-http": "^3.2.0", | ||
"ts-morph": "^12.2.0", | ||
"ts-node": "^10.2.1", | ||
@@ -71,0 +73,0 @@ "typescript": "^4.4.3", |
import { BaseController } from './Base'; | ||
import { User } from '../core/security/User'; | ||
import { JSONObject, ApiKey } from '../types'; | ||
import { JSONObject, ApiKey, ArgsDefault } from '../types'; | ||
import { RequestPayload } from '../types/RequestPayload'; | ||
@@ -42,8 +42,3 @@ /** | ||
*/ | ||
createApiKey(description: string, options?: { | ||
_id?: string; | ||
expiresIn?: number; | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<ApiKey>; | ||
createApiKey(description: string, options?: ArgsAuthControllerCreateApiKey): Promise<ApiKey>; | ||
/** | ||
@@ -58,5 +53,3 @@ * Checks if an API action can be executed by the current user | ||
*/ | ||
checkRights(requestPayload: RequestPayload, options?: { | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
checkRights(requestPayload: RequestPayload, options?: ArgsAuthControllerCheckRights): Promise<boolean>; | ||
/** | ||
@@ -72,6 +65,3 @@ * Deletes an API key for the currently logged user. | ||
*/ | ||
deleteApiKey(id: string, options?: { | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<null>; | ||
deleteApiKey(id: string, options?: ArgsAuthControllerDeleteApiKey): Promise<null>; | ||
/** | ||
@@ -90,8 +80,3 @@ * Searches API keys for the currently logged user. | ||
*/ | ||
searchApiKeys(query?: JSONObject, options?: { | ||
from?: number; | ||
size?: number; | ||
lang?: string; | ||
timeout?: number; | ||
}): Promise<{ | ||
searchApiKeys(query?: JSONObject, options?: ArgsAuthControllerSearchApiKeys): Promise<{ | ||
/** | ||
@@ -117,5 +102,3 @@ * Array of found ApiKeys | ||
*/ | ||
checkToken(token?: string, options?: { | ||
timeout?: number; | ||
}): Promise<{ | ||
checkToken(token?: string, options?: ArgsAuthControllerCheckToken): Promise<{ | ||
/** | ||
@@ -148,6 +131,3 @@ * Tell if the token is valid or not | ||
*/ | ||
createMyCredentials(strategy: string, credentials: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
createMyCredentials(strategy: string, credentials: JSONObject, options?: ArgsAuthControllerCreateMyCredentials): Promise<JSONObject>; | ||
/** | ||
@@ -165,6 +145,3 @@ * Check the existence of the specified strategy's credentials for the current user. | ||
*/ | ||
credentialsExist(strategy: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
credentialsExist(strategy: string, options?: ArgsAuthControllerCredentialsExist): Promise<boolean>; | ||
/** | ||
@@ -180,6 +157,3 @@ * Delete credentials of the specified strategy for the current user. | ||
*/ | ||
deleteMyCredentials(strategy: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
deleteMyCredentials(strategy: string, options?: ArgsAuthControllerDeleteMyCredentials): Promise<boolean>; | ||
/** | ||
@@ -196,6 +170,3 @@ * Fetches the current user. | ||
*/ | ||
getCurrentUser(options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<User>; | ||
getCurrentUser(options?: ArgsAuthControllerGetCurrentUser): Promise<User>; | ||
/** | ||
@@ -214,6 +185,3 @@ * Get credential information of the specified strategy for the current user. | ||
*/ | ||
getMyCredentials(strategy: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
getMyCredentials(strategy: string, options?: ArgsAuthControllerGetMyCredentials): Promise<JSONObject>; | ||
/** | ||
@@ -230,6 +198,3 @@ * Gets the rights array of the currently logged user. | ||
*/ | ||
getMyRights(options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<Array<{ | ||
getMyRights(options?: ArgsAuthControllerGetMyRights): Promise<Array<{ | ||
/** | ||
@@ -267,6 +232,3 @@ * Controller on wich the rights are applied | ||
*/ | ||
getStrategies(options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<Array<string>>; | ||
getStrategies(options?: ArgsAuthControllerGetStrategies): Promise<Array<string>>; | ||
/** | ||
@@ -306,6 +268,3 @@ * Send login request to kuzzle with credentials | ||
*/ | ||
updateMyCredentials(strategy: string, credentials: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
updateMyCredentials(strategy: string, credentials: JSONObject, options?: ArgsAuthControllerUpdateMyCredentials): Promise<JSONObject>; | ||
/** | ||
@@ -324,6 +283,3 @@ * Update current user in Kuzzle. | ||
*/ | ||
updateSelf(content: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<User>; | ||
updateSelf(content: JSONObject, options?: ArgsAuthControllerUpdateSelf): Promise<User>; | ||
/** | ||
@@ -340,6 +296,3 @@ * Validate credentials of the specified strategy for the current user. | ||
*/ | ||
validateMyCredentials(strategy: string, credentials: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
validateMyCredentials(strategy: string, credentials: JSONObject, options?: ArgsAuthControllerValidateMyCredentials): Promise<boolean>; | ||
/** | ||
@@ -357,7 +310,3 @@ * Refresh the SDK current authentication token | ||
*/ | ||
refreshToken(options?: { | ||
queuable?: boolean; | ||
expiresIn?: number | string; | ||
timeout?: number; | ||
}): Promise<{ | ||
refreshToken(options?: ArgsAuthControllerRefreshToken): Promise<{ | ||
/** | ||
@@ -381,1 +330,41 @@ * Token unique ID | ||
} | ||
export interface ArgsAuthControllerCreateApiKey extends ArgsDefault { | ||
_id?: string; | ||
expiresIn?: number; | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsAuthControllerCheckRights extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerDeleteApiKey extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsAuthControllerSearchApiKeys extends ArgsDefault { | ||
from?: number; | ||
size?: number; | ||
lang?: string; | ||
} | ||
export interface ArgsAuthControllerCheckToken extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerCreateMyCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerCredentialsExist extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerDeleteMyCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerGetCurrentUser extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerGetMyCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerGetMyRights extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerGetStrategies extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerUpdateMyCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerUpdateSelf extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerValidateMyCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsAuthControllerRefreshToken extends ArgsDefault { | ||
expiresIn?: number | string; | ||
} |
@@ -81,3 +81,3 @@ "use strict"; | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(response => response.result); | ||
@@ -118,3 +118,3 @@ } | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(() => null); | ||
@@ -143,3 +143,3 @@ } | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(response => response.result); | ||
@@ -146,0 +146,0 @@ } |
import { BaseController } from './Base'; | ||
import { JSONObject } from '../types'; | ||
import { JSONObject, ArgsDefault } from '../types'; | ||
export declare class BulkController extends BaseController { | ||
@@ -23,7 +23,3 @@ constructor(kuzzle: any); | ||
*/ | ||
deleteByQuery(index: string, collection: string, query?: JSONObject, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<number>; | ||
deleteByQuery(index: string, collection: string, query?: JSONObject, options?: ArgsBulkControllerDeleteByQuery): Promise<number>; | ||
/** | ||
@@ -43,6 +39,3 @@ * Creates, updates or deletes large amounts of documents as fast as possible. | ||
*/ | ||
import(index: string, collection: string, bulkData: Array<JSONObject>, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<{ | ||
import(index: string, collection: string, bulkData: Array<JSONObject>, options?: ArgsBulkControllerImport): Promise<{ | ||
/** | ||
@@ -108,6 +101,3 @@ * Array of successfully executed actions | ||
*/ | ||
updateByQuery(index: string, collection: string, query: JSONObject, changes: JSONObject, options?: { | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<number>; | ||
updateByQuery(index: string, collection: string, query: JSONObject, changes: JSONObject, options?: ArgsBulkControllerUpdateByQuery): Promise<number>; | ||
/** | ||
@@ -130,8 +120,3 @@ * Creates or replaces a document directly into the storage engine. | ||
*/ | ||
write(index: string, collection: string, document: JSONObject, id?: string, options?: { | ||
queuable?: boolean; | ||
notify?: boolean; | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
write(index: string, collection: string, document: JSONObject, id?: string, options?: ArgsBulkControllerWrite): Promise<Document>; | ||
/** | ||
@@ -162,8 +147,3 @@ * Creates or replaces multiple documents directly into the storage engine. | ||
_source: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
notify?: boolean; | ||
refresh?: 'wait_for'; | ||
timeout?: number; | ||
}): Promise<{ | ||
}>, options?: ArgsBulkControllerMWrite): Promise<{ | ||
/** | ||
@@ -192,1 +172,17 @@ * Array of successfully created/replaced documents | ||
} | ||
export interface ArgsBulkControllerDeleteByQuery extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsBulkControllerImport extends ArgsDefault { | ||
} | ||
export interface ArgsBulkControllerUpdateByQuery extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsBulkControllerWrite extends ArgsDefault { | ||
notify?: boolean; | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsBulkControllerMWrite extends ArgsDefault { | ||
notify?: boolean; | ||
refresh?: 'wait_for'; | ||
} |
import { BaseController } from './Base'; | ||
import { SpecificationsSearchResult } from '../core/searchResult/Specifications'; | ||
import { CollectionMappings, JSONObject } from '../types'; | ||
import { CollectionMappings, JSONObject, ArgsDefault } from '../types'; | ||
export declare class CollectionController extends BaseController { | ||
@@ -30,6 +30,3 @@ constructor(kuzzle: any); | ||
settings?: JSONObject; | ||
} | CollectionMappings, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
} | CollectionMappings, options?: ArgsCollectionControllerCreate): Promise<void>; | ||
/** | ||
@@ -46,6 +43,3 @@ * Deletes validation specifications for a collection. | ||
*/ | ||
deleteSpecifications(index: string, collection: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
deleteSpecifications(index: string, collection: string, options?: ArgsCollectionControllerDeleteSpecifications): Promise<void>; | ||
/** | ||
@@ -62,6 +56,3 @@ * Checks if a collection exists in Kuzzle. | ||
*/ | ||
exists(index: string, collection: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
exists(index: string, collection: string, options?: ArgsCollectionControllerExists): Promise<boolean>; | ||
/** | ||
@@ -79,6 +70,3 @@ * Refreshes a collection to reindex the writed and deleted documents | ||
*/ | ||
refresh(index: string, collection: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
refresh(index: string, collection: string, options?: ArgsCollectionControllerRefresh): Promise<void>; | ||
/** | ||
@@ -96,7 +84,3 @@ * Returns the collection mapping. | ||
*/ | ||
getMapping(index: string, collection: string, options?: { | ||
includeKuzzleMeta?: boolean; | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<CollectionMappings>; | ||
getMapping(index: string, collection: string, options?: ArgsCollectionControllerGetMapping): Promise<CollectionMappings>; | ||
/** | ||
@@ -115,6 +99,3 @@ * Returns the validation specifications associated to the given index and collection. | ||
*/ | ||
getSpecifications(index: string, collection: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
getSpecifications(index: string, collection: string, options?: ArgsCollectionControllerGetSpecifications): Promise<JSONObject>; | ||
/** | ||
@@ -132,15 +113,4 @@ * Returns the list of collections associated to a provided index. | ||
*/ | ||
list(index: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
list(index: string, options?: ArgsCollectionControllerList): Promise<{ | ||
/** | ||
* @deprecated | ||
*/ | ||
from?: number; | ||
/** | ||
* @deprecated | ||
*/ | ||
size?: number; | ||
}): Promise<{ | ||
/** | ||
* Types of returned collections. | ||
@@ -176,9 +146,3 @@ */ | ||
*/ | ||
searchSpecifications(query?: JSONObject, options?: { | ||
queuable?: boolean; | ||
from?: number; | ||
size?: number; | ||
scroll?: string; | ||
timeout?: number; | ||
}): Promise<SpecificationsSearchResult>; | ||
searchSpecifications(query?: JSONObject, options?: ArgsCollectionControllerSearchSpecifications): Promise<SpecificationsSearchResult>; | ||
/** | ||
@@ -195,6 +159,3 @@ * Removes all documents from a collection, while keeping the associated mappings. | ||
*/ | ||
truncate(index: string, collection: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
truncate(index: string, collection: string, options?: ArgsCollectionControllerTruncate): Promise<void>; | ||
/** | ||
@@ -224,12 +185,7 @@ * Updates a collection informations | ||
settings?: JSONObject; | ||
} | CollectionMappings, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
} | CollectionMappings, options?: ArgsCollectionControllerUpdate): Promise<void>; | ||
/** | ||
* @deprecated Use collection.update instead | ||
*/ | ||
updateMapping(index: string, collection: string, mappings: CollectionMappings, options?: { | ||
queuable?: boolean; | ||
}): Promise<JSONObject>; | ||
updateMapping(index: string, collection: string, mappings: CollectionMappings, options?: ArgsCollectionControllerUpdateMapping): Promise<JSONObject>; | ||
/** | ||
@@ -249,6 +205,3 @@ * Create or updates the validation specifications for a collection. | ||
*/ | ||
updateSpecifications(index: string, collection: string, specifications: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
updateSpecifications(index: string, collection: string, specifications: JSONObject, options?: ArgsCollectionControllerUpdateSpecifications): Promise<JSONObject>; | ||
/** | ||
@@ -269,6 +222,3 @@ * Checks if a validation specification is well formatted. | ||
*/ | ||
validateSpecifications(index: string, collection: string, specifications: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<{ | ||
validateSpecifications(index: string, collection: string, specifications: JSONObject, options?: ArgsCollectionControllerValidateSpecifications): Promise<{ | ||
valid: boolean; | ||
@@ -288,5 +238,37 @@ details: Array<string>; | ||
*/ | ||
delete(index: string, collection: string, options?: { | ||
timeout?: number; | ||
}): Promise<void>; | ||
delete(index: string, collection: string, options?: ArgsCollectionControllerDelete): Promise<void>; | ||
} | ||
export interface ArgsCollectionControllerCreate extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerDeleteSpecifications extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerExists extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerRefresh extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerGetMapping extends ArgsDefault { | ||
includeKuzzleMeta?: boolean; | ||
} | ||
export interface ArgsCollectionControllerGetSpecifications extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerList extends ArgsDefault { | ||
from?: number; | ||
size?: number; | ||
} | ||
export interface ArgsCollectionControllerSearchSpecifications extends ArgsDefault { | ||
from?: number; | ||
size?: number; | ||
scroll?: string; | ||
} | ||
export interface ArgsCollectionControllerTruncate extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerUpdate extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerUpdateMapping extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerUpdateSpecifications extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerValidateSpecifications extends ArgsDefault { | ||
} | ||
export interface ArgsCollectionControllerDelete extends ArgsDefault { | ||
} |
import { BaseController } from './Base'; | ||
import { SearchResult } from '../core/searchResult/SearchResultBase'; | ||
import { JSONObject, Document, DocumentHit } from '../types'; | ||
import { JSONObject, Document, DocumentHit, ArgsDefault } from '../types'; | ||
export declare class DocumentController extends BaseController { | ||
@@ -23,6 +23,3 @@ constructor(kuzzle: any); | ||
*/ | ||
count(index: string, collection: string, body?: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<number>; | ||
count(index: string, collection: string, body?: JSONObject, options?: ArgsDocumentControllerCount): Promise<number>; | ||
/** | ||
@@ -45,8 +42,3 @@ * Creates a new document in the persistent data storage. | ||
*/ | ||
create(index: string, collection: string, content: JSONObject, _id?: string, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
create(index: string, collection: string, content: JSONObject, _id?: string, options?: ArgsDocumentControllerCreate): Promise<Document>; | ||
/** | ||
@@ -70,8 +62,3 @@ * Creates a new document in the persistent data storage, | ||
*/ | ||
createOrReplace(index: string, collection: string, _id: string, content: JSONObject, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
createOrReplace(index: string, collection: string, _id: string, content: JSONObject, options?: ArgsDocumentControllerCreateOrReplace): Promise<Document>; | ||
/** | ||
@@ -93,8 +80,3 @@ * Deletes a document. | ||
*/ | ||
delete(index: string, collection: string, _id: string, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<number>; | ||
delete(index: string, collection: string, _id: string, options?: ArgsDocumentControllerDelete): Promise<number>; | ||
/** | ||
@@ -117,9 +99,3 @@ * Deletes documents matching the provided search query. | ||
*/ | ||
deleteByQuery(index: string, collection: string, query?: JSONObject, options?: { | ||
queuable?: boolean; | ||
refresh?: string; | ||
silent?: boolean; | ||
lang?: string; | ||
timeout?: number; | ||
}): Promise<Array<string>>; | ||
deleteByQuery(index: string, collection: string, query?: JSONObject, options?: ArgsDocumentControllerDeleteByQuery): Promise<Array<string>>; | ||
/** | ||
@@ -142,9 +118,3 @@ * Deletes fields of an existing document. | ||
*/ | ||
deleteFields(index: string, collection: string, _id: string, fields: string[], options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
source?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
deleteFields(index: string, collection: string, _id: string, fields: string[], options?: ArgsDocumentControllerDeleteFields): Promise<Document>; | ||
/** | ||
@@ -166,8 +136,3 @@ * Checks if the given document exists. | ||
*/ | ||
exists(index: string, collection: string, _id: string, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
exists(index: string, collection: string, _id: string, options?: ArgsDocumentControllerExists): Promise<boolean>; | ||
/** | ||
@@ -189,8 +154,3 @@ * Gets a document. | ||
*/ | ||
get(index: string, collection: string, _id: string, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
get(index: string, collection: string, _id: string, options?: ArgsDocumentControllerGet): Promise<Document>; | ||
/** | ||
@@ -222,9 +182,3 @@ * Creates multiple documents. | ||
body: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
}>, options?: ArgsDocumentControllerMCreate): Promise<{ | ||
/** | ||
@@ -278,9 +232,3 @@ * Array of successfully created documents | ||
body: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
}>, options?: ArgsDocumentControllerMCreateOrReplace): Promise<{ | ||
/** | ||
@@ -325,9 +273,3 @@ * Array of successfully created documents | ||
*/ | ||
mDelete(index: string, collection: string, ids: Array<string>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
mDelete(index: string, collection: string, ids: Array<string>, options?: ArgsDocumentControllerMDelete): Promise<{ | ||
/** | ||
@@ -366,7 +308,3 @@ * Array of successfully deleted documents IDS | ||
*/ | ||
mGet(index: string, collection: string, ids: Array<string>, options?: { | ||
queuable?: boolean; | ||
verb?: string; | ||
timeout?: number; | ||
}): Promise<{ | ||
mGet(index: string, collection: string, ids: Array<string>, options?: ArgsDocumentControllerMGet): Promise<{ | ||
/** | ||
@@ -407,9 +345,3 @@ * Array of successfully retrieved documents | ||
body: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
}>, options?: ArgsDocumentControllerMReplace): Promise<{ | ||
/** | ||
@@ -467,10 +399,3 @@ * Array of successfully replaced documents | ||
body: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
timeout?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
}>, options?: ArgsDocumentControllerMUpdate): Promise<{ | ||
/** | ||
@@ -529,9 +454,3 @@ * Array of successfully updated documents | ||
default: JSONObject; | ||
}>, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
strict?: boolean; | ||
}): Promise<{ | ||
}>, options?: ArgsDocumentControllerMUpsert): Promise<{ | ||
/** | ||
@@ -576,8 +495,3 @@ * Array of successfully updated documents | ||
*/ | ||
replace(index: string, collection: string, _id: string, content: JSONObject, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
replace(index: string, collection: string, _id: string, content: JSONObject, options?: ArgsDocumentControllerReplace): Promise<Document>; | ||
/** | ||
@@ -590,3 +504,3 @@ * Searches documents. | ||
* @param collection Collection name | ||
* @param query Search query | ||
* @param searchBody Search query | ||
* @param options Additional options | ||
@@ -602,11 +516,3 @@ * - `queuable` If true, queues the request during downtime, until connected to Kuzzle again | ||
*/ | ||
search(index: string, collection: string, query?: JSONObject, options?: { | ||
queuable?: boolean; | ||
from?: number; | ||
size?: number; | ||
scroll?: string; | ||
lang?: string; | ||
verb?: string; | ||
timeout?: number; | ||
}): Promise<SearchResult<DocumentHit>>; | ||
search(index: string, collection: string, searchBody?: JSONObject, options?: ArgsDocumentControllerSearch): Promise<SearchResult<DocumentHit>>; | ||
private _search; | ||
@@ -632,10 +538,3 @@ /** | ||
*/ | ||
update(index: string, collection: string, _id: string, content: JSONObject, options?: { | ||
queuable?: boolean; | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
source?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
update(index: string, collection: string, _id: string, content: JSONObject, options?: ArgsDocumentControllerUpdate): Promise<Document>; | ||
/** | ||
@@ -659,9 +558,3 @@ * Updates documents matching the provided search query. | ||
*/ | ||
updateByQuery(index: string, collection: string, query: JSONObject, changes: JSONObject, options?: { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
source?: boolean; | ||
lang?: string; | ||
timeout?: number; | ||
}): Promise<{ | ||
updateByQuery(index: string, collection: string, query: JSONObject, changes: JSONObject, options?: ArgsDocumentControllerUpdateByQuery): Promise<{ | ||
/** | ||
@@ -707,10 +600,3 @@ * Array of successfully updated documents | ||
*/ | ||
upsert(index: string, collection: string, _id: string, changes: JSONObject, options?: { | ||
default?: JSONObject; | ||
refresh?: string; | ||
silent?: boolean; | ||
retryOnConflict?: boolean; | ||
source?: boolean; | ||
timeout?: number; | ||
}): Promise<Document>; | ||
upsert(index: string, collection: string, _id: string, changes: JSONObject, options?: ArgsDocumentControllerUpsert): Promise<Document>; | ||
/** | ||
@@ -730,6 +616,102 @@ * Validates a document against existing validation rules. | ||
*/ | ||
validate(index: string, collection: string, content: JSONObject, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
validate(index: string, collection: string, content: JSONObject, options?: ArgsDocumentControllerValidate): Promise<boolean>; | ||
} | ||
export interface ArgsDocumentControllerCount extends ArgsDefault { | ||
} | ||
export interface ArgsDocumentControllerCreate extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerCreateOrReplace extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerDelete extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerDeleteByQuery extends ArgsDefault { | ||
refresh?: string; | ||
silent?: boolean; | ||
lang?: string; | ||
} | ||
export interface ArgsDocumentControllerDeleteFields extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
source?: boolean; | ||
} | ||
export interface ArgsDocumentControllerExists extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerGet extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMCreate extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMCreateOrReplace extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMDelete extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMGet extends ArgsDefault { | ||
verb?: string; | ||
} | ||
export interface ArgsDocumentControllerMReplace extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMUpdate extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerMUpsert extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
strict?: boolean; | ||
} | ||
export interface ArgsDocumentControllerReplace extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
} | ||
export interface ArgsDocumentControllerSearch extends ArgsDefault { | ||
from?: number; | ||
size?: number; | ||
scroll?: string; | ||
lang?: string; | ||
verb?: string; | ||
} | ||
export interface ArgsDocumentControllerUpdate extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
retryOnConflict?: number; | ||
source?: boolean; | ||
} | ||
export interface ArgsDocumentControllerUpdateByQuery extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
silent?: boolean; | ||
source?: boolean; | ||
lang?: string; | ||
} | ||
export interface ArgsDocumentControllerUpsert extends ArgsDefault { | ||
default?: JSONObject; | ||
refresh?: string; | ||
silent?: boolean; | ||
retryOnConflict?: boolean; | ||
source?: boolean; | ||
} | ||
export interface ArgsDocumentControllerValidate extends ArgsDefault { | ||
} |
@@ -474,3 +474,3 @@ "use strict"; | ||
* @param collection Collection name | ||
* @param query Search query | ||
* @param searchBody Search query | ||
* @param options Additional options | ||
@@ -486,4 +486,4 @@ * - `queuable` If true, queues the request during downtime, until connected to Kuzzle again | ||
*/ | ||
search(index, collection, query = {}, options = {}) { | ||
return this._search(index, collection, query, options) | ||
search(index, collection, searchBody = {}, options = {}) { | ||
return this._search(index, collection, searchBody, options) | ||
.then(({ response, request, opts }) => (new Document_1.DocumentSearchResult(this.kuzzle, request, opts, response.result))); | ||
@@ -490,0 +490,0 @@ } |
import { BaseController } from './Base'; | ||
import { JSONObject } from '../types'; | ||
import { JSONObject, ArgsDefault } from '../types'; | ||
export declare class IndexController extends BaseController { | ||
@@ -15,6 +15,3 @@ constructor(kuzzle: any); | ||
*/ | ||
create(index: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
create(index: string, options?: ArgsIndexControllerCreate): Promise<void>; | ||
/** | ||
@@ -30,6 +27,3 @@ * Deletes an index | ||
*/ | ||
delete(index: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
delete(index: string, options?: ArgsIndexControllerDelete): Promise<void>; | ||
/** | ||
@@ -45,6 +39,3 @@ * Checks if the given index exists. | ||
*/ | ||
exists(index: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
exists(index: string, options?: ArgsIndexControllerExists): Promise<boolean>; | ||
/** | ||
@@ -59,6 +50,3 @@ * Returns the complete list of indexes. | ||
*/ | ||
list(options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<Array<string>>; | ||
list(options?: ArgsIndexControllerList): Promise<Array<string>>; | ||
/** | ||
@@ -76,6 +64,3 @@ * Deletes multiple indexes | ||
*/ | ||
mDelete(indexes: Array<string>, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<Array<string>>; | ||
mDelete(indexes: Array<string>, options?: ArgsIndexControllerMDelete): Promise<Array<string>>; | ||
/** | ||
@@ -90,6 +75,15 @@ * Returns detailed storage usage statistics. | ||
*/ | ||
stats(options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<JSONObject>; | ||
stats(options?: ArgsIndexControllerStats): Promise<JSONObject>; | ||
} | ||
export interface ArgsIndexControllerCreate extends ArgsDefault { | ||
} | ||
export interface ArgsIndexControllerDelete extends ArgsDefault { | ||
} | ||
export interface ArgsIndexControllerExists extends ArgsDefault { | ||
} | ||
export interface ArgsIndexControllerList extends ArgsDefault { | ||
} | ||
export interface ArgsIndexControllerMDelete extends ArgsDefault { | ||
} | ||
export interface ArgsIndexControllerStats extends ArgsDefault { | ||
} |
import { BaseController } from './Base'; | ||
import { Notification, JSONObject } from '../types'; | ||
import { Notification, JSONObject, ArgsDefault } from '../types'; | ||
/** | ||
@@ -61,6 +61,3 @@ * Enum for `scope` option of realtime.subscribe method | ||
*/ | ||
count(roomId: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<number>; | ||
count(roomId: string, options?: ArgsRealtimeControllerCount): Promise<number>; | ||
/** | ||
@@ -82,7 +79,3 @@ * Sends a real-time message to Kuzzle. | ||
*/ | ||
publish(index: string, collection: string, message: JSONObject, options?: { | ||
queuable?: boolean; | ||
_id?: string; | ||
timeout?: number; | ||
}): Promise<boolean>; | ||
publish(index: string, collection: string, message: JSONObject, options?: ArgsRealtimeControllerPublish): Promise<boolean>; | ||
/** | ||
@@ -109,21 +102,3 @@ * Subscribes by providing a set of filters: messages, document changes | ||
*/ | ||
subscribe(index: string, collection: string, filters: JSONObject, callback: (notification: Notification) => void | Promise<void>, options?: { | ||
/** | ||
* Subscribe to document entering or leaving the scope. (default: 'all') | ||
*/ | ||
scope?: ScopeOption; | ||
/** | ||
* Subscribe to users entering or leaving the room. (default: 'none') | ||
*/ | ||
users?: UserOption; | ||
/** | ||
* Subscribe to notifications fired by our own queries. (default: true) | ||
*/ | ||
subscribeToSelf?: boolean; | ||
/** | ||
* Subscription information sent alongside notifications | ||
*/ | ||
volatile?: JSONObject; | ||
timeout?: number; | ||
}): Promise<string>; | ||
subscribe(index: string, collection: string, filters: JSONObject, callback: (notification: Notification) => void | Promise<void>, options?: ArgsRealtimeControllerSubscribe): Promise<string>; | ||
/** | ||
@@ -137,6 +112,3 @@ * Removes a subscription | ||
*/ | ||
unsubscribe(roomId: string, options?: { | ||
queuable?: boolean; | ||
timeout?: number; | ||
}): Promise<void>; | ||
unsubscribe(roomId: string, options?: ArgsRealtimeControllerUnsubscribe): Promise<void>; | ||
/** | ||
@@ -155,1 +127,14 @@ * Called when kuzzle is disconnected | ||
} | ||
export interface ArgsRealtimeControllerCount extends ArgsDefault { | ||
} | ||
export interface ArgsRealtimeControllerPublish extends ArgsDefault { | ||
_id?: string; | ||
} | ||
export interface ArgsRealtimeControllerSubscribe extends ArgsDefault { | ||
scope?: ScopeOption; | ||
users?: UserOption; | ||
subscribeToSelf?: boolean; | ||
volatile?: JSONObject; | ||
} | ||
export interface ArgsRealtimeControllerUnsubscribe extends ArgsDefault { | ||
} |
@@ -8,2 +8,3 @@ import { BaseController } from './Base'; | ||
import { UserSearchResult } from '../core/searchResult/User'; | ||
import { ArgsDefault } from '../types'; | ||
export declare class SecurityController extends BaseController { | ||
@@ -23,7 +24,3 @@ /** | ||
*/ | ||
createApiKey(userId: any, description: any, options?: { | ||
expiresIn?: string | number; | ||
_id?: string; | ||
refresh?: 'wait_for'; | ||
}): Promise<any>; | ||
createApiKey(userId: any, description: any, options?: ArgsSecurityControllerCreateApiKey): Promise<any>; | ||
/** | ||
@@ -35,3 +32,3 @@ * Checks if an API action can be executed by a user | ||
*/ | ||
checkRights(kuid: any, requestPayload: any): Promise<any>; | ||
checkRights(kuid: any, requestPayload: any, options: ArgsSecurityControllerCheckRights): Promise<any>; | ||
/** | ||
@@ -46,5 +43,3 @@ * Deletes an user API key. | ||
*/ | ||
deleteApiKey(userId: any, id: any, options?: { | ||
refresh?: 'wait_for'; | ||
}): Promise<import("../types").JSONObject>; | ||
deleteApiKey(userId: any, id: any, options?: ArgsSecurityControllerDeleteApiKey): Promise<import("../types").JSONObject>; | ||
/** | ||
@@ -59,60 +54,155 @@ * Searches for a user API key. | ||
*/ | ||
searchApiKeys(userId: any, query?: {}, options?: { | ||
from?: number; | ||
size?: number; | ||
lang?: string; | ||
}): Promise<any>; | ||
createCredentials(strategy: any, _id: any, body: any, options?: {}): Promise<any>; | ||
createFirstAdmin(_id: any, body: any, options?: { | ||
reset?: boolean; | ||
}): Promise<User>; | ||
createOrReplaceProfile(_id: any, body: any, options?: {}): Promise<Profile>; | ||
createOrReplaceRole(_id: any, body: any, options?: { | ||
force?: boolean; | ||
}): Promise<Role>; | ||
createProfile(_id: any, body: any, options?: {}): Promise<Profile>; | ||
createRestrictedUser(body: any, _id?: any, options?: {}): Promise<User>; | ||
createRole(_id: any, body: any, options?: { | ||
force?: boolean; | ||
}): Promise<Role>; | ||
createUser(_id: any, body: any, options?: {}): Promise<User>; | ||
deleteCredentials(strategy: any, _id: any, options?: {}): Promise<any>; | ||
deleteProfile(_id: any, options?: {}): Promise<any>; | ||
deleteRole(_id: any, options?: {}): Promise<any>; | ||
deleteUser(_id: any, options?: {}): Promise<any>; | ||
getAllCredentialFields(options?: {}): Promise<any>; | ||
getCredentialFields(strategy: any, options?: {}): Promise<any>; | ||
getCredentials(strategy: any, _id: any, options?: {}): Promise<any>; | ||
getCredentialsById(strategy: any, _id: any, options?: {}): Promise<any>; | ||
getProfile(_id: any, options?: {}): Promise<Profile>; | ||
getProfileMapping(options?: {}): Promise<any>; | ||
getProfileRights(_id: any, options?: {}): Promise<any>; | ||
getRole(_id: any, options?: {}): Promise<Role>; | ||
getRoleMapping(options?: {}): Promise<any>; | ||
getUser(_id: any, options?: {}): Promise<User>; | ||
getUserMapping(options?: {}): Promise<any>; | ||
getUserRights(_id: any, options?: {}): Promise<any>; | ||
getUserStrategies(_id: any, options?: {}): Promise<any>; | ||
hasCredentials(strategy: any, _id: any, options?: {}): Promise<any>; | ||
mDeleteProfiles(ids: any, options?: {}): Promise<any>; | ||
mDeleteRoles(ids: any, options?: {}): Promise<any>; | ||
mDeleteUsers(ids: any, options?: {}): Promise<any>; | ||
mGetProfiles(ids: any, options?: {}): Promise<any>; | ||
mGetUsers(ids: any, options?: {}): Promise<any>; | ||
mGetRoles(ids: any, options?: {}): Promise<any>; | ||
searchApiKeys(userId: any, query?: {}, options?: ArgsSecurityControllerSearchApiKeys): Promise<any>; | ||
createCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerCreateCredentials): Promise<any>; | ||
createFirstAdmin(_id: any, body: any, options?: ArgsSecurityControllerCreateFirstAdmin): Promise<User>; | ||
createOrReplaceProfile(_id: any, body: any, options?: ArgsSecurityControllerCreateOrReplaceProfile): Promise<Profile>; | ||
createOrReplaceRole(_id: any, body: any, options?: ArgsSecurityControllerCreateOrReplaceRole): Promise<Role>; | ||
createProfile(_id: any, body: any, options?: ArgsSecurityControllerCreateProfile): Promise<Profile>; | ||
createRestrictedUser(body: any, _id?: any, options?: ArgsSecurityControllerCreateRestrictedUser): Promise<User>; | ||
createRole(_id: any, body: any, options?: ArgsSecurityControllerCreateRole): Promise<Role>; | ||
createUser(_id: any, body: any, options?: ArgsSecurityControllerCreateUser): Promise<User>; | ||
deleteCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerDeleteCredentials): Promise<any>; | ||
deleteProfile(_id: any, options?: ArgsSecurityControllerDeleteProfile): Promise<any>; | ||
deleteRole(_id: any, options?: ArgsSecurityControllerDeleteRole): Promise<any>; | ||
deleteUser(_id: any, options?: ArgsSecurityControllerDeleteUser): Promise<any>; | ||
getAllCredentialFields(options?: ArgsSecurityControllerGetAllCredentialFields): Promise<any>; | ||
getCredentialFields(strategy: any, options?: ArgsSecurityControllerGetCredentialFields): Promise<any>; | ||
getCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerGetCredentials): Promise<any>; | ||
getCredentialsById(strategy: any, _id: any, options?: ArgsSecurityControllerGetCredentialsById): Promise<any>; | ||
getProfile(_id: any, options?: ArgsSecurityControllerGetProfile): Promise<Profile>; | ||
getProfileMapping(options?: ArgsSecurityControllerGetProfileMapping): Promise<any>; | ||
getProfileRights(_id: any, options?: ArgsSecurityControllerGetProfileRights): Promise<any>; | ||
getRole(_id: any, options?: ArgsSecurityControllerGetRole): Promise<Role>; | ||
getRoleMapping(options?: ArgsSecurityControllerGetRoleMapping): Promise<any>; | ||
getUser(_id: any, options?: ArgsSecurityControllerGetUser): Promise<User>; | ||
getUserMapping(options?: ArgsSecurityControllerGetUserMapping): Promise<any>; | ||
getUserRights(_id: any, options?: ArgsSecurityControllerGetUserRights): Promise<any>; | ||
getUserStrategies(_id: any, options?: ArgsSecurityControllerGetUserStrategies): Promise<any>; | ||
hasCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerHasCredentials): Promise<any>; | ||
mDeleteProfiles(ids: any, options?: ArgsSecurityControllerMDeleteProfiles): Promise<any>; | ||
mDeleteRoles(ids: any, options?: ArgsSecurityControllerMDeleteRoles): Promise<any>; | ||
mDeleteUsers(ids: any, options?: ArgsSecurityControllerMDeleteUsers): Promise<any>; | ||
mGetProfiles(ids: any, options?: ArgsSecurityControllerMGetProfiles): Promise<any>; | ||
mGetUsers(ids: any, options?: ArgsSecurityControllerMGetUsers): Promise<any>; | ||
mGetRoles(ids: any, options?: ArgsSecurityControllerMGetRoles): Promise<any>; | ||
refresh(collection: any): Promise<import("../types").JSONObject>; | ||
replaceUser(_id: any, body: any, options?: {}): Promise<User>; | ||
searchProfiles(body: any, options?: {}): Promise<ProfileSearchResult>; | ||
searchRoles(body: any, options?: {}): Promise<RoleSearchResult>; | ||
searchUsers(body: any, options?: {}): Promise<UserSearchResult>; | ||
updateCredentials(strategy: any, _id: any, body: any, options?: {}): Promise<any>; | ||
updateProfile(_id: any, body: any, options?: {}): Promise<Profile>; | ||
updateProfileMapping(body: any, options?: {}): Promise<any>; | ||
updateRole(_id: any, body: any, options?: { | ||
force?: boolean; | ||
}): Promise<Role>; | ||
updateRoleMapping(body: any, options?: {}): Promise<any>; | ||
updateUser(_id: any, body: any, options?: {}): Promise<User>; | ||
updateUserMapping(body: any, options?: {}): Promise<any>; | ||
validateCredentials(strategy: any, _id: any, body: any, options?: {}): Promise<any>; | ||
replaceUser(_id: any, body: any, options?: ArgsSecurityControllerReplaceUser): Promise<User>; | ||
searchProfiles(body: any, options?: ArgsSecurityControllerSearchProfiles): Promise<ProfileSearchResult>; | ||
searchRoles(body: any, options?: ArgsSecurityControllerSearchRoles): Promise<RoleSearchResult>; | ||
searchUsers(body: any, options?: ArgsSecurityControllerSearchUsers): Promise<UserSearchResult>; | ||
updateCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerUpdateCredentials): Promise<any>; | ||
updateProfile(_id: any, body: any, options?: ArgsSecurityControllerUpdateProfile): Promise<Profile>; | ||
updateProfileMapping(body: any, options?: ArgsSecurityControllerUpdateProfileMapping): Promise<any>; | ||
updateRole(_id: any, body: any, options?: ArgsSecurityControllerUpdateRole): Promise<Role>; | ||
updateRoleMapping(body: any, options?: ArgsSecurityControllerUpdateRoleMapping): Promise<any>; | ||
updateUser(_id: any, body: any, options?: ArgsSecurityControllerUpdateUser): Promise<User>; | ||
updateUserMapping(body: any, options?: ArgsSecurityControllerUpdateUserMapping): Promise<any>; | ||
validateCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerValidateCredentials): Promise<any>; | ||
} | ||
export interface ArgsSecurityControllerCreateApiKey extends ArgsDefault { | ||
expiresIn?: string | number; | ||
_id?: string; | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsSecurityControllerCheckRights extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerDeleteApiKey extends ArgsDefault { | ||
refresh?: 'wait_for'; | ||
} | ||
export interface ArgsSecurityControllerSearchApiKeys extends ArgsDefault { | ||
from?: number; | ||
size?: number; | ||
lang?: string; | ||
} | ||
export interface ArgsSecurityControllerCreateCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerCreateFirstAdmin extends ArgsDefault { | ||
reset?: boolean; | ||
} | ||
export interface ArgsSecurityControllerCreateOrReplaceProfile extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerCreateOrReplaceRole extends ArgsDefault { | ||
force?: boolean; | ||
} | ||
export interface ArgsSecurityControllerCreateProfile extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerCreateRestrictedUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerCreateRole extends ArgsDefault { | ||
force?: boolean; | ||
} | ||
export interface ArgsSecurityControllerCreateUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerDeleteCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerDeleteProfile extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerDeleteRole extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerDeleteUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetAllCredentialFields extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetCredentialFields extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetCredentialsById extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetProfile extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetProfileMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetProfileRights extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetRole extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetRoleMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetUserMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetUserRights extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerGetUserStrategies extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerHasCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMDeleteProfiles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMDeleteRoles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMDeleteUsers extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMGetProfiles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMGetUsers extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerMGetRoles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerReplaceUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerSearchProfiles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerSearchRoles extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerSearchUsers extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateCredentials extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateProfile extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateProfileMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateRole extends ArgsDefault { | ||
force?: boolean; | ||
} | ||
export interface ArgsSecurityControllerUpdateRoleMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateUser extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerUpdateUserMapping extends ArgsDefault { | ||
} | ||
export interface ArgsSecurityControllerValidateCredentials extends ArgsDefault { | ||
} |
@@ -38,3 +38,3 @@ "use strict"; | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(response => response.result); | ||
@@ -48,3 +48,3 @@ } | ||
*/ | ||
checkRights(kuid, requestPayload) { | ||
checkRights(kuid, requestPayload, options) { | ||
const request = { | ||
@@ -55,3 +55,3 @@ userId: kuid, | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(response => response.result.allowed); | ||
@@ -75,3 +75,3 @@ } | ||
}; | ||
return this.query(request); | ||
return this.query(request, options); | ||
} | ||
@@ -96,3 +96,3 @@ /** | ||
}; | ||
return this.query(request) | ||
return this.query(request, options) | ||
.then(response => response.result); | ||
@@ -99,0 +99,0 @@ } |
@@ -1,3 +0,5 @@ | ||
const { BaseController } = require('./Base'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ServerController = void 0; | ||
const Base_1 = require("./Base"); | ||
/** | ||
@@ -7,108 +9,99 @@ * @class ServerController | ||
*/ | ||
class ServerController extends BaseController { | ||
/** | ||
* @param {Kuzzle} kuzzle - The Kuzzle SDK Instance | ||
*/ | ||
constructor (kuzzle) { | ||
super(kuzzle, 'server'); | ||
} | ||
/** | ||
* Checks if an administrator user exists | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Boolean>} | ||
*/ | ||
adminExists (options) { | ||
return this.query({ | ||
action: 'adminExists' | ||
}, options) | ||
.then(response => response.result.exists); | ||
} | ||
/** | ||
* Returns all stored statistics frames | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getAllStats (options) { | ||
return this.query({ | ||
action: 'getAllStats' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the Kuzzle configuration | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getConfig (options) { | ||
return this.query({ | ||
action: 'getConfig' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the last statistics frame | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getLastStats (options) { | ||
return this.query({ | ||
action: 'getLastStats' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the statistics frame from a date | ||
* | ||
* @param {Number|String} startTime - begining of statistics frame set (timestamp or datetime format) | ||
* @param {Number|String} stopTime - end of statistics frame set (timestamp or datetime format) | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getStats(startTime, stopTime, options) { | ||
return this.query({ | ||
action: 'getStats', | ||
startTime, | ||
stopTime | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the Kuzzle server information | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
info (options) { | ||
return this.query({ | ||
action: 'info' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Get server's current timestamp | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Number>} | ||
*/ | ||
now (options) { | ||
return this.query({ | ||
action: 'now' | ||
}, options) | ||
.then(response => response.result.now); | ||
} | ||
class ServerController extends Base_1.BaseController { | ||
/** | ||
* @param {Kuzzle} kuzzle - The Kuzzle SDK Instance | ||
*/ | ||
constructor(kuzzle) { | ||
super(kuzzle, 'server'); | ||
} | ||
/** | ||
* Checks if an administrator user exists | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Boolean>} | ||
*/ | ||
adminExists(options) { | ||
return this.query({ | ||
action: 'adminExists' | ||
}, options) | ||
.then(response => response.result.exists); | ||
} | ||
/** | ||
* Returns all stored statistics frames | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getAllStats(options) { | ||
return this.query({ | ||
action: 'getAllStats' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the Kuzzle configuration | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getConfig(options) { | ||
return this.query({ | ||
action: 'getConfig' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the last statistics frame | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getLastStats(options) { | ||
return this.query({ | ||
action: 'getLastStats' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the statistics frame from a date | ||
* | ||
* @param {Number|String} startTime - begining of statistics frame set (timestamp or datetime format) | ||
* @param {Number|String} stopTime - end of statistics frame set (timestamp or datetime format) | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
getStats(startTime, stopTime, options) { | ||
return this.query({ | ||
action: 'getStats', | ||
startTime, | ||
stopTime | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Returns the Kuzzle server information | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Object>} | ||
*/ | ||
info(options) { | ||
return this.query({ | ||
action: 'info' | ||
}, options) | ||
.then(response => response.result); | ||
} | ||
/** | ||
* Get server's current timestamp | ||
* | ||
* @param {Object} options - {queuable: Boolean(true)} | ||
* @returns {Promise<Number>} | ||
*/ | ||
now(options) { | ||
return this.query({ | ||
action: 'now' | ||
}, options) | ||
.then(response => response.result.now); | ||
} | ||
} | ||
module.exports = { ServerController }; | ||
exports.ServerController = ServerController; | ||
//# sourceMappingURL=Server.js.map |
@@ -495,2 +495,19 @@ "use strict"; | ||
} | ||
let queuable = true; | ||
if (options && options.queuable === false) { | ||
queuable = false; | ||
} | ||
if (this.queueFilter) { | ||
queuable = queuable && this.queueFilter(request); | ||
} | ||
const requestTimeout = typeof options.timeout === 'number' | ||
? options.timeout | ||
: this._requestTimeout; | ||
for (const [key, value] of Object.entries(options)) { | ||
// Ignore common SDK option | ||
if (['queuable', 'timeout'].includes(key)) { | ||
continue; | ||
} | ||
request[key] = value; | ||
} | ||
if (request.refresh === undefined && options.refresh !== undefined) { | ||
@@ -517,12 +534,2 @@ request.refresh = options.refresh; | ||
this.auth.authenticateRequest(request); | ||
let queuable = true; | ||
if (options && options.queuable === false) { | ||
queuable = false; | ||
} | ||
if (this.queueFilter) { | ||
queuable = queuable && this.queueFilter(request); | ||
} | ||
const requestTimeout = typeof options.timeout === 'number' | ||
? options.timeout | ||
: this._requestTimeout; | ||
if (this._queuing) { | ||
@@ -529,0 +536,0 @@ if (queuable) { |
@@ -9,1 +9,2 @@ export * from './ApiKey'; | ||
export * from './RoleRightsDefinition'; | ||
export * from './ArgsDefault'; |
@@ -21,2 +21,3 @@ "use strict"; | ||
__exportStar(require("./RoleRightsDefinition"), exports); | ||
__exportStar(require("./ArgsDefault"), exports); | ||
//# sourceMappingURL=index.js.map |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
487829
106
11322
31