Skip to content

Commit

Permalink
5.13.1 (#7)
Browse files Browse the repository at this point in the history
* aerospike: export some classes

* existsCommand: metadata support

* policy: export bitwise policy

* status: new status codes

* version: bump version

* record metadata: nullable fields (in case of existsWithMetadata)
  • Loading branch information
bit0r1n authored Nov 12, 2024
1 parent 9aa4002 commit 1380c03
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# aerospike-typings
Since typings in [original repo](https://github.com/aerospike/aerospike-client-nodejs/blob/master/typings/index.d.ts) are kinda messy, like why `export const Client: typeof import("client");`, it results in `object` type?? And there also a lot of any =((

Actual for version 5.12.0
Actual for version 5.13.1

## Installation
1. Install package `npm install https://github.com/bit0r1n/aerospike-typings -D`
Expand Down
22 changes: 15 additions & 7 deletions aerospike.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ declare module "aerospike" {
}

class ExistsCommandBase extends Command {
protected convertResponse(error: AerospikeError): [AerospikeError | null, boolean];
constructor(client: Client, key: IKey, args: any[], callback?: AddonCallback);
protected convertResult(metadata: IRecordMetadata): AerospikeRecord<null>
protected convertResponse(error: AerospikeError, bins: AerospikeBins, metadata: IRecordMetadata): [AerospikeError | null, boolean | AerospikeRecord<null>];
}

class ReadRecordCommand extends Command {
Expand Down Expand Up @@ -558,6 +560,7 @@ declare module "aerospike" {
AEROSPIKE_EXPIRED_PASSWORD,
AEROSPIKE_FORBIDDEN_PASSWORD,
AEROSPIKE_INVALID_CREDENTIAL,
AEROSPIKE_EXPIRED_SESSION,
AEROSPIKE_INVALID_ROLE = 70,
AEROSPIKE_ROLE_ALREADY_EXISTS,
AEROSPIKE_INVALID_PRIVILEGE,
Expand Down Expand Up @@ -755,7 +758,7 @@ declare module "aerospike" {
ttl?: number;
}

class Query {
export class Query {
public client: Client;
public ns: string;
public set: string;
Expand Down Expand Up @@ -1267,6 +1270,7 @@ declare module "aerospike" {
interface IBatchResult<T extends AerospikeBins = AerospikeBins> {
status: Status;
record: AerospikeRecord<T>;
inDoubt: boolean;
}

export class Client extends EventEmitter {
Expand Down Expand Up @@ -1341,6 +1345,7 @@ declare module "aerospike" {
public apply(key: IKey, udfArgs: IAddonUDF, policy: IApplyPolicyProps, callback: AddonCallback): void;
public exists(key: IKey, policy?: IReadPolicyProps): Promise<boolean>;
public exists(key: IKey, policy: IReadPolicyProps, callback: TypedCallback<boolean>): void;
public existsWithMetadata(key: IKey, policy: IReadPolicyProps): Promise<AerospikeRecord<null>>;
public get<T extends AerospikeBins = AerospikeBins>(key: IKey, policy?: IReadPolicyProps): Promise<AerospikeRecord<T>>;
public get<T extends AerospikeBins = AerospikeBins>(key: IKey, policy: IReadPolicyProps, callback: TypedCallback<AerospikeRecord<T>>): void;
public indexRemove(namespace: string, index: string, policy?: IInfoPolicyProps): Promise<void>;
Expand Down Expand Up @@ -1560,7 +1565,7 @@ declare module "aerospike" {
interface ISindexInfoEntity {
load_pct: number;
}
class IndexJob extends Job<ISindexInfoEntity> {
export class IndexJob extends Job<ISindexInfoEntity> {
public namespace: string;
public indexName: string;
constructor(client: Client, namespace: string, indexName: string);
Expand All @@ -1573,7 +1578,7 @@ declare module "aerospike" {
status: JobStatus;
}

class Job<T = IJobInfoResponse> {
export class Job<T = IJobInfoResponse> {
public client: Client;
public jobID: number;
public module: string;
Expand Down Expand Up @@ -1613,8 +1618,8 @@ declare module "aerospike" {

// record.js
interface IRecordMetadata {
ttl?: number;
gen?: number;
ttl?: number | null;
gen?: number | null;
}

// record_stream.js
Expand All @@ -1640,7 +1645,7 @@ declare module "aerospike" {
bytes: number[];
}

class Scan {
export class Scan {
public client: Client;
public ns: string;
public set: string;
Expand Down Expand Up @@ -1886,6 +1891,7 @@ declare module "aerospike" {
BatchReadPolicy: typeof BatchReadPolicy;
BatchRemovePolicy: typeof BatchRemovePolicy;
BatchWritePolicy: typeof BatchWritePolicy;
BitwisePolicy: typeof BitwisePolicy;
CommandQueuePolicy: typeof CommandQueuePolicy;
InfoPolicy: typeof InfoPolicy;
AdminPolicy: typeof AdminPolicy;
Expand All @@ -1903,6 +1909,7 @@ declare module "aerospike" {
export interface StatusModule {
ERR_ASYNC_QUEUE_FULL: Status;
ERR_CONNECTION: Status;
ERR_TLS_STATUS: Status;
ERR_INVALID_NODE: Status,
ERR_NO_MORE_CONNECTIONS: Status;
ERR_ASYNC_CONNECTION: Status;
Expand Down Expand Up @@ -1954,6 +1961,7 @@ declare module "aerospike" {
EXPIRED_PASSWORD: Status;
FORBIDDEN_PASSWORD: Status;
INVALID_CREDENTIAL: Status;
EXPIRED_SESSION: Status;
INVALID_ROLE: Status;
ROLE_ALREADY_EXISTS: Status;
INVALID_PRIVILEGE: Status;
Expand Down
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aerospike-typings",
"version": "5.12.0",
"version": "5.13.1",
"description": "More precise typing for aerospike NodeJS client library",
"license": "MIT",
"homepage": "https://github.com/bit0r1n/aerospike-typings",
Expand Down

0 comments on commit 1380c03

Please sign in to comment.