@gomomento/sdk-core 1.88.0 → 1.89.0
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.
- package/dist/src/clients/ICacheClient.d.ts +2 -2
- package/dist/src/clients/ICacheClient.js +1 -1
- package/dist/src/clients/IMomentoCache.d.ts +2 -2
- package/dist/src/clients/IMomentoCache.js +1 -1
- package/dist/src/internal/clients/cache/IDataClient.d.ts +2 -2
- package/dist/src/internal/clients/cache/IDataClient.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-fetch.d.ts +19 -55
- package/dist/src/messages/responses/cache-sorted-set-fetch.js +23 -46
- package/dist/src/messages/responses/cache-sorted-set-get-rank.d.ts +19 -53
- package/dist/src/messages/responses/cache-sorted-set-get-rank.js +22 -39
- package/dist/src/messages/responses/cache-sorted-set-get-score.d.ts +28 -71
- package/dist/src/messages/responses/cache-sorted-set-get-score.js +32 -60
- package/dist/src/messages/responses/cache-sorted-set-get-scores.d.ts +21 -58
- package/dist/src/messages/responses/cache-sorted-set-get-scores.js +29 -52
- package/dist/src/messages/responses/cache-sorted-set-increment-score.d.ts +14 -46
- package/dist/src/messages/responses/cache-sorted-set-increment-score.js +14 -41
- package/dist/src/messages/responses/cache-sorted-set-length-by-score.d.ts +18 -53
- package/dist/src/messages/responses/cache-sorted-set-length-by-score.js +23 -40
- package/dist/src/messages/responses/cache-sorted-set-length.d.ts +19 -53
- package/dist/src/messages/responses/cache-sorted-set-length.js +22 -39
- package/dist/src/messages/responses/cache-sorted-set-put-element.d.ts +10 -43
- package/dist/src/messages/responses/cache-sorted-set-put-element.js +13 -34
- package/dist/src/messages/responses/cache-sorted-set-put-elements.d.ts +10 -43
- package/dist/src/messages/responses/cache-sorted-set-put-elements.js +13 -34
- package/dist/src/messages/responses/cache-sorted-set-remove-element.d.ts +10 -43
- package/dist/src/messages/responses/cache-sorted-set-remove-element.js +13 -34
- package/dist/src/messages/responses/cache-sorted-set-remove-elements.d.ts +10 -43
- package/dist/src/messages/responses/cache-sorted-set-remove-elements.js +13 -34
- package/dist/src/messages/responses/enums/cache/index.d.ts +1 -0
- package/dist/src/messages/responses/enums/cache/index.js +2 -1
- package/dist/src/messages/responses/enums/cache/sorted-set/index.d.ts +50 -0
- package/dist/src/messages/responses/enums/cache/sorted-set/index.js +65 -0
- package/package.json +1 -1
@@ -1,29 +1,17 @@
|
|
1
|
-
import { ResponseBase } from './response-base';
|
1
|
+
import { ResponseBase, BaseResponseError, BaseResponseMiss } from './response-base';
|
2
|
+
import { CacheSortedSetGetRankResponse } from './enums';
|
2
3
|
import { SdkError } from '../../errors';
|
4
|
+
interface IResponse {
|
5
|
+
rank(): number | undefined;
|
6
|
+
readonly type: CacheSortedSetGetRankResponse;
|
7
|
+
}
|
3
8
|
/**
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Hit}
|
9
|
-
* - {Miss}
|
10
|
-
* - {Error}
|
11
|
-
*
|
12
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
13
|
-
* @example
|
14
|
-
* For example:
|
15
|
-
* ```
|
16
|
-
* if (response instanceof CacheSortedSetGetRank.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheSortedSetGetRank.Error` in this block, so you will have access to the properties
|
19
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
20
|
-
* }
|
21
|
-
* ```
|
9
|
+
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
10
|
+
* `rank()` accessor to retrieve rank.
|
22
11
|
*/
|
23
|
-
export declare
|
24
|
-
}
|
25
|
-
declare class _Hit extends Response {
|
12
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
26
13
|
private readonly _rank;
|
14
|
+
readonly type: CacheSortedSetGetRankResponse.Hit;
|
27
15
|
constructor(rank: number);
|
28
16
|
/**
|
29
17
|
* Returns the rank of the element in the sorted set. Ranks start at 0.
|
@@ -32,40 +20,14 @@ declare class _Hit extends Response {
|
|
32
20
|
rank(): number;
|
33
21
|
toString(): string;
|
34
22
|
}
|
35
|
-
declare const Hit_base: {
|
36
|
-
new (...args: any[]): {};
|
37
|
-
} & typeof _Hit;
|
38
|
-
/**
|
39
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
40
|
-
* `rank()` accessor to retrieve rank.
|
41
|
-
*/
|
42
|
-
export declare class Hit extends Hit_base {
|
43
|
-
}
|
44
|
-
declare class _Miss extends Response {
|
45
|
-
}
|
46
|
-
declare const Miss_base: {
|
47
|
-
new (...args: any[]): {
|
48
|
-
readonly is_miss: boolean;
|
49
|
-
};
|
50
|
-
} & typeof _Miss;
|
51
23
|
/**
|
52
24
|
* Indicates that the requested data was not available in the cache.
|
53
25
|
*/
|
54
|
-
export declare class Miss extends
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
constructor(_innerException: SdkError);
|
26
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
27
|
+
readonly type: CacheSortedSetGetRankResponse.Miss;
|
28
|
+
constructor();
|
29
|
+
rank(): undefined;
|
59
30
|
}
|
60
|
-
declare const Error_base: {
|
61
|
-
new (...args: any[]): {
|
62
|
-
_innerException: SdkError;
|
63
|
-
message(): string;
|
64
|
-
innerException(): SdkError;
|
65
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
66
|
-
toString(): string;
|
67
|
-
};
|
68
|
-
} & typeof _Error;
|
69
31
|
/**
|
70
32
|
* Indicates that an error occurred during the sorted set get rank request.
|
71
33
|
*
|
@@ -76,6 +38,10 @@ declare const Error_base: {
|
|
76
38
|
* - `message()` - a human-readable description of the error
|
77
39
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
78
40
|
*/
|
79
|
-
export declare class Error extends
|
41
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
42
|
+
readonly type: CacheSortedSetGetRankResponse.Error;
|
43
|
+
constructor(error: SdkError);
|
44
|
+
rank(): undefined;
|
80
45
|
}
|
46
|
+
export type Response = Hit | Miss | Error;
|
81
47
|
export {};
|
@@ -1,33 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.Miss = exports.Hit =
|
3
|
+
exports.Error = exports.Miss = exports.Hit = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
+
const enums_1 = require("./enums");
|
5
6
|
/**
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Hit}
|
11
|
-
* - {Miss}
|
12
|
-
* - {Error}
|
13
|
-
*
|
14
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
15
|
-
* @example
|
16
|
-
* For example:
|
17
|
-
* ```
|
18
|
-
* if (response instanceof CacheSortedSetGetRank.Error) {
|
19
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
-
* // `CacheSortedSetGetRank.Error` in this block, so you will have access to the properties
|
21
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
22
|
-
* }
|
23
|
-
* ```
|
7
|
+
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
8
|
+
* `rank()` accessor to retrieve rank.
|
24
9
|
*/
|
25
|
-
class
|
26
|
-
}
|
27
|
-
exports.Response = Response;
|
28
|
-
class _Hit extends Response {
|
10
|
+
class Hit extends response_base_1.ResponseBase {
|
29
11
|
constructor(rank) {
|
30
12
|
super();
|
13
|
+
this.type = enums_1.CacheSortedSetGetRankResponse.Hit;
|
31
14
|
this._rank = rank;
|
32
15
|
}
|
33
16
|
/**
|
@@ -41,27 +24,20 @@ class _Hit extends Response {
|
|
41
24
|
return `${super.toString()}: rank: ${this.rank()}`;
|
42
25
|
}
|
43
26
|
}
|
44
|
-
/**
|
45
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
46
|
-
* `rank()` accessor to retrieve rank.
|
47
|
-
*/
|
48
|
-
class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
|
49
|
-
}
|
50
27
|
exports.Hit = Hit;
|
51
|
-
class _Miss extends Response {
|
52
|
-
}
|
53
28
|
/**
|
54
29
|
* Indicates that the requested data was not available in the cache.
|
55
30
|
*/
|
56
|
-
class Miss extends
|
57
|
-
|
58
|
-
exports.Miss = Miss;
|
59
|
-
class _Error extends Response {
|
60
|
-
constructor(_innerException) {
|
31
|
+
class Miss extends response_base_1.BaseResponseMiss {
|
32
|
+
constructor() {
|
61
33
|
super();
|
62
|
-
this.
|
34
|
+
this.type = enums_1.CacheSortedSetGetRankResponse.Miss;
|
35
|
+
}
|
36
|
+
rank() {
|
37
|
+
return undefined;
|
63
38
|
}
|
64
39
|
}
|
40
|
+
exports.Miss = Miss;
|
65
41
|
/**
|
66
42
|
* Indicates that an error occurred during the sorted set get rank request.
|
67
43
|
*
|
@@ -72,7 +48,14 @@ class _Error extends Response {
|
|
72
48
|
* - `message()` - a human-readable description of the error
|
73
49
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
74
50
|
*/
|
75
|
-
class Error extends
|
51
|
+
class Error extends response_base_1.BaseResponseError {
|
52
|
+
constructor(error) {
|
53
|
+
super(error);
|
54
|
+
this.type = enums_1.CacheSortedSetGetRankResponse.Error;
|
55
|
+
}
|
56
|
+
rank() {
|
57
|
+
return undefined;
|
58
|
+
}
|
76
59
|
}
|
77
60
|
exports.Error = Error;
|
78
|
-
//# sourceMappingURL=data:application/json;base64,
|
61
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtc29ydGVkLXNldC1nZXQtcmFuay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvY2FjaGUtc29ydGVkLXNldC1nZXQtcmFuay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxtREFJeUI7QUFDekIsbUNBQXNEO0FBUXREOzs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mVhZGFibGUgZGVzY3JpcHRpb24gb2YgdGhlIGVycm9yXG4gKiAtIGBpbm5lckV4Y2VwdGlvbigpYCAtIHRoZSBvcmlnaW5hbCBlcnJvciB0aGF0IGNhdXNlZCB0aGUgZmFpbHVyZTsgY2FuIGJlIHJlLXRocm93bi5cbiAqL1xuZXhwb3J0IGNsYXNzIEVycm9yIGV4dGVuZHMgQmFzZVJlc3BvbnNlRXJyb3IgaW1wbGVtZW50cyBJUmVzcG9uc2Uge1xuICByZWFkb25seSB0eXBlOiBDYWNoZVNvcnRlZFNldEdldFJhbmtSZXNwb25zZS5FcnJvciA9XG4gICAgQ2FjaGVTb3J0ZWRTZXRHZXRSYW5rUmVzcG9uc2UuRXJyb3I7XG5cbiAgY29uc3RydWN0b3IoZXJyb3I6IFNka0Vycm9yKSB7XG4gICAgc3VwZXIoZXJyb3IpO1xuICB9XG5cbiAgcHVibGljIHJhbmsoKTogdW5kZWZpbmVkIHtcbiAgICByZXR1cm4gdW5kZWZpbmVkO1xuICB9XG59XG5cbmV4cG9ydCB0eXBlIFJlc3BvbnNlID0gSGl0IHwgTWlzcyB8IEVycm9yO1xuIl19
|
@@ -1,31 +1,18 @@
|
|
1
|
-
import { ResponseBase } from './response-base';
|
1
|
+
import { ResponseBase, BaseResponseMiss, BaseResponseError } from './response-base';
|
2
2
|
import { SdkError } from '../../errors';
|
3
|
-
|
4
|
-
|
5
|
-
* response object is resolved to a type-safe object of one of
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Hit}
|
9
|
-
* - {Miss}
|
10
|
-
* - {Error}
|
11
|
-
*
|
12
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
13
|
-
* @example
|
14
|
-
* For example:
|
15
|
-
* ```
|
16
|
-
* if (response instanceof CacheSortedSetGetScore.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheSortedSetGetScore.Error` in this block, so you will have access to the properties
|
19
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
20
|
-
* }
|
21
|
-
* ```
|
22
|
-
*/
|
23
|
-
export declare abstract class Response extends ResponseBase {
|
3
|
+
import { CacheSortedSetGetScoreResponse } from './enums';
|
4
|
+
interface IResponse {
|
24
5
|
score(): number | undefined;
|
6
|
+
readonly type: CacheSortedSetGetScoreResponse;
|
25
7
|
}
|
26
|
-
|
8
|
+
/**
|
9
|
+
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
10
|
+
* `score()` accessor to retrieve score.
|
11
|
+
*/
|
12
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
27
13
|
private readonly _value;
|
28
14
|
private readonly _score;
|
15
|
+
readonly type: CacheSortedSetGetScoreResponse.Hit;
|
29
16
|
constructor(score: number, value: Uint8Array);
|
30
17
|
/**
|
31
18
|
* Returns the value of the element in the sorted set as a Uint8Array.
|
@@ -33,30 +20,23 @@ declare class _Hit extends Response {
|
|
33
20
|
*/
|
34
21
|
valueUint8Array(): Uint8Array;
|
35
22
|
/**
|
36
|
-
* Returns the
|
23
|
+
* Returns the value of the element in the sorted set as a string.
|
37
24
|
* @returns {string}
|
38
25
|
*/
|
39
26
|
valueString(): string;
|
40
27
|
/**
|
41
|
-
*
|
42
|
-
*
|
28
|
+
* Returns the score of the element in the sorted set.
|
43
29
|
* @return {*} {number}
|
44
|
-
* @memberof _Hit
|
45
30
|
*/
|
46
31
|
score(): number;
|
47
32
|
toString(): string;
|
48
33
|
}
|
49
|
-
declare const Hit_base: {
|
50
|
-
new (...args: any[]): {};
|
51
|
-
} & typeof _Hit;
|
52
34
|
/**
|
53
|
-
* Indicates that the requested data was
|
54
|
-
* `score()` accessor to retrieve score.
|
35
|
+
* Indicates that the requested data was not available in the cache.
|
55
36
|
*/
|
56
|
-
export declare class
|
57
|
-
}
|
58
|
-
declare class _Miss extends Response {
|
37
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
59
38
|
private readonly _value;
|
39
|
+
readonly type: CacheSortedSetGetScoreResponse.Miss;
|
60
40
|
constructor(value: Uint8Array);
|
61
41
|
/**
|
62
42
|
* Returns the value of the element in the sorted set as a Uint8Array.
|
@@ -68,21 +48,22 @@ declare class _Miss extends Response {
|
|
68
48
|
* @returns {string}
|
69
49
|
*/
|
70
50
|
valueString(): string;
|
51
|
+
score(): undefined;
|
71
52
|
toString(): string;
|
72
53
|
}
|
73
|
-
declare const Miss_base: {
|
74
|
-
new (...args: any[]): {
|
75
|
-
readonly is_miss: boolean;
|
76
|
-
};
|
77
|
-
} & typeof _Miss;
|
78
54
|
/**
|
79
|
-
* Indicates that
|
55
|
+
* Indicates that an error occurred during the sorted set get score request.
|
56
|
+
*
|
57
|
+
* This response object includes the following fields that you can use to determine
|
58
|
+
* how you would like to handle the error:
|
59
|
+
*
|
60
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
61
|
+
* - `message()` - a human-readable description of the error
|
62
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
80
63
|
*/
|
81
|
-
export declare class
|
82
|
-
}
|
83
|
-
declare class _Error extends Response {
|
84
|
-
protected _innerException: SdkError;
|
64
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
85
65
|
private readonly _value;
|
66
|
+
readonly type: CacheSortedSetGetScoreResponse.Error;
|
86
67
|
constructor(_innerException: SdkError, value: Uint8Array);
|
87
68
|
/**
|
88
69
|
* Returns the value of the element in the sorted set as a Uint8Array.
|
@@ -94,31 +75,7 @@ declare class _Error extends Response {
|
|
94
75
|
* @returns {string}
|
95
76
|
*/
|
96
77
|
valueString(): string;
|
78
|
+
score(): undefined;
|
97
79
|
}
|
98
|
-
|
99
|
-
new (...args: any[]): {
|
100
|
-
_innerException: SdkError; /**
|
101
|
-
*
|
102
|
-
*
|
103
|
-
* @return {*} {number}
|
104
|
-
* @memberof _Hit
|
105
|
-
*/
|
106
|
-
message(): string;
|
107
|
-
innerException(): SdkError;
|
108
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
109
|
-
toString(): string;
|
110
|
-
};
|
111
|
-
} & typeof _Error;
|
112
|
-
/**
|
113
|
-
* Indicates that an error occurred during the sorted set get score request.
|
114
|
-
*
|
115
|
-
* This response object includes the following fields that you can use to determine
|
116
|
-
* how you would like to handle the error:
|
117
|
-
*
|
118
|
-
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
119
|
-
* - `message()` - a human-readable description of the error
|
120
|
-
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
121
|
-
*/
|
122
|
-
export declare class Error extends Error_base {
|
123
|
-
}
|
80
|
+
export type Response = Hit | Miss | Error;
|
124
81
|
export {};
|
@@ -1,39 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.Miss = exports.Hit =
|
3
|
+
exports.Error = exports.Miss = exports.Hit = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
+
const enums_1 = require("./enums");
|
5
6
|
/**
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Hit}
|
11
|
-
* - {Miss}
|
12
|
-
* - {Error}
|
13
|
-
*
|
14
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
15
|
-
* @example
|
16
|
-
* For example:
|
17
|
-
* ```
|
18
|
-
* if (response instanceof CacheSortedSetGetScore.Error) {
|
19
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
-
* // `CacheSortedSetGetScore.Error` in this block, so you will have access to the properties
|
21
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
22
|
-
* }
|
23
|
-
* ```
|
7
|
+
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
8
|
+
* `score()` accessor to retrieve score.
|
24
9
|
*/
|
25
|
-
class
|
26
|
-
score() {
|
27
|
-
if (this instanceof Hit) {
|
28
|
-
return this.score();
|
29
|
-
}
|
30
|
-
return undefined;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
exports.Response = Response;
|
34
|
-
class _Hit extends Response {
|
10
|
+
class Hit extends response_base_1.ResponseBase {
|
35
11
|
constructor(score, value) {
|
36
12
|
super();
|
13
|
+
this.type = enums_1.CacheSortedSetGetScoreResponse.Hit;
|
37
14
|
this._value = value;
|
38
15
|
this._score = score;
|
39
16
|
}
|
@@ -45,35 +22,31 @@ class _Hit extends Response {
|
|
45
22
|
return this._value;
|
46
23
|
}
|
47
24
|
/**
|
48
|
-
* Returns the
|
25
|
+
* Returns the value of the element in the sorted set as a string.
|
49
26
|
* @returns {string}
|
50
27
|
*/
|
51
28
|
valueString() {
|
52
29
|
return new TextDecoder().decode(this._value);
|
53
30
|
}
|
54
31
|
/**
|
55
|
-
*
|
56
|
-
*
|
32
|
+
* Returns the score of the element in the sorted set.
|
57
33
|
* @return {*} {number}
|
58
|
-
* @memberof _Hit
|
59
34
|
*/
|
60
35
|
score() {
|
61
36
|
return this._score;
|
62
37
|
}
|
63
38
|
toString() {
|
64
|
-
return `${super.toString()}: value: ${this.valueString()}
|
39
|
+
return `${super.toString()}: value: ${this.valueString()}`;
|
65
40
|
}
|
66
41
|
}
|
42
|
+
exports.Hit = Hit;
|
67
43
|
/**
|
68
|
-
* Indicates that the requested data was
|
69
|
-
* `score()` accessor to retrieve score.
|
44
|
+
* Indicates that the requested data was not available in the cache.
|
70
45
|
*/
|
71
|
-
class
|
72
|
-
}
|
73
|
-
exports.Hit = Hit;
|
74
|
-
class _Miss extends Response {
|
46
|
+
class Miss extends response_base_1.BaseResponseMiss {
|
75
47
|
constructor(value) {
|
76
48
|
super();
|
49
|
+
this.type = enums_1.CacheSortedSetGetScoreResponse.Miss;
|
77
50
|
this._value = value;
|
78
51
|
}
|
79
52
|
/**
|
@@ -90,20 +63,28 @@ class _Miss extends Response {
|
|
90
63
|
valueString() {
|
91
64
|
return new TextDecoder().decode(this._value);
|
92
65
|
}
|
66
|
+
score() {
|
67
|
+
return undefined;
|
68
|
+
}
|
93
69
|
toString() {
|
94
70
|
return `${super.toString()}: value: ${this.valueString()}`;
|
95
71
|
}
|
96
72
|
}
|
73
|
+
exports.Miss = Miss;
|
97
74
|
/**
|
98
|
-
* Indicates that
|
75
|
+
* Indicates that an error occurred during the sorted set get score request.
|
76
|
+
*
|
77
|
+
* This response object includes the following fields that you can use to determine
|
78
|
+
* how you would like to handle the error:
|
79
|
+
*
|
80
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
81
|
+
* - `message()` - a human-readable description of the error
|
82
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
99
83
|
*/
|
100
|
-
class
|
101
|
-
}
|
102
|
-
exports.Miss = Miss;
|
103
|
-
class _Error extends Response {
|
84
|
+
class Error extends response_base_1.BaseResponseError {
|
104
85
|
constructor(_innerException, value) {
|
105
|
-
super();
|
106
|
-
this.
|
86
|
+
super(_innerException);
|
87
|
+
this.type = enums_1.CacheSortedSetGetScoreResponse.Error;
|
107
88
|
this._value = value;
|
108
89
|
}
|
109
90
|
/**
|
@@ -120,18 +101,9 @@ class _Error extends Response {
|
|
120
101
|
valueString() {
|
121
102
|
return new TextDecoder().decode(this._value);
|
122
103
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
*
|
127
|
-
* This response object includes the following fields that you can use to determine
|
128
|
-
* how you would like to handle the error:
|
129
|
-
*
|
130
|
-
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
131
|
-
* - `message()` - a human-readable description of the error
|
132
|
-
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
133
|
-
*/
|
134
|
-
class Error extends (0, response_base_1.ResponseError)(_Error) {
|
104
|
+
score() {
|
105
|
+
return undefined;
|
106
|
+
}
|
135
107
|
}
|
136
108
|
exports.Error = Error;
|
137
|
-
//# sourceMappingURL=data:application/json;base64,
|
109
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtc29ydGVkLXNldC1nZXQtc2NvcmUuanMiLCJzb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cblxuICAvKipcbiAgICogUmV0dXJucyB0aGUgdmFsdWUgb2YgdGhlIGVsZW1lbnQgaW4gdGhlIHNvcnRlZCBzZXQgYXMgYSBVaW50OEFycmF5LlxuICAgKiBAcmV0dXJucyB7bnVtYmVyfVxuICAgKi9cbiAgcHVibGljIHZhbHVlVWludDhBcnJheSgpOiBVaW50OEFycmF5IHtcbiAgICByZXR1cm4gdGhpcy5fdmFsdWU7XG4gIH1cblxuICAvKipcbiAgICogUmV0dXJucyB0aGUgc2NvcmUgb2YgdGhlIGVsZW1lbnQgaW4gdGhlIHNvcnRlZCBzZXQgYXMgYSBzdHJpbmcuXG4gICAqIEByZXR1cm5zIHtzdHJpbmd9XG4gICAqL1xuICBwdWJsaWMgdmFsdWVTdHJpbmcoKTogc3RyaW5nIHtcbiAgICByZXR1cm4gbmV3IFRleHREZWNvZGVyKCkuZGVjb2RlKHRoaXMuX3ZhbHVlKTtcbiAgfVxuXG4gIHB1YmxpYyBzY29yZSgpOiB1bmRlZmluZWQge1xuICAgIHJldHVybiB1bmRlZmluZWQ7XG4gIH1cbn1cblxuZXhwb3J0IHR5cGUgUmVzcG9uc2UgPSBIaXQgfCBNaXNzIHwgRXJyb3I7XG4iXX0=
|
@@ -1,35 +1,21 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
3
|
-
import * as CacheSortedSetGetScoreResponse from './cache-sorted-set-get-score';
|
2
|
+
import { ResponseBase, BaseResponseMiss, BaseResponseError } from './response-base';
|
4
3
|
import { _SortedSetGetScoreResponsePart } from './grpc-response-types';
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
* response object is resolved to a type-safe object of one of
|
9
|
-
* the following subtypes:
|
10
|
-
*
|
11
|
-
* - {Hit}
|
12
|
-
* - {Miss}
|
13
|
-
* - {Error}
|
14
|
-
*
|
15
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
16
|
-
* @example
|
17
|
-
* For example:
|
18
|
-
* ```
|
19
|
-
* if (response instanceof CacheSortedSetGetScores.Error) {
|
20
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
21
|
-
* // `CacheSortedSetGetScores.Error` in this block, so you will have access to the properties
|
22
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
23
|
-
* }
|
24
|
-
* ```
|
25
|
-
*/
|
26
|
-
export declare abstract class Response extends ResponseBase {
|
4
|
+
import { CacheSortedSetGetScoresResponse } from './enums';
|
5
|
+
import { CacheSortedSetGetScore } from '../../index';
|
6
|
+
interface IResponse {
|
27
7
|
value(): Record<string, number> | undefined;
|
8
|
+
readonly type: CacheSortedSetGetScoresResponse;
|
28
9
|
}
|
29
|
-
|
30
|
-
|
10
|
+
/**
|
11
|
+
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
12
|
+
* `value*` accessors to retrieve the data in the appropriate format.
|
13
|
+
*/
|
14
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
15
|
+
private readonly _responses;
|
16
|
+
readonly type: CacheSortedSetGetScoresResponse.Hit;
|
31
17
|
constructor(scores: _SortedSetGetScoreResponsePart[], values: Uint8Array[]);
|
32
|
-
responses():
|
18
|
+
responses(): CacheSortedSetGetScore.Response[];
|
33
19
|
/**
|
34
20
|
* Returns the data as a Map whose keys are utf-8 strings, decoded from the underlying byte arrays and values are numbers.
|
35
21
|
* @returns {Map<string, number>}
|
@@ -63,40 +49,13 @@ declare class _Hit extends Response {
|
|
63
49
|
value(): Record<string, number>;
|
64
50
|
toString(): string;
|
65
51
|
}
|
66
|
-
declare const Hit_base: {
|
67
|
-
new (...args: any[]): {};
|
68
|
-
} & typeof _Hit;
|
69
|
-
/**
|
70
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
71
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
72
|
-
*/
|
73
|
-
export declare class Hit extends Hit_base {
|
74
|
-
}
|
75
|
-
declare class _Miss extends Response {
|
76
|
-
}
|
77
|
-
declare const Miss_base: {
|
78
|
-
new (...args: any[]): {
|
79
|
-
readonly is_miss: boolean;
|
80
|
-
};
|
81
|
-
} & typeof _Miss;
|
82
52
|
/**
|
83
53
|
* Indicates that the requested data was not available in the cache.
|
84
54
|
*/
|
85
|
-
export declare class Miss extends
|
86
|
-
|
87
|
-
|
88
|
-
_innerException: SdkError;
|
89
|
-
constructor(_innerException: SdkError);
|
55
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
56
|
+
readonly type: CacheSortedSetGetScoresResponse.Miss;
|
57
|
+
value(): undefined;
|
90
58
|
}
|
91
|
-
declare const Error_base: {
|
92
|
-
new (...args: any[]): {
|
93
|
-
_innerException: SdkError;
|
94
|
-
message(): string;
|
95
|
-
innerException(): SdkError;
|
96
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
97
|
-
toString(): string;
|
98
|
-
};
|
99
|
-
} & typeof _Error;
|
100
59
|
/**
|
101
60
|
* Indicates that an error occurred during the dictionary get fields request.
|
102
61
|
*
|
@@ -107,6 +66,10 @@ declare const Error_base: {
|
|
107
66
|
* - `message()` - a human-readable description of the error
|
108
67
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
109
68
|
*/
|
110
|
-
export declare class Error extends
|
69
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
70
|
+
readonly type: CacheSortedSetGetScoresResponse.Error;
|
71
|
+
constructor(_innerException: SdkError);
|
72
|
+
value(): undefined;
|
111
73
|
}
|
74
|
+
export type Response = Hit | Miss | Error;
|
112
75
|
export {};
|